jackwener/maka-agent

refactor(runtime): finish agent-run.ts extraction (prior-run context + status projection helpers)

Closed

#1,407 opened on Jul 23, 2026

 (1 comment) (0 reactions) (1 assignee)TypeScript (0 forks)github user discovery
enhancementgood first issue

Repository metrics

Stars
 (1 star)
PR merge metrics
 (PR metrics pending)

Description

Part of #1084 (second-pass sink-file and boundary governance). Half of the original slice already landed (session-projection-helpers.ts exists and is imported at agent-run.ts:38); this finishes the rest. Scope re-verified against current main (agent-run.ts, 1652 lines).

Scope

  • New prior-run-context.ts: PriorRuntimeContext (~L144), buildPriorRuntimeContext (~L977), buildResumedChildRuntimeContext (~L1061, added by #1329 — include this child variant), backfillMissingPriorRuntimeEvents (~L1159) and the repair/backfill helpers.
  • Move the remaining pure helpers into the existing session-projection-helpers.ts: isTerminalRunStatus (~L1591), statusFromEvent (~L1603), turnStatusFromEvent (~L1626), blockedReasonFromErrorReason (~L1645). No new file for these.

Invariants

Same as #1084: behavior-neutral; stable public exports via re-exports; no reverse imports; flat PR off main.

Verification

Typecheck/build + agent-run/session tests.

Contributor guide