githubnext/chopinPublic

Let's compose rich plans together

Admit the Pi harness after a real green contract

Wrap createPi() so structured output works: a synthetic host tool
captures the model's final answer, Pi's responseFormat never reaches
the published adapter (which throws HarnessCapabilityUnsupportedError
for it), and the outer stream still sees only host tool-calls plus one
synthesized text/finish-step. Every non-JSON turn, and every
built-in/abort/destroy guarantee, passes straight through unchanged.

Prove it against the real createPi() and a real local OpenAI-completions
model stub, not a mock: the contract suite's three guarantees now run
unconditionally and pass against the actual Pi agent loop, with no host
credential and no read of ~/.pi/agent/auth.json. Add pi to the harness
map with its own auth guard: HARNESS_AUTH is required, only Pi's
documented modes are accepted, direct is refused, and a non-loopback
bind allows only ai-gateway.

Verify interactively: with HARNESS=pi, HARNESS_AUTH=auto, and a real
Copilot-backed model, @chopin replies through the harness in the user's
Edge with an accurate repository-specific answer.

Fix AGENTS.md's stale E2E port/service summary and document Pi in
self-hosting, hosted-agent, and .env.example.

Part of #181 (slice 5 of 5).

Assistant-model: GPT-6 Sol
Assistant-workflow: harness-stack (run 5f1c7488-e4d3-40e8-8307-591dbcff5d63)
Assistant-duration: 95m converged, estimated 60m
Assistant-verification: Bun Pi adapter contract passed: real createPi via createPiAdapter against a local openai-completions stub, all 3 guarantees, stable across 5 consecutive runs
Assistant-verification: Bun focused unit passed: 5 adapter behavior tests (reserved-name collision, no-result rejection, host tool + output, no leak, plain-text pass-through) against a fake inner session
Assistant-verification: Bun focused unit passed: harnesses.test.ts covers both harness names and the Pi auth guard's loopback/mode clauses
Assistant-verification: Bun unit passed: mise exec -- bun test (1591 pass, 2 PostgreSQL skips)
Assistant-verification: Bun format passed: mise exec -- bun run fix (existing unrelated oxlint warning)
Assistant-verification: Bun ci passed: mise exec -- bun run ci (existing unrelated oxlint warning)
Assistant-verification: Bun typecheck passed: mise exec -- bun run types (all workspaces and E2E)
Assistant-verification: Playwright E2E failed: exact locked bun run e2e (229 pass, 2 AGENT=off UI timing failures; harness case passed)
Assistant-verification: Playwright CI-profile E2E passed: CI=1 locked bun run e2e (229 pass, 2 flaky recovered on retry)
Assistant-verification: agent-browser Edge E2E passed: HARNESS=pi HARNESS_AUTH=auto MODEL=github-copilot/gpt-5.6-luna, @chopin replied with an accurate README summary (5 tool calls, names collapsed; PR answer and foreign-repository check not captured)
Assistant-verification: qlty metrics and smells passed: new adapter and harness-map sources analyzed; existing complexity shape noted, not restructured
Co-authored-by: Alex Lavaee <lavaman131@github.com>
ALAlex Lavaee authored
d43063fPatch
Parent415101c
10 files changed+580-54
StackedSplit
.env.example+3 โˆ’1
AGENTS.md+8 โˆ’6
apps/server/src/harness/harnesses.test.ts+27 โˆ’4
apps/server/src/harness/harnesses.ts+25 โˆ’1
apps/server/src/harness/pi.contract.test.ts+39 โˆ’4
apps/server/src/harness/pi/adapter.test.ts+166 โˆ’0
apps/server/src/harness/pi/adapter.ts+174 โˆ’0
apps/server/src/harness/pi/model-stub.ts+89 โˆ’0
docs/hosted-agent.md+5 โˆ’3
docs/self-hosting.md+44 โˆ’35