export type SensitiveRequestKind = "secret" | "payment" | "oauth" | "private_info"; export type SensitiveRequestStatus = "pending" | "fulfilled" | "failed" | "canceled" | "expired"; export type SensitiveRequestPaymentContext = "verified_payer" | "any_payer"; export type SensitiveRequestActorPolicy = "owner_only" | "owner_or_linked_identity" | "organization_admin" | "verified_payer" | "any_payer"; export type SensitiveRequestSourceContext = "owner_app_private" | "dm" | "public" | "api" | "unknown"; export type SensitiveRequestDeliveryMode = "inline_owner_app" | "private_dm" | "cloud_authenticated_link" | "tunnel_authenticated_link" | "public_link" | "dm_or_owner_app_instruction"; export interface SensitiveRequestEnvironment { cloud?: { available: boolean; baseUrl?: string; }; tunnel?: { available: boolean; url?: string; /** * Tunnel reachability is not an auth boundary. This must be true only when * the tunneled sensitive-request route enforces owner/session auth. */ authenticated: boolean; }; dm?: { available: boolean; }; ownerApp?: { privateChat: boolean; }; } export interface SensitiveRequestPolicyInput { kind: SensitiveRequestKind; channelType?: string; source?: SensitiveRequestSourceContext; paymentContext?: SensitiveRequestPaymentContext; environment?: SensitiveRequestEnvironment; } export interface SensitiveRequestPolicy { actor: SensitiveRequestActorPolicy; requirePrivateDelivery: boolean; requireAuthenticatedLink: boolean; allowInlineOwnerAppEntry: boolean; allowPublicLink: boolean; allowDmFallback: boolean; allowTunnelLink: boolean; allowCloudLink: boolean; } export interface SensitiveRequestSecretTarget { kind: "secret"; key: string; scope?: "organization" | "app" | "agent" | "global" | (string & {}); appId?: string; validation?: Record; /** * How the value should be collected. Defaults to `secret` (masked text). * `image`/`file` let a secret be captured as an upload — e.g. photograph a * 2FA seed or scan a recovery QR — delivered as a base64 data URL through the * same submit path. Additive; omit for a normal typed secret. */ input?: "secret" | "text" | "image" | "file"; /** For `input: "image" | "file"` — accepted MIME types (maps to the file input `accept`). */ mimeTypes?: string[]; /** For `input: "image" | "file"` — max upload size in bytes. */ maxBytes?: number; } export interface SensitiveRequestPrivateInfoField { name: string; label?: string; required?: boolean; classification?: string; } export interface SensitiveRequestPrivateInfoTarget { kind: "private_info"; fields: SensitiveRequestPrivateInfoField[]; storage?: { kind: string; key?: string; }; } export interface SensitiveRequestPaymentTarget { kind: "payment"; [key: string]: unknown; } export interface SensitiveRequestOauthTarget { kind: "oauth"; [key: string]: unknown; } /** OAuth target fields required by owner-app adapters and consent widgets. */ export interface SensitiveRequestOAuthTarget { kind: "oauth"; /** Canonical provider id, e.g. "github", "google". */ provider: string; /** OAuth scopes the consent screen will request. */ scopes?: string[]; /** The consent URL the widget opens in a popup. */ authorizationUrl: string; /** Human-readable provider label shown in the "Connect