Migrate to Pi Coding Agent SDK for multi-provider LLM support

Replace the custom Pi API fetch client with the @earendil-works/pi-coding-agent
SDK, enabling support for multiple LLM providers (Anthropic, OpenAI, DeepSeek,
Google Gemini, xAI/ZAI) while maintaining backward compatibility.

Key changes:
- Add piSdk.ts with SDK session management and provider auto-detection
- Refactor client.ts to delegate to SDK adapter, keeping public API surface
- Update documentation to reflect multi-provider environment variables
- Add RPC contracts for LLM model selection and provider configuration
- Update agent runner to support provider-specific tools and parameters

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-15 00:17:26 -04:00
parent 506d092b2b
commit 0624026af3
30 changed files with 4326 additions and 354 deletions

View File

@@ -6,21 +6,29 @@ Use the attached **MosaicIQ Design Document v3** as the primary reference for pr
## Required Environment Variables
**`PI_API_KEY` is required.** This application uses the Pi API (Inflection AI) for all LLM operations. The application will not function without this key set.
**An LLM provider API key is required.** This application uses the Pi Coding Agent SDK for all LLM operations. Set at least one of the following:
```bash
export PI_API_KEY=your_pi_api_key_here
export ANTHROPIC_API_KEY=sk-ant-...
# or
export OPENAI_API_KEY=sk-...
# or
export DEEPSEEK_API_KEY=...
# or
export GOOGLE_API_KEY=...
# or
export ZAI_API_KEY=...
```
### API Details
- **Provider**: Pi (Inflection AI)
- **Base URL**: `https://api.pi.ai/v1/chat/completions`
- **Client**: Custom fetch-based client in `packages/shared/src/llm/client.ts`
- **Model**: `pi` (default)
- **Features**: Streaming and non-streaming completions, structured JSON responses
- **SDK**: `@earendil-works/pi-coding-agent` — multi-provider agent framework
- **Providers**: Anthropic, OpenAI, DeepSeek, Google Gemini, xAI/ZAI, and more
- **Client**: SDK-backed client in `packages/shared/src/llm/piSdk.ts`
- **Default model**: First available from configured provider (prefers Anthropic)
- **Features**: Streaming, tool use, structured output, multi-agent pipelines
All agent execution, memo generation, and AI-powered features depend on this API key.
All agent execution, memo generation, and AI-powered features depend on at least one provider API key.
## Core Direction