openfox 1.6.45 → 1.6.47
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-2AI46SNC.js → auto-compaction-7RDQVOYK.js} +6 -6
- package/dist/{chat-handler-ITVOWLJR.js → chat-handler-TTCW7DIB.js} +10 -10
- package/dist/{chunk-SMK6HIR5.js → chunk-22JBSK6P.js} +23 -42
- package/dist/{chunk-RB576RLK.js → chunk-4DR3WUVA.js} +99 -60
- package/dist/{chunk-BF7JQWEL.js → chunk-BHSTSA7U.js} +4 -4
- package/dist/{chunk-HSSXBW6N.js → chunk-DZHZ3UUR.js} +14 -2
- package/dist/{chunk-G6JKXYFE.js → chunk-LIMBYVO4.js} +58 -1
- package/dist/{chunk-FBUTQPJ6.js → chunk-NBBX64KC.js} +4 -5
- package/dist/{chunk-GY4TRYOG.js → chunk-SGOTQ7R3.js} +18 -13
- package/dist/{chunk-KBEOYUA3.js → chunk-SNIBI4L4.js} +2 -2
- package/dist/{chunk-53DUI4MS.js → chunk-Y6HBEACI.js} +1 -1
- package/dist/{chunk-ZSQFDQPH.js → chunk-YVQ6DP5Y.js} +23 -5
- package/dist/cli/dev.js +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/{events-DFDD4BRS.js → events-FHPSSSE4.js} +7 -3
- package/dist/{folding-JSQFCDZO.js → folding-NEZWWL7K.js} +4 -2
- package/dist/{orchestrator-7ZXXNEEC.js → orchestrator-DIJO4BJ7.js} +7 -11
- package/dist/package.json +1 -1
- package/dist/{processor-6CITCUJR.js → processor-YLKEJ7QC.js} +11 -12
- package/dist/{protocol-IWXXOGWM.js → protocol-YNVBDNL7.js} +7 -3
- package/dist/{protocol-B4lesmg5.d.ts → protocol-_A3Upt5b.d.ts} +15 -7
- package/dist/{serve-BCRWEL5U.js → serve-4I7FE32H.js} +9 -9
- package/dist/server/index.d.ts +11 -2
- package/dist/server/index.js +8 -8
- package/dist/shared/index.d.ts +2 -2
- package/dist/shared/index.js +1 -1
- package/dist/{tools-K7TJWICQ.js → tools-E3UECGKO.js} +6 -6
- package/dist/web/assets/{index-Bl-fM2P0.js → index-CK4F8AG6.js} +66 -66
- package/dist/web/assets/{index-DzPKzXc0.css → index-DFE4PMXP.css} +1 -1
- package/dist/web/index.html +2 -2
- package/dist/web/sw.js +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createServerMessage,
|
|
3
3
|
isClientMessage
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-Y6HBEACI.js";
|
|
5
5
|
|
|
6
6
|
// src/server/ws/protocol.ts
|
|
7
7
|
function enrichMessagesWithToolResults(messages) {
|
|
@@ -110,6 +110,9 @@ function createChatAskUserMessage(callId, question) {
|
|
|
110
110
|
function createChatVisionFallbackMessage(payload) {
|
|
111
111
|
return createServerMessage("chat.vision_fallback", payload);
|
|
112
112
|
}
|
|
113
|
+
function createModeChangedMessage(mode, auto, reason) {
|
|
114
|
+
return createServerMessage("mode.changed", { mode, auto, ...reason ? { reason } : {} });
|
|
115
|
+
}
|
|
113
116
|
function createPhaseChangedMessage(phase) {
|
|
114
117
|
return createServerMessage("phase.changed", { phase });
|
|
115
118
|
}
|
|
@@ -135,6 +138,9 @@ function isSessionLoadPayload(payload) {
|
|
|
135
138
|
function isChatSendPayload(payload) {
|
|
136
139
|
return typeof payload === "object" && payload !== null && "content" in payload;
|
|
137
140
|
}
|
|
141
|
+
function isModeSwitchPayload(payload) {
|
|
142
|
+
return typeof payload === "object" && payload !== null && "mode" in payload;
|
|
143
|
+
}
|
|
138
144
|
function isCriteriaEditPayload(payload) {
|
|
139
145
|
return typeof payload === "object" && payload !== null && "criteria" in payload;
|
|
140
146
|
}
|
|
@@ -229,6 +235,10 @@ function storedEventToServerMessage(event) {
|
|
|
229
235
|
const data = event.data;
|
|
230
236
|
return createServerMessage("task.completed", data);
|
|
231
237
|
}
|
|
238
|
+
case "mode.changed": {
|
|
239
|
+
const data = event.data;
|
|
240
|
+
return createModeChangedMessage(data.mode, data.auto, data.reason);
|
|
241
|
+
}
|
|
232
242
|
case "running.changed": {
|
|
233
243
|
const data = event.data;
|
|
234
244
|
return createSessionRunningMessage(data.isRunning);
|
|
@@ -306,12 +316,14 @@ export {
|
|
|
306
316
|
createChatPathConfirmationMessage,
|
|
307
317
|
createChatAskUserMessage,
|
|
308
318
|
createChatVisionFallbackMessage,
|
|
319
|
+
createModeChangedMessage,
|
|
309
320
|
createPhaseChangedMessage,
|
|
310
321
|
createCriteriaUpdatedMessage,
|
|
311
322
|
createContextStateMessage,
|
|
312
323
|
createSessionNameGeneratedMessage,
|
|
313
324
|
isSessionLoadPayload,
|
|
314
325
|
isChatSendPayload,
|
|
326
|
+
isModeSwitchPayload,
|
|
315
327
|
isCriteriaEditPayload,
|
|
316
328
|
isPathConfirmPayload,
|
|
317
329
|
isAskAnswerPayload,
|
|
@@ -321,4 +333,4 @@ export {
|
|
|
321
333
|
isQueueCancelPayload,
|
|
322
334
|
storedEventToServerMessage
|
|
323
335
|
};
|
|
324
|
-
//# sourceMappingURL=chunk-
|
|
336
|
+
//# sourceMappingURL=chunk-DZHZ3UUR.js.map
|
|
@@ -151,6 +151,7 @@ function applyEvents(initialMessages, events, options) {
|
|
|
151
151
|
case "session.initialized":
|
|
152
152
|
case "turn.snapshot":
|
|
153
153
|
case "phase.changed":
|
|
154
|
+
case "mode.changed":
|
|
154
155
|
case "running.changed":
|
|
155
156
|
case "criteria.set":
|
|
156
157
|
case "criterion.updated":
|
|
@@ -500,6 +501,16 @@ function foldContextState(events, initialWindowId) {
|
|
|
500
501
|
latestContextState
|
|
501
502
|
};
|
|
502
503
|
}
|
|
504
|
+
function foldMode(events) {
|
|
505
|
+
let mode = "planner";
|
|
506
|
+
for (const event of events) {
|
|
507
|
+
if (event.type === "mode.changed") {
|
|
508
|
+
const data = event.data;
|
|
509
|
+
mode = data.mode;
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
return mode;
|
|
513
|
+
}
|
|
503
514
|
function foldPhase(events) {
|
|
504
515
|
let phase = "plan";
|
|
505
516
|
for (const event of events) {
|
|
@@ -546,6 +557,7 @@ function foldPendingConfirmations(events) {
|
|
|
546
557
|
return pending;
|
|
547
558
|
}
|
|
548
559
|
function foldSessionState(events, initialWindowId, maxTokens, initialMessages) {
|
|
560
|
+
const mode = foldMode(events);
|
|
549
561
|
const phase = foldPhase(events);
|
|
550
562
|
const isRunning = foldIsRunning(events);
|
|
551
563
|
const messages = initialMessages && initialMessages.length > 0 ? foldTurnEventsToSnapshotMessagesFromInitial(events, initialMessages) : foldTurnEventsToSnapshotMessages(events);
|
|
@@ -561,6 +573,45 @@ function foldSessionState(events, initialWindowId, maxTokens, initialMessages) {
|
|
|
561
573
|
canCompact: false
|
|
562
574
|
};
|
|
563
575
|
const contextState = baseContextState.compactionCount !== contextResult.compactionCount || baseContextState.maxTokens !== maxTokens ? { ...baseContextState, compactionCount: contextResult.compactionCount, maxTokens } : { ...baseContextState, maxTokens };
|
|
576
|
+
let lastModeWithReminder;
|
|
577
|
+
for (let i = events.length - 1; i >= 0; i--) {
|
|
578
|
+
const event = events[i];
|
|
579
|
+
if (event.type === "turn.snapshot") {
|
|
580
|
+
const snapshotData = event.data;
|
|
581
|
+
if (snapshotData.lastModeWithReminder) {
|
|
582
|
+
lastModeWithReminder = snapshotData.lastModeWithReminder;
|
|
583
|
+
break;
|
|
584
|
+
}
|
|
585
|
+
for (let j = snapshotData.messages.length - 1; j >= 0; j--) {
|
|
586
|
+
const msg = snapshotData.messages[j];
|
|
587
|
+
if (msg.role === "user" && msg.messageKind === "auto-prompt" && msg.content?.includes("<system-reminder>")) {
|
|
588
|
+
if (msg.content.includes("Plan Mode")) {
|
|
589
|
+
lastModeWithReminder = "planner";
|
|
590
|
+
} else if (msg.content.includes("Build Mode")) {
|
|
591
|
+
lastModeWithReminder = "builder";
|
|
592
|
+
}
|
|
593
|
+
break;
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
if (lastModeWithReminder) break;
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
if (lastModeWithReminder === void 0) {
|
|
600
|
+
for (let i = events.length - 1; i >= 0; i--) {
|
|
601
|
+
const event = events[i];
|
|
602
|
+
if (event.type === "message.start") {
|
|
603
|
+
const data = event.data;
|
|
604
|
+
if (data.role === "user" && data.messageKind === "auto-prompt" && data.content?.includes("<system-reminder>")) {
|
|
605
|
+
if (data.content.includes("Plan Mode")) {
|
|
606
|
+
lastModeWithReminder = "planner";
|
|
607
|
+
} else if (data.content.includes("Build Mode")) {
|
|
608
|
+
lastModeWithReminder = "builder";
|
|
609
|
+
}
|
|
610
|
+
break;
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
}
|
|
564
615
|
let sessionInit;
|
|
565
616
|
let sessionTitle;
|
|
566
617
|
let visionFallbacks = [];
|
|
@@ -643,6 +694,7 @@ function foldSessionState(events, initialWindowId, maxTokens, initialMessages) {
|
|
|
643
694
|
}
|
|
644
695
|
}
|
|
645
696
|
return {
|
|
697
|
+
mode,
|
|
646
698
|
phase,
|
|
647
699
|
isRunning,
|
|
648
700
|
messages,
|
|
@@ -651,6 +703,7 @@ function foldSessionState(events, initialWindowId, maxTokens, initialMessages) {
|
|
|
651
703
|
contextState,
|
|
652
704
|
currentContextWindowId: contextResult.currentContextWindowId,
|
|
653
705
|
readFiles: contextResult.readFiles,
|
|
706
|
+
...lastModeWithReminder !== void 0 && { lastModeWithReminder },
|
|
654
707
|
pendingConfirmations,
|
|
655
708
|
...sessionInit !== void 0 && { sessionInit },
|
|
656
709
|
...sessionTitle !== void 0 && { sessionTitle },
|
|
@@ -664,6 +717,7 @@ function foldSessionState(events, initialWindowId, maxTokens, initialMessages) {
|
|
|
664
717
|
}
|
|
665
718
|
function buildSnapshot(foldedState, latestSeq, snapshotAt = Date.now()) {
|
|
666
719
|
return {
|
|
720
|
+
mode: foldedState.mode,
|
|
667
721
|
phase: foldedState.phase,
|
|
668
722
|
isRunning: foldedState.isRunning,
|
|
669
723
|
messages: foldedState.messages,
|
|
@@ -672,6 +726,7 @@ function buildSnapshot(foldedState, latestSeq, snapshotAt = Date.now()) {
|
|
|
672
726
|
currentContextWindowId: foldedState.currentContextWindowId,
|
|
673
727
|
todos: foldedState.todos,
|
|
674
728
|
readFiles: foldedState.readFiles,
|
|
729
|
+
...foldedState.lastModeWithReminder !== void 0 && { lastModeWithReminder: foldedState.lastModeWithReminder },
|
|
675
730
|
snapshotSeq: latestSeq,
|
|
676
731
|
snapshotAt,
|
|
677
732
|
...foldedState.sessionInit !== void 0 && { sessionInit: foldedState.sessionInit },
|
|
@@ -707,6 +762,7 @@ function buildSnapshotFromSessionState(input) {
|
|
|
707
762
|
) : foldedState.messages;
|
|
708
763
|
stripPromptContextMessages(messages);
|
|
709
764
|
return {
|
|
765
|
+
mode: session.mode,
|
|
710
766
|
phase: session.phase,
|
|
711
767
|
isRunning: session.isRunning,
|
|
712
768
|
messages,
|
|
@@ -749,6 +805,7 @@ export {
|
|
|
749
805
|
foldCriteria,
|
|
750
806
|
foldTodos,
|
|
751
807
|
foldContextState,
|
|
808
|
+
foldMode,
|
|
752
809
|
foldPhase,
|
|
753
810
|
foldIsRunning,
|
|
754
811
|
foldPendingConfirmations,
|
|
@@ -758,4 +815,4 @@ export {
|
|
|
758
815
|
getMessagesForWindow,
|
|
759
816
|
buildContextMessagesFromMessages
|
|
760
817
|
};
|
|
761
|
-
//# sourceMappingURL=chunk-
|
|
818
|
+
//# sourceMappingURL=chunk-LIMBYVO4.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getEventStore
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-YVQ6DP5Y.js";
|
|
4
4
|
import {
|
|
5
5
|
createContextStateMessage
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-DZHZ3UUR.js";
|
|
7
7
|
|
|
8
8
|
// src/server/utils/session-utils.ts
|
|
9
9
|
function getSessionMessageCount(sessionId) {
|
|
@@ -32,8 +32,7 @@ function buildRunChatTurnParams(params) {
|
|
|
32
32
|
llmClient: params.llmClient,
|
|
33
33
|
signal: params.signal,
|
|
34
34
|
onMessage: params.onMessage,
|
|
35
|
-
...params.statsIdentity ? { statsIdentity: params.statsIdentity } : {}
|
|
36
|
-
...params.agentId ? { agentId: params.agentId } : {}
|
|
35
|
+
...params.statsIdentity ? { statsIdentity: params.statsIdentity } : {}
|
|
37
36
|
};
|
|
38
37
|
}
|
|
39
38
|
|
|
@@ -42,4 +41,4 @@ export {
|
|
|
42
41
|
finalizeTurnCompletion,
|
|
43
42
|
buildRunChatTurnParams
|
|
44
43
|
};
|
|
45
|
-
//# sourceMappingURL=chunk-
|
|
44
|
+
//# sourceMappingURL=chunk-NBBX64KC.js.map
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
getContextMessages,
|
|
25
25
|
getCurrentContextWindowId,
|
|
26
26
|
getEventStore
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-YVQ6DP5Y.js";
|
|
28
28
|
import {
|
|
29
29
|
createChatDoneMessage,
|
|
30
30
|
createChatMessageMessage,
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
createChatToolOutputMessage,
|
|
34
34
|
createChatVisionFallbackMessage,
|
|
35
35
|
createQueueStateMessage
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-DZHZ3UUR.js";
|
|
37
37
|
import {
|
|
38
38
|
AskUserInterrupt,
|
|
39
39
|
askUserTool
|
|
@@ -151,19 +151,21 @@ function shouldCompact(currentTokens, maxTokens, threshold) {
|
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
// src/server/chat/prompts.ts
|
|
154
|
-
function buildBasePrompt(workdir, customInstructions, skills) {
|
|
154
|
+
function buildBasePrompt(workdir, customInstructions, skills, modelName) {
|
|
155
155
|
const instructionsSection = customInstructions ? `
|
|
156
156
|
|
|
157
157
|
## CUSTOM INSTRUCTIONS
|
|
158
158
|
|
|
159
159
|
${customInstructions}` : "";
|
|
160
|
+
const modelLine = modelName ? `
|
|
161
|
+
Model: ${modelName}` : "";
|
|
160
162
|
return `You are OpenFox, an agentic assistant.
|
|
161
163
|
|
|
162
164
|
Today's date is ${(/* @__PURE__ */ new Date()).toISOString().split("T")[0].replace(/-/g, "/")}
|
|
163
165
|
|
|
164
166
|
## ENVIRONMENT
|
|
165
167
|
Working directory: ${workdir}
|
|
166
|
-
Platform: ${process.platform} (${process.arch})
|
|
168
|
+
Platform: ${process.platform} (${process.arch})${modelLine}
|
|
167
169
|
|
|
168
170
|
## CORE BEHAVIOR
|
|
169
171
|
- Help the user complete any tasks safely and efficiently.
|
|
@@ -310,13 +312,13 @@ To call a sub-agent, use the call_sub_agent tool with:
|
|
|
310
312
|
- prompt: Clear description of what you need
|
|
311
313
|
`;
|
|
312
314
|
}
|
|
313
|
-
function buildTopLevelSystemPrompt(workdir, customInstructions, skills, subAgentDefs) {
|
|
314
|
-
const base = buildBasePrompt(workdir, customInstructions, skills);
|
|
315
|
+
function buildTopLevelSystemPrompt(workdir, customInstructions, skills, subAgentDefs, modelName) {
|
|
316
|
+
const base = buildBasePrompt(workdir, customInstructions, skills, modelName);
|
|
315
317
|
const subAgents = subAgentDefs ? buildSubAgentsSection(subAgentDefs) : "";
|
|
316
318
|
return base + subAgents;
|
|
317
319
|
}
|
|
318
|
-
function buildSubAgentSystemPrompt(workdir, agentDef, skills) {
|
|
319
|
-
const base = buildBasePrompt(workdir, void 0, skills);
|
|
320
|
+
function buildSubAgentSystemPrompt(workdir, agentDef, skills, modelName) {
|
|
321
|
+
const base = buildBasePrompt(workdir, void 0, skills, modelName);
|
|
320
322
|
return base + "\n\n" + agentDef.prompt;
|
|
321
323
|
}
|
|
322
324
|
function buildToolPermissionsSection(allowedTools, isSubAgent) {
|
|
@@ -473,7 +475,8 @@ function assembleAgentRequest(input) {
|
|
|
473
475
|
const systemPrompt2 = buildSubAgentSystemPrompt(
|
|
474
476
|
baseInput.workdir,
|
|
475
477
|
agentDef,
|
|
476
|
-
baseInput.skills
|
|
478
|
+
baseInput.skills,
|
|
479
|
+
baseInput.modelName
|
|
477
480
|
);
|
|
478
481
|
return buildAssemblyInput(systemPrompt2, baseInput);
|
|
479
482
|
}
|
|
@@ -481,7 +484,8 @@ function assembleAgentRequest(input) {
|
|
|
481
484
|
baseInput.workdir,
|
|
482
485
|
baseInput.customInstructions,
|
|
483
486
|
baseInput.skills,
|
|
484
|
-
subAgentDefs
|
|
487
|
+
subAgentDefs,
|
|
488
|
+
baseInput.modelName
|
|
485
489
|
);
|
|
486
490
|
return buildAssemblyInput(systemPrompt, baseInput);
|
|
487
491
|
}
|
|
@@ -3124,7 +3128,8 @@ async function executeSubAgent(options) {
|
|
|
3124
3128
|
const systemPrompt = buildSubAgentSystemPrompt(
|
|
3125
3129
|
session.workdir,
|
|
3126
3130
|
agentDef,
|
|
3127
|
-
skills.length > 0 ? skills : void 0
|
|
3131
|
+
skills.length > 0 ? skills : void 0,
|
|
3132
|
+
llmClient.getModel()
|
|
3128
3133
|
);
|
|
3129
3134
|
let customMessages = [...contextMessages];
|
|
3130
3135
|
let consecutiveEmptyStops = 0;
|
|
@@ -3353,7 +3358,7 @@ var callSubAgentTool = {
|
|
|
3353
3358
|
};
|
|
3354
3359
|
}
|
|
3355
3360
|
try {
|
|
3356
|
-
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-
|
|
3361
|
+
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-E3UECGKO.js");
|
|
3357
3362
|
const toolRegistry = getToolRegistryForAgent2(agentDef);
|
|
3358
3363
|
const turnMetrics = new TurnMetrics();
|
|
3359
3364
|
const result = await executeSubAgent({
|
|
@@ -4482,4 +4487,4 @@ export {
|
|
|
4482
4487
|
getToolRegistryForAgent,
|
|
4483
4488
|
createToolRegistry
|
|
4484
4489
|
};
|
|
4485
|
-
//# sourceMappingURL=chunk-
|
|
4490
|
+
//# sourceMappingURL=chunk-SGOTQ7R3.js.map
|
|
@@ -179,7 +179,7 @@ async function runCli(options) {
|
|
|
179
179
|
if (!configExists) {
|
|
180
180
|
await runNetworkSetup(mode);
|
|
181
181
|
}
|
|
182
|
-
const { runServe } = await import("./serve-
|
|
182
|
+
const { runServe } = await import("./serve-4I7FE32H.js");
|
|
183
183
|
await runServe({
|
|
184
184
|
mode,
|
|
185
185
|
port: values.port ? parseInt(values.port) : void 0,
|
|
@@ -192,4 +192,4 @@ async function runCli(options) {
|
|
|
192
192
|
export {
|
|
193
193
|
runCli
|
|
194
194
|
};
|
|
195
|
-
//# sourceMappingURL=chunk-
|
|
195
|
+
//# sourceMappingURL=chunk-SNIBI4L4.js.map
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
foldSessionState,
|
|
7
7
|
spreadOptionalMessageFields,
|
|
8
8
|
stripPromptContextMessages
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-LIMBYVO4.js";
|
|
10
10
|
import {
|
|
11
11
|
getDatabase
|
|
12
12
|
} from "./chunk-BLNFJ22S.js";
|
|
@@ -320,7 +320,7 @@ var EventStore = class {
|
|
|
320
320
|
* Clean up old events, keeping only:
|
|
321
321
|
* - session.initialized event (seq 1)
|
|
322
322
|
* - All snapshot events
|
|
323
|
-
* - State-changing events (criteria.set, criterion.updated, phase.changed, context.state, etc.)
|
|
323
|
+
* - State-changing events (criteria.set, criterion.updated, mode.changed, phase.changed, context.state, etc.)
|
|
324
324
|
* - Events after the latest snapshot (current window)
|
|
325
325
|
*
|
|
326
326
|
* This is the recommended cleanup method that preserves all snapshots and state.
|
|
@@ -339,6 +339,7 @@ var EventStore = class {
|
|
|
339
339
|
AND event_type NOT IN (
|
|
340
340
|
'criteria.set',
|
|
341
341
|
'criterion.updated',
|
|
342
|
+
'mode.changed',
|
|
342
343
|
'phase.changed',
|
|
343
344
|
'todo.updated',
|
|
344
345
|
'context.state'
|
|
@@ -544,13 +545,14 @@ function createSession(projectId, workdir, title, providerId, providerModel) {
|
|
|
544
545
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
545
546
|
const id = crypto.randomUUID();
|
|
546
547
|
db.prepare(`
|
|
547
|
-
INSERT INTO sessions (id, project_id, workdir, phase, workflow_phase, is_running, created_at, updated_at, title, provider_id, provider_model, danger_level)
|
|
548
|
-
VALUES (?, ?, ?, 'idle', 'plan', 0, ?, ?, ?, ?, ?, 'normal')
|
|
548
|
+
INSERT INTO sessions (id, project_id, workdir, phase, mode, workflow_phase, is_running, created_at, updated_at, title, provider_id, provider_model, danger_level)
|
|
549
|
+
VALUES (?, ?, ?, 'idle', 'planner', 'plan', 0, ?, ?, ?, ?, ?, 'normal')
|
|
549
550
|
`).run(id, projectId, workdir, now, now, title ?? null, providerId ?? null, providerModel ?? null);
|
|
550
551
|
return {
|
|
551
552
|
id,
|
|
552
553
|
projectId,
|
|
553
554
|
workdir,
|
|
555
|
+
mode: "planner",
|
|
554
556
|
phase: "plan",
|
|
555
557
|
isRunning: false,
|
|
556
558
|
summary: null,
|
|
@@ -583,6 +585,7 @@ function getSession(id) {
|
|
|
583
585
|
id: row.id,
|
|
584
586
|
projectId: row.project_id,
|
|
585
587
|
workdir: row.workdir,
|
|
588
|
+
mode: row.mode ?? "planner",
|
|
586
589
|
phase: row.workflow_phase ?? "plan",
|
|
587
590
|
isRunning: Boolean(row.is_running),
|
|
588
591
|
summary: row.summary ?? null,
|
|
@@ -674,6 +677,7 @@ function listSessions() {
|
|
|
674
677
|
s.id,
|
|
675
678
|
s.project_id,
|
|
676
679
|
s.workdir,
|
|
680
|
+
s.mode,
|
|
677
681
|
s.workflow_phase,
|
|
678
682
|
s.is_running,
|
|
679
683
|
s.created_at,
|
|
@@ -694,6 +698,7 @@ function listSessionsByProject(projectId, limit = 20, offset = 0) {
|
|
|
694
698
|
s.id,
|
|
695
699
|
s.project_id,
|
|
696
700
|
s.workdir,
|
|
701
|
+
s.mode,
|
|
697
702
|
s.workflow_phase,
|
|
698
703
|
s.is_running,
|
|
699
704
|
s.created_at,
|
|
@@ -721,6 +726,7 @@ function mapSessionSummaryRow(row) {
|
|
|
721
726
|
projectId: row.project_id,
|
|
722
727
|
...row.title ? { title: row.title } : {},
|
|
723
728
|
workdir: row.workdir,
|
|
729
|
+
mode: row.mode ?? "planner",
|
|
724
730
|
phase: row.workflow_phase ?? "plan",
|
|
725
731
|
isRunning: Boolean(row.is_running),
|
|
726
732
|
providerId: row.provider_id ?? null,
|
|
@@ -912,6 +918,17 @@ function emitToolResult(sessionId, messageId, toolCallId, result) {
|
|
|
912
918
|
data: { messageId, toolCallId, result }
|
|
913
919
|
});
|
|
914
920
|
}
|
|
921
|
+
function emitModeChanged(sessionId, mode, auto, reason) {
|
|
922
|
+
const eventStore = getEventStore();
|
|
923
|
+
eventStore.append(sessionId, {
|
|
924
|
+
type: "mode.changed",
|
|
925
|
+
data: {
|
|
926
|
+
mode,
|
|
927
|
+
auto,
|
|
928
|
+
...reason !== void 0 && { reason }
|
|
929
|
+
}
|
|
930
|
+
});
|
|
931
|
+
}
|
|
915
932
|
function emitPhaseChanged(sessionId, phase) {
|
|
916
933
|
const eventStore = getEventStore();
|
|
917
934
|
eventStore.append(sessionId, {
|
|
@@ -1125,6 +1142,7 @@ export {
|
|
|
1125
1142
|
emitToolCall,
|
|
1126
1143
|
emitToolOutput,
|
|
1127
1144
|
emitToolResult,
|
|
1145
|
+
emitModeChanged,
|
|
1128
1146
|
emitPhaseChanged,
|
|
1129
1147
|
emitRunningChanged,
|
|
1130
1148
|
emitCriteriaSet,
|
|
@@ -1140,4 +1158,4 @@ export {
|
|
|
1140
1158
|
compactContext,
|
|
1141
1159
|
getRecentUserPromptsForSession
|
|
1142
1160
|
};
|
|
1143
|
-
//# sourceMappingURL=chunk-
|
|
1161
|
+
//# sourceMappingURL=chunk-YVQ6DP5Y.js.map
|
package/dist/cli/dev.js
CHANGED
package/dist/cli/index.js
CHANGED
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
emitMessageDelta,
|
|
15
15
|
emitMessageDone,
|
|
16
16
|
emitMessageThinking,
|
|
17
|
+
emitModeChanged,
|
|
17
18
|
emitPhaseChanged,
|
|
18
19
|
emitRunningChanged,
|
|
19
20
|
emitSessionInitialized,
|
|
@@ -35,7 +36,7 @@ import {
|
|
|
35
36
|
isFileInCache,
|
|
36
37
|
isStoredEvent,
|
|
37
38
|
isTurnEvent
|
|
38
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-YVQ6DP5Y.js";
|
|
39
40
|
import {
|
|
40
41
|
buildContextMessagesFromEventHistory,
|
|
41
42
|
buildContextMessagesFromMessages,
|
|
@@ -46,12 +47,13 @@ import {
|
|
|
46
47
|
foldContextState,
|
|
47
48
|
foldCriteria,
|
|
48
49
|
foldIsRunning,
|
|
50
|
+
foldMode,
|
|
49
51
|
foldPhase,
|
|
50
52
|
foldSessionState,
|
|
51
53
|
foldTodos,
|
|
52
54
|
foldTurnEventsToSnapshotMessages,
|
|
53
55
|
getMessagesForWindow
|
|
54
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-LIMBYVO4.js";
|
|
55
57
|
import "./chunk-BLNFJ22S.js";
|
|
56
58
|
import "./chunk-TVQOONDR.js";
|
|
57
59
|
import "./chunk-PNBH3RAX.js";
|
|
@@ -77,6 +79,7 @@ export {
|
|
|
77
79
|
emitMessageDelta,
|
|
78
80
|
emitMessageDone,
|
|
79
81
|
emitMessageThinking,
|
|
82
|
+
emitModeChanged,
|
|
80
83
|
emitPhaseChanged,
|
|
81
84
|
emitRunningChanged,
|
|
82
85
|
emitSessionInitialized,
|
|
@@ -90,6 +93,7 @@ export {
|
|
|
90
93
|
foldContextState,
|
|
91
94
|
foldCriteria,
|
|
92
95
|
foldIsRunning,
|
|
96
|
+
foldMode,
|
|
93
97
|
foldPhase,
|
|
94
98
|
foldSessionState,
|
|
95
99
|
foldTodos,
|
|
@@ -107,4 +111,4 @@ export {
|
|
|
107
111
|
isStoredEvent,
|
|
108
112
|
isTurnEvent
|
|
109
113
|
};
|
|
110
|
-
//# sourceMappingURL=events-
|
|
114
|
+
//# sourceMappingURL=events-FHPSSSE4.js.map
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
foldContextState,
|
|
9
9
|
foldCriteria,
|
|
10
10
|
foldIsRunning,
|
|
11
|
+
foldMode,
|
|
11
12
|
foldPendingConfirmations,
|
|
12
13
|
foldPhase,
|
|
13
14
|
foldSessionState,
|
|
@@ -16,7 +17,7 @@ import {
|
|
|
16
17
|
foldTurnEventsToSnapshotMessagesFromInitial,
|
|
17
18
|
getMessagesForWindow,
|
|
18
19
|
spreadOptionalMessageFields
|
|
19
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-LIMBYVO4.js";
|
|
20
21
|
export {
|
|
21
22
|
buildContextMessagesFromEventHistory,
|
|
22
23
|
buildContextMessagesFromMessages,
|
|
@@ -27,6 +28,7 @@ export {
|
|
|
27
28
|
foldContextState,
|
|
28
29
|
foldCriteria,
|
|
29
30
|
foldIsRunning,
|
|
31
|
+
foldMode,
|
|
30
32
|
foldPendingConfirmations,
|
|
31
33
|
foldPhase,
|
|
32
34
|
foldSessionState,
|
|
@@ -36,4 +38,4 @@ export {
|
|
|
36
38
|
getMessagesForWindow,
|
|
37
39
|
spreadOptionalMessageFields
|
|
38
40
|
};
|
|
39
|
-
//# sourceMappingURL=folding-
|
|
41
|
+
//# sourceMappingURL=folding-NEZWWL7K.js.map
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
filterToolRegistryForStepDone,
|
|
3
|
-
hasReminderInCurrentWindow,
|
|
4
|
-
injectModeReminderIfNeeded,
|
|
5
3
|
runBuilderTurn,
|
|
6
4
|
runChatTurn,
|
|
7
5
|
runVerifierTurn
|
|
8
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-22JBSK6P.js";
|
|
9
7
|
import {
|
|
10
8
|
TurnMetrics,
|
|
11
9
|
createChatDoneEvent,
|
|
@@ -13,18 +11,18 @@ import {
|
|
|
13
11
|
createMessageStartEvent,
|
|
14
12
|
createToolCallEvent,
|
|
15
13
|
createToolResultEvent
|
|
16
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-SGOTQ7R3.js";
|
|
17
15
|
import "./chunk-NBU6KIOD.js";
|
|
18
16
|
import "./chunk-574HZVLE.js";
|
|
19
17
|
import "./chunk-7JPKRM6M.js";
|
|
20
18
|
import "./chunk-WNZIUQ2L.js";
|
|
21
|
-
import "./chunk-
|
|
22
|
-
import "./chunk-
|
|
23
|
-
import "./chunk-
|
|
19
|
+
import "./chunk-YVQ6DP5Y.js";
|
|
20
|
+
import "./chunk-LIMBYVO4.js";
|
|
21
|
+
import "./chunk-DZHZ3UUR.js";
|
|
24
22
|
import "./chunk-22CTURMH.js";
|
|
25
23
|
import "./chunk-GQZGIMJO.js";
|
|
26
24
|
import "./chunk-BLNFJ22S.js";
|
|
27
|
-
import "./chunk-
|
|
25
|
+
import "./chunk-Y6HBEACI.js";
|
|
28
26
|
import "./chunk-R4HADRYO.js";
|
|
29
27
|
import "./chunk-TVQOONDR.js";
|
|
30
28
|
import "./chunk-VCALN543.js";
|
|
@@ -37,10 +35,8 @@ export {
|
|
|
37
35
|
createToolCallEvent,
|
|
38
36
|
createToolResultEvent,
|
|
39
37
|
filterToolRegistryForStepDone,
|
|
40
|
-
hasReminderInCurrentWindow,
|
|
41
|
-
injectModeReminderIfNeeded,
|
|
42
38
|
runBuilderTurn,
|
|
43
39
|
runChatTurn,
|
|
44
40
|
runVerifierTurn
|
|
45
41
|
};
|
|
46
|
-
//# sourceMappingURL=orchestrator-
|
|
42
|
+
//# sourceMappingURL=orchestrator-DIJO4BJ7.js.map
|
package/dist/package.json
CHANGED
|
@@ -2,22 +2,22 @@ import {
|
|
|
2
2
|
buildRunChatTurnParams,
|
|
3
3
|
finalizeTurnCompletion,
|
|
4
4
|
getSessionMessageCount
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-NBBX64KC.js";
|
|
6
6
|
import {
|
|
7
7
|
applyGeneratedSessionName,
|
|
8
8
|
generateSessionName,
|
|
9
9
|
needsNameGenerationCheck
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-BHSTSA7U.js";
|
|
11
11
|
import {
|
|
12
12
|
getEventStore
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import "./chunk-
|
|
13
|
+
} from "./chunk-YVQ6DP5Y.js";
|
|
14
|
+
import "./chunk-LIMBYVO4.js";
|
|
15
15
|
import {
|
|
16
16
|
createChatMessageMessage,
|
|
17
17
|
createSessionRunningMessage
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-DZHZ3UUR.js";
|
|
19
19
|
import "./chunk-BLNFJ22S.js";
|
|
20
|
-
import "./chunk-
|
|
20
|
+
import "./chunk-Y6HBEACI.js";
|
|
21
21
|
import "./chunk-TVQOONDR.js";
|
|
22
22
|
import {
|
|
23
23
|
logger
|
|
@@ -145,9 +145,9 @@ var QueueProcessor = class {
|
|
|
145
145
|
});
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
|
-
this.runTurn(sessionId, controller
|
|
148
|
+
this.runTurn(sessionId, controller);
|
|
149
149
|
}
|
|
150
|
-
async runTurn(sessionId, controller
|
|
150
|
+
async runTurn(sessionId, controller) {
|
|
151
151
|
const { sessionManager, getLLMClient, getActiveProvider, broadcastForSession, providerManager } = this.deps;
|
|
152
152
|
const session = sessionManager.getSession(sessionId);
|
|
153
153
|
if (session?.providerId && session.providerModel) {
|
|
@@ -175,15 +175,14 @@ var QueueProcessor = class {
|
|
|
175
175
|
backend: provider?.backend ?? llmClient.getBackend(),
|
|
176
176
|
model: llmClient.getModel()
|
|
177
177
|
};
|
|
178
|
-
const { runChatTurn } = await import("./orchestrator-
|
|
178
|
+
const { runChatTurn } = await import("./orchestrator-DIJO4BJ7.js");
|
|
179
179
|
const runChatTurnParams = buildRunChatTurnParams({
|
|
180
180
|
sessionManager,
|
|
181
181
|
sessionId,
|
|
182
182
|
llmClient,
|
|
183
183
|
statsIdentity,
|
|
184
184
|
signal: controller.signal,
|
|
185
|
-
onMessage: (msg) => broadcastForSession(sessionId, msg)
|
|
186
|
-
...agentId ? { agentId } : {}
|
|
185
|
+
onMessage: (msg) => broadcastForSession(sessionId, msg)
|
|
187
186
|
});
|
|
188
187
|
runChatTurn(runChatTurnParams).catch((error) => {
|
|
189
188
|
if (error instanceof Error && error.message === "Aborted") {
|
|
@@ -209,4 +208,4 @@ var QueueProcessor = class {
|
|
|
209
208
|
export {
|
|
210
209
|
QueueProcessor
|
|
211
210
|
};
|
|
212
|
-
//# sourceMappingURL=processor-
|
|
211
|
+
//# sourceMappingURL=processor-YLKEJ7QC.js.map
|