feat(protocol): add step-level timing (startedAtMs / completedAtMs) (#489)

BREAKING CHANGE: StepRecord now requires startedAtMs and completedAtMs fields.
StepEntry now requires durationMs field. Old CAS data without these fields is invalid.

- Add startedAtMs/completedAtMs to StepRecord and StepNodePayload
- Add durationMs to StepEntry (computed: completedAtMs - startedAtMs)
- Update STEP_NODE_SCHEMA to require timing fields as integers
- Record Date.now() before/after agent execution in createAgent
- Show duration in thread read headers (formatStepHeader)
- Update existing test fixtures with timing fields
This commit is contained in:
2026-05-25 08:01:50 +00:00
parent 3fca67e443
commit 45f479e60f
10 changed files with 465 additions and 5 deletions
@@ -58,6 +58,7 @@ export async function cmdStepList(
detail: item.payload.detail ?? null,
agent: item.payload.agent,
timestamp: item.timestamp,
durationMs: item.payload.completedAtMs - item.payload.startedAtMs,
});
}