@flowdular/sdk 0.1.0 → 0.2.1

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 (175) hide show
  1. package/.ai/skills/test-hardening/SKILL.md +1 -1
  2. package/README.md +69 -12
  3. package/assets/flowdular-banner.png +0 -0
  4. package/modules/agents/package.json +1 -1
  5. package/modules/auth/package.json +1 -1
  6. package/modules/auth/src/client/AuthenticationCore.tsrx +3 -1
  7. package/modules/auth/src/server/endpoints.ts +3 -1
  8. package/modules/auth/src/server/runtime.ts +4 -0
  9. package/modules/automations/package.json +1 -1
  10. package/modules/automations-workflows-integration/package.json +1 -1
  11. package/modules/profile/package.json +1 -1
  12. package/modules/sandbox/package.json +1 -1
  13. package/modules/system/package.json +1 -1
  14. package/modules/users/package.json +1 -1
  15. package/modules/workflows/package.json +1 -1
  16. package/package.json +5 -13
  17. package/packages/ai-provider/package.json +1 -1
  18. package/packages/cli-protocol/package.json +1 -1
  19. package/packages/client/package.json +1 -1
  20. package/packages/client/src/routing.ts +39 -2
  21. package/packages/client/src/shell/BrandMark.tsrx +5 -1
  22. package/packages/client/src/shell/navigation.ts +3 -1
  23. package/packages/client/src/state.ts +6 -2
  24. package/packages/contracts/package.json +1 -1
  25. package/packages/contracts/schemas/project.schema.json +16 -42
  26. package/packages/database/package.json +1 -1
  27. package/packages/database-pglite/package.json +2 -2
  28. package/packages/database-pglite/src/driver.ts +21 -3
  29. package/packages/database-testing/package.json +1 -1
  30. package/packages/dev-console/package.json +1 -1
  31. package/packages/harness/package.json +1 -1
  32. package/packages/kernel/package.json +1 -1
  33. package/packages/server/package.json +1 -1
  34. package/packages/server/src/application-routes.ts +80 -8
  35. package/packages/server/src/index.ts +4 -1
  36. package/packages/server/src/web-html.ts +9 -5
  37. package/packages/server/src/web.ts +59 -7
  38. package/packages/ui/package.json +1 -1
  39. package/packages/coding-agent/package.json +0 -44
  40. package/packages/coding-agent/src/drivers/byok.ts +0 -322
  41. package/packages/coding-agent/src/drivers/claude-code.ts +0 -290
  42. package/packages/coding-agent/src/drivers/codex.ts +0 -281
  43. package/packages/coding-agent/src/index.ts +0 -56
  44. package/packages/coding-agent/src/registry.ts +0 -119
  45. package/packages/coding-agent/src/roles/contract.ts +0 -60
  46. package/packages/coding-agent/src/roles/defaults.ts +0 -134
  47. package/packages/coding-agent/src/roles/handoff.ts +0 -41
  48. package/packages/coding-agent/src/roles/registry.ts +0 -156
  49. package/packages/coding-agent/src/roles/skills.ts +0 -72
  50. package/packages/coding-agent/src/roles/sync.ts +0 -88
  51. package/packages/coding-agent/src/types.ts +0 -102
  52. package/packages/coding-agent/src/workspace.ts +0 -275
  53. package/packages/sandbox/README.md +0 -691
  54. package/packages/sandbox/bin/flowdular-sandbox.mjs +0 -393
  55. package/packages/sandbox/dist/client/assets/App-ClMOrpyg.js +0 -11
  56. package/packages/sandbox/dist/client/assets/PreviewHost-BHiHrfbQ.js +0 -1
  57. package/packages/sandbox/dist/client/assets/auto-buGEq6de.js +0 -3
  58. package/packages/sandbox/dist/client/assets/ibm-plex-mono-cyrillic-400-normal-BSMlKf0J.woff2 +0 -0
  59. package/packages/sandbox/dist/client/assets/ibm-plex-mono-cyrillic-400-normal-CEL4l2ZJ.woff +0 -0
  60. package/packages/sandbox/dist/client/assets/ibm-plex-mono-cyrillic-500-normal-Ael50iVv.woff +0 -0
  61. package/packages/sandbox/dist/client/assets/ibm-plex-mono-cyrillic-500-normal-Bq9vWWag.woff2 +0 -0
  62. package/packages/sandbox/dist/client/assets/ibm-plex-mono-cyrillic-ext-400-normal-DMdlQ8Kv.woff +0 -0
  63. package/packages/sandbox/dist/client/assets/ibm-plex-mono-cyrillic-ext-400-normal-xuaO2J-f.woff2 +0 -0
  64. package/packages/sandbox/dist/client/assets/ibm-plex-mono-cyrillic-ext-500-normal-BIfNGwUT.woff +0 -0
  65. package/packages/sandbox/dist/client/assets/ibm-plex-mono-cyrillic-ext-500-normal-BqneJy0T.woff2 +0 -0
  66. package/packages/sandbox/dist/client/assets/ibm-plex-mono-latin-400-normal-CvHOgSBP.woff +0 -0
  67. package/packages/sandbox/dist/client/assets/ibm-plex-mono-latin-400-normal-DMJ8VG8y.woff2 +0 -0
  68. package/packages/sandbox/dist/client/assets/ibm-plex-mono-latin-500-normal-CB9ihrfo.woff +0 -0
  69. package/packages/sandbox/dist/client/assets/ibm-plex-mono-latin-500-normal-DSY6xOcd.woff2 +0 -0
  70. package/packages/sandbox/dist/client/assets/ibm-plex-mono-latin-ext-400-normal-BmRBH3aV.woff2 +0 -0
  71. package/packages/sandbox/dist/client/assets/ibm-plex-mono-latin-ext-400-normal-D3D2R8hC.woff +0 -0
  72. package/packages/sandbox/dist/client/assets/ibm-plex-mono-latin-ext-500-normal-CAhNIIs5.woff2 +0 -0
  73. package/packages/sandbox/dist/client/assets/ibm-plex-mono-latin-ext-500-normal-CZ70TYgx.woff +0 -0
  74. package/packages/sandbox/dist/client/assets/ibm-plex-mono-vietnamese-400-normal-BulugwFq.woff2 +0 -0
  75. package/packages/sandbox/dist/client/assets/ibm-plex-mono-vietnamese-400-normal-DDuiU_S-.woff +0 -0
  76. package/packages/sandbox/dist/client/assets/ibm-plex-mono-vietnamese-500-normal-C8zxqsMH.woff +0 -0
  77. package/packages/sandbox/dist/client/assets/ibm-plex-mono-vietnamese-500-normal-DZ4AoWbu.woff2 +0 -0
  78. package/packages/sandbox/dist/client/assets/ibm-plex-sans-cyrillic-ext-wght-normal-d45eAU9y.woff2 +0 -0
  79. package/packages/sandbox/dist/client/assets/ibm-plex-sans-cyrillic-wght-normal-BAAhND-U.woff2 +0 -0
  80. package/packages/sandbox/dist/client/assets/ibm-plex-sans-greek-wght-normal-CmyJS8uq.woff2 +0 -0
  81. package/packages/sandbox/dist/client/assets/ibm-plex-sans-latin-ext-wght-normal-CIII54If.woff2 +0 -0
  82. package/packages/sandbox/dist/client/assets/ibm-plex-sans-latin-wght-normal-IvpUvPa2.woff2 +0 -0
  83. package/packages/sandbox/dist/client/assets/ibm-plex-sans-vietnamese-wght-normal-Dg1JeJN0.woff2 +0 -0
  84. package/packages/sandbox/dist/client/assets/index-CvwhlQ87.js +0 -4
  85. package/packages/sandbox/dist/client/assets/styles-BPWaGf55.js +0 -3
  86. package/packages/sandbox/dist/client/assets/styles-Dx1_KOag.css +0 -1
  87. package/packages/sandbox/dist/client/favicon.svg +0 -1
  88. package/packages/sandbox/dist/server/assets/auto-CVGNYyb3.js +0 -12785
  89. package/packages/sandbox/dist/server/assets/chunk-DDJLRBDX-3OUNo51g.js +0 -4125
  90. package/packages/sandbox/dist/server/assets/nodefs-DVSI7kG0.js +0 -24
  91. package/packages/sandbox/dist/server/assets/opfs-ahp-D56iokt1.js +0 -388
  92. package/packages/sandbox/dist/server/assets/token-Bvaq7Anz.js +0 -55
  93. package/packages/sandbox/dist/server/assets/token-util-BqSvdIPQ.js +0 -3
  94. package/packages/sandbox/dist/server/assets/token-util-CktFFT4z.js +0 -494
  95. package/packages/sandbox/dist/server/entry.js +0 -91671
  96. package/packages/sandbox/dist/server/favicon.svg +0 -1
  97. package/packages/sandbox/dist/server/index.html +0 -161
  98. package/packages/sandbox/index.html +0 -159
  99. package/packages/sandbox/octane.config.ts +0 -36
  100. package/packages/sandbox/package.json +0 -83
  101. package/packages/sandbox/public/favicon.svg +0 -1
  102. package/packages/sandbox/public/og.png +0 -0
  103. package/packages/sandbox/src/App.tsrx +0 -924
  104. package/packages/sandbox/src/client/ApprovalHandoff.tsrx +0 -39
  105. package/packages/sandbox/src/client/ChatPane.tsrx +0 -694
  106. package/packages/sandbox/src/client/ConnectView.tsrx +0 -86
  107. package/packages/sandbox/src/client/DiffPane.tsrx +0 -150
  108. package/packages/sandbox/src/client/EjectModal.tsrx +0 -571
  109. package/packages/sandbox/src/client/GateResults.tsrx +0 -60
  110. package/packages/sandbox/src/client/GitHubSettingsModal.tsrx +0 -219
  111. package/packages/sandbox/src/client/NewSessionForm.tsrx +0 -214
  112. package/packages/sandbox/src/client/SessionBar.tsrx +0 -151
  113. package/packages/sandbox/src/client/SessionPicker.tsrx +0 -472
  114. package/packages/sandbox/src/client/SpecEditor.tsrx +0 -109
  115. package/packages/sandbox/src/client/SpecReviewCard.tsrx +0 -321
  116. package/packages/sandbox/src/client/WorkCard.tsrx +0 -128
  117. package/packages/sandbox/src/client/WorkbenchModal.tsrx +0 -161
  118. package/packages/sandbox/src/client/WorkspaceMenu.tsrx +0 -100
  119. package/packages/sandbox/src/client/api.ts +0 -797
  120. package/packages/sandbox/src/client/attachments.ts +0 -73
  121. package/packages/sandbox/src/client/dashboard.ts +0 -46
  122. package/packages/sandbox/src/client/github-settings.ts +0 -48
  123. package/packages/sandbox/src/client/highlight.ts +0 -105
  124. package/packages/sandbox/src/client/i18n.ts +0 -32
  125. package/packages/sandbox/src/client/locales/en.json +0 -466
  126. package/packages/sandbox/src/client/locales/pl.json +0 -466
  127. package/packages/sandbox/src/client/session-labels.ts +0 -77
  128. package/packages/sandbox/src/client/state.ts +0 -108
  129. package/packages/sandbox/src/index.ts +0 -10
  130. package/packages/sandbox/src/preview/PreviewHost.tsrx +0 -373
  131. package/packages/sandbox/src/preview/load-module.ts +0 -16
  132. package/packages/sandbox/src/server/attachments.ts +0 -308
  133. package/packages/sandbox/src/server/auto-review.ts +0 -181
  134. package/packages/sandbox/src/server/checkpoints.ts +0 -90
  135. package/packages/sandbox/src/server/config.ts +0 -460
  136. package/packages/sandbox/src/server/dashboard.ts +0 -245
  137. package/packages/sandbox/src/server/delivery/configuration.ts +0 -193
  138. package/packages/sandbox/src/server/delivery/git-pr.ts +0 -1473
  139. package/packages/sandbox/src/server/delivery/index.ts +0 -83
  140. package/packages/sandbox/src/server/delivery/local.ts +0 -151
  141. package/packages/sandbox/src/server/delivery/official-modules.ts +0 -516
  142. package/packages/sandbox/src/server/delivery/plan.ts +0 -218
  143. package/packages/sandbox/src/server/delivery/policies.ts +0 -239
  144. package/packages/sandbox/src/server/delivery/record.ts +0 -41
  145. package/packages/sandbox/src/server/delivery/steps.ts +0 -464
  146. package/packages/sandbox/src/server/delivery/types.ts +0 -158
  147. package/packages/sandbox/src/server/dependencies.ts +0 -88
  148. package/packages/sandbox/src/server/diff.ts +0 -230
  149. package/packages/sandbox/src/server/gates.ts +0 -388
  150. package/packages/sandbox/src/server/index.ts +0 -139
  151. package/packages/sandbox/src/server/path-guard.ts +0 -282
  152. package/packages/sandbox/src/server/planning.ts +0 -749
  153. package/packages/sandbox/src/server/platform-client.ts +0 -189
  154. package/packages/sandbox/src/server/preview-database-host.ts +0 -340
  155. package/packages/sandbox/src/server/preview-database-protocol.ts +0 -163
  156. package/packages/sandbox/src/server/preview-database-proxy.ts +0 -356
  157. package/packages/sandbox/src/server/preview-database.ts +0 -109
  158. package/packages/sandbox/src/server/preview-ipc.ts +0 -15
  159. package/packages/sandbox/src/server/preview-modules.ts +0 -83
  160. package/packages/sandbox/src/server/preview-revision.ts +0 -44
  161. package/packages/sandbox/src/server/preview-runtime.ts +0 -467
  162. package/packages/sandbox/src/server/preview-worker-manager.ts +0 -436
  163. package/packages/sandbox/src/server/preview-worker.ts +0 -168
  164. package/packages/sandbox/src/server/reference.ts +0 -251
  165. package/packages/sandbox/src/server/routes.ts +0 -2258
  166. package/packages/sandbox/src/server/runtime.ts +0 -188
  167. package/packages/sandbox/src/server/session-owner.ts +0 -23
  168. package/packages/sandbox/src/server/sessions.ts +0 -849
  169. package/packages/sandbox/src/server/spec.ts +0 -471
  170. package/packages/sandbox/src/server/turn-lifecycle.ts +0 -56
  171. package/packages/sandbox/src/server/turns.ts +0 -993
  172. package/packages/sandbox/src/server/workspace-install.ts +0 -266
  173. package/packages/sandbox/src/server/workspace-root.ts +0 -73
  174. package/packages/sandbox/src/styles.css +0 -1573
  175. package/packages/sandbox/vite.config.ts +0 -133
@@ -1,494 +0,0 @@
1
- import { createRequire } from "node:module";
2
- //#region \0rolldown/runtime.js
3
- var __create = Object.create;
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getProtoOf = Object.getPrototypeOf;
8
- var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
10
- var __exportAll = (all, no_symbols) => {
11
- let target = {};
12
- for (var name in all) __defProp(target, name, {
13
- get: all[name],
14
- enumerable: true
15
- });
16
- if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
17
- return target;
18
- };
19
- var __copyProps = (to, from, except, desc) => {
20
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
21
- key = keys[i];
22
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
23
- get: ((k) => from[k]).bind(null, key),
24
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
25
- });
26
- }
27
- return to;
28
- };
29
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
30
- value: mod,
31
- enumerable: true
32
- }) : target, mod));
33
- var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
34
- //#endregion
35
- //#region ../../node_modules/.pnpm/@vercel+oidc@3.2.0/node_modules/@vercel/oidc/dist/token-error.js
36
- var require_token_error = /* @__PURE__ */ __commonJSMin(((exports, module) => {
37
- var __defProp = Object.defineProperty;
38
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
39
- var __getOwnPropNames = Object.getOwnPropertyNames;
40
- var __hasOwnProp = Object.prototype.hasOwnProperty;
41
- var __export = (target, all) => {
42
- for (var name in all) __defProp(target, name, {
43
- get: all[name],
44
- enumerable: true
45
- });
46
- };
47
- var __copyProps = (to, from, except, desc) => {
48
- if (from && typeof from === "object" || typeof from === "function") {
49
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
50
- get: () => from[key],
51
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
52
- });
53
- }
54
- return to;
55
- };
56
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
57
- var token_error_exports = {};
58
- __export(token_error_exports, { VercelOidcTokenError: () => VercelOidcTokenError });
59
- module.exports = __toCommonJS(token_error_exports);
60
- var VercelOidcTokenError = class extends Error {
61
- constructor(message, cause) {
62
- super(message);
63
- this.name = "VercelOidcTokenError";
64
- this.cause = cause;
65
- }
66
- toString() {
67
- if (this.cause) return `${this.name}: ${this.message}: ${this.cause}`;
68
- return `${this.name}: ${this.message}`;
69
- }
70
- };
71
- 0 && (module.exports = { VercelOidcTokenError });
72
- }));
73
- //#endregion
74
- //#region ../../node_modules/.pnpm/@vercel+oidc@3.2.0/node_modules/@vercel/oidc/dist/auth-errors.js
75
- var require_auth_errors = /* @__PURE__ */ __commonJSMin(((exports, module) => {
76
- var __defProp = Object.defineProperty;
77
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
78
- var __getOwnPropNames = Object.getOwnPropertyNames;
79
- var __hasOwnProp = Object.prototype.hasOwnProperty;
80
- var __export = (target, all) => {
81
- for (var name in all) __defProp(target, name, {
82
- get: all[name],
83
- enumerable: true
84
- });
85
- };
86
- var __copyProps = (to, from, except, desc) => {
87
- if (from && typeof from === "object" || typeof from === "function") {
88
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
89
- get: () => from[key],
90
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
91
- });
92
- }
93
- return to;
94
- };
95
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
96
- var auth_errors_exports = {};
97
- __export(auth_errors_exports, {
98
- AccessTokenMissingError: () => AccessTokenMissingError,
99
- RefreshAccessTokenFailedError: () => RefreshAccessTokenFailedError
100
- });
101
- module.exports = __toCommonJS(auth_errors_exports);
102
- var AccessTokenMissingError = class extends Error {
103
- constructor() {
104
- super("No authentication found. Please log in with the Vercel CLI (vercel login).");
105
- this.name = "AccessTokenMissingError";
106
- }
107
- };
108
- var RefreshAccessTokenFailedError = class extends Error {
109
- constructor(cause) {
110
- super("Failed to refresh authentication token.", { cause });
111
- this.name = "RefreshAccessTokenFailedError";
112
- }
113
- };
114
- 0 && (module.exports = {
115
- AccessTokenMissingError,
116
- RefreshAccessTokenFailedError
117
- });
118
- }));
119
- //#endregion
120
- //#region ../../node_modules/.pnpm/@vercel+oidc@3.2.0/node_modules/@vercel/oidc/dist/token-io.js
121
- var require_token_io = /* @__PURE__ */ __commonJSMin(((exports, module) => {
122
- var __create = Object.create;
123
- var __defProp = Object.defineProperty;
124
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
125
- var __getOwnPropNames = Object.getOwnPropertyNames;
126
- var __getProtoOf = Object.getPrototypeOf;
127
- var __hasOwnProp = Object.prototype.hasOwnProperty;
128
- var __export = (target, all) => {
129
- for (var name in all) __defProp(target, name, {
130
- get: all[name],
131
- enumerable: true
132
- });
133
- };
134
- var __copyProps = (to, from, except, desc) => {
135
- if (from && typeof from === "object" || typeof from === "function") {
136
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
137
- get: () => from[key],
138
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
139
- });
140
- }
141
- return to;
142
- };
143
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
144
- value: mod,
145
- enumerable: true
146
- }) : target, mod));
147
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
148
- var token_io_exports = {};
149
- __export(token_io_exports, {
150
- findRootDir: () => findRootDir,
151
- getUserDataDir: () => getUserDataDir
152
- });
153
- module.exports = __toCommonJS(token_io_exports);
154
- var import_path = __toESM(__require("path"));
155
- var import_fs = __toESM(__require("fs"));
156
- var import_os$1 = __toESM(__require("os"));
157
- var import_token_error = require_token_error();
158
- function findRootDir() {
159
- try {
160
- let dir = process.cwd();
161
- while (dir !== import_path.default.dirname(dir)) {
162
- const pkgPath = import_path.default.join(dir, ".vercel");
163
- if (import_fs.default.existsSync(pkgPath)) return dir;
164
- dir = import_path.default.dirname(dir);
165
- }
166
- } catch (e) {
167
- throw new import_token_error.VercelOidcTokenError("Token refresh only supported in node server environments");
168
- }
169
- return null;
170
- }
171
- function getUserDataDir() {
172
- if (process.env.XDG_DATA_HOME) return process.env.XDG_DATA_HOME;
173
- switch (import_os$1.default.platform()) {
174
- case "darwin": return import_path.default.join(import_os$1.default.homedir(), "Library/Application Support");
175
- case "linux": return import_path.default.join(import_os$1.default.homedir(), ".local/share");
176
- case "win32":
177
- if (process.env.LOCALAPPDATA) return process.env.LOCALAPPDATA;
178
- return null;
179
- default: return null;
180
- }
181
- }
182
- 0 && (module.exports = {
183
- findRootDir,
184
- getUserDataDir
185
- });
186
- }));
187
- //#endregion
188
- //#region ../../node_modules/.pnpm/@vercel+oidc@3.2.0/node_modules/@vercel/oidc/dist/auth-config.js
189
- var require_auth_config = /* @__PURE__ */ __commonJSMin(((exports, module) => {
190
- var __create = Object.create;
191
- var __defProp = Object.defineProperty;
192
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
193
- var __getOwnPropNames = Object.getOwnPropertyNames;
194
- var __getProtoOf = Object.getPrototypeOf;
195
- var __hasOwnProp = Object.prototype.hasOwnProperty;
196
- var __export = (target, all) => {
197
- for (var name in all) __defProp(target, name, {
198
- get: all[name],
199
- enumerable: true
200
- });
201
- };
202
- var __copyProps = (to, from, except, desc) => {
203
- if (from && typeof from === "object" || typeof from === "function") {
204
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
205
- get: () => from[key],
206
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
207
- });
208
- }
209
- return to;
210
- };
211
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
212
- value: mod,
213
- enumerable: true
214
- }) : target, mod));
215
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
216
- var auth_config_exports = {};
217
- __export(auth_config_exports, {
218
- isValidAccessToken: () => isValidAccessToken,
219
- readAuthConfig: () => readAuthConfig,
220
- writeAuthConfig: () => writeAuthConfig
221
- });
222
- module.exports = __toCommonJS(auth_config_exports);
223
- var fs$1 = __toESM(__require("fs"));
224
- var path$1 = __toESM(__require("path"));
225
- var import_token_util = require_token_util();
226
- function getAuthConfigPath() {
227
- const dataDir = (0, import_token_util.getVercelDataDir)();
228
- if (!dataDir) throw new Error(`Unable to find Vercel CLI data directory. Your platform: ${process.platform}. Supported: darwin, linux, win32.`);
229
- return path$1.join(dataDir, "auth.json");
230
- }
231
- function readAuthConfig() {
232
- try {
233
- const authPath = getAuthConfigPath();
234
- if (!fs$1.existsSync(authPath)) return null;
235
- const content = fs$1.readFileSync(authPath, "utf8");
236
- if (!content) return null;
237
- return JSON.parse(content);
238
- } catch (error) {
239
- return null;
240
- }
241
- }
242
- function writeAuthConfig(config) {
243
- const authPath = getAuthConfigPath();
244
- const authDir = path$1.dirname(authPath);
245
- if (!fs$1.existsSync(authDir)) fs$1.mkdirSync(authDir, {
246
- mode: 504,
247
- recursive: true
248
- });
249
- fs$1.writeFileSync(authPath, JSON.stringify(config, null, 2), { mode: 384 });
250
- }
251
- function isValidAccessToken(authConfig, expirationBufferMs = 0) {
252
- if (!authConfig.token) return false;
253
- if (typeof authConfig.expiresAt !== "number") return true;
254
- const nowInSeconds = Math.floor(Date.now() / 1e3);
255
- const bufferInSeconds = expirationBufferMs / 1e3;
256
- return authConfig.expiresAt >= nowInSeconds + bufferInSeconds;
257
- }
258
- 0 && (module.exports = {
259
- isValidAccessToken,
260
- readAuthConfig,
261
- writeAuthConfig
262
- });
263
- }));
264
- //#endregion
265
- //#region ../../node_modules/.pnpm/@vercel+oidc@3.2.0/node_modules/@vercel/oidc/dist/oauth.js
266
- var require_oauth = /* @__PURE__ */ __commonJSMin(((exports, module) => {
267
- var __defProp = Object.defineProperty;
268
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
269
- var __getOwnPropNames = Object.getOwnPropertyNames;
270
- var __hasOwnProp = Object.prototype.hasOwnProperty;
271
- var __export = (target, all) => {
272
- for (var name in all) __defProp(target, name, {
273
- get: all[name],
274
- enumerable: true
275
- });
276
- };
277
- var __copyProps = (to, from, except, desc) => {
278
- if (from && typeof from === "object" || typeof from === "function") {
279
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
280
- get: () => from[key],
281
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
282
- });
283
- }
284
- return to;
285
- };
286
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
287
- var oauth_exports = {};
288
- __export(oauth_exports, {
289
- processTokenResponse: () => processTokenResponse,
290
- refreshTokenRequest: () => refreshTokenRequest
291
- });
292
- module.exports = __toCommonJS(oauth_exports);
293
- var import_os = __require("os");
294
- var VERCEL_ISSUER = "https://vercel.com";
295
- var VERCEL_CLI_CLIENT_ID = "cl_HYyOPBNtFMfHhaUn9L4QPfTZz6TP47bp";
296
- var userAgent = `@vercel/oidc node-${process.version} ${(0, import_os.platform)()} (${(0, import_os.arch)()}) ${(0, import_os.hostname)()}`;
297
- var _tokenEndpoint = null;
298
- async function getTokenEndpoint() {
299
- if (_tokenEndpoint) return _tokenEndpoint;
300
- const response = await fetch(`${VERCEL_ISSUER}/.well-known/openid-configuration`, { headers: { "user-agent": userAgent } });
301
- if (!response.ok) throw new Error("Failed to discover OAuth endpoints");
302
- const metadata = await response.json();
303
- if (!metadata || typeof metadata.token_endpoint !== "string") throw new Error("Invalid OAuth discovery response");
304
- const endpoint = metadata.token_endpoint;
305
- _tokenEndpoint = endpoint;
306
- return endpoint;
307
- }
308
- async function refreshTokenRequest(options) {
309
- const tokenEndpoint = await getTokenEndpoint();
310
- return await fetch(tokenEndpoint, {
311
- method: "POST",
312
- headers: {
313
- "Content-Type": "application/x-www-form-urlencoded",
314
- "user-agent": userAgent
315
- },
316
- body: new URLSearchParams({
317
- client_id: VERCEL_CLI_CLIENT_ID,
318
- grant_type: "refresh_token",
319
- ...options
320
- })
321
- });
322
- }
323
- async function processTokenResponse(response) {
324
- const json = await response.json();
325
- if (!response.ok) {
326
- const errorMsg = typeof json === "object" && json && "error" in json ? String(json.error) : "Token refresh failed";
327
- return [new Error(errorMsg)];
328
- }
329
- if (typeof json !== "object" || json === null) return [/* @__PURE__ */ new Error("Invalid token response")];
330
- if (typeof json.access_token !== "string") return [/* @__PURE__ */ new Error("Missing access_token in response")];
331
- if (json.token_type !== "Bearer") return [/* @__PURE__ */ new Error("Invalid token_type in response")];
332
- if (typeof json.expires_in !== "number") return [/* @__PURE__ */ new Error("Missing expires_in in response")];
333
- return [null, json];
334
- }
335
- 0 && (module.exports = {
336
- processTokenResponse,
337
- refreshTokenRequest
338
- });
339
- }));
340
- //#endregion
341
- //#region ../../node_modules/.pnpm/@vercel+oidc@3.2.0/node_modules/@vercel/oidc/dist/token-util.js
342
- var require_token_util = /* @__PURE__ */ __commonJSMin(((exports, module) => {
343
- var __create = Object.create;
344
- var __defProp = Object.defineProperty;
345
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
346
- var __getOwnPropNames = Object.getOwnPropertyNames;
347
- var __getProtoOf = Object.getPrototypeOf;
348
- var __hasOwnProp = Object.prototype.hasOwnProperty;
349
- var __export = (target, all) => {
350
- for (var name in all) __defProp(target, name, {
351
- get: all[name],
352
- enumerable: true
353
- });
354
- };
355
- var __copyProps = (to, from, except, desc) => {
356
- if (from && typeof from === "object" || typeof from === "function") {
357
- for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
358
- get: () => from[key],
359
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
360
- });
361
- }
362
- return to;
363
- };
364
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
365
- value: mod,
366
- enumerable: true
367
- }) : target, mod));
368
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
369
- var token_util_exports = {};
370
- __export(token_util_exports, {
371
- assertVercelOidcTokenResponse: () => assertVercelOidcTokenResponse,
372
- findProjectInfo: () => findProjectInfo,
373
- getTokenPayload: () => getTokenPayload,
374
- getVercelDataDir: () => getVercelDataDir,
375
- getVercelOidcToken: () => getVercelOidcToken,
376
- getVercelToken: () => getVercelToken,
377
- isExpired: () => isExpired,
378
- loadToken: () => loadToken,
379
- saveToken: () => saveToken
380
- });
381
- module.exports = __toCommonJS(token_util_exports);
382
- var path = __toESM(__require("path"));
383
- var fs = __toESM(__require("fs"));
384
- var import_token_error = require_token_error();
385
- var import_token_io = require_token_io();
386
- var import_auth_config = require_auth_config();
387
- var import_oauth = require_oauth();
388
- var import_auth_errors = require_auth_errors();
389
- function getVercelDataDir() {
390
- const vercelFolder = "com.vercel.cli";
391
- const dataDir = (0, import_token_io.getUserDataDir)();
392
- if (!dataDir) return null;
393
- return path.join(dataDir, vercelFolder);
394
- }
395
- async function getVercelToken(options) {
396
- const authConfig = (0, import_auth_config.readAuthConfig)();
397
- if (!authConfig?.token) throw new import_auth_errors.AccessTokenMissingError();
398
- if ((0, import_auth_config.isValidAccessToken)(authConfig, options?.expirationBufferMs)) return authConfig.token;
399
- if (!authConfig.refreshToken) {
400
- (0, import_auth_config.writeAuthConfig)({});
401
- throw new import_auth_errors.RefreshAccessTokenFailedError("No refresh token available");
402
- }
403
- try {
404
- const tokenResponse = await (0, import_oauth.refreshTokenRequest)({ refresh_token: authConfig.refreshToken });
405
- const [tokensError, tokens] = await (0, import_oauth.processTokenResponse)(tokenResponse);
406
- if (tokensError || !tokens) {
407
- (0, import_auth_config.writeAuthConfig)({});
408
- throw new import_auth_errors.RefreshAccessTokenFailedError(tokensError);
409
- }
410
- const updatedConfig = {
411
- token: tokens.access_token,
412
- expiresAt: Math.floor(Date.now() / 1e3) + tokens.expires_in
413
- };
414
- if (tokens.refresh_token) updatedConfig.refreshToken = tokens.refresh_token;
415
- (0, import_auth_config.writeAuthConfig)(updatedConfig);
416
- return updatedConfig.token;
417
- } catch (error) {
418
- (0, import_auth_config.writeAuthConfig)({});
419
- if (error instanceof import_auth_errors.AccessTokenMissingError || error instanceof import_auth_errors.RefreshAccessTokenFailedError) throw error;
420
- throw new import_auth_errors.RefreshAccessTokenFailedError(error);
421
- }
422
- }
423
- async function getVercelOidcToken(authToken, projectId, teamId) {
424
- const url = `https://api.vercel.com/v1/projects/${projectId}/token?source=vercel-oidc-refresh${teamId ? `&teamId=${teamId}` : ""}`;
425
- const res = await fetch(url, {
426
- method: "POST",
427
- headers: { Authorization: `Bearer ${authToken}` }
428
- });
429
- if (!res.ok) throw new import_token_error.VercelOidcTokenError(`Failed to refresh OIDC token: ${res.statusText}`);
430
- const tokenRes = await res.json();
431
- assertVercelOidcTokenResponse(tokenRes);
432
- return tokenRes;
433
- }
434
- function assertVercelOidcTokenResponse(res) {
435
- if (!res || typeof res !== "object") throw new TypeError("Vercel OIDC token is malformed. Expected an object. Please run `vc env pull` and try again");
436
- if (!("token" in res) || typeof res.token !== "string") throw new TypeError("Vercel OIDC token is malformed. Expected a string-valued token property. Please run `vc env pull` and try again");
437
- }
438
- function findProjectInfo() {
439
- const dir = (0, import_token_io.findRootDir)();
440
- if (!dir) throw new import_token_error.VercelOidcTokenError("Unable to find project root directory. Have you linked your project with `vc link?`");
441
- const prjPath = path.join(dir, ".vercel", "project.json");
442
- if (!fs.existsSync(prjPath)) throw new import_token_error.VercelOidcTokenError("project.json not found, have you linked your project with `vc link?`");
443
- const prj = JSON.parse(fs.readFileSync(prjPath, "utf8"));
444
- if (typeof prj.projectId !== "string" && typeof prj.orgId !== "string") throw new TypeError("Expected a string-valued projectId property. Try running `vc link` to re-link your project.");
445
- return {
446
- projectId: prj.projectId,
447
- teamId: prj.orgId
448
- };
449
- }
450
- function saveToken(token, projectId) {
451
- const dir = (0, import_token_io.getUserDataDir)();
452
- if (!dir) throw new import_token_error.VercelOidcTokenError("Unable to find user data directory. Please reach out to Vercel support.");
453
- const tokenPath = path.join(dir, "com.vercel.token", `${projectId}.json`);
454
- const tokenJson = JSON.stringify(token);
455
- fs.mkdirSync(path.dirname(tokenPath), {
456
- mode: 504,
457
- recursive: true
458
- });
459
- fs.writeFileSync(tokenPath, tokenJson);
460
- fs.chmodSync(tokenPath, 432);
461
- }
462
- function loadToken(projectId) {
463
- const dir = (0, import_token_io.getUserDataDir)();
464
- if (!dir) throw new import_token_error.VercelOidcTokenError("Unable to find user data directory. Please reach out to Vercel support.");
465
- const tokenPath = path.join(dir, "com.vercel.token", `${projectId}.json`);
466
- if (!fs.existsSync(tokenPath)) return null;
467
- const token = JSON.parse(fs.readFileSync(tokenPath, "utf8"));
468
- assertVercelOidcTokenResponse(token);
469
- return token;
470
- }
471
- function getTokenPayload(token) {
472
- const tokenParts = token.split(".");
473
- if (tokenParts.length !== 3) throw new import_token_error.VercelOidcTokenError("Invalid token. Please run `vc env pull` and try again");
474
- const base64 = tokenParts[1].replace(/-/g, "+").replace(/_/g, "/");
475
- const padded = base64.padEnd(base64.length + (4 - base64.length % 4) % 4, "=");
476
- return JSON.parse(Buffer.from(padded, "base64").toString("utf8"));
477
- }
478
- function isExpired(token, bufferMs = 0) {
479
- return token.exp * 1e3 < Date.now() + bufferMs;
480
- }
481
- 0 && (module.exports = {
482
- assertVercelOidcTokenResponse,
483
- findProjectInfo,
484
- getTokenPayload,
485
- getVercelDataDir,
486
- getVercelOidcToken,
487
- getVercelToken,
488
- isExpired,
489
- loadToken,
490
- saveToken
491
- });
492
- }));
493
- //#endregion
494
- export { __exportAll as a, __commonJSMin as i, require_auth_errors as n, __require as o, require_token_error as r, __toESM as s, require_token_util as t };