@otium-team/negotium 0.23.11 → 0.23.13
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 +510 -1323
- package/dist/agent-helpers.js.map +10 -10
- package/dist/background-bash.js +12 -12
- package/dist/background-bash.js.map +3 -3
- package/dist/browser-runtime.js +42 -44
- package/dist/browser-runtime.js.map +3 -3
- package/dist/canonical-mcp-bridge.js +8 -9
- package/dist/canonical-mcp-bridge.js.map +1 -1
- package/dist/chunk-22kg3fsw.js +79 -0
- package/dist/{chunk-ad7kxsaq.js.map → chunk-22kg3fsw.js.map} +1 -1
- package/dist/{chunk-mxxwx5mg.js → chunk-d4j77adx.js} +96 -135
- package/dist/{chunk-mxxwx5mg.js.map → chunk-d4j77adx.js.map} +6 -6
- package/dist/{chunk-0fenxbe6.js → chunk-mk9x18jn.js} +4 -5
- package/dist/{chunk-0fenxbe6.js.map → chunk-mk9x18jn.js.map} +2 -2
- package/dist/{chunk-da9ad838.js → chunk-qd0vtfm2.js} +115 -119
- package/dist/{chunk-da9ad838.js.map → chunk-qd0vtfm2.js.map} +7 -7
- package/dist/{chunk-jtv8yzy1.js → chunk-wf7ny8eq.js} +12 -12
- package/dist/{chunk-jtv8yzy1.js.map → chunk-wf7ny8eq.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 +198 -135
- package/dist/hosted-agent.js.map +4 -4
- package/dist/main.js +3906 -4213
- package/dist/main.js.map +20 -18
- package/dist/mcp-catalog.js +4 -4
- package/dist/mcp-catalog.js.map +1 -1
- package/dist/mcp-factories.js +753 -1558
- package/dist/mcp-factories.js.map +10 -10
- 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 +2 -2
- 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 +3 -3
- package/dist/query-runtime.js +16 -18
- package/dist/query-runtime.js.map +4 -4
- 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/claude-provider.ts +80 -5
- package/dist/runtime/src/application/submit-runtime-gateway-turn.ts +84 -20
- package/dist/runtime/src/application/topic-service.ts +6 -2
- package/dist/runtime/src/application/turn-follow-ups.ts +291 -0
- package/dist/runtime/src/bus.ts +6 -0
- package/dist/runtime/src/node-host.ts +11 -0
- package/dist/runtime/src/query/active-rooms.ts +7 -1
- package/dist/runtime/src/runtime/turn-runner.ts +34 -7
- package/dist/runtime/src/runtime-gateway.ts +198 -1
- package/dist/runtime/src/storage/runtime-follow-ups.ts +212 -0
- package/dist/runtime/src/storage/runtime-turn-requests.ts +43 -2
- package/dist/runtime/src/types/api.ts +9 -0
- package/dist/runtime/src/types.ts +23 -0
- package/dist/runtime/src/version.ts +1 -1
- package/dist/runtime-gateway.js +73 -12
- package/dist/runtime-gateway.js.map +3 -3
- package/dist/runtime-helpers.js +52 -54
- package/dist/runtime-helpers.js.map +3 -3
- package/dist/sqlite.js +3 -5
- package/dist/sqlite.js.map +2 -2
- package/dist/storage.js +4841 -4812
- package/dist/storage.js.map +3 -3
- package/dist/types/packages/core/src/bus.d.ts +3 -0
- package/dist/types/packages/core/src/query/active-rooms.d.ts +7 -1
- package/dist/types/packages/core/src/runtime-gateway.d.ts +59 -1
- package/dist/types/packages/core/src/storage/runtime-turn-requests.d.ts +25 -0
- package/dist/types/packages/core/src/types/api.d.ts +5 -0
- package/dist/types/packages/core/src/types.d.ts +21 -0
- package/dist/types/packages/core/src/version.d.ts +1 -1
- package/dist/vault.js +20 -22
- package/dist/vault.js.map +3 -3
- package/package.json +1 -1
- package/dist/chunk-2mx7fq49.js +0 -6
- package/dist/chunk-2mx7fq49.js.map +0 -9
- package/dist/chunk-ad7kxsaq.js +0 -202
package/dist/hosted-agent.js
CHANGED
|
@@ -1,55 +1,53 @@
|
|
|
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_HISTORY_SERVER,
|
|
29
|
-
SESSION_WORKSPACE_DIR,
|
|
30
|
-
SUPPORTED_AGENTS,
|
|
31
|
-
SYSTEM_HEALTH_SERVER,
|
|
32
|
-
TASK_SERVER,
|
|
33
|
-
TOKEN_STATS_SERVER,
|
|
34
|
-
TOPIC_WORKSPACE_DIR,
|
|
35
|
-
TSCONFIG_PATH,
|
|
36
|
-
TSX_LOADER,
|
|
37
|
-
VAULT_MASTER_KEY,
|
|
38
|
-
VAULT_SERVER,
|
|
39
|
-
WIKI_SERVER,
|
|
40
|
-
WORKSPACE_DIR,
|
|
41
|
-
codexAuthFilePath,
|
|
42
|
-
envText,
|
|
43
3
|
logger,
|
|
4
|
+
SUPPORTED_AGENTS,
|
|
5
|
+
CLAUDE_EFFORT_VALUES,
|
|
44
6
|
resolveFallbackAgent,
|
|
45
|
-
|
|
46
|
-
|
|
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
|
+
SESSION_HISTORY_SERVER2,
|
|
25
|
+
SYSTEM_HEALTH_SERVER2,
|
|
26
|
+
AGENT_HEALTH_SERVER2,
|
|
27
|
+
VAULT_SERVER2,
|
|
28
|
+
BG_BASH_BASE_PORT2,
|
|
29
|
+
BG_BASH_MAX_PORT2,
|
|
30
|
+
resolveTopicWorkspaceDir2,
|
|
31
|
+
RUNTIME_MCP_SECRET2,
|
|
32
|
+
VAULT_MASTER_KEY2,
|
|
33
|
+
NEGOTIUM_PORT2,
|
|
34
|
+
RUN_DIR2,
|
|
35
|
+
BASHRS_SPILL_ROOT2,
|
|
36
|
+
FILE_TAG_REGEX2,
|
|
37
|
+
MODEL_SONNET2,
|
|
38
|
+
MODEL_OPUS2,
|
|
39
|
+
MODEL_FABLE2,
|
|
40
|
+
FALLBACK_AGENT2,
|
|
41
|
+
codexAuthFilePath2
|
|
42
|
+
} from "./chunk-d4j77adx.js";
|
|
47
43
|
import {
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
canonicalMcpBridgeEnv2,
|
|
45
|
+
revokeCanonicalMcpBridgeTurn2
|
|
46
|
+
} from "./chunk-ww8a4ej4.js";
|
|
50
47
|
|
|
51
48
|
// ../../packages/core/src/agents/claude-provider.ts
|
|
52
49
|
import { spawn as spawn2 } from "child_process";
|
|
50
|
+
import { randomUUID } from "crypto";
|
|
53
51
|
import { existsSync, readFileSync as readFileSync2 } from "fs";
|
|
54
52
|
import { query } from "@anthropic-ai/claude-agent-sdk";
|
|
55
53
|
|
|
@@ -151,12 +149,12 @@ function toDisplayPath(filePath) {
|
|
|
151
149
|
|
|
152
150
|
// ../../packages/core/src/agents/rollout/shared.ts
|
|
153
151
|
var trustedWorkspaceRoots = [
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
152
|
+
WORKSPACE_DIR2,
|
|
153
|
+
DM_WORKSPACE_DIR2,
|
|
154
|
+
SESSION_WORKSPACE_DIR2,
|
|
155
|
+
TOPIC_WORKSPACE_DIR2
|
|
158
156
|
].map((root) => resolve2(root));
|
|
159
|
-
var FIXTURES_DIR = resolve2(
|
|
157
|
+
var FIXTURES_DIR = resolve2(PROJECT_ROOT2, "src", "agents", "fixtures");
|
|
160
158
|
|
|
161
159
|
// ../../packages/core/src/platform/jsonl.ts
|
|
162
160
|
import {
|
|
@@ -242,9 +240,9 @@ function fsyncDirectoryBestEffort(dir) {
|
|
|
242
240
|
|
|
243
241
|
// ../../packages/core/src/agents/claude-registry.ts
|
|
244
242
|
var ALIAS_MAP = {
|
|
245
|
-
sonnet:
|
|
246
|
-
opus:
|
|
247
|
-
fable:
|
|
243
|
+
sonnet: MODEL_SONNET2,
|
|
244
|
+
opus: MODEL_OPUS2,
|
|
245
|
+
fable: MODEL_FABLE2
|
|
248
246
|
};
|
|
249
247
|
var VALID_ALIASES = new Set(Object.keys(ALIAS_MAP));
|
|
250
248
|
var VALID_EFFORTS = new Set(CLAUDE_EFFORT_VALUES);
|
|
@@ -616,12 +614,12 @@ class McpUrlBudgetExceededError extends Error {
|
|
|
616
614
|
this.name = "McpUrlBudgetExceededError";
|
|
617
615
|
}
|
|
618
616
|
}
|
|
619
|
-
var runtimePort =
|
|
617
|
+
var runtimePort = NEGOTIUM_PORT2;
|
|
620
618
|
function encodeTokenPart(value) {
|
|
621
619
|
return Buffer.from(JSON.stringify(value), "utf-8").toString("base64url");
|
|
622
620
|
}
|
|
623
621
|
function signTokenPayload(payloadPart) {
|
|
624
|
-
return createHmac("sha256",
|
|
622
|
+
return createHmac("sha256", RUNTIME_MCP_SECRET2).update(payloadPart).digest("base64url");
|
|
625
623
|
}
|
|
626
624
|
function issueRuntimeMcpToken(ctx) {
|
|
627
625
|
const payloadPart = encodeTokenPart({
|
|
@@ -773,9 +771,9 @@ function createBackgroundBashManager(options = {}) {
|
|
|
773
771
|
const knownContexts = new Map;
|
|
774
772
|
const runtimeCapability = options.capability ?? randomBytes(32).toString("hex");
|
|
775
773
|
const runtimeServerId = options.serverId ?? randomBytes(16).toString("hex");
|
|
776
|
-
const bashRsBin = options.bashRsBin ??
|
|
777
|
-
const basePort = options.basePort ??
|
|
778
|
-
const maxPort = options.maxPort ??
|
|
774
|
+
const bashRsBin = options.bashRsBin ?? BASH_RS_BIN2;
|
|
775
|
+
const basePort = options.basePort ?? BG_BASH_BASE_PORT2;
|
|
776
|
+
const maxPort = options.maxPort ?? BG_BASH_MAX_PORT2;
|
|
779
777
|
const fetchImpl = options.fetch ?? globalThis.fetch;
|
|
780
778
|
const now = options.now ?? Date.now;
|
|
781
779
|
const wait = options.delay ?? delay;
|
|
@@ -832,7 +830,7 @@ function createBackgroundBashManager(options = {}) {
|
|
|
832
830
|
}
|
|
833
831
|
async function spawnServer(key, reservedPort, excludedPorts = new Set) {
|
|
834
832
|
if (!bashRsBin) {
|
|
835
|
-
throw new Error(`background-bash requires the bash-rs ${
|
|
833
|
+
throw new Error(`background-bash requires the bash-rs ${BASH_RS_VERSION2} binary; run install-bash-rs.mjs (or set NEGOTIUM_BASH_RS_BIN)`);
|
|
836
834
|
}
|
|
837
835
|
const port = reservedPort ?? await allocatePort(excludedPorts);
|
|
838
836
|
const process2 = spawnImpl(bashRsBin, [String(port)], {
|
|
@@ -845,7 +843,7 @@ function createBackgroundBashManager(options = {}) {
|
|
|
845
843
|
NEGOTIUM_BG_BASH_SERVER_ID: runtimeServerId,
|
|
846
844
|
BASHRS_HTTP_CAPABILITY: runtimeCapability,
|
|
847
845
|
BASHRS_INSTANCE_ID: runtimeServerId,
|
|
848
|
-
BASHRS_SPILL_ROOT
|
|
846
|
+
BASHRS_SPILL_ROOT: BASHRS_SPILL_ROOT2
|
|
849
847
|
}
|
|
850
848
|
});
|
|
851
849
|
process2.once("error", (error) => {
|
|
@@ -932,12 +930,12 @@ function createBackgroundBashManager(options = {}) {
|
|
|
932
930
|
usedPorts.clear();
|
|
933
931
|
knownContexts.clear();
|
|
934
932
|
const deadline = now() + 3000;
|
|
935
|
-
await Promise.all(entries.map((instance) => new Promise((
|
|
933
|
+
await Promise.all(entries.map((instance) => new Promise((resolve) => {
|
|
936
934
|
if (instance.process.exitCode !== null || instance.process.killed)
|
|
937
|
-
return
|
|
938
|
-
instance.process.once("exit",
|
|
939
|
-
instance.process.once("error",
|
|
940
|
-
const timer = setTimeout(
|
|
935
|
+
return resolve();
|
|
936
|
+
instance.process.once("exit", resolve);
|
|
937
|
+
instance.process.once("error", resolve);
|
|
938
|
+
const timer = setTimeout(resolve, Math.max(0, deadline - now()));
|
|
941
939
|
timer.unref?.();
|
|
942
940
|
})));
|
|
943
941
|
}
|
|
@@ -1370,7 +1368,7 @@ var SCHEMA_TRIGGERS = {
|
|
|
1370
1368
|
};
|
|
1371
1369
|
var OTIUM_TOPIC_SCOPE_IMMUTABLE_ERROR = "otium_topic_scope_immutable";
|
|
1372
1370
|
function topicLinkSchemaIsCurrent(database, nodeId) {
|
|
1373
|
-
const objects = new Map(database.query("SELECT name, sql FROM sqlite_master WHERE type IN ('table','index','trigger')").all().map((
|
|
1371
|
+
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 ?? ""]));
|
|
1374
1372
|
for (const name of [...SCHEMA_TABLES, ...SCHEMA_INDEXES, ...SCHEMA_INDEXES_TOMBSTONES]) {
|
|
1375
1373
|
if (!objects.has(name))
|
|
1376
1374
|
return false;
|
|
@@ -1387,7 +1385,7 @@ function topicLinkSchemaIsCurrent(database, nodeId) {
|
|
|
1387
1385
|
return false;
|
|
1388
1386
|
}
|
|
1389
1387
|
const identity = database.query("SELECT node_id, epoch_id FROM api_node_identity WHERE singleton = 1").all();
|
|
1390
|
-
if (identity.some((
|
|
1388
|
+
if (identity.some((row) => row.epoch_id === null))
|
|
1391
1389
|
return false;
|
|
1392
1390
|
if (nodeId && identity[0]?.node_id !== nodeId)
|
|
1393
1391
|
return false;
|
|
@@ -2211,8 +2209,8 @@ function buildStdioMcpServer(agent, serverFile, serverArgs, env) {
|
|
|
2211
2209
|
if (agent === "codex") {
|
|
2212
2210
|
return {
|
|
2213
2211
|
command: "node",
|
|
2214
|
-
args: ["--import",
|
|
2215
|
-
env: { TSX_TSCONFIG_PATH:
|
|
2212
|
+
args: ["--import", TSX_LOADER2, serverFile, ...serverArgs],
|
|
2213
|
+
env: { TSX_TSCONFIG_PATH: TSCONFIG_PATH2, ...env }
|
|
2216
2214
|
};
|
|
2217
2215
|
}
|
|
2218
2216
|
return {
|
|
@@ -2222,12 +2220,12 @@ function buildStdioMcpServer(agent, serverFile, serverArgs, env) {
|
|
|
2222
2220
|
};
|
|
2223
2221
|
}
|
|
2224
2222
|
function useHostedBuiltinMcp() {
|
|
2225
|
-
return
|
|
2223
|
+
return envText2("NEGOTIUM_BUILTIN_MCP_TRANSPORT") !== "stdio";
|
|
2226
2224
|
}
|
|
2227
2225
|
function buildBuiltinMcpServer(surface, ctx, stdio) {
|
|
2228
2226
|
if (!useHostedBuiltinMcp())
|
|
2229
2227
|
return stdio();
|
|
2230
|
-
const agent = ctx.agent ??
|
|
2228
|
+
const agent = ctx.agent ?? FALLBACK_AGENT2;
|
|
2231
2229
|
return buildHostedMcpSpec(agent, surface, {
|
|
2232
2230
|
userId: ctx.userId,
|
|
2233
2231
|
...ctx.actorUserId ? { actorUserId: ctx.actorUserId } : {},
|
|
@@ -2239,7 +2237,7 @@ function buildBuiltinMcpServer(surface, ctx, stdio) {
|
|
|
2239
2237
|
...ctx.wikiTopicId ? { wikiTopicId: ctx.wikiTopicId } : {},
|
|
2240
2238
|
...ctx.subagentParentTopicId ? { subagentParentTopicId: ctx.subagentParentTopicId } : {},
|
|
2241
2239
|
...ctx.threadRootId ? { threadRootId: ctx.threadRootId } : {},
|
|
2242
|
-
cwd: ctx.cwd ?? (ctx.topicId ?
|
|
2240
|
+
cwd: ctx.cwd ?? (ctx.topicId ? resolveTopicWorkspaceDir2(ctx.topicId) : process.cwd()),
|
|
2243
2241
|
agent,
|
|
2244
2242
|
...ctx.model ? { model: ctx.model } : {},
|
|
2245
2243
|
...ctx.depth !== undefined ? { depth: ctx.depth } : {},
|
|
@@ -2352,7 +2350,7 @@ var MCP_CATALOG = {
|
|
|
2352
2350
|
topicId,
|
|
2353
2351
|
topicTitle: session,
|
|
2354
2352
|
queryId,
|
|
2355
|
-
cwd: cwd ??
|
|
2353
|
+
cwd: cwd ?? resolveTopicWorkspaceDir2(topicId),
|
|
2356
2354
|
agent,
|
|
2357
2355
|
model,
|
|
2358
2356
|
...switchTargets.length ? { explicitAgentSwitchTargets: switchTargets } : {},
|
|
@@ -2367,7 +2365,7 @@ var MCP_CATALOG = {
|
|
|
2367
2365
|
"token-stats": {
|
|
2368
2366
|
...commonRuntimeMcpPolicy("token-stats"),
|
|
2369
2367
|
build(ctx) {
|
|
2370
|
-
return buildBuiltinMcpServer("token-stats", ctx, () => buildStdioMcpServer(ctx.agent,
|
|
2368
|
+
return buildBuiltinMcpServer("token-stats", ctx, () => buildStdioMcpServer(ctx.agent, TOKEN_STATS_SERVER2, [`--user-id=${ctx.userId}`]));
|
|
2371
2369
|
}
|
|
2372
2370
|
},
|
|
2373
2371
|
task: {
|
|
@@ -2377,19 +2375,19 @@ var MCP_CATALOG = {
|
|
|
2377
2375
|
if (peerBridge) {
|
|
2378
2376
|
if (!topicId || !queryId)
|
|
2379
2377
|
return null;
|
|
2380
|
-
const env =
|
|
2378
|
+
const env = canonicalMcpBridgeEnv2({
|
|
2381
2379
|
surface: "task",
|
|
2382
2380
|
userId,
|
|
2383
2381
|
topicId,
|
|
2384
2382
|
queryId,
|
|
2385
2383
|
peerBridge
|
|
2386
2384
|
});
|
|
2387
|
-
return env ? buildStdioMcpServer(agent,
|
|
2385
|
+
return env ? buildStdioMcpServer(agent, CANONICAL_MCP_PROXY_SERVER2, ["--surface=task"], env) : null;
|
|
2388
2386
|
}
|
|
2389
2387
|
const args = [`--user-id=${userId}`, `--topic=${session}`];
|
|
2390
2388
|
if (topicId)
|
|
2391
2389
|
args.push(`--topic-id=${topicId}`);
|
|
2392
|
-
return buildBuiltinMcpServer("task", ctx, () => buildStdioMcpServer(agent,
|
|
2390
|
+
return buildBuiltinMcpServer("task", ctx, () => buildStdioMcpServer(agent, TASK_SERVER2, args));
|
|
2393
2391
|
}
|
|
2394
2392
|
},
|
|
2395
2393
|
decision: {
|
|
@@ -2399,25 +2397,25 @@ var MCP_CATALOG = {
|
|
|
2399
2397
|
if (peerBridge) {
|
|
2400
2398
|
if (!topicId || !queryId)
|
|
2401
2399
|
return null;
|
|
2402
|
-
const env =
|
|
2400
|
+
const env = canonicalMcpBridgeEnv2({
|
|
2403
2401
|
surface: "decision",
|
|
2404
2402
|
userId,
|
|
2405
2403
|
topicId,
|
|
2406
2404
|
queryId,
|
|
2407
2405
|
peerBridge
|
|
2408
2406
|
});
|
|
2409
|
-
return env ? buildStdioMcpServer(agent,
|
|
2407
|
+
return env ? buildStdioMcpServer(agent, CANONICAL_MCP_PROXY_SERVER2, ["--surface=decision"], env) : null;
|
|
2410
2408
|
}
|
|
2411
2409
|
const args = [
|
|
2412
2410
|
`--user-id=${userId}`,
|
|
2413
2411
|
`--topic=${session}`,
|
|
2414
|
-
`--agent=${agent ??
|
|
2412
|
+
`--agent=${agent ?? FALLBACK_AGENT2}`
|
|
2415
2413
|
];
|
|
2416
2414
|
if (topicId)
|
|
2417
2415
|
args.push(`--topic-id=${topicId}`);
|
|
2418
2416
|
if (model)
|
|
2419
2417
|
args.push(`--model=${model}`);
|
|
2420
|
-
return buildBuiltinMcpServer("decision", ctx, () => buildStdioMcpServer(agent,
|
|
2418
|
+
return buildBuiltinMcpServer("decision", ctx, () => buildStdioMcpServer(agent, DECISION_SERVER2, args));
|
|
2421
2419
|
}
|
|
2422
2420
|
},
|
|
2423
2421
|
"session-history": {
|
|
@@ -2427,19 +2425,19 @@ var MCP_CATALOG = {
|
|
|
2427
2425
|
if (peerBridge) {
|
|
2428
2426
|
if (!topicId || !queryId)
|
|
2429
2427
|
return null;
|
|
2430
|
-
const env =
|
|
2428
|
+
const env = canonicalMcpBridgeEnv2({
|
|
2431
2429
|
surface: "session-history",
|
|
2432
2430
|
userId,
|
|
2433
2431
|
topicId,
|
|
2434
2432
|
queryId,
|
|
2435
2433
|
peerBridge
|
|
2436
2434
|
});
|
|
2437
|
-
return env ? buildStdioMcpServer(agent,
|
|
2435
|
+
return env ? buildStdioMcpServer(agent, CANONICAL_MCP_PROXY_SERVER2, ["--surface=session-history"], env) : null;
|
|
2438
2436
|
}
|
|
2439
2437
|
const args = [`--user-id=${userId}`, `--topic=${session}`];
|
|
2440
2438
|
if (topicId)
|
|
2441
2439
|
args.push(`--topic-id=${topicId}`);
|
|
2442
|
-
return buildBuiltinMcpServer("session-history", ctx, () => buildStdioMcpServer(agent,
|
|
2440
|
+
return buildBuiltinMcpServer("session-history", ctx, () => buildStdioMcpServer(agent, SESSION_HISTORY_SERVER2, args));
|
|
2443
2441
|
}
|
|
2444
2442
|
},
|
|
2445
2443
|
"session-comm": {
|
|
@@ -2459,7 +2457,7 @@ var MCP_CATALOG = {
|
|
|
2459
2457
|
threadRootId,
|
|
2460
2458
|
peerBridge
|
|
2461
2459
|
} = ctx;
|
|
2462
|
-
const effectiveAgent = agent ??
|
|
2460
|
+
const effectiveAgent = agent ?? FALLBACK_AGENT2;
|
|
2463
2461
|
const cronSessionId = topicId ? getRegisteredCronSession(topicId, effectiveAgent)?.sessionId : undefined;
|
|
2464
2462
|
const args = [
|
|
2465
2463
|
`--user-id=${userId}`,
|
|
@@ -2479,7 +2477,7 @@ var MCP_CATALOG = {
|
|
|
2479
2477
|
...threadRootId ? [`--thread-root-id=${threadRootId}`] : [],
|
|
2480
2478
|
...peerBridge ? [`--peer-host-query-id=${peerBridge.hostQueryId}`] : []
|
|
2481
2479
|
];
|
|
2482
|
-
return buildBuiltinMcpServer("session-comm", ctx, () => buildStdioMcpServer(effectiveAgent,
|
|
2480
|
+
return buildBuiltinMcpServer("session-comm", ctx, () => buildStdioMcpServer(effectiveAgent, SESSION_COMM_SERVER2, args, peerBridge ? peerSessionBridgeIpcEnv() : undefined));
|
|
2483
2481
|
}
|
|
2484
2482
|
},
|
|
2485
2483
|
wiki: {
|
|
@@ -2489,14 +2487,14 @@ var MCP_CATALOG = {
|
|
|
2489
2487
|
if (peerBridge) {
|
|
2490
2488
|
if (!topicId || !queryId)
|
|
2491
2489
|
return null;
|
|
2492
|
-
const env =
|
|
2490
|
+
const env = canonicalMcpBridgeEnv2({
|
|
2493
2491
|
surface: "wiki",
|
|
2494
2492
|
userId,
|
|
2495
2493
|
topicId,
|
|
2496
2494
|
queryId,
|
|
2497
2495
|
peerBridge
|
|
2498
2496
|
});
|
|
2499
|
-
return env ? buildStdioMcpServer(agent,
|
|
2497
|
+
return env ? buildStdioMcpServer(agent, CANONICAL_MCP_PROXY_SERVER2, ["--surface=wiki"], env) : null;
|
|
2500
2498
|
}
|
|
2501
2499
|
const args = [`--user-id=${userId}`];
|
|
2502
2500
|
if (topicId)
|
|
@@ -2505,7 +2503,7 @@ var MCP_CATALOG = {
|
|
|
2505
2503
|
if (resolvedWikiTopicId)
|
|
2506
2504
|
args.push(`--topic-id=${resolvedWikiTopicId}`);
|
|
2507
2505
|
args.push("--surface=wiki");
|
|
2508
|
-
return buildBuiltinMcpServer("wiki", { ...ctx, wikiTopicId: resolvedWikiTopicId }, () => buildStdioMcpServer(agent,
|
|
2506
|
+
return buildBuiltinMcpServer("wiki", { ...ctx, wikiTopicId: resolvedWikiTopicId }, () => buildStdioMcpServer(agent, WIKI_SERVER2, args));
|
|
2509
2507
|
}
|
|
2510
2508
|
},
|
|
2511
2509
|
skills: {
|
|
@@ -2515,13 +2513,13 @@ var MCP_CATALOG = {
|
|
|
2515
2513
|
const args = [`--user-id=${userId}`, "--surface=skills"];
|
|
2516
2514
|
if (topicId)
|
|
2517
2515
|
args.push(`--topic-id=${topicId}`);
|
|
2518
|
-
return buildBuiltinMcpServer("skills", ctx, () => buildStdioMcpServer(agent,
|
|
2516
|
+
return buildBuiltinMcpServer("skills", ctx, () => buildStdioMcpServer(agent, WIKI_SERVER2, args));
|
|
2519
2517
|
}
|
|
2520
2518
|
},
|
|
2521
2519
|
"system-health": {
|
|
2522
2520
|
...commonRuntimeMcpPolicy("system-health"),
|
|
2523
2521
|
build(ctx) {
|
|
2524
|
-
return buildBuiltinMcpServer("system-health", ctx, () => buildStdioMcpServer(ctx.agent,
|
|
2522
|
+
return buildBuiltinMcpServer("system-health", ctx, () => buildStdioMcpServer(ctx.agent, SYSTEM_HEALTH_SERVER2, []));
|
|
2525
2523
|
}
|
|
2526
2524
|
},
|
|
2527
2525
|
"background-bash": {
|
|
@@ -2537,7 +2535,7 @@ var MCP_CATALOG = {
|
|
|
2537
2535
|
build(ctx) {
|
|
2538
2536
|
const { userId, agent } = ctx;
|
|
2539
2537
|
const args = [`--user-id=${userId}`];
|
|
2540
|
-
return buildBuiltinMcpServer("agent-health", ctx, () => buildStdioMcpServer(agent,
|
|
2538
|
+
return buildBuiltinMcpServer("agent-health", ctx, () => buildStdioMcpServer(agent, AGENT_HEALTH_SERVER2, args));
|
|
2541
2539
|
}
|
|
2542
2540
|
},
|
|
2543
2541
|
vault: {
|
|
@@ -2547,7 +2545,7 @@ var MCP_CATALOG = {
|
|
|
2547
2545
|
const args = [`--user-id=${vaultUserId ?? userId}`];
|
|
2548
2546
|
if (agent !== "codex")
|
|
2549
2547
|
args.push("--list-only=true");
|
|
2550
|
-
return buildBuiltinMcpServer("vault", { ...ctx, userId: vaultUserId ?? userId }, () => buildStdioMcpServer(agent,
|
|
2548
|
+
return buildBuiltinMcpServer("vault", { ...ctx, userId: vaultUserId ?? userId }, () => buildStdioMcpServer(agent, VAULT_SERVER2, args));
|
|
2551
2549
|
}
|
|
2552
2550
|
},
|
|
2553
2551
|
"cua-rs": {
|
|
@@ -2896,16 +2894,16 @@ function decryptVaultValueWithKey(userId, key, storedValue, masterKey) {
|
|
|
2896
2894
|
}
|
|
2897
2895
|
|
|
2898
2896
|
// ../../packages/core/src/storage/vault-crypto.ts
|
|
2899
|
-
function encryptVaultValue(userId, key, value, masterKey =
|
|
2897
|
+
function encryptVaultValue(userId, key, value, masterKey = VAULT_MASTER_KEY2) {
|
|
2900
2898
|
return encryptVaultValueWithKey(userId, key, value, masterKey);
|
|
2901
2899
|
}
|
|
2902
|
-
function decryptVaultValue(userId, key, storedValue, masterKey =
|
|
2900
|
+
function decryptVaultValue(userId, key, storedValue, masterKey = VAULT_MASTER_KEY2) {
|
|
2903
2901
|
return decryptVaultValueWithKey(userId, key, storedValue, masterKey);
|
|
2904
2902
|
}
|
|
2905
2903
|
|
|
2906
2904
|
// ../../packages/core/src/storage/vault.ts
|
|
2907
2905
|
var vaultDb;
|
|
2908
|
-
var vaultMasterKey =
|
|
2906
|
+
var vaultMasterKey = VAULT_MASTER_KEY2;
|
|
2909
2907
|
function initializeVaultDatabase(database) {
|
|
2910
2908
|
database.exec("PRAGMA journal_mode = WAL");
|
|
2911
2909
|
database.exec("PRAGMA busy_timeout = 5000");
|
|
@@ -3045,8 +3043,8 @@ var defaultHost = {
|
|
|
3045
3043
|
redactVaultSecrets,
|
|
3046
3044
|
substituteVaultSecrets: (userId, value) => vaultSubstituteDetailed(userId, value).text,
|
|
3047
3045
|
referencesRuntimeSecretStorage,
|
|
3048
|
-
claudeCodeExecutablePath: () =>
|
|
3049
|
-
codexAuthFilePath
|
|
3046
|
+
claudeCodeExecutablePath: () => CLAUDE_EXECUTABLE2,
|
|
3047
|
+
codexAuthFilePath: codexAuthFilePath2
|
|
3050
3048
|
};
|
|
3051
3049
|
var hostRegistrations = [];
|
|
3052
3050
|
var scopedHost = new AsyncLocalStorage;
|
|
@@ -3111,7 +3109,7 @@ function hostedCodexHomePath() {
|
|
|
3111
3109
|
|
|
3112
3110
|
// ../../packages/core/src/media/file-events.ts
|
|
3113
3111
|
function* extractFileEvents(text, source) {
|
|
3114
|
-
const tagRegex = new RegExp(
|
|
3112
|
+
const tagRegex = new RegExp(FILE_TAG_REGEX2.source, "gi");
|
|
3115
3113
|
let match = tagRegex.exec(text);
|
|
3116
3114
|
while (match !== null) {
|
|
3117
3115
|
yield { type: "file", path: match[1], source, origin: "tag" };
|
|
@@ -3203,10 +3201,54 @@ function isClaudeImageAttachment(attachment) {
|
|
|
3203
3201
|
async function* singleUserMessage(message) {
|
|
3204
3202
|
yield message;
|
|
3205
3203
|
}
|
|
3204
|
+
var textUserMessage = (text) => ({
|
|
3205
|
+
type: "user",
|
|
3206
|
+
message: { role: "user", content: text },
|
|
3207
|
+
parent_tool_use_id: null
|
|
3208
|
+
});
|
|
3209
|
+
function liveTurnInput(first) {
|
|
3210
|
+
const waiting = [];
|
|
3211
|
+
let wake;
|
|
3212
|
+
let ended = false;
|
|
3213
|
+
async function* stream() {
|
|
3214
|
+
yield first;
|
|
3215
|
+
for (;; ) {
|
|
3216
|
+
while (waiting.length > 0)
|
|
3217
|
+
yield waiting.shift();
|
|
3218
|
+
if (ended)
|
|
3219
|
+
return;
|
|
3220
|
+
await new Promise((resolve) => {
|
|
3221
|
+
wake = resolve;
|
|
3222
|
+
});
|
|
3223
|
+
}
|
|
3224
|
+
}
|
|
3225
|
+
const nudge = () => {
|
|
3226
|
+
wake?.();
|
|
3227
|
+
wake = undefined;
|
|
3228
|
+
};
|
|
3229
|
+
return {
|
|
3230
|
+
stream: stream(),
|
|
3231
|
+
push(message) {
|
|
3232
|
+
if (ended)
|
|
3233
|
+
return false;
|
|
3234
|
+
waiting.push(message);
|
|
3235
|
+
nudge();
|
|
3236
|
+
return true;
|
|
3237
|
+
},
|
|
3238
|
+
end() {
|
|
3239
|
+
ended = true;
|
|
3240
|
+
nudge();
|
|
3241
|
+
}
|
|
3242
|
+
};
|
|
3243
|
+
}
|
|
3206
3244
|
function buildClaudePrompt(opts) {
|
|
3245
|
+
const message = buildClaudeUserMessage(opts);
|
|
3246
|
+
return message ? singleUserMessage(message) : opts.prompt;
|
|
3247
|
+
}
|
|
3248
|
+
function buildClaudeUserMessage(opts) {
|
|
3207
3249
|
const attachments = opts.attachments ?? [];
|
|
3208
3250
|
if (attachments.length === 0)
|
|
3209
|
-
return
|
|
3251
|
+
return;
|
|
3210
3252
|
const imageBlocks = [];
|
|
3211
3253
|
for (const attachment of attachments) {
|
|
3212
3254
|
if (!isClaudeImageAttachment(attachment))
|
|
@@ -3238,23 +3280,23 @@ function buildClaudePrompt(opts) {
|
|
|
3238
3280
|
}
|
|
3239
3281
|
}
|
|
3240
3282
|
if (imageBlocks.length === 0)
|
|
3241
|
-
return
|
|
3283
|
+
return;
|
|
3242
3284
|
const content = [{ type: "text", text: opts.prompt }, ...imageBlocks];
|
|
3243
|
-
return
|
|
3285
|
+
return {
|
|
3244
3286
|
type: "user",
|
|
3245
3287
|
message: {
|
|
3246
3288
|
role: "user",
|
|
3247
3289
|
content
|
|
3248
3290
|
},
|
|
3249
3291
|
parent_tool_use_id: null
|
|
3250
|
-
}
|
|
3292
|
+
};
|
|
3251
3293
|
}
|
|
3252
3294
|
var CLAUDE_ABORT_SIGKILL_DELAY_MS = 2500;
|
|
3253
3295
|
var claudeProcessExitListeners = new WeakMap;
|
|
3254
3296
|
function watchClaudeProcessExit(signal) {
|
|
3255
3297
|
let listener;
|
|
3256
|
-
const exited = new Promise((
|
|
3257
|
-
listener =
|
|
3298
|
+
const exited = new Promise((resolve) => {
|
|
3299
|
+
listener = resolve;
|
|
3258
3300
|
const listeners = claudeProcessExitListeners.get(signal) ?? new Set;
|
|
3259
3301
|
listeners.add(listener);
|
|
3260
3302
|
claudeProcessExitListeners.set(signal, listeners);
|
|
@@ -3524,8 +3566,27 @@ async function* claudeProvider(opts) {
|
|
|
3524
3566
|
lastThinkingBeat = now;
|
|
3525
3567
|
return { type: "tool_progress", toolName: "thinking", elapsed: (now - thinkingStart) / 1000 };
|
|
3526
3568
|
};
|
|
3569
|
+
const live = opts.midTurn ? liveTurnInput(buildClaudeUserMessage(opts) ?? textUserMessage(opts.prompt)) : undefined;
|
|
3570
|
+
const midTurnIds = new Map;
|
|
3571
|
+
let midTurnClosed = false;
|
|
3572
|
+
const closeMidTurn = (readUuids) => {
|
|
3573
|
+
if (!opts.midTurn || midTurnClosed)
|
|
3574
|
+
return;
|
|
3575
|
+
midTurnClosed = true;
|
|
3576
|
+
live?.end();
|
|
3577
|
+
opts.midTurn.close(readUuids.flatMap((uuid) => midTurnIds.get(uuid) ?? []));
|
|
3578
|
+
};
|
|
3579
|
+
opts.midTurn?.open((message) => {
|
|
3580
|
+
if (!live || midTurnClosed)
|
|
3581
|
+
return false;
|
|
3582
|
+
const uuid = randomUUID();
|
|
3583
|
+
if (!live.push({ ...textUserMessage(message.text), priority: "next", uuid }))
|
|
3584
|
+
return false;
|
|
3585
|
+
midTurnIds.set(uuid, message.id);
|
|
3586
|
+
return true;
|
|
3587
|
+
});
|
|
3527
3588
|
try {
|
|
3528
|
-
const prompt = buildClaudePrompt(opts);
|
|
3589
|
+
const prompt = live ? live.stream : buildClaudePrompt(opts);
|
|
3529
3590
|
for await (const message of query({
|
|
3530
3591
|
prompt,
|
|
3531
3592
|
options: queryOptions
|
|
@@ -3583,6 +3644,7 @@ async function* claudeProvider(opts) {
|
|
|
3583
3644
|
}
|
|
3584
3645
|
if (message.type === "result") {
|
|
3585
3646
|
const m = message;
|
|
3647
|
+
closeMidTurn(m.user_message_uuids ?? []);
|
|
3586
3648
|
if (m.subtype === "success") {
|
|
3587
3649
|
const contextWindow = (lastContextModel ? m.modelUsage?.[lastContextModel]?.contextWindow : undefined) ?? Object.values(m.modelUsage ?? {})[0]?.contextWindow;
|
|
3588
3650
|
yield {
|
|
@@ -3682,6 +3744,7 @@ async function* claudeProvider(opts) {
|
|
|
3682
3744
|
logger.error({ err: e }, "claudeProvider: SDK iteration failed");
|
|
3683
3745
|
yield { type: "error", content: errMsg(e) };
|
|
3684
3746
|
} finally {
|
|
3747
|
+
closeMidTurn([]);
|
|
3685
3748
|
processExitWatch.dispose();
|
|
3686
3749
|
opts.abortController?.signal.removeEventListener("abort", onCallerAbort);
|
|
3687
3750
|
}
|
|
@@ -3696,7 +3759,7 @@ import { Codex } from "@openai/codex-sdk";
|
|
|
3696
3759
|
|
|
3697
3760
|
// ../../packages/core/src/agents/codex-native-multi-agent.ts
|
|
3698
3761
|
import { spawn as spawn3 } from "child_process";
|
|
3699
|
-
import { randomUUID } from "crypto";
|
|
3762
|
+
import { randomUUID as randomUUID2 } from "crypto";
|
|
3700
3763
|
import {
|
|
3701
3764
|
chmodSync as chmodSync2,
|
|
3702
3765
|
copyFileSync,
|
|
@@ -3713,7 +3776,7 @@ import { dirname as dirname5, join as join3 } from "path";
|
|
|
3713
3776
|
import { fileURLToPath } from "url";
|
|
3714
3777
|
|
|
3715
3778
|
// ../../packages/core/src/version.ts
|
|
3716
|
-
var NEGOTIUM_VERSION = "0.23.
|
|
3779
|
+
var NEGOTIUM_VERSION = "0.23.13";
|
|
3717
3780
|
|
|
3718
3781
|
// ../../packages/core/src/agents/codex-native-multi-agent.ts
|
|
3719
3782
|
function findPackageJson(specifier, searchFromDir) {
|
|
@@ -3773,7 +3836,7 @@ function readCompatibleCodexModelCache(cachePath) {
|
|
|
3773
3836
|
function writePrivateFileAtomic(path, contents) {
|
|
3774
3837
|
if (existsSync2(path) && readFileSync3(path, "utf8") === contents)
|
|
3775
3838
|
return;
|
|
3776
|
-
const tempPath = `${path}.${process.pid}.${
|
|
3839
|
+
const tempPath = `${path}.${process.pid}.${randomUUID2()}.tmp`;
|
|
3777
3840
|
try {
|
|
3778
3841
|
writeFileSync2(tempPath, contents, { encoding: "utf8", mode: 384 });
|
|
3779
3842
|
renameSync2(tempPath, path);
|
|
@@ -3793,7 +3856,7 @@ async function bootstrapCodexModelCache(codexHome, cachePath) {
|
|
|
3793
3856
|
stdio: ["pipe", "pipe", "pipe"],
|
|
3794
3857
|
windowsHide: true
|
|
3795
3858
|
});
|
|
3796
|
-
const refreshed = new Promise((
|
|
3859
|
+
const refreshed = new Promise((resolve, reject) => {
|
|
3797
3860
|
let settled = false;
|
|
3798
3861
|
let stdoutBuffer = "";
|
|
3799
3862
|
let stderr = "";
|
|
@@ -3812,7 +3875,7 @@ async function bootstrapCodexModelCache(codexHome, cachePath) {
|
|
|
3812
3875
|
else if (!existsSync2(cachePath))
|
|
3813
3876
|
reject(new Error("Codex did not create its model cache"));
|
|
3814
3877
|
else
|
|
3815
|
-
|
|
3878
|
+
resolve();
|
|
3816
3879
|
};
|
|
3817
3880
|
const send = (message) => {
|
|
3818
3881
|
child.stdin.write(`${JSON.stringify(message)}
|
|
@@ -3879,12 +3942,12 @@ var CODEX_BOOTSTRAP_EXIT_WAIT_MS = 3000;
|
|
|
3879
3942
|
function waitForChildExit(child, timeoutMs) {
|
|
3880
3943
|
if (child.exitCode !== null || child.signalCode !== null)
|
|
3881
3944
|
return Promise.resolve();
|
|
3882
|
-
return new Promise((
|
|
3883
|
-
const timer = setTimeout(
|
|
3945
|
+
return new Promise((resolve) => {
|
|
3946
|
+
const timer = setTimeout(resolve, timeoutMs);
|
|
3884
3947
|
timer.unref?.();
|
|
3885
3948
|
child.once("exit", () => {
|
|
3886
3949
|
clearTimeout(timer);
|
|
3887
|
-
|
|
3950
|
+
resolve();
|
|
3888
3951
|
});
|
|
3889
3952
|
});
|
|
3890
3953
|
}
|
|
@@ -4082,12 +4145,12 @@ function createCodexTreeManager(host, options = {}) {
|
|
|
4082
4145
|
const previous = spawnChain;
|
|
4083
4146
|
let release;
|
|
4084
4147
|
let released = false;
|
|
4085
|
-
spawnChain = new Promise((
|
|
4148
|
+
spawnChain = new Promise((resolve) => {
|
|
4086
4149
|
release = () => {
|
|
4087
4150
|
if (released)
|
|
4088
4151
|
return;
|
|
4089
4152
|
released = true;
|
|
4090
|
-
|
|
4153
|
+
resolve();
|
|
4091
4154
|
};
|
|
4092
4155
|
});
|
|
4093
4156
|
await previous;
|
|
@@ -4194,7 +4257,7 @@ function createCodexTreeManager(host, options = {}) {
|
|
|
4194
4257
|
return;
|
|
4195
4258
|
const deadline = Date.now() + Math.max(0, graceMs);
|
|
4196
4259
|
while (Date.now() < deadline && hasSurvivors(plan.targets)) {
|
|
4197
|
-
await new Promise((
|
|
4260
|
+
await new Promise((resolve) => setTimeout(resolve, Math.min(100, Math.max(1, deadline - Date.now()))));
|
|
4198
4261
|
}
|
|
4199
4262
|
killStragglers(plan);
|
|
4200
4263
|
}
|
|
@@ -4257,7 +4320,7 @@ import { fileURLToPath as fileURLToPath2 } from "url";
|
|
|
4257
4320
|
|
|
4258
4321
|
// ../../packages/core/src/agents/codex-windows-wrapper.ts
|
|
4259
4322
|
import { execFile } from "child_process";
|
|
4260
|
-
import { createHash as createHash3, randomUUID as
|
|
4323
|
+
import { createHash as createHash3, randomUUID as randomUUID3 } from "crypto";
|
|
4261
4324
|
import { existsSync as existsSync3 } from "fs";
|
|
4262
4325
|
import { mkdir, rename, rm, writeFile } from "fs/promises";
|
|
4263
4326
|
import { join as join4 } from "path";
|
|
@@ -4364,7 +4427,7 @@ async function ensureCodexWindowsWrapperExe(cacheDir) {
|
|
|
4364
4427
|
if (existsSync3(exePath))
|
|
4365
4428
|
return exePath;
|
|
4366
4429
|
await mkdir(cacheDir, { recursive: true });
|
|
4367
|
-
const stamp =
|
|
4430
|
+
const stamp = randomUUID3();
|
|
4368
4431
|
const sourcePath = join4(cacheDir, `wrapper-${stamp}.cs`);
|
|
4369
4432
|
const tempExe = join4(cacheDir, `wrapper-${stamp}.exe`);
|
|
4370
4433
|
try {
|
|
@@ -4518,7 +4581,7 @@ async function createCodexVaultHookBridge(userId) {
|
|
|
4518
4581
|
});
|
|
4519
4582
|
restrictIpcEndpoint(socketPath);
|
|
4520
4583
|
if (IS_WINDOWS2) {
|
|
4521
|
-
const { BINARIES_DIR } = await import("./chunk-
|
|
4584
|
+
const { BINARIES_DIR } = await import("./chunk-22kg3fsw.js");
|
|
4522
4585
|
const cached = await ensureCodexWindowsWrapperExe(join5(BINARIES_DIR, "codex-hook-wrapper"));
|
|
4523
4586
|
await copyFile(cached, wrapperPath);
|
|
4524
4587
|
await writeFile2(join5(root, "codex-with-hooks.cfg"), [process.execPath, codexCliScriptPath(), socketPath, token].join(`
|
|
@@ -5308,9 +5371,9 @@ async function startStreamedWithTracking(thread, prompt, abortSignal, trackedPid
|
|
|
5308
5371
|
nextP.catch(() => {});
|
|
5309
5372
|
first = await Promise.race([nextP, startupTimeout]);
|
|
5310
5373
|
} catch (err) {
|
|
5311
|
-
const
|
|
5312
|
-
if (
|
|
5313
|
-
killCodexTrees(
|
|
5374
|
+
const novel = findNewCodexChildren(baseline);
|
|
5375
|
+
if (novel.length > 0) {
|
|
5376
|
+
killCodexTrees(novel);
|
|
5314
5377
|
}
|
|
5315
5378
|
await closeIterator(iter);
|
|
5316
5379
|
throw err;
|
|
@@ -5799,7 +5862,7 @@ function buildProviderOwnedToolBlockHook() {
|
|
|
5799
5862
|
}
|
|
5800
5863
|
};
|
|
5801
5864
|
}
|
|
5802
|
-
var MAESTRO_TOOL_OUTPUT_DIR = resolve8(
|
|
5865
|
+
var MAESTRO_TOOL_OUTPUT_DIR = resolve8(RUN_DIR2, "maestro-tool-outputs");
|
|
5803
5866
|
function buildMaestroToolResultTruncation(opts) {
|
|
5804
5867
|
if (opts.toolResultTruncation)
|
|
5805
5868
|
return opts.toolResultTruncation;
|
|
@@ -5893,7 +5956,7 @@ async function* runHostedAgent(input, host) {
|
|
|
5893
5956
|
}
|
|
5894
5957
|
} finally {
|
|
5895
5958
|
if (opts.userId && opts.topicId && opts.queryId && opts.peerBridge) {
|
|
5896
|
-
|
|
5959
|
+
revokeCanonicalMcpBridgeTurn2({
|
|
5897
5960
|
userId: opts.userId,
|
|
5898
5961
|
topicId: opts.topicId,
|
|
5899
5962
|
queryId: opts.queryId,
|
|
@@ -5903,17 +5966,17 @@ async function* runHostedAgent(input, host) {
|
|
|
5903
5966
|
}
|
|
5904
5967
|
}
|
|
5905
5968
|
export {
|
|
5906
|
-
|
|
5907
|
-
spawnClaudeCodeProcessWithTreeKill,
|
|
5908
|
-
runHostedAgent,
|
|
5909
|
-
maestroProvider,
|
|
5910
|
-
inspectBundledClaudeRuntime,
|
|
5911
|
-
configureAgentExecutionHost,
|
|
5912
|
-
codexProvider,
|
|
5913
|
-
claudeProvider,
|
|
5914
|
-
buildMaestroToolHooks,
|
|
5969
|
+
buildClaudeDisallowedTools,
|
|
5915
5970
|
buildMaestroDisallowedTools,
|
|
5916
|
-
|
|
5971
|
+
buildMaestroToolHooks,
|
|
5972
|
+
claudeProvider,
|
|
5973
|
+
codexProvider,
|
|
5974
|
+
configureAgentExecutionHost,
|
|
5975
|
+
inspectBundledClaudeRuntime,
|
|
5976
|
+
maestroProvider,
|
|
5977
|
+
runHostedAgent,
|
|
5978
|
+
spawnClaudeCodeProcessWithTreeKill,
|
|
5979
|
+
toCodexMcpServers
|
|
5917
5980
|
};
|
|
5918
5981
|
|
|
5919
|
-
//# debugId=
|
|
5982
|
+
//# debugId=8A04C2A589B1A6C664756E2164756E21
|