@kya-os/checkpoint-wasm-runtime 1.5.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +215 -0
- package/dist/engine-edge.d.mts +52 -16
- package/dist/engine-edge.d.ts +52 -16
- package/dist/engine-edge.js +11 -4
- package/dist/engine-edge.mjs +11 -4
- package/dist/index.d.mts +118 -1
- package/dist/index.d.ts +118 -1
- package/dist/orchestrator-edge.js +46 -13
- package/dist/orchestrator-edge.mjs +46 -13
- package/dist/orchestrator-node.js +35 -9
- package/dist/orchestrator-node.mjs +35 -9
- package/dist/orchestrator.d.mts +52 -16
- package/dist/orchestrator.d.ts +52 -16
- package/dist/orchestrator.js +46 -13
- package/dist/orchestrator.mjs +46 -13
- package/dist/policy.d.mts +148 -0
- package/dist/policy.d.ts +148 -0
- package/dist/policy.js +52 -0
- package/dist/policy.mjs +53 -0
- package/dist/reporter.d.mts +102 -0
- package/dist/reporter.d.ts +102 -0
- package/dist/reporter.js +125 -0
- package/dist/reporter.mjs +122 -0
- package/package.json +15 -5
- package/wasm/kya-os-engine/kya_os_engine_bg.wasm +0 -0
- package/wasm/kya-os-engine/package.json +4 -2
- package/wasm/kya-os-engine-bundler/kya_os_engine_bg.wasm +0 -0
- package/wasm/kya-os-engine-cedar/README.md +26 -0
- package/wasm/kya-os-engine-cedar/kya_os_engine.d.ts +77 -0
- package/wasm/kya-os-engine-cedar/kya_os_engine.js +636 -0
- package/wasm/kya-os-engine-cedar/kya_os_engine_bg.wasm +0 -0
- package/wasm/kya-os-engine-cedar/kya_os_engine_bg.wasm.d.ts +11 -0
- package/wasm/kya-os-engine-cedar/package.json +29 -0
- package/wasm/kya-os-engine-cedar-web/README.md +26 -0
- package/wasm/kya-os-engine-cedar-web/kya_os_engine.d.ts +117 -0
- package/wasm/kya-os-engine-cedar-web/kya_os_engine.js +694 -0
- package/wasm/kya-os-engine-cedar-web/kya_os_engine_bg.wasm +0 -0
- package/wasm/kya-os-engine-cedar-web/kya_os_engine_bg.wasm.d.ts +11 -0
- package/wasm/kya-os-engine-cedar-web/package.json +31 -0
- package/wasm/kya-os-engine-web/kya_os_engine_bg.wasm +0 -0
- package/wasm/kya-os-engine-web/package.json +5 -3
- package/wasm/agentshield_wasm.d.ts +0 -485
- package/wasm/agentshield_wasm.js +0 -1551
- package/wasm/agentshield_wasm_bg.wasm +0 -0
- package/wasm/agentshield_wasm_bg.wasm.d.ts +0 -97
|
@@ -0,0 +1,636 @@
|
|
|
1
|
+
let imports = {};
|
|
2
|
+
imports['__wbindgen_placeholder__'] = module.exports;
|
|
3
|
+
|
|
4
|
+
let cachedUint8ArrayMemory0 = null;
|
|
5
|
+
|
|
6
|
+
function getUint8ArrayMemory0() {
|
|
7
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
8
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
9
|
+
}
|
|
10
|
+
return cachedUint8ArrayMemory0;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
14
|
+
|
|
15
|
+
cachedTextDecoder.decode();
|
|
16
|
+
|
|
17
|
+
function decodeText(ptr, len) {
|
|
18
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function getStringFromWasm0(ptr, len) {
|
|
22
|
+
ptr = ptr >>> 0;
|
|
23
|
+
return decodeText(ptr, len);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
let heap = new Array(128).fill(undefined);
|
|
27
|
+
|
|
28
|
+
heap.push(undefined, null, true, false);
|
|
29
|
+
|
|
30
|
+
let heap_next = heap.length;
|
|
31
|
+
|
|
32
|
+
function addHeapObject(obj) {
|
|
33
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
34
|
+
const idx = heap_next;
|
|
35
|
+
heap_next = heap[idx];
|
|
36
|
+
|
|
37
|
+
heap[idx] = obj;
|
|
38
|
+
return idx;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function getObject(idx) {
|
|
42
|
+
return heap[idx];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
let WASM_VECTOR_LEN = 0;
|
|
46
|
+
|
|
47
|
+
const cachedTextEncoder = new TextEncoder();
|
|
48
|
+
|
|
49
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
50
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
51
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
52
|
+
view.set(buf);
|
|
53
|
+
return {
|
|
54
|
+
read: arg.length,
|
|
55
|
+
written: buf.length,
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
61
|
+
if (realloc === undefined) {
|
|
62
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
63
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
64
|
+
getUint8ArrayMemory0()
|
|
65
|
+
.subarray(ptr, ptr + buf.length)
|
|
66
|
+
.set(buf);
|
|
67
|
+
WASM_VECTOR_LEN = buf.length;
|
|
68
|
+
return ptr;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
let len = arg.length;
|
|
72
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
73
|
+
|
|
74
|
+
const mem = getUint8ArrayMemory0();
|
|
75
|
+
|
|
76
|
+
let offset = 0;
|
|
77
|
+
|
|
78
|
+
for (; offset < len; offset++) {
|
|
79
|
+
const code = arg.charCodeAt(offset);
|
|
80
|
+
if (code > 0x7f) break;
|
|
81
|
+
mem[ptr + offset] = code;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (offset !== len) {
|
|
85
|
+
if (offset !== 0) {
|
|
86
|
+
arg = arg.slice(offset);
|
|
87
|
+
}
|
|
88
|
+
ptr = realloc(ptr, len, (len = offset + arg.length * 3), 1) >>> 0;
|
|
89
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
90
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
91
|
+
|
|
92
|
+
offset += ret.written;
|
|
93
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
WASM_VECTOR_LEN = offset;
|
|
97
|
+
return ptr;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
let cachedDataViewMemory0 = null;
|
|
101
|
+
|
|
102
|
+
function getDataViewMemory0() {
|
|
103
|
+
if (
|
|
104
|
+
cachedDataViewMemory0 === null ||
|
|
105
|
+
cachedDataViewMemory0.buffer.detached === true ||
|
|
106
|
+
(cachedDataViewMemory0.buffer.detached === undefined &&
|
|
107
|
+
cachedDataViewMemory0.buffer !== wasm.memory.buffer)
|
|
108
|
+
) {
|
|
109
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
110
|
+
}
|
|
111
|
+
return cachedDataViewMemory0;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function isLikeNone(x) {
|
|
115
|
+
return x === undefined || x === null;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function debugString(val) {
|
|
119
|
+
// primitive types
|
|
120
|
+
const type = typeof val;
|
|
121
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
122
|
+
return `${val}`;
|
|
123
|
+
}
|
|
124
|
+
if (type == 'string') {
|
|
125
|
+
return `"${val}"`;
|
|
126
|
+
}
|
|
127
|
+
if (type == 'symbol') {
|
|
128
|
+
const description = val.description;
|
|
129
|
+
if (description == null) {
|
|
130
|
+
return 'Symbol';
|
|
131
|
+
} else {
|
|
132
|
+
return `Symbol(${description})`;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
if (type == 'function') {
|
|
136
|
+
const name = val.name;
|
|
137
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
138
|
+
return `Function(${name})`;
|
|
139
|
+
} else {
|
|
140
|
+
return 'Function';
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
// objects
|
|
144
|
+
if (Array.isArray(val)) {
|
|
145
|
+
const length = val.length;
|
|
146
|
+
let debug = '[';
|
|
147
|
+
if (length > 0) {
|
|
148
|
+
debug += debugString(val[0]);
|
|
149
|
+
}
|
|
150
|
+
for (let i = 1; i < length; i++) {
|
|
151
|
+
debug += ', ' + debugString(val[i]);
|
|
152
|
+
}
|
|
153
|
+
debug += ']';
|
|
154
|
+
return debug;
|
|
155
|
+
}
|
|
156
|
+
// Test for built-in
|
|
157
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
158
|
+
let className;
|
|
159
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
160
|
+
className = builtInMatches[1];
|
|
161
|
+
} else {
|
|
162
|
+
// Failed to match the standard '[object ClassName]'
|
|
163
|
+
return toString.call(val);
|
|
164
|
+
}
|
|
165
|
+
if (className == 'Object') {
|
|
166
|
+
// we're a user defined class or Object
|
|
167
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
168
|
+
// easier than looping through ownProperties of `val`.
|
|
169
|
+
try {
|
|
170
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
171
|
+
} catch (_) {
|
|
172
|
+
return 'Object';
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
// errors
|
|
176
|
+
if (val instanceof Error) {
|
|
177
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
178
|
+
}
|
|
179
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
180
|
+
return className;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
function handleError(f, args) {
|
|
184
|
+
try {
|
|
185
|
+
return f.apply(this, args);
|
|
186
|
+
} catch (e) {
|
|
187
|
+
wasm.__wbindgen_export3(addHeapObject(e));
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
192
|
+
ptr = ptr >>> 0;
|
|
193
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
function dropObject(idx) {
|
|
197
|
+
if (idx < 132) return;
|
|
198
|
+
heap[idx] = heap_next;
|
|
199
|
+
heap_next = idx;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
function takeObject(idx) {
|
|
203
|
+
const ret = getObject(idx);
|
|
204
|
+
dropObject(idx);
|
|
205
|
+
return ret;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Cross-boundary `verify` wrapper. The JS host calls `engine.verify(input,
|
|
209
|
+
* ctxSpec)`; on success it gets a [`VerifyResult`] JSON object; on
|
|
210
|
+
* infrastructure failure (or malformed input) it gets a thrown JS error
|
|
211
|
+
* whose message names the failure mode.
|
|
212
|
+
*
|
|
213
|
+
* **Error semantics**:
|
|
214
|
+
*
|
|
215
|
+
* - Verification *verdicts* (Block/Challenge/etc.) surface inside the
|
|
216
|
+
* returned `VerifyResult` — they are not thrown.
|
|
217
|
+
* - Engine [`VerifyError`][crate::error::VerifyError] (resolver / cache /
|
|
218
|
+
* reputation / policy infra failures) surface as thrown JS errors.
|
|
219
|
+
* - Serde deserialisation failures (malformed JS input) surface as thrown
|
|
220
|
+
* JS errors too, mirroring the typed-vs-thrown split.
|
|
221
|
+
*
|
|
222
|
+
* # JS signature
|
|
223
|
+
*
|
|
224
|
+
* ```ts
|
|
225
|
+
* function verify(input: AgentRequest, ctx: ContextSpec): VerifyResult;
|
|
226
|
+
* ```
|
|
227
|
+
* @param {any} input_js
|
|
228
|
+
* @param {any} ctx_js
|
|
229
|
+
* @returns {any}
|
|
230
|
+
*/
|
|
231
|
+
exports.verify = function (input_js, ctx_js) {
|
|
232
|
+
try {
|
|
233
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
234
|
+
wasm.verify(retptr, addHeapObject(input_js), addHeapObject(ctx_js));
|
|
235
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
236
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
237
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
238
|
+
if (r2) {
|
|
239
|
+
throw takeObject(r1);
|
|
240
|
+
}
|
|
241
|
+
return takeObject(r0);
|
|
242
|
+
} finally {
|
|
243
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
const PolicyEvaluatorFinalization =
|
|
248
|
+
typeof FinalizationRegistry === 'undefined'
|
|
249
|
+
? { register: () => {}, unregister: () => {} }
|
|
250
|
+
: new FinalizationRegistry((ptr) => wasm.__wbg_policyevaluator_free(ptr >>> 0, 1));
|
|
251
|
+
/**
|
|
252
|
+
* Cross-boundary handle to a compiled Cedar policy bundle.
|
|
253
|
+
*
|
|
254
|
+
* Wraps a [`CedarPolicyEvaluator`] so a JS host can compile a tenant
|
|
255
|
+
* policy once and authorize many requests against it. Construction
|
|
256
|
+
* compiles the bundle; each [`authorize`][Self::authorize] call evaluates
|
|
257
|
+
* a single owned request and never re-parses policy text.
|
|
258
|
+
*/
|
|
259
|
+
class PolicyEvaluator {
|
|
260
|
+
__destroy_into_raw() {
|
|
261
|
+
const ptr = this.__wbg_ptr;
|
|
262
|
+
this.__wbg_ptr = 0;
|
|
263
|
+
PolicyEvaluatorFinalization.unregister(this);
|
|
264
|
+
return ptr;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
free() {
|
|
268
|
+
const ptr = this.__destroy_into_raw();
|
|
269
|
+
wasm.__wbg_policyevaluator_free(ptr, 0);
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Compile `policy_text` into a reusable evaluator.
|
|
273
|
+
*
|
|
274
|
+
* The Cedar policy bundle is parsed and compiled exactly once here;
|
|
275
|
+
* the resulting evaluator is held for the lifetime of the handle and
|
|
276
|
+
* reused by every [`authorize`][Self::authorize] call.
|
|
277
|
+
*
|
|
278
|
+
* # Errors
|
|
279
|
+
*
|
|
280
|
+
* Returns a thrown JS error whose message names the failure when
|
|
281
|
+
* `policy_text` is not syntactically valid Cedar
|
|
282
|
+
* ([`PolicyEvaluationError::Malformed`][crate::error::PolicyEvaluationError::Malformed]).
|
|
283
|
+
* A malformed bundle is an infrastructure fault surfaced at
|
|
284
|
+
* construction, never as a per-request deny.
|
|
285
|
+
* @param {string} policy_text
|
|
286
|
+
*/
|
|
287
|
+
constructor(policy_text) {
|
|
288
|
+
try {
|
|
289
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
290
|
+
const ptr0 = passStringToWasm0(policy_text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
291
|
+
const len0 = WASM_VECTOR_LEN;
|
|
292
|
+
wasm.policyevaluator_new(retptr, ptr0, len0);
|
|
293
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
294
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
295
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
296
|
+
if (r2) {
|
|
297
|
+
throw takeObject(r1);
|
|
298
|
+
}
|
|
299
|
+
this.__wbg_ptr = r0 >>> 0;
|
|
300
|
+
PolicyEvaluatorFinalization.register(this, this.__wbg_ptr, this);
|
|
301
|
+
return this;
|
|
302
|
+
} finally {
|
|
303
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Authorize one owned request against the compiled policy bundle.
|
|
308
|
+
*
|
|
309
|
+
* The JS host calls `evaluator.authorize(input)` with an
|
|
310
|
+
* [`AuthorizeInput`]-shaped object (camelCase keys); it gets back a
|
|
311
|
+
* [`Decision`][crate::types::Decision] JSON object. The evaluator owns
|
|
312
|
+
* the fail-closed posture — a request it cannot marshal, or one
|
|
313
|
+
* matching no `permit`, comes back as a
|
|
314
|
+
* [`Decision::Block`][crate::types::Decision::Block], not a thrown
|
|
315
|
+
* error.
|
|
316
|
+
*
|
|
317
|
+
* # Errors
|
|
318
|
+
*
|
|
319
|
+
* Returns a thrown JS error only for boundary faults: a malformed
|
|
320
|
+
* `input_js` that fails [`AuthorizeInput`] deserialisation, or a
|
|
321
|
+
* failure serialising the resulting `Decision`. Authorization
|
|
322
|
+
* *verdicts* never throw — they surface inside the returned value.
|
|
323
|
+
*
|
|
324
|
+
* # JS signature
|
|
325
|
+
*
|
|
326
|
+
* ```ts
|
|
327
|
+
* authorize(input: AuthorizeInput): Decision;
|
|
328
|
+
* ```
|
|
329
|
+
* @param {any} input_js
|
|
330
|
+
* @returns {any}
|
|
331
|
+
*/
|
|
332
|
+
authorize(input_js) {
|
|
333
|
+
try {
|
|
334
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
335
|
+
wasm.policyevaluator_authorize(retptr, this.__wbg_ptr, addHeapObject(input_js));
|
|
336
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
337
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
338
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
339
|
+
if (r2) {
|
|
340
|
+
throw takeObject(r1);
|
|
341
|
+
}
|
|
342
|
+
return takeObject(r0);
|
|
343
|
+
} finally {
|
|
344
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
if (Symbol.dispose) PolicyEvaluator.prototype[Symbol.dispose] = PolicyEvaluator.prototype.free;
|
|
349
|
+
|
|
350
|
+
exports.PolicyEvaluator = PolicyEvaluator;
|
|
351
|
+
|
|
352
|
+
exports.__wbg_Error_e83987f665cf5504 = function (arg0, arg1) {
|
|
353
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
354
|
+
return addHeapObject(ret);
|
|
355
|
+
};
|
|
356
|
+
|
|
357
|
+
exports.__wbg_Number_bb48ca12f395cd08 = function (arg0) {
|
|
358
|
+
const ret = Number(getObject(arg0));
|
|
359
|
+
return ret;
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
exports.__wbg_String_8f0eb39a4a4c2f66 = function (arg0, arg1) {
|
|
363
|
+
const ret = String(getObject(arg1));
|
|
364
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
365
|
+
const len1 = WASM_VECTOR_LEN;
|
|
366
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
367
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
368
|
+
};
|
|
369
|
+
|
|
370
|
+
exports.__wbg___wbindgen_bigint_get_as_i64_f3ebc5a755000afd = function (arg0, arg1) {
|
|
371
|
+
const v = getObject(arg1);
|
|
372
|
+
const ret = typeof v === 'bigint' ? v : undefined;
|
|
373
|
+
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
374
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
375
|
+
};
|
|
376
|
+
|
|
377
|
+
exports.__wbg___wbindgen_boolean_get_6d5a1ee65bab5f68 = function (arg0) {
|
|
378
|
+
const v = getObject(arg0);
|
|
379
|
+
const ret = typeof v === 'boolean' ? v : undefined;
|
|
380
|
+
return isLikeNone(ret) ? 0xffffff : ret ? 1 : 0;
|
|
381
|
+
};
|
|
382
|
+
|
|
383
|
+
exports.__wbg___wbindgen_debug_string_df47ffb5e35e6763 = function (arg0, arg1) {
|
|
384
|
+
const ret = debugString(getObject(arg1));
|
|
385
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
386
|
+
const len1 = WASM_VECTOR_LEN;
|
|
387
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
388
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
389
|
+
};
|
|
390
|
+
|
|
391
|
+
exports.__wbg___wbindgen_in_bb933bd9e1b3bc0f = function (arg0, arg1) {
|
|
392
|
+
const ret = getObject(arg0) in getObject(arg1);
|
|
393
|
+
return ret;
|
|
394
|
+
};
|
|
395
|
+
|
|
396
|
+
exports.__wbg___wbindgen_is_bigint_cb320707dcd35f0b = function (arg0) {
|
|
397
|
+
const ret = typeof getObject(arg0) === 'bigint';
|
|
398
|
+
return ret;
|
|
399
|
+
};
|
|
400
|
+
|
|
401
|
+
exports.__wbg___wbindgen_is_function_ee8a6c5833c90377 = function (arg0) {
|
|
402
|
+
const ret = typeof getObject(arg0) === 'function';
|
|
403
|
+
return ret;
|
|
404
|
+
};
|
|
405
|
+
|
|
406
|
+
exports.__wbg___wbindgen_is_object_c818261d21f283a4 = function (arg0) {
|
|
407
|
+
const val = getObject(arg0);
|
|
408
|
+
const ret = typeof val === 'object' && val !== null;
|
|
409
|
+
return ret;
|
|
410
|
+
};
|
|
411
|
+
|
|
412
|
+
exports.__wbg___wbindgen_is_string_fbb76cb2940daafd = function (arg0) {
|
|
413
|
+
const ret = typeof getObject(arg0) === 'string';
|
|
414
|
+
return ret;
|
|
415
|
+
};
|
|
416
|
+
|
|
417
|
+
exports.__wbg___wbindgen_is_undefined_2d472862bd29a478 = function (arg0) {
|
|
418
|
+
const ret = getObject(arg0) === undefined;
|
|
419
|
+
return ret;
|
|
420
|
+
};
|
|
421
|
+
|
|
422
|
+
exports.__wbg___wbindgen_jsval_eq_6b13ab83478b1c50 = function (arg0, arg1) {
|
|
423
|
+
const ret = getObject(arg0) === getObject(arg1);
|
|
424
|
+
return ret;
|
|
425
|
+
};
|
|
426
|
+
|
|
427
|
+
exports.__wbg___wbindgen_jsval_loose_eq_b664b38a2f582147 = function (arg0, arg1) {
|
|
428
|
+
const ret = getObject(arg0) == getObject(arg1);
|
|
429
|
+
return ret;
|
|
430
|
+
};
|
|
431
|
+
|
|
432
|
+
exports.__wbg___wbindgen_number_get_a20bf9b85341449d = function (arg0, arg1) {
|
|
433
|
+
const obj = getObject(arg1);
|
|
434
|
+
const ret = typeof obj === 'number' ? obj : undefined;
|
|
435
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
436
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
437
|
+
};
|
|
438
|
+
|
|
439
|
+
exports.__wbg___wbindgen_string_get_e4f06c90489ad01b = function (arg0, arg1) {
|
|
440
|
+
const obj = getObject(arg1);
|
|
441
|
+
const ret = typeof obj === 'string' ? obj : undefined;
|
|
442
|
+
var ptr1 = isLikeNone(ret)
|
|
443
|
+
? 0
|
|
444
|
+
: passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
445
|
+
var len1 = WASM_VECTOR_LEN;
|
|
446
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
447
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
448
|
+
};
|
|
449
|
+
|
|
450
|
+
exports.__wbg___wbindgen_throw_b855445ff6a94295 = function (arg0, arg1) {
|
|
451
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
452
|
+
};
|
|
453
|
+
|
|
454
|
+
exports.__wbg_call_e762c39fa8ea36bf = function () {
|
|
455
|
+
return handleError(function (arg0, arg1) {
|
|
456
|
+
const ret = getObject(arg0).call(getObject(arg1));
|
|
457
|
+
return addHeapObject(ret);
|
|
458
|
+
}, arguments);
|
|
459
|
+
};
|
|
460
|
+
|
|
461
|
+
exports.__wbg_done_2042aa2670fb1db1 = function (arg0) {
|
|
462
|
+
const ret = getObject(arg0).done;
|
|
463
|
+
return ret;
|
|
464
|
+
};
|
|
465
|
+
|
|
466
|
+
exports.__wbg_entries_e171b586f8f6bdbf = function (arg0) {
|
|
467
|
+
const ret = Object.entries(getObject(arg0));
|
|
468
|
+
return addHeapObject(ret);
|
|
469
|
+
};
|
|
470
|
+
|
|
471
|
+
exports.__wbg_get_7bed016f185add81 = function (arg0, arg1) {
|
|
472
|
+
const ret = getObject(arg0)[arg1 >>> 0];
|
|
473
|
+
return addHeapObject(ret);
|
|
474
|
+
};
|
|
475
|
+
|
|
476
|
+
exports.__wbg_get_efcb449f58ec27c2 = function () {
|
|
477
|
+
return handleError(function (arg0, arg1) {
|
|
478
|
+
const ret = Reflect.get(getObject(arg0), getObject(arg1));
|
|
479
|
+
return addHeapObject(ret);
|
|
480
|
+
}, arguments);
|
|
481
|
+
};
|
|
482
|
+
|
|
483
|
+
exports.__wbg_get_with_ref_key_1dc361bd10053bfe = function (arg0, arg1) {
|
|
484
|
+
const ret = getObject(arg0)[getObject(arg1)];
|
|
485
|
+
return addHeapObject(ret);
|
|
486
|
+
};
|
|
487
|
+
|
|
488
|
+
exports.__wbg_instanceof_ArrayBuffer_70beb1189ca63b38 = function (arg0) {
|
|
489
|
+
let result;
|
|
490
|
+
try {
|
|
491
|
+
result = getObject(arg0) instanceof ArrayBuffer;
|
|
492
|
+
} catch (_) {
|
|
493
|
+
result = false;
|
|
494
|
+
}
|
|
495
|
+
const ret = result;
|
|
496
|
+
return ret;
|
|
497
|
+
};
|
|
498
|
+
|
|
499
|
+
exports.__wbg_instanceof_Map_8579b5e2ab5437c7 = function (arg0) {
|
|
500
|
+
let result;
|
|
501
|
+
try {
|
|
502
|
+
result = getObject(arg0) instanceof Map;
|
|
503
|
+
} catch (_) {
|
|
504
|
+
result = false;
|
|
505
|
+
}
|
|
506
|
+
const ret = result;
|
|
507
|
+
return ret;
|
|
508
|
+
};
|
|
509
|
+
|
|
510
|
+
exports.__wbg_instanceof_Uint8Array_20c8e73002f7af98 = function (arg0) {
|
|
511
|
+
let result;
|
|
512
|
+
try {
|
|
513
|
+
result = getObject(arg0) instanceof Uint8Array;
|
|
514
|
+
} catch (_) {
|
|
515
|
+
result = false;
|
|
516
|
+
}
|
|
517
|
+
const ret = result;
|
|
518
|
+
return ret;
|
|
519
|
+
};
|
|
520
|
+
|
|
521
|
+
exports.__wbg_isArray_96e0af9891d0945d = function (arg0) {
|
|
522
|
+
const ret = Array.isArray(getObject(arg0));
|
|
523
|
+
return ret;
|
|
524
|
+
};
|
|
525
|
+
|
|
526
|
+
exports.__wbg_isSafeInteger_d216eda7911dde36 = function (arg0) {
|
|
527
|
+
const ret = Number.isSafeInteger(getObject(arg0));
|
|
528
|
+
return ret;
|
|
529
|
+
};
|
|
530
|
+
|
|
531
|
+
exports.__wbg_iterator_e5822695327a3c39 = function () {
|
|
532
|
+
const ret = Symbol.iterator;
|
|
533
|
+
return addHeapObject(ret);
|
|
534
|
+
};
|
|
535
|
+
|
|
536
|
+
exports.__wbg_length_69bca3cb64fc8748 = function (arg0) {
|
|
537
|
+
const ret = getObject(arg0).length;
|
|
538
|
+
return ret;
|
|
539
|
+
};
|
|
540
|
+
|
|
541
|
+
exports.__wbg_length_cdd215e10d9dd507 = function (arg0) {
|
|
542
|
+
const ret = getObject(arg0).length;
|
|
543
|
+
return ret;
|
|
544
|
+
};
|
|
545
|
+
|
|
546
|
+
exports.__wbg_new_1acc0b6eea89d040 = function () {
|
|
547
|
+
const ret = new Object();
|
|
548
|
+
return addHeapObject(ret);
|
|
549
|
+
};
|
|
550
|
+
|
|
551
|
+
exports.__wbg_new_5a79be3ab53b8aa5 = function (arg0) {
|
|
552
|
+
const ret = new Uint8Array(getObject(arg0));
|
|
553
|
+
return addHeapObject(ret);
|
|
554
|
+
};
|
|
555
|
+
|
|
556
|
+
exports.__wbg_new_68651c719dcda04e = function () {
|
|
557
|
+
const ret = new Map();
|
|
558
|
+
return addHeapObject(ret);
|
|
559
|
+
};
|
|
560
|
+
|
|
561
|
+
exports.__wbg_new_e17d9f43105b08be = function () {
|
|
562
|
+
const ret = new Array();
|
|
563
|
+
return addHeapObject(ret);
|
|
564
|
+
};
|
|
565
|
+
|
|
566
|
+
exports.__wbg_next_020810e0ae8ebcb0 = function () {
|
|
567
|
+
return handleError(function (arg0) {
|
|
568
|
+
const ret = getObject(arg0).next();
|
|
569
|
+
return addHeapObject(ret);
|
|
570
|
+
}, arguments);
|
|
571
|
+
};
|
|
572
|
+
|
|
573
|
+
exports.__wbg_next_2c826fe5dfec6b6a = function (arg0) {
|
|
574
|
+
const ret = getObject(arg0).next;
|
|
575
|
+
return addHeapObject(ret);
|
|
576
|
+
};
|
|
577
|
+
|
|
578
|
+
exports.__wbg_prototypesetcall_2a6620b6922694b2 = function (arg0, arg1, arg2) {
|
|
579
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
|
|
580
|
+
};
|
|
581
|
+
|
|
582
|
+
exports.__wbg_set_3f1d0b984ed272ed = function (arg0, arg1, arg2) {
|
|
583
|
+
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
|
584
|
+
};
|
|
585
|
+
|
|
586
|
+
exports.__wbg_set_907fb406c34a251d = function (arg0, arg1, arg2) {
|
|
587
|
+
const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
|
|
588
|
+
return addHeapObject(ret);
|
|
589
|
+
};
|
|
590
|
+
|
|
591
|
+
exports.__wbg_set_c213c871859d6500 = function (arg0, arg1, arg2) {
|
|
592
|
+
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
|
593
|
+
};
|
|
594
|
+
|
|
595
|
+
exports.__wbg_value_692627309814bb8c = function (arg0) {
|
|
596
|
+
const ret = getObject(arg0).value;
|
|
597
|
+
return addHeapObject(ret);
|
|
598
|
+
};
|
|
599
|
+
|
|
600
|
+
exports.__wbindgen_cast_2241b6af4c4b2941 = function (arg0, arg1) {
|
|
601
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
602
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
603
|
+
return addHeapObject(ret);
|
|
604
|
+
};
|
|
605
|
+
|
|
606
|
+
exports.__wbindgen_cast_4625c577ab2ec9ee = function (arg0) {
|
|
607
|
+
// Cast intrinsic for `U64 -> Externref`.
|
|
608
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
609
|
+
return addHeapObject(ret);
|
|
610
|
+
};
|
|
611
|
+
|
|
612
|
+
exports.__wbindgen_cast_9ae0607507abb057 = function (arg0) {
|
|
613
|
+
// Cast intrinsic for `I64 -> Externref`.
|
|
614
|
+
const ret = arg0;
|
|
615
|
+
return addHeapObject(ret);
|
|
616
|
+
};
|
|
617
|
+
|
|
618
|
+
exports.__wbindgen_cast_d6cd19b81560fd6e = function (arg0) {
|
|
619
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
620
|
+
const ret = arg0;
|
|
621
|
+
return addHeapObject(ret);
|
|
622
|
+
};
|
|
623
|
+
|
|
624
|
+
exports.__wbindgen_object_clone_ref = function (arg0) {
|
|
625
|
+
const ret = getObject(arg0);
|
|
626
|
+
return addHeapObject(ret);
|
|
627
|
+
};
|
|
628
|
+
|
|
629
|
+
exports.__wbindgen_object_drop_ref = function (arg0) {
|
|
630
|
+
takeObject(arg0);
|
|
631
|
+
};
|
|
632
|
+
|
|
633
|
+
const wasmPath = `${__dirname}/kya_os_engine_bg.wasm`;
|
|
634
|
+
const wasmBytes = require('fs').readFileSync(wasmPath);
|
|
635
|
+
const wasmModule = new WebAssembly.Module(wasmBytes);
|
|
636
|
+
const wasm = (exports.__wasm = new WebAssembly.Instance(wasmModule, imports).exports);
|
|
Binary file
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const __wbg_policyevaluator_free: (a: number, b: number) => void;
|
|
5
|
+
export const policyevaluator_authorize: (a: number, b: number, c: number) => void;
|
|
6
|
+
export const policyevaluator_new: (a: number, b: number, c: number) => void;
|
|
7
|
+
export const verify: (a: number, b: number, c: number) => void;
|
|
8
|
+
export const __wbindgen_export: (a: number, b: number) => number;
|
|
9
|
+
export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
10
|
+
export const __wbindgen_export3: (a: number) => void;
|
|
11
|
+
export const __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "kya-os-engine",
|
|
3
|
+
"collaborators": [
|
|
4
|
+
"KnowThat.ai Team"
|
|
5
|
+
],
|
|
6
|
+
"description": "Verification engine for the KYA-OS ecosystem. The single source of truth for detection, identity, scope, revocation, policy, and reputation across every host runtime. See ADR-001.",
|
|
7
|
+
"version": "0.1.0",
|
|
8
|
+
"license": "MIT OR Apache-2.0",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/knowthat-ai/agentshield"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"kya_os_engine_bg.wasm",
|
|
15
|
+
"kya_os_engine.js",
|
|
16
|
+
"kya_os_engine.d.ts"
|
|
17
|
+
],
|
|
18
|
+
"main": "kya_os_engine.js",
|
|
19
|
+
"types": "kya_os_engine.d.ts",
|
|
20
|
+
"keywords": [
|
|
21
|
+
"kya-os",
|
|
22
|
+
"verification",
|
|
23
|
+
"mcp-i",
|
|
24
|
+
"agent",
|
|
25
|
+
"did"
|
|
26
|
+
],
|
|
27
|
+
"type": "commonjs",
|
|
28
|
+
"_note": "wasm-bindgen --target nodejs output: uses module.exports + require('fs') at module load. The parent wasm/package.json says type:module (for the older agentshield_wasm.js ESM file), which would make Node mis-classify this CJS file and throw ERR_REQUIRE_ESM. This nested package.json overrides per Node's nearest-package.json resolution algorithm. See SDK-WASM-Bundler-Loader-1 (#2613) for the original incident; AIVF-1 Path B (#2639) re-instated this override after a wasm-pack regen silently dropped it, plus a regen-pipeline patcher (rust/scripts/build-engine-wasm.sh) + an integrity test (packages/checkpoint-wasm-runtime/src/__tests__/wasm-artifact-integrity.test.ts) so the next regen can't silently break Node consumers again. Engine-Pattern-Codegen-Retirement-1 extended the patcher to also restore the types/`files` .d.ts references that --no-typescript drops. This is the cedar-feature variant built by rust/scripts/build-engine-cedar-wasm.sh; same guards apply."
|
|
29
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# kya-os-engine
|
|
2
|
+
|
|
3
|
+
Verification engine for the KYA-OS ecosystem. Every TS / .NET / Go / Python /
|
|
4
|
+
Cloudflare-Workers host wrapper is a thin shim around the WASM or WASI build of
|
|
5
|
+
this crate. ADR-001 (Engine-Centric Consolidation) is the architectural
|
|
6
|
+
decision; the locked public API contract is tracked in D-design
|
|
7
|
+
([issue #2484][issue]) and mirrored at
|
|
8
|
+
[`docs/architecture/D-design-ratification.md`][ratification].
|
|
9
|
+
|
|
10
|
+
`kya-os-engine` is the root of the dependency graph. It depends on
|
|
11
|
+
nothing from `@kya-os/*`, `agentshield-*`, or `checkpoint-*`; the
|
|
12
|
+
direction is the other way.
|
|
13
|
+
|
|
14
|
+
The public surface is one function (`verify`), one decision vocabulary (`Decision`
|
|
15
|
+
with five variants — `Permit`, `Block`, `Challenge`, `Redirect`, `Instruct`),
|
|
16
|
+
five dependency-injection traits (`DidResolver`, `StatusListCache`,
|
|
17
|
+
`ReputationOracle`, `PolicyEvaluator`, `Clock`), and one canonical-signing-payload
|
|
18
|
+
helper (`canonical_signing_payload`, RFC 8785 / JCS).
|
|
19
|
+
|
|
20
|
+
This is the **Layer 1 API lock** (D-design, [issue #2484][issue]). The body of
|
|
21
|
+
`verify()` is `todo!()`; trait methods are stubbed. D-impl
|
|
22
|
+
([issue #2485][impl]) satisfies the contract.
|
|
23
|
+
|
|
24
|
+
[issue]: https://github.com/Know-That-Ai/agent-shield/issues/2484
|
|
25
|
+
[impl]: https://github.com/Know-That-Ai/agent-shield/issues/2485
|
|
26
|
+
[ratification]: ../../../docs/architecture/D-design-ratification.md
|