openfox 1.6.79 → 1.6.80

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.
@@ -2,17 +2,17 @@ import {
2
2
  maybeAutoCompactContext,
3
3
  performManualContextCompaction,
4
4
  resolveCompactionStatsIdentity
5
- } from "./chunk-UCZSBKG7.js";
5
+ } from "./chunk-7DOKXSMI.js";
6
6
  import "./chunk-OXI26S7U.js";
7
7
  import "./chunk-CMQCO27Y.js";
8
8
  import "./chunk-DL6ZILAF.js";
9
9
  import "./chunk-PBGOZMVY.js";
10
10
  import "./chunk-VRGRAQDG.js";
11
11
  import "./chunk-CUDAT6SS.js";
12
- import "./chunk-RJRG2VER.js";
12
+ import "./chunk-LHKXWUEK.js";
13
13
  import "./chunk-KIOUKC3Z.js";
14
14
  import "./chunk-TS5XFQ2D.js";
15
- import "./chunk-STYHKCG7.js";
15
+ import "./chunk-UF6D2IPO.js";
16
16
  import "./chunk-BJYPTN5S.js";
17
17
  import "./chunk-NDJ6FKSP.js";
18
18
  import "./chunk-CQGTEGKL.js";
@@ -24,4 +24,4 @@ export {
24
24
  performManualContextCompaction,
25
25
  resolveCompactionStatsIdentity
26
26
  };
27
- //# sourceMappingURL=auto-compaction-KTA6H4HP.js.map
27
+ //# sourceMappingURL=auto-compaction-Q3GRX7T5.js.map
@@ -5,11 +5,11 @@ import {
5
5
  generateSessionName,
6
6
  getSessionMessageCount,
7
7
  needsNameGenerationCheck
8
- } from "./chunk-2IZMUXMP.js";
8
+ } from "./chunk-A5W6JUYZ.js";
9
9
  import {
10
10
  runChatTurn
11
- } from "./chunk-BG7QCFGG.js";
12
- import "./chunk-UCZSBKG7.js";
11
+ } from "./chunk-HPTMW2FT.js";
12
+ import "./chunk-7DOKXSMI.js";
13
13
  import "./chunk-OXI26S7U.js";
14
14
  import "./chunk-CMQCO27Y.js";
15
15
  import "./chunk-DL6ZILAF.js";
@@ -18,14 +18,14 @@ import "./chunk-VRGRAQDG.js";
18
18
  import "./chunk-CUDAT6SS.js";
19
19
  import {
20
20
  getEventStore
21
- } from "./chunk-RJRG2VER.js";
21
+ } from "./chunk-LHKXWUEK.js";
22
22
  import "./chunk-KIOUKC3Z.js";
23
23
  import "./chunk-TS5XFQ2D.js";
24
24
  import {
25
25
  createChatMessageMessage,
26
26
  createPhaseChangedMessage,
27
27
  createSessionRunningMessage
28
- } from "./chunk-STYHKCG7.js";
28
+ } from "./chunk-UF6D2IPO.js";
29
29
  import "./chunk-BJYPTN5S.js";
30
30
  import "./chunk-NDJ6FKSP.js";
31
31
  import "./chunk-CQGTEGKL.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-KTA6H4HP.js");
64
+ const { maybeAutoCompactContext } = await import("./auto-compaction-Q3GRX7T5.js");
65
65
  await maybeAutoCompactContext({
66
66
  sessionManager,
67
67
  sessionId,
@@ -113,8 +113,11 @@ async function startChatSession(sessionId, content, deps, options) {
113
113
  if (activeAgents.get(sessionId) === controller) {
114
114
  activeAgents.delete(sessionId);
115
115
  }
116
- sessionManager.setRunning(sessionId, false);
117
- broadcastForSession(sessionId, createSessionRunningMessage(false));
116
+ try {
117
+ sessionManager.setRunning(sessionId, false);
118
+ broadcastForSession(sessionId, createSessionRunningMessage(false));
119
+ } catch {
120
+ }
118
121
  finalizeTurnCompletion(sessionId, sessionManager, broadcastForSession);
119
122
  throw error;
120
123
  }
@@ -172,4 +175,4 @@ export {
172
175
  startChatSession,
173
176
  stopSessionExecution
174
177
  };
175
- //# sourceMappingURL=chat-handler-EKAO6CIB.js.map
178
+ //# sourceMappingURL=chat-handler-PO5OBBJE.js.map
@@ -32,7 +32,7 @@ import {
32
32
  import {
33
33
  getCurrentContextWindowId,
34
34
  getEventStore
35
- } from "./chunk-RJRG2VER.js";
35
+ } from "./chunk-LHKXWUEK.js";
36
36
  import {
37
37
  buildContextMessagesFromEventHistory,
38
38
  foldContextState,
@@ -50,7 +50,7 @@ import {
50
50
  createChatToolOutputMessage,
51
51
  createChatVisionFallbackMessage,
52
52
  createQueueStateMessage
53
- } from "./chunk-STYHKCG7.js";
53
+ } from "./chunk-UF6D2IPO.js";
54
54
  import {
55
55
  AskUserInterrupt,
56
56
  askUserTool
@@ -2946,12 +2946,17 @@ async function executeToolBatch(assistantMsgId, toolCalls, ctx) {
2946
2946
  let criteriaChanged = false;
2947
2947
  let returnValueContent;
2948
2948
  let returnValueResult;
2949
- let session = ctx.sessionManager.requireSession(ctx.sessionId);
2949
+ const session = ctx.sessionManager.requireSession(ctx.sessionId);
2950
+ if (ctx.signal?.aborted) {
2951
+ throw new Error("Aborted");
2952
+ }
2950
2953
  for (const toolCall of toolCalls) {
2954
+ eventStore.append(ctx.sessionId, createToolCallEvent(assistantMsgId, toolCall));
2955
+ }
2956
+ const executeTool = async (toolCall, index) => {
2951
2957
  if (ctx.signal?.aborted) {
2952
2958
  throw new Error("Aborted");
2953
2959
  }
2954
- eventStore.append(ctx.sessionId, createToolCallEvent(assistantMsgId, toolCall));
2955
2960
  if (toolCall.parseError) {
2956
2961
  const toolResult2 = {
2957
2962
  success: false,
@@ -2961,13 +2966,12 @@ async function executeToolBatch(assistantMsgId, toolCalls, ctx) {
2961
2966
  };
2962
2967
  ctx.turnMetrics.addToolTime(toolResult2.durationMs);
2963
2968
  eventStore.append(ctx.sessionId, createToolResultEvent(assistantMsgId, toolCall.id, toolResult2));
2964
- toolMessages.push({
2965
- role: "tool",
2969
+ return {
2970
+ toolCall,
2971
+ toolResult: toolResult2,
2966
2972
  content: `Error: ${toolResult2.error}`,
2967
- source: "history",
2968
- toolCallId: toolCall.id
2969
- });
2970
- continue;
2973
+ index
2974
+ };
2971
2975
  }
2972
2976
  const onProgress = ctx.onMessage ? createToolProgressHandler(assistantMsgId, toolCall.id, ctx.onMessage) : void 0;
2973
2977
  const toolContext = {
@@ -3024,22 +3028,32 @@ async function executeToolBatch(assistantMsgId, toolCalls, ctx) {
3024
3028
  returnValueContent = toolCall.arguments["content"];
3025
3029
  returnValueResult = toolCall.arguments["result"];
3026
3030
  }
3027
- toolMessages.push({
3028
- role: "tool",
3029
- content: stripAnsi(
3030
- toolResult.success ? toolResult.output ?? "Success" : toolResult.output ? `${toolResult.output}
3031
+ const content = stripAnsi(
3032
+ toolResult.success ? toolResult.output ?? "Success" : toolResult.output ? `${toolResult.output}
3031
3033
 
3032
3034
  Error: ${toolResult.error}` : `Error: ${toolResult.error}`
3033
- ),
3035
+ );
3036
+ return {
3037
+ toolCall,
3038
+ toolResult,
3039
+ content,
3040
+ index
3041
+ };
3042
+ };
3043
+ const executionPromises = toolCalls.map((toolCall, index) => executeTool(toolCall, index));
3044
+ const results = await Promise.all(executionPromises);
3045
+ for (const result of results) {
3046
+ toolMessages.push({
3047
+ role: "tool",
3048
+ content: result.content,
3034
3049
  source: "history",
3035
- toolCallId: toolCall.id
3050
+ toolCallId: result.toolCall.id
3036
3051
  });
3037
- const updatedSession = ctx.sessionManager.requireSession(ctx.sessionId);
3038
- if (JSON.stringify(updatedSession.criteria) !== JSON.stringify(session.criteria)) {
3039
- eventStore.append(ctx.sessionId, { type: "criteria.set", data: { criteria: updatedSession.criteria } });
3040
- session = updatedSession;
3041
- criteriaChanged = true;
3042
- }
3052
+ }
3053
+ const updatedSession = ctx.sessionManager.requireSession(ctx.sessionId);
3054
+ if (JSON.stringify(updatedSession.criteria) !== JSON.stringify(session.criteria)) {
3055
+ eventStore.append(ctx.sessionId, { type: "criteria.set", data: { criteria: updatedSession.criteria } });
3056
+ criteriaChanged = true;
3043
3057
  }
3044
3058
  return { toolMessages, criteriaChanged, returnValueContent, returnValueResult };
3045
3059
  }
@@ -3684,7 +3698,7 @@ var callSubAgentTool = {
3684
3698
  };
3685
3699
  }
3686
3700
  try {
3687
- const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-W6OPDFQV.js");
3701
+ const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-B4KSCOWC.js");
3688
3702
  const toolRegistry = getToolRegistryForAgent2(agentDef);
3689
3703
  const turnMetrics = new TurnMetrics();
3690
3704
  const result = await executeSubAgent({
@@ -4873,4 +4887,4 @@ export {
4873
4887
  getToolRegistryForAgent,
4874
4888
  createToolRegistry
4875
4889
  };
4876
- //# sourceMappingURL=chunk-UCZSBKG7.js.map
4890
+ //# sourceMappingURL=chunk-7DOKXSMI.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getEventStore,
3
3
  updateSessionMetadata
4
- } from "./chunk-RJRG2VER.js";
4
+ } from "./chunk-LHKXWUEK.js";
5
5
  import {
6
6
  buildMessagesFromStoredEvents,
7
7
  foldPendingConfirmations
@@ -9,7 +9,7 @@ import {
9
9
  import {
10
10
  createContextStateMessage,
11
11
  createSessionStateMessage
12
- } from "./chunk-STYHKCG7.js";
12
+ } from "./chunk-UF6D2IPO.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-2IZMUXMP.js.map
146
+ //# sourceMappingURL=chunk-A5W6JUYZ.js.map
@@ -190,7 +190,7 @@ async function runCli(options) {
190
190
  if (!configExists) {
191
191
  await runNetworkSetup(mode);
192
192
  }
193
- const { runServe } = await import("./serve-55GF3KJW.js");
193
+ const { runServe } = await import("./serve-U5FU7YWD.js");
194
194
  const serveOptions = { mode };
195
195
  if (values.port) serveOptions.port = parseInt(values.port);
196
196
  if (values["no-browser"] === true) serveOptions.openBrowser = false;
@@ -202,4 +202,4 @@ async function runCli(options) {
202
202
  export {
203
203
  runCli
204
204
  };
205
- //# sourceMappingURL=chunk-HOD7GVQ5.js.map
205
+ //# sourceMappingURL=chunk-GFLXCEZA.js.map
@@ -13,11 +13,11 @@ import {
13
13
  getToolRegistryForAgent,
14
14
  loadAllAgentsDefault,
15
15
  runTopLevelAgentLoop
16
- } from "./chunk-UCZSBKG7.js";
16
+ } from "./chunk-7DOKXSMI.js";
17
17
  import {
18
18
  getCurrentContextWindowId,
19
19
  getEventStore
20
- } from "./chunk-RJRG2VER.js";
20
+ } from "./chunk-LHKXWUEK.js";
21
21
  import {
22
22
  buildSnapshotFromSessionState
23
23
  } from "./chunk-TS5XFQ2D.js";
@@ -327,4 +327,4 @@ export {
327
327
  runBuilderTurn,
328
328
  runVerifierTurn
329
329
  };
330
- //# sourceMappingURL=chunk-BG7QCFGG.js.map
330
+ //# sourceMappingURL=chunk-HPTMW2FT.js.map
@@ -452,6 +452,12 @@ var EventStore = class {
452
452
  return transaction();
453
453
  } catch (error) {
454
454
  const err = error instanceof Error ? error : new Error(String(error));
455
+ const errnoError = error;
456
+ const isFkError = errnoError.code === "SQLITE_CONSTRAINT_FOREIGNKEY";
457
+ if (isFkError || err.message.includes("FOREIGN KEY constraint failed")) {
458
+ logger.debug("Session no longer exists during consolidation", { sessionId });
459
+ return null;
460
+ }
455
461
  logger.error("Failed to consolidate session", { sessionId, error: err.message, stack: err.stack });
456
462
  return null;
457
463
  }
@@ -1252,4 +1258,4 @@ export {
1252
1258
  compactContext,
1253
1259
  getRecentUserPromptsForSession
1254
1260
  };
1255
- //# sourceMappingURL=chunk-RJRG2VER.js.map
1261
+ //# sourceMappingURL=chunk-LHKXWUEK.js.map
@@ -226,6 +226,30 @@ function storedEventToServerMessage(event) {
226
226
  const data = event.data;
227
227
  return createServerMessage("task.completed", data);
228
228
  }
229
+ case "session.initialized": {
230
+ const data = event.data;
231
+ const session = {
232
+ id: event.sessionId,
233
+ projectId: data.projectId,
234
+ workdir: data.workdir,
235
+ mode: "planner",
236
+ phase: "plan",
237
+ isRunning: false,
238
+ criteria: [],
239
+ summary: data.title || "Untitled Session",
240
+ metadata: {
241
+ totalTokensUsed: 0,
242
+ totalToolCalls: 0,
243
+ iterationCount: 0
244
+ },
245
+ createdAt: new Date(event.timestamp).toISOString(),
246
+ updatedAt: new Date(event.timestamp).toISOString(),
247
+ messages: [],
248
+ contextWindows: [],
249
+ executionState: null
250
+ };
251
+ return createSessionStateMessage(session, [], []);
252
+ }
229
253
  case "mode.changed": {
230
254
  const data = event.data;
231
255
  return createModeChangedMessage(data.mode, data.auto, data.reason);
@@ -319,4 +343,4 @@ export {
319
343
  createQueueStateMessage,
320
344
  storedEventToServerMessage
321
345
  };
322
- //# sourceMappingURL=chunk-STYHKCG7.js.map
346
+ //# sourceMappingURL=chunk-UF6D2IPO.js.map