@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
@@ -0,0 +1,168 @@
1
+ import { createRequire as __nerveCreateRequire } from "node:module";
2
+ const require = __nerveCreateRequire(import.meta.url);
3
+ import {
4
+ trustedHttpUrl
5
+ } from "./chunk-B4IE2GAM.js";
6
+ import {
7
+ pollOAuthDeviceCodeFlow
8
+ } from "./chunk-ER2ES2RH.js";
9
+ import "./chunk-CWESUMYQ.js";
10
+
11
+ // 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/meta.js
12
+ var CLIENT_ID = "1031625952748946";
13
+ var AUTH_HOST = "https://auth.meta.com";
14
+ var DEVICE_AUTHORIZATION_URL = `${AUTH_HOST}/oidc/device/authorization/`;
15
+ var DEVICE_TOKEN_URL = `${AUTH_HOST}/oidc/device/token/`;
16
+ var API_KEY_MINT_URL = "https://api.meta.ai/muse-code/key";
17
+ var API_KEY_LIFETIME_MS = 24 * 60 * 60 * 1e3;
18
+ var REQUEST_TIMEOUT_MS = 30 * 1e3;
19
+ function requestSignal(signal) {
20
+ return AbortSignal.any([AbortSignal.timeout(REQUEST_TIMEOUT_MS), signal]);
21
+ }
22
+ async function readJson(response) {
23
+ try {
24
+ const json = await response.json();
25
+ return json && typeof json === "object" ? json : null;
26
+ } catch {
27
+ return null;
28
+ }
29
+ }
30
+ function errorDetail(json) {
31
+ for (const key of ["error_description", "detail", "message", "error"]) {
32
+ const value = json?.[key];
33
+ if (typeof value === "string" && value.trim())
34
+ return `: ${value.trim()}`;
35
+ }
36
+ return "";
37
+ }
38
+ function positiveNumber(value) {
39
+ return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : void 0;
40
+ }
41
+ async function startDeviceAuthorization(signal) {
42
+ const response = await fetch(DEVICE_AUTHORIZATION_URL, {
43
+ method: "POST",
44
+ headers: {
45
+ "Content-Type": "application/x-www-form-urlencoded",
46
+ Accept: "application/json"
47
+ },
48
+ body: new URLSearchParams({ client_id: CLIENT_ID }).toString(),
49
+ signal: requestSignal(signal)
50
+ });
51
+ const json = await readJson(response);
52
+ if (!response.ok) {
53
+ throw new Error(`Meta device authorization failed with status ${response.status}${errorDetail(json)}`);
54
+ }
55
+ const deviceCode = json?.device_code;
56
+ const userCode = json?.user_code;
57
+ const verificationUri = trustedHttpUrl(json?.verification_uri_complete) ?? trustedHttpUrl(json?.verification_uri);
58
+ if (typeof deviceCode !== "string" || !deviceCode || typeof userCode !== "string" || !userCode || !verificationUri) {
59
+ throw new Error(`Invalid Meta device authorization response: ${JSON.stringify(json)}`);
60
+ }
61
+ return {
62
+ deviceCode,
63
+ userCode,
64
+ verificationUri,
65
+ intervalSeconds: positiveNumber(json?.interval),
66
+ expiresInSeconds: positiveNumber(json?.expires_in)
67
+ };
68
+ }
69
+ async function pollForIdentityToken(device, signal) {
70
+ return pollOAuthDeviceCodeFlow({
71
+ intervalSeconds: device.intervalSeconds,
72
+ expiresInSeconds: device.expiresInSeconds,
73
+ waitBeforeFirstPoll: true,
74
+ signal,
75
+ poll: async () => {
76
+ const response = await fetch(DEVICE_TOKEN_URL, {
77
+ method: "POST",
78
+ headers: {
79
+ "Content-Type": "application/x-www-form-urlencoded",
80
+ Accept: "application/json"
81
+ },
82
+ body: new URLSearchParams({
83
+ grant_type: "urn:ietf:params:oauth:grant-type:device_code",
84
+ device_code: device.deviceCode,
85
+ client_id: CLIENT_ID
86
+ }).toString(),
87
+ signal: requestSignal(signal)
88
+ });
89
+ const json = await readJson(response);
90
+ if (response.ok && typeof json?.access_token === "string" && json.access_token) {
91
+ return { status: "complete", value: json.access_token };
92
+ }
93
+ switch (json?.error) {
94
+ case "authorization_pending":
95
+ return { status: "pending" };
96
+ case "slow_down":
97
+ return { status: "slow_down", intervalSeconds: positiveNumber(json?.interval) };
98
+ case "access_denied":
99
+ return { status: "failed", message: "Meta login was denied." };
100
+ case "expired_token":
101
+ return { status: "failed", message: "Meta device authorization expired. Please restart login." };
102
+ default:
103
+ return {
104
+ status: "failed",
105
+ message: `Meta device token request failed with status ${response.status}${errorDetail(json)}`
106
+ };
107
+ }
108
+ }
109
+ });
110
+ }
111
+ async function mintApiKey(identityToken, signal) {
112
+ const response = await fetch(API_KEY_MINT_URL, {
113
+ method: "POST",
114
+ headers: {
115
+ Accept: "application/json",
116
+ Authorization: `Bearer ${identityToken}`,
117
+ "Content-Type": "application/json",
118
+ "x-api-version": "1.0.0"
119
+ },
120
+ body: "{}",
121
+ signal: requestSignal(signal)
122
+ });
123
+ const json = await readJson(response);
124
+ if (response.status === 401 || response.status === 403) {
125
+ throw new Error(`Meta session expired (status ${response.status}). Run \`/login meta\` to sign in again.${errorDetail(json)}`);
126
+ }
127
+ if (!response.ok) {
128
+ throw new Error(`Meta API key mint failed with status ${response.status}${errorDetail(json)}`);
129
+ }
130
+ const apiKey = json?.api_key;
131
+ if (typeof apiKey !== "string" || !apiKey) {
132
+ const actionUrl = trustedHttpUrl(json?.action_url);
133
+ throw new Error(`Meta did not issue an API key.${actionUrl ? ` Complete setup at ${actionUrl}` : ""}`);
134
+ }
135
+ return { type: "oauth", refresh: identityToken, access: apiKey, expires: Date.now() + API_KEY_LIFETIME_MS };
136
+ }
137
+ async function loginMeta(interaction) {
138
+ try {
139
+ const device = await startDeviceAuthorization(interaction.signal);
140
+ interaction.notify({
141
+ type: "device_code",
142
+ userCode: device.userCode,
143
+ verificationUri: device.verificationUri,
144
+ intervalSeconds: device.intervalSeconds,
145
+ expiresInSeconds: device.expiresInSeconds
146
+ });
147
+ const identityToken = await pollForIdentityToken(device, interaction.signal);
148
+ interaction.notify({ type: "progress", message: "Enabling Meta Model API access..." });
149
+ return await mintApiKey(identityToken, interaction.signal);
150
+ } catch (e) {
151
+ if (interaction.signal.aborted)
152
+ throw new Error("Login cancelled");
153
+ throw e;
154
+ }
155
+ }
156
+ var metaOAuth = {
157
+ name: "Meta (Muse subscription)",
158
+ isSubscription: true,
159
+ loginLabel: "Sign in with Meta",
160
+ login: loginMeta,
161
+ refresh: (credential, signal) => mintApiKey(credential.refresh, signal),
162
+ async toAuth(credential) {
163
+ return { apiKey: credential.access };
164
+ }
165
+ };
166
+ export {
167
+ metaOAuth
168
+ };
@@ -554,6 +554,28 @@ async function searchContent(root, options) {
554
554
  }
555
555
  }
556
556
 
557
+ // packages/native/dist/image/index.js
558
+ var image_exports = {};
559
+ __export(image_exports, {
560
+ isAvailable: () => isAvailable2,
561
+ prepareImage: () => prepareImage
562
+ });
563
+ var native = binding;
564
+ function isAvailable2() {
565
+ return typeof native.prepareModelImage === "function";
566
+ }
567
+ async function prepareImage(data, options) {
568
+ if (typeof native.prepareModelImage !== "function") {
569
+ throw new Error("Native image support is not available");
570
+ }
571
+ return await native.prepareModelImage(data, {
572
+ maxDimension: options.maxDimension,
573
+ maxBase64Bytes: options.maxBase64Bytes,
574
+ acceptedFormats: [...options.acceptedFormats ?? ["png", "jpeg", "webp"]],
575
+ outputFormats: [...options.outputFormats ?? ["png", "jpeg"]]
576
+ });
577
+ }
578
+
557
579
  // packages/native/dist/git/git-client.js
558
580
  var NativeGitReadError = class extends Error {
559
581
  category;
@@ -1151,6 +1173,7 @@ export {
1151
1173
  nativeRuntimeCapabilities,
1152
1174
  createSearchIndex,
1153
1175
  files_exports,
1176
+ image_exports,
1154
1177
  NativeGitReadError,
1155
1178
  readGitRepositoryInfo,
1156
1179
  readGitSnapshot,
@@ -2,19 +2,20 @@ import { createRequire as __nerveCreateRequire } from "node:module";
2
2
  const require = __nerveCreateRequire(import.meta.url);
3
3
  import {
4
4
  classifySystemOne
5
- } from "./chunk-3DGBM7UW.js";
5
+ } from "./chunk-YQFENES6.js";
6
6
  import {
7
7
  isRecord
8
- } from "./chunk-OY6PIAR7.js";
9
- import "./chunk-AON37AL2.js";
10
- import "./chunk-SQ7CWNIT.js";
11
- import "./chunk-CEX2GWGZ.js";
12
- import "./chunk-WXRYBXYR.js";
13
- import "./chunk-MN7PZ2PH.js";
14
- import "./chunk-24GQ74HM.js";
8
+ } from "./chunk-YJT4NXMV.js";
9
+ import "./chunk-EX63VKXY.js";
10
+ import "./chunk-O2652RWY.js";
11
+ import "./chunk-VBM7TD3X.js";
12
+ import "./chunk-TGKIV3F4.js";
13
+ import "./chunk-TSV3PFU2.js";
14
+ import "./chunk-UDC7NPQJ.js";
15
+ import "./chunk-XY53EFK3.js";
15
16
  import "./chunk-CWESUMYQ.js";
16
17
 
17
- // 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/typesafe-system-one.js
18
+ // 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/typesafe-system-one.js
18
19
  var transport = {
19
20
  api: "typesafe-system-one",
20
21
  label: "System One API",
@@ -2,19 +2,20 @@ import { createRequire as __nerveCreateRequire } from "node:module";
2
2
  const require = __nerveCreateRequire(import.meta.url);
3
3
  import {
4
4
  classifySystemOne
5
- } from "./chunk-3DGBM7UW.js";
5
+ } from "./chunk-YQFENES6.js";
6
6
  import {
7
7
  isRecord
8
- } from "./chunk-OY6PIAR7.js";
9
- import "./chunk-AON37AL2.js";
10
- import "./chunk-SQ7CWNIT.js";
11
- import "./chunk-CEX2GWGZ.js";
12
- import "./chunk-WXRYBXYR.js";
13
- import "./chunk-MN7PZ2PH.js";
14
- import "./chunk-24GQ74HM.js";
8
+ } from "./chunk-YJT4NXMV.js";
9
+ import "./chunk-EX63VKXY.js";
10
+ import "./chunk-O2652RWY.js";
11
+ import "./chunk-VBM7TD3X.js";
12
+ import "./chunk-TGKIV3F4.js";
13
+ import "./chunk-TSV3PFU2.js";
14
+ import "./chunk-UDC7NPQJ.js";
15
+ import "./chunk-XY53EFK3.js";
15
16
  import "./chunk-CWESUMYQ.js";
16
17
 
17
- // 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/cloudflare-workers-ai-system-one.js
18
+ // 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/cloudflare-workers-ai-system-one.js
18
19
  var LABEL = "Cloudflare Workers AI";
19
20
  function cloudflareErrorMessage(errors) {
20
21
  if (Array.isArray(errors)) {
@@ -0,0 +1,39 @@
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/text.js
5
+ function contentText(content, separator = "\n") {
6
+ if (typeof content === "string")
7
+ return content;
8
+ return content.filter((block) => block.type === "text").map((block) => block.text).join(separator);
9
+ }
10
+ function getSystemMessageText(message) {
11
+ const parts = [contentText(message.content)];
12
+ for (const text of Object.values(message.sections ?? {})) {
13
+ if (text !== null)
14
+ parts.push(text);
15
+ }
16
+ return parts.filter((part) => part.length > 0).join("\n\n");
17
+ }
18
+ function renderSystemMessageUpdate(message) {
19
+ const parts = [];
20
+ const text = contentText(message.content);
21
+ if (text.length > 0)
22
+ parts.push(text);
23
+ for (const [name, value] of Object.entries(message.sections ?? {})) {
24
+ parts.push(value === null ? `Removed system prompt section "${name}".` : `Updated system prompt section "${name}":
25
+
26
+ ${value}`);
27
+ }
28
+ return parts.join("\n\n");
29
+ }
30
+ function ownedSlice(text, start, end = text.length) {
31
+ return `${text.slice(start, end)} `.slice(0, -1);
32
+ }
33
+
34
+ export {
35
+ contentText,
36
+ getSystemMessageText,
37
+ renderSystemMessageUpdate,
38
+ ownedSlice
39
+ };
@@ -0,0 +1,153 @@
1
+ import { createRequire as __nerveCreateRequire } from "node:module";
2
+ const require = __nerveCreateRequire(import.meta.url);
3
+ import {
4
+ startOAuthCallbackServer,
5
+ waitForCallbackOrManualInput
6
+ } from "./chunk-K2J2VZXO.js";
7
+ import {
8
+ generatePKCE
9
+ } from "./chunk-YUO5V75X.js";
10
+ import {
11
+ getProviderEnvValue
12
+ } from "./chunk-SU2USXTD.js";
13
+ import "./chunk-CWESUMYQ.js";
14
+
15
+ // 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/openrouter.js
16
+ var AUTHORIZE_URL = "https://openrouter.ai/auth";
17
+ var TOKEN_URL = "https://openrouter.ai/api/v1/auth/keys";
18
+ var LOGIN_TIMEOUT_MS = 5 * 60 * 1e3;
19
+ var TOKEN_EXCHANGE_TIMEOUT_MS = 3e4;
20
+ function getCallbackHost() {
21
+ return getProviderEnvValue("PI_OAUTH_CALLBACK_HOST") || "127.0.0.1";
22
+ }
23
+ function parseAuthorizationInput(input) {
24
+ const value = input.trim();
25
+ if (!value)
26
+ return void 0;
27
+ try {
28
+ return new URL(value).searchParams.get("code") ?? void 0;
29
+ } catch {
30
+ }
31
+ if (value.includes("code=")) {
32
+ return new URLSearchParams(value).get("code") ?? void 0;
33
+ }
34
+ return value;
35
+ }
36
+ function errorDetail(body) {
37
+ if (typeof body.error_description === "string")
38
+ return body.error_description;
39
+ if (typeof body.message === "string")
40
+ return body.message;
41
+ if (typeof body.error === "string")
42
+ return body.error;
43
+ if (body.error && typeof body.error === "object" && !Array.isArray(body.error)) {
44
+ const message = body.error.message;
45
+ if (typeof message === "string")
46
+ return message;
47
+ }
48
+ return void 0;
49
+ }
50
+ async function exchangeAuthorizationCode(code, verifier, signal) {
51
+ if (signal.aborted)
52
+ throw new Error("Login cancelled");
53
+ const controller = new AbortController();
54
+ const onAbort = () => controller.abort(signal.reason);
55
+ signal.addEventListener("abort", onAbort, { once: true });
56
+ const timeout = setTimeout(() => controller.abort(new Error("OpenRouter OAuth token exchange timed out")), TOKEN_EXCHANGE_TIMEOUT_MS);
57
+ let response;
58
+ let body = {};
59
+ try {
60
+ response = await fetch(TOKEN_URL, {
61
+ method: "POST",
62
+ headers: { accept: "application/json", "content-type": "application/json" },
63
+ body: JSON.stringify({ code, code_verifier: verifier, code_challenge_method: "S256" }),
64
+ signal: controller.signal
65
+ });
66
+ try {
67
+ const parsed = await response.json();
68
+ if (parsed && typeof parsed === "object" && !Array.isArray(parsed))
69
+ body = parsed;
70
+ } catch {
71
+ if (response.ok)
72
+ throw new Error("OpenRouter OAuth returned invalid JSON");
73
+ }
74
+ } catch (error) {
75
+ if (signal.aborted)
76
+ throw new Error("Login cancelled");
77
+ if (controller.signal.aborted)
78
+ throw new Error("OpenRouter OAuth token exchange timed out");
79
+ throw error;
80
+ } finally {
81
+ clearTimeout(timeout);
82
+ signal.removeEventListener("abort", onAbort);
83
+ }
84
+ if (!response.ok) {
85
+ const detail = errorDetail(body);
86
+ throw new Error(`OpenRouter OAuth key exchange failed (HTTP ${response.status})${detail ? `: ${detail}` : ""}`);
87
+ }
88
+ if (typeof body.key !== "string" || body.key.length === 0) {
89
+ throw new Error('OpenRouter OAuth response carries no "key"');
90
+ }
91
+ return {
92
+ type: "oauth",
93
+ access: body.key,
94
+ refresh: "",
95
+ expires: Number.MAX_SAFE_INTEGER
96
+ };
97
+ }
98
+ async function loginOpenRouter(interaction) {
99
+ const { verifier, challenge } = await generatePKCE();
100
+ const callback = await startOAuthCallbackServer({
101
+ providerName: "OpenRouter",
102
+ host: getCallbackHost(),
103
+ port: 0,
104
+ path: `/oauth/callback/${crypto.randomUUID()}`,
105
+ complete: (code) => exchangeAuthorizationCode(code, verifier, interaction.signal),
106
+ signal: interaction.signal,
107
+ timeoutMs: LOGIN_TIMEOUT_MS
108
+ });
109
+ try {
110
+ const authorizeUrl = new URL(AUTHORIZE_URL);
111
+ authorizeUrl.search = new URLSearchParams({
112
+ callback_url: callback.redirectUri,
113
+ code_challenge: challenge,
114
+ code_challenge_method: "S256"
115
+ }).toString();
116
+ interaction.notify({
117
+ type: "progress",
118
+ message: `Listening for OpenRouter OAuth callback on ${callback.redirectUri}`
119
+ });
120
+ interaction.notify({
121
+ type: "auth_url",
122
+ url: authorizeUrl.toString(),
123
+ instructions: "Complete sign-in in your browser. If the browser is on another machine, paste the final redirect URL here."
124
+ });
125
+ const result = await waitForCallbackOrManualInput(interaction, callback, {
126
+ message: "Complete sign-in in your browser, or paste the authorization code / redirect URL here:",
127
+ placeholder: callback.redirectUri
128
+ });
129
+ if (result.type === "callback")
130
+ return result.value;
131
+ const code = parseAuthorizationInput(result.input);
132
+ if (!code)
133
+ throw new Error("Missing authorization code");
134
+ interaction.notify({ type: "progress", message: "Exchanging authorization code for an API key..." });
135
+ return await exchangeAuthorizationCode(code, verifier, interaction.signal);
136
+ } finally {
137
+ callback.close();
138
+ }
139
+ }
140
+ var openRouterOAuth = {
141
+ name: "OpenRouter OAuth",
142
+ loginLabel: "Sign in with OpenRouter",
143
+ login: loginOpenRouter,
144
+ async refresh(credential, _signal) {
145
+ return credential;
146
+ },
147
+ async toAuth(credential) {
148
+ return { apiKey: credential.access };
149
+ }
150
+ };
151
+ export {
152
+ openRouterOAuth
153
+ };
@@ -2,19 +2,19 @@ import { createRequire as __nerveCreateRequire } from "node:module";
2
2
  const require = __nerveCreateRequire(import.meta.url);
3
3
  import {
4
4
  retryProviderRequest
5
- } from "./chunk-SQ7CWNIT.js";
5
+ } from "./chunk-EX63VKXY.js";
6
6
  import {
7
7
  headersToRecord,
8
8
  providerHeadersToRecord
9
- } from "./chunk-CEX2GWGZ.js";
9
+ } from "./chunk-VBM7TD3X.js";
10
10
  import {
11
11
  calculateCost
12
- } from "./chunk-WXRYBXYR.js";
12
+ } from "./chunk-TGKIV3F4.js";
13
13
  import {
14
14
  getIdentityHeaders
15
- } from "./chunk-24GQ74HM.js";
15
+ } from "./chunk-UDC7NPQJ.js";
16
16
 
17
- // 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/classifier-shared.js
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/api/classifier-shared.js
18
18
  function httpError(label, response, body) {
19
19
  const error = new Error(`${label} returned ${response.status}`);
20
20
  error.status = response.status;
@@ -5,13 +5,13 @@ import {
5
5
  parseClassifierUsage,
6
6
  postClassifierRequest,
7
7
  requiredNumber
8
- } from "./chunk-OY6PIAR7.js";
8
+ } from "./chunk-YJT4NXMV.js";
9
9
  import {
10
10
  formatProviderError,
11
11
  normalizeProviderError
12
- } from "./chunk-AON37AL2.js";
12
+ } from "./chunk-O2652RWY.js";
13
13
 
14
- // 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/system-one-shared.js
14
+ // 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/system-one-shared.js
15
15
  var IMAGE_OPT_IN_HEADERS = { "TypeSafe-Danger-Zone-Images": "true" };
16
16
  function probabilities(label, value, id) {
17
17
  if (!isRecord(value))
@@ -0,0 +1,128 @@
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/oauth-page.js
5
+ var LOGO_SVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 800 800" aria-hidden="true"><path fill="#F09082" d="M165.29 165.29H517.36V400H400V282.65H165.29Z"/><path fill="#4D9ABF" d="M165.29 282.65H282.65V400H400V517.36H282.65V634.72H165.29Z"/><path fill="#F1BE58" d="M517.36 400H634.72V634.72H517.36Z"/></svg>`;
6
+ function escapeHtml(value) {
7
+ return value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&#39;");
8
+ }
9
+ function renderPage(options) {
10
+ const title = escapeHtml(options.title);
11
+ const heading = escapeHtml(options.heading);
12
+ const message = escapeHtml(options.message);
13
+ const details = options.details ? escapeHtml(options.details) : void 0;
14
+ return `<!doctype html>
15
+ <html lang="en">
16
+ <head>
17
+ <meta charset="utf-8" />
18
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
19
+ <title>${title}</title>
20
+ <style>
21
+ :root {
22
+ --text: #fafafa;
23
+ --text-dim: #a1a1aa;
24
+ --page-bg: #09090b;
25
+ --font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
26
+ --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
27
+ }
28
+ * { box-sizing: border-box; }
29
+ html { color-scheme: dark; }
30
+ body {
31
+ margin: 0;
32
+ min-height: 100vh;
33
+ display: flex;
34
+ align-items: center;
35
+ justify-content: center;
36
+ padding: 24px;
37
+ background: var(--page-bg);
38
+ color: var(--text);
39
+ font-family: var(--font-sans);
40
+ text-align: center;
41
+ }
42
+ main {
43
+ width: 100%;
44
+ max-width: 560px;
45
+ display: flex;
46
+ flex-direction: column;
47
+ align-items: center;
48
+ justify-content: center;
49
+ }
50
+ .logo {
51
+ width: 72px;
52
+ height: 72px;
53
+ display: block;
54
+ margin-bottom: 24px;
55
+ }
56
+ h1 {
57
+ margin: 0 0 10px;
58
+ font-size: 28px;
59
+ line-height: 1.15;
60
+ font-weight: 650;
61
+ color: var(--text);
62
+ }
63
+ p {
64
+ margin: 0;
65
+ line-height: 1.7;
66
+ color: var(--text-dim);
67
+ font-size: 15px;
68
+ }
69
+ .details {
70
+ margin-top: 16px;
71
+ font-family: var(--font-mono);
72
+ font-size: 13px;
73
+ color: var(--text-dim);
74
+ white-space: pre-wrap;
75
+ word-break: break-word;
76
+ }
77
+ </style>
78
+ </head>
79
+ <body>
80
+ <main>
81
+ <div class="logo">${LOGO_SVG}</div>
82
+ <h1>${heading}</h1>
83
+ <p>${message}</p>
84
+ ${details ? `<div class="details">${details}</div>` : ""}
85
+ </main>
86
+ </body>
87
+ </html>`;
88
+ }
89
+ function oauthSuccessHtml(message) {
90
+ return renderPage({
91
+ title: "Authentication successful",
92
+ heading: "Authentication successful",
93
+ message
94
+ });
95
+ }
96
+ function oauthErrorHtml(message, details) {
97
+ return renderPage({
98
+ title: "Authentication failed",
99
+ heading: "Authentication failed",
100
+ message,
101
+ details
102
+ });
103
+ }
104
+
105
+ // 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/pkce.js
106
+ function base64urlEncode(bytes) {
107
+ let binary = "";
108
+ for (const byte of bytes) {
109
+ binary += String.fromCharCode(byte);
110
+ }
111
+ return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "");
112
+ }
113
+ async function generatePKCE() {
114
+ const verifierBytes = new Uint8Array(32);
115
+ crypto.getRandomValues(verifierBytes);
116
+ const verifier = base64urlEncode(verifierBytes);
117
+ const encoder = new TextEncoder();
118
+ const data = encoder.encode(verifier);
119
+ const hashBuffer = await crypto.subtle.digest("SHA-256", data);
120
+ const challenge = base64urlEncode(new Uint8Array(hashBuffer));
121
+ return { verifier, challenge };
122
+ }
123
+
124
+ export {
125
+ oauthSuccessHtml,
126
+ oauthErrorHtml,
127
+ generatePKCE
128
+ };
package/dist/daemon.js CHANGED
@@ -67,7 +67,7 @@ import {
67
67
  writeCrashReportSync,
68
68
  writeDevicesFile,
69
69
  writeNodeDiagnosticReport
70
- } from "./chunk-TW6FURZ7.js";
70
+ } from "./chunk-PST63OUS.js";
71
71
  import {
72
72
  firstEnvValue,
73
73
  isLoopbackHost,
@@ -82,7 +82,7 @@ import {
82
82
  discardFailedItems,
83
83
  readMigrationFailureReport,
84
84
  rollbackFailedMigration
85
- } from "./chunk-XBHEYY65.js";
85
+ } from "./chunk-7JQBECUL.js";
86
86
  import {
87
87
  MIGRATION_ROLLED_BACK,
88
88
  MissingAssetError,
@@ -101,17 +101,22 @@ import {
101
101
  storagePaths,
102
102
  transferConversationEvent,
103
103
  transferredConversationEventSchema
104
- } from "./chunk-AJGPULMX.js";
105
- import "./chunk-BXVRC3HF.js";
106
- import "./chunk-L3YB2QLN.js";
104
+ } from "./chunk-6FSDDGFZ.js";
105
+ import "./chunk-BNVMNV4O.js";
106
+ import "./chunk-SHEU5KLD.js";
107
+ import "./chunk-4H3WR7IT.js";
108
+ import "./chunk-OANTMDXI.js";
109
+ import "./chunk-C6RO4LP3.js";
107
110
  import {
108
111
  configureManagedProcessRuntime,
109
112
  initializeManagedProcessHost
110
- } from "./chunk-HKLAYK2Z.js";
111
- import "./chunk-FESN7DND.js";
112
- import "./chunk-WXRYBXYR.js";
113
- import "./chunk-MN7PZ2PH.js";
114
- import "./chunk-24GQ74HM.js";
113
+ } from "./chunk-WRTA5G57.js";
114
+ import "./chunk-SU2USXTD.js";
115
+ import "./chunk-H2G55ZPG.js";
116
+ import "./chunk-TGKIV3F4.js";
117
+ import "./chunk-TSV3PFU2.js";
118
+ import "./chunk-UDC7NPQJ.js";
119
+ import "./chunk-XY53EFK3.js";
115
120
  import {
116
121
  __toESM
117
122
  } from "./chunk-CWESUMYQ.js";