chore: pi family 0.85.1 -> 0.87.1 (finishTurn, transcript contexts, typebox 1.3.27)

Mechanical fallout only; semantic deltas flagged in the wave report:
- shouldStopAfterTurn -> finishTurn ({action:'end'} wrap; loop order verified
  equivalent for Wave C stranding)
- transcript rework: seeded leading SystemMessage filtered at both
  state.messages read seams (ui-stream settleWith, pi-run slice); prompt
  and tool declarations now ride the transcript
- streamOnce sites normalizeContext() (Context -> TranscriptContext)
- AgentToolResult details / ToolCall.arguments JsonValue narrowing (casts)
- AUTH_PROVIDER_KEYS regenerated (meta added); glm-5.3-flash price pin
  follows the 0.87.1 catalog (0.15/0.5/0.05)
- vanish probe: 0/12 vs 2/6 baseline; live smoke green on PORT=3004
This commit is contained in:
amosblomqvist
2026-09-26 21:45:51 +03:00
parent 9853075331
commit 876185eb6e
12 changed files with 329 additions and 850 deletions
+11 -1
View File
@@ -115,8 +115,18 @@ export function runPiTurn(spec: PiTurnSpec): PiTurnHandle {
// The settle seam: the record write is the agent's OWN final state
// (native history — signatures, usage, provider stamps all real).
// Copy the array: the agent may outlive this call's read.
// 0.87.1 (transcript rework): the Agent seeds a leading SystemMessage
// from initialState.systemPrompt (prompt + tool declarations) — it is
// synthesized per turn and must NEVER persist (the record would bloat
// with tool declarations AND replay would see messages[0] === system,
// suppressing the fresh per-turn re-seed). Our app mints no system
// messages of its own (the prompt is composed per turn), so dropping
// the role wholesale is exact; revisit if prompt-updates ever land.
const settleWith = () => {
onFinish([...agent.state.messages], sawAbort);
onFinish(
[...agent.state.messages].filter((m) => (m as { role?: string }).role !== "system"),
sawAbort,
);
};
const handle = (event: AgentEvent) => {