openfox 2.0.65 → 2.0.67
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/README.md +1 -0
- package/dist/agent-defaults/builder.agent.md +1 -1
- package/dist/agent-defaults/code-reviewer.agent.md +0 -1
- package/dist/agent-defaults/explorer.agent.md +0 -1
- package/dist/agent-defaults/planner.agent.md +1 -1
- package/dist/{branch.api-LAN42BA5.js → branch.api-3YJSWOZG.js} +5 -1
- package/dist/{chat-handler-MC3XZ3OV.js → chat-handler-72DFHK5K.js} +16 -13
- package/dist/{chunk-Z6H7SFQR.js → chunk-2GRUQN2B.js} +435 -170
- package/dist/{chunk-LBGHZLLH.js → chunk-4QBDV6LX.js} +17 -14
- package/dist/{chunk-RYIREJAW.js → chunk-5EO6SEGV.js} +2 -2
- package/dist/{chunk-N4K3PNOS.js → chunk-B6JUWVTK.js} +95 -29
- package/dist/{chunk-QBYQ7KDX.js → chunk-B7WGOK7G.js} +16 -15
- package/dist/{chunk-Z6W4YHJB.js → chunk-BL5LOLVA.js} +17 -1
- package/dist/{chunk-TMUBLQFC.js → chunk-C3VLGVSQ.js} +3 -3
- package/dist/{chunk-ZPIZLTWU.js → chunk-GMXKJGJ2.js} +5 -1
- package/dist/{chunk-YQ3SOPBI.js → chunk-KXVFHMSM.js} +2 -2
- package/dist/{chunk-4UYKN6JU.js → chunk-MQHMT5WF.js} +3 -3
- package/dist/{chunk-VWPY2KWH.js → chunk-PYRH4G2J.js} +9 -35
- package/dist/{chunk-BGTEIA2S.js → chunk-TFCHWMOJ.js} +23 -30
- package/dist/{chunk-AIJE3RYH.js → chunk-TFDK6VSG.js} +33 -7
- package/dist/{chunk-X5YCWKNS.js → chunk-TJO4QFDQ.js} +59 -86
- package/dist/{chunk-QJ5FH5DP.js → chunk-TMHWQYWE.js} +4 -4
- package/dist/chunk-VLV3XWZS.js +191 -0
- package/dist/chunk-WGMJCFCE.js +14 -0
- package/dist/chunk-X5DOUA3Z.js +66 -0
- package/dist/{chunk-PXJ4NOP4.js → chunk-XUPKS5FL.js} +6 -4
- package/dist/{chunk-UEIQKG5P.js → chunk-YU6DZAVA.js} +303 -360
- package/dist/{chunk-OESYKZCM.js → chunk-ZLON3JTI.js} +3 -3
- package/dist/cli/dev.js +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/{client-LAKW7TA5.js → client-BUX62J2K.js} +3 -3
- package/dist/{client-pure-DO3S675T.js → client-pure-U6ZYUPJQ.js} +6 -4
- package/dist/{compactor-I3N56PSJ.js → compactor-74CZVUWI.js} +9 -7
- package/dist/{events-52XADT6Y.js → events-CDQ4HASP.js} +4 -4
- package/dist/{folding-2BGFLV5J.js → folding-V2K34EGN.js} +2 -2
- package/dist/{inspect-proxy-BV25JERQ.js → inspect-proxy-OVEFBJ26.js} +4 -4
- package/dist/{manager-344C5JLZ.js → manager-JXYRGR6B.js} +6 -2
- package/dist/{orchestrator-IYJRQQKB.js → orchestrator-FEMPJOZD.js} +15 -14
- package/dist/package.json +2 -1
- package/dist/platform-AB3GIEGO.js +21 -0
- package/dist/{processor-LUXKVIED.js → processor-QB3NMRMO.js} +16 -13
- package/dist/{project-creator-IDW7RACH.js → project-creator-EMGRSPYS.js} +18 -5
- package/dist/{projects-BY227WT2.js → projects-7HSBZY2D.js} +3 -3
- package/dist/{protocol-Cq66hdDX.d.ts → protocol-42f_Png6.d.ts} +1 -1
- package/dist/provider/index.d.ts +4 -4
- package/dist/{provider-GYOW4OWQ.js → provider-BDH6JGZB.js} +4 -4
- package/dist/{provider-manager-HRHNF73A.js → provider-manager-D3KIOD5E.js} +4 -4
- package/dist/{serve-ZRTWVOL2.js → serve-32FAA4FX.js} +20 -17
- package/dist/server/index.d.ts +26 -8
- package/dist/server/index.js +19 -16
- package/dist/server-OYE7GERR.js +37 -0
- package/dist/{settings-JA4XUR3W.js → settings-6ZPWOBWL.js} +3 -3
- package/dist/shared/index.d.ts +3 -3
- package/dist/{tools-ZZM36DAZ.js → tools-INWP6FGV.js} +14 -11
- package/dist/{types-CDZakn7f.d.ts → types-apiMd7Df.d.ts} +1 -1
- package/dist/{types-akHmgvBk.d.ts → types-vezAEt_y.d.ts} +3 -1
- package/dist/web/assets/{index-Dc05znz4.css → index-BELeAs12.css} +1 -1
- package/dist/web/assets/index-C3n65CNu.js +303 -0
- package/dist/web/index.html +2 -2
- package/dist/web/sw.js +1 -1
- package/dist/worktree-6U45P63P.js +30 -0
- package/package.json +2 -1
- package/dist/server-PXXGMFBT.js +0 -34
- package/dist/web/assets/index-Bsi_le80.js +0 -303
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getProjectByWorkdir
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-KXVFHMSM.js";
|
|
4
4
|
import {
|
|
5
5
|
logger
|
|
6
6
|
} from "./chunk-K44MW7JJ.js";
|
|
@@ -22,17 +22,20 @@ function buildHttpHeaders(resHeaders, status, contentLengthOverride, contentType
|
|
|
22
22
|
}
|
|
23
23
|
var proxyPool = /* @__PURE__ */ new Map();
|
|
24
24
|
var nextOffset = 0;
|
|
25
|
-
function getAvailablePort() {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
for (const instance of proxyPool.values()) {
|
|
29
|
-
const addr = instance.server.address();
|
|
30
|
-
if (addr && typeof addr === "object") used.add(addr.port);
|
|
31
|
-
}
|
|
32
|
-
for (let port = base + 1; port < base + 200; port++) {
|
|
33
|
-
if (!used.has(port)) return port;
|
|
25
|
+
async function getAvailablePort(proxyBase) {
|
|
26
|
+
for (let port = proxyBase; port < proxyBase + 200; port++) {
|
|
27
|
+
if (await tryBind(port)) return port;
|
|
34
28
|
}
|
|
35
|
-
return
|
|
29
|
+
return proxyBase + nextOffset++ % 200;
|
|
30
|
+
}
|
|
31
|
+
function tryBind(port) {
|
|
32
|
+
return new Promise((resolve) => {
|
|
33
|
+
const server = net.createServer();
|
|
34
|
+
server.on("error", () => resolve(false));
|
|
35
|
+
server.listen(port, "127.0.0.1", () => {
|
|
36
|
+
server.close(() => resolve(true));
|
|
37
|
+
});
|
|
38
|
+
});
|
|
36
39
|
}
|
|
37
40
|
function parseReqHeaders(str) {
|
|
38
41
|
const lines = str.split("\r\n");
|
|
@@ -85,8 +88,8 @@ function dechunk(buf) {
|
|
|
85
88
|
}
|
|
86
89
|
return Buffer.concat(parts);
|
|
87
90
|
}
|
|
88
|
-
function startInspectProxy(target, sessionManager, workdir) {
|
|
89
|
-
const port = getAvailablePort();
|
|
91
|
+
async function startInspectProxy(target, sessionManager, devServerPort, workdir) {
|
|
92
|
+
const port = await getAvailablePort(devServerPort + 1e3);
|
|
90
93
|
const server = net.createServer((client) => {
|
|
91
94
|
let clientHead = "";
|
|
92
95
|
let clientParsed = false;
|
|
@@ -340,4 +343,4 @@ export {
|
|
|
340
343
|
startInspectProxy,
|
|
341
344
|
stopAllInspectProxies
|
|
342
345
|
};
|
|
343
|
-
//# sourceMappingURL=chunk-
|
|
346
|
+
//# sourceMappingURL=chunk-4QBDV6LX.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createLLMClient
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-B7WGOK7G.js";
|
|
4
4
|
import {
|
|
5
5
|
getModelProfile
|
|
6
6
|
} from "./chunk-V4IE7HJY.js";
|
|
@@ -796,4 +796,4 @@ export {
|
|
|
796
796
|
parseDefaultModelSelection,
|
|
797
797
|
createProviderManager
|
|
798
798
|
};
|
|
799
|
-
//# sourceMappingURL=chunk-
|
|
799
|
+
//# sourceMappingURL=chunk-5EO6SEGV.js.map
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
appendCompactionPrompt
|
|
3
|
-
} from "./chunk-OESYKZCM.js";
|
|
4
1
|
import {
|
|
5
2
|
applyDynamicContext,
|
|
6
3
|
computeSessionHash,
|
|
7
|
-
injectWorkflowKickoffIfNeeded,
|
|
8
4
|
runAgentTurn,
|
|
9
5
|
runChatTurn
|
|
10
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-PYRH4G2J.js";
|
|
7
|
+
import {
|
|
8
|
+
appendCompactionPrompt
|
|
9
|
+
} from "./chunk-ZLON3JTI.js";
|
|
11
10
|
import {
|
|
12
|
-
checkAborted,
|
|
13
11
|
deleteItemFromDir,
|
|
14
12
|
devServerManager,
|
|
15
13
|
executeSubAgent,
|
|
@@ -17,22 +15,29 @@ import {
|
|
|
17
15
|
getToolRegistryForAgent,
|
|
18
16
|
jsonSerializer,
|
|
19
17
|
loadAllAgentsDefault,
|
|
20
|
-
saveItemToDir
|
|
21
|
-
|
|
22
|
-
} from "./chunk-UEIQKG5P.js";
|
|
18
|
+
saveItemToDir
|
|
19
|
+
} from "./chunk-YU6DZAVA.js";
|
|
23
20
|
import {
|
|
24
21
|
TurnMetrics,
|
|
25
22
|
createMessageStartEvent
|
|
26
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-TJO4QFDQ.js";
|
|
24
|
+
import {
|
|
25
|
+
checkAborted,
|
|
26
|
+
onProcessEvent,
|
|
27
|
+
spawnShellProcess
|
|
28
|
+
} from "./chunk-TFCHWMOJ.js";
|
|
27
29
|
import {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
} from "./chunk-BGTEIA2S.js";
|
|
30
|
+
gitSpawnEnv
|
|
31
|
+
} from "./chunk-WGMJCFCE.js";
|
|
31
32
|
import {
|
|
32
33
|
getCurrentContextWindowId,
|
|
33
34
|
getEventStore,
|
|
34
35
|
getRuntimeConfig
|
|
35
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-TFDK6VSG.js";
|
|
37
|
+
import {
|
|
38
|
+
buildMessagesFromStoredEvents,
|
|
39
|
+
foldPendingConfirmations
|
|
40
|
+
} from "./chunk-C3VLGVSQ.js";
|
|
36
41
|
import {
|
|
37
42
|
createChatErrorMessage,
|
|
38
43
|
createChatMessageMessage,
|
|
@@ -41,6 +46,7 @@ import {
|
|
|
41
46
|
createGitStatusMessage,
|
|
42
47
|
createQueueStateMessage,
|
|
43
48
|
createSessionRunningMessage,
|
|
49
|
+
createSessionStateMessage,
|
|
44
50
|
isAskAnswerPayload,
|
|
45
51
|
isSessionLoadPayload,
|
|
46
52
|
parseClientMessage,
|
|
@@ -48,6 +54,10 @@ import {
|
|
|
48
54
|
storedEventToServerMessage
|
|
49
55
|
} from "./chunk-F4PMNP7S.js";
|
|
50
56
|
import {
|
|
57
|
+
getPlatformShell
|
|
58
|
+
} from "./chunk-X5DOUA3Z.js";
|
|
59
|
+
import {
|
|
60
|
+
getPendingQuestionsForSession,
|
|
51
61
|
provideAnswer
|
|
52
62
|
} from "./chunk-EU3WWTFH.js";
|
|
53
63
|
import {
|
|
@@ -82,6 +92,9 @@ var TerminalManager = class {
|
|
|
82
92
|
generateId() {
|
|
83
93
|
return `term_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`;
|
|
84
94
|
}
|
|
95
|
+
// Uses getPlatformShell() directly instead of spawnShell() because
|
|
96
|
+
// node-pty.spawn() has a different API than child_process.spawn().
|
|
97
|
+
// PTY requires the command and argv separately, not a shell -c invocation.
|
|
85
98
|
getShell() {
|
|
86
99
|
return getPlatformShell().command;
|
|
87
100
|
}
|
|
@@ -446,13 +459,16 @@ var TERMINAL_BLOCKED = "$blocked";
|
|
|
446
459
|
import { spawn as spawn2 } from "child_process";
|
|
447
460
|
function getGitDiffFiles(cwd) {
|
|
448
461
|
return new Promise((resolve) => {
|
|
462
|
+
const env = gitSpawnEnv();
|
|
449
463
|
const diffProc = spawn2("git", ["diff", "--name-status", "HEAD"], {
|
|
450
464
|
cwd,
|
|
465
|
+
env,
|
|
451
466
|
stdio: ["ignore", "pipe", "pipe"],
|
|
452
467
|
windowsHide: true
|
|
453
468
|
});
|
|
454
469
|
const statusProc = spawn2("git", ["status", "--porcelain"], {
|
|
455
470
|
cwd,
|
|
471
|
+
env,
|
|
456
472
|
stdio: ["ignore", "pipe", "pipe"],
|
|
457
473
|
windowsHide: true
|
|
458
474
|
});
|
|
@@ -595,7 +611,8 @@ function formatCriteriaList(entries) {
|
|
|
595
611
|
}).join("\n");
|
|
596
612
|
}
|
|
597
613
|
async function formatModifiedFiles(session) {
|
|
598
|
-
|
|
614
|
+
const effectiveWorkdir = session.worktree ?? session.workdir;
|
|
615
|
+
return formatGitDiffFiles(effectiveWorkdir);
|
|
599
616
|
}
|
|
600
617
|
function resolveTemplate(template, ctx) {
|
|
601
618
|
let result = template;
|
|
@@ -665,6 +682,21 @@ function emitWorkflowMessage(eventStore, sessionId, content, windowOptions, onMe
|
|
|
665
682
|
}
|
|
666
683
|
return msgId;
|
|
667
684
|
}
|
|
685
|
+
function injectGenericKickoff(sessionId) {
|
|
686
|
+
const eventStore = getEventStore();
|
|
687
|
+
const windowOpts = getCurrentWindowMessageOptions(sessionId);
|
|
688
|
+
const msgId = crypto.randomUUID();
|
|
689
|
+
eventStore.append(
|
|
690
|
+
sessionId,
|
|
691
|
+
createMessageStartEvent(msgId, "user", "Proceed with the current step.", {
|
|
692
|
+
...windowOpts ?? {},
|
|
693
|
+
isSystemGenerated: true,
|
|
694
|
+
messageKind: "auto-prompt",
|
|
695
|
+
metadata: { type: "workflow", name: "Workflow", color: "#f59e0b" }
|
|
696
|
+
})
|
|
697
|
+
);
|
|
698
|
+
eventStore.append(sessionId, { type: "message.done", data: { messageId: msgId } });
|
|
699
|
+
}
|
|
668
700
|
function getCurrentWindowMessageOptions(sessionId) {
|
|
669
701
|
const contextWindowId = getCurrentContextWindowId(sessionId);
|
|
670
702
|
return contextWindowId ? { contextWindowId } : void 0;
|
|
@@ -756,7 +788,7 @@ async function executeWorkflow(workflow, options, subGroup) {
|
|
|
756
788
|
const currentWindowMessageOptions = getCurrentWindowMessageOptions(sessionId);
|
|
757
789
|
const criteriaEntries = session.metadataEntries["criteria"] ?? [];
|
|
758
790
|
const templateCtx = {
|
|
759
|
-
workdir: session.workdir,
|
|
791
|
+
workdir: session.worktree ?? session.workdir,
|
|
760
792
|
reason: buildReason(session.metadataEntries),
|
|
761
793
|
verifierFindings: lastStepOutput["content"] ?? "",
|
|
762
794
|
previousStepOutput: lastStepOutput["stdout"] ?? "",
|
|
@@ -835,15 +867,11 @@ async function executeWorkflow(workflow, options, subGroup) {
|
|
|
835
867
|
agentStep.agentId ?? "planner",
|
|
836
868
|
append,
|
|
837
869
|
{
|
|
838
|
-
...!firstEntryForStep.has(step.id) && !agentStep.prompt
|
|
870
|
+
...!firstEntryForStep.has(step.id) && !agentStep.prompt ? { injectKickoff: () => injectGenericKickoff(sessionId) } : {},
|
|
839
871
|
onToolExecuted: (toolCall, toolResult) => {
|
|
840
872
|
if (toolCall.name === "step_done" && toolResult.success) {
|
|
841
873
|
stepDoneCalled = true;
|
|
842
874
|
}
|
|
843
|
-
if (toolResult.success && ["write_file", "edit_file"].includes(toolCall.name)) {
|
|
844
|
-
const path = toolCall.arguments["path"];
|
|
845
|
-
sessionManager.addModifiedFile(sessionId, path);
|
|
846
|
-
}
|
|
847
875
|
}
|
|
848
876
|
}
|
|
849
877
|
);
|
|
@@ -932,7 +960,7 @@ async function executeWorkflow(workflow, options, subGroup) {
|
|
|
932
960
|
})
|
|
933
961
|
);
|
|
934
962
|
}
|
|
935
|
-
const result = await executeShellCommand(command, session.workdir, timeout, signal);
|
|
963
|
+
const result = await executeShellCommand(command, session.worktree ?? session.workdir, timeout, signal);
|
|
936
964
|
const output = [result.stdout, result.stderr].filter(Boolean).join("\n").trim();
|
|
937
965
|
lastStepOutput = { stdout: result.stdout ?? "", stderr: result.stderr ?? "", exitCode: String(result.exitCode) };
|
|
938
966
|
const outputContent = output ? `Exit code: ${result.exitCode}
|
|
@@ -1189,6 +1217,7 @@ function moduleGitBranch(cwd) {
|
|
|
1189
1217
|
return new Promise((resolve) => {
|
|
1190
1218
|
const proc = spawn3("git", ["rev-parse", "--abbrev-ref", "HEAD"], {
|
|
1191
1219
|
cwd,
|
|
1220
|
+
env: gitSpawnEnv(),
|
|
1192
1221
|
stdio: ["ignore", "pipe", "ignore"],
|
|
1193
1222
|
windowsHide: true
|
|
1194
1223
|
});
|
|
@@ -1211,13 +1240,16 @@ function hashContent(content) {
|
|
|
1211
1240
|
}
|
|
1212
1241
|
function moduleGitDiff(cwd) {
|
|
1213
1242
|
return new Promise((resolve) => {
|
|
1243
|
+
const env = gitSpawnEnv();
|
|
1214
1244
|
const diffProc = spawn3("git", ["diff", "--name-status", "HEAD"], {
|
|
1215
1245
|
cwd,
|
|
1246
|
+
env,
|
|
1216
1247
|
stdio: ["ignore", "pipe", "pipe"],
|
|
1217
1248
|
windowsHide: true
|
|
1218
1249
|
});
|
|
1219
1250
|
const statusProc = spawn3("git", ["status", "--porcelain"], {
|
|
1220
1251
|
cwd,
|
|
1252
|
+
env,
|
|
1221
1253
|
stdio: ["ignore", "pipe", "pipe"],
|
|
1222
1254
|
windowsHide: true
|
|
1223
1255
|
});
|
|
@@ -1570,6 +1602,40 @@ function createWebSocketServer(httpServer, _config, getLLMClient, getActiveProvi
|
|
|
1570
1602
|
})
|
|
1571
1603
|
);
|
|
1572
1604
|
});
|
|
1605
|
+
sessionManager.subscribe((event) => {
|
|
1606
|
+
if (event.type === "session_updated") {
|
|
1607
|
+
const updatedSession = event.session;
|
|
1608
|
+
const eventStore = getEventStore();
|
|
1609
|
+
const events = eventStore.getEvents(updatedSession.id);
|
|
1610
|
+
const messages = buildMessagesFromStoredEvents(events);
|
|
1611
|
+
const pendingConfirmations = foldPendingConfirmations(events);
|
|
1612
|
+
const pendingQuestions = getPendingQuestionsForSession(updatedSession.id);
|
|
1613
|
+
const effectiveWorkdir = updatedSession.worktree ?? updatedSession.workdir;
|
|
1614
|
+
let worktreeChanged = false;
|
|
1615
|
+
for (const [, client] of clients) {
|
|
1616
|
+
if (client.activeSessionId === updatedSession.id && client.activeWorkdir !== effectiveWorkdir) {
|
|
1617
|
+
worktreeChanged = true;
|
|
1618
|
+
const prevWorkdir = client.activeWorkdir;
|
|
1619
|
+
client.activeWorkdir = effectiveWorkdir;
|
|
1620
|
+
if (prevWorkdir) moduleStopGitPolling(prevWorkdir);
|
|
1621
|
+
}
|
|
1622
|
+
}
|
|
1623
|
+
if (effectiveWorkdir) moduleStartGitPolling(effectiveWorkdir);
|
|
1624
|
+
broadcastForSession(
|
|
1625
|
+
updatedSession.id,
|
|
1626
|
+
createSessionStateMessage(updatedSession, messages, pendingConfirmations, pendingQuestions)
|
|
1627
|
+
);
|
|
1628
|
+
if (worktreeChanged && effectiveWorkdir) {
|
|
1629
|
+
;
|
|
1630
|
+
(async () => {
|
|
1631
|
+
const branch = await moduleGitBranch(effectiveWorkdir);
|
|
1632
|
+
if (!branch) return;
|
|
1633
|
+
const { files } = await moduleGitDiff(effectiveWorkdir);
|
|
1634
|
+
broadcastForSession(updatedSession.id, createGitStatusMessage(branch, files));
|
|
1635
|
+
})();
|
|
1636
|
+
}
|
|
1637
|
+
}
|
|
1638
|
+
});
|
|
1573
1639
|
onProcessEvent((_processId, msg) => {
|
|
1574
1640
|
const sessionId = msg.sessionId;
|
|
1575
1641
|
if (!sessionId) return;
|
|
@@ -1766,13 +1832,14 @@ async function handleClientMessage(ws, client, message, _getLLMClient, _getActiv
|
|
|
1766
1832
|
return;
|
|
1767
1833
|
}
|
|
1768
1834
|
client.activeSessionId = session.id;
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
const
|
|
1835
|
+
const effectiveWorkdir = session.worktree ?? session.workdir;
|
|
1836
|
+
client.activeWorkdir = effectiveWorkdir;
|
|
1837
|
+
if (effectiveWorkdir) {
|
|
1838
|
+
const branch = await moduleGitBranch(effectiveWorkdir);
|
|
1839
|
+
const { files } = await moduleGitDiff(effectiveWorkdir);
|
|
1773
1840
|
const msg = createGitStatusMessage(branch, files);
|
|
1774
1841
|
send(msg);
|
|
1775
|
-
if (branch) moduleStartGitPolling(
|
|
1842
|
+
if (branch) moduleStartGitPolling(effectiveWorkdir);
|
|
1776
1843
|
}
|
|
1777
1844
|
ensureEventStoreSubscription(session.id);
|
|
1778
1845
|
send({ type: "ack", payload: { sessionId: session.id }, id: message.id });
|
|
@@ -1995,7 +2062,6 @@ ${content}` : workflowInfo;
|
|
|
1995
2062
|
sessionId,
|
|
1996
2063
|
llmClient: llmForSession(sessionId),
|
|
1997
2064
|
statsIdentity: statsForSession(sessionId),
|
|
1998
|
-
injectWorkflowKickoff: !hasUserMessage,
|
|
1999
2065
|
...launchPayload?.workflowId ? { workflowId: launchPayload.workflowId } : {},
|
|
2000
2066
|
...launchPayload?.subGroup ? { subGroup: launchPayload.subGroup } : {},
|
|
2001
2067
|
...hasUserMessage ? {
|
|
@@ -2092,4 +2158,4 @@ export {
|
|
|
2092
2158
|
signalMcpReady,
|
|
2093
2159
|
createWebSocketServer
|
|
2094
2160
|
};
|
|
2095
|
-
//# sourceMappingURL=chunk-
|
|
2161
|
+
//# sourceMappingURL=chunk-B6JUWVTK.js.map
|
|
@@ -11,8 +11,9 @@ import {
|
|
|
11
11
|
buildNonStreamingCreateParams,
|
|
12
12
|
buildStreamingCreateParams,
|
|
13
13
|
getThinking,
|
|
14
|
-
mapFinishReason
|
|
15
|
-
|
|
14
|
+
mapFinishReason,
|
|
15
|
+
parseToolArguments
|
|
16
|
+
} from "./chunk-BL5LOLVA.js";
|
|
16
17
|
import {
|
|
17
18
|
LLMError,
|
|
18
19
|
OpenAIHttpClient
|
|
@@ -92,11 +93,10 @@ function createLLMClient(config, initialBackend = "unknown") {
|
|
|
92
93
|
const message = choice.message;
|
|
93
94
|
const content = message.content ?? "";
|
|
94
95
|
const thinkingContent = getThinking(message, thinkingField) ?? "";
|
|
95
|
-
const toolCalls = message.tool_calls?.map((tc) =>
|
|
96
|
-
id: tc.id,
|
|
97
|
-
name: tc.function.name,
|
|
98
|
-
|
|
99
|
-
}));
|
|
96
|
+
const toolCalls = message.tool_calls?.map((tc) => {
|
|
97
|
+
const { arguments: args, parseError } = parseToolArguments(tc.function.arguments, { id: tc.id, name: tc.function.name });
|
|
98
|
+
return { id: tc.id, name: tc.function.name, arguments: args, ...parseError ? { parseError } : {} };
|
|
99
|
+
});
|
|
100
100
|
return {
|
|
101
101
|
id: httpResponse.id,
|
|
102
102
|
content,
|
|
@@ -222,20 +222,21 @@ function createLLMClient(config, initialBackend = "unknown") {
|
|
|
222
222
|
const finalThinking = fullThinking.trim();
|
|
223
223
|
const parsedToolCalls = [];
|
|
224
224
|
for (const [, tc] of toolCalls) {
|
|
225
|
-
|
|
225
|
+
const { arguments: args, parseError } = parseToolArguments(tc.arguments, { id: tc.id, name: tc.name });
|
|
226
|
+
if (parseError) {
|
|
227
|
+
logger.warn("Failed to parse tool call arguments", { name: tc.name, arguments: tc.arguments, parseError });
|
|
226
228
|
parsedToolCalls.push({
|
|
227
229
|
id: tc.id,
|
|
228
230
|
name: tc.name,
|
|
229
|
-
arguments:
|
|
231
|
+
arguments: args,
|
|
232
|
+
parseError,
|
|
233
|
+
rawArguments: tc.arguments
|
|
230
234
|
});
|
|
231
|
-
}
|
|
232
|
-
logger.warn("Failed to parse tool call arguments", { name: tc.name, arguments: tc.arguments });
|
|
235
|
+
} else {
|
|
233
236
|
parsedToolCalls.push({
|
|
234
237
|
id: tc.id,
|
|
235
238
|
name: tc.name,
|
|
236
|
-
arguments:
|
|
237
|
-
parseError: error instanceof Error ? error.message : "Unknown JSON parse error",
|
|
238
|
-
rawArguments: tc.arguments
|
|
239
|
+
arguments: args
|
|
239
240
|
});
|
|
240
241
|
}
|
|
241
242
|
}
|
|
@@ -264,4 +265,4 @@ function createLLMClient(config, initialBackend = "unknown") {
|
|
|
264
265
|
export {
|
|
265
266
|
createLLMClient
|
|
266
267
|
};
|
|
267
|
-
//# sourceMappingURL=chunk-
|
|
268
|
+
//# sourceMappingURL=chunk-B7WGOK7G.js.map
|
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
// src/server/llm/client-pure.ts
|
|
2
|
+
function parseToolArguments(raw, _meta) {
|
|
3
|
+
const input = raw?.trim() ? raw : "{}";
|
|
4
|
+
try {
|
|
5
|
+
const parsed = JSON.parse(input);
|
|
6
|
+
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
7
|
+
return { arguments: {}, parseError: "Tool arguments must be a JSON object" };
|
|
8
|
+
}
|
|
9
|
+
return { arguments: parsed };
|
|
10
|
+
} catch (error) {
|
|
11
|
+
return {
|
|
12
|
+
arguments: {},
|
|
13
|
+
parseError: error instanceof Error ? error.message : "Invalid JSON"
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
}
|
|
2
17
|
function buildModelParams(params) {
|
|
3
18
|
return {
|
|
4
19
|
...params.temperature !== void 0 && { temperature: params.temperature },
|
|
@@ -195,6 +210,7 @@ function mapFinishReason(reason) {
|
|
|
195
210
|
}
|
|
196
211
|
|
|
197
212
|
export {
|
|
213
|
+
parseToolArguments,
|
|
198
214
|
buildModelParams,
|
|
199
215
|
getThinking,
|
|
200
216
|
convertMessages,
|
|
@@ -203,4 +219,4 @@ export {
|
|
|
203
219
|
buildStreamingCreateParams,
|
|
204
220
|
mapFinishReason
|
|
205
221
|
};
|
|
206
|
-
//# sourceMappingURL=chunk-
|
|
222
|
+
//# sourceMappingURL=chunk-BL5LOLVA.js.map
|
|
@@ -822,9 +822,9 @@ function buildSnapshotFromSessionState(input) {
|
|
|
822
822
|
criteria: session.criteria,
|
|
823
823
|
metadataEntries: foldedState.metadataEntries,
|
|
824
824
|
contextState: {
|
|
825
|
-
currentTokens:
|
|
825
|
+
currentTokens: foldedState.contextState.currentTokens,
|
|
826
826
|
maxTokens: foldedState.contextState.maxTokens,
|
|
827
|
-
compactionCount:
|
|
827
|
+
compactionCount: foldedState.contextState.compactionCount,
|
|
828
828
|
dangerZone: foldedState.contextState.dangerZone,
|
|
829
829
|
canCompact: foldedState.contextState.canCompact,
|
|
830
830
|
dynamicContextChanged: foldedState.contextState.dynamicContextChanged
|
|
@@ -867,4 +867,4 @@ export {
|
|
|
867
867
|
buildSnapshot,
|
|
868
868
|
buildSnapshotFromSessionState
|
|
869
869
|
};
|
|
870
|
-
//# sourceMappingURL=chunk-
|
|
870
|
+
//# sourceMappingURL=chunk-C3VLGVSQ.js.map
|
|
@@ -173,6 +173,10 @@ function runMigrations(db2) {
|
|
|
173
173
|
logger.info("Migrating sessions table: adding cached_hash column");
|
|
174
174
|
db2.exec(`ALTER TABLE sessions ADD COLUMN cached_hash TEXT`);
|
|
175
175
|
}
|
|
176
|
+
if (!columnNames.includes("worktree")) {
|
|
177
|
+
logger.info("Migrating sessions table: adding worktree column");
|
|
178
|
+
db2.exec(`ALTER TABLE sessions ADD COLUMN worktree TEXT`);
|
|
179
|
+
}
|
|
176
180
|
logger.info("Database migrations completed");
|
|
177
181
|
}
|
|
178
182
|
|
|
@@ -180,4 +184,4 @@ export {
|
|
|
180
184
|
initDatabase,
|
|
181
185
|
getDatabase
|
|
182
186
|
};
|
|
183
|
-
//# sourceMappingURL=chunk-
|
|
187
|
+
//# sourceMappingURL=chunk-GMXKJGJ2.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getDatabase
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-GMXKJGJ2.js";
|
|
4
4
|
|
|
5
5
|
// src/server/db/projects.ts
|
|
6
6
|
function createProject(name, workdir) {
|
|
@@ -117,4 +117,4 @@ export {
|
|
|
117
117
|
deleteProject,
|
|
118
118
|
toggleStar
|
|
119
119
|
};
|
|
120
|
-
//# sourceMappingURL=chunk-
|
|
120
|
+
//# sourceMappingURL=chunk-KXVFHMSM.js.map
|
|
@@ -164,7 +164,7 @@ async function runCli(options) {
|
|
|
164
164
|
break;
|
|
165
165
|
}
|
|
166
166
|
case "provider": {
|
|
167
|
-
const { runProviderCommand } = await import("./provider-
|
|
167
|
+
const { runProviderCommand } = await import("./provider-BDH6JGZB.js");
|
|
168
168
|
const [, subcommand] = positionals;
|
|
169
169
|
await runProviderCommand(mode, subcommand);
|
|
170
170
|
break;
|
|
@@ -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-32FAA4FX.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-MQHMT5WF.js.map
|
|
@@ -10,25 +10,24 @@ import {
|
|
|
10
10
|
loadAllAgentsDefault,
|
|
11
11
|
processEventsForConversation,
|
|
12
12
|
runTopLevelAgentLoop
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-YU6DZAVA.js";
|
|
14
14
|
import {
|
|
15
15
|
TurnMetrics,
|
|
16
|
-
WORKFLOW_KICKOFF_PROMPT,
|
|
17
16
|
buildAgentReminder,
|
|
18
17
|
buildAgentSmallReminder,
|
|
19
18
|
buildTopLevelSystemPrompt,
|
|
20
19
|
createChatDoneEvent,
|
|
21
20
|
createMessageStartEvent
|
|
22
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-TJO4QFDQ.js";
|
|
23
22
|
import {
|
|
24
23
|
getCurrentContextWindowId,
|
|
25
24
|
getCurrentWindowMessageOptions,
|
|
26
25
|
getEventStore,
|
|
27
26
|
getRuntimeConfig
|
|
28
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-TFDK6VSG.js";
|
|
29
28
|
import {
|
|
30
29
|
buildSnapshotFromSessionState
|
|
31
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-C3VLGVSQ.js";
|
|
32
31
|
import {
|
|
33
32
|
logger
|
|
34
33
|
} from "./chunk-K44MW7JJ.js";
|
|
@@ -65,7 +64,7 @@ function resolveAgentDef(sessionManager, sessionId) {
|
|
|
65
64
|
}
|
|
66
65
|
async function buildCachedPrompt(sessionManager, sessionId, agentDef) {
|
|
67
66
|
const { instructionContent, skills } = await loadSessionContext(sessionManager, sessionId);
|
|
68
|
-
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-
|
|
67
|
+
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-INWP6FGV.js");
|
|
69
68
|
const tools = getToolRegistryForAgent2(agentDef).definitions;
|
|
70
69
|
const toolFingerprint = getToolFingerprint(tools);
|
|
71
70
|
const allAgents = await loadAllAgentsDefault();
|
|
@@ -78,7 +77,7 @@ async function buildCachedPrompt(sessionManager, sessionId, agentDef) {
|
|
|
78
77
|
async function computeSessionHash(sessionManager, sessionId) {
|
|
79
78
|
const { instructionContent, skills } = await loadSessionContext(sessionManager, sessionId);
|
|
80
79
|
const agentDef = await resolveAgentDef(sessionManager, sessionId);
|
|
81
|
-
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-
|
|
80
|
+
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-INWP6FGV.js");
|
|
82
81
|
const tools = getToolRegistryForAgent2(agentDef).definitions;
|
|
83
82
|
const toolFingerprint = getToolFingerprint(tools);
|
|
84
83
|
return computeDynamicContextHash(instructionContent, skills, toolFingerprint);
|
|
@@ -96,7 +95,7 @@ async function applyDynamicContext(sessionManager, sessionId) {
|
|
|
96
95
|
|
|
97
96
|
// src/server/chat/orchestrator.ts
|
|
98
97
|
async function buildRetryPatterns() {
|
|
99
|
-
const { getSetting, SETTINGS_KEYS } = await import("./settings-
|
|
98
|
+
const { getSetting, SETTINGS_KEYS } = await import("./settings-6ZPWOBWL.js");
|
|
100
99
|
const raw = getSetting(SETTINGS_KEYS.RETRY_PATTERNS);
|
|
101
100
|
if (!raw) {
|
|
102
101
|
const oldXmlProtection = getSetting("llm.disableXmlProtection");
|
|
@@ -338,30 +337,6 @@ async function runAgentTurn(options, turnMetrics, agentId, append, callbacks) {
|
|
|
338
337
|
turnMetrics
|
|
339
338
|
);
|
|
340
339
|
}
|
|
341
|
-
function injectWorkflowKickoffIfNeeded(sessionManager, sessionId, eventStore) {
|
|
342
|
-
const session = sessionManager.requireSession(sessionId);
|
|
343
|
-
const currentWindowMessageOptions = getCurrentContextWindowId(sessionId) ? { contextWindowId: getCurrentContextWindowId(sessionId) } : void 0;
|
|
344
|
-
const events = eventStore.getEvents(sessionId);
|
|
345
|
-
const hasKickoff = events.some((e) => {
|
|
346
|
-
if (e.type !== "message.start") return false;
|
|
347
|
-
const data = e.data;
|
|
348
|
-
return data.messageKind === "auto-prompt" && data.content?.includes("fulfil the");
|
|
349
|
-
});
|
|
350
|
-
if (!hasKickoff) {
|
|
351
|
-
const kickoffMsgId = crypto.randomUUID();
|
|
352
|
-
const kickoffContent = WORKFLOW_KICKOFF_PROMPT(session.criteria.length);
|
|
353
|
-
eventStore.append(
|
|
354
|
-
sessionId,
|
|
355
|
-
createMessageStartEvent(kickoffMsgId, "user", kickoffContent, {
|
|
356
|
-
...currentWindowMessageOptions ?? {},
|
|
357
|
-
isSystemGenerated: true,
|
|
358
|
-
messageKind: "auto-prompt",
|
|
359
|
-
metadata: { type: "workflow", name: "Workflow", color: "#f59e0b" }
|
|
360
|
-
})
|
|
361
|
-
);
|
|
362
|
-
eventStore.append(sessionId, { type: "message.done", data: { messageId: kickoffMsgId } });
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
340
|
function buildSnapshot(sessionManager, sessionId, _lastStats) {
|
|
366
341
|
const eventStore = getEventStore();
|
|
367
342
|
const session = sessionManager.requireSession(sessionId);
|
|
@@ -380,7 +355,6 @@ export {
|
|
|
380
355
|
computeSessionHash,
|
|
381
356
|
applyDynamicContext,
|
|
382
357
|
runChatTurn,
|
|
383
|
-
runAgentTurn
|
|
384
|
-
injectWorkflowKickoffIfNeeded
|
|
358
|
+
runAgentTurn
|
|
385
359
|
};
|
|
386
|
-
//# sourceMappingURL=chunk-
|
|
360
|
+
//# sourceMappingURL=chunk-PYRH4G2J.js.map
|