negotium 0.22.6 → 0.22.7
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 +1349 -410
- package/dist/agent-helpers.js.map +7 -7
- package/dist/background-bash.js +12 -12
- package/dist/background-bash.js.map +2 -2
- package/dist/browser-runtime.js +81 -52
- package/dist/browser-runtime.js.map +4 -4
- package/dist/canonical-mcp-bridge.js +9 -8
- package/dist/canonical-mcp-bridge.js.map +1 -1
- package/dist/{chunk-e59kzyvy.js → chunk-1gznvrth.js} +5 -4
- package/dist/{chunk-e59kzyvy.js.map → chunk-1gznvrth.js.map} +2 -2
- package/dist/chunk-2mx7fq49.js +6 -0
- package/dist/{chunk-bnyvxss3.js.map → chunk-2mx7fq49.js.map} +1 -1
- package/dist/{chunk-1mba9m1j.js → chunk-9zn0bkc9.js} +116 -77
- package/dist/{chunk-1mba9m1j.js.map → chunk-9zn0bkc9.js.map} +2 -2
- package/dist/{chunk-ww8a4ej4.js → chunk-f7p0h1gs.js} +5 -5
- package/dist/{chunk-ww8a4ej4.js.map → chunk-f7p0h1gs.js.map} +2 -2
- package/dist/{chunk-9a50csg6.js → chunk-pr8p6pap.js} +125 -116
- package/dist/{chunk-9a50csg6.js.map → chunk-pr8p6pap.js.map} +7 -7
- package/dist/chunk-q5djsg78.js +200 -0
- package/dist/chunk-q5djsg78.js.map +9 -0
- package/dist/{chunk-1e0nxy7p.js → chunk-z4r7tt2p.js} +12 -12
- package/dist/{chunk-1e0nxy7p.js.map → chunk-z4r7tt2p.js.map} +2 -2
- package/dist/hosted-agent.js +128 -120
- package/dist/hosted-agent.js.map +4 -4
- package/dist/main.js +5174 -3278
- package/dist/main.js.map +9 -9
- package/dist/mcp-catalog.js +4 -4
- package/dist/mcp-catalog.js.map +1 -1
- package/dist/mcp-factories.js +1563 -632
- package/dist/mcp-factories.js.map +7 -7
- 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 +18 -16
- package/dist/query-runtime.js.map +2 -2
- package/dist/registry.js +20 -19
- package/dist/registry.js.map +2 -2
- package/dist/rollout.js +41 -41
- package/dist/rollout.js.map +2 -2
- package/dist/runtime/src/platform/playwright/manager.ts +77 -15
- package/dist/runtime/src/storage/api-topics.ts +6 -0
- package/dist/runtime/src/storage/browser-profiles.ts +18 -0
- package/dist/runtime/src/topics/lifecycle.ts +2 -5
- package/dist/runtime/src/topics/update.ts +17 -0
- package/dist/runtime/src/types/api.ts +6 -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 +54 -52
- package/dist/runtime-helpers.js.map +2 -2
- package/dist/sqlite.js +5 -3
- package/dist/sqlite.js.map +2 -2
- package/dist/storage.js +640 -664
- package/dist/storage.js.map +3 -3
- package/dist/types/packages/core/src/platform/playwright/manager.d.ts +8 -0
- package/dist/types/packages/core/src/storage/api-topics.d.ts +1 -0
- package/dist/types/packages/core/src/storage/browser-profiles.d.ts +4 -0
- package/dist/types/packages/core/src/types/api.d.ts +6 -0
- package/dist/types/packages/core/src/version.d.ts +1 -1
- package/dist/vault.js +22 -20
- package/dist/vault.js.map +2 -2
- package/package.json +1 -1
- package/dist/chunk-bnyvxss3.js +0 -77
package/dist/hosted-agent.js
CHANGED
|
@@ -1,48 +1,51 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
-
|
|
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,
|
|
4
14
|
CLAUDE_EFFORT_VALUES,
|
|
5
|
-
|
|
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
|
+
SUPPORTED_AGENTS,
|
|
30
|
+
SYSTEM_HEALTH_SERVER,
|
|
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,
|
|
6
42
|
logger,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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";
|
|
43
|
+
resolveFallbackAgent,
|
|
44
|
+
resolveTopicWorkspaceDir
|
|
45
|
+
} from "./chunk-9zn0bkc9.js";
|
|
42
46
|
import {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
} from "./chunk-ww8a4ej4.js";
|
|
47
|
+
__require
|
|
48
|
+
} from "./chunk-2mx7fq49.js";
|
|
46
49
|
|
|
47
50
|
// ../../packages/core/src/agents/claude-provider.ts
|
|
48
51
|
import { spawn as spawn2 } from "child_process";
|
|
@@ -60,12 +63,12 @@ function toDisplayPath(filePath) {
|
|
|
60
63
|
|
|
61
64
|
// ../../packages/core/src/agents/rollout/shared.ts
|
|
62
65
|
var trustedWorkspaceRoots = [
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
WORKSPACE_DIR,
|
|
67
|
+
DM_WORKSPACE_DIR,
|
|
68
|
+
SESSION_WORKSPACE_DIR,
|
|
69
|
+
TOPIC_WORKSPACE_DIR
|
|
67
70
|
].map((root) => resolve2(root));
|
|
68
|
-
var FIXTURES_DIR = resolve2(
|
|
71
|
+
var FIXTURES_DIR = resolve2(PROJECT_ROOT, "src", "agents", "fixtures");
|
|
69
72
|
|
|
70
73
|
// ../../packages/core/src/platform/jsonl.ts
|
|
71
74
|
import {
|
|
@@ -151,9 +154,9 @@ function fsyncDirectoryBestEffort(dir) {
|
|
|
151
154
|
|
|
152
155
|
// ../../packages/core/src/agents/claude-registry.ts
|
|
153
156
|
var ALIAS_MAP = {
|
|
154
|
-
sonnet:
|
|
155
|
-
opus:
|
|
156
|
-
fable:
|
|
157
|
+
sonnet: MODEL_SONNET,
|
|
158
|
+
opus: MODEL_OPUS,
|
|
159
|
+
fable: MODEL_FABLE
|
|
157
160
|
};
|
|
158
161
|
var VALID_ALIASES = new Set(Object.keys(ALIAS_MAP));
|
|
159
162
|
var VALID_EFFORTS = new Set(CLAUDE_EFFORT_VALUES);
|
|
@@ -520,12 +523,12 @@ class McpUrlBudgetExceededError extends Error {
|
|
|
520
523
|
this.name = "McpUrlBudgetExceededError";
|
|
521
524
|
}
|
|
522
525
|
}
|
|
523
|
-
var runtimePort =
|
|
526
|
+
var runtimePort = NEGOTIUM_PORT;
|
|
524
527
|
function encodeTokenPart(value) {
|
|
525
528
|
return Buffer.from(JSON.stringify(value), "utf-8").toString("base64url");
|
|
526
529
|
}
|
|
527
530
|
function signTokenPayload(payloadPart) {
|
|
528
|
-
return createHmac("sha256",
|
|
531
|
+
return createHmac("sha256", RUNTIME_MCP_SECRET).update(payloadPart).digest("base64url");
|
|
529
532
|
}
|
|
530
533
|
function issueRuntimeMcpToken(ctx) {
|
|
531
534
|
const payloadPart = encodeTokenPart({
|
|
@@ -677,9 +680,9 @@ function createBackgroundBashManager(options = {}) {
|
|
|
677
680
|
const knownContexts = new Map;
|
|
678
681
|
const runtimeCapability = options.capability ?? randomBytes(32).toString("hex");
|
|
679
682
|
const runtimeServerId = options.serverId ?? randomBytes(16).toString("hex");
|
|
680
|
-
const bashRsBin = options.bashRsBin ??
|
|
681
|
-
const basePort = options.basePort ??
|
|
682
|
-
const maxPort = options.maxPort ??
|
|
683
|
+
const bashRsBin = options.bashRsBin ?? BASH_RS_BIN;
|
|
684
|
+
const basePort = options.basePort ?? BG_BASH_BASE_PORT;
|
|
685
|
+
const maxPort = options.maxPort ?? BG_BASH_MAX_PORT;
|
|
683
686
|
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
684
687
|
const now = options.now ?? Date.now;
|
|
685
688
|
const wait = options.delay ?? delay;
|
|
@@ -736,7 +739,7 @@ function createBackgroundBashManager(options = {}) {
|
|
|
736
739
|
}
|
|
737
740
|
async function spawnServer(key, reservedPort, excludedPorts = new Set) {
|
|
738
741
|
if (!bashRsBin) {
|
|
739
|
-
throw new Error(`background-bash requires the bash-rs ${
|
|
742
|
+
throw new Error(`background-bash requires the bash-rs ${BASH_RS_VERSION} binary; run install-bash-rs.mjs (or set NEGOTIUM_BASH_RS_BIN)`);
|
|
740
743
|
}
|
|
741
744
|
const port = reservedPort ?? await allocatePort(excludedPorts);
|
|
742
745
|
const process2 = spawnImpl(bashRsBin, [String(port)], {
|
|
@@ -749,7 +752,7 @@ function createBackgroundBashManager(options = {}) {
|
|
|
749
752
|
NEGOTIUM_BG_BASH_SERVER_ID: runtimeServerId,
|
|
750
753
|
BASHRS_HTTP_CAPABILITY: runtimeCapability,
|
|
751
754
|
BASHRS_INSTANCE_ID: runtimeServerId,
|
|
752
|
-
BASHRS_SPILL_ROOT
|
|
755
|
+
BASHRS_SPILL_ROOT
|
|
753
756
|
}
|
|
754
757
|
});
|
|
755
758
|
process2.once("error", (error) => {
|
|
@@ -836,12 +839,12 @@ function createBackgroundBashManager(options = {}) {
|
|
|
836
839
|
usedPorts.clear();
|
|
837
840
|
knownContexts.clear();
|
|
838
841
|
const deadline = now() + 3000;
|
|
839
|
-
await Promise.all(entries.map((instance) => new Promise((
|
|
842
|
+
await Promise.all(entries.map((instance) => new Promise((resolve4) => {
|
|
840
843
|
if (instance.process.exitCode !== null || instance.process.killed)
|
|
841
|
-
return
|
|
842
|
-
instance.process.once("exit",
|
|
843
|
-
instance.process.once("error",
|
|
844
|
-
const timer = setTimeout(
|
|
844
|
+
return resolve4();
|
|
845
|
+
instance.process.once("exit", resolve4);
|
|
846
|
+
instance.process.once("error", resolve4);
|
|
847
|
+
const timer = setTimeout(resolve4, Math.max(0, deadline - now()));
|
|
845
848
|
timer.unref?.();
|
|
846
849
|
})));
|
|
847
850
|
}
|
|
@@ -1273,7 +1276,7 @@ var SCHEMA_TRIGGERS = {
|
|
|
1273
1276
|
};
|
|
1274
1277
|
var OTIUM_TOPIC_SCOPE_IMMUTABLE_ERROR = "otium_topic_scope_immutable";
|
|
1275
1278
|
function topicLinkSchemaIsCurrent(database, nodeId) {
|
|
1276
|
-
const objects = new Map(database.query("SELECT name, sql FROM sqlite_master WHERE type IN ('table','index','trigger')").all().map((
|
|
1279
|
+
const objects = new Map(database.query("SELECT name, sql FROM sqlite_master WHERE type IN ('table','index','trigger')").all().map((row2) => [row2.name, row2.sql ?? ""]));
|
|
1277
1280
|
for (const name of [...SCHEMA_TABLES, ...SCHEMA_INDEXES, ...SCHEMA_INDEXES_TOMBSTONES]) {
|
|
1278
1281
|
if (!objects.has(name))
|
|
1279
1282
|
return false;
|
|
@@ -1290,7 +1293,7 @@ function topicLinkSchemaIsCurrent(database, nodeId) {
|
|
|
1290
1293
|
return false;
|
|
1291
1294
|
}
|
|
1292
1295
|
const identity = database.query("SELECT node_id, epoch_id FROM api_node_identity WHERE singleton = 1").all();
|
|
1293
|
-
if (identity.some((
|
|
1296
|
+
if (identity.some((row2) => row2.epoch_id === null))
|
|
1294
1297
|
return false;
|
|
1295
1298
|
if (nodeId && identity[0]?.node_id !== nodeId)
|
|
1296
1299
|
return false;
|
|
@@ -1700,6 +1703,7 @@ function initializeApiTopicsSchema() {
|
|
|
1700
1703
|
surface_scope TEXT,
|
|
1701
1704
|
browser_profile TEXT NOT NULL DEFAULT 'default',
|
|
1702
1705
|
browser_profile_owner TEXT,
|
|
1706
|
+
browser_connect_port INTEGER,
|
|
1703
1707
|
session_id TEXT,
|
|
1704
1708
|
CHECK (
|
|
1705
1709
|
(kind = 'channel' AND response_policy = 'off' AND agent IS NULL) OR
|
|
@@ -1817,6 +1821,9 @@ function initializeApiTopicsSchema() {
|
|
|
1817
1821
|
if (!tableColumns("api_topics").has("browser_profile_owner")) {
|
|
1818
1822
|
db.exec("ALTER TABLE api_topics ADD COLUMN browser_profile_owner TEXT");
|
|
1819
1823
|
}
|
|
1824
|
+
if (!tableColumns("api_topics").has("browser_connect_port")) {
|
|
1825
|
+
db.exec("ALTER TABLE api_topics ADD COLUMN browser_connect_port INTEGER");
|
|
1826
|
+
}
|
|
1820
1827
|
if (!tableColumns("api_topics").has("subagent_report_mode")) {
|
|
1821
1828
|
db.exec("ALTER TABLE api_topics ADD COLUMN subagent_report_mode TEXT NOT NULL DEFAULT 'auto'");
|
|
1822
1829
|
}
|
|
@@ -2054,7 +2061,8 @@ function rowToDto(r, participants = getTopicParticipants(r.id), tellTargets) {
|
|
|
2054
2061
|
} : {},
|
|
2055
2062
|
visibility: normalizeTopicVisibility(r.visibility),
|
|
2056
2063
|
surface: normalizeTopicSurface(r.surface),
|
|
2057
|
-
surfaceScope: normalizeSurfaceScope(r.surface_scope)
|
|
2064
|
+
surfaceScope: normalizeSurfaceScope(r.surface_scope),
|
|
2065
|
+
...r.browser_connect_port != null ? { browserConnectPort: r.browser_connect_port } : {}
|
|
2058
2066
|
};
|
|
2059
2067
|
}
|
|
2060
2068
|
function normalizeTopicVisibility(value) {
|
|
@@ -2109,8 +2117,8 @@ function buildStdioMcpServer(agent, serverFile, serverArgs, env) {
|
|
|
2109
2117
|
if (agent === "codex") {
|
|
2110
2118
|
return {
|
|
2111
2119
|
command: "node",
|
|
2112
|
-
args: ["--import",
|
|
2113
|
-
env: { TSX_TSCONFIG_PATH:
|
|
2120
|
+
args: ["--import", TSX_LOADER, serverFile, ...serverArgs],
|
|
2121
|
+
env: { TSX_TSCONFIG_PATH: TSCONFIG_PATH, ...env }
|
|
2114
2122
|
};
|
|
2115
2123
|
}
|
|
2116
2124
|
return {
|
|
@@ -2120,12 +2128,12 @@ function buildStdioMcpServer(agent, serverFile, serverArgs, env) {
|
|
|
2120
2128
|
};
|
|
2121
2129
|
}
|
|
2122
2130
|
function useHostedBuiltinMcp() {
|
|
2123
|
-
return
|
|
2131
|
+
return envText("NEGOTIUM_BUILTIN_MCP_TRANSPORT") !== "stdio";
|
|
2124
2132
|
}
|
|
2125
2133
|
function buildBuiltinMcpServer(surface, ctx, stdio) {
|
|
2126
2134
|
if (!useHostedBuiltinMcp())
|
|
2127
2135
|
return stdio();
|
|
2128
|
-
const agent = ctx.agent ??
|
|
2136
|
+
const agent = ctx.agent ?? FALLBACK_AGENT;
|
|
2129
2137
|
return buildHostedMcpSpec(agent, surface, {
|
|
2130
2138
|
userId: ctx.userId,
|
|
2131
2139
|
...ctx.actorUserId ? { actorUserId: ctx.actorUserId } : {},
|
|
@@ -2137,7 +2145,7 @@ function buildBuiltinMcpServer(surface, ctx, stdio) {
|
|
|
2137
2145
|
...ctx.wikiTopicId ? { wikiTopicId: ctx.wikiTopicId } : {},
|
|
2138
2146
|
...ctx.subagentParentTopicId ? { subagentParentTopicId: ctx.subagentParentTopicId } : {},
|
|
2139
2147
|
...ctx.threadRootId ? { threadRootId: ctx.threadRootId } : {},
|
|
2140
|
-
cwd: ctx.cwd ?? (ctx.topicId ?
|
|
2148
|
+
cwd: ctx.cwd ?? (ctx.topicId ? resolveTopicWorkspaceDir(ctx.topicId) : process.cwd()),
|
|
2141
2149
|
agent,
|
|
2142
2150
|
...ctx.model ? { model: ctx.model } : {},
|
|
2143
2151
|
...ctx.depth !== undefined ? { depth: ctx.depth } : {},
|
|
@@ -2250,7 +2258,7 @@ var MCP_CATALOG = {
|
|
|
2250
2258
|
topicId,
|
|
2251
2259
|
topicTitle: session,
|
|
2252
2260
|
queryId,
|
|
2253
|
-
cwd: cwd ??
|
|
2261
|
+
cwd: cwd ?? resolveTopicWorkspaceDir(topicId),
|
|
2254
2262
|
agent,
|
|
2255
2263
|
model,
|
|
2256
2264
|
...switchTargets.length ? { explicitAgentSwitchTargets: switchTargets } : {},
|
|
@@ -2265,7 +2273,7 @@ var MCP_CATALOG = {
|
|
|
2265
2273
|
"token-stats": {
|
|
2266
2274
|
...commonRuntimeMcpPolicy("token-stats"),
|
|
2267
2275
|
build(ctx) {
|
|
2268
|
-
return buildBuiltinMcpServer("token-stats", ctx, () => buildStdioMcpServer(ctx.agent,
|
|
2276
|
+
return buildBuiltinMcpServer("token-stats", ctx, () => buildStdioMcpServer(ctx.agent, TOKEN_STATS_SERVER, [`--user-id=${ctx.userId}`]));
|
|
2269
2277
|
}
|
|
2270
2278
|
},
|
|
2271
2279
|
task: {
|
|
@@ -2275,19 +2283,19 @@ var MCP_CATALOG = {
|
|
|
2275
2283
|
if (peerBridge) {
|
|
2276
2284
|
if (!topicId || !queryId)
|
|
2277
2285
|
return null;
|
|
2278
|
-
const env =
|
|
2286
|
+
const env = canonicalMcpBridgeEnv({
|
|
2279
2287
|
surface: "task",
|
|
2280
2288
|
userId,
|
|
2281
2289
|
topicId,
|
|
2282
2290
|
queryId,
|
|
2283
2291
|
peerBridge
|
|
2284
2292
|
});
|
|
2285
|
-
return env ? buildStdioMcpServer(agent,
|
|
2293
|
+
return env ? buildStdioMcpServer(agent, CANONICAL_MCP_PROXY_SERVER, ["--surface=task"], env) : null;
|
|
2286
2294
|
}
|
|
2287
2295
|
const args = [`--user-id=${userId}`, `--topic=${session}`];
|
|
2288
2296
|
if (topicId)
|
|
2289
2297
|
args.push(`--topic-id=${topicId}`);
|
|
2290
|
-
return buildBuiltinMcpServer("task", ctx, () => buildStdioMcpServer(agent,
|
|
2298
|
+
return buildBuiltinMcpServer("task", ctx, () => buildStdioMcpServer(agent, TASK_SERVER, args));
|
|
2291
2299
|
}
|
|
2292
2300
|
},
|
|
2293
2301
|
decision: {
|
|
@@ -2297,25 +2305,25 @@ var MCP_CATALOG = {
|
|
|
2297
2305
|
if (peerBridge) {
|
|
2298
2306
|
if (!topicId || !queryId)
|
|
2299
2307
|
return null;
|
|
2300
|
-
const env =
|
|
2308
|
+
const env = canonicalMcpBridgeEnv({
|
|
2301
2309
|
surface: "decision",
|
|
2302
2310
|
userId,
|
|
2303
2311
|
topicId,
|
|
2304
2312
|
queryId,
|
|
2305
2313
|
peerBridge
|
|
2306
2314
|
});
|
|
2307
|
-
return env ? buildStdioMcpServer(agent,
|
|
2315
|
+
return env ? buildStdioMcpServer(agent, CANONICAL_MCP_PROXY_SERVER, ["--surface=decision"], env) : null;
|
|
2308
2316
|
}
|
|
2309
2317
|
const args = [
|
|
2310
2318
|
`--user-id=${userId}`,
|
|
2311
2319
|
`--topic=${session}`,
|
|
2312
|
-
`--agent=${agent ??
|
|
2320
|
+
`--agent=${agent ?? FALLBACK_AGENT}`
|
|
2313
2321
|
];
|
|
2314
2322
|
if (topicId)
|
|
2315
2323
|
args.push(`--topic-id=${topicId}`);
|
|
2316
2324
|
if (model)
|
|
2317
2325
|
args.push(`--model=${model}`);
|
|
2318
|
-
return buildBuiltinMcpServer("decision", ctx, () => buildStdioMcpServer(agent,
|
|
2326
|
+
return buildBuiltinMcpServer("decision", ctx, () => buildStdioMcpServer(agent, DECISION_SERVER, args));
|
|
2319
2327
|
}
|
|
2320
2328
|
},
|
|
2321
2329
|
"session-comm": {
|
|
@@ -2335,7 +2343,7 @@ var MCP_CATALOG = {
|
|
|
2335
2343
|
threadRootId,
|
|
2336
2344
|
peerBridge
|
|
2337
2345
|
} = ctx;
|
|
2338
|
-
const effectiveAgent = agent ??
|
|
2346
|
+
const effectiveAgent = agent ?? FALLBACK_AGENT;
|
|
2339
2347
|
const cronSessionId = topicId ? getRegisteredCronSession(topicId, effectiveAgent)?.sessionId : undefined;
|
|
2340
2348
|
const args = [
|
|
2341
2349
|
`--user-id=${userId}`,
|
|
@@ -2355,7 +2363,7 @@ var MCP_CATALOG = {
|
|
|
2355
2363
|
...threadRootId ? [`--thread-root-id=${threadRootId}`] : [],
|
|
2356
2364
|
...peerBridge ? [`--peer-host-query-id=${peerBridge.hostQueryId}`] : []
|
|
2357
2365
|
];
|
|
2358
|
-
return buildBuiltinMcpServer("session-comm", ctx, () => buildStdioMcpServer(effectiveAgent,
|
|
2366
|
+
return buildBuiltinMcpServer("session-comm", ctx, () => buildStdioMcpServer(effectiveAgent, SESSION_COMM_SERVER, args, peerBridge ? peerSessionBridgeIpcEnv() : undefined));
|
|
2359
2367
|
}
|
|
2360
2368
|
},
|
|
2361
2369
|
wiki: {
|
|
@@ -2365,14 +2373,14 @@ var MCP_CATALOG = {
|
|
|
2365
2373
|
if (peerBridge) {
|
|
2366
2374
|
if (!topicId || !queryId)
|
|
2367
2375
|
return null;
|
|
2368
|
-
const env =
|
|
2376
|
+
const env = canonicalMcpBridgeEnv({
|
|
2369
2377
|
surface: "wiki",
|
|
2370
2378
|
userId,
|
|
2371
2379
|
topicId,
|
|
2372
2380
|
queryId,
|
|
2373
2381
|
peerBridge
|
|
2374
2382
|
});
|
|
2375
|
-
return env ? buildStdioMcpServer(agent,
|
|
2383
|
+
return env ? buildStdioMcpServer(agent, CANONICAL_MCP_PROXY_SERVER, ["--surface=wiki"], env) : null;
|
|
2376
2384
|
}
|
|
2377
2385
|
const args = [`--user-id=${userId}`];
|
|
2378
2386
|
if (topicId)
|
|
@@ -2381,7 +2389,7 @@ var MCP_CATALOG = {
|
|
|
2381
2389
|
if (resolvedWikiTopicId)
|
|
2382
2390
|
args.push(`--topic-id=${resolvedWikiTopicId}`);
|
|
2383
2391
|
args.push("--surface=wiki");
|
|
2384
|
-
return buildBuiltinMcpServer("wiki", { ...ctx, wikiTopicId: resolvedWikiTopicId }, () => buildStdioMcpServer(agent,
|
|
2392
|
+
return buildBuiltinMcpServer("wiki", { ...ctx, wikiTopicId: resolvedWikiTopicId }, () => buildStdioMcpServer(agent, WIKI_SERVER, args));
|
|
2385
2393
|
}
|
|
2386
2394
|
},
|
|
2387
2395
|
skills: {
|
|
@@ -2391,13 +2399,13 @@ var MCP_CATALOG = {
|
|
|
2391
2399
|
const args = [`--user-id=${userId}`, "--surface=skills"];
|
|
2392
2400
|
if (topicId)
|
|
2393
2401
|
args.push(`--topic-id=${topicId}`);
|
|
2394
|
-
return buildBuiltinMcpServer("skills", ctx, () => buildStdioMcpServer(agent,
|
|
2402
|
+
return buildBuiltinMcpServer("skills", ctx, () => buildStdioMcpServer(agent, WIKI_SERVER, args));
|
|
2395
2403
|
}
|
|
2396
2404
|
},
|
|
2397
2405
|
"system-health": {
|
|
2398
2406
|
...commonRuntimeMcpPolicy("system-health"),
|
|
2399
2407
|
build(ctx) {
|
|
2400
|
-
return buildBuiltinMcpServer("system-health", ctx, () => buildStdioMcpServer(ctx.agent,
|
|
2408
|
+
return buildBuiltinMcpServer("system-health", ctx, () => buildStdioMcpServer(ctx.agent, SYSTEM_HEALTH_SERVER, []));
|
|
2401
2409
|
}
|
|
2402
2410
|
},
|
|
2403
2411
|
"background-bash": {
|
|
@@ -2413,7 +2421,7 @@ var MCP_CATALOG = {
|
|
|
2413
2421
|
build(ctx) {
|
|
2414
2422
|
const { userId, agent } = ctx;
|
|
2415
2423
|
const args = [`--user-id=${userId}`];
|
|
2416
|
-
return buildBuiltinMcpServer("agent-health", ctx, () => buildStdioMcpServer(agent,
|
|
2424
|
+
return buildBuiltinMcpServer("agent-health", ctx, () => buildStdioMcpServer(agent, AGENT_HEALTH_SERVER, args));
|
|
2417
2425
|
}
|
|
2418
2426
|
},
|
|
2419
2427
|
vault: {
|
|
@@ -2423,7 +2431,7 @@ var MCP_CATALOG = {
|
|
|
2423
2431
|
const args = [`--user-id=${vaultUserId ?? userId}`];
|
|
2424
2432
|
if (agent !== "codex")
|
|
2425
2433
|
args.push("--list-only=true");
|
|
2426
|
-
return buildBuiltinMcpServer("vault", { ...ctx, userId: vaultUserId ?? userId }, () => buildStdioMcpServer(agent,
|
|
2434
|
+
return buildBuiltinMcpServer("vault", { ...ctx, userId: vaultUserId ?? userId }, () => buildStdioMcpServer(agent, VAULT_SERVER, args));
|
|
2427
2435
|
}
|
|
2428
2436
|
},
|
|
2429
2437
|
"cua-rs": {
|
|
@@ -2772,16 +2780,16 @@ function decryptVaultValueWithKey(userId, key, storedValue, masterKey) {
|
|
|
2772
2780
|
}
|
|
2773
2781
|
|
|
2774
2782
|
// ../../packages/core/src/storage/vault-crypto.ts
|
|
2775
|
-
function encryptVaultValue(userId, key, value, masterKey =
|
|
2783
|
+
function encryptVaultValue(userId, key, value, masterKey = VAULT_MASTER_KEY) {
|
|
2776
2784
|
return encryptVaultValueWithKey(userId, key, value, masterKey);
|
|
2777
2785
|
}
|
|
2778
|
-
function decryptVaultValue(userId, key, storedValue, masterKey =
|
|
2786
|
+
function decryptVaultValue(userId, key, storedValue, masterKey = VAULT_MASTER_KEY) {
|
|
2779
2787
|
return decryptVaultValueWithKey(userId, key, storedValue, masterKey);
|
|
2780
2788
|
}
|
|
2781
2789
|
|
|
2782
2790
|
// ../../packages/core/src/storage/vault.ts
|
|
2783
2791
|
var vaultDb;
|
|
2784
|
-
var vaultMasterKey =
|
|
2792
|
+
var vaultMasterKey = VAULT_MASTER_KEY;
|
|
2785
2793
|
function initializeVaultDatabase(database) {
|
|
2786
2794
|
database.exec("PRAGMA journal_mode = WAL");
|
|
2787
2795
|
database.exec("PRAGMA busy_timeout = 5000");
|
|
@@ -2921,8 +2929,8 @@ var defaultHost = {
|
|
|
2921
2929
|
redactVaultSecrets,
|
|
2922
2930
|
substituteVaultSecrets: (userId, value) => vaultSubstituteDetailed(userId, value).text,
|
|
2923
2931
|
referencesRuntimeSecretStorage,
|
|
2924
|
-
claudeCodeExecutablePath: () =>
|
|
2925
|
-
codexAuthFilePath
|
|
2932
|
+
claudeCodeExecutablePath: () => CLAUDE_EXECUTABLE,
|
|
2933
|
+
codexAuthFilePath
|
|
2926
2934
|
};
|
|
2927
2935
|
var hostRegistrations = [];
|
|
2928
2936
|
var scopedHost = new AsyncLocalStorage;
|
|
@@ -2987,7 +2995,7 @@ function hostedCodexHomePath() {
|
|
|
2987
2995
|
|
|
2988
2996
|
// ../../packages/core/src/media/file-events.ts
|
|
2989
2997
|
function* extractFileEvents(text, source) {
|
|
2990
|
-
const tagRegex = new RegExp(
|
|
2998
|
+
const tagRegex = new RegExp(FILE_TAG_REGEX.source, "gi");
|
|
2991
2999
|
let match = tagRegex.exec(text);
|
|
2992
3000
|
while (match !== null) {
|
|
2993
3001
|
yield { type: "file", path: match[1], source, origin: "tag" };
|
|
@@ -3129,8 +3137,8 @@ var CLAUDE_ABORT_SIGKILL_DELAY_MS = 2500;
|
|
|
3129
3137
|
var claudeProcessExitListeners = new WeakMap;
|
|
3130
3138
|
function watchClaudeProcessExit(signal) {
|
|
3131
3139
|
let listener;
|
|
3132
|
-
const exited = new Promise((
|
|
3133
|
-
listener =
|
|
3140
|
+
const exited = new Promise((resolve5) => {
|
|
3141
|
+
listener = resolve5;
|
|
3134
3142
|
const listeners = claudeProcessExitListeners.get(signal) ?? new Set;
|
|
3135
3143
|
listeners.add(listener);
|
|
3136
3144
|
claudeProcessExitListeners.set(signal, listeners);
|
|
@@ -3587,7 +3595,7 @@ import { tmpdir } from "os";
|
|
|
3587
3595
|
import { dirname as dirname5, join as join3 } from "path";
|
|
3588
3596
|
|
|
3589
3597
|
// ../../packages/core/src/version.ts
|
|
3590
|
-
var NEGOTIUM_VERSION = "0.22.
|
|
3598
|
+
var NEGOTIUM_VERSION = "0.22.7";
|
|
3591
3599
|
|
|
3592
3600
|
// ../../packages/core/src/agents/codex-native-multi-agent.ts
|
|
3593
3601
|
var moduleRequire = createRequire(import.meta.url);
|
|
@@ -3655,7 +3663,7 @@ async function bootstrapCodexModelCache(codexHome, cachePath) {
|
|
|
3655
3663
|
stdio: ["pipe", "pipe", "pipe"],
|
|
3656
3664
|
windowsHide: true
|
|
3657
3665
|
});
|
|
3658
|
-
const refreshed = new Promise((
|
|
3666
|
+
const refreshed = new Promise((resolve5, reject) => {
|
|
3659
3667
|
let settled = false;
|
|
3660
3668
|
let stdoutBuffer = "";
|
|
3661
3669
|
let stderr = "";
|
|
@@ -3674,7 +3682,7 @@ async function bootstrapCodexModelCache(codexHome, cachePath) {
|
|
|
3674
3682
|
else if (!existsSync2(cachePath))
|
|
3675
3683
|
reject(new Error("Codex did not create its model cache"));
|
|
3676
3684
|
else
|
|
3677
|
-
|
|
3685
|
+
resolve5();
|
|
3678
3686
|
};
|
|
3679
3687
|
const send = (message) => {
|
|
3680
3688
|
child.stdin.write(`${JSON.stringify(message)}
|
|
@@ -3741,12 +3749,12 @@ var CODEX_BOOTSTRAP_EXIT_WAIT_MS = 3000;
|
|
|
3741
3749
|
function waitForChildExit(child, timeoutMs) {
|
|
3742
3750
|
if (child.exitCode !== null || child.signalCode !== null)
|
|
3743
3751
|
return Promise.resolve();
|
|
3744
|
-
return new Promise((
|
|
3745
|
-
const timer = setTimeout(
|
|
3752
|
+
return new Promise((resolve5) => {
|
|
3753
|
+
const timer = setTimeout(resolve5, timeoutMs);
|
|
3746
3754
|
timer.unref?.();
|
|
3747
3755
|
child.once("exit", () => {
|
|
3748
3756
|
clearTimeout(timer);
|
|
3749
|
-
|
|
3757
|
+
resolve5();
|
|
3750
3758
|
});
|
|
3751
3759
|
});
|
|
3752
3760
|
}
|
|
@@ -3880,12 +3888,12 @@ function createCodexTreeManager(host, options = {}) {
|
|
|
3880
3888
|
const previous = spawnChain;
|
|
3881
3889
|
let release;
|
|
3882
3890
|
let released = false;
|
|
3883
|
-
spawnChain = new Promise((
|
|
3891
|
+
spawnChain = new Promise((resolve5) => {
|
|
3884
3892
|
release = () => {
|
|
3885
3893
|
if (released)
|
|
3886
3894
|
return;
|
|
3887
3895
|
released = true;
|
|
3888
|
-
|
|
3896
|
+
resolve5();
|
|
3889
3897
|
};
|
|
3890
3898
|
});
|
|
3891
3899
|
await previous;
|
|
@@ -3992,7 +4000,7 @@ function createCodexTreeManager(host, options = {}) {
|
|
|
3992
4000
|
return;
|
|
3993
4001
|
const deadline = Date.now() + Math.max(0, graceMs);
|
|
3994
4002
|
while (Date.now() < deadline && hasSurvivors(plan.targets)) {
|
|
3995
|
-
await new Promise((
|
|
4003
|
+
await new Promise((resolve5) => setTimeout(resolve5, Math.min(100, Math.max(1, deadline - Date.now()))));
|
|
3996
4004
|
}
|
|
3997
4005
|
killStragglers(plan);
|
|
3998
4006
|
}
|
|
@@ -4316,7 +4324,7 @@ async function createCodexVaultHookBridge(userId) {
|
|
|
4316
4324
|
});
|
|
4317
4325
|
restrictIpcEndpoint(socketPath);
|
|
4318
4326
|
if (IS_WINDOWS2) {
|
|
4319
|
-
const { BINARIES_DIR } = await import("./chunk-
|
|
4327
|
+
const { BINARIES_DIR } = await import("./chunk-q5djsg78.js");
|
|
4320
4328
|
const cached = await ensureCodexWindowsWrapperExe(join5(BINARIES_DIR, "codex-hook-wrapper"));
|
|
4321
4329
|
await copyFile(cached, wrapperPath);
|
|
4322
4330
|
await writeFile2(join5(root, "codex-with-hooks.cfg"), [process.execPath, codexCliScriptPath(), socketPath, token].join(`
|
|
@@ -5055,9 +5063,9 @@ async function startStreamedWithTracking(thread, prompt, abortSignal, trackedPid
|
|
|
5055
5063
|
nextP.catch(() => {});
|
|
5056
5064
|
first = await Promise.race([nextP, startupTimeout]);
|
|
5057
5065
|
} catch (err) {
|
|
5058
|
-
const
|
|
5059
|
-
if (
|
|
5060
|
-
killCodexTrees(
|
|
5066
|
+
const novel2 = findNewCodexChildren(baseline);
|
|
5067
|
+
if (novel2.length > 0) {
|
|
5068
|
+
killCodexTrees(novel2);
|
|
5061
5069
|
}
|
|
5062
5070
|
await closeIterator(iter);
|
|
5063
5071
|
throw err;
|
|
@@ -5529,7 +5537,7 @@ function buildProviderOwnedToolBlockHook() {
|
|
|
5529
5537
|
}
|
|
5530
5538
|
};
|
|
5531
5539
|
}
|
|
5532
|
-
var MAESTRO_TOOL_OUTPUT_DIR = resolve8(
|
|
5540
|
+
var MAESTRO_TOOL_OUTPUT_DIR = resolve8(RUN_DIR, "maestro-tool-outputs");
|
|
5533
5541
|
function buildMaestroToolResultTruncation(opts) {
|
|
5534
5542
|
if (opts.toolResultTruncation)
|
|
5535
5543
|
return opts.toolResultTruncation;
|
|
@@ -5623,7 +5631,7 @@ async function* runHostedAgent(input, host) {
|
|
|
5623
5631
|
}
|
|
5624
5632
|
} finally {
|
|
5625
5633
|
if (opts.userId && opts.topicId && opts.queryId && opts.peerBridge) {
|
|
5626
|
-
|
|
5634
|
+
revokeCanonicalMcpBridgeTurn({
|
|
5627
5635
|
userId: opts.userId,
|
|
5628
5636
|
topicId: opts.topicId,
|
|
5629
5637
|
queryId: opts.queryId,
|
|
@@ -5633,17 +5641,17 @@ async function* runHostedAgent(input, host) {
|
|
|
5633
5641
|
}
|
|
5634
5642
|
}
|
|
5635
5643
|
export {
|
|
5636
|
-
|
|
5637
|
-
buildMaestroDisallowedTools,
|
|
5638
|
-
buildMaestroToolHooks,
|
|
5639
|
-
claudeProvider,
|
|
5640
|
-
codexProvider,
|
|
5641
|
-
configureAgentExecutionHost,
|
|
5642
|
-
inspectBundledClaudeRuntime,
|
|
5643
|
-
maestroProvider,
|
|
5644
|
-
runHostedAgent,
|
|
5644
|
+
toCodexMcpServers,
|
|
5645
5645
|
spawnClaudeCodeProcessWithTreeKill,
|
|
5646
|
-
|
|
5646
|
+
runHostedAgent,
|
|
5647
|
+
maestroProvider,
|
|
5648
|
+
inspectBundledClaudeRuntime,
|
|
5649
|
+
configureAgentExecutionHost,
|
|
5650
|
+
codexProvider,
|
|
5651
|
+
claudeProvider,
|
|
5652
|
+
buildMaestroToolHooks,
|
|
5653
|
+
buildMaestroDisallowedTools,
|
|
5654
|
+
buildClaudeDisallowedTools
|
|
5647
5655
|
};
|
|
5648
5656
|
|
|
5649
|
-
//# debugId=
|
|
5657
|
+
//# debugId=B305FCBE3879A96B64756E2164756E21
|