import { tool } from "./tool/tool.mjs"; import { agent } from "./agent/agent.mjs"; import { budget, readBudgetFallbackSignal } from "./middleware/builtins/budget.mjs"; import { spawnSubAgent } from "./agent/spawn-sub-agent.mjs"; import { batch } from "./batch/batch.mjs"; import { streamObject } from "./object-stream/stream-object.mjs"; import { serve } from "./serve/serve.mjs"; import { memory } from "./checkpoint/memory.mjs"; import { pg } from "./checkpoint/pg.mjs"; import { redis } from "./checkpoint/redis.mjs"; import { setAIConfig } from "./config.mjs"; import { dataset } from "./eval/dataset.mjs"; import { evalScorers } from "./eval/index.mjs"; import { humanApproval } from "./human/human-approval.mjs"; import { image } from "./image/image.mjs"; import { speech } from "./speech/speech.mjs"; import { audioFromBuffer, audioFromFile, audioMediaTypeForFilename } from "./transcribe/audio-input.mjs"; import { transcribe } from "./transcribe/transcribe.mjs"; import { resume } from "./human/resume.mjs"; import { memory as memory$1 } from "./human/stores/memory.mjs"; import { pg as pg$1 } from "./human/stores/pg.mjs"; import { redis as redis$1 } from "./human/stores/redis.mjs"; import { guardrail } from "./guard/guardrail.mjs"; import { memory as memory$2 } from "./memory/memory.mjs"; import { guardrail as guardrail$1 } from "./middleware/builtins/guardrail.mjs"; import { semanticCache } from "./middleware/builtins/semantic-cache.mjs"; import { composeMiddleware } from "./middleware/helpers/compose.mjs"; import { forTool } from "./middleware/helpers/for-tool.mjs"; import { mockRouter } from "./mock/mock-router.mjs"; import { fallbackModel } from "./model/fallback-model.mjs"; import { orchestrator } from "./orchestrator/orchestrator.mjs"; import { planner } from "./planner/planner.mjs"; import { defaultPromptsManager } from "./prompts/prompts-manager.mjs"; import { rag } from "./rag/rag.mjs"; import { chunk } from "./rag/chunk/chunk.mjs"; import { cacheVectorStore } from "./rag/store/cache-vector-store.mjs"; import { pgVectorStore, vectorLiteral } from "./rag/store/pg-vector-store.mjs"; import { loadText } from "./rag/loaders/load-text.mjs"; import { loadHtml } from "./rag/loaders/load-html.mjs"; import { loadWeb } from "./rag/loaders/load-web.mjs"; import { loadPdf } from "./rag/loaders/load-pdf.mjs"; import { keywordReranker } from "./rag/rerank/keyword-reranker.mjs"; import { llmReranker } from "./rag/rerank/llm-reranker.mjs"; import { reciprocalRankFusion } from "./rag/hybrid/rrf.mjs"; import { bm25Rank } from "./rag/hybrid/bm25.mjs"; import { hybridRank } from "./rag/hybrid/hybrid-rank.mjs"; import { multiQuery } from "./rag/transforms/multi-query.mjs"; import { skills } from "./skills/skills.mjs"; import { systemPrompt } from "./system-prompt/system-prompt.mjs"; import { prompt } from "./prompt/prompt.mjs"; import { vcr } from "./vcr/vcr.mjs"; import { memory as memory$3 } from "./snapshot/memory.mjs"; import { pg as pg$2 } from "./snapshot/pg.mjs"; import { redis as redis$2 } from "./snapshot/redis.mjs"; import { fanOut } from "./supervisor/fan-out.mjs"; import { router } from "./supervisor/router-factory.mjs"; import { supervisor } from "./supervisor/supervisor.mjs"; import { team } from "./team/team.mjs"; import { instruction } from "./system-prompt/instruction.mjs"; import { persona } from "./system-prompt/persona.mjs"; import { step } from "./workflow/step.mjs"; import { workflow } from "./workflow/workflow.mjs"; //#region ../ai/src/ai.d.ts /** * The shape of the top-level `ai` namespace. Declared as an `interface` (not an * inferred `const` type) so satellite packages can attach their verb via * `declare module "@warlock.js/ai" { interface Ai { … } }` — e.g. `ai.workspace`, * `ai.tools`, `ai.mcp`, `ai.human`. The runtime object below is asserted to this * type; a satellite assigns its member on import. */ interface Ai { config: typeof setAIConfig; tool: typeof tool; agent: typeof agent; systemPrompt: typeof systemPrompt; persona: typeof persona; instruction: typeof instruction; workflow: typeof workflow; step: typeof step; supervisor: typeof supervisor; team: typeof team; orchestrator: typeof orchestrator; memory: typeof memory$2; skills: typeof skills; planner: typeof planner; rag: typeof rag & { keywordReranker: typeof keywordReranker; llmReranker: typeof llmReranker; chunk: typeof chunk; cacheVectorStore: typeof cacheVectorStore; pgVectorStore: typeof pgVectorStore; vectorLiteral: typeof vectorLiteral; loadText: typeof loadText; loadHtml: typeof loadHtml; loadWeb: typeof loadWeb; loadPdf: typeof loadPdf; bm25Rank: typeof bm25Rank; reciprocalRankFusion: typeof reciprocalRankFusion; hybridRank: typeof hybridRank; multiQuery: typeof multiQuery; }; spawnSubAgent: typeof spawnSubAgent; router: typeof router; fanOut: typeof fanOut; batch: typeof batch; /** Structured-output streaming — partial-object snapshots + a strict final parse (A1). */ streamObject: typeof streamObject; /** Serve an executable as an SSE HTTP endpoint — production serving primitive (A3). */ serve: typeof serve; /** * Generate images from a text prompt — the image-output verb of the * output-modality track (Theme I). Wraps an `ImageModelContract` (from * `openai.image(...)` / `google.image(...)`) in the uniform * never-throws `{ data, error, usage, report }` envelope with cost-truth * and observability. */ image: typeof image; /** Text-to-speech (TTS) — the audio-output verb of the modality track (Theme I). */ speech: typeof speech; /** Speech-to-text (STT / transcription) — the audio-input verb of the modality track (Theme I). */ transcribe: typeof transcribe; /** Read an audio file from disk → `AudioInput` for `ai.transcribe` (non-AI file plumbing). */ audioFromFile: typeof audioFromFile; /** Package raw audio bytes → `AudioInput` for `ai.transcribe`. */ audioFromBuffer: typeof audioFromBuffer; /** Resolve the audio media type from a filename's extension. */ audioMediaTypeForFilename: typeof audioMediaTypeForFilename; fallbackModel: typeof fallbackModel; eval: typeof evalScorers; dataset: typeof dataset; prompt: typeof prompt; /** * Process-wide registry of named, versioned `systemPrompt(...)` builders, * keyed by `name@version`. A `systemPrompt(input, { name })` (or any * `.meta({ name })` rename) auto-registers here; `ai.prompts.get(name)` / * `.resolve(name)` reads them back, and `systemPrompt().merge(name)` folds a * registered prompt into a new one. */ prompts: ReturnType; vcr: typeof vcr; mockRouter: typeof mockRouter; middleware: { budget: typeof budget; guardrail: typeof guardrail$1; semanticCache: typeof semanticCache; compose: typeof composeMiddleware; forTool: typeof forTool; readBudgetFallbackSignal: typeof readBudgetFallbackSignal; }; checkpoint: { memory: typeof memory; pg: typeof pg; redis: typeof redis; }; snapshot: { memory: typeof memory$3; pg: typeof pg$2; redis: typeof redis$2; }; /** * Human-in-the-loop tool approval (interrupt / resume). * * - `human.approval(options)` — the `tool.before` approval-gate middleware. * - `human.resume(id, decision, options)` — out-of-process durable resume. * - `human.interrupt.{memory,pg,redis}()` — durable {@link InterruptStore} * factories (memory ships real; pg/redis are lazy optional peers). */ human: { approval: typeof humanApproval; resume: typeof resume; interrupt: { memory: typeof memory$1; pg: typeof pg$1; redis: typeof redis$1; }; }; /** * Content-intelligence guardrail. `ai.guardrail(options)` builds a composed * input / output / tool middleware; `ai.guardrail.{pii,topic,injection,moderation}` * are the built-in detector factories. */ guardrail: typeof guardrail; } /** * Top-level `ai` namespace — holds built-in factories and user-registered SDK adapters. * * Factories: * - `ai.tool(...)` — wrap an async function with a schema-validated input. * - `ai.agent(...)` — build an executable agent from model + tools + prompt. * - `ai.systemPrompt(...)` — compose a layered persona + instructions prompt. * - `ai.persona(text)` — reusable persona block (can be passed to `systemPrompt`). * - `ai.instruction(text)` — reusable instruction block (can be passed to `systemPrompt`). * - `ai.orchestrator(...)` — session-state manager wrapped around a supervisor (durable session, drift detection, resume, commands). * - `ai.memory(...)` — build an agent-memory store with WORKING (in-run scratch) and SEMANTIC (cache-driver `.similar()` recall) tiers. * - `ai.skills(...)` — build a runtime skills library (always-injected metadata catalog + on-demand loadSkill tool). * - `ai.planner(...)` — build an executable that generates an ordered plan over registered capabilities, then runs it step-by-step. * - `ai.spawnSubAgent(spec)` — thin wrapper that builds a fresh one-shot `agent()` with an optional per-task `budget` and runs the task once. A general primitive (not planner-specific). * - `ai.router(...)` — build a supervisor-compatible routing agent from named intents. * - `ai.fanOut(unit, count)` — spread one agent/workflow into N intent entries for voting / self-consistency. * - `ai.batch(executable, items, opts?)` — run any executable over a dataset with bounded concurrency + per-item retry. * - `ai.fallbackModel(models, opts?)` — wrap an ordered model list that fails over to the next on transient provider errors. * - `ai.eval.{exact,contains,predicate,judge}(...)` — built-in scorer factories for `agent.eval(...)`. * - `ai.mockRouter(decisions, opts?)` — deterministic supervisor `route` callback for tests. * - `ai.checkpoint.{memory,pg,redis}()` — durable orchestrator session checkpoint stores. * - `ai.snapshot.{memory,pg,redis}()` — supervisor-run snapshot stores for `iterate: true` resume. * - `ai.human.approval(...)` / `ai.human.resume(...)` / `ai.human.interrupt.{memory,pg,redis}()` — human-in-the-loop tool approval (interrupt / resume). * - `ai.guardrail(options)` + `ai.guardrail.{pii,topic,injection,moderation}(...)` — content-intelligence guardrails (moderation / PII / injection / topic). * - `ai.openai.model(...)` / `ai.anthropic.model(...)` / ... once the adapter SDK is registered. * * @example * const alex = ai.persona("You are Alex, a TypeScript expert."); * const replyIn = ai.instruction("Respond in {{language|English}}."); * * const prompt = ai.systemPrompt().persona(alex).instruction(replyIn); * * const myAgent = ai.agent({ * model: ai.openai.model({ name: "gpt-4o" }), * systemPrompt: prompt, * tools: [myTool], * }); * * const result = await myAgent.execute("What is the weather in Cairo?", { * placeholders: { language: "Arabic" }, * }); */ declare const ai: Ai; //#endregion export { Ai, ai }; //# sourceMappingURL=ai.d.mts.map