import { z } from "zod"; import type { DefinitionSummary } from "./definitions.js"; import { type RunnerName } from "./config.js"; import { type CronSpec } from "./schedule.js"; export declare const ConditionSchema: z.ZodObject<{ path: z.ZodOptional; header: z.ZodOptional; query: z.ZodOptional; equals: z.ZodOptional; not_equals: z.ZodOptional; in: z.ZodOptional>; matches: z.ZodOptional; exists: z.ZodOptional; contains: z.ZodOptional; }, z.core.$strict>; export type Condition = z.infer; export declare const AuthSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{ type: z.ZodLiteral<"none">; allow_ips: z.ZodOptional>; }, z.core.$strict>, z.ZodObject<{ type: z.ZodLiteral<"bearer">; secret_env: z.ZodOptional; header: z.ZodOptional; allow_query_token: z.ZodOptional; allow_ips: z.ZodOptional>; }, z.core.$strict>, z.ZodObject<{ type: z.ZodLiteral<"basic">; secret_env: z.ZodOptional; allow_ips: z.ZodOptional>; }, z.core.$strict>, z.ZodObject<{ type: z.ZodLiteral<"hmac">; secret_env: z.ZodOptional; header: z.ZodOptional; prefix: z.ZodOptional; encoding: z.ZodOptional>; algorithm: z.ZodOptional>; delivery_id_header: z.ZodOptional; timestamp_header: z.ZodOptional; tolerance_seconds: z.ZodOptional; allow_ips: z.ZodOptional>; }, z.core.$strict>, z.ZodObject<{ type: z.ZodLiteral<"github">; secret_env: z.ZodOptional; allow_ips: z.ZodOptional>; }, z.core.$strict>, z.ZodObject<{ type: z.ZodLiteral<"sentry">; secret_env: z.ZodOptional; allow_ips: z.ZodOptional>; }, z.core.$strict>, z.ZodObject<{ type: z.ZodLiteral<"linear">; secret_env: z.ZodOptional; allow_ips: z.ZodOptional>; }, z.core.$strict>, z.ZodObject<{ type: z.ZodLiteral<"standard-webhooks">; secret_env: z.ZodOptional; tolerance_seconds: z.ZodOptional; allow_ips: z.ZodOptional>; }, z.core.$strict>, z.ZodObject<{ type: z.ZodLiteral<"granola">; secret_env: z.ZodOptional; tolerance_seconds: z.ZodOptional; allow_ips: z.ZodOptional>; }, z.core.$strict>, z.ZodObject<{ type: z.ZodLiteral<"svix">; secret_env: z.ZodOptional; tolerance_seconds: z.ZodOptional; allow_ips: z.ZodOptional>; }, z.core.$strict>, z.ZodObject<{ type: z.ZodLiteral<"stripe">; secret_env: z.ZodOptional; tolerance_seconds: z.ZodOptional; allow_ips: z.ZodOptional>; }, z.core.$strict>, z.ZodObject<{ type: z.ZodLiteral<"slack">; secret_env: z.ZodOptional; tolerance_seconds: z.ZodOptional; allow_ips: z.ZodOptional>; }, z.core.$strict>], "type">; export type AuthConfig = z.infer; export type AuthType = AuthConfig["type"]; export declare const AUTH_TYPES: AuthType[]; export declare const ScheduleObjectSchema: z.ZodObject<{ cron: z.ZodString; timezone: z.ZodOptional; catch_up: z.ZodOptional>; overlap: z.ZodOptional>; payload: z.ZodOptional>; }, z.core.$strict>; /** A cron expression (read in UTC), a full object, or `false` to cancel a schedule a hook would inherit from its SKILL.md. */ export declare const ScheduleSchema: z.ZodUnion, z.ZodObject<{ cron: z.ZodString; timezone: z.ZodOptional; catch_up: z.ZodOptional>; overlap: z.ZodOptional>; payload: z.ZodOptional>; }, z.core.$strict>]>; export type ScheduleConfig = z.infer; /** One MCP server a skill's runs get, in Claude Code's own `mcpServers` shape: a local command (stdio) or a remote URL. */ export declare const McpServerSchema: z.ZodObject<{ type: z.ZodOptional>; command: z.ZodOptional; args: z.ZodOptional>; env: z.ZodOptional>; url: z.ZodOptional; headers: z.ZodOptional>; }, z.core.$strict>; export type McpServer = z.infer; /** The environment variable names a skill's MCP servers refer to as `${NAME}`: they reach the run like the names in `env:`. */ export declare function mcpEnvNames(servers: Record | undefined): string[]; /** Every environment variable name a skill asks for: `env:` plus what its MCP servers refer to. */ export declare function skillEnvNames(config: { env?: string[]; claude?: { mcp_servers?: Record; }; }): string[]; /** Claude Code options of a skill (the `claude:` key of the `skillhook:` block), and of a whole `skillhook.yaml`. */ export declare const ClaudeOptionsSchema: z.ZodObject<{ permission_mode: z.ZodOptional>; allowed_tools: z.ZodOptional>; disallowed_tools: z.ZodOptional>; add_dirs: z.ZodOptional>; max_budget_usd: z.ZodOptional; append_system_prompt: z.ZodOptional; args: z.ZodOptional>; config_dir: z.ZodOptional; mcp_servers: z.ZodOptional>; command: z.ZodOptional; args: z.ZodOptional>; env: z.ZodOptional>; url: z.ZodOptional; headers: z.ZodOptional>; }, z.core.$strict>>>; strict_mcp: z.ZodOptional; }, z.core.$strict>; export type ClaudeOptions = z.infer; export declare const SkillhookBlockSchema: z.ZodObject<{ runner: z.ZodOptional>; account: z.ZodOptional]>>; model: z.ZodOptional; effort: z.ZodOptional; cwd: z.ZodOptional; timeout_seconds: z.ZodOptional; auth: z.ZodOptional; allow_ips: z.ZodOptional>; }, z.core.$strict>, z.ZodObject<{ type: z.ZodLiteral<"bearer">; secret_env: z.ZodOptional; header: z.ZodOptional; allow_query_token: z.ZodOptional; allow_ips: z.ZodOptional>; }, z.core.$strict>, z.ZodObject<{ type: z.ZodLiteral<"basic">; secret_env: z.ZodOptional; allow_ips: z.ZodOptional>; }, z.core.$strict>, z.ZodObject<{ type: z.ZodLiteral<"hmac">; secret_env: z.ZodOptional; header: z.ZodOptional; prefix: z.ZodOptional; encoding: z.ZodOptional>; algorithm: z.ZodOptional>; delivery_id_header: z.ZodOptional; timestamp_header: z.ZodOptional; tolerance_seconds: z.ZodOptional; allow_ips: z.ZodOptional>; }, z.core.$strict>, z.ZodObject<{ type: z.ZodLiteral<"github">; secret_env: z.ZodOptional; allow_ips: z.ZodOptional>; }, z.core.$strict>, z.ZodObject<{ type: z.ZodLiteral<"sentry">; secret_env: z.ZodOptional; allow_ips: z.ZodOptional>; }, z.core.$strict>, z.ZodObject<{ type: z.ZodLiteral<"linear">; secret_env: z.ZodOptional; allow_ips: z.ZodOptional>; }, z.core.$strict>, z.ZodObject<{ type: z.ZodLiteral<"standard-webhooks">; secret_env: z.ZodOptional; tolerance_seconds: z.ZodOptional; allow_ips: z.ZodOptional>; }, z.core.$strict>, z.ZodObject<{ type: z.ZodLiteral<"granola">; secret_env: z.ZodOptional; tolerance_seconds: z.ZodOptional; allow_ips: z.ZodOptional>; }, z.core.$strict>, z.ZodObject<{ type: z.ZodLiteral<"svix">; secret_env: z.ZodOptional; tolerance_seconds: z.ZodOptional; allow_ips: z.ZodOptional>; }, z.core.$strict>, z.ZodObject<{ type: z.ZodLiteral<"stripe">; secret_env: z.ZodOptional; tolerance_seconds: z.ZodOptional; allow_ips: z.ZodOptional>; }, z.core.$strict>, z.ZodObject<{ type: z.ZodLiteral<"slack">; secret_env: z.ZodOptional; tolerance_seconds: z.ZodOptional; allow_ips: z.ZodOptional>; }, z.core.$strict>], "type">>; when: z.ZodOptional; header: z.ZodOptional; query: z.ZodOptional; equals: z.ZodOptional; not_equals: z.ZodOptional; in: z.ZodOptional>; matches: z.ZodOptional; exists: z.ZodOptional; contains: z.ZodOptional; }, z.core.$strict>>>; env: z.ZodOptional>; concurrency: z.ZodOptional; serialize_cwd: z.ZodOptional; dedupe: z.ZodOptional; header: z.ZodOptional; in_flight: z.ZodOptional; }, z.core.$strict>>; claude: z.ZodOptional>; allowed_tools: z.ZodOptional>; disallowed_tools: z.ZodOptional>; add_dirs: z.ZodOptional>; max_budget_usd: z.ZodOptional; append_system_prompt: z.ZodOptional; args: z.ZodOptional>; config_dir: z.ZodOptional; mcp_servers: z.ZodOptional>; command: z.ZodOptional; args: z.ZodOptional>; env: z.ZodOptional>; url: z.ZodOptional; headers: z.ZodOptional>; }, z.core.$strict>>>; strict_mcp: z.ZodOptional; }, z.core.$strict>>; codex: z.ZodOptional>; network_access: z.ZodOptional; profile: z.ZodOptional; add_dirs: z.ZodOptional>; args: z.ZodOptional>; }, z.core.$strict>>; shell: z.ZodOptional]>; }, z.core.$strict>>; fallback: z.ZodOptional, z.ZodObject<{ runner: z.ZodEnum<{ claude: "claude"; codex: "codex"; shell: "shell"; }>; model: z.ZodOptional; effort: z.ZodOptional; account: z.ZodOptional; }, z.core.$strict>]>>; on: z.ZodOptional>>; }, z.core.$strict>>; retry: z.ZodOptional>>; backoff_seconds: z.ZodOptional; }, z.core.$strict>>; agent_api: z.ZodOptional>; human_wait_seconds: z.ZodOptional; response: z.ZodOptional>; schema: z.ZodOptional>; }, z.core.$strict>>; enabled: z.ZodOptional; schedule: z.ZodOptional, z.ZodObject<{ cron: z.ZodString; timezone: z.ZodOptional; catch_up: z.ZodOptional>; overlap: z.ZodOptional>; payload: z.ZodOptional>; }, z.core.$strict>]>>; webhook: z.ZodOptional; }, z.core.$strict>; export type SkillhookBlock = z.infer; export declare const SkillFrontmatterSchema: z.ZodObject<{ name: z.ZodString; description: z.ZodString; license: z.ZodOptional; compatibility: z.ZodOptional; metadata: z.ZodOptional>; "allowed-tools": z.ZodOptional; skillhook: z.ZodOptional>; account: z.ZodOptional]>>; model: z.ZodOptional; effort: z.ZodOptional; cwd: z.ZodOptional; timeout_seconds: z.ZodOptional; auth: z.ZodOptional; allow_ips: z.ZodOptional>; }, z.core.$strict>, z.ZodObject<{ type: z.ZodLiteral<"bearer">; secret_env: z.ZodOptional; header: z.ZodOptional; allow_query_token: z.ZodOptional; allow_ips: z.ZodOptional>; }, z.core.$strict>, z.ZodObject<{ type: z.ZodLiteral<"basic">; secret_env: z.ZodOptional; allow_ips: z.ZodOptional>; }, z.core.$strict>, z.ZodObject<{ type: z.ZodLiteral<"hmac">; secret_env: z.ZodOptional; header: z.ZodOptional; prefix: z.ZodOptional; encoding: z.ZodOptional>; algorithm: z.ZodOptional>; delivery_id_header: z.ZodOptional; timestamp_header: z.ZodOptional; tolerance_seconds: z.ZodOptional; allow_ips: z.ZodOptional>; }, z.core.$strict>, z.ZodObject<{ type: z.ZodLiteral<"github">; secret_env: z.ZodOptional; allow_ips: z.ZodOptional>; }, z.core.$strict>, z.ZodObject<{ type: z.ZodLiteral<"sentry">; secret_env: z.ZodOptional; allow_ips: z.ZodOptional>; }, z.core.$strict>, z.ZodObject<{ type: z.ZodLiteral<"linear">; secret_env: z.ZodOptional; allow_ips: z.ZodOptional>; }, z.core.$strict>, z.ZodObject<{ type: z.ZodLiteral<"standard-webhooks">; secret_env: z.ZodOptional; tolerance_seconds: z.ZodOptional; allow_ips: z.ZodOptional>; }, z.core.$strict>, z.ZodObject<{ type: z.ZodLiteral<"granola">; secret_env: z.ZodOptional; tolerance_seconds: z.ZodOptional; allow_ips: z.ZodOptional>; }, z.core.$strict>, z.ZodObject<{ type: z.ZodLiteral<"svix">; secret_env: z.ZodOptional; tolerance_seconds: z.ZodOptional; allow_ips: z.ZodOptional>; }, z.core.$strict>, z.ZodObject<{ type: z.ZodLiteral<"stripe">; secret_env: z.ZodOptional; tolerance_seconds: z.ZodOptional; allow_ips: z.ZodOptional>; }, z.core.$strict>, z.ZodObject<{ type: z.ZodLiteral<"slack">; secret_env: z.ZodOptional; tolerance_seconds: z.ZodOptional; allow_ips: z.ZodOptional>; }, z.core.$strict>], "type">>; when: z.ZodOptional; header: z.ZodOptional; query: z.ZodOptional; equals: z.ZodOptional; not_equals: z.ZodOptional; in: z.ZodOptional>; matches: z.ZodOptional; exists: z.ZodOptional; contains: z.ZodOptional; }, z.core.$strict>>>; env: z.ZodOptional>; concurrency: z.ZodOptional; serialize_cwd: z.ZodOptional; dedupe: z.ZodOptional; header: z.ZodOptional; in_flight: z.ZodOptional; }, z.core.$strict>>; claude: z.ZodOptional>; allowed_tools: z.ZodOptional>; disallowed_tools: z.ZodOptional>; add_dirs: z.ZodOptional>; max_budget_usd: z.ZodOptional; append_system_prompt: z.ZodOptional; args: z.ZodOptional>; config_dir: z.ZodOptional; mcp_servers: z.ZodOptional>; command: z.ZodOptional; args: z.ZodOptional>; env: z.ZodOptional>; url: z.ZodOptional; headers: z.ZodOptional>; }, z.core.$strict>>>; strict_mcp: z.ZodOptional; }, z.core.$strict>>; codex: z.ZodOptional>; network_access: z.ZodOptional; profile: z.ZodOptional; add_dirs: z.ZodOptional>; args: z.ZodOptional>; }, z.core.$strict>>; shell: z.ZodOptional]>; }, z.core.$strict>>; fallback: z.ZodOptional, z.ZodObject<{ runner: z.ZodEnum<{ claude: "claude"; codex: "codex"; shell: "shell"; }>; model: z.ZodOptional; effort: z.ZodOptional; account: z.ZodOptional; }, z.core.$strict>]>>; on: z.ZodOptional>>; }, z.core.$strict>>; retry: z.ZodOptional>>; backoff_seconds: z.ZodOptional; }, z.core.$strict>>; agent_api: z.ZodOptional>; human_wait_seconds: z.ZodOptional; response: z.ZodOptional>; schema: z.ZodOptional>; }, z.core.$strict>>; enabled: z.ZodOptional; schedule: z.ZodOptional, z.ZodObject<{ cron: z.ZodString; timezone: z.ZodOptional; catch_up: z.ZodOptional>; overlap: z.ZodOptional>; payload: z.ZodOptional>; }, z.core.$strict>]>>; webhook: z.ZodOptional; }, z.core.$strict>>; }, z.core.$loose>; export type NormalizedAuth = { type: "none"; allow_ips?: string[]; } | { type: "bearer"; secret_env: string; header: string; allow_query_token: boolean; allow_ips?: string[]; } | { type: "basic"; secret_env: string; allow_ips?: string[]; } | { type: "hmac"; secret_env: string; header: string; prefix: string; encoding: "hex" | "base64"; algorithm: "sha256" | "sha1" | "sha512"; delivery_id_header?: string; timestamp_header?: string; tolerance_seconds: number; preset?: "github" | "sentry" | "linear"; allow_ips?: string[]; } | { type: "standard-webhooks"; secret_env: string; tolerance_seconds: number; preset?: "granola" | "svix"; allow_ips?: string[]; } | { type: "stripe"; secret_env: string; tolerance_seconds: number; allow_ips?: string[]; } | { type: "slack"; secret_env: string; tolerance_seconds: number; allow_ips?: string[]; }; export declare const DEFAULT_TOLERANCE_SECONDS = 300; export declare function normalizeAuth(skillName: string, auth: AuthConfig | undefined): NormalizedAuth; export interface NormalizedSchedule { /** The expression as written (aliases expanded). */ cron: string; timezone: string; catch_up: "latest" | "all" | "none"; overlap: "skip" | "queue"; payload?: Record; spec: CronSpec; } /** Parses and validates a `schedule:` value; throws `SkillError` so an unusable schedule stops the skill from loading rather than silently never firing. */ export declare function normalizeSchedule(skillName: string, schedule: ScheduleConfig | undefined, dir: string): NormalizedSchedule | undefined; /** The `schedule` and `webhook` fields of a `Skill`, validated together: a hook that is neither reachable nor scheduled can never run. */ export declare function resolveSchedule(skillName: string, config: SkillhookBlock, dir: string): { schedule?: NormalizedSchedule; webhook: boolean; }; /** Human-readable description of what a sender must do to authenticate. */ export declare function describeAuth(auth: NormalizedAuth): string; /** Where a skill came from: its own directory under `/skills`, a hook in a linked project's `skillhook.yaml`, or a definition Skillhook Cloud assigned to this machine. */ export type SkillSource = { type: "home"; } | { /** A cloud-managed skill: the definition with this hash, pulled from Skillhook Cloud into `/cloud-skills` (docs/cloud.md#cloud-managed-skills). */ type: "cloud"; sha256: string; installed_at: string; } | { type: "project"; /** The project (repository) directory. */ dir: string; /** The `skillhook.yaml` that defines the hook. */ file: string; /** How the hook is implemented: a `SKILL.md` in the project, an inline `prompt`, or a shell command (`run`). */ kind: "skill" | "prompt" | "run"; /** For a `skill` hook that refers to a skill declared under `skills:` (`skill: "@name"`): that name. */ skill?: string; } | { /** A SKILL.md supplied with the request and kept in the job directory (`jobs//skill//`); never in the registry. */ type: "adhoc"; job: string; }; export interface Skill { name: string; description: string; /** Directory whose files the agent may use (`--add-dir`, `{{skill_dir}}`): the skill directory, or the project directory for `run`/`prompt` hooks. */ dir: string; /** The file that defines the skill: `SKILL.md`, or the project's `skillhook.yaml` for `run`/`prompt` hooks. */ file: string; /** Markdown instructions (frontmatter removed). */ body: string; frontmatter: Record; config: SkillhookBlock; auth: NormalizedAuth; /** The cron schedule this skill runs on, when it has one (`schedule:` in the block). */ schedule?: NormalizedSchedule; /** False for schedule-only skills (`webhook: false`): `POST /hooks/` answers 404 and no secret is required. */ webhook: boolean; /** From the standard `allowed-tools` frontmatter field, mapped to `claude --allowedTools`. */ allowedTools: string[]; enabled: boolean; /** Set when the file exists but is invalid; the skill is then not routable. */ error?: string; mtimeMs: number; source: SkillSource; /** The content hash of the files that define the skill (src/definitions.ts), set by the registry; absent for an ad-hoc skill. */ definition?: DefinitionSummary; } export declare class SkillError extends Error { readonly dir: string; constructor(message: string, dir: string); } export declare function skillFile(dir: string): string; export declare function parseSkillDocument(text: string, dir: string): Skill; export declare function loadSkill(dir: string): Skill; /** The SKILL.md an ad-hoc job keeps in its directory (`//SKILL.md`), loaded from there rather than from the registry. */ export declare function loadAdhocSkill(skillDir: string, jobId: string, name: string): Skill; export interface SkillLoadResult { skills: Skill[]; errors: { dir: string; name: string; error: string; }[]; } export declare function loadSkills(skillsDir: string): SkillLoadResult; /** Frontmatter + body for a freshly scaffolded skill. */ export declare function renderSkillTemplate(options: { name: string; description: string; runner?: RunnerName; model?: string; authType?: AuthType; cwd?: string; instructions?: string; }): string;