UNPKG

@mastra/core

Version:

Mastra is a framework for building AI-powered applications and agents with a modern TypeScript stack.

61 lines 2.9 kB
import type { BlobStore } from '../../storage/domains/blobs/base.js'; import type { SkillVersionTree, StorageBlobEntry, StorageSkillFileNode, StorageSkillSnapshotType } from '../../storage/types.js'; import type { SkillSource } from './skill-source.js'; /** * Result of collecting a skill's filesystem tree. * Contains the tree manifest, the blob entries to store, and parsed SKILL.md fields. */ export interface SkillPublishResult { /** Denormalized snapshot fields parsed from SKILL.md frontmatter */ snapshot: Omit<StorageSkillSnapshotType, 'tree'>; /** Content-addressable file tree manifest */ tree: SkillVersionTree; /** Blob entries to store (already deduplicated by hash) */ blobs: StorageBlobEntry[]; /** UI-facing nested file tree (folders + files with content) for the stored skill record */ files: StorageSkillFileNode[]; } /** * A flat file entry used by snapshot parsing helpers. * Path is the skill-relative path (e.g. `SKILL.md`, `references/foo.md`). */ export interface SkillSnapshotFile { path: string; content: string | Buffer; } /** * Parse a flat array of skill files into a denormalized snapshot. * * Finds `SKILL.md`, parses its YAML frontmatter into structured fields * (name, description, license, compatibility, metadata), and uses the * markdown body as `instructions`. Discovers `references/`, `scripts/`, * and `assets/` subdirectory paths from the file list. * * Used by both the publish flow (which has files from a SkillSource walk) * and the registry install flow (which has files fetched from an external * registry like skills.sh). The Agent Skills spec puts metadata in * frontmatter and agent-facing prose in the body — this helper enforces * that split so frontmatter never leaks into the runtime instructions. * * @throws if `SKILL.md` is missing from the file list */ export declare function parseSkillSnapshotFromFiles(files: SkillSnapshotFile[]): Omit<StorageSkillSnapshotType, 'tree'>; /** * Collect a skill from a SkillSource for publishing. * Walks the skill directory, hashes all files, parses SKILL.md frontmatter, * and returns everything needed to create a new version. * * @param source - The SkillSource to read from (live filesystem or any other source) * @param skillPath - Path to the skill directory (containing SKILL.md) */ export declare function collectSkillForPublish(source: SkillSource, skillPath: string): Promise<SkillPublishResult>; /** * Publish a skill: collect files, store blobs, create version. * This is the full publish flow. * * @param source - The SkillSource to read from * @param skillPath - Path to the skill directory * @param blobStore - Where to store file blobs */ export declare function publishSkillFromSource(source: SkillSource, skillPath: string, blobStore: BlobStore): Promise<SkillPublishResult>; //# sourceMappingURL=publish.d.ts.map