shield360 1.0.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/LICENSE +201 -0
- package/README.md +310 -0
- package/dist/__tests__/manual-trace.test.d.ts +1 -0
- package/dist/__tests__/manual-trace.test.js +118 -0
- package/dist/__tests__/manual-trace.test.js.map +1 -0
- package/dist/__tests__/register.test.d.ts +0 -0
- package/dist/__tests__/register.test.js +90 -0
- package/dist/__tests__/register.test.js.map +1 -0
- package/dist/config.d.ts +28 -0
- package/dist/config.js +22 -0
- package/dist/config.js.map +1 -0
- package/dist/constant.d.ts +6 -0
- package/dist/constant.js +14 -0
- package/dist/constant.js.map +1 -0
- package/dist/evals/__tests__/offline.test.d.ts +1 -0
- package/dist/evals/__tests__/offline.test.js +427 -0
- package/dist/evals/__tests__/offline.test.js.map +1 -0
- package/dist/evals/index.d.ts +2 -0
- package/dist/evals/index.js +15 -0
- package/dist/evals/index.js.map +1 -0
- package/dist/evals/offline.d.ts +6 -0
- package/dist/evals/offline.js +350 -0
- package/dist/evals/offline.js.map +1 -0
- package/dist/evals/types.d.ts +74 -0
- package/dist/evals/types.js +23 -0
- package/dist/evals/types.js.map +1 -0
- package/dist/features/__tests__/rule-engine.test.d.ts +1 -0
- package/dist/features/__tests__/rule-engine.test.js +146 -0
- package/dist/features/__tests__/rule-engine.test.js.map +1 -0
- package/dist/features/base.d.ts +8 -0
- package/dist/features/base.js +15 -0
- package/dist/features/base.js.map +1 -0
- package/dist/features/prompt-hub.d.ts +4 -0
- package/dist/features/prompt-hub.js +66 -0
- package/dist/features/prompt-hub.js.map +1 -0
- package/dist/features/rule-engine.d.ts +6 -0
- package/dist/features/rule-engine.js +60 -0
- package/dist/features/rule-engine.js.map +1 -0
- package/dist/features/vault.d.ts +4 -0
- package/dist/features/vault.js +63 -0
- package/dist/features/vault.js.map +1 -0
- package/dist/guard/__tests__/findings.test.d.ts +1 -0
- package/dist/guard/__tests__/findings.test.js +79 -0
- package/dist/guard/__tests__/findings.test.js.map +1 -0
- package/dist/guard/__tests__/integration.test.d.ts +1 -0
- package/dist/guard/__tests__/integration.test.js +215 -0
- package/dist/guard/__tests__/integration.test.js.map +1 -0
- package/dist/guard/__tests__/pii.test.d.ts +1 -0
- package/dist/guard/__tests__/pii.test.js +131 -0
- package/dist/guard/__tests__/pii.test.js.map +1 -0
- package/dist/guard/__tests__/pipeline.test.d.ts +1 -0
- package/dist/guard/__tests__/pipeline.test.js +162 -0
- package/dist/guard/__tests__/pipeline.test.js.map +1 -0
- package/dist/guard/__tests__/prompt-injection.test.d.ts +1 -0
- package/dist/guard/__tests__/prompt-injection.test.js +92 -0
- package/dist/guard/__tests__/prompt-injection.test.js.map +1 -0
- package/dist/guard/__tests__/report.test.d.ts +1 -0
- package/dist/guard/__tests__/report.test.js +50 -0
- package/dist/guard/__tests__/report.test.js.map +1 -0
- package/dist/guard/base.d.ts +79 -0
- package/dist/guard/base.js +136 -0
- package/dist/guard/base.js.map +1 -0
- package/dist/guard/custom.d.ts +19 -0
- package/dist/guard/custom.js +46 -0
- package/dist/guard/custom.js.map +1 -0
- package/dist/guard/findings.d.ts +31 -0
- package/dist/guard/findings.js +156 -0
- package/dist/guard/findings.js.map +1 -0
- package/dist/guard/index.d.ts +24 -0
- package/dist/guard/index.js +42 -0
- package/dist/guard/index.js.map +1 -0
- package/dist/guard/integration.d.ts +44 -0
- package/dist/guard/integration.js +363 -0
- package/dist/guard/integration.js.map +1 -0
- package/dist/guard/moderation.d.ts +18 -0
- package/dist/guard/moderation.js +61 -0
- package/dist/guard/moderation.js.map +1 -0
- package/dist/guard/pii.d.ts +17 -0
- package/dist/guard/pii.js +114 -0
- package/dist/guard/pii.js.map +1 -0
- package/dist/guard/pipeline.d.ts +26 -0
- package/dist/guard/pipeline.js +139 -0
- package/dist/guard/pipeline.js.map +1 -0
- package/dist/guard/prompt-injection.d.ts +21 -0
- package/dist/guard/prompt-injection.js +70 -0
- package/dist/guard/prompt-injection.js.map +1 -0
- package/dist/guard/report.d.ts +34 -0
- package/dist/guard/report.js +182 -0
- package/dist/guard/report.js.map +1 -0
- package/dist/guard/schema.d.ts +20 -0
- package/dist/guard/schema.js +99 -0
- package/dist/guard/schema.js.map +1 -0
- package/dist/guard/sensitive-topic.d.ts +23 -0
- package/dist/guard/sensitive-topic.js +89 -0
- package/dist/guard/sensitive-topic.js.map +1 -0
- package/dist/guard/topic-restriction.d.ts +22 -0
- package/dist/guard/topic-restriction.js +54 -0
- package/dist/guard/topic-restriction.js.map +1 -0
- package/dist/helpers.d.ts +246 -0
- package/dist/helpers.js +903 -0
- package/dist/helpers.js.map +1 -0
- package/dist/index.d.ts +71 -0
- package/dist/index.js +234 -0
- package/dist/index.js.map +1 -0
- package/dist/instrumentation/__tests__/ai21-rag-trace-comparison.test.d.ts +13 -0
- package/dist/instrumentation/__tests__/ai21-rag-trace-comparison.test.js +176 -0
- package/dist/instrumentation/__tests__/ai21-rag-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/ai21-trace-comparison.test.d.ts +10 -0
- package/dist/instrumentation/__tests__/ai21-trace-comparison.test.js +203 -0
- package/dist/instrumentation/__tests__/ai21-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/anthropic-wrapper.test.d.ts +1 -0
- package/dist/instrumentation/__tests__/anthropic-wrapper.test.js +284 -0
- package/dist/instrumentation/__tests__/anthropic-wrapper.test.js.map +1 -0
- package/dist/instrumentation/__tests__/assemblyai-wrapper.test.d.ts +1 -0
- package/dist/instrumentation/__tests__/assemblyai-wrapper.test.js +284 -0
- package/dist/instrumentation/__tests__/assemblyai-wrapper.test.js.map +1 -0
- package/dist/instrumentation/__tests__/astra-trace-comparison.test.d.ts +7 -0
- package/dist/instrumentation/__tests__/astra-trace-comparison.test.js +160 -0
- package/dist/instrumentation/__tests__/astra-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/base-wrapper.test.d.ts +1 -0
- package/dist/instrumentation/__tests__/base-wrapper.test.js +171 -0
- package/dist/instrumentation/__tests__/base-wrapper.test.js.map +1 -0
- package/dist/instrumentation/__tests__/bedrock-trace-comparison.test.d.ts +1 -0
- package/dist/instrumentation/__tests__/bedrock-trace-comparison.test.js +422 -0
- package/dist/instrumentation/__tests__/bedrock-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/browser-use-wrapper.test.d.ts +1 -0
- package/dist/instrumentation/__tests__/browser-use-wrapper.test.js +284 -0
- package/dist/instrumentation/__tests__/browser-use-wrapper.test.js.map +1 -0
- package/dist/instrumentation/__tests__/cache-pricing.test.d.ts +15 -0
- package/dist/instrumentation/__tests__/cache-pricing.test.js +155 -0
- package/dist/instrumentation/__tests__/cache-pricing.test.js.map +1 -0
- package/dist/instrumentation/__tests__/chroma-trace-comparison.test.d.ts +18 -0
- package/dist/instrumentation/__tests__/chroma-trace-comparison.test.js +209 -0
- package/dist/instrumentation/__tests__/chroma-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/cohere-wrapper.test.d.ts +1 -0
- package/dist/instrumentation/__tests__/cohere-wrapper.test.js +256 -0
- package/dist/instrumentation/__tests__/cohere-wrapper.test.js.map +1 -0
- package/dist/instrumentation/__tests__/elevenlabs-wrapper.test.d.ts +1 -0
- package/dist/instrumentation/__tests__/elevenlabs-wrapper.test.js +282 -0
- package/dist/instrumentation/__tests__/elevenlabs-wrapper.test.js.map +1 -0
- package/dist/instrumentation/__tests__/firecrawl-wrapper.test.d.ts +1 -0
- package/dist/instrumentation/__tests__/firecrawl-wrapper.test.js +238 -0
- package/dist/instrumentation/__tests__/firecrawl-wrapper.test.js.map +1 -0
- package/dist/instrumentation/__tests__/google-ai-trace-comparison.test.d.ts +4 -0
- package/dist/instrumentation/__tests__/google-ai-trace-comparison.test.js +229 -0
- package/dist/instrumentation/__tests__/google-ai-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/gpu-collector.test.d.ts +1 -0
- package/dist/instrumentation/__tests__/gpu-collector.test.js +247 -0
- package/dist/instrumentation/__tests__/gpu-collector.test.js.map +1 -0
- package/dist/instrumentation/__tests__/gradient-trace-comparison.test.d.ts +11 -0
- package/dist/instrumentation/__tests__/gradient-trace-comparison.test.js +391 -0
- package/dist/instrumentation/__tests__/gradient-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/groq-trace-comparison.test.d.ts +7 -0
- package/dist/instrumentation/__tests__/groq-trace-comparison.test.js +687 -0
- package/dist/instrumentation/__tests__/groq-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/helpers-genai.test.d.ts +14 -0
- package/dist/instrumentation/__tests__/helpers-genai.test.js +347 -0
- package/dist/instrumentation/__tests__/helpers-genai.test.js.map +1 -0
- package/dist/instrumentation/__tests__/huggingface-trace-comparison.test.d.ts +7 -0
- package/dist/instrumentation/__tests__/huggingface-trace-comparison.test.js +529 -0
- package/dist/instrumentation/__tests__/huggingface-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/langchain-role-map.test.d.ts +1 -0
- package/dist/instrumentation/__tests__/langchain-role-map.test.js +19 -0
- package/dist/instrumentation/__tests__/langchain-role-map.test.js.map +1 -0
- package/dist/instrumentation/__tests__/langchain-wrapper.test.d.ts +1 -0
- package/dist/instrumentation/__tests__/langchain-wrapper.test.js +282 -0
- package/dist/instrumentation/__tests__/langchain-wrapper.test.js.map +1 -0
- package/dist/instrumentation/__tests__/letta-wrapper.test.d.ts +1 -0
- package/dist/instrumentation/__tests__/letta-wrapper.test.js +285 -0
- package/dist/instrumentation/__tests__/letta-wrapper.test.js.map +1 -0
- package/dist/instrumentation/__tests__/mem0-trace-comparison.test.d.ts +13 -0
- package/dist/instrumentation/__tests__/mem0-trace-comparison.test.js +208 -0
- package/dist/instrumentation/__tests__/mem0-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/milvus-trace-comparison.test.d.ts +17 -0
- package/dist/instrumentation/__tests__/milvus-trace-comparison.test.js +206 -0
- package/dist/instrumentation/__tests__/milvus-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/mistral-trace-comparison.test.d.ts +1 -0
- package/dist/instrumentation/__tests__/mistral-trace-comparison.test.js +345 -0
- package/dist/instrumentation/__tests__/mistral-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/openai-wrapper.test.d.ts +1 -0
- package/dist/instrumentation/__tests__/openai-wrapper.test.js +179 -0
- package/dist/instrumentation/__tests__/openai-wrapper.test.js.map +1 -0
- package/dist/instrumentation/__tests__/pg-trace-comparison.test.d.ts +21 -0
- package/dist/instrumentation/__tests__/pg-trace-comparison.test.js +455 -0
- package/dist/instrumentation/__tests__/pg-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/qdrant-trace-comparison.test.d.ts +17 -0
- package/dist/instrumentation/__tests__/qdrant-trace-comparison.test.js +182 -0
- package/dist/instrumentation/__tests__/qdrant-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/replicate-trace-comparison.test.d.ts +8 -0
- package/dist/instrumentation/__tests__/replicate-trace-comparison.test.js +346 -0
- package/dist/instrumentation/__tests__/replicate-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/together-trace-comparison.test.d.ts +4 -0
- package/dist/instrumentation/__tests__/together-trace-comparison.test.js +289 -0
- package/dist/instrumentation/__tests__/together-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/trace-comparison-utils.d.ts +67 -0
- package/dist/instrumentation/__tests__/trace-comparison-utils.js +255 -0
- package/dist/instrumentation/__tests__/trace-comparison-utils.js.map +1 -0
- package/dist/instrumentation/__tests__/transformers-trace-comparison.test.d.ts +11 -0
- package/dist/instrumentation/__tests__/transformers-trace-comparison.test.js +214 -0
- package/dist/instrumentation/__tests__/transformers-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/vercel-ai-trace-comparison.test.d.ts +8 -0
- package/dist/instrumentation/__tests__/vercel-ai-trace-comparison.test.js +446 -0
- package/dist/instrumentation/__tests__/vercel-ai-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/vertexai-trace-comparison.test.d.ts +6 -0
- package/dist/instrumentation/__tests__/vertexai-trace-comparison.test.js +409 -0
- package/dist/instrumentation/__tests__/vertexai-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/__tests__/vllm-trace-comparison.test.d.ts +1 -0
- package/dist/instrumentation/__tests__/vllm-trace-comparison.test.js +519 -0
- package/dist/instrumentation/__tests__/vllm-trace-comparison.test.js.map +1 -0
- package/dist/instrumentation/ai21/index.d.ts +11 -0
- package/dist/instrumentation/ai21/index.js +67 -0
- package/dist/instrumentation/ai21/index.js.map +1 -0
- package/dist/instrumentation/ai21/wrapper.d.ts +54 -0
- package/dist/instrumentation/ai21/wrapper.js +511 -0
- package/dist/instrumentation/ai21/wrapper.js.map +1 -0
- package/dist/instrumentation/anthropic/index.d.ts +11 -0
- package/dist/instrumentation/anthropic/index.js +45 -0
- package/dist/instrumentation/anthropic/index.js.map +1 -0
- package/dist/instrumentation/anthropic/wrapper.d.ts +34 -0
- package/dist/instrumentation/anthropic/wrapper.js +426 -0
- package/dist/instrumentation/anthropic/wrapper.js.map +1 -0
- package/dist/instrumentation/assemblyai/index.d.ts +12 -0
- package/dist/instrumentation/assemblyai/index.js +91 -0
- package/dist/instrumentation/assemblyai/index.js.map +1 -0
- package/dist/instrumentation/assemblyai/wrapper.d.ts +35 -0
- package/dist/instrumentation/assemblyai/wrapper.js +238 -0
- package/dist/instrumentation/assemblyai/wrapper.js.map +1 -0
- package/dist/instrumentation/astra/index.d.ts +11 -0
- package/dist/instrumentation/astra/index.js +87 -0
- package/dist/instrumentation/astra/index.js.map +1 -0
- package/dist/instrumentation/astra/wrapper.d.ts +39 -0
- package/dist/instrumentation/astra/wrapper.js +349 -0
- package/dist/instrumentation/astra/wrapper.js.map +1 -0
- package/dist/instrumentation/azure-ai-inference/index.d.ts +11 -0
- package/dist/instrumentation/azure-ai-inference/index.js +76 -0
- package/dist/instrumentation/azure-ai-inference/index.js.map +1 -0
- package/dist/instrumentation/azure-ai-inference/wrapper.d.ts +55 -0
- package/dist/instrumentation/azure-ai-inference/wrapper.js +580 -0
- package/dist/instrumentation/azure-ai-inference/wrapper.js.map +1 -0
- package/dist/instrumentation/base-wrapper.d.ts +16 -0
- package/dist/instrumentation/base-wrapper.js +139 -0
- package/dist/instrumentation/base-wrapper.js.map +1 -0
- package/dist/instrumentation/bedrock/index.d.ts +11 -0
- package/dist/instrumentation/bedrock/index.js +52 -0
- package/dist/instrumentation/bedrock/index.js.map +1 -0
- package/dist/instrumentation/bedrock/wrapper.d.ts +41 -0
- package/dist/instrumentation/bedrock/wrapper.js +494 -0
- package/dist/instrumentation/bedrock/wrapper.js.map +1 -0
- package/dist/instrumentation/browser-use/index.d.ts +11 -0
- package/dist/instrumentation/browser-use/index.js +98 -0
- package/dist/instrumentation/browser-use/index.js.map +1 -0
- package/dist/instrumentation/browser-use/wrapper.d.ts +12 -0
- package/dist/instrumentation/browser-use/wrapper.js +706 -0
- package/dist/instrumentation/browser-use/wrapper.js.map +1 -0
- package/dist/instrumentation/chroma/index.d.ts +11 -0
- package/dist/instrumentation/chroma/index.js +70 -0
- package/dist/instrumentation/chroma/index.js.map +1 -0
- package/dist/instrumentation/chroma/wrapper.d.ts +10 -0
- package/dist/instrumentation/chroma/wrapper.js +127 -0
- package/dist/instrumentation/chroma/wrapper.js.map +1 -0
- package/dist/instrumentation/claude-agent-sdk/index.d.ts +23 -0
- package/dist/instrumentation/claude-agent-sdk/index.js +83 -0
- package/dist/instrumentation/claude-agent-sdk/index.js.map +1 -0
- package/dist/instrumentation/claude-agent-sdk/wrapper.d.ts +13 -0
- package/dist/instrumentation/claude-agent-sdk/wrapper.js +1123 -0
- package/dist/instrumentation/claude-agent-sdk/wrapper.js.map +1 -0
- package/dist/instrumentation/cohere/index.d.ts +11 -0
- package/dist/instrumentation/cohere/index.js +53 -0
- package/dist/instrumentation/cohere/index.js.map +1 -0
- package/dist/instrumentation/cohere/wrapper.d.ts +50 -0
- package/dist/instrumentation/cohere/wrapper.js +452 -0
- package/dist/instrumentation/cohere/wrapper.js.map +1 -0
- package/dist/instrumentation/cursor-sdk/index.d.ts +21 -0
- package/dist/instrumentation/cursor-sdk/index.js +58 -0
- package/dist/instrumentation/cursor-sdk/index.js.map +1 -0
- package/dist/instrumentation/cursor-sdk/wrapper.d.ts +17 -0
- package/dist/instrumentation/cursor-sdk/wrapper.js +789 -0
- package/dist/instrumentation/cursor-sdk/wrapper.js.map +1 -0
- package/dist/instrumentation/elevenlabs/index.d.ts +12 -0
- package/dist/instrumentation/elevenlabs/index.js +92 -0
- package/dist/instrumentation/elevenlabs/index.js.map +1 -0
- package/dist/instrumentation/elevenlabs/wrapper.d.ts +34 -0
- package/dist/instrumentation/elevenlabs/wrapper.js +280 -0
- package/dist/instrumentation/elevenlabs/wrapper.js.map +1 -0
- package/dist/instrumentation/firecrawl/index.d.ts +13 -0
- package/dist/instrumentation/firecrawl/index.js +115 -0
- package/dist/instrumentation/firecrawl/index.js.map +1 -0
- package/dist/instrumentation/firecrawl/wrapper.d.ts +22 -0
- package/dist/instrumentation/firecrawl/wrapper.js +378 -0
- package/dist/instrumentation/firecrawl/wrapper.js.map +1 -0
- package/dist/instrumentation/google-adk/index.d.ts +57 -0
- package/dist/instrumentation/google-adk/index.js +371 -0
- package/dist/instrumentation/google-adk/index.js.map +1 -0
- package/dist/instrumentation/google-adk/utils.d.ts +45 -0
- package/dist/instrumentation/google-adk/utils.js +663 -0
- package/dist/instrumentation/google-adk/utils.js.map +1 -0
- package/dist/instrumentation/google-adk/wrapper.d.ts +11 -0
- package/dist/instrumentation/google-adk/wrapper.js +391 -0
- package/dist/instrumentation/google-adk/wrapper.js.map +1 -0
- package/dist/instrumentation/google-ai/index.d.ts +11 -0
- package/dist/instrumentation/google-ai/index.js +48 -0
- package/dist/instrumentation/google-ai/index.js.map +1 -0
- package/dist/instrumentation/google-ai/wrapper.d.ts +52 -0
- package/dist/instrumentation/google-ai/wrapper.js +466 -0
- package/dist/instrumentation/google-ai/wrapper.js.map +1 -0
- package/dist/instrumentation/gpu/index.d.ts +38 -0
- package/dist/instrumentation/gpu/index.js +233 -0
- package/dist/instrumentation/gpu/index.js.map +1 -0
- package/dist/instrumentation/gradient/index.d.ts +12 -0
- package/dist/instrumentation/gradient/index.js +74 -0
- package/dist/instrumentation/gradient/index.js.map +1 -0
- package/dist/instrumentation/gradient/utils.d.ts +14 -0
- package/dist/instrumentation/gradient/utils.js +119 -0
- package/dist/instrumentation/gradient/utils.js.map +1 -0
- package/dist/instrumentation/gradient/wrapper.d.ts +76 -0
- package/dist/instrumentation/gradient/wrapper.js +584 -0
- package/dist/instrumentation/gradient/wrapper.js.map +1 -0
- package/dist/instrumentation/groq/index.d.ts +11 -0
- package/dist/instrumentation/groq/index.js +43 -0
- package/dist/instrumentation/groq/index.js.map +1 -0
- package/dist/instrumentation/groq/wrapper.d.ts +35 -0
- package/dist/instrumentation/groq/wrapper.js +442 -0
- package/dist/instrumentation/groq/wrapper.js.map +1 -0
- package/dist/instrumentation/huggingface/index.d.ts +13 -0
- package/dist/instrumentation/huggingface/index.js +110 -0
- package/dist/instrumentation/huggingface/index.js.map +1 -0
- package/dist/instrumentation/huggingface/wrapper.d.ts +54 -0
- package/dist/instrumentation/huggingface/wrapper.js +514 -0
- package/dist/instrumentation/huggingface/wrapper.js.map +1 -0
- package/dist/instrumentation/index.d.ts +7 -0
- package/dist/instrumentation/index.js +176 -0
- package/dist/instrumentation/index.js.map +1 -0
- package/dist/instrumentation/langchain/index.d.ts +16 -0
- package/dist/instrumentation/langchain/index.js +91 -0
- package/dist/instrumentation/langchain/index.js.map +1 -0
- package/dist/instrumentation/langchain/wrapper.d.ts +41 -0
- package/dist/instrumentation/langchain/wrapper.js +1235 -0
- package/dist/instrumentation/langchain/wrapper.js.map +1 -0
- package/dist/instrumentation/langgraph/index.d.ts +12 -0
- package/dist/instrumentation/langgraph/index.js +99 -0
- package/dist/instrumentation/langgraph/index.js.map +1 -0
- package/dist/instrumentation/langgraph/wrapper.d.ts +20 -0
- package/dist/instrumentation/langgraph/wrapper.js +620 -0
- package/dist/instrumentation/langgraph/wrapper.js.map +1 -0
- package/dist/instrumentation/letta/index.d.ts +10 -0
- package/dist/instrumentation/letta/index.js +122 -0
- package/dist/instrumentation/letta/index.js.map +1 -0
- package/dist/instrumentation/letta/utils.d.ts +24 -0
- package/dist/instrumentation/letta/utils.js +343 -0
- package/dist/instrumentation/letta/utils.js.map +1 -0
- package/dist/instrumentation/letta/wrapper.d.ts +37 -0
- package/dist/instrumentation/letta/wrapper.js +180 -0
- package/dist/instrumentation/letta/wrapper.js.map +1 -0
- package/dist/instrumentation/llamaindex/index.d.ts +36 -0
- package/dist/instrumentation/llamaindex/index.js +221 -0
- package/dist/instrumentation/llamaindex/index.js.map +1 -0
- package/dist/instrumentation/llamaindex/wrapper.d.ts +36 -0
- package/dist/instrumentation/llamaindex/wrapper.js +811 -0
- package/dist/instrumentation/llamaindex/wrapper.js.map +1 -0
- package/dist/instrumentation/mcp/index.d.ts +20 -0
- package/dist/instrumentation/mcp/index.js +282 -0
- package/dist/instrumentation/mcp/index.js.map +1 -0
- package/dist/instrumentation/mcp/wrapper.d.ts +72 -0
- package/dist/instrumentation/mcp/wrapper.js +571 -0
- package/dist/instrumentation/mcp/wrapper.js.map +1 -0
- package/dist/instrumentation/mem0/index.d.ts +17 -0
- package/dist/instrumentation/mem0/index.js +113 -0
- package/dist/instrumentation/mem0/index.js.map +1 -0
- package/dist/instrumentation/mem0/wrapper.d.ts +37 -0
- package/dist/instrumentation/mem0/wrapper.js +298 -0
- package/dist/instrumentation/mem0/wrapper.js.map +1 -0
- package/dist/instrumentation/milvus/index.d.ts +11 -0
- package/dist/instrumentation/milvus/index.js +67 -0
- package/dist/instrumentation/milvus/index.js.map +1 -0
- package/dist/instrumentation/milvus/wrapper.d.ts +15 -0
- package/dist/instrumentation/milvus/wrapper.js +219 -0
- package/dist/instrumentation/milvus/wrapper.js.map +1 -0
- package/dist/instrumentation/mistral/index.d.ts +11 -0
- package/dist/instrumentation/mistral/index.js +66 -0
- package/dist/instrumentation/mistral/index.js.map +1 -0
- package/dist/instrumentation/mistral/wrapper.d.ts +49 -0
- package/dist/instrumentation/mistral/wrapper.js +482 -0
- package/dist/instrumentation/mistral/wrapper.js.map +1 -0
- package/dist/instrumentation/ollama/index.d.ts +11 -0
- package/dist/instrumentation/ollama/index.js +72 -0
- package/dist/instrumentation/ollama/index.js.map +1 -0
- package/dist/instrumentation/ollama/wrapper.d.ts +73 -0
- package/dist/instrumentation/ollama/wrapper.js +629 -0
- package/dist/instrumentation/ollama/wrapper.js.map +1 -0
- package/dist/instrumentation/openai/index.d.ts +11 -0
- package/dist/instrumentation/openai/index.js +79 -0
- package/dist/instrumentation/openai/index.js.map +1 -0
- package/dist/instrumentation/openai/wrapper.d.ts +80 -0
- package/dist/instrumentation/openai/wrapper.js +1121 -0
- package/dist/instrumentation/openai/wrapper.js.map +1 -0
- package/dist/instrumentation/openai-agents/index.d.ts +20 -0
- package/dist/instrumentation/openai-agents/index.js +174 -0
- package/dist/instrumentation/openai-agents/index.js.map +1 -0
- package/dist/instrumentation/openai-agents/processor.d.ts +35 -0
- package/dist/instrumentation/openai-agents/processor.js +249 -0
- package/dist/instrumentation/openai-agents/processor.js.map +1 -0
- package/dist/instrumentation/openai-agents/utils.d.ts +20 -0
- package/dist/instrumentation/openai-agents/utils.js +624 -0
- package/dist/instrumentation/openai-agents/utils.js.map +1 -0
- package/dist/instrumentation/pg/index.d.ts +20 -0
- package/dist/instrumentation/pg/index.js +74 -0
- package/dist/instrumentation/pg/index.js.map +1 -0
- package/dist/instrumentation/pg/wrapper.d.ts +66 -0
- package/dist/instrumentation/pg/wrapper.js +441 -0
- package/dist/instrumentation/pg/wrapper.js.map +1 -0
- package/dist/instrumentation/pinecone/index.d.ts +11 -0
- package/dist/instrumentation/pinecone/index.js +79 -0
- package/dist/instrumentation/pinecone/index.js.map +1 -0
- package/dist/instrumentation/pinecone/wrapper.d.ts +14 -0
- package/dist/instrumentation/pinecone/wrapper.js +198 -0
- package/dist/instrumentation/pinecone/wrapper.js.map +1 -0
- package/dist/instrumentation/qdrant/index.d.ts +11 -0
- package/dist/instrumentation/qdrant/index.js +67 -0
- package/dist/instrumentation/qdrant/index.js.map +1 -0
- package/dist/instrumentation/qdrant/wrapper.d.ts +14 -0
- package/dist/instrumentation/qdrant/wrapper.js +213 -0
- package/dist/instrumentation/qdrant/wrapper.js.map +1 -0
- package/dist/instrumentation/replicate/index.d.ts +11 -0
- package/dist/instrumentation/replicate/index.js +57 -0
- package/dist/instrumentation/replicate/index.js.map +1 -0
- package/dist/instrumentation/replicate/wrapper.d.ts +28 -0
- package/dist/instrumentation/replicate/wrapper.js +242 -0
- package/dist/instrumentation/replicate/wrapper.js.map +1 -0
- package/dist/instrumentation/strands/index.d.ts +21 -0
- package/dist/instrumentation/strands/index.js +83 -0
- package/dist/instrumentation/strands/index.js.map +1 -0
- package/dist/instrumentation/strands/processor.d.ts +51 -0
- package/dist/instrumentation/strands/processor.js +625 -0
- package/dist/instrumentation/strands/processor.js.map +1 -0
- package/dist/instrumentation/strands/utils.d.ts +24 -0
- package/dist/instrumentation/strands/utils.js +373 -0
- package/dist/instrumentation/strands/utils.js.map +1 -0
- package/dist/instrumentation/together/index.d.ts +11 -0
- package/dist/instrumentation/together/index.js +43 -0
- package/dist/instrumentation/together/index.js.map +1 -0
- package/dist/instrumentation/together/wrapper.d.ts +48 -0
- package/dist/instrumentation/together/wrapper.js +409 -0
- package/dist/instrumentation/together/wrapper.js.map +1 -0
- package/dist/instrumentation/transformers/index.d.ts +35 -0
- package/dist/instrumentation/transformers/index.js +119 -0
- package/dist/instrumentation/transformers/index.js.map +1 -0
- package/dist/instrumentation/transformers/wrapper.d.ts +49 -0
- package/dist/instrumentation/transformers/wrapper.js +472 -0
- package/dist/instrumentation/transformers/wrapper.js.map +1 -0
- package/dist/instrumentation/vercel-ai/index.d.ts +10 -0
- package/dist/instrumentation/vercel-ai/index.js +59 -0
- package/dist/instrumentation/vercel-ai/index.js.map +1 -0
- package/dist/instrumentation/vercel-ai/wrapper.d.ts +50 -0
- package/dist/instrumentation/vercel-ai/wrapper.js +539 -0
- package/dist/instrumentation/vercel-ai/wrapper.js.map +1 -0
- package/dist/instrumentation/vertexai/index.d.ts +11 -0
- package/dist/instrumentation/vertexai/index.js +70 -0
- package/dist/instrumentation/vertexai/index.js.map +1 -0
- package/dist/instrumentation/vertexai/wrapper.d.ts +67 -0
- package/dist/instrumentation/vertexai/wrapper.js +530 -0
- package/dist/instrumentation/vertexai/wrapper.js.map +1 -0
- package/dist/instrumentation/vllm/index.d.ts +13 -0
- package/dist/instrumentation/vllm/index.js +67 -0
- package/dist/instrumentation/vllm/index.js.map +1 -0
- package/dist/instrumentation/vllm/wrapper.d.ts +60 -0
- package/dist/instrumentation/vllm/wrapper.js +482 -0
- package/dist/instrumentation/vllm/wrapper.js.map +1 -0
- package/dist/llm/anthropic.d.ts +5 -0
- package/dist/llm/anthropic.js +39 -0
- package/dist/llm/anthropic.js.map +1 -0
- package/dist/llm/index.d.ts +10 -0
- package/dist/llm/index.js +93 -0
- package/dist/llm/index.js.map +1 -0
- package/dist/llm/openai.d.ts +6 -0
- package/dist/llm/openai.js +52 -0
- package/dist/llm/openai.js.map +1 -0
- package/dist/llm/providers.d.ts +7 -0
- package/dist/llm/providers.js +10 -0
- package/dist/llm/providers.js.map +1 -0
- package/dist/manual-trace.d.ts +40 -0
- package/dist/manual-trace.js +103 -0
- package/dist/manual-trace.js.map +1 -0
- package/dist/otel/__tests__/metrics.test.d.ts +1 -0
- package/dist/otel/__tests__/metrics.test.js +40 -0
- package/dist/otel/__tests__/metrics.test.js.map +1 -0
- package/dist/otel/events.d.ts +11 -0
- package/dist/otel/events.js +74 -0
- package/dist/otel/events.js.map +1 -0
- package/dist/otel/metrics.d.ts +35 -0
- package/dist/otel/metrics.js +219 -0
- package/dist/otel/metrics.js.map +1 -0
- package/dist/otel/tracing.d.ts +12 -0
- package/dist/otel/tracing.js +93 -0
- package/dist/otel/tracing.js.map +1 -0
- package/dist/otel/utils.d.ts +11 -0
- package/dist/otel/utils.js +34 -0
- package/dist/otel/utils.js.map +1 -0
- package/dist/pricing.json +951 -0
- package/dist/prompt-hub.d.ts +4 -0
- package/dist/prompt-hub.js +66 -0
- package/dist/prompt-hub.js.map +1 -0
- package/dist/register.d.ts +4 -0
- package/dist/register.js +52 -0
- package/dist/register.js.map +1 -0
- package/dist/score/__tests__/score.test.d.ts +1 -0
- package/dist/score/__tests__/score.test.js +143 -0
- package/dist/score/__tests__/score.test.js.map +1 -0
- package/dist/score/index.d.ts +2 -0
- package/dist/score/index.js +6 -0
- package/dist/score/index.js.map +1 -0
- package/dist/score/score.d.ts +15 -0
- package/dist/score/score.js +135 -0
- package/dist/score/score.js.map +1 -0
- package/dist/semantic-convention.d.ts +555 -0
- package/dist/semantic-convention.js +630 -0
- package/dist/semantic-convention.js.map +1 -0
- package/dist/types.d.ts +131 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/package.json +136 -0
|
@@ -0,0 +1,452 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
const api_1 = require("@opentelemetry/api");
|
|
40
|
+
const config_1 = __importDefault(require("../../config"));
|
|
41
|
+
const helpers_1 = __importStar(require("../../helpers"));
|
|
42
|
+
const semantic_convention_1 = __importDefault(require("../../semantic-convention"));
|
|
43
|
+
const base_wrapper_1 = __importDefault(require("../base-wrapper"));
|
|
44
|
+
function spanCreationAttrs(operationName, requestModel) {
|
|
45
|
+
return {
|
|
46
|
+
[semantic_convention_1.default.GEN_AI_OPERATION]: operationName,
|
|
47
|
+
[semantic_convention_1.default.GEN_AI_PROVIDER_NAME_OTEL]: semantic_convention_1.default.GEN_AI_SYSTEM_COHERE,
|
|
48
|
+
[semantic_convention_1.default.GEN_AI_REQUEST_MODEL]: requestModel,
|
|
49
|
+
[semantic_convention_1.default.SERVER_ADDRESS]: CohereWrapper.serverAddress,
|
|
50
|
+
[semantic_convention_1.default.SERVER_PORT]: CohereWrapper.serverPort,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
class CohereWrapper extends base_wrapper_1.default {
|
|
54
|
+
/**
|
|
55
|
+
* Stamp `shield360.agent.version_hash` (auto) and `gen_ai.agent.version`
|
|
56
|
+
* (user override, if set) on the span and return the same attributes so
|
|
57
|
+
* the caller can merge them into the inference event extras.
|
|
58
|
+
*/
|
|
59
|
+
static _stampAgentVersion(span, args) {
|
|
60
|
+
const out = {};
|
|
61
|
+
try {
|
|
62
|
+
const versionHash = helpers_1.default.computeAgentVersionHash({
|
|
63
|
+
systemInstructions: args.systemInstructionsJson ?? null,
|
|
64
|
+
toolDefinitions: args.toolDefinitionsJson ?? null,
|
|
65
|
+
primaryModel: args.primaryModel ?? null,
|
|
66
|
+
runtimeConfig: {
|
|
67
|
+
temperature: args.temperature ?? null,
|
|
68
|
+
top_p: args.top_p ?? null,
|
|
69
|
+
max_tokens: args.max_tokens ?? null,
|
|
70
|
+
provider: semantic_convention_1.default.GEN_AI_SYSTEM_COHERE,
|
|
71
|
+
},
|
|
72
|
+
providers: [semantic_convention_1.default.GEN_AI_SYSTEM_COHERE],
|
|
73
|
+
});
|
|
74
|
+
if (versionHash) {
|
|
75
|
+
out[semantic_convention_1.default.SHIELD360_AGENT_VERSION_HASH] = versionHash;
|
|
76
|
+
span.setAttribute(semantic_convention_1.default.SHIELD360_AGENT_VERSION_HASH, versionHash);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
// Hash computation must never fail the wrapped call.
|
|
81
|
+
}
|
|
82
|
+
const versionLabel = (0, helpers_1.getCurrentAgentVersion)();
|
|
83
|
+
if (versionLabel) {
|
|
84
|
+
out[semantic_convention_1.default.GEN_AI_AGENT_VERSION] = versionLabel;
|
|
85
|
+
span.setAttribute(semantic_convention_1.default.GEN_AI_AGENT_VERSION, versionLabel);
|
|
86
|
+
}
|
|
87
|
+
return out;
|
|
88
|
+
}
|
|
89
|
+
static _patchEmbed(tracer) {
|
|
90
|
+
const genAIEndpoint = 'cohere.embed';
|
|
91
|
+
return (originalMethod) => {
|
|
92
|
+
return async function (...args) {
|
|
93
|
+
if ((0, helpers_1.isFrameworkLlmActive)())
|
|
94
|
+
return originalMethod.apply(this, args);
|
|
95
|
+
const requestModel = args[0]?.model || 'embed-english-v2.0';
|
|
96
|
+
const spanName = `${semantic_convention_1.default.GEN_AI_OPERATION_TYPE_EMBEDDING} ${requestModel}`;
|
|
97
|
+
const effectiveCtx = (0, helpers_1.getFrameworkParentContext)() ?? api_1.context.active();
|
|
98
|
+
const span = tracer.startSpan(spanName, {
|
|
99
|
+
kind: api_1.SpanKind.CLIENT,
|
|
100
|
+
attributes: spanCreationAttrs(semantic_convention_1.default.GEN_AI_OPERATION_TYPE_EMBEDDING, requestModel),
|
|
101
|
+
}, effectiveCtx);
|
|
102
|
+
return api_1.context.with(api_1.trace.setSpan(effectiveCtx, span), async () => {
|
|
103
|
+
const captureContent = config_1.default.captureMessageContent;
|
|
104
|
+
let metricParams;
|
|
105
|
+
try {
|
|
106
|
+
const response = await originalMethod.apply(this, args);
|
|
107
|
+
const _responseModel = response.model || requestModel;
|
|
108
|
+
const pricingInfo = config_1.default.pricingInfo || {};
|
|
109
|
+
const inputTokens = response.meta?.billedUnits?.inputTokens || 0;
|
|
110
|
+
const cost = helpers_1.default.getEmbedModelCost(requestModel, pricingInfo, inputTokens);
|
|
111
|
+
const { dimensions, encoding_format = 'float', texts = [], user } = args[0];
|
|
112
|
+
CohereWrapper.setBaseSpanAttributes(span, {
|
|
113
|
+
genAIEndpoint,
|
|
114
|
+
model: requestModel,
|
|
115
|
+
user,
|
|
116
|
+
cost,
|
|
117
|
+
aiSystem: CohereWrapper.aiSystem,
|
|
118
|
+
serverAddress: CohereWrapper.serverAddress,
|
|
119
|
+
serverPort: CohereWrapper.serverPort,
|
|
120
|
+
});
|
|
121
|
+
span.setAttribute(semantic_convention_1.default.GEN_AI_REQUEST_IS_STREAM, false);
|
|
122
|
+
span.setAttribute(semantic_convention_1.default.GEN_AI_REQUEST_ENCODING_FORMATS, [encoding_format]);
|
|
123
|
+
if (dimensions) {
|
|
124
|
+
span.setAttribute(semantic_convention_1.default.GEN_AI_EMBEDDINGS_DIMENSION_COUNT, dimensions);
|
|
125
|
+
}
|
|
126
|
+
if (captureContent) {
|
|
127
|
+
span.setAttribute(semantic_convention_1.default.GEN_AI_INPUT_MESSAGES, JSON.stringify(texts));
|
|
128
|
+
}
|
|
129
|
+
span.setAttribute(semantic_convention_1.default.GEN_AI_RESPONSE_ID, response.id);
|
|
130
|
+
span.setAttribute(semantic_convention_1.default.GEN_AI_USAGE_INPUT_TOKENS, inputTokens);
|
|
131
|
+
metricParams = {
|
|
132
|
+
genAIEndpoint,
|
|
133
|
+
model: requestModel,
|
|
134
|
+
user,
|
|
135
|
+
cost,
|
|
136
|
+
aiSystem: CohereWrapper.aiSystem,
|
|
137
|
+
};
|
|
138
|
+
return response;
|
|
139
|
+
}
|
|
140
|
+
catch (e) {
|
|
141
|
+
helpers_1.default.handleException(span, e);
|
|
142
|
+
throw e;
|
|
143
|
+
}
|
|
144
|
+
finally {
|
|
145
|
+
span.end();
|
|
146
|
+
if (metricParams) {
|
|
147
|
+
base_wrapper_1.default.recordMetrics(span, metricParams);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
};
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
static _patchChat(tracer) {
|
|
155
|
+
const genAIEndpoint = 'cohere.chat';
|
|
156
|
+
return (originalMethod) => {
|
|
157
|
+
return async function (...args) {
|
|
158
|
+
if ((0, helpers_1.isFrameworkLlmActive)())
|
|
159
|
+
return originalMethod.apply(this, args);
|
|
160
|
+
const requestModel = args[0]?.model || 'command-r-plus-08-2024';
|
|
161
|
+
const spanName = `${semantic_convention_1.default.GEN_AI_OPERATION_TYPE_CHAT} ${requestModel}`;
|
|
162
|
+
const effectiveCtx = (0, helpers_1.getFrameworkParentContext)() ?? api_1.context.active();
|
|
163
|
+
const span = tracer.startSpan(spanName, {
|
|
164
|
+
kind: api_1.SpanKind.CLIENT,
|
|
165
|
+
attributes: spanCreationAttrs(semantic_convention_1.default.GEN_AI_OPERATION_TYPE_CHAT, requestModel),
|
|
166
|
+
}, effectiveCtx);
|
|
167
|
+
return api_1.context
|
|
168
|
+
.with(api_1.trace.setSpan(effectiveCtx, span), async () => {
|
|
169
|
+
return originalMethod.apply(this, args);
|
|
170
|
+
})
|
|
171
|
+
.then((response) => {
|
|
172
|
+
return CohereWrapper._chat({ args, genAIEndpoint, response, span });
|
|
173
|
+
})
|
|
174
|
+
.catch((e) => {
|
|
175
|
+
helpers_1.default.handleException(span, e);
|
|
176
|
+
base_wrapper_1.default.recordMetrics(span, {
|
|
177
|
+
genAIEndpoint,
|
|
178
|
+
model: requestModel,
|
|
179
|
+
aiSystem: CohereWrapper.aiSystem,
|
|
180
|
+
serverAddress: CohereWrapper.serverAddress,
|
|
181
|
+
serverPort: CohereWrapper.serverPort,
|
|
182
|
+
errorType: e?.constructor?.name || '_OTHER',
|
|
183
|
+
});
|
|
184
|
+
span.end();
|
|
185
|
+
throw e;
|
|
186
|
+
});
|
|
187
|
+
};
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
static _patchChatStream(tracer) {
|
|
191
|
+
const genAIEndpoint = 'cohere.chat';
|
|
192
|
+
return (originalMethod) => {
|
|
193
|
+
return async function (...args) {
|
|
194
|
+
if ((0, helpers_1.isFrameworkLlmActive)())
|
|
195
|
+
return originalMethod.apply(this, args);
|
|
196
|
+
const requestModel = args[0]?.model || 'command-r-plus-08-2024';
|
|
197
|
+
const spanName = `${semantic_convention_1.default.GEN_AI_OPERATION_TYPE_CHAT} ${requestModel}`;
|
|
198
|
+
const effectiveCtx = (0, helpers_1.getFrameworkParentContext)() ?? api_1.context.active();
|
|
199
|
+
const span = tracer.startSpan(spanName, {
|
|
200
|
+
kind: api_1.SpanKind.CLIENT,
|
|
201
|
+
attributes: spanCreationAttrs(semantic_convention_1.default.GEN_AI_OPERATION_TYPE_CHAT, requestModel),
|
|
202
|
+
}, effectiveCtx);
|
|
203
|
+
return api_1.context
|
|
204
|
+
.with(api_1.trace.setSpan(effectiveCtx, span), async () => {
|
|
205
|
+
return originalMethod.apply(this, args);
|
|
206
|
+
})
|
|
207
|
+
.then((response) => {
|
|
208
|
+
return helpers_1.default.createStreamProxy(response, CohereWrapper._chatGenerator({
|
|
209
|
+
args,
|
|
210
|
+
genAIEndpoint,
|
|
211
|
+
response,
|
|
212
|
+
span,
|
|
213
|
+
}));
|
|
214
|
+
})
|
|
215
|
+
.catch((e) => {
|
|
216
|
+
helpers_1.default.handleException(span, e);
|
|
217
|
+
base_wrapper_1.default.recordMetrics(span, {
|
|
218
|
+
genAIEndpoint,
|
|
219
|
+
model: requestModel,
|
|
220
|
+
aiSystem: CohereWrapper.aiSystem,
|
|
221
|
+
serverAddress: CohereWrapper.serverAddress,
|
|
222
|
+
serverPort: CohereWrapper.serverPort,
|
|
223
|
+
errorType: e?.constructor?.name || '_OTHER',
|
|
224
|
+
});
|
|
225
|
+
span.end();
|
|
226
|
+
throw e;
|
|
227
|
+
});
|
|
228
|
+
};
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
static async _chat({ args, genAIEndpoint, response, span, }) {
|
|
232
|
+
let metricParams;
|
|
233
|
+
try {
|
|
234
|
+
metricParams = await CohereWrapper._chatCommonSetter({
|
|
235
|
+
args,
|
|
236
|
+
genAIEndpoint,
|
|
237
|
+
result: response,
|
|
238
|
+
span,
|
|
239
|
+
});
|
|
240
|
+
return response;
|
|
241
|
+
}
|
|
242
|
+
catch (e) {
|
|
243
|
+
helpers_1.default.handleException(span, e);
|
|
244
|
+
throw e;
|
|
245
|
+
}
|
|
246
|
+
finally {
|
|
247
|
+
span.end();
|
|
248
|
+
if (metricParams) {
|
|
249
|
+
base_wrapper_1.default.recordMetrics(span, metricParams);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
static async *_chatGenerator({ args, genAIEndpoint, response, span, }) {
|
|
254
|
+
let metricParams;
|
|
255
|
+
const timestamps = [];
|
|
256
|
+
const startTime = Date.now();
|
|
257
|
+
try {
|
|
258
|
+
let result = {
|
|
259
|
+
response_id: '',
|
|
260
|
+
text: '',
|
|
261
|
+
generationId: '',
|
|
262
|
+
chatHistory: [],
|
|
263
|
+
finishReason: '',
|
|
264
|
+
meta: {
|
|
265
|
+
apiVersion: { version: '1' },
|
|
266
|
+
billedUnits: { inputTokens: 0, outputTokens: 0 },
|
|
267
|
+
},
|
|
268
|
+
};
|
|
269
|
+
for await (const chunk of response) {
|
|
270
|
+
timestamps.push(Date.now());
|
|
271
|
+
if (chunk.eventType === 'stream-end') {
|
|
272
|
+
result = chunk.response;
|
|
273
|
+
}
|
|
274
|
+
yield chunk;
|
|
275
|
+
}
|
|
276
|
+
const ttft = timestamps.length > 0 ? (timestamps[0] - startTime) / 1000 : 0;
|
|
277
|
+
let tbt = 0;
|
|
278
|
+
if (timestamps.length > 1) {
|
|
279
|
+
const timeDiffs = timestamps.slice(1).map((t, i) => t - timestamps[i]);
|
|
280
|
+
tbt = timeDiffs.reduce((a, b) => a + b, 0) / timeDiffs.length / 1000;
|
|
281
|
+
}
|
|
282
|
+
metricParams = await CohereWrapper._chatCommonSetter({
|
|
283
|
+
args,
|
|
284
|
+
genAIEndpoint,
|
|
285
|
+
result,
|
|
286
|
+
span,
|
|
287
|
+
stream: true,
|
|
288
|
+
ttft,
|
|
289
|
+
tbt,
|
|
290
|
+
});
|
|
291
|
+
return result;
|
|
292
|
+
}
|
|
293
|
+
catch (e) {
|
|
294
|
+
helpers_1.default.handleException(span, e);
|
|
295
|
+
throw e;
|
|
296
|
+
}
|
|
297
|
+
finally {
|
|
298
|
+
span.end();
|
|
299
|
+
if (metricParams) {
|
|
300
|
+
base_wrapper_1.default.recordMetrics(span, metricParams);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
static async _chatCommonSetter({ args, genAIEndpoint, result, span, stream = false, ttft = 0, tbt = 0, }) {
|
|
305
|
+
const captureContent = config_1.default.captureMessageContent;
|
|
306
|
+
const requestModel = args[0]?.model || 'command-r-plus-08-2024';
|
|
307
|
+
const { message, messages, frequency_penalty = 0, max_tokens = null, presence_penalty = 0, seed = null, stop_sequences = null, temperature = 1, p: topP, k: topK, user, tools: _tools, } = args[0];
|
|
308
|
+
span.setAttribute(semantic_convention_1.default.GEN_AI_REQUEST_TOP_P, topP ?? 1);
|
|
309
|
+
if (topK != null) {
|
|
310
|
+
span.setAttribute(semantic_convention_1.default.GEN_AI_REQUEST_TOP_K, topK);
|
|
311
|
+
}
|
|
312
|
+
if (max_tokens != null) {
|
|
313
|
+
span.setAttribute(semantic_convention_1.default.GEN_AI_REQUEST_MAX_TOKENS, max_tokens);
|
|
314
|
+
}
|
|
315
|
+
span.setAttribute(semantic_convention_1.default.GEN_AI_REQUEST_TEMPERATURE, temperature);
|
|
316
|
+
if (presence_penalty) {
|
|
317
|
+
span.setAttribute(semantic_convention_1.default.GEN_AI_REQUEST_PRESENCE_PENALTY, presence_penalty);
|
|
318
|
+
}
|
|
319
|
+
if (frequency_penalty) {
|
|
320
|
+
span.setAttribute(semantic_convention_1.default.GEN_AI_REQUEST_FREQUENCY_PENALTY, frequency_penalty);
|
|
321
|
+
}
|
|
322
|
+
if (seed != null) {
|
|
323
|
+
span.setAttribute(semantic_convention_1.default.GEN_AI_REQUEST_SEED, Number(seed));
|
|
324
|
+
}
|
|
325
|
+
span.setAttribute(semantic_convention_1.default.GEN_AI_REQUEST_IS_STREAM, stream);
|
|
326
|
+
if (stop_sequences) {
|
|
327
|
+
span.setAttribute(semantic_convention_1.default.GEN_AI_REQUEST_STOP_SEQUENCES, Array.isArray(stop_sequences) ? stop_sequences : [stop_sequences]);
|
|
328
|
+
}
|
|
329
|
+
const inputMessages = messages || (message ? [{ role: 'user', content: message }] : []);
|
|
330
|
+
if (captureContent) {
|
|
331
|
+
span.setAttribute(semantic_convention_1.default.GEN_AI_INPUT_MESSAGES, helpers_1.default.buildInputMessages(inputMessages));
|
|
332
|
+
}
|
|
333
|
+
const responseId = result.response_id || result.id || '';
|
|
334
|
+
span.setAttribute(semantic_convention_1.default.GEN_AI_RESPONSE_ID, responseId);
|
|
335
|
+
const pricingInfo = config_1.default.pricingInfo || {};
|
|
336
|
+
const inputTokens = result.meta?.billedUnits?.inputTokens
|
|
337
|
+
?? result.usage?.billed_units?.input_tokens ?? 0;
|
|
338
|
+
const outputTokens = result.meta?.billedUnits?.outputTokens
|
|
339
|
+
?? result.usage?.billed_units?.output_tokens ?? 0;
|
|
340
|
+
const cost = helpers_1.default.getChatModelCost(requestModel, pricingInfo, inputTokens, outputTokens);
|
|
341
|
+
CohereWrapper.setBaseSpanAttributes(span, {
|
|
342
|
+
genAIEndpoint,
|
|
343
|
+
model: requestModel,
|
|
344
|
+
user,
|
|
345
|
+
cost,
|
|
346
|
+
aiSystem: CohereWrapper.aiSystem,
|
|
347
|
+
serverAddress: CohereWrapper.serverAddress,
|
|
348
|
+
serverPort: CohereWrapper.serverPort,
|
|
349
|
+
});
|
|
350
|
+
span.setAttribute(semantic_convention_1.default.GEN_AI_RESPONSE_MODEL, requestModel);
|
|
351
|
+
span.setAttribute(semantic_convention_1.default.GEN_AI_USAGE_INPUT_TOKENS, inputTokens);
|
|
352
|
+
span.setAttribute(semantic_convention_1.default.GEN_AI_USAGE_OUTPUT_TOKENS, outputTokens);
|
|
353
|
+
if (ttft > 0) {
|
|
354
|
+
span.setAttribute(semantic_convention_1.default.GEN_AI_SERVER_TTFT, ttft);
|
|
355
|
+
}
|
|
356
|
+
if (tbt > 0) {
|
|
357
|
+
span.setAttribute(semantic_convention_1.default.GEN_AI_SERVER_TBT, tbt);
|
|
358
|
+
}
|
|
359
|
+
const finishReason = result.finishReason || result.finish_reason || '';
|
|
360
|
+
if (finishReason) {
|
|
361
|
+
span.setAttribute(semantic_convention_1.default.GEN_AI_RESPONSE_FINISH_REASON, [finishReason]);
|
|
362
|
+
}
|
|
363
|
+
const responseText = result.text ?? '';
|
|
364
|
+
const outputType = typeof responseText === 'string'
|
|
365
|
+
? semantic_convention_1.default.GEN_AI_OUTPUT_TYPE_TEXT
|
|
366
|
+
: semantic_convention_1.default.GEN_AI_OUTPUT_TYPE_JSON;
|
|
367
|
+
span.setAttribute(semantic_convention_1.default.GEN_AI_OUTPUT_TYPE, outputType);
|
|
368
|
+
const toolCalls = result.toolCalls || result.message?.tool_calls;
|
|
369
|
+
if (toolCalls && Array.isArray(toolCalls)) {
|
|
370
|
+
const toolNames = toolCalls.map((t) => t.function?.name || t.name || '').filter(Boolean);
|
|
371
|
+
const toolIds = toolCalls.map((t) => t.id || '').filter(Boolean);
|
|
372
|
+
const toolArgs = toolCalls.map((t) => t.function?.arguments || t.arguments || '').filter(Boolean);
|
|
373
|
+
if (toolNames.length > 0) {
|
|
374
|
+
span.setAttribute(semantic_convention_1.default.GEN_AI_TOOL_NAME, toolNames.join(', '));
|
|
375
|
+
}
|
|
376
|
+
if (toolIds.length > 0) {
|
|
377
|
+
span.setAttribute(semantic_convention_1.default.GEN_AI_TOOL_CALL_ID, toolIds.join(', '));
|
|
378
|
+
}
|
|
379
|
+
if (toolArgs.length > 0) {
|
|
380
|
+
span.setAttribute(semantic_convention_1.default.GEN_AI_TOOL_ARGS, toolArgs.join(', '));
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
const toolPlan = result.toolPlan || result.message?.tool_plan;
|
|
384
|
+
if (toolPlan) {
|
|
385
|
+
span.setAttribute(semantic_convention_1.default.GEN_AI_CONTENT_REASONING, toolPlan);
|
|
386
|
+
}
|
|
387
|
+
let inputMessagesJson;
|
|
388
|
+
let outputMessagesJson;
|
|
389
|
+
const toolDefinitionsJson = helpers_1.default.buildToolDefinitions(_tools);
|
|
390
|
+
// Compute system_instructions and version hash regardless of
|
|
391
|
+
// captureContent so versions still group correctly when content
|
|
392
|
+
// capture is disabled.
|
|
393
|
+
const systemInstructionsJson = helpers_1.default.buildSystemInstructionsFromMessages(inputMessages);
|
|
394
|
+
const versionExtras = CohereWrapper._stampAgentVersion(span, {
|
|
395
|
+
systemInstructionsJson,
|
|
396
|
+
toolDefinitionsJson,
|
|
397
|
+
primaryModel: requestModel,
|
|
398
|
+
temperature,
|
|
399
|
+
top_p: topP,
|
|
400
|
+
max_tokens,
|
|
401
|
+
});
|
|
402
|
+
if (captureContent) {
|
|
403
|
+
outputMessagesJson = helpers_1.default.buildOutputMessages(responseText, finishReason || 'stop', toolCalls);
|
|
404
|
+
span.setAttribute(semantic_convention_1.default.GEN_AI_OUTPUT_MESSAGES, outputMessagesJson);
|
|
405
|
+
inputMessagesJson = helpers_1.default.buildInputMessages(inputMessages);
|
|
406
|
+
if (systemInstructionsJson) {
|
|
407
|
+
span.setAttribute(semantic_convention_1.default.GEN_AI_SYSTEM_INSTRUCTIONS, systemInstructionsJson);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
if (toolDefinitionsJson) {
|
|
411
|
+
span.setAttribute(semantic_convention_1.default.GEN_AI_TOOL_DEFINITIONS, toolDefinitionsJson);
|
|
412
|
+
}
|
|
413
|
+
if (!config_1.default.disableEvents) {
|
|
414
|
+
const eventAttrs = {
|
|
415
|
+
[semantic_convention_1.default.GEN_AI_OPERATION]: semantic_convention_1.default.GEN_AI_OPERATION_TYPE_CHAT,
|
|
416
|
+
[semantic_convention_1.default.GEN_AI_REQUEST_MODEL]: requestModel,
|
|
417
|
+
[semantic_convention_1.default.GEN_AI_RESPONSE_MODEL]: requestModel,
|
|
418
|
+
[semantic_convention_1.default.SERVER_ADDRESS]: CohereWrapper.serverAddress,
|
|
419
|
+
[semantic_convention_1.default.SERVER_PORT]: CohereWrapper.serverPort,
|
|
420
|
+
[semantic_convention_1.default.GEN_AI_RESPONSE_ID]: responseId,
|
|
421
|
+
[semantic_convention_1.default.GEN_AI_RESPONSE_FINISH_REASON]: [finishReason || 'stop'],
|
|
422
|
+
[semantic_convention_1.default.GEN_AI_OUTPUT_TYPE]: outputType,
|
|
423
|
+
[semantic_convention_1.default.GEN_AI_USAGE_INPUT_TOKENS]: inputTokens,
|
|
424
|
+
[semantic_convention_1.default.GEN_AI_USAGE_OUTPUT_TOKENS]: outputTokens,
|
|
425
|
+
...versionExtras,
|
|
426
|
+
};
|
|
427
|
+
if (captureContent) {
|
|
428
|
+
if (inputMessagesJson)
|
|
429
|
+
eventAttrs[semantic_convention_1.default.GEN_AI_INPUT_MESSAGES] = inputMessagesJson;
|
|
430
|
+
if (outputMessagesJson)
|
|
431
|
+
eventAttrs[semantic_convention_1.default.GEN_AI_OUTPUT_MESSAGES] = outputMessagesJson;
|
|
432
|
+
if (systemInstructionsJson)
|
|
433
|
+
eventAttrs[semantic_convention_1.default.GEN_AI_SYSTEM_INSTRUCTIONS] = systemInstructionsJson;
|
|
434
|
+
}
|
|
435
|
+
if (toolDefinitionsJson)
|
|
436
|
+
eventAttrs[semantic_convention_1.default.GEN_AI_TOOL_DEFINITIONS] = toolDefinitionsJson;
|
|
437
|
+
helpers_1.default.emitInferenceEvent(span, eventAttrs);
|
|
438
|
+
}
|
|
439
|
+
return {
|
|
440
|
+
genAIEndpoint,
|
|
441
|
+
model: requestModel,
|
|
442
|
+
user,
|
|
443
|
+
cost,
|
|
444
|
+
aiSystem: CohereWrapper.aiSystem,
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
CohereWrapper.aiSystem = semantic_convention_1.default.GEN_AI_SYSTEM_COHERE;
|
|
449
|
+
CohereWrapper.serverAddress = 'api.cohere.com';
|
|
450
|
+
CohereWrapper.serverPort = 443;
|
|
451
|
+
exports.default = CohereWrapper;
|
|
452
|
+
//# sourceMappingURL=wrapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrapper.js","sourceRoot":"","sources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,IAAI,iBAAiB;oBAAE,UAAU,CAAC,6BAAkB,CAAC,qBAAqB,CAAC,GAAG,iBAAiB,CAAC;gBAChG,IAAI,kBAAkB;oBAAE,UAAU,CAAC,6BAAkB,CAAC,sBAAsB,CAAC,GAAG,kBAAkB,CAAC;gBACnG,IAAI,sBAAsB;oBAAE,UAAU,CAAC,6BAAkB,CAAC,0BAA0B,CAAC,GAAG,sBAAsB,CAAC;YACjH,CAAC;YACD,IAAI,mBAAmB;gBAAE,UAAU,CAAC,6BAAkB,CAAC,uBAAuB,CAAC,GAAG,mBAAmB,CAAC;YACtG,iBAAe,CAAC,kBAAkB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QACvD,CAAC;QAED,OAAO;YACL,aAAa;YACb,KAAK,EAAE,YAAY;YACnB,IAAI;YACJ,IAAI;YACJ,QAAQ,EAAE,aAAa,CAAC,QAAQ;SACjC,CAAC;IACJ,CAAC;;AAnfM,sBAAQ,GAAG,6BAAkB,CAAC,oBAAoB,CAAC;AACnD,2BAAa,GAAG,gBAAgB,CAAC;AACjC,wBAAU,GAAG,GAAG,CAAC;kBAHL,aAAa"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shield360 Cursor SDK Instrumentation
|
|
3
|
+
*
|
|
4
|
+
* Provides auto-instrumentation for @cursor/sdk including:
|
|
5
|
+
* - Agent.create() wrapping (create_agent spans + send() patching)
|
|
6
|
+
* - Agent.resume() wrapping (send() patching on resumed agents)
|
|
7
|
+
* - agent.send() wrapping (invoke_agent spans with streaming tool child spans)
|
|
8
|
+
*
|
|
9
|
+
* Agent.prompt() is covered automatically since it calls create() + send().
|
|
10
|
+
*
|
|
11
|
+
* OTel GenAI semantic convention compliant.
|
|
12
|
+
*/
|
|
13
|
+
import { InstrumentationBase, InstrumentationModuleDefinition } from '@opentelemetry/instrumentation';
|
|
14
|
+
import type { InstrumentationConfig } from '@opentelemetry/instrumentation';
|
|
15
|
+
export default class CursorSDKInstrumentation extends InstrumentationBase {
|
|
16
|
+
constructor(config?: InstrumentationConfig);
|
|
17
|
+
protected init(): InstrumentationModuleDefinition | InstrumentationModuleDefinition[] | void;
|
|
18
|
+
manualPatch(moduleExports: any): any;
|
|
19
|
+
private _patch;
|
|
20
|
+
private _unpatch;
|
|
21
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Shield360 Cursor SDK Instrumentation
|
|
4
|
+
*
|
|
5
|
+
* Provides auto-instrumentation for @cursor/sdk including:
|
|
6
|
+
* - Agent.create() wrapping (create_agent spans + send() patching)
|
|
7
|
+
* - Agent.resume() wrapping (send() patching on resumed agents)
|
|
8
|
+
* - agent.send() wrapping (invoke_agent spans with streaming tool child spans)
|
|
9
|
+
*
|
|
10
|
+
* Agent.prompt() is covered automatically since it calls create() + send().
|
|
11
|
+
*
|
|
12
|
+
* OTel GenAI semantic convention compliant.
|
|
13
|
+
*/
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const instrumentation_1 = require("@opentelemetry/instrumentation");
|
|
16
|
+
const constant_1 = require("../../constant");
|
|
17
|
+
const wrapper_1 = require("./wrapper");
|
|
18
|
+
const SUPPORTED_VERSIONS = ['>=0.1.0'];
|
|
19
|
+
class CursorSDKInstrumentation extends instrumentation_1.InstrumentationBase {
|
|
20
|
+
constructor(config = {}) {
|
|
21
|
+
super(`${constant_1.INSTRUMENTATION_PREFIX}/instrumentation-cursor-sdk`, '1.0.0', config);
|
|
22
|
+
}
|
|
23
|
+
init() {
|
|
24
|
+
const module = new instrumentation_1.InstrumentationNodeModuleDefinition('@cursor/sdk', SUPPORTED_VERSIONS, (moduleExports) => {
|
|
25
|
+
return this._patch(moduleExports);
|
|
26
|
+
}, (moduleExports) => {
|
|
27
|
+
this._unpatch(moduleExports);
|
|
28
|
+
return moduleExports;
|
|
29
|
+
});
|
|
30
|
+
return module;
|
|
31
|
+
}
|
|
32
|
+
manualPatch(moduleExports) {
|
|
33
|
+
return this._patch(moduleExports);
|
|
34
|
+
}
|
|
35
|
+
_patch(moduleExports) {
|
|
36
|
+
try {
|
|
37
|
+
const tracer = this.tracer;
|
|
38
|
+
const AgentClass = moduleExports.Agent;
|
|
39
|
+
if (!AgentClass)
|
|
40
|
+
return moduleExports;
|
|
41
|
+
if (typeof AgentClass.create === 'function') {
|
|
42
|
+
const originalCreate = AgentClass.create;
|
|
43
|
+
AgentClass.create = (0, wrapper_1.patchAgentCreate)(tracer)(originalCreate);
|
|
44
|
+
}
|
|
45
|
+
if (typeof AgentClass.resume === 'function') {
|
|
46
|
+
const originalResume = AgentClass.resume;
|
|
47
|
+
AgentClass.resume = (0, wrapper_1.patchAgentResume)(tracer)(originalResume);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
catch { /* graceful degradation */ }
|
|
51
|
+
return moduleExports;
|
|
52
|
+
}
|
|
53
|
+
_unpatch(_moduleExports) {
|
|
54
|
+
// InstrumentationBase handles restoring originals on disable
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.default = CursorSDKInstrumentation;
|
|
58
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/instrumentation/cursor-sdk/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;AAEH,oEAIwC;AAGxC,6CAAwD;AACxD,uCAA+D;AAE/D,MAAM,kBAAkB,GAAG,CAAC,SAAS,CAAC,CAAC;AAEvC,MAAqB,wBAAyB,SAAQ,qCAAmB;IACvE,YAAY,SAAgC,EAAE;QAC5C,KAAK,CAAC,GAAG,iCAAsB,6BAA6B,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IACjF,CAAC;IAES,IAAI;QACZ,MAAM,MAAM,GAAG,IAAI,qDAAmC,CACpD,aAAa,EACb,kBAAkB,EAClB,CAAC,aAAkB,EAAE,EAAE;YACrB,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agent.resume(), and agent.send()
|
|
5
|
+
* to produce `create_agent`, `invoke_agent`, and `execute_tool` spans.
|
|
6
|
+
*
|
|
7
|
+
* Agent.prompt() is NOT wrapped separately -- it internally calls
|
|
8
|
+
* create() + send(), so the patched versions handle it automatically
|
|
9
|
+
* without producing duplicate spans.
|
|
10
|
+
*
|
|
11
|
+
* Token usage is captured via onDelta injection (TurnEndedUpdate).
|
|
12
|
+
* Tool call spans are created from SDKMessage stream events.
|
|
13
|
+
* The `system` stream event provides resolved model and tool definitions.
|
|
14
|
+
*/
|
|
15
|
+
import { Tracer } from '@opentelemetry/api';
|
|
16
|
+
export declare function patchAgentCreate(tracer: Tracer): (originalCreate: any) => any;
|
|
17
|
+
export declare function patchAgentResume(tracer: Tracer): (originalResume: any) => any;
|