@kya-os/checkpoint-wasm-runtime 1.3.0 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +110 -1
- package/dist/adapters.d.mts +1 -1
- package/dist/adapters.d.ts +1 -1
- package/dist/engine-edge.d.mts +2 -2
- package/dist/engine-edge.d.ts +2 -2
- package/dist/engine-edge.js +3 -509
- package/dist/engine-edge.mjs +3 -508
- package/dist/engine-node.d.mts +46 -0
- package/dist/engine-node.d.ts +46 -0
- package/dist/engine-node.js +31 -0
- package/dist/engine-node.mjs +10 -0
- package/dist/engine.d.mts +25 -4
- package/dist/engine.d.ts +25 -4
- package/dist/engine.js +2 -457
- package/dist/engine.mjs +2 -464
- package/dist/index.d.mts +531 -3
- package/dist/index.d.ts +531 -3
- package/dist/index.js +2 -28
- package/dist/index.mjs +2 -29
- package/dist/node.d.mts +524 -3
- package/dist/node.d.ts +524 -3
- package/dist/node.js +2 -26
- package/dist/node.mjs +2 -26
- package/dist/orchestrator-edge.d.mts +26 -10
- package/dist/orchestrator-edge.d.ts +26 -10
- package/dist/orchestrator-edge.js +23 -510
- package/dist/orchestrator-edge.mjs +23 -509
- package/dist/orchestrator-node.d.mts +62 -52
- package/dist/orchestrator-node.d.ts +62 -52
- package/dist/orchestrator-node.js +68 -487
- package/dist/orchestrator-node.mjs +52 -497
- package/dist/orchestrator.d.mts +358 -4
- package/dist/orchestrator.d.ts +358 -4
- package/dist/orchestrator.js +55 -1001
- package/dist/orchestrator.mjs +55 -1005
- package/dist/{types-ByrdPLL2.d.ts → types-C3RniIOM.d.mts} +59 -1
- package/dist/{types-ByrdPLL2.d.mts → types-C3RniIOM.d.ts} +59 -1
- package/package.json +13 -2
- package/wasm/kya-os-engine/README.md +26 -0
- package/wasm/kya-os-engine-bundler/kya_os_engine.js +4 -0
- package/wasm/{kya-os-engine/kya_os_engine.js → kya-os-engine-bundler/kya_os_engine_bg.js} +62 -57
- package/wasm/kya-os-engine-bundler/kya_os_engine_bg.wasm +0 -0
- package/wasm/kya-os-engine-web/README.md +26 -0
- package/dist/kya_os_engine_bg.wasm +0 -0
- package/dist/rules-detector-ZIKHN-_y.d.mts +0 -532
- package/dist/rules-detector-ZIKHN-_y.d.ts +0 -532
- package/wasm/kya-os-engine/kya_os_engine_bg.wasm +0 -0
- package/wasm/kya-os-engine/kya_os_engine_bg.wasm.d.ts +0 -8
- package/wasm/kya-os-engine/package.json +0 -7
- package/wasm/kya-os-engine-web/kya_os_engine.d.ts +0 -56
- package/wasm/kya-os-engine-web/kya_os_engine.js +0 -574
- package/wasm/kya-os-engine-web/kya_os_engine_bg.wasm +0 -0
- package/wasm/kya-os-engine-web/package.json +0 -7
- /package/wasm/{kya-os-engine → kya-os-engine-bundler}/kya_os_engine.d.ts +0 -0
- /package/wasm/{kya-os-engine-web → kya-os-engine-bundler}/kya_os_engine_bg.wasm.d.ts +0 -0
package/dist/orchestrator.d.ts
CHANGED
|
@@ -1,8 +1,218 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { BuildAgentRequestOpts, RenderedResponse, buildAgentRequest, extractAgentDid, extractCredentialStatusUrl, extractIssuer, hasMalformedJwsBody, makeVerifyRequest, renderDecisionAsResponse, verifyRequest } from './orchestrator-node.js';
|
|
3
|
-
import { V as VerifyResult } from './types-ByrdPLL2.js';
|
|
1
|
+
import { d as DidDocument, D as Decision, E as EnforcementMode, A as AgentRequest, C as ContextSpec, V as VerifyResult, e as EngineConfig } from './types-C3RniIOM.js';
|
|
4
2
|
import '@kya-os/checkpoint-shared';
|
|
5
3
|
|
|
4
|
+
/**
|
|
5
|
+
* DidResolver adapter — sub-phase B.1.
|
|
6
|
+
*
|
|
7
|
+
* Resolves `did:key:*` (in-memory multibase decode) and `did:web:*`
|
|
8
|
+
* (HTTPS fetch of `.well-known/did.json`) into the engine's
|
|
9
|
+
* `DidDocument` shape. The async half does any required I/O; the
|
|
10
|
+
* adapter's output is plain data that the host wrapper bundles into
|
|
11
|
+
* `ContextSpec.didDocs` before calling `engineVerify`.
|
|
12
|
+
*
|
|
13
|
+
* Phase 1 supports only Ed25519 verification methods (the engine's
|
|
14
|
+
* `KeyType` is `#[non_exhaustive]` with `Ed25519` as its single
|
|
15
|
+
* variant). Non-Ed25519 methods on a resolved doc are silently
|
|
16
|
+
* filtered out — the engine wouldn't accept them as a valid Stage 2
|
|
17
|
+
* key match anyway.
|
|
18
|
+
*
|
|
19
|
+
* **`kid` for `did:key`**: the verification-method id is
|
|
20
|
+
* `<did>#<multibase>` per mcp-i-core PR #16. **NOT** `<did>#keys-1`.
|
|
21
|
+
* H-1's `stage2_did_key_fragment_resolution` test pins this.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
interface DidResolverAdapter {
|
|
25
|
+
resolve(did: string): Promise<DidDocument>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
interface StatusListCacheAdapter {
|
|
29
|
+
/**
|
|
30
|
+
* Fetch the status list at `url`, decode it, and return the sorted
|
|
31
|
+
* set of revoked credential indices.
|
|
32
|
+
*
|
|
33
|
+
* @throws {StatusListUnavailable} on transport / non-2xx response.
|
|
34
|
+
* @throws {StatusListTimeout} when the fetch budget is exceeded.
|
|
35
|
+
* @throws {MalformedStatusList} when the VC is unparseable.
|
|
36
|
+
*/
|
|
37
|
+
fetch(url: string): Promise<number[]>;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* ReputationOracle adapter — sub-phase B.3.
|
|
42
|
+
*
|
|
43
|
+
* Resolves a per-DID reputation score in `[0.0, 1.0]`. Phase 1 wires
|
|
44
|
+
* an optional HTTP endpoint (Argus). Unavailable / misconfigured /
|
|
45
|
+
* out-of-range responses degrade to a baseline score so infrastructure
|
|
46
|
+
* blips can't silently DOS Adobe-class traffic. The engine's Stage 6
|
|
47
|
+
* compares the returned score against the tenant-configured threshold
|
|
48
|
+
* (Phase B.4 builds the threshold via `PolicyEvaluator`).
|
|
49
|
+
*
|
|
50
|
+
* **Degrade-to-trust** (Phase B § 4.5). Reputation is best-effort;
|
|
51
|
+
* Argus outages do not block traffic. The adapter returns the
|
|
52
|
+
* configured baseline (default 1.0 = "no signal, treat as trusted")
|
|
53
|
+
* and logs loudly. The engine's `LowReputation` block fires only
|
|
54
|
+
* when score < threshold from tenant policy; baseline-1.0 ensures
|
|
55
|
+
* no traffic is silently rejected just because Argus went down.
|
|
56
|
+
*/
|
|
57
|
+
interface ReputationOracleAdapter {
|
|
58
|
+
/**
|
|
59
|
+
* Return the agent's reputation in `[0.0, 1.0]`. Higher is better.
|
|
60
|
+
*
|
|
61
|
+
* **Does not throw.** Network / parse / range failures degrade to
|
|
62
|
+
* the baseline + log; the engine should never see a thrown error
|
|
63
|
+
* from this adapter.
|
|
64
|
+
*/
|
|
65
|
+
score(agentDid: string): Promise<number>;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* PolicyEvaluator adapter — sub-phase B.4.
|
|
70
|
+
*
|
|
71
|
+
* Computes the **tenant verdict** on the JS side and hands the engine
|
|
72
|
+
* a constant `Decision` for the WASM `WasmConstantPolicy` to echo as
|
|
73
|
+
* Stage 7's contribution. The engine's cross-stage priority order
|
|
74
|
+
* (locked in D-design § 6 row 4) handles how Stage 7 interacts with
|
|
75
|
+
* Stages 2 / 3 / 4 / 5.
|
|
76
|
+
*
|
|
77
|
+
* **Sync-engine / async-host invariant.** The JS adapter is async (it
|
|
78
|
+
* fetches tenant policy from the Checkpoint dashboard); the engine
|
|
79
|
+
* sees only the resolved `Decision`. Cedar-1 will replace this
|
|
80
|
+
* adapter's implementation without touching the surrounding orchestrator.
|
|
81
|
+
*
|
|
82
|
+
* **Cedar-1 forward-compat.** [`PolicyEvaluatorAdapter`] is the
|
|
83
|
+
* Cedar-swappable interface: `(input) → Decision`. The Phase 1 stub
|
|
84
|
+
* is a reputation-threshold check; Cedar-1 will replace the
|
|
85
|
+
* implementation, not the surface. Don't bake Cedar internals into
|
|
86
|
+
* this seam.
|
|
87
|
+
*
|
|
88
|
+
* **Degrade-to-permit.** Per Phase B § 4.5: when the dashboard policy
|
|
89
|
+
* endpoint is unreachable, fall back to `defaultPolicy` (caller-supplied)
|
|
90
|
+
* or `permit-by-default`. Loud log; no silent block.
|
|
91
|
+
*/
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Pre-fetched inputs the JS host knows before calling the engine.
|
|
95
|
+
* Phase 1's evaluator only consumes `reputation` + `tenantHost`; later
|
|
96
|
+
* implementations (Cedar-1) may extend.
|
|
97
|
+
*/
|
|
98
|
+
interface PolicyEvalInput {
|
|
99
|
+
tenantHost: string;
|
|
100
|
+
reputation: number;
|
|
101
|
+
}
|
|
102
|
+
interface PolicyEvaluatorAdapter {
|
|
103
|
+
evaluate(input: PolicyEvalInput): Promise<Decision>;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Clock adapter — sub-phase B.5.
|
|
108
|
+
*
|
|
109
|
+
* Provides the Unix-seconds timestamp the engine's `Clock` trait needs
|
|
110
|
+
* for Stage 4 expiration checks. Trivial; the trait shape exists so
|
|
111
|
+
* tests can inject a frozen clock (and so the engine's sync-trait
|
|
112
|
+
* surface is satisfied without a JS callback crossing the WASM
|
|
113
|
+
* boundary — `ContextSpec.nowUnix` carries the value).
|
|
114
|
+
*/
|
|
115
|
+
interface ClockAdapter {
|
|
116
|
+
nowUnix(): number;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Framework-agnostic HTTP request shape.
|
|
121
|
+
*
|
|
122
|
+
* Next.js / Express / Cloudflare Workers / Hono adapters marshal
|
|
123
|
+
* their native request type into this shape before calling
|
|
124
|
+
* `verifyRequest`. The shape is intentionally minimal — only what
|
|
125
|
+
* the engine needs to make a verdict.
|
|
126
|
+
*/
|
|
127
|
+
interface IncomingHttpLike {
|
|
128
|
+
method: string;
|
|
129
|
+
/** Path + query string (no scheme + host). */
|
|
130
|
+
url: string;
|
|
131
|
+
headers: Record<string, string | string[] | undefined>;
|
|
132
|
+
/**
|
|
133
|
+
* Parsed body if the framework has already parsed it (Next.js
|
|
134
|
+
* with `await req.json()`, Express with `body-parser`). Falsy if
|
|
135
|
+
* the caller hasn't materialised the body — the orchestrator
|
|
136
|
+
* treats that as "no MCP-I envelope present" and routes to
|
|
137
|
+
* PlainHttp.
|
|
138
|
+
*/
|
|
139
|
+
body?: Buffer | string | object | null;
|
|
140
|
+
/** Client IP if the framework surfaces one (Express `req.ip`). */
|
|
141
|
+
remoteAddress?: string;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Options the host wrapper passes per-`verifyRequest`-construction.
|
|
145
|
+
* The five adapters + clock + tenant identifier + enforcement mode.
|
|
146
|
+
*/
|
|
147
|
+
interface VerifyRequestOpts {
|
|
148
|
+
didResolver: DidResolverAdapter;
|
|
149
|
+
statusListCache: StatusListCacheAdapter;
|
|
150
|
+
reputationOracle: ReputationOracleAdapter;
|
|
151
|
+
policyEvaluator: PolicyEvaluatorAdapter;
|
|
152
|
+
clock: ClockAdapter;
|
|
153
|
+
/** Tenant identifier — the host customer this request targets. */
|
|
154
|
+
tenantHost: string;
|
|
155
|
+
enforcementMode: EnforcementMode;
|
|
156
|
+
/** Returned to the PolicyEvaluator when the request has no agent DID. Default 1.0. */
|
|
157
|
+
reputationBaseline?: number;
|
|
158
|
+
/**
|
|
159
|
+
* **Envelope-1 (#2537) coordination flag.** Pre-Envelope-1 the TS
|
|
160
|
+
* bouncer ships MCP-I proofs as `{protected,payload,signature}` JSON
|
|
161
|
+
* in a `KYA-Delegation` header. Post-Envelope-1 they ship compact
|
|
162
|
+
* JWS in `_meta.proof.jws` of the body. When this flag is true the
|
|
163
|
+
* orchestrator also accepts the legacy header form. **Default off.**
|
|
164
|
+
* Delete this flag once Envelope-1 ships end-to-end.
|
|
165
|
+
*/
|
|
166
|
+
legacyEnvelopeFallback?: boolean;
|
|
167
|
+
/**
|
|
168
|
+
* Argus URL — passed only so the orchestrator can detect "Argus
|
|
169
|
+
* not configured" at construction time and log the one-shot
|
|
170
|
+
* warning. The actual reputation fetch goes through `reputationOracle`.
|
|
171
|
+
*/
|
|
172
|
+
argusUrl?: string;
|
|
173
|
+
/** Injectable for the once-only Argus configuration warning. */
|
|
174
|
+
logger?: (msg: string) => void;
|
|
175
|
+
/**
|
|
176
|
+
* Override the engine WASM-bridge function used during the sync
|
|
177
|
+
* `verify()` call. Defaults to the wasm-bindgen `--target bundler`
|
|
178
|
+
* variant imported by `./verify-request.ts` from `'../index'`.
|
|
179
|
+
*
|
|
180
|
+
* The `./orchestrator/node` subpath (SDK-Next.js-Integration-Audit-1
|
|
181
|
+
* / #2618 safety net) injects the `--target nodejs` variant here so
|
|
182
|
+
* Webpack-without-asyncWebAssembly consumers don't transitively pull
|
|
183
|
+
* the bundler artifact through the orchestrator's verify call.
|
|
184
|
+
*/
|
|
185
|
+
engineVerifyFn?: (input: AgentRequest, ctx: ContextSpec) => VerifyResult;
|
|
186
|
+
/**
|
|
187
|
+
* Engine-default behaviour knobs forwarded onto every composed
|
|
188
|
+
* `ContextSpec`. Defaults to `{ tier3Action: 'monitor' }` so a host
|
|
189
|
+
* installing `@kya-os/checkpoint-*` with minimal config preserves
|
|
190
|
+
* 1.3.0 behaviour — tenant policy is the arbiter, the engine does
|
|
191
|
+
* not short-circuit known-agent UAs with an engine-default Block.
|
|
192
|
+
*
|
|
193
|
+
* Host wrappers that want the calibrated engine-default block opt
|
|
194
|
+
* into `{ tier3Action: 'block' }`. The bench harness is the
|
|
195
|
+
* canonical opt-in consumer. See the wasm-runtime 1.4.0 CHANGELOG.
|
|
196
|
+
*/
|
|
197
|
+
engineConfig?: EngineConfig;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Transport-agnostic response shape `renderDecisionAsResponse`
|
|
201
|
+
* produces. Host wrappers adapt this to their framework's response
|
|
202
|
+
* type (NextResponse / Express `res` / Cloudflare Response).
|
|
203
|
+
*
|
|
204
|
+
* `status === null` means "pass through" — the request continues to
|
|
205
|
+
* the next handler. Happens in two cases:
|
|
206
|
+
* 1. `Decision::Permit` (no block in Enforce mode).
|
|
207
|
+
* 2. **Any verdict in Observe mode** — Observe never blocks, but
|
|
208
|
+
* the response headers still carry the would-have-been verdict.
|
|
209
|
+
*/
|
|
210
|
+
interface RenderedResponse {
|
|
211
|
+
status: number | null;
|
|
212
|
+
headers: Record<string, string>;
|
|
213
|
+
body?: string | object;
|
|
214
|
+
}
|
|
215
|
+
|
|
6
216
|
/**
|
|
7
217
|
* `kya-os-engine` WASM bridge for edge runtimes — Edge-WASM-1.
|
|
8
218
|
*
|
|
@@ -43,6 +253,121 @@ import '@kya-os/checkpoint-shared';
|
|
|
43
253
|
*/
|
|
44
254
|
declare function initEngineEdge(moduleOrPath?: WebAssembly.Module | URL | string | Request | BufferSource): Promise<void>;
|
|
45
255
|
|
|
256
|
+
/**
|
|
257
|
+
* HTTP-to-`AgentRequest` translator — Phase C.1.
|
|
258
|
+
*
|
|
259
|
+
* Detects which engine protocol the request belongs to and builds
|
|
260
|
+
* the typed `AgentRequest` the WASM consumes. Conservative
|
|
261
|
+
* detection: never escalates an ambiguous request into a higher
|
|
262
|
+
* verification tier. Anonymous PlainHttp is the default.
|
|
263
|
+
*
|
|
264
|
+
* **What this layer parses and what it doesn't.** It parses *only
|
|
265
|
+
* what's needed to drive conditional pre-fetch* — header presence,
|
|
266
|
+
* the MCP-I envelope's payload segment (to extract `iss` + `sub` +
|
|
267
|
+
* optional credentialStatus URL). It does **not** verify
|
|
268
|
+
* signatures, decode VC chains for revocation bits, or evaluate
|
|
269
|
+
* scope. Those live in the engine (H-1's parser + Stages 2-5).
|
|
270
|
+
*
|
|
271
|
+
* **Buffer-portability note.** This module uses `Buffer.from(...)` and
|
|
272
|
+
* `Buffer.isBuffer(...)` at multiple call sites (the JWS preflight
|
|
273
|
+
* `hasMalformedJwsBody`, both `tryBuildMcpIFromBody` variants, the
|
|
274
|
+
* legacy-header reconstitution path, and `bodyAsBytes`). All of these
|
|
275
|
+
* assume the Node `Buffer` global is available — provided natively by
|
|
276
|
+
* the Node runtime, polyfilled on Vercel Edge, and gated behind
|
|
277
|
+
* `nodejs_compat` on Cloudflare Workers. Bare-Edge and pure-browser
|
|
278
|
+
* embedders would need a `Buffer` polyfill or a refactor to
|
|
279
|
+
* `TextEncoder` / `Uint8Array.from`. Tracked as a follow-up since
|
|
280
|
+
* Phase D's Vercel Node + Vercel Edge targets are both covered today.
|
|
281
|
+
*/
|
|
282
|
+
|
|
283
|
+
interface BuildAgentRequestOpts {
|
|
284
|
+
/** See `VerifyRequestOpts.legacyEnvelopeFallback`. */
|
|
285
|
+
legacyEnvelopeFallback?: boolean;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Translate an HTTP-like request into the engine's `AgentRequest`.
|
|
289
|
+
*
|
|
290
|
+
* Detection order (conservative — never escalate ambiguous input):
|
|
291
|
+
* 1. MCP-I L2 detached proof in `_meta.proof.jws` (spec form).
|
|
292
|
+
* 2. (Legacy, opt-in) MCP-I in `KYA-Delegation` header
|
|
293
|
+
* (Envelope-1 #2537 transition window only).
|
|
294
|
+
* 3. RFC 9421 HTTP Message Signatures (`Signature-Input` header).
|
|
295
|
+
* 4. PlainHttp (default — anonymous traffic).
|
|
296
|
+
*/
|
|
297
|
+
declare function buildAgentRequest(req: IncomingHttpLike, opts?: BuildAgentRequestOpts): AgentRequest;
|
|
298
|
+
/**
|
|
299
|
+
* Preflight check — does the request body carry a `_meta.proof.jws`
|
|
300
|
+
* string that `parseJwsPayloadStruct` cannot project into a typed
|
|
301
|
+
* `McpIPayload`?
|
|
302
|
+
*
|
|
303
|
+
* The caller declared intent (an MCP-I envelope) by including the
|
|
304
|
+
* JWS field; structural failure to extract the payload means the
|
|
305
|
+
* envelope is malformed, not absent. Without this preflight, the
|
|
306
|
+
* orchestrator would silently fall through to PlainHttp — pre-#2560
|
|
307
|
+
* that happened to also Block (engine returned `Block(ParseError)`
|
|
308
|
+
* for every PlainHttp), so the regression was invisible; post-#2560
|
|
309
|
+
* the engine's Stage 1 + stub policy returns `Permit` for anonymous
|
|
310
|
+
* PlainHttp and tampered envelopes would be silently accepted.
|
|
311
|
+
*
|
|
312
|
+
* Returns `true` when the orchestrator should synthesize
|
|
313
|
+
* `Block(ParseError)` BEFORE calling `buildAgentRequest`.
|
|
314
|
+
*/
|
|
315
|
+
declare function hasMalformedJwsBody(req: IncomingHttpLike): boolean;
|
|
316
|
+
/**
|
|
317
|
+
* Issuer DID — Stage 1 (identity resolution) targets this. `null`
|
|
318
|
+
* for PlainHttp (anonymous → no DID to resolve).
|
|
319
|
+
*/
|
|
320
|
+
declare function extractIssuer(request: AgentRequest): string | null;
|
|
321
|
+
/**
|
|
322
|
+
* Agent DID — used by ReputationOracle. Defaults to `payload.sub`
|
|
323
|
+
* for MCP-I (subject = the agent the proof is *about*).
|
|
324
|
+
*/
|
|
325
|
+
declare function extractAgentDid(request: AgentRequest): string | null;
|
|
326
|
+
/**
|
|
327
|
+
* Status-list URL for revocation pre-fetch. Pulled from the JWS
|
|
328
|
+
* payload's `vc.credentialStatus.id` (W3C VC Data Model 1.1).
|
|
329
|
+
* `null` when the envelope is L1 (no VC chain) — Stage 3 will skip.
|
|
330
|
+
*/
|
|
331
|
+
declare function extractCredentialStatusUrl(request: AgentRequest): string | null;
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* Transport-agnostic `Decision` → HTTP renderer — Phase C.3.
|
|
335
|
+
*
|
|
336
|
+
* Translates a `VerifyResult` into a framework-neutral
|
|
337
|
+
* `{ status, headers, body }` shape. Phase D (Next.js) adapts this
|
|
338
|
+
* to `NextResponse`; Phase E (Express) adapts it to `res.status().set().send()`.
|
|
339
|
+
* One source of truth for the verdict→HTTP mapping.
|
|
340
|
+
*
|
|
341
|
+
* Mapping table (§ 4.5 of Phase C kickoff):
|
|
342
|
+
*
|
|
343
|
+
* | Decision | HTTP | Notes |
|
|
344
|
+
* |-----------------------------------|------|-----------------------------------------|
|
|
345
|
+
* | Permit | null | Pass through to next handler |
|
|
346
|
+
* | Block(Unauthenticated) | 401 | WWW-Authenticate header |
|
|
347
|
+
* | Block(InvalidSignature) | 403 | |
|
|
348
|
+
* | Block(Revoked) | 403 | |
|
|
349
|
+
* | Block(Expired) | 401 | Refresh-the-credential semantics |
|
|
350
|
+
* | Block(OutOfScope) | 403 | Body carries requested + granted |
|
|
351
|
+
* | Block(LowReputation) | 403 | Body carries score + threshold |
|
|
352
|
+
* | Block(PolicyDenied) | 403 | Body carries detail |
|
|
353
|
+
* | Block(ParseError) | 400 | Body carries detail |
|
|
354
|
+
* | Block(AgentAttribution) | 403 | Body carries vendor + tier + confidence |
|
|
355
|
+
* | Block(Tier3UAMatch) | 403 | Body carries pattern_id + kind + conf |
|
|
356
|
+
* | Challenge | 401 | Body carries ChallengeParams |
|
|
357
|
+
* | Redirect | 302 | Location header |
|
|
358
|
+
* | Instruct | 422 | application/problem+json body |
|
|
359
|
+
*
|
|
360
|
+
* Observe mode overrides: every verdict renders as `status: null`
|
|
361
|
+
* (pass through) with an `X-Checkpoint-Would-Have-Been` header
|
|
362
|
+
* carrying the verdict kind, plus the standard attribution headers.
|
|
363
|
+
*
|
|
364
|
+
* Every response carries the Phase 0.1 attribution headers:
|
|
365
|
+
* `X-Checkpoint-Engine`, `X-Checkpoint-Engine-Version`, and
|
|
366
|
+
* (when present) `X-Checkpoint-Ruleset-Hash`.
|
|
367
|
+
*/
|
|
368
|
+
|
|
369
|
+
declare function renderDecisionAsResponse(result: VerifyResult): RenderedResponse;
|
|
370
|
+
|
|
46
371
|
/**
|
|
47
372
|
* `verifyRequestEdge` async-init orchestrator — Edge-WASM-2 (folded into
|
|
48
373
|
* Phase D's PR).
|
|
@@ -84,4 +409,33 @@ declare function makeVerifyRequestEdge(opts: VerifyRequestOpts): (req: IncomingH
|
|
|
84
409
|
*/
|
|
85
410
|
declare function verifyRequestEdge(req: IncomingHttpLike, opts: VerifyRequestOpts): Promise<VerifyResult>;
|
|
86
411
|
|
|
87
|
-
|
|
412
|
+
/**
|
|
413
|
+
* Phase C + Edge-WASM-2 orchestrator barrel.
|
|
414
|
+
*
|
|
415
|
+
* The async entry point Phase D / E / future host wrappers compose.
|
|
416
|
+
* Subpath: `@kya-os/checkpoint-wasm-runtime/orchestrator`.
|
|
417
|
+
*
|
|
418
|
+
* Two variants:
|
|
419
|
+
*
|
|
420
|
+
* - **Node** — sync engine via `engineVerify`. Use under Vercel Node-
|
|
421
|
+
* runtime / serverless functions / long-lived Node servers. Exported:
|
|
422
|
+
* `verifyRequest`, `makeVerifyRequest`.
|
|
423
|
+
*
|
|
424
|
+
* - **Edge** — async-init engine via `engineVerifyEdge`. Use under
|
|
425
|
+
* Vercel Edge runtime / Cloudflare Workers / browser embedding.
|
|
426
|
+
* Exported: `verifyRequestEdge`, `makeVerifyRequestEdge`,
|
|
427
|
+
* `initEngineEdge`. The `edge-runtime` + `browser` conditions on
|
|
428
|
+
* the `./orchestrator` subpath automatically route to this variant
|
|
429
|
+
* for edge bundlers; consumers can also import explicitly from
|
|
430
|
+
* `./orchestrator/edge`.
|
|
431
|
+
*
|
|
432
|
+
* The cross-target parity test in [[__tests__/verify-request-parity.test.ts]]
|
|
433
|
+
* pins the verdict-equivalence invariant: both variants produce
|
|
434
|
+
* identical `VerifyResult.decision` on identical inputs. Any change
|
|
435
|
+
* to `verify-request.ts` MUST be mirrored in `verify-request-edge.ts`
|
|
436
|
+
* (see the doc-comment header on both files).
|
|
437
|
+
*/
|
|
438
|
+
declare const verifyRequest: (req: IncomingHttpLike, opts: VerifyRequestOpts) => Promise<VerifyResult>;
|
|
439
|
+
declare const makeVerifyRequest: (opts: VerifyRequestOpts) => (req: IncomingHttpLike) => Promise<VerifyResult>;
|
|
440
|
+
|
|
441
|
+
export { type BuildAgentRequestOpts, type IncomingHttpLike, type RenderedResponse, type VerifyRequestOpts, buildAgentRequest, extractAgentDid, extractCredentialStatusUrl, extractIssuer, hasMalformedJwsBody, initEngineEdge, makeVerifyRequest, makeVerifyRequestEdge, renderDecisionAsResponse, verifyRequest, verifyRequestEdge };
|