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,190 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Memory Observability Adapter
|
|
4
|
+
* In-memory storage for development and testing
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.MemoryObservabilityAdapter = void 0;
|
|
8
|
+
exports.createMemoryAdapter = createMemoryAdapter;
|
|
9
|
+
/**
|
|
10
|
+
* Generate a random ID
|
|
11
|
+
*/
|
|
12
|
+
function generateId() {
|
|
13
|
+
return Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Memory Span Context
|
|
17
|
+
*/
|
|
18
|
+
class MemorySpanContext {
|
|
19
|
+
constructor(spanId, traceId, adapter) {
|
|
20
|
+
this.spanId = spanId;
|
|
21
|
+
this.traceId = traceId;
|
|
22
|
+
this.adapter = adapter;
|
|
23
|
+
}
|
|
24
|
+
addEvent(name, attributes) {
|
|
25
|
+
this.adapter.addEvent(this.spanId, name, attributes);
|
|
26
|
+
}
|
|
27
|
+
setAttributes(attributes) {
|
|
28
|
+
const span = this.adapter.getSpan(this.spanId);
|
|
29
|
+
if (span) {
|
|
30
|
+
span.attributes = { ...span.attributes, ...attributes };
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
setProviderMetadata(metadata) {
|
|
34
|
+
const span = this.adapter.getSpan(this.spanId);
|
|
35
|
+
if (span) {
|
|
36
|
+
span.providerMetadata = metadata;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
recordError(error) {
|
|
40
|
+
this.adapter.recordError(this.spanId, error);
|
|
41
|
+
}
|
|
42
|
+
end(status = 'completed') {
|
|
43
|
+
this.adapter.endSpan(this.spanId, status);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Memory Trace Context
|
|
48
|
+
*/
|
|
49
|
+
class MemoryTraceContext {
|
|
50
|
+
constructor(traceId, adapter) {
|
|
51
|
+
this.traceId = traceId;
|
|
52
|
+
this.adapter = adapter;
|
|
53
|
+
}
|
|
54
|
+
startSpan(name, kind, parentId) {
|
|
55
|
+
return this.adapter.startSpan(this.traceId, name, kind, parentId);
|
|
56
|
+
}
|
|
57
|
+
end(status = 'completed') {
|
|
58
|
+
this.adapter.endTrace(this.traceId, status);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Memory Observability Adapter
|
|
63
|
+
* Stores all traces and spans in memory for development/testing
|
|
64
|
+
*/
|
|
65
|
+
class MemoryObservabilityAdapter {
|
|
66
|
+
constructor(options = {}) {
|
|
67
|
+
this.name = 'memory';
|
|
68
|
+
this.isEnabled = true;
|
|
69
|
+
this.traces = new Map();
|
|
70
|
+
this.spans = new Map();
|
|
71
|
+
this.maxTraces = options.maxTraces || 1000;
|
|
72
|
+
}
|
|
73
|
+
async initialize() { }
|
|
74
|
+
async shutdown() {
|
|
75
|
+
this.clear();
|
|
76
|
+
}
|
|
77
|
+
startTrace(name, metadata = {}, attribution) {
|
|
78
|
+
const traceId = generateId();
|
|
79
|
+
const trace = {
|
|
80
|
+
id: traceId,
|
|
81
|
+
name,
|
|
82
|
+
startTime: Date.now(),
|
|
83
|
+
status: 'running',
|
|
84
|
+
spans: [],
|
|
85
|
+
metadata,
|
|
86
|
+
attribution
|
|
87
|
+
};
|
|
88
|
+
// Enforce max traces limit
|
|
89
|
+
if (this.traces.size >= this.maxTraces) {
|
|
90
|
+
const oldestKey = this.traces.keys().next().value;
|
|
91
|
+
if (oldestKey) {
|
|
92
|
+
this.traces.delete(oldestKey);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
this.traces.set(traceId, trace);
|
|
96
|
+
return new MemoryTraceContext(traceId, this);
|
|
97
|
+
}
|
|
98
|
+
endTrace(traceId, status = 'completed') {
|
|
99
|
+
const trace = this.traces.get(traceId);
|
|
100
|
+
if (trace) {
|
|
101
|
+
trace.endTime = Date.now();
|
|
102
|
+
trace.status = status;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
startSpan(traceId, name, kind, parentId) {
|
|
106
|
+
const spanId = generateId();
|
|
107
|
+
const span = {
|
|
108
|
+
id: spanId,
|
|
109
|
+
traceId,
|
|
110
|
+
parentId,
|
|
111
|
+
name,
|
|
112
|
+
kind,
|
|
113
|
+
status: 'running',
|
|
114
|
+
startTime: Date.now(),
|
|
115
|
+
attributes: {},
|
|
116
|
+
events: []
|
|
117
|
+
};
|
|
118
|
+
this.spans.set(spanId, span);
|
|
119
|
+
const trace = this.traces.get(traceId);
|
|
120
|
+
if (trace) {
|
|
121
|
+
trace.spans.push(span);
|
|
122
|
+
}
|
|
123
|
+
return new MemorySpanContext(spanId, traceId, this);
|
|
124
|
+
}
|
|
125
|
+
endSpan(spanId, status = 'completed', attributes) {
|
|
126
|
+
const span = this.spans.get(spanId);
|
|
127
|
+
if (span) {
|
|
128
|
+
span.endTime = Date.now();
|
|
129
|
+
span.status = status;
|
|
130
|
+
if (attributes) {
|
|
131
|
+
span.attributes = { ...span.attributes, ...attributes };
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
addEvent(spanId, name, attributes) {
|
|
136
|
+
const span = this.spans.get(spanId);
|
|
137
|
+
if (span) {
|
|
138
|
+
const event = {
|
|
139
|
+
name,
|
|
140
|
+
timestamp: Date.now(),
|
|
141
|
+
attributes
|
|
142
|
+
};
|
|
143
|
+
span.events.push(event);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
recordError(spanId, error) {
|
|
147
|
+
const span = this.spans.get(spanId);
|
|
148
|
+
if (span) {
|
|
149
|
+
span.error = {
|
|
150
|
+
message: error.message,
|
|
151
|
+
stack: error.stack,
|
|
152
|
+
code: error.code
|
|
153
|
+
};
|
|
154
|
+
span.status = 'failed';
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
async flush() {
|
|
158
|
+
// No-op for memory adapter
|
|
159
|
+
}
|
|
160
|
+
// Utility methods for testing/debugging
|
|
161
|
+
getTrace(traceId) {
|
|
162
|
+
return this.traces.get(traceId);
|
|
163
|
+
}
|
|
164
|
+
getSpan(spanId) {
|
|
165
|
+
return this.spans.get(spanId);
|
|
166
|
+
}
|
|
167
|
+
getAllTraces() {
|
|
168
|
+
return Array.from(this.traces.values());
|
|
169
|
+
}
|
|
170
|
+
getAllSpans() {
|
|
171
|
+
return Array.from(this.spans.values());
|
|
172
|
+
}
|
|
173
|
+
getTraceSpans(traceId) {
|
|
174
|
+
return Array.from(this.spans.values()).filter(s => s.traceId === traceId);
|
|
175
|
+
}
|
|
176
|
+
clear() {
|
|
177
|
+
this.traces.clear();
|
|
178
|
+
this.spans.clear();
|
|
179
|
+
}
|
|
180
|
+
getStats() {
|
|
181
|
+
return {
|
|
182
|
+
traces: this.traces.size,
|
|
183
|
+
spans: this.spans.size
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
exports.MemoryObservabilityAdapter = MemoryObservabilityAdapter;
|
|
188
|
+
function createMemoryAdapter(options) {
|
|
189
|
+
return new MemoryObservabilityAdapter(options);
|
|
190
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* No-op Observability Adapter
|
|
3
|
+
* Default adapter that does nothing - zero overhead when observability is disabled
|
|
4
|
+
*/
|
|
5
|
+
import type { ObservabilityAdapter, TraceContext, SpanContext, SpanKind, SpanStatus, AttributionContext } from '../types';
|
|
6
|
+
/**
|
|
7
|
+
* No-op Observability Adapter
|
|
8
|
+
*
|
|
9
|
+
* This adapter does nothing and has zero overhead.
|
|
10
|
+
* Used as the default when no observability is configured.
|
|
11
|
+
*/
|
|
12
|
+
export declare class NoopObservabilityAdapter implements ObservabilityAdapter {
|
|
13
|
+
readonly name = "noop";
|
|
14
|
+
readonly isEnabled = false;
|
|
15
|
+
initialize(): Promise<void>;
|
|
16
|
+
shutdown(): Promise<void>;
|
|
17
|
+
startTrace(_name: string, _metadata?: Record<string, unknown>, _attribution?: AttributionContext): TraceContext;
|
|
18
|
+
endTrace(_traceId: string, _status?: SpanStatus): void;
|
|
19
|
+
startSpan(_traceId: string, _name: string, _kind: SpanKind, _parentId?: string): SpanContext;
|
|
20
|
+
endSpan(_spanId: string, _status?: SpanStatus, _attributes?: Record<string, unknown>): void;
|
|
21
|
+
addEvent(_spanId: string, _name: string, _attributes?: Record<string, unknown>): void;
|
|
22
|
+
recordError(_spanId: string, _error: Error): void;
|
|
23
|
+
flush(): Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
export declare const noopAdapter: NoopObservabilityAdapter;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* No-op Observability Adapter
|
|
4
|
+
* Default adapter that does nothing - zero overhead when observability is disabled
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.noopAdapter = exports.NoopObservabilityAdapter = void 0;
|
|
8
|
+
/**
|
|
9
|
+
* No-op span context - all operations are no-ops
|
|
10
|
+
*/
|
|
11
|
+
class NoopSpanContext {
|
|
12
|
+
constructor() {
|
|
13
|
+
this.spanId = '';
|
|
14
|
+
this.traceId = '';
|
|
15
|
+
}
|
|
16
|
+
addEvent(_name, _attributes) { }
|
|
17
|
+
setAttributes(_attributes) { }
|
|
18
|
+
setProviderMetadata(_metadata) { }
|
|
19
|
+
recordError(_error) { }
|
|
20
|
+
end(_status) { }
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* No-op trace context - all operations are no-ops
|
|
24
|
+
*/
|
|
25
|
+
class NoopTraceContext {
|
|
26
|
+
constructor() {
|
|
27
|
+
this.traceId = '';
|
|
28
|
+
}
|
|
29
|
+
startSpan(_name, _kind, _parentId) {
|
|
30
|
+
return new NoopSpanContext();
|
|
31
|
+
}
|
|
32
|
+
end(_status) { }
|
|
33
|
+
}
|
|
34
|
+
// Singleton instances
|
|
35
|
+
const noopSpanContext = new NoopSpanContext();
|
|
36
|
+
const noopTraceContext = new NoopTraceContext();
|
|
37
|
+
/**
|
|
38
|
+
* No-op Observability Adapter
|
|
39
|
+
*
|
|
40
|
+
* This adapter does nothing and has zero overhead.
|
|
41
|
+
* Used as the default when no observability is configured.
|
|
42
|
+
*/
|
|
43
|
+
class NoopObservabilityAdapter {
|
|
44
|
+
constructor() {
|
|
45
|
+
this.name = 'noop';
|
|
46
|
+
this.isEnabled = false;
|
|
47
|
+
}
|
|
48
|
+
async initialize() { }
|
|
49
|
+
async shutdown() { }
|
|
50
|
+
startTrace(_name, _metadata, _attribution) {
|
|
51
|
+
return noopTraceContext;
|
|
52
|
+
}
|
|
53
|
+
endTrace(_traceId, _status) { }
|
|
54
|
+
startSpan(_traceId, _name, _kind, _parentId) {
|
|
55
|
+
return noopSpanContext;
|
|
56
|
+
}
|
|
57
|
+
endSpan(_spanId, _status, _attributes) { }
|
|
58
|
+
addEvent(_spanId, _name, _attributes) { }
|
|
59
|
+
recordError(_spanId, _error) { }
|
|
60
|
+
async flush() { }
|
|
61
|
+
}
|
|
62
|
+
exports.NoopObservabilityAdapter = NoopObservabilityAdapter;
|
|
63
|
+
// Export singleton instance
|
|
64
|
+
exports.noopAdapter = new NoopObservabilityAdapter();
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Observability Module - Unified tracing, logging, and metrics
|
|
3
|
+
*
|
|
4
|
+
* Supports 14+ observability integrations:
|
|
5
|
+
* - Langfuse, LangSmith, LangWatch
|
|
6
|
+
* - Arize AX, Axiom, Braintrust
|
|
7
|
+
* - Helicone, Laminar, Maxim
|
|
8
|
+
* - Patronus, Scorecard, SigNoz
|
|
9
|
+
* - Traceloop, Weave
|
|
10
|
+
*
|
|
11
|
+
* @example Basic usage
|
|
12
|
+
* ```typescript
|
|
13
|
+
* import { createObservabilityAdapter, setObservabilityAdapter } from 'praisonai';
|
|
14
|
+
*
|
|
15
|
+
* // Enable observability
|
|
16
|
+
* const adapter = await createObservabilityAdapter('langfuse');
|
|
17
|
+
* setObservabilityAdapter(adapter);
|
|
18
|
+
*
|
|
19
|
+
* // Use with agents
|
|
20
|
+
* const agent = new Agent({
|
|
21
|
+
* instructions: "You are helpful"
|
|
22
|
+
* });
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export type { SpanKind, SpanStatus, SpanData, SpanEvent, TraceData, TraceContext, SpanContext, ObservabilityAdapter, AttributionContext, ProviderMetadata, ObservabilityToolConfig, ObservabilityToolName, ObservabilityToolInfo } from './types';
|
|
26
|
+
export { OBSERVABILITY_TOOLS, getObservabilityToolInfo, listObservabilityTools, hasObservabilityToolEnvVar } from './types';
|
|
27
|
+
export { NoopObservabilityAdapter, noopAdapter, MemoryObservabilityAdapter, createMemoryAdapter, ConsoleObservabilityAdapter, createConsoleAdapter, createObservabilityAdapter, clearAdapterCache } from './adapters';
|
|
28
|
+
import type { ObservabilityAdapter } from './types';
|
|
29
|
+
/**
|
|
30
|
+
* Set the global observability adapter
|
|
31
|
+
*/
|
|
32
|
+
export declare function setObservabilityAdapter(adapter: ObservabilityAdapter): void;
|
|
33
|
+
/**
|
|
34
|
+
* Get the global observability adapter (creates memory adapter if not set)
|
|
35
|
+
*/
|
|
36
|
+
export declare function getObservabilityAdapter(): ObservabilityAdapter;
|
|
37
|
+
/**
|
|
38
|
+
* Reset the global observability adapter (for testing)
|
|
39
|
+
*/
|
|
40
|
+
export declare function resetObservabilityAdapter(): void;
|
|
41
|
+
/**
|
|
42
|
+
* Create a trace helper function for easy integration
|
|
43
|
+
*/
|
|
44
|
+
export declare function trace(toolName?: string): {
|
|
45
|
+
tool: string;
|
|
46
|
+
getAdapter(): Promise<ObservabilityAdapter>;
|
|
47
|
+
};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Observability Module - Unified tracing, logging, and metrics
|
|
4
|
+
*
|
|
5
|
+
* Supports 14+ observability integrations:
|
|
6
|
+
* - Langfuse, LangSmith, LangWatch
|
|
7
|
+
* - Arize AX, Axiom, Braintrust
|
|
8
|
+
* - Helicone, Laminar, Maxim
|
|
9
|
+
* - Patronus, Scorecard, SigNoz
|
|
10
|
+
* - Traceloop, Weave
|
|
11
|
+
*
|
|
12
|
+
* @example Basic usage
|
|
13
|
+
* ```typescript
|
|
14
|
+
* import { createObservabilityAdapter, setObservabilityAdapter } from 'praisonai';
|
|
15
|
+
*
|
|
16
|
+
* // Enable observability
|
|
17
|
+
* const adapter = await createObservabilityAdapter('langfuse');
|
|
18
|
+
* setObservabilityAdapter(adapter);
|
|
19
|
+
*
|
|
20
|
+
* // Use with agents
|
|
21
|
+
* const agent = new Agent({
|
|
22
|
+
* instructions: "You are helpful"
|
|
23
|
+
* });
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
27
|
+
if (k2 === undefined) k2 = k;
|
|
28
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
29
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
30
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
31
|
+
}
|
|
32
|
+
Object.defineProperty(o, k2, desc);
|
|
33
|
+
}) : (function(o, m, k, k2) {
|
|
34
|
+
if (k2 === undefined) k2 = k;
|
|
35
|
+
o[k2] = m[k];
|
|
36
|
+
}));
|
|
37
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
38
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
39
|
+
}) : function(o, v) {
|
|
40
|
+
o["default"] = v;
|
|
41
|
+
});
|
|
42
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
43
|
+
var ownKeys = function(o) {
|
|
44
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
45
|
+
var ar = [];
|
|
46
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
47
|
+
return ar;
|
|
48
|
+
};
|
|
49
|
+
return ownKeys(o);
|
|
50
|
+
};
|
|
51
|
+
return function (mod) {
|
|
52
|
+
if (mod && mod.__esModule) return mod;
|
|
53
|
+
var result = {};
|
|
54
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
55
|
+
__setModuleDefault(result, mod);
|
|
56
|
+
return result;
|
|
57
|
+
};
|
|
58
|
+
})();
|
|
59
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
60
|
+
exports.clearAdapterCache = exports.createObservabilityAdapter = exports.createConsoleAdapter = exports.ConsoleObservabilityAdapter = exports.createMemoryAdapter = exports.MemoryObservabilityAdapter = exports.noopAdapter = exports.NoopObservabilityAdapter = exports.hasObservabilityToolEnvVar = exports.listObservabilityTools = exports.getObservabilityToolInfo = exports.OBSERVABILITY_TOOLS = void 0;
|
|
61
|
+
exports.setObservabilityAdapter = setObservabilityAdapter;
|
|
62
|
+
exports.getObservabilityAdapter = getObservabilityAdapter;
|
|
63
|
+
exports.resetObservabilityAdapter = resetObservabilityAdapter;
|
|
64
|
+
exports.trace = trace;
|
|
65
|
+
var types_1 = require("./types");
|
|
66
|
+
Object.defineProperty(exports, "OBSERVABILITY_TOOLS", { enumerable: true, get: function () { return types_1.OBSERVABILITY_TOOLS; } });
|
|
67
|
+
Object.defineProperty(exports, "getObservabilityToolInfo", { enumerable: true, get: function () { return types_1.getObservabilityToolInfo; } });
|
|
68
|
+
Object.defineProperty(exports, "listObservabilityTools", { enumerable: true, get: function () { return types_1.listObservabilityTools; } });
|
|
69
|
+
Object.defineProperty(exports, "hasObservabilityToolEnvVar", { enumerable: true, get: function () { return types_1.hasObservabilityToolEnvVar; } });
|
|
70
|
+
// Re-export adapters
|
|
71
|
+
var adapters_1 = require("./adapters");
|
|
72
|
+
Object.defineProperty(exports, "NoopObservabilityAdapter", { enumerable: true, get: function () { return adapters_1.NoopObservabilityAdapter; } });
|
|
73
|
+
Object.defineProperty(exports, "noopAdapter", { enumerable: true, get: function () { return adapters_1.noopAdapter; } });
|
|
74
|
+
Object.defineProperty(exports, "MemoryObservabilityAdapter", { enumerable: true, get: function () { return adapters_1.MemoryObservabilityAdapter; } });
|
|
75
|
+
Object.defineProperty(exports, "createMemoryAdapter", { enumerable: true, get: function () { return adapters_1.createMemoryAdapter; } });
|
|
76
|
+
Object.defineProperty(exports, "ConsoleObservabilityAdapter", { enumerable: true, get: function () { return adapters_1.ConsoleObservabilityAdapter; } });
|
|
77
|
+
Object.defineProperty(exports, "createConsoleAdapter", { enumerable: true, get: function () { return adapters_1.createConsoleAdapter; } });
|
|
78
|
+
Object.defineProperty(exports, "createObservabilityAdapter", { enumerable: true, get: function () { return adapters_1.createObservabilityAdapter; } });
|
|
79
|
+
Object.defineProperty(exports, "clearAdapterCache", { enumerable: true, get: function () { return adapters_1.clearAdapterCache; } });
|
|
80
|
+
const adapters_2 = require("./adapters");
|
|
81
|
+
// Global observability instance
|
|
82
|
+
let globalAdapter = null;
|
|
83
|
+
/**
|
|
84
|
+
* Set the global observability adapter
|
|
85
|
+
*/
|
|
86
|
+
function setObservabilityAdapter(adapter) {
|
|
87
|
+
globalAdapter = adapter;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Get the global observability adapter (creates memory adapter if not set)
|
|
91
|
+
*/
|
|
92
|
+
function getObservabilityAdapter() {
|
|
93
|
+
if (!globalAdapter) {
|
|
94
|
+
globalAdapter = new adapters_2.MemoryObservabilityAdapter();
|
|
95
|
+
}
|
|
96
|
+
return globalAdapter;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Reset the global observability adapter (for testing)
|
|
100
|
+
*/
|
|
101
|
+
function resetObservabilityAdapter() {
|
|
102
|
+
globalAdapter = null;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Create a trace helper function for easy integration
|
|
106
|
+
*/
|
|
107
|
+
function trace(toolName = 'memory') {
|
|
108
|
+
return {
|
|
109
|
+
tool: toolName,
|
|
110
|
+
async getAdapter() {
|
|
111
|
+
const { createObservabilityAdapter } = await Promise.resolve().then(() => __importStar(require('./adapters')));
|
|
112
|
+
return createObservabilityAdapter(toolName);
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Observability Types - Unified tracing interface for all observability integrations
|
|
3
|
+
*/
|
|
4
|
+
export type SpanKind = 'llm' | 'tool' | 'agent' | 'workflow' | 'embedding' | 'retrieval' | 'custom';
|
|
5
|
+
export type SpanStatus = 'pending' | 'running' | 'completed' | 'failed' | 'cancelled';
|
|
6
|
+
/**
|
|
7
|
+
* Attribution context for multi-agent safety
|
|
8
|
+
*/
|
|
9
|
+
export interface AttributionContext {
|
|
10
|
+
agentId?: string;
|
|
11
|
+
runId?: string;
|
|
12
|
+
traceId?: string;
|
|
13
|
+
sessionId?: string;
|
|
14
|
+
parentSpanId?: string;
|
|
15
|
+
userId?: string;
|
|
16
|
+
teamId?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Provider call metadata
|
|
20
|
+
*/
|
|
21
|
+
export interface ProviderMetadata {
|
|
22
|
+
provider: string;
|
|
23
|
+
model: string;
|
|
24
|
+
promptTokens?: number;
|
|
25
|
+
completionTokens?: number;
|
|
26
|
+
totalTokens?: number;
|
|
27
|
+
latencyMs?: number;
|
|
28
|
+
retryCount?: number;
|
|
29
|
+
region?: string;
|
|
30
|
+
cost?: number;
|
|
31
|
+
finishReason?: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Span event
|
|
35
|
+
*/
|
|
36
|
+
export interface SpanEvent {
|
|
37
|
+
name: string;
|
|
38
|
+
timestamp: number;
|
|
39
|
+
attributes?: Record<string, unknown>;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Span data
|
|
43
|
+
*/
|
|
44
|
+
export interface SpanData {
|
|
45
|
+
id: string;
|
|
46
|
+
traceId: string;
|
|
47
|
+
parentId?: string;
|
|
48
|
+
name: string;
|
|
49
|
+
kind: SpanKind;
|
|
50
|
+
status: SpanStatus;
|
|
51
|
+
startTime: number;
|
|
52
|
+
endTime?: number;
|
|
53
|
+
attributes: Record<string, unknown>;
|
|
54
|
+
events: SpanEvent[];
|
|
55
|
+
attribution?: AttributionContext;
|
|
56
|
+
providerMetadata?: ProviderMetadata;
|
|
57
|
+
error?: {
|
|
58
|
+
message: string;
|
|
59
|
+
stack?: string;
|
|
60
|
+
code?: string;
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Trace data
|
|
65
|
+
*/
|
|
66
|
+
export interface TraceData {
|
|
67
|
+
id: string;
|
|
68
|
+
name: string;
|
|
69
|
+
startTime: number;
|
|
70
|
+
endTime?: number;
|
|
71
|
+
status: SpanStatus;
|
|
72
|
+
spans: SpanData[];
|
|
73
|
+
metadata: Record<string, unknown>;
|
|
74
|
+
attribution?: AttributionContext;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Span context for active spans
|
|
78
|
+
*/
|
|
79
|
+
export interface SpanContext {
|
|
80
|
+
spanId: string;
|
|
81
|
+
traceId: string;
|
|
82
|
+
addEvent(name: string, attributes?: Record<string, unknown>): void;
|
|
83
|
+
setAttributes(attributes: Record<string, unknown>): void;
|
|
84
|
+
setProviderMetadata(metadata: ProviderMetadata): void;
|
|
85
|
+
recordError(error: Error): void;
|
|
86
|
+
end(status?: SpanStatus): void;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Trace context for active traces
|
|
90
|
+
*/
|
|
91
|
+
export interface TraceContext {
|
|
92
|
+
traceId: string;
|
|
93
|
+
startSpan(name: string, kind: SpanKind, parentId?: string): SpanContext;
|
|
94
|
+
end(status?: SpanStatus): void;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Unified Observability Adapter Protocol
|
|
98
|
+
* All observability integrations must implement this interface
|
|
99
|
+
*/
|
|
100
|
+
export interface ObservabilityAdapter {
|
|
101
|
+
readonly name: string;
|
|
102
|
+
readonly isEnabled: boolean;
|
|
103
|
+
initialize?(): Promise<void>;
|
|
104
|
+
shutdown?(): Promise<void>;
|
|
105
|
+
startTrace(name: string, metadata?: Record<string, unknown>, attribution?: AttributionContext): TraceContext;
|
|
106
|
+
endTrace(traceId: string, status?: SpanStatus): void;
|
|
107
|
+
startSpan(traceId: string, name: string, kind: SpanKind, parentId?: string): SpanContext;
|
|
108
|
+
endSpan(spanId: string, status?: SpanStatus, attributes?: Record<string, unknown>): void;
|
|
109
|
+
addEvent(spanId: string, name: string, attributes?: Record<string, unknown>): void;
|
|
110
|
+
recordError(spanId: string, error: Error): void;
|
|
111
|
+
flush(): Promise<void>;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Observability tool configuration
|
|
115
|
+
*/
|
|
116
|
+
export interface ObservabilityToolConfig {
|
|
117
|
+
name: string;
|
|
118
|
+
apiKey?: string;
|
|
119
|
+
baseUrl?: string;
|
|
120
|
+
projectId?: string;
|
|
121
|
+
environment?: string;
|
|
122
|
+
enabled?: boolean;
|
|
123
|
+
batchSize?: number;
|
|
124
|
+
flushInterval?: number;
|
|
125
|
+
debug?: boolean;
|
|
126
|
+
headers?: Record<string, string>;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Supported observability tools
|
|
130
|
+
*/
|
|
131
|
+
export type ObservabilityToolName = 'langfuse' | 'langsmith' | 'langwatch' | 'arize' | 'axiom' | 'braintrust' | 'helicone' | 'laminar' | 'maxim' | 'patronus' | 'scorecard' | 'signoz' | 'traceloop' | 'weave' | 'console' | 'memory' | 'noop';
|
|
132
|
+
/**
|
|
133
|
+
* Observability tool info
|
|
134
|
+
*/
|
|
135
|
+
export interface ObservabilityToolInfo {
|
|
136
|
+
name: ObservabilityToolName;
|
|
137
|
+
package?: string;
|
|
138
|
+
envKey: string;
|
|
139
|
+
description: string;
|
|
140
|
+
features: {
|
|
141
|
+
traces: boolean;
|
|
142
|
+
spans: boolean;
|
|
143
|
+
events: boolean;
|
|
144
|
+
errors: boolean;
|
|
145
|
+
metrics: boolean;
|
|
146
|
+
export: boolean;
|
|
147
|
+
};
|
|
148
|
+
docsUrl?: string;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* All supported observability tools with their configurations
|
|
152
|
+
*/
|
|
153
|
+
export declare const OBSERVABILITY_TOOLS: Record<ObservabilityToolName, ObservabilityToolInfo>;
|
|
154
|
+
/**
|
|
155
|
+
* Get observability tool info
|
|
156
|
+
*/
|
|
157
|
+
export declare function getObservabilityToolInfo(name: ObservabilityToolName): ObservabilityToolInfo | undefined;
|
|
158
|
+
/**
|
|
159
|
+
* List all observability tools
|
|
160
|
+
*/
|
|
161
|
+
export declare function listObservabilityTools(): ObservabilityToolInfo[];
|
|
162
|
+
/**
|
|
163
|
+
* Check if observability tool has required env var
|
|
164
|
+
*/
|
|
165
|
+
export declare function hasObservabilityToolEnvVar(name: ObservabilityToolName): boolean;
|