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