export type BodyKind = "json" | "form" | "text" | "empty" | "binary"; export interface ParsedBody { payload: unknown; kind: BodyKind; } /** Parses a request body by content type. JSON is preferred; form bodies become objects (GitHub's `payload=` form is unwrapped). */ export declare function parseBody(contentType: string | undefined, raw: Buffer): ParsedBody; /** Drops credentials and signatures before headers are stored or shown to the agent. */ export declare function redactHeaders(headers: Record): Record; /** JSON with object keys sorted at every level, so two payloads that mean the same thing serialize the same way. */ export declare function canonicalJson(value: unknown): string; export interface FingerprintInput { kind: BodyKind; payload: unknown; /** Needed for binary bodies, whose parsed payload only records the size. */ rawBody?: Buffer; /** Query parameters that reach the skill (`token` and `wait` already removed). */ query?: Record; } /** * SHA-256 over what the skill would actually see: the parsed payload (key order and whitespace ignored for JSON and * form bodies), plus the query string. Headers are left out on purpose: delivery ids, timestamps and signatures differ * on every retry of the same event. */ export declare function deliveryFingerprint(input: FingerprintInput): string; /** `webhook`: a delivery to `/hooks/`; `api`: `POST /skills//run`; `cli`: `skillhook run`; `mcp`: the MCP `run_skill` tool in-process; `schedule`: the scheduler fired a `schedule:` slot; `replay`: an operator replayed an earlier delivery or job; `test`: a SKILL.md supplied with the request (`POST /skills/test`, `skillhook run --file`). */ export type Trigger = "webhook" | "cli" | "mcp" | "api" | "schedule" | "replay" | "test" | "resume"; export declare const TRIGGERS: Trigger[]; /** Everything the skill learns about one delivery. Persisted as `event.json` in the job directory. */ export interface WebhookEvent { id: string; skill: string; trigger: Trigger; received_at: string; method: string; path: string; query: Record; /** Redacted (no auth/signature headers). */ headers: Record; source_ip: string; content_type: string | null; content_length: number; body_kind: BodyKind; delivery_id?: string; payload: unknown; }