/** * Shape of the ssh_exec summary: what became of every command that was sent, * and what it printed. * * The summary travels beside the text, and the output rides in it rather than * only in the text: a client that declares a schema shows the caller the * fields alone, so output left in the text reaches nobody. */ import type { Tool } from '@modelcontextprotocol/sdk/types.js'; import { type Legend } from './legend.js'; type OutputSchema = NonNullable; /** * What became of one command. * * `exit_code` is the whole answer to "did it run": a number means the command * reported back, `null` means it did not. The flags only say why — otherwise * a blocked command would have to choose between `not_run: false`, which * reads as "it ran", and stretching "we never got to it" over a case that has * a name of its own. */ export interface CommandSummary { command: string; exit_code: number | null; truncated: boolean; /** Stopped by a timeout guard: the server's one reports a code, ours leaves `exit_code` null */ timed_out: boolean; blocked: boolean; /** What the removal guard objected to; `null` when it did not object */ blocked_reason: string | null; not_run: boolean; /** Warning about what this command does, tied to the command it speaks about */ warning: string | null; /** * What the command printed. Only a command that ran carries these: an empty * string means it ran and said nothing, while a command that never ran has * no field at all — otherwise the two would read the same. */ stdout?: string; stderr?: string; /** Bytes cut out of the middle to fit; `0` — both streams arrived whole */ clipped_bytes?: number; } /** The answer of one ssh_exec call */ export interface ExecSummary { commands: CommandSummary[]; /** Job started by detach; `null` when the call waited for the answer itself */ job_id: string | null; legend: Legend; } /** The answer, with an explanation only for what this one actually did */ export declare function execSummary(commands: CommandSummary[], jobId: string | null): ExecSummary; /** * A command that ran and reported back, output included. * * Output cut by the transport buffer keeps only its head: there the end of * what arrived is not the end of what the command printed, and a tail would * pass the buffer's edge off as the command's own last word. */ export declare function executedCommand(command: string, result: { exitCode: number; truncated: boolean; stdout?: string; stderr?: string; }, warning: string | null): CommandSummary; /** * A command that started and never reported back. * * On `timeout` it may still be running on the server: we stopped waiting, the * command did not stop. On `interrupted` the call itself ended — cancelled by * the caller, or the connection dropped. */ export declare function stoppedCommand(command: string, warning: string | null, cause: 'timeout' | 'interrupted'): CommandSummary; /** A command running in the background: it was started, and there is no code yet */ export declare function startedCommand(command: string, warning: string | null): CommandSummary; /** A command the removal guard refused; the whole call stops with it */ export declare function blockedCommand(command: string, reason: string, warning: string | null): CommandSummary; /** A command that was never sent: the call ended before it */ export declare function notRunCommand(command: string, warning: string | null): CommandSummary; export declare const EXEC_OUTPUT_SCHEMA: OutputSchema; export {};