@inkeep/agents-run-api 0.39.1 → 0.39.3

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 (67) hide show
  1. package/dist/SandboxExecutorFactory.cjs +895 -0
  2. package/dist/SandboxExecutorFactory.js +893 -0
  3. package/dist/SandboxExecutorFactory.js.map +1 -0
  4. package/dist/chunk-VBDAOXYI.cjs +927 -0
  5. package/dist/chunk-VBDAOXYI.js +832 -0
  6. package/dist/chunk-VBDAOXYI.js.map +1 -0
  7. package/dist/chunk.cjs +34 -0
  8. package/dist/conversations.cjs +7 -0
  9. package/dist/conversations.js +7 -0
  10. package/dist/conversations2.cjs +209 -0
  11. package/dist/conversations2.js +180 -0
  12. package/dist/conversations2.js.map +1 -0
  13. package/dist/dbClient.cjs +9676 -0
  14. package/dist/dbClient.js +9670 -0
  15. package/dist/dbClient.js.map +1 -0
  16. package/dist/dbClient2.cjs +5 -0
  17. package/dist/dbClient2.js +5 -0
  18. package/dist/env.cjs +59 -0
  19. package/dist/env.js +54 -0
  20. package/dist/env.js.map +1 -0
  21. package/dist/execution-limits.cjs +260 -0
  22. package/dist/execution-limits.js +63 -0
  23. package/dist/execution-limits.js.map +1 -0
  24. package/dist/index.cjs +10545 -20565
  25. package/dist/index.d.cts +26 -22
  26. package/dist/index.d.cts.map +1 -0
  27. package/dist/index.d.ts +27 -22
  28. package/dist/index.d.ts.map +1 -0
  29. package/dist/index.js +10545 -12888
  30. package/dist/index.js.map +1 -0
  31. package/dist/instrumentation.cjs +12 -121
  32. package/dist/instrumentation.d.cts +9 -7
  33. package/dist/instrumentation.d.cts.map +1 -0
  34. package/dist/instrumentation.d.ts +9 -7
  35. package/dist/instrumentation.d.ts.map +1 -0
  36. package/dist/instrumentation.js +5 -1
  37. package/dist/instrumentation2.cjs +116 -0
  38. package/dist/instrumentation2.js +69 -0
  39. package/dist/instrumentation2.js.map +1 -0
  40. package/dist/json-postprocessor.cjs +20 -0
  41. package/dist/json-postprocessor.js +20 -0
  42. package/dist/json-postprocessor.js.map +1 -0
  43. package/dist/logger.cjs +5 -0
  44. package/dist/logger.js +3 -0
  45. package/dist/logger2.cjs +1 -0
  46. package/dist/logger2.js +3 -0
  47. package/dist/nodefs.cjs +29 -0
  48. package/dist/nodefs.js +27 -0
  49. package/dist/nodefs.js.map +1 -0
  50. package/dist/opfs-ahp.cjs +367 -0
  51. package/dist/opfs-ahp.js +368 -0
  52. package/dist/opfs-ahp.js.map +1 -0
  53. package/package.json +3 -3
  54. package/dist/SandboxExecutorFactory-2N27SE3B.js +0 -943
  55. package/dist/chunk-A2S7GSHL.js +0 -1
  56. package/dist/chunk-EVOISBFH.js +0 -5070
  57. package/dist/chunk-JCVMVG3J.js +0 -592
  58. package/dist/chunk-KBZIYCPJ.js +0 -40
  59. package/dist/chunk-KCJWSIDZ.js +0 -246
  60. package/dist/chunk-THWNUGWP.js +0 -204
  61. package/dist/chunk-UC2EPLSW.js +0 -75
  62. package/dist/conversations-XPSTWUMK.js +0 -1
  63. package/dist/dbClient-MAHUR4TO.js +0 -1
  64. package/dist/json-postprocessor-IGYTSWFB.js +0 -12
  65. package/dist/logger-3EE6BUSU.js +0 -1
  66. package/dist/nodefs-RPE52Q4Z.js +0 -21
  67. package/dist/opfs-ahp-QL4REJJW.js +0 -318
@@ -0,0 +1,367 @@
1
+ const require_chunk_VBDAOXYI = require('./chunk-VBDAOXYI.cjs');
2
+
3
+ //#region ../node_modules/.pnpm/@electric-sql+pglite@0.3.14/node_modules/@electric-sql/pglite/dist/fs/opfs-ahp.js
4
+ require_chunk_VBDAOXYI.u();
5
+ var $ = "state.txt", G = "data", T$1 = {
6
+ DIR: 16384,
7
+ FILE: 32768
8
+ }, H, v, F, M, y, b, m, x$1, P, D, S, n, C, O, k, w, f, I, W, j, L = class extends require_chunk_VBDAOXYI.cr {
9
+ constructor(e, { initialPoolSize: t = 1e3, maintainedPoolSize: o = 100, debug: i = !1 } = {}) {
10
+ super(e, { debug: i });
11
+ require_chunk_VBDAOXYI.R(this, n);
12
+ require_chunk_VBDAOXYI.R(this, H);
13
+ require_chunk_VBDAOXYI.R(this, v);
14
+ require_chunk_VBDAOXYI.R(this, F);
15
+ require_chunk_VBDAOXYI.R(this, M);
16
+ require_chunk_VBDAOXYI.R(this, y);
17
+ require_chunk_VBDAOXYI.R(this, b, /* @__PURE__ */ new Map());
18
+ require_chunk_VBDAOXYI.R(this, m, /* @__PURE__ */ new Map());
19
+ require_chunk_VBDAOXYI.R(this, x$1, 0);
20
+ require_chunk_VBDAOXYI.R(this, P, /* @__PURE__ */ new Map());
21
+ require_chunk_VBDAOXYI.R(this, D, /* @__PURE__ */ new Map());
22
+ this.lastCheckpoint = 0;
23
+ this.checkpointInterval = 1e3 * 60;
24
+ this.poolCounter = 0;
25
+ require_chunk_VBDAOXYI.R(this, S, /* @__PURE__ */ new Set());
26
+ this.initialPoolSize = t, this.maintainedPoolSize = o;
27
+ }
28
+ async init(e, t) {
29
+ return await require_chunk_VBDAOXYI.T(this, n, C).call(this), super.init(e, t);
30
+ }
31
+ async syncToFs(e = !1) {
32
+ await this.maybeCheckpointState(), await this.maintainPool(), e || this.flush();
33
+ }
34
+ async closeFs() {
35
+ for (let e of require_chunk_VBDAOXYI.h(this, m).values()) e.close();
36
+ require_chunk_VBDAOXYI.h(this, y).flush(), require_chunk_VBDAOXYI.h(this, y).close(), this.pg.Module.FS.quit();
37
+ }
38
+ async maintainPool(e) {
39
+ e = e || this.maintainedPoolSize;
40
+ let t = e - this.state.pool.length, o = [];
41
+ for (let i = 0; i < t; i++) o.push(new Promise(async (c) => {
42
+ ++this.poolCounter;
43
+ let a = `${(Date.now() - 1704063600).toString(16).padStart(8, "0")}-${this.poolCounter.toString(16).padStart(8, "0")}`, h$1 = await require_chunk_VBDAOXYI.h(this, F).getFileHandle(a, { create: !0 }), d = await h$1.createSyncAccessHandle();
44
+ require_chunk_VBDAOXYI.h(this, b).set(a, h$1), require_chunk_VBDAOXYI.h(this, m).set(a, d), require_chunk_VBDAOXYI.T(this, n, k).call(this, {
45
+ opp: "createPoolFile",
46
+ args: [a]
47
+ }), this.state.pool.push(a), c();
48
+ }));
49
+ for (let i = 0; i > t; i--) o.push(new Promise(async (c) => {
50
+ let a = this.state.pool.pop();
51
+ require_chunk_VBDAOXYI.T(this, n, k).call(this, {
52
+ opp: "deletePoolFile",
53
+ args: [a]
54
+ });
55
+ let h$1 = require_chunk_VBDAOXYI.h(this, b).get(a);
56
+ require_chunk_VBDAOXYI.h(this, m).get(a)?.close(), await require_chunk_VBDAOXYI.h(this, F).removeEntry(h$1.name), require_chunk_VBDAOXYI.h(this, b).delete(a), require_chunk_VBDAOXYI.h(this, m).delete(a), c();
57
+ }));
58
+ await Promise.all(o);
59
+ }
60
+ _createPoolFileState(e) {
61
+ this.state.pool.push(e);
62
+ }
63
+ _deletePoolFileState(e) {
64
+ let t = this.state.pool.indexOf(e);
65
+ t > -1 && this.state.pool.splice(t, 1);
66
+ }
67
+ async maybeCheckpointState() {
68
+ Date.now() - this.lastCheckpoint > this.checkpointInterval && await this.checkpointState();
69
+ }
70
+ async checkpointState() {
71
+ let e = new TextEncoder().encode(JSON.stringify(this.state));
72
+ require_chunk_VBDAOXYI.h(this, y).truncate(0), require_chunk_VBDAOXYI.h(this, y).write(e, { at: 0 }), require_chunk_VBDAOXYI.h(this, y).flush(), this.lastCheckpoint = Date.now();
73
+ }
74
+ flush() {
75
+ for (let e of require_chunk_VBDAOXYI.h(this, S)) try {
76
+ e.flush();
77
+ } catch {}
78
+ require_chunk_VBDAOXYI.h(this, S).clear();
79
+ }
80
+ chmod(e, t) {
81
+ require_chunk_VBDAOXYI.T(this, n, O).call(this, {
82
+ opp: "chmod",
83
+ args: [e, t]
84
+ }, () => {
85
+ this._chmodState(e, t);
86
+ });
87
+ }
88
+ _chmodState(e, t) {
89
+ let o = require_chunk_VBDAOXYI.T(this, n, f).call(this, e);
90
+ o.mode = t;
91
+ }
92
+ close(e) {
93
+ let t = require_chunk_VBDAOXYI.T(this, n, I).call(this, e);
94
+ require_chunk_VBDAOXYI.h(this, P).delete(e), require_chunk_VBDAOXYI.h(this, D).delete(t);
95
+ }
96
+ fstat(e) {
97
+ let t = require_chunk_VBDAOXYI.T(this, n, I).call(this, e);
98
+ return this.lstat(t);
99
+ }
100
+ lstat(e) {
101
+ let t = require_chunk_VBDAOXYI.T(this, n, f).call(this, e), o = t.type === "file" ? require_chunk_VBDAOXYI.h(this, m).get(t.backingFilename).getSize() : 0, i = 4096;
102
+ return {
103
+ dev: 0,
104
+ ino: 0,
105
+ mode: t.mode,
106
+ nlink: 1,
107
+ uid: 0,
108
+ gid: 0,
109
+ rdev: 0,
110
+ size: o,
111
+ blksize: i,
112
+ blocks: Math.ceil(o / i),
113
+ atime: t.lastModified,
114
+ mtime: t.lastModified,
115
+ ctime: t.lastModified
116
+ };
117
+ }
118
+ mkdir(e, t) {
119
+ require_chunk_VBDAOXYI.T(this, n, O).call(this, {
120
+ opp: "mkdir",
121
+ args: [e, t]
122
+ }, () => {
123
+ this._mkdirState(e, t);
124
+ });
125
+ }
126
+ _mkdirState(e, t) {
127
+ let o = require_chunk_VBDAOXYI.T(this, n, w).call(this, e), i = o.pop(), c = [], a = this.state.root;
128
+ for (let d of o) {
129
+ if (c.push(e), !Object.prototype.hasOwnProperty.call(a.children, d)) if (t?.recursive) this.mkdir(c.join("/"));
130
+ else throw new p("ENOENT", "No such file or directory");
131
+ if (a.children[d].type !== "directory") throw new p("ENOTDIR", "Not a directory");
132
+ a = a.children[d];
133
+ }
134
+ if (Object.prototype.hasOwnProperty.call(a.children, i)) throw new p("EEXIST", "File exists");
135
+ let h$1 = {
136
+ type: "directory",
137
+ lastModified: Date.now(),
138
+ mode: t?.mode || T$1.DIR,
139
+ children: {}
140
+ };
141
+ a.children[i] = h$1;
142
+ }
143
+ open(e, t, o) {
144
+ if (require_chunk_VBDAOXYI.T(this, n, f).call(this, e).type !== "file") throw new p("EISDIR", "Is a directory");
145
+ let c = require_chunk_VBDAOXYI.T(this, n, W).call(this);
146
+ return require_chunk_VBDAOXYI.h(this, P).set(c, e), require_chunk_VBDAOXYI.h(this, D).set(e, c), c;
147
+ }
148
+ readdir(e) {
149
+ let t = require_chunk_VBDAOXYI.T(this, n, f).call(this, e);
150
+ if (t.type !== "directory") throw new p("ENOTDIR", "Not a directory");
151
+ return Object.keys(t.children);
152
+ }
153
+ read(e, t, o, i, c) {
154
+ let a = require_chunk_VBDAOXYI.T(this, n, I).call(this, e), h$1 = require_chunk_VBDAOXYI.T(this, n, f).call(this, a);
155
+ if (h$1.type !== "file") throw new p("EISDIR", "Is a directory");
156
+ return require_chunk_VBDAOXYI.h(this, m).get(h$1.backingFilename).read(new Uint8Array(t.buffer, o, i), { at: c });
157
+ }
158
+ rename(e, t) {
159
+ require_chunk_VBDAOXYI.T(this, n, O).call(this, {
160
+ opp: "rename",
161
+ args: [e, t]
162
+ }, () => {
163
+ this._renameState(e, t, !0);
164
+ });
165
+ }
166
+ _renameState(e, t, o = !1) {
167
+ let i = require_chunk_VBDAOXYI.T(this, n, w).call(this, e), c = i.pop(), a = require_chunk_VBDAOXYI.T(this, n, f).call(this, i.join("/"));
168
+ if (!Object.prototype.hasOwnProperty.call(a.children, c)) throw new p("ENOENT", "No such file or directory");
169
+ let h$1 = require_chunk_VBDAOXYI.T(this, n, w).call(this, t), d = h$1.pop(), l = require_chunk_VBDAOXYI.T(this, n, f).call(this, h$1.join("/"));
170
+ if (o && Object.prototype.hasOwnProperty.call(l.children, d)) {
171
+ let u$1 = l.children[d];
172
+ require_chunk_VBDAOXYI.h(this, m).get(u$1.backingFilename).truncate(0), this.state.pool.push(u$1.backingFilename);
173
+ }
174
+ l.children[d] = a.children[c], delete a.children[c];
175
+ }
176
+ rmdir(e) {
177
+ require_chunk_VBDAOXYI.T(this, n, O).call(this, {
178
+ opp: "rmdir",
179
+ args: [e]
180
+ }, () => {
181
+ this._rmdirState(e);
182
+ });
183
+ }
184
+ _rmdirState(e) {
185
+ let t = require_chunk_VBDAOXYI.T(this, n, w).call(this, e), o = t.pop(), i = require_chunk_VBDAOXYI.T(this, n, f).call(this, t.join("/"));
186
+ if (!Object.prototype.hasOwnProperty.call(i.children, o)) throw new p("ENOENT", "No such file or directory");
187
+ let c = i.children[o];
188
+ if (c.type !== "directory") throw new p("ENOTDIR", "Not a directory");
189
+ if (Object.keys(c.children).length > 0) throw new p("ENOTEMPTY", "Directory not empty");
190
+ delete i.children[o];
191
+ }
192
+ truncate(e, t = 0) {
193
+ let o = require_chunk_VBDAOXYI.T(this, n, f).call(this, e);
194
+ if (o.type !== "file") throw new p("EISDIR", "Is a directory");
195
+ let i = require_chunk_VBDAOXYI.h(this, m).get(o.backingFilename);
196
+ if (!i) throw new p("ENOENT", "No such file or directory");
197
+ i.truncate(t), require_chunk_VBDAOXYI.h(this, S).add(i);
198
+ }
199
+ unlink(e) {
200
+ require_chunk_VBDAOXYI.T(this, n, O).call(this, {
201
+ opp: "unlink",
202
+ args: [e]
203
+ }, () => {
204
+ this._unlinkState(e, !0);
205
+ });
206
+ }
207
+ _unlinkState(e, t = !1) {
208
+ let o = require_chunk_VBDAOXYI.T(this, n, w).call(this, e), i = o.pop(), c = require_chunk_VBDAOXYI.T(this, n, f).call(this, o.join("/"));
209
+ if (!Object.prototype.hasOwnProperty.call(c.children, i)) throw new p("ENOENT", "No such file or directory");
210
+ let a = c.children[i];
211
+ if (a.type !== "file") throw new p("EISDIR", "Is a directory");
212
+ if (delete c.children[i], t) {
213
+ let h$1 = require_chunk_VBDAOXYI.h(this, m).get(a.backingFilename);
214
+ h$1?.truncate(0), require_chunk_VBDAOXYI.h(this, S).add(h$1), require_chunk_VBDAOXYI.h(this, D).has(e) && (require_chunk_VBDAOXYI.h(this, P).delete(require_chunk_VBDAOXYI.h(this, D).get(e)), require_chunk_VBDAOXYI.h(this, D).delete(e));
215
+ }
216
+ this.state.pool.push(a.backingFilename);
217
+ }
218
+ utimes(e, t, o) {
219
+ require_chunk_VBDAOXYI.T(this, n, O).call(this, {
220
+ opp: "utimes",
221
+ args: [
222
+ e,
223
+ t,
224
+ o
225
+ ]
226
+ }, () => {
227
+ this._utimesState(e, t, o);
228
+ });
229
+ }
230
+ _utimesState(e, t, o) {
231
+ let i = require_chunk_VBDAOXYI.T(this, n, f).call(this, e);
232
+ i.lastModified = o;
233
+ }
234
+ writeFile(e, t, o) {
235
+ let i = require_chunk_VBDAOXYI.T(this, n, w).call(this, e), c = i.pop(), a = require_chunk_VBDAOXYI.T(this, n, f).call(this, i.join("/"));
236
+ if (Object.prototype.hasOwnProperty.call(a.children, c)) {
237
+ let l = a.children[c];
238
+ l.lastModified = Date.now(), require_chunk_VBDAOXYI.T(this, n, k).call(this, {
239
+ opp: "setLastModified",
240
+ args: [e, l.lastModified]
241
+ });
242
+ } else {
243
+ if (this.state.pool.length === 0) throw new Error("No more file handles available in the pool");
244
+ let l = {
245
+ type: "file",
246
+ lastModified: Date.now(),
247
+ mode: o?.mode || T$1.FILE,
248
+ backingFilename: this.state.pool.pop()
249
+ };
250
+ a.children[c] = l, require_chunk_VBDAOXYI.T(this, n, k).call(this, {
251
+ opp: "createFileNode",
252
+ args: [e, l]
253
+ });
254
+ }
255
+ let h$1 = a.children[c], d = require_chunk_VBDAOXYI.h(this, m).get(h$1.backingFilename);
256
+ t.length > 0 && (d.write(typeof t == "string" ? new TextEncoder().encode(t) : new Uint8Array(t), { at: 0 }), e.startsWith("/pg_wal") && require_chunk_VBDAOXYI.h(this, S).add(d));
257
+ }
258
+ _createFileNodeState(e, t) {
259
+ let o = require_chunk_VBDAOXYI.T(this, n, w).call(this, e), i = o.pop(), c = require_chunk_VBDAOXYI.T(this, n, f).call(this, o.join("/"));
260
+ c.children[i] = t;
261
+ let a = this.state.pool.indexOf(t.backingFilename);
262
+ return a > -1 && this.state.pool.splice(a, 1), t;
263
+ }
264
+ _setLastModifiedState(e, t) {
265
+ let o = require_chunk_VBDAOXYI.T(this, n, f).call(this, e);
266
+ o.lastModified = t;
267
+ }
268
+ write(e, t, o, i, c) {
269
+ let a = require_chunk_VBDAOXYI.T(this, n, I).call(this, e), h$1 = require_chunk_VBDAOXYI.T(this, n, f).call(this, a);
270
+ if (h$1.type !== "file") throw new p("EISDIR", "Is a directory");
271
+ let d = require_chunk_VBDAOXYI.h(this, m).get(h$1.backingFilename);
272
+ if (!d) throw new p("EBADF", "Bad file descriptor");
273
+ let l = d.write(new Uint8Array(t, o, i), { at: c });
274
+ return a.startsWith("/pg_wal") && require_chunk_VBDAOXYI.h(this, S).add(d), l;
275
+ }
276
+ };
277
+ 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$1 = /* @__PURE__ */ new WeakMap(), P = /* @__PURE__ */ new WeakMap(), D = /* @__PURE__ */ new WeakMap(), S = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new WeakSet(), C = async function() {
278
+ require_chunk_VBDAOXYI.x(this, H, await navigator.storage.getDirectory()), require_chunk_VBDAOXYI.x(this, v, await require_chunk_VBDAOXYI.T(this, n, j).call(this, this.dataDir, { create: !0 })), require_chunk_VBDAOXYI.x(this, F, await require_chunk_VBDAOXYI.T(this, n, j).call(this, G, {
279
+ from: require_chunk_VBDAOXYI.h(this, v),
280
+ create: !0
281
+ })), require_chunk_VBDAOXYI.x(this, M, await require_chunk_VBDAOXYI.h(this, v).getFileHandle($, { create: !0 })), require_chunk_VBDAOXYI.x(this, y, await require_chunk_VBDAOXYI.h(this, M).createSyncAccessHandle());
282
+ let e = new ArrayBuffer(require_chunk_VBDAOXYI.h(this, y).getSize());
283
+ require_chunk_VBDAOXYI.h(this, y).read(e, { at: 0 });
284
+ let t, o = new TextDecoder().decode(e).split(`
285
+ `), i = !1;
286
+ try {
287
+ t = JSON.parse(o[0]);
288
+ } catch {
289
+ t = {
290
+ root: {
291
+ type: "directory",
292
+ lastModified: Date.now(),
293
+ mode: T$1.DIR,
294
+ children: {}
295
+ },
296
+ pool: []
297
+ }, require_chunk_VBDAOXYI.h(this, y).truncate(0), require_chunk_VBDAOXYI.h(this, y).write(new TextEncoder().encode(JSON.stringify(t)), { at: 0 }), i = !0;
298
+ }
299
+ this.state = t;
300
+ let c = o.slice(1).filter(Boolean).map((l) => JSON.parse(l));
301
+ for (let l of c) {
302
+ let u$1 = `_${l.opp}State`;
303
+ if (typeof this[u$1] == "function") try {
304
+ this[u$1].bind(this)(...l.args);
305
+ } catch (N) {
306
+ console.warn("Error applying OPFS AHP WAL entry", l, N);
307
+ }
308
+ }
309
+ let a = [], h$1 = async (l) => {
310
+ if (l.type === "file") try {
311
+ let u$1 = await require_chunk_VBDAOXYI.h(this, F).getFileHandle(l.backingFilename), N = await u$1.createSyncAccessHandle();
312
+ require_chunk_VBDAOXYI.h(this, b).set(l.backingFilename, u$1), require_chunk_VBDAOXYI.h(this, m).set(l.backingFilename, N);
313
+ } catch (u$1) {
314
+ console.error("Error opening file handle for node", l, u$1);
315
+ }
316
+ else for (let u$1 of Object.values(l.children)) a.push(h$1(u$1));
317
+ };
318
+ await h$1(this.state.root);
319
+ let d = [];
320
+ for (let l of this.state.pool) d.push(new Promise(async (u$1) => {
321
+ require_chunk_VBDAOXYI.h(this, b).has(l) && console.warn("File handle already exists for pool file", l);
322
+ let N = await require_chunk_VBDAOXYI.h(this, F).getFileHandle(l), U$1 = await N.createSyncAccessHandle();
323
+ require_chunk_VBDAOXYI.h(this, b).set(l, N), require_chunk_VBDAOXYI.h(this, m).set(l, U$1), u$1();
324
+ }));
325
+ await Promise.all([...a, ...d]), await this.maintainPool(i ? this.initialPoolSize : this.maintainedPoolSize);
326
+ }, O = function(e, t) {
327
+ let o = require_chunk_VBDAOXYI.T(this, n, k).call(this, e);
328
+ try {
329
+ t();
330
+ } catch (i) {
331
+ throw require_chunk_VBDAOXYI.h(this, y).truncate(o), i;
332
+ }
333
+ }, k = function(e) {
334
+ let t = JSON.stringify(e), o = new TextEncoder().encode(`
335
+ ${t}`), i = require_chunk_VBDAOXYI.h(this, y).getSize();
336
+ return require_chunk_VBDAOXYI.h(this, y).write(o, { at: i }), require_chunk_VBDAOXYI.h(this, S).add(require_chunk_VBDAOXYI.h(this, y)), i;
337
+ }, w = function(e) {
338
+ return e.split("/").filter(Boolean);
339
+ }, f = function(e, t) {
340
+ let o = require_chunk_VBDAOXYI.T(this, n, w).call(this, e), i = t || this.state.root;
341
+ for (let c of o) {
342
+ if (i.type !== "directory") throw new p("ENOTDIR", "Not a directory");
343
+ if (!Object.prototype.hasOwnProperty.call(i.children, c)) throw new p("ENOENT", "No such file or directory");
344
+ i = i.children[c];
345
+ }
346
+ return i;
347
+ }, I = function(e) {
348
+ let t = require_chunk_VBDAOXYI.h(this, P).get(e);
349
+ if (!t) throw new p("EBADF", "Bad file descriptor");
350
+ return t;
351
+ }, W = function() {
352
+ let e = ++require_chunk_VBDAOXYI.U(this, x$1)._;
353
+ for (; require_chunk_VBDAOXYI.h(this, P).has(e);) require_chunk_VBDAOXYI.U(this, x$1)._++;
354
+ return e;
355
+ }, j = async function(e, t) {
356
+ let o = require_chunk_VBDAOXYI.T(this, n, w).call(this, e), i = t?.from || require_chunk_VBDAOXYI.h(this, H);
357
+ for (let c of o) i = await i.getDirectoryHandle(c, { create: t?.create });
358
+ return i;
359
+ };
360
+ var p = class extends Error {
361
+ constructor(A, e) {
362
+ super(e), typeof A == "number" ? this.code = A : typeof A == "string" && (this.code = require_chunk_VBDAOXYI.pr[A]);
363
+ }
364
+ };
365
+
366
+ //#endregion
367
+ exports.OpfsAhpFS = L;