openfox 1.6.77 → 1.6.79
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/{auto-compaction-GOHNI2R2.js → auto-compaction-KTA6H4HP.js} +5 -5
- package/dist/{chat-handler-K2RDXBO6.js → chat-handler-EKAO6CIB.js} +8 -8
- package/dist/{chunk-I7JVS7V5.js → chunk-2IZMUXMP.js} +3 -3
- package/dist/{chunk-XSUQDB6R.js → chunk-3JU4NOQD.js} +36 -22
- package/dist/{chunk-6SYNGMU4.js → chunk-BG7QCFGG.js} +4 -4
- package/dist/{chunk-XKIEDGQF.js → chunk-DL6ZILAF.js} +1 -2
- package/dist/{chunk-OJBFC6ER.js → chunk-HOD7GVQ5.js} +3 -3
- package/dist/{chunk-UVN6AKIO.js → chunk-RJRG2VER.js} +33 -2
- package/dist/{chunk-BBC46FN4.js → chunk-TS5XFQ2D.js} +88 -48
- package/dist/{chunk-EBQYRNNU.js → chunk-UCZSBKG7.js} +176 -92
- package/dist/cli/dev.js +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/{events-5RIXWI5Y.js → events-ND5GZBT2.js} +7 -5
- package/dist/{folding-JNOUTI5Z.js → folding-XIKR6AFM.js} +14 -4
- package/dist/{inspect-proxy-Y75AXMRX.js → inspect-proxy-42ZXL2R5.js} +2 -2
- package/dist/{orchestrator-TW5II347.js → orchestrator-5U4O4K7V.js} +6 -6
- package/dist/package.json +1 -1
- package/dist/{processor-MZ3QIUED.js → processor-O35Q3EZT.js} +5 -5
- package/dist/{serve-FTTLGRAO.js → serve-55GF3KJW.js} +7 -7
- package/dist/server/index.js +6 -6
- package/dist/{service-D6LC3CAM.js → service-TU4XSXYJ.js} +33 -2
- package/dist/{tools-QJ5K5IJP.js → tools-W6OPDFQV.js} +5 -5
- package/dist/web/assets/{index-FjLp1t6r.js → index-BJtUJYiT.js} +49 -49
- package/dist/web/index.html +1 -1
- package/dist/web/sw.js +1 -1
- package/package.json +1 -1
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from "./chunk-CMQCO27Y.js";
|
|
10
10
|
import {
|
|
11
11
|
startInspectProxy
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-DL6ZILAF.js";
|
|
13
13
|
import {
|
|
14
14
|
createProcess,
|
|
15
15
|
getPlatformShell,
|
|
@@ -30,10 +30,18 @@ import {
|
|
|
30
30
|
streamWithSegments
|
|
31
31
|
} from "./chunk-CUDAT6SS.js";
|
|
32
32
|
import {
|
|
33
|
-
getContextMessages,
|
|
34
33
|
getCurrentContextWindowId,
|
|
35
34
|
getEventStore
|
|
36
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-RJRG2VER.js";
|
|
36
|
+
import {
|
|
37
|
+
buildContextMessagesFromEventHistory,
|
|
38
|
+
foldContextState,
|
|
39
|
+
handleMessageDelta,
|
|
40
|
+
handleMessageThinking,
|
|
41
|
+
handleToolCall,
|
|
42
|
+
handleToolResult,
|
|
43
|
+
stripOrphanedToolCalls
|
|
44
|
+
} from "./chunk-TS5XFQ2D.js";
|
|
37
45
|
import {
|
|
38
46
|
createChatDoneMessage,
|
|
39
47
|
createChatMessageMessage,
|
|
@@ -553,25 +561,6 @@ function computeAggregatedStats(input) {
|
|
|
553
561
|
}
|
|
554
562
|
|
|
555
563
|
// src/server/chat/stream-pure.ts
|
|
556
|
-
function toStreamMessages(messages) {
|
|
557
|
-
return messages.map((m) => ({
|
|
558
|
-
role: m.role,
|
|
559
|
-
content: m.content,
|
|
560
|
-
...m.thinkingContent ? { thinkingContent: m.thinkingContent } : {},
|
|
561
|
-
...m.toolCalls?.length ? { toolCalls: m.toolCalls.map((tc) => ({ id: tc.id, name: tc.name, arguments: tc.arguments })) } : {},
|
|
562
|
-
...m.toolCallId ? { toolCallId: m.toolCallId } : {},
|
|
563
|
-
...m.attachments?.length ? { attachments: m.attachments } : {}
|
|
564
|
-
}));
|
|
565
|
-
}
|
|
566
|
-
function createAssistantMessage(content, thinkingContent, toolCalls) {
|
|
567
|
-
return {
|
|
568
|
-
role: "assistant",
|
|
569
|
-
content,
|
|
570
|
-
source: "history",
|
|
571
|
-
...thinkingContent ? { thinkingContent } : {},
|
|
572
|
-
...toolCalls.length > 0 ? { toolCalls } : {}
|
|
573
|
-
};
|
|
574
|
-
}
|
|
575
564
|
function createEmptyStreamResult(aborted, xmlFormatError, modelParams) {
|
|
576
565
|
return {
|
|
577
566
|
content: "",
|
|
@@ -2830,6 +2819,111 @@ async function deleteSkill(configDir, skillId) {
|
|
|
2830
2819
|
|
|
2831
2820
|
// src/server/chat/agent-loop.ts
|
|
2832
2821
|
import stripAnsi from "strip-ansi";
|
|
2822
|
+
|
|
2823
|
+
// src/server/chat/conversation-history.ts
|
|
2824
|
+
function buildContextMessages(events, scope) {
|
|
2825
|
+
if (scope.type === "toplevel") {
|
|
2826
|
+
return buildTopLevelContextMessages(events, scope);
|
|
2827
|
+
}
|
|
2828
|
+
return buildSubAgentContextMessages(events, scope);
|
|
2829
|
+
}
|
|
2830
|
+
function buildTopLevelContextMessages(events, scope) {
|
|
2831
|
+
const includeVerifier = scope.includeVerifier ?? true;
|
|
2832
|
+
const currentWindowId = foldContextState(events, "").currentContextWindowId;
|
|
2833
|
+
if (!currentWindowId) return [];
|
|
2834
|
+
return buildContextMessagesFromEventHistory(events, currentWindowId, { includeVerifier });
|
|
2835
|
+
}
|
|
2836
|
+
function buildSubAgentContextMessages(events, scope) {
|
|
2837
|
+
const { subAgentId } = scope;
|
|
2838
|
+
const messages = [];
|
|
2839
|
+
const messageMap = /* @__PURE__ */ new Map();
|
|
2840
|
+
const fulfilledToolCallIds = /* @__PURE__ */ new Set();
|
|
2841
|
+
let compactionSummaryIndex = -1;
|
|
2842
|
+
for (let i = events.length - 1; i >= 0; i--) {
|
|
2843
|
+
const event = events[i];
|
|
2844
|
+
if (event.type === "context.compacted") {
|
|
2845
|
+
const data = event.data;
|
|
2846
|
+
if (data.subAgentId === subAgentId) {
|
|
2847
|
+
compactionSummaryIndex = i;
|
|
2848
|
+
break;
|
|
2849
|
+
}
|
|
2850
|
+
}
|
|
2851
|
+
}
|
|
2852
|
+
const startIdx = compactionSummaryIndex >= 0 ? compactionSummaryIndex : 0;
|
|
2853
|
+
for (let i = startIdx; i < events.length; i++) {
|
|
2854
|
+
const event = events[i];
|
|
2855
|
+
switch (event.type) {
|
|
2856
|
+
case "message.start": {
|
|
2857
|
+
const data = event.data;
|
|
2858
|
+
if (data.subAgentId !== subAgentId) break;
|
|
2859
|
+
if (data.role === "system") break;
|
|
2860
|
+
if (data.messageKind === "context-reset") break;
|
|
2861
|
+
const message = {
|
|
2862
|
+
id: data.messageId,
|
|
2863
|
+
role: data.role,
|
|
2864
|
+
content: data.content ?? "",
|
|
2865
|
+
...data.subAgentId ? { subAgentId: data.subAgentId } : {},
|
|
2866
|
+
...data.subAgentType ? { subAgentType: data.subAgentType } : {},
|
|
2867
|
+
...data.contextWindowId ? { contextWindowId: data.contextWindowId } : {},
|
|
2868
|
+
...data.isCompactionSummary ? { isCompactionSummary: data.isCompactionSummary } : {},
|
|
2869
|
+
...data.attachments !== void 0 ? { attachments: data.attachments } : {}
|
|
2870
|
+
};
|
|
2871
|
+
messageMap.set(data.messageId, message);
|
|
2872
|
+
messages.push(message);
|
|
2873
|
+
break;
|
|
2874
|
+
}
|
|
2875
|
+
case "message.thinking": {
|
|
2876
|
+
const evt = event.data;
|
|
2877
|
+
handleMessageThinking(messageMap, evt);
|
|
2878
|
+
break;
|
|
2879
|
+
}
|
|
2880
|
+
case "message.delta": {
|
|
2881
|
+
const evt = event.data;
|
|
2882
|
+
handleMessageDelta(messageMap, evt);
|
|
2883
|
+
break;
|
|
2884
|
+
}
|
|
2885
|
+
case "tool.call": {
|
|
2886
|
+
const evt = event.data;
|
|
2887
|
+
handleToolCall(messageMap, evt);
|
|
2888
|
+
break;
|
|
2889
|
+
}
|
|
2890
|
+
case "tool.result": {
|
|
2891
|
+
const evt = event.data;
|
|
2892
|
+
handleToolResult(messages, messageMap, fulfilledToolCallIds, evt);
|
|
2893
|
+
break;
|
|
2894
|
+
}
|
|
2895
|
+
case "context.compacted": {
|
|
2896
|
+
const data = event.data;
|
|
2897
|
+
if (data.subAgentId === subAgentId && i === compactionSummaryIndex) {
|
|
2898
|
+
}
|
|
2899
|
+
break;
|
|
2900
|
+
}
|
|
2901
|
+
}
|
|
2902
|
+
}
|
|
2903
|
+
stripOrphanedToolCalls(messages, fulfilledToolCallIds);
|
|
2904
|
+
return messages.map(
|
|
2905
|
+
({ id: _id, subAgentId: _sa, subAgentType: _st, contextWindowId: _cw, isCompactionSummary: _ics, ...rest }) => {
|
|
2906
|
+
const ctx = {
|
|
2907
|
+
role: rest.role,
|
|
2908
|
+
content: rest.content,
|
|
2909
|
+
...rest.thinkingContent ? { thinkingContent: rest.thinkingContent } : {},
|
|
2910
|
+
...rest.toolCalls ? { toolCalls: rest.toolCalls } : {},
|
|
2911
|
+
...rest.toolCallId ? { toolCallId: rest.toolCallId } : {},
|
|
2912
|
+
...rest.attachments ? { attachments: rest.attachments } : {}
|
|
2913
|
+
};
|
|
2914
|
+
return ctx;
|
|
2915
|
+
}
|
|
2916
|
+
);
|
|
2917
|
+
}
|
|
2918
|
+
function getConversationMessages(scope) {
|
|
2919
|
+
const eventStore = getEventStore();
|
|
2920
|
+
const events = eventStore.getEvents(scope.sessionId);
|
|
2921
|
+
if (events.length === 0) return [];
|
|
2922
|
+
const contextMessages = buildContextMessages(events, scope);
|
|
2923
|
+
return minimalMessagesToRequestContextMessages(contextMessages, "history");
|
|
2924
|
+
}
|
|
2925
|
+
|
|
2926
|
+
// src/server/chat/agent-loop.ts
|
|
2833
2927
|
function emitPartialDoneEvents(sessionId, assistantMsgId, statsIdentity, mode, turnMetrics, promptContext, eventStore) {
|
|
2834
2928
|
const stats = turnMetrics.buildStats(statsIdentity, mode);
|
|
2835
2929
|
eventStore.append(
|
|
@@ -2950,24 +3044,7 @@ Error: ${toolResult.error}` : `Error: ${toolResult.error}`
|
|
|
2950
3044
|
return { toolMessages, criteriaChanged, returnValueContent, returnValueResult };
|
|
2951
3045
|
}
|
|
2952
3046
|
var MAX_FORMAT_RETRIES = 10;
|
|
2953
|
-
var FORMAT_CORRECTION_PROMPT2 = `IMPORTANT: You MUST use the JSON function calling API. Do NOT output XML tags like <
|
|
2954
|
-
function toRequestContextMessages(messages) {
|
|
2955
|
-
return messages.map((message) => ({
|
|
2956
|
-
role: message.role,
|
|
2957
|
-
content: message.content,
|
|
2958
|
-
source: "history",
|
|
2959
|
-
...message.thinkingContent ? { thinkingContent: message.thinkingContent } : {},
|
|
2960
|
-
...message.toolCalls ? {
|
|
2961
|
-
toolCalls: message.toolCalls.map((toolCall) => ({
|
|
2962
|
-
id: toolCall.id,
|
|
2963
|
-
name: toolCall.name,
|
|
2964
|
-
arguments: toolCall.arguments
|
|
2965
|
-
}))
|
|
2966
|
-
} : {},
|
|
2967
|
-
...message.toolCallId ? { toolCallId: message.toolCallId } : {},
|
|
2968
|
-
...message.attachments ? { attachments: message.attachments } : {}
|
|
2969
|
-
}));
|
|
2970
|
-
}
|
|
3047
|
+
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.`;
|
|
2971
3048
|
async function runTopLevelAgentLoop(config, turnMetrics) {
|
|
2972
3049
|
const { mode, sessionManager, sessionId, llmClient, signal, onMessage, statsIdentity } = config;
|
|
2973
3050
|
const eventStore = getEventStore();
|
|
@@ -2996,7 +3073,7 @@ async function runTopLevelAgentLoop(config, turnMetrics) {
|
|
|
2996
3073
|
}));
|
|
2997
3074
|
const toolRegistry = config.getToolRegistry();
|
|
2998
3075
|
const currentWindowMessageOptions = getCurrentWindowMessageOptions(sessionId);
|
|
2999
|
-
const requestMessages =
|
|
3076
|
+
const requestMessages = getConversationMessages({ type: "toplevel", sessionId });
|
|
3000
3077
|
if (formatRetryCount > 0) {
|
|
3001
3078
|
const correctionMsgId = crypto.randomUUID();
|
|
3002
3079
|
eventStore.append(
|
|
@@ -3008,7 +3085,7 @@ async function runTopLevelAgentLoop(config, turnMetrics) {
|
|
|
3008
3085
|
})
|
|
3009
3086
|
);
|
|
3010
3087
|
eventStore.append(sessionId, createFormatRetryEvent(formatRetryCount, MAX_FORMAT_RETRIES));
|
|
3011
|
-
requestMessages.push({ role: "user", content: FORMAT_CORRECTION_PROMPT2, source: "
|
|
3088
|
+
requestMessages.push({ role: "user", content: FORMAT_CORRECTION_PROMPT2, source: "history" });
|
|
3012
3089
|
}
|
|
3013
3090
|
const configDir = getGlobalConfigDir(getRuntimeConfig().mode ?? "production");
|
|
3014
3091
|
const skills = await getEnabledSkillMetadata(configDir);
|
|
@@ -3173,6 +3250,15 @@ async function runTopLevelAgentLoop(config, turnMetrics) {
|
|
|
3173
3250
|
})
|
|
3174
3251
|
);
|
|
3175
3252
|
eventStore.append(sessionId, { type: "message.done", data: { messageId: asapMsgId } });
|
|
3253
|
+
const message = {
|
|
3254
|
+
id: asapMsgId,
|
|
3255
|
+
role: "user",
|
|
3256
|
+
content: asap.content,
|
|
3257
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3258
|
+
...asap.attachments ? { attachments: asap.attachments } : {}
|
|
3259
|
+
};
|
|
3260
|
+
onMessage?.(createChatMessageMessage(message));
|
|
3261
|
+
onMessage?.(createChatDoneMessage(asapMsgId, "complete"));
|
|
3176
3262
|
}
|
|
3177
3263
|
if (asapMessages.length > 0) {
|
|
3178
3264
|
onMessage?.(createQueueStateMessage(sessionManager.getQueueState(sessionId)));
|
|
@@ -3284,7 +3370,6 @@ async function executeSubAgent(options) {
|
|
|
3284
3370
|
const subAgentId = crypto.randomUUID();
|
|
3285
3371
|
let session = sessionManager.requireSession(sessionId);
|
|
3286
3372
|
const currentWindowMessageOptions = getCurrentWindowMessageOptions2(sessionId);
|
|
3287
|
-
const contextMessages = [{ role: "user", content: prompt, source: "runtime" }];
|
|
3288
3373
|
logger.debug("Sub-agent starting", { subAgentType, subAgentId, sessionId });
|
|
3289
3374
|
const resetMsgId = crypto.randomUUID();
|
|
3290
3375
|
eventStore.append(
|
|
@@ -3298,12 +3383,30 @@ async function executeSubAgent(options) {
|
|
|
3298
3383
|
})
|
|
3299
3384
|
);
|
|
3300
3385
|
eventStore.append(sessionId, { type: "message.done", data: { messageId: resetMsgId } });
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3386
|
+
const promptMsgId = crypto.randomUUID();
|
|
3387
|
+
eventStore.append(
|
|
3388
|
+
sessionId,
|
|
3389
|
+
createMessageStartEvent(promptMsgId, "user", prompt, {
|
|
3390
|
+
...currentWindowMessageOptions ?? {},
|
|
3391
|
+
isSystemGenerated: true,
|
|
3392
|
+
messageKind: "auto-prompt",
|
|
3393
|
+
subAgentId,
|
|
3394
|
+
subAgentType,
|
|
3395
|
+
metadata: {
|
|
3396
|
+
type: "subagent",
|
|
3397
|
+
name: agentDef.metadata.name,
|
|
3398
|
+
color: agentDef.metadata.color ?? "#6b7280"
|
|
3399
|
+
}
|
|
3400
|
+
})
|
|
3401
|
+
);
|
|
3402
|
+
eventStore.append(sessionId, { type: "message.done", data: { messageId: promptMsgId } });
|
|
3403
|
+
if (onMessage) {
|
|
3404
|
+
onMessage(
|
|
3405
|
+
createChatMessageMessage({
|
|
3406
|
+
id: promptMsgId,
|
|
3407
|
+
role: "user",
|
|
3408
|
+
content: prompt,
|
|
3409
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3307
3410
|
isSystemGenerated: true,
|
|
3308
3411
|
messageKind: "auto-prompt",
|
|
3309
3412
|
subAgentId,
|
|
@@ -3315,28 +3418,8 @@ async function executeSubAgent(options) {
|
|
|
3315
3418
|
}
|
|
3316
3419
|
})
|
|
3317
3420
|
);
|
|
3318
|
-
eventStore.append(sessionId, { type: "message.done", data: { messageId: msgId } });
|
|
3319
|
-
if (onMessage) {
|
|
3320
|
-
onMessage(
|
|
3321
|
-
createChatMessageMessage({
|
|
3322
|
-
id: msgId,
|
|
3323
|
-
role: "user",
|
|
3324
|
-
content: msg.content,
|
|
3325
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3326
|
-
isSystemGenerated: true,
|
|
3327
|
-
messageKind: "auto-prompt",
|
|
3328
|
-
subAgentId,
|
|
3329
|
-
subAgentType,
|
|
3330
|
-
metadata: {
|
|
3331
|
-
type: "subagent",
|
|
3332
|
-
name: agentDef.metadata.name,
|
|
3333
|
-
color: agentDef.metadata.color ?? "#6b7280"
|
|
3334
|
-
}
|
|
3335
|
-
})
|
|
3336
|
-
);
|
|
3337
|
-
}
|
|
3338
3421
|
}
|
|
3339
|
-
const { files } = await getAllInstructions(session.workdir, session.projectId);
|
|
3422
|
+
const { content: instructionContent, files } = await getAllInstructions(session.workdir, session.projectId);
|
|
3340
3423
|
const injectedFiles = toInjectedFiles(files);
|
|
3341
3424
|
const configDir = getGlobalConfigDir(getRuntimeConfig().mode ?? "production");
|
|
3342
3425
|
const skills = await getEnabledSkillMetadata(configDir);
|
|
@@ -3346,7 +3429,7 @@ async function executeSubAgent(options) {
|
|
|
3346
3429
|
skills.length > 0 ? skills : void 0,
|
|
3347
3430
|
llmClient.getModel()
|
|
3348
3431
|
);
|
|
3349
|
-
|
|
3432
|
+
const subAgentScope = { type: "subagent", sessionId, subAgentId, subAgentType };
|
|
3350
3433
|
let consecutiveEmptyStops = 0;
|
|
3351
3434
|
let finalContent;
|
|
3352
3435
|
let returnValueContent = null;
|
|
@@ -3356,13 +3439,7 @@ async function executeSubAgent(options) {
|
|
|
3356
3439
|
if (signal?.aborted) {
|
|
3357
3440
|
throw new Error("Aborted");
|
|
3358
3441
|
}
|
|
3359
|
-
|
|
3360
|
-
sessionManager,
|
|
3361
|
-
sessionId,
|
|
3362
|
-
llmClient,
|
|
3363
|
-
statsIdentity: resolveCompactionStatsIdentity(llmClient),
|
|
3364
|
-
...signal ? { signal } : {}
|
|
3365
|
-
});
|
|
3442
|
+
const requestMessages = getConversationMessages(subAgentScope);
|
|
3366
3443
|
const assistantMsgId = crypto.randomUUID();
|
|
3367
3444
|
eventStore.append(
|
|
3368
3445
|
sessionId,
|
|
@@ -3376,14 +3453,29 @@ async function executeSubAgent(options) {
|
|
|
3376
3453
|
systemPrompt,
|
|
3377
3454
|
injectedFiles,
|
|
3378
3455
|
prompt,
|
|
3379
|
-
|
|
3456
|
+
requestMessages,
|
|
3380
3457
|
toolRegistry.definitions
|
|
3381
3458
|
);
|
|
3459
|
+
const assembledRequest = assembleAgentRequest({
|
|
3460
|
+
agentDef,
|
|
3461
|
+
subAgentDefs: [],
|
|
3462
|
+
workdir: session.workdir,
|
|
3463
|
+
messages: requestMessages,
|
|
3464
|
+
injectedFiles,
|
|
3465
|
+
promptTools: toolRegistry.definitions,
|
|
3466
|
+
requestTools: toolRegistry.definitions,
|
|
3467
|
+
toolChoice: "auto",
|
|
3468
|
+
disableThinking: true,
|
|
3469
|
+
...instructionContent ? { customInstructions: instructionContent } : {},
|
|
3470
|
+
...skills.length > 0 ? { skills } : {},
|
|
3471
|
+
modelName: llmClient.getModel()
|
|
3472
|
+
});
|
|
3473
|
+
const effectiveSystemPrompt = assembledRequest.systemPrompt + RETURN_VALUE_INSTRUCTION;
|
|
3382
3474
|
const streamGen = streamLLMPure({
|
|
3383
3475
|
messageId: assistantMsgId,
|
|
3384
|
-
systemPrompt:
|
|
3476
|
+
systemPrompt: effectiveSystemPrompt,
|
|
3385
3477
|
llmClient,
|
|
3386
|
-
messages:
|
|
3478
|
+
messages: assembledRequest.messages,
|
|
3387
3479
|
tools: toolRegistry.definitions,
|
|
3388
3480
|
toolChoice: "auto",
|
|
3389
3481
|
signal,
|
|
@@ -3406,9 +3498,7 @@ async function executeSubAgent(options) {
|
|
|
3406
3498
|
throw new Error("Aborted");
|
|
3407
3499
|
}
|
|
3408
3500
|
turnMetrics.addLLMCall(result.timing, result.usage.promptTokens, result.usage.completionTokens, result.modelParams);
|
|
3409
|
-
sessionManager.setCurrentContextSize(sessionId, result.usage.promptTokens, subAgentId);
|
|
3410
3501
|
finalContent = result.content;
|
|
3411
|
-
customMessages.push(createAssistantMessage(result.content, result.thinkingContent, result.toolCalls));
|
|
3412
3502
|
session = sessionManager.requireSession(sessionId);
|
|
3413
3503
|
if (result.toolCalls.length === 0) {
|
|
3414
3504
|
if (nudgeConfig) {
|
|
@@ -3428,7 +3518,6 @@ async function executeSubAgent(options) {
|
|
|
3428
3518
|
subAgentId,
|
|
3429
3519
|
subAgentType
|
|
3430
3520
|
});
|
|
3431
|
-
customMessages = [...customMessages, { role: "user", content: nudgeContent, source: "runtime" }];
|
|
3432
3521
|
continue;
|
|
3433
3522
|
}
|
|
3434
3523
|
const stalledMsgId = crypto.randomUUID();
|
|
@@ -3458,7 +3547,6 @@ async function executeSubAgent(options) {
|
|
|
3458
3547
|
subAgentId,
|
|
3459
3548
|
subAgentType
|
|
3460
3549
|
});
|
|
3461
|
-
customMessages = [...customMessages, { role: "user", content: RETURN_VALUE_NUDGE, source: "runtime" }];
|
|
3462
3550
|
continue;
|
|
3463
3551
|
}
|
|
3464
3552
|
const stats = turnMetrics.buildStats(statsIdentity, "verifier");
|
|
@@ -3510,7 +3598,6 @@ async function executeSubAgent(options) {
|
|
|
3510
3598
|
}
|
|
3511
3599
|
break;
|
|
3512
3600
|
}
|
|
3513
|
-
customMessages = [...customMessages, ...batchResult.toolMessages];
|
|
3514
3601
|
session = sessionManager.requireSession(sessionId);
|
|
3515
3602
|
if (nudgeConfig) {
|
|
3516
3603
|
consecutiveEmptyStops = 0;
|
|
@@ -3597,7 +3684,7 @@ var callSubAgentTool = {
|
|
|
3597
3684
|
};
|
|
3598
3685
|
}
|
|
3599
3686
|
try {
|
|
3600
|
-
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-
|
|
3687
|
+
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-W6OPDFQV.js");
|
|
3601
3688
|
const toolRegistry = getToolRegistryForAgent2(agentDef);
|
|
3602
3689
|
const turnMetrics = new TurnMetrics();
|
|
3603
3690
|
const result = await executeSubAgent({
|
|
@@ -4581,9 +4668,6 @@ function getCurrentWindowMessageOptions3(sessionId) {
|
|
|
4581
4668
|
const contextWindowId = getCurrentContextWindowId(sessionId);
|
|
4582
4669
|
return contextWindowId ? { contextWindowId } : void 0;
|
|
4583
4670
|
}
|
|
4584
|
-
function toRequestContextMessages2(messages) {
|
|
4585
|
-
return minimalMessagesToRequestContextMessages(messages, "history");
|
|
4586
|
-
}
|
|
4587
4671
|
async function maybeAutoCompactContext(options) {
|
|
4588
4672
|
const config = getRuntimeConfig();
|
|
4589
4673
|
const contextState = options.sessionManager.getContextState(options.sessionId);
|
|
@@ -4630,7 +4714,7 @@ async function performContextCompaction(options) {
|
|
|
4630
4714
|
const session = sessionManager.requireSession(sessionId);
|
|
4631
4715
|
const { content: instructions, files } = await getAllInstructions(session.workdir, session.projectId);
|
|
4632
4716
|
const injectedFiles = toInjectedFiles(files);
|
|
4633
|
-
const requestMessages =
|
|
4717
|
+
const requestMessages = getConversationMessages({ type: "toplevel", sessionId });
|
|
4634
4718
|
const config = getRuntimeConfig();
|
|
4635
4719
|
const allAgents = await loadAllAgentsDefault();
|
|
4636
4720
|
const plannerDef = findAgentById("planner", allAgents);
|
|
@@ -4789,4 +4873,4 @@ export {
|
|
|
4789
4873
|
getToolRegistryForAgent,
|
|
4790
4874
|
createToolRegistry
|
|
4791
4875
|
};
|
|
4792
|
-
//# sourceMappingURL=chunk-
|
|
4876
|
+
//# sourceMappingURL=chunk-UCZSBKG7.js.map
|
package/dist/cli/dev.js
CHANGED
package/dist/cli/index.js
CHANGED
|
@@ -35,8 +35,9 @@ import {
|
|
|
35
35
|
initEventStore,
|
|
36
36
|
isFileInCache,
|
|
37
37
|
isStoredEvent,
|
|
38
|
-
isTurnEvent
|
|
39
|
-
|
|
38
|
+
isTurnEvent,
|
|
39
|
+
truncateSessionMessages
|
|
40
|
+
} from "./chunk-RJRG2VER.js";
|
|
40
41
|
import "./chunk-KIOUKC3Z.js";
|
|
41
42
|
import {
|
|
42
43
|
buildContextMessagesFromEventHistory,
|
|
@@ -54,7 +55,7 @@ import {
|
|
|
54
55
|
foldTodos,
|
|
55
56
|
foldTurnEventsToSnapshotMessages,
|
|
56
57
|
getMessagesForWindow
|
|
57
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-TS5XFQ2D.js";
|
|
58
59
|
import "./chunk-B5AP3RSV.js";
|
|
59
60
|
import "./chunk-K44MW7JJ.js";
|
|
60
61
|
export {
|
|
@@ -109,6 +110,7 @@ export {
|
|
|
109
110
|
initEventStore,
|
|
110
111
|
isFileInCache,
|
|
111
112
|
isStoredEvent,
|
|
112
|
-
isTurnEvent
|
|
113
|
+
isTurnEvent,
|
|
114
|
+
truncateSessionMessages
|
|
113
115
|
};
|
|
114
|
-
//# sourceMappingURL=events-
|
|
116
|
+
//# sourceMappingURL=events-ND5GZBT2.js.map
|
|
@@ -16,8 +16,13 @@ import {
|
|
|
16
16
|
foldTurnEventsToSnapshotMessages,
|
|
17
17
|
foldTurnEventsToSnapshotMessagesFromInitial,
|
|
18
18
|
getMessagesForWindow,
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
handleMessageDelta,
|
|
20
|
+
handleMessageThinking,
|
|
21
|
+
handleToolCall,
|
|
22
|
+
handleToolResult,
|
|
23
|
+
spreadOptionalMessageFields,
|
|
24
|
+
stripOrphanedToolCalls
|
|
25
|
+
} from "./chunk-TS5XFQ2D.js";
|
|
21
26
|
export {
|
|
22
27
|
buildContextMessagesFromEventHistory,
|
|
23
28
|
buildContextMessagesFromMessages,
|
|
@@ -36,6 +41,11 @@ export {
|
|
|
36
41
|
foldTurnEventsToSnapshotMessages,
|
|
37
42
|
foldTurnEventsToSnapshotMessagesFromInitial,
|
|
38
43
|
getMessagesForWindow,
|
|
39
|
-
|
|
44
|
+
handleMessageDelta,
|
|
45
|
+
handleMessageThinking,
|
|
46
|
+
handleToolCall,
|
|
47
|
+
handleToolResult,
|
|
48
|
+
spreadOptionalMessageFields,
|
|
49
|
+
stripOrphanedToolCalls
|
|
40
50
|
};
|
|
41
|
-
//# sourceMappingURL=folding-
|
|
51
|
+
//# sourceMappingURL=folding-XIKR6AFM.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
startInspectProxy,
|
|
3
3
|
stopAllInspectProxies
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-DL6ZILAF.js";
|
|
5
5
|
import "./chunk-K44MW7JJ.js";
|
|
6
6
|
export {
|
|
7
7
|
startInspectProxy,
|
|
8
8
|
stopAllInspectProxies
|
|
9
9
|
};
|
|
10
|
-
//# sourceMappingURL=inspect-proxy-
|
|
10
|
+
//# sourceMappingURL=inspect-proxy-42ZXL2R5.js.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
runBuilderTurn,
|
|
4
4
|
runChatTurn,
|
|
5
5
|
runVerifierTurn
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-BG7QCFGG.js";
|
|
7
7
|
import {
|
|
8
8
|
TurnMetrics,
|
|
9
9
|
createChatDoneEvent,
|
|
@@ -11,16 +11,16 @@ import {
|
|
|
11
11
|
createMessageStartEvent,
|
|
12
12
|
createToolCallEvent,
|
|
13
13
|
createToolResultEvent
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-UCZSBKG7.js";
|
|
15
15
|
import "./chunk-OXI26S7U.js";
|
|
16
16
|
import "./chunk-CMQCO27Y.js";
|
|
17
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-DL6ZILAF.js";
|
|
18
18
|
import "./chunk-PBGOZMVY.js";
|
|
19
19
|
import "./chunk-VRGRAQDG.js";
|
|
20
20
|
import "./chunk-CUDAT6SS.js";
|
|
21
|
-
import "./chunk-
|
|
21
|
+
import "./chunk-RJRG2VER.js";
|
|
22
22
|
import "./chunk-KIOUKC3Z.js";
|
|
23
|
-
import "./chunk-
|
|
23
|
+
import "./chunk-TS5XFQ2D.js";
|
|
24
24
|
import "./chunk-STYHKCG7.js";
|
|
25
25
|
import "./chunk-BJYPTN5S.js";
|
|
26
26
|
import "./chunk-NDJ6FKSP.js";
|
|
@@ -40,4 +40,4 @@ export {
|
|
|
40
40
|
runChatTurn,
|
|
41
41
|
runVerifierTurn
|
|
42
42
|
};
|
|
43
|
-
//# sourceMappingURL=orchestrator-
|
|
43
|
+
//# sourceMappingURL=orchestrator-5U4O4K7V.js.map
|
package/dist/package.json
CHANGED
|
@@ -5,12 +5,12 @@ import {
|
|
|
5
5
|
generateSessionName,
|
|
6
6
|
getSessionMessageCount,
|
|
7
7
|
needsNameGenerationCheck
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-2IZMUXMP.js";
|
|
9
9
|
import {
|
|
10
10
|
getEventStore
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-RJRG2VER.js";
|
|
12
12
|
import "./chunk-KIOUKC3Z.js";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-TS5XFQ2D.js";
|
|
14
14
|
import {
|
|
15
15
|
createChatMessageMessage,
|
|
16
16
|
createSessionRunningMessage
|
|
@@ -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-
|
|
180
|
+
const { runChatTurn } = await import("./orchestrator-5U4O4K7V.js");
|
|
181
181
|
const runChatTurnParams = buildRunChatTurnParams({
|
|
182
182
|
sessionManager,
|
|
183
183
|
sessionId,
|
|
@@ -214,4 +214,4 @@ var QueueProcessor = class {
|
|
|
214
214
|
export {
|
|
215
215
|
QueueProcessor
|
|
216
216
|
};
|
|
217
|
-
//# sourceMappingURL=processor-
|
|
217
|
+
//# sourceMappingURL=processor-O35Q3EZT.js.map
|
|
@@ -6,20 +6,20 @@ import {
|
|
|
6
6
|
import {
|
|
7
7
|
VERSION,
|
|
8
8
|
createServer
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-3JU4NOQD.js";
|
|
10
|
+
import "./chunk-BG7QCFGG.js";
|
|
11
|
+
import "./chunk-UCZSBKG7.js";
|
|
12
12
|
import "./chunk-OXI26S7U.js";
|
|
13
13
|
import "./chunk-CMQCO27Y.js";
|
|
14
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-DL6ZILAF.js";
|
|
15
15
|
import "./chunk-PBGOZMVY.js";
|
|
16
16
|
import "./chunk-VRGRAQDG.js";
|
|
17
17
|
import "./chunk-WR6QCJJO.js";
|
|
18
18
|
import "./chunk-TGWEH2BC.js";
|
|
19
19
|
import "./chunk-CUDAT6SS.js";
|
|
20
|
-
import "./chunk-
|
|
20
|
+
import "./chunk-RJRG2VER.js";
|
|
21
21
|
import "./chunk-KIOUKC3Z.js";
|
|
22
|
-
import "./chunk-
|
|
22
|
+
import "./chunk-TS5XFQ2D.js";
|
|
23
23
|
import "./chunk-STYHKCG7.js";
|
|
24
24
|
import "./chunk-BJYPTN5S.js";
|
|
25
25
|
import "./chunk-RGRBWDZP.js";
|
|
@@ -190,4 +190,4 @@ async function runServe(options) {
|
|
|
190
190
|
export {
|
|
191
191
|
runServe
|
|
192
192
|
};
|
|
193
|
-
//# sourceMappingURL=serve-
|
|
193
|
+
//# sourceMappingURL=serve-55GF3KJW.js.map
|
package/dist/server/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createServer,
|
|
3
3
|
createServerHandle
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-3JU4NOQD.js";
|
|
5
|
+
import "../chunk-BG7QCFGG.js";
|
|
6
|
+
import "../chunk-UCZSBKG7.js";
|
|
7
7
|
import "../chunk-OXI26S7U.js";
|
|
8
8
|
import "../chunk-CMQCO27Y.js";
|
|
9
|
-
import "../chunk-
|
|
9
|
+
import "../chunk-DL6ZILAF.js";
|
|
10
10
|
import "../chunk-PBGOZMVY.js";
|
|
11
11
|
import "../chunk-VRGRAQDG.js";
|
|
12
12
|
import "../chunk-WR6QCJJO.js";
|
|
13
13
|
import "../chunk-TGWEH2BC.js";
|
|
14
14
|
import "../chunk-CUDAT6SS.js";
|
|
15
|
-
import "../chunk-
|
|
15
|
+
import "../chunk-RJRG2VER.js";
|
|
16
16
|
import "../chunk-KIOUKC3Z.js";
|
|
17
|
-
import "../chunk-
|
|
17
|
+
import "../chunk-TS5XFQ2D.js";
|
|
18
18
|
import "../chunk-STYHKCG7.js";
|
|
19
19
|
import "../chunk-BJYPTN5S.js";
|
|
20
20
|
import "../chunk-RGRBWDZP.js";
|