openfox 2.0.63 → 2.0.65
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/{chat-handler-WNARPARQ.js → chat-handler-MC3XZ3OV.js} +4 -4
- package/dist/{chunk-FGG4KRFX.js → chunk-4UYKN6JU.js} +2 -2
- package/dist/{chunk-W4PUAODY.js → chunk-N4K3PNOS.js} +3 -3
- package/dist/{chunk-SVSKQYFH.js → chunk-PXJ4NOP4.js} +5 -3
- package/dist/{chunk-5OPZLQDV.js → chunk-UEIQKG5P.js} +184 -98
- package/dist/{chunk-IVJYQZSN.js → chunk-VWPY2KWH.js} +5 -5
- package/dist/{chunk-N5JF4RYJ.js → chunk-Z6H7SFQR.js} +42 -25
- package/dist/cli/dev.js +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/{orchestrator-OIBLY5QJ.js → orchestrator-IYJRQQKB.js} +4 -4
- package/dist/package.json +1 -1
- package/dist/{processor-27VCKRGB.js → processor-LUXKVIED.js} +4 -4
- package/dist/{serve-HB222ARV.js → serve-ZRTWVOL2.js} +6 -6
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +5 -5
- package/dist/{server-XDC7R2IX.js → server-PXXGMFBT.js} +5 -5
- package/dist/{settings-ASLTSUE2.js → settings-JA4XUR3W.js} +2 -2
- package/dist/{tools-W2FFSF4N.js → tools-ZZM36DAZ.js} +3 -3
- package/dist/web/assets/index-Bsi_le80.js +303 -0
- package/dist/web/assets/{index-DvPmgi8F.css → index-Dc05znz4.css} +1 -1
- package/dist/web/index.html +2 -2
- package/dist/web/sw.js +1 -1
- package/package.json +1 -1
- package/dist/web/assets/index-bSaZSLjg.js +0 -303
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
} from "./chunk-QJ5FH5DP.js";
|
|
6
6
|
import {
|
|
7
7
|
runChatTurn
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-VWPY2KWH.js";
|
|
9
|
+
import "./chunk-UEIQKG5P.js";
|
|
10
10
|
import "./chunk-X5YCWKNS.js";
|
|
11
11
|
import "./chunk-LBGHZLLH.js";
|
|
12
12
|
import "./chunk-BGTEIA2S.js";
|
|
@@ -21,8 +21,8 @@ import {
|
|
|
21
21
|
createPhaseChangedMessage,
|
|
22
22
|
createSessionRunningMessage
|
|
23
23
|
} from "./chunk-F4PMNP7S.js";
|
|
24
|
+
import "./chunk-PXJ4NOP4.js";
|
|
24
25
|
import "./chunk-EU3WWTFH.js";
|
|
25
|
-
import "./chunk-SVSKQYFH.js";
|
|
26
26
|
import "./chunk-YQ3SOPBI.js";
|
|
27
27
|
import "./chunk-ZPIZLTWU.js";
|
|
28
28
|
import "./chunk-J2GP3J3X.js";
|
|
@@ -154,4 +154,4 @@ export {
|
|
|
154
154
|
startChatSession,
|
|
155
155
|
stopSessionExecution
|
|
156
156
|
};
|
|
157
|
-
//# sourceMappingURL=chat-handler-
|
|
157
|
+
//# sourceMappingURL=chat-handler-MC3XZ3OV.js.map
|
|
@@ -208,7 +208,7 @@ async function runCli(options) {
|
|
|
208
208
|
if (!configExists) {
|
|
209
209
|
await runNetworkSetup(mode);
|
|
210
210
|
}
|
|
211
|
-
const { runServe } = await import("./serve-
|
|
211
|
+
const { runServe } = await import("./serve-ZRTWVOL2.js");
|
|
212
212
|
const serveOptions = { mode };
|
|
213
213
|
if (values.port) serveOptions.port = parseInt(values.port);
|
|
214
214
|
if (values["no-browser"] === true) serveOptions.openBrowser = false;
|
|
@@ -220,4 +220,4 @@ async function runCli(options) {
|
|
|
220
220
|
export {
|
|
221
221
|
runCli
|
|
222
222
|
};
|
|
223
|
-
//# sourceMappingURL=chunk-
|
|
223
|
+
//# sourceMappingURL=chunk-4UYKN6JU.js.map
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
injectWorkflowKickoffIfNeeded,
|
|
8
8
|
runAgentTurn,
|
|
9
9
|
runChatTurn
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-VWPY2KWH.js";
|
|
11
11
|
import {
|
|
12
12
|
checkAborted,
|
|
13
13
|
deleteItemFromDir,
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
loadAllAgentsDefault,
|
|
20
20
|
saveItemToDir,
|
|
21
21
|
spawnShellProcess
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-UEIQKG5P.js";
|
|
23
23
|
import {
|
|
24
24
|
TurnMetrics,
|
|
25
25
|
createMessageStartEvent
|
|
@@ -2092,4 +2092,4 @@ export {
|
|
|
2092
2092
|
signalMcpReady,
|
|
2093
2093
|
createWebSocketServer
|
|
2094
2094
|
};
|
|
2095
|
-
//# sourceMappingURL=chunk-
|
|
2095
|
+
//# sourceMappingURL=chunk-N4K3PNOS.js.map
|
|
@@ -24,7 +24,8 @@ var SETTINGS_KEYS = {
|
|
|
24
24
|
SEARCH_ENGINE: "search.engine",
|
|
25
25
|
SEARCH_TAVILY_API_KEY: "search.tavilyApiKey",
|
|
26
26
|
SEARCH_SEARXNG_URL: "search.searxngUrl",
|
|
27
|
-
SEARCH_SEARXNG_API_KEY: "search.searxngApiKey"
|
|
27
|
+
SEARCH_SEARXNG_API_KEY: "search.searxngApiKey",
|
|
28
|
+
TOOLS_USE_RTK: "tools.useRtk"
|
|
28
29
|
};
|
|
29
30
|
var SETTINGS_DEFAULTS = {
|
|
30
31
|
[SETTINGS_KEYS.DISPLAY_SHOW_THINKING]: "true",
|
|
@@ -49,7 +50,8 @@ var SETTINGS_DEFAULTS = {
|
|
|
49
50
|
{ type: "chord", key: "3", modifiers: ["ctrl"] },
|
|
50
51
|
{ type: "chord", key: "4", modifiers: ["ctrl"] }
|
|
51
52
|
]
|
|
52
|
-
})
|
|
53
|
+
}),
|
|
54
|
+
[SETTINGS_KEYS.TOOLS_USE_RTK]: "false"
|
|
53
55
|
};
|
|
54
56
|
function getSetting(key) {
|
|
55
57
|
try {
|
|
@@ -97,4 +99,4 @@ export {
|
|
|
97
99
|
deleteSetting,
|
|
98
100
|
getAllSettings
|
|
99
101
|
};
|
|
100
|
-
//# sourceMappingURL=chunk-
|
|
102
|
+
//# sourceMappingURL=chunk-PXJ4NOP4.js.map
|
|
@@ -54,16 +54,16 @@ import {
|
|
|
54
54
|
createChatPathConfirmationMessage,
|
|
55
55
|
createQueueStateMessage
|
|
56
56
|
} from "./chunk-F4PMNP7S.js";
|
|
57
|
-
import {
|
|
58
|
-
AskUserInterrupt,
|
|
59
|
-
askUserTool
|
|
60
|
-
} from "./chunk-EU3WWTFH.js";
|
|
61
57
|
import {
|
|
62
58
|
SETTINGS_KEYS,
|
|
63
59
|
deleteSetting,
|
|
64
60
|
getSetting,
|
|
65
61
|
setSetting
|
|
66
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-PXJ4NOP4.js";
|
|
63
|
+
import {
|
|
64
|
+
AskUserInterrupt,
|
|
65
|
+
askUserTool
|
|
66
|
+
} from "./chunk-EU3WWTFH.js";
|
|
67
67
|
import {
|
|
68
68
|
getProject
|
|
69
69
|
} from "./chunk-YQ3SOPBI.js";
|
|
@@ -380,7 +380,21 @@ function extractGitNoVerify(command) {
|
|
|
380
380
|
}
|
|
381
381
|
return false;
|
|
382
382
|
}
|
|
383
|
-
async function requestPathAccess(paths, workdir, sessionId, callId, tool, onEvent, dangerLevel, command) {
|
|
383
|
+
async function requestPathAccess(paths, workdir, sessionId, callId, tool, onEvent, dangerLevel, command, isSubAgent) {
|
|
384
|
+
if (isSubAgent) {
|
|
385
|
+
const result2 = await checkPathsAccess(paths, workdir, sessionId);
|
|
386
|
+
if (!result2.needsConfirmation) return;
|
|
387
|
+
if (dangerLevel === "dangerous") {
|
|
388
|
+
const allPaths2 = [.../* @__PURE__ */ new Set([...result2.deniedPaths, ...result2.sensitivePaths])];
|
|
389
|
+
addAllowedPaths(sessionId, allPaths2);
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
const allPaths = [.../* @__PURE__ */ new Set([...result2.deniedPaths, ...result2.sensitivePaths])];
|
|
393
|
+
const hasDenied2 = result2.deniedPaths.length > 0;
|
|
394
|
+
const hasSensitive2 = result2.sensitivePaths.length > 0;
|
|
395
|
+
const reason2 = hasDenied2 && hasSensitive2 ? "both" : hasDenied2 ? "outside_workdir" : "sensitive_file";
|
|
396
|
+
throw new PathAccessDeniedError(allPaths, tool, reason2);
|
|
397
|
+
}
|
|
384
398
|
const emitPendingEvent = (confirmationPaths, confirmationReason) => {
|
|
385
399
|
try {
|
|
386
400
|
const eventStore = getEventStore();
|
|
@@ -553,7 +567,8 @@ function createTool(name, definition, handler2) {
|
|
|
553
567
|
name,
|
|
554
568
|
context.onEvent,
|
|
555
569
|
context.dangerLevel,
|
|
556
|
-
command
|
|
570
|
+
command,
|
|
571
|
+
context.isSubAgent
|
|
557
572
|
);
|
|
558
573
|
}
|
|
559
574
|
},
|
|
@@ -1433,7 +1448,9 @@ Make sure whitespace and indentation match exactly.`
|
|
|
1433
1448
|
);
|
|
1434
1449
|
|
|
1435
1450
|
// src/server/tools/shell.ts
|
|
1451
|
+
import { spawn as spawn2 } from "child_process";
|
|
1436
1452
|
import { resolve as resolve4, isAbsolute as isAbsolute2 } from "path";
|
|
1453
|
+
import { access } from "fs/promises";
|
|
1437
1454
|
|
|
1438
1455
|
// src/server/utils/shell.ts
|
|
1439
1456
|
import { spawn } from "child_process";
|
|
@@ -1465,6 +1482,33 @@ function stripTailPipe(command) {
|
|
|
1465
1482
|
}
|
|
1466
1483
|
|
|
1467
1484
|
// src/server/tools/shell.ts
|
|
1485
|
+
var rtkAvailable;
|
|
1486
|
+
async function checkRtkAvailability() {
|
|
1487
|
+
if (rtkAvailable !== void 0) return rtkAvailable;
|
|
1488
|
+
try {
|
|
1489
|
+
await access("/usr/local/bin/rtk");
|
|
1490
|
+
rtkAvailable = true;
|
|
1491
|
+
} catch {
|
|
1492
|
+
try {
|
|
1493
|
+
const out = await new Promise((resolve6, reject) => {
|
|
1494
|
+
const proc = spawn2("rtk", ["--version"], { stdio: ["ignore", "pipe", "pipe"] });
|
|
1495
|
+
let output = "";
|
|
1496
|
+
proc.stdout?.on("data", (d) => {
|
|
1497
|
+
output += d.toString();
|
|
1498
|
+
});
|
|
1499
|
+
proc.on("error", reject);
|
|
1500
|
+
proc.on("close", (code) => {
|
|
1501
|
+
if (code === 0) resolve6(output.trim());
|
|
1502
|
+
else reject(new Error(`exit ${code}`));
|
|
1503
|
+
});
|
|
1504
|
+
});
|
|
1505
|
+
rtkAvailable = out.startsWith("rtk ");
|
|
1506
|
+
} catch {
|
|
1507
|
+
rtkAvailable = false;
|
|
1508
|
+
}
|
|
1509
|
+
}
|
|
1510
|
+
return rtkAvailable;
|
|
1511
|
+
}
|
|
1468
1512
|
function hasBackgroundAmpersand(command) {
|
|
1469
1513
|
const trimmed = command.replace(/[;\s]+$/, "");
|
|
1470
1514
|
if (trimmed.endsWith("&")) {
|
|
@@ -1523,7 +1567,9 @@ var runCommandTool = createTool(
|
|
|
1523
1567
|
await helpers.checkPathAccess(pathsToCheck, args.command);
|
|
1524
1568
|
const tailInfo = stripTailPipe(args.command);
|
|
1525
1569
|
const execCommand = tailInfo ? tailInfo.command : args.command;
|
|
1526
|
-
const
|
|
1570
|
+
const useRtk = getSetting(SETTINGS_KEYS.TOOLS_USE_RTK) === "true";
|
|
1571
|
+
const finalCommand = useRtk ? await tryRtkRewrite(execCommand) : execCommand;
|
|
1572
|
+
const result = await executeCommand(finalCommand, workingDir, timeout, context.signal, context.onProgress);
|
|
1527
1573
|
let output = "";
|
|
1528
1574
|
if (result.stdout) {
|
|
1529
1575
|
output += result.stdout;
|
|
@@ -1561,6 +1607,29 @@ ${result.stderr}`;
|
|
|
1561
1607
|
});
|
|
1562
1608
|
}
|
|
1563
1609
|
);
|
|
1610
|
+
async function tryRtkRewrite(command) {
|
|
1611
|
+
if (!await checkRtkAvailability()) return command;
|
|
1612
|
+
try {
|
|
1613
|
+
const result = await new Promise((resolve6, reject) => {
|
|
1614
|
+
const proc = spawn2("rtk", ["rewrite", command], {
|
|
1615
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
1616
|
+
timeout: 2e3
|
|
1617
|
+
});
|
|
1618
|
+
let stdout = "";
|
|
1619
|
+
proc.stdout?.on("data", (data) => {
|
|
1620
|
+
stdout += data.toString();
|
|
1621
|
+
});
|
|
1622
|
+
proc.on("error", reject);
|
|
1623
|
+
proc.on("close", (code) => {
|
|
1624
|
+
if (code === 0 || code === 3) resolve6(stdout.trim());
|
|
1625
|
+
else reject(new Error(`exit ${code}`));
|
|
1626
|
+
});
|
|
1627
|
+
});
|
|
1628
|
+
if (result && result !== command) return result;
|
|
1629
|
+
} catch {
|
|
1630
|
+
}
|
|
1631
|
+
return command;
|
|
1632
|
+
}
|
|
1564
1633
|
function executeCommand(command, cwd, timeout, signal, onProgress) {
|
|
1565
1634
|
return new Promise((resolve6, reject) => {
|
|
1566
1635
|
if (checkAborted(signal)) {
|
|
@@ -1785,24 +1854,24 @@ ${Object.entries(schema.fields).map(([f, t]) => ` ${f}: ${t}`).join("\n")}`
|
|
|
1785
1854
|
);
|
|
1786
1855
|
|
|
1787
1856
|
// src/server/sub-agents/manager.ts
|
|
1788
|
-
import { readFile as readFile8, access as
|
|
1857
|
+
import { readFile as readFile8, access as access5 } from "fs/promises";
|
|
1789
1858
|
import { join as join7, dirname as dirname5, isAbsolute as isAbsolute3 } from "path";
|
|
1790
1859
|
|
|
1791
1860
|
// src/server/agents/registry.ts
|
|
1792
|
-
import { readdir as readdir3, readFile as readFile5, writeFile as writeFile4, mkdir as mkdir3, access as
|
|
1861
|
+
import { readdir as readdir3, readFile as readFile5, writeFile as writeFile4, mkdir as mkdir3, access as access3, unlink as unlink2 } from "fs/promises";
|
|
1793
1862
|
import { join as join4, dirname as dirname2 } from "path";
|
|
1794
1863
|
import { constants as constants2 } from "fs";
|
|
1795
1864
|
import { fileURLToPath } from "url";
|
|
1796
1865
|
import matter2 from "gray-matter";
|
|
1797
1866
|
|
|
1798
1867
|
// src/server/shared/item-loader.ts
|
|
1799
|
-
import { readdir as readdir2, readFile as readFile4, access, writeFile as writeFile3, mkdir as mkdir2, unlink } from "fs/promises";
|
|
1868
|
+
import { readdir as readdir2, readFile as readFile4, access as access2, writeFile as writeFile3, mkdir as mkdir2, unlink } from "fs/promises";
|
|
1800
1869
|
import { join as join3 } from "path";
|
|
1801
1870
|
import { constants } from "fs";
|
|
1802
1871
|
import matter from "gray-matter";
|
|
1803
1872
|
async function pathExists(path) {
|
|
1804
1873
|
try {
|
|
1805
|
-
await
|
|
1874
|
+
await access2(path, constants.R_OK);
|
|
1806
1875
|
return true;
|
|
1807
1876
|
} catch {
|
|
1808
1877
|
return false;
|
|
@@ -1880,7 +1949,7 @@ function getProjectAgentsDir(projectDir) {
|
|
|
1880
1949
|
}
|
|
1881
1950
|
async function pathExists2(path) {
|
|
1882
1951
|
try {
|
|
1883
|
-
await
|
|
1952
|
+
await access3(path, constants2.R_OK);
|
|
1884
1953
|
return true;
|
|
1885
1954
|
} catch {
|
|
1886
1955
|
return false;
|
|
@@ -2059,7 +2128,7 @@ async function deleteAgent(configDir, agentId) {
|
|
|
2059
2128
|
}
|
|
2060
2129
|
|
|
2061
2130
|
// src/server/context/instructions.ts
|
|
2062
|
-
import { readFile as readFile6, access as
|
|
2131
|
+
import { readFile as readFile6, access as access4 } from "fs/promises";
|
|
2063
2132
|
import { join as join5, dirname as dirname3 } from "path";
|
|
2064
2133
|
import { constants as constants3 } from "fs";
|
|
2065
2134
|
var INSTRUCTION_FILENAMES = ["AGENTS.md", "CLAUDE.md"];
|
|
@@ -2142,7 +2211,7 @@ ${agentContent}`);
|
|
|
2142
2211
|
}
|
|
2143
2212
|
async function fileExists(path) {
|
|
2144
2213
|
try {
|
|
2145
|
-
await
|
|
2214
|
+
await access4(path, constants3.R_OK);
|
|
2146
2215
|
return true;
|
|
2147
2216
|
} catch {
|
|
2148
2217
|
return false;
|
|
@@ -2579,6 +2648,9 @@ async function executeTools(assistantMsgId, toolCalls, ctx, append) {
|
|
|
2579
2648
|
if (ctx.dangerLevel) {
|
|
2580
2649
|
toolContext.dangerLevel = ctx.dangerLevel;
|
|
2581
2650
|
}
|
|
2651
|
+
if (ctx.isSubAgent) {
|
|
2652
|
+
toolContext.isSubAgent = true;
|
|
2653
|
+
}
|
|
2582
2654
|
const startTime = Date.now();
|
|
2583
2655
|
let toolResult;
|
|
2584
2656
|
try {
|
|
@@ -2957,6 +3029,9 @@ ${COMPACTION_PROMPT}`,
|
|
|
2957
3029
|
if (session.dangerLevel) {
|
|
2958
3030
|
batchContext.dangerLevel = session.dangerLevel;
|
|
2959
3031
|
}
|
|
3032
|
+
if (config.subAgentMetadata) {
|
|
3033
|
+
batchContext.isSubAgent = true;
|
|
3034
|
+
}
|
|
2960
3035
|
batchContext.agentTimeout = getRuntimeConfig().agent.toolTimeout;
|
|
2961
3036
|
const batchResult = await executeTools(assistantMsgId, result.toolCalls, batchContext, append);
|
|
2962
3037
|
if (batchResult.stepDoneCalled) {
|
|
@@ -3564,7 +3639,7 @@ async function loadGitIgnoreRules(workdir) {
|
|
|
3564
3639
|
while (true) {
|
|
3565
3640
|
const gitignorePath = join7(currentDir, ".gitignore");
|
|
3566
3641
|
try {
|
|
3567
|
-
await
|
|
3642
|
+
await access5(gitignorePath);
|
|
3568
3643
|
const content = await readFile8(gitignorePath, "utf-8");
|
|
3569
3644
|
const trimmed = content.trim();
|
|
3570
3645
|
if (!trimmed) return "";
|
|
@@ -3766,7 +3841,7 @@ var callSubAgentTool = {
|
|
|
3766
3841
|
};
|
|
3767
3842
|
}
|
|
3768
3843
|
try {
|
|
3769
|
-
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-
|
|
3844
|
+
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-ZZM36DAZ.js");
|
|
3770
3845
|
const toolRegistry = getToolRegistryForAgent2(agentDef);
|
|
3771
3846
|
const turnMetrics = new TurnMetrics();
|
|
3772
3847
|
const result = await executeSubAgent({
|
|
@@ -4050,7 +4125,7 @@ var webFetchTool = createTool(
|
|
|
4050
4125
|
);
|
|
4051
4126
|
|
|
4052
4127
|
// src/server/dev-server/manager.ts
|
|
4053
|
-
import { spawn as
|
|
4128
|
+
import { spawn as spawn3 } from "child_process";
|
|
4054
4129
|
import { readFile as readFile9, writeFile as writeFile6, mkdir as mkdir5 } from "fs/promises";
|
|
4055
4130
|
import { resolve as resolve5, join as join8 } from "path";
|
|
4056
4131
|
var MAX_LOG_LINES = 2e3;
|
|
@@ -4164,7 +4239,7 @@ var DevServerManager = class {
|
|
|
4164
4239
|
}
|
|
4165
4240
|
const resolved = this.resolveWorkdir(workdir);
|
|
4166
4241
|
const shell = getPlatformShell();
|
|
4167
|
-
const proc =
|
|
4242
|
+
const proc = spawn3(shell.command, [...shell.args, config.command], {
|
|
4168
4243
|
cwd: resolved,
|
|
4169
4244
|
env: { ...process.env, FORCE_COLOR: "1" },
|
|
4170
4245
|
stdio: ["ignore", "pipe", "pipe"],
|
|
@@ -4688,7 +4763,7 @@ var mcpConfigTool = createTool(
|
|
|
4688
4763
|
mcpNotifyChanged?.(sessionId);
|
|
4689
4764
|
}
|
|
4690
4765
|
async function rebuildTools() {
|
|
4691
|
-
const { setMcpTools: setMcpTools2 } = await import("./tools-
|
|
4766
|
+
const { setMcpTools: setMcpTools2 } = await import("./tools-ZZM36DAZ.js");
|
|
4692
4767
|
const mcpTools = createMcpTools(mcpManagerForTools);
|
|
4693
4768
|
setMcpTools2(mcpTools);
|
|
4694
4769
|
}
|
|
@@ -5259,103 +5334,114 @@ function createRegistryFromTools(tools, allowedTools, toolPermissions, agentId,
|
|
|
5259
5334
|
for (const tool of tools) {
|
|
5260
5335
|
toolMap.set(tool.name, tool);
|
|
5261
5336
|
}
|
|
5337
|
+
async function trySubAgentAlias(name, args, context) {
|
|
5338
|
+
if (!toolMap.has("call_sub_agent")) {
|
|
5339
|
+
return null;
|
|
5340
|
+
}
|
|
5341
|
+
try {
|
|
5342
|
+
const agents = await loadAllAgentsDefault();
|
|
5343
|
+
const agentDef = findAgentById(name, agents);
|
|
5344
|
+
if (!agentDef?.metadata.subagent) {
|
|
5345
|
+
return null;
|
|
5346
|
+
}
|
|
5347
|
+
const prompt = extractSubAgentPrompt(args);
|
|
5348
|
+
logger.info("Sub-agent alias transformation", {
|
|
5349
|
+
from: name,
|
|
5350
|
+
to: "call_sub_agent",
|
|
5351
|
+
subAgentType: name
|
|
5352
|
+
});
|
|
5353
|
+
return callSubAgentTool.execute({ subAgentType: name, prompt }, context);
|
|
5354
|
+
} catch (err) {
|
|
5355
|
+
logger.warn("Sub-agent alias resolution failed", {
|
|
5356
|
+
tool: name,
|
|
5357
|
+
error: err instanceof Error ? err.message : String(err)
|
|
5358
|
+
});
|
|
5359
|
+
return null;
|
|
5360
|
+
}
|
|
5361
|
+
}
|
|
5262
5362
|
return {
|
|
5263
5363
|
tools,
|
|
5264
5364
|
definitions: tools.map((t) => t.definition),
|
|
5265
5365
|
async execute(name, args, context) {
|
|
5266
5366
|
const tool = toolMap.get(name);
|
|
5267
|
-
if (
|
|
5268
|
-
|
|
5269
|
-
|
|
5270
|
-
|
|
5271
|
-
|
|
5272
|
-
|
|
5273
|
-
|
|
5274
|
-
logger.warn("Sub-agent alias redirect", { from: name, to: "call_sub_agent", subAgentType: name });
|
|
5275
|
-
return callSubAgentTool.execute({ subAgentType: name, prompt }, context);
|
|
5276
|
-
}
|
|
5277
|
-
} catch (err) {
|
|
5278
|
-
logger.warn("Sub-agent alias resolution failed", {
|
|
5367
|
+
if (tool) {
|
|
5368
|
+
const isMcpTool = !getBuiltInToolNames().has(name);
|
|
5369
|
+
const hasRestrictions = allowedTools !== void 0;
|
|
5370
|
+
if (!isMcpTool && hasRestrictions) {
|
|
5371
|
+
const effectiveTools = computeEffectiveTools(allowedTools, isSubAgent ? "sub-agent" : "agent");
|
|
5372
|
+
if (!effectiveTools.has(name)) {
|
|
5373
|
+
logger.debug("Permission denied: tool not in allowed list", {
|
|
5279
5374
|
tool: name,
|
|
5280
|
-
|
|
5375
|
+
allowedTools
|
|
5281
5376
|
});
|
|
5377
|
+
return {
|
|
5378
|
+
success: false,
|
|
5379
|
+
error: createPermissionErrorMessage(name, allowedTools, agentId, isSubAgent),
|
|
5380
|
+
durationMs: 0,
|
|
5381
|
+
truncated: false
|
|
5382
|
+
};
|
|
5282
5383
|
}
|
|
5283
5384
|
}
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
|
|
5287
|
-
|
|
5288
|
-
|
|
5385
|
+
if (toolPermissions) {
|
|
5386
|
+
const action = args["action"];
|
|
5387
|
+
if (action) {
|
|
5388
|
+
const actionError = validateToolAction(name, action, toolPermissions);
|
|
5389
|
+
if (actionError) {
|
|
5390
|
+
logger.debug("Permission denied: action not allowed", {
|
|
5391
|
+
tool: name,
|
|
5392
|
+
action,
|
|
5393
|
+
toolPermissions
|
|
5394
|
+
});
|
|
5395
|
+
return {
|
|
5396
|
+
success: false,
|
|
5397
|
+
error: actionError,
|
|
5398
|
+
durationMs: 0,
|
|
5399
|
+
truncated: false
|
|
5400
|
+
};
|
|
5401
|
+
}
|
|
5402
|
+
}
|
|
5403
|
+
}
|
|
5404
|
+
const permittedActionsArray = {};
|
|
5405
|
+
for (const [key, value] of Object.entries(toolPermissions || {})) {
|
|
5406
|
+
permittedActionsArray[key] = [...value];
|
|
5407
|
+
}
|
|
5408
|
+
const contextWithPerms = {
|
|
5409
|
+
...context,
|
|
5410
|
+
permittedActions: Object.keys(permittedActionsArray).length > 0 ? permittedActionsArray : void 0
|
|
5289
5411
|
};
|
|
5290
|
-
|
|
5291
|
-
|
|
5292
|
-
|
|
5293
|
-
|
|
5294
|
-
const effectiveTools = computeEffectiveTools(allowedTools, isSubAgent ? "sub-agent" : "agent");
|
|
5295
|
-
if (!effectiveTools.has(name)) {
|
|
5296
|
-
logger.debug("Permission denied: tool not in allowed list", {
|
|
5412
|
+
logger.debug("Executing tool", { tool: name, args });
|
|
5413
|
+
try {
|
|
5414
|
+
const result = await tool.execute(args, contextWithPerms);
|
|
5415
|
+
logger.debug("Tool completed", {
|
|
5297
5416
|
tool: name,
|
|
5298
|
-
|
|
5417
|
+
success: result.success,
|
|
5418
|
+
durationMs: result.durationMs
|
|
5299
5419
|
});
|
|
5420
|
+
return result;
|
|
5421
|
+
} catch (error) {
|
|
5422
|
+
if (error instanceof AskUserInterrupt) {
|
|
5423
|
+
throw error;
|
|
5424
|
+
}
|
|
5425
|
+
if (error instanceof PathAccessDeniedError) {
|
|
5426
|
+
throw error;
|
|
5427
|
+
}
|
|
5428
|
+
logger.error("Tool execution error", { tool: name, error });
|
|
5300
5429
|
return {
|
|
5301
5430
|
success: false,
|
|
5302
|
-
error:
|
|
5431
|
+
error: error instanceof Error ? error.message : "Unknown error",
|
|
5303
5432
|
durationMs: 0,
|
|
5304
5433
|
truncated: false
|
|
5305
5434
|
};
|
|
5306
5435
|
}
|
|
5307
5436
|
}
|
|
5308
|
-
|
|
5309
|
-
|
|
5310
|
-
|
|
5311
|
-
|
|
5312
|
-
|
|
5313
|
-
|
|
5314
|
-
|
|
5315
|
-
action,
|
|
5316
|
-
toolPermissions
|
|
5317
|
-
});
|
|
5318
|
-
return {
|
|
5319
|
-
success: false,
|
|
5320
|
-
error: actionError,
|
|
5321
|
-
durationMs: 0,
|
|
5322
|
-
truncated: false
|
|
5323
|
-
};
|
|
5324
|
-
}
|
|
5325
|
-
}
|
|
5326
|
-
}
|
|
5327
|
-
const permittedActionsArray = {};
|
|
5328
|
-
for (const [key, value] of Object.entries(toolPermissions || {})) {
|
|
5329
|
-
permittedActionsArray[key] = [...value];
|
|
5330
|
-
}
|
|
5331
|
-
const contextWithPerms = {
|
|
5332
|
-
...context,
|
|
5333
|
-
permittedActions: Object.keys(permittedActionsArray).length > 0 ? permittedActionsArray : void 0
|
|
5437
|
+
const aliasResult = await trySubAgentAlias(name, args, context);
|
|
5438
|
+
if (aliasResult) return aliasResult;
|
|
5439
|
+
return {
|
|
5440
|
+
success: false,
|
|
5441
|
+
error: `Unknown tool: ${name}. Available tools: ${tools.map((t) => t.name).join(", ")}`,
|
|
5442
|
+
durationMs: 0,
|
|
5443
|
+
truncated: false
|
|
5334
5444
|
};
|
|
5335
|
-
logger.debug("Executing tool", { tool: name, args });
|
|
5336
|
-
try {
|
|
5337
|
-
const result = await tool.execute(args, contextWithPerms);
|
|
5338
|
-
logger.debug("Tool completed", {
|
|
5339
|
-
tool: name,
|
|
5340
|
-
success: result.success,
|
|
5341
|
-
durationMs: result.durationMs
|
|
5342
|
-
});
|
|
5343
|
-
return result;
|
|
5344
|
-
} catch (error) {
|
|
5345
|
-
if (error instanceof AskUserInterrupt) {
|
|
5346
|
-
throw error;
|
|
5347
|
-
}
|
|
5348
|
-
if (error instanceof PathAccessDeniedError) {
|
|
5349
|
-
throw error;
|
|
5350
|
-
}
|
|
5351
|
-
logger.error("Tool execution error", { tool: name, error });
|
|
5352
|
-
return {
|
|
5353
|
-
success: false,
|
|
5354
|
-
error: error instanceof Error ? error.message : "Unknown error",
|
|
5355
|
-
durationMs: 0,
|
|
5356
|
-
truncated: false
|
|
5357
|
-
};
|
|
5358
|
-
}
|
|
5359
5445
|
}
|
|
5360
5446
|
};
|
|
5361
5447
|
}
|
|
@@ -5492,4 +5578,4 @@ export {
|
|
|
5492
5578
|
getToolRegistryForAgent,
|
|
5493
5579
|
createToolRegistry
|
|
5494
5580
|
};
|
|
5495
|
-
//# sourceMappingURL=chunk-
|
|
5581
|
+
//# sourceMappingURL=chunk-UEIQKG5P.js.map
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
loadAllAgentsDefault,
|
|
11
11
|
processEventsForConversation,
|
|
12
12
|
runTopLevelAgentLoop
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-UEIQKG5P.js";
|
|
14
14
|
import {
|
|
15
15
|
TurnMetrics,
|
|
16
16
|
WORKFLOW_KICKOFF_PROMPT,
|
|
@@ -65,7 +65,7 @@ function resolveAgentDef(sessionManager, sessionId) {
|
|
|
65
65
|
}
|
|
66
66
|
async function buildCachedPrompt(sessionManager, sessionId, agentDef) {
|
|
67
67
|
const { instructionContent, skills } = await loadSessionContext(sessionManager, sessionId);
|
|
68
|
-
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-
|
|
68
|
+
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-ZZM36DAZ.js");
|
|
69
69
|
const tools = getToolRegistryForAgent2(agentDef).definitions;
|
|
70
70
|
const toolFingerprint = getToolFingerprint(tools);
|
|
71
71
|
const allAgents = await loadAllAgentsDefault();
|
|
@@ -78,7 +78,7 @@ async function buildCachedPrompt(sessionManager, sessionId, agentDef) {
|
|
|
78
78
|
async function computeSessionHash(sessionManager, sessionId) {
|
|
79
79
|
const { instructionContent, skills } = await loadSessionContext(sessionManager, sessionId);
|
|
80
80
|
const agentDef = await resolveAgentDef(sessionManager, sessionId);
|
|
81
|
-
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-
|
|
81
|
+
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-ZZM36DAZ.js");
|
|
82
82
|
const tools = getToolRegistryForAgent2(agentDef).definitions;
|
|
83
83
|
const toolFingerprint = getToolFingerprint(tools);
|
|
84
84
|
return computeDynamicContextHash(instructionContent, skills, toolFingerprint);
|
|
@@ -96,7 +96,7 @@ async function applyDynamicContext(sessionManager, sessionId) {
|
|
|
96
96
|
|
|
97
97
|
// src/server/chat/orchestrator.ts
|
|
98
98
|
async function buildRetryPatterns() {
|
|
99
|
-
const { getSetting, SETTINGS_KEYS } = await import("./settings-
|
|
99
|
+
const { getSetting, SETTINGS_KEYS } = await import("./settings-JA4XUR3W.js");
|
|
100
100
|
const raw = getSetting(SETTINGS_KEYS.RETRY_PATTERNS);
|
|
101
101
|
if (!raw) {
|
|
102
102
|
const oldXmlProtection = getSetting("llm.disableXmlProtection");
|
|
@@ -383,4 +383,4 @@ export {
|
|
|
383
383
|
runAgentTurn,
|
|
384
384
|
injectWorkflowKickoffIfNeeded
|
|
385
385
|
};
|
|
386
|
-
//# sourceMappingURL=chunk-
|
|
386
|
+
//# sourceMappingURL=chunk-VWPY2KWH.js.map
|