omp-fabric 1.26.13 → 1.26.15

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 (42) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/dist/chunks/{chunk-7KKE52AS.js → chunk-673LUJCK.js} +2 -2
  3. package/dist/chunks/{chunk-JHKOG5GS.js → chunk-BV3EDWSX.js} +50 -3
  4. package/dist/chunks/chunk-BV3EDWSX.js.map +7 -0
  5. package/dist/chunks/{chunk-RFTAEH2R.js → chunk-EZWJ5GBW.js} +93 -3
  6. package/dist/chunks/{chunk-RFTAEH2R.js.map → chunk-EZWJ5GBW.js.map} +2 -2
  7. package/dist/chunks/{chunk-AVSEXLZ7.js → chunk-O5SZML2M.js} +434 -3
  8. package/dist/chunks/chunk-O5SZML2M.js.map +7 -0
  9. package/dist/chunks/{chunk-2T6EHZ5G.js → chunk-S3URDR4K.js} +1 -1
  10. package/dist/fabric-runtime-state.js +124 -18
  11. package/dist/fabric-runtime-state.js.map +2 -2
  12. package/dist/index.js +60 -1
  13. package/dist/index.js.map +3 -3
  14. package/dist/providers/image-provider.d.ts +1 -0
  15. package/dist/providers/image-provider.d.ts.map +1 -1
  16. package/dist/residency/host.js +2 -2
  17. package/dist/residency/omp-entry.js +2 -2
  18. package/dist/runtime/core-override-guest-types.js +1 -1
  19. package/dist/runtime/guest-host-sync.d.ts +5 -0
  20. package/dist/runtime/guest-host-sync.d.ts.map +1 -0
  21. package/dist/runtime/guest-types.d.ts +1 -1
  22. package/dist/runtime/guest-types.d.ts.map +1 -1
  23. package/dist/runtime/guest-types.js +1 -1
  24. package/dist/runtime/guest-web-globals.d.ts +2 -0
  25. package/dist/runtime/guest-web-globals.d.ts.map +1 -0
  26. package/dist/runtime/node-process-child-source.d.ts.map +1 -1
  27. package/dist/runtime/node-process-runtime.js +12 -2
  28. package/dist/runtime/node-process-runtime.js.map +2 -2
  29. package/dist/runtime/quickjs-runtime.d.ts +1 -1
  30. package/dist/runtime/quickjs-runtime.d.ts.map +1 -1
  31. package/dist/runtime/quickjs-runtime.js +2 -2
  32. package/dist/runtime/type-checker.d.ts.map +1 -1
  33. package/dist/runtime/type-checker.js +1 -1
  34. package/dist/type-error-guidance.d.ts.map +1 -1
  35. package/docs/architecture.md +1 -1
  36. package/docs/image.md +24 -3
  37. package/package.json +1 -1
  38. package/skills/fabric-exec/SKILL.md +4 -1
  39. package/dist/chunks/chunk-AVSEXLZ7.js.map +0 -7
  40. package/dist/chunks/chunk-JHKOG5GS.js.map +0 -7
  41. /package/dist/chunks/{chunk-7KKE52AS.js.map → chunk-673LUJCK.js.map} +0 -0
  42. /package/dist/chunks/{chunk-2T6EHZ5G.js.map → chunk-S3URDR4K.js.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  OMP_GUEST_ENTRYPOINT,
3
3
  transpileFabricCodeWithSourceMap
4
- } from "./chunk-JHKOG5GS.js";
4
+ } from "./chunk-BV3EDWSX.js";
5
5
  import {
6
6
  ompBashExitMetadata
7
7
  } from "./chunk-6X6WUU2K.js";
@@ -103,6 +103,404 @@ var remapGuestErrorText = (text, stackMap, guestLineCount) => {
103
103
  });
104
104
  };
105
105
 
106
+ // src/runtime/guest-host-sync.ts
107
+ import * as nodeCrypto from "node:crypto";
108
+ import { runInThisContext } from "node:vm";
109
+ var FABRIC_SYNC_FACTORY_SOURCE = String.raw`((nodeCrypto) => {
110
+ const digestNames = { "SHA-1": "sha1", "SHA-256": "sha256", "SHA-384": "sha384", "SHA-512": "sha512" };
111
+ const urlProperties = ["href", "protocol", "username", "password", "host", "hostname", "port", "pathname", "search", "hash"];
112
+ const failure = (name, message) => Object.assign(new Error(message), { name });
113
+ const canonicalHash = (name) => {
114
+ const canonical = String(name ?? "").toUpperCase();
115
+ if (!Object.prototype.hasOwnProperty.call(digestNames, canonical)) {
116
+ throw failure("NotSupportedError", "Unrecognized digest algorithm: " + name + ". fabric_exec supports SHA-1, SHA-256, SHA-384 and SHA-512.");
117
+ }
118
+ return canonical;
119
+ };
120
+ const bytes = (hex) => Buffer.from(typeof hex === "string" ? hex : "", "hex");
121
+ const hmac = (hash, key, data) =>
122
+ nodeCrypto.createHmac(digestNames[canonicalHash(hash)], bytes(key)).update(bytes(data)).digest();
123
+ const urlParts = (url) => {
124
+ const parts = { origin: url.origin };
125
+ for (const property of urlProperties) parts[property] = url[property];
126
+ return parts;
127
+ };
128
+ const operations = {
129
+ random: ({ length }) => nodeCrypto.randomBytes(Math.min(Math.max(Math.trunc(Number(length)) || 0, 0), 65536)).toString("hex"),
130
+ uuid: () => nodeCrypto.randomUUID(),
131
+ hashName: ({ algorithm }) => canonicalHash(algorithm),
132
+ digest: ({ algorithm, data }) =>
133
+ nodeCrypto.createHash(digestNames[canonicalHash(algorithm)]).update(bytes(data)).digest("hex"),
134
+ hmac: ({ hash, key, data }) => hmac(hash, key, data).toString("hex"),
135
+ hmacVerify: ({ hash, key, data, signature }) => {
136
+ const expected = hmac(hash, key, data);
137
+ const actual = bytes(signature);
138
+ return expected.length === actual.length && nodeCrypto.timingSafeEqual(expected, actual);
139
+ },
140
+ utf8Encode: ({ text }) => Buffer.from(String(text), "utf8").toString("hex"),
141
+ utf8Decode: ({ data, fatal, ignoreBOM }) =>
142
+ new TextDecoder("utf-8", { fatal: fatal === true, ignoreBOM: ignoreBOM === true }).decode(bytes(data)),
143
+ atob: ({ data }) => atob(data),
144
+ btoa: ({ data }) => btoa(data),
145
+ url: ({ input, base }) => urlParts(base === undefined ? new URL(input) : new URL(input, base)),
146
+ urlSet: ({ href, property, value }) => {
147
+ if (urlProperties.indexOf(property) < 0) throw new TypeError("URL has no settable property " + property);
148
+ const url = new URL(href);
149
+ url[property] = value;
150
+ return urlParts(url);
151
+ },
152
+ searchParse: ({ init }) => Array.from(new URLSearchParams(init)),
153
+ searchSerialize: ({ pairs }) => new URLSearchParams(pairs).toString(),
154
+ };
155
+ return (operation, argsJson) => {
156
+ try {
157
+ if (!Object.prototype.hasOwnProperty.call(operations, operation)) {
158
+ throw new TypeError("Unknown fabric sync operation " + operation);
159
+ }
160
+ return JSON.stringify({ ok: true, value: operations[operation](JSON.parse(argsJson)) });
161
+ } catch (error) {
162
+ return JSON.stringify({
163
+ ok: false,
164
+ name: error && typeof error.name === "string" ? error.name : "Error",
165
+ message: error && typeof error.message === "string" ? error.message : String(error),
166
+ });
167
+ }
168
+ };
169
+ })`;
170
+ var fabricSync;
171
+ var fabricSyncCall = (operation, argsJson) => {
172
+ fabricSync ??= runInThisContext(FABRIC_SYNC_FACTORY_SOURCE)(nodeCrypto);
173
+ return fabricSync(operation, argsJson);
174
+ };
175
+
176
+ // src/runtime/guest-web-globals.ts
177
+ var GUEST_WEB_GLOBALS_SOURCE = String.raw`(__fabricSync) => {
178
+ const __namedError = (ErrorType, name, message) => {
179
+ const error = new ErrorType(message);
180
+ if (error.name !== name) error.name = name;
181
+ return error;
182
+ };
183
+ const __syncCall = (operation, args) => {
184
+ const reply = JSON.parse(__fabricSync(operation, JSON.stringify(args)));
185
+ if (reply.ok) return reply.value;
186
+ const ErrorType = reply.name === "TypeError" ? TypeError : reply.name === "RangeError" ? RangeError : Error;
187
+ throw __namedError(ErrorType, reply.name, reply.message);
188
+ };
189
+ const __hexByte = Array.from({ length: 256 }, (_, value) => (value < 16 ? "0" : "") + value.toString(16));
190
+ const __toHex = (bytes) => {
191
+ const chunks = [];
192
+ const parts = [];
193
+ for (let start = 0; start < bytes.length; start += 8192) {
194
+ const end = Math.min(start + 8192, bytes.length);
195
+ parts.length = end - start;
196
+ for (let index = start; index < end; index++) parts[index - start] = __hexByte[bytes[index]];
197
+ chunks.push(parts.join(""));
198
+ }
199
+ return chunks.join("");
200
+ };
201
+ const __fromHex = (hex) => {
202
+ const bytes = new Uint8Array(hex.length / 2);
203
+ for (let index = 0; index < bytes.length; index++) bytes[index] = parseInt(hex.substr(index * 2, 2), 16);
204
+ return bytes;
205
+ };
206
+ const __bufferBytes = (input, label) => {
207
+ if (input instanceof ArrayBuffer) return new Uint8Array(input);
208
+ if (ArrayBuffer.isView(input)) return new Uint8Array(input.buffer, input.byteOffset, input.byteLength);
209
+ throw new TypeError(label + " must be an ArrayBuffer, a typed array or a DataView");
210
+ };
211
+ const __utf8Write = (destination, offset, code) => {
212
+ if (code < 0x80) {
213
+ destination[offset] = code;
214
+ } else if (code < 0x800) {
215
+ destination[offset] = 0xc0 | (code >> 6);
216
+ destination[offset + 1] = 0x80 | (code & 63);
217
+ } else if (code < 0x10000) {
218
+ destination[offset] = 0xe0 | (code >> 12);
219
+ destination[offset + 1] = 0x80 | ((code >> 6) & 63);
220
+ destination[offset + 2] = 0x80 | (code & 63);
221
+ } else {
222
+ destination[offset] = 0xf0 | (code >> 18);
223
+ destination[offset + 1] = 0x80 | ((code >> 12) & 63);
224
+ destination[offset + 2] = 0x80 | ((code >> 6) & 63);
225
+ destination[offset + 3] = 0x80 | (code & 63);
226
+ }
227
+ };
228
+ class TextEncoder {
229
+ get encoding() { return "utf-8"; }
230
+ encode(input = "") {
231
+ return __fromHex(__syncCall("utf8Encode", { text: String(input) }));
232
+ }
233
+ encodeInto(source, destination) {
234
+ let read = 0;
235
+ let written = 0;
236
+ for (const char of String(source)) {
237
+ const point = char.codePointAt(0);
238
+ const code = point >= 0xd800 && point <= 0xdfff ? 0xfffd : point;
239
+ const size = code < 0x80 ? 1 : code < 0x800 ? 2 : code < 0x10000 ? 3 : 4;
240
+ if (written + size > destination.length) break;
241
+ __utf8Write(destination, written, code);
242
+ written += size;
243
+ read += char.length;
244
+ }
245
+ return { read, written };
246
+ }
247
+ }
248
+ const __utf8Labels = ["utf-8", "utf8", "unicode-1-1-utf-8", "unicode11utf8", "unicode20utf8", "x-unicode20utf8"];
249
+ const __decoderOptions = new WeakMap();
250
+ class TextDecoder {
251
+ constructor(label = "utf-8", options = {}) {
252
+ if (__utf8Labels.indexOf(String(label).trim().toLowerCase()) < 0) {
253
+ throw new RangeError("The encoding " + String(label) + " is not supported; fabric_exec TextDecoder decodes UTF-8 only");
254
+ }
255
+ __decoderOptions.set(this, {
256
+ fatal: Boolean(options && options.fatal),
257
+ ignoreBOM: Boolean(options && options.ignoreBOM),
258
+ });
259
+ }
260
+ get encoding() { return "utf-8"; }
261
+ get fatal() { return __decoderOptions.get(this).fatal; }
262
+ get ignoreBOM() { return __decoderOptions.get(this).ignoreBOM; }
263
+ decode(input, options) {
264
+ if (options && options.stream) {
265
+ throw new TypeError("TextDecoder stream mode is not available in fabric_exec; decode the complete buffer");
266
+ }
267
+ if (input === undefined) return "";
268
+ const settings = __decoderOptions.get(this);
269
+ return __syncCall("utf8Decode", {
270
+ data: __toHex(__bufferBytes(input, "TextDecoder.decode input")),
271
+ fatal: settings.fatal,
272
+ ignoreBOM: settings.ignoreBOM,
273
+ });
274
+ }
275
+ }
276
+ const atob = (data) => __syncCall("atob", { data: String(data) });
277
+ const btoa = (data) => __syncCall("btoa", { data: String(data) });
278
+ const __searchState = new WeakMap();
279
+ const __searchList = (params) => __searchState.get(params).list;
280
+ const __searchChanged = (params) => {
281
+ const owner = __searchState.get(params).url;
282
+ if (owner) owner.search = params.toString();
283
+ };
284
+ class URLSearchParams {
285
+ constructor(init = "") {
286
+ let list = [];
287
+ if (init instanceof URLSearchParams) {
288
+ list = __searchList(init).map((pair) => [pair[0], pair[1]]);
289
+ } else if (typeof init === "object" && init !== null) {
290
+ if (typeof init[Symbol.iterator] === "function") {
291
+ for (const pair of init) {
292
+ const items = Array.from(pair);
293
+ if (items.length !== 2) throw new TypeError("Each URLSearchParams init pair must have exactly two items");
294
+ list.push([String(items[0]), String(items[1])]);
295
+ }
296
+ } else {
297
+ for (const key of Object.keys(init)) list.push([key, String(init[key])]);
298
+ }
299
+ } else {
300
+ list = __syncCall("searchParse", { init: String(init) });
301
+ }
302
+ __searchState.set(this, { list, url: undefined });
303
+ }
304
+ get size() { return __searchList(this).length; }
305
+ append(name, value) {
306
+ __searchList(this).push([String(name), String(value)]);
307
+ __searchChanged(this);
308
+ }
309
+ delete(name, value) {
310
+ const key = String(name);
311
+ const state = __searchState.get(this);
312
+ state.list = state.list.filter((pair) => pair[0] !== key || (value !== undefined && pair[1] !== String(value)));
313
+ __searchChanged(this);
314
+ }
315
+ get(name) {
316
+ const key = String(name);
317
+ const pair = __searchList(this).find((entry) => entry[0] === key);
318
+ return pair ? pair[1] : null;
319
+ }
320
+ getAll(name) {
321
+ const key = String(name);
322
+ return __searchList(this).filter((pair) => pair[0] === key).map((pair) => pair[1]);
323
+ }
324
+ has(name, value) {
325
+ const key = String(name);
326
+ return __searchList(this).some((pair) => pair[0] === key && (value === undefined || pair[1] === String(value)));
327
+ }
328
+ set(name, value) {
329
+ const key = String(name);
330
+ const state = __searchState.get(this);
331
+ const index = state.list.findIndex((pair) => pair[0] === key);
332
+ if (index < 0) {
333
+ state.list.push([key, String(value)]);
334
+ } else {
335
+ state.list[index] = [key, String(value)];
336
+ state.list = state.list.filter((pair, position) => position <= index || pair[0] !== key);
337
+ }
338
+ __searchChanged(this);
339
+ }
340
+ sort() {
341
+ __searchList(this).sort((left, right) => (left[0] < right[0] ? -1 : left[0] > right[0] ? 1 : 0));
342
+ __searchChanged(this);
343
+ }
344
+ forEach(callback, thisArg) {
345
+ for (const pair of __searchList(this).slice()) callback.call(thisArg, pair[1], pair[0], this);
346
+ }
347
+ keys() { return __searchList(this).map((pair) => pair[0])[Symbol.iterator](); }
348
+ values() { return __searchList(this).map((pair) => pair[1])[Symbol.iterator](); }
349
+ entries() { return __searchList(this).map((pair) => [pair[0], pair[1]])[Symbol.iterator](); }
350
+ [Symbol.iterator]() { return this.entries(); }
351
+ toString() { return __syncCall("searchSerialize", { pairs: __searchList(this) }); }
352
+ }
353
+ const __urlState = new WeakMap();
354
+ const __urlApply = (url, parts) => {
355
+ const state = __urlState.get(url);
356
+ state.parts = parts;
357
+ if (state.params) __searchState.get(state.params).list = __syncCall("searchParse", { init: parts.search });
358
+ };
359
+ class URL {
360
+ constructor(url, base) {
361
+ const parts = __syncCall(
362
+ "url",
363
+ base === undefined ? { input: String(url) } : { input: String(url), base: String(base) },
364
+ );
365
+ __urlState.set(this, { parts, params: undefined });
366
+ }
367
+ static canParse(url, base) {
368
+ try {
369
+ new URL(url, base);
370
+ return true;
371
+ } catch {
372
+ return false;
373
+ }
374
+ }
375
+ get origin() { return __urlState.get(this).parts.origin; }
376
+ get searchParams() {
377
+ const state = __urlState.get(this);
378
+ if (!state.params) {
379
+ state.params = new URLSearchParams(state.parts.search);
380
+ __searchState.get(state.params).url = this;
381
+ }
382
+ return state.params;
383
+ }
384
+ toString() { return this.href; }
385
+ toJSON() { return this.href; }
386
+ }
387
+ for (const property of ["href", "protocol", "username", "password", "host", "hostname", "port", "pathname", "search", "hash"]) {
388
+ Object.defineProperty(URL.prototype, property, {
389
+ get() { return __urlState.get(this).parts[property]; },
390
+ set(value) {
391
+ __urlApply(this, __syncCall("urlSet", { href: this.href, property, value: String(value) }));
392
+ },
393
+ enumerable: true,
394
+ configurable: true,
395
+ });
396
+ }
397
+ const __cryptoKeys = new WeakMap();
398
+ const __settle = (run) => {
399
+ try {
400
+ return Promise.resolve(run());
401
+ } catch (error) {
402
+ return Promise.reject(error);
403
+ }
404
+ };
405
+ const __algorithmName = (algorithm) =>
406
+ typeof algorithm === "string" ? algorithm : algorithm && typeof algorithm.name === "string" ? algorithm.name : "";
407
+ const __requireHmac = (algorithm) => {
408
+ if (__algorithmName(algorithm).toUpperCase() !== "HMAC") {
409
+ throw __namedError(Error, "NotSupportedError", "fabric_exec crypto.subtle signs with HMAC only, got " + __algorithmName(algorithm));
410
+ }
411
+ };
412
+ const __hmacSecret = (key, usage) => {
413
+ const secret = __cryptoKeys.get(key);
414
+ if (secret === undefined) throw new TypeError("key must be a CryptoKey returned by crypto.subtle.importKey");
415
+ if (key.usages.indexOf(usage) < 0) {
416
+ throw __namedError(Error, "InvalidAccessError", "CryptoKey usages do not include " + usage);
417
+ }
418
+ return secret;
419
+ };
420
+ const __unsupportedSubtle = (name) => () => Promise.reject(__namedError(
421
+ Error,
422
+ "NotSupportedError",
423
+ "crypto.subtle." + name + " is not available in fabric_exec, which provides digest plus HMAC importKey, sign and verify; run other algorithms through omp.bash with openssl",
424
+ ));
425
+ const __subtle = Object.freeze({
426
+ digest: (algorithm, data) => __settle(() =>
427
+ __fromHex(__syncCall("digest", {
428
+ algorithm: __algorithmName(algorithm),
429
+ data: __toHex(__bufferBytes(data, "crypto.subtle.digest data")),
430
+ })).buffer),
431
+ importKey: (format, keyData, algorithm, extractable, keyUsages) => __settle(() => {
432
+ if (format !== "raw") {
433
+ throw __namedError(Error, "NotSupportedError", "fabric_exec crypto.subtle.importKey accepts the raw format only, got " + String(format));
434
+ }
435
+ __requireHmac(algorithm);
436
+ const usages = Array.from(keyUsages ?? []);
437
+ if (usages.length === 0) throw __namedError(Error, "SyntaxError", "HMAC keys need at least one usage");
438
+ for (const usage of usages) {
439
+ if (usage !== "sign" && usage !== "verify") {
440
+ throw __namedError(Error, "SyntaxError", "HMAC key usages must be sign or verify, got " + String(usage));
441
+ }
442
+ }
443
+ const bytes = __bufferBytes(keyData, "crypto.subtle.importKey keyData");
444
+ if (bytes.length === 0) throw __namedError(Error, "DataError", "HMAC key data must not be empty");
445
+ const hash = __syncCall("hashName", { algorithm: __algorithmName(algorithm.hash) });
446
+ const key = Object.freeze({
447
+ type: "secret",
448
+ extractable: Boolean(extractable),
449
+ algorithm: Object.freeze({ name: "HMAC", hash: Object.freeze({ name: hash }), length: bytes.length * 8 }),
450
+ usages: Object.freeze(usages),
451
+ });
452
+ __cryptoKeys.set(key, __toHex(bytes));
453
+ return key;
454
+ }),
455
+ sign: (algorithm, key, data) => __settle(() => {
456
+ __requireHmac(algorithm);
457
+ return __fromHex(__syncCall("hmac", {
458
+ hash: key.algorithm.hash.name,
459
+ key: __hmacSecret(key, "sign"),
460
+ data: __toHex(__bufferBytes(data, "crypto.subtle.sign data")),
461
+ })).buffer;
462
+ }),
463
+ verify: (algorithm, key, signature, data) => __settle(() => {
464
+ __requireHmac(algorithm);
465
+ return __syncCall("hmacVerify", {
466
+ hash: key.algorithm.hash.name,
467
+ key: __hmacSecret(key, "verify"),
468
+ signature: __toHex(__bufferBytes(signature, "crypto.subtle.verify signature")),
469
+ data: __toHex(__bufferBytes(data, "crypto.subtle.verify data")),
470
+ });
471
+ }),
472
+ encrypt: __unsupportedSubtle("encrypt"),
473
+ decrypt: __unsupportedSubtle("decrypt"),
474
+ generateKey: __unsupportedSubtle("generateKey"),
475
+ deriveKey: __unsupportedSubtle("deriveKey"),
476
+ deriveBits: __unsupportedSubtle("deriveBits"),
477
+ exportKey: __unsupportedSubtle("exportKey"),
478
+ wrapKey: __unsupportedSubtle("wrapKey"),
479
+ unwrapKey: __unsupportedSubtle("unwrapKey"),
480
+ });
481
+ const __integerArray = (array) =>
482
+ ArrayBuffer.isView(array)
483
+ && !(array instanceof DataView)
484
+ && !(array instanceof Float32Array)
485
+ && !(array instanceof Float64Array);
486
+ const crypto = Object.freeze({
487
+ subtle: __subtle,
488
+ randomUUID: () => __syncCall("uuid", {}),
489
+ getRandomValues: (array) => {
490
+ if (!__integerArray(array)) {
491
+ throw __namedError(TypeError, "TypeMismatchError", "crypto.getRandomValues needs an integer typed array");
492
+ }
493
+ if (array.byteLength > 65536) {
494
+ throw __namedError(Error, "QuotaExceededError", "crypto.getRandomValues fills at most 65536 bytes per call");
495
+ }
496
+ new Uint8Array(array.buffer, array.byteOffset, array.byteLength)
497
+ .set(__fromHex(__syncCall("random", { length: array.byteLength })));
498
+ return array;
499
+ },
500
+ });
501
+ return { TextEncoder, TextDecoder, atob, btoa, URL, URLSearchParams, crypto };
502
+ }`;
503
+
106
504
  // src/runtime/quickjs-runtime.ts
107
505
  var quickJsModulePromise;
108
506
  var referencedPayloadKeys = (code) => {
@@ -742,7 +1140,10 @@ globalThis.extensions = new Proxy(__extensionBase, {
742
1140
  return target[property];
743
1141
  },
744
1142
  });
745
- globalThis.memory = __providerProxy("memory", { walk: __memoryWalk });
1143
+ globalThis.memory = __providerProxy("memory", {
1144
+ walk: __memoryWalk,
1145
+ recall: (args = {}) => __call("memory.recall", typeof args === "string" ? { query: args } : args),
1146
+ });
746
1147
  globalThis.state = __providerProxy("state");
747
1148
  globalThis.schema = __providerProxy("schema");
748
1149
  globalThis.components = __providerProxy("components");
@@ -1251,6 +1652,23 @@ globalThis.setInterval = (callback, ms = 0) => {
1251
1652
  };
1252
1653
  globalThis.clearTimeout = (id) => { __timerCallbacks.delete(id); };
1253
1654
  globalThis.clearInterval = (id) => { __timerCallbacks.delete(id); };
1655
+ const __fabricSync = globalThis.__fabricSync;
1656
+ delete globalThis.__fabricSync;
1657
+ const __evaluate = eval;
1658
+ let __webGlobalValues;
1659
+ for (const name of ["TextEncoder", "TextDecoder", "atob", "btoa", "URL", "URLSearchParams", "crypto"]) {
1660
+ Object.defineProperty(globalThis, name, {
1661
+ get() {
1662
+ __webGlobalValues ??= __evaluate(__fabricSync("source", ""))(__fabricSync);
1663
+ return __webGlobalValues[name];
1664
+ },
1665
+ set(value) {
1666
+ Object.defineProperty(globalThis, name, { value, writable: true, enumerable: false, configurable: true });
1667
+ },
1668
+ enumerable: false,
1669
+ configurable: true,
1670
+ });
1671
+ }
1254
1672
  })();
1255
1673
  `;
1256
1674
  var formatValue = (value) => {
@@ -1449,6 +1867,17 @@ var QuickJsRuntime = class {
1449
1867
  );
1450
1868
  context.setProp(context.global, "__fabricHostCall", hostFunction);
1451
1869
  hostFunction.dispose();
1870
+ const syncFunction = context.newFunction(
1871
+ "__fabricSync",
1872
+ (operationHandle, argsHandle) => {
1873
+ const operation = context.getString(operationHandle);
1874
+ return context.newString(
1875
+ operation === "source" ? GUEST_WEB_GLOBALS_SOURCE : fabricSyncCall(operation, context.getString(argsHandle))
1876
+ );
1877
+ }
1878
+ );
1879
+ context.setProp(context.global, "__fabricSync", syncFunction);
1880
+ syncFunction.dispose();
1452
1881
  const printFunction = context.newFunction("print", (...handles) => {
1453
1882
  if (logsTruncated) return;
1454
1883
  const line = handles.map((handle) => formatValue(context.dump(handle))).join(" ");
@@ -1611,7 +2040,9 @@ Promise.race([${OMP_GUEST_ENTRYPOINT}(), globalThis.__fabricExecutionGate])`;
1611
2040
  export {
1612
2041
  createGuestStackMap,
1613
2042
  remapGuestErrorText,
2043
+ FABRIC_SYNC_FACTORY_SOURCE,
2044
+ GUEST_WEB_GLOBALS_SOURCE,
1614
2045
  GUEST_SETUP,
1615
2046
  QuickJsRuntime
1616
2047
  };
1617
- //# sourceMappingURL=chunk-AVSEXLZ7.js.map
2048
+ //# sourceMappingURL=chunk-O5SZML2M.js.map