Skip to content

feat(agents): add pi adapter#138

Closed
yyovil wants to merge 1 commit into
agents/18-vibefrom
agents/19-pi
Closed

feat(agents): add pi adapter#138
yyovil wants to merge 1 commit into
agents/18-vibefrom
agents/19-pi

Conversation

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Jun 6, 2026

Greptile Summary

This PR introduces the Pi agent adapter (@earendil-works/pi-coding-agent), following the same structure as the existing adapters (claudecode, kiro, etc.). It registers the new adapter in Constructors() and adds a wiring test entry for resolver coverage.

  • pi.go: Implements all required ports.Agent methods — GetLaunchCommand (with correct file-content inlining for SystemPromptFile), GetRestoreCommand (using --session <id>), GetAgentHooks and SessionInfo as documented no-ops, plus a binary resolver with PATH + common-install-location fallback.
  • registry.go / wiring_test.go: pi.New() added to Constructors() and domain.HarnessPi → "pi" added to the resolver integration test.

Confidence Score: 5/5

Safe to merge — the adapter is a clean additive change, all required interface methods are implemented correctly, and the previously reported SystemPromptFile issue has been fixed.

The adapter correctly inlines system-prompt file contents rather than forwarding the path, binary resolution is cached safely under a mutex, context cancellation is propagated through every public method, and the wiring test confirms end-to-end resolver coverage. No pre-existing functionality is altered.

No files require special attention.

Important Files Changed

Filename Overview
backend/internal/adapters/agent/pi/pi.go New Pi adapter; correctly reads SystemPromptFile contents (not the path) into --append-system-prompt; binary resolution and caching consistent with other adapters.
backend/internal/adapters/agent/pi/pi_test.go Comprehensive unit tests covering manifest, launch command variants, system prompt inlining, restore, no-op hooks/SessionInfo, and context cancellation paths.
backend/internal/adapters/agent/registry/registry.go Adds pi.New() to Constructors(); change is minimal and consistent with all other adapter registrations.
backend/internal/daemon/wiring_test.go Adds domain.HarnessPi → "pi" resolver entry to the integration test, matching the existing pattern for all other harnesses.

Sequence Diagram

sequenceDiagram
    participant AO as AO Spawn Engine
    participant Plugin as pi.Plugin
    participant FS as Filesystem
    participant Pi as pi binary

    AO->>Plugin: GetLaunchCommand(ctx, LaunchConfig)
    Plugin->>Plugin: "piBinary(ctx) — resolve & cache"
    alt SystemPromptFile set
        Plugin->>FS: os.ReadFile(cfg.SystemPromptFile)
        FS-->>Plugin: []byte contents
    end
    Plugin-->>AO: "["pi","--print","--append-system-prompt","<text>","<prompt>"]"
    AO->>Pi: exec(cmd)

    AO->>Plugin: GetRestoreCommand(ctx, RestoreConfig)
    Plugin->>Plugin: read MetadataKeyAgentSessionID from session metadata
    alt agentSessionID known
        Plugin-->>AO: "["pi","--print","--session","<uuid>"], ok=true"
        AO->>Pi: exec(restore cmd)
    else no agentSessionID
        Plugin-->>AO: "nil, ok=false"
        AO->>AO: fall back to fresh launch
    end
Loading

Reviews (2): Last reviewed commit: "feat(agents): add pi adapter" | Re-trigger Greptile

Comment thread backend/internal/adapters/agent/pi/pi.go Outdated
Registers the pi harness, stacked on the agent platform.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants