openfox 1.6.45 → 1.6.46
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-GI4VMKB2.js} +6 -6
- package/dist/{chat-handler-ITVOWLJR.js → chat-handler-UYAJHFNJ.js} +10 -10
- package/dist/{chunk-RB576RLK.js → chunk-AVMBAUH2.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-KBEOYUA3.js → chunk-LN5RMI7G.js} +2 -2
- package/dist/{chunk-GY4TRYOG.js → chunk-MY66TLAH.js} +4 -4
- package/dist/{chunk-FBUTQPJ6.js → chunk-NBBX64KC.js} +4 -5
- package/dist/{chunk-SMK6HIR5.js → chunk-W62DI5UK.js} +21 -40
- 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-WQDVNDB3.js} +7 -11
- package/dist/package.json +1 -1
- package/dist/{processor-6CITCUJR.js → processor-7V5FI5X7.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-G3XDWOPI.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-QXQGYZ4D.js} +6 -6
- package/dist/web/assets/{index-Bl-fM2P0.js → index-BPG5tJZc.js} +65 -65
- 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
|
@@ -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
|
|
@@ -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-G3XDWOPI.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-LN5RMI7G.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
|
|
@@ -3353,7 +3353,7 @@ var callSubAgentTool = {
|
|
|
3353
3353
|
};
|
|
3354
3354
|
}
|
|
3355
3355
|
try {
|
|
3356
|
-
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-
|
|
3356
|
+
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-QXQGYZ4D.js");
|
|
3357
3357
|
const toolRegistry = getToolRegistryForAgent2(agentDef);
|
|
3358
3358
|
const turnMetrics = new TurnMetrics();
|
|
3359
3359
|
const result = await executeSubAgent({
|
|
@@ -4482,4 +4482,4 @@ export {
|
|
|
4482
4482
|
getToolRegistryForAgent,
|
|
4483
4483
|
createToolRegistry
|
|
4484
4484
|
};
|
|
4485
|
-
//# sourceMappingURL=chunk-
|
|
4485
|
+
//# sourceMappingURL=chunk-MY66TLAH.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
|
|
@@ -13,14 +13,14 @@ import {
|
|
|
13
13
|
getToolRegistryForAgent,
|
|
14
14
|
loadAllAgentsDefault,
|
|
15
15
|
runTopLevelAgentLoop
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-MY66TLAH.js";
|
|
17
17
|
import {
|
|
18
18
|
getCurrentContextWindowId,
|
|
19
19
|
getEventStore
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-YVQ6DP5Y.js";
|
|
21
21
|
import {
|
|
22
22
|
buildSnapshotFromSessionState
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-LIMBYVO4.js";
|
|
24
24
|
import {
|
|
25
25
|
logger
|
|
26
26
|
} from "./chunk-PNBH3RAX.js";
|
|
@@ -72,16 +72,17 @@ async function runChatTurn(options) {
|
|
|
72
72
|
const { sessionManager, sessionId } = options;
|
|
73
73
|
const eventStore = getEventStore();
|
|
74
74
|
const statsIdentity = resolveStatsIdentity(options);
|
|
75
|
-
const
|
|
76
|
-
|
|
75
|
+
const session = sessionManager.requireSession(sessionId);
|
|
76
|
+
const mode = session.mode;
|
|
77
|
+
logger.debug("Starting chat turn", { sessionId, mode });
|
|
77
78
|
const turnMetrics = new TurnMetrics();
|
|
78
79
|
try {
|
|
79
|
-
if (
|
|
80
|
+
if (mode === "builder") {
|
|
80
81
|
await runBuilderTurn(options, turnMetrics);
|
|
81
82
|
} else {
|
|
82
|
-
await runGenericAgentTurn(options, turnMetrics,
|
|
83
|
+
await runGenericAgentTurn(options, turnMetrics, mode);
|
|
83
84
|
}
|
|
84
|
-
const snapshot = buildSnapshot(sessionManager, sessionId, turnMetrics.buildStats(statsIdentity,
|
|
85
|
+
const snapshot = buildSnapshot(sessionManager, sessionId, turnMetrics.buildStats(statsIdentity, mode));
|
|
85
86
|
const snapshotEvent = eventStore.append(sessionId, { type: "turn.snapshot", data: snapshot });
|
|
86
87
|
const deletedCount = eventStore.cleanupOldEvents(sessionId);
|
|
87
88
|
if (deletedCount > 0) {
|
|
@@ -109,7 +110,7 @@ async function runChatTurn(options) {
|
|
|
109
110
|
if (error instanceof Error && error.message === "Aborted") {
|
|
110
111
|
return;
|
|
111
112
|
}
|
|
112
|
-
logger.error("Chat turn error", { sessionId,
|
|
113
|
+
logger.error("Chat turn error", { sessionId, mode, error });
|
|
113
114
|
const errorMsgId = crypto.randomUUID();
|
|
114
115
|
eventStore.append(sessionId, {
|
|
115
116
|
type: "chat.error",
|
|
@@ -128,39 +129,18 @@ async function runChatTurn(options) {
|
|
|
128
129
|
eventStore.append(sessionId, { type: "running.changed", data: { isRunning: false } });
|
|
129
130
|
}
|
|
130
131
|
}
|
|
131
|
-
function
|
|
132
|
-
for (let i = events.length - 1; i >= 0; i--) {
|
|
133
|
-
const event = events[i];
|
|
134
|
-
if (event?.type !== "message.start") continue;
|
|
135
|
-
const data = event.data;
|
|
136
|
-
if (data?.role !== "user") continue;
|
|
137
|
-
if (data?.messageKind !== "auto-prompt") continue;
|
|
138
|
-
if (!data?.content?.includes("<system-reminder>")) continue;
|
|
139
|
-
if (!data.content.includes(keyword)) continue;
|
|
140
|
-
if (currentWindowId && data.contextWindowId && data.contextWindowId !== currentWindowId) {
|
|
141
|
-
continue;
|
|
142
|
-
}
|
|
143
|
-
if (currentWindowId && !data.contextWindowId) {
|
|
144
|
-
continue;
|
|
145
|
-
}
|
|
146
|
-
return true;
|
|
147
|
-
}
|
|
148
|
-
return false;
|
|
149
|
-
}
|
|
150
|
-
function injectModeReminderIfNeeded(_sessionManager, sessionId, agentId, allAgents, _onMessage) {
|
|
132
|
+
function injectModeReminderIfNeeded(sessionManager, sessionId, agentId, allAgents, onMessage) {
|
|
151
133
|
const eventStore = getEventStore();
|
|
152
|
-
const
|
|
153
|
-
const
|
|
154
|
-
if (
|
|
155
|
-
const modeKeywordMatch = agentDef.prompt.match(/#\s*(.+Mode)/);
|
|
156
|
-
const keyword = modeKeywordMatch ? modeKeywordMatch[1] ?? agentId : agentId;
|
|
157
|
-
const events = eventStore.getEvents(sessionId);
|
|
158
|
-
if (hasReminderInCurrentWindow(events, currentWindowId, keyword)) {
|
|
134
|
+
const session = sessionManager.requireSession(sessionId);
|
|
135
|
+
const lastModeReminder = session.executionState?.lastModeWithReminder;
|
|
136
|
+
if (lastModeReminder === agentId) {
|
|
159
137
|
return;
|
|
160
138
|
}
|
|
139
|
+
const agentDef = findAgentById(agentId, allAgents);
|
|
140
|
+
if (!agentDef) return;
|
|
161
141
|
const reminderContent = buildAgentReminder(agentDef);
|
|
162
142
|
const reminderMsgId = crypto.randomUUID();
|
|
163
|
-
const currentWindowMessageOptions =
|
|
143
|
+
const currentWindowMessageOptions = getCurrentContextWindowId(sessionId) ? { contextWindowId: getCurrentContextWindowId(sessionId) } : void 0;
|
|
164
144
|
eventStore.append(sessionId, {
|
|
165
145
|
type: "message.start",
|
|
166
146
|
data: {
|
|
@@ -181,6 +161,9 @@ function injectModeReminderIfNeeded(_sessionManager, sessionId, agentId, allAgen
|
|
|
181
161
|
type: "message.done",
|
|
182
162
|
data: { messageId: reminderMsgId }
|
|
183
163
|
});
|
|
164
|
+
sessionManager.updateExecutionState(sessionId, {
|
|
165
|
+
lastModeWithReminder: agentId
|
|
166
|
+
});
|
|
184
167
|
}
|
|
185
168
|
async function runGenericAgentTurn(options, turnMetrics, agentId) {
|
|
186
169
|
const statsIdentity = resolveStatsIdentity(options);
|
|
@@ -306,10 +289,8 @@ function buildSnapshot(sessionManager, sessionId, lastStats) {
|
|
|
306
289
|
export {
|
|
307
290
|
createVerifierNudgeConfig,
|
|
308
291
|
runChatTurn,
|
|
309
|
-
hasReminderInCurrentWindow,
|
|
310
|
-
injectModeReminderIfNeeded,
|
|
311
292
|
filterToolRegistryForStepDone,
|
|
312
293
|
runBuilderTurn,
|
|
313
294
|
runVerifierTurn
|
|
314
295
|
};
|
|
315
|
-
//# sourceMappingURL=chunk-
|
|
296
|
+
//# sourceMappingURL=chunk-W62DI5UK.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-W62DI5UK.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-MY66TLAH.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-WQDVNDB3.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-WQDVNDB3.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-7V5FI5X7.js.map
|