import { i as AdoptedVendorKeys, pt as VerifyResult, s as AgentRequest, ut as VendorKeyMiss, w as EngineWasmSource } from "./types-BZXvyqcb.js"; import { o as EngineRenderOptions } from "./render-types-Cfuz3soS.js"; import { f as IncomingHttpLike, h as ResolutionWarmerEngine, m as VerifyRequestOpts, p as RenderedResponse, r as VendorKeyEdgeOptions } from "./feed-CbaIEv3h.js"; import { HeaderEntry } from "@kya-os/checkpoint-shared"; import "@kya-os/checkpoint-shared/host-adapter"; //#region src/engine/orchestrator/render-engine.d.ts /** Per-request host settings for {@link makeRenderDecision}'s renderer. */ type RenderDecisionOptions = EngineRenderOptions; /** The renderer the host adapters call. */ type RenderDecision = (result: VerifyResult, options?: RenderDecisionOptions) => RenderedResponse; //#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`. */ export declare function initEngineEdge(wasmModule?: EngineWasmSource): Promise; //#endregion //#region src/engine/orchestrator/build-agent-request.d.ts interface BuildAgentRequestOpts { /** See `VerifyRequestOpts.legacyEnvelopeFallback`. */ legacyEnvelopeFallback?: boolean; } interface CredentialStatusRef { /** URL the host should fetch from the StatusList cache. */ fetchUrl: string; /** Exact key the engine will query in `ContextSpec.revoked`. */ mapUrl: string; /** * The issuer of the credential carrying the status entry: the list must be * signed by it. Null when the credential names none (the list then fails * closed). */ issuer: string | null; /** * The credential's `statusListIndex`, or null when it is not a * non-negative integer. An index outside the list fails closed. */ index: number | null; } /** * The `iss` a presented DelegationCredential names, read before any signature * check. Null when the credential has no string `iss`. */ interface DelegationIssuerRef { issuer: string | null; } interface BearerDelegationCredentialRef extends DelegationIssuerRef { /** The compact VC-JWT presented as a standalone bearer delegation. */ credential: string; /** Decoded JWT payload claims. Signature verification happens in the engine. */ claims: Record; agentDid: string | null; credentialStatus: CredentialStatusRef | null; } /** * Translate an HTTP-like request into the engine's `AgentRequest`. * * Detection order (conservative — never escalate ambiguous input): * 1. KYA-OS L2 detached proof in `_meta.proof.jws` (spec form). * 2. (Legacy, opt-in) KYA-OS in `KYA-Delegation` header * (Envelope-1 #2537 transition window only). * 3. RFC 9421 HTTP Message Signatures (`Signature-Input` header). * 4. PlainHttp (default — anonymous traffic). */ export declare function buildAgentRequest(req: IncomingHttpLike, opts?: BuildAgentRequestOpts): AgentRequest; /** * Preflight check — does the request body carry a `_meta.proof.jws` * string that `parseJwsPayloadStruct` cannot project into a typed * `McpIPayload`? * * The caller declared intent (an KYA-OS envelope) by including the * JWS field; structural failure to extract the payload means the * envelope is malformed, not absent. Without this preflight, the * orchestrator would silently fall through to PlainHttp — pre-#2560 * that happened to also Block (engine returned `Block(ParseError)` * for every PlainHttp), so the regression was invisible; post-#2560 * the engine's Stage 1 + stub policy returns `Permit` for anonymous * PlainHttp and tampered envelopes would be silently accepted. * * Returns `true` when the orchestrator should synthesize * `Block(ParseError)` BEFORE calling `buildAgentRequest`. */ export declare function hasMalformedJwsBody(req: IncomingHttpLike): boolean; /** * Issuer DID — Stage 1 (identity resolution) targets this. `null` * for PlainHttp (anonymous → no DID to resolve) and for an McpI envelope, * which the engine refuses without resolving anything. * * For `HttpSigned`, this is the KYA HTTP Binding `kya=` signature's base * DID (see [[extractKyaHttpDid]]) — the #3362 gap this closes: without a * pre-fetched `did_doc`, the engine cannot resolve the `keyid` and blocks * a validly-signed request with `kyaos/did-unresolvable`. * A generic RFC 9421 signature (e.g. ChatGPT's `sig1=` profile) has no * `kya` label and stays `null` here, unaffected. */ export declare function extractIssuer(request: AgentRequest): string | null; /** * Agent DID — used by ReputationOracle. For `HttpSigned`, the KYA signer IS * the subject (no separate `sub` claim on a bare L1 signature), so this * returns the same DID as [[extractIssuer]]. `null` otherwise. */ export declare function extractAgentDid(request: AgentRequest): string | null; /** * Standalone draft-kya-http bearer delegation (`Authorization: Bearer `) * plus its explicit fallback header (`KYA-Delegation`). This intentionally does * NOT consume `KYA-OS-Delegation-Credential` when the request is RFC-9421 signed; * that path must stay on `HttpSigned` so holder binding is verified. */ export declare function extractBearerDelegationCredential(req: IncomingHttpLike): BearerDelegationCredentialRef | null; //#endregion //#region src/engine/orchestrator/verify-request-edge.d.ts type VerifyRequestEdgeOpts = VerifyRequestOpts & VendorKeyEdgeOptions; export declare function vendorKeysEdge(options?: VendorKeyEdgeOptions): Promise; export declare function reportVendorKeyMissEdge(miss: VendorKeyMiss, options?: VendorKeyEdgeOptions): Promise; /** * Factory — constructs a `verifyRequestEdge` closure that remembers the * one-shot Argus-not-configured warning state. Use this when the * host wrapper wants the startup log; call `verifyRequestEdge` directly * (the loose function below) if you don't. */ export declare function makeVerifyRequestEdge(opts: VerifyRequestEdgeOpts): (req: IncomingHttpLike) => Promise; /** * Single-shot async entry. Use [`makeVerifyRequestEdge`] in long-lived * hosts (so the Argus warning is one-shot per process); use this * loose form in tests + one-off invocations. */ export declare function verifyRequestEdge(req: IncomingHttpLike, opts: VerifyRequestEdgeOpts): Promise; //#endregion //#region src/engine/orchestrator/index.d.ts export declare const verifyRequest: (req: IncomingHttpLike, opts: VerifyRequestOpts) => Promise; export declare const makeVerifyRequest: (opts: VerifyRequestOpts) => (req: IncomingHttpLike) => Promise; /** Render a `VerifyResult` as the kya-os/http answer, in the bundler-target engine. */ export declare const renderDecisionAsResponse: RenderDecision; /** * The engine calls a resolution warmer makes (`makeResolutionWarmer`), on the * same engine instance `verifyRequest` uses. */ export declare const resolutionEngine: ResolutionWarmerEngine; /** * Warm the engine now if the after-import warm-up has not run yet, so a host * that awaits this at startup serves its first request from a warm engine. * `wasmModule` is ignored (the edge build needs it on Cloudflare Workers). It * exists so every `./orchestrator` build exports the same `initEngine`, and a * host can warm the engine without knowing which build its runtime resolved. */ export declare function initEngine(_wasmModule?: EngineWasmSource): Promise; //#endregion export type { BearerDelegationCredentialRef, BuildAgentRequestOpts, EngineWasmSource, IncomingHttpLike, RenderedResponse, VerifyRequestOpts }; //# sourceMappingURL=orchestrator.d.ts.map