openlit 1.12.0 → 1.14.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 +34 -1
- package/dist/__tests__/manual-trace.test.js +118 -0
- package/dist/__tests__/manual-trace.test.js.map +1 -0
- package/dist/__tests__/register.test.js +90 -0
- package/dist/__tests__/register.test.js.map +1 -0
- package/dist/config.d.ts +7 -1
- package/dist/config.js +3 -1
- package/dist/config.js.map +1 -1
- package/dist/evals/__tests__/offline.test.js +418 -0
- package/dist/evals/__tests__/offline.test.js.map +1 -0
- package/dist/evals/index.d.ts +2 -5
- package/dist/evals/index.js +12 -26
- package/dist/evals/index.js.map +1 -1
- package/dist/evals/offline.d.ts +6 -0
- package/dist/evals/offline.js +347 -0
- package/dist/evals/offline.js.map +1 -0
- package/dist/evals/types.d.ts +69 -18
- package/dist/evals/types.js +20 -0
- package/dist/evals/types.js.map +1 -1
- package/dist/guard/__tests__/integration.test.js +178 -0
- package/dist/guard/__tests__/integration.test.js.map +1 -0
- package/dist/guard/__tests__/pii.test.js +109 -0
- package/dist/guard/__tests__/pii.test.js.map +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.js +92 -0
- package/dist/guard/__tests__/prompt-injection.test.js.map +1 -0
- package/dist/guard/base.d.ts +75 -14
- package/dist/guard/base.js +130 -53
- package/dist/guard/base.js.map +1 -1
- 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/index.d.ts +24 -5
- package/dist/guard/index.js +39 -21
- package/dist/guard/index.js.map +1 -1
- package/dist/guard/integration.d.ts +32 -0
- package/dist/guard/integration.js +328 -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 +94 -0
- package/dist/guard/pii.js.map +1 -0
- package/dist/guard/pipeline.d.ts +18 -0
- package/dist/guard/pipeline.js +96 -0
- package/dist/guard/pipeline.js.map +1 -0
- package/dist/guard/prompt-injection.d.ts +20 -6
- package/dist/guard/prompt-injection.js +59 -68
- package/dist/guard/prompt-injection.js.map +1 -1
- 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 +22 -6
- package/dist/guard/sensitive-topic.js +78 -64
- package/dist/guard/sensitive-topic.js.map +1 -1
- package/dist/guard/topic-restriction.d.ts +21 -6
- package/dist/guard/topic-restriction.js +43 -64
- package/dist/guard/topic-restriction.js.map +1 -1
- package/dist/helpers.d.ts +133 -2
- package/dist/helpers.js +416 -5
- package/dist/helpers.js.map +1 -1
- package/dist/index.d.ts +54 -30
- package/dist/index.js +104 -22
- package/dist/index.js.map +1 -1
- 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__/assemblyai-wrapper.test.js +262 -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__/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 +12 -0
- package/dist/instrumentation/__tests__/cache-pricing.test.js +95 -0
- package/dist/instrumentation/__tests__/cache-pricing.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__/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.js +150 -0
- package/dist/instrumentation/__tests__/groq-trace-comparison.test.js.map +1 -1
- 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__/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__/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__/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__/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__/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/wrapper.js +56 -2
- package/dist/instrumentation/anthropic/wrapper.js.map +1 -1
- 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 +233 -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/wrapper.d.ts +13 -0
- package/dist/instrumentation/azure-ai-inference/wrapper.js +60 -1
- package/dist/instrumentation/azure-ai-inference/wrapper.js.map +1 -1
- package/dist/instrumentation/bedrock/wrapper.d.ts +13 -0
- package/dist/instrumentation/bedrock/wrapper.js +78 -2
- package/dist/instrumentation/bedrock/wrapper.js.map +1 -1
- 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/claude-agent-sdk/wrapper.js +90 -4
- package/dist/instrumentation/claude-agent-sdk/wrapper.js.map +1 -1
- package/dist/instrumentation/cohere/wrapper.d.ts +13 -0
- package/dist/instrumentation/cohere/wrapper.js +59 -0
- package/dist/instrumentation/cohere/wrapper.js.map +1 -1
- 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 +785 -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-ai/wrapper.d.ts +13 -0
- package/dist/instrumentation/google-ai/wrapper.js +85 -1
- package/dist/instrumentation/google-ai/wrapper.js.map +1 -1
- 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/wrapper.js +42 -0
- package/dist/instrumentation/groq/wrapper.js.map +1 -1
- package/dist/instrumentation/huggingface/wrapper.d.ts +13 -0
- package/dist/instrumentation/huggingface/wrapper.js +66 -0
- package/dist/instrumentation/huggingface/wrapper.js.map +1 -1
- package/dist/instrumentation/index.js +28 -0
- package/dist/instrumentation/index.js.map +1 -1
- package/dist/instrumentation/langchain/wrapper.js +5 -8
- package/dist/instrumentation/langchain/wrapper.js.map +1 -1
- package/dist/instrumentation/langgraph/wrapper.js +12 -11
- package/dist/instrumentation/langgraph/wrapper.js.map +1 -1
- package/dist/instrumentation/llamaindex/wrapper.d.ts +14 -1
- package/dist/instrumentation/llamaindex/wrapper.js +68 -0
- package/dist/instrumentation/llamaindex/wrapper.js.map +1 -1
- 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/mistral/wrapper.d.ts +13 -0
- package/dist/instrumentation/mistral/wrapper.js +60 -1
- package/dist/instrumentation/mistral/wrapper.js.map +1 -1
- package/dist/instrumentation/ollama/wrapper.d.ts +13 -0
- package/dist/instrumentation/ollama/wrapper.js +67 -1
- package/dist/instrumentation/ollama/wrapper.js.map +1 -1
- package/dist/instrumentation/openai/wrapper.d.ts +13 -0
- package/dist/instrumentation/openai/wrapper.js +89 -3
- package/dist/instrumentation/openai/wrapper.js.map +1 -1
- 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/replicate/wrapper.d.ts +13 -0
- package/dist/instrumentation/replicate/wrapper.js +61 -0
- package/dist/instrumentation/replicate/wrapper.js.map +1 -1
- package/dist/instrumentation/strands/processor.d.ts +6 -0
- package/dist/instrumentation/strands/processor.js +73 -3
- package/dist/instrumentation/strands/processor.js.map +1 -1
- package/dist/instrumentation/strands/utils.d.ts +2 -2
- package/dist/instrumentation/strands/utils.js +15 -2
- package/dist/instrumentation/strands/utils.js.map +1 -1
- package/dist/instrumentation/together/wrapper.d.ts +13 -0
- package/dist/instrumentation/together/wrapper.js +59 -1
- package/dist/instrumentation/together/wrapper.js.map +1 -1
- 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/wrapper.d.ts +13 -0
- package/dist/instrumentation/vercel-ai/wrapper.js +106 -1
- package/dist/instrumentation/vercel-ai/wrapper.js.map +1 -1
- 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 +529 -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/index.d.ts +9 -2
- package/dist/llm/index.js.map +1 -1
- 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/metrics.d.ts +11 -0
- package/dist/otel/metrics.js +48 -0
- package/dist/otel/metrics.js.map +1 -1
- 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 +278 -0
- package/dist/semantic-convention.js +322 -0
- package/dist/semantic-convention.js.map +1 -1
- package/dist/types.d.ts +15 -1
- package/package.json +18 -1
- package/dist/evals/__tests__/anthropic.test.js +0 -9
- package/dist/evals/__tests__/anthropic.test.js.map +0 -1
- package/dist/evals/__tests__/base.test.js +0 -37
- package/dist/evals/__tests__/base.test.js.map +0 -1
- package/dist/evals/__tests__/core.test.js +0 -33
- package/dist/evals/__tests__/core.test.js.map +0 -1
- package/dist/evals/__tests__/metrics.test.js +0 -59
- package/dist/evals/__tests__/metrics.test.js.map +0 -1
- package/dist/evals/__tests__/openai.test.js +0 -9
- package/dist/evals/__tests__/openai.test.js.map +0 -1
- package/dist/evals/__tests__/providers.test.js +0 -14
- package/dist/evals/__tests__/providers.test.js.map +0 -1
- package/dist/evals/__tests__/utils.test.js +0 -46
- package/dist/evals/__tests__/utils.test.js.map +0 -1
- package/dist/evals/all.d.ts +0 -4
- package/dist/evals/all.js +0 -35
- package/dist/evals/all.js.map +0 -1
- package/dist/evals/base.d.ts +0 -15
- package/dist/evals/base.js +0 -51
- package/dist/evals/base.js.map +0 -1
- package/dist/evals/bias.d.ts +0 -4
- package/dist/evals/bias.js +0 -35
- package/dist/evals/bias.js.map +0 -1
- package/dist/evals/hallucination.d.ts +0 -4
- package/dist/evals/hallucination.js +0 -32
- package/dist/evals/hallucination.js.map +0 -1
- package/dist/evals/llm/anthropic.d.ts +0 -5
- package/dist/evals/llm/anthropic.js +0 -42
- package/dist/evals/llm/anthropic.js.map +0 -1
- package/dist/evals/llm/openai.d.ts +0 -6
- package/dist/evals/llm/openai.js +0 -28
- package/dist/evals/llm/openai.js.map +0 -1
- package/dist/evals/llm/providers.d.ts +0 -7
- package/dist/evals/llm/providers.js +0 -10
- package/dist/evals/llm/providers.js.map +0 -1
- package/dist/evals/metrics.d.ts +0 -9
- package/dist/evals/metrics.js +0 -38
- package/dist/evals/metrics.js.map +0 -1
- package/dist/evals/toxicity.d.ts +0 -4
- package/dist/evals/toxicity.js +0 -33
- package/dist/evals/toxicity.js.map +0 -1
- package/dist/evals/utils.d.ts +0 -4
- package/dist/evals/utils.js +0 -39
- package/dist/evals/utils.js.map +0 -1
- package/dist/guard/__tests__/gaurd.test.js +0 -136
- package/dist/guard/__tests__/gaurd.test.js.map +0 -1
- package/dist/guard/__tests__/utils.test.js +0 -64
- package/dist/guard/__tests__/utils.test.js.map +0 -1
- package/dist/guard/all.d.ts +0 -8
- package/dist/guard/all.js +0 -28
- package/dist/guard/all.js.map +0 -1
- package/dist/guard/types.d.ts +0 -26
- package/dist/guard/types.js +0 -4
- package/dist/guard/types.js.map +0 -1
- package/dist/guard/utils.d.ts +0 -13
- package/dist/guard/utils.js +0 -79
- package/dist/guard/utils.js.map +0 -1
- /package/dist/{evals/__tests__/anthropic.test.d.ts → __tests__/manual-trace.test.d.ts} +0 -0
- /package/dist/{evals/__tests__/metrics.test.d.ts → __tests__/register.test.d.ts} +0 -0
- /package/dist/evals/__tests__/{base.test.d.ts → offline.test.d.ts} +0 -0
- /package/dist/{evals/__tests__/core.test.d.ts → guard/__tests__/integration.test.d.ts} +0 -0
- /package/dist/{evals/__tests__/openai.test.d.ts → guard/__tests__/pii.test.d.ts} +0 -0
- /package/dist/{evals/__tests__/providers.test.d.ts → guard/__tests__/pipeline.test.d.ts} +0 -0
- /package/dist/{evals/__tests__/utils.test.d.ts → guard/__tests__/prompt-injection.test.d.ts} +0 -0
- /package/dist/{guard/__tests__/gaurd.test.d.ts → instrumentation/__tests__/assemblyai-wrapper.test.d.ts} +0 -0
- /package/dist/{guard/__tests__/utils.test.d.ts → instrumentation/__tests__/browser-use-wrapper.test.d.ts} +0 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* OpenLIT 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,OAAO,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;QACpC,CAAC,EACD,CAAC,aAAkB,EAAE,EAAE;YACrB,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;YAC7B,OAAO,aAAa,CAAC;QACvB,CAAC,CACF,CAAC;QACF,OAAO,MAAM,CAAC;IAChB,CAAC;IAEM,WAAW,CAAC,aAAkB;QACnC,OAAO,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IACpC,CAAC;IAEO,MAAM,CAAC,aAAkB;QAC/B,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;YAC3B,MAAM,UAAU,GAAG,aAAa,CAAC,KAAK,CAAC;YAEvC,IAAI,CAAC,UAAU;gBAAE,OAAO,aAAa,CAAC;YAEtC,IAAI,OAAO,UAAU,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;gBAC5C,MAAM,cAAc,GAAG,UAAU,CAAC,MAAM,CAAC;gBACzC,UAAU,CAAC,MAAM,GAAG,IAAA,0BAAgB,EAAC,MAAM,CAAC,CAAC,cAAc,CAAC,CAAC;YAC/D,CAAC;YAED,IAAI,OAAO,UAAU,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;gBAC5C,MAAM,cAAc,GAAG,UAAU,CAAC,MAAM,CAAC;gBACzC,UAAU,CAAC,MAAM,GAAG,IAAA,0BAAgB,EAAC,MAAM,CAAC,CAAC,cAAc,CAAC,CAAC;YAC/D,CAAC;QAEH,CAAC;QAAC,MAAM,CAAC,CAAC,0BAA0B,CAAC,CAAC;QACtC,OAAO,aAAa,CAAC;IACvB,CAAC;IAEO,QAAQ,CAAC,cAAmB;QAClC,6DAA6D;IAC/D,CAAC;CACF;AAhDD,2CAgDC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cursor SDK wrapper -- OTel GenAI semantic convention compliant.
|
|
3
|
+
*
|
|
4
|
+
* Wraps Agent.create(), 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;
|