/** * A — Artifacts namespace. * * Artifact lifecycle management: publish, snapshot, save, load, and transforms. * Compose with .pipe() (chain). * * Usage: * agent.artifacts(A.publish("report.md", { fromKey: "report" })) * A.publish("data.json", { fromKey: "result" }).pipe(A.snapshot("data.json", { intoKey: "cached" })) */ import type { StatePredicate } from "../core/types.js"; import { STransform } from "./state.js"; import { CTransform } from "./context.js"; /** Descriptor for a single artifact operation. */ export interface ArtifactSpec { type: string; config: Record; } /** A composable artifact operation descriptor. */ export declare class AComposite { readonly ops: ArtifactSpec[]; constructor(ops: ArtifactSpec[]); /** Chain: add another artifact operation. */ pipe(other: AComposite): AComposite; /** Convert to a flat array for passing to builder. */ toArray(): ArtifactSpec[]; } /** MIME type constants. */ declare class MimeConstants { readonly text = "text/plain"; readonly markdown = "text/markdown"; readonly html = "text/html"; readonly csv = "text/csv"; readonly json = "application/json"; readonly xml = "application/xml"; readonly yaml = "application/yaml"; readonly pdf = "application/pdf"; readonly png = "image/png"; readonly jpeg = "image/jpeg"; readonly gif = "image/gif"; readonly webp = "image/webp"; readonly svg = "image/svg+xml"; readonly mp3 = "audio/mpeg"; readonly wav = "audio/wav"; readonly ogg = "audio/ogg"; readonly mp4 = "video/mp4"; readonly webm = "video/webm"; readonly binary = "application/octet-stream"; } /** Tool factories for LLM artifact interaction. */ declare class ToolFactory { /** Create a FunctionTool for saving artifacts. */ save(opts?: { name?: string; mime?: string; allowed?: string[]; scope?: string; }): AComposite; /** Create a FunctionTool for loading artifacts. */ load(opts?: { name?: string; scope?: string; }): AComposite; /** Create a FunctionTool for listing artifacts. */ list(opts?: { name?: string; scope?: string; }): AComposite; /** Create a FunctionTool for checking artifact version metadata. */ version(opts?: { name?: string; scope?: string; }): AComposite; } /** * A namespace — artifact lifecycle factories. * * All 17 methods + mime constants + tool sub-namespace from the Python A namespace. */ export declare class A { /** MIME type constants. */ static readonly mime: MimeConstants; /** Tool factories for LLM artifact interaction. */ static readonly tool: ToolFactory; /** Publish state[fromKey] to an artifact file. */ static publish(filename: string, opts?: { fromKey?: string; mime?: string; metadata?: Record; scope?: string; }): AComposite; /** Snapshot an artifact into state[intoKey]. */ static snapshot(filename: string, opts?: { intoKey?: string; version?: number; decode?: boolean; scope?: string; }): AComposite; /** Save literal content to an artifact (no state bridge). */ static save(filename: string, opts?: { content?: string | Uint8Array; mime?: string; metadata?: Record; scope?: string; }): AComposite; /** Load an artifact for pipeline use (no state bridge). */ static load(filename: string, opts?: { scope?: string; }): AComposite; /** List artifact filenames into state[intoKey]. */ static list(opts?: { intoKey?: string; }): AComposite; /** Get artifact version metadata into state[intoKey]. */ static version(filename: string, opts?: { intoKey?: string; }): AComposite; /** Delete all versions of an artifact. */ static delete(filename: string): AComposite; /** Batch publish multiple (filename, fromKey) pairs. */ static publishMany(pairs: Array<[string, string]>, opts?: { mime?: string; scope?: string; }): AComposite; /** Batch snapshot multiple (filename, intoKey) pairs. */ static snapshotMany(pairs: Array<[string, string]>, opts?: { scope?: string; }): AComposite; /** Parse JSON string in state[key] to object. */ static asJson(key: string): STransform; /** Parse CSV string in state[key] to array of objects. */ static asCsv(key: string, opts?: { columns?: string[]; }): STransform; /** Ensure state[key] is a decoded string. */ static asText(key: string, opts?: { encoding?: string; }): STransform; /** Serialize state[key] object to JSON string. */ static fromJson(key: string, opts?: { indent?: number; }): STransform; /** Serialize state[key] array of objects to CSV string. */ static fromCsv(key: string): STransform; /** Convert Markdown in state[key] to HTML string. */ static fromMarkdown(key: string): STransform; /** Conditional artifact operation. */ static when(predicate: StatePredicate, transform: AComposite): AComposite; /** Load artifact directly into LLM context (returns CTransform). */ static forLlm(filename: string, opts?: { version?: number; scope?: string; }): CTransform; } export {}; //# sourceMappingURL=artifacts.d.ts.map