create-walle 0.10.1 → 0.10.3

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 (681) hide show
  1. package/README.md +7 -1
  2. package/lib/owner-write-safety.js +135 -0
  3. package/lib/public-runtime.js +13 -5
  4. package/lib/release-schema.json +3 -2
  5. package/lib/runtime-closure-policy.json +11 -8
  6. package/package.json +1 -1
  7. package/template/bin/deps-doctor.js +1 -1
  8. package/template/bin/node-bin.sh +11 -0
  9. package/template/coding-task-manager/api-prompts.js +55 -29
  10. package/template/coding-task-manager/bin/claude-hook.js +62 -4
  11. package/template/coding-task-manager/bin/claude-table-parity.js +307 -0
  12. package/template/coding-task-manager/bin/conversation-storage-auto-migration-lib.js +16 -1
  13. package/template/coding-task-manager/bin/conversation-storage-generation-evidence.js +9 -2
  14. package/template/coding-task-manager/bin/conversation-storage-service-entry-lib.js +16 -1
  15. package/template/coding-task-manager/bin/conversation-storage-walle-owner.js +247 -0
  16. package/template/coding-task-manager/bin/ctm-machine-pair.js +160 -0
  17. package/template/coding-task-manager/bin/ctm-relay-client.js +35 -12
  18. package/template/coding-task-manager/bin/land.js +2069 -0
  19. package/template/coding-task-manager/bin/lead-wait-census.js +1348 -0
  20. package/template/coding-task-manager/bin/memory-census.js +4 -2
  21. package/template/coding-task-manager/bin/memory-sync-verify.js +151 -0
  22. package/template/coding-task-manager/bin/probe-refusal-scope.js +530 -0
  23. package/template/coding-task-manager/bin/repair-foreign-clone.js +564 -0
  24. package/template/coding-task-manager/bin/repair-resume-echo-titles.js +248 -0
  25. package/template/coding-task-manager/bin/write-lock-bench.js +111 -0
  26. package/template/coding-task-manager/db.js +860 -317
  27. package/template/coding-task-manager/git-utils.js +44 -0
  28. package/template/coding-task-manager/lib/acp/acp-client.js +383 -0
  29. package/template/coding-task-manager/lib/acp/dsh-context-truth.js +176 -0
  30. package/template/coding-task-manager/lib/acp/dsh-launch-model.js +302 -0
  31. package/template/coding-task-manager/lib/acp/dsh-mcp-servers.js +194 -0
  32. package/template/coding-task-manager/lib/acp/dsh-prompt-lane.js +616 -0
  33. package/template/coding-task-manager/lib/acp/dsh-route-patch.js +308 -0
  34. package/template/coding-task-manager/lib/acp/dsh-session-runtime.js +522 -0
  35. package/template/coding-task-manager/lib/acp/dsh-transcript.js +395 -0
  36. package/template/coding-task-manager/lib/acp/dsh-usage-log.js +162 -0
  37. package/template/coding-task-manager/lib/acp/ndjson-stdio-transport.js +225 -0
  38. package/template/coding-task-manager/lib/adopted-host-redial.js +47 -7
  39. package/template/coding-task-manager/lib/adopted-launch-environment.js +123 -0
  40. package/template/coding-task-manager/lib/agent-auto-update-runtime.js +0 -3
  41. package/template/coding-task-manager/lib/agent-auto-update.js +26 -10
  42. package/template/coding-task-manager/lib/agent-bundle/build.js +657 -0
  43. package/template/coding-task-manager/lib/agent-bundle/codex-install.js +558 -0
  44. package/template/coding-task-manager/lib/agent-bundle/drift.js +120 -0
  45. package/template/coding-task-manager/lib/agent-bundle/gc.js +522 -0
  46. package/template/coding-task-manager/lib/agent-bundle/inventory.js +346 -0
  47. package/template/coding-task-manager/lib/agent-bundle/push.js +717 -0
  48. package/template/coding-task-manager/lib/agent-bundle/skill-transfer.js +724 -0
  49. package/template/coding-task-manager/lib/agent-bundle/spawn.js +119 -0
  50. package/template/coding-task-manager/lib/agent-bundle/store.js +568 -0
  51. package/template/coding-task-manager/lib/agent-capabilities.js +142 -12
  52. package/template/coding-task-manager/lib/agent-cli-cache.js +30 -5
  53. package/template/coding-task-manager/lib/agent-definitions.js +19 -0
  54. package/template/coding-task-manager/lib/agent-hooks-codex-toml.js +28 -16
  55. package/template/coding-task-manager/lib/agent-hooks-codex-workspace.js +9 -1
  56. package/template/coding-task-manager/lib/agent-hooks-installer.js +23 -8
  57. package/template/coding-task-manager/lib/agent-hooks-prune.js +37 -11
  58. package/template/coding-task-manager/lib/agent-hooks-shim.js +105 -0
  59. package/template/coding-task-manager/lib/agent-presets.js +99 -1
  60. package/template/coding-task-manager/lib/agent-title-apply.js +88 -0
  61. package/template/coding-task-manager/lib/agent-title-backfill-read.js +92 -0
  62. package/template/coding-task-manager/lib/agent-upgrade-jobs.js +12 -1
  63. package/template/coding-task-manager/lib/agent-version-service.js +74 -11
  64. package/template/coding-task-manager/lib/all-sessions-query.js +6 -2
  65. package/template/coding-task-manager/lib/api/agent-bundles.js +436 -0
  66. package/template/coding-task-manager/lib/api/backup-retention.js +83 -0
  67. package/template/coding-task-manager/lib/api/conversation-sync-routes.js +124 -0
  68. package/template/coding-task-manager/lib/api/diagnostics.js +549 -69
  69. package/template/coding-task-manager/lib/api/fleet.js +118 -0
  70. package/template/coding-task-manager/lib/api/host-stats.js +98 -0
  71. package/template/coding-task-manager/lib/api/hub-bridge.js +243 -0
  72. package/template/coding-task-manager/lib/api/ingress.js +43 -12
  73. package/template/coding-task-manager/lib/api/landing.js +403 -0
  74. package/template/coding-task-manager/lib/api/machine-pairing.js +285 -0
  75. package/template/coding-task-manager/lib/api/machine-pool.js +307 -0
  76. package/template/coding-task-manager/lib/api/machines.js +1150 -0
  77. package/template/coding-task-manager/lib/api/memory-sync-routes.js +335 -0
  78. package/template/coding-task-manager/lib/api/misc-ops.js +25 -5
  79. package/template/coding-task-manager/lib/api/providers.js +53 -6
  80. package/template/coding-task-manager/lib/api/remote-sessions.js +1326 -0
  81. package/template/coding-task-manager/lib/api/resume-from-store.js +25 -0
  82. package/template/coding-task-manager/lib/api/session-attach.js +623 -0
  83. package/template/coding-task-manager/lib/api/session-messages.js +1384 -0
  84. package/template/coding-task-manager/lib/api/sessions.js +237 -59
  85. package/template/coding-task-manager/lib/api/setup-network.js +544 -16
  86. package/template/coding-task-manager/lib/api/setup-wizard-handlers.js +884 -0
  87. package/template/coding-task-manager/lib/api/setup.js +829 -10
  88. package/template/coding-task-manager/lib/api/transcript-history.js +17 -4
  89. package/template/coding-task-manager/lib/api/walle-bridge.js +9 -1
  90. package/template/coding-task-manager/lib/api/worktrees.js +38 -37
  91. package/template/coding-task-manager/lib/approval-drift.js +16 -1
  92. package/template/coding-task-manager/lib/approval-logical-frame.js +5 -1
  93. package/template/coding-task-manager/lib/approval-scope.js +68 -4
  94. package/template/coding-task-manager/lib/attachment-reconciler-wiring.js +5 -2
  95. package/template/coding-task-manager/lib/auth-context.js +32 -2
  96. package/template/coding-task-manager/lib/auth-rate-limit.js +64 -1
  97. package/template/coding-task-manager/lib/auth-rules.js +474 -62
  98. package/template/coding-task-manager/lib/background-stop.js +369 -0
  99. package/template/coding-task-manager/lib/best-of-attempts.js +4 -1
  100. package/template/coding-task-manager/lib/best-of-launch-plan.js +52 -0
  101. package/template/coding-task-manager/lib/box-keep-awake.js +89 -0
  102. package/template/coding-task-manager/lib/broadcast-reason-stats.js +152 -0
  103. package/template/coding-task-manager/lib/broadcast-serialize.js +7 -1
  104. package/template/coding-task-manager/lib/browser-session-broker.js +9 -1
  105. package/template/coding-task-manager/lib/browser-use-adapter.js +33 -2
  106. package/template/coding-task-manager/lib/build-info.js +4 -2
  107. package/template/coding-task-manager/lib/claude-markdown-ansi.js +27 -85
  108. package/template/coding-task-manager/lib/claude-model-truth.js +13 -2
  109. package/template/coding-task-manager/lib/claude-session-title.js +6 -30
  110. package/template/coding-task-manager/lib/claude-table-layout.js +322 -0
  111. package/template/coding-task-manager/lib/claude-transcript-terminal-renderer.js +17 -13
  112. package/template/coding-task-manager/lib/client-diag-handler.js +69 -2
  113. package/template/coding-task-manager/lib/codex-app-server-client.js +14 -16
  114. package/template/coding-task-manager/lib/codex-config-guard.js +33 -3
  115. package/template/coding-task-manager/lib/codex-configuration-history.js +55 -0
  116. package/template/coding-task-manager/lib/codex-harness-qualification.js +55 -20
  117. package/template/coding-task-manager/lib/codex-launch-health.js +29 -2
  118. package/template/coding-task-manager/lib/codex-link-preparation.js +9 -8
  119. package/template/coding-task-manager/lib/codex-paths.js +2 -1
  120. package/template/coding-task-manager/lib/codex-rollout-history.js +743 -0
  121. package/template/coding-task-manager/lib/coding-agent-models.js +48 -42
  122. package/template/coding-task-manager/lib/coding-cli-skill-installer.js +44 -14
  123. package/template/coding-task-manager/lib/coding-session-model-adapters.js +70 -4
  124. package/template/coding-task-manager/lib/coding-session-model-owner.js +1 -1
  125. package/template/coding-task-manager/lib/coding-session-model-projection.js +5 -0
  126. package/template/coding-task-manager/lib/coding-session-model-public.js +7 -1
  127. package/template/coding-task-manager/lib/coding-session-model-runtime.js +24 -6
  128. package/template/coding-task-manager/lib/coding-session-model-scan.js +31 -0
  129. package/template/coding-task-manager/lib/coding-session-model-state.js +17 -0
  130. package/template/coding-task-manager/lib/coding-session-model-sync-state.js +0 -1
  131. package/template/coding-task-manager/lib/conversation-freshness-diagnostics.js +280 -0
  132. package/template/coding-task-manager/lib/conversation-import/cursor-guard-owner.js +10 -0
  133. package/template/coding-task-manager/lib/conversation-item-clock.js +261 -0
  134. package/template/coding-task-manager/lib/conversation-source-registry.js +5 -0
  135. package/template/coding-task-manager/lib/conversation-store-v2.js +44 -0
  136. package/template/coding-task-manager/lib/conversation-sync.js +355 -0
  137. package/template/coding-task-manager/lib/create/resolve-launch-params.js +104 -13
  138. package/template/coding-task-manager/lib/create/worker-role-profile.js +4 -4
  139. package/template/coding-task-manager/lib/create-intent-lease.js +51 -0
  140. package/template/coding-task-manager/lib/ctm-boot-lifecycle.js +17 -1
  141. package/template/coding-task-manager/lib/ctm-session-context-api.js +97 -6
  142. package/template/coding-task-manager/lib/db-domain-tables.js +8 -0
  143. package/template/coding-task-manager/lib/db-domains.js +22 -2
  144. package/template/coding-task-manager/lib/db-owner-dispatch-probe.js +32 -0
  145. package/template/coding-task-manager/lib/db-owner-op-registry.js +7 -0
  146. package/template/coding-task-manager/lib/db-owner-request-counts.js +178 -0
  147. package/template/coding-task-manager/lib/db-owner-worker-client.js +68 -14
  148. package/template/coding-task-manager/lib/db-schema-source-files.js +6 -0
  149. package/template/coding-task-manager/lib/deferred-restore-attempt.js +6 -2
  150. package/template/coding-task-manager/lib/feature-manifest.js +5 -1
  151. package/template/coding-task-manager/lib/fleet-conversation-route.js +97 -0
  152. package/template/coding-task-manager/lib/fleet-fanout.js +78 -0
  153. package/template/coding-task-manager/lib/fleet-hub.js +762 -0
  154. package/template/coding-task-manager/lib/fleet-origin-follower.js +252 -0
  155. package/template/coding-task-manager/lib/fleet-resolver-effects.js +147 -0
  156. package/template/coding-task-manager/lib/fleet-resolver-tick.js +148 -0
  157. package/template/coding-task-manager/lib/fleet-resolver.js +454 -0
  158. package/template/coding-task-manager/lib/fleet-session-list-routes.js +114 -0
  159. package/template/coding-task-manager/lib/fleet-session-lists.js +672 -0
  160. package/template/coding-task-manager/lib/fleet-update.js +798 -0
  161. package/template/coding-task-manager/lib/fs-watcher-root-watch.js +141 -0
  162. package/template/coding-task-manager/lib/fs-watcher.js +61 -44
  163. package/template/coding-task-manager/lib/harness-history-transition.js +52 -11
  164. package/template/coding-task-manager/lib/headless-inflight-ops.js +203 -0
  165. package/template/coding-task-manager/lib/headless-missing-reply.js +42 -0
  166. package/template/coding-task-manager/lib/headless-term-service.js +139 -25
  167. package/template/coding-task-manager/lib/hermetic-agent-launch-guard.js +10 -0
  168. package/template/coding-task-manager/lib/history-transition-read-op.js +175 -8
  169. package/template/coding-task-manager/lib/host-control-dial.js +167 -0
  170. package/template/coding-task-manager/lib/host-cpu-categories.js +310 -0
  171. package/template/coding-task-manager/lib/host-fseventsd-sampler.js +399 -0
  172. package/template/coding-task-manager/lib/host-handoff-orchestrator.js +16 -2
  173. package/template/coding-task-manager/lib/host-handoff.js +50 -15
  174. package/template/coding-task-manager/lib/host-health-ledger.js +164 -12
  175. package/template/coding-task-manager/lib/host-self-truth-watchdog.js +4 -0
  176. package/template/coding-task-manager/lib/host-stats.js +475 -0
  177. package/template/coding-task-manager/lib/host-threadpool-evacuation.js +160 -0
  178. package/template/coding-task-manager/lib/host-threadpool-monitor.js +14 -1
  179. package/template/coding-task-manager/lib/hosted-input-dispatch.js +203 -0
  180. package/template/coding-task-manager/lib/hosted-sync-worker.js +141 -310
  181. package/template/coding-task-manager/lib/hub-bridge-access.js +798 -0
  182. package/template/coding-task-manager/lib/hub-bridge-box.js +409 -0
  183. package/template/coding-task-manager/lib/hub-bridge-mcp.js +380 -0
  184. package/template/coding-task-manager/lib/hub-bridge-mesh.js +313 -0
  185. package/template/coding-task-manager/lib/hub-bridge-ops.js +721 -0
  186. package/template/coding-task-manager/lib/hub-bridge.js +398 -0
  187. package/template/coding-task-manager/lib/idle-notify.js +491 -0
  188. package/template/coding-task-manager/lib/instance-id-ownership-manifest.js +12 -0
  189. package/template/coding-task-manager/lib/instance-manifest-runtime.js +3 -0
  190. package/template/coding-task-manager/lib/instance-manifest.js +18 -2
  191. package/template/coding-task-manager/lib/instance-sync-status.js +33 -8
  192. package/template/coding-task-manager/lib/landing/agent-rule.txt +1 -0
  193. package/template/coding-task-manager/lib/landing/batch-runner.js +366 -0
  194. package/template/coding-task-manager/lib/landing/config.js +536 -0
  195. package/template/coding-task-manager/lib/landing/ctm-view.js +256 -0
  196. package/template/coding-task-manager/lib/landing/gate.js +360 -0
  197. package/template/coding-task-manager/lib/landing/git.js +344 -0
  198. package/template/coding-task-manager/lib/landing/lease.js +247 -0
  199. package/template/coding-task-manager/lib/landing/merge-delta.js +380 -0
  200. package/template/coding-task-manager/lib/landing/proof.js +223 -0
  201. package/template/coding-task-manager/lib/landing/queue.js +998 -0
  202. package/template/coding-task-manager/lib/landing/radar.js +489 -0
  203. package/template/coding-task-manager/lib/landing/resolve-cli.js +424 -0
  204. package/template/coding-task-manager/lib/landing/state.js +263 -0
  205. package/template/coding-task-manager/lib/landing/stop.js +49 -0
  206. package/template/coding-task-manager/lib/landing/sync-cli.js +475 -0
  207. package/template/coding-task-manager/lib/landing/sync.js +456 -0
  208. package/template/coding-task-manager/lib/landing/train.js +885 -0
  209. package/template/coding-task-manager/lib/landing/window.js +57 -0
  210. package/template/coding-task-manager/lib/launch-environment.js +121 -0
  211. package/template/coding-task-manager/lib/launch-model-override.js +193 -8
  212. package/template/coding-task-manager/lib/launch-plan-pool.js +2 -1
  213. package/template/coding-task-manager/lib/launch-plan-warm-cache.js +6 -0
  214. package/template/coding-task-manager/lib/launch-plan-worker.js +59 -2
  215. package/template/coding-task-manager/lib/lead-model-observer.js +57 -1
  216. package/template/coding-task-manager/lib/lead-model-options.js +160 -3
  217. package/template/coding-task-manager/lib/lead-model-restore-reconciliation.js +106 -24
  218. package/template/coding-task-manager/lib/lead-model-switch-runtime.js +409 -72
  219. package/template/coding-task-manager/lib/lead-model-switch.js +115 -10
  220. package/template/coding-task-manager/lib/lead-model-transition-runtime.js +14 -2
  221. package/template/coding-task-manager/lib/lead-model-transition-store.js +85 -9
  222. package/template/coding-task-manager/lib/lead-route-preflight.js +179 -0
  223. package/template/coding-task-manager/lib/lead-switch-history-mode.js +110 -0
  224. package/template/coding-task-manager/lib/lead-wire-agent.js +7 -0
  225. package/template/coding-task-manager/lib/legacy-draft-cancellation-recovery.js +111 -0
  226. package/template/coding-task-manager/lib/lifecycle-wake-experiment.js +9 -2
  227. package/template/coding-task-manager/lib/live-defer-announce.js +45 -0
  228. package/template/coding-task-manager/lib/login-tripwire.js +1 -0
  229. package/template/coding-task-manager/lib/machine-pairing.js +238 -0
  230. package/template/coding-task-manager/lib/machine-pool.js +409 -0
  231. package/template/coding-task-manager/lib/machine-registry.js +1494 -0
  232. package/template/coding-task-manager/lib/machine-self.js +66 -0
  233. package/template/coding-task-manager/lib/macos-capabilities.js +32 -15
  234. package/template/coding-task-manager/lib/main-thread-lint-exemptions.json +485 -57
  235. package/template/coding-task-manager/lib/mainloop-observability.js +14 -9
  236. package/template/coding-task-manager/lib/media-draft-owner.js +16 -3
  237. package/template/coding-task-manager/lib/media-journal-control-reader.js +473 -0
  238. package/template/coding-task-manager/lib/media-journal.js +84 -27
  239. package/template/coding-task-manager/lib/media-store-options.js +43 -15
  240. package/template/coding-task-manager/lib/memory-join.js +337 -0
  241. package/template/coding-task-manager/lib/memory-sync-verify.js +393 -0
  242. package/template/coding-task-manager/lib/memory-sync.js +565 -0
  243. package/template/coding-task-manager/lib/migrations/v56-host-samples-and-machine-pool.js +76 -0
  244. package/template/coding-task-manager/lib/migrations/v57-delegate-pref-mirror-opencode.js +68 -0
  245. package/template/coding-task-manager/lib/migrations/v58-subagent-launch-native-subagents.js +42 -0
  246. package/template/coding-task-manager/lib/migrations/v59-coding-session-model-state-dsh.js +73 -0
  247. package/template/coding-task-manager/lib/migrations/v60-delegate-pref-mirror-dsh.js +78 -0
  248. package/template/coding-task-manager/lib/migrations/v61-conversation-item-clock.js +71 -0
  249. package/template/coding-task-manager/lib/mirror-feed-sanitize.js +12 -3
  250. package/template/coding-task-manager/lib/model-availability.js +727 -0
  251. package/template/coding-task-manager/lib/model-execution-recipe-metadata.js +4 -6
  252. package/template/coding-task-manager/lib/model-host-receipt.js +6 -3
  253. package/template/coding-task-manager/lib/model-id-rule.js +19 -0
  254. package/template/coding-task-manager/lib/model-proxy/anthropic-face.js +8 -0
  255. package/template/coding-task-manager/lib/model-proxy/auto-mode-review.js +110 -23
  256. package/template/coding-task-manager/lib/model-proxy/chat-response-translators.js +6 -0
  257. package/template/coding-task-manager/lib/model-proxy/generation-probe.js +60 -17
  258. package/template/coding-task-manager/lib/model-proxy/handoff.js +494 -0
  259. package/template/coding-task-manager/lib/model-proxy/historical-tool-declarations.js +37 -0
  260. package/template/coding-task-manager/lib/model-proxy/lead-request-validation.js +1 -0
  261. package/template/coding-task-manager/lib/model-proxy/lead-token-admin.js +130 -0
  262. package/template/coding-task-manager/lib/model-proxy/lead-worker-picks.js +25 -0
  263. package/template/coding-task-manager/lib/model-proxy/native-lead-listener.js +61 -7
  264. package/template/coding-task-manager/lib/model-proxy/proxy-cli.js +200 -0
  265. package/template/coding-task-manager/lib/model-proxy/proxy-instance-record.js +257 -0
  266. package/template/coding-task-manager/lib/model-proxy/refusal-scope.js +151 -0
  267. package/template/coding-task-manager/lib/model-proxy/request-budget-store.js +11 -2
  268. package/template/coding-task-manager/lib/model-proxy/stream-accounting.js +205 -0
  269. package/template/coding-task-manager/lib/model-proxy/tokens.js +147 -5
  270. package/template/coding-task-manager/lib/model-proxy/upstream-outcome.js +18 -0
  271. package/template/coding-task-manager/lib/native-agent-model-args.js +25 -22
  272. package/template/coding-task-manager/lib/native-history-control.js +7 -5
  273. package/template/coding-task-manager/lib/native-lead-settings-client.js +46 -5
  274. package/template/coding-task-manager/lib/native-lead-tls.js +18 -4
  275. package/template/coding-task-manager/lib/oauth-proxy-supervisor.js +776 -75
  276. package/template/coding-task-manager/lib/online-backup-worker-client.js +2 -0
  277. package/template/coding-task-manager/lib/opencode-cli.js +480 -0
  278. package/template/coding-task-manager/lib/opencode-launch-model.js +471 -0
  279. package/template/coding-task-manager/lib/opencode-v1-plugin/model-carrier.mjs +35 -0
  280. package/template/coding-task-manager/lib/opencode-v2-plugin/server.js +118 -0
  281. package/template/coding-task-manager/lib/owner-action-manifest-data.json +15 -1
  282. package/template/coding-task-manager/lib/painted-row-recorder.js +9 -1
  283. package/template/coding-task-manager/lib/park-composer-draft.js +54 -0
  284. package/template/coding-task-manager/lib/park-fresh-relaunch.js +41 -10
  285. package/template/coding-task-manager/lib/perf-phase-trace.js +72 -0
  286. package/template/coding-task-manager/lib/perf-summary.js +7 -0
  287. package/template/coding-task-manager/lib/perf-tracker.js +63 -2
  288. package/template/coding-task-manager/lib/project-config.js +7 -0
  289. package/template/coding-task-manager/lib/prompt-purge-v2.js +52 -1
  290. package/template/coding-task-manager/lib/prompt-submission-contract.js +21 -1
  291. package/template/coding-task-manager/lib/provider-login-broker.js +264 -24
  292. package/template/coding-task-manager/lib/provider-login-capture.js +153 -0
  293. package/template/coding-task-manager/lib/provider-login-tab.js +10 -2
  294. package/template/coding-task-manager/lib/queue-draft-status-overlay.js +36 -0
  295. package/template/coding-task-manager/lib/raw-codex-history-window.js +5 -3
  296. package/template/coding-task-manager/lib/read-pool-client.js +94 -4
  297. package/template/coding-task-manager/lib/read-pool-op-registry.js +10 -1
  298. package/template/coding-task-manager/lib/read-pool-worker-handle.js +29 -4
  299. package/template/coding-task-manager/lib/recent-catalog-query.js +41 -0
  300. package/template/coding-task-manager/lib/recent-session-catalog-response.js +76 -10
  301. package/template/coding-task-manager/lib/recovery-evidence.js +26 -11
  302. package/template/coding-task-manager/lib/relay-client.js +57 -3
  303. package/template/coding-task-manager/lib/relink-audit.js +34 -5
  304. package/template/coding-task-manager/lib/remote-command-context.js +12 -0
  305. package/template/coding-task-manager/lib/remote-command-runtime.js +13 -1
  306. package/template/coding-task-manager/lib/remote-machine-catalog.js +1357 -0
  307. package/template/coding-task-manager/lib/remote-machine-create.js +1233 -0
  308. package/template/coding-task-manager/lib/remote-machine-link.js +1426 -0
  309. package/template/coding-task-manager/lib/remote-machine-proxy.js +654 -0
  310. package/template/coding-task-manager/lib/remote-session-forward.js +364 -0
  311. package/template/coding-task-manager/lib/remote-submission-status.js +6 -0
  312. package/template/coding-task-manager/lib/remote-terminal-target.js +9 -2
  313. package/template/coding-task-manager/lib/restart-guard.js +18 -6
  314. package/template/coding-task-manager/lib/restart-outcome-truth.js +20 -3
  315. package/template/coding-task-manager/lib/restart-preflight.js +9 -2
  316. package/template/coding-task-manager/lib/restore-backoff-gate.js +10 -2
  317. package/template/coding-task-manager/lib/restore-prepare-retry.js +12 -5
  318. package/template/coding-task-manager/lib/restore-resume-batch.js +22 -1
  319. package/template/coding-task-manager/lib/restore-seed-modes.js +87 -0
  320. package/template/coding-task-manager/lib/restored-scrollback-hydration-runtime.js +22 -2
  321. package/template/coding-task-manager/lib/resume-admission.js +17 -3
  322. package/template/coding-task-manager/lib/resume-blocked-wire.js +62 -1
  323. package/template/coding-task-manager/lib/resume-cwd.js +13 -0
  324. package/template/coding-task-manager/lib/resume-from-store.js +12 -1
  325. package/template/coding-task-manager/lib/resume-origin-facts.js +38 -1
  326. package/template/coding-task-manager/lib/resume-preflight.js +21 -16
  327. package/template/coding-task-manager/lib/review-repo-admission.js +39 -6
  328. package/template/coding-task-manager/lib/review-repo-registry.js +74 -18
  329. package/template/coding-task-manager/lib/root-delivery-runtime.js +74 -17
  330. package/template/coding-task-manager/lib/root-delivery-selection.js +37 -1
  331. package/template/coding-task-manager/lib/root-prompt-admission.js +33 -2
  332. package/template/coding-task-manager/lib/root-prompt-flow.js +168 -34
  333. package/template/coding-task-manager/lib/runtime-contract.js +3 -1
  334. package/template/coding-task-manager/lib/schema-indexes.js +1 -0
  335. package/template/coding-task-manager/lib/scrollback-archive-store.js +7 -4
  336. package/template/coding-task-manager/lib/session-analysis-memory.js +2 -0
  337. package/template/coding-task-manager/lib/session-context-locator.js +742 -0
  338. package/template/coding-task-manager/lib/session-create/attachment.js +2 -2
  339. package/template/coding-task-manager/lib/session-create/codex-native-provider-gate.js +218 -0
  340. package/template/coding-task-manager/lib/session-create/codex-resume-exit-classify.js +52 -0
  341. package/template/coding-task-manager/lib/session-create/create-phases.js +118 -0
  342. package/template/coding-task-manager/lib/session-create/delegate-worker.js +179 -20
  343. package/template/coding-task-manager/lib/session-create/dsh-session.js +930 -0
  344. package/template/coding-task-manager/lib/session-create/identity.js +20 -1
  345. package/template/coding-task-manager/lib/session-create/lead-route-launch.js +186 -13
  346. package/template/coding-task-manager/lib/session-create/native-lead-lifetime.js +55 -3
  347. package/template/coding-task-manager/lib/session-create/opencode-lead-provider.js +50 -0
  348. package/template/coding-task-manager/lib/session-create/prepared.js +201 -9
  349. package/template/coding-task-manager/lib/session-create/provider-launch-context.js +77 -0
  350. package/template/coding-task-manager/lib/session-create/provider-process.js +193 -64
  351. package/template/coding-task-manager/lib/session-create/response.js +37 -19
  352. package/template/coding-task-manager/lib/session-create/structured-session.js +27 -0
  353. package/template/coding-task-manager/lib/session-create/subagent-pick-table.js +3 -1
  354. package/template/coding-task-manager/lib/session-create/subagent-pick.js +458 -9
  355. package/template/coding-task-manager/lib/session-create/transcript.js +14 -5
  356. package/template/coding-task-manager/lib/session-create/worker-budget-setup.js +21 -2
  357. package/template/coding-task-manager/lib/session-create/worker-continuation.js +50 -2
  358. package/template/coding-task-manager/lib/session-create/worker-launch-sandbox.js +39 -10
  359. package/template/coding-task-manager/lib/session-create/worker-notices.js +94 -5
  360. package/template/coding-task-manager/lib/session-create/worker-observability.js +101 -9
  361. package/template/coding-task-manager/lib/session-create/worker-stop.js +11 -3
  362. package/template/coding-task-manager/lib/session-create/worker-wait-watcher.js +315 -0
  363. package/template/coding-task-manager/lib/session-empty.js +13 -10
  364. package/template/coding-task-manager/lib/session-geometry-authority-handler.js +10 -1
  365. package/template/coding-task-manager/lib/session-host-manager.js +212 -206
  366. package/template/coding-task-manager/lib/session-jobs.js +20 -10
  367. package/template/coding-task-manager/lib/session-lifecycle.js +28 -4
  368. package/template/coding-task-manager/lib/session-model-action-preconditions.js +15 -2
  369. package/template/coding-task-manager/lib/session-model-intent-contract.js +11 -8
  370. package/template/coding-task-manager/lib/session-park.js +738 -0
  371. package/template/coding-task-manager/lib/session-path-grant.js +13 -4
  372. package/template/coding-task-manager/lib/session-resource-sampler.js +19 -9
  373. package/template/coding-task-manager/lib/session-standup.js +67 -4
  374. package/template/coding-task-manager/lib/session-status-ledger.js +147 -6
  375. package/template/coding-task-manager/lib/session-status-runtime.js +45 -1
  376. package/template/coding-task-manager/lib/session-title-mirror.js +25 -57
  377. package/template/coding-task-manager/lib/session-transcript-trash.js +8 -1
  378. package/template/coding-task-manager/lib/session-transport.js +17 -0
  379. package/template/coding-task-manager/lib/session-workspace-projection.js +54 -5
  380. package/template/coding-task-manager/lib/session-workspace-tracking-runtime.js +213 -1
  381. package/template/coding-task-manager/lib/skill-autocomplete-query.js +120 -3
  382. package/template/coding-task-manager/lib/skill-autocomplete.js +15 -1
  383. package/template/coding-task-manager/lib/sqlite-file-set.js +39 -0
  384. package/template/coding-task-manager/lib/standup-search-adapter.js +16 -2
  385. package/template/coding-task-manager/lib/startup-pointer-write.js +57 -0
  386. package/template/coding-task-manager/lib/state-sync/client-ledger.js +12 -0
  387. package/template/coding-task-manager/lib/state-sync/frame-emitter.js +319 -100
  388. package/template/coding-task-manager/lib/state-sync/painted-frame-field.js +11 -0
  389. package/template/coding-task-manager/lib/storage/coding-session-model-store.js +25 -23
  390. package/template/coding-task-manager/lib/storage/delegate-pref-mirror-store.js +32 -9
  391. package/template/coding-task-manager/lib/structured-session-boot-sweep.js +235 -0
  392. package/template/coding-task-manager/lib/submission-ack.js +90 -2
  393. package/template/coding-task-manager/lib/surviving-owner-bootstrap.js +7 -2
  394. package/template/coding-task-manager/lib/surviving-owner-recovery.js +2 -1
  395. package/template/coding-task-manager/lib/systemd-scope.js +115 -0
  396. package/template/coding-task-manager/lib/telemetry-receiver.js +39 -0
  397. package/template/coding-task-manager/lib/terminal-attach-geometry.js +985 -0
  398. package/template/coding-task-manager/lib/terminal-bootstrap.js +30 -0
  399. package/template/coding-task-manager/lib/terminal-draft-http-status.js +25 -0
  400. package/template/coding-task-manager/lib/terminal-draft-operation.js +357 -0
  401. package/template/coding-task-manager/lib/terminal-input-admission.js +17 -1
  402. package/template/coding-task-manager/lib/terminal-input-prepared.js +563 -0
  403. package/template/coding-task-manager/lib/transcript-archiver.js +229 -229
  404. package/template/coding-task-manager/lib/transcript-cache-temps.js +171 -0
  405. package/template/coding-task-manager/lib/transcript-frame-cache.js +20 -5
  406. package/template/coding-task-manager/lib/transcript-guard-job.js +55 -4
  407. package/template/coding-task-manager/lib/transcript-link.js +77 -0
  408. package/template/coding-task-manager/lib/transcript-manifest-store.js +8 -4
  409. package/template/coding-task-manager/lib/transcript-source.js +44 -7
  410. package/template/coding-task-manager/lib/transcript-store.js +49 -0
  411. package/template/coding-task-manager/lib/tunnel-lane-governor.js +6 -3
  412. package/template/coding-task-manager/lib/typing-interaction-trace.js +198 -3
  413. package/template/coding-task-manager/lib/typing-worker-stages.js +60 -0
  414. package/template/coding-task-manager/lib/usage-ledger/backfill.js +40 -5
  415. package/template/coding-task-manager/lib/usage-ledger/client.js +4 -1
  416. package/template/coding-task-manager/lib/usage-ledger/dsh-parse.js +152 -0
  417. package/template/coding-task-manager/lib/usage-ledger/dsh-read.js +73 -0
  418. package/template/coding-task-manager/lib/usage-ledger/ingest.js +34 -6
  419. package/template/coding-task-manager/lib/usage-ledger/live.js +35 -8
  420. package/template/coding-task-manager/lib/usage-ledger/read.js +29 -20
  421. package/template/coding-task-manager/lib/usage-ledger/schema.js +61 -1
  422. package/template/coding-task-manager/lib/usage-ledger/task-coordinator.js +4 -2
  423. package/template/coding-task-manager/lib/visible-revision-watchdog.js +8 -12
  424. package/template/coding-task-manager/lib/wake-skip-reasons.js +47 -0
  425. package/template/coding-task-manager/lib/walle/turn.js +1 -1
  426. package/template/coding-task-manager/lib/walle-history-serve.js +838 -0
  427. package/template/coding-task-manager/lib/walle-kill-authority.js +2 -2
  428. package/template/coding-task-manager/lib/walle-log-rotation.js +164 -1
  429. package/template/coding-task-manager/lib/walle-mcp-auto-config.js +56 -2
  430. package/template/coding-task-manager/lib/walle-row-history.js +495 -0
  431. package/template/coding-task-manager/lib/walle-supervisor.js +130 -27
  432. package/template/coding-task-manager/lib/watch-worker-client.js +203 -0
  433. package/template/coding-task-manager/lib/worker-failure-classify.js +13 -1
  434. package/template/coding-task-manager/lib/worker-terminal-output.js +5 -2
  435. package/template/coding-task-manager/lib/ws/hub-bridge.js +35 -0
  436. package/template/coding-task-manager/lib/ws/lifecycle.js +6 -11
  437. package/template/coding-task-manager/lib/ws/misc.js +1 -1
  438. package/template/coding-task-manager/lib/ws/state-sync.js +125 -6
  439. package/template/coding-task-manager/lib/ws/terminal-attach.js +123 -1
  440. package/template/coding-task-manager/lib/ws-router.js +68 -1
  441. package/template/coding-task-manager/lib/ws-send-admission.js +22 -4
  442. package/template/coding-task-manager/oauth-proxy.js +211 -170
  443. package/template/coding-task-manager/package-lock.json +34 -94
  444. package/template/coding-task-manager/package.json +7 -3
  445. package/template/coding-task-manager/protocol/message-table.json +10 -0
  446. package/template/coding-task-manager/protocol/messages.js +10 -0
  447. package/template/coding-task-manager/protocol/ws-schema.json +20 -0
  448. package/template/coding-task-manager/protocol/ws-schema.md +2 -0
  449. package/template/coding-task-manager/providers/codex-mcp-extract.js +121 -19
  450. package/template/coding-task-manager/providers/codex-mcp.js +14 -5
  451. package/template/coding-task-manager/public/css/app.css +449 -1
  452. package/template/coding-task-manager/public/css/reviews.css +4 -0
  453. package/template/coding-task-manager/public/css/walle-session.css +4 -0
  454. package/template/coding-task-manager/public/index.html +766 -465
  455. package/template/coding-task-manager/public/js/agent-command.js +86 -0
  456. package/template/coding-task-manager/public/js/app/backups-panel.js +111 -5
  457. package/template/coding-task-manager/public/js/app/coding-agent-upgrade.js +103 -4
  458. package/template/coding-task-manager/public/js/app/machines-page.js +2572 -0
  459. package/template/coding-task-manager/public/js/app/models-tab.js +658 -73
  460. package/template/coding-task-manager/public/js/app/restart-banner.js +53 -0
  461. package/template/coding-task-manager/public/js/app/worktrees-panel.js +191 -7
  462. package/template/coding-task-manager/public/js/background-work.js +203 -28
  463. package/template/coding-task-manager/public/js/coding-session-model-presentation.js +181 -13
  464. package/template/coding-task-manager/public/js/core/active-session-groups.js +179 -0
  465. package/template/coding-task-manager/public/js/core/pending-create.js +238 -0
  466. package/template/coding-task-manager/public/js/core/recent-machine-source.js +228 -0
  467. package/template/coding-task-manager/public/js/core/session-commands.js +847 -5
  468. package/template/coding-task-manager/public/js/core/session-selectors.js +5 -1
  469. package/template/coding-task-manager/public/js/dashboard-client-function-order.json +8 -0
  470. package/template/coding-task-manager/public/js/document-review-links.js +9 -1
  471. package/template/coding-task-manager/public/js/file-resolution-client.js +52 -1
  472. package/template/coding-task-manager/public/js/history-app-seam.js +48 -4
  473. package/template/coding-task-manager/public/js/history-painted-rows.js +17 -2
  474. package/template/coding-task-manager/public/js/history-reader-park.js +13 -1
  475. package/template/coding-task-manager/public/js/history-scroller.js +187 -9
  476. package/template/coding-task-manager/public/js/history-transcript-pages.js +5 -5
  477. package/template/coding-task-manager/public/js/machine-pool-shared.js +991 -0
  478. package/template/coding-task-manager/public/js/message-renderer.js +4 -3
  479. package/template/coding-task-manager/public/js/model-picker.js +3 -1
  480. package/template/coding-task-manager/public/js/native-subagent-review.js +15 -2
  481. package/template/coding-task-manager/public/js/new-session-agent-grid.js +346 -0
  482. package/template/coding-task-manager/public/js/pasted-content.js +236 -0
  483. package/template/coding-task-manager/public/js/pe-private-content-lifetime.js +39 -7
  484. package/template/coding-task-manager/public/js/private-model-lifetime.js +6 -2
  485. package/template/coding-task-manager/public/js/private-state-scope.js +31 -3
  486. package/template/coding-task-manager/public/js/prompt-submission-client.js +173 -8
  487. package/template/coding-task-manager/public/js/prompt-submission-tray.js +281 -0
  488. package/template/coding-task-manager/public/js/prompts.js +11 -10
  489. package/template/coding-task-manager/public/js/protocol.js +10 -0
  490. package/template/coding-task-manager/public/js/queue-panel-submission-reconcile.js +174 -1
  491. package/template/coding-task-manager/public/js/restart-banner-policy.js +29 -1
  492. package/template/coding-task-manager/public/js/reviews.js +7 -3
  493. package/template/coding-task-manager/public/js/root-draft-lifetime.js +139 -2
  494. package/template/coding-task-manager/public/js/root-queue-builder-lifetime.js +16 -0
  495. package/template/coding-task-manager/public/js/row-join.js +4 -2
  496. package/template/coding-task-manager/public/js/session-model-picker.js +447 -57
  497. package/template/coding-task-manager/public/js/session-search-utils.js +64 -21
  498. package/template/coding-task-manager/public/js/session-usage-view.js +2 -1
  499. package/template/coding-task-manager/public/js/session-workspace-tracking.js +51 -1
  500. package/template/coding-task-manager/public/js/state-sync-client.js +14 -1
  501. package/template/coding-task-manager/public/js/stream-view.js +6 -5
  502. package/template/coding-task-manager/public/js/terminal/conv-only-session.js +287 -0
  503. package/template/coding-task-manager/public/js/terminal/runtime-02.js +16 -7
  504. package/template/coding-task-manager/public/js/terminal/runtime-03.js +41 -0
  505. package/template/coding-task-manager/public/js/terminal/runtime-04.js +41 -4
  506. package/template/coding-task-manager/public/js/terminal/runtime-09.js +2 -0
  507. package/template/coding-task-manager/public/js/terminal/runtime-10.js +5 -5
  508. package/template/coding-task-manager/public/js/terminal/runtime-12.js +60 -3
  509. package/template/coding-task-manager/public/js/terminal/runtime-16.js +16 -12
  510. package/template/coding-task-manager/public/js/terminal/runtime-18.js +14 -0
  511. package/template/coding-task-manager/public/js/terminal/runtime-19.js +8 -4
  512. package/template/coding-task-manager/public/js/terminal/runtime-20.js +211 -74
  513. package/template/coding-task-manager/public/js/terminal/runtime-21.js +19 -6
  514. package/template/coding-task-manager/public/js/terminal/runtime-22.js +86 -0
  515. package/template/coding-task-manager/public/js/terminal-attachment-draft.js +67 -13
  516. package/template/coding-task-manager/public/js/terminal-history-viewport.js +1 -1
  517. package/template/coding-task-manager/public/js/terminal-image-orchestration.js +52 -6
  518. package/template/coding-task-manager/public/js/terminal-wheel.js +62 -5
  519. package/template/coding-task-manager/public/js/walle/chat-conversation.js +15 -7
  520. package/template/coding-task-manager/public/js/walle-session.js +30 -7
  521. package/template/coding-task-manager/public/js/walle.js +6 -0
  522. package/template/coding-task-manager/public/js/ws/live-dispatch.js +10 -0
  523. package/template/coding-task-manager/public/m/app.css +366 -8
  524. package/template/coding-task-manager/public/m/app.js +1006 -74
  525. package/template/coding-task-manager/public/m/index.html +55 -1
  526. package/template/coding-task-manager/public/m/machines.js +2147 -0
  527. package/template/coding-task-manager/public/m/pool-failover.js +391 -0
  528. package/template/coding-task-manager/public/m/private-api.js +31 -1
  529. package/template/coding-task-manager/public/m/private-queue-actions.js +26 -7
  530. package/template/coding-task-manager/public/m/sw.js +5 -0
  531. package/template/coding-task-manager/public/usage.html +1 -0
  532. package/template/coding-task-manager/queue-engine.js +13 -0
  533. package/template/coding-task-manager/scripts/dev-route-fixture/synthetic-route-upstream.js +104 -0
  534. package/template/coding-task-manager/scripts/dev-route-fixture.js +339 -0
  535. package/template/coding-task-manager/scripts/opencode-lead-route-probe.js +195 -0
  536. package/template/coding-task-manager/scripts/opencode-v2-contract-probe/fake-anthropic.js +168 -0
  537. package/template/coding-task-manager/scripts/opencode-v2-contract-probe/probe-plugin/server.js +95 -0
  538. package/template/coding-task-manager/scripts/opencode-v2-contract-probe.js +673 -0
  539. package/template/coding-task-manager/server/approvals.js +5 -6
  540. package/template/coding-task-manager/server/boot.js +136 -17
  541. package/template/coding-task-manager/server.js +2819 -11885
  542. package/template/coding-task-manager/session-integrity.js +71 -13
  543. package/template/coding-task-manager/workers/db-owner-worker.js +72 -9
  544. package/template/coding-task-manager/workers/online-backup-worker.js +1 -0
  545. package/template/coding-task-manager/workers/read-pool-model-collector.js +51 -3
  546. package/template/coding-task-manager/workers/read-pool-worker.js +93 -12
  547. package/template/coding-task-manager/workers/session-host-pool-process.js +24 -10
  548. package/template/coding-task-manager/workers/session-host-process.js +19 -8
  549. package/template/coding-task-manager/workers/transcript-archive-worker.js +1 -1
  550. package/template/coding-task-manager/workers/watch-worker.js +105 -0
  551. package/template/coding-task-manager/workers/worktree-worker.js +202 -33
  552. package/template/ctm-relay/lib/protocol.js +14 -1
  553. package/template/package-lock.json +2 -2
  554. package/template/package.json +1 -1
  555. package/template/scripts/conversation-storage-v2-migration.js +78 -11
  556. package/template/shared/backup-retention.js +82 -0
  557. package/template/shared/conversation-admission.js +2 -0
  558. package/template/shared/conversation-provenance.js +3 -7
  559. package/template/shared/conversation-storage-v2-contract.js +47 -6
  560. package/template/shared/fixtures/worker-status-payloads.json +392 -0
  561. package/template/shared/git-remote-key.js +83 -0
  562. package/template/shared/host-identity.js +98 -2
  563. package/template/shared/linked-worktree.js +51 -0
  564. package/template/shared/macos-fda-target.js +57 -0
  565. package/template/shared/orphan-parents.js +55 -0
  566. package/template/shared/owner-write-safety.js +135 -0
  567. package/template/shared/public-runtime.js +13 -5
  568. package/template/shared/release-schema.json +3 -2
  569. package/template/shared/report-citations.js +14 -0
  570. package/template/shared/sqlite-write-lock.js +361 -223
  571. package/template/shared/storage/contract.js +38 -3
  572. package/template/wall-e/adapters/imessage.js +12 -0
  573. package/template/wall-e/agent.js +92 -4
  574. package/template/wall-e/api-walle.js +26 -1
  575. package/template/wall-e/bin/brain-purge-legacy-ctm.js +3 -2
  576. package/template/wall-e/bin/train-gemma-e4b-tooluse.js +2 -2
  577. package/template/wall-e/bin/walle-mcp-stdio.js +14 -8
  578. package/template/wall-e/brain/brain-join.js +859 -0
  579. package/template/wall-e/brain/brain-sync-membership.js +20 -0
  580. package/template/wall-e/brain/brain-sync-store.js +131 -77
  581. package/template/wall-e/brain/brain-sync-v2-schema.js +203 -0
  582. package/template/wall-e/brain/brain-sync-v2.js +578 -0
  583. package/template/wall-e/brain/delegate-model-prefs-store.js +13 -4
  584. package/template/wall-e/brain/deterministic-id.js +51 -0
  585. package/template/wall-e/brain/helper-rules-schema.js +129 -0
  586. package/template/wall-e/brain/memories.js +2 -2
  587. package/template/wall-e/brain/migrations.js +91 -28
  588. package/template/wall-e/brain/model-deployment-facts.js +31 -1
  589. package/template/wall-e/brain/model-identity-migration.js +1 -1
  590. package/template/wall-e/brain/owner-call-whitelist.js +39 -7
  591. package/template/wall-e/brain/schema-ensures.js +22 -0
  592. package/template/wall-e/brain/schema.js +45 -85
  593. package/template/wall-e/brain.js +172 -36
  594. package/template/wall-e/chat.js +3 -3
  595. package/template/wall-e/coding/agent-shell-env.js +7 -2
  596. package/template/wall-e/coding/journal-dispatcher.js +51 -0
  597. package/template/wall-e/coding/prompt-bundle.js +66 -21
  598. package/template/wall-e/coding/session-journal.js +28 -40
  599. package/template/wall-e/coding-orchestrator.js +23 -26
  600. package/template/wall-e/config/main-loop-exemptions.json +2 -2
  601. package/template/wall-e/http/admin-api.js +37 -0
  602. package/template/wall-e/http/auth.js +18 -1
  603. package/template/wall-e/http/blog-views-api.js +318 -0
  604. package/template/wall-e/http/gws-api.js +4 -0
  605. package/template/wall-e/http/helper-rules-api.js +327 -0
  606. package/template/wall-e/http/model-admin.js +8 -1
  607. package/template/wall-e/http/model-delegate-pref-admin.js +3 -3
  608. package/template/wall-e/http/model-proxy-providers.js +177 -2
  609. package/template/wall-e/http/model-route-health.js +157 -0
  610. package/template/wall-e/http/sync-api.js +278 -464
  611. package/template/wall-e/http/telemetry-api.js +12 -0
  612. package/template/wall-e/jobs/job-runner.js +28 -1
  613. package/template/wall-e/lib/blog-view-policy.js +88 -0
  614. package/template/wall-e/lib/blog-view-store.js +169 -0
  615. package/template/wall-e/lib/brain-owner-op-priority.js +9 -1
  616. package/template/wall-e/lib/client-config-lock.js +2 -1
  617. package/template/wall-e/lib/coding-journal-writer-child-client.js +67 -18
  618. package/template/wall-e/lib/ctm-data-dir.js +26 -0
  619. package/template/wall-e/lib/derivation-home.js +147 -0
  620. package/template/wall-e/lib/error-kinds.js +10 -1
  621. package/template/wall-e/lib/feature-manifest.js +1 -1
  622. package/template/wall-e/lib/helper-rules/cell-state.js +123 -0
  623. package/template/wall-e/lib/helper-rules/evaluate.js +398 -0
  624. package/template/wall-e/lib/helper-rules/explore-rubric.md +12 -0
  625. package/template/wall-e/lib/helper-rules/grade.js +320 -0
  626. package/template/wall-e/lib/helper-rules/label.js +247 -0
  627. package/template/wall-e/lib/helper-rules/lead-call-hook.js +555 -0
  628. package/template/wall-e/lib/helper-rules/store.js +669 -0
  629. package/template/wall-e/lib/landing-mcp-tools.js +170 -0
  630. package/template/wall-e/lib/mcp-client-config.js +133 -14
  631. package/template/wall-e/lib/mcp-gateway-migrate.js +28 -64
  632. package/template/wall-e/lib/mcp-integration.js +63 -19
  633. package/template/wall-e/lib/parent-death.js +7 -1
  634. package/template/wall-e/lib/runtime-worker-pool.js +1 -0
  635. package/template/wall-e/lib/scheduler-worker-jobs.js +12 -4
  636. package/template/wall-e/lib/telemetry-db-schema.js +37 -0
  637. package/template/wall-e/lib/telemetry-process-client.js +76 -1
  638. package/template/wall-e/llm/default-fallback.js +4 -0
  639. package/template/wall-e/llm/delegate-lead-prefs.js +16 -1
  640. package/template/wall-e/llm/delegate-vendor-default.js +12 -5
  641. package/template/wall-e/llm/model-catalog.js +13 -4
  642. package/template/wall-e/llm/model-roles.js +7 -1
  643. package/template/wall-e/llm/native-delegate-selection.js +56 -8
  644. package/template/wall-e/llm/portkey-http.js +150 -0
  645. package/template/wall-e/llm/portkey-sync.js +15 -145
  646. package/template/wall-e/llm/worker-delegate-args.js +72 -7
  647. package/template/wall-e/llm/worker-mcp-routing.js +117 -7
  648. package/template/wall-e/llm/worker-route.js +43 -1
  649. package/template/wall-e/loops/brain-custom-writes.js +64 -0
  650. package/template/wall-e/loops/ingest.js +17 -1
  651. package/template/wall-e/loops/think.js +19 -4
  652. package/template/wall-e/mcp-contract.js +222 -6
  653. package/template/wall-e/mcp-protocol-contract.js +77 -2
  654. package/template/wall-e/mcp-server.js +141 -31
  655. package/template/wall-e/mcp-worker-schemas.js +25 -7
  656. package/template/wall-e/memory/ctm-context-client.js +110 -5
  657. package/template/wall-e/memory/ctm-session-context.js +9 -3
  658. package/template/wall-e/memory/hub-bridge-client.js +388 -0
  659. package/template/wall-e/memory/replica-origin.js +56 -0
  660. package/template/wall-e/memory/session-pool.js +135 -0
  661. package/template/wall-e/runtime/live-capabilities.js +8 -3
  662. package/template/wall-e/server.js +4 -2
  663. package/template/wall-e/shared/release-schema.json +3 -2
  664. package/template/wall-e/shared/sqlite-file-set.js +39 -0
  665. package/template/wall-e/shared/sqlite-write-lock.js +361 -223
  666. package/template/wall-e/shared/storage/contract.js +38 -3
  667. package/template/wall-e/skills/_templates/delegate-worker/VERSION +1 -1
  668. package/template/wall-e/skills/_templates/delegate-worker/released-sha256.json +13 -1
  669. package/template/wall-e/skills/_templates/delegate-worker/templates/claude/SKILL.md +11 -6
  670. package/template/wall-e/skills/_templates/delegate-worker/templates/codex/SKILL.md +13 -8
  671. package/template/wall-e/skills/_templates/fleet-sync/VERSION +1 -0
  672. package/template/wall-e/skills/_templates/fleet-sync/released-sha256.json +16 -0
  673. package/template/wall-e/skills/_templates/fleet-sync/templates/claude/SKILL.md +64 -0
  674. package/template/wall-e/skills/_templates/fleet-sync/templates/codex/SKILL.md +64 -0
  675. package/template/wall-e/tools/chrome-automation.js +6 -0
  676. package/template/wall-e/tools/local-tools.js +6 -4
  677. package/template/wall-e/training/setup-cuda-train-env.sh +2 -2
  678. package/template/wall-e/workers/brain-owner-worker.js +27 -4
  679. package/template/wall-e/workers/coding-journal-writer-child.js +8 -1
  680. package/template/wall-e/workers/mcp-gateway-process.js +5 -5
  681. package/template/wall-e/workers/telemetry-worker.js +8 -0
@@ -0,0 +1,322 @@
1
+ 'use strict';
2
+
3
+ // Port of Claude Code 2.1.310's Markdown-table layout, read from the installed CLI
4
+ // (the versioned CLI binary under the user's local Claude install, Mach-O arm64; the layout sits at byte
5
+ // offset ~= 243,694,000, the `kind:"vertical"` literal: functions jr / Q / Z / Y / _t / ce,
6
+ // constants Ke=4 _e=3 as=4 Or=200). Design: docs/reader-claude-table-layout-parity-2026-10-25.html
7
+ // §3.1 (the algorithm) and §5 (rules R-1..R-8).
8
+ //
9
+ // WHY THIS EXISTS: the reader re-draws a Claude transcript into rows and then proves the seam
10
+ // against what the live terminal painted. A table the transcript renderer draws differently from
11
+ // the TUI is content the screen never had, and the proof refuses (dup rows / an overlap). So this
12
+ // module reproduces Claude's own layout EXACTLY -- same branch choice, same column widths, same
13
+ // line breaks, same glyphs, same fallback to the stacked key-value "cards", quirks included
14
+ // (R-6: floor rounding in the proportional branch, `max(floor(E*C/W), 3)` in the hard branch,
15
+ // the `> 4` wrapped-line rule, `floor` vertical centring, the 200-row cap). No "improvement" here
16
+ // is a fix; every deviation is a bug (R-1).
17
+ //
18
+ // TWO FORMS: `bordered` (the box, lines carry NO indent and never exceed cols - 4) and `cards`
19
+ // (the vertical key-value form, re-wrapped a second time by Ink's box: see inkWrapLines). The
20
+ // caller (lib/claude-markdown-ansi.js emitTable) prefixes the 2-column message indent and closes
21
+ // each row; `cols` is the TERMINAL width and the indent is never subtracted from it (R-5).
22
+ //
23
+ // VERIFIED against three live captures (golden fixtures under
24
+ // tests/golden/claude-transcript/table-captures/, reproduced byte-for-byte by
25
+ // tests/claude-table-captures.test.js):
26
+ // lid-options-196 -- session 6ea59930 painted rows 4192-4197, cols 196, hard branch -> cards
27
+ // tasks-steps-171 -- session 3320adc3 painted rows 493-517, cols 171, proportional -> cards
28
+ // (the 170-cell card line re-wrapped at 169 by Ink's box)
29
+ // inject-ways-196 -- session 7cf57222 painted rows 8396-8408, cols 196, proportional -> bordered
30
+ // There is no runtime switch on the Claude version (R-8): drift is caught by those fixtures.
31
+
32
+ const { stringCellWidth } = require('./terminal-cell-width');
33
+
34
+ // wrap-ansi is ESM-only; Node's require(esm) (>= 22.12, the pinned 25.2.1 here) hands back the
35
+ // namespace, so `.default` is the function. Loaded ONCE at module top (D-4).
36
+ const wrapAnsiModule = require('wrap-ansi');
37
+ const wrapAnsi = wrapAnsiModule.default || wrapAnsiModule;
38
+
39
+ // Claude's own constants, by their de-minified names (Ke / _e / as / Or) plus the rule cap and
40
+ // the version/offset the port was read from (R-8).
41
+ const CLAUDE_TABLE = Object.freeze({
42
+ MARGIN: 4, // Ke: a bordered table must fit inside cols - 4
43
+ MIN_COL: 3, // _e: never allocate less than 3 columns to a cell
44
+ MAX_CELL_LINES: 4, // as: a cell wrapping to MORE lines than this sends the table to cards
45
+ MAX_ROWS: 200, // Or: rows beyond this are dropped and announced
46
+ RULE_MAX: 40, // the card separator is '─'.repeat(min(cols - 1, 40))
47
+ VERSION: '2.1.310',
48
+ });
49
+
50
+ const SGR_RE = /\x1b\[[0-9;?]*[ -\/]*[@-~]/g;
51
+
52
+ function stripSgr(text) {
53
+ return String(text == null ? '' : text).replace(SGR_RE, '');
54
+ }
55
+
56
+ /**
57
+ * Claude's `ce(text, width, {hard})`: wrap-ansi with `trimEnd()` first, `{hard, trim:false,
58
+ * wordWrap:true}`, empty lines dropped, `['']` when nothing is left. `width <= 0` returns the
59
+ * text untouched (Claude's own early return).
60
+ */
61
+ function wrapCell(text, width, hard) {
62
+ const source = String(text == null ? '' : text);
63
+ if (width <= 0) return [source];
64
+ const lines = wrapAnsi(source.trimEnd(), width, { hard: !!hard, trim: false, wordWrap: true })
65
+ .split('\n')
66
+ .filter((line) => line.length > 0);
67
+ return lines.length > 0 ? carryExtendedColour(lines) : [''];
68
+ }
69
+
70
+ // wrap-ansi closes bold / italic / strike and the 16 basic colours at its own line break and re-opens
71
+ // them on the next line, but it has no closer for an EXTENDED colour selector (`38;5;n`, `38;2;r;g;b`):
72
+ // a coloured span that wraps inside a cell stays open past the cell's `│` and paints the border and
73
+ // the neighbouring cell. The live screen never does that -- painted-rows census 2026-10-26: 556 of
74
+ // 556 bordered rows carrying a 256-colour span close it before every border (Ink styles each text
75
+ // node on its own) -- so carry the colour across the break exactly the way wrap-ansi carries the
76
+ // other attributes: close it (`39`) at the end of the line, re-open it at the start of the next.
77
+ function carryExtendedColour(lines) {
78
+ let open = null;
79
+ return lines.map((line) => {
80
+ const prefix = open || '';
81
+ for (const m of line.matchAll(/\x1b\[([0-9;]*)m/g)) {
82
+ const codes = m[1] === '' ? [0] : m[1].split(';').map(Number);
83
+ for (let i = 0; i < codes.length; i += 1) {
84
+ const code = codes[i];
85
+ if (code === 38 && codes[i + 1] === 5) { open = `\x1b[38;5;${codes[i + 2]}m`; i += 2; }
86
+ else if (code === 38 && codes[i + 1] === 2) { open = `\x1b[38;2;${codes.slice(i + 2, i + 5).join(';')}m`; i += 4; }
87
+ else if (code === 0 || code === 39 || (code >= 30 && code <= 37) || (code >= 90 && code <= 97)) open = null;
88
+ }
89
+ }
90
+ return prefix + line + (open ? '\x1b[39m' : '');
91
+ });
92
+ }
93
+
94
+ // Claude's `bgr(text, width, align)` -- pad by VISIBLE width. `center` puts the odd space on the
95
+ // right (floor on the left), `right` pads all on the left, `left` all on the right.
96
+ function pad(text, width, align, strWidth) {
97
+ const total = Math.max(0, width - strWidth(stripSgr(text)));
98
+ if (align === 'center') {
99
+ const left = Math.floor(total / 2);
100
+ return ' '.repeat(left) + text + ' '.repeat(total - left);
101
+ }
102
+ if (align === 'right') return ' '.repeat(total) + text;
103
+ return text + ' '.repeat(total);
104
+ }
105
+
106
+ /**
107
+ * Lay a table out exactly as Claude Code 2.1.310 does.
108
+ *
109
+ * header: ANSI-rendered header cells (emitInline output) rows: ANSI-rendered body cells
110
+ * align: ('left'|'center'|'right'|null)[] cols: terminal columns (p)
111
+ *
112
+ * Returns the layout DECISION, never the indented rows:
113
+ * { kind:'bordered', widths, hard, branch:'natural'|'proportional'|'hard', lines }
114
+ * -- lines carry no indent; the widest is <= cols - 4
115
+ * { kind:'cards', branch, reason:'cellLines'|'tooWide'|'headerOnly', headers, rows, truncated }
116
+ * -- the vertical form's inputs, before Ink's box wrap (see cardLines/inkWrapLines)
117
+ */
118
+ function layoutClaudeTable({ header, rows, align } = {}, cols, { strWidth = stringCellWidth } = {}) {
119
+ const p = Number(cols) || 0;
120
+ const headerCells = (header || []).map((cell) => String(cell == null ? '' : cell));
121
+ const everyRow = (rows || []).map((row) => (row || []).map((cell) => String(cell == null ? '' : cell)));
122
+ const truncated = Math.max(0, everyRow.length - CLAUDE_TABLE.MAX_ROWS);
123
+ const bodyRows = truncated > 0 ? everyRow.slice(0, CLAUDE_TABLE.MAX_ROWS) : everyRow;
124
+
125
+ const K = headerCells.length;
126
+ if (K === 0) return { kind: 'bordered', widths: [], hard: false, branch: 'natural', lines: [] };
127
+
128
+ // R-3: widths come from the SGR-stripped RENDERED cell (a link counts as `label (href)`).
129
+ // E[c] = the widest whitespace-separated word, H[c] = the widest whole cell, both floored at 3.
130
+ const wordWidth = (cell) => {
131
+ const words = stripSgr(cell).split(/\s+/).filter((word) => word.length > 0);
132
+ if (words.length === 0) return CLAUDE_TABLE.MIN_COL;
133
+ let widest = CLAUDE_TABLE.MIN_COL;
134
+ for (const word of words) widest = Math.max(widest, strWidth(word));
135
+ return widest;
136
+ };
137
+ const cellWidth = (cell) => Math.max(strWidth(stripSgr(cell)), CLAUDE_TABLE.MIN_COL);
138
+
139
+ const E = headerCells.map((cell, i) => {
140
+ let width = wordWidth(cell);
141
+ for (const row of bodyRows) width = Math.max(width, wordWidth(row[i] || ''));
142
+ return width;
143
+ });
144
+ const H = headerCells.map((cell, i) => {
145
+ let width = cellWidth(cell);
146
+ for (const row of bodyRows) width = Math.max(width, cellWidth(row[i] || ''));
147
+ return width;
148
+ });
149
+
150
+ const M = 1 + 3 * K;
151
+ const C = Math.max(p - M - CLAUDE_TABLE.MARGIN, K * CLAUDE_TABLE.MIN_COL);
152
+ const W = E.reduce((sum, w) => sum + w, 0);
153
+ const z = H.reduce((sum, w) => sum + w, 0);
154
+
155
+ let hard = false;
156
+ let branch;
157
+ let D;
158
+ if (z <= C) {
159
+ D = H;
160
+ branch = 'natural';
161
+ } else if (W <= C) {
162
+ // Proportional: hand out the slack in proportion to each column's (natural - minimum) want,
163
+ // floored (R-6: Claude floors, it does not round).
164
+ branch = 'proportional';
165
+ const slack = C - W;
166
+ const want = H.map((w, i) => w - E[i]);
167
+ const U = want.reduce((sum, w) => sum + w, 0);
168
+ D = E.map((w, i) => (U === 0 ? w : w + Math.floor((want[i] / U) * slack)));
169
+ } else {
170
+ // Hard: scale every minimum by C/W, never below 3.
171
+ branch = 'hard';
172
+ hard = true;
173
+ const ratio = C / W;
174
+ D = E.map((w) => Math.max(Math.floor(w * ratio), CLAUDE_TABLE.MIN_COL));
175
+ }
176
+
177
+ // > 4 wrapped lines anywhere -> the whole table becomes cards.
178
+ let maxLines = 1;
179
+ for (let i = 0; i < K; i += 1) maxLines = Math.max(maxLines, wrapCell(headerCells[i], D[i], hard).length);
180
+ for (const row of bodyRows) {
181
+ for (let i = 0; i < row.length; i += 1) maxLines = Math.max(maxLines, wrapCell(row[i] || '', D[i], hard).length);
182
+ }
183
+
184
+ // The vertical form's inputs: a header-only table has no labels and its one row is the header
185
+ // (so it draws as unlabeled lines). `headerOnly` names that shape; the bordered attempt still
186
+ // runs first, exactly as Claude's does (a header-only table that fits stays a box).
187
+ const cards = (cause) => ({
188
+ kind: 'cards',
189
+ branch,
190
+ reason: bodyRows.length === 0 ? 'headerOnly' : cause,
191
+ headers: bodyRows.length === 0 ? [] : headerCells.map((cell) => stripSgr(cell).trim()),
192
+ rows: (bodyRows.length === 0 ? [headerCells] : bodyRows).map((row) => row.slice()),
193
+ truncated,
194
+ });
195
+ if (maxLines > CLAUDE_TABLE.MAX_CELL_LINES) return cards('cellLines');
196
+
197
+ const border = (kind) => {
198
+ const [left, bar, join, right] = {
199
+ top: ['┌', '─', '┬', '┐'],
200
+ middle: ['├', '─', '┼', '┤'],
201
+ bottom: ['└', '─', '┴', '┘'],
202
+ }[kind];
203
+ let line = left;
204
+ D.forEach((width, i) => {
205
+ line += bar.repeat(width + 2);
206
+ line += i < D.length - 1 ? join : right;
207
+ });
208
+ return line;
209
+ };
210
+
211
+ // One table row -> its bordered lines. Cells are vertically centred with floor((G - n)/2).
212
+ // Header cells are centred; body cells follow `align[c] ?? 'left'` (both Claude's rules).
213
+ const drawRow = (cells, isHeader) => {
214
+ const lines = cells.map((cell, i) => wrapCell(cell || '', D[i], hard));
215
+ const height = Math.max(...lines.map((l) => l.length), 1);
216
+ const off = lines.map((l) => Math.floor((height - l.length) / 2));
217
+ const out = [];
218
+ for (let r = 0; r < height; r += 1) {
219
+ let row = '│';
220
+ for (let c = 0; c < cells.length; c += 1) {
221
+ const idx = r - off[c];
222
+ const text = idx >= 0 && idx < lines[c].length ? lines[c][idx] : '';
223
+ row += ` ${pad(text, D[c], isHeader ? 'center' : ((align && align[c]) || 'left'), strWidth)} │`;
224
+ }
225
+ out.push(row);
226
+ }
227
+ return out;
228
+ };
229
+
230
+ const lines = [border('top'), ...drawRow(headerCells, true), border('middle')];
231
+ bodyRows.forEach((row, i) => {
232
+ lines.push(...drawRow(row, false));
233
+ if (i < bodyRows.length - 1) lines.push(border('middle'));
234
+ });
235
+ lines.push(border('bottom'));
236
+
237
+ let widest = 0;
238
+ for (const line of lines) widest = Math.max(widest, strWidth(stripSgr(line)));
239
+ if (widest > p - CLAUDE_TABLE.MARGIN) return cards('tooWide');
240
+
241
+ if (truncated > 0) lines.push(notShown(truncated));
242
+ return { kind: 'bordered', widths: D, hard, branch, lines };
243
+ }
244
+
245
+ // Claude's `lt(n)`: the 200-row cap's footnote.
246
+ function notShown(count) {
247
+ return `… ${count.toLocaleString()} more ${count === 1 ? 'row' : 'rows'} not shown`;
248
+ }
249
+
250
+ /**
251
+ * The vertical form, before Ink's box wrap: one `Bold Header: value` line per non-empty cell,
252
+ * continuation lines verbatim, a `─`.repeat(min(cols - 1, 40)) rule BETWEEN cards only (never
253
+ * before the first, never after the last). `style.bold`/`style.boldOff` label the key (Claude
254
+ * paints `\x1b[1m`…`\x1b[22m`).
255
+ */
256
+ function cardLines(layout, cols, style) {
257
+ const m = Number(cols) || 0;
258
+ const out = [];
259
+ const rule = '─'.repeat(Math.max(0, Math.min(m - 1, CLAUDE_TABLE.RULE_MAX)));
260
+ const headers = (layout && layout.headers) || [];
261
+ for (const row of (layout && layout.rows) || []) {
262
+ const lines = [];
263
+ row.forEach((cell, i) => {
264
+ const label = headers[i] || '';
265
+ // Claude flattens the cell to one line for the FIRST line, then re-wraps the rest.
266
+ const flat = String(cell == null ? '' : cell)
267
+ .trimEnd()
268
+ .replace(/\n+/g, ' ')
269
+ .replace(/\s+/g, ' ')
270
+ .trim();
271
+ if (!label && !flat) return; // an unlabeled empty cell prints nothing at all
272
+ const firstWidth = label ? m - stringCellWidth(label) - 3 : m - 1;
273
+ const contWidth = m - 3;
274
+ const wrapped = wrapCell(flat, Math.max(firstWidth, 10), false);
275
+ const head = wrapped[0] || '';
276
+ const rest = wrapped.length <= 1
277
+ ? wrapped
278
+ : [head, ...wrapCell(wrapped.slice(1).map((line) => line.trim()).join(' '), contWidth, false)];
279
+ lines.push(label
280
+ ? `${styleSpanText(`${label}:`, style)} ${rest[0] || ''}`
281
+ : (rest[0] || ''));
282
+ for (let d = 1; d < rest.length; d += 1) {
283
+ if (!rest[d].trim()) continue;
284
+ lines.push(rest[d]);
285
+ }
286
+ });
287
+ if (!lines.length) continue;
288
+ if (out.length) out.push(rule);
289
+ out.push(...lines);
290
+ }
291
+ if (layout && layout.truncated > 0) {
292
+ if (out.length) out.push(rule);
293
+ out.push(notShown(layout.truncated));
294
+ }
295
+ return out;
296
+ }
297
+
298
+ // The card label's own span: open with `style.bold`, close with `style.boldOff` (never a blanket
299
+ // reset, so a caller's surrounding style survives). Kept local so this module stays pure.
300
+ function styleSpanText(text, style) {
301
+ const open = (style && style.bold) || [];
302
+ const close = (style && style.boldOff) || [];
303
+ const openCodes = (Array.isArray(open) ? open : [open]).filter((c) => c !== undefined && c !== null && c !== '');
304
+ if (!openCodes.length) return text;
305
+ const closeCodes = (Array.isArray(close) ? close : [close]).filter((c) => c !== undefined && c !== null && c !== '');
306
+ return `\x1b[${openCodes.join(';')}m${text}${closeCodes.length ? `\x1b[${closeCodes.join(';')}m` : ''}`;
307
+ }
308
+
309
+ /**
310
+ * Ink's `<Text wrap="wrap">` inside the 2-column message box: every line is re-wrapped with
311
+ * `wrapAnsi(line, boxWidth, {trim:false, hard:true})` and split on '\n' (D-5 -- observed: the
312
+ * tasks capture's 170-cell card line breaks at 169 into `…rubric` / `and` / `0.60 threshold`).
313
+ */
314
+ function inkWrapLines(lines, boxWidth) {
315
+ const out = [];
316
+ for (const line of lines || []) {
317
+ out.push(...wrapAnsi(String(line == null ? '' : line), boxWidth, { trim: false, hard: true }).split('\n'));
318
+ }
319
+ return out;
320
+ }
321
+
322
+ module.exports = { CLAUDE_TABLE, wrapCell, layoutClaudeTable, cardLines, inkWrapLines };
@@ -51,10 +51,13 @@ const {
51
51
  const { _jsonlContentText } = require('./jsonl-conversation-parser');
52
52
  const {
53
53
  COMMAND_ENVELOPE_RE, LOCAL_COMMAND_STDOUT_RE, PEER_RELAY_PREFIX_RE, UNKNOWN_TAG_RE,
54
- SYSTEM_REMINDER_RE, PASTED_CONTENT_RE, IDE_SELECTION_RE,
54
+ SYSTEM_REMINDER_RE, IDE_SELECTION_RE,
55
55
  TASK_NOTIFICATION_RE, TASK_NOTIFICATION_SUMMARY_RE,
56
56
  BASH_INPUT_RE, BASH_STDOUT_RE, BASH_STDERR_RE,
57
57
  } = require('../../shared/conversation-provenance');
58
+ // D-5: the ONE strict paste-wrapper recogniser (line-exact opener/closer pair, 4 lowercase
59
+ // hex ids) lives in public/js/pasted-content.js. Nothing here re-derives it.
60
+ const PastedContent = require('../public/js/pasted-content');
58
61
  // WP-1 (rule D-9): wrap/measure/pad through the ONE width authority that matches the xterm.js
59
62
  // pane this renders into, not a hand-written East-Asian-Width table -- `wrapToCells`/
60
63
  // `stringCellWidth`/`truncateToCells` no longer flow from the codex renderer into this one.
@@ -184,18 +187,19 @@ function _bashStdoutOnly(text) {
184
187
  return null;
185
188
  }
186
189
 
187
- // Corrected 2026-09-27 (WP-3 live capture, fix round 1): the real screen shows a
188
- // `<pasted_content>` block VERBATIM, inline with the rest of the message -- never the
189
- // "[Pasted text #n +N lines]" placeholder this used to invent (a real bracketed paste, sent
190
- // through the same input path a real keystroke takes and confirmed present in the JSONL, showed
191
- // as ordinary wrapped prompt lines: "❯ line one" / " line two" / ... / " summarize the pasted
192
- // text in one line", with no collapse marker anywhere). D-8 branch 6: strip the tags, keep the
193
- // inner text, dropping exactly one leading/trailing blank line the tag wrapping usually
194
- // introduces (same trim the old placeholder's line count used).
190
+ // Corrected 2026-09-27 (WP-3 live capture, fix round 1): the real screen shows a pasted
191
+ // block VERBATIM, inline with the rest of the message -- never the "[Pasted text #n +N lines]"
192
+ // placeholder this used to invent (a real bracketed paste, sent through the same input path a
193
+ // real keystroke takes and confirmed present in the JSONL, showed as ordinary wrapped prompt
194
+ // lines: "❯ line one" / " line two" / ... / " summarize the pasted text in one line", with no
195
+ // collapse marker anywhere). D-8 branch 6: strip the wrapper, keep the inner text.
196
+ //
197
+ // D-5 (WP-2): recognition is NOT re-derived here any more -- the strict rule (a line that is
198
+ // exactly the opener with a 4-lowercase-hex id, matched by the same-id closer line) lives in
199
+ // public/js/pasted-content.js; `PastedContent.unwrap` drops the wrapper and keeps the body
200
+ // verbatim, so the escaped/unknown-tag handling below sees body text only.
195
201
  function _replacePastedContent(text) {
196
- return String(text || '').replace(PASTED_CONTENT_RE, (whole, inner) => (
197
- inner.replace(/^\n+/, '').replace(/\n+$/, '')
198
- ));
202
+ return PastedContent.unwrap(text);
199
203
  }
200
204
 
201
205
  // D-10 (WP-3 live capture): a raw tool_use name is not always what the TUI displays -- see
@@ -557,7 +561,7 @@ function parseClaudeTranscript(records, opts = {}) {
557
561
  const bashStdoutOnly = _bashStdoutOnly(text);
558
562
  if (bashStdoutOnly) { flushTools(); turns.push({ kind: 'local_stdout', uuid: rec.uuid, ts: rec.timestamp, lines: bashStdoutOnly }); continue; }
559
563
 
560
- // 6/7/9/10/11: strip <pasted_content> to a placeholder, drop <ide_selection> and
564
+ // 6/7/9/10/11: strip the paste wrapper, drop <ide_selection> and
561
565
  // <system-reminder> entirely, then fall back to a plain prompt; an unmatched leading
562
566
  // tag on what's left is recorded (never hidden) via stats.unknownEnvelopes.
563
567
  let working = _replacePastedContent(text);
@@ -44,6 +44,15 @@ function resolveDiagClientId(ws) {
44
44
  // while still capping memory if a client rotates clientId to evade this.
45
45
  const MAX_DIAG_THROTTLE_KEYS = 512;
46
46
 
47
+ // WP-0 (docs/box-session-client-diag-and-reader-jump-2026-11-01.html §5 R-1/R-2): a box-owned
48
+ // "mirror" session has no entry in the hub's local `sessions` Map, so `getSession(id)` is null for
49
+ // it and every client-diag frame from a hub viewer on that session was dropped before recording —
50
+ // even though the hub is the observer that owns the browser and telemetry.db. Mirror ids now get a
51
+ // per-id holder object (throttle state only — nothing but the terminal-authority branch reads local
52
+ // session fields, and mirrors skip that branch) from this bounded map. FIFO eviction keeps a long-
53
+ // lived hub process from pinning one holder per mirror it has ever seen.
54
+ const MAX_MIRROR_DIAG_HOLDERS = 256;
55
+
47
56
  // Cap on the generic (unlisted-event) detail passthrough below. 32 rather than 24 because the
48
57
  // history-seam-crossing beacon carries up to 27 non-null keys (joinDup/joinBlk included), and a
49
58
  // 24-key cut silently dropped its trailing distPx/exitBy/provider fields.
@@ -68,6 +77,9 @@ function clientDiagHostSnapshot() {
68
77
 
69
78
  function createClientDiagHandler(deps = {}) {
70
79
  const getSession = deps.getSession || (() => null);
80
+ // WP-0 R-1: (id) => truthy for a box-owned mirror session id, else null. Default keeps every
81
+ // existing caller byte-identical (a mirror id stays dropped).
82
+ const getMirrorSession = typeof deps.getMirrorSession === 'function' ? deps.getMirrorSession : () => null;
71
83
  const isSubscribed = typeof deps.isSubscribed === 'function' ? deps.isSubscribed : () => false;
72
84
  const recordDiagnostic = deps.recordDiagnostic || (() => {});
73
85
  const recordAuthority = deps.recordAuthority || (() => {});
@@ -79,14 +91,59 @@ function createClientDiagHandler(deps = {}) {
79
91
  // A socket close is page-scoped rather than session-scoped, so it alone may use the bounded
80
92
  // global pseudo-session. Terminal/render recovery events must name a real session.
81
93
  let globalDiagSession = null;
94
+ // WP-0 (§6.4, D-8) review fix: a create-ready frame names a PENDING CREATE id, which is not
95
+ // necessarily a session this machine knows — outcome 'failed'/'expired' never became one, and
96
+ // on the hub a successfully created session is owned by the box, so getSession(msg.id) is
97
+ // empty here. It is therefore answered BEFORE the session gate (the client-ws-close-observed
98
+ // escape is the same idea) and needs its own bounded 1 s window, since the per-session
99
+ // throttle map below is unreachable for a session-less id.
100
+ const createReadyAtByKey = new Map();
101
+ // WP-0 R-1: per-mirror-id throttle holders, newest-last (Map insertion order), FIFO-evicted at
102
+ // MAX_MIRROR_DIAG_HOLDERS. Scoped per handler instance so one hub process's churn cannot affect
103
+ // another's (and so a test harness gets a fresh map).
104
+ const mirrorDiagHolders = new Map();
82
105
 
83
- return function handleClientDiag(ws, msg) {
106
+ function handleClientDiag(ws, msg) {
84
107
  if (!msg || !msg.id) return;
85
108
  const event = String(msg.event || '');
109
+ if (event === 'create-ready') {
110
+ const at = now();
111
+ const throttleKey = `${event} ${resolveDiagClientId(ws)} ${msg.id}`;
112
+ const lastEventAt = Number(createReadyAtByKey.get(throttleKey)) || 0;
113
+ if (lastEventAt && at - lastEventAt < 1000) return;
114
+ createReadyAtByKey.delete(throttleKey);
115
+ createReadyAtByKey.set(throttleKey, at);
116
+ while (createReadyAtByKey.size > MAX_DIAG_THROTTLE_KEYS) {
117
+ createReadyAtByKey.delete(createReadyAtByKey.keys().next().value);
118
+ }
119
+ // Display only: the numbers come from the client's own clock, so they are coerced
120
+ // (non-finite → -1) and the strings cut before they reach the log.
121
+ const d = msg.details && typeof msg.details === 'object' ? msg.details : {};
122
+ const num = (value) => (Number.isFinite(Number(value)) ? Number(value) : -1);
123
+ const text = (value, max) => (typeof value === 'string' ? value.slice(0, max) : '');
124
+ console.log(
125
+ `[create-client] id=${text(msg.id, 160)} machine=${text(d.machine, 160)} outcome=${text(d.outcome, 40)} ` +
126
+ `clickToAcceptedMs=${num(d.clickToAcceptedMs)} clickToSettledMs=${num(d.clickToSettledMs)}`
127
+ );
128
+ return;
129
+ }
86
130
  let session = getSession(msg.id);
131
+ // WP-0 R-2: a mirror session skips only terminal-authority (recordAuthority reads LOCAL session
132
+ // fields and drives local wedge remediation); every other branch records as normal.
133
+ let isMirror = false;
87
134
  if (!session) {
88
135
  if (msg.id === 'global' && event === 'client-ws-close-observed') {
89
136
  session = globalDiagSession || (globalDiagSession = {});
137
+ } else if (getMirrorSession(msg.id)) {
138
+ isMirror = true;
139
+ session = mirrorDiagHolders.get(msg.id);
140
+ if (!session) {
141
+ session = {};
142
+ mirrorDiagHolders.set(msg.id, session);
143
+ while (mirrorDiagHolders.size > MAX_MIRROR_DIAG_HOLDERS) {
144
+ mirrorDiagHolders.delete(mirrorDiagHolders.keys().next().value);
145
+ }
146
+ }
90
147
  } else {
91
148
  return;
92
149
  }
@@ -109,6 +166,7 @@ function createClientDiagHandler(deps = {}) {
109
166
  session._clientDiagAtByEvent.delete(session._clientDiagAtByEvent.keys().next().value);
110
167
  }
111
168
  if (event === 'terminal-authority') {
169
+ if (isMirror) return;
112
170
  if (msg.details && typeof msg.details === 'object') {
113
171
  recordAuthority(ws, session, msg.id, msg.details);
114
172
  }
@@ -137,6 +195,11 @@ function createClientDiagHandler(deps = {}) {
137
195
  toCols: nonNegInt(d.toCols),
138
196
  widthPx: nonNegInt(d.widthPx),
139
197
  reason: typeof d.reason === 'string' ? d.reason.slice(0, 40) : '',
198
+ // WP-2 (docs/codex-terminal-geometry-sticky-cols-2026-10-24.html §5): the two
199
+ // layout facts that make an adoption explainable -- browser viewport width and whether
200
+ // split view was on. Whitelisted here or the beacon's producer fields would be dropped.
201
+ viewportWidthPx: nonNegInt(d.viewportWidthPx),
202
+ split: d.split === true,
140
203
  });
141
204
  return;
142
205
  }
@@ -206,7 +269,11 @@ function createClientDiagHandler(deps = {}) {
206
269
  }
207
270
  }
208
271
  recordDiagnostic(msg.id, `client-${event}`, details);
209
- };
272
+ }
273
+
274
+ // WP-0 AC-0e: test-only probe for the mirror holder bound. Production callers never read it.
275
+ handleClientDiag._mirrorHolderCount = () => mirrorDiagHolders.size;
276
+ return handleClientDiag;
210
277
  }
211
278
 
212
279
  module.exports = { createClientDiagHandler };
@@ -21,27 +21,25 @@
21
21
  // half of this claim so a stray production `require` here is caught.
22
22
 
23
23
  const { spawn } = require('child_process');
24
+ const { spawnNdjsonTransport } = require('./acp/ndjson-stdio-transport');
24
25
  const bridge = require('./codex-approval-bridge');
25
26
 
26
27
  // A transport is { write(jsonString), onLine(cb), close() }. The default spawns codex;
27
- // tests inject a fake one to drive the client deterministically.
28
- function spawnCodexTransport({ cwd, env, spawnFn = spawn, command = 'codex', args = ['app-server'] } = {}) {
29
- const child = spawnFn(command, args, { stdio: ['pipe', 'pipe', 'pipe'], cwd, env });
30
- let buf = '';
31
- let lineCb = null;
32
- child.stdout.on('data', (d) => {
33
- buf += d.toString();
34
- let i;
35
- while ((i = buf.indexOf('\n')) >= 0) {
36
- const line = buf.slice(0, i); buf = buf.slice(i + 1);
37
- if (line.trim() && lineCb) lineCb(line);
38
- }
28
+ // tests inject a fake one to drive the client deterministically. The framing itself moved
29
+ // to lib/acp/ndjson-stdio-transport.js (WP-1) so the ACP client shares one implementation.
30
+ function spawnCodexTransport(o = {}) {
31
+ const t = spawnNdjsonTransport({
32
+ command: o.command || 'codex',
33
+ args: o.args || ['app-server'],
34
+ cwd: o.cwd,
35
+ env: o.env,
36
+ spawnFn: o.spawnFn || spawn,
39
37
  });
40
38
  return {
41
- write: (s) => { try { child.stdin.write(s + '\n'); } catch (error) { void error; } },
42
- onLine: (cb) => { lineCb = cb; },
43
- close: () => { try { child.kill(); } catch (error) { void error; } },
44
- _child: child,
39
+ write: t.write,
40
+ onLine: t.onLine,
41
+ close: () => t.kill(),
42
+ _child: t._child,
45
43
  };
46
44
  }
47
45
 
@@ -105,20 +105,50 @@ function buildCodexTransportOverrideArgs(names, opts = {}) {
105
105
  return out;
106
106
  }
107
107
 
108
- // Read CODEX_HOME/config.toml and return the override args (best-effort: unreadable/missing → []).
109
- function codexMcpTransportGuardArgs(codexHome, opts = {}) {
108
+ // Read CODEX_HOME/config.toml (best-effort: unreadable/missing → null). The one sync read both
109
+ // guards share; it is the ledgered main-thread site (docs/main-thread-sync-baseline.json).
110
+ function readCodexConfigToml(codexHome) {
110
111
  let text;
111
112
  try {
112
113
  text = fs.readFileSync(path.join(codexHome || '', 'config.toml'), 'utf8');
113
114
  } catch {
114
- return [];
115
+ return null;
115
116
  }
117
+ return text;
118
+ }
119
+
120
+ // Return the override args (unreadable/missing config → []).
121
+ function codexMcpTransportGuardArgs(codexHome, opts = {}) {
122
+ const text = readCodexConfigToml(codexHome);
123
+ if (text === null) return [];
116
124
  return buildCodexTransportOverrideArgs(findTransportlessMcpServers(text), opts);
117
125
  }
118
126
 
127
+ // WP-1 (codex-routed-fork-cold-restore-guard-2026-10-22.html §5 D-2, §9 S-5): the ids a native
128
+ // `codex` config load resolves through `model_providers.get(id)` — Codex merges its built-in
129
+ // providers with this user table. Only the TABLE HEADERS are needed (the values are irrelevant to
130
+ // servability), so this is a line scan, not a TOML parse: `[model_providers.<id>]` and its
131
+ // sub-tables (`[model_providers.<id>.http_headers]`) both name the provider `<id>`; text before a
132
+ // `[model_providers]` header (or after a different table) is never attributed to it. Best-effort
133
+ // exactly like the transport guard: a missing/unreadable config is an empty set, never a throw.
134
+ // `codexHome` is the CODEX_HOME directory (the one that holds config.toml).
135
+ function readModelProviderKeys(codexHome) {
136
+ const text = readCodexConfigToml(codexHome);
137
+ if (text === null) return [];
138
+ const out = [];
139
+ for (const line of String(text || '').split(/\r?\n/)) {
140
+ const segs = _tableHeaderSegments(line);
141
+ if (!segs || segs.length < 2 || _unquote(segs[0]) !== 'model_providers') continue;
142
+ const key = _unquote(segs[1]);
143
+ if (key) out.push(key);
144
+ }
145
+ return [...new Set(out)];
146
+ }
147
+
119
148
  module.exports = {
120
149
  INERT_COMMAND,
121
150
  findTransportlessMcpServers,
122
151
  buildCodexTransportOverrideArgs,
123
152
  codexMcpTransportGuardArgs,
153
+ readModelProviderKeys,
124
154
  };
@@ -0,0 +1,55 @@
1
+ 'use strict';
2
+
3
+ // D-7 (docs/codex-upgrades-without-version-approval-2026-10-28.html §configuration-followup): Codex
4
+ // 0.165.0 persists a harness-authored reasoning-configuration control record in the rollout as
5
+ // `response_item` / `configuration_update`. The tagged release source
6
+ // (codex-rs/protocol/src/models/configuration_update.rs -> ConfigurationReasoning { effort },
7
+ // codex-rs/core/src/client.rs:596-599,935-939 @ rust-v0.165.0) enables the update only for native
8
+ // OpenAI targets that advertise it and REMOVES configuration updates from the outgoing request copy
9
+ // for every other target, so the record is source history CTM classifies (and never rewrites) --
10
+ // the selected effort is the source model's own setting and is never adopted as CTM's.
11
+ //
12
+ // This module is the ONE shape definition for that record. It is PURE: no file effects, no runtime
13
+ // version check, no enum/version list. The scanner (lib/history-transition-read-op.js) uses it to
14
+ // classify the record into its own history kind; the planner
15
+ // (lib/harness-history-transition.js) decides where that kind may travel.
16
+ const ENVELOPE_KEYS = new Set(['type', 'payload', 'timestamp', 'ordinal', 'metadata']);
17
+ const PAYLOAD_KEYS = new Set(['type', 'reasoning']);
18
+ const METADATA_KEYS = new Set(['client_authored', 'harness_authored_configuration']);
19
+
20
+ function isRecord(value) {
21
+ return !!value && typeof value === 'object' && !Array.isArray(value);
22
+ }
23
+
24
+ // A record is a native configuration update only when every measured field is exact: the envelope
25
+ // carries no unknown key, `type` is the `response_item` envelope, the payload holds exactly
26
+ // `type`/`reasoning` with a nonblank effort STRING (never an enum or version list), and the payload
27
+ // matches the native harness-authored marker the REQUIRED `harness_authored_configuration: true`
28
+ // names. This is SHAPE validation, not cryptographic authentication: the marker only has to match
29
+ // the value the native harness writes. Any other shape returns false so the caller's existing
30
+ // refusal fires unchanged.
31
+ function isNativeConfigurationUpdate(record) {
32
+ if (!isRecord(record)) return false;
33
+ if (Object.keys(record).some((key) => !ENVELOPE_KEYS.has(key))) return false;
34
+ if (record.type !== 'response_item') return false;
35
+ if (Object.hasOwn(record, 'timestamp') && typeof record.timestamp !== 'string') return false;
36
+ if (record.ordinal !== undefined && record.ordinal !== null
37
+ && (!Number.isSafeInteger(record.ordinal) || record.ordinal < 0)) return false;
38
+ if (!Object.hasOwn(record, 'metadata') || !isRecord(record.metadata)) return false;
39
+ const metadata = record.metadata;
40
+ if (Object.keys(metadata).some((key) => !METADATA_KEYS.has(key))) return false;
41
+ if (metadata.harness_authored_configuration !== true) return false;
42
+ if (Object.hasOwn(metadata, 'client_authored') && metadata.client_authored !== false) return false;
43
+ if (!isRecord(record.payload)) return false;
44
+ const payload = record.payload;
45
+ if (Object.keys(payload).length !== PAYLOAD_KEYS.size) return false;
46
+ if (Object.keys(payload).some((key) => !PAYLOAD_KEYS.has(key))) return false;
47
+ if (payload.type !== 'configuration_update') return false;
48
+ if (!isRecord(payload.reasoning)) return false;
49
+ const reasoningKeys = Object.keys(payload.reasoning);
50
+ if (reasoningKeys.length !== 1 || reasoningKeys[0] !== 'effort') return false;
51
+ const effort = payload.reasoning.effort;
52
+ return typeof effort === 'string' && effort.trim().length > 0;
53
+ }
54
+
55
+ module.exports = { isNativeConfigurationUpdate };