negotium 0.22.4 → 0.22.6
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 +408 -1301
- package/dist/agent-helpers.js.map +6 -6
- package/dist/background-bash.js +12 -12
- package/dist/background-bash.js.map +2 -2
- package/dist/browser-runtime.js +42 -44
- package/dist/browser-runtime.js.map +2 -2
- package/dist/canonical-mcp-bridge.js +8 -9
- package/dist/canonical-mcp-bridge.js.map +1 -1
- package/dist/{chunk-y4tyc603.js → chunk-1e0nxy7p.js} +13 -13
- package/dist/chunk-1e0nxy7p.js.map +10 -0
- package/dist/{chunk-9zn0bkc9.js → chunk-1mba9m1j.js} +77 -116
- package/dist/{chunk-9zn0bkc9.js.map → chunk-1mba9m1j.js.map} +2 -2
- package/dist/{chunk-rwj7x5pg.js → chunk-9a50csg6.js} +123 -121
- package/dist/{chunk-rwj7x5pg.js.map → chunk-9a50csg6.js.map} +7 -7
- package/dist/chunk-bnyvxss3.js +77 -0
- package/dist/{chunk-q5djsg78.js.map → chunk-bnyvxss3.js.map} +1 -1
- package/dist/{chunk-0jtan6fd.js → chunk-e59kzyvy.js} +4 -5
- package/dist/{chunk-0jtan6fd.js.map → chunk-e59kzyvy.js.map} +2 -2
- package/dist/{chunk-f7p0h1gs.js → chunk-ww8a4ej4.js} +5 -5
- package/dist/{chunk-f7p0h1gs.js.map → chunk-ww8a4ej4.js.map} +2 -2
- package/dist/hosted-agent.js +127 -124
- package/dist/hosted-agent.js.map +4 -4
- package/dist/main.js +3327 -5138
- package/dist/main.js.map +10 -10
- package/dist/mcp-catalog.js +4 -4
- package/dist/mcp-catalog.js.map +1 -1
- package/dist/mcp-factories.js +630 -1515
- package/dist/mcp-factories.js.map +6 -6
- package/dist/mcp-servers.js +5 -5
- package/dist/mcp-servers.js.map +1 -1
- package/dist/media.js +3 -3
- package/dist/media.js.map +1 -1
- package/dist/outbox.js +15 -15
- package/dist/outbox.js.map +2 -2
- package/dist/platform-runtime.js +7 -7
- package/dist/platform-runtime.js.map +1 -1
- package/dist/prompts.js +6 -6
- package/dist/prompts.js.map +2 -2
- package/dist/query-runtime.js +16 -18
- package/dist/query-runtime.js.map +2 -2
- package/dist/registry.js +19 -20
- package/dist/registry.js.map +2 -2
- package/dist/rollout.js +41 -41
- package/dist/rollout.js.map +2 -2
- package/dist/runtime/src/agents/rollout/claude.ts +6 -1
- package/dist/runtime/src/application/submit-runtime-gateway-turn.ts +6 -4
- package/dist/runtime/src/node-host.ts +1 -0
- package/dist/runtime/src/platform/mcp-config.ts +60 -28
- package/dist/runtime/src/runtime/turn-runner.ts +9 -4
- package/dist/runtime/src/topics/update.ts +20 -0
- package/dist/runtime/src/version.ts +1 -1
- package/dist/runtime-gateway.js +12 -12
- package/dist/runtime-gateway.js.map +2 -2
- package/dist/runtime-helpers.js +52 -54
- package/dist/runtime-helpers.js.map +2 -2
- package/dist/sqlite.js +3 -5
- package/dist/sqlite.js.map +2 -2
- package/dist/storage.js +4831 -4802
- package/dist/storage.js.map +2 -2
- package/dist/types/packages/core/src/agents/rollout/claude.d.ts +5 -0
- package/dist/types/packages/core/src/platform/mcp-config.d.ts +8 -0
- package/dist/types/packages/core/src/runtime/turn-runner.d.ts +6 -2
- package/dist/types/packages/core/src/version.d.ts +1 -1
- package/dist/vault.js +20 -22
- package/dist/vault.js.map +2 -2
- package/package.json +1 -1
- package/dist/chunk-2mx7fq49.js +0 -6
- package/dist/chunk-2mx7fq49.js.map +0 -9
- package/dist/chunk-q5djsg78.js +0 -200
- package/dist/chunk-y4tyc603.js.map +0 -10
package/dist/hosted-agent.js
CHANGED
|
@@ -1,51 +1,48 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
-
canonicalMcpBridgeEnv,
|
|
4
|
-
revokeCanonicalMcpBridgeTurn
|
|
5
|
-
} from "./chunk-f7p0h1gs.js";
|
|
6
|
-
import {
|
|
7
|
-
AGENT_HEALTH_SERVER,
|
|
8
|
-
BASHRS_SPILL_ROOT,
|
|
9
|
-
BASH_RS_BIN,
|
|
10
|
-
BASH_RS_VERSION,
|
|
11
|
-
BG_BASH_BASE_PORT,
|
|
12
|
-
BG_BASH_MAX_PORT,
|
|
13
|
-
CANONICAL_MCP_PROXY_SERVER,
|
|
14
|
-
CLAUDE_EFFORT_VALUES,
|
|
15
|
-
CLAUDE_EXECUTABLE,
|
|
16
|
-
DECISION_SERVER,
|
|
17
|
-
DM_WORKSPACE_DIR,
|
|
18
|
-
FALLBACK_AGENT,
|
|
19
|
-
FILE_TAG_REGEX,
|
|
20
|
-
MODEL_FABLE,
|
|
21
|
-
MODEL_OPUS,
|
|
22
|
-
MODEL_SONNET,
|
|
23
|
-
NEGOTIUM_PORT,
|
|
24
|
-
PROJECT_ROOT,
|
|
25
|
-
RUNTIME_MCP_SECRET,
|
|
26
|
-
RUN_DIR,
|
|
27
|
-
SESSION_COMM_SERVER,
|
|
28
|
-
SESSION_WORKSPACE_DIR,
|
|
29
3
|
SUPPORTED_AGENTS,
|
|
30
|
-
|
|
31
|
-
TASK_SERVER,
|
|
32
|
-
TOKEN_STATS_SERVER,
|
|
33
|
-
TOPIC_WORKSPACE_DIR,
|
|
34
|
-
TSCONFIG_PATH,
|
|
35
|
-
TSX_LOADER,
|
|
36
|
-
VAULT_MASTER_KEY,
|
|
37
|
-
VAULT_SERVER,
|
|
38
|
-
WIKI_SERVER,
|
|
39
|
-
WORKSPACE_DIR,
|
|
40
|
-
codexAuthFilePath,
|
|
41
|
-
envText,
|
|
42
|
-
logger,
|
|
4
|
+
CLAUDE_EFFORT_VALUES,
|
|
43
5
|
resolveFallbackAgent,
|
|
44
|
-
|
|
45
|
-
|
|
6
|
+
logger,
|
|
7
|
+
envText2,
|
|
8
|
+
PROJECT_ROOT2,
|
|
9
|
+
WORKSPACE_DIR2,
|
|
10
|
+
TOPIC_WORKSPACE_DIR2,
|
|
11
|
+
DM_WORKSPACE_DIR2,
|
|
12
|
+
SESSION_WORKSPACE_DIR2,
|
|
13
|
+
CLAUDE_EXECUTABLE2,
|
|
14
|
+
BASH_RS_VERSION2,
|
|
15
|
+
BASH_RS_BIN2,
|
|
16
|
+
TSX_LOADER2,
|
|
17
|
+
TSCONFIG_PATH2,
|
|
18
|
+
SESSION_COMM_SERVER2,
|
|
19
|
+
TASK_SERVER2,
|
|
20
|
+
DECISION_SERVER2,
|
|
21
|
+
CANONICAL_MCP_PROXY_SERVER2,
|
|
22
|
+
WIKI_SERVER2,
|
|
23
|
+
TOKEN_STATS_SERVER2,
|
|
24
|
+
SYSTEM_HEALTH_SERVER2,
|
|
25
|
+
AGENT_HEALTH_SERVER2,
|
|
26
|
+
VAULT_SERVER2,
|
|
27
|
+
BG_BASH_BASE_PORT2,
|
|
28
|
+
BG_BASH_MAX_PORT2,
|
|
29
|
+
resolveTopicWorkspaceDir2,
|
|
30
|
+
RUNTIME_MCP_SECRET2,
|
|
31
|
+
VAULT_MASTER_KEY2,
|
|
32
|
+
NEGOTIUM_PORT2,
|
|
33
|
+
RUN_DIR2,
|
|
34
|
+
BASHRS_SPILL_ROOT2,
|
|
35
|
+
FILE_TAG_REGEX2,
|
|
36
|
+
MODEL_SONNET2,
|
|
37
|
+
MODEL_OPUS2,
|
|
38
|
+
MODEL_FABLE2,
|
|
39
|
+
FALLBACK_AGENT2,
|
|
40
|
+
codexAuthFilePath2
|
|
41
|
+
} from "./chunk-1mba9m1j.js";
|
|
46
42
|
import {
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
canonicalMcpBridgeEnv2,
|
|
44
|
+
revokeCanonicalMcpBridgeTurn2
|
|
45
|
+
} from "./chunk-ww8a4ej4.js";
|
|
49
46
|
|
|
50
47
|
// ../../packages/core/src/agents/claude-provider.ts
|
|
51
48
|
import { spawn as spawn2 } from "child_process";
|
|
@@ -63,12 +60,12 @@ function toDisplayPath(filePath) {
|
|
|
63
60
|
|
|
64
61
|
// ../../packages/core/src/agents/rollout/shared.ts
|
|
65
62
|
var trustedWorkspaceRoots = [
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
63
|
+
WORKSPACE_DIR2,
|
|
64
|
+
DM_WORKSPACE_DIR2,
|
|
65
|
+
SESSION_WORKSPACE_DIR2,
|
|
66
|
+
TOPIC_WORKSPACE_DIR2
|
|
70
67
|
].map((root) => resolve2(root));
|
|
71
|
-
var FIXTURES_DIR = resolve2(
|
|
68
|
+
var FIXTURES_DIR = resolve2(PROJECT_ROOT2, "src", "agents", "fixtures");
|
|
72
69
|
|
|
73
70
|
// ../../packages/core/src/platform/jsonl.ts
|
|
74
71
|
import {
|
|
@@ -154,9 +151,9 @@ function fsyncDirectoryBestEffort(dir) {
|
|
|
154
151
|
|
|
155
152
|
// ../../packages/core/src/agents/claude-registry.ts
|
|
156
153
|
var ALIAS_MAP = {
|
|
157
|
-
sonnet:
|
|
158
|
-
opus:
|
|
159
|
-
fable:
|
|
154
|
+
sonnet: MODEL_SONNET2,
|
|
155
|
+
opus: MODEL_OPUS2,
|
|
156
|
+
fable: MODEL_FABLE2
|
|
160
157
|
};
|
|
161
158
|
var VALID_ALIASES = new Set(Object.keys(ALIAS_MAP));
|
|
162
159
|
var VALID_EFFORTS = new Set(CLAUDE_EFFORT_VALUES);
|
|
@@ -523,12 +520,12 @@ class McpUrlBudgetExceededError extends Error {
|
|
|
523
520
|
this.name = "McpUrlBudgetExceededError";
|
|
524
521
|
}
|
|
525
522
|
}
|
|
526
|
-
var runtimePort =
|
|
523
|
+
var runtimePort = NEGOTIUM_PORT2;
|
|
527
524
|
function encodeTokenPart(value) {
|
|
528
525
|
return Buffer.from(JSON.stringify(value), "utf-8").toString("base64url");
|
|
529
526
|
}
|
|
530
527
|
function signTokenPayload(payloadPart) {
|
|
531
|
-
return createHmac("sha256",
|
|
528
|
+
return createHmac("sha256", RUNTIME_MCP_SECRET2).update(payloadPart).digest("base64url");
|
|
532
529
|
}
|
|
533
530
|
function issueRuntimeMcpToken(ctx) {
|
|
534
531
|
const payloadPart = encodeTokenPart({
|
|
@@ -680,9 +677,9 @@ function createBackgroundBashManager(options = {}) {
|
|
|
680
677
|
const knownContexts = new Map;
|
|
681
678
|
const runtimeCapability = options.capability ?? randomBytes(32).toString("hex");
|
|
682
679
|
const runtimeServerId = options.serverId ?? randomBytes(16).toString("hex");
|
|
683
|
-
const bashRsBin = options.bashRsBin ??
|
|
684
|
-
const basePort = options.basePort ??
|
|
685
|
-
const maxPort = options.maxPort ??
|
|
680
|
+
const bashRsBin = options.bashRsBin ?? BASH_RS_BIN2;
|
|
681
|
+
const basePort = options.basePort ?? BG_BASH_BASE_PORT2;
|
|
682
|
+
const maxPort = options.maxPort ?? BG_BASH_MAX_PORT2;
|
|
686
683
|
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
687
684
|
const now = options.now ?? Date.now;
|
|
688
685
|
const wait = options.delay ?? delay;
|
|
@@ -739,7 +736,7 @@ function createBackgroundBashManager(options = {}) {
|
|
|
739
736
|
}
|
|
740
737
|
async function spawnServer(key, reservedPort, excludedPorts = new Set) {
|
|
741
738
|
if (!bashRsBin) {
|
|
742
|
-
throw new Error(`background-bash requires the bash-rs ${
|
|
739
|
+
throw new Error(`background-bash requires the bash-rs ${BASH_RS_VERSION2} binary; run install-bash-rs.mjs (or set NEGOTIUM_BASH_RS_BIN)`);
|
|
743
740
|
}
|
|
744
741
|
const port = reservedPort ?? await allocatePort(excludedPorts);
|
|
745
742
|
const process2 = spawnImpl(bashRsBin, [String(port)], {
|
|
@@ -752,7 +749,7 @@ function createBackgroundBashManager(options = {}) {
|
|
|
752
749
|
NEGOTIUM_BG_BASH_SERVER_ID: runtimeServerId,
|
|
753
750
|
BASHRS_HTTP_CAPABILITY: runtimeCapability,
|
|
754
751
|
BASHRS_INSTANCE_ID: runtimeServerId,
|
|
755
|
-
BASHRS_SPILL_ROOT
|
|
752
|
+
BASHRS_SPILL_ROOT: BASHRS_SPILL_ROOT2
|
|
756
753
|
}
|
|
757
754
|
});
|
|
758
755
|
process2.once("error", (error) => {
|
|
@@ -839,12 +836,12 @@ function createBackgroundBashManager(options = {}) {
|
|
|
839
836
|
usedPorts.clear();
|
|
840
837
|
knownContexts.clear();
|
|
841
838
|
const deadline = now() + 3000;
|
|
842
|
-
await Promise.all(entries.map((instance) => new Promise((
|
|
839
|
+
await Promise.all(entries.map((instance) => new Promise((resolve) => {
|
|
843
840
|
if (instance.process.exitCode !== null || instance.process.killed)
|
|
844
|
-
return
|
|
845
|
-
instance.process.once("exit",
|
|
846
|
-
instance.process.once("error",
|
|
847
|
-
const timer = setTimeout(
|
|
841
|
+
return resolve();
|
|
842
|
+
instance.process.once("exit", resolve);
|
|
843
|
+
instance.process.once("error", resolve);
|
|
844
|
+
const timer = setTimeout(resolve, Math.max(0, deadline - now()));
|
|
848
845
|
timer.unref?.();
|
|
849
846
|
})));
|
|
850
847
|
}
|
|
@@ -1276,7 +1273,7 @@ var SCHEMA_TRIGGERS = {
|
|
|
1276
1273
|
};
|
|
1277
1274
|
var OTIUM_TOPIC_SCOPE_IMMUTABLE_ERROR = "otium_topic_scope_immutable";
|
|
1278
1275
|
function topicLinkSchemaIsCurrent(database, nodeId) {
|
|
1279
|
-
const objects = new Map(database.query("SELECT name, sql FROM sqlite_master WHERE type IN ('table','index','trigger')").all().map((
|
|
1276
|
+
const objects = new Map(database.query("SELECT name, sql FROM sqlite_master WHERE type IN ('table','index','trigger')").all().map((row) => [row.name, row.sql ?? ""]));
|
|
1280
1277
|
for (const name of [...SCHEMA_TABLES, ...SCHEMA_INDEXES, ...SCHEMA_INDEXES_TOMBSTONES]) {
|
|
1281
1278
|
if (!objects.has(name))
|
|
1282
1279
|
return false;
|
|
@@ -1293,7 +1290,7 @@ function topicLinkSchemaIsCurrent(database, nodeId) {
|
|
|
1293
1290
|
return false;
|
|
1294
1291
|
}
|
|
1295
1292
|
const identity = database.query("SELECT node_id, epoch_id FROM api_node_identity WHERE singleton = 1").all();
|
|
1296
|
-
if (identity.some((
|
|
1293
|
+
if (identity.some((row) => row.epoch_id === null))
|
|
1297
1294
|
return false;
|
|
1298
1295
|
if (nodeId && identity[0]?.node_id !== nodeId)
|
|
1299
1296
|
return false;
|
|
@@ -2112,8 +2109,8 @@ function buildStdioMcpServer(agent, serverFile, serverArgs, env) {
|
|
|
2112
2109
|
if (agent === "codex") {
|
|
2113
2110
|
return {
|
|
2114
2111
|
command: "node",
|
|
2115
|
-
args: ["--import",
|
|
2116
|
-
env: { TSX_TSCONFIG_PATH:
|
|
2112
|
+
args: ["--import", TSX_LOADER2, serverFile, ...serverArgs],
|
|
2113
|
+
env: { TSX_TSCONFIG_PATH: TSCONFIG_PATH2, ...env }
|
|
2117
2114
|
};
|
|
2118
2115
|
}
|
|
2119
2116
|
return {
|
|
@@ -2123,12 +2120,12 @@ function buildStdioMcpServer(agent, serverFile, serverArgs, env) {
|
|
|
2123
2120
|
};
|
|
2124
2121
|
}
|
|
2125
2122
|
function useHostedBuiltinMcp() {
|
|
2126
|
-
return
|
|
2123
|
+
return envText2("NEGOTIUM_BUILTIN_MCP_TRANSPORT") !== "stdio";
|
|
2127
2124
|
}
|
|
2128
2125
|
function buildBuiltinMcpServer(surface, ctx, stdio) {
|
|
2129
2126
|
if (!useHostedBuiltinMcp())
|
|
2130
2127
|
return stdio();
|
|
2131
|
-
const agent = ctx.agent ??
|
|
2128
|
+
const agent = ctx.agent ?? FALLBACK_AGENT2;
|
|
2132
2129
|
return buildHostedMcpSpec(agent, surface, {
|
|
2133
2130
|
userId: ctx.userId,
|
|
2134
2131
|
...ctx.actorUserId ? { actorUserId: ctx.actorUserId } : {},
|
|
@@ -2140,7 +2137,7 @@ function buildBuiltinMcpServer(surface, ctx, stdio) {
|
|
|
2140
2137
|
...ctx.wikiTopicId ? { wikiTopicId: ctx.wikiTopicId } : {},
|
|
2141
2138
|
...ctx.subagentParentTopicId ? { subagentParentTopicId: ctx.subagentParentTopicId } : {},
|
|
2142
2139
|
...ctx.threadRootId ? { threadRootId: ctx.threadRootId } : {},
|
|
2143
|
-
cwd: ctx.cwd ?? (ctx.topicId ?
|
|
2140
|
+
cwd: ctx.cwd ?? (ctx.topicId ? resolveTopicWorkspaceDir2(ctx.topicId) : process.cwd()),
|
|
2144
2141
|
agent,
|
|
2145
2142
|
...ctx.model ? { model: ctx.model } : {},
|
|
2146
2143
|
...ctx.depth !== undefined ? { depth: ctx.depth } : {},
|
|
@@ -2253,7 +2250,7 @@ var MCP_CATALOG = {
|
|
|
2253
2250
|
topicId,
|
|
2254
2251
|
topicTitle: session,
|
|
2255
2252
|
queryId,
|
|
2256
|
-
cwd: cwd ??
|
|
2253
|
+
cwd: cwd ?? resolveTopicWorkspaceDir2(topicId),
|
|
2257
2254
|
agent,
|
|
2258
2255
|
model,
|
|
2259
2256
|
...switchTargets.length ? { explicitAgentSwitchTargets: switchTargets } : {},
|
|
@@ -2268,7 +2265,7 @@ var MCP_CATALOG = {
|
|
|
2268
2265
|
"token-stats": {
|
|
2269
2266
|
...commonRuntimeMcpPolicy("token-stats"),
|
|
2270
2267
|
build(ctx) {
|
|
2271
|
-
return buildBuiltinMcpServer("token-stats", ctx, () => buildStdioMcpServer(ctx.agent,
|
|
2268
|
+
return buildBuiltinMcpServer("token-stats", ctx, () => buildStdioMcpServer(ctx.agent, TOKEN_STATS_SERVER2, [`--user-id=${ctx.userId}`]));
|
|
2272
2269
|
}
|
|
2273
2270
|
},
|
|
2274
2271
|
task: {
|
|
@@ -2278,19 +2275,19 @@ var MCP_CATALOG = {
|
|
|
2278
2275
|
if (peerBridge) {
|
|
2279
2276
|
if (!topicId || !queryId)
|
|
2280
2277
|
return null;
|
|
2281
|
-
const env =
|
|
2278
|
+
const env = canonicalMcpBridgeEnv2({
|
|
2282
2279
|
surface: "task",
|
|
2283
2280
|
userId,
|
|
2284
2281
|
topicId,
|
|
2285
2282
|
queryId,
|
|
2286
2283
|
peerBridge
|
|
2287
2284
|
});
|
|
2288
|
-
return env ? buildStdioMcpServer(agent,
|
|
2285
|
+
return env ? buildStdioMcpServer(agent, CANONICAL_MCP_PROXY_SERVER2, ["--surface=task"], env) : null;
|
|
2289
2286
|
}
|
|
2290
2287
|
const args = [`--user-id=${userId}`, `--topic=${session}`];
|
|
2291
2288
|
if (topicId)
|
|
2292
2289
|
args.push(`--topic-id=${topicId}`);
|
|
2293
|
-
return buildBuiltinMcpServer("task", ctx, () => buildStdioMcpServer(agent,
|
|
2290
|
+
return buildBuiltinMcpServer("task", ctx, () => buildStdioMcpServer(agent, TASK_SERVER2, args));
|
|
2294
2291
|
}
|
|
2295
2292
|
},
|
|
2296
2293
|
decision: {
|
|
@@ -2300,25 +2297,25 @@ var MCP_CATALOG = {
|
|
|
2300
2297
|
if (peerBridge) {
|
|
2301
2298
|
if (!topicId || !queryId)
|
|
2302
2299
|
return null;
|
|
2303
|
-
const env =
|
|
2300
|
+
const env = canonicalMcpBridgeEnv2({
|
|
2304
2301
|
surface: "decision",
|
|
2305
2302
|
userId,
|
|
2306
2303
|
topicId,
|
|
2307
2304
|
queryId,
|
|
2308
2305
|
peerBridge
|
|
2309
2306
|
});
|
|
2310
|
-
return env ? buildStdioMcpServer(agent,
|
|
2307
|
+
return env ? buildStdioMcpServer(agent, CANONICAL_MCP_PROXY_SERVER2, ["--surface=decision"], env) : null;
|
|
2311
2308
|
}
|
|
2312
2309
|
const args = [
|
|
2313
2310
|
`--user-id=${userId}`,
|
|
2314
2311
|
`--topic=${session}`,
|
|
2315
|
-
`--agent=${agent ??
|
|
2312
|
+
`--agent=${agent ?? FALLBACK_AGENT2}`
|
|
2316
2313
|
];
|
|
2317
2314
|
if (topicId)
|
|
2318
2315
|
args.push(`--topic-id=${topicId}`);
|
|
2319
2316
|
if (model)
|
|
2320
2317
|
args.push(`--model=${model}`);
|
|
2321
|
-
return buildBuiltinMcpServer("decision", ctx, () => buildStdioMcpServer(agent,
|
|
2318
|
+
return buildBuiltinMcpServer("decision", ctx, () => buildStdioMcpServer(agent, DECISION_SERVER2, args));
|
|
2322
2319
|
}
|
|
2323
2320
|
},
|
|
2324
2321
|
"session-comm": {
|
|
@@ -2338,7 +2335,7 @@ var MCP_CATALOG = {
|
|
|
2338
2335
|
threadRootId,
|
|
2339
2336
|
peerBridge
|
|
2340
2337
|
} = ctx;
|
|
2341
|
-
const effectiveAgent = agent ??
|
|
2338
|
+
const effectiveAgent = agent ?? FALLBACK_AGENT2;
|
|
2342
2339
|
const cronSessionId = topicId ? getRegisteredCronSession(topicId, effectiveAgent)?.sessionId : undefined;
|
|
2343
2340
|
const args = [
|
|
2344
2341
|
`--user-id=${userId}`,
|
|
@@ -2358,7 +2355,7 @@ var MCP_CATALOG = {
|
|
|
2358
2355
|
...threadRootId ? [`--thread-root-id=${threadRootId}`] : [],
|
|
2359
2356
|
...peerBridge ? [`--peer-host-query-id=${peerBridge.hostQueryId}`] : []
|
|
2360
2357
|
];
|
|
2361
|
-
return buildBuiltinMcpServer("session-comm", ctx, () => buildStdioMcpServer(effectiveAgent,
|
|
2358
|
+
return buildBuiltinMcpServer("session-comm", ctx, () => buildStdioMcpServer(effectiveAgent, SESSION_COMM_SERVER2, args, peerBridge ? peerSessionBridgeIpcEnv() : undefined));
|
|
2362
2359
|
}
|
|
2363
2360
|
},
|
|
2364
2361
|
wiki: {
|
|
@@ -2368,14 +2365,14 @@ var MCP_CATALOG = {
|
|
|
2368
2365
|
if (peerBridge) {
|
|
2369
2366
|
if (!topicId || !queryId)
|
|
2370
2367
|
return null;
|
|
2371
|
-
const env =
|
|
2368
|
+
const env = canonicalMcpBridgeEnv2({
|
|
2372
2369
|
surface: "wiki",
|
|
2373
2370
|
userId,
|
|
2374
2371
|
topicId,
|
|
2375
2372
|
queryId,
|
|
2376
2373
|
peerBridge
|
|
2377
2374
|
});
|
|
2378
|
-
return env ? buildStdioMcpServer(agent,
|
|
2375
|
+
return env ? buildStdioMcpServer(agent, CANONICAL_MCP_PROXY_SERVER2, ["--surface=wiki"], env) : null;
|
|
2379
2376
|
}
|
|
2380
2377
|
const args = [`--user-id=${userId}`];
|
|
2381
2378
|
if (topicId)
|
|
@@ -2384,7 +2381,7 @@ var MCP_CATALOG = {
|
|
|
2384
2381
|
if (resolvedWikiTopicId)
|
|
2385
2382
|
args.push(`--topic-id=${resolvedWikiTopicId}`);
|
|
2386
2383
|
args.push("--surface=wiki");
|
|
2387
|
-
return buildBuiltinMcpServer("wiki", { ...ctx, wikiTopicId: resolvedWikiTopicId }, () => buildStdioMcpServer(agent,
|
|
2384
|
+
return buildBuiltinMcpServer("wiki", { ...ctx, wikiTopicId: resolvedWikiTopicId }, () => buildStdioMcpServer(agent, WIKI_SERVER2, args));
|
|
2388
2385
|
}
|
|
2389
2386
|
},
|
|
2390
2387
|
skills: {
|
|
@@ -2394,13 +2391,13 @@ var MCP_CATALOG = {
|
|
|
2394
2391
|
const args = [`--user-id=${userId}`, "--surface=skills"];
|
|
2395
2392
|
if (topicId)
|
|
2396
2393
|
args.push(`--topic-id=${topicId}`);
|
|
2397
|
-
return buildBuiltinMcpServer("skills", ctx, () => buildStdioMcpServer(agent,
|
|
2394
|
+
return buildBuiltinMcpServer("skills", ctx, () => buildStdioMcpServer(agent, WIKI_SERVER2, args));
|
|
2398
2395
|
}
|
|
2399
2396
|
},
|
|
2400
2397
|
"system-health": {
|
|
2401
2398
|
...commonRuntimeMcpPolicy("system-health"),
|
|
2402
2399
|
build(ctx) {
|
|
2403
|
-
return buildBuiltinMcpServer("system-health", ctx, () => buildStdioMcpServer(ctx.agent,
|
|
2400
|
+
return buildBuiltinMcpServer("system-health", ctx, () => buildStdioMcpServer(ctx.agent, SYSTEM_HEALTH_SERVER2, []));
|
|
2404
2401
|
}
|
|
2405
2402
|
},
|
|
2406
2403
|
"background-bash": {
|
|
@@ -2416,7 +2413,7 @@ var MCP_CATALOG = {
|
|
|
2416
2413
|
build(ctx) {
|
|
2417
2414
|
const { userId, agent } = ctx;
|
|
2418
2415
|
const args = [`--user-id=${userId}`];
|
|
2419
|
-
return buildBuiltinMcpServer("agent-health", ctx, () => buildStdioMcpServer(agent,
|
|
2416
|
+
return buildBuiltinMcpServer("agent-health", ctx, () => buildStdioMcpServer(agent, AGENT_HEALTH_SERVER2, args));
|
|
2420
2417
|
}
|
|
2421
2418
|
},
|
|
2422
2419
|
vault: {
|
|
@@ -2426,7 +2423,7 @@ var MCP_CATALOG = {
|
|
|
2426
2423
|
const args = [`--user-id=${vaultUserId ?? userId}`];
|
|
2427
2424
|
if (agent !== "codex")
|
|
2428
2425
|
args.push("--list-only=true");
|
|
2429
|
-
return buildBuiltinMcpServer("vault", { ...ctx, userId: vaultUserId ?? userId }, () => buildStdioMcpServer(agent,
|
|
2426
|
+
return buildBuiltinMcpServer("vault", { ...ctx, userId: vaultUserId ?? userId }, () => buildStdioMcpServer(agent, VAULT_SERVER2, args));
|
|
2430
2427
|
}
|
|
2431
2428
|
},
|
|
2432
2429
|
"cua-rs": {
|
|
@@ -2455,6 +2452,12 @@ refreshForumCatalogViews();
|
|
|
2455
2452
|
function isReservedRuntimeMcpServerName(name) {
|
|
2456
2453
|
return Object.hasOwn(MCP_CATALOG, name) || nodeMcpEntries.some((entry) => entry.key === name);
|
|
2457
2454
|
}
|
|
2455
|
+
var MANAGER_ONLY_HOST_MCP_NAMES = new Set(["topic-admin"]);
|
|
2456
|
+
function withoutManagerOnlyHostMcpServers(hostMcpServers) {
|
|
2457
|
+
if (!hostMcpServers)
|
|
2458
|
+
return;
|
|
2459
|
+
return Object.fromEntries(Object.entries(hostMcpServers).filter(([name]) => !MANAGER_ONLY_HOST_MCP_NAMES.has(name)));
|
|
2460
|
+
}
|
|
2458
2461
|
function mergeHostMcpServers(base, hostMcpServers) {
|
|
2459
2462
|
if (!hostMcpServers)
|
|
2460
2463
|
return base;
|
|
@@ -2682,7 +2685,7 @@ function getMcpServersForQuery(opts) {
|
|
|
2682
2685
|
fileDeliveryTools: opts.fileDeliveryTools
|
|
2683
2686
|
}), opts.hostMcpServers), opts.topicId);
|
|
2684
2687
|
}
|
|
2685
|
-
return hideProviderIntrospectionForOtium(getForumMcpServers({
|
|
2688
|
+
return hideProviderIntrospectionForOtium(mergeHostMcpServers(getForumMcpServers({
|
|
2686
2689
|
userId: opts.userId || "local",
|
|
2687
2690
|
actorUserId: opts.actorUserId,
|
|
2688
2691
|
actorTopicScope: opts.actorTopicScope,
|
|
@@ -2709,7 +2712,7 @@ function getMcpServersForQuery(opts) {
|
|
|
2709
2712
|
extra: opts.mcpExtra,
|
|
2710
2713
|
silent: opts.silent,
|
|
2711
2714
|
peerBridge: opts.peerBridge
|
|
2712
|
-
}), opts.topicId);
|
|
2715
|
+
}), withoutManagerOnlyHostMcpServers(opts.hostMcpServers)), opts.topicId);
|
|
2713
2716
|
}
|
|
2714
2717
|
function hideProviderIntrospectionForOtium(servers, topicId) {
|
|
2715
2718
|
if (!topicId || getTopic(topicId)?.surface !== "otium")
|
|
@@ -2769,16 +2772,16 @@ function decryptVaultValueWithKey(userId, key, storedValue, masterKey) {
|
|
|
2769
2772
|
}
|
|
2770
2773
|
|
|
2771
2774
|
// ../../packages/core/src/storage/vault-crypto.ts
|
|
2772
|
-
function encryptVaultValue(userId, key, value, masterKey =
|
|
2775
|
+
function encryptVaultValue(userId, key, value, masterKey = VAULT_MASTER_KEY2) {
|
|
2773
2776
|
return encryptVaultValueWithKey(userId, key, value, masterKey);
|
|
2774
2777
|
}
|
|
2775
|
-
function decryptVaultValue(userId, key, storedValue, masterKey =
|
|
2778
|
+
function decryptVaultValue(userId, key, storedValue, masterKey = VAULT_MASTER_KEY2) {
|
|
2776
2779
|
return decryptVaultValueWithKey(userId, key, storedValue, masterKey);
|
|
2777
2780
|
}
|
|
2778
2781
|
|
|
2779
2782
|
// ../../packages/core/src/storage/vault.ts
|
|
2780
2783
|
var vaultDb;
|
|
2781
|
-
var vaultMasterKey =
|
|
2784
|
+
var vaultMasterKey = VAULT_MASTER_KEY2;
|
|
2782
2785
|
function initializeVaultDatabase(database) {
|
|
2783
2786
|
database.exec("PRAGMA journal_mode = WAL");
|
|
2784
2787
|
database.exec("PRAGMA busy_timeout = 5000");
|
|
@@ -2918,8 +2921,8 @@ var defaultHost = {
|
|
|
2918
2921
|
redactVaultSecrets,
|
|
2919
2922
|
substituteVaultSecrets: (userId, value) => vaultSubstituteDetailed(userId, value).text,
|
|
2920
2923
|
referencesRuntimeSecretStorage,
|
|
2921
|
-
claudeCodeExecutablePath: () =>
|
|
2922
|
-
codexAuthFilePath
|
|
2924
|
+
claudeCodeExecutablePath: () => CLAUDE_EXECUTABLE2,
|
|
2925
|
+
codexAuthFilePath: codexAuthFilePath2
|
|
2923
2926
|
};
|
|
2924
2927
|
var hostRegistrations = [];
|
|
2925
2928
|
var scopedHost = new AsyncLocalStorage;
|
|
@@ -2984,7 +2987,7 @@ function hostedCodexHomePath() {
|
|
|
2984
2987
|
|
|
2985
2988
|
// ../../packages/core/src/media/file-events.ts
|
|
2986
2989
|
function* extractFileEvents(text, source) {
|
|
2987
|
-
const tagRegex = new RegExp(
|
|
2990
|
+
const tagRegex = new RegExp(FILE_TAG_REGEX2.source, "gi");
|
|
2988
2991
|
let match = tagRegex.exec(text);
|
|
2989
2992
|
while (match !== null) {
|
|
2990
2993
|
yield { type: "file", path: match[1], source, origin: "tag" };
|
|
@@ -3126,8 +3129,8 @@ var CLAUDE_ABORT_SIGKILL_DELAY_MS = 2500;
|
|
|
3126
3129
|
var claudeProcessExitListeners = new WeakMap;
|
|
3127
3130
|
function watchClaudeProcessExit(signal) {
|
|
3128
3131
|
let listener;
|
|
3129
|
-
const exited = new Promise((
|
|
3130
|
-
listener =
|
|
3132
|
+
const exited = new Promise((resolve) => {
|
|
3133
|
+
listener = resolve;
|
|
3131
3134
|
const listeners = claudeProcessExitListeners.get(signal) ?? new Set;
|
|
3132
3135
|
listeners.add(listener);
|
|
3133
3136
|
claudeProcessExitListeners.set(signal, listeners);
|
|
@@ -3584,7 +3587,7 @@ import { tmpdir } from "os";
|
|
|
3584
3587
|
import { dirname as dirname5, join as join3 } from "path";
|
|
3585
3588
|
|
|
3586
3589
|
// ../../packages/core/src/version.ts
|
|
3587
|
-
var NEGOTIUM_VERSION = "0.22.
|
|
3590
|
+
var NEGOTIUM_VERSION = "0.22.6";
|
|
3588
3591
|
|
|
3589
3592
|
// ../../packages/core/src/agents/codex-native-multi-agent.ts
|
|
3590
3593
|
var moduleRequire = createRequire(import.meta.url);
|
|
@@ -3652,7 +3655,7 @@ async function bootstrapCodexModelCache(codexHome, cachePath) {
|
|
|
3652
3655
|
stdio: ["pipe", "pipe", "pipe"],
|
|
3653
3656
|
windowsHide: true
|
|
3654
3657
|
});
|
|
3655
|
-
const refreshed = new Promise((
|
|
3658
|
+
const refreshed = new Promise((resolve, reject) => {
|
|
3656
3659
|
let settled = false;
|
|
3657
3660
|
let stdoutBuffer = "";
|
|
3658
3661
|
let stderr = "";
|
|
@@ -3671,7 +3674,7 @@ async function bootstrapCodexModelCache(codexHome, cachePath) {
|
|
|
3671
3674
|
else if (!existsSync2(cachePath))
|
|
3672
3675
|
reject(new Error("Codex did not create its model cache"));
|
|
3673
3676
|
else
|
|
3674
|
-
|
|
3677
|
+
resolve();
|
|
3675
3678
|
};
|
|
3676
3679
|
const send = (message) => {
|
|
3677
3680
|
child.stdin.write(`${JSON.stringify(message)}
|
|
@@ -3738,12 +3741,12 @@ var CODEX_BOOTSTRAP_EXIT_WAIT_MS = 3000;
|
|
|
3738
3741
|
function waitForChildExit(child, timeoutMs) {
|
|
3739
3742
|
if (child.exitCode !== null || child.signalCode !== null)
|
|
3740
3743
|
return Promise.resolve();
|
|
3741
|
-
return new Promise((
|
|
3742
|
-
const timer = setTimeout(
|
|
3744
|
+
return new Promise((resolve) => {
|
|
3745
|
+
const timer = setTimeout(resolve, timeoutMs);
|
|
3743
3746
|
timer.unref?.();
|
|
3744
3747
|
child.once("exit", () => {
|
|
3745
3748
|
clearTimeout(timer);
|
|
3746
|
-
|
|
3749
|
+
resolve();
|
|
3747
3750
|
});
|
|
3748
3751
|
});
|
|
3749
3752
|
}
|
|
@@ -3877,12 +3880,12 @@ function createCodexTreeManager(host, options = {}) {
|
|
|
3877
3880
|
const previous = spawnChain;
|
|
3878
3881
|
let release;
|
|
3879
3882
|
let released = false;
|
|
3880
|
-
spawnChain = new Promise((
|
|
3883
|
+
spawnChain = new Promise((resolve) => {
|
|
3881
3884
|
release = () => {
|
|
3882
3885
|
if (released)
|
|
3883
3886
|
return;
|
|
3884
3887
|
released = true;
|
|
3885
|
-
|
|
3888
|
+
resolve();
|
|
3886
3889
|
};
|
|
3887
3890
|
});
|
|
3888
3891
|
await previous;
|
|
@@ -3989,7 +3992,7 @@ function createCodexTreeManager(host, options = {}) {
|
|
|
3989
3992
|
return;
|
|
3990
3993
|
const deadline = Date.now() + Math.max(0, graceMs);
|
|
3991
3994
|
while (Date.now() < deadline && hasSurvivors(plan.targets)) {
|
|
3992
|
-
await new Promise((
|
|
3995
|
+
await new Promise((resolve) => setTimeout(resolve, Math.min(100, Math.max(1, deadline - Date.now()))));
|
|
3993
3996
|
}
|
|
3994
3997
|
killStragglers(plan);
|
|
3995
3998
|
}
|
|
@@ -4313,7 +4316,7 @@ async function createCodexVaultHookBridge(userId) {
|
|
|
4313
4316
|
});
|
|
4314
4317
|
restrictIpcEndpoint(socketPath);
|
|
4315
4318
|
if (IS_WINDOWS2) {
|
|
4316
|
-
const { BINARIES_DIR } = await import("./chunk-
|
|
4319
|
+
const { BINARIES_DIR } = await import("./chunk-bnyvxss3.js");
|
|
4317
4320
|
const cached = await ensureCodexWindowsWrapperExe(join5(BINARIES_DIR, "codex-hook-wrapper"));
|
|
4318
4321
|
await copyFile(cached, wrapperPath);
|
|
4319
4322
|
await writeFile2(join5(root, "codex-with-hooks.cfg"), [process.execPath, codexCliScriptPath(), socketPath, token].join(`
|
|
@@ -5052,9 +5055,9 @@ async function startStreamedWithTracking(thread, prompt, abortSignal, trackedPid
|
|
|
5052
5055
|
nextP.catch(() => {});
|
|
5053
5056
|
first = await Promise.race([nextP, startupTimeout]);
|
|
5054
5057
|
} catch (err) {
|
|
5055
|
-
const
|
|
5056
|
-
if (
|
|
5057
|
-
killCodexTrees(
|
|
5058
|
+
const novel = findNewCodexChildren(baseline);
|
|
5059
|
+
if (novel.length > 0) {
|
|
5060
|
+
killCodexTrees(novel);
|
|
5058
5061
|
}
|
|
5059
5062
|
await closeIterator(iter);
|
|
5060
5063
|
throw err;
|
|
@@ -5526,7 +5529,7 @@ function buildProviderOwnedToolBlockHook() {
|
|
|
5526
5529
|
}
|
|
5527
5530
|
};
|
|
5528
5531
|
}
|
|
5529
|
-
var MAESTRO_TOOL_OUTPUT_DIR = resolve8(
|
|
5532
|
+
var MAESTRO_TOOL_OUTPUT_DIR = resolve8(RUN_DIR2, "maestro-tool-outputs");
|
|
5530
5533
|
function buildMaestroToolResultTruncation(opts) {
|
|
5531
5534
|
if (opts.toolResultTruncation)
|
|
5532
5535
|
return opts.toolResultTruncation;
|
|
@@ -5620,7 +5623,7 @@ async function* runHostedAgent(input, host) {
|
|
|
5620
5623
|
}
|
|
5621
5624
|
} finally {
|
|
5622
5625
|
if (opts.userId && opts.topicId && opts.queryId && opts.peerBridge) {
|
|
5623
|
-
|
|
5626
|
+
revokeCanonicalMcpBridgeTurn2({
|
|
5624
5627
|
userId: opts.userId,
|
|
5625
5628
|
topicId: opts.topicId,
|
|
5626
5629
|
queryId: opts.queryId,
|
|
@@ -5630,17 +5633,17 @@ async function* runHostedAgent(input, host) {
|
|
|
5630
5633
|
}
|
|
5631
5634
|
}
|
|
5632
5635
|
export {
|
|
5633
|
-
|
|
5634
|
-
spawnClaudeCodeProcessWithTreeKill,
|
|
5635
|
-
runHostedAgent,
|
|
5636
|
-
maestroProvider,
|
|
5637
|
-
inspectBundledClaudeRuntime,
|
|
5638
|
-
configureAgentExecutionHost,
|
|
5639
|
-
codexProvider,
|
|
5640
|
-
claudeProvider,
|
|
5641
|
-
buildMaestroToolHooks,
|
|
5636
|
+
buildClaudeDisallowedTools,
|
|
5642
5637
|
buildMaestroDisallowedTools,
|
|
5643
|
-
|
|
5638
|
+
buildMaestroToolHooks,
|
|
5639
|
+
claudeProvider,
|
|
5640
|
+
codexProvider,
|
|
5641
|
+
configureAgentExecutionHost,
|
|
5642
|
+
inspectBundledClaudeRuntime,
|
|
5643
|
+
maestroProvider,
|
|
5644
|
+
runHostedAgent,
|
|
5645
|
+
spawnClaudeCodeProcessWithTreeKill,
|
|
5646
|
+
toCodexMcpServers
|
|
5644
5647
|
};
|
|
5645
5648
|
|
|
5646
|
-
//# debugId=
|
|
5649
|
+
//# debugId=BB59DA8C13CF133464756E2164756E21
|