openfox 2.0.135 → 2.0.137

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 (87) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/dist/CHANGELOG.md +33 -0
  3. package/dist/agent-defaults/builder.agent.md +1 -0
  4. package/dist/agent-defaults/planner.agent.md +1 -0
  5. package/dist/{ask-UBIRH3SO.js → ask-46J5WYRL.js} +2 -2
  6. package/dist/{auto-config-5VSNLVNI.js → auto-config-2A7Y2WOK.js} +25 -6
  7. package/dist/{backend-NDBY3DAQ.js → backend-24FTDSHF.js} +4 -2
  8. package/dist/{chat-handler-WGDFMOOD.js → chat-handler-ZCPFNHTE.js} +30 -26
  9. package/dist/{chunk-QZOV4OVN.js → chunk-2OO46UAW.js} +5 -5
  10. package/dist/{chunk-7QMWYNVF.js → chunk-4LLGI372.js} +2 -2
  11. package/dist/chunk-4SBVW4UH.js +24 -0
  12. package/dist/{chunk-ZMK4VX7V.js → chunk-64YDOCQR.js} +53 -21
  13. package/dist/{chunk-VHLD6PCZ.js → chunk-6TQNTFJW.js} +17 -11
  14. package/dist/{chunk-UV6IH6HK.js → chunk-AKWJMMEJ.js} +15 -1
  15. package/dist/{chunk-ORCQ3EXQ.js → chunk-BHVR2YS5.js} +2 -2
  16. package/dist/{chunk-S67WIWUG.js → chunk-DG2YSWMC.js} +40 -6
  17. package/dist/chunk-FG4G4EWB.js +7 -0
  18. package/dist/{chunk-NFEZATSN.js → chunk-FIQPKLDY.js} +8 -8
  19. package/dist/chunk-FSSUPWYO.js +336 -0
  20. package/dist/{chunk-5UQ4CKOA.js → chunk-G5GUQKLS.js} +27 -6
  21. package/dist/{chunk-7ET46SNE.js → chunk-HEYU7FAY.js} +3 -3
  22. package/dist/{chunk-4R5GV7RW.js → chunk-JIS6C6PA.js} +21 -21
  23. package/dist/{chunk-5H5NRWHA.js → chunk-LQPAM55V.js} +12 -10
  24. package/dist/{chunk-MEEUXRFL.js → chunk-MMGHIPBU.js} +72 -54
  25. package/dist/{chunk-O3RCSKUH.js → chunk-MOYWDP73.js} +2 -2
  26. package/dist/{chunk-J3NMNYGM.js → chunk-N5JKVNLH.js} +2 -2
  27. package/dist/{chunk-DWA4IE65.js → chunk-Q33DL67W.js} +2 -2
  28. package/dist/{chunk-OZWHRBDY.js → chunk-QBWJCO5K.js} +12 -29
  29. package/dist/{chunk-EUOWCVU6.js → chunk-QMU3ZY2C.js} +37 -341
  30. package/dist/{chunk-CTWZPN7G.js → chunk-QUAEH3MP.js} +29 -1
  31. package/dist/{chunk-BIZFY3QP.js → chunk-RS7I4W5A.js} +212 -148
  32. package/dist/{chunk-5UMXFLET.js → chunk-SAGDTQXD.js} +3 -3
  33. package/dist/{chunk-UKIUQAQZ.js → chunk-U7XCK7WL.js} +4 -4
  34. package/dist/{chunk-JURM3RPZ.js → chunk-V5AC2TV7.js} +8 -13
  35. package/dist/{chunk-JE7LW7Y6.js → chunk-VIJVLLPT.js} +12 -3
  36. package/dist/{chunk-2AI7VYPN.js → chunk-VKMPR25F.js} +9 -3
  37. package/dist/{chunk-IAT2LBIX.js → chunk-WOIQO7ZC.js} +4 -4
  38. package/dist/chunk-WQUCCHOY.js +1155 -0
  39. package/dist/{chunk-F2MOHHXB.js → chunk-X4PVR6AW.js} +2 -2
  40. package/dist/chunk-XG3AUMPI.js +72 -0
  41. package/dist/{chunk-I5ODJKYM.js → chunk-XWWRZSK7.js} +162 -6
  42. package/dist/{chunk-GP3CLMPQ.js → chunk-ZJ2IHOVN.js} +23 -23
  43. package/dist/{chunk-ESZQTFQP.js → chunk-ZQENKB7X.js} +86 -1010
  44. package/dist/cli/dev.js +1 -1
  45. package/dist/cli/index.js +1 -1
  46. package/dist/client-MVI3J7SN.js +18 -0
  47. package/dist/{client-pure-FLKP6PTI.js → client-pure-YZ4IGCU4.js} +4 -2
  48. package/dist/{compactor-454UEIEX.js → compactor-KDTY4ERE.js} +14 -12
  49. package/dist/describe-image-EFHMWGWI.js +30 -0
  50. package/dist/{dynamic-context-LKC6JYLQ.js → dynamic-context-HL4RGNHK.js} +12 -10
  51. package/dist/{events-335XAKFK.js → events-ADE2KEHI.js} +7 -9
  52. package/dist/{export-import-3WMRLO4A.js → export-import-6OUEANYH.js} +7 -7
  53. package/dist/{folding-H7JTX6KI.js → folding-CM63AVSB.js} +6 -6
  54. package/dist/{http-client-A445WYZU.js → http-client-C6UYWVWZ.js} +3 -3
  55. package/dist/launch-L5NSPAAX.js +58 -0
  56. package/dist/{manager-ZACEUL5P.js → manager-FSPRJCYT.js} +4 -4
  57. package/dist/{model-catalog-2PCKTYGW.js → model-catalog-Y5MA5OZP.js} +2 -2
  58. package/dist/{orchestrator-JGJWTRO5.js → orchestrator-FMWKMD54.js} +29 -25
  59. package/dist/package.json +1 -1
  60. package/dist/{path-security-4LROI7F4.js → path-security-DND2R3RP.js} +8 -8
  61. package/dist/{platform-XPMZKAUB.js → platform-KPKYBU54.js} +3 -3
  62. package/dist/{processor-MSQP63ML.js → processor-SB5X44PX.js} +29 -25
  63. package/dist/{provider-JWUNG2TD.js → provider-SOC6Z25R.js} +10 -8
  64. package/dist/{provider-manager-2KKZ37XJ.js → provider-manager-Y53SVVQ3.js} +10 -8
  65. package/dist/{registry-BEIR7Y5G.js → registry-FMDMGIUB.js} +3 -3
  66. package/dist/{serve-CW5C3CBZ.js → serve-VONTGJCK.js} +41 -32
  67. package/dist/server/index.d.ts +1 -0
  68. package/dist/server/index.js +34 -30
  69. package/dist/server-MI2LZK3W.js +61 -0
  70. package/dist/{service-XIUNS5XV.js → service-NKLQH647.js} +12 -9
  71. package/dist/{session-overrides-LYW5PJ3R.js → session-overrides-ANQBKV74.js} +11 -7
  72. package/dist/{sessions-AOK3AGHY.js → sessions-GLYACE5R.js} +4 -4
  73. package/dist/{settings-ZJPM6PQV.js → settings-WH6BVQCP.js} +4 -2
  74. package/dist/{tasks-3JJWJJ3X.js → tasks-GPM3JAE6.js} +14 -10
  75. package/dist/tool-adapter-ZY4FC4C4.js +9 -0
  76. package/dist/{tools-E63MOJBO.js → tools-WLJJ3ILO.js} +27 -23
  77. package/dist/{update-XVXNSSDK.js → update-6ZSQJQJB.js} +2 -2
  78. package/dist/web/assets/{index-wTFCxQAw.js → index-CfFwerN2.js} +84 -84
  79. package/dist/web/assets/{index-Bg_Z8i3F.css → index-ChJjYovg.css} +1 -1
  80. package/dist/web/index.html +2 -2
  81. package/dist/web/sw.js +1 -1
  82. package/package.json +1 -1
  83. package/dist/chunk-WY3PWHWY.js +0 -7
  84. package/dist/client-VVYOWXRR.js +0 -16
  85. package/dist/launch-GJ7EHQRI.js +0 -54
  86. package/dist/server-ZHEB7XS2.js +0 -57
  87. package/dist/tool-adapter-FJAFLDZA.js +0 -8
@@ -1,27 +1,27 @@
1
1
  import {
2
2
  getPendingQuestionsForSession
3
- } from "./chunk-JURM3RPZ.js";
3
+ } from "./chunk-V5AC2TV7.js";
4
4
  import {
5
5
  combineEventsWithSnapshot,
6
6
  getEventStore
7
- } from "./chunk-QZOV4OVN.js";
7
+ } from "./chunk-2OO46UAW.js";
8
8
  import {
9
9
  buildMessagesFromStoredEvents,
10
10
  foldPendingConfirmations
11
- } from "./chunk-MEEUXRFL.js";
11
+ } from "./chunk-MMGHIPBU.js";
12
12
  import {
13
13
  updateSessionMetadata
14
- } from "./chunk-F2MOHHXB.js";
14
+ } from "./chunk-X4PVR6AW.js";
15
15
  import {
16
16
  getRuntimeConfig
17
- } from "./chunk-ORCQ3EXQ.js";
17
+ } from "./chunk-BHVR2YS5.js";
18
18
  import {
19
19
  createContextStateMessage,
20
20
  createSessionStateMessage
21
21
  } from "./chunk-AATMPL7S.js";
22
22
  import {
23
23
  getMaxVisibleItems
24
- } from "./chunk-CTWZPN7G.js";
24
+ } from "./chunk-QUAEH3MP.js";
25
25
  import {
26
26
  logger
27
27
  } from "./chunk-K44MW7JJ.js";
@@ -162,7 +162,7 @@ async function generateSessionNameForSession(sessionId, userMessage, deps, signa
162
162
  client = deps.getLLMClient();
163
163
  client.setModel(providerConfig.model);
164
164
  } else if (providerConfig) {
165
- const { createLLMClient } = await import("./client-VVYOWXRR.js");
165
+ const { createLLMClient } = await import("./client-MVI3J7SN.js");
166
166
  client = createLLMClient(
167
167
  {
168
168
  llm: {
@@ -216,4 +216,4 @@ export {
216
216
  needsNameGeneration,
217
217
  generateSessionNameForSession
218
218
  };
219
- //# sourceMappingURL=chunk-NFEZATSN.js.map
219
+ //# sourceMappingURL=chunk-FIQPKLDY.js.map
@@ -0,0 +1,336 @@
1
+ // src/server/tools/types.ts
2
+ var OUTPUT_LIMITS = {
3
+ read_file: {
4
+ maxLines: 2e3,
5
+ maxBytes: 1e5,
6
+ maxImageBytes: 2097152,
7
+ // 2MB for images
8
+ maxPdfPages: 50,
9
+ maxPdfImages: 20,
10
+ maxFileBytes: 20971520
11
+ // 20MB general file safety limit
12
+ },
13
+ run_command: {
14
+ maxLines: 2e3,
15
+ maxBytes: 5e4
16
+ },
17
+ glob: {
18
+ maxResults: 500
19
+ },
20
+ grep: {
21
+ maxMatches: 200
22
+ },
23
+ web_fetch: {
24
+ maxBytes: 1e5
25
+ }
26
+ };
27
+
28
+ // src/server/tools/pdf-utils.ts
29
+ import { getDocument, OPS } from "pdfjs-dist/legacy/build/pdf.mjs";
30
+ import { PNG } from "pngjs";
31
+ var PDF_HEADER = Buffer.from("%PDF");
32
+ function isPdfBuffer(buffer) {
33
+ return buffer.length > 4 && buffer.subarray(0, 4).equals(PDF_HEADER);
34
+ }
35
+ function isPasswordError(err) {
36
+ const message = err instanceof Error ? err.message : String(err);
37
+ return message.toLowerCase().includes("password") || message.toLowerCase().includes("encrypt");
38
+ }
39
+ function formatPdfErrorMessage(err) {
40
+ if (isPasswordError(err)) {
41
+ return "This PDF is password-protected. Unlock it with an external tool first.";
42
+ }
43
+ return `Failed to read PDF: ${err instanceof Error ? err.message : String(err)}`;
44
+ }
45
+ function processPdfContent(text, maxBytes) {
46
+ let output = text;
47
+ let truncated = false;
48
+ if (output.length > maxBytes) {
49
+ output = output.slice(0, maxBytes) + "\n\n[Output truncated due to size limit]";
50
+ truncated = true;
51
+ }
52
+ const isScanned = output.replace(/\[Page \d+\/\d+\]\n/g, "").trim().length === 0;
53
+ return { output, truncated, isScanned };
54
+ }
55
+ var IMAGE_KIND_GRAYSCALE_1BPP = 1;
56
+ var IMAGE_KIND_RGB_24BPP = 2;
57
+ var IMAGE_KIND_RGBA_32BPP = 3;
58
+ function getRgbaPixel(data, width, x, y, kind) {
59
+ if (kind === IMAGE_KIND_RGBA_32BPP) {
60
+ const i = (y * width + x) * 4;
61
+ return [data[i] ?? 0, data[i + 1] ?? 0, data[i + 2] ?? 0, data[i + 3] ?? 255];
62
+ }
63
+ if (kind === IMAGE_KIND_RGB_24BPP) {
64
+ const i = (y * width + x) * 3;
65
+ return [data[i] ?? 0, data[i + 1] ?? 0, data[i + 2] ?? 0, 255];
66
+ }
67
+ if (kind === IMAGE_KIND_GRAYSCALE_1BPP) {
68
+ const bytesPerRow = Math.ceil(width / 8);
69
+ const byteIdx = y * bytesPerRow + Math.floor(x / 8);
70
+ const bitIdx = 7 - x % 8;
71
+ const val = (data[byteIdx] ?? 0) >> bitIdx & 1 ? 255 : 0;
72
+ return [val, val, val, 255];
73
+ }
74
+ return [0, 0, 0, 255];
75
+ }
76
+ function toRgbaBuffer(data, width, height, kind) {
77
+ const rgba = new Uint8Array(width * height * 4);
78
+ for (let y = 0; y < height; y++) {
79
+ for (let x = 0; x < width; x++) {
80
+ const [r, g, b, a] = getRgbaPixel(data, width, x, y, kind);
81
+ const i = (y * width + x) * 4;
82
+ rgba[i] = r;
83
+ rgba[i + 1] = g;
84
+ rgba[i + 2] = b;
85
+ rgba[i + 3] = a;
86
+ }
87
+ }
88
+ return rgba;
89
+ }
90
+ function extractBitmapToRawImageData(bitmap) {
91
+ const canvas = new globalThis.OffscreenCanvas(bitmap.width, bitmap.height);
92
+ const ctx = canvas.getContext("2d");
93
+ ctx.drawImage(bitmap, 0, 0);
94
+ const imageData = ctx.getImageData(0, 0, bitmap.width, bitmap.height);
95
+ return {
96
+ width: bitmap.width,
97
+ height: bitmap.height,
98
+ data: new Uint8Array(imageData.data.buffer),
99
+ kind: IMAGE_KIND_RGBA_32BPP
100
+ };
101
+ }
102
+ function encodeImageToDataUrl(imgData, maxDimension = 1024) {
103
+ try {
104
+ let { width, height } = imgData;
105
+ let { data, kind } = imgData;
106
+ if (imgData.bitmap && !data) {
107
+ const converted = extractBitmapToRawImageData(imgData.bitmap);
108
+ data = converted.data;
109
+ kind = converted.kind;
110
+ }
111
+ if (!data) return null;
112
+ if (width * height * 4 > 20971520) return null;
113
+ if (maxDimension > 0 && (width > maxDimension || height > maxDimension)) {
114
+ const scale = maxDimension / Math.max(width, height);
115
+ const newWidth = Math.round(width * scale);
116
+ const newHeight = Math.round(height * scale);
117
+ const scaled = new Uint8Array(newWidth * newHeight * 4);
118
+ for (let y = 0; y < newHeight; y++) {
119
+ for (let x = 0; x < newWidth; x++) {
120
+ const srcX = Math.floor(x / scale);
121
+ const srcY = Math.floor(y / scale);
122
+ const dstI = (y * newWidth + x) * 4;
123
+ const [r, g, b, a] = getRgbaPixel(data, width, srcX, srcY, kind);
124
+ scaled[dstI] = r;
125
+ scaled[dstI + 1] = g;
126
+ scaled[dstI + 2] = b;
127
+ scaled[dstI + 3] = a;
128
+ }
129
+ }
130
+ width = newWidth;
131
+ height = newHeight;
132
+ const png2 = new PNG({ width, height });
133
+ Buffer.from(scaled.buffer, scaled.byteOffset, scaled.byteLength).copy(png2.data);
134
+ const pngBuffer2 = PNG.sync.write(png2);
135
+ return `data:image/png;base64,${pngBuffer2.toString("base64")}`;
136
+ }
137
+ let rgba;
138
+ if (kind === IMAGE_KIND_RGBA_32BPP) {
139
+ rgba = Uint8Array.from(
140
+ data instanceof Uint8ClampedArray ? new Uint8Array(data.buffer, data.byteOffset, data.byteLength) : data
141
+ );
142
+ } else {
143
+ rgba = toRgbaBuffer(data, width, height, kind);
144
+ }
145
+ const png = new PNG({ width, height });
146
+ Buffer.from(rgba.buffer, rgba.byteOffset, rgba.byteLength).copy(png.data);
147
+ const pngBuffer = PNG.sync.write(png);
148
+ return `data:image/png;base64,${pngBuffer.toString("base64")}`;
149
+ } catch {
150
+ return null;
151
+ }
152
+ }
153
+ async function extractPageBlocks(page, pageIndex, pageCount, imageCounter, maxImages) {
154
+ const [textContent, opList] = await Promise.all([page.getTextContent(), page.getOperatorList()]);
155
+ const textItems = textContent.items.filter(
156
+ (item) => "str" in item
157
+ );
158
+ const textStr = textItems.map((t) => t.str).join(" ").trim();
159
+ const imageOpIndices = [];
160
+ for (let i = 0; i < opList.fnArray.length; i++) {
161
+ const op = opList.fnArray[i];
162
+ if (op === OPS.paintImageXObject || op === OPS.paintInlineImageXObject || op === OPS.paintImageMaskXObject || op === OPS.paintImageMaskXObjectGroup || op === OPS.paintImageXObjectRepeat || op === OPS.paintImageMaskXObjectRepeat || op === OPS.paintInlineImageXObjectGroup || op === OPS.paintSolidColorImageMask) {
163
+ imageOpIndices.push(i);
164
+ }
165
+ }
166
+ const blocks = [];
167
+ if (textStr) {
168
+ blocks.push({ type: "text", content: `[Page ${pageIndex}/${pageCount}]
169
+ ${textStr}` });
170
+ }
171
+ for (let imageOpIdx = 0; imageOpIdx < imageOpIndices.length; imageOpIdx++) {
172
+ if (imageCounter.count >= maxImages) {
173
+ imageCounter.limitReached = true;
174
+ break;
175
+ }
176
+ const opIdx = imageOpIndices[imageOpIdx];
177
+ if (opIdx === void 0) break;
178
+ const imgBlock = await extractImageBlock(page, opList, opIdx);
179
+ if (imgBlock) {
180
+ blocks.push(imgBlock);
181
+ imageCounter.count++;
182
+ }
183
+ }
184
+ return blocks;
185
+ }
186
+ function isValidPixelData(data) {
187
+ return data instanceof Uint8Array || data instanceof Uint8ClampedArray;
188
+ }
189
+ var IMAGE_RESOLVE_TIMEOUT_MS = 5e3;
190
+ async function getObjectWithFallback(objs, objId) {
191
+ try {
192
+ return objs.get(objId);
193
+ } catch {
194
+ }
195
+ return new Promise((resolve, reject) => {
196
+ const timeoutId = setTimeout(() => reject(new Error("timeout")), IMAGE_RESOLVE_TIMEOUT_MS);
197
+ try {
198
+ ;
199
+ objs.get(objId, (data) => {
200
+ clearTimeout(timeoutId);
201
+ resolve(data);
202
+ });
203
+ } catch (e) {
204
+ clearTimeout(timeoutId);
205
+ reject(e);
206
+ }
207
+ });
208
+ }
209
+ async function extractImageBlock(page, opList, opIdx) {
210
+ const args = opList.argsArray[opIdx];
211
+ const objId = Array.isArray(args) ? args[0] : void 0;
212
+ let imgData = null;
213
+ if (objId && typeof objId === "string") {
214
+ try {
215
+ const store = objId.startsWith("g_") ? page.commonObjs : page.objs;
216
+ const raw = await getObjectWithFallback(store, objId);
217
+ if (raw && typeof raw === "object" && "width" in raw && "height" in raw) {
218
+ const r = raw;
219
+ if (isValidPixelData(r["data"])) {
220
+ imgData = raw;
221
+ } else if (r["bitmap"] && !r["data"]) {
222
+ imgData = raw;
223
+ }
224
+ }
225
+ } catch {
226
+ }
227
+ } else if (Array.isArray(args) && args[0] && typeof args[0] === "object" && "width" in args[0]) {
228
+ const inline = args[0];
229
+ if (isValidPixelData(inline["data"])) {
230
+ imgData = args[0];
231
+ } else if (inline["bitmap"] && !inline["data"]) {
232
+ imgData = args[0];
233
+ }
234
+ }
235
+ if (imgData) {
236
+ const dataUrl = encodeImageToDataUrl(imgData);
237
+ if (dataUrl) {
238
+ return { type: "image", dataUrl };
239
+ }
240
+ }
241
+ return null;
242
+ }
243
+ async function extractPdfContent(buffer) {
244
+ const doc = await getDocument({ data: Uint8Array.from(buffer) }).promise;
245
+ const pageCount = doc.numPages;
246
+ const allBlocks = [];
247
+ const limitedPageCount = Math.min(pageCount, OUTPUT_LIMITS.read_file.maxPdfPages);
248
+ const maxImages = OUTPUT_LIMITS.read_file.maxPdfImages;
249
+ const imageCounter = { count: 0, limitReached: false };
250
+ let title = null;
251
+ let author = null;
252
+ try {
253
+ const rawMeta = await doc.getMetadata();
254
+ const info = rawMeta.info;
255
+ title = info?.["Title"] || null;
256
+ author = info?.["Author"] || null;
257
+ } catch {
258
+ }
259
+ try {
260
+ for (let i = 1; i <= limitedPageCount; i++) {
261
+ const page = await doc.getPage(i);
262
+ try {
263
+ const blocks = await extractPageBlocks(page, i, pageCount, imageCounter, maxImages);
264
+ allBlocks.push(...blocks);
265
+ } finally {
266
+ page.cleanup();
267
+ }
268
+ }
269
+ } catch {
270
+ } finally {
271
+ doc.cleanup();
272
+ }
273
+ if (pageCount > limitedPageCount) {
274
+ allBlocks.push({
275
+ type: "text",
276
+ content: `[PDF has ${pageCount} pages, showing first ${limitedPageCount}. Use a shell command to process more.]`
277
+ });
278
+ }
279
+ if (imageCounter.limitReached) {
280
+ allBlocks.push({
281
+ type: "text",
282
+ content: `[Image limit reached: showing first ${maxImages} images out of more in this document.]`
283
+ });
284
+ }
285
+ return {
286
+ blocks: allBlocks,
287
+ pageCount,
288
+ title,
289
+ author,
290
+ imageCount: imageCounter.count,
291
+ imageLimitReached: imageCounter.limitReached
292
+ };
293
+ }
294
+ async function extractPdfText(buffer) {
295
+ const result = await extractPdfContent(buffer);
296
+ const text = result.blocks.filter((b) => b.type === "text").map((b) => b.content ?? "").join("\n\n");
297
+ return { text, pageCount: result.pageCount, title: result.title, author: result.author };
298
+ }
299
+
300
+ // src/server/utils/cache.ts
301
+ import { createHash } from "crypto";
302
+ function contentHash(data) {
303
+ return createHash("sha256").update(data).digest("hex").slice(0, 16);
304
+ }
305
+ function cacheSet(cache, key, value) {
306
+ const max = 50;
307
+ if (cache.size >= max) {
308
+ const first = cache.keys().next().value;
309
+ if (first !== void 0) cache.delete(first);
310
+ }
311
+ cache.set(key, value);
312
+ }
313
+
314
+ // src/server/utils/data-url.ts
315
+ function decodeDataUrl(data) {
316
+ const match = data.match(/^data:.*?;base64,(.+)$/);
317
+ if (!match?.[1]) return null;
318
+ try {
319
+ return Buffer.from(match[1], "base64");
320
+ } catch {
321
+ return null;
322
+ }
323
+ }
324
+
325
+ export {
326
+ OUTPUT_LIMITS,
327
+ isPdfBuffer,
328
+ formatPdfErrorMessage,
329
+ processPdfContent,
330
+ extractPdfContent,
331
+ extractPdfText,
332
+ contentHash,
333
+ cacheSet,
334
+ decodeDataUrl
335
+ };
336
+ //# sourceMappingURL=chunk-FSSUPWYO.js.map
@@ -4,14 +4,15 @@ import {
4
4
  } from "./chunk-OA2FURC3.js";
5
5
  import {
6
6
  createLLMClient
7
- } from "./chunk-ZMK4VX7V.js";
7
+ } from "./chunk-64YDOCQR.js";
8
8
  import {
9
9
  getModelProfile
10
10
  } from "./chunk-TS5WKTFB.js";
11
11
  import {
12
12
  detectBackendFromUrl,
13
+ detectProviderDefaultsFromUrl,
13
14
  getBackendCapabilities
14
- } from "./chunk-UV6IH6HK.js";
15
+ } from "./chunk-AKWJMMEJ.js";
15
16
  import {
16
17
  buildModelsUrl,
17
18
  ensureVersionPrefix,
@@ -19,12 +20,15 @@ import {
19
20
  } from "./chunk-HNCM3D7Y.js";
20
21
  import {
21
22
  resolveAttachmentsInMessages
22
- } from "./chunk-EUOWCVU6.js";
23
+ } from "./chunk-QMU3ZY2C.js";
24
+ import {
25
+ sanitizeToolSchema
26
+ } from "./chunk-XG3AUMPI.js";
23
27
  import {
24
28
  getCatalogEntry,
25
29
  resolveEffortForModel,
26
30
  resolveModeModelId
27
- } from "./chunk-2AI7VYPN.js";
31
+ } from "./chunk-VKMPR25F.js";
28
32
  import {
29
33
  logger
30
34
  } from "./chunk-K44MW7JJ.js";
@@ -79,6 +83,15 @@ function createTransportLLMClient(provider, modelId, transport, reasoningEffort)
79
83
  request: {
80
84
  ...request,
81
85
  messages: await resolveAttachmentsInMessages(request.messages, supportsVision),
86
+ ...request.tools ? {
87
+ tools: request.tools.map((t) => ({
88
+ ...t,
89
+ function: {
90
+ ...t.function,
91
+ parameters: sanitizeToolSchema(t.function.parameters)
92
+ }
93
+ }))
94
+ } : {},
82
95
  ...resolvedEffort && !send.suppressEffort ? { reasoningEffort: resolvedEffort } : {}
83
96
  },
84
97
  effort: resolvedEffort
@@ -265,6 +278,7 @@ function mergeModelsWithUserOverrides(backendModels, userModels, preserveMissing
265
278
  const claimedByMergedModes = /* @__PURE__ */ new Set();
266
279
  for (const userModel of userModels) {
267
280
  if (!userModel.modes?.length) continue;
281
+ claimedByMergedModes.add(normalizeModelId(userModel.id));
268
282
  for (const mode of userModel.modes) {
269
283
  if (mode.apiModelId) claimedByMergedModes.add(normalizeModelId(mode.apiModelId));
270
284
  }
@@ -449,6 +463,10 @@ function createProviderManager(config, options = {}) {
449
463
  });
450
464
  return effort ? { reasoningEffort: effort } : {};
451
465
  }
466
+ function resolveThinkingField(provider) {
467
+ if (provider.thinkingField) return provider.thinkingField;
468
+ return detectProviderDefaultsFromUrl(provider.url)?.thinkingField;
469
+ }
452
470
  function createConfigForProvider(provider, model, reasoningEffort) {
453
471
  const modelThinking = resolveModelThinkingConfig(provider, model, reasoningEffort);
454
472
  const configureModel = provider.models.find((m) => m.id === model);
@@ -458,6 +476,7 @@ function createProviderManager(config, options = {}) {
458
476
  configureModel?.apiModelId,
459
477
  model
460
478
  );
479
+ const thinkingField = resolveThinkingField(provider);
461
480
  return {
462
481
  ...config,
463
482
  llm: {
@@ -466,7 +485,7 @@ function createProviderManager(config, options = {}) {
466
485
  model: send.modelId,
467
486
  backend: resolveBackend(provider),
468
487
  ...provider.apiKey && { apiKey: provider.apiKey },
469
- ...provider.thinkingField && { thinkingField: provider.thinkingField },
488
+ ...thinkingField ? { thinkingField } : {},
470
489
  ...provider.sendReasoningInMessages !== void 0 ? { sendReasoningInMessages: provider.sendReasoningInMessages } : {},
471
490
  ...modelThinking.reasoningEffort && !send.suppressEffort && { reasoningEffort: modelThinking.reasoningEffort }
472
491
  }
@@ -767,7 +786,9 @@ function createProviderManager(config, options = {}) {
767
786
  source: "user",
768
787
  ...existingModel?.name !== void 0 && { name: existingModel.name },
769
788
  ...existingModel?.apiModelId !== void 0 && { apiModelId: existingModel.apiModelId },
789
+ ...existingModel?.requestBody !== void 0 && { requestBody: existingModel.requestBody },
770
790
  ...existingModel?.modes !== void 0 && { modes: existingModel.modes },
791
+ ...existingModel?.selected !== void 0 && { selected: existingModel.selected },
771
792
  ...finalTemp !== void 0 && { temperature: finalTemp },
772
793
  ...finalTopP !== void 0 && { topP: finalTopP },
773
794
  ...finalTopK !== void 0 && { topK: finalTopK },
@@ -895,4 +916,4 @@ export {
895
916
  parseDefaultModelSelection,
896
917
  createProviderManager
897
918
  };
898
- //# sourceMappingURL=chunk-5UQ4CKOA.js.map
919
+ //# sourceMappingURL=chunk-G5GUQKLS.js.map
@@ -6,10 +6,10 @@ import {
6
6
  } from "./chunk-TS5WKTFB.js";
7
7
  import {
8
8
  getBackendCapabilities
9
- } from "./chunk-UV6IH6HK.js";
9
+ } from "./chunk-AKWJMMEJ.js";
10
10
  import {
11
11
  buildModelParams
12
- } from "./chunk-EUOWCVU6.js";
12
+ } from "./chunk-QMU3ZY2C.js";
13
13
  import {
14
14
  logger
15
15
  } from "./chunk-K44MW7JJ.js";
@@ -518,4 +518,4 @@ export {
518
518
  createChatDoneEvent,
519
519
  consumeStreamGenerator
520
520
  };
521
- //# sourceMappingURL=chunk-7ET46SNE.js.map
521
+ //# sourceMappingURL=chunk-HEYU7FAY.js.map
@@ -1,51 +1,51 @@
1
+ import {
2
+ buildCachedPrompt,
3
+ checkToolChangesAndInject,
4
+ computeDynamicContextHash,
5
+ getToolFingerprint
6
+ } from "./chunk-6TQNTFJW.js";
1
7
  import {
2
8
  createAssemblyResult,
3
9
  getConversationMessages,
4
10
  getToolRegistryForAgent,
5
11
  processEventsForConversation,
6
12
  runTopLevelAgentLoop
7
- } from "./chunk-ESZQTFQP.js";
13
+ } from "./chunk-ZQENKB7X.js";
14
+ import {
15
+ getAllInstructions,
16
+ getEnabledSkillMetadata
17
+ } from "./chunk-Q33DL67W.js";
8
18
  import {
9
19
  serverT
10
- } from "./chunk-OZWHRBDY.js";
20
+ } from "./chunk-4SBVW4UH.js";
11
21
  import {
12
22
  TurnMetrics,
13
23
  createChatDoneEvent,
14
24
  createMessageStartEvent
15
- } from "./chunk-7ET46SNE.js";
16
- import {
17
- buildCachedPrompt,
18
- checkToolChangesAndInject,
19
- computeDynamicContextHash,
20
- getToolFingerprint
21
- } from "./chunk-VHLD6PCZ.js";
22
- import {
23
- getAllInstructions,
24
- getEnabledSkillMetadata
25
- } from "./chunk-DWA4IE65.js";
25
+ } from "./chunk-HEYU7FAY.js";
26
26
  import {
27
27
  buildAgentReminder,
28
28
  buildAgentSmallReminder,
29
29
  buildTopLevelSystemPrompt
30
- } from "./chunk-7QMWYNVF.js";
30
+ } from "./chunk-4LLGI372.js";
31
31
  import {
32
32
  PathAccessDeniedError
33
- } from "./chunk-I5ODJKYM.js";
33
+ } from "./chunk-XWWRZSK7.js";
34
34
  import {
35
35
  getCurrentContextWindowId,
36
36
  getCurrentWindowMessageOptions,
37
37
  getEventStore
38
- } from "./chunk-QZOV4OVN.js";
38
+ } from "./chunk-2OO46UAW.js";
39
39
  import {
40
40
  buildSnapshotFromSessionState
41
- } from "./chunk-MEEUXRFL.js";
41
+ } from "./chunk-MMGHIPBU.js";
42
42
  import {
43
43
  findAgentById,
44
44
  getRuntimeConfig,
45
45
  getSubAgents,
46
46
  loadAllAgentsDefault,
47
47
  resolveDefaultAgentId
48
- } from "./chunk-ORCQ3EXQ.js";
48
+ } from "./chunk-BHVR2YS5.js";
49
49
  import {
50
50
  logger
51
51
  } from "./chunk-K44MW7JJ.js";
@@ -55,7 +55,7 @@ import {
55
55
 
56
56
  // src/server/chat/orchestrator.ts
57
57
  async function buildRetryPatterns() {
58
- const { getSetting, SETTINGS_KEYS } = await import("./settings-ZJPM6PQV.js");
58
+ const { getSetting, SETTINGS_KEYS } = await import("./settings-WH6BVQCP.js");
59
59
  const raw = getSetting(SETTINGS_KEYS.RETRY_PATTERNS);
60
60
  if (!raw) {
61
61
  const oldXmlProtection = getSetting("llm.disableXmlProtection");
@@ -355,7 +355,7 @@ async function runAgentTurn(options, turnMetrics, agentId, append, callbacks) {
355
355
  getConversationMessages: buildGetConversationMessages(options.sessionId, resolveAgentClient, append),
356
356
  injectAgentReminder: () => injectAgentReminder(options.sessionId, agentDef),
357
357
  rebuildCachedContext: async () => {
358
- const { applyDynamicContext } = await import("./dynamic-context-LKC6JYLQ.js");
358
+ const { applyDynamicContext } = await import("./dynamic-context-HL4RGNHK.js");
359
359
  await applyDynamicContext(options.sessionManager, options.sessionId, agentLlmClient.getModel());
360
360
  },
361
361
  ...options.initialCompacting ? { initialCompacting: true } : {},
@@ -385,4 +385,4 @@ export {
385
385
  runChatTurn,
386
386
  runAgentTurn
387
387
  };
388
- //# sourceMappingURL=chunk-4R5GV7RW.js.map
388
+ //# sourceMappingURL=chunk-JIS6C6PA.js.map
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  runAgentTurn
3
- } from "./chunk-4R5GV7RW.js";
3
+ } from "./chunk-JIS6C6PA.js";
4
4
  import {
5
5
  executeSubAgent,
6
6
  getToolRegistryForAgent
7
- } from "./chunk-ESZQTFQP.js";
7
+ } from "./chunk-ZQENKB7X.js";
8
8
  import {
9
9
  gitSpawnEnv
10
10
  } from "./chunk-J7GAZGZT.js";
@@ -14,38 +14,40 @@ import {
14
14
  loadDefaultWorkflows,
15
15
  loadProjectWorkflows,
16
16
  loadUserWorkflows,
17
- normalizeWorkflowScope,
17
+ normalizeWorkflowScope
18
+ } from "./chunk-QBWJCO5K.js";
19
+ import {
18
20
  serverT
19
- } from "./chunk-OZWHRBDY.js";
21
+ } from "./chunk-4SBVW4UH.js";
20
22
  import {
21
23
  TurnMetrics,
22
24
  createMessageStartEvent
23
- } from "./chunk-7ET46SNE.js";
25
+ } from "./chunk-HEYU7FAY.js";
24
26
  import {
25
27
  checkAborted,
26
28
  decodeUtf8,
27
29
  spawnShellProcess
28
- } from "./chunk-5UMXFLET.js";
30
+ } from "./chunk-SAGDTQXD.js";
29
31
  import {
30
32
  terminateProcessTree
31
33
  } from "./chunk-I72ACQ6R.js";
32
34
  import {
33
35
  getCurrentContextWindowId,
34
36
  getEventStore
35
- } from "./chunk-QZOV4OVN.js";
37
+ } from "./chunk-2OO46UAW.js";
36
38
  import {
37
39
  findAgentById,
38
40
  getRuntimeConfig,
39
41
  loadAllAgentsDefault,
40
42
  resolveDefaultAgentId
41
- } from "./chunk-ORCQ3EXQ.js";
43
+ } from "./chunk-BHVR2YS5.js";
42
44
  import {
43
45
  createChatMessageMessage,
44
46
  createSessionRunningMessage
45
47
  } from "./chunk-AATMPL7S.js";
46
48
  import {
47
49
  LLMError
48
- } from "./chunk-J3NMNYGM.js";
50
+ } from "./chunk-N5JKVNLH.js";
49
51
  import {
50
52
  logger
51
53
  } from "./chunk-K44MW7JJ.js";
@@ -1021,4 +1023,4 @@ export {
1021
1023
  abortRunnerRun,
1022
1024
  launchWorkflowRun
1023
1025
  };
1024
- //# sourceMappingURL=chunk-5H5NRWHA.js.map
1026
+ //# sourceMappingURL=chunk-LQPAM55V.js.map