UNPKG

@phren/cli

Version:

Knowledge layer for AI agents - CLI, MCP server, and data layer

67 lines (66 loc) • 3.99 kB
import { type HarnessInventory } from "./harnesses.js"; import { type Json } from "./protocol.js"; /** * phren agent's quick chat and resume: `mode: "chat"` starts it with no tools * and its memory read up front (`--mode chat`); `resumeSession` continues a * session's history (`--session <id>`). Resuming a chat in `mode: "agent"` * promotes it: the same conversation with tools. An agent session that used * tools cannot go back to a chat: its history holds tool calls and results, * which a request with no tools may not carry (Anthropic refuses it with a * 400), so it is refused here before any pane exists. */ export declare function phrenLaunchArgs(kind: string, data: Json, store?: string): Promise<string[]>; /** Whether a phren agent session's history, as its model sees it, holds a * tool call or result: its event log (`<store>/.sessions`) folded as the * agent folds it, so a span a compaction summary replaced counts as that * summary. False when there is no readable log; phren agent says so itself. */ export declare function sessionUsedTools(session: string, store?: string): Promise<boolean>; /** A model from phren agent's catalog (`/v1/models?source=phren`) is * `<provider>/<model>`. phren agent reads an openai or openai-codex prefix off * `--model` itself; the rest name their provider with `--provider`. Any other * model (an OpenRouter id typed by hand) passes through as it is. */ export declare function phrenModelArgs(model: string): string[]; /** The live conductor on this computer, as a target: the pane the Hook * recorded (docs/conductor-sets.md), or before any record, a pane named as a * conductor on any server, which is then recorded. `known` reuses a snapshot * the caller already took. */ export declare function localConductor(known?: { server: string; snapshot: Json; }): Promise<{ server: string; target?: Json; } | undefined>; /** "Make conductor": the owner gives an agent already running in a pane on this computer the role. */ export declare function makeConductor(server: string, data: Json): Promise<Json>; /** "Stop being conductor": the pane keeps its agent and loses the role. With * `paneId`, only that pane's role ends. */ export declare function stopConductor(data: Json): Promise<Json>; /** The Herdr agent-name slug for a human label: "Conductor smoke 4" becomes "conductor-smoke-4". */ export declare function herdrAgentName(label: string): string; type InventoryReader = () => Promise<HarnessInventory>; /** Only for tests: what this computer can launch. Without one, `PHREN_LAUNCH_CHECK=off` skips the early availability check. */ export declare function setLaunchInventory(reader: InventoryReader | undefined): void; export interface LaunchOptions { canary?: boolean; /** `data.cwd` is a folder the Hook resolved itself (a dispatched or * scheduled project's source folder), so it may be marked trusted for the * harness before the launch. Never set for a folder the phone chose. */ trustFolder?: boolean; } /** * "Open on a computer": a new Herdr workspace (or a tab in an existing one) * in the project's directory, with the chosen agent started in its pane. * Herdr's create calls do not return identifiers, so the new tab is found * by diffing snapshots; `agent.start` returns once Herdr has detected the * agent and it is ready for input, which can take most of `timeoutMs`. * A `launchId` (a UUID the caller keeps for one intended launch) makes it * idempotent: the same id again returns the first launch's pane while it is * listed, with `reused: true`, instead of starting a second agent. */ export declare function launchSession(server: string, data: Json, options?: LaunchOptions): Promise<Json>; export declare const LAUNCH_ID_TTL_MS: number; /** For tests: forget every remembered launch. */ export declare function resetLaunchIds(): void; export declare function workspaceAction(server: string, operation: string, data: Json): Promise<Json>; export {};