openfox 2.0.2 → 2.0.4

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 (36) hide show
  1. package/dist/{chat-handler-LJMW4OK3.js → chat-handler-WHE75FCD.js} +9 -9
  2. package/dist/{chunk-ITWVFGFV.js → chunk-4HBWSC6K.js} +1 -1
  3. package/dist/{chunk-7ZMMDZU7.js → chunk-A52FXWJX.js} +8 -4
  4. package/dist/{chunk-7TTEGAO6.js → chunk-DTJJZZOC.js} +2 -2
  5. package/dist/{chunk-XEK3KII6.js → chunk-FRJQC77Y.js} +2 -29
  6. package/dist/{chunk-CK6LGE7G.js → chunk-KXJWTSOS.js} +4 -4
  7. package/dist/{chunk-BVHFMAVN.js → chunk-LVS5YGTX.js} +1 -1
  8. package/dist/{chunk-32GQUDLN.js → chunk-N374WCXC.js} +53 -27
  9. package/dist/{chunk-RI6GAMNP.js → chunk-NZCKCJH5.js} +1 -1
  10. package/dist/{chunk-72GTKFVG.js → chunk-O2MR653P.js} +67 -155
  11. package/dist/{chunk-MWHH6UZB.js → chunk-RVXAYREQ.js} +6 -6
  12. package/dist/{chunk-LEDG5WAN.js → chunk-STJJDIXV.js} +4 -4
  13. package/dist/{chunk-FFEAEPJB.js → chunk-Z4SWOUWC.js} +8 -3
  14. package/dist/cli/dev.js +1 -1
  15. package/dist/cli/index.js +1 -1
  16. package/dist/{compactor-TDNRM3A7.js → compactor-5VQNEYQX.js} +2 -2
  17. package/dist/{events-ZKWAKWI7.js → events-5SWEG62X.js} +3 -5
  18. package/dist/{folding-YOCGTZYH.js → folding-NUBDA4HS.js} +2 -2
  19. package/dist/{orchestrator-LX6FKB6L.js → orchestrator-X2ECL42Y.js} +8 -8
  20. package/dist/package.json +1 -1
  21. package/dist/{processor-NMYSEBC7.js → processor-7TYZNS4I.js} +7 -7
  22. package/dist/{protocol-D59sCy9L.d.ts → protocol-BljtHZrx.d.ts} +4 -2
  23. package/dist/{protocol-CN24IKQN.js → protocol-X53W2J73.js} +3 -3
  24. package/dist/{provider-DTNQYCMV.js → provider-QPECLUZ7.js} +3 -3
  25. package/dist/{provider-manager-LMHAHLIF.js → provider-manager-YA2WALTF.js} +3 -3
  26. package/dist/{serve-DMWEPTU5.js → serve-XPCJSKXX.js} +11 -11
  27. package/dist/server/index.d.ts +4 -9
  28. package/dist/server/index.js +10 -10
  29. package/dist/{service-GB7AIOG5.js → service-FJ4TW5L7.js} +14 -9
  30. package/dist/shared/index.d.ts +2 -2
  31. package/dist/shared/index.js +1 -1
  32. package/dist/{tools-BOE5T3KC.js → tools-22OPY2O7.js} +7 -7
  33. package/dist/web/assets/{index-C7IF2YAa.js → index-Di3909TT.js} +68 -68
  34. package/dist/web/index.html +1 -1
  35. package/dist/web/sw.js +1 -1
  36. package/package.json +1 -1
@@ -5,30 +5,30 @@ import {
5
5
  generateSessionName,
6
6
  getSessionMessageCount,
7
7
  needsNameGenerationCheck
8
- } from "./chunk-CK6LGE7G.js";
8
+ } from "./chunk-KXJWTSOS.js";
9
9
  import {
10
10
  runChatTurn
11
- } from "./chunk-LEDG5WAN.js";
12
- import "./chunk-32GQUDLN.js";
11
+ } from "./chunk-STJJDIXV.js";
12
+ import "./chunk-N374WCXC.js";
13
13
  import "./chunk-DL6ZILAF.js";
14
14
  import "./chunk-PBGOZMVY.js";
15
15
  import "./chunk-VRGRAQDG.js";
16
16
  import "./chunk-XAMAYRDA.js";
17
17
  import {
18
18
  getEventStore
19
- } from "./chunk-XEK3KII6.js";
20
- import "./chunk-ITWVFGFV.js";
19
+ } from "./chunk-FRJQC77Y.js";
20
+ import "./chunk-4HBWSC6K.js";
21
21
  import {
22
22
  createChatMessageMessage,
23
23
  createPhaseChangedMessage,
24
24
  createSessionRunningMessage
25
- } from "./chunk-7TTEGAO6.js";
25
+ } from "./chunk-DTJJZZOC.js";
26
26
  import "./chunk-BJYPTN5S.js";
27
27
  import "./chunk-RFNEDBVO.js";
28
28
  import "./chunk-FBGWG4N6.js";
29
- import "./chunk-BVHFMAVN.js";
29
+ import "./chunk-LVS5YGTX.js";
30
30
  import "./chunk-CQGTEGKL.js";
31
- import "./chunk-FFEAEPJB.js";
31
+ import "./chunk-Z4SWOUWC.js";
32
32
  import {
33
33
  logger
34
34
  } from "./chunk-K44MW7JJ.js";
@@ -161,4 +161,4 @@ export {
161
161
  startChatSession,
162
162
  stopSessionExecution
163
163
  };
164
- //# sourceMappingURL=chat-handler-LJMW4OK3.js.map
164
+ //# sourceMappingURL=chat-handler-WHE75FCD.js.map
@@ -856,4 +856,4 @@ export {
856
856
  getMessagesForWindow,
857
857
  buildContextMessagesFromMessages
858
858
  };
859
- //# sourceMappingURL=chunk-ITWVFGFV.js.map
859
+ //# sourceMappingURL=chunk-4HBWSC6K.js.map
@@ -5,7 +5,7 @@ import {
5
5
  getModelProfile,
6
6
  getThinking,
7
7
  mapFinishReason
8
- } from "./chunk-FFEAEPJB.js";
8
+ } from "./chunk-Z4SWOUWC.js";
9
9
  import {
10
10
  logger
11
11
  } from "./chunk-K44MW7JJ.js";
@@ -826,7 +826,9 @@ function createProviderManager(config) {
826
826
  ...settings.thinkingLevel !== void 0 ? { thinkingLevel: settings.thinkingLevel } : existingModel?.thinkingLevel !== void 0 ? { thinkingLevel: existingModel.thinkingLevel } : {},
827
827
  ...settings.nonThinkingEnabled !== void 0 ? { nonThinkingEnabled: settings.nonThinkingEnabled } : existingModel?.nonThinkingEnabled !== void 0 ? { nonThinkingEnabled: existingModel.nonThinkingEnabled } : {},
828
828
  ...settings.thinkingExtraKwargs !== void 0 ? { thinkingExtraKwargs: settings.thinkingExtraKwargs } : existingModel?.thinkingExtraKwargs !== void 0 ? { thinkingExtraKwargs: existingModel.thinkingExtraKwargs } : {},
829
- ...settings.nonThinkingExtraKwargs !== void 0 ? { nonThinkingExtraKwargs: settings.nonThinkingExtraKwargs } : existingModel?.nonThinkingExtraKwargs !== void 0 ? { nonThinkingExtraKwargs: existingModel.nonThinkingExtraKwargs } : {}
829
+ ...settings.nonThinkingExtraKwargs !== void 0 ? { nonThinkingExtraKwargs: settings.nonThinkingExtraKwargs } : existingModel?.nonThinkingExtraKwargs !== void 0 ? { nonThinkingExtraKwargs: existingModel.nonThinkingExtraKwargs } : {},
830
+ ...settings.thinkingQueryParams !== void 0 ? { thinkingQueryParams: settings.thinkingQueryParams } : existingModel?.thinkingQueryParams !== void 0 ? { thinkingQueryParams: existingModel.thinkingQueryParams } : {},
831
+ ...settings.nonThinkingQueryParams !== void 0 ? { nonThinkingQueryParams: settings.nonThinkingQueryParams } : existingModel?.nonThinkingQueryParams !== void 0 ? { nonThinkingQueryParams: existingModel.nonThinkingQueryParams } : {}
830
832
  });
831
833
  if (existingModel) {
832
834
  providers = providers.map(
@@ -849,7 +851,9 @@ function createProviderManager(config) {
849
851
  ...model.topK !== void 0 && { topK: model.topK },
850
852
  ...model.maxTokens !== void 0 && { maxTokens: model.maxTokens },
851
853
  ...model.supportsVision !== void 0 && { supportsVision: model.supportsVision },
852
- ...kwargs ? { chatTemplateKwargs: JSON.parse(kwargs) } : {}
854
+ ...kwargs ? { chatTemplateKwargs: JSON.parse(kwargs) } : {},
855
+ ...mode === "thinking" && model.thinkingQueryParams ? { queryParams: JSON.parse(model.thinkingQueryParams) } : {},
856
+ ...mode === "non-thinking" && model.nonThinkingQueryParams ? { queryParams: JSON.parse(model.nonThinkingQueryParams) } : {}
853
857
  };
854
858
  },
855
859
  async refreshProviderModels(providerId) {
@@ -913,4 +917,4 @@ export {
913
917
  parseDefaultModelSelection,
914
918
  createProviderManager
915
919
  };
916
- //# sourceMappingURL=chunk-7ZMMDZU7.js.map
920
+ //# sourceMappingURL=chunk-A52FXWJX.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createServerMessage,
3
3
  isClientMessage
4
- } from "./chunk-BVHFMAVN.js";
4
+ } from "./chunk-LVS5YGTX.js";
5
5
 
6
6
  // src/server/ws/protocol.ts
7
7
  function enrichMessagesWithToolResults(messages) {
@@ -333,4 +333,4 @@ export {
333
333
  createQueueStateMessage,
334
334
  storedEventToServerMessage
335
335
  };
336
- //# sourceMappingURL=chunk-7TTEGAO6.js.map
336
+ //# sourceMappingURL=chunk-DTJJZZOC.js.map
@@ -5,7 +5,7 @@ import {
5
5
  foldContextState,
6
6
  foldSessionState,
7
7
  spreadOptionalMessageFields
8
- } from "./chunk-ITWVFGFV.js";
8
+ } from "./chunk-4HBWSC6K.js";
9
9
  import {
10
10
  getDatabase
11
11
  } from "./chunk-FBGWG4N6.js";
@@ -1287,32 +1287,6 @@ function truncateSessionMessages(sessionId, messageIndex) {
1287
1287
  const removed = messages.length - lastKept;
1288
1288
  updateSessionMessageCount(sessionId, -removed);
1289
1289
  }
1290
- function compactContext(sessionId, summary, beforeTokens) {
1291
- const state = getSessionState(sessionId);
1292
- if (!state) {
1293
- throw new Error("Session not found");
1294
- }
1295
- const closedWindowId = state.currentContextWindowId;
1296
- const newWindowId = crypto.randomUUID();
1297
- const summaryMessageId = crypto.randomUUID();
1298
- const eventStore = getEventStore();
1299
- eventStore.append(sessionId, {
1300
- type: "message.start",
1301
- data: {
1302
- messageId: summaryMessageId,
1303
- role: "assistant",
1304
- content: summary,
1305
- contextWindowId: closedWindowId,
1306
- isCompactionSummary: true
1307
- }
1308
- });
1309
- eventStore.append(sessionId, {
1310
- type: "message.done",
1311
- data: { messageId: summaryMessageId }
1312
- });
1313
- emitContextCompacted(sessionId, closedWindowId, newWindowId, beforeTokens, 0, summary);
1314
- return { newWindowId, summaryMessageId };
1315
- }
1316
1290
  function getRecentUserPromptsForSession(sessionId, limit = 10) {
1317
1291
  try {
1318
1292
  const eventStore = getEventStore();
@@ -1421,7 +1395,6 @@ export {
1421
1395
  emitPatternRetry,
1422
1396
  emitTurnSnapshot,
1423
1397
  truncateSessionMessages,
1424
- compactContext,
1425
1398
  getRecentUserPromptsForSession
1426
1399
  };
1427
- //# sourceMappingURL=chunk-XEK3KII6.js.map
1400
+ //# sourceMappingURL=chunk-FRJQC77Y.js.map
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  getEventStore,
3
3
  updateSessionMetadata
4
- } from "./chunk-XEK3KII6.js";
4
+ } from "./chunk-FRJQC77Y.js";
5
5
  import {
6
6
  buildMessagesFromStoredEvents,
7
7
  foldPendingConfirmations
8
- } from "./chunk-ITWVFGFV.js";
8
+ } from "./chunk-4HBWSC6K.js";
9
9
  import {
10
10
  createContextStateMessage,
11
11
  createSessionStateMessage
12
- } from "./chunk-7TTEGAO6.js";
12
+ } from "./chunk-DTJJZZOC.js";
13
13
  import {
14
14
  logger
15
15
  } from "./chunk-K44MW7JJ.js";
@@ -147,4 +147,4 @@ export {
147
147
  needsNameGenerationCheck,
148
148
  applyGeneratedSessionName
149
149
  };
150
- //# sourceMappingURL=chunk-CK6LGE7G.js.map
150
+ //# sourceMappingURL=chunk-KXJWTSOS.js.map
@@ -26,4 +26,4 @@ export {
26
26
  isClientMessage,
27
27
  isServerMessage
28
28
  };
29
- //# sourceMappingURL=chunk-BVHFMAVN.js.map
29
+ //# sourceMappingURL=chunk-LVS5YGTX.js.map
@@ -22,7 +22,7 @@ import {
22
22
  getCurrentWindowMessageOptions,
23
23
  getEventStore,
24
24
  getRuntimeConfig
25
- } from "./chunk-XEK3KII6.js";
25
+ } from "./chunk-FRJQC77Y.js";
26
26
  import {
27
27
  buildContextMessagesFromEventHistory,
28
28
  foldContextState,
@@ -31,14 +31,14 @@ import {
31
31
  handleToolCall,
32
32
  handleToolResult,
33
33
  stripOrphanedToolCalls
34
- } from "./chunk-ITWVFGFV.js";
34
+ } from "./chunk-4HBWSC6K.js";
35
35
  import {
36
36
  createChatDoneMessage,
37
37
  createChatMessageMessage,
38
38
  createChatMessageUpdatedMessage,
39
39
  createChatPathConfirmationMessage,
40
40
  createQueueStateMessage
41
- } from "./chunk-7TTEGAO6.js";
41
+ } from "./chunk-DTJJZZOC.js";
42
42
  import {
43
43
  AskUserInterrupt,
44
44
  askUserTool
@@ -57,7 +57,7 @@ import {
57
57
  getModelProfile,
58
58
  modelSupportsVision,
59
59
  streamWithSegments
60
- } from "./chunk-FFEAEPJB.js";
60
+ } from "./chunk-Z4SWOUWC.js";
61
61
  import {
62
62
  logger
63
63
  } from "./chunk-K44MW7JJ.js";
@@ -2629,6 +2629,7 @@ async function executeTools(assistantMsgId, toolCalls, ctx, append) {
2629
2629
  const toolMessages = [];
2630
2630
  let returnValueContent;
2631
2631
  let returnValueResult;
2632
+ let stepDoneCalled = false;
2632
2633
  if (ctx.signal?.aborted) {
2633
2634
  throw new Error("Aborted");
2634
2635
  }
@@ -2713,6 +2714,9 @@ async function executeTools(assistantMsgId, toolCalls, ctx, append) {
2713
2714
  returnValueContent = toolCall.arguments["content"];
2714
2715
  returnValueResult = toolCall.arguments["result"];
2715
2716
  }
2717
+ if (toolCall.name === "step_done" && toolResult.success) {
2718
+ stepDoneCalled = true;
2719
+ }
2716
2720
  const content = stripAnsi(
2717
2721
  toolResult.success ? toolResult.output ?? "Success" : toolResult.output ? `${toolResult.output}
2718
2722
 
@@ -2737,7 +2741,7 @@ Error: ${toolResult.error}` : `Error: ${toolResult.error}`
2737
2741
  toolCallId: result.toolCall.id
2738
2742
  });
2739
2743
  }
2740
- return { toolMessages, criteriaChanged: false, returnValueContent, returnValueResult };
2744
+ return { toolMessages, criteriaChanged: false, returnValueContent, returnValueResult, stepDoneCalled };
2741
2745
  }
2742
2746
 
2743
2747
  // src/server/chat/retry-limiter.ts
@@ -2795,6 +2799,25 @@ function emitPartialDoneEvents(_sessionId, assistantMsgId, statsIdentity, mode,
2795
2799
  );
2796
2800
  append(createChatDoneEvent(assistantMsgId, "stopped", stats));
2797
2801
  }
2802
+ function emitDoneAndBreak(assistantMsgId, segments, statsIdentity, mode, turnMetrics, append, onMessage, reason) {
2803
+ const stats = turnMetrics.buildStats(statsIdentity, mode);
2804
+ append(
2805
+ createMessageDoneEvent(assistantMsgId, {
2806
+ ...segments ? { segments } : {},
2807
+ stats
2808
+ })
2809
+ );
2810
+ append(createChatDoneEvent(assistantMsgId, reason, stats));
2811
+ if (onMessage) {
2812
+ onMessage(
2813
+ createChatMessageUpdatedMessage(assistantMsgId, {
2814
+ isStreaming: false,
2815
+ stats
2816
+ })
2817
+ );
2818
+ onMessage(createChatDoneMessage(assistantMsgId, reason, stats));
2819
+ }
2820
+ }
2798
2821
  var MAX_TRUNCATION_RETRIES = 3;
2799
2822
  var CONTINUE_PROMPT = "Continue your previous response. Do NOT repeat what you already wrote.";
2800
2823
  async function runTopLevelAgentLoop(config, turnMetrics) {
@@ -2929,7 +2952,7 @@ ${CONTINUE_PROMPT}` : CONTINUE_PROMPT;
2929
2952
  sessionManager.setCurrentContextSize(sessionId, result.usage.promptTokens);
2930
2953
  if (!compacting) {
2931
2954
  const contextState = sessionManager.getContextState(sessionId);
2932
- const { shouldCompact } = await import("./compactor-TDNRM3A7.js");
2955
+ const { shouldCompact } = await import("./compactor-5VQNEYQX.js");
2933
2956
  if (shouldCompact(contextState.currentTokens, contextState.maxTokens, runtimeConfig.context.compactionThreshold)) {
2934
2957
  const compactPromptMsgId = crypto.randomUUID();
2935
2958
  append(
@@ -3032,28 +3055,33 @@ ${COMPACTION_PROMPT}`,
3032
3055
  }
3033
3056
  batchContext.agentTimeout = getRuntimeConfig().agent.toolTimeout;
3034
3057
  const batchResult = await executeTools(assistantMsgId, result.toolCalls, batchContext, append);
3058
+ if (batchResult.stepDoneCalled) {
3059
+ emitDoneAndBreak(
3060
+ assistantMsgId,
3061
+ result.segments,
3062
+ statsIdentity,
3063
+ mode,
3064
+ turnMetrics,
3065
+ append,
3066
+ onMessage,
3067
+ "step_done"
3068
+ );
3069
+ break;
3070
+ }
3035
3071
  if (batchResult.returnValueContent) {
3036
3072
  returnValueContent = batchResult.returnValueContent;
3037
3073
  returnValueResult = batchResult.returnValueResult;
3038
3074
  if (config.breakOnReturnValue) {
3039
- const stats2 = turnMetrics.buildStats(statsIdentity, mode);
3040
- append(
3041
- createMessageDoneEvent(assistantMsgId, {
3042
- segments: result.segments,
3043
- stats: stats2
3044
- })
3075
+ emitDoneAndBreak(
3076
+ assistantMsgId,
3077
+ result.segments,
3078
+ statsIdentity,
3079
+ mode,
3080
+ turnMetrics,
3081
+ append,
3082
+ onMessage,
3083
+ "complete"
3045
3084
  );
3046
- append(createChatDoneEvent(assistantMsgId, "complete", stats2));
3047
- if (onMessage) {
3048
- onMessage(
3049
- createChatMessageUpdatedMessage(assistantMsgId, {
3050
- isStreaming: false,
3051
- stats: stats2
3052
- })
3053
- );
3054
- const { createChatDoneMessage: createChatDoneMessage2 } = await import("./protocol-CN24IKQN.js");
3055
- onMessage(createChatDoneMessage2(assistantMsgId, "complete", stats2));
3056
- }
3057
3085
  break;
3058
3086
  }
3059
3087
  }
@@ -3733,7 +3761,7 @@ var callSubAgentTool = {
3733
3761
  };
3734
3762
  }
3735
3763
  try {
3736
- const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-BOE5T3KC.js");
3764
+ const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-22OPY2O7.js");
3737
3765
  const toolRegistry = getToolRegistryForAgent2(agentDef);
3738
3766
  const turnMetrics = new TurnMetrics();
3739
3767
  const result = await executeSubAgent({
@@ -4770,8 +4798,6 @@ export {
4770
4798
  runTopLevelAgentLoop,
4771
4799
  createAssemblyResult,
4772
4800
  assembleAgentRequest,
4773
- loadVisionModelFromGlobalConfig,
4774
- processContextImages,
4775
4801
  getConversationMessages,
4776
4802
  processEventsForConversation,
4777
4803
  executeSubAgent,
@@ -4785,4 +4811,4 @@ export {
4785
4811
  getToolRegistryForAgent,
4786
4812
  createToolRegistry
4787
4813
  };
4788
- //# sourceMappingURL=chunk-32GQUDLN.js.map
4814
+ //# sourceMappingURL=chunk-N374WCXC.js.map
@@ -10,4 +10,4 @@ export {
10
10
  shouldCompact,
11
11
  getCompactionTarget
12
12
  };
13
- //# sourceMappingURL=chunk-RI6GAMNP.js.map
13
+ //# sourceMappingURL=chunk-NZCKCJH5.js.map