openfox 2.0.65 → 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.
Files changed (59) hide show
  1. package/README.md +1 -0
  2. package/dist/agent-defaults/builder.agent.md +1 -1
  3. package/dist/agent-defaults/code-reviewer.agent.md +0 -1
  4. package/dist/agent-defaults/explorer.agent.md +0 -1
  5. package/dist/agent-defaults/planner.agent.md +1 -1
  6. package/dist/{branch.api-LAN42BA5.js → branch.api-3YJSWOZG.js} +5 -1
  7. package/dist/{chat-handler-MC3XZ3OV.js → chat-handler-ZRDNSLOG.js} +14 -12
  8. package/dist/{chunk-UEIQKG5P.js → chunk-3ACDQKK6.js} +290 -326
  9. package/dist/{chunk-RYIREJAW.js → chunk-5EO6SEGV.js} +2 -2
  10. package/dist/{chunk-OESYKZCM.js → chunk-5V5DM5E4.js} +3 -3
  11. package/dist/{chunk-QBYQ7KDX.js → chunk-B7WGOK7G.js} +16 -15
  12. package/dist/{chunk-Z6W4YHJB.js → chunk-BL5LOLVA.js} +17 -1
  13. package/dist/{chunk-TMUBLQFC.js → chunk-C3VLGVSQ.js} +3 -3
  14. package/dist/{chunk-ZPIZLTWU.js → chunk-GMXKJGJ2.js} +5 -1
  15. package/dist/{chunk-YQ3SOPBI.js → chunk-KXVFHMSM.js} +2 -2
  16. package/dist/chunk-OBK3I4KD.js +137 -0
  17. package/dist/{chunk-Z6H7SFQR.js → chunk-OE5B44P6.js} +258 -65
  18. package/dist/{chunk-PXJ4NOP4.js → chunk-PVRSNXD4.js} +2 -2
  19. package/dist/{chunk-X5YCWKNS.js → chunk-R4UTFE63.js} +53 -83
  20. package/dist/{chunk-4UYKN6JU.js → chunk-R7EED6ZU.js} +3 -3
  21. package/dist/{chunk-AIJE3RYH.js → chunk-TFDK6VSG.js} +33 -7
  22. package/dist/{chunk-QJ5FH5DP.js → chunk-TMHWQYWE.js} +4 -4
  23. package/dist/{chunk-VWPY2KWH.js → chunk-UBIHP5Z7.js} +8 -8
  24. package/dist/chunk-WGMJCFCE.js +14 -0
  25. package/dist/{chunk-LBGHZLLH.js → chunk-WNA5VPZG.js} +2 -2
  26. package/dist/{chunk-N4K3PNOS.js → chunk-ZUM2ZJOX.js} +46 -18
  27. package/dist/cli/dev.js +1 -1
  28. package/dist/cli/index.js +1 -1
  29. package/dist/{client-LAKW7TA5.js → client-BUX62J2K.js} +3 -3
  30. package/dist/{client-pure-DO3S675T.js → client-pure-U6ZYUPJQ.js} +6 -4
  31. package/dist/{compactor-I3N56PSJ.js → compactor-V43WJ3WX.js} +7 -7
  32. package/dist/{events-52XADT6Y.js → events-CDQ4HASP.js} +4 -4
  33. package/dist/{folding-2BGFLV5J.js → folding-V2K34EGN.js} +2 -2
  34. package/dist/{inspect-proxy-BV25JERQ.js → inspect-proxy-PKMDR47R.js} +4 -4
  35. package/dist/{orchestrator-IYJRQQKB.js → orchestrator-LZQTDOWM.js} +13 -11
  36. package/dist/package.json +1 -1
  37. package/dist/{processor-LUXKVIED.js → processor-7KAXESY5.js} +14 -12
  38. package/dist/{project-creator-IDW7RACH.js → project-creator-EMGRSPYS.js} +18 -5
  39. package/dist/{projects-BY227WT2.js → projects-7HSBZY2D.js} +3 -3
  40. package/dist/{protocol-Cq66hdDX.d.ts → protocol-42f_Png6.d.ts} +1 -1
  41. package/dist/provider/index.d.ts +4 -4
  42. package/dist/{provider-GYOW4OWQ.js → provider-BDH6JGZB.js} +4 -4
  43. package/dist/{provider-manager-HRHNF73A.js → provider-manager-D3KIOD5E.js} +4 -4
  44. package/dist/{serve-ZRTWVOL2.js → serve-HGHFN3D2.js} +18 -16
  45. package/dist/server/index.d.ts +26 -8
  46. package/dist/server/index.js +17 -15
  47. package/dist/{server-PXXGMFBT.js → server-W42ENYFX.js} +15 -13
  48. package/dist/{settings-JA4XUR3W.js → settings-ZZ6AKFPD.js} +3 -3
  49. package/dist/shared/index.d.ts +3 -3
  50. package/dist/{tools-ZZM36DAZ.js → tools-2EB7C6H2.js} +12 -10
  51. package/dist/{types-CDZakn7f.d.ts → types-apiMd7Df.d.ts} +1 -1
  52. package/dist/{types-akHmgvBk.d.ts → types-vezAEt_y.d.ts} +3 -1
  53. package/dist/web/assets/{index-Dc05znz4.css → index-B0Q5uK2h.css} +1 -1
  54. package/dist/web/assets/index-BhQN93bI.js +303 -0
  55. package/dist/web/index.html +2 -2
  56. package/dist/web/sw.js +1 -1
  57. package/dist/worktree-EIF75WGF.js +26 -0
  58. package/package.json +1 -1
  59. package/dist/web/assets/index-Bsi_le80.js +0 -303
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createLLMClient
3
- } from "./chunk-QBYQ7KDX.js";
3
+ } from "./chunk-B7WGOK7G.js";
4
4
  import {
5
5
  getModelProfile
6
6
  } from "./chunk-V4IE7HJY.js";
@@ -796,4 +796,4 @@ export {
796
796
  parseDefaultModelSelection,
797
797
  createProviderManager
798
798
  };
799
- //# sourceMappingURL=chunk-RYIREJAW.js.map
799
+ //# sourceMappingURL=chunk-5EO6SEGV.js.map
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  COMPACTION_PROMPT,
3
3
  createMessageStartEvent
4
- } from "./chunk-X5YCWKNS.js";
4
+ } from "./chunk-R4UTFE63.js";
5
5
  import {
6
6
  getCurrentWindowMessageOptions
7
- } from "./chunk-AIJE3RYH.js";
7
+ } from "./chunk-TFDK6VSG.js";
8
8
 
9
9
  // src/server/context/compactor.ts
10
10
  function appendCompactionPrompt(sessionId, append) {
@@ -31,4 +31,4 @@ export {
31
31
  shouldCompact,
32
32
  getCompactionTarget
33
33
  };
34
- //# sourceMappingURL=chunk-OESYKZCM.js.map
34
+ //# sourceMappingURL=chunk-5V5DM5E4.js.map
@@ -11,8 +11,9 @@ import {
11
11
  buildNonStreamingCreateParams,
12
12
  buildStreamingCreateParams,
13
13
  getThinking,
14
- mapFinishReason
15
- } from "./chunk-Z6W4YHJB.js";
14
+ mapFinishReason,
15
+ parseToolArguments
16
+ } from "./chunk-BL5LOLVA.js";
16
17
  import {
17
18
  LLMError,
18
19
  OpenAIHttpClient
@@ -92,11 +93,10 @@ function createLLMClient(config, initialBackend = "unknown") {
92
93
  const message = choice.message;
93
94
  const content = message.content ?? "";
94
95
  const thinkingContent = getThinking(message, thinkingField) ?? "";
95
- const toolCalls = message.tool_calls?.map((tc) => ({
96
- id: tc.id,
97
- name: tc.function.name,
98
- arguments: JSON.parse(tc.function.arguments)
99
- }));
96
+ const toolCalls = message.tool_calls?.map((tc) => {
97
+ const { arguments: args, parseError } = parseToolArguments(tc.function.arguments, { id: tc.id, name: tc.function.name });
98
+ return { id: tc.id, name: tc.function.name, arguments: args, ...parseError ? { parseError } : {} };
99
+ });
100
100
  return {
101
101
  id: httpResponse.id,
102
102
  content,
@@ -222,20 +222,21 @@ function createLLMClient(config, initialBackend = "unknown") {
222
222
  const finalThinking = fullThinking.trim();
223
223
  const parsedToolCalls = [];
224
224
  for (const [, tc] of toolCalls) {
225
- try {
225
+ const { arguments: args, parseError } = parseToolArguments(tc.arguments, { id: tc.id, name: tc.name });
226
+ if (parseError) {
227
+ logger.warn("Failed to parse tool call arguments", { name: tc.name, arguments: tc.arguments, parseError });
226
228
  parsedToolCalls.push({
227
229
  id: tc.id,
228
230
  name: tc.name,
229
- arguments: JSON.parse(tc.arguments)
231
+ arguments: args,
232
+ parseError,
233
+ rawArguments: tc.arguments
230
234
  });
231
- } catch (error) {
232
- logger.warn("Failed to parse tool call arguments", { name: tc.name, arguments: tc.arguments });
235
+ } else {
233
236
  parsedToolCalls.push({
234
237
  id: tc.id,
235
238
  name: tc.name,
236
- arguments: {},
237
- parseError: error instanceof Error ? error.message : "Unknown JSON parse error",
238
- rawArguments: tc.arguments
239
+ arguments: args
239
240
  });
240
241
  }
241
242
  }
@@ -264,4 +265,4 @@ function createLLMClient(config, initialBackend = "unknown") {
264
265
  export {
265
266
  createLLMClient
266
267
  };
267
- //# sourceMappingURL=chunk-QBYQ7KDX.js.map
268
+ //# sourceMappingURL=chunk-B7WGOK7G.js.map
@@ -1,4 +1,19 @@
1
1
  // src/server/llm/client-pure.ts
2
+ function parseToolArguments(raw, _meta) {
3
+ const input = raw?.trim() ? raw : "{}";
4
+ try {
5
+ const parsed = JSON.parse(input);
6
+ if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
7
+ return { arguments: {}, parseError: "Tool arguments must be a JSON object" };
8
+ }
9
+ return { arguments: parsed };
10
+ } catch (error) {
11
+ return {
12
+ arguments: {},
13
+ parseError: error instanceof Error ? error.message : "Invalid JSON"
14
+ };
15
+ }
16
+ }
2
17
  function buildModelParams(params) {
3
18
  return {
4
19
  ...params.temperature !== void 0 && { temperature: params.temperature },
@@ -195,6 +210,7 @@ function mapFinishReason(reason) {
195
210
  }
196
211
 
197
212
  export {
213
+ parseToolArguments,
198
214
  buildModelParams,
199
215
  getThinking,
200
216
  convertMessages,
@@ -203,4 +219,4 @@ export {
203
219
  buildStreamingCreateParams,
204
220
  mapFinishReason
205
221
  };
206
- //# sourceMappingURL=chunk-Z6W4YHJB.js.map
222
+ //# sourceMappingURL=chunk-BL5LOLVA.js.map
@@ -822,9 +822,9 @@ function buildSnapshotFromSessionState(input) {
822
822
  criteria: session.criteria,
823
823
  metadataEntries: foldedState.metadataEntries,
824
824
  contextState: {
825
- currentTokens: session.executionState?.currentTokenCount ?? foldedState.contextState.currentTokens,
825
+ currentTokens: foldedState.contextState.currentTokens,
826
826
  maxTokens: foldedState.contextState.maxTokens,
827
- compactionCount: session.executionState?.compactionCount ?? foldedState.contextState.compactionCount,
827
+ compactionCount: foldedState.contextState.compactionCount,
828
828
  dangerZone: foldedState.contextState.dangerZone,
829
829
  canCompact: foldedState.contextState.canCompact,
830
830
  dynamicContextChanged: foldedState.contextState.dynamicContextChanged
@@ -867,4 +867,4 @@ export {
867
867
  buildSnapshot,
868
868
  buildSnapshotFromSessionState
869
869
  };
870
- //# sourceMappingURL=chunk-TMUBLQFC.js.map
870
+ //# sourceMappingURL=chunk-C3VLGVSQ.js.map
@@ -173,6 +173,10 @@ function runMigrations(db2) {
173
173
  logger.info("Migrating sessions table: adding cached_hash column");
174
174
  db2.exec(`ALTER TABLE sessions ADD COLUMN cached_hash TEXT`);
175
175
  }
176
+ if (!columnNames.includes("worktree")) {
177
+ logger.info("Migrating sessions table: adding worktree column");
178
+ db2.exec(`ALTER TABLE sessions ADD COLUMN worktree TEXT`);
179
+ }
176
180
  logger.info("Database migrations completed");
177
181
  }
178
182
 
@@ -180,4 +184,4 @@ export {
180
184
  initDatabase,
181
185
  getDatabase
182
186
  };
183
- //# sourceMappingURL=chunk-ZPIZLTWU.js.map
187
+ //# sourceMappingURL=chunk-GMXKJGJ2.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getDatabase
3
- } from "./chunk-ZPIZLTWU.js";
3
+ } from "./chunk-GMXKJGJ2.js";
4
4
 
5
5
  // src/server/db/projects.ts
6
6
  function createProject(name, workdir) {
@@ -117,4 +117,4 @@ export {
117
117
  deleteProject,
118
118
  toggleStar
119
119
  };
120
- //# sourceMappingURL=chunk-YQ3SOPBI.js.map
120
+ //# sourceMappingURL=chunk-KXVFHMSM.js.map
@@ -0,0 +1,137 @@
1
+ import {
2
+ gitSpawnEnv
3
+ } from "./chunk-WGMJCFCE.js";
4
+ import {
5
+ logger
6
+ } from "./chunk-K44MW7JJ.js";
7
+
8
+ // src/server/git/worktree.ts
9
+ import { spawn } from "child_process";
10
+ import { mkdir, readFile, appendFile, stat } from "fs/promises";
11
+ import { resolve } from "path";
12
+ function captureStdout(cwd, args) {
13
+ return new Promise((resolvePromise) => {
14
+ const proc = spawn("git", args, { cwd, env: gitSpawnEnv(), stdio: ["ignore", "pipe", "ignore"] });
15
+ let out = "";
16
+ proc.stdout.on("data", (d) => {
17
+ out += d.toString();
18
+ });
19
+ proc.on("close", (code) => resolvePromise(code === 0 ? out : null));
20
+ proc.on("error", () => resolvePromise(null));
21
+ });
22
+ }
23
+ function runGit(cwd, args) {
24
+ return new Promise((resolvePromise, reject) => {
25
+ const proc = spawn("git", args, { cwd, env: gitSpawnEnv(), stdio: ["ignore", "pipe", "pipe"] });
26
+ let stderr = "";
27
+ proc.stderr.on("data", (d) => {
28
+ stderr += d.toString();
29
+ });
30
+ proc.on("close", (code) => {
31
+ if (code === 0) resolvePromise();
32
+ else reject(new Error(stderr.trim() || `git ${args[0]} failed (code ${code})`));
33
+ });
34
+ proc.on("error", (err) => reject(err));
35
+ });
36
+ }
37
+ function getGitBranch(cwd) {
38
+ return captureStdout(cwd, ["rev-parse", "--abbrev-ref", "HEAD"]).then((r) => r?.trim() ?? null);
39
+ }
40
+ function listWorktrees(cwd) {
41
+ return captureStdout(cwd, ["worktree", "list", "--porcelain"]).then((out) => {
42
+ if (!out) return [];
43
+ const entries = [];
44
+ let current = {};
45
+ for (const line of out.split("\n")) {
46
+ if (line.startsWith("worktree ")) current.path = line.slice(9);
47
+ else if (line.startsWith("branch ")) current.branch = line.slice(7).replace("refs/heads/", "");
48
+ else if (line === "" && current.path && current.branch) {
49
+ entries.push({ path: current.path, branch: current.branch });
50
+ current = {};
51
+ }
52
+ }
53
+ if (current.path && current.branch) entries.push({ path: current.path, branch: current.branch });
54
+ return entries;
55
+ });
56
+ }
57
+ function validateRef(cwd, name) {
58
+ return runGit(cwd, ["check-ref-format", `refs/heads/${name}`]);
59
+ }
60
+ function addWorktree(cwd, args) {
61
+ return runGit(cwd, ["worktree", "add", ...args]);
62
+ }
63
+ async function ensureWorktreesIgnored(projectDir) {
64
+ const gitignorePath = resolve(projectDir, ".gitignore");
65
+ let content = "";
66
+ try {
67
+ content = await readFile(gitignorePath, "utf-8");
68
+ } catch {
69
+ }
70
+ const lines = content.split("\n");
71
+ const hasWorktreesIgnore = lines.some(
72
+ (line) => line.trim() === "worktrees/" || line.trim() === "/worktrees/" || line.trim() === "worktrees"
73
+ );
74
+ if (hasWorktreesIgnore) return;
75
+ const entry = content.length > 0 && !content.endsWith("\n") ? "\nworktrees/\n" : "worktrees/\n";
76
+ await appendFile(gitignorePath, entry);
77
+ }
78
+ function listBranches(cwd) {
79
+ return captureStdout(cwd, ["branch", "--format", "%(refname:short)%09%(HEAD)"]).then((out) => {
80
+ if (!out) return [];
81
+ const branches = [];
82
+ for (const line of out.trim().split("\n")) {
83
+ if (!line) continue;
84
+ const [name, head] = line.split(" ");
85
+ if (name) branches.push({ name, current: head === "*" });
86
+ }
87
+ return branches;
88
+ });
89
+ }
90
+ function checkoutBranch(cwd, name) {
91
+ return runGit(cwd, ["checkout", name]);
92
+ }
93
+ function createBranch(cwd, name) {
94
+ return runGit(cwd, ["checkout", "-b", name]);
95
+ }
96
+ function branchExists(cwd, name) {
97
+ return captureStdout(cwd, ["rev-parse", "--verify", `refs/heads/${name}`]).then((r) => r !== null);
98
+ }
99
+ async function ensureWorktree(projectDir, name, startBranch) {
100
+ await validateRef(projectDir, name);
101
+ const worktreesDir = resolve(projectDir, "worktrees");
102
+ const wtPath = resolve(worktreesDir, name.replace(/\//g, "-"));
103
+ await mkdir(worktreesDir, { recursive: true });
104
+ await ensureWorktreesIgnored(projectDir).catch((err) => {
105
+ logger.warn("Failed to update .gitignore", { projectDir, error: String(err) });
106
+ });
107
+ const startBranchResolved = startBranch ?? await getGitBranch(projectDir) ?? "main";
108
+ try {
109
+ const st = await stat(wtPath);
110
+ if (st.isDirectory()) return { path: wtPath, name };
111
+ } catch {
112
+ }
113
+ try {
114
+ await addWorktree(projectDir, ["-b", name, wtPath, startBranchResolved]);
115
+ } catch (err) {
116
+ const exists = await branchExists(projectDir, name);
117
+ if (exists) {
118
+ await addWorktree(projectDir, [wtPath, name]);
119
+ } else {
120
+ throw err;
121
+ }
122
+ }
123
+ return { path: wtPath, name };
124
+ }
125
+
126
+ export {
127
+ getGitBranch,
128
+ listWorktrees,
129
+ validateRef,
130
+ addWorktree,
131
+ ensureWorktreesIgnored,
132
+ listBranches,
133
+ checkoutBranch,
134
+ createBranch,
135
+ ensureWorktree
136
+ };
137
+ //# sourceMappingURL=chunk-OBK3I4KD.js.map