import type { Config, RunnerName } from "./config.js"; import type { JobRecord, JobStore } from "./jobs.js"; import { type BodyKind, type Trigger, type WebhookEvent } from "./payload.js"; import type { JobAnswer, JobQuestion } from "./progress.js"; import { type Skill } from "./skills.js"; export interface ManualRunInput { skill: Skill; payload: unknown; headers?: Record; query?: Record; trigger: Trigger; overrides?: { runner?: RunnerName; model?: string; effort?: string; cwd?: string; account?: string; }; /** Recorded on the job and the event; the caller is responsible for `rememberDelivery`. The scheduler uses `schedule:`. */ deliveryId?: string; /** `source.method` on the job (default `LOCAL`; the scheduler writes `SCHEDULE`, replays `REPLAY`). */ sourceMethod?: string; /** `source.ip` and `event.source_ip` (default `127.0.0.1`; a replay keeps the original sender's). */ sourceIp?: string; /** What this run replays, when it is a replay. */ replayOf?: { delivery?: string; job?: string; }; /** The body as originally received, when it should be reproduced exactly (kind, content type, raw bytes for binary bodies). */ body?: { kind: BodyKind; contentType: string | null; raw?: Buffer; }; /** Use this id instead of a fresh one (an ad-hoc run names its skill directory after the job before creating it). */ jobId?: string; /** The SKILL.md came with the request and lives in the job directory. */ adhoc?: true; /** For `trigger: resume`: the job a person answered, the session to continue (when it has one), what was asked and answered, why it cannot be resumed when it cannot, and the title the job had. */ resume?: { of: string; session?: { session_id: string; runner: RunnerName; }; question?: JobQuestion; answer: JobAnswer; runnerReason?: string; title?: string; }; } export declare function buildManualEvent(input: ManualRunInput, id?: string): WebhookEvent; /** Creates (but does not enqueue) a job for a run that did not arrive over HTTP. Needs only the config and the job store, so the scheduler can call it with the server's own instances. */ export declare function createManualJob(ops: { config: Config; store: JobStore; }, input: ManualRunInput, store?: JobStore): JobRecord; export interface AdhocRunInput { /** The complete SKILL.md text, frontmatter included. */ skillMd: string; payload: unknown; headers?: Record; overrides?: ManualRunInput["overrides"]; } /** * A job for a SKILL.md that is not installed (`POST /skills/test`, `skillhook run --file`): the document is validated, * the job is created with `trigger: test`, and the file is written to `jobs//skill//SKILL.md`, where the queue * loads it from (the server writes nothing outside the jobs directory). Throws `SkillError` for an invalid document. */ export declare function createAdhocJob(ops: { config: Config; store: JobStore; }, input: AdhocRunInput): { job: JobRecord; skill: Skill; };