UNPKG

@code-yeongyu/senpi

Version:

Coding agent CLI with read, bash, edit, write tools and session management

47 lines • 2.99 kB
import type { IdentityMatcher } from "./evaluate.ts"; import { type CanonicalPath } from "./path-identity.ts"; import type { PathIdentityResolver } from "./path-identity-host.ts"; import type { RuleIdentityCache } from "./rule-identity-cache.ts"; import type { Rule } from "./types.ts"; /** The canonical forms of one request (design 6.2): every alias names one operation, so any of them may match. */ export interface IdentityInput { readonly canonical: readonly CanonicalPath[]; /** Error code when the executed path could not be canonicalized (6.1.3). */ readonly unresolvable?: string; /** Set when a timed-out DENY rule of the class could have reached this request through an alias (6.5.1). */ readonly failClosed?: boolean; } /** The kernel-supplied canonical of a cell operation, honoured only at the host's own PATH_IDENTITY_VERSION. */ export interface KernelCanonical { readonly canonical?: { readonly v: number; readonly path: string; readonly foldCase: boolean; }; readonly unresolvable?: string; } /** The permission classes with a path target; only these take the identity route (M4). */ export declare const PATH_PERMISSIONS: ReadonlySet<string>; /** The static and approved rules that could match by identity: a path class, and a pattern other than `*`. */ export declare function pathRulesOf(rules: readonly Rule[]): Rule[]; /** * True when a static or approved rule of a path class could match by identity (R3-H2 gate). With the * resolver unavailable only a request that brings its own current canonical (a JS cell) keeps the route: * it needs no worker, so its decision stays exact; every other request matches by spelling only. */ export declare function identityWanted(resolver: PathIdentityResolver | undefined, rules: readonly Rule[], permission: string, kernel?: KernelCanonical): boolean; export interface IdentityContext { readonly resolver: PathIdentityResolver | undefined; readonly cache: RuleIdentityCache; readonly mountRewrite: (value: string) => string; identityWanted(permission: string, kernel?: KernelCanonical): boolean; } /** * The identity input for one request (6.2, 6.5.1). Synchronous when the kernel supplied a current canonical * and no rule of the class is pending or timed out; otherwise it awaits the resolver worker. Never throws: * every resolver failure becomes `unresolvable`. */ export declare function prepareIdentity(context: IdentityContext, permission: string, executed: readonly string[], cwd?: string, kernel?: KernelCanonical): IdentityInput | Promise<IdentityInput>; /** The identity predicate for one request: takes the RULE pattern only and tests every canonical path (H1). */ export declare function identityMatcher(cache: RuleIdentityCache, permission: string, identity: IdentityInput | undefined, rewrite: (value: string) => string, resolverUnavailable?: boolean): IdentityMatcher | undefined; //# sourceMappingURL=identity-decision.d.ts.map