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,576 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Tools command - List, manage, and test AI SDK tools
|
|
4
|
+
*
|
|
5
|
+
* Subcommands:
|
|
6
|
+
* list - List all available tools
|
|
7
|
+
* info - Get detailed info about a tool
|
|
8
|
+
* doctor - Check tool dependencies and env vars
|
|
9
|
+
* example - Show usage example for a tool
|
|
10
|
+
* add - Register a custom tool from npm/local
|
|
11
|
+
* test - Test a tool (dry-run or live)
|
|
12
|
+
*/
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc);
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
+
}) : function(o, v) {
|
|
27
|
+
o["default"] = v;
|
|
28
|
+
});
|
|
29
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
30
|
+
var ownKeys = function(o) {
|
|
31
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
32
|
+
var ar = [];
|
|
33
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
34
|
+
return ar;
|
|
35
|
+
};
|
|
36
|
+
return ownKeys(o);
|
|
37
|
+
};
|
|
38
|
+
return function (mod) {
|
|
39
|
+
if (mod && mod.__esModule) return mod;
|
|
40
|
+
var result = {};
|
|
41
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
42
|
+
__setModuleDefault(result, mod);
|
|
43
|
+
return result;
|
|
44
|
+
};
|
|
45
|
+
})();
|
|
46
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
47
|
+
exports.execute = execute;
|
|
48
|
+
const decorator_1 = require("../../tools/decorator");
|
|
49
|
+
const registry_1 = require("../../tools/registry/registry");
|
|
50
|
+
const tools_1 = require("../../tools/tools");
|
|
51
|
+
const builtins_1 = require("../../tools/builtins");
|
|
52
|
+
const cli_spec_1 = require("../spec/cli-spec");
|
|
53
|
+
const pretty_logger_1 = require("../../utils/pretty-logger");
|
|
54
|
+
function outputJson(data) {
|
|
55
|
+
console.log(JSON.stringify(data, null, 2));
|
|
56
|
+
}
|
|
57
|
+
function formatSuccess(data) {
|
|
58
|
+
return { success: true, data };
|
|
59
|
+
}
|
|
60
|
+
function formatError(code, message) {
|
|
61
|
+
return { success: false, error: { code, message } };
|
|
62
|
+
}
|
|
63
|
+
const ERROR_CODES = {
|
|
64
|
+
INVALID_ARGS: 'INVALID_ARGS',
|
|
65
|
+
MISSING_ARG: 'MISSING_ARG',
|
|
66
|
+
TOOL_NOT_FOUND: 'TOOL_NOT_FOUND',
|
|
67
|
+
RUNTIME_ERROR: 'RUNTIME_ERROR',
|
|
68
|
+
};
|
|
69
|
+
async function printKeyValue(entries) {
|
|
70
|
+
for (const [key, value] of Object.entries(entries)) {
|
|
71
|
+
await pretty_logger_1.PrettyLogger.plain(` ${key}: ${value}`);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
// Ensure built-in tools are registered
|
|
75
|
+
let builtinsRegistered = false;
|
|
76
|
+
function ensureBuiltinsRegistered() {
|
|
77
|
+
if (!builtinsRegistered) {
|
|
78
|
+
(0, tools_1.registerBuiltinTools)();
|
|
79
|
+
builtinsRegistered = true;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
async function execute(args, options) {
|
|
83
|
+
const subcommand = args[0] || 'list';
|
|
84
|
+
const outputFormat = options.json ? 'json' : (options.output || 'pretty');
|
|
85
|
+
switch (subcommand) {
|
|
86
|
+
case 'list':
|
|
87
|
+
await listTools(options, outputFormat);
|
|
88
|
+
break;
|
|
89
|
+
case 'info':
|
|
90
|
+
await toolInfo(args.slice(1), options, outputFormat);
|
|
91
|
+
break;
|
|
92
|
+
case 'doctor':
|
|
93
|
+
await toolDoctor(options, outputFormat);
|
|
94
|
+
break;
|
|
95
|
+
case 'example':
|
|
96
|
+
await toolExample(args.slice(1), options, outputFormat);
|
|
97
|
+
break;
|
|
98
|
+
case 'add':
|
|
99
|
+
await toolAdd(args.slice(1), options, outputFormat);
|
|
100
|
+
break;
|
|
101
|
+
case 'test':
|
|
102
|
+
await toolTest(args.slice(1), options, outputFormat);
|
|
103
|
+
break;
|
|
104
|
+
default:
|
|
105
|
+
if (outputFormat === 'json') {
|
|
106
|
+
outputJson(formatError(ERROR_CODES.INVALID_ARGS, `Unknown subcommand: ${subcommand}`));
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
await pretty_logger_1.PrettyLogger.error(`Unknown subcommand: ${subcommand}`);
|
|
110
|
+
await pretty_logger_1.PrettyLogger.plain('Available subcommands: list, info, doctor, example, add, test');
|
|
111
|
+
}
|
|
112
|
+
process.exit(cli_spec_1.EXIT_CODES.INVALID_ARGUMENTS);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
async function listTools(options, outputFormat) {
|
|
116
|
+
ensureBuiltinsRegistered();
|
|
117
|
+
// Get all built-in tool metadata
|
|
118
|
+
const builtinMetadata = await (0, builtins_1.getAllBuiltinMetadata)();
|
|
119
|
+
// Get registered tools from decorator registry (legacy)
|
|
120
|
+
const decoratorRegistry = (0, decorator_1.getRegistry)();
|
|
121
|
+
const registeredTools = decoratorRegistry.list();
|
|
122
|
+
// Filter by tag if specified
|
|
123
|
+
let filteredMetadata = builtinMetadata;
|
|
124
|
+
if (options.tag) {
|
|
125
|
+
filteredMetadata = builtinMetadata.filter(m => m.tags.includes(options.tag));
|
|
126
|
+
}
|
|
127
|
+
if (outputFormat === 'json') {
|
|
128
|
+
outputJson(formatSuccess({
|
|
129
|
+
builtinTools: filteredMetadata.map(m => ({
|
|
130
|
+
id: m.id,
|
|
131
|
+
name: m.displayName,
|
|
132
|
+
description: m.description,
|
|
133
|
+
tags: m.tags,
|
|
134
|
+
packageName: m.packageName,
|
|
135
|
+
requiredEnv: m.requiredEnv,
|
|
136
|
+
capabilities: m.capabilities,
|
|
137
|
+
})),
|
|
138
|
+
registeredTools: registeredTools.map((t) => ({
|
|
139
|
+
name: t.name,
|
|
140
|
+
description: t.description,
|
|
141
|
+
})),
|
|
142
|
+
count: filteredMetadata.length + registeredTools.length
|
|
143
|
+
}));
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
await pretty_logger_1.PrettyLogger.heading('AI SDK Tools Registry');
|
|
147
|
+
await pretty_logger_1.PrettyLogger.plain('\nBuilt-in Tools:');
|
|
148
|
+
for (const meta of filteredMetadata) {
|
|
149
|
+
const tags = meta.tags.slice(0, 3).join(', ');
|
|
150
|
+
await pretty_logger_1.PrettyLogger.plain(` • ${meta.id} (${meta.displayName})`);
|
|
151
|
+
await pretty_logger_1.PrettyLogger.dim(` ${meta.description}`);
|
|
152
|
+
await pretty_logger_1.PrettyLogger.dim(` Tags: ${tags} | Package: ${meta.packageName}`);
|
|
153
|
+
}
|
|
154
|
+
if (registeredTools.length > 0) {
|
|
155
|
+
await pretty_logger_1.PrettyLogger.newline();
|
|
156
|
+
await pretty_logger_1.PrettyLogger.plain('Custom Registered Tools:');
|
|
157
|
+
for (const tool of registeredTools) {
|
|
158
|
+
await pretty_logger_1.PrettyLogger.plain(` • ${tool.name}`);
|
|
159
|
+
if (tool.description) {
|
|
160
|
+
await pretty_logger_1.PrettyLogger.dim(` ${tool.description}`);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
await pretty_logger_1.PrettyLogger.newline();
|
|
165
|
+
await pretty_logger_1.PrettyLogger.info(`Total: ${filteredMetadata.length + registeredTools.length} tools`);
|
|
166
|
+
await pretty_logger_1.PrettyLogger.dim('\nUse "overai tools info <id>" for details');
|
|
167
|
+
await pretty_logger_1.PrettyLogger.dim('Use "overai tools doctor" to check dependencies');
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
async function toolInfo(args, options, outputFormat) {
|
|
171
|
+
ensureBuiltinsRegistered();
|
|
172
|
+
const toolId = args[0];
|
|
173
|
+
if (!toolId) {
|
|
174
|
+
if (outputFormat === 'json') {
|
|
175
|
+
outputJson(formatError(ERROR_CODES.MISSING_ARG, 'Please provide a tool ID'));
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
await pretty_logger_1.PrettyLogger.error('Please provide a tool ID');
|
|
179
|
+
}
|
|
180
|
+
process.exit(cli_spec_1.EXIT_CODES.INVALID_ARGUMENTS);
|
|
181
|
+
}
|
|
182
|
+
// Look for tool in built-in metadata
|
|
183
|
+
const builtinMetadata = await (0, builtins_1.getAllBuiltinMetadata)();
|
|
184
|
+
const metadata = builtinMetadata.find(m => m.id === toolId);
|
|
185
|
+
// Also check decorator registry
|
|
186
|
+
const decoratorRegistry = (0, decorator_1.getRegistry)();
|
|
187
|
+
const registeredTool = decoratorRegistry.get(toolId);
|
|
188
|
+
if (!metadata && !registeredTool) {
|
|
189
|
+
if (outputFormat === 'json') {
|
|
190
|
+
outputJson(formatError(ERROR_CODES.TOOL_NOT_FOUND, `Tool not found: ${toolId}`));
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
await pretty_logger_1.PrettyLogger.error(`Tool not found: ${toolId}`);
|
|
194
|
+
await pretty_logger_1.PrettyLogger.dim('Use "overai tools list" to see available tools');
|
|
195
|
+
}
|
|
196
|
+
process.exit(cli_spec_1.EXIT_CODES.RUNTIME_ERROR);
|
|
197
|
+
}
|
|
198
|
+
if (outputFormat === 'json') {
|
|
199
|
+
outputJson(formatSuccess({
|
|
200
|
+
tool: metadata ? {
|
|
201
|
+
id: metadata.id,
|
|
202
|
+
name: metadata.displayName,
|
|
203
|
+
description: metadata.description,
|
|
204
|
+
tags: metadata.tags,
|
|
205
|
+
packageName: metadata.packageName,
|
|
206
|
+
requiredEnv: metadata.requiredEnv,
|
|
207
|
+
optionalEnv: metadata.optionalEnv,
|
|
208
|
+
install: metadata.install,
|
|
209
|
+
capabilities: metadata.capabilities,
|
|
210
|
+
docsSlug: metadata.docsSlug,
|
|
211
|
+
} : {
|
|
212
|
+
name: registeredTool.name,
|
|
213
|
+
description: registeredTool.description,
|
|
214
|
+
type: 'registered'
|
|
215
|
+
}
|
|
216
|
+
}));
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
if (metadata) {
|
|
220
|
+
await pretty_logger_1.PrettyLogger.heading(`Tool: ${metadata.displayName}`);
|
|
221
|
+
await printKeyValue({
|
|
222
|
+
'ID': metadata.id,
|
|
223
|
+
'Description': metadata.description,
|
|
224
|
+
'Package': metadata.packageName,
|
|
225
|
+
'Tags': metadata.tags.join(', '),
|
|
226
|
+
'Docs': `https://docs.praison.ai/js/${metadata.docsSlug}`,
|
|
227
|
+
});
|
|
228
|
+
await pretty_logger_1.PrettyLogger.newline();
|
|
229
|
+
await pretty_logger_1.PrettyLogger.plain('Required Environment Variables:');
|
|
230
|
+
if (metadata.requiredEnv.length > 0) {
|
|
231
|
+
for (const env of metadata.requiredEnv) {
|
|
232
|
+
const isSet = !!process.env[env];
|
|
233
|
+
await pretty_logger_1.PrettyLogger.plain(` ${isSet ? '✓' : '✗'} ${env}`);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
else {
|
|
237
|
+
await pretty_logger_1.PrettyLogger.dim(' None');
|
|
238
|
+
}
|
|
239
|
+
await pretty_logger_1.PrettyLogger.newline();
|
|
240
|
+
await pretty_logger_1.PrettyLogger.plain('Installation:');
|
|
241
|
+
await pretty_logger_1.PrettyLogger.plain(` ${metadata.install.npm}`);
|
|
242
|
+
await pretty_logger_1.PrettyLogger.newline();
|
|
243
|
+
await pretty_logger_1.PrettyLogger.plain('Capabilities:');
|
|
244
|
+
const caps = Object.entries(metadata.capabilities)
|
|
245
|
+
.filter(([_, v]) => v)
|
|
246
|
+
.map(([k]) => k);
|
|
247
|
+
await pretty_logger_1.PrettyLogger.plain(` ${caps.join(', ') || 'None specified'}`);
|
|
248
|
+
}
|
|
249
|
+
else {
|
|
250
|
+
await pretty_logger_1.PrettyLogger.heading(`Tool: ${registeredTool.name}`);
|
|
251
|
+
await printKeyValue({
|
|
252
|
+
'Name': registeredTool.name,
|
|
253
|
+
'Type': 'Custom Registered',
|
|
254
|
+
'Description': registeredTool.description || 'No description'
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
async function toolDoctor(options, outputFormat) {
|
|
260
|
+
ensureBuiltinsRegistered();
|
|
261
|
+
const builtinMetadata = await (0, builtins_1.getAllBuiltinMetadata)();
|
|
262
|
+
const results = [];
|
|
263
|
+
for (const meta of builtinMetadata) {
|
|
264
|
+
// Check env vars
|
|
265
|
+
const missingEnv = meta.requiredEnv.filter(env => !process.env[env]);
|
|
266
|
+
// Check if package is installed (check node_modules)
|
|
267
|
+
let installed = false;
|
|
268
|
+
try {
|
|
269
|
+
// First try require.resolve for CJS packages
|
|
270
|
+
require.resolve(meta.packageName);
|
|
271
|
+
installed = true;
|
|
272
|
+
}
|
|
273
|
+
catch {
|
|
274
|
+
// For ESM packages, check if the package directory exists
|
|
275
|
+
try {
|
|
276
|
+
const path = await Promise.resolve().then(() => __importStar(require('path')));
|
|
277
|
+
const fs = await Promise.resolve().then(() => __importStar(require('fs')));
|
|
278
|
+
const packagePath = path.join(process.cwd(), 'node_modules', ...meta.packageName.split('/'));
|
|
279
|
+
installed = fs.existsSync(packagePath);
|
|
280
|
+
}
|
|
281
|
+
catch {
|
|
282
|
+
installed = false;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
results.push({
|
|
286
|
+
id: meta.id,
|
|
287
|
+
name: meta.displayName,
|
|
288
|
+
installed,
|
|
289
|
+
missingEnv,
|
|
290
|
+
installCmd: installed ? undefined : meta.install.npm,
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
const allGood = results.every(r => r.installed && r.missingEnv.length === 0);
|
|
294
|
+
const installedCount = results.filter(r => r.installed).length;
|
|
295
|
+
const envIssues = results.filter(r => r.missingEnv.length > 0).length;
|
|
296
|
+
if (outputFormat === 'json') {
|
|
297
|
+
outputJson(formatSuccess({
|
|
298
|
+
status: allGood ? 'healthy' : 'issues_found',
|
|
299
|
+
summary: {
|
|
300
|
+
total: results.length,
|
|
301
|
+
installed: installedCount,
|
|
302
|
+
notInstalled: results.length - installedCount,
|
|
303
|
+
missingEnvVars: envIssues,
|
|
304
|
+
},
|
|
305
|
+
tools: results,
|
|
306
|
+
}));
|
|
307
|
+
}
|
|
308
|
+
else {
|
|
309
|
+
await pretty_logger_1.PrettyLogger.heading('Tools Health Check');
|
|
310
|
+
await pretty_logger_1.PrettyLogger.newline();
|
|
311
|
+
await pretty_logger_1.PrettyLogger.plain(`Summary: ${installedCount}/${results.length} packages installed, ${envIssues} with missing env vars`);
|
|
312
|
+
await pretty_logger_1.PrettyLogger.newline();
|
|
313
|
+
for (const result of results) {
|
|
314
|
+
const status = result.installed && result.missingEnv.length === 0 ? '✓' : '✗';
|
|
315
|
+
await pretty_logger_1.PrettyLogger.plain(`${status} ${result.id} (${result.name})`);
|
|
316
|
+
if (!result.installed) {
|
|
317
|
+
await pretty_logger_1.PrettyLogger.dim(` Package not installed: ${result.installCmd}`);
|
|
318
|
+
}
|
|
319
|
+
if (result.missingEnv.length > 0) {
|
|
320
|
+
await pretty_logger_1.PrettyLogger.dim(` Missing env vars: ${result.missingEnv.join(', ')}`);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
await pretty_logger_1.PrettyLogger.newline();
|
|
324
|
+
if (allGood) {
|
|
325
|
+
await pretty_logger_1.PrettyLogger.info('All tools are ready to use!');
|
|
326
|
+
}
|
|
327
|
+
else {
|
|
328
|
+
await pretty_logger_1.PrettyLogger.warning('Some tools need attention. Install packages and set env vars as needed.');
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
async function toolExample(args, options, outputFormat) {
|
|
333
|
+
const toolId = args[0];
|
|
334
|
+
if (!toolId) {
|
|
335
|
+
if (outputFormat === 'json') {
|
|
336
|
+
outputJson(formatError(ERROR_CODES.MISSING_ARG, 'Please provide a tool ID'));
|
|
337
|
+
}
|
|
338
|
+
else {
|
|
339
|
+
await pretty_logger_1.PrettyLogger.error('Please provide a tool ID');
|
|
340
|
+
}
|
|
341
|
+
process.exit(cli_spec_1.EXIT_CODES.INVALID_ARGUMENTS);
|
|
342
|
+
}
|
|
343
|
+
// Tool examples
|
|
344
|
+
const examples = {
|
|
345
|
+
'code-execution': `
|
|
346
|
+
import { Agent, tools } from 'overai';
|
|
347
|
+
|
|
348
|
+
const agent = new Agent({
|
|
349
|
+
name: 'CodeRunner',
|
|
350
|
+
instructions: 'You can execute Python code to solve problems.',
|
|
351
|
+
tools: [tools.codeExecution()],
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
const result = await agent.run('Calculate the factorial of 10');
|
|
355
|
+
console.log(result.text);
|
|
356
|
+
`,
|
|
357
|
+
'tavily': `
|
|
358
|
+
import { Agent, tools } from 'overai';
|
|
359
|
+
|
|
360
|
+
const agent = new Agent({
|
|
361
|
+
name: 'Researcher',
|
|
362
|
+
instructions: 'Search the web for information.',
|
|
363
|
+
tools: [tools.tavily()],
|
|
364
|
+
});
|
|
365
|
+
|
|
366
|
+
const result = await agent.run('What are the latest AI developments?');
|
|
367
|
+
console.log(result.text);
|
|
368
|
+
`,
|
|
369
|
+
'exa': `
|
|
370
|
+
import { Agent, tools } from 'overai';
|
|
371
|
+
|
|
372
|
+
const agent = new Agent({
|
|
373
|
+
name: 'WebSearcher',
|
|
374
|
+
instructions: 'Search the web using semantic search.',
|
|
375
|
+
tools: [tools.exa()],
|
|
376
|
+
});
|
|
377
|
+
|
|
378
|
+
const result = await agent.run('Find AI companies in Europe');
|
|
379
|
+
console.log(result.text);
|
|
380
|
+
`,
|
|
381
|
+
'superagent': `
|
|
382
|
+
import { Agent, tools } from 'overai';
|
|
383
|
+
|
|
384
|
+
const agent = new Agent({
|
|
385
|
+
name: 'SecureAgent',
|
|
386
|
+
instructions: 'Process text securely.',
|
|
387
|
+
tools: [
|
|
388
|
+
tools.guard(), // Check for prompt injection
|
|
389
|
+
tools.redact(), // Remove PII
|
|
390
|
+
tools.verify(), // Verify claims
|
|
391
|
+
],
|
|
392
|
+
});
|
|
393
|
+
|
|
394
|
+
const result = await agent.run('Check this text for security issues');
|
|
395
|
+
console.log(result.text);
|
|
396
|
+
`,
|
|
397
|
+
'valyu': `
|
|
398
|
+
import { Agent, tools } from 'overai';
|
|
399
|
+
|
|
400
|
+
const agent = new Agent({
|
|
401
|
+
name: 'FinanceResearcher',
|
|
402
|
+
instructions: 'Research financial data.',
|
|
403
|
+
tools: [
|
|
404
|
+
tools.valyuFinanceSearch(),
|
|
405
|
+
tools.valyuSecSearch(),
|
|
406
|
+
],
|
|
407
|
+
});
|
|
408
|
+
|
|
409
|
+
const result = await agent.run('What is Apple stock price trend?');
|
|
410
|
+
console.log(result.text);
|
|
411
|
+
`,
|
|
412
|
+
};
|
|
413
|
+
const example = examples[toolId];
|
|
414
|
+
if (!example) {
|
|
415
|
+
if (outputFormat === 'json') {
|
|
416
|
+
outputJson(formatError(ERROR_CODES.TOOL_NOT_FOUND, `No example for tool: ${toolId}`));
|
|
417
|
+
}
|
|
418
|
+
else {
|
|
419
|
+
await pretty_logger_1.PrettyLogger.error(`No example available for: ${toolId}`);
|
|
420
|
+
await pretty_logger_1.PrettyLogger.dim(`Available examples: ${Object.keys(examples).join(', ')}`);
|
|
421
|
+
}
|
|
422
|
+
process.exit(cli_spec_1.EXIT_CODES.RUNTIME_ERROR);
|
|
423
|
+
}
|
|
424
|
+
if (outputFormat === 'json') {
|
|
425
|
+
outputJson(formatSuccess({ toolId, example: example.trim() }));
|
|
426
|
+
}
|
|
427
|
+
else {
|
|
428
|
+
await pretty_logger_1.PrettyLogger.heading(`Example: ${toolId}`);
|
|
429
|
+
await pretty_logger_1.PrettyLogger.plain(example);
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
async function toolAdd(args, options, outputFormat) {
|
|
433
|
+
const packageOrPath = args[0];
|
|
434
|
+
if (!packageOrPath) {
|
|
435
|
+
if (outputFormat === 'json') {
|
|
436
|
+
outputJson(formatError(ERROR_CODES.MISSING_ARG, 'Please provide a package name or path'));
|
|
437
|
+
}
|
|
438
|
+
else {
|
|
439
|
+
await pretty_logger_1.PrettyLogger.error('Please provide a package name or path');
|
|
440
|
+
await pretty_logger_1.PrettyLogger.dim('Usage: overai tools add <package-name>');
|
|
441
|
+
await pretty_logger_1.PrettyLogger.dim(' overai tools add ./path/to/tool.js');
|
|
442
|
+
}
|
|
443
|
+
process.exit(cli_spec_1.EXIT_CODES.INVALID_ARGUMENTS);
|
|
444
|
+
}
|
|
445
|
+
try {
|
|
446
|
+
const { registerNpmTool, registerLocalTool } = await Promise.resolve().then(() => __importStar(require('../../tools/builtins/custom')));
|
|
447
|
+
const isLocalPath = packageOrPath.startsWith('./') || packageOrPath.startsWith('/');
|
|
448
|
+
const tool = isLocalPath
|
|
449
|
+
? await registerLocalTool(packageOrPath)
|
|
450
|
+
: await registerNpmTool(packageOrPath);
|
|
451
|
+
if (outputFormat === 'json') {
|
|
452
|
+
outputJson(formatSuccess({
|
|
453
|
+
registered: true,
|
|
454
|
+
tool: {
|
|
455
|
+
name: tool.name,
|
|
456
|
+
description: tool.description,
|
|
457
|
+
source: isLocalPath ? 'local' : 'npm',
|
|
458
|
+
}
|
|
459
|
+
}));
|
|
460
|
+
}
|
|
461
|
+
else {
|
|
462
|
+
await pretty_logger_1.PrettyLogger.info(`Successfully registered tool: ${tool.name}`);
|
|
463
|
+
await pretty_logger_1.PrettyLogger.dim(`Description: ${tool.description}`);
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
catch (error) {
|
|
467
|
+
if (outputFormat === 'json') {
|
|
468
|
+
outputJson(formatError(ERROR_CODES.RUNTIME_ERROR, `Failed to register tool: ${error}`));
|
|
469
|
+
}
|
|
470
|
+
else {
|
|
471
|
+
await pretty_logger_1.PrettyLogger.error(`Failed to register tool: ${error}`);
|
|
472
|
+
}
|
|
473
|
+
process.exit(cli_spec_1.EXIT_CODES.RUNTIME_ERROR);
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
async function toolTest(args, options, outputFormat) {
|
|
477
|
+
const toolId = args[0];
|
|
478
|
+
if (!toolId) {
|
|
479
|
+
if (outputFormat === 'json') {
|
|
480
|
+
outputJson(formatError(ERROR_CODES.MISSING_ARG, 'Please provide a tool ID'));
|
|
481
|
+
}
|
|
482
|
+
else {
|
|
483
|
+
await pretty_logger_1.PrettyLogger.error('Please provide a tool ID');
|
|
484
|
+
}
|
|
485
|
+
process.exit(cli_spec_1.EXIT_CODES.INVALID_ARGUMENTS);
|
|
486
|
+
}
|
|
487
|
+
ensureBuiltinsRegistered();
|
|
488
|
+
const registry = (0, registry_1.getToolsRegistry)();
|
|
489
|
+
const metadata = registry.getMetadata(toolId);
|
|
490
|
+
if (!metadata) {
|
|
491
|
+
if (outputFormat === 'json') {
|
|
492
|
+
outputJson(formatError(ERROR_CODES.TOOL_NOT_FOUND, `Tool not found: ${toolId}`));
|
|
493
|
+
}
|
|
494
|
+
else {
|
|
495
|
+
await pretty_logger_1.PrettyLogger.error(`Tool not found: ${toolId}`);
|
|
496
|
+
}
|
|
497
|
+
process.exit(cli_spec_1.EXIT_CODES.RUNTIME_ERROR);
|
|
498
|
+
}
|
|
499
|
+
// Check dependencies
|
|
500
|
+
const missingEnv = metadata.requiredEnv.filter(env => !process.env[env]);
|
|
501
|
+
if (missingEnv.length > 0 && !options.live) {
|
|
502
|
+
if (outputFormat === 'json') {
|
|
503
|
+
outputJson(formatSuccess({
|
|
504
|
+
toolId,
|
|
505
|
+
status: 'dry_run',
|
|
506
|
+
message: 'Dry run completed. Missing env vars for live test.',
|
|
507
|
+
missingEnv,
|
|
508
|
+
}));
|
|
509
|
+
}
|
|
510
|
+
else {
|
|
511
|
+
await pretty_logger_1.PrettyLogger.info(`Dry run for ${toolId}:`);
|
|
512
|
+
await pretty_logger_1.PrettyLogger.plain(` Tool ID: ${metadata.id}`);
|
|
513
|
+
await pretty_logger_1.PrettyLogger.plain(` Package: ${metadata.packageName}`);
|
|
514
|
+
await pretty_logger_1.PrettyLogger.warning(` Missing env vars: ${missingEnv.join(', ')}`);
|
|
515
|
+
await pretty_logger_1.PrettyLogger.dim('\nUse --live flag to run actual test (requires env vars)');
|
|
516
|
+
}
|
|
517
|
+
return;
|
|
518
|
+
}
|
|
519
|
+
if (options.live) {
|
|
520
|
+
if (missingEnv.length > 0) {
|
|
521
|
+
if (outputFormat === 'json') {
|
|
522
|
+
outputJson(formatError(ERROR_CODES.MISSING_ARG, `Missing required env vars: ${missingEnv.join(', ')}`));
|
|
523
|
+
}
|
|
524
|
+
else {
|
|
525
|
+
await pretty_logger_1.PrettyLogger.error(`Cannot run live test. Missing env vars: ${missingEnv.join(', ')}`);
|
|
526
|
+
}
|
|
527
|
+
process.exit(cli_spec_1.EXIT_CODES.RUNTIME_ERROR);
|
|
528
|
+
}
|
|
529
|
+
try {
|
|
530
|
+
const tool = registry.create(toolId);
|
|
531
|
+
await pretty_logger_1.PrettyLogger.info(`Live test for ${toolId}...`);
|
|
532
|
+
// Simple test execution
|
|
533
|
+
const testInput = { query: 'test' };
|
|
534
|
+
const result = await tool.execute(testInput);
|
|
535
|
+
if (outputFormat === 'json') {
|
|
536
|
+
outputJson(formatSuccess({
|
|
537
|
+
toolId,
|
|
538
|
+
status: 'success',
|
|
539
|
+
result,
|
|
540
|
+
}));
|
|
541
|
+
}
|
|
542
|
+
else {
|
|
543
|
+
await pretty_logger_1.PrettyLogger.info('Test passed!');
|
|
544
|
+
await pretty_logger_1.PrettyLogger.plain(`Result: ${JSON.stringify(result, null, 2)}`);
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
catch (error) {
|
|
548
|
+
if (outputFormat === 'json') {
|
|
549
|
+
outputJson(formatError(ERROR_CODES.RUNTIME_ERROR, `Test failed: ${error}`));
|
|
550
|
+
}
|
|
551
|
+
else {
|
|
552
|
+
await pretty_logger_1.PrettyLogger.error(`Test failed: ${error}`);
|
|
553
|
+
}
|
|
554
|
+
process.exit(cli_spec_1.EXIT_CODES.RUNTIME_ERROR);
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
else {
|
|
558
|
+
if (outputFormat === 'json') {
|
|
559
|
+
outputJson(formatSuccess({
|
|
560
|
+
toolId,
|
|
561
|
+
status: 'dry_run',
|
|
562
|
+
message: 'Dry run completed successfully.',
|
|
563
|
+
metadata: {
|
|
564
|
+
id: metadata.id,
|
|
565
|
+
package: metadata.packageName,
|
|
566
|
+
envVars: metadata.requiredEnv,
|
|
567
|
+
}
|
|
568
|
+
}));
|
|
569
|
+
}
|
|
570
|
+
else {
|
|
571
|
+
await pretty_logger_1.PrettyLogger.info(`Dry run for ${toolId}: OK`);
|
|
572
|
+
await pretty_logger_1.PrettyLogger.plain(` Tool is registered and ready`);
|
|
573
|
+
await pretty_logger_1.PrettyLogger.dim('\nUse --live flag to run actual API test');
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vector command - Vector store management
|
|
3
|
+
*/
|
|
4
|
+
export interface VectorOptions {
|
|
5
|
+
verbose?: boolean;
|
|
6
|
+
output?: 'json' | 'text' | 'pretty';
|
|
7
|
+
json?: boolean;
|
|
8
|
+
store?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function execute(args: string[], options: VectorOptions): Promise<void>;
|