/** * Knowledge-pack loader. * * A knowledge pack is a markdown document with a YAML-ish frontmatter that * declares metadata. Packs can be loaded from local paths, HTTPS URLs, or * inline strings. The loader: * 1. Fetches the content * 2. Parses frontmatter * 3. Splits the body into heading-scoped chunks (~500–1500 chars) * 4. Embeds each chunk * 5. Stores pack + chunks in the memory DB * * Packs show up as `pack_chunk` memory matches in subsequent optimize calls, * scored by the curator like any other grounding source. This is the * community-facing surface of 1.3. */ import type { MemoryScope, Pack } from './types.js'; export interface LoadPackOptions { source: string; sourceType?: 'auto' | 'local' | 'url' | 'inline' | 'registry'; scope?: MemoryScope; name?: string; version?: string; } export interface LoadPackResult { pack: Pack; chunks: number; embedded: number; skipped: number; } export interface PackFrontmatter { name?: string; version?: string; description?: string; scope?: string; author?: string; license?: string; tags?: string[]; } export interface ParsedPack { frontmatter: PackFrontmatter; body: string; } /** Parse `--- frontmatter --- body` markdown. YAML-lite, no deps. */ export declare function parsePackSource(raw: string): ParsedPack; /** * Split markdown body into heading-scoped chunks. Keeps under ~1500 chars * each; bodies below a heading that exceed the limit get further split by * paragraph. */ export declare function chunkPackBody(body: string, maxChars?: number): { heading?: string; content: string; }[]; /** High-level loader — the function called by the MCP tool. */ export declare function loadKnowledgePack(opts: LoadPackOptions): Promise;