import type { Skill } from "./skills.js"; /** What a definition may carry: more files or bytes are listed without their text (`files_omitted`, `text_omitted`). */ export declare const DEFINITION_LIMITS: { /** Files in one definition; the rest is counted in `files_omitted`. */ readonly max_files: 200; /** One file's text travels only up to this size. */ readonly max_file_bytes: number; /** All the text of one definition. */ readonly max_bytes: number; }; export declare const DEFINITION_KINDS: readonly ["skill", "hook"]; export type DefinitionKind = (typeof DEFINITION_KINDS)[number]; /** The virtual file that carries a hook's own block of `skillhook.yaml` (its key and the file-level `claude:` block). */ export declare const HOOK_FILE = "hook.yaml"; /** * A path inside a definition: relative, `/`-separated segments of letters, digits, `.`, `_` and `-`, none of them `.` or * `..`. A segment may start with a dot (`.claude/skills/x` is where repositories keep skills); whether dotfiles belong in * a given definition is the collector's and the installer's decision, not the path rule's. The same function lives in * src/cloud/protocol.ts, which must stay free of imports. */ export declare function isDefinitionPath(value: string): boolean; export interface DefinitionFile { /** Relative to the definition's root, with `/` separators. */ path: string; /** Hex SHA-256 of the file's bytes. */ sha256: string; bytes: number; /** The file's text, when it is UTF-8 and within the limits. */ text?: string; /** Why `text` is absent. */ text_omitted?: "binary" | "too_large"; } export interface SkillDefinition { /** Hex SHA-256 over the kind, the name and the sorted `(path, sha256)` pairs: the same files hash alike wherever they sit. */ sha256: string; kind: DefinitionKind; name: string; files: DefinitionFile[]; /** The size of every listed file, text present or not. */ bytes: number; /** Files beyond `DEFINITION_LIMITS.max_files` that were not listed. */ files_omitted?: number; } /** What a skill summary and a `skill.changed` event carry about the definition: enough to know whether the cloud has it. */ export interface DefinitionSummary { sha256: string; kind: DefinitionKind; bytes: number; files: number; } export declare function sha256Hex(data: Buffer | string): string; /** The definition's hash: over the kind, the name and the files' paths and content hashes, sorted, never over absolute paths or times. */ export declare function definitionDigest(kind: DefinitionKind, name: string, files: readonly { path: string; sha256: string; }[]): string; /** * Builds a definition from files given as bytes or text (tests, the fake cloud and the collector below share this). * Files are sorted by path; text is kept while the per-file and total limits allow and the bytes are UTF-8. */ export declare function buildDefinition(kind: DefinitionKind, name: string, files: Record, options?: { omitted?: number; }): SkillDefinition; export declare function summarizeDefinition(definition: SkillDefinition): DefinitionSummary; /** Every regular file under `dir` (no dotfiles, no symlinks, no `node_modules`), as `/`-separated relative paths, sorted. */ export declare function listDefinitionFiles(dir: string): string[]; /** A hook's own part of its `skillhook.yaml`: the file-level `claude:` block and the hook under its name, as canonical YAML. */ export declare function hookYaml(projectFileText: string, name: string): string; /** Collects a skill's whole definition, text included. Ad-hoc skills (a job's own copy) have none. */ export declare function collectDefinition(skill: Skill): SkillDefinition | undefined; /** Definitions by skill, recomputed only when one of their files changed (the registry lists skills far more often than they change). */ export declare class DefinitionCache { private readonly entries; /** The summary for `skill`, from the cache when its files are unchanged; undefined for a skill without a definition. */ summary(skill: Skill): DefinitionSummary | undefined; }