@pleri/olam-cli 0.1.152 → 0.1.157
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.
- package/dist/commands/bootstrap.d.ts +2 -1
- package/dist/commands/bootstrap.d.ts.map +1 -1
- package/dist/commands/bootstrap.js +8 -10
- package/dist/commands/bootstrap.js.map +1 -1
- package/dist/commands/doctor.d.ts +46 -0
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +146 -8
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/flywheel/check-persona-skeleton.d.ts +7 -0
- package/dist/commands/flywheel/check-persona-skeleton.d.ts.map +1 -0
- package/dist/commands/flywheel/check-persona-skeleton.js +14 -0
- package/dist/commands/flywheel/check-persona-skeleton.js.map +1 -0
- package/dist/commands/flywheel/diversity-check.d.ts +7 -0
- package/dist/commands/flywheel/diversity-check.d.ts.map +1 -0
- package/dist/commands/flywheel/diversity-check.js +14 -0
- package/dist/commands/flywheel/diversity-check.js.map +1 -0
- package/dist/commands/flywheel/emit-breadcrumb.d.ts +20 -0
- package/dist/commands/flywheel/emit-breadcrumb.d.ts.map +1 -0
- package/dist/commands/flywheel/emit-breadcrumb.js +137 -0
- package/dist/commands/flywheel/emit-breadcrumb.js.map +1 -0
- package/dist/commands/flywheel/index.d.ts +27 -0
- package/dist/commands/flywheel/index.d.ts.map +1 -0
- package/dist/commands/flywheel/index.js +48 -0
- package/dist/commands/flywheel/index.js.map +1 -0
- package/dist/commands/flywheel/install-shims.d.ts +8 -0
- package/dist/commands/flywheel/install-shims.d.ts.map +1 -0
- package/dist/commands/flywheel/install-shims.js +15 -0
- package/dist/commands/flywheel/install-shims.js.map +1 -0
- package/dist/commands/flywheel/k10-measure.d.ts +7 -0
- package/dist/commands/flywheel/k10-measure.d.ts.map +1 -0
- package/dist/commands/flywheel/k10-measure.js +14 -0
- package/dist/commands/flywheel/k10-measure.js.map +1 -0
- package/dist/commands/flywheel/k5-score.d.ts +14 -0
- package/dist/commands/flywheel/k5-score.d.ts.map +1 -0
- package/dist/commands/flywheel/k5-score.js +59 -0
- package/dist/commands/flywheel/k5-score.js.map +1 -0
- package/dist/commands/flywheel/k5-validate.d.ts +15 -0
- package/dist/commands/flywheel/k5-validate.d.ts.map +1 -0
- package/dist/commands/flywheel/k5-validate.js +185 -0
- package/dist/commands/flywheel/k5-validate.js.map +1 -0
- package/dist/commands/flywheel/ping.d.ts +21 -0
- package/dist/commands/flywheel/ping.d.ts.map +1 -0
- package/dist/commands/flywheel/ping.js +79 -0
- package/dist/commands/flywheel/ping.js.map +1 -0
- package/dist/commands/flywheel/sanitize-persona-output.d.ts +7 -0
- package/dist/commands/flywheel/sanitize-persona-output.d.ts.map +1 -0
- package/dist/commands/flywheel/sanitize-persona-output.js +14 -0
- package/dist/commands/flywheel/sanitize-persona-output.js.map +1 -0
- package/dist/commands/hermes-kg-hook.d.ts +36 -0
- package/dist/commands/hermes-kg-hook.d.ts.map +1 -0
- package/dist/commands/hermes-kg-hook.js +80 -0
- package/dist/commands/hermes-kg-hook.js.map +1 -0
- package/dist/commands/hermes.d.ts +46 -0
- package/dist/commands/hermes.d.ts.map +1 -0
- package/dist/commands/hermes.js +320 -0
- package/dist/commands/hermes.js.map +1 -0
- package/dist/commands/host-cp.d.ts.map +1 -1
- package/dist/commands/host-cp.js +17 -0
- package/dist/commands/host-cp.js.map +1 -1
- package/dist/commands/kg-install-hook.d.ts +7 -1
- package/dist/commands/kg-install-hook.d.ts.map +1 -1
- package/dist/commands/kg-install-hook.js +122 -6
- package/dist/commands/kg-install-hook.js.map +1 -1
- package/dist/commands/memory/_paths.d.ts +13 -3
- package/dist/commands/memory/_paths.d.ts.map +1 -1
- package/dist/commands/memory/_paths.js +25 -22
- package/dist/commands/memory/_paths.js.map +1 -1
- package/dist/commands/memory/logs.d.ts +8 -4
- package/dist/commands/memory/logs.d.ts.map +1 -1
- package/dist/commands/memory/logs.js +18 -13
- package/dist/commands/memory/logs.js.map +1 -1
- package/dist/commands/memory/mode.d.ts.map +1 -1
- package/dist/commands/memory/mode.js +7 -3
- package/dist/commands/memory/mode.js.map +1 -1
- package/dist/commands/memory/start.d.ts +16 -14
- package/dist/commands/memory/start.d.ts.map +1 -1
- package/dist/commands/memory/start.js +55 -189
- package/dist/commands/memory/start.js.map +1 -1
- package/dist/commands/memory/status.d.ts +10 -8
- package/dist/commands/memory/status.d.ts.map +1 -1
- package/dist/commands/memory/status.js +35 -38
- package/dist/commands/memory/status.js.map +1 -1
- package/dist/commands/memory/stop.d.ts +5 -4
- package/dist/commands/memory/stop.d.ts.map +1 -1
- package/dist/commands/memory/stop.js +26 -55
- package/dist/commands/memory/stop.js.map +1 -1
- package/dist/commands/memory-service-container.d.ts +78 -0
- package/dist/commands/memory-service-container.d.ts.map +1 -0
- package/dist/commands/memory-service-container.js +187 -0
- package/dist/commands/memory-service-container.js.map +1 -0
- package/dist/commands/services.d.ts +16 -1
- package/dist/commands/services.d.ts.map +1 -1
- package/dist/commands/services.js +97 -38
- package/dist/commands/services.js.map +1 -1
- package/dist/commands/substrate.d.ts +19 -1
- package/dist/commands/substrate.d.ts.map +1 -1
- package/dist/commands/substrate.js +19 -11
- package/dist/commands/substrate.js.map +1 -1
- package/dist/commands/upgrade.d.ts.map +1 -1
- package/dist/commands/upgrade.js +11 -0
- package/dist/commands/upgrade.js.map +1 -1
- package/dist/image-digests.json +7 -7
- package/dist/index.js +3662 -2044
- package/dist/index.js.map +1 -1
- package/dist/lib/auth-refresh-kubernetes.d.ts +3 -0
- package/dist/lib/auth-refresh-kubernetes.d.ts.map +1 -1
- package/dist/lib/auth-refresh-kubernetes.js +6 -17
- package/dist/lib/auth-refresh-kubernetes.js.map +1 -1
- package/dist/lib/health-probes.d.ts +20 -0
- package/dist/lib/health-probes.d.ts.map +1 -1
- package/dist/lib/health-probes.js +55 -0
- package/dist/lib/health-probes.js.map +1 -1
- package/dist/lib/k8s-bootstrap.d.ts +120 -0
- package/dist/lib/k8s-bootstrap.d.ts.map +1 -0
- package/dist/lib/k8s-bootstrap.js +193 -0
- package/dist/lib/k8s-bootstrap.js.map +1 -0
- package/dist/lib/k8s-secret-render.d.ts +139 -0
- package/dist/lib/k8s-secret-render.d.ts.map +1 -0
- package/dist/lib/k8s-secret-render.js +281 -0
- package/dist/lib/k8s-secret-render.js.map +1 -0
- package/dist/lib/kubectl-context.d.ts +38 -0
- package/dist/lib/kubectl-context.d.ts.map +1 -0
- package/dist/lib/kubectl-context.js +43 -0
- package/dist/lib/kubectl-context.js.map +1 -0
- package/dist/lib/memory-host-process-migration.d.ts +56 -0
- package/dist/lib/memory-host-process-migration.d.ts.map +1 -0
- package/dist/lib/memory-host-process-migration.js +156 -0
- package/dist/lib/memory-host-process-migration.js.map +1 -0
- package/dist/lib/upgrade-kubernetes.d.ts +42 -0
- package/dist/lib/upgrade-kubernetes.d.ts.map +1 -1
- package/dist/lib/upgrade-kubernetes.js +258 -24
- package/dist/lib/upgrade-kubernetes.js.map +1 -1
- package/dist/mcp-server.js +56 -22
- package/hermes-bundle/kg-first.sh +100 -0
- package/hermes-bundle/version.json +4 -0
- package/host-cp/k8s/manifests/50-deployment.yaml +54 -27
- package/host-cp/k8s/manifests/auth-service/30-configmap.yaml +5 -0
- package/host-cp/k8s/manifests/auth-service/50-deployment.yaml +5 -1
- package/host-cp/k8s/manifests/kg-service/30-configmap.yaml +5 -0
- package/host-cp/k8s/manifests/kg-service/50-deployment.yaml +5 -1
- package/host-cp/k8s/manifests/mcp-auth-service/30-configmap.yaml +4 -0
- package/host-cp/k8s/manifests/mcp-auth-service/50-deployment.yaml +5 -1
- package/host-cp/k8s/manifests/memory-service/30-configmap.yaml +4 -0
- package/host-cp/k8s/manifests/memory-service/50-deployment.yaml +5 -1
- package/package.json +3 -4
- package/memory-service-bundle/scripts/ensure-iii-engine.mjs +0 -179
|
@@ -1,77 +1,48 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* olam memory stop —
|
|
2
|
+
* olam memory stop — stop the agent-memory Docker container.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Phase B substrate: delegates to `MemoryServiceContainerController.stop()`.
|
|
5
|
+
* Also cleans up any residual Phase A legacy state (`~/.olam/memory.pid` +
|
|
6
|
+
* the log file) via `migrateFromHostProcess({ removeLog: true })`.
|
|
6
7
|
*
|
|
7
|
-
* Plan reference: docs/plans/
|
|
8
|
+
* Plan reference: docs/plans/memory-service-as-docker-peripheral/phase-b-tasks.md B2
|
|
8
9
|
*/
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
const SIGTERM_GRACE_MS = 10_000;
|
|
13
|
-
const POLL_MS = 250;
|
|
14
|
-
function isAlive(pid) {
|
|
15
|
-
try {
|
|
16
|
-
process.kill(pid, 0);
|
|
17
|
-
return true;
|
|
18
|
-
}
|
|
19
|
-
catch {
|
|
20
|
-
return false;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
10
|
+
import { printSuccess, printInfo, printHeader, printWarning } from '../../output.js';
|
|
11
|
+
import { MemoryServiceContainerController } from '../memory-service-container.js';
|
|
12
|
+
import { migrateFromHostProcess } from '../../lib/memory-host-process-migration.js';
|
|
23
13
|
export async function runMemoryStop() {
|
|
24
14
|
printHeader('olam memory stop');
|
|
25
|
-
|
|
26
|
-
|
|
15
|
+
// Always sweep up legacy state. Stop is the canonical "remove all running
|
|
16
|
+
// agent-memory" verb; we additionally remove the log file here (vs start.ts
|
|
17
|
+
// which leaves it in place — see B5's removeLog flag).
|
|
18
|
+
const migration = migrateFromHostProcess({ removeLog: true });
|
|
19
|
+
if (migration.cleaned) {
|
|
20
|
+
printInfo('migration', migration.summary);
|
|
21
|
+
}
|
|
22
|
+
const controller = new MemoryServiceContainerController();
|
|
23
|
+
const current = controller.status();
|
|
24
|
+
if (current.state === 'missing') {
|
|
25
|
+
printSuccess('no olam-memory-service container present (nothing to stop)');
|
|
27
26
|
return 0;
|
|
28
27
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
printWarning(`pidfile contained invalid value; removing`);
|
|
32
|
-
unlinkSync(MEMORY_PID_PATH);
|
|
28
|
+
if (current.state === 'stopped') {
|
|
29
|
+
printSuccess('olam-memory-service container already stopped');
|
|
33
30
|
return 0;
|
|
34
31
|
}
|
|
35
|
-
if (!isAlive(pid)) {
|
|
36
|
-
printSuccess(`pid ${pid} is not running (stale pidfile); cleaned up`);
|
|
37
|
-
unlinkSync(MEMORY_PID_PATH);
|
|
38
|
-
return 0;
|
|
39
|
-
}
|
|
40
|
-
printInfo('pid', `${pid}`);
|
|
41
32
|
try {
|
|
42
|
-
|
|
33
|
+
controller.stop();
|
|
43
34
|
}
|
|
44
35
|
catch (err) {
|
|
45
|
-
printWarning(`
|
|
46
|
-
|
|
47
|
-
// Wait for graceful exit
|
|
48
|
-
const deadline = Date.now() + SIGTERM_GRACE_MS;
|
|
49
|
-
while (Date.now() < deadline) {
|
|
50
|
-
if (!isAlive(pid))
|
|
51
|
-
break;
|
|
52
|
-
await new Promise((r) => setTimeout(r, POLL_MS));
|
|
53
|
-
}
|
|
54
|
-
if (isAlive(pid)) {
|
|
55
|
-
printWarning(`pid ${pid} did not exit within ${SIGTERM_GRACE_MS / 1000}s; sending SIGKILL`);
|
|
56
|
-
try {
|
|
57
|
-
process.kill(pid, 'SIGKILL');
|
|
58
|
-
}
|
|
59
|
-
catch (err) {
|
|
60
|
-
printWarning(`SIGKILL to pid ${pid} failed: ${err.message}`);
|
|
61
|
-
}
|
|
62
|
-
// Brief wait for SIGKILL to take effect
|
|
63
|
-
await new Promise((r) => setTimeout(r, 500));
|
|
64
|
-
}
|
|
65
|
-
if (existsSync(MEMORY_PID_PATH)) {
|
|
66
|
-
unlinkSync(MEMORY_PID_PATH);
|
|
36
|
+
printWarning(`docker stop failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
37
|
+
return 1;
|
|
67
38
|
}
|
|
68
|
-
printSuccess(
|
|
39
|
+
printSuccess('olam-memory-service stopped');
|
|
69
40
|
return 0;
|
|
70
41
|
}
|
|
71
42
|
export function registerMemoryStop(cmd) {
|
|
72
43
|
cmd
|
|
73
44
|
.command('stop')
|
|
74
|
-
.description('Stop the
|
|
45
|
+
.description('Stop the agent-memory Docker container (Phase B substrate; idempotent).')
|
|
75
46
|
.action(async () => {
|
|
76
47
|
const rc = await runMemoryStop();
|
|
77
48
|
if (rc !== 0)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stop.js","sourceRoot":"","sources":["../../../src/commands/memory/stop.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"stop.js","sourceRoot":"","sources":["../../../src/commands/memory/stop.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACrF,OAAO,EAAE,gCAAgC,EAAE,MAAM,gCAAgC,CAAC;AAClF,OAAO,EAAE,sBAAsB,EAAE,MAAM,4CAA4C,CAAC;AAEpF,MAAM,CAAC,KAAK,UAAU,aAAa;IACjC,WAAW,CAAC,kBAAkB,CAAC,CAAC;IAEhC,0EAA0E;IAC1E,4EAA4E;IAC5E,uDAAuD;IACvD,MAAM,SAAS,GAAG,sBAAsB,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9D,IAAI,SAAS,CAAC,OAAO,EAAE,CAAC;QACtB,SAAS,CAAC,WAAW,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;IAC5C,CAAC;IAED,MAAM,UAAU,GAAG,IAAI,gCAAgC,EAAE,CAAC;IAC1D,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC;IACpC,IAAI,OAAO,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;QAChC,YAAY,CAAC,4DAA4D,CAAC,CAAC;QAC3E,OAAO,CAAC,CAAC;IACX,CAAC;IACD,IAAI,OAAO,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;QAChC,YAAY,CAAC,+CAA+C,CAAC,CAAC;QAC9D,OAAO,CAAC,CAAC;IACX,CAAC;IAED,IAAI,CAAC;QACH,UAAU,CAAC,IAAI,EAAE,CAAC;IACpB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,YAAY,CAAC,uBAAuB,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACxF,OAAO,CAAC,CAAC;IACX,CAAC;IACD,YAAY,CAAC,6BAA6B,CAAC,CAAC;IAC5C,OAAO,CAAC,CAAC;AACX,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,GAAY;IAC7C,GAAG;SACA,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,yEAAyE,CAAC;SACtF,MAAM,CAAC,KAAK,IAAI,EAAE;QACjB,MAAM,EAAE,GAAG,MAAM,aAAa,EAAE,CAAC;QACjC,IAAI,EAAE,KAAK,CAAC;YAAE,OAAO,CAAC,QAAQ,GAAG,EAAE,CAAC;IACtC,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MemoryServiceContainerController — lifecycle for olam-memory-service.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors KgServiceContainerController (./kg-service-container.ts). memory-service,
|
|
5
|
+
* like kg-service, runs as a host-side Docker peripheral managed by `olam services up`.
|
|
6
|
+
* The Phase A predecessor (host-process model — `olam memory start` spawning the
|
|
7
|
+
* npm-installed `agentmemory` bin) is retired in Phase B; both substrates coexist
|
|
8
|
+
* during Phase A so operators can roll back without losing data
|
|
9
|
+
* (`~/.olam/memory-data/` is bind-mounted and survives substrate swap).
|
|
10
|
+
*
|
|
11
|
+
* Divergence from kg-service:
|
|
12
|
+
* - Bearer-authenticated livez probe (kg-service `/health` is unauthenticated).
|
|
13
|
+
* `waitForReady` reads `~/.olam/memory-secret` and adds `Authorization: Bearer <secret>`.
|
|
14
|
+
* - No /host-home read-only mount (kg-service mounts $HOME for build ingestion;
|
|
15
|
+
* memory-service writes only to its own /data volume).
|
|
16
|
+
* - No prewarm probe (kg-service pre-warms bge-small inference; memory-service has
|
|
17
|
+
* no equivalent hot path — iii engine init happens at process start, not first request).
|
|
18
|
+
*
|
|
19
|
+
* Plan reference: docs/plans/memory-service-as-docker-peripheral/phase-a-tasks.md A1
|
|
20
|
+
*/
|
|
21
|
+
export declare const MEMORY_SERVICE_PORT = 3111;
|
|
22
|
+
export declare const MEMORY_SERVICE_CONTAINER = "olam-memory-service";
|
|
23
|
+
export declare const MEMORY_SERVICE_LOCAL_TAG = "olam-memory-service:local";
|
|
24
|
+
export declare const MEMORY_SERVICE_PUBLISHED_TAG = "ghcr.io/pleri/olam-memory-service:latest";
|
|
25
|
+
export declare const MEMORY_SERVICE_DEV_TAG = "olam-memory-service:dev";
|
|
26
|
+
export declare const MEMORY_SERVICE_HEALTH_URL = "http://127.0.0.1:3111/agentmemory/livez";
|
|
27
|
+
export declare const MEMORY_SERVICE_HEALTH_TIMEOUT_MS = 60000;
|
|
28
|
+
type ContainerState = 'running' | 'stopped' | 'missing';
|
|
29
|
+
export interface MemoryServiceStatus {
|
|
30
|
+
readonly state: ContainerState;
|
|
31
|
+
readonly port: number;
|
|
32
|
+
readonly containerId?: string;
|
|
33
|
+
readonly ready?: boolean;
|
|
34
|
+
}
|
|
35
|
+
export declare class MemoryServiceContainerController {
|
|
36
|
+
private imageTag;
|
|
37
|
+
status(): MemoryServiceStatus;
|
|
38
|
+
private imageExists;
|
|
39
|
+
/**
|
|
40
|
+
* Resolve the first available image tag: local → dev → published.
|
|
41
|
+
* Throws if none exist (operator should run `olam bootstrap` to pull, or
|
|
42
|
+
* `node packages/cli/scripts/build-memory-service-image.mjs` to build locally).
|
|
43
|
+
*/
|
|
44
|
+
private resolveImage;
|
|
45
|
+
/**
|
|
46
|
+
* Idempotent start. If already running → return. If stopped → docker start.
|
|
47
|
+
* If missing → ensure secret + bind-mount dir, then docker run with port-forward
|
|
48
|
+
* + memory-data volume mount + restart policy + bearer-secret env.
|
|
49
|
+
*
|
|
50
|
+
* The bearer secret is read from `~/.olam/memory-secret` (generated on first
|
|
51
|
+
* call via `ensureMemorySecret()`) and passed as `AGENTMEMORY_SECRET`. The
|
|
52
|
+
* container's agentmemory CLI requires this for the livez probe + all API
|
|
53
|
+
* calls; without it the container will start but reject every request as 401.
|
|
54
|
+
*/
|
|
55
|
+
start(): void;
|
|
56
|
+
/**
|
|
57
|
+
* Returns true when no memory-service image exists locally — useful for
|
|
58
|
+
* callers (e.g. servicesUp) to distinguish "operator opted out of
|
|
59
|
+
* memory-service" from "memory-service was supposed to work but is broken".
|
|
60
|
+
* The opted-out case should be silent; the broken case should warn.
|
|
61
|
+
*/
|
|
62
|
+
imageMissingEverywhere(): boolean;
|
|
63
|
+
stop(): void;
|
|
64
|
+
remove(): void;
|
|
65
|
+
/**
|
|
66
|
+
* Poll /agentmemory/livez until 200 OK with `{status: "ok"}` body OR
|
|
67
|
+
* timeoutMs elapses. The probe is bearer-authenticated; without the secret
|
|
68
|
+
* header agentmemory returns 401 regardless of container state.
|
|
69
|
+
*
|
|
70
|
+
* Divergence from kg-service: kg-service's `/health` is unauthenticated and
|
|
71
|
+
* returns `{ready: true}` once bge-small is loaded. memory-service's
|
|
72
|
+
* `/agentmemory/livez` returns `{status: "ok"}` once iii-engine accepts
|
|
73
|
+
* connections — there's no equivalent "model warmed" state to wait for.
|
|
74
|
+
*/
|
|
75
|
+
waitForReady(timeoutMs?: number): Promise<boolean>;
|
|
76
|
+
}
|
|
77
|
+
export {};
|
|
78
|
+
//# sourceMappingURL=memory-service-container.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory-service-container.d.ts","sourceRoot":"","sources":["../../src/commands/memory-service-container.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAQH,eAAO,MAAM,mBAAmB,OAAO,CAAC;AACxC,eAAO,MAAM,wBAAwB,wBAAwB,CAAC;AAC9D,eAAO,MAAM,wBAAwB,8BAA8B,CAAC;AACpE,eAAO,MAAM,4BAA4B,6CAA6C,CAAC;AACvF,eAAO,MAAM,sBAAsB,4BAA4B,CAAC;AAChE,eAAO,MAAM,yBAAyB,4CAA8D,CAAC;AAKrG,eAAO,MAAM,gCAAgC,QAAS,CAAC;AAOvD,KAAK,cAAc,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;AAExD,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;CAC1B;AAeD,qBAAa,gCAAgC;IAC3C,OAAO,CAAC,QAAQ,CAAoC;IAEpD,MAAM,IAAI,mBAAmB;IAiB7B,OAAO,CAAC,WAAW;IAInB;;;;OAIG;IACH,OAAO,CAAC,YAAY;IAUpB;;;;;;;;;OASG;IACH,KAAK,IAAI,IAAI;IA6Cb;;;;;OAKG;IACH,sBAAsB,IAAI,OAAO;IAQjC,IAAI,IAAI,IAAI;IAMZ,MAAM,IAAI,IAAI;IAId;;;;;;;;;OASG;IACG,YAAY,CAAC,SAAS,SAAmC,GAAG,OAAO,CAAC,OAAO,CAAC;CAoBnF"}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MemoryServiceContainerController — lifecycle for olam-memory-service.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors KgServiceContainerController (./kg-service-container.ts). memory-service,
|
|
5
|
+
* like kg-service, runs as a host-side Docker peripheral managed by `olam services up`.
|
|
6
|
+
* The Phase A predecessor (host-process model — `olam memory start` spawning the
|
|
7
|
+
* npm-installed `agentmemory` bin) is retired in Phase B; both substrates coexist
|
|
8
|
+
* during Phase A so operators can roll back without losing data
|
|
9
|
+
* (`~/.olam/memory-data/` is bind-mounted and survives substrate swap).
|
|
10
|
+
*
|
|
11
|
+
* Divergence from kg-service:
|
|
12
|
+
* - Bearer-authenticated livez probe (kg-service `/health` is unauthenticated).
|
|
13
|
+
* `waitForReady` reads `~/.olam/memory-secret` and adds `Authorization: Bearer <secret>`.
|
|
14
|
+
* - No /host-home read-only mount (kg-service mounts $HOME for build ingestion;
|
|
15
|
+
* memory-service writes only to its own /data volume).
|
|
16
|
+
* - No prewarm probe (kg-service pre-warms bge-small inference; memory-service has
|
|
17
|
+
* no equivalent hot path — iii engine init happens at process start, not first request).
|
|
18
|
+
*
|
|
19
|
+
* Plan reference: docs/plans/memory-service-as-docker-peripheral/phase-a-tasks.md A1
|
|
20
|
+
*/
|
|
21
|
+
import { execFileSync, spawnSync } from 'node:child_process';
|
|
22
|
+
import * as fs from 'node:fs';
|
|
23
|
+
import { homedir } from 'node:os';
|
|
24
|
+
import { join } from 'node:path';
|
|
25
|
+
import { ensureMemorySecret } from '../lib/memory-secret.js';
|
|
26
|
+
export const MEMORY_SERVICE_PORT = 3111;
|
|
27
|
+
export const MEMORY_SERVICE_CONTAINER = 'olam-memory-service';
|
|
28
|
+
export const MEMORY_SERVICE_LOCAL_TAG = 'olam-memory-service:local';
|
|
29
|
+
export const MEMORY_SERVICE_PUBLISHED_TAG = 'ghcr.io/pleri/olam-memory-service:latest';
|
|
30
|
+
export const MEMORY_SERVICE_DEV_TAG = 'olam-memory-service:dev';
|
|
31
|
+
export const MEMORY_SERVICE_HEALTH_URL = `http://127.0.0.1:${MEMORY_SERVICE_PORT}/agentmemory/livez`;
|
|
32
|
+
// Mirrors KgServiceContainerController: 60s timeout absorbs cold-start on flaky
|
|
33
|
+
// CI runners (image pull + iii-engine boot can exceed the operator-visible
|
|
34
|
+
// "took a moment" budget). Warm machines see ~3-5s.
|
|
35
|
+
export const MEMORY_SERVICE_HEALTH_TIMEOUT_MS = 60_000;
|
|
36
|
+
// memory-data is the host-mounted `~/.olam/memory-data/` so the container's
|
|
37
|
+
// agentmemory engine can persist iii-engine state to a path the operator can
|
|
38
|
+
// inspect + that survives `docker rm`.
|
|
39
|
+
const MEMORY_SERVICE_VOLUME_TARGET = '/data';
|
|
40
|
+
/**
|
|
41
|
+
* Resolves the operator's memory-data root for the host bind-mount.
|
|
42
|
+
*
|
|
43
|
+
* Mirrors kg-service's `kgDataHostPath()`: respects `$HOME` for testability,
|
|
44
|
+
* defaults to `~/.olam/memory-data` for the real operator path. Caller is
|
|
45
|
+
* responsible for ensuring the directory exists pre-bind-mount (Linux dockerd
|
|
46
|
+
* auto-creates as root:root if absent, which breaks subsequent host-side
|
|
47
|
+
* reads/writes from the operator's UID).
|
|
48
|
+
*/
|
|
49
|
+
function memoryDataHostPath() {
|
|
50
|
+
return join(homedir(), '.olam', 'memory-data');
|
|
51
|
+
}
|
|
52
|
+
export class MemoryServiceContainerController {
|
|
53
|
+
imageTag = MEMORY_SERVICE_LOCAL_TAG;
|
|
54
|
+
status() {
|
|
55
|
+
const r = spawnSync('docker', ['inspect', '--format', '{{.State.Status}}|{{.Id}}', MEMORY_SERVICE_CONTAINER], { encoding: 'utf-8' });
|
|
56
|
+
if (r.status === 0) {
|
|
57
|
+
const [stateRaw, id] = r.stdout.trim().split('|');
|
|
58
|
+
return {
|
|
59
|
+
state: stateRaw === 'running' ? 'running' : 'stopped',
|
|
60
|
+
port: MEMORY_SERVICE_PORT,
|
|
61
|
+
containerId: id,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
return { state: 'missing', port: MEMORY_SERVICE_PORT };
|
|
65
|
+
}
|
|
66
|
+
imageExists(tag = this.imageTag) {
|
|
67
|
+
return spawnSync('docker', ['image', 'inspect', tag], { encoding: 'utf-8' }).status === 0;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Resolve the first available image tag: local → dev → published.
|
|
71
|
+
* Throws if none exist (operator should run `olam bootstrap` to pull, or
|
|
72
|
+
* `node packages/cli/scripts/build-memory-service-image.mjs` to build locally).
|
|
73
|
+
*/
|
|
74
|
+
resolveImage() {
|
|
75
|
+
for (const tag of [MEMORY_SERVICE_LOCAL_TAG, MEMORY_SERVICE_DEV_TAG, MEMORY_SERVICE_PUBLISHED_TAG]) {
|
|
76
|
+
if (this.imageExists(tag))
|
|
77
|
+
return tag;
|
|
78
|
+
}
|
|
79
|
+
throw new Error(`memory-service image not found. Tried: ${MEMORY_SERVICE_LOCAL_TAG}, ${MEMORY_SERVICE_DEV_TAG}, ${MEMORY_SERVICE_PUBLISHED_TAG}. ` +
|
|
80
|
+
'Run `olam bootstrap` to pull the published image, or `node packages/cli/scripts/build-memory-service-image.mjs` to build locally.');
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Idempotent start. If already running → return. If stopped → docker start.
|
|
84
|
+
* If missing → ensure secret + bind-mount dir, then docker run with port-forward
|
|
85
|
+
* + memory-data volume mount + restart policy + bearer-secret env.
|
|
86
|
+
*
|
|
87
|
+
* The bearer secret is read from `~/.olam/memory-secret` (generated on first
|
|
88
|
+
* call via `ensureMemorySecret()`) and passed as `AGENTMEMORY_SECRET`. The
|
|
89
|
+
* container's agentmemory CLI requires this for the livez probe + all API
|
|
90
|
+
* calls; without it the container will start but reject every request as 401.
|
|
91
|
+
*/
|
|
92
|
+
start() {
|
|
93
|
+
const current = this.status();
|
|
94
|
+
if (current.state === 'running')
|
|
95
|
+
return;
|
|
96
|
+
if (current.state === 'stopped') {
|
|
97
|
+
execFileSync('docker', ['start', MEMORY_SERVICE_CONTAINER], { stdio: 'pipe' });
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
this.imageTag = this.resolveImage();
|
|
101
|
+
const memoryData = memoryDataHostPath();
|
|
102
|
+
const secret = ensureMemorySecret();
|
|
103
|
+
// Pre-create the host path with the operator's UID. Without this,
|
|
104
|
+
// dockerd on Linux auto-creates the bind-mount target as root:root,
|
|
105
|
+
// which breaks subsequent host-side reads from the operator's UID
|
|
106
|
+
// (EACCES). macOS Docker Desktop's user-mapped binds don't bite
|
|
107
|
+
// here but the explicit mkdir is portable + cheap.
|
|
108
|
+
fs.mkdirSync(memoryData, { recursive: true });
|
|
109
|
+
execFileSync('docker', [
|
|
110
|
+
'run',
|
|
111
|
+
'--detach',
|
|
112
|
+
'--name', MEMORY_SERVICE_CONTAINER,
|
|
113
|
+
'--restart', 'unless-stopped',
|
|
114
|
+
// Bind to 127.0.0.1 ONLY at the host port level — local-only by design.
|
|
115
|
+
'--publish', `127.0.0.1:${MEMORY_SERVICE_PORT}:${MEMORY_SERVICE_PORT}`,
|
|
116
|
+
// host-gateway lets this container reach the host. Worlds reach
|
|
117
|
+
// memory-service via the published 127.0.0.1:3111 PLUS their OWN
|
|
118
|
+
// --add-host flag configured in the world-create code path.
|
|
119
|
+
'--add-host', 'host.docker.internal:host-gateway',
|
|
120
|
+
// Bearer secret for all /agentmemory/* requests.
|
|
121
|
+
'--env', `AGENTMEMORY_SECRET=${secret}`,
|
|
122
|
+
// Bind to all interfaces inside the container; the host-port publish
|
|
123
|
+
// restricts access to 127.0.0.1 externally.
|
|
124
|
+
'--env', 'AGENTMEMORY_HOST=0.0.0.0',
|
|
125
|
+
'--env', `AGENTMEMORY_PORT=${MEMORY_SERVICE_PORT}`,
|
|
126
|
+
// Mount the operator's memory-data root so iii-engine state persists.
|
|
127
|
+
'--volume', `${memoryData}:${MEMORY_SERVICE_VOLUME_TARGET}`,
|
|
128
|
+
this.imageTag,
|
|
129
|
+
], { stdio: 'pipe' });
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Returns true when no memory-service image exists locally — useful for
|
|
133
|
+
* callers (e.g. servicesUp) to distinguish "operator opted out of
|
|
134
|
+
* memory-service" from "memory-service was supposed to work but is broken".
|
|
135
|
+
* The opted-out case should be silent; the broken case should warn.
|
|
136
|
+
*/
|
|
137
|
+
imageMissingEverywhere() {
|
|
138
|
+
return (!this.imageExists(MEMORY_SERVICE_LOCAL_TAG) &&
|
|
139
|
+
!this.imageExists(MEMORY_SERVICE_DEV_TAG) &&
|
|
140
|
+
!this.imageExists(MEMORY_SERVICE_PUBLISHED_TAG));
|
|
141
|
+
}
|
|
142
|
+
stop() {
|
|
143
|
+
const current = this.status();
|
|
144
|
+
if (current.state !== 'running')
|
|
145
|
+
return;
|
|
146
|
+
execFileSync('docker', ['stop', MEMORY_SERVICE_CONTAINER], { stdio: 'pipe' });
|
|
147
|
+
}
|
|
148
|
+
remove() {
|
|
149
|
+
spawnSync('docker', ['rm', '-f', MEMORY_SERVICE_CONTAINER], { stdio: 'pipe' });
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Poll /agentmemory/livez until 200 OK with `{status: "ok"}` body OR
|
|
153
|
+
* timeoutMs elapses. The probe is bearer-authenticated; without the secret
|
|
154
|
+
* header agentmemory returns 401 regardless of container state.
|
|
155
|
+
*
|
|
156
|
+
* Divergence from kg-service: kg-service's `/health` is unauthenticated and
|
|
157
|
+
* returns `{ready: true}` once bge-small is loaded. memory-service's
|
|
158
|
+
* `/agentmemory/livez` returns `{status: "ok"}` once iii-engine accepts
|
|
159
|
+
* connections — there's no equivalent "model warmed" state to wait for.
|
|
160
|
+
*/
|
|
161
|
+
async waitForReady(timeoutMs = MEMORY_SERVICE_HEALTH_TIMEOUT_MS) {
|
|
162
|
+
const secret = ensureMemorySecret();
|
|
163
|
+
const deadline = Date.now() + timeoutMs;
|
|
164
|
+
while (Date.now() < deadline) {
|
|
165
|
+
try {
|
|
166
|
+
const res = await fetch(MEMORY_SERVICE_HEALTH_URL, {
|
|
167
|
+
headers: { authorization: `Bearer ${secret}` },
|
|
168
|
+
signal: AbortSignal.timeout(1_500),
|
|
169
|
+
});
|
|
170
|
+
if (res.ok) {
|
|
171
|
+
const body = (await res.json());
|
|
172
|
+
if (body.status === 'ok')
|
|
173
|
+
return true;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
catch {
|
|
177
|
+
// not ready yet (connection refused, container booting, network race)
|
|
178
|
+
}
|
|
179
|
+
await sleep(500);
|
|
180
|
+
}
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
function sleep(ms) {
|
|
185
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
186
|
+
}
|
|
187
|
+
//# sourceMappingURL=memory-service-container.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory-service-container.js","sourceRoot":"","sources":["../../src/commands/memory-service-container.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC;AACxC,MAAM,CAAC,MAAM,wBAAwB,GAAG,qBAAqB,CAAC;AAC9D,MAAM,CAAC,MAAM,wBAAwB,GAAG,2BAA2B,CAAC;AACpE,MAAM,CAAC,MAAM,4BAA4B,GAAG,0CAA0C,CAAC;AACvF,MAAM,CAAC,MAAM,sBAAsB,GAAG,yBAAyB,CAAC;AAChE,MAAM,CAAC,MAAM,yBAAyB,GAAG,oBAAoB,mBAAmB,oBAAoB,CAAC;AAErG,gFAAgF;AAChF,2EAA2E;AAC3E,oDAAoD;AACpD,MAAM,CAAC,MAAM,gCAAgC,GAAG,MAAM,CAAC;AAEvD,4EAA4E;AAC5E,6EAA6E;AAC7E,uCAAuC;AACvC,MAAM,4BAA4B,GAAG,OAAO,CAAC;AAW7C;;;;;;;;GAQG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M,KAAK,IAAI;wBAAE,OAAO,IAAI,CAAC;gBACxC,CAAC;YACH,CAAC;YAAC,MAAM,CAAC;gBACP,sEAAsE;YACxE,CAAC;YACD,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAED,SAAS,KAAK,CAAC,EAAU;IACvB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAC3D,CAAC"}
|
|
@@ -55,9 +55,24 @@ export declare function servicesDownKubernetes(deps?: ServicesKubernetesDeps): P
|
|
|
55
55
|
* the compose table shape: NAME | STATUS | IMAGE | AGE | RESTARTS.
|
|
56
56
|
*/
|
|
57
57
|
export declare function servicesStatusKubernetes(deps?: ServicesKubernetesDeps): Promise<void>;
|
|
58
|
+
/**
|
|
59
|
+
* Normalize a user-supplied service name to the k8s Deployment name form.
|
|
60
|
+
*
|
|
61
|
+
* All olam peripheral Deployments are named `olam-<short-name>` in the k8s
|
|
62
|
+
* manifests (e.g. `olam-kg-service`, `olam-auth-service`). When the operator
|
|
63
|
+
* types `olam services restart kg-service` the CLI must prepend `olam-` before
|
|
64
|
+
* calling `kubectl rollout restart deployment/olam-kg-service`.
|
|
65
|
+
*
|
|
66
|
+
* Idempotent: if the user already types the full name (`olam-kg-service`), the
|
|
67
|
+
* prefix is NOT doubled → `olam-kg-service` (NOT `olam-olam-kg-service`).
|
|
68
|
+
*
|
|
69
|
+
* Exported for unit testing (C1 — R3-D).
|
|
70
|
+
*/
|
|
71
|
+
export declare function normalizeK8sDeploymentName(name: string): string;
|
|
58
72
|
/**
|
|
59
73
|
* `olam services restart <name>` on kubernetes substrate.
|
|
60
|
-
* Uses `kubectl rollout restart deployment
|
|
74
|
+
* Uses `kubectl rollout restart deployment/olam-<name>`.
|
|
75
|
+
* Prepends `olam-` to the user-supplied name (idempotent — no double-prefix).
|
|
61
76
|
*/
|
|
62
77
|
export declare function servicesRestartKubernetes(name: string, deps?: ServicesKubernetesDeps): Promise<{
|
|
63
78
|
exitCode: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../src/commands/services.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../src/commands/services.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAgBzC,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAyBrD,KAAK,cAAc,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;AAExD,UAAU,eAAe;IACvB,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,qBAAa,0BAA0B;IACrC,OAAO,CAAC,QAAQ,CAA8B;IAE9C,MAAM,IAAI,eAAe;IAiBzB,OAAO,CAAC,WAAW;IAInB,KAAK,IAAI,IAAI;IAgCb,IAAI,IAAI,IAAI;IAMZ,MAAM,IAAI,IAAI;IAIR,YAAY,CAAC,SAAS,SAA6B,GAAG,OAAO,CAAC,OAAO,CAAC;CAa7E;AA6BD,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,WAAW,CAAC;IAC9C,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED;;;;GAIG;AACH,wBAAsB,oBAAoB,CACxC,IAAI,GAAE,sBAA2B,GAChC,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CA2B/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