@phren/cli
Version:
Knowledge layer for AI agents - CLI, MCP server, and data layer
80 lines (79 loc) • 3.59 kB
TypeScript
import { AgentHooks } from "./agent-hooks.js";
import { type CodexNextTurn } from "./codex-servers.js";
import { type PermissionModeName } from "./permission-mode.js";
import { type Json, type PermissionMode, type Target } from "./protocol.js";
export { claudeFooterMode } from "./permission-mode.js";
/** T3's CodexSessionRuntime mapping. The reviewer is always sent: leaving it
* out would keep `auto_review` from an earlier turn. */
export declare const CODEX_MODES: Record<PermissionMode, Pick<CodexNextTurn, "approvalPolicy" | "approvalsReviewer" | "sandboxPolicy">>;
export declare const CLAUDE_NAMES: Record<string, string>;
/** The same Codex mode as command-line flags, for a Codex started with no thread yet. */
export declare function codexModeFlags(mode: PermissionMode): string[];
/**
* Copilot CLI's launch flags for a mode. Copilot asks before every tool by
* default and has no automatic reviewer, so `auto` approves every tool call
* while file access stays inside the working folder, and `full-access` also
* lifts the path and URL checks (`--allow-all`).
*/
export declare function copilotModeFlags(mode: PermissionMode): string[];
export interface SettingsCapabilities {
permissionModes: string[];
plan: boolean;
fast: boolean;
}
/** What this pane can change from the phone; undefined for harnesses that
* offer nothing. A hand-started Codex TUI is empty: its state is still read
* from its transcript, but switching is not offered. Claude's cycle holds
* `full-access` only when it was launched allowing bypass. */
export declare function settingsCapabilities(source: string, codexServed: boolean, claudeBypass?: boolean): SettingsCapabilities | undefined;
export interface SettingsState {
permissionMode?: string;
plan?: boolean;
fast?: boolean;
}
/** A Claude pane's settings as its footer shows them, read at most once per
* `PHREN_DIALOG_THROTTLE_MS` like the dialog check, and whether bypass was
* ever seen in it (which is when full access is offered). The same read, with
* its styles, carries the suggested next prompt in the input box. */
export declare class ClaudeSettingsReader {
private readonly hooks;
private readonly every;
private cache;
constructor(hooks: AgentHooks, every?: number);
read(target: Target, terminal: unknown): Promise<{
state?: SettingsState;
bypass: boolean;
suggestion?: {
text: string;
readAt: number;
};
permissionMode?: PermissionModeName;
permissionModes?: PermissionModeName[];
}>;
}
/** One settings transaction per pane owns its terminal input until it ends. */
export declare class SettingsSwitcher {
private readonly hooks;
private readonly wait;
private active;
private readonly reader;
constructor(hooks: AgentHooks, wait?: number);
/** A Claude pane's footer-read settings and capabilities for the stream,
* with the suggested next prompt its input box shows and the raw permission
* mode (`agentStatus.permissionMode`) its picker offers. */
streamSettings(target: Target, terminal: unknown, codexServed: boolean): Promise<{
settings?: SettingsCapabilities;
settingsState?: SettingsState;
suggestion?: {
text: string;
readAt: number;
};
permissionMode?: PermissionModeName;
permissionModes?: PermissionModeName[];
}>;
private key;
assertAvailable(target: Target): void;
switch(target: Target, data: Json): Promise<Json>;
private hold;
private claude;
}