@pleri/olam-cli 0.1.126 → 0.1.128

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.
@@ -1 +1 @@
1
- {"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../../src/commands/memory/start.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAwFzC,wBAAsB,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC,CA6EtD;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAQtD"}
1
+ {"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../../src/commands/memory/start.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAoHzC,wBAAsB,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC,CAgGtD;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAQtD"}
@@ -20,6 +20,7 @@
20
20
  import { spawn } from 'node:child_process';
21
21
  import { existsSync, mkdirSync, openSync, readFileSync, writeFileSync } from 'node:fs';
22
22
  import { join } from 'node:path';
23
+ import { pathToFileURL } from 'node:url';
23
24
  import { printError, printSuccess, printInfo, printHeader } from '../../output.js';
24
25
  import { ensureMemorySecret } from '../../lib/memory-secret.js';
25
26
  import { III_BINARY_PATH, MEMORY_DATA_DIR, MEMORY_LIVEZ_URL, MEMORY_LOG_PATH, MEMORY_PID_PATH, MEMORY_SERVICE_CANDIDATES, OLAM_BIN_DIR, OLAM_HOME, } from './_paths.js';
@@ -91,19 +92,63 @@ async function waitForReady(secret) {
91
92
  }
92
93
  return false;
93
94
  }
95
+ /**
96
+ * Auto-fetch the iii binary via A1's `ensure-iii-engine.mjs` helper.
97
+ *
98
+ * Called from `runMemoryStart` when `~/.olam/bin/iii` is missing. Closes
99
+ * the bootstrap-time UX gap surfaced by `olam bootstrap` in CI: A5
100
+ * wires `olam memory start` into the bootstrap flow, but A2's start
101
+ * command previously failed with a "Run: node ... ensure-iii-engine.mjs"
102
+ * remedy that operators on fresh hosts couldn't auto-resolve. Now
103
+ * `olam memory start` (and therefore `olam bootstrap`) auto-fetches the
104
+ * SHA256-pinned binary on first use.
105
+ *
106
+ * Dynamic-imported because the helper is in `packages/memory-service/`,
107
+ * a sibling workspace — resolving statically would invert the package
108
+ * graph. Path resolution reuses `resolveMemoryServiceDir` so the bundle-
109
+ * vs-source layout fallbacks stay consistent.
110
+ */
111
+ async function autoEnsureIiiBinary(serviceDir) {
112
+ const helperPath = join(serviceDir, 'scripts', 'ensure-iii-engine.mjs');
113
+ const mod = (await import(pathToFileURL(helperPath).href));
114
+ const result = await mod.ensureIiiEngine();
115
+ if (!result.ok) {
116
+ throw new Error(`ensureIiiEngine returned ok=false (path=${result.path})`);
117
+ }
118
+ }
94
119
  export async function runMemoryStart() {
95
120
  printHeader('olam memory start');
96
- // 1. iii binary (A1's deliverable)
97
- if (!existsSync(III_BINARY_PATH)) {
98
- printError(`iii binary missing at ${III_BINARY_PATH}. Run: node packages/memory-service/scripts/ensure-iii-engine.mjs`);
121
+ // 3. Locate the service first (needed for both auto-fetch and bin
122
+ // resolution below). Throws with a clear remedy if the packaging
123
+ // is broken (e.g. running outside a checkout).
124
+ let serviceDir;
125
+ try {
126
+ serviceDir = resolveMemoryServiceDir();
127
+ }
128
+ catch (err) {
129
+ printError(err instanceof Error ? err.message : String(err));
99
130
  return 1;
100
131
  }
132
+ // 1. iii binary (A1's deliverable). Auto-fetch when missing so
133
+ // `olam bootstrap` succeeds on fresh hosts (CI runners, new
134
+ // operator machines) without a manual ensure-iii-engine step.
135
+ if (!existsSync(III_BINARY_PATH)) {
136
+ printInfo('iii binary', `missing at ${III_BINARY_PATH} — auto-fetching v0.11.2`);
137
+ try {
138
+ await autoEnsureIiiBinary(serviceDir);
139
+ }
140
+ catch (err) {
141
+ printError(`iii binary auto-fetch failed: ${err instanceof Error ? err.message : String(err)}. ` +
142
+ `Run manually: node packages/memory-service/scripts/ensure-iii-engine.mjs`);
143
+ return 1;
144
+ }
145
+ }
101
146
  printInfo('iii binary', III_BINARY_PATH);
102
147
  // 2. Secret (A3 lib)
103
148
  const secret = ensureMemorySecret();
104
149
  printInfo('secret', '~/.olam/memory-secret (0600)');
105
- // 3. Locate the service + agentmemory bin
106
- const serviceDir = resolveMemoryServiceDir();
150
+ // 3b. Locate the agentmemory bin (serviceDir was resolved above for
151
+ // the auto-fetch path).
107
152
  const agentmemoryBin = resolveAgentMemoryBin(serviceDir);
108
153
  printInfo('agentmemory', agentmemoryBin);
109
154
  // 4. Idempotency: already running?
@@ -1 +1 @@
1
- {"version":3,"file":"start.js","sourceRoot":"","sources":["../../../src/commands/memory/start.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACvF,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnF,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EACL,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,yBAAyB,EACzB,YAAY,EACZ,SAAS,GACV,MAAM,aAAa,CAAC;AAErB,MAAM,oBAAoB,GAAG,MAAM,CAAC;AACpC,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAE9B,SAAS,uBAAuB;IAC9B,KAAK,MAAM,CAAC,IAAI,yBAAyB,EAAE,CAAC;QAC1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AwC,oBAAoB,GAAG,IAAI,KAAK;YACtE,WAAW,eAAe,qBAAqB,CAClD,CAAC;QACF,OAAO,CAAC,CAAC;IACX,CAAC;IAED,YAAY,CAAC,6BAA6B,KAAK,CAAC,GAAG,aAAa,eAAe,GAAG,CAAC,CAAC;IACpF,OAAO,CAAC,CAAC;AACX,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,GAAY;IAC9C,GAAG;SACA,OAAO,CAAC,OAAO,CAAC;SAChB,WAAW,CAAC,2EAA2E,CAAC;SACxF,MAAM,CAAC,KAAK,IAAI,EAAE;QACjB,MAAM,EAAE,GAAG,MAAM,cAAc,EAAE,CAAC;QAClC,IAAI,EAAE,KAAK,CAAC;YAAE,OAAO,CAAC,QAAQ,GAAG,EAAE,CAAC;IACtC,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -5,6 +5,6 @@
5
5
  "host-cp": "sha256:13a26950fea2917ebb268f7bda04fd54267ffe8e5ba4a550db89f28eb309553f",
6
6
  "mcp-auth": "sha256:c82fcfca7ed1b139cbea252697487889b96b45a6575cfba076de7f57eaa943ac",
7
7
  "$schema_version": 1,
8
- "$published_version": "0.1.126",
8
+ "$published_version": "0.1.128",
9
9
  "$registry": "ghcr.io/pleri"
10
10
  }
package/dist/index.js CHANGED
@@ -4474,7 +4474,32 @@ var init_repo_manifest = __esm({
4474
4474
  // later in the seam. Statements are NOT exposed to operator-controlled
4475
4475
  // env variables — only the two whitelisted placeholders above. No shell
4476
4476
  // expansion, no DOLLAR-name expansion.
4477
- post_clone_sql: external_exports.record(external_exports.string().min(1), external_exports.array(external_exports.string().min(1))).optional()
4477
+ post_clone_sql: external_exports.record(external_exports.string().min(1), external_exports.array(external_exports.string().min(1))).optional(),
4478
+ // olam-hybrid-shared-postgres Phase B: per-seed env-var-name override.
4479
+ //
4480
+ // Phase A's F-6 derives the DB-name env var from the seed name using a
4481
+ // POSTGRESQL_<PURPOSE>_DATABASE convention (atlas_common_seed →
4482
+ // POSTGRESQL_COMMON_DATABASE). That works for atlas-core which uses
4483
+ // POSTGRESQL_*-prefixed env vars throughout.
4484
+ //
4485
+ // Atlas-pay (and other future repos) use different env var names —
4486
+ // e.g. ATLAS_PAY_DATABASE, not POSTGRESQL_PAY_DATABASE. This map lets
4487
+ // a manifest declare the override explicitly:
4488
+ //
4489
+ // services:
4490
+ // postgres:
4491
+ // seed_template:
4492
+ // - atlas_common_seed
4493
+ // - atlas_pay_seed
4494
+ // db_env_override:
4495
+ // atlas_pay_seed: ATLAS_PAY_DATABASE
4496
+ // # atlas_common_seed keeps F-6's default POSTGRESQL_COMMON_DATABASE
4497
+ //
4498
+ // Schema: Record<seed_template_name, env_var_name>. The env var name
4499
+ // must be uppercase letters/digits/underscores ([A-Z][A-Z0-9_]*) — same
4500
+ // shape as conventional shell env vars. F-6 honors the override when
4501
+ // present; falls back to the derived default otherwise.
4502
+ db_env_override: external_exports.record(external_exports.string().min(1), external_exports.string().regex(/^[A-Z][A-Z0-9_]*$/)).optional()
4478
4503
  }).passthrough();
4479
4504
  deploySchema = external_exports.object({
4480
4505
  tags: external_exports.array(external_exports.string()).optional()
@@ -11242,6 +11267,7 @@ function applyPostgresNetworkOverrides(worldEnv, enrichedRepos, worldId) {
11242
11267
  if (worldId !== void 0) {
11243
11268
  assertSafeWorldId(worldId);
11244
11269
  const seedTemplates = /* @__PURE__ */ new Set();
11270
+ const dbEnvOverride = {};
11245
11271
  for (const repo of enrichedRepos) {
11246
11272
  const pg = repo.manifest?.services?.["postgres"];
11247
11273
  const raw = pg?.seed_template;
@@ -11252,12 +11278,23 @@ function applyPostgresNetworkOverrides(worldEnv, enrichedRepos, worldId) {
11252
11278
  if (typeof s === "string")
11253
11279
  seedTemplates.add(s);
11254
11280
  }
11281
+ if (pg?.db_env_override && typeof pg.db_env_override === "object") {
11282
+ for (const [seedKey, envName] of Object.entries(pg.db_env_override)) {
11283
+ if (typeof envName === "string" && envName.length > 0) {
11284
+ dbEnvOverride[seedKey] = envName;
11285
+ }
11286
+ }
11287
+ }
11255
11288
  }
11256
11289
  for (const seed of seedTemplates) {
11257
- const match2 = seed.match(/^atlas_([a-z][a-z0-9_]*?)_seed$/i);
11258
- if (match2 && match2[1] !== void 0) {
11259
- const purpose = match2[1].toUpperCase();
11260
- const envKey = `POSTGRESQL_${purpose}_DATABASE`;
11290
+ let envKey = dbEnvOverride[seed];
11291
+ if (envKey === void 0) {
11292
+ const match2 = seed.match(/^atlas_([a-z][a-z0-9_]*?)_seed$/i);
11293
+ if (match2 && match2[1] !== void 0) {
11294
+ envKey = `POSTGRESQL_${match2[1].toUpperCase()}_DATABASE`;
11295
+ }
11296
+ }
11297
+ if (envKey !== void 0) {
11261
11298
  worldEnv[envKey] = deriveWorldDbName(seed, worldId);
11262
11299
  }
11263
11300
  }
@@ -28333,6 +28370,7 @@ init_output();
28333
28370
  import { spawn as spawn8 } from "node:child_process";
28334
28371
  import { existsSync as existsSync54, mkdirSync as mkdirSync30, openSync as openSync3, readFileSync as readFileSync38, writeFileSync as writeFileSync24 } from "node:fs";
28335
28372
  import { join as join52 } from "node:path";
28373
+ import { pathToFileURL } from "node:url";
28336
28374
 
28337
28375
  // src/commands/memory/_paths.ts
28338
28376
  import { homedir as homedir30 } from "node:os";
@@ -28418,18 +28456,37 @@ async function waitForReady(secret) {
28418
28456
  }
28419
28457
  return false;
28420
28458
  }
28459
+ async function autoEnsureIiiBinary(serviceDir) {
28460
+ const helperPath = join52(serviceDir, "scripts", "ensure-iii-engine.mjs");
28461
+ const mod = await import(pathToFileURL(helperPath).href);
28462
+ const result = await mod.ensureIiiEngine();
28463
+ if (!result.ok) {
28464
+ throw new Error(`ensureIiiEngine returned ok=false (path=${result.path})`);
28465
+ }
28466
+ }
28421
28467
  async function runMemoryStart() {
28422
28468
  printHeader("olam memory start");
28423
- if (!existsSync54(III_BINARY_PATH)) {
28424
- printError(
28425
- `iii binary missing at ${III_BINARY_PATH}. Run: node packages/memory-service/scripts/ensure-iii-engine.mjs`
28426
- );
28469
+ let serviceDir;
28470
+ try {
28471
+ serviceDir = resolveMemoryServiceDir();
28472
+ } catch (err) {
28473
+ printError(err instanceof Error ? err.message : String(err));
28427
28474
  return 1;
28428
28475
  }
28476
+ if (!existsSync54(III_BINARY_PATH)) {
28477
+ printInfo("iii binary", `missing at ${III_BINARY_PATH} \u2014 auto-fetching v0.11.2`);
28478
+ try {
28479
+ await autoEnsureIiiBinary(serviceDir);
28480
+ } catch (err) {
28481
+ printError(
28482
+ `iii binary auto-fetch failed: ${err instanceof Error ? err.message : String(err)}. Run manually: node packages/memory-service/scripts/ensure-iii-engine.mjs`
28483
+ );
28484
+ return 1;
28485
+ }
28486
+ }
28429
28487
  printInfo("iii binary", III_BINARY_PATH);
28430
28488
  const secret = ensureMemorySecret();
28431
28489
  printInfo("secret", "~/.olam/memory-secret (0600)");
28432
- const serviceDir = resolveMemoryServiceDir();
28433
28490
  const agentmemoryBin = resolveAgentMemoryBin(serviceDir);
28434
28491
  printInfo("agentmemory", agentmemoryBin);
28435
28492
  const existingPid = readPidFromFile();
@@ -22413,7 +22413,32 @@ var serviceSchema = external_exports.object({
22413
22413
  // later in the seam. Statements are NOT exposed to operator-controlled
22414
22414
  // env variables — only the two whitelisted placeholders above. No shell
22415
22415
  // expansion, no DOLLAR-name expansion.
22416
- post_clone_sql: external_exports.record(external_exports.string().min(1), external_exports.array(external_exports.string().min(1))).optional()
22416
+ post_clone_sql: external_exports.record(external_exports.string().min(1), external_exports.array(external_exports.string().min(1))).optional(),
22417
+ // olam-hybrid-shared-postgres Phase B: per-seed env-var-name override.
22418
+ //
22419
+ // Phase A's F-6 derives the DB-name env var from the seed name using a
22420
+ // POSTGRESQL_<PURPOSE>_DATABASE convention (atlas_common_seed →
22421
+ // POSTGRESQL_COMMON_DATABASE). That works for atlas-core which uses
22422
+ // POSTGRESQL_*-prefixed env vars throughout.
22423
+ //
22424
+ // Atlas-pay (and other future repos) use different env var names —
22425
+ // e.g. ATLAS_PAY_DATABASE, not POSTGRESQL_PAY_DATABASE. This map lets
22426
+ // a manifest declare the override explicitly:
22427
+ //
22428
+ // services:
22429
+ // postgres:
22430
+ // seed_template:
22431
+ // - atlas_common_seed
22432
+ // - atlas_pay_seed
22433
+ // db_env_override:
22434
+ // atlas_pay_seed: ATLAS_PAY_DATABASE
22435
+ // # atlas_common_seed keeps F-6's default POSTGRESQL_COMMON_DATABASE
22436
+ //
22437
+ // Schema: Record<seed_template_name, env_var_name>. The env var name
22438
+ // must be uppercase letters/digits/underscores ([A-Z][A-Z0-9_]*) — same
22439
+ // shape as conventional shell env vars. F-6 honors the override when
22440
+ // present; falls back to the derived default otherwise.
22441
+ db_env_override: external_exports.record(external_exports.string().min(1), external_exports.string().regex(/^[A-Z][A-Z0-9_]*$/)).optional()
22417
22442
  }).passthrough();
22418
22443
  var deploySchema = external_exports.object({
22419
22444
  tags: external_exports.array(external_exports.string()).optional()
@@ -33252,6 +33277,7 @@ function applyPostgresNetworkOverrides(worldEnv, enrichedRepos, worldId) {
33252
33277
  if (worldId !== void 0) {
33253
33278
  assertSafeWorldId(worldId);
33254
33279
  const seedTemplates = /* @__PURE__ */ new Set();
33280
+ const dbEnvOverride = {};
33255
33281
  for (const repo of enrichedRepos) {
33256
33282
  const pg = repo.manifest?.services?.["postgres"];
33257
33283
  const raw = pg?.seed_template;
@@ -33262,12 +33288,23 @@ function applyPostgresNetworkOverrides(worldEnv, enrichedRepos, worldId) {
33262
33288
  if (typeof s === "string")
33263
33289
  seedTemplates.add(s);
33264
33290
  }
33291
+ if (pg?.db_env_override && typeof pg.db_env_override === "object") {
33292
+ for (const [seedKey, envName] of Object.entries(pg.db_env_override)) {
33293
+ if (typeof envName === "string" && envName.length > 0) {
33294
+ dbEnvOverride[seedKey] = envName;
33295
+ }
33296
+ }
33297
+ }
33265
33298
  }
33266
33299
  for (const seed of seedTemplates) {
33267
- const match = seed.match(/^atlas_([a-z][a-z0-9_]*?)_seed$/i);
33268
- if (match && match[1] !== void 0) {
33269
- const purpose = match[1].toUpperCase();
33270
- const envKey = `POSTGRESQL_${purpose}_DATABASE`;
33300
+ let envKey = dbEnvOverride[seed];
33301
+ if (envKey === void 0) {
33302
+ const match = seed.match(/^atlas_([a-z][a-z0-9_]*?)_seed$/i);
33303
+ if (match && match[1] !== void 0) {
33304
+ envKey = `POSTGRESQL_${match[1].toUpperCase()}_DATABASE`;
33305
+ }
33306
+ }
33307
+ if (envKey !== void 0) {
33271
33308
  worldEnv[envKey] = deriveWorldDbName(seed, worldId);
33272
33309
  }
33273
33310
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pleri/olam-cli",
3
- "version": "0.1.126",
3
+ "version": "0.1.128",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "olam": "./bin/olam.cjs"