import type { CompiledWorkspaceResourceRoot } from "#compiler/manifest.js"; import type { RuntimeCompiledArtifactsSource } from "#runtime/compiled-artifacts-source.js"; /** Largest skill file `readSkill` returns. */ export declare const MAX_SKILL_FILE_BYTES: number; /** Canonical file name of a skill package's entry markdown. */ export declare const SKILL_ENTRY_FILE_NAME = "SKILL.md"; /** * Whether a file name is a skill's entry markdown. Discovery accepts any case * variant, such as `skill.md`, and materialization keeps the authored name. */ export declare function isSkillEntryFileName(name: string): boolean; export type SkillReadErrorCode = "invalid-path" | "too-large" | "unavailable" | "unknown-file" | "unknown-skill"; /** Thrown by `readSkill`. `code` lets a channel map the failure onto its own protocol. */ export declare class SkillReadError extends Error { readonly code: SkillReadErrorCode; constructor(code: SkillReadErrorCode, message: string); } /** One regular file of a skill: its `/`-separated path under the skill root and its size. */ export interface SkillFileEntry { readonly path: string; readonly size: number; } /** * Lookup into the compiled skill files of one agent. Paths are `/`-separated * and relative to the skill root, e.g. `SKILL.md` or `references/api.md`. */ export interface SkillFileSource { /** Regular files of one skill, sorted by path. Empty when the skill has no materialized files. */ listFiles(skill: string): Promise; /** * Every directory of one skill below its root, sorted by path, including * empty ones that no listed file implies. */ listDirectories(skill: string): Promise; readFile(skill: string, path: string): Promise; } /** Nitro `serverAssets` base that holds the root agent's shipped skill files. */ export declare const SKILL_FILES_SERVER_ASSET_BASE = "eve-skills"; /** Nitro `serverAssets` base that holds {@link SKILL_FILES_INDEX_KEY}. */ export declare const SKILL_FILES_INDEX_SERVER_ASSET_BASE = "eve-skill-index"; /** Key of the skill file index inside {@link SKILL_FILES_INDEX_SERVER_ASSET_BASE}. */ export declare const SKILL_FILES_INDEX_KEY = "skills.json"; /** * One indexed file: `[path, size, sha256]`. `sha256` is `null` for files over * {@link MAX_SKILL_FILE_BYTES}, which are listed but not shipped. A shipped * file's storage key is {@link skillFileStorageKey} of its digest. */ export type SkillFilesIndexEntry = readonly [path: string, size: number, sha256: string | null]; /** * Index of the skill files a production build ships, written by `eve build`. * eve owns the listing rather than deriving it from storage keys, so real * paths never pass through unstorage key normalization. Entries are arrays, * not object keys, so names such as `__proto__` stay plain data. */ export interface SkillFilesIndex { readonly version: 1; /** `[skill, files, directories]`, sorted by skill then path. */ readonly skills: readonly (readonly [ skill: string, files: readonly SkillFilesIndexEntry[], directories: readonly string[] ])[]; } /** * Storage key of a shipped skill file: its SHA-256 with a `.bin` name. `.bin` * makes Nitro inline the file as a `Uint8Array` whatever its real extension, * and a hex name is left unchanged by unstorage key normalization. */ export declare function skillFileStorageKey(sha256: string): string; /** The subset of an unstorage `Storage` the server asset source reads with. */ export interface SkillFileStorage { getItemRaw(key: string): Promise; } /** Opens a Nitro server asset storage, e.g. `useStorage("assets:eve-skills")`. */ export type OpenSkillFileStorage = (base: string) => Promise; /** * Selects the skill file source for the active compiled artifacts. * * Skill files are materialized under the node's workspace resource root by * `compiler/workspace-resources.ts`. Disk artifacts (dev) read that tree with * {@link createDiskSkillFileSource}; bundled artifacts (production builds) * read the Nitro server assets `eve build` registers for the root agent. */ export declare function createCompiledSkillFileSource(input: { readonly compiledArtifactsSource: RuntimeCompiledArtifactsSource; readonly workspaceResourceRoot: CompiledWorkspaceResourceRoot; readonly openStorage?: OpenSkillFileStorage; }): SkillFileSource; /** * Reads skill files from a materialized `skills//` tree. * * Only regular files reached through real directories are served: a * symlinked skill root lists nothing, listing skips symlinks, every path * component is checked with `lstat` before opening, the leaf is opened with * `O_NOFOLLOW` where the platform defines it, and the `realpath` of the * target must stay under the `realpath` of the skill root. These checks are * not atomic; the tree is the app's own compile output, so a writer that * could race them can already change what is served. */ export declare function createDiskSkillFileSource(skillsRoot: string): SkillFileSource; /** * Reads one file of one skill, byte for byte, given any caller-supplied path. * * With no `path`, reads the skill's entry markdown under whatever case variant * of `SKILL.md` it was authored with. An explicit top-level `SKILL.md` matches * the entry file case-insensitively too; every other path must match a listed * file exactly. Files over {@link MAX_SKILL_FILE_BYTES} are `too-large`. */ export declare function readSkillFile(input: { readonly path?: string; readonly skill: string; readonly source: SkillFileSource; }): Promise; export declare function comparePaths(left: string, right: string): number;