@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
34 lines • 1.74 kB
TypeScript
/**
* The `run` operation's allowlist (S40 PR 2, senpi#5645, design v2.2-v2.4). A hand runs only the git and lsof calls the
* memory component makes, scanned from its sources; everything else is refused with a reason naming what was refused.
* The hand prepends its own git globals, builds the environment from scratch, and never runs a shell. The lists below
* are the scan's result and are covered by a behavioral test, not compared with themselves.
*/
import { type TypedPath } from "./hand-run-grammar.ts";
export interface RunRequest {
readonly exe: string;
readonly argv: readonly string[];
readonly env: Readonly<Record<string, string>>;
}
export interface HandRunContext {
readonly uid: number;
readonly platform: NodeJS.Platform;
/** The hand's own environment, read for the baseline only; the caller never supplies these. */
readonly ownEnv: Readonly<Record<string, string | undefined>>;
}
export type RunPlan = {
readonly ok: true;
readonly exe: "git" | "lsof";
readonly argv: string[];
readonly env: Record<string, string>;
/** Path arguments the hand confines on the device before spawning (none for lsof). */
readonly paths: readonly TypedPath[];
} | {
readonly ok: false;
readonly reason: string;
};
/** Turns a `run` request into the exact argv and environment the hand spawns, or a refusal naming what was refused. */
export declare function planRun(request: RunRequest, context: HandRunContext): RunPlan;
/** The POSIX-quoted command line the hand's `tool_call` handlers judge: exactly what is spawned, no shell involved. */
export declare function renderCommand(exe: string, argv: readonly string[]): string;
//# sourceMappingURL=hand-run-allowlist.d.ts.map