feat(server): replace Pi ACP with direct SDK provider#202
Open
feat(server): replace Pi ACP with direct SDK provider#202
Conversation
Replace the ACP-based Pi provider (which spawned a `pi-acp` subprocess and talked JSON-RPC over stdio) with a direct in-process integration using `@mariozechner/pi-coding-agent` as a library. The new `PiDirectAgentClient` and `PiDirectAgentSession` use the Pi SDK directly — creating sessions via `createAgentSession()`, managing models via `ModelRegistry`, and mapping Pi's `AgentSessionEvent` stream to Paseo's `AgentStreamEvent` types including: - Thread/turn lifecycle events - Assistant text and thinking/reasoning deltas - Tool execution (bash, read, write, edit, find, grep, ls) with arg caching across start/update/end events - Compaction events - Session persistence and resume via `SessionManager` Thinking levels flow through the existing `thinkingOptionId` / `setThinkingOption()` infrastructure, not through features. Includes 9 real e2e tests against a live Pi agent covering tool calls (bash/read/write/edit), reasoning chunks, session persistence/resume, model listing, and thinking option management. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Address coding standards violations in pi-direct-agent.ts: - Replace all `as Record<string, unknown>` / `as any` / `as unknown as` casts with properly typed boundaries using Pi SDK's exported tool input types (BashToolInput, ReadToolInput, EditToolInput, etc.) - Introduce named interfaces at all boundaries: PiPromptPayload, ToolCallOutputSummary, PiModelReference, PiPersistenceMetadata - Parse tool args once at boundary into typed discriminated union, then trust types internally — no more typeof probing in mappers - Break all dense ternary chains into named steps / helper functions - Import SDK types directly (RegisteredCommand, ResourceLoader, Skill) instead of casting through anonymous inline shapes - Isolate the system prompt SDK escape hatch into a minimal boundary helper with a named interface Behavior is preserved — all 9 real e2e tests still pass. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pi-acpsubprocess and talked JSON-RPC over stdio) with a direct in-process integration using@mariozechner/pi-coding-agentas a libraryPiDirectAgentClient+PiDirectAgentSessionmap Pi'sAgentSessionEventstream to Paseo'sAgentStreamEventtypes — tool execution, text/reasoning deltas, compaction, persistencethinkingOptionId/setThinkingOption()infrastructureTest plan
npm run typecheckpasses clean🤖 Generated with Claude Code