@phren/cli
Version:
Knowledge layer for AI agents - CLI, MCP server, and data layer
56 lines (55 loc) • 2.27 kB
TypeScript
import { type ClaudeHome } from "./claude-accounts.js";
export declare const DEFAULT_HELPER_MODEL = "haiku";
export declare const HELPER_TIMEOUT_DEFAULT_S = 120;
export declare const HELPER_TIMEOUT_MAX_S = 600;
export interface HelperChoice {
project: string;
account: string;
model: string;
home: ClaudeHome;
pool?: string;
}
/**
* The project's helper account and model, checked: configured, an account on this computer with role `helpers`
* (a team store's phren.project.yaml can name any of the owner's local accounts), and in the project's and this
* computer's allowed pools. Throws with what to change otherwise.
*/
export declare function helperFor(phrenPath: string, project: string, env?: NodeJS.ProcessEnv): HelperChoice;
/** The helper's environment: the lead's, without anything naming another login, plus the account's home. */
export declare function helperEnv(home: ClaudeHome, env?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
export interface HelperTokens {
input?: number;
output?: number;
cacheRead?: number;
cacheWrite?: number;
}
export interface HelperResult {
ok: boolean;
/** Claude's final reply, or what went wrong; capped at 64 KB. */
output: string;
project: string;
account: string;
model: string;
durationMs: number;
costUSD?: number;
/** Token counts, when Claude printed them (`usage` in its JSON answer). */
tokens?: HelperTokens;
sessionId?: string;
timedOut?: true;
truncated?: true;
}
export interface HelperRunOptions {
prompt: string;
cwd: string;
timeoutSeconds?: number;
/** Let the helper edit files (`--permission-mode acceptEdits`); otherwise tools that need a grant are refused. */
allowEdits?: boolean;
env?: NodeJS.ProcessEnv;
/** The MCP call's cancel: stops the run. */
signal?: AbortSignal;
now?: () => number;
}
/** Run one helper task and record it. Never throws for the run itself: a failed run is `ok: false`. */
export declare function runHelper(choice: HelperChoice, options: HelperRunOptions): Promise<HelperResult>;
/** `<bridge>/usage/helper-runs.jsonl`: one line per run (when, project, account, model, outcome, cost), never the prompt. */
export declare const helperRunsFile: () => string;