import { $ as StorageDescriptor, F as HarnessDetection, G as McpServerConfig, I as HarnessId, K as PathCandidate, M as EnvOverride, P as HarnessCapabilities, Q as SkillsSyncTarget, R as HarnessInvocationModes, Y as PromptTemplateSyncTarget, Z as ResolvedPaths, _ as McpConfigListing, b as SyncReport, j as AvailableModel, n as SkillsSyncReport, o as PromptSyncReport, p as AgentsSyncReport } from "./_chunks/skills-sync.mjs"; import { n as HARNESS_INFO_MAX_ITEMS } from "./_chunks/tool-schemas.mjs"; //#region src/tool-operations.d.ts /** Text for the model plus details for the harness, shared by every tool surface. */ export interface ToolResult
{ content: Array<{ type: "text"; text: string; }>; details: Details; /** Set when the tool could not answer. */ isError?: boolean; } /** Install state of one harness on this machine, plus the runs harnesses_run takes for it. */ export interface HarnessStatus { id: HarnessId; name: string; installed: boolean; version: string | null; /** Takes `tools: false`, an advisor without tools. */ advisor: boolean; /** Takes `tools: true` with `readOnly: true`; false while the installed CLI is too old for it. */ readOnly: boolean; /** Takes `tools: true`, the full agent. */ agent: boolean; } /** Every registered harness with its install state, as scanned by {@link detectHarnesses}. */ export interface HarnessListing { harnesses: HarnessStatus[]; } /** Full metadata for one harness, including paths resolved for this platform. */ export interface HarnessMetadata { id: HarnessId; name: string; binaries: string[]; capabilities: HarnessCapabilities; invocationModes: HarnessInvocationModes; /** Network for what a read-only run starts here, MCP servers included; null when unknown. */ readOnlyNetwork: boolean | null; modelListing: boolean; modelSelection: boolean; effortSelection: boolean; config: PathCandidate[]; sessions: PathCandidate[]; instructions: PathCandidate[]; skills: PathCandidate[]; skillsSyncTarget: SkillsSyncTarget | null; commands: PathCandidate[]; promptTemplates: PathCandidate[]; promptTemplateSyncTarget: PromptTemplateSyncTarget | null; hooks: PathCandidate[]; temp: PathCandidate[]; envOverrides: EnvOverride[]; persistence: StorageDescriptor[]; detection: HarnessDetection; resolved: ResolvedPaths; } /** Returned when the requested harness id is not registered. */ export interface UnknownHarness { error: string; known: HarnessId[]; } /** Returned when a direct batch call bypasses the tool schema limits. */ export interface HarnessInfoInputError { error: string; } /** One harness lookup result. */ export type HarnessInfoResult = HarnessMetadata | UnknownHarness; /** Scalar, batch, or rejected batch details from {@link harnessInfo}. */ export type HarnessInfoDetails = HarnessInfoResult | HarnessInfoResult[] | HarnessInfoInputError; /** Default wall-clock budget for one harness run, in seconds. */ export declare const RUN_DEFAULT_TIMEOUT_SECONDS = 600; /** The run tool's per-stream cap: harness output is unbounded, model context is not. */ export declare const RUN_MAX_OUTPUT_CHARS = 8000; /** What the run tool and the CLI say about an advisor answer with a tool call written as text. */ export declare const TOOL_CALL_TEXT_WARNING = "The advisor wrote a tool call as text. Nothing ran it, so any result it reports from that call is unverified"; /** * Scans every registered harness for its binaries and version, next to the modes it runs in. * * @returns {ToolResult} The complete installation listing. */ export declare function detectHarnesses(): ToolResult; /** Full metadata for one harness, with paths resolved for the current platform. */ export declare function harnessInfo(id: string): ToolResult; /** Full metadata for several harnesses, preserving input order and errors for each item. */ export declare function harnessInfo(ids: readonly string[]): ToolResult; export declare function harnessInfo(input: string | readonly string[]): ToolResult; /** Options accepted by {@link listHarnessModels}. */ export interface ModelsOptions { search?: string; cwd?: string; /** Wall-clock budget in seconds; defaults to {@link RUN_DEFAULT_TIMEOUT_SECONDS}. */ timeoutSeconds?: number; /** Cancel the owned command through the host request signal. */ signal?: AbortSignal; } /** One completed native model-listing query. */ export interface ModelsOutcome { id: HarnessId; command: string; args: string[]; search?: string; models: AvailableModel[]; exitCode: number | null; timedOut: boolean; aborted: boolean; /** Milliseconds without output before the listing was stopped; absent when it exited on its own. */ idleMs?: number; stderr: string; } /** * Lists the models currently available to one harness through its native CLI. * * @param id - Harness id to query. * @param options - Search, working-directory, and timeout options. * @returns {Promise>} The model listing or failure. */ export declare function listHarnessModels(id: string, options?: ModelsOptions): Promise>; /** Options accepted by {@link runHarness}. */ export interface RunOptions { cwd?: string; /** Harness-native model id or selector. */ model?: string; /** Reasoning effort in the harness's own words; rejected where `effortArgs` is missing. */ effort?: string; /** Wall-clock budget in seconds; defaults to {@link RUN_DEFAULT_TIMEOUT_SECONDS}. */ timeoutSeconds?: number; /** Cancel the owned command through the host request signal. */ signal?: AbortSignal; /** Use the harness's structured (JSON) output mode instead of plain text. */ structured?: boolean; /** Enable tools; defaults to a native advisor without tools invocation. */ tools?: boolean; /** Require native enforcement of read-only tool access. Implies tools when `tools` is omitted; `tools: false` rejects the run. */ readOnly?: boolean; } /** One completed (or failed) harness run, with output capped for the model. */ export interface RunOutcome { id: HarnessId; command: string; /** Expanded arguments; the model's text keeps "{prompt}" instead, it wrote the prompt itself. */ args: string[]; model?: string; effort?: string; structured: boolean; tools: boolean; readOnly: boolean; exitCode: number | null; timedOut: boolean; aborted: boolean; /** Milliseconds without output before the run was stopped; absent when it exited on its own. */ idleMs?: number; /** Present when an advisor answer holds a tool call written as text. */ warning?: string; stdout: string; stderr: string; } /** Returned when the harness cannot be run at all. */ export interface RunFailure { error: string; known?: HarnessId[]; /** Modes accepted by the selected harness when invocation mode caused the failure. */ invocationModes?: HarnessInvocationModes; /** Explicit mode change that makes the same invocation shape executable. */ retry?: { structured: false; tools?: boolean; } | { tools: boolean; }; } /** * Runs one prompt through a harness's normalized non-interactive invocation. * * Tool use defaults to a native advisor without tools invocation. Harnesses that * cannot disable tools reject that mode; setting `tools` selects their full * agent invocation. `model` and `effort` are translated through the harness-specific recipe. * This layer also closes stdin, enforces the timeout, caps the echoed output, * and leaves the prompt out of the echoed invocation. * * @param id - Harness id to run. * @param prompt - Prompt sent to the selected harness. * @param options - Model, mode, working-directory, and timeout options. * @returns {Promise>} The capped run outcome or failure. */ export declare function runHarness(id: string, prompt: string, options?: RunOptions): Promise>; /** MCP server listings for one harness or all of them. */ export interface McpListing { harnesses: Array<{ id: HarnessId; configs: McpConfigListing[]; }>; } /** Result of one MCP config mutation. */ export interface McpMutation { id: HarnessId; path: string; action: "added" | "replaced" | "removed" | "noop"; } /** Flat tool parameters describing one MCP server, shared by every surface. */ export interface McpServerParams { name: string; transport?: McpServerConfig["transport"]; command?: string; args?: string[]; env?: Record; url?: string; headers?: Record; } /** * Builds the normalized server shape from flat tool parameters. * * @param params - Flat MCP server parameters. * @returns {McpServerConfig} The normalized server configuration. */ export declare function toMcpServerConfig(params: McpServerParams): McpServerConfig; /** * Lists configured MCP servers, normalized across harness config dialects. * * @param id - Optional harness id; omission lists every harness. * @returns {ToolResult} The normalized listing or id error. */ export declare function mcpList(id?: string): ToolResult; /** * Adds or replaces one MCP server in a harness's config. * * @param id - Target harness id. * @param params - Server parameters to normalize and write. * @param scope - User or project config scope. * @returns {ToolResult} The mutation outcome or failure. */ export declare function mcpAdd(id: string, params: McpServerParams, scope?: "user" | "project"): ToolResult; /** * Removes one MCP server from a harness's config. * * @param id - Target harness id. * @param name - Server name to remove. * @param scope - User or project config scope. * @returns {ToolResult} The mutation outcome or failure. */ export declare function mcpRemove(id: string, name: string, scope?: "user" | "project"): ToolResult; /** * Pushes the master MCP list from ~/.config/agntn/mcp.jsonc into harness configs. * A misspelled id in excludes or keep fails the run before the first write. * * @param id - Optional harness id; omission targets every harness. * @returns {ToolResult} The sync report or failure. */ export declare function mcpSync(id?: string): ToolResult; /** * Links every harness's global instructions file to the master AGENTS.md. * * @param id - Optional harness id; omission targets every harness. * @param check - Report intended changes without writing them. * @returns {ToolResult} The sync report or failure. */ export declare function agentsSync(id?: string, check?: boolean): ToolResult; /** * Synchronizes canonical Markdown prompt templates into harness destinations. * * @param id - Optional harness id; omission targets every harness. * @param check - Report intended changes without writing them. * @returns {ToolResult} The sync report or failure. */ export declare function promptsSync(id?: string, check?: boolean): ToolResult; /** * Links harness skills directories to the canonical skills directory. * * @param id - Optional harness id; omission targets every harness. * @param check - Report intended changes without writing them. * @returns {ToolResult} The sync report or failure. */ export declare function skillsSync(id?: string, check?: boolean): ToolResult; //#endregion export { type AgentsSyncReport, HARNESS_INFO_MAX_ITEMS, type HarnessInvocationModes, type PromptSyncReport, type SkillsSyncReport, type SyncReport }; //# sourceMappingURL=tool-operations.d.mts.map