openfox 2.0.3 → 2.0.5
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/{ask-5SSOA6SZ.js → ask-4GZ334CO.js} +4 -2
- package/dist/{chat-handler-HXCAXFEV.js → chat-handler-RQXMBCKX.js} +9 -9
- package/dist/{chunk-7TTEGAO6.js → chunk-3QB2RMX2.js} +13 -7
- package/dist/{chunk-BVHFMAVN.js → chunk-5BDVM6YI.js} +1 -1
- package/dist/{chunk-3YK3INGL.js → chunk-734M5CG5.js} +5 -5
- package/dist/{chunk-MSUES6A3.js → chunk-7EHJPONC.js} +4 -4
- package/dist/{chunk-FCFCBOWR.js → chunk-7S6FKODI.js} +56 -28
- package/dist/{chunk-ZHK4XSLM.js → chunk-DXV74LCI.js} +68 -36
- package/dist/{chunk-BJYPTN5S.js → chunk-EU3WWTFH.js} +35 -8
- package/dist/{chunk-ITWVFGFV.js → chunk-LX66KJPL.js} +2 -2
- package/dist/{chunk-OP22QEB3.js → chunk-SYG2ENUQ.js} +2 -2
- package/dist/{chunk-PK7CBACL.js → chunk-TIKQWNYK.js} +12 -5
- package/dist/cli/dev.js +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/{events-4T6IO56V.js → events-4K52FKPR.js} +3 -3
- package/dist/{folding-YOCGTZYH.js → folding-QIBNKYA6.js} +2 -2
- package/dist/{orchestrator-KQROHCQ7.js → orchestrator-JPDTRWQE.js} +8 -8
- package/dist/package.json +1 -1
- package/dist/{processor-YXAPERVZ.js → processor-KRBBTKRS.js} +20 -7
- package/dist/{protocol-49SJtN_P.d.ts → protocol-CaLuIetw.d.ts} +13 -3
- package/dist/{protocol-CN24IKQN.js → protocol-YYWMFR35.js} +3 -3
- package/dist/{serve-WHN52MAF.js → serve-YJIMBTIX.js} +9 -9
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.js +8 -8
- package/dist/{service-GB7AIOG5.js → service-FJ4TW5L7.js} +14 -9
- package/dist/shared/index.d.ts +2 -2
- package/dist/shared/index.js +1 -1
- package/dist/{tools-ESHH53EB.js → tools-Z6KF35SO.js} +9 -7
- package/dist/web/assets/{index-Sdax8ayU.css → index-B6xft9Co.css} +1 -1
- package/dist/web/assets/{index-Di3909TT.js → index-Cwshb4LW.js} +43 -43
- package/dist/web/index.html +2 -2
- package/dist/web/sw.js +1 -1
- package/package.json +1 -1
|
@@ -4,16 +4,18 @@ import {
|
|
|
4
4
|
awaitAnswer,
|
|
5
5
|
cancelQuestion,
|
|
6
6
|
cancelQuestionsForSession,
|
|
7
|
+
getPendingQuestionsForSession,
|
|
7
8
|
hasPendingQuestion,
|
|
8
9
|
provideAnswer
|
|
9
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-EU3WWTFH.js";
|
|
10
11
|
export {
|
|
11
12
|
AskUserInterrupt,
|
|
12
13
|
askUserTool,
|
|
13
14
|
awaitAnswer,
|
|
14
15
|
cancelQuestion,
|
|
15
16
|
cancelQuestionsForSession,
|
|
17
|
+
getPendingQuestionsForSession,
|
|
16
18
|
hasPendingQuestion,
|
|
17
19
|
provideAnswer
|
|
18
20
|
};
|
|
19
|
-
//# sourceMappingURL=ask-
|
|
21
|
+
//# sourceMappingURL=ask-4GZ334CO.js.map
|
|
@@ -5,28 +5,28 @@ import {
|
|
|
5
5
|
generateSessionName,
|
|
6
6
|
getSessionMessageCount,
|
|
7
7
|
needsNameGenerationCheck
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-TIKQWNYK.js";
|
|
9
9
|
import {
|
|
10
10
|
runChatTurn
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-7EHJPONC.js";
|
|
12
|
+
import "./chunk-7S6FKODI.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-
|
|
20
|
-
import "./chunk-
|
|
19
|
+
} from "./chunk-SYG2ENUQ.js";
|
|
20
|
+
import "./chunk-LX66KJPL.js";
|
|
21
21
|
import {
|
|
22
22
|
createChatMessageMessage,
|
|
23
23
|
createPhaseChangedMessage,
|
|
24
24
|
createSessionRunningMessage
|
|
25
|
-
} from "./chunk-
|
|
26
|
-
import "./chunk-
|
|
25
|
+
} from "./chunk-3QB2RMX2.js";
|
|
26
|
+
import "./chunk-EU3WWTFH.js";
|
|
27
27
|
import "./chunk-RFNEDBVO.js";
|
|
28
28
|
import "./chunk-FBGWG4N6.js";
|
|
29
|
-
import "./chunk-
|
|
29
|
+
import "./chunk-5BDVM6YI.js";
|
|
30
30
|
import "./chunk-CQGTEGKL.js";
|
|
31
31
|
import "./chunk-Z4SWOUWC.js";
|
|
32
32
|
import {
|
|
@@ -161,4 +161,4 @@ export {
|
|
|
161
161
|
startChatSession,
|
|
162
162
|
stopSessionExecution
|
|
163
163
|
};
|
|
164
|
-
//# sourceMappingURL=chat-handler-
|
|
164
|
+
//# sourceMappingURL=chat-handler-RQXMBCKX.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createServerMessage,
|
|
3
3
|
isClientMessage
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-5BDVM6YI.js";
|
|
5
5
|
|
|
6
6
|
// src/server/ws/protocol.ts
|
|
7
7
|
function enrichMessagesWithToolResults(messages) {
|
|
@@ -43,11 +43,17 @@ function serializeServerMessage(message) {
|
|
|
43
43
|
function createErrorMessage(code, message, correlationId) {
|
|
44
44
|
return createServerMessage("error", { code, message }, correlationId);
|
|
45
45
|
}
|
|
46
|
-
function createSessionStateMessage(session, messages, pendingConfirmations = [], gitStatus, correlationId) {
|
|
46
|
+
function createSessionStateMessage(session, messages, pendingConfirmations = [], pendingQuestions, gitStatus, correlationId) {
|
|
47
47
|
const enrichedMessages = enrichMessagesWithToolResults(messages);
|
|
48
48
|
return createServerMessage(
|
|
49
49
|
"session.state",
|
|
50
|
-
{
|
|
50
|
+
{
|
|
51
|
+
session,
|
|
52
|
+
messages: enrichedMessages,
|
|
53
|
+
pendingConfirmations,
|
|
54
|
+
...pendingQuestions ? { pendingQuestions } : {},
|
|
55
|
+
...gitStatus ? { gitStatus } : {}
|
|
56
|
+
},
|
|
51
57
|
correlationId
|
|
52
58
|
);
|
|
53
59
|
}
|
|
@@ -123,8 +129,8 @@ function createChatErrorMessage(error, recoverable) {
|
|
|
123
129
|
function createChatPathConfirmationMessage(callId, tool, paths, workdir, reason) {
|
|
124
130
|
return createServerMessage("chat.path_confirmation", { callId, tool, paths, workdir, reason });
|
|
125
131
|
}
|
|
126
|
-
function createChatAskUserMessage(callId, question) {
|
|
127
|
-
return createServerMessage("chat.ask_user", { callId, question });
|
|
132
|
+
function createChatAskUserMessage(callId, question, type, options) {
|
|
133
|
+
return createServerMessage("chat.ask_user", { callId, question, type, options });
|
|
128
134
|
}
|
|
129
135
|
function createModeChangedMessage(mode, auto, reason) {
|
|
130
136
|
return createServerMessage("mode.changed", { mode, auto, ...reason ? { reason } : {} });
|
|
@@ -281,7 +287,7 @@ function storedEventToServerMessage(event) {
|
|
|
281
287
|
}
|
|
282
288
|
case "chat.ask_user": {
|
|
283
289
|
const data = event.data;
|
|
284
|
-
return createChatAskUserMessage(data.callId, data.question);
|
|
290
|
+
return createChatAskUserMessage(data.callId, data.question, data.type, data.options);
|
|
285
291
|
}
|
|
286
292
|
case "pattern.retry": {
|
|
287
293
|
const data = event.data;
|
|
@@ -333,4 +339,4 @@ export {
|
|
|
333
339
|
createQueueStateMessage,
|
|
334
340
|
storedEventToServerMessage
|
|
335
341
|
};
|
|
336
|
-
//# sourceMappingURL=chunk-
|
|
342
|
+
//# sourceMappingURL=chunk-3QB2RMX2.js.map
|
|
@@ -157,12 +157,12 @@ async function runCli(options) {
|
|
|
157
157
|
break;
|
|
158
158
|
}
|
|
159
159
|
case "service": {
|
|
160
|
-
const { runServiceCommand } = await import("./service-
|
|
161
|
-
const [, subcommand] = positionals;
|
|
160
|
+
const { runServiceCommand } = await import("./service-FJ4TW5L7.js");
|
|
161
|
+
const [, subcommand, ...serviceArgs] = positionals;
|
|
162
162
|
if (subcommand === "--help" || subcommand === "-h" || values.help) {
|
|
163
163
|
runServiceCommand(mode, void 0);
|
|
164
164
|
} else {
|
|
165
|
-
await runServiceCommand(mode, subcommand);
|
|
165
|
+
await runServiceCommand(mode, subcommand, ...serviceArgs);
|
|
166
166
|
}
|
|
167
167
|
break;
|
|
168
168
|
}
|
|
@@ -193,7 +193,7 @@ async function runCli(options) {
|
|
|
193
193
|
if (!configExists) {
|
|
194
194
|
await runNetworkSetup(mode);
|
|
195
195
|
}
|
|
196
|
-
const { runServe } = await import("./serve-
|
|
196
|
+
const { runServe } = await import("./serve-YJIMBTIX.js");
|
|
197
197
|
const serveOptions = { mode };
|
|
198
198
|
if (values.port) serveOptions.port = parseInt(values.port);
|
|
199
199
|
if (values["no-browser"] === true) serveOptions.openBrowser = false;
|
|
@@ -205,4 +205,4 @@ async function runCli(options) {
|
|
|
205
205
|
export {
|
|
206
206
|
runCli
|
|
207
207
|
};
|
|
208
|
-
//# sourceMappingURL=chunk-
|
|
208
|
+
//# sourceMappingURL=chunk-734M5CG5.js.map
|
|
@@ -17,16 +17,16 @@ import {
|
|
|
17
17
|
loadAllAgentsDefault,
|
|
18
18
|
processEventsForConversation,
|
|
19
19
|
runTopLevelAgentLoop
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-7S6FKODI.js";
|
|
21
21
|
import {
|
|
22
22
|
getCurrentContextWindowId,
|
|
23
23
|
getCurrentWindowMessageOptions,
|
|
24
24
|
getEventStore,
|
|
25
25
|
getRuntimeConfig
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-SYG2ENUQ.js";
|
|
27
27
|
import {
|
|
28
28
|
buildSnapshotFromSessionState
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-LX66KJPL.js";
|
|
30
30
|
import {
|
|
31
31
|
getGlobalConfigDir
|
|
32
32
|
} from "./chunk-CQGTEGKL.js";
|
|
@@ -311,4 +311,4 @@ export {
|
|
|
311
311
|
runAgentTurn,
|
|
312
312
|
injectWorkflowKickoffIfNeeded
|
|
313
313
|
};
|
|
314
|
-
//# sourceMappingURL=chunk-
|
|
314
|
+
//# sourceMappingURL=chunk-7EHJPONC.js.map
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
getCurrentWindowMessageOptions,
|
|
23
23
|
getEventStore,
|
|
24
24
|
getRuntimeConfig
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-SYG2ENUQ.js";
|
|
26
26
|
import {
|
|
27
27
|
buildContextMessagesFromEventHistory,
|
|
28
28
|
foldContextState,
|
|
@@ -31,18 +31,18 @@ import {
|
|
|
31
31
|
handleToolCall,
|
|
32
32
|
handleToolResult,
|
|
33
33
|
stripOrphanedToolCalls
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-LX66KJPL.js";
|
|
35
35
|
import {
|
|
36
36
|
createChatDoneMessage,
|
|
37
37
|
createChatMessageMessage,
|
|
38
38
|
createChatMessageUpdatedMessage,
|
|
39
39
|
createChatPathConfirmationMessage,
|
|
40
40
|
createQueueStateMessage
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-3QB2RMX2.js";
|
|
42
42
|
import {
|
|
43
43
|
AskUserInterrupt,
|
|
44
44
|
askUserTool
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-EU3WWTFH.js";
|
|
46
46
|
import {
|
|
47
47
|
SETTINGS_KEYS,
|
|
48
48
|
deleteSetting,
|
|
@@ -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
|
}
|
|
@@ -2646,9 +2647,9 @@ async function executeTools(assistantMsgId, toolCalls, ctx, append) {
|
|
|
2646
2647
|
} else if (error instanceof AskUserInterrupt) {
|
|
2647
2648
|
append({
|
|
2648
2649
|
type: "chat.ask_user",
|
|
2649
|
-
data: { callId: error.callId, question: error.question }
|
|
2650
|
+
data: { callId: error.callId, question: error.question, type: error.type, options: error.options }
|
|
2650
2651
|
});
|
|
2651
|
-
const { awaitAnswer } = await import("./ask-
|
|
2652
|
+
const { awaitAnswer } = await import("./ask-4GZ334CO.js");
|
|
2652
2653
|
const answerPromise = awaitAnswer(error.callId);
|
|
2653
2654
|
if (!answerPromise) {
|
|
2654
2655
|
throw new Error(`No pending question found for callId: ${error.callId}`);
|
|
@@ -2675,7 +2676,6 @@ async function executeTools(assistantMsgId, toolCalls, ctx, append) {
|
|
|
2675
2676
|
durationMs: 0,
|
|
2676
2677
|
truncated: false
|
|
2677
2678
|
};
|
|
2678
|
-
ctx.turnMetrics.addToolTime(toolResult2.durationMs);
|
|
2679
2679
|
append(createToolResultEvent(assistantMsgId, toolCall.id, toolResult2));
|
|
2680
2680
|
return {
|
|
2681
2681
|
toolCall,
|
|
@@ -2707,12 +2707,14 @@ async function executeTools(assistantMsgId, toolCalls, ctx, append) {
|
|
|
2707
2707
|
} catch (error) {
|
|
2708
2708
|
toolResult = await handleToolExecutionError(error, ctx.sessionId, startTime);
|
|
2709
2709
|
}
|
|
2710
|
-
ctx.turnMetrics.addToolTime(toolResult.durationMs);
|
|
2711
2710
|
ctx.onToolExecuted?.(toolCall, toolResult);
|
|
2712
2711
|
if (toolCall.name === "return_value" && !toolCall.parseError) {
|
|
2713
2712
|
returnValueContent = toolCall.arguments["content"];
|
|
2714
2713
|
returnValueResult = toolCall.arguments["result"];
|
|
2715
2714
|
}
|
|
2715
|
+
if (toolCall.name === "step_done" && toolResult.success) {
|
|
2716
|
+
stepDoneCalled = true;
|
|
2717
|
+
}
|
|
2716
2718
|
const content = stripAnsi(
|
|
2717
2719
|
toolResult.success ? toolResult.output ?? "Success" : toolResult.output ? `${toolResult.output}
|
|
2718
2720
|
|
|
@@ -2726,8 +2728,10 @@ Error: ${toolResult.error}` : `Error: ${toolResult.error}`
|
|
|
2726
2728
|
index
|
|
2727
2729
|
};
|
|
2728
2730
|
};
|
|
2731
|
+
const batchStart = Date.now();
|
|
2729
2732
|
const executionPromises = toolCalls.map((toolCall, index) => executeTool(toolCall, index));
|
|
2730
2733
|
const results = await Promise.all(executionPromises);
|
|
2734
|
+
ctx.turnMetrics.addToolTime(Date.now() - batchStart);
|
|
2731
2735
|
results.sort((a, b) => a.index - b.index);
|
|
2732
2736
|
for (const result of results) {
|
|
2733
2737
|
toolMessages.push({
|
|
@@ -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) {
|
|
@@ -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
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
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-
|
|
3764
|
+
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-Z6KF35SO.js");
|
|
3737
3765
|
const toolRegistry = getToolRegistryForAgent2(agentDef);
|
|
3738
3766
|
const turnMetrics = new TurnMetrics();
|
|
3739
3767
|
const result = await executeSubAgent({
|
|
@@ -4783,4 +4811,4 @@ export {
|
|
|
4783
4811
|
getToolRegistryForAgent,
|
|
4784
4812
|
createToolRegistry
|
|
4785
4813
|
};
|
|
4786
|
-
//# sourceMappingURL=chunk-
|
|
4814
|
+
//# sourceMappingURL=chunk-7S6FKODI.js.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
injectWorkflowKickoffIfNeeded,
|
|
4
4
|
runAgentTurn,
|
|
5
5
|
runChatTurn
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-7EHJPONC.js";
|
|
7
7
|
import {
|
|
8
8
|
COMPACTION_PROMPT,
|
|
9
9
|
TurnMetrics,
|
|
@@ -58,7 +58,7 @@ import {
|
|
|
58
58
|
skillExists,
|
|
59
59
|
spawnShellProcess,
|
|
60
60
|
streamLLMPure
|
|
61
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-7S6FKODI.js";
|
|
62
62
|
import {
|
|
63
63
|
getPathSeparator,
|
|
64
64
|
getPlatformShell,
|
|
@@ -95,11 +95,11 @@ import {
|
|
|
95
95
|
updateSessionMetadata,
|
|
96
96
|
updateSessionProvider,
|
|
97
97
|
updateSessionRunning
|
|
98
|
-
} from "./chunk-
|
|
98
|
+
} from "./chunk-SYG2ENUQ.js";
|
|
99
99
|
import {
|
|
100
100
|
buildMessagesFromStoredEvents,
|
|
101
101
|
foldPendingConfirmations
|
|
102
|
-
} from "./chunk-
|
|
102
|
+
} from "./chunk-LX66KJPL.js";
|
|
103
103
|
import {
|
|
104
104
|
createChatErrorMessage,
|
|
105
105
|
createChatMessageMessage,
|
|
@@ -114,11 +114,11 @@ import {
|
|
|
114
114
|
parseClientMessage,
|
|
115
115
|
serializeServerMessage,
|
|
116
116
|
storedEventToServerMessage
|
|
117
|
-
} from "./chunk-
|
|
117
|
+
} from "./chunk-3QB2RMX2.js";
|
|
118
118
|
import {
|
|
119
119
|
EventEmitter,
|
|
120
120
|
provideAnswer
|
|
121
|
-
} from "./chunk-
|
|
121
|
+
} from "./chunk-EU3WWTFH.js";
|
|
122
122
|
import {
|
|
123
123
|
initDatabase
|
|
124
124
|
} from "./chunk-FBGWG4N6.js";
|
|
@@ -127,7 +127,7 @@ import {
|
|
|
127
127
|
} from "./chunk-VUQCQXXJ.js";
|
|
128
128
|
import {
|
|
129
129
|
createServerMessage
|
|
130
|
-
} from "./chunk-
|
|
130
|
+
} from "./chunk-5BDVM6YI.js";
|
|
131
131
|
import {
|
|
132
132
|
getGlobalConfigDir
|
|
133
133
|
} from "./chunk-CQGTEGKL.js";
|
|
@@ -690,6 +690,26 @@ var RULES = [
|
|
|
690
690
|
// -------------------------------------------------------------------------
|
|
691
691
|
// Ask User Tool
|
|
692
692
|
// -------------------------------------------------------------------------
|
|
693
|
+
// Specific type rules must come before generic ask rules
|
|
694
|
+
{
|
|
695
|
+
match: /confirm.*question/i,
|
|
696
|
+
tools: [{ name: "ask_user", arguments: { question: "Do you approve?", type: "confirm" } }],
|
|
697
|
+
response: "I asked a confirm question."
|
|
698
|
+
},
|
|
699
|
+
{
|
|
700
|
+
match: /choose.*option/i,
|
|
701
|
+
tools: [
|
|
702
|
+
{
|
|
703
|
+
name: "ask_user",
|
|
704
|
+
arguments: {
|
|
705
|
+
question: "Which option do you prefer?",
|
|
706
|
+
type: "choice",
|
|
707
|
+
options: ["Option A", "Option B", "Option C"]
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
],
|
|
711
|
+
response: "I asked a choice question."
|
|
712
|
+
},
|
|
693
713
|
{
|
|
694
714
|
match: /ask.*user|ask.*question|clarif/i,
|
|
695
715
|
tools: [{ name: "ask_user", arguments: { question: "What would you like me to do?" } }],
|
|
@@ -3263,7 +3283,12 @@ async function handleClientMessage(ws, client, message, _getLLMClient, _getActiv
|
|
|
3263
3283
|
const compactEvents = compactEventStore.getEvents(sessionId);
|
|
3264
3284
|
const compactMessages = buildMessagesFromStoredEvents(compactEvents);
|
|
3265
3285
|
const pendingConfirmations = foldPendingConfirmations(compactEvents);
|
|
3266
|
-
|
|
3286
|
+
const { getPendingQuestionsForSession } = await import("./tools-Z6KF35SO.js");
|
|
3287
|
+
const pendingQuestions = getPendingQuestionsForSession(sessionId);
|
|
3288
|
+
sendForSession(
|
|
3289
|
+
sessionId,
|
|
3290
|
+
createSessionStateMessage(updatedSession, compactMessages, pendingConfirmations, pendingQuestions)
|
|
3291
|
+
);
|
|
3267
3292
|
} catch (error) {
|
|
3268
3293
|
logger.error("Compaction failed", { error, sessionId });
|
|
3269
3294
|
sendForSession(
|
|
@@ -3471,8 +3496,8 @@ ${content}` : workflowInfo;
|
|
|
3471
3496
|
send(createErrorMessage("INVALID_PAYLOAD", "Invalid ask.answer payload", message.id));
|
|
3472
3497
|
return;
|
|
3473
3498
|
}
|
|
3474
|
-
const { callId, answer } = message.payload;
|
|
3475
|
-
const found = provideAnswer(callId, answer);
|
|
3499
|
+
const { callId, answer, skip } = message.payload;
|
|
3500
|
+
const found = provideAnswer(callId, answer, skip);
|
|
3476
3501
|
if (!found) {
|
|
3477
3502
|
send(createErrorMessage("NOT_FOUND", "No pending question with that ID", message.id));
|
|
3478
3503
|
return;
|
|
@@ -5793,7 +5818,7 @@ import { Router as Router6 } from "express";
|
|
|
5793
5818
|
import { spawn as spawn5 } from "child_process";
|
|
5794
5819
|
|
|
5795
5820
|
// src/constants.ts
|
|
5796
|
-
var VERSION = "2.0.
|
|
5821
|
+
var VERSION = "2.0.5";
|
|
5797
5822
|
|
|
5798
5823
|
// src/server/routes/auto-update.ts
|
|
5799
5824
|
var updateInProgress = false;
|
|
@@ -6086,7 +6111,7 @@ async function createServerHandle(config4) {
|
|
|
6086
6111
|
res.json({ project });
|
|
6087
6112
|
});
|
|
6088
6113
|
app.get("/api/sessions", async (req, res) => {
|
|
6089
|
-
const { getRecentUserPromptsForSession } = await import("./events-
|
|
6114
|
+
const { getRecentUserPromptsForSession } = await import("./events-4K52FKPR.js");
|
|
6090
6115
|
const projectId = req.query["projectId"];
|
|
6091
6116
|
const limit = Math.min(parseInt(req.query["limit"]) || 20, 100);
|
|
6092
6117
|
const offset = parseInt(req.query["offset"]) || 0;
|
|
@@ -6119,8 +6144,9 @@ async function createServerHandle(config4) {
|
|
|
6119
6144
|
res.status(201).json({ session });
|
|
6120
6145
|
});
|
|
6121
6146
|
app.get("/api/sessions/:id", async (req, res) => {
|
|
6122
|
-
const { getEventStore: getEventStore2 } = await import("./events-
|
|
6123
|
-
const { buildMessagesFromStoredEvents: buildMessagesFromStoredEvents2 } = await import("./folding-
|
|
6147
|
+
const { getEventStore: getEventStore2 } = await import("./events-4K52FKPR.js");
|
|
6148
|
+
const { buildMessagesFromStoredEvents: buildMessagesFromStoredEvents2 } = await import("./folding-QIBNKYA6.js");
|
|
6149
|
+
const { getPendingQuestionsForSession } = await import("./tools-Z6KF35SO.js");
|
|
6124
6150
|
const session = sessionManager.getSession(req.params.id);
|
|
6125
6151
|
if (!session) {
|
|
6126
6152
|
return res.status(404).json({ error: "Session not found" });
|
|
@@ -6130,7 +6156,8 @@ async function createServerHandle(config4) {
|
|
|
6130
6156
|
const messages = buildMessagesFromStoredEvents2(events);
|
|
6131
6157
|
const contextState = sessionManager.getContextState(req.params.id);
|
|
6132
6158
|
const queueState = sessionManager.getQueueState(req.params.id);
|
|
6133
|
-
|
|
6159
|
+
const pendingQuestions = getPendingQuestionsForSession(req.params.id);
|
|
6160
|
+
res.json({ session, messages, contextState, queueState, pendingQuestions });
|
|
6134
6161
|
});
|
|
6135
6162
|
app.delete("/api/sessions/:id", (req, res) => {
|
|
6136
6163
|
const session = sessionManager.getSession(req.params["id"]);
|
|
@@ -6150,8 +6177,8 @@ async function createServerHandle(config4) {
|
|
|
6150
6177
|
res.json({ success: true });
|
|
6151
6178
|
});
|
|
6152
6179
|
app.post("/api/sessions/:id/provider", async (req, res) => {
|
|
6153
|
-
const { getEventStore: getEventStore2 } = await import("./events-
|
|
6154
|
-
const { buildMessagesFromStoredEvents: buildMessagesFromStoredEvents2 } = await import("./folding-
|
|
6180
|
+
const { getEventStore: getEventStore2 } = await import("./events-4K52FKPR.js");
|
|
6181
|
+
const { buildMessagesFromStoredEvents: buildMessagesFromStoredEvents2 } = await import("./folding-QIBNKYA6.js");
|
|
6155
6182
|
const sessionId = req.params.id;
|
|
6156
6183
|
const session = sessionManager.getSession(sessionId);
|
|
6157
6184
|
if (!session) {
|
|
@@ -6193,8 +6220,8 @@ async function createServerHandle(config4) {
|
|
|
6193
6220
|
res.json({ success: true });
|
|
6194
6221
|
});
|
|
6195
6222
|
app.put("/api/sessions/:id/mode", async (req, res) => {
|
|
6196
|
-
const { getEventStore: getEventStore2 } = await import("./events-
|
|
6197
|
-
const { buildMessagesFromStoredEvents: buildMessagesFromStoredEvents2 } = await import("./folding-
|
|
6223
|
+
const { getEventStore: getEventStore2 } = await import("./events-4K52FKPR.js");
|
|
6224
|
+
const { buildMessagesFromStoredEvents: buildMessagesFromStoredEvents2 } = await import("./folding-QIBNKYA6.js");
|
|
6198
6225
|
const sessionId = req.params.id;
|
|
6199
6226
|
const session = sessionManager.getSession(sessionId);
|
|
6200
6227
|
if (!session) {
|
|
@@ -6250,32 +6277,37 @@ async function createServerHandle(config4) {
|
|
|
6250
6277
|
if (!callId || approved === void 0) {
|
|
6251
6278
|
return res.status(400).json({ error: "callId and approved are required" });
|
|
6252
6279
|
}
|
|
6253
|
-
const { providePathConfirmation } = await import("./tools-
|
|
6280
|
+
const { providePathConfirmation } = await import("./tools-Z6KF35SO.js");
|
|
6254
6281
|
const result = providePathConfirmation(callId, approved, alwaysAllow);
|
|
6255
6282
|
if (!result.found) {
|
|
6256
6283
|
return res.status(404).json({ error: "No pending path confirmation with that ID" });
|
|
6257
6284
|
}
|
|
6258
|
-
const { getEventStore: getEventStore2 } = await import("./events-
|
|
6259
|
-
const { buildMessagesFromStoredEvents: buildMessagesFromStoredEvents2, foldPendingConfirmations: foldPendingConfirmations2 } = await import("./folding-
|
|
6260
|
-
const { createSessionStateMessage: createSessionStateMessage2 } = await import("./protocol-
|
|
6285
|
+
const { getEventStore: getEventStore2 } = await import("./events-4K52FKPR.js");
|
|
6286
|
+
const { buildMessagesFromStoredEvents: buildMessagesFromStoredEvents2, foldPendingConfirmations: foldPendingConfirmations2 } = await import("./folding-QIBNKYA6.js");
|
|
6287
|
+
const { createSessionStateMessage: createSessionStateMessage2 } = await import("./protocol-YYWMFR35.js");
|
|
6288
|
+
const { getPendingQuestionsForSession } = await import("./tools-Z6KF35SO.js");
|
|
6261
6289
|
const eventStore = getEventStore2();
|
|
6262
6290
|
const events = eventStore.getEvents(sessionId);
|
|
6263
6291
|
const messages = buildMessagesFromStoredEvents2(events);
|
|
6264
6292
|
const pendingConfirmations = foldPendingConfirmations2(events);
|
|
6293
|
+
const pendingQuestions = getPendingQuestionsForSession(sessionId);
|
|
6265
6294
|
const session = sessionManager.getSession(sessionId);
|
|
6266
6295
|
if (session) {
|
|
6267
|
-
const stateMsg = createSessionStateMessage2(session, messages, pendingConfirmations);
|
|
6296
|
+
const stateMsg = createSessionStateMessage2(session, messages, pendingConfirmations, pendingQuestions);
|
|
6268
6297
|
wssExports.broadcastForSession(sessionId, { ...stateMsg, sessionId });
|
|
6269
6298
|
}
|
|
6270
6299
|
res.json({ success: true });
|
|
6271
6300
|
});
|
|
6272
6301
|
app.post("/api/sessions/:id/answer", async (req, res) => {
|
|
6273
|
-
const { callId, answer } = req.body;
|
|
6274
|
-
if (!callId
|
|
6275
|
-
return res.status(400).json({ error: "callId
|
|
6302
|
+
const { callId, answer, skip } = req.body;
|
|
6303
|
+
if (!callId) {
|
|
6304
|
+
return res.status(400).json({ error: "callId is required" });
|
|
6305
|
+
}
|
|
6306
|
+
if (!skip && typeof answer !== "string") {
|
|
6307
|
+
return res.status(400).json({ error: "answer is required when not skipping" });
|
|
6276
6308
|
}
|
|
6277
|
-
const { provideAnswer: provideAnswer2 } = await import("./tools-
|
|
6278
|
-
const found = provideAnswer2(callId, answer);
|
|
6309
|
+
const { provideAnswer: provideAnswer2 } = await import("./tools-Z6KF35SO.js");
|
|
6310
|
+
const found = provideAnswer2(callId, answer ?? "", skip ?? false);
|
|
6279
6311
|
if (!found) {
|
|
6280
6312
|
return res.status(404).json({ error: "No pending question with that ID" });
|
|
6281
6313
|
}
|
|
@@ -6310,15 +6342,15 @@ async function createServerHandle(config4) {
|
|
|
6310
6342
|
if (!session) {
|
|
6311
6343
|
return res.status(404).json({ error: "Session not found" });
|
|
6312
6344
|
}
|
|
6313
|
-
const { stopSessionExecution } = await import("./chat-handler-
|
|
6314
|
-
const { cancelQuestionsForSession, cancelPathConfirmationsForSession } = await import("./tools-
|
|
6345
|
+
const { stopSessionExecution } = await import("./chat-handler-RQXMBCKX.js");
|
|
6346
|
+
const { cancelQuestionsForSession, cancelPathConfirmationsForSession } = await import("./tools-Z6KF35SO.js");
|
|
6315
6347
|
const queuedMessages = sessionManager.getQueueState(sessionId);
|
|
6316
6348
|
sessionManager.clearMessageQueue(sessionId);
|
|
6317
6349
|
stopSessionExecution(sessionId, sessionManager);
|
|
6318
6350
|
abortSession(sessionId);
|
|
6319
6351
|
cancelQuestionsForSession(sessionId, "Session stopped by user");
|
|
6320
6352
|
cancelPathConfirmationsForSession(sessionId, "Session stopped by user");
|
|
6321
|
-
const eventStore = (await import("./events-
|
|
6353
|
+
const eventStore = (await import("./events-4K52FKPR.js")).getEventStore();
|
|
6322
6354
|
eventStore.append(sessionId, { type: "running.changed", data: { isRunning: false } });
|
|
6323
6355
|
res.json({ success: true, queuedMessages });
|
|
6324
6356
|
});
|
|
@@ -6332,7 +6364,7 @@ async function createServerHandle(config4) {
|
|
|
6332
6364
|
if (typeof messageIndex !== "number" || messageIndex < 0) {
|
|
6333
6365
|
return res.status(400).json({ error: "messageIndex must be a non-negative number" });
|
|
6334
6366
|
}
|
|
6335
|
-
const { truncateSessionMessages } = await import("./events-
|
|
6367
|
+
const { truncateSessionMessages } = await import("./events-4K52FKPR.js");
|
|
6336
6368
|
truncateSessionMessages(sessionId, messageIndex);
|
|
6337
6369
|
res.json({ success: true });
|
|
6338
6370
|
});
|
|
@@ -6350,7 +6382,7 @@ async function createServerHandle(config4) {
|
|
|
6350
6382
|
if (!msg) {
|
|
6351
6383
|
return res.status(400).json({ error: "Message not found at this index" });
|
|
6352
6384
|
}
|
|
6353
|
-
const { truncateSessionMessages } = await import("./events-
|
|
6385
|
+
const { truncateSessionMessages } = await import("./events-4K52FKPR.js");
|
|
6354
6386
|
truncateSessionMessages(sessionId, messageIndex - 1);
|
|
6355
6387
|
sessionManager.queueMessage(sessionId, "asap", msg.content, msg.attachments, msg.messageKind);
|
|
6356
6388
|
res.json({ success: true });
|
|
@@ -6921,7 +6953,7 @@ async function createServerHandle(config4) {
|
|
|
6921
6953
|
providerManager
|
|
6922
6954
|
);
|
|
6923
6955
|
const wss = wssExports.wss;
|
|
6924
|
-
const { QueueProcessor } = await import("./processor-
|
|
6956
|
+
const { QueueProcessor } = await import("./processor-KRBBTKRS.js");
|
|
6925
6957
|
const queueProcessor = new QueueProcessor({
|
|
6926
6958
|
sessionManager,
|
|
6927
6959
|
providerManager,
|
|
@@ -6995,4 +7027,4 @@ export {
|
|
|
6995
7027
|
createServerHandle,
|
|
6996
7028
|
createServer
|
|
6997
7029
|
};
|
|
6998
|
-
//# sourceMappingURL=chunk-
|
|
7030
|
+
//# sourceMappingURL=chunk-DXV74LCI.js.map
|