@flowdular/sandbox 0.2.0

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 (139) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +696 -0
  3. package/bin/flowdular-sandbox.mjs +394 -0
  4. package/bin/register-types.mjs +53 -0
  5. package/dist/client/assets/App-ClMOrpyg.js +11 -0
  6. package/dist/client/assets/PreviewHost-BHiHrfbQ.js +1 -0
  7. package/dist/client/assets/auto-buGEq6de.js +3 -0
  8. package/dist/client/assets/ibm-plex-mono-cyrillic-400-normal-BSMlKf0J.woff2 +0 -0
  9. package/dist/client/assets/ibm-plex-mono-cyrillic-400-normal-CEL4l2ZJ.woff +0 -0
  10. package/dist/client/assets/ibm-plex-mono-cyrillic-500-normal-Ael50iVv.woff +0 -0
  11. package/dist/client/assets/ibm-plex-mono-cyrillic-500-normal-Bq9vWWag.woff2 +0 -0
  12. package/dist/client/assets/ibm-plex-mono-cyrillic-ext-400-normal-DMdlQ8Kv.woff +0 -0
  13. package/dist/client/assets/ibm-plex-mono-cyrillic-ext-400-normal-xuaO2J-f.woff2 +0 -0
  14. package/dist/client/assets/ibm-plex-mono-cyrillic-ext-500-normal-BIfNGwUT.woff +0 -0
  15. package/dist/client/assets/ibm-plex-mono-cyrillic-ext-500-normal-BqneJy0T.woff2 +0 -0
  16. package/dist/client/assets/ibm-plex-mono-latin-400-normal-CvHOgSBP.woff +0 -0
  17. package/dist/client/assets/ibm-plex-mono-latin-400-normal-DMJ8VG8y.woff2 +0 -0
  18. package/dist/client/assets/ibm-plex-mono-latin-500-normal-CB9ihrfo.woff +0 -0
  19. package/dist/client/assets/ibm-plex-mono-latin-500-normal-DSY6xOcd.woff2 +0 -0
  20. package/dist/client/assets/ibm-plex-mono-latin-ext-400-normal-BmRBH3aV.woff2 +0 -0
  21. package/dist/client/assets/ibm-plex-mono-latin-ext-400-normal-D3D2R8hC.woff +0 -0
  22. package/dist/client/assets/ibm-plex-mono-latin-ext-500-normal-CAhNIIs5.woff2 +0 -0
  23. package/dist/client/assets/ibm-plex-mono-latin-ext-500-normal-CZ70TYgx.woff +0 -0
  24. package/dist/client/assets/ibm-plex-mono-vietnamese-400-normal-BulugwFq.woff2 +0 -0
  25. package/dist/client/assets/ibm-plex-mono-vietnamese-400-normal-DDuiU_S-.woff +0 -0
  26. package/dist/client/assets/ibm-plex-mono-vietnamese-500-normal-C8zxqsMH.woff +0 -0
  27. package/dist/client/assets/ibm-plex-mono-vietnamese-500-normal-DZ4AoWbu.woff2 +0 -0
  28. package/dist/client/assets/ibm-plex-sans-cyrillic-ext-wght-normal-d45eAU9y.woff2 +0 -0
  29. package/dist/client/assets/ibm-plex-sans-cyrillic-wght-normal-BAAhND-U.woff2 +0 -0
  30. package/dist/client/assets/ibm-plex-sans-greek-wght-normal-CmyJS8uq.woff2 +0 -0
  31. package/dist/client/assets/ibm-plex-sans-latin-ext-wght-normal-CIII54If.woff2 +0 -0
  32. package/dist/client/assets/ibm-plex-sans-latin-wght-normal-IvpUvPa2.woff2 +0 -0
  33. package/dist/client/assets/ibm-plex-sans-vietnamese-wght-normal-Dg1JeJN0.woff2 +0 -0
  34. package/dist/client/assets/index-CvwhlQ87.js +4 -0
  35. package/dist/client/assets/styles-BPWaGf55.js +3 -0
  36. package/dist/client/assets/styles-Dx1_KOag.css +1 -0
  37. package/dist/client/favicon.svg +1 -0
  38. package/dist/server/assets/auto-CVGNYyb3.js +12785 -0
  39. package/dist/server/assets/chunk-DDJLRBDX-3OUNo51g.js +4125 -0
  40. package/dist/server/assets/nodefs-DVSI7kG0.js +24 -0
  41. package/dist/server/assets/opfs-ahp-D56iokt1.js +388 -0
  42. package/dist/server/assets/token-Bvaq7Anz.js +55 -0
  43. package/dist/server/assets/token-util-BqSvdIPQ.js +3 -0
  44. package/dist/server/assets/token-util-CktFFT4z.js +494 -0
  45. package/dist/server/entry.js +91671 -0
  46. package/dist/server/favicon.svg +1 -0
  47. package/dist/server/index.html +161 -0
  48. package/index.html +159 -0
  49. package/internal/coding-agent/package.json +44 -0
  50. package/internal/coding-agent/src/drivers/byok.ts +322 -0
  51. package/internal/coding-agent/src/drivers/claude-code.ts +290 -0
  52. package/internal/coding-agent/src/drivers/codex.ts +281 -0
  53. package/internal/coding-agent/src/index.ts +56 -0
  54. package/internal/coding-agent/src/registry.ts +119 -0
  55. package/internal/coding-agent/src/roles/contract.ts +60 -0
  56. package/internal/coding-agent/src/roles/defaults.ts +134 -0
  57. package/internal/coding-agent/src/roles/handoff.ts +41 -0
  58. package/internal/coding-agent/src/roles/registry.ts +156 -0
  59. package/internal/coding-agent/src/roles/skills.ts +72 -0
  60. package/internal/coding-agent/src/roles/sync.ts +88 -0
  61. package/internal/coding-agent/src/types.ts +102 -0
  62. package/internal/coding-agent/src/workspace.ts +275 -0
  63. package/octane.config.ts +36 -0
  64. package/package.json +68 -0
  65. package/public/favicon.svg +1 -0
  66. package/public/og.png +0 -0
  67. package/src/App.tsrx +924 -0
  68. package/src/client/ApprovalHandoff.tsrx +39 -0
  69. package/src/client/ChatPane.tsrx +694 -0
  70. package/src/client/ConnectView.tsrx +86 -0
  71. package/src/client/DiffPane.tsrx +150 -0
  72. package/src/client/EjectModal.tsrx +571 -0
  73. package/src/client/GateResults.tsrx +60 -0
  74. package/src/client/GitHubSettingsModal.tsrx +219 -0
  75. package/src/client/NewSessionForm.tsrx +214 -0
  76. package/src/client/SessionBar.tsrx +151 -0
  77. package/src/client/SessionPicker.tsrx +472 -0
  78. package/src/client/SpecEditor.tsrx +109 -0
  79. package/src/client/SpecReviewCard.tsrx +321 -0
  80. package/src/client/WorkCard.tsrx +128 -0
  81. package/src/client/WorkbenchModal.tsrx +161 -0
  82. package/src/client/WorkspaceMenu.tsrx +100 -0
  83. package/src/client/api.ts +797 -0
  84. package/src/client/attachments.ts +73 -0
  85. package/src/client/dashboard.ts +46 -0
  86. package/src/client/github-settings.ts +48 -0
  87. package/src/client/highlight.ts +105 -0
  88. package/src/client/i18n.ts +32 -0
  89. package/src/client/locales/en.json +466 -0
  90. package/src/client/locales/pl.json +466 -0
  91. package/src/client/session-labels.ts +77 -0
  92. package/src/client/state.ts +108 -0
  93. package/src/index.ts +10 -0
  94. package/src/preview/PreviewHost.tsrx +373 -0
  95. package/src/preview/load-module.ts +16 -0
  96. package/src/server/attachments.ts +308 -0
  97. package/src/server/auto-review.ts +181 -0
  98. package/src/server/checkpoints.ts +90 -0
  99. package/src/server/config.ts +460 -0
  100. package/src/server/dashboard.ts +245 -0
  101. package/src/server/delivery/configuration.ts +193 -0
  102. package/src/server/delivery/git-pr.ts +1473 -0
  103. package/src/server/delivery/index.ts +83 -0
  104. package/src/server/delivery/local.ts +151 -0
  105. package/src/server/delivery/official-modules.ts +516 -0
  106. package/src/server/delivery/plan.ts +218 -0
  107. package/src/server/delivery/policies.ts +239 -0
  108. package/src/server/delivery/record.ts +41 -0
  109. package/src/server/delivery/steps.ts +464 -0
  110. package/src/server/delivery/types.ts +158 -0
  111. package/src/server/dependencies.ts +88 -0
  112. package/src/server/diff.ts +230 -0
  113. package/src/server/gates.ts +388 -0
  114. package/src/server/index.ts +139 -0
  115. package/src/server/path-guard.ts +282 -0
  116. package/src/server/planning.ts +749 -0
  117. package/src/server/platform-client.ts +189 -0
  118. package/src/server/preview-database-host.ts +340 -0
  119. package/src/server/preview-database-protocol.ts +163 -0
  120. package/src/server/preview-database-proxy.ts +356 -0
  121. package/src/server/preview-database.ts +109 -0
  122. package/src/server/preview-ipc.ts +15 -0
  123. package/src/server/preview-modules.ts +83 -0
  124. package/src/server/preview-revision.ts +44 -0
  125. package/src/server/preview-runtime.ts +467 -0
  126. package/src/server/preview-worker-manager.ts +477 -0
  127. package/src/server/preview-worker.ts +168 -0
  128. package/src/server/reference.ts +251 -0
  129. package/src/server/routes.ts +2258 -0
  130. package/src/server/runtime.ts +188 -0
  131. package/src/server/session-owner.ts +23 -0
  132. package/src/server/sessions.ts +849 -0
  133. package/src/server/spec.ts +471 -0
  134. package/src/server/turn-lifecycle.ts +56 -0
  135. package/src/server/turns.ts +993 -0
  136. package/src/server/workspace-install.ts +266 -0
  137. package/src/server/workspace-root.ts +73 -0
  138. package/src/styles.css +1573 -0
  139. package/vite.config.ts +134 -0
@@ -0,0 +1,24 @@
1
+ import { b as u, c as Ye, n as B } from "./chunk-DDJLRBDX-3OUNo51g.js";
2
+ import * as o from "path";
3
+ import * as s from "fs";
4
+ //#region ../../node_modules/.pnpm/@electric-sql+pglite@0.5.8/node_modules/@electric-sql/pglite/dist/fs/nodefs.js
5
+ u();
6
+ var m = class extends Ye {
7
+ constructor(t) {
8
+ super(t), this.rootDir = o.resolve(t), s.existsSync(o.join(this.rootDir)) || s.mkdirSync(this.rootDir);
9
+ }
10
+ async init(t, e) {
11
+ return this.pg = t, { emscriptenOpts: {
12
+ ...e,
13
+ preRun: [...e.preRun || [], (r) => {
14
+ let c = r.FS.filesystems.NODEFS;
15
+ r.FS.mkdir(B), r.FS.mount(c, { root: this.rootDir }, B);
16
+ }]
17
+ } };
18
+ }
19
+ async closeFs() {
20
+ this.pg.Module.FS.quit();
21
+ }
22
+ };
23
+ //#endregion
24
+ export { m as NodeFS };
@@ -0,0 +1,388 @@
1
+ import { _ as T$1, b as u, g as R, o as Ve, s as We, v as U, x as x$1, y as h } from "./chunk-DDJLRBDX-3OUNo51g.js";
2
+ //#region ../../node_modules/.pnpm/@electric-sql+pglite@0.5.8/node_modules/@electric-sql/pglite/dist/fs/opfs-ahp.js
3
+ u();
4
+ var $ = "state.txt";
5
+ var G = "data";
6
+ var T = {
7
+ DIR: 16384,
8
+ FILE: 32768
9
+ };
10
+ var H;
11
+ var v;
12
+ var F;
13
+ var M;
14
+ var y;
15
+ var b;
16
+ var m;
17
+ var x;
18
+ var P;
19
+ var D;
20
+ var S;
21
+ var n;
22
+ var C;
23
+ var O;
24
+ var k;
25
+ var w;
26
+ var f;
27
+ var I;
28
+ var W;
29
+ var j;
30
+ var L = class extends We {
31
+ constructor(e, { initialPoolSize: t = 1e3, maintainedPoolSize: o = 100, debug: i = !1 } = {}) {
32
+ super(e, { debug: i });
33
+ R(this, n);
34
+ R(this, H);
35
+ R(this, v);
36
+ R(this, F);
37
+ R(this, M);
38
+ R(this, y);
39
+ R(this, b, /* @__PURE__ */ new Map());
40
+ R(this, m, /* @__PURE__ */ new Map());
41
+ R(this, x, 0);
42
+ R(this, P, /* @__PURE__ */ new Map());
43
+ R(this, D, /* @__PURE__ */ new Map());
44
+ this.lastCheckpoint = 0;
45
+ this.checkpointInterval = 6e4;
46
+ this.poolCounter = 0;
47
+ R(this, S, /* @__PURE__ */ new Set());
48
+ this.initialPoolSize = t, this.maintainedPoolSize = o;
49
+ }
50
+ async init(e, t) {
51
+ return await T$1(this, n, C).call(this), super.init(e, t);
52
+ }
53
+ async syncToFs(e = !1) {
54
+ await this.maybeCheckpointState(), await this.maintainPool(), e || this.flush();
55
+ }
56
+ async closeFs() {
57
+ for (let e of h(this, m).values()) e.close();
58
+ h(this, y).flush(), h(this, y).close(), this.pg.Module.FS.quit();
59
+ }
60
+ async maintainPool(e) {
61
+ e = e || this.maintainedPoolSize;
62
+ let t = e - this.state.pool.length, o = [];
63
+ for (let i = 0; i < t; i++) o.push(new Promise(async (c) => {
64
+ ++this.poolCounter;
65
+ let a = `${(Date.now() - 1704063600).toString(16).padStart(8, "0")}-${this.poolCounter.toString(16).padStart(8, "0")}`, h$1 = await h(this, F).getFileHandle(a, { create: !0 }), d = await h$1.createSyncAccessHandle();
66
+ h(this, b).set(a, h$1), h(this, m).set(a, d), T$1(this, n, k).call(this, {
67
+ opp: "createPoolFile",
68
+ args: [a]
69
+ }), this.state.pool.push(a), c();
70
+ }));
71
+ for (let i = 0; i > t; i--) o.push(new Promise(async (c) => {
72
+ let a = this.state.pool.pop();
73
+ T$1(this, n, k).call(this, {
74
+ opp: "deletePoolFile",
75
+ args: [a]
76
+ });
77
+ let h$2 = h(this, b).get(a);
78
+ h(this, m).get(a)?.close(), await h(this, F).removeEntry(h$2.name), h(this, b).delete(a), h(this, m).delete(a), c();
79
+ }));
80
+ await Promise.all(o);
81
+ }
82
+ _createPoolFileState(e) {
83
+ this.state.pool.push(e);
84
+ }
85
+ _deletePoolFileState(e) {
86
+ let t = this.state.pool.indexOf(e);
87
+ t > -1 && this.state.pool.splice(t, 1);
88
+ }
89
+ async maybeCheckpointState() {
90
+ Date.now() - this.lastCheckpoint > this.checkpointInterval && await this.checkpointState();
91
+ }
92
+ async checkpointState() {
93
+ let e = new TextEncoder().encode(JSON.stringify(this.state));
94
+ h(this, y).truncate(0), h(this, y).write(e, { at: 0 }), h(this, y).flush(), this.lastCheckpoint = Date.now();
95
+ }
96
+ flush() {
97
+ for (let e of h(this, S)) try {
98
+ e.flush();
99
+ } catch {}
100
+ h(this, S).clear();
101
+ }
102
+ chmod(e, t) {
103
+ T$1(this, n, O).call(this, {
104
+ opp: "chmod",
105
+ args: [e, t]
106
+ }, () => {
107
+ this._chmodState(e, t);
108
+ });
109
+ }
110
+ _chmodState(e, t) {
111
+ let o = T$1(this, n, f).call(this, e);
112
+ o.mode = t;
113
+ }
114
+ close(e) {
115
+ let t = T$1(this, n, I).call(this, e);
116
+ h(this, P).delete(e), h(this, D).delete(t);
117
+ }
118
+ fstat(e) {
119
+ let t = T$1(this, n, I).call(this, e);
120
+ return this.lstat(t);
121
+ }
122
+ lstat(e) {
123
+ let t = T$1(this, n, f).call(this, e), o = t.type === "file" ? h(this, m).get(t.backingFilename).getSize() : 0, i = 4096;
124
+ return {
125
+ dev: 0,
126
+ ino: 0,
127
+ mode: t.mode,
128
+ nlink: 1,
129
+ uid: 0,
130
+ gid: 0,
131
+ rdev: 0,
132
+ size: o,
133
+ blksize: i,
134
+ blocks: Math.ceil(o / i),
135
+ atime: t.lastModified,
136
+ mtime: t.lastModified,
137
+ ctime: t.lastModified
138
+ };
139
+ }
140
+ mkdir(e, t) {
141
+ T$1(this, n, O).call(this, {
142
+ opp: "mkdir",
143
+ args: [e, t]
144
+ }, () => {
145
+ this._mkdirState(e, t);
146
+ });
147
+ }
148
+ _mkdirState(e, t) {
149
+ let o = T$1(this, n, w).call(this, e), i = o.pop(), c = [], a = this.state.root;
150
+ for (let d of o) {
151
+ if (c.push(e), !Object.prototype.hasOwnProperty.call(a.children, d)) if (t?.recursive) this.mkdir(c.join("/"));
152
+ else throw new p("ENOENT", "No such file or directory");
153
+ if (a.children[d].type !== "directory") throw new p("ENOTDIR", "Not a directory");
154
+ a = a.children[d];
155
+ }
156
+ if (Object.prototype.hasOwnProperty.call(a.children, i)) throw new p("EEXIST", "File exists");
157
+ let h = {
158
+ type: "directory",
159
+ lastModified: Date.now(),
160
+ mode: t?.mode || T.DIR,
161
+ children: {}
162
+ };
163
+ a.children[i] = h;
164
+ }
165
+ open(e, t, o) {
166
+ if (T$1(this, n, f).call(this, e).type !== "file") throw new p("EISDIR", "Is a directory");
167
+ let c = T$1(this, n, W).call(this);
168
+ return h(this, P).set(c, e), h(this, D).set(e, c), c;
169
+ }
170
+ readdir(e) {
171
+ let t = T$1(this, n, f).call(this, e);
172
+ if (t.type !== "directory") throw new p("ENOTDIR", "Not a directory");
173
+ return Object.keys(t.children);
174
+ }
175
+ read(e, t, o, i, c) {
176
+ let a = T$1(this, n, I).call(this, e), h$3 = T$1(this, n, f).call(this, a);
177
+ if (h$3.type !== "file") throw new p("EISDIR", "Is a directory");
178
+ return h(this, m).get(h$3.backingFilename).read(new Uint8Array(t.buffer, o, i), { at: c });
179
+ }
180
+ rename(e, t) {
181
+ T$1(this, n, O).call(this, {
182
+ opp: "rename",
183
+ args: [e, t]
184
+ }, () => {
185
+ this._renameState(e, t, !0);
186
+ });
187
+ }
188
+ _renameState(e, t, o = !1) {
189
+ let i = T$1(this, n, w).call(this, e), c = i.pop(), a = T$1(this, n, f).call(this, i.join("/"));
190
+ if (!Object.prototype.hasOwnProperty.call(a.children, c)) throw new p("ENOENT", "No such file or directory");
191
+ let h$4 = T$1(this, n, w).call(this, t), d = h$4.pop(), l = T$1(this, n, f).call(this, h$4.join("/"));
192
+ if (o && Object.prototype.hasOwnProperty.call(l.children, d)) {
193
+ let u = l.children[d];
194
+ h(this, m).get(u.backingFilename).truncate(0), this.state.pool.push(u.backingFilename);
195
+ }
196
+ l.children[d] = a.children[c], delete a.children[c];
197
+ }
198
+ rmdir(e) {
199
+ T$1(this, n, O).call(this, {
200
+ opp: "rmdir",
201
+ args: [e]
202
+ }, () => {
203
+ this._rmdirState(e);
204
+ });
205
+ }
206
+ _rmdirState(e) {
207
+ let t = T$1(this, n, w).call(this, e), o = t.pop(), i = T$1(this, n, f).call(this, t.join("/"));
208
+ if (!Object.prototype.hasOwnProperty.call(i.children, o)) throw new p("ENOENT", "No such file or directory");
209
+ let c = i.children[o];
210
+ if (c.type !== "directory") throw new p("ENOTDIR", "Not a directory");
211
+ if (Object.keys(c.children).length > 0) throw new p("ENOTEMPTY", "Directory not empty");
212
+ delete i.children[o];
213
+ }
214
+ truncate(e, t = 0) {
215
+ let o = T$1(this, n, f).call(this, e);
216
+ if (o.type !== "file") throw new p("EISDIR", "Is a directory");
217
+ let i = h(this, m).get(o.backingFilename);
218
+ if (!i) throw new p("ENOENT", "No such file or directory");
219
+ i.truncate(t), h(this, S).add(i);
220
+ }
221
+ unlink(e) {
222
+ T$1(this, n, O).call(this, {
223
+ opp: "unlink",
224
+ args: [e]
225
+ }, () => {
226
+ this._unlinkState(e, !0);
227
+ });
228
+ }
229
+ _unlinkState(e, t = !1) {
230
+ let o = T$1(this, n, w).call(this, e), i = o.pop(), c = T$1(this, n, f).call(this, o.join("/"));
231
+ if (!Object.prototype.hasOwnProperty.call(c.children, i)) throw new p("ENOENT", "No such file or directory");
232
+ let a = c.children[i];
233
+ if (a.type !== "file") throw new p("EISDIR", "Is a directory");
234
+ if (delete c.children[i], t) {
235
+ let h$5 = h(this, m).get(a.backingFilename);
236
+ h$5?.truncate(0), h(this, S).add(h$5), h(this, D).has(e) && (h(this, P).delete(h(this, D).get(e)), h(this, D).delete(e));
237
+ }
238
+ this.state.pool.push(a.backingFilename);
239
+ }
240
+ utimes(e, t, o) {
241
+ T$1(this, n, O).call(this, {
242
+ opp: "utimes",
243
+ args: [
244
+ e,
245
+ t,
246
+ o
247
+ ]
248
+ }, () => {
249
+ this._utimesState(e, t, o);
250
+ });
251
+ }
252
+ _utimesState(e, t, o) {
253
+ let i = T$1(this, n, f).call(this, e);
254
+ i.lastModified = o;
255
+ }
256
+ writeFile(e, t, o) {
257
+ let i = T$1(this, n, w).call(this, e), c = i.pop(), a = T$1(this, n, f).call(this, i.join("/"));
258
+ if (Object.prototype.hasOwnProperty.call(a.children, c)) {
259
+ let l = a.children[c];
260
+ l.lastModified = Date.now(), T$1(this, n, k).call(this, {
261
+ opp: "setLastModified",
262
+ args: [e, l.lastModified]
263
+ });
264
+ } else {
265
+ if (this.state.pool.length === 0) throw new Error("No more file handles available in the pool");
266
+ let l = {
267
+ type: "file",
268
+ lastModified: Date.now(),
269
+ mode: o?.mode || T.FILE,
270
+ backingFilename: this.state.pool.pop()
271
+ };
272
+ a.children[c] = l, T$1(this, n, k).call(this, {
273
+ opp: "createFileNode",
274
+ args: [e, l]
275
+ });
276
+ }
277
+ let h$6 = a.children[c], d = h(this, m).get(h$6.backingFilename);
278
+ t.length > 0 && (d.write(typeof t == "string" ? new TextEncoder().encode(t) : new Uint8Array(t), { at: 0 }), e.startsWith("/pg_wal") && h(this, S).add(d));
279
+ }
280
+ _createFileNodeState(e, t) {
281
+ let o = T$1(this, n, w).call(this, e), i = o.pop(), c = T$1(this, n, f).call(this, o.join("/"));
282
+ c.children[i] = t;
283
+ let a = this.state.pool.indexOf(t.backingFilename);
284
+ return a > -1 && this.state.pool.splice(a, 1), t;
285
+ }
286
+ _setLastModifiedState(e, t) {
287
+ let o = T$1(this, n, f).call(this, e);
288
+ o.lastModified = t;
289
+ }
290
+ write(e, t, o, i, c) {
291
+ let a = T$1(this, n, I).call(this, e), h$7 = T$1(this, n, f).call(this, a);
292
+ if (h$7.type !== "file") throw new p("EISDIR", "Is a directory");
293
+ let d = h(this, m).get(h$7.backingFilename);
294
+ if (!d) throw new p("EBADF", "Bad file descriptor");
295
+ let l = d.write(new Uint8Array(t, o, i), { at: c });
296
+ return a.startsWith("/pg_wal") && h(this, S).add(d), l;
297
+ }
298
+ };
299
+ H = /* @__PURE__ */ new WeakMap(), v = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new WeakMap(), M = /* @__PURE__ */ new WeakMap(), y = /* @__PURE__ */ new WeakMap(), b = /* @__PURE__ */ new WeakMap(), m = /* @__PURE__ */ new WeakMap(), x = /* @__PURE__ */ new WeakMap(), P = /* @__PURE__ */ new WeakMap(), D = /* @__PURE__ */ new WeakMap(), S = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new WeakSet(), C = async function() {
300
+ x$1(this, H, await navigator.storage.getDirectory()), x$1(this, v, await T$1(this, n, j).call(this, this.dataDir, { create: !0 })), x$1(this, F, await T$1(this, n, j).call(this, G, {
301
+ from: h(this, v),
302
+ create: !0
303
+ })), x$1(this, M, await h(this, v).getFileHandle($, { create: !0 })), x$1(this, y, await h(this, M).createSyncAccessHandle());
304
+ let e = new ArrayBuffer(h(this, y).getSize());
305
+ h(this, y).read(e, { at: 0 });
306
+ let t, o = new TextDecoder().decode(e).split(`
307
+ `), i = !1;
308
+ try {
309
+ t = JSON.parse(o[0]);
310
+ } catch {
311
+ t = {
312
+ root: {
313
+ type: "directory",
314
+ lastModified: Date.now(),
315
+ mode: T.DIR,
316
+ children: {}
317
+ },
318
+ pool: []
319
+ }, h(this, y).truncate(0), h(this, y).write(new TextEncoder().encode(JSON.stringify(t)), { at: 0 }), i = !0;
320
+ }
321
+ this.state = t;
322
+ let c = o.slice(1).filter(Boolean).map((l) => JSON.parse(l));
323
+ for (let l of c) {
324
+ let u = `_${l.opp}State`;
325
+ if (typeof this[u] == "function") try {
326
+ this[u].bind(this)(...l.args);
327
+ } catch (N) {
328
+ console.warn("Error applying OPFS AHP WAL entry", l, N);
329
+ }
330
+ }
331
+ let a = [], h$8 = async (l) => {
332
+ if (l.type === "file") try {
333
+ let u = await h(this, F).getFileHandle(l.backingFilename), N = await u.createSyncAccessHandle();
334
+ h(this, b).set(l.backingFilename, u), h(this, m).set(l.backingFilename, N);
335
+ } catch (u) {
336
+ console.error("Error opening file handle for node", l, u);
337
+ }
338
+ else for (let u of Object.values(l.children)) a.push(h$8(u));
339
+ };
340
+ await h$8(this.state.root);
341
+ let d = [];
342
+ for (let l of this.state.pool) d.push(new Promise(async (u) => {
343
+ h(this, b).has(l) && console.warn("File handle already exists for pool file", l);
344
+ let N = await h(this, F).getFileHandle(l), U = await N.createSyncAccessHandle();
345
+ h(this, b).set(l, N), h(this, m).set(l, U), u();
346
+ }));
347
+ await Promise.all([...a, ...d]), await this.maintainPool(i ? this.initialPoolSize : this.maintainedPoolSize);
348
+ }, O = function(e, t) {
349
+ let o = T$1(this, n, k).call(this, e);
350
+ try {
351
+ t();
352
+ } catch (i) {
353
+ throw h(this, y).truncate(o), i;
354
+ }
355
+ }, k = function(e) {
356
+ let t = JSON.stringify(e), o = new TextEncoder().encode(`
357
+ ${t}`), i = h(this, y).getSize();
358
+ return h(this, y).write(o, { at: i }), h(this, S).add(h(this, y)), i;
359
+ }, w = function(e) {
360
+ return e.split("/").filter(Boolean);
361
+ }, f = function(e, t) {
362
+ let o = T$1(this, n, w).call(this, e), i = t || this.state.root;
363
+ for (let c of o) {
364
+ if (i.type !== "directory") throw new p("ENOTDIR", "Not a directory");
365
+ if (!Object.prototype.hasOwnProperty.call(i.children, c)) throw new p("ENOENT", "No such file or directory");
366
+ i = i.children[c];
367
+ }
368
+ return i;
369
+ }, I = function(e) {
370
+ let t = h(this, P).get(e);
371
+ if (!t) throw new p("EBADF", "Bad file descriptor");
372
+ return t;
373
+ }, W = function() {
374
+ let e = ++U(this, x)._;
375
+ for (; h(this, P).has(e);) U(this, x)._++;
376
+ return e;
377
+ }, j = async function(e, t) {
378
+ let o = T$1(this, n, w).call(this, e), i = t?.from || h(this, H);
379
+ for (let c of o) i = await i.getDirectoryHandle(c, { create: t?.create });
380
+ return i;
381
+ };
382
+ var p = class extends Error {
383
+ constructor(A, e) {
384
+ super(e), typeof A == "number" ? this.code = A : typeof A == "string" && (this.code = Ve[A]);
385
+ }
386
+ };
387
+ //#endregion
388
+ export { L as OpfsAhpFS };
@@ -0,0 +1,55 @@
1
+ import { i as __commonJSMin, r as require_token_error, t as require_token_util } from "./token-util-CktFFT4z.js";
2
+ //#region ../../node_modules/.pnpm/@vercel+oidc@3.2.0/node_modules/@vercel/oidc/dist/token.js
3
+ var require_token = /* @__PURE__ */ __commonJSMin(((exports, module) => {
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all) __defProp(target, name, {
10
+ get: all[name],
11
+ enumerable: true
12
+ });
13
+ };
14
+ var __copyProps = (to, from, except, desc) => {
15
+ if (from && typeof from === "object" || typeof from === "function") {
16
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
17
+ get: () => from[key],
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ }
21
+ return to;
22
+ };
23
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
24
+ var token_exports = {};
25
+ __export(token_exports, { refreshToken: () => refreshToken });
26
+ module.exports = __toCommonJS(token_exports);
27
+ var import_token_error = require_token_error();
28
+ var import_token_util = require_token_util();
29
+ async function refreshToken(options) {
30
+ let projectId = options?.project;
31
+ let teamId = options?.team;
32
+ if (!projectId && !teamId) {
33
+ const projectInfo = (0, import_token_util.findProjectInfo)();
34
+ projectId = projectInfo.projectId;
35
+ teamId = projectInfo.teamId;
36
+ } else if (!projectId || !teamId) {
37
+ const projectInfo = (0, import_token_util.findProjectInfo)();
38
+ projectId = projectId ?? projectInfo.projectId;
39
+ teamId = teamId ?? projectInfo.teamId;
40
+ }
41
+ if (!projectId) throw new import_token_error.VercelOidcTokenError("Failed to refresh OIDC token: No project specified. Try re-linking your project with `vc link`");
42
+ let maybeToken = (0, import_token_util.loadToken)(projectId);
43
+ if (!maybeToken || (0, import_token_util.isExpired)((0, import_token_util.getTokenPayload)(maybeToken.token), options?.expirationBufferMs)) {
44
+ const authToken = await (0, import_token_util.getVercelToken)({ expirationBufferMs: options?.expirationBufferMs });
45
+ maybeToken = await (0, import_token_util.getVercelOidcToken)(authToken, projectId, teamId);
46
+ if (!maybeToken) throw new import_token_error.VercelOidcTokenError("Failed to refresh OIDC token");
47
+ (0, import_token_util.saveToken)(maybeToken, projectId);
48
+ }
49
+ process.env.VERCEL_OIDC_TOKEN = maybeToken.token;
50
+ }
51
+ 0 && (module.exports = { refreshToken });
52
+ }));
53
+ //#endregion
54
+ export default require_token();
55
+ export {};
@@ -0,0 +1,3 @@
1
+ import { t as require_token_util } from "./token-util-CktFFT4z.js";
2
+ export default require_token_util();
3
+ export {};