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

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.
@@ -1,200 +0,0 @@
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 };
@@ -1,200 +0,0 @@
1
- import { E as EnforcementMode, A as AgentRequest, V as VerifyResult } from './types-D0j85fF0.js';
2
- import { DidResolverAdapter, StatusListCacheAdapter, ReputationOracleAdapter, PolicyEvaluatorAdapter, ClockAdapter } from './adapters.js';
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 };
@@ -1,72 +0,0 @@
1
- import { i as IWasmLoader, h as IWasmBindings } from './rules-detector-DjbTJ1-Q.js';
2
-
3
- /**
4
- * Static WASM Loader for Edge Runtime
5
- *
6
- * This loader is designed for environments that require static WASM imports,
7
- * such as Vercel Edge Runtime and Cloudflare Workers.
8
- *
9
- * Usage:
10
- * ```typescript
11
- * // In your middleware.ts:
12
- * import wasmModule from '@kya-os/checkpoint-wasm-runtime/wasm?module';
13
- * import { StaticWasmLoader, WasmDetector } from '@kya-os/checkpoint-wasm-runtime/edge';
14
- *
15
- * const loader = new StaticWasmLoader(wasmModule);
16
- * const detector = new WasmDetector(loader);
17
- * ```
18
- *
19
- * The `?module` suffix tells bundlers (webpack, esbuild) to import the WASM
20
- * as a pre-compiled WebAssembly.Module, which is required for Edge Runtime.
21
- */
22
-
23
- /**
24
- * Static WASM Loader
25
- *
26
- * For Edge Runtime environments that require pre-compiled WASM modules.
27
- * The consumer must provide the WASM module via a static import with `?module` suffix.
28
- *
29
- * This loader uses the wasm-bindgen generated JS glue code to properly
30
- * initialize the WASM module with all required imports.
31
- */
32
- declare class StaticWasmLoader implements IWasmLoader {
33
- private readonly wasmModule;
34
- private bindings;
35
- private loadPromise;
36
- private wasmExports;
37
- /**
38
- * Create a new StaticWasmLoader
39
- * @param wasmModule - Pre-compiled WebAssembly.Module from static import
40
- */
41
- constructor(wasmModule: WebAssembly.Module);
42
- /**
43
- * Load and instantiate the WASM module
44
- */
45
- load(): Promise<void>;
46
- /**
47
- * Internal load implementation using wasm-bindgen initSync
48
- */
49
- private doLoad;
50
- /**
51
- * Get the WASM bindings after loading
52
- */
53
- getBindings(): IWasmBindings;
54
- /**
55
- * Check if WASM is loaded
56
- */
57
- isLoaded(): boolean;
58
- /**
59
- * Get the loading strategy name
60
- */
61
- getStrategy(): string;
62
- /**
63
- * Create bindings wrapper using wasm-bindgen exports
64
- */
65
- private createBindings;
66
- }
67
- /**
68
- * Create a static loader with validation
69
- */
70
- declare function createStaticLoader(wasmModule: WebAssembly.Module): StaticWasmLoader;
71
-
72
- export { StaticWasmLoader as S, createStaticLoader as c };
@@ -1,72 +0,0 @@
1
- import { i as IWasmLoader, h as IWasmBindings } from './rules-detector-DjbTJ1-Q.mjs';
2
-
3
- /**
4
- * Static WASM Loader for Edge Runtime
5
- *
6
- * This loader is designed for environments that require static WASM imports,
7
- * such as Vercel Edge Runtime and Cloudflare Workers.
8
- *
9
- * Usage:
10
- * ```typescript
11
- * // In your middleware.ts:
12
- * import wasmModule from '@kya-os/checkpoint-wasm-runtime/wasm?module';
13
- * import { StaticWasmLoader, WasmDetector } from '@kya-os/checkpoint-wasm-runtime/edge';
14
- *
15
- * const loader = new StaticWasmLoader(wasmModule);
16
- * const detector = new WasmDetector(loader);
17
- * ```
18
- *
19
- * The `?module` suffix tells bundlers (webpack, esbuild) to import the WASM
20
- * as a pre-compiled WebAssembly.Module, which is required for Edge Runtime.
21
- */
22
-
23
- /**
24
- * Static WASM Loader
25
- *
26
- * For Edge Runtime environments that require pre-compiled WASM modules.
27
- * The consumer must provide the WASM module via a static import with `?module` suffix.
28
- *
29
- * This loader uses the wasm-bindgen generated JS glue code to properly
30
- * initialize the WASM module with all required imports.
31
- */
32
- declare class StaticWasmLoader implements IWasmLoader {
33
- private readonly wasmModule;
34
- private bindings;
35
- private loadPromise;
36
- private wasmExports;
37
- /**
38
- * Create a new StaticWasmLoader
39
- * @param wasmModule - Pre-compiled WebAssembly.Module from static import
40
- */
41
- constructor(wasmModule: WebAssembly.Module);
42
- /**
43
- * Load and instantiate the WASM module
44
- */
45
- load(): Promise<void>;
46
- /**
47
- * Internal load implementation using wasm-bindgen initSync
48
- */
49
- private doLoad;
50
- /**
51
- * Get the WASM bindings after loading
52
- */
53
- getBindings(): IWasmBindings;
54
- /**
55
- * Check if WASM is loaded
56
- */
57
- isLoaded(): boolean;
58
- /**
59
- * Get the loading strategy name
60
- */
61
- getStrategy(): string;
62
- /**
63
- * Create bindings wrapper using wasm-bindgen exports
64
- */
65
- private createBindings;
66
- }
67
- /**
68
- * Create a static loader with validation
69
- */
70
- declare function createStaticLoader(wasmModule: WebAssembly.Module): StaticWasmLoader;
71
-
72
- export { StaticWasmLoader as S, createStaticLoader as c };