import { z } from "zod"; import { type FleetClient } from "./api.js"; export declare const CatalogToolSchema: z.ZodObject<{ name: z.ZodString; title: z.ZodOptional>; description: z.ZodString; scope: z.ZodOptional>; kind: z.ZodOptional>; allowed: z.ZodOptional>; input_schema: z.ZodObject<{ type: z.ZodLiteral<"object">; properties: z.ZodOptional>>; required: z.ZodOptional>; }, z.core.$loose>; }, z.core.$loose>; export type CatalogTool = z.infer; /** The shape of the catalogue this version reads; a cloud that changes the shape (not the tools) raises it. */ export declare const CATALOG_VERSION = 1; declare const ListingSchema: z.ZodObject<{ version: z.ZodOptional>; instructions: z.ZodOptional>; organisation: z.ZodOptional>; }, z.core.$loose>>>; key: z.ZodOptional>; scopes: z.ZodOptional>>; role: z.ZodOptional>; }, z.core.$loose>>>; tools: z.ZodArray; }, z.core.$loose>; type Listing = z.infer; export interface Catalog { version?: Listing["version"]; instructions?: Listing["instructions"]; organisation?: Listing["organisation"]; key?: Listing["key"]; tools: CatalogTool[]; } /** * The catalogue as this key sees it: the tools this version can read (one it cannot, a malformed schema included, is * skipped, not fatal; a name listed twice counts once). A cloud from before the catalogue, or with a newer shape of it, * says so. */ export declare function fetchCatalog(client: FleetClient, options?: { timeoutMs?: number; }): Promise; /** How long a call may take: what it waits for a machine (`wait_seconds`) plus the cloud's own wait for a command. */ export declare function callTimeoutMs(input: Record): number; /** Runs one operation; its result is the cloud's answer as it came. */ export declare function callTool(client: FleetClient, name: string, input: Record): Promise>; /** `list-jobs` and `List_Jobs` are `list_jobs`. */ export declare function toolName(given: string): string; export interface ToolParameter { /** As the tool names it (`wait_seconds`). */ name: string; /** As a flag (`--wait-seconds`; `--wait_seconds` works too). */ flag: string; /** `json`: an object, an array or any value (a payload), given as JSON, `@file` or `-` for stdin. */ kind: "string" | "integer" | "number" | "boolean" | "json"; required: boolean; description: string | null; choices: string[] | null; } export declare function toolParameters(tool: CatalogTool): ToolParameter[]; export declare class ToolInputError extends Error { constructor(message: string); } export interface InputSources { stdin: () => Promise; file: (path: string) => string; } /** * Which of skillhook's own options a word is, read exactly as every command reads it (`parseArgs` in * src/commands/shared.ts): `--json`, `--no-json`, `--dir=PATH`, `-h`…; and whether it takes the next word as its value * (`--dir PATH`, but not `--dir --json`). */ export declare function ownOption(word: string, next: string | undefined): { name: string; takesNext: boolean; } | undefined; /** The first word from `from` on that is neither one of skillhook's own options nor the value one takes. */ export declare function afterOwnOptions(words: string[], from?: number): number; /** * A tool's input from the words after its name, read with its schema: `--param value` or `--param=value` (a text * parameter takes the next word, even one that starts with a dash, unless it is one of skillhook's own options: those, * `--json`, `--help`/`-h`, `--version`/`-v`, `--dir`/`--home`, mean the same everywhere, so such a text is given as * `--param=--json`), booleans as switches (`--param`, `--no-param`, `--param=false`), numbers checked, JSON parameters * (objects, payloads) as a literal, `@file` or `-`, `--param-file PATH` for a long text, `--input JSON|@file|-` for the * whole input (flags win over it), and the required parameters not given as flags from the remaining arguments, in * order. `--` ends the flags. */ export declare function toolInput(tool: CatalogTool, tokens: string[], sources: InputSources): Promise>; /** `skillhook cloud tools `: how to call it from the command line. */ export declare function toolUsage(tool: CatalogTool): string; /** A tool's answer as indented `key: value` lines: lists as `- ` items, text with newlines as an indented block. */ export declare function renderResult(value: unknown): string; export {};