@inkeep/agents-run-api 0.39.5 → 0.41.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/_raw_/home/runner/work/agents/agents/agents-run-api/templates/v1/phase1/system-prompt.js +5 -0
- package/dist/_virtual/_raw_/home/runner/work/agents/agents/agents-run-api/templates/v1/phase1/thinking-preparation.js +5 -0
- package/dist/_virtual/_raw_/home/runner/work/agents/agents/agents-run-api/templates/v1/phase1/tool.js +5 -0
- package/dist/_virtual/_raw_/home/runner/work/agents/agents/agents-run-api/templates/v1/phase2/data-component.js +5 -0
- package/dist/_virtual/_raw_/home/runner/work/agents/agents/agents-run-api/templates/v1/phase2/data-components.js +5 -0
- package/dist/_virtual/_raw_/home/runner/work/agents/agents/agents-run-api/templates/v1/phase2/system-prompt.js +5 -0
- package/dist/_virtual/_raw_/home/runner/work/agents/agents/agents-run-api/templates/v1/shared/artifact-retrieval-guidance.js +5 -0
- package/dist/_virtual/_raw_/home/runner/work/agents/agents/agents-run-api/templates/v1/shared/artifact.js +5 -0
- package/dist/a2a/client.d.ts +184 -0
- package/dist/a2a/client.js +510 -0
- package/dist/a2a/handlers.d.ts +7 -0
- package/dist/a2a/handlers.js +576 -0
- package/dist/a2a/transfer.d.ts +22 -0
- package/dist/a2a/transfer.js +46 -0
- package/dist/a2a/types.d.ts +79 -0
- package/dist/a2a/types.js +22 -0
- package/dist/agents/Agent.d.ts +268 -0
- package/dist/agents/Agent.js +1932 -0
- package/dist/agents/ModelFactory.d.ts +63 -0
- package/dist/agents/ModelFactory.js +194 -0
- package/dist/agents/SystemPromptBuilder.d.ts +21 -0
- package/dist/agents/SystemPromptBuilder.js +48 -0
- package/dist/agents/ToolSessionManager.d.ts +63 -0
- package/dist/agents/ToolSessionManager.js +146 -0
- package/dist/agents/generateTaskHandler.d.ts +49 -0
- package/dist/agents/generateTaskHandler.js +523 -0
- package/dist/agents/relationTools.d.ts +57 -0
- package/dist/agents/relationTools.js +262 -0
- package/dist/agents/types.d.ts +28 -0
- package/dist/agents/types.js +1 -0
- package/dist/agents/versions/v1/Phase1Config.d.ts +27 -0
- package/dist/agents/versions/v1/Phase1Config.js +424 -0
- package/dist/agents/versions/v1/Phase2Config.d.ts +31 -0
- package/dist/agents/versions/v1/Phase2Config.js +330 -0
- package/dist/constants/execution-limits/defaults.d.ts +51 -0
- package/dist/constants/execution-limits/defaults.js +52 -0
- package/dist/constants/execution-limits/index.d.ts +6 -0
- package/dist/constants/execution-limits/index.js +21 -0
- package/dist/create-app.d.ts +9 -0
- package/dist/create-app.js +195 -0
- package/dist/data/agent.d.ts +7 -0
- package/dist/data/agent.js +72 -0
- package/dist/data/agents.d.ts +34 -0
- package/dist/data/agents.js +139 -0
- package/dist/data/conversations.d.ts +128 -0
- package/dist/data/conversations.js +522 -0
- package/dist/data/db/dbClient.d.ts +6 -0
- package/dist/data/db/dbClient.js +17 -0
- package/dist/env.d.ts +57 -0
- package/dist/env.js +1 -2
- package/dist/handlers/executionHandler.d.ts +41 -0
- package/dist/handlers/executionHandler.js +457 -0
- package/dist/index.d.ts +8 -29
- package/dist/index.js +5 -11386
- package/dist/instrumentation.d.ts +1 -2
- package/dist/instrumentation.js +66 -3
- package/dist/{logger2.js → logger.d.ts} +1 -2
- package/dist/logger.js +1 -1
- package/dist/middleware/api-key-auth.d.ts +26 -0
- package/dist/middleware/api-key-auth.js +240 -0
- package/dist/middleware/index.d.ts +2 -0
- package/dist/middleware/index.js +3 -0
- package/dist/openapi.d.ts +4 -0
- package/dist/openapi.js +54 -0
- package/dist/routes/agents.d.ts +12 -0
- package/dist/routes/agents.js +147 -0
- package/dist/routes/chat.d.ts +13 -0
- package/dist/routes/chat.js +305 -0
- package/dist/routes/chatDataStream.d.ts +13 -0
- package/dist/routes/chatDataStream.js +365 -0
- package/dist/routes/mcp.d.ts +13 -0
- package/dist/routes/mcp.js +495 -0
- package/dist/services/AgentSession.d.ts +356 -0
- package/dist/services/AgentSession.js +1208 -0
- package/dist/services/ArtifactParser.d.ts +105 -0
- package/dist/services/ArtifactParser.js +338 -0
- package/dist/services/ArtifactService.d.ts +123 -0
- package/dist/services/ArtifactService.js +612 -0
- package/dist/services/BaseCompressor.d.ts +183 -0
- package/dist/services/BaseCompressor.js +500 -0
- package/dist/services/ConversationCompressor.d.ts +32 -0
- package/dist/services/ConversationCompressor.js +91 -0
- package/dist/services/IncrementalStreamParser.d.ts +98 -0
- package/dist/services/IncrementalStreamParser.js +327 -0
- package/dist/services/MidGenerationCompressor.d.ts +63 -0
- package/dist/services/MidGenerationCompressor.js +104 -0
- package/dist/services/PendingToolApprovalManager.d.ts +62 -0
- package/dist/services/PendingToolApprovalManager.js +133 -0
- package/dist/services/ResponseFormatter.d.ts +39 -0
- package/dist/services/ResponseFormatter.js +152 -0
- package/dist/tools/NativeSandboxExecutor.d.ts +38 -0
- package/dist/tools/NativeSandboxExecutor.js +432 -0
- package/dist/tools/SandboxExecutorFactory.d.ts +36 -0
- package/dist/tools/SandboxExecutorFactory.js +80 -0
- package/dist/tools/VercelSandboxExecutor.d.ts +71 -0
- package/dist/tools/VercelSandboxExecutor.js +340 -0
- package/dist/tools/distill-conversation-history-tool.d.ts +62 -0
- package/dist/tools/distill-conversation-history-tool.js +206 -0
- package/dist/tools/distill-conversation-tool.d.ts +41 -0
- package/dist/tools/distill-conversation-tool.js +141 -0
- package/dist/tools/sandbox-utils.d.ts +18 -0
- package/dist/tools/sandbox-utils.js +53 -0
- package/dist/types/chat.d.ts +27 -0
- package/dist/types/chat.js +1 -0
- package/dist/types/execution-context.d.ts +46 -0
- package/dist/types/execution-context.js +27 -0
- package/dist/types/xml.d.ts +5 -0
- package/dist/utils/SchemaProcessor.d.ts +52 -0
- package/dist/utils/SchemaProcessor.js +182 -0
- package/dist/utils/agent-operations.d.ts +62 -0
- package/dist/utils/agent-operations.js +53 -0
- package/dist/utils/artifact-component-schema.d.ts +42 -0
- package/dist/utils/artifact-component-schema.js +186 -0
- package/dist/utils/cleanup.d.ts +21 -0
- package/dist/utils/cleanup.js +59 -0
- package/dist/utils/data-component-schema.d.ts +2 -0
- package/dist/utils/data-component-schema.js +3 -0
- package/dist/utils/default-status-schemas.d.ts +20 -0
- package/dist/utils/default-status-schemas.js +24 -0
- package/dist/utils/json-postprocessor.d.ts +13 -0
- package/dist/{json-postprocessor.cjs → utils/json-postprocessor.js} +2 -3
- package/dist/utils/model-context-utils.d.ts +39 -0
- package/dist/utils/model-context-utils.js +181 -0
- package/dist/utils/model-resolver.d.ts +6 -0
- package/dist/utils/model-resolver.js +34 -0
- package/dist/utils/schema-validation.d.ts +44 -0
- package/dist/utils/schema-validation.js +97 -0
- package/dist/utils/stream-helpers.d.ts +197 -0
- package/dist/utils/stream-helpers.js +518 -0
- package/dist/utils/stream-registry.d.ts +22 -0
- package/dist/utils/stream-registry.js +34 -0
- package/dist/utils/token-estimator.d.ts +69 -0
- package/dist/utils/token-estimator.js +53 -0
- package/dist/utils/tracer.d.ts +7 -0
- package/dist/utils/tracer.js +7 -0
- package/package.json +10 -26
- package/dist/SandboxExecutorFactory.cjs +0 -895
- package/dist/SandboxExecutorFactory.js +0 -893
- package/dist/SandboxExecutorFactory.js.map +0 -1
- package/dist/chunk-VBDAOXYI.cjs +0 -927
- package/dist/chunk-VBDAOXYI.js +0 -832
- package/dist/chunk-VBDAOXYI.js.map +0 -1
- package/dist/chunk.cjs +0 -34
- package/dist/conversations.cjs +0 -7
- package/dist/conversations.js +0 -7
- package/dist/conversations2.cjs +0 -209
- package/dist/conversations2.js +0 -180
- package/dist/conversations2.js.map +0 -1
- package/dist/dbClient.cjs +0 -9676
- package/dist/dbClient.js +0 -9670
- package/dist/dbClient.js.map +0 -1
- package/dist/dbClient2.cjs +0 -5
- package/dist/dbClient2.js +0 -5
- package/dist/env.cjs +0 -59
- package/dist/env.js.map +0 -1
- package/dist/execution-limits.cjs +0 -260
- package/dist/execution-limits.js +0 -63
- package/dist/execution-limits.js.map +0 -1
- package/dist/index.cjs +0 -11411
- package/dist/index.d.cts +0 -36
- package/dist/index.d.cts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/instrumentation.cjs +0 -12
- package/dist/instrumentation.d.cts +0 -18
- package/dist/instrumentation.d.cts.map +0 -1
- package/dist/instrumentation.d.ts.map +0 -1
- package/dist/instrumentation2.cjs +0 -116
- package/dist/instrumentation2.js +0 -69
- package/dist/instrumentation2.js.map +0 -1
- package/dist/json-postprocessor.js +0 -20
- package/dist/json-postprocessor.js.map +0 -1
- package/dist/logger.cjs +0 -5
- package/dist/logger2.cjs +0 -1
- package/dist/nodefs.cjs +0 -29
- package/dist/nodefs.js +0 -27
- package/dist/nodefs.js.map +0 -1
- package/dist/opfs-ahp.cjs +0 -367
- package/dist/opfs-ahp.js +0 -368
- package/dist/opfs-ahp.js.map +0 -1
package/dist/opfs-ahp.cjs
DELETED
|
@@ -1,367 +0,0 @@
|
|
|
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;
|