@kya-os/checkpoint-wasm-runtime 1.0.0 → 1.1.1

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 (47) hide show
  1. package/CHANGELOG.md +166 -0
  2. package/dist/adapters.js +0 -2
  3. package/dist/adapters.mjs +0 -2
  4. package/dist/edge.js +0 -2
  5. package/dist/edge.mjs +0 -2
  6. package/dist/engine-edge.js +0 -2
  7. package/dist/engine-edge.mjs +0 -2
  8. package/dist/engine.js +447 -4
  9. package/dist/engine.mjs +447 -4
  10. package/dist/index.js +0 -2
  11. package/dist/index.mjs +0 -2
  12. package/dist/kya_os_engine_bg.wasm +0 -0
  13. package/dist/node.js +0 -2
  14. package/dist/node.mjs +0 -2
  15. package/dist/orchestrator-edge.d.mts +5 -199
  16. package/dist/orchestrator-edge.d.ts +5 -199
  17. package/dist/orchestrator-edge.js +0 -2
  18. package/dist/orchestrator-edge.mjs +0 -2
  19. package/dist/orchestrator-node.d.mts +49 -0
  20. package/dist/orchestrator-node.d.ts +49 -0
  21. package/dist/orchestrator-node.js +992 -0
  22. package/dist/orchestrator-node.mjs +983 -0
  23. package/dist/orchestrator.d.mts +4 -47
  24. package/dist/orchestrator.d.ts +4 -47
  25. package/dist/orchestrator.js +448 -8
  26. package/dist/orchestrator.mjs +448 -8
  27. package/dist/render-decision-C1a-iuiW.d.mts +200 -0
  28. package/dist/render-decision-Dsjwt96g.d.ts +200 -0
  29. package/package.json +14 -2
  30. package/wasm/kya-os-engine/package.json +7 -0
  31. package/wasm/kya-os-engine-web/package.json +7 -0
  32. package/dist/adapters.js.map +0 -1
  33. package/dist/adapters.mjs.map +0 -1
  34. package/dist/edge.js.map +0 -1
  35. package/dist/edge.mjs.map +0 -1
  36. package/dist/engine-edge.js.map +0 -1
  37. package/dist/engine-edge.mjs.map +0 -1
  38. package/dist/engine.js.map +0 -1
  39. package/dist/engine.mjs.map +0 -1
  40. package/dist/index.js.map +0 -1
  41. package/dist/index.mjs.map +0 -1
  42. package/dist/node.js.map +0 -1
  43. package/dist/node.mjs.map +0 -1
  44. package/dist/orchestrator-edge.js.map +0 -1
  45. package/dist/orchestrator-edge.mjs.map +0 -1
  46. package/dist/orchestrator.js.map +0 -1
  47. package/dist/orchestrator.mjs.map +0 -1
@@ -1,19 +1,460 @@
1
+ var __create = Object.create;
1
2
  var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
2
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
8
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
9
+ }) : x)(function(x) {
10
+ if (typeof require !== "undefined") return require.apply(this, arguments);
11
+ throw Error('Dynamic require of "' + x + '" is not supported');
12
+ });
3
13
  var __esm = (fn, res) => function __init() {
4
14
  return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
5
15
  };
16
+ var __commonJS = (cb, mod) => function __require2() {
17
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
18
+ };
6
19
  var __export = (target, all) => {
7
20
  for (var name in all)
8
21
  __defProp(target, name, { get: all[name], enumerable: true });
9
22
  };
23
+ var __copyProps = (to, from, except, desc) => {
24
+ if (from && typeof from === "object" || typeof from === "function") {
25
+ for (let key of __getOwnPropNames(from))
26
+ if (!__hasOwnProp.call(to, key) && key !== except)
27
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
28
+ }
29
+ return to;
30
+ };
31
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
32
+ // If the importer is in node compatibility mode or this is not an ESM
33
+ // file that has been converted to a CommonJS file using a Babel-
34
+ // compatible transform (i.e. "__esModule" has not been set), then set
35
+ // "default" to the CommonJS "module.exports" for node compatibility.
36
+ !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
37
+ mod
38
+ ));
39
+
40
+ // wasm/kya-os-engine/kya_os_engine.js
41
+ var require_kya_os_engine = __commonJS({
42
+ "wasm/kya-os-engine/kya_os_engine.js"(exports$1, module) {
43
+ var imports = {};
44
+ imports["__wbindgen_placeholder__"] = module.exports;
45
+ var cachedUint8ArrayMemory02 = null;
46
+ function getUint8ArrayMemory02() {
47
+ if (cachedUint8ArrayMemory02 === null || cachedUint8ArrayMemory02.byteLength === 0) {
48
+ cachedUint8ArrayMemory02 = new Uint8Array(wasm2.memory.buffer);
49
+ }
50
+ return cachedUint8ArrayMemory02;
51
+ }
52
+ var cachedTextDecoder2 = new TextDecoder("utf-8", { ignoreBOM: true, fatal: true });
53
+ cachedTextDecoder2.decode();
54
+ function decodeText2(ptr, len) {
55
+ return cachedTextDecoder2.decode(getUint8ArrayMemory02().subarray(ptr, ptr + len));
56
+ }
57
+ function getStringFromWasm02(ptr, len) {
58
+ ptr = ptr >>> 0;
59
+ return decodeText2(ptr, len);
60
+ }
61
+ var heap2 = new Array(128).fill(void 0);
62
+ heap2.push(void 0, null, true, false);
63
+ var heap_next2 = heap2.length;
64
+ function addHeapObject2(obj) {
65
+ if (heap_next2 === heap2.length) heap2.push(heap2.length + 1);
66
+ const idx = heap_next2;
67
+ heap_next2 = heap2[idx];
68
+ heap2[idx] = obj;
69
+ return idx;
70
+ }
71
+ function getObject2(idx) {
72
+ return heap2[idx];
73
+ }
74
+ var WASM_VECTOR_LEN2 = 0;
75
+ var cachedTextEncoder2 = new TextEncoder();
76
+ if (!("encodeInto" in cachedTextEncoder2)) {
77
+ cachedTextEncoder2.encodeInto = function(arg, view) {
78
+ const buf = cachedTextEncoder2.encode(arg);
79
+ view.set(buf);
80
+ return {
81
+ read: arg.length,
82
+ written: buf.length
83
+ };
84
+ };
85
+ }
86
+ function passStringToWasm02(arg, malloc, realloc) {
87
+ if (realloc === void 0) {
88
+ const buf = cachedTextEncoder2.encode(arg);
89
+ const ptr2 = malloc(buf.length, 1) >>> 0;
90
+ getUint8ArrayMemory02().subarray(ptr2, ptr2 + buf.length).set(buf);
91
+ WASM_VECTOR_LEN2 = buf.length;
92
+ return ptr2;
93
+ }
94
+ let len = arg.length;
95
+ let ptr = malloc(len, 1) >>> 0;
96
+ const mem = getUint8ArrayMemory02();
97
+ let offset = 0;
98
+ for (; offset < len; offset++) {
99
+ const code = arg.charCodeAt(offset);
100
+ if (code > 127) break;
101
+ mem[ptr + offset] = code;
102
+ }
103
+ if (offset !== len) {
104
+ if (offset !== 0) {
105
+ arg = arg.slice(offset);
106
+ }
107
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
108
+ const view = getUint8ArrayMemory02().subarray(ptr + offset, ptr + len);
109
+ const ret = cachedTextEncoder2.encodeInto(arg, view);
110
+ offset += ret.written;
111
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
112
+ }
113
+ WASM_VECTOR_LEN2 = offset;
114
+ return ptr;
115
+ }
116
+ var cachedDataViewMemory02 = null;
117
+ function getDataViewMemory02() {
118
+ if (cachedDataViewMemory02 === null || cachedDataViewMemory02.buffer.detached === true || cachedDataViewMemory02.buffer.detached === void 0 && cachedDataViewMemory02.buffer !== wasm2.memory.buffer) {
119
+ cachedDataViewMemory02 = new DataView(wasm2.memory.buffer);
120
+ }
121
+ return cachedDataViewMemory02;
122
+ }
123
+ function isLikeNone2(x) {
124
+ return x === void 0 || x === null;
125
+ }
126
+ function debugString2(val) {
127
+ const type = typeof val;
128
+ if (type == "number" || type == "boolean" || val == null) {
129
+ return `${val}`;
130
+ }
131
+ if (type == "string") {
132
+ return `"${val}"`;
133
+ }
134
+ if (type == "symbol") {
135
+ const description = val.description;
136
+ if (description == null) {
137
+ return "Symbol";
138
+ } else {
139
+ return `Symbol(${description})`;
140
+ }
141
+ }
142
+ if (type == "function") {
143
+ const name = val.name;
144
+ if (typeof name == "string" && name.length > 0) {
145
+ return `Function(${name})`;
146
+ } else {
147
+ return "Function";
148
+ }
149
+ }
150
+ if (Array.isArray(val)) {
151
+ const length = val.length;
152
+ let debug = "[";
153
+ if (length > 0) {
154
+ debug += debugString2(val[0]);
155
+ }
156
+ for (let i = 1; i < length; i++) {
157
+ debug += ", " + debugString2(val[i]);
158
+ }
159
+ debug += "]";
160
+ return debug;
161
+ }
162
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
163
+ let className;
164
+ if (builtInMatches && builtInMatches.length > 1) {
165
+ className = builtInMatches[1];
166
+ } else {
167
+ return toString.call(val);
168
+ }
169
+ if (className == "Object") {
170
+ try {
171
+ return "Object(" + JSON.stringify(val) + ")";
172
+ } catch (_) {
173
+ return "Object";
174
+ }
175
+ }
176
+ if (val instanceof Error) {
177
+ return `${val.name}: ${val.message}
178
+ ${val.stack}`;
179
+ }
180
+ return className;
181
+ }
182
+ function handleError2(f, args) {
183
+ try {
184
+ return f.apply(this, args);
185
+ } catch (e) {
186
+ wasm2.__wbindgen_export3(addHeapObject2(e));
187
+ }
188
+ }
189
+ function getArrayU8FromWasm02(ptr, len) {
190
+ ptr = ptr >>> 0;
191
+ return getUint8ArrayMemory02().subarray(ptr / 1, ptr / 1 + len);
192
+ }
193
+ function dropObject2(idx) {
194
+ if (idx < 132) return;
195
+ heap2[idx] = heap_next2;
196
+ heap_next2 = idx;
197
+ }
198
+ function takeObject2(idx) {
199
+ const ret = getObject2(idx);
200
+ dropObject2(idx);
201
+ return ret;
202
+ }
203
+ exports$1.verify = function(input_js, ctx_js) {
204
+ try {
205
+ const retptr = wasm2.__wbindgen_add_to_stack_pointer(-16);
206
+ wasm2.verify(retptr, addHeapObject2(input_js), addHeapObject2(ctx_js));
207
+ var r0 = getDataViewMemory02().getInt32(retptr + 4 * 0, true);
208
+ var r1 = getDataViewMemory02().getInt32(retptr + 4 * 1, true);
209
+ var r2 = getDataViewMemory02().getInt32(retptr + 4 * 2, true);
210
+ if (r2) {
211
+ throw takeObject2(r1);
212
+ }
213
+ return takeObject2(r0);
214
+ } finally {
215
+ wasm2.__wbindgen_add_to_stack_pointer(16);
216
+ }
217
+ };
218
+ exports$1.__wbg_Error_e83987f665cf5504 = function(arg0, arg1) {
219
+ const ret = Error(getStringFromWasm02(arg0, arg1));
220
+ return addHeapObject2(ret);
221
+ };
222
+ exports$1.__wbg_Number_bb48ca12f395cd08 = function(arg0) {
223
+ const ret = Number(getObject2(arg0));
224
+ return ret;
225
+ };
226
+ exports$1.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
227
+ const ret = String(getObject2(arg1));
228
+ const ptr1 = passStringToWasm02(ret, wasm2.__wbindgen_export, wasm2.__wbindgen_export2);
229
+ const len1 = WASM_VECTOR_LEN2;
230
+ getDataViewMemory02().setInt32(arg0 + 4 * 1, len1, true);
231
+ getDataViewMemory02().setInt32(arg0 + 4 * 0, ptr1, true);
232
+ };
233
+ exports$1.__wbg___wbindgen_bigint_get_as_i64_f3ebc5a755000afd = function(arg0, arg1) {
234
+ const v = getObject2(arg1);
235
+ const ret = typeof v === "bigint" ? v : void 0;
236
+ getDataViewMemory02().setBigInt64(arg0 + 8 * 1, isLikeNone2(ret) ? BigInt(0) : ret, true);
237
+ getDataViewMemory02().setInt32(arg0 + 4 * 0, !isLikeNone2(ret), true);
238
+ };
239
+ exports$1.__wbg___wbindgen_boolean_get_6d5a1ee65bab5f68 = function(arg0) {
240
+ const v = getObject2(arg0);
241
+ const ret = typeof v === "boolean" ? v : void 0;
242
+ return isLikeNone2(ret) ? 16777215 : ret ? 1 : 0;
243
+ };
244
+ exports$1.__wbg___wbindgen_debug_string_df47ffb5e35e6763 = function(arg0, arg1) {
245
+ const ret = debugString2(getObject2(arg1));
246
+ const ptr1 = passStringToWasm02(ret, wasm2.__wbindgen_export, wasm2.__wbindgen_export2);
247
+ const len1 = WASM_VECTOR_LEN2;
248
+ getDataViewMemory02().setInt32(arg0 + 4 * 1, len1, true);
249
+ getDataViewMemory02().setInt32(arg0 + 4 * 0, ptr1, true);
250
+ };
251
+ exports$1.__wbg___wbindgen_in_bb933bd9e1b3bc0f = function(arg0, arg1) {
252
+ const ret = getObject2(arg0) in getObject2(arg1);
253
+ return ret;
254
+ };
255
+ exports$1.__wbg___wbindgen_is_bigint_cb320707dcd35f0b = function(arg0) {
256
+ const ret = typeof getObject2(arg0) === "bigint";
257
+ return ret;
258
+ };
259
+ exports$1.__wbg___wbindgen_is_function_ee8a6c5833c90377 = function(arg0) {
260
+ const ret = typeof getObject2(arg0) === "function";
261
+ return ret;
262
+ };
263
+ exports$1.__wbg___wbindgen_is_object_c818261d21f283a4 = function(arg0) {
264
+ const val = getObject2(arg0);
265
+ const ret = typeof val === "object" && val !== null;
266
+ return ret;
267
+ };
268
+ exports$1.__wbg___wbindgen_is_string_fbb76cb2940daafd = function(arg0) {
269
+ const ret = typeof getObject2(arg0) === "string";
270
+ return ret;
271
+ };
272
+ exports$1.__wbg___wbindgen_is_undefined_2d472862bd29a478 = function(arg0) {
273
+ const ret = getObject2(arg0) === void 0;
274
+ return ret;
275
+ };
276
+ exports$1.__wbg___wbindgen_jsval_eq_6b13ab83478b1c50 = function(arg0, arg1) {
277
+ const ret = getObject2(arg0) === getObject2(arg1);
278
+ return ret;
279
+ };
280
+ exports$1.__wbg___wbindgen_jsval_loose_eq_b664b38a2f582147 = function(arg0, arg1) {
281
+ const ret = getObject2(arg0) == getObject2(arg1);
282
+ return ret;
283
+ };
284
+ exports$1.__wbg___wbindgen_number_get_a20bf9b85341449d = function(arg0, arg1) {
285
+ const obj = getObject2(arg1);
286
+ const ret = typeof obj === "number" ? obj : void 0;
287
+ getDataViewMemory02().setFloat64(arg0 + 8 * 1, isLikeNone2(ret) ? 0 : ret, true);
288
+ getDataViewMemory02().setInt32(arg0 + 4 * 0, !isLikeNone2(ret), true);
289
+ };
290
+ exports$1.__wbg___wbindgen_string_get_e4f06c90489ad01b = function(arg0, arg1) {
291
+ const obj = getObject2(arg1);
292
+ const ret = typeof obj === "string" ? obj : void 0;
293
+ var ptr1 = isLikeNone2(ret) ? 0 : passStringToWasm02(ret, wasm2.__wbindgen_export, wasm2.__wbindgen_export2);
294
+ var len1 = WASM_VECTOR_LEN2;
295
+ getDataViewMemory02().setInt32(arg0 + 4 * 1, len1, true);
296
+ getDataViewMemory02().setInt32(arg0 + 4 * 0, ptr1, true);
297
+ };
298
+ exports$1.__wbg___wbindgen_throw_b855445ff6a94295 = function(arg0, arg1) {
299
+ throw new Error(getStringFromWasm02(arg0, arg1));
300
+ };
301
+ exports$1.__wbg_call_e762c39fa8ea36bf = function() {
302
+ return handleError2(function(arg0, arg1) {
303
+ const ret = getObject2(arg0).call(getObject2(arg1));
304
+ return addHeapObject2(ret);
305
+ }, arguments);
306
+ };
307
+ exports$1.__wbg_done_2042aa2670fb1db1 = function(arg0) {
308
+ const ret = getObject2(arg0).done;
309
+ return ret;
310
+ };
311
+ exports$1.__wbg_entries_e171b586f8f6bdbf = function(arg0) {
312
+ const ret = Object.entries(getObject2(arg0));
313
+ return addHeapObject2(ret);
314
+ };
315
+ exports$1.__wbg_get_7bed016f185add81 = function(arg0, arg1) {
316
+ const ret = getObject2(arg0)[arg1 >>> 0];
317
+ return addHeapObject2(ret);
318
+ };
319
+ exports$1.__wbg_get_efcb449f58ec27c2 = function() {
320
+ return handleError2(function(arg0, arg1) {
321
+ const ret = Reflect.get(getObject2(arg0), getObject2(arg1));
322
+ return addHeapObject2(ret);
323
+ }, arguments);
324
+ };
325
+ exports$1.__wbg_get_with_ref_key_1dc361bd10053bfe = function(arg0, arg1) {
326
+ const ret = getObject2(arg0)[getObject2(arg1)];
327
+ return addHeapObject2(ret);
328
+ };
329
+ exports$1.__wbg_instanceof_ArrayBuffer_70beb1189ca63b38 = function(arg0) {
330
+ let result;
331
+ try {
332
+ result = getObject2(arg0) instanceof ArrayBuffer;
333
+ } catch (_) {
334
+ result = false;
335
+ }
336
+ const ret = result;
337
+ return ret;
338
+ };
339
+ exports$1.__wbg_instanceof_Map_8579b5e2ab5437c7 = function(arg0) {
340
+ let result;
341
+ try {
342
+ result = getObject2(arg0) instanceof Map;
343
+ } catch (_) {
344
+ result = false;
345
+ }
346
+ const ret = result;
347
+ return ret;
348
+ };
349
+ exports$1.__wbg_instanceof_Uint8Array_20c8e73002f7af98 = function(arg0) {
350
+ let result;
351
+ try {
352
+ result = getObject2(arg0) instanceof Uint8Array;
353
+ } catch (_) {
354
+ result = false;
355
+ }
356
+ const ret = result;
357
+ return ret;
358
+ };
359
+ exports$1.__wbg_isArray_96e0af9891d0945d = function(arg0) {
360
+ const ret = Array.isArray(getObject2(arg0));
361
+ return ret;
362
+ };
363
+ exports$1.__wbg_isSafeInteger_d216eda7911dde36 = function(arg0) {
364
+ const ret = Number.isSafeInteger(getObject2(arg0));
365
+ return ret;
366
+ };
367
+ exports$1.__wbg_iterator_e5822695327a3c39 = function() {
368
+ const ret = Symbol.iterator;
369
+ return addHeapObject2(ret);
370
+ };
371
+ exports$1.__wbg_length_69bca3cb64fc8748 = function(arg0) {
372
+ const ret = getObject2(arg0).length;
373
+ return ret;
374
+ };
375
+ exports$1.__wbg_length_cdd215e10d9dd507 = function(arg0) {
376
+ const ret = getObject2(arg0).length;
377
+ return ret;
378
+ };
379
+ exports$1.__wbg_new_1acc0b6eea89d040 = function() {
380
+ const ret = new Object();
381
+ return addHeapObject2(ret);
382
+ };
383
+ exports$1.__wbg_new_5a79be3ab53b8aa5 = function(arg0) {
384
+ const ret = new Uint8Array(getObject2(arg0));
385
+ return addHeapObject2(ret);
386
+ };
387
+ exports$1.__wbg_new_68651c719dcda04e = function() {
388
+ const ret = /* @__PURE__ */ new Map();
389
+ return addHeapObject2(ret);
390
+ };
391
+ exports$1.__wbg_new_e17d9f43105b08be = function() {
392
+ const ret = new Array();
393
+ return addHeapObject2(ret);
394
+ };
395
+ exports$1.__wbg_next_020810e0ae8ebcb0 = function() {
396
+ return handleError2(function(arg0) {
397
+ const ret = getObject2(arg0).next();
398
+ return addHeapObject2(ret);
399
+ }, arguments);
400
+ };
401
+ exports$1.__wbg_next_2c826fe5dfec6b6a = function(arg0) {
402
+ const ret = getObject2(arg0).next;
403
+ return addHeapObject2(ret);
404
+ };
405
+ exports$1.__wbg_prototypesetcall_2a6620b6922694b2 = function(arg0, arg1, arg2) {
406
+ Uint8Array.prototype.set.call(getArrayU8FromWasm02(arg0, arg1), getObject2(arg2));
407
+ };
408
+ exports$1.__wbg_set_3f1d0b984ed272ed = function(arg0, arg1, arg2) {
409
+ getObject2(arg0)[takeObject2(arg1)] = takeObject2(arg2);
410
+ };
411
+ exports$1.__wbg_set_907fb406c34a251d = function(arg0, arg1, arg2) {
412
+ const ret = getObject2(arg0).set(getObject2(arg1), getObject2(arg2));
413
+ return addHeapObject2(ret);
414
+ };
415
+ exports$1.__wbg_set_c213c871859d6500 = function(arg0, arg1, arg2) {
416
+ getObject2(arg0)[arg1 >>> 0] = takeObject2(arg2);
417
+ };
418
+ exports$1.__wbg_value_692627309814bb8c = function(arg0) {
419
+ const ret = getObject2(arg0).value;
420
+ return addHeapObject2(ret);
421
+ };
422
+ exports$1.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
423
+ const ret = getStringFromWasm02(arg0, arg1);
424
+ return addHeapObject2(ret);
425
+ };
426
+ exports$1.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
427
+ const ret = BigInt.asUintN(64, arg0);
428
+ return addHeapObject2(ret);
429
+ };
430
+ exports$1.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
431
+ const ret = arg0;
432
+ return addHeapObject2(ret);
433
+ };
434
+ exports$1.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
435
+ const ret = arg0;
436
+ return addHeapObject2(ret);
437
+ };
438
+ exports$1.__wbindgen_object_clone_ref = function(arg0) {
439
+ const ret = getObject2(arg0);
440
+ return addHeapObject2(ret);
441
+ };
442
+ exports$1.__wbindgen_object_drop_ref = function(arg0) {
443
+ takeObject2(arg0);
444
+ };
445
+ var wasmPath = `${__dirname}/kya_os_engine_bg.wasm`;
446
+ var wasmBytes = __require("fs").readFileSync(wasmPath);
447
+ var wasmModule2 = new WebAssembly.Module(wasmBytes);
448
+ var wasm2 = exports$1.__wasm = new WebAssembly.Instance(wasmModule2, imports).exports;
449
+ }
450
+ });
10
451
 
11
452
  // wasm/kya-os-engine-web/kya_os_engine.js
12
453
  var kya_os_engine_exports = {};
13
454
  __export(kya_os_engine_exports, {
14
455
  default: () => kya_os_engine_default,
15
456
  initSync: () => initSync,
16
- verify: () => verify
457
+ verify: () => verify2
17
458
  });
18
459
  function getUint8ArrayMemory0() {
19
460
  if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
@@ -160,7 +601,7 @@ function takeObject(idx) {
160
601
  dropObject(idx);
161
602
  return ret;
162
603
  }
163
- function verify(input_js, ctx_js) {
604
+ function verify2(input_js, ctx_js) {
164
605
  try {
165
606
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
166
607
  wasm.verify(retptr, addHeapObject(input_js), addHeapObject(ctx_js));
@@ -579,9 +1020,10 @@ function isBlockedIpv6(hostname) {
579
1020
  }
580
1021
 
581
1022
  // src/engine/index.ts
1023
+ var wasmModule = __toESM(require_kya_os_engine());
582
1024
  function engineVerify(input, ctx) {
583
- const result = (void 0)(input, ctx);
584
- return result;
1025
+ const verify3 = wasmModule.verify;
1026
+ return verify3(input, ctx);
585
1027
  }
586
1028
 
587
1029
  // src/engine/adapters/util.ts
@@ -899,8 +1341,8 @@ function ensureReady(moduleOrPath) {
899
1341
  return initialised;
900
1342
  }
901
1343
  async function engineVerifyEdge(input, ctx) {
902
- const verify2 = await ensureReady();
903
- return verify2(input, ctx);
1344
+ const verify3 = await ensureReady();
1345
+ return verify3(input, ctx);
904
1346
  }
905
1347
 
906
1348
  // src/engine/orchestrator/render-decision.ts
@@ -1168,5 +1610,3 @@ function defaultLogger2(msg) {
1168
1610
  }
1169
1611
 
1170
1612
  export { buildAgentRequest, extractAgentDid, extractCredentialStatusUrl, extractIssuer, hasMalformedJwsBody, initEngineEdge, makeVerifyRequest, makeVerifyRequestEdge, renderDecisionAsResponse, verifyRequest, verifyRequestEdge };
1171
- //# sourceMappingURL=orchestrator.mjs.map
1172
- //# sourceMappingURL=orchestrator.mjs.map
@@ -0,0 +1,200 @@
1
+ import { E as EnforcementMode, A as AgentRequest, V as VerifyResult } from './types-D0j85fF0.mjs';
2
+ import { DidResolverAdapter, StatusListCacheAdapter, ReputationOracleAdapter, PolicyEvaluatorAdapter, ClockAdapter } from './adapters.mjs';
3
+
4
+ /**
5
+ * Orchestrator-layer types — Phase C, host-side only.
6
+ *
7
+ * Nothing here crosses the WASM boundary. The engine ABI types live
8
+ * in `../types.ts`; the adapter interfaces live in
9
+ * `../adapters/index.ts`. This file is the host-wrapper-facing
10
+ * surface — what Phase D (Next.js) and Phase E (Express) import.
11
+ */
12
+
13
+ /**
14
+ * Framework-agnostic HTTP request shape.
15
+ *
16
+ * Next.js / Express / Cloudflare Workers / Hono adapters marshal
17
+ * their native request type into this shape before calling
18
+ * `verifyRequest`. The shape is intentionally minimal — only what
19
+ * the engine needs to make a verdict.
20
+ */
21
+ interface IncomingHttpLike {
22
+ method: string;
23
+ /** Path + query string (no scheme + host). */
24
+ url: string;
25
+ headers: Record<string, string | string[] | undefined>;
26
+ /**
27
+ * Parsed body if the framework has already parsed it (Next.js
28
+ * with `await req.json()`, Express with `body-parser`). Falsy if
29
+ * the caller hasn't materialised the body — the orchestrator
30
+ * treats that as "no MCP-I envelope present" and routes to
31
+ * PlainHttp.
32
+ */
33
+ body?: Buffer | string | object | null;
34
+ /** Client IP if the framework surfaces one (Express `req.ip`). */
35
+ remoteAddress?: string;
36
+ }
37
+ /**
38
+ * Options the host wrapper passes per-`verifyRequest`-construction.
39
+ * The five adapters + clock + tenant identifier + enforcement mode.
40
+ */
41
+ interface VerifyRequestOpts {
42
+ didResolver: DidResolverAdapter;
43
+ statusListCache: StatusListCacheAdapter;
44
+ reputationOracle: ReputationOracleAdapter;
45
+ policyEvaluator: PolicyEvaluatorAdapter;
46
+ clock: ClockAdapter;
47
+ /** Tenant identifier — the host customer this request targets. */
48
+ tenantHost: string;
49
+ enforcementMode: EnforcementMode;
50
+ /** Returned to the PolicyEvaluator when the request has no agent DID. Default 1.0. */
51
+ reputationBaseline?: number;
52
+ /**
53
+ * **Envelope-1 (#2537) coordination flag.** Pre-Envelope-1 the TS
54
+ * bouncer ships MCP-I proofs as `{protected,payload,signature}` JSON
55
+ * in a `KYA-Delegation` header. Post-Envelope-1 they ship compact
56
+ * JWS in `_meta.proof.jws` of the body. When this flag is true the
57
+ * orchestrator also accepts the legacy header form. **Default off.**
58
+ * Delete this flag once Envelope-1 ships end-to-end.
59
+ */
60
+ legacyEnvelopeFallback?: boolean;
61
+ /**
62
+ * Argus URL — passed only so the orchestrator can detect "Argus
63
+ * not configured" at construction time and log the one-shot
64
+ * warning. The actual reputation fetch goes through `reputationOracle`.
65
+ */
66
+ argusUrl?: string;
67
+ /** Injectable for the once-only Argus configuration warning. */
68
+ logger?: (msg: string) => void;
69
+ }
70
+ /**
71
+ * Transport-agnostic response shape `renderDecisionAsResponse`
72
+ * produces. Host wrappers adapt this to their framework's response
73
+ * type (NextResponse / Express `res` / Cloudflare Response).
74
+ *
75
+ * `status === null` means "pass through" — the request continues to
76
+ * the next handler. Happens in two cases:
77
+ * 1. `Decision::Permit` (no block in Enforce mode).
78
+ * 2. **Any verdict in Observe mode** — Observe never blocks, but
79
+ * the response headers still carry the would-have-been verdict.
80
+ */
81
+ interface RenderedResponse {
82
+ status: number | null;
83
+ headers: Record<string, string>;
84
+ body?: string | object;
85
+ }
86
+
87
+ /**
88
+ * HTTP-to-`AgentRequest` translator — Phase C.1.
89
+ *
90
+ * Detects which engine protocol the request belongs to and builds
91
+ * the typed `AgentRequest` the WASM consumes. Conservative
92
+ * detection: never escalates an ambiguous request into a higher
93
+ * verification tier. Anonymous PlainHttp is the default.
94
+ *
95
+ * **What this layer parses and what it doesn't.** It parses *only
96
+ * what's needed to drive conditional pre-fetch* — header presence,
97
+ * the MCP-I envelope's payload segment (to extract `iss` + `sub` +
98
+ * optional credentialStatus URL). It does **not** verify
99
+ * signatures, decode VC chains for revocation bits, or evaluate
100
+ * scope. Those live in the engine (H-1's parser + Stages 2-5).
101
+ *
102
+ * **Buffer-portability note.** This module uses `Buffer.from(...)` and
103
+ * `Buffer.isBuffer(...)` at multiple call sites (the JWS preflight
104
+ * `hasMalformedJwsBody`, both `tryBuildMcpIFromBody` variants, the
105
+ * legacy-header reconstitution path, and `bodyAsBytes`). All of these
106
+ * assume the Node `Buffer` global is available — provided natively by
107
+ * the Node runtime, polyfilled on Vercel Edge, and gated behind
108
+ * `nodejs_compat` on Cloudflare Workers. Bare-Edge and pure-browser
109
+ * embedders would need a `Buffer` polyfill or a refactor to
110
+ * `TextEncoder` / `Uint8Array.from`. Tracked as a follow-up since
111
+ * Phase D's Vercel Node + Vercel Edge targets are both covered today.
112
+ */
113
+
114
+ interface BuildAgentRequestOpts {
115
+ /** See `VerifyRequestOpts.legacyEnvelopeFallback`. */
116
+ legacyEnvelopeFallback?: boolean;
117
+ }
118
+ /**
119
+ * Translate an HTTP-like request into the engine's `AgentRequest`.
120
+ *
121
+ * Detection order (conservative — never escalate ambiguous input):
122
+ * 1. MCP-I L2 detached proof in `_meta.proof.jws` (spec form).
123
+ * 2. (Legacy, opt-in) MCP-I in `KYA-Delegation` header
124
+ * (Envelope-1 #2537 transition window only).
125
+ * 3. RFC 9421 HTTP Message Signatures (`Signature-Input` header).
126
+ * 4. PlainHttp (default — anonymous traffic).
127
+ */
128
+ declare function buildAgentRequest(req: IncomingHttpLike, opts?: BuildAgentRequestOpts): AgentRequest;
129
+ /**
130
+ * Preflight check — does the request body carry a `_meta.proof.jws`
131
+ * string that `parseJwsPayloadStruct` cannot project into a typed
132
+ * `McpIPayload`?
133
+ *
134
+ * The caller declared intent (an MCP-I envelope) by including the
135
+ * JWS field; structural failure to extract the payload means the
136
+ * envelope is malformed, not absent. Without this preflight, the
137
+ * orchestrator would silently fall through to PlainHttp — pre-#2560
138
+ * that happened to also Block (engine returned `Block(ParseError)`
139
+ * for every PlainHttp), so the regression was invisible; post-#2560
140
+ * the engine's Stage 1 + stub policy returns `Permit` for anonymous
141
+ * PlainHttp and tampered envelopes would be silently accepted.
142
+ *
143
+ * Returns `true` when the orchestrator should synthesize
144
+ * `Block(ParseError)` BEFORE calling `buildAgentRequest`.
145
+ */
146
+ declare function hasMalformedJwsBody(req: IncomingHttpLike): boolean;
147
+ /**
148
+ * Issuer DID — Stage 1 (identity resolution) targets this. `null`
149
+ * for PlainHttp (anonymous → no DID to resolve).
150
+ */
151
+ declare function extractIssuer(request: AgentRequest): string | null;
152
+ /**
153
+ * Agent DID — used by ReputationOracle. Defaults to `payload.sub`
154
+ * for MCP-I (subject = the agent the proof is *about*).
155
+ */
156
+ declare function extractAgentDid(request: AgentRequest): string | null;
157
+ /**
158
+ * Status-list URL for revocation pre-fetch. Pulled from the JWS
159
+ * payload's `vc.credentialStatus.id` (W3C VC Data Model 1.1).
160
+ * `null` when the envelope is L1 (no VC chain) — Stage 3 will skip.
161
+ */
162
+ declare function extractCredentialStatusUrl(request: AgentRequest): string | null;
163
+
164
+ /**
165
+ * Transport-agnostic `Decision` → HTTP renderer — Phase C.3.
166
+ *
167
+ * Translates a `VerifyResult` into a framework-neutral
168
+ * `{ status, headers, body }` shape. Phase D (Next.js) adapts this
169
+ * to `NextResponse`; Phase E (Express) adapts it to `res.status().set().send()`.
170
+ * One source of truth for the verdict→HTTP mapping.
171
+ *
172
+ * Mapping table (§ 4.5 of Phase C kickoff):
173
+ *
174
+ * | Decision | HTTP | Notes |
175
+ * |-----------------------------------|------|-----------------------------------------|
176
+ * | Permit | null | Pass through to next handler |
177
+ * | Block(Unauthenticated) | 401 | WWW-Authenticate header |
178
+ * | Block(InvalidSignature) | 403 | |
179
+ * | Block(Revoked) | 403 | |
180
+ * | Block(Expired) | 401 | Refresh-the-credential semantics |
181
+ * | Block(OutOfScope) | 403 | Body carries requested + granted |
182
+ * | Block(LowReputation) | 403 | Body carries score + threshold |
183
+ * | Block(PolicyDenied) | 403 | Body carries detail |
184
+ * | Block(ParseError) | 400 | Body carries detail |
185
+ * | Challenge | 401 | Body carries ChallengeParams |
186
+ * | Redirect | 302 | Location header |
187
+ * | Instruct | 422 | application/problem+json body |
188
+ *
189
+ * Observe mode overrides: every verdict renders as `status: null`
190
+ * (pass through) with an `X-Checkpoint-Would-Have-Been` header
191
+ * carrying the verdict kind, plus the standard attribution headers.
192
+ *
193
+ * Every response carries the Phase 0.1 attribution headers:
194
+ * `X-Checkpoint-Engine`, `X-Checkpoint-Engine-Version`, and
195
+ * (when present) `X-Checkpoint-Ruleset-Hash`.
196
+ */
197
+
198
+ declare function renderDecisionAsResponse(result: VerifyResult): RenderedResponse;
199
+
200
+ export { type BuildAgentRequestOpts as B, type IncomingHttpLike as I, type RenderedResponse as R, type VerifyRequestOpts as V, extractCredentialStatusUrl as a, buildAgentRequest as b, extractIssuer as c, extractAgentDid as e, hasMalformedJwsBody as h, renderDecisionAsResponse as r };