@pleri/olam-cli 0.1.97 → 0.1.99

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.
@@ -4,6 +4,6 @@
4
4
  "host-cp": "sha256:37a8d675fe57b282a81568156eba4c2b9496e6371e8930674f91adb317247d7b",
5
5
  "mcp-auth": "sha256:e47169ad3fbc9cab216248fecbc56874343a5daab84b1f18d67529b7d415cf95",
6
6
  "$schema_version": 1,
7
- "$published_version": "0.1.97",
7
+ "$published_version": "0.1.99",
8
8
  "$registry": "ghcr.io/pleri"
9
9
  }
package/dist/index.js CHANGED
@@ -10282,6 +10282,7 @@ __export(manager_exports, {
10282
10282
  BotIdentityError: () => BotIdentityError,
10283
10283
  WorkspaceNotFoundError: () => WorkspaceNotFoundError,
10284
10284
  WorldManager: () => WorldManager,
10285
+ applyPostgresNetworkOverrides: () => applyPostgresNetworkOverrides,
10285
10286
  buildManifestRuntimeForTest: () => buildManifestRuntime,
10286
10287
  deriveReadinessChain: () => deriveReadinessChain,
10287
10288
  getTokenScopes: () => getTokenScopes,
@@ -10548,31 +10549,33 @@ function planManifestPipeline(repos, baselineServices, worldId, branch, portOffs
10548
10549
  }
10549
10550
  return { services: mergedServices, crossRepoEnv };
10550
10551
  }
10551
- async function runManifestRuntime(containerName, worldId, repos, exec) {
10552
+ async function runManifestRuntime(containerName, worldId, repos, exec, opts = {}) {
10552
10553
  const hasAnyManifest = repos.some((r) => r.manifest !== void 0);
10553
10554
  if (!hasAnyManifest)
10554
10555
  return {};
10555
- const bootstrapTasks = [];
10556
- for (const repo of repos) {
10557
- const bootstrap = repo.manifest?.bootstrap;
10558
- if (!bootstrap || bootstrap.length === 0)
10559
- continue;
10560
- if (repo.setup_commands.length > 0) {
10561
- console.warn(`[manifest] step 4e' both bootstrap[] and setup_commands populated for "${repo.name}". HARD-STOP semantics apply to bootstrap[] (OQ9): if any bootstrap step exits non-zero, the world transitions to 'error' and the legacy setup_commands path will NOT run as a fallback. Migrate setup_commands \u2192 manifest.bootstrap and remove the duplicate.`);
10556
+ if (!opts.skipBootstrap) {
10557
+ const bootstrapTasks = [];
10558
+ for (const repo of repos) {
10559
+ const bootstrap = repo.manifest?.bootstrap;
10560
+ if (!bootstrap || bootstrap.length === 0)
10561
+ continue;
10562
+ if (repo.setup_commands.length > 0) {
10563
+ console.warn(`[manifest] step 4e' both bootstrap[] and setup_commands populated for "${repo.name}". HARD-STOP semantics apply to bootstrap[] (OQ9): if any bootstrap step exits non-zero, the world transitions to 'error' and the legacy setup_commands path will NOT run as a fallback. Migrate setup_commands \u2192 manifest.bootstrap and remove the duplicate.`);
10564
+ }
10565
+ const workdir = `/home/olam/workspace/${repo.name}`;
10566
+ const cmds = bootstrap.map(bootstrapStepCmd);
10567
+ console.log(`[manifest] step 4e bootstrap "${repo.name}" (${cmds.length} steps)`);
10568
+ bootstrapTasks.push((async () => {
10569
+ await runBootstrap(containerName, workdir, cmds, exec);
10570
+ console.log(`[manifest] step 4e bootstrap "${repo.name}" complete`);
10571
+ })());
10562
10572
  }
10563
- const workdir = `/home/olam/workspace/${repo.name}`;
10564
- const cmds = bootstrap.map(bootstrapStepCmd);
10565
- console.log(`[manifest] step 4e bootstrap "${repo.name}" (${cmds.length} steps)`);
10566
- bootstrapTasks.push((async () => {
10567
- await runBootstrap(containerName, workdir, cmds, exec);
10568
- console.log(`[manifest] step 4e bootstrap "${repo.name}" complete`);
10569
- })());
10570
- }
10571
- if (bootstrapTasks.length > 0) {
10572
- const results = await Promise.allSettled(bootstrapTasks);
10573
- const firstFailure = results.find((r) => r.status === "rejected");
10574
- if (firstFailure && firstFailure.status === "rejected") {
10575
- throw firstFailure.reason;
10573
+ if (bootstrapTasks.length > 0) {
10574
+ const results = await Promise.allSettled(bootstrapTasks);
10575
+ const firstFailure = results.find((r) => r.status === "rejected");
10576
+ if (firstFailure && firstFailure.status === "rejected") {
10577
+ throw firstFailure.reason;
10578
+ }
10576
10579
  }
10577
10580
  }
10578
10581
  const supervisedRepos = [];
@@ -10631,6 +10634,17 @@ function buildManifestRuntime(worldId, repos) {
10631
10634
  }
10632
10635
  return { worldId, repos: runtimeRepos };
10633
10636
  }
10637
+ function applyPostgresNetworkOverrides(worldEnv, enrichedRepos) {
10638
+ const hasPostgres = enrichedRepos.some((r) => r.manifest?.services?.["postgres"] !== void 0);
10639
+ if (!hasPostgres)
10640
+ return;
10641
+ worldEnv["POSTGRESQL_HOST"] = "postgres";
10642
+ worldEnv["POSTGRESQL_PORT"] = "5432";
10643
+ if ("POSTGRESQL_COMMON_HOST" in worldEnv)
10644
+ worldEnv["POSTGRESQL_COMMON_HOST"] = "postgres";
10645
+ if ("POSTGRESQL_COMMON_PORT" in worldEnv)
10646
+ worldEnv["POSTGRESQL_COMMON_PORT"] = "5432";
10647
+ }
10634
10648
  var BotIdentityError, ADJECTIVES, NOUNS, AuthPreflightError, WorkspaceNotFoundError, WorldManager;
10635
10649
  var init_manager = __esm({
10636
10650
  "../core/dist/world/manager.js"() {
@@ -10983,7 +10997,7 @@ ${detail}`);
10983
10997
  }
10984
10998
  }
10985
10999
  const appPorts = [];
10986
- for (const repo of repos) {
11000
+ for (const repo of enrichedRepos) {
10987
11001
  const manifestPort = repo.manifest?.app?.port;
10988
11002
  const centralPort = repo.app_port;
10989
11003
  const port = manifestPort ?? centralPort;
@@ -11096,6 +11110,7 @@ ${detail}`);
11096
11110
  }
11097
11111
  }
11098
11112
  }
11113
+ applyPostgresNetworkOverrides(worldEnv, enrichedRepos);
11099
11114
  await this.provider.createWorld({
11100
11115
  id: worldId,
11101
11116
  name: opts.name,
@@ -11236,6 +11251,25 @@ ${detail}`);
11236
11251
  const msg = err instanceof Error ? err.message : String(err);
11237
11252
  console.warn(`[manifest] WARN: bootstrap failure allowed by --allow-bootstrap-failure: ${msg}`);
11238
11253
  console.warn(`[manifest] WARN: world ${worldId} stays running; rerun the failing step manually inside the world if needed.`);
11254
+ try {
11255
+ await runManifestRuntime(containerName, worldId, enrichedRepos, this.dockerExec, { skipBootstrap: true });
11256
+ } catch (supervisorErr) {
11257
+ if (supervisorErr instanceof PortInUseError) {
11258
+ sm.transition("error");
11259
+ this.registry.update(worldId, { status: "error" });
11260
+ try {
11261
+ await this.provider.destroyWorld(worldId);
11262
+ } catch {
11263
+ }
11264
+ try {
11265
+ await removeWorktrees(repos, workspacePath);
11266
+ } catch {
11267
+ }
11268
+ throw supervisorErr;
11269
+ }
11270
+ const supervisorMsg = supervisorErr instanceof Error ? supervisorErr.message : String(supervisorErr);
11271
+ console.warn(`[manifest] WARN: step 4f/4g failed after bootstrap-failure escape hatch: ${supervisorMsg}`);
11272
+ }
11239
11273
  } else if (err instanceof BootstrapStepError || err instanceof PortInUseError || err instanceof EnvSubstCycleError || err instanceof EnvSubstDepthExceededError) {
11240
11274
  sm.transition("error");
11241
11275
  this.registry.update(worldId, { status: "error" });
@@ -31611,31 +31611,33 @@ function planManifestPipeline(repos, baselineServices, worldId, branch, portOffs
31611
31611
  }
31612
31612
  return { services: mergedServices, crossRepoEnv };
31613
31613
  }
31614
- async function runManifestRuntime(containerName, worldId, repos, exec) {
31614
+ async function runManifestRuntime(containerName, worldId, repos, exec, opts = {}) {
31615
31615
  const hasAnyManifest = repos.some((r) => r.manifest !== void 0);
31616
31616
  if (!hasAnyManifest)
31617
31617
  return {};
31618
- const bootstrapTasks = [];
31619
- for (const repo of repos) {
31620
- const bootstrap = repo.manifest?.bootstrap;
31621
- if (!bootstrap || bootstrap.length === 0)
31622
- continue;
31623
- if (repo.setup_commands.length > 0) {
31624
- console.warn(`[manifest] step 4e' both bootstrap[] and setup_commands populated for "${repo.name}". HARD-STOP semantics apply to bootstrap[] (OQ9): if any bootstrap step exits non-zero, the world transitions to 'error' and the legacy setup_commands path will NOT run as a fallback. Migrate setup_commands \u2192 manifest.bootstrap and remove the duplicate.`);
31618
+ if (!opts.skipBootstrap) {
31619
+ const bootstrapTasks = [];
31620
+ for (const repo of repos) {
31621
+ const bootstrap = repo.manifest?.bootstrap;
31622
+ if (!bootstrap || bootstrap.length === 0)
31623
+ continue;
31624
+ if (repo.setup_commands.length > 0) {
31625
+ console.warn(`[manifest] step 4e' both bootstrap[] and setup_commands populated for "${repo.name}". HARD-STOP semantics apply to bootstrap[] (OQ9): if any bootstrap step exits non-zero, the world transitions to 'error' and the legacy setup_commands path will NOT run as a fallback. Migrate setup_commands \u2192 manifest.bootstrap and remove the duplicate.`);
31626
+ }
31627
+ const workdir = `/home/olam/workspace/${repo.name}`;
31628
+ const cmds = bootstrap.map(bootstrapStepCmd);
31629
+ console.log(`[manifest] step 4e bootstrap "${repo.name}" (${cmds.length} steps)`);
31630
+ bootstrapTasks.push((async () => {
31631
+ await runBootstrap(containerName, workdir, cmds, exec);
31632
+ console.log(`[manifest] step 4e bootstrap "${repo.name}" complete`);
31633
+ })());
31625
31634
  }
31626
- const workdir = `/home/olam/workspace/${repo.name}`;
31627
- const cmds = bootstrap.map(bootstrapStepCmd);
31628
- console.log(`[manifest] step 4e bootstrap "${repo.name}" (${cmds.length} steps)`);
31629
- bootstrapTasks.push((async () => {
31630
- await runBootstrap(containerName, workdir, cmds, exec);
31631
- console.log(`[manifest] step 4e bootstrap "${repo.name}" complete`);
31632
- })());
31633
- }
31634
- if (bootstrapTasks.length > 0) {
31635
- const results = await Promise.allSettled(bootstrapTasks);
31636
- const firstFailure = results.find((r) => r.status === "rejected");
31637
- if (firstFailure && firstFailure.status === "rejected") {
31638
- throw firstFailure.reason;
31635
+ if (bootstrapTasks.length > 0) {
31636
+ const results = await Promise.allSettled(bootstrapTasks);
31637
+ const firstFailure = results.find((r) => r.status === "rejected");
31638
+ if (firstFailure && firstFailure.status === "rejected") {
31639
+ throw firstFailure.reason;
31640
+ }
31639
31641
  }
31640
31642
  }
31641
31643
  const supervisedRepos = [];
@@ -32010,7 +32012,7 @@ ${detail}`);
32010
32012
  }
32011
32013
  }
32012
32014
  const appPorts = [];
32013
- for (const repo of repos) {
32015
+ for (const repo of enrichedRepos) {
32014
32016
  const manifestPort = repo.manifest?.app?.port;
32015
32017
  const centralPort = repo.app_port;
32016
32018
  const port = manifestPort ?? centralPort;
@@ -32123,6 +32125,7 @@ ${detail}`);
32123
32125
  }
32124
32126
  }
32125
32127
  }
32128
+ applyPostgresNetworkOverrides(worldEnv, enrichedRepos);
32126
32129
  await this.provider.createWorld({
32127
32130
  id: worldId,
32128
32131
  name: opts.name,
@@ -32263,6 +32266,25 @@ ${detail}`);
32263
32266
  const msg = err instanceof Error ? err.message : String(err);
32264
32267
  console.warn(`[manifest] WARN: bootstrap failure allowed by --allow-bootstrap-failure: ${msg}`);
32265
32268
  console.warn(`[manifest] WARN: world ${worldId} stays running; rerun the failing step manually inside the world if needed.`);
32269
+ try {
32270
+ await runManifestRuntime(containerName, worldId, enrichedRepos, this.dockerExec, { skipBootstrap: true });
32271
+ } catch (supervisorErr) {
32272
+ if (supervisorErr instanceof PortInUseError) {
32273
+ sm.transition("error");
32274
+ this.registry.update(worldId, { status: "error" });
32275
+ try {
32276
+ await this.provider.destroyWorld(worldId);
32277
+ } catch {
32278
+ }
32279
+ try {
32280
+ await removeWorktrees(repos, workspacePath);
32281
+ } catch {
32282
+ }
32283
+ throw supervisorErr;
32284
+ }
32285
+ const supervisorMsg = supervisorErr instanceof Error ? supervisorErr.message : String(supervisorErr);
32286
+ console.warn(`[manifest] WARN: step 4f/4g failed after bootstrap-failure escape hatch: ${supervisorMsg}`);
32287
+ }
32266
32288
  } else if (err instanceof BootstrapStepError || err instanceof PortInUseError || err instanceof EnvSubstCycleError || err instanceof EnvSubstDepthExceededError) {
32267
32289
  sm.transition("error");
32268
32290
  this.registry.update(worldId, { status: "error" });
@@ -32566,6 +32588,17 @@ ${opts.task}`;
32566
32588
  return services;
32567
32589
  }
32568
32590
  };
32591
+ function applyPostgresNetworkOverrides(worldEnv, enrichedRepos) {
32592
+ const hasPostgres = enrichedRepos.some((r) => r.manifest?.services?.["postgres"] !== void 0);
32593
+ if (!hasPostgres)
32594
+ return;
32595
+ worldEnv["POSTGRESQL_HOST"] = "postgres";
32596
+ worldEnv["POSTGRESQL_PORT"] = "5432";
32597
+ if ("POSTGRESQL_COMMON_HOST" in worldEnv)
32598
+ worldEnv["POSTGRESQL_COMMON_HOST"] = "postgres";
32599
+ if ("POSTGRESQL_COMMON_PORT" in worldEnv)
32600
+ worldEnv["POSTGRESQL_COMMON_PORT"] = "5432";
32601
+ }
32569
32602
 
32570
32603
  // ../core/dist/cost/tracker.js
32571
32604
  var CostTracker = class {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pleri/olam-cli",
3
- "version": "0.1.97",
3
+ "version": "0.1.99",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "olam": "./bin/olam.cjs"