@kya-os/checkpoint-wasm-runtime 1.0.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 +58 -0
- package/dist/adapters.d.mts +257 -0
- package/dist/adapters.d.ts +257 -0
- package/dist/adapters.js +603 -0
- package/dist/adapters.js.map +1 -0
- package/dist/adapters.mjs +586 -0
- package/dist/adapters.mjs.map +1 -0
- package/dist/dynamic-loader-cS-pUisw.d.ts +65 -0
- package/dist/dynamic-loader-qGJacfEC.d.mts +65 -0
- package/dist/edge.d.mts +22 -0
- package/dist/edge.d.ts +22 -0
- package/dist/edge.js +1403 -0
- package/dist/edge.js.map +1 -0
- package/dist/edge.mjs +1391 -0
- package/dist/edge.mjs.map +1 -0
- package/dist/engine-edge.d.mts +58 -0
- package/dist/engine-edge.d.ts +58 -0
- package/dist/engine-edge.js +537 -0
- package/dist/engine-edge.js.map +1 -0
- package/dist/engine-edge.mjs +533 -0
- package/dist/engine-edge.mjs.map +1 -0
- package/dist/engine.d.mts +34 -0
- package/dist/engine.d.ts +34 -0
- package/dist/engine.js +11 -0
- package/dist/engine.js.map +1 -0
- package/dist/engine.mjs +9 -0
- package/dist/engine.mjs.map +1 -0
- package/dist/index.d.mts +58 -0
- package/dist/index.d.ts +58 -0
- package/dist/index.js +1652 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1637 -0
- package/dist/index.mjs.map +1 -0
- package/dist/node.d.mts +26 -0
- package/dist/node.d.ts +26 -0
- package/dist/node.js +972 -0
- package/dist/node.js.map +1 -0
- package/dist/node.mjs +960 -0
- package/dist/node.mjs.map +1 -0
- package/dist/orchestrator-edge.d.mts +243 -0
- package/dist/orchestrator-edge.d.ts +243 -0
- package/dist/orchestrator-edge.js +1076 -0
- package/dist/orchestrator-edge.js.map +1 -0
- package/dist/orchestrator-edge.mjs +1065 -0
- package/dist/orchestrator-edge.mjs.map +1 -0
- package/dist/orchestrator.d.mts +50 -0
- package/dist/orchestrator.d.ts +50 -0
- package/dist/orchestrator.js +1185 -0
- package/dist/orchestrator.js.map +1 -0
- package/dist/orchestrator.mjs +1172 -0
- package/dist/orchestrator.mjs.map +1 -0
- package/dist/rules-detector-DjbTJ1-Q.d.mts +470 -0
- package/dist/rules-detector-DjbTJ1-Q.d.ts +470 -0
- package/dist/static-loader-C1hUlksK.d.ts +72 -0
- package/dist/static-loader-Ds4iNw7c.d.mts +72 -0
- package/dist/types-D0j85fF0.d.mts +163 -0
- package/dist/types-D0j85fF0.d.ts +163 -0
- package/package.json +141 -0
- package/wasm/agentshield_wasm.d.ts +485 -0
- package/wasm/agentshield_wasm.js +1551 -0
- package/wasm/agentshield_wasm_bg.wasm +0 -0
- package/wasm/agentshield_wasm_bg.wasm.d.ts +97 -0
- package/wasm/kya-os-engine/kya_os_engine.d.ts +24 -0
- package/wasm/kya-os-engine/kya_os_engine.js +517 -0
- package/wasm/kya-os-engine/kya_os_engine_bg.wasm +0 -0
- package/wasm/kya-os-engine/kya_os_engine_bg.wasm.d.ts +8 -0
- package/wasm/kya-os-engine-web/kya_os_engine.d.ts +56 -0
- package/wasm/kya-os-engine-web/kya_os_engine.js +574 -0
- package/wasm/kya-os-engine-web/kya_os_engine_bg.wasm +0 -0
- package/wasm/kya-os-engine-web/kya_os_engine_bg.wasm.d.ts +8 -0
- package/wasm/package.json +30 -0
package/dist/engine.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { A as AgentRequest, C as ContextSpec, V as VerifyResult } from './types-D0j85fF0.js';
|
|
2
|
+
export { a as A2ARequest, b as A2PRequest, B as BlockReason, c as ChallengeParams, D as Decision, d as DidDocument, E as EnforcementMode, e as EngineInfo, H as HttpSignedRequest, I as InstructPayload, K as KeyType, M as McpIRequest, P as PlainHttpRequest, R as RedirectTarget, S as SuggestedAction, f as VerificationMethod } from './types-D0j85fF0.js';
|
|
3
|
+
export { McpIPayload } from '@kya-os/checkpoint-shared';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* `kya-os-engine` WASM bridge — E-1 (#2486 follow-up).
|
|
7
|
+
*
|
|
8
|
+
* Loads the Rust `kya-os-engine` WASM artifact and surfaces a typed
|
|
9
|
+
* `engineVerify(input, ctx)` wrapper around its single `verify` export.
|
|
10
|
+
*
|
|
11
|
+
* The engine is **synchronous** by contract. Host wrappers pre-fetch
|
|
12
|
+
* every async dependency (DID document, status list, reputation,
|
|
13
|
+
* tenant policy) and ship the results as a plain-data
|
|
14
|
+
* [`ContextSpec`] (see `./types`). The WASM glue on the Rust side
|
|
15
|
+
* builds in-memory lookup-table adapters that satisfy the engine's
|
|
16
|
+
* five sync DI traits — no JS callbacks cross the boundary.
|
|
17
|
+
*
|
|
18
|
+
* Subsequent E-2 / E-3 phases consume this module to verify HTTP
|
|
19
|
+
* requests inside the Next.js + Express middlewares.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Verify an AgentRequest synchronously against a pre-fetched
|
|
24
|
+
* [`ContextSpec`].
|
|
25
|
+
*
|
|
26
|
+
* @throws {Error} if the WASM glue rejects the input (deserialisation
|
|
27
|
+
* failure) or the engine returns a `VerifyError` (resolver /
|
|
28
|
+
* status-list / reputation / policy infrastructure failure). Engine
|
|
29
|
+
* *verdicts* (Block / Challenge / etc.) DO NOT throw — they surface
|
|
30
|
+
* inside the returned [`VerifyResult`].
|
|
31
|
+
*/
|
|
32
|
+
declare function engineVerify(input: AgentRequest, ctx: ContextSpec): VerifyResult;
|
|
33
|
+
|
|
34
|
+
export { AgentRequest, ContextSpec, VerifyResult, engineVerify };
|
package/dist/engine.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/engine/index.ts"],"names":[],"mappings":";;;AAoCO,SAAS,YAAA,CAAa,OAAqB,GAAA,EAAgC;AAChF,EAAA,MAAM,MAAA,GAAS,CAAA,MAAA,EAAW,KAAA,EAAO,GAAG,CAAA;AACpC,EAAA,OAAO,MAAA;AACT","file":"engine.js","sourcesContent":["/**\n * `kya-os-engine` WASM bridge — E-1 (#2486 follow-up).\n *\n * Loads the Rust `kya-os-engine` WASM artifact and surfaces a typed\n * `engineVerify(input, ctx)` wrapper around its single `verify` export.\n *\n * The engine is **synchronous** by contract. Host wrappers pre-fetch\n * every async dependency (DID document, status list, reputation,\n * tenant policy) and ship the results as a plain-data\n * [`ContextSpec`] (see `./types`). The WASM glue on the Rust side\n * builds in-memory lookup-table adapters that satisfy the engine's\n * five sync DI traits — no JS callbacks cross the boundary.\n *\n * Subsequent E-2 / E-3 phases consume this module to verify HTTP\n * requests inside the Next.js + Express middlewares.\n */\n\nimport type { AgentRequest, ContextSpec, VerifyResult } from './types';\n\n// wasm-bindgen ships a Node.js entry that calls\n// `fs.readFileSync(__dirname + '/<name>_bg.wasm')` synchronously when\n// the module is imported. The auto-generated `.d.ts` types the export\n// loosely (`any`); we re-type at this wrapper boundary so callers see\n// the contract from `./types`.\nimport { verify as wasmVerify } from '../../wasm/kya-os-engine/kya_os_engine.js';\n\n/**\n * Verify an AgentRequest synchronously against a pre-fetched\n * [`ContextSpec`].\n *\n * @throws {Error} if the WASM glue rejects the input (deserialisation\n * failure) or the engine returns a `VerifyError` (resolver /\n * status-list / reputation / policy infrastructure failure). Engine\n * *verdicts* (Block / Challenge / etc.) DO NOT throw — they surface\n * inside the returned [`VerifyResult`].\n */\nexport function engineVerify(input: AgentRequest, ctx: ContextSpec): VerifyResult {\n const result = wasmVerify(input, ctx);\n return result as VerifyResult;\n}\n\nexport type {\n AgentRequest,\n A2ARequest,\n A2PRequest,\n BlockReason,\n ChallengeParams,\n ContextSpec,\n Decision,\n DidDocument,\n EngineInfo,\n EnforcementMode,\n HttpSignedRequest,\n InstructPayload,\n KeyType,\n McpIPayload,\n McpIRequest,\n PlainHttpRequest,\n RedirectTarget,\n SuggestedAction,\n VerificationMethod,\n VerifyResult,\n} from './types';\n"]}
|
package/dist/engine.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/engine/index.ts"],"names":[],"mappings":";AAoCO,SAAS,YAAA,CAAa,OAAqB,GAAA,EAAgC;AAChF,EAAA,MAAM,MAAA,GAAS,CAAA,MAAA,EAAW,KAAA,EAAO,GAAG,CAAA;AACpC,EAAA,OAAO,MAAA;AACT","file":"engine.mjs","sourcesContent":["/**\n * `kya-os-engine` WASM bridge — E-1 (#2486 follow-up).\n *\n * Loads the Rust `kya-os-engine` WASM artifact and surfaces a typed\n * `engineVerify(input, ctx)` wrapper around its single `verify` export.\n *\n * The engine is **synchronous** by contract. Host wrappers pre-fetch\n * every async dependency (DID document, status list, reputation,\n * tenant policy) and ship the results as a plain-data\n * [`ContextSpec`] (see `./types`). The WASM glue on the Rust side\n * builds in-memory lookup-table adapters that satisfy the engine's\n * five sync DI traits — no JS callbacks cross the boundary.\n *\n * Subsequent E-2 / E-3 phases consume this module to verify HTTP\n * requests inside the Next.js + Express middlewares.\n */\n\nimport type { AgentRequest, ContextSpec, VerifyResult } from './types';\n\n// wasm-bindgen ships a Node.js entry that calls\n// `fs.readFileSync(__dirname + '/<name>_bg.wasm')` synchronously when\n// the module is imported. The auto-generated `.d.ts` types the export\n// loosely (`any`); we re-type at this wrapper boundary so callers see\n// the contract from `./types`.\nimport { verify as wasmVerify } from '../../wasm/kya-os-engine/kya_os_engine.js';\n\n/**\n * Verify an AgentRequest synchronously against a pre-fetched\n * [`ContextSpec`].\n *\n * @throws {Error} if the WASM glue rejects the input (deserialisation\n * failure) or the engine returns a `VerifyError` (resolver /\n * status-list / reputation / policy infrastructure failure). Engine\n * *verdicts* (Block / Challenge / etc.) DO NOT throw — they surface\n * inside the returned [`VerifyResult`].\n */\nexport function engineVerify(input: AgentRequest, ctx: ContextSpec): VerifyResult {\n const result = wasmVerify(input, ctx);\n return result as VerifyResult;\n}\n\nexport type {\n AgentRequest,\n A2ARequest,\n A2PRequest,\n BlockReason,\n ChallengeParams,\n ContextSpec,\n Decision,\n DidDocument,\n EngineInfo,\n EnforcementMode,\n HttpSignedRequest,\n InstructPayload,\n KeyType,\n McpIPayload,\n McpIRequest,\n PlainHttpRequest,\n RedirectTarget,\n SuggestedAction,\n VerificationMethod,\n VerifyResult,\n} from './types';\n"]}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { I as IDetectorOptions, a as IDetector } from './rules-detector-DjbTJ1-Q.mjs';
|
|
2
|
+
export { C as CONFIDENCE, D as DetectionClass, F as ForgeabilityRisk, b as ICustomerPolicy, c as IDetectedAgent, d as IDetectionInput, e as IDetectionResult, f as IPathRule, g as IPolicyLoader, h as IWasmBindings, i as IWasmLoader, P as PolicyLoadError, j as PolicyLoader, k as PolicyLoaderConfig, R as RulesDetector, V as VerificationMethod, W as WasmDetector, l as createPolicyLoader, m as createRulesDetector } from './rules-detector-DjbTJ1-Q.mjs';
|
|
3
|
+
export { S as StaticWasmLoader, c as createStaticLoader } from './static-loader-Ds4iNw7c.mjs';
|
|
4
|
+
export { D as DynamicWasmLoader, c as createDynamicLoader } from './dynamic-loader-qGJacfEC.mjs';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Create a detector with automatic runtime selection
|
|
8
|
+
*
|
|
9
|
+
* @param options - Detector configuration
|
|
10
|
+
* @returns A configured detector instance
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* // Basic usage
|
|
15
|
+
* const detector = createDetector();
|
|
16
|
+
*
|
|
17
|
+
* // With API key for policy loading
|
|
18
|
+
* const detector = createDetector({
|
|
19
|
+
* apiKey: 'your-api-key',
|
|
20
|
+
* });
|
|
21
|
+
*
|
|
22
|
+
* // With custom WASM loader (for Edge Runtime)
|
|
23
|
+
* import wasmModule from './wasm.wasm?module';
|
|
24
|
+
* const detector = createDetector({
|
|
25
|
+
* wasmLoader: new StaticWasmLoader(wasmModule),
|
|
26
|
+
* });
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
declare function createDetector(options?: IDetectorOptions): IDetector;
|
|
30
|
+
/**
|
|
31
|
+
* Create a detector for Edge Runtime with static WASM import
|
|
32
|
+
*
|
|
33
|
+
* @param wasmModule - Pre-compiled WebAssembly.Module from static import
|
|
34
|
+
* @param options - Detector configuration
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* // In your middleware.ts:
|
|
39
|
+
* import wasmModule from '@kya-os/checkpoint-wasm-runtime/wasm?module';
|
|
40
|
+
* import { createEdgeDetector } from '@kya-os/checkpoint-wasm-runtime';
|
|
41
|
+
*
|
|
42
|
+
* const detector = createEdgeDetector(wasmModule, {
|
|
43
|
+
* apiKey: process.env.AGENTSHIELD_API_KEY,
|
|
44
|
+
* });
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
declare function createEdgeDetector(wasmModule: WebAssembly.Module, options?: IDetectorOptions): IDetector;
|
|
48
|
+
/**
|
|
49
|
+
* Create a fallback detector using JavaScript rules
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```typescript
|
|
53
|
+
* const detector = createFallbackDetector();
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
declare function createFallbackDetector(): IDetector;
|
|
57
|
+
|
|
58
|
+
export { IDetector, IDetectorOptions, createDetector, createEdgeDetector, createFallbackDetector };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { I as IDetectorOptions, a as IDetector } from './rules-detector-DjbTJ1-Q.js';
|
|
2
|
+
export { C as CONFIDENCE, D as DetectionClass, F as ForgeabilityRisk, b as ICustomerPolicy, c as IDetectedAgent, d as IDetectionInput, e as IDetectionResult, f as IPathRule, g as IPolicyLoader, h as IWasmBindings, i as IWasmLoader, P as PolicyLoadError, j as PolicyLoader, k as PolicyLoaderConfig, R as RulesDetector, V as VerificationMethod, W as WasmDetector, l as createPolicyLoader, m as createRulesDetector } from './rules-detector-DjbTJ1-Q.js';
|
|
3
|
+
export { S as StaticWasmLoader, c as createStaticLoader } from './static-loader-C1hUlksK.js';
|
|
4
|
+
export { D as DynamicWasmLoader, c as createDynamicLoader } from './dynamic-loader-cS-pUisw.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Create a detector with automatic runtime selection
|
|
8
|
+
*
|
|
9
|
+
* @param options - Detector configuration
|
|
10
|
+
* @returns A configured detector instance
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* // Basic usage
|
|
15
|
+
* const detector = createDetector();
|
|
16
|
+
*
|
|
17
|
+
* // With API key for policy loading
|
|
18
|
+
* const detector = createDetector({
|
|
19
|
+
* apiKey: 'your-api-key',
|
|
20
|
+
* });
|
|
21
|
+
*
|
|
22
|
+
* // With custom WASM loader (for Edge Runtime)
|
|
23
|
+
* import wasmModule from './wasm.wasm?module';
|
|
24
|
+
* const detector = createDetector({
|
|
25
|
+
* wasmLoader: new StaticWasmLoader(wasmModule),
|
|
26
|
+
* });
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
declare function createDetector(options?: IDetectorOptions): IDetector;
|
|
30
|
+
/**
|
|
31
|
+
* Create a detector for Edge Runtime with static WASM import
|
|
32
|
+
*
|
|
33
|
+
* @param wasmModule - Pre-compiled WebAssembly.Module from static import
|
|
34
|
+
* @param options - Detector configuration
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* // In your middleware.ts:
|
|
39
|
+
* import wasmModule from '@kya-os/checkpoint-wasm-runtime/wasm?module';
|
|
40
|
+
* import { createEdgeDetector } from '@kya-os/checkpoint-wasm-runtime';
|
|
41
|
+
*
|
|
42
|
+
* const detector = createEdgeDetector(wasmModule, {
|
|
43
|
+
* apiKey: process.env.AGENTSHIELD_API_KEY,
|
|
44
|
+
* });
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
declare function createEdgeDetector(wasmModule: WebAssembly.Module, options?: IDetectorOptions): IDetector;
|
|
48
|
+
/**
|
|
49
|
+
* Create a fallback detector using JavaScript rules
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```typescript
|
|
53
|
+
* const detector = createFallbackDetector();
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
declare function createFallbackDetector(): IDetector;
|
|
57
|
+
|
|
58
|
+
export { IDetector, IDetectorOptions, createDetector, createEdgeDetector, createFallbackDetector };
|