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
@@ -0,0 +1,248 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ // Repair "resume echo" titles (design doc session-name-agent-title-precedence §1e/§8 WP-6).
5
+ //
6
+ // A CTM session named after the harness's own resume boilerplate ("Resume: …", "Continue the
7
+ // conversation…") instead of the name the agent wrote into its own transcript is the bug WP-0..5
8
+ // fixes for NEW ingests. For rows that were already mis-titled, this script, per id:
9
+ //
10
+ // 1. demotes the row back to a CTM-generated name — user_renamed=0, title_source='ai_title',
11
+ // title_status='generated', title_status_reason='demoted_resume_echo' — so tier 2 may write
12
+ // again, then
13
+ // 2. re-runs WP-6's per-row backfill for that id: the SAME read-pool op the boot job uses
14
+ // ('backfillAgentTitles', one ≤64 KiB transcript tail read) and the SAME applier
15
+ // (lib/agent-title-apply.js applyAgentTitleSignals — the ONLY tier-2 apply).
16
+ //
17
+ // The initial id list this was written for (2026-10-23; NOT applied automatically — pass the ids
18
+ // explicitly). Kept here as documentation, never as code:
19
+ //
20
+ // 21b4bb0b-b889-4c7f-b8b8-fa333291fdd4
21
+ //
22
+ // Usage:
23
+ // node bin/repair-resume-echo-titles.js <id> [<id> …] [--db <path>] [--apply] [--force]
24
+ // node bin/repair-resume-echo-titles.js --ids <id,id,…> [--db <path>] [--apply]
25
+ //
26
+ // Dry run by default: each id's demote + apply runs in one IMMEDIATE transaction that is ROLLED
27
+ // BACK, so the printed before → after is exactly what --apply would write and nothing persists.
28
+ // --apply commits. --db picks the database file; with no --db the script uses CTM's own resolver
29
+ // (lib/data-dir.js + lib/domain-db-paths.js), i.e. <data dir>/task-manager.db and its core
30
+ // sibling if this install is flipped.
31
+ //
32
+ // ABSOLUTE RULE (same as bin/conversation-adopt-self-links.js): run this against a STOPPED CTM or
33
+ // a copy — NEVER against ports 3456/3457's live database, whose owning CTM keeps its own copy of
34
+ // these rows in memory and would overwrite the repair on its next write. --apply refuses a
35
+ // database whose -wal was written in the last 60 s unless --force is passed. The documented path
36
+ // is: stop CTM first, or work on a copy.
37
+ //
38
+ // Exit codes: 0 success, 2 refusal (bad args, missing file, looks live), 1 error.
39
+
40
+ // No CTM_PROCESS_ROLE here on purpose: this script never calls db.js initDb() — it opens the
41
+ // sqlite files itself — so the process identity CTM_PROCESS_ROLE exists for has no reader here,
42
+ // and setting it would mean a new raw flag read for nothing (bin/flag-lint.js).
43
+
44
+ const fs = require('node:fs');
45
+ const path = require('node:path');
46
+
47
+ const { loadSqliteDriver } = require('../lib/sqlite-driver');
48
+ const { getDataDir } = require('../lib/data-dir');
49
+ const { resolveDomainDbPath } = require('../lib/domain-db-paths');
50
+ const { applyAgentTitleSignals } = require('../lib/agent-title-apply');
51
+ const { createReadPoolClient } = require('../lib/read-pool-client');
52
+
53
+ const DEMOTE_REASON = 'demoted_resume_echo';
54
+ const REQUEST_TIMEOUT_MS = 30000;
55
+ const ROW_COLUMNS = 'title, title_source, title_status, title_status_reason, user_renamed, '
56
+ + 'title_mirror_state, title_mirror_value';
57
+
58
+ function arg(name, fallback = '') {
59
+ const index = process.argv.indexOf(name);
60
+ if (index < 0) return fallback;
61
+ const value = process.argv[index + 1];
62
+ return value != null && !value.startsWith('--') ? value : fallback;
63
+ }
64
+ const has = (name) => process.argv.includes(name);
65
+
66
+ // A WAL sidecar that is being actively written is the cheap, honest signal that another
67
+ // process (the primary) owns this database. Copied from bin/conversation-adopt-self-links.js.
68
+ function looksLive(dbPath) {
69
+ try {
70
+ const wal = fs.statSync(`${dbPath}-wal`);
71
+ return wal.size > 0 && (Date.now() - wal.mtimeMs) < 60_000;
72
+ } catch {
73
+ /* expected: no -wal sidecar (or an unstattable one) means nobody is writing this
74
+ database right now, which is exactly the "not live" answer. */
75
+ return false;
76
+ }
77
+ }
78
+
79
+ function refuse(message) {
80
+ console.error(`ERROR: ${message}`);
81
+ process.exit(2);
82
+ }
83
+
84
+ // Positional ids, plus `--ids a,b,c`. Every other flag (and its value) is skipped, so
85
+ // `--db <path>` can never be mistaken for a session id.
86
+ function parseIds() {
87
+ const argv = process.argv.slice(2);
88
+ const out = [];
89
+ for (let i = 0; i < argv.length; i += 1) {
90
+ const item = String(argv[i]);
91
+ if (item === '--ids') { out.push(...String(argv[i + 1] || '').split(',')); i += 1; continue; }
92
+ if (item === '--db') { i += 1; continue; }
93
+ if (item.startsWith('--')) continue;
94
+ out.push(item);
95
+ }
96
+ return [...new Set(out.map((id) => id.trim()).filter(Boolean))];
97
+ }
98
+
99
+ function tableExists(handle, table) {
100
+ try {
101
+ return !!handle.prepare('SELECT 1 FROM sqlite_master WHERE type = ? AND name = ?').get('table', table);
102
+ } catch {
103
+ return false; // expected: an unreadable/foreign sqlite file is "no such table" here, never a crash
104
+ }
105
+ }
106
+
107
+ // The file that actually holds ctm_sessions + agent_sessions: the given file when it already does
108
+ // (an explicit core.db, or a pre-split task-manager.db), otherwise its flipped core sibling.
109
+ function resolveCorePath(basePath) {
110
+ const Database = loadSqliteDriver({ source: 'repair-resume-echo-titles' });
111
+ const probe = new Database(basePath, { readonly: true, fileMustExist: true });
112
+ try {
113
+ if (tableExists(probe, 'ctm_sessions')) return basePath;
114
+ } finally {
115
+ probe.close();
116
+ }
117
+ return resolveDomainDbPath('core', basePath, { flipped: true });
118
+ }
119
+
120
+ /**
121
+ * Demote + re-title ONE id. The write half runs in its own IMMEDIATE transaction, committed by
122
+ * --apply and rolled back otherwise — that is what makes a dry run print the real after-state
123
+ * while writing nothing. The transaction is opened AFTER the await, never across it: the tail read
124
+ * belongs to the read pool, and a write lock must not be held while waiting on another process.
125
+ */
126
+ async function repairOne({ core, pool, basePath, id, apply }) {
127
+ const readRow = () => core.prepare(`SELECT ${ROW_COLUMNS} FROM ctm_sessions WHERE id = ?`).get(id);
128
+ const before = readRow();
129
+ if (!before) return { id, action: 'skip', reason: 'no_row' };
130
+ // Presence check only — the read op resolves the file itself, by the same "latest agent_sessions
131
+ // row" rule db.js's display path uses (a stitched continuation adds a row).
132
+ const transcript = String(core.prepare(`
133
+ SELECT jsonl_path FROM agent_sessions WHERE ctm_session_id = ?
134
+ ORDER BY COALESCE(NULLIF(modified_at, ''), updated_at, created_at) DESC,
135
+ updated_at DESC, created_at DESC
136
+ LIMIT 1
137
+ `).get(id)?.jsonl_path || '');
138
+ // 1. re-run the per-row backfill: the boot job's own read op, scoped to this id.
139
+ let signal = null;
140
+ if (transcript) {
141
+ const page = await pool.request('backfillAgentTitles', {
142
+ dbPath: basePath, ids: [id], limit: 1,
143
+ }, { timeoutMs: REQUEST_TIMEOUT_MS });
144
+ const row = (Array.isArray(page?.rows) ? page.rows : []).find((r) => r.id === id);
145
+ if (row) {
146
+ signal = {
147
+ customTitle: row.customTitle || '',
148
+ aiTitle: row.aiTitle || '',
149
+ tailBytes: row.tailBytes,
150
+ jsonlPath: String(row.jsonlPath || transcript),
151
+ };
152
+ }
153
+ }
154
+ // 2. demote (D-1: tier 1 off, tier 3 restated, so the applier below is allowed to write) and
155
+ // apply — one synchronous burst, no awaits.
156
+ core.exec('BEGIN IMMEDIATE');
157
+ let outcome = null;
158
+ let labelSynced = false;
159
+ let after = null;
160
+ try {
161
+ core.prepare(`
162
+ UPDATE ctm_sessions
163
+ SET user_renamed = 0, title_source = 'ai_title', title_status = 'generated',
164
+ title_status_reason = ?
165
+ WHERE id = ?
166
+ `).run(DEMOTE_REASON, id);
167
+ outcome = signal
168
+ ? applyAgentTitleSignals(core, { ctmSessionId: id, customTitle: signal.customTitle, aiTitle: signal.aiTitle })
169
+ : { applied: 'none', reason: transcript ? 'no_title_signal' : 'no_transcript', reassert: false };
170
+ if (outcome.applied === 'agent' && outcome.title) {
171
+ // D-13: the restore label and the durable title must never disagree. This is a local repair —
172
+ // it does not enqueue the multi-machine sync outbox row, which db.js's own
173
+ // updateStartupTaskLabel owns (see lib/agent-title-apply.js's header).
174
+ labelSynced = core.prepare('UPDATE startup_tasks SET label = ? WHERE ctm_session_id = ?')
175
+ .run(outcome.title, id).changes > 0;
176
+ }
177
+ // The dry run's whole point: this read happens INSIDE the transaction, so a rolled-back run
178
+ // still reports the state --apply would have left behind.
179
+ after = readRow();
180
+ core.exec(apply ? 'COMMIT' : 'ROLLBACK');
181
+ } catch (error) {
182
+ try { core.exec('ROLLBACK'); } catch { /* expected: a failed statement may already have aborted the transaction */ }
183
+ throw error;
184
+ }
185
+ return {
186
+ id,
187
+ action: 'demoted+retitled',
188
+ // The file the read op actually read, which is the row's latest transcript.
189
+ transcript: signal?.jsonlPath || transcript,
190
+ tailBytes: signal?.tailBytes ?? null,
191
+ signal: signal ? { customTitle: signal.customTitle || '', aiTitle: signal.aiTitle || '' } : null,
192
+ apply: outcome.applied,
193
+ reason: outcome.reason,
194
+ title: outcome.title || null,
195
+ labelSynced,
196
+ before,
197
+ after,
198
+ };
199
+ }
200
+
201
+ async function main() {
202
+ const ids = parseIds();
203
+ if (ids.length === 0) refuse('at least one session id is required (see the header comment)');
204
+ const apply = has('--apply');
205
+ const dbArg = String(arg('--db') || '').trim();
206
+ const basePath = path.resolve(dbArg || path.join(getDataDir(), 'task-manager.db'));
207
+ if (!fs.existsSync(basePath)) refuse(`db not found: ${basePath}`);
208
+ const corePath = resolveCorePath(basePath);
209
+ if (!fs.existsSync(corePath)) refuse(`core db not found: ${corePath} (resolved from ${basePath})`);
210
+ if (apply && !has('--force')) {
211
+ for (const candidate of [basePath, corePath]) {
212
+ if (!looksLive(candidate)) continue;
213
+ console.error(`ERROR: ${candidate} looks like a LIVE database (recent -wal writes).`);
214
+ console.error(' Stop CTM and re-run, work on a copy, or pass --force.');
215
+ process.exit(2);
216
+ }
217
+ }
218
+
219
+ const Database = loadSqliteDriver({ source: 'repair-resume-echo-titles' });
220
+ const core = new Database(corePath, {});
221
+ core.pragma('busy_timeout = 30000');
222
+ const pool = createReadPoolClient({ size: 1, requestTimeoutMs: REQUEST_TIMEOUT_MS, closeTimeoutMs: 2000 });
223
+ const counts = { repaired: 0, skipped: 0 };
224
+ try {
225
+ await pool.start();
226
+ for (const id of ids) {
227
+ const line = await repairOne({ core, pool, basePath, id, apply });
228
+ if (line.action === 'skip') counts.skipped += 1;
229
+ else counts.repaired += 1;
230
+ console.log(JSON.stringify({ ...line, dryRun: !apply }));
231
+ }
232
+ console.log(JSON.stringify({ summary: true, dryRun: !apply, ids: ids.length, ...counts }));
233
+ } finally {
234
+ try { await pool.close(); } catch { /* expected: the pool may never have started */ }
235
+ try { core.close(); } catch { /* expected: closing an already-closed handle is not an error here */ }
236
+ }
237
+ }
238
+
239
+ if (require.main === module) {
240
+ main()
241
+ .catch((error) => {
242
+ // REPORT: print the failure and exit 1; nothing is retried.
243
+ console.error(`[repair-resume-echo-titles] ${error && error.stack ? error.stack : String(error)}`);
244
+ process.exitCode = 1;
245
+ });
246
+ }
247
+
248
+ module.exports = { looksLive, parseIds, resolveCorePath, DEMOTE_REASON };
@@ -0,0 +1,111 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ // AC-1h (coding-task-manager/docs/fsevents-churn-kernel-write-lock-2026-10-23.html §8): measure
5
+ // the cost of one UNCONTENDED locked write through the installed module, on a throwaway temp
6
+ // database, and print the distribution. The pre-WP-1 link-claim mechanism measured 913–2,797 µs
7
+ // per cycle; the kernel-backed protocol's budget is p50 ≤ 100 µs.
8
+ //
9
+ // node bin/write-lock-bench.js --cycles 5000
10
+ //
11
+ // This is a measurement, not a gate: it always exits 0 and prints whether the budget was met.
12
+ // The cycle measured is a full `createSqliteWriteLock(...)(fn)` round trip — kernel BEGIN
13
+ // EXCLUSIVE, the fence, the 1,024-byte in-place identity write, and the COMMIT — i.e. everything
14
+ // a wrapped write pays before and after the caller's own statement.
15
+ //
16
+ // Adapted from the WP-0 exploration harness (scratchpad/lockexp/mech.js), which compared the
17
+ // candidate mechanisms; this file keeps only the shipped one, so the numbers stay comparable to
18
+ // the ones quoted in the design doc.
19
+
20
+ const fs = require('node:fs');
21
+ const os = require('node:os');
22
+ const path = require('node:path');
23
+ const Database = require('better-sqlite3');
24
+
25
+ const { createSqliteWriteLock, closeSqliteWriteLocksForTests } = require('../../shared/sqlite-write-lock');
26
+
27
+ const AC_1H_P50_BUDGET_US = 100;
28
+ const DEFAULT_CYCLES = 2000;
29
+
30
+ function parseCycles(argv) {
31
+ const index = argv.indexOf('--cycles');
32
+ if (index === -1) return DEFAULT_CYCLES;
33
+ const raw = argv[index + 1];
34
+ const value = Number(raw);
35
+ if (!Number.isInteger(value) || value <= 0) {
36
+ console.error(`write-lock-bench: --cycles needs a positive integer, got ${JSON.stringify(raw)}`);
37
+ process.exit(2);
38
+ }
39
+ return value;
40
+ }
41
+
42
+ // Nearest-rank percentile over an ascending array.
43
+ function percentile(sorted, p) {
44
+ if (sorted.length === 0) return 0;
45
+ const rank = Math.ceil((p / 100) * sorted.length);
46
+ return sorted[Math.min(sorted.length - 1, Math.max(0, rank - 1))];
47
+ }
48
+
49
+ function main() {
50
+ const cycles = parseCycles(process.argv.slice(2));
51
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'write-lock-bench-'));
52
+ const lockPath = path.join(dir, 'bench.db.write-lock');
53
+ const lock = createSqliteWriteLock(lockPath, { Database, label: 'bench' });
54
+ const warmup = Math.min(200, Math.max(1, Math.floor(cycles / 10)));
55
+ const samples = new Float64Array(cycles);
56
+ const hold = [];
57
+
58
+ try {
59
+ // Warmup absorbs the one-time costs (lock DB creation, the record's first write, the
60
+ // journal's first open) so the distribution describes steady state, which is what AC-1h
61
+ // compares against the baseline.
62
+ for (let i = 0; i < warmup; i += 1) lock(() => {}, 'bench');
63
+ for (let i = 0; i < cycles; i += 1) {
64
+ const started = process.hrtime.bigint();
65
+ lock(() => {}, 'bench');
66
+ samples[i] = Number(process.hrtime.bigint() - started) / 1000;
67
+ }
68
+ } finally {
69
+ closeSqliteWriteLocksForTests();
70
+ try {
71
+ fs.rmSync(dir, { recursive: true, force: true });
72
+ } catch {
73
+ /* expected: best-effort removal of the throwaway bench directory; a leaked temp dir must
74
+ not turn a successful measurement into a failed run. */
75
+ }
76
+ }
77
+
78
+ const sorted = Float64Array.prototype.slice.call(samples).sort((a, b) => a - b);
79
+ const total = sorted.reduce((sum, value) => sum + value, 0);
80
+ const p50 = percentile(sorted, 50);
81
+ const report = {
82
+ // The mechanism is named without its lock-path literal on purpose: that literal is confined to
83
+ // shared/sqlite-write-lock.js by bin/lint-shared-copy-parity.js (E-2), because an unrelated
84
+ // open()+close() on it drops a live holder's POSIX lock (D-6).
85
+ mechanism: 'kernel write lock (BEGIN EXCLUSIVE on the module\'s lock DB, protocol 2)',
86
+ cycles,
87
+ warmupCycles: warmup,
88
+ platform: `${process.platform}/${process.arch} node ${process.version}`,
89
+ p50us: Number(p50.toFixed(1)),
90
+ p95us: Number(percentile(sorted, 95).toFixed(1)),
91
+ p99us: Number(percentile(sorted, 99).toFixed(1)),
92
+ minUs: Number(sorted[0].toFixed(1)),
93
+ maxUs: Number(sorted[sorted.length - 1].toFixed(1)),
94
+ meanUs: Number((total / sorted.length).toFixed(1)),
95
+ budgetP50us: AC_1H_P50_BUDGET_US,
96
+ withinBudget: p50 <= AC_1H_P50_BUDGET_US,
97
+ };
98
+ console.log(`[write-lock-bench] ${report.platform}`);
99
+ console.log(
100
+ `[write-lock-bench] cycles=${report.cycles} (warmup ${report.warmupCycles}) `
101
+ + `p50=${report.p50us}µs p95=${report.p95us}µs p99=${report.p99us}µs `
102
+ + `min=${report.minUs}µs max=${report.maxUs}µs mean=${report.meanUs}µs`,
103
+ );
104
+ console.log(
105
+ `[write-lock-bench] AC-1h budget p50 <= ${report.budgetP50us}µs: `
106
+ + `${report.withinBudget ? 'MET' : 'MISSED'} (baseline link-claim: 913–2,797µs)`,
107
+ );
108
+ console.log(JSON.stringify(report));
109
+ }
110
+
111
+ main();