openfox 2.0.49 → 2.0.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chat-handler-PLRNAAXW.js → chat-handler-K7M5ZPLO.js} +6 -6
- package/dist/{chunk-PTIF5OEJ.js → chunk-4Y7WWB55.js} +4 -4
- package/dist/{chunk-U62IKLKM.js → chunk-7OJTTOZ7.js} +3 -3
- package/dist/{chunk-GTY27MWS.js → chunk-AE5Q2JXO.js} +10 -8
- package/dist/{chunk-LB3E24TN.js → chunk-AIJE3RYH.js} +2 -2
- package/dist/{chunk-2DKFKTLY.js → chunk-KFO535IO.js} +2 -2
- package/dist/{chunk-Z3TD43AO.js → chunk-KS25ZHG3.js} +49 -34
- package/dist/{chunk-CZPX6AVB.js → chunk-PSFMSGCC.js} +22 -5
- package/dist/{chunk-EHYFYQXY.js → chunk-TMUBLQFC.js} +35 -1
- package/dist/{chunk-JMQJIU64.js → chunk-ZUADUO54.js} +2 -2
- package/dist/cli/dev.js +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/{compactor-VIN5YWQF.js → compactor-7OGA6OYM.js} +4 -4
- package/dist/{events-S4EOKSYA.js → events-52XADT6Y.js} +3 -3
- package/dist/{folding-H5C6HS7O.js → folding-2BGFLV5J.js} +4 -2
- package/dist/{orchestrator-YOAWKIB2.js → orchestrator-5BXIY2F7.js} +5 -5
- package/dist/package.json +1 -1
- package/dist/{processor-U35UWS3W.js → processor-L4XHWQUH.js} +6 -6
- package/dist/{serve-USAKHQQN.js → serve-4D5N2R35.js} +8 -8
- package/dist/server/index.js +7 -7
- package/dist/{server-7XS77JZD.js → server-UB2YTFXP.js} +7 -7
- package/dist/{tools-CSRQDWRI.js → tools-AALOAXXT.js} +4 -4
- package/dist/web/assets/{index-GFd2V-Ja.css → index-BfYemJAQ.css} +1 -1
- package/dist/web/assets/{index-C4UaPDjy.js → index-DMYJNpQV.js} +57 -57
- package/dist/web/index.html +2 -2
- package/dist/web/sw.js +1 -1
- package/package.json +1 -1
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
buildRunChatTurnParams,
|
|
3
3
|
finalizeTurnCompletion,
|
|
4
4
|
generateSessionNameForSession
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-7OJTTOZ7.js";
|
|
6
6
|
import {
|
|
7
7
|
runChatTurn
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-4Y7WWB55.js";
|
|
9
|
+
import "./chunk-AE5Q2JXO.js";
|
|
10
10
|
import "./chunk-LBGHZLLH.js";
|
|
11
11
|
import "./chunk-PBGOZMVY.js";
|
|
12
12
|
import "./chunk-VRGRAQDG.js";
|
|
@@ -22,8 +22,8 @@ import "./chunk-YQ3SOPBI.js";
|
|
|
22
22
|
import "./chunk-55RWNJBT.js";
|
|
23
23
|
import {
|
|
24
24
|
getEventStore
|
|
25
|
-
} from "./chunk-
|
|
26
|
-
import "./chunk-
|
|
25
|
+
} from "./chunk-AIJE3RYH.js";
|
|
26
|
+
import "./chunk-TMUBLQFC.js";
|
|
27
27
|
import "./chunk-ZPIZLTWU.js";
|
|
28
28
|
import "./chunk-J2GP3J3X.js";
|
|
29
29
|
import "./chunk-Z4FMBCJO.js";
|
|
@@ -154,4 +154,4 @@ export {
|
|
|
154
154
|
startChatSession,
|
|
155
155
|
stopSessionExecution
|
|
156
156
|
};
|
|
157
|
-
//# sourceMappingURL=chat-handler-
|
|
157
|
+
//# sourceMappingURL=chat-handler-K7M5ZPLO.js.map
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
loadAllAgentsDefault,
|
|
13
13
|
processEventsForConversation,
|
|
14
14
|
runTopLevelAgentLoop
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-AE5Q2JXO.js";
|
|
16
16
|
import {
|
|
17
17
|
TurnMetrics,
|
|
18
18
|
WORKFLOW_KICKOFF_PROMPT,
|
|
@@ -26,10 +26,10 @@ import {
|
|
|
26
26
|
getCurrentWindowMessageOptions,
|
|
27
27
|
getEventStore,
|
|
28
28
|
getRuntimeConfig
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-AIJE3RYH.js";
|
|
30
30
|
import {
|
|
31
31
|
buildSnapshotFromSessionState
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-TMUBLQFC.js";
|
|
33
33
|
import {
|
|
34
34
|
logger
|
|
35
35
|
} from "./chunk-K44MW7JJ.js";
|
|
@@ -324,4 +324,4 @@ export {
|
|
|
324
324
|
runAgentTurn,
|
|
325
325
|
injectWorkflowKickoffIfNeeded
|
|
326
326
|
};
|
|
327
|
-
//# sourceMappingURL=chunk-
|
|
327
|
+
//# sourceMappingURL=chunk-4Y7WWB55.js.map
|
|
@@ -9,11 +9,11 @@ import {
|
|
|
9
9
|
getEventStore,
|
|
10
10
|
getRuntimeConfig,
|
|
11
11
|
updateSessionMetadata
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-AIJE3RYH.js";
|
|
13
13
|
import {
|
|
14
14
|
buildMessagesFromStoredEvents,
|
|
15
15
|
foldPendingConfirmations
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-TMUBLQFC.js";
|
|
17
17
|
import {
|
|
18
18
|
logger
|
|
19
19
|
} from "./chunk-K44MW7JJ.js";
|
|
@@ -180,4 +180,4 @@ export {
|
|
|
180
180
|
buildRunChatTurnParams,
|
|
181
181
|
generateSessionNameForSession
|
|
182
182
|
};
|
|
183
|
-
//# sourceMappingURL=chunk-
|
|
183
|
+
//# sourceMappingURL=chunk-7OJTTOZ7.js.map
|
|
@@ -55,7 +55,7 @@ import {
|
|
|
55
55
|
getCurrentWindowMessageOptions,
|
|
56
56
|
getEventStore,
|
|
57
57
|
getRuntimeConfig
|
|
58
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-AIJE3RYH.js";
|
|
59
59
|
import {
|
|
60
60
|
buildContextMessagesFromEventHistory,
|
|
61
61
|
foldContextState,
|
|
@@ -63,8 +63,9 @@ import {
|
|
|
63
63
|
handleMessageThinking,
|
|
64
64
|
handleToolCall,
|
|
65
65
|
handleToolResult,
|
|
66
|
+
reorderToolMessages,
|
|
66
67
|
stripOrphanedToolCalls
|
|
67
|
-
} from "./chunk-
|
|
68
|
+
} from "./chunk-TMUBLQFC.js";
|
|
68
69
|
import {
|
|
69
70
|
logger
|
|
70
71
|
} from "./chunk-K44MW7JJ.js";
|
|
@@ -2608,7 +2609,7 @@ ${CONTINUE_PROMPT}` : CONTINUE_PROMPT;
|
|
|
2608
2609
|
sessionManager.setCurrentContextSize(sessionId, result.usage.promptTokens);
|
|
2609
2610
|
if (!compacting) {
|
|
2610
2611
|
const contextState2 = sessionManager.getContextState(sessionId);
|
|
2611
|
-
const { shouldCompact, appendCompactionPrompt } = await import("./compactor-
|
|
2612
|
+
const { shouldCompact, appendCompactionPrompt } = await import("./compactor-7OGA6OYM.js");
|
|
2612
2613
|
if (shouldCompact(contextState2.currentTokens, contextState2.maxTokens, runtimeConfig.context.compactionThreshold)) {
|
|
2613
2614
|
appendCompactionPrompt(sessionId, append);
|
|
2614
2615
|
compacting = true;
|
|
@@ -3235,6 +3236,7 @@ function buildSubAgentContextMessages(events, scope) {
|
|
|
3235
3236
|
}
|
|
3236
3237
|
}
|
|
3237
3238
|
stripOrphanedToolCalls(messages, fulfilledToolCallIds);
|
|
3239
|
+
reorderToolMessages(messages);
|
|
3238
3240
|
return messages.map(
|
|
3239
3241
|
({ id: _id, subAgentId: _sa, subAgentType: _st, contextWindowId: _cw, isCompactionSummary: _ics, ...rest }) => {
|
|
3240
3242
|
const ctx = {
|
|
@@ -3479,7 +3481,7 @@ var callSubAgentTool = {
|
|
|
3479
3481
|
};
|
|
3480
3482
|
}
|
|
3481
3483
|
try {
|
|
3482
|
-
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-
|
|
3484
|
+
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-AALOAXXT.js");
|
|
3483
3485
|
const toolRegistry = getToolRegistryForAgent2(agentDef);
|
|
3484
3486
|
const turnMetrics = new TurnMetrics();
|
|
3485
3487
|
const result = await executeSubAgent({
|
|
@@ -4295,7 +4297,7 @@ function resolveAgentDef2(sessionManager, sessionId) {
|
|
|
4295
4297
|
}
|
|
4296
4298
|
async function buildCachedPrompt(sessionManager, sessionId, agentDef) {
|
|
4297
4299
|
const { instructionContent, skills } = await loadSessionContext(sessionManager, sessionId);
|
|
4298
|
-
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-
|
|
4300
|
+
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-AALOAXXT.js");
|
|
4299
4301
|
const tools = getToolRegistryForAgent2(agentDef).definitions;
|
|
4300
4302
|
const toolFingerprint = getToolFingerprint(tools);
|
|
4301
4303
|
const allAgents = await loadAllAgentsDefault();
|
|
@@ -4308,7 +4310,7 @@ async function buildCachedPrompt(sessionManager, sessionId, agentDef) {
|
|
|
4308
4310
|
async function computeSessionHash(sessionManager, sessionId) {
|
|
4309
4311
|
const { instructionContent, skills } = await loadSessionContext(sessionManager, sessionId);
|
|
4310
4312
|
const agentDef = await resolveAgentDef2(sessionManager, sessionId);
|
|
4311
|
-
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-
|
|
4313
|
+
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-AALOAXXT.js");
|
|
4312
4314
|
const tools = getToolRegistryForAgent2(agentDef).definitions;
|
|
4313
4315
|
const toolFingerprint = getToolFingerprint(tools);
|
|
4314
4316
|
return computeDynamicContextHash(instructionContent, skills, toolFingerprint);
|
|
@@ -4415,7 +4417,7 @@ var mcpConfigTool = createTool(
|
|
|
4415
4417
|
await saveGlobalConfig(mcpConfigMode, { ...globalConfig, mcpServers: updated });
|
|
4416
4418
|
}
|
|
4417
4419
|
async function rebuildTools() {
|
|
4418
|
-
const { setMcpTools: setMcpTools2 } = await import("./tools-
|
|
4420
|
+
const { setMcpTools: setMcpTools2 } = await import("./tools-AALOAXXT.js");
|
|
4419
4421
|
const mcpTools = createMcpTools(mcpManagerForTools);
|
|
4420
4422
|
setMcpTools2(mcpTools);
|
|
4421
4423
|
}
|
|
@@ -5085,4 +5087,4 @@ export {
|
|
|
5085
5087
|
getToolRegistryForAgent,
|
|
5086
5088
|
createToolRegistry
|
|
5087
5089
|
};
|
|
5088
|
-
//# sourceMappingURL=chunk-
|
|
5090
|
+
//# sourceMappingURL=chunk-AE5Q2JXO.js.map
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
foldContextState,
|
|
6
6
|
foldSessionState,
|
|
7
7
|
spreadOptionalMessageFields
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-TMUBLQFC.js";
|
|
9
9
|
import {
|
|
10
10
|
getDatabase
|
|
11
11
|
} from "./chunk-ZPIZLTWU.js";
|
|
@@ -1434,4 +1434,4 @@ export {
|
|
|
1434
1434
|
truncateSessionMessages,
|
|
1435
1435
|
getRecentUserPromptsForSession
|
|
1436
1436
|
};
|
|
1437
|
-
//# sourceMappingURL=chunk-
|
|
1437
|
+
//# sourceMappingURL=chunk-AIJE3RYH.js.map
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-55RWNJBT.js";
|
|
5
5
|
import {
|
|
6
6
|
getCurrentWindowMessageOptions
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-AIJE3RYH.js";
|
|
8
8
|
|
|
9
9
|
// src/server/context/compactor.ts
|
|
10
10
|
function appendCompactionPrompt(sessionId, append) {
|
|
@@ -31,4 +31,4 @@ export {
|
|
|
31
31
|
shouldCompact,
|
|
32
32
|
getCompactionTarget
|
|
33
33
|
};
|
|
34
|
-
//# sourceMappingURL=chunk-
|
|
34
|
+
//# sourceMappingURL=chunk-KFO535IO.js.map
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
tokenFromPassword,
|
|
22
22
|
verifyPassword,
|
|
23
23
|
workflowExists
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-PSFMSGCC.js";
|
|
25
25
|
import {
|
|
26
26
|
agentExists,
|
|
27
27
|
createToolRegistry,
|
|
@@ -61,7 +61,7 @@ import {
|
|
|
61
61
|
setMcpTools,
|
|
62
62
|
setNotifyMcpServersChanged,
|
|
63
63
|
skillExists
|
|
64
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-AE5Q2JXO.js";
|
|
65
65
|
import {
|
|
66
66
|
getPathSeparator,
|
|
67
67
|
isAbsolutePath
|
|
@@ -109,7 +109,7 @@ import {
|
|
|
109
109
|
updateSessionMetadata,
|
|
110
110
|
updateSessionProvider,
|
|
111
111
|
updateSessionRunning
|
|
112
|
-
} from "./chunk-
|
|
112
|
+
} from "./chunk-AIJE3RYH.js";
|
|
113
113
|
import {
|
|
114
114
|
initDatabase
|
|
115
115
|
} from "./chunk-ZPIZLTWU.js";
|
|
@@ -3849,7 +3849,7 @@ import { Router as Router7 } from "express";
|
|
|
3849
3849
|
import { spawn as spawn2 } from "child_process";
|
|
3850
3850
|
|
|
3851
3851
|
// src/constants.ts
|
|
3852
|
-
var VERSION = "2.0.
|
|
3852
|
+
var VERSION = "2.0.51";
|
|
3853
3853
|
|
|
3854
3854
|
// src/server/routes/auto-update.ts
|
|
3855
3855
|
var updateInProgress = false;
|
|
@@ -4046,7 +4046,7 @@ async function createServerHandle(config4) {
|
|
|
4046
4046
|
setMcpTools(mcpTools);
|
|
4047
4047
|
logger.info("MCP tools registered", { count: mcpTools.length });
|
|
4048
4048
|
}
|
|
4049
|
-
const { signalMcpReady } = await import("./server-
|
|
4049
|
+
const { signalMcpReady } = await import("./server-UB2YTFXP.js");
|
|
4050
4050
|
signalMcpReady();
|
|
4051
4051
|
});
|
|
4052
4052
|
const app = express();
|
|
@@ -4204,7 +4204,7 @@ async function createServerHandle(config4) {
|
|
|
4204
4204
|
res.json({ project });
|
|
4205
4205
|
});
|
|
4206
4206
|
app.get("/api/sessions", async (req, res) => {
|
|
4207
|
-
const { getRecentUserPromptsForSession } = await import("./events-
|
|
4207
|
+
const { getRecentUserPromptsForSession } = await import("./events-52XADT6Y.js");
|
|
4208
4208
|
const projectId = req.query["projectId"];
|
|
4209
4209
|
const limit = Math.min(parseInt(req.query["limit"]) || 20, 100);
|
|
4210
4210
|
const offset = parseInt(req.query["offset"]) || 0;
|
|
@@ -4237,9 +4237,9 @@ async function createServerHandle(config4) {
|
|
|
4237
4237
|
res.status(201).json({ session });
|
|
4238
4238
|
});
|
|
4239
4239
|
app.get("/api/sessions/:id", async (req, res) => {
|
|
4240
|
-
const { getEventStore: getEventStore2 } = await import("./events-
|
|
4241
|
-
const { buildMessagesFromStoredEvents } = await import("./folding-
|
|
4242
|
-
const { getPendingQuestionsForSession } = await import("./tools-
|
|
4240
|
+
const { getEventStore: getEventStore2 } = await import("./events-52XADT6Y.js");
|
|
4241
|
+
const { buildMessagesFromStoredEvents } = await import("./folding-2BGFLV5J.js");
|
|
4242
|
+
const { getPendingQuestionsForSession } = await import("./tools-AALOAXXT.js");
|
|
4243
4243
|
const session = sessionManager.getSession(req.params.id);
|
|
4244
4244
|
if (!session) {
|
|
4245
4245
|
return res.status(404).json({ error: "Session not found" });
|
|
@@ -4258,8 +4258,8 @@ async function createServerHandle(config4) {
|
|
|
4258
4258
|
if (!session) {
|
|
4259
4259
|
return res.status(404).json({ error: "Session not found" });
|
|
4260
4260
|
}
|
|
4261
|
-
const { stopSessionExecution } = await import("./chat-handler-
|
|
4262
|
-
const { cancelQuestionsForSession, cancelPathConfirmationsForSession } = await import("./tools-
|
|
4261
|
+
const { stopSessionExecution } = await import("./chat-handler-K7M5ZPLO.js");
|
|
4262
|
+
const { cancelQuestionsForSession, cancelPathConfirmationsForSession } = await import("./tools-AALOAXXT.js");
|
|
4263
4263
|
sessionManager.clearMessageQueue(sessionId);
|
|
4264
4264
|
stopSessionExecution(sessionId, sessionManager);
|
|
4265
4265
|
abortSession(sessionId);
|
|
@@ -4278,8 +4278,8 @@ async function createServerHandle(config4) {
|
|
|
4278
4278
|
res.json({ success: true });
|
|
4279
4279
|
});
|
|
4280
4280
|
app.post("/api/sessions/:id/provider", async (req, res) => {
|
|
4281
|
-
const { getEventStore: getEventStore2 } = await import("./events-
|
|
4282
|
-
const { buildMessagesFromStoredEvents } = await import("./folding-
|
|
4281
|
+
const { getEventStore: getEventStore2 } = await import("./events-52XADT6Y.js");
|
|
4282
|
+
const { buildMessagesFromStoredEvents } = await import("./folding-2BGFLV5J.js");
|
|
4283
4283
|
const sessionId = req.params.id;
|
|
4284
4284
|
const session = sessionManager.getSession(sessionId);
|
|
4285
4285
|
if (!session) {
|
|
@@ -4292,11 +4292,6 @@ async function createServerHandle(config4) {
|
|
|
4292
4292
|
const provider = providerManager.getProviders().find((p) => p.id === providerId);
|
|
4293
4293
|
const resolvedModel = model ?? provider?.models?.[0]?.id ?? "auto";
|
|
4294
4294
|
sessionManager.setSessionProvider(sessionId, providerId, resolvedModel);
|
|
4295
|
-
const { loadGlobalConfig, saveGlobalConfig, setDefaultModelSelection } = await import("./config-G5GNT4UT.js");
|
|
4296
|
-
const globalConfig = await loadGlobalConfig(config4.mode ?? "production");
|
|
4297
|
-
const updatedConfig = setDefaultModelSelection(globalConfig, providerId, resolvedModel);
|
|
4298
|
-
await saveGlobalConfig(config4.mode ?? "production", updatedConfig);
|
|
4299
|
-
config4.defaultModelSelection = updatedConfig.defaultModelSelection;
|
|
4300
4295
|
const contextState = sessionManager.getContextState(sessionId);
|
|
4301
4296
|
const eventStore = getEventStore2();
|
|
4302
4297
|
const events = eventStore.getEvents(sessionId);
|
|
@@ -4304,6 +4299,26 @@ async function createServerHandle(config4) {
|
|
|
4304
4299
|
const updatedSession = sessionManager.getSession(sessionId);
|
|
4305
4300
|
res.json({ session: updatedSession, messages, contextState });
|
|
4306
4301
|
});
|
|
4302
|
+
app.post("/api/default-model", async (req, res) => {
|
|
4303
|
+
const { providerId, model } = req.body;
|
|
4304
|
+
if (!providerId || !model) {
|
|
4305
|
+
return res.status(400).json({ error: "providerId and model are required" });
|
|
4306
|
+
}
|
|
4307
|
+
const provider = providerManager.getProviders().find((p) => p.id === providerId);
|
|
4308
|
+
if (!provider) {
|
|
4309
|
+
return res.status(404).json({ error: "Provider not found" });
|
|
4310
|
+
}
|
|
4311
|
+
const result = await providerManager.setDefaultModelSelection(providerId, model);
|
|
4312
|
+
if (!result.success) {
|
|
4313
|
+
return res.status(500).json({ error: result.error ?? "Failed to set default model" });
|
|
4314
|
+
}
|
|
4315
|
+
const { loadGlobalConfig, saveGlobalConfig, setDefaultModelSelection } = await import("./config-G5GNT4UT.js");
|
|
4316
|
+
const globalConfig = await loadGlobalConfig(config4.mode ?? "production");
|
|
4317
|
+
const updatedConfig = setDefaultModelSelection(globalConfig, providerId, model);
|
|
4318
|
+
await saveGlobalConfig(config4.mode ?? "production", updatedConfig);
|
|
4319
|
+
config4.defaultModelSelection = updatedConfig.defaultModelSelection;
|
|
4320
|
+
res.json({ success: true, defaultModelSelection: config4.defaultModelSelection });
|
|
4321
|
+
});
|
|
4307
4322
|
app.put("/api/sessions/:id/criteria", async (req, res) => {
|
|
4308
4323
|
const sessionId = req.params.id;
|
|
4309
4324
|
const session = sessionManager.getSession(sessionId);
|
|
@@ -4341,8 +4356,8 @@ async function createServerHandle(config4) {
|
|
|
4341
4356
|
res.json({ success: true });
|
|
4342
4357
|
});
|
|
4343
4358
|
app.put("/api/sessions/:id/mode", async (req, res) => {
|
|
4344
|
-
const { getEventStore: getEventStore2 } = await import("./events-
|
|
4345
|
-
const { buildMessagesFromStoredEvents } = await import("./folding-
|
|
4359
|
+
const { getEventStore: getEventStore2 } = await import("./events-52XADT6Y.js");
|
|
4360
|
+
const { buildMessagesFromStoredEvents } = await import("./folding-2BGFLV5J.js");
|
|
4346
4361
|
const sessionId = req.params.id;
|
|
4347
4362
|
const session = sessionManager.getSession(sessionId);
|
|
4348
4363
|
if (!session) {
|
|
@@ -4398,15 +4413,15 @@ async function createServerHandle(config4) {
|
|
|
4398
4413
|
if (!callId || approved === void 0) {
|
|
4399
4414
|
return res.status(400).json({ error: "callId and approved are required" });
|
|
4400
4415
|
}
|
|
4401
|
-
const { providePathConfirmation } = await import("./tools-
|
|
4416
|
+
const { providePathConfirmation } = await import("./tools-AALOAXXT.js");
|
|
4402
4417
|
const result = providePathConfirmation(callId, approved, alwaysAllow);
|
|
4403
4418
|
if (!result.found) {
|
|
4404
4419
|
return res.status(404).json({ error: "No pending path confirmation with that ID" });
|
|
4405
4420
|
}
|
|
4406
|
-
const { getEventStore: getEventStore2 } = await import("./events-
|
|
4407
|
-
const { buildMessagesFromStoredEvents, foldPendingConfirmations } = await import("./folding-
|
|
4421
|
+
const { getEventStore: getEventStore2 } = await import("./events-52XADT6Y.js");
|
|
4422
|
+
const { buildMessagesFromStoredEvents, foldPendingConfirmations } = await import("./folding-2BGFLV5J.js");
|
|
4408
4423
|
const { createSessionStateMessage } = await import("./protocol-CTNE3ANP.js");
|
|
4409
|
-
const { getPendingQuestionsForSession } = await import("./tools-
|
|
4424
|
+
const { getPendingQuestionsForSession } = await import("./tools-AALOAXXT.js");
|
|
4410
4425
|
const eventStore = getEventStore2();
|
|
4411
4426
|
const events = eventStore.getEvents(sessionId);
|
|
4412
4427
|
const messages = buildMessagesFromStoredEvents(events);
|
|
@@ -4427,7 +4442,7 @@ async function createServerHandle(config4) {
|
|
|
4427
4442
|
if (!skip && typeof answer !== "string") {
|
|
4428
4443
|
return res.status(400).json({ error: "answer is required when not skipping" });
|
|
4429
4444
|
}
|
|
4430
|
-
const { provideAnswer } = await import("./tools-
|
|
4445
|
+
const { provideAnswer } = await import("./tools-AALOAXXT.js");
|
|
4431
4446
|
const found = provideAnswer(callId, answer ?? "", skip ?? false);
|
|
4432
4447
|
if (!found) {
|
|
4433
4448
|
return res.status(404).json({ error: "No pending question with that ID" });
|
|
@@ -4463,7 +4478,7 @@ async function createServerHandle(config4) {
|
|
|
4463
4478
|
if (sessionManager.isWarmedUp(sessionId)) {
|
|
4464
4479
|
return res.json({ success: false, reason: "already_warmed" });
|
|
4465
4480
|
}
|
|
4466
|
-
const { runAgentTurn, TurnMetrics } = await import("./orchestrator-
|
|
4481
|
+
const { runAgentTurn, TurnMetrics } = await import("./orchestrator-5BXIY2F7.js");
|
|
4467
4482
|
runAgentTurn(
|
|
4468
4483
|
{
|
|
4469
4484
|
sessionManager,
|
|
@@ -4506,15 +4521,15 @@ async function createServerHandle(config4) {
|
|
|
4506
4521
|
if (!session) {
|
|
4507
4522
|
return res.status(404).json({ error: "Session not found" });
|
|
4508
4523
|
}
|
|
4509
|
-
const { stopSessionExecution } = await import("./chat-handler-
|
|
4510
|
-
const { cancelQuestionsForSession, cancelPathConfirmationsForSession } = await import("./tools-
|
|
4524
|
+
const { stopSessionExecution } = await import("./chat-handler-K7M5ZPLO.js");
|
|
4525
|
+
const { cancelQuestionsForSession, cancelPathConfirmationsForSession } = await import("./tools-AALOAXXT.js");
|
|
4511
4526
|
const queuedMessages = sessionManager.getQueueState(sessionId);
|
|
4512
4527
|
sessionManager.clearMessageQueue(sessionId);
|
|
4513
4528
|
stopSessionExecution(sessionId, sessionManager);
|
|
4514
4529
|
abortSession(sessionId);
|
|
4515
4530
|
cancelQuestionsForSession(sessionId, "Session stopped by user");
|
|
4516
4531
|
cancelPathConfirmationsForSession(sessionId, "Session stopped by user");
|
|
4517
|
-
const eventStore = (await import("./events-
|
|
4532
|
+
const eventStore = (await import("./events-52XADT6Y.js")).getEventStore();
|
|
4518
4533
|
eventStore.append(sessionId, { type: "running.changed", data: { isRunning: false } });
|
|
4519
4534
|
res.json({ success: true, queuedMessages });
|
|
4520
4535
|
});
|
|
@@ -4528,7 +4543,7 @@ async function createServerHandle(config4) {
|
|
|
4528
4543
|
if (typeof messageIndex !== "number" || messageIndex < 0) {
|
|
4529
4544
|
return res.status(400).json({ error: "messageIndex must be a non-negative number" });
|
|
4530
4545
|
}
|
|
4531
|
-
const { truncateSessionMessages } = await import("./events-
|
|
4546
|
+
const { truncateSessionMessages } = await import("./events-52XADT6Y.js");
|
|
4532
4547
|
truncateSessionMessages(sessionId, messageIndex);
|
|
4533
4548
|
res.json({ success: true });
|
|
4534
4549
|
});
|
|
@@ -4546,7 +4561,7 @@ async function createServerHandle(config4) {
|
|
|
4546
4561
|
if (!msg) {
|
|
4547
4562
|
return res.status(400).json({ error: "Message not found at this index" });
|
|
4548
4563
|
}
|
|
4549
|
-
const { truncateSessionMessages } = await import("./events-
|
|
4564
|
+
const { truncateSessionMessages } = await import("./events-52XADT6Y.js");
|
|
4550
4565
|
truncateSessionMessages(sessionId, messageIndex - 1);
|
|
4551
4566
|
sessionManager.queueMessage(sessionId, "asap", msg.content, msg.attachments, msg.messageKind);
|
|
4552
4567
|
res.json({ success: true });
|
|
@@ -5003,7 +5018,7 @@ async function createServerHandle(config4) {
|
|
|
5003
5018
|
});
|
|
5004
5019
|
async function rebuildMcpTools() {
|
|
5005
5020
|
const { createMcpTools: createMcpTools2 } = await import("./tool-adapter-MOGEI6TP.js");
|
|
5006
|
-
const { setMcpTools: setMcpTools2 } = await import("./tools-
|
|
5021
|
+
const { setMcpTools: setMcpTools2 } = await import("./tools-AALOAXXT.js");
|
|
5007
5022
|
const mcpTools = createMcpTools2(mcpManager);
|
|
5008
5023
|
setMcpTools2(mcpTools);
|
|
5009
5024
|
}
|
|
@@ -5311,7 +5326,7 @@ async function createServerHandle(config4) {
|
|
|
5311
5326
|
const state = sessionManager.getContextState(sessionId);
|
|
5312
5327
|
wssExports.broadcastForSession(sessionId, createContextStateMessage(state));
|
|
5313
5328
|
});
|
|
5314
|
-
const { QueueProcessor } = await import("./processor-
|
|
5329
|
+
const { QueueProcessor } = await import("./processor-L4XHWQUH.js");
|
|
5315
5330
|
const queueProcessor = new QueueProcessor({
|
|
5316
5331
|
sessionManager,
|
|
5317
5332
|
providerManager,
|
|
@@ -5386,4 +5401,4 @@ export {
|
|
|
5386
5401
|
createServerHandle,
|
|
5387
5402
|
createServer
|
|
5388
5403
|
};
|
|
5389
|
-
//# sourceMappingURL=chunk-
|
|
5404
|
+
//# sourceMappingURL=chunk-KS25ZHG3.js.map
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
injectWorkflowKickoffIfNeeded,
|
|
3
3
|
runAgentTurn,
|
|
4
4
|
runChatTurn
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-4Y7WWB55.js";
|
|
6
6
|
import {
|
|
7
7
|
applyDynamicContext,
|
|
8
8
|
checkAborted,
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
loadAllAgentsDefault,
|
|
17
17
|
saveItemToDir,
|
|
18
18
|
spawnShellProcess
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-AE5Q2JXO.js";
|
|
20
20
|
import {
|
|
21
21
|
getPlatformShell,
|
|
22
22
|
onProcessEvent
|
|
@@ -40,7 +40,7 @@ import {
|
|
|
40
40
|
} from "./chunk-EU3WWTFH.js";
|
|
41
41
|
import {
|
|
42
42
|
appendCompactionPrompt
|
|
43
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-KFO535IO.js";
|
|
44
44
|
import {
|
|
45
45
|
TurnMetrics,
|
|
46
46
|
createMessageStartEvent
|
|
@@ -49,7 +49,7 @@ import {
|
|
|
49
49
|
getCurrentContextWindowId,
|
|
50
50
|
getEventStore,
|
|
51
51
|
getRuntimeConfig
|
|
52
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-AIJE3RYH.js";
|
|
53
53
|
import {
|
|
54
54
|
createLLMClient
|
|
55
55
|
} from "./chunk-H5AC62SN.js";
|
|
@@ -1815,12 +1815,20 @@ async function handleClientMessage(ws, client, message, _getLLMClient, _getActiv
|
|
|
1815
1815
|
return;
|
|
1816
1816
|
}
|
|
1817
1817
|
send({ type: "ack", payload: {}, id: message.id });
|
|
1818
|
+
const controller = new AbortController();
|
|
1819
|
+
const existingController = activeAgents.get(sessionId);
|
|
1820
|
+
if (existingController) {
|
|
1821
|
+
logger.warn("Aborting existing agent before compaction", { sessionId });
|
|
1822
|
+
existingController.abort();
|
|
1823
|
+
}
|
|
1824
|
+
activeAgents.set(sessionId, controller);
|
|
1818
1825
|
appendCompactionPrompt(sessionId, (event) => getEventStore().append(sessionId, event));
|
|
1819
1826
|
runChatTurn({
|
|
1820
1827
|
sessionManager,
|
|
1821
1828
|
sessionId,
|
|
1822
1829
|
llmClient: llmForSession(sessionId),
|
|
1823
1830
|
statsIdentity: statsForSession(sessionId),
|
|
1831
|
+
signal: controller.signal,
|
|
1824
1832
|
onMessage: (msg) => _broadcastForSession(sessionId, msg),
|
|
1825
1833
|
initialCompacting: true
|
|
1826
1834
|
}).then(() => {
|
|
@@ -1838,8 +1846,17 @@ async function handleClientMessage(ws, client, message, _getLLMClient, _getActiv
|
|
|
1838
1846
|
);
|
|
1839
1847
|
}).finally(() => {
|
|
1840
1848
|
try {
|
|
1849
|
+
if (activeAgents.get(sessionId) === controller) {
|
|
1850
|
+
activeAgents.delete(sessionId);
|
|
1851
|
+
}
|
|
1852
|
+
if (abortedSessions.has(sessionId)) {
|
|
1853
|
+
abortedSessions.delete(sessionId);
|
|
1854
|
+
sessionManager.clearMessageQueue(sessionId);
|
|
1855
|
+
}
|
|
1841
1856
|
sessionManager.setRunning(sessionId, false);
|
|
1842
1857
|
sendForSession(sessionId, createSessionRunningMessage(false));
|
|
1858
|
+
const contextState = sessionManager.getContextState(sessionId);
|
|
1859
|
+
sendForSession(sessionId, createContextStateMessage(contextState));
|
|
1843
1860
|
} catch {
|
|
1844
1861
|
}
|
|
1845
1862
|
});
|
|
@@ -2074,4 +2091,4 @@ export {
|
|
|
2074
2091
|
signalMcpReady,
|
|
2075
2092
|
createWebSocketServer
|
|
2076
2093
|
};
|
|
2077
|
-
//# sourceMappingURL=chunk-
|
|
2094
|
+
//# sourceMappingURL=chunk-PSFMSGCC.js.map
|
|
@@ -360,6 +360,7 @@ function buildContextMessagesFromStoredEvents(events, windowId, options) {
|
|
|
360
360
|
}
|
|
361
361
|
}
|
|
362
362
|
stripOrphanedToolCalls(messages, fulfilledToolCallIds);
|
|
363
|
+
reorderToolMessages(messages);
|
|
363
364
|
return messages.map(({ id: _id, ...message }) => message);
|
|
364
365
|
}
|
|
365
366
|
function handleMessageThinking(messageMap, data) {
|
|
@@ -423,6 +424,38 @@ function stripOrphanedToolCalls(messages, fulfilledToolCallIds) {
|
|
|
423
424
|
}
|
|
424
425
|
}
|
|
425
426
|
}
|
|
427
|
+
function reorderToolMessages(messages) {
|
|
428
|
+
let i = 0;
|
|
429
|
+
while (i < messages.length) {
|
|
430
|
+
const msg = messages[i];
|
|
431
|
+
if (msg.role === "assistant" && msg.toolCalls && msg.toolCalls.length > 1) {
|
|
432
|
+
const orderMap = /* @__PURE__ */ new Map();
|
|
433
|
+
msg.toolCalls.forEach((tc, idx) => orderMap.set(tc.id, idx));
|
|
434
|
+
const toolStart = i + 1;
|
|
435
|
+
let toolEnd = toolStart;
|
|
436
|
+
while (toolEnd < messages.length && messages[toolEnd].role === "tool") {
|
|
437
|
+
toolEnd++;
|
|
438
|
+
}
|
|
439
|
+
if (toolEnd - toolStart > 1) {
|
|
440
|
+
const toolSlice = messages.slice(toolStart, toolEnd);
|
|
441
|
+
const allKnown = toolSlice.every((m) => m.toolCallId && orderMap.has(m.toolCallId));
|
|
442
|
+
if (allKnown) {
|
|
443
|
+
toolSlice.sort((a, b) => {
|
|
444
|
+
const aOrder = orderMap.get(a.toolCallId);
|
|
445
|
+
const bOrder = orderMap.get(b.toolCallId);
|
|
446
|
+
return aOrder - bOrder;
|
|
447
|
+
});
|
|
448
|
+
for (let j = 0; j < toolSlice.length; j++) {
|
|
449
|
+
messages[toolStart + j] = toolSlice[j];
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
i = toolEnd;
|
|
454
|
+
} else {
|
|
455
|
+
i++;
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
}
|
|
426
459
|
function buildContextMessagesFromEventHistory(events, windowId, options) {
|
|
427
460
|
const snapshotEvent = [...events].reverse().find((event) => event.type === "turn.snapshot");
|
|
428
461
|
if (!snapshotEvent) {
|
|
@@ -816,6 +849,7 @@ export {
|
|
|
816
849
|
handleToolCall,
|
|
817
850
|
handleToolResult,
|
|
818
851
|
stripOrphanedToolCalls,
|
|
852
|
+
reorderToolMessages,
|
|
819
853
|
buildContextMessagesFromEventHistory,
|
|
820
854
|
foldTurnEventsToSnapshotMessages,
|
|
821
855
|
foldTurnEventsToSnapshotMessagesFromInitial,
|
|
@@ -833,4 +867,4 @@ export {
|
|
|
833
867
|
buildSnapshot,
|
|
834
868
|
buildSnapshotFromSessionState
|
|
835
869
|
};
|
|
836
|
-
//# sourceMappingURL=chunk-
|
|
870
|
+
//# sourceMappingURL=chunk-TMUBLQFC.js.map
|
|
@@ -208,7 +208,7 @@ async function runCli(options) {
|
|
|
208
208
|
if (!configExists) {
|
|
209
209
|
await runNetworkSetup(mode);
|
|
210
210
|
}
|
|
211
|
-
const { runServe } = await import("./serve-
|
|
211
|
+
const { runServe } = await import("./serve-4D5N2R35.js");
|
|
212
212
|
const serveOptions = { mode };
|
|
213
213
|
if (values.port) serveOptions.port = parseInt(values.port);
|
|
214
214
|
if (values["no-browser"] === true) serveOptions.openBrowser = false;
|
|
@@ -220,4 +220,4 @@ async function runCli(options) {
|
|
|
220
220
|
export {
|
|
221
221
|
runCli
|
|
222
222
|
};
|
|
223
|
-
//# sourceMappingURL=chunk-
|
|
223
|
+
//# sourceMappingURL=chunk-ZUADUO54.js.map
|
package/dist/cli/dev.js
CHANGED
package/dist/cli/index.js
CHANGED
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
appendCompactionPrompt,
|
|
3
3
|
getCompactionTarget,
|
|
4
4
|
shouldCompact
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-KFO535IO.js";
|
|
6
6
|
import "./chunk-55RWNJBT.js";
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-AIJE3RYH.js";
|
|
8
|
+
import "./chunk-TMUBLQFC.js";
|
|
9
9
|
import "./chunk-ZPIZLTWU.js";
|
|
10
10
|
import "./chunk-J2GP3J3X.js";
|
|
11
11
|
import "./chunk-Z4FMBCJO.js";
|
|
@@ -18,4 +18,4 @@ export {
|
|
|
18
18
|
getCompactionTarget,
|
|
19
19
|
shouldCompact
|
|
20
20
|
};
|
|
21
|
-
//# sourceMappingURL=compactor-
|
|
21
|
+
//# sourceMappingURL=compactor-7OGA6OYM.js.map
|
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
isStoredEvent,
|
|
39
39
|
isTurnEvent,
|
|
40
40
|
truncateSessionMessages
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-AIJE3RYH.js";
|
|
42
42
|
import {
|
|
43
43
|
buildContextMessagesFromEventHistory,
|
|
44
44
|
buildContextMessagesFromMessages,
|
|
@@ -55,7 +55,7 @@ import {
|
|
|
55
55
|
foldTodos,
|
|
56
56
|
foldTurnEventsToSnapshotMessages,
|
|
57
57
|
getMessagesForWindow
|
|
58
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-TMUBLQFC.js";
|
|
59
59
|
import "./chunk-ZPIZLTWU.js";
|
|
60
60
|
import "./chunk-K44MW7JJ.js";
|
|
61
61
|
import "./chunk-5WRI5ZAA.js";
|
|
@@ -115,4 +115,4 @@ export {
|
|
|
115
115
|
isTurnEvent,
|
|
116
116
|
truncateSessionMessages
|
|
117
117
|
};
|
|
118
|
-
//# sourceMappingURL=events-
|
|
118
|
+
//# sourceMappingURL=events-52XADT6Y.js.map
|
|
@@ -21,9 +21,10 @@ import {
|
|
|
21
21
|
handleMessageThinking,
|
|
22
22
|
handleToolCall,
|
|
23
23
|
handleToolResult,
|
|
24
|
+
reorderToolMessages,
|
|
24
25
|
spreadOptionalMessageFields,
|
|
25
26
|
stripOrphanedToolCalls
|
|
26
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-TMUBLQFC.js";
|
|
27
28
|
import "./chunk-5WRI5ZAA.js";
|
|
28
29
|
export {
|
|
29
30
|
buildContextMessagesFromEventHistory,
|
|
@@ -48,7 +49,8 @@ export {
|
|
|
48
49
|
handleMessageThinking,
|
|
49
50
|
handleToolCall,
|
|
50
51
|
handleToolResult,
|
|
52
|
+
reorderToolMessages,
|
|
51
53
|
spreadOptionalMessageFields,
|
|
52
54
|
stripOrphanedToolCalls
|
|
53
55
|
};
|
|
54
|
-
//# sourceMappingURL=folding-
|
|
56
|
+
//# sourceMappingURL=folding-2BGFLV5J.js.map
|