openfox 1.6.100 → 1.6.102
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/{auto-compaction-NLUAT562.js → auto-compaction-7LMAY5JV.js} +7 -7
- package/dist/{chat-handler-5KT442LF.js → chat-handler-ZJVIM7U4.js} +10 -10
- package/dist/{chunk-DCYDTDWO.js → chunk-6WZI6F6G.js} +20 -4
- package/dist/{chunk-VMRDLSNP.js → chunk-AI3CY7T6.js} +3 -3
- package/dist/{chunk-IB3TCZF7.js → chunk-IZC2EZ4D.js} +4 -4
- package/dist/{chunk-BZBT5VJL.js → chunk-J335KZ6U.js} +4 -3
- package/dist/{chunk-X3GA33UG.js → chunk-MEYDERUX.js} +1 -1
- package/dist/{chunk-Y532ULQ2.js → chunk-PDPXHSNZ.js} +7 -5
- package/dist/{chunk-TYIHIHJF.js → chunk-PSJIT5LZ.js} +3 -1
- package/dist/{chunk-MEOKWBXX.js → chunk-RCQOHFAN.js} +10 -6
- package/dist/{chunk-PFSOVCEN.js → chunk-RYEZ7LDX.js} +74 -13
- package/dist/{chunk-KOQOPNE5.js → chunk-ZPCJLFAG.js} +187 -50
- package/dist/cli/dev.js +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/{events-QBKF32WS.js → events-OKTZRT3Y.js} +3 -3
- package/dist/{folding-EQPDQKQS.js → folding-Z3OMWNOE.js} +2 -2
- package/dist/{orchestrator-4GHZFEGT.js → orchestrator-5EYWRAZ2.js} +8 -8
- package/dist/package.json +3 -1
- package/dist/{processor-I3WKCUAE.js → processor-XJYCHNV6.js} +7 -7
- package/dist/{protocol-eKAFeMXn.d.ts → protocol-CdVNdXi8.d.ts} +6 -1
- package/dist/{protocol-GKGDN64O.js → protocol-TNC6MCJV.js} +3 -3
- package/dist/{serve-CJEAHPPU.js → serve-SGFEQ5N7.js} +9 -9
- package/dist/server/index.d.ts +10 -1
- package/dist/server/index.js +8 -8
- package/dist/{settings-4334IX63.js → settings-VRAOAPLA.js} +2 -2
- package/dist/shared/index.d.ts +2 -2
- package/dist/shared/index.js +1 -1
- package/dist/{tools-UBURWNND.js → tools-WFIYKFBE.js} +7 -7
- package/dist/web/assets/{index-DzlTckHS.js → index-DcGVOFte.js} +61 -61
- package/dist/web/index.html +1 -1
- package/dist/web/sw.js +1 -1
- package/package.json +3 -1
|
@@ -2,19 +2,19 @@ import {
|
|
|
2
2
|
maybeAutoCompactContext,
|
|
3
3
|
performManualContextCompaction,
|
|
4
4
|
resolveCompactionStatsIdentity
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-RYEZ7LDX.js";
|
|
6
|
+
import "./chunk-PSJIT5LZ.js";
|
|
7
7
|
import "./chunk-XAMAYRDA.js";
|
|
8
8
|
import "./chunk-DL6ZILAF.js";
|
|
9
9
|
import "./chunk-PBGOZMVY.js";
|
|
10
10
|
import "./chunk-VRGRAQDG.js";
|
|
11
11
|
import "./chunk-HGAMIPFO.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-J335KZ6U.js";
|
|
13
13
|
import "./chunk-FBGWG4N6.js";
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-6WZI6F6G.js";
|
|
15
|
+
import "./chunk-RCQOHFAN.js";
|
|
16
16
|
import "./chunk-BJYPTN5S.js";
|
|
17
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-MEYDERUX.js";
|
|
18
18
|
import "./chunk-CQGTEGKL.js";
|
|
19
19
|
import "./chunk-CGZHLM3K.js";
|
|
20
20
|
import "./chunk-SZKEGZIB.js";
|
|
@@ -24,4 +24,4 @@ export {
|
|
|
24
24
|
performManualContextCompaction,
|
|
25
25
|
resolveCompactionStatsIdentity
|
|
26
26
|
};
|
|
27
|
-
//# sourceMappingURL=auto-compaction-
|
|
27
|
+
//# sourceMappingURL=auto-compaction-7LMAY5JV.js.map
|
|
@@ -5,12 +5,12 @@ import {
|
|
|
5
5
|
generateSessionName,
|
|
6
6
|
getSessionMessageCount,
|
|
7
7
|
needsNameGenerationCheck
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-IZC2EZ4D.js";
|
|
9
9
|
import {
|
|
10
10
|
runChatTurn
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-PDPXHSNZ.js";
|
|
12
|
+
import "./chunk-RYEZ7LDX.js";
|
|
13
|
+
import "./chunk-PSJIT5LZ.js";
|
|
14
14
|
import "./chunk-XAMAYRDA.js";
|
|
15
15
|
import "./chunk-DL6ZILAF.js";
|
|
16
16
|
import "./chunk-PBGOZMVY.js";
|
|
@@ -18,16 +18,16 @@ import "./chunk-VRGRAQDG.js";
|
|
|
18
18
|
import "./chunk-HGAMIPFO.js";
|
|
19
19
|
import {
|
|
20
20
|
getEventStore
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-J335KZ6U.js";
|
|
22
22
|
import "./chunk-FBGWG4N6.js";
|
|
23
|
-
import "./chunk-
|
|
23
|
+
import "./chunk-6WZI6F6G.js";
|
|
24
24
|
import {
|
|
25
25
|
createChatMessageMessage,
|
|
26
26
|
createPhaseChangedMessage,
|
|
27
27
|
createSessionRunningMessage
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-RCQOHFAN.js";
|
|
29
29
|
import "./chunk-BJYPTN5S.js";
|
|
30
|
-
import "./chunk-
|
|
30
|
+
import "./chunk-MEYDERUX.js";
|
|
31
31
|
import "./chunk-CQGTEGKL.js";
|
|
32
32
|
import "./chunk-CGZHLM3K.js";
|
|
33
33
|
import "./chunk-SZKEGZIB.js";
|
|
@@ -61,7 +61,7 @@ async function startChatSession(sessionId, content, deps, options) {
|
|
|
61
61
|
sessionManager.setRunning(sessionId, true);
|
|
62
62
|
broadcastForSession(sessionId, createSessionRunningMessage(true));
|
|
63
63
|
try {
|
|
64
|
-
const { maybeAutoCompactContext } = await import("./auto-compaction-
|
|
64
|
+
const { maybeAutoCompactContext } = await import("./auto-compaction-7LMAY5JV.js");
|
|
65
65
|
await maybeAutoCompactContext({
|
|
66
66
|
sessionManager,
|
|
67
67
|
sessionId,
|
|
@@ -175,4 +175,4 @@ export {
|
|
|
175
175
|
startChatSession,
|
|
176
176
|
stopSessionExecution
|
|
177
177
|
};
|
|
178
|
-
//# sourceMappingURL=chat-handler-
|
|
178
|
+
//# sourceMappingURL=chat-handler-ZJVIM7U4.js.map
|
|
@@ -631,11 +631,14 @@ function foldSessionState(events, initialWindowId, maxTokens, initialMessages) {
|
|
|
631
631
|
maxTokens,
|
|
632
632
|
compactionCount: contextResult.compactionCount,
|
|
633
633
|
dangerZone: false,
|
|
634
|
-
canCompact: false
|
|
634
|
+
canCompact: false,
|
|
635
|
+
dynamicContextChanged: false
|
|
635
636
|
};
|
|
636
637
|
const contextState = baseContextState.compactionCount !== contextResult.compactionCount || baseContextState.maxTokens !== maxTokens ? { ...baseContextState, compactionCount: contextResult.compactionCount, maxTokens } : { ...baseContextState, maxTokens };
|
|
637
638
|
let messageReminderMode;
|
|
638
639
|
let snapshotReminderMode;
|
|
640
|
+
let cachedSystemPrompt;
|
|
641
|
+
let dynamicContextHash;
|
|
639
642
|
for (let i = events.length - 1; i >= 0; i--) {
|
|
640
643
|
const event = events[i];
|
|
641
644
|
if (event.type === "message.start") {
|
|
@@ -656,6 +659,12 @@ function foldSessionState(events, initialWindowId, maxTokens, initialMessages) {
|
|
|
656
659
|
mode: snapshotData.lastModeWithReminder
|
|
657
660
|
};
|
|
658
661
|
}
|
|
662
|
+
if (snapshotData.cachedSystemPrompt && !cachedSystemPrompt) {
|
|
663
|
+
cachedSystemPrompt = snapshotData.cachedSystemPrompt;
|
|
664
|
+
}
|
|
665
|
+
if (snapshotData.dynamicContextHash && !dynamicContextHash) {
|
|
666
|
+
dynamicContextHash = snapshotData.dynamicContextHash;
|
|
667
|
+
}
|
|
659
668
|
}
|
|
660
669
|
}
|
|
661
670
|
let lastModeWithReminder;
|
|
@@ -760,6 +769,8 @@ function foldSessionState(events, initialWindowId, maxTokens, initialMessages) {
|
|
|
760
769
|
currentContextWindowId: contextResult.currentContextWindowId,
|
|
761
770
|
readFiles: contextResult.readFiles,
|
|
762
771
|
...lastModeWithReminder !== void 0 && { lastModeWithReminder },
|
|
772
|
+
...cachedSystemPrompt !== void 0 && { cachedSystemPrompt },
|
|
773
|
+
...dynamicContextHash !== void 0 && { dynamicContextHash },
|
|
763
774
|
pendingConfirmations,
|
|
764
775
|
...sessionInit !== void 0 && { sessionInit },
|
|
765
776
|
...sessionTitle !== void 0 && { sessionTitle },
|
|
@@ -783,6 +794,8 @@ function buildSnapshot(foldedState, latestSeq, snapshotAt = Date.now()) {
|
|
|
783
794
|
todos: foldedState.todos,
|
|
784
795
|
readFiles: foldedState.readFiles,
|
|
785
796
|
...foldedState.lastModeWithReminder !== void 0 && { lastModeWithReminder: foldedState.lastModeWithReminder },
|
|
797
|
+
...foldedState.cachedSystemPrompt !== void 0 && { cachedSystemPrompt: foldedState.cachedSystemPrompt },
|
|
798
|
+
...foldedState.dynamicContextHash !== void 0 && { dynamicContextHash: foldedState.dynamicContextHash },
|
|
786
799
|
snapshotSeq: latestSeq,
|
|
787
800
|
snapshotAt,
|
|
788
801
|
...foldedState.sessionInit !== void 0 && { sessionInit: foldedState.sessionInit },
|
|
@@ -828,7 +841,8 @@ function buildSnapshotFromSessionState(input) {
|
|
|
828
841
|
maxTokens: foldedState.contextState.maxTokens,
|
|
829
842
|
compactionCount: session.executionState?.compactionCount ?? foldedState.contextState.compactionCount,
|
|
830
843
|
dangerZone: foldedState.contextState.dangerZone,
|
|
831
|
-
canCompact: foldedState.contextState.canCompact
|
|
844
|
+
canCompact: foldedState.contextState.canCompact,
|
|
845
|
+
dynamicContextChanged: foldedState.contextState.dynamicContextChanged
|
|
832
846
|
},
|
|
833
847
|
currentContextWindowId: foldedState.currentContextWindowId,
|
|
834
848
|
todos: foldedState.todos,
|
|
@@ -836,7 +850,9 @@ function buildSnapshotFromSessionState(input) {
|
|
|
836
850
|
snapshotSeq: latestSeq,
|
|
837
851
|
snapshotAt,
|
|
838
852
|
...foldedState.sessionInit !== void 0 && { sessionInit: foldedState.sessionInit },
|
|
839
|
-
...foldedState.lastModeWithReminder !== void 0 && { lastModeWithReminder: foldedState.lastModeWithReminder }
|
|
853
|
+
...foldedState.lastModeWithReminder !== void 0 && { lastModeWithReminder: foldedState.lastModeWithReminder },
|
|
854
|
+
...input.cachedSystemPrompt !== void 0 ? { cachedSystemPrompt: input.cachedSystemPrompt } : foldedState.cachedSystemPrompt !== void 0 ? { cachedSystemPrompt: foldedState.cachedSystemPrompt } : {},
|
|
855
|
+
...input.dynamicContextHash !== void 0 ? { dynamicContextHash: input.dynamicContextHash } : foldedState.dynamicContextHash !== void 0 ? { dynamicContextHash: foldedState.dynamicContextHash } : {}
|
|
840
856
|
};
|
|
841
857
|
}
|
|
842
858
|
function getMessagesForWindow(messages, windowId) {
|
|
@@ -878,4 +894,4 @@ export {
|
|
|
878
894
|
getMessagesForWindow,
|
|
879
895
|
buildContextMessagesFromMessages
|
|
880
896
|
};
|
|
881
|
-
//# sourceMappingURL=chunk-
|
|
897
|
+
//# sourceMappingURL=chunk-6WZI6F6G.js.map
|
|
@@ -178,7 +178,7 @@ async function runCli(options) {
|
|
|
178
178
|
case "update": {
|
|
179
179
|
const __filename = fileURLToPath(import.meta.url);
|
|
180
180
|
const __dirname = dirname(__filename);
|
|
181
|
-
const updateScriptPath = join(__dirname, "update.sh");
|
|
181
|
+
const updateScriptPath = join(__dirname, "cli", "update.sh");
|
|
182
182
|
const result = spawnSync(updateScriptPath, [], { shell: true, stdio: "inherit" });
|
|
183
183
|
if (result.status !== 0) {
|
|
184
184
|
process.exit(result.status ?? 1);
|
|
@@ -191,7 +191,7 @@ async function runCli(options) {
|
|
|
191
191
|
if (!configExists) {
|
|
192
192
|
await runNetworkSetup(mode);
|
|
193
193
|
}
|
|
194
|
-
const { runServe } = await import("./serve-
|
|
194
|
+
const { runServe } = await import("./serve-SGFEQ5N7.js");
|
|
195
195
|
const serveOptions = { mode };
|
|
196
196
|
if (values.port) serveOptions.port = parseInt(values.port);
|
|
197
197
|
if (values["no-browser"] === true) serveOptions.openBrowser = false;
|
|
@@ -203,4 +203,4 @@ async function runCli(options) {
|
|
|
203
203
|
export {
|
|
204
204
|
runCli
|
|
205
205
|
};
|
|
206
|
-
//# sourceMappingURL=chunk-
|
|
206
|
+
//# sourceMappingURL=chunk-AI3CY7T6.js.map
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getEventStore,
|
|
3
3
|
updateSessionMetadata
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-J335KZ6U.js";
|
|
5
5
|
import {
|
|
6
6
|
buildMessagesFromStoredEvents,
|
|
7
7
|
foldPendingConfirmations
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-6WZI6F6G.js";
|
|
9
9
|
import {
|
|
10
10
|
createContextStateMessage,
|
|
11
11
|
createSessionStateMessage
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-RCQOHFAN.js";
|
|
13
13
|
import {
|
|
14
14
|
logger
|
|
15
15
|
} from "./chunk-K44MW7JJ.js";
|
|
@@ -143,4 +143,4 @@ export {
|
|
|
143
143
|
needsNameGenerationCheck,
|
|
144
144
|
applyGeneratedSessionName
|
|
145
145
|
};
|
|
146
|
-
//# sourceMappingURL=chunk-
|
|
146
|
+
//# sourceMappingURL=chunk-IZC2EZ4D.js.map
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
foldSessionState,
|
|
10
10
|
spreadOptionalMessageFields,
|
|
11
11
|
stripPromptContextMessages
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-6WZI6F6G.js";
|
|
13
13
|
import {
|
|
14
14
|
getRuntimeConfig
|
|
15
15
|
} from "./chunk-CGZHLM3K.js";
|
|
@@ -1072,7 +1072,7 @@ function emitContextCompacted(sessionId, closedWindowId, newWindowId, beforeToke
|
|
|
1072
1072
|
}
|
|
1073
1073
|
});
|
|
1074
1074
|
}
|
|
1075
|
-
function emitContextState(sessionId, currentTokens, maxTokens, compactionCount, dangerZone, canCompact, subAgentId) {
|
|
1075
|
+
function emitContextState(sessionId, currentTokens, maxTokens, compactionCount, dangerZone, canCompact, subAgentId, dynamicContextChanged) {
|
|
1076
1076
|
const eventStore = getEventStore();
|
|
1077
1077
|
eventStore.append(sessionId, {
|
|
1078
1078
|
type: "context.state",
|
|
@@ -1082,6 +1082,7 @@ function emitContextState(sessionId, currentTokens, maxTokens, compactionCount,
|
|
|
1082
1082
|
compactionCount,
|
|
1083
1083
|
dangerZone,
|
|
1084
1084
|
canCompact,
|
|
1085
|
+
dynamicContextChanged: dynamicContextChanged ?? false,
|
|
1085
1086
|
...subAgentId !== void 0 && { subAgentId }
|
|
1086
1087
|
}
|
|
1087
1088
|
});
|
|
@@ -1267,4 +1268,4 @@ export {
|
|
|
1267
1268
|
compactContext,
|
|
1268
1269
|
getRecentUserPromptsForSession
|
|
1269
1270
|
};
|
|
1270
|
-
//# sourceMappingURL=chunk-
|
|
1271
|
+
//# sourceMappingURL=chunk-J335KZ6U.js.map
|
|
@@ -13,14 +13,14 @@ import {
|
|
|
13
13
|
getToolRegistryForAgent,
|
|
14
14
|
loadAllAgentsDefault,
|
|
15
15
|
runTopLevelAgentLoop
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-RYEZ7LDX.js";
|
|
17
17
|
import {
|
|
18
18
|
getCurrentContextWindowId,
|
|
19
19
|
getEventStore
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-J335KZ6U.js";
|
|
21
21
|
import {
|
|
22
22
|
buildSnapshotFromSessionState
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-6WZI6F6G.js";
|
|
24
24
|
import {
|
|
25
25
|
logger
|
|
26
26
|
} from "./chunk-K44MW7JJ.js";
|
|
@@ -313,10 +313,12 @@ function buildSnapshot(sessionManager, sessionId, _lastStats) {
|
|
|
313
313
|
const session = sessionManager.requireSession(sessionId);
|
|
314
314
|
const events = eventStore.getEvents(sessionId);
|
|
315
315
|
const latestSeq = eventStore.getLatestSeq(sessionId) ?? 0;
|
|
316
|
+
const cachedPrompt = sessionManager.getCachedPrompt(sessionId);
|
|
316
317
|
return buildSnapshotFromSessionState({
|
|
317
318
|
session,
|
|
318
319
|
events,
|
|
319
|
-
latestSeq
|
|
320
|
+
latestSeq,
|
|
321
|
+
...cachedPrompt ? { cachedSystemPrompt: cachedPrompt.systemPrompt, dynamicContextHash: cachedPrompt.hash } : {}
|
|
320
322
|
});
|
|
321
323
|
}
|
|
322
324
|
|
|
@@ -327,4 +329,4 @@ export {
|
|
|
327
329
|
runBuilderTurn,
|
|
328
330
|
runVerifierTurn
|
|
329
331
|
};
|
|
330
|
-
//# sourceMappingURL=chunk-
|
|
332
|
+
//# sourceMappingURL=chunk-PDPXHSNZ.js.map
|
|
@@ -16,6 +16,7 @@ var SETTINGS_KEYS = {
|
|
|
16
16
|
DISPLAY_FOLLOW_SYSTEM_THEME: "display.followSystemTheme",
|
|
17
17
|
DISPLAY_SHOW_OPEN_IN_EDITOR: "display.showOpenInEditorLinks",
|
|
18
18
|
LLM_DISABLE_XML_PROTECTION: "llm.disableXmlProtection",
|
|
19
|
+
LLM_DYNAMIC_SYSTEM_PROMPT: "llm.dynamicSystemPrompt",
|
|
19
20
|
KEYBINDINGS: "keybindings"
|
|
20
21
|
};
|
|
21
22
|
var SETTINGS_DEFAULTS = {
|
|
@@ -29,6 +30,7 @@ var SETTINGS_DEFAULTS = {
|
|
|
29
30
|
[SETTINGS_KEYS.DISPLAY_FOLLOW_SYSTEM_THEME]: "true",
|
|
30
31
|
[SETTINGS_KEYS.DISPLAY_SHOW_OPEN_IN_EDITOR]: "false",
|
|
31
32
|
[SETTINGS_KEYS.LLM_DISABLE_XML_PROTECTION]: "false",
|
|
33
|
+
[SETTINGS_KEYS.LLM_DYNAMIC_SYSTEM_PROMPT]: "false",
|
|
32
34
|
[SETTINGS_KEYS.KEYBINDINGS]: JSON.stringify({
|
|
33
35
|
terminalToggle: { type: "double-press", key: "Control", threshold: 300 },
|
|
34
36
|
quickAction: { type: "double-press", key: "Shift", threshold: 300 },
|
|
@@ -86,4 +88,4 @@ export {
|
|
|
86
88
|
deleteSetting,
|
|
87
89
|
getAllSettings
|
|
88
90
|
};
|
|
89
|
-
//# sourceMappingURL=chunk-
|
|
91
|
+
//# sourceMappingURL=chunk-PSJIT5LZ.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createServerMessage,
|
|
3
3
|
isClientMessage
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-MEYDERUX.js";
|
|
5
5
|
|
|
6
6
|
// src/server/ws/protocol.ts
|
|
7
7
|
function enrichMessagesWithToolResults(messages) {
|
|
@@ -66,8 +66,12 @@ function createProjectListMessage(projects, correlationId) {
|
|
|
66
66
|
function createGitStatusMessage(branch, diffFiles, correlationId) {
|
|
67
67
|
return createServerMessage("git.status", { branch, diff: { files: diffFiles } }, correlationId);
|
|
68
68
|
}
|
|
69
|
-
function createChatDeltaMessage(messageId, content) {
|
|
70
|
-
return createServerMessage("chat.delta", {
|
|
69
|
+
function createChatDeltaMessage(messageId, content, subAgentType) {
|
|
70
|
+
return createServerMessage("chat.delta", {
|
|
71
|
+
messageId,
|
|
72
|
+
content,
|
|
73
|
+
...subAgentType ? { subAgentType } : {}
|
|
74
|
+
});
|
|
71
75
|
}
|
|
72
76
|
function createChatThinkingMessage(messageId, content) {
|
|
73
77
|
return createServerMessage("chat.thinking", { messageId, content });
|
|
@@ -176,7 +180,7 @@ function storedEventToServerMessage(event) {
|
|
|
176
180
|
}
|
|
177
181
|
case "message.delta": {
|
|
178
182
|
const data = event.data;
|
|
179
|
-
return createChatDeltaMessage(data.messageId, data.content);
|
|
183
|
+
return createChatDeltaMessage(data.messageId, data.content, data.subAgentType);
|
|
180
184
|
}
|
|
181
185
|
case "message.thinking": {
|
|
182
186
|
const data = event.data;
|
|
@@ -262,7 +266,7 @@ function storedEventToServerMessage(event) {
|
|
|
262
266
|
}
|
|
263
267
|
case "chat.done": {
|
|
264
268
|
const data = event.data;
|
|
265
|
-
return createChatDoneMessage(data.messageId, data.reason, data.stats);
|
|
269
|
+
return createChatDoneMessage(data.messageId, data.reason, data.stats, data.agentType);
|
|
266
270
|
}
|
|
267
271
|
case "chat.error": {
|
|
268
272
|
const data = event.data;
|
|
@@ -322,4 +326,4 @@ export {
|
|
|
322
326
|
createQueueStateMessage,
|
|
323
327
|
storedEventToServerMessage
|
|
324
328
|
};
|
|
325
|
-
//# sourceMappingURL=chunk-
|
|
329
|
+
//# sourceMappingURL=chunk-RCQOHFAN.js.map
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
SETTINGS_KEYS,
|
|
3
3
|
deleteSetting,
|
|
4
4
|
getSetting
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-PSJIT5LZ.js";
|
|
6
6
|
import {
|
|
7
7
|
getProject
|
|
8
8
|
} from "./chunk-XAMAYRDA.js";
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
import {
|
|
32
32
|
getCurrentContextWindowId,
|
|
33
33
|
getEventStore
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-J335KZ6U.js";
|
|
35
35
|
import {
|
|
36
36
|
buildContextMessagesFromEventHistory,
|
|
37
37
|
foldContextState,
|
|
@@ -40,7 +40,7 @@ import {
|
|
|
40
40
|
handleToolCall,
|
|
41
41
|
handleToolResult,
|
|
42
42
|
stripOrphanedToolCalls
|
|
43
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-6WZI6F6G.js";
|
|
44
44
|
import {
|
|
45
45
|
createChatDoneMessage,
|
|
46
46
|
createChatMessageMessage,
|
|
@@ -48,7 +48,7 @@ import {
|
|
|
48
48
|
createChatPathConfirmationMessage,
|
|
49
49
|
createChatVisionFallbackMessage,
|
|
50
50
|
createQueueStateMessage
|
|
51
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-RCQOHFAN.js";
|
|
52
52
|
import {
|
|
53
53
|
AskUserInterrupt,
|
|
54
54
|
askUserTool
|
|
@@ -889,13 +889,14 @@ function createToolResultEvent(messageId, toolCallId, result) {
|
|
|
889
889
|
data: { messageId, toolCallId, result }
|
|
890
890
|
};
|
|
891
891
|
}
|
|
892
|
-
function createChatDoneEvent(messageId, reason, stats) {
|
|
892
|
+
function createChatDoneEvent(messageId, reason, stats, agentType) {
|
|
893
893
|
return {
|
|
894
894
|
type: "chat.done",
|
|
895
895
|
data: {
|
|
896
896
|
messageId,
|
|
897
897
|
reason,
|
|
898
|
-
...stats && { stats }
|
|
898
|
+
...stats && { stats },
|
|
899
|
+
...agentType && { agentType }
|
|
899
900
|
}
|
|
900
901
|
};
|
|
901
902
|
}
|
|
@@ -2975,6 +2976,16 @@ async function deleteProjectSkill(projectDir, skillId) {
|
|
|
2975
2976
|
return deleteItemFromDir(getProjectSkillsDir(projectDir), skillId, SKILL_EXTENSION);
|
|
2976
2977
|
}
|
|
2977
2978
|
|
|
2979
|
+
// src/server/chat/dynamic-context.ts
|
|
2980
|
+
import { createHash as createHash2 } from "crypto";
|
|
2981
|
+
function computeDynamicContextHash(instructionContent, skills) {
|
|
2982
|
+
const dynamicInputs = JSON.stringify({
|
|
2983
|
+
instructions: instructionContent,
|
|
2984
|
+
skills: skills.map((s) => s.id).sort()
|
|
2985
|
+
});
|
|
2986
|
+
return createHash2("sha256").update(dynamicInputs).digest("hex");
|
|
2987
|
+
}
|
|
2988
|
+
|
|
2978
2989
|
// src/server/chat/agent-loop.ts
|
|
2979
2990
|
import stripAnsi from "strip-ansi";
|
|
2980
2991
|
|
|
@@ -3271,7 +3282,8 @@ async function runTopLevelAgentLoop(config, turnMetrics) {
|
|
|
3271
3282
|
const configDir = getGlobalConfigDir(runtimeConfig.mode ?? "production");
|
|
3272
3283
|
const skills = await getEnabledSkillMetadata(configDir, runtimeConfig.workdir);
|
|
3273
3284
|
if (signal?.aborted) throw new Error("Aborted");
|
|
3274
|
-
const
|
|
3285
|
+
const isDynamicMode = getSetting(SETTINGS_KEYS.LLM_DYNAMIC_SYSTEM_PROMPT) === "true";
|
|
3286
|
+
const assembleFreshRequest = () => config.assembleRequest({
|
|
3275
3287
|
workdir: session.workdir,
|
|
3276
3288
|
messages: requestMessages,
|
|
3277
3289
|
injectedFiles,
|
|
@@ -3280,6 +3292,44 @@ async function runTopLevelAgentLoop(config, turnMetrics) {
|
|
|
3280
3292
|
...instructionContent ? { customInstructions: instructionContent } : {},
|
|
3281
3293
|
...skills.length > 0 ? { skills } : {}
|
|
3282
3294
|
});
|
|
3295
|
+
let assembledRequest;
|
|
3296
|
+
if (isDynamicMode) {
|
|
3297
|
+
assembledRequest = assembleFreshRequest();
|
|
3298
|
+
} else {
|
|
3299
|
+
const dynamicHash = computeDynamicContextHash(instructionContent, skills);
|
|
3300
|
+
const execState = session.executionState;
|
|
3301
|
+
const hashMatch = execState?.dynamicContextHash === dynamicHash;
|
|
3302
|
+
const hasCached = !!execState?.cachedSystemPrompt;
|
|
3303
|
+
if (hasCached && hashMatch) {
|
|
3304
|
+
assembledRequest = createAssemblyResult({
|
|
3305
|
+
systemPrompt: execState.cachedSystemPrompt,
|
|
3306
|
+
messages: requestMessages,
|
|
3307
|
+
injectedFiles,
|
|
3308
|
+
requestTools: toolRegistry.definitions,
|
|
3309
|
+
toolChoice: "auto",
|
|
3310
|
+
disableThinking: false
|
|
3311
|
+
});
|
|
3312
|
+
if (sessionManager.getDynamicContextChanged(sessionId)) {
|
|
3313
|
+
sessionManager.setDynamicContextChanged(sessionId, false);
|
|
3314
|
+
}
|
|
3315
|
+
} else if (hasCached) {
|
|
3316
|
+
assembledRequest = createAssemblyResult({
|
|
3317
|
+
systemPrompt: execState.cachedSystemPrompt,
|
|
3318
|
+
messages: requestMessages,
|
|
3319
|
+
injectedFiles,
|
|
3320
|
+
requestTools: toolRegistry.definitions,
|
|
3321
|
+
toolChoice: "auto",
|
|
3322
|
+
disableThinking: false
|
|
3323
|
+
});
|
|
3324
|
+
if (!sessionManager.getDynamicContextChanged(sessionId)) {
|
|
3325
|
+
sessionManager.setDynamicContextChanged(sessionId, true);
|
|
3326
|
+
}
|
|
3327
|
+
} else {
|
|
3328
|
+
assembledRequest = assembleFreshRequest();
|
|
3329
|
+
sessionManager.setCachedPrompt(sessionId, assembledRequest.systemPrompt, dynamicHash);
|
|
3330
|
+
sessionManager.setDynamicContextChanged(sessionId, false);
|
|
3331
|
+
}
|
|
3332
|
+
}
|
|
3283
3333
|
const assistantMsgId = crypto.randomUUID();
|
|
3284
3334
|
eventStore.append(
|
|
3285
3335
|
sessionId,
|
|
@@ -3723,7 +3773,14 @@ async function executeSubAgent(options) {
|
|
|
3723
3773
|
disableThinking: true
|
|
3724
3774
|
});
|
|
3725
3775
|
const result = await consumeStreamGenerator(streamGen, (event) => {
|
|
3726
|
-
|
|
3776
|
+
if (event.type === "message.delta") {
|
|
3777
|
+
eventStore.append(sessionId, {
|
|
3778
|
+
...event,
|
|
3779
|
+
data: { ...event.data, subAgentType }
|
|
3780
|
+
});
|
|
3781
|
+
} else {
|
|
3782
|
+
eventStore.append(sessionId, event);
|
|
3783
|
+
}
|
|
3727
3784
|
});
|
|
3728
3785
|
if (result.aborted) {
|
|
3729
3786
|
const stats = turnMetrics.buildStats(statsIdentity, "verifier");
|
|
@@ -3735,7 +3792,7 @@ async function executeSubAgent(options) {
|
|
|
3735
3792
|
promptContext
|
|
3736
3793
|
})
|
|
3737
3794
|
);
|
|
3738
|
-
eventStore.append(sessionId, createChatDoneEvent(assistantMsgId, "stopped", stats));
|
|
3795
|
+
eventStore.append(sessionId, createChatDoneEvent(assistantMsgId, "stopped", stats, "sub-agent"));
|
|
3739
3796
|
throw new Error("Aborted");
|
|
3740
3797
|
}
|
|
3741
3798
|
turnMetrics.addLLMCall(
|
|
@@ -3805,7 +3862,7 @@ async function executeSubAgent(options) {
|
|
|
3805
3862
|
promptContext
|
|
3806
3863
|
})
|
|
3807
3864
|
);
|
|
3808
|
-
eventStore.append(sessionId, createChatDoneEvent(assistantMsgId, "complete", stats));
|
|
3865
|
+
eventStore.append(sessionId, createChatDoneEvent(assistantMsgId, "complete", stats, "sub-agent"));
|
|
3809
3866
|
break;
|
|
3810
3867
|
}
|
|
3811
3868
|
eventStore.append(
|
|
@@ -3840,7 +3897,7 @@ async function executeSubAgent(options) {
|
|
|
3840
3897
|
if (onMessage) {
|
|
3841
3898
|
onMessage(createChatMessageUpdatedMessage(assistantMsgId, { isStreaming: false, stats, promptContext }));
|
|
3842
3899
|
}
|
|
3843
|
-
eventStore.append(sessionId, createChatDoneEvent(assistantMsgId, "complete", stats));
|
|
3900
|
+
eventStore.append(sessionId, createChatDoneEvent(assistantMsgId, "complete", stats, "sub-agent"));
|
|
3844
3901
|
if (onMessage) {
|
|
3845
3902
|
onMessage(createChatDoneMessage(assistantMsgId, "complete", stats, "sub-agent"));
|
|
3846
3903
|
}
|
|
@@ -3932,7 +3989,7 @@ var callSubAgentTool = {
|
|
|
3932
3989
|
};
|
|
3933
3990
|
}
|
|
3934
3991
|
try {
|
|
3935
|
-
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-
|
|
3992
|
+
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-WFIYKFBE.js");
|
|
3936
3993
|
const toolRegistry = getToolRegistryForAgent2(agentDef);
|
|
3937
3994
|
const turnMetrics = new TurnMetrics();
|
|
3938
3995
|
const result = await executeSubAgent({
|
|
@@ -5092,6 +5149,7 @@ export {
|
|
|
5092
5149
|
agentExists,
|
|
5093
5150
|
saveAgent,
|
|
5094
5151
|
deleteAgent,
|
|
5152
|
+
buildTopLevelSystemPrompt,
|
|
5095
5153
|
buildAgentReminder,
|
|
5096
5154
|
BUILDER_KICKOFF_PROMPT,
|
|
5097
5155
|
VERIFIER_KICKOFF_PROMPT,
|
|
@@ -5102,10 +5160,12 @@ export {
|
|
|
5102
5160
|
createToolResultEvent,
|
|
5103
5161
|
createChatDoneEvent,
|
|
5104
5162
|
assembleAgentRequest,
|
|
5163
|
+
getAllInstructions,
|
|
5105
5164
|
loadDefaultSkills,
|
|
5106
5165
|
loadUserSkills,
|
|
5107
5166
|
loadProjectSkills,
|
|
5108
5167
|
loadAllSkills,
|
|
5168
|
+
getEnabledSkillMetadata,
|
|
5109
5169
|
isSkillEnabled,
|
|
5110
5170
|
getDefaultSkillIds,
|
|
5111
5171
|
isDefaultSkill,
|
|
@@ -5118,6 +5178,7 @@ export {
|
|
|
5118
5178
|
maybeAutoCompactContext,
|
|
5119
5179
|
performManualContextCompaction,
|
|
5120
5180
|
resolveCompactionStatsIdentity,
|
|
5181
|
+
computeDynamicContextHash,
|
|
5121
5182
|
runTopLevelAgentLoop,
|
|
5122
5183
|
executeSubAgent,
|
|
5123
5184
|
devServerManager,
|
|
@@ -5130,4 +5191,4 @@ export {
|
|
|
5130
5191
|
getToolRegistryForAgent,
|
|
5131
5192
|
createToolRegistry
|
|
5132
5193
|
};
|
|
5133
|
-
//# sourceMappingURL=chunk-
|
|
5194
|
+
//# sourceMappingURL=chunk-RYEZ7LDX.js.map
|