@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.
Files changed (114) hide show
  1. package/THIRD-PARTY-LICENSES.txt +5087 -485
  2. package/dist/{chunk-KSZJ3HGD.js → chunk-2BKMOJYJ.js} +1 -1
  3. package/dist/{chunk-5UT23MT6.js → chunk-3JJN36GV.js} +70 -71
  4. package/dist/{chunk-2Z5FLMLE.js → chunk-3SSNDIQT.js} +1 -1
  5. package/dist/{chunk-PUM6UCBT.js → chunk-3VZR3ZUY.js} +55 -8
  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-BPOIFVQO.js → chunk-6FSDDGFZ.js} +731 -605
  10. package/dist/chunk-6PACEIUY.js +183 -0
  11. package/dist/{chunk-XNYZEQ3U.js → chunk-6TAN6WG6.js} +1 -1
  12. package/dist/{chunk-RWLLVZ7I.js → chunk-7FLZA2BD.js} +31 -15
  13. package/dist/{chunk-WTHP3VH6.js → chunk-7JQBECUL.js} +1 -1
  14. package/dist/{chunk-5Y3NEEOK.js → chunk-AAEIGAGD.js} +9 -9
  15. package/dist/{chunk-UN3GLM4U.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-U4DBQKHO.js → chunk-E4JNHQGT.js} +11 -9
  21. package/dist/chunk-EJM4HMEL.js +45 -0
  22. package/dist/chunk-ER2ES2RH.js +64 -0
  23. package/dist/{chunk-SQ7CWNIT.js → chunk-EX63VKXY.js} +1 -1
  24. package/dist/{chunk-JDI4D5EM.js → chunk-F3MHINI6.js} +19 -23
  25. package/dist/chunk-FGZX4Q7W.js +22828 -0
  26. package/dist/{chunk-LPCHTKEK.js → chunk-FZ5N6WXF.js} +31 -160
  27. package/dist/chunk-H2G55ZPG.js +783 -0
  28. package/dist/chunk-HDBDYGJQ.js +40 -0
  29. package/dist/{chunk-RU6S57LK.js → chunk-HOCODVKL.js} +22 -24
  30. package/dist/chunk-JCF3ZRP4.js +481 -0
  31. package/dist/chunk-K2J2VZXO.js +142 -0
  32. package/dist/chunk-KBNEZR7T.js +135 -0
  33. package/dist/chunk-KSSM6LUI.js +340 -0
  34. package/dist/{chunk-HHUSIAK3.js → chunk-KTGSBL6T.js} +14 -17
  35. package/dist/chunk-L2DHKP5C.js +42 -0
  36. package/dist/{chunk-DBXMYYPJ.js → chunk-M3ELKCNA.js} +1 -1
  37. package/dist/chunk-M7WTH5K5.js +822 -0
  38. package/dist/{chunk-LZRPWVVJ.js → chunk-MWIKZIAI.js} +9 -8
  39. package/dist/{chunk-AON37AL2.js → chunk-O2652RWY.js} +29 -4
  40. package/dist/chunk-O6U226AI.js +249 -0
  41. package/dist/{chunk-5R3UAHXF.js → chunk-OAEV22IW.js} +48 -26
  42. package/dist/chunk-OANTMDXI.js +29 -0
  43. package/dist/{chunk-UGDIHDAR.js → chunk-ODS5QROC.js} +1 -1
  44. package/dist/{chunk-Q7LPOIKN.js → chunk-OQC3F6JA.js} +3 -471
  45. package/dist/{chunk-YA2WJRUO.js → chunk-PST63OUS.js} +5 -5
  46. package/dist/{chunk-S2PITDVA.js → chunk-QBAIDKF6.js} +1 -1
  47. package/dist/chunk-RPLBWENJ.js +224 -0
  48. package/dist/{chunk-GCSWN326.js → chunk-S62LLS4I.js} +33 -55
  49. package/dist/chunk-SHEU5KLD.js +32 -0
  50. package/dist/{chunk-FESN7DND.js → chunk-SU2USXTD.js} +1 -1
  51. package/dist/chunk-T6NRMNLQ.js +22 -0
  52. package/dist/{chunk-NSA42OOT.js → chunk-TGKIV3F4.js} +53 -65
  53. package/dist/{chunk-MN7PZ2PH.js → chunk-TSV3PFU2.js} +2 -2
  54. package/dist/{chunk-D5WJKB4R.js → chunk-UDC7NPQJ.js} +4 -3
  55. package/dist/{chunk-CEX2GWGZ.js → chunk-VBM7TD3X.js} +1 -1
  56. package/dist/chunk-VC6TX2Y2.js +359 -0
  57. package/dist/{chunk-7FI3LC3O.js → chunk-VTDI5KP7.js} +241 -104
  58. package/dist/{chunk-P2GSKP6N.js → chunk-WIN7KHMV.js} +15 -18
  59. package/dist/chunk-WJULIJOU.js +168 -0
  60. package/dist/{chunk-HKLAYK2Z.js → chunk-WRTA5G57.js} +23 -0
  61. package/dist/{chunk-4ZNLXHTH.js → chunk-WYPVD3HW.js} +10 -9
  62. package/dist/{chunk-V7EAFXAX.js → chunk-XE2E2KBP.js} +10 -9
  63. package/dist/chunk-XY53EFK3.js +39 -0
  64. package/dist/chunk-XZYFB566.js +153 -0
  65. package/dist/{chunk-H4CDZRIE.js → chunk-YJT4NXMV.js} +5 -5
  66. package/dist/{chunk-ET5RYBGZ.js → chunk-YQFENES6.js} +3 -3
  67. package/dist/chunk-YUO5V75X.js +128 -0
  68. package/dist/chunk-YYLKI74V.js +8778 -0
  69. package/dist/daemon.js +15 -10
  70. package/dist/git-isolated-reader-helper.js +1 -1
  71. package/dist/main.js +14 -9
  72. package/dist/web/assets/{AsyncBashCenterHost-HGsdxUJ3.js → AsyncBashCenterHost-BvXKoCVr.js} +1 -1
  73. package/dist/web/assets/{ConversationsWorkbenchPanel-B6dzWkG1.js → ConversationsWorkbenchPanel-CIfK_e3I.js} +1 -1
  74. package/dist/web/assets/{DiscoverCenterHost-B186WBRA.js → DiscoverCenterHost-Ep8EN9iJ.js} +1 -1
  75. package/dist/web/assets/{FileCenterHost-DigJOU5M.js → FileCenterHost-C_7XZAFZ.js} +1 -1
  76. package/dist/web/assets/{FilesWorkbenchPanel-VPvx3Bmi.js → FilesWorkbenchPanel-CtXo7ywG.js} +1 -1
  77. package/dist/web/assets/{GitDiffCenterHost-IuZfF3hG.js → GitDiffCenterHost-Cr7lqGI_.js} +1 -1
  78. package/dist/web/assets/{GitWorkbenchPanel-CScC0CfH.js → GitWorkbenchPanel-BFbwUgIN.js} +1 -1
  79. package/dist/web/assets/{LaunchConfigurationNotice-5yb4cH27.js → LaunchConfigurationNotice-CJjWkMhv.js} +1 -1
  80. package/dist/web/assets/{LaunchesWorkbenchPanel-Vy0Gm7gg.js → LaunchesWorkbenchPanel-BqzJvsrj.js} +1 -1
  81. package/dist/web/assets/{LogsCenterHost-BXBozCYw.js → LogsCenterHost-BI1fSxFW.js} +1 -1
  82. package/dist/web/assets/{MermaidCenterHost-DDh4ArdK.js → MermaidCenterHost-DVsZB8nB.js} +1 -1
  83. package/dist/web/assets/{MobileFilesBody-Cda_7gDp.js → MobileFilesBody-BJMoaP9I.js} +1 -1
  84. package/dist/web/assets/{MobileFilesHost-C1jev2Un.js → MobileFilesHost-D843vkDF.js} +1 -1
  85. package/dist/web/assets/{MobileLaunchOutputHost-Bsv12o2H.js → MobileLaunchOutputHost-vpltMcar.js} +1 -1
  86. package/dist/web/assets/{MobileLaunchesHost-C9VH-2bn.js → MobileLaunchesHost-CdDrKASg.js} +1 -1
  87. package/dist/web/assets/{MobileLogsHost-BMDXc-WC.js → MobileLogsHost-qK7N-C1y.js} +1 -1
  88. package/dist/web/assets/{MobileNoteEditorHost-BA6WIY1Y.js → MobileNoteEditorHost-Bg1N8o54.js} +1 -1
  89. package/dist/web/assets/{MobileNotesHost-BZeYpK9H.js → MobileNotesHost-meLV39Yw.js} +1 -1
  90. package/dist/web/assets/{MobileProjectSettingsHost-U3Mx3EN8.js → MobileProjectSettingsHost-A49Fdn54.js} +1 -1
  91. package/dist/web/assets/{MobileProjectSettingsPageHost-CMvxbjfs.js → MobileProjectSettingsPageHost-BXpUqS_N.js} +1 -1
  92. package/dist/web/assets/{MobileSettingsHost-CP8Z_-gH.js → MobileSettingsHost-DPKPajzI.js} +1 -1
  93. package/dist/web/assets/{MobileSettingsPageHost-BPjXKTMV.js → MobileSettingsPageHost-izNWGN0i.js} +1 -1
  94. package/dist/web/assets/{MobileSettingsPageScreen-C5rHdrUU.js → MobileSettingsPageScreen-DWMg4fDo.js} +1 -1
  95. package/dist/web/assets/{ProjectSettingsCenterHost-BVXpBixy.js → ProjectSettingsCenterHost-DHeb274m.js} +1 -1
  96. package/dist/web/assets/{PullRequestCenterHost-CZhXfCX2.js → PullRequestCenterHost-BYkWxXQe.js} +1 -1
  97. package/dist/web/assets/{PullRequestsWorkbenchPanel-BBnZJVnI.js → PullRequestsWorkbenchPanel-ZvGbi1Cr.js} +1 -1
  98. package/dist/web/assets/{SearchWorkbenchPanel-qLgszneN.js → SearchWorkbenchPanel-DaC0smfe.js} +1 -1
  99. package/dist/web/assets/{SettingsCenter-7BfrBfiy.js → SettingsCenter-C_NLBsi6.js} +1 -1
  100. package/dist/web/assets/{SettingsCenterHost-Ck5uHILP.js → SettingsCenterHost-jP8MULEj.js} +1 -1
  101. package/dist/web/assets/{SystemPromptCenterHost-ya5AvXsd.js → SystemPromptCenterHost-B1hfsfAn.js} +1 -1
  102. package/dist/web/assets/{discover-B3I5g1_G.js → discover-B-aZ504j.js} +1 -1
  103. package/dist/web/assets/{index-FJEmK_L5.js → index-TZ1KAAsX.js} +34 -34
  104. package/dist/web/assets/{settings-page-controllers.svelte-CU0i08wo.js → settings-page-controllers.svelte-D_ydJF8u.js} +1 -1
  105. package/dist/web/assets/{shell-layout.svelte-BT2508sa.js → shell-layout.svelte-OoLFwzzJ.js} +2 -2
  106. package/dist/web/assets/{views-Z-n-GTYY.js → views-ByPCKDiZ.js} +1 -1
  107. package/dist/web/index.html +3 -3
  108. package/dist/web/sw.js +1 -1
  109. package/dist/worker.js +14 -9
  110. package/package.json +8 -9
  111. package/dist/chunk-RUZ2UAYH.js +0 -365
  112. package/dist/resize-worker.js +0 -168
  113. /package/dist/{chunk-PUM6UCBT.js.LEGAL.txt → chunk-3VZR3ZUY.js.LEGAL.txt} +0 -0
  114. /package/dist/{chunk-YA2WJRUO.js.LEGAL.txt → chunk-PST63OUS.js.LEGAL.txt} +0 -0
@@ -0,0 +1,224 @@
1
+ import { createRequire as __nerveCreateRequire } from "node:module";
2
+ const require = __nerveCreateRequire(import.meta.url);
3
+ import {
4
+ sleep
5
+ } from "./chunk-T6NRMNLQ.js";
6
+ import {
7
+ trustedHttpUrl
8
+ } from "./chunk-B4IE2GAM.js";
9
+ import {
10
+ pollOAuthDeviceCodeFlow
11
+ } from "./chunk-ER2ES2RH.js";
12
+ import {
13
+ getProviderEnvValue
14
+ } from "./chunk-SU2USXTD.js";
15
+ import "./chunk-CWESUMYQ.js";
16
+
17
+ // 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/oauth/kimi-coding.js
18
+ var CLIENT_ID = "17e5f671-d194-4dfb-9706-5516cb48c098";
19
+ var DEFAULT_OAUTH_HOST = "https://auth.kimi.com";
20
+ var DEVICE_CODE_TIMEOUT_SECONDS = 15 * 60;
21
+ var DEFAULT_POLL_INTERVAL_SECONDS = 5;
22
+ var REQUEST_TIMEOUT_MS = 30 * 1e3;
23
+ var REFRESH_MAX_RETRIES = 3;
24
+ function getOauthHost() {
25
+ const override = getProviderEnvValue("KIMI_CODE_OAUTH_HOST") || getProviderEnvValue("KIMI_OAUTH_HOST");
26
+ return (override || DEFAULT_OAUTH_HOST).replace(/\/+$/, "");
27
+ }
28
+ function requestSignal(signal) {
29
+ return AbortSignal.any([AbortSignal.timeout(REQUEST_TIMEOUT_MS), signal]);
30
+ }
31
+ function formUrlEncode(fields) {
32
+ return new URLSearchParams(fields).toString();
33
+ }
34
+ async function readJson(response) {
35
+ try {
36
+ const json = await response.json();
37
+ return json && typeof json === "object" ? json : null;
38
+ } catch {
39
+ return null;
40
+ }
41
+ }
42
+ async function startDeviceAuthorization(oauthHost, signal) {
43
+ const response = await fetch(`${oauthHost}/api/oauth/device_authorization`, {
44
+ method: "POST",
45
+ headers: {
46
+ "Content-Type": "application/x-www-form-urlencoded",
47
+ Accept: "application/json"
48
+ },
49
+ body: formUrlEncode({ client_id: CLIENT_ID }),
50
+ signal: requestSignal(signal)
51
+ });
52
+ if (!response.ok) {
53
+ const text = await response.text().catch(() => "");
54
+ throw new Error(`Kimi Code device authorization failed with status ${response.status}${text ? `: ${text}` : ""}`);
55
+ }
56
+ const json = await readJson(response);
57
+ const deviceCode = json?.device_code;
58
+ const userCode = json?.user_code;
59
+ const verificationUri = trustedHttpUrl(json?.verification_uri);
60
+ const verificationUriComplete = trustedHttpUrl(json?.verification_uri_complete);
61
+ if (typeof deviceCode !== "string" || typeof userCode !== "string" || !verificationUri || !verificationUriComplete) {
62
+ throw new Error(`Invalid Kimi Code device authorization response: ${JSON.stringify(json)}`);
63
+ }
64
+ const interval = json?.interval;
65
+ const expiresIn = json?.expires_in;
66
+ return {
67
+ deviceCode,
68
+ userCode,
69
+ verificationUri,
70
+ verificationUriComplete,
71
+ intervalSeconds: typeof interval === "number" && Number.isFinite(interval) && interval > 0 ? interval : DEFAULT_POLL_INTERVAL_SECONDS,
72
+ expiresInSeconds: typeof expiresIn === "number" && Number.isFinite(expiresIn) && expiresIn > 0 ? expiresIn : DEVICE_CODE_TIMEOUT_SECONDS
73
+ };
74
+ }
75
+ function parseTokenResponse(json, operation) {
76
+ const accessToken = json?.access_token;
77
+ const refreshToken2 = json?.refresh_token;
78
+ const expiresIn = json?.expires_in;
79
+ if (typeof accessToken !== "string" || !accessToken || typeof refreshToken2 !== "string" || !refreshToken2 || typeof expiresIn !== "number" || !Number.isFinite(expiresIn) || expiresIn <= 0) {
80
+ throw new Error(`Kimi Code token ${operation} response missing fields: ${JSON.stringify(json)}`);
81
+ }
82
+ return {
83
+ access: accessToken,
84
+ refresh: refreshToken2,
85
+ expires: Date.now() + expiresIn * 1e3
86
+ };
87
+ }
88
+ async function pollForToken(oauthHost, device, signal) {
89
+ return pollOAuthDeviceCodeFlow({
90
+ intervalSeconds: device.intervalSeconds,
91
+ expiresInSeconds: device.expiresInSeconds,
92
+ waitBeforeFirstPoll: true,
93
+ signal,
94
+ poll: async () => {
95
+ const response = await fetch(`${oauthHost}/api/oauth/token`, {
96
+ method: "POST",
97
+ headers: {
98
+ "Content-Type": "application/x-www-form-urlencoded",
99
+ Accept: "application/json"
100
+ },
101
+ body: formUrlEncode({
102
+ client_id: CLIENT_ID,
103
+ device_code: device.deviceCode,
104
+ grant_type: "urn:ietf:params:oauth:grant-type:device_code"
105
+ }),
106
+ signal: requestSignal(signal)
107
+ });
108
+ if (response.status >= 500) {
109
+ const text = await response.text().catch(() => "");
110
+ return {
111
+ status: "failed",
112
+ message: `Kimi Code device token request failed with status ${response.status}${text ? `: ${text}` : ""}`
113
+ };
114
+ }
115
+ const json = await readJson(response);
116
+ if (response.ok && typeof json?.access_token === "string") {
117
+ try {
118
+ return { status: "complete", value: parseTokenResponse(json, "poll") };
119
+ } catch (error2) {
120
+ return { status: "failed", message: error2 instanceof Error ? error2.message : String(error2) };
121
+ }
122
+ }
123
+ const error = json?.error;
124
+ const description = typeof json?.error_description === "string" ? `: ${json.error_description}` : "";
125
+ if (error === "authorization_pending") {
126
+ return { status: "pending" };
127
+ }
128
+ if (error === "slow_down") {
129
+ const interval = json?.interval;
130
+ return {
131
+ status: "slow_down",
132
+ intervalSeconds: typeof interval === "number" && interval > 0 ? interval : void 0
133
+ };
134
+ }
135
+ if (error === "expired_token") {
136
+ return { status: "failed", message: "Kimi Code device authorization expired. Please restart login." };
137
+ }
138
+ if (error === "access_denied") {
139
+ return { status: "failed", message: "Kimi Code login was denied." };
140
+ }
141
+ return {
142
+ status: "failed",
143
+ message: `Kimi Code device token request failed (status ${response.status})${typeof error === "string" ? `: ${error}${description}` : ""}`
144
+ };
145
+ }
146
+ });
147
+ }
148
+ function isRetryableRefreshFailure(response) {
149
+ return response.status === 429 || response.status >= 500;
150
+ }
151
+ async function refreshToken(oauthHost, refreshTokenValue, signal) {
152
+ let lastError;
153
+ for (let attempt = 0; attempt <= REFRESH_MAX_RETRIES; attempt++) {
154
+ if (attempt > 0) {
155
+ await sleep(1e3 * 2 ** (attempt - 1), signal);
156
+ }
157
+ if (signal.aborted) {
158
+ throw new Error("Kimi Code token refresh aborted");
159
+ }
160
+ let response;
161
+ try {
162
+ response = await fetch(`${oauthHost}/api/oauth/token`, {
163
+ method: "POST",
164
+ headers: {
165
+ "Content-Type": "application/x-www-form-urlencoded",
166
+ Accept: "application/json"
167
+ },
168
+ body: formUrlEncode({
169
+ client_id: CLIENT_ID,
170
+ grant_type: "refresh_token",
171
+ refresh_token: refreshTokenValue
172
+ }),
173
+ signal: requestSignal(signal)
174
+ });
175
+ } catch (error) {
176
+ lastError = error instanceof Error ? error : new Error(String(error));
177
+ continue;
178
+ }
179
+ const json = await readJson(response);
180
+ if (response.ok) {
181
+ return parseTokenResponse(json, "refresh");
182
+ }
183
+ if (response.status === 401 || response.status === 403 || json?.error === "invalid_grant") {
184
+ const description = typeof json?.error_description === "string" ? `: ${json.error_description}` : "";
185
+ throw new Error(`Kimi Code token refresh unauthorized (status ${response.status})${description}`);
186
+ }
187
+ if (isRetryableRefreshFailure(response) && attempt < REFRESH_MAX_RETRIES) {
188
+ lastError = new Error(`Kimi Code token refresh failed with status ${response.status}`);
189
+ continue;
190
+ }
191
+ const text = JSON.stringify(json);
192
+ throw new Error(`Kimi Code token refresh failed with status ${response.status}${text ? `: ${text}` : ""}`);
193
+ }
194
+ throw lastError ?? new Error("Kimi Code token refresh failed");
195
+ }
196
+ async function loginKimiCoding(interaction) {
197
+ const oauthHost = getOauthHost();
198
+ const device = await startDeviceAuthorization(oauthHost, interaction.signal);
199
+ interaction.notify({
200
+ type: "device_code",
201
+ userCode: device.userCode,
202
+ verificationUri: device.verificationUriComplete,
203
+ intervalSeconds: device.intervalSeconds,
204
+ expiresInSeconds: device.expiresInSeconds
205
+ });
206
+ const token = await pollForToken(oauthHost, device, interaction.signal);
207
+ return { type: "oauth", access: token.access, refresh: token.refresh, expires: token.expires };
208
+ }
209
+ var kimiCodingOAuth = {
210
+ name: "Kimi Code (subscription)",
211
+ isSubscription: true,
212
+ loginLabel: "Sign in with Kimi Code",
213
+ login: loginKimiCoding,
214
+ refresh: async (credential, signal) => {
215
+ const token = await refreshToken(getOauthHost(), credential.refresh, signal);
216
+ return { type: "oauth", access: token.access, refresh: token.refresh, expires: token.expires };
217
+ },
218
+ async toAuth(credential) {
219
+ return { headers: { Authorization: `Bearer ${credential.access}` } };
220
+ }
221
+ };
222
+ export {
223
+ kimiCodingOAuth
224
+ };
@@ -2,43 +2,47 @@ import { createRequire as __nerveCreateRequire } from "node:module";
2
2
  const require = __nerveCreateRequire(import.meta.url);
3
3
  import {
4
4
  combineAbortSignals
5
- } from "./chunk-XNYZEQ3U.js";
5
+ } from "./chunk-6TAN6WG6.js";
6
6
  import {
7
7
  shortHash
8
- } from "./chunk-KSZJ3HGD.js";
9
- import {
10
- parseStreamingJson,
11
- parseToolCallArguments
12
- } from "./chunk-RUZ2UAYH.js";
8
+ } from "./chunk-2BKMOJYJ.js";
13
9
  import {
14
10
  buildBaseOptions,
15
11
  getJsonSchemaToolParameters,
16
12
  resolveJsonSchemaStrictSampling,
17
13
  transformMessages
18
- } from "./chunk-5R3UAHXF.js";
14
+ } from "./chunk-OAEV22IW.js";
19
15
  import {
20
16
  sanitizeSurrogates
21
- } from "./chunk-2Z5FLMLE.js";
17
+ } from "./chunk-3SSNDIQT.js";
18
+ import {
19
+ truncateErrorText
20
+ } from "./chunk-O2652RWY.js";
22
21
  import {
23
22
  headersToRecord
24
- } from "./chunk-CEX2GWGZ.js";
23
+ } from "./chunk-VBM7TD3X.js";
24
+ import {
25
+ ToolCallArgumentsStream
26
+ } from "./chunk-H2G55ZPG.js";
25
27
  import {
26
28
  calculateCost,
27
29
  clampThinkingLevel,
28
30
  getCurrentTools,
29
- getSystemMessageText,
30
- renderSystemMessageUpdate,
31
31
  resolveTranscript
32
- } from "./chunk-NSA42OOT.js";
32
+ } from "./chunk-TGKIV3F4.js";
33
33
  import {
34
34
  AssistantMessageEventStream
35
- } from "./chunk-MN7PZ2PH.js";
35
+ } from "./chunk-TSV3PFU2.js";
36
36
  import {
37
37
  getIdentityHeaders
38
- } from "./chunk-D5WJKB4R.js";
38
+ } from "./chunk-UDC7NPQJ.js";
39
+ import {
40
+ getSystemMessageText,
41
+ renderSystemMessageUpdate
42
+ } from "./chunk-XY53EFK3.js";
39
43
  import "./chunk-CWESUMYQ.js";
40
44
 
41
- // 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/mistral-conversations.js
45
+ // 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/mistral-conversations.js
42
46
  var MISTRAL_TOOL_CALL_ID_LENGTH = 9;
43
47
  var MAX_MISTRAL_ERROR_BODY_CHARS = 4e3;
44
48
  var stream = (model, context, options) => {
@@ -73,9 +77,6 @@ var stream = (model, context, options) => {
73
77
  stream2.push({ type: "done", reason: output.stopReason, message: output });
74
78
  stream2.end();
75
79
  } catch (error) {
76
- for (const block of output.content) {
77
- delete block.partialArgs;
78
- }
79
80
  output.stopReason = options?.signal?.aborted ? "aborted" : "error";
80
81
  output.errorMessage = formatMistralError(error);
81
82
  stream2.push({ type: "error", reason: output.stopReason, error: output });
@@ -164,11 +165,6 @@ function formatMistralError(error) {
164
165
  }
165
166
  return safeJsonStringify(error);
166
167
  }
167
- function truncateErrorText(text, maxChars) {
168
- if (text.length <= maxChars)
169
- return text;
170
- return `${text.slice(0, maxChars)}... [truncated ${text.length - maxChars} chars]`;
171
- }
172
168
  function safeJsonStringify(value) {
173
169
  try {
174
170
  const serialized = JSON.stringify(value);
@@ -414,7 +410,7 @@ async function consumeChatStream(model, output, stream2, mistralStream, onProvid
414
410
  let currentBlock = null;
415
411
  const blocks = output.content;
416
412
  const blockIndex = () => blocks.length - 1;
417
- const toolBlocksByKey = /* @__PURE__ */ new Map();
413
+ const toolCallsByKey = /* @__PURE__ */ new Map();
418
414
  const finishCurrentBlock = (block) => {
419
415
  if (!block)
420
416
  return;
@@ -532,49 +528,31 @@ async function consumeChatStream(model, output, stream2, mistralStream, onProvid
532
528
  }
533
529
  const callId = toolCall.id && toolCall.id !== "null" ? toolCall.id : deriveMistralToolCallId(`toolcall:${toolCall.index ?? 0}`, 0);
534
530
  const key = toolCall.index ?? callId;
535
- const existingIndex = toolBlocksByKey.get(key);
536
- let block;
537
- if (existingIndex !== void 0) {
538
- const existing = output.content[existingIndex];
539
- if (existing?.type === "toolCall") {
540
- block = existing;
541
- }
542
- }
543
- if (!block) {
544
- block = {
545
- type: "toolCall",
546
- id: callId,
547
- name: toolCall.function.name,
548
- arguments: {},
549
- partialArgs: ""
550
- };
551
- output.content.push(block);
552
- toolBlocksByKey.set(key, output.content.length - 1);
553
- stream2.push({ type: "toolcall_start", contentIndex: output.content.length - 1, partial: output });
531
+ let open = toolCallsByKey.get(key);
532
+ if (!open) {
533
+ output.content.push({ type: "toolCall", id: callId, name: toolCall.function.name, arguments: {} });
534
+ open = { contentIndex: output.content.length - 1, arguments: new ToolCallArgumentsStream() };
535
+ toolCallsByKey.set(key, open);
536
+ stream2.push({ type: "toolcall_start", contentIndex: open.contentIndex, partial: output });
554
537
  }
555
538
  const argsDelta = typeof toolCall.function.arguments === "string" ? toolCall.function.arguments : JSON.stringify(toolCall.function.arguments || {});
556
- block.partialArgs = (block.partialArgs || "") + argsDelta;
557
- block.arguments = parseStreamingJson(block.partialArgs);
539
+ output.content[open.contentIndex].arguments = open.arguments.append(argsDelta);
558
540
  stream2.push({
559
541
  type: "toolcall_delta",
560
- contentIndex: toolBlocksByKey.get(key),
542
+ contentIndex: open.contentIndex,
561
543
  delta: argsDelta,
562
544
  partial: output
563
545
  });
564
546
  }
565
547
  }
566
548
  finishCurrentBlock(currentBlock);
567
- for (const index of toolBlocksByKey.values()) {
568
- const block = output.content[index];
569
- if (block.type !== "toolCall")
570
- continue;
571
- const toolBlock = block;
572
- Object.assign(toolBlock, parseToolCallArguments(toolBlock.partialArgs));
573
- delete toolBlock.partialArgs;
549
+ for (const open of toolCallsByKey.values()) {
550
+ const block = output.content[open.contentIndex];
551
+ Object.assign(block, open.arguments.finish());
574
552
  stream2.push({
575
553
  type: "toolcall_end",
576
- contentIndex: index,
577
- toolCall: toolBlock,
554
+ contentIndex: open.contentIndex,
555
+ toolCall: block,
578
556
  partial: output
579
557
  });
580
558
  }
@@ -0,0 +1,32 @@
1
+ import { createRequire as __nerveCreateRequire } from "node:module";
2
+ const require = __nerveCreateRequire(import.meta.url);
3
+
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/providers/data/github-copilot.json
5
+ var github_copilot_default = { "anthropic-messages": { "chat:claude-fable-5": { id: "claude-fable-5", name: "Claude Fable 5", api: "anthropic-messages", provider: "github-copilot", baseUrl: "https://api.individual.githubcopilot.com", reasoning: true, input: ["text", "image"], cost: { input: 10, output: 50, cacheRead: 1, cacheWrite: 12.5 }, contextWindow: 1e6, maxTokens: 128e3, headers: { "User-Agent": "GitHubCopilotChat/0.35.0", "Editor-Version": "vscode/1.107.0", "Editor-Plugin-Version": "copilot-chat/0.35.0", "Copilot-Integration-Id": "vscode-chat" }, thinkingLevelMap: { off: null, xhigh: "xhigh", max: "max" }, compat: { forceAdaptiveThinking: true, supportsMidConvoSystemMessages: true }, inputLimits: { images: { resize: { maxWidth: 2e3, maxHeight: 2e3, maxBytes: 4718592, jpegQuality: 80 } } }, type: "chat" }, "chat:claude-fable-5.1": { id: "claude-fable-5.1", name: "Claude Fable 5.1", api: "anthropic-messages", provider: "github-copilot", baseUrl: "https://api.individual.githubcopilot.com", reasoning: true, input: ["text", "image"], cost: { input: 10, output: 50, cacheRead: 0.25, cacheWrite: 12.5 }, contextWindow: 1e6, maxTokens: 128e3, headers: { "User-Agent": "GitHubCopilotChat/0.35.0", "Editor-Version": "vscode/1.107.0", "Editor-Plugin-Version": "copilot-chat/0.35.0", "Copilot-Integration-Id": "vscode-chat" }, thinkingLevelMap: { off: null, xhigh: "xhigh", max: "max" }, compat: { forceAdaptiveThinking: true, supportsMidConvoSystemMessages: true }, inputLimits: { images: { resize: { maxWidth: 2e3, maxHeight: 2e3, maxBytes: 4718592, jpegQuality: 80 } } }, type: "chat" }, "chat:claude-haiku-4.5": { id: "claude-haiku-4.5", name: "Claude Haiku 4.5 (latest)", api: "anthropic-messages", provider: "github-copilot", baseUrl: "https://api.individual.githubcopilot.com", reasoning: true, input: ["text", "image"], cost: { input: 1, output: 5, cacheRead: 0.1, cacheWrite: 1.25 }, contextWindow: 2e5, maxTokens: 64e3, headers: { "User-Agent": "GitHubCopilotChat/0.35.0", "Editor-Version": "vscode/1.107.0", "Editor-Plugin-Version": "copilot-chat/0.35.0", "Copilot-Integration-Id": "vscode-chat" }, compat: { supportsEagerToolInputStreaming: false }, inputLimits: { images: { resize: { maxWidth: 2e3, maxHeight: 2e3, maxBytes: 4718592, jpegQuality: 80 } } }, type: "chat" }, "chat:claude-haiku-5.5": { id: "claude-haiku-5.5", name: "Claude Haiku 5.5", api: "anthropic-messages", provider: "github-copilot", baseUrl: "https://api.individual.githubcopilot.com", reasoning: true, input: ["text", "image"], cost: { input: 0.1, output: 0.5, cacheRead: 0.01, cacheWrite: 0.125, tiers: [{ inputTokensAbove: 1e5, input: 0.5, output: 2.5, cacheRead: 0.05, cacheWrite: 0.625 }] }, contextWindow: 1e6, maxTokens: 128e3, headers: { "User-Agent": "GitHubCopilotChat/0.35.0", "Editor-Version": "vscode/1.107.0", "Editor-Plugin-Version": "copilot-chat/0.35.0", "Copilot-Integration-Id": "vscode-chat" }, thinkingLevelMap: { xhigh: "xhigh", max: "max" }, compat: { forceAdaptiveThinking: true, supportsTemperature: false, supportsMidConvoSystemMessages: true }, inputLimits: { images: { resize: { maxWidth: 2e3, maxHeight: 2e3, maxBytes: 4718592, jpegQuality: 80 } } }, type: "chat" }, "chat:claude-opus-4.8": { id: "claude-opus-4.8", name: "Claude Opus 4.8", api: "anthropic-messages", provider: "github-copilot", baseUrl: "https://api.individual.githubcopilot.com", reasoning: true, input: ["text", "image"], cost: { input: 5, output: 25, cacheRead: 0.5, cacheWrite: 6.25 }, contextWindow: 1e6, maxTokens: 64e3, headers: { "User-Agent": "GitHubCopilotChat/0.35.0", "Editor-Version": "vscode/1.107.0", "Editor-Plugin-Version": "copilot-chat/0.35.0", "Copilot-Integration-Id": "vscode-chat" }, thinkingLevelMap: { xhigh: "xhigh", max: "max", minimal: "low" }, compat: { forceAdaptiveThinking: true, supportsTemperature: false, supportsMidConvoSystemMessages: true }, inputLimits: { images: { resize: { maxWidth: 2e3, maxHeight: 2e3, maxBytes: 4718592, jpegQuality: 80 } } }, type: "chat" }, "chat:claude-opus-5": { id: "claude-opus-5", name: "Claude Opus 5", api: "anthropic-messages", provider: "github-copilot", baseUrl: "https://api.individual.githubcopilot.com", reasoning: true, input: ["text", "image"], cost: { input: 5, output: 25, cacheRead: 0.5, cacheWrite: 6.25 }, contextWindow: 1e6, maxTokens: 64e3, headers: { "User-Agent": "GitHubCopilotChat/0.35.0", "Editor-Version": "vscode/1.107.0", "Editor-Plugin-Version": "copilot-chat/0.35.0", "Copilot-Integration-Id": "vscode-chat" }, thinkingLevelMap: { xhigh: "xhigh", max: "max", minimal: "low" }, compat: { forceAdaptiveThinking: true, supportsTemperature: false, supportsMidConvoSystemMessages: true }, inputLimits: { images: { resize: { maxWidth: 2e3, maxHeight: 2e3, maxBytes: 4718592, jpegQuality: 80 } } }, type: "chat" }, "chat:claude-opus-5.5": { id: "claude-opus-5.5", name: "Claude Opus 5.5", api: "anthropic-messages", provider: "github-copilot", baseUrl: "https://api.individual.githubcopilot.com", reasoning: true, input: ["text", "image"], cost: { input: 4, output: 20, cacheRead: 0.2, cacheWrite: 5 }, contextWindow: 1e6, maxTokens: 128e3, headers: { "User-Agent": "GitHubCopilotChat/0.35.0", "Editor-Version": "vscode/1.107.0", "Editor-Plugin-Version": "copilot-chat/0.35.0", "Copilot-Integration-Id": "vscode-chat" }, thinkingLevelMap: { off: null, minimal: null, low: "low", medium: "medium", high: "high", xhigh: "xhigh", max: "max" }, compat: { forceAdaptiveThinking: true, supportsTemperature: false, supportsMidConvoSystemMessages: true }, inputLimits: { images: { resize: { maxWidth: 2e3, maxHeight: 2e3, maxBytes: 4718592, jpegQuality: 80 } } }, type: "chat" }, "chat:claude-sonnet-4.6": { id: "claude-sonnet-4.6", name: "Claude Sonnet 4.6", api: "anthropic-messages", provider: "github-copilot", baseUrl: "https://api.individual.githubcopilot.com", reasoning: true, input: ["text", "image"], cost: { input: 3, output: 15, cacheRead: 0.3, cacheWrite: 3.75 }, contextWindow: 1e6, maxTokens: 32e3, headers: { "User-Agent": "GitHubCopilotChat/0.35.0", "Editor-Version": "vscode/1.107.0", "Editor-Plugin-Version": "copilot-chat/0.35.0", "Copilot-Integration-Id": "vscode-chat" }, thinkingLevelMap: { max: "max", minimal: "low" }, compat: { forceAdaptiveThinking: true }, inputLimits: { images: { resize: { maxWidth: 2e3, maxHeight: 2e3, maxBytes: 4718592, jpegQuality: 80 } } }, type: "chat" }, "chat:claude-sonnet-5": { id: "claude-sonnet-5", name: "Claude Sonnet 5", api: "anthropic-messages", provider: "github-copilot", baseUrl: "https://api.individual.githubcopilot.com", reasoning: true, input: ["text", "image"], cost: { input: 2, output: 10, cacheRead: 0.2, cacheWrite: 2.5 }, contextWindow: 1e6, maxTokens: 128e3, headers: { "User-Agent": "GitHubCopilotChat/0.35.0", "Editor-Version": "vscode/1.107.0", "Editor-Plugin-Version": "copilot-chat/0.35.0", "Copilot-Integration-Id": "vscode-chat" }, thinkingLevelMap: { xhigh: "xhigh", max: "max" }, compat: { forceAdaptiveThinking: true, supportsTemperature: false }, inputLimits: { images: { resize: { maxWidth: 2e3, maxHeight: 2e3, maxBytes: 4718592, jpegQuality: 80 } } }, type: "chat" }, "chat:claude-sonnet-5.5": { id: "claude-sonnet-5.5", name: "Claude Sonnet 5.5", api: "anthropic-messages", provider: "github-copilot", baseUrl: "https://api.individual.githubcopilot.com", reasoning: true, input: ["text", "image"], cost: { input: 2, output: 10, cacheRead: 0.1, cacheWrite: 2.5 }, contextWindow: 1e6, maxTokens: 128e3, headers: { "User-Agent": "GitHubCopilotChat/0.35.0", "Editor-Version": "vscode/1.107.0", "Editor-Plugin-Version": "copilot-chat/0.35.0", "Copilot-Integration-Id": "vscode-chat" }, thinkingLevelMap: { xhigh: "xhigh", max: "max" }, compat: { forceAdaptiveThinking: true, supportsTemperature: false, supportsMidConvoSystemMessages: true }, inputLimits: { images: { resize: { maxWidth: 2e3, maxHeight: 2e3, maxBytes: 4718592, jpegQuality: 80 } } }, type: "chat" } }, "openai-completions": { "chat:gemini-3.8-flash": { id: "gemini-3.8-flash", name: "Gemini 3.8 Flash", api: "openai-completions", provider: "github-copilot", baseUrl: "https://api.individual.githubcopilot.com", reasoning: true, input: ["text", "image"], cost: { input: 0.75, output: 3.75, cacheRead: 0.075, cacheWrite: 0 }, contextWindow: 1e6, maxTokens: 64e3, headers: { "User-Agent": "GitHubCopilotChat/0.35.0", "Editor-Version": "vscode/1.107.0", "Editor-Plugin-Version": "copilot-chat/0.35.0", "Copilot-Integration-Id": "vscode-chat" }, compat: { supportsStrictMode: true, supportsStore: false, supportsDeveloperRole: false, supportsReasoningEffort: false }, inputLimits: { images: { resize: { maxWidth: 2e3, maxHeight: 2e3, maxBytes: 4718592, jpegQuality: 80 } } }, type: "chat" }, "chat:gemini-4-argon": { id: "gemini-4-argon", name: "Gemini 4 Argon", api: "openai-completions", provider: "github-copilot", baseUrl: "https://api.individual.githubcopilot.com", reasoning: true, input: ["text", "image"], cost: { input: 2, output: 10, cacheRead: 0.1, cacheWrite: 0 }, contextWindow: 1048576, maxTokens: 65536, headers: { "User-Agent": "GitHubCopilotChat/0.35.0", "Editor-Version": "vscode/1.107.0", "Editor-Plugin-Version": "copilot-chat/0.35.0", "Copilot-Integration-Id": "vscode-chat" }, compat: { supportsStrictMode: true, supportsStore: false, supportsDeveloperRole: false, supportsReasoningEffort: false }, inputLimits: { images: { resize: { maxWidth: 2e3, maxHeight: 2e3, maxBytes: 4718592, jpegQuality: 80 } } }, type: "chat" }, "chat:kimi-k3": { id: "kimi-k3", name: "Kimi K3", api: "openai-completions", provider: "github-copilot", baseUrl: "https://api.individual.githubcopilot.com", reasoning: true, input: ["text", "image"], cost: { input: 3, output: 15, cacheRead: 0.3, cacheWrite: 0 }, contextWindow: 1048576, maxTokens: 131072, headers: { "User-Agent": "GitHubCopilotChat/0.35.0", "Editor-Version": "vscode/1.107.0", "Editor-Plugin-Version": "copilot-chat/0.35.0", "Copilot-Integration-Id": "vscode-chat" }, compat: { supportsStrictMode: true, supportsStore: false, supportsDeveloperRole: false, supportsReasoningEffort: false, supportsMidConvoSystemMessages: true }, inputLimits: { images: { resize: { maxWidth: 2e3, maxHeight: 2e3, maxBytes: 4718592, jpegQuality: 80 } } }, type: "chat" } }, "openai-responses": { "chat:gpt-5.3-codex": { id: "gpt-5.3-codex", name: "GPT-5.3 Codex", api: "openai-responses", provider: "github-copilot", baseUrl: "https://api.individual.githubcopilot.com", reasoning: true, input: ["text", "image"], cost: { input: 1.75, output: 14, cacheRead: 0.175, cacheWrite: 0 }, contextWindow: 1e6, maxTokens: 128e3, headers: { "User-Agent": "GitHubCopilotChat/0.35.0", "Editor-Version": "vscode/1.107.0", "Editor-Plugin-Version": "copilot-chat/0.35.0", "Copilot-Integration-Id": "vscode-chat" }, thinkingLevelMap: { off: null, minimal: "low", low: "low", medium: "medium", high: "high", xhigh: "xhigh", max: null }, compat: { supportsOpenAIGrammarTools: true }, inputLimits: { images: { resize: { maxWidth: 2e3, maxHeight: 2e3, maxBytes: 4718592, jpegQuality: 80 } } }, type: "chat" }, "chat:gpt-5.4-nano": { id: "gpt-5.4-nano", name: "GPT-5.4 nano", api: "openai-responses", provider: "github-copilot", baseUrl: "https://api.individual.githubcopilot.com", reasoning: true, input: ["text", "image"], cost: { input: 0.2, output: 1.25, cacheRead: 0.02, cacheWrite: 0 }, contextWindow: 4e5, maxTokens: 128e3, headers: { "User-Agent": "GitHubCopilotChat/0.35.0", "Editor-Version": "vscode/1.107.0", "Editor-Plugin-Version": "copilot-chat/0.35.0", "Copilot-Integration-Id": "vscode-chat" }, thinkingLevelMap: { off: null, minimal: "low", low: "low", medium: "medium", high: "high", xhigh: "xhigh", max: null }, compat: { supportsOpenAIGrammarTools: true }, inputLimits: { images: { resize: { maxWidth: 2e3, maxHeight: 2e3, maxBytes: 4718592, jpegQuality: 80 } } }, type: "chat" }, "chat:gpt-5.6-luna": { id: "gpt-5.6-luna", name: "GPT-5.6 Luna", api: "openai-responses", provider: "github-copilot", baseUrl: "https://api.individual.githubcopilot.com", reasoning: true, input: ["text", "image"], cost: { input: 0.2, output: 1.2, cacheRead: 0.02, cacheWrite: 0.25, tiers: [{ inputTokensAbove: 2e5, input: 0.4, output: 1.8, cacheRead: 0.04, cacheWrite: 0.5 }] }, contextWindow: 105e4, maxTokens: 128e3, headers: { "User-Agent": "GitHubCopilotChat/0.35.0", "Editor-Version": "vscode/1.107.0", "Editor-Plugin-Version": "copilot-chat/0.35.0", "Copilot-Integration-Id": "vscode-chat" }, thinkingLevelMap: { off: null, minimal: "low", low: "low", medium: "medium", high: "high", xhigh: "xhigh", max: "max" }, compat: { supportsMidConvoSystemMessages: true, supportsAdditionalTools: true, supportsOpenAIGrammarTools: true }, inputLimits: { images: { resize: { maxWidth: 2e3, maxHeight: 2e3, maxBytes: 4718592, jpegQuality: 80 } } }, type: "chat" }, "chat:gpt-5.6-sol": { id: "gpt-5.6-sol", name: "GPT-5.6 Sol", api: "openai-responses", provider: "github-copilot", baseUrl: "https://api.individual.githubcopilot.com", reasoning: true, input: ["text", "image"], cost: { input: 4, output: 20, cacheRead: 0.4, cacheWrite: 5, tiers: [{ inputTokensAbove: 272e3, input: 8, output: 30, cacheRead: 0.8, cacheWrite: 10 }] }, contextWindow: 105e4, maxTokens: 128e3, headers: { "User-Agent": "GitHubCopilotChat/0.35.0", "Editor-Version": "vscode/1.107.0", "Editor-Plugin-Version": "copilot-chat/0.35.0", "Copilot-Integration-Id": "vscode-chat" }, thinkingLevelMap: { off: null, minimal: "low", low: "low", medium: "medium", high: "high", xhigh: "xhigh", max: "max" }, compat: { supportsMidConvoSystemMessages: true, supportsAdditionalTools: true, supportsOpenAIGrammarTools: true }, inputLimits: { images: { resize: { maxWidth: 2e3, maxHeight: 2e3, maxBytes: 4718592, jpegQuality: 80 } } }, type: "chat" }, "chat:gpt-5.6-terra": { id: "gpt-5.6-terra", name: "GPT-5.6 Terra", api: "openai-responses", provider: "github-copilot", baseUrl: "https://api.individual.githubcopilot.com", reasoning: true, input: ["text", "image"], cost: { input: 2, output: 12, cacheRead: 0.2, cacheWrite: 2.5, tiers: [{ inputTokensAbove: 272e3, input: 4, output: 18, cacheRead: 0.4, cacheWrite: 5 }] }, contextWindow: 105e4, maxTokens: 128e3, headers: { "User-Agent": "GitHubCopilotChat/0.35.0", "Editor-Version": "vscode/1.107.0", "Editor-Plugin-Version": "copilot-chat/0.35.0", "Copilot-Integration-Id": "vscode-chat" }, thinkingLevelMap: { off: null, minimal: "low", low: "low", medium: "medium", high: "high", xhigh: "xhigh", max: "max" }, compat: { supportsMidConvoSystemMessages: true, supportsAdditionalTools: true, supportsOpenAIGrammarTools: true }, inputLimits: { images: { resize: { maxWidth: 2e3, maxHeight: 2e3, maxBytes: 4718592, jpegQuality: 80 } } }, type: "chat" }, "chat:gpt-6-astra": { id: "gpt-6-astra", name: "GPT-6 Astra", api: "openai-responses", provider: "github-copilot", baseUrl: "https://api.individual.githubcopilot.com", reasoning: true, input: ["text", "image"], cost: { input: 10, output: 50, cacheRead: 1, cacheWrite: 12.5, tiers: [{ inputTokensAbove: 272e3, input: 20, output: 75, cacheRead: 2, cacheWrite: 25 }] }, contextWindow: 1e6, maxTokens: 128e3, headers: { "User-Agent": "GitHubCopilotChat/0.35.0", "Editor-Version": "vscode/1.107.0", "Editor-Plugin-Version": "copilot-chat/0.35.0", "Copilot-Integration-Id": "vscode-chat" }, thinkingLevelMap: { off: null, minimal: null, low: "low", medium: "medium", high: "high", xhigh: "xhigh", max: "max" }, compat: { supportsMidConvoSystemMessages: true, supportsAdditionalTools: true, supportsOpenAIGrammarTools: true }, inputLimits: { images: { resize: { maxWidth: 2e3, maxHeight: 2e3, maxBytes: 4718592, jpegQuality: 80 } } }, type: "chat" }, "chat:gpt-6-luna": { id: "gpt-6-luna", name: "GPT-6 Luna", api: "openai-responses", provider: "github-copilot", baseUrl: "https://api.individual.githubcopilot.com", reasoning: true, input: ["text", "image"], cost: { input: 0.1, output: 0.5, cacheRead: 0.01, cacheWrite: 0.125, tiers: [{ inputTokensAbove: 272e3, input: 0.2, output: 0.75, cacheRead: 0.02, cacheWrite: 0.25 }] }, contextWindow: 1e6, maxTokens: 128e3, headers: { "User-Agent": "GitHubCopilotChat/0.35.0", "Editor-Version": "vscode/1.107.0", "Editor-Plugin-Version": "copilot-chat/0.35.0", "Copilot-Integration-Id": "vscode-chat" }, thinkingLevelMap: { off: "none", minimal: null, low: "low", medium: "medium", high: "high", xhigh: "xhigh", max: "max" }, compat: { supportsMidConvoSystemMessages: true, supportsAdditionalTools: true, supportsOpenAIGrammarTools: true }, inputLimits: { images: { resize: { maxWidth: 2e3, maxHeight: 2e3, maxBytes: 4718592, jpegQuality: 80 } } }, type: "chat" }, "chat:gpt-6-sol": { id: "gpt-6-sol", name: "GPT-6 Sol", api: "openai-responses", provider: "github-copilot", baseUrl: "https://api.individual.githubcopilot.com", reasoning: true, input: ["text", "image"], cost: { input: 2, output: 10, cacheRead: 0.2, cacheWrite: 2.5, tiers: [{ inputTokensAbove: 272e3, input: 4, output: 15, cacheRead: 0.4, cacheWrite: 5 }] }, contextWindow: 1e6, maxTokens: 128e3, headers: { "User-Agent": "GitHubCopilotChat/0.35.0", "Editor-Version": "vscode/1.107.0", "Editor-Plugin-Version": "copilot-chat/0.35.0", "Copilot-Integration-Id": "vscode-chat" }, thinkingLevelMap: { off: "none", minimal: null, low: "low", medium: "medium", high: "high", xhigh: "xhigh", max: "max" }, compat: { supportsMidConvoSystemMessages: true, supportsAdditionalTools: true, supportsOpenAIGrammarTools: true }, inputLimits: { images: { resize: { maxWidth: 2e3, maxHeight: 2e3, maxBytes: 4718592, jpegQuality: 80 } } }, type: "chat" }, "chat:gpt-6.1-sol": { id: "gpt-6.1-sol", name: "GPT-6.1 Sol", api: "openai-responses", provider: "github-copilot", baseUrl: "https://api.individual.githubcopilot.com", reasoning: true, input: ["text", "image"], cost: { input: 2, output: 10, cacheRead: 0.1, cacheWrite: 2.5, tiers: [{ inputTokensAbove: 272e3, input: 4, output: 15, cacheRead: 0.2, cacheWrite: 5 }] }, contextWindow: 105e4, maxTokens: 128e3, headers: { "User-Agent": "GitHubCopilotChat/0.35.0", "Editor-Version": "vscode/1.107.0", "Editor-Plugin-Version": "copilot-chat/0.35.0", "Copilot-Integration-Id": "vscode-chat" }, thinkingLevelMap: { off: null, minimal: null, low: "low", medium: "medium", high: "high", xhigh: "xhigh", max: "max" }, compat: { supportsMidConvoSystemMessages: true, supportsAdditionalTools: true, supportsOpenAIGrammarTools: true }, inputLimits: { images: { resize: { maxWidth: 2e3, maxHeight: 2e3, maxBytes: 4718592, jpegQuality: 80 } } }, type: "chat" }, "chat:gpt-6.1-terra": { id: "gpt-6.1-terra", name: "GPT-6.1 Terra", api: "openai-responses", provider: "github-copilot", baseUrl: "https://api.individual.githubcopilot.com", reasoning: true, input: ["text", "image"], cost: { input: 1, output: 5, cacheRead: 0.05, cacheWrite: 1.25, tiers: [{ inputTokensAbove: 272e3, input: 2, output: 7.5, cacheRead: 0.1, cacheWrite: 2.5 }] }, contextWindow: 105e4, maxTokens: 128e3, headers: { "User-Agent": "GitHubCopilotChat/0.35.0", "Editor-Version": "vscode/1.107.0", "Editor-Plugin-Version": "copilot-chat/0.35.0", "Copilot-Integration-Id": "vscode-chat" }, thinkingLevelMap: { off: "none", minimal: null, low: "low", medium: "medium", high: "high", xhigh: "xhigh", max: "max" }, compat: { supportsMidConvoSystemMessages: true, supportsAdditionalTools: true, supportsOpenAIGrammarTools: true }, inputLimits: { images: { resize: { maxWidth: 2e3, maxHeight: 2e3, maxBytes: 4718592, jpegQuality: 80 } } }, type: "chat" }, "chat:grok-4.5": { id: "grok-4.5", name: "Grok 4.5", api: "openai-responses", provider: "github-copilot", baseUrl: "https://api.individual.githubcopilot.com", reasoning: true, input: ["text", "image"], cost: { input: 2, output: 6, cacheRead: 0.5, cacheWrite: 0, tiers: [{ inputTokensAbove: 2e5, input: 4, output: 12, cacheRead: 1, cacheWrite: 0 }] }, contextWindow: 5e5, maxTokens: 128e3, headers: { "User-Agent": "GitHubCopilotChat/0.35.0", "Editor-Version": "vscode/1.107.0", "Editor-Plugin-Version": "copilot-chat/0.35.0", "Copilot-Integration-Id": "vscode-chat" }, thinkingLevelMap: { off: null, minimal: null, low: "low", medium: "medium", high: "high", xhigh: null, max: null }, inputLimits: { images: { resize: { maxWidth: 2e3, maxHeight: 2e3, maxBytes: 4718592, jpegQuality: 80 } } }, type: "chat" }, "chat:grok-4.6": { id: "grok-4.6", name: "Grok 4.6", api: "openai-responses", provider: "github-copilot", baseUrl: "https://api.individual.githubcopilot.com", reasoning: true, input: ["text", "image"], cost: { input: 2, output: 6, cacheRead: 0.5, cacheWrite: 0, tiers: [{ inputTokensAbove: 2e5, input: 4, output: 12, cacheRead: 1, cacheWrite: 0 }] }, contextWindow: 5e5, maxTokens: 128e3, headers: { "User-Agent": "GitHubCopilotChat/0.35.0", "Editor-Version": "vscode/1.107.0", "Editor-Plugin-Version": "copilot-chat/0.35.0", "Copilot-Integration-Id": "vscode-chat" }, thinkingLevelMap: { off: null, minimal: null, low: "low", medium: "medium", high: "high", xhigh: "xhigh", max: null }, inputLimits: { images: { resize: { maxWidth: 2e3, maxHeight: 2e3, maxBytes: 4718592, jpegQuality: 80 } } }, type: "chat" }, "chat:grok-4.7": { id: "grok-4.7", name: "Grok 4.7", api: "openai-responses", provider: "github-copilot", baseUrl: "https://api.individual.githubcopilot.com", reasoning: true, input: ["text", "image"], cost: { input: 2, output: 6, cacheRead: 0.5, cacheWrite: 0, tiers: [{ inputTokensAbove: 2e5, input: 4, output: 12, cacheRead: 1, cacheWrite: 0 }] }, contextWindow: 5e5, maxTokens: 128e3, headers: { "User-Agent": "GitHubCopilotChat/0.35.0", "Editor-Version": "vscode/1.107.0", "Editor-Plugin-Version": "copilot-chat/0.35.0", "Copilot-Integration-Id": "vscode-chat" }, thinkingLevelMap: { off: null, minimal: null, low: "low", medium: "medium", high: "high", xhigh: "xhigh", max: null }, inputLimits: { images: { resize: { maxWidth: 2e3, maxHeight: 2e3, maxBytes: 4718592, jpegQuality: 80 } } }, type: "chat" }, "chat:mai-code-1.1-flash": { id: "mai-code-1.1-flash", name: "MAI-Code-1.1-Flash", api: "openai-responses", provider: "github-copilot", baseUrl: "https://api.individual.githubcopilot.com", reasoning: true, input: ["text", "image"], cost: { input: 0.2, output: 1.2, cacheRead: 0.02, cacheWrite: 0 }, contextWindow: 256e3, maxTokens: 128e3, headers: { "User-Agent": "GitHubCopilotChat/0.35.0", "Editor-Version": "vscode/1.107.0", "Editor-Plugin-Version": "copilot-chat/0.35.0", "Copilot-Integration-Id": "vscode-chat" }, thinkingLevelMap: { off: null, minimal: null, low: "low", medium: "medium", high: "high", xhigh: null, max: null }, inputLimits: { images: { resize: { maxWidth: 2e3, maxHeight: 2e3, maxBytes: 4718592, jpegQuality: 80 } } }, type: "chat" } }, "typesafe-system-one": { "classifier:microsoft-decision-1": { type: "classifier", id: "microsoft-decision-1", name: "Microsoft-Decision-1", api: "typesafe-system-one", provider: "github-copilot", baseUrl: "https://api.individual.githubcopilot.com", input: ["text"], cost: { input: 0.042, output: 0, cacheRead: 0, cacheWrite: 0 }, contextWindow: 32768, headers: { "User-Agent": "GitHubCopilotChat/0.35.0", "Editor-Version": "vscode/1.107.0", "Editor-Plugin-Version": "copilot-chat/0.35.0", "Copilot-Integration-Id": "vscode-chat" } } } };
6
+
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/model-catalog.js
8
+ function flattenModelCatalog(groups, type) {
9
+ return Object.fromEntries(Object.values(groups).flatMap((models) => Object.values(models)).filter((model) => model.type === type).map((model) => [model.id, model]));
10
+ }
11
+ function flattenChatModelCatalog(_provider, groups) {
12
+ return flattenModelCatalog(groups, "chat");
13
+ }
14
+ function flattenImageModelCatalog(_provider, groups) {
15
+ return flattenModelCatalog(groups, "image");
16
+ }
17
+ function flattenClassifierModelCatalog(_provider, groups) {
18
+ return flattenModelCatalog(groups, "classifier");
19
+ }
20
+
21
+ // 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/providers/github-copilot.models.js
22
+ var GITHUB_COPILOT_MODELS = flattenChatModelCatalog("github-copilot", github_copilot_default);
23
+ var GITHUB_COPILOT_IMAGE_MODELS = flattenImageModelCatalog("github-copilot", github_copilot_default);
24
+ var GITHUB_COPILOT_CLASSIFIER_MODELS = flattenClassifierModelCatalog("github-copilot", github_copilot_default);
25
+
26
+ export {
27
+ flattenChatModelCatalog,
28
+ flattenImageModelCatalog,
29
+ flattenClassifierModelCatalog,
30
+ GITHUB_COPILOT_MODELS,
31
+ GITHUB_COPILOT_CLASSIFIER_MODELS
32
+ };
@@ -4,7 +4,7 @@ import {
4
4
  __require
5
5
  } from "./chunk-CWESUMYQ.js";
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/provider-env.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/provider-env.js
8
8
  var procEnvCache = null;
9
9
  function getBunSandboxEnvValue(name) {
10
10
  if (typeof process === "undefined" || !process.versions?.bun || Object.keys(process.env).length > 0) {
@@ -0,0 +1,22 @@
1
+ import { createRequire as __nerveCreateRequire } from "node:module";
2
+ const require = __nerveCreateRequire(import.meta.url);
3
+
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/sleep.js
5
+ function sleep(ms, signal) {
6
+ return new Promise((resolve, reject) => {
7
+ signal.throwIfAborted();
8
+ const onAbort = () => {
9
+ clearTimeout(timeout);
10
+ reject(signal.reason);
11
+ };
12
+ const timeout = setTimeout(() => {
13
+ signal.removeEventListener("abort", onAbort);
14
+ resolve();
15
+ }, ms);
16
+ signal.addEventListener("abort", onAbort, { once: true });
17
+ });
18
+ }
19
+
20
+ export {
21
+ sleep
22
+ };