/** * Shape of the summary for background jobs: ssh_job_status and ssh_job_list. * * The four outcomes differ in what the caller does next, and in the text they * differ only by wording: `lost` means the job is gone and left no code, * `missing` means the server has no such job at all. A field says which is * which without reading the sentence. */ import type { Tool } from '@modelcontextprotocol/sdk/types.js'; import type { JobState } from '../utils/job-command.js'; import { type Legend } from './legend.js'; type OutputSchema = NonNullable; export interface JobEntry { id: string; state: JobState; /** Only a finished job reports one; `null` everywhere else */ exit_code: number | null; pid: number | null; /** Start time in seconds since the epoch; `null` when the server did not record it */ started_at: number | null; /** * The last lines the job wrote, when they were asked for. A status call * carries them; a listing of thirty jobs does not, and leaves the field out. */ output_tail?: string[]; } /** The answer of one call about jobs */ export interface JobsSummary { jobs: JobEntry[]; legend: Legend; } /** * The answer, legend included: a list of thirty jobs in four states costs * four explanations, and the caller cannot end up with a state nobody named. */ export declare function jobsSummary(jobs: JobEntry[]): JobsSummary; /** One job, as its own status line words it */ export declare function jobEntry(id: string, job: { state: JobState; exitCode?: number; pid?: number; startedAt?: number; outputTail?: string[]; }): JobEntry; export declare const JOBS_OUTPUT_SCHEMA: OutputSchema; /** * Shape of the ssh_job_kill answer. * * Five outcomes lead to five different next steps, and the text tells them * apart by wording alone. `no-answer` is the one that must not be read as * success: the server said nothing, so whether the job still runs is unknown. */ export type KillOutcome = 'signalled' | 'gone' | 'nopid' | 'missing' | 'no-answer'; export interface KillSummary { id: string; outcome: KillOutcome; /** The signal that was sent, after the requested one was checked against the allowed pair */ signal: 'TERM' | 'KILL'; /** What the server said when nothing was signalled; `null` after a sent signal */ reason: string | null; legend: Legend; } /** The outcome of one stop request, as the kill answer words it */ export declare function killSummary(id: string, signal: 'TERM' | 'KILL', killed: { killed: boolean; reason?: string; }): KillSummary; export declare const KILL_OUTPUT_SCHEMA: OutputSchema; export {};