/* tslint:disable */ /* eslint-disable */ /** * **Day 3-4 export**: run the selective-recomputation analyzer. * * Takes the JSONL chain + a JSON-serialized [`CorrectionEvent`]. * Returns a [`RecomputationPlan`] serialized as a `JsValue`. The * browser orchestrator renders the partition + lets the visitor * expand any decision to see its `PreservationProof` or * `RecomputationProof` inline. */ export function analyze_correction_event(chain_jsonl: string, correction_json: string): any; /** * **Day 3-4 export**: build the dependency graph from a JSONL chain. * * Returns a [`DependencyGraph`] serialized as a `JsValue` — the JS * side gets a plain object with `nodes: Vec` it can * visualize without further parsing. */ export function compute_dependency_graph(chain_jsonl: string): any; /** * **Day 10 export**: compute the typed savings summary from a * recomputation plan + a per-step cost map. * * `plan_json` is a serialized [`RecomputationPlan`]; `cost_map_json` is * `{ step_id: cost_micro_usd, ... }`. Returns: * ```json * { * "total_steps": N, * "preserved_steps": M, * "recomputed_steps": K, * "preservation_ratio": 0.0..=1.0, * "baseline_cost_micro_usd": sum-of-all-step-costs, * "selective_cost_micro_usd": sum-of-recompute-step-costs, * "naive_restart_cost_micro_usd": 2 × baseline (the modeled "start over" worst case), * "savings_vs_naive_ratio": 1 - selective / naive_restart * } * ``` * * Costs are integer micro-USD (per workspace f64-discipline rule — * money math stays in integers). The ratio is computed as `f64` only * because it's a display-layer value (the page renders `XX.X%`). * * Steps absent from `cost_map` contribute zero — the JS side should * pre-populate every step_id; the missing-key case is a no-op rather * than a hard error so a malformed cost map doesn't blow up the * browser tab. */ export function compute_savings_summary(plan_json: string, cost_map_json: string): any; /** * **The ONE proven IFC decision, surfaced to JS.** Recomputes the * `FlowDeclaration → IfcVerdict` decision over the Denning lattice from * `nucleus-ifc` (whose lattice laws are Lean-proven in `portcullis-core`) — the * SAME `decide()` the production gate runs. `@coproduct_inc/verify`'s DAG-cage * flow check delegates here instead of a TS mirror, so there is one model. * * `input_tokens_json` is a JSON array of declared-input tokens — one of: * `user_prompt`, `web_content`, `tool_response`, `file_read`, `env_var`, * `secret`, `database_row`, `memory_read`, `http_response`. `requires_authority` * = the action needs directive authority; `sink_public` = the sink is publicly * visible. Returns the recomputable `IfcVerdict` (allow/deny + reason). */ export function ifc_decide(input_tokens_json: string, requires_authority: boolean, sink_public: boolean): any; /** * Install a browser-friendly panic hook. The hook routes any wasm-side * `panic!` into `console.error`, which means failed assertions in the * dependency analysis or signature verification path become visible in * the visitor's DevTools instead of an opaque `RuntimeError: unreachable`. * * Idempotent — calling it more than once is harmless. Browsers should * invoke this once on module load. */ export function init(): void; /** * **Day 10 export**: parse a raw Claude Code session JSONL (the format * Claude Code writes under `~/.claude/projects/.../.jsonl`) into * a renderable step list. * * This is the drag-and-drop path: the visitor's browser receives a * session log it didn't sign and runs the dependency analyzer against * it locally. The mapper produces unsigned [`nucleus_lineage::LineageEdge`]s; * `signed = false` is set on the returned [`RenderableChain`] so the UI * can label the source ("unsigned — your local session" vs. "signed * corpus from coproduct-opensource/nucleus-recompute-corpus"). * * Source-of-truth: the parse + map logic lives in `claude-code-capture` * (the same code the server-side capture binary uses). One canonical * implementation, shared between native + wasm. */ export function parse_claude_code_session(session_jsonl: string): any; /** * **Day 10 export**: parse a JSONL chain of signed lineage edges into * a renderable step list (one [`RenderableStep`] per edge in chain * order). The orchestrator on the JS side consumes this directly to * render the dependency graph + per-step drawer. * * Wire format: `chain_jsonl` is one `LineageEdge` per line (the same * format `verify_chain_signatures` expects). Signature verification is * NOT performed here — call `verify_chain_signatures` first if the * chain's provenance matters. */ export function parse_lineage_chain(chain_jsonl: string): any; /** * **Offline auction-receipt verifier — the "verify this receipt" * button.** Given a signed `AuctionReceipt` JSON + a pinned JWKS * document, re-build the canonical envelope, re-hash it (BLAKE3), and * Ed25519-verify the signature against the issuer key matched by `kid` * — all in the visitor's tab, with zero hub access. * * Returns a [`ReceiptVerifyReport`] serialized as a `JsValue`: * ```json * { * "ok": true, * "reason": null, * "auction_id": "...", "issuer_kid": "...", "root_hash_hex": "...", * "issued_at_micros": 1717…, "winner_spiffe_id": "spiffe://…", * "clearing_price_micro_usd": 250000, "bid_count": 3 * } * ``` * * Never throws on a bad receipt — `ok = false` with a `reason` string * is the FAIL path (so the page renders PASS/FAIL rather than a thrown * error). A `JsValue` error is only returned if the report itself * can't be serialized, which shouldn't happen. */ export function verify_auction_receipt(receipt_json: string, jwks_json: string): any; /** * **Bet C — the full offline verifier.** Combines the signature + * root-hash check ([`verify_auction_receipt`]) with the local * clearing-price recomputation ([`verify_clearing_recompute`]) into a * single call, so an agent NEVER trusts the hub's price: the wasm * recomputes it locally from the signed bids and asserts equality. * * The drop-in story (`@nucleus/verify`): * ```js * import { verify } from '@nucleus/verify'; * const r = await verify(receiptJson, jwksJson); * if (!r.ok) throw new Error(r.reason); * // r.ok === signature_ok && root_hash_ok && price_recomputed_ok * ``` * * Returns a [`FullVerifyReport`] as a `JsValue`. All prices are `u64` * micro-USD (fit JS `Number` / Python `int`); the kernel's internal * `u128` math never crosses this boundary. */ export function verify_auction_receipt_full(receipt_json: string, jwks_json: string): any; /** * Day-1 entry point. Parses a JSONL chain + a JWKS document and runs * per-edge Ed25519 signature verification. * * Wire format: * - `chain_jsonl`: one signed [`nucleus_lineage::LineageEdge`] per line. * - `jwks_json`: a JSON document with a top-level `{ "keys": [...] }` array, * each entry an Ed25519 JWK. * * Returns a [`VerifyReport`] serialized as a `JsValue` (so the JS side * gets a plain object, not a string it has to re-parse). Errors are * surfaced as `JsValue` strings — wrap with `wasm_bindgen::throw_str` * downstream if richer error types are needed. */ export function verify_chain_signatures(chain_jsonl: string, jwks_json: string): any; /** * **Bet C moat-closer — recompute-only export.** Re-runs the auction * clearing locally from the receipt's signed bid set and reports whether * the recomputed price matches the receipt's claimed price. Does NOT * check the signature — pair with [`verify_auction_receipt`] (or use * [`verify_auction_receipt_full`], which does both). * * Returns a [`recompute::RecomputeReport`] as a `JsValue`: * ```json * { * "recomputed_price_micro_usd": 400000, * "receipt_price_micro_usd": 400000, * "matches_receipt": true, * "path": "vickrey", * "recomputed_winner_spiffe_id": "spiffe://…", * "winner_matches": true, * "pigou_vcg_clearing_micro_usd": null, * "reason": null * } * ``` */ export function verify_clearing_recompute(receipt_json: string): any; /** * **R6 — verify a Proof-Carrying-Authorization certificate in the browser.** * Runs the FULL [`nucleus_policy_cert::verify`]: the Ed25519 signature over the * cert's signing message, then the verbatim recompute (`decide` / * `governance_monotone`) against the carried witness, plus freshness and — when * `expected_context_hex` is supplied — the context binding. No network, no * trust in the emitter; the same check anyone runs offline. * * `cert_json` is a serialized `Certificate`; `now_unix` is the current time for * the freshness check; `expected_context_hex` (optional, 64 hex chars) binds * the cert to a specific context (e.g. a lineage-edge / request hash). * * **`ok` means the certificate VALIDLY CERTIFIES ITS STATED OUTCOME — not that * the request is allowed.** A validly-signed cert for a `Deny` decision returns * `ok:true` with `decision:"deny"`. To gate an *authorization*, check * `ok && decision === "allow"`; to gate a governance *update*, check * `ok && monotone === true`. * * Returns a [`PolicyCertReport`] as a `JsValue`. `Option` fields are serialized * as JS `null` (not `undefined`) so they match the published TS typings. */ export function verify_policy_certificate(cert_json: string, now_unix: bigint, expected_context_hex?: string | null): any; /** * **Day 3-4 export**: independently verify a single * [`PreservationProof`]. * * The browser surfaces this on the demo's "expand any preserved step * to see its proof" affordance. The proof is JSON-serializable; the * WASM call re-runs the structural check and returns `null` on * success or an error string on falsification. */ export function verify_preservation(proof_json: string): void; /** * **Day 3-4 export**: independently verify a single * [`RecomputationProof`]. * * Same shape as [`verify_preservation`] — re-runs the witness-hash * check, returns a `JsValue` error on falsification. */ export function verify_recomputation_necessity(proof_json: string): void;