@pleri/olam-cli 0.1.200 → 0.1.204

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 (828) 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 +8752 -5674
  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/package.json +8 -4
  30. package/dist/ask/checkout.d.ts +0 -19
  31. package/dist/ask/checkout.d.ts.map +0 -1
  32. package/dist/ask/checkout.js +0 -40
  33. package/dist/ask/checkout.js.map +0 -1
  34. package/dist/ask/knowledge-pack-builder.d.ts +0 -72
  35. package/dist/ask/knowledge-pack-builder.d.ts.map +0 -1
  36. package/dist/ask/knowledge-pack-builder.js +0 -96
  37. package/dist/ask/knowledge-pack-builder.js.map +0 -1
  38. package/dist/ask/knowledge-pack.generated.d.ts +0 -8
  39. package/dist/ask/knowledge-pack.generated.d.ts.map +0 -1
  40. package/dist/ask/knowledge-pack.generated.js +0 -2362
  41. package/dist/ask/knowledge-pack.generated.js.map +0 -1
  42. package/dist/ask/one-shot.d.ts +0 -21
  43. package/dist/ask/one-shot.d.ts.map +0 -1
  44. package/dist/ask/one-shot.js +0 -50
  45. package/dist/ask/one-shot.js.map +0 -1
  46. package/dist/ask/repl.d.ts +0 -30
  47. package/dist/ask/repl.d.ts.map +0 -1
  48. package/dist/ask/repl.js +0 -109
  49. package/dist/ask/repl.js.map +0 -1
  50. package/dist/ask/sdk-client.d.ts +0 -87
  51. package/dist/ask/sdk-client.d.ts.map +0 -1
  52. package/dist/ask/sdk-client.js +0 -118
  53. package/dist/ask/sdk-client.js.map +0 -1
  54. package/dist/ask/system-prompt.d.ts +0 -30
  55. package/dist/ask/system-prompt.d.ts.map +0 -1
  56. package/dist/ask/system-prompt.js +0 -31
  57. package/dist/ask/system-prompt.js.map +0 -1
  58. package/dist/cli-version.d.ts +0 -16
  59. package/dist/cli-version.d.ts.map +0 -1
  60. package/dist/cli-version.js +0 -39
  61. package/dist/cli-version.js.map +0 -1
  62. package/dist/commands/ask.d.ts +0 -27
  63. package/dist/commands/ask.d.ts.map +0 -1
  64. package/dist/commands/ask.js +0 -63
  65. package/dist/commands/ask.js.map +0 -1
  66. package/dist/commands/auth-list-json.d.ts +0 -87
  67. package/dist/commands/auth-list-json.d.ts.map +0 -1
  68. package/dist/commands/auth-list-json.js +0 -71
  69. package/dist/commands/auth-list-json.js.map +0 -1
  70. package/dist/commands/auth-migrate.d.ts +0 -212
  71. package/dist/commands/auth-migrate.d.ts.map +0 -1
  72. package/dist/commands/auth-migrate.js +0 -465
  73. package/dist/commands/auth-migrate.js.map +0 -1
  74. package/dist/commands/auth-status.d.ts +0 -51
  75. package/dist/commands/auth-status.d.ts.map +0 -1
  76. package/dist/commands/auth-status.js +0 -250
  77. package/dist/commands/auth-status.js.map +0 -1
  78. package/dist/commands/auth-upgrade.d.ts +0 -88
  79. package/dist/commands/auth-upgrade.d.ts.map +0 -1
  80. package/dist/commands/auth-upgrade.js +0 -431
  81. package/dist/commands/auth-upgrade.js.map +0 -1
  82. package/dist/commands/auth.d.ts +0 -31
  83. package/dist/commands/auth.d.ts.map +0 -1
  84. package/dist/commands/auth.js +0 -784
  85. package/dist/commands/auth.js.map +0 -1
  86. package/dist/commands/begin.d.ts +0 -27
  87. package/dist/commands/begin.d.ts.map +0 -1
  88. package/dist/commands/begin.js +0 -45
  89. package/dist/commands/begin.js.map +0 -1
  90. package/dist/commands/bootstrap.d.ts +0 -111
  91. package/dist/commands/bootstrap.d.ts.map +0 -1
  92. package/dist/commands/bootstrap.js +0 -485
  93. package/dist/commands/bootstrap.js.map +0 -1
  94. package/dist/commands/clean.d.ts +0 -41
  95. package/dist/commands/clean.d.ts.map +0 -1
  96. package/dist/commands/clean.js +0 -382
  97. package/dist/commands/clean.js.map +0 -1
  98. package/dist/commands/completion.d.ts +0 -30
  99. package/dist/commands/completion.d.ts.map +0 -1
  100. package/dist/commands/completion.js +0 -50
  101. package/dist/commands/completion.js.map +0 -1
  102. package/dist/commands/config.d.ts +0 -3
  103. package/dist/commands/config.d.ts.map +0 -1
  104. package/dist/commands/config.js +0 -146
  105. package/dist/commands/config.js.map +0 -1
  106. package/dist/commands/create.d.ts +0 -8
  107. package/dist/commands/create.d.ts.map +0 -1
  108. package/dist/commands/create.js +0 -775
  109. package/dist/commands/create.js.map +0 -1
  110. package/dist/commands/crystallize.d.ts +0 -18
  111. package/dist/commands/crystallize.d.ts.map +0 -1
  112. package/dist/commands/crystallize.js +0 -123
  113. package/dist/commands/crystallize.js.map +0 -1
  114. package/dist/commands/destroy.d.ts +0 -59
  115. package/dist/commands/destroy.d.ts.map +0 -1
  116. package/dist/commands/destroy.js +0 -148
  117. package/dist/commands/destroy.js.map +0 -1
  118. package/dist/commands/diagnose.d.ts +0 -36
  119. package/dist/commands/diagnose.d.ts.map +0 -1
  120. package/dist/commands/diagnose.js +0 -177
  121. package/dist/commands/diagnose.js.map +0 -1
  122. package/dist/commands/dispatch-resolve.d.ts +0 -54
  123. package/dist/commands/dispatch-resolve.d.ts.map +0 -1
  124. package/dist/commands/dispatch-resolve.js +0 -105
  125. package/dist/commands/dispatch-resolve.js.map +0 -1
  126. package/dist/commands/dispatch.d.ts +0 -18
  127. package/dist/commands/dispatch.d.ts.map +0 -1
  128. package/dist/commands/dispatch.js +0 -159
  129. package/dist/commands/dispatch.js.map +0 -1
  130. package/dist/commands/doctor.d.ts +0 -258
  131. package/dist/commands/doctor.d.ts.map +0 -1
  132. package/dist/commands/doctor.js +0 -1073
  133. package/dist/commands/doctor.js.map +0 -1
  134. package/dist/commands/enter.d.ts +0 -63
  135. package/dist/commands/enter.d.ts.map +0 -1
  136. package/dist/commands/enter.js +0 -230
  137. package/dist/commands/enter.js.map +0 -1
  138. package/dist/commands/flywheel/check-persona-skeleton.d.ts +0 -35
  139. package/dist/commands/flywheel/check-persona-skeleton.d.ts.map +0 -1
  140. package/dist/commands/flywheel/check-persona-skeleton.js +0 -151
  141. package/dist/commands/flywheel/check-persona-skeleton.js.map +0 -1
  142. package/dist/commands/flywheel/diversity-check.d.ts +0 -17
  143. package/dist/commands/flywheel/diversity-check.d.ts.map +0 -1
  144. package/dist/commands/flywheel/diversity-check.js +0 -64
  145. package/dist/commands/flywheel/diversity-check.js.map +0 -1
  146. package/dist/commands/flywheel/emit-breadcrumb.d.ts +0 -20
  147. package/dist/commands/flywheel/emit-breadcrumb.d.ts.map +0 -1
  148. package/dist/commands/flywheel/emit-breadcrumb.js +0 -137
  149. package/dist/commands/flywheel/emit-breadcrumb.js.map +0 -1
  150. package/dist/commands/flywheel/index.d.ts +0 -27
  151. package/dist/commands/flywheel/index.d.ts.map +0 -1
  152. package/dist/commands/flywheel/index.js +0 -54
  153. package/dist/commands/flywheel/index.js.map +0 -1
  154. package/dist/commands/flywheel/install-sessionstart-hook.d.ts +0 -64
  155. package/dist/commands/flywheel/install-sessionstart-hook.d.ts.map +0 -1
  156. package/dist/commands/flywheel/install-sessionstart-hook.js +0 -197
  157. package/dist/commands/flywheel/install-sessionstart-hook.js.map +0 -1
  158. package/dist/commands/flywheel/install-shims.d.ts +0 -41
  159. package/dist/commands/flywheel/install-shims.d.ts.map +0 -1
  160. package/dist/commands/flywheel/install-shims.js +0 -126
  161. package/dist/commands/flywheel/install-shims.js.map +0 -1
  162. package/dist/commands/flywheel/k10-measure.d.ts +0 -17
  163. package/dist/commands/flywheel/k10-measure.d.ts.map +0 -1
  164. package/dist/commands/flywheel/k10-measure.js +0 -63
  165. package/dist/commands/flywheel/k10-measure.js.map +0 -1
  166. package/dist/commands/flywheel/k5-score.d.ts +0 -14
  167. package/dist/commands/flywheel/k5-score.d.ts.map +0 -1
  168. package/dist/commands/flywheel/k5-score.js +0 -59
  169. package/dist/commands/flywheel/k5-score.js.map +0 -1
  170. package/dist/commands/flywheel/k5-validate.d.ts +0 -46
  171. package/dist/commands/flywheel/k5-validate.d.ts.map +0 -1
  172. package/dist/commands/flywheel/k5-validate.js +0 -246
  173. package/dist/commands/flywheel/k5-validate.js.map +0 -1
  174. package/dist/commands/flywheel/migrate-overlays.d.ts +0 -116
  175. package/dist/commands/flywheel/migrate-overlays.d.ts.map +0 -1
  176. package/dist/commands/flywheel/migrate-overlays.js +0 -792
  177. package/dist/commands/flywheel/migrate-overlays.js.map +0 -1
  178. package/dist/commands/flywheel/ping.d.ts +0 -21
  179. package/dist/commands/flywheel/ping.d.ts.map +0 -1
  180. package/dist/commands/flywheel/ping.js +0 -79
  181. package/dist/commands/flywheel/ping.js.map +0 -1
  182. package/dist/commands/flywheel/sanitize-persona-output.d.ts +0 -38
  183. package/dist/commands/flywheel/sanitize-persona-output.d.ts.map +0 -1
  184. package/dist/commands/flywheel/sanitize-persona-output.js +0 -102
  185. package/dist/commands/flywheel/sanitize-persona-output.js.map +0 -1
  186. package/dist/commands/flywheel/session-start.d.ts +0 -26
  187. package/dist/commands/flywheel/session-start.d.ts.map +0 -1
  188. package/dist/commands/flywheel/session-start.js +0 -119
  189. package/dist/commands/flywheel/session-start.js.map +0 -1
  190. package/dist/commands/hermes-kg-hook.d.ts +0 -36
  191. package/dist/commands/hermes-kg-hook.d.ts.map +0 -1
  192. package/dist/commands/hermes-kg-hook.js +0 -80
  193. package/dist/commands/hermes-kg-hook.js.map +0 -1
  194. package/dist/commands/hermes.d.ts +0 -46
  195. package/dist/commands/hermes.d.ts.map +0 -1
  196. package/dist/commands/hermes.js +0 -320
  197. package/dist/commands/hermes.js.map +0 -1
  198. package/dist/commands/host-cp.d.ts +0 -216
  199. package/dist/commands/host-cp.d.ts.map +0 -1
  200. package/dist/commands/host-cp.js +0 -913
  201. package/dist/commands/host-cp.js.map +0 -1
  202. package/dist/commands/implode.d.ts +0 -86
  203. package/dist/commands/implode.d.ts.map +0 -1
  204. package/dist/commands/implode.js +0 -468
  205. package/dist/commands/implode.js.map +0 -1
  206. package/dist/commands/init.d.ts +0 -86
  207. package/dist/commands/init.d.ts.map +0 -1
  208. package/dist/commands/init.js +0 -357
  209. package/dist/commands/init.js.map +0 -1
  210. package/dist/commands/install.d.ts +0 -22
  211. package/dist/commands/install.d.ts.map +0 -1
  212. package/dist/commands/install.js +0 -203
  213. package/dist/commands/install.js.map +0 -1
  214. package/dist/commands/keys-list-json.d.ts +0 -55
  215. package/dist/commands/keys-list-json.d.ts.map +0 -1
  216. package/dist/commands/keys-list-json.js +0 -54
  217. package/dist/commands/keys-list-json.js.map +0 -1
  218. package/dist/commands/keys.d.ts +0 -26
  219. package/dist/commands/keys.d.ts.map +0 -1
  220. package/dist/commands/keys.js +0 -157
  221. package/dist/commands/keys.js.map +0 -1
  222. package/dist/commands/kg-build.d.ts +0 -80
  223. package/dist/commands/kg-build.d.ts.map +0 -1
  224. package/dist/commands/kg-build.js +0 -282
  225. package/dist/commands/kg-build.js.map +0 -1
  226. package/dist/commands/kg-classify.d.ts +0 -30
  227. package/dist/commands/kg-classify.d.ts.map +0 -1
  228. package/dist/commands/kg-classify.js +0 -88
  229. package/dist/commands/kg-classify.js.map +0 -1
  230. package/dist/commands/kg-doctor.d.ts +0 -76
  231. package/dist/commands/kg-doctor.d.ts.map +0 -1
  232. package/dist/commands/kg-doctor.js +0 -262
  233. package/dist/commands/kg-doctor.js.map +0 -1
  234. package/dist/commands/kg-install-hook.d.ts +0 -20
  235. package/dist/commands/kg-install-hook.d.ts.map +0 -1
  236. package/dist/commands/kg-install-hook.js +0 -208
  237. package/dist/commands/kg-install-hook.js.map +0 -1
  238. package/dist/commands/kg-mirror.d.ts +0 -72
  239. package/dist/commands/kg-mirror.d.ts.map +0 -1
  240. package/dist/commands/kg-mirror.js +0 -397
  241. package/dist/commands/kg-mirror.js.map +0 -1
  242. package/dist/commands/kg-savings.d.ts +0 -20
  243. package/dist/commands/kg-savings.d.ts.map +0 -1
  244. package/dist/commands/kg-savings.js +0 -77
  245. package/dist/commands/kg-savings.js.map +0 -1
  246. package/dist/commands/kg-service-container.d.ts +0 -68
  247. package/dist/commands/kg-service-container.d.ts.map +0 -1
  248. package/dist/commands/kg-service-container.js +0 -191
  249. package/dist/commands/kg-service-container.js.map +0 -1
  250. package/dist/commands/kg-status.d.ts +0 -59
  251. package/dist/commands/kg-status.d.ts.map +0 -1
  252. package/dist/commands/kg-status.js +0 -344
  253. package/dist/commands/kg-status.js.map +0 -1
  254. package/dist/commands/kg-uninstall-hook.d.ts +0 -12
  255. package/dist/commands/kg-uninstall-hook.d.ts.map +0 -1
  256. package/dist/commands/kg-uninstall-hook.js +0 -121
  257. package/dist/commands/kg-uninstall-hook.js.map +0 -1
  258. package/dist/commands/kg-watch.d.ts +0 -49
  259. package/dist/commands/kg-watch.d.ts.map +0 -1
  260. package/dist/commands/kg-watch.js +0 -172
  261. package/dist/commands/kg-watch.js.map +0 -1
  262. package/dist/commands/lanes-list-json.d.ts +0 -69
  263. package/dist/commands/lanes-list-json.d.ts.map +0 -1
  264. package/dist/commands/lanes-list-json.js +0 -42
  265. package/dist/commands/lanes-list-json.js.map +0 -1
  266. package/dist/commands/lanes.d.ts +0 -18
  267. package/dist/commands/lanes.d.ts.map +0 -1
  268. package/dist/commands/lanes.js +0 -133
  269. package/dist/commands/lanes.js.map +0 -1
  270. package/dist/commands/list.d.ts +0 -33
  271. package/dist/commands/list.d.ts.map +0 -1
  272. package/dist/commands/list.js +0 -87
  273. package/dist/commands/list.js.map +0 -1
  274. package/dist/commands/logs.d.ts +0 -52
  275. package/dist/commands/logs.d.ts.map +0 -1
  276. package/dist/commands/logs.js +0 -180
  277. package/dist/commands/logs.js.map +0 -1
  278. package/dist/commands/mcp/add.d.ts +0 -9
  279. package/dist/commands/mcp/add.d.ts.map +0 -1
  280. package/dist/commands/mcp/add.js +0 -87
  281. package/dist/commands/mcp/add.js.map +0 -1
  282. package/dist/commands/mcp/client.d.ts +0 -60
  283. package/dist/commands/mcp/client.d.ts.map +0 -1
  284. package/dist/commands/mcp/client.js +0 -70
  285. package/dist/commands/mcp/client.js.map +0 -1
  286. package/dist/commands/mcp/complete.d.ts +0 -36
  287. package/dist/commands/mcp/complete.d.ts.map +0 -1
  288. package/dist/commands/mcp/complete.js +0 -66
  289. package/dist/commands/mcp/complete.js.map +0 -1
  290. package/dist/commands/mcp/import-discovery.d.ts +0 -25
  291. package/dist/commands/mcp/import-discovery.d.ts.map +0 -1
  292. package/dist/commands/mcp/import-discovery.js +0 -135
  293. package/dist/commands/mcp/import-discovery.js.map +0 -1
  294. package/dist/commands/mcp/import-validate.d.ts +0 -15
  295. package/dist/commands/mcp/import-validate.d.ts.map +0 -1
  296. package/dist/commands/mcp/import-validate.js +0 -55
  297. package/dist/commands/mcp/import-validate.js.map +0 -1
  298. package/dist/commands/mcp/import.d.ts +0 -12
  299. package/dist/commands/mcp/import.d.ts.map +0 -1
  300. package/dist/commands/mcp/import.js +0 -126
  301. package/dist/commands/mcp/import.js.map +0 -1
  302. package/dist/commands/mcp/index.d.ts +0 -14
  303. package/dist/commands/mcp/index.d.ts.map +0 -1
  304. package/dist/commands/mcp/index.js +0 -39
  305. package/dist/commands/mcp/index.js.map +0 -1
  306. package/dist/commands/mcp/install-shared.d.ts +0 -24
  307. package/dist/commands/mcp/install-shared.d.ts.map +0 -1
  308. package/dist/commands/mcp/install-shared.js +0 -42
  309. package/dist/commands/mcp/install-shared.js.map +0 -1
  310. package/dist/commands/mcp/install.d.ts +0 -20
  311. package/dist/commands/mcp/install.d.ts.map +0 -1
  312. package/dist/commands/mcp/install.js +0 -59
  313. package/dist/commands/mcp/install.js.map +0 -1
  314. package/dist/commands/mcp/list.d.ts +0 -6
  315. package/dist/commands/mcp/list.d.ts.map +0 -1
  316. package/dist/commands/mcp/list.js +0 -56
  317. package/dist/commands/mcp/list.js.map +0 -1
  318. package/dist/commands/mcp/login.d.ts +0 -6
  319. package/dist/commands/mcp/login.d.ts.map +0 -1
  320. package/dist/commands/mcp/login.js +0 -38
  321. package/dist/commands/mcp/login.js.map +0 -1
  322. package/dist/commands/mcp/remove.d.ts +0 -6
  323. package/dist/commands/mcp/remove.d.ts.map +0 -1
  324. package/dist/commands/mcp/remove.js +0 -21
  325. package/dist/commands/mcp/remove.js.map +0 -1
  326. package/dist/commands/mcp/revoke.d.ts +0 -11
  327. package/dist/commands/mcp/revoke.d.ts.map +0 -1
  328. package/dist/commands/mcp/revoke.js +0 -51
  329. package/dist/commands/mcp/revoke.js.map +0 -1
  330. package/dist/commands/mcp/serve.d.ts +0 -23
  331. package/dist/commands/mcp/serve.d.ts.map +0 -1
  332. package/dist/commands/mcp/serve.js +0 -55
  333. package/dist/commands/mcp/serve.js.map +0 -1
  334. package/dist/commands/mcp/status.d.ts +0 -6
  335. package/dist/commands/mcp/status.d.ts.map +0 -1
  336. package/dist/commands/mcp/status.js +0 -57
  337. package/dist/commands/mcp/status.js.map +0 -1
  338. package/dist/commands/mcp/uninstall.d.ts +0 -20
  339. package/dist/commands/mcp/uninstall.d.ts.map +0 -1
  340. package/dist/commands/mcp/uninstall.js +0 -60
  341. package/dist/commands/mcp/uninstall.js.map +0 -1
  342. package/dist/commands/memory/_paths.d.ts +0 -25
  343. package/dist/commands/memory/_paths.d.ts.map +0 -1
  344. package/dist/commands/memory/_paths.js +0 -57
  345. package/dist/commands/memory/_paths.js.map +0 -1
  346. package/dist/commands/memory/bridge.d.ts +0 -57
  347. package/dist/commands/memory/bridge.d.ts.map +0 -1
  348. package/dist/commands/memory/bridge.js +0 -152
  349. package/dist/commands/memory/bridge.js.map +0 -1
  350. package/dist/commands/memory/index.d.ts +0 -20
  351. package/dist/commands/memory/index.d.ts.map +0 -1
  352. package/dist/commands/memory/index.js +0 -47
  353. package/dist/commands/memory/index.js.map +0 -1
  354. package/dist/commands/memory/install-hooks.d.ts +0 -22
  355. package/dist/commands/memory/install-hooks.d.ts.map +0 -1
  356. package/dist/commands/memory/install-hooks.js +0 -156
  357. package/dist/commands/memory/install-hooks.js.map +0 -1
  358. package/dist/commands/memory/install.d.ts +0 -57
  359. package/dist/commands/memory/install.d.ts.map +0 -1
  360. package/dist/commands/memory/install.js +0 -114
  361. package/dist/commands/memory/install.js.map +0 -1
  362. package/dist/commands/memory/logs.d.ts +0 -19
  363. package/dist/commands/memory/logs.d.ts.map +0 -1
  364. package/dist/commands/memory/logs.js +0 -50
  365. package/dist/commands/memory/logs.js.map +0 -1
  366. package/dist/commands/memory/mode.d.ts +0 -47
  367. package/dist/commands/memory/mode.d.ts.map +0 -1
  368. package/dist/commands/memory/mode.js +0 -185
  369. package/dist/commands/memory/mode.js.map +0 -1
  370. package/dist/commands/memory/reclassify.d.ts +0 -56
  371. package/dist/commands/memory/reclassify.d.ts.map +0 -1
  372. package/dist/commands/memory/reclassify.js +0 -177
  373. package/dist/commands/memory/reclassify.js.map +0 -1
  374. package/dist/commands/memory/secret.d.ts +0 -16
  375. package/dist/commands/memory/secret.d.ts.map +0 -1
  376. package/dist/commands/memory/secret.js +0 -80
  377. package/dist/commands/memory/secret.js.map +0 -1
  378. package/dist/commands/memory/start.d.ts +0 -25
  379. package/dist/commands/memory/start.d.ts.map +0 -1
  380. package/dist/commands/memory/start.js +0 -83
  381. package/dist/commands/memory/start.js.map +0 -1
  382. package/dist/commands/memory/stats.d.ts +0 -69
  383. package/dist/commands/memory/stats.d.ts.map +0 -1
  384. package/dist/commands/memory/stats.js +0 -164
  385. package/dist/commands/memory/stats.js.map +0 -1
  386. package/dist/commands/memory/status.d.ts +0 -45
  387. package/dist/commands/memory/status.d.ts.map +0 -1
  388. package/dist/commands/memory/status.js +0 -134
  389. package/dist/commands/memory/status.js.map +0 -1
  390. package/dist/commands/memory/stop.d.ts +0 -13
  391. package/dist/commands/memory/stop.d.ts.map +0 -1
  392. package/dist/commands/memory/stop.js +0 -52
  393. package/dist/commands/memory/stop.js.map +0 -1
  394. package/dist/commands/memory/uninstall.d.ts +0 -19
  395. package/dist/commands/memory/uninstall.d.ts.map +0 -1
  396. package/dist/commands/memory/uninstall.js +0 -60
  397. package/dist/commands/memory/uninstall.js.map +0 -1
  398. package/dist/commands/memory-service-container.d.ts +0 -130
  399. package/dist/commands/memory-service-container.d.ts.map +0 -1
  400. package/dist/commands/memory-service-container.js +0 -251
  401. package/dist/commands/memory-service-container.js.map +0 -1
  402. package/dist/commands/observe.d.ts +0 -9
  403. package/dist/commands/observe.d.ts.map +0 -1
  404. package/dist/commands/observe.js +0 -42
  405. package/dist/commands/observe.js.map +0 -1
  406. package/dist/commands/plans-list-json.d.ts +0 -77
  407. package/dist/commands/plans-list-json.d.ts.map +0 -1
  408. package/dist/commands/plans-list-json.js +0 -61
  409. package/dist/commands/plans-list-json.js.map +0 -1
  410. package/dist/commands/plans.d.ts +0 -3
  411. package/dist/commands/plans.d.ts.map +0 -1
  412. package/dist/commands/plans.js +0 -221
  413. package/dist/commands/plans.js.map +0 -1
  414. package/dist/commands/policy-check.d.ts +0 -14
  415. package/dist/commands/policy-check.d.ts.map +0 -1
  416. package/dist/commands/policy-check.js +0 -76
  417. package/dist/commands/policy-check.js.map +0 -1
  418. package/dist/commands/pr.d.ts +0 -17
  419. package/dist/commands/pr.d.ts.map +0 -1
  420. package/dist/commands/pr.js +0 -148
  421. package/dist/commands/pr.js.map +0 -1
  422. package/dist/commands/ps.d.ts +0 -57
  423. package/dist/commands/ps.d.ts.map +0 -1
  424. package/dist/commands/ps.js +0 -202
  425. package/dist/commands/ps.js.map +0 -1
  426. package/dist/commands/refresh-helpers.d.ts +0 -25
  427. package/dist/commands/refresh-helpers.d.ts.map +0 -1
  428. package/dist/commands/refresh-helpers.js +0 -56
  429. package/dist/commands/refresh-helpers.js.map +0 -1
  430. package/dist/commands/refresh.d.ts +0 -23
  431. package/dist/commands/refresh.d.ts.map +0 -1
  432. package/dist/commands/refresh.js +0 -237
  433. package/dist/commands/refresh.js.map +0 -1
  434. package/dist/commands/rekey.d.ts +0 -84
  435. package/dist/commands/rekey.d.ts.map +0 -1
  436. package/dist/commands/rekey.js +0 -209
  437. package/dist/commands/rekey.js.map +0 -1
  438. package/dist/commands/repos-list-json.d.ts +0 -58
  439. package/dist/commands/repos-list-json.d.ts.map +0 -1
  440. package/dist/commands/repos-list-json.js +0 -45
  441. package/dist/commands/repos-list-json.js.map +0 -1
  442. package/dist/commands/repos.d.ts +0 -11
  443. package/dist/commands/repos.d.ts.map +0 -1
  444. package/dist/commands/repos.js +0 -102
  445. package/dist/commands/repos.js.map +0 -1
  446. package/dist/commands/restart.d.ts +0 -18
  447. package/dist/commands/restart.d.ts.map +0 -1
  448. package/dist/commands/restart.js +0 -113
  449. package/dist/commands/restart.js.map +0 -1
  450. package/dist/commands/resume.d.ts +0 -63
  451. package/dist/commands/resume.d.ts.map +0 -1
  452. package/dist/commands/resume.js +0 -174
  453. package/dist/commands/resume.js.map +0 -1
  454. package/dist/commands/runbooks.d.ts +0 -45
  455. package/dist/commands/runbooks.d.ts.map +0 -1
  456. package/dist/commands/runbooks.js +0 -313
  457. package/dist/commands/runbooks.js.map +0 -1
  458. package/dist/commands/seed.d.ts +0 -27
  459. package/dist/commands/seed.d.ts.map +0 -1
  460. package/dist/commands/seed.js +0 -303
  461. package/dist/commands/seed.js.map +0 -1
  462. package/dist/commands/services-tls.d.ts +0 -120
  463. package/dist/commands/services-tls.d.ts.map +0 -1
  464. package/dist/commands/services-tls.js +0 -489
  465. package/dist/commands/services-tls.js.map +0 -1
  466. package/dist/commands/services.d.ts +0 -218
  467. package/dist/commands/services.d.ts.map +0 -1
  468. package/dist/commands/services.js +0 -830
  469. package/dist/commands/services.js.map +0 -1
  470. package/dist/commands/setup-linux-gate.d.ts +0 -26
  471. package/dist/commands/setup-linux-gate.d.ts.map +0 -1
  472. package/dist/commands/setup-linux-gate.js +0 -40
  473. package/dist/commands/setup-linux-gate.js.map +0 -1
  474. package/dist/commands/setup-metrics.d.ts +0 -26
  475. package/dist/commands/setup-metrics.d.ts.map +0 -1
  476. package/dist/commands/setup-metrics.js +0 -56
  477. package/dist/commands/setup-metrics.js.map +0 -1
  478. package/dist/commands/setup-phase-5a-skill-source.d.ts +0 -84
  479. package/dist/commands/setup-phase-5a-skill-source.d.ts.map +0 -1
  480. package/dist/commands/setup-phase-5a-skill-source.js +0 -259
  481. package/dist/commands/setup-phase-5a-skill-source.js.map +0 -1
  482. package/dist/commands/setup-phase-5b-project-sweep.d.ts +0 -38
  483. package/dist/commands/setup-phase-5b-project-sweep.d.ts.map +0 -1
  484. package/dist/commands/setup-phase-5b-project-sweep.js +0 -175
  485. package/dist/commands/setup-phase-5b-project-sweep.js.map +0 -1
  486. package/dist/commands/setup-phase-8-kg-hook.d.ts +0 -48
  487. package/dist/commands/setup-phase-8-kg-hook.d.ts.map +0 -1
  488. package/dist/commands/setup-phase-8-kg-hook.js +0 -93
  489. package/dist/commands/setup-phase-8-kg-hook.js.map +0 -1
  490. package/dist/commands/setup-phase-9-memory-bridge.d.ts +0 -36
  491. package/dist/commands/setup-phase-9-memory-bridge.d.ts.map +0 -1
  492. package/dist/commands/setup-phase-9-memory-bridge.js +0 -59
  493. package/dist/commands/setup-phase-9-memory-bridge.js.map +0 -1
  494. package/dist/commands/setup.d.ts +0 -231
  495. package/dist/commands/setup.d.ts.map +0 -1
  496. package/dist/commands/setup.js +0 -1374
  497. package/dist/commands/setup.js.map +0 -1
  498. package/dist/commands/skills-100x.d.ts +0 -34
  499. package/dist/commands/skills-100x.d.ts.map +0 -1
  500. package/dist/commands/skills-100x.js +0 -405
  501. package/dist/commands/skills-100x.js.map +0 -1
  502. package/dist/commands/skills-doctor.d.ts +0 -14
  503. package/dist/commands/skills-doctor.d.ts.map +0 -1
  504. package/dist/commands/skills-doctor.js +0 -126
  505. package/dist/commands/skills-doctor.js.map +0 -1
  506. package/dist/commands/skills-hook.d.ts +0 -19
  507. package/dist/commands/skills-hook.d.ts.map +0 -1
  508. package/dist/commands/skills-hook.js +0 -99
  509. package/dist/commands/skills-hook.js.map +0 -1
  510. package/dist/commands/skills-install-model-router.d.ts +0 -20
  511. package/dist/commands/skills-install-model-router.d.ts.map +0 -1
  512. package/dist/commands/skills-install-model-router.js +0 -55
  513. package/dist/commands/skills-install-model-router.js.map +0 -1
  514. package/dist/commands/skills-migrate-back.d.ts +0 -21
  515. package/dist/commands/skills-migrate-back.d.ts.map +0 -1
  516. package/dist/commands/skills-migrate-back.js +0 -222
  517. package/dist/commands/skills-migrate-back.js.map +0 -1
  518. package/dist/commands/skills-migrate-hooks-back.d.ts +0 -19
  519. package/dist/commands/skills-migrate-hooks-back.d.ts.map +0 -1
  520. package/dist/commands/skills-migrate-hooks-back.js +0 -83
  521. package/dist/commands/skills-migrate-hooks-back.js.map +0 -1
  522. package/dist/commands/skills-migrate-hooks.d.ts +0 -40
  523. package/dist/commands/skills-migrate-hooks.d.ts.map +0 -1
  524. package/dist/commands/skills-migrate-hooks.js +0 -178
  525. package/dist/commands/skills-migrate-hooks.js.map +0 -1
  526. package/dist/commands/skills-migrate.d.ts +0 -33
  527. package/dist/commands/skills-migrate.d.ts.map +0 -1
  528. package/dist/commands/skills-migrate.js +0 -216
  529. package/dist/commands/skills-migrate.js.map +0 -1
  530. package/dist/commands/skills-onboard.d.ts +0 -26
  531. package/dist/commands/skills-onboard.d.ts.map +0 -1
  532. package/dist/commands/skills-onboard.js +0 -230
  533. package/dist/commands/skills-onboard.js.map +0 -1
  534. package/dist/commands/skills-shadow-backups.d.ts +0 -15
  535. package/dist/commands/skills-shadow-backups.d.ts.map +0 -1
  536. package/dist/commands/skills-shadow-backups.js +0 -132
  537. package/dist/commands/skills-shadow-backups.js.map +0 -1
  538. package/dist/commands/skills-source.d.ts +0 -61
  539. package/dist/commands/skills-source.d.ts.map +0 -1
  540. package/dist/commands/skills-source.js +0 -895
  541. package/dist/commands/skills-source.js.map +0 -1
  542. package/dist/commands/skills.d.ts +0 -59
  543. package/dist/commands/skills.d.ts.map +0 -1
  544. package/dist/commands/skills.js +0 -461
  545. package/dist/commands/skills.js.map +0 -1
  546. package/dist/commands/status.d.ts +0 -65
  547. package/dist/commands/status.d.ts.map +0 -1
  548. package/dist/commands/status.js +0 -249
  549. package/dist/commands/status.js.map +0 -1
  550. package/dist/commands/stop.d.ts +0 -10
  551. package/dist/commands/stop.d.ts.map +0 -1
  552. package/dist/commands/stop.js +0 -17
  553. package/dist/commands/stop.js.map +0 -1
  554. package/dist/commands/substrate-audit-log.d.ts +0 -51
  555. package/dist/commands/substrate-audit-log.d.ts.map +0 -1
  556. package/dist/commands/substrate-audit-log.js +0 -161
  557. package/dist/commands/substrate-audit-log.js.map +0 -1
  558. package/dist/commands/substrate.d.ts +0 -87
  559. package/dist/commands/substrate.d.ts.map +0 -1
  560. package/dist/commands/substrate.js +0 -194
  561. package/dist/commands/substrate.js.map +0 -1
  562. package/dist/commands/update.d.ts +0 -89
  563. package/dist/commands/update.d.ts.map +0 -1
  564. package/dist/commands/update.js +0 -331
  565. package/dist/commands/update.js.map +0 -1
  566. package/dist/commands/upgrade-history.d.ts +0 -15
  567. package/dist/commands/upgrade-history.d.ts.map +0 -1
  568. package/dist/commands/upgrade-history.js +0 -34
  569. package/dist/commands/upgrade-history.js.map +0 -1
  570. package/dist/commands/upgrade-lock.d.ts +0 -93
  571. package/dist/commands/upgrade-lock.d.ts.map +0 -1
  572. package/dist/commands/upgrade-lock.js +0 -225
  573. package/dist/commands/upgrade-lock.js.map +0 -1
  574. package/dist/commands/upgrade-log.d.ts +0 -86
  575. package/dist/commands/upgrade-log.d.ts.map +0 -1
  576. package/dist/commands/upgrade-log.js +0 -146
  577. package/dist/commands/upgrade-log.js.map +0 -1
  578. package/dist/commands/upgrade.d.ts +0 -445
  579. package/dist/commands/upgrade.d.ts.map +0 -1
  580. package/dist/commands/upgrade.js +0 -1718
  581. package/dist/commands/upgrade.js.map +0 -1
  582. package/dist/commands/workspace-list-json.d.ts +0 -73
  583. package/dist/commands/workspace-list-json.d.ts.map +0 -1
  584. package/dist/commands/workspace-list-json.js +0 -59
  585. package/dist/commands/workspace-list-json.js.map +0 -1
  586. package/dist/commands/workspace.d.ts +0 -23
  587. package/dist/commands/workspace.d.ts.map +0 -1
  588. package/dist/commands/workspace.js +0 -203
  589. package/dist/commands/workspace.js.map +0 -1
  590. package/dist/commands/world-snapshot.d.ts +0 -32
  591. package/dist/commands/world-snapshot.d.ts.map +0 -1
  592. package/dist/commands/world-snapshot.js +0 -531
  593. package/dist/commands/world-snapshot.js.map +0 -1
  594. package/dist/commands/world-upgrade.d.ts +0 -33
  595. package/dist/commands/world-upgrade.d.ts.map +0 -1
  596. package/dist/commands/world-upgrade.js +0 -82
  597. package/dist/commands/world-upgrade.js.map +0 -1
  598. package/dist/commands/world.d.ts +0 -12
  599. package/dist/commands/world.d.ts.map +0 -1
  600. package/dist/commands/world.js +0 -18
  601. package/dist/commands/world.js.map +0 -1
  602. package/dist/commands/worldspec/compile.d.ts +0 -20
  603. package/dist/commands/worldspec/compile.d.ts.map +0 -1
  604. package/dist/commands/worldspec/compile.js +0 -130
  605. package/dist/commands/worldspec/compile.js.map +0 -1
  606. package/dist/commands/worldspec/index.d.ts +0 -12
  607. package/dist/commands/worldspec/index.d.ts.map +0 -1
  608. package/dist/commands/worldspec/index.js +0 -23
  609. package/dist/commands/worldspec/index.js.map +0 -1
  610. package/dist/commands/worldspec/init.d.ts +0 -15
  611. package/dist/commands/worldspec/init.d.ts.map +0 -1
  612. package/dist/commands/worldspec/init.js +0 -166
  613. package/dist/commands/worldspec/init.js.map +0 -1
  614. package/dist/commands/worldspec/schema.d.ts +0 -11
  615. package/dist/commands/worldspec/schema.d.ts.map +0 -1
  616. package/dist/commands/worldspec/schema.js +0 -55
  617. package/dist/commands/worldspec/schema.js.map +0 -1
  618. package/dist/commands/worldspec/validate.d.ts +0 -15
  619. package/dist/commands/worldspec/validate.d.ts.map +0 -1
  620. package/dist/commands/worldspec/validate.js +0 -66
  621. package/dist/commands/worldspec/validate.js.map +0 -1
  622. package/dist/commands/yolo.d.ts +0 -95
  623. package/dist/commands/yolo.d.ts.map +0 -1
  624. package/dist/commands/yolo.js +0 -377
  625. package/dist/commands/yolo.js.map +0 -1
  626. package/dist/context.d.ts +0 -30
  627. package/dist/context.d.ts.map +0 -1
  628. package/dist/context.js +0 -56
  629. package/dist/context.js.map +0 -1
  630. package/dist/docker-host.d.ts +0 -18
  631. package/dist/docker-host.d.ts.map +0 -1
  632. package/dist/docker-host.js +0 -17
  633. package/dist/docker-host.js.map +0 -1
  634. package/dist/exit-codes.d.ts +0 -67
  635. package/dist/exit-codes.d.ts.map +0 -1
  636. package/dist/exit-codes.js +0 -67
  637. package/dist/exit-codes.js.map +0 -1
  638. package/dist/from-manifest.d.ts +0 -53
  639. package/dist/from-manifest.d.ts.map +0 -1
  640. package/dist/from-manifest.js +0 -95
  641. package/dist/from-manifest.js.map +0 -1
  642. package/dist/image-presence.d.ts +0 -40
  643. package/dist/image-presence.d.ts.map +0 -1
  644. package/dist/image-presence.js +0 -39
  645. package/dist/image-presence.js.map +0 -1
  646. package/dist/index.d.ts +0 -9
  647. package/dist/index.d.ts.map +0 -1
  648. package/dist/install-root.d.ts +0 -74
  649. package/dist/install-root.d.ts.map +0 -1
  650. package/dist/install-root.js +0 -98
  651. package/dist/install-root.js.map +0 -1
  652. package/dist/lib/anthropic-base-url-file.d.ts +0 -37
  653. package/dist/lib/anthropic-base-url-file.d.ts.map +0 -1
  654. package/dist/lib/anthropic-base-url-file.js +0 -46
  655. package/dist/lib/anthropic-base-url-file.js.map +0 -1
  656. package/dist/lib/auth-backend.d.ts +0 -168
  657. package/dist/lib/auth-backend.d.ts.map +0 -1
  658. package/dist/lib/auth-backend.js +0 -172
  659. package/dist/lib/auth-backend.js.map +0 -1
  660. package/dist/lib/auth-list-cache.d.ts +0 -67
  661. package/dist/lib/auth-list-cache.d.ts.map +0 -1
  662. package/dist/lib/auth-list-cache.js +0 -84
  663. package/dist/lib/auth-list-cache.js.map +0 -1
  664. package/dist/lib/auth-list.d.ts +0 -107
  665. package/dist/lib/auth-list.d.ts.map +0 -1
  666. package/dist/lib/auth-list.js +0 -123
  667. package/dist/lib/auth-list.js.map +0 -1
  668. package/dist/lib/auth-login.d.ts +0 -92
  669. package/dist/lib/auth-login.d.ts.map +0 -1
  670. package/dist/lib/auth-login.js +0 -124
  671. package/dist/lib/auth-login.js.map +0 -1
  672. package/dist/lib/auth-mutator-backend.d.ts +0 -54
  673. package/dist/lib/auth-mutator-backend.d.ts.map +0 -1
  674. package/dist/lib/auth-mutator-backend.js +0 -62
  675. package/dist/lib/auth-mutator-backend.js.map +0 -1
  676. package/dist/lib/auth-refresh-kubernetes.d.ts +0 -65
  677. package/dist/lib/auth-refresh-kubernetes.d.ts.map +0 -1
  678. package/dist/lib/auth-refresh-kubernetes.js +0 -125
  679. package/dist/lib/auth-refresh-kubernetes.js.map +0 -1
  680. package/dist/lib/auth-remote.d.ts +0 -172
  681. package/dist/lib/auth-remote.d.ts.map +0 -1
  682. package/dist/lib/auth-remote.js +0 -394
  683. package/dist/lib/auth-remote.js.map +0 -1
  684. package/dist/lib/bootstrap-kubernetes.d.ts +0 -164
  685. package/dist/lib/bootstrap-kubernetes.d.ts.map +0 -1
  686. package/dist/lib/bootstrap-kubernetes.js +0 -1002
  687. package/dist/lib/bootstrap-kubernetes.js.map +0 -1
  688. package/dist/lib/build-if-stale.d.ts +0 -33
  689. package/dist/lib/build-if-stale.d.ts.map +0 -1
  690. package/dist/lib/build-if-stale.js +0 -156
  691. package/dist/lib/build-if-stale.js.map +0 -1
  692. package/dist/lib/bundle-freshness.d.ts +0 -57
  693. package/dist/lib/bundle-freshness.d.ts.map +0 -1
  694. package/dist/lib/bundle-freshness.js +0 -223
  695. package/dist/lib/bundle-freshness.js.map +0 -1
  696. package/dist/lib/bundle-source.d.ts +0 -52
  697. package/dist/lib/bundle-source.d.ts.map +0 -1
  698. package/dist/lib/bundle-source.js +0 -83
  699. package/dist/lib/bundle-source.js.map +0 -1
  700. package/dist/lib/cf-access-token.d.ts +0 -32
  701. package/dist/lib/cf-access-token.d.ts.map +0 -1
  702. package/dist/lib/cf-access-token.js +0 -51
  703. package/dist/lib/cf-access-token.js.map +0 -1
  704. package/dist/lib/completion-generator.d.ts +0 -107
  705. package/dist/lib/completion-generator.d.ts.map +0 -1
  706. package/dist/lib/completion-generator.js +0 -226
  707. package/dist/lib/completion-generator.js.map +0 -1
  708. package/dist/lib/config.d.ts +0 -114
  709. package/dist/lib/config.d.ts.map +0 -1
  710. package/dist/lib/config.js +0 -246
  711. package/dist/lib/config.js.map +0 -1
  712. package/dist/lib/flywheel-probes.d.ts +0 -58
  713. package/dist/lib/flywheel-probes.d.ts.map +0 -1
  714. package/dist/lib/flywheel-probes.js +0 -163
  715. package/dist/lib/flywheel-probes.js.map +0 -1
  716. package/dist/lib/health-probes.d.ts +0 -267
  717. package/dist/lib/health-probes.d.ts.map +0 -1
  718. package/dist/lib/health-probes.js +0 -933
  719. package/dist/lib/health-probes.js.map +0 -1
  720. package/dist/lib/help-groups.d.ts +0 -36
  721. package/dist/lib/help-groups.d.ts.map +0 -1
  722. package/dist/lib/help-groups.js +0 -124
  723. package/dist/lib/help-groups.js.map +0 -1
  724. package/dist/lib/host-side-proxy.d.ts +0 -67
  725. package/dist/lib/host-side-proxy.d.ts.map +0 -1
  726. package/dist/lib/host-side-proxy.js +0 -177
  727. package/dist/lib/host-side-proxy.js.map +0 -1
  728. package/dist/lib/instrumentation.d.ts +0 -85
  729. package/dist/lib/instrumentation.d.ts.map +0 -1
  730. package/dist/lib/instrumentation.js +0 -104
  731. package/dist/lib/instrumentation.js.map +0 -1
  732. package/dist/lib/k8s-bootstrap.d.ts +0 -126
  733. package/dist/lib/k8s-bootstrap.d.ts.map +0 -1
  734. package/dist/lib/k8s-bootstrap.js +0 -218
  735. package/dist/lib/k8s-bootstrap.js.map +0 -1
  736. package/dist/lib/k8s-context-discovery.d.ts +0 -80
  737. package/dist/lib/k8s-context-discovery.d.ts.map +0 -1
  738. package/dist/lib/k8s-context-discovery.js +0 -102
  739. package/dist/lib/k8s-context-discovery.js.map +0 -1
  740. package/dist/lib/k8s-secret-render.d.ts +0 -141
  741. package/dist/lib/k8s-secret-render.d.ts.map +0 -1
  742. package/dist/lib/k8s-secret-render.js +0 -318
  743. package/dist/lib/k8s-secret-render.js.map +0 -1
  744. package/dist/lib/kg-caps.d.ts +0 -19
  745. package/dist/lib/kg-caps.d.ts.map +0 -1
  746. package/dist/lib/kg-caps.js +0 -19
  747. package/dist/lib/kg-caps.js.map +0 -1
  748. package/dist/lib/kubectl-context.d.ts +0 -87
  749. package/dist/lib/kubectl-context.d.ts.map +0 -1
  750. package/dist/lib/kubectl-context.js +0 -105
  751. package/dist/lib/kubectl-context.js.map +0 -1
  752. package/dist/lib/kubectl-wrap.d.ts +0 -65
  753. package/dist/lib/kubectl-wrap.d.ts.map +0 -1
  754. package/dist/lib/kubectl-wrap.js +0 -135
  755. package/dist/lib/kubectl-wrap.js.map +0 -1
  756. package/dist/lib/manifest-refresh.d.ts +0 -136
  757. package/dist/lib/manifest-refresh.d.ts.map +0 -1
  758. package/dist/lib/manifest-refresh.js +0 -298
  759. package/dist/lib/manifest-refresh.js.map +0 -1
  760. package/dist/lib/memory-host-process-migration.d.ts +0 -56
  761. package/dist/lib/memory-host-process-migration.d.ts.map +0 -1
  762. package/dist/lib/memory-host-process-migration.js +0 -156
  763. package/dist/lib/memory-host-process-migration.js.map +0 -1
  764. package/dist/lib/memory-secret.d.ts +0 -83
  765. package/dist/lib/memory-secret.d.ts.map +0 -1
  766. package/dist/lib/memory-secret.js +0 -147
  767. package/dist/lib/memory-secret.js.map +0 -1
  768. package/dist/lib/peripheral-registry.d.ts +0 -53
  769. package/dist/lib/peripheral-registry.d.ts.map +0 -1
  770. package/dist/lib/peripheral-registry.js +0 -73
  771. package/dist/lib/peripheral-registry.js.map +0 -1
  772. package/dist/lib/plans-client.d.ts +0 -69
  773. package/dist/lib/plans-client.d.ts.map +0 -1
  774. package/dist/lib/plans-client.js +0 -140
  775. package/dist/lib/plans-client.js.map +0 -1
  776. package/dist/lib/port-forward.d.ts +0 -168
  777. package/dist/lib/port-forward.d.ts.map +0 -1
  778. package/dist/lib/port-forward.js +0 -393
  779. package/dist/lib/port-forward.js.map +0 -1
  780. package/dist/lib/shell-rc.d.ts +0 -90
  781. package/dist/lib/shell-rc.d.ts.map +0 -1
  782. package/dist/lib/shell-rc.js +0 -91
  783. package/dist/lib/shell-rc.js.map +0 -1
  784. package/dist/lib/shim-generator.d.ts +0 -51
  785. package/dist/lib/shim-generator.d.ts.map +0 -1
  786. package/dist/lib/shim-generator.js +0 -88
  787. package/dist/lib/shim-generator.js.map +0 -1
  788. package/dist/lib/skills-apply-overlays.d.ts +0 -35
  789. package/dist/lib/skills-apply-overlays.d.ts.map +0 -1
  790. package/dist/lib/skills-apply-overlays.js +0 -243
  791. package/dist/lib/skills-apply-overlays.js.map +0 -1
  792. package/dist/lib/symlink-reconcile.d.ts +0 -32
  793. package/dist/lib/symlink-reconcile.d.ts.map +0 -1
  794. package/dist/lib/symlink-reconcile.js +0 -80
  795. package/dist/lib/symlink-reconcile.js.map +0 -1
  796. package/dist/lib/upgrade-check.d.ts +0 -60
  797. package/dist/lib/upgrade-check.d.ts.map +0 -1
  798. package/dist/lib/upgrade-check.js +0 -169
  799. package/dist/lib/upgrade-check.js.map +0 -1
  800. package/dist/lib/upgrade-kubernetes.d.ts +0 -193
  801. package/dist/lib/upgrade-kubernetes.d.ts.map +0 -1
  802. package/dist/lib/upgrade-kubernetes.js +0 -1014
  803. package/dist/lib/upgrade-kubernetes.js.map +0 -1
  804. package/dist/lib/world-mcp-register.d.ts +0 -98
  805. package/dist/lib/world-mcp-register.d.ts.map +0 -1
  806. package/dist/lib/world-mcp-register.js +0 -117
  807. package/dist/lib/world-mcp-register.js.map +0 -1
  808. package/dist/output.d.ts +0 -10
  809. package/dist/output.d.ts.map +0 -1
  810. package/dist/output.js +0 -31
  811. package/dist/output.js.map +0 -1
  812. package/dist/pleri-config.d.ts +0 -22
  813. package/dist/pleri-config.d.ts.map +0 -1
  814. package/dist/pleri-config.js +0 -42
  815. package/dist/pleri-config.js.map +0 -1
  816. package/dist/protocol-version.d.ts +0 -79
  817. package/dist/protocol-version.d.ts.map +0 -1
  818. package/dist/protocol-version.js +0 -133
  819. package/dist/protocol-version.js.map +0 -1
  820. package/dist/registry-allowlist.d.ts +0 -47
  821. package/dist/registry-allowlist.d.ts.map +0 -1
  822. package/dist/registry-allowlist.js +0 -67
  823. package/dist/registry-allowlist.js.map +0 -1
  824. package/dist/spawn/home-override.d.ts +0 -82
  825. package/dist/spawn/home-override.d.ts.map +0 -1
  826. package/dist/spawn/home-override.js +0 -107
  827. package/dist/spawn/home-override.js.map +0 -1
  828. package/host-cp/src/linear-sync.mjs +0 -43
@@ -1,1073 +0,0 @@
1
- /**
2
- * olam doctor — pass/fail host-health command.
3
- *
4
- * Phase A3 of olam-operator-onboarding-parity (original 5 probes) +
5
- * Phase C / C2 of olam-host-cp-k3s-prereqs (engine + colima probes) +
6
- * Phase 2 Phase A A5 (probeNodeMemory — kubernetes-only, D29).
7
- *
8
- * Probe layout — Decision 16 positional contract for `--json` consumers:
9
- *
10
- * On engine=docker (default):
11
- * 1. docker daemon — probeDockerDaemon (fast-fail gate)
12
- * 2. images — probeImagePresence (per-image)
13
- * 3. host-cp /health — probeHostCpHealth
14
- * 4. auth vault — probeAuthVault
15
- * 5. KG storage — probeKgStorage
16
- * 6. engine — probeEngine (NEW Phase C / C2)
17
- * 7. colima version — probeColimaVersion (NEW Phase C / C2)
18
- * 8. bundle freshness — probeBundleFreshness (NEW olam-world-bundle-freshness Phase A1)
19
- * Position 8 in docker mode is docker-only (per-MODE positional contract;
20
- * kubernetes mode keeps slot 8 = node memory). Non-gating: WARN when any
21
- * world's `/opt/olam/agent-stream/dist/` differs from the host's freshly
22
- * built `packages/intelligence/dist/agent-stream/`; PASS otherwise.
23
- * Silent in kubernetes substrate mode (worlds-as-pods don't support
24
- * `docker exec` reach-through; Phase C of the plan addresses cloud paths).
25
- *
26
- * On engine=kubernetes:
27
- * 1. api server — probeK8sApiReachable (slot replaced)
28
- * 2. images — probeK8sImagePresence (slot replaced)
29
- * 3. host-cp /health — probeHostCpHealth (unchanged)
30
- * 4. auth vault — probeAuthVault (unchanged)
31
- * 5. KG storage — probeKgStorage (unchanged)
32
- * 6. engine — probeEngine (unchanged)
33
- * 7. colima version — probeColimaVersion (unchanged)
34
- * 8. node memory — probeNodeMemory (NEW Phase 2 A5, D29)
35
- * Position 8 is kubernetes-only (D11 per-MODE positional contract).
36
- * Non-gating: WARN when free RAM <4 GiB; PASS otherwise.
37
- * Silent in docker/compose substrate mode.
38
- *
39
- * The `--json` payload's `probes[]` indexes are stable across engine swap:
40
- * consumers parsing `probes[0]` for "daemon-reachability" still see a
41
- * daemon-reachability probe; consumers parsing `probes[5]` for engine
42
- * identity see it regardless of which runtime is active.
43
- *
44
- * Exit code:
45
- * - 0 on all PASS
46
- * - 0 on PASS+WARN (WARN doesn't block — Colima 0.10.x is a hint)
47
- * - 1 on any FAIL
48
- *
49
- * Output format:
50
- * - `✓` / `⚠` / `✗` icon per row (green / yellow / red).
51
- * - Indented detail under WARN/FAIL.
52
- * - `--json` emits the same probe array (canonical positional shape).
53
- */
54
- import pc from 'picocolors';
55
- import { probeDockerDaemon, probeComposePlugin, probeImagePresence, probeHostCpHealth, probeAuthVault, probeKgStorage, probeEngine, probeColimaVersion, probeK8sApiReachable, probeK8sImagePresence, defaultDetectK8sClusterType, buildDockerSocketRemedy, } from '../lib/health-probes.js';
56
- import { probeBundleFreshness } from '../lib/bundle-freshness.js';
57
- import { printError, printSuccess, printWarning, printHeader } from '../output.js';
58
- import { kubectlWrap } from '../lib/kubectl-wrap.js';
59
- import { PERIPHERALS } from '../lib/peripheral-registry.js';
60
- import { statusHostSideProxy } from '../lib/host-side-proxy.js';
61
- import { resolveK8sAssetsRoot } from '../lib/k8s-bootstrap.js';
62
- import * as fs from 'node:fs';
63
- import * as net from 'node:net';
64
- import * as path from 'node:path';
65
- import * as os from 'node:os';
66
- import { OLAM_HOME, OLAM_CONFIG_PATH, readConfig } from '../lib/config.js';
67
- import { HERMES_KG_HOOK_SENTINEL } from './hermes-kg-hook.js';
68
- import { DEFAULT_AUTH_WORKER_URL } from '../lib/auth-login.js';
69
- /** Default registry prefix for registry-tagged images. Mirrors bootstrap.ts's default. */
70
- const DEFAULT_REGISTRY = 'ghcr.io/pleri';
71
- /**
72
- * Canonical image set olam doctor verifies, in {bare, registry} pairs.
73
- *
74
- * upgrade.ts maintains a dual-tag invariant: each image is tagged BOTH
75
- * bare (`olam-host-cp:latest`) AND registry-prefixed
76
- * (`ghcr.io/pleri/olam-host-cp:latest`). The bare tag is used by
77
- * `docker run` paths; the registry tag is used by compose.yaml.
78
- * `docker image prune` can orphan one tag while leaving the other —
79
- * doctor must probe both to surface the failure that compose.yaml
80
- * would hit on next recreate (audit finding HIGH).
81
- *
82
- * `olam-auth:local` and `olam-mcp-auth:local` are bare-only by design
83
- * (they don't ship a registry-prefixed `:local` variant); they appear
84
- * in the bare set only.
85
- */
86
- const REQUIRED_IMAGE_PAIRS = [
87
- { bare: 'olam-host-cp:latest', registryName: 'olam-host-cp:latest' },
88
- { bare: 'olam-auth:local' },
89
- { bare: 'olam-devbox:base', registryName: 'olam-devbox:base' },
90
- { bare: 'olam-mcp-auth:local' },
91
- ];
92
- function buildRequiredImageRefs(registry) {
93
- const refs = [];
94
- for (const pair of REQUIRED_IMAGE_PAIRS) {
95
- refs.push(pair.bare);
96
- if (pair.registryName)
97
- refs.push(`${registry}/${pair.registryName}`);
98
- }
99
- return refs;
100
- }
101
- /**
102
- * Run probes against the host. Probe-1 (daemon / API) runs FIRST + ALONE.
103
- * If it fails, the remaining slot-1+2 probes are SKIPPED — image presence
104
- * probes against a paused daemon / unreachable cluster return confusing
105
- * errors that misdirect the operator's fix (Risk T5 mitigation per plan).
106
- *
107
- * On daemon-success, probes 2-7 run in parallel via Promise.all
108
- * (P1 budget: doctor < 2s on healthy host).
109
- *
110
- * Phase C / C2: engine-aware. When `engine=kubernetes` we substitute
111
- * positions 1 + 2 in-place to preserve the positional `--json` contract.
112
- */
113
- export async function runDoctor(opts, deps = {}) {
114
- const dockerExec = deps.dockerExec;
115
- const fetchImpl = deps.fetchImpl;
116
- const olamHomeOverride = deps.olamHomeOverride;
117
- const hermesHomeOverride = deps.hermesHomeOverride;
118
- const registry = deps.registry ?? DEFAULT_REGISTRY;
119
- const engine = deps.engine ?? resolveEngine(deps.configPath);
120
- const isK8s = engine === 'kubernetes';
121
- // Slot 1: daemon / API reachability (fast-fail gate). Engine-aware.
122
- const slot1Result = isK8s
123
- ? await probeK8sApiReachable(dockerExec)
124
- : await probeDockerDaemon(dockerExec);
125
- const slot1Name = isK8s ? 'api server' : 'docker daemon';
126
- const rows = [{ name: slot1Name, result: slot1Result, position: 1 }];
127
- if (!slot1Result.ok) {
128
- // Fast-fail: skip per-image / host-cp / auth / kg probes when the
129
- // engine's daemon-equivalent is down. Engine + colima probes still
130
- // surface for diagnostic context, though, since they may hint at WHY
131
- // the daemon is unreachable (e.g. Colima 0.10.x kubernetes-mode bug).
132
- const [engineRes, colimaRes] = await Promise.all([
133
- probeEngine(fetchImpl),
134
- probeColimaVersion(dockerExec),
135
- ]);
136
- rows.push({ name: 'engine', result: engineRes, position: 6 }, { name: 'colima version', result: colimaRes, position: 7 });
137
- return emit(makeReport(rows), opts);
138
- }
139
- // Slots 2-7: parallel (independent; no shared state).
140
- const imageRefs = buildRequiredImageRefs(registry);
141
- // On kubernetes, bare/registry tags (olam-host-cp:latest etc.) don't exist —
142
- // deployments use digest-pinned ghcr.io refs verified by the per-peripheral
143
- // image probes (positions 14-28). Skip the slot-2 images probe with PASS to
144
- // avoid false negatives on a healthy cluster.
145
- const slot2Promise = isK8s
146
- ? Promise.resolve({ ok: true, message: 'images probe skipped (kubernetes substrate uses digest-pinned images verified via image-present probe)' })
147
- : probeImagePresence(imageRefs, dockerExec);
148
- // B7: when authVaultFetchImpl is explicitly provided (or authWorkerUrlOverride is set),
149
- // use the new dual-backend probe. Otherwise fall back to the legacy local-only probe
150
- // so existing callers that don't inject authVaultFetchImpl stay unaffected.
151
- const useDualBackend = deps.authVaultFetchImpl !== undefined || deps.authWorkerUrlOverride !== undefined;
152
- const authWorkerUrl = deps.authWorkerUrlOverride ?? resolveAuthWorkerUrlForDoctor();
153
- const [imageResult, hostCpResult, authResult, kgResult, engineResult, colimaResult] = await Promise.all([
154
- slot2Promise,
155
- probeHostCpHealth(fetchImpl),
156
- useDualBackend
157
- ? probeAuthVaultBothBackends({
158
- olamHomeOverride,
159
- dockerExec,
160
- authWorkerUrl,
161
- fetchImpl: deps.authVaultFetchImpl,
162
- })
163
- : probeAuthVault(olamHomeOverride),
164
- probeKgStorage(olamHomeOverride),
165
- probeEngine(fetchImpl),
166
- probeColimaVersion(dockerExec),
167
- ]);
168
- rows.push({ name: 'images', result: imageResult, position: 2 }, { name: 'host-cp /health', result: hostCpResult, position: 3 }, { name: 'auth vault', result: authResult, position: 4 }, { name: 'KG storage', result: kgResult, position: 5 }, { name: 'engine', result: engineResult, position: 6 }, { name: 'colima version', result: colimaResult, position: 7 });
169
- // Per-MODE positional contract (D11) — slot 8+ branches by engine.
170
- // docker mode: bundle freshness probe — olam-world-bundle-freshness Phase A1
171
- // (non-gating WARN-or-PASS; informational signal for in-development
172
- // agent-stream patches).
173
- // kubernetes mode: D2 peripheral suite (positions 14-25) + storage class
174
- // (26) + node memory (27). Non-gating informational probes; silent in
175
- // docker/compose substrate mode. Positions 8-13 reserved for future
176
- // Phase 1b probes.
177
- if (isK8s) {
178
- const wrapImpl = deps.kubectlWrapImpl ?? kubectlWrap;
179
- const k8sCtx = deps.kubectlContext;
180
- const manifestsDir = deps.manifestsDir ?? path.join(OLAM_HOME, 'k8s', 'manifests');
181
- const readFileSyncImpl = deps.readFileSyncImpl ?? fs.readFileSync;
182
- // D11 positional contract — positions 8-13 reserved (Phase 1b D11).
183
- // These slots are intentionally empty in the kubernetes probe suite.
184
- // They are NOT emitted as rows; consumers must not assume contiguity.
185
- // Future probes for managed-k8s / cert-manager / ingress can occupy 9-13.
186
- // Positions 14-28: 5 peripherals × 3 probes in alphabetical order.
187
- // Alphabetical: auth-service, kg-service, mcp-auth-service, memory-service, plan-chat-service.
188
- const sortedPeripherals = [...PERIPHERALS].sort((a, b) => a.name.localeCompare(b.name));
189
- let peripheralPosition = 14;
190
- const peripheralProbeRows = await Promise.all(sortedPeripherals.map(async (peripheral) => {
191
- const startPos = peripheralPosition;
192
- peripheralPosition += 3;
193
- return runPeripheralProbes(peripheral, startPos, k8sCtx, wrapImpl);
194
- }));
195
- for (const probeRows of peripheralProbeRows) {
196
- rows.push(...probeRows);
197
- }
198
- // Position 29: probeStorageClassMatch (D24 — non-gating, WARN on mismatch).
199
- const storageClassResult = await probeStorageClassMatch(sortedPeripherals, k8sCtx, manifestsDir, wrapImpl, readFileSyncImpl);
200
- rows.push({ name: 'storage class match', result: storageClassResult, position: 29 });
201
- // Position 30: probeNodeMemory (D29 — already seeded in Phase A A5).
202
- const nodeMemResult = probeNodeMemory(dockerExec, k8sCtx);
203
- rows.push({ name: 'node memory', result: nodeMemResult, position: 30 });
204
- // Position 31: probeHostSideProxyReachability (olam-k3d-on-mac-substrate-
205
- // decision Phase C C1). Replaces probeDockerSocketBindMount (Phase B B3
206
- // retracted; host-cp no longer mounts docker.sock). Asserts the host-side
207
- // tecnativa/docker-socket-proxy container is running on the operator's
208
- // docker daemon; host-cp connects to it via the in-cluster ExternalName
209
- // Service `docker-socket-proxy.olam.svc.cluster.local:2375` (kube-dns
210
- // CNAME → host.k3d.internal). Non-gating: WARN when proxy is stopped or
211
- // status-unknown; PASS when running.
212
- const socketCheckImpl = deps.dockerSocketCheckImpl;
213
- // Distinguish 'undefined' (not injected — use real resolver) from 'null'
214
- // (test explicitly simulating bundle-not-found). `??` would collapse the
215
- // explicit-null case into the default; use a strict undefined check.
216
- const composePath = deps.hostSideProxyComposePathOverride !== undefined
217
- ? deps.hostSideProxyComposePathOverride
218
- : defaultResolveHostSideProxyComposePath();
219
- const socketResult = await probeHostSideProxyReachability(composePath, socketCheckImpl);
220
- rows.push({ name: 'host-side proxy', result: socketResult, position: 31 });
221
- }
222
- else {
223
- const bundleResult = await probeBundleFreshness({
224
- dockerExec,
225
- repoRootOverride: deps.repoRootOverride,
226
- });
227
- rows.push({ name: 'bundle freshness', result: bundleResult, position: 8 });
228
- }
229
- // Position 9 (docker) / 32 (kubernetes): Hermes integration probe.
230
- // Non-gating WARN-or-PASS. Only emitted when hermesHomeOverride is explicitly
231
- // provided (opt-in for tests + `registerDoctor` passes the real path on production).
232
- // This keeps the positional contract stable for existing --json consumers on
233
- // machines where ~/.hermes/ happens to exist.
234
- if (hermesHomeOverride !== undefined && fs.existsSync(hermesHomeOverride)) {
235
- const hermesResult = probeHermesIntegration(hermesHomeOverride);
236
- const hermesPosition = isK8s ? 32 : 9;
237
- rows.push({ name: 'hermes integration', result: hermesResult, position: hermesPosition });
238
- }
239
- return emit(makeReport(rows), opts);
240
- }
241
- // ── D2 Kubernetes peripheral probes (positions 14-28) ─────────────────────
242
- const K8S_NAMESPACE = 'olam';
243
- /**
244
- * Run 3 probes for one peripheral: Reachable (kubectl exec), PortForwardLiveness (TCP),
245
- * ImagePresent (kubectl get pod jsonpath). Returns 3 ProbeRows at consecutive positions.
246
- */
247
- async function runPeripheralProbes(peripheral, startPosition, kubectlContext, wrapImpl) {
248
- const ctxArgs = kubectlContext ? ['--context', kubectlContext] : [];
249
- const rows = [];
250
- // Probe N: Ready — check the pod's Ready condition via kubectl get pod jsonpath.
251
- // Uses kubelet's view of readiness without requiring any binary inside the container
252
- // (distroless images don't ship wget/curl, so kubectl exec -- wget always fails).
253
- //
254
- // The jsonpath uses a `{range .items[*]}...{end}` form rather than `.items[0]`:
255
- // an indexed access on an EMPTY items array makes kubectl exit non-zero and
256
- // print `array index out of bounds: index 0, length 0` to stderr. That error
257
- // used to leak verbatim into the remedy whenever pods were mid-rollout (0 pods
258
- // matching the label for a moment) — confusing operators into thinking the
259
- // infra was broken. The range form returns an empty string for 0 pods with no
260
- // error, so we can distinguish "no pods yet" from "pod present, not Ready".
261
- const reachableResult = await (async () => {
262
- const result = await wrapImpl([
263
- ...ctxArgs,
264
- 'get', 'pod',
265
- '-n', K8S_NAMESPACE,
266
- '-l', `app=${peripheral.k8sResourceName}`,
267
- '-o', `jsonpath={range .items[*]}{.status.conditions[?(@.type=="Ready")].status}{"\\n"}{end}`,
268
- ], { timeout: 5_000 });
269
- const statuses = (result.stdout ?? '')
270
- .split('\n')
271
- .map((s) => s.trim())
272
- .filter((s) => s.length > 0);
273
- if (result.ok && statuses.includes('True')) {
274
- return { ok: true, message: `${peripheral.name} pod ready` };
275
- }
276
- // No pods matched the label — deployment is rolling or scaled to 0. This is
277
- // a transient state during `olam upgrade`, not a hard failure of infra.
278
- if (result.ok && statuses.length === 0) {
279
- return {
280
- ok: false,
281
- message: `${peripheral.name}: 0 pods (deployment rolling or scaled to 0)`,
282
- remedy: `kubectl get pods -n ${K8S_NAMESPACE} -l app=${peripheral.k8sResourceName} — if mid-rollout, re-run \`olam doctor\` shortly`,
283
- };
284
- }
285
- return {
286
- ok: false,
287
- message: `${peripheral.name} pod not ready`,
288
- remedy: `kubectl get pod -l app=${peripheral.k8sResourceName} -n ${K8S_NAMESPACE} -o wide`,
289
- };
290
- })();
291
- rows.push({ name: `${peripheral.name} ready`, result: reachableResult, position: startPosition });
292
- // Probe N+1: PortForwardLiveness — TCP connect to 127.0.0.1:<port>.
293
- const pfLivenessResult = await (async () => {
294
- return new Promise((resolve) => {
295
- const socket = new net.Socket();
296
- let done = false;
297
- const finish = (alive) => {
298
- if (done)
299
- return;
300
- done = true;
301
- socket.destroy();
302
- if (alive) {
303
- resolve({ ok: true, message: `${peripheral.name} port-forward live on :${peripheral.port}` });
304
- }
305
- else {
306
- resolve({
307
- ok: true,
308
- warn: true,
309
- message: `${peripheral.name} port-forward not live on :${peripheral.port}`,
310
- remedy: `Run \`olam upgrade\` to establish port-forwards for peripheral services.`,
311
- });
312
- }
313
- };
314
- const timer = setTimeout(() => finish(false), 2_000);
315
- socket.once('connect', () => { clearTimeout(timer); finish(true); });
316
- socket.once('error', () => { clearTimeout(timer); finish(false); });
317
- socket.connect(peripheral.port, '127.0.0.1');
318
- });
319
- })();
320
- rows.push({ name: `${peripheral.name} port-forward`, result: pfLivenessResult, position: startPosition + 1 });
321
- // Probe N+2: ImagePresent — kubectl get pod jsonpath for container image.
322
- // Same `{range .items[*]}...{end}` empty-safe form as the Ready probe above
323
- // (indexed `.items[0]` errors on 0 pods and leaks an ugly kubectl template
324
- // error). "image not detected" is a downstream symptom of 0 pods, so call
325
- // that out explicitly rather than implying the image itself is missing.
326
- const imagePresentResult = await (async () => {
327
- const result = await wrapImpl([
328
- ...ctxArgs,
329
- 'get', 'pod',
330
- '-n', K8S_NAMESPACE,
331
- '-l', `app=${peripheral.k8sResourceName}`,
332
- '-o', `jsonpath={range .items[*]}{.status.containerStatuses[*].image}{"\\n"}{end}`,
333
- ], { timeout: 10_000 });
334
- const images = (result.stdout ?? '')
335
- .split('\n')
336
- .map((s) => s.trim())
337
- .filter((s) => s.length > 0);
338
- if (result.ok && images.length > 0) {
339
- return { ok: true, message: `${peripheral.name} image present: ${images[0]}` };
340
- }
341
- return {
342
- ok: true,
343
- warn: true,
344
- message: `${peripheral.name} image not detected (0 pods — deployment rolling or scaled to 0)`,
345
- remedy: `kubectl get pods -n ${K8S_NAMESPACE} -l app=${peripheral.k8sResourceName}`,
346
- };
347
- })();
348
- rows.push({ name: `${peripheral.name} image`, result: imagePresentResult, position: startPosition + 2 });
349
- return rows;
350
- }
351
- /**
352
- * Position 26 — probeStorageClassMatch (D24).
353
- *
354
- * For each peripheral, reads the bound PVC's storageClassName from the cluster
355
- * and compares against the manifest declaration (45-pvc.yaml). WARN on mismatch.
356
- * Non-gating per D24 spec.
357
- */
358
- async function probeStorageClassMatch(peripherals, kubectlContext, manifestsDir, wrapImpl, readFileSyncImpl) {
359
- const ctxArgs = kubectlContext ? ['--context', kubectlContext] : [];
360
- const mismatches = [];
361
- for (const peripheral of peripherals) {
362
- // Read declared storageClassName from the manifest PVC file.
363
- const pvcManifestPath = path.join(manifestsDir, peripheral.name, '45-pvc.yaml');
364
- let declaredClass;
365
- try {
366
- const raw = readFileSyncImpl(pvcManifestPath, 'utf8');
367
- // Simple regex parse — avoid bringing in yaml parse dep here.
368
- const match = /storageClassName:\s*(\S+)/.exec(raw);
369
- declaredClass = match?.[1];
370
- }
371
- catch {
372
- // Manifest not found — skip this peripheral (not deployed yet).
373
- continue;
374
- }
375
- // Read actual storageClassName from the cluster.
376
- const pvcName = `olam-${peripheral.name}-data`;
377
- const result = await wrapImpl([
378
- ...ctxArgs,
379
- 'get', 'pvc', pvcName,
380
- '-n', K8S_NAMESPACE,
381
- '-o', `jsonpath={.spec.storageClassName}`,
382
- ], { timeout: 10_000 });
383
- if (!result.ok || !result.stdout.trim()) {
384
- // PVC not found — skip (peripheral not deployed yet).
385
- continue;
386
- }
387
- const actualClass = result.stdout.trim();
388
- if (declaredClass && actualClass !== declaredClass) {
389
- mismatches.push(`${peripheral.name}: declared=${declaredClass} actual=${actualClass}`);
390
- }
391
- }
392
- if (mismatches.length > 0) {
393
- return {
394
- ok: true,
395
- warn: true,
396
- message: `storage class mismatch on ${mismatches.length} PVC(s)`,
397
- remedy: `Mismatches: ${mismatches.join('; ')}. Re-provision PVCs or update manifest storageClassName.`,
398
- };
399
- }
400
- return { ok: true, message: 'storage class match: all PVCs match manifest declarations' };
401
- }
402
- /**
403
- * probeNodeMemory — Phase 2 A5, Decision D29.
404
- *
405
- * Reads free RAM on the k3d node via `kubectl top node --no-headers`.
406
- * The fifth column is "FREE" in Ki. Warns when free RAM is below 4 GiB
407
- * (T4 risk: peripheral service pods OOM before the operator notices).
408
- *
409
- * Non-gating (WARN, not FAIL). Only runs in engine=kubernetes mode.
410
- *
411
- * kubectl top requires metrics-server. If metrics-server is absent (fresh
412
- * k3d cluster), `kubectl top` exits non-zero. In that case we emit WARN
413
- * with a "metrics-server not installed" note rather than FAIL.
414
- */
415
- function probeNodeMemory(dockerExec, kubectlContext) {
416
- if (!dockerExec) {
417
- // No exec injected — can't run kubectl. Skip gracefully.
418
- return { ok: true, message: 'node memory probe skipped (no exec)' };
419
- }
420
- const contextArgs = kubectlContext ? ['--context', kubectlContext] : [];
421
- const result = dockerExec('kubectl', [...contextArgs, 'top', 'node', '--no-headers']);
422
- if (result.status !== 0) {
423
- // metrics-server absent or cluster unreachable.
424
- const hint = (result.stderr ?? '').includes('not available') || (result.stderr ?? '').includes('Metrics')
425
- ? 'metrics-server not installed on cluster — install via: kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml'
426
- : `kubectl top node failed: ${(result.stderr ?? '').trim()}`;
427
- return {
428
- ok: true,
429
- warn: true,
430
- message: 'node memory unknown (kubectl top unavailable)',
431
- remedy: hint,
432
- };
433
- }
434
- // Parse the first node's output. Format:
435
- // NAME CPU(cores) CPU% MEMORY(bytes) MEMORY%
436
- // We want total node capacity which isn't in `top` output directly;
437
- // use `kubectl get node -o json` to fetch allocatable memory and compare.
438
- const topLine = (result.stdout ?? '').trim().split('\n')[0];
439
- if (!topLine) {
440
- return {
441
- ok: true,
442
- warn: true,
443
- message: 'node memory unknown (empty kubectl top output)',
444
- remedy: 'Verify metrics-server is running: kubectl get pods -n kube-system | grep metrics-server',
445
- };
446
- }
447
- // Get allocatable memory from `kubectl get nodes -o jsonpath`.
448
- const allocResult = dockerExec('kubectl', [
449
- ...contextArgs,
450
- 'get', 'nodes', '-o', 'jsonpath={.items[0].status.allocatable.memory}',
451
- ]);
452
- if (allocResult.status !== 0 || !(allocResult.stdout ?? '').trim()) {
453
- return {
454
- ok: true,
455
- warn: true,
456
- message: 'node memory unknown (could not read allocatable memory)',
457
- remedy: 'kubectl get nodes unreachable',
458
- };
459
- }
460
- // Parse allocatable memory (e.g. "8059228Ki" or "8Gi").
461
- const raw = (allocResult.stdout ?? '').trim();
462
- let allocKi;
463
- if (raw.endsWith('Ki')) {
464
- allocKi = parseInt(raw.slice(0, -2), 10);
465
- }
466
- else if (raw.endsWith('Mi')) {
467
- allocKi = parseInt(raw.slice(0, -2), 10) * 1024;
468
- }
469
- else if (raw.endsWith('Gi')) {
470
- allocKi = parseInt(raw.slice(0, -2), 10) * 1024 * 1024;
471
- }
472
- else {
473
- // Bytes (no suffix).
474
- allocKi = Math.floor(parseInt(raw, 10) / 1024);
475
- }
476
- // Parse used memory from kubectl top output (4th column: MEMORY(bytes) in Mi).
477
- const topCols = topLine.trim().split(/\s+/);
478
- const usedMiStr = topCols[3] ?? '0Mi';
479
- const usedKi = usedMiStr.endsWith('Mi')
480
- ? parseInt(usedMiStr.slice(0, -2), 10) * 1024
481
- : parseInt(usedMiStr, 10);
482
- const freeKi = allocKi - usedKi;
483
- const freeGiB = freeKi / (1024 * 1024);
484
- const WARN_THRESHOLD_GIB = 4;
485
- if (freeGiB < WARN_THRESHOLD_GIB) {
486
- return {
487
- ok: true,
488
- warn: true,
489
- message: `node free RAM ${freeGiB.toFixed(1)} GiB (below ${WARN_THRESHOLD_GIB} GiB threshold)`,
490
- remedy: `Free at least ${WARN_THRESHOLD_GIB} GiB of node RAM before deploying peripheral services to avoid OOM (T4 risk).`,
491
- };
492
- }
493
- return {
494
- ok: true,
495
- message: `node free RAM ${freeGiB.toFixed(1)} GiB (≥${WARN_THRESHOLD_GIB} GiB threshold)`,
496
- };
497
- }
498
- /**
499
- * Resolve the bundled docker-socket-proxy.compose.yaml path (Phase C C1).
500
- * Mirrors the upgrade-kubernetes.ts helper of the same name. Returns null
501
- * when the bundle layout is unexpected (dev contexts without a built
502
- * tarball); the probe treats null as a warning.
503
- */
504
- function defaultResolveHostSideProxyComposePath() {
505
- const root = resolveK8sAssetsRoot();
506
- if (root === null)
507
- return null;
508
- const candidate = path.join(root, 'host-side', 'docker-socket-proxy.compose.yaml');
509
- return fs.existsSync(candidate) ? candidate : null;
510
- }
511
- // defaultDetectK8sClusterType, buildDockerSocketRemedy, DetectK8sClusterTypeFn
512
- // are imported from health-probes.ts (canonical location). Re-exported here
513
- // for back-compat with callers that imported them from doctor.ts. Their
514
- // docker-socket-related codepath is unused since Phase B B3, but the symbols
515
- // remain available for other consumers.
516
- export { defaultDetectK8sClusterType, buildDockerSocketRemedy };
517
- /**
518
- * Default implementation: invoke statusHostSideProxy from host-side-proxy.ts.
519
- * Returns 'running' / 'stopped' / 'unknown'.
520
- *
521
- * This replaces the previous pod-internal `test -S /var/run/docker.sock`
522
- * check (R3-A/R4-W2-E surface) — host-cp no longer mounts docker.sock; it
523
- * connects to the host-side proxy via TCP through the in-cluster
524
- * ExternalName Service. The probe now asks the more direct question:
525
- * "is the host-side proxy container actually running on the operator's
526
- * docker daemon?"
527
- */
528
- async function defaultDockerSocketCheck(composePath) {
529
- const result = statusHostSideProxy(composePath);
530
- return result.status;
531
- }
532
- /**
533
- * probeHostSideProxyReachability — olam-k3d-on-mac-substrate-decision Phase C C1.
534
- *
535
- * Position 28 in the kubernetes probe suite (replaces probeDockerSocketBindMount).
536
- * Asserts the host-side `tecnativa/docker-socket-proxy` container is running
537
- * on the operator's docker daemon. host-cp's kubernetes-substrate codepath
538
- * connects to this proxy via TCP through the in-cluster `docker-socket-proxy`
539
- * ExternalName Service (kube-dns CNAME → host.k3d.internal:2375).
540
- *
541
- * PASS: statusHostSideProxy returns 'running' — proxy reachable on host
542
- * (operator's `olam upgrade` Step 0.7 succeeded, OR Linux operator
543
- * brought up the proxy manually per the install guide).
544
- * WARN: 'stopped' — proxy not running. Remedy: `olam upgrade` (macOS) OR
545
- * `docker compose -f $(npm root -g)/@pleri/olam-cli/host-cp/k8s/
546
- * host-side/docker-socket-proxy.compose.yaml up -d` (Linux).
547
- * WARN: 'unknown' — probe failure (docker compose plugin absent, daemon
548
- * unreachable, malformed output). Remedy includes plugin-install hint.
549
- *
550
- * Non-gating (WARN, not FAIL). Only runs in engine=kubernetes mode.
551
- */
552
- async function probeHostSideProxyReachability(composePath, checkImpl) {
553
- if (composePath === null) {
554
- return {
555
- ok: true,
556
- warn: true,
557
- message: 'host-side proxy compose yaml not found in CLI bundle',
558
- remedy: 'The bundled `docker-socket-proxy.compose.yaml` could not be resolved.\n' +
559
- 'This is a packaging issue — try `npm install -g @pleri/olam-cli@latest`\n' +
560
- 'to restore the bundled k8s assets.',
561
- };
562
- }
563
- const check = checkImpl ?? defaultDockerSocketCheck;
564
- const status = await check(composePath);
565
- if (status === 'running') {
566
- return {
567
- ok: true,
568
- message: 'host-side docker-socket-proxy running on operator docker daemon',
569
- };
570
- }
571
- if (status === 'stopped') {
572
- return {
573
- ok: true,
574
- warn: true,
575
- message: 'host-side docker-socket-proxy not running',
576
- remedy: 'Start the proxy on the operator host:\n' +
577
- ` - macOS: re-run \`olam upgrade\` (Step 0.7 auto-starts the proxy)\n` +
578
- ` - Linux: \`docker compose -f ${composePath} up -d\`\n` +
579
- 'host-cp connects to docker through this proxy via the in-cluster\n' +
580
- 'ExternalName Service `docker-socket-proxy.olam.svc.cluster.local:2375`.',
581
- };
582
- }
583
- return {
584
- ok: true,
585
- warn: true,
586
- message: 'host-side docker-socket-proxy status unknown',
587
- remedy: 'Probe failed before reaching the docker daemon. Check:\n' +
588
- ' - `docker compose version` succeeds (compose v2 plugin installed)\n' +
589
- ' - `docker context ls` shows your active context (colima for macOS)\n' +
590
- ' - `docker info` succeeds against that context',
591
- };
592
- }
593
- /**
594
- * runK8sPreflight — Issue #713 narrowed pre-deploy check for `olam substrate set kubernetes`.
595
- *
596
- * The full `runDoctor` kubernetes probe suite (probes 3-7: host-cp /health,
597
- * auth vault, KG storage, engine, colima) requires host-cp to be already deployed.
598
- * When the operator runs `substrate set kubernetes` on a fresh cluster BEFORE
599
- * `olam upgrade`, those probes fail with ok:false because host-cp doesn't exist yet.
600
- *
601
- * This narrowed preflight only checks gates the operator CAN satisfy BEFORE
602
- * `olam upgrade`:
603
- * 1. kubectl binary present + cluster reachable (probeK8sApiReachable)
604
- *
605
- * Exits 0 when the single gate passes; 1 when kubectl/cluster is unreachable.
606
- * The full `olam doctor --substrate=kubernetes` covers the complete post-deploy
607
- * suite — operators should run that AFTER `olam upgrade` to confirm health.
608
- *
609
- * Exported for injection into substrate.ts's handleSet via SubstrateDeps.runDoctor.
610
- */
611
- export async function runK8sPreflight(opts, deps = {}) {
612
- const dockerExec = deps.dockerExec;
613
- const result = await probeK8sApiReachable(dockerExec);
614
- const rows = [{ name: 'api server', result, position: 1 }];
615
- return emit(makeReport(rows), opts);
616
- }
617
- /**
618
- * runComposePreflight — narrowed pre-deploy check for `olam substrate set compose`.
619
- *
620
- * Mirrors {@link runK8sPreflight} for the compose direction. The full
621
- * `runDoctor` compose suite (probes 3-5: host-cp /health, auth vault, KG storage)
622
- * requires host-cp to be already running under docker compose. When the operator
623
- * switches FROM kubernetes TO compose on a host that has never run compose
624
- * host-cp, those probes fail with ok:false because the container doesn't exist yet.
625
- *
626
- * This narrowed preflight only checks the gates the operator CAN satisfy BEFORE
627
- * `olam bootstrap` / `olam upgrade`:
628
- * 1. docker daemon reachable (probeDockerDaemon)
629
- * 2. docker compose v2 plugin (probeComposePlugin — B2: npm-only-via-Homebrew operators)
630
- *
631
- * Daemon comes first (fast-fail per Risk T5). If the daemon is down, the compose
632
- * plugin probe would emit a redundant / confusing remedy.
633
- *
634
- * Exits 0 when both probes pass; 1 when either fails. The full
635
- * `olam doctor` covers the complete post-deploy suite — operators run that
636
- * AFTER `olam bootstrap` to confirm host-cp health.
637
- *
638
- * Exported for injection into substrate.ts's handleSet via SubstrateDeps.runComposePreflightFn.
639
- */
640
- export async function runComposePreflight(opts, deps = {}) {
641
- const dockerExec = deps.dockerExec;
642
- const daemonResult = await probeDockerDaemon(dockerExec);
643
- const rows = [{ name: 'docker daemon', result: daemonResult, position: 1 }];
644
- // Skip compose-plugin probe when daemon is down — the surfacing
645
- // remedy is "start docker first" and the second row would just clutter.
646
- if (daemonResult.ok) {
647
- const composeResult = await probeComposePlugin(dockerExec);
648
- rows.push({ name: 'docker compose plugin', result: composeResult, position: 2 });
649
- }
650
- return emit(makeReport(rows), opts);
651
- }
652
- // ── B7 — Auth vault dual-backend probe ────────────────────────────────────────
653
- /**
654
- * Resolve the auth-worker URL for the doctor probe.
655
- *
656
- * Mirrors the resolution order from `runAuthLogin` in auth-login.ts:
657
- * 1. `OLAM_AUTH_WORKER_URL` env var.
658
- * 2. `~/.olam/auth-worker-url` file.
659
- * 3. Hard-coded fallback `https://auth-worker.kaluga.co`.
660
- *
661
- * Pure (no side effects) — reads env + filesystem only.
662
- */
663
- function resolveAuthWorkerUrlForDoctor() {
664
- const fromEnv = process.env['OLAM_AUTH_WORKER_URL'];
665
- if (fromEnv && fromEnv.length > 0)
666
- return fromEnv;
667
- try {
668
- const file = path.join(os.homedir(), '.olam', 'auth-worker-url');
669
- if (fs.existsSync(file)) {
670
- const content = fs.readFileSync(file, 'utf-8').trim();
671
- if (content.length > 0)
672
- return content;
673
- }
674
- }
675
- catch {
676
- // Unreadable file — fall through.
677
- }
678
- return DEFAULT_AUTH_WORKER_URL;
679
- }
680
- /** Default local auth-service port. */
681
- const LOCAL_AUTH_PORT = 9999;
682
- /** Default local auth-container name. */
683
- const LOCAL_AUTH_CONTAINER = 'olam-auth';
684
- /** Remote probe timeout (milliseconds). */
685
- const REMOTE_PROBE_TIMEOUT_MS = 5_000;
686
- /**
687
- * Probe the remote auth-worker status with a 5-second timeout.
688
- *
689
- * Uses GET /v1/health which exists per auth-remote.ts. If that returns 401
690
- * the worker is reachable but the operator is not authenticated. If it fails
691
- * with DNS / TCP error or 5xx it is unreachable.
692
- */
693
- async function probeRemoteAuthWorker(authWorkerUrl, fetchImpl) {
694
- const fetchFn = fetchImpl ?? fetch;
695
- const start = Date.now();
696
- const url = authWorkerUrl.replace(/\/$/, '') + '/v1/health';
697
- try {
698
- const controller = new AbortController();
699
- const timer = setTimeout(() => controller.abort(), REMOTE_PROBE_TIMEOUT_MS);
700
- let res;
701
- try {
702
- res = await fetchFn(url, { signal: controller.signal });
703
- }
704
- finally {
705
- clearTimeout(timer);
706
- }
707
- const durationMs = Date.now() - start;
708
- if (res.status === 401 || res.status === 403) {
709
- return { state: 'unauthenticated', durationMs };
710
- }
711
- if (res.status >= 200 && res.status < 300) {
712
- return { state: 'healthy', durationMs };
713
- }
714
- // 5xx or other non-2xx non-auth error → unreachable.
715
- return { state: 'unreachable', durationMs };
716
- }
717
- catch {
718
- // DNS failure, TCP refused, AbortError (timeout), etc.
719
- return { state: 'unreachable', durationMs: Date.now() - start };
720
- }
721
- }
722
- /**
723
- * Check whether the `olam-auth` container is currently running on the local
724
- * Docker daemon by running `docker inspect --format {{.State.Running}} olam-auth`.
725
- */
726
- function probeLocalAuthContainer(dockerExec) {
727
- if (!dockerExec)
728
- return false;
729
- try {
730
- const result = dockerExec('docker', [
731
- 'inspect', '--format', '{{.State.Running}}', LOCAL_AUTH_CONTAINER,
732
- ]);
733
- return result.status === 0 && (result.stdout ?? '').trim() === 'true';
734
- }
735
- catch {
736
- return false;
737
- }
738
- }
739
- /**
740
- * Classify the local auth state from the file-existence + container-running booleans.
741
- *
742
- * D3: when the container is running (regardless of file), classify as
743
- * 'present-active-but-deprecated' since cloud-only-vault is now the default.
744
- * The 'present-active' classification is retained for back-compat with callers
745
- * that explicitly pass `remoteIsHealthy: false` to override the cloud path.
746
- */
747
- function classifyLocalState(fileExists, containerRunning) {
748
- if (containerRunning) {
749
- // D3: container running → deprecated (cloud is the default now)
750
- return fileExists ? 'present-active-but-deprecated' : 'present-active-but-deprecated';
751
- }
752
- if (!fileExists && !containerRunning)
753
- return 'absent';
754
- return 'present-stale';
755
- }
756
- /**
757
- * Build the suggestion line for the `auth vault` doctor row.
758
- *
759
- * Suggestion lookup table (per B7 + D3 spec):
760
- * - remote=healthy + local=present-active-but-deprecated → stop olam-auth
761
- * - remote=healthy + local=present-active|present-stale → migrate dry-run
762
- * - remote=healthy + local=absent → no suggestion (cloud-native)
763
- * - remote=unreachable + local=absent → stranded (4 recovery options)
764
- * - remote=unreachable + local=present-active-but-deprecated → stay-local env override
765
- * - remote=unreachable + local=present-active → stay-local env override
766
- * - remote=unauthenticated + any → `olam auth login`
767
- */
768
- function authVaultSuggestion(remote, local) {
769
- if (remote === 'unauthenticated') {
770
- return 'Run `olam auth login` (logs into the cloud auth-worker by default).';
771
- }
772
- if (remote === 'healthy') {
773
- if (local === 'present-active-but-deprecated') {
774
- // D3: container running but cloud is default — suggest stopping it
775
- return ('olam-auth container is running but cloud vault is now the default. ' +
776
- 'Stop it: `olam services down --include olam-auth` ' +
777
- '(see docs/architecture/cloud-only-vault-migration.md)');
778
- }
779
- if (local === 'present-active' || local === 'present-stale') {
780
- return 'Run `olam auth migrate --dry-run` to plan cloud migration of local credentials.';
781
- }
782
- return undefined; // already cloud-native
783
- }
784
- // remote=unreachable
785
- if (local === 'absent') {
786
- // D3: stranded — 4 recovery options
787
- return ('Stranded: cloud auth-worker unreachable and no local fallback. Recovery options:\n' +
788
- ' 1. Wait and retry (transient network issue)\n' +
789
- ' 2. Set ANTHROPIC_API_KEY env var (bypass vault for offline use)\n' +
790
- ' 3. `OLAM_CREDENTIAL_BACKEND=local olam services up --with-local-auth` (restore local vault)\n' +
791
- ' 4. Check network / VPN connectivity to the auth-worker');
792
- }
793
- if (local === 'present-active-but-deprecated' || local === 'present-active') {
794
- return 'Cloud auth-worker unreachable. Stay on local: `OLAM_CREDENTIAL_BACKEND=local olam auth list`';
795
- }
796
- return undefined;
797
- }
798
- /**
799
- * probeAuthVaultBothBackends — B7 cloud-only-vault dual-backend auth probe.
800
- *
801
- * Replaces the legacy `probeAuthVault` (which only read the local file) at
802
- * doctor position 4. Reports three remote states (healthy / unreachable /
803
- * unauthenticated) and three local states (present-active / present-stale /
804
- * absent), then routes to the correct suggestion.
805
- *
806
- * Non-gating when remote is unreachable + local is present-active (operator
807
- * already has a working local vault; WARN not FAIL). All other error states
808
- * remain gating (FAIL).
809
- *
810
- * Exported for direct use in `doctor-auth-probes.test.ts`.
811
- */
812
- export async function probeAuthVaultBothBackends(deps) {
813
- const { olamHomeOverride, dockerExec, authWorkerUrl, fetchImpl } = deps;
814
- // Probe remote + local in parallel (both are independent).
815
- const olamHome = olamHomeOverride ?? process.env.OLAM_HOME ?? path.join(os.homedir(), '.olam');
816
- const accountsFile = path.join(olamHome, 'auth-data', 'accounts.json');
817
- const [remoteResult] = await Promise.all([
818
- probeRemoteAuthWorker(authWorkerUrl, fetchImpl),
819
- ]);
820
- const localFileExists = fs.existsSync(accountsFile);
821
- const localContainerRunning = probeLocalAuthContainer(dockerExec);
822
- const localState = classifyLocalState(localFileExists, localContainerRunning);
823
- const { state: remoteState, durationMs } = remoteResult;
824
- // Humanize the auth-worker host for display (strip https:// for brevity).
825
- const workerHost = authWorkerUrl.replace(/^https?:\/\//, '');
826
- const suggestion = authVaultSuggestion(remoteState, localState);
827
- // Build the summary message.
828
- const remotePart = remoteState === 'healthy'
829
- ? `remote (${workerHost}) healthy (${durationMs}ms)`
830
- : remoteState === 'unauthenticated'
831
- ? `remote (${workerHost}) unauthenticated`
832
- : `remote (${workerHost}) unreachable`;
833
- let localDetail;
834
- if (localState === 'present-active-but-deprecated') {
835
- // D3: container running, but deprecated (cloud is the default)
836
- localDetail = 'local (olam-auth:9999) present-active-but-deprecated';
837
- }
838
- else if (localState === 'present-active') {
839
- localDetail = 'local (olam-auth:9999) present-active';
840
- }
841
- else if (localState === 'present-stale') {
842
- const which = localFileExists
843
- ? 'file present, container not running'
844
- : 'container running, file absent';
845
- localDetail = `local (olam-auth:9999) present-stale (${which})`;
846
- }
847
- else {
848
- localDetail = 'local (olam-auth:9999) absent';
849
- }
850
- const message = `${remotePart}; ${localDetail}`;
851
- // Determine ok/warn/fail:
852
- // - unauthenticated → FAIL (operator must login before cloud works)
853
- // - unreachable + local=absent → FAIL (stranded — D3 4-option remedy)
854
- // - unreachable + local=present-stale → WARN (partial local, cloud down)
855
- // - unreachable + local=present-active[-but-deprecated] → WARN (local works)
856
- // - healthy + local=present-active-but-deprecated → WARN (suggest stop olam-auth — D3)
857
- // - healthy → ok:true (cloud is the source of truth)
858
- if (remoteState === 'unauthenticated') {
859
- return {
860
- ok: false,
861
- message,
862
- remedy: suggestion ?? 'Run `olam auth login` to authenticate with the cloud auth-worker.',
863
- };
864
- }
865
- if (remoteState === 'unreachable' && localState === 'absent') {
866
- // D3 stranded: 4 recovery options surfaced via suggestion
867
- return {
868
- ok: false,
869
- message,
870
- remedy: suggestion ?? ('Stranded: cloud auth-worker unreachable and no local fallback. ' +
871
- 'Set ANTHROPIC_API_KEY or run `OLAM_CREDENTIAL_BACKEND=local olam services up --with-local-auth`.'),
872
- };
873
- }
874
- if (remoteState === 'unreachable') {
875
- // local is present-active[-but-deprecated] or present-stale — WARN
876
- const remedy = suggestion
877
- ?? 'Set `OLAM_CREDENTIAL_BACKEND=local` to route through the local vault until the cloud is reachable.';
878
- return {
879
- ok: true,
880
- warn: true,
881
- message,
882
- remedy,
883
- };
884
- }
885
- // remote=healthy
886
- if (suggestion) {
887
- return {
888
- ok: true,
889
- warn: true,
890
- message,
891
- remedy: suggestion,
892
- };
893
- }
894
- return { ok: true, message };
895
- }
896
- function makeReport(rows) {
897
- const failureCount = rows.filter((r) => !r.result.ok).length;
898
- const warnCount = rows.filter((r) => isWarn(r.result)).length;
899
- const summary = failureCount === 0 ? 'OK' : 'FAILED';
900
- return { rows, summary, failureCount, warnCount };
901
- }
902
- /**
903
- * Resolve the engine substrate for `olam doctor`.
904
- *
905
- * Priority (D1 — Phase D config-file fallback):
906
- * 1. OLAM_HOST_CP_ENGINE env var (explicit override wins)
907
- * 2. KUBERNETES_SERVICE_HOST env var (in-pod auto-detect)
908
- * 3. host.substrate in ~/.olam/config.json (config-file fallback — D1 load-bearing fix)
909
- * 4. 'docker' default
910
- *
911
- * The config-file fallback (step 3) closes the round-1+2 ghost-shipped gap:
912
- * `olam doctor` running on the HOST (not inside a k8s pod) without env vars
913
- * previously defaulted to docker mode. With this change, operators who have
914
- * `host.substrate: kubernetes` in their config get the correct 28-probe walk.
915
- *
916
- * @param configPath - override for tests (default: OLAM_CONFIG_PATH = ~/.olam/config.json)
917
- */
918
- function resolveEngine(configPath) {
919
- const explicit = process.env.OLAM_HOST_CP_ENGINE;
920
- if (explicit === 'kubernetes')
921
- return 'kubernetes';
922
- if (explicit === 'docker')
923
- return 'docker';
924
- // In-pod auto-detect (unchanged from pre-D1 behaviour).
925
- if (process.env.KUBERNETES_SERVICE_HOST)
926
- return 'kubernetes';
927
- // Phase D D1: config-file fallback — read host.substrate from ~/.olam/config.json.
928
- try {
929
- const cfg = readConfig({ configPath: configPath ?? OLAM_CONFIG_PATH });
930
- if (cfg.host.substrate === 'kubernetes')
931
- return 'kubernetes';
932
- }
933
- catch {
934
- // Config absent or unreadable; fall through to docker default.
935
- }
936
- return 'docker';
937
- }
938
- function isWarn(r) {
939
- return r.ok === true && r.warn === true;
940
- }
941
- function emit(report, opts) {
942
- if (opts.json) {
943
- process.stdout.write(JSON.stringify({
944
- summary: report.summary,
945
- failureCount: report.failureCount,
946
- warnCount: report.warnCount,
947
- probes: report.rows.map((r) => {
948
- const isFail = !r.result.ok;
949
- const warn = isWarn(r.result);
950
- const base = {
951
- position: r.position,
952
- name: r.name,
953
- ok: r.result.ok,
954
- message: r.result.message,
955
- };
956
- if (warn)
957
- base.warn = true;
958
- if (isFail || warn)
959
- base.remedy = r.result.remedy;
960
- return base;
961
- }),
962
- }, null, 2) + '\n');
963
- }
964
- else {
965
- renderHuman(report);
966
- }
967
- const exitCode = report.summary === 'OK' ? 0 : 1;
968
- return { exitCode, report };
969
- }
970
- function renderHuman(report) {
971
- printHeader('olam doctor');
972
- // Icon prefix width: '✓ ' / '✗ ' / '⚠ ' = 2 chars.
973
- const ICON_PAD = 2;
974
- const namePad = Math.max(...report.rows.map((r) => r.name.length));
975
- for (const row of report.rows) {
976
- const label = row.name.padEnd(namePad);
977
- if (isWarn(row.result)) {
978
- console.log(`${pc.yellow('⚠')} ${label} ${row.result.message}`);
979
- const remedy = row.result.remedy;
980
- if (remedy)
981
- console.log(`${''.padEnd(namePad + ICON_PAD)} remedy: ${remedy}`);
982
- }
983
- else if (row.result.ok) {
984
- console.log(`${pc.green('✓')} ${label} ${row.result.message}`);
985
- }
986
- else {
987
- console.error(`${pc.red('✗')} ${label} ${row.result.message}`);
988
- console.log(`${''.padEnd(namePad + ICON_PAD)} remedy: ${row.result.remedy}`);
989
- }
990
- }
991
- process.stdout.write('\n');
992
- if (report.summary === 'OK') {
993
- const warnNote = report.warnCount > 0 ? ` (${report.warnCount} warn)` : '';
994
- printSuccess(`OK — all ${report.rows.length} probes green${warnNote}`);
995
- }
996
- else {
997
- printError(`FAILED — ${report.failureCount} of ${report.rows.length} probes failed`);
998
- }
999
- }
1000
- // ── Hermes integration probe ───────────────────────────────────────────────────
1001
- /**
1002
- * Non-gating WARN probe: surfaces when a hermes directory exists but olam is
1003
- * not bootstrapped (missing mcp_servers.olam or kg-first hook).
1004
- *
1005
- * hermesDir: the Hermes home directory to inspect (typically ~/.hermes).
1006
- * Callers that inject a non-existent path get PASS immediately (probe silent).
1007
- */
1008
- export function probeHermesIntegration(hermesDir) {
1009
- const configPath = path.join(hermesDir, 'config.yaml');
1010
- const hookPath = path.join(hermesDir, 'hooks', 'kg-first.sh');
1011
- const issues = [];
1012
- // Check mcp_servers.olam in config.yaml
1013
- if (!fs.existsSync(configPath)) {
1014
- issues.push('~/.hermes/config.yaml not found');
1015
- }
1016
- else {
1017
- try {
1018
- const content = fs.readFileSync(configPath, 'utf-8');
1019
- if (!content.includes('mcp_servers') || !content.includes('olam')) {
1020
- issues.push('mcp_servers.olam not configured in ~/.hermes/config.yaml');
1021
- }
1022
- }
1023
- catch {
1024
- issues.push('could not read ~/.hermes/config.yaml');
1025
- }
1026
- }
1027
- // Check kg-first hook
1028
- if (!fs.existsSync(hookPath)) {
1029
- issues.push('kg-first.sh hook not installed at ~/.hermes/hooks/kg-first.sh');
1030
- }
1031
- else {
1032
- try {
1033
- const content = fs.readFileSync(hookPath, 'utf-8');
1034
- if (!content.includes(HERMES_KG_HOOK_SENTINEL)) {
1035
- issues.push('~/.hermes/hooks/kg-first.sh exists but is not the olam-managed hook');
1036
- }
1037
- }
1038
- catch {
1039
- issues.push('could not read ~/.hermes/hooks/kg-first.sh');
1040
- }
1041
- }
1042
- if (issues.length === 0) {
1043
- return { ok: true, message: 'hermes integration configured (mcp + kg-first hook)' };
1044
- }
1045
- return {
1046
- ok: true, // non-gating: WARN only
1047
- message: `hermes integration incomplete: ${issues.join('; ')}`,
1048
- warn: true,
1049
- remedy: 'run `olam hermes bootstrap` to wire olam into Hermes',
1050
- };
1051
- }
1052
- export function registerDoctor(program) {
1053
- program
1054
- .command('doctor')
1055
- .description('Pass/fail host-health check (28 probes on k8s, 7 on compose)')
1056
- .option('--json', 'emit the report as JSON instead of a human-readable table')
1057
- .action(async (opts) => {
1058
- const hermesDir = path.join(os.homedir(), '.hermes');
1059
- const r = await runDoctor(opts, {
1060
- // Pass hermesHomeOverride so the probe fires when ~/.hermes/ exists.
1061
- // When the dir is absent the probe is skipped; when present it WARNs
1062
- // if olam is not wired into Hermes.
1063
- hermesHomeOverride: hermesDir,
1064
- // B7: opt-in the dual-backend auth vault probe in production by
1065
- // providing the global fetch. The probe resolves the auth-worker URL
1066
- // via env / file / DEFAULT_AUTH_WORKER_URL.
1067
- authVaultFetchImpl: fetch,
1068
- });
1069
- if (r.exitCode !== 0)
1070
- process.exitCode = r.exitCode;
1071
- });
1072
- }
1073
- //# sourceMappingURL=doctor.js.map