@pleri/olam-cli 0.1.75 → 0.1.77

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/index.js CHANGED
@@ -9788,6 +9788,7 @@ var init_schema3 = __esm({
9788
9788
  path: external_exports.string().min(1, "path must not be empty").refine(isAbsoluteOrTilde, {
9789
9789
  message: `path must be absolute (e.g. "/home/user/atlas-core") or "~/..." for the operator's home directory`
9790
9790
  }).refine(hasNoTraversalComponents, { message: 'path must not contain ".." components' }),
9791
+ url: external_exports.string().min(1, "url must not be empty").optional(),
9791
9792
  description: external_exports.string().optional(),
9792
9793
  defaultBranch: external_exports.string().optional(),
9793
9794
  addedAt: external_exports.number().int().nonnegative(),
@@ -9998,8 +9999,47 @@ var init_runbooks = __esm({
9998
9999
  }
9999
10000
  });
10000
10001
 
10001
- // ../core/dist/global-config/runbook-resolver.js
10002
+ // ../core/dist/global-config/bridge.js
10002
10003
  import * as fs19 from "node:fs";
10004
+ function repoEntryToRepoConfig(entry) {
10005
+ if (!entry.url) {
10006
+ throw new Error(`Repo "${entry.name}" has no url. Re-register:
10007
+ olam repos remove ${entry.name}
10008
+ olam repos add ${entry.name} --path ${entry.path}`);
10009
+ }
10010
+ const repoPath = resolveTildePath(entry.path);
10011
+ if (!fs19.existsSync(repoPath)) {
10012
+ throw new Error(`Repo "${entry.name}" path "${repoPath}" no longer exists. Run: olam repos update ${entry.name} --path <new-path>`);
10013
+ }
10014
+ let manifest = null;
10015
+ try {
10016
+ manifest = loadRepoManifest(repoPath);
10017
+ } catch {
10018
+ }
10019
+ const config = {
10020
+ name: entry.name,
10021
+ url: entry.url,
10022
+ // RepoEntry has no type field; generic is the safe universal default.
10023
+ // Operators needing non-generic type behavior should declare the repo in local config.
10024
+ type: "generic",
10025
+ path: repoPath,
10026
+ submodules: false,
10027
+ services: [],
10028
+ setup_commands: [],
10029
+ ...manifest !== null ? { manifest } : {}
10030
+ };
10031
+ return config;
10032
+ }
10033
+ var init_bridge = __esm({
10034
+ "../core/dist/global-config/bridge.js"() {
10035
+ "use strict";
10036
+ init_path();
10037
+ init_repo_manifest();
10038
+ }
10039
+ });
10040
+
10041
+ // ../core/dist/global-config/runbook-resolver.js
10042
+ import * as fs20 from "node:fs";
10003
10043
  import * as os12 from "node:os";
10004
10044
  import * as path21 from "node:path";
10005
10045
  function expandTilde(p) {
@@ -10016,7 +10056,7 @@ function resolveRunbookToWorldParams(runbook, repoRegistry) {
10016
10056
  throw new Error(`repo "${repoName}" is referenced by runbook "${runbook.name}" but is not in the registry. Run "olam repos add ${repoName} --path <path>" to register it.`);
10017
10057
  }
10018
10058
  const resolvedPath = expandTilde(entry.path);
10019
- if (!fs19.existsSync(resolvedPath)) {
10059
+ if (!fs20.existsSync(resolvedPath)) {
10020
10060
  throw new Error(`repo "${repoName}" path "${resolvedPath}" no longer exists. Run "olam repos update ${repoName} --path <new-path>" to fix.`);
10021
10061
  }
10022
10062
  }
@@ -10116,7 +10156,7 @@ var init_port_validator = __esm({
10116
10156
  });
10117
10157
 
10118
10158
  // ../core/dist/world/bootstrap-hooks.js
10119
- import * as fs20 from "node:fs";
10159
+ import * as fs21 from "node:fs";
10120
10160
  import * as path22 from "node:path";
10121
10161
  function runFixtureCopySeeds(seeds, workspacePath) {
10122
10162
  if (!seeds)
@@ -10127,8 +10167,8 @@ function runFixtureCopySeeds(seeds, workspacePath) {
10127
10167
  const srcAbs = path22.resolve(workspacePath, seed.repo, seed.src);
10128
10168
  const destAbs = path22.resolve(workspacePath, seed.repo, seed.dest);
10129
10169
  const destDir = path22.dirname(destAbs);
10130
- fs20.mkdirSync(destDir, { recursive: true });
10131
- fs20.cpSync(srcAbs, destAbs, { recursive: true, force: true });
10170
+ fs21.mkdirSync(destDir, { recursive: true });
10171
+ fs21.cpSync(srcAbs, destAbs, { recursive: true, force: true });
10132
10172
  }
10133
10173
  }
10134
10174
  async function runSeedHooks(seeds, containerName, servicePortMap, exec) {
@@ -10285,7 +10325,7 @@ __export(manager_exports, {
10285
10325
  });
10286
10326
  import * as crypto5 from "node:crypto";
10287
10327
  import { execSync as execSync5 } from "node:child_process";
10288
- import * as fs21 from "node:fs";
10328
+ import * as fs22 from "node:fs";
10289
10329
  import * as os13 from "node:os";
10290
10330
  import * as path23 from "node:path";
10291
10331
  import YAML3 from "yaml";
@@ -10651,6 +10691,7 @@ var init_manager = __esm({
10651
10691
  init_loader2();
10652
10692
  init_runbooks();
10653
10693
  init_store2();
10694
+ init_bridge();
10654
10695
  init_runbook_resolver();
10655
10696
  init_port_validator();
10656
10697
  init_bootstrap_hooks();
@@ -10799,7 +10840,7 @@ ${detail}`);
10799
10840
  continue;
10800
10841
  const sourceRoot = repo.path.replace(/^~/, os13.homedir());
10801
10842
  const worktreeRoot = path23.join(workspacePath, repo.name);
10802
- if (!fs21.existsSync(sourceRoot) || !fs21.existsSync(worktreeRoot))
10843
+ if (!fs22.existsSync(sourceRoot) || !fs22.existsSync(worktreeRoot))
10803
10844
  continue;
10804
10845
  let copied = 0;
10805
10846
  for (const pattern of RUNTIME_FILE_PATTERNS) {
@@ -10807,28 +10848,28 @@ ${detail}`);
10807
10848
  if (pattern.includes("*")) {
10808
10849
  const [dir, glob] = [path23.dirname(pattern), path23.basename(pattern)];
10809
10850
  const sourceDir = path23.join(sourceRoot, dir);
10810
- if (fs21.existsSync(sourceDir)) {
10851
+ if (fs22.existsSync(sourceDir)) {
10811
10852
  const ext2 = glob.replace(/^\*+/, "");
10812
10853
  try {
10813
- for (const entry of fs21.readdirSync(sourceDir)) {
10854
+ for (const entry of fs22.readdirSync(sourceDir)) {
10814
10855
  if (ext2 === "" || entry.endsWith(ext2))
10815
10856
  matches2.push(path23.join(dir, entry));
10816
10857
  }
10817
10858
  } catch {
10818
10859
  }
10819
10860
  }
10820
- } else if (fs21.existsSync(path23.join(sourceRoot, pattern))) {
10861
+ } else if (fs22.existsSync(path23.join(sourceRoot, pattern))) {
10821
10862
  matches2.push(pattern);
10822
10863
  }
10823
10864
  for (const rel of matches2) {
10824
10865
  const src = path23.join(sourceRoot, rel);
10825
10866
  const dst = path23.join(worktreeRoot, rel);
10826
10867
  try {
10827
- const st = fs21.statSync(src);
10868
+ const st = fs22.statSync(src);
10828
10869
  if (!st.isFile())
10829
10870
  continue;
10830
- fs21.mkdirSync(path23.dirname(dst), { recursive: true });
10831
- fs21.copyFileSync(src, dst);
10871
+ fs22.mkdirSync(path23.dirname(dst), { recursive: true });
10872
+ fs22.copyFileSync(src, dst);
10832
10873
  copied++;
10833
10874
  } catch {
10834
10875
  }
@@ -10995,9 +11036,9 @@ ${detail}`);
10995
11036
  if (opts.task)
10996
11037
  worldEnv.OLAM_TASK = opts.task;
10997
11038
  const r2CredsPath = path23.join(os13.homedir(), ".olam", "r2-credentials.json");
10998
- if (fs21.existsSync(r2CredsPath)) {
11039
+ if (fs22.existsSync(r2CredsPath)) {
10999
11040
  try {
11000
- const r2Raw = fs21.readFileSync(r2CredsPath, "utf-8").trim();
11041
+ const r2Raw = fs22.readFileSync(r2CredsPath, "utf-8").trim();
11001
11042
  if (r2Raw.length > 0) {
11002
11043
  const r2 = JSON.parse(r2Raw);
11003
11044
  if (typeof r2.account_id === "string")
@@ -11015,9 +11056,9 @@ ${detail}`);
11015
11056
  }
11016
11057
  }
11017
11058
  const keysYamlPath = path23.join(os13.homedir(), ".olam", "keys.yaml");
11018
- if (fs21.existsSync(keysYamlPath)) {
11059
+ if (fs22.existsSync(keysYamlPath)) {
11019
11060
  try {
11020
- const keysRaw = fs21.readFileSync(keysYamlPath, "utf-8").trim();
11061
+ const keysRaw = fs22.readFileSync(keysYamlPath, "utf-8").trim();
11021
11062
  if (keysRaw.length > 0) {
11022
11063
  const parsed = YAML3.parse(keysRaw);
11023
11064
  if (typeof parsed === "object" && parsed !== null && !Array.isArray(parsed)) {
@@ -11078,8 +11119,8 @@ ${detail}`);
11078
11119
  for (const { repoName, relativePath, content } of fileWrites) {
11079
11120
  const absPath = path23.join(workspacePath, repoName, relativePath);
11080
11121
  try {
11081
- fs21.mkdirSync(path23.dirname(absPath), { recursive: true });
11082
- fs21.writeFileSync(absPath, content.endsWith("\n") ? content : content + "\n", {
11122
+ fs22.mkdirSync(path23.dirname(absPath), { recursive: true });
11123
+ fs22.writeFileSync(absPath, content.endsWith("\n") ? content : content + "\n", {
11083
11124
  mode: 384
11084
11125
  });
11085
11126
  console.log(`[secrets] ${repoName}: materialised ${relativePath} (${content.length} chars, mode 0600)`);
@@ -11304,7 +11345,7 @@ ${opts.task}`;
11304
11345
  execSync5(`docker exec ${containerName} mkdir -p /home/olam/.olam/policies`, { stdio: "pipe", timeout: 1e4 });
11305
11346
  for (const repo of repos) {
11306
11347
  const policiesDir = path23.join(workspacePath, repo.name, ".olam", "policies");
11307
- if (fs21.existsSync(policiesDir)) {
11348
+ if (fs22.existsSync(policiesDir)) {
11308
11349
  execSync5(`docker cp "${policiesDir}/." "${containerName}:/home/olam/.olam/policies/"`, { stdio: "pipe", timeout: 15e3 });
11309
11350
  }
11310
11351
  }
@@ -11396,8 +11437,8 @@ ${opts.task}`;
11396
11437
  } catch {
11397
11438
  }
11398
11439
  try {
11399
- fs21.rmSync(world.workspacePath, { recursive: true, force: true });
11400
- if (fs21.existsSync(world.workspacePath)) {
11440
+ fs22.rmSync(world.workspacePath, { recursive: true, force: true });
11441
+ if (fs22.existsSync(world.workspacePath)) {
11401
11442
  console.warn(`[WorldManager] destroyWorld(${worldId}): workspace dir ${world.workspacePath} still exists after rmSync. Run \`olam clean --apply\` to reap.`);
11402
11443
  }
11403
11444
  } catch (err) {
@@ -11470,26 +11511,50 @@ ${opts.task}`;
11470
11511
  if (!repoNames || repoNames.length === 0) {
11471
11512
  return [...this.config.repos];
11472
11513
  }
11514
+ let globalRepos = [];
11515
+ try {
11516
+ globalRepos = readGlobalConfig().repos;
11517
+ } catch {
11518
+ }
11473
11519
  return repoNames.map((name) => {
11474
- const repo = this.config.repos.find((r) => r.name === name);
11475
- if (!repo) {
11476
- throw new Error(`Repo "${name}" not found in config`);
11477
- }
11478
- return repo;
11520
+ const local = this.config.repos.find((r) => r.name === name);
11521
+ if (local)
11522
+ return local;
11523
+ const globalEntry = globalRepos.find((r) => r.name === name);
11524
+ if (globalEntry)
11525
+ return repoEntryToRepoConfig(globalEntry);
11526
+ throw new Error(`Repo "${name}" not found in config`);
11479
11527
  });
11480
11528
  }
11481
11529
  resolveReposFromNames(names) {
11482
- return names.map((name) => this.config.repos.find((r) => r.name === name)).filter((r) => r !== void 0);
11530
+ let globalRepos = [];
11531
+ try {
11532
+ globalRepos = readGlobalConfig().repos;
11533
+ } catch {
11534
+ }
11535
+ return names.map((name) => {
11536
+ const local = this.config.repos.find((r) => r.name === name);
11537
+ if (local)
11538
+ return local;
11539
+ const globalEntry = globalRepos.find((r) => r.name === name);
11540
+ if (!globalEntry)
11541
+ return void 0;
11542
+ try {
11543
+ return repoEntryToRepoConfig(globalEntry);
11544
+ } catch {
11545
+ return void 0;
11546
+ }
11547
+ }).filter((r) => r !== void 0);
11483
11548
  }
11484
11549
  transportPlanFile(planFilePath, workspacePath, repoNames) {
11485
- const planContent = fs21.readFileSync(planFilePath, "utf-8");
11550
+ const planContent = fs22.readFileSync(planFilePath, "utf-8");
11486
11551
  const planFileName = path23.basename(planFilePath);
11487
11552
  const targetRepo = repoNames[0];
11488
11553
  if (!targetRepo)
11489
11554
  return;
11490
11555
  const plansDir = path23.join(workspacePath, targetRepo, "docs", "plans");
11491
- fs21.mkdirSync(plansDir, { recursive: true });
11492
- fs21.writeFileSync(path23.join(plansDir, planFileName), planContent);
11556
+ fs22.mkdirSync(plansDir, { recursive: true });
11557
+ fs22.writeFileSync(path23.join(plansDir, planFileName), planContent);
11493
11558
  }
11494
11559
  resolveServices(repos) {
11495
11560
  const services = [];
@@ -12202,7 +12267,7 @@ var init_session_aggregator = __esm({
12202
12267
 
12203
12268
  // ../core/dist/dashboard/server.js
12204
12269
  import * as http from "node:http";
12205
- import * as fs22 from "node:fs";
12270
+ import * as fs23 from "node:fs";
12206
12271
  import * as path25 from "node:path";
12207
12272
  import { fileURLToPath as fileURLToPath3 } from "node:url";
12208
12273
  function jsonResponse(res, data, status = 200) {
@@ -12214,7 +12279,7 @@ function notFound(res) {
12214
12279
  }
12215
12280
  function openThoughtStore(workspacePath) {
12216
12281
  const dbPath = getWorldDbPath(workspacePath);
12217
- if (!fs22.existsSync(dbPath))
12282
+ if (!fs23.existsSync(dbPath))
12218
12283
  return null;
12219
12284
  return new ThoughtLocalStore(dbPath);
12220
12285
  }
@@ -12388,10 +12453,10 @@ function createDashboardServer(opts) {
12388
12453
  const thisDir = path25.dirname(fileURLToPath3(import.meta.url));
12389
12454
  const defaultPublicDir = path25.resolve(thisDir, "../../../control-plane/public");
12390
12455
  const publicDir = opts.publicDir ?? defaultPublicDir;
12391
- let hasPublicDir = fs22.existsSync(publicDir);
12456
+ let hasPublicDir = fs23.existsSync(publicDir);
12392
12457
  const server = http.createServer((req, res) => {
12393
12458
  if (!hasPublicDir) {
12394
- hasPublicDir = fs22.existsSync(publicDir);
12459
+ hasPublicDir = fs23.existsSync(publicDir);
12395
12460
  }
12396
12461
  const host = req.headers.host ?? `localhost:${port}`;
12397
12462
  const url = new URL(req.url ?? "/", `http://${host}`);
@@ -12670,17 +12735,17 @@ function createDashboardServer(opts) {
12670
12735
  notFound(res);
12671
12736
  return;
12672
12737
  }
12673
- if (fs22.existsSync(filePath) && fs22.statSync(filePath).isFile()) {
12738
+ if (fs23.existsSync(filePath) && fs23.statSync(filePath).isFile()) {
12674
12739
  const ext2 = path25.extname(filePath);
12675
12740
  const contentType = MIME[ext2] ?? "application/octet-stream";
12676
12741
  res.writeHead(200, { "Content-Type": contentType });
12677
- fs22.createReadStream(filePath).pipe(res);
12742
+ fs23.createReadStream(filePath).pipe(res);
12678
12743
  return;
12679
12744
  }
12680
12745
  filePath = path25.join(publicDir, "index.html");
12681
- if (fs22.existsSync(filePath)) {
12746
+ if (fs23.existsSync(filePath)) {
12682
12747
  res.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
12683
- fs22.createReadStream(filePath).pipe(res);
12748
+ fs23.createReadStream(filePath).pipe(res);
12684
12749
  return;
12685
12750
  }
12686
12751
  notFound(res);
@@ -12711,16 +12776,16 @@ var init_server = __esm({
12711
12776
  });
12712
12777
 
12713
12778
  // ../core/dist/dashboard/state.js
12714
- import * as fs23 from "node:fs";
12779
+ import * as fs24 from "node:fs";
12715
12780
  import * as os14 from "node:os";
12716
12781
  import * as path26 from "node:path";
12717
12782
  function saveDashboardState(state) {
12718
- fs23.mkdirSync(path26.dirname(STATE_PATH), { recursive: true });
12719
- fs23.writeFileSync(STATE_PATH, JSON.stringify(state, null, 2));
12783
+ fs24.mkdirSync(path26.dirname(STATE_PATH), { recursive: true });
12784
+ fs24.writeFileSync(STATE_PATH, JSON.stringify(state, null, 2));
12720
12785
  }
12721
12786
  function loadDashboardState() {
12722
12787
  try {
12723
- const raw = fs23.readFileSync(STATE_PATH, "utf-8");
12788
+ const raw = fs24.readFileSync(STATE_PATH, "utf-8");
12724
12789
  return JSON.parse(raw);
12725
12790
  } catch {
12726
12791
  return null;
@@ -12728,7 +12793,7 @@ function loadDashboardState() {
12728
12793
  }
12729
12794
  function clearDashboardState() {
12730
12795
  try {
12731
- fs23.unlinkSync(STATE_PATH);
12796
+ fs24.unlinkSync(STATE_PATH);
12732
12797
  } catch {
12733
12798
  }
12734
12799
  }
@@ -13143,7 +13208,7 @@ __export(host_cp_exports, {
13143
13208
  writeToken: () => writeToken
13144
13209
  });
13145
13210
  import * as crypto6 from "node:crypto";
13146
- import * as fs24 from "node:fs";
13211
+ import * as fs25 from "node:fs";
13147
13212
  import * as os15 from "node:os";
13148
13213
  import * as path27 from "node:path";
13149
13214
  import { spawnSync as spawnSync4 } from "node:child_process";
@@ -13158,7 +13223,7 @@ function findComposeFile() {
13158
13223
  path27.resolve(process.cwd(), "../packages/host-cp/compose.yaml")
13159
13224
  ];
13160
13225
  for (const c of candidates) {
13161
- if (fs24.existsSync(c)) return c;
13226
+ if (fs25.existsSync(c)) return c;
13162
13227
  }
13163
13228
  return path27.resolve(process.cwd(), "packages/host-cp/compose.yaml");
13164
13229
  }
@@ -13176,8 +13241,8 @@ function authSecretPath() {
13176
13241
  }
13177
13242
  function readAuthSecret2() {
13178
13243
  const filePath = authSecretPath();
13179
- if (!fs24.existsSync(filePath)) return null;
13180
- const raw = fs24.readFileSync(filePath, "utf-8").trim();
13244
+ if (!fs25.existsSync(filePath)) return null;
13245
+ const raw = fs25.readFileSync(filePath, "utf-8").trim();
13181
13246
  return raw.length > 0 ? raw : null;
13182
13247
  }
13183
13248
  function r2CredentialsPath() {
@@ -13185,8 +13250,8 @@ function r2CredentialsPath() {
13185
13250
  }
13186
13251
  function readR2Credentials() {
13187
13252
  const filePath = r2CredentialsPath();
13188
- if (!fs24.existsSync(filePath)) return null;
13189
- const raw = fs24.readFileSync(filePath, "utf-8").trim();
13253
+ if (!fs25.existsSync(filePath)) return null;
13254
+ const raw = fs25.readFileSync(filePath, "utf-8").trim();
13190
13255
  if (raw.length === 0) return null;
13191
13256
  try {
13192
13257
  const parsed = JSON.parse(raw);
@@ -13209,37 +13274,37 @@ function readR2Credentials() {
13209
13274
  function writeToken() {
13210
13275
  const token = crypto6.randomBytes(32).toString("hex");
13211
13276
  const filePath = tokenPath();
13212
- fs24.mkdirSync(path27.dirname(filePath), { recursive: true });
13213
- fs24.writeFileSync(filePath, token, { mode: 384 });
13277
+ fs25.mkdirSync(path27.dirname(filePath), { recursive: true });
13278
+ fs25.writeFileSync(filePath, token, { mode: 384 });
13214
13279
  return token;
13215
13280
  }
13216
13281
  function readToken() {
13217
13282
  const filePath = tokenPath();
13218
- if (!fs24.existsSync(filePath)) return null;
13219
- return fs24.readFileSync(filePath, "utf-8").trim();
13283
+ if (!fs25.existsSync(filePath)) return null;
13284
+ return fs25.readFileSync(filePath, "utf-8").trim();
13220
13285
  }
13221
13286
  function removeToken() {
13222
13287
  const filePath = tokenPath();
13223
- if (!fs24.existsSync(filePath)) return false;
13224
- fs24.unlinkSync(filePath);
13288
+ if (!fs25.existsSync(filePath)) return false;
13289
+ fs25.unlinkSync(filePath);
13225
13290
  return true;
13226
13291
  }
13227
13292
  function writePid(pid) {
13228
13293
  const filePath = pidPath();
13229
- fs24.mkdirSync(path27.dirname(filePath), { recursive: true });
13230
- fs24.writeFileSync(filePath, String(pid), { mode: 420 });
13294
+ fs25.mkdirSync(path27.dirname(filePath), { recursive: true });
13295
+ fs25.writeFileSync(filePath, String(pid), { mode: 420 });
13231
13296
  }
13232
13297
  function readPid() {
13233
13298
  const filePath = pidPath();
13234
- if (!fs24.existsSync(filePath)) return null;
13235
- const raw = fs24.readFileSync(filePath, "utf-8").trim();
13299
+ if (!fs25.existsSync(filePath)) return null;
13300
+ const raw = fs25.readFileSync(filePath, "utf-8").trim();
13236
13301
  const n = parseInt(raw, 10);
13237
13302
  return Number.isFinite(n) ? n : null;
13238
13303
  }
13239
13304
  function removePid() {
13240
13305
  const filePath = pidPath();
13241
- if (!fs24.existsSync(filePath)) return false;
13242
- fs24.unlinkSync(filePath);
13306
+ if (!fs25.existsSync(filePath)) return false;
13307
+ fs25.unlinkSync(filePath);
13243
13308
  return true;
13244
13309
  }
13245
13310
  async function findHostCpContainer() {
@@ -13402,7 +13467,7 @@ async function handleStart(opts) {
13402
13467
  }
13403
13468
  const token = writeToken();
13404
13469
  const composeFile = findComposeFile();
13405
- if (!fs24.existsSync(composeFile)) {
13470
+ if (!fs25.existsSync(composeFile)) {
13406
13471
  printError(`compose.yaml not found at ${composeFile}. Run from the olam project root.`);
13407
13472
  removeToken();
13408
13473
  process.exitCode = 1;
@@ -13484,7 +13549,7 @@ async function stopHostCp() {
13484
13549
  }
13485
13550
  async function handleStop() {
13486
13551
  const composeFile = findComposeFile();
13487
- if (!fs24.existsSync(composeFile)) {
13552
+ if (!fs25.existsSync(composeFile)) {
13488
13553
  printWarning(`compose.yaml not found at ${composeFile}. Cleaning up token + PID anyway.`);
13489
13554
  removeToken();
13490
13555
  removePid();
@@ -13512,13 +13577,13 @@ async function buildStatusReport() {
13512
13577
  const container = await findHostCpContainer();
13513
13578
  const health = await probeHealth();
13514
13579
  const tokenFile = tokenPath();
13515
- const tokenPresent = fs24.existsSync(tokenFile);
13580
+ const tokenPresent = fs25.existsSync(tokenFile);
13516
13581
  let tokenModeOk = false;
13517
13582
  if (tokenPresent) {
13518
- const mode = fs24.statSync(tokenFile).mode & 511;
13583
+ const mode = fs25.statSync(tokenFile).mode & 511;
13519
13584
  tokenModeOk = mode === 384;
13520
13585
  }
13521
- const pidPresent = fs24.existsSync(pidPath());
13586
+ const pidPresent = fs25.existsSync(pidPath());
13522
13587
  let stack;
13523
13588
  if (!container) {
13524
13589
  stack = "not_started";
@@ -13606,8 +13671,8 @@ async function discoverWorldPort(worldId) {
13606
13671
  }
13607
13672
  async function readHostCpToken2() {
13608
13673
  const tp = tokenPath();
13609
- if (!fs24.existsSync(tp)) return null;
13610
- return fs24.readFileSync(tp, "utf-8").trim();
13674
+ if (!fs25.existsSync(tp)) return null;
13675
+ return fs25.readFileSync(tp, "utf-8").trim();
13611
13676
  }
13612
13677
  async function callHostCpProxy(method, worldId, path48, body) {
13613
13678
  const token = await readHostCpToken2();
@@ -13738,7 +13803,7 @@ __export(install_root_exports, {
13738
13803
  isDevMode: () => isDevMode,
13739
13804
  resolveBuildScript: () => resolveBuildScript
13740
13805
  });
13741
- import { existsSync as existsSync22 } from "node:fs";
13806
+ import { existsSync as existsSync23 } from "node:fs";
13742
13807
  import { dirname as dirname17, join as join28, resolve as resolve8 } from "node:path";
13743
13808
  import { fileURLToPath as fileURLToPath4 } from "node:url";
13744
13809
  function installRoot(metaUrl = import.meta.url) {
@@ -13748,7 +13813,7 @@ function installRoot(metaUrl = import.meta.url) {
13748
13813
  function isDevMode(env = process.env, installRootDir = installRoot()) {
13749
13814
  if (env.OLAM_DEV !== "1") return false;
13750
13815
  const repoRoot = resolve8(installRootDir, "..", "..");
13751
- return existsSync22(join28(repoRoot, "packages")) && existsSync22(join28(repoRoot, "package.json"));
13816
+ return existsSync23(join28(repoRoot, "packages")) && existsSync23(join28(repoRoot, "package.json"));
13752
13817
  }
13753
13818
  function resolveBuildScript(input) {
13754
13819
  const { scriptRelPath, env = process.env, installRootDir = installRoot() } = input;
@@ -13927,20 +13992,20 @@ var init_registry_allowlist = __esm({
13927
13992
  });
13928
13993
 
13929
13994
  // ../core/dist/world/world-yaml.js
13930
- import * as fs26 from "node:fs";
13995
+ import * as fs27 from "node:fs";
13931
13996
  import * as path29 from "node:path";
13932
13997
  import { parse as parseYaml4, stringify as stringifyYaml4 } from "yaml";
13933
13998
  function writeWorldYaml(worldPath, data) {
13934
13999
  const olamDir = path29.join(worldPath, ".olam");
13935
- fs26.mkdirSync(olamDir, { recursive: true });
13936
- fs26.writeFileSync(path29.join(olamDir, "world.yaml"), stringifyYaml4(data), "utf-8");
14000
+ fs27.mkdirSync(olamDir, { recursive: true });
14001
+ fs27.writeFileSync(path29.join(olamDir, "world.yaml"), stringifyYaml4(data), "utf-8");
13937
14002
  }
13938
14003
  function readWorldYaml(worldPath) {
13939
14004
  const yamlPath = path29.join(worldPath, ".olam", "world.yaml");
13940
- if (!fs26.existsSync(yamlPath))
14005
+ if (!fs27.existsSync(yamlPath))
13941
14006
  return null;
13942
14007
  try {
13943
- const raw = fs26.readFileSync(yamlPath, "utf-8");
14008
+ const raw = fs27.readFileSync(yamlPath, "utf-8");
13944
14009
  const parsed = parseYaml4(raw);
13945
14010
  return WorldYamlSchema.parse(parsed);
13946
14011
  } catch {
@@ -14071,16 +14136,16 @@ __export(machine_schema_exports, {
14071
14136
  readMachineConfig: () => readMachineConfig,
14072
14137
  writeMachineConfig: () => writeMachineConfig
14073
14138
  });
14074
- import * as fs39 from "node:fs";
14139
+ import * as fs40 from "node:fs";
14075
14140
  import * as path43 from "node:path";
14076
14141
  import * as os23 from "node:os";
14077
14142
  import { parse as parseYaml5, stringify as stringifyYaml5 } from "yaml";
14078
14143
  function readMachineConfig(configPath) {
14079
14144
  const p = configPath ?? DEFAULT_CONFIG_PATH;
14080
- if (!fs39.existsSync(p))
14145
+ if (!fs40.existsSync(p))
14081
14146
  return null;
14082
14147
  try {
14083
- const raw = fs39.readFileSync(p, "utf-8");
14148
+ const raw = fs40.readFileSync(p, "utf-8");
14084
14149
  const parsed = parseYaml5(raw);
14085
14150
  return MachineConfigSchema.parse(parsed);
14086
14151
  } catch {
@@ -14089,8 +14154,8 @@ function readMachineConfig(configPath) {
14089
14154
  }
14090
14155
  function writeMachineConfig(config, configPath) {
14091
14156
  const p = configPath ?? DEFAULT_CONFIG_PATH;
14092
- fs39.mkdirSync(path43.dirname(p), { recursive: true });
14093
- fs39.writeFileSync(p, stringifyYaml5({ ...config }), { mode: 420 });
14157
+ fs40.mkdirSync(path43.dirname(p), { recursive: true });
14158
+ fs40.writeFileSync(p, stringifyYaml5({ ...config }), { mode: 420 });
14094
14159
  }
14095
14160
  function initMachineConfig(opts = {}) {
14096
14161
  const configPath = opts.configPath ?? DEFAULT_CONFIG_PATH;
@@ -14711,7 +14776,7 @@ var LOCAL_DATA_DIR = path10.join(os5.homedir(), ".olam", "auth-data");
14711
14776
  init_output();
14712
14777
  init_host_cp();
14713
14778
  init_auth();
14714
- import * as fs25 from "node:fs";
14779
+ import * as fs26 from "node:fs";
14715
14780
  import * as path28 from "node:path";
14716
14781
  import { spawnSync as spawnSync7 } from "node:child_process";
14717
14782
  import ora2 from "ora";
@@ -14723,13 +14788,13 @@ init_exit_codes();
14723
14788
  init_protocol_version();
14724
14789
  init_output();
14725
14790
  import { spawn as spawn3, spawnSync as spawnSync6 } from "node:child_process";
14726
- import { existsSync as existsSync23, readFileSync as readFileSync18 } from "node:fs";
14791
+ import { existsSync as existsSync24, readFileSync as readFileSync18 } from "node:fs";
14727
14792
  import { join as join29 } from "node:path";
14728
14793
  import ora from "ora";
14729
14794
  import pc6 from "picocolors";
14730
14795
  function loadImageDigests(installRootDir = installRoot()) {
14731
14796
  const digestsPath = join29(installRootDir, "dist", "image-digests.json");
14732
- if (!existsSync23(digestsPath)) {
14797
+ if (!existsSync24(digestsPath)) {
14733
14798
  throw new Error(
14734
14799
  `image-digests.json missing at ${digestsPath}. Re-run \`npm install -g @pleri/olam-cli@<version>\` to refresh the tarball.`
14735
14800
  );
@@ -15054,7 +15119,7 @@ function parseAuthUpgradeOpts(raw) {
15054
15119
  }
15055
15120
  function validateAuthRepoRoot(cwd) {
15056
15121
  const marker = path28.join(cwd, "packages/auth-service/Dockerfile");
15057
- if (!fs25.existsSync(marker)) {
15122
+ if (!fs26.existsSync(marker)) {
15058
15123
  return {
15059
15124
  ok: false,
15060
15125
  error: `Not an olam repo root (expected ${marker}).
@@ -15788,14 +15853,14 @@ ${pc9.dim("Next: olam create --name my-world")}`);
15788
15853
  // src/commands/create.ts
15789
15854
  init_manager();
15790
15855
  import { spawnSync as spawnSync9 } from "node:child_process";
15791
- import { existsSync as existsSync26 } from "node:fs";
15856
+ import { existsSync as existsSync27 } from "node:fs";
15792
15857
  import { dirname as dirname18, resolve as resolve9 } from "node:path";
15793
15858
  import ora3 from "ora";
15794
15859
  import pc10 from "picocolors";
15795
15860
 
15796
15861
  // ../core/dist/world/devbox-freshness.js
15797
15862
  import { execSync as execSync7 } from "node:child_process";
15798
- import { existsSync as existsSync25, statSync as statSync6 } from "node:fs";
15863
+ import { existsSync as existsSync26, statSync as statSync6 } from "node:fs";
15799
15864
  import { join as join31 } from "node:path";
15800
15865
  var DEFAULT_DEVBOX_IMAGE = "olam-devbox:latest";
15801
15866
  var DEVBOX_BAKED_SOURCES = [
@@ -15885,7 +15950,7 @@ function defaultDockerInspect(image) {
15885
15950
  }
15886
15951
  function defaultStatMtime(absPath) {
15887
15952
  try {
15888
- if (!existsSync25(absPath))
15953
+ if (!existsSync26(absPath))
15889
15954
  return null;
15890
15955
  return statSync6(absPath).mtimeMs;
15891
15956
  } catch {
@@ -16025,15 +16090,15 @@ init_host_cp();
16025
16090
  var HOST_CP_URL = "http://127.0.0.1:19000";
16026
16091
  async function readHostCpTokenForCreate() {
16027
16092
  try {
16028
- const { default: fs45 } = await import("node:fs");
16093
+ const { default: fs46 } = await import("node:fs");
16029
16094
  const { default: os27 } = await import("node:os");
16030
16095
  const { default: path48 } = await import("node:path");
16031
16096
  const tp = path48.join(
16032
16097
  process.env.OLAM_HOME ?? path48.join(os27.homedir(), ".olam"),
16033
16098
  "host-cp.token"
16034
16099
  );
16035
- if (!fs45.existsSync(tp)) return null;
16036
- return fs45.readFileSync(tp, "utf-8").trim();
16100
+ if (!fs46.existsSync(tp)) return null;
16101
+ return fs46.readFileSync(tp, "utf-8").trim();
16037
16102
  } catch {
16038
16103
  return null;
16039
16104
  }
@@ -16382,7 +16447,7 @@ ${pc10.cyan("Host CP UI:")} ${worldUrl}`);
16382
16447
  function resolveRepoRoot(start) {
16383
16448
  let cur = start;
16384
16449
  while (true) {
16385
- if (existsSync26(resolve9(cur, "packages")) && existsSync26(resolve9(cur, "package.json"))) {
16450
+ if (existsSync27(resolve9(cur, "packages")) && existsSync27(resolve9(cur, "package.json"))) {
16386
16451
  return cur;
16387
16452
  }
16388
16453
  const parent = dirname18(cur);
@@ -16396,12 +16461,12 @@ function defaultNameFromPrompt(prompt) {
16396
16461
  }
16397
16462
  async function readHostCpToken3() {
16398
16463
  try {
16399
- const { default: fs45 } = await import("node:fs");
16464
+ const { default: fs46 } = await import("node:fs");
16400
16465
  const { default: os27 } = await import("node:os");
16401
16466
  const { default: path48 } = await import("node:path");
16402
16467
  const tp = path48.join(os27.homedir(), ".olam", "host-cp.token");
16403
- if (!fs45.existsSync(tp)) return null;
16404
- const raw = fs45.readFileSync(tp, "utf-8").trim();
16468
+ if (!fs46.existsSync(tp)) return null;
16469
+ const raw = fs46.readFileSync(tp, "utf-8").trim();
16405
16470
  return raw.length > 0 ? raw : null;
16406
16471
  } catch {
16407
16472
  return null;
@@ -16613,7 +16678,7 @@ function registerList(program2) {
16613
16678
 
16614
16679
  // src/commands/status.ts
16615
16680
  init_output();
16616
- import * as fs27 from "node:fs";
16681
+ import * as fs28 from "node:fs";
16617
16682
  import * as os16 from "node:os";
16618
16683
  import * as path30 from "node:path";
16619
16684
  var CLI_VERSION2 = process.env["OLAM_CLI_VERSION"] ?? "0.0.0";
@@ -16648,11 +16713,11 @@ async function getMachineStatus(_probe, _loadCtx, _readToken) {
16648
16713
  const manifestPath2 = path30.join(os16.homedir(), ".olam", "cache", "manifest.json");
16649
16714
  let updateAvailable = null;
16650
16715
  let lastUpdateCheck = null;
16651
- if (fs27.existsSync(manifestPath2)) {
16652
- const mtime = fs27.statSync(manifestPath2).mtime;
16716
+ if (fs28.existsSync(manifestPath2)) {
16717
+ const mtime = fs28.statSync(manifestPath2).mtime;
16653
16718
  lastUpdateCheck = mtime.toISOString();
16654
16719
  try {
16655
- const manifest = JSON.parse(fs27.readFileSync(manifestPath2, "utf-8"));
16720
+ const manifest = JSON.parse(fs28.readFileSync(manifestPath2, "utf-8"));
16656
16721
  const latest = manifest["version"];
16657
16722
  updateAvailable = latest !== void 0 && latest !== CLI_VERSION2;
16658
16723
  } catch {
@@ -16775,7 +16840,7 @@ function registerDestroy(program2) {
16775
16840
  // src/commands/clean.ts
16776
16841
  init_context();
16777
16842
  init_output();
16778
- import fs28 from "node:fs";
16843
+ import fs29 from "node:fs";
16779
16844
  import os17 from "node:os";
16780
16845
  import path31 from "node:path";
16781
16846
  import { execFileSync as execFileSync6 } from "node:child_process";
@@ -16802,7 +16867,7 @@ async function runClean(opts) {
16802
16867
  return 1;
16803
16868
  }
16804
16869
  const worldsDir = path31.join(os17.homedir(), ".olam", "worlds");
16805
- if (!fs28.existsSync(worldsDir)) {
16870
+ if (!fs29.existsSync(worldsDir)) {
16806
16871
  if (opts.json) {
16807
16872
  process.stdout.write(`${JSON.stringify({ worldsDir, entries: [] })}
16808
16873
  `);
@@ -16817,7 +16882,7 @@ async function runClean(opts) {
16817
16882
  }
16818
16883
  const worktreeMap = collectWorktrees(worldsDir);
16819
16884
  const entries = [];
16820
- for (const id of fs28.readdirSync(worldsDir).sort()) {
16885
+ for (const id of fs29.readdirSync(worldsDir).sort()) {
16821
16886
  const fullPath = path31.join(worldsDir, id);
16822
16887
  const stat = safeStat(fullPath);
16823
16888
  if (!stat || !stat.isDirectory()) continue;
@@ -16930,20 +16995,20 @@ function reapEntry(entry) {
16930
16995
  }
16931
16996
  }
16932
16997
  try {
16933
- fs28.rmSync(entry.path, { recursive: true, force: true });
16998
+ fs29.rmSync(entry.path, { recursive: true, force: true });
16934
16999
  } catch (err) {
16935
17000
  process.stderr.write(` ! rm ${entry.path}: ${err instanceof Error ? err.message : String(err)}
16936
17001
  `);
16937
17002
  return false;
16938
17003
  }
16939
- return !fs28.existsSync(entry.path);
17004
+ return !fs29.existsSync(entry.path);
16940
17005
  }
16941
17006
  function collectWorktrees(worldsDir) {
16942
17007
  const out = /* @__PURE__ */ new Map();
16943
- for (const id of fs28.readdirSync(worldsDir)) {
17008
+ for (const id of fs29.readdirSync(worldsDir)) {
16944
17009
  const child = path31.join(worldsDir, id, "olam");
16945
17010
  const gitMarker = path31.join(child, ".git");
16946
- if (!fs28.existsSync(gitMarker)) continue;
17011
+ if (!fs29.existsSync(gitMarker)) continue;
16947
17012
  const gitDir = resolveGitDirForWorktree(child);
16948
17013
  if (!gitDir) continue;
16949
17014
  const branch = readBranch(child);
@@ -17011,7 +17076,7 @@ function countUnpushed(worktreePath) {
17011
17076
  }
17012
17077
  function safeStat(p) {
17013
17078
  try {
17014
- return fs28.statSync(p);
17079
+ return fs29.statSync(p);
17015
17080
  } catch {
17016
17081
  return null;
17017
17082
  }
@@ -17023,7 +17088,7 @@ function computeBytes(p) {
17023
17088
  const cur = stack.pop();
17024
17089
  let st;
17025
17090
  try {
17026
- st = fs28.lstatSync(cur);
17091
+ st = fs29.lstatSync(cur);
17027
17092
  } catch {
17028
17093
  continue;
17029
17094
  }
@@ -17031,7 +17096,7 @@ function computeBytes(p) {
17031
17096
  if (st.isDirectory()) {
17032
17097
  let entries;
17033
17098
  try {
17034
- entries = fs28.readdirSync(cur);
17099
+ entries = fs29.readdirSync(cur);
17035
17100
  } catch {
17036
17101
  continue;
17037
17102
  }
@@ -17243,7 +17308,7 @@ init_context();
17243
17308
  init_output();
17244
17309
  init_exit_codes();
17245
17310
  init_world_paths();
17246
- import * as fs29 from "node:fs";
17311
+ import * as fs30 from "node:fs";
17247
17312
  import "node:path";
17248
17313
  import ora6 from "ora";
17249
17314
  function registerCrystallize(program2, options = {}) {
@@ -17275,7 +17340,7 @@ function registerCrystallize(program2, options = {}) {
17275
17340
  return;
17276
17341
  }
17277
17342
  const thoughtDbPath = getWorldDbPath(world.workspacePath);
17278
- if (!fs29.existsSync(thoughtDbPath)) {
17343
+ if (!fs30.existsSync(thoughtDbPath)) {
17279
17344
  printError(`No thoughts captured yet for "${worldId}". Run a dispatch first.`);
17280
17345
  process.exitCode = EXIT_GENERIC_ERROR;
17281
17346
  return;
@@ -19479,7 +19544,7 @@ function registerPolicyCheck(program2) {
19479
19544
  }
19480
19545
 
19481
19546
  // src/commands/worldspec/compile.ts
19482
- import { existsSync as existsSync30, mkdirSync as mkdirSync18, readFileSync as readFileSync21, writeFileSync as writeFileSync14 } from "node:fs";
19547
+ import { existsSync as existsSync31, mkdirSync as mkdirSync18, readFileSync as readFileSync21, writeFileSync as writeFileSync14 } from "node:fs";
19483
19548
  import { resolve as resolvePath } from "node:path";
19484
19549
  import YAML5 from "yaml";
19485
19550
 
@@ -20282,7 +20347,7 @@ function registerWorldspecCompile(parent) {
20282
20347
  const sourcePolicies = [];
20283
20348
  for (const p of paths) {
20284
20349
  const abs = resolvePath(process.cwd(), p);
20285
- if (!existsSync30(abs)) {
20350
+ if (!existsSync31(abs)) {
20286
20351
  printError(`worldspec not found at ${abs}`);
20287
20352
  process.exit(EXIT_WORLDSPEC_FILE_NOT_FOUND);
20288
20353
  }
@@ -20373,7 +20438,7 @@ function getPkgVersion() {
20373
20438
  // src/commands/worldspec/init.ts
20374
20439
  init_exit_codes();
20375
20440
  init_output();
20376
- import { existsSync as existsSync31, mkdirSync as mkdirSync19, readFileSync as readFileSync22, writeFileSync as writeFileSync15 } from "node:fs";
20441
+ import { existsSync as existsSync32, mkdirSync as mkdirSync19, readFileSync as readFileSync22, writeFileSync as writeFileSync15 } from "node:fs";
20377
20442
  import { execSync as execSync10 } from "node:child_process";
20378
20443
  import { basename as basename3, resolve as resolvePath2 } from "node:path";
20379
20444
  function registerWorldspecInit(parent) {
@@ -20391,7 +20456,7 @@ function registerWorldspecInit(parent) {
20391
20456
  const cwd = process.cwd();
20392
20457
  const targetDir = resolvePath2(cwd, ".olam/worldspecs");
20393
20458
  const targetFile = resolvePath2(targetDir, "default.yaml");
20394
- if (existsSync31(targetFile) && !opts.force) {
20459
+ if (existsSync32(targetFile) && !opts.force) {
20395
20460
  printError(
20396
20461
  `${targetFile} already exists; pass --force to overwrite`
20397
20462
  );
@@ -20425,12 +20490,12 @@ function registerWorldspecInit(parent) {
20425
20490
  });
20426
20491
  }
20427
20492
  function detectProjectShape(root, useAdbYaml) {
20428
- const hasGemfile = existsSync31(resolvePath2(root, "Gemfile"));
20429
- const hasNodePackageJson = existsSync31(resolvePath2(root, "package.json"));
20430
- const hasAdbYaml = existsSync31(resolvePath2(root, ".adb.yaml"));
20493
+ const hasGemfile = existsSync32(resolvePath2(root, "Gemfile"));
20494
+ const hasNodePackageJson = existsSync32(resolvePath2(root, "package.json"));
20495
+ const hasAdbYaml = existsSync32(resolvePath2(root, ".adb.yaml"));
20431
20496
  let rubyVersion = null;
20432
20497
  const rubyVersionPath = resolvePath2(root, ".ruby-version");
20433
- if (existsSync31(rubyVersionPath)) {
20498
+ if (existsSync32(rubyVersionPath)) {
20434
20499
  try {
20435
20500
  const raw = readFileSync22(rubyVersionPath, "utf8").trim();
20436
20501
  const match2 = raw.match(/(\d+\.\d+\.\d+)/);
@@ -21835,7 +21900,7 @@ function registerWorldspecSchema(parent) {
21835
21900
  }
21836
21901
 
21837
21902
  // src/commands/worldspec/validate.ts
21838
- import { existsSync as existsSync32, readFileSync as readFileSync23 } from "node:fs";
21903
+ import { existsSync as existsSync33, readFileSync as readFileSync23 } from "node:fs";
21839
21904
  import { resolve as resolvePath4 } from "node:path";
21840
21905
  init_exit_codes();
21841
21906
  init_output();
@@ -21852,7 +21917,7 @@ function registerWorldspecValidate(parent) {
21852
21917
  "human"
21853
21918
  ).action(async (pathArg, opts) => {
21854
21919
  const absPath = resolvePath4(process.cwd(), pathArg);
21855
- if (!existsSync32(absPath)) {
21920
+ if (!existsSync33(absPath)) {
21856
21921
  printError(`worldspec not found at ${absPath}`);
21857
21922
  process.exit(EXIT_WORLDSPEC_FILE_NOT_FOUND);
21858
21923
  }
@@ -21904,14 +21969,14 @@ function registerWorldspec(program2) {
21904
21969
  // src/commands/upgrade.ts
21905
21970
  init_output();
21906
21971
  init_host_cp();
21907
- import * as fs32 from "node:fs";
21972
+ import * as fs33 from "node:fs";
21908
21973
  import * as path36 from "node:path";
21909
21974
  import { spawnSync as spawnSync11 } from "node:child_process";
21910
21975
  import ora7 from "ora";
21911
21976
  import pc17 from "picocolors";
21912
21977
 
21913
21978
  // src/commands/upgrade-lock.ts
21914
- import * as fs30 from "node:fs";
21979
+ import * as fs31 from "node:fs";
21915
21980
  import * as os18 from "node:os";
21916
21981
  import * as path34 from "node:path";
21917
21982
  import { spawnSync as spawnSync10 } from "node:child_process";
@@ -21919,8 +21984,8 @@ var LOCK_FILE_PATH = path34.join(os18.homedir(), ".olam", ".upgrade.lock");
21919
21984
  var STALE_LOCK_TIMEOUT_MS = 5 * 60 * 1e3;
21920
21985
  function readLockFile(lockPath) {
21921
21986
  try {
21922
- if (!fs30.existsSync(lockPath)) return null;
21923
- const raw = fs30.readFileSync(lockPath, "utf-8").trim();
21987
+ if (!fs31.existsSync(lockPath)) return null;
21988
+ const raw = fs31.readFileSync(lockPath, "utf-8").trim();
21924
21989
  if (raw.length === 0) return null;
21925
21990
  const parsed = JSON.parse(raw);
21926
21991
  if (typeof parsed.pid !== "number" || typeof parsed.startTs !== "number") return null;
@@ -21966,15 +22031,15 @@ function isStaleLock(content, nowMs = Date.now()) {
21966
22031
  }
21967
22032
  function acquireLock(lockPath = LOCK_FILE_PATH, nowMs = Date.now()) {
21968
22033
  const dir = path34.dirname(lockPath);
21969
- fs30.mkdirSync(dir, { recursive: true });
22034
+ fs31.mkdirSync(dir, { recursive: true });
21970
22035
  for (let attempt = 0; attempt < 2; attempt++) {
21971
22036
  try {
21972
- const fd = fs30.openSync(lockPath, "wx", 420);
22037
+ const fd = fs31.openSync(lockPath, "wx", 420);
21973
22038
  try {
21974
22039
  const content = { pid: process.pid, startTs: nowMs };
21975
- fs30.writeSync(fd, JSON.stringify(content));
22040
+ fs31.writeSync(fd, JSON.stringify(content));
21976
22041
  } finally {
21977
- fs30.closeSync(fd);
22042
+ fs31.closeSync(fd);
21978
22043
  }
21979
22044
  return { acquired: true, lockPath };
21980
22045
  } catch (err) {
@@ -21983,7 +22048,7 @@ function acquireLock(lockPath = LOCK_FILE_PATH, nowMs = Date.now()) {
21983
22048
  const existing2 = readLockFile(lockPath);
21984
22049
  if (isStaleLock(existing2, nowMs)) {
21985
22050
  try {
21986
- fs30.unlinkSync(lockPath);
22051
+ fs31.unlinkSync(lockPath);
21987
22052
  } catch (unlinkErr) {
21988
22053
  const ucode = unlinkErr.code;
21989
22054
  if (ucode !== "ENOENT") throw unlinkErr;
@@ -22008,7 +22073,7 @@ function acquireLock(lockPath = LOCK_FILE_PATH, nowMs = Date.now()) {
22008
22073
  }
22009
22074
  function releaseLock(lockPath = LOCK_FILE_PATH) {
22010
22075
  try {
22011
- fs30.unlinkSync(lockPath);
22076
+ fs31.unlinkSync(lockPath);
22012
22077
  } catch (err) {
22013
22078
  const code = err.code;
22014
22079
  if (code !== "ENOENT") throw err;
@@ -22026,7 +22091,7 @@ function formatRefusalMessage(result, lockPath = LOCK_FILE_PATH) {
22026
22091
  }
22027
22092
 
22028
22093
  // src/commands/upgrade-log.ts
22029
- import * as fs31 from "node:fs";
22094
+ import * as fs32 from "node:fs";
22030
22095
  import * as os19 from "node:os";
22031
22096
  import * as path35 from "node:path";
22032
22097
  function getUpgradeLogPath() {
@@ -22036,9 +22101,9 @@ function getUpgradeLogPath() {
22036
22101
  var UPGRADE_LOG_PATH = getUpgradeLogPath();
22037
22102
  function appendUpgradeLog(row, logPath = getUpgradeLogPath()) {
22038
22103
  try {
22039
- fs31.mkdirSync(path35.dirname(logPath), { recursive: true });
22104
+ fs32.mkdirSync(path35.dirname(logPath), { recursive: true });
22040
22105
  const line = JSON.stringify(row) + "\n";
22041
- fs31.appendFileSync(logPath, line, { mode: 420 });
22106
+ fs32.appendFileSync(logPath, line, { mode: 420 });
22042
22107
  } catch (err) {
22043
22108
  process.stderr.write(
22044
22109
  `[upgrade-log] failed to append: ${err instanceof Error ? err.message : String(err)}
@@ -22047,10 +22112,10 @@ function appendUpgradeLog(row, logPath = getUpgradeLogPath()) {
22047
22112
  }
22048
22113
  }
22049
22114
  function readUpgradeLog(limit = 10, logPath = getUpgradeLogPath()) {
22050
- if (!fs31.existsSync(logPath)) return [];
22115
+ if (!fs32.existsSync(logPath)) return [];
22051
22116
  let raw;
22052
22117
  try {
22053
- raw = fs31.readFileSync(logPath, "utf-8");
22118
+ raw = fs32.readFileSync(logPath, "utf-8");
22054
22119
  } catch (err) {
22055
22120
  process.stderr.write(
22056
22121
  `[upgrade-log] failed to read: ${err instanceof Error ? err.message : String(err)}
@@ -22145,10 +22210,10 @@ var AUTH_HEALTH_URL2 = "http://127.0.0.1:9999/health";
22145
22210
  function isNodeModulesInSync(cwd) {
22146
22211
  const lockPath = path36.join(cwd, "package-lock.json");
22147
22212
  const markerPath = path36.join(cwd, "node_modules", ".package-lock.json");
22148
- if (!fs32.existsSync(lockPath) || !fs32.existsSync(markerPath)) return false;
22213
+ if (!fs33.existsSync(lockPath) || !fs33.existsSync(markerPath)) return false;
22149
22214
  try {
22150
- const lockStat = fs32.statSync(lockPath);
22151
- const markerStat = fs32.statSync(markerPath);
22215
+ const lockStat = fs33.statSync(lockPath);
22216
+ const markerStat = fs33.statSync(markerPath);
22152
22217
  return markerStat.mtimeMs >= lockStat.mtimeMs;
22153
22218
  } catch {
22154
22219
  return false;
@@ -22165,7 +22230,7 @@ function shouldSkipInstall(opts, cwd) {
22165
22230
  }
22166
22231
  function validateRepoRoot(cwd) {
22167
22232
  const marker = path36.join(cwd, "packages/host-cp/compose.yaml");
22168
- if (!fs32.existsSync(marker)) {
22233
+ if (!fs33.existsSync(marker)) {
22169
22234
  return {
22170
22235
  ok: false,
22171
22236
  error: `Not an olam repo root (expected ${marker}).
@@ -22522,8 +22587,8 @@ async function recreateAuthService() {
22522
22587
  }
22523
22588
  function readBundleHash(cwd) {
22524
22589
  const indexPath = path36.join(cwd, "packages/control-plane/public/index.html");
22525
- if (!fs32.existsSync(indexPath)) return null;
22526
- return extractBundleHash(fs32.readFileSync(indexPath, "utf-8"));
22590
+ if (!fs33.existsSync(indexPath)) return null;
22591
+ return extractBundleHash(fs33.readFileSync(indexPath, "utf-8"));
22527
22592
  }
22528
22593
  async function runUpgradePullByDigest(deps = {}) {
22529
22594
  const docker2 = deps.docker ?? realDocker;
@@ -23557,7 +23622,7 @@ ${pc19.dim(`world: ${worldId} sort: ${sortKey} refresh: 5s Ctrl-C to exit`)}
23557
23622
 
23558
23623
  // src/commands/keys.ts
23559
23624
  init_output();
23560
- import * as fs33 from "node:fs";
23625
+ import * as fs34 from "node:fs";
23561
23626
  import * as os20 from "node:os";
23562
23627
  import * as path37 from "node:path";
23563
23628
  import YAML6 from "yaml";
@@ -23569,8 +23634,8 @@ function keysFilePath() {
23569
23634
  }
23570
23635
  function readKeysFile() {
23571
23636
  const filePath = keysFilePath();
23572
- if (!fs33.existsSync(filePath)) return null;
23573
- const raw = fs33.readFileSync(filePath, "utf-8").trim();
23637
+ if (!fs34.existsSync(filePath)) return null;
23638
+ const raw = fs34.readFileSync(filePath, "utf-8").trim();
23574
23639
  if (raw.length === 0) return null;
23575
23640
  try {
23576
23641
  const parsed = YAML6.parse(raw);
@@ -23586,13 +23651,13 @@ function readKeysFile() {
23586
23651
  }
23587
23652
  function writeKeysFile(keys) {
23588
23653
  const dir = olamHome2();
23589
- if (!fs33.existsSync(dir)) {
23590
- fs33.mkdirSync(dir, { recursive: true });
23654
+ if (!fs34.existsSync(dir)) {
23655
+ fs34.mkdirSync(dir, { recursive: true });
23591
23656
  }
23592
23657
  const filePath = keysFilePath();
23593
23658
  const content = YAML6.stringify(keys);
23594
- fs33.writeFileSync(filePath, content, { encoding: "utf-8", mode: 384 });
23595
- fs33.chmodSync(filePath, 384);
23659
+ fs34.writeFileSync(filePath, content, { encoding: "utf-8", mode: 384 });
23660
+ fs34.chmodSync(filePath, 384);
23596
23661
  }
23597
23662
  function redact(value) {
23598
23663
  if (value.length <= 8) return value + "...";
@@ -23635,7 +23700,7 @@ function registerKeys(program2) {
23635
23700
  }
23636
23701
  const { [key]: _removed, ...rest } = existing;
23637
23702
  if (Object.keys(rest).length === 0) {
23638
- fs33.unlinkSync(keysFilePath());
23703
+ fs34.unlinkSync(keysFilePath());
23639
23704
  } else {
23640
23705
  writeKeysFile(rest);
23641
23706
  }
@@ -23660,7 +23725,7 @@ function registerKeys(program2) {
23660
23725
  // src/commands/world-snapshot.ts
23661
23726
  init_snapshot();
23662
23727
  init_output();
23663
- import * as fs34 from "node:fs";
23728
+ import * as fs35 from "node:fs";
23664
23729
  import * as path38 from "node:path";
23665
23730
  import { execSync as execSync11 } from "node:child_process";
23666
23731
  import pc20 from "picocolors";
@@ -23686,14 +23751,14 @@ function bumpDeprecationCounter() {
23686
23751
  if (process.env[INTERNAL_SENTINEL_ENV] === "1") return;
23687
23752
  const counterPath = path38.join(snapshotsDir(), ".deprecation-counter");
23688
23753
  try {
23689
- fs34.mkdirSync(path38.dirname(counterPath), { recursive: true });
23754
+ fs35.mkdirSync(path38.dirname(counterPath), { recursive: true });
23690
23755
  let current = 0;
23691
- if (fs34.existsSync(counterPath)) {
23692
- const raw = fs34.readFileSync(counterPath, "utf-8").trim();
23756
+ if (fs35.existsSync(counterPath)) {
23757
+ const raw = fs35.readFileSync(counterPath, "utf-8").trim();
23693
23758
  const parsed = parseInt(raw, 10);
23694
23759
  if (Number.isInteger(parsed) && parsed >= 0) current = parsed;
23695
23760
  }
23696
- fs34.writeFileSync(counterPath, String(current + 1), { mode: 384 });
23761
+ fs35.writeFileSync(counterPath, String(current + 1), { mode: 384 });
23697
23762
  } catch {
23698
23763
  }
23699
23764
  }
@@ -23776,10 +23841,10 @@ async function captureGems(worldId, workspacePath, repo) {
23776
23841
  }
23777
23842
  const tarPath = snapshotTarPath(worldId, "gems", repo, fingerprint);
23778
23843
  const vendorBundle = path38.join(repoDir, "vendor", "bundle");
23779
- if (fs34.existsSync(vendorBundle)) {
23844
+ if (fs35.existsSync(vendorBundle)) {
23780
23845
  try {
23781
23846
  packTarball(vendorBundle, tarPath);
23782
- const stat = fs34.statSync(tarPath);
23847
+ const stat = fs35.statSync(tarPath);
23783
23848
  const manifest = {
23784
23849
  kind: "gems",
23785
23850
  worldId,
@@ -23812,10 +23877,10 @@ async function captureGems(worldId, workspacePath, repo) {
23812
23877
  `docker exec ${containerName} sh -c 'mkdir -p "$(dirname ${tmpTar})" && tar -czf ${tmpTar}.tmp -C ${bundlePath} . && mv ${tmpTar}.tmp ${tmpTar}'`,
23813
23878
  { stdio: "pipe", timeout: 12e4 }
23814
23879
  );
23815
- fs34.mkdirSync(path38.dirname(tarPath), { recursive: true });
23880
+ fs35.mkdirSync(path38.dirname(tarPath), { recursive: true });
23816
23881
  execSync11(`docker cp ${containerName}:${tmpTar} "${tarPath}"`, { stdio: "pipe", timeout: 12e4 });
23817
23882
  execSync11(`docker exec ${containerName} rm -f ${tmpTar}`, { stdio: "pipe" });
23818
- const stat = fs34.statSync(tarPath);
23883
+ const stat = fs35.statSync(tarPath);
23819
23884
  const manifest = {
23820
23885
  kind: "gems",
23821
23886
  worldId,
@@ -23838,13 +23903,13 @@ async function captureNode(worldId, workspacePath, repo) {
23838
23903
  return { ok: false, tarPath: "", msg: "no lockfile \u2014 layer does not apply" };
23839
23904
  }
23840
23905
  const nodeModules = path38.join(repoDir, "node_modules");
23841
- if (!fs34.existsSync(nodeModules)) {
23906
+ if (!fs35.existsSync(nodeModules)) {
23842
23907
  return { ok: false, tarPath: "", msg: "node_modules not installed yet" };
23843
23908
  }
23844
23909
  const tarPath = snapshotTarPath(worldId, "node", repo, fingerprint);
23845
23910
  try {
23846
23911
  packTarball(nodeModules, tarPath);
23847
- const stat = fs34.statSync(tarPath);
23912
+ const stat = fs35.statSync(tarPath);
23848
23913
  const manifest = {
23849
23914
  kind: "node",
23850
23915
  worldId,
@@ -23876,13 +23941,13 @@ async function capturePg(worldId, workspacePath, repoNames) {
23876
23941
  }
23877
23942
  try {
23878
23943
  execSync11(`docker stop ${containerName}`, { stdio: "pipe", timeout: 3e4 });
23879
- fs34.mkdirSync(path38.dirname(tarPath), { recursive: true });
23944
+ fs35.mkdirSync(path38.dirname(tarPath), { recursive: true });
23880
23945
  execSync11(
23881
23946
  `docker run --rm -v "${volumeName2}:/pgdata:ro" -v "${path38.dirname(tarPath)}:/dest" alpine sh -c 'tar -czf /dest/${path38.basename(tarPath)}.tmp -C /pgdata . && mv /dest/${path38.basename(tarPath)}.tmp /dest/${path38.basename(tarPath)}'`,
23882
23947
  { stdio: "pipe", timeout: 18e4 }
23883
23948
  );
23884
23949
  execSync11(`docker start ${containerName}`, { stdio: "pipe", timeout: 3e4 });
23885
- const stat = fs34.statSync(tarPath);
23950
+ const stat = fs35.statSync(tarPath);
23886
23951
  const manifest = {
23887
23952
  kind: "pg",
23888
23953
  worldId,
@@ -23906,18 +23971,18 @@ async function handleEvict(opts) {
23906
23971
  const maxBytes = Number.isInteger(cap) && cap > 0 ? cap : 5 * 1024 * 1024 * 1024;
23907
23972
  if (opts.dryRun) {
23908
23973
  const root = snapshotsDir();
23909
- if (!fs34.existsSync(root)) {
23974
+ if (!fs35.existsSync(root)) {
23910
23975
  console.log(pc20.dim("No snapshot dir; nothing to evict."));
23911
23976
  return;
23912
23977
  }
23913
23978
  const allTars = [];
23914
23979
  const walk2 = (d) => {
23915
- for (const entry of fs34.readdirSync(d, { withFileTypes: true })) {
23980
+ for (const entry of fs35.readdirSync(d, { withFileTypes: true })) {
23916
23981
  const full = path38.join(d, entry.name);
23917
23982
  if (entry.isDirectory()) {
23918
23983
  walk2(full);
23919
23984
  } else if (entry.name.endsWith(".tar.gz")) {
23920
- const stat = fs34.statSync(full);
23985
+ const stat = fs35.statSync(full);
23921
23986
  allTars.push({ path: full, size: stat.size, mtime: stat.mtimeMs });
23922
23987
  }
23923
23988
  }
@@ -24010,31 +24075,31 @@ function formatAge2(ms) {
24010
24075
  // src/commands/refresh.ts
24011
24076
  init_context();
24012
24077
  init_output();
24013
- import * as fs36 from "node:fs";
24078
+ import * as fs37 from "node:fs";
24014
24079
  import * as os21 from "node:os";
24015
24080
  import * as path40 from "node:path";
24016
24081
  import { spawnSync as spawnSync13 } from "node:child_process";
24017
24082
  import ora8 from "ora";
24018
24083
 
24019
24084
  // src/commands/refresh-helpers.ts
24020
- import * as fs35 from "node:fs";
24085
+ import * as fs36 from "node:fs";
24021
24086
  import * as path39 from "node:path";
24022
24087
  function collectCpSourceFiles(standaloneDir) {
24023
- if (!fs35.existsSync(standaloneDir)) {
24088
+ if (!fs36.existsSync(standaloneDir)) {
24024
24089
  throw new Error(`CP standalone dir not found: ${standaloneDir}`);
24025
24090
  }
24026
24091
  const entries = [];
24027
- const topLevel = fs35.readdirSync(standaloneDir).filter((f) => {
24028
- const stat = fs35.statSync(path39.join(standaloneDir, f));
24092
+ const topLevel = fs36.readdirSync(standaloneDir).filter((f) => {
24093
+ const stat = fs36.statSync(path39.join(standaloneDir, f));
24029
24094
  return stat.isFile() && f.endsWith(".mjs") && !f.endsWith(".test.mjs");
24030
24095
  }).sort();
24031
24096
  for (const f of topLevel) {
24032
24097
  entries.push({ srcPath: path39.join(standaloneDir, f), destRelPath: f });
24033
24098
  }
24034
24099
  const libDir = path39.join(standaloneDir, "lib");
24035
- if (fs35.existsSync(libDir) && fs35.statSync(libDir).isDirectory()) {
24036
- const libFiles = fs35.readdirSync(libDir).filter((f) => {
24037
- const stat = fs35.statSync(path39.join(libDir, f));
24100
+ if (fs36.existsSync(libDir) && fs36.statSync(libDir).isDirectory()) {
24101
+ const libFiles = fs36.readdirSync(libDir).filter((f) => {
24102
+ const stat = fs36.statSync(path39.join(libDir, f));
24038
24103
  return stat.isFile() && f.endsWith(".mjs") && !f.endsWith(".test.mjs");
24039
24104
  }).sort();
24040
24105
  for (const f of libFiles) {
@@ -24096,16 +24161,16 @@ async function refreshWorld(worldId, portOffset, standaloneDir, opts) {
24096
24161
  error: err instanceof Error ? err.message : String(err)
24097
24162
  };
24098
24163
  }
24099
- const stagingDir = fs36.mkdtempSync(
24164
+ const stagingDir = fs37.mkdtempSync(
24100
24165
  path40.join(os21.tmpdir(), `olam-refresh-${worldId}-`)
24101
24166
  );
24102
24167
  try {
24103
24168
  const hasLib = entries.some((e) => e.destRelPath.startsWith("lib/"));
24104
24169
  if (hasLib) {
24105
- fs36.mkdirSync(path40.join(stagingDir, "lib"), { recursive: true });
24170
+ fs37.mkdirSync(path40.join(stagingDir, "lib"), { recursive: true });
24106
24171
  }
24107
24172
  for (const { srcPath, destRelPath } of entries) {
24108
- fs36.copyFileSync(srcPath, path40.join(stagingDir, destRelPath));
24173
+ fs37.copyFileSync(srcPath, path40.join(stagingDir, destRelPath));
24109
24174
  }
24110
24175
  const cpResult = docker([
24111
24176
  "cp",
@@ -24120,7 +24185,7 @@ async function refreshWorld(worldId, portOffset, standaloneDir, opts) {
24120
24185
  };
24121
24186
  }
24122
24187
  } finally {
24123
- fs36.rmSync(stagingDir, { recursive: true, force: true });
24188
+ fs37.rmSync(stagingDir, { recursive: true, force: true });
24124
24189
  }
24125
24190
  if (opts.restart) {
24126
24191
  const restartResult = docker([
@@ -24161,7 +24226,7 @@ function registerRefresh(program2) {
24161
24226
  process.cwd(),
24162
24227
  "packages/control-plane/standalone"
24163
24228
  );
24164
- if (!fs36.existsSync(standaloneDir)) {
24229
+ if (!fs37.existsSync(standaloneDir)) {
24165
24230
  printError(
24166
24231
  `CP standalone source not found at ${standaloneDir}.
24167
24232
  Run \`olam refresh\` from the olam repo root.`
@@ -24240,7 +24305,7 @@ Run \`olam refresh\` from the olam repo root.`
24240
24305
  }
24241
24306
 
24242
24307
  // src/commands/diagnose.ts
24243
- import * as fs37 from "node:fs";
24308
+ import * as fs38 from "node:fs";
24244
24309
  import * as os22 from "node:os";
24245
24310
  import * as path41 from "node:path";
24246
24311
  import { execFileSync as execFileSync8, execSync as execSync12 } from "node:child_process";
@@ -24294,9 +24359,9 @@ function defaultZip(zipPath, files) {
24294
24359
  async function buildDiagnosticsZip(_exec = (cmd) => safeExec(cmd), _outDir = DIAGNOSTICS_DIR, _logDir = LOG_DIR, _zip = defaultZip) {
24295
24360
  const ts = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-").slice(0, 23);
24296
24361
  const zipPath = path41.join(_outDir, `olam-diag-${ts}.zip`);
24297
- const tmpDir = fs37.mkdtempSync(path41.join(os22.tmpdir(), "olam-diag-"));
24362
+ const tmpDir = fs38.mkdtempSync(path41.join(os22.tmpdir(), "olam-diag-"));
24298
24363
  try {
24299
- fs37.mkdirSync(_outDir, { recursive: true });
24364
+ fs38.mkdirSync(_outDir, { recursive: true });
24300
24365
  const entries = [];
24301
24366
  const version = process.env["OLAM_CLI_VERSION"] ?? "unknown";
24302
24367
  const nodeVersion = process.version;
@@ -24313,13 +24378,13 @@ platform: ${platform}
24313
24378
  ].join("\n") + "\n";
24314
24379
  _writeEntry(tmpDir, "os-info.txt", stripSecrets(osContent), entries);
24315
24380
  const depsFile = path41.join(CACHE_DIR, "deps.json");
24316
- if (fs37.existsSync(depsFile)) {
24317
- const deps = fs37.readFileSync(depsFile, "utf-8");
24381
+ if (fs38.existsSync(depsFile)) {
24382
+ const deps = fs38.readFileSync(depsFile, "utf-8");
24318
24383
  _writeEntry(tmpDir, "deps.json", stripSecrets(deps), entries);
24319
24384
  }
24320
24385
  const latestLog = _latestLog(_logDir);
24321
24386
  if (latestLog) {
24322
- const lines = fs37.readFileSync(latestLog, "utf-8").split("\n");
24387
+ const lines = fs38.readFileSync(latestLog, "utf-8").split("\n");
24323
24388
  const tail = lines.slice(-LOG_TAIL_LINES).join("\n");
24324
24389
  _writeEntry(tmpDir, "log-tail.txt", stripSecrets(tail), entries);
24325
24390
  }
@@ -24337,32 +24402,32 @@ platform: ${platform}
24337
24402
  } catch (err) {
24338
24403
  throw new Error(`zip command produced no output file. zip stderr: ${err.message}`);
24339
24404
  }
24340
- if (!fs37.existsSync(zipPath)) {
24405
+ if (!fs38.existsSync(zipPath)) {
24341
24406
  throw new Error("zip command produced no output file.");
24342
24407
  }
24343
24408
  return { zipPath, entries };
24344
24409
  } finally {
24345
24410
  try {
24346
- fs37.rmSync(tmpDir, { recursive: true, force: true });
24411
+ fs38.rmSync(tmpDir, { recursive: true, force: true });
24347
24412
  } catch {
24348
24413
  }
24349
24414
  }
24350
24415
  }
24351
24416
  function _writeEntry(dir, name, content, entries) {
24352
- fs37.writeFileSync(path41.join(dir, name), content, { mode: 420 });
24417
+ fs38.writeFileSync(path41.join(dir, name), content, { mode: 420 });
24353
24418
  entries.push(name);
24354
24419
  }
24355
24420
  function _latestLog(logDir) {
24356
- if (!fs37.existsSync(logDir)) return null;
24357
- const files = fs37.readdirSync(logDir).filter((f) => f.startsWith("host-")).sort().reverse();
24421
+ if (!fs38.existsSync(logDir)) return null;
24422
+ const files = fs38.readdirSync(logDir).filter((f) => f.startsWith("host-")).sort().reverse();
24358
24423
  return files.length > 0 ? path41.join(logDir, files[0]) : null;
24359
24424
  }
24360
24425
  async function buildTelemetryPayload() {
24361
24426
  const channel = "stable";
24362
24427
  const manifestFile = path41.join(CACHE_DIR, "manifest.json");
24363
24428
  let manifestAgeHours = null;
24364
- if (fs37.existsSync(manifestFile)) {
24365
- const mtime = fs37.statSync(manifestFile).mtime.getTime();
24429
+ if (fs38.existsSync(manifestFile)) {
24430
+ const mtime = fs38.statSync(manifestFile).mtime.getTime();
24366
24431
  manifestAgeHours = Math.round((Date.now() - mtime) / 36e5);
24367
24432
  }
24368
24433
  return {
@@ -24405,24 +24470,24 @@ function registerDiagnose(program2) {
24405
24470
  }
24406
24471
 
24407
24472
  // src/commands/update.ts
24408
- import * as fs40 from "node:fs";
24473
+ import * as fs41 from "node:fs";
24409
24474
  import * as os24 from "node:os";
24410
24475
  import * as path44 from "node:path";
24411
24476
  import { execSync as execSync13 } from "node:child_process";
24412
24477
  import pc22 from "picocolors";
24413
24478
 
24414
24479
  // src/lib/symlink-reconcile.ts
24415
- import * as fs38 from "node:fs";
24480
+ import * as fs39 from "node:fs";
24416
24481
  import * as path42 from "node:path";
24417
24482
  var realFs = {
24418
- readdirSync: (p) => fs38.readdirSync(p),
24419
- existsSync: (p) => fs38.existsSync(p),
24420
- lstatSync: (p) => fs38.lstatSync(p),
24421
- readlinkSync: (p) => fs38.readlinkSync(p),
24422
- symlinkSync: (t, l) => fs38.symlinkSync(t, l),
24423
- unlinkSync: (p) => fs38.unlinkSync(p),
24483
+ readdirSync: (p) => fs39.readdirSync(p),
24484
+ existsSync: (p) => fs39.existsSync(p),
24485
+ lstatSync: (p) => fs39.lstatSync(p),
24486
+ readlinkSync: (p) => fs39.readlinkSync(p),
24487
+ symlinkSync: (t, l) => fs39.symlinkSync(t, l),
24488
+ unlinkSync: (p) => fs39.unlinkSync(p),
24424
24489
  mkdirSync: (p, o) => {
24425
- fs38.mkdirSync(p, o);
24490
+ fs39.mkdirSync(p, o);
24426
24491
  }
24427
24492
  };
24428
24493
  function reconcileSkillSymlinks(npmSkillsDir, claudeSkillsDir, _fs = realFs) {
@@ -24495,22 +24560,22 @@ function getCurrentVersion(_exec = defaultExec) {
24495
24560
  }
24496
24561
  function readLastStable(file = LAST_STABLE_FILE) {
24497
24562
  try {
24498
- const v = fs40.readFileSync(file, "utf-8").trim();
24563
+ const v = fs41.readFileSync(file, "utf-8").trim();
24499
24564
  return v || null;
24500
24565
  } catch {
24501
24566
  return null;
24502
24567
  }
24503
24568
  }
24504
24569
  function writeLastStable(version, file = LAST_STABLE_FILE) {
24505
- fs40.mkdirSync(path44.dirname(file), { recursive: true });
24506
- fs40.writeFileSync(file, version, { mode: 420 });
24570
+ fs41.mkdirSync(path44.dirname(file), { recursive: true });
24571
+ fs41.writeFileSync(file, version, { mode: 420 });
24507
24572
  }
24508
24573
  function logUpdateFailure(stderr) {
24509
24574
  const ts = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
24510
24575
  const logFile = path44.join(LOG_DIR2, `update-${ts}.log`);
24511
24576
  try {
24512
- fs40.mkdirSync(LOG_DIR2, { recursive: true });
24513
- fs40.appendFileSync(logFile, `[update-failure ${(/* @__PURE__ */ new Date()).toISOString()}]
24577
+ fs41.mkdirSync(LOG_DIR2, { recursive: true });
24578
+ fs41.appendFileSync(logFile, `[update-failure ${(/* @__PURE__ */ new Date()).toISOString()}]
24514
24579
  ${stderr}
24515
24580
  `, "utf-8");
24516
24581
  } catch {
@@ -24726,7 +24791,7 @@ function registerBegin(program2) {
24726
24791
  }
24727
24792
 
24728
24793
  // src/commands/config.ts
24729
- import * as fs42 from "node:fs";
24794
+ import * as fs43 from "node:fs";
24730
24795
  import { createRequire as createRequire4 } from "node:module";
24731
24796
 
24732
24797
  // ../core/dist/global-config/index.js
@@ -24735,7 +24800,7 @@ init_store2();
24735
24800
 
24736
24801
  // ../core/dist/global-config/repos.js
24737
24802
  init_store2();
24738
- import * as fs41 from "node:fs";
24803
+ import * as fs42 from "node:fs";
24739
24804
  import * as os25 from "node:os";
24740
24805
  import * as path45 from "node:path";
24741
24806
  function expandPath(p) {
@@ -24753,7 +24818,7 @@ function addRepo(entry) {
24753
24818
  throw new Error(`repo "${entry.name}" already registered. Use "olam repos update" to change its path.`);
24754
24819
  }
24755
24820
  const resolvedPath = expandPath(entry.path);
24756
- if (!fs41.existsSync(resolvedPath)) {
24821
+ if (!fs42.existsSync(resolvedPath)) {
24757
24822
  throw new Error(`path "${entry.path}" does not exist. Verify the path is correct.`);
24758
24823
  }
24759
24824
  const now = Date.now();
@@ -24782,7 +24847,7 @@ function updateRepo(name, updates) {
24782
24847
  throw new Error(`repo "${name}" is not registered. Run "olam repos list" to see registered repos.`);
24783
24848
  }
24784
24849
  const resolvedUpdatePath = updates.path !== void 0 ? expandPath(updates.path) : void 0;
24785
- if (resolvedUpdatePath !== void 0 && !fs41.existsSync(resolvedUpdatePath)) {
24850
+ if (resolvedUpdatePath !== void 0 && !fs42.existsSync(resolvedUpdatePath)) {
24786
24851
  throw new Error(`path "${updates.path}" does not exist. Verify the path is correct.`);
24787
24852
  }
24788
24853
  const existing = config.repos[idx];
@@ -24802,6 +24867,7 @@ function updateRepo(name, updates) {
24802
24867
  // ../core/dist/global-config/index.js
24803
24868
  init_runbooks();
24804
24869
  init_port_validator();
24870
+ init_bridge();
24805
24871
 
24806
24872
  // src/commands/config.ts
24807
24873
  init_store2();
@@ -24811,14 +24877,14 @@ function registerConfig(program2) {
24811
24877
  const config = program2.command("config").description("Manage global olam configuration");
24812
24878
  config.command("validate [path]").description("Validate ~/.olam/config.json (or a custom path) against the schema").action((filePath) => {
24813
24879
  const resolvedPath = filePath ?? globalConfigPath();
24814
- if (!fs42.existsSync(resolvedPath)) {
24880
+ if (!fs43.existsSync(resolvedPath)) {
24815
24881
  process.stderr.write(`config file not found: ${resolvedPath}
24816
24882
  `);
24817
24883
  process.exit(1);
24818
24884
  }
24819
24885
  let raw;
24820
24886
  try {
24821
- raw = fs42.readFileSync(resolvedPath, "utf-8");
24887
+ raw = fs43.readFileSync(resolvedPath, "utf-8");
24822
24888
  } catch (err) {
24823
24889
  const msg = err instanceof Error ? err.message : String(err);
24824
24890
  process.stderr.write(`cannot read ${resolvedPath}: ${msg}
@@ -25409,12 +25475,12 @@ import * as readline3 from "node:readline";
25409
25475
  import pc28 from "picocolors";
25410
25476
 
25411
25477
  // src/commands/mcp/import-discovery.ts
25412
- import * as fs43 from "node:fs";
25478
+ import * as fs44 from "node:fs";
25413
25479
  import * as os26 from "node:os";
25414
25480
  import * as path46 from "node:path";
25415
25481
  function readJsonFile(filePath) {
25416
25482
  try {
25417
- const raw = fs43.readFileSync(filePath, "utf-8");
25483
+ const raw = fs44.readFileSync(filePath, "utf-8");
25418
25484
  return JSON.parse(raw);
25419
25485
  } catch {
25420
25486
  return null;
@@ -25458,9 +25524,9 @@ function getOlamRepoPaths() {
25458
25524
  ];
25459
25525
  const paths = [];
25460
25526
  for (const configPath of configPaths) {
25461
- if (!fs43.existsSync(configPath)) continue;
25527
+ if (!fs44.existsSync(configPath)) continue;
25462
25528
  try {
25463
- const raw = fs43.readFileSync(configPath, "utf-8");
25529
+ const raw = fs44.readFileSync(configPath, "utf-8");
25464
25530
  const repoMatches = [...raw.matchAll(/path:\s*["']?([^\s"'\n]+)/g)];
25465
25531
  for (const m of repoMatches) {
25466
25532
  if (m[1]) paths.push(m[1]);
@@ -25726,18 +25792,18 @@ function registerMcp(program2) {
25726
25792
  }
25727
25793
 
25728
25794
  // src/pleri-config.ts
25729
- import * as fs44 from "node:fs";
25795
+ import * as fs45 from "node:fs";
25730
25796
  import * as path47 from "node:path";
25731
25797
  function isPleriConfigured(configDir = process.env.OLAM_CONFIG_DIR ?? ".olam") {
25732
25798
  if (process.env.PLERI_BASE_URL) {
25733
25799
  return true;
25734
25800
  }
25735
25801
  const configPath = path47.join(configDir, "config.yaml");
25736
- if (!fs44.existsSync(configPath)) {
25802
+ if (!fs45.existsSync(configPath)) {
25737
25803
  return false;
25738
25804
  }
25739
25805
  try {
25740
- const contents = fs44.readFileSync(configPath, "utf8");
25806
+ const contents = fs45.readFileSync(configPath, "utf8");
25741
25807
  return /^[^#\n]*\bpleri:/m.test(contents);
25742
25808
  } catch {
25743
25809
  return false;