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,182 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Computer Use Integration
|
|
3
|
+
*
|
|
4
|
+
* Provides interfaces for computer use capabilities (browser/desktop control).
|
|
5
|
+
* By default, tools are safe no-ops that require explicit implementation.
|
|
6
|
+
*/
|
|
7
|
+
export interface ComputerUseConfig {
|
|
8
|
+
/** Enable browser control */
|
|
9
|
+
browser?: boolean;
|
|
10
|
+
/** Enable desktop control */
|
|
11
|
+
desktop?: boolean;
|
|
12
|
+
/** Require human approval for actions (default: true) */
|
|
13
|
+
requireApproval?: boolean;
|
|
14
|
+
/** Screenshot directory */
|
|
15
|
+
screenshotDir?: string;
|
|
16
|
+
/** Action timeout in ms (default: 30000) */
|
|
17
|
+
timeout?: number;
|
|
18
|
+
/** Custom tool implementations */
|
|
19
|
+
tools?: Partial<ComputerUseTools>;
|
|
20
|
+
}
|
|
21
|
+
export interface ComputerUseTools {
|
|
22
|
+
/** Take a screenshot */
|
|
23
|
+
screenshot: () => Promise<ScreenshotResult>;
|
|
24
|
+
/** Click at coordinates */
|
|
25
|
+
click: (x: number, y: number, button?: 'left' | 'right' | 'middle') => Promise<void>;
|
|
26
|
+
/** Double click at coordinates */
|
|
27
|
+
doubleClick: (x: number, y: number) => Promise<void>;
|
|
28
|
+
/** Type text */
|
|
29
|
+
type: (text: string) => Promise<void>;
|
|
30
|
+
/** Press a key or key combination */
|
|
31
|
+
key: (key: string) => Promise<void>;
|
|
32
|
+
/** Move mouse to coordinates */
|
|
33
|
+
moveMouse: (x: number, y: number) => Promise<void>;
|
|
34
|
+
/** Scroll */
|
|
35
|
+
scroll: (direction: 'up' | 'down' | 'left' | 'right', amount?: number) => Promise<void>;
|
|
36
|
+
/** Get screen size */
|
|
37
|
+
getScreenSize: () => Promise<{
|
|
38
|
+
width: number;
|
|
39
|
+
height: number;
|
|
40
|
+
}>;
|
|
41
|
+
/** Wait for a duration */
|
|
42
|
+
wait: (ms: number) => Promise<void>;
|
|
43
|
+
/** Execute a shell command (with approval) */
|
|
44
|
+
execute: (command: string) => Promise<string>;
|
|
45
|
+
}
|
|
46
|
+
export interface ScreenshotResult {
|
|
47
|
+
/** Base64-encoded image */
|
|
48
|
+
base64: string;
|
|
49
|
+
/** Image width */
|
|
50
|
+
width: number;
|
|
51
|
+
/** Image height */
|
|
52
|
+
height: number;
|
|
53
|
+
/** File path if saved */
|
|
54
|
+
path?: string;
|
|
55
|
+
}
|
|
56
|
+
export interface ComputerAction {
|
|
57
|
+
type: 'screenshot' | 'click' | 'doubleClick' | 'type' | 'key' | 'moveMouse' | 'scroll' | 'wait' | 'execute';
|
|
58
|
+
params?: any;
|
|
59
|
+
requiresApproval?: boolean;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Create a Computer Use agent with safe defaults.
|
|
63
|
+
*
|
|
64
|
+
* @example Basic usage (safe mode - no-op tools)
|
|
65
|
+
* ```typescript
|
|
66
|
+
* import { createComputerUse } from 'praisonai/integrations/computer-use';
|
|
67
|
+
*
|
|
68
|
+
* const computer = createComputerUse({
|
|
69
|
+
* requireApproval: true
|
|
70
|
+
* });
|
|
71
|
+
*
|
|
72
|
+
* // Get tools for use with an agent
|
|
73
|
+
* const tools = computer.getTools();
|
|
74
|
+
* ```
|
|
75
|
+
*
|
|
76
|
+
* @example With Playwright browser control
|
|
77
|
+
* ```typescript
|
|
78
|
+
* import { chromium } from 'playwright';
|
|
79
|
+
* import { createComputerUse } from 'praisonai/integrations/computer-use';
|
|
80
|
+
*
|
|
81
|
+
* const browser = await chromium.launch();
|
|
82
|
+
* const page = await browser.newPage();
|
|
83
|
+
*
|
|
84
|
+
* const computer = createComputerUse({
|
|
85
|
+
* browser: true,
|
|
86
|
+
* tools: {
|
|
87
|
+
* screenshot: async () => {
|
|
88
|
+
* const buffer = await page.screenshot();
|
|
89
|
+
* return {
|
|
90
|
+
* base64: buffer.toString('base64'),
|
|
91
|
+
* width: 1920,
|
|
92
|
+
* height: 1080
|
|
93
|
+
* };
|
|
94
|
+
* },
|
|
95
|
+
* click: async (x, y) => {
|
|
96
|
+
* await page.mouse.click(x, y);
|
|
97
|
+
* },
|
|
98
|
+
* type: async (text) => {
|
|
99
|
+
* await page.keyboard.type(text);
|
|
100
|
+
* }
|
|
101
|
+
* }
|
|
102
|
+
* });
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
export declare function createComputerUse(config?: ComputerUseConfig): ComputerUseClient;
|
|
106
|
+
export declare class ComputerUseClient {
|
|
107
|
+
private config;
|
|
108
|
+
private tools;
|
|
109
|
+
private approvalCallback?;
|
|
110
|
+
constructor(config?: ComputerUseConfig);
|
|
111
|
+
/**
|
|
112
|
+
* Set the approval callback for actions.
|
|
113
|
+
*/
|
|
114
|
+
onApproval(callback: (action: ComputerAction) => Promise<boolean>): this;
|
|
115
|
+
/**
|
|
116
|
+
* No-op screenshot implementation.
|
|
117
|
+
*/
|
|
118
|
+
private noOpScreenshot;
|
|
119
|
+
/**
|
|
120
|
+
* No-op action implementation.
|
|
121
|
+
*/
|
|
122
|
+
private noOpAction;
|
|
123
|
+
/**
|
|
124
|
+
* No-op execute implementation.
|
|
125
|
+
*/
|
|
126
|
+
private noOpExecute;
|
|
127
|
+
/**
|
|
128
|
+
* Request approval for an action.
|
|
129
|
+
*/
|
|
130
|
+
private requestApproval;
|
|
131
|
+
/**
|
|
132
|
+
* Take a screenshot.
|
|
133
|
+
*/
|
|
134
|
+
screenshot(): Promise<ScreenshotResult>;
|
|
135
|
+
/**
|
|
136
|
+
* Click at coordinates.
|
|
137
|
+
*/
|
|
138
|
+
click(x: number, y: number, button?: 'left' | 'right' | 'middle'): Promise<void>;
|
|
139
|
+
/**
|
|
140
|
+
* Type text.
|
|
141
|
+
*/
|
|
142
|
+
type(text: string): Promise<void>;
|
|
143
|
+
/**
|
|
144
|
+
* Press a key.
|
|
145
|
+
*/
|
|
146
|
+
key(key: string): Promise<void>;
|
|
147
|
+
/**
|
|
148
|
+
* Execute a command.
|
|
149
|
+
*/
|
|
150
|
+
execute(command: string): Promise<string>;
|
|
151
|
+
/**
|
|
152
|
+
* Get tools for use with an agent.
|
|
153
|
+
*/
|
|
154
|
+
getTools(): Record<string, any>;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Create a simple approval prompt for CLI usage.
|
|
158
|
+
*/
|
|
159
|
+
export declare function createCLIApprovalPrompt(): (action: ComputerAction) => Promise<boolean>;
|
|
160
|
+
/**
|
|
161
|
+
* Create a Computer Use agent with human-in-the-loop approval.
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* ```typescript
|
|
165
|
+
* import { Agent } from 'praisonai';
|
|
166
|
+
* import { createComputerUseAgent } from 'praisonai/integrations/computer-use';
|
|
167
|
+
*
|
|
168
|
+
* const agent = await createComputerUseAgent({
|
|
169
|
+
* instructions: 'You can control the computer to help the user',
|
|
170
|
+
* approvalMode: 'cli' // or 'auto' for no approval
|
|
171
|
+
* });
|
|
172
|
+
*
|
|
173
|
+
* await agent.chat('Open a browser and search for AI news');
|
|
174
|
+
* ```
|
|
175
|
+
*/
|
|
176
|
+
export declare function createComputerUseAgent(options: {
|
|
177
|
+
instructions?: string;
|
|
178
|
+
model?: string;
|
|
179
|
+
approvalMode?: 'cli' | 'auto' | 'custom';
|
|
180
|
+
onApproval?: (action: ComputerAction) => Promise<boolean>;
|
|
181
|
+
tools?: Partial<ComputerUseTools>;
|
|
182
|
+
}): Promise<any>;
|
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Computer Use Integration
|
|
4
|
+
*
|
|
5
|
+
* Provides interfaces for computer use capabilities (browser/desktop control).
|
|
6
|
+
* By default, tools are safe no-ops that require explicit implementation.
|
|
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.ComputerUseClient = void 0;
|
|
43
|
+
exports.createComputerUse = createComputerUse;
|
|
44
|
+
exports.createCLIApprovalPrompt = createCLIApprovalPrompt;
|
|
45
|
+
exports.createComputerUseAgent = createComputerUseAgent;
|
|
46
|
+
/**
|
|
47
|
+
* Create a Computer Use agent with safe defaults.
|
|
48
|
+
*
|
|
49
|
+
* @example Basic usage (safe mode - no-op tools)
|
|
50
|
+
* ```typescript
|
|
51
|
+
* import { createComputerUse } from 'praisonai/integrations/computer-use';
|
|
52
|
+
*
|
|
53
|
+
* const computer = createComputerUse({
|
|
54
|
+
* requireApproval: true
|
|
55
|
+
* });
|
|
56
|
+
*
|
|
57
|
+
* // Get tools for use with an agent
|
|
58
|
+
* const tools = computer.getTools();
|
|
59
|
+
* ```
|
|
60
|
+
*
|
|
61
|
+
* @example With Playwright browser control
|
|
62
|
+
* ```typescript
|
|
63
|
+
* import { chromium } from 'playwright';
|
|
64
|
+
* import { createComputerUse } from 'praisonai/integrations/computer-use';
|
|
65
|
+
*
|
|
66
|
+
* const browser = await chromium.launch();
|
|
67
|
+
* const page = await browser.newPage();
|
|
68
|
+
*
|
|
69
|
+
* const computer = createComputerUse({
|
|
70
|
+
* browser: true,
|
|
71
|
+
* tools: {
|
|
72
|
+
* screenshot: async () => {
|
|
73
|
+
* const buffer = await page.screenshot();
|
|
74
|
+
* return {
|
|
75
|
+
* base64: buffer.toString('base64'),
|
|
76
|
+
* width: 1920,
|
|
77
|
+
* height: 1080
|
|
78
|
+
* };
|
|
79
|
+
* },
|
|
80
|
+
* click: async (x, y) => {
|
|
81
|
+
* await page.mouse.click(x, y);
|
|
82
|
+
* },
|
|
83
|
+
* type: async (text) => {
|
|
84
|
+
* await page.keyboard.type(text);
|
|
85
|
+
* }
|
|
86
|
+
* }
|
|
87
|
+
* });
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
function createComputerUse(config = {}) {
|
|
91
|
+
return new ComputerUseClient(config);
|
|
92
|
+
}
|
|
93
|
+
class ComputerUseClient {
|
|
94
|
+
constructor(config = {}) {
|
|
95
|
+
this.config = {
|
|
96
|
+
requireApproval: true,
|
|
97
|
+
timeout: 30000,
|
|
98
|
+
...config,
|
|
99
|
+
};
|
|
100
|
+
// Initialize with safe no-op tools
|
|
101
|
+
this.tools = {
|
|
102
|
+
screenshot: config.tools?.screenshot || this.noOpScreenshot,
|
|
103
|
+
click: config.tools?.click || this.noOpAction,
|
|
104
|
+
doubleClick: config.tools?.doubleClick || this.noOpAction,
|
|
105
|
+
type: config.tools?.type || this.noOpAction,
|
|
106
|
+
key: config.tools?.key || this.noOpAction,
|
|
107
|
+
moveMouse: config.tools?.moveMouse || this.noOpAction,
|
|
108
|
+
scroll: config.tools?.scroll || this.noOpAction,
|
|
109
|
+
getScreenSize: config.tools?.getScreenSize || (async () => ({ width: 1920, height: 1080 })),
|
|
110
|
+
wait: config.tools?.wait || (async (ms) => new Promise(r => setTimeout(r, ms))),
|
|
111
|
+
execute: config.tools?.execute || this.noOpExecute,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Set the approval callback for actions.
|
|
116
|
+
*/
|
|
117
|
+
onApproval(callback) {
|
|
118
|
+
this.approvalCallback = callback;
|
|
119
|
+
return this;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* No-op screenshot implementation.
|
|
123
|
+
*/
|
|
124
|
+
async noOpScreenshot() {
|
|
125
|
+
console.warn('Computer Use: screenshot() called but no implementation provided');
|
|
126
|
+
return {
|
|
127
|
+
base64: '',
|
|
128
|
+
width: 0,
|
|
129
|
+
height: 0,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* No-op action implementation.
|
|
134
|
+
*/
|
|
135
|
+
async noOpAction(...args) {
|
|
136
|
+
console.warn('Computer Use: action called but no implementation provided', args);
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* No-op execute implementation.
|
|
140
|
+
*/
|
|
141
|
+
async noOpExecute(command) {
|
|
142
|
+
console.warn('Computer Use: execute() called but no implementation provided');
|
|
143
|
+
return `[No-op] Would execute: ${command}`;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Request approval for an action.
|
|
147
|
+
*/
|
|
148
|
+
async requestApproval(action) {
|
|
149
|
+
if (!this.config.requireApproval) {
|
|
150
|
+
return true;
|
|
151
|
+
}
|
|
152
|
+
if (this.approvalCallback) {
|
|
153
|
+
return await this.approvalCallback(action);
|
|
154
|
+
}
|
|
155
|
+
// Default: deny if no callback
|
|
156
|
+
console.warn('Computer Use: Action requires approval but no callback set', action);
|
|
157
|
+
return false;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Take a screenshot.
|
|
161
|
+
*/
|
|
162
|
+
async screenshot() {
|
|
163
|
+
const action = { type: 'screenshot' };
|
|
164
|
+
if (!(await this.requestApproval(action))) {
|
|
165
|
+
throw new Error('Screenshot action denied');
|
|
166
|
+
}
|
|
167
|
+
return await this.tools.screenshot();
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Click at coordinates.
|
|
171
|
+
*/
|
|
172
|
+
async click(x, y, button = 'left') {
|
|
173
|
+
const action = { type: 'click', params: { x, y, button }, requiresApproval: true };
|
|
174
|
+
if (!(await this.requestApproval(action))) {
|
|
175
|
+
throw new Error('Click action denied');
|
|
176
|
+
}
|
|
177
|
+
await this.tools.click(x, y, button);
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Type text.
|
|
181
|
+
*/
|
|
182
|
+
async type(text) {
|
|
183
|
+
const action = { type: 'type', params: { text }, requiresApproval: true };
|
|
184
|
+
if (!(await this.requestApproval(action))) {
|
|
185
|
+
throw new Error('Type action denied');
|
|
186
|
+
}
|
|
187
|
+
await this.tools.type(text);
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Press a key.
|
|
191
|
+
*/
|
|
192
|
+
async key(key) {
|
|
193
|
+
const action = { type: 'key', params: { key }, requiresApproval: true };
|
|
194
|
+
if (!(await this.requestApproval(action))) {
|
|
195
|
+
throw new Error('Key action denied');
|
|
196
|
+
}
|
|
197
|
+
await this.tools.key(key);
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Execute a command.
|
|
201
|
+
*/
|
|
202
|
+
async execute(command) {
|
|
203
|
+
const action = { type: 'execute', params: { command }, requiresApproval: true };
|
|
204
|
+
if (!(await this.requestApproval(action))) {
|
|
205
|
+
throw new Error('Execute action denied');
|
|
206
|
+
}
|
|
207
|
+
return await this.tools.execute(command);
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Get tools for use with an agent.
|
|
211
|
+
*/
|
|
212
|
+
getTools() {
|
|
213
|
+
return {
|
|
214
|
+
computer_screenshot: {
|
|
215
|
+
description: 'Take a screenshot of the current screen',
|
|
216
|
+
parameters: { type: 'object', properties: {} },
|
|
217
|
+
execute: async () => {
|
|
218
|
+
const result = await this.screenshot();
|
|
219
|
+
return JSON.stringify({ width: result.width, height: result.height, hasImage: !!result.base64 });
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
computer_click: {
|
|
223
|
+
description: 'Click at specific coordinates on the screen',
|
|
224
|
+
parameters: {
|
|
225
|
+
type: 'object',
|
|
226
|
+
properties: {
|
|
227
|
+
x: { type: 'number', description: 'X coordinate' },
|
|
228
|
+
y: { type: 'number', description: 'Y coordinate' },
|
|
229
|
+
button: { type: 'string', enum: ['left', 'right', 'middle'], description: 'Mouse button' },
|
|
230
|
+
},
|
|
231
|
+
required: ['x', 'y'],
|
|
232
|
+
},
|
|
233
|
+
execute: async ({ x, y, button }) => {
|
|
234
|
+
await this.click(x, y, button);
|
|
235
|
+
return 'Clicked successfully';
|
|
236
|
+
},
|
|
237
|
+
},
|
|
238
|
+
computer_type: {
|
|
239
|
+
description: 'Type text using the keyboard',
|
|
240
|
+
parameters: {
|
|
241
|
+
type: 'object',
|
|
242
|
+
properties: {
|
|
243
|
+
text: { type: 'string', description: 'Text to type' },
|
|
244
|
+
},
|
|
245
|
+
required: ['text'],
|
|
246
|
+
},
|
|
247
|
+
execute: async ({ text }) => {
|
|
248
|
+
await this.type(text);
|
|
249
|
+
return 'Typed successfully';
|
|
250
|
+
},
|
|
251
|
+
},
|
|
252
|
+
computer_key: {
|
|
253
|
+
description: 'Press a key or key combination (e.g., "Enter", "Control+C")',
|
|
254
|
+
parameters: {
|
|
255
|
+
type: 'object',
|
|
256
|
+
properties: {
|
|
257
|
+
key: { type: 'string', description: 'Key or key combination to press' },
|
|
258
|
+
},
|
|
259
|
+
required: ['key'],
|
|
260
|
+
},
|
|
261
|
+
execute: async ({ key }) => {
|
|
262
|
+
await this.key(key);
|
|
263
|
+
return 'Key pressed successfully';
|
|
264
|
+
},
|
|
265
|
+
},
|
|
266
|
+
computer_scroll: {
|
|
267
|
+
description: 'Scroll the screen',
|
|
268
|
+
parameters: {
|
|
269
|
+
type: 'object',
|
|
270
|
+
properties: {
|
|
271
|
+
direction: { type: 'string', enum: ['up', 'down', 'left', 'right'] },
|
|
272
|
+
amount: { type: 'number', description: 'Scroll amount in pixels' },
|
|
273
|
+
},
|
|
274
|
+
required: ['direction'],
|
|
275
|
+
},
|
|
276
|
+
execute: async ({ direction, amount }) => {
|
|
277
|
+
const action = { type: 'scroll', params: { direction, amount }, requiresApproval: true };
|
|
278
|
+
if (!(await this.requestApproval(action))) {
|
|
279
|
+
throw new Error('Scroll action denied');
|
|
280
|
+
}
|
|
281
|
+
await this.tools.scroll(direction, amount);
|
|
282
|
+
return 'Scrolled successfully';
|
|
283
|
+
},
|
|
284
|
+
},
|
|
285
|
+
computer_execute: {
|
|
286
|
+
description: 'Execute a shell command (requires approval)',
|
|
287
|
+
parameters: {
|
|
288
|
+
type: 'object',
|
|
289
|
+
properties: {
|
|
290
|
+
command: { type: 'string', description: 'Shell command to execute' },
|
|
291
|
+
},
|
|
292
|
+
required: ['command'],
|
|
293
|
+
},
|
|
294
|
+
execute: async ({ command }) => {
|
|
295
|
+
const result = await this.execute(command);
|
|
296
|
+
return result;
|
|
297
|
+
},
|
|
298
|
+
},
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
exports.ComputerUseClient = ComputerUseClient;
|
|
303
|
+
/**
|
|
304
|
+
* Create a simple approval prompt for CLI usage.
|
|
305
|
+
*/
|
|
306
|
+
function createCLIApprovalPrompt() {
|
|
307
|
+
return async (action) => {
|
|
308
|
+
const readline = await Promise.resolve().then(() => __importStar(require('readline')));
|
|
309
|
+
const rl = readline.createInterface({
|
|
310
|
+
input: process.stdin,
|
|
311
|
+
output: process.stdout,
|
|
312
|
+
});
|
|
313
|
+
return new Promise((resolve) => {
|
|
314
|
+
const actionDesc = `${action.type}${action.params ? `: ${JSON.stringify(action.params)}` : ''}`;
|
|
315
|
+
rl.question(`\n⚠️ Approve action: ${actionDesc}? (y/n) `, (answer) => {
|
|
316
|
+
rl.close();
|
|
317
|
+
resolve(answer.toLowerCase() === 'y' || answer.toLowerCase() === 'yes');
|
|
318
|
+
});
|
|
319
|
+
});
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* Create a Computer Use agent with human-in-the-loop approval.
|
|
324
|
+
*
|
|
325
|
+
* @example
|
|
326
|
+
* ```typescript
|
|
327
|
+
* import { Agent } from 'praisonai';
|
|
328
|
+
* import { createComputerUseAgent } from 'praisonai/integrations/computer-use';
|
|
329
|
+
*
|
|
330
|
+
* const agent = await createComputerUseAgent({
|
|
331
|
+
* instructions: 'You can control the computer to help the user',
|
|
332
|
+
* approvalMode: 'cli' // or 'auto' for no approval
|
|
333
|
+
* });
|
|
334
|
+
*
|
|
335
|
+
* await agent.chat('Open a browser and search for AI news');
|
|
336
|
+
* ```
|
|
337
|
+
*/
|
|
338
|
+
async function createComputerUseAgent(options) {
|
|
339
|
+
const { Agent } = await Promise.resolve().then(() => __importStar(require('../agent/simple')));
|
|
340
|
+
const computer = createComputerUse({
|
|
341
|
+
requireApproval: options.approvalMode !== 'auto',
|
|
342
|
+
tools: options.tools,
|
|
343
|
+
});
|
|
344
|
+
if (options.approvalMode === 'cli') {
|
|
345
|
+
computer.onApproval(createCLIApprovalPrompt());
|
|
346
|
+
}
|
|
347
|
+
else if (options.approvalMode === 'custom' && options.onApproval) {
|
|
348
|
+
computer.onApproval(options.onApproval);
|
|
349
|
+
}
|
|
350
|
+
const computerTools = computer.getTools();
|
|
351
|
+
return new Agent({
|
|
352
|
+
instructions: options.instructions || 'You are a computer use assistant. You can take screenshots, click, type, and execute commands to help the user.',
|
|
353
|
+
llm: options.model || 'gpt-4o',
|
|
354
|
+
tools: Object.values(computerTools),
|
|
355
|
+
});
|
|
356
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* PraisonAI Integrations
|
|
4
|
+
* Extensions for vector stores, observability, and voice
|
|
5
|
+
*/
|
|
6
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
13
|
+
}) : (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
o[k2] = m[k];
|
|
16
|
+
}));
|
|
17
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
18
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
// Vector Store Integrations
|
|
22
|
+
__exportStar(require("./vector"), exports);
|
|
23
|
+
// Observability Integrations
|
|
24
|
+
__exportStar(require("./observability"), exports);
|
|
25
|
+
// Voice Integrations
|
|
26
|
+
__exportStar(require("./voice"), exports);
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base Observability - Abstract class for observability integrations
|
|
3
|
+
* Supports tracing, logging, and metrics
|
|
4
|
+
*/
|
|
5
|
+
export interface Span {
|
|
6
|
+
id: string;
|
|
7
|
+
traceId: string;
|
|
8
|
+
parentId?: string;
|
|
9
|
+
name: string;
|
|
10
|
+
startTime: number;
|
|
11
|
+
endTime?: number;
|
|
12
|
+
status: 'ok' | 'error' | 'unset';
|
|
13
|
+
attributes: Record<string, any>;
|
|
14
|
+
events: SpanEvent[];
|
|
15
|
+
}
|
|
16
|
+
export interface SpanEvent {
|
|
17
|
+
name: string;
|
|
18
|
+
timestamp: number;
|
|
19
|
+
attributes?: Record<string, any>;
|
|
20
|
+
}
|
|
21
|
+
export interface TraceContext {
|
|
22
|
+
traceId: string;
|
|
23
|
+
spanId: string;
|
|
24
|
+
parentSpanId?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface LogEntry {
|
|
27
|
+
level: 'debug' | 'info' | 'warn' | 'error';
|
|
28
|
+
message: string;
|
|
29
|
+
timestamp: number;
|
|
30
|
+
traceId?: string;
|
|
31
|
+
spanId?: string;
|
|
32
|
+
attributes?: Record<string, any>;
|
|
33
|
+
}
|
|
34
|
+
export interface Metric {
|
|
35
|
+
name: string;
|
|
36
|
+
value: number;
|
|
37
|
+
type: 'counter' | 'gauge' | 'histogram';
|
|
38
|
+
timestamp: number;
|
|
39
|
+
tags?: Record<string, string>;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Abstract base class for observability providers
|
|
43
|
+
*/
|
|
44
|
+
export declare abstract class BaseObservabilityProvider {
|
|
45
|
+
readonly name: string;
|
|
46
|
+
constructor(name: string);
|
|
47
|
+
/**
|
|
48
|
+
* Start a new span
|
|
49
|
+
*/
|
|
50
|
+
abstract startSpan(name: string, attributes?: Record<string, any>, parentContext?: TraceContext): Span;
|
|
51
|
+
/**
|
|
52
|
+
* End a span
|
|
53
|
+
*/
|
|
54
|
+
abstract endSpan(span: Span, status?: 'ok' | 'error', error?: Error): void;
|
|
55
|
+
/**
|
|
56
|
+
* Add event to span
|
|
57
|
+
*/
|
|
58
|
+
abstract addSpanEvent(span: Span, name: string, attributes?: Record<string, any>): void;
|
|
59
|
+
/**
|
|
60
|
+
* Log a message
|
|
61
|
+
*/
|
|
62
|
+
abstract log(entry: LogEntry): void;
|
|
63
|
+
/**
|
|
64
|
+
* Record a metric
|
|
65
|
+
*/
|
|
66
|
+
abstract recordMetric(metric: Metric): void;
|
|
67
|
+
/**
|
|
68
|
+
* Flush all pending data
|
|
69
|
+
*/
|
|
70
|
+
abstract flush(): Promise<void>;
|
|
71
|
+
/**
|
|
72
|
+
* Shutdown the provider
|
|
73
|
+
*/
|
|
74
|
+
abstract shutdown(): Promise<void>;
|
|
75
|
+
/**
|
|
76
|
+
* Helper to create trace context
|
|
77
|
+
*/
|
|
78
|
+
protected createTraceContext(span: Span): TraceContext;
|
|
79
|
+
/**
|
|
80
|
+
* Generate unique ID
|
|
81
|
+
*/
|
|
82
|
+
protected generateId(): string;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Console-based observability provider for development
|
|
86
|
+
*/
|
|
87
|
+
export declare class ConsoleObservabilityProvider extends BaseObservabilityProvider {
|
|
88
|
+
private spans;
|
|
89
|
+
private verbose;
|
|
90
|
+
constructor(config?: {
|
|
91
|
+
verbose?: boolean;
|
|
92
|
+
});
|
|
93
|
+
startSpan(name: string, attributes?: Record<string, any>, parentContext?: TraceContext): Span;
|
|
94
|
+
endSpan(span: Span, status?: 'ok' | 'error', error?: Error): void;
|
|
95
|
+
addSpanEvent(span: Span, name: string, attributes?: Record<string, any>): void;
|
|
96
|
+
log(entry: LogEntry): void;
|
|
97
|
+
recordMetric(metric: Metric): void;
|
|
98
|
+
flush(): Promise<void>;
|
|
99
|
+
shutdown(): Promise<void>;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Memory-based observability provider for testing
|
|
103
|
+
*/
|
|
104
|
+
export declare class MemoryObservabilityProvider extends BaseObservabilityProvider {
|
|
105
|
+
spans: Span[];
|
|
106
|
+
logs: LogEntry[];
|
|
107
|
+
metrics: Metric[];
|
|
108
|
+
constructor();
|
|
109
|
+
startSpan(name: string, attributes?: Record<string, any>, parentContext?: TraceContext): Span;
|
|
110
|
+
endSpan(span: Span, status?: 'ok' | 'error', error?: Error): void;
|
|
111
|
+
addSpanEvent(span: Span, name: string, attributes?: Record<string, any>): void;
|
|
112
|
+
log(entry: LogEntry): void;
|
|
113
|
+
recordMetric(metric: Metric): void;
|
|
114
|
+
flush(): Promise<void>;
|
|
115
|
+
shutdown(): Promise<void>;
|
|
116
|
+
getSpansByName(name: string): Span[];
|
|
117
|
+
getLogsByLevel(level: LogEntry['level']): LogEntry[];
|
|
118
|
+
getMetricsByName(name: string): Metric[];
|
|
119
|
+
}
|
|
120
|
+
export declare function createConsoleObservability(config?: {
|
|
121
|
+
verbose?: boolean;
|
|
122
|
+
}): ConsoleObservabilityProvider;
|
|
123
|
+
export declare function createMemoryObservability(): MemoryObservabilityProvider;
|