UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

48 lines (47 loc) • 4.14 kB
/** * The allow layer's DISCLOSURE vocabulary — which member matched a call and could not clear its ask. A leaf: the decision * union (`PermissionResult`), the approval request (`AskRequest`), the park row's risk descriptor and the allow layer all * name these, and nothing here names them back. */ /** The allow layer's members, in the order the layer reads them: a PreToolUse hook's explicit `allow`, the deployment's * `RunnerDeps.allowedTools`, a person's stored allow rows, an active skill's `allowed-tools`, the request's * `TaskSpec.allowedTools`. The closed set {@link AllowRuleShadow.member} names. */ export declare const ALLOW_RULE_MEMBERS: readonly ["hook", "deployment", "persisted", "skill", "request"]; export type AllowRuleMember = (typeof ALLOW_RULE_MEMBERS)[number]; /** Why a member's match did not clear an inside peer's question (`a2a_inside`) although nothing else in the question refused it — * the binding: `identity_changed` (an entry it matched is bound to an identity stamp, and not to the one the peer's registration * carries now — the registration changed since the grant was given), `unbound` (no entry it matched is bound to the peer's identity). * The closed set {@link AllowRuleShadow.reason} names. */ export declare const ALLOW_RULE_SHADOW_REASONS: readonly ["identity_changed", "unbound"]; export type AllowRuleShadowReason = (typeof ALLOW_RULE_SHADOW_REASONS)[number]; /** Does a person's stored allow row that names an A2A peer registered inside the trust boundary stand for the peer's identity now — * the engine's reading of the row against the stamp the registration carries now: `current` (one of its adds is bound to it), or * one of the two {@link ALLOW_RULE_SHADOW_REASONS} it would be disclosed with. The closed set a listed row's `binding` names. */ export declare const ALLOW_RULE_BINDINGS: readonly ["current", "identity_changed", "unbound"]; export type AllowRuleBinding = (typeof ALLOW_RULE_BINDINGS)[number]; /** One allow-layer member that matched a call and could not clear its ask — one record per member: the member, and the * entries it matched as their source spells them (sanitized and capped at the mint; the hook member names the registrations * that spoke). `omitted` counts entries beyond the cap, never dropped silently. `reason` is present only where the binding is * the whole reason the member did not clear ({@link AllowRuleShadowReason}); the ask's class says every other reason. */ export interface AllowRuleShadow { readonly member: AllowRuleMember; readonly entries: readonly string[]; readonly omitted?: number; readonly reason?: AllowRuleShadowReason; } /** Who put a list entry on its list, as the list's writer marks it (`{ rule, grant }`): `preapproval` (an administrator pre-approved * the peer for every user), `recipe` (a published recipe named the peer). Carried as written onto the clearance; the engine judges * nothing by it. */ export declare const ALLOW_LIST_GRANTS: readonly ["preapproval", "recipe"]; export type AllowListGrant = (typeof ALLOW_LIST_GRANTS)[number]; /** Is `value` a word of {@link ALLOW_LIST_GRANTS}? The one membership reading the list's receiver and the disposition screen take. */ export declare function isAllowListGrant(value: unknown): value is AllowListGrant; /** The allow-layer member that CLEARED a call's ask (`tool_end.gate.disposition.clearedBy`): the shadow record's shape — the member * and the entries it stood on, sanitized and capped by the same mint — plus, for a LIST member (`request`, `deployment`), * `positions`: the index of every element of the list the run received that is one of those entries (a string listed twice has * both indices), so a host reads which line of its own declaration spoke even where the shown text is capped; and `grant`, the * entries' {@link AllowListGrant} where every entry the clearance stands on carries the same one. A clearance carries no `reason`. */ export interface AllowRuleClearance extends Omit<AllowRuleShadow, "reason"> { readonly positions?: readonly number[]; readonly grant?: AllowListGrant; }