UNPKG

@code-yeongyu/senpi

Version:

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

27 lines • 1.82 kB
import { type NestedRequest, type AgentToolResult } from "@earendil-works/pi-agent-core"; import type { FilesystemPolicyChecker } from "../../core/extensions/types.ts"; import type { Flock } from "./hand-activity-lock.ts"; import type { HandRunContext } from "./hand-run-allowlist.ts"; /** What a hand scope checks every device file operation against: its runtime's handlers and filesystem policy. */ export interface HandFileGuards { beforeToolCall(toolName: string, toolCallId: string, input: Record<string, unknown>, /** The operation's nested requests to the loop: a two-sided extension's handler runs on the loop's copy (S29). */ nested?: NestedRequest): Promise<{ readonly block?: boolean; readonly reason?: string; } | undefined>; filesystemPolicy(): FilesystemPolicyChecker | undefined; } /** * One hand scope's device file operations (S40, senpi#5645). Paths resolve against the scope root and are NOT confined * to it: they are bounded by the hand's OS user, its filesystem policy and its `tool_call` handlers, which see each * operation as the matching file tool (`read`, `ls`, `write`) with that tool's input shape; a block, a throw or a * patched input refuses it. The operation then runs on exactly the canonical path the policy checked, in the same * per-file mutation slot the file tools use; `stat`, `remove` and `rename` act on a link itself, as on a fused session. * A write over the limit is refused before its data is decoded. */ export declare function createHandFileOps(root: string, guards: HandFileGuards, run?: { readonly context: HandRunContext; readonly flock: Flock | undefined; }): (op: string, rawArgs: unknown, signal: AbortSignal, nested?: NestedRequest) => Promise<AgentToolResult<unknown>>; //# sourceMappingURL=hand-file-ops.d.ts.map