openfox 2.0.64 → 2.0.66
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/README.md +1 -0
- package/dist/agent-defaults/builder.agent.md +1 -1
- package/dist/agent-defaults/code-reviewer.agent.md +0 -1
- package/dist/agent-defaults/explorer.agent.md +0 -1
- package/dist/agent-defaults/planner.agent.md +1 -1
- package/dist/{branch.api-LAN42BA5.js → branch.api-3YJSWOZG.js} +5 -1
- package/dist/{chat-handler-LI4R4Z2E.js → chat-handler-ZRDNSLOG.js} +14 -12
- package/dist/{chunk-WD75RSGR.js → chunk-3ACDQKK6.js} +358 -340
- package/dist/{chunk-RYIREJAW.js → chunk-5EO6SEGV.js} +2 -2
- package/dist/{chunk-OESYKZCM.js → chunk-5V5DM5E4.js} +3 -3
- package/dist/{chunk-QBYQ7KDX.js → chunk-B7WGOK7G.js} +16 -15
- package/dist/{chunk-Z6W4YHJB.js → chunk-BL5LOLVA.js} +17 -1
- package/dist/{chunk-TMUBLQFC.js → chunk-C3VLGVSQ.js} +3 -3
- package/dist/{chunk-ZPIZLTWU.js → chunk-GMXKJGJ2.js} +5 -1
- package/dist/{chunk-YQ3SOPBI.js → chunk-KXVFHMSM.js} +2 -2
- package/dist/chunk-OBK3I4KD.js +137 -0
- package/dist/{chunk-JFQSQO2N.js → chunk-OE5B44P6.js} +278 -68
- package/dist/{chunk-SVSKQYFH.js → chunk-PVRSNXD4.js} +6 -4
- package/dist/{chunk-X5YCWKNS.js → chunk-R4UTFE63.js} +53 -83
- package/dist/{chunk-O3G6X5CT.js → chunk-R7EED6ZU.js} +3 -3
- package/dist/{chunk-AIJE3RYH.js → chunk-TFDK6VSG.js} +33 -7
- package/dist/{chunk-QJ5FH5DP.js → chunk-TMHWQYWE.js} +4 -4
- package/dist/{chunk-73N5CJH3.js → chunk-UBIHP5Z7.js} +8 -8
- package/dist/chunk-WGMJCFCE.js +14 -0
- package/dist/{chunk-LBGHZLLH.js → chunk-WNA5VPZG.js} +2 -2
- package/dist/{chunk-HZNY77HZ.js → chunk-ZUM2ZJOX.js} +46 -18
- package/dist/cli/dev.js +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/{client-LAKW7TA5.js → client-BUX62J2K.js} +3 -3
- package/dist/{client-pure-DO3S675T.js → client-pure-U6ZYUPJQ.js} +6 -4
- package/dist/{compactor-I3N56PSJ.js → compactor-V43WJ3WX.js} +7 -7
- package/dist/{events-52XADT6Y.js → events-CDQ4HASP.js} +4 -4
- package/dist/{folding-2BGFLV5J.js → folding-V2K34EGN.js} +2 -2
- package/dist/{inspect-proxy-BV25JERQ.js → inspect-proxy-PKMDR47R.js} +4 -4
- package/dist/{orchestrator-PFN7C5JI.js → orchestrator-LZQTDOWM.js} +13 -11
- package/dist/package.json +1 -1
- package/dist/{processor-AYYXP5NS.js → processor-7KAXESY5.js} +14 -12
- package/dist/{project-creator-IDW7RACH.js → project-creator-EMGRSPYS.js} +18 -5
- package/dist/{projects-BY227WT2.js → projects-7HSBZY2D.js} +3 -3
- package/dist/{protocol-Cq66hdDX.d.ts → protocol-42f_Png6.d.ts} +1 -1
- package/dist/provider/index.d.ts +4 -4
- package/dist/{provider-GYOW4OWQ.js → provider-BDH6JGZB.js} +4 -4
- package/dist/{provider-manager-HRHNF73A.js → provider-manager-D3KIOD5E.js} +4 -4
- package/dist/{serve-54KALE6R.js → serve-HGHFN3D2.js} +18 -16
- package/dist/server/index.d.ts +26 -8
- package/dist/server/index.js +17 -15
- package/dist/{server-Z2A5YZM6.js → server-W42ENYFX.js} +15 -13
- package/dist/{settings-ASLTSUE2.js → settings-ZZ6AKFPD.js} +3 -3
- package/dist/shared/index.d.ts +3 -3
- package/dist/{tools-R6LPK6OS.js → tools-2EB7C6H2.js} +12 -10
- package/dist/{types-CDZakn7f.d.ts → types-apiMd7Df.d.ts} +1 -1
- package/dist/{types-akHmgvBk.d.ts → types-vezAEt_y.d.ts} +3 -1
- package/dist/web/assets/{index-DvPmgi8F.css → index-B0Q5uK2h.css} +1 -1
- package/dist/web/assets/index-BhQN93bI.js +303 -0
- package/dist/web/index.html +2 -2
- package/dist/web/sw.js +1 -1
- package/dist/worktree-EIF75WGF.js +26 -0
- package/package.json +1 -1
- package/dist/web/assets/index-CkE65FP4.js +0 -303
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getDatabase
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-GMXKJGJ2.js";
|
|
4
4
|
|
|
5
5
|
// src/server/db/settings.ts
|
|
6
6
|
var SETTINGS_KEYS = {
|
|
@@ -24,7 +24,8 @@ var SETTINGS_KEYS = {
|
|
|
24
24
|
SEARCH_ENGINE: "search.engine",
|
|
25
25
|
SEARCH_TAVILY_API_KEY: "search.tavilyApiKey",
|
|
26
26
|
SEARCH_SEARXNG_URL: "search.searxngUrl",
|
|
27
|
-
SEARCH_SEARXNG_API_KEY: "search.searxngApiKey"
|
|
27
|
+
SEARCH_SEARXNG_API_KEY: "search.searxngApiKey",
|
|
28
|
+
TOOLS_USE_RTK: "tools.useRtk"
|
|
28
29
|
};
|
|
29
30
|
var SETTINGS_DEFAULTS = {
|
|
30
31
|
[SETTINGS_KEYS.DISPLAY_SHOW_THINKING]: "true",
|
|
@@ -49,7 +50,8 @@ var SETTINGS_DEFAULTS = {
|
|
|
49
50
|
{ type: "chord", key: "3", modifiers: ["ctrl"] },
|
|
50
51
|
{ type: "chord", key: "4", modifiers: ["ctrl"] }
|
|
51
52
|
]
|
|
52
|
-
})
|
|
53
|
+
}),
|
|
54
|
+
[SETTINGS_KEYS.TOOLS_USE_RTK]: "false"
|
|
53
55
|
};
|
|
54
56
|
function getSetting(key) {
|
|
55
57
|
try {
|
|
@@ -97,4 +99,4 @@ export {
|
|
|
97
99
|
deleteSetting,
|
|
98
100
|
getAllSettings
|
|
99
101
|
};
|
|
100
|
-
//# sourceMappingURL=chunk-
|
|
102
|
+
//# sourceMappingURL=chunk-PVRSNXD4.js.map
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from "./chunk-YHEQTVFV.js";
|
|
10
10
|
import {
|
|
11
11
|
buildModelParams
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-BL5LOLVA.js";
|
|
13
13
|
import {
|
|
14
14
|
logger
|
|
15
15
|
} from "./chunk-K44MW7JJ.js";
|
|
@@ -50,117 +50,87 @@ Working directory: ${workdir}
|
|
|
50
50
|
Platform: ${process.platform} (${process.arch})${modelLine}
|
|
51
51
|
|
|
52
52
|
## CORE BEHAVIOR
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
53
|
+
Help user complete tasks safely and efficiently.
|
|
54
|
+
Do everything to satisfy user requirements.
|
|
55
|
+
Read file before editing.
|
|
56
|
+
Prefer precise, minimal changes.
|
|
57
|
+
Use available tools when needed.
|
|
58
|
+
Explain tradeoffs clearly when requirements are ambiguous.
|
|
59
|
+
Follow repository and project instructions exactly.
|
|
60
60
|
|
|
61
61
|
## MODE CONTROL
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
- Do not describe them as "the user reminded me"; they are runtime mode/control metadata injected by OpenFox.
|
|
62
|
+
OpenFox appends runtime control as USER-role messages wrapped in <system-reminder>...</system-reminder>.
|
|
63
|
+
These reminders are authoritative, treat them as higher-priority operational constraints.
|
|
64
|
+
Never say "user reminded me"; they are runtime mode injected by OpenFox.
|
|
66
65
|
|
|
67
66
|
## WORKFLOW
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
Remember that your output will be displayed on a command line interface. Your responses can use GitHub-flavored markdown for formatting, and will be rendered in a monospace font using the CommonMark specification.
|
|
83
|
-
Output text to communicate with the user; all text you output outside of tool use is displayed to the user. Only use tools to complete tasks. Never use tools like Bash or code comments as means to communicate with the user during the session.
|
|
84
|
-
If you cannot or will not help the user with something, please do not say why or what it could lead to, since this comes across as preachy and annoying. Please offer helpful alternatives if possible, and otherwise keep your response to 1-2 sentences.
|
|
85
|
-
Only use emojis if the user explicitly requests it. Avoid using emojis in all communication unless asked.
|
|
86
|
-
IMPORTANT: You should minimize output tokens as much as possible while maintaining helpfulness, quality, and accuracy. Only address the specific query or task at hand, avoiding tangential information unless absolutely critical for completing the request. If you can answer in 1-3 sentences or a short paragraph, please do.
|
|
87
|
-
IMPORTANT: You should NOT answer with unnecessary preamble or postamble (such as explaining your code or summarizing your action), unless the user asks you to.
|
|
88
|
-
IMPORTANT: Keep your responses short, since they will be displayed on a command line interface. You MUST answer concisely with fewer than 4 lines (not including tool use or code generation), unless user asks for detail. Answer the user's question directly, without elaboration, explanation, or details. One word answers are best. Avoid introductions, conclusions, and explanations. You MUST avoid text before/after your response, such as "The answer is <answer>.", "Here is the content of the file..." or "Based on the information provided, the answer is..." or "Here is what I will do next...". Here are some examples to demonstrate appropriate verbosity:
|
|
89
|
-
<example>
|
|
67
|
+
Reminder = planning mode: focus on understanding, exploration, clarification, criteria quality.
|
|
68
|
+
Reminder = build mode: focus on implementation, verification, completing approved criteria.
|
|
69
|
+
|
|
70
|
+
## TONE AND STYLE
|
|
71
|
+
Be concise, direct, and to the point.
|
|
72
|
+
Explain non-trivial bash commands (what & why).
|
|
73
|
+
Output renders as CLI markdown (CommonMark).
|
|
74
|
+
Only use tools for tasks, not communication.
|
|
75
|
+
No emojis unless asked.
|
|
76
|
+
Minimize tokens, stay on-topic.
|
|
77
|
+
No preamble/postamble.
|
|
78
|
+
Keep responses under ~4 lines unless detail requested.
|
|
79
|
+
|
|
80
|
+
### Examples
|
|
90
81
|
user: 2 + 2
|
|
91
82
|
assistant: 4
|
|
92
|
-
</example>
|
|
93
|
-
|
|
94
|
-
<example>
|
|
95
|
-
user: what is 2+2?
|
|
96
|
-
assistant: 4
|
|
97
|
-
</example>
|
|
98
|
-
|
|
99
|
-
<example>
|
|
100
|
-
user: is 11 a prime number?
|
|
101
|
-
assistant: Yes
|
|
102
|
-
</example>
|
|
103
83
|
|
|
104
|
-
<example>
|
|
105
84
|
user: what command should I run to list files in the current directory?
|
|
106
85
|
assistant: ls
|
|
107
|
-
</example>
|
|
108
86
|
|
|
109
|
-
<example>
|
|
110
87
|
user: what command should I run to watch files in the current directory?
|
|
111
88
|
assistant: [use the ls tool to list the files in the current directory, then read docs/commands in the relevant file to find out how to watch files]
|
|
112
|
-
npm run dev
|
|
113
|
-
</example>
|
|
89
|
+
npm run dev
|
|
114
90
|
|
|
115
|
-
<example>
|
|
116
|
-
user: How many golf balls fit inside a jetta?
|
|
117
|
-
assistant: 150000
|
|
118
|
-
</example>
|
|
119
|
-
|
|
120
|
-
<example>
|
|
121
91
|
user: what files are in the directory src/?
|
|
122
92
|
assistant: [runs ls and sees foo.c, bar.c, baz.c]
|
|
123
93
|
user: which file contains the implementation of foo?
|
|
124
94
|
assistant: src/foo.c
|
|
125
|
-
</example>
|
|
126
95
|
|
|
127
|
-
<example>
|
|
128
96
|
user: write tests for new feature
|
|
129
|
-
assistant: [uses
|
|
130
|
-
|
|
97
|
+
assistant: [uses run_command tool to find where similar tests are defined, uses concurrent read file tool use blocks in one tool call to read relevant files at the same time, uses edit file tool to write new tests]
|
|
98
|
+
|
|
99
|
+
## FILE REFERENCES
|
|
100
|
+
@ prefix, e.g. @src/index.ts or @web/components/.
|
|
101
|
+
Relative to the working directory above. Strip leading @ and resolve against working directory, never treat as absolute path.
|
|
102
|
+
|
|
103
|
+
## IMPORTANT GUARDRAILS
|
|
104
|
+
NEVER delete/git checkout already modified file: would result in data loss.
|
|
131
105
|
|
|
132
106
|
# Proactiveness
|
|
133
|
-
|
|
107
|
+
Allowed to be proactive, but only when user asks you to do something. Balance:
|
|
134
108
|
1. Doing the right thing when asked, including taking actions and follow-up actions
|
|
135
|
-
2. Not surprising
|
|
136
|
-
For example, if
|
|
137
|
-
3. Do not add additional code explanation summary unless requested by
|
|
109
|
+
2. Not surprising user with actions you take without asking
|
|
110
|
+
For example, if user asks you how to approach something, you should do your best to answer their question first, and not immediately jump into taking actions.
|
|
111
|
+
3. Do not add additional code explanation summary unless requested by user. After working on a file, just stop, rather than providing an explanation of what you did.
|
|
138
112
|
|
|
139
113
|
# Following conventions
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
114
|
+
Understand file's code conventions. Mimic code style, use existing libraries and utilities, follow existing patterns.
|
|
115
|
+
NEVER assume that a given library is available. To use library or framework, first check that codebase already uses given library.
|
|
116
|
+
When you create new component, first look at existing components to see how written; then consider framework choice, naming conventions, typing, other conventions.
|
|
117
|
+
When you edit code, look at code's surrounding context (imports) to understand code's choice of frameworks and libraries. Then consider how to make given change in way that is most idiomatic.
|
|
118
|
+
Always follow security best practices. Never introduce code that exposes or logs secrets and keys. Never commit secrets or keys to the repository.
|
|
145
119
|
|
|
146
120
|
# Code style
|
|
147
|
-
|
|
121
|
+
IMPORTANT: DO NOT ADD ***ANY*** COMMENTS unless asked
|
|
148
122
|
|
|
149
123
|
# Doing tasks
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
NEVER commit changes unless
|
|
156
|
-
|
|
157
|
-
- Tool results and user messages may include <system-reminder> tags. <system-reminder> tags contain useful information and reminders. They are NOT part of the user's provided input or the tool result.
|
|
124
|
+
User will primarily request you perform software engineering tasks. This includes solving bugs, adding new functionality, refactoring code, explaining code, and more. For these tasks the following steps are recommended:
|
|
125
|
+
Use run_command or Explorer sub-agent to understand the codebase and user's query.
|
|
126
|
+
Implement solution using all tools available to you.
|
|
127
|
+
Verify the solution if possible with tests. NEVER assume specific test framework or test script. Check README or search codebase to determine testing approach.
|
|
128
|
+
VERY IMPORTANT: When you have completed a task, you MUST run lint and typecheck commands (e.g. npm run lint, npm run typecheck, ruff, etc.) with run_command to ensure your code is correct.
|
|
129
|
+
NEVER commit changes unless user explicitly asks you to. VERY IMPORTANT only commit when explicitly asked, otherwise user will feel that you are being too proactive.
|
|
158
130
|
|
|
159
131
|
# Tool usage policy
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
You MUST answer concisely with fewer than 4 lines of text (not including tool use or code generation), unless user asks for detail.
|
|
132
|
+
When doing file search, prefer to use the call_sub_agent tool with the "explorer" in order to reduce context usage, except if this would take less than 3 calls to get the information.
|
|
133
|
+
You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance.
|
|
164
134
|
|
|
165
135
|
${instructionsSection}
|
|
166
136
|
${buildSkillsSection(skills)}
|
|
@@ -705,4 +675,4 @@ export {
|
|
|
705
675
|
createChatDoneEvent,
|
|
706
676
|
consumeStreamGenerator
|
|
707
677
|
};
|
|
708
|
-
//# sourceMappingURL=chunk-
|
|
678
|
+
//# sourceMappingURL=chunk-R4UTFE63.js.map
|
|
@@ -164,7 +164,7 @@ async function runCli(options) {
|
|
|
164
164
|
break;
|
|
165
165
|
}
|
|
166
166
|
case "provider": {
|
|
167
|
-
const { runProviderCommand } = await import("./provider-
|
|
167
|
+
const { runProviderCommand } = await import("./provider-BDH6JGZB.js");
|
|
168
168
|
const [, subcommand] = positionals;
|
|
169
169
|
await runProviderCommand(mode, subcommand);
|
|
170
170
|
break;
|
|
@@ -208,7 +208,7 @@ async function runCli(options) {
|
|
|
208
208
|
if (!configExists) {
|
|
209
209
|
await runNetworkSetup(mode);
|
|
210
210
|
}
|
|
211
|
-
const { runServe } = await import("./serve-
|
|
211
|
+
const { runServe } = await import("./serve-HGHFN3D2.js");
|
|
212
212
|
const serveOptions = { mode };
|
|
213
213
|
if (values.port) serveOptions.port = parseInt(values.port);
|
|
214
214
|
if (values["no-browser"] === true) serveOptions.openBrowser = false;
|
|
@@ -220,4 +220,4 @@ async function runCli(options) {
|
|
|
220
220
|
export {
|
|
221
221
|
runCli
|
|
222
222
|
};
|
|
223
|
-
//# sourceMappingURL=chunk-
|
|
223
|
+
//# sourceMappingURL=chunk-R7EED6ZU.js.map
|
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
foldContextState,
|
|
6
6
|
foldSessionState,
|
|
7
7
|
spreadOptionalMessageFields
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-C3VLGVSQ.js";
|
|
9
9
|
import {
|
|
10
10
|
getDatabase
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-GMXKJGJ2.js";
|
|
12
12
|
import {
|
|
13
13
|
logger
|
|
14
14
|
} from "./chunk-K44MW7JJ.js";
|
|
@@ -680,21 +680,33 @@ function getProjectDangerLevel(projectId) {
|
|
|
680
680
|
return "normal";
|
|
681
681
|
}
|
|
682
682
|
}
|
|
683
|
-
function createSession(projectId, workdir, title, providerId, providerModel) {
|
|
683
|
+
function createSession(projectId, workdir, title, providerId, providerModel, worktree) {
|
|
684
684
|
const db = getDatabase();
|
|
685
685
|
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
686
686
|
const id = crypto.randomUUID();
|
|
687
687
|
const dangerLevel = getProjectDangerLevel(projectId);
|
|
688
688
|
db.prepare(
|
|
689
689
|
`
|
|
690
|
-
INSERT INTO sessions (id, project_id, workdir, phase, mode, workflow_phase, is_running, created_at, updated_at, title, provider_id, provider_model, danger_level)
|
|
691
|
-
VALUES (?, ?, ?, 'idle', 'planner', 'plan', 0, ?, ?, ?, ?, ?, ?)
|
|
690
|
+
INSERT INTO sessions (id, project_id, workdir, worktree, phase, mode, workflow_phase, is_running, created_at, updated_at, title, provider_id, provider_model, danger_level)
|
|
691
|
+
VALUES (?, ?, ?, ?, 'idle', 'planner', 'plan', 0, ?, ?, ?, ?, ?, ?)
|
|
692
692
|
`
|
|
693
|
-
).run(
|
|
693
|
+
).run(
|
|
694
|
+
id,
|
|
695
|
+
projectId,
|
|
696
|
+
workdir,
|
|
697
|
+
worktree ?? null,
|
|
698
|
+
now,
|
|
699
|
+
now,
|
|
700
|
+
title ?? null,
|
|
701
|
+
providerId ?? null,
|
|
702
|
+
providerModel ?? null,
|
|
703
|
+
dangerLevel
|
|
704
|
+
);
|
|
694
705
|
return {
|
|
695
706
|
id,
|
|
696
707
|
projectId,
|
|
697
708
|
workdir,
|
|
709
|
+
...worktree ? { worktree } : {},
|
|
698
710
|
mode: "planner",
|
|
699
711
|
phase: "plan",
|
|
700
712
|
isRunning: false,
|
|
@@ -843,6 +855,7 @@ function listSessions() {
|
|
|
843
855
|
s.id,
|
|
844
856
|
s.project_id,
|
|
845
857
|
s.workdir,
|
|
858
|
+
s.worktree,
|
|
846
859
|
s.mode,
|
|
847
860
|
s.workflow_phase,
|
|
848
861
|
s.is_running,
|
|
@@ -866,6 +879,7 @@ function listSessionsByProject(projectId, limit = 20, offset = 0) {
|
|
|
866
879
|
s.id,
|
|
867
880
|
s.project_id,
|
|
868
881
|
s.workdir,
|
|
882
|
+
s.worktree,
|
|
869
883
|
s.mode,
|
|
870
884
|
s.workflow_phase,
|
|
871
885
|
s.is_running,
|
|
@@ -885,6 +899,16 @@ function listSessionsByProject(projectId, limit = 20, offset = 0) {
|
|
|
885
899
|
const sessions = rows.slice(0, limit).map(mapSessionSummaryRow);
|
|
886
900
|
return { sessions, hasMore };
|
|
887
901
|
}
|
|
902
|
+
function updateSessionWorkdir(id, workdir, worktree) {
|
|
903
|
+
const db = getDatabase();
|
|
904
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
905
|
+
db.prepare("UPDATE sessions SET workdir = ?, worktree = ?, updated_at = ? WHERE id = ?").run(
|
|
906
|
+
workdir,
|
|
907
|
+
worktree,
|
|
908
|
+
now,
|
|
909
|
+
id
|
|
910
|
+
);
|
|
911
|
+
}
|
|
888
912
|
function deleteSession(id) {
|
|
889
913
|
const db = getDatabase();
|
|
890
914
|
db.prepare("DELETE FROM sessions WHERE id = ?").run(id);
|
|
@@ -894,6 +918,7 @@ function mapSessionBase(row) {
|
|
|
894
918
|
id: row.id,
|
|
895
919
|
projectId: row.project_id,
|
|
896
920
|
workdir: row.workdir,
|
|
921
|
+
...row.worktree ? { worktree: row.worktree } : {},
|
|
897
922
|
mode: row.mode ?? "planner",
|
|
898
923
|
phase: row.workflow_phase ?? "plan",
|
|
899
924
|
isRunning: Boolean(row.is_running),
|
|
@@ -1396,6 +1421,7 @@ export {
|
|
|
1396
1421
|
getSessionCachedPrompt,
|
|
1397
1422
|
listSessions,
|
|
1398
1423
|
listSessionsByProject,
|
|
1424
|
+
updateSessionWorkdir,
|
|
1399
1425
|
deleteSession,
|
|
1400
1426
|
loadConfig,
|
|
1401
1427
|
setRuntimeConfig,
|
|
@@ -1434,4 +1460,4 @@ export {
|
|
|
1434
1460
|
truncateSessionMessages,
|
|
1435
1461
|
getRecentUserPromptsForSession
|
|
1436
1462
|
};
|
|
1437
|
-
//# sourceMappingURL=chunk-
|
|
1463
|
+
//# sourceMappingURL=chunk-TFDK6VSG.js.map
|
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
getEventStore,
|
|
3
3
|
getRuntimeConfig,
|
|
4
4
|
updateSessionMetadata
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-TFDK6VSG.js";
|
|
6
6
|
import {
|
|
7
7
|
buildMessagesFromStoredEvents,
|
|
8
8
|
foldPendingConfirmations
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-C3VLGVSQ.js";
|
|
10
10
|
import {
|
|
11
11
|
createContextStateMessage,
|
|
12
12
|
createSessionStateMessage
|
|
@@ -135,7 +135,7 @@ async function generateSessionNameForSession(sessionId, userMessage, deps, signa
|
|
|
135
135
|
client = deps.getLLMClient();
|
|
136
136
|
client.setModel(providerConfig.model);
|
|
137
137
|
} else if (providerConfig) {
|
|
138
|
-
const { createLLMClient } = await import("./client-
|
|
138
|
+
const { createLLMClient } = await import("./client-BUX62J2K.js");
|
|
139
139
|
client = createLLMClient({
|
|
140
140
|
llm: {
|
|
141
141
|
baseUrl: providerConfig.baseUrl,
|
|
@@ -184,4 +184,4 @@ export {
|
|
|
184
184
|
buildRunChatTurnParams,
|
|
185
185
|
generateSessionNameForSession
|
|
186
186
|
};
|
|
187
|
-
//# sourceMappingURL=chunk-
|
|
187
|
+
//# sourceMappingURL=chunk-TMHWQYWE.js.map
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
loadAllAgentsDefault,
|
|
11
11
|
processEventsForConversation,
|
|
12
12
|
runTopLevelAgentLoop
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-3ACDQKK6.js";
|
|
14
14
|
import {
|
|
15
15
|
TurnMetrics,
|
|
16
16
|
WORKFLOW_KICKOFF_PROMPT,
|
|
@@ -19,16 +19,16 @@ import {
|
|
|
19
19
|
buildTopLevelSystemPrompt,
|
|
20
20
|
createChatDoneEvent,
|
|
21
21
|
createMessageStartEvent
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-R4UTFE63.js";
|
|
23
23
|
import {
|
|
24
24
|
getCurrentContextWindowId,
|
|
25
25
|
getCurrentWindowMessageOptions,
|
|
26
26
|
getEventStore,
|
|
27
27
|
getRuntimeConfig
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-TFDK6VSG.js";
|
|
29
29
|
import {
|
|
30
30
|
buildSnapshotFromSessionState
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-C3VLGVSQ.js";
|
|
32
32
|
import {
|
|
33
33
|
logger
|
|
34
34
|
} from "./chunk-K44MW7JJ.js";
|
|
@@ -65,7 +65,7 @@ function resolveAgentDef(sessionManager, sessionId) {
|
|
|
65
65
|
}
|
|
66
66
|
async function buildCachedPrompt(sessionManager, sessionId, agentDef) {
|
|
67
67
|
const { instructionContent, skills } = await loadSessionContext(sessionManager, sessionId);
|
|
68
|
-
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-
|
|
68
|
+
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-2EB7C6H2.js");
|
|
69
69
|
const tools = getToolRegistryForAgent2(agentDef).definitions;
|
|
70
70
|
const toolFingerprint = getToolFingerprint(tools);
|
|
71
71
|
const allAgents = await loadAllAgentsDefault();
|
|
@@ -78,7 +78,7 @@ async function buildCachedPrompt(sessionManager, sessionId, agentDef) {
|
|
|
78
78
|
async function computeSessionHash(sessionManager, sessionId) {
|
|
79
79
|
const { instructionContent, skills } = await loadSessionContext(sessionManager, sessionId);
|
|
80
80
|
const agentDef = await resolveAgentDef(sessionManager, sessionId);
|
|
81
|
-
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-
|
|
81
|
+
const { getToolRegistryForAgent: getToolRegistryForAgent2 } = await import("./tools-2EB7C6H2.js");
|
|
82
82
|
const tools = getToolRegistryForAgent2(agentDef).definitions;
|
|
83
83
|
const toolFingerprint = getToolFingerprint(tools);
|
|
84
84
|
return computeDynamicContextHash(instructionContent, skills, toolFingerprint);
|
|
@@ -96,7 +96,7 @@ async function applyDynamicContext(sessionManager, sessionId) {
|
|
|
96
96
|
|
|
97
97
|
// src/server/chat/orchestrator.ts
|
|
98
98
|
async function buildRetryPatterns() {
|
|
99
|
-
const { getSetting, SETTINGS_KEYS } = await import("./settings-
|
|
99
|
+
const { getSetting, SETTINGS_KEYS } = await import("./settings-ZZ6AKFPD.js");
|
|
100
100
|
const raw = getSetting(SETTINGS_KEYS.RETRY_PATTERNS);
|
|
101
101
|
if (!raw) {
|
|
102
102
|
const oldXmlProtection = getSetting("llm.disableXmlProtection");
|
|
@@ -383,4 +383,4 @@ export {
|
|
|
383
383
|
runAgentTurn,
|
|
384
384
|
injectWorkflowKickoffIfNeeded
|
|
385
385
|
};
|
|
386
|
-
//# sourceMappingURL=chunk-
|
|
386
|
+
//# sourceMappingURL=chunk-UBIHP5Z7.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// src/server/git/env.ts
|
|
2
|
+
function gitSpawnEnv() {
|
|
3
|
+
const env = { ...process.env };
|
|
4
|
+
delete env["GIT_DIR"];
|
|
5
|
+
delete env["GIT_INDEX_FILE"];
|
|
6
|
+
delete env["GIT_WORK_TREE"];
|
|
7
|
+
delete env["GIT_PREFIX"];
|
|
8
|
+
return env;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export {
|
|
12
|
+
gitSpawnEnv
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=chunk-WGMJCFCE.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getProjectByWorkdir
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-KXVFHMSM.js";
|
|
4
4
|
import {
|
|
5
5
|
logger
|
|
6
6
|
} from "./chunk-K44MW7JJ.js";
|
|
@@ -340,4 +340,4 @@ export {
|
|
|
340
340
|
startInspectProxy,
|
|
341
341
|
stopAllInspectProxies
|
|
342
342
|
};
|
|
343
|
-
//# sourceMappingURL=chunk-
|
|
343
|
+
//# sourceMappingURL=chunk-WNA5VPZG.js.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
appendCompactionPrompt
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-5V5DM5E4.js";
|
|
4
4
|
import {
|
|
5
5
|
applyDynamicContext,
|
|
6
6
|
computeSessionHash,
|
|
7
7
|
injectWorkflowKickoffIfNeeded,
|
|
8
8
|
runAgentTurn,
|
|
9
9
|
runChatTurn
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-UBIHP5Z7.js";
|
|
11
11
|
import {
|
|
12
12
|
checkAborted,
|
|
13
13
|
deleteItemFromDir,
|
|
@@ -19,20 +19,27 @@ import {
|
|
|
19
19
|
loadAllAgentsDefault,
|
|
20
20
|
saveItemToDir,
|
|
21
21
|
spawnShellProcess
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-3ACDQKK6.js";
|
|
23
23
|
import {
|
|
24
24
|
TurnMetrics,
|
|
25
25
|
createMessageStartEvent
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-R4UTFE63.js";
|
|
27
27
|
import {
|
|
28
28
|
getPlatformShell,
|
|
29
29
|
onProcessEvent
|
|
30
30
|
} from "./chunk-BGTEIA2S.js";
|
|
31
|
+
import {
|
|
32
|
+
gitSpawnEnv
|
|
33
|
+
} from "./chunk-WGMJCFCE.js";
|
|
31
34
|
import {
|
|
32
35
|
getCurrentContextWindowId,
|
|
33
36
|
getEventStore,
|
|
34
37
|
getRuntimeConfig
|
|
35
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-TFDK6VSG.js";
|
|
39
|
+
import {
|
|
40
|
+
buildMessagesFromStoredEvents,
|
|
41
|
+
foldPendingConfirmations
|
|
42
|
+
} from "./chunk-C3VLGVSQ.js";
|
|
36
43
|
import {
|
|
37
44
|
createChatErrorMessage,
|
|
38
45
|
createChatMessageMessage,
|
|
@@ -41,6 +48,7 @@ import {
|
|
|
41
48
|
createGitStatusMessage,
|
|
42
49
|
createQueueStateMessage,
|
|
43
50
|
createSessionRunningMessage,
|
|
51
|
+
createSessionStateMessage,
|
|
44
52
|
isAskAnswerPayload,
|
|
45
53
|
isSessionLoadPayload,
|
|
46
54
|
parseClientMessage,
|
|
@@ -48,6 +56,7 @@ import {
|
|
|
48
56
|
storedEventToServerMessage
|
|
49
57
|
} from "./chunk-F4PMNP7S.js";
|
|
50
58
|
import {
|
|
59
|
+
getPendingQuestionsForSession,
|
|
51
60
|
provideAnswer
|
|
52
61
|
} from "./chunk-EU3WWTFH.js";
|
|
53
62
|
import {
|
|
@@ -446,13 +455,16 @@ var TERMINAL_BLOCKED = "$blocked";
|
|
|
446
455
|
import { spawn as spawn2 } from "child_process";
|
|
447
456
|
function getGitDiffFiles(cwd) {
|
|
448
457
|
return new Promise((resolve) => {
|
|
458
|
+
const env = gitSpawnEnv();
|
|
449
459
|
const diffProc = spawn2("git", ["diff", "--name-status", "HEAD"], {
|
|
450
460
|
cwd,
|
|
461
|
+
env,
|
|
451
462
|
stdio: ["ignore", "pipe", "pipe"],
|
|
452
463
|
windowsHide: true
|
|
453
464
|
});
|
|
454
465
|
const statusProc = spawn2("git", ["status", "--porcelain"], {
|
|
455
466
|
cwd,
|
|
467
|
+
env,
|
|
456
468
|
stdio: ["ignore", "pipe", "pipe"],
|
|
457
469
|
windowsHide: true
|
|
458
470
|
});
|
|
@@ -595,7 +607,8 @@ function formatCriteriaList(entries) {
|
|
|
595
607
|
}).join("\n");
|
|
596
608
|
}
|
|
597
609
|
async function formatModifiedFiles(session) {
|
|
598
|
-
|
|
610
|
+
const effectiveWorkdir = session.worktree ?? session.workdir;
|
|
611
|
+
return formatGitDiffFiles(effectiveWorkdir);
|
|
599
612
|
}
|
|
600
613
|
function resolveTemplate(template, ctx) {
|
|
601
614
|
let result = template;
|
|
@@ -756,7 +769,7 @@ async function executeWorkflow(workflow, options, subGroup) {
|
|
|
756
769
|
const currentWindowMessageOptions = getCurrentWindowMessageOptions(sessionId);
|
|
757
770
|
const criteriaEntries = session.metadataEntries["criteria"] ?? [];
|
|
758
771
|
const templateCtx = {
|
|
759
|
-
workdir: session.workdir,
|
|
772
|
+
workdir: session.worktree ?? session.workdir,
|
|
760
773
|
reason: buildReason(session.metadataEntries),
|
|
761
774
|
verifierFindings: lastStepOutput["content"] ?? "",
|
|
762
775
|
previousStepOutput: lastStepOutput["stdout"] ?? "",
|
|
@@ -840,10 +853,6 @@ async function executeWorkflow(workflow, options, subGroup) {
|
|
|
840
853
|
if (toolCall.name === "step_done" && toolResult.success) {
|
|
841
854
|
stepDoneCalled = true;
|
|
842
855
|
}
|
|
843
|
-
if (toolResult.success && ["write_file", "edit_file"].includes(toolCall.name)) {
|
|
844
|
-
const path = toolCall.arguments["path"];
|
|
845
|
-
sessionManager.addModifiedFile(sessionId, path);
|
|
846
|
-
}
|
|
847
856
|
}
|
|
848
857
|
}
|
|
849
858
|
);
|
|
@@ -932,7 +941,7 @@ async function executeWorkflow(workflow, options, subGroup) {
|
|
|
932
941
|
})
|
|
933
942
|
);
|
|
934
943
|
}
|
|
935
|
-
const result = await executeShellCommand(command, session.workdir, timeout, signal);
|
|
944
|
+
const result = await executeShellCommand(command, session.worktree ?? session.workdir, timeout, signal);
|
|
936
945
|
const output = [result.stdout, result.stderr].filter(Boolean).join("\n").trim();
|
|
937
946
|
lastStepOutput = { stdout: result.stdout ?? "", stderr: result.stderr ?? "", exitCode: String(result.exitCode) };
|
|
938
947
|
const outputContent = output ? `Exit code: ${result.exitCode}
|
|
@@ -1189,6 +1198,7 @@ function moduleGitBranch(cwd) {
|
|
|
1189
1198
|
return new Promise((resolve) => {
|
|
1190
1199
|
const proc = spawn3("git", ["rev-parse", "--abbrev-ref", "HEAD"], {
|
|
1191
1200
|
cwd,
|
|
1201
|
+
env: gitSpawnEnv(),
|
|
1192
1202
|
stdio: ["ignore", "pipe", "ignore"],
|
|
1193
1203
|
windowsHide: true
|
|
1194
1204
|
});
|
|
@@ -1211,13 +1221,16 @@ function hashContent(content) {
|
|
|
1211
1221
|
}
|
|
1212
1222
|
function moduleGitDiff(cwd) {
|
|
1213
1223
|
return new Promise((resolve) => {
|
|
1224
|
+
const env = gitSpawnEnv();
|
|
1214
1225
|
const diffProc = spawn3("git", ["diff", "--name-status", "HEAD"], {
|
|
1215
1226
|
cwd,
|
|
1227
|
+
env,
|
|
1216
1228
|
stdio: ["ignore", "pipe", "pipe"],
|
|
1217
1229
|
windowsHide: true
|
|
1218
1230
|
});
|
|
1219
1231
|
const statusProc = spawn3("git", ["status", "--porcelain"], {
|
|
1220
1232
|
cwd,
|
|
1233
|
+
env,
|
|
1221
1234
|
stdio: ["ignore", "pipe", "pipe"],
|
|
1222
1235
|
windowsHide: true
|
|
1223
1236
|
});
|
|
@@ -1570,6 +1583,20 @@ function createWebSocketServer(httpServer, _config, getLLMClient, getActiveProvi
|
|
|
1570
1583
|
})
|
|
1571
1584
|
);
|
|
1572
1585
|
});
|
|
1586
|
+
sessionManager.subscribe((event) => {
|
|
1587
|
+
if (event.type === "session_updated") {
|
|
1588
|
+
const updatedSession = event.session;
|
|
1589
|
+
const eventStore = getEventStore();
|
|
1590
|
+
const events = eventStore.getEvents(updatedSession.id);
|
|
1591
|
+
const messages = buildMessagesFromStoredEvents(events);
|
|
1592
|
+
const pendingConfirmations = foldPendingConfirmations(events);
|
|
1593
|
+
const pendingQuestions = getPendingQuestionsForSession(updatedSession.id);
|
|
1594
|
+
broadcastForSession(
|
|
1595
|
+
updatedSession.id,
|
|
1596
|
+
createSessionStateMessage(updatedSession, messages, pendingConfirmations, pendingQuestions)
|
|
1597
|
+
);
|
|
1598
|
+
}
|
|
1599
|
+
});
|
|
1573
1600
|
onProcessEvent((_processId, msg) => {
|
|
1574
1601
|
const sessionId = msg.sessionId;
|
|
1575
1602
|
if (!sessionId) return;
|
|
@@ -1766,13 +1793,14 @@ async function handleClientMessage(ws, client, message, _getLLMClient, _getActiv
|
|
|
1766
1793
|
return;
|
|
1767
1794
|
}
|
|
1768
1795
|
client.activeSessionId = session.id;
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
const
|
|
1796
|
+
const effectiveWorkdir = session.worktree ?? session.workdir;
|
|
1797
|
+
client.activeWorkdir = effectiveWorkdir;
|
|
1798
|
+
if (effectiveWorkdir) {
|
|
1799
|
+
const branch = await moduleGitBranch(effectiveWorkdir);
|
|
1800
|
+
const { files } = await moduleGitDiff(effectiveWorkdir);
|
|
1773
1801
|
const msg = createGitStatusMessage(branch, files);
|
|
1774
1802
|
send(msg);
|
|
1775
|
-
if (branch) moduleStartGitPolling(
|
|
1803
|
+
if (branch) moduleStartGitPolling(effectiveWorkdir);
|
|
1776
1804
|
}
|
|
1777
1805
|
ensureEventStoreSubscription(session.id);
|
|
1778
1806
|
send({ type: "ack", payload: { sessionId: session.id }, id: message.id });
|
|
@@ -2092,4 +2120,4 @@ export {
|
|
|
2092
2120
|
signalMcpReady,
|
|
2093
2121
|
createWebSocketServer
|
|
2094
2122
|
};
|
|
2095
|
-
//# sourceMappingURL=chunk-
|
|
2123
|
+
//# sourceMappingURL=chunk-ZUM2ZJOX.js.map
|