create-walle 0.10.1 → 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 (341) hide show
  1. package/README.md +4 -0
  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 +6 -4
  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 +10 -22
  10. package/template/coding-task-manager/bin/claude-hook.js +7 -3
  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/lead-wait-census.js +1348 -0
  18. package/template/coding-task-manager/bin/repair-foreign-clone.js +564 -0
  19. package/template/coding-task-manager/bin/repair-resume-echo-titles.js +248 -0
  20. package/template/coding-task-manager/bin/write-lock-bench.js +111 -0
  21. package/template/coding-task-manager/db.js +705 -286
  22. package/template/coding-task-manager/git-utils.js +44 -0
  23. package/template/coding-task-manager/lib/adopted-host-redial.js +4 -0
  24. package/template/coding-task-manager/lib/agent-presets.js +15 -0
  25. package/template/coding-task-manager/lib/agent-title-apply.js +88 -0
  26. package/template/coding-task-manager/lib/agent-title-backfill-read.js +92 -0
  27. package/template/coding-task-manager/lib/api/host-stats.js +98 -0
  28. package/template/coding-task-manager/lib/api/ingress.js +35 -12
  29. package/template/coding-task-manager/lib/api/machine-pairing.js +285 -0
  30. package/template/coding-task-manager/lib/api/machine-pool.js +307 -0
  31. package/template/coding-task-manager/lib/api/machines.js +461 -0
  32. package/template/coding-task-manager/lib/api/misc-ops.js +20 -5
  33. package/template/coding-task-manager/lib/api/providers.js +53 -6
  34. package/template/coding-task-manager/lib/api/resume-from-store.js +25 -0
  35. package/template/coding-task-manager/lib/api/sessions.js +160 -8
  36. package/template/coding-task-manager/lib/api/transcript-history.js +17 -4
  37. package/template/coding-task-manager/lib/api/worktrees.js +38 -37
  38. package/template/coding-task-manager/lib/approval-drift.js +16 -1
  39. package/template/coding-task-manager/lib/approval-logical-frame.js +5 -1
  40. package/template/coding-task-manager/lib/approval-scope.js +68 -4
  41. package/template/coding-task-manager/lib/auth-context.js +32 -2
  42. package/template/coding-task-manager/lib/auth-rate-limit.js +41 -1
  43. package/template/coding-task-manager/lib/auth-rules.js +186 -45
  44. package/template/coding-task-manager/lib/broadcast-serialize.js +2 -1
  45. package/template/coding-task-manager/lib/browser-session-broker.js +9 -1
  46. package/template/coding-task-manager/lib/browser-use-adapter.js +33 -2
  47. package/template/coding-task-manager/lib/claude-markdown-ansi.js +27 -85
  48. package/template/coding-task-manager/lib/claude-session-title.js +6 -30
  49. package/template/coding-task-manager/lib/claude-table-layout.js +322 -0
  50. package/template/coding-task-manager/lib/client-diag-handler.js +5 -0
  51. package/template/coding-task-manager/lib/codex-config-guard.js +33 -3
  52. package/template/coding-task-manager/lib/codex-harness-qualification.js +12 -0
  53. package/template/coding-task-manager/lib/codex-launch-health.js +29 -2
  54. package/template/coding-task-manager/lib/codex-link-preparation.js +9 -8
  55. package/template/coding-task-manager/lib/codex-paths.js +2 -1
  56. package/template/coding-task-manager/lib/coding-agent-models.js +21 -30
  57. package/template/coding-task-manager/lib/coding-session-model-adapters.js +27 -2
  58. package/template/coding-task-manager/lib/coding-session-model-projection.js +5 -0
  59. package/template/coding-task-manager/lib/coding-session-model-runtime.js +1 -2
  60. package/template/coding-task-manager/lib/coding-session-model-state.js +10 -0
  61. package/template/coding-task-manager/lib/coding-session-model-sync-state.js +0 -1
  62. package/template/coding-task-manager/lib/conversation-import/cursor-guard-owner.js +10 -0
  63. package/template/coding-task-manager/lib/create/resolve-launch-params.js +8 -1
  64. package/template/coding-task-manager/lib/ctm-boot-lifecycle.js +17 -1
  65. package/template/coding-task-manager/lib/db-domain-tables.js +7 -0
  66. package/template/coding-task-manager/lib/db-domains.js +21 -2
  67. package/template/coding-task-manager/lib/db-owner-op-registry.js +7 -0
  68. package/template/coding-task-manager/lib/db-schema-source-files.js +1 -0
  69. package/template/coding-task-manager/lib/feature-manifest.js +1 -1
  70. package/template/coding-task-manager/lib/fs-watcher.js +3 -2
  71. package/template/coding-task-manager/lib/harness-history-transition.js +3 -3
  72. package/template/coding-task-manager/lib/headless-inflight-ops.js +203 -0
  73. package/template/coding-task-manager/lib/headless-missing-reply.js +42 -0
  74. package/template/coding-task-manager/lib/headless-term-service.js +55 -17
  75. package/template/coding-task-manager/lib/host-control-dial.js +167 -0
  76. package/template/coding-task-manager/lib/host-handoff-orchestrator.js +16 -2
  77. package/template/coding-task-manager/lib/host-handoff.js +51 -13
  78. package/template/coding-task-manager/lib/host-health-ledger.js +164 -12
  79. package/template/coding-task-manager/lib/host-self-truth-watchdog.js +4 -0
  80. package/template/coding-task-manager/lib/host-stats.js +328 -0
  81. package/template/coding-task-manager/lib/host-threadpool-evacuation.js +160 -0
  82. package/template/coding-task-manager/lib/host-threadpool-monitor.js +14 -1
  83. package/template/coding-task-manager/lib/hosted-input-dispatch.js +203 -0
  84. package/template/coding-task-manager/lib/hosted-sync-worker.js +113 -5
  85. package/template/coding-task-manager/lib/instance-id-ownership-manifest.js +4 -0
  86. package/template/coding-task-manager/lib/instance-manifest-runtime.js +3 -0
  87. package/template/coding-task-manager/lib/instance-manifest.js +13 -1
  88. package/template/coding-task-manager/lib/instance-sync-status.js +15 -0
  89. package/template/coding-task-manager/lib/launch-model-override.js +160 -1
  90. package/template/coding-task-manager/lib/launch-plan-worker.js +59 -2
  91. package/template/coding-task-manager/lib/lead-model-switch-runtime.js +57 -4
  92. package/template/coding-task-manager/lib/lead-model-switch.js +3 -2
  93. package/template/coding-task-manager/lib/lead-model-transition-store.js +61 -3
  94. package/template/coding-task-manager/lib/legacy-draft-cancellation-recovery.js +111 -0
  95. package/template/coding-task-manager/lib/login-tripwire.js +1 -0
  96. package/template/coding-task-manager/lib/machine-pairing.js +238 -0
  97. package/template/coding-task-manager/lib/machine-pool.js +409 -0
  98. package/template/coding-task-manager/lib/machine-registry.js +749 -0
  99. package/template/coding-task-manager/lib/machine-self.js +66 -0
  100. package/template/coding-task-manager/lib/main-thread-lint-exemptions.json +52 -4
  101. package/template/coding-task-manager/lib/media-journal-control-reader.js +473 -0
  102. package/template/coding-task-manager/lib/media-journal.js +84 -27
  103. package/template/coding-task-manager/lib/media-store-options.js +43 -15
  104. package/template/coding-task-manager/lib/migrations/v56-host-samples-and-machine-pool.js +76 -0
  105. package/template/coding-task-manager/lib/mirror-feed-sanitize.js +12 -3
  106. package/template/coding-task-manager/lib/model-proxy/anthropic-face.js +4 -0
  107. package/template/coding-task-manager/lib/model-proxy/chat-response-translators.js +3 -0
  108. package/template/coding-task-manager/lib/model-proxy/handoff.js +494 -0
  109. package/template/coding-task-manager/lib/model-proxy/lead-worker-picks.js +25 -0
  110. package/template/coding-task-manager/lib/model-proxy/native-lead-listener.js +61 -7
  111. package/template/coding-task-manager/lib/model-proxy/proxy-cli.js +200 -0
  112. package/template/coding-task-manager/lib/model-proxy/proxy-instance-record.js +257 -0
  113. package/template/coding-task-manager/lib/model-proxy/stream-accounting.js +205 -0
  114. package/template/coding-task-manager/lib/model-proxy/tokens.js +78 -0
  115. package/template/coding-task-manager/lib/model-proxy/upstream-outcome.js +9 -0
  116. package/template/coding-task-manager/lib/native-history-control.js +2 -2
  117. package/template/coding-task-manager/lib/native-lead-settings-client.js +2 -1
  118. package/template/coding-task-manager/lib/native-lead-tls.js +18 -4
  119. package/template/coding-task-manager/lib/oauth-proxy-supervisor.js +628 -64
  120. package/template/coding-task-manager/lib/owner-action-manifest-data.json +14 -0
  121. package/template/coding-task-manager/lib/painted-row-recorder.js +9 -1
  122. package/template/coding-task-manager/lib/prompt-submission-contract.js +21 -1
  123. package/template/coding-task-manager/lib/provider-login-broker.js +192 -9
  124. package/template/coding-task-manager/lib/provider-login-capture.js +153 -0
  125. package/template/coding-task-manager/lib/queue-draft-status-overlay.js +36 -0
  126. package/template/coding-task-manager/lib/raw-codex-history-window.js +5 -3
  127. package/template/coding-task-manager/lib/read-pool-client.js +5 -2
  128. package/template/coding-task-manager/lib/read-pool-op-registry.js +10 -1
  129. package/template/coding-task-manager/lib/recent-catalog-query.js +26 -0
  130. package/template/coding-task-manager/lib/recent-session-catalog-response.js +9 -0
  131. package/template/coding-task-manager/lib/remote-command-context.js +12 -0
  132. package/template/coding-task-manager/lib/remote-command-runtime.js +13 -1
  133. package/template/coding-task-manager/lib/remote-machine-catalog.js +1062 -0
  134. package/template/coding-task-manager/lib/remote-machine-create.js +693 -0
  135. package/template/coding-task-manager/lib/remote-machine-link.js +939 -0
  136. package/template/coding-task-manager/lib/remote-machine-proxy.js +520 -0
  137. package/template/coding-task-manager/lib/remote-session-forward.js +306 -0
  138. package/template/coding-task-manager/lib/remote-submission-status.js +6 -0
  139. package/template/coding-task-manager/lib/restart-outcome-truth.js +20 -3
  140. package/template/coding-task-manager/lib/restart-preflight.js +9 -2
  141. package/template/coding-task-manager/lib/restore-backoff-gate.js +10 -2
  142. package/template/coding-task-manager/lib/restore-prepare-retry.js +12 -5
  143. package/template/coding-task-manager/lib/restore-resume-batch.js +22 -1
  144. package/template/coding-task-manager/lib/resume-blocked-wire.js +62 -1
  145. package/template/coding-task-manager/lib/resume-cwd.js +13 -0
  146. package/template/coding-task-manager/lib/resume-from-store.js +12 -1
  147. package/template/coding-task-manager/lib/resume-origin-facts.js +38 -1
  148. package/template/coding-task-manager/lib/resume-preflight.js +21 -16
  149. package/template/coding-task-manager/lib/review-repo-admission.js +39 -6
  150. package/template/coding-task-manager/lib/review-repo-registry.js +17 -0
  151. package/template/coding-task-manager/lib/root-delivery-runtime.js +72 -15
  152. package/template/coding-task-manager/lib/root-delivery-selection.js +37 -1
  153. package/template/coding-task-manager/lib/root-prompt-admission.js +33 -2
  154. package/template/coding-task-manager/lib/root-prompt-flow.js +167 -33
  155. package/template/coding-task-manager/lib/scrollback-archive-store.js +7 -4
  156. package/template/coding-task-manager/lib/session-analysis-memory.js +2 -0
  157. package/template/coding-task-manager/lib/session-create/codex-native-provider-gate.js +218 -0
  158. package/template/coding-task-manager/lib/session-create/codex-resume-exit-classify.js +52 -0
  159. package/template/coding-task-manager/lib/session-create/delegate-worker.js +95 -6
  160. package/template/coding-task-manager/lib/session-create/identity.js +20 -1
  161. package/template/coding-task-manager/lib/session-create/prepared.js +69 -1
  162. package/template/coding-task-manager/lib/session-create/provider-launch-context.js +77 -0
  163. package/template/coding-task-manager/lib/session-create/provider-process.js +34 -37
  164. package/template/coding-task-manager/lib/session-create/response.js +30 -12
  165. package/template/coding-task-manager/lib/session-create/transcript.js +13 -4
  166. package/template/coding-task-manager/lib/session-create/worker-continuation.js +43 -1
  167. package/template/coding-task-manager/lib/session-create/worker-notices.js +94 -5
  168. package/template/coding-task-manager/lib/session-create/worker-observability.js +99 -7
  169. package/template/coding-task-manager/lib/session-create/worker-stop.js +11 -3
  170. package/template/coding-task-manager/lib/session-create/worker-wait-watcher.js +315 -0
  171. package/template/coding-task-manager/lib/session-geometry-authority-handler.js +10 -1
  172. package/template/coding-task-manager/lib/session-host-manager.js +152 -206
  173. package/template/coding-task-manager/lib/session-jobs.js +17 -9
  174. package/template/coding-task-manager/lib/session-lifecycle.js +18 -0
  175. package/template/coding-task-manager/lib/session-model-action-preconditions.js +9 -0
  176. package/template/coding-task-manager/lib/session-resource-sampler.js +19 -9
  177. package/template/coding-task-manager/lib/session-standup.js +67 -4
  178. package/template/coding-task-manager/lib/session-status-ledger.js +42 -3
  179. package/template/coding-task-manager/lib/session-status-runtime.js +45 -1
  180. package/template/coding-task-manager/lib/session-title-mirror.js +25 -57
  181. package/template/coding-task-manager/lib/session-transcript-trash.js +8 -1
  182. package/template/coding-task-manager/lib/startup-pointer-write.js +57 -0
  183. package/template/coding-task-manager/lib/state-sync/painted-frame-field.js +11 -0
  184. package/template/coding-task-manager/lib/storage/coding-session-model-store.js +21 -22
  185. package/template/coding-task-manager/lib/surviving-owner-bootstrap.js +7 -2
  186. package/template/coding-task-manager/lib/surviving-owner-recovery.js +2 -1
  187. package/template/coding-task-manager/lib/terminal-draft-http-status.js +25 -0
  188. package/template/coding-task-manager/lib/transcript-archiver.js +229 -229
  189. package/template/coding-task-manager/lib/transcript-frame-cache.js +12 -2
  190. package/template/coding-task-manager/lib/transcript-guard-job.js +55 -4
  191. package/template/coding-task-manager/lib/transcript-link.js +77 -0
  192. package/template/coding-task-manager/lib/transcript-manifest-store.js +8 -4
  193. package/template/coding-task-manager/lib/transcript-source.js +8 -3
  194. package/template/coding-task-manager/lib/transcript-store.js +40 -0
  195. package/template/coding-task-manager/lib/tunnel-lane-governor.js +6 -3
  196. package/template/coding-task-manager/lib/typing-interaction-trace.js +92 -0
  197. package/template/coding-task-manager/lib/typing-worker-stages.js +60 -0
  198. package/template/coding-task-manager/lib/visible-revision-watchdog.js +8 -12
  199. package/template/coding-task-manager/lib/wake-skip-reasons.js +46 -0
  200. package/template/coding-task-manager/lib/walle-supervisor.js +98 -14
  201. package/template/coding-task-manager/lib/worker-failure-classify.js +13 -1
  202. package/template/coding-task-manager/lib/ws/state-sync.js +19 -2
  203. package/template/coding-task-manager/lib/ws/terminal-attach.js +32 -1
  204. package/template/coding-task-manager/lib/ws-router.js +68 -1
  205. package/template/coding-task-manager/lib/ws-send-admission.js +22 -4
  206. package/template/coding-task-manager/oauth-proxy.js +99 -55
  207. package/template/coding-task-manager/package-lock.json +24 -0
  208. package/template/coding-task-manager/package.json +3 -0
  209. package/template/coding-task-manager/providers/codex-mcp-extract.js +121 -19
  210. package/template/coding-task-manager/providers/codex-mcp.js +14 -5
  211. package/template/coding-task-manager/public/css/app.css +279 -1
  212. package/template/coding-task-manager/public/css/reviews.css +4 -0
  213. package/template/coding-task-manager/public/index.html +294 -223
  214. package/template/coding-task-manager/public/js/app/machines-page.js +1252 -0
  215. package/template/coding-task-manager/public/js/app/models-tab.js +546 -36
  216. package/template/coding-task-manager/public/js/app/worktrees-panel.js +7 -5
  217. package/template/coding-task-manager/public/js/background-work.js +13 -7
  218. package/template/coding-task-manager/public/js/coding-session-model-presentation.js +44 -4
  219. package/template/coding-task-manager/public/js/core/session-commands.js +676 -0
  220. package/template/coding-task-manager/public/js/core/session-selectors.js +5 -1
  221. package/template/coding-task-manager/public/js/history-app-seam.js +26 -2
  222. package/template/coding-task-manager/public/js/history-painted-rows.js +17 -2
  223. package/template/coding-task-manager/public/js/history-reader-park.js +13 -1
  224. package/template/coding-task-manager/public/js/history-scroller.js +187 -9
  225. package/template/coding-task-manager/public/js/history-transcript-pages.js +5 -5
  226. package/template/coding-task-manager/public/js/machine-pool-shared.js +436 -0
  227. package/template/coding-task-manager/public/js/private-state-scope.js +31 -3
  228. package/template/coding-task-manager/public/js/prompt-submission-client.js +173 -8
  229. package/template/coding-task-manager/public/js/prompt-submission-tray.js +281 -0
  230. package/template/coding-task-manager/public/js/queue-panel-submission-reconcile.js +174 -1
  231. package/template/coding-task-manager/public/js/reviews.js +7 -3
  232. package/template/coding-task-manager/public/js/root-draft-lifetime.js +139 -2
  233. package/template/coding-task-manager/public/js/root-queue-builder-lifetime.js +16 -0
  234. package/template/coding-task-manager/public/js/row-join.js +4 -2
  235. package/template/coding-task-manager/public/js/session-model-picker.js +1 -1
  236. package/template/coding-task-manager/public/js/session-search-utils.js +46 -19
  237. package/template/coding-task-manager/public/js/state-sync-client.js +4 -0
  238. package/template/coding-task-manager/public/js/terminal/runtime-02.js +16 -7
  239. package/template/coding-task-manager/public/js/terminal/runtime-03.js +41 -0
  240. package/template/coding-task-manager/public/js/terminal/runtime-04.js +41 -4
  241. package/template/coding-task-manager/public/js/terminal/runtime-12.js +52 -2
  242. package/template/coding-task-manager/public/js/terminal/runtime-16.js +12 -12
  243. package/template/coding-task-manager/public/js/terminal/runtime-18.js +14 -0
  244. package/template/coding-task-manager/public/js/terminal/runtime-19.js +8 -4
  245. package/template/coding-task-manager/public/js/terminal/runtime-20.js +210 -73
  246. package/template/coding-task-manager/public/js/terminal/runtime-21.js +19 -6
  247. package/template/coding-task-manager/public/js/terminal/runtime-22.js +86 -0
  248. package/template/coding-task-manager/public/js/terminal-history-viewport.js +1 -1
  249. package/template/coding-task-manager/public/js/terminal-wheel.js +39 -2
  250. package/template/coding-task-manager/public/js/walle/chat-conversation.js +11 -3
  251. package/template/coding-task-manager/public/js/walle-session.js +30 -7
  252. package/template/coding-task-manager/public/m/app.css +226 -8
  253. package/template/coding-task-manager/public/m/app.js +502 -9
  254. package/template/coding-task-manager/public/m/index.html +38 -1
  255. package/template/coding-task-manager/public/m/machines.js +1313 -0
  256. package/template/coding-task-manager/public/m/pool-failover.js +391 -0
  257. package/template/coding-task-manager/public/m/private-queue-actions.js +26 -7
  258. package/template/coding-task-manager/public/m/sw.js +5 -0
  259. package/template/coding-task-manager/queue-engine.js +13 -0
  260. package/template/coding-task-manager/server/approvals.js +5 -6
  261. package/template/coding-task-manager/server/boot.js +136 -17
  262. package/template/coding-task-manager/server.js +902 -239
  263. package/template/coding-task-manager/session-integrity.js +7 -9
  264. package/template/coding-task-manager/workers/db-owner-worker.js +53 -7
  265. package/template/coding-task-manager/workers/read-pool-worker.js +17 -6
  266. package/template/coding-task-manager/workers/session-host-pool-process.js +18 -4
  267. package/template/coding-task-manager/workers/session-host-process.js +14 -3
  268. package/template/coding-task-manager/workers/transcript-archive-worker.js +1 -1
  269. package/template/coding-task-manager/workers/worktree-worker.js +34 -0
  270. package/template/package-lock.json +2 -2
  271. package/template/package.json +1 -1
  272. package/template/scripts/conversation-storage-v2-migration.js +78 -11
  273. package/template/shared/conversation-storage-v2-contract.js +42 -6
  274. package/template/shared/fixtures/worker-status-payloads.json +392 -0
  275. package/template/shared/git-remote-key.js +83 -0
  276. package/template/shared/host-identity.js +98 -2
  277. package/template/shared/owner-write-safety.js +135 -0
  278. package/template/shared/public-runtime.js +13 -5
  279. package/template/shared/release-schema.json +3 -2
  280. package/template/shared/report-citations.js +14 -0
  281. package/template/shared/sqlite-write-lock.js +361 -223
  282. package/template/shared/storage/contract.js +35 -3
  283. package/template/wall-e/agent.js +21 -0
  284. package/template/wall-e/api-walle.js +5 -0
  285. package/template/wall-e/bin/brain-purge-legacy-ctm.js +3 -2
  286. package/template/wall-e/bin/walle-mcp-stdio.js +12 -6
  287. package/template/wall-e/brain/helper-rules-schema.js +129 -0
  288. package/template/wall-e/brain/migrations.js +51 -22
  289. package/template/wall-e/brain/model-deployment-facts.js +31 -1
  290. package/template/wall-e/brain/owner-call-whitelist.js +16 -0
  291. package/template/wall-e/brain/schema-ensures.js +22 -0
  292. package/template/wall-e/brain.js +1 -1
  293. package/template/wall-e/coding/journal-dispatcher.js +51 -0
  294. package/template/wall-e/coding/session-journal.js +28 -40
  295. package/template/wall-e/coding-orchestrator.js +23 -26
  296. package/template/wall-e/http/auth.js +18 -1
  297. package/template/wall-e/http/blog-views-api.js +318 -0
  298. package/template/wall-e/http/helper-rules-api.js +321 -0
  299. package/template/wall-e/http/model-proxy-providers.js +3 -1
  300. package/template/wall-e/http/telemetry-api.js +12 -0
  301. package/template/wall-e/lib/blog-view-policy.js +88 -0
  302. package/template/wall-e/lib/blog-view-store.js +169 -0
  303. package/template/wall-e/lib/client-config-lock.js +2 -1
  304. package/template/wall-e/lib/coding-journal-writer-child-client.js +67 -18
  305. package/template/wall-e/lib/error-kinds.js +10 -1
  306. package/template/wall-e/lib/feature-manifest.js +1 -1
  307. package/template/wall-e/lib/helper-rules/cell-state.js +123 -0
  308. package/template/wall-e/lib/helper-rules/evaluate.js +357 -0
  309. package/template/wall-e/lib/helper-rules/explore-rubric.md +12 -0
  310. package/template/wall-e/lib/helper-rules/grade.js +277 -0
  311. package/template/wall-e/lib/helper-rules/label.js +247 -0
  312. package/template/wall-e/lib/helper-rules/lead-call-hook.js +522 -0
  313. package/template/wall-e/lib/helper-rules/store.js +667 -0
  314. package/template/wall-e/lib/mcp-integration.js +5 -6
  315. package/template/wall-e/lib/runtime-worker-pool.js +1 -0
  316. package/template/wall-e/lib/scheduler-worker-jobs.js +6 -0
  317. package/template/wall-e/lib/telemetry-db-schema.js +37 -0
  318. package/template/wall-e/lib/telemetry-process-client.js +76 -1
  319. package/template/wall-e/llm/default-fallback.js +4 -0
  320. package/template/wall-e/llm/model-catalog.js +13 -4
  321. package/template/wall-e/llm/model-roles.js +6 -0
  322. package/template/wall-e/llm/portkey-http.js +150 -0
  323. package/template/wall-e/llm/portkey-sync.js +15 -145
  324. package/template/wall-e/llm/worker-mcp-routing.js +61 -0
  325. package/template/wall-e/llm/worker-route.js +43 -1
  326. package/template/wall-e/loops/brain-custom-writes.js +45 -0
  327. package/template/wall-e/mcp-protocol-contract.js +41 -1
  328. package/template/wall-e/mcp-server.js +13 -2
  329. package/template/wall-e/mcp-worker-schemas.js +20 -2
  330. package/template/wall-e/memory/ctm-context-client.js +25 -5
  331. package/template/wall-e/shared/release-schema.json +3 -2
  332. package/template/wall-e/shared/sqlite-write-lock.js +361 -223
  333. package/template/wall-e/shared/storage/contract.js +35 -3
  334. package/template/wall-e/skills/_templates/delegate-worker/VERSION +1 -1
  335. package/template/wall-e/skills/_templates/delegate-worker/released-sha256.json +6 -0
  336. package/template/wall-e/skills/_templates/delegate-worker/templates/claude/SKILL.md +7 -2
  337. package/template/wall-e/skills/_templates/delegate-worker/templates/codex/SKILL.md +7 -2
  338. package/template/wall-e/tools/local-tools.js +6 -4
  339. package/template/wall-e/workers/brain-owner-worker.js +9 -0
  340. package/template/wall-e/workers/coding-journal-writer-child.js +8 -1
  341. package/template/wall-e/workers/telemetry-worker.js +8 -0
@@ -39,35 +39,83 @@ async function readCursor(journalPath) {
39
39
  }
40
40
  }
41
41
 
42
- async function readRecords(journalPath, startOffset = 0) {
43
- const handle = await fs.promises.open(journalPath, 'r');
44
- let size;
45
- let absoluteStart;
46
- let buffer;
47
- try {
48
- size = (await handle.stat()).size;
49
- absoluteStart = Math.min(size, Math.max(0, Number(startOffset) || 0));
50
- buffer = Buffer.allocUnsafe(size - absoluteStart);
51
- let bytesRead = 0;
52
- while (bytesRead < buffer.length) {
53
- const read = await handle.read(buffer, bytesRead, buffer.length - bytesRead, absoluteStart + bytesRead);
54
- if (read.bytesRead === 0) break;
55
- bytesRead += read.bytesRead;
42
+ // I/O working set only: neither the record size nor the recovered records array is capped.
43
+ const JOURNAL_READ_WINDOW_BYTES = 64 * 1024;
44
+
45
+ async function closeAfterJournalFailure(handle, error) {
46
+ try { await handle.close(); }
47
+ catch (closeError) {
48
+ throw new AggregateError([error, closeError], 'Media journal operation and owned handle cleanup failed', { cause: error });
49
+ }
50
+ }
51
+
52
+ async function readJournalWindow(handle, journalPath, position, length) {
53
+ const buffer = Buffer.allocUnsafe(length);
54
+ let filled = 0;
55
+ // Fill one window even when the filesystem returns tiny short reads. Retaining a new 64KiB
56
+ // buffer for each few bytes of progress would amplify a long line's working set needlessly.
57
+ while (filled < length) {
58
+ const remaining = length - filled;
59
+ const { bytesRead } = await handle.read(buffer, filled, remaining, position + filled);
60
+ if (bytesRead === 0) {
61
+ throw Object.assign(new Error(`Media journal ${path.basename(journalPath)} ended before its captured length; recovery is required`),
62
+ { code: 'CTM_MEDIA_JOURNAL_TRUNCATED' });
56
63
  }
57
- if (bytesRead !== buffer.length) buffer = buffer.subarray(0, bytesRead);
58
- } finally {
59
- await handle.close();
64
+ if (!Number.isSafeInteger(bytesRead) || bytesRead < 0 || bytesRead > remaining) {
65
+ throw Object.assign(new Error('Media journal read returned invalid byte progress'),
66
+ { code: 'CTM_MEDIA_JOURNAL_READ_INVALID' });
67
+ }
68
+ filled += bytesRead;
60
69
  }
70
+ return buffer;
71
+ }
72
+
73
+ async function frameJournalRecords(handle, journalPath, absoluteStart, size) {
61
74
  const records = [];
62
- let lineStart = 0;
63
- for (let index = 0; index < buffer.length; index += 1) {
64
- if (buffer[index] !== 0x0a) continue;
65
- const endOffset = absoluteStart + index + 1;
66
- const raw = buffer.subarray(lineStart, index).toString('utf8').trim();
67
- if (raw) records.push({ entry: JSON.parse(raw), startOffset: absoluteStart + lineStart, endOffset });
68
- lineStart = index + 1;
75
+ let pieces = [];
76
+ let lineBytes = 0;
77
+ let lineStart = absoluteStart;
78
+ let position = absoluteStart;
79
+ while (position < size) {
80
+ const buffer = await readJournalWindow(handle, journalPath, position,
81
+ Math.min(JOURNAL_READ_WINDOW_BYTES, size - position));
82
+ let pieceStart = 0;
83
+ for (let index = 0; index < buffer.length; index += 1) {
84
+ if (buffer[index] !== 0x0a) continue;
85
+ pieces.push(buffer.subarray(pieceStart, index));
86
+ lineBytes += index - pieceStart;
87
+ const endOffset = position + index + 1;
88
+ const line = pieces.length === 1 ? pieces[0] : Buffer.concat(pieces, lineBytes);
89
+ // Decode only after newline framing: split UTF-8 sequences survive read/window boundaries.
90
+ const raw = line.toString('utf8').trim();
91
+ if (raw) records.push({ entry: JSON.parse(raw), startOffset: lineStart, endOffset });
92
+ pieces = [];
93
+ lineBytes = 0;
94
+ lineStart = endOffset;
95
+ pieceStart = index + 1;
96
+ }
97
+ if (pieceStart < buffer.length) {
98
+ pieces.push(buffer.subarray(pieceStart));
99
+ lineBytes += buffer.length - pieceStart;
100
+ }
101
+ position += buffer.length;
69
102
  }
70
- return { records, size, partialOffset: absoluteStart + lineStart };
103
+ return { records, size, partialOffset: lineStart };
104
+ }
105
+
106
+ async function readRecords(journalPath, startOffset = 0) {
107
+ const handle = await fs.promises.open(journalPath, 'r');
108
+ let parsed;
109
+ try {
110
+ const size = (await handle.stat()).size;
111
+ const absoluteStart = Math.min(size, Math.max(0, Number(startOffset) || 0));
112
+ parsed = await frameJournalRecords(handle, journalPath, absoluteStart, size);
113
+ } catch (error) {
114
+ await closeAfterJournalFailure(handle, error);
115
+ throw error;
116
+ }
117
+ await handle.close();
118
+ return parsed;
71
119
  }
72
120
 
73
121
  async function createMediaJournal(options = {}) {
@@ -80,7 +128,6 @@ async function createMediaJournal(options = {}) {
80
128
  const journalPath = path.join(root, `journal-${bootId}.jsonl`);
81
129
  const handle = await fs.promises.open(journalPath, 'a', 0o600);
82
130
  await fs.promises.chmod(journalPath, 0o600).catch(() => {});
83
- await syncDirectory(root);
84
131
 
85
132
  const files = new Map();
86
133
  let op = Promise.resolve();
@@ -124,7 +171,14 @@ async function createMediaJournal(options = {}) {
124
171
  files.set(filePath, { cursor: offset, records: parsed.records, size: parsed.size });
125
172
  }
126
173
  }
127
- await refresh();
174
+ try {
175
+ await syncDirectory(root);
176
+ await refresh();
177
+ } catch (error) {
178
+ // A failed constructor returns no journal whose close() the caller could invoke.
179
+ await closeAfterJournalFailure(handle, error);
180
+ throw error;
181
+ }
128
182
 
129
183
  function serialize(fn) {
130
184
  const next = op.then(fn, fn);
@@ -335,6 +389,9 @@ const { DRAFT_CANONICAL_FIELDS, DRAFT_STATE_VERSION_MAX, canonicalDraftProjectio
335
389
 
336
390
  module.exports = {
337
391
  createMediaJournal,
392
+ JOURNAL_READ_WINDOW_BYTES,
393
+ readCursor,
394
+ readJournalWindow,
338
395
  DRAFT_CANONICAL_FIELDS,
339
396
  DRAFT_STATE_VERSION_MAX,
340
397
  canonicalDraftProjection,
@@ -1,5 +1,22 @@
1
1
  'use strict';
2
2
 
3
+ function createMediaJournalProjector(runDbWorkerOp) {
4
+ return (entry, projection = {}) => {
5
+ const urgent = entry.projectionPriority === 'urgent' || projection.urgent;
6
+ const effectiveEntry = urgent && entry.projectionPriority !== 'urgent'
7
+ ? { ...entry, projectionPriority: 'urgent' }
8
+ : entry;
9
+ return runDbWorkerOp('runDbMutation', {
10
+ action: 'applyMediaJournalEntry',
11
+ args: [effectiveEntry],
12
+ }, {
13
+ priority: urgent ? 'urgent' : 'low',
14
+ requestClass: urgent ? 'user-blocking' : 'background',
15
+ timeoutMs: urgent ? 10_000 : 30_000,
16
+ });
17
+ };
18
+ }
19
+
3
20
  function buildMediaStoreOptions({
4
21
  dataDir, bootId, registry, assertDraftOwner, runDbWorkerOp, onDrainProgress,
5
22
  currentOwnerId, isSameOwnerLineage,
@@ -25,21 +42,32 @@ function buildMediaStoreOptions({
25
42
  // drain progress with the load-pressure controller so the media journal participates
26
43
  // in the same producer-debt/freshness framework as read-pool-batch/provider-index above.
27
44
  onDrainProgress,
28
- projectEntry: (entry, projection = {}) => {
29
- const urgent = entry.projectionPriority === 'urgent' || projection.urgent;
30
- const effectiveEntry = urgent && entry.projectionPriority !== 'urgent'
31
- ? { ...entry, projectionPriority: 'urgent' }
32
- : entry;
33
- return runDbWorkerOp('runDbMutation', {
34
- action: 'applyMediaJournalEntry',
35
- args: [effectiveEntry],
36
- }, {
37
- priority: urgent ? 'urgent' : 'low',
38
- requestClass: urgent ? 'user-blocking' : 'background',
39
- timeoutMs: urgent ? 10_000 : 30_000,
40
- });
41
- },
45
+ projectEntry: createMediaJournalProjector(runDbWorkerOp),
42
46
  };
43
47
  }
44
48
 
45
- module.exports = { buildMediaStoreOptions };
49
+ async function prepareMainMediaStore({
50
+ createStore, getDataDir, bootId, runDbWorkerOp, assertDraftOwner,
51
+ onDrainProgress, getCurrentOwnerId, isSameOwnerLineage,
52
+ }) {
53
+ const registry = await runDbWorkerOp('loadMediaStoreRegistry', {}, {
54
+ // Listener activation depends on this registry. It is boot-critical
55
+ // maintenance, while the journal projections below remain background work.
56
+ priority: 'high',
57
+ requestClass: 'maintenance',
58
+ timeoutMs: 30_000,
59
+ });
60
+ return createStore(buildMediaStoreOptions({
61
+ dataDir: getDataDir(), bootId, registry, assertDraftOwner, runDbWorkerOp, onDrainProgress,
62
+ // WP-1 (docs/image-draft-event-ordering-and-verified-adoption-2026-10-14.html §6.4): the store
63
+ // is the single draft version allocator. It recovers the highest pending journal version and
64
+ // then applies verified owner-lineage normalization as one journaled mutation — the draft
65
+ // restamp was removed from db.js restampOwnerLineage so the two can never allocate concurrently.
66
+ // Review finding 9: getCurrentOwnerId delegates to the existing LAZY, MEMOIZED identity
67
+ // accessor only after the DB is open. It returns no invented hostname/port-derived identity.
68
+ // isSameOwnerLineage is the existing dbModule-free lineage snapshot, not a new DB boundary.
69
+ currentOwnerId: getCurrentOwnerId(), isSameOwnerLineage,
70
+ }));
71
+ }
72
+
73
+ module.exports = { buildMediaStoreOptions, createMediaJournalProjector, prepareMainMediaStore };
@@ -0,0 +1,76 @@
1
+ 'use strict';
2
+
3
+ // WP-1 (docs/machine-pool-picker-pairing-dashboard-2026-10-24.html §5 D-4/D-7/D-11, §6.1, §8 WP-1,
4
+ // §9 S-3): the machine-pool schema, in one migration because every piece of it lands with the same
5
+ // reader (lib/host-stats.js today; WP-2/WP-3 for the pairing/self tables).
6
+ //
7
+ // host_samples D-11 — the box owns its own 24 h time series (one row per 60 s tick;
8
+ // ≤1440 rows/machine). No hub-side samples table exists.
9
+ // machine_self D-4 rev 2 — this machine's OWN user settings (display name, favorite,
10
+ // hidden). Exactly one row, id = 1.
11
+ // machine_pairing_offers D-6 — the RFC 8628-shaped code a joining member redeems. The plaintext
12
+ // code is never stored, only its hash.
13
+ // machines.urls_json P-1/P-4 rev 2 — the member's dialable URLs in dial order.
14
+ //
15
+ // Rev 2 deliberately has NO peer_credentials table: D-7 is one shared pool secret in
16
+ // machine-pool.json, never in the DB.
17
+ //
18
+ // The shape follows v55-agent-origin-backfill.js: a narrow dependency object, idempotent SQL, and
19
+ // the version stamp LAST so a failure leaves the ladder where it was. ALTER TABLE has no
20
+ // `IF NOT EXISTS` in SQLite, so the column add is guarded by its own PRAGMA read — which also
21
+ // makes a re-run (a restored snapshot, a partially upgraded file) a no-op rather than an error.
22
+
23
+ const TABLES_DDL = `
24
+ CREATE TABLE IF NOT EXISTS host_samples (
25
+ at INTEGER PRIMARY KEY,
26
+ sample_json TEXT NOT NULL
27
+ );
28
+ CREATE TABLE IF NOT EXISTS machine_self (
29
+ id INTEGER PRIMARY KEY CHECK (id = 1),
30
+ display_name TEXT NOT NULL DEFAULT '',
31
+ favorite INTEGER NOT NULL DEFAULT 0,
32
+ hidden INTEGER NOT NULL DEFAULT 0,
33
+ updated_at INTEGER NOT NULL DEFAULT 0
34
+ );
35
+ CREATE TABLE IF NOT EXISTS machine_pairing_offers (
36
+ id TEXT PRIMARY KEY,
37
+ code_hash TEXT NOT NULL UNIQUE,
38
+ created_at INTEGER NOT NULL,
39
+ expires_at INTEGER NOT NULL,
40
+ redeemed_at INTEGER,
41
+ redeemed_by TEXT
42
+ );
43
+ `;
44
+
45
+ function _tableExists(db, table) {
46
+ try {
47
+ return !!db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name = ?").get(table);
48
+ } catch {
49
+ return false; // expected: a handle that cannot read sqlite_master (pre-boot) has nothing to alter
50
+ }
51
+ }
52
+
53
+ function _tableHasColumn(db, table, column) {
54
+ try {
55
+ return db.prepare(`PRAGMA table_info(${table})`).all().some((c) => c.name === column);
56
+ } catch {
57
+ return false; // expected: no such table on an old/partial database -> nothing to alter
58
+ }
59
+ }
60
+
61
+ function migrateToV56({ getDb, setSchemaVersion, log = console } = {}) {
62
+ if (typeof getDb !== 'function' || typeof setSchemaVersion !== 'function') throw new TypeError('migration dependencies are required');
63
+ const db = getDb();
64
+ db.exec(TABLES_DDL);
65
+ // S-3: existing databases get the column by ALTER; db.js's machines CREATE literal carries the
66
+ // same column for a fresh file, and the two must stay in the same ordinal position.
67
+ let altered = 0;
68
+ if (_tableExists(db, 'machines') && !_tableHasColumn(db, 'machines', 'urls_json')) {
69
+ db.exec("ALTER TABLE machines ADD COLUMN urls_json TEXT NOT NULL DEFAULT '[]'");
70
+ altered = 1;
71
+ }
72
+ setSchemaVersion(56);
73
+ log.log(`[db] Schema migrated to v56 (host samples + machine pool): ${altered} column(s) added`);
74
+ }
75
+
76
+ module.exports = { migrateToV56 };
@@ -151,9 +151,14 @@ function createHostedMirrorFeedCoalescer(options = {}) {
151
151
  clear();
152
152
  if (!buffer) return false;
153
153
  const batch = buffer;
154
+ // WP-4 (clock-free-tests-followups-r4-2026-10-24.html §5 R-9, §6.5): the batch's FIRST-byte
155
+ // time, not the drain time -- a held/buffered batch was received when its first byte arrived,
156
+ // and the hold is exactly the delay this stamp exists to expose. Captured before `startedAt`
157
+ // is cleared below.
158
+ const receivedAt = startedAt || now();
154
159
  buffer = '';
155
160
  startedAt = 0;
156
- deliver(sanitizeAndCoalesceHostedMirrorFeed(batch, command()));
161
+ deliver(sanitizeAndCoalesceHostedMirrorFeed(batch, command()), { receivedAt });
157
162
  return true;
158
163
  };
159
164
  const arm = (ms, opts = {}) => {
@@ -174,7 +179,8 @@ function createHostedMirrorFeedCoalescer(options = {}) {
174
179
  const hasSyncControl = _hasSyncFrameControl(text);
175
180
  const hasRedrawControl = _hasCursorRedrawControl(text);
176
181
  if (!buffer && !hasSyncControl && !hasRedrawControl) {
177
- deliver(sanitizeHostedMirrorFeed(text, command()));
182
+ // WP-4 (R-9, §6.5): the immediate path was never held, so its receipt time IS now.
183
+ deliver(sanitizeHostedMirrorFeed(text, command()), { receivedAt: now() });
178
184
  return true;
179
185
  }
180
186
  if (!startedAt) startedAt = now();
@@ -204,7 +210,10 @@ function createHostedMirrorFeedCoalescer(options = {}) {
204
210
  const prefix = buffer.slice(0, lastOff + SYNC_OFF.length);
205
211
  const trailing = buffer.slice(lastOff + SYNC_OFF.length);
206
212
  buffer = trailing;
207
- deliver(sanitizeAndCoalesceHostedMirrorFeed(prefix, command()));
213
+ // WP-4 (R-9, §6.5): this prefix came out of the same buffer as flush()'s batch, so it carries
214
+ // the same first-byte time. `startedAt` is still live here when `trailing` is non-empty; the
215
+ // `|| now()` fallback only covers a zeroed clock.
216
+ deliver(sanitizeAndCoalesceHostedMirrorFeed(prefix, command()), { receivedAt: startedAt || now() });
208
217
  if (trailing) {
209
218
  // Keep startedAt running for the trailing incomplete fragment and re-arm the safety timer.
210
219
  arm(2000, { reset: true });
@@ -92,6 +92,10 @@ function anthropicErrorType(kind) {
92
92
  if (kind === 'rate_limit_exceeded') return 'rate_limit_error';
93
93
  if (kind === 'insufficient_quota') return 'billing_error';
94
94
  if (kind === 'server_is_overloaded') return 'overloaded_error';
95
+ // WP-2 D-5: the two truthful refusal classes carry their own HTTP status (400 / 403), so the type
96
+ // must not collapse into api_error -- a permission denial is not an upstream fault.
97
+ if (kind === 'model_not_invocable') return 'invalid_request_error';
98
+ if (kind === 'model_access_denied') return 'permission_error';
95
99
  return 'api_error';
96
100
  }
97
101
 
@@ -20,6 +20,9 @@ function createChatResponseTranslators({ normalizeUpstreamOutcome, firstString,
20
20
  if (kind === 'rate_limit_exceeded') return 'rate_limit_error';
21
21
  if (kind === 'insufficient_quota') return 'billing_error';
22
22
  if (kind === 'server_is_overloaded') return 'overloaded_error';
23
+ // WP-2 D-5: same two mappings as anthropic-face.js (HTTP 400 / 403 respectively).
24
+ if (kind === 'model_not_invocable') return 'invalid_request_error';
25
+ if (kind === 'model_access_denied') return 'permission_error';
23
26
  return 'api_error';
24
27
  }
25
28