@phren/cli
Version:
Knowledge layer for AI agents - CLI, MCP server, and data layer
71 lines (70 loc) • 2.67 kB
TypeScript
import { z } from "zod";
export declare const approvalRuleDraftSchema: z.ZodObject<{
tool: z.ZodLiteral<"Bash">;
command: z.ZodString;
match: z.ZodEnum<{
exact: "exact";
glob: "glob";
prefix: "prefix";
}>;
effect: z.ZodEnum<{
"always-ask": "always-ask";
deny: "deny";
}>;
scope: z.ZodObject<{
project: z.ZodString;
harness: z.ZodOptional<z.ZodEnum<{
claude: "claude";
codex: "codex";
copilot: "copilot";
opencode: "opencode";
phren: "phren";
}>>;
session: z.ZodOptional<z.ZodString>;
computer: z.ZodOptional<z.ZodString>;
}, z.core.$strict>;
projectName: z.ZodString;
until: z.ZodOptional<z.ZodString>;
}, z.core.$strict>;
export type ApprovalRuleDraft = z.infer<typeof approvalRuleDraftSchema>;
export interface ApprovalRule extends ApprovalRuleDraft {
id: string;
createdAt: string;
owner: string;
enabled: boolean;
}
export declare function listApprovalRules(root?: string, pairedKey?: string): Promise<{
tool: "Bash";
command: string;
match: "exact" | "glob" | "prefix";
effect: "always-ask" | "deny";
scope: {
project: string;
harness?: "claude" | "codex" | "copilot" | "opencode" | "phren" | undefined;
session?: string | undefined;
computer?: string | undefined;
};
projectName: string;
until?: string | undefined;
id: string;
createdAt: string;
owner: string;
enabled: boolean;
signerFingerprint: string;
matchesPairedKey: boolean;
}[]>;
/** The signed operations remain on disk and are verified again at every decision. */
export declare function changeApprovalRule(input: unknown, method: "POST" | "DELETE", root?: string): Promise<{
ok: boolean;
}>;
export interface ApprovalRuleContext {
project: string;
harness: NonNullable<ApprovalRuleDraft["scope"]["harness"]>;
session: string;
computer: string;
}
/** Bind project scope to the main repository, including linked worktrees. */
export declare function approvalRuleContext(cwd: string, harness: string, session: string): Promise<ApprovalRuleContext | undefined>;
/** Rules can only restrict a request the harness has already raised. Invalid policy
* falls back to that ordinary approval path; Settings reports the load error. */
export declare function approvalRuleEffect(tool: string, input: unknown, context: ApprovalRuleContext | undefined | (() => Promise<ApprovalRuleContext | undefined>), root?: string, knownScope?: Partial<ApprovalRuleContext>): Promise<"always-ask" | "deny" | undefined>;