@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.
Files changed (180) hide show
  1. package/dist/_virtual/_raw_/home/runner/work/agents/agents/agents-run-api/templates/v1/phase1/system-prompt.js +5 -0
  2. package/dist/_virtual/_raw_/home/runner/work/agents/agents/agents-run-api/templates/v1/phase1/thinking-preparation.js +5 -0
  3. package/dist/_virtual/_raw_/home/runner/work/agents/agents/agents-run-api/templates/v1/phase1/tool.js +5 -0
  4. package/dist/_virtual/_raw_/home/runner/work/agents/agents/agents-run-api/templates/v1/phase2/data-component.js +5 -0
  5. package/dist/_virtual/_raw_/home/runner/work/agents/agents/agents-run-api/templates/v1/phase2/data-components.js +5 -0
  6. package/dist/_virtual/_raw_/home/runner/work/agents/agents/agents-run-api/templates/v1/phase2/system-prompt.js +5 -0
  7. package/dist/_virtual/_raw_/home/runner/work/agents/agents/agents-run-api/templates/v1/shared/artifact-retrieval-guidance.js +5 -0
  8. package/dist/_virtual/_raw_/home/runner/work/agents/agents/agents-run-api/templates/v1/shared/artifact.js +5 -0
  9. package/dist/a2a/client.d.ts +184 -0
  10. package/dist/a2a/client.js +510 -0
  11. package/dist/a2a/handlers.d.ts +7 -0
  12. package/dist/a2a/handlers.js +576 -0
  13. package/dist/a2a/transfer.d.ts +22 -0
  14. package/dist/a2a/transfer.js +46 -0
  15. package/dist/a2a/types.d.ts +79 -0
  16. package/dist/a2a/types.js +22 -0
  17. package/dist/agents/Agent.d.ts +268 -0
  18. package/dist/agents/Agent.js +1932 -0
  19. package/dist/agents/ModelFactory.d.ts +63 -0
  20. package/dist/agents/ModelFactory.js +194 -0
  21. package/dist/agents/SystemPromptBuilder.d.ts +21 -0
  22. package/dist/agents/SystemPromptBuilder.js +48 -0
  23. package/dist/agents/ToolSessionManager.d.ts +63 -0
  24. package/dist/agents/ToolSessionManager.js +146 -0
  25. package/dist/agents/generateTaskHandler.d.ts +49 -0
  26. package/dist/agents/generateTaskHandler.js +523 -0
  27. package/dist/agents/relationTools.d.ts +57 -0
  28. package/dist/agents/relationTools.js +262 -0
  29. package/dist/agents/types.d.ts +28 -0
  30. package/dist/agents/types.js +1 -0
  31. package/dist/agents/versions/v1/Phase1Config.d.ts +27 -0
  32. package/dist/agents/versions/v1/Phase1Config.js +424 -0
  33. package/dist/agents/versions/v1/Phase2Config.d.ts +31 -0
  34. package/dist/agents/versions/v1/Phase2Config.js +330 -0
  35. package/dist/constants/execution-limits/defaults.d.ts +51 -0
  36. package/dist/constants/execution-limits/defaults.js +52 -0
  37. package/dist/constants/execution-limits/index.d.ts +6 -0
  38. package/dist/constants/execution-limits/index.js +21 -0
  39. package/dist/create-app.d.ts +9 -0
  40. package/dist/create-app.js +195 -0
  41. package/dist/data/agent.d.ts +7 -0
  42. package/dist/data/agent.js +72 -0
  43. package/dist/data/agents.d.ts +34 -0
  44. package/dist/data/agents.js +139 -0
  45. package/dist/data/conversations.d.ts +128 -0
  46. package/dist/data/conversations.js +522 -0
  47. package/dist/data/db/dbClient.d.ts +6 -0
  48. package/dist/data/db/dbClient.js +17 -0
  49. package/dist/env.d.ts +57 -0
  50. package/dist/env.js +1 -2
  51. package/dist/handlers/executionHandler.d.ts +41 -0
  52. package/dist/handlers/executionHandler.js +457 -0
  53. package/dist/index.d.ts +8 -29
  54. package/dist/index.js +5 -11386
  55. package/dist/instrumentation.d.ts +1 -2
  56. package/dist/instrumentation.js +66 -3
  57. package/dist/{logger2.js → logger.d.ts} +1 -2
  58. package/dist/logger.js +1 -1
  59. package/dist/middleware/api-key-auth.d.ts +26 -0
  60. package/dist/middleware/api-key-auth.js +240 -0
  61. package/dist/middleware/index.d.ts +2 -0
  62. package/dist/middleware/index.js +3 -0
  63. package/dist/openapi.d.ts +4 -0
  64. package/dist/openapi.js +54 -0
  65. package/dist/routes/agents.d.ts +12 -0
  66. package/dist/routes/agents.js +147 -0
  67. package/dist/routes/chat.d.ts +13 -0
  68. package/dist/routes/chat.js +305 -0
  69. package/dist/routes/chatDataStream.d.ts +13 -0
  70. package/dist/routes/chatDataStream.js +365 -0
  71. package/dist/routes/mcp.d.ts +13 -0
  72. package/dist/routes/mcp.js +495 -0
  73. package/dist/services/AgentSession.d.ts +356 -0
  74. package/dist/services/AgentSession.js +1208 -0
  75. package/dist/services/ArtifactParser.d.ts +105 -0
  76. package/dist/services/ArtifactParser.js +338 -0
  77. package/dist/services/ArtifactService.d.ts +123 -0
  78. package/dist/services/ArtifactService.js +612 -0
  79. package/dist/services/BaseCompressor.d.ts +183 -0
  80. package/dist/services/BaseCompressor.js +500 -0
  81. package/dist/services/ConversationCompressor.d.ts +32 -0
  82. package/dist/services/ConversationCompressor.js +91 -0
  83. package/dist/services/IncrementalStreamParser.d.ts +98 -0
  84. package/dist/services/IncrementalStreamParser.js +327 -0
  85. package/dist/services/MidGenerationCompressor.d.ts +63 -0
  86. package/dist/services/MidGenerationCompressor.js +104 -0
  87. package/dist/services/PendingToolApprovalManager.d.ts +62 -0
  88. package/dist/services/PendingToolApprovalManager.js +133 -0
  89. package/dist/services/ResponseFormatter.d.ts +39 -0
  90. package/dist/services/ResponseFormatter.js +152 -0
  91. package/dist/tools/NativeSandboxExecutor.d.ts +38 -0
  92. package/dist/tools/NativeSandboxExecutor.js +432 -0
  93. package/dist/tools/SandboxExecutorFactory.d.ts +36 -0
  94. package/dist/tools/SandboxExecutorFactory.js +80 -0
  95. package/dist/tools/VercelSandboxExecutor.d.ts +71 -0
  96. package/dist/tools/VercelSandboxExecutor.js +340 -0
  97. package/dist/tools/distill-conversation-history-tool.d.ts +62 -0
  98. package/dist/tools/distill-conversation-history-tool.js +206 -0
  99. package/dist/tools/distill-conversation-tool.d.ts +41 -0
  100. package/dist/tools/distill-conversation-tool.js +141 -0
  101. package/dist/tools/sandbox-utils.d.ts +18 -0
  102. package/dist/tools/sandbox-utils.js +53 -0
  103. package/dist/types/chat.d.ts +27 -0
  104. package/dist/types/chat.js +1 -0
  105. package/dist/types/execution-context.d.ts +46 -0
  106. package/dist/types/execution-context.js +27 -0
  107. package/dist/types/xml.d.ts +5 -0
  108. package/dist/utils/SchemaProcessor.d.ts +52 -0
  109. package/dist/utils/SchemaProcessor.js +182 -0
  110. package/dist/utils/agent-operations.d.ts +62 -0
  111. package/dist/utils/agent-operations.js +53 -0
  112. package/dist/utils/artifact-component-schema.d.ts +42 -0
  113. package/dist/utils/artifact-component-schema.js +186 -0
  114. package/dist/utils/cleanup.d.ts +21 -0
  115. package/dist/utils/cleanup.js +59 -0
  116. package/dist/utils/data-component-schema.d.ts +2 -0
  117. package/dist/utils/data-component-schema.js +3 -0
  118. package/dist/utils/default-status-schemas.d.ts +20 -0
  119. package/dist/utils/default-status-schemas.js +24 -0
  120. package/dist/utils/json-postprocessor.d.ts +13 -0
  121. package/dist/{json-postprocessor.cjs → utils/json-postprocessor.js} +2 -3
  122. package/dist/utils/model-context-utils.d.ts +39 -0
  123. package/dist/utils/model-context-utils.js +181 -0
  124. package/dist/utils/model-resolver.d.ts +6 -0
  125. package/dist/utils/model-resolver.js +34 -0
  126. package/dist/utils/schema-validation.d.ts +44 -0
  127. package/dist/utils/schema-validation.js +97 -0
  128. package/dist/utils/stream-helpers.d.ts +197 -0
  129. package/dist/utils/stream-helpers.js +518 -0
  130. package/dist/utils/stream-registry.d.ts +22 -0
  131. package/dist/utils/stream-registry.js +34 -0
  132. package/dist/utils/token-estimator.d.ts +69 -0
  133. package/dist/utils/token-estimator.js +53 -0
  134. package/dist/utils/tracer.d.ts +7 -0
  135. package/dist/utils/tracer.js +7 -0
  136. package/package.json +10 -26
  137. package/dist/SandboxExecutorFactory.cjs +0 -895
  138. package/dist/SandboxExecutorFactory.js +0 -893
  139. package/dist/SandboxExecutorFactory.js.map +0 -1
  140. package/dist/chunk-VBDAOXYI.cjs +0 -927
  141. package/dist/chunk-VBDAOXYI.js +0 -832
  142. package/dist/chunk-VBDAOXYI.js.map +0 -1
  143. package/dist/chunk.cjs +0 -34
  144. package/dist/conversations.cjs +0 -7
  145. package/dist/conversations.js +0 -7
  146. package/dist/conversations2.cjs +0 -209
  147. package/dist/conversations2.js +0 -180
  148. package/dist/conversations2.js.map +0 -1
  149. package/dist/dbClient.cjs +0 -9676
  150. package/dist/dbClient.js +0 -9670
  151. package/dist/dbClient.js.map +0 -1
  152. package/dist/dbClient2.cjs +0 -5
  153. package/dist/dbClient2.js +0 -5
  154. package/dist/env.cjs +0 -59
  155. package/dist/env.js.map +0 -1
  156. package/dist/execution-limits.cjs +0 -260
  157. package/dist/execution-limits.js +0 -63
  158. package/dist/execution-limits.js.map +0 -1
  159. package/dist/index.cjs +0 -11411
  160. package/dist/index.d.cts +0 -36
  161. package/dist/index.d.cts.map +0 -1
  162. package/dist/index.d.ts.map +0 -1
  163. package/dist/index.js.map +0 -1
  164. package/dist/instrumentation.cjs +0 -12
  165. package/dist/instrumentation.d.cts +0 -18
  166. package/dist/instrumentation.d.cts.map +0 -1
  167. package/dist/instrumentation.d.ts.map +0 -1
  168. package/dist/instrumentation2.cjs +0 -116
  169. package/dist/instrumentation2.js +0 -69
  170. package/dist/instrumentation2.js.map +0 -1
  171. package/dist/json-postprocessor.js +0 -20
  172. package/dist/json-postprocessor.js.map +0 -1
  173. package/dist/logger.cjs +0 -5
  174. package/dist/logger2.cjs +0 -1
  175. package/dist/nodefs.cjs +0 -29
  176. package/dist/nodefs.js +0 -27
  177. package/dist/nodefs.js.map +0 -1
  178. package/dist/opfs-ahp.cjs +0 -367
  179. package/dist/opfs-ahp.js +0 -368
  180. package/dist/opfs-ahp.js.map +0 -1
@@ -1,927 +0,0 @@
1
-
2
- //#region ../node_modules/.pnpm/@electric-sql+pglite@0.3.14/node_modules/@electric-sql/pglite/dist/chunk-QY3QWFKW.js
3
- var p = Object.create;
4
- var i = Object.defineProperty;
5
- var c = Object.getOwnPropertyDescriptor;
6
- var f = Object.getOwnPropertyNames;
7
- var l = Object.getPrototypeOf, s = Object.prototype.hasOwnProperty;
8
- var a = (t) => {
9
- throw TypeError(t);
10
- };
11
- var _ = (t, e, o) => e in t ? i(t, e, {
12
- enumerable: !0,
13
- configurable: !0,
14
- writable: !0,
15
- value: o
16
- }) : t[e] = o;
17
- var d = (t, e) => () => (t && (e = t(t = 0)), e);
18
- var D = (t, e) => () => (e || t((e = { exports: {} }).exports, e), e.exports), F = (t, e) => {
19
- for (var o in e) i(t, o, {
20
- get: e[o],
21
- enumerable: !0
22
- });
23
- }, g$1 = (t, e, o, m) => {
24
- if (e && typeof e == "object" || typeof e == "function") for (let r of f(e)) !s.call(t, r) && r !== o && i(t, r, {
25
- get: () => e[r],
26
- enumerable: !(m = c(e, r)) || m.enumerable
27
- });
28
- return t;
29
- };
30
- var L = (t, e, o) => (o = t != null ? p(l(t)) : {}, g$1(e || !t || !t.__esModule ? i(o, "default", {
31
- value: t,
32
- enumerable: !0
33
- }) : o, t));
34
- var P = (t, e, o) => _(t, typeof e != "symbol" ? e + "" : e, o), n = (t, e, o) => e.has(t) || a("Cannot " + o);
35
- var h = (t, e, o) => (n(t, e, "read from private field"), o ? o.call(t) : e.get(t)), R = (t, e, o) => e.has(t) ? a("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, o), x$1 = (t, e, o, m) => (n(t, e, "write to private field"), m ? m.call(t, o) : e.set(t, o), o), T = (t, e, o) => (n(t, e, "access private method"), o);
36
- var U = (t, e, o, m) => ({
37
- set _(r) {
38
- x$1(t, e, r, o);
39
- },
40
- get _() {
41
- return h(t, e, m);
42
- }
43
- });
44
- var u = d(() => {
45
- "use strict";
46
- });
47
-
48
- //#endregion
49
- //#region ../node_modules/.pnpm/@electric-sql+pglite@0.3.14/node_modules/@electric-sql/pglite/dist/chunk-VBDAOXYI.js
50
- var w = D(($r, l$1) => {
51
- "use strict";
52
- u();
53
- var j = 9007199254740991, B = function(r) {
54
- return r;
55
- }();
56
- function mr(r) {
57
- return r === B;
58
- }
59
- function q(r) {
60
- return typeof r == "string" || Object.prototype.toString.call(r) == "[object String]";
61
- }
62
- function lr(r) {
63
- return Object.prototype.toString.call(r) == "[object Date]";
64
- }
65
- function N(r) {
66
- return r !== null && typeof r == "object";
67
- }
68
- function U$1(r) {
69
- return typeof r == "function";
70
- }
71
- function fr(r) {
72
- return typeof r == "number" && r > -1 && r % 1 == 0 && r <= j;
73
- }
74
- function yr(r) {
75
- return Object.prototype.toString.call(r) == "[object Array]";
76
- }
77
- function Y(r) {
78
- return N(r) && !U$1(r) && fr(r.length);
79
- }
80
- function D$1(r) {
81
- return Object.prototype.toString.call(r) == "[object ArrayBuffer]";
82
- }
83
- function gr(r, e) {
84
- return Array.prototype.map.call(r, e);
85
- }
86
- function hr(r, e) {
87
- var t = B;
88
- return U$1(e) && Array.prototype.every.call(r, function(s$1, a$1, n$1) {
89
- var o = e(s$1, a$1, n$1);
90
- return o && (t = s$1), !o;
91
- }), t;
92
- }
93
- function Sr(r) {
94
- return Object.assign.apply(null, arguments);
95
- }
96
- function W(r) {
97
- var e, t, s$1;
98
- if (q(r)) {
99
- for (t = r.length, s$1 = new Uint8Array(t), e = 0; e < t; e++) s$1[e] = r.charCodeAt(e) & 255;
100
- return s$1;
101
- }
102
- return D$1(r) ? new Uint8Array(r) : N(r) && D$1(r.buffer) ? new Uint8Array(r.buffer) : Y(r) ? new Uint8Array(r) : N(r) && U$1(r.toString) ? W(r.toString()) : new Uint8Array();
103
- }
104
- l$1.exports.MAX_SAFE_INTEGER = j;
105
- l$1.exports.isUndefined = mr;
106
- l$1.exports.isString = q;
107
- l$1.exports.isObject = N;
108
- l$1.exports.isDateTime = lr;
109
- l$1.exports.isFunction = U$1;
110
- l$1.exports.isArray = yr;
111
- l$1.exports.isArrayLike = Y;
112
- l$1.exports.isArrayBuffer = D$1;
113
- l$1.exports.map = gr;
114
- l$1.exports.find = hr;
115
- l$1.exports.extend = Sr;
116
- l$1.exports.toUint8Array = W;
117
- });
118
- var x = D((Qr, X) => {
119
- "use strict";
120
- u();
121
- var M = "\0";
122
- X.exports = {
123
- NULL_CHAR: M,
124
- TMAGIC: "ustar" + M + "00",
125
- OLDGNU_MAGIC: "ustar " + M,
126
- REGTYPE: 0,
127
- LNKTYPE: 1,
128
- SYMTYPE: 2,
129
- CHRTYPE: 3,
130
- BLKTYPE: 4,
131
- DIRTYPE: 5,
132
- FIFOTYPE: 6,
133
- CONTTYPE: 7,
134
- TSUID: parseInt("4000", 8),
135
- TSGID: parseInt("2000", 8),
136
- TSVTX: parseInt("1000", 8),
137
- TUREAD: parseInt("0400", 8),
138
- TUWRITE: parseInt("0200", 8),
139
- TUEXEC: parseInt("0100", 8),
140
- TGREAD: parseInt("0040", 8),
141
- TGWRITE: parseInt("0020", 8),
142
- TGEXEC: parseInt("0010", 8),
143
- TOREAD: parseInt("0004", 8),
144
- TOWRITE: parseInt("0002", 8),
145
- TOEXEC: parseInt("0001", 8),
146
- TPERMALL: parseInt("0777", 8),
147
- TPERMMASK: parseInt("0777", 8)
148
- };
149
- });
150
- var L$1 = D((ee, f$1) => {
151
- "use strict";
152
- u();
153
- var K = w(), p$1 = x(), Fr = 512, I = p$1.TPERMALL, V = 0, Z = 0, _$1 = [
154
- [
155
- "name",
156
- 100,
157
- 0,
158
- function(r, e) {
159
- return v(r[e[0]], e[1]);
160
- },
161
- function(r, e, t) {
162
- return A(r.slice(e, e + t[1]));
163
- }
164
- ],
165
- [
166
- "mode",
167
- 8,
168
- 100,
169
- function(r, e) {
170
- var t = r[e[0]] || I;
171
- return t = t & p$1.TPERMMASK, P$1(t, e[1], I);
172
- },
173
- function(r, e, t) {
174
- var s$1 = S(r.slice(e, e + t[1]));
175
- return s$1 &= p$1.TPERMMASK, s$1;
176
- }
177
- ],
178
- [
179
- "uid",
180
- 8,
181
- 108,
182
- function(r, e) {
183
- return P$1(r[e[0]], e[1], V);
184
- },
185
- function(r, e, t) {
186
- return S(r.slice(e, e + t[1]));
187
- }
188
- ],
189
- [
190
- "gid",
191
- 8,
192
- 116,
193
- function(r, e) {
194
- return P$1(r[e[0]], e[1], Z);
195
- },
196
- function(r, e, t) {
197
- return S(r.slice(e, e + t[1]));
198
- }
199
- ],
200
- [
201
- "size",
202
- 12,
203
- 124,
204
- function(r, e) {
205
- return P$1(r.data.length, e[1]);
206
- },
207
- function(r, e, t) {
208
- return S(r.slice(e, e + t[1]));
209
- }
210
- ],
211
- [
212
- "modifyTime",
213
- 12,
214
- 136,
215
- function(r, e) {
216
- return k(r[e[0]], e[1]);
217
- },
218
- function(r, e, t) {
219
- return z(r.slice(e, e + t[1]));
220
- }
221
- ],
222
- [
223
- "checksum",
224
- 8,
225
- 148,
226
- function(r, e) {
227
- return " ";
228
- },
229
- function(r, e, t) {
230
- return S(r.slice(e, e + t[1]));
231
- }
232
- ],
233
- [
234
- "type",
235
- 1,
236
- 156,
237
- function(r, e) {
238
- return "" + (parseInt(r[e[0]], 10) || 0) % 8;
239
- },
240
- function(r, e, t) {
241
- return (parseInt(String.fromCharCode(r[e]), 10) || 0) % 8;
242
- }
243
- ],
244
- [
245
- "linkName",
246
- 100,
247
- 157,
248
- function(r, e) {
249
- return "";
250
- },
251
- function(r, e, t) {
252
- return A(r.slice(e, e + t[1]));
253
- }
254
- ],
255
- [
256
- "ustar",
257
- 8,
258
- 257,
259
- function(r, e) {
260
- return p$1.TMAGIC;
261
- },
262
- function(r, e, t) {
263
- return br(A(r.slice(e, e + t[1]), !0));
264
- },
265
- function(r, e) {
266
- return r[e[0]] == p$1.TMAGIC || r[e[0]] == p$1.OLDGNU_MAGIC;
267
- }
268
- ],
269
- [
270
- "owner",
271
- 32,
272
- 265,
273
- function(r, e) {
274
- return v(r[e[0]], e[1]);
275
- },
276
- function(r, e, t) {
277
- return A(r.slice(e, e + t[1]));
278
- }
279
- ],
280
- [
281
- "group",
282
- 32,
283
- 297,
284
- function(r, e) {
285
- return v(r[e[0]], e[1]);
286
- },
287
- function(r, e, t) {
288
- return A(r.slice(e, e + t[1]));
289
- }
290
- ],
291
- [
292
- "majorNumber",
293
- 8,
294
- 329,
295
- function(r, e) {
296
- return "";
297
- },
298
- function(r, e, t) {
299
- return S(r.slice(e, e + t[1]));
300
- }
301
- ],
302
- [
303
- "minorNumber",
304
- 8,
305
- 337,
306
- function(r, e) {
307
- return "";
308
- },
309
- function(r, e, t) {
310
- return S(r.slice(e, e + t[1]));
311
- }
312
- ],
313
- [
314
- "prefix",
315
- 131,
316
- 345,
317
- function(r, e) {
318
- return v(r[e[0]], e[1]);
319
- },
320
- function(r, e, t) {
321
- return A(r.slice(e, e + t[1]));
322
- }
323
- ],
324
- [
325
- "accessTime",
326
- 12,
327
- 476,
328
- function(r, e) {
329
- return k(r[e[0]], e[1]);
330
- },
331
- function(r, e, t) {
332
- return z(r.slice(e, e + t[1]));
333
- }
334
- ],
335
- [
336
- "createTime",
337
- 12,
338
- 488,
339
- function(r, e) {
340
- return k(r[e[0]], e[1]);
341
- },
342
- function(r, e, t) {
343
- return z(r.slice(e, e + t[1]));
344
- }
345
- ]
346
- ], $ = function(r) {
347
- var e = r[r.length - 1];
348
- return e[2] + e[1];
349
- }(_$1);
350
- function br(r) {
351
- if (r.length == 8) {
352
- var e = r.split("");
353
- if (e[5] == p$1.NULL_CHAR) return (e[6] == " " || e[6] == p$1.NULL_CHAR) && (e[6] = "0"), (e[7] == " " || e[7] == p$1.NULL_CHAR) && (e[7] = "0"), e = e.join(""), e == p$1.TMAGIC ? e : r;
354
- if (e[7] == p$1.NULL_CHAR) return e[5] == p$1.NULL_CHAR && (e[5] = " "), e[6] == p$1.NULL_CHAR && (e[6] = " "), e == p$1.OLDGNU_MAGIC ? e : r;
355
- }
356
- return r;
357
- }
358
- function v(r, e) {
359
- return e -= 1, K.isUndefined(r) && (r = ""), r = ("" + r).substr(0, e), r + p$1.NULL_CHAR;
360
- }
361
- function P$1(r, e, t) {
362
- for (t = parseInt(t) || 0, e -= 1, r = (parseInt(r) || t).toString(8).substr(-e, e); r.length < e;) r = "0" + r;
363
- return r + p$1.NULL_CHAR;
364
- }
365
- function k(r, e) {
366
- if (K.isDateTime(r)) r = Math.floor(1 * r / 1e3);
367
- else if (r = parseInt(r, 10), isFinite(r)) {
368
- if (r <= 0) return "";
369
- } else r = Math.floor(1 * /* @__PURE__ */ new Date() / 1e3);
370
- return P$1(r, e, 0);
371
- }
372
- function A(r, e) {
373
- var t = String.fromCharCode.apply(null, r);
374
- if (e) return t;
375
- var s$1 = t.indexOf(p$1.NULL_CHAR);
376
- return s$1 >= 0 ? t.substr(0, s$1) : t;
377
- }
378
- function S(r) {
379
- var e = String.fromCharCode.apply(null, r);
380
- return parseInt(e.replace(/^0+$/g, ""), 8) || 0;
381
- }
382
- function z(r) {
383
- return r.length == 0 || r[0] == 0 ? null : /* @__PURE__ */ new Date(1e3 * S(r));
384
- }
385
- function Tr(r, e, t) {
386
- var s$1 = parseInt(e, 10) || 0, a$1 = Math.min(s$1 + $, r.length), n$1 = 0, o = 0, i$1 = 0;
387
- t && _$1.every(function(y) {
388
- return y[0] == "checksum" ? (o = s$1 + y[2], i$1 = o + y[1], !1) : !0;
389
- });
390
- for (var u$1 = 32, c$1 = s$1; c$1 < a$1; c$1++) {
391
- var m = c$1 >= o && c$1 < i$1 ? u$1 : r[c$1];
392
- n$1 = (n$1 + m) % 262144;
393
- }
394
- return n$1;
395
- }
396
- f$1.exports.recordSize = Fr;
397
- f$1.exports.defaultFileMode = I;
398
- f$1.exports.defaultUid = V;
399
- f$1.exports.defaultGid = Z;
400
- f$1.exports.posixHeader = _$1;
401
- f$1.exports.effectiveHeaderSize = $;
402
- f$1.exports.calculateChecksum = Tr;
403
- f$1.exports.formatTarString = v;
404
- f$1.exports.formatTarNumber = P$1;
405
- f$1.exports.formatTarDateTime = k;
406
- f$1.exports.parseTarString = A;
407
- f$1.exports.parseTarNumber = S;
408
- f$1.exports.parseTarDateTime = z;
409
- });
410
- var er = D((ne, rr) => {
411
- "use strict";
412
- u();
413
- var Ar = x(), O = w(), F$1 = L$1();
414
- function J(r) {
415
- return F$1.recordSize;
416
- }
417
- function Q(r) {
418
- return Math.ceil(r.data.length / F$1.recordSize) * F$1.recordSize;
419
- }
420
- function Er(r) {
421
- var e = 0;
422
- return r.forEach(function(t) {
423
- e += J(t) + Q(t);
424
- }), e += F$1.recordSize * 2, new Uint8Array(e);
425
- }
426
- function Pr(r, e, t) {
427
- t = parseInt(t) || 0;
428
- var s$1 = t;
429
- F$1.posixHeader.forEach(function(u$1) {
430
- for (var c$1 = u$1[3](e, u$1), m = c$1.length, y = 0; y < m; y += 1) r[s$1 + y] = c$1.charCodeAt(y) & 255;
431
- s$1 += u$1[1];
432
- });
433
- var a$1 = O.find(F$1.posixHeader, function(u$1) {
434
- return u$1[0] == "checksum";
435
- });
436
- if (a$1) {
437
- var n$1 = F$1.calculateChecksum(r, t, !0), o = F$1.formatTarNumber(n$1, a$1[1] - 2) + Ar.NULL_CHAR + " ";
438
- s$1 = t + a$1[2];
439
- for (var i$1 = 0; i$1 < o.length; i$1 += 1) r[s$1] = o.charCodeAt(i$1) & 255, s$1++;
440
- }
441
- return t + J(e);
442
- }
443
- function wr(r, e, t) {
444
- return t = parseInt(t, 10) || 0, r.set(e.data, t), t + Q(e);
445
- }
446
- function xr(r) {
447
- r = O.map(r, function(s$1) {
448
- return O.extend({}, s$1, { data: O.toUint8Array(s$1.data) });
449
- });
450
- var e = Er(r), t = 0;
451
- return r.forEach(function(s$1) {
452
- t = Pr(e, s$1, t), t = wr(e, s$1, t);
453
- }), e;
454
- }
455
- rr.exports.tar = xr;
456
- });
457
- var nr = D((oe, tr) => {
458
- "use strict";
459
- u();
460
- var vr = x(), G = w(), h$1 = L$1(), Nr = {
461
- extractData: !0,
462
- checkHeader: !0,
463
- checkChecksum: !0,
464
- checkFileSize: !0
465
- }, Ur = {
466
- size: !0,
467
- checksum: !0,
468
- ustar: !0
469
- }, R$1 = {
470
- unexpectedEndOfFile: "Unexpected end of file.",
471
- fileCorrupted: "File is corrupted.",
472
- checksumCheckFailed: "Checksum check failed."
473
- };
474
- function kr(r) {
475
- return h$1.recordSize;
476
- }
477
- function zr(r) {
478
- return Math.ceil(r / h$1.recordSize) * h$1.recordSize;
479
- }
480
- function Or(r, e) {
481
- for (var t = e, s$1 = Math.min(r.length, e + h$1.recordSize * 2), a$1 = t; a$1 < s$1; a$1++) if (r[a$1] != 0) return !1;
482
- return !0;
483
- }
484
- function Cr(r, e, t) {
485
- if (r.length - e < h$1.recordSize) {
486
- if (t.checkFileSize) throw new Error(R$1.unexpectedEndOfFile);
487
- return null;
488
- }
489
- e = parseInt(e) || 0;
490
- var s$1 = {}, a$1 = e;
491
- if (h$1.posixHeader.forEach(function(i$1) {
492
- s$1[i$1[0]] = i$1[4](r, a$1, i$1), a$1 += i$1[1];
493
- }), s$1.type != 0 && (s$1.size = 0), t.checkHeader && h$1.posixHeader.forEach(function(i$1) {
494
- if (G.isFunction(i$1[5]) && !i$1[5](s$1, i$1)) {
495
- var u$1 = new Error(R$1.fileCorrupted);
496
- throw u$1.data = {
497
- offset: e + i$1[2],
498
- field: i$1[0]
499
- }, u$1;
500
- }
501
- }), t.checkChecksum) {
502
- var n$1 = h$1.calculateChecksum(r, e, !0);
503
- if (n$1 != s$1.checksum) {
504
- var o = new Error(R$1.checksumCheckFailed);
505
- throw o.data = {
506
- offset: e,
507
- header: s$1,
508
- checksum: n$1
509
- }, o;
510
- }
511
- }
512
- return s$1;
513
- }
514
- function Dr(r, e, t, s$1) {
515
- return s$1.extractData ? t.size <= 0 ? new Uint8Array() : r.slice(e, e + t.size) : null;
516
- }
517
- function Mr(r, e) {
518
- var t = {};
519
- return h$1.posixHeader.forEach(function(s$1) {
520
- var a$1 = s$1[0];
521
- Ur[a$1] || (t[a$1] = r[a$1]);
522
- }), t.isOldGNUFormat = r.ustar == vr.OLDGNU_MAGIC, e && (t.data = e), t;
523
- }
524
- function Ir(r, e) {
525
- e = G.extend({}, Nr, e);
526
- for (var t = [], s$1 = 0, a$1 = r.length; a$1 - s$1 >= h$1.recordSize;) {
527
- r = G.toUint8Array(r);
528
- var n$1 = Cr(r, s$1, e);
529
- if (!n$1) break;
530
- s$1 += kr(n$1);
531
- var o = Dr(r, s$1, n$1, e);
532
- if (t.push(Mr(n$1, o)), s$1 += zr(n$1.size), Or(r, s$1)) break;
533
- }
534
- return t;
535
- }
536
- tr.exports.untar = Ir;
537
- });
538
- var or = D((se, ir) => {
539
- "use strict";
540
- u();
541
- var _r = w(), Lr = x(), Rr = er(), Gr = nr();
542
- _r.extend(ir.exports, Rr, Gr, Lr);
543
- });
544
- u();
545
- u();
546
- var g = L(or(), 1);
547
- async function H(r, e, t = "pgdata", s$1 = "auto") {
548
- let [n$1, o] = await qr(Br(r, e), s$1), i$1 = t + (o ? ".tar.gz" : ".tar"), u$1 = o ? "application/x-gzip" : "application/x-tar";
549
- return typeof File < "u" ? new File([n$1], i$1, { type: u$1 }) : new Blob([n$1], { type: u$1 });
550
- }
551
- var Hr = [
552
- "application/x-gtar",
553
- "application/x-tar+gzip",
554
- "application/x-gzip",
555
- "application/gzip"
556
- ];
557
- async function ce(r, e, t) {
558
- let s$1 = new Uint8Array(await e.arrayBuffer()), a$1 = typeof File < "u" && e instanceof File ? e.name : void 0;
559
- (Hr.includes(e.type) || a$1?.endsWith(".tgz") || a$1?.endsWith(".tar.gz")) && (s$1 = await ar(s$1));
560
- let o;
561
- try {
562
- o = (0, g.untar)(s$1);
563
- } catch (i$1) {
564
- if (i$1 instanceof Error && i$1.message.includes("File is corrupted")) s$1 = await ar(s$1), o = (0, g.untar)(s$1);
565
- else throw i$1;
566
- }
567
- for (let i$1 of o) {
568
- let u$1 = t + i$1.name, c$1 = u$1.split("/").slice(0, -1);
569
- for (let m = 1; m <= c$1.length; m++) {
570
- let y = c$1.slice(0, m).join("/");
571
- r.analyzePath(y).exists || r.mkdir(y);
572
- }
573
- i$1.type === g.REGTYPE ? (r.writeFile(u$1, i$1.data), r.utime(u$1, sr(i$1.modifyTime), sr(i$1.modifyTime))) : i$1.type === g.DIRTYPE && r.mkdir(u$1);
574
- }
575
- }
576
- function jr(r, e) {
577
- let t = [], s$1 = (a$1) => {
578
- r.readdir(a$1).forEach((o) => {
579
- if (o === "." || o === "..") return;
580
- let i$1 = a$1 + "/" + o, u$1 = r.stat(i$1), c$1 = r.isFile(u$1.mode) ? r.readFile(i$1, { encoding: "binary" }) : new Uint8Array(0);
581
- t.push({
582
- name: i$1.substring(e.length),
583
- mode: u$1.mode,
584
- size: u$1.size,
585
- type: r.isFile(u$1.mode) ? g.REGTYPE : g.DIRTYPE,
586
- modifyTime: u$1.mtime,
587
- data: c$1
588
- }), r.isDir(u$1.mode) && s$1(i$1);
589
- });
590
- };
591
- return s$1(e), t;
592
- }
593
- function Br(r, e) {
594
- let t = jr(r, e);
595
- return (0, g.tar)(t);
596
- }
597
- async function qr(r, e = "auto") {
598
- if (e === "none") return [r, !1];
599
- if (typeof CompressionStream < "u") return [await Yr(r), !0];
600
- if (typeof process < "u" && process.versions && process.versions.node) return [await Wr(r), !0];
601
- if (e === "auto") return [r, !1];
602
- throw new Error("Compression not supported in this environment");
603
- }
604
- async function Yr(r) {
605
- let e = new CompressionStream("gzip"), t = e.writable.getWriter(), s$1 = e.readable.getReader();
606
- t.write(r), t.close();
607
- let a$1 = [];
608
- for (;;) {
609
- let { value: i$1, done: u$1 } = await s$1.read();
610
- if (u$1) break;
611
- i$1 && a$1.push(i$1);
612
- }
613
- let n$1 = new Uint8Array(a$1.reduce((i$1, u$1) => i$1 + u$1.length, 0)), o = 0;
614
- return a$1.forEach((i$1) => {
615
- n$1.set(i$1, o), o += i$1.length;
616
- }), n$1;
617
- }
618
- async function Wr(r) {
619
- let { promisify: e } = await import("util"), { gzip: t } = await import("zlib");
620
- return await e(t)(r);
621
- }
622
- async function ar(r) {
623
- if (typeof CompressionStream < "u") return await Xr(r);
624
- if (typeof process < "u" && process.versions && process.versions.node) return await Kr(r);
625
- throw new Error("Unsupported environment for decompression");
626
- }
627
- async function Xr(r) {
628
- let e = new DecompressionStream("gzip"), t = e.writable.getWriter(), s$1 = e.readable.getReader();
629
- t.write(r), t.close();
630
- let a$1 = [];
631
- for (;;) {
632
- let { value: i$1, done: u$1 } = await s$1.read();
633
- if (u$1) break;
634
- i$1 && a$1.push(i$1);
635
- }
636
- let n$1 = new Uint8Array(a$1.reduce((i$1, u$1) => i$1 + u$1.length, 0)), o = 0;
637
- return a$1.forEach((i$1) => {
638
- n$1.set(i$1, o), o += i$1.length;
639
- }), n$1;
640
- }
641
- async function Kr(r) {
642
- let { promisify: e } = await import("util"), { gunzip: t } = await import("zlib");
643
- return await e(t)(r);
644
- }
645
- function sr(r) {
646
- return r ? typeof r == "number" ? r : Math.floor(r.getTime() / 1e3) : Math.floor(Date.now() / 1e3);
647
- }
648
- var Vr = "/tmp/pglite", C = Vr + "/base", ur = class {
649
- constructor(e) {
650
- this.dataDir = e;
651
- }
652
- async init(e, t) {
653
- return this.pg = e, { emscriptenOpts: t };
654
- }
655
- async syncToFs(e) {}
656
- async initialSyncFs() {}
657
- async closeFs() {}
658
- async dumpTar(e, t) {
659
- return H(this.pg.Module.FS, C, e, t);
660
- }
661
- }, cr = class {
662
- constructor(e, { debug: t = !1 } = {}) {
663
- this.dataDir = e, this.debug = t;
664
- }
665
- async syncToFs(e) {}
666
- async initialSyncFs() {}
667
- async closeFs() {}
668
- async dumpTar(e, t) {
669
- return H(this.pg.Module.FS, C, e, t);
670
- }
671
- async init(e, t) {
672
- return this.pg = e, { emscriptenOpts: {
673
- ...t,
674
- preRun: [...t.preRun || [], (a$1) => {
675
- let n$1 = Zr(a$1, this);
676
- a$1.FS.mkdir(C), a$1.FS.mount(n$1, {}, C);
677
- }]
678
- } };
679
- }
680
- }, pr = {
681
- EBADF: 8,
682
- EBADFD: 127,
683
- EEXIST: 20,
684
- EINVAL: 28,
685
- EISDIR: 31,
686
- ENODEV: 43,
687
- ENOENT: 44,
688
- ENOTDIR: 54,
689
- ENOTEMPTY: 55
690
- }, Zr = (r, e) => {
691
- let t = r.FS, s$1 = e.debug ? console.log : null, a$1 = {
692
- tryFSOperation(n$1) {
693
- try {
694
- return n$1();
695
- } catch (o) {
696
- throw o.code ? o.code === "UNKNOWN" ? new t.ErrnoError(pr.EINVAL) : new t.ErrnoError(o.code) : o;
697
- }
698
- },
699
- mount(n$1) {
700
- return a$1.createNode(null, "/", 16895, 0);
701
- },
702
- syncfs(n$1, o, i$1) {},
703
- createNode(n$1, o, i$1, u$1) {
704
- if (!t.isDir(i$1) && !t.isFile(i$1)) throw new t.ErrnoError(28);
705
- let c$1 = t.createNode(n$1, o, i$1);
706
- return c$1.node_ops = a$1.node_ops, c$1.stream_ops = a$1.stream_ops, c$1;
707
- },
708
- getMode: function(n$1) {
709
- return s$1?.("getMode", n$1), a$1.tryFSOperation(() => e.lstat(n$1).mode);
710
- },
711
- realPath: function(n$1) {
712
- let o = [];
713
- for (; n$1.parent !== n$1;) o.push(n$1.name), n$1 = n$1.parent;
714
- return o.push(n$1.mount.opts.root), o.reverse(), o.join("/");
715
- },
716
- node_ops: {
717
- getattr(n$1) {
718
- s$1?.("getattr", a$1.realPath(n$1));
719
- let o = a$1.realPath(n$1);
720
- return a$1.tryFSOperation(() => {
721
- let i$1 = e.lstat(o);
722
- return {
723
- ...i$1,
724
- dev: 0,
725
- ino: n$1.id,
726
- nlink: 1,
727
- rdev: n$1.rdev,
728
- atime: new Date(i$1.atime),
729
- mtime: new Date(i$1.mtime),
730
- ctime: new Date(i$1.ctime)
731
- };
732
- });
733
- },
734
- setattr(n$1, o) {
735
- s$1?.("setattr", a$1.realPath(n$1), o);
736
- let i$1 = a$1.realPath(n$1);
737
- a$1.tryFSOperation(() => {
738
- o.mode !== void 0 && e.chmod(i$1, o.mode), o.size !== void 0 && e.truncate(i$1, o.size), o.timestamp !== void 0 && e.utimes(i$1, o.timestamp, o.timestamp), o.size !== void 0 && e.truncate(i$1, o.size);
739
- });
740
- },
741
- lookup(n$1, o) {
742
- s$1?.("lookup", a$1.realPath(n$1), o);
743
- let i$1 = [a$1.realPath(n$1), o].join("/"), u$1 = a$1.getMode(i$1);
744
- return a$1.createNode(n$1, o, u$1);
745
- },
746
- mknod(n$1, o, i$1, u$1) {
747
- s$1?.("mknod", a$1.realPath(n$1), o, i$1, u$1);
748
- let c$1 = a$1.createNode(n$1, o, i$1, u$1), m = a$1.realPath(c$1);
749
- return a$1.tryFSOperation(() => (t.isDir(c$1.mode) ? e.mkdir(m, { mode: i$1 }) : e.writeFile(m, "", { mode: i$1 }), c$1));
750
- },
751
- rename(n$1, o, i$1) {
752
- s$1?.("rename", a$1.realPath(n$1), a$1.realPath(o), i$1);
753
- let u$1 = a$1.realPath(n$1), c$1 = [a$1.realPath(o), i$1].join("/");
754
- a$1.tryFSOperation(() => {
755
- e.rename(u$1, c$1);
756
- }), n$1.name = i$1;
757
- },
758
- unlink(n$1, o) {
759
- s$1?.("unlink", a$1.realPath(n$1), o);
760
- let i$1 = [a$1.realPath(n$1), o].join("/");
761
- try {
762
- e.unlink(i$1);
763
- } catch {}
764
- },
765
- rmdir(n$1, o) {
766
- s$1?.("rmdir", a$1.realPath(n$1), o);
767
- let i$1 = [a$1.realPath(n$1), o].join("/");
768
- return a$1.tryFSOperation(() => {
769
- e.rmdir(i$1);
770
- });
771
- },
772
- readdir(n$1) {
773
- s$1?.("readdir", a$1.realPath(n$1));
774
- let o = a$1.realPath(n$1);
775
- return a$1.tryFSOperation(() => e.readdir(o));
776
- },
777
- symlink(n$1, o, i$1) {
778
- throw s$1?.("symlink", a$1.realPath(n$1), o, i$1), new t.ErrnoError(63);
779
- },
780
- readlink(n$1) {
781
- throw s$1?.("readlink", a$1.realPath(n$1)), new t.ErrnoError(63);
782
- }
783
- },
784
- stream_ops: {
785
- open(n$1) {
786
- s$1?.("open stream", a$1.realPath(n$1.node));
787
- let o = a$1.realPath(n$1.node);
788
- return a$1.tryFSOperation(() => {
789
- t.isFile(n$1.node.mode) && (n$1.shared.refcount = 1, n$1.nfd = e.open(o));
790
- });
791
- },
792
- close(n$1) {
793
- return s$1?.("close stream", a$1.realPath(n$1.node)), a$1.tryFSOperation(() => {
794
- t.isFile(n$1.node.mode) && n$1.nfd && --n$1.shared.refcount === 0 && e.close(n$1.nfd);
795
- });
796
- },
797
- dup(n$1) {
798
- s$1?.("dup stream", a$1.realPath(n$1.node)), n$1.shared.refcount++;
799
- },
800
- read(n$1, o, i$1, u$1, c$1) {
801
- return s$1?.("read stream", a$1.realPath(n$1.node), i$1, u$1, c$1), u$1 === 0 ? 0 : a$1.tryFSOperation(() => e.read(n$1.nfd, o, i$1, u$1, c$1));
802
- },
803
- write(n$1, o, i$1, u$1, c$1) {
804
- return s$1?.("write stream", a$1.realPath(n$1.node), i$1, u$1, c$1), a$1.tryFSOperation(() => e.write(n$1.nfd, o.buffer, i$1, u$1, c$1));
805
- },
806
- llseek(n$1, o, i$1) {
807
- s$1?.("llseek stream", a$1.realPath(n$1.node), o, i$1);
808
- let u$1 = o;
809
- if (i$1 === 1 ? u$1 += n$1.position : i$1 === 2 && t.isFile(n$1.node.mode) && a$1.tryFSOperation(() => {
810
- let c$1 = e.fstat(n$1.nfd);
811
- u$1 += c$1.size;
812
- }), u$1 < 0) throw new t.ErrnoError(28);
813
- return u$1;
814
- },
815
- mmap(n$1, o, i$1, u$1, c$1) {
816
- if (s$1?.("mmap stream", a$1.realPath(n$1.node), o, i$1, u$1, c$1), !t.isFile(n$1.node.mode)) throw new t.ErrnoError(pr.ENODEV);
817
- let m = r.mmapAlloc(o);
818
- return a$1.stream_ops.read(n$1, r.HEAP8, m, o, i$1), {
819
- ptr: m,
820
- allocated: !0
821
- };
822
- },
823
- msync(n$1, o, i$1, u$1, c$1) {
824
- return s$1?.("msync stream", a$1.realPath(n$1.node), i$1, u$1, c$1), a$1.stream_ops.write(n$1, o, 0, u$1, i$1), 0;
825
- }
826
- }
827
- };
828
- return a$1;
829
- };
830
-
831
- //#endregion
832
- Object.defineProperty(exports, 'C', {
833
- enumerable: true,
834
- get: function () {
835
- return C;
836
- }
837
- });
838
- Object.defineProperty(exports, 'F', {
839
- enumerable: true,
840
- get: function () {
841
- return F;
842
- }
843
- });
844
- Object.defineProperty(exports, 'L', {
845
- enumerable: true,
846
- get: function () {
847
- return L;
848
- }
849
- });
850
- Object.defineProperty(exports, 'P', {
851
- enumerable: true,
852
- get: function () {
853
- return P;
854
- }
855
- });
856
- Object.defineProperty(exports, 'R', {
857
- enumerable: true,
858
- get: function () {
859
- return R;
860
- }
861
- });
862
- Object.defineProperty(exports, 'T', {
863
- enumerable: true,
864
- get: function () {
865
- return T;
866
- }
867
- });
868
- Object.defineProperty(exports, 'U', {
869
- enumerable: true,
870
- get: function () {
871
- return U;
872
- }
873
- });
874
- Object.defineProperty(exports, 'Vr', {
875
- enumerable: true,
876
- get: function () {
877
- return Vr;
878
- }
879
- });
880
- Object.defineProperty(exports, 'ce', {
881
- enumerable: true,
882
- get: function () {
883
- return ce;
884
- }
885
- });
886
- Object.defineProperty(exports, 'cr', {
887
- enumerable: true,
888
- get: function () {
889
- return cr;
890
- }
891
- });
892
- Object.defineProperty(exports, 'h', {
893
- enumerable: true,
894
- get: function () {
895
- return h;
896
- }
897
- });
898
- Object.defineProperty(exports, 'or', {
899
- enumerable: true,
900
- get: function () {
901
- return or;
902
- }
903
- });
904
- Object.defineProperty(exports, 'pr', {
905
- enumerable: true,
906
- get: function () {
907
- return pr;
908
- }
909
- });
910
- Object.defineProperty(exports, 'u', {
911
- enumerable: true,
912
- get: function () {
913
- return u;
914
- }
915
- });
916
- Object.defineProperty(exports, 'ur', {
917
- enumerable: true,
918
- get: function () {
919
- return ur;
920
- }
921
- });
922
- Object.defineProperty(exports, 'x', {
923
- enumerable: true,
924
- get: function () {
925
- return x$1;
926
- }
927
- });