import { B as RootNeedsResult, C as FeedAttemptOutcome, G as RuleBundleReport, S as EngineWasmSource, et as VendorKeyFeedStatus, h as DelegationVerifyInput, i as AdoptedVendorKeys, it as VerifyResult, nt as VendorKeyMissReason, o as AgentRequest, p as ContextSpec, w as FeedDemandReason, x as EngineInfo } from "./types-BVx5XvPN.js"; import { t as StatusListVerification } from "./status-list-cache-C-fmbUlJ.js"; import { ChallengeWireErrorCode, ChallengeWireInput } from "@kya-os/checkpoint-shared"; //#region src/engine/render-types.d.ts /** Per-request host settings for the engine renderer. */ interface EngineRenderOptions { /** Serve the body-readable HTTP 200 for Challenge / Instruct (negotiated mode). */ bodyReadable200?: boolean; /** Registered context for a canonical Delegation challenge. */ delegationChallenge?: ChallengeWireInput; /** The host tried to resolve registered context and got none. */ challengeContextRequested?: boolean; } /** The rendered answer. `status: null` passes the request through. */ interface EngineRenderedResponse { status: number | null; /** Ordered `[name, value]` pairs, applied in order. Names may repeat. */ headers: [name: string, value: string][]; body?: unknown; } /** The TS challenge-wire codes plus `invalid-input` for an unparseable input. */ type EngineRenderErrorCode = ChallengeWireErrorCode | 'invalid-input'; /** What every binding returns. */ interface EngineRenderEnvelope { success: boolean; result?: EngineRenderedResponse; error?: { code: EngineRenderErrorCode; message: string; }; } /** One control the engine enforces, and the engine version it arrived in. */ interface EngineCapability { id: string; since: string; } /** The engine's self-description: attribution stamp plus capabilities. */ interface EngineManifest { manifestVersion: number; engine: EngineInfo; capabilities: EngineCapability[]; } /** A typed render failure, with the same codes as `ChallengeWireError`. */ declare class EngineRenderError extends TypeError { readonly code: EngineRenderErrorCode; constructor(code: EngineRenderErrorCode, message: string); } //#endregion //#region src/engine/edge.d.ts /** * Initialise the edge wasm module. Idempotent โ€” subsequent calls * return the same in-flight or resolved promise. Host wrappers * should call this once at startup with the `wasmModule` they * statically imported from the package's `./wasm/kya-os-engine-web/` * subpath (see CLAUDE.md for the wrangler/webpack import pattern). * * @param wasmModule The engine module the host imported * (`./wasm/kya-os-engine-web/kya_os_engine_bg.wasm`). * Required on the first call, on every runtime. Which * module an attempt uses: * - the first one given; * - a different one only after an attempt failed, so a * host can replace a bad module; never while an * attempt is pending or after one succeeded; * - after a failure, the module that failed, when the * retry passes none (`verifyRequestEdge` calls * `initEngineEdge()` itself), so one transient * failure is not permanent. * With no module ever given it rejects with * `WasmModuleNotRegisteredError`. */ declare function initEngineEdge(wasmModule?: EngineWasmSource): Promise; /** * The engine's cedar-web glue, initialised, when the engine runs on the * cedar-web module (or would, once it starts): the edge Cedar evaluator then * uses this one instance instead of instantiating its own. `null` when the * engine runs on the engine-web module. */ declare function edgeEngineCedarGlue(): Promise | null; /** * Edge-runtime async equivalent of `engineVerify`. * * Identical contract (typed `AgentRequest` + `ContextSpec` in, * typed `VerifyResult` out) โ€” only the return type changes from * `VerifyResult` to `Promise` because the underlying * wasm artifact is loaded async on this target. * * @throws If `engineVerify` rejects the input (deserialisation * failure) or the engine returns a `VerifyError`. Verdicts * surface inside the returned `VerifyResult`, not as throws. */ declare function engineVerifyEdge(input: AgentRequest, ctx: ContextSpec): Promise; /** * Edge-runtime async equivalent of `engineVerifyDelegation` โ€” the standalone * Layer-2-only (`Authorization: Bearer `) path, * `draft-kya-http-02` ยง4.3. Same contract as the bundler/node entries, only * the return type is `Promise` (the wasm artifact loads async on * this target). The resource server's own org DID rides on `ctx.resourceOrgDid`. */ declare function engineVerifyDelegationEdge(input: DelegationVerifyInput, ctx: ContextSpec): Promise; /** * Edge-runtime async equivalent of `engineRender`: the kya-os/http answer, * rendered in the engine. Same output as the bundler and Node entries. * * @throws {EngineRenderError} when the registered challenge context fails * validation. */ declare function engineRenderEdge(result: VerifyResult, options?: EngineRenderOptions): Promise; /** * Edge-runtime async equivalent of `engineVerifyStatusList`: verify a fetched * status list against its issuer's DID document. Never rejects for a bad * list; a rejection is `{ ok: false, code, message }`. */ /** The trusted roots' DID-document needs (`rootNeeds`), on the edge engine. Never throws. */ declare function engineRootNeedsEdge(contextJson: string): Promise; declare function engineVerifyStatusListEdge(requestJson: string): Promise; /** Edge-runtime async equivalent of `engineInfo`: the capability manifest. */ declare function engineInfoEdge(): Promise; declare function engineApplyRuleBundleEdge(bundleJson: string, nowUnix: number): Promise; declare function engineFeedDemandEdge(nowUnix: number): Promise; declare function engineFeedAttemptFinishedEdge(outcome: FeedAttemptOutcome): Promise; declare function engineFeedStatusEdge(nowUnix: number): Promise; declare function engineFeedNoteMissEdge(keyid: string, reason: VendorKeyMissReason): Promise; declare function engineVendorKeysEdge(): Promise; //#endregion export { EngineRenderEnvelope as _, engineFeedNoteMissEdge as a, EngineRenderOptions as b, engineRenderEdge as c, engineVerifyDelegationEdge as d, engineVerifyEdge as f, EngineManifest as g, EngineCapability as h, engineFeedDemandEdge as i, engineRootNeedsEdge as l, initEngineEdge as m, engineApplyRuleBundleEdge as n, engineFeedStatusEdge as o, engineVerifyStatusListEdge as p, engineFeedAttemptFinishedEdge as r, engineInfoEdge as s, edgeEngineCedarGlue as t, engineVendorKeysEdge as u, EngineRenderError as v, EngineRenderedResponse as x, EngineRenderErrorCode as y }; //# sourceMappingURL=edge-COZ8dP4b.d.ts.map