openfox 1.6.82 → 1.6.83

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 (39) hide show
  1. package/dist/{auto-compaction-I3GTBPTZ.js → auto-compaction-YKNSXB3B.js} +8 -8
  2. package/dist/{chat-handler-IOHM7XMZ.js → chat-handler-XORXAICJ.js} +11 -11
  3. package/dist/{chunk-MDL6USSE.js → chunk-3Y3HDOT3.js} +38 -35
  4. package/dist/{chunk-NDJ6FKSP.js → chunk-4VT74LCD.js} +1 -1
  5. package/dist/{chunk-HJOH367L.js → chunk-6GGYIEBM.js} +3 -3
  6. package/dist/{chunk-D67V55WE.js → chunk-6GH2PJJC.js} +4 -4
  7. package/dist/{chunk-WNYDTFJO.js → chunk-6THJULLK.js} +2 -2
  8. package/dist/{chunk-Y2LKLZ2V.js → chunk-AET6LELP.js} +6 -6
  9. package/dist/{chunk-ZPQDYRQI.js → chunk-GN7RB4Y4.js} +2 -2
  10. package/dist/{chunk-NRJOTXHG.js → chunk-JDDNBK6T.js} +5 -5
  11. package/dist/{chunk-XI7JEBNT.js → chunk-NAONQLLT.js} +66 -15
  12. package/dist/{chunk-DVNZAJT5.js → chunk-TLOL4I7K.js} +3 -3
  13. package/dist/{chunk-C3O6MZJV.js → chunk-WSRF5L3S.js} +2 -2
  14. package/dist/{chunk-TS5XFQ2D.js → chunk-XVWVAWSG.js} +1 -1
  15. package/dist/{chunk-Y325P6Z4.js → chunk-YNIAFX24.js} +5 -5
  16. package/dist/{chunk-WHPOBTTU.js → chunk-ZSTL3GO6.js} +4 -4
  17. package/dist/cli/dev.js +1 -1
  18. package/dist/cli/index.js +1 -1
  19. package/dist/{config-RIK5T6WK.js → config-HMMPXQ46.js} +5 -5
  20. package/dist/{events-I7NDHSNU.js → events-H563T5M5.js} +3 -3
  21. package/dist/{folding-XIKR6AFM.js → folding-4VHGQE6Y.js} +2 -2
  22. package/dist/{orchestrator-YFHSFYII.js → orchestrator-4YKFENVV.js} +9 -9
  23. package/dist/package.json +1 -1
  24. package/dist/{processor-EM4BINEJ.js → processor-I2NXOFPC.js} +7 -7
  25. package/dist/{protocol-OnZRAPeM.d.ts → protocol-DEXfLRbe.d.ts} +2 -1
  26. package/dist/{protocol-VVUFP4I7.js → protocol-NEBXAMJ3.js} +3 -3
  27. package/dist/{provider-AASLIQZJ.js → provider-LDZFYLK6.js} +7 -7
  28. package/dist/{serve-OJPBEKVE.js → serve-IED7B4A5.js} +13 -13
  29. package/dist/server/index.d.ts +2 -1
  30. package/dist/server/index.js +11 -11
  31. package/dist/shared/index.d.ts +2 -2
  32. package/dist/shared/index.js +1 -1
  33. package/dist/{tools-PPLFGZCK.js → tools-RGERQUMC.js} +8 -8
  34. package/dist/{vision-fallback-GMDXLVRN.js → vision-fallback-WT66NURB.js} +2 -2
  35. package/dist/web/assets/{index-D4Si0Pmc.css → index-CA0bz_5H.css} +1 -1
  36. package/dist/web/assets/{index-CkbORFn4.js → index-DmpkTC-2.js} +45 -45
  37. package/dist/web/index.html +2 -2
  38. package/dist/web/sw.js +1 -1
  39. package/package.json +1 -1
@@ -28,11 +28,11 @@ import {
28
28
  getBackendCapabilities,
29
29
  getModelProfile,
30
30
  streamWithSegments
31
- } from "./chunk-Y325P6Z4.js";
31
+ } from "./chunk-YNIAFX24.js";
32
32
  import {
33
33
  getCurrentContextWindowId,
34
34
  getEventStore
35
- } from "./chunk-WNYDTFJO.js";
35
+ } from "./chunk-6THJULLK.js";
36
36
  import {
37
37
  buildContextMessagesFromEventHistory,
38
38
  foldContextState,
@@ -41,7 +41,7 @@ import {
41
41
  handleToolCall,
42
42
  handleToolResult,
43
43
  stripOrphanedToolCalls
44
- } from "./chunk-TS5XFQ2D.js";
44
+ } from "./chunk-XVWVAWSG.js";
45
45
  import {
46
46
  createChatDoneMessage,
47
47
  createChatMessageMessage,
@@ -49,7 +49,7 @@ import {
49
49
  createChatPathConfirmationMessage,
50
50
  createChatVisionFallbackMessage,
51
51
  createQueueStateMessage
52
- } from "./chunk-ZPQDYRQI.js";
52
+ } from "./chunk-GN7RB4Y4.js";
53
53
  import {
54
54
  AskUserInterrupt,
55
55
  askUserTool
@@ -569,7 +569,8 @@ function createEmptyStreamResult(aborted, xmlFormatError, modelParams) {
569
569
  timing: { ttft: 0, completionTime: 0, tps: 0, prefillTps: 0 },
570
570
  aborted,
571
571
  xmlFormatError,
572
- modelParams
572
+ modelParams,
573
+ finishReason: "stop"
573
574
  };
574
575
  }
575
576
  async function* streamLLMPure(options) {
@@ -754,7 +755,8 @@ async function* streamLLMPure(options) {
754
755
  timing: result.timing,
755
756
  aborted,
756
757
  xmlFormatError,
757
- modelParams
758
+ modelParams,
759
+ finishReason: result.response.finishReason
758
760
  };
759
761
  if (result.thinkingContent) {
760
762
  baseResult.thinkingContent = result.thinkingContent;
@@ -2996,13 +2998,12 @@ async function executeToolBatch(assistantMsgId, toolCalls, ctx) {
2996
2998
  truncated: false
2997
2999
  };
2998
3000
  ctx.turnMetrics.addToolTime(toolResult2.durationMs);
2999
- const event = createToolResultEvent(assistantMsgId, toolCall.id, toolResult2);
3001
+ eventStore.append(ctx.sessionId, createToolResultEvent(assistantMsgId, toolCall.id, toolResult2));
3000
3002
  return {
3001
3003
  toolCall,
3002
3004
  toolResult: toolResult2,
3003
3005
  content: `Error: ${toolResult2.error}`,
3004
- index,
3005
- event
3006
+ index
3006
3007
  };
3007
3008
  }
3008
3009
  const onProgress = ctx.onMessage ? createToolProgressHandler(eventStore, assistantMsgId, toolCall.id, ctx.sessionId) : void 0;
@@ -3039,19 +3040,18 @@ async function executeToolBatch(assistantMsgId, toolCalls, ctx) {
3039
3040
 
3040
3041
  Error: ${toolResult.error}` : `Error: ${toolResult.error}`
3041
3042
  );
3043
+ eventStore.append(ctx.sessionId, createToolResultEvent(assistantMsgId, toolCall.id, toolResult));
3042
3044
  return {
3043
3045
  toolCall,
3044
3046
  toolResult,
3045
3047
  content,
3046
- index,
3047
- event: createToolResultEvent(assistantMsgId, toolCall.id, toolResult)
3048
+ index
3048
3049
  };
3049
3050
  };
3050
3051
  const executionPromises = toolCalls.map((toolCall, index) => executeTool(toolCall, index));
3051
3052
  const results = await Promise.all(executionPromises);
3052
3053
  results.sort((a, b) => a.index - b.index);
3053
3054
  for (const result of results) {
3054
- eventStore.append(ctx.sessionId, result.event);
3055
3055
  toolMessages.push({
3056
3056
  role: "tool",
3057
3057
  content: result.content,
@@ -3067,13 +3067,16 @@ Error: ${toolResult.error}` : `Error: ${toolResult.error}`
3067
3067
  return { toolMessages, criteriaChanged, returnValueContent, returnValueResult };
3068
3068
  }
3069
3069
  var MAX_FORMAT_RETRIES = 10;
3070
+ var MAX_TRUNCATION_RETRIES = 3;
3070
3071
  var FORMAT_CORRECTION_PROMPT2 = `IMPORTANT: You MUST use the JSON function calling API. Do NOT output XML tags like <function=>, <parameter=>, or <invoke=>. Your previous attempt was stopped because you used the wrong format. Use the proper tool_calls format.`;
3071
3072
  async function runTopLevelAgentLoop(config, turnMetrics) {
3072
3073
  const { mode, sessionManager, sessionId, llmClient, signal, onMessage, statsIdentity } = config;
3073
3074
  const eventStore = getEventStore();
3074
3075
  let formatRetryCount = 0;
3076
+ let truncationRetryCount = 0;
3075
3077
  let returnValueContent;
3076
3078
  let returnValueResult;
3079
+ let currentMaxTokensOverride;
3077
3080
  for (; ; ) {
3078
3081
  await maybeAutoCompactContext({
3079
3082
  sessionManager,
@@ -3161,7 +3164,7 @@ async function runTopLevelAgentLoop(config, turnMetrics) {
3161
3164
  createChatVisionFallbackMessage({ type: "done", messageId: assistantMsgId, attachmentId, description })
3162
3165
  );
3163
3166
  };
3164
- const modelSettings = sessionManager.getCurrentModelSettings();
3167
+ const modelSettings = currentMaxTokensOverride !== void 0 ? { ...sessionManager.getCurrentModelSettings(), maxTokens: currentMaxTokensOverride } : sessionManager.getCurrentModelSettings();
3165
3168
  const streamGen = streamLLMPure({
3166
3169
  messageId: assistantMsgId,
3167
3170
  systemPrompt: assembledRequest.systemPrompt,
@@ -3204,6 +3207,54 @@ async function runTopLevelAgentLoop(config, turnMetrics) {
3204
3207
  }
3205
3208
  turnMetrics.addLLMCall(result.timing, result.usage.promptTokens, result.usage.completionTokens, result.modelParams);
3206
3209
  sessionManager.setCurrentContextSize(sessionId, result.usage.promptTokens);
3210
+ if (result.finishReason === "length" && result.toolCalls.length === 0) {
3211
+ if (truncationRetryCount < MAX_TRUNCATION_RETRIES) {
3212
+ truncationRetryCount += 1;
3213
+ const currentMaxTokens = result.modelParams?.maxTokens ?? 16384;
3214
+ const promptTokens = result.usage.promptTokens;
3215
+ const contextWindow = sessionManager.getCurrentModelContext();
3216
+ const newMaxTokens = Math.min(Math.floor(currentMaxTokens * 1.5), contextWindow - promptTokens - 2048);
3217
+ currentMaxTokensOverride = newMaxTokens;
3218
+ const interimStats = turnMetrics.buildStats(statsIdentity, mode);
3219
+ eventStore.append(
3220
+ sessionId,
3221
+ createMessageDoneEvent(assistantMsgId, {
3222
+ segments: result.segments,
3223
+ stats: interimStats,
3224
+ promptContext: assembledRequest.promptContext
3225
+ })
3226
+ );
3227
+ onMessage?.(createChatMessageUpdatedMessage(assistantMsgId, { isStreaming: false }));
3228
+ const continueMsgId = crypto.randomUUID();
3229
+ eventStore.append(
3230
+ sessionId,
3231
+ createMessageStartEvent(
3232
+ continueMsgId,
3233
+ "user",
3234
+ "Continue your previous response exactly where you left off.",
3235
+ {
3236
+ ...currentWindowMessageOptions ?? {},
3237
+ isSystemGenerated: true
3238
+ }
3239
+ )
3240
+ );
3241
+ eventStore.append(sessionId, { type: "message.done", data: { messageId: continueMsgId } });
3242
+ continue;
3243
+ } else {
3244
+ const stats2 = turnMetrics.buildStats(statsIdentity, mode);
3245
+ eventStore.append(
3246
+ sessionId,
3247
+ createMessageDoneEvent(assistantMsgId, {
3248
+ segments: result.segments,
3249
+ stats: stats2,
3250
+ partial: true,
3251
+ promptContext: assembledRequest.promptContext
3252
+ })
3253
+ );
3254
+ eventStore.append(sessionId, createChatDoneEvent(assistantMsgId, "truncated", stats2));
3255
+ break;
3256
+ }
3257
+ }
3207
3258
  if (result.toolCalls.length > 0) {
3208
3259
  eventStore.append(
3209
3260
  sessionId,
@@ -3707,7 +3758,7 @@ var callSubAgentTool = {
3707
3758
  };
3708
3759
  }
3709
3760
  try {
3710
- const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-PPLFGZCK.js");
3761
+ const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-RGERQUMC.js");
3711
3762
  const toolRegistry = getToolRegistryForAgent2(agentDef);
3712
3763
  const turnMetrics = new TurnMetrics();
3713
3764
  const result = await executeSubAgent({
@@ -4896,4 +4947,4 @@ export {
4896
4947
  getToolRegistryForAgent,
4897
4948
  createToolRegistry
4898
4949
  };
4899
- //# sourceMappingURL=chunk-XI7JEBNT.js.map
4950
+ //# sourceMappingURL=chunk-NAONQLLT.js.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  detectModel
3
- } from "./chunk-NRJOTXHG.js";
3
+ } from "./chunk-JDDNBK6T.js";
4
4
  import {
5
5
  detectBackend
6
- } from "./chunk-Y325P6Z4.js";
6
+ } from "./chunk-YNIAFX24.js";
7
7
  import {
8
8
  getGlobalConfigPath
9
9
  } from "./chunk-CQGTEGKL.js";
@@ -435,4 +435,4 @@ export {
435
435
  activateProvider,
436
436
  mergeConfigs
437
437
  };
438
- //# sourceMappingURL=chunk-DVNZAJT5.js.map
438
+ //# sourceMappingURL=chunk-TLOL4I7K.js.map
@@ -29,7 +29,7 @@ function isVisionFallbackEnabled() {
29
29
  async function ensureVisionFallbackConfigLoaded() {
30
30
  if (configLoaded) return;
31
31
  try {
32
- const { loadGlobalConfig, getVisionFallback } = await import("./config-RIK5T6WK.js");
32
+ const { loadGlobalConfig, getVisionFallback } = await import("./config-HMMPXQ46.js");
33
33
  const { getRuntimeConfig } = await import("./runtime-config-CBJJJGBD.js");
34
34
  const runtimeConfig = getRuntimeConfig();
35
35
  const mode = runtimeConfig.mode ?? "production";
@@ -137,4 +137,4 @@ export {
137
137
  describeImage,
138
138
  describeImageFromDataUrl
139
139
  };
140
- //# sourceMappingURL=chunk-C3O6MZJV.js.map
140
+ //# sourceMappingURL=chunk-WSRF5L3S.js.map
@@ -880,4 +880,4 @@ export {
880
880
  getMessagesForWindow,
881
881
  buildContextMessagesFromMessages
882
882
  };
883
- //# sourceMappingURL=chunk-TS5XFQ2D.js.map
883
+ //# sourceMappingURL=chunk-XVWVAWSG.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  describeImageFromDataUrl
3
- } from "./chunk-C3O6MZJV.js";
3
+ } from "./chunk-WSRF5L3S.js";
4
4
  import {
5
5
  logger
6
6
  } from "./chunk-K44MW7JJ.js";
@@ -595,9 +595,9 @@ async function buildChatCompletionCreateParams(model, request, profile, capabili
595
595
  onVisionFallbackStart,
596
596
  onVisionFallbackDone
597
597
  );
598
- const temperature = request.temperature ?? profile.temperature;
599
- const maxTokens = request.maxTokens ?? profile.defaultMaxTokens;
600
- const topP = profile.topP;
598
+ const temperature = request.modelSettings?.temperature ?? request.temperature ?? profile.temperature;
599
+ const maxTokens = request.modelSettings?.maxTokens ?? request.maxTokens ?? profile.defaultMaxTokens;
600
+ const topP = request.modelSettings?.topP ?? profile.topP;
601
601
  const topK = capabilities.supportsTopK ? profile.topK : void 0;
602
602
  const params = {
603
603
  model,
@@ -801,4 +801,4 @@ export {
801
801
  extractThinking,
802
802
  streamWithSegments
803
803
  };
804
- //# sourceMappingURL=chunk-Y325P6Z4.js.map
804
+ //# sourceMappingURL=chunk-YNIAFX24.js.map
@@ -13,14 +13,14 @@ import {
13
13
  getToolRegistryForAgent,
14
14
  loadAllAgentsDefault,
15
15
  runTopLevelAgentLoop
16
- } from "./chunk-XI7JEBNT.js";
16
+ } from "./chunk-NAONQLLT.js";
17
17
  import {
18
18
  getCurrentContextWindowId,
19
19
  getEventStore
20
- } from "./chunk-WNYDTFJO.js";
20
+ } from "./chunk-6THJULLK.js";
21
21
  import {
22
22
  buildSnapshotFromSessionState
23
- } from "./chunk-TS5XFQ2D.js";
23
+ } from "./chunk-XVWVAWSG.js";
24
24
  import {
25
25
  logger
26
26
  } from "./chunk-K44MW7JJ.js";
@@ -327,4 +327,4 @@ export {
327
327
  runBuilderTurn,
328
328
  runVerifierTurn
329
329
  };
330
- //# sourceMappingURL=chunk-WHPOBTTU.js.map
330
+ //# sourceMappingURL=chunk-ZSTL3GO6.js.map
package/dist/cli/dev.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  runCli
4
- } from "../chunk-Y2LKLZ2V.js";
4
+ } from "../chunk-AET6LELP.js";
5
5
  import {
6
6
  logger
7
7
  } from "../chunk-K44MW7JJ.js";
package/dist/cli/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  runCli
4
- } from "../chunk-Y2LKLZ2V.js";
4
+ } from "../chunk-AET6LELP.js";
5
5
  import {
6
6
  logger
7
7
  } from "../chunk-K44MW7JJ.js";
@@ -13,11 +13,11 @@ import {
13
13
  saveGlobalConfig,
14
14
  setDefaultModelSelection,
15
15
  trySmartDefaults
16
- } from "./chunk-DVNZAJT5.js";
17
- import "./chunk-NRJOTXHG.js";
18
- import "./chunk-Y325P6Z4.js";
16
+ } from "./chunk-TLOL4I7K.js";
17
+ import "./chunk-JDDNBK6T.js";
18
+ import "./chunk-YNIAFX24.js";
19
19
  import "./chunk-CQGTEGKL.js";
20
- import "./chunk-C3O6MZJV.js";
20
+ import "./chunk-WSRF5L3S.js";
21
21
  import "./chunk-K44MW7JJ.js";
22
22
  export {
23
23
  activateProvider,
@@ -35,4 +35,4 @@ export {
35
35
  setDefaultModelSelection,
36
36
  trySmartDefaults
37
37
  };
38
- //# sourceMappingURL=config-RIK5T6WK.js.map
38
+ //# sourceMappingURL=config-HMMPXQ46.js.map
@@ -37,7 +37,7 @@ import {
37
37
  isStoredEvent,
38
38
  isTurnEvent,
39
39
  truncateSessionMessages
40
- } from "./chunk-WNYDTFJO.js";
40
+ } from "./chunk-6THJULLK.js";
41
41
  import "./chunk-KIOUKC3Z.js";
42
42
  import {
43
43
  buildContextMessagesFromEventHistory,
@@ -55,7 +55,7 @@ import {
55
55
  foldTodos,
56
56
  foldTurnEventsToSnapshotMessages,
57
57
  getMessagesForWindow
58
- } from "./chunk-TS5XFQ2D.js";
58
+ } from "./chunk-XVWVAWSG.js";
59
59
  import "./chunk-B5AP3RSV.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-I7NDHSNU.js.map
116
+ //# sourceMappingURL=events-H563T5M5.js.map
@@ -22,7 +22,7 @@ import {
22
22
  handleToolResult,
23
23
  spreadOptionalMessageFields,
24
24
  stripOrphanedToolCalls
25
- } from "./chunk-TS5XFQ2D.js";
25
+ } from "./chunk-XVWVAWSG.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-XIKR6AFM.js.map
51
+ //# sourceMappingURL=folding-4VHGQE6Y.js.map
@@ -3,7 +3,7 @@ import {
3
3
  runBuilderTurn,
4
4
  runChatTurn,
5
5
  runVerifierTurn
6
- } from "./chunk-WHPOBTTU.js";
6
+ } from "./chunk-ZSTL3GO6.js";
7
7
  import {
8
8
  TurnMetrics,
9
9
  createChatDoneEvent,
@@ -11,22 +11,22 @@ import {
11
11
  createMessageStartEvent,
12
12
  createToolCallEvent,
13
13
  createToolResultEvent
14
- } from "./chunk-XI7JEBNT.js";
14
+ } from "./chunk-NAONQLLT.js";
15
15
  import "./chunk-OXI26S7U.js";
16
16
  import "./chunk-CMQCO27Y.js";
17
17
  import "./chunk-DL6ZILAF.js";
18
18
  import "./chunk-PBGOZMVY.js";
19
19
  import "./chunk-VRGRAQDG.js";
20
- import "./chunk-Y325P6Z4.js";
21
- import "./chunk-WNYDTFJO.js";
20
+ import "./chunk-YNIAFX24.js";
21
+ import "./chunk-6THJULLK.js";
22
22
  import "./chunk-KIOUKC3Z.js";
23
- import "./chunk-TS5XFQ2D.js";
24
- import "./chunk-ZPQDYRQI.js";
23
+ import "./chunk-XVWVAWSG.js";
24
+ import "./chunk-GN7RB4Y4.js";
25
25
  import "./chunk-BJYPTN5S.js";
26
- import "./chunk-NDJ6FKSP.js";
26
+ import "./chunk-4VT74LCD.js";
27
27
  import "./chunk-CQGTEGKL.js";
28
28
  import "./chunk-B5AP3RSV.js";
29
- import "./chunk-C3O6MZJV.js";
29
+ import "./chunk-WSRF5L3S.js";
30
30
  import "./chunk-K44MW7JJ.js";
31
31
  export {
32
32
  TurnMetrics,
@@ -40,4 +40,4 @@ export {
40
40
  runChatTurn,
41
41
  runVerifierTurn
42
42
  };
43
- //# sourceMappingURL=orchestrator-YFHSFYII.js.map
43
+ //# sourceMappingURL=orchestrator-4YKFENVV.js.map
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openfox",
3
- "version": "1.6.82",
3
+ "version": "1.6.83",
4
4
  "description": "Local-LLM-first agentic coding assistant",
5
5
  "type": "module",
6
6
  "bin": {
@@ -5,17 +5,17 @@ import {
5
5
  generateSessionName,
6
6
  getSessionMessageCount,
7
7
  needsNameGenerationCheck
8
- } from "./chunk-D67V55WE.js";
8
+ } from "./chunk-6GH2PJJC.js";
9
9
  import {
10
10
  getEventStore
11
- } from "./chunk-WNYDTFJO.js";
11
+ } from "./chunk-6THJULLK.js";
12
12
  import "./chunk-KIOUKC3Z.js";
13
- import "./chunk-TS5XFQ2D.js";
13
+ import "./chunk-XVWVAWSG.js";
14
14
  import {
15
15
  createChatMessageMessage,
16
16
  createSessionRunningMessage
17
- } from "./chunk-ZPQDYRQI.js";
18
- import "./chunk-NDJ6FKSP.js";
17
+ } from "./chunk-GN7RB4Y4.js";
18
+ import "./chunk-4VT74LCD.js";
19
19
  import "./chunk-B5AP3RSV.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-YFHSFYII.js");
180
+ const { runChatTurn } = await import("./orchestrator-4YKFENVV.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-EM4BINEJ.js.map
224
+ //# sourceMappingURL=processor-I2NXOFPC.js.map
@@ -256,6 +256,7 @@ interface Message {
256
256
  segments?: MessageSegment[];
257
257
  stats?: MessageStats;
258
258
  partial?: boolean;
259
+ completeReason?: 'complete' | 'stopped' | 'error' | 'waiting_for_user' | 'truncated';
259
260
  isSystemGenerated?: boolean;
260
261
  isStreaming?: boolean;
261
262
  messageKind?: 'correction' | 'auto-prompt' | 'context-reset' | 'task-completed' | 'workflow-started' | 'command';
@@ -623,7 +624,7 @@ interface ChatMessageUpdatedPayload {
623
624
  }
624
625
  interface ChatDonePayload {
625
626
  messageId: string;
626
- reason: 'complete' | 'stopped' | 'error' | 'waiting_for_user';
627
+ reason: 'complete' | 'stopped' | 'error' | 'waiting_for_user' | 'truncated';
627
628
  agentType?: 'sub-agent';
628
629
  stats?: {
629
630
  model: string;
@@ -35,8 +35,8 @@ import {
35
35
  parseClientMessage,
36
36
  serializeServerMessage,
37
37
  storedEventToServerMessage
38
- } from "./chunk-ZPQDYRQI.js";
39
- import "./chunk-NDJ6FKSP.js";
38
+ } from "./chunk-GN7RB4Y4.js";
39
+ import "./chunk-4VT74LCD.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-VVUFP4I7.js.map
78
+ //# sourceMappingURL=protocol-NEBXAMJ3.js.map
@@ -5,18 +5,18 @@ import {
5
5
  loadGlobalConfig,
6
6
  removeProvider,
7
7
  saveGlobalConfig
8
- } from "./chunk-DVNZAJT5.js";
8
+ } from "./chunk-TLOL4I7K.js";
9
9
  import {
10
10
  fetchAvailableModelsFromBackend
11
- } from "./chunk-HJOH367L.js";
11
+ } from "./chunk-6GGYIEBM.js";
12
12
  import {
13
13
  detectModel
14
- } from "./chunk-NRJOTXHG.js";
14
+ } from "./chunk-JDDNBK6T.js";
15
15
  import {
16
16
  detectBackend
17
- } from "./chunk-Y325P6Z4.js";
17
+ } from "./chunk-YNIAFX24.js";
18
18
  import "./chunk-CQGTEGKL.js";
19
- import "./chunk-C3O6MZJV.js";
19
+ import "./chunk-WSRF5L3S.js";
20
20
  import "./chunk-K44MW7JJ.js";
21
21
 
22
22
  // src/cli/provider.ts
@@ -248,7 +248,7 @@ async function runProviderAdd(mode) {
248
248
  isActive: makeActive
249
249
  });
250
250
  if (makeActive) {
251
- const { setDefaultModelSelection } = await import("./config-RIK5T6WK.js");
251
+ const { setDefaultModelSelection } = await import("./config-HMMPXQ46.js");
252
252
  newConfig = setDefaultModelSelection(
253
253
  newConfig,
254
254
  newConfig.providers[newConfig.providers.length - 1].id,
@@ -376,4 +376,4 @@ export {
376
376
  runProviderRemove,
377
377
  runProviderUse
378
378
  };
379
- //# sourceMappingURL=provider-AASLIQZJ.js.map
379
+ //# sourceMappingURL=provider-LDZFYLK6.js.map
@@ -2,28 +2,28 @@ import {
2
2
  getActiveProvider,
3
3
  getDefaultModel,
4
4
  loadGlobalConfig
5
- } from "./chunk-DVNZAJT5.js";
5
+ } from "./chunk-TLOL4I7K.js";
6
6
  import {
7
7
  VERSION,
8
8
  createServer
9
- } from "./chunk-MDL6USSE.js";
10
- import "./chunk-WHPOBTTU.js";
11
- import "./chunk-XI7JEBNT.js";
9
+ } from "./chunk-3Y3HDOT3.js";
10
+ import "./chunk-ZSTL3GO6.js";
11
+ import "./chunk-NAONQLLT.js";
12
12
  import "./chunk-OXI26S7U.js";
13
13
  import "./chunk-CMQCO27Y.js";
14
14
  import "./chunk-DL6ZILAF.js";
15
15
  import "./chunk-PBGOZMVY.js";
16
16
  import "./chunk-VRGRAQDG.js";
17
- import "./chunk-HJOH367L.js";
18
- import "./chunk-NRJOTXHG.js";
19
- import "./chunk-Y325P6Z4.js";
20
- import "./chunk-WNYDTFJO.js";
17
+ import "./chunk-6GGYIEBM.js";
18
+ import "./chunk-JDDNBK6T.js";
19
+ import "./chunk-YNIAFX24.js";
20
+ import "./chunk-6THJULLK.js";
21
21
  import "./chunk-KIOUKC3Z.js";
22
- import "./chunk-TS5XFQ2D.js";
23
- import "./chunk-ZPQDYRQI.js";
22
+ import "./chunk-XVWVAWSG.js";
23
+ import "./chunk-GN7RB4Y4.js";
24
24
  import "./chunk-BJYPTN5S.js";
25
25
  import "./chunk-RGRBWDZP.js";
26
- import "./chunk-NDJ6FKSP.js";
26
+ import "./chunk-4VT74LCD.js";
27
27
  import {
28
28
  ensureDataDirExists,
29
29
  getDatabasePath,
@@ -32,7 +32,7 @@ import {
32
32
  import {
33
33
  loadConfig
34
34
  } from "./chunk-B5AP3RSV.js";
35
- import "./chunk-C3O6MZJV.js";
35
+ import "./chunk-WSRF5L3S.js";
36
36
  import {
37
37
  logger
38
38
  } from "./chunk-K44MW7JJ.js";
@@ -190,4 +190,4 @@ async function runServe(options) {
190
190
  export {
191
191
  runServe
192
192
  };
193
- //# sourceMappingURL=serve-OJPBEKVE.js.map
193
+ //# sourceMappingURL=serve-IED7B4A5.js.map
@@ -1,4 +1,4 @@
1
- import { aO as ToolCall, c as Attachment, T as Diagnostic, an as Provider, a8 as ModelConfig, aA as Session, aJ as SessionSummary, af as Project, aE as SessionMode, aG as SessionPhase, M as Message, K as Criterion, N as CriterionStatus, aw as QueuedMessage, G as ContextState, P as DangerLevel$1, ay as ServerMessage, aL as StatsIdentity, aR as ToolResult, E as Config } from '../protocol-OnZRAPeM.js';
1
+ import { aO as ToolCall, c as Attachment, T as Diagnostic, an as Provider, a8 as ModelConfig, aA as Session, aJ as SessionSummary, af as Project, aE as SessionMode, aG as SessionPhase, M as Message, K as Criterion, N as CriterionStatus, aw as QueuedMessage, G as ContextState, P as DangerLevel$1, ay as ServerMessage, aL as StatsIdentity, aR as ToolResult, E as Config } from '../protocol-DEXfLRbe.js';
2
2
  import { Server } from 'node:http';
3
3
 
4
4
  interface LLMMessage {
@@ -295,6 +295,7 @@ declare class SessionManager {
295
295
  maxTokens?: number;
296
296
  supportsVision?: boolean;
297
297
  } | undefined;
298
+ getCurrentModelContext(): number;
298
299
  /**
299
300
  * Create a new session. Emits session.initialized event.
300
301
  * Note: maxTokens is no longer stored in the session - it comes from the current model config
@@ -1,27 +1,27 @@
1
1
  import {
2
2
  createServer,
3
3
  createServerHandle
4
- } from "../chunk-MDL6USSE.js";
5
- import "../chunk-WHPOBTTU.js";
6
- import "../chunk-XI7JEBNT.js";
4
+ } from "../chunk-3Y3HDOT3.js";
5
+ import "../chunk-ZSTL3GO6.js";
6
+ import "../chunk-NAONQLLT.js";
7
7
  import "../chunk-OXI26S7U.js";
8
8
  import "../chunk-CMQCO27Y.js";
9
9
  import "../chunk-DL6ZILAF.js";
10
10
  import "../chunk-PBGOZMVY.js";
11
11
  import "../chunk-VRGRAQDG.js";
12
- import "../chunk-HJOH367L.js";
13
- import "../chunk-NRJOTXHG.js";
14
- import "../chunk-Y325P6Z4.js";
15
- import "../chunk-WNYDTFJO.js";
12
+ import "../chunk-6GGYIEBM.js";
13
+ import "../chunk-JDDNBK6T.js";
14
+ import "../chunk-YNIAFX24.js";
15
+ import "../chunk-6THJULLK.js";
16
16
  import "../chunk-KIOUKC3Z.js";
17
- import "../chunk-TS5XFQ2D.js";
18
- import "../chunk-ZPQDYRQI.js";
17
+ import "../chunk-XVWVAWSG.js";
18
+ import "../chunk-GN7RB4Y4.js";
19
19
  import "../chunk-BJYPTN5S.js";
20
20
  import "../chunk-RGRBWDZP.js";
21
- import "../chunk-NDJ6FKSP.js";
21
+ import "../chunk-4VT74LCD.js";
22
22
  import "../chunk-CQGTEGKL.js";
23
23
  import "../chunk-B5AP3RSV.js";
24
- import "../chunk-C3O6MZJV.js";
24
+ import "../chunk-WSRF5L3S.js";
25
25
  import "../chunk-K44MW7JJ.js";
26
26
  export {
27
27
  createServer,
@@ -1,5 +1,5 @@
1
- import { M as Message, S as SessionStats } from '../protocol-OnZRAPeM.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 ChatSummaryPayload, s as ChatThinkingPayload, t as ChatTodoPayload, u as ChatToolCallPayload, v as ChatToolOutputPayload, w as ChatToolPreparingPayload, x as ChatToolResultPayload, y as ChatVisionFallbackPayload, z as ClientMessage, D as ClientMessageType, E as Config, F as ContextCompactionEvent, G as ContextState, H as ContextStatePayload, I as ContextWindow, J as CriteriaUpdatedPayload, K as Criterion, L as CriterionAttempt, N as CriterionStatus, O as CriterionValidation, P as DangerLevel, Q as DevServerOutputPayload, R as DevServerStatePayload, T as Diagnostic, U as EditContextEdit, V as EditContextLine, W as EditContextRegion, X as ElementData, Y as ErrorPayload, Z as ExecutionState, _ as FileReadEntry, $ as InjectedFile, a0 as LLMCallStats, a1 as LlmBackend, a2 as LogLine, a3 as LspDiagnosticsPayload, a4 as MessageRole, a5 as MessageSegment, a6 as MessageStats, a7 as ModeChangedPayload, a8 as ModelConfig, a9 as ModelSessionStats, aa as PathConfirmPayload, ab as PathConfirmationReason, ac as PendingPathConfirmationPayload, ad as PhaseChangedPayload, ae as PreparingToolCall, af as Project, ag as ProjectDeletedPayload, ah as ProjectListPayload, ai as ProjectStatePayload, aj as PromptContext, ak as PromptContextMessage, al as PromptContextTool, am as PromptRequestOptions, an as Provider, ao as ProviderBackend, ap as ProviderChangedPayload, aq as QueueAddedEvent, ar as QueueCancelledEvent, as as QueueDrainedEvent, at as QueueEvent, au as QueueEventType, av as QueueStatePayload, aw as QueuedMessage, ax as RecentUserPrompt, ay as ServerMessage, az as ServerMessageType, aA as Session, aB as SessionListPayload, aC as SessionLoadPayload, aD as SessionMetadata, aE as SessionMode, aF as SessionNameGeneratedPayload, aG as SessionPhase, aH as SessionRunningPayload, aI as SessionStatePayload, aJ as SessionSummary, aK as StatsDataPoint, aL as StatsIdentity, aM as TaskCompletedPayload, aN as Todo, aO as ToolCall, aP as ToolMode, aQ as ToolName, aR as ToolResult, aS as ValidationResult, aT as createClientMessage, aU as createServerMessage, aV as isClientMessage, aW as isServerMessage } from '../protocol-OnZRAPeM.js';
1
+ import { M as Message, S as SessionStats } from '../protocol-DEXfLRbe.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 ChatSummaryPayload, s as ChatThinkingPayload, t as ChatTodoPayload, u as ChatToolCallPayload, v as ChatToolOutputPayload, w as ChatToolPreparingPayload, x as ChatToolResultPayload, y as ChatVisionFallbackPayload, z as ClientMessage, D as ClientMessageType, E as Config, F as ContextCompactionEvent, G as ContextState, H as ContextStatePayload, I as ContextWindow, J as CriteriaUpdatedPayload, K as Criterion, L as CriterionAttempt, N as CriterionStatus, O as CriterionValidation, P as DangerLevel, Q as DevServerOutputPayload, R as DevServerStatePayload, T as Diagnostic, U as EditContextEdit, V as EditContextLine, W as EditContextRegion, X as ElementData, Y as ErrorPayload, Z as ExecutionState, _ as FileReadEntry, $ as InjectedFile, a0 as LLMCallStats, a1 as LlmBackend, a2 as LogLine, a3 as LspDiagnosticsPayload, a4 as MessageRole, a5 as MessageSegment, a6 as MessageStats, a7 as ModeChangedPayload, a8 as ModelConfig, a9 as ModelSessionStats, aa as PathConfirmPayload, ab as PathConfirmationReason, ac as PendingPathConfirmationPayload, ad as PhaseChangedPayload, ae as PreparingToolCall, af as Project, ag as ProjectDeletedPayload, ah as ProjectListPayload, ai as ProjectStatePayload, aj as PromptContext, ak as PromptContextMessage, al as PromptContextTool, am as PromptRequestOptions, an as Provider, ao as ProviderBackend, ap as ProviderChangedPayload, aq as QueueAddedEvent, ar as QueueCancelledEvent, as as QueueDrainedEvent, at as QueueEvent, au as QueueEventType, av as QueueStatePayload, aw as QueuedMessage, ax as RecentUserPrompt, ay as ServerMessage, az as ServerMessageType, aA as Session, aB as SessionListPayload, aC as SessionLoadPayload, aD as SessionMetadata, aE as SessionMode, aF as SessionNameGeneratedPayload, aG as SessionPhase, aH as SessionRunningPayload, aI as SessionStatePayload, aJ as SessionSummary, aK as StatsDataPoint, aL as StatsIdentity, aM as TaskCompletedPayload, aN as Todo, aO as ToolCall, aP as ToolMode, aQ as ToolName, aR as ToolResult, aS as ValidationResult, aT as createClientMessage, aU as createServerMessage, aV as isClientMessage, aW as isServerMessage } from '../protocol-DEXfLRbe.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-NDJ6FKSP.js";
9
+ } from "../chunk-4VT74LCD.js";
10
10
  export {
11
11
  computeSessionStats,
12
12
  createClientMessage,