@nervekit/desktop 0.40.1 → 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.
Files changed (109) hide show
  1. package/THIRD-PARTY-LICENSES.txt +7 -29
  2. package/dist/{chunk-KSZJ3HGD.js → chunk-2BKMOJYJ.js} +1 -1
  3. package/dist/{chunk-4MMJDHFX.js → chunk-3JJN36GV.js} +70 -71
  4. package/dist/{chunk-2Z5FLMLE.js → chunk-3SSNDIQT.js} +1 -1
  5. package/dist/{chunk-CKVFGRVV.js → chunk-3VZR3ZUY.js} +54 -7
  6. package/dist/{chunk-BXVRC3HF.js → chunk-4H3WR7IT.js} +1 -1
  7. package/dist/{chunk-QVHYARC2.js → chunk-4VPX67B7.js} +3 -1
  8. package/dist/chunk-5NN7JAJ2.js +258 -0
  9. package/dist/{chunk-AJGPULMX.js → chunk-6FSDDGFZ.js} +815 -3108
  10. package/dist/chunk-6PACEIUY.js +183 -0
  11. package/dist/{chunk-XNYZEQ3U.js → chunk-6TAN6WG6.js} +1 -1
  12. package/dist/{chunk-55OGZFNA.js → chunk-7FLZA2BD.js} +31 -15
  13. package/dist/{chunk-XBHEYY65.js → chunk-7JQBECUL.js} +1 -1
  14. package/dist/{chunk-5Y3NEEOK.js → chunk-AAEIGAGD.js} +9 -9
  15. package/dist/{chunk-H5UKINTD.js → chunk-ANI6J75M.js} +68 -65
  16. package/dist/chunk-B4IE2GAM.js +14 -0
  17. package/dist/chunk-BNVMNV4O.js +69 -0
  18. package/dist/{chunk-L3YB2QLN.js → chunk-C6RO4LP3.js} +2 -2
  19. package/dist/chunk-DTGL5P2V.js +250 -0
  20. package/dist/{chunk-QWTKCUIZ.js → chunk-E4JNHQGT.js} +11 -9
  21. package/dist/chunk-ER2ES2RH.js +64 -0
  22. package/dist/{chunk-SQ7CWNIT.js → chunk-EX63VKXY.js} +1 -1
  23. package/dist/{chunk-KQPEOUCA.js → chunk-F3MHINI6.js} +19 -23
  24. package/dist/{chunk-KAZFF2RD.js → chunk-FGZX4Q7W.js} +137 -113
  25. package/dist/{chunk-I6NVW4NX.js → chunk-FZ5N6WXF.js} +29 -33
  26. package/dist/chunk-H2G55ZPG.js +783 -0
  27. package/dist/chunk-HDBDYGJQ.js +40 -0
  28. package/dist/{chunk-TJR6ASRW.js → chunk-HOCODVKL.js} +22 -24
  29. package/dist/chunk-K2J2VZXO.js +142 -0
  30. package/dist/{chunk-MH3SUHI2.js → chunk-KBNEZR7T.js} +2 -2
  31. package/dist/chunk-KSSM6LUI.js +340 -0
  32. package/dist/{chunk-QFXKQNMT.js → chunk-KTGSBL6T.js} +14 -17
  33. package/dist/chunk-L2DHKP5C.js +42 -0
  34. package/dist/{chunk-DBXMYYPJ.js → chunk-M3ELKCNA.js} +1 -1
  35. package/dist/{chunk-KIGB3FK6.js → chunk-MWIKZIAI.js} +9 -8
  36. package/dist/{chunk-AON37AL2.js → chunk-O2652RWY.js} +29 -4
  37. package/dist/chunk-O6U226AI.js +249 -0
  38. package/dist/{chunk-N5B2RRSS.js → chunk-OAEV22IW.js} +47 -26
  39. package/dist/chunk-OANTMDXI.js +29 -0
  40. package/dist/{chunk-UGDIHDAR.js → chunk-ODS5QROC.js} +1 -1
  41. package/dist/{chunk-TW6FURZ7.js → chunk-PST63OUS.js} +5 -5
  42. package/dist/{chunk-S2PITDVA.js → chunk-QBAIDKF6.js} +1 -1
  43. package/dist/chunk-RPLBWENJ.js +224 -0
  44. package/dist/{chunk-CWHAK2HX.js → chunk-S62LLS4I.js} +33 -55
  45. package/dist/chunk-SHEU5KLD.js +32 -0
  46. package/dist/{chunk-FESN7DND.js → chunk-SU2USXTD.js} +1 -1
  47. package/dist/chunk-T6NRMNLQ.js +22 -0
  48. package/dist/{chunk-WXRYBXYR.js → chunk-TGKIV3F4.js} +53 -65
  49. package/dist/{chunk-MN7PZ2PH.js → chunk-TSV3PFU2.js} +2 -2
  50. package/dist/{chunk-24GQ74HM.js → chunk-UDC7NPQJ.js} +3 -3
  51. package/dist/{chunk-CEX2GWGZ.js → chunk-VBM7TD3X.js} +1 -1
  52. package/dist/chunk-VC6TX2Y2.js +359 -0
  53. package/dist/{chunk-V53CETNZ.js → chunk-VTDI5KP7.js} +241 -104
  54. package/dist/{chunk-ONWQH2W6.js → chunk-WIN7KHMV.js} +15 -18
  55. package/dist/chunk-WJULIJOU.js +168 -0
  56. package/dist/{chunk-HKLAYK2Z.js → chunk-WRTA5G57.js} +23 -0
  57. package/dist/{chunk-FOFVPPPV.js → chunk-WYPVD3HW.js} +10 -9
  58. package/dist/{chunk-D7WIIZAV.js → chunk-XE2E2KBP.js} +10 -9
  59. package/dist/chunk-XY53EFK3.js +39 -0
  60. package/dist/chunk-XZYFB566.js +153 -0
  61. package/dist/{chunk-OY6PIAR7.js → chunk-YJT4NXMV.js} +5 -5
  62. package/dist/{chunk-3DGBM7UW.js → chunk-YQFENES6.js} +3 -3
  63. package/dist/chunk-YUO5V75X.js +128 -0
  64. package/dist/daemon.js +15 -10
  65. package/dist/git-isolated-reader-helper.js +1 -1
  66. package/dist/main.js +14 -9
  67. package/dist/web/assets/{AsyncBashCenterHost-HGsdxUJ3.js → AsyncBashCenterHost-BvXKoCVr.js} +1 -1
  68. package/dist/web/assets/{ConversationsWorkbenchPanel-B6dzWkG1.js → ConversationsWorkbenchPanel-CIfK_e3I.js} +1 -1
  69. package/dist/web/assets/{DiscoverCenterHost-B186WBRA.js → DiscoverCenterHost-Ep8EN9iJ.js} +1 -1
  70. package/dist/web/assets/{FileCenterHost-DigJOU5M.js → FileCenterHost-C_7XZAFZ.js} +1 -1
  71. package/dist/web/assets/{FilesWorkbenchPanel-VPvx3Bmi.js → FilesWorkbenchPanel-CtXo7ywG.js} +1 -1
  72. package/dist/web/assets/{GitDiffCenterHost-IuZfF3hG.js → GitDiffCenterHost-Cr7lqGI_.js} +1 -1
  73. package/dist/web/assets/{GitWorkbenchPanel-CScC0CfH.js → GitWorkbenchPanel-BFbwUgIN.js} +1 -1
  74. package/dist/web/assets/{LaunchConfigurationNotice-5yb4cH27.js → LaunchConfigurationNotice-CJjWkMhv.js} +1 -1
  75. package/dist/web/assets/{LaunchesWorkbenchPanel-Vy0Gm7gg.js → LaunchesWorkbenchPanel-BqzJvsrj.js} +1 -1
  76. package/dist/web/assets/{LogsCenterHost-BXBozCYw.js → LogsCenterHost-BI1fSxFW.js} +1 -1
  77. package/dist/web/assets/{MermaidCenterHost-DDh4ArdK.js → MermaidCenterHost-DVsZB8nB.js} +1 -1
  78. package/dist/web/assets/{MobileFilesBody-Cda_7gDp.js → MobileFilesBody-BJMoaP9I.js} +1 -1
  79. package/dist/web/assets/{MobileFilesHost-C1jev2Un.js → MobileFilesHost-D843vkDF.js} +1 -1
  80. package/dist/web/assets/{MobileLaunchOutputHost-Bsv12o2H.js → MobileLaunchOutputHost-vpltMcar.js} +1 -1
  81. package/dist/web/assets/{MobileLaunchesHost-C9VH-2bn.js → MobileLaunchesHost-CdDrKASg.js} +1 -1
  82. package/dist/web/assets/{MobileLogsHost-BMDXc-WC.js → MobileLogsHost-qK7N-C1y.js} +1 -1
  83. package/dist/web/assets/{MobileNoteEditorHost-BA6WIY1Y.js → MobileNoteEditorHost-Bg1N8o54.js} +1 -1
  84. package/dist/web/assets/{MobileNotesHost-BZeYpK9H.js → MobileNotesHost-meLV39Yw.js} +1 -1
  85. package/dist/web/assets/{MobileProjectSettingsHost-U3Mx3EN8.js → MobileProjectSettingsHost-A49Fdn54.js} +1 -1
  86. package/dist/web/assets/{MobileProjectSettingsPageHost-CMvxbjfs.js → MobileProjectSettingsPageHost-BXpUqS_N.js} +1 -1
  87. package/dist/web/assets/{MobileSettingsHost-CP8Z_-gH.js → MobileSettingsHost-DPKPajzI.js} +1 -1
  88. package/dist/web/assets/{MobileSettingsPageHost-BPjXKTMV.js → MobileSettingsPageHost-izNWGN0i.js} +1 -1
  89. package/dist/web/assets/{MobileSettingsPageScreen-C5rHdrUU.js → MobileSettingsPageScreen-DWMg4fDo.js} +1 -1
  90. package/dist/web/assets/{ProjectSettingsCenterHost-BVXpBixy.js → ProjectSettingsCenterHost-DHeb274m.js} +1 -1
  91. package/dist/web/assets/{PullRequestCenterHost-CZhXfCX2.js → PullRequestCenterHost-BYkWxXQe.js} +1 -1
  92. package/dist/web/assets/{PullRequestsWorkbenchPanel-BBnZJVnI.js → PullRequestsWorkbenchPanel-ZvGbi1Cr.js} +1 -1
  93. package/dist/web/assets/{SearchWorkbenchPanel-qLgszneN.js → SearchWorkbenchPanel-DaC0smfe.js} +1 -1
  94. package/dist/web/assets/{SettingsCenter-7BfrBfiy.js → SettingsCenter-C_NLBsi6.js} +1 -1
  95. package/dist/web/assets/{SettingsCenterHost-Ck5uHILP.js → SettingsCenterHost-jP8MULEj.js} +1 -1
  96. package/dist/web/assets/{SystemPromptCenterHost-ya5AvXsd.js → SystemPromptCenterHost-B1hfsfAn.js} +1 -1
  97. package/dist/web/assets/{discover-B3I5g1_G.js → discover-B-aZ504j.js} +1 -1
  98. package/dist/web/assets/{index-FJEmK_L5.js → index-TZ1KAAsX.js} +34 -34
  99. package/dist/web/assets/{settings-page-controllers.svelte-CU0i08wo.js → settings-page-controllers.svelte-D_ydJF8u.js} +1 -1
  100. package/dist/web/assets/{shell-layout.svelte-BT2508sa.js → shell-layout.svelte-OoLFwzzJ.js} +2 -2
  101. package/dist/web/assets/{views-Z-n-GTYY.js → views-ByPCKDiZ.js} +1 -1
  102. package/dist/web/index.html +3 -3
  103. package/dist/web/sw.js +1 -1
  104. package/dist/worker.js +14 -9
  105. package/package.json +8 -9
  106. package/dist/chunk-RUZ2UAYH.js +0 -365
  107. package/dist/resize-worker.js +0 -168
  108. /package/dist/{chunk-CKVFGRVV.js.LEGAL.txt → chunk-3VZR3ZUY.js.LEGAL.txt} +0 -0
  109. /package/dist/{chunk-TW6FURZ7.js.LEGAL.txt → chunk-PST63OUS.js.LEGAL.txt} +0 -0
@@ -3,40 +3,17 @@ const require = __nerveCreateRequire(import.meta.url);
3
3
  import {
4
4
  AssistantMessageEventStream,
5
5
  formatThrownValue
6
- } from "./chunk-MN7PZ2PH.js";
6
+ } from "./chunk-TSV3PFU2.js";
7
7
  import {
8
8
  getOpenCodeSessionHeaders,
9
9
  mergeClientIdentity
10
- } from "./chunk-24GQ74HM.js";
11
-
12
- // node_modules/.pnpm/@earendil-works+pi-ai@1.4.0_@aws-sdk+credential-provider-node@3.972.83_@smithy+signatur_c4dd529f1cf5cdf12d9a6e2070ccac62/node_modules/@earendil-works/pi-ai/dist/utils/text.js
13
- function contentText(content, separator = "\n") {
14
- if (typeof content === "string")
15
- return content;
16
- return content.filter((block) => block.type === "text").map((block) => block.text).join(separator);
17
- }
18
- function getSystemMessageText(message) {
19
- const parts = [contentText(message.content)];
20
- for (const text of Object.values(message.sections ?? {})) {
21
- if (text !== null)
22
- parts.push(text);
23
- }
24
- return parts.filter((part) => part.length > 0).join("\n\n");
25
- }
26
- function renderSystemMessageUpdate(message) {
27
- const parts = [];
28
- const text = contentText(message.content);
29
- if (text.length > 0)
30
- parts.push(text);
31
- for (const [name, value] of Object.entries(message.sections ?? {})) {
32
- parts.push(value === null ? `Removed system prompt section "${name}".` : `Updated system prompt section "${name}":
33
-
34
- ${value}`);
35
- }
36
- return parts.join("\n\n");
37
- }
10
+ } from "./chunk-UDC7NPQJ.js";
11
+ import {
12
+ contentText,
13
+ ownedSlice
14
+ } from "./chunk-XY53EFK3.js";
38
15
 
39
- // node_modules/.pnpm/@earendil-works+pi-ai@1.4.0_@aws-sdk+credential-provider-node@3.972.83_@smithy+signatur_c4dd529f1cf5cdf12d9a6e2070ccac62/node_modules/@earendil-works/pi-ai/dist/utils/transcript.js
16
+ // 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/transcript.js
40
17
  function createInitialSystemMessage(systemPrompt, tools) {
41
18
  const hasSystemPrompt = systemPrompt !== void 0 && systemPrompt.length > 0;
42
19
  const hasTools = tools !== void 0 && tools.length > 0;
@@ -149,8 +126,8 @@ function resolveTranscriptTools(messages, support) {
149
126
  return { requestTools: getCurrentTools(systemMessages.slice(0, folded)), foldedSystemMessages: folded };
150
127
  }
151
128
 
152
- // node_modules/.pnpm/@earendil-works+pi-ai@1.4.0_@aws-sdk+credential-provider-node@3.972.83_@smithy+signatur_c4dd529f1cf5cdf12d9a6e2070ccac62/node_modules/@earendil-works/pi-ai/dist/api/lazy.js
153
- function createSetupErrorMessage(model2, error, timestamp) {
129
+ // 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/lazy.js
130
+ function createSetupErrorMessage(model2, error, timestamp, stopReason) {
154
131
  return {
155
132
  role: "assistant",
156
133
  content: [],
@@ -165,7 +142,7 @@ function createSetupErrorMessage(model2, error, timestamp) {
165
142
  totalTokens: 0,
166
143
  cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 }
167
144
  },
168
- stopReason: "error",
145
+ stopReason,
169
146
  errorMessage: error instanceof Error ? error.message : String(error),
170
147
  timestamp
171
148
  };
@@ -188,7 +165,7 @@ async function forwardStream(target, source, observer, observeResult) {
188
165
  target.end(result);
189
166
  observeResult(result);
190
167
  }
191
- function lazyStream(model2, setup, observer) {
168
+ function lazyStream(model2, setup, observer, signal) {
192
169
  const startedAt = Date.now();
193
170
  const outer = new AssistantMessageEventStream();
194
171
  let observedResult = false;
@@ -199,8 +176,9 @@ function lazyStream(model2, setup, observer) {
199
176
  observer?.onResult?.(result);
200
177
  };
201
178
  setup().then((inner) => forwardStream(outer, inner, observer, observeResult)).catch((error) => {
202
- const message = createSetupErrorMessage(model2, error, startedAt);
203
- const event = { type: "error", reason: "error", error: message };
179
+ const reason = signal?.aborted ? "aborted" : "error";
180
+ const message = createSetupErrorMessage(model2, error, startedAt, reason);
181
+ const event = { type: "error", reason, error: message };
204
182
  outer.push(event);
205
183
  observer?.onEvent?.(event);
206
184
  outer.end(message);
@@ -210,8 +188,8 @@ function lazyStream(model2, setup, observer) {
210
188
  }
211
189
  function lazyApi(load, capabilities) {
212
190
  const api = {
213
- stream: (model2, context, options) => lazyStream(model2, async () => (await load()).stream(model2, context, options)),
214
- streamSimple: (model2, context, options) => lazyStream(model2, async () => (await load()).streamSimple(model2, context, options))
191
+ stream: (model2, context, options) => lazyStream(model2, async () => (await load()).stream(model2, context, options), void 0, options?.signal),
192
+ streamSimple: (model2, context, options) => lazyStream(model2, async () => (await load()).streamSimple(model2, context, options), void 0, options?.signal)
215
193
  };
216
194
  if (capabilities?.fetchDeferred) {
217
195
  api.fetchDeferred = (model2, handle, options) => lazyStream(model2, async () => {
@@ -219,7 +197,7 @@ function lazyApi(load, capabilities) {
219
197
  if (!implementation.fetchDeferred)
220
198
  throw new Error("API does not support deferred responses");
221
199
  return implementation.fetchDeferred(model2, handle, options);
222
- });
200
+ }, void 0, options?.signal);
223
201
  }
224
202
  if (capabilities?.cancelDeferred) {
225
203
  api.cancelDeferred = async (model2, handle, options) => {
@@ -232,7 +210,7 @@ function lazyApi(load, capabilities) {
232
210
  return api;
233
211
  }
234
212
 
235
- // node_modules/.pnpm/@earendil-works+pi-ai@1.4.0_@aws-sdk+credential-provider-node@3.972.83_@smithy+signatur_c4dd529f1cf5cdf12d9a6e2070ccac62/node_modules/@earendil-works/pi-ai/dist/auth/context.js
213
+ // 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/auth/context.js
236
214
  var __rewriteRelativeImportExtension = function(path, preserveJsx) {
237
215
  if (typeof path === "string" && /^\.\.?\//.test(path)) {
238
216
  return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function(m, tsx, d, ext, cm) {
@@ -269,7 +247,7 @@ function defaultProviderAuthContext() {
269
247
  };
270
248
  }
271
249
 
272
- // node_modules/.pnpm/@earendil-works+pi-ai@1.4.0_@aws-sdk+credential-provider-node@3.972.83_@smithy+signatur_c4dd529f1cf5cdf12d9a6e2070ccac62/node_modules/@earendil-works/pi-ai/dist/utils/abort.js
250
+ // 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/abort.js
273
251
  function abortReason(signal) {
274
252
  if (signal.reason !== void 0)
275
253
  return signal.reason;
@@ -315,7 +293,7 @@ function raceWithAbortSignal(operation, signal) {
315
293
  });
316
294
  }
317
295
 
318
- // node_modules/.pnpm/@earendil-works+pi-ai@1.4.0_@aws-sdk+credential-provider-node@3.972.83_@smithy+signatur_c4dd529f1cf5cdf12d9a6e2070ccac62/node_modules/@earendil-works/pi-ai/dist/auth/credential-store.js
296
+ // 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/auth/credential-store.js
319
297
  var InMemoryCredentialStore = class {
320
298
  credentials = /* @__PURE__ */ new Map();
321
299
  chains = /* @__PURE__ */ new Map();
@@ -363,7 +341,7 @@ var InMemoryCredentialStore = class {
363
341
  }
364
342
  };
365
343
 
366
- // node_modules/.pnpm/@earendil-works+pi-ai@1.4.0_@aws-sdk+credential-provider-node@3.972.83_@smithy+signatur_c4dd529f1cf5cdf12d9a6e2070ccac62/node_modules/@earendil-works/pi-ai/dist/utils/models-error.js
344
+ // 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/models-error.js
367
345
  var ModelsError = class extends Error {
368
346
  code;
369
347
  constructor(code, message, options) {
@@ -381,7 +359,7 @@ function withCauseDetail(message, cause) {
381
359
  return `${message}: ${detail}`;
382
360
  }
383
361
 
384
- // node_modules/.pnpm/@earendil-works+pi-ai@1.4.0_@aws-sdk+credential-provider-node@3.972.83_@smithy+signatur_c4dd529f1cf5cdf12d9a6e2070ccac62/node_modules/@earendil-works/pi-ai/dist/auth/resolve.js
362
+ // 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/auth/resolve.js
385
363
  function resolveProviderAuth(provider2, credentials, authContext, overrides) {
386
364
  const signal = operationSignal(overrides?.signal);
387
365
  return raceWithAbortSignal(resolveProviderAuthWithSignal(provider2, credentials, authContext, overrides, signal), signal);
@@ -482,7 +460,7 @@ async function readCredential(credentials, providerId, signal) {
482
460
  }
483
461
  }
484
462
 
485
- // node_modules/.pnpm/@earendil-works+pi-ai@1.4.0_@aws-sdk+credential-provider-node@3.972.83_@smithy+signatur_c4dd529f1cf5cdf12d9a6e2070ccac62/node_modules/@earendil-works/pi-ai/dist/models-store.js
463
+ // 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/models-store.js
486
464
  var InMemoryModelsStore = class {
487
465
  entries = /* @__PURE__ */ new Map();
488
466
  async read(providerId, options) {
@@ -500,7 +478,7 @@ var InMemoryModelsStore = class {
500
478
  }
501
479
  };
502
480
 
503
- // node_modules/.pnpm/@earendil-works+pi-telemetry@1.4.0/node_modules/@earendil-works/pi-telemetry/dist/metrics.js
481
+ // node_modules/.pnpm/@earendil-works+pi-telemetry@1.5.1/node_modules/@earendil-works/pi-telemetry/dist/metrics.js
504
482
  function createTypedMetrics(metrics, schemas) {
505
483
  const definitions = /* @__PURE__ */ new Map();
506
484
  for (const schema of schemas) {
@@ -514,7 +492,7 @@ function createTypedMetrics(metrics, schemas) {
514
492
  };
515
493
  }
516
494
 
517
- // node_modules/.pnpm/@earendil-works+pi-telemetry@1.4.0/node_modules/@earendil-works/pi-telemetry/dist/noop.js
495
+ // node_modules/.pnpm/@earendil-works+pi-telemetry@1.5.1/node_modules/@earendil-works/pi-telemetry/dist/noop.js
518
496
  async function startNoopSpan(_options, callback) {
519
497
  return callback(noopTelemetrySpan);
520
498
  }
@@ -549,7 +527,10 @@ var noopTelemetrySpan = {
549
527
  Object.freeze(noopTelemetrySpan);
550
528
  var NOOP_TELEMETRY_CONTEXT = noopTelemetrySpan;
551
529
 
552
- // node_modules/.pnpm/@earendil-works+pi-telemetry@1.4.0/node_modules/@earendil-works/pi-telemetry/dist/index.js
530
+ // node_modules/.pnpm/@earendil-works+pi-telemetry@1.5.1/node_modules/@earendil-works/pi-telemetry/dist/memory.js
531
+ var anchor = performance.timeOrigin;
532
+
533
+ // node_modules/.pnpm/@earendil-works+pi-telemetry@1.5.1/node_modules/@earendil-works/pi-telemetry/dist/index.js
553
534
  function defineTelemetrySchema(schema) {
554
535
  return schema;
555
536
  }
@@ -561,7 +542,7 @@ function createTypedSpanStarter(telemetryContext, _schemas) {
561
542
  return bindTypedSpanStarter(telemetryContext);
562
543
  }
563
544
 
564
- // node_modules/.pnpm/@earendil-works+pi-ai@1.4.0_@aws-sdk+credential-provider-node@3.972.83_@smithy+signatur_c4dd529f1cf5cdf12d9a6e2070ccac62/node_modules/@earendil-works/pi-ai/dist/telemetry.js
545
+ // 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/telemetry.js
565
546
  var provider = { type: "string", description: "Provider identifier.", required: true };
566
547
  var model = { type: "string", description: "Requested model identifier.", required: true };
567
548
  var stop = {
@@ -732,7 +713,7 @@ function observeModelRequest(requestedModel, options, poll) {
732
713
  if (message.stopReason === "error") {
733
714
  span.setStatus({
734
715
  status: "error",
735
- error: { name: "provider_error", message: message.errorMessage?.slice(0, 500) ?? "" }
716
+ error: { name: "provider_error", message: ownedSlice(message.errorMessage ?? "", 0, 500) }
736
717
  });
737
718
  }
738
719
  requestDuration.record(performance.now() - started, { ...attributes, stop: message.stopReason }, span);
@@ -749,7 +730,7 @@ function observeModelRequest(requestedModel, options, poll) {
749
730
  };
750
731
  }
751
732
 
752
- // node_modules/.pnpm/@earendil-works+pi-ai@1.4.0_@aws-sdk+credential-provider-node@3.972.83_@smithy+signatur_c4dd529f1cf5cdf12d9a6e2070ccac62/node_modules/@earendil-works/pi-ai/dist/utils/model-operations.js
733
+ // 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/model-operations.js
753
734
  function getModelType(model2) {
754
735
  return model2.type ?? "chat";
755
736
  }
@@ -799,7 +780,7 @@ function classifierErrorResult(model2, error, aborted = false) {
799
780
  };
800
781
  }
801
782
 
802
- // node_modules/.pnpm/@earendil-works+pi-ai@1.4.0_@aws-sdk+credential-provider-node@3.972.83_@smithy+signatur_c4dd529f1cf5cdf12d9a6e2070ccac62/node_modules/@earendil-works/pi-ai/dist/models.js
783
+ // 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/models.js
803
784
  var KNOWN_MODEL_TYPES = { chat: true, image: true, classifier: true };
804
785
  function hasKnownModelType(model2) {
805
786
  return Object.hasOwn(KNOWN_MODEL_TYPES, getModelType(model2));
@@ -983,10 +964,10 @@ var ModelsImpl = class {
983
964
  throw credentialError;
984
965
  if (!allowNetwork || signal.aborted)
985
966
  return;
986
- const credential = await this.resolveRefreshCredential(provider2, storedCredential, signal);
987
- if (!credential)
967
+ const network = await this.resolveNetworkRefresh(provider2, storedCredential, signal);
968
+ if (!network)
988
969
  return;
989
- await this.runProviderRefreshPhase(provider2, credential, true, options.force, generation, signal);
970
+ await this.runProviderRefreshPhase(provider2, network.credential, true, options.force, generation, signal);
990
971
  })();
991
972
  try {
992
973
  await raceWithAbortSignal(operation, signal);
@@ -1008,6 +989,14 @@ var ModelsImpl = class {
1008
989
  }
1009
990
  return { aborted: callerSignal.aborted, errors: new Map(errors) };
1010
991
  }
992
+ /** The credential for the network refresh phase, or undefined when the provider is not configured. */
993
+ async resolveNetworkRefresh(provider2, stored, signal) {
994
+ if (provider2.refreshModelsAuth === "configured") {
995
+ return await this.checkProviderAuth(provider2, stored, signal) ? {} : void 0;
996
+ }
997
+ const credential = await this.resolveRefreshCredential(provider2, stored, signal);
998
+ return credential ? { credential } : void 0;
999
+ }
1011
1000
  async resolveRefreshCredential(provider2, stored, signal) {
1012
1001
  if (stored?.type === "oauth") {
1013
1002
  const oauth = provider2.auth.oauth;
@@ -1227,7 +1216,7 @@ var ModelsImpl = class {
1227
1216
  const provider2 = this.requireChatProvider(model2);
1228
1217
  const { requestModel, requestOptions } = await this.applyAuth(model2, options);
1229
1218
  return provider2.stream(requestModel, transcript, requestOptions);
1230
- }, observeModelRequest(model2, options, false));
1219
+ }, observeModelRequest(model2, options, false), options?.signal);
1231
1220
  }
1232
1221
  async complete(model2, context, options) {
1233
1222
  return this.stream(model2, context, options).result();
@@ -1238,7 +1227,7 @@ var ModelsImpl = class {
1238
1227
  const provider2 = this.requireChatProvider(model2);
1239
1228
  const { requestModel, requestOptions } = await this.applyAuth(model2, options);
1240
1229
  return provider2.streamSimple(requestModel, transcript, requestOptions);
1241
- }, observeModelRequest(model2, options, false));
1230
+ }, observeModelRequest(model2, options, false), options?.signal);
1242
1231
  }
1243
1232
  async completeSimple(model2, context, options) {
1244
1233
  return this.streamSimple(model2, context, options).result();
@@ -1251,7 +1240,7 @@ var ModelsImpl = class {
1251
1240
  }
1252
1241
  const { requestModel, requestOptions } = await this.applyAuth(model2, options);
1253
1242
  return provider2.fetchDeferred(requestModel, handle, requestOptions);
1254
- }, observeModelRequest(model2, options, true));
1243
+ }, observeModelRequest(model2, options, true), options?.signal);
1255
1244
  }
1256
1245
  async fetchDeferred(model2, handle, options) {
1257
1246
  return this.streamDeferred(model2, handle, options).result();
@@ -1321,12 +1310,12 @@ function createProvider(input) {
1321
1310
  return merged;
1322
1311
  };
1323
1312
  const apiFor = (model2) => single ?? byApi?.[model2.api];
1324
- const dispatch = (model2, run) => {
1313
+ const dispatch = (model2, run, signal) => {
1325
1314
  const streams2 = apiFor(model2);
1326
1315
  if (!streams2) {
1327
1316
  return lazyStream(model2, async () => {
1328
1317
  throw new ModelsError("stream", `Provider ${input.id} has no API implementation for "${model2.api}"`);
1329
- });
1318
+ }, void 0, signal);
1330
1319
  }
1331
1320
  return run(streams2);
1332
1321
  };
@@ -1364,8 +1353,8 @@ function createProvider(input) {
1364
1353
  } : void 0,
1365
1354
  filterModels: input.filterModels,
1366
1355
  filterAllModels: input.filterAllModels,
1367
- stream: (model2, context, options) => dispatch(model2, (streams2) => streams2.stream(model2, context, options)),
1368
- streamSimple: (model2, context, options) => dispatch(model2, (streams2) => streams2.streamSimple(model2, context, options))
1356
+ stream: (model2, context, options) => dispatch(model2, (streams2) => streams2.stream(model2, context, options), options?.signal),
1357
+ streamSimple: (model2, context, options) => dispatch(model2, (streams2) => streams2.streamSimple(model2, context, options), options?.signal)
1369
1358
  };
1370
1359
  if (streams.some((entry) => entry.fetchDeferred !== void 0)) {
1371
1360
  provider2.fetchDeferred = (model2, handle, options) => lazyStream(model2, async () => {
@@ -1374,7 +1363,7 @@ function createProvider(input) {
1374
1363
  throw new ModelsError("provider", `Provider ${input.id} does not support deferred responses for "${model2.api}"`);
1375
1364
  }
1376
1365
  return implementation.fetchDeferred(model2, handle, options);
1377
- });
1366
+ }, void 0, options?.signal);
1378
1367
  }
1379
1368
  if (streams.some((entry) => entry.cancelDeferred !== void 0)) {
1380
1369
  provider2.cancelDeferred = async (model2, handle, options) => {
@@ -1422,6 +1411,7 @@ function calculateCost(model2, usage) {
1422
1411
  usage.cost.cacheRead = rates.cacheRead / 1e6 * usage.cacheRead;
1423
1412
  usage.cost.cacheWrite = (rates.cacheWrite * shortWrite + rates.input * 2 * longWrite) / 1e6;
1424
1413
  usage.cost.total = usage.cost.input + usage.cost.output + usage.cost.cacheRead + usage.cost.cacheWrite;
1414
+ usage.cost.totalFromProvider = false;
1425
1415
  return usage.cost;
1426
1416
  }
1427
1417
  var EXTENDED_THINKING_LEVELS = ["off", "minimal", "low", "medium", "high", "xhigh", "max"];
@@ -1461,8 +1451,6 @@ export {
1461
1451
  lazyStream,
1462
1452
  lazyApi,
1463
1453
  isModelType,
1464
- getSystemMessageText,
1465
- renderSystemMessageUpdate,
1466
1454
  normalizeContext,
1467
1455
  getInitialSystemMessage,
1468
1456
  withoutInitialSystemMessage,
@@ -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.0_@aws-sdk+credential-provider-node@3.972.83_@smithy+signatur_c4dd529f1cf5cdf12d9a6e2070ccac62/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.js
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/event-stream.js
5
5
  var FifoQueue = class {
6
6
  incoming = [];
7
7
  outgoing = [];
@@ -112,7 +112,7 @@ function createAssistantMessageEventStream() {
112
112
  return new AssistantMessageEventStream();
113
113
  }
114
114
 
115
- // node_modules/.pnpm/@earendil-works+pi-ai@1.4.0_@aws-sdk+credential-provider-node@3.972.83_@smithy+signatur_c4dd529f1cf5cdf12d9a6e2070ccac62/node_modules/@earendil-works/pi-ai/dist/utils/diagnostics.js
115
+ // 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/diagnostics.js
116
116
  function formatThrownValue(value) {
117
117
  if (value instanceof Error)
118
118
  return value.message || value.name;
@@ -1,10 +1,10 @@
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.0_@aws-sdk+credential-provider-node@3.972.83_@smithy+signatur_c4dd529f1cf5cdf12d9a6e2070ccac62/node_modules/@earendil-works/pi-ai/dist/utils/version.js
5
- var PI_AI_VERSION = "1.4.0";
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/version.js
5
+ var PI_AI_VERSION = "1.5.1";
6
6
 
7
- // node_modules/.pnpm/@earendil-works+pi-ai@1.4.0_@aws-sdk+credential-provider-node@3.972.83_@smithy+signatur_c4dd529f1cf5cdf12d9a6e2070ccac62/node_modules/@earendil-works/pi-ai/dist/utils/identity.js
7
+ // 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/identity.js
8
8
  var NVIDIA_NIM_HOST = "integrate.api.nvidia.com";
9
9
  var OPENCODE_HOST = "opencode.ai";
10
10
  function mergeClientIdentity(...sources) {
@@ -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.0_@aws-sdk+credential-provider-node@3.972.83_@smithy+signatur_c4dd529f1cf5cdf12d9a6e2070ccac62/node_modules/@earendil-works/pi-ai/dist/utils/headers.js
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/headers.js
5
5
  function headersToRecord(headers) {
6
6
  const result = {};
7
7
  for (const [key, value] of headers.entries()) {