openfox 2.0.89 → 2.0.91
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/CHANGELOG.md +25 -0
- package/dist/CHANGELOG.md +25 -0
- package/dist/{chat-handler-NOTXEOLF.js → chat-handler-PC5BUJGA.js} +26 -22
- package/dist/chunk-3NGD6IVM.js +65 -0
- package/dist/{chunk-E5D7V7XC.js → chunk-4IBFA5IF.js} +8 -8
- package/dist/{chunk-VFMHWU3E.js → chunk-54Q4TGG6.js} +7 -3
- package/dist/{chunk-TAHZHEJ4.js → chunk-6J5IZ2NL.js} +10 -3
- package/dist/{chunk-EZWSS7LG.js → chunk-6OAJNCRY.js} +9 -1
- package/dist/{chunk-SYU5GNPN.js → chunk-7YBGCZSI.js} +2 -2
- package/dist/{chunk-AGYP7AUV.js → chunk-AXFPEGJI.js} +2 -2
- package/dist/{chunk-67AVIA5G.js → chunk-BJHPUMRX.js} +2 -2
- package/dist/{chunk-Q4OPCXV4.js → chunk-C56Z4OVW.js} +2 -2
- package/dist/{chunk-U7RLUZBP.js → chunk-CFK34T26.js} +1 -1
- package/dist/{chunk-47WNBFDO.js → chunk-CND2YWIJ.js} +2 -2
- package/dist/{chunk-J2IVK667.js → chunk-DH32AHTL.js} +2 -2
- package/dist/{chunk-7JC5YWST.js → chunk-DVVRKNFS.js} +62 -475
- package/dist/chunk-FSLCOA4R.js +144 -0
- package/dist/{chunk-NTYWC6PD.js → chunk-GH5PL3JW.js} +3 -3
- package/dist/chunk-GPODFKPQ.js +7 -0
- package/dist/{chunk-5OGOPB3I.js → chunk-JJY5O2WH.js} +236 -146
- package/dist/{chunk-J7R25K6N.js → chunk-JX6WL56A.js} +7 -7
- package/dist/{chunk-NGIOAASU.js → chunk-K2O7JTCX.js} +1 -243
- package/dist/{chunk-RNXMN5QY.js → chunk-LT4MPTGU.js} +4 -4
- package/dist/{chunk-7TFKWFY3.js → chunk-NGN3Q26A.js} +88 -72
- package/dist/chunk-NLJXZZTB.js +246 -0
- package/dist/{chunk-OVSB5SFF.js → chunk-NO65CC2R.js} +82 -32
- package/dist/{chunk-N54PQSCH.js → chunk-OQTLFO4R.js} +3 -2
- package/dist/{chunk-U2ECZUAX.js → chunk-Q7CN4JOO.js} +22 -75
- package/dist/{chunk-Q6AKRIM2.js → chunk-ST4NYXLH.js} +9 -2
- package/dist/chunk-SXHGRPCI.js +443 -0
- package/dist/{chunk-2GQ7X2NP.js → chunk-U7D72C4O.js} +4 -4
- package/dist/{chunk-4S76VMPH.js → chunk-VJEVCZZA.js} +6 -4
- package/dist/{chunk-VPFUXGMM.js → chunk-VKWVPQJ5.js} +3 -1
- package/dist/{chunk-3QHXJ3DJ.js → chunk-WPACSSBS.js} +3 -3
- package/dist/{chunk-ANYBIATF.js → chunk-WWC3R3YL.js} +2 -2
- package/dist/cli/dev.js +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/{client-2KVPLIV4.js → client-RBXMHFX3.js} +5 -5
- package/dist/{compactor-W2CUKE22.js → compactor-HW6GBRAG.js} +11 -10
- package/dist/{config-JN6MW5SL.js → config-XIYAPMX3.js} +2 -2
- package/dist/dynamic-context-TDD3Q43F.js +27 -0
- package/dist/{events-OD7MN3FL.js → events-ICX5KVET.js} +7 -7
- package/dist/{folding-TDDQ5CXT.js → folding-L2L4OHX6.js} +5 -5
- package/dist/http-client-E3CV6E5D.js +11 -0
- package/dist/{inspect-proxy-CN2MUFQ5.js → inspect-proxy-NZ3VSMSC.js} +4 -4
- package/dist/{manager-6UIC3QKJ.js → manager-ZPQ6VSM5.js} +5 -5
- package/dist/orchestrator-56LSHPPK.js +55 -0
- package/dist/package.json +1 -1
- package/dist/{path-security-M2JDUBKK.js → path-security-XENIR7SX.js} +10 -10
- package/dist/{platform-55N6FRRU.js → platform-UKZ2QC34.js} +4 -4
- package/dist/{processor-FE4ZJ7GS.js → processor-H6NFFRI2.js} +25 -22
- package/dist/{project-creator-W5VW22DC.js → project-creator-2WMZYQME.js} +3 -3
- package/dist/{projects-HZ3WVTKG.js → projects-N6KVZGMS.js} +3 -3
- package/dist/{protocol-BUA2W2KM.js → protocol-3GNSIGP4.js} +3 -3
- package/dist/{protocol-DKJPL2Ci.d.ts → protocol-CaSHnORC.d.ts} +15 -4
- package/dist/provider/index.d.ts +4 -4
- package/dist/{provider-I2P3NYUI.js → provider-SYYZI2KX.js} +8 -8
- package/dist/{provider-manager-OLDOHCR2.js → provider-manager-P3ZSA5QS.js} +6 -6
- package/dist/registry-ERUV33AP.js +46 -0
- package/dist/{serve-UMPDBCVG.js → serve-KNVANLAK.js} +32 -28
- package/dist/server/index.d.ts +3 -3
- package/dist/server/index.js +31 -27
- package/dist/server-H3525HD6.js +45 -0
- package/dist/session-overrides-NPVYNHTM.js +20 -0
- package/dist/{sessions-Q6SYLG6U.js → sessions-7KCM5QH4.js} +7 -5
- package/dist/{settings-PFZWX6VY.js → settings-2OVKFWR5.js} +3 -3
- package/dist/shared/index.d.ts +3 -3
- package/dist/shared/index.js +1 -1
- package/dist/{tools-NLKP65HF.js → tools-DXBIHSMY.js} +23 -20
- package/dist/{types-C4NrLRR1.d.ts → types-CHCZiJvw.d.ts} +4 -0
- package/dist/{types-B97Fb4vm.d.ts → types-Cw7L4Bze.d.ts} +1 -1
- package/dist/{update-BHTE5TMY.js → update-4BGMFSEG.js} +2 -2
- package/dist/{update-server-V6GJ43WH.js → update-server-4I6LXE5K.js} +2 -2
- package/dist/web/assets/index-Chu9JX0M.js +316 -0
- package/dist/web/assets/index-mS37wyUs.css +32 -0
- package/dist/web/index.html +2 -2
- package/dist/web/sw.js +1 -1
- package/dist/{workspace-N4QHV6J2.js → workspace-YLTMP3OX.js} +4 -4
- package/package.json +1 -1
- package/dist/chunk-TH4JF6XP.js +0 -7
- package/dist/http-client-IPJGJXNJ.js +0 -11
- package/dist/orchestrator-NQDWCULY.js +0 -51
- package/dist/server-4PB7BNE6.js +0 -41
- package/dist/web/assets/index-BQfVUhSC.css +0 -32
- package/dist/web/assets/index-C5sTYb--.js +0 -306
|
@@ -37,7 +37,7 @@ Options:
|
|
|
37
37
|
}
|
|
38
38
|
async function runNetworkSetup(mode) {
|
|
39
39
|
const { loadAuthConfig, saveAuthConfig, encryptPassword } = await import("./auth-YY5PJYSC.js");
|
|
40
|
-
const { saveGlobalConfig } = await import("./config-
|
|
40
|
+
const { saveGlobalConfig } = await import("./config-XIYAPMX3.js");
|
|
41
41
|
const { getAuthKeyPath } = await import("./paths-F27V3S4I.js");
|
|
42
42
|
const existingAuth = await loadAuthConfig(mode);
|
|
43
43
|
if (existingAuth) {
|
|
@@ -104,7 +104,7 @@ async function runNetworkSetup(mode) {
|
|
|
104
104
|
console.log("\u2713 Configuration saved!\n");
|
|
105
105
|
}
|
|
106
106
|
async function runConfig(mode) {
|
|
107
|
-
const { loadGlobalConfig, getActiveProvider, getDefaultModel } = await import("./config-
|
|
107
|
+
const { loadGlobalConfig, getActiveProvider, getDefaultModel } = await import("./config-XIYAPMX3.js");
|
|
108
108
|
const { getGlobalConfigPath } = await import("./paths-F27V3S4I.js");
|
|
109
109
|
const config = await loadGlobalConfig(mode);
|
|
110
110
|
const configPath = getGlobalConfigPath(mode);
|
|
@@ -163,7 +163,7 @@ async function runCli(options) {
|
|
|
163
163
|
break;
|
|
164
164
|
}
|
|
165
165
|
case "provider": {
|
|
166
|
-
const { runProviderCommand } = await import("./provider-
|
|
166
|
+
const { runProviderCommand } = await import("./provider-SYYZI2KX.js");
|
|
167
167
|
const [, subcommand] = positionals;
|
|
168
168
|
await runProviderCommand(mode, subcommand);
|
|
169
169
|
break;
|
|
@@ -200,7 +200,7 @@ async function runCli(options) {
|
|
|
200
200
|
break;
|
|
201
201
|
}
|
|
202
202
|
case "update": {
|
|
203
|
-
const { runUpdate } = await import("./update-
|
|
203
|
+
const { runUpdate } = await import("./update-4BGMFSEG.js");
|
|
204
204
|
const code = await runUpdate();
|
|
205
205
|
if (code !== 0) {
|
|
206
206
|
process.exit(code);
|
|
@@ -208,12 +208,12 @@ async function runCli(options) {
|
|
|
208
208
|
break;
|
|
209
209
|
}
|
|
210
210
|
default: {
|
|
211
|
-
const { configFileExists } = await import("./config-
|
|
211
|
+
const { configFileExists } = await import("./config-XIYAPMX3.js");
|
|
212
212
|
const configExists = await configFileExists(mode);
|
|
213
213
|
if (!configExists) {
|
|
214
214
|
await runNetworkSetup(mode);
|
|
215
215
|
}
|
|
216
|
-
const { runServe } = await import("./serve-
|
|
216
|
+
const { runServe } = await import("./serve-KNVANLAK.js");
|
|
217
217
|
const serveOptions = { mode };
|
|
218
218
|
if (values.port) serveOptions.port = parseInt(values.port);
|
|
219
219
|
if (values["no-browser"] === true) serveOptions.openBrowser = false;
|
|
@@ -225,4 +225,4 @@ async function runCli(options) {
|
|
|
225
225
|
export {
|
|
226
226
|
runCli
|
|
227
227
|
};
|
|
228
|
-
//# sourceMappingURL=chunk-
|
|
228
|
+
//# sourceMappingURL=chunk-JX6WL56A.js.map
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getPlatformShell
|
|
3
|
-
} from "./chunk-ANYBIATF.js";
|
|
4
1
|
import {
|
|
5
2
|
streamWithSegments
|
|
6
3
|
} from "./chunk-J2GP3J3X.js";
|
|
@@ -17,236 +14,6 @@ import {
|
|
|
17
14
|
logger
|
|
18
15
|
} from "./chunk-K44MW7JJ.js";
|
|
19
16
|
|
|
20
|
-
// src/server/tools/tool-policy.ts
|
|
21
|
-
var ALWAYS_ALLOWED = /* @__PURE__ */ new Set(["step_done"]);
|
|
22
|
-
var ALWAYS_ALLOWED_FOR_SUBAGENTS = /* @__PURE__ */ new Set(["return_value"]);
|
|
23
|
-
var TOP_LEVEL_ONLY_TOOLS = /* @__PURE__ */ new Set(["call_sub_agent"]);
|
|
24
|
-
function computeEffectiveTools(allowedTools, type) {
|
|
25
|
-
const tools = /* @__PURE__ */ new Set();
|
|
26
|
-
for (const entry of allowedTools) {
|
|
27
|
-
const baseName = entry.includes(":") ? entry.split(":")[0] : entry;
|
|
28
|
-
if (baseName === "return_value" && type === "agent") continue;
|
|
29
|
-
tools.add(baseName);
|
|
30
|
-
}
|
|
31
|
-
const alwaysAllowed = type === "sub-agent" ? ALWAYS_ALLOWED_FOR_SUBAGENTS : ALWAYS_ALLOWED;
|
|
32
|
-
for (const tool of alwaysAllowed) {
|
|
33
|
-
tools.add(tool);
|
|
34
|
-
}
|
|
35
|
-
return tools;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// src/server/chat/prompts.ts
|
|
39
|
-
import { basename } from "path";
|
|
40
|
-
function buildBasePrompt(workdir, customInstructions, skills, modelName) {
|
|
41
|
-
const instructionsSection = customInstructions ? `
|
|
42
|
-
|
|
43
|
-
## CUSTOM INSTRUCTIONS
|
|
44
|
-
|
|
45
|
-
${customInstructions}` : "";
|
|
46
|
-
const modelLine = modelName ? `
|
|
47
|
-
Model: ${modelName}` : "";
|
|
48
|
-
return `You are OpenFox, an agentic assistant.
|
|
49
|
-
|
|
50
|
-
Today's date is ${(/* @__PURE__ */ new Date()).toISOString().split("T")[0].replace(/-/g, "/")}
|
|
51
|
-
|
|
52
|
-
## ENVIRONMENT
|
|
53
|
-
Working directory: ${workdir}
|
|
54
|
-
Platform: ${process.platform} (${process.arch})
|
|
55
|
-
Shell (run_command): ${basename(getPlatformShell().command)}${modelLine}
|
|
56
|
-
|
|
57
|
-
## CORE BEHAVIOR
|
|
58
|
-
Help user complete tasks safely and efficiently.
|
|
59
|
-
Do everything to satisfy user requirements.
|
|
60
|
-
Read file before editing.
|
|
61
|
-
Prefer precise, minimal changes.
|
|
62
|
-
Use available tools when needed.
|
|
63
|
-
Explain tradeoffs clearly when requirements are ambiguous.
|
|
64
|
-
Follow repository and project instructions exactly.
|
|
65
|
-
Commands run from your working directory \u2014 do not prepend "cd /path/" to change to a directory you are already in.
|
|
66
|
-
|
|
67
|
-
## MODE CONTROL
|
|
68
|
-
OpenFox appends runtime control as USER-role messages wrapped in <system-reminder>...</system-reminder>.
|
|
69
|
-
These reminders are authoritative, treat them as higher-priority operational constraints.
|
|
70
|
-
Never say "user reminded me"; they are runtime mode injected by OpenFox.
|
|
71
|
-
|
|
72
|
-
## WORKFLOW
|
|
73
|
-
Reminder = planning mode: focus on understanding, exploration, clarification, criteria quality.
|
|
74
|
-
Reminder = build mode: focus on implementation, verification, completing approved criteria.
|
|
75
|
-
|
|
76
|
-
## TONE AND STYLE
|
|
77
|
-
Be concise, direct, and to the point.
|
|
78
|
-
Explain non-trivial bash commands (what & why).
|
|
79
|
-
Output renders as CLI markdown (CommonMark).
|
|
80
|
-
Only use tools for tasks, not communication.
|
|
81
|
-
No emojis unless asked.
|
|
82
|
-
Minimize tokens, stay on-topic.
|
|
83
|
-
No preamble/postamble.
|
|
84
|
-
Keep responses under ~4 lines unless detail requested.
|
|
85
|
-
|
|
86
|
-
### Examples
|
|
87
|
-
user: 2 + 2
|
|
88
|
-
assistant: 4
|
|
89
|
-
|
|
90
|
-
user: what command should I run to list files in the current directory?
|
|
91
|
-
assistant: ls
|
|
92
|
-
|
|
93
|
-
user: what command should I run to watch files in the current directory?
|
|
94
|
-
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]
|
|
95
|
-
npm run dev
|
|
96
|
-
|
|
97
|
-
user: what files are in the directory src/?
|
|
98
|
-
assistant: [runs ls and sees foo.c, bar.c, baz.c]
|
|
99
|
-
user: which file contains the implementation of foo?
|
|
100
|
-
assistant: src/foo.c
|
|
101
|
-
|
|
102
|
-
user: write tests for new feature
|
|
103
|
-
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]
|
|
104
|
-
|
|
105
|
-
## FILE REFERENCES
|
|
106
|
-
@ prefix, e.g. @src/index.ts or @web/components/.
|
|
107
|
-
Relative to the working directory above. Strip leading @ and resolve against working directory, never treat as absolute path.
|
|
108
|
-
|
|
109
|
-
## IMPORTANT GUARDRAILS
|
|
110
|
-
NEVER delete/git checkout already modified file: would result in data loss.
|
|
111
|
-
|
|
112
|
-
# Proactiveness
|
|
113
|
-
Allowed to be proactive, but only when user asks you to do something. Balance:
|
|
114
|
-
1. Doing the right thing when asked, including taking actions and follow-up actions
|
|
115
|
-
2. Not surprising user with actions you take without asking
|
|
116
|
-
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.
|
|
117
|
-
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.
|
|
118
|
-
|
|
119
|
-
# Following conventions
|
|
120
|
-
Understand file's code conventions. Mimic code style, use existing libraries and utilities, follow existing patterns.
|
|
121
|
-
NEVER assume that a given library is available. To use library or framework, first check that codebase already uses given library.
|
|
122
|
-
When you create new component, first look at existing components to see how written; then consider framework choice, naming conventions, typing, other conventions.
|
|
123
|
-
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.
|
|
124
|
-
Always follow security best practices. Never introduce code that exposes or logs secrets and keys. Never commit secrets or keys to the repository.
|
|
125
|
-
|
|
126
|
-
# Code style
|
|
127
|
-
IMPORTANT: DO NOT ADD ***ANY*** COMMENTS unless asked
|
|
128
|
-
|
|
129
|
-
# Doing tasks
|
|
130
|
-
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:
|
|
131
|
-
Use run_command or Explorer sub-agent to understand the codebase and user's query.
|
|
132
|
-
Implement solution using all tools available to you.
|
|
133
|
-
Verify the solution if possible with tests. NEVER assume specific test framework or test script. Check README or search codebase to determine testing approach.
|
|
134
|
-
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.
|
|
135
|
-
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.
|
|
136
|
-
|
|
137
|
-
# Tool usage policy
|
|
138
|
-
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.
|
|
139
|
-
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.
|
|
140
|
-
|
|
141
|
-
${instructionsSection}
|
|
142
|
-
${buildSkillsSection(skills)}
|
|
143
|
-
`;
|
|
144
|
-
}
|
|
145
|
-
function buildSkillsSection(skills) {
|
|
146
|
-
if (!skills || skills.length === 0) return "";
|
|
147
|
-
const listing = skills.map((s, i) => `${i + 1}. **${s.id}** - ${s.description}`).join("\n");
|
|
148
|
-
return `
|
|
149
|
-
## AVAILABLE SKILLS
|
|
150
|
-
|
|
151
|
-
You can load specialized knowledge using the load_skill tool. Only load a skill when you need its instructions for the current task.
|
|
152
|
-
|
|
153
|
-
${listing}
|
|
154
|
-
|
|
155
|
-
To load a skill, call load_skill with the skill ID. The skill's detailed instructions will be returned as a tool result.
|
|
156
|
-
`;
|
|
157
|
-
}
|
|
158
|
-
function buildSubAgentsSection(subAgentDefs) {
|
|
159
|
-
if (subAgentDefs.length === 0) return "";
|
|
160
|
-
const listing = subAgentDefs.map((agent, i) => {
|
|
161
|
-
const tools = (agent.metadata.allowedTools || []).join(", ");
|
|
162
|
-
return `${i + 1}. **${agent.metadata.id}** - ${agent.metadata.description}
|
|
163
|
-
- Has access to: ${tools}`;
|
|
164
|
-
}).join("\n\n");
|
|
165
|
-
return `
|
|
166
|
-
## AVAILABLE SUB-AGENTS
|
|
167
|
-
|
|
168
|
-
You can call specialized sub-agents for specific tasks using the call_sub_agent tool:
|
|
169
|
-
|
|
170
|
-
${listing}
|
|
171
|
-
|
|
172
|
-
To call a sub-agent, use the call_sub_agent tool with:
|
|
173
|
-
- subAgentType: The ID of the sub-agent
|
|
174
|
-
- prompt: Clear description of what you need
|
|
175
|
-
`;
|
|
176
|
-
}
|
|
177
|
-
function buildTopLevelSystemPrompt(workdir, customInstructions, skills, subAgentDefs, modelName) {
|
|
178
|
-
const base = buildBasePrompt(workdir, customInstructions, skills, modelName);
|
|
179
|
-
const subAgents = subAgentDefs ? buildSubAgentsSection(subAgentDefs) : "";
|
|
180
|
-
return base + subAgents;
|
|
181
|
-
}
|
|
182
|
-
function buildToolPermissionsSection(allowedTools, isSubAgent) {
|
|
183
|
-
if (!allowedTools || allowedTools.length === 0) {
|
|
184
|
-
return "\n\n## AVAILABLE TOOLS\n\nYou have no tools available.";
|
|
185
|
-
}
|
|
186
|
-
const toolPermissions = /* @__PURE__ */ new Map();
|
|
187
|
-
const baseTools = [];
|
|
188
|
-
for (const entry of allowedTools) {
|
|
189
|
-
const colonIdx = entry.indexOf(":");
|
|
190
|
-
if (colonIdx === -1) {
|
|
191
|
-
if (entry !== "return_value" || isSubAgent) {
|
|
192
|
-
baseTools.push(entry);
|
|
193
|
-
}
|
|
194
|
-
} else {
|
|
195
|
-
const toolName = entry.slice(0, colonIdx);
|
|
196
|
-
const actionsStr = entry.slice(colonIdx + 1);
|
|
197
|
-
const actions = actionsStr.split(",").filter(Boolean);
|
|
198
|
-
const existing = toolPermissions.get(toolName) || [];
|
|
199
|
-
toolPermissions.set(toolName, [...existing, ...actions]);
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
const effectiveTools = computeEffectiveTools(allowedTools, isSubAgent ? "sub-agent" : "agent");
|
|
203
|
-
for (const tool of effectiveTools) {
|
|
204
|
-
if (!baseTools.includes(tool) && !toolPermissions.has(tool)) {
|
|
205
|
-
baseTools.push(tool);
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
const parts = [];
|
|
209
|
-
for (const [toolName, actions] of toolPermissions) {
|
|
210
|
-
parts.push(`${toolName}: ${actions.join(", ")}`);
|
|
211
|
-
}
|
|
212
|
-
for (const tool of baseTools) {
|
|
213
|
-
if (!toolPermissions.has(tool)) {
|
|
214
|
-
parts.push(tool);
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
const toolsList = parts.join(", ");
|
|
218
|
-
return `
|
|
219
|
-
|
|
220
|
-
## AVAILABLE TOOLS
|
|
221
|
-
|
|
222
|
-
You have access to these tools: ${toolsList}`;
|
|
223
|
-
}
|
|
224
|
-
function buildAgentReminder(agentDef) {
|
|
225
|
-
const toolPermissions = buildToolPermissionsSection(agentDef.metadata.allowedTools, agentDef.metadata.subagent);
|
|
226
|
-
return `<system-reminder>
|
|
227
|
-
${agentDef.prompt}${toolPermissions}
|
|
228
|
-
</system-reminder>`;
|
|
229
|
-
}
|
|
230
|
-
function buildAgentSmallReminder(name) {
|
|
231
|
-
return `<system-reminder>
|
|
232
|
-
Reminder: you are in '${name}' mode.
|
|
233
|
-
</system-reminder>`;
|
|
234
|
-
}
|
|
235
|
-
var COMPACTION_PROMPT = `You are a helpful AI assistant tasked with summarizing conversations for continuation.
|
|
236
|
-
|
|
237
|
-
Summarize the conversation history concisely, preserving:
|
|
238
|
-
1. What was done and what is currently being worked on
|
|
239
|
-
2. All file modifications made (file paths and what changed)
|
|
240
|
-
3. All errors encountered and how they were resolved
|
|
241
|
-
4. Current progress on each task
|
|
242
|
-
5. Important technical decisions and WHY they were made
|
|
243
|
-
6. Requirements that should persist
|
|
244
|
-
7. Next steps or pending actions that should be continued after compaction
|
|
245
|
-
8. The user's current question, prompt, or active request
|
|
246
|
-
|
|
247
|
-
Do not respond to any questions in the conversation, only output the summary.
|
|
248
|
-
Be thorough but concise. Output as a structured summary.`;
|
|
249
|
-
|
|
250
17
|
// src/server/chat/auto-patterns.ts
|
|
251
18
|
function matchRetryPatterns(content, thinking, patterns) {
|
|
252
19
|
const matches = [];
|
|
@@ -662,15 +429,6 @@ async function consumeStreamGenerator(gen, onEvent) {
|
|
|
662
429
|
}
|
|
663
430
|
|
|
664
431
|
export {
|
|
665
|
-
ALWAYS_ALLOWED,
|
|
666
|
-
ALWAYS_ALLOWED_FOR_SUBAGENTS,
|
|
667
|
-
TOP_LEVEL_ONLY_TOOLS,
|
|
668
|
-
computeEffectiveTools,
|
|
669
|
-
buildBasePrompt,
|
|
670
|
-
buildTopLevelSystemPrompt,
|
|
671
|
-
buildAgentReminder,
|
|
672
|
-
buildAgentSmallReminder,
|
|
673
|
-
COMPACTION_PROMPT,
|
|
674
432
|
streamLLMPure,
|
|
675
433
|
TurnMetrics,
|
|
676
434
|
createMessageStartEvent,
|
|
@@ -680,4 +438,4 @@ export {
|
|
|
680
438
|
createChatDoneEvent,
|
|
681
439
|
consumeStreamGenerator
|
|
682
440
|
};
|
|
683
|
-
//# sourceMappingURL=chunk-
|
|
441
|
+
//# sourceMappingURL=chunk-K2O7JTCX.js.map
|
|
@@ -5,13 +5,13 @@ import {
|
|
|
5
5
|
foldContextState,
|
|
6
6
|
foldSessionState,
|
|
7
7
|
spreadOptionalMessageFields
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-AXFPEGJI.js";
|
|
9
9
|
import {
|
|
10
10
|
updateSessionMessageCount
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-6J5IZ2NL.js";
|
|
12
12
|
import {
|
|
13
13
|
getRuntimeConfig
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-NGN3Q26A.js";
|
|
15
15
|
import {
|
|
16
16
|
logger
|
|
17
17
|
} from "./chunk-K44MW7JJ.js";
|
|
@@ -1159,4 +1159,4 @@ export {
|
|
|
1159
1159
|
truncateSessionMessages,
|
|
1160
1160
|
getRecentUserPromptsForSession
|
|
1161
1161
|
};
|
|
1162
|
-
//# sourceMappingURL=chunk-
|
|
1162
|
+
//# sourceMappingURL=chunk-LT4MPTGU.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SETTINGS_KEYS,
|
|
3
3
|
getSetting
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-54Q4TGG6.js";
|
|
5
5
|
import {
|
|
6
6
|
logger
|
|
7
7
|
} from "./chunk-K44MW7JJ.js";
|
|
@@ -9,76 +9,6 @@ import {
|
|
|
9
9
|
getGlobalConfigDir
|
|
10
10
|
} from "./chunk-CQGTEGKL.js";
|
|
11
11
|
|
|
12
|
-
// src/server/config.ts
|
|
13
|
-
import { z } from "zod";
|
|
14
|
-
var backendSchema = z.enum(["vllm", "sglang", "ollama", "llamacpp", "unknown"]).default("unknown");
|
|
15
|
-
var envSchema = z.object({
|
|
16
|
-
// New env var name, with fallback to old name for backward compatibility
|
|
17
|
-
OPENFOX_LLM_URL: z.string().url().optional(),
|
|
18
|
-
OPENFOX_VLLM_URL: z.string().url().optional(),
|
|
19
|
-
OPENFOX_BACKEND: backendSchema,
|
|
20
|
-
OPENFOX_MODEL_NAME: z.string().default(""),
|
|
21
|
-
OPENFOX_MAX_CONTEXT: z.coerce.number().default(2e5),
|
|
22
|
-
OPENFOX_PORT: z.coerce.number().default(10369),
|
|
23
|
-
OPENFOX_HOST: z.string().optional(),
|
|
24
|
-
OPENFOX_WORKDIR: z.string().optional(),
|
|
25
|
-
OPENFOX_DB_PATH: z.string().default("./openfox.db"),
|
|
26
|
-
OPENFOX_LOG_LEVEL: z.enum(["debug", "info", "warn", "error"]).default("info"),
|
|
27
|
-
OPENFOX_REASONING_EFFORT: z.string().optional(),
|
|
28
|
-
// Deprecated: use OPENFOX_REASONING_EFFORT=none instead
|
|
29
|
-
OPENFOX_DISABLE_THINKING: z.coerce.boolean().default(false),
|
|
30
|
-
OPENFOX_LLM_TIMEOUT: z.coerce.number().default(3e5),
|
|
31
|
-
OPENFOX_LLM_IDLE_TIMEOUT: z.coerce.number().default(3e5),
|
|
32
|
-
OPENFOX_DEV: z.coerce.boolean().default(false),
|
|
33
|
-
OPENFOX_DISABLE_AUTO_SESSION_TITLE: z.coerce.boolean().optional(),
|
|
34
|
-
OPENFOX_DEFAULT_AGENT: z.string().optional()
|
|
35
|
-
});
|
|
36
|
-
function loadConfig() {
|
|
37
|
-
const env = envSchema.parse(process.env);
|
|
38
|
-
const llmUrl = env.OPENFOX_LLM_URL ?? env.OPENFOX_VLLM_URL ?? "http://localhost:8000/v1";
|
|
39
|
-
const workdir = env.OPENFOX_WORKDIR ?? process.cwd();
|
|
40
|
-
return {
|
|
41
|
-
llm: {
|
|
42
|
-
baseUrl: llmUrl,
|
|
43
|
-
model: env.OPENFOX_MODEL_NAME,
|
|
44
|
-
timeout: env.OPENFOX_LLM_TIMEOUT,
|
|
45
|
-
idleTimeout: env.OPENFOX_LLM_IDLE_TIMEOUT,
|
|
46
|
-
backend: env.OPENFOX_BACKEND,
|
|
47
|
-
...env.OPENFOX_REASONING_EFFORT ? { reasoningEffort: env.OPENFOX_REASONING_EFFORT } : env.OPENFOX_DISABLE_THINKING ? { reasoningEffort: "none" } : {}
|
|
48
|
-
},
|
|
49
|
-
context: {
|
|
50
|
-
maxTokens: env.OPENFOX_MAX_CONTEXT,
|
|
51
|
-
compactionThreshold: 0.85,
|
|
52
|
-
compactionTarget: 0.6
|
|
53
|
-
},
|
|
54
|
-
agent: {
|
|
55
|
-
maxIterations: 10,
|
|
56
|
-
maxConsecutiveFailures: 3,
|
|
57
|
-
toolTimeout: 3e5
|
|
58
|
-
},
|
|
59
|
-
server: {
|
|
60
|
-
port: env.OPENFOX_PORT,
|
|
61
|
-
...env.OPENFOX_HOST !== void 0 ? { host: env.OPENFOX_HOST } : {}
|
|
62
|
-
},
|
|
63
|
-
database: {
|
|
64
|
-
path: env.OPENFOX_DB_PATH
|
|
65
|
-
},
|
|
66
|
-
mode: env.OPENFOX_DEV ? "development" : "production",
|
|
67
|
-
workdir,
|
|
68
|
-
...env.OPENFOX_DISABLE_AUTO_SESSION_TITLE !== void 0 ? { disableAutoSessionTitle: env.OPENFOX_DISABLE_AUTO_SESSION_TITLE } : {},
|
|
69
|
-
...env.OPENFOX_DEFAULT_AGENT !== void 0 ? { defaultAgent: env.OPENFOX_DEFAULT_AGENT } : {}
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// src/server/runtime-config.ts
|
|
74
|
-
var runtimeConfig = null;
|
|
75
|
-
function setRuntimeConfig(config) {
|
|
76
|
-
runtimeConfig = config;
|
|
77
|
-
}
|
|
78
|
-
function getRuntimeConfig() {
|
|
79
|
-
return runtimeConfig ?? loadConfig();
|
|
80
|
-
}
|
|
81
|
-
|
|
82
12
|
// src/server/agents/registry.ts
|
|
83
13
|
import { readdir as readdir2, readFile as readFile2, writeFile as writeFile2, mkdir as mkdir2, access as access2, unlink as unlink2 } from "fs/promises";
|
|
84
14
|
import { join as join2, dirname } from "path";
|
|
@@ -158,6 +88,76 @@ async function deleteItemFromDir(dir, id, ext) {
|
|
|
158
88
|
}
|
|
159
89
|
}
|
|
160
90
|
|
|
91
|
+
// src/server/config.ts
|
|
92
|
+
import { z } from "zod";
|
|
93
|
+
var backendSchema = z.enum(["vllm", "sglang", "ollama", "llamacpp", "unknown"]).default("unknown");
|
|
94
|
+
var envSchema = z.object({
|
|
95
|
+
// New env var name, with fallback to old name for backward compatibility
|
|
96
|
+
OPENFOX_LLM_URL: z.string().url().optional(),
|
|
97
|
+
OPENFOX_VLLM_URL: z.string().url().optional(),
|
|
98
|
+
OPENFOX_BACKEND: backendSchema,
|
|
99
|
+
OPENFOX_MODEL_NAME: z.string().default(""),
|
|
100
|
+
OPENFOX_MAX_CONTEXT: z.coerce.number().default(2e5),
|
|
101
|
+
OPENFOX_PORT: z.coerce.number().default(10369),
|
|
102
|
+
OPENFOX_HOST: z.string().optional(),
|
|
103
|
+
OPENFOX_WORKDIR: z.string().optional(),
|
|
104
|
+
OPENFOX_DB_PATH: z.string().default("./openfox.db"),
|
|
105
|
+
OPENFOX_LOG_LEVEL: z.enum(["debug", "info", "warn", "error"]).default("info"),
|
|
106
|
+
OPENFOX_REASONING_EFFORT: z.string().optional(),
|
|
107
|
+
// Deprecated: use OPENFOX_REASONING_EFFORT=none instead
|
|
108
|
+
OPENFOX_DISABLE_THINKING: z.coerce.boolean().default(false),
|
|
109
|
+
OPENFOX_LLM_TIMEOUT: z.coerce.number().default(3e5),
|
|
110
|
+
OPENFOX_LLM_IDLE_TIMEOUT: z.coerce.number().default(3e5),
|
|
111
|
+
OPENFOX_DEV: z.coerce.boolean().default(false),
|
|
112
|
+
OPENFOX_DISABLE_AUTO_SESSION_TITLE: z.coerce.boolean().optional(),
|
|
113
|
+
OPENFOX_DEFAULT_AGENT: z.string().optional()
|
|
114
|
+
});
|
|
115
|
+
function loadConfig() {
|
|
116
|
+
const env = envSchema.parse(process.env);
|
|
117
|
+
const llmUrl = env.OPENFOX_LLM_URL ?? env.OPENFOX_VLLM_URL ?? "http://localhost:8000/v1";
|
|
118
|
+
const workdir = env.OPENFOX_WORKDIR ?? process.cwd();
|
|
119
|
+
return {
|
|
120
|
+
llm: {
|
|
121
|
+
baseUrl: llmUrl,
|
|
122
|
+
model: env.OPENFOX_MODEL_NAME,
|
|
123
|
+
timeout: env.OPENFOX_LLM_TIMEOUT,
|
|
124
|
+
idleTimeout: env.OPENFOX_LLM_IDLE_TIMEOUT,
|
|
125
|
+
backend: env.OPENFOX_BACKEND,
|
|
126
|
+
...env.OPENFOX_REASONING_EFFORT ? { reasoningEffort: env.OPENFOX_REASONING_EFFORT } : env.OPENFOX_DISABLE_THINKING ? { reasoningEffort: "none" } : {}
|
|
127
|
+
},
|
|
128
|
+
context: {
|
|
129
|
+
maxTokens: env.OPENFOX_MAX_CONTEXT,
|
|
130
|
+
compactionThreshold: 0.85,
|
|
131
|
+
compactionTarget: 0.6
|
|
132
|
+
},
|
|
133
|
+
agent: {
|
|
134
|
+
maxIterations: 10,
|
|
135
|
+
maxConsecutiveFailures: 3,
|
|
136
|
+
toolTimeout: 3e5
|
|
137
|
+
},
|
|
138
|
+
server: {
|
|
139
|
+
port: env.OPENFOX_PORT,
|
|
140
|
+
...env.OPENFOX_HOST !== void 0 ? { host: env.OPENFOX_HOST } : {}
|
|
141
|
+
},
|
|
142
|
+
database: {
|
|
143
|
+
path: env.OPENFOX_DB_PATH
|
|
144
|
+
},
|
|
145
|
+
mode: env.OPENFOX_DEV ? "development" : "production",
|
|
146
|
+
workdir,
|
|
147
|
+
...env.OPENFOX_DISABLE_AUTO_SESSION_TITLE !== void 0 ? { disableAutoSessionTitle: env.OPENFOX_DISABLE_AUTO_SESSION_TITLE } : {},
|
|
148
|
+
...env.OPENFOX_DEFAULT_AGENT !== void 0 ? { defaultAgent: env.OPENFOX_DEFAULT_AGENT } : {}
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// src/server/runtime-config.ts
|
|
153
|
+
var runtimeConfig = null;
|
|
154
|
+
function setRuntimeConfig(config) {
|
|
155
|
+
runtimeConfig = config;
|
|
156
|
+
}
|
|
157
|
+
function getRuntimeConfig() {
|
|
158
|
+
return runtimeConfig ?? loadConfig();
|
|
159
|
+
}
|
|
160
|
+
|
|
161
161
|
// src/server/agents/registry.ts
|
|
162
162
|
var __bundleDir = dirname(fileURLToPath(import.meta.url));
|
|
163
163
|
var DEFAULTS_DIR = join2(__bundleDir, "defaults");
|
|
@@ -287,6 +287,10 @@ async function getDefaultAgentIds() {
|
|
|
287
287
|
}
|
|
288
288
|
return [];
|
|
289
289
|
}
|
|
290
|
+
async function getDefaultAgentContent(agentId) {
|
|
291
|
+
const defaults = await loadDefaultAgents();
|
|
292
|
+
return defaults.find((a) => a.metadata.id === agentId) ?? null;
|
|
293
|
+
}
|
|
290
294
|
async function isDefaultAgent(agentId) {
|
|
291
295
|
const defaultIds = await getDefaultAgentIds();
|
|
292
296
|
return defaultIds.includes(agentId);
|
|
@@ -348,6 +352,16 @@ async function deleteAgent(configDir, agentId) {
|
|
|
348
352
|
}
|
|
349
353
|
return { success: false };
|
|
350
354
|
}
|
|
355
|
+
async function getOverrideAgentIds(configDir, projectDir) {
|
|
356
|
+
const [defaultIds, userAgents, projectAgents] = await Promise.all([
|
|
357
|
+
getDefaultAgentIds(),
|
|
358
|
+
loadUserAgents(configDir),
|
|
359
|
+
projectDir ? loadProjectAgents(projectDir) : []
|
|
360
|
+
]);
|
|
361
|
+
const userOverrides = userAgents.map((agent) => agent.metadata.id).filter((id) => defaultIds.includes(id));
|
|
362
|
+
const projectOverrides = projectAgents.map((agent) => agent.metadata.id).filter((id) => defaultIds.includes(id));
|
|
363
|
+
return [...userOverrides, ...projectOverrides];
|
|
364
|
+
}
|
|
351
365
|
function resolveDefaultAgentId() {
|
|
352
366
|
try {
|
|
353
367
|
const dbSetting = getSetting(SETTINGS_KEYS.DEFAULT_AGENT);
|
|
@@ -387,6 +401,7 @@ export {
|
|
|
387
401
|
deleteProjectAgent,
|
|
388
402
|
loadAllAgentsDefault,
|
|
389
403
|
getDefaultAgentIds,
|
|
404
|
+
getDefaultAgentContent,
|
|
390
405
|
isDefaultAgent,
|
|
391
406
|
findAgentById,
|
|
392
407
|
getSubAgents,
|
|
@@ -394,6 +409,7 @@ export {
|
|
|
394
409
|
agentExists,
|
|
395
410
|
saveAgent,
|
|
396
411
|
deleteAgent,
|
|
412
|
+
getOverrideAgentIds,
|
|
397
413
|
resolveDefaultAgentId
|
|
398
414
|
};
|
|
399
|
-
//# sourceMappingURL=chunk-
|
|
415
|
+
//# sourceMappingURL=chunk-NGN3Q26A.js.map
|