/** * Capability + Agent Metadata + Cedar Types * * The new consent screen renders operator-authored capabilities, each backed by * a Cedar policy fragment. The label, description, icon, and risk level shown * to the user are the human rendering of the same record. * * @module @kya-os/consent/types/capabilities */ /** * Risk classification for a capability. Used to surface the amber `HIGHER RISK` * chip on capability rows when riskLevel is `high` or `critical`. */ export type RiskLevel = "low" | "medium" | "high" | "critical"; /** * Allowlist of icon tokens recognized by ``. Operators * pick from this list in the WYSIWYG editor; unknown tokens fall back to a * neutral square icon. */ export type CapabilityIcon = "search" | "cart" | "card" | "pin" | "pin-new" | "shield" | "key" | "tools" | "user" | "calendar" | "lock" | "eye" | "send" | "package" | "neutral"; /** * A single capability row shown to the user during consent. * * The `cedar` field is the operator-authored permit fragment with templated * placeholders ({{agent_did}}, {{user_did}}, {{org}}, {{deployment}}) that get * bound at compile time. The `label` and `description` are what the user sees; * `cedar` is what gets attached to the issued delegation VC and surfaced via * the per-row "View policy" disclosure. */ export interface Capability { /** Stable identifier, e.g. `cart.add`. */ id: string; /** Bold label shown on the capability row, e.g. "Add items to your cart". */ label: string; /** Supporting copy shown next to the label. */ description: string; /** Icon token from the allowlist. */ icon: CapabilityIcon; /** Risk classification; >= 'high' renders the amber HIGHER RISK chip. */ riskLevel: RiskLevel; /** Whether the checkbox is pre-selected by default. */ defaultOn: boolean; /** * Operator-authored Cedar permit fragment with templated placeholders. * Bound at consent compile-time via `compileSingleCapability`. */ cedar: string; /** * Scopes derived from the Cedar fragment's `action` clauses. Persisted for * legacy clients and for the runtime authorization check; the Cedar fragment * remains the source of truth. */ scopes: string[]; /** Optional grouping label shown above a cluster of related capabilities. */ category?: string; } /** * Optional grouping wrapper, e.g. group several capabilities under * "Browse + cart" vs "Checkout". */ export interface CapabilityGroup { /** Group identifier. */ id: string; /** Group label rendered as a section header. */ label: string; /** Capabilities in this group, rendered in declared order. */ capabilities: Capability[]; } /** * Agent identity tile data shared across the consent + (future) gateway * screens. * * Mirrors the rendering of the agent identity in Peter's mockup * (`Claude · Made by Anthropic · Asking from your Mac · Verified`) and the * OAuth Gateway consent tile (`Cursor · UNVERIFIED`). */ export interface AgentMetadata { /** Display name (e.g. "Claude"). */ name: string; /** Decentralized identifier of the agent. */ did: string; /** Vendor / "Made by" label (e.g. "Anthropic"). */ vendor?: string; /** Surface label (e.g. "Mac", "Web", "Desktop"). */ surfaceLabel?: string; /** Whether the agent identity is verified (controls Verified vs UNVERIFIED chip). */ verified: boolean; /** Logo URL for the agent tile. */ logoUrl?: string; /** ISO timestamp of when the agent connected; rendered as "Connected just now"/"5 min ago". */ connectedAt?: string; } /** * Theme selection for the consent screen. * * `light` → paper background, dark on light, serif headline (Peter's mockup). * `dark` → glassy dark modal, soft halo backdrop (OAuth Gateway aesthetic). */ export type ConsentTheme = "light" | "dark"; /** * Bound values used when compiling per-grant Cedar fragments into the final * delegation policy. */ export interface CedarTemplateContext { /** Agent DID; substituted into `{{agent_did}}` placeholders. */ agent_did: string; /** User DID; substituted into `{{user_did}}` placeholders. */ user_did: string; /** Organization slug or display name; substituted into `{{org}}` placeholders. */ org: string; /** Deployment identifier (e.g. project slug); substituted into `{{deployment}}` placeholders. */ deployment: string; } /** * Result of `explainCedarFragment` — the plain-language gloss shown alongside * the raw Cedar in the per-row "View policy" disclosure. */ export interface CedarExplanation { /** Action identifiers extracted from the policy. */ actions: string[]; /** Resource expression (e.g. `Org::"hardwareworld.com"::Cart::"*"`). */ resource: string; /** Plain-language conditions clause (one per `when`/`unless`). */ conditions: string[]; } //# sourceMappingURL=capabilities.types.d.ts.map