create-walle 0.10.0 → 0.10.2

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 (381) hide show
  1. package/README.md +88 -41
  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 +7 -5
  6. package/package.json +10 -4
  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 +10 -22
  10. package/template/coding-task-manager/bin/capture-codex-rollout-records.js +417 -0
  11. package/template/coding-task-manager/bin/census-codex-lead-history.js +325 -0
  12. package/template/coding-task-manager/bin/claude-hook.js +7 -3
  13. package/template/coding-task-manager/bin/claude-table-parity.js +307 -0
  14. package/template/coding-task-manager/bin/conversation-storage-auto-migration-lib.js +16 -1
  15. package/template/coding-task-manager/bin/conversation-storage-generation-evidence.js +9 -2
  16. package/template/coding-task-manager/bin/conversation-storage-service-entry-lib.js +16 -1
  17. package/template/coding-task-manager/bin/conversation-storage-walle-owner.js +247 -0
  18. package/template/coding-task-manager/bin/ctm-machine-pair.js +160 -0
  19. package/template/coding-task-manager/bin/lead-wait-census.js +1348 -0
  20. package/template/coding-task-manager/bin/repair-foreign-clone.js +564 -0
  21. package/template/coding-task-manager/bin/repair-resume-echo-titles.js +248 -0
  22. package/template/coding-task-manager/bin/seam-replay-codex.js +301 -0
  23. package/template/coding-task-manager/bin/write-lock-bench.js +111 -0
  24. package/template/coding-task-manager/db.js +705 -286
  25. package/template/coding-task-manager/git-utils.js +44 -0
  26. package/template/coding-task-manager/lib/adopted-host-redial.js +4 -0
  27. package/template/coding-task-manager/lib/agent-presets.js +15 -0
  28. package/template/coding-task-manager/lib/agent-title-apply.js +88 -0
  29. package/template/coding-task-manager/lib/agent-title-backfill-read.js +92 -0
  30. package/template/coding-task-manager/lib/api/host-stats.js +98 -0
  31. package/template/coding-task-manager/lib/api/ingress.js +35 -12
  32. package/template/coding-task-manager/lib/api/machine-pairing.js +285 -0
  33. package/template/coding-task-manager/lib/api/machine-pool.js +307 -0
  34. package/template/coding-task-manager/lib/api/machines.js +461 -0
  35. package/template/coding-task-manager/lib/api/misc-ops.js +20 -5
  36. package/template/coding-task-manager/lib/api/providers.js +53 -6
  37. package/template/coding-task-manager/lib/api/resume-from-store.js +25 -0
  38. package/template/coding-task-manager/lib/api/sessions.js +160 -8
  39. package/template/coding-task-manager/lib/api/transcript-history.js +17 -4
  40. package/template/coding-task-manager/lib/api/worktrees.js +38 -37
  41. package/template/coding-task-manager/lib/approval-drift.js +16 -1
  42. package/template/coding-task-manager/lib/approval-logical-frame.js +5 -1
  43. package/template/coding-task-manager/lib/approval-scope.js +68 -4
  44. package/template/coding-task-manager/lib/auth-context.js +32 -2
  45. package/template/coding-task-manager/lib/auth-rate-limit.js +41 -1
  46. package/template/coding-task-manager/lib/auth-rules.js +186 -45
  47. package/template/coding-task-manager/lib/broadcast-serialize.js +2 -1
  48. package/template/coding-task-manager/lib/browser-session-broker.js +9 -1
  49. package/template/coding-task-manager/lib/browser-use-adapter.js +33 -2
  50. package/template/coding-task-manager/lib/claude-markdown-ansi.js +27 -85
  51. package/template/coding-task-manager/lib/claude-session-title.js +6 -30
  52. package/template/coding-task-manager/lib/claude-table-layout.js +322 -0
  53. package/template/coding-task-manager/lib/client-diag-handler.js +25 -0
  54. package/template/coding-task-manager/lib/codex-config-guard.js +33 -3
  55. package/template/coding-task-manager/lib/codex-harness-qualification.js +12 -0
  56. package/template/coding-task-manager/lib/codex-history-terminal-renderer.js +33 -33
  57. package/template/coding-task-manager/lib/codex-launch-health.js +29 -2
  58. package/template/coding-task-manager/lib/codex-link-preparation.js +9 -8
  59. package/template/coding-task-manager/lib/codex-local-links.js +267 -0
  60. package/template/coding-task-manager/lib/codex-markdown-lists.js +160 -0
  61. package/template/coding-task-manager/lib/codex-native-history-prefix.js +4 -0
  62. package/template/coding-task-manager/lib/codex-paths.js +2 -1
  63. package/template/coding-task-manager/lib/codex-source-handoff.js +186 -0
  64. package/template/coding-task-manager/lib/coding-agent-models.js +21 -30
  65. package/template/coding-task-manager/lib/coding-session-model-adapters.js +27 -2
  66. package/template/coding-task-manager/lib/coding-session-model-projection.js +5 -0
  67. package/template/coding-task-manager/lib/coding-session-model-runtime.js +1 -2
  68. package/template/coding-task-manager/lib/coding-session-model-state.js +10 -0
  69. package/template/coding-task-manager/lib/coding-session-model-sync-state.js +0 -1
  70. package/template/coding-task-manager/lib/conversation-import/cursor-guard-owner.js +10 -0
  71. package/template/coding-task-manager/lib/create/resolve-launch-params.js +8 -1
  72. package/template/coding-task-manager/lib/ctm-boot-lifecycle.js +17 -1
  73. package/template/coding-task-manager/lib/db-domain-tables.js +7 -0
  74. package/template/coding-task-manager/lib/db-domains.js +21 -2
  75. package/template/coding-task-manager/lib/db-owner-op-registry.js +7 -0
  76. package/template/coding-task-manager/lib/db-owner-worker-client.js +22 -0
  77. package/template/coding-task-manager/lib/db-schema-source-files.js +1 -0
  78. package/template/coding-task-manager/lib/feature-manifest.js +1 -3
  79. package/template/coding-task-manager/lib/fs-watcher.js +3 -2
  80. package/template/coding-task-manager/lib/harness-history-transition.js +41 -14
  81. package/template/coding-task-manager/lib/headless-inflight-ops.js +203 -0
  82. package/template/coding-task-manager/lib/headless-missing-reply.js +42 -0
  83. package/template/coding-task-manager/lib/headless-term-service.js +60 -23
  84. package/template/coding-task-manager/lib/history-transition-read-op.js +179 -23
  85. package/template/coding-task-manager/lib/host-control-dial.js +167 -0
  86. package/template/coding-task-manager/lib/host-handoff-orchestrator.js +16 -2
  87. package/template/coding-task-manager/lib/host-handoff.js +51 -13
  88. package/template/coding-task-manager/lib/host-health-ledger.js +164 -12
  89. package/template/coding-task-manager/lib/host-self-truth-watchdog.js +4 -0
  90. package/template/coding-task-manager/lib/host-stats.js +328 -0
  91. package/template/coding-task-manager/lib/host-threadpool-evacuation.js +160 -0
  92. package/template/coding-task-manager/lib/host-threadpool-monitor.js +14 -1
  93. package/template/coding-task-manager/lib/hosted-input-dispatch.js +203 -0
  94. package/template/coding-task-manager/lib/hosted-sync-worker.js +113 -5
  95. package/template/coding-task-manager/lib/instance-id-ownership-manifest.js +4 -0
  96. package/template/coding-task-manager/lib/instance-manifest-runtime.js +3 -0
  97. package/template/coding-task-manager/lib/instance-manifest.js +13 -1
  98. package/template/coding-task-manager/lib/instance-sync-status.js +15 -0
  99. package/template/coding-task-manager/lib/kernel/diag-log.js +12 -0
  100. package/template/coding-task-manager/lib/launch-model-override.js +160 -1
  101. package/template/coding-task-manager/lib/launch-plan-worker.js +59 -2
  102. package/template/coding-task-manager/lib/lead-model-observer.js +17 -2
  103. package/template/coding-task-manager/lib/lead-model-switch-runtime.js +57 -4
  104. package/template/coding-task-manager/lib/lead-model-switch.js +11 -2
  105. package/template/coding-task-manager/lib/lead-model-transition-runtime.js +42 -4
  106. package/template/coding-task-manager/lib/lead-model-transition-store.js +61 -3
  107. package/template/coding-task-manager/lib/legacy-draft-cancellation-recovery.js +111 -0
  108. package/template/coding-task-manager/lib/login-tripwire.js +18 -0
  109. package/template/coding-task-manager/lib/machine-pairing.js +238 -0
  110. package/template/coding-task-manager/lib/machine-pool.js +409 -0
  111. package/template/coding-task-manager/lib/machine-registry.js +749 -0
  112. package/template/coding-task-manager/lib/machine-self.js +66 -0
  113. package/template/coding-task-manager/lib/main-thread-lint-exemptions.json +56 -4
  114. package/template/coding-task-manager/lib/media-journal-control-reader.js +473 -0
  115. package/template/coding-task-manager/lib/media-journal.js +84 -27
  116. package/template/coding-task-manager/lib/media-store-options.js +43 -15
  117. package/template/coding-task-manager/lib/migrations/v56-host-samples-and-machine-pool.js +76 -0
  118. package/template/coding-task-manager/lib/mirror-feed-sanitize.js +12 -3
  119. package/template/coding-task-manager/lib/model-execution-recipe-metadata.js +16 -3
  120. package/template/coding-task-manager/lib/model-proxy/anthropic-face.js +4 -0
  121. package/template/coding-task-manager/lib/model-proxy/chat-response-translators.js +3 -0
  122. package/template/coding-task-manager/lib/model-proxy/collaboration-codec.js +94 -0
  123. package/template/coding-task-manager/lib/model-proxy/handoff.js +494 -0
  124. package/template/coding-task-manager/lib/model-proxy/lead-worker-picks.js +25 -0
  125. package/template/coding-task-manager/lib/model-proxy/native-lead-listener.js +61 -7
  126. package/template/coding-task-manager/lib/model-proxy/proxy-cli.js +200 -0
  127. package/template/coding-task-manager/lib/model-proxy/proxy-instance-record.js +257 -0
  128. package/template/coding-task-manager/lib/model-proxy/responses-face.js +24 -2
  129. package/template/coding-task-manager/lib/model-proxy/stream-accounting.js +205 -0
  130. package/template/coding-task-manager/lib/model-proxy/tokens.js +78 -0
  131. package/template/coding-task-manager/lib/model-proxy/upstream-outcome.js +9 -0
  132. package/template/coding-task-manager/lib/native-history-control.js +62 -14
  133. package/template/coding-task-manager/lib/native-lead-settings-client.js +2 -1
  134. package/template/coding-task-manager/lib/native-lead-tls.js +18 -4
  135. package/template/coding-task-manager/lib/oauth-proxy-supervisor.js +628 -64
  136. package/template/coding-task-manager/lib/owner-action-manifest-data.json +14 -0
  137. package/template/coding-task-manager/lib/painted-row-recorder.js +9 -1
  138. package/template/coding-task-manager/lib/prompt-admission-trace.js +69 -0
  139. package/template/coding-task-manager/lib/prompt-submission-contract.js +21 -1
  140. package/template/coding-task-manager/lib/provider-login-broker.js +192 -9
  141. package/template/coding-task-manager/lib/provider-login-capture.js +153 -0
  142. package/template/coding-task-manager/lib/queue-draft-status-overlay.js +36 -0
  143. package/template/coding-task-manager/lib/raw-codex-history-window.js +5 -3
  144. package/template/coding-task-manager/lib/raw-history-block.js +3 -1
  145. package/template/coding-task-manager/lib/read-pool-client.js +36 -24
  146. package/template/coding-task-manager/lib/read-pool-op-registry.js +10 -1
  147. package/template/coding-task-manager/lib/read-pool-telemetry.js +14 -5
  148. package/template/coding-task-manager/lib/recent-catalog-query.js +26 -0
  149. package/template/coding-task-manager/lib/recent-session-catalog-response.js +9 -0
  150. package/template/coding-task-manager/lib/remote-command-context.js +12 -0
  151. package/template/coding-task-manager/lib/remote-command-runtime.js +18 -5
  152. package/template/coding-task-manager/lib/remote-machine-catalog.js +1062 -0
  153. package/template/coding-task-manager/lib/remote-machine-create.js +693 -0
  154. package/template/coding-task-manager/lib/remote-machine-link.js +939 -0
  155. package/template/coding-task-manager/lib/remote-machine-proxy.js +520 -0
  156. package/template/coding-task-manager/lib/remote-session-forward.js +306 -0
  157. package/template/coding-task-manager/lib/remote-submission-status.js +6 -0
  158. package/template/coding-task-manager/lib/restart-outcome-truth.js +20 -3
  159. package/template/coding-task-manager/lib/restart-preflight.js +9 -2
  160. package/template/coding-task-manager/lib/restore-backoff-gate.js +10 -2
  161. package/template/coding-task-manager/lib/restore-prepare-retry.js +12 -5
  162. package/template/coding-task-manager/lib/restore-resume-batch.js +22 -1
  163. package/template/coding-task-manager/lib/resume-blocked-wire.js +62 -1
  164. package/template/coding-task-manager/lib/resume-cwd.js +13 -0
  165. package/template/coding-task-manager/lib/resume-from-store.js +12 -1
  166. package/template/coding-task-manager/lib/resume-origin-facts.js +38 -1
  167. package/template/coding-task-manager/lib/resume-preflight.js +21 -16
  168. package/template/coding-task-manager/lib/review-repo-admission.js +39 -6
  169. package/template/coding-task-manager/lib/review-repo-registry.js +17 -0
  170. package/template/coding-task-manager/lib/root-delivery-runtime.js +72 -15
  171. package/template/coding-task-manager/lib/root-delivery-selection.js +37 -1
  172. package/template/coding-task-manager/lib/root-prompt-admission.js +43 -11
  173. package/template/coding-task-manager/lib/root-prompt-flow.js +175 -38
  174. package/template/coding-task-manager/lib/scrollback-archive-store.js +7 -4
  175. package/template/coding-task-manager/lib/server-memory-sampler-runtime.js +10 -0
  176. package/template/coding-task-manager/lib/server-memory-sampler.js +41 -2
  177. package/template/coding-task-manager/lib/session-analysis-memory.js +2 -0
  178. package/template/coding-task-manager/lib/session-create/codex-native-provider-gate.js +218 -0
  179. package/template/coding-task-manager/lib/session-create/codex-resume-exit-classify.js +52 -0
  180. package/template/coding-task-manager/lib/session-create/delegate-worker.js +95 -6
  181. package/template/coding-task-manager/lib/session-create/identity.js +20 -1
  182. package/template/coding-task-manager/lib/session-create/prepared.js +69 -1
  183. package/template/coding-task-manager/lib/session-create/provider-launch-context.js +77 -0
  184. package/template/coding-task-manager/lib/session-create/provider-process.js +38 -39
  185. package/template/coding-task-manager/lib/session-create/response.js +30 -12
  186. package/template/coding-task-manager/lib/session-create/transcript.js +13 -4
  187. package/template/coding-task-manager/lib/session-create/worker-continuation.js +43 -1
  188. package/template/coding-task-manager/lib/session-create/worker-notices.js +94 -5
  189. package/template/coding-task-manager/lib/session-create/worker-observability.js +99 -7
  190. package/template/coding-task-manager/lib/session-create/worker-stop.js +11 -3
  191. package/template/coding-task-manager/lib/session-create/worker-wait-watcher.js +315 -0
  192. package/template/coding-task-manager/lib/session-geometry-authority-handler.js +10 -1
  193. package/template/coding-task-manager/lib/session-host-manager.js +152 -206
  194. package/template/coding-task-manager/lib/session-jobs.js +17 -9
  195. package/template/coding-task-manager/lib/session-lifecycle.js +20 -50
  196. package/template/coding-task-manager/lib/session-model-action-preconditions.js +68 -3
  197. package/template/coding-task-manager/lib/session-resource-sampler.js +67 -9
  198. package/template/coding-task-manager/lib/session-standup.js +67 -4
  199. package/template/coding-task-manager/lib/session-status-ledger.js +42 -3
  200. package/template/coding-task-manager/lib/session-status-runtime.js +45 -1
  201. package/template/coding-task-manager/lib/session-status.js +2 -2
  202. package/template/coding-task-manager/lib/session-title-mirror.js +25 -57
  203. package/template/coding-task-manager/lib/session-transcript-trash.js +8 -1
  204. package/template/coding-task-manager/lib/startup-pointer-write.js +57 -0
  205. package/template/coding-task-manager/lib/state-sync/painted-frame-field.js +11 -0
  206. package/template/coding-task-manager/lib/storage/coding-session-model-store.js +21 -22
  207. package/template/coding-task-manager/lib/surviving-owner-bootstrap.js +7 -2
  208. package/template/coding-task-manager/lib/surviving-owner-recovery.js +2 -1
  209. package/template/coding-task-manager/lib/terminal-draft-http-status.js +25 -0
  210. package/template/coding-task-manager/lib/transcript-archiver.js +229 -229
  211. package/template/coding-task-manager/lib/transcript-frame-cache.js +12 -2
  212. package/template/coding-task-manager/lib/transcript-guard-job.js +55 -4
  213. package/template/coding-task-manager/lib/transcript-link.js +77 -0
  214. package/template/coding-task-manager/lib/transcript-manifest-store.js +8 -4
  215. package/template/coding-task-manager/lib/transcript-source.js +8 -3
  216. package/template/coding-task-manager/lib/transcript-store.js +40 -0
  217. package/template/coding-task-manager/lib/tunnel-lane-governor.js +6 -3
  218. package/template/coding-task-manager/lib/typing-interaction-trace.js +136 -2
  219. package/template/coding-task-manager/lib/typing-worker-stages.js +208 -1
  220. package/template/coding-task-manager/lib/usage-ledger/claude-parse.js +53 -2
  221. package/template/coding-task-manager/lib/usage-ledger/ingest.js +13 -4
  222. package/template/coding-task-manager/lib/usage-ledger/read.js +14 -0
  223. package/template/coding-task-manager/lib/usage-ledger/schema.js +49 -1
  224. package/template/coding-task-manager/lib/usage-ledger/store.js +337 -6
  225. package/template/coding-task-manager/lib/usage-ledger/task-read.js +123 -5
  226. package/template/coding-task-manager/lib/visible-revision-watchdog.js +8 -12
  227. package/template/coding-task-manager/lib/wake-skip-reasons.js +46 -0
  228. package/template/coding-task-manager/lib/walle-supervisor.js +98 -14
  229. package/template/coding-task-manager/lib/worker-failure-classify.js +13 -1
  230. package/template/coding-task-manager/lib/ws/input.js +1 -0
  231. package/template/coding-task-manager/lib/ws/state-sync.js +19 -2
  232. package/template/coding-task-manager/lib/ws/terminal-attach.js +32 -1
  233. package/template/coding-task-manager/lib/ws-router.js +68 -1
  234. package/template/coding-task-manager/lib/ws-send-admission.js +22 -4
  235. package/template/coding-task-manager/oauth-proxy.js +99 -55
  236. package/template/coding-task-manager/package-lock.json +24 -0
  237. package/template/coding-task-manager/package.json +3 -0
  238. package/template/coding-task-manager/protocol/message-table.json +0 -10
  239. package/template/coding-task-manager/protocol/messages.js +0 -10
  240. package/template/coding-task-manager/protocol/ws-schema.json +0 -20
  241. package/template/coding-task-manager/protocol/ws-schema.md +0 -2
  242. package/template/coding-task-manager/providers/codex-mcp-extract.js +121 -19
  243. package/template/coding-task-manager/providers/codex-mcp.js +14 -5
  244. package/template/coding-task-manager/public/css/app.css +279 -2
  245. package/template/coding-task-manager/public/css/reviews.css +4 -0
  246. package/template/coding-task-manager/public/index.html +297 -240
  247. package/template/coding-task-manager/public/js/app/machines-page.js +1252 -0
  248. package/template/coding-task-manager/public/js/app/models-tab.js +546 -36
  249. package/template/coding-task-manager/public/js/app/worktrees-panel.js +7 -5
  250. package/template/coding-task-manager/public/js/background-work.js +13 -7
  251. package/template/coding-task-manager/public/js/client-health-core.js +81 -0
  252. package/template/coding-task-manager/public/js/client-health-main.js +61 -0
  253. package/template/coding-task-manager/public/js/coding-session-model-presentation.js +44 -4
  254. package/template/coding-task-manager/public/js/core/session-commands.js +676 -0
  255. package/template/coding-task-manager/public/js/core/session-selectors.js +5 -1
  256. package/template/coding-task-manager/public/js/history-app-seam.js +26 -2
  257. package/template/coding-task-manager/public/js/history-painted-rows.js +17 -2
  258. package/template/coding-task-manager/public/js/history-reader-park.js +13 -1
  259. package/template/coding-task-manager/public/js/history-scroller.js +187 -9
  260. package/template/coding-task-manager/public/js/history-transcript-pages.js +5 -5
  261. package/template/coding-task-manager/public/js/machine-pool-shared.js +436 -0
  262. package/template/coding-task-manager/public/js/private-state-scope.js +31 -3
  263. package/template/coding-task-manager/public/js/prompt-submission-client.js +173 -4
  264. package/template/coding-task-manager/public/js/prompt-submission-tray.js +281 -0
  265. package/template/coding-task-manager/public/js/protocol.js +0 -10
  266. package/template/coding-task-manager/public/js/queue-panel-submission-reconcile.js +174 -1
  267. package/template/coding-task-manager/public/js/reviews.js +7 -3
  268. package/template/coding-task-manager/public/js/root-draft-lifetime.js +139 -2
  269. package/template/coding-task-manager/public/js/root-queue-builder-lifetime.js +16 -0
  270. package/template/coding-task-manager/public/js/row-join.js +18 -3
  271. package/template/coding-task-manager/public/js/session-model-picker.js +1 -1
  272. package/template/coding-task-manager/public/js/session-search-utils.js +46 -19
  273. package/template/coding-task-manager/public/js/session-usage-view.js +1 -0
  274. package/template/coding-task-manager/public/js/state-sync-client.js +4 -0
  275. package/template/coding-task-manager/public/js/terminal/runtime-02.js +16 -7
  276. package/template/coding-task-manager/public/js/terminal/runtime-03.js +41 -0
  277. package/template/coding-task-manager/public/js/terminal/runtime-04.js +41 -4
  278. package/template/coding-task-manager/public/js/terminal/runtime-12.js +52 -2
  279. package/template/coding-task-manager/public/js/terminal/runtime-16.js +12 -12
  280. package/template/coding-task-manager/public/js/terminal/runtime-18.js +14 -0
  281. package/template/coding-task-manager/public/js/terminal/runtime-19.js +8 -4
  282. package/template/coding-task-manager/public/js/terminal/runtime-20.js +210 -73
  283. package/template/coding-task-manager/public/js/terminal/runtime-21.js +19 -6
  284. package/template/coding-task-manager/public/js/terminal/runtime-22.js +86 -0
  285. package/template/coding-task-manager/public/js/terminal-history-viewport.js +1 -3
  286. package/template/coding-task-manager/public/js/terminal-wheel.js +39 -2
  287. package/template/coding-task-manager/public/js/walle/chat-conversation.js +11 -3
  288. package/template/coding-task-manager/public/js/walle-session.js +30 -7
  289. package/template/coding-task-manager/public/m/app.css +226 -8
  290. package/template/coding-task-manager/public/m/app.js +502 -9
  291. package/template/coding-task-manager/public/m/index.html +38 -1
  292. package/template/coding-task-manager/public/m/machines.js +1313 -0
  293. package/template/coding-task-manager/public/m/pool-failover.js +391 -0
  294. package/template/coding-task-manager/public/m/private-queue-actions.js +26 -7
  295. package/template/coding-task-manager/public/m/sw.js +5 -0
  296. package/template/coding-task-manager/queue-engine.js +13 -0
  297. package/template/coding-task-manager/server/approvals.js +5 -6
  298. package/template/coding-task-manager/server/boot.js +136 -17
  299. package/template/coding-task-manager/server.js +964 -425
  300. package/template/coding-task-manager/session-integrity.js +7 -9
  301. package/template/coding-task-manager/workers/db-owner-worker.js +53 -7
  302. package/template/coding-task-manager/workers/read-pool-worker.js +17 -6
  303. package/template/coding-task-manager/workers/session-host-pool-process.js +18 -4
  304. package/template/coding-task-manager/workers/session-host-process.js +14 -3
  305. package/template/coding-task-manager/workers/transcript-archive-worker.js +1 -1
  306. package/template/coding-task-manager/workers/worktree-worker.js +34 -0
  307. package/template/package-lock.json +2 -2
  308. package/template/package.json +1 -1
  309. package/template/scripts/conversation-storage-v2-migration.js +78 -11
  310. package/template/shared/conversation-storage-v2-contract.js +42 -6
  311. package/template/shared/fixtures/worker-status-payloads.json +392 -0
  312. package/template/shared/git-remote-key.js +83 -0
  313. package/template/shared/host-identity.js +98 -2
  314. package/template/shared/owner-write-safety.js +135 -0
  315. package/template/shared/public-runtime.js +13 -5
  316. package/template/shared/release-schema.json +3 -2
  317. package/template/shared/report-citations.js +14 -0
  318. package/template/shared/sqlite-write-lock.js +361 -223
  319. package/template/shared/storage/contract.js +35 -3
  320. package/template/wall-e/agent.js +21 -0
  321. package/template/wall-e/api-walle.js +5 -0
  322. package/template/wall-e/bin/brain-purge-legacy-ctm.js +3 -2
  323. package/template/wall-e/bin/walle-mcp-stdio.js +12 -6
  324. package/template/wall-e/brain/helper-rules-schema.js +129 -0
  325. package/template/wall-e/brain/migrations.js +51 -22
  326. package/template/wall-e/brain/model-deployment-facts.js +31 -1
  327. package/template/wall-e/brain/owner-call-whitelist.js +16 -0
  328. package/template/wall-e/brain/schema-ensures.js +22 -0
  329. package/template/wall-e/brain.js +1 -1
  330. package/template/wall-e/coding/host-capabilities.js +2 -2
  331. package/template/wall-e/coding/journal-dispatcher.js +51 -0
  332. package/template/wall-e/coding/session-journal.js +28 -40
  333. package/template/wall-e/coding-orchestrator.js +23 -26
  334. package/template/wall-e/fly.toml +1 -1
  335. package/template/wall-e/http/auth.js +18 -1
  336. package/template/wall-e/http/blog-views-api.js +318 -0
  337. package/template/wall-e/http/helper-rules-api.js +321 -0
  338. package/template/wall-e/http/model-proxy-providers.js +3 -1
  339. package/template/wall-e/http/telemetry-api.js +12 -0
  340. package/template/wall-e/lib/blog-view-policy.js +88 -0
  341. package/template/wall-e/lib/blog-view-store.js +169 -0
  342. package/template/wall-e/lib/client-config-lock.js +2 -1
  343. package/template/wall-e/lib/coding-journal-writer-child-client.js +67 -18
  344. package/template/wall-e/lib/error-kinds.js +10 -1
  345. package/template/wall-e/lib/feature-manifest.js +1 -1
  346. package/template/wall-e/lib/helper-rules/cell-state.js +123 -0
  347. package/template/wall-e/lib/helper-rules/evaluate.js +357 -0
  348. package/template/wall-e/lib/helper-rules/explore-rubric.md +12 -0
  349. package/template/wall-e/lib/helper-rules/grade.js +277 -0
  350. package/template/wall-e/lib/helper-rules/label.js +247 -0
  351. package/template/wall-e/lib/helper-rules/lead-call-hook.js +522 -0
  352. package/template/wall-e/lib/helper-rules/store.js +667 -0
  353. package/template/wall-e/lib/mcp-integration.js +5 -6
  354. package/template/wall-e/lib/runtime-worker-pool.js +1 -0
  355. package/template/wall-e/lib/scheduler-worker-jobs.js +6 -0
  356. package/template/wall-e/lib/telemetry-db-schema.js +37 -0
  357. package/template/wall-e/lib/telemetry-process-client.js +76 -1
  358. package/template/wall-e/llm/default-fallback.js +4 -0
  359. package/template/wall-e/llm/model-catalog.js +13 -4
  360. package/template/wall-e/llm/model-roles.js +6 -0
  361. package/template/wall-e/llm/portkey-http.js +150 -0
  362. package/template/wall-e/llm/portkey-sync.js +15 -145
  363. package/template/wall-e/llm/worker-mcp-routing.js +61 -0
  364. package/template/wall-e/llm/worker-route.js +43 -1
  365. package/template/wall-e/loops/brain-custom-writes.js +45 -0
  366. package/template/wall-e/mcp-protocol-contract.js +41 -1
  367. package/template/wall-e/mcp-server.js +13 -2
  368. package/template/wall-e/mcp-worker-schemas.js +20 -2
  369. package/template/wall-e/memory/ctm-context-client.js +25 -5
  370. package/template/wall-e/shared/release-schema.json +3 -2
  371. package/template/wall-e/shared/sqlite-write-lock.js +361 -223
  372. package/template/wall-e/shared/storage/contract.js +35 -3
  373. package/template/wall-e/skills/_templates/delegate-worker/VERSION +1 -1
  374. package/template/wall-e/skills/_templates/delegate-worker/released-sha256.json +6 -0
  375. package/template/wall-e/skills/_templates/delegate-worker/templates/claude/SKILL.md +7 -2
  376. package/template/wall-e/skills/_templates/delegate-worker/templates/codex/SKILL.md +7 -2
  377. package/template/wall-e/tools/local-tools.js +12 -5
  378. package/template/wall-e/workers/brain-owner-worker.js +9 -0
  379. package/template/wall-e/workers/coding-journal-writer-child.js +8 -1
  380. package/template/wall-e/workers/telemetry-worker.js +8 -0
  381. package/template/coding-task-manager/lib/giant-freeze-park.js +0 -31
@@ -363,7 +363,7 @@ const OP_META = {
363
363
  materializeRestoredSessionIndex: { kind: 'write', equality: 'exact', domain: 'core' },
364
364
  persistJsonlReconciliationBatch: { kind: 'write', equality: 'exact', domain: 'core' },
365
365
  getAllSessionTitles: { kind: 'read', equality: 'exact' },
366
- setSessionTitleStatusNew: { kind: 'write', equality: 'exact', domain: 'core' }, setSessionTitleMirror: { kind: 'write', equality: 'exact', domain: 'core' }, getSessionTitleMirror: { kind: 'read', equality: 'exact' }, // WP-1
366
+ setSessionTitleStatusNew: { kind: 'write', equality: 'exact', domain: 'core' }, setSessionTitleMirror: { kind: 'write', equality: 'exact', domain: 'core' }, getSessionTitleMirror: { kind: 'read', equality: 'exact' }, applyAgentTitleBackfillRows: { kind: 'write', equality: 'exact', domain: 'core' }, // WP-1 / session-name WP-6
367
367
  updateSessionTokens: { kind: 'write', equality: 'exact', domain: 'core' },
368
368
  getSessionTokens: { kind: 'read', equality: 'exact' },
369
369
  // WP-1 (design doc §5/§9 S-19): last known physical-footprint sample, persisted at
@@ -426,6 +426,40 @@ const OP_META = {
426
426
  getHostedSyncSchemaStatus: { kind: 'sqlite-only', equality: 'exact' },
427
427
  listHostedWorkspaceBindings: { kind: 'sqlite-only', equality: 'set', idKey: 'logical_id' },
428
428
  upsertHostedWorkspaceBinding: { kind: 'write', equality: 'exact', domain: 'core' },
429
+ // WP-2 (docs/remote-machine-hub-sessions-2026-10-22.html §6.1/§8, deferred from WP-0): the hub
430
+ // machine-registry writes. Single-table (`machines`, classified 'core' in
431
+ // coding-task-manager/lib/db-domain-tables.js) — hence the explicit `tables` list Gate 2i
432
+ // checks against the tag, and the domain tag itself, which is what keeps these off the base
433
+ // (firehose) writer behind conversation import once the domain split is on.
434
+ upsertMachineRow: { kind: 'write', equality: 'exact', domain: 'core', tables: ['machines'] },
435
+ recordMachineProbe: { kind: 'write', equality: 'exact', domain: 'core', tables: ['machines'] },
436
+ deleteMachineRow: { kind: 'write', equality: 'exact', domain: 'core', tables: ['machines'] },
437
+ // WP-1 (docs/machine-pool-picker-pairing-dashboard-2026-10-24.html §6.1, D-11, §9 S-4): the
438
+ // host-sample pair. `recordHostSample` is one INSERT OR REPLACE plus the 24 h DELETE in a single
439
+ // transaction, single-table (`host_samples`, classified 'core' in
440
+ // coding-task-manager/lib/db-domain-tables.js) — so the explicit `tables` list Gate 2i checks
441
+ // against the tag is exact, and Gate 2g finds the routing declaration the action needs.
442
+ recordHostSample: { kind: 'write', equality: 'exact', domain: 'core', tables: ['host_samples'] },
443
+ // The bounded read beside it (oldest first, `sinceMs`/`limit`). `set` equality, keyed on `at`
444
+ // — the same shape as listSyncOutbox below.
445
+ listHostSamples: { kind: 'read', equality: 'set', idKey: 'at' },
446
+ // WP-2a (docs/machine-pool-picker-pairing-dashboard-2026-10-24.html §6.1, D-4/P-5/P-6, §9 S-4):
447
+ // the machine-owned settings write (single row, single table `machine_self`), the P-5 roster
448
+ // replacement (single table `machines`, one transaction) and the leave() sweep (`machines`).
449
+ // Both tables are classified 'core' in coding-task-manager/lib/db-domain-tables.js.
450
+ setMachineSelf: { kind: 'write', equality: 'exact', domain: 'core', tables: ['machine_self'] },
451
+ replaceRosterMachines: { kind: 'write', equality: 'exact', domain: 'core', tables: ['machines'] },
452
+ deleteAllMachineRows: { kind: 'write', equality: 'exact', domain: 'core', tables: ['machines'] },
453
+ // WP-3 (machine-pool-picker-pairing-dashboard-2026-10-24.html §6.3, D-6/D-9, §9 S-15/S-16): the
454
+ // pairing-offer trio — mint one offer, mark exactly one redeemed (single-use), and the AC-3c burn
455
+ // that flips every live offer at once. Single-table (`machine_pairing_offers`, classified 'core' in
456
+ // coding-task-manager/lib/db-domain-tables.js), so Gate 2i's `tables` list is exact. The bounded
457
+ // read beside them (`listLivePairingOffers`, unspent+unexpired as of `at`) is `set` equality keyed
458
+ // on `id`, the same shape as listHostSamples above.
459
+ insertPairingOffer: { kind: 'write', equality: 'exact', domain: 'core', tables: ['machine_pairing_offers'] },
460
+ markPairingOfferRedeemed: { kind: 'write', equality: 'exact', domain: 'core', tables: ['machine_pairing_offers'] },
461
+ burnLivePairingOffers: { kind: 'write', equality: 'exact', domain: 'core', tables: ['machine_pairing_offers'] },
462
+ listLivePairingOffers: { kind: 'read', equality: 'set', idKey: 'id' },
429
463
  seedHostedWorkspaceBindings: { kind: 'sqlite-only', equality: 'exact', domain: 'core', tables: ['workspace_bindings'] },
430
464
  updateStartupTaskWorkspaceMapping: { kind: 'write', equality: 'exact', domain: 'core' },
431
465
  repointStartupTaskWorkspace: { kind: 'sqlite-only', equality: 'exact', domain: 'core', tables: ['startup_tasks', 'sync_outbox', 'synced_entities'] },
@@ -784,8 +818,6 @@ const OP_META = {
784
818
  // the live scrollback_identity table is listed.
785
819
  prepareScrollbackForSession: { kind: 'write', equality: 'exact', domain: 'core', tables: ['scrollback_identity'] },
786
820
  upsertAgentSessionIdentity: { kind: 'write', equality: 'exact', domain: 'core', tables: ['agent_sessions'] },
787
- promoteStartupTaskTitleIfUserNamed: { kind: 'write', equality: 'exact', domain: 'core', tables: ['ctm_sessions'] },
788
- repairSessionTitlesFromStartupTasks: { kind: 'write', equality: 'exact', domain: 'core', tables: ['ctm_sessions'] },
789
821
  repairCodexRolloutAgentIdentities: { kind: 'write', equality: 'exact', domain: 'core', tables: ['agent_sessions', 'ctm_sessions'] },
790
822
  cleanupOrphanScrollbackIdentities: { kind: 'write', equality: 'exact', domain: 'core', tables: ['scrollback_identity', 'startup_tasks'] },
791
823
  // --- writer:'base' pins (deliberately NOT re-routed; behaviour unchanged) ---
@@ -1 +1 @@
1
- 4.6.0
1
+ 4.7.0
@@ -5,6 +5,7 @@
5
5
  "06efbe01e436b34adb7102fe04a5d59748dc4834b1ae6c4c45a492b2e1e79e9a": "4.1.0",
6
6
  "0dde179abdab5d523da264cab944ce48306009807e5dc566ffa14aa0c8017186": "3.0.0",
7
7
  "0e162871e8fd037c6a954c491ba5100d3f64cede44a8f82c519d2d2e33e032e3": "3.3.0",
8
+ "120cc88fa7b15ca0b75cf68873cde02bf56f867331e45a545589062b87127a89": "4.6.0",
8
9
  "14d6d156625905d0b7ed12dea1c2131edc62146f61b6f9fd187a422773d7f300": "4.4.0",
9
10
  "24a429b3c1b3651cad34317fd74d574ddb2f4863252b60db0d6b3b76050607f5": "3.8.0",
10
11
  "31e405815c6010db8a90897d69b6448dfd4c3b21cc464e5b447ab43e60f6c69e": "3.1.0",
@@ -21,7 +22,9 @@
21
22
  "9253a28aa91552c0555c0bc248ed66c61cc98ec716d517b9d1c8c3204d46d590": "3.7.0",
22
23
  "a224ec90dc7df131415d89e2fa2df82c62e7ee2981c73c0c3cae8ec35e8c3d9e": "3.2.0",
23
24
  "a87cd74831aa010a9fa28a68242038ca3e91461b070cf43ea91b4ff08848c54c": "3.8.0",
25
+ "b6c9bdc82070a8458af94d5bdad9026806e378b3adee8fe2c135f9bc3c72d720": "4.6.0",
24
26
  "c5c66a11c5262014f58b127c4b7e21e0cfaf1179f2678ee6dc6a922d27362cbe": "4.2.0",
27
+ "c9e6f75ab694bbd66c841979fe2468db2c57177d6cfc18ea4eb97e034e5d98dc": "4.7.0",
25
28
  "d9d6e3687ff5f626258f0b629e74829719df82bfcc25e079456bdd667e30abb8": "3.2.1",
26
29
  "e22741fb1233863289757660b546691b7bfd70d21f3f641d82b743324c335f9c": "3.4.0",
27
30
  "eba2b4dea2eb856fe3933be618730f75f8fc3c38c554e3a6063438bafa41d368": "4.6.0",
@@ -34,10 +37,12 @@
34
37
  "21c9ca776a755692b0bfe64960c909db804dcaaf803c725c1684e53317d9f288": "3.2.0",
35
38
  "290a270a69332fb18289f153b46b67f8a6e06459891665b952bbeca9e54d7371": "3.8.0",
36
39
  "3c5d22d4a7c432662ca8036022b79a5b9097357f2139eda7ebf4acb3c18f2b71": "3.1.0",
40
+ "3e5db71601f075a303a1a7442cc1fbac11a37362e60fd25b717e86b180c177cc": "4.7.0",
37
41
  "3ea78bdc6c5cd377e01b2061f63a4586e4859159f5c771eafea7ca0e984c8969": "4.2.0",
38
42
  "4461f6ebdf10398b6529bff84f3cd3b4145f2935fd3a5f0f1efe38ab52b2c871": "4.6.0",
39
43
  "56a9df7b9a49e7a47abadfa6c026ee599bf12f6a3cc5fc9370bfdc776f46e835": "3.4.0",
40
44
  "576083d2286162eed343150f0a28305863fb7773960f2618ddb033c6d2e1f306": "3.8.0",
45
+ "5f9eb74ee52154661e2d572269b121b45d5d76e42989a091fa83086ba5eef3ec": "4.6.0",
41
46
  "60a96b080de8243321fb68c76d664d5be9cb9983c3088e64b31da8b53b8bca5b": "4.3.0",
42
47
  "75be2666f123930e7f655ad03ed6e18b512c8349bc1cca8af7a92699616e1074": "3.2.1",
43
48
  "7de463c9f1647140a636b5155c2291c2df207e088d109ca7db6d16d2591fd948": "3.5.0",
@@ -47,6 +52,7 @@
47
52
  "8aad4b5b96ff40df281b1657a390cd8f350d3608f2349f3867d2bc985a7fe979": "3.1.0",
48
53
  "8c94e50631795fece512e58d1f849e2abd28f181ae66088806df75f718aeae61": "3.2.0",
49
54
  "b7f5ba39bd37adf2f126b07b288a1ed4195ae2c9a87a3d6db642ecb8c83b776c": "4.1.0",
55
+ "bf16fbc5d9dadb36163dd161e8621158a90c9e79b3fd72ecd6b6bcbb701ad440": "4.6.0",
50
56
  "c6cb630aca4487c95311146b5f0c148b9d6f68d42f88fc8a9a6a5fec663b54e6": "3.0.0",
51
57
  "c75019cf38784040fda2f63e8be8c8aaf988d612fb1c868a3e5f2064b971cb42": "4.3.0",
52
58
  "e1a85b80e419b38459a45c5d6c4884931b97b10a1e4e6a352af626f7a40dcd9d": "4.0.0",
@@ -52,6 +52,11 @@ Write a self-contained brief to a scratch path inside the worktree (never commit
52
52
  - `lane: "native"`: Wall-E launched nothing; spawn a read-only helper (an Agent with read-only tools) for the review as before.
53
53
  - Either way you own the verdict: check each claim against the code before acting on it. A review worker's lease does not renew (renewal needs file writes); resume it if it needs more, and a resume cannot change its profile.
54
54
 
55
+ ## Lead: waiting
56
+ - Wait on workers with walle_worker_wait and omit wait_ms. It wakes on a finished, failed, resumed or stuck worker,
57
+ on a question, and when your user types. Do not sleep-and-check and do not wrap it in a script with a short yield.
58
+ - The exploration hand-off rule (write a four-field brief before the third read; hand it to a review worker) arrives in Wall-E's MCP instructions at connect; follow it when present.
59
+
55
60
  ## Worker: implement and test
56
61
 
57
62
  Give the worker these requirements in its brief:
@@ -67,8 +72,8 @@ Use additional workers only for independent, useful subtasks with clear ownershi
67
72
  ## Lead: wait for the worker
68
73
 
69
74
  - Native lane: the Agent tool returns when the worker finishes; then read the report file.
70
- - While workers run, do non-overlapping work. When you are blocked, call `walle_worker_wait({})` with no id: it waits for all of your workers at once, in stretches of minutes, and returns as soon as one finishes or starts a new run. `woke_on: "user_input"` means your user just spoke — answer them before waiting again. Re-issue the wait while `woke_on` is `timeout`.
71
- - `woke_on: "advisory"` means the worker has gone many turns without a verified write; read its status and decide — keep waiting or stop it. `walle_stop_worker({ ctm_session_id, mode, reason })` stops a worker you own: mode `after_turn` (default) lets the in-flight request finish then ends the process; mode `now` ends it immediately. The transcript and report stay and the worker can be resumed. Use it when a worker is off-brief, duplicating another worker, or no longer needed; never DELETE the session.
75
+ - While workers run, do non-overlapping work. When you are blocked, call `walle_worker_wait({})` with no id: it waits for all of your workers at once, in stretches of minutes, and returns as soon as one finishes or starts a new run. `woke_on: "user_input"` means your user just spoke — answer them before waiting again. Until every worker is terminal, re-issue the wait after any non-terminal wake (`timeout`, `advisory`, `generation`, `user_input` once you have answered your user); the result's `lead_next_step` says so. Ending your turn with a live worker and no wait in flight leaves you idle until your user types.
76
+ - `woke_on: "advisory"` means the worker has gone many turns without a verified write; read its status and decide — call `walle_worker_wait` again to keep waiting, or stop it. `walle_stop_worker({ ctm_session_id, mode, reason })` stops a worker you own: mode `after_turn` (default) lets the in-flight request finish then ends the process; mode `now` ends it immediately. The transcript and report stay and the worker can be resumed. Use it when a worker is off-brief, duplicating another worker, or no longer needed; never DELETE the session.
72
77
  - Routed lane: never sleep-loop on the report file (a failed worker never writes one — `terminal_path` is written on every stop). For a one-off status read, poll `walle_worker_status({ ctm_session_id })` no sooner than its `poll_after_ms` (30 s when the field is absent). Terminal states are `report_ready`, `failed`, and `exited`; also stop when `exitCode` is not null. If `report_ready` arrives while `exitCode` is still null, poll once more before reading `report_text`. `exited` without a report, or a `report_text_error`, is a failure — say so. `throttled` means the worker is alive and mid-retry; keep polling; stop it only with walle_stop_worker, never by killing the process.
73
78
  - On `failed`, follow `failure.next_step`; it is written for the exact failure. `budget` means the proxy stopped the worker at a limit of its lease (`failure.budget` names the kind, the task total used, and the lease). The lease renews in place while the worker makes verifiable progress, and the ×4 ceiling covers the whole task, resumes included — but a resume never uses a lease: it is accepted at the task's current lease while `lease.headroom_requests` in `walle_worker_status` is above zero. Only a 409 `task_lease_ceiling` refusal means the task spent its whole budget; report its `task_requests` and `base_requests` to the user and pass `extra_leases` only on their word, never pre-emptively. Never switch models because of a budget stop.
74
79
  - `terminal` with `worker_repeated_action` or `worker_repeated_error` means the worker repeated the same step without new results: read what it repeated, fix the brief or the environment, then resume with a corrective message — never resume blind.
@@ -50,6 +50,11 @@ Write a self-contained brief to a scratch path inside the worktree (never commit
50
50
  - `lane: "native"`: Wall-E launched nothing; spawn a read-only helper (`spawn_agent`) for the review as before.
51
51
  - Either way you own the verdict: check each claim against the code before acting on it. A review worker's lease does not renew (renewal needs file writes); resume it if it needs more, and a resume cannot change its profile.
52
52
 
53
+ ## Lead: waiting
54
+ - Wait on workers with walle_worker_wait and omit wait_ms. It wakes on a finished, failed, resumed or stuck worker,
55
+ on a question, and when your user types. Do not sleep-and-check and do not wrap it in a script with a short yield.
56
+ - The exploration hand-off rule (write a four-field brief before the third read; hand it to a review worker) arrives in Wall-E's MCP instructions at connect; follow it when present.
57
+
53
58
  ## Worker: implement and test
54
59
 
55
60
  Give the worker these requirements in its brief:
@@ -65,8 +70,8 @@ Use additional workers only for independent, useful subtasks with clear ownershi
65
70
  ## Lead: wait for the worker
66
71
 
67
72
  - Native lane: `wait_agent` returns when the worker finishes; then read the report file.
68
- - While workers run, do non-overlapping work. When you are blocked, call `walle_worker_wait({})` with no id: it waits for all of your workers at once, in stretches of minutes, and returns as soon as one finishes or starts a new run. `woke_on: "user_input"` means your user just spoke — answer them before waiting again. Re-issue the wait while `woke_on` is `timeout`.
69
- - `woke_on: "advisory"` means the worker has gone many turns without a verified write; read its status and decide — keep waiting or stop it. `walle_stop_worker({ ctm_session_id, mode, reason })` stops a worker you own: mode `after_turn` (default) lets the in-flight request finish then ends the process; mode `now` ends it immediately. The transcript and report stay and the worker can be resumed. Use it when a worker is off-brief, duplicating another worker, or no longer needed; never DELETE the session.
73
+ - While workers run, do non-overlapping work. When you are blocked, call `walle_worker_wait({})` with no id: it waits for all of your workers at once, in stretches of minutes, and returns as soon as one finishes or starts a new run. `woke_on: "user_input"` means your user just spoke — answer them before waiting again. Until every worker is terminal, re-issue the wait after any non-terminal wake (`timeout`, `advisory`, `generation`, `user_input` once you have answered your user); the result's `lead_next_step` says so. Ending your turn with a live worker and no wait in flight leaves you idle until your user types.
74
+ - `woke_on: "advisory"` means the worker has gone many turns without a verified write; read its status and decide — call `walle_worker_wait` again to keep waiting, or stop it. `walle_stop_worker({ ctm_session_id, mode, reason })` stops a worker you own: mode `after_turn` (default) lets the in-flight request finish then ends the process; mode `now` ends it immediately. The transcript and report stay and the worker can be resumed. Use it when a worker is off-brief, duplicating another worker, or no longer needed; never DELETE the session.
70
75
  - Routed lane: never sleep-loop on the report file (a failed worker never writes one — `terminal_path` is written on every stop). For a one-off status read, poll `walle_worker_status({ ctm_session_id })` no sooner than its `poll_after_ms` (30 s when the field is absent). Terminal states are `report_ready`, `failed`, and `exited`; also stop when `exitCode` is not null. If `report_ready` arrives while `exitCode` is still null, poll once more before reading `report_text`. `exited` without a report, or a `report_text_error`, is a failure — say so. `throttled` means the worker is alive and mid-retry; keep polling; stop it only with walle_stop_worker, never by killing the process.
71
76
  - On `failed`, follow `failure.next_step`; it is written for the exact failure. `budget` means the proxy stopped the worker at a limit of its lease (`failure.budget` names the kind, the task total used, and the lease). The lease renews in place while the worker makes verifiable progress, and the ×4 ceiling covers the whole task, resumes included — but a resume never uses a lease: it is accepted at the task's current lease while `lease.headroom_requests` in `walle_worker_status` is above zero. Only a 409 `task_lease_ceiling` refusal means the task spent its whole budget; report its `task_requests` and `base_requests` to the user and pass `extra_leases` only on their word, never pre-emptively. Never switch models because of a budget stop.
72
77
  - `terminal` with `worker_repeated_action` or `worker_repeated_error` means the worker repeated the same step without new results: read what it repeated, fix the brief or the environment, then resume with a corrective message — never resume blind.
@@ -2555,7 +2555,9 @@ async function _autoChromeUsable(chromePath, { timeoutMs = 15000, pollMs = 100 }
2555
2555
  '--window-size=200,200',
2556
2556
  '--virtual-time-budget=2000',
2557
2557
  'data:text/html,<title>walle-probe</title><p>ok</p>',
2558
- ], { stdio: 'ignore', env: hostAutomationEnv() });
2558
+ // Own process group (detached): Chrome forks GPU/renderer/utility helpers into it,
2559
+ // and the cleanup below must reach them, not just the browser pid.
2560
+ ], { stdio: 'ignore', env: hostAutomationEnv(), detached: process.platform !== 'win32' });
2559
2561
  child.on('error', () => { /* expected: the poll loop below is the single source of truth for usability, not this event */ });
2560
2562
 
2561
2563
  const deadline = Date.now() + timeoutMs;
@@ -2570,9 +2572,9 @@ async function _autoChromeUsable(chromePath, { timeoutMs = 15000, pollMs = 100 }
2570
2572
  /* expected: spawn/stat failures (e.g. ENOENT, EACCES) mean unusable, not a bug to surface */
2571
2573
  usable = false;
2572
2574
  } finally {
2573
- if (child && child.pid) {
2574
- try { child.kill('SIGKILL'); } catch { /* expected: probe child may already be gone */ }
2575
- }
2575
+ // Kill the whole tree: SIGKILL to the browser pid alone left its helpers alive,
2576
+ // re-parented to launchd, after every probe (observed: 2-4 helpers per probe).
2577
+ if (child && child.pid) terminateForegroundProcessTree(child, 'SIGKILL');
2576
2578
  try { fs.rmSync(userDataDir, { recursive: true, force: true }); } catch { /* expected: probe child may already be gone */ }
2577
2579
  }
2578
2580
  _chromeProbeCache.set(chromePath, usable);
@@ -2586,6 +2588,11 @@ async function _autoChromeUsable(chromePath, { timeoutMs = 15000, pollMs = 100 }
2586
2588
  async function inspectChromeCapability({
2587
2589
  candidates = CHROME_CANDIDATES,
2588
2590
  probe = _autoChromeUsable,
2591
+ // probeOptions (no default): the same timer seam host-capabilities.js's
2592
+ // getCapability() already exposes for pdf.poppler (WP-3). It is handed to
2593
+ // the probe unchanged; production callers omit it, so _autoChromeUsable's
2594
+ // own 15000/100 defaults stand.
2595
+ probeOptions,
2589
2596
  overridePath = process.env.WALLE_CHROME_PATH || '',
2590
2597
  } = {}) {
2591
2598
  if (overridePath && fs.existsSync(overridePath)) {
@@ -2595,7 +2602,7 @@ async function inspectChromeCapability({
2595
2602
  let executable = null;
2596
2603
  for (const candidate of detected) {
2597
2604
  // eslint-disable-next-line no-await-in-loop -- probes must run sequentially: first usable wins
2598
- if (await probe(candidate)) { executable = candidate; break; }
2605
+ if (await probe(candidate, probeOptions)) { executable = candidate; break; }
2599
2606
  }
2600
2607
  if (executable) return { executable, detected, source: 'auto' };
2601
2608
  const installedButUnavailable = detected.length > 0;
@@ -318,6 +318,15 @@ const CUSTOM_BRAIN_CALLS = { agentRunShadowOperation: (args) => require('../runt
318
318
  recordProviderHealthStatus: (args) => require('../llm/provider-health-state').recordProviderHealthStatus(args[0], { brain, ...(args[1] || {}) }),
319
319
  reserveProviderModelCircuitProbe: (args) => require('../llm/provider-health-state').reserveProviderModelCircuitProbe(args[0], args[1], { brain }),
320
320
  workflowStoreOperation: (args) => require('../routing/workflow-store-operations').runWorkflowStoreOperation(brain, args[0], args[1] || {}),
321
+ helperRulesRecordOutcome: (args) => require('../loops/brain-custom-writes').helperRulesRecordOutcome(args[0]),
322
+ helperRulesCloseOutcome: (args) => require('../loops/brain-custom-writes').helperRulesCloseOutcome(args[0], args[1]),
323
+ helperRulesSetCellState: (args) => require('../loops/brain-custom-writes').helperRulesSetCellState(args[0], args[1]),
324
+ helperRulesDailyTick: () => require('../loops/brain-custom-writes').helperRulesDailyTick(),
325
+ helperRulesSetGrade: (args) => require('../loops/brain-custom-writes').helperRulesSetGrade(args[0], args[1]), // WP-6
326
+ // Round 2 WP-2 (§6.4 S-16): D-5's close-by-worker (the hook's terminal-read path) and the
327
+ // one-time relabel/recovery pass (D-5/D-6).
328
+ helperRulesCloseOutcomeByWorker: (args) => require('../loops/brain-custom-writes').helperRulesCloseOutcomeByWorker(args[0], args[1]),
329
+ helperRulesRelabel: (args) => require('../loops/brain-custom-writes').helperRulesRelabel(args[0]),
321
330
  };
322
331
 
323
332
  async function _brainCall(payload = {}) {
@@ -54,7 +54,7 @@ async function reply(message) {
54
54
  // If the daemon dies before sending it (or mid-write), there is no other
55
55
  // exit path — install the backstop before anything else so an orphaned
56
56
  // instance can't hold the WAL open indefinitely.
57
- installParentDeathWatch({
57
+ const parentDeathWatch = installParentDeathWatch({
58
58
  label: 'coding-journal-writer-child',
59
59
  onShutdown: async () => {
60
60
  if (!openBrain) return;
@@ -102,6 +102,13 @@ process.once('message', async (message) => {
102
102
  code: error?.code ? String(error.code).slice(0, 100) : undefined,
103
103
  });
104
104
  } finally {
105
+ // The watch is a backstop for a parent that dies mid-write, so it stays
106
+ // armed for as long as this child is doing work. On our OWN completed
107
+ // request path it must be disarmed immediately BEFORE this self-initiated
108
+ // disconnect: otherwise our own disconnect looks like parent death to the
109
+ // watch, whose shutdown hook calls exit(0) and erases the exit status set
110
+ // above (a schema/owner refusal must leave the process exiting 1, not 0).
111
+ parentDeathWatch.stop();
105
112
  try { process.disconnect(); } catch { /* expected: process.disconnect() throws ERR_IPC_DISCONNECTED when the parent already closed the channel after taking the reply; this one-shot worker is finished either way and exits when the loop drains */ }
106
113
  }
107
114
  });
@@ -28,6 +28,14 @@ function runRequest(payload, maxResponseBytes) {
28
28
  req.method = payload.method || 'GET';
29
29
  req.headers = payload.headers || {};
30
30
  req.url = payload.path;
31
+ // WP-1 (blog-view-counts): the parent sends the TCP peer it observed in its own
32
+ // IPC field (never as a header, so a client cannot forge it). Re-attach it as
33
+ // the request's socket address — the blog counter's per-IP limiter reads it
34
+ // there. Routes that do not carry the field keep the request exactly as before
35
+ // (no req.socket at all).
36
+ if (typeof payload.clientAddress === 'string' && payload.clientAddress) {
37
+ req.socket = { remoteAddress: payload.clientAddress };
38
+ }
31
39
  req.destroy = () => {};
32
40
  let status = 200;
33
41
  let headers = {};
@@ -1,31 +0,0 @@
1
- 'use strict';
2
-
3
- const DEFAULT_GIANT_ROLLOUT_BYTES = 500 * 1024 * 1024;
4
- const RECLAIM_REASONS = new Set([
5
- 'cap',
6
- 'interactive-preempt',
7
- 'prewarm-cap',
8
- 'pressure',
9
- 'pressure-relief',
10
- 'rss-budget',
11
- ]);
12
-
13
- function shouldFreezeParkGiant({
14
- enabled = true,
15
- fileSizeBytes = 0,
16
- pressure = 'normal',
17
- reason = 'idle',
18
- thresholdBytes = DEFAULT_GIANT_ROLLOUT_BYTES,
19
- alreadyFrozen = false,
20
- } = {}) {
21
- if (!enabled || alreadyFrozen) return false;
22
- if (String(pressure || 'normal') !== 'normal') return false;
23
- if (RECLAIM_REASONS.has(String(reason || ''))) return false;
24
- return Math.max(0, Number(fileSizeBytes) || 0)
25
- >= Math.max(1, Number(thresholdBytes) || DEFAULT_GIANT_ROLLOUT_BYTES);
26
- }
27
-
28
- module.exports = {
29
- DEFAULT_GIANT_ROLLOUT_BYTES,
30
- shouldFreezeParkGiant,
31
- };