negotium 0.4.3 → 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.
@@ -779,7 +779,7 @@ function isPoisonedAssistantEntry(entry) {
779
779
  // ../../packages/core/src/agents/rollout/codex.ts
780
780
  import { randomBytes as randomBytes4 } from "crypto";
781
781
  import { existsSync as existsSync3, readFileSync as readFileSync4, realpathSync as realpathSync2, statSync as statSync2, unlinkSync as unlinkSync3 } from "fs";
782
- import { basename, dirname as dirname5, join as join6, resolve as resolve5 } from "path";
782
+ import { basename, dirname as dirname5, join as join5, resolve as resolve5 } from "path";
783
783
 
784
784
  // ../../packages/core/src/agents/execution-host.ts
785
785
  import { AsyncLocalStorage } from "async_hooks";
@@ -838,11 +838,6 @@ function referencesRuntimeSecretStorage(value) {
838
838
  return false;
839
839
  }
840
840
 
841
- // ../../packages/core/src/platform/mcp-config.ts
842
- import { accessSync as accessSync2, constants as fsConstants } from "fs";
843
- import { homedir as homedir3 } from "os";
844
- import { join as join3 } from "path";
845
-
846
841
  // ../../packages/core/src/mcp/canonical-bridge-config.ts
847
842
  var registrations = [];
848
843
  var turnLeases = new Map;
@@ -1317,6 +1312,10 @@ function playwrightTransport(port, owner, capability, agent) {
1317
1312
  function longLivedHttpMcp(agent, port) {
1318
1313
  return agent === "codex" ? { url: `http://127.0.0.1:${port}/mcp` } : { type: "sse", url: `http://127.0.0.1:${port}/sse` };
1319
1314
  }
1315
+ var cuaRsMcpPort;
1316
+ function cuaRsHttpMcp(port) {
1317
+ return { type: "http", url: `http://127.0.0.1:${port}/mcp` };
1318
+ }
1320
1319
  function backgroundBashTransport(agent, port, userId, topic) {
1321
1320
  const capability = bgBashContextCapability(userId, topic);
1322
1321
  const headers = {
@@ -1538,34 +1537,10 @@ var MCP_CATALOG = {
1538
1537
  "cua-rs": {
1539
1538
  ...commonRuntimeMcpPolicy("cua-rs"),
1540
1539
  build() {
1541
- const bin = resolveCuaRsBinary();
1542
- if (!bin)
1543
- return null;
1544
- return { command: bin, args: cuaRsArgs() };
1540
+ return cuaRsMcpPort ? cuaRsHttpMcp(cuaRsMcpPort) : null;
1545
1541
  }
1546
1542
  }
1547
1543
  };
1548
- function cuaRsArgs() {
1549
- const raw = envText("NEGOTIUM_CUA_RS_ALLOW_HID")?.trim().toLowerCase();
1550
- const on = raw === "1" || raw === "true" || raw === "yes";
1551
- return on ? ["--allow-hid"] : [];
1552
- }
1553
- function resolveCuaRsBinary(platform = process.platform) {
1554
- if (platform !== "darwin")
1555
- return null;
1556
- const candidates = [
1557
- envText("NEGOTIUM_CUA_RS_BIN"),
1558
- join3(homedir3(), ".local", "bin", "cua-rs"),
1559
- "/usr/local/bin/cua-rs"
1560
- ].filter((p) => Boolean(p));
1561
- for (const candidate of candidates) {
1562
- try {
1563
- accessSync2(candidate, fsConstants.X_OK);
1564
- return candidate;
1565
- } catch {}
1566
- }
1567
- return null;
1568
- }
1569
1544
  var allForumMcpServerNames = [];
1570
1545
  var requiredForumMcpServers = [];
1571
1546
  var REQUIRED_FORUM_MCP_SERVERS = requiredForumMcpServers;
@@ -1793,7 +1768,7 @@ function getMcpServersForQuery(opts) {
1793
1768
 
1794
1769
  // ../../packages/core/src/storage/vault.ts
1795
1770
  import { chmodSync as chmodSync2, mkdirSync as mkdirSync5 } from "fs";
1796
- import { join as join5 } from "path";
1771
+ import { join as join4 } from "path";
1797
1772
 
1798
1773
  // ../../packages/core/src/storage/sqlite.ts
1799
1774
  var isBun = typeof process.versions.bun === "string";
@@ -1848,8 +1823,8 @@ if (isBun) {
1848
1823
 
1849
1824
  // ../../packages/core/src/storage/storage-host.ts
1850
1825
  import { mkdirSync as mkdirSync4 } from "fs";
1851
- import { homedir as homedir4 } from "os";
1852
- import { dirname as dirname3, join as join4, resolve as resolve4 } from "path";
1826
+ import { homedir as homedir3 } from "os";
1827
+ import { dirname as dirname3, join as join3, resolve as resolve4 } from "path";
1853
1828
  var STORAGE_HOST_STATE = Symbol.for("negotium.storage-host.state.v1");
1854
1829
  function storageState() {
1855
1830
  const holder = globalThis;
@@ -1878,13 +1853,13 @@ function envPath(name, fallback) {
1878
1853
  return resolve4(value || fallback);
1879
1854
  }
1880
1855
  function defaultStateDir() {
1881
- return envPath("NEGOTIUM_STATE_DIR", join4(homedir4(), ".negotium"));
1856
+ return envPath("NEGOTIUM_STATE_DIR", join3(homedir3(), ".negotium"));
1882
1857
  }
1883
1858
  function defaultDataDir() {
1884
- return envPath("NEGOTIUM_DATA_DIR", join4(defaultStateDir(), "data"));
1859
+ return envPath("NEGOTIUM_DATA_DIR", join3(defaultStateDir(), "data"));
1885
1860
  }
1886
1861
  function defaultSessionsDatabasePath() {
1887
- return envPath("SESSIONS_DB_PATH", join4(resolveStorageDataDir(), "sessions.db"));
1862
+ return envPath("SESSIONS_DB_PATH", join3(resolveStorageDataDir(), "sessions.db"));
1888
1863
  }
1889
1864
  var SQLITE_INIT_RETRY_MS = 25;
1890
1865
  var SQLITE_INIT_TIMEOUT_MS = 5000;
@@ -2063,8 +2038,8 @@ function initializeVaultDatabase(database) {
2063
2038
  }
2064
2039
  }
2065
2040
  function openVaultDatabase(dataDir) {
2066
- const vaultDir = join5(dataDir, "vault");
2067
- const path = join5(vaultDir, "vault.db");
2041
+ const vaultDir = join4(dataDir, "vault");
2042
+ const path = join4(vaultDir, "vault.db");
2068
2043
  mkdirSync5(vaultDir, { recursive: true, mode: 448 });
2069
2044
  const database = new Database(path, { create: true });
2070
2045
  chmodSync2(path, 384);
@@ -2191,13 +2166,13 @@ function hostedCodexHomePath() {
2191
2166
 
2192
2167
  // ../../packages/core/src/agents/rollout/codex.ts
2193
2168
  function codexSessionsDir() {
2194
- return join6(hostedCodexHomePath(), "sessions");
2169
+ return join5(hostedCodexHomePath(), "sessions");
2195
2170
  }
2196
2171
  var _shellCache = null;
2197
2172
  function loadCodexShell() {
2198
2173
  if (_shellCache)
2199
2174
  return _shellCache;
2200
- const raw = readFileSync4(join6(FIXTURES_DIR, "codex-shell.jsonl"), "utf8");
2175
+ const raw = readFileSync4(join5(FIXTURES_DIR, "codex-shell.jsonl"), "utf8");
2201
2176
  const lines = parseJsonlText(raw);
2202
2177
  if (lines.length < 5) {
2203
2178
  throw new Error(`loadCodexShell: expected >=5 entries in codex-shell.jsonl, got ${lines.length}`);
@@ -2264,8 +2239,8 @@ function codexRolloutPath(threadId, fallback) {
2264
2239
  const hh = String(createdAt.getHours()).padStart(2, "0");
2265
2240
  const min = String(createdAt.getMinutes()).padStart(2, "0");
2266
2241
  const ss = String(createdAt.getSeconds()).padStart(2, "0");
2267
- const dir = join6(codexSessionsDir(), yyyy, mm, dd);
2268
- return join6(dir, `rollout-${yyyy}-${mm}-${dd}T${hh}-${min}-${ss}-${threadId}.jsonl`);
2242
+ const dir = join5(codexSessionsDir(), yyyy, mm, dd);
2243
+ return join5(dir, `rollout-${yyyy}-${mm}-${dd}T${hh}-${min}-${ss}-${threadId}.jsonl`);
2269
2244
  }
2270
2245
  function canonicalFilePath(path) {
2271
2246
  const absolute = resolve5(path);
@@ -2273,7 +2248,7 @@ function canonicalFilePath(path) {
2273
2248
  return realpathSync2(absolute);
2274
2249
  } catch {
2275
2250
  try {
2276
- return join6(realpathSync2(dirname5(absolute)), basename(absolute));
2251
+ return join5(realpathSync2(dirname5(absolute)), basename(absolute));
2277
2252
  } catch {
2278
2253
  return absolute;
2279
2254
  }
@@ -2462,19 +2437,19 @@ function latestCodexRolloutPath(threadId) {
2462
2437
  try {
2463
2438
  if (buckets) {
2464
2439
  for (const bucket of buckets) {
2465
- const dir = join6(sessionsDir, bucket);
2440
+ const dir = join5(sessionsDir, bucket);
2466
2441
  if (!existsSync3(dir))
2467
2442
  continue;
2468
2443
  const glob = new Bun.Glob(`rollout-*-${threadId}.jsonl`);
2469
2444
  for (const rel of glob.scanSync({ cwd: dir, onlyFiles: true })) {
2470
- candidates.push(join6(dir, rel));
2445
+ candidates.push(join5(dir, rel));
2471
2446
  }
2472
2447
  }
2473
2448
  }
2474
2449
  if (candidates.length === 0) {
2475
2450
  const glob = new Bun.Glob(`**/rollout-*-${threadId}.jsonl`);
2476
2451
  for (const rel of glob.scanSync({ cwd: sessionsDir, onlyFiles: true })) {
2477
- candidates.push(join6(sessionsDir, rel));
2452
+ candidates.push(join5(sessionsDir, rel));
2478
2453
  }
2479
2454
  }
2480
2455
  return candidates.sort((a, b) => statSync2(b).mtimeMs - statSync2(a).mtimeMs)[0];
@@ -2595,13 +2570,13 @@ function sweepPriorRolloutsForThread(threadId) {
2595
2570
  return;
2596
2571
  }
2597
2572
  for (const bucket of buckets) {
2598
- const dir = join6(sessionsDir, bucket);
2573
+ const dir = join5(sessionsDir, bucket);
2599
2574
  if (!existsSync3(dir))
2600
2575
  continue;
2601
2576
  try {
2602
2577
  const glob = new Bun.Glob(`rollout-*-${threadId}.jsonl`);
2603
2578
  for (const rel of glob.scanSync({ cwd: dir, onlyFiles: true })) {
2604
- const fullPath = join6(dir, rel);
2579
+ const fullPath = join5(dir, rel);
2605
2580
  try {
2606
2581
  unlinkSync3(fullPath);
2607
2582
  } catch (e) {
@@ -2619,7 +2594,7 @@ function sweepPriorRolloutsFullTree(threadId, sessionsDir) {
2619
2594
  try {
2620
2595
  const glob = new Bun.Glob(`**/rollout-*-${threadId}.jsonl`);
2621
2596
  for (const rel of glob.scanSync({ cwd: sessionsDir, onlyFiles: true })) {
2622
- const fullPath = join6(sessionsDir, rel);
2597
+ const fullPath = join5(sessionsDir, rel);
2623
2598
  try {
2624
2599
  unlinkSync3(fullPath);
2625
2600
  } catch (e) {
@@ -2678,4 +2653,4 @@ function formatDateBucket(d) {
2678
2653
 
2679
2654
  export { __toESM, __require, logger, CLAUDE_EFFORT_VALUES, CODEX_EFFORT_VALUES, MAESTRO_EFFORT_VALUES, MODEL_SONNET, MODEL_OPUS, MODEL_FABLE, configureRolloutHost, assertUuidLike, ensureCwdExists, extractChatPairs, encodeClaudeCwd, writeClaudeRollout, repairPoisonedRollout, hostedCodexHomePath, extractLatestCodexPatchPreview, extractCodexPatchCallIds, readCodexPatchCallIds, readLatestCodexPatchPreview, extractLatestCodexContextUsage, readLatestCodexContextUsage, migrateCodexRolloutNativeMultiAgentMetadata, latestCodexRolloutPath, writeCodexRollout, decodeUuidV7Timestamp };
2680
2655
 
2681
- //# debugId=FED74EAE160C674464756E2164756E21
2656
+ //# debugId=A47FDC961FB9CD8B64756E2164756E21