@nervekit/desktop 0.40.0 → 0.40.2
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/THIRD-PARTY-LICENSES.txt +5087 -485
- package/dist/{chunk-KSZJ3HGD.js → chunk-2BKMOJYJ.js} +1 -1
- package/dist/{chunk-5UT23MT6.js → chunk-3JJN36GV.js} +70 -71
- package/dist/{chunk-2Z5FLMLE.js → chunk-3SSNDIQT.js} +1 -1
- package/dist/{chunk-PUM6UCBT.js → chunk-3VZR3ZUY.js} +55 -8
- package/dist/{chunk-BXVRC3HF.js → chunk-4H3WR7IT.js} +1 -1
- package/dist/{chunk-QVHYARC2.js → chunk-4VPX67B7.js} +3 -1
- package/dist/chunk-5NN7JAJ2.js +258 -0
- package/dist/{chunk-BPOIFVQO.js → chunk-6FSDDGFZ.js} +731 -605
- package/dist/chunk-6PACEIUY.js +183 -0
- package/dist/{chunk-XNYZEQ3U.js → chunk-6TAN6WG6.js} +1 -1
- package/dist/{chunk-RWLLVZ7I.js → chunk-7FLZA2BD.js} +31 -15
- package/dist/{chunk-WTHP3VH6.js → chunk-7JQBECUL.js} +1 -1
- package/dist/{chunk-5Y3NEEOK.js → chunk-AAEIGAGD.js} +9 -9
- package/dist/{chunk-UN3GLM4U.js → chunk-ANI6J75M.js} +68 -65
- package/dist/chunk-B4IE2GAM.js +14 -0
- package/dist/chunk-BNVMNV4O.js +69 -0
- package/dist/{chunk-L3YB2QLN.js → chunk-C6RO4LP3.js} +2 -2
- package/dist/chunk-DTGL5P2V.js +250 -0
- package/dist/{chunk-U4DBQKHO.js → chunk-E4JNHQGT.js} +11 -9
- package/dist/chunk-EJM4HMEL.js +45 -0
- package/dist/chunk-ER2ES2RH.js +64 -0
- package/dist/{chunk-SQ7CWNIT.js → chunk-EX63VKXY.js} +1 -1
- package/dist/{chunk-JDI4D5EM.js → chunk-F3MHINI6.js} +19 -23
- package/dist/chunk-FGZX4Q7W.js +22828 -0
- package/dist/{chunk-LPCHTKEK.js → chunk-FZ5N6WXF.js} +31 -160
- package/dist/chunk-H2G55ZPG.js +783 -0
- package/dist/chunk-HDBDYGJQ.js +40 -0
- package/dist/{chunk-RU6S57LK.js → chunk-HOCODVKL.js} +22 -24
- package/dist/chunk-JCF3ZRP4.js +481 -0
- package/dist/chunk-K2J2VZXO.js +142 -0
- package/dist/chunk-KBNEZR7T.js +135 -0
- package/dist/chunk-KSSM6LUI.js +340 -0
- package/dist/{chunk-HHUSIAK3.js → chunk-KTGSBL6T.js} +14 -17
- package/dist/chunk-L2DHKP5C.js +42 -0
- package/dist/{chunk-DBXMYYPJ.js → chunk-M3ELKCNA.js} +1 -1
- package/dist/chunk-M7WTH5K5.js +822 -0
- package/dist/{chunk-LZRPWVVJ.js → chunk-MWIKZIAI.js} +9 -8
- package/dist/{chunk-AON37AL2.js → chunk-O2652RWY.js} +29 -4
- package/dist/chunk-O6U226AI.js +249 -0
- package/dist/{chunk-5R3UAHXF.js → chunk-OAEV22IW.js} +48 -26
- package/dist/chunk-OANTMDXI.js +29 -0
- package/dist/{chunk-UGDIHDAR.js → chunk-ODS5QROC.js} +1 -1
- package/dist/{chunk-Q7LPOIKN.js → chunk-OQC3F6JA.js} +3 -471
- package/dist/{chunk-YA2WJRUO.js → chunk-PST63OUS.js} +5 -5
- package/dist/{chunk-S2PITDVA.js → chunk-QBAIDKF6.js} +1 -1
- package/dist/chunk-RPLBWENJ.js +224 -0
- package/dist/{chunk-GCSWN326.js → chunk-S62LLS4I.js} +33 -55
- package/dist/chunk-SHEU5KLD.js +32 -0
- package/dist/{chunk-FESN7DND.js → chunk-SU2USXTD.js} +1 -1
- package/dist/chunk-T6NRMNLQ.js +22 -0
- package/dist/{chunk-NSA42OOT.js → chunk-TGKIV3F4.js} +53 -65
- package/dist/{chunk-MN7PZ2PH.js → chunk-TSV3PFU2.js} +2 -2
- package/dist/{chunk-D5WJKB4R.js → chunk-UDC7NPQJ.js} +4 -3
- package/dist/{chunk-CEX2GWGZ.js → chunk-VBM7TD3X.js} +1 -1
- package/dist/chunk-VC6TX2Y2.js +359 -0
- package/dist/{chunk-7FI3LC3O.js → chunk-VTDI5KP7.js} +241 -104
- package/dist/{chunk-P2GSKP6N.js → chunk-WIN7KHMV.js} +15 -18
- package/dist/chunk-WJULIJOU.js +168 -0
- package/dist/{chunk-HKLAYK2Z.js → chunk-WRTA5G57.js} +23 -0
- package/dist/{chunk-4ZNLXHTH.js → chunk-WYPVD3HW.js} +10 -9
- package/dist/{chunk-V7EAFXAX.js → chunk-XE2E2KBP.js} +10 -9
- package/dist/chunk-XY53EFK3.js +39 -0
- package/dist/chunk-XZYFB566.js +153 -0
- package/dist/{chunk-H4CDZRIE.js → chunk-YJT4NXMV.js} +5 -5
- package/dist/{chunk-ET5RYBGZ.js → chunk-YQFENES6.js} +3 -3
- package/dist/chunk-YUO5V75X.js +128 -0
- package/dist/chunk-YYLKI74V.js +8778 -0
- package/dist/daemon.js +15 -10
- package/dist/git-isolated-reader-helper.js +1 -1
- package/dist/main.js +14 -9
- package/dist/web/assets/{AsyncBashCenterHost-HGsdxUJ3.js → AsyncBashCenterHost-BvXKoCVr.js} +1 -1
- package/dist/web/assets/{ConversationsWorkbenchPanel-B6dzWkG1.js → ConversationsWorkbenchPanel-CIfK_e3I.js} +1 -1
- package/dist/web/assets/{DiscoverCenterHost-B186WBRA.js → DiscoverCenterHost-Ep8EN9iJ.js} +1 -1
- package/dist/web/assets/{FileCenterHost-DigJOU5M.js → FileCenterHost-C_7XZAFZ.js} +1 -1
- package/dist/web/assets/{FilesWorkbenchPanel-VPvx3Bmi.js → FilesWorkbenchPanel-CtXo7ywG.js} +1 -1
- package/dist/web/assets/{GitDiffCenterHost-IuZfF3hG.js → GitDiffCenterHost-Cr7lqGI_.js} +1 -1
- package/dist/web/assets/{GitWorkbenchPanel-CScC0CfH.js → GitWorkbenchPanel-BFbwUgIN.js} +1 -1
- package/dist/web/assets/{LaunchConfigurationNotice-5yb4cH27.js → LaunchConfigurationNotice-CJjWkMhv.js} +1 -1
- package/dist/web/assets/{LaunchesWorkbenchPanel-Vy0Gm7gg.js → LaunchesWorkbenchPanel-BqzJvsrj.js} +1 -1
- package/dist/web/assets/{LogsCenterHost-BXBozCYw.js → LogsCenterHost-BI1fSxFW.js} +1 -1
- package/dist/web/assets/{MermaidCenterHost-DDh4ArdK.js → MermaidCenterHost-DVsZB8nB.js} +1 -1
- package/dist/web/assets/{MobileFilesBody-Cda_7gDp.js → MobileFilesBody-BJMoaP9I.js} +1 -1
- package/dist/web/assets/{MobileFilesHost-C1jev2Un.js → MobileFilesHost-D843vkDF.js} +1 -1
- package/dist/web/assets/{MobileLaunchOutputHost-Bsv12o2H.js → MobileLaunchOutputHost-vpltMcar.js} +1 -1
- package/dist/web/assets/{MobileLaunchesHost-C9VH-2bn.js → MobileLaunchesHost-CdDrKASg.js} +1 -1
- package/dist/web/assets/{MobileLogsHost-BMDXc-WC.js → MobileLogsHost-qK7N-C1y.js} +1 -1
- package/dist/web/assets/{MobileNoteEditorHost-BA6WIY1Y.js → MobileNoteEditorHost-Bg1N8o54.js} +1 -1
- package/dist/web/assets/{MobileNotesHost-BZeYpK9H.js → MobileNotesHost-meLV39Yw.js} +1 -1
- package/dist/web/assets/{MobileProjectSettingsHost-U3Mx3EN8.js → MobileProjectSettingsHost-A49Fdn54.js} +1 -1
- package/dist/web/assets/{MobileProjectSettingsPageHost-CMvxbjfs.js → MobileProjectSettingsPageHost-BXpUqS_N.js} +1 -1
- package/dist/web/assets/{MobileSettingsHost-CP8Z_-gH.js → MobileSettingsHost-DPKPajzI.js} +1 -1
- package/dist/web/assets/{MobileSettingsPageHost-BPjXKTMV.js → MobileSettingsPageHost-izNWGN0i.js} +1 -1
- package/dist/web/assets/{MobileSettingsPageScreen-C5rHdrUU.js → MobileSettingsPageScreen-DWMg4fDo.js} +1 -1
- package/dist/web/assets/{ProjectSettingsCenterHost-BVXpBixy.js → ProjectSettingsCenterHost-DHeb274m.js} +1 -1
- package/dist/web/assets/{PullRequestCenterHost-CZhXfCX2.js → PullRequestCenterHost-BYkWxXQe.js} +1 -1
- package/dist/web/assets/{PullRequestsWorkbenchPanel-BBnZJVnI.js → PullRequestsWorkbenchPanel-ZvGbi1Cr.js} +1 -1
- package/dist/web/assets/{SearchWorkbenchPanel-qLgszneN.js → SearchWorkbenchPanel-DaC0smfe.js} +1 -1
- package/dist/web/assets/{SettingsCenter-7BfrBfiy.js → SettingsCenter-C_NLBsi6.js} +1 -1
- package/dist/web/assets/{SettingsCenterHost-Ck5uHILP.js → SettingsCenterHost-jP8MULEj.js} +1 -1
- package/dist/web/assets/{SystemPromptCenterHost-ya5AvXsd.js → SystemPromptCenterHost-B1hfsfAn.js} +1 -1
- package/dist/web/assets/{discover-B3I5g1_G.js → discover-B-aZ504j.js} +1 -1
- package/dist/web/assets/{index-FJEmK_L5.js → index-TZ1KAAsX.js} +34 -34
- package/dist/web/assets/{settings-page-controllers.svelte-CU0i08wo.js → settings-page-controllers.svelte-D_ydJF8u.js} +1 -1
- package/dist/web/assets/{shell-layout.svelte-BT2508sa.js → shell-layout.svelte-OoLFwzzJ.js} +2 -2
- package/dist/web/assets/{views-Z-n-GTYY.js → views-ByPCKDiZ.js} +1 -1
- package/dist/web/index.html +3 -3
- package/dist/web/sw.js +1 -1
- package/dist/worker.js +14 -9
- package/package.json +8 -9
- package/dist/chunk-RUZ2UAYH.js +0 -365
- package/dist/resize-worker.js +0 -168
- /package/dist/{chunk-PUM6UCBT.js.LEGAL.txt → chunk-3VZR3ZUY.js.LEGAL.txt} +0 -0
- /package/dist/{chunk-YA2WJRUO.js.LEGAL.txt → chunk-PST63OUS.js.LEGAL.txt} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __nerveCreateRequire } from "node:module";
|
|
2
2
|
const require = __nerveCreateRequire(import.meta.url);
|
|
3
3
|
|
|
4
|
-
// node_modules/.pnpm/@earendil-works+pi-ai@1.
|
|
4
|
+
// node_modules/.pnpm/@earendil-works+pi-ai@1.5.1_@aws-sdk+credential-provider-node@3.972.83_@smithy+signatur_e7d72008f907c45a36788e380ed24019/node_modules/@earendil-works/pi-ai/dist/utils/hash.js
|
|
5
5
|
function shortHash(str) {
|
|
6
6
|
let h1 = 3735928559;
|
|
7
7
|
let h2 = 1103547991;
|
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
import { createRequire as __nerveCreateRequire } from "node:module";
|
|
2
2
|
const require = __nerveCreateRequire(import.meta.url);
|
|
3
|
+
import {
|
|
4
|
+
applyOpenRouterReportedCost,
|
|
5
|
+
isOpenRouterModel
|
|
6
|
+
} from "./chunk-HDBDYGJQ.js";
|
|
3
7
|
import {
|
|
4
8
|
buildCopilotDynamicHeaders,
|
|
5
9
|
hasCopilotVisionInput
|
|
6
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-QBAIDKF6.js";
|
|
7
11
|
import {
|
|
8
12
|
clampOpenAIPromptCacheKey
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import {
|
|
11
|
-
shortHash
|
|
12
|
-
} from "./chunk-KSZJ3HGD.js";
|
|
13
|
+
} from "./chunk-ODS5QROC.js";
|
|
13
14
|
import {
|
|
14
15
|
OpenAI
|
|
15
16
|
} from "./chunk-NW3DH7IK.js";
|
|
16
17
|
import {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
} from "./chunk-RUZ2UAYH.js";
|
|
18
|
+
shortHash
|
|
19
|
+
} from "./chunk-2BKMOJYJ.js";
|
|
20
20
|
import {
|
|
21
21
|
appendGrammarToolInputJsonDelta,
|
|
22
22
|
buildBaseOptions,
|
|
23
23
|
clampThinkingBudgetToAnswerRoom,
|
|
24
|
+
closeGrammarToolInputJson,
|
|
24
25
|
createGrammarToolInputProperties,
|
|
25
26
|
getGrammarToolInput,
|
|
26
27
|
getJsonSchemaToolParameters,
|
|
@@ -29,41 +30,46 @@ import {
|
|
|
29
30
|
resolveSamplingParams,
|
|
30
31
|
thinkingBudgetForLevel,
|
|
31
32
|
transformMessages
|
|
32
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-OAEV22IW.js";
|
|
33
34
|
import {
|
|
34
35
|
sanitizeSurrogates
|
|
35
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-3SSNDIQT.js";
|
|
37
|
+
import {
|
|
38
|
+
retryProviderRequest
|
|
39
|
+
} from "./chunk-EX63VKXY.js";
|
|
36
40
|
import {
|
|
37
41
|
formatProviderError,
|
|
38
42
|
normalizeProviderError
|
|
39
|
-
} from "./chunk-
|
|
40
|
-
import {
|
|
41
|
-
retryProviderRequest
|
|
42
|
-
} from "./chunk-SQ7CWNIT.js";
|
|
43
|
+
} from "./chunk-O2652RWY.js";
|
|
43
44
|
import {
|
|
44
45
|
headersToRecord
|
|
45
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-VBM7TD3X.js";
|
|
46
47
|
import {
|
|
47
48
|
getProviderEnvValue
|
|
48
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-SU2USXTD.js";
|
|
50
|
+
import {
|
|
51
|
+
ToolCallArgumentsStream
|
|
52
|
+
} from "./chunk-H2G55ZPG.js";
|
|
49
53
|
import {
|
|
50
54
|
calculateCost,
|
|
51
55
|
clampThinkingLevel,
|
|
52
56
|
getDeclaredTools,
|
|
53
|
-
getSystemMessageText,
|
|
54
|
-
renderSystemMessageUpdate,
|
|
55
57
|
resolveTranscript,
|
|
56
58
|
resolveTranscriptTools
|
|
57
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-TGKIV3F4.js";
|
|
58
60
|
import {
|
|
59
61
|
AssistantMessageEventStream
|
|
60
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-TSV3PFU2.js";
|
|
61
63
|
import {
|
|
62
64
|
getIdentityHeaders
|
|
63
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-UDC7NPQJ.js";
|
|
66
|
+
import {
|
|
67
|
+
getSystemMessageText,
|
|
68
|
+
renderSystemMessageUpdate
|
|
69
|
+
} from "./chunk-XY53EFK3.js";
|
|
64
70
|
import "./chunk-CWESUMYQ.js";
|
|
65
71
|
|
|
66
|
-
// node_modules/.pnpm/@earendil-works+pi-ai@1.
|
|
72
|
+
// node_modules/.pnpm/@earendil-works+pi-ai@1.5.1_@aws-sdk+credential-provider-node@3.972.83_@smithy+signatur_e7d72008f907c45a36788e380ed24019/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js
|
|
67
73
|
function hasHeader(headers, name) {
|
|
68
74
|
if (!headers)
|
|
69
75
|
return false;
|
|
@@ -236,23 +242,14 @@ var stream = (model, context, options) => {
|
|
|
236
242
|
let hasFinishReason = false;
|
|
237
243
|
const toolCallBlocksByIndex = /* @__PURE__ */ new Map();
|
|
238
244
|
const toolCallBlocksById = /* @__PURE__ */ new Map();
|
|
245
|
+
const toolCallStates = /* @__PURE__ */ new Map();
|
|
239
246
|
const blocks = output.content;
|
|
240
247
|
const getContentIndex = (block) => blocks.indexOf(block);
|
|
241
|
-
const
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
return typeof value === "string" ? value : "";
|
|
247
|
-
};
|
|
248
|
-
const appendCustomToolCallInput = (block, nextInput, close) => {
|
|
249
|
-
const customInput = block.customInput;
|
|
250
|
-
if (!customInput)
|
|
251
|
-
return void 0;
|
|
252
|
-
const delta = appendGrammarToolInputJsonDelta(customInput.jsonBuffer, customInput.property, nextInput, close);
|
|
253
|
-
block.arguments = { [customInput.property]: nextInput };
|
|
254
|
-
return delta;
|
|
255
|
-
};
|
|
248
|
+
const customInput = (property) => ({
|
|
249
|
+
kind: "custom",
|
|
250
|
+
property,
|
|
251
|
+
buffer: { input: "", started: false, closed: false }
|
|
252
|
+
});
|
|
256
253
|
const finishBlock = (block) => {
|
|
257
254
|
const contentIndex = getContentIndex(block);
|
|
258
255
|
if (contentIndex === -1) {
|
|
@@ -274,8 +271,10 @@ var stream = (model, context, options) => {
|
|
|
274
271
|
partial: output
|
|
275
272
|
});
|
|
276
273
|
} else if (block.type === "toolCall") {
|
|
277
|
-
|
|
278
|
-
|
|
274
|
+
const input = toolCallStates.get(block).input;
|
|
275
|
+
toolCallStates.delete(block);
|
|
276
|
+
if (input.kind === "custom") {
|
|
277
|
+
const delta = closeGrammarToolInputJson(input.buffer, input.property, void 0);
|
|
279
278
|
if (delta !== void 0) {
|
|
280
279
|
stream2.push({
|
|
281
280
|
type: "toolcall_delta",
|
|
@@ -285,11 +284,8 @@ var stream = (model, context, options) => {
|
|
|
285
284
|
});
|
|
286
285
|
}
|
|
287
286
|
} else {
|
|
288
|
-
Object.assign(block,
|
|
287
|
+
Object.assign(block, input.arguments.finish());
|
|
289
288
|
}
|
|
290
|
-
delete block.partialArgs;
|
|
291
|
-
delete block.customInput;
|
|
292
|
-
delete block.streamIndex;
|
|
293
289
|
stream2.push({
|
|
294
290
|
type: "toolcall_end",
|
|
295
291
|
contentIndex,
|
|
@@ -327,16 +323,16 @@ var stream = (model, context, options) => {
|
|
|
327
323
|
}
|
|
328
324
|
if (!block) {
|
|
329
325
|
const customInputProperty = toolCall.custom && !toolCall.function ? grammarToolInputProperties.get(name) ?? "input" : void 0;
|
|
330
|
-
const hasCustomInput = customInputProperty !== void 0;
|
|
331
326
|
block = {
|
|
332
327
|
type: "toolCall",
|
|
333
328
|
id: toolCall.id || "",
|
|
334
329
|
name,
|
|
335
|
-
arguments:
|
|
336
|
-
partialArgs: hasCustomInput ? void 0 : "",
|
|
337
|
-
customInput: hasCustomInput ? { property: customInputProperty, jsonBuffer: { input: "", started: false, closed: false } } : void 0,
|
|
338
|
-
streamIndex
|
|
330
|
+
arguments: customInputProperty !== void 0 ? { [customInputProperty]: "" } : {}
|
|
339
331
|
};
|
|
332
|
+
toolCallStates.set(block, {
|
|
333
|
+
streamIndex,
|
|
334
|
+
input: customInputProperty !== void 0 ? customInput(customInputProperty) : { kind: "json", arguments: new ToolCallArgumentsStream() }
|
|
335
|
+
});
|
|
340
336
|
if (streamIndex !== void 0) {
|
|
341
337
|
toolCallBlocksByIndex.set(streamIndex, block);
|
|
342
338
|
}
|
|
@@ -350,8 +346,9 @@ var stream = (model, context, options) => {
|
|
|
350
346
|
partial: output
|
|
351
347
|
});
|
|
352
348
|
}
|
|
353
|
-
|
|
354
|
-
|
|
349
|
+
const state = toolCallStates.get(block);
|
|
350
|
+
if (streamIndex !== void 0 && state.streamIndex === void 0) {
|
|
351
|
+
state.streamIndex = streamIndex;
|
|
355
352
|
toolCallBlocksByIndex.set(streamIndex, block);
|
|
356
353
|
}
|
|
357
354
|
if (toolCall.id) {
|
|
@@ -360,16 +357,12 @@ var stream = (model, context, options) => {
|
|
|
360
357
|
if (!block.name && name) {
|
|
361
358
|
block.name = name;
|
|
362
359
|
}
|
|
363
|
-
if (toolCall.custom && !toolCall.function &&
|
|
360
|
+
if (toolCall.custom && !toolCall.function && state.input.kind !== "custom") {
|
|
364
361
|
const customInputProperty = grammarToolInputProperties.get(block.name) ?? "input";
|
|
365
362
|
block.arguments = { [customInputProperty]: "" };
|
|
366
|
-
|
|
367
|
-
property: customInputProperty,
|
|
368
|
-
jsonBuffer: { input: "", started: false, closed: false }
|
|
369
|
-
};
|
|
370
|
-
delete block.partialArgs;
|
|
363
|
+
state.input = customInput(customInputProperty);
|
|
371
364
|
}
|
|
372
|
-
return block;
|
|
365
|
+
return { block, state };
|
|
373
366
|
};
|
|
374
367
|
for await (const chunk of openaiStream) {
|
|
375
368
|
await options?.onProviderStreamEvent?.(chunk, model);
|
|
@@ -444,7 +437,7 @@ var stream = (model, context, options) => {
|
|
|
444
437
|
}
|
|
445
438
|
if (choice?.delta?.tool_calls) {
|
|
446
439
|
for (const toolCall of choice.delta.tool_calls) {
|
|
447
|
-
const block = ensureToolCallBlock(toolCall);
|
|
440
|
+
const { block, state } = ensureToolCallBlock(toolCall);
|
|
448
441
|
if (!block.id && toolCall.id) {
|
|
449
442
|
block.id = toolCall.id;
|
|
450
443
|
toolCallBlocksById.set(toolCall.id, block);
|
|
@@ -454,13 +447,13 @@ var stream = (model, context, options) => {
|
|
|
454
447
|
block.name = name;
|
|
455
448
|
}
|
|
456
449
|
let delta = "";
|
|
457
|
-
|
|
450
|
+
const input = state.input;
|
|
451
|
+
if (toolCall.function?.arguments && input.kind === "json") {
|
|
458
452
|
delta = toolCall.function.arguments;
|
|
459
|
-
block.
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
delta = appendCustomToolCallInput(block, nextInput, false) ?? "";
|
|
453
|
+
block.arguments = input.arguments.append(delta);
|
|
454
|
+
} else if (toolCall.custom?.input && input.kind === "custom") {
|
|
455
|
+
delta = appendGrammarToolInputJsonDelta(input.buffer, input.property, toolCall.custom.input) ?? "";
|
|
456
|
+
block.arguments = { [input.property]: input.buffer.input };
|
|
464
457
|
}
|
|
465
458
|
stream2.push({
|
|
466
459
|
type: "toolcall_delta",
|
|
@@ -497,10 +490,6 @@ var stream = (model, context, options) => {
|
|
|
497
490
|
if (block.type === "thinking") {
|
|
498
491
|
applyStreamedReasoningDetails(block);
|
|
499
492
|
}
|
|
500
|
-
delete block.index;
|
|
501
|
-
delete block.partialArgs;
|
|
502
|
-
delete block.customInput;
|
|
503
|
-
delete block.streamIndex;
|
|
504
493
|
}
|
|
505
494
|
output.stopReason = options?.signal?.aborted ? "aborted" : "error";
|
|
506
495
|
output.errorMessage = formatProviderError(normalizeProviderError(error));
|
|
@@ -567,11 +556,13 @@ function buildParams(model, context, options, compat = getCompat(model), cacheRe
|
|
|
567
556
|
grammarToolInputProperties
|
|
568
557
|
});
|
|
569
558
|
const cacheControl = getCompatCacheControl(compat, cacheRetention);
|
|
559
|
+
const promptCacheKeyMode = compat.promptCacheKeyMode ?? "auto";
|
|
560
|
+
const supportsPromptCacheKey = promptCacheKeyMode === "enabled" || promptCacheKeyMode === "auto" && (model.baseUrl.includes("api.openai.com") || cacheRetention === "long" && compat.supportsLongCacheRetention);
|
|
570
561
|
const params = {
|
|
571
562
|
model: model.id,
|
|
572
563
|
messages,
|
|
573
564
|
stream: true,
|
|
574
|
-
prompt_cache_key:
|
|
565
|
+
prompt_cache_key: cacheRetention !== "none" && supportsPromptCacheKey ? clampOpenAIPromptCacheKey(options?.sessionId) : void 0,
|
|
575
566
|
prompt_cache_retention: cacheRetention === "long" && compat.supportsLongCacheRetention ? "24h" : void 0
|
|
576
567
|
};
|
|
577
568
|
if (compat.supportsUsageInStreaming !== false) {
|
|
@@ -595,7 +586,7 @@ function buildParams(model, context, options, compat = getCompat(model), cacheRe
|
|
|
595
586
|
if (compat.zaiToolStream) {
|
|
596
587
|
params.tool_stream = true;
|
|
597
588
|
}
|
|
598
|
-
} else if (hasToolHistory(context.messages)) {
|
|
589
|
+
} else if (compat.requiresToolsWithToolHistory && hasToolHistory(context.messages)) {
|
|
599
590
|
params.tools = [];
|
|
600
591
|
}
|
|
601
592
|
if (cacheControl) {
|
|
@@ -911,7 +902,7 @@ function convertMessages(model, context, compat, options) {
|
|
|
911
902
|
} else if (msg.role === "assistant") {
|
|
912
903
|
const assistantMsg = {
|
|
913
904
|
role: "assistant",
|
|
914
|
-
content: compat.requiresAssistantAfterToolResult ? "" : null
|
|
905
|
+
content: compat.requiresAssistantAfterToolResult || compat.requiresNonNullAssistantContent ? "" : null
|
|
915
906
|
};
|
|
916
907
|
const assistantTextParts = msg.content.filter(isTextContentBlock).filter((block) => block.text.trim().length > 0).map((block) => ({
|
|
917
908
|
type: "text",
|
|
@@ -1087,6 +1078,9 @@ function parseChunkUsage(rawUsage, model) {
|
|
|
1087
1078
|
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 }
|
|
1088
1079
|
};
|
|
1089
1080
|
calculateCost(model, usage);
|
|
1081
|
+
if (isOpenRouterModel(model)) {
|
|
1082
|
+
applyOpenRouterReportedCost(usage, rawUsage);
|
|
1083
|
+
}
|
|
1090
1084
|
return usage;
|
|
1091
1085
|
}
|
|
1092
1086
|
function mapStopReason(reason) {
|
|
@@ -1139,6 +1133,8 @@ function detectCompat(model) {
|
|
|
1139
1133
|
maxTokensField: useMaxTokens ? "max_tokens" : "max_completion_tokens",
|
|
1140
1134
|
requiresToolResultName: false,
|
|
1141
1135
|
requiresAssistantAfterToolResult: false,
|
|
1136
|
+
requiresNonNullAssistantContent: false,
|
|
1137
|
+
requiresToolsWithToolHistory: false,
|
|
1142
1138
|
requiresThinkingAsText: false,
|
|
1143
1139
|
requiresReasoningContentOnAssistantMessages: isDeepSeek,
|
|
1144
1140
|
thinkingFormat: isDeepSeek ? "deepseek" : isZai ? "zai" : isTogether ? "together" : isAntLing ? "ant-ling" : isOpenRouter ? "openrouter" : "openai",
|
|
@@ -1173,6 +1169,8 @@ function getCompat(model) {
|
|
|
1173
1169
|
maxTokensField: model.compat.maxTokensField ?? detected.maxTokensField,
|
|
1174
1170
|
requiresToolResultName: model.compat.requiresToolResultName ?? detected.requiresToolResultName,
|
|
1175
1171
|
requiresAssistantAfterToolResult: model.compat.requiresAssistantAfterToolResult ?? detected.requiresAssistantAfterToolResult,
|
|
1172
|
+
requiresNonNullAssistantContent: model.compat.requiresNonNullAssistantContent ?? detected.requiresNonNullAssistantContent,
|
|
1173
|
+
requiresToolsWithToolHistory: model.compat.requiresToolsWithToolHistory ?? detected.requiresToolsWithToolHistory,
|
|
1176
1174
|
requiresThinkingAsText: model.compat.requiresThinkingAsText ?? detected.requiresThinkingAsText,
|
|
1177
1175
|
requiresReasoningContentOnAssistantMessages: model.compat.requiresReasoningContentOnAssistantMessages ?? detected.requiresReasoningContentOnAssistantMessages,
|
|
1178
1176
|
thinkingFormat: model.compat.thinkingFormat ?? detected.thinkingFormat,
|
|
@@ -1191,6 +1189,7 @@ function getCompat(model) {
|
|
|
1191
1189
|
sendSessionAffinityHeaders: model.compat.sendSessionAffinityHeaders ?? detected.sendSessionAffinityHeaders,
|
|
1192
1190
|
sessionAffinityFormat: model.compat.sessionAffinityFormat ?? detected.sessionAffinityFormat,
|
|
1193
1191
|
supportsLongCacheRetention: model.compat.supportsLongCacheRetention ?? detected.supportsLongCacheRetention,
|
|
1192
|
+
promptCacheKeyMode: model.compat.promptCacheKeyMode,
|
|
1194
1193
|
vllmPriority: model.compat.vllmPriority
|
|
1195
1194
|
};
|
|
1196
1195
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __nerveCreateRequire } from "node:module";
|
|
2
2
|
const require = __nerveCreateRequire(import.meta.url);
|
|
3
3
|
|
|
4
|
-
// node_modules/.pnpm/@earendil-works+pi-ai@1.
|
|
4
|
+
// node_modules/.pnpm/@earendil-works+pi-ai@1.5.1_@aws-sdk+credential-provider-node@3.972.83_@smithy+signatur_e7d72008f907c45a36788e380ed24019/node_modules/@earendil-works/pi-ai/dist/utils/sanitize-unicode.js
|
|
5
5
|
function sanitizeSurrogates(text) {
|
|
6
6
|
return text.replace(/[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g, "");
|
|
7
7
|
}
|
|
@@ -7,18 +7,18 @@ import {
|
|
|
7
7
|
getJsonSchemaToolParameters,
|
|
8
8
|
resolveJsonSchemaStrictSampling,
|
|
9
9
|
transformMessages
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-OAEV22IW.js";
|
|
11
11
|
import {
|
|
12
12
|
sanitizeSurrogates
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-3SSNDIQT.js";
|
|
14
14
|
import {
|
|
15
15
|
retryProviderRequest
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-EX63VKXY.js";
|
|
17
17
|
import {
|
|
18
18
|
clampThinkingLevel,
|
|
19
19
|
collapseSystemMessages,
|
|
20
20
|
withoutInitialSystemMessage
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-TGKIV3F4.js";
|
|
22
22
|
import {
|
|
23
23
|
__commonJS,
|
|
24
24
|
__require,
|
|
@@ -1336,7 +1336,7 @@ Content-Type: ${partContentType}\r
|
|
|
1336
1336
|
* @returns A proxy agent
|
|
1337
1337
|
*/
|
|
1338
1338
|
static async #getProxyAgent() {
|
|
1339
|
-
this.#proxyAgent ||= (await import("./chunk-
|
|
1339
|
+
this.#proxyAgent ||= (await import("./chunk-JCF3ZRP4.js")).HttpsProxyAgent;
|
|
1340
1340
|
return this.#proxyAgent;
|
|
1341
1341
|
}
|
|
1342
1342
|
static async #getFetch() {
|
|
@@ -33283,7 +33283,7 @@ function getApiKeyFromEnv() {
|
|
|
33283
33283
|
return envGoogleApiKey || envGeminiApiKey || void 0;
|
|
33284
33284
|
}
|
|
33285
33285
|
|
|
33286
|
-
// node_modules/.pnpm/@earendil-works+pi-ai@1.
|
|
33286
|
+
// node_modules/.pnpm/@earendil-works+pi-ai@1.5.1_@aws-sdk+credential-provider-node@3.972.83_@smithy+signatur_e7d72008f907c45a36788e380ed24019/node_modules/@earendil-works/pi-ai/dist/api/google-shared.js
|
|
33287
33287
|
var GOOGLE_SDK_THINKING_LEVEL_MAP = {
|
|
33288
33288
|
THINKING_LEVEL_UNSPECIFIED: ThinkingLevel.THINKING_LEVEL_UNSPECIFIED,
|
|
33289
33289
|
MINIMAL: ThinkingLevel.MINIMAL,
|
|
@@ -33524,6 +33524,53 @@ function sanitizeForOpenApi(schema) {
|
|
|
33524
33524
|
}
|
|
33525
33525
|
return result;
|
|
33526
33526
|
}
|
|
33527
|
+
var JSON_SCHEMA_NAME_MAPS = /* @__PURE__ */ new Set([
|
|
33528
|
+
"properties",
|
|
33529
|
+
"patternProperties",
|
|
33530
|
+
"$defs",
|
|
33531
|
+
"definitions",
|
|
33532
|
+
"dependentSchemas",
|
|
33533
|
+
"dependencies"
|
|
33534
|
+
]);
|
|
33535
|
+
var JSON_SCHEMA_SUBSCHEMAS = /* @__PURE__ */ new Set([
|
|
33536
|
+
"additionalProperties",
|
|
33537
|
+
"unevaluatedProperties",
|
|
33538
|
+
"propertyNames",
|
|
33539
|
+
"items",
|
|
33540
|
+
"prefixItems",
|
|
33541
|
+
"additionalItems",
|
|
33542
|
+
"unevaluatedItems",
|
|
33543
|
+
"contains",
|
|
33544
|
+
"allOf",
|
|
33545
|
+
"anyOf",
|
|
33546
|
+
"oneOf",
|
|
33547
|
+
"not",
|
|
33548
|
+
"if",
|
|
33549
|
+
"then",
|
|
33550
|
+
"else",
|
|
33551
|
+
"contentSchema"
|
|
33552
|
+
]);
|
|
33553
|
+
function rewriteConstAsEnum(schema, isNameMap = false) {
|
|
33554
|
+
if (Array.isArray(schema))
|
|
33555
|
+
return schema.map((item) => rewriteConstAsEnum(item));
|
|
33556
|
+
if (typeof schema !== "object" || schema === null)
|
|
33557
|
+
return schema;
|
|
33558
|
+
const result = Object.fromEntries(Object.entries(schema).map(([key, value]) => {
|
|
33559
|
+
if (isNameMap || JSON_SCHEMA_SUBSCHEMAS.has(key))
|
|
33560
|
+
return [key, rewriteConstAsEnum(value)];
|
|
33561
|
+
if (JSON_SCHEMA_NAME_MAPS.has(key))
|
|
33562
|
+
return [key, rewriteConstAsEnum(value, true)];
|
|
33563
|
+
return [key, value];
|
|
33564
|
+
}));
|
|
33565
|
+
if (!isNameMap && "const" in result && result.enum === void 0) {
|
|
33566
|
+
const value = result.const;
|
|
33567
|
+
if (typeof value === "string" || typeof value === "number") {
|
|
33568
|
+
delete result.const;
|
|
33569
|
+
result.enum = [value];
|
|
33570
|
+
}
|
|
33571
|
+
}
|
|
33572
|
+
return result;
|
|
33573
|
+
}
|
|
33527
33574
|
function convertTools(tools, useParameters = false, supportsStrictMode = true) {
|
|
33528
33575
|
if (tools.length === 0)
|
|
33529
33576
|
return void 0;
|
|
@@ -33535,7 +33582,7 @@ function convertTools(tools, useParameters = false, supportsStrictMode = true) {
|
|
|
33535
33582
|
return {
|
|
33536
33583
|
name: tool.name,
|
|
33537
33584
|
description: tool.description,
|
|
33538
|
-
...useParameters ? { parameters: sanitizeForOpenApi(parameters) } : { parametersJsonSchema: parameters }
|
|
33585
|
+
...useParameters ? { parameters: sanitizeForOpenApi(parameters) } : { parametersJsonSchema: rewriteConstAsEnum(parameters) }
|
|
33539
33586
|
};
|
|
33540
33587
|
})
|
|
33541
33588
|
}
|
|
@@ -33630,4 +33677,4 @@ export {
|
|
|
33630
33677
|
mapStopReason,
|
|
33631
33678
|
retryGoogleRequest
|
|
33632
33679
|
};
|
|
33633
|
-
/*! For license information please see chunk-
|
|
33680
|
+
/*! For license information please see chunk-3VZR3ZUY.js.LEGAL.txt */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __nerveCreateRequire } from "node:module";
|
|
2
2
|
const require = __nerveCreateRequire(import.meta.url);
|
|
3
3
|
|
|
4
|
-
// node_modules/.pnpm/@earendil-works+pi-ai@1.
|
|
4
|
+
// node_modules/.pnpm/@earendil-works+pi-ai@1.5.1_@aws-sdk+credential-provider-node@3.972.83_@smithy+signatur_e7d72008f907c45a36788e380ed24019/node_modules/@earendil-works/pi-ai/dist/env-api-keys.js
|
|
5
5
|
var __rewriteRelativeImportExtension = function(path, preserveJsx) {
|
|
6
6
|
if (typeof path === "string" && /^\.\.?\//.test(path)) {
|
|
7
7
|
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function(m, tsx, d, ext, cm) {
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
createSearchIndex,
|
|
11
11
|
discoverGitRepositories,
|
|
12
12
|
files_exports,
|
|
13
|
+
image_exports,
|
|
13
14
|
initializeManagedProcessHost,
|
|
14
15
|
inspectManagedTarget,
|
|
15
16
|
inspectTcpListeners,
|
|
@@ -28,7 +29,7 @@ import {
|
|
|
28
29
|
terminateManagedTarget,
|
|
29
30
|
terminateTcpListener,
|
|
30
31
|
validateGitBranchName
|
|
31
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-WRTA5G57.js";
|
|
32
33
|
import "./chunk-CWESUMYQ.js";
|
|
33
34
|
export {
|
|
34
35
|
ChangeMonitor,
|
|
@@ -40,6 +41,7 @@ export {
|
|
|
40
41
|
createSearchIndex,
|
|
41
42
|
discoverGitRepositories,
|
|
42
43
|
files_exports as files,
|
|
44
|
+
image_exports as image,
|
|
43
45
|
initializeManagedProcessHost,
|
|
44
46
|
inspectManagedTarget,
|
|
45
47
|
inspectTcpListeners,
|