feat(agent): durable execution ledger and kill recovery cases (S08)
Part of #4997.
Summary
Adds the S08 execution endpoint ledger over DurableStore. The ledger commits each transition before returning, binds identities to issuer/command/generation/scope, preserves immutable terminal outcomes, retains dedup identity after ACK, and handles lease renewal and restart recovery.
This is an inert foundation. The agent loop does not call it yet. S18a is a separate stacked PR.
Acceptance and evidence
At head 889b94d038f3f084ed15d5222b83c229a6bfcad4, the gated push ran:
| Obligation | Evidence | Result |
|---|---|---|
| R19/F42, S08 projection | cd packages/agent && bun run test -- test/execution test/durable/store-conformance.test.ts test/conformance | 5 files, 124 tests passed |
| Endpoint rules | LEDGER-01..12 | Identity, effect boundary, consent wait, at-most-once dispatch, terminal ordering, renewal, ACK, restart and epoch fencing |
| KILL-LEDGER | 64 cases: 16 transitions, each cut before commit, at both writes, and after durability | All passed in the targeted run |
| Static checks | bun check --no-script --all -p tsconfig.json | No type errors in 7,672 files |
| Scoped lint and format | oxlint --deny-warnings, oxfmt --check, all changed TypeScript files | Both exit 0 |
| Z1.G | No default-path caller added; runtime EQ remains a parent-owned phase gate | Not claimed as an EQ pass |
| Z3.pr | New modules are reachable from the conformance export; no ignores, suppressed diagnostics or weakened tests | Full knip and CI-equivalent checks remain parent-owned |
| MA-D | Portable StoreConformanceAdapter cases and exported kill declarations | Full DO/Bun comparison, mutation proof and conformance review remain parent-owned |
At that same head, the actual Bun SQLite host also passed the entire registered conformance suite through CONFORMANCE_HOST=bun-sqlite bun ../../node_modules/vitest/vitest.mjs run test/conformance/run-suite.test.ts (6 wrapper tests passed, including the host test that runs every registered case). This proves this host run, not the separate phase-level DO/Bun comparison gate.
RED: the new endpoint test failed because src/execution/ledger.ts did not exist. The first GREEN run exposed the expected stale public-export inventory; that test and the host implementation map were updated to include the new public conformance cases.
Contract decisions
The ledger receives authenticated actor identities and the store owner's shared admission line; it does not invent a second writer lock or transport authorization layer. Only an applied response whose state is dispatched permits body execution. Expired requests return their terminal lease outcome instead.
Prepared, consent-waiting and released calls survive restart. Preparing calls terminate rather than rerun hooks. Reconcilable dispatched calls get one durable 30-second grace window, bounded by the lease; another restart cannot extend it.
Remaining integration gates
Review and merge are parent-owned. This PR does not claim phase-level EQ, whole-suite CI, DO comparison or mutation evidence. The tracking issue stays open until those acceptance obligations are proven.