negotium 0.2.2 → 0.2.3
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/agent-helpers.js +131 -133
- package/dist/agent-helpers.js.map +4 -4
- package/dist/{chunk-kc5kmr95.js → chunk-hsqgb2hw.js} +22 -24
- package/dist/{chunk-kc5kmr95.js.map → chunk-hsqgb2hw.js.map} +3 -3
- package/dist/hosted-agent.js +34 -36
- package/dist/hosted-agent.js.map +4 -4
- package/dist/main.js +291 -918
- package/dist/main.js.map +7 -9
- package/dist/mcp-factories.js +135 -137
- package/dist/mcp-factories.js.map +4 -4
- package/dist/registry.js +1 -1
- package/dist/rollout.js +1 -1
- package/dist/runtime/src/agents/rollout/shared.ts +3 -5
- package/dist/runtime/src/version.ts +1 -1
- package/dist/types/packages/core/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/dist/runtime/src/migration/single-user.ts +0 -805
package/dist/hosted-agent.js
CHANGED
|
@@ -11,8 +11,7 @@ import { existsSync as existsSync2, readFileSync as readFileSync3 } from "fs";
|
|
|
11
11
|
import { query } from "@anthropic-ai/claude-agent-sdk";
|
|
12
12
|
|
|
13
13
|
// ../../packages/core/src/agents/rollout/shared.ts
|
|
14
|
-
import {
|
|
15
|
-
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
14
|
+
import { resolve as resolve2 } from "path";
|
|
16
15
|
|
|
17
16
|
// ../../packages/core/src/platform/config.ts
|
|
18
17
|
import { execFileSync } from "child_process";
|
|
@@ -306,14 +305,13 @@ function codexAuthFilePath() {
|
|
|
306
305
|
}
|
|
307
306
|
|
|
308
307
|
// ../../packages/core/src/agents/rollout/shared.ts
|
|
309
|
-
var __dirname2 = dirname2(fileURLToPath2(import.meta.url));
|
|
310
308
|
var trustedWorkspaceRoots = [
|
|
311
309
|
WORKSPACE_DIR,
|
|
312
310
|
DM_WORKSPACE_DIR,
|
|
313
311
|
SESSION_WORKSPACE_DIR,
|
|
314
312
|
TOPIC_WORKSPACE_DIR
|
|
315
313
|
].map((root) => resolve2(root));
|
|
316
|
-
var FIXTURES_DIR =
|
|
314
|
+
var FIXTURES_DIR = resolve2(PROJECT_ROOT, "src", "agents", "fixtures");
|
|
317
315
|
|
|
318
316
|
// ../../packages/core/src/platform/jsonl.ts
|
|
319
317
|
import {
|
|
@@ -328,7 +326,7 @@ import {
|
|
|
328
326
|
unlinkSync as unlinkSync2,
|
|
329
327
|
writeFileSync as writeFileSync2
|
|
330
328
|
} from "fs";
|
|
331
|
-
import { dirname as
|
|
329
|
+
import { dirname as dirname2 } from "path";
|
|
332
330
|
|
|
333
331
|
// ../../packages/core/src/platform/file-utils.ts
|
|
334
332
|
import { unlinkSync } from "fs";
|
|
@@ -356,7 +354,7 @@ function parseJsonlText(raw) {
|
|
|
356
354
|
}
|
|
357
355
|
var LOCK_SLEEP = new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT));
|
|
358
356
|
function writeJsonlFile(filePath, entries) {
|
|
359
|
-
const dir =
|
|
357
|
+
const dir = dirname2(filePath);
|
|
360
358
|
mkdirSync2(dir, { recursive: true });
|
|
361
359
|
const tmpPath = `${filePath}.tmp-${process.pid}-${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
|
362
360
|
const payload = `${entries.map((e) => JSON.stringify(e)).join(`
|
|
@@ -1317,7 +1315,7 @@ function getMcpServersForQuery(opts) {
|
|
|
1317
1315
|
|
|
1318
1316
|
// ../../packages/core/src/storage/vault.ts
|
|
1319
1317
|
import { chmodSync as chmodSync2, mkdirSync as mkdirSync3 } from "fs";
|
|
1320
|
-
import { join as
|
|
1318
|
+
import { join as join2 } from "path";
|
|
1321
1319
|
|
|
1322
1320
|
// ../../packages/core/src/storage/sqlite.ts
|
|
1323
1321
|
var isBun = typeof process.versions.bun === "string";
|
|
@@ -1459,8 +1457,8 @@ function initializeVaultDatabase(database) {
|
|
|
1459
1457
|
}
|
|
1460
1458
|
}
|
|
1461
1459
|
function openVaultDatabase(dataDir) {
|
|
1462
|
-
const vaultDir =
|
|
1463
|
-
const path =
|
|
1460
|
+
const vaultDir = join2(dataDir, "vault");
|
|
1461
|
+
const path = join2(vaultDir, "vault.db");
|
|
1464
1462
|
mkdirSync3(vaultDir, { recursive: true, mode: 448 });
|
|
1465
1463
|
const database = new Database(path, { create: true });
|
|
1466
1464
|
chmodSync2(path, 384);
|
|
@@ -2120,7 +2118,7 @@ async function* claudeProvider(opts) {
|
|
|
2120
2118
|
// ../../packages/core/src/agents/codex-provider.ts
|
|
2121
2119
|
import { execFileSync as execFileSync4 } from "child_process";
|
|
2122
2120
|
import { existsSync as existsSync5, readFileSync as readFileSync6, realpathSync as realpathSync3, statSync as statSync3 } from "fs";
|
|
2123
|
-
import { dirname as
|
|
2121
|
+
import { dirname as dirname5, isAbsolute, join as join5, relative, resolve as resolve5 } from "path";
|
|
2124
2122
|
import { Codex } from "@openai/codex-sdk";
|
|
2125
2123
|
|
|
2126
2124
|
// ../../packages/core/src/agents/codex-native-multi-agent.ts
|
|
@@ -2139,10 +2137,10 @@ import {
|
|
|
2139
2137
|
} from "fs";
|
|
2140
2138
|
import { createRequire as createRequire2 } from "module";
|
|
2141
2139
|
import { tmpdir } from "os";
|
|
2142
|
-
import { dirname as
|
|
2140
|
+
import { dirname as dirname3, join as join3 } from "path";
|
|
2143
2141
|
|
|
2144
2142
|
// ../../packages/core/src/version.ts
|
|
2145
|
-
var NEGOTIUM_VERSION = "0.2.
|
|
2143
|
+
var NEGOTIUM_VERSION = "0.2.3";
|
|
2146
2144
|
|
|
2147
2145
|
// ../../packages/core/src/agents/codex-native-multi-agent.ts
|
|
2148
2146
|
var moduleRequire = createRequire2(import.meta.url);
|
|
@@ -2161,7 +2159,7 @@ var SAFE_BUNDLED_CODEX_VERSION = BUNDLED_CODEX_VERSION.replace(/[^a-zA-Z0-9._-]/
|
|
|
2161
2159
|
var NEGOTIUM_MODEL_CACHE = `negotium-models-cache-${SAFE_BUNDLED_CODEX_VERSION}.json`;
|
|
2162
2160
|
var NEGOTIUM_MODEL_CATALOG = `negotium-model-catalog-${SAFE_BUNDLED_CODEX_VERSION}.json`;
|
|
2163
2161
|
function codexCliScriptPath() {
|
|
2164
|
-
return
|
|
2162
|
+
return join3(dirname3(bundledCodexPackagePath), "bin", "codex.js");
|
|
2165
2163
|
}
|
|
2166
2164
|
function parseCodexModelCache(contents, sourcePath) {
|
|
2167
2165
|
let parsed;
|
|
@@ -2202,7 +2200,7 @@ function writePrivateFileAtomic(path, contents) {
|
|
|
2202
2200
|
}
|
|
2203
2201
|
}
|
|
2204
2202
|
function bundledCodexModelCachePath(authFilePath) {
|
|
2205
|
-
return
|
|
2203
|
+
return join3(dirname3(authFilePath), NEGOTIUM_MODEL_CACHE);
|
|
2206
2204
|
}
|
|
2207
2205
|
async function bootstrapCodexModelCache(codexHome, cachePath) {
|
|
2208
2206
|
const child = spawn3(process.execPath, [codexCliScriptPath(), "app-server", "--stdio"], {
|
|
@@ -2287,16 +2285,16 @@ async function bootstrapCodexModelCache(codexHome, cachePath) {
|
|
|
2287
2285
|
});
|
|
2288
2286
|
}
|
|
2289
2287
|
async function bootstrapIsolatedCodexModelCache(authFilePath, bootstrap) {
|
|
2290
|
-
const sourceHome =
|
|
2291
|
-
const isolatedHome = mkdtempSync(
|
|
2292
|
-
const isolatedCachePath =
|
|
2288
|
+
const sourceHome = dirname3(authFilePath);
|
|
2289
|
+
const isolatedHome = mkdtempSync(join3(tmpdir(), "negotium-codex-models-"));
|
|
2290
|
+
const isolatedCachePath = join3(isolatedHome, "models_cache.json");
|
|
2293
2291
|
try {
|
|
2294
|
-
const isolatedAuthPath =
|
|
2292
|
+
const isolatedAuthPath = join3(isolatedHome, "auth.json");
|
|
2295
2293
|
copyFileSync(authFilePath, isolatedAuthPath);
|
|
2296
2294
|
chmodSync3(isolatedAuthPath, 384);
|
|
2297
|
-
const sourceConfigPath =
|
|
2295
|
+
const sourceConfigPath = join3(sourceHome, "config.toml");
|
|
2298
2296
|
if (existsSync3(sourceConfigPath)) {
|
|
2299
|
-
const isolatedConfigPath =
|
|
2297
|
+
const isolatedConfigPath = join3(isolatedHome, "config.toml");
|
|
2300
2298
|
copyFileSync(sourceConfigPath, isolatedConfigPath);
|
|
2301
2299
|
chmodSync3(isolatedConfigPath, 384);
|
|
2302
2300
|
}
|
|
@@ -2307,7 +2305,7 @@ async function bootstrapIsolatedCodexModelCache(authFilePath, bootstrap) {
|
|
|
2307
2305
|
}
|
|
2308
2306
|
}
|
|
2309
2307
|
async function ensureCodexModelCache(authFilePath, bootstrap = bootstrapCodexModelCache) {
|
|
2310
|
-
const codexHome =
|
|
2308
|
+
const codexHome = dirname3(authFilePath);
|
|
2311
2309
|
const configuredCachePath = process.env.NEGOTIUM_CODEX_MODELS_CACHE_FILE;
|
|
2312
2310
|
if (configuredCachePath) {
|
|
2313
2311
|
if (!existsSync3(configuredCachePath)) {
|
|
@@ -2317,7 +2315,7 @@ async function ensureCodexModelCache(authFilePath, bootstrap = bootstrapCodexMod
|
|
|
2317
2315
|
return configuredCachePath;
|
|
2318
2316
|
}
|
|
2319
2317
|
const bundledCachePath = bundledCodexModelCachePath(authFilePath);
|
|
2320
|
-
const sharedCachePath =
|
|
2318
|
+
const sharedCachePath = join3(codexHome, "models_cache.json");
|
|
2321
2319
|
if (existsSync3(sharedCachePath)) {
|
|
2322
2320
|
try {
|
|
2323
2321
|
const shared = readCompatibleCodexModelCache(sharedCachePath);
|
|
@@ -2336,8 +2334,8 @@ async function ensureCodexModelCache(authFilePath, bootstrap = bootstrapCodexMod
|
|
|
2336
2334
|
return bundledCachePath;
|
|
2337
2335
|
}
|
|
2338
2336
|
function writeCodexCatalogWithNativeMultiAgentDisabled(authFilePath, sourcePath) {
|
|
2339
|
-
const codexHome =
|
|
2340
|
-
const outputPath =
|
|
2337
|
+
const codexHome = dirname3(authFilePath);
|
|
2338
|
+
const outputPath = join3(codexHome, NEGOTIUM_MODEL_CATALOG);
|
|
2341
2339
|
const parsed = readCodexModelCache(sourcePath).parsed;
|
|
2342
2340
|
const models = parsed.models.map((model, index) => {
|
|
2343
2341
|
if (!model || typeof model !== "object" || Array.isArray(model)) {
|
|
@@ -2573,9 +2571,9 @@ var killOwnedCodexTreesForShutdown = manager.killOwnedTreesForShutdown;
|
|
|
2573
2571
|
// ../../packages/core/src/agents/rollout/codex.ts
|
|
2574
2572
|
import { existsSync as existsSync4, readFileSync as readFileSync5, realpathSync as realpathSync2, statSync as statSync2, unlinkSync as unlinkSync4 } from "fs";
|
|
2575
2573
|
import { homedir as homedir2 } from "os";
|
|
2576
|
-
import { basename, dirname as
|
|
2574
|
+
import { basename, dirname as dirname4, join as join4, resolve as resolve4 } from "path";
|
|
2577
2575
|
function codexSessionsDir() {
|
|
2578
|
-
return
|
|
2576
|
+
return join4(process.env.CODEX_HOME || join4(homedir2(), ".codex"), "sessions");
|
|
2579
2577
|
}
|
|
2580
2578
|
function canonicalFilePath(path) {
|
|
2581
2579
|
const absolute = resolve4(path);
|
|
@@ -2583,7 +2581,7 @@ function canonicalFilePath(path) {
|
|
|
2583
2581
|
return realpathSync2(absolute);
|
|
2584
2582
|
} catch {
|
|
2585
2583
|
try {
|
|
2586
|
-
return
|
|
2584
|
+
return join4(realpathSync2(dirname4(absolute)), basename(absolute));
|
|
2587
2585
|
} catch {
|
|
2588
2586
|
return absolute;
|
|
2589
2587
|
}
|
|
@@ -2772,19 +2770,19 @@ function latestCodexRolloutPath(threadId) {
|
|
|
2772
2770
|
try {
|
|
2773
2771
|
if (buckets) {
|
|
2774
2772
|
for (const bucket of buckets) {
|
|
2775
|
-
const dir =
|
|
2773
|
+
const dir = join4(sessionsDir, bucket);
|
|
2776
2774
|
if (!existsSync4(dir))
|
|
2777
2775
|
continue;
|
|
2778
2776
|
const glob = new Bun.Glob(`rollout-*-${threadId}.jsonl`);
|
|
2779
2777
|
for (const rel of glob.scanSync({ cwd: dir, onlyFiles: true })) {
|
|
2780
|
-
candidates.push(
|
|
2778
|
+
candidates.push(join4(dir, rel));
|
|
2781
2779
|
}
|
|
2782
2780
|
}
|
|
2783
2781
|
}
|
|
2784
2782
|
if (candidates.length === 0) {
|
|
2785
2783
|
const glob = new Bun.Glob(`**/rollout-*-${threadId}.jsonl`);
|
|
2786
2784
|
for (const rel of glob.scanSync({ cwd: sessionsDir, onlyFiles: true })) {
|
|
2787
|
-
candidates.push(
|
|
2785
|
+
candidates.push(join4(sessionsDir, rel));
|
|
2788
2786
|
}
|
|
2789
2787
|
}
|
|
2790
2788
|
return candidates.sort((a, b) => statSync2(b).mtimeMs - statSync2(a).mtimeMs)[0];
|
|
@@ -2922,7 +2920,7 @@ function codexMcpServerName(name) {
|
|
|
2922
2920
|
return CODEX_MCP_SERVER_NAME_OVERRIDES[name] ?? name;
|
|
2923
2921
|
}
|
|
2924
2922
|
function globalCodexMcpServerNames(authFilePath) {
|
|
2925
|
-
const configPath =
|
|
2923
|
+
const configPath = join5(dirname5(authFilePath), "config.toml");
|
|
2926
2924
|
if (!existsSync5(configPath))
|
|
2927
2925
|
return [];
|
|
2928
2926
|
try {
|
|
@@ -3688,16 +3686,16 @@ function maestroProvider(opts) {
|
|
|
3688
3686
|
// ../../packages/core/src/agents/claude-runtime-inspection.ts
|
|
3689
3687
|
import { readFileSync as readFileSync7 } from "fs";
|
|
3690
3688
|
import { createRequire as createRequire3 } from "module";
|
|
3691
|
-
import { dirname as
|
|
3689
|
+
import { dirname as dirname6, join as join6 } from "path";
|
|
3692
3690
|
var cached;
|
|
3693
3691
|
function inspectBundledClaudeRuntime() {
|
|
3694
3692
|
if (cached)
|
|
3695
3693
|
return cached;
|
|
3696
3694
|
try {
|
|
3697
3695
|
const require2 = createRequire3(import.meta.url);
|
|
3698
|
-
const sdkDir =
|
|
3699
|
-
const sdkPackage = JSON.parse(readFileSync7(
|
|
3700
|
-
const manifest = JSON.parse(readFileSync7(
|
|
3696
|
+
const sdkDir = dirname6(require2.resolve("@anthropic-ai/claude-agent-sdk"));
|
|
3697
|
+
const sdkPackage = JSON.parse(readFileSync7(join6(sdkDir, "package.json"), "utf8"));
|
|
3698
|
+
const manifest = JSON.parse(readFileSync7(join6(sdkDir, "manifest.json"), "utf8"));
|
|
3701
3699
|
const sdkVersion = typeof sdkPackage.version === "string" ? sdkPackage.version : "";
|
|
3702
3700
|
const claudeCodeVersion = typeof manifest.version === "string" ? manifest.version : "";
|
|
3703
3701
|
if (!sdkVersion || !claudeCodeVersion) {
|
|
@@ -3770,4 +3768,4 @@ export {
|
|
|
3770
3768
|
buildClaudeDisallowedTools
|
|
3771
3769
|
};
|
|
3772
3770
|
|
|
3773
|
-
//# debugId=
|
|
3771
|
+
//# debugId=1CBD65157B0A833464756E2164756E21
|