@pleri/olam-cli 0.1.180 → 0.1.185

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 (209) hide show
  1. package/dist/agent-stream/agent-sdk-to-chunks.js +44 -30
  2. package/dist/ask/checkout.d.ts +19 -0
  3. package/dist/ask/checkout.d.ts.map +1 -0
  4. package/dist/ask/checkout.js +40 -0
  5. package/dist/ask/checkout.js.map +1 -0
  6. package/dist/ask/knowledge-pack-builder.d.ts +72 -0
  7. package/dist/ask/knowledge-pack-builder.d.ts.map +1 -0
  8. package/dist/ask/knowledge-pack-builder.js +91 -0
  9. package/dist/ask/knowledge-pack-builder.js.map +1 -0
  10. package/dist/ask/knowledge-pack.generated.d.ts +8 -0
  11. package/dist/ask/knowledge-pack.generated.d.ts.map +1 -0
  12. package/dist/ask/knowledge-pack.generated.js +1947 -0
  13. package/dist/ask/knowledge-pack.generated.js.map +1 -0
  14. package/dist/ask/one-shot.d.ts +21 -0
  15. package/dist/ask/one-shot.d.ts.map +1 -0
  16. package/dist/ask/one-shot.js +50 -0
  17. package/dist/ask/one-shot.js.map +1 -0
  18. package/dist/ask/repl.d.ts +30 -0
  19. package/dist/ask/repl.d.ts.map +1 -0
  20. package/dist/ask/repl.js +109 -0
  21. package/dist/ask/repl.js.map +1 -0
  22. package/dist/ask/sdk-client.d.ts +87 -0
  23. package/dist/ask/sdk-client.d.ts.map +1 -0
  24. package/dist/ask/sdk-client.js +118 -0
  25. package/dist/ask/sdk-client.js.map +1 -0
  26. package/dist/ask/system-prompt.d.ts +30 -0
  27. package/dist/ask/system-prompt.d.ts.map +1 -0
  28. package/dist/ask/system-prompt.js +31 -0
  29. package/dist/ask/system-prompt.js.map +1 -0
  30. package/dist/commands/ask.d.ts +27 -0
  31. package/dist/commands/ask.d.ts.map +1 -0
  32. package/dist/commands/ask.js +63 -0
  33. package/dist/commands/ask.js.map +1 -0
  34. package/dist/commands/auth-list-json.d.ts +53 -0
  35. package/dist/commands/auth-list-json.d.ts.map +1 -0
  36. package/dist/commands/auth-list-json.js +47 -0
  37. package/dist/commands/auth-list-json.js.map +1 -0
  38. package/dist/commands/auth.d.ts.map +1 -1
  39. package/dist/commands/auth.js +80 -19
  40. package/dist/commands/auth.js.map +1 -1
  41. package/dist/commands/config.d.ts.map +1 -1
  42. package/dist/commands/config.js +93 -0
  43. package/dist/commands/config.js.map +1 -1
  44. package/dist/commands/destroy.d.ts +41 -0
  45. package/dist/commands/destroy.d.ts.map +1 -1
  46. package/dist/commands/destroy.js +81 -33
  47. package/dist/commands/destroy.js.map +1 -1
  48. package/dist/commands/dispatch-resolve.d.ts +54 -0
  49. package/dist/commands/dispatch-resolve.d.ts.map +1 -0
  50. package/dist/commands/dispatch-resolve.js +105 -0
  51. package/dist/commands/dispatch-resolve.js.map +1 -0
  52. package/dist/commands/dispatch.d.ts.map +1 -1
  53. package/dist/commands/dispatch.js +40 -9
  54. package/dist/commands/dispatch.js.map +1 -1
  55. package/dist/commands/doctor.js +11 -11
  56. package/dist/commands/doctor.js.map +1 -1
  57. package/dist/commands/flywheel/k5-validate.d.ts +31 -0
  58. package/dist/commands/flywheel/k5-validate.d.ts.map +1 -1
  59. package/dist/commands/flywheel/k5-validate.js +80 -19
  60. package/dist/commands/flywheel/k5-validate.js.map +1 -1
  61. package/dist/commands/keys-list-json.d.ts +55 -0
  62. package/dist/commands/keys-list-json.d.ts.map +1 -0
  63. package/dist/commands/keys-list-json.js +54 -0
  64. package/dist/commands/keys-list-json.js.map +1 -0
  65. package/dist/commands/keys.d.ts.map +1 -1
  66. package/dist/commands/keys.js +6 -0
  67. package/dist/commands/keys.js.map +1 -1
  68. package/dist/commands/kg-classify.d.ts.map +1 -1
  69. package/dist/commands/kg-classify.js +20 -0
  70. package/dist/commands/kg-classify.js.map +1 -1
  71. package/dist/commands/kg-doctor.d.ts +67 -6
  72. package/dist/commands/kg-doctor.d.ts.map +1 -1
  73. package/dist/commands/kg-doctor.js +126 -46
  74. package/dist/commands/kg-doctor.js.map +1 -1
  75. package/dist/commands/lanes-list-json.d.ts +69 -0
  76. package/dist/commands/lanes-list-json.d.ts.map +1 -0
  77. package/dist/commands/lanes-list-json.js +42 -0
  78. package/dist/commands/lanes-list-json.js.map +1 -0
  79. package/dist/commands/lanes.d.ts.map +1 -1
  80. package/dist/commands/lanes.js +18 -7
  81. package/dist/commands/lanes.js.map +1 -1
  82. package/dist/commands/list.d.ts +27 -0
  83. package/dist/commands/list.d.ts.map +1 -1
  84. package/dist/commands/list.js +67 -19
  85. package/dist/commands/list.js.map +1 -1
  86. package/dist/commands/memory/status.d.ts +18 -0
  87. package/dist/commands/memory/status.d.ts.map +1 -1
  88. package/dist/commands/memory/status.js +38 -2
  89. package/dist/commands/memory/status.js.map +1 -1
  90. package/dist/commands/memory-service-container.d.ts +44 -0
  91. package/dist/commands/memory-service-container.d.ts.map +1 -1
  92. package/dist/commands/memory-service-container.js +49 -0
  93. package/dist/commands/memory-service-container.js.map +1 -1
  94. package/dist/commands/plans-list-json.d.ts +77 -0
  95. package/dist/commands/plans-list-json.d.ts.map +1 -0
  96. package/dist/commands/plans-list-json.js +61 -0
  97. package/dist/commands/plans-list-json.js.map +1 -0
  98. package/dist/commands/plans.d.ts.map +1 -1
  99. package/dist/commands/plans.js +10 -0
  100. package/dist/commands/plans.js.map +1 -1
  101. package/dist/commands/ps.d.ts +32 -0
  102. package/dist/commands/ps.d.ts.map +1 -1
  103. package/dist/commands/ps.js +34 -0
  104. package/dist/commands/ps.js.map +1 -1
  105. package/dist/commands/repos-list-json.d.ts +58 -0
  106. package/dist/commands/repos-list-json.d.ts.map +1 -0
  107. package/dist/commands/repos-list-json.js +45 -0
  108. package/dist/commands/repos-list-json.js.map +1 -0
  109. package/dist/commands/repos.d.ts +1 -1
  110. package/dist/commands/repos.d.ts.map +1 -1
  111. package/dist/commands/repos.js +12 -2
  112. package/dist/commands/repos.js.map +1 -1
  113. package/dist/commands/runbooks.d.ts +32 -0
  114. package/dist/commands/runbooks.d.ts.map +1 -1
  115. package/dist/commands/runbooks.js +79 -22
  116. package/dist/commands/runbooks.js.map +1 -1
  117. package/dist/commands/services.d.ts +47 -1
  118. package/dist/commands/services.d.ts.map +1 -1
  119. package/dist/commands/services.js +59 -33
  120. package/dist/commands/services.js.map +1 -1
  121. package/dist/commands/skills-source.d.ts.map +1 -1
  122. package/dist/commands/skills-source.js +77 -2
  123. package/dist/commands/skills-source.js.map +1 -1
  124. package/dist/commands/skills.d.ts +27 -0
  125. package/dist/commands/skills.d.ts.map +1 -1
  126. package/dist/commands/skills.js +17 -2
  127. package/dist/commands/skills.js.map +1 -1
  128. package/dist/commands/upgrade-history.d.ts +0 -2
  129. package/dist/commands/upgrade-history.d.ts.map +1 -1
  130. package/dist/commands/upgrade-history.js +0 -6
  131. package/dist/commands/upgrade-history.js.map +1 -1
  132. package/dist/commands/upgrade-lock.d.ts +0 -9
  133. package/dist/commands/upgrade-lock.d.ts.map +1 -1
  134. package/dist/commands/upgrade-lock.js +1 -1
  135. package/dist/commands/upgrade-lock.js.map +1 -1
  136. package/dist/commands/workspace-list-json.d.ts +73 -0
  137. package/dist/commands/workspace-list-json.d.ts.map +1 -0
  138. package/dist/commands/workspace-list-json.js +59 -0
  139. package/dist/commands/workspace-list-json.js.map +1 -0
  140. package/dist/commands/workspace.d.ts.map +1 -1
  141. package/dist/commands/workspace.js +7 -1
  142. package/dist/commands/workspace.js.map +1 -1
  143. package/dist/commands/world-snapshot.d.ts +13 -0
  144. package/dist/commands/world-snapshot.d.ts.map +1 -1
  145. package/dist/commands/world-snapshot.js +81 -1
  146. package/dist/commands/world-snapshot.js.map +1 -1
  147. package/dist/commands/yolo.d.ts +0 -4
  148. package/dist/commands/yolo.d.ts.map +1 -1
  149. package/dist/commands/yolo.js +2 -2
  150. package/dist/commands/yolo.js.map +1 -1
  151. package/dist/image-digests.json +8 -8
  152. package/dist/index.js +6097 -2563
  153. package/dist/index.js.map +1 -1
  154. package/dist/lib/anthropic-base-url-file.d.ts +37 -0
  155. package/dist/lib/anthropic-base-url-file.d.ts.map +1 -0
  156. package/dist/lib/anthropic-base-url-file.js +46 -0
  157. package/dist/lib/anthropic-base-url-file.js.map +1 -0
  158. package/dist/lib/auth-remote.d.ts +9 -0
  159. package/dist/lib/auth-remote.d.ts.map +1 -1
  160. package/dist/lib/auth-remote.js +19 -4
  161. package/dist/lib/auth-remote.js.map +1 -1
  162. package/dist/lib/cf-access-token.d.ts +32 -0
  163. package/dist/lib/cf-access-token.d.ts.map +1 -0
  164. package/dist/lib/cf-access-token.js +52 -0
  165. package/dist/lib/cf-access-token.js.map +1 -0
  166. package/dist/lib/config.d.ts +17 -3
  167. package/dist/lib/config.d.ts.map +1 -1
  168. package/dist/lib/config.js +28 -4
  169. package/dist/lib/config.js.map +1 -1
  170. package/dist/lib/k8s-bootstrap.d.ts.map +1 -1
  171. package/dist/lib/k8s-bootstrap.js +13 -1
  172. package/dist/lib/k8s-bootstrap.js.map +1 -1
  173. package/dist/lib/k8s-secret-render.d.ts +2 -0
  174. package/dist/lib/k8s-secret-render.d.ts.map +1 -1
  175. package/dist/lib/k8s-secret-render.js +27 -0
  176. package/dist/lib/k8s-secret-render.js.map +1 -1
  177. package/dist/lib/kubectl-context.d.ts +49 -0
  178. package/dist/lib/kubectl-context.d.ts.map +1 -1
  179. package/dist/lib/kubectl-context.js +64 -2
  180. package/dist/lib/kubectl-context.js.map +1 -1
  181. package/dist/lib/peripheral-registry.d.ts +1 -1
  182. package/dist/lib/peripheral-registry.d.ts.map +1 -1
  183. package/dist/lib/peripheral-registry.js +13 -0
  184. package/dist/lib/peripheral-registry.js.map +1 -1
  185. package/dist/lib/upgrade-kubernetes.d.ts +13 -0
  186. package/dist/lib/upgrade-kubernetes.d.ts.map +1 -1
  187. package/dist/lib/upgrade-kubernetes.js +42 -9
  188. package/dist/lib/upgrade-kubernetes.js.map +1 -1
  189. package/dist/mcp-server.js +2624 -1041
  190. package/hermes-bundle/version.json +1 -1
  191. package/host-cp/k8s/manifests/30-configmap.yaml +11 -6
  192. package/host-cp/k8s/manifests/45-pvc.yaml +6 -2
  193. package/host-cp/k8s/manifests/50-deployment.yaml +15 -1
  194. package/host-cp/k8s/manifests/auth-service/50-deployment.yaml +1 -1
  195. package/host-cp/k8s/manifests/kg-service/50-deployment.yaml +1 -1
  196. package/host-cp/k8s/manifests/mcp-auth-service/50-deployment.yaml +1 -1
  197. package/host-cp/k8s/manifests/memory-service/50-deployment.yaml +1 -1
  198. package/host-cp/k8s/templates/chunks-postgres-secret-template.yaml +24 -0
  199. package/host-cp/k8s/templates/plan-chat-service-secret-template.yaml +35 -0
  200. package/host-cp/observability/trace-summary.mjs +267 -0
  201. package/host-cp/src/bootstrap-selective.mjs +30 -28
  202. package/host-cp/src/host-stream.mjs +52 -0
  203. package/host-cp/src/plan-chat-service.mjs +99 -74
  204. package/host-cp/src/redirect.mjs +7 -0
  205. package/host-cp/src/router.mjs +168 -0
  206. package/host-cp/src/serve-only-config.mjs +85 -0
  207. package/host-cp/src/server.mjs +482 -217
  208. package/host-cp/src/world-services.mjs +136 -0
  209. package/package.json +4 -2
@@ -0,0 +1,136 @@
1
+ // Service enrichment (Phase F-2-D dogfood fix) — extracted from server.mjs.
2
+ //
3
+ // Fetch port bindings for a world's container via docker-socket-proxy
4
+ // inspect, map each to a clickable URL tagged with well-known internal
5
+ // ports, and probe each for actual reachability.
6
+ //
7
+ // Extracted as a standalone module so the probe + enrichment logic can be
8
+ // unit-tested in isolation (server.mjs has module-level side effects that
9
+ // make direct import impractical). The two host-specific values that the
10
+ // inline version read from server.mjs module constants — HOST_FOR_WORLD and
11
+ // DOCKER_HOST — are injected as a `deps` object so the functions stay pure
12
+ // and deterministically testable.
13
+
14
+ export const WELL_KNOWN_PORTS = {
15
+ 3000: 'atlas-core (Rails)',
16
+ 5175: 'diner-app (Vite)',
17
+ 7681: 'Terminal (ttyd)',
18
+ 7682: 'Terminal Shell (ttyd)',
19
+ 8080: 'Per-world CP',
20
+ };
21
+
22
+ /**
23
+ * Quick liveness probe against a service URL. Returns true if the
24
+ * service responds with ANY HTTP response (1xx-5xx) — we don't care
25
+ * about status codes because each app has its own conventions (Vite
26
+ * 200s on /, ttyd may 401, Rails may 500 on /, the per-world CP 200s).
27
+ * What matters is that something is listening.
28
+ *
29
+ * Probed from inside the host-cp container so we use hostForWorld
30
+ * (host.docker.internal on macOS/Windows, 172.17.0.1 on Linux) — the
31
+ * SPA's own 127.0.0.1:<port> URL is unreachable from container-side.
32
+ *
33
+ * Tight 800ms timeout. Worst case: 4 services × 800ms in parallel ≤ 1s
34
+ * added to the /api/worlds response — acceptable for a 4s poll cycle.
35
+ *
36
+ * @param {number} hostPort
37
+ * @param {{ hostForWorld: string }} deps
38
+ * @returns {Promise<boolean>}
39
+ */
40
+ export async function probeServiceLive(hostPort, { hostForWorld }) {
41
+ const probeUrl = `http://${hostForWorld}:${hostPort}/`;
42
+ try {
43
+ const res = await fetch(probeUrl, {
44
+ method: 'HEAD',
45
+ signal: AbortSignal.timeout(800),
46
+ redirect: 'manual',
47
+ });
48
+ return res.status > 0;
49
+ } catch {
50
+ // ECONNREFUSED, timeout, DNS — anything counts as not-live. Try
51
+ // GET as a fallback because some servers (e.g. ttyd) close on HEAD
52
+ // and we don't want false negatives from picky upstream behavior.
53
+ try {
54
+ const res2 = await fetch(probeUrl, {
55
+ method: 'GET',
56
+ signal: AbortSignal.timeout(800),
57
+ redirect: 'manual',
58
+ });
59
+ return res2.status > 0;
60
+ } catch {
61
+ return false;
62
+ }
63
+ }
64
+ }
65
+
66
+ /**
67
+ * Get the running container's port bindings from socket-proxy + map
68
+ * each to a clickable URL. Each service is then probed in parallel
69
+ * for actual reachability — the docker port mapping just tells us
70
+ * what's CONFIGURED; the probe confirms what's actually LISTENING.
71
+ *
72
+ * Returns [] on any docker-inspect failure (container missing, socket-
73
+ * proxy down) so the API still returns a valid worlds list.
74
+ *
75
+ * @param {string} worldId
76
+ * @param {{ hostForWorld: string, dockerHost: string }} deps
77
+ * @returns {Promise<Array<{name: string, host_port: number, internal_port: number, url: string, live: boolean}>>}
78
+ */
79
+ export async function fetchWorldServices(worldId, { hostForWorld, dockerHost }) {
80
+ const containerName = `olam-${worldId}-devbox`;
81
+ let data;
82
+ try {
83
+ if (dockerHost === 'docker-cli') {
84
+ // Bare-node mode: shell out to `docker inspect` instead of HTTP.
85
+ // Same fix pattern as fetchContainerSecret (PR #108). Without
86
+ // this, the services array is always empty in bare-node and the
87
+ // SPA can't find the ttyd host port → terminal renders blank.
88
+ const { spawnSync } = await import('node:child_process');
89
+ const result = spawnSync(
90
+ 'docker',
91
+ ['inspect', containerName],
92
+ { encoding: 'utf-8', timeout: 2000 },
93
+ );
94
+ if (result.status !== 0) return [];
95
+ const arr = JSON.parse(result.stdout || '[]');
96
+ data = Array.isArray(arr) && arr.length > 0 ? arr[0] : null;
97
+ if (!data) return [];
98
+ } else {
99
+ const apiBase = dockerHost.replace(/^tcp:\/\//, 'http://');
100
+ const res = await fetch(`${apiBase}/containers/${encodeURIComponent(containerName)}/json`, {
101
+ signal: AbortSignal.timeout(2000),
102
+ });
103
+ if (!res.ok) return [];
104
+ data = await res.json();
105
+ }
106
+ const ports = data?.NetworkSettings?.Ports ?? {};
107
+ const draft = [];
108
+ for (const [internal, bindings] of Object.entries(ports)) {
109
+ if (!Array.isArray(bindings) || bindings.length === 0) continue;
110
+ const internalPort = parseInt(internal.split('/')[0], 10);
111
+ const hostPort = parseInt(bindings[0].HostPort, 10);
112
+ if (!Number.isFinite(internalPort) || !Number.isFinite(hostPort)) continue;
113
+ draft.push({
114
+ name: WELL_KNOWN_PORTS[internalPort] ?? `App (port ${internalPort})`,
115
+ host_port: hostPort,
116
+ internal_port: internalPort,
117
+ url: `http://127.0.0.1:${hostPort}`,
118
+ });
119
+ }
120
+
121
+ // Probe each service in parallel for actual reachability. Adds a
122
+ // `live: boolean` field. The UI dims chips for non-live services
123
+ // so operators can see what's configured-but-down vs configured-
124
+ // and-up at a glance.
125
+ const liveResults = await Promise.all(
126
+ draft.map((s) => probeServiceLive(s.host_port, { hostForWorld })),
127
+ );
128
+ const services = draft.map((s, i) => ({ ...s, live: liveResults[i] }));
129
+
130
+ // Stable order: well-known ports first (CP, then Rails/Vite, then terminal).
131
+ services.sort((a, b) => a.internal_port - b.internal_port);
132
+ return services;
133
+ } catch {
134
+ return [];
135
+ }
136
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pleri/olam-cli",
3
- "version": "0.1.180",
3
+ "version": "0.1.185",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "olam": "./bin/olam.cjs"
@@ -26,7 +26,8 @@
26
26
  "access": "public"
27
27
  },
28
28
  "scripts": {
29
- "build": "tsc",
29
+ "build": "npm run gen:knowledge-pack && tsc",
30
+ "gen:knowledge-pack": "node scripts/gen-knowledge-pack.mjs",
30
31
  "dev": "tsx src/index.ts",
31
32
  "test": "vitest run --passWithNoTests",
32
33
  "test:ci": "vitest run --reporter=basic --passWithNoTests",
@@ -45,6 +46,7 @@
45
46
  "ssh2": "^1.16.0",
46
47
  "yaml": "^2.7.0",
47
48
  "@inquirer/prompts": "^7.0.0",
49
+ "@anthropic-ai/claude-agent-sdk": "^0.2.56",
48
50
  "zod-to-json-schema": "^3.24.0",
49
51
  "playwright-core": "~1.59.0",
50
52
  "@napi-rs/keyring": "^1.1.6"