Skip to content

Instantly share code, notes, and snippets.

@gwythyr
gwythyr / index.ts
Created February 4, 2026 10:13
index.ts
import { calculateCost, createAssistantMessageEventStream, getModels, type AssistantMessage, type AssistantMessageEventStream, type Context, type ImageContent, type Model, type SimpleStreamOptions, type Tool } from "@mariozechner/pi-ai";
import { AuthStorage, type ExtensionAPI } from "@mariozechner/pi-coding-agent";
import { createSdkMcpServer, query, type SDKMessage, type SDKUserMessage, type SettingSource } from "@anthropic-ai/claude-agent-sdk";
import type { Base64ImageSource, CacheControlEphemeral, ContentBlockParam, ImageBlockParam, MessageParam, TextBlockParam } from "@anthropic-ai/sdk/resources";
import { pascalCase } from "change-case";
import { existsSync, readFileSync } from "fs";
import { homedir } from "os";
import { dirname, join, relative, resolve } from "path";
const PROVIDER_ID = "claude-agent-sdk";
@gwythyr
gwythyr / custom-prompt.ts
Last active February 4, 2026 12:02
Customize prompt for Claude Code compatibility
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
const PI_TO_SDK_TOOL_NAME: Record<string, string> = {
read: "Read",
write: "Write",
edit: "Edit",
bash: "Bash",
grep: "Grep",
find: "Glob",
glob: "Glob",