@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.
Files changed (45) hide show
  1. package/CHANGELOG.md +215 -0
  2. package/dist/engine-edge.d.mts +52 -16
  3. package/dist/engine-edge.d.ts +52 -16
  4. package/dist/engine-edge.js +11 -4
  5. package/dist/engine-edge.mjs +11 -4
  6. package/dist/index.d.mts +118 -1
  7. package/dist/index.d.ts +118 -1
  8. package/dist/orchestrator-edge.js +46 -13
  9. package/dist/orchestrator-edge.mjs +46 -13
  10. package/dist/orchestrator-node.js +35 -9
  11. package/dist/orchestrator-node.mjs +35 -9
  12. package/dist/orchestrator.d.mts +52 -16
  13. package/dist/orchestrator.d.ts +52 -16
  14. package/dist/orchestrator.js +46 -13
  15. package/dist/orchestrator.mjs +46 -13
  16. package/dist/policy.d.mts +148 -0
  17. package/dist/policy.d.ts +148 -0
  18. package/dist/policy.js +52 -0
  19. package/dist/policy.mjs +53 -0
  20. package/dist/reporter.d.mts +102 -0
  21. package/dist/reporter.d.ts +102 -0
  22. package/dist/reporter.js +125 -0
  23. package/dist/reporter.mjs +122 -0
  24. package/package.json +15 -5
  25. package/wasm/kya-os-engine/kya_os_engine_bg.wasm +0 -0
  26. package/wasm/kya-os-engine/package.json +4 -2
  27. package/wasm/kya-os-engine-bundler/kya_os_engine_bg.wasm +0 -0
  28. package/wasm/kya-os-engine-cedar/README.md +26 -0
  29. package/wasm/kya-os-engine-cedar/kya_os_engine.d.ts +77 -0
  30. package/wasm/kya-os-engine-cedar/kya_os_engine.js +636 -0
  31. package/wasm/kya-os-engine-cedar/kya_os_engine_bg.wasm +0 -0
  32. package/wasm/kya-os-engine-cedar/kya_os_engine_bg.wasm.d.ts +11 -0
  33. package/wasm/kya-os-engine-cedar/package.json +29 -0
  34. package/wasm/kya-os-engine-cedar-web/README.md +26 -0
  35. package/wasm/kya-os-engine-cedar-web/kya_os_engine.d.ts +117 -0
  36. package/wasm/kya-os-engine-cedar-web/kya_os_engine.js +694 -0
  37. package/wasm/kya-os-engine-cedar-web/kya_os_engine_bg.wasm +0 -0
  38. package/wasm/kya-os-engine-cedar-web/kya_os_engine_bg.wasm.d.ts +11 -0
  39. package/wasm/kya-os-engine-cedar-web/package.json +31 -0
  40. package/wasm/kya-os-engine-web/kya_os_engine_bg.wasm +0 -0
  41. package/wasm/kya-os-engine-web/package.json +5 -3
  42. package/wasm/agentshield_wasm.d.ts +0 -485
  43. package/wasm/agentshield_wasm.js +0 -1551
  44. package/wasm/agentshield_wasm_bg.wasm +0 -0
  45. package/wasm/agentshield_wasm_bg.wasm.d.ts +0 -97
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "kya-os-engine",
3
+ "type": "module",
4
+ "collaborators": [
5
+ "KnowThat.ai Team"
6
+ ],
7
+ "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.",
8
+ "version": "0.1.0",
9
+ "license": "MIT OR Apache-2.0",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/knowthat-ai/agentshield"
13
+ },
14
+ "files": [
15
+ "kya_os_engine_bg.wasm",
16
+ "kya_os_engine.js",
17
+ "kya_os_engine.d.ts"
18
+ ],
19
+ "main": "kya_os_engine.js",
20
+ "types": "kya_os_engine.d.ts",
21
+ "sideEffects": [
22
+ "./snippets/*"
23
+ ],
24
+ "keywords": [
25
+ "kya-os",
26
+ "verification",
27
+ "mcp-i",
28
+ "agent",
29
+ "did"
30
+ ]
31
+ }
@@ -13,7 +13,8 @@
13
13
  },
14
14
  "files": [
15
15
  "kya_os_engine_bg.wasm",
16
- "kya_os_engine.js"
16
+ "kya_os_engine.js",
17
+ "kya_os_engine.d.ts"
17
18
  ],
18
19
  "main": "kya_os_engine.js",
19
20
  "sideEffects": [
@@ -25,5 +26,6 @@
25
26
  "mcp-i",
26
27
  "agent",
27
28
  "did"
28
- ]
29
- }
29
+ ],
30
+ "types": "kya_os_engine.d.ts"
31
+ }
@@ -1,485 +0,0 @@
1
- /* tslint:disable */
2
- /* eslint-disable */
3
- /**
4
- * Initialize the AgentShield WASM module
5
- */
6
- export function init(): void;
7
- /**
8
- * Analyze a request and detect if it's from an agent
9
- */
10
- export function detect_agent(metadata: JsRequestMetadata): JsDetectionResult;
11
- /**
12
- * Get the version of the AgentShield library
13
- */
14
- export function version(): string;
15
- /**
16
- * Get the version of the AgentShield library
17
- */
18
- export function get_version(): string;
19
- /**
20
- * Get build information
21
- */
22
- export function get_build_info(): string;
23
- /**
24
- * Verify an MCP-I proof (VC-JWT token)
25
- *
26
- * This function verifies a Verifiable Credential JWT and extracts the
27
- * principal (issuer) and agent (subject) DIDs.
28
- *
29
- * # Arguments
30
- *
31
- * * `vc_jwt` - The VC-JWT token string (header.payload.signature)
32
- * * `current_time_secs` - Current Unix timestamp in seconds (for expiration check)
33
- *
34
- * # Returns
35
- *
36
- * A `JsMcpIVerificationResult` with verification status and extracted DIDs.
37
- */
38
- export function verify_mcp_i_proof(
39
- vc_jwt: string,
40
- current_time_secs: bigint
41
- ): JsMcpIVerificationResult;
42
- /**
43
- * Resolve a did:key identifier to its public key
44
- *
45
- * # Arguments
46
- *
47
- * * `did` - The did:key identifier (e.g., "did:key:z6Mkf...")
48
- *
49
- * # Returns
50
- *
51
- * A `JsDidKeyResult` with the resolved public key or an error.
52
- */
53
- export function resolve_did_key_wasm(did: string): JsDidKeyResult;
54
- /**
55
- * Check if a requested scope is permitted by granted scopes
56
- *
57
- * # Arguments
58
- *
59
- * * `requested` - The scope being requested (e.g., "read:email")
60
- * * `granted_json` - JSON array of granted scopes (e.g., "[\"read:*\", \"write:calendar\"]")
61
- *
62
- * # Returns
63
- *
64
- * A `JsScopeCheckResult` indicating whether the scope is permitted.
65
- */
66
- export function check_delegation_scope(requested: string, granted_json: string): JsScopeCheckResult;
67
- /**
68
- * Verify a delegation with time constraints
69
- *
70
- * # Arguments
71
- *
72
- * * `requested` - The scope being requested
73
- * * `granted_json` - JSON array of granted scopes
74
- * * `not_before` - Optional Unix timestamp (0 to skip)
75
- * * `not_after` - Optional Unix timestamp (0 to skip)
76
- * * `current_time` - Current Unix timestamp (0 to skip time checks)
77
- *
78
- * # Returns
79
- *
80
- * A `JsScopeCheckResult` indicating whether the delegation is valid.
81
- */
82
- export function verify_delegation_scope(
83
- requested: string,
84
- granted_json: string,
85
- not_before: bigint,
86
- not_after: bigint,
87
- current_time: bigint
88
- ): JsScopeCheckResult;
89
- /**
90
- * Evaluate a request against a policy configuration
91
- *
92
- * # Arguments
93
- *
94
- * * `policy_json` - Policy configuration as JSON string
95
- * * `context_json` - Evaluation context as JSON string
96
- *
97
- * # Returns
98
- *
99
- * A `JsPolicyEvaluationResult` with the enforcement action and reason.
100
- *
101
- * # Example
102
- *
103
- * ```javascript
104
- * const policy = JSON.stringify({
105
- * version: "1.0.0",
106
- * enabled: true,
107
- * defaultAction: "allow",
108
- * thresholds: { confidenceThreshold: 80, confidenceAction: "block" },
109
- * denyList: [],
110
- * allowList: [],
111
- * rules: []
112
- * });
113
- *
114
- * const context = JSON.stringify({
115
- * agentType: "ai_agent",
116
- * agentName: "ChatGPT",
117
- * confidence: 95
118
- * });
119
- *
120
- * const result = evaluate_policy(policy, context);
121
- * console.log(result.action); // "block" (confidence exceeded threshold)
122
- * ```
123
- */
124
- export function evaluate_policy(
125
- policy_json: string,
126
- context_json: string
127
- ): JsPolicyEvaluationResult;
128
- /**
129
- * Check if a policy allows a request (convenience function)
130
- *
131
- * # Arguments
132
- *
133
- * * `policy_json` - Policy configuration as JSON string
134
- * * `context_json` - Evaluation context as JSON string
135
- *
136
- * # Returns
137
- *
138
- * `true` if the request is allowed, `false` otherwise.
139
- */
140
- export function policy_allows(policy_json: string, context_json: string): boolean;
141
- /**
142
- * JavaScript-compatible detection result
143
- */
144
- export class JsDetectionResult {
145
- private constructor();
146
- free(): void;
147
- [Symbol.dispose](): void;
148
- /**
149
- * Whether the request was identified as coming from an agent
150
- */
151
- is_agent: boolean;
152
- /**
153
- * Whether the detected bot is an AI crawler (GPTBot, ClaudeBot, etc.)
154
- */
155
- is_ai_crawler: boolean;
156
- /**
157
- * Confidence score (0.0 to 1.0 scale)
158
- */
159
- confidence: number;
160
- /**
161
- * Get the detected agent name
162
- */
163
- readonly agent: string | undefined;
164
- /**
165
- * Get the detection class for database storage
166
- * Returns: 'human', 'ai_agent', 'bot', 'automation', or 'unknown'
167
- */
168
- readonly detection_class: string;
169
- /**
170
- * Get the verification method as a string
171
- */
172
- readonly verification_method: string;
173
- /**
174
- * Get the risk level as a string
175
- */
176
- readonly risk_level: string;
177
- /**
178
- * Get the timestamp as a string
179
- */
180
- readonly timestamp: string;
181
- }
182
- /**
183
- * JavaScript-compatible result from did:key resolution
184
- */
185
- export class JsDidKeyResult {
186
- private constructor();
187
- free(): void;
188
- [Symbol.dispose](): void;
189
- /**
190
- * Whether the resolution was successful
191
- */
192
- success: boolean;
193
- /**
194
- * Get the public key as hex string
195
- */
196
- readonly public_key_hex: string | undefined;
197
- /**
198
- * Get the key type
199
- */
200
- readonly key_type: string | undefined;
201
- /**
202
- * Get the error message
203
- */
204
- readonly error: string | undefined;
205
- }
206
- /**
207
- * JavaScript-compatible result from MCP-I verification
208
- */
209
- export class JsMcpIVerificationResult {
210
- private constructor();
211
- free(): void;
212
- [Symbol.dispose](): void;
213
- /**
214
- * Whether the verification was successful
215
- */
216
- verified: boolean;
217
- /**
218
- * Confidence score (0.0 to 1.0 scale) - 0.99 for verified MCP-I
219
- */
220
- confidence: number;
221
- /**
222
- * Get the issuer DID (principal)
223
- */
224
- readonly issuer_did: string | undefined;
225
- /**
226
- * Get the subject DID (agent)
227
- */
228
- readonly subject_did: string | undefined;
229
- /**
230
- * Get the error message
231
- */
232
- readonly error: string | undefined;
233
- }
234
- /**
235
- * JavaScript-compatible policy evaluation result
236
- */
237
- export class JsPolicyEvaluationResult {
238
- private constructor();
239
- free(): void;
240
- [Symbol.dispose](): void;
241
- /**
242
- * Check if the action permits the request to proceed
243
- * Returns true for 'allow' and 'log' (allow but log for monitoring)
244
- */
245
- is_allowed(): boolean;
246
- /**
247
- * Check if the action blocks the request
248
- * Returns true for 'block', 'redirect', and 'challenge'
249
- */
250
- is_blocked(): boolean;
251
- /**
252
- * Convert to JSON string for serialization
253
- */
254
- to_json(): string;
255
- /**
256
- * Get the enforcement action
257
- */
258
- readonly action: string;
259
- /**
260
- * Get the reason for the action
261
- */
262
- readonly reason: string;
263
- /**
264
- * Get the matched rule ID
265
- */
266
- readonly rule_id: string | undefined;
267
- /**
268
- * Get the matched rule name
269
- */
270
- readonly rule_name: string | undefined;
271
- /**
272
- * Get the redirect URL
273
- */
274
- readonly redirect_url: string | undefined;
275
- /**
276
- * Get the custom message
277
- */
278
- readonly message: string | undefined;
279
- /**
280
- * Get the match type
281
- */
282
- readonly match_type: string;
283
- }
284
- /**
285
- * JavaScript-compatible request metadata
286
- */
287
- export class JsRequestMetadata {
288
- free(): void;
289
- [Symbol.dispose](): void;
290
- /**
291
- * Constructor for JsRequestMetadata
292
- */
293
- constructor(
294
- user_agent: string | null | undefined,
295
- ip_address: string | null | undefined,
296
- headers: string,
297
- timestamp: string,
298
- url?: string | null,
299
- method?: string | null,
300
- client_fingerprint?: string | null,
301
- tls_fingerprint?: string | null
302
- );
303
- /**
304
- * Get the user agent
305
- */
306
- readonly user_agent: string | undefined;
307
- /**
308
- * Get the IP address
309
- */
310
- readonly ip_address: string | undefined;
311
- /**
312
- * Get the headers as JSON string
313
- */
314
- readonly headers: string;
315
- /**
316
- * Get the timestamp
317
- */
318
- readonly timestamp: string;
319
- /**
320
- * Get the URL
321
- */
322
- readonly url: string | undefined;
323
- /**
324
- * Get the method
325
- */
326
- readonly method: string | undefined;
327
- /**
328
- * Get the client fingerprint
329
- */
330
- readonly client_fingerprint: string | undefined;
331
- /**
332
- * Get the TLS fingerprint
333
- */
334
- readonly tls_fingerprint: string | undefined;
335
- }
336
- /**
337
- * JavaScript-compatible result from scope check
338
- */
339
- export class JsScopeCheckResult {
340
- private constructor();
341
- free(): void;
342
- [Symbol.dispose](): void;
343
- /**
344
- * Whether the scope is permitted
345
- */
346
- permitted: boolean;
347
- /**
348
- * Get the matching scope
349
- */
350
- readonly matched_by: string | undefined;
351
- /**
352
- * Get the match type
353
- */
354
- readonly match_type: string;
355
- /**
356
- * Get the error message
357
- */
358
- readonly error: string | undefined;
359
- }
360
-
361
- export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
362
-
363
- export interface InitOutput {
364
- readonly memory: WebAssembly.Memory;
365
- readonly __wbg_jsdetectionresult_free: (a: number, b: number) => void;
366
- readonly __wbg_get_jsdetectionresult_is_agent: (a: number) => number;
367
- readonly __wbg_set_jsdetectionresult_is_agent: (a: number, b: number) => void;
368
- readonly __wbg_get_jsdetectionresult_is_ai_crawler: (a: number) => number;
369
- readonly __wbg_set_jsdetectionresult_is_ai_crawler: (a: number, b: number) => void;
370
- readonly __wbg_get_jsdetectionresult_confidence: (a: number) => number;
371
- readonly __wbg_set_jsdetectionresult_confidence: (a: number, b: number) => void;
372
- readonly jsdetectionresult_agent: (a: number, b: number) => void;
373
- readonly jsdetectionresult_detection_class: (a: number, b: number) => void;
374
- readonly jsdetectionresult_verification_method: (a: number, b: number) => void;
375
- readonly jsdetectionresult_risk_level: (a: number, b: number) => void;
376
- readonly jsdetectionresult_timestamp: (a: number, b: number) => void;
377
- readonly __wbg_jsrequestmetadata_free: (a: number, b: number) => void;
378
- readonly jsrequestmetadata_new: (
379
- a: number,
380
- b: number,
381
- c: number,
382
- d: number,
383
- e: number,
384
- f: number,
385
- g: number,
386
- h: number,
387
- i: number,
388
- j: number,
389
- k: number,
390
- l: number,
391
- m: number,
392
- n: number,
393
- o: number,
394
- p: number
395
- ) => number;
396
- readonly jsrequestmetadata_user_agent: (a: number, b: number) => void;
397
- readonly jsrequestmetadata_ip_address: (a: number, b: number) => void;
398
- readonly jsrequestmetadata_headers: (a: number, b: number) => void;
399
- readonly jsrequestmetadata_timestamp: (a: number, b: number) => void;
400
- readonly jsrequestmetadata_url: (a: number, b: number) => void;
401
- readonly jsrequestmetadata_method: (a: number, b: number) => void;
402
- readonly jsrequestmetadata_client_fingerprint: (a: number, b: number) => void;
403
- readonly jsrequestmetadata_tls_fingerprint: (a: number, b: number) => void;
404
- readonly init: () => void;
405
- readonly detect_agent: (a: number, b: number) => void;
406
- readonly get_version: (a: number) => void;
407
- readonly get_build_info: (a: number) => void;
408
- readonly __wbg_jsmcpiverificationresult_free: (a: number, b: number) => void;
409
- readonly __wbg_get_jsmcpiverificationresult_verified: (a: number) => number;
410
- readonly __wbg_set_jsmcpiverificationresult_verified: (a: number, b: number) => void;
411
- readonly jsmcpiverificationresult_issuer_did: (a: number, b: number) => void;
412
- readonly jsmcpiverificationresult_subject_did: (a: number, b: number) => void;
413
- readonly jsmcpiverificationresult_error: (a: number, b: number) => void;
414
- readonly verify_mcp_i_proof: (a: number, b: number, c: bigint) => number;
415
- readonly __wbg_jsdidkeyresult_free: (a: number, b: number) => void;
416
- readonly __wbg_get_jsdidkeyresult_success: (a: number) => number;
417
- readonly __wbg_set_jsdidkeyresult_success: (a: number, b: number) => void;
418
- readonly jsdidkeyresult_public_key_hex: (a: number, b: number) => void;
419
- readonly jsdidkeyresult_key_type: (a: number, b: number) => void;
420
- readonly jsdidkeyresult_error: (a: number, b: number) => void;
421
- readonly resolve_did_key_wasm: (a: number, b: number) => number;
422
- readonly __wbg_jsscopecheckresult_free: (a: number, b: number) => void;
423
- readonly jsscopecheckresult_matched_by: (a: number, b: number) => void;
424
- readonly jsscopecheckresult_match_type: (a: number, b: number) => void;
425
- readonly jsscopecheckresult_error: (a: number, b: number) => void;
426
- readonly check_delegation_scope: (a: number, b: number, c: number, d: number) => number;
427
- readonly verify_delegation_scope: (
428
- a: number,
429
- b: number,
430
- c: number,
431
- d: number,
432
- e: bigint,
433
- f: bigint,
434
- g: bigint
435
- ) => number;
436
- readonly __wbg_jspolicyevaluationresult_free: (a: number, b: number) => void;
437
- readonly jspolicyevaluationresult_action: (a: number, b: number) => void;
438
- readonly jspolicyevaluationresult_reason: (a: number, b: number) => void;
439
- readonly jspolicyevaluationresult_rule_id: (a: number, b: number) => void;
440
- readonly jspolicyevaluationresult_rule_name: (a: number, b: number) => void;
441
- readonly jspolicyevaluationresult_redirect_url: (a: number, b: number) => void;
442
- readonly jspolicyevaluationresult_message: (a: number, b: number) => void;
443
- readonly jspolicyevaluationresult_match_type: (a: number, b: number) => void;
444
- readonly jspolicyevaluationresult_is_allowed: (a: number) => number;
445
- readonly jspolicyevaluationresult_is_blocked: (a: number) => number;
446
- readonly jspolicyevaluationresult_to_json: (a: number, b: number) => void;
447
- readonly evaluate_policy: (a: number, b: number, c: number, d: number, e: number) => void;
448
- readonly policy_allows: (a: number, b: number, c: number, d: number) => number;
449
- readonly version: (a: number) => void;
450
- readonly __wbg_get_jsscopecheckresult_permitted: (a: number) => number;
451
- readonly __wbg_set_jsscopecheckresult_permitted: (a: number, b: number) => void;
452
- readonly __wbg_set_jsmcpiverificationresult_confidence: (a: number, b: number) => void;
453
- readonly __wbg_get_jsmcpiverificationresult_confidence: (a: number) => number;
454
- readonly __wbindgen_export: (a: number, b: number, c: number) => void;
455
- readonly __wbindgen_export2: (a: number, b: number) => number;
456
- readonly __wbindgen_export3: (a: number, b: number, c: number, d: number) => number;
457
- readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
458
- readonly __wbindgen_start: () => void;
459
- }
460
-
461
- export type SyncInitInput = BufferSource | WebAssembly.Module;
462
- /**
463
- * Instantiates the given `module`, which can either be bytes or
464
- * a precompiled `WebAssembly.Module`.
465
- *
466
- * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
467
- *
468
- * @returns {InitOutput}
469
- */
470
- export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
471
-
472
- /**
473
- * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
474
- * for everything else, calls `WebAssembly.instantiate` directly.
475
- *
476
- * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
477
- *
478
- * @returns {Promise<InitOutput>}
479
- */
480
- export default function __wbg_init(
481
- module_or_path?:
482
- | { module_or_path: InitInput | Promise<InitInput> }
483
- | InitInput
484
- | Promise<InitInput>
485
- ): Promise<InitOutput>;