negotium 0.2.3 → 0.2.5

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 (99) hide show
  1. package/dist/agent-helpers.js +3366 -3048
  2. package/dist/agent-helpers.js.map +49 -48
  3. package/dist/background-bash.js +1 -3
  4. package/dist/background-bash.js.map +4 -4
  5. package/dist/browser-runtime.js +137 -23
  6. package/dist/browser-runtime.js.map +11 -10
  7. package/dist/chunk-qmbcbhyy.js +2407 -0
  8. package/dist/chunk-qmbcbhyy.js.map +35 -0
  9. package/dist/hosted-agent.js +56 -39
  10. package/dist/hosted-agent.js.map +13 -13
  11. package/dist/main.js +3276 -2808
  12. package/dist/main.js.map +54 -51
  13. package/dist/mcp-factories.js +6471 -6148
  14. package/dist/mcp-factories.js.map +49 -48
  15. package/dist/prompts.js +1 -3
  16. package/dist/prompts.js.map +4 -4
  17. package/dist/query-runtime.js +22 -4
  18. package/dist/query-runtime.js.map +6 -6
  19. package/dist/registry.js +169 -213
  20. package/dist/registry.js.map +8 -9
  21. package/dist/rollout.js +1 -1
  22. package/dist/runtime/src/agents/api-topic-agent-switch.ts +6 -12
  23. package/dist/runtime/src/agents/claude-provider.ts +2 -2
  24. package/dist/runtime/src/agents/codex-app-server.ts +136 -0
  25. package/dist/runtime/src/agents/codex-native-multi-agent.ts +1 -1
  26. package/dist/runtime/src/agents/codex-provider.ts +22 -11
  27. package/dist/runtime/src/agents/codex-registry.ts +9 -17
  28. package/dist/runtime/src/agents/contracts.ts +2 -0
  29. package/dist/runtime/src/agents/execution-host.ts +6 -0
  30. package/dist/runtime/src/agents/fork.ts +24 -18
  31. package/dist/runtime/src/agents/idle-archiver.ts +7 -2
  32. package/dist/runtime/src/agents/index.ts +21 -15
  33. package/dist/runtime/src/agents/maestro-provider.ts +1 -1
  34. package/dist/runtime/src/agents/maestro-registry.ts +26 -7
  35. package/dist/runtime/src/agents/memory-archive-policy.ts +20 -0
  36. package/dist/runtime/src/agents/rollout/codex.ts +31 -23
  37. package/dist/runtime/src/agents/self-config-core.ts +2 -4
  38. package/dist/runtime/src/agents/topic-agent-switch.ts +4 -10
  39. package/dist/runtime/src/application/submit-runtime-gateway-turn.ts +77 -19
  40. package/dist/runtime/src/application/switch-topic-model.ts +7 -10
  41. package/dist/runtime/src/index.ts +4 -0
  42. package/dist/runtime/src/mcp/factories/session-comm.ts +12 -0
  43. package/dist/runtime/src/mcp/session-comm/default-host.ts +16 -0
  44. package/dist/runtime/src/mcp/session-comm/server.ts +25 -0
  45. package/dist/runtime/src/mcp/wiki-server.ts +19 -12
  46. package/dist/runtime/src/platform/config.ts +4 -3
  47. package/dist/runtime/src/platform/log-rotation.ts +45 -0
  48. package/dist/runtime/src/platform/mcp-config.ts +9 -3
  49. package/dist/runtime/src/platform/playwright/manager.ts +57 -1
  50. package/dist/runtime/src/platform/playwright/profile-management.ts +33 -0
  51. package/dist/runtime/src/platform/playwright/public-runtime.ts +5 -0
  52. package/dist/runtime/src/platform/playwright/vault-broker.ts +9 -10
  53. package/dist/runtime/src/query/active-rooms.ts +7 -1
  54. package/dist/runtime/src/runtime/errors.ts +1 -0
  55. package/dist/runtime/src/runtime/turn-event-stream.ts +46 -1
  56. package/dist/runtime/src/runtime/turn-runner.ts +176 -100
  57. package/dist/runtime/src/runtime/user-turn-envelope.ts +19 -0
  58. package/dist/runtime/src/storage/browser-profiles.ts +35 -10
  59. package/dist/runtime/src/storage/runtime-gateway-submissions.ts +12 -3
  60. package/dist/runtime/src/storage/runtime-turn-requests.ts +68 -7
  61. package/dist/runtime/src/storage/storage-host.ts +31 -5
  62. package/dist/runtime/src/storage/vault.ts +30 -2
  63. package/dist/runtime/src/topics/derive.ts +38 -2
  64. package/dist/runtime/src/topics/lifecycle.ts +12 -2
  65. package/dist/runtime/src/types.ts +2 -0
  66. package/dist/runtime/src/version.ts +1 -1
  67. package/dist/runtime-helpers.js +22 -4
  68. package/dist/runtime-helpers.js.map +5 -5
  69. package/dist/storage.js +22 -2
  70. package/dist/storage.js.map +5 -5
  71. package/dist/types/packages/core/src/agents/api-topic-agent-switch.d.ts +1 -1
  72. package/dist/types/packages/core/src/agents/codex-app-server.d.ts +13 -0
  73. package/dist/types/packages/core/src/agents/codex-native-multi-agent.d.ts +1 -0
  74. package/dist/types/packages/core/src/agents/contracts.d.ts +2 -0
  75. package/dist/types/packages/core/src/agents/execution-host.d.ts +2 -0
  76. package/dist/types/packages/core/src/agents/fork.d.ts +8 -7
  77. package/dist/types/packages/core/src/agents/memory-archive-policy.d.ts +10 -0
  78. package/dist/types/packages/core/src/agents/rollout/codex.d.ts +4 -2
  79. package/dist/types/packages/core/src/agents/self-config-core.d.ts +1 -1
  80. package/dist/types/packages/core/src/mcp/factories/session-comm.d.ts +1 -0
  81. package/dist/types/packages/core/src/platform/config.d.ts +0 -1
  82. package/dist/types/packages/core/src/platform/mcp-config.d.ts +3 -0
  83. package/dist/types/packages/core/src/platform/playwright/manager.d.ts +15 -0
  84. package/dist/types/packages/core/src/platform/playwright/profile-management.d.ts +8 -0
  85. package/dist/types/packages/core/src/platform/playwright/public-runtime.d.ts +2 -1
  86. package/dist/types/packages/core/src/query/active-rooms.d.ts +7 -1
  87. package/dist/types/packages/core/src/runtime/turn-runner.d.ts +42 -1
  88. package/dist/types/packages/core/src/runtime/user-turn-envelope.d.ts +7 -0
  89. package/dist/types/packages/core/src/storage/browser-profiles.d.ts +3 -1
  90. package/dist/types/packages/core/src/storage/runtime-turn-requests.d.ts +17 -0
  91. package/dist/types/packages/core/src/storage/storage-host.d.ts +1 -0
  92. package/dist/types/packages/core/src/storage/vault.d.ts +8 -0
  93. package/dist/types/packages/core/src/types.d.ts +2 -0
  94. package/dist/types/packages/core/src/version.d.ts +1 -1
  95. package/dist/vault.js +19 -5
  96. package/dist/vault.js.map +5 -5
  97. package/package.json +2 -2
  98. package/dist/chunk-hsqgb2hw.js +0 -1223
  99. package/dist/chunk-hsqgb2hw.js.map +0 -19
@@ -119,7 +119,6 @@ var BROWSER_DIR = resolveLocalStateDir("NEGOTIUM_BROWSER_DIR", "browser");
119
119
  var BROWSER_PROFILES_DIR = resolve(BROWSER_DIR, "profiles");
120
120
  var BINARIES_DIR = resolve(STATE_DIR, "binaries");
121
121
  var SECRETS_DIR = resolve(STATE_DIR, "secrets");
122
- var CONTEXTS_DIR = resolve(STATE_DIR, "data", "contexts");
123
122
  var DM_WORKSPACE_DIR = resolve(STATE_DIR, "data", "dm");
124
123
  var SESSION_WORKSPACE_DIR = resolve(STATE_DIR, "data", "sessions");
125
124
  var CLAUDE_EXECUTABLE_ENV = envText("NEGOTIUM_CLAUDE_EXECUTABLE");
@@ -268,7 +267,6 @@ mkdirSync(WORKSPACE_DIR, { recursive: true });
268
267
  mkdirSync(TOPIC_WORKSPACE_DIR, { recursive: true });
269
268
  mkdirSync(SHARED_WIKI_DIR, { recursive: true });
270
269
  mkdirSync(CRON_WORKSPACE_DIR, { recursive: true });
271
- mkdirSync(CONTEXTS_DIR, { recursive: true });
272
270
  mkdirSync(DM_WORKSPACE_DIR, { recursive: true });
273
271
  mkdirSync(SESSION_WORKSPACE_DIR, { recursive: true });
274
272
  mkdirSync(BROWSER_DIR, { recursive: true });
@@ -301,7 +299,7 @@ var PDFTOTEXT_BIN = envText("PDFTOTEXT_BIN") ?? "pdftotext";
301
299
  var _envMaxTellDepth = Number.parseInt(process.env.MAX_TELL_DEPTH ?? "", 10);
302
300
  var MAX_TELL_DEPTH = Number.isInteger(_envMaxTellDepth) && _envMaxTellDepth > 0 ? _envMaxTellDepth : 20;
303
301
  function codexAuthFilePath() {
304
- return process.env.NEGOTIUM_CODEX_AUTH_FILE || join(homedir(), ".codex", "auth.json");
302
+ return process.env.NEGOTIUM_CODEX_AUTH_FILE || join(process.env.CODEX_HOME || join(homedir(), ".codex"), "auth.json");
305
303
  }
306
304
 
307
305
  // ../../packages/core/src/agents/rollout/shared.ts
@@ -440,6 +438,7 @@ function deepMapStrings(value, fn) {
440
438
 
441
439
  // ../../packages/core/src/agents/execution-host.ts
442
440
  import { AsyncLocalStorage } from "async_hooks";
441
+ import { dirname as dirname3 } from "path";
443
442
 
444
443
  // ../../packages/core/src/security/sensitive-path.ts
445
444
  import { realpathSync } from "fs";
@@ -1083,11 +1082,11 @@ var MCP_CATALOG = {
1083
1082
  vault: {
1084
1083
  ...commonRuntimeMcpPolicy("vault"),
1085
1084
  build(ctx) {
1086
- const { userId, agent } = ctx;
1087
- const args = [`--user-id=${userId}`];
1085
+ const { userId, vaultUserId, agent } = ctx;
1086
+ const args = [`--user-id=${vaultUserId ?? userId}`];
1088
1087
  if (agent !== "codex")
1089
1088
  args.push("--list-only=true");
1090
- return buildBuiltinMcpServer("vault", ctx, () => buildStdioMcpServer(agent, VAULT_SERVER, args));
1089
+ return buildBuiltinMcpServer("vault", { ...ctx, userId: vaultUserId ?? userId }, () => buildStdioMcpServer(agent, VAULT_SERVER, args));
1091
1090
  }
1092
1091
  }
1093
1092
  };
@@ -1167,6 +1166,7 @@ function getManagerMcpServers(opts) {
1167
1166
  function getForumMcpServers(opts) {
1168
1167
  const {
1169
1168
  userId,
1169
+ vaultUserId,
1170
1170
  session,
1171
1171
  topicId,
1172
1172
  subagentParentTopicId,
@@ -1197,6 +1197,7 @@ function getForumMcpServers(opts) {
1197
1197
  };
1198
1198
  const base = buildScope("forum", {
1199
1199
  userId,
1200
+ vaultUserId,
1200
1201
  session,
1201
1202
  topicId,
1202
1203
  subagentParentTopicId,
@@ -1290,6 +1291,7 @@ function getMcpServersForQuery(opts) {
1290
1291
  }
1291
1292
  return getForumMcpServers({
1292
1293
  userId: opts.userId || "local",
1294
+ vaultUserId: opts.vaultUserId,
1293
1295
  session: opts.session || "default",
1294
1296
  topicId: opts.topicId,
1295
1297
  subagentParentTopicId: opts.subagentParentTopicId,
@@ -1482,13 +1484,19 @@ function decryptRow(userId, key, storedValue) {
1482
1484
  }
1483
1485
  return decoded.value;
1484
1486
  }
1485
- function vaultListWithValues(userId) {
1487
+ function vaultListDecryptableValues(userId) {
1486
1488
  const rows = activeVaultDatabase().prepare("SELECT key, description, value FROM vault WHERE user_id = ? ORDER BY key").all(userId);
1487
- return rows.map((row) => ({
1488
- key: row.key,
1489
- description: row.description,
1490
- value: decryptRow(userId, row.key, row.value)
1491
- }));
1489
+ const entries = [];
1490
+ for (const row of rows) {
1491
+ try {
1492
+ entries.push({
1493
+ key: row.key,
1494
+ description: row.description,
1495
+ value: decryptRow(userId, row.key, row.value)
1496
+ });
1497
+ } catch {}
1498
+ }
1499
+ return entries;
1492
1500
  }
1493
1501
  function vaultGetValue(userId, key) {
1494
1502
  const normalizedKey = normalizeVaultKey(key);
@@ -1496,10 +1504,12 @@ function vaultGetValue(userId, key) {
1496
1504
  return row ? decryptRow(userId, row.key, row.value) : undefined;
1497
1505
  }
1498
1506
  function vaultSubstituteDetailed(userId, text) {
1499
- const entries = new Map(vaultListWithValues(userId).map((entry) => [entry.key, entry.value]));
1507
+ const entries = new Map;
1500
1508
  const usedKeys = new Set;
1501
1509
  const substituted = text.replace(/\{\{([^}]+)\}\}/g, (match, rawKey) => {
1502
1510
  const key = normalizeVaultKey(rawKey);
1511
+ if (!entries.has(key))
1512
+ entries.set(key, vaultGetValue(userId, key));
1503
1513
  const value = entries.get(key);
1504
1514
  if (value === undefined)
1505
1515
  return match;
@@ -1520,7 +1530,7 @@ function encodedSecretForms(value) {
1520
1530
  return [...forms].sort((a, b) => b.length - a.length);
1521
1531
  }
1522
1532
  function redactVaultSecrets(userId, text) {
1523
- const candidates = vaultListWithValues(userId).flatMap((entry) => encodedSecretForms(entry.value).map((form) => ({ form, key: entry.key }))).sort((a, b) => b.form.length - a.form.length || a.key.localeCompare(b.key));
1533
+ const candidates = vaultListDecryptableValues(userId).flatMap((entry) => encodedSecretForms(entry.value).map((form) => ({ form, key: entry.key }))).sort((a, b) => b.form.length - a.form.length || a.key.localeCompare(b.key));
1524
1534
  if (candidates.length === 0)
1525
1535
  return text;
1526
1536
  const candidatesByFirstCharacter = new Map;
@@ -1614,6 +1624,9 @@ function hostedClaudeCodeExecutablePath() {
1614
1624
  function hostedCodexAuthFilePath() {
1615
1625
  return activeHost().codexAuthFilePath();
1616
1626
  }
1627
+ function hostedCodexHomePath() {
1628
+ return dirname3(hostedCodexAuthFilePath());
1629
+ }
1617
1630
 
1618
1631
  // ../../packages/core/src/media/file-events.ts
1619
1632
  function* extractFileEvents(text, source) {
@@ -1905,7 +1918,7 @@ async function* claudeProvider(opts) {
1905
1918
  }
1906
1919
  };
1907
1920
  }
1908
- const userId = opts.userId ?? "";
1921
+ const userId = opts.vaultUserId ?? opts.userId ?? "";
1909
1922
  const withVault = substituteClaudeToolInput(userId, tool_name, tool_input);
1910
1923
  if (JSON.stringify(withVault) === JSON.stringify(tool_input)) {
1911
1924
  return { continue: true };
@@ -1925,7 +1938,7 @@ async function* claudeProvider(opts) {
1925
1938
  hooks: [
1926
1939
  async (input) => {
1927
1940
  const { tool_response } = input;
1928
- const userId = opts.userId ?? "";
1941
+ const userId = opts.vaultUserId ?? opts.userId ?? "";
1929
1942
  const redacted = deepMapStrings(tool_response, (value) => redactHostedSecrets(userId, value));
1930
1943
  if (JSON.stringify(redacted) === JSON.stringify(tool_response)) {
1931
1944
  return { continue: true };
@@ -2118,7 +2131,8 @@ async function* claudeProvider(opts) {
2118
2131
  // ../../packages/core/src/agents/codex-provider.ts
2119
2132
  import { execFileSync as execFileSync4 } from "child_process";
2120
2133
  import { existsSync as existsSync5, readFileSync as readFileSync6, realpathSync as realpathSync3, statSync as statSync3 } from "fs";
2121
- import { dirname as dirname5, isAbsolute, join as join5, relative, resolve as resolve5 } from "path";
2134
+ import { homedir as homedir2 } from "os";
2135
+ import { dirname as dirname6, isAbsolute, join as join5, relative, resolve as resolve5 } from "path";
2122
2136
  import { Codex } from "@openai/codex-sdk";
2123
2137
 
2124
2138
  // ../../packages/core/src/agents/codex-native-multi-agent.ts
@@ -2137,10 +2151,10 @@ import {
2137
2151
  } from "fs";
2138
2152
  import { createRequire as createRequire2 } from "module";
2139
2153
  import { tmpdir } from "os";
2140
- import { dirname as dirname3, join as join3 } from "path";
2154
+ import { dirname as dirname4, join as join3 } from "path";
2141
2155
 
2142
2156
  // ../../packages/core/src/version.ts
2143
- var NEGOTIUM_VERSION = "0.2.3";
2157
+ var NEGOTIUM_VERSION = "0.2.5";
2144
2158
 
2145
2159
  // ../../packages/core/src/agents/codex-native-multi-agent.ts
2146
2160
  var moduleRequire = createRequire2(import.meta.url);
@@ -2159,7 +2173,7 @@ var SAFE_BUNDLED_CODEX_VERSION = BUNDLED_CODEX_VERSION.replace(/[^a-zA-Z0-9._-]/
2159
2173
  var NEGOTIUM_MODEL_CACHE = `negotium-models-cache-${SAFE_BUNDLED_CODEX_VERSION}.json`;
2160
2174
  var NEGOTIUM_MODEL_CATALOG = `negotium-model-catalog-${SAFE_BUNDLED_CODEX_VERSION}.json`;
2161
2175
  function codexCliScriptPath() {
2162
- return join3(dirname3(bundledCodexPackagePath), "bin", "codex.js");
2176
+ return join3(dirname4(bundledCodexPackagePath), "bin", "codex.js");
2163
2177
  }
2164
2178
  function parseCodexModelCache(contents, sourcePath) {
2165
2179
  let parsed;
@@ -2200,7 +2214,7 @@ function writePrivateFileAtomic(path, contents) {
2200
2214
  }
2201
2215
  }
2202
2216
  function bundledCodexModelCachePath(authFilePath) {
2203
- return join3(dirname3(authFilePath), NEGOTIUM_MODEL_CACHE);
2217
+ return join3(dirname4(authFilePath), NEGOTIUM_MODEL_CACHE);
2204
2218
  }
2205
2219
  async function bootstrapCodexModelCache(codexHome, cachePath) {
2206
2220
  const child = spawn3(process.execPath, [codexCliScriptPath(), "app-server", "--stdio"], {
@@ -2285,7 +2299,7 @@ async function bootstrapCodexModelCache(codexHome, cachePath) {
2285
2299
  });
2286
2300
  }
2287
2301
  async function bootstrapIsolatedCodexModelCache(authFilePath, bootstrap) {
2288
- const sourceHome = dirname3(authFilePath);
2302
+ const sourceHome = dirname4(authFilePath);
2289
2303
  const isolatedHome = mkdtempSync(join3(tmpdir(), "negotium-codex-models-"));
2290
2304
  const isolatedCachePath = join3(isolatedHome, "models_cache.json");
2291
2305
  try {
@@ -2305,7 +2319,7 @@ async function bootstrapIsolatedCodexModelCache(authFilePath, bootstrap) {
2305
2319
  }
2306
2320
  }
2307
2321
  async function ensureCodexModelCache(authFilePath, bootstrap = bootstrapCodexModelCache) {
2308
- const codexHome = dirname3(authFilePath);
2322
+ const codexHome = dirname4(authFilePath);
2309
2323
  const configuredCachePath = process.env.NEGOTIUM_CODEX_MODELS_CACHE_FILE;
2310
2324
  if (configuredCachePath) {
2311
2325
  if (!existsSync3(configuredCachePath)) {
@@ -2334,7 +2348,7 @@ async function ensureCodexModelCache(authFilePath, bootstrap = bootstrapCodexMod
2334
2348
  return bundledCachePath;
2335
2349
  }
2336
2350
  function writeCodexCatalogWithNativeMultiAgentDisabled(authFilePath, sourcePath) {
2337
- const codexHome = dirname3(authFilePath);
2351
+ const codexHome = dirname4(authFilePath);
2338
2352
  const outputPath = join3(codexHome, NEGOTIUM_MODEL_CATALOG);
2339
2353
  const parsed = readCodexModelCache(sourcePath).parsed;
2340
2354
  const models = parsed.models.map((model, index) => {
@@ -2570,10 +2584,9 @@ var killOwnedCodexTreesForShutdown = manager.killOwnedTreesForShutdown;
2570
2584
 
2571
2585
  // ../../packages/core/src/agents/rollout/codex.ts
2572
2586
  import { existsSync as existsSync4, readFileSync as readFileSync5, realpathSync as realpathSync2, statSync as statSync2, unlinkSync as unlinkSync4 } from "fs";
2573
- import { homedir as homedir2 } from "os";
2574
- import { basename, dirname as dirname4, join as join4, resolve as resolve4 } from "path";
2587
+ import { basename, dirname as dirname5, join as join4, resolve as resolve4 } from "path";
2575
2588
  function codexSessionsDir() {
2576
- return join4(process.env.CODEX_HOME || join4(homedir2(), ".codex"), "sessions");
2589
+ return join4(hostedCodexHomePath(), "sessions");
2577
2590
  }
2578
2591
  function canonicalFilePath(path) {
2579
2592
  const absolute = resolve4(path);
@@ -2581,7 +2594,7 @@ function canonicalFilePath(path) {
2581
2594
  return realpathSync2(absolute);
2582
2595
  } catch {
2583
2596
  try {
2584
- return join4(realpathSync2(dirname4(absolute)), basename(absolute));
2597
+ return join4(realpathSync2(dirname5(absolute)), basename(absolute));
2585
2598
  } catch {
2586
2599
  return absolute;
2587
2600
  }
@@ -2920,7 +2933,7 @@ function codexMcpServerName(name) {
2920
2933
  return CODEX_MCP_SERVER_NAME_OVERRIDES[name] ?? name;
2921
2934
  }
2922
2935
  function globalCodexMcpServerNames(authFilePath) {
2923
- const configPath = join5(dirname5(authFilePath), "config.toml");
2936
+ const configPath = join5(dirname6(authFilePath), "config.toml");
2924
2937
  if (!existsSync5(configPath))
2925
2938
  return [];
2926
2939
  try {
@@ -3281,13 +3294,15 @@ async function* codexProvider(opts) {
3281
3294
  resume: Boolean(opts.sessionId),
3282
3295
  mcpServerCount: Object.keys(codexMcpServers).length
3283
3296
  }, "codexProvider: starting turn");
3297
+ const hostedCodexHome = hostedCodexHomePath();
3298
+ const inheritedCodexHome = process.env.CODEX_HOME || join5(homedir2(), ".codex");
3299
+ const codexEnvironment = scopedBrowserCapability || resolve5(hostedCodexHome) !== resolve5(inheritedCodexHome) ? {
3300
+ ...Object.fromEntries(Object.entries(process.env).filter((entry) => typeof entry[1] === "string")),
3301
+ CODEX_HOME: hostedCodexHome,
3302
+ ...scopedBrowserCapability ? { [CODEX_BROWSER_CAPABILITY_ENV]: scopedBrowserCapability } : {}
3303
+ } : undefined;
3284
3304
  const codex = new Codex({
3285
- ...scopedBrowserCapability ? {
3286
- env: {
3287
- ...Object.fromEntries(Object.entries(process.env).filter((entry) => typeof entry[1] === "string")),
3288
- [CODEX_BROWSER_CAPABILITY_ENV]: scopedBrowserCapability
3289
- }
3290
- } : {},
3305
+ ...codexEnvironment ? { env: codexEnvironment } : {},
3291
3306
  config: {
3292
3307
  features: { multi_agent: false, multi_agent_v2: false, enable_fanout: false },
3293
3308
  model_catalog_json: codexModelCatalogPath,
@@ -3361,6 +3376,8 @@ async function* codexProvider(opts) {
3361
3376
  throw err;
3362
3377
  if (!currentSessionId || !isMissingCodexRolloutError(err))
3363
3378
  throw err;
3379
+ if (opts.userId && opts.session)
3380
+ throw err;
3364
3381
  logger.warn({ staleSessionId: currentSessionId, err: errMsg(err) }, "codexProvider: stale/missing rollout, restarting fresh thread");
3365
3382
  thread = codex.startThread(threadOptions);
3366
3383
  prompt = promptForThread(opts, true);
@@ -3667,7 +3684,7 @@ function maestroProvider(opts) {
3667
3684
  if (opts.agent !== undefined && opts.agent !== "maestro") {
3668
3685
  throw new Error(`maestroProvider: unexpected agent "${opts.agent}", expected "maestro"`);
3669
3686
  }
3670
- const userId = opts.userId ?? "";
3687
+ const userId = opts.vaultUserId ?? opts.userId ?? "";
3671
3688
  setMcpResolver(hostedMcpServers);
3672
3689
  const callerDisallowedTools = opts.disallowedTools ?? [];
3673
3690
  const callerToolHooks = opts.toolHooks ?? [];
@@ -3686,14 +3703,14 @@ function maestroProvider(opts) {
3686
3703
  // ../../packages/core/src/agents/claude-runtime-inspection.ts
3687
3704
  import { readFileSync as readFileSync7 } from "fs";
3688
3705
  import { createRequire as createRequire3 } from "module";
3689
- import { dirname as dirname6, join as join6 } from "path";
3706
+ import { dirname as dirname7, join as join6 } from "path";
3690
3707
  var cached;
3691
3708
  function inspectBundledClaudeRuntime() {
3692
3709
  if (cached)
3693
3710
  return cached;
3694
3711
  try {
3695
3712
  const require2 = createRequire3(import.meta.url);
3696
- const sdkDir = dirname6(require2.resolve("@anthropic-ai/claude-agent-sdk"));
3713
+ const sdkDir = dirname7(require2.resolve("@anthropic-ai/claude-agent-sdk"));
3697
3714
  const sdkPackage = JSON.parse(readFileSync7(join6(sdkDir, "package.json"), "utf8"));
3698
3715
  const manifest = JSON.parse(readFileSync7(join6(sdkDir, "manifest.json"), "utf8"));
3699
3716
  const sdkVersion = typeof sdkPackage.version === "string" ? sdkPackage.version : "";
@@ -3768,4 +3785,4 @@ export {
3768
3785
  buildClaudeDisallowedTools
3769
3786
  };
3770
3787
 
3771
- //# debugId=1CBD65157B0A833464756E2164756E21
3788
+ //# debugId=C7B2CAE8A499CD9764756E2164756E21