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,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Code Execution Tool (Vercel Sandbox)
|
|
4
|
+
*
|
|
5
|
+
* Execute Python code in a sandboxed Vercel environment.
|
|
6
|
+
* Package: ai-sdk-tool-code-execution
|
|
7
|
+
*/
|
|
8
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
+
if (k2 === undefined) k2 = k;
|
|
10
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
}) : (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
}));
|
|
19
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
20
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
21
|
+
}) : function(o, v) {
|
|
22
|
+
o["default"] = v;
|
|
23
|
+
});
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.CODE_EXECUTION_METADATA = void 0;
|
|
43
|
+
exports.codeExecution = codeExecution;
|
|
44
|
+
exports.createCodeExecutionTool = createCodeExecutionTool;
|
|
45
|
+
const types_1 = require("../registry/types");
|
|
46
|
+
exports.CODE_EXECUTION_METADATA = {
|
|
47
|
+
id: 'code-execution',
|
|
48
|
+
displayName: 'Code Execution (Vercel Sandbox)',
|
|
49
|
+
description: 'Execute Python code in a secure Vercel Sandbox environment',
|
|
50
|
+
tags: ['sandbox', 'code', 'python', 'execution'],
|
|
51
|
+
requiredEnv: [], // VERCEL_OIDC_TOKEN is auto-provided in Vercel, or use alternative auth
|
|
52
|
+
optionalEnv: ['VERCEL_OIDC_TOKEN', 'VERCEL_TOKEN', 'VERCEL_TEAM_ID', 'VERCEL_PROJECT_ID'],
|
|
53
|
+
install: {
|
|
54
|
+
npm: 'npm install ai-sdk-tool-code-execution',
|
|
55
|
+
pnpm: 'pnpm add ai-sdk-tool-code-execution',
|
|
56
|
+
yarn: 'yarn add ai-sdk-tool-code-execution',
|
|
57
|
+
bun: 'bun add ai-sdk-tool-code-execution',
|
|
58
|
+
},
|
|
59
|
+
docsSlug: 'tools/code-execution',
|
|
60
|
+
capabilities: {
|
|
61
|
+
sandbox: true,
|
|
62
|
+
code: true,
|
|
63
|
+
},
|
|
64
|
+
packageName: 'ai-sdk-tool-code-execution',
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Create a Code Execution tool instance
|
|
68
|
+
*/
|
|
69
|
+
function codeExecution(config) {
|
|
70
|
+
// Lazy load the package
|
|
71
|
+
let executeCodeFn = null;
|
|
72
|
+
const loadPackage = async () => {
|
|
73
|
+
if (executeCodeFn)
|
|
74
|
+
return executeCodeFn;
|
|
75
|
+
try {
|
|
76
|
+
// @ts-ignore - Optional dependency
|
|
77
|
+
const pkg = await Promise.resolve().then(() => __importStar(require('ai-sdk-tool-code-execution')));
|
|
78
|
+
executeCodeFn = pkg.executeCode;
|
|
79
|
+
return executeCodeFn;
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
throw new types_1.MissingDependencyError(exports.CODE_EXECUTION_METADATA.id, exports.CODE_EXECUTION_METADATA.packageName, exports.CODE_EXECUTION_METADATA.install, exports.CODE_EXECUTION_METADATA.requiredEnv, exports.CODE_EXECUTION_METADATA.docsSlug);
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
return {
|
|
86
|
+
name: 'executeCode',
|
|
87
|
+
description: 'Execute Python code in a secure sandbox environment. Use this for calculations, data processing, and computational tasks.',
|
|
88
|
+
parameters: {
|
|
89
|
+
type: 'object',
|
|
90
|
+
properties: {
|
|
91
|
+
code: {
|
|
92
|
+
type: 'string',
|
|
93
|
+
description: 'Python code to execute',
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
required: ['code'],
|
|
97
|
+
},
|
|
98
|
+
execute: async (input, context) => {
|
|
99
|
+
const executeCode = await loadPackage();
|
|
100
|
+
// The AI SDK tool returns a tool definition, not a direct executor
|
|
101
|
+
// We need to use it with the AI SDK's generateText
|
|
102
|
+
// For direct execution, we'll create a wrapper
|
|
103
|
+
try {
|
|
104
|
+
// Create the tool with config
|
|
105
|
+
const tool = executeCode({ debug: config?.debug });
|
|
106
|
+
// The tool is meant to be used with AI SDK's generateText
|
|
107
|
+
// For standalone use, we execute it directly if possible
|
|
108
|
+
if (tool && typeof tool.execute === 'function') {
|
|
109
|
+
const result = await tool.execute(input);
|
|
110
|
+
return {
|
|
111
|
+
result: String(result),
|
|
112
|
+
success: true,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
// If the tool doesn't have a direct execute, return info about usage
|
|
116
|
+
return {
|
|
117
|
+
result: 'Code execution tool created. Use with AI SDK generateText for full functionality.',
|
|
118
|
+
success: true,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
catch (error) {
|
|
122
|
+
return {
|
|
123
|
+
result: '',
|
|
124
|
+
stderr: error instanceof Error ? error.message : String(error),
|
|
125
|
+
success: false,
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Factory function for registry
|
|
133
|
+
*/
|
|
134
|
+
function createCodeExecutionTool(config) {
|
|
135
|
+
return codeExecution(config);
|
|
136
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Code Mode Tool
|
|
3
|
+
*
|
|
4
|
+
* Transform MCP tools and AI SDK tools into code-mode execution.
|
|
5
|
+
* Allows writing code to a sandbox FS, importing tools, and running them.
|
|
6
|
+
*/
|
|
7
|
+
import type { ToolMetadata, PraisonTool } from '../registry/types';
|
|
8
|
+
export declare const CODE_MODE_METADATA: ToolMetadata;
|
|
9
|
+
export interface CodeModeConfig {
|
|
10
|
+
/** Allowed tools that can be imported */
|
|
11
|
+
allowedTools?: string[];
|
|
12
|
+
/** Blocked tools that cannot be imported */
|
|
13
|
+
blockedTools?: string[];
|
|
14
|
+
/** Enable network access (default: false) */
|
|
15
|
+
allowNetwork?: boolean;
|
|
16
|
+
/** Allowed file paths (glob patterns) */
|
|
17
|
+
allowedPaths?: string[];
|
|
18
|
+
/** Execution timeout in ms (default: 30000) */
|
|
19
|
+
timeoutMs?: number;
|
|
20
|
+
/** Maximum memory in MB (default: 128) */
|
|
21
|
+
maxMemoryMb?: number;
|
|
22
|
+
}
|
|
23
|
+
export interface CodeModeInput {
|
|
24
|
+
/** Code to execute */
|
|
25
|
+
code: string;
|
|
26
|
+
/** Files to write to the sandbox before execution */
|
|
27
|
+
files?: Record<string, string>;
|
|
28
|
+
/** Environment variables for execution */
|
|
29
|
+
env?: Record<string, string>;
|
|
30
|
+
}
|
|
31
|
+
export interface CodeModeResult {
|
|
32
|
+
/** Execution output */
|
|
33
|
+
output: string;
|
|
34
|
+
/** Standard output */
|
|
35
|
+
stdout: string;
|
|
36
|
+
/** Standard error */
|
|
37
|
+
stderr: string;
|
|
38
|
+
/** Exit code */
|
|
39
|
+
exitCode: number;
|
|
40
|
+
/** Files created/modified during execution */
|
|
41
|
+
files?: Record<string, string>;
|
|
42
|
+
/** Execution success */
|
|
43
|
+
success: boolean;
|
|
44
|
+
/** Error message if failed */
|
|
45
|
+
error?: string;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Create a Code Mode tool
|
|
49
|
+
*/
|
|
50
|
+
export declare function codeMode(config?: CodeModeConfig): PraisonTool<CodeModeInput, CodeModeResult>;
|
|
51
|
+
/**
|
|
52
|
+
* Factory function for registry
|
|
53
|
+
*/
|
|
54
|
+
export declare function createCodeModeTool(config?: CodeModeConfig): PraisonTool<unknown, unknown>;
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Code Mode Tool
|
|
4
|
+
*
|
|
5
|
+
* Transform MCP tools and AI SDK tools into code-mode execution.
|
|
6
|
+
* Allows writing code to a sandbox FS, importing tools, and running them.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.CODE_MODE_METADATA = void 0;
|
|
10
|
+
exports.codeMode = codeMode;
|
|
11
|
+
exports.createCodeModeTool = createCodeModeTool;
|
|
12
|
+
exports.CODE_MODE_METADATA = {
|
|
13
|
+
id: 'code-mode',
|
|
14
|
+
displayName: 'Code Mode',
|
|
15
|
+
description: 'Execute code that can import and use other tools in a sandboxed environment',
|
|
16
|
+
tags: ['sandbox', 'code', 'mcp', 'tools'],
|
|
17
|
+
requiredEnv: [],
|
|
18
|
+
optionalEnv: [],
|
|
19
|
+
install: {
|
|
20
|
+
npm: '# Built-in, no installation required',
|
|
21
|
+
pnpm: '# Built-in, no installation required',
|
|
22
|
+
yarn: '# Built-in, no installation required',
|
|
23
|
+
bun: '# Built-in, no installation required',
|
|
24
|
+
},
|
|
25
|
+
docsSlug: 'tools/code-mode',
|
|
26
|
+
capabilities: {
|
|
27
|
+
sandbox: true,
|
|
28
|
+
code: true,
|
|
29
|
+
},
|
|
30
|
+
packageName: 'praisonai', // Built-in
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Create a Code Mode tool
|
|
34
|
+
*/
|
|
35
|
+
function codeMode(config) {
|
|
36
|
+
const settings = {
|
|
37
|
+
allowNetwork: false,
|
|
38
|
+
timeoutMs: 30000,
|
|
39
|
+
maxMemoryMb: 128,
|
|
40
|
+
...config,
|
|
41
|
+
};
|
|
42
|
+
return {
|
|
43
|
+
name: 'codeMode',
|
|
44
|
+
description: 'Execute code in a sandboxed environment with access to imported tools. Write files, run code, and get results.',
|
|
45
|
+
parameters: {
|
|
46
|
+
type: 'object',
|
|
47
|
+
properties: {
|
|
48
|
+
code: {
|
|
49
|
+
type: 'string',
|
|
50
|
+
description: 'The code to execute',
|
|
51
|
+
},
|
|
52
|
+
files: {
|
|
53
|
+
type: 'object',
|
|
54
|
+
description: 'Files to write to the sandbox before execution (path -> content)',
|
|
55
|
+
},
|
|
56
|
+
env: {
|
|
57
|
+
type: 'object',
|
|
58
|
+
description: 'Environment variables for execution',
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
required: ['code'],
|
|
62
|
+
},
|
|
63
|
+
execute: async (input, context) => {
|
|
64
|
+
const { code, files, env } = input;
|
|
65
|
+
// Validate code doesn't contain blocked patterns
|
|
66
|
+
const blockedPatterns = [
|
|
67
|
+
/require\s*\(\s*['"]child_process['"]\s*\)/,
|
|
68
|
+
/require\s*\(\s*['"]fs['"]\s*\)/,
|
|
69
|
+
/import\s+.*from\s+['"]child_process['"]/,
|
|
70
|
+
/process\.exit/,
|
|
71
|
+
/eval\s*\(/,
|
|
72
|
+
];
|
|
73
|
+
if (!settings.allowNetwork) {
|
|
74
|
+
blockedPatterns.push(/require\s*\(\s*['"]http['"]\s*\)/, /require\s*\(\s*['"]https['"]\s*\)/, /require\s*\(\s*['"]net['"]\s*\)/, /fetch\s*\(/);
|
|
75
|
+
}
|
|
76
|
+
for (const pattern of blockedPatterns) {
|
|
77
|
+
if (pattern.test(code)) {
|
|
78
|
+
return {
|
|
79
|
+
output: '',
|
|
80
|
+
stdout: '',
|
|
81
|
+
stderr: `Blocked pattern detected: ${pattern.source}`,
|
|
82
|
+
exitCode: 1,
|
|
83
|
+
success: false,
|
|
84
|
+
error: 'Code contains blocked patterns for security',
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
// Check for blocked tools
|
|
89
|
+
if (settings.blockedTools && settings.blockedTools.length > 0) {
|
|
90
|
+
for (const tool of settings.blockedTools) {
|
|
91
|
+
if (code.includes(tool)) {
|
|
92
|
+
return {
|
|
93
|
+
output: '',
|
|
94
|
+
stdout: '',
|
|
95
|
+
stderr: `Blocked tool: ${tool}`,
|
|
96
|
+
exitCode: 1,
|
|
97
|
+
success: false,
|
|
98
|
+
error: `Tool "${tool}" is not allowed`,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
try {
|
|
104
|
+
// Create a sandboxed execution context
|
|
105
|
+
// In a real implementation, this would use a proper sandbox like vm2 or isolated-vm
|
|
106
|
+
// For now, we provide a safe execution wrapper
|
|
107
|
+
const sandbox = {
|
|
108
|
+
console: {
|
|
109
|
+
log: (...args) => stdout.push(args.map(String).join(' ')),
|
|
110
|
+
error: (...args) => stderr.push(args.map(String).join(' ')),
|
|
111
|
+
warn: (...args) => stderr.push(args.map(String).join(' ')),
|
|
112
|
+
},
|
|
113
|
+
setTimeout: undefined,
|
|
114
|
+
setInterval: undefined,
|
|
115
|
+
setImmediate: undefined,
|
|
116
|
+
process: undefined,
|
|
117
|
+
require: undefined,
|
|
118
|
+
__dirname: '/sandbox',
|
|
119
|
+
__filename: '/sandbox/index.js',
|
|
120
|
+
env: env || {},
|
|
121
|
+
files: files || {},
|
|
122
|
+
};
|
|
123
|
+
const stdout = [];
|
|
124
|
+
const stderr = [];
|
|
125
|
+
// Execute with timeout
|
|
126
|
+
const timeoutPromise = new Promise((_, reject) => {
|
|
127
|
+
setTimeout(() => reject(new Error('Execution timeout')), settings.timeoutMs);
|
|
128
|
+
});
|
|
129
|
+
const executePromise = new Promise((resolve, reject) => {
|
|
130
|
+
try {
|
|
131
|
+
// Create a function from the code
|
|
132
|
+
const fn = new Function('sandbox', `with (sandbox) { ${code} }`);
|
|
133
|
+
const result = fn(sandbox);
|
|
134
|
+
resolve(String(result ?? ''));
|
|
135
|
+
}
|
|
136
|
+
catch (error) {
|
|
137
|
+
reject(error);
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
const result = await Promise.race([executePromise, timeoutPromise]);
|
|
141
|
+
return {
|
|
142
|
+
output: result,
|
|
143
|
+
stdout: stdout.join('\n'),
|
|
144
|
+
stderr: stderr.join('\n'),
|
|
145
|
+
exitCode: 0,
|
|
146
|
+
success: true,
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
catch (error) {
|
|
150
|
+
return {
|
|
151
|
+
output: '',
|
|
152
|
+
stdout: '',
|
|
153
|
+
stderr: error instanceof Error ? error.message : String(error),
|
|
154
|
+
exitCode: 1,
|
|
155
|
+
success: false,
|
|
156
|
+
error: error instanceof Error ? error.message : String(error),
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Factory function for registry
|
|
164
|
+
*/
|
|
165
|
+
function createCodeModeTool(config) {
|
|
166
|
+
return codeMode(config);
|
|
167
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Custom Tool Registration API
|
|
3
|
+
*
|
|
4
|
+
* Clean API to register custom tools (local + npm) with minimal friction.
|
|
5
|
+
*/
|
|
6
|
+
import type { PraisonTool, ToolExecutionContext, ToolParameterSchema } from '../registry/types';
|
|
7
|
+
export interface CustomToolConfig<TInput = unknown, TOutput = unknown> {
|
|
8
|
+
/** Unique tool identifier */
|
|
9
|
+
id: string;
|
|
10
|
+
/** Display name */
|
|
11
|
+
name: string;
|
|
12
|
+
/** Tool description (used by LLM) */
|
|
13
|
+
description: string;
|
|
14
|
+
/** Parameter schema */
|
|
15
|
+
parameters?: ToolParameterSchema;
|
|
16
|
+
/** Execute function */
|
|
17
|
+
execute: (input: TInput, context?: ToolExecutionContext) => Promise<TOutput> | TOutput;
|
|
18
|
+
/** Tags for categorization */
|
|
19
|
+
tags?: string[];
|
|
20
|
+
/** Documentation slug */
|
|
21
|
+
docsSlug?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Register a custom tool with the global registry
|
|
25
|
+
*/
|
|
26
|
+
export declare function registerCustomTool<TInput = unknown, TOutput = unknown>(config: CustomToolConfig<TInput, TOutput>): PraisonTool<TInput, TOutput>;
|
|
27
|
+
/**
|
|
28
|
+
* Create a custom tool without registering it
|
|
29
|
+
*/
|
|
30
|
+
export declare function createCustomTool<TInput = unknown, TOutput = unknown>(config: CustomToolConfig<TInput, TOutput>): PraisonTool<TInput, TOutput>;
|
|
31
|
+
/**
|
|
32
|
+
* Register a tool from an npm package
|
|
33
|
+
*/
|
|
34
|
+
export declare function registerNpmTool(packageName: string, toolName?: string): Promise<PraisonTool<unknown, unknown>>;
|
|
35
|
+
/**
|
|
36
|
+
* Register a tool from a local file path
|
|
37
|
+
*/
|
|
38
|
+
export declare function registerLocalTool(filePath: string, toolName?: string): Promise<PraisonTool<unknown, unknown>>;
|
|
39
|
+
/**
|
|
40
|
+
* Decorator for creating tools from class methods
|
|
41
|
+
*/
|
|
42
|
+
export declare function Tool(config: Omit<CustomToolConfig, 'execute'>): (target: unknown, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Custom Tool Registration API
|
|
4
|
+
*
|
|
5
|
+
* Clean API to register custom tools (local + npm) with minimal friction.
|
|
6
|
+
*/
|
|
7
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
|
+
if (k2 === undefined) k2 = k;
|
|
9
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12
|
+
}
|
|
13
|
+
Object.defineProperty(o, k2, desc);
|
|
14
|
+
}) : (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
o[k2] = m[k];
|
|
17
|
+
}));
|
|
18
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
19
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
20
|
+
}) : function(o, v) {
|
|
21
|
+
o["default"] = v;
|
|
22
|
+
});
|
|
23
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
24
|
+
var ownKeys = function(o) {
|
|
25
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
26
|
+
var ar = [];
|
|
27
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
28
|
+
return ar;
|
|
29
|
+
};
|
|
30
|
+
return ownKeys(o);
|
|
31
|
+
};
|
|
32
|
+
return function (mod) {
|
|
33
|
+
if (mod && mod.__esModule) return mod;
|
|
34
|
+
var result = {};
|
|
35
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
36
|
+
__setModuleDefault(result, mod);
|
|
37
|
+
return result;
|
|
38
|
+
};
|
|
39
|
+
})();
|
|
40
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
+
exports.registerCustomTool = registerCustomTool;
|
|
42
|
+
exports.createCustomTool = createCustomTool;
|
|
43
|
+
exports.registerNpmTool = registerNpmTool;
|
|
44
|
+
exports.registerLocalTool = registerLocalTool;
|
|
45
|
+
exports.Tool = Tool;
|
|
46
|
+
const registry_1 = require("../registry/registry");
|
|
47
|
+
/**
|
|
48
|
+
* Register a custom tool with the global registry
|
|
49
|
+
*/
|
|
50
|
+
function registerCustomTool(config) {
|
|
51
|
+
const metadata = {
|
|
52
|
+
id: config.id,
|
|
53
|
+
displayName: config.name,
|
|
54
|
+
description: config.description,
|
|
55
|
+
tags: config.tags || ['custom'],
|
|
56
|
+
requiredEnv: [],
|
|
57
|
+
optionalEnv: [],
|
|
58
|
+
install: {
|
|
59
|
+
npm: '# Custom tool - no installation required',
|
|
60
|
+
pnpm: '# Custom tool - no installation required',
|
|
61
|
+
yarn: '# Custom tool - no installation required',
|
|
62
|
+
bun: '# Custom tool - no installation required',
|
|
63
|
+
},
|
|
64
|
+
docsSlug: config.docsSlug || `tools/custom/${config.id}`,
|
|
65
|
+
capabilities: {},
|
|
66
|
+
packageName: 'custom',
|
|
67
|
+
};
|
|
68
|
+
const tool = {
|
|
69
|
+
name: config.name,
|
|
70
|
+
description: config.description,
|
|
71
|
+
parameters: config.parameters || { type: 'object', properties: {} },
|
|
72
|
+
execute: async (input, context) => {
|
|
73
|
+
return config.execute(input, context);
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
// Register with the global registry
|
|
77
|
+
const registry = (0, registry_1.getToolsRegistry)();
|
|
78
|
+
registry.register(metadata, () => tool);
|
|
79
|
+
return tool;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Create a custom tool without registering it
|
|
83
|
+
*/
|
|
84
|
+
function createCustomTool(config) {
|
|
85
|
+
return {
|
|
86
|
+
name: config.name,
|
|
87
|
+
description: config.description,
|
|
88
|
+
parameters: config.parameters || { type: 'object', properties: {} },
|
|
89
|
+
execute: async (input, context) => {
|
|
90
|
+
return config.execute(input, context);
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Register a tool from an npm package
|
|
96
|
+
*/
|
|
97
|
+
async function registerNpmTool(packageName, toolName) {
|
|
98
|
+
try {
|
|
99
|
+
const pkg = await Promise.resolve(`${packageName}`).then(s => __importStar(require(s)));
|
|
100
|
+
// Try to find the tool export
|
|
101
|
+
const toolExport = toolName
|
|
102
|
+
? pkg[toolName]
|
|
103
|
+
: pkg.default || pkg.tool || pkg[Object.keys(pkg)[0]];
|
|
104
|
+
if (!toolExport) {
|
|
105
|
+
throw new Error(`Could not find tool export in package "${packageName}"`);
|
|
106
|
+
}
|
|
107
|
+
// If it's a function, call it to get the tool
|
|
108
|
+
const tool = typeof toolExport === 'function' ? toolExport() : toolExport;
|
|
109
|
+
// Validate it has the required properties
|
|
110
|
+
if (!tool.name || !tool.execute) {
|
|
111
|
+
throw new Error(`Invalid tool structure in package "${packageName}"`);
|
|
112
|
+
}
|
|
113
|
+
// Register with the registry
|
|
114
|
+
const metadata = {
|
|
115
|
+
id: `npm:${packageName}${toolName ? `:${toolName}` : ''}`,
|
|
116
|
+
displayName: tool.name,
|
|
117
|
+
description: tool.description || `Tool from ${packageName}`,
|
|
118
|
+
tags: ['npm', 'external'],
|
|
119
|
+
requiredEnv: [],
|
|
120
|
+
optionalEnv: [],
|
|
121
|
+
install: {
|
|
122
|
+
npm: `npm install ${packageName}`,
|
|
123
|
+
pnpm: `pnpm add ${packageName}`,
|
|
124
|
+
yarn: `yarn add ${packageName}`,
|
|
125
|
+
bun: `bun add ${packageName}`,
|
|
126
|
+
},
|
|
127
|
+
docsSlug: `tools/npm/${packageName.replace(/[@/]/g, '-')}`,
|
|
128
|
+
capabilities: {},
|
|
129
|
+
packageName,
|
|
130
|
+
};
|
|
131
|
+
const registry = (0, registry_1.getToolsRegistry)();
|
|
132
|
+
registry.register(metadata, () => tool);
|
|
133
|
+
return tool;
|
|
134
|
+
}
|
|
135
|
+
catch (error) {
|
|
136
|
+
throw new Error(`Failed to register tool from "${packageName}": ${error instanceof Error ? error.message : String(error)}`);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Register a tool from a local file path
|
|
141
|
+
*/
|
|
142
|
+
async function registerLocalTool(filePath, toolName) {
|
|
143
|
+
try {
|
|
144
|
+
// Resolve the path
|
|
145
|
+
const resolvedPath = require.resolve(filePath, { paths: [process.cwd()] });
|
|
146
|
+
const pkg = await Promise.resolve(`${resolvedPath}`).then(s => __importStar(require(s)));
|
|
147
|
+
const toolExport = toolName
|
|
148
|
+
? pkg[toolName]
|
|
149
|
+
: pkg.default || pkg.tool || pkg[Object.keys(pkg)[0]];
|
|
150
|
+
if (!toolExport) {
|
|
151
|
+
throw new Error(`Could not find tool export in file "${filePath}"`);
|
|
152
|
+
}
|
|
153
|
+
const tool = typeof toolExport === 'function' ? toolExport() : toolExport;
|
|
154
|
+
if (!tool.name || !tool.execute) {
|
|
155
|
+
throw new Error(`Invalid tool structure in file "${filePath}"`);
|
|
156
|
+
}
|
|
157
|
+
const metadata = {
|
|
158
|
+
id: `local:${filePath}${toolName ? `:${toolName}` : ''}`,
|
|
159
|
+
displayName: tool.name,
|
|
160
|
+
description: tool.description || `Tool from ${filePath}`,
|
|
161
|
+
tags: ['local', 'custom'],
|
|
162
|
+
requiredEnv: [],
|
|
163
|
+
optionalEnv: [],
|
|
164
|
+
install: {
|
|
165
|
+
npm: '# Local tool - no installation required',
|
|
166
|
+
pnpm: '# Local tool - no installation required',
|
|
167
|
+
yarn: '# Local tool - no installation required',
|
|
168
|
+
bun: '# Local tool - no installation required',
|
|
169
|
+
},
|
|
170
|
+
docsSlug: `tools/local`,
|
|
171
|
+
capabilities: {},
|
|
172
|
+
packageName: 'local',
|
|
173
|
+
};
|
|
174
|
+
const registry = (0, registry_1.getToolsRegistry)();
|
|
175
|
+
registry.register(metadata, () => tool);
|
|
176
|
+
return tool;
|
|
177
|
+
}
|
|
178
|
+
catch (error) {
|
|
179
|
+
throw new Error(`Failed to register tool from "${filePath}": ${error instanceof Error ? error.message : String(error)}`);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Decorator for creating tools from class methods
|
|
184
|
+
*/
|
|
185
|
+
function Tool(config) {
|
|
186
|
+
return function (target, propertyKey, descriptor) {
|
|
187
|
+
const originalMethod = descriptor.value;
|
|
188
|
+
// Create and register the tool
|
|
189
|
+
registerCustomTool({
|
|
190
|
+
...config,
|
|
191
|
+
execute: originalMethod,
|
|
192
|
+
});
|
|
193
|
+
return descriptor;
|
|
194
|
+
};
|
|
195
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Exa Web Search Tool
|
|
3
|
+
*
|
|
4
|
+
* AI-powered web search with semantic understanding.
|
|
5
|
+
* Package: @exalabs/ai-sdk
|
|
6
|
+
*/
|
|
7
|
+
import type { ToolMetadata, PraisonTool } from '../registry/types';
|
|
8
|
+
export declare const EXA_METADATA: ToolMetadata;
|
|
9
|
+
export interface ExaSearchConfig {
|
|
10
|
+
type?: 'auto' | 'neural' | 'fast' | 'deep';
|
|
11
|
+
category?: 'company' | 'research paper' | 'news' | 'pdf' | 'github' | 'personal site' | 'linkedin profile' | 'financial report';
|
|
12
|
+
numResults?: number;
|
|
13
|
+
includeDomains?: string[];
|
|
14
|
+
excludeDomains?: string[];
|
|
15
|
+
startPublishedDate?: string;
|
|
16
|
+
endPublishedDate?: string;
|
|
17
|
+
includeText?: string[];
|
|
18
|
+
excludeText?: string[];
|
|
19
|
+
userLocation?: string;
|
|
20
|
+
contents?: {
|
|
21
|
+
text?: {
|
|
22
|
+
maxCharacters?: number;
|
|
23
|
+
includeHtmlTags?: boolean;
|
|
24
|
+
};
|
|
25
|
+
summary?: {
|
|
26
|
+
query?: string;
|
|
27
|
+
} | boolean;
|
|
28
|
+
livecrawl?: 'never' | 'fallback' | 'always' | 'preferred';
|
|
29
|
+
livecrawlTimeout?: number;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export interface ExaSearchInput {
|
|
33
|
+
query: string;
|
|
34
|
+
}
|
|
35
|
+
export interface ExaSearchResult {
|
|
36
|
+
results: Array<{
|
|
37
|
+
title: string;
|
|
38
|
+
url: string;
|
|
39
|
+
text?: string;
|
|
40
|
+
summary?: string;
|
|
41
|
+
publishedDate?: string;
|
|
42
|
+
author?: string;
|
|
43
|
+
score?: number;
|
|
44
|
+
}>;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Create an Exa Web Search tool
|
|
48
|
+
*/
|
|
49
|
+
export declare function exaSearch(config?: ExaSearchConfig): PraisonTool<ExaSearchInput, ExaSearchResult>;
|
|
50
|
+
/**
|
|
51
|
+
* Factory function for registry
|
|
52
|
+
*/
|
|
53
|
+
export declare function createExaSearchTool(config?: ExaSearchConfig): PraisonTool<unknown, unknown>;
|