import type { RunnerName } from "./config.js"; import type { JobRecord, JobStatus } from "./jobs.js"; import { type ResponseLink } from "./reporting.js"; import type { Skill } from "./skills.js"; export type JobOutcome = "completed" | "partial" | "needs_human" | "nothing_to_do" | "failed" | "unknown"; export declare const JOB_OUTCOMES: JobOutcome[]; /** What an agent may report; `unknown` is what skillhook records when it reported nothing. */ export declare const REPORTABLE_OUTCOMES: JobOutcome[]; export interface JobResponse { outcome: JobOutcome; /** What the job was about, in a few words ("Fix the 500 on /api/sync"); shown instead of the skill's name. Becomes `job.title`. */ title?: string; /** The result in one line, at most 280 characters: what a person sees first in a list. */ headline?: string; /** One paragraph (Markdown welcome) for a person: what was done, what was found, what remains. */ summary: string; /** Where to look: bare URLs, or `{url, title, kind}` (the event's source, pull requests, tickets, messages, documents, deployments, how to test). */ links?: ResponseLink[]; /** With `needs_human`: what the person can pick from (Skillhook Cloud shows buttons); the pick resumes the session. */ options?: string[]; /** The option the agent suggests. */ recommended?: string; /** The person may pick several options. */ multiple?: boolean; /** Structured details for other systems; capped inline, complete in `response.json`. */ data?: unknown; } export declare const RESPONSE_FILE = "response.json"; export declare const RESPONSE_SCHEMA_FILE = "response.schema.json"; /** The JSON Schema a structured run must answer with unless the skill brings its own (`response.schema`). */ export declare const DEFAULT_RESPONSE_SCHEMA: Record; export declare function responseSchemaFor(skill: Skill): Record; /** * Turns what an agent reported (structured output or `response.json`) into a `JobResponse`. A custom schema without * `outcome`/`summary` keeps the whole object as `data` and takes the outcome from how the run ended; its fields are * never read as a title, links or choices. */ export declare function parseResponseObject(value: unknown, fallback: { ok: boolean; result?: string; }): JobResponse | undefined; export interface ReportInput { outcome: JobOutcome; summary: string; title?: string; headline?: string; links?: unknown[]; options?: string[]; recommended?: string; multiple?: boolean; data?: unknown; } /** * The `response.json` the job API writes for `job_set_outcome` / `skillhook job outcome`: the same normalization as a * file the agent writes itself, except that `data` is kept whole (only the copy on the job record is capped). */ export declare function buildResponse(input: ReportInput): JobResponse; /** The parsed `response.json` of a job directory, or undefined when absent, too large or not JSON. */ export declare function readResponseFile(jobDir: string): unknown; export declare function resolveJobResponse(input: { jobDir: string; structured?: unknown; ok: boolean; result?: string; }): JobResponse | undefined; /** The outcome to record for a job that reached `status`; undefined while it is still queued or running. */ export declare function deriveOutcome(status: JobStatus, runner: RunnerName, response?: JobResponse): JobOutcome | undefined; /** A job's outcome, derived for records written before outcomes existed. */ export declare function jobOutcome(job: Pick): JobOutcome | undefined;