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,218 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UIMessage - AI SDK v6 Compatible UI Message Types
|
|
3
|
+
*
|
|
4
|
+
* Provides types and utilities for working with UI messages in chat applications.
|
|
5
|
+
* Compatible with AI SDK v6's UIMessage format for seamless integration.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* UI Message - The main message type for chat UIs.
|
|
9
|
+
* Compatible with AI SDK v6's UIMessage format.
|
|
10
|
+
*/
|
|
11
|
+
export interface UIMessage<METADATA = unknown, DATA_PARTS extends UIDataTypes = UIDataTypes, TOOLS extends UITools = UITools> {
|
|
12
|
+
/** Unique identifier for the message */
|
|
13
|
+
id: string;
|
|
14
|
+
/** Role of the message sender */
|
|
15
|
+
role: 'system' | 'user' | 'assistant';
|
|
16
|
+
/** Optional metadata */
|
|
17
|
+
metadata?: METADATA;
|
|
18
|
+
/** Message parts for rendering */
|
|
19
|
+
parts: Array<UIMessagePart<DATA_PARTS, TOOLS>>;
|
|
20
|
+
}
|
|
21
|
+
/** Data types that can be used in UI message data parts */
|
|
22
|
+
export type UIDataTypes = Record<string, unknown>;
|
|
23
|
+
/** UI Tool definition */
|
|
24
|
+
export type UITool = {
|
|
25
|
+
input: unknown;
|
|
26
|
+
output: unknown | undefined;
|
|
27
|
+
};
|
|
28
|
+
/** UI Tools map */
|
|
29
|
+
export type UITools = Record<string, UITool>;
|
|
30
|
+
/** All possible UI message part types */
|
|
31
|
+
export type UIMessagePart<DATA_TYPES extends UIDataTypes = UIDataTypes, TOOLS extends UITools = UITools> = TextUIPart | ReasoningUIPart | ToolUIPart<TOOLS> | SourceUrlUIPart | SourceDocumentUIPart | FileUIPart | DataUIPart<DATA_TYPES> | StepStartUIPart;
|
|
32
|
+
/** Text part of a message */
|
|
33
|
+
export interface TextUIPart {
|
|
34
|
+
type: 'text';
|
|
35
|
+
text: string;
|
|
36
|
+
state?: 'streaming' | 'done';
|
|
37
|
+
providerMetadata?: Record<string, unknown>;
|
|
38
|
+
}
|
|
39
|
+
/** Reasoning part of a message */
|
|
40
|
+
export interface ReasoningUIPart {
|
|
41
|
+
type: 'reasoning';
|
|
42
|
+
text: string;
|
|
43
|
+
state?: 'streaming' | 'done';
|
|
44
|
+
providerMetadata?: Record<string, unknown>;
|
|
45
|
+
}
|
|
46
|
+
/** Tool invocation part */
|
|
47
|
+
export interface ToolUIPart<TOOLS extends UITools = UITools> {
|
|
48
|
+
type: 'tool';
|
|
49
|
+
toolInvocationId: string;
|
|
50
|
+
toolName: keyof TOOLS & string;
|
|
51
|
+
state: 'input-streaming' | 'input-available' | 'output-streaming' | 'output-available' | 'error';
|
|
52
|
+
input?: TOOLS[keyof TOOLS]['input'];
|
|
53
|
+
output?: TOOLS[keyof TOOLS]['output'];
|
|
54
|
+
error?: string;
|
|
55
|
+
/** Whether this tool needs approval before execution */
|
|
56
|
+
needsApproval?: boolean;
|
|
57
|
+
/** Approval status */
|
|
58
|
+
approvalStatus?: 'pending' | 'approved' | 'denied';
|
|
59
|
+
}
|
|
60
|
+
/** Source URL part */
|
|
61
|
+
export interface SourceUrlUIPart {
|
|
62
|
+
type: 'source-url';
|
|
63
|
+
sourceId: string;
|
|
64
|
+
url: string;
|
|
65
|
+
title?: string;
|
|
66
|
+
providerMetadata?: Record<string, unknown>;
|
|
67
|
+
}
|
|
68
|
+
/** Source document part */
|
|
69
|
+
export interface SourceDocumentUIPart {
|
|
70
|
+
type: 'source-document';
|
|
71
|
+
sourceId: string;
|
|
72
|
+
mediaType: string;
|
|
73
|
+
title?: string;
|
|
74
|
+
providerMetadata?: Record<string, unknown>;
|
|
75
|
+
}
|
|
76
|
+
/** File part */
|
|
77
|
+
export interface FileUIPart {
|
|
78
|
+
type: 'file';
|
|
79
|
+
mediaType: string;
|
|
80
|
+
url?: string;
|
|
81
|
+
data?: string;
|
|
82
|
+
filename?: string;
|
|
83
|
+
}
|
|
84
|
+
/** Data part for custom data */
|
|
85
|
+
export interface DataUIPart<DATA_TYPES extends UIDataTypes = UIDataTypes> {
|
|
86
|
+
type: 'data';
|
|
87
|
+
dataType: keyof DATA_TYPES & string;
|
|
88
|
+
data: DATA_TYPES[keyof DATA_TYPES];
|
|
89
|
+
}
|
|
90
|
+
/** Step start marker */
|
|
91
|
+
export interface StepStartUIPart {
|
|
92
|
+
type: 'step-start';
|
|
93
|
+
stepNumber: number;
|
|
94
|
+
}
|
|
95
|
+
export interface ModelMessage {
|
|
96
|
+
role: 'system' | 'user' | 'assistant' | 'tool';
|
|
97
|
+
content: string | ModelMessageContent[];
|
|
98
|
+
name?: string;
|
|
99
|
+
toolCallId?: string;
|
|
100
|
+
toolCalls?: ToolCall[];
|
|
101
|
+
}
|
|
102
|
+
export type ModelMessageContent = {
|
|
103
|
+
type: 'text';
|
|
104
|
+
text: string;
|
|
105
|
+
} | {
|
|
106
|
+
type: 'image';
|
|
107
|
+
image: string | Uint8Array;
|
|
108
|
+
mimeType?: string;
|
|
109
|
+
} | {
|
|
110
|
+
type: 'file';
|
|
111
|
+
data: string | Uint8Array;
|
|
112
|
+
mimeType: string;
|
|
113
|
+
} | {
|
|
114
|
+
type: 'tool-call';
|
|
115
|
+
toolCallId: string;
|
|
116
|
+
toolName: string;
|
|
117
|
+
args: unknown;
|
|
118
|
+
} | {
|
|
119
|
+
type: 'tool-result';
|
|
120
|
+
toolCallId: string;
|
|
121
|
+
toolName: string;
|
|
122
|
+
result: unknown;
|
|
123
|
+
isError?: boolean;
|
|
124
|
+
};
|
|
125
|
+
export interface ToolCall {
|
|
126
|
+
id: string;
|
|
127
|
+
type: 'function';
|
|
128
|
+
function: {
|
|
129
|
+
name: string;
|
|
130
|
+
arguments: string;
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Convert UI messages to model messages for AI SDK functions.
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* ```typescript
|
|
138
|
+
* const modelMessages = await convertToModelMessages(uiMessages);
|
|
139
|
+
* const result = await generateText({ model, messages: modelMessages });
|
|
140
|
+
* ```
|
|
141
|
+
*/
|
|
142
|
+
export declare function convertToModelMessages(messages: Array<Omit<UIMessage, 'id'>>, options?: {
|
|
143
|
+
tools?: Record<string, unknown>;
|
|
144
|
+
ignoreIncompleteToolCalls?: boolean;
|
|
145
|
+
}): Promise<ModelMessage[]>;
|
|
146
|
+
/**
|
|
147
|
+
* Convert model messages to UI messages.
|
|
148
|
+
*/
|
|
149
|
+
export declare function convertToUIMessages(messages: ModelMessage[], generateId?: () => string): UIMessage[];
|
|
150
|
+
/**
|
|
151
|
+
* Validate UI messages array.
|
|
152
|
+
*/
|
|
153
|
+
export declare function validateUIMessages(messages: unknown[]): messages is UIMessage[];
|
|
154
|
+
/**
|
|
155
|
+
* Safe validation that returns result object.
|
|
156
|
+
*/
|
|
157
|
+
export declare function safeValidateUIMessages(messages: unknown[]): {
|
|
158
|
+
success: boolean;
|
|
159
|
+
value?: UIMessage[];
|
|
160
|
+
error?: string;
|
|
161
|
+
};
|
|
162
|
+
/**
|
|
163
|
+
* Create a text UI message.
|
|
164
|
+
*/
|
|
165
|
+
export declare function createTextMessage(role: 'user' | 'assistant', text: string, id?: string): UIMessage;
|
|
166
|
+
/**
|
|
167
|
+
* Create a system message.
|
|
168
|
+
*/
|
|
169
|
+
export declare function createSystemMessage(text: string, id?: string): UIMessage;
|
|
170
|
+
/**
|
|
171
|
+
* Check if a message has pending tool approvals.
|
|
172
|
+
*/
|
|
173
|
+
export declare function hasPendingApprovals(message: UIMessage): boolean;
|
|
174
|
+
/**
|
|
175
|
+
* Get tool parts that need approval.
|
|
176
|
+
*/
|
|
177
|
+
export declare function getToolsNeedingApproval(message: UIMessage): ToolUIPart[];
|
|
178
|
+
/**
|
|
179
|
+
* Create an approval response for a tool.
|
|
180
|
+
*/
|
|
181
|
+
export declare function createApprovalResponse(toolInvocationId: string, approved: boolean): {
|
|
182
|
+
toolInvocationId: string;
|
|
183
|
+
approved: boolean;
|
|
184
|
+
};
|
|
185
|
+
export interface UIMessageStreamOptions {
|
|
186
|
+
/** Called when a message is created */
|
|
187
|
+
onMessage?: (message: UIMessage) => void;
|
|
188
|
+
/** Called when a part is added */
|
|
189
|
+
onPart?: (part: UIMessagePart) => void;
|
|
190
|
+
/** Called on error */
|
|
191
|
+
onError?: (error: Error) => void;
|
|
192
|
+
/** Called when stream completes */
|
|
193
|
+
onFinish?: (messages: UIMessage[]) => void;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Create a UI message stream response for Next.js route handlers.
|
|
197
|
+
*
|
|
198
|
+
* @example
|
|
199
|
+
* ```typescript
|
|
200
|
+
* // In app/api/chat/route.ts
|
|
201
|
+
* export async function POST(req: Request) {
|
|
202
|
+
* const { messages } = await req.json();
|
|
203
|
+
* const result = await streamText({ model, messages });
|
|
204
|
+
* return toUIMessageStreamResponse(result);
|
|
205
|
+
* }
|
|
206
|
+
* ```
|
|
207
|
+
*/
|
|
208
|
+
export declare function toUIMessageStreamResponse(stream: AsyncIterable<any>, options?: {
|
|
209
|
+
headers?: Record<string, string>;
|
|
210
|
+
status?: number;
|
|
211
|
+
}): Response;
|
|
212
|
+
/**
|
|
213
|
+
* Pipe UI message stream to a Node.js response.
|
|
214
|
+
*/
|
|
215
|
+
export declare function pipeUIMessageStreamToResponse(stream: AsyncIterable<any>, response: {
|
|
216
|
+
write: (chunk: string) => void;
|
|
217
|
+
end: () => void;
|
|
218
|
+
}): void;
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* UIMessage - AI SDK v6 Compatible UI Message Types
|
|
4
|
+
*
|
|
5
|
+
* Provides types and utilities for working with UI messages in chat applications.
|
|
6
|
+
* Compatible with AI SDK v6's UIMessage format for seamless integration.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.convertToModelMessages = convertToModelMessages;
|
|
10
|
+
exports.convertToUIMessages = convertToUIMessages;
|
|
11
|
+
exports.validateUIMessages = validateUIMessages;
|
|
12
|
+
exports.safeValidateUIMessages = safeValidateUIMessages;
|
|
13
|
+
exports.createTextMessage = createTextMessage;
|
|
14
|
+
exports.createSystemMessage = createSystemMessage;
|
|
15
|
+
exports.hasPendingApprovals = hasPendingApprovals;
|
|
16
|
+
exports.getToolsNeedingApproval = getToolsNeedingApproval;
|
|
17
|
+
exports.createApprovalResponse = createApprovalResponse;
|
|
18
|
+
exports.toUIMessageStreamResponse = toUIMessageStreamResponse;
|
|
19
|
+
exports.pipeUIMessageStreamToResponse = pipeUIMessageStreamToResponse;
|
|
20
|
+
// ============================================================================
|
|
21
|
+
// Conversion Functions
|
|
22
|
+
// ============================================================================
|
|
23
|
+
/**
|
|
24
|
+
* Convert UI messages to model messages for AI SDK functions.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```typescript
|
|
28
|
+
* const modelMessages = await convertToModelMessages(uiMessages);
|
|
29
|
+
* const result = await generateText({ model, messages: modelMessages });
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
async function convertToModelMessages(messages, options) {
|
|
33
|
+
const modelMessages = [];
|
|
34
|
+
for (const message of messages) {
|
|
35
|
+
switch (message.role) {
|
|
36
|
+
case 'system': {
|
|
37
|
+
const textParts = message.parts.filter((part) => part.type === 'text');
|
|
38
|
+
if (textParts.length > 0) {
|
|
39
|
+
modelMessages.push({
|
|
40
|
+
role: 'system',
|
|
41
|
+
content: textParts.map(p => p.text).join(''),
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
case 'user': {
|
|
47
|
+
const content = [];
|
|
48
|
+
for (const part of message.parts) {
|
|
49
|
+
if (part.type === 'text') {
|
|
50
|
+
content.push({ type: 'text', text: part.text });
|
|
51
|
+
}
|
|
52
|
+
else if (part.type === 'file') {
|
|
53
|
+
content.push({
|
|
54
|
+
type: 'file',
|
|
55
|
+
data: part.data || '',
|
|
56
|
+
mimeType: part.mediaType,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
if (content.length > 0) {
|
|
61
|
+
modelMessages.push({
|
|
62
|
+
role: 'user',
|
|
63
|
+
content: content.length === 1 && content[0].type === 'text'
|
|
64
|
+
? content[0].text
|
|
65
|
+
: content,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
case 'assistant': {
|
|
71
|
+
const content = [];
|
|
72
|
+
const toolCalls = [];
|
|
73
|
+
for (const part of message.parts) {
|
|
74
|
+
if (part.type === 'text') {
|
|
75
|
+
content.push({ type: 'text', text: part.text });
|
|
76
|
+
}
|
|
77
|
+
else if (part.type === 'tool') {
|
|
78
|
+
// Skip incomplete tool calls if requested
|
|
79
|
+
if (options?.ignoreIncompleteToolCalls &&
|
|
80
|
+
(part.state === 'input-streaming' || part.state === 'input-available')) {
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
toolCalls.push({
|
|
84
|
+
id: part.toolInvocationId,
|
|
85
|
+
type: 'function',
|
|
86
|
+
function: {
|
|
87
|
+
name: part.toolName,
|
|
88
|
+
arguments: JSON.stringify(part.input || {}),
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
if (content.length > 0 || toolCalls.length > 0) {
|
|
94
|
+
modelMessages.push({
|
|
95
|
+
role: 'assistant',
|
|
96
|
+
content: content.length === 1 && content[0].type === 'text'
|
|
97
|
+
? content[0].text
|
|
98
|
+
: content.length > 0 ? content : '',
|
|
99
|
+
...(toolCalls.length > 0 ? { toolCalls } : {}),
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
// Add tool results as separate messages
|
|
103
|
+
for (const part of message.parts) {
|
|
104
|
+
if (part.type === 'tool' && part.state === 'output-available' && part.output !== undefined) {
|
|
105
|
+
modelMessages.push({
|
|
106
|
+
role: 'tool',
|
|
107
|
+
content: typeof part.output === 'string' ? part.output : JSON.stringify(part.output),
|
|
108
|
+
toolCallId: part.toolInvocationId,
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return modelMessages;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Convert model messages to UI messages.
|
|
120
|
+
*/
|
|
121
|
+
function convertToUIMessages(messages, generateId = () => crypto.randomUUID()) {
|
|
122
|
+
const uiMessages = [];
|
|
123
|
+
for (const message of messages) {
|
|
124
|
+
const parts = [];
|
|
125
|
+
if (typeof message.content === 'string') {
|
|
126
|
+
parts.push({ type: 'text', text: message.content, state: 'done' });
|
|
127
|
+
}
|
|
128
|
+
else if (Array.isArray(message.content)) {
|
|
129
|
+
for (const content of message.content) {
|
|
130
|
+
if (content.type === 'text') {
|
|
131
|
+
parts.push({ type: 'text', text: content.text, state: 'done' });
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
if (message.toolCalls) {
|
|
136
|
+
for (const toolCall of message.toolCalls) {
|
|
137
|
+
parts.push({
|
|
138
|
+
type: 'tool',
|
|
139
|
+
toolInvocationId: toolCall.id,
|
|
140
|
+
toolName: toolCall.function.name,
|
|
141
|
+
state: 'input-available',
|
|
142
|
+
input: JSON.parse(toolCall.function.arguments || '{}'),
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
if (message.role !== 'tool') {
|
|
147
|
+
uiMessages.push({
|
|
148
|
+
id: generateId(),
|
|
149
|
+
role: message.role,
|
|
150
|
+
parts,
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return uiMessages;
|
|
155
|
+
}
|
|
156
|
+
// ============================================================================
|
|
157
|
+
// Validation
|
|
158
|
+
// ============================================================================
|
|
159
|
+
/**
|
|
160
|
+
* Validate UI messages array.
|
|
161
|
+
*/
|
|
162
|
+
function validateUIMessages(messages) {
|
|
163
|
+
if (!Array.isArray(messages))
|
|
164
|
+
return false;
|
|
165
|
+
for (const msg of messages) {
|
|
166
|
+
if (!msg || typeof msg !== 'object')
|
|
167
|
+
return false;
|
|
168
|
+
const m = msg;
|
|
169
|
+
if (typeof m.id !== 'string')
|
|
170
|
+
return false;
|
|
171
|
+
if (!['system', 'user', 'assistant'].includes(m.role))
|
|
172
|
+
return false;
|
|
173
|
+
if (!Array.isArray(m.parts))
|
|
174
|
+
return false;
|
|
175
|
+
}
|
|
176
|
+
return true;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Safe validation that returns result object.
|
|
180
|
+
*/
|
|
181
|
+
function safeValidateUIMessages(messages) {
|
|
182
|
+
try {
|
|
183
|
+
if (validateUIMessages(messages)) {
|
|
184
|
+
return { success: true, value: messages };
|
|
185
|
+
}
|
|
186
|
+
return { success: false, error: 'Invalid UI messages format' };
|
|
187
|
+
}
|
|
188
|
+
catch (error) {
|
|
189
|
+
return { success: false, error: String(error) };
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
// ============================================================================
|
|
193
|
+
// Helper Functions
|
|
194
|
+
// ============================================================================
|
|
195
|
+
/**
|
|
196
|
+
* Create a text UI message.
|
|
197
|
+
*/
|
|
198
|
+
function createTextMessage(role, text, id) {
|
|
199
|
+
return {
|
|
200
|
+
id: id || crypto.randomUUID(),
|
|
201
|
+
role,
|
|
202
|
+
parts: [{ type: 'text', text, state: 'done' }],
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Create a system message.
|
|
207
|
+
*/
|
|
208
|
+
function createSystemMessage(text, id) {
|
|
209
|
+
return {
|
|
210
|
+
id: id || crypto.randomUUID(),
|
|
211
|
+
role: 'system',
|
|
212
|
+
parts: [{ type: 'text', text, state: 'done' }],
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Check if a message has pending tool approvals.
|
|
217
|
+
*/
|
|
218
|
+
function hasPendingApprovals(message) {
|
|
219
|
+
return message.parts.some(part => part.type === 'tool' && part.needsApproval && part.approvalStatus === 'pending');
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Get tool parts that need approval.
|
|
223
|
+
*/
|
|
224
|
+
function getToolsNeedingApproval(message) {
|
|
225
|
+
return message.parts.filter((part) => part.type === 'tool' && part.needsApproval === true && part.approvalStatus === 'pending');
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Create an approval response for a tool.
|
|
229
|
+
*/
|
|
230
|
+
function createApprovalResponse(toolInvocationId, approved) {
|
|
231
|
+
return { toolInvocationId, approved };
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Create a UI message stream response for Next.js route handlers.
|
|
235
|
+
*
|
|
236
|
+
* @example
|
|
237
|
+
* ```typescript
|
|
238
|
+
* // In app/api/chat/route.ts
|
|
239
|
+
* export async function POST(req: Request) {
|
|
240
|
+
* const { messages } = await req.json();
|
|
241
|
+
* const result = await streamText({ model, messages });
|
|
242
|
+
* return toUIMessageStreamResponse(result);
|
|
243
|
+
* }
|
|
244
|
+
* ```
|
|
245
|
+
*/
|
|
246
|
+
function toUIMessageStreamResponse(stream, options) {
|
|
247
|
+
const encoder = new TextEncoder();
|
|
248
|
+
const readable = new ReadableStream({
|
|
249
|
+
async start(controller) {
|
|
250
|
+
try {
|
|
251
|
+
for await (const chunk of stream) {
|
|
252
|
+
const data = JSON.stringify(chunk);
|
|
253
|
+
controller.enqueue(encoder.encode(`data: ${data}\n\n`));
|
|
254
|
+
}
|
|
255
|
+
controller.enqueue(encoder.encode('data: [DONE]\n\n'));
|
|
256
|
+
controller.close();
|
|
257
|
+
}
|
|
258
|
+
catch (error) {
|
|
259
|
+
controller.error(error);
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
});
|
|
263
|
+
return new Response(readable, {
|
|
264
|
+
status: options?.status || 200,
|
|
265
|
+
headers: {
|
|
266
|
+
'Content-Type': 'text/event-stream',
|
|
267
|
+
'Cache-Control': 'no-cache',
|
|
268
|
+
'Connection': 'keep-alive',
|
|
269
|
+
...options?.headers,
|
|
270
|
+
},
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Pipe UI message stream to a Node.js response.
|
|
275
|
+
*/
|
|
276
|
+
function pipeUIMessageStreamToResponse(stream, response) {
|
|
277
|
+
(async () => {
|
|
278
|
+
try {
|
|
279
|
+
for await (const chunk of stream) {
|
|
280
|
+
const data = JSON.stringify(chunk);
|
|
281
|
+
response.write(`data: ${data}\n\n`);
|
|
282
|
+
}
|
|
283
|
+
response.write('data: [DONE]\n\n');
|
|
284
|
+
response.end();
|
|
285
|
+
}
|
|
286
|
+
catch (error) {
|
|
287
|
+
response.write(`data: ${JSON.stringify({ error: String(error) })}\n\n`);
|
|
288
|
+
response.end();
|
|
289
|
+
}
|
|
290
|
+
})();
|
|
291
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AutoAgents - Automatic agent generation from task descriptions
|
|
3
|
+
*/
|
|
4
|
+
export interface AgentConfig {
|
|
5
|
+
name: string;
|
|
6
|
+
role: string;
|
|
7
|
+
goal: string;
|
|
8
|
+
backstory?: string;
|
|
9
|
+
instructions?: string;
|
|
10
|
+
tools?: string[];
|
|
11
|
+
}
|
|
12
|
+
export interface TaskConfig {
|
|
13
|
+
description: string;
|
|
14
|
+
expectedOutput?: string;
|
|
15
|
+
agent?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface TeamStructure {
|
|
18
|
+
agents: AgentConfig[];
|
|
19
|
+
tasks: TaskConfig[];
|
|
20
|
+
pattern: 'sequential' | 'parallel' | 'hierarchical';
|
|
21
|
+
}
|
|
22
|
+
export interface AutoAgentsConfig {
|
|
23
|
+
llm?: string;
|
|
24
|
+
pattern?: 'sequential' | 'parallel' | 'routing' | 'orchestrator-workers' | 'evaluator-optimizer';
|
|
25
|
+
singleAgent?: boolean;
|
|
26
|
+
verbose?: boolean;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* AutoAgents - Generate agent configurations from task descriptions
|
|
30
|
+
*/
|
|
31
|
+
export declare class AutoAgents {
|
|
32
|
+
private provider;
|
|
33
|
+
private providerPromise;
|
|
34
|
+
private llmModel;
|
|
35
|
+
private pattern;
|
|
36
|
+
private singleAgent;
|
|
37
|
+
private verbose;
|
|
38
|
+
constructor(config?: AutoAgentsConfig);
|
|
39
|
+
/**
|
|
40
|
+
* Get the LLM provider (lazy initialization with AI SDK backend)
|
|
41
|
+
*/
|
|
42
|
+
private getProvider;
|
|
43
|
+
/**
|
|
44
|
+
* Generate agent configuration from task description
|
|
45
|
+
*/
|
|
46
|
+
generate(taskDescription: string): Promise<TeamStructure>;
|
|
47
|
+
/**
|
|
48
|
+
* Recommend a pattern for the task
|
|
49
|
+
*/
|
|
50
|
+
recommendPattern(taskDescription: string): string;
|
|
51
|
+
/**
|
|
52
|
+
* Analyze task complexity
|
|
53
|
+
*/
|
|
54
|
+
analyzeComplexity(taskDescription: string): 'simple' | 'moderate' | 'complex';
|
|
55
|
+
private getSystemPrompt;
|
|
56
|
+
private buildPrompt;
|
|
57
|
+
private parseResponse;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Create an AutoAgents instance
|
|
61
|
+
*/
|
|
62
|
+
export declare function createAutoAgents(config?: AutoAgentsConfig): AutoAgents;
|