@terreno/mcp 57.8.0 → 57.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/dist/docs/upgrades/57.10.1.md +54 -0
  2. package/dist/docs/upgrades/57.9.0.md +28 -0
  3. package/dist/docs/versioned/next/README.md +1 -0
  4. package/dist/docs/versioned/next/explanation/README.md +4 -0
  5. package/dist/docs/versioned/next/explanation/admin-plugin-frontend.md +2 -2
  6. package/dist/docs/versioned/next/explanation/agent-ui-asks.md +299 -0
  7. package/dist/docs/versioned/next/explanation/agent-ui-blocks.md +67 -0
  8. package/dist/docs/versioned/next/explanation/ai-observability.md +101 -0
  9. package/dist/docs/versioned/next/explanation/charts.md +12 -0
  10. package/dist/docs/versioned/next/explanation/durable-agent-harness.md +531 -0
  11. package/dist/docs/versioned/next/explanation/example-coverage.md +4 -2
  12. package/dist/docs/versioned/next/explanation/loop-engineering.md +1 -1
  13. package/dist/docs/versioned/next/explanation/roadmap-seed-issues.md +49 -1
  14. package/dist/docs/versioned/next/explanation/typescript-configuration.md +1 -1
  15. package/dist/docs/versioned/next/explanation/versioning-policy.md +1 -1
  16. package/dist/docs/versioned/next/how-to/README.md +7 -1
  17. package/dist/docs/versioned/next/how-to/admin-import-prebuilt.md +1 -1
  18. package/dist/docs/versioned/next/how-to/agent-ui-asks.md +730 -0
  19. package/dist/docs/versioned/next/how-to/agent-ui-blocks.md +104 -0
  20. package/dist/docs/versioned/next/how-to/ai-feature-development.md +156 -0
  21. package/dist/docs/versioned/next/how-to/build-a-durable-workflow.md +232 -0
  22. package/dist/docs/versioned/next/how-to/charts-and-dashboards.md +7 -0
  23. package/dist/docs/versioned/next/how-to/circleci.md +9 -6
  24. package/dist/docs/versioned/next/how-to/compare-chart-rendered-snapshots.md +8 -0
  25. package/dist/docs/versioned/next/how-to/install-agent-skills.md +1 -1
  26. package/dist/docs/versioned/next/how-to/observe-llm-calls.md +197 -0
  27. package/dist/docs/versioned/next/how-to/run-tests-locally.md +2 -1
  28. package/dist/docs/versioned/next/how-to/ship-a-new-task-version.md +76 -0
  29. package/dist/docs/versioned/next/how-to/upgrade-terreno.md +1 -1
  30. package/dist/docs/versioned/next/implementationPlans/agent-ui-asks.md +688 -0
  31. package/dist/docs/versioned/next/implementationPlans/agent-ui-blocks.md +10 -6
  32. package/dist/docs/versioned/next/implementationPlans/ai-observability.md +475 -157
  33. package/dist/docs/versioned/next/implementationPlans/b2b-platform-program.md +1 -1
  34. package/dist/docs/versioned/next/implementationPlans/charts-and-dashboards.md +3 -2
  35. package/dist/docs/versioned/next/implementationPlans/dashboard-chart-parity.md +275 -0
  36. package/dist/docs/versioned/next/implementationPlans/durable-agent-harness.md +340 -0
  37. package/dist/docs/versioned/next/implementationPlans/terreno-langfuse-integration.md +1 -1
  38. package/dist/docs/versioned/next/reference/README.md +3 -0
  39. package/dist/docs/versioned/next/reference/admin-config.md +2 -0
  40. package/dist/docs/versioned/next/reference/admin-frontend.md +216 -0
  41. package/dist/docs/versioned/next/reference/agent-ui-asks.md +1059 -0
  42. package/dist/docs/versioned/next/reference/ai-harness.md +1881 -0
  43. package/dist/docs/versioned/next/reference/ai.md +283 -28
  44. package/dist/docs/versioned/next/reference/api.md +46 -0
  45. package/dist/docs/versioned/next/reference/blocks.md +178 -0
  46. package/dist/docs/versioned/next/reference/environment-variables.md +2 -1
  47. package/dist/docs/versioned/next/reference/feature-flags.md +1 -1
  48. package/dist/docs/versioned/next/reference/mcp-server.md +17 -0
  49. package/dist/docs/versioned/next/reference/test.md +11 -2
  50. package/dist/docs/versioned/next/reference/ui.md +418 -11
  51. package/dist/docs/versioned/next/tasks/agent-ui-asks.md +213 -0
  52. package/dist/docs/versioned/next/tasks/agent-ui-blocks.md +2 -1
  53. package/dist/docs/versioned/next/tasks/ai-observability.md +233 -104
  54. package/dist/docs/versioned/next/tasks/dashboard-chart-parity.md +145 -0
  55. package/dist/docs/versioned/next/tasks/durable-agent-harness.md +183 -0
  56. package/dist/tools.d.ts +4 -0
  57. package/dist/tools.d.ts.map +1 -1
  58. package/dist/tools.js +37 -0
  59. package/dist/tools.js.map +1 -1
  60. package/package.json +3 -2
  61. package/src/docs/upgrades/57.10.1.md +54 -0
  62. package/src/docs/upgrades/57.9.0.md +28 -0
  63. package/src/docs/versioned/next/README.md +1 -0
  64. package/src/docs/versioned/next/explanation/README.md +4 -0
  65. package/src/docs/versioned/next/explanation/admin-plugin-frontend.md +2 -2
  66. package/src/docs/versioned/next/explanation/agent-ui-asks.md +299 -0
  67. package/src/docs/versioned/next/explanation/agent-ui-blocks.md +67 -0
  68. package/src/docs/versioned/next/explanation/ai-observability.md +101 -0
  69. package/src/docs/versioned/next/explanation/charts.md +12 -0
  70. package/src/docs/versioned/next/explanation/durable-agent-harness.md +531 -0
  71. package/src/docs/versioned/next/explanation/example-coverage.md +4 -2
  72. package/src/docs/versioned/next/explanation/loop-engineering.md +1 -1
  73. package/src/docs/versioned/next/explanation/roadmap-seed-issues.md +49 -1
  74. package/src/docs/versioned/next/explanation/typescript-configuration.md +1 -1
  75. package/src/docs/versioned/next/explanation/versioning-policy.md +1 -1
  76. package/src/docs/versioned/next/how-to/README.md +7 -1
  77. package/src/docs/versioned/next/how-to/admin-import-prebuilt.md +1 -1
  78. package/src/docs/versioned/next/how-to/agent-ui-asks.md +730 -0
  79. package/src/docs/versioned/next/how-to/agent-ui-blocks.md +104 -0
  80. package/src/docs/versioned/next/how-to/ai-feature-development.md +156 -0
  81. package/src/docs/versioned/next/how-to/build-a-durable-workflow.md +232 -0
  82. package/src/docs/versioned/next/how-to/charts-and-dashboards.md +7 -0
  83. package/src/docs/versioned/next/how-to/circleci.md +9 -6
  84. package/src/docs/versioned/next/how-to/compare-chart-rendered-snapshots.md +8 -0
  85. package/src/docs/versioned/next/how-to/install-agent-skills.md +1 -1
  86. package/src/docs/versioned/next/how-to/observe-llm-calls.md +197 -0
  87. package/src/docs/versioned/next/how-to/run-tests-locally.md +2 -1
  88. package/src/docs/versioned/next/how-to/ship-a-new-task-version.md +76 -0
  89. package/src/docs/versioned/next/how-to/upgrade-terreno.md +1 -1
  90. package/src/docs/versioned/next/implementationPlans/agent-ui-asks.md +688 -0
  91. package/src/docs/versioned/next/implementationPlans/agent-ui-blocks.md +10 -6
  92. package/src/docs/versioned/next/implementationPlans/ai-observability.md +475 -157
  93. package/src/docs/versioned/next/implementationPlans/b2b-platform-program.md +1 -1
  94. package/src/docs/versioned/next/implementationPlans/charts-and-dashboards.md +3 -2
  95. package/src/docs/versioned/next/implementationPlans/dashboard-chart-parity.md +275 -0
  96. package/src/docs/versioned/next/implementationPlans/durable-agent-harness.md +340 -0
  97. package/src/docs/versioned/next/implementationPlans/terreno-langfuse-integration.md +1 -1
  98. package/src/docs/versioned/next/reference/README.md +3 -0
  99. package/src/docs/versioned/next/reference/admin-config.md +2 -0
  100. package/src/docs/versioned/next/reference/admin-frontend.md +216 -0
  101. package/src/docs/versioned/next/reference/agent-ui-asks.md +1059 -0
  102. package/src/docs/versioned/next/reference/ai-harness.md +1881 -0
  103. package/src/docs/versioned/next/reference/ai.md +283 -28
  104. package/src/docs/versioned/next/reference/api.md +46 -0
  105. package/src/docs/versioned/next/reference/blocks.md +178 -0
  106. package/src/docs/versioned/next/reference/environment-variables.md +2 -1
  107. package/src/docs/versioned/next/reference/feature-flags.md +1 -1
  108. package/src/docs/versioned/next/reference/mcp-server.md +17 -0
  109. package/src/docs/versioned/next/reference/test.md +11 -2
  110. package/src/docs/versioned/next/reference/ui.md +418 -11
  111. package/src/docs/versioned/next/tasks/agent-ui-asks.md +213 -0
  112. package/src/docs/versioned/next/tasks/agent-ui-blocks.md +2 -1
  113. package/src/docs/versioned/next/tasks/ai-observability.md +233 -104
  114. package/src/docs/versioned/next/tasks/dashboard-chart-parity.md +145 -0
  115. package/src/docs/versioned/next/tasks/durable-agent-harness.md +183 -0
@@ -0,0 +1,183 @@
1
+ # Tasks: Durable agent harness
2
+
3
+ IP: [durable-agent-harness.md](../implementationPlans/durable-agent-harness.md)
4
+ **Feature profile:** false (full IP)
5
+ **Base branch:** `cursor/ai-observability-ip-64ca` (rebase as it lands)
6
+ **First PR scope:** Phases 1–2. Phases 3–5 ship in follow-up PRs.
7
+
8
+ ## Resume here (paused 2026-10-03)
9
+
10
+ The Pick ⇄ Roast loop is paused after Phase 1. Tasks 1.1–1.12 are Roast-verified, one commit each.
11
+
12
+ 1. **Sync the base.** `git fetch origin && git merge origin/cursor/ai-observability-ip-64ca`.
13
+ At pause it was 5+ commits ahead, including a master merge and "Preserve AI observability
14
+ across chat turn refactor", which touches `ai/`. Re-run `cd ai && bun run test:ci` after the merge.
15
+ 2. **Resume the loop** with `/terreno:pick-roast-loop` (or `terreno-pick-roast-loop`) at
16
+ **Task 2.0**, then 2.1, then 2.2. Each task is Pick, then an independent Roast, then one commit.
17
+ 3. **Brew when Phase 2 is done.** Run the full independent branch review that was deferred at
18
+ pause, take the PR out of draft, then Taste.
19
+
20
+ Known environment notes from Phase 1:
21
+
22
+ - `/tmp` in the cloud VM is a 1 GB tmpfs, and in-memory replica sets use about 200 MB each. Run Mongo
23
+ test suites sequentially and delete leftover `/tmp/mongo-mem-*` directories after killed runs.
24
+ - `example-backend` seed-heavy tests can hit Bun's 5 s default timeout under load. This also
25
+ happens on the base branch.
26
+ - In the root `bun run lint`, `check:explicit-any:lint` requires a `// noExplicitAny: <reason>` line
27
+ above every `biome-ignore … noExplicitAny`.
28
+
29
+ Every task: bun tests in `ai/` against the in-memory replica set from `@terreno/test`; real
30
+ models are replaced by the mock model pattern in `.claude/rules/ai/00-ai.md`. Docs pages are
31
+ created in 1.1 and extended by every later task — never deferred.
32
+
33
+ ## Phase 1 — Durable clinical tracer
34
+
35
+ - [x] **Task 1.1**: Harness subpath + `defineTask` + transactional checkpoint/span (tracer)
36
+ - Delivers: `@terreno/ai/harness` export; `HarnessTask` model; `defineTask` with phases; `InProcessRunner` (no lease yet) runs a two-phase task to `completed`; `rt.commit` writes task + `ObsSpan` + root `ObsTrace` in one transaction; `Harness.open` throws without local observability plugin or without a replica set
37
+ - Files: `ai/package.json`, `ai/src/harness/harness.ts`, `defineTask.ts`, `runtime.ts`, `commit.ts`, `runners/inProcessRunner.ts`, `models/harnessTask.ts`, `ai/src/types/harness.ts`, tests
38
+ - Blocked by: none
39
+ - Skills: `terreno-backend-api`, `mongoose-schema-safety`, `backend-test-env`
40
+ - Docs: create `docs/explanation/durable-agent-harness.md` (concepts table), `docs/reference/ai-harness.md` (`defineTask`, `Harness.open`, `rt.commit`), link from `docs/reference/ai.md`
41
+ - Acceptance: AC1 — bun test asserts one CHAIN span per phase; forced throw inside the transaction leaves neither task update nor span
42
+
43
+ - [x] **Task 1.2**: Owner lease, crash resume, replay semantics
44
+ - Delivers: `HarnessOwner` lease + heartbeat; standby second process; task leases with fencing token; resume on `start()`; per-phase `replay`; `interrupted` status; `harness.resolveInterrupted(taskId, action)`
45
+ - Files: `runners/inProcessRunner.ts`, `models/harnessOwner.ts`, `runtime.ts`, `commit.ts`, tests
46
+ - Blocked by: 1.1
47
+ - Skills: `terreno-backend-api`, `backend-test-env`
48
+ - Docs: reference "Replay and interruption" table; explanation section on leases
49
+ - Acceptance: AC2 + AC3 (phase rows) — simulate death by abandoning a harness mid-phase with an expired lease; new harness resumes safe phase and parks `never` phase as `interrupted`; stale-token commit rejected
50
+
51
+ - [x] **Task 1.3**: Retries, failure, abort + ownership tree
52
+ - Delivers: task `retry` policy with backoff+jitter (Luxon), `failed` after `maxAttempts`; `rt.createTask` child ownership; `harness.abort` bottom-up with `abort` handlers; `rt.waitForTasks` (`all` / `failFast`); `background` flag
53
+ - Files: `runtime.ts`, `retryBackoff.ts`, `ownership.ts`, tests
54
+ - Blocked by: 1.2
55
+ - Skills: `terreno-backend-api`
56
+ - Docs: reference retry/abort/ownership; explanation ownership tree
57
+ - Acceptance: AC4 (phase retries) + AC5 — ordering assertion on abort handlers; `failFast` aborts siblings
58
+
59
+ - [x] **Task 1.4**: Agents, conversations, tools, model-call resilience
60
+ - Delivers: `defineAgent`, `defineTool` (zod params, `replay`), `HarnessConversation` + `HarnessMessage`; built-in `terreno.agent.turn` task (`request` ⇄ `tools` phases, `maxSteps`); tools run as child tasks; interrupted `never` tools reported to the model; model calls retry 429/5xx then `fallbackModels`; interrupted model requests re-requested; LLM/TOOL spans with usage/cost; `ExecutionEnv` interface (types only) on `rt.env`
61
+ - Files: `defineAgent.ts`, `defineTool.ts`, `agentLoop.ts`, `modelCall.ts`, `executionEnv.ts`, `models/harnessConversation.ts`, `models/harnessMessage.ts`, tests
62
+ - Blocked by: 1.3
63
+ - Skills: `terreno-backend-api`, `claude-api` (model ids), `ai-prompt-governance`
64
+ - Docs: reference agents/tools/model resilience; explanation agent loop
65
+ - Acceptance: AC3 (tool rows) + AC4 (model rows) — mock model returns 503 twice then succeeds; fallback used after exhaustion; span tree CHAIN→LLM→TOOL
66
+
67
+ - [x] **Task 1.5**: Subagents
68
+ - Delivers: `rt.runAgent(agent, {input, output})` creates a task-owned child conversation, idempotent on resume (finds existing by `ownerTaskId`), returns parsed structured output; AGENT span nests the child's spans
69
+ - Files: `runtime.ts`, `agentLoop.ts`, tests
70
+ - Blocked by: 1.4
71
+ - Skills: `terreno-backend-api`
72
+ - Docs: reference `runAgent`; explanation subagents
73
+ - Acceptance: bun test — crash between child creation and completion resumes the same child conversation (no duplicate); abort of parent aborts child
74
+
75
+ - [x] **Task 1.6**: Extensions, hooks, wraps, memos
76
+ - Delivers: `defineExtension({name, sections, tools, hooks, wraps})`; `section` rebuilt per request and recorded in transcript; hooks `beforeModelRequest` / `beforeTool` (rewrite or `{block}`) / `afterTool`; `wrapTool`; `rt.memo(key, value?)` via `HarnessMemo`
77
+ - Files: `extensions.ts`, `models/harnessMemo.ts`, `agentLoop.ts`, tests
78
+ - Blocked by: 1.4
79
+ - Skills: `terreno-backend-api`
80
+ - Docs: reference extensions/hooks/memos
81
+ - Acceptance: AC6 — blocked tool result reaches the model; memo value survives a new harness instance
82
+
83
+ - [x] **Task 1.7**: Events, waits, sleep
84
+ - Delivers: `rt.waitFor(event, {timeout})`, `rt.sleep(duration)`, `harness.sendEvent(taskId, event, payload)`; `waiting` status; runner wakes on event or `timeoutAt`; timeout resolves `undefined`
85
+ - Files: `runtime.ts`, `runners/inProcessRunner.ts`, tests
86
+ - Blocked by: 1.3
87
+ - Skills: `terreno-backend-api`
88
+ - Docs: reference waits/events
89
+ - Acceptance: bun test with frozen Luxon clock — event before timeout resumes with payload; timeout path; event sent while owner is down is delivered after restart
90
+
91
+ - [x] **Task 1.8**: Approvals backend
92
+ - Delivers: `HarnessApproval` model; `rt.approval(key, {title, summary, payload, timeout, notify?})` with approvers declared per key on `defineTask({approvals})`; `approvalGate({tools, approvers})` extension (memo-backed); `HarnessApp` routes `GET /harness/approvals` (filtered by `approvers`), `approve` / `reject` instanceActions with reason; decision span with `decidedBy`
93
+ - Files: `approvals.ts`, `models/harnessApproval.ts`, `harnessApp.ts`, `routes/approvals.ts`, tests
94
+ - Blocked by: 1.6, 1.7
95
+ - Skills: `terreno-backend-api`, `model-router-actions`
96
+ - Docs: reference approvals + routes; how-to section "Require human approval"
97
+ - Acceptance: AC7 — supertest: unpermitted user gets 403 and an empty list; permitted user approves; span `output.decidedBy` equals user id; reject without reason → 400
98
+
99
+ - [x] **Task 1.9**: SSE event stream + submit
100
+ - Delivers: `HarnessEvent` log (coalesced deltas with TTL, committed events permanent); `rt.output`; `GET /harness/conversations/:id/events` + `/harness/tasks/:id/events` SSE with `Last-Event-ID` replay then change-stream tail; `submit` instanceAction (`requestId` idempotent, `whenBusy: queue | steer`)
101
+ - Files: `events.ts`, `models/harnessEvent.ts`, `routes/events.ts`, `routes/conversations.ts`, tests
102
+ - Blocked by: 1.4
103
+ - Skills: `terreno-backend-api`, `model-router-actions`
104
+ - Docs: reference SSE contract (event types, ids, reconnect)
105
+ - Acceptance: AC9 — two `HarnessApp` instances on one replica set; client disconnects mid-stream, reconnects to the other with `Last-Event-ID`, receives each missed event exactly once
106
+
107
+ - [x] **Task 1.10**: Version pinning
108
+ - Delivers: runs resume only on exact `name@version`; `Harness.start()` throws listing unregistered in-flight versions
109
+ - Files: `harness.ts`, `registry.ts`, tests
110
+ - Blocked by: 1.2
111
+ - Skills: `terreno-backend-api`
112
+ - Docs: reference "Versioning"; how-to "Ship a new task version"
113
+ - Acceptance: AC10
114
+
115
+ - [x] **Task 1.11**: Approvals inbox (admin-frontend)
116
+ - Delivers: `admin-frontend/src/widgets/harness/HarnessApprovalInbox.tsx` (list, detail, approve/reject with reason, loading/empty/error states) via `adminRequest`; admin custom screen `harness-approvals` (group "AI Harness"); standalone export; example-frontend admin route; `bun run sdk`
117
+ - Files: `admin-frontend/src/widgets/harness/*`, `ai/src/harness/adminScreens.ts`, `example-frontend/app/admin/*`, tests
118
+ - Blocked by: 1.8
119
+ - Skills: `building-admin-interfaces`, `verify-ui-changes`
120
+ - Docs: `docs/reference/admin-frontend.md` inbox section
121
+ - Acceptance: AC8 — component tests + Playwright run on web: approve one item, reject one; screenshots in `/opt/cursor/artifacts/`
122
+
123
+ - [x] **Task 1.12**: Clinical tracer in example-backend + how-to
124
+ - Delivers: `clinic.intakeSummary` (fetch → `runAgent` summary → approval → EHR write with `replay: "never"`) against a fake EHR model; `HarnessApp` registered in `server.ts`; admin action to start a run; e2e script kills the backend during `summarize`, restarts, approves in the inbox, asserts `filed` and the span tree in Traces
125
+ - Files: `example-backend/src/harness/*`, `example-backend/src/server.ts`, `example-frontend/e2e/harness-intake.spec.ts`
126
+ - Blocked by: 1.5, 1.9, 1.10, 1.11
127
+ - Skills: `verify-ui-changes`, `backend-test-env`
128
+ - Docs: create `docs/how-to/build-a-durable-workflow.md` using this workflow as the one example
129
+ - Acceptance: AC2 (e2e) — Playwright spec passes; screenshots of the inbox and the trace waterfall attached
130
+ - Shipped as two proofs: the kill/restart runs in `example-backend/src/harness/clinicalIntake.crash.test.ts` (spawns the real API process, SIGKILLs it mid-`summarize`, restarts); `harness-intake.spec.ts` approves in the inbox and asserts `filed` and the span tree
131
+
132
+ ## Phase 2 — Multi-instance
133
+
134
+ - [ ] **Task 2.0**: `InProcessRunner` concurrency
135
+ - Delivers: `new InProcessRunner({concurrency})` (default 8) runs up to N claimed tasks at once, each with its own lease and heartbeat; a slow phase no longer delays other tasks' wakes; `stop()` waits for all in-flight phases
136
+ - Files: `ai/src/harness/runners/inProcessRunner.ts`, tests
137
+ - Blocked by: 1.12
138
+ - Skills: `terreno-backend-api`
139
+ - Docs: reference "Runners" (concurrency option, ordering guarantees)
140
+ - Acceptance: bun test — a phase blocked on a gate does not prevent a second task from completing; never more than N concurrent; no task runs twice concurrently
141
+
142
+ - [ ] **Task 2.1**: `JobsRunner`
143
+ - Delivers: `@terreno/ai/harness/jobsRunner` with optional peer `@terreno/jobs`; job `terreno.harness.phase` keyed `taskId:phase:attempt`; harness task lease + heartbeat is the authority; importing the root `@terreno/ai` never loads jobs
144
+ - Files: `ai/src/harness/runners/jobsRunner.ts`, `ai/package.json`, tests
145
+ - Blocked by: 2.0
146
+ - Skills: `terreno-backend-api`
147
+ - Docs: reference "Runners"; how-to "Run on multiple instances"
148
+ - Acceptance: AC11 — two workers race one phase; exactly one commit; stale owner rejected; knip clean without jobs installed
149
+
150
+ - [ ] **Task 2.2**: Runs admin screen
151
+ - Delivers: task list/tree with status filters, abort, resolve-interrupted (retry/abort/complete + reason), link to trace
152
+ - Files: `admin-frontend/src/widgets/harness/HarnessRuns*.tsx`, `ai/src/harness/routes/tasks.ts`
153
+ - Blocked by: 2.1
154
+ - Skills: `building-admin-interfaces`, `verify-ui-changes`
155
+ - Docs: admin-frontend reference
156
+ - Acceptance: Playwright resolves an interrupted EHR write; screenshots
157
+
158
+ ## Phase 3 — Long context
159
+
160
+ - [ ] **Task 3.1**: Background compaction + manual `compact(instructions)`; originals stay searchable
161
+ - [ ] **Task 3.2**: `reset` / handoff tool control
162
+ - [ ] **Task 3.3**: Conversation forks at any message (parent history by reference)
163
+ - [ ] **Task 3.4**: `defineDoc` typed documents (`scope`, `history: rewindable`, `fork: asOf`), committed atomically with transcripts
164
+
165
+ Each 3.x task: Blocked by 1.12; Docs: reference + explanation sections; Acceptance: bun tests (10k-message conversation fits budget; fork isolation; doc rewind).
166
+
167
+ ## Phase 4 — Durable chat + multiplayer
168
+
169
+ - [x] **Task 4.0**: Human gate — `GptHistory` migration strategy → **one-shot migration** script at deploy (decided 2026-10-02)
170
+ - [ ] **Task 4.1**: `/gpt/prompt` on the harness; history mapping
171
+ - [ ] **Task 4.2**: Steering, foreground/background abort, `viewState` over SSE
172
+ - [ ] **Task 4.3**: rtk `useHarnessConversation` SSE hook + `GPTChat` adapter in example-frontend
173
+
174
+ Acceptance: kill backend mid-chat, reconnect resumes; two browsers see the same view (Playwright, screenshots).
175
+
176
+ ## Phase 5 — Coding agents + malleability
177
+
178
+ - [x] **Task 5.0**: Human gate — sandbox provider → **Cloud Run Jobs container** (decided 2026-10-02)
179
+ - [ ] **Task 5.1**: `NodeExecutionEnv` + `CodingTools` (read/write/edit/bash with replay classes)
180
+ - [ ] **Task 5.2**: Remote sandbox adapter
181
+ - [ ] **Task 5.3**: Registry hot-replace (running calls finish on old code)
182
+
183
+ Acceptance: a coding agent fixes a failing test in a fixture repo after a forced crash.