Files
hack/tools/scripts/llm-key-hunter/results/_cache/content/artificemachine_pencil-sync.json
T

1 line
5.4 KiB
JSON

{"repo": "artificemachine/pencil-sync", "files": {"docs/ARCH-multi-provider-ai-runner.md": {"e5332f997890d945c211fdb84078de5fff919174": {"t": 1785746712.42295, "n": 2424, "h": "0e8b90ff546b5027", "c": "# Multi-Provider AI Runner Architecture\n\nProvider-agnostic design for pencil-sync's AI layer, enabling Anthropic, Gemini, DeepSeek, MiniMax, and OpenAI to be swapped via config.\n\n---\n\n## Structure\n\n```\npencil-sync\n├── pencil-mcp-client.ts ← provider-agnostic, talks to Pencil MCP\n└── ai/\n ├── runner.interface.ts ← AIRunner interface\n ├── anthropic.ts ← @anthropic-ai/sdk\n ├── openai-compat.ts ← @openai/openai — covers DeepSeek, MiniMax, OpenRouter\n └── google.ts ← @google/generative-ai — covers Gemini\n```\n\nThe MCP client layer is completely provider-agnostic — it calls the Pencil MCP binary regardless of which AI provider generates the `batch_design` script. Only the AI runner needs adapters.\n\n---\n\n## Provider Mapping\n\n| Tool / Provider | Runner | How |\n|---|---|---|\n| Claude Code / Anthropic | `anthropic.ts` | `ANTHROPIC_API_KEY` |\n| Gemini CLI / Gemini | `google.ts` | `GOOGLE_API_KEY` via `@google/generative-ai` |\n| OpenCode + DeepSeek | `openai-compat.ts` | `DEEPSEEK_API_KEY`, base URL `api.deepseek.com` |\n| OpenCode + MiniMax | `openai-compat.ts` | `MINIMAX_API_KEY`, base URL `api.minimax.chat/v1` |\n| Codex CLI / OpenAI | `openai-compat.ts` | `OPENAI_API_KEY`, default base URL |\n\nDeepSeek and MiniMax both expose OpenAI-compatible REST APIs. One `openai-compat.ts` runner covers all three by swapping `baseURL` and `apiKey` from config. No separate SDK needed per provider.\n\n---\n\n## Config Schema\n\n```json\n\"settings\": {\n \"aiProvider\": \"anthropic\" | \"openai-compatible\" | \"google\",\n \"model\": \"deepseek-coder\",\n \"apiKey\": \"${DEEPSEEK_API_KEY}\",\n \"apiBaseUrl\": \"https://api.deepseek.com\"\n}\n```\n\n`apiBaseUrl` is only required for `openai-compatible` providers. Anthropic and Google use their SDK defaults.\n\n---\n\n## AIRunner Interface\n\n```typescript\ninterface AIRunner {\n complete(prompt: string, options: RunOptions): Promise<string>;\n estimateCost(tokens: TokenUsage): number;\n}\n```\n\n`complete()` returns the generated `batch_design` JavaScript. `estimateCost()` enables budget enforcement. Every provider implements these two methods; pencil-sync does not care which provider answers.\n\n---\n\n## Dependencies\n\n```json\n\"@modelcontextprotocol/sdk\": \"^1.x\",\n\"@anthropic-ai/sdk\": \"^0.x\",\n\"openai\": \"^4.x\",\n\"@google/generative-ai\": \"^0.x\"\n```\n\nOnly the SDK matching the configured provider needs to be reachable at runtime. Others can be optional peer dependencies.\n"}, "fc871c3be3765588bae9ba777085bb5f55be8962": {"t": 1785767198.8500834, "n": 2424, "h": "0e8b90ff546b5027", "c": "# Multi-Provider AI Runner Architecture\n\nProvider-agnostic design for pencil-sync's AI layer, enabling Anthropic, Gemini, DeepSeek, MiniMax, and OpenAI to be swapped via config.\n\n---\n\n## Structure\n\n```\npencil-sync\n├── pencil-mcp-client.ts ← provider-agnostic, talks to Pencil MCP\n└── ai/\n ├── runner.interface.ts ← AIRunner interface\n ├── anthropic.ts ← @anthropic-ai/sdk\n ├── openai-compat.ts ← @openai/openai — covers DeepSeek, MiniMax, OpenRouter\n └── google.ts ← @google/generative-ai — covers Gemini\n```\n\nThe MCP client layer is completely provider-agnostic — it calls the Pencil MCP binary regardless of which AI provider generates the `batch_design` script. Only the AI runner needs adapters.\n\n---\n\n## Provider Mapping\n\n| Tool / Provider | Runner | How |\n|---|---|---|\n| Claude Code / Anthropic | `anthropic.ts` | `ANTHROPIC_API_KEY` |\n| Gemini CLI / Gemini | `google.ts` | `GOOGLE_API_KEY` via `@google/generative-ai` |\n| OpenCode + DeepSeek | `openai-compat.ts` | `DEEPSEEK_API_KEY`, base URL `api.deepseek.com` |\n| OpenCode + MiniMax | `openai-compat.ts` | `MINIMAX_API_KEY`, base URL `api.minimax.chat/v1` |\n| Codex CLI / OpenAI | `openai-compat.ts` | `OPENAI_API_KEY`, default base URL |\n\nDeepSeek and MiniMax both expose OpenAI-compatible REST APIs. One `openai-compat.ts` runner covers all three by swapping `baseURL` and `apiKey` from config. No separate SDK needed per provider.\n\n---\n\n## Config Schema\n\n```json\n\"settings\": {\n \"aiProvider\": \"anthropic\" | \"openai-compatible\" | \"google\",\n \"model\": \"deepseek-coder\",\n \"apiKey\": \"${DEEPSEEK_API_KEY}\",\n \"apiBaseUrl\": \"https://api.deepseek.com\"\n}\n```\n\n`apiBaseUrl` is only required for `openai-compatible` providers. Anthropic and Google use their SDK defaults.\n\n---\n\n## AIRunner Interface\n\n```typescript\ninterface AIRunner {\n complete(prompt: string, options: RunOptions): Promise<string>;\n estimateCost(tokens: TokenUsage): number;\n}\n```\n\n`complete()` returns the generated `batch_design` JavaScript. `estimateCost()` enables budget enforcement. Every provider implements these two methods; pencil-sync does not care which provider answers.\n\n---\n\n## Dependencies\n\n```json\n\"@modelcontextprotocol/sdk\": \"^1.x\",\n\"@anthropic-ai/sdk\": \"^0.x\",\n\"openai\": \"^4.x\",\n\"@google/generative-ai\": \"^0.x\"\n```\n\nOnly the SDK matching the configured provider needs to be reachable at runtime. Others can be optional peer dependencies.\n"}}}}