UNPKG

@code-yeongyu/senpi

Version:

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

38 lines • 2.72 kB
import type { ToolInfo } from "../../types.ts"; import type { Request } from "../permission-system/types.ts"; /** Simplified permission request without ID/session metadata */ export type PermissionRequest = Pick<Request, "permission" | "patterns" | "always" | "widerAlways" | "originalPaths"> & { readonly autoApproveAsk?: true; /** Absolute external lexical spellings restrict the resolved decision; other aliases share rule order. */ readonly ruleAliases?: readonly string[]; /** The strings the tool opens for its path-class request, matched literally and by file identity (design 6.2). */ readonly executed?: readonly string[]; }; /** Parser function that extracts permission requests from tool input */ export type ToolPermissionParser = (toolName: string, input: Record<string, unknown>, cwd: string) => PermissionRequest[]; /** Marks a bash request target that no command-specific rule can match: only a `*` rule decides it. */ export declare const UNPARSED_BASH_PREFIX = "(unparsed) "; /** The `eval` class a cell carries on its own, used when its tool-owned parser names anything narrower. */ export declare function fallbackEvalPermissionRequest(): PermissionRequest; /** * The permission requests for one call: the builtin registry's answer, or the tool's own parser * when the builtin registry does not own it. An `eval` call is arbitrary code, so its tool's own * parser can never speak for everything the cell does: the `eval` request is always carried * alongside, and a narrower answer (for example `read`) can never approve it (senpi#3211). */ export declare function permissionRequestsFor(getTools: () => readonly ToolInfo[], registry: ParserRegistry, toolName: string, input: Record<string, unknown>, cwd: string): PermissionRequest[]; /** The requests a tool's own `permissionParser` derives from this call, or undefined when the tool declares none. */ export declare function toolOwnedPermissionRequests(tools: readonly ToolInfo[], toolName: string, input: Record<string, unknown>, cwd: string): PermissionRequest[] | undefined; /** Registry for tool-specific permission parsers */ export declare class ParserRegistry { private readonly parsers; /** Register a parser for a specific tool */ register(toolName: string, parser: ToolPermissionParser): void; /** Whether a built-in parser owns this tool */ has(toolName: string): boolean; /** Parse tool input into permission requests */ parse(toolName: string, input: Record<string, unknown>, cwd: string): PermissionRequest[]; } /** Create registry with built-in parsers for standard tools */ export declare function createBuiltinParserRegistry(): ParserRegistry; //# sourceMappingURL=parsers.d.ts.map