githubnext/chopinPublic

Let's compose rich plans together

Enable Pi's result tool from turn state, not prompt text

The result-tool extension switched the tool on whenever the assembled
system prompt contained the structured-output instruction. Planner
instructions quote earlier chat, so a user who pasted that sentence
could make an ordinary reply end on a hidden, terminating tool call.

Each Pi session now gets its own extension state, which the session
wrapper sets from the turn's responseFormat before the turn starts.

Assistant-model: Claude Opus 5.5
Assistant-workflow: inline
Assistant-verification: bun test contract passed: real Pi plain turn with the instruction quoted in earlier chat does not offer the tool and answers normally
Assistant-verification: red check passed: the new contract test fails against the previous adapter with an empty reply
Assistant-verification: bun test passed: src/harness 95 pass, 0 fail
Assistant-verification: bun run types passed: all workspaces and E2E
Assistant-verification: bun run ci passed: dprint, oxlint, tokens
Co-authored-by: Alex Lavaee <lavaman131@github.com>
ALAlex Lavaee authored
fadb3e6Patch
Parent28b65ef
4 files changed+163-100
StackedSplit
apps/server/src/harness/pi.contract.test.ts+16 โˆ’2
apps/server/src/harness/pi/adapter.test.ts+92 โˆ’55
apps/server/src/harness/pi/adapter.ts+51 โˆ’40
docs/self-hosting.md+4 โˆ’3