openfox 2.0.70 → 2.0.71

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 (39) hide show
  1. package/dist/{chat-handler-K3DWIGHG.js → chat-handler-IKLQ3ZUN.js} +11 -11
  2. package/dist/{chunk-XDWV5CYV.js → chunk-6V7DU7ID.js} +15 -20
  3. package/dist/{chunk-E4POUD2M.js → chunk-6XOA2WPU.js} +2 -2
  4. package/dist/chunk-7NMOWPNY.js +7 -0
  5. package/dist/{chunk-JHGKXQBO.js → chunk-EZK7CGJ7.js} +87 -30
  6. package/dist/{chunk-PK2RMVMB.js → chunk-I72ACQ6R.js} +19 -18
  7. package/dist/{chunk-64GN6OPR.js → chunk-NEL2REUM.js} +5 -5
  8. package/dist/{chunk-7OW6X764.js → chunk-OHGQILRF.js} +15 -4
  9. package/dist/{chunk-ZZ5JPVBT.js → chunk-OLXHRPAD.js} +38 -37
  10. package/dist/{chunk-TFCHWMOJ.js → chunk-PVUBCGAT.js} +2 -2
  11. package/dist/{chunk-QFSDJIUS.js → chunk-RKD2FML3.js} +2 -2
  12. package/dist/{chunk-YQ3MEZJL.js → chunk-TQGGMWS6.js} +2 -2
  13. package/dist/{chunk-UTSSFPYA.js → chunk-X7OCC37J.js} +5 -5
  14. package/dist/{chunk-PVWAE43V.js → chunk-Y4YESMVA.js} +50 -22
  15. package/dist/{chunk-46OR4W3L.js → chunk-Z42YTK3O.js} +17 -14
  16. package/dist/cli/dev.js +1 -1
  17. package/dist/cli/index.js +1 -1
  18. package/dist/{client-63U5CTPE.js → client-SC6X65GY.js} +3 -3
  19. package/dist/{client-pure-XHH4RRLB.js → client-pure-NMLDKRDN.js} +6 -4
  20. package/dist/{compactor-IPMMFFHM.js → compactor-MXXF5WQR.js} +4 -4
  21. package/dist/{manager-JXYRGR6B.js → manager-EHIQCIUP.js} +3 -3
  22. package/dist/{orchestrator-PUV4WG77.js → orchestrator-YGCZZNNV.js} +10 -10
  23. package/dist/package.json +2 -2
  24. package/dist/{processor-O2QW27BD.js → processor-K6UPVMIP.js} +11 -11
  25. package/dist/{provider-IBIWR4AI.js → provider-OJUCZ5RN.js} +4 -4
  26. package/dist/{provider-manager-7C3JVOLW.js → provider-manager-MAKXSL6L.js} +4 -4
  27. package/dist/{pwa-T6JRAYJB.js → pwa-SEWCVKZX.js} +7 -8
  28. package/dist/{serve-NOHD22CT.js → serve-5IOKFKGL.js} +18 -16
  29. package/dist/server/index.js +15 -14
  30. package/dist/{server-RLNPHLY2.js → server-T5QDCUBN.js} +12 -12
  31. package/dist/{service-6DL3MJZD.js → service-2PW2V25M.js} +6 -1
  32. package/dist/{store-FXTCHBI4.js → store-SARB6V2N.js} +2 -2
  33. package/dist/{tools-CALGWIV2.js → tools-K3SNGBI2.js} +14 -14
  34. package/dist/update-734IDLKT.js +40 -0
  35. package/dist/web/assets/{index-CtWMMQ_X.js → index-HTzupfR0.js} +1 -1
  36. package/dist/web/index.html +1 -1
  37. package/dist/web/sw.js +1 -1
  38. package/package.json +2 -2
  39. package/dist/cli/update.sh +0 -16
@@ -2,20 +2,21 @@ import {
2
2
  buildRunChatTurnParams,
3
3
  finalizeTurnCompletion,
4
4
  generateSessionNameForSession
5
- } from "./chunk-64GN6OPR.js";
5
+ } from "./chunk-NEL2REUM.js";
6
6
  import {
7
7
  runChatTurn
8
- } from "./chunk-UTSSFPYA.js";
9
- import "./chunk-PVWAE43V.js";
10
- import "./chunk-QFSDJIUS.js";
8
+ } from "./chunk-X7OCC37J.js";
9
+ import "./chunk-Y4YESMVA.js";
10
+ import "./chunk-VLV3XWZS.js";
11
+ import "./chunk-WGMJCFCE.js";
12
+ import "./chunk-EU3WWTFH.js";
13
+ import "./chunk-RKD2FML3.js";
11
14
  import "./chunk-4QBDV6LX.js";
12
15
  import "./chunk-KXVFHMSM.js";
13
- import "./chunk-TFCHWMOJ.js";
14
- import "./chunk-PK2RMVMB.js";
16
+ import "./chunk-PVUBCGAT.js";
17
+ import "./chunk-I72ACQ6R.js";
15
18
  import "./chunk-NWO6GRYE.js";
16
19
  import "./chunk-UN26GIQG.js";
17
- import "./chunk-VLV3XWZS.js";
18
- import "./chunk-WGMJCFCE.js";
19
20
  import {
20
21
  getEventStore
21
22
  } from "./chunk-TFDK6VSG.js";
@@ -28,11 +29,10 @@ import {
28
29
  import "./chunk-X5DOUA3Z.js";
29
30
  import "./chunk-XUPKS5FL.js";
30
31
  import "./chunk-GMXKJGJ2.js";
31
- import "./chunk-EU3WWTFH.js";
32
32
  import "./chunk-J2GP3J3X.js";
33
33
  import "./chunk-V4IE7HJY.js";
34
34
  import "./chunk-YHEQTVFV.js";
35
- import "./chunk-JHGKXQBO.js";
35
+ import "./chunk-EZK7CGJ7.js";
36
36
  import "./chunk-K44MW7JJ.js";
37
37
  import "./chunk-YD6NDTKF.js";
38
38
  import "./chunk-WGAAQASA.js";
@@ -158,4 +158,4 @@ export {
158
158
  startChatSession,
159
159
  stopSessionExecution
160
160
  };
161
- //# sourceMappingURL=chat-handler-K3DWIGHG.js.map
161
+ //# sourceMappingURL=chat-handler-IKLQ3ZUN.js.map
@@ -7,9 +7,6 @@ import {
7
7
 
8
8
  // src/cli/main.ts
9
9
  import { parseArgs } from "util";
10
- import { spawnSync } from "child_process";
11
- import { fileURLToPath } from "url";
12
- import { dirname, join } from "path";
13
10
  import { generateKeyPairSync } from "crypto";
14
11
  import { writeFile } from "fs/promises";
15
12
  function printHelp() {
@@ -28,7 +25,7 @@ Commands:
28
25
  provider remove Remove a provider
29
26
  service Manage the systemd service (install, start, stop, status, logs, uninstall)
30
27
  pwa Manage the PWA installation (install, uninstall, launch, update, status)
31
- update Update OpenFox to the latest version (see update.sh)
28
+ update Update OpenFox to the latest version
32
29
 
33
30
  Options:
34
31
  -p, --port <number> Specify port (default: 10369 for prod, 10469 for dev)
@@ -145,11 +142,11 @@ async function runCli(options) {
145
142
  const [command] = positionals;
146
143
  if (values.version && !command) {
147
144
  const { readFileSync } = await import("fs");
148
- const { fileURLToPath: fileURLToPath2 } = await import("url");
149
- const { dirname: dirname2, join: join2 } = await import("path");
150
- const __filename = fileURLToPath2(import.meta.url);
151
- const __dirname = dirname2(__filename);
152
- const packageJsonPath = join2(__dirname, "../package.json");
145
+ const { fileURLToPath } = await import("url");
146
+ const { dirname, join } = await import("path");
147
+ const __filename = fileURLToPath(import.meta.url);
148
+ const __dirname = dirname(__filename);
149
+ const packageJsonPath = join(__dirname, "../package.json");
153
150
  const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf-8"));
154
151
  console.log(packageJson.version);
155
152
  process.exit(0);
@@ -164,13 +161,13 @@ async function runCli(options) {
164
161
  break;
165
162
  }
166
163
  case "provider": {
167
- const { runProviderCommand } = await import("./provider-IBIWR4AI.js");
164
+ const { runProviderCommand } = await import("./provider-OJUCZ5RN.js");
168
165
  const [, subcommand] = positionals;
169
166
  await runProviderCommand(mode, subcommand);
170
167
  break;
171
168
  }
172
169
  case "service": {
173
- const { runServiceCommand } = await import("./service-6DL3MJZD.js");
170
+ const { runServiceCommand } = await import("./service-2PW2V25M.js");
174
171
  const [, subcommand, ...serviceArgs] = positionals;
175
172
  if (values.follow) {
176
173
  serviceArgs.push("-f");
@@ -183,7 +180,7 @@ async function runCli(options) {
183
180
  break;
184
181
  }
185
182
  case "pwa": {
186
- const { runPwaCommand, printPwaHelp } = await import("./pwa-T6JRAYJB.js");
183
+ const { runPwaCommand, printPwaHelp } = await import("./pwa-SEWCVKZX.js");
187
184
  const [, subcommand] = positionals;
188
185
  if (subcommand === "--help" || subcommand === "-h" || values.help) {
189
186
  printPwaHelp();
@@ -193,12 +190,10 @@ async function runCli(options) {
193
190
  break;
194
191
  }
195
192
  case "update": {
196
- const __filename = fileURLToPath(import.meta.url);
197
- const __dirname = dirname(__filename);
198
- const updateScriptPath = join(__dirname, "cli", "update.sh");
199
- const result = spawnSync(updateScriptPath, [], { shell: true, stdio: "inherit", windowsHide: true });
200
- if (result.status !== 0) {
201
- process.exit(result.status ?? 1);
193
+ const { runUpdate } = await import("./update-734IDLKT.js");
194
+ const code = runUpdate();
195
+ if (code !== 0) {
196
+ process.exit(code);
202
197
  }
203
198
  break;
204
199
  }
@@ -208,7 +203,7 @@ async function runCli(options) {
208
203
  if (!configExists) {
209
204
  await runNetworkSetup(mode);
210
205
  }
211
- const { runServe } = await import("./serve-NOHD22CT.js");
206
+ const { runServe } = await import("./serve-5IOKFKGL.js");
212
207
  const serveOptions = { mode };
213
208
  if (values.port) serveOptions.port = parseInt(values.port);
214
209
  if (values["no-browser"] === true) serveOptions.openBrowser = false;
@@ -220,4 +215,4 @@ async function runCli(options) {
220
215
  export {
221
216
  runCli
222
217
  };
223
- //# sourceMappingURL=chunk-XDWV5CYV.js.map
218
+ //# sourceMappingURL=chunk-6V7DU7ID.js.map
@@ -13,7 +13,7 @@ import {
13
13
  getThinking,
14
14
  mapFinishReason,
15
15
  parseToolArguments
16
- } from "./chunk-JHGKXQBO.js";
16
+ } from "./chunk-EZK7CGJ7.js";
17
17
  import {
18
18
  LLMError,
19
19
  OpenAIHttpClient
@@ -265,4 +265,4 @@ function createLLMClient(config, initialBackend = "unknown") {
265
265
  export {
266
266
  createLLMClient
267
267
  };
268
- //# sourceMappingURL=chunk-E4POUD2M.js.map
268
+ //# sourceMappingURL=chunk-6XOA2WPU.js.map
@@ -0,0 +1,7 @@
1
+ // src/constants.ts
2
+ var VERSION = "2.0.71";
3
+
4
+ export {
5
+ VERSION
6
+ };
7
+ //# sourceMappingURL=chunk-7NMOWPNY.js.map
@@ -1,3 +1,16 @@
1
+ // src/shared/constants.ts
2
+ var TEXT_MIME_PREFIXES = ["text/"];
3
+ var TEXT_MIME_EXACT = [
4
+ "application/json",
5
+ "application/xml",
6
+ "application/yaml",
7
+ "application/x-yaml",
8
+ "application/javascript",
9
+ "application/xhtml+xml",
10
+ "application/x-sh",
11
+ "image/svg+xml"
12
+ ];
13
+
1
14
  // src/server/tools/types.ts
2
15
  var OUTPUT_LIMITS = {
3
16
  read_file: {
@@ -83,18 +96,76 @@ ${pageText}`);
83
96
  return { text, pageCount, title, author };
84
97
  }
85
98
 
86
- // src/shared/constants.ts
87
- var TEXT_MIME_PREFIXES = ["text/"];
88
- var TEXT_MIME_EXACT = [
89
- "application/json",
90
- "application/xml",
91
- "application/yaml",
92
- "application/x-yaml",
93
- "application/javascript",
94
- "application/xhtml+xml",
95
- "application/x-sh",
96
- "image/svg+xml"
97
- ];
99
+ // src/server/llm/resolve-attachments.ts
100
+ function decodeDataUrlToText(data) {
101
+ const match = data.match(/^data:.*?;base64,(.+)$/);
102
+ if (match?.[1]) {
103
+ return Buffer.from(match[1], "base64").toString("utf8");
104
+ }
105
+ return data;
106
+ }
107
+ async function extractPdfFromDataUrl(data, filename) {
108
+ const base64Match = data.match(/^data:.*?;base64,(.+)$/);
109
+ if (base64Match?.[1]) {
110
+ try {
111
+ const buffer = Buffer.from(base64Match[1], "base64");
112
+ const result = await extractPdfText(buffer);
113
+ return `[PDF: ${filename}]
114
+ ${result.text}`;
115
+ } catch {
116
+ return `[PDF: ${filename}] (could not extract text)`;
117
+ }
118
+ }
119
+ return `[PDF: ${filename}] (could not extract text)`;
120
+ }
121
+ async function resolveAttachmentToText(attachment, supportsVision) {
122
+ const mimeType = attachment.mimeType;
123
+ if (TEXT_MIME_EXACT.includes(mimeType) || TEXT_MIME_PREFIXES.some((p) => mimeType.startsWith(p))) {
124
+ const text = decodeDataUrlToText(attachment.data);
125
+ return `[File: ${attachment.filename || "file"}]
126
+ ${text}`;
127
+ }
128
+ if (mimeType === "application/pdf") {
129
+ return extractPdfFromDataUrl(attachment.data, attachment.filename || "document.pdf");
130
+ }
131
+ if (supportsVision) {
132
+ return `[File: ${attachment.filename || "file"} (unsupported type: ${mimeType})]`;
133
+ }
134
+ if (attachment.description) {
135
+ return `[Image: ${attachment.filename || "image"} - description: ${attachment.description}]`;
136
+ }
137
+ return `[Image: ${attachment.filename || "image"}] (vision not supported, cannot describe)`;
138
+ }
139
+ async function resolveAttachmentsInMessages(messages, supportsVision) {
140
+ const result = [];
141
+ for (const msg of messages) {
142
+ if (!msg.attachments || msg.attachments.length === 0) {
143
+ result.push(msg);
144
+ continue;
145
+ }
146
+ if (supportsVision && msg.attachments.every((a) => a.mimeType.startsWith("image/"))) {
147
+ result.push(msg);
148
+ continue;
149
+ }
150
+ const parts = [];
151
+ if (msg.content?.trim()) parts.push(msg.content);
152
+ const remainingImageAttachments = [];
153
+ for (const attachment of msg.attachments) {
154
+ if (supportsVision && attachment.mimeType.startsWith("image/")) {
155
+ remainingImageAttachments.push(attachment);
156
+ continue;
157
+ }
158
+ const text = await resolveAttachmentToText(attachment, supportsVision);
159
+ if (text) parts.push(text);
160
+ }
161
+ result.push({
162
+ ...msg,
163
+ content: parts.join("\n\n"),
164
+ attachments: remainingImageAttachments
165
+ });
166
+ }
167
+ return result;
168
+ }
98
169
 
99
170
  // src/server/llm/client-pure.ts
100
171
  function parseToolArguments(raw, _meta) {
@@ -171,23 +242,8 @@ ${attachment.data}`
171
242
  };
172
243
  }
173
244
  if (mimeType === "application/pdf") {
174
- try {
175
- const base64Match = attachment.data.match(/^data:.*?;base64,(.+)$/);
176
- if (base64Match?.[1]) {
177
- const buffer = Buffer.from(base64Match[1], "base64");
178
- const result = await extractPdfText(buffer);
179
- return {
180
- type: "text",
181
- text: `[PDF: ${attachment.filename || "document.pdf"}]
182
- ${result.text}`
183
- };
184
- }
185
- } catch {
186
- }
187
- return {
188
- type: "text",
189
- text: `[PDF: ${attachment.filename || "document.pdf"}] (could not extract text)`
190
- };
245
+ const text = await extractPdfFromDataUrl(attachment.data, attachment.filename || "document.pdf");
246
+ return { type: "text", text };
191
247
  }
192
248
  if (modelSupportsVision) {
193
249
  return {
@@ -343,6 +399,7 @@ export {
343
399
  formatPdfErrorMessage,
344
400
  processPdfContent,
345
401
  extractPdfText,
402
+ resolveAttachmentsInMessages,
346
403
  parseToolArguments,
347
404
  buildModelParams,
348
405
  getThinking,
@@ -352,4 +409,4 @@ export {
352
409
  buildStreamingCreateParams,
353
410
  mapFinishReason
354
411
  };
355
- //# sourceMappingURL=chunk-JHGKXQBO.js.map
412
+ //# sourceMappingURL=chunk-EZK7CGJ7.js.map
@@ -43,7 +43,7 @@ function killProcess(pid, signal) {
43
43
  } catch {
44
44
  }
45
45
  }
46
- async function killProcessTree(pid) {
46
+ async function killProcessTree(pid, immediate = false) {
47
47
  if (process.platform === "win32") {
48
48
  await new Promise((resolve) => {
49
49
  const killer = spawn("taskkill", ["/pid", String(pid), "/f", "/t"], {
@@ -55,14 +55,23 @@ async function killProcessTree(pid) {
55
55
  });
56
56
  return;
57
57
  }
58
- const allPids = await getDescendantPids(pid);
59
- allPids.push(pid);
60
- for (const p of allPids) {
61
- killProcess(p, "SIGTERM");
58
+ if (!immediate) {
59
+ try {
60
+ process.kill(-pid, "SIGTERM");
61
+ } catch {
62
+ }
63
+ await sleep(SIGKILL_TIMEOUT_MS);
62
64
  }
63
- await sleep(SIGKILL_TIMEOUT_MS);
64
- for (const p of allPids) {
65
- killProcess(p, "SIGKILL");
65
+ try {
66
+ process.kill(-pid, "SIGKILL");
67
+ } catch {
68
+ }
69
+ const survivors = await getDescendantPids(pid);
70
+ if (survivors.length > 0) {
71
+ survivors.push(pid);
72
+ for (const p of survivors) {
73
+ killProcess(p, "SIGKILL");
74
+ }
66
75
  }
67
76
  }
68
77
  async function terminateProcessTree(proc, options) {
@@ -70,15 +79,7 @@ async function terminateProcessTree(proc, options) {
70
79
  if (!pid || options?.exited?.()) {
71
80
  return;
72
81
  }
73
- if (options?.immediate) {
74
- const allPids = await getDescendantPids(pid);
75
- allPids.push(pid);
76
- for (const p of allPids) {
77
- killProcess(p, "SIGKILL");
78
- }
79
- return;
80
- }
81
- await killProcessTree(pid);
82
+ await killProcessTree(pid, options?.immediate ?? false);
82
83
  }
83
84
 
84
85
  // src/server/tools/background-process/store.ts
@@ -224,4 +225,4 @@ export {
224
225
  getProcessById,
225
226
  cleanupAllProcesses
226
227
  };
227
- //# sourceMappingURL=chunk-PK2RMVMB.js.map
228
+ //# sourceMappingURL=chunk-I72ACQ6R.js.map
@@ -1,3 +1,6 @@
1
+ import {
2
+ getPendingQuestionsForSession
3
+ } from "./chunk-EU3WWTFH.js";
1
4
  import {
2
5
  getEventStore,
3
6
  getRuntimeConfig,
@@ -11,9 +14,6 @@ import {
11
14
  createContextStateMessage,
12
15
  createSessionStateMessage
13
16
  } from "./chunk-F4PMNP7S.js";
14
- import {
15
- getPendingQuestionsForSession
16
- } from "./chunk-EU3WWTFH.js";
17
17
  import {
18
18
  logger
19
19
  } from "./chunk-K44MW7JJ.js";
@@ -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-63U5CTPE.js");
138
+ const { createLLMClient } = await import("./client-SC6X65GY.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-64GN6OPR.js.map
187
+ //# sourceMappingURL=chunk-NEL2REUM.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createLLMClient
3
- } from "./chunk-E4POUD2M.js";
3
+ } from "./chunk-6XOA2WPU.js";
4
4
  import {
5
5
  getModelProfile
6
6
  } from "./chunk-V4IE7HJY.js";
@@ -12,6 +12,9 @@ import {
12
12
  ensureVersionPrefix,
13
13
  stripVersionPrefix
14
14
  } from "./chunk-HNCM3D7Y.js";
15
+ import {
16
+ resolveAttachmentsInMessages
17
+ } from "./chunk-EZK7CGJ7.js";
15
18
  import {
16
19
  logger
17
20
  } from "./chunk-K44MW7JJ.js";
@@ -55,8 +58,16 @@ function createTransportLLMClient(provider, modelId, transport) {
55
58
  setBackend(next) {
56
59
  backend = next;
57
60
  },
58
- complete: (request) => transport.complete(request, context()),
59
- stream: (request) => transport.stream(request, context())
61
+ complete: async (request) => {
62
+ const supportsVision = request.modelSettings?.supportsVision ?? profile.supportsVision ?? false;
63
+ const resolved = { ...request, messages: await resolveAttachmentsInMessages(request.messages, supportsVision) };
64
+ return transport.complete(resolved, context());
65
+ },
66
+ stream: async function* (request) {
67
+ const supportsVision = request.modelSettings?.supportsVision ?? profile.supportsVision ?? false;
68
+ const resolved = { ...request, messages: await resolveAttachmentsInMessages(request.messages, supportsVision) };
69
+ yield* transport.stream(resolved, context());
70
+ }
60
71
  };
61
72
  }
62
73
 
@@ -796,4 +807,4 @@ export {
796
807
  parseDefaultModelSelection,
797
808
  createProviderManager
798
809
  };
799
- //# sourceMappingURL=chunk-7OW6X764.js.map
810
+ //# sourceMappingURL=chunk-OHGQILRF.js.map