@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,24 +0,0 @@
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 };
@@ -1,388 +0,0 @@
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 };
@@ -1,55 +0,0 @@
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 {};
@@ -1,3 +0,0 @@
1
- import { t as require_token_util } from "./token-util-CktFFT4z.js";
2
- export default require_token_util();
3
- export {};