import { C as Capability } from './types-iaO2gHBL.js'; /** * Capability matching for Krikos: the pure predicate behind every authorization decision. * * A capability grants a set of actions, optionally scoped to a set of resource patterns. This * module decides whether a declared capability set admits a requested (capability, action, * resource) triple. It is the only place resource-pattern semantics live, so the rule is stated * once and shared by the engine, the Vercel tool guard, the MCP guard, and the edge verifier. * * Determinism: pure functions of their inputs, no clock, no randomness, no platform globals. * * @packageDocumentation */ /** * Validates one capability's shape, throwing on a malformed declaration so a bad capability is * rejected at the boundary (issue, grant) rather than silently never matching. * * @param capability - The capability to validate. * @throws KrikosError `ERR_INVALID_INPUT` for an empty name, an empty actions list, a non-string * action, or a non-string resource pattern. */ declare function assertValidCapability(capability: Capability): void; /** * True when `pattern` admits `resource`. * * Pattern semantics, deliberately small and unsurprising: * - `*` alone matches any resource. * - A pattern ending in `*` is a prefix match: `/data/*` admits `/data/x` and `/data/`. * - Any other pattern is an exact match. * * No regex, no path normalization, no globbing beyond the trailing star, so the rule cannot * surprise an operator reasoning about what a capability grants. * * @param pattern - A resource pattern from a capability. * @param resource - The concrete resource being requested. * @returns Whether the pattern admits the resource. */ declare function resourceMatches(pattern: string, resource: string): boolean; /** * True when a single capability admits the requested action and resource. * * The capability must permit `action`. If `resource` is provided and the capability declares * `resources`, one of the patterns must admit it; a capability with no `resources` admits any * resource. If `resource` is omitted, resource scope is not checked. * * @param capability - The capability to test. * @param action - The requested action. * @param resource - The requested resource, or undefined to skip resource scoping. * @returns Whether this capability alone authorizes the request. */ declare function capabilityAdmits(capability: Capability, action: string, resource: string | undefined, requireResourceScope?: boolean): boolean; /** * True when a declared capability set authorizes the (capability name, action, resource) triple. * * Finds capabilities matching `name` and returns whether any one of them admits the action and * resource. This is the lexical half of authorization; the engine combines it with the agent's * lifecycle state to produce the final fail-closed decision. * * @param capabilities - The agent's declared capabilities. * @param name - The capability name requested. * @param action - The action requested. * @param resource - The resource requested, or undefined. * @param requireResourceScope - When true, a resource-bearing request is admitted only by a * capability that declares explicit resource patterns; an unscoped capability is denied. Enforces * least privilege. * @returns Whether the capability set admits the request. */ declare function capabilitiesAuthorize(capabilities: readonly Capability[], name: string, action: string, resource: string | undefined, requireResourceScope?: boolean): boolean; export { assertValidCapability as a, capabilityAdmits as b, capabilitiesAuthorize as c, resourceMatches as r };