negotium 0.2.19 → 0.2.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/agent-helpers.js +367 -313
  2. package/dist/agent-helpers.js.map +17 -17
  3. package/dist/background-bash.js +3 -2
  4. package/dist/background-bash.js.map +3 -3
  5. package/dist/browser-runtime.js +60 -36
  6. package/dist/browser-runtime.js.map +6 -6
  7. package/dist/{chunk-fc58cqry.js → chunk-g2kqfdwm.js} +154 -24
  8. package/dist/{chunk-fc58cqry.js.map → chunk-g2kqfdwm.js.map} +6 -5
  9. package/dist/hosted-agent.js +183 -53
  10. package/dist/hosted-agent.js.map +7 -6
  11. package/dist/main.js +671 -425
  12. package/dist/main.js.map +23 -23
  13. package/dist/mcp-factories.js +334 -280
  14. package/dist/mcp-factories.js.map +17 -17
  15. package/dist/prompts.js +3 -2
  16. package/dist/prompts.js.map +3 -3
  17. package/dist/query-runtime.js +47 -26
  18. package/dist/query-runtime.js.map +4 -4
  19. package/dist/registry.js +3 -3
  20. package/dist/registry.js.map +2 -2
  21. package/dist/rollout.js +1 -1
  22. package/dist/runtime/src/agents/archiver.ts +3 -2
  23. package/dist/runtime/src/application/switch-topic-access-mode.ts +81 -8
  24. package/dist/runtime/src/bus.ts +19 -2
  25. package/dist/runtime/src/mcp/session-comm/runtime.ts +16 -0
  26. package/dist/runtime/src/platform/config.ts +13 -1
  27. package/dist/runtime/src/runtime/ask-callbacks.ts +19 -11
  28. package/dist/runtime/src/runtime/background-sessions.ts +9 -7
  29. package/dist/runtime/src/runtime/visual-store.ts +31 -23
  30. package/dist/runtime/src/storage/api-topics.ts +26 -0
  31. package/dist/runtime/src/storage/browser-profiles.ts +16 -8
  32. package/dist/runtime/src/storage/runtime-events.ts +30 -20
  33. package/dist/runtime/src/storage/runtime-gateway-submissions.ts +24 -16
  34. package/dist/runtime/src/storage/runtime-turn-requests.ts +9 -1
  35. package/dist/runtime/src/storage/self-schedules.ts +32 -24
  36. package/dist/runtime/src/storage/storage-host.ts +105 -43
  37. package/dist/runtime/src/storage/vault.ts +12 -3
  38. package/dist/runtime/src/version.ts +1 -1
  39. package/dist/runtime-helpers.js +47 -26
  40. package/dist/runtime-helpers.js.map +4 -4
  41. package/dist/storage.js +76 -41
  42. package/dist/storage.js.map +4 -4
  43. package/dist/types/packages/core/src/storage/api-topics.d.ts +15 -0
  44. package/dist/types/packages/core/src/storage/storage-host.d.ts +10 -0
  45. package/dist/types/packages/core/src/version.d.ts +1 -1
  46. package/dist/vault.js +140 -10
  47. package/dist/vault.js.map +6 -5
  48. package/package.json +1 -1
@@ -138,11 +138,12 @@ function versionAtLeast(actualVersion, minimumVersion) {
138
138
  }
139
139
  return true;
140
140
  }
141
+ var BROWSER_RS_VERSION_PROBE_TIMEOUT_MS = 15000;
141
142
  function browserRsMeetsMinimumVersion(candidate) {
142
143
  try {
143
144
  const output = execFileSync(candidate, ["--version"], {
144
145
  encoding: "utf8",
145
- timeout: 2000,
146
+ timeout: BROWSER_RS_VERSION_PROBE_TIMEOUT_MS,
146
147
  stdio: ["ignore", "pipe", "ignore"]
147
148
  }).trim();
148
149
  const match = output.match(/^browser-rs (\d+)\.(\d+)\.(\d+)$/);
@@ -451,7 +452,7 @@ function deepMapStrings(value, fn) {
451
452
 
452
453
  // ../../packages/core/src/agents/execution-host.ts
453
454
  import { AsyncLocalStorage } from "async_hooks";
454
- import { dirname as dirname3 } from "path";
455
+ import { dirname as dirname4 } from "path";
455
456
 
456
457
  // ../../packages/core/src/security/sensitive-path.ts
457
458
  import { realpathSync } from "fs";
@@ -1395,8 +1396,8 @@ function getMcpServersForQuery(opts) {
1395
1396
  }
1396
1397
 
1397
1398
  // ../../packages/core/src/storage/vault.ts
1398
- import { chmodSync as chmodSync2, mkdirSync as mkdirSync3 } from "fs";
1399
- import { join as join2 } from "path";
1399
+ import { chmodSync as chmodSync2, mkdirSync as mkdirSync4 } from "fs";
1400
+ import { join as join3 } from "path";
1400
1401
 
1401
1402
  // ../../packages/core/src/storage/sqlite.ts
1402
1403
  var isBun = typeof process.versions.bun === "string";
@@ -1449,6 +1450,134 @@ if (isBun) {
1449
1450
  Database = NodeDatabase;
1450
1451
  }
1451
1452
 
1453
+ // ../../packages/core/src/storage/storage-host.ts
1454
+ import { mkdirSync as mkdirSync3 } from "fs";
1455
+ import { homedir as homedir2 } from "os";
1456
+ import { dirname as dirname3, join as join2, resolve as resolve4 } from "path";
1457
+ var STORAGE_HOST_STATE = Symbol.for("negotium.storage-host.state.v1");
1458
+ function storageState() {
1459
+ const holder = globalThis;
1460
+ const existing = holder[STORAGE_HOST_STATE];
1461
+ if (existing)
1462
+ return existing;
1463
+ const created = {
1464
+ configuredHost: {},
1465
+ fallbackDatabase: null,
1466
+ fallbackDatabasePath: null,
1467
+ frames: [],
1468
+ schemaInitializers: [],
1469
+ initializedSchemas: new WeakMap,
1470
+ initializingDatabases: new WeakSet
1471
+ };
1472
+ Object.defineProperty(holder, STORAGE_HOST_STATE, {
1473
+ value: created,
1474
+ enumerable: false,
1475
+ writable: false,
1476
+ configurable: false
1477
+ });
1478
+ return created;
1479
+ }
1480
+ function envPath(name, fallback) {
1481
+ const value = process.env[name]?.trim();
1482
+ return resolve4(value || fallback);
1483
+ }
1484
+ function defaultStateDir() {
1485
+ return envPath("NEGOTIUM_STATE_DIR", join2(homedir2(), ".negotium"));
1486
+ }
1487
+ function defaultDataDir() {
1488
+ return envPath("NEGOTIUM_DATA_DIR", join2(defaultStateDir(), "data"));
1489
+ }
1490
+ function defaultSessionsDatabasePath() {
1491
+ return envPath("SESSIONS_DB_PATH", join2(resolveStorageDataDir(), "sessions.db"));
1492
+ }
1493
+ var SQLITE_INIT_RETRY_MS = 25;
1494
+ var SQLITE_INIT_TIMEOUT_MS = 5000;
1495
+ var SQLITE_INIT_SLEEP = new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT));
1496
+ function isSqliteBusy(error) {
1497
+ const message = error instanceof Error ? error.message : String(error);
1498
+ return /database is (?:locked|busy)|SQLITE_(?:BUSY|LOCKED)/i.test(message);
1499
+ }
1500
+ function execWithBusyRetry(database, sql, timeoutMs = SQLITE_INIT_TIMEOUT_MS) {
1501
+ const deadline = Date.now() + timeoutMs;
1502
+ while (true) {
1503
+ try {
1504
+ database.exec(sql);
1505
+ return;
1506
+ } catch (error) {
1507
+ if (!isSqliteBusy(error) || Date.now() >= deadline)
1508
+ throw error;
1509
+ Atomics.wait(SQLITE_INIT_SLEEP, 0, 0, Math.min(SQLITE_INIT_RETRY_MS, deadline - Date.now()));
1510
+ }
1511
+ }
1512
+ }
1513
+ function initializeDatabase(database) {
1514
+ database.exec("PRAGMA busy_timeout = 5000");
1515
+ execWithBusyRetry(database, "PRAGMA journal_mode = WAL");
1516
+ database.exec("PRAGMA foreign_keys = ON");
1517
+ database.exec("PRAGMA wal_autocheckpoint = 1000");
1518
+ try {
1519
+ database.exec("PRAGMA wal_checkpoint(TRUNCATE)");
1520
+ } catch {}
1521
+ }
1522
+ function defaultDatabase() {
1523
+ const path = defaultSessionsDatabasePath();
1524
+ const state = storageState();
1525
+ if (state.fallbackDatabase && state.fallbackDatabasePath === path)
1526
+ return state.fallbackDatabase;
1527
+ if (state.fallbackDatabase)
1528
+ state.fallbackDatabase.close();
1529
+ mkdirSync3(dirname3(path), { recursive: true });
1530
+ state.fallbackDatabase = new Database(path, { create: true });
1531
+ state.fallbackDatabasePath = path;
1532
+ initializeDatabase(state.fallbackDatabase);
1533
+ return state.fallbackDatabase;
1534
+ }
1535
+ function resolveStorageDatabase() {
1536
+ return storageState().configuredHost.database ?? defaultDatabase();
1537
+ }
1538
+ function resolveStorageDataDir() {
1539
+ return storageState().configuredHost.dataDir ?? defaultDataDir();
1540
+ }
1541
+ function ensureStorageSchemas(database = resolveStorageDatabase()) {
1542
+ const state = storageState();
1543
+ if (state.initializingDatabases.has(database))
1544
+ return;
1545
+ let initialized = state.initializedSchemas.get(database);
1546
+ if (!initialized) {
1547
+ initialized = new Set;
1548
+ state.initializedSchemas.set(database, initialized);
1549
+ }
1550
+ state.initializingDatabases.add(database);
1551
+ try {
1552
+ for (const entry of state.schemaInitializers) {
1553
+ if (initialized.has(entry.initialize))
1554
+ continue;
1555
+ initialized.add(entry.initialize);
1556
+ try {
1557
+ entry.initialize(database);
1558
+ } catch (error) {
1559
+ initialized.delete(entry.initialize);
1560
+ throw error;
1561
+ }
1562
+ }
1563
+ } finally {
1564
+ state.initializingDatabases.delete(database);
1565
+ }
1566
+ }
1567
+ var internalStorageDatabase = new Proxy({}, {
1568
+ get(_target, property) {
1569
+ const database = resolveStorageDatabase();
1570
+ ensureStorageSchemas(database);
1571
+ const value = Reflect.get(database, property, database);
1572
+ return typeof value === "function" ? value.bind(database) : value;
1573
+ },
1574
+ set(_target, property, value) {
1575
+ const database = resolveStorageDatabase();
1576
+ ensureStorageSchemas(database);
1577
+ return Reflect.set(database, property, value, database);
1578
+ }
1579
+ });
1580
+
1452
1581
  // ../../packages/core/src/storage/vault-crypto-core.ts
1453
1582
  import { createCipheriv, createDecipheriv, createHash as createHash2, randomBytes as randomBytes3 } from "crypto";
1454
1583
  var ENVELOPE_PREFIX = "otium-vault:v1:";
@@ -1538,17 +1667,18 @@ function initializeVaultDatabase(database) {
1538
1667
  }
1539
1668
  }
1540
1669
  function openVaultDatabase(dataDir) {
1541
- const vaultDir = join2(dataDir, "vault");
1542
- const path = join2(vaultDir, "vault.db");
1543
- mkdirSync3(vaultDir, { recursive: true, mode: 448 });
1670
+ const vaultDir = join3(dataDir, "vault");
1671
+ const path = join3(vaultDir, "vault.db");
1672
+ mkdirSync4(vaultDir, { recursive: true, mode: 448 });
1544
1673
  const database = new Database(path, { create: true });
1545
1674
  chmodSync2(path, 384);
1546
1675
  initializeVaultDatabase(database);
1547
1676
  return database;
1548
1677
  }
1549
1678
  function activeVaultDatabase() {
1550
- if (!vaultDb)
1551
- vaultDb = openVaultDatabase(DATA_DIR);
1679
+ if (!vaultDb) {
1680
+ vaultDb = openVaultDatabase(resolveStorageDataDir());
1681
+ }
1552
1682
  return vaultDb;
1553
1683
  }
1554
1684
  var VAULT_VALUE_MAX_BYTES = 64 * 1024;
@@ -1704,7 +1834,7 @@ function hostedCodexAuthFilePath() {
1704
1834
  return activeHost().codexAuthFilePath();
1705
1835
  }
1706
1836
  function hostedCodexHomePath() {
1707
- return dirname3(hostedCodexAuthFilePath());
1837
+ return dirname4(hostedCodexAuthFilePath());
1708
1838
  }
1709
1839
 
1710
1840
  // ../../packages/core/src/media/file-events.ts
@@ -2214,8 +2344,8 @@ async function* claudeProvider(opts) {
2214
2344
  // ../../packages/core/src/agents/codex-provider.ts
2215
2345
  import { execFileSync as execFileSync4 } from "child_process";
2216
2346
  import { existsSync as existsSync5, readFileSync as readFileSync6, realpathSync as realpathSync3, statSync as statSync3 } from "fs";
2217
- import { homedir as homedir2 } from "os";
2218
- import { dirname as dirname6, isAbsolute, join as join5, relative, resolve as resolve5 } from "path";
2347
+ import { homedir as homedir3 } from "os";
2348
+ import { dirname as dirname7, isAbsolute, join as join6, relative, resolve as resolve6 } from "path";
2219
2349
  import { Codex } from "@openai/codex-sdk";
2220
2350
 
2221
2351
  // ../../packages/core/src/agents/codex-native-multi-agent.ts
@@ -2234,10 +2364,10 @@ import {
2234
2364
  } from "fs";
2235
2365
  import { createRequire as createRequire2 } from "module";
2236
2366
  import { tmpdir } from "os";
2237
- import { dirname as dirname4, join as join3 } from "path";
2367
+ import { dirname as dirname5, join as join4 } from "path";
2238
2368
 
2239
2369
  // ../../packages/core/src/version.ts
2240
- var NEGOTIUM_VERSION = "0.2.19";
2370
+ var NEGOTIUM_VERSION = "0.2.20";
2241
2371
 
2242
2372
  // ../../packages/core/src/agents/codex-native-multi-agent.ts
2243
2373
  var moduleRequire = createRequire2(import.meta.url);
@@ -2256,7 +2386,7 @@ var SAFE_BUNDLED_CODEX_VERSION = BUNDLED_CODEX_VERSION.replace(/[^a-zA-Z0-9._-]/
2256
2386
  var NEGOTIUM_MODEL_CACHE = `negotium-models-cache-${SAFE_BUNDLED_CODEX_VERSION}.json`;
2257
2387
  var NEGOTIUM_MODEL_CATALOG = `negotium-model-catalog-${SAFE_BUNDLED_CODEX_VERSION}.json`;
2258
2388
  function codexCliScriptPath() {
2259
- return join3(dirname4(bundledCodexPackagePath), "bin", "codex.js");
2389
+ return join4(dirname5(bundledCodexPackagePath), "bin", "codex.js");
2260
2390
  }
2261
2391
  function parseCodexModelCache(contents, sourcePath) {
2262
2392
  let parsed;
@@ -2297,14 +2427,14 @@ function writePrivateFileAtomic(path, contents) {
2297
2427
  }
2298
2428
  }
2299
2429
  function bundledCodexModelCachePath(authFilePath) {
2300
- return join3(dirname4(authFilePath), NEGOTIUM_MODEL_CACHE);
2430
+ return join4(dirname5(authFilePath), NEGOTIUM_MODEL_CACHE);
2301
2431
  }
2302
2432
  async function bootstrapCodexModelCache(codexHome, cachePath) {
2303
2433
  const child = spawn3(process.execPath, [codexCliScriptPath(), "app-server", "--stdio"], {
2304
2434
  env: { ...process.env, CODEX_HOME: codexHome },
2305
2435
  stdio: ["pipe", "pipe", "pipe"]
2306
2436
  });
2307
- await new Promise((resolve4, reject) => {
2437
+ await new Promise((resolve5, reject) => {
2308
2438
  let settled = false;
2309
2439
  let stdoutBuffer = "";
2310
2440
  let stderr = "";
@@ -2323,7 +2453,7 @@ async function bootstrapCodexModelCache(codexHome, cachePath) {
2323
2453
  else if (!existsSync3(cachePath))
2324
2454
  reject(new Error("Codex did not create its model cache"));
2325
2455
  else
2326
- resolve4();
2456
+ resolve5();
2327
2457
  };
2328
2458
  const send = (message) => {
2329
2459
  child.stdin.write(`${JSON.stringify(message)}
@@ -2382,16 +2512,16 @@ async function bootstrapCodexModelCache(codexHome, cachePath) {
2382
2512
  });
2383
2513
  }
2384
2514
  async function bootstrapIsolatedCodexModelCache(authFilePath, bootstrap) {
2385
- const sourceHome = dirname4(authFilePath);
2386
- const isolatedHome = mkdtempSync(join3(tmpdir(), "negotium-codex-models-"));
2387
- const isolatedCachePath = join3(isolatedHome, "models_cache.json");
2515
+ const sourceHome = dirname5(authFilePath);
2516
+ const isolatedHome = mkdtempSync(join4(tmpdir(), "negotium-codex-models-"));
2517
+ const isolatedCachePath = join4(isolatedHome, "models_cache.json");
2388
2518
  try {
2389
- const isolatedAuthPath = join3(isolatedHome, "auth.json");
2519
+ const isolatedAuthPath = join4(isolatedHome, "auth.json");
2390
2520
  copyFileSync(authFilePath, isolatedAuthPath);
2391
2521
  chmodSync3(isolatedAuthPath, 384);
2392
- const sourceConfigPath = join3(sourceHome, "config.toml");
2522
+ const sourceConfigPath = join4(sourceHome, "config.toml");
2393
2523
  if (existsSync3(sourceConfigPath)) {
2394
- const isolatedConfigPath = join3(isolatedHome, "config.toml");
2524
+ const isolatedConfigPath = join4(isolatedHome, "config.toml");
2395
2525
  copyFileSync(sourceConfigPath, isolatedConfigPath);
2396
2526
  chmodSync3(isolatedConfigPath, 384);
2397
2527
  }
@@ -2402,7 +2532,7 @@ async function bootstrapIsolatedCodexModelCache(authFilePath, bootstrap) {
2402
2532
  }
2403
2533
  }
2404
2534
  async function ensureCodexModelCache(authFilePath, bootstrap = bootstrapCodexModelCache) {
2405
- const codexHome = dirname4(authFilePath);
2535
+ const codexHome = dirname5(authFilePath);
2406
2536
  const configuredCachePath = process.env.NEGOTIUM_CODEX_MODELS_CACHE_FILE;
2407
2537
  if (configuredCachePath) {
2408
2538
  if (!existsSync3(configuredCachePath)) {
@@ -2412,7 +2542,7 @@ async function ensureCodexModelCache(authFilePath, bootstrap = bootstrapCodexMod
2412
2542
  return configuredCachePath;
2413
2543
  }
2414
2544
  const bundledCachePath = bundledCodexModelCachePath(authFilePath);
2415
- const sharedCachePath = join3(codexHome, "models_cache.json");
2545
+ const sharedCachePath = join4(codexHome, "models_cache.json");
2416
2546
  if (existsSync3(sharedCachePath)) {
2417
2547
  try {
2418
2548
  const shared = readCompatibleCodexModelCache(sharedCachePath);
@@ -2431,8 +2561,8 @@ async function ensureCodexModelCache(authFilePath, bootstrap = bootstrapCodexMod
2431
2561
  return bundledCachePath;
2432
2562
  }
2433
2563
  function writeCodexCatalogWithNativeMultiAgentDisabled(authFilePath, sourcePath) {
2434
- const codexHome = dirname4(authFilePath);
2435
- const outputPath = join3(codexHome, NEGOTIUM_MODEL_CATALOG);
2564
+ const codexHome = dirname5(authFilePath);
2565
+ const outputPath = join4(codexHome, NEGOTIUM_MODEL_CATALOG);
2436
2566
  const parsed = readCodexModelCache(sourcePath).parsed;
2437
2567
  const models = parsed.models.map((model, index) => {
2438
2568
  if (!model || typeof model !== "object" || Array.isArray(model)) {
@@ -2502,12 +2632,12 @@ function createCodexTreeManager(host, options = {}) {
2502
2632
  const previous = spawnChain;
2503
2633
  let release;
2504
2634
  let released = false;
2505
- spawnChain = new Promise((resolve4) => {
2635
+ spawnChain = new Promise((resolve5) => {
2506
2636
  release = () => {
2507
2637
  if (released)
2508
2638
  return;
2509
2639
  released = true;
2510
- resolve4();
2640
+ resolve5();
2511
2641
  };
2512
2642
  });
2513
2643
  await previous;
@@ -2614,7 +2744,7 @@ function createCodexTreeManager(host, options = {}) {
2614
2744
  return;
2615
2745
  const deadline = Date.now() + Math.max(0, graceMs);
2616
2746
  while (Date.now() < deadline && hasSurvivors(plan.targets)) {
2617
- await new Promise((resolve4) => setTimeout(resolve4, Math.min(100, Math.max(1, deadline - Date.now()))));
2747
+ await new Promise((resolve5) => setTimeout(resolve5, Math.min(100, Math.max(1, deadline - Date.now()))));
2618
2748
  }
2619
2749
  killStragglers(plan);
2620
2750
  }
@@ -2667,17 +2797,17 @@ var killOwnedCodexTreesForShutdown = manager.killOwnedTreesForShutdown;
2667
2797
 
2668
2798
  // ../../packages/core/src/agents/rollout/codex.ts
2669
2799
  import { existsSync as existsSync4, readFileSync as readFileSync5, realpathSync as realpathSync2, statSync as statSync2, unlinkSync as unlinkSync4 } from "fs";
2670
- import { basename, dirname as dirname5, join as join4, resolve as resolve4 } from "path";
2800
+ import { basename, dirname as dirname6, join as join5, resolve as resolve5 } from "path";
2671
2801
  function codexSessionsDir() {
2672
- return join4(hostedCodexHomePath(), "sessions");
2802
+ return join5(hostedCodexHomePath(), "sessions");
2673
2803
  }
2674
2804
  function canonicalFilePath(path) {
2675
- const absolute = resolve4(path);
2805
+ const absolute = resolve5(path);
2676
2806
  try {
2677
2807
  return realpathSync2(absolute);
2678
2808
  } catch {
2679
2809
  try {
2680
- return join4(realpathSync2(dirname5(absolute)), basename(absolute));
2810
+ return join5(realpathSync2(dirname6(absolute)), basename(absolute));
2681
2811
  } catch {
2682
2812
  return absolute;
2683
2813
  }
@@ -2907,19 +3037,19 @@ function latestCodexRolloutPath(threadId) {
2907
3037
  try {
2908
3038
  if (buckets) {
2909
3039
  for (const bucket of buckets) {
2910
- const dir = join4(sessionsDir, bucket);
3040
+ const dir = join5(sessionsDir, bucket);
2911
3041
  if (!existsSync4(dir))
2912
3042
  continue;
2913
3043
  const glob = new Bun.Glob(`rollout-*-${threadId}.jsonl`);
2914
3044
  for (const rel of glob.scanSync({ cwd: dir, onlyFiles: true })) {
2915
- candidates.push(join4(dir, rel));
3045
+ candidates.push(join5(dir, rel));
2916
3046
  }
2917
3047
  }
2918
3048
  }
2919
3049
  if (candidates.length === 0) {
2920
3050
  const glob = new Bun.Glob(`**/rollout-*-${threadId}.jsonl`);
2921
3051
  for (const rel of glob.scanSync({ cwd: sessionsDir, onlyFiles: true })) {
2922
- candidates.push(join4(sessionsDir, rel));
3052
+ candidates.push(join5(sessionsDir, rel));
2923
3053
  }
2924
3054
  }
2925
3055
  return candidates.sort((a, b) => statSync2(b).mtimeMs - statSync2(a).mtimeMs)[0];
@@ -3071,7 +3201,7 @@ function codexMcpServerName(name) {
3071
3201
  return CODEX_MCP_SERVER_NAME_OVERRIDES[name] ?? name;
3072
3202
  }
3073
3203
  function globalCodexMcpServerNames(authFilePath) {
3074
- const configPath = join5(dirname6(authFilePath), "config.toml");
3204
+ const configPath = join6(dirname7(authFilePath), "config.toml");
3075
3205
  if (!existsSync5(configPath))
3076
3206
  return [];
3077
3207
  try {
@@ -3170,9 +3300,9 @@ var CODEX_DIFF_BASELINE_FILE_LIMIT = 200;
3170
3300
  var CODEX_DIFF_BASELINE_BYTE_LIMIT = 16 * 1024 * 1024;
3171
3301
  function canonicalPath(path) {
3172
3302
  try {
3173
- return realpathSync3(resolve5(path));
3303
+ return realpathSync3(resolve6(path));
3174
3304
  } catch {
3175
- return resolve5(path);
3305
+ return resolve6(path);
3176
3306
  }
3177
3307
  }
3178
3308
  function textFile(path, maxBytes = CODEX_DIFF_FILE_LIMIT) {
@@ -3216,7 +3346,7 @@ class CodexFilePreviewTracker {
3216
3346
  const code = record.slice(0, 2);
3217
3347
  const path = record.slice(3);
3218
3348
  const remainingBytes = CODEX_DIFF_BASELINE_BYTE_LIMIT - loadedBytes;
3219
- const content = loadedFiles < CODEX_DIFF_BASELINE_FILE_LIMIT && remainingBytes > 0 ? textFile(resolve5(this.#root, path), remainingBytes) : undefined;
3349
+ const content = loadedFiles < CODEX_DIFF_BASELINE_FILE_LIMIT && remainingBytes > 0 ? textFile(resolve6(this.#root, path), remainingBytes) : undefined;
3220
3350
  this.#baseline.set(path, content);
3221
3351
  if (typeof content === "string") {
3222
3352
  loadedFiles += 1;
@@ -3229,7 +3359,7 @@ class CodexFilePreviewTracker {
3229
3359
  preview(path, succeeded) {
3230
3360
  if (!this.#root || !this.#baselineAvailable || !succeeded)
3231
3361
  return {};
3232
- const absolute = canonicalPath(isAbsolute(path) ? path : resolve5(this.#cwd, path));
3362
+ const absolute = canonicalPath(isAbsolute(path) ? path : resolve6(this.#cwd, path));
3233
3363
  const relativePath = relative(this.#root, absolute);
3234
3364
  if (!relativePath || relativePath.startsWith("..") || isAbsolute(relativePath))
3235
3365
  return {};
@@ -3264,7 +3394,7 @@ class CodexFilePreviewTracker {
3264
3394
  }
3265
3395
  }
3266
3396
  async function fileChangeEvents(item, previews, cwd, threadId, consumedPatchCallIds) {
3267
- const expectedPaths = item.changes.map((change) => isAbsolute(change.path) ? change.path : resolve5(cwd, change.path));
3397
+ const expectedPaths = item.changes.map((change) => isAbsolute(change.path) ? change.path : resolve6(cwd, change.path));
3268
3398
  let nativePreview;
3269
3399
  if (threadId && item.status === "completed") {
3270
3400
  await new Promise((resolveDelay) => setTimeout(resolveDelay, 20));
@@ -3433,8 +3563,8 @@ async function* codexProvider(opts) {
3433
3563
  mcpServerCount: Object.keys(codexMcpServers).length
3434
3564
  }, "codexProvider: starting turn");
3435
3565
  const hostedCodexHome = hostedCodexHomePath();
3436
- const inheritedCodexHome = process.env.CODEX_HOME || join5(homedir2(), ".codex");
3437
- const codexEnvironment = scopedBrowserCapability || resolve5(hostedCodexHome) !== resolve5(inheritedCodexHome) ? {
3566
+ const inheritedCodexHome = process.env.CODEX_HOME || join6(homedir3(), ".codex");
3567
+ const codexEnvironment = scopedBrowserCapability || resolve6(hostedCodexHome) !== resolve6(inheritedCodexHome) ? {
3438
3568
  ...Object.fromEntries(Object.entries(process.env).filter((entry) => typeof entry[1] === "string")),
3439
3569
  CODEX_HOME: hostedCodexHome,
3440
3570
  ...scopedBrowserCapability ? { [CODEX_BROWSER_CAPABILITY_ENV]: scopedBrowserCapability } : {}
@@ -3712,7 +3842,7 @@ async function* codexProvider(opts) {
3712
3842
  process.env.MAESTRO_SDK_SILENT_BOOTSTRAP ??= "1";
3713
3843
 
3714
3844
  // ../../packages/core/src/agents/maestro-provider.ts
3715
- import { resolve as resolve6 } from "path";
3845
+ import { resolve as resolve7 } from "path";
3716
3846
  import { maestroProvider as sdkMaestroProvider, setMcpResolver } from "maestro-agent-sdk";
3717
3847
  var MAESTRO_DEFAULT_MAX_TOKENS = 32768;
3718
3848
  var PROVIDER_ASK_USER_TOOL = "AskUserQuestion";
@@ -3811,7 +3941,7 @@ function buildProviderOwnedToolBlockHook() {
3811
3941
  }
3812
3942
  };
3813
3943
  }
3814
- var MAESTRO_TOOL_OUTPUT_DIR = resolve6(RUN_DIR, "maestro-tool-outputs");
3944
+ var MAESTRO_TOOL_OUTPUT_DIR = resolve7(RUN_DIR, "maestro-tool-outputs");
3815
3945
  function buildMaestroToolResultTruncation(opts) {
3816
3946
  if (opts.toolResultTruncation)
3817
3947
  return opts.toolResultTruncation;
@@ -3846,16 +3976,16 @@ function maestroProvider(opts) {
3846
3976
  // ../../packages/core/src/agents/claude-runtime-inspection.ts
3847
3977
  import { readFileSync as readFileSync7 } from "fs";
3848
3978
  import { createRequire as createRequire3 } from "module";
3849
- import { dirname as dirname7, join as join6 } from "path";
3979
+ import { dirname as dirname8, join as join7 } from "path";
3850
3980
  var cached;
3851
3981
  function inspectBundledClaudeRuntime() {
3852
3982
  if (cached)
3853
3983
  return cached;
3854
3984
  try {
3855
3985
  const require2 = createRequire3(import.meta.url);
3856
- const sdkDir = dirname7(require2.resolve("@anthropic-ai/claude-agent-sdk"));
3857
- const sdkPackage = JSON.parse(readFileSync7(join6(sdkDir, "package.json"), "utf8"));
3858
- const manifest = JSON.parse(readFileSync7(join6(sdkDir, "manifest.json"), "utf8"));
3986
+ const sdkDir = dirname8(require2.resolve("@anthropic-ai/claude-agent-sdk"));
3987
+ const sdkPackage = JSON.parse(readFileSync7(join7(sdkDir, "package.json"), "utf8"));
3988
+ const manifest = JSON.parse(readFileSync7(join7(sdkDir, "manifest.json"), "utf8"));
3859
3989
  const sdkVersion = typeof sdkPackage.version === "string" ? sdkPackage.version : "";
3860
3990
  const claudeCodeVersion = typeof manifest.version === "string" ? manifest.version : "";
3861
3991
  if (!sdkVersion || !claudeCodeVersion) {
@@ -3928,4 +4058,4 @@ export {
3928
4058
  buildClaudeDisallowedTools
3929
4059
  };
3930
4060
 
3931
- //# debugId=AAFB3B393DF7264D64756E2164756E21
4061
+ //# debugId=A4049493D1A9D50864756E2164756E21