overai 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +248 -0
- package/dist/agent/context.d.ts +74 -0
- package/dist/agent/context.js +140 -0
- package/dist/agent/enhanced.d.ts +98 -0
- package/dist/agent/enhanced.js +293 -0
- package/dist/agent/handoff.d.ts +82 -0
- package/dist/agent/handoff.js +124 -0
- package/dist/agent/image.d.ts +57 -0
- package/dist/agent/image.js +116 -0
- package/dist/agent/index.d.ts +19 -0
- package/dist/agent/index.js +38 -0
- package/dist/agent/prompt-expander.d.ts +43 -0
- package/dist/agent/prompt-expander.js +99 -0
- package/dist/agent/proxy.d.ts +26 -0
- package/dist/agent/proxy.js +173 -0
- package/dist/agent/query-rewriter.d.ts +41 -0
- package/dist/agent/query-rewriter.js +94 -0
- package/dist/agent/research.d.ts +55 -0
- package/dist/agent/research.js +134 -0
- package/dist/agent/router.d.ts +141 -0
- package/dist/agent/router.js +209 -0
- package/dist/agent/simple.d.ts +289 -0
- package/dist/agent/simple.js +696 -0
- package/dist/agent/types.d.ts +56 -0
- package/dist/agent/types.js +165 -0
- package/dist/ai/agent-loop.d.ts +177 -0
- package/dist/ai/agent-loop.js +313 -0
- package/dist/ai/devtools.d.ts +74 -0
- package/dist/ai/devtools.js +216 -0
- package/dist/ai/embed.d.ts +71 -0
- package/dist/ai/embed.js +154 -0
- package/dist/ai/generate-image.d.ts +66 -0
- package/dist/ai/generate-image.js +138 -0
- package/dist/ai/generate-object.d.ts +132 -0
- package/dist/ai/generate-object.js +206 -0
- package/dist/ai/generate-text.d.ts +201 -0
- package/dist/ai/generate-text.js +253 -0
- package/dist/ai/index.d.ts +27 -0
- package/dist/ai/index.js +140 -0
- package/dist/ai/mcp.d.ts +181 -0
- package/dist/ai/mcp.js +234 -0
- package/dist/ai/middleware.d.ts +110 -0
- package/dist/ai/middleware.js +186 -0
- package/dist/ai/models.d.ts +67 -0
- package/dist/ai/models.js +249 -0
- package/dist/ai/multimodal.d.ts +125 -0
- package/dist/ai/multimodal.js +270 -0
- package/dist/ai/nextjs.d.ts +122 -0
- package/dist/ai/nextjs.js +218 -0
- package/dist/ai/server.d.ts +126 -0
- package/dist/ai/server.js +336 -0
- package/dist/ai/speech.d.ts +135 -0
- package/dist/ai/speech.js +296 -0
- package/dist/ai/telemetry.d.ts +162 -0
- package/dist/ai/telemetry.js +311 -0
- package/dist/ai/tool-approval.d.ts +225 -0
- package/dist/ai/tool-approval.js +407 -0
- package/dist/ai/tools.d.ts +93 -0
- package/dist/ai/tools.js +89 -0
- package/dist/ai/types.d.ts +47 -0
- package/dist/ai/types.js +5 -0
- package/dist/ai/ui-message.d.ts +218 -0
- package/dist/ai/ui-message.js +291 -0
- package/dist/auto/index.d.ts +62 -0
- package/dist/auto/index.js +163 -0
- package/dist/cache/index.d.ts +78 -0
- package/dist/cache/index.js +235 -0
- package/dist/cli/commands/agent.d.ts +30 -0
- package/dist/cli/commands/agent.js +151 -0
- package/dist/cli/commands/agents.d.ts +24 -0
- package/dist/cli/commands/agents.js +166 -0
- package/dist/cli/commands/approval.d.ts +10 -0
- package/dist/cli/commands/approval.js +253 -0
- package/dist/cli/commands/auto.d.ts +12 -0
- package/dist/cli/commands/auto.js +109 -0
- package/dist/cli/commands/autonomy.d.ts +5 -0
- package/dist/cli/commands/autonomy.js +152 -0
- package/dist/cli/commands/benchmark.d.ts +19 -0
- package/dist/cli/commands/benchmark.js +484 -0
- package/dist/cli/commands/cache.d.ts +9 -0
- package/dist/cli/commands/cache.js +143 -0
- package/dist/cli/commands/chat.d.ts +14 -0
- package/dist/cli/commands/chat.js +127 -0
- package/dist/cli/commands/checkpoints.d.ts +5 -0
- package/dist/cli/commands/checkpoints.js +236 -0
- package/dist/cli/commands/context.d.ts +11 -0
- package/dist/cli/commands/context.js +182 -0
- package/dist/cli/commands/cost.d.ts +5 -0
- package/dist/cli/commands/cost.js +146 -0
- package/dist/cli/commands/db.d.ts +9 -0
- package/dist/cli/commands/db.js +149 -0
- package/dist/cli/commands/embed.d.ts +20 -0
- package/dist/cli/commands/embed.js +375 -0
- package/dist/cli/commands/eval.d.ts +17 -0
- package/dist/cli/commands/eval.js +247 -0
- package/dist/cli/commands/external-agents.d.ts +5 -0
- package/dist/cli/commands/external-agents.js +170 -0
- package/dist/cli/commands/fast-context.d.ts +5 -0
- package/dist/cli/commands/fast-context.js +126 -0
- package/dist/cli/commands/flow.d.ts +5 -0
- package/dist/cli/commands/flow.js +141 -0
- package/dist/cli/commands/git.d.ts +5 -0
- package/dist/cli/commands/git.js +178 -0
- package/dist/cli/commands/graph-rag.d.ts +9 -0
- package/dist/cli/commands/graph-rag.js +131 -0
- package/dist/cli/commands/guardrail.d.ts +11 -0
- package/dist/cli/commands/guardrail.js +156 -0
- package/dist/cli/commands/handoff.d.ts +9 -0
- package/dist/cli/commands/handoff.js +133 -0
- package/dist/cli/commands/help.d.ts +8 -0
- package/dist/cli/commands/help.js +139 -0
- package/dist/cli/commands/image.d.ts +13 -0
- package/dist/cli/commands/image.js +192 -0
- package/dist/cli/commands/interactive.d.ts +6 -0
- package/dist/cli/commands/interactive.js +79 -0
- package/dist/cli/commands/jobs.d.ts +5 -0
- package/dist/cli/commands/jobs.js +282 -0
- package/dist/cli/commands/knowledge.d.ts +9 -0
- package/dist/cli/commands/knowledge.js +226 -0
- package/dist/cli/commands/llm.d.ts +21 -0
- package/dist/cli/commands/llm.js +748 -0
- package/dist/cli/commands/mcp.d.ts +9 -0
- package/dist/cli/commands/mcp.js +243 -0
- package/dist/cli/commands/memory.d.ts +10 -0
- package/dist/cli/commands/memory.js +198 -0
- package/dist/cli/commands/n8n.d.ts +5 -0
- package/dist/cli/commands/n8n.js +137 -0
- package/dist/cli/commands/observability.d.ts +16 -0
- package/dist/cli/commands/observability.js +335 -0
- package/dist/cli/commands/planning.d.ts +9 -0
- package/dist/cli/commands/planning.js +167 -0
- package/dist/cli/commands/prompt-expand.d.ts +11 -0
- package/dist/cli/commands/prompt-expand.js +100 -0
- package/dist/cli/commands/providers.d.ts +17 -0
- package/dist/cli/commands/providers.js +386 -0
- package/dist/cli/commands/query-rewrite.d.ts +12 -0
- package/dist/cli/commands/query-rewrite.js +102 -0
- package/dist/cli/commands/repo-map.d.ts +5 -0
- package/dist/cli/commands/repo-map.js +151 -0
- package/dist/cli/commands/reranker.d.ts +10 -0
- package/dist/cli/commands/reranker.js +144 -0
- package/dist/cli/commands/research.d.ts +12 -0
- package/dist/cli/commands/research.js +108 -0
- package/dist/cli/commands/router.d.ts +11 -0
- package/dist/cli/commands/router.js +142 -0
- package/dist/cli/commands/run.d.ts +14 -0
- package/dist/cli/commands/run.js +111 -0
- package/dist/cli/commands/sandbox.d.ts +5 -0
- package/dist/cli/commands/sandbox.js +135 -0
- package/dist/cli/commands/scheduler.d.ts +5 -0
- package/dist/cli/commands/scheduler.js +260 -0
- package/dist/cli/commands/session.d.ts +9 -0
- package/dist/cli/commands/session.js +238 -0
- package/dist/cli/commands/skills.d.ts +9 -0
- package/dist/cli/commands/skills.js +256 -0
- package/dist/cli/commands/telemetry.d.ts +9 -0
- package/dist/cli/commands/telemetry.js +146 -0
- package/dist/cli/commands/tools.d.ts +19 -0
- package/dist/cli/commands/tools.js +576 -0
- package/dist/cli/commands/vector.d.ts +10 -0
- package/dist/cli/commands/vector.js +171 -0
- package/dist/cli/commands/version.d.ts +8 -0
- package/dist/cli/commands/version.js +40 -0
- package/dist/cli/commands/voice.d.ts +10 -0
- package/dist/cli/commands/voice.js +162 -0
- package/dist/cli/commands/workflow.d.ts +13 -0
- package/dist/cli/commands/workflow.js +184 -0
- package/dist/cli/config/index.d.ts +6 -0
- package/dist/cli/config/index.js +22 -0
- package/dist/cli/config/load.d.ts +20 -0
- package/dist/cli/config/load.js +229 -0
- package/dist/cli/config/resolve.d.ts +28 -0
- package/dist/cli/config/resolve.js +70 -0
- package/dist/cli/config/schema.d.ts +15 -0
- package/dist/cli/config/schema.js +65 -0
- package/dist/cli/features/autonomy-mode.d.ts +98 -0
- package/dist/cli/features/autonomy-mode.js +266 -0
- package/dist/cli/features/background-jobs.d.ts +155 -0
- package/dist/cli/features/background-jobs.js +416 -0
- package/dist/cli/features/checkpoints.d.ts +126 -0
- package/dist/cli/features/checkpoints.js +288 -0
- package/dist/cli/features/cost-tracker.d.ts +101 -0
- package/dist/cli/features/cost-tracker.js +212 -0
- package/dist/cli/features/external-agents.d.ts +117 -0
- package/dist/cli/features/external-agents.js +296 -0
- package/dist/cli/features/fast-context.d.ts +126 -0
- package/dist/cli/features/fast-context.js +310 -0
- package/dist/cli/features/flow-display.d.ts +100 -0
- package/dist/cli/features/flow-display.js +254 -0
- package/dist/cli/features/git-integration.d.ts +138 -0
- package/dist/cli/features/git-integration.js +374 -0
- package/dist/cli/features/index.d.ts +17 -0
- package/dist/cli/features/index.js +102 -0
- package/dist/cli/features/interactive-tui.d.ts +114 -0
- package/dist/cli/features/interactive-tui.js +326 -0
- package/dist/cli/features/n8n-integration.d.ts +111 -0
- package/dist/cli/features/n8n-integration.js +299 -0
- package/dist/cli/features/repo-map.d.ts +101 -0
- package/dist/cli/features/repo-map.js +350 -0
- package/dist/cli/features/sandbox-executor.d.ts +89 -0
- package/dist/cli/features/sandbox-executor.js +314 -0
- package/dist/cli/features/scheduler.d.ts +111 -0
- package/dist/cli/features/scheduler.js +298 -0
- package/dist/cli/features/slash-commands.d.ts +77 -0
- package/dist/cli/features/slash-commands.js +316 -0
- package/dist/cli/index.d.ts +24 -0
- package/dist/cli/index.js +214 -0
- package/dist/cli/output/errors.d.ts +23 -0
- package/dist/cli/output/errors.js +36 -0
- package/dist/cli/output/json.d.ts +27 -0
- package/dist/cli/output/json.js +31 -0
- package/dist/cli/output/pretty.d.ts +13 -0
- package/dist/cli/output/pretty.js +31 -0
- package/dist/cli/runtime/env.d.ts +12 -0
- package/dist/cli/runtime/env.js +55 -0
- package/dist/cli/runtime/exit.d.ts +11 -0
- package/dist/cli/runtime/exit.js +49 -0
- package/dist/cli/runtime/index.d.ts +6 -0
- package/dist/cli/runtime/index.js +22 -0
- package/dist/cli/runtime/lazy.d.ts +18 -0
- package/dist/cli/runtime/lazy.js +85 -0
- package/dist/cli/spec/cli-spec.d.ts +87 -0
- package/dist/cli/spec/cli-spec.js +551 -0
- package/dist/cli/spec/index.d.ts +4 -0
- package/dist/cli/spec/index.js +20 -0
- package/dist/db/index.d.ts +6 -0
- package/dist/db/index.js +75 -0
- package/dist/db/types.d.ts +42 -0
- package/dist/db/types.js +2 -0
- package/dist/eval/index.d.ts +61 -0
- package/dist/eval/index.js +157 -0
- package/dist/events/index.d.ts +84 -0
- package/dist/events/index.js +153 -0
- package/dist/guardrails/index.d.ts +82 -0
- package/dist/guardrails/index.js +202 -0
- package/dist/guardrails/llm-guardrail.d.ts +46 -0
- package/dist/guardrails/llm-guardrail.js +112 -0
- package/dist/index.d.ts +92 -0
- package/dist/index.js +608 -0
- package/dist/integrations/computer-use.d.ts +182 -0
- package/dist/integrations/computer-use.js +356 -0
- package/dist/integrations/index.d.ts +7 -0
- package/dist/integrations/index.js +26 -0
- package/dist/integrations/observability/base.d.ts +123 -0
- package/dist/integrations/observability/base.js +183 -0
- package/dist/integrations/observability/index.d.ts +8 -0
- package/dist/integrations/observability/index.js +29 -0
- package/dist/integrations/observability/langfuse.d.ts +32 -0
- package/dist/integrations/observability/langfuse.js +174 -0
- package/dist/integrations/postgres.d.ts +162 -0
- package/dist/integrations/postgres.js +396 -0
- package/dist/integrations/slack.d.ts +145 -0
- package/dist/integrations/slack.js +270 -0
- package/dist/integrations/vector/base.d.ts +110 -0
- package/dist/integrations/vector/base.js +158 -0
- package/dist/integrations/vector/chroma.d.ts +25 -0
- package/dist/integrations/vector/chroma.js +143 -0
- package/dist/integrations/vector/index.d.ts +14 -0
- package/dist/integrations/vector/index.js +37 -0
- package/dist/integrations/vector/pinecone.d.ts +28 -0
- package/dist/integrations/vector/pinecone.js +172 -0
- package/dist/integrations/vector/qdrant.d.ts +25 -0
- package/dist/integrations/vector/qdrant.js +146 -0
- package/dist/integrations/vector/weaviate.d.ts +30 -0
- package/dist/integrations/vector/weaviate.js +206 -0
- package/dist/integrations/voice/base.d.ts +76 -0
- package/dist/integrations/voice/base.js +168 -0
- package/dist/integrations/voice/index.d.ts +6 -0
- package/dist/integrations/voice/index.js +26 -0
- package/dist/knowledge/chunking.d.ts +55 -0
- package/dist/knowledge/chunking.js +158 -0
- package/dist/knowledge/graph-rag.d.ts +125 -0
- package/dist/knowledge/graph-rag.js +289 -0
- package/dist/knowledge/index.d.ts +24 -0
- package/dist/knowledge/index.js +47 -0
- package/dist/knowledge/knowledge.d.ts +0 -0
- package/dist/knowledge/knowledge.js +1 -0
- package/dist/knowledge/rag.d.ts +80 -0
- package/dist/knowledge/rag.js +147 -0
- package/dist/knowledge/reranker.d.ts +86 -0
- package/dist/knowledge/reranker.js +196 -0
- package/dist/llm/backend-resolver.d.ts +77 -0
- package/dist/llm/backend-resolver.js +242 -0
- package/dist/llm/embeddings.d.ts +66 -0
- package/dist/llm/embeddings.js +294 -0
- package/dist/llm/index.d.ts +29 -0
- package/dist/llm/index.js +33 -0
- package/dist/llm/llm.d.ts +0 -0
- package/dist/llm/llm.js +1 -0
- package/dist/llm/openai.d.ts +39 -0
- package/dist/llm/openai.js +302 -0
- package/dist/llm/providers/ai-sdk/adapter.d.ts +121 -0
- package/dist/llm/providers/ai-sdk/adapter.js +399 -0
- package/dist/llm/providers/ai-sdk/backend.d.ts +49 -0
- package/dist/llm/providers/ai-sdk/backend.js +421 -0
- package/dist/llm/providers/ai-sdk/index.d.ts +69 -0
- package/dist/llm/providers/ai-sdk/index.js +200 -0
- package/dist/llm/providers/ai-sdk/middleware.d.ts +60 -0
- package/dist/llm/providers/ai-sdk/middleware.js +262 -0
- package/dist/llm/providers/ai-sdk/provider-map.d.ts +75 -0
- package/dist/llm/providers/ai-sdk/provider-map.js +258 -0
- package/dist/llm/providers/ai-sdk/types.d.ts +217 -0
- package/dist/llm/providers/ai-sdk/types.js +222 -0
- package/dist/llm/providers/anthropic.d.ts +33 -0
- package/dist/llm/providers/anthropic.js +291 -0
- package/dist/llm/providers/base.d.ts +25 -0
- package/dist/llm/providers/base.js +43 -0
- package/dist/llm/providers/google.d.ts +27 -0
- package/dist/llm/providers/google.js +275 -0
- package/dist/llm/providers/index.d.ts +107 -0
- package/dist/llm/providers/index.js +216 -0
- package/dist/llm/providers/openai.d.ts +18 -0
- package/dist/llm/providers/openai.js +203 -0
- package/dist/llm/providers/registry.d.ts +159 -0
- package/dist/llm/providers/registry.js +279 -0
- package/dist/llm/providers/types.d.ts +94 -0
- package/dist/llm/providers/types.js +5 -0
- package/dist/main.d.ts +0 -0
- package/dist/main.js +1 -0
- package/dist/memory/auto-memory.d.ts +136 -0
- package/dist/memory/auto-memory.js +301 -0
- package/dist/memory/file-memory.d.ts +88 -0
- package/dist/memory/file-memory.js +287 -0
- package/dist/memory/index.d.ts +26 -0
- package/dist/memory/index.js +41 -0
- package/dist/memory/memory.d.ts +92 -0
- package/dist/memory/memory.js +170 -0
- package/dist/observability/adapters/console.d.ts +33 -0
- package/dist/observability/adapters/console.js +71 -0
- package/dist/observability/adapters/external/arize.d.ts +20 -0
- package/dist/observability/adapters/external/arize.js +22 -0
- package/dist/observability/adapters/external/axiom.d.ts +20 -0
- package/dist/observability/adapters/external/axiom.js +22 -0
- package/dist/observability/adapters/external/braintrust.d.ts +20 -0
- package/dist/observability/adapters/external/braintrust.js +22 -0
- package/dist/observability/adapters/external/helicone.d.ts +20 -0
- package/dist/observability/adapters/external/helicone.js +22 -0
- package/dist/observability/adapters/external/laminar.d.ts +20 -0
- package/dist/observability/adapters/external/laminar.js +22 -0
- package/dist/observability/adapters/external/langfuse.d.ts +28 -0
- package/dist/observability/adapters/external/langfuse.js +186 -0
- package/dist/observability/adapters/external/langsmith.d.ts +21 -0
- package/dist/observability/adapters/external/langsmith.js +83 -0
- package/dist/observability/adapters/external/langwatch.d.ts +20 -0
- package/dist/observability/adapters/external/langwatch.js +22 -0
- package/dist/observability/adapters/external/maxim.d.ts +20 -0
- package/dist/observability/adapters/external/maxim.js +22 -0
- package/dist/observability/adapters/external/patronus.d.ts +20 -0
- package/dist/observability/adapters/external/patronus.js +22 -0
- package/dist/observability/adapters/external/scorecard.d.ts +20 -0
- package/dist/observability/adapters/external/scorecard.js +22 -0
- package/dist/observability/adapters/external/signoz.d.ts +20 -0
- package/dist/observability/adapters/external/signoz.js +22 -0
- package/dist/observability/adapters/external/traceloop.d.ts +20 -0
- package/dist/observability/adapters/external/traceloop.js +22 -0
- package/dist/observability/adapters/external/weave.d.ts +20 -0
- package/dist/observability/adapters/external/weave.js +22 -0
- package/dist/observability/adapters/index.d.ts +19 -0
- package/dist/observability/adapters/index.js +289 -0
- package/dist/observability/adapters/memory.d.ts +41 -0
- package/dist/observability/adapters/memory.js +190 -0
- package/dist/observability/adapters/noop.d.ts +25 -0
- package/dist/observability/adapters/noop.js +64 -0
- package/dist/observability/index.d.ts +47 -0
- package/dist/observability/index.js +115 -0
- package/dist/observability/types.d.ts +165 -0
- package/dist/observability/types.js +165 -0
- package/dist/planning/index.d.ts +253 -0
- package/dist/planning/index.js +475 -0
- package/dist/process/index.d.ts +25 -0
- package/dist/process/index.js +37 -0
- package/dist/process/process.d.ts +0 -0
- package/dist/process/process.js +1 -0
- package/dist/session/index.d.ts +111 -0
- package/dist/session/index.js +250 -0
- package/dist/skills/index.d.ts +70 -0
- package/dist/skills/index.js +233 -0
- package/dist/task/index.d.ts +25 -0
- package/dist/task/index.js +32 -0
- package/dist/task/task.d.ts +0 -0
- package/dist/task/task.js +1 -0
- package/dist/telemetry/index.d.ts +175 -0
- package/dist/telemetry/index.js +287 -0
- package/dist/tools/arxivTools.d.ts +32 -0
- package/dist/tools/arxivTools.js +81 -0
- package/dist/tools/base.d.ts +97 -0
- package/dist/tools/base.js +147 -0
- package/dist/tools/builtins/airweave.d.ts +32 -0
- package/dist/tools/builtins/airweave.js +119 -0
- package/dist/tools/builtins/bedrock-agentcore.d.ts +62 -0
- package/dist/tools/builtins/bedrock-agentcore.js +233 -0
- package/dist/tools/builtins/code-execution.d.ts +36 -0
- package/dist/tools/builtins/code-execution.js +136 -0
- package/dist/tools/builtins/code-mode.d.ts +54 -0
- package/dist/tools/builtins/code-mode.js +167 -0
- package/dist/tools/builtins/custom.d.ts +42 -0
- package/dist/tools/builtins/custom.js +195 -0
- package/dist/tools/builtins/exa.d.ts +53 -0
- package/dist/tools/builtins/exa.js +112 -0
- package/dist/tools/builtins/firecrawl.d.ts +56 -0
- package/dist/tools/builtins/firecrawl.js +158 -0
- package/dist/tools/builtins/index.d.ts +45 -0
- package/dist/tools/builtins/index.js +180 -0
- package/dist/tools/builtins/parallel.d.ts +30 -0
- package/dist/tools/builtins/parallel.js +113 -0
- package/dist/tools/builtins/perplexity.d.ts +32 -0
- package/dist/tools/builtins/perplexity.js +113 -0
- package/dist/tools/builtins/superagent.d.ts +66 -0
- package/dist/tools/builtins/superagent.js +187 -0
- package/dist/tools/builtins/tavily.d.ts +99 -0
- package/dist/tools/builtins/tavily.js +285 -0
- package/dist/tools/builtins/valyu.d.ts +65 -0
- package/dist/tools/builtins/valyu.js +193 -0
- package/dist/tools/decorator.d.ts +91 -0
- package/dist/tools/decorator.js +165 -0
- package/dist/tools/index.d.ts +8 -0
- package/dist/tools/index.js +36 -0
- package/dist/tools/mcpSse.d.ts +43 -0
- package/dist/tools/mcpSse.js +110 -0
- package/dist/tools/registry/index.d.ts +9 -0
- package/dist/tools/registry/index.js +28 -0
- package/dist/tools/registry/middleware.d.ts +43 -0
- package/dist/tools/registry/middleware.js +220 -0
- package/dist/tools/registry/registry.d.ts +92 -0
- package/dist/tools/registry/registry.js +280 -0
- package/dist/tools/registry/types.d.ts +217 -0
- package/dist/tools/registry/types.js +49 -0
- package/dist/tools/test.d.ts +0 -0
- package/dist/tools/test.js +1 -0
- package/dist/tools/tools.d.ts +74 -0
- package/dist/tools/tools.js +133 -0
- package/dist/utils/logger.d.ts +25 -0
- package/dist/utils/logger.js +149 -0
- package/dist/utils/pretty-logger.d.ts +21 -0
- package/dist/utils/pretty-logger.js +248 -0
- package/dist/workflows/index.d.ts +118 -0
- package/dist/workflows/index.js +247 -0
- package/dist/workflows/loop.d.ts +0 -0
- package/dist/workflows/loop.js +1 -0
- package/dist/workflows/yaml-parser.d.ts +48 -0
- package/dist/workflows/yaml-parser.js +304 -0
- package/package.json +119 -0
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* AI SDK Backend
|
|
4
|
+
*
|
|
5
|
+
* Main implementation of the AI SDK backend for praisonai-ts.
|
|
6
|
+
* Provides generateText, streamText, and generateObject methods
|
|
7
|
+
* with retry logic, timeouts, and attribution support.
|
|
8
|
+
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
16
|
+
}) : (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
o[k2] = m[k];
|
|
19
|
+
}));
|
|
20
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
+
}) : function(o, v) {
|
|
23
|
+
o["default"] = v;
|
|
24
|
+
});
|
|
25
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
26
|
+
var ownKeys = function(o) {
|
|
27
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
28
|
+
var ar = [];
|
|
29
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
30
|
+
return ar;
|
|
31
|
+
};
|
|
32
|
+
return ownKeys(o);
|
|
33
|
+
};
|
|
34
|
+
return function (mod) {
|
|
35
|
+
if (mod && mod.__esModule) return mod;
|
|
36
|
+
var result = {};
|
|
37
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
38
|
+
__setModuleDefault(result, mod);
|
|
39
|
+
return result;
|
|
40
|
+
};
|
|
41
|
+
})();
|
|
42
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
+
exports.AISDKBackend = void 0;
|
|
44
|
+
exports.createAISDKBackend = createAISDKBackend;
|
|
45
|
+
const types_1 = require("./types");
|
|
46
|
+
const provider_map_1 = require("./provider-map");
|
|
47
|
+
const adapter_1 = require("./adapter");
|
|
48
|
+
/**
|
|
49
|
+
* Lazy-loaded AI SDK modules
|
|
50
|
+
* These are only imported when actually used to avoid startup cost
|
|
51
|
+
*
|
|
52
|
+
* Note: We use 'any' type here because the 'ai' package is an optional
|
|
53
|
+
* peer dependency. The actual types are checked at runtime.
|
|
54
|
+
*/
|
|
55
|
+
let _aiModule = null;
|
|
56
|
+
async function getAIModule() {
|
|
57
|
+
if (!_aiModule) {
|
|
58
|
+
try {
|
|
59
|
+
// Dynamic import - 'ai' is an optional peer dependency
|
|
60
|
+
// Use variable to prevent TypeScript from resolving the module at compile time
|
|
61
|
+
const moduleName = 'ai';
|
|
62
|
+
_aiModule = await Promise.resolve(`${moduleName}`).then(s => __importStar(require(s)));
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
throw new types_1.AISDKError('AI SDK is not installed. Install it with: npm install ai', 'MISSING_DEPENDENCY', false, error);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return _aiModule;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* AI SDK Backend - implements LLMProvider interface
|
|
72
|
+
*/
|
|
73
|
+
class AISDKBackend {
|
|
74
|
+
constructor(modelString, config = {}) {
|
|
75
|
+
this.provider = null;
|
|
76
|
+
this.model = null;
|
|
77
|
+
const parsed = (0, provider_map_1.parseModelString)(modelString, config.defaultProvider);
|
|
78
|
+
this.providerId = parsed.providerId;
|
|
79
|
+
this.modelId = parsed.modelId;
|
|
80
|
+
// Merge with safe defaults
|
|
81
|
+
this.config = {
|
|
82
|
+
...types_1.SAFE_DEFAULTS,
|
|
83
|
+
...config
|
|
84
|
+
};
|
|
85
|
+
this.attribution = config.attribution;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Initialize the AI SDK provider and model (lazy)
|
|
89
|
+
*/
|
|
90
|
+
async ensureInitialized() {
|
|
91
|
+
if (this.model) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
// Validate API key
|
|
95
|
+
if (!(0, provider_map_1.validateProviderApiKey)(this.providerId)) {
|
|
96
|
+
throw new types_1.AISDKError((0, provider_map_1.getMissingApiKeyMessage)(this.providerId), 'AUTHENTICATION', false);
|
|
97
|
+
}
|
|
98
|
+
// Get provider options from config
|
|
99
|
+
const providerOptions = this.config.providers?.[this.providerId] || {};
|
|
100
|
+
// Create the AI SDK provider
|
|
101
|
+
this.provider = await (0, provider_map_1.createAISDKProvider)(this.providerId, providerOptions);
|
|
102
|
+
// Get the language model from the provider
|
|
103
|
+
if (typeof this.provider === 'function') {
|
|
104
|
+
// Provider is callable (e.g., openai('gpt-4o'))
|
|
105
|
+
this.model = this.provider(this.modelId);
|
|
106
|
+
}
|
|
107
|
+
else if (this.provider && typeof this.provider.languageModel === 'function') {
|
|
108
|
+
// Provider has languageModel method
|
|
109
|
+
this.model = this.provider.languageModel(this.modelId);
|
|
110
|
+
}
|
|
111
|
+
else if (this.provider && typeof this.provider.chat === 'function') {
|
|
112
|
+
// Provider has chat method (OpenAI style)
|
|
113
|
+
this.model = this.provider.chat(this.modelId);
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
throw new types_1.AISDKError(`Could not get language model from provider '${this.providerId}'`, 'PROVIDER_ERROR', false);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Generate text (non-streaming)
|
|
121
|
+
*/
|
|
122
|
+
async generateText(options) {
|
|
123
|
+
await this.ensureInitialized();
|
|
124
|
+
const ai = await getAIModule();
|
|
125
|
+
// Convert messages to AI SDK format
|
|
126
|
+
const prompt = (0, adapter_1.toAISDKPrompt)(options.messages);
|
|
127
|
+
// Convert tools if provided (now async)
|
|
128
|
+
const tools = options.tools ? await (0, adapter_1.toAISDKTools)(options.tools) : undefined;
|
|
129
|
+
// Build call options
|
|
130
|
+
const callOptions = {
|
|
131
|
+
model: this.model,
|
|
132
|
+
messages: prompt,
|
|
133
|
+
maxTokens: options.maxTokens || this.config.maxOutputTokens,
|
|
134
|
+
temperature: options.temperature,
|
|
135
|
+
topP: options.topP,
|
|
136
|
+
frequencyPenalty: options.frequencyPenalty,
|
|
137
|
+
presencePenalty: options.presencePenalty,
|
|
138
|
+
stopSequences: options.stop,
|
|
139
|
+
maxRetries: this.config.maxRetries,
|
|
140
|
+
};
|
|
141
|
+
if (tools && Object.keys(tools).length > 0) {
|
|
142
|
+
callOptions.tools = tools;
|
|
143
|
+
callOptions.toolChoice = (0, adapter_1.toAISDKToolChoice)(options.toolChoice);
|
|
144
|
+
}
|
|
145
|
+
// Add telemetry settings if configured
|
|
146
|
+
if (this.config.telemetry) {
|
|
147
|
+
callOptions.experimental_telemetry = this.config.telemetry;
|
|
148
|
+
}
|
|
149
|
+
// Execute with retry logic
|
|
150
|
+
let lastError;
|
|
151
|
+
const maxRetries = this.config.maxRetries || types_1.SAFE_DEFAULTS.maxRetries;
|
|
152
|
+
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
153
|
+
try {
|
|
154
|
+
// Create abort controller for timeout
|
|
155
|
+
const controller = new AbortController();
|
|
156
|
+
const timeoutId = setTimeout(() => {
|
|
157
|
+
controller.abort();
|
|
158
|
+
}, this.config.timeout || types_1.SAFE_DEFAULTS.timeout);
|
|
159
|
+
try {
|
|
160
|
+
callOptions.abortSignal = controller.signal;
|
|
161
|
+
const result = await ai.generateText(callOptions);
|
|
162
|
+
clearTimeout(timeoutId);
|
|
163
|
+
return (0, adapter_1.fromAISDKResult)({
|
|
164
|
+
text: result.text,
|
|
165
|
+
toolCalls: result.toolCalls?.map((tc) => ({
|
|
166
|
+
toolCallId: tc.toolCallId,
|
|
167
|
+
toolName: tc.toolName,
|
|
168
|
+
args: tc.args
|
|
169
|
+
})),
|
|
170
|
+
usage: result.usage,
|
|
171
|
+
finishReason: result.finishReason
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
finally {
|
|
175
|
+
clearTimeout(timeoutId);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
catch (error) {
|
|
179
|
+
lastError = error;
|
|
180
|
+
const classifiedError = classifyError(error);
|
|
181
|
+
// Don't retry non-retryable errors
|
|
182
|
+
if (!classifiedError.isRetryable || attempt === maxRetries) {
|
|
183
|
+
throw classifiedError;
|
|
184
|
+
}
|
|
185
|
+
// Exponential backoff
|
|
186
|
+
const delay = Math.min(1000 * Math.pow(2, attempt), 10000);
|
|
187
|
+
await sleep(delay);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
throw classifyError(lastError);
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Stream text generation
|
|
194
|
+
*/
|
|
195
|
+
async streamText(options) {
|
|
196
|
+
await this.ensureInitialized();
|
|
197
|
+
const ai = await getAIModule();
|
|
198
|
+
// Convert messages to AI SDK format
|
|
199
|
+
const prompt = (0, adapter_1.toAISDKPrompt)(options.messages);
|
|
200
|
+
// Convert tools if provided (now async)
|
|
201
|
+
const tools = options.tools ? await (0, adapter_1.toAISDKTools)(options.tools) : undefined;
|
|
202
|
+
// Build call options
|
|
203
|
+
const callOptions = {
|
|
204
|
+
model: this.model,
|
|
205
|
+
messages: prompt,
|
|
206
|
+
maxTokens: options.maxTokens || this.config.maxOutputTokens,
|
|
207
|
+
temperature: options.temperature,
|
|
208
|
+
topP: options.topP,
|
|
209
|
+
frequencyPenalty: options.frequencyPenalty,
|
|
210
|
+
presencePenalty: options.presencePenalty,
|
|
211
|
+
stopSequences: options.stop,
|
|
212
|
+
};
|
|
213
|
+
if (tools && Object.keys(tools).length > 0) {
|
|
214
|
+
callOptions.tools = tools;
|
|
215
|
+
callOptions.toolChoice = (0, adapter_1.toAISDKToolChoice)(options.toolChoice);
|
|
216
|
+
}
|
|
217
|
+
// Add telemetry settings if configured
|
|
218
|
+
if (this.config.telemetry) {
|
|
219
|
+
callOptions.experimental_telemetry = this.config.telemetry;
|
|
220
|
+
}
|
|
221
|
+
// Create abort controller for timeout
|
|
222
|
+
const controller = new AbortController();
|
|
223
|
+
const timeoutId = setTimeout(() => {
|
|
224
|
+
controller.abort();
|
|
225
|
+
}, this.config.timeout || types_1.SAFE_DEFAULTS.timeout);
|
|
226
|
+
callOptions.abortSignal = controller.signal;
|
|
227
|
+
const self = this;
|
|
228
|
+
const onToken = options.onToken;
|
|
229
|
+
const onToolCall = options.onToolCall;
|
|
230
|
+
// Return async iterable
|
|
231
|
+
return {
|
|
232
|
+
async *[Symbol.asyncIterator]() {
|
|
233
|
+
try {
|
|
234
|
+
const result = await ai.streamText(callOptions);
|
|
235
|
+
let accumulatedText = '';
|
|
236
|
+
const toolCalls = new Map();
|
|
237
|
+
for await (const chunk of result.textStream) {
|
|
238
|
+
// AI SDK streamText returns text chunks directly
|
|
239
|
+
if (typeof chunk === 'string') {
|
|
240
|
+
accumulatedText += chunk;
|
|
241
|
+
if (onToken) {
|
|
242
|
+
onToken(chunk);
|
|
243
|
+
}
|
|
244
|
+
yield {
|
|
245
|
+
text: chunk
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
// Get final result for usage and tool calls
|
|
250
|
+
const finalResult = await result;
|
|
251
|
+
// Yield tool calls if any
|
|
252
|
+
if (finalResult.toolCalls && finalResult.toolCalls.length > 0) {
|
|
253
|
+
for (const tc of finalResult.toolCalls) {
|
|
254
|
+
const toolCall = {
|
|
255
|
+
id: tc.toolCallId,
|
|
256
|
+
type: 'function',
|
|
257
|
+
function: {
|
|
258
|
+
name: tc.toolName,
|
|
259
|
+
arguments: typeof tc.args === 'string' ? tc.args : JSON.stringify(tc.args)
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
if (onToolCall) {
|
|
263
|
+
onToolCall(toolCall);
|
|
264
|
+
}
|
|
265
|
+
yield {
|
|
266
|
+
toolCalls: [toolCall]
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
// Yield final chunk with usage
|
|
271
|
+
yield {
|
|
272
|
+
usage: finalResult.usage ? {
|
|
273
|
+
promptTokens: finalResult.usage.promptTokens,
|
|
274
|
+
completionTokens: finalResult.usage.completionTokens,
|
|
275
|
+
totalTokens: finalResult.usage.promptTokens + finalResult.usage.completionTokens
|
|
276
|
+
} : undefined,
|
|
277
|
+
finishReason: finalResult.finishReason
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
catch (error) {
|
|
281
|
+
throw classifyError(error);
|
|
282
|
+
}
|
|
283
|
+
finally {
|
|
284
|
+
clearTimeout(timeoutId);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Generate structured object output
|
|
291
|
+
*/
|
|
292
|
+
async generateObject(options) {
|
|
293
|
+
await this.ensureInitialized();
|
|
294
|
+
const ai = await getAIModule();
|
|
295
|
+
// Convert messages to AI SDK format
|
|
296
|
+
const prompt = (0, adapter_1.toAISDKPrompt)(options.messages);
|
|
297
|
+
// Build call options
|
|
298
|
+
const callOptions = {
|
|
299
|
+
model: this.model,
|
|
300
|
+
messages: prompt,
|
|
301
|
+
schema: options.schema,
|
|
302
|
+
maxTokens: options.maxTokens || this.config.maxOutputTokens,
|
|
303
|
+
temperature: options.temperature,
|
|
304
|
+
maxRetries: options.maxRetries || this.config.maxRetries,
|
|
305
|
+
};
|
|
306
|
+
// Add telemetry settings if configured
|
|
307
|
+
if (this.config.telemetry) {
|
|
308
|
+
callOptions.experimental_telemetry = this.config.telemetry;
|
|
309
|
+
}
|
|
310
|
+
// Create abort controller for timeout
|
|
311
|
+
const controller = new AbortController();
|
|
312
|
+
const timeoutId = setTimeout(() => {
|
|
313
|
+
controller.abort();
|
|
314
|
+
}, this.config.timeout || types_1.SAFE_DEFAULTS.timeout);
|
|
315
|
+
try {
|
|
316
|
+
callOptions.abortSignal = controller.signal;
|
|
317
|
+
const result = await ai.generateObject(callOptions);
|
|
318
|
+
return {
|
|
319
|
+
object: result.object,
|
|
320
|
+
usage: result.usage ? {
|
|
321
|
+
promptTokens: result.usage.promptTokens,
|
|
322
|
+
completionTokens: result.usage.completionTokens,
|
|
323
|
+
totalTokens: result.usage.promptTokens + result.usage.completionTokens
|
|
324
|
+
} : {
|
|
325
|
+
promptTokens: 0,
|
|
326
|
+
completionTokens: 0,
|
|
327
|
+
totalTokens: 0
|
|
328
|
+
},
|
|
329
|
+
raw: result
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
catch (error) {
|
|
333
|
+
throw classifyError(error);
|
|
334
|
+
}
|
|
335
|
+
finally {
|
|
336
|
+
clearTimeout(timeoutId);
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Get the underlying AI SDK model (for advanced use)
|
|
341
|
+
*/
|
|
342
|
+
async getModel() {
|
|
343
|
+
await this.ensureInitialized();
|
|
344
|
+
return this.model;
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Get the underlying AI SDK provider (for advanced use)
|
|
348
|
+
*/
|
|
349
|
+
async getProvider() {
|
|
350
|
+
await this.ensureInitialized();
|
|
351
|
+
return this.provider;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
exports.AISDKBackend = AISDKBackend;
|
|
355
|
+
/**
|
|
356
|
+
* Create an AI SDK backend instance
|
|
357
|
+
*/
|
|
358
|
+
function createAISDKBackend(modelString, config) {
|
|
359
|
+
return new AISDKBackend(modelString, config);
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* Classify an error into an AISDKError
|
|
363
|
+
*/
|
|
364
|
+
function classifyError(error) {
|
|
365
|
+
if (error instanceof types_1.AISDKError) {
|
|
366
|
+
return error;
|
|
367
|
+
}
|
|
368
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
369
|
+
const lowerMessage = message.toLowerCase();
|
|
370
|
+
// Check for timeout/abort
|
|
371
|
+
if (lowerMessage.includes('abort') || lowerMessage.includes('timeout')) {
|
|
372
|
+
return new types_1.AISDKError(`Request timed out: ${message}`, 'TIMEOUT', true, error);
|
|
373
|
+
}
|
|
374
|
+
// Check for rate limit
|
|
375
|
+
if (lowerMessage.includes('rate limit') || lowerMessage.includes('429') || lowerMessage.includes('too many')) {
|
|
376
|
+
return new types_1.AISDKError(`Rate limit exceeded: ${message}`, 'RATE_LIMIT', true, error, 429);
|
|
377
|
+
}
|
|
378
|
+
// Check for authentication
|
|
379
|
+
if (lowerMessage.includes('unauthorized') || lowerMessage.includes('401') ||
|
|
380
|
+
lowerMessage.includes('forbidden') || lowerMessage.includes('403') ||
|
|
381
|
+
lowerMessage.includes('api key') || lowerMessage.includes('authentication')) {
|
|
382
|
+
return new types_1.AISDKError(`Authentication failed: ${message}`, 'AUTHENTICATION', false, error, 401);
|
|
383
|
+
}
|
|
384
|
+
// Check for invalid request
|
|
385
|
+
if (lowerMessage.includes('bad request') || lowerMessage.includes('400') ||
|
|
386
|
+
lowerMessage.includes('invalid')) {
|
|
387
|
+
return new types_1.AISDKError(`Invalid request: ${message}`, 'INVALID_REQUEST', false, error, 400);
|
|
388
|
+
}
|
|
389
|
+
// Check for model not found
|
|
390
|
+
if (lowerMessage.includes('model not found') || lowerMessage.includes('404') ||
|
|
391
|
+
lowerMessage.includes('does not exist')) {
|
|
392
|
+
return new types_1.AISDKError(`Model not found: ${message}`, 'MODEL_NOT_FOUND', false, error, 404);
|
|
393
|
+
}
|
|
394
|
+
// Check for network errors
|
|
395
|
+
if (lowerMessage.includes('network') || lowerMessage.includes('econnrefused') ||
|
|
396
|
+
lowerMessage.includes('enotfound') || lowerMessage.includes('socket')) {
|
|
397
|
+
return new types_1.AISDKError(`Network error: ${message}`, 'NETWORK', true, error);
|
|
398
|
+
}
|
|
399
|
+
// Check for cancelled
|
|
400
|
+
if (lowerMessage.includes('cancel')) {
|
|
401
|
+
return new types_1.AISDKError(`Request cancelled: ${message}`, 'CANCELLED', false, error);
|
|
402
|
+
}
|
|
403
|
+
// Check for missing dependency
|
|
404
|
+
if (lowerMessage.includes('cannot find module') || lowerMessage.includes('module_not_found')) {
|
|
405
|
+
return new types_1.AISDKError(`Missing dependency: ${message}`, 'MISSING_DEPENDENCY', false, error);
|
|
406
|
+
}
|
|
407
|
+
// Check for server errors (retryable)
|
|
408
|
+
if (lowerMessage.includes('500') || lowerMessage.includes('502') ||
|
|
409
|
+
lowerMessage.includes('503') || lowerMessage.includes('504') ||
|
|
410
|
+
lowerMessage.includes('server error')) {
|
|
411
|
+
return new types_1.AISDKError(`Server error: ${message}`, 'PROVIDER_ERROR', true, error, 500);
|
|
412
|
+
}
|
|
413
|
+
// Default to unknown error
|
|
414
|
+
return new types_1.AISDKError(message, 'UNKNOWN', false, error);
|
|
415
|
+
}
|
|
416
|
+
/**
|
|
417
|
+
* Sleep for a given number of milliseconds
|
|
418
|
+
*/
|
|
419
|
+
function sleep(ms) {
|
|
420
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
421
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI SDK Integration for praisonai-ts
|
|
3
|
+
*
|
|
4
|
+
* This module provides integration with Vercel's AI SDK for multi-provider LLM support.
|
|
5
|
+
* All imports are lazy-loaded to avoid startup cost when AI SDK is not used.
|
|
6
|
+
*
|
|
7
|
+
* @example Basic usage
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { createAISDKBackend, registerAISDKProviders } from 'praisonai';
|
|
10
|
+
*
|
|
11
|
+
* // Register AI SDK providers (one-time)
|
|
12
|
+
* registerAISDKProviders();
|
|
13
|
+
*
|
|
14
|
+
* // Create a backend for any supported provider
|
|
15
|
+
* const backend = createAISDKBackend('anthropic/claude-3-5-sonnet');
|
|
16
|
+
* const result = await backend.generateText({ messages: [...] });
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export type { AISDKBackendConfig, AISDKProviderOptions, AttributionContext, AISDKTelemetrySettings, AISDKErrorCode, PraisonStreamChunk, TokenUsage, FinishReason, AISDKToolDefinition, AISDKToolCall, AISDKToolResult, } from './types';
|
|
20
|
+
export { AISDKError, SAFE_DEFAULTS, AISDK_PROVIDERS, PROVIDER_ALIASES } from './types';
|
|
21
|
+
export { parseModelString, resolveProviderAlias, isProviderSupported, getProviderPackage, getProviderEnvKey, listSupportedProviders, registerCustomProvider, unregisterCustomProvider, getCustomProvider, createAISDKProvider, validateProviderApiKey, getMissingApiKeyMessage, type ParsedModel, type ProviderFactory, } from './provider-map';
|
|
22
|
+
export { toAISDKPrompt, toAISDKTools, fromAISDKToolCall, toAISDKToolResult, fromAISDKResult, fromAISDKStreamChunk, mapFinishReason, mapFinishReasonToProvider, toAISDKToolChoice, createSimplePrompt, type AISDKMessage, type AISDKSystemMessage, type AISDKUserMessage, type AISDKAssistantMessage, type AISDKToolMessage, } from './adapter';
|
|
23
|
+
export { createAttributionMiddleware, createLoggingMiddleware, createTimeoutMiddleware, composeMiddleware, createStandardMiddleware, redactSensitiveData, type AISDKMiddleware, } from './middleware';
|
|
24
|
+
/**
|
|
25
|
+
* Get the AISDKBackend class (lazy loaded)
|
|
26
|
+
*/
|
|
27
|
+
export declare function getAISDKBackendClass(): typeof import('./backend').AISDKBackend;
|
|
28
|
+
/**
|
|
29
|
+
* Create an AI SDK backend instance
|
|
30
|
+
*
|
|
31
|
+
* @param modelString - Model string in format "provider/model" or just "model"
|
|
32
|
+
* @param config - Optional configuration
|
|
33
|
+
* @returns AISDKBackend instance implementing LLMProvider
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```typescript
|
|
37
|
+
* const backend = createAISDKBackend('openai/gpt-4o');
|
|
38
|
+
* const backend = createAISDKBackend('anthropic/claude-3-5-sonnet');
|
|
39
|
+
* const backend = createAISDKBackend('google/gemini-2.0-flash');
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export declare function createAISDKBackend(modelString: string, config?: import('./types').AISDKBackendConfig): import('./backend').AISDKBackend;
|
|
43
|
+
export { AISDKBackend } from './backend';
|
|
44
|
+
/**
|
|
45
|
+
* Register AI SDK providers with the praisonai-ts provider registry
|
|
46
|
+
* This allows using AI SDK providers via the standard createProvider() function
|
|
47
|
+
*
|
|
48
|
+
* @param customProviders - Optional map of custom provider factories
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```typescript
|
|
52
|
+
* import { registerAISDKProviders, createProvider } from 'praisonai';
|
|
53
|
+
*
|
|
54
|
+
* // Register all AI SDK providers
|
|
55
|
+
* registerAISDKProviders();
|
|
56
|
+
*
|
|
57
|
+
* // Now you can use AI SDK providers via createProvider
|
|
58
|
+
* const provider = createProvider('aisdk:anthropic/claude-3-5-sonnet');
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
export declare function registerAISDKProviders(customProviders?: Record<string, import('./provider-map').ProviderFactory>): void;
|
|
62
|
+
/**
|
|
63
|
+
* Check if AI SDK is available (installed)
|
|
64
|
+
*/
|
|
65
|
+
export declare function isAISDKAvailable(): Promise<boolean>;
|
|
66
|
+
/**
|
|
67
|
+
* Get AI SDK version if available
|
|
68
|
+
*/
|
|
69
|
+
export declare function getAISDKVersion(): Promise<string | null>;
|