@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
44 lines • 2.35 kB
TypeScript
import type { DispatchPermissionState } from "./dispatch-policy.ts";
import type { IdentityMatcher } from "./evaluate.ts";
import type { PermissionPresetName, Ruleset } from "./types.ts";
export interface CellOperation {
readonly tool: "bash" | "read" | "write" | "ls";
/** `path` as written, `executedPath` as handed to the runtime, `canonical`/`unresolvable` from the kernel thread (design 6.3.1). */
readonly input: Record<string, unknown>;
readonly cwd: string;
}
export interface CellDenyRule {
readonly permission: string;
readonly pattern: string;
readonly layer: string;
}
export type CellDecision = {
readonly action: "pass";
} | {
readonly action: "deny";
readonly rule: CellDenyRule;
};
export interface CellEnforcementState {
readonly active: boolean;
readonly alive: boolean;
readonly epoch: number;
}
interface Registration {
readonly decide: (call: CellOperation) => CellDecision | Promise<CellDecision>;
readonly refresh: () => void;
alive: boolean;
}
/** Retiring an older extension load must not retire its replacement. */
export declare function registerCellAuthorizer(session: object, decide: Registration["decide"], refresh: Registration["refresh"]): () => void;
/** Compare the full ordered user rules, not just the deny subset. */
export declare function updateCellEnforcement(session: object, rules: Ruleset, preset: PermissionPresetName | null, setupFailed?: boolean): void;
export declare function cellEnforcementState(sessionManager: object): CellEnforcementState;
export declare function onCellEnforcementChange(sessionManager: object, callback: (state: CellEnforcementState) => void): () => void;
/**
* Deny projection only: no ask, auto judge or approval event. Synchronous for a JS cell carrying a
* current kernel canonical; a Promise only when the host must canonicalize on the resolver worker.
*/
export declare function decideCellOperation(sessionManager: object, call: CellOperation): CellDecision | Promise<CellDecision>;
export declare function createCellDecision(stateFor: () => DispatchPermissionState, provenance: (permission: string, patterns: readonly string[], matchesIdentity?: IdentityMatcher) => CellDenyRule | undefined): (call: CellOperation) => CellDecision | Promise<CellDecision>;
export {};
//# sourceMappingURL=cell-decision.d.ts.map