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
+8 -2
View File
@@ -122,7 +122,8 @@ export interface AgentBuildOptions {
*
* Question results also carry terminate: true (tool-execute's
* questionResult), so single-question batches stop natively at the pi
* loop's own batch check; this shouldStopAfterTurn hook is the
* loop's own batch check; this finishTurn hook (0.87.1 rename of
* shouldStopAfterTurn) is the
* belt-and-suspenders HALF for the mixed batch (a question + other calls
* in one message) that terminate-only semantics would let run on — the
* learner cannot answer while a turn is in flight (per-chat 409), so a
@@ -164,7 +165,12 @@ function baseAgentOptions(kind: AgentKind, opts: AgentBuildOptions, tools: Agent
messages: opts.messages ?? [],
},
streamFn: engine.streamFn,
shouldStopAfterTurn: stopper,
// 0.87.1: shouldStopAfterTurn → finishTurn. Same call point (after
// tool results attach, before turn_end) and `{ action: "end" }` still
// exits BEFORE the steering poll — the parked-marker stranding our
// Wave C registerLiveAgent-before-runPiTurn design depends on.
// undefined preserves normal scheduling (the old boolean false).
finishTurn: (turn) => (stopper(turn) ? { action: "end" } : undefined),
// Wave C (2026-09-26, owner correction same day): markers handed to a
// live run drain from pi's STEERING queue — the lesson loop is one
// continuous teach→quiz→teach run, so delivery must inject at turn