import type { ScopeOfClaim } from '../../accountability/types/base.js';
export type { ScopeOfClaim } from '../../accountability/types/base.js';
/** Cycles protocol pin. Bump when the upstream protocol revision changes. */
export declare const CYCLES_PROTOCOL_VERSION: "cycles-protocol-v0.1.25";
/** CyclesEvidence schema version this adapter consumes. */
export declare const CYCLES_EVIDENCE_SCHEMA_VERSION: "cycles-evidence/v0.1";
export declare const RAIL_BUDGET_RESERVATION_PERMIT_CLAIM_TYPE: "rail.budget_reservation.permit.v1";
export declare const RAIL_BUDGET_RESERVATION_RELEASE_CLAIM_TYPE: "rail.budget_reservation.release.v1";
export declare const RAIL_BUDGET_RESERVATION_DENIAL_CLAIM_TYPE: "rail.budget_reservation.denial.v1";
export interface CyclesEvidenceRef {
    /** Where to fetch the signed CyclesEvidence envelope. Opaque to APS. */
    cycles_evidence_url: string;
    /** sha256 hex of the JCS-canonical envelope bytes with both
     *  evidence_id and signature emptied. The content-addressed id of
     *  the Cycles-side artifact this receipt binds to. */
    cycles_evidence_id_sha256: string;
    /** APS-side action anchor (mirrors PaymentReceipt.action_ref). */
    action_ref: string;
    /** APS-side delegation anchor (mirrors PaymentReceipt.delegation_ref). */
    delegation_ref: string;
    /** For commit/release receipts: the prior permit-receipt's id, so
     *  the authorization → settlement chain is reconstructable from
     *  evidence alone. Omitted on permit-receipts and standalone denials. */
    prior_permit_receipt_id?: string;
}
/** Cycles `Decision` enum — three-way decision on /decide and reserve. */
export type CyclesDecision = 'ALLOW' | 'ALLOW_WITH_CAPS' | 'DENY';
/** Cycles `ArtifactType` — the five CyclesEvidence lifecycle events. */
export type CyclesArtifactType = 'decide' | 'reserve' | 'commit' | 'release' | 'error';
/** Minimal read-only view of a CyclesEvidence envelope's payload
 *  variants — only the fields the adapter actually reads. The full
 *  envelope schema (signed, content-addressed) lives at the canonical
 *  spec; this mirror exists so the denial-mapper can pattern-match
 *  without a full schema-validation dependency. */
export interface CyclesEvidenceView {
    artifact_type: CyclesArtifactType;
    trace_id?: string;
    payload: {
        decide: {
            response: {
                decision: CyclesDecision;
                reason_code?: string;
            };
        };
    } | {
        reserve: {
            response: {
                decision: CyclesDecision;
                reason_code?: string;
            };
        };
    } | {
        commit: {
            reservation_id: string;
        };
    } | {
        release: {
            reservation_id: string;
        };
    } | {
        error: {
            endpoint: string;
            http_status: number;
            reservation_id?: string;
            response: {
                error: string;
                message: string;
                request_id: string;
                trace_id?: string;
            };
        };
    };
}
/** Snapshot of the delegation-authority state APS saw at admission. */
export interface AuthorityStateSnapshot {
    /** Admission-time ISO 8601 — when APS evaluated this authority state. */
    checked_at: string;
    /** Revocation state APS saw at admission. */
    delegation_revoked: boolean;
    /** Delegation expiry APS saw at admission, when known. */
    delegation_expires_at?: string;
    /** Origin of the snapshot. Fixed for the APS admission path. */
    source: 'aps_admission';
}
/** Signed receipt emitted at reserve-allow. Binds the APS delegation
 *  to a Cycles reservation; references the CyclesEvidence envelope
 *  for the underlying reserve event. */
export interface CyclesPermitReceipt {
    claim_type: typeof RAIL_BUDGET_RESERVATION_PERMIT_CLAIM_TYPE;
    receipt_id: string;
    signer: string;
    agent_id: string;
    delegation_ref: string;
    action_ref: string;
    rail_name: 'cycles';
    /** Cycles reservation_id from the reserve response. */
    reservation_id: string;
    /** Reserved amount in canonical (unit, amount) form. Unit is the
     *  Cycles UnitEnum — USD_MICROCENTS, TOKENS, CREDITS, or RISK_POINTS. */
    reserved: {
        unit: string;
        amount: number;
    };
    /** Cycles decision: ALLOW or ALLOW_WITH_CAPS (DENY rides denial). */
    decision: 'ALLOW' | 'ALLOW_WITH_CAPS';
    /** Reservation TTL deadline (Cycles `expires_at_ms`). */
    expires_at_ms?: number;
    /** Bind to the signed Cycles-side artifact. */
    cycles_evidence: CyclesEvidenceRef;
    issued_at: string;
    /** Hex Ed25519 signature over the canonical receipt body, signature cleared. */
    signature: string;
    /** Phase 4.1 / Q1 accountability fields. */
    timestamp?: string;
    scope_of_claim?: ScopeOfClaim;
    /** Optional (Track B): the authority/revocation/expiry state APS
     *  evaluated at admission, before calling Cycles, carried inline.
     *  Optional so existing fixtures and call sites that omit it stay
     *  valid. */
    authority_state_at_admission?: AuthorityStateSnapshot;
    /** Optional (W2-B1): pointer to the trust-root-policy a producer
     *  evaluated this receipt's issuer against, of the form
     *  `${policy_id}@${policy_version}`. It is a REFERENCE, not an
     *  assurance: a relying party re-derives its own verdict against its
     *  own policy and never reads acceptance off this field. Optional so
     *  existing fixtures and call sites that omit it keep byte-identical
     *  canonical form. */
    trust_policy_ref?: string;
}
/** Signed receipt emitted at release. Symmetric to permit; references
 *  the prior permit-receipt for chain completeness. */
export interface CyclesReleaseReceipt {
    claim_type: typeof RAIL_BUDGET_RESERVATION_RELEASE_CLAIM_TYPE;
    receipt_id: string;
    signer: string;
    agent_id: string;
    delegation_ref: string;
    action_ref: string;
    rail_name: 'cycles';
    reservation_id: string;
    released: {
        unit: string;
        amount: number;
    };
    /** Optional reason from the ReleaseRequest body. */
    reason?: string;
    cycles_evidence: CyclesEvidenceRef;
    issued_at: string;
    signature: string;
    timestamp?: string;
    scope_of_claim?: ScopeOfClaim;
}
/** Closed taxonomy of Cycles-sourced denial reasons (the source axis;
 *  the Tier-1 mapping happens via mapCyclesDenialToFoundation). */
export type CyclesDenialSource = 'ErrorCode' | 'DecisionReasonCode';
/** Cycles-specific denial detail. Lives Tier-2 in the APS denial-
 *  receipt under `cycles.denial_detail` so audit consumers retain the
 *  canonical denial identifier byte-for-byte. */
export interface CyclesDenialDetail {
    layer: 'cycles';
    /** Which Cycles axis surfaced the denial — see mapping doc. */
    source: CyclesDenialSource;
    /** The canonical Cycles code (ErrorCode value OR DecisionReasonCode
     *  value, depending on `source`). Preserved byte-for-byte. */
    code: string;
    /** HTTP status on the wire (only present when source=ErrorCode). */
    http_status?: number;
    /** Server message (only present when source=ErrorCode). */
    message?: string;
    /** Request correlation id (only present when source=ErrorCode). */
    request_id?: string;
    /** W3C Trace Context trace-id (32-hex), when populated. */
    trace_id?: string;
}
/** Signed denial — emitted on live 4xx, on /v1/decide DENY, or on
 *  dry-run reserve DENY. Carries the APS Tier-1 reason (closed enum
 *  via DenialReason from payment-rails/types.ts) plus the rich
 *  Cycles-side detail Tier-2. */
export interface CyclesDenial {
    claim_type: typeof RAIL_BUDGET_RESERVATION_DENIAL_CLAIM_TYPE;
    receipt_id: string;
    signer: string;
    agent_id: string;
    delegation_ref: string;
    action_ref: string;
    rail_name: 'cycles';
    /** APS Tier-1 reason from payment-rails/types.ts DenialReason. The
     *  string-typed import avoids a circular import; runtime validation
     *  via VALID_DENIAL_REASONS in hooks.ts. */
    denial_reason: string;
    cycles: {
        denial_detail: CyclesDenialDetail;
    };
    cycles_evidence: CyclesEvidenceRef;
    issued_at: string;
    signature: string;
    timestamp?: string;
    scope_of_claim?: ScopeOfClaim;
}
export type CyclesVerifyReason = 'INVALID_CLAIM_TYPE' | 'INVALID_SCHEMA_VERSION' | 'INVALID_RAIL_NAME' | 'MISSING_REQUIRED_FIELD' | 'SIGNATURE_INVALID' | 'EXPIRED' | 'EVIDENCE_REF_HASH_MISMATCH' | 'DID_RESOLVER_MISSING' | 'DID_URI_INVALID' | 'DID_DOC_NOT_FOUND' | 'DID_KEY_NOT_IN_DOC' | 'DID_KEY_RETIRED';
export type CyclesVerifyResult = {
    valid: true;
} | {
    valid: false;
    reason: CyclesVerifyReason;
    detail?: string;
};
export interface SignCyclesPermitReceiptInput {
    agent_id: string;
    delegation_ref: string;
    action_ref: string;
    reservation_id: string;
    reserved: {
        unit: string;
        amount: number;
    };
    decision: 'ALLOW' | 'ALLOW_WITH_CAPS';
    expires_at_ms?: number;
    cycles_evidence: CyclesEvidenceRef;
    /** Optional (Track B): the authority-state snapshot APS evaluated at
     *  admission. When supplied, it is carried inline on the permit-receipt
     *  as authority_state_at_admission; when omitted, the field is left
     *  absent. */
    authority_state_at_admission?: AuthorityStateSnapshot;
    /** Override the rail's default scope_of_claim. */
    scope_of_claim?: ScopeOfClaim;
    /** When supplied alongside `issuer_key_ref`, signer becomes a DID URI
     *  of the form `${issuer_agent_id}#${issuer_key_ref}`. Otherwise the
     *  signer is the raw hex pubkey derived from the private key. */
    issuer_agent_id?: string;
    issuer_key_ref?: string;
    /** Optional (W2-B1): trust-root-policy reference, carried onto the
     *  permit-receipt as trust_policy_ref when supplied; absent otherwise
     *  (canonical bytes unchanged on omit). */
    trust_policy_ref?: string;
}
export interface SignCyclesReleaseReceiptInput {
    agent_id: string;
    delegation_ref: string;
    action_ref: string;
    reservation_id: string;
    released: {
        unit: string;
        amount: number;
    };
    /** Optional reason from the ReleaseRequest body. */
    reason?: string;
    cycles_evidence: CyclesEvidenceRef;
    scope_of_claim?: ScopeOfClaim;
    issuer_agent_id?: string;
    issuer_key_ref?: string;
}
export interface SignCyclesDenialInput {
    agent_id: string;
    delegation_ref: string;
    action_ref: string;
    /** APS Tier-1 reason — must be a member of `DenialReason` from
     *  payment-rails/types.ts. Runtime validation against
     *  VALID_DENIAL_REASONS at hooks.ts:87-94. */
    denial_reason: string;
    cycles: {
        denial_detail: CyclesDenialDetail;
    };
    cycles_evidence: CyclesEvidenceRef;
    scope_of_claim?: ScopeOfClaim;
    issuer_agent_id?: string;
    issuer_key_ref?: string;
}
/** A fetched CyclesEvidence envelope, for the join-integrity check. */
export interface CyclesEvidenceEnvelopeInput {
    /** Content-addressed id: sha256 of the JCS-canonical envelope bytes
     *  with `evidence_id` and `signature` both set to the empty string.
     *  Per runcycles/cycles-protocol drafts/cycles-evidence-v0.1.yaml. */
    evidence_id: string;
    /** Ed25519 signature hex; emptied (not omitted) during the recompute. */
    signature: string;
    [key: string]: unknown;
}
export interface VerifyCyclesOptions {
    now?: Date;
    ttl_seconds?: number;
    expected_signer?: string;
    /** Required when signer is a DID URI. Sync verify paths return
     *  DID_RESOLVER_MISSING; pass this to the *WithDID async paths. */
    resolveDidDocument?: CyclesResolveDidDocument;
    /** Optional (W2-A2): a caller-supplied resolver for the CyclesEvidence
     *  envelope at cycles_evidence_url. When supplied to the *WithEvidence
     *  async paths, the verifier fetches the envelope and recomputes its
     *  content hash to test the CLAIMED cycles_evidence_id_sha256. When
     *  omitted, the claimed hash is signature-checked only (claimed, not
     *  resolved). The SDK performs no network egress itself: the resolver
     *  owns the transport. Mirrors the resolveDidDocument seam. */
    resolveEvidence?: import('./evidence-resolution.js').EvidenceResolver;
    /** Optional (W2-A2): failure posture for envelope resolution. Default
     *  'closed'. fail-open relaxes ONLY an unreachable endpoint to a
     *  degraded, still non-matching outcome; it never makes an unmatched
     *  envelope read as resolved. */
    evidenceFailurePolicy?: import('./evidence-resolution.js').EvidenceFailurePolicy;
    /** The fetched CyclesEvidence envelope this receipt's `cycles_evidence`
     *  references (retrieved from `cycles_evidence_url`). When supplied,
     *  verify performs the join-integrity check: recompute the envelope's
     *  content hash and confirm it matches BOTH the envelope's own
     *  `evidence_id` (envelope untampered) AND the receipt's
     *  `cycles_evidence.cycles_evidence_id_sha256` (receipt binds to THIS
     *  envelope). When omitted, the check is skipped — signature-only
     *  verification, preserving prior behavior. APS does not own the fetch
     *  contract; the caller retrieves the envelope and passes it in. */
    evidence?: CyclesEvidenceEnvelopeInput;
}
/** DID document resolver — mirrors MppResolveDidDocument. */
export type CyclesResolveDidDocument = (agentId: string) => Promise<import('../../../types/passport.js').RotatableDIDDocument | null>;
//# sourceMappingURL=types.d.ts.map