openfox 1.6.101 → 1.6.103

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.
Files changed (32) hide show
  1. package/dist/{auto-compaction-JSXVY2CJ.js → auto-compaction-7LMAY5JV.js} +7 -7
  2. package/dist/{chat-handler-45TB6QWI.js → chat-handler-ZJVIM7U4.js} +10 -10
  3. package/dist/{chunk-DCYDTDWO.js → chunk-6WZI6F6G.js} +20 -4
  4. package/dist/{chunk-SBQ36AOQ.js → chunk-IZC2EZ4D.js} +4 -4
  5. package/dist/{chunk-MBLZSLPH.js → chunk-J335KZ6U.js} +4 -3
  6. package/dist/{chunk-SCAFZ75C.js → chunk-LGN6IXGS.js} +180 -37
  7. package/dist/{chunk-UTBDR6KM.js → chunk-MEYDERUX.js} +1 -1
  8. package/dist/{chunk-NASF624P.js → chunk-PDPXHSNZ.js} +7 -5
  9. package/dist/{chunk-L6LTCUCO.js → chunk-PQOK4XCX.js} +2 -2
  10. package/dist/{chunk-TYIHIHJF.js → chunk-PSJIT5LZ.js} +3 -1
  11. package/dist/{chunk-C5U6NRAY.js → chunk-RCQOHFAN.js} +2 -2
  12. package/dist/{chunk-5LYWA56Z.js → chunk-RYEZ7LDX.js} +60 -7
  13. package/dist/cli/dev.js +25 -1
  14. package/dist/cli/index.js +25 -1
  15. package/dist/{events-JP746DV3.js → events-OKTZRT3Y.js} +3 -3
  16. package/dist/{folding-EQPDQKQS.js → folding-Z3OMWNOE.js} +2 -2
  17. package/dist/{orchestrator-RRO2XLYZ.js → orchestrator-5EYWRAZ2.js} +8 -8
  18. package/dist/package.json +3 -1
  19. package/dist/{processor-C4KLV5SV.js → processor-XJYCHNV6.js} +7 -7
  20. package/dist/{protocol-BkFgSJVU.d.ts → protocol-CdVNdXi8.d.ts} +5 -1
  21. package/dist/{protocol-SVQYBN2X.js → protocol-TNC6MCJV.js} +3 -3
  22. package/dist/{serve-5B36ZPK3.js → serve-NWPJO6J7.js} +9 -9
  23. package/dist/server/index.d.ts +10 -1
  24. package/dist/server/index.js +8 -8
  25. package/dist/{settings-4334IX63.js → settings-VRAOAPLA.js} +2 -2
  26. package/dist/shared/index.d.ts +2 -2
  27. package/dist/shared/index.js +1 -1
  28. package/dist/{tools-AGVKG553.js → tools-WFIYKFBE.js} +7 -7
  29. package/dist/web/assets/{index-Du9Uz0qZ.js → index-DcGVOFte.js} +61 -61
  30. package/dist/web/index.html +1 -1
  31. package/dist/web/sw.js +1 -1
  32. package/package.json +3 -1
@@ -13,14 +13,14 @@ import {
13
13
  getToolRegistryForAgent,
14
14
  loadAllAgentsDefault,
15
15
  runTopLevelAgentLoop
16
- } from "./chunk-5LYWA56Z.js";
16
+ } from "./chunk-RYEZ7LDX.js";
17
17
  import {
18
18
  getCurrentContextWindowId,
19
19
  getEventStore
20
- } from "./chunk-MBLZSLPH.js";
20
+ } from "./chunk-J335KZ6U.js";
21
21
  import {
22
22
  buildSnapshotFromSessionState
23
- } from "./chunk-DCYDTDWO.js";
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-NASF624P.js.map
332
+ //# sourceMappingURL=chunk-PDPXHSNZ.js.map
@@ -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-5B36ZPK3.js");
194
+ const { runServe } = await import("./serve-NWPJO6J7.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-L6LTCUCO.js.map
206
+ //# sourceMappingURL=chunk-PQOK4XCX.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-TYIHIHJF.js.map
91
+ //# sourceMappingURL=chunk-PSJIT5LZ.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createServerMessage,
3
3
  isClientMessage
4
- } from "./chunk-UTBDR6KM.js";
4
+ } from "./chunk-MEYDERUX.js";
5
5
 
6
6
  // src/server/ws/protocol.ts
7
7
  function enrichMessagesWithToolResults(messages) {
@@ -326,4 +326,4 @@ export {
326
326
  createQueueStateMessage,
327
327
  storedEventToServerMessage
328
328
  };
329
- //# sourceMappingURL=chunk-C5U6NRAY.js.map
329
+ //# sourceMappingURL=chunk-RCQOHFAN.js.map
@@ -2,7 +2,7 @@ import {
2
2
  SETTINGS_KEYS,
3
3
  deleteSetting,
4
4
  getSetting
5
- } from "./chunk-TYIHIHJF.js";
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-MBLZSLPH.js";
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-DCYDTDWO.js";
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-C5U6NRAY.js";
51
+ } from "./chunk-RCQOHFAN.js";
52
52
  import {
53
53
  AskUserInterrupt,
54
54
  askUserTool
@@ -2976,6 +2976,16 @@ async function deleteProjectSkill(projectDir, skillId) {
2976
2976
  return deleteItemFromDir(getProjectSkillsDir(projectDir), skillId, SKILL_EXTENSION);
2977
2977
  }
2978
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
+
2979
2989
  // src/server/chat/agent-loop.ts
2980
2990
  import stripAnsi from "strip-ansi";
2981
2991
 
@@ -3272,7 +3282,8 @@ async function runTopLevelAgentLoop(config, turnMetrics) {
3272
3282
  const configDir = getGlobalConfigDir(runtimeConfig.mode ?? "production");
3273
3283
  const skills = await getEnabledSkillMetadata(configDir, runtimeConfig.workdir);
3274
3284
  if (signal?.aborted) throw new Error("Aborted");
3275
- const assembledRequest = config.assembleRequest({
3285
+ const isDynamicMode = getSetting(SETTINGS_KEYS.LLM_DYNAMIC_SYSTEM_PROMPT) === "true";
3286
+ const assembleFreshRequest = () => config.assembleRequest({
3276
3287
  workdir: session.workdir,
3277
3288
  messages: requestMessages,
3278
3289
  injectedFiles,
@@ -3281,6 +3292,44 @@ async function runTopLevelAgentLoop(config, turnMetrics) {
3281
3292
  ...instructionContent ? { customInstructions: instructionContent } : {},
3282
3293
  ...skills.length > 0 ? { skills } : {}
3283
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
+ }
3284
3333
  const assistantMsgId = crypto.randomUUID();
3285
3334
  eventStore.append(
3286
3335
  sessionId,
@@ -3940,7 +3989,7 @@ var callSubAgentTool = {
3940
3989
  };
3941
3990
  }
3942
3991
  try {
3943
- const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-AGVKG553.js");
3992
+ const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-WFIYKFBE.js");
3944
3993
  const toolRegistry = getToolRegistryForAgent2(agentDef);
3945
3994
  const turnMetrics = new TurnMetrics();
3946
3995
  const result = await executeSubAgent({
@@ -5100,6 +5149,7 @@ export {
5100
5149
  agentExists,
5101
5150
  saveAgent,
5102
5151
  deleteAgent,
5152
+ buildTopLevelSystemPrompt,
5103
5153
  buildAgentReminder,
5104
5154
  BUILDER_KICKOFF_PROMPT,
5105
5155
  VERIFIER_KICKOFF_PROMPT,
@@ -5110,10 +5160,12 @@ export {
5110
5160
  createToolResultEvent,
5111
5161
  createChatDoneEvent,
5112
5162
  assembleAgentRequest,
5163
+ getAllInstructions,
5113
5164
  loadDefaultSkills,
5114
5165
  loadUserSkills,
5115
5166
  loadProjectSkills,
5116
5167
  loadAllSkills,
5168
+ getEnabledSkillMetadata,
5117
5169
  isSkillEnabled,
5118
5170
  getDefaultSkillIds,
5119
5171
  isDefaultSkill,
@@ -5126,6 +5178,7 @@ export {
5126
5178
  maybeAutoCompactContext,
5127
5179
  performManualContextCompaction,
5128
5180
  resolveCompactionStatsIdentity,
5181
+ computeDynamicContextHash,
5129
5182
  runTopLevelAgentLoop,
5130
5183
  executeSubAgent,
5131
5184
  devServerManager,
@@ -5138,4 +5191,4 @@ export {
5138
5191
  getToolRegistryForAgent,
5139
5192
  createToolRegistry
5140
5193
  };
5141
- //# sourceMappingURL=chunk-5LYWA56Z.js.map
5194
+ //# sourceMappingURL=chunk-RYEZ7LDX.js.map
package/dist/cli/dev.js CHANGED
@@ -1,13 +1,37 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  runCli
4
- } from "../chunk-L6LTCUCO.js";
4
+ } from "../chunk-PQOK4XCX.js";
5
5
  import {
6
6
  logger
7
7
  } from "../chunk-K44MW7JJ.js";
8
8
 
9
9
  // src/cli/dev.ts
10
10
  import { readFileSync } from "fs";
11
+ var MIN_HEAP_MB = 6144;
12
+ var DEFAULT_HEAP_MB = 8192;
13
+ function getCurrentHeapMB() {
14
+ const arg = process.execArgv.find((a) => a.startsWith("--max-old-space-size="));
15
+ if (arg) return Number.parseInt(arg.split("=")[1], 10);
16
+ const m = (process.env["NODE_OPTIONS"] ?? "").match(/--max-old-space-size=(\d+)/);
17
+ return m ? Number.parseInt(m[1], 10) : 0;
18
+ }
19
+ var currentHeap = getCurrentHeapMB();
20
+ if (currentHeap < MIN_HEAP_MB && !process.env["OPENFOX_HEAP_INCREASED"]) {
21
+ const { spawnSync } = await import("child_process");
22
+ const { totalmem } = await import("os");
23
+ const heapMB = Math.min(DEFAULT_HEAP_MB, Math.max(4096, Math.floor(totalmem() / (1024 * 1024) * 0.55)));
24
+ const env = { ...process.env, OPENFOX_HEAP_INCREASED: "1" };
25
+ const cleanNodeOptions = (env["NODE_OPTIONS"] ?? "").replace(/--max-old-space-size=\d+/g, "").trim();
26
+ env["NODE_OPTIONS"] = cleanNodeOptions || void 0;
27
+ const scriptPath = process.argv[1];
28
+ const result = spawnSync(
29
+ process.execPath,
30
+ ["--max-old-space-size=" + heapMB, ...process.execArgv, scriptPath, ...process.argv.slice(2)],
31
+ { stdio: "inherit", env }
32
+ );
33
+ process.exit(result.status ?? 0);
34
+ }
11
35
  var mode = process.env["OPENFOX_MODE"] ?? "development";
12
36
  var pkg = JSON.parse(readFileSync("./package.json", "utf-8"));
13
37
  process.env["VERSION"] = pkg.version + "-dev";
package/dist/cli/index.js CHANGED
@@ -1,12 +1,36 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  runCli
4
- } from "../chunk-L6LTCUCO.js";
4
+ } from "../chunk-PQOK4XCX.js";
5
5
  import {
6
6
  logger
7
7
  } from "../chunk-K44MW7JJ.js";
8
8
 
9
9
  // src/cli/index.ts
10
+ var MIN_HEAP_MB = 6144;
11
+ var DEFAULT_HEAP_MB = 8192;
12
+ function getCurrentHeapMB() {
13
+ const arg = process.execArgv.find((a) => a.startsWith("--max-old-space-size="));
14
+ if (arg) return Number.parseInt(arg.split("=")[1], 10);
15
+ const m = (process.env["NODE_OPTIONS"] ?? "").match(/--max-old-space-size=(\d+)/);
16
+ return m ? Number.parseInt(m[1], 10) : 0;
17
+ }
18
+ var currentHeap = getCurrentHeapMB();
19
+ if (currentHeap < MIN_HEAP_MB && !process.env["OPENFOX_HEAP_INCREASED"]) {
20
+ const { spawnSync } = await import("child_process");
21
+ const { totalmem } = await import("os");
22
+ const heapMB = Math.min(DEFAULT_HEAP_MB, Math.max(4096, Math.floor(totalmem() / (1024 * 1024) * 0.55)));
23
+ const env = { ...process.env, OPENFOX_HEAP_INCREASED: "1" };
24
+ const cleanNodeOptions = (env["NODE_OPTIONS"] ?? "").replace(/--max-old-space-size=\d+/g, "").trim();
25
+ env["NODE_OPTIONS"] = cleanNodeOptions || void 0;
26
+ const scriptPath = process.argv[1];
27
+ const result = spawnSync(
28
+ process.execPath,
29
+ ["--max-old-space-size=" + heapMB, ...process.execArgv, scriptPath, ...process.argv.slice(2)],
30
+ { stdio: "inherit", env }
31
+ );
32
+ process.exit(result.status ?? 0);
33
+ }
10
34
  var mode = process.env["OPENFOX_MODE"] ?? "production";
11
35
  runCli({ mode }).catch((error) => {
12
36
  logger.error("CLI fatal error", { error: error instanceof Error ? error.message : String(error) });
@@ -37,7 +37,7 @@ import {
37
37
  isStoredEvent,
38
38
  isTurnEvent,
39
39
  truncateSessionMessages
40
- } from "./chunk-MBLZSLPH.js";
40
+ } from "./chunk-J335KZ6U.js";
41
41
  import "./chunk-FBGWG4N6.js";
42
42
  import {
43
43
  buildContextMessagesFromEventHistory,
@@ -55,7 +55,7 @@ import {
55
55
  foldTodos,
56
56
  foldTurnEventsToSnapshotMessages,
57
57
  getMessagesForWindow
58
- } from "./chunk-DCYDTDWO.js";
58
+ } from "./chunk-6WZI6F6G.js";
59
59
  import "./chunk-CGZHLM3K.js";
60
60
  import "./chunk-K44MW7JJ.js";
61
61
  export {
@@ -113,4 +113,4 @@ export {
113
113
  isTurnEvent,
114
114
  truncateSessionMessages
115
115
  };
116
- //# sourceMappingURL=events-JP746DV3.js.map
116
+ //# sourceMappingURL=events-OKTZRT3Y.js.map
@@ -22,7 +22,7 @@ import {
22
22
  handleToolResult,
23
23
  spreadOptionalMessageFields,
24
24
  stripOrphanedToolCalls
25
- } from "./chunk-DCYDTDWO.js";
25
+ } from "./chunk-6WZI6F6G.js";
26
26
  export {
27
27
  buildContextMessagesFromEventHistory,
28
28
  buildContextMessagesFromMessages,
@@ -48,4 +48,4 @@ export {
48
48
  spreadOptionalMessageFields,
49
49
  stripOrphanedToolCalls
50
50
  };
51
- //# sourceMappingURL=folding-EQPDQKQS.js.map
51
+ //# sourceMappingURL=folding-Z3OMWNOE.js.map
@@ -3,7 +3,7 @@ import {
3
3
  runBuilderTurn,
4
4
  runChatTurn,
5
5
  runVerifierTurn
6
- } from "./chunk-NASF624P.js";
6
+ } from "./chunk-PDPXHSNZ.js";
7
7
  import {
8
8
  TurnMetrics,
9
9
  createChatDoneEvent,
@@ -11,19 +11,19 @@ import {
11
11
  createMessageStartEvent,
12
12
  createToolCallEvent,
13
13
  createToolResultEvent
14
- } from "./chunk-5LYWA56Z.js";
15
- import "./chunk-TYIHIHJF.js";
14
+ } from "./chunk-RYEZ7LDX.js";
15
+ import "./chunk-PSJIT5LZ.js";
16
16
  import "./chunk-XAMAYRDA.js";
17
17
  import "./chunk-DL6ZILAF.js";
18
18
  import "./chunk-PBGOZMVY.js";
19
19
  import "./chunk-VRGRAQDG.js";
20
20
  import "./chunk-HGAMIPFO.js";
21
- import "./chunk-MBLZSLPH.js";
21
+ import "./chunk-J335KZ6U.js";
22
22
  import "./chunk-FBGWG4N6.js";
23
- import "./chunk-DCYDTDWO.js";
24
- import "./chunk-C5U6NRAY.js";
23
+ import "./chunk-6WZI6F6G.js";
24
+ import "./chunk-RCQOHFAN.js";
25
25
  import "./chunk-BJYPTN5S.js";
26
- import "./chunk-UTBDR6KM.js";
26
+ import "./chunk-MEYDERUX.js";
27
27
  import "./chunk-CQGTEGKL.js";
28
28
  import "./chunk-CGZHLM3K.js";
29
29
  import "./chunk-SZKEGZIB.js";
@@ -40,4 +40,4 @@ export {
40
40
  runChatTurn,
41
41
  runVerifierTurn
42
42
  };
43
- //# sourceMappingURL=orchestrator-RRO2XLYZ.js.map
43
+ //# sourceMappingURL=orchestrator-5EYWRAZ2.js.map
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openfox",
3
- "version": "1.6.101",
3
+ "version": "1.6.103",
4
4
  "description": "Local-LLM-first agentic coding assistant",
5
5
  "type": "module",
6
6
  "bin": {
@@ -116,8 +116,10 @@
116
116
  "concurrently": "^9.2.1",
117
117
  "dotenv": "^17.3.1",
118
118
  "eslint": "^10.1.0",
119
+ "happy-dom": "^20.10.2",
119
120
  "husky": "^9.1.7",
120
121
  "jscpd": "^4.0.9",
122
+ "jsdom": "^29.1.1",
121
123
  "lint-staged": "^16.4.0",
122
124
  "postcss": "^8.5.1",
123
125
  "prettier": "^3.8.1",
@@ -5,17 +5,17 @@ import {
5
5
  generateSessionName,
6
6
  getSessionMessageCount,
7
7
  needsNameGenerationCheck
8
- } from "./chunk-SBQ36AOQ.js";
8
+ } from "./chunk-IZC2EZ4D.js";
9
9
  import {
10
10
  getEventStore
11
- } from "./chunk-MBLZSLPH.js";
11
+ } from "./chunk-J335KZ6U.js";
12
12
  import "./chunk-FBGWG4N6.js";
13
- import "./chunk-DCYDTDWO.js";
13
+ import "./chunk-6WZI6F6G.js";
14
14
  import {
15
15
  createChatMessageMessage,
16
16
  createSessionRunningMessage
17
- } from "./chunk-C5U6NRAY.js";
18
- import "./chunk-UTBDR6KM.js";
17
+ } from "./chunk-RCQOHFAN.js";
18
+ import "./chunk-MEYDERUX.js";
19
19
  import "./chunk-CGZHLM3K.js";
20
20
  import {
21
21
  logger
@@ -177,7 +177,7 @@ var QueueProcessor = class {
177
177
  backend: provider?.backend ?? llmClient.getBackend(),
178
178
  model: llmClient.getModel()
179
179
  };
180
- const { runChatTurn } = await import("./orchestrator-RRO2XLYZ.js");
180
+ const { runChatTurn } = await import("./orchestrator-5EYWRAZ2.js");
181
181
  const runChatTurnParams = buildRunChatTurnParams({
182
182
  sessionManager,
183
183
  sessionId,
@@ -221,4 +221,4 @@ var QueueProcessor = class {
221
221
  export {
222
222
  QueueProcessor
223
223
  };
224
- //# sourceMappingURL=processor-C4KLV5SV.js.map
224
+ //# sourceMappingURL=processor-XJYCHNV6.js.map
@@ -377,6 +377,9 @@ interface ExecutionState {
377
377
  startedAt: string;
378
378
  lastActivityAt: string;
379
379
  lastModeWithReminder?: string;
380
+ cachedSystemPrompt?: string;
381
+ dynamicContextHash?: string;
382
+ dynamicContextChanged?: boolean;
380
383
  }
381
384
  interface ContextState {
382
385
  currentTokens: number;
@@ -384,6 +387,7 @@ interface ContextState {
384
387
  compactionCount: number;
385
388
  dangerZone: boolean;
386
389
  canCompact: boolean;
390
+ dynamicContextChanged: boolean;
387
391
  }
388
392
  interface ValidationResult {
389
393
  allPassed: boolean;
@@ -506,7 +510,7 @@ interface ElementData {
506
510
  attributes: Record<string, string>;
507
511
  }
508
512
 
509
- type ClientMessageType = 'session.load' | 'context.compact' | 'runner.launch' | 'path.confirm' | 'ask.answer';
513
+ type ClientMessageType = 'session.load' | 'context.compact' | 'context.checkDynamic' | 'context.applyDynamic' | 'runner.launch' | 'path.confirm' | 'ask.answer';
510
514
  interface ClientMessage<T = unknown> {
511
515
  id: string;
512
516
  type: ClientMessageType;
@@ -35,8 +35,8 @@ import {
35
35
  parseClientMessage,
36
36
  serializeServerMessage,
37
37
  storedEventToServerMessage
38
- } from "./chunk-C5U6NRAY.js";
39
- import "./chunk-UTBDR6KM.js";
38
+ } from "./chunk-RCQOHFAN.js";
39
+ import "./chunk-MEYDERUX.js";
40
40
  export {
41
41
  createChatAskUserMessage,
42
42
  createChatDeltaMessage,
@@ -75,4 +75,4 @@ export {
75
75
  serializeServerMessage,
76
76
  storedEventToServerMessage
77
77
  };
78
- //# sourceMappingURL=protocol-SVQYBN2X.js.map
78
+ //# sourceMappingURL=protocol-TNC6MCJV.js.map
@@ -6,10 +6,10 @@ import {
6
6
  import {
7
7
  VERSION,
8
8
  createServer
9
- } from "./chunk-SCAFZ75C.js";
10
- import "./chunk-NASF624P.js";
11
- import "./chunk-5LYWA56Z.js";
12
- import "./chunk-TYIHIHJF.js";
9
+ } from "./chunk-LGN6IXGS.js";
10
+ import "./chunk-PDPXHSNZ.js";
11
+ import "./chunk-RYEZ7LDX.js";
12
+ import "./chunk-PSJIT5LZ.js";
13
13
  import "./chunk-XAMAYRDA.js";
14
14
  import "./chunk-DL6ZILAF.js";
15
15
  import "./chunk-PBGOZMVY.js";
@@ -17,13 +17,13 @@ import "./chunk-VRGRAQDG.js";
17
17
  import "./chunk-RF2JGDSS.js";
18
18
  import "./chunk-HHAJ3QF6.js";
19
19
  import "./chunk-HGAMIPFO.js";
20
- import "./chunk-MBLZSLPH.js";
20
+ import "./chunk-J335KZ6U.js";
21
21
  import "./chunk-FBGWG4N6.js";
22
- import "./chunk-DCYDTDWO.js";
23
- import "./chunk-C5U6NRAY.js";
22
+ import "./chunk-6WZI6F6G.js";
23
+ import "./chunk-RCQOHFAN.js";
24
24
  import "./chunk-BJYPTN5S.js";
25
25
  import "./chunk-VUQCQXXJ.js";
26
- import "./chunk-UTBDR6KM.js";
26
+ import "./chunk-MEYDERUX.js";
27
27
  import {
28
28
  ensureDataDirExists,
29
29
  getDatabasePath,
@@ -190,4 +190,4 @@ async function runServe(options) {
190
190
  export {
191
191
  runServe
192
192
  };
193
- //# sourceMappingURL=serve-5B36ZPK3.js.map
193
+ //# sourceMappingURL=serve-NWPJO6J7.js.map
@@ -1,4 +1,4 @@
1
- import { aP as ToolCall, c as Attachment, R as Diagnostic, ao as Provider, a9 as ModelConfig, aB as Session, aK as SessionSummary, ag as Project, aF as SessionMode, aH as SessionPhase, M as Message, J as Criterion, L as CriterionStatus, ax as QueuedMessage, F as ContextState, O as DangerLevel$1, az as ServerMessage, aM as StatsIdentity, aS as ToolResult, D as Config } from '../protocol-BkFgSJVU.js';
1
+ import { aP as ToolCall, c as Attachment, R as Diagnostic, ao as Provider, a9 as ModelConfig, aB as Session, aK as SessionSummary, ag as Project, aF as SessionMode, aH as SessionPhase, M as Message, J as Criterion, L as CriterionStatus, ax as QueuedMessage, F as ContextState, O as DangerLevel$1, az as ServerMessage, aM as StatsIdentity, aS as ToolResult, D as Config } from '../protocol-CdVNdXi8.js';
2
2
  import { Server } from 'node:http';
3
3
 
4
4
  interface LLMMessage {
@@ -288,6 +288,8 @@ declare class SessionManager {
288
288
  private events;
289
289
  private activeSessionId;
290
290
  private providerManager;
291
+ private cachedPromptStore;
292
+ private dynamicContextChangedStore;
291
293
  constructor(providerManager: ProviderManager);
292
294
  getCurrentModelSettings(): {
293
295
  temperature?: number;
@@ -470,6 +472,13 @@ declare class SessionManager {
470
472
  * Update execution state.
471
473
  */
472
474
  updateExecutionState(sessionId: string, updates: Record<string, unknown>): void;
475
+ setCachedPrompt(sessionId: string, systemPrompt: string, hash: string): void;
476
+ getCachedPrompt(sessionId: string): {
477
+ systemPrompt: string;
478
+ hash: string;
479
+ } | undefined;
480
+ setDynamicContextChanged(sessionId: string, changed: boolean): void;
481
+ getDynamicContextChanged(sessionId: string): boolean;
473
482
  /**
474
483
  * @deprecated Use addMessage + compactContext instead
475
484
  */
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  createServer,
3
3
  createServerHandle
4
- } from "../chunk-SCAFZ75C.js";
5
- import "../chunk-NASF624P.js";
6
- import "../chunk-5LYWA56Z.js";
7
- import "../chunk-TYIHIHJF.js";
4
+ } from "../chunk-LGN6IXGS.js";
5
+ import "../chunk-PDPXHSNZ.js";
6
+ import "../chunk-RYEZ7LDX.js";
7
+ import "../chunk-PSJIT5LZ.js";
8
8
  import "../chunk-XAMAYRDA.js";
9
9
  import "../chunk-DL6ZILAF.js";
10
10
  import "../chunk-PBGOZMVY.js";
@@ -12,13 +12,13 @@ import "../chunk-VRGRAQDG.js";
12
12
  import "../chunk-RF2JGDSS.js";
13
13
  import "../chunk-HHAJ3QF6.js";
14
14
  import "../chunk-HGAMIPFO.js";
15
- import "../chunk-MBLZSLPH.js";
15
+ import "../chunk-J335KZ6U.js";
16
16
  import "../chunk-FBGWG4N6.js";
17
- import "../chunk-DCYDTDWO.js";
18
- import "../chunk-C5U6NRAY.js";
17
+ import "../chunk-6WZI6F6G.js";
18
+ import "../chunk-RCQOHFAN.js";
19
19
  import "../chunk-BJYPTN5S.js";
20
20
  import "../chunk-VUQCQXXJ.js";
21
- import "../chunk-UTBDR6KM.js";
21
+ import "../chunk-MEYDERUX.js";
22
22
  import "../chunk-CQGTEGKL.js";
23
23
  import "../chunk-CGZHLM3K.js";
24
24
  import "../chunk-SZKEGZIB.js";
@@ -5,7 +5,7 @@ import {
5
5
  getAllSettings,
6
6
  getSetting,
7
7
  setSetting
8
- } from "./chunk-TYIHIHJF.js";
8
+ } from "./chunk-PSJIT5LZ.js";
9
9
  import "./chunk-FBGWG4N6.js";
10
10
  import "./chunk-K44MW7JJ.js";
11
11
  export {
@@ -16,4 +16,4 @@ export {
16
16
  getSetting,
17
17
  setSetting
18
18
  };
19
- //# sourceMappingURL=settings-4334IX63.js.map
19
+ //# sourceMappingURL=settings-VRAOAPLA.js.map
@@ -1,5 +1,5 @@
1
- import { M as Message, S as SessionStats } from '../protocol-BkFgSJVU.js';
2
- export { A as AgentEvent, a as AskAnswerPayload, b as AskUserEvent, c as Attachment, B as BackgroundProcess, d as BackgroundProcessExitedPayload, e as BackgroundProcessOutputPayload, f as BackgroundProcessRemovedPayload, g as BackgroundProcessStartedPayload, h as BackgroundProcessStatus, C as CallStatsDataPoint, i as ChatAskUserPayload, j as ChatDeltaPayload, k as ChatDonePayload, l as ChatErrorPayload, m as ChatFormatRetryPayload, n as ChatMessagePayload, o as ChatMessageUpdatedPayload, p as ChatPathConfirmationPayload, q as ChatProgressPayload, r as ChatThinkingPayload, s as ChatTodoPayload, t as ChatToolCallPayload, u as ChatToolOutputPayload, v as ChatToolPreparingPayload, w as ChatToolResultPayload, x as ChatVisionFallbackPayload, y as ClientMessage, z as ClientMessageType, D as Config, E as ContextCompactionEvent, F as ContextState, G as ContextStatePayload, H as ContextWindow, I as CriteriaUpdatedPayload, J as Criterion, K as CriterionAttempt, L as CriterionStatus, N as CriterionValidation, O as DangerLevel, P as DevServerOutputPayload, Q as DevServerStatePayload, R as Diagnostic, T as EditContextEdit, U as EditContextLine, V as EditContextRegion, W as ElementData, X as ErrorPayload, Y as ExecutionState, Z as FileReadEntry, _ as GitDiffFile, $ as GitStatusPayload, a0 as InjectedFile, a1 as LLMCallStats, a2 as LlmBackend, a3 as LogLine, a4 as LspDiagnosticsPayload, a5 as MessageRole, a6 as MessageSegment, a7 as MessageStats, a8 as ModeChangedPayload, a9 as ModelConfig, aa as ModelSessionStats, ab as PathConfirmPayload, ac as PathConfirmationReason, ad as PendingPathConfirmationPayload, ae as PhaseChangedPayload, af as PreparingToolCall, ag as Project, ah as ProjectDeletedPayload, ai as ProjectListPayload, aj as ProjectStatePayload, ak as PromptContext, al as PromptContextMessage, am as PromptContextTool, an as PromptRequestOptions, ao as Provider, ap as ProviderBackend, aq as ProviderChangedPayload, ar as QueueAddedEvent, as as QueueCancelledEvent, at as QueueDrainedEvent, au as QueueEvent, av as QueueEventType, aw as QueueStatePayload, ax as QueuedMessage, ay as RecentUserPrompt, az as ServerMessage, aA as ServerMessageType, aB as Session, aC as SessionListPayload, aD as SessionLoadPayload, aE as SessionMetadata, aF as SessionMode, aG as SessionNameGeneratedPayload, aH as SessionPhase, aI as SessionRunningPayload, aJ as SessionStatePayload, aK as SessionSummary, aL as StatsDataPoint, aM as StatsIdentity, aN as TaskCompletedPayload, aO as Todo, aP as ToolCall, aQ as ToolMode, aR as ToolName, aS as ToolResult, aT as ValidationResult, aU as createClientMessage, aV as createServerMessage, aW as isClientMessage, aX as isServerMessage } from '../protocol-BkFgSJVU.js';
1
+ import { M as Message, S as SessionStats } from '../protocol-CdVNdXi8.js';
2
+ export { A as AgentEvent, a as AskAnswerPayload, b as AskUserEvent, c as Attachment, B as BackgroundProcess, d as BackgroundProcessExitedPayload, e as BackgroundProcessOutputPayload, f as BackgroundProcessRemovedPayload, g as BackgroundProcessStartedPayload, h as BackgroundProcessStatus, C as CallStatsDataPoint, i as ChatAskUserPayload, j as ChatDeltaPayload, k as ChatDonePayload, l as ChatErrorPayload, m as ChatFormatRetryPayload, n as ChatMessagePayload, o as ChatMessageUpdatedPayload, p as ChatPathConfirmationPayload, q as ChatProgressPayload, r as ChatThinkingPayload, s as ChatTodoPayload, t as ChatToolCallPayload, u as ChatToolOutputPayload, v as ChatToolPreparingPayload, w as ChatToolResultPayload, x as ChatVisionFallbackPayload, y as ClientMessage, z as ClientMessageType, D as Config, E as ContextCompactionEvent, F as ContextState, G as ContextStatePayload, H as ContextWindow, I as CriteriaUpdatedPayload, J as Criterion, K as CriterionAttempt, L as CriterionStatus, N as CriterionValidation, O as DangerLevel, P as DevServerOutputPayload, Q as DevServerStatePayload, R as Diagnostic, T as EditContextEdit, U as EditContextLine, V as EditContextRegion, W as ElementData, X as ErrorPayload, Y as ExecutionState, Z as FileReadEntry, _ as GitDiffFile, $ as GitStatusPayload, a0 as InjectedFile, a1 as LLMCallStats, a2 as LlmBackend, a3 as LogLine, a4 as LspDiagnosticsPayload, a5 as MessageRole, a6 as MessageSegment, a7 as MessageStats, a8 as ModeChangedPayload, a9 as ModelConfig, aa as ModelSessionStats, ab as PathConfirmPayload, ac as PathConfirmationReason, ad as PendingPathConfirmationPayload, ae as PhaseChangedPayload, af as PreparingToolCall, ag as Project, ah as ProjectDeletedPayload, ai as ProjectListPayload, aj as ProjectStatePayload, ak as PromptContext, al as PromptContextMessage, am as PromptContextTool, an as PromptRequestOptions, ao as Provider, ap as ProviderBackend, aq as ProviderChangedPayload, ar as QueueAddedEvent, as as QueueCancelledEvent, at as QueueDrainedEvent, au as QueueEvent, av as QueueEventType, aw as QueueStatePayload, ax as QueuedMessage, ay as RecentUserPrompt, az as ServerMessage, aA as ServerMessageType, aB as Session, aC as SessionListPayload, aD as SessionLoadPayload, aE as SessionMetadata, aF as SessionMode, aG as SessionNameGeneratedPayload, aH as SessionPhase, aI as SessionRunningPayload, aJ as SessionStatePayload, aK as SessionSummary, aL as StatsDataPoint, aM as StatsIdentity, aN as TaskCompletedPayload, aO as Todo, aP as ToolCall, aQ as ToolMode, aR as ToolName, aS as ToolResult, aT as ValidationResult, aU as createClientMessage, aV as createServerMessage, aW as isClientMessage, aX as isServerMessage } from '../protocol-CdVNdXi8.js';
3
3
 
4
4
  /**
5
5
  * Session stats computation - aggregates response-level MessageStats from
@@ -6,7 +6,7 @@ import {
6
6
  createServerMessage,
7
7
  isClientMessage,
8
8
  isServerMessage
9
- } from "../chunk-UTBDR6KM.js";
9
+ } from "../chunk-MEYDERUX.js";
10
10
  export {
11
11
  computeSessionStats,
12
12
  createClientMessage,