langwatch 1.19.0 → 2.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.
Files changed (91) hide show
  1. package/README.md +27 -13
  2. package/dist/agent/index.d.mts +122 -79
  3. package/dist/agent/index.d.ts +122 -79
  4. package/dist/agent/index.js +541 -301
  5. package/dist/agent/index.js.map +1 -1
  6. package/dist/agent/index.mjs +540 -302
  7. package/dist/agent/index.mjs.map +1 -1
  8. package/dist/{chunk-NPEK4RSD.mjs → chunk-2GKEMCKT.mjs} +7757 -2409
  9. package/dist/chunk-2GKEMCKT.mjs.map +1 -0
  10. package/dist/chunk-5VYEG3RS.js +117 -0
  11. package/dist/chunk-5VYEG3RS.js.map +1 -0
  12. package/dist/chunk-AYPQNLCC.mjs +852 -0
  13. package/dist/chunk-AYPQNLCC.mjs.map +1 -0
  14. package/dist/chunk-BL3GHEKF.js +59 -0
  15. package/dist/chunk-BL3GHEKF.js.map +1 -0
  16. package/dist/chunk-C7IWJ2GJ.mjs +59 -0
  17. package/dist/chunk-C7IWJ2GJ.mjs.map +1 -0
  18. package/dist/chunk-DLZCOUXC.js +852 -0
  19. package/dist/chunk-DLZCOUXC.js.map +1 -0
  20. package/dist/{chunk-O4J3ZPZY.js → chunk-F7BVJW3S.js} +7912 -2564
  21. package/dist/chunk-F7BVJW3S.js.map +1 -0
  22. package/dist/{chunk-SY5HSL5G.mjs → chunk-M3DSPR5S.mjs} +124 -112
  23. package/dist/chunk-M3DSPR5S.mjs.map +1 -0
  24. package/dist/{chunk-CSV7B7B5.js → chunk-MAO3SIBB.js} +141 -129
  25. package/dist/chunk-MAO3SIBB.js.map +1 -0
  26. package/dist/{chunk-LCG5Y2EG.js → chunk-N76BG37W.js} +15 -101
  27. package/dist/chunk-N76BG37W.js.map +1 -0
  28. package/dist/chunk-SERULD4Z.mjs +117 -0
  29. package/dist/chunk-SERULD4Z.mjs.map +1 -0
  30. package/dist/{chunk-73QOHSHU.js → chunk-WDUUAIG3.js} +2 -2
  31. package/dist/chunk-WDUUAIG3.js.map +1 -0
  32. package/dist/{chunk-WMDQVWA6.mjs → chunk-WSGVZ3J2.mjs} +22 -108
  33. package/dist/chunk-WSGVZ3J2.mjs.map +1 -0
  34. package/dist/{chunk-57L2K66L.mjs → chunk-XQ4CP2JK.mjs} +2 -2
  35. package/dist/chunk-XQ4CP2JK.mjs.map +1 -0
  36. package/dist/cli/bundle.js +853 -552
  37. package/dist/implementation-BXVPzwOt.d.mts +261 -0
  38. package/dist/implementation-DJ-JveZl.d.ts +261 -0
  39. package/dist/index.d.mts +479 -1130
  40. package/dist/index.d.ts +479 -1130
  41. package/dist/index.js +7908 -3525
  42. package/dist/index.js.map +1 -1
  43. package/dist/index.mjs +7883 -3500
  44. package/dist/index.mjs.map +1 -1
  45. package/dist/observability-sdk/index.d.mts +16 -76
  46. package/dist/observability-sdk/index.d.ts +16 -76
  47. package/dist/observability-sdk/index.js +8 -5
  48. package/dist/observability-sdk/index.js.map +1 -1
  49. package/dist/observability-sdk/index.mjs +13 -10
  50. package/dist/observability-sdk/instrumentation/langchain/index.d.mts +3 -5
  51. package/dist/observability-sdk/instrumentation/langchain/index.d.ts +3 -5
  52. package/dist/observability-sdk/instrumentation/langchain/index.js +160 -112
  53. package/dist/observability-sdk/instrumentation/langchain/index.js.map +1 -1
  54. package/dist/observability-sdk/instrumentation/langchain/index.mjs +148 -100
  55. package/dist/observability-sdk/instrumentation/langchain/index.mjs.map +1 -1
  56. package/dist/observability-sdk/semconv/index.d.mts +37 -0
  57. package/dist/observability-sdk/semconv/index.d.ts +37 -0
  58. package/dist/observability-sdk/semconv/index.js +121 -0
  59. package/dist/observability-sdk/semconv/index.js.map +1 -0
  60. package/dist/observability-sdk/semconv/index.mjs +121 -0
  61. package/dist/observability-sdk/semconv/index.mjs.map +1 -0
  62. package/dist/observability-sdk/setup/node/index.d.mts +73 -313
  63. package/dist/observability-sdk/setup/node/index.d.ts +73 -313
  64. package/dist/observability-sdk/setup/node/index.js +6 -4
  65. package/dist/observability-sdk/setup/node/index.js.map +1 -1
  66. package/dist/observability-sdk/setup/node/index.mjs +5 -3
  67. package/dist/types--ExXvd26.d.mts +16583 -0
  68. package/dist/{types-VOZv9LYO.d.ts → types-CoS5PmeU.d.mts} +22 -59
  69. package/dist/{types-VOZv9LYO.d.mts → types-CoS5PmeU.d.ts} +22 -59
  70. package/dist/types-CpT3iEIj.d.ts +16583 -0
  71. package/dist/{types-DLfhJb38.d.mts → types-RkiBQZ9j.d.mts} +1 -6
  72. package/dist/{types-DLfhJb38.d.ts → types-RkiBQZ9j.d.ts} +1 -6
  73. package/dist/values-1yj9l0Sa.d.mts +112 -0
  74. package/dist/values-1yj9l0Sa.d.ts +112 -0
  75. package/package.json +94 -64
  76. package/dist/chunk-57L2K66L.mjs.map +0 -1
  77. package/dist/chunk-73QOHSHU.js.map +0 -1
  78. package/dist/chunk-CSV7B7B5.js.map +0 -1
  79. package/dist/chunk-LCG5Y2EG.js.map +0 -1
  80. package/dist/chunk-NPEK4RSD.mjs.map +0 -1
  81. package/dist/chunk-O4J3ZPZY.js.map +0 -1
  82. package/dist/chunk-PIYOJF6V.mjs +0 -566
  83. package/dist/chunk-PIYOJF6V.mjs.map +0 -1
  84. package/dist/chunk-SY5HSL5G.mjs.map +0 -1
  85. package/dist/chunk-WGLVIV4J.js +0 -566
  86. package/dist/chunk-WGLVIV4J.js.map +0 -1
  87. package/dist/chunk-WMDQVWA6.mjs.map +0 -1
  88. package/dist/implementation-CeTvnq6e.d.mts +0 -716
  89. package/dist/implementation-CsQrexpY.d.ts +0 -716
  90. package/dist/types-ofe1fAYQ.d.mts +0 -38143
  91. package/dist/types-wuYJPoFb.d.ts +0 -38143
@@ -22,12 +22,7 @@ interface DataCaptureContext {
22
22
  * @returns Capture mode to use for this specific operation
23
23
  */
24
24
  type DataCapturePredicate = (context: DataCaptureContext) => DataCaptureMode;
25
- /**
26
- * Configuration for what data should be captured in spans.
27
- *
28
- * This provides simple control over input/output data capture
29
- * by LangWatch instrumentations.
30
- */
25
+ /** Configuration for what data (input/output) LangWatch instrumentations capture in spans. */
31
26
  interface DataCaptureConfig {
32
27
  /**
33
28
  * Controls data capture behavior.
@@ -22,12 +22,7 @@ interface DataCaptureContext {
22
22
  * @returns Capture mode to use for this specific operation
23
23
  */
24
24
  type DataCapturePredicate = (context: DataCaptureContext) => DataCaptureMode;
25
- /**
26
- * Configuration for what data should be captured in spans.
27
- *
28
- * This provides simple control over input/output data capture
29
- * by LangWatch instrumentations.
30
- */
25
+ /** Configuration for what data (input/output) LangWatch instrumentations capture in spans. */
31
26
  interface DataCaptureConfig {
32
27
  /**
33
28
  * Controls data capture behavior.
@@ -0,0 +1,112 @@
1
+ /**
2
+ * Anthropic AI system identifier
3
+ * Used to identify Anthropic's Claude models
4
+ */
5
+ declare const VAL_GEN_AI_SYSTEM_ANTHROPIC = "anthropic";
6
+ /**
7
+ * AWS Bedrock system identifier
8
+ * Used to identify AWS Bedrock AI services
9
+ */
10
+ declare const VAL_GEN_AI_SYSTEM_AWS_BEDROCK = "aws.bedrock";
11
+ /**
12
+ * Azure AI Inference system identifier
13
+ * Used to identify Azure AI Inference services
14
+ */
15
+ declare const VAL_GEN_AI_SYSTEM_AZURE_AI_INFERENCE = "azure.ai.inference";
16
+ /**
17
+ * Azure AI OpenAI system identifier
18
+ * Used to identify Azure OpenAI services
19
+ */
20
+ declare const VAL_GEN_AI_SYSTEM_AZURE_AI_OPENAI = "azure.ai.openai";
21
+ /**
22
+ * Cohere system identifier
23
+ * Used to identify Cohere AI models
24
+ */
25
+ declare const VAL_GEN_AI_SYSTEM_COHERE = "cohere";
26
+ /**
27
+ * DeepSeek system identifier
28
+ * Used to identify DeepSeek AI models
29
+ */
30
+ declare const VAL_GEN_AI_SYSTEM_DEEPSEEK = "deepseek";
31
+ /**
32
+ * GCP Gemini system identifier
33
+ * Used to identify Google Cloud Gemini models
34
+ */
35
+ declare const VAL_GEN_AI_SYSTEM_GCP_GEMINI = "gcp.gemini";
36
+ /**
37
+ * GCP Gen AI system identifier
38
+ * Used to identify Google Cloud Generative AI services
39
+ */
40
+ declare const VAL_GEN_AI_SYSTEM_GCP_GEN_AI = "gcp.gen_ai";
41
+ /**
42
+ * GCP Vertex AI system identifier
43
+ * Used to identify Google Cloud Vertex AI services
44
+ */
45
+ declare const VAL_GEN_AI_SYSTEM_GCP_VERTEX_AI = "gcp.vertex_ai";
46
+ /**
47
+ * Groq system identifier
48
+ * Used to identify Groq AI models
49
+ */
50
+ declare const VAL_GEN_AI_SYSTEM_GROQ = "groq";
51
+ /**
52
+ * IBM WatsonX AI system identifier
53
+ * Used to identify IBM WatsonX AI services
54
+ */
55
+ declare const VAL_GEN_AI_SYSTEM_IBM_WATSONX_AI = "ibm.watsonx.ai";
56
+ /**
57
+ * Mistral AI system identifier
58
+ * Used to identify Mistral AI models
59
+ */
60
+ declare const VAL_GEN_AI_SYSTEM_MISTRAL_AI = "mistral_ai";
61
+ /**
62
+ * OpenAI system identifier
63
+ * Used to identify OpenAI models and services
64
+ */
65
+ declare const VAL_GEN_AI_SYSTEM_OPENAI = "openai";
66
+ /**
67
+ * Perplexity system identifier
68
+ * Used to identify Perplexity AI models
69
+ */
70
+ declare const VAL_GEN_AI_SYSTEM_PERPLEXITY = "perplexity";
71
+ /**
72
+ * XAI system identifier
73
+ * Used to identify XAI models and services
74
+ */
75
+ declare const VAL_GEN_AI_SYSTEM_XAI = "xai";
76
+ /**
77
+ * Content filter finish reason
78
+ * Used when generation stops due to content filtering
79
+ */
80
+ declare const VAL_GEN_AI_FINISH_REASON_CONTENT_FILTER = "content_filter";
81
+ /**
82
+ * Error finish reason
83
+ * Used when generation stops due to an error
84
+ */
85
+ declare const VAL_GEN_AI_FINISH_REASON_ERROR = "error";
86
+ /**
87
+ * Length finish reason
88
+ * Used when generation stops due to length limits
89
+ */
90
+ declare const VAL_GEN_AI_FINISH_REASON_LENGTH = "length";
91
+ /**
92
+ * Stop finish reason
93
+ * Used when generation stops due to stop tokens
94
+ */
95
+ declare const VAL_GEN_AI_FINISH_REASON_STOP = "stop";
96
+ /**
97
+ * Tool calls finish reason
98
+ * Used when generation stops due to tool calls
99
+ */
100
+ declare const VAL_GEN_AI_FINISH_REASON_TOOL_CALLS = "tool_calls";
101
+ /**
102
+ * Union type of all supported GenAI system identifiers
103
+ * Used for type safety when working with system identification
104
+ */
105
+ type VAL_GEN_AI_SYSTEMS = typeof VAL_GEN_AI_SYSTEM_ANTHROPIC | typeof VAL_GEN_AI_SYSTEM_AWS_BEDROCK | typeof VAL_GEN_AI_SYSTEM_AZURE_AI_INFERENCE | typeof VAL_GEN_AI_SYSTEM_AZURE_AI_OPENAI | typeof VAL_GEN_AI_SYSTEM_COHERE | typeof VAL_GEN_AI_SYSTEM_DEEPSEEK | typeof VAL_GEN_AI_SYSTEM_GCP_GEMINI | typeof VAL_GEN_AI_SYSTEM_GCP_GEN_AI | typeof VAL_GEN_AI_SYSTEM_GCP_VERTEX_AI | typeof VAL_GEN_AI_SYSTEM_GROQ | typeof VAL_GEN_AI_SYSTEM_IBM_WATSONX_AI | typeof VAL_GEN_AI_SYSTEM_MISTRAL_AI | typeof VAL_GEN_AI_SYSTEM_OPENAI | typeof VAL_GEN_AI_SYSTEM_PERPLEXITY | typeof VAL_GEN_AI_SYSTEM_XAI;
106
+ /**
107
+ * Union type of all supported GenAI finish reasons
108
+ * Used for type safety when working with generation completion reasons
109
+ */
110
+ type VAL_GEN_AI_FINISH_REASONS = typeof VAL_GEN_AI_FINISH_REASON_CONTENT_FILTER | typeof VAL_GEN_AI_FINISH_REASON_ERROR | typeof VAL_GEN_AI_FINISH_REASON_LENGTH | typeof VAL_GEN_AI_FINISH_REASON_STOP | typeof VAL_GEN_AI_FINISH_REASON_TOOL_CALLS;
111
+
112
+ export { type VAL_GEN_AI_SYSTEMS as V, type VAL_GEN_AI_FINISH_REASONS as a, VAL_GEN_AI_FINISH_REASON_CONTENT_FILTER as b, VAL_GEN_AI_FINISH_REASON_ERROR as c, VAL_GEN_AI_FINISH_REASON_LENGTH as d, VAL_GEN_AI_FINISH_REASON_STOP as e, VAL_GEN_AI_FINISH_REASON_TOOL_CALLS as f, VAL_GEN_AI_SYSTEM_ANTHROPIC as g, VAL_GEN_AI_SYSTEM_AWS_BEDROCK as h, VAL_GEN_AI_SYSTEM_AZURE_AI_INFERENCE as i, VAL_GEN_AI_SYSTEM_AZURE_AI_OPENAI as j, VAL_GEN_AI_SYSTEM_COHERE as k, VAL_GEN_AI_SYSTEM_DEEPSEEK as l, VAL_GEN_AI_SYSTEM_GCP_GEMINI as m, VAL_GEN_AI_SYSTEM_GCP_GEN_AI as n, VAL_GEN_AI_SYSTEM_GCP_VERTEX_AI as o, VAL_GEN_AI_SYSTEM_GROQ as p, VAL_GEN_AI_SYSTEM_IBM_WATSONX_AI as q, VAL_GEN_AI_SYSTEM_MISTRAL_AI as r, VAL_GEN_AI_SYSTEM_OPENAI as s, VAL_GEN_AI_SYSTEM_PERPLEXITY as t, VAL_GEN_AI_SYSTEM_XAI as u };
@@ -0,0 +1,112 @@
1
+ /**
2
+ * Anthropic AI system identifier
3
+ * Used to identify Anthropic's Claude models
4
+ */
5
+ declare const VAL_GEN_AI_SYSTEM_ANTHROPIC = "anthropic";
6
+ /**
7
+ * AWS Bedrock system identifier
8
+ * Used to identify AWS Bedrock AI services
9
+ */
10
+ declare const VAL_GEN_AI_SYSTEM_AWS_BEDROCK = "aws.bedrock";
11
+ /**
12
+ * Azure AI Inference system identifier
13
+ * Used to identify Azure AI Inference services
14
+ */
15
+ declare const VAL_GEN_AI_SYSTEM_AZURE_AI_INFERENCE = "azure.ai.inference";
16
+ /**
17
+ * Azure AI OpenAI system identifier
18
+ * Used to identify Azure OpenAI services
19
+ */
20
+ declare const VAL_GEN_AI_SYSTEM_AZURE_AI_OPENAI = "azure.ai.openai";
21
+ /**
22
+ * Cohere system identifier
23
+ * Used to identify Cohere AI models
24
+ */
25
+ declare const VAL_GEN_AI_SYSTEM_COHERE = "cohere";
26
+ /**
27
+ * DeepSeek system identifier
28
+ * Used to identify DeepSeek AI models
29
+ */
30
+ declare const VAL_GEN_AI_SYSTEM_DEEPSEEK = "deepseek";
31
+ /**
32
+ * GCP Gemini system identifier
33
+ * Used to identify Google Cloud Gemini models
34
+ */
35
+ declare const VAL_GEN_AI_SYSTEM_GCP_GEMINI = "gcp.gemini";
36
+ /**
37
+ * GCP Gen AI system identifier
38
+ * Used to identify Google Cloud Generative AI services
39
+ */
40
+ declare const VAL_GEN_AI_SYSTEM_GCP_GEN_AI = "gcp.gen_ai";
41
+ /**
42
+ * GCP Vertex AI system identifier
43
+ * Used to identify Google Cloud Vertex AI services
44
+ */
45
+ declare const VAL_GEN_AI_SYSTEM_GCP_VERTEX_AI = "gcp.vertex_ai";
46
+ /**
47
+ * Groq system identifier
48
+ * Used to identify Groq AI models
49
+ */
50
+ declare const VAL_GEN_AI_SYSTEM_GROQ = "groq";
51
+ /**
52
+ * IBM WatsonX AI system identifier
53
+ * Used to identify IBM WatsonX AI services
54
+ */
55
+ declare const VAL_GEN_AI_SYSTEM_IBM_WATSONX_AI = "ibm.watsonx.ai";
56
+ /**
57
+ * Mistral AI system identifier
58
+ * Used to identify Mistral AI models
59
+ */
60
+ declare const VAL_GEN_AI_SYSTEM_MISTRAL_AI = "mistral_ai";
61
+ /**
62
+ * OpenAI system identifier
63
+ * Used to identify OpenAI models and services
64
+ */
65
+ declare const VAL_GEN_AI_SYSTEM_OPENAI = "openai";
66
+ /**
67
+ * Perplexity system identifier
68
+ * Used to identify Perplexity AI models
69
+ */
70
+ declare const VAL_GEN_AI_SYSTEM_PERPLEXITY = "perplexity";
71
+ /**
72
+ * XAI system identifier
73
+ * Used to identify XAI models and services
74
+ */
75
+ declare const VAL_GEN_AI_SYSTEM_XAI = "xai";
76
+ /**
77
+ * Content filter finish reason
78
+ * Used when generation stops due to content filtering
79
+ */
80
+ declare const VAL_GEN_AI_FINISH_REASON_CONTENT_FILTER = "content_filter";
81
+ /**
82
+ * Error finish reason
83
+ * Used when generation stops due to an error
84
+ */
85
+ declare const VAL_GEN_AI_FINISH_REASON_ERROR = "error";
86
+ /**
87
+ * Length finish reason
88
+ * Used when generation stops due to length limits
89
+ */
90
+ declare const VAL_GEN_AI_FINISH_REASON_LENGTH = "length";
91
+ /**
92
+ * Stop finish reason
93
+ * Used when generation stops due to stop tokens
94
+ */
95
+ declare const VAL_GEN_AI_FINISH_REASON_STOP = "stop";
96
+ /**
97
+ * Tool calls finish reason
98
+ * Used when generation stops due to tool calls
99
+ */
100
+ declare const VAL_GEN_AI_FINISH_REASON_TOOL_CALLS = "tool_calls";
101
+ /**
102
+ * Union type of all supported GenAI system identifiers
103
+ * Used for type safety when working with system identification
104
+ */
105
+ type VAL_GEN_AI_SYSTEMS = typeof VAL_GEN_AI_SYSTEM_ANTHROPIC | typeof VAL_GEN_AI_SYSTEM_AWS_BEDROCK | typeof VAL_GEN_AI_SYSTEM_AZURE_AI_INFERENCE | typeof VAL_GEN_AI_SYSTEM_AZURE_AI_OPENAI | typeof VAL_GEN_AI_SYSTEM_COHERE | typeof VAL_GEN_AI_SYSTEM_DEEPSEEK | typeof VAL_GEN_AI_SYSTEM_GCP_GEMINI | typeof VAL_GEN_AI_SYSTEM_GCP_GEN_AI | typeof VAL_GEN_AI_SYSTEM_GCP_VERTEX_AI | typeof VAL_GEN_AI_SYSTEM_GROQ | typeof VAL_GEN_AI_SYSTEM_IBM_WATSONX_AI | typeof VAL_GEN_AI_SYSTEM_MISTRAL_AI | typeof VAL_GEN_AI_SYSTEM_OPENAI | typeof VAL_GEN_AI_SYSTEM_PERPLEXITY | typeof VAL_GEN_AI_SYSTEM_XAI;
106
+ /**
107
+ * Union type of all supported GenAI finish reasons
108
+ * Used for type safety when working with generation completion reasons
109
+ */
110
+ type VAL_GEN_AI_FINISH_REASONS = typeof VAL_GEN_AI_FINISH_REASON_CONTENT_FILTER | typeof VAL_GEN_AI_FINISH_REASON_ERROR | typeof VAL_GEN_AI_FINISH_REASON_LENGTH | typeof VAL_GEN_AI_FINISH_REASON_STOP | typeof VAL_GEN_AI_FINISH_REASON_TOOL_CALLS;
111
+
112
+ export { type VAL_GEN_AI_SYSTEMS as V, type VAL_GEN_AI_FINISH_REASONS as a, VAL_GEN_AI_FINISH_REASON_CONTENT_FILTER as b, VAL_GEN_AI_FINISH_REASON_ERROR as c, VAL_GEN_AI_FINISH_REASON_LENGTH as d, VAL_GEN_AI_FINISH_REASON_STOP as e, VAL_GEN_AI_FINISH_REASON_TOOL_CALLS as f, VAL_GEN_AI_SYSTEM_ANTHROPIC as g, VAL_GEN_AI_SYSTEM_AWS_BEDROCK as h, VAL_GEN_AI_SYSTEM_AZURE_AI_INFERENCE as i, VAL_GEN_AI_SYSTEM_AZURE_AI_OPENAI as j, VAL_GEN_AI_SYSTEM_COHERE as k, VAL_GEN_AI_SYSTEM_DEEPSEEK as l, VAL_GEN_AI_SYSTEM_GCP_GEMINI as m, VAL_GEN_AI_SYSTEM_GCP_GEN_AI as n, VAL_GEN_AI_SYSTEM_GCP_VERTEX_AI as o, VAL_GEN_AI_SYSTEM_GROQ as p, VAL_GEN_AI_SYSTEM_IBM_WATSONX_AI as q, VAL_GEN_AI_SYSTEM_MISTRAL_AI as r, VAL_GEN_AI_SYSTEM_OPENAI as s, VAL_GEN_AI_SYSTEM_PERPLEXITY as t, VAL_GEN_AI_SYSTEM_XAI as u };
package/package.json CHANGED
@@ -1,15 +1,17 @@
1
1
  {
2
2
  "name": "langwatch",
3
- "version": "1.19.0",
3
+ "version": "2.0.0",
4
4
  "description": "LangWatch TypeScript/JavaScript SDK. Interact with the full LangWatch API and use the LangWatch OpenTelemetry SDK to instrument your application. For more information, see https://docs.langwatch.ai/integration/typescript/guide",
5
- "main": "dist/index.js",
6
- "module": "dist/index.mjs",
7
- "types": "dist/index.d.ts",
8
- "author": "LangWatch",
9
5
  "license": "MIT",
10
- "engines": {
11
- "node": ">=20",
12
- "pnpm": ">=8"
6
+ "author": "LangWatch",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/langwatch/langwatch.git",
10
+ "directory": "typescript-sdk"
11
+ },
12
+ "bin": {
13
+ "langwatch": "./dist/cli/index.js",
14
+ "lw": "./dist/cli/index.js"
13
15
  },
14
16
  "files": [
15
17
  "dist",
@@ -18,10 +20,9 @@
18
20
  "README.md",
19
21
  "LICENSE"
20
22
  ],
21
- "bin": {
22
- "lw": "./dist/cli/index.js",
23
- "langwatch": "./dist/cli/index.js"
24
- },
23
+ "main": "dist/index.js",
24
+ "module": "dist/index.mjs",
25
+ "types": "dist/index.d.ts",
25
26
  "exports": {
26
27
  ".": {
27
28
  "types": "./dist/index.d.ts",
@@ -33,6 +34,11 @@
33
34
  "require": "./dist/observability-sdk/index.js",
34
35
  "import": "./dist/observability-sdk/index.mjs"
35
36
  },
37
+ "./observability/semconv": {
38
+ "types": "./dist/observability-sdk/semconv/index.d.ts",
39
+ "require": "./dist/observability-sdk/semconv/index.js",
40
+ "import": "./dist/observability-sdk/semconv/index.mjs"
41
+ },
36
42
  "./observability/node": {
37
43
  "types": "./dist/observability-sdk/setup/node/index.d.ts",
38
44
  "require": "./dist/observability-sdk/setup/node/index.js",
@@ -49,79 +55,77 @@
49
55
  "import": "./dist/agent/index.mjs"
50
56
  }
51
57
  },
52
- "repository": {
53
- "type": "git",
54
- "url": "https://github.com/langwatch/langwatch.git",
55
- "directory": "typescript-sdk"
58
+ "dependencies": {
59
+ "@opentelemetry/api-logs": "0.221.0",
60
+ "@opentelemetry/context-async-hooks": "2.10.0",
61
+ "@opentelemetry/core": "2.10.0",
62
+ "@opentelemetry/exporter-logs-otlp-proto": "0.221.0",
63
+ "@opentelemetry/exporter-trace-otlp-proto": "^0.221.0",
64
+ "@opentelemetry/otlp-exporter-base": "0.221.0",
65
+ "@opentelemetry/resources": "^2.8.0",
66
+ "@opentelemetry/sdk-logs": "^0.221.0",
67
+ "@opentelemetry/sdk-trace-base": "2.10.0",
68
+ "@opentelemetry/sdk-trace-node": "2.10.0",
69
+ "liquidjs": "^10.27.2",
70
+ "open": "^11.0.0",
71
+ "openapi-fetch": "^0.17.0",
72
+ "ws": "^8.21.0",
73
+ "xksuid": "^0.0.4",
74
+ "zod": "^4.6.7"
56
75
  },
57
76
  "devDependencies": {
58
77
  "@eslint/js": "^9.32.0",
59
78
  "@langchain/core": ">=0.3.68 <0.4.0",
60
79
  "@langchain/langgraph": ">=0.4.0 <1.0.0",
61
80
  "@langchain/openai": ">=0.6.0 <1.0.0",
62
- "@opentelemetry/sdk-node": "0.221.0",
63
- "@opentelemetry/sdk-trace-node": "^2.0.1",
64
- "@opentelemetry/sdk-trace-web": ">=2.0.1",
65
- "@types/debug": "^4.1.12",
81
+ "@langwatch/e2e-stack": "0.0.1",
82
+ "@langwatch/handled-error": "0.1.0",
83
+ "@opentelemetry/api": "^1.9.1",
84
+ "@opentelemetry/instrumentation": "^0.221.0",
85
+ "@opentelemetry/sdk-metrics": "^2.8.0",
86
+ "@opentelemetry/sdk-trace-web": "2.10.0",
87
+ "@types/debug": "^4.1.13",
66
88
  "@types/js-yaml": "^4.0.9",
67
89
  "@types/node": "^26.2.0",
68
90
  "@types/prompts": "^2.4.9",
69
91
  "@types/ws": "^8.18.1",
92
+ "@typescript-eslint/parser": "^8.58.1",
70
93
  "@vercel/otel": "^1.13.0",
71
- "@vitest/coverage-v8": "^4.1.0",
94
+ "@vitest/coverage-v8": "^5.0.1",
95
+ "chalk": "^6.0.0",
96
+ "commander": "^15.0.0",
97
+ "dotenv": "^17.4.2",
72
98
  "dotenv-cli": "^11.0.0",
73
- "esbuild": "^0.28.1",
99
+ "esbuild": "^0.28.2",
74
100
  "eslint": "^9.32.0",
75
101
  "fets": "^0.8.5",
76
102
  "fishery": "^2.3.1",
103
+ "js-yaml": "^5.4.1",
104
+ "jsonc-parser": "^3.3.1",
77
105
  "langchain": ">=0.3.0 <2.0.0",
78
106
  "msw": "^2.10.4",
79
107
  "nock": "^14.0.8",
80
108
  "openapi-msw": "^1.2.0",
81
109
  "openapi-typescript": "7.13.0",
110
+ "ora": "^9.3.0",
111
+ "prompts": "^2.4.2",
82
112
  "tsup": "^8.5.0",
83
113
  "typescript": "^6.0.3",
84
- "typescript-eslint": "^8.38.0",
85
- "vitest": "^4.1.0",
114
+ "typescript-eslint": "^8.55.0",
115
+ "vitest": "^5.0.1",
86
116
  "vitest-mock-extended": "^5.1.1",
87
- "yaml": "^2.8.1",
88
- "@langwatch/langy": "0.1.0"
89
- },
90
- "dependencies": {
91
- "@opentelemetry/api": "^1.9.0",
92
- "@opentelemetry/api-logs": "0.221.0",
93
- "@opentelemetry/core": "^2.0.1",
94
- "@opentelemetry/exporter-logs-otlp-http": "0.221.0",
95
- "@opentelemetry/exporter-trace-otlp-http": "0.221.0",
96
- "@opentelemetry/instrumentation": "0.221.0",
97
- "@opentelemetry/resources": "^2.0.1",
98
- "@opentelemetry/sdk-logs": "0.221.0",
99
- "@opentelemetry/sdk-metrics": "^2.0.1",
100
- "@opentelemetry/sdk-node": "^0.221.0",
101
- "@opentelemetry/sdk-trace-base": "^2.0.1",
102
- "@opentelemetry/semantic-conventions": "^1.36.0",
103
- "chalk": "^6.0.0",
104
- "cloudflared": "0.7.1",
105
- "commander": "^15.0.0",
106
- "dotenv": "^17.3.1",
107
- "js-yaml": "^5.2.0",
108
- "jsonc-parser": "^3.3.1",
109
- "liquidjs": "^10.27.0",
110
- "open": "^11.0.0",
111
- "openapi-fetch": "^0.17.0",
112
- "ora": "^9.3.0",
113
- "prompts": "^2.4.2",
114
- "ws": "^8.21.0",
115
- "xksuid": "^0.0.4",
116
- "zod": "^4.0.14"
117
+ "yaml": "^2.8.1"
117
118
  },
118
119
  "peerDependencies": {
119
120
  "@ai-sdk/openai": ">=2.0.0 <5.0.0",
120
121
  "@langchain/core": ">=0.3.0 <2.0.0",
121
122
  "@langchain/langgraph": ">=0.4.0 <2.0.0",
122
123
  "@langchain/openai": ">=0.6.0 <2.0.0",
123
- "@opentelemetry/context-async-hooks": "^2.1.0",
124
+ "@opentelemetry/api": "^1.9.0",
124
125
  "@opentelemetry/context-zone": ">=1.19.0 <3.0.0",
126
+ "@opentelemetry/exporter-trace-otlp-grpc": ">=0.221.0 <1.0.0",
127
+ "@opentelemetry/instrumentation": ">=0.200.0 <1.0.0",
128
+ "@opentelemetry/sdk-metrics": ">=2.0.0 <3.0.0",
125
129
  "@opentelemetry/sdk-trace-web": ">=1.19.0 <3.0.0",
126
130
  "langchain": ">=0.3.0 <2.0.0"
127
131
  },
@@ -138,10 +142,16 @@
138
142
  "@langchain/openai": {
139
143
  "optional": true
140
144
  },
141
- "@opentelemetry/context-async-hooks": {
145
+ "@opentelemetry/context-zone": {
142
146
  "optional": true
143
147
  },
144
- "@opentelemetry/context-zone": {
148
+ "@opentelemetry/exporter-trace-otlp-grpc": {
149
+ "optional": true
150
+ },
151
+ "@opentelemetry/instrumentation": {
152
+ "optional": true
153
+ },
154
+ "@opentelemetry/sdk-metrics": {
145
155
  "optional": true
146
156
  },
147
157
  "@opentelemetry/sdk-trace-web": {
@@ -151,25 +161,45 @@
151
161
  "optional": true
152
162
  }
153
163
  },
164
+ "engines": {
165
+ "node": "^22.23.4 || ^24.22.1 || >=26.12.1",
166
+ "pnpm": ">=8"
167
+ },
168
+ "nx": {
169
+ "namedInputs": {
170
+ "sdkBuild": [
171
+ "default",
172
+ "!{projectRoot}/**/*.test.ts",
173
+ "!{projectRoot}/**/*.test.tsx",
174
+ "!{projectRoot}/**/*.test.mts",
175
+ "!{projectRoot}/vitest.config.*",
176
+ "!{projectRoot}/vitest.integration.config.*",
177
+ "!{projectRoot}/__tests__/**/*"
178
+ ],
179
+ "production": [
180
+ "sdkBuild",
181
+ "!{projectRoot}/src/cli/**/*"
182
+ ]
183
+ }
184
+ },
154
185
  "scripts": {
155
- "generate": "pnpm run generate:server-types && pnpm run generate:openapi-types",
186
+ "generate": "pnpm run generate:server-types",
156
187
  "cli": "node dist/cli/index.js",
157
188
  "prelint": "pnpm run generate",
158
189
  "lint": "eslint .",
159
190
  "pretest": "pnpm run generate",
160
- "test": "vitest",
161
- "test:unit": "vitest run --exclude '**/*.integration.test.ts'",
191
+ "test": "vitest run --exclude '**/*.integration.test.ts'",
162
192
  "test:e2e": "dotenv -- vitest run -c ./vitest.e2e.config.mts",
163
193
  "test:governance-e2e": "vitest run -c ./vitest.governance-e2e.config.mts",
164
- "test:seed": "dotenv -e .env.test -- bash -c 'cd ../../platform/app && pnpm prisma:seed'",
194
+ "test:seed": "dotenv -e .env.test -- pnpm -w run prisma:seed",
165
195
  "prebuild": "pnpm run generate",
166
- "build": "tsc --noEmit && rm -rf dist && tsup",
196
+ "build": "rm -rf dist && tsup",
167
197
  "postbuild": "node -e \"const{statSync}=require('node:fs'),{execFileSync}=require('node:child_process');const f='dist/cli/index.js',want=require('./package.json').version;const s=statSync(f);if(process.platform!=='win32'&&!(s.mode&0o111))throw new Error(f+' is not executable');const got=execFileSync(process.execPath,[f,'--version'],{encoding:'utf8',env:{...process.env,LANGWATCH_NO_DAEMON:'1'}}).trim();if(got!==want)throw new Error('version mismatch: '+f+' reports '+got+', package.json says '+want);console.log('postbuild: '+f+' ok ('+got+')')\"",
168
198
  "build:binary": "bun run scripts/build-cli-binary.ts",
169
199
  "tarball": "pnpm build && pnpm pack",
170
- "typecheck": "tsc --noEmit",
200
+ "typecheck": "GOMAXPROCS=2 GOMEMLIMIT=2GiB pnpm -w exec tsc -b sdks/typescript",
171
201
  "prepublish": "pnpm run build",
172
- "generate:openapi-types": "pnpm exec openapi-typescript ../../platform/app/src/app/api/openapiLangWatch.json -o ./src/internal/generated/openapi/api-client.ts && node scripts/patch-generated-openapi.mjs",
202
+ "generate:openapi-types": "node scripts/generate-openapi-types.mjs",
173
203
  "generate:server-types": "./copy-types.sh"
174
204
  }
175
205
  }
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/observability-sdk/processors/filterable-batch-span-processor.ts","../src/observability-sdk/features/data-capture/presets.ts"],"sourcesContent":["/**\n * Filterable Batch Span Exporter for OpenTelemetry\n *\n * This module provides a BatchSpanProcessor subclass that allows filtering of spans before export\n * based on configurable rules. Spans matching any exclude rule are dropped and not exported.\n *\n * @module filterable-batch-span-exporter\n */\n\nimport {\n BatchSpanProcessor,\n type ReadableSpan,\n type SpanExporter,\n} from '@opentelemetry/sdk-trace-base';\n\n/**\n * A rule for excluding spans from export based on their name or instrumentation scope name.\n *\n * @property fieldName - The span field to match against ('span_name' or 'instrumentation_scope_name').\n * @property matchValue - The value to match against the field.\n * @property matchOperation - The operation to use for matching ('includes', 'exact_match', 'starts_with', 'ends_with').\n *\n * @example\n * const rule: SpanProcessingExcludeRule = {\n * fieldName: 'span_name',\n * matchValue: 'heartbeat',\n * matchOperation: 'exact_match',\n * };\n */\nexport interface SpanProcessingExcludeRule {\n fieldName: \"span_name\" | \"instrumentation_scope_name\";\n matchValue: string;\n matchOperation: \"includes\" | \"exact_match\" | \"starts_with\" | \"ends_with\";\n}\n\n/**\n * A BatchSpanProcessor that filters out spans matching any of the provided exclude rules before export.\n *\n * This is useful for dropping noisy or irrelevant spans (e.g., health checks, heartbeats) from being exported to your tracing backend.\n *\n * @example\n * import { FilterableBatchSpanProcessor } from './filterable-batch-span-exporter';\n * import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';\n *\n * const exporter = new OTLPTraceExporter({ url: '...' });\n * const filters = [\n * { fieldName: 'span_name', matchValue: 'heartbeat', matchOperation: 'exact_match' },\n * { fieldName: 'instrumentation_scope_name', matchValue: 'internal', matchOperation: 'starts_with' },\n * ];\n * provider.addSpanProcessor(new FilterableBatchSpanProcessor(exporter, filters));\n */\nexport class FilterableBatchSpanProcessor extends BatchSpanProcessor {\n private readonly _filters: SpanProcessingExcludeRule[];\n\n /**\n * Create a new FilterableBatchSpanProcessor.\n *\n * @param exporter - The underlying SpanExporter to use for exporting spans.\n * @param filters - An array of rules for excluding spans from export.\n */\n constructor(exporter: SpanExporter, filters: SpanProcessingExcludeRule[]) {\n super(exporter);\n this._filters = filters;\n }\n\n /**\n * Called when a span ends. If the span matches any exclude rule, it is dropped and not exported.\n *\n * @param span - The ReadableSpan that has ended.\n */\n override onEnd(span: ReadableSpan): void {\n for (const filter of this._filters) {\n let sourceValue: string;\n\n if (filter.fieldName === \"span_name\") {\n sourceValue = span.name;\n } else if (filter.fieldName === \"instrumentation_scope_name\") {\n sourceValue = span.instrumentationScope.name;\n } else {\n continue;\n }\n\n const matchValue = filter.matchValue;\n const matchOperation = filter.matchOperation;\n\n switch (true) {\n case matchOperation === \"exact_match\" && sourceValue === matchValue:\n case matchOperation === \"includes\" && sourceValue.includes(matchValue):\n case matchOperation === \"starts_with\" && sourceValue.startsWith(matchValue):\n case matchOperation === \"ends_with\" && sourceValue.endsWith(matchValue):\n return;\n\n default: break;\n }\n }\n\n super.onEnd(span);\n }\n}\n","import { type DataCaptureMode } from \"./types\";\n\n/**\n * Predefined data capture configurations for common use cases.\n */\nexport const DataCapturePresets = {\n /**\n * Capture both input and output - useful for development and debugging.\n */\n CAPTURE_ALL: \"all\" as DataCaptureMode,\n\n /**\n * Capture nothing - useful for high-security environments.\n */\n CAPTURE_NONE: \"none\" as DataCaptureMode,\n\n /**\n * Capture only inputs - useful when you want to see what's being sent.\n */\n INPUT_ONLY: \"input\" as DataCaptureMode,\n\n /**\n * Capture only outputs - useful when you want to see responses.\n */\n OUTPUT_ONLY: \"output\" as DataCaptureMode,\n} as const;\n"],"mappings":";;;;;AASA;AAAA,EACE;AAAA,OAGK;AAsCA,IAAM,+BAAN,cAA2C,mBAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASnE,YAAY,UAAwB,SAAsC;AACxE,UAAM,QAAQ;AACd,SAAK,WAAW;AAAA,EAClB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOS,MAAM,MAA0B;AACvC,eAAW,UAAU,KAAK,UAAU;AAClC,UAAI;AAEJ,UAAI,OAAO,cAAc,aAAa;AACpC,sBAAc,KAAK;AAAA,MACrB,WAAW,OAAO,cAAc,8BAA8B;AAC5D,sBAAc,KAAK,qBAAqB;AAAA,MAC1C,OAAO;AACL;AAAA,MACF;AAEA,YAAM,aAAa,OAAO;AAC1B,YAAM,iBAAiB,OAAO;AAE9B,cAAQ,MAAM;AAAA,QACZ,MAAK,mBAAmB,iBAAiB,gBAAgB;AAAA,QACzD,MAAK,mBAAmB,cAAc,YAAY,SAAS,UAAU;AAAA,QACrE,MAAK,mBAAmB,iBAAiB,YAAY,WAAW,UAAU;AAAA,QAC1E,MAAK,mBAAmB,eAAe,YAAY,SAAS,UAAU;AACpE;AAAA,QAEF;AAAS;AAAA,MACX;AAAA,IACF;AAEA,UAAM,MAAM,IAAI;AAAA,EAClB;AACF;;;AC7FO,IAAM,qBAAqB;AAAA;AAAA;AAAA;AAAA,EAIhC,aAAa;AAAA;AAAA;AAAA;AAAA,EAKb,cAAc;AAAA;AAAA;AAAA;AAAA,EAKd,YAAY;AAAA;AAAA;AAAA;AAAA,EAKZ,aAAa;AACf;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["/home/runner/work/langwatch/langwatch/sdks/typescript/dist/chunk-73QOHSHU.js","../src/observability-sdk/processors/filterable-batch-span-processor.ts","../src/observability-sdk/features/data-capture/presets.ts"],"names":[],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B;AACA;ACKA;AACE;AAAA,6DAGK;AAsCA,IAAM,6BAAA,EAAN,MAAA,QAA2C,iCAAmB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASnE,WAAA,CAAY,QAAA,EAAwB,OAAA,EAAsC;AACxE,IAAA,KAAA,CAAM,QAAQ,CAAA;AACd,IAAA,IAAA,CAAK,SAAA,EAAW,OAAA;AAAA,EAClB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOS,KAAA,CAAM,IAAA,EAA0B;AACvC,IAAA,IAAA,CAAA,MAAW,OAAA,GAAU,IAAA,CAAK,QAAA,EAAU;AAClC,MAAA,IAAI,WAAA;AAEJ,MAAA,GAAA,CAAI,MAAA,CAAO,UAAA,IAAc,WAAA,EAAa;AACpC,QAAA,YAAA,EAAc,IAAA,CAAK,IAAA;AAAA,MACrB,EAAA,KAAA,GAAA,CAAW,MAAA,CAAO,UAAA,IAAc,4BAAA,EAA8B;AAC5D,QAAA,YAAA,EAAc,IAAA,CAAK,oBAAA,CAAqB,IAAA;AAAA,MAC1C,EAAA,KAAO;AACL,QAAA,QAAA;AAAA,MACF;AAEA,MAAA,MAAM,WAAA,EAAa,MAAA,CAAO,UAAA;AAC1B,MAAA,MAAM,eAAA,EAAiB,MAAA,CAAO,cAAA;AAE9B,MAAA,OAAA,CAAQ,IAAA,EAAM;AAAA,QACZ,KAAA,CAAK,eAAA,IAAmB,cAAA,GAAiB,YAAA,IAAgB,UAAA,CAAA;AAAA,QACzD,KAAA,CAAK,eAAA,IAAmB,WAAA,GAAc,WAAA,CAAY,QAAA,CAAS,UAAU,CAAA,CAAA;AAAA,QACrE,KAAA,CAAK,eAAA,IAAmB,cAAA,GAAiB,WAAA,CAAY,UAAA,CAAW,UAAU,CAAA,CAAA;AAAA,QAC1E,KAAA,CAAK,eAAA,IAAmB,YAAA,GAAe,WAAA,CAAY,QAAA,CAAS,UAAU,CAAA,CAAA;AACpE,UAAA,MAAA;AAAA,QAEF,OAAA;AAAS,UAAA,KAAA;AAAA,MACX;AAAA,IACF;AAEA,IAAA,KAAA,CAAM,KAAA,CAAM,IAAI,CAAA;AAAA,EAClB;AACF,CAAA;ADjDA;AACA;AE7CO,IAAM,mBAAA,EAAqB;AAAA;AAAA;AAAA;AAAA,EAIhC,WAAA,EAAa,KAAA;AAAA;AAAA;AAAA;AAAA,EAKb,YAAA,EAAc,MAAA;AAAA;AAAA;AAAA;AAAA,EAKd,UAAA,EAAY,OAAA;AAAA;AAAA;AAAA;AAAA,EAKZ,WAAA,EAAa;AACf,CAAA;AF4CA;AACA;AACE;AACA;AACF,qHAAC","file":"/home/runner/work/langwatch/langwatch/sdks/typescript/dist/chunk-73QOHSHU.js","sourcesContent":[null,"/**\n * Filterable Batch Span Exporter for OpenTelemetry\n *\n * This module provides a BatchSpanProcessor subclass that allows filtering of spans before export\n * based on configurable rules. Spans matching any exclude rule are dropped and not exported.\n *\n * @module filterable-batch-span-exporter\n */\n\nimport {\n BatchSpanProcessor,\n type ReadableSpan,\n type SpanExporter,\n} from '@opentelemetry/sdk-trace-base';\n\n/**\n * A rule for excluding spans from export based on their name or instrumentation scope name.\n *\n * @property fieldName - The span field to match against ('span_name' or 'instrumentation_scope_name').\n * @property matchValue - The value to match against the field.\n * @property matchOperation - The operation to use for matching ('includes', 'exact_match', 'starts_with', 'ends_with').\n *\n * @example\n * const rule: SpanProcessingExcludeRule = {\n * fieldName: 'span_name',\n * matchValue: 'heartbeat',\n * matchOperation: 'exact_match',\n * };\n */\nexport interface SpanProcessingExcludeRule {\n fieldName: \"span_name\" | \"instrumentation_scope_name\";\n matchValue: string;\n matchOperation: \"includes\" | \"exact_match\" | \"starts_with\" | \"ends_with\";\n}\n\n/**\n * A BatchSpanProcessor that filters out spans matching any of the provided exclude rules before export.\n *\n * This is useful for dropping noisy or irrelevant spans (e.g., health checks, heartbeats) from being exported to your tracing backend.\n *\n * @example\n * import { FilterableBatchSpanProcessor } from './filterable-batch-span-exporter';\n * import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';\n *\n * const exporter = new OTLPTraceExporter({ url: '...' });\n * const filters = [\n * { fieldName: 'span_name', matchValue: 'heartbeat', matchOperation: 'exact_match' },\n * { fieldName: 'instrumentation_scope_name', matchValue: 'internal', matchOperation: 'starts_with' },\n * ];\n * provider.addSpanProcessor(new FilterableBatchSpanProcessor(exporter, filters));\n */\nexport class FilterableBatchSpanProcessor extends BatchSpanProcessor {\n private readonly _filters: SpanProcessingExcludeRule[];\n\n /**\n * Create a new FilterableBatchSpanProcessor.\n *\n * @param exporter - The underlying SpanExporter to use for exporting spans.\n * @param filters - An array of rules for excluding spans from export.\n */\n constructor(exporter: SpanExporter, filters: SpanProcessingExcludeRule[]) {\n super(exporter);\n this._filters = filters;\n }\n\n /**\n * Called when a span ends. If the span matches any exclude rule, it is dropped and not exported.\n *\n * @param span - The ReadableSpan that has ended.\n */\n override onEnd(span: ReadableSpan): void {\n for (const filter of this._filters) {\n let sourceValue: string;\n\n if (filter.fieldName === \"span_name\") {\n sourceValue = span.name;\n } else if (filter.fieldName === \"instrumentation_scope_name\") {\n sourceValue = span.instrumentationScope.name;\n } else {\n continue;\n }\n\n const matchValue = filter.matchValue;\n const matchOperation = filter.matchOperation;\n\n switch (true) {\n case matchOperation === \"exact_match\" && sourceValue === matchValue:\n case matchOperation === \"includes\" && sourceValue.includes(matchValue):\n case matchOperation === \"starts_with\" && sourceValue.startsWith(matchValue):\n case matchOperation === \"ends_with\" && sourceValue.endsWith(matchValue):\n return;\n\n default: break;\n }\n }\n\n super.onEnd(span);\n }\n}\n","import { type DataCaptureMode } from \"./types\";\n\n/**\n * Predefined data capture configurations for common use cases.\n */\nexport const DataCapturePresets = {\n /**\n * Capture both input and output - useful for development and debugging.\n */\n CAPTURE_ALL: \"all\" as DataCaptureMode,\n\n /**\n * Capture nothing - useful for high-security environments.\n */\n CAPTURE_NONE: \"none\" as DataCaptureMode,\n\n /**\n * Capture only inputs - useful when you want to see what's being sent.\n */\n INPUT_ONLY: \"input\" as DataCaptureMode,\n\n /**\n * Capture only outputs - useful when you want to see responses.\n */\n OUTPUT_ONLY: \"output\" as DataCaptureMode,\n} as const;\n"]}