@pleri/olam-cli 0.1.201 → 0.1.205

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 (833) hide show
  1. package/README.md +102 -169
  2. package/dist/agent-stream/agent-sdk-to-chunks.js +1 -1
  3. package/dist/agent-stream/driver-runner.js +73 -7
  4. package/dist/agent-stream/host-driver-launch.js +14 -1
  5. package/dist/agent-stream/prototype-gen-launch.js +113 -0
  6. package/dist/agent-stream/question-broker-bridge.js +335 -0
  7. package/dist/agent-stream/sdk-env-merge.demo.js +35 -0
  8. package/dist/agent-stream/sdk-env-merge.js +98 -0
  9. package/dist/image-digests.json +8 -8
  10. package/dist/index.js +9533 -6258
  11. package/dist/index.js.map +1 -1
  12. package/dist/mcp-server.js +24721 -12934
  13. package/hermes-bundle/version.json +1 -1
  14. package/hooks/__tests__/_loader.py +26 -0
  15. package/hooks/__tests__/prompts.py +63 -0
  16. package/hooks/__tests__/test_classify_bench.py +94 -0
  17. package/hooks/__tests__/test_classify_pins.py +78 -0
  18. package/hooks/model-router.py +17 -4
  19. package/host-cp/k8s/manifests/50-deployment.yaml +1 -1
  20. package/host-cp/k8s/manifests/auth-service/50-deployment.yaml +1 -1
  21. package/host-cp/k8s/manifests/kg-service/50-deployment.yaml +1 -1
  22. package/host-cp/k8s/manifests/mcp-auth-service/50-deployment.yaml +1 -1
  23. package/host-cp/k8s/manifests/memory-service/50-deployment.yaml +1 -1
  24. package/host-cp/src/op-side-longpoll.mjs +212 -0
  25. package/host-cp/src/plan-chat-proxy-headers.mjs +53 -0
  26. package/host-cp/src/plan-chat-service.mjs +100 -0
  27. package/host-cp/src/plan-orchestrator.mjs +100 -6
  28. package/host-cp/src/server.mjs +607 -45
  29. package/memory-hooks/agentmemory-classify-queue.mjs +363 -0
  30. package/memory-hooks/agentmemory-recall-trigger.mjs +233 -0
  31. package/memory-hooks/agentmemory-reflect-cite.mjs +332 -0
  32. package/memory-hooks/agentmemory-session-recall.js +332 -0
  33. package/memory-hooks/recall-log.mjs +185 -0
  34. package/package.json +9 -4
  35. package/dist/ask/checkout.d.ts +0 -19
  36. package/dist/ask/checkout.d.ts.map +0 -1
  37. package/dist/ask/checkout.js +0 -40
  38. package/dist/ask/checkout.js.map +0 -1
  39. package/dist/ask/knowledge-pack-builder.d.ts +0 -72
  40. package/dist/ask/knowledge-pack-builder.d.ts.map +0 -1
  41. package/dist/ask/knowledge-pack-builder.js +0 -96
  42. package/dist/ask/knowledge-pack-builder.js.map +0 -1
  43. package/dist/ask/knowledge-pack.generated.d.ts +0 -8
  44. package/dist/ask/knowledge-pack.generated.d.ts.map +0 -1
  45. package/dist/ask/knowledge-pack.generated.js +0 -2362
  46. package/dist/ask/knowledge-pack.generated.js.map +0 -1
  47. package/dist/ask/one-shot.d.ts +0 -21
  48. package/dist/ask/one-shot.d.ts.map +0 -1
  49. package/dist/ask/one-shot.js +0 -50
  50. package/dist/ask/one-shot.js.map +0 -1
  51. package/dist/ask/repl.d.ts +0 -30
  52. package/dist/ask/repl.d.ts.map +0 -1
  53. package/dist/ask/repl.js +0 -109
  54. package/dist/ask/repl.js.map +0 -1
  55. package/dist/ask/sdk-client.d.ts +0 -87
  56. package/dist/ask/sdk-client.d.ts.map +0 -1
  57. package/dist/ask/sdk-client.js +0 -118
  58. package/dist/ask/sdk-client.js.map +0 -1
  59. package/dist/ask/system-prompt.d.ts +0 -30
  60. package/dist/ask/system-prompt.d.ts.map +0 -1
  61. package/dist/ask/system-prompt.js +0 -31
  62. package/dist/ask/system-prompt.js.map +0 -1
  63. package/dist/cli-version.d.ts +0 -16
  64. package/dist/cli-version.d.ts.map +0 -1
  65. package/dist/cli-version.js +0 -39
  66. package/dist/cli-version.js.map +0 -1
  67. package/dist/commands/ask.d.ts +0 -27
  68. package/dist/commands/ask.d.ts.map +0 -1
  69. package/dist/commands/ask.js +0 -63
  70. package/dist/commands/ask.js.map +0 -1
  71. package/dist/commands/auth-list-json.d.ts +0 -87
  72. package/dist/commands/auth-list-json.d.ts.map +0 -1
  73. package/dist/commands/auth-list-json.js +0 -71
  74. package/dist/commands/auth-list-json.js.map +0 -1
  75. package/dist/commands/auth-migrate.d.ts +0 -212
  76. package/dist/commands/auth-migrate.d.ts.map +0 -1
  77. package/dist/commands/auth-migrate.js +0 -465
  78. package/dist/commands/auth-migrate.js.map +0 -1
  79. package/dist/commands/auth-status.d.ts +0 -51
  80. package/dist/commands/auth-status.d.ts.map +0 -1
  81. package/dist/commands/auth-status.js +0 -250
  82. package/dist/commands/auth-status.js.map +0 -1
  83. package/dist/commands/auth-upgrade.d.ts +0 -88
  84. package/dist/commands/auth-upgrade.d.ts.map +0 -1
  85. package/dist/commands/auth-upgrade.js +0 -431
  86. package/dist/commands/auth-upgrade.js.map +0 -1
  87. package/dist/commands/auth.d.ts +0 -31
  88. package/dist/commands/auth.d.ts.map +0 -1
  89. package/dist/commands/auth.js +0 -784
  90. package/dist/commands/auth.js.map +0 -1
  91. package/dist/commands/begin.d.ts +0 -27
  92. package/dist/commands/begin.d.ts.map +0 -1
  93. package/dist/commands/begin.js +0 -45
  94. package/dist/commands/begin.js.map +0 -1
  95. package/dist/commands/bootstrap.d.ts +0 -111
  96. package/dist/commands/bootstrap.d.ts.map +0 -1
  97. package/dist/commands/bootstrap.js +0 -485
  98. package/dist/commands/bootstrap.js.map +0 -1
  99. package/dist/commands/clean.d.ts +0 -41
  100. package/dist/commands/clean.d.ts.map +0 -1
  101. package/dist/commands/clean.js +0 -382
  102. package/dist/commands/clean.js.map +0 -1
  103. package/dist/commands/completion.d.ts +0 -30
  104. package/dist/commands/completion.d.ts.map +0 -1
  105. package/dist/commands/completion.js +0 -50
  106. package/dist/commands/completion.js.map +0 -1
  107. package/dist/commands/config.d.ts +0 -3
  108. package/dist/commands/config.d.ts.map +0 -1
  109. package/dist/commands/config.js +0 -146
  110. package/dist/commands/config.js.map +0 -1
  111. package/dist/commands/create.d.ts +0 -8
  112. package/dist/commands/create.d.ts.map +0 -1
  113. package/dist/commands/create.js +0 -775
  114. package/dist/commands/create.js.map +0 -1
  115. package/dist/commands/crystallize.d.ts +0 -18
  116. package/dist/commands/crystallize.d.ts.map +0 -1
  117. package/dist/commands/crystallize.js +0 -123
  118. package/dist/commands/crystallize.js.map +0 -1
  119. package/dist/commands/destroy.d.ts +0 -59
  120. package/dist/commands/destroy.d.ts.map +0 -1
  121. package/dist/commands/destroy.js +0 -148
  122. package/dist/commands/destroy.js.map +0 -1
  123. package/dist/commands/diagnose.d.ts +0 -36
  124. package/dist/commands/diagnose.d.ts.map +0 -1
  125. package/dist/commands/diagnose.js +0 -177
  126. package/dist/commands/diagnose.js.map +0 -1
  127. package/dist/commands/dispatch-resolve.d.ts +0 -54
  128. package/dist/commands/dispatch-resolve.d.ts.map +0 -1
  129. package/dist/commands/dispatch-resolve.js +0 -105
  130. package/dist/commands/dispatch-resolve.js.map +0 -1
  131. package/dist/commands/dispatch.d.ts +0 -18
  132. package/dist/commands/dispatch.d.ts.map +0 -1
  133. package/dist/commands/dispatch.js +0 -159
  134. package/dist/commands/dispatch.js.map +0 -1
  135. package/dist/commands/doctor.d.ts +0 -258
  136. package/dist/commands/doctor.d.ts.map +0 -1
  137. package/dist/commands/doctor.js +0 -1073
  138. package/dist/commands/doctor.js.map +0 -1
  139. package/dist/commands/enter.d.ts +0 -63
  140. package/dist/commands/enter.d.ts.map +0 -1
  141. package/dist/commands/enter.js +0 -230
  142. package/dist/commands/enter.js.map +0 -1
  143. package/dist/commands/flywheel/check-persona-skeleton.d.ts +0 -35
  144. package/dist/commands/flywheel/check-persona-skeleton.d.ts.map +0 -1
  145. package/dist/commands/flywheel/check-persona-skeleton.js +0 -151
  146. package/dist/commands/flywheel/check-persona-skeleton.js.map +0 -1
  147. package/dist/commands/flywheel/diversity-check.d.ts +0 -17
  148. package/dist/commands/flywheel/diversity-check.d.ts.map +0 -1
  149. package/dist/commands/flywheel/diversity-check.js +0 -64
  150. package/dist/commands/flywheel/diversity-check.js.map +0 -1
  151. package/dist/commands/flywheel/emit-breadcrumb.d.ts +0 -20
  152. package/dist/commands/flywheel/emit-breadcrumb.d.ts.map +0 -1
  153. package/dist/commands/flywheel/emit-breadcrumb.js +0 -137
  154. package/dist/commands/flywheel/emit-breadcrumb.js.map +0 -1
  155. package/dist/commands/flywheel/index.d.ts +0 -27
  156. package/dist/commands/flywheel/index.d.ts.map +0 -1
  157. package/dist/commands/flywheel/index.js +0 -54
  158. package/dist/commands/flywheel/index.js.map +0 -1
  159. package/dist/commands/flywheel/install-sessionstart-hook.d.ts +0 -64
  160. package/dist/commands/flywheel/install-sessionstart-hook.d.ts.map +0 -1
  161. package/dist/commands/flywheel/install-sessionstart-hook.js +0 -197
  162. package/dist/commands/flywheel/install-sessionstart-hook.js.map +0 -1
  163. package/dist/commands/flywheel/install-shims.d.ts +0 -41
  164. package/dist/commands/flywheel/install-shims.d.ts.map +0 -1
  165. package/dist/commands/flywheel/install-shims.js +0 -126
  166. package/dist/commands/flywheel/install-shims.js.map +0 -1
  167. package/dist/commands/flywheel/k10-measure.d.ts +0 -17
  168. package/dist/commands/flywheel/k10-measure.d.ts.map +0 -1
  169. package/dist/commands/flywheel/k10-measure.js +0 -63
  170. package/dist/commands/flywheel/k10-measure.js.map +0 -1
  171. package/dist/commands/flywheel/k5-score.d.ts +0 -14
  172. package/dist/commands/flywheel/k5-score.d.ts.map +0 -1
  173. package/dist/commands/flywheel/k5-score.js +0 -59
  174. package/dist/commands/flywheel/k5-score.js.map +0 -1
  175. package/dist/commands/flywheel/k5-validate.d.ts +0 -46
  176. package/dist/commands/flywheel/k5-validate.d.ts.map +0 -1
  177. package/dist/commands/flywheel/k5-validate.js +0 -246
  178. package/dist/commands/flywheel/k5-validate.js.map +0 -1
  179. package/dist/commands/flywheel/migrate-overlays.d.ts +0 -116
  180. package/dist/commands/flywheel/migrate-overlays.d.ts.map +0 -1
  181. package/dist/commands/flywheel/migrate-overlays.js +0 -792
  182. package/dist/commands/flywheel/migrate-overlays.js.map +0 -1
  183. package/dist/commands/flywheel/ping.d.ts +0 -21
  184. package/dist/commands/flywheel/ping.d.ts.map +0 -1
  185. package/dist/commands/flywheel/ping.js +0 -79
  186. package/dist/commands/flywheel/ping.js.map +0 -1
  187. package/dist/commands/flywheel/sanitize-persona-output.d.ts +0 -38
  188. package/dist/commands/flywheel/sanitize-persona-output.d.ts.map +0 -1
  189. package/dist/commands/flywheel/sanitize-persona-output.js +0 -102
  190. package/dist/commands/flywheel/sanitize-persona-output.js.map +0 -1
  191. package/dist/commands/flywheel/session-start.d.ts +0 -26
  192. package/dist/commands/flywheel/session-start.d.ts.map +0 -1
  193. package/dist/commands/flywheel/session-start.js +0 -119
  194. package/dist/commands/flywheel/session-start.js.map +0 -1
  195. package/dist/commands/hermes-kg-hook.d.ts +0 -36
  196. package/dist/commands/hermes-kg-hook.d.ts.map +0 -1
  197. package/dist/commands/hermes-kg-hook.js +0 -80
  198. package/dist/commands/hermes-kg-hook.js.map +0 -1
  199. package/dist/commands/hermes.d.ts +0 -46
  200. package/dist/commands/hermes.d.ts.map +0 -1
  201. package/dist/commands/hermes.js +0 -320
  202. package/dist/commands/hermes.js.map +0 -1
  203. package/dist/commands/host-cp.d.ts +0 -216
  204. package/dist/commands/host-cp.d.ts.map +0 -1
  205. package/dist/commands/host-cp.js +0 -913
  206. package/dist/commands/host-cp.js.map +0 -1
  207. package/dist/commands/implode.d.ts +0 -86
  208. package/dist/commands/implode.d.ts.map +0 -1
  209. package/dist/commands/implode.js +0 -468
  210. package/dist/commands/implode.js.map +0 -1
  211. package/dist/commands/init.d.ts +0 -86
  212. package/dist/commands/init.d.ts.map +0 -1
  213. package/dist/commands/init.js +0 -357
  214. package/dist/commands/init.js.map +0 -1
  215. package/dist/commands/install.d.ts +0 -22
  216. package/dist/commands/install.d.ts.map +0 -1
  217. package/dist/commands/install.js +0 -203
  218. package/dist/commands/install.js.map +0 -1
  219. package/dist/commands/keys-list-json.d.ts +0 -55
  220. package/dist/commands/keys-list-json.d.ts.map +0 -1
  221. package/dist/commands/keys-list-json.js +0 -54
  222. package/dist/commands/keys-list-json.js.map +0 -1
  223. package/dist/commands/keys.d.ts +0 -26
  224. package/dist/commands/keys.d.ts.map +0 -1
  225. package/dist/commands/keys.js +0 -157
  226. package/dist/commands/keys.js.map +0 -1
  227. package/dist/commands/kg-build.d.ts +0 -80
  228. package/dist/commands/kg-build.d.ts.map +0 -1
  229. package/dist/commands/kg-build.js +0 -282
  230. package/dist/commands/kg-build.js.map +0 -1
  231. package/dist/commands/kg-classify.d.ts +0 -30
  232. package/dist/commands/kg-classify.d.ts.map +0 -1
  233. package/dist/commands/kg-classify.js +0 -88
  234. package/dist/commands/kg-classify.js.map +0 -1
  235. package/dist/commands/kg-doctor.d.ts +0 -76
  236. package/dist/commands/kg-doctor.d.ts.map +0 -1
  237. package/dist/commands/kg-doctor.js +0 -262
  238. package/dist/commands/kg-doctor.js.map +0 -1
  239. package/dist/commands/kg-install-hook.d.ts +0 -20
  240. package/dist/commands/kg-install-hook.d.ts.map +0 -1
  241. package/dist/commands/kg-install-hook.js +0 -208
  242. package/dist/commands/kg-install-hook.js.map +0 -1
  243. package/dist/commands/kg-mirror.d.ts +0 -72
  244. package/dist/commands/kg-mirror.d.ts.map +0 -1
  245. package/dist/commands/kg-mirror.js +0 -397
  246. package/dist/commands/kg-mirror.js.map +0 -1
  247. package/dist/commands/kg-savings.d.ts +0 -20
  248. package/dist/commands/kg-savings.d.ts.map +0 -1
  249. package/dist/commands/kg-savings.js +0 -77
  250. package/dist/commands/kg-savings.js.map +0 -1
  251. package/dist/commands/kg-service-container.d.ts +0 -68
  252. package/dist/commands/kg-service-container.d.ts.map +0 -1
  253. package/dist/commands/kg-service-container.js +0 -191
  254. package/dist/commands/kg-service-container.js.map +0 -1
  255. package/dist/commands/kg-status.d.ts +0 -59
  256. package/dist/commands/kg-status.d.ts.map +0 -1
  257. package/dist/commands/kg-status.js +0 -344
  258. package/dist/commands/kg-status.js.map +0 -1
  259. package/dist/commands/kg-uninstall-hook.d.ts +0 -12
  260. package/dist/commands/kg-uninstall-hook.d.ts.map +0 -1
  261. package/dist/commands/kg-uninstall-hook.js +0 -121
  262. package/dist/commands/kg-uninstall-hook.js.map +0 -1
  263. package/dist/commands/kg-watch.d.ts +0 -49
  264. package/dist/commands/kg-watch.d.ts.map +0 -1
  265. package/dist/commands/kg-watch.js +0 -172
  266. package/dist/commands/kg-watch.js.map +0 -1
  267. package/dist/commands/lanes-list-json.d.ts +0 -69
  268. package/dist/commands/lanes-list-json.d.ts.map +0 -1
  269. package/dist/commands/lanes-list-json.js +0 -42
  270. package/dist/commands/lanes-list-json.js.map +0 -1
  271. package/dist/commands/lanes.d.ts +0 -18
  272. package/dist/commands/lanes.d.ts.map +0 -1
  273. package/dist/commands/lanes.js +0 -133
  274. package/dist/commands/lanes.js.map +0 -1
  275. package/dist/commands/list.d.ts +0 -33
  276. package/dist/commands/list.d.ts.map +0 -1
  277. package/dist/commands/list.js +0 -87
  278. package/dist/commands/list.js.map +0 -1
  279. package/dist/commands/logs.d.ts +0 -52
  280. package/dist/commands/logs.d.ts.map +0 -1
  281. package/dist/commands/logs.js +0 -180
  282. package/dist/commands/logs.js.map +0 -1
  283. package/dist/commands/mcp/add.d.ts +0 -9
  284. package/dist/commands/mcp/add.d.ts.map +0 -1
  285. package/dist/commands/mcp/add.js +0 -87
  286. package/dist/commands/mcp/add.js.map +0 -1
  287. package/dist/commands/mcp/client.d.ts +0 -60
  288. package/dist/commands/mcp/client.d.ts.map +0 -1
  289. package/dist/commands/mcp/client.js +0 -70
  290. package/dist/commands/mcp/client.js.map +0 -1
  291. package/dist/commands/mcp/complete.d.ts +0 -36
  292. package/dist/commands/mcp/complete.d.ts.map +0 -1
  293. package/dist/commands/mcp/complete.js +0 -66
  294. package/dist/commands/mcp/complete.js.map +0 -1
  295. package/dist/commands/mcp/import-discovery.d.ts +0 -25
  296. package/dist/commands/mcp/import-discovery.d.ts.map +0 -1
  297. package/dist/commands/mcp/import-discovery.js +0 -135
  298. package/dist/commands/mcp/import-discovery.js.map +0 -1
  299. package/dist/commands/mcp/import-validate.d.ts +0 -15
  300. package/dist/commands/mcp/import-validate.d.ts.map +0 -1
  301. package/dist/commands/mcp/import-validate.js +0 -55
  302. package/dist/commands/mcp/import-validate.js.map +0 -1
  303. package/dist/commands/mcp/import.d.ts +0 -12
  304. package/dist/commands/mcp/import.d.ts.map +0 -1
  305. package/dist/commands/mcp/import.js +0 -126
  306. package/dist/commands/mcp/import.js.map +0 -1
  307. package/dist/commands/mcp/index.d.ts +0 -14
  308. package/dist/commands/mcp/index.d.ts.map +0 -1
  309. package/dist/commands/mcp/index.js +0 -39
  310. package/dist/commands/mcp/index.js.map +0 -1
  311. package/dist/commands/mcp/install-shared.d.ts +0 -24
  312. package/dist/commands/mcp/install-shared.d.ts.map +0 -1
  313. package/dist/commands/mcp/install-shared.js +0 -42
  314. package/dist/commands/mcp/install-shared.js.map +0 -1
  315. package/dist/commands/mcp/install.d.ts +0 -20
  316. package/dist/commands/mcp/install.d.ts.map +0 -1
  317. package/dist/commands/mcp/install.js +0 -59
  318. package/dist/commands/mcp/install.js.map +0 -1
  319. package/dist/commands/mcp/list.d.ts +0 -6
  320. package/dist/commands/mcp/list.d.ts.map +0 -1
  321. package/dist/commands/mcp/list.js +0 -56
  322. package/dist/commands/mcp/list.js.map +0 -1
  323. package/dist/commands/mcp/login.d.ts +0 -6
  324. package/dist/commands/mcp/login.d.ts.map +0 -1
  325. package/dist/commands/mcp/login.js +0 -38
  326. package/dist/commands/mcp/login.js.map +0 -1
  327. package/dist/commands/mcp/remove.d.ts +0 -6
  328. package/dist/commands/mcp/remove.d.ts.map +0 -1
  329. package/dist/commands/mcp/remove.js +0 -21
  330. package/dist/commands/mcp/remove.js.map +0 -1
  331. package/dist/commands/mcp/revoke.d.ts +0 -11
  332. package/dist/commands/mcp/revoke.d.ts.map +0 -1
  333. package/dist/commands/mcp/revoke.js +0 -51
  334. package/dist/commands/mcp/revoke.js.map +0 -1
  335. package/dist/commands/mcp/serve.d.ts +0 -23
  336. package/dist/commands/mcp/serve.d.ts.map +0 -1
  337. package/dist/commands/mcp/serve.js +0 -55
  338. package/dist/commands/mcp/serve.js.map +0 -1
  339. package/dist/commands/mcp/status.d.ts +0 -6
  340. package/dist/commands/mcp/status.d.ts.map +0 -1
  341. package/dist/commands/mcp/status.js +0 -57
  342. package/dist/commands/mcp/status.js.map +0 -1
  343. package/dist/commands/mcp/uninstall.d.ts +0 -20
  344. package/dist/commands/mcp/uninstall.d.ts.map +0 -1
  345. package/dist/commands/mcp/uninstall.js +0 -60
  346. package/dist/commands/mcp/uninstall.js.map +0 -1
  347. package/dist/commands/memory/_paths.d.ts +0 -25
  348. package/dist/commands/memory/_paths.d.ts.map +0 -1
  349. package/dist/commands/memory/_paths.js +0 -57
  350. package/dist/commands/memory/_paths.js.map +0 -1
  351. package/dist/commands/memory/bridge.d.ts +0 -57
  352. package/dist/commands/memory/bridge.d.ts.map +0 -1
  353. package/dist/commands/memory/bridge.js +0 -152
  354. package/dist/commands/memory/bridge.js.map +0 -1
  355. package/dist/commands/memory/index.d.ts +0 -20
  356. package/dist/commands/memory/index.d.ts.map +0 -1
  357. package/dist/commands/memory/index.js +0 -47
  358. package/dist/commands/memory/index.js.map +0 -1
  359. package/dist/commands/memory/install-hooks.d.ts +0 -22
  360. package/dist/commands/memory/install-hooks.d.ts.map +0 -1
  361. package/dist/commands/memory/install-hooks.js +0 -156
  362. package/dist/commands/memory/install-hooks.js.map +0 -1
  363. package/dist/commands/memory/install.d.ts +0 -57
  364. package/dist/commands/memory/install.d.ts.map +0 -1
  365. package/dist/commands/memory/install.js +0 -114
  366. package/dist/commands/memory/install.js.map +0 -1
  367. package/dist/commands/memory/logs.d.ts +0 -19
  368. package/dist/commands/memory/logs.d.ts.map +0 -1
  369. package/dist/commands/memory/logs.js +0 -50
  370. package/dist/commands/memory/logs.js.map +0 -1
  371. package/dist/commands/memory/mode.d.ts +0 -47
  372. package/dist/commands/memory/mode.d.ts.map +0 -1
  373. package/dist/commands/memory/mode.js +0 -185
  374. package/dist/commands/memory/mode.js.map +0 -1
  375. package/dist/commands/memory/reclassify.d.ts +0 -56
  376. package/dist/commands/memory/reclassify.d.ts.map +0 -1
  377. package/dist/commands/memory/reclassify.js +0 -177
  378. package/dist/commands/memory/reclassify.js.map +0 -1
  379. package/dist/commands/memory/secret.d.ts +0 -16
  380. package/dist/commands/memory/secret.d.ts.map +0 -1
  381. package/dist/commands/memory/secret.js +0 -80
  382. package/dist/commands/memory/secret.js.map +0 -1
  383. package/dist/commands/memory/start.d.ts +0 -25
  384. package/dist/commands/memory/start.d.ts.map +0 -1
  385. package/dist/commands/memory/start.js +0 -83
  386. package/dist/commands/memory/start.js.map +0 -1
  387. package/dist/commands/memory/stats.d.ts +0 -69
  388. package/dist/commands/memory/stats.d.ts.map +0 -1
  389. package/dist/commands/memory/stats.js +0 -164
  390. package/dist/commands/memory/stats.js.map +0 -1
  391. package/dist/commands/memory/status.d.ts +0 -45
  392. package/dist/commands/memory/status.d.ts.map +0 -1
  393. package/dist/commands/memory/status.js +0 -134
  394. package/dist/commands/memory/status.js.map +0 -1
  395. package/dist/commands/memory/stop.d.ts +0 -13
  396. package/dist/commands/memory/stop.d.ts.map +0 -1
  397. package/dist/commands/memory/stop.js +0 -52
  398. package/dist/commands/memory/stop.js.map +0 -1
  399. package/dist/commands/memory/uninstall.d.ts +0 -19
  400. package/dist/commands/memory/uninstall.d.ts.map +0 -1
  401. package/dist/commands/memory/uninstall.js +0 -60
  402. package/dist/commands/memory/uninstall.js.map +0 -1
  403. package/dist/commands/memory-service-container.d.ts +0 -130
  404. package/dist/commands/memory-service-container.d.ts.map +0 -1
  405. package/dist/commands/memory-service-container.js +0 -251
  406. package/dist/commands/memory-service-container.js.map +0 -1
  407. package/dist/commands/observe.d.ts +0 -9
  408. package/dist/commands/observe.d.ts.map +0 -1
  409. package/dist/commands/observe.js +0 -42
  410. package/dist/commands/observe.js.map +0 -1
  411. package/dist/commands/plans-list-json.d.ts +0 -77
  412. package/dist/commands/plans-list-json.d.ts.map +0 -1
  413. package/dist/commands/plans-list-json.js +0 -61
  414. package/dist/commands/plans-list-json.js.map +0 -1
  415. package/dist/commands/plans.d.ts +0 -3
  416. package/dist/commands/plans.d.ts.map +0 -1
  417. package/dist/commands/plans.js +0 -221
  418. package/dist/commands/plans.js.map +0 -1
  419. package/dist/commands/policy-check.d.ts +0 -14
  420. package/dist/commands/policy-check.d.ts.map +0 -1
  421. package/dist/commands/policy-check.js +0 -76
  422. package/dist/commands/policy-check.js.map +0 -1
  423. package/dist/commands/pr.d.ts +0 -17
  424. package/dist/commands/pr.d.ts.map +0 -1
  425. package/dist/commands/pr.js +0 -148
  426. package/dist/commands/pr.js.map +0 -1
  427. package/dist/commands/ps.d.ts +0 -57
  428. package/dist/commands/ps.d.ts.map +0 -1
  429. package/dist/commands/ps.js +0 -202
  430. package/dist/commands/ps.js.map +0 -1
  431. package/dist/commands/refresh-helpers.d.ts +0 -25
  432. package/dist/commands/refresh-helpers.d.ts.map +0 -1
  433. package/dist/commands/refresh-helpers.js +0 -56
  434. package/dist/commands/refresh-helpers.js.map +0 -1
  435. package/dist/commands/refresh.d.ts +0 -23
  436. package/dist/commands/refresh.d.ts.map +0 -1
  437. package/dist/commands/refresh.js +0 -237
  438. package/dist/commands/refresh.js.map +0 -1
  439. package/dist/commands/rekey.d.ts +0 -84
  440. package/dist/commands/rekey.d.ts.map +0 -1
  441. package/dist/commands/rekey.js +0 -209
  442. package/dist/commands/rekey.js.map +0 -1
  443. package/dist/commands/repos-list-json.d.ts +0 -58
  444. package/dist/commands/repos-list-json.d.ts.map +0 -1
  445. package/dist/commands/repos-list-json.js +0 -45
  446. package/dist/commands/repos-list-json.js.map +0 -1
  447. package/dist/commands/repos.d.ts +0 -11
  448. package/dist/commands/repos.d.ts.map +0 -1
  449. package/dist/commands/repos.js +0 -102
  450. package/dist/commands/repos.js.map +0 -1
  451. package/dist/commands/restart.d.ts +0 -18
  452. package/dist/commands/restart.d.ts.map +0 -1
  453. package/dist/commands/restart.js +0 -113
  454. package/dist/commands/restart.js.map +0 -1
  455. package/dist/commands/resume.d.ts +0 -63
  456. package/dist/commands/resume.d.ts.map +0 -1
  457. package/dist/commands/resume.js +0 -174
  458. package/dist/commands/resume.js.map +0 -1
  459. package/dist/commands/runbooks.d.ts +0 -45
  460. package/dist/commands/runbooks.d.ts.map +0 -1
  461. package/dist/commands/runbooks.js +0 -313
  462. package/dist/commands/runbooks.js.map +0 -1
  463. package/dist/commands/seed.d.ts +0 -27
  464. package/dist/commands/seed.d.ts.map +0 -1
  465. package/dist/commands/seed.js +0 -303
  466. package/dist/commands/seed.js.map +0 -1
  467. package/dist/commands/services-tls.d.ts +0 -120
  468. package/dist/commands/services-tls.d.ts.map +0 -1
  469. package/dist/commands/services-tls.js +0 -489
  470. package/dist/commands/services-tls.js.map +0 -1
  471. package/dist/commands/services.d.ts +0 -218
  472. package/dist/commands/services.d.ts.map +0 -1
  473. package/dist/commands/services.js +0 -830
  474. package/dist/commands/services.js.map +0 -1
  475. package/dist/commands/setup-linux-gate.d.ts +0 -26
  476. package/dist/commands/setup-linux-gate.d.ts.map +0 -1
  477. package/dist/commands/setup-linux-gate.js +0 -40
  478. package/dist/commands/setup-linux-gate.js.map +0 -1
  479. package/dist/commands/setup-metrics.d.ts +0 -26
  480. package/dist/commands/setup-metrics.d.ts.map +0 -1
  481. package/dist/commands/setup-metrics.js +0 -56
  482. package/dist/commands/setup-metrics.js.map +0 -1
  483. package/dist/commands/setup-phase-5a-skill-source.d.ts +0 -84
  484. package/dist/commands/setup-phase-5a-skill-source.d.ts.map +0 -1
  485. package/dist/commands/setup-phase-5a-skill-source.js +0 -259
  486. package/dist/commands/setup-phase-5a-skill-source.js.map +0 -1
  487. package/dist/commands/setup-phase-5b-project-sweep.d.ts +0 -38
  488. package/dist/commands/setup-phase-5b-project-sweep.d.ts.map +0 -1
  489. package/dist/commands/setup-phase-5b-project-sweep.js +0 -175
  490. package/dist/commands/setup-phase-5b-project-sweep.js.map +0 -1
  491. package/dist/commands/setup-phase-8-kg-hook.d.ts +0 -48
  492. package/dist/commands/setup-phase-8-kg-hook.d.ts.map +0 -1
  493. package/dist/commands/setup-phase-8-kg-hook.js +0 -93
  494. package/dist/commands/setup-phase-8-kg-hook.js.map +0 -1
  495. package/dist/commands/setup-phase-9-memory-bridge.d.ts +0 -36
  496. package/dist/commands/setup-phase-9-memory-bridge.d.ts.map +0 -1
  497. package/dist/commands/setup-phase-9-memory-bridge.js +0 -59
  498. package/dist/commands/setup-phase-9-memory-bridge.js.map +0 -1
  499. package/dist/commands/setup.d.ts +0 -231
  500. package/dist/commands/setup.d.ts.map +0 -1
  501. package/dist/commands/setup.js +0 -1374
  502. package/dist/commands/setup.js.map +0 -1
  503. package/dist/commands/skills-100x.d.ts +0 -34
  504. package/dist/commands/skills-100x.d.ts.map +0 -1
  505. package/dist/commands/skills-100x.js +0 -405
  506. package/dist/commands/skills-100x.js.map +0 -1
  507. package/dist/commands/skills-doctor.d.ts +0 -14
  508. package/dist/commands/skills-doctor.d.ts.map +0 -1
  509. package/dist/commands/skills-doctor.js +0 -126
  510. package/dist/commands/skills-doctor.js.map +0 -1
  511. package/dist/commands/skills-hook.d.ts +0 -19
  512. package/dist/commands/skills-hook.d.ts.map +0 -1
  513. package/dist/commands/skills-hook.js +0 -99
  514. package/dist/commands/skills-hook.js.map +0 -1
  515. package/dist/commands/skills-install-model-router.d.ts +0 -20
  516. package/dist/commands/skills-install-model-router.d.ts.map +0 -1
  517. package/dist/commands/skills-install-model-router.js +0 -55
  518. package/dist/commands/skills-install-model-router.js.map +0 -1
  519. package/dist/commands/skills-migrate-back.d.ts +0 -21
  520. package/dist/commands/skills-migrate-back.d.ts.map +0 -1
  521. package/dist/commands/skills-migrate-back.js +0 -222
  522. package/dist/commands/skills-migrate-back.js.map +0 -1
  523. package/dist/commands/skills-migrate-hooks-back.d.ts +0 -19
  524. package/dist/commands/skills-migrate-hooks-back.d.ts.map +0 -1
  525. package/dist/commands/skills-migrate-hooks-back.js +0 -83
  526. package/dist/commands/skills-migrate-hooks-back.js.map +0 -1
  527. package/dist/commands/skills-migrate-hooks.d.ts +0 -40
  528. package/dist/commands/skills-migrate-hooks.d.ts.map +0 -1
  529. package/dist/commands/skills-migrate-hooks.js +0 -178
  530. package/dist/commands/skills-migrate-hooks.js.map +0 -1
  531. package/dist/commands/skills-migrate.d.ts +0 -33
  532. package/dist/commands/skills-migrate.d.ts.map +0 -1
  533. package/dist/commands/skills-migrate.js +0 -216
  534. package/dist/commands/skills-migrate.js.map +0 -1
  535. package/dist/commands/skills-onboard.d.ts +0 -26
  536. package/dist/commands/skills-onboard.d.ts.map +0 -1
  537. package/dist/commands/skills-onboard.js +0 -230
  538. package/dist/commands/skills-onboard.js.map +0 -1
  539. package/dist/commands/skills-shadow-backups.d.ts +0 -15
  540. package/dist/commands/skills-shadow-backups.d.ts.map +0 -1
  541. package/dist/commands/skills-shadow-backups.js +0 -132
  542. package/dist/commands/skills-shadow-backups.js.map +0 -1
  543. package/dist/commands/skills-source.d.ts +0 -61
  544. package/dist/commands/skills-source.d.ts.map +0 -1
  545. package/dist/commands/skills-source.js +0 -895
  546. package/dist/commands/skills-source.js.map +0 -1
  547. package/dist/commands/skills.d.ts +0 -59
  548. package/dist/commands/skills.d.ts.map +0 -1
  549. package/dist/commands/skills.js +0 -461
  550. package/dist/commands/skills.js.map +0 -1
  551. package/dist/commands/status.d.ts +0 -65
  552. package/dist/commands/status.d.ts.map +0 -1
  553. package/dist/commands/status.js +0 -249
  554. package/dist/commands/status.js.map +0 -1
  555. package/dist/commands/stop.d.ts +0 -10
  556. package/dist/commands/stop.d.ts.map +0 -1
  557. package/dist/commands/stop.js +0 -17
  558. package/dist/commands/stop.js.map +0 -1
  559. package/dist/commands/substrate-audit-log.d.ts +0 -51
  560. package/dist/commands/substrate-audit-log.d.ts.map +0 -1
  561. package/dist/commands/substrate-audit-log.js +0 -161
  562. package/dist/commands/substrate-audit-log.js.map +0 -1
  563. package/dist/commands/substrate.d.ts +0 -87
  564. package/dist/commands/substrate.d.ts.map +0 -1
  565. package/dist/commands/substrate.js +0 -194
  566. package/dist/commands/substrate.js.map +0 -1
  567. package/dist/commands/update.d.ts +0 -89
  568. package/dist/commands/update.d.ts.map +0 -1
  569. package/dist/commands/update.js +0 -331
  570. package/dist/commands/update.js.map +0 -1
  571. package/dist/commands/upgrade-history.d.ts +0 -15
  572. package/dist/commands/upgrade-history.d.ts.map +0 -1
  573. package/dist/commands/upgrade-history.js +0 -34
  574. package/dist/commands/upgrade-history.js.map +0 -1
  575. package/dist/commands/upgrade-lock.d.ts +0 -93
  576. package/dist/commands/upgrade-lock.d.ts.map +0 -1
  577. package/dist/commands/upgrade-lock.js +0 -225
  578. package/dist/commands/upgrade-lock.js.map +0 -1
  579. package/dist/commands/upgrade-log.d.ts +0 -86
  580. package/dist/commands/upgrade-log.d.ts.map +0 -1
  581. package/dist/commands/upgrade-log.js +0 -146
  582. package/dist/commands/upgrade-log.js.map +0 -1
  583. package/dist/commands/upgrade.d.ts +0 -445
  584. package/dist/commands/upgrade.d.ts.map +0 -1
  585. package/dist/commands/upgrade.js +0 -1718
  586. package/dist/commands/upgrade.js.map +0 -1
  587. package/dist/commands/workspace-list-json.d.ts +0 -73
  588. package/dist/commands/workspace-list-json.d.ts.map +0 -1
  589. package/dist/commands/workspace-list-json.js +0 -59
  590. package/dist/commands/workspace-list-json.js.map +0 -1
  591. package/dist/commands/workspace.d.ts +0 -23
  592. package/dist/commands/workspace.d.ts.map +0 -1
  593. package/dist/commands/workspace.js +0 -203
  594. package/dist/commands/workspace.js.map +0 -1
  595. package/dist/commands/world-snapshot.d.ts +0 -32
  596. package/dist/commands/world-snapshot.d.ts.map +0 -1
  597. package/dist/commands/world-snapshot.js +0 -531
  598. package/dist/commands/world-snapshot.js.map +0 -1
  599. package/dist/commands/world-upgrade.d.ts +0 -33
  600. package/dist/commands/world-upgrade.d.ts.map +0 -1
  601. package/dist/commands/world-upgrade.js +0 -82
  602. package/dist/commands/world-upgrade.js.map +0 -1
  603. package/dist/commands/world.d.ts +0 -12
  604. package/dist/commands/world.d.ts.map +0 -1
  605. package/dist/commands/world.js +0 -18
  606. package/dist/commands/world.js.map +0 -1
  607. package/dist/commands/worldspec/compile.d.ts +0 -20
  608. package/dist/commands/worldspec/compile.d.ts.map +0 -1
  609. package/dist/commands/worldspec/compile.js +0 -130
  610. package/dist/commands/worldspec/compile.js.map +0 -1
  611. package/dist/commands/worldspec/index.d.ts +0 -12
  612. package/dist/commands/worldspec/index.d.ts.map +0 -1
  613. package/dist/commands/worldspec/index.js +0 -23
  614. package/dist/commands/worldspec/index.js.map +0 -1
  615. package/dist/commands/worldspec/init.d.ts +0 -15
  616. package/dist/commands/worldspec/init.d.ts.map +0 -1
  617. package/dist/commands/worldspec/init.js +0 -166
  618. package/dist/commands/worldspec/init.js.map +0 -1
  619. package/dist/commands/worldspec/schema.d.ts +0 -11
  620. package/dist/commands/worldspec/schema.d.ts.map +0 -1
  621. package/dist/commands/worldspec/schema.js +0 -55
  622. package/dist/commands/worldspec/schema.js.map +0 -1
  623. package/dist/commands/worldspec/validate.d.ts +0 -15
  624. package/dist/commands/worldspec/validate.d.ts.map +0 -1
  625. package/dist/commands/worldspec/validate.js +0 -66
  626. package/dist/commands/worldspec/validate.js.map +0 -1
  627. package/dist/commands/yolo.d.ts +0 -95
  628. package/dist/commands/yolo.d.ts.map +0 -1
  629. package/dist/commands/yolo.js +0 -377
  630. package/dist/commands/yolo.js.map +0 -1
  631. package/dist/context.d.ts +0 -30
  632. package/dist/context.d.ts.map +0 -1
  633. package/dist/context.js +0 -56
  634. package/dist/context.js.map +0 -1
  635. package/dist/docker-host.d.ts +0 -18
  636. package/dist/docker-host.d.ts.map +0 -1
  637. package/dist/docker-host.js +0 -17
  638. package/dist/docker-host.js.map +0 -1
  639. package/dist/exit-codes.d.ts +0 -67
  640. package/dist/exit-codes.d.ts.map +0 -1
  641. package/dist/exit-codes.js +0 -67
  642. package/dist/exit-codes.js.map +0 -1
  643. package/dist/from-manifest.d.ts +0 -53
  644. package/dist/from-manifest.d.ts.map +0 -1
  645. package/dist/from-manifest.js +0 -95
  646. package/dist/from-manifest.js.map +0 -1
  647. package/dist/image-presence.d.ts +0 -40
  648. package/dist/image-presence.d.ts.map +0 -1
  649. package/dist/image-presence.js +0 -39
  650. package/dist/image-presence.js.map +0 -1
  651. package/dist/index.d.ts +0 -9
  652. package/dist/index.d.ts.map +0 -1
  653. package/dist/install-root.d.ts +0 -74
  654. package/dist/install-root.d.ts.map +0 -1
  655. package/dist/install-root.js +0 -98
  656. package/dist/install-root.js.map +0 -1
  657. package/dist/lib/anthropic-base-url-file.d.ts +0 -37
  658. package/dist/lib/anthropic-base-url-file.d.ts.map +0 -1
  659. package/dist/lib/anthropic-base-url-file.js +0 -46
  660. package/dist/lib/anthropic-base-url-file.js.map +0 -1
  661. package/dist/lib/auth-backend.d.ts +0 -168
  662. package/dist/lib/auth-backend.d.ts.map +0 -1
  663. package/dist/lib/auth-backend.js +0 -172
  664. package/dist/lib/auth-backend.js.map +0 -1
  665. package/dist/lib/auth-list-cache.d.ts +0 -67
  666. package/dist/lib/auth-list-cache.d.ts.map +0 -1
  667. package/dist/lib/auth-list-cache.js +0 -84
  668. package/dist/lib/auth-list-cache.js.map +0 -1
  669. package/dist/lib/auth-list.d.ts +0 -107
  670. package/dist/lib/auth-list.d.ts.map +0 -1
  671. package/dist/lib/auth-list.js +0 -123
  672. package/dist/lib/auth-list.js.map +0 -1
  673. package/dist/lib/auth-login.d.ts +0 -92
  674. package/dist/lib/auth-login.d.ts.map +0 -1
  675. package/dist/lib/auth-login.js +0 -124
  676. package/dist/lib/auth-login.js.map +0 -1
  677. package/dist/lib/auth-mutator-backend.d.ts +0 -54
  678. package/dist/lib/auth-mutator-backend.d.ts.map +0 -1
  679. package/dist/lib/auth-mutator-backend.js +0 -62
  680. package/dist/lib/auth-mutator-backend.js.map +0 -1
  681. package/dist/lib/auth-refresh-kubernetes.d.ts +0 -65
  682. package/dist/lib/auth-refresh-kubernetes.d.ts.map +0 -1
  683. package/dist/lib/auth-refresh-kubernetes.js +0 -125
  684. package/dist/lib/auth-refresh-kubernetes.js.map +0 -1
  685. package/dist/lib/auth-remote.d.ts +0 -172
  686. package/dist/lib/auth-remote.d.ts.map +0 -1
  687. package/dist/lib/auth-remote.js +0 -394
  688. package/dist/lib/auth-remote.js.map +0 -1
  689. package/dist/lib/bootstrap-kubernetes.d.ts +0 -164
  690. package/dist/lib/bootstrap-kubernetes.d.ts.map +0 -1
  691. package/dist/lib/bootstrap-kubernetes.js +0 -1002
  692. package/dist/lib/bootstrap-kubernetes.js.map +0 -1
  693. package/dist/lib/build-if-stale.d.ts +0 -33
  694. package/dist/lib/build-if-stale.d.ts.map +0 -1
  695. package/dist/lib/build-if-stale.js +0 -156
  696. package/dist/lib/build-if-stale.js.map +0 -1
  697. package/dist/lib/bundle-freshness.d.ts +0 -57
  698. package/dist/lib/bundle-freshness.d.ts.map +0 -1
  699. package/dist/lib/bundle-freshness.js +0 -223
  700. package/dist/lib/bundle-freshness.js.map +0 -1
  701. package/dist/lib/bundle-source.d.ts +0 -52
  702. package/dist/lib/bundle-source.d.ts.map +0 -1
  703. package/dist/lib/bundle-source.js +0 -83
  704. package/dist/lib/bundle-source.js.map +0 -1
  705. package/dist/lib/cf-access-token.d.ts +0 -32
  706. package/dist/lib/cf-access-token.d.ts.map +0 -1
  707. package/dist/lib/cf-access-token.js +0 -51
  708. package/dist/lib/cf-access-token.js.map +0 -1
  709. package/dist/lib/completion-generator.d.ts +0 -107
  710. package/dist/lib/completion-generator.d.ts.map +0 -1
  711. package/dist/lib/completion-generator.js +0 -226
  712. package/dist/lib/completion-generator.js.map +0 -1
  713. package/dist/lib/config.d.ts +0 -114
  714. package/dist/lib/config.d.ts.map +0 -1
  715. package/dist/lib/config.js +0 -246
  716. package/dist/lib/config.js.map +0 -1
  717. package/dist/lib/flywheel-probes.d.ts +0 -58
  718. package/dist/lib/flywheel-probes.d.ts.map +0 -1
  719. package/dist/lib/flywheel-probes.js +0 -163
  720. package/dist/lib/flywheel-probes.js.map +0 -1
  721. package/dist/lib/health-probes.d.ts +0 -267
  722. package/dist/lib/health-probes.d.ts.map +0 -1
  723. package/dist/lib/health-probes.js +0 -933
  724. package/dist/lib/health-probes.js.map +0 -1
  725. package/dist/lib/help-groups.d.ts +0 -36
  726. package/dist/lib/help-groups.d.ts.map +0 -1
  727. package/dist/lib/help-groups.js +0 -124
  728. package/dist/lib/help-groups.js.map +0 -1
  729. package/dist/lib/host-side-proxy.d.ts +0 -67
  730. package/dist/lib/host-side-proxy.d.ts.map +0 -1
  731. package/dist/lib/host-side-proxy.js +0 -177
  732. package/dist/lib/host-side-proxy.js.map +0 -1
  733. package/dist/lib/instrumentation.d.ts +0 -85
  734. package/dist/lib/instrumentation.d.ts.map +0 -1
  735. package/dist/lib/instrumentation.js +0 -104
  736. package/dist/lib/instrumentation.js.map +0 -1
  737. package/dist/lib/k8s-bootstrap.d.ts +0 -126
  738. package/dist/lib/k8s-bootstrap.d.ts.map +0 -1
  739. package/dist/lib/k8s-bootstrap.js +0 -218
  740. package/dist/lib/k8s-bootstrap.js.map +0 -1
  741. package/dist/lib/k8s-context-discovery.d.ts +0 -80
  742. package/dist/lib/k8s-context-discovery.d.ts.map +0 -1
  743. package/dist/lib/k8s-context-discovery.js +0 -102
  744. package/dist/lib/k8s-context-discovery.js.map +0 -1
  745. package/dist/lib/k8s-secret-render.d.ts +0 -141
  746. package/dist/lib/k8s-secret-render.d.ts.map +0 -1
  747. package/dist/lib/k8s-secret-render.js +0 -318
  748. package/dist/lib/k8s-secret-render.js.map +0 -1
  749. package/dist/lib/kg-caps.d.ts +0 -19
  750. package/dist/lib/kg-caps.d.ts.map +0 -1
  751. package/dist/lib/kg-caps.js +0 -19
  752. package/dist/lib/kg-caps.js.map +0 -1
  753. package/dist/lib/kubectl-context.d.ts +0 -87
  754. package/dist/lib/kubectl-context.d.ts.map +0 -1
  755. package/dist/lib/kubectl-context.js +0 -105
  756. package/dist/lib/kubectl-context.js.map +0 -1
  757. package/dist/lib/kubectl-wrap.d.ts +0 -65
  758. package/dist/lib/kubectl-wrap.d.ts.map +0 -1
  759. package/dist/lib/kubectl-wrap.js +0 -135
  760. package/dist/lib/kubectl-wrap.js.map +0 -1
  761. package/dist/lib/manifest-refresh.d.ts +0 -136
  762. package/dist/lib/manifest-refresh.d.ts.map +0 -1
  763. package/dist/lib/manifest-refresh.js +0 -298
  764. package/dist/lib/manifest-refresh.js.map +0 -1
  765. package/dist/lib/memory-host-process-migration.d.ts +0 -56
  766. package/dist/lib/memory-host-process-migration.d.ts.map +0 -1
  767. package/dist/lib/memory-host-process-migration.js +0 -156
  768. package/dist/lib/memory-host-process-migration.js.map +0 -1
  769. package/dist/lib/memory-secret.d.ts +0 -83
  770. package/dist/lib/memory-secret.d.ts.map +0 -1
  771. package/dist/lib/memory-secret.js +0 -147
  772. package/dist/lib/memory-secret.js.map +0 -1
  773. package/dist/lib/peripheral-registry.d.ts +0 -53
  774. package/dist/lib/peripheral-registry.d.ts.map +0 -1
  775. package/dist/lib/peripheral-registry.js +0 -73
  776. package/dist/lib/peripheral-registry.js.map +0 -1
  777. package/dist/lib/plans-client.d.ts +0 -69
  778. package/dist/lib/plans-client.d.ts.map +0 -1
  779. package/dist/lib/plans-client.js +0 -140
  780. package/dist/lib/plans-client.js.map +0 -1
  781. package/dist/lib/port-forward.d.ts +0 -168
  782. package/dist/lib/port-forward.d.ts.map +0 -1
  783. package/dist/lib/port-forward.js +0 -393
  784. package/dist/lib/port-forward.js.map +0 -1
  785. package/dist/lib/shell-rc.d.ts +0 -90
  786. package/dist/lib/shell-rc.d.ts.map +0 -1
  787. package/dist/lib/shell-rc.js +0 -91
  788. package/dist/lib/shell-rc.js.map +0 -1
  789. package/dist/lib/shim-generator.d.ts +0 -51
  790. package/dist/lib/shim-generator.d.ts.map +0 -1
  791. package/dist/lib/shim-generator.js +0 -88
  792. package/dist/lib/shim-generator.js.map +0 -1
  793. package/dist/lib/skills-apply-overlays.d.ts +0 -35
  794. package/dist/lib/skills-apply-overlays.d.ts.map +0 -1
  795. package/dist/lib/skills-apply-overlays.js +0 -243
  796. package/dist/lib/skills-apply-overlays.js.map +0 -1
  797. package/dist/lib/symlink-reconcile.d.ts +0 -32
  798. package/dist/lib/symlink-reconcile.d.ts.map +0 -1
  799. package/dist/lib/symlink-reconcile.js +0 -80
  800. package/dist/lib/symlink-reconcile.js.map +0 -1
  801. package/dist/lib/upgrade-check.d.ts +0 -60
  802. package/dist/lib/upgrade-check.d.ts.map +0 -1
  803. package/dist/lib/upgrade-check.js +0 -169
  804. package/dist/lib/upgrade-check.js.map +0 -1
  805. package/dist/lib/upgrade-kubernetes.d.ts +0 -193
  806. package/dist/lib/upgrade-kubernetes.d.ts.map +0 -1
  807. package/dist/lib/upgrade-kubernetes.js +0 -1014
  808. package/dist/lib/upgrade-kubernetes.js.map +0 -1
  809. package/dist/lib/world-mcp-register.d.ts +0 -98
  810. package/dist/lib/world-mcp-register.d.ts.map +0 -1
  811. package/dist/lib/world-mcp-register.js +0 -117
  812. package/dist/lib/world-mcp-register.js.map +0 -1
  813. package/dist/output.d.ts +0 -10
  814. package/dist/output.d.ts.map +0 -1
  815. package/dist/output.js +0 -31
  816. package/dist/output.js.map +0 -1
  817. package/dist/pleri-config.d.ts +0 -22
  818. package/dist/pleri-config.d.ts.map +0 -1
  819. package/dist/pleri-config.js +0 -42
  820. package/dist/pleri-config.js.map +0 -1
  821. package/dist/protocol-version.d.ts +0 -79
  822. package/dist/protocol-version.d.ts.map +0 -1
  823. package/dist/protocol-version.js +0 -133
  824. package/dist/protocol-version.js.map +0 -1
  825. package/dist/registry-allowlist.d.ts +0 -47
  826. package/dist/registry-allowlist.d.ts.map +0 -1
  827. package/dist/registry-allowlist.js +0 -67
  828. package/dist/registry-allowlist.js.map +0 -1
  829. package/dist/spawn/home-override.d.ts +0 -82
  830. package/dist/spawn/home-override.d.ts.map +0 -1
  831. package/dist/spawn/home-override.js +0 -107
  832. package/dist/spawn/home-override.js.map +0 -1
  833. package/host-cp/src/linear-sync.mjs +0 -43
@@ -27,6 +27,7 @@ import path from 'node:path';
27
27
  import url from 'node:url';
28
28
  import { execFile } from 'node:child_process';
29
29
  import { promisify } from 'node:util';
30
+ import { createHash } from 'node:crypto';
30
31
 
31
32
  const execFileAsync = promisify(execFile);
32
33
  import { SecretCache } from './secret-cache.mjs';
@@ -48,6 +49,10 @@ import {
48
49
  import { betaResponseEmitter, cfAccessHeaders } from '@olam/auth-client';
49
50
  import { attemptRecovery, findScenarioForKind } from '../recovery/index.mjs';
50
51
  import { detectHaltChunk } from './halt-detect.mjs';
52
+ import {
53
+ buildPlanChatProxyHeaders,
54
+ injectBrokerSecret,
55
+ } from './plan-chat-proxy-headers.mjs';
51
56
  import { evaluateRedirect, applyRedirect } from './redirect.mjs';
52
57
  import { spawnUpgraderContainer } from './upgrade-spawner.mjs';
53
58
  import { isPlanningPath } from './bootstrap-selective.mjs';
@@ -104,6 +109,11 @@ import { handleDispatchFromLinear } from './lib/linear-dispatch.mjs';
104
109
  // (safePersistLastDispatch imported above alongside readLastDispatch)
105
110
  import { emitTierSuggestion } from '../dispatch/auto-tier-scheduler.mjs';
106
111
  import { isServeOnly, isOrchestrationRoute, ORCHESTRATION_UNAVAILABLE } from './serve-only-config.mjs';
112
+ // D.1 — operator-side long-poll (Phase D of 3-axis-local-cloud-mode-v1).
113
+ // Feature-flag-gated: only imported when OLAM_OPSIDE_LONGPOLL=1.
114
+ // Import is static so the module is parsed at startup (cheap), but
115
+ // startPoll() is only called when the flag is on.
116
+ import { startPoll, stopPoll } from './op-side-longpoll.mjs';
107
117
 
108
118
  // ── Deployment-mode detection ─────────────────────────────────────
109
119
  //
@@ -197,13 +207,43 @@ const OLAM_EMAIL_ATTACHMENTS_ROOT =
197
207
  (HOST_CP_MODE === 'container'
198
208
  ? '/data/email-attachments'
199
209
  : path.join(os.homedir(), '.olam', 'email-attachments'));
200
- // Linear-webhook trigger (POST /v1/dispatch-from-linear).
201
- // OLAM_LINEAR_WEBHOOK_SECRET — shared secret set in Linear webhook settings.
210
+ // Linear-dispatch trigger (POST /v1/dispatch-from-linear).
211
+ // OLAM_LINEAR_DISPATCH_SIGNING_SECRET — shared secret with the
212
+ // cloudflare-worker-linear-sync Worker. The Worker signs a canonical
213
+ // dispatch string and carries the signature in the request BODY (NOT an
214
+ // X-Linear-Signature header). This MUST match the Worker's
215
+ // OLAM_LINEAR_DISPATCH_SIGNING_SECRET.
216
+ // OLAM_LINEAR_WEBHOOK_SECRET — retained for back-compat / any future direct
217
+ // inbound-Linear-webhook receiver; NOT used by the dispatch hop.
202
218
  // OLAM_LINEAR_WORLD_ID — optional; when set, route events to this worldId
203
219
  // instead of spawning a new world each time.
204
220
  // See docs/architecture/linear-as-trigger.md.
205
221
  const OLAM_LINEAR_WEBHOOK_SECRET = process.env.OLAM_LINEAR_WEBHOOK_SECRET ?? '';
222
+ const OLAM_LINEAR_DISPATCH_SIGNING_SECRET =
223
+ process.env.OLAM_LINEAR_DISPATCH_SIGNING_SECRET ?? '';
206
224
  const OLAM_LINEAR_WORLD_ID = process.env.OLAM_LINEAR_WORLD_ID ?? '';
225
+ // Cloud-burst dispatch (3-axis-local-cloud-mode-v1 Phase A1).
226
+ // OLAM_SANDBOX_RUNNER_URL — public HTTPS URL of the worker-runner-cloudflare-sandbox /spawn endpoint.
227
+ // OLAM_SANDBOX_RUNNER_TOKEN — bearer token presented to the runner's /spawn.
228
+ // Both required for the /api/world/:id/dispatch-cloud-burst endpoint to function.
229
+ // When either is absent, the endpoint returns 503 cloud_burst_not_configured.
230
+ const OLAM_SANDBOX_RUNNER_URL = process.env.OLAM_SANDBOX_RUNNER_URL ?? '';
231
+ const OLAM_SANDBOX_RUNNER_TOKEN = process.env.OLAM_SANDBOX_RUNNER_TOKEN ?? '';
232
+
233
+ // D.1 — operator-side long-poll feature flag.
234
+ // Set OLAM_OPSIDE_LONGPOLL=1 to enable. Default OFF (no behavior change
235
+ // when unset). Also requires OLAM_CLOUD_URL to know where plan-DO lives.
236
+ // OLAM_OPSIDE_LONGPOLL_AUTH provides the Authorization header value for
237
+ // Basic auth to plan-DO; defaults to Basic auth with operator/<SHOWCASE_PW>.
238
+ const OLAM_OPSIDE_LONGPOLL = process.env.OLAM_OPSIDE_LONGPOLL === '1';
239
+ const OLAM_CLOUD_URL = process.env.OLAM_CLOUD_URL ?? '';
240
+ const OLAM_SHOWCASE_PASSWORD = process.env.OLAM_SHOWCASE_PASSWORD ?? '';
241
+ // Build the Basic auth header from OLAM_SHOWCASE_PASSWORD when not
242
+ // explicitly overridden. Showcase Basic auth is the v1 mechanism (Decision #7).
243
+ const OLAM_OPSIDE_LONGPOLL_AUTH = process.env.OLAM_OPSIDE_LONGPOLL_AUTH
244
+ ?? (OLAM_SHOWCASE_PASSWORD
245
+ ? `Basic ${Buffer.from(`operator:${OLAM_SHOWCASE_PASSWORD}`).toString('base64')}`
246
+ : '');
207
247
 
208
248
  // In-flight delivery IDs for deduplication. Linear retries on non-2xx;
209
249
  // we MUST return 2xx for duplicates so retries terminate. Never use 409.
@@ -360,6 +400,33 @@ function readDogfoodRepoUrl() {
360
400
  return '';
361
401
  }
362
402
 
403
+ /**
404
+ * Resolve the default MULTI-repo clone list to inject into cloud-dispatch
405
+ * bodies as `repoUrls[]`. The SPA composer has no multi-repo picker (it sends
406
+ * a single optional repoUrl at most), so for multi-repo worlds (e.g.
407
+ * atlas-core + diner-app) host-cp injects the operator-configured default.
408
+ * Source order: OLAM_DOGFOOD_REPO_URLS env, then ~/.olam/dogfood-repo-urls
409
+ * file. Both accept newline- OR comma-separated URLs. Absent/empty → [] (no
410
+ * injection; falls back to the single-repo dogfoodRepoUrl path). Mirrors
411
+ * readDogfoodRepoUrl() — operators have ONE pattern, singular + plural.
412
+ * @returns {string[]}
413
+ */
414
+ function readDogfoodRepoUrls() {
415
+ const raw =
416
+ process.env['OLAM_DOGFOOD_REPO_URLS'] ??
417
+ (() => {
418
+ try {
419
+ return fs.readFileSync(path.join(os.homedir(), '.olam', 'dogfood-repo-urls'), 'utf-8');
420
+ } catch {
421
+ return '';
422
+ }
423
+ })();
424
+ return raw
425
+ .split(/[\n,]/)
426
+ .map((s) => s.trim())
427
+ .filter((s) => s.length > 0);
428
+ }
429
+
363
430
  /**
364
431
  * Resolve the cloud-kg-mirror classifier proxy URL the runner forwards
365
432
  * into spawned CF Sandbox child worlds. When set, host-cp enriches
@@ -404,6 +471,139 @@ function readKgProxyBearer() {
404
471
  return '';
405
472
  }
406
473
 
474
+ /**
475
+ * KG workspace the dispatched sandbox queries (e.g. `atlas-one`, which spans
476
+ * atlas-core + diner-app + 9 sibling repos). The runner exports it as
477
+ * OLAM_KG_PROXY_WORKSPACE so the in-sandbox `kg` helper scopes `/v1/graph` and
478
+ * the classify hook scopes its L2 probe. Source order: OLAM_KG_PROXY_WORKSPACE
479
+ * env, then ~/.olam/kg-proxy-workspace file. The per-world `workspace` field on
480
+ * the dispatch body (when present) wins over this at the enrich site below.
481
+ * Absent → no workspace injection (the KG is reachable but graph queries are
482
+ * un-scoped). Mirrors readKgProxyUrl/Bearer — operators have ONE pattern.
483
+ */
484
+ function readKgProxyWorkspace() {
485
+ const fromOlamEnv = process.env['OLAM_KG_PROXY_WORKSPACE'];
486
+ if (fromOlamEnv && fromOlamEnv.length > 0) return fromOlamEnv.trim();
487
+ try {
488
+ const file = path.join(os.homedir(), '.olam', 'kg-proxy-workspace');
489
+ const content = fs.readFileSync(file, 'utf-8').trim();
490
+ if (content.length > 0) return content;
491
+ } catch {
492
+ // file absent — fall through
493
+ }
494
+ return '';
495
+ }
496
+
497
+ /**
498
+ * Resolve the REMOTE host-cp base URL to inject into cloud-dispatch bodies as
499
+ * `hostCpUrl`. The CF-Sandbox runner posts chunks back to whatever
500
+ * OLAM_HOST_CP_URL it was deployed with — NOT this local host-cp. To see live
501
+ * agent reasoning in the SPA, the operator stands up a public tunnel (e.g.
502
+ * `cloudflared tunnel --url http://127.0.0.1:19000`) to THIS host-cp and writes
503
+ * the tunnel URL to ~/.olam/remote-host-cp-url. We forward it so the runner's
504
+ * in-container chunk-poster targets it (body.hostCpUrl wins over the runner's
505
+ * deploy-time env). Source order: OLAM_REMOTE_HOST_CP_URL env, then the file.
506
+ * Absent → no injection (chunks land at the runner's default sink). Mirrors
507
+ * readKgProxyUrl() — operators have ONE pattern.
508
+ */
509
+ function readRemoteHostCpUrl() {
510
+ const fromOlamEnv = process.env['OLAM_REMOTE_HOST_CP_URL'];
511
+ if (fromOlamEnv && fromOlamEnv.length > 0) return fromOlamEnv.trim();
512
+ try {
513
+ const file = path.join(os.homedir(), '.olam', 'remote-host-cp-url');
514
+ const content = fs.readFileSync(file, 'utf-8').trim();
515
+ if (content.length > 0) return content;
516
+ } catch {
517
+ // file absent — fall through
518
+ }
519
+ return '';
520
+ }
521
+
522
+ /**
523
+ * TTL-cached aggregator for the four ~/.olam/ config values that enrich
524
+ * cloud-dispatch payloads. Called on every /api/cloud-dispatch and
525
+ * /api/plans/create request — without caching each call issued 4 synchronous
526
+ * readFileSync syscalls that block the Node.js event loop in series.
527
+ *
528
+ * Cache design:
529
+ * TTL: OLAM_DISPATCH_CONFIG_TTL_MS (default 10 000 ms).
530
+ * Worst-case staleness after an operator file edit: one TTL window.
531
+ *
532
+ * fs.watch: each of the 4 ~/.olam/ files is watched for 'change'/'rename'
533
+ * events on first read. A watcher event immediately sets _dispatchConfigCache.value
534
+ * to null, so the next request re-reads all four files fresh — operator
535
+ * edits typically take effect on the very next dispatch, not after the TTL.
536
+ * Watchers are armed once and never torn down (host-cp is a long-running
537
+ * process; the 4 files are operator-written config, rarely mutated).
538
+ * fs.watch failures (e.g. network-mounted homedir, non-existent file) are
539
+ * swallowed — the TTL provides the fallback path.
540
+ *
541
+ * Env-var paths (OLAM_ANTHROPIC_BASE_URL etc.) can only change on process
542
+ * restart; the individual readers short-circuit on env before touching disk,
543
+ * so their values naturally stay consistent with the cached result.
544
+ *
545
+ * Thread-safety: Node.js is single-threaded. Concurrent async handlers
546
+ * race to read/write the same cache object. All outcomes are idempotent
547
+ * (same files → same values); the last writer wins harmlessly.
548
+ *
549
+ * Saving: 4 synchronous readFileSync calls per dispatch eliminated within the
550
+ * TTL window. Under concurrent dispatch bursts this removes the most
551
+ * common event-loop blocking on the hot path.
552
+ *
553
+ * @returns {{ anthropicBaseUrl: string, dogfoodRepoUrl: string, kgProxyUrl: string, kgProxyBearer: string, kgWorkspace: string }}
554
+ */
555
+ const _DISPATCH_CONFIG_TTL_MS =
556
+ Number(process.env['OLAM_DISPATCH_CONFIG_TTL_MS'] ?? 10_000);
557
+
558
+ /** @type {{ value: { anthropicBaseUrl: string, dogfoodRepoUrl: string, kgProxyUrl: string, kgProxyBearer: string, kgWorkspace: string } | null, ts: number, watchersArmed: boolean }} */
559
+ const _dispatchConfigCache = { value: null, ts: 0, watchersArmed: false };
560
+
561
+ function _invalidateDispatchConfigCache() {
562
+ _dispatchConfigCache.value = null;
563
+ }
564
+
565
+ function _armDispatchConfigWatchers() {
566
+ if (_dispatchConfigCache.watchersArmed) return;
567
+ _dispatchConfigCache.watchersArmed = true;
568
+ const watchFiles = [
569
+ 'anthropic-base-url',
570
+ 'dogfood-repo-url',
571
+ 'kg-proxy-url',
572
+ 'kg-proxy-bearer',
573
+ 'kg-proxy-workspace',
574
+ ];
575
+ for (const name of watchFiles) {
576
+ const file = path.join(os.homedir(), '.olam', name);
577
+ try {
578
+ fs.watch(file, () => _invalidateDispatchConfigCache());
579
+ } catch {
580
+ // File absent or fs.watch unavailable (e.g. network-mounted homedir).
581
+ // TTL covers this fallback path — no action needed.
582
+ }
583
+ }
584
+ }
585
+
586
+ function readHostDispatchConfig() {
587
+ const now = Date.now();
588
+ if (
589
+ _dispatchConfigCache.value !== null &&
590
+ now - _dispatchConfigCache.ts < _DISPATCH_CONFIG_TTL_MS
591
+ ) {
592
+ return _dispatchConfigCache.value;
593
+ }
594
+ const value = {
595
+ anthropicBaseUrl: readAnthropicBaseUrl(),
596
+ dogfoodRepoUrl: readDogfoodRepoUrl(),
597
+ kgProxyUrl: readKgProxyUrl(),
598
+ kgProxyBearer: readKgProxyBearer(),
599
+ kgWorkspace: readKgProxyWorkspace(),
600
+ };
601
+ _dispatchConfigCache.value = value;
602
+ _dispatchConfigCache.ts = now;
603
+ _armDispatchConfigWatchers();
604
+ return value;
605
+ }
606
+
407
607
  /** @type {Record<string, number>} */
408
608
  let WORLDS = {};
409
609
 
@@ -825,7 +1025,6 @@ async function tickWorldsSnapshot() {
825
1025
  String(a?.id ?? '').localeCompare(String(b?.id ?? '')),
826
1026
  );
827
1027
  const json = JSON.stringify(sorted);
828
- const { createHash } = await import('node:crypto');
829
1028
  const hash = createHash('sha1').update(json).digest('hex');
830
1029
  if (hash === lastWorldsHash) return;
831
1030
  lastWorldsHash = hash;
@@ -895,7 +1094,6 @@ async function tickTunnelsSnapshot() {
895
1094
  tunnels: [...byWorld[id]].sort((a, b) => a.name.localeCompare(b.name)),
896
1095
  }));
897
1096
  const json = JSON.stringify(stable);
898
- const { createHash } = await import('node:crypto');
899
1097
  const hash = createHash('sha1').update(json).digest('hex');
900
1098
  if (hash === lastTunnelsHash) return;
901
1099
  lastTunnelsHash = hash;
@@ -938,7 +1136,6 @@ async function tickListeningSnapshot() {
938
1136
  servers: [...w.servers].sort((a, b) => a.port - b.port),
939
1137
  }));
940
1138
  const json = JSON.stringify(stable);
941
- const { createHash } = await import('node:crypto');
942
1139
  const hash = createHash('sha1').update(json).digest('hex');
943
1140
  if (hash === lastListeningHash) return;
944
1141
  lastListeningHash = hash;
@@ -1055,6 +1252,11 @@ const server = http.createServer(instrumentHandler('host-cp', async (req, res) =
1055
1252
  // anything local that can hit 127.0.0.1:19000 can also read the token
1056
1253
  // file directly (same OS-level privilege boundary). Single-user-only;
1057
1254
  // multi-user mode (Phase G+) will swap this for cookie-with-Secure.
1255
+ //
1256
+ // Phase B (3-axis-local-cloud-mode-v1) adds two new fields:
1257
+ // capabilities — { local_docker, cloud_burst, cloud_tier } runtime capability flags
1258
+ // apiBase — '' by default; non-empty routes all SPA fetches to a different host
1259
+ // Both fields are additive; existing fields are preserved for backward compat.
1058
1260
  if (url.pathname === '/api/bootstrap') {
1059
1261
  return jsonReply(res, 200, {
1060
1262
  token: auth.token,
@@ -1063,6 +1265,17 @@ const server = http.createServer(instrumentHandler('host-cp', async (req, res) =
1063
1265
  header_format: 'Bearer <token>',
1064
1266
  hint: 'SPA: set document.cookie = `olam_host_cp_token=${token}; path=/; samesite=strict` then fetch (`/api/world/...`) freely.',
1065
1267
  cloud_enabled: Boolean(process.env.OLAM_CLOUD_URL && process.env.OLAM_SHOWCASE_PASSWORD),
1268
+ // Phase B: tri-state capability flags. SPA reads these to populate
1269
+ // the PlanModeSelector (Phase C) and to gate the executor dispatch path.
1270
+ capabilities: {
1271
+ local_docker: true,
1272
+ cloud_burst: Boolean(OLAM_SANDBOX_RUNNER_URL && OLAM_SANDBOX_RUNNER_TOKEN),
1273
+ cloud_tier: Boolean(process.env.OLAM_CLOUD_URL),
1274
+ },
1275
+ // Phase B: remote host-cp re-targeting. '' means same origin (no-op).
1276
+ // v1 always returns '' — the field exists so the SPA can read it
1277
+ // without a code change when a future operator sets a non-empty value.
1278
+ apiBase: '',
1066
1279
  });
1067
1280
  }
1068
1281
 
@@ -1949,6 +2162,118 @@ const server = http.createServer(instrumentHandler('host-cp', async (req, res) =
1949
2162
  const parsed = parseProxyPath(url.pathname);
1950
2163
  if (parsed) {
1951
2164
  const { worldId, subPath } = parsed;
2165
+
2166
+ // /api/world/:id/dispatch-cloud-burst — must be checked BEFORE the WORLDS
2167
+ // registry lookup below. Cloud-burst dispatches to the CF Sandbox runner
2168
+ // directly (no local Docker world required). The runner can receive bursts
2169
+ // for worlds that have never been registered locally — this is the whole
2170
+ // point of the cloud-burst path. The handler after the if(parsed) block is
2171
+ // unreachable because the proxy block returns before it; this is the
2172
+ // authoritative check.
2173
+ if (subPath === '/dispatch-cloud-burst' && req.method === 'POST') {
2174
+ if (!OLAM_SANDBOX_RUNNER_URL || !OLAM_SANDBOX_RUNNER_TOKEN) {
2175
+ return jsonReply(res, 503, {
2176
+ error: 'cloud_burst_not_configured',
2177
+ message:
2178
+ 'host-cp needs OLAM_SANDBOX_RUNNER_URL + OLAM_SANDBOX_RUNNER_TOKEN to dispatch cloud bursts. ' +
2179
+ 'Set both env vars + restart host-cp.',
2180
+ });
2181
+ }
2182
+ try {
2183
+ const reqChunks = [];
2184
+ for await (const c of req) reqChunks.push(c);
2185
+ let parsedBody;
2186
+ try {
2187
+ parsedBody = JSON.parse(Buffer.concat(reqChunks).toString('utf8'));
2188
+ } catch {
2189
+ return jsonReply(res, 400, { error: 'body_not_json' });
2190
+ }
2191
+ // Seam C guard (T1): strip ANTHROPIC_API_KEY + sk-ant-* keys from options
2192
+ // before building the spawn body. Structural — matches sandbox-dispatch-client.
2193
+ const safeOptions = {};
2194
+ if (parsedBody.options && typeof parsedBody.options === 'object') {
2195
+ for (const [k, v] of Object.entries(parsedBody.options)) {
2196
+ if (k !== 'ANTHROPIC_API_KEY' && !k.startsWith('sk-ant-')) safeOptions[k] = v;
2197
+ }
2198
+ }
2199
+ // Enrich with host config (parity with cloud-dispatch handler).
2200
+ // readHostDispatchConfig() is TTL-cached (default 10 s) + fs.watch invalidated.
2201
+ // Body-field-wins semantics: caller-supplied value always takes precedence over
2202
+ // the host default for each optional field (additive: absent fields use the
2203
+ // host default so vault-routed deployments propagate without SPA changes).
2204
+ // idempotencyKey is always generated fresh — deduplicates retried bursts at
2205
+ // the runner's /spawn endpoint (mirrors the cloud-dispatch handler A3.2 contract).
2206
+ const {
2207
+ anthropicBaseUrl: hostAnthropicBaseUrl,
2208
+ dogfoodRepoUrl: hostRepoUrl,
2209
+ kgProxyUrl: hostKgProxyUrl,
2210
+ kgProxyBearer: hostKgProxyBearer,
2211
+ kgWorkspace: hostKgWorkspace,
2212
+ } = readHostDispatchConfig();
2213
+ const burstAnthropicBaseUrl = parsedBody.anthropicBaseUrl || hostAnthropicBaseUrl;
2214
+ const burstRepoUrl = parsedBody.repoUrl || hostRepoUrl;
2215
+ const burstKgProxyUrl = parsedBody.kgProxyUrl || hostKgProxyUrl;
2216
+ const burstKgProxyBearer = parsedBody.kgProxyBearer || hostKgProxyBearer;
2217
+ const burstKgWorkspace = parsedBody.kgWorkspace ||
2218
+ (typeof parsedBody.workspace === 'string' && parsedBody.workspace.length > 0 ? parsedBody.workspace : '') ||
2219
+ hostKgWorkspace;
2220
+ const burstHostCpUrl = parsedBody.hostCpUrl || readRemoteHostCpUrl();
2221
+ const burstChunksSinkUrl = parsedBody.chunksSinkUrl || OLAM_CLOUD_URL;
2222
+ // Always generate a fresh idempotency key — prevents double-spawn on
2223
+ // retried requests (mirrors the cloud-dispatch handler's A3.2 contract).
2224
+ const idempotencyKey = crypto.randomUUID();
2225
+ const spawnBody = {
2226
+ prompt: parsedBody.prompt ?? '',
2227
+ sessionId: parsedBody.session_id ?? worldId,
2228
+ worldId: parsedBody.world_id ?? worldId,
2229
+ bypassPermissions: typeof parsedBody.bypassPermissions === 'boolean' ? parsedBody.bypassPermissions : true,
2230
+ ...(burstRepoUrl ? { repoUrl: burstRepoUrl } : {}),
2231
+ ...(parsedBody.repoUrls && Array.isArray(parsedBody.repoUrls) && parsedBody.repoUrls.length > 0 ? { repoUrls: parsedBody.repoUrls } : {}),
2232
+ // submodules → runner clones with --recurse-submodules (vs --depth 1).
2233
+ // cloud-dispatch forwards it via its `...parsed` spread; cloud-burst
2234
+ // builds an explicit spawnBody, so it must forward it too or a
2235
+ // submodule repo dispatched via burst silently clones without its
2236
+ // submodules (drift parity with cloud-dispatch — same class as #1572).
2237
+ ...(typeof parsedBody.submodules === 'boolean' ? { submodules: parsedBody.submodules } : {}),
2238
+ ...(burstAnthropicBaseUrl ? { anthropicBaseUrl: burstAnthropicBaseUrl } : {}),
2239
+ ...(burstKgProxyUrl ? { kgProxyUrl: burstKgProxyUrl } : {}),
2240
+ ...(burstKgProxyBearer ? { kgProxyBearer: burstKgProxyBearer } : {}),
2241
+ ...(burstKgWorkspace ? { kgWorkspace: burstKgWorkspace } : {}),
2242
+ ...(burstHostCpUrl ? { hostCpUrl: burstHostCpUrl } : {}),
2243
+ ...(burstChunksSinkUrl ? { chunksSinkUrl: burstChunksSinkUrl } : {}),
2244
+ idempotencyKey,
2245
+ ...safeOptions,
2246
+ };
2247
+ const spawnRes = await fetch(`${OLAM_SANDBOX_RUNNER_URL}/spawn`, {
2248
+ method: 'POST',
2249
+ headers: {
2250
+ Authorization: `Bearer ${OLAM_SANDBOX_RUNNER_TOKEN}`,
2251
+ 'content-type': 'application/json',
2252
+ },
2253
+ body: JSON.stringify(spawnBody),
2254
+ });
2255
+ if (!spawnRes.ok) {
2256
+ const errText = (await spawnRes.text()).slice(0, 200);
2257
+ return jsonReply(res, spawnRes.status, {
2258
+ error: 'cloud_burst_runner_error',
2259
+ message: errText,
2260
+ });
2261
+ }
2262
+ let spawnAck = {};
2263
+ try { spawnAck = await spawnRes.json(); } catch { /* older runner */ }
2264
+ return jsonReply(res, 200, {
2265
+ status: 'dispatched',
2266
+ sandbox_session_id: spawnAck.sessionId,
2267
+ world_id: parsedBody.world_id ?? worldId,
2268
+ });
2269
+ } catch (err) {
2270
+ return jsonReply(res, 502, {
2271
+ error: 'cloud_burst_dispatch_failed',
2272
+ message: err instanceof Error ? err.message : String(err),
2273
+ });
2274
+ }
2275
+ }
2276
+
1952
2277
  const port = WORLDS[worldId];
1953
2278
  if (port === undefined) {
1954
2279
  return jsonReply(res, 404, {
@@ -1958,6 +2283,53 @@ const server = http.createServer(instrumentHandler('host-cp', async (req, res) =
1958
2283
  });
1959
2284
  }
1960
2285
 
2286
+ // SPA-driven UAT (WS4): /api/world/<id>/uat[/status] is NOT a per-world-CP
2287
+ // proxy — it forwards to the Cloudflare worker-runner that boots atlas-core
2288
+ // + diner-app in a sandbox and returns the two quick-tunnel URLs. Handle it
2289
+ // HERE, BEFORE the docker per-world secret-fetch + proxy below (which assumes
2290
+ // a local `olam-<id>-devbox` container and 500s for cloud UAT worlds).
2291
+ if ((subPath === '/uat' || subPath === '/uat/status') && req.method === 'POST') {
2292
+ if (!OLAM_SANDBOX_RUNNER_URL || !OLAM_SANDBOX_RUNNER_TOKEN) {
2293
+ return jsonReply(res, 503, {
2294
+ error: 'uat_not_configured',
2295
+ message: 'host-cp needs OLAM_SANDBOX_RUNNER_URL + OLAM_SANDBOX_RUNNER_TOKEN to run UAT.',
2296
+ });
2297
+ }
2298
+ const isStatus = subPath === '/uat/status';
2299
+ try {
2300
+ const reqChunks = [];
2301
+ for await (const c of req) reqChunks.push(c);
2302
+ let uatIn = {};
2303
+ if (reqChunks.length) {
2304
+ try { uatIn = JSON.parse(Buffer.concat(reqChunks).toString('utf8')); }
2305
+ catch { return jsonReply(res, 400, { error: 'body_not_json' }); }
2306
+ }
2307
+ const uatBody = {
2308
+ sessionId: uatIn.session_id ?? uatIn.sessionId ?? worldId,
2309
+ ...(uatIn.atlasCoreUrl ? { atlasCoreUrl: uatIn.atlasCoreUrl } : {}),
2310
+ ...(uatIn.dinerAppUrl ? { dinerAppUrl: uatIn.dinerAppUrl } : {}),
2311
+ // Only the start call clones; inject the gh token server-side so the
2312
+ // browser never carries it.
2313
+ ...(!isStatus && process.env.OLAM_UAT_GH_TOKEN ? { ghToken: process.env.OLAM_UAT_GH_TOKEN } : {}),
2314
+ };
2315
+ const uatRes = await fetch(`${OLAM_SANDBOX_RUNNER_URL}${isStatus ? '/uat/status' : '/uat'}`, {
2316
+ method: 'POST',
2317
+ headers: { Authorization: `Bearer ${OLAM_SANDBOX_RUNNER_TOKEN}`, 'content-type': 'application/json' },
2318
+ body: JSON.stringify(uatBody),
2319
+ signal: AbortSignal.timeout(90_000),
2320
+ });
2321
+ const text = await uatRes.text();
2322
+ let payload;
2323
+ try { payload = JSON.parse(text); } catch { payload = { raw: text.slice(0, 400) }; }
2324
+ return jsonReply(res, uatRes.ok ? 200 : uatRes.status, payload);
2325
+ } catch (err) {
2326
+ return jsonReply(res, 502, {
2327
+ error: 'uat_dispatch_failed',
2328
+ message: err instanceof Error ? err.message : String(err),
2329
+ });
2330
+ }
2331
+ }
2332
+
1961
2333
  // Phase F-2-D dogfood: synthesize /session/<id>/state. The CF Worker
1962
2334
  // had a Durable Object tracking phase progression (created → syncing
1963
2335
  // → cloning → configuring → warming-claude → ready). The per-world
@@ -2445,12 +2817,7 @@ const server = http.createServer(instrumentHandler('host-cp', async (req, res) =
2445
2817
  : url.pathname.slice('/api/plan-chat'.length);
2446
2818
  const upstreamUrl = new URL(subPath + url.search, upstreamBase);
2447
2819
  try {
2448
- const headers = {};
2449
- for (const [k, v] of Object.entries(req.headers)) {
2450
- if (k === 'host' || k === 'connection' || k === 'content-length') continue;
2451
- if (Array.isArray(v)) headers[k] = v.join(', ');
2452
- else if (typeof v === 'string') headers[k] = v;
2453
- }
2820
+ const headers = buildPlanChatProxyHeaders(req.headers);
2454
2821
  // Buffer body for non-GET/HEAD; GET shouldn't carry one.
2455
2822
  let body;
2456
2823
  if (req.method !== 'GET' && req.method !== 'HEAD') {
@@ -2472,6 +2839,17 @@ const server = http.createServer(instrumentHandler('host-cp', async (req, res) =
2472
2839
  } catch {
2473
2840
  // Body not JSON — pass through to upstream as-is. No event.
2474
2841
  }
2842
+
2843
+ // F3 (T9) — this host-cp proxy is the TRUSTED operator surface: the
2844
+ // SPA browser → host-cp → plan-chat-service. A WORLD process never
2845
+ // routes through here (it talks to plan-chat-service directly via
2846
+ // host.docker.internal). So when the operator-chunk broker secret is
2847
+ // configured, inject it here so the operator's own SPA interject is
2848
+ // authorised to write operator chunks, while a world process — which
2849
+ // cannot present this secret — is rejected by plan-chat-service's gate.
2850
+ // Injected only for chunk writes; harmless for non-operator chunks
2851
+ // (the gate only checks it for actor_type='operator').
2852
+ injectBrokerSecret(headers, process.env.OLAM_OPERATOR_CHUNK_SECRET);
2475
2853
  }
2476
2854
 
2477
2855
  const upstreamRes = await fetch(upstreamUrl.toString(), {
@@ -2582,13 +2960,16 @@ const server = http.createServer(instrumentHandler('host-cp', async (req, res) =
2582
2960
  return;
2583
2961
  }
2584
2962
 
2585
- // POST /v1/dispatch-from-linear — Linear webhook receiver.
2963
+ // POST /v1/dispatch-from-linear — linear-sync Worker dispatch receiver.
2586
2964
  //
2587
- // Linear POSTs a JSON payload and an HMAC-SHA256 signature in
2588
- // X-Linear-Signature. host-cp validates the signature, deduplicates
2589
- // by webhookId (Linear retries on non-2xx duplicates MUST return 202),
2590
- // and either routes to a pinned world (OLAM_LINEAR_WORLD_ID) or returns
2591
- // a spawn_pending descriptor for the MCP/CLI layer.
2965
+ // The cloudflare-worker-linear-sync Worker POSTs a structured dispatch
2966
+ // payload whose HMAC-SHA256 signature is carried IN THE BODY
2967
+ // (`payload.signature`) over a canonical string, keyed by
2968
+ // OLAM_LINEAR_DISPATCH_SIGNING_SECRET (NOT an X-Linear-Signature header,
2969
+ // NOT the Linear webhook secret). host-cp validates that signature +
2970
+ // replay window, deduplicates by deliveryId (Worker retries — duplicates
2971
+ // MUST return 202), and either routes to a pinned world
2972
+ // (OLAM_LINEAR_WORLD_ID) or returns a spawn_pending descriptor.
2592
2973
  //
2593
2974
  // Dedup rule: HTTP 202 { action: 'deduplicated' } — NEVER 409.
2594
2975
  // Body cap: 1 MiB (Linear payloads are small JSON, no attachments).
@@ -2610,7 +2991,6 @@ const server = http.createServer(instrumentHandler('host-cp', async (req, res) =
2610
2991
  req.on('end', async () => {
2611
2992
  if (aborted) return;
2612
2993
  const rawBody = Buffer.concat(chunks);
2613
- const signature = req.headers['x-linear-signature'] ?? '';
2614
2994
  let payload;
2615
2995
  try {
2616
2996
  payload = JSON.parse(rawBody.toString('utf8') || '{}');
@@ -2619,10 +2999,8 @@ const server = http.createServer(instrumentHandler('host-cp', async (req, res) =
2619
2999
  }
2620
3000
  try {
2621
3001
  const result = await handleDispatchFromLinear({
2622
- rawBody,
2623
3002
  payload,
2624
- signature,
2625
- secret: OLAM_LINEAR_WEBHOOK_SECRET,
3003
+ secret: OLAM_LINEAR_DISPATCH_SIGNING_SECRET,
2626
3004
  worlds: WORLDS,
2627
3005
  inFlight: linearInFlight,
2628
3006
  targetWorldId: OLAM_LINEAR_WORLD_ID || undefined,
@@ -2638,6 +3016,100 @@ const server = http.createServer(instrumentHandler('host-cp', async (req, res) =
2638
3016
  return;
2639
3017
  }
2640
3018
 
3019
+ // plan-chat-spa-attachments Phase A — POST /api/cloud-attachment.
3020
+ //
3021
+ // Bearer-gated (the central auth.isAuthorized gate above covers all /api/*
3022
+ // routes — same auth the SPA already carries for /api/cloud-dispatch). This
3023
+ // is a RAW-BYTE proxy: it streams the multipart body to plan-DO's
3024
+ // /v1/attachment (Basic operator:$OLAM_SHOWCASE_PASSWORD) WITHOUT decoding
3025
+ // it — `Buffer.concat(chunks)` with NO `.toString('utf8')` (utf8-decoding
3026
+ // binary file bytes corrupts them) and forwards Content-Type VERBATIM so the
3027
+ // upstream multipart boundary stays intact.
3028
+ //
3029
+ // Streaming size-guard (mirrors /v1/dispatch-from-email @ ~2893): a running
3030
+ // byte counter aborts with 413 + req.destroy() BEFORE fully buffering. Capped
3031
+ // at 32 MiB/file. Do NOT copy the JSON-buffering shape of /api/cloud-dispatch.
3032
+ if (url.pathname === '/api/cloud-attachment' && req.method === 'POST') {
3033
+ const cloudUrl = process.env.OLAM_CLOUD_URL;
3034
+ const showcasePw = process.env.OLAM_SHOWCASE_PASSWORD;
3035
+ if (!cloudUrl || !showcasePw) {
3036
+ return jsonReply(res, 503, {
3037
+ error: 'cloud_attachment_not_configured',
3038
+ message:
3039
+ 'host-cp needs OLAM_CLOUD_URL + OLAM_SHOWCASE_PASSWORD to proxy cloud attachments. ' +
3040
+ 'Set both env vars + restart host-cp.',
3041
+ });
3042
+ }
3043
+ // session_id query param → upstream plan_id (per-session = per-plan).
3044
+ // NOTE: this proxy reads session_id from the QUERY STRING, NOT the parsed
3045
+ // body — it is a raw-byte multipart proxy that never decodes the envelope.
3046
+ // (/api/cloud-dispatch differs: it parses its JSON body and reads
3047
+ // session_id from there.) The SPA must therefore carry session_id in the
3048
+ // upload URL query, or every upload forwards plan_id='default'. Defaults
3049
+ // to 'default' when absent.
3050
+ const sessionId = url.searchParams.get('session_id') ?? 'default';
3051
+ const contentType = req.headers['content-type'] ?? 'application/octet-stream';
3052
+
3053
+ const chunks = [];
3054
+ let size = 0;
3055
+ // P2-5 — this caps the RAW MULTIPART BODY (envelope), not the file. A
3056
+ // max-allowed 32 MiB file plus its multipart headers/boundary exceeds
3057
+ // 32 MiB, so capping at 32 here 413'd an at-ceiling file. The 32 MiB
3058
+ // PER-FILE limit is enforced downstream at plan-DO (/v1/attachment); this
3059
+ // 33 MiB cap only bounds the envelope to keep a runaway upload from
3060
+ // buffering unbounded.
3061
+ const MAX_BODY = 33 * 1024 * 1024;
3062
+ let aborted = false;
3063
+ req.on('data', (chunk) => {
3064
+ size += chunk.length;
3065
+ if (size > MAX_BODY) {
3066
+ aborted = true;
3067
+ jsonReply(res, 413, { error: 'attachment_too_large', maxBytes: MAX_BODY });
3068
+ req.destroy();
3069
+ return;
3070
+ }
3071
+ chunks.push(chunk);
3072
+ });
3073
+ req.on('error', () => {
3074
+ if (!aborted && !res.headersSent) {
3075
+ aborted = true;
3076
+ jsonReply(res, 400, { error: 'attachment_stream_error' });
3077
+ }
3078
+ });
3079
+ req.on('end', async () => {
3080
+ if (aborted) return;
3081
+ // RAW BYTES — never decode. utf8-decoding binary corrupts the file.
3082
+ const rawBody = Buffer.concat(chunks);
3083
+ const basicAuth = Buffer.from(`operator:${showcasePw}`).toString('base64');
3084
+ try {
3085
+ const upstream = await fetch(
3086
+ `${cloudUrl.replace(/\/+$/, '')}/v1/attachment?plan_id=${encodeURIComponent(sessionId)}`,
3087
+ {
3088
+ method: 'POST',
3089
+ headers: {
3090
+ 'Authorization': `Basic ${basicAuth}`,
3091
+ // Content-Type VERBATIM — preserves the multipart boundary.
3092
+ 'content-type': contentType,
3093
+ ...cfAccessHeaders(),
3094
+ },
3095
+ body: rawBody,
3096
+ },
3097
+ );
3098
+ const upstreamBody = await upstream.text();
3099
+ res.statusCode = upstream.status;
3100
+ res.setHeader('content-type', upstream.headers.get('content-type') ?? 'application/json');
3101
+ res.setHeader('cache-control', 'no-store');
3102
+ return res.end(upstreamBody);
3103
+ } catch (err) {
3104
+ return jsonReply(res, 502, {
3105
+ error: 'cloud_attachment_proxy_failed',
3106
+ message: err.message,
3107
+ });
3108
+ }
3109
+ });
3110
+ return;
3111
+ }
3112
+
2641
3113
  if (url.pathname === '/api/cloud-dispatch' && req.method === 'POST') {
2642
3114
  const cloudUrl = process.env.OLAM_CLOUD_URL;
2643
3115
  const showcasePw = process.env.OLAM_SHOWCASE_PASSWORD;
@@ -2706,34 +3178,77 @@ const server = http.createServer(instrumentHandler('host-cp', async (req, res) =
2706
3178
  );
2707
3179
  }
2708
3180
 
2709
- // Gap 3: enrich the dispatch body with the operator's anthropicBaseUrl
2710
- // so plan-DO can propagate it to spawned CF Sandbox child worlds.
2711
- // Only injected when not already set by the SPA (SPA has no auth-worker
2712
- // config knowledge host-cp is the sole injection point).
2713
- const anthropicBaseUrl = readAnthropicBaseUrl();
2714
- // Sibling injection: default repoUrl for the cloud Sandbox coding loop.
2715
- // The SPA has no repo-config knowledge today (Decision 2 in
2716
- // olam-builds-olam-cloud-dogfood: no SPA repo-selector); host-cp is the
2717
- // injection point. Source order: OLAM_DOGFOOD_REPO_URL env, then
2718
- // ~/.olam/dogfood-repo-url file. Absent → no injection (the dispatch
2719
- // runs text-only, like before this change).
2720
- const dogfoodRepoUrl = readDogfoodRepoUrl();
2721
- // cloud-kg-mirror Phase 1: propagate the classifier Worker URL +
2722
- // bearer so the runner can inject them into the sandbox env. When
2723
- // either is missing the dispatched world's PreToolUse hook falls
2724
- // through to grep via the existing fail-open path. Operator opts
2725
- // in by writing ~/.olam/kg-proxy-url + ~/.olam/kg-proxy-bearer.
2726
- const kgProxyUrl = readKgProxyUrl();
2727
- const kgProxyBearer = readKgProxyBearer();
3181
+ // Gap 3: enrich the dispatch body with the operator's host config so
3182
+ // plan-DO can propagate these values to spawned CF Sandbox child worlds.
3183
+ // Only injected when not already set by the SPA host-cp is the sole
3184
+ // injection point for auth-worker / repo / kg-proxy config.
3185
+ // readHostDispatchConfig() is TTL-cached (default 10 s) + fs.watch
3186
+ // invalidated eliminates 4 synchronous readFileSync calls per dispatch
3187
+ // on the hot path; see its JSDoc for the staleness window contract.
3188
+ const {
3189
+ anthropicBaseUrl,
3190
+ dogfoodRepoUrl,
3191
+ kgProxyUrl,
3192
+ kgProxyBearer,
3193
+ kgWorkspace: hostKgWorkspace,
3194
+ } = readHostDispatchConfig();
3195
+ // KG workspace: the per-world `workspace` field (set by the SPA's
3196
+ // WorkspacePicker) wins; otherwise fall back to the host default
3197
+ // (~/.olam/kg-proxy-workspace). The runner exports it as
3198
+ // OLAM_KG_PROXY_WORKSPACE so the in-sandbox `kg` helper + classify hook
3199
+ // scope their queries to the right graph (e.g. atlas-one).
3200
+ const kgWorkspace =
3201
+ (typeof parsed.workspace === 'string' && parsed.workspace.length > 0
3202
+ ? parsed.workspace
3203
+ : '') || hostKgWorkspace;
3204
+ // 3-axis-local-cloud-mode-v1 Phase A3 A3.2: generate a uuid-v7 per dispatch
3205
+ // for idempotency deduplication at the runner's /spawn endpoint. The key
3206
+ // travels as both a header (Idempotency-Key) and a body field (idempotencyKey)
3207
+ // so plan-DO can forward it even without native header-forwarding support
3208
+ // (the body field path is the safe fallback until plan-DO gains header
3209
+ // propagation in a follow-up phase).
3210
+ const idempotencyKey = crypto.randomUUID();
3211
+ // Multi-repo default: the SPA composer can't pass repoUrls[] (no picker),
3212
+ // so inject the operator-configured multi-repo default for multi-repo
3213
+ // worlds (atlas-core + diner-app). Only when the body carries neither a
3214
+ // repoUrls[] nor a single repoUrl — explicit caller input always wins.
3215
+ const dogfoodRepoUrls = readDogfoodRepoUrls();
3216
+ // plan-chat-spa-attachments Phase A: `parsed.attachments` (a top-level
3217
+ // AttachmentRef[] field — NEVER inside messages[].content) is forwarded
3218
+ // UNTOUCHED to plan-DO. It rides through the `...parsed` spread chain
3219
+ // below verbatim; it is NOT routed through the messages→prompt `.join`
3220
+ // normalisation above (which would stringify a structured array — T1).
3221
+ // Keep it on the enriched body if a future refactor narrows the spread.
2728
3222
  let enrichedObj = null;
2729
3223
  if (anthropicBaseUrl && !parsed.anthropicBaseUrl) enrichedObj = { ...(enrichedObj ?? parsed), anthropicBaseUrl };
2730
- if (dogfoodRepoUrl && !parsed.repoUrl) enrichedObj = { ...(enrichedObj ?? parsed), repoUrl: dogfoodRepoUrl };
3224
+ if (
3225
+ dogfoodRepoUrls.length > 0 &&
3226
+ !(Array.isArray(parsed.repoUrls) && parsed.repoUrls.length > 0) &&
3227
+ !parsed.repoUrl
3228
+ ) {
3229
+ enrichedObj = { ...(enrichedObj ?? parsed), repoUrls: dogfoodRepoUrls };
3230
+ } else if (dogfoodRepoUrl && !parsed.repoUrl) {
3231
+ enrichedObj = { ...(enrichedObj ?? parsed), repoUrl: dogfoodRepoUrl };
3232
+ }
2731
3233
  if (kgProxyUrl && !parsed.kgProxyUrl) enrichedObj = { ...(enrichedObj ?? parsed), kgProxyUrl };
2732
3234
  if (kgProxyBearer && !parsed.kgProxyBearer) enrichedObj = { ...(enrichedObj ?? parsed), kgProxyBearer };
3235
+ if (kgWorkspace && !parsed.kgWorkspace) enrichedObj = { ...(enrichedObj ?? parsed), kgWorkspace };
3236
+ // Dynamic chunk-sink: forward the operator's remote (tunnel) host-cp URL
3237
+ // so the CF-Sandbox runner streams chunks back to the host-cp the
3238
+ // operator is watching (live SPA reasoning). body value wins if present.
3239
+ const remoteHostCpUrl = readRemoteHostCpUrl();
3240
+ if (remoteHostCpUrl && !parsed.hostCpUrl) enrichedObj = { ...(enrichedObj ?? parsed), hostCpUrl: remoteHostCpUrl };
3241
+ // Host-cp-independent chunk sink: forward the public plan-DO URL so the
3242
+ // runner posts chunks straight to plan-DO /v1/chunks → Neon → Electric →
3243
+ // SPA (no host-cp in the chunk path). OLAM_CLOUD_URL is plan-DO's URL.
3244
+ if (OLAM_CLOUD_URL && !parsed.chunksSinkUrl) enrichedObj = { ...(enrichedObj ?? parsed), chunksSinkUrl: OLAM_CLOUD_URL };
3245
+ // Always inject idempotencyKey into the body so plan-DO forwards it to the
3246
+ // runner even when the Idempotency-Key header is not propagated.
3247
+ enrichedObj = { ...(enrichedObj ?? parsed), idempotencyKey };
2733
3248
  // Use `parsed` (not raw `body`) as the no-enrichment fallback so that the
2734
3249
  // messages→prompt normalisation above is always forwarded even when no
2735
3250
  // env-var enrichments are applied.
2736
- const enriched = enrichedObj ? JSON.stringify(enrichedObj) : JSON.stringify(parsed);
3251
+ const enriched = JSON.stringify(enrichedObj);
2737
3252
 
2738
3253
  if (parsed.world_id && parsed.prompt) {
2739
3254
  safePersistLastDispatch({
@@ -2758,6 +3273,7 @@ const server = http.createServer(instrumentHandler('host-cp', async (req, res) =
2758
3273
  headers: {
2759
3274
  'Authorization': `Basic ${basicAuth}`,
2760
3275
  'content-type': 'application/json',
3276
+ 'Idempotency-Key': idempotencyKey,
2761
3277
  ...cfAccessHeaders(),
2762
3278
  },
2763
3279
  body: enriched,
@@ -2776,6 +3292,14 @@ const server = http.createServer(instrumentHandler('host-cp', async (req, res) =
2776
3292
  }
2777
3293
  }
2778
3294
 
3295
+ // (dispatch-cloud-burst /api/world/<id>/dispatch-cloud-burst is handled earlier,
3296
+ // inside the /api/world/<id>/* block, BEFORE the WORLDS registry check — see above.
3297
+ // The subPath check fires before the WORLDS lookup because cloud-burst does not
3298
+ // require a locally-registered Docker world.)
3299
+
3300
+ // (SPA-driven UAT /api/world/<id>/uat[/status] is handled earlier, inside the
3301
+ // /api/world/<id>/* block, BEFORE the docker per-world proxy — see above.)
3302
+
2779
3303
  // /api/plans/create — Gap 3 plan-creation handshake (Phase H h2 v1 dogfood).
2780
3304
  //
2781
3305
  // Accepts a plan-creation request from the SPA, enriches it with the
@@ -2808,9 +3332,18 @@ const server = http.createServer(instrumentHandler('host-cp', async (req, res) =
2808
3332
  }
2809
3333
 
2810
3334
  // Enrich with anthropicBaseUrl + kgProxy from the host config.
2811
- const anthropicBaseUrl = readAnthropicBaseUrl();
2812
- const kgProxyUrl = readKgProxyUrl();
2813
- const kgProxyBearer = readKgProxyBearer();
3335
+ // Note: plans/create always stamps host values (no !parsed.X guard)
3336
+ // plan-DO needs the authoritative bearer URL, not whatever the SPA sent.
3337
+ // dogfoodRepoUrl is intentionally not forwarded here (plans/create is
3338
+ // a bearer-registration call, not a coding-sandbox dispatch).
3339
+ // kgWorkspace MUST travel with kgProxyUrl/kgProxyBearer: the worker-runner
3340
+ // gates KG on `kgEnabled = Boolean(kgProxyUrl && kgWorkspace)`, and plan-DO
3341
+ // forwards all three onto the sandbox spawn body (plan-agent.ts). Stamping
3342
+ // only 2 of the 3 would send the bearer but leave KG disabled (or silently
3343
+ // fall back to the runner's deploy-time workspace, not the authoritative
3344
+ // host value) — the same drift the other two dispatch sites already avoid.
3345
+ // readHostDispatchConfig() is TTL-cached — see its JSDoc.
3346
+ const { anthropicBaseUrl, kgProxyUrl, kgProxyBearer, kgWorkspace } = readHostDispatchConfig();
2814
3347
  const planId = parsed.planId ?? parsed.session_id ?? `plan-${Date.now()}`;
2815
3348
  const requestBody = {
2816
3349
  ...parsed,
@@ -2818,6 +3351,7 @@ const server = http.createServer(instrumentHandler('host-cp', async (req, res) =
2818
3351
  ...(anthropicBaseUrl ? { anthropicBaseUrl } : {}),
2819
3352
  ...(kgProxyUrl ? { kgProxyUrl } : {}),
2820
3353
  ...(kgProxyBearer ? { kgProxyBearer } : {}),
3354
+ ...(kgWorkspace ? { kgWorkspace } : {}),
2821
3355
  };
2822
3356
 
2823
3357
  const basicAuth = Buffer.from(`operator:${showcasePw}`).toString('base64');
@@ -3615,6 +4149,18 @@ async function renderSpaShell(filePath, pathname) {
3615
4149
  // which 404s. Rewrite to absolute `/assets/` so all SPA shell paths
3616
4150
  // (/, /worlds, /workspaces, /world/<id>) reference the same bundle.
3617
4151
  html = html.replace(/(href|src)="\.\/assets\//g, '$1="/assets/');
4152
+ // Idempotent injection: strip ANY pre-existing bearer / cloud-enabled
4153
+ // bootstrap script before injecting fresh values. A built dist may carry a
4154
+ // STALE baked `<script>window.__OLAM_PLAN_CHAT_BEARER__=...;window.__OLAM_CLOUD_ENABLED__=false;</script>`
4155
+ // (a fixture stamped at build/stage time). Without stripping it, host-cp's
4156
+ // freshly-injected `__OLAM_CLOUD_ENABLED__=true` is OVERRIDDEN by the stale
4157
+ // `=false` that runs second in source order — silently force-disabling Cloud
4158
+ // mode in the browser. Remove any such prior injection first so the
4159
+ // server-resolved values are authoritative.
4160
+ html = html.replace(
4161
+ /<script>window\.__OLAM_(?:PLAN_CHAT_BEARER|CLOUD_ENABLED)__=[^<]*<\/script>/g,
4162
+ '',
4163
+ );
3618
4164
  // Inject the bearer right after <head> so window.__OLAM_PLAN_CHAT_BEARER__
3619
4165
  // is set before the SPA bundle reads it. No bootstrap shim — see the
3620
4166
  // block comment above (Phase E5 cutover).
@@ -3937,6 +4483,20 @@ server.listen(PORT, '0.0.0.0', () => {
3937
4483
  } else if (hasShowcasePw && !hasCloudUrl) {
3938
4484
  console.warn(' [cloud] OLAM_SHOWCASE_PASSWORD set but OLAM_CLOUD_URL missing — cloud_enabled will be false');
3939
4485
  }
4486
+
4487
+ // D.1 — start operator-side long-poll after server is ready.
4488
+ // Only when OLAM_OPSIDE_LONGPOLL=1. Requires OLAM_CLOUD_URL and auth.
4489
+ // Default OFF — byte-for-byte no change when the flag is unset.
4490
+ if (OLAM_OPSIDE_LONGPOLL) {
4491
+ if (!OLAM_CLOUD_URL) {
4492
+ console.warn(' [op-poll] OLAM_OPSIDE_LONGPOLL=1 but OLAM_CLOUD_URL is not set — long-poll disabled');
4493
+ } else if (!OLAM_OPSIDE_LONGPOLL_AUTH) {
4494
+ console.warn(' [op-poll] OLAM_OPSIDE_LONGPOLL=1 but OLAM_SHOWCASE_PASSWORD is not set — long-poll disabled (no auth)');
4495
+ } else {
4496
+ console.log(` [op-poll] starting operator-side long-poll → ${OLAM_CLOUD_URL}/v1/op-poll`);
4497
+ startPoll(OLAM_CLOUD_URL, OLAM_OPSIDE_LONGPOLL_AUTH);
4498
+ }
4499
+ }
3940
4500
  });
3941
4501
 
3942
4502
  // Graceful shutdown so docker compose down → SIGTERM → flush + close.
@@ -3945,6 +4505,8 @@ for (const sig of ['SIGTERM', 'SIGINT']) {
3945
4505
  console.log(`received ${sig}, shutting down`);
3946
4506
  stopEvents();
3947
4507
  prPoller.stop();
4508
+ // D.1: stop the operator-side long-poll loop if it was started.
4509
+ stopPoll();
3948
4510
  // worldsDbReconciler + worldActivityTracker + worldWatchdog are null in SERVE-ONLY mode.
3949
4511
  worldsDbReconciler?.stop();
3950
4512
  stopWorldsSnapshotLoop();