negotium 0.4.2 → 0.4.4

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.
@@ -124,7 +124,7 @@ var DM_WORKSPACE_DIR = resolve(STATE_DIR, "data", "dm");
124
124
  var SESSION_WORKSPACE_DIR = resolve(STATE_DIR, "data", "sessions");
125
125
  var CLAUDE_EXECUTABLE_ENV = envText("NEGOTIUM_CLAUDE_EXECUTABLE");
126
126
  var CLAUDE_EXECUTABLE = CLAUDE_EXECUTABLE_ENV ? resolve(CLAUDE_EXECUTABLE_ENV) : undefined;
127
- var BROWSER_RS_VERSION = "v0.1.21";
127
+ var BROWSER_RS_VERSION = "v0.1.22";
128
128
  var BROWSER_RS_MIN_SECURE_VERSION = "0.1.15";
129
129
  function versionAtLeast(actualVersion, minimumVersion) {
130
130
  const actual = actualVersion.split(".").map(Number);
@@ -518,11 +518,6 @@ function referencesRuntimeSecretStorage(value) {
518
518
  return false;
519
519
  }
520
520
 
521
- // ../../packages/core/src/platform/mcp-config.ts
522
- import { accessSync as accessSync2, constants as fsConstants } from "fs";
523
- import { homedir as homedir2 } from "os";
524
- import { join as join2 } from "path";
525
-
526
521
  // ../../packages/core/src/mcp/runtime-spec.ts
527
522
  import { createHash, createHmac, timingSafeEqual } from "crypto";
528
523
  var RUNTIME_MCP_KEY = "runtime";
@@ -973,6 +968,10 @@ function playwrightTransport(port, owner, capability, agent) {
973
968
  function longLivedHttpMcp(agent, port) {
974
969
  return agent === "codex" ? { url: `http://127.0.0.1:${port}/mcp` } : { type: "sse", url: `http://127.0.0.1:${port}/sse` };
975
970
  }
971
+ var cuaRsMcpPort;
972
+ function cuaRsHttpMcp(port) {
973
+ return { type: "http", url: `http://127.0.0.1:${port}/mcp` };
974
+ }
976
975
  function backgroundBashTransport(agent, port, userId, topic) {
977
976
  const capability = bgBashContextCapability(userId, topic);
978
977
  const headers = {
@@ -1194,34 +1193,10 @@ var MCP_CATALOG = {
1194
1193
  "cua-rs": {
1195
1194
  ...commonRuntimeMcpPolicy("cua-rs"),
1196
1195
  build() {
1197
- const bin = resolveCuaRsBinary();
1198
- if (!bin)
1199
- return null;
1200
- return { command: bin, args: cuaRsArgs() };
1196
+ return cuaRsMcpPort ? cuaRsHttpMcp(cuaRsMcpPort) : null;
1201
1197
  }
1202
1198
  }
1203
1199
  };
1204
- function cuaRsArgs() {
1205
- const raw = envText("NEGOTIUM_CUA_RS_ALLOW_HID")?.trim().toLowerCase();
1206
- const on = raw === "1" || raw === "true" || raw === "yes";
1207
- return on ? ["--allow-hid"] : [];
1208
- }
1209
- function resolveCuaRsBinary(platform = process.platform) {
1210
- if (platform !== "darwin")
1211
- return null;
1212
- const candidates = [
1213
- envText("NEGOTIUM_CUA_RS_BIN"),
1214
- join2(homedir2(), ".local", "bin", "cua-rs"),
1215
- "/usr/local/bin/cua-rs"
1216
- ].filter((p) => Boolean(p));
1217
- for (const candidate of candidates) {
1218
- try {
1219
- accessSync2(candidate, fsConstants.X_OK);
1220
- return candidate;
1221
- } catch {}
1222
- }
1223
- return null;
1224
- }
1225
1200
  var allForumMcpServerNames = [];
1226
1201
  var requiredForumMcpServers = [];
1227
1202
  var REQUIRED_FORUM_MCP_SERVERS = requiredForumMcpServers;
@@ -1449,7 +1424,7 @@ function getMcpServersForQuery(opts) {
1449
1424
 
1450
1425
  // ../../packages/core/src/storage/vault.ts
1451
1426
  import { chmodSync as chmodSync2, mkdirSync as mkdirSync4 } from "fs";
1452
- import { join as join4 } from "path";
1427
+ import { join as join3 } from "path";
1453
1428
 
1454
1429
  // ../../packages/core/src/storage/sqlite.ts
1455
1430
  var isBun = typeof process.versions.bun === "string";
@@ -1504,8 +1479,8 @@ if (isBun) {
1504
1479
 
1505
1480
  // ../../packages/core/src/storage/storage-host.ts
1506
1481
  import { mkdirSync as mkdirSync3 } from "fs";
1507
- import { homedir as homedir3 } from "os";
1508
- import { dirname as dirname3, join as join3, resolve as resolve4 } from "path";
1482
+ import { homedir as homedir2 } from "os";
1483
+ import { dirname as dirname3, join as join2, resolve as resolve4 } from "path";
1509
1484
  var STORAGE_HOST_STATE = Symbol.for("negotium.storage-host.state.v1");
1510
1485
  function storageState() {
1511
1486
  const holder = globalThis;
@@ -1534,13 +1509,13 @@ function envPath(name, fallback) {
1534
1509
  return resolve4(value || fallback);
1535
1510
  }
1536
1511
  function defaultStateDir() {
1537
- return envPath("NEGOTIUM_STATE_DIR", join3(homedir3(), ".negotium"));
1512
+ return envPath("NEGOTIUM_STATE_DIR", join2(homedir2(), ".negotium"));
1538
1513
  }
1539
1514
  function defaultDataDir() {
1540
- return envPath("NEGOTIUM_DATA_DIR", join3(defaultStateDir(), "data"));
1515
+ return envPath("NEGOTIUM_DATA_DIR", join2(defaultStateDir(), "data"));
1541
1516
  }
1542
1517
  function defaultSessionsDatabasePath() {
1543
- return envPath("SESSIONS_DB_PATH", join3(resolveStorageDataDir(), "sessions.db"));
1518
+ return envPath("SESSIONS_DB_PATH", join2(resolveStorageDataDir(), "sessions.db"));
1544
1519
  }
1545
1520
  var SQLITE_INIT_RETRY_MS = 25;
1546
1521
  var SQLITE_INIT_TIMEOUT_MS = 5000;
@@ -1719,8 +1694,8 @@ function initializeVaultDatabase(database) {
1719
1694
  }
1720
1695
  }
1721
1696
  function openVaultDatabase(dataDir) {
1722
- const vaultDir = join4(dataDir, "vault");
1723
- const path = join4(vaultDir, "vault.db");
1697
+ const vaultDir = join3(dataDir, "vault");
1698
+ const path = join3(vaultDir, "vault.db");
1724
1699
  mkdirSync4(vaultDir, { recursive: true, mode: 448 });
1725
1700
  const database = new Database(path, { create: true });
1726
1701
  chmodSync2(path, 384);
@@ -2395,8 +2370,8 @@ async function* claudeProvider(opts) {
2395
2370
  // ../../packages/core/src/agents/codex-provider.ts
2396
2371
  import { execFileSync as execFileSync4 } from "child_process";
2397
2372
  import { existsSync as existsSync6, readFileSync as readFileSync6, realpathSync as realpathSync3, statSync as statSync3 } from "fs";
2398
- import { homedir as homedir4 } from "os";
2399
- import { dirname as dirname8, isAbsolute, join as join8, relative, resolve as resolve7 } from "path";
2373
+ import { homedir as homedir3 } from "os";
2374
+ import { dirname as dirname8, isAbsolute, join as join7, relative, resolve as resolve7 } from "path";
2400
2375
  import { Codex } from "@openai/codex-sdk";
2401
2376
 
2402
2377
  // ../../packages/core/src/agents/codex-native-multi-agent.ts
@@ -2415,10 +2390,10 @@ import {
2415
2390
  } from "fs";
2416
2391
  import { createRequire as createRequire2 } from "module";
2417
2392
  import { tmpdir } from "os";
2418
- import { dirname as dirname5, join as join5 } from "path";
2393
+ import { dirname as dirname5, join as join4 } from "path";
2419
2394
 
2420
2395
  // ../../packages/core/src/version.ts
2421
- var NEGOTIUM_VERSION = "0.4.2";
2396
+ var NEGOTIUM_VERSION = "0.4.4";
2422
2397
 
2423
2398
  // ../../packages/core/src/agents/codex-native-multi-agent.ts
2424
2399
  var moduleRequire = createRequire2(import.meta.url);
@@ -2437,7 +2412,7 @@ var SAFE_BUNDLED_CODEX_VERSION = BUNDLED_CODEX_VERSION.replace(/[^a-zA-Z0-9._-]/
2437
2412
  var NEGOTIUM_MODEL_CACHE = `negotium-models-cache-${SAFE_BUNDLED_CODEX_VERSION}.json`;
2438
2413
  var NEGOTIUM_MODEL_CATALOG = `negotium-model-catalog-${SAFE_BUNDLED_CODEX_VERSION}.json`;
2439
2414
  function codexCliScriptPath() {
2440
- return join5(dirname5(bundledCodexPackagePath), "bin", "codex.js");
2415
+ return join4(dirname5(bundledCodexPackagePath), "bin", "codex.js");
2441
2416
  }
2442
2417
  function parseCodexModelCache(contents, sourcePath) {
2443
2418
  let parsed;
@@ -2478,7 +2453,7 @@ function writePrivateFileAtomic(path, contents) {
2478
2453
  }
2479
2454
  }
2480
2455
  function bundledCodexModelCachePath(authFilePath) {
2481
- return join5(dirname5(authFilePath), NEGOTIUM_MODEL_CACHE);
2456
+ return join4(dirname5(authFilePath), NEGOTIUM_MODEL_CACHE);
2482
2457
  }
2483
2458
  async function bootstrapCodexModelCache(codexHome, cachePath) {
2484
2459
  const child = spawn3(process.execPath, [codexCliScriptPath(), "app-server", "--stdio"], {
@@ -2564,15 +2539,15 @@ async function bootstrapCodexModelCache(codexHome, cachePath) {
2564
2539
  }
2565
2540
  async function bootstrapIsolatedCodexModelCache(authFilePath, bootstrap) {
2566
2541
  const sourceHome = dirname5(authFilePath);
2567
- const isolatedHome = mkdtempSync(join5(tmpdir(), "negotium-codex-models-"));
2568
- const isolatedCachePath = join5(isolatedHome, "models_cache.json");
2542
+ const isolatedHome = mkdtempSync(join4(tmpdir(), "negotium-codex-models-"));
2543
+ const isolatedCachePath = join4(isolatedHome, "models_cache.json");
2569
2544
  try {
2570
- const isolatedAuthPath = join5(isolatedHome, "auth.json");
2545
+ const isolatedAuthPath = join4(isolatedHome, "auth.json");
2571
2546
  copyFileSync(authFilePath, isolatedAuthPath);
2572
2547
  chmodSync3(isolatedAuthPath, 384);
2573
- const sourceConfigPath = join5(sourceHome, "config.toml");
2548
+ const sourceConfigPath = join4(sourceHome, "config.toml");
2574
2549
  if (existsSync3(sourceConfigPath)) {
2575
- const isolatedConfigPath = join5(isolatedHome, "config.toml");
2550
+ const isolatedConfigPath = join4(isolatedHome, "config.toml");
2576
2551
  copyFileSync(sourceConfigPath, isolatedConfigPath);
2577
2552
  chmodSync3(isolatedConfigPath, 384);
2578
2553
  }
@@ -2593,7 +2568,7 @@ async function ensureCodexModelCache(authFilePath, bootstrap = bootstrapCodexMod
2593
2568
  return configuredCachePath;
2594
2569
  }
2595
2570
  const bundledCachePath = bundledCodexModelCachePath(authFilePath);
2596
- const sharedCachePath = join5(codexHome, "models_cache.json");
2571
+ const sharedCachePath = join4(codexHome, "models_cache.json");
2597
2572
  if (existsSync3(sharedCachePath)) {
2598
2573
  try {
2599
2574
  const shared = readCompatibleCodexModelCache(sharedCachePath);
@@ -2613,7 +2588,7 @@ async function ensureCodexModelCache(authFilePath, bootstrap = bootstrapCodexMod
2613
2588
  }
2614
2589
  function writeCodexCatalogWithNativeMultiAgentDisabled(authFilePath, sourcePath) {
2615
2590
  const codexHome = dirname5(authFilePath);
2616
- const outputPath = join5(codexHome, NEGOTIUM_MODEL_CATALOG);
2591
+ const outputPath = join4(codexHome, NEGOTIUM_MODEL_CATALOG);
2617
2592
  const parsed = readCodexModelCache(sourcePath).parsed;
2618
2593
  const models = parsed.models.map((model, index) => {
2619
2594
  if (!model || typeof model !== "object" || Array.isArray(model)) {
@@ -2852,7 +2827,7 @@ import { existsSync as existsSync4 } from "fs";
2852
2827
  import { chmod, mkdtemp, rm, writeFile } from "fs/promises";
2853
2828
  import { createServer } from "net";
2854
2829
  import { tmpdir as tmpdir2 } from "os";
2855
- import { dirname as dirname6, join as join6, resolve as resolve5 } from "path";
2830
+ import { dirname as dirname6, join as join5, resolve as resolve5 } from "path";
2856
2831
  import { fileURLToPath as fileURLToPath2 } from "url";
2857
2832
  var MAX_HOOK_REQUEST_BYTES = 1024 * 1024;
2858
2833
  var SENSITIVE_STORAGE_DENIAL = "Runtime secret storage access is not permitted";
@@ -2909,10 +2884,10 @@ function privateCodexWrapper(codexScript, socketPath, token) {
2909
2884
  `);
2910
2885
  }
2911
2886
  async function createCodexVaultHookBridge(userId) {
2912
- const root = await mkdtemp(join6(tmpdir2(), "negotium-codex-vault-"));
2887
+ const root = await mkdtemp(join5(tmpdir2(), "negotium-codex-vault-"));
2913
2888
  await chmod(root, 448);
2914
- const socketPath = join6(root, "hook.sock");
2915
- const wrapperPath = join6(root, "codex-with-hooks");
2889
+ const socketPath = join5(root, "hook.sock");
2890
+ const wrapperPath = join5(root, "codex-with-hooks");
2916
2891
  const token = randomBytes4(32).toString("hex");
2917
2892
  const connections = new Set;
2918
2893
  const server = createServer((socket) => {
@@ -2999,9 +2974,9 @@ async function createCodexVaultHookBridge(userId) {
2999
2974
 
3000
2975
  // ../../packages/core/src/agents/rollout/codex.ts
3001
2976
  import { existsSync as existsSync5, readFileSync as readFileSync5, realpathSync as realpathSync2, statSync as statSync2, unlinkSync as unlinkSync4 } from "fs";
3002
- import { basename, dirname as dirname7, join as join7, resolve as resolve6 } from "path";
2977
+ import { basename, dirname as dirname7, join as join6, resolve as resolve6 } from "path";
3003
2978
  function codexSessionsDir() {
3004
- return join7(hostedCodexHomePath(), "sessions");
2979
+ return join6(hostedCodexHomePath(), "sessions");
3005
2980
  }
3006
2981
  function canonicalFilePath(path) {
3007
2982
  const absolute = resolve6(path);
@@ -3009,7 +2984,7 @@ function canonicalFilePath(path) {
3009
2984
  return realpathSync2(absolute);
3010
2985
  } catch {
3011
2986
  try {
3012
- return join7(realpathSync2(dirname7(absolute)), basename(absolute));
2987
+ return join6(realpathSync2(dirname7(absolute)), basename(absolute));
3013
2988
  } catch {
3014
2989
  return absolute;
3015
2990
  }
@@ -3239,19 +3214,19 @@ function latestCodexRolloutPath(threadId) {
3239
3214
  try {
3240
3215
  if (buckets) {
3241
3216
  for (const bucket of buckets) {
3242
- const dir = join7(sessionsDir, bucket);
3217
+ const dir = join6(sessionsDir, bucket);
3243
3218
  if (!existsSync5(dir))
3244
3219
  continue;
3245
3220
  const glob = new Bun.Glob(`rollout-*-${threadId}.jsonl`);
3246
3221
  for (const rel of glob.scanSync({ cwd: dir, onlyFiles: true })) {
3247
- candidates.push(join7(dir, rel));
3222
+ candidates.push(join6(dir, rel));
3248
3223
  }
3249
3224
  }
3250
3225
  }
3251
3226
  if (candidates.length === 0) {
3252
3227
  const glob = new Bun.Glob(`**/rollout-*-${threadId}.jsonl`);
3253
3228
  for (const rel of glob.scanSync({ cwd: sessionsDir, onlyFiles: true })) {
3254
- candidates.push(join7(sessionsDir, rel));
3229
+ candidates.push(join6(sessionsDir, rel));
3255
3230
  }
3256
3231
  }
3257
3232
  return candidates.sort((a, b) => statSync2(b).mtimeMs - statSync2(a).mtimeMs)[0];
@@ -3398,13 +3373,14 @@ function mapEffort(effort) {
3398
3373
  return effort;
3399
3374
  }
3400
3375
  var CODEX_MCP_SERVER_NAME_OVERRIDES = {
3401
- playwright: "otium_playwright"
3376
+ playwright: "otium_playwright",
3377
+ "cua-rs": "otium_cua_rs"
3402
3378
  };
3403
3379
  function codexMcpServerName(name) {
3404
3380
  return CODEX_MCP_SERVER_NAME_OVERRIDES[name] ?? name;
3405
3381
  }
3406
3382
  function globalCodexMcpServerNames(authFilePath) {
3407
- const configPath = join8(dirname8(authFilePath), "config.toml");
3383
+ const configPath = join7(dirname8(authFilePath), "config.toml");
3408
3384
  if (!existsSync6(configPath))
3409
3385
  return [];
3410
3386
  try {
@@ -3444,15 +3420,16 @@ function withCodexMcpServerOverrides(_name, server) {
3444
3420
  };
3445
3421
  }
3446
3422
  function toCodexMcpServers(claudeShape) {
3447
- const disabledBrowserStdio = () => ({
3423
+ const disabledStdio = () => ({
3448
3424
  command: process.execPath,
3449
3425
  args: ["-e", "process.exit(0)"],
3450
3426
  enabled: false
3451
3427
  });
3452
3428
  const out = {
3453
- playwright: disabledBrowserStdio(),
3454
- "browser-rs": disabledBrowserStdio(),
3455
- patchright: disabledBrowserStdio()
3429
+ playwright: disabledStdio(),
3430
+ "browser-rs": disabledStdio(),
3431
+ patchright: disabledStdio(),
3432
+ "cua-rs": disabledStdio()
3456
3433
  };
3457
3434
  for (const [name, srv] of Object.entries(claudeShape)) {
3458
3435
  if (!srv || typeof srv !== "object")
@@ -3766,7 +3743,7 @@ async function* codexProvider(opts) {
3766
3743
  mcpServerCount: Object.keys(codexMcpServers).length
3767
3744
  }, "codexProvider: starting turn");
3768
3745
  const hostedCodexHome = hostedCodexHomePath();
3769
- const inheritedCodexHome = process.env.CODEX_HOME || join8(homedir4(), ".codex");
3746
+ const inheritedCodexHome = process.env.CODEX_HOME || join7(homedir3(), ".codex");
3770
3747
  const codexEnvironment = scopedBrowserCapability || resolve7(hostedCodexHome) !== resolve7(inheritedCodexHome) ? {
3771
3748
  ...Object.fromEntries(Object.entries(process.env).filter((entry) => typeof entry[1] === "string")),
3772
3749
  CODEX_HOME: hostedCodexHome,
@@ -4193,7 +4170,7 @@ function maestroProvider(opts) {
4193
4170
  // ../../packages/core/src/agents/claude-runtime-inspection.ts
4194
4171
  import { readFileSync as readFileSync7 } from "fs";
4195
4172
  import { createRequire as createRequire3 } from "module";
4196
- import { dirname as dirname9, join as join9 } from "path";
4173
+ import { dirname as dirname9, join as join8 } from "path";
4197
4174
  var cached;
4198
4175
  function inspectBundledClaudeRuntime() {
4199
4176
  if (cached)
@@ -4201,8 +4178,8 @@ function inspectBundledClaudeRuntime() {
4201
4178
  try {
4202
4179
  const require2 = createRequire3(import.meta.url);
4203
4180
  const sdkDir = dirname9(require2.resolve("@anthropic-ai/claude-agent-sdk"));
4204
- const sdkPackage = JSON.parse(readFileSync7(join9(sdkDir, "package.json"), "utf8"));
4205
- const manifest = JSON.parse(readFileSync7(join9(sdkDir, "manifest.json"), "utf8"));
4181
+ const sdkPackage = JSON.parse(readFileSync7(join8(sdkDir, "package.json"), "utf8"));
4182
+ const manifest = JSON.parse(readFileSync7(join8(sdkDir, "manifest.json"), "utf8"));
4206
4183
  const sdkVersion = typeof sdkPackage.version === "string" ? sdkPackage.version : "";
4207
4184
  const claudeCodeVersion = typeof manifest.version === "string" ? manifest.version : "";
4208
4185
  if (!sdkVersion || !claudeCodeVersion) {
@@ -4275,4 +4252,4 @@ export {
4275
4252
  buildClaudeDisallowedTools
4276
4253
  };
4277
4254
 
4278
- //# debugId=AA00F8568D35B36164756E2164756E21
4255
+ //# debugId=5948FB2BA3560C9864756E2164756E21