negotium 0.2.3 → 0.2.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.
- package/dist/agent-helpers.js +3069 -2865
- package/dist/agent-helpers.js.map +38 -37
- package/dist/background-bash.js.map +1 -1
- package/dist/browser-runtime.js +137 -21
- package/dist/browser-runtime.js.map +10 -9
- package/dist/{chunk-hsqgb2hw.js → chunk-1s9ryz8g.js} +1195 -19
- package/dist/chunk-1s9ryz8g.js.map +35 -0
- package/dist/hosted-agent.js +45 -31
- package/dist/hosted-agent.js.map +9 -9
- package/dist/main.js +2691 -2383
- package/dist/main.js.map +32 -30
- package/dist/mcp-factories.js +6210 -6002
- package/dist/mcp-factories.js.map +39 -38
- package/dist/prompts.js.map +1 -1
- package/dist/query-runtime.js +22 -2
- package/dist/query-runtime.js.map +4 -4
- package/dist/registry.js +169 -213
- package/dist/registry.js.map +8 -9
- package/dist/rollout.js +1 -1
- package/dist/runtime/src/agents/codex-app-server.ts +136 -0
- package/dist/runtime/src/agents/codex-native-multi-agent.ts +1 -1
- package/dist/runtime/src/agents/codex-provider.ts +21 -11
- package/dist/runtime/src/agents/codex-registry.ts +9 -17
- package/dist/runtime/src/agents/contracts.ts +2 -0
- package/dist/runtime/src/agents/execution-host.ts +6 -0
- package/dist/runtime/src/agents/fork.ts +24 -18
- package/dist/runtime/src/agents/idle-archiver.ts +7 -2
- package/dist/runtime/src/agents/index.ts +2 -1
- package/dist/runtime/src/agents/maestro-registry.ts +26 -7
- package/dist/runtime/src/agents/memory-archive-policy.ts +20 -0
- package/dist/runtime/src/agents/rollout/codex.ts +6 -5
- package/dist/runtime/src/mcp/factories/session-comm.ts +12 -0
- package/dist/runtime/src/mcp/session-comm/default-host.ts +16 -0
- package/dist/runtime/src/mcp/session-comm/server.ts +25 -0
- package/dist/runtime/src/platform/config.ts +4 -1
- package/dist/runtime/src/platform/playwright/manager.ts +57 -1
- package/dist/runtime/src/platform/playwright/profile-management.ts +33 -0
- package/dist/runtime/src/platform/playwright/public-runtime.ts +5 -0
- package/dist/runtime/src/platform/playwright/vault-broker.ts +9 -10
- package/dist/runtime/src/storage/browser-profiles.ts +35 -10
- package/dist/runtime/src/storage/storage-host.ts +31 -5
- package/dist/runtime/src/storage/vault.ts +30 -2
- package/dist/runtime/src/topics/derive.ts +38 -2
- package/dist/runtime/src/topics/lifecycle.ts +12 -2
- package/dist/runtime/src/version.ts +1 -1
- package/dist/runtime-helpers.js +22 -2
- package/dist/runtime-helpers.js.map +4 -4
- package/dist/storage.js +22 -2
- package/dist/storage.js.map +4 -4
- package/dist/types/packages/core/src/agents/codex-app-server.d.ts +13 -0
- package/dist/types/packages/core/src/agents/codex-native-multi-agent.d.ts +1 -0
- package/dist/types/packages/core/src/agents/contracts.d.ts +2 -0
- package/dist/types/packages/core/src/agents/execution-host.d.ts +2 -0
- package/dist/types/packages/core/src/agents/fork.d.ts +8 -7
- package/dist/types/packages/core/src/agents/memory-archive-policy.d.ts +10 -0
- package/dist/types/packages/core/src/agents/rollout/codex.d.ts +4 -2
- package/dist/types/packages/core/src/mcp/factories/session-comm.d.ts +1 -0
- package/dist/types/packages/core/src/platform/playwright/manager.d.ts +15 -0
- package/dist/types/packages/core/src/platform/playwright/profile-management.d.ts +8 -0
- package/dist/types/packages/core/src/platform/playwright/public-runtime.d.ts +2 -1
- package/dist/types/packages/core/src/storage/browser-profiles.d.ts +3 -1
- package/dist/types/packages/core/src/storage/storage-host.d.ts +1 -0
- package/dist/types/packages/core/src/storage/vault.d.ts +8 -0
- package/dist/types/packages/core/src/version.d.ts +1 -1
- package/dist/vault.js +19 -3
- package/dist/vault.js.map +4 -4
- package/package.json +2 -2
- package/dist/chunk-hsqgb2hw.js.map +0 -19
package/dist/hosted-agent.js
CHANGED
|
@@ -301,7 +301,7 @@ var PDFTOTEXT_BIN = envText("PDFTOTEXT_BIN") ?? "pdftotext";
|
|
|
301
301
|
var _envMaxTellDepth = Number.parseInt(process.env.MAX_TELL_DEPTH ?? "", 10);
|
|
302
302
|
var MAX_TELL_DEPTH = Number.isInteger(_envMaxTellDepth) && _envMaxTellDepth > 0 ? _envMaxTellDepth : 20;
|
|
303
303
|
function codexAuthFilePath() {
|
|
304
|
-
return process.env.NEGOTIUM_CODEX_AUTH_FILE || join(homedir(), ".codex", "auth.json");
|
|
304
|
+
return process.env.NEGOTIUM_CODEX_AUTH_FILE || join(process.env.CODEX_HOME || join(homedir(), ".codex"), "auth.json");
|
|
305
305
|
}
|
|
306
306
|
|
|
307
307
|
// ../../packages/core/src/agents/rollout/shared.ts
|
|
@@ -440,6 +440,7 @@ function deepMapStrings(value, fn) {
|
|
|
440
440
|
|
|
441
441
|
// ../../packages/core/src/agents/execution-host.ts
|
|
442
442
|
import { AsyncLocalStorage } from "async_hooks";
|
|
443
|
+
import { dirname as dirname3 } from "path";
|
|
443
444
|
|
|
444
445
|
// ../../packages/core/src/security/sensitive-path.ts
|
|
445
446
|
import { realpathSync } from "fs";
|
|
@@ -1482,13 +1483,19 @@ function decryptRow(userId, key, storedValue) {
|
|
|
1482
1483
|
}
|
|
1483
1484
|
return decoded.value;
|
|
1484
1485
|
}
|
|
1485
|
-
function
|
|
1486
|
+
function vaultListDecryptableValues(userId) {
|
|
1486
1487
|
const rows = activeVaultDatabase().prepare("SELECT key, description, value FROM vault WHERE user_id = ? ORDER BY key").all(userId);
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1488
|
+
const entries = [];
|
|
1489
|
+
for (const row of rows) {
|
|
1490
|
+
try {
|
|
1491
|
+
entries.push({
|
|
1492
|
+
key: row.key,
|
|
1493
|
+
description: row.description,
|
|
1494
|
+
value: decryptRow(userId, row.key, row.value)
|
|
1495
|
+
});
|
|
1496
|
+
} catch {}
|
|
1497
|
+
}
|
|
1498
|
+
return entries;
|
|
1492
1499
|
}
|
|
1493
1500
|
function vaultGetValue(userId, key) {
|
|
1494
1501
|
const normalizedKey = normalizeVaultKey(key);
|
|
@@ -1496,10 +1503,12 @@ function vaultGetValue(userId, key) {
|
|
|
1496
1503
|
return row ? decryptRow(userId, row.key, row.value) : undefined;
|
|
1497
1504
|
}
|
|
1498
1505
|
function vaultSubstituteDetailed(userId, text) {
|
|
1499
|
-
const entries = new Map
|
|
1506
|
+
const entries = new Map;
|
|
1500
1507
|
const usedKeys = new Set;
|
|
1501
1508
|
const substituted = text.replace(/\{\{([^}]+)\}\}/g, (match, rawKey) => {
|
|
1502
1509
|
const key = normalizeVaultKey(rawKey);
|
|
1510
|
+
if (!entries.has(key))
|
|
1511
|
+
entries.set(key, vaultGetValue(userId, key));
|
|
1503
1512
|
const value = entries.get(key);
|
|
1504
1513
|
if (value === undefined)
|
|
1505
1514
|
return match;
|
|
@@ -1520,7 +1529,7 @@ function encodedSecretForms(value) {
|
|
|
1520
1529
|
return [...forms].sort((a, b) => b.length - a.length);
|
|
1521
1530
|
}
|
|
1522
1531
|
function redactVaultSecrets(userId, text) {
|
|
1523
|
-
const candidates =
|
|
1532
|
+
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
1533
|
if (candidates.length === 0)
|
|
1525
1534
|
return text;
|
|
1526
1535
|
const candidatesByFirstCharacter = new Map;
|
|
@@ -1614,6 +1623,9 @@ function hostedClaudeCodeExecutablePath() {
|
|
|
1614
1623
|
function hostedCodexAuthFilePath() {
|
|
1615
1624
|
return activeHost().codexAuthFilePath();
|
|
1616
1625
|
}
|
|
1626
|
+
function hostedCodexHomePath() {
|
|
1627
|
+
return dirname3(hostedCodexAuthFilePath());
|
|
1628
|
+
}
|
|
1617
1629
|
|
|
1618
1630
|
// ../../packages/core/src/media/file-events.ts
|
|
1619
1631
|
function* extractFileEvents(text, source) {
|
|
@@ -2118,7 +2130,8 @@ async function* claudeProvider(opts) {
|
|
|
2118
2130
|
// ../../packages/core/src/agents/codex-provider.ts
|
|
2119
2131
|
import { execFileSync as execFileSync4 } from "child_process";
|
|
2120
2132
|
import { existsSync as existsSync5, readFileSync as readFileSync6, realpathSync as realpathSync3, statSync as statSync3 } from "fs";
|
|
2121
|
-
import {
|
|
2133
|
+
import { homedir as homedir2 } from "os";
|
|
2134
|
+
import { dirname as dirname6, isAbsolute, join as join5, relative, resolve as resolve5 } from "path";
|
|
2122
2135
|
import { Codex } from "@openai/codex-sdk";
|
|
2123
2136
|
|
|
2124
2137
|
// ../../packages/core/src/agents/codex-native-multi-agent.ts
|
|
@@ -2137,10 +2150,10 @@ import {
|
|
|
2137
2150
|
} from "fs";
|
|
2138
2151
|
import { createRequire as createRequire2 } from "module";
|
|
2139
2152
|
import { tmpdir } from "os";
|
|
2140
|
-
import { dirname as
|
|
2153
|
+
import { dirname as dirname4, join as join3 } from "path";
|
|
2141
2154
|
|
|
2142
2155
|
// ../../packages/core/src/version.ts
|
|
2143
|
-
var NEGOTIUM_VERSION = "0.2.
|
|
2156
|
+
var NEGOTIUM_VERSION = "0.2.4";
|
|
2144
2157
|
|
|
2145
2158
|
// ../../packages/core/src/agents/codex-native-multi-agent.ts
|
|
2146
2159
|
var moduleRequire = createRequire2(import.meta.url);
|
|
@@ -2159,7 +2172,7 @@ var SAFE_BUNDLED_CODEX_VERSION = BUNDLED_CODEX_VERSION.replace(/[^a-zA-Z0-9._-]/
|
|
|
2159
2172
|
var NEGOTIUM_MODEL_CACHE = `negotium-models-cache-${SAFE_BUNDLED_CODEX_VERSION}.json`;
|
|
2160
2173
|
var NEGOTIUM_MODEL_CATALOG = `negotium-model-catalog-${SAFE_BUNDLED_CODEX_VERSION}.json`;
|
|
2161
2174
|
function codexCliScriptPath() {
|
|
2162
|
-
return join3(
|
|
2175
|
+
return join3(dirname4(bundledCodexPackagePath), "bin", "codex.js");
|
|
2163
2176
|
}
|
|
2164
2177
|
function parseCodexModelCache(contents, sourcePath) {
|
|
2165
2178
|
let parsed;
|
|
@@ -2200,7 +2213,7 @@ function writePrivateFileAtomic(path, contents) {
|
|
|
2200
2213
|
}
|
|
2201
2214
|
}
|
|
2202
2215
|
function bundledCodexModelCachePath(authFilePath) {
|
|
2203
|
-
return join3(
|
|
2216
|
+
return join3(dirname4(authFilePath), NEGOTIUM_MODEL_CACHE);
|
|
2204
2217
|
}
|
|
2205
2218
|
async function bootstrapCodexModelCache(codexHome, cachePath) {
|
|
2206
2219
|
const child = spawn3(process.execPath, [codexCliScriptPath(), "app-server", "--stdio"], {
|
|
@@ -2285,7 +2298,7 @@ async function bootstrapCodexModelCache(codexHome, cachePath) {
|
|
|
2285
2298
|
});
|
|
2286
2299
|
}
|
|
2287
2300
|
async function bootstrapIsolatedCodexModelCache(authFilePath, bootstrap) {
|
|
2288
|
-
const sourceHome =
|
|
2301
|
+
const sourceHome = dirname4(authFilePath);
|
|
2289
2302
|
const isolatedHome = mkdtempSync(join3(tmpdir(), "negotium-codex-models-"));
|
|
2290
2303
|
const isolatedCachePath = join3(isolatedHome, "models_cache.json");
|
|
2291
2304
|
try {
|
|
@@ -2305,7 +2318,7 @@ async function bootstrapIsolatedCodexModelCache(authFilePath, bootstrap) {
|
|
|
2305
2318
|
}
|
|
2306
2319
|
}
|
|
2307
2320
|
async function ensureCodexModelCache(authFilePath, bootstrap = bootstrapCodexModelCache) {
|
|
2308
|
-
const codexHome =
|
|
2321
|
+
const codexHome = dirname4(authFilePath);
|
|
2309
2322
|
const configuredCachePath = process.env.NEGOTIUM_CODEX_MODELS_CACHE_FILE;
|
|
2310
2323
|
if (configuredCachePath) {
|
|
2311
2324
|
if (!existsSync3(configuredCachePath)) {
|
|
@@ -2334,7 +2347,7 @@ async function ensureCodexModelCache(authFilePath, bootstrap = bootstrapCodexMod
|
|
|
2334
2347
|
return bundledCachePath;
|
|
2335
2348
|
}
|
|
2336
2349
|
function writeCodexCatalogWithNativeMultiAgentDisabled(authFilePath, sourcePath) {
|
|
2337
|
-
const codexHome =
|
|
2350
|
+
const codexHome = dirname4(authFilePath);
|
|
2338
2351
|
const outputPath = join3(codexHome, NEGOTIUM_MODEL_CATALOG);
|
|
2339
2352
|
const parsed = readCodexModelCache(sourcePath).parsed;
|
|
2340
2353
|
const models = parsed.models.map((model, index) => {
|
|
@@ -2570,10 +2583,9 @@ var killOwnedCodexTreesForShutdown = manager.killOwnedTreesForShutdown;
|
|
|
2570
2583
|
|
|
2571
2584
|
// ../../packages/core/src/agents/rollout/codex.ts
|
|
2572
2585
|
import { existsSync as existsSync4, readFileSync as readFileSync5, realpathSync as realpathSync2, statSync as statSync2, unlinkSync as unlinkSync4 } from "fs";
|
|
2573
|
-
import {
|
|
2574
|
-
import { basename, dirname as dirname4, join as join4, resolve as resolve4 } from "path";
|
|
2586
|
+
import { basename, dirname as dirname5, join as join4, resolve as resolve4 } from "path";
|
|
2575
2587
|
function codexSessionsDir() {
|
|
2576
|
-
return join4(
|
|
2588
|
+
return join4(hostedCodexHomePath(), "sessions");
|
|
2577
2589
|
}
|
|
2578
2590
|
function canonicalFilePath(path) {
|
|
2579
2591
|
const absolute = resolve4(path);
|
|
@@ -2581,7 +2593,7 @@ function canonicalFilePath(path) {
|
|
|
2581
2593
|
return realpathSync2(absolute);
|
|
2582
2594
|
} catch {
|
|
2583
2595
|
try {
|
|
2584
|
-
return join4(realpathSync2(
|
|
2596
|
+
return join4(realpathSync2(dirname5(absolute)), basename(absolute));
|
|
2585
2597
|
} catch {
|
|
2586
2598
|
return absolute;
|
|
2587
2599
|
}
|
|
@@ -2920,7 +2932,7 @@ function codexMcpServerName(name) {
|
|
|
2920
2932
|
return CODEX_MCP_SERVER_NAME_OVERRIDES[name] ?? name;
|
|
2921
2933
|
}
|
|
2922
2934
|
function globalCodexMcpServerNames(authFilePath) {
|
|
2923
|
-
const configPath = join5(
|
|
2935
|
+
const configPath = join5(dirname6(authFilePath), "config.toml");
|
|
2924
2936
|
if (!existsSync5(configPath))
|
|
2925
2937
|
return [];
|
|
2926
2938
|
try {
|
|
@@ -3281,13 +3293,15 @@ async function* codexProvider(opts) {
|
|
|
3281
3293
|
resume: Boolean(opts.sessionId),
|
|
3282
3294
|
mcpServerCount: Object.keys(codexMcpServers).length
|
|
3283
3295
|
}, "codexProvider: starting turn");
|
|
3296
|
+
const hostedCodexHome = hostedCodexHomePath();
|
|
3297
|
+
const inheritedCodexHome = process.env.CODEX_HOME || join5(homedir2(), ".codex");
|
|
3298
|
+
const codexEnvironment = scopedBrowserCapability || resolve5(hostedCodexHome) !== resolve5(inheritedCodexHome) ? {
|
|
3299
|
+
...Object.fromEntries(Object.entries(process.env).filter((entry) => typeof entry[1] === "string")),
|
|
3300
|
+
CODEX_HOME: hostedCodexHome,
|
|
3301
|
+
...scopedBrowserCapability ? { [CODEX_BROWSER_CAPABILITY_ENV]: scopedBrowserCapability } : {}
|
|
3302
|
+
} : undefined;
|
|
3284
3303
|
const codex = new Codex({
|
|
3285
|
-
...
|
|
3286
|
-
env: {
|
|
3287
|
-
...Object.fromEntries(Object.entries(process.env).filter((entry) => typeof entry[1] === "string")),
|
|
3288
|
-
[CODEX_BROWSER_CAPABILITY_ENV]: scopedBrowserCapability
|
|
3289
|
-
}
|
|
3290
|
-
} : {},
|
|
3304
|
+
...codexEnvironment ? { env: codexEnvironment } : {},
|
|
3291
3305
|
config: {
|
|
3292
3306
|
features: { multi_agent: false, multi_agent_v2: false, enable_fanout: false },
|
|
3293
3307
|
model_catalog_json: codexModelCatalogPath,
|
|
@@ -3686,14 +3700,14 @@ function maestroProvider(opts) {
|
|
|
3686
3700
|
// ../../packages/core/src/agents/claude-runtime-inspection.ts
|
|
3687
3701
|
import { readFileSync as readFileSync7 } from "fs";
|
|
3688
3702
|
import { createRequire as createRequire3 } from "module";
|
|
3689
|
-
import { dirname as
|
|
3703
|
+
import { dirname as dirname7, join as join6 } from "path";
|
|
3690
3704
|
var cached;
|
|
3691
3705
|
function inspectBundledClaudeRuntime() {
|
|
3692
3706
|
if (cached)
|
|
3693
3707
|
return cached;
|
|
3694
3708
|
try {
|
|
3695
3709
|
const require2 = createRequire3(import.meta.url);
|
|
3696
|
-
const sdkDir =
|
|
3710
|
+
const sdkDir = dirname7(require2.resolve("@anthropic-ai/claude-agent-sdk"));
|
|
3697
3711
|
const sdkPackage = JSON.parse(readFileSync7(join6(sdkDir, "package.json"), "utf8"));
|
|
3698
3712
|
const manifest = JSON.parse(readFileSync7(join6(sdkDir, "manifest.json"), "utf8"));
|
|
3699
3713
|
const sdkVersion = typeof sdkPackage.version === "string" ? sdkPackage.version : "";
|
|
@@ -3768,4 +3782,4 @@ export {
|
|
|
3768
3782
|
buildClaudeDisallowedTools
|
|
3769
3783
|
};
|
|
3770
3784
|
|
|
3771
|
-
//# debugId=
|
|
3785
|
+
//# debugId=03F870923DEBEFF364756E2164756E21
|