@iqai/adk 0.6.4 → 0.6.5

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.
@@ -0,0 +1,289 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/telemetry/constants.ts
20
+ var constants_exports = {};
21
+ __export(constants_exports, {
22
+ ADK_ATTRS: () => ADK_ATTRS,
23
+ ADK_SYSTEM_NAME: () => ADK_SYSTEM_NAME,
24
+ DEFAULTS: () => DEFAULTS,
25
+ ENV_VARS: () => ENV_VARS,
26
+ METRICS: () => METRICS,
27
+ OPERATIONS: () => OPERATIONS,
28
+ SEMCONV: () => SEMCONV,
29
+ SPAN_STATUS: () => SPAN_STATUS
30
+ });
31
+ module.exports = __toCommonJS(constants_exports);
32
+ var SEMCONV = {
33
+ // System identification (REQUIRED)
34
+ GEN_AI_PROVIDER_NAME: "gen_ai.provider.name",
35
+ // e.g., "openai", "anthropic", "aws.bedrock"
36
+ // Operation names (REQUIRED)
37
+ GEN_AI_OPERATION_NAME: "gen_ai.operation.name",
38
+ // Agent attributes
39
+ GEN_AI_AGENT_ID: "gen_ai.agent.id",
40
+ // Unique agent identifier
41
+ GEN_AI_AGENT_NAME: "gen_ai.agent.name",
42
+ GEN_AI_AGENT_DESCRIPTION: "gen_ai.agent.description",
43
+ GEN_AI_CONVERSATION_ID: "gen_ai.conversation.id",
44
+ // Tool attributes
45
+ GEN_AI_TOOL_NAME: "gen_ai.tool.name",
46
+ GEN_AI_TOOL_DESCRIPTION: "gen_ai.tool.description",
47
+ GEN_AI_TOOL_TYPE: "gen_ai.tool.type",
48
+ GEN_AI_TOOL_CALL_ID: "gen_ai.tool.call.id",
49
+ GEN_AI_TOOL_CALL_ARGUMENTS: "gen_ai.tool.call.arguments",
50
+ // Structured tool input (opt-in)
51
+ GEN_AI_TOOL_CALL_RESULT: "gen_ai.tool.call.result",
52
+ // Structured tool output (opt-in)
53
+ GEN_AI_TOOL_DEFINITIONS: "gen_ai.tool.definitions",
54
+ // Tool schemas (opt-in)
55
+ // LLM request attributes
56
+ GEN_AI_REQUEST_MODEL: "gen_ai.request.model",
57
+ // Conditionally required
58
+ GEN_AI_REQUEST_MAX_TOKENS: "gen_ai.request.max_tokens",
59
+ GEN_AI_REQUEST_TEMPERATURE: "gen_ai.request.temperature",
60
+ GEN_AI_REQUEST_TOP_P: "gen_ai.request.top_p",
61
+ GEN_AI_REQUEST_TOP_K: "gen_ai.request.top_k",
62
+ GEN_AI_REQUEST_FREQUENCY_PENALTY: "gen_ai.request.frequency_penalty",
63
+ GEN_AI_REQUEST_PRESENCE_PENALTY: "gen_ai.request.presence_penalty",
64
+ GEN_AI_REQUEST_STOP_SEQUENCES: "gen_ai.request.stop_sequences",
65
+ GEN_AI_REQUEST_CHOICE_COUNT: "gen_ai.request.choice.count",
66
+ // Conditionally required (if !=1)
67
+ GEN_AI_REQUEST_SEED: "gen_ai.request.seed",
68
+ // Conditionally required
69
+ // LLM response attributes
70
+ GEN_AI_RESPONSE_ID: "gen_ai.response.id",
71
+ // Recommended - completion ID
72
+ GEN_AI_RESPONSE_MODEL: "gen_ai.response.model",
73
+ // Recommended - actual model name returned
74
+ GEN_AI_RESPONSE_FINISH_REASONS: "gen_ai.response.finish_reasons",
75
+ GEN_AI_OUTPUT_TYPE: "gen_ai.output.type",
76
+ // Conditionally required - "text", "json", "image", "speech"
77
+ // Token usage (input/output only; total is computed client-side)
78
+ GEN_AI_USAGE_INPUT_TOKENS: "gen_ai.usage.input_tokens",
79
+ GEN_AI_USAGE_OUTPUT_TOKENS: "gen_ai.usage.output_tokens",
80
+ // Content attributes (opt-in, large/PII)
81
+ GEN_AI_SYSTEM_INSTRUCTIONS: "gen_ai.system_instructions",
82
+ // System prompt
83
+ GEN_AI_INPUT_MESSAGES: "gen_ai.input.messages",
84
+ // Full chat history input
85
+ GEN_AI_OUTPUT_MESSAGES: "gen_ai.output.messages",
86
+ // Model output messages
87
+ // Server attributes (Recommended)
88
+ SERVER_ADDRESS: "server.address",
89
+ // GenAI server host
90
+ SERVER_PORT: "server.port",
91
+ // Conditionally required if server.address is set
92
+ // Error attributes (Conditionally required on error)
93
+ ERROR_TYPE: "error.type",
94
+ // Low-cardinality error identifier
95
+ // Data source (for RAG/knowledge base)
96
+ GEN_AI_DATA_SOURCE_ID: "gen_ai.data_source.id",
97
+ // Embeddings (for future support)
98
+ GEN_AI_EMBEDDINGS_DIMENSION_COUNT: "gen_ai.embeddings.dimension.count",
99
+ GEN_AI_REQUEST_ENCODING_FORMATS: "gen_ai.request.encoding_formats",
100
+ // ============================================
101
+ // DEPRECATED ATTRIBUTES (kept for backward compatibility)
102
+ // These will be removed in a future release
103
+ // ============================================
104
+ /**
105
+ * @deprecated Use GEN_AI_PROVIDER_NAME instead
106
+ */
107
+ GEN_AI_SYSTEM: "gen_ai.system",
108
+ /**
109
+ * @deprecated Total tokens should be computed client-side from input + output
110
+ */
111
+ GEN_AI_USAGE_TOTAL_TOKENS: "gen_ai.usage.total_tokens",
112
+ /**
113
+ * @deprecated Use GEN_AI_INPUT_MESSAGES or structured events instead
114
+ */
115
+ GEN_AI_CONTENT_PROMPT: "gen_ai.content.prompt",
116
+ /**
117
+ * @deprecated Use GEN_AI_OUTPUT_MESSAGES or structured events instead
118
+ */
119
+ GEN_AI_CONTENT_COMPLETION: "gen_ai.content.completion"
120
+ };
121
+ var ADK_ATTRS = {
122
+ // ============================================
123
+ // TIER 1: Always Present (Core Identity)
124
+ // ============================================
125
+ // System identification
126
+ SYSTEM_NAME: "adk.system.name",
127
+ SYSTEM_VERSION: "adk.system.version",
128
+ // Session and context
129
+ SESSION_ID: "adk.session.id",
130
+ USER_ID: "adk.user.id",
131
+ INVOCATION_ID: "adk.invocation.id",
132
+ EVENT_ID: "adk.event.id",
133
+ // Environment
134
+ ENVIRONMENT: "adk.environment",
135
+ // ============================================
136
+ // TIER 2: Operation-Specific (Standard)
137
+ // ============================================
138
+ // Agent attributes
139
+ AGENT_NAME: "adk.agent.name",
140
+ AGENT_DESCRIPTION: "adk.agent.description",
141
+ // Transfer attributes (for multi-agent)
142
+ TRANSFER_SOURCE_AGENT: "adk.transfer.source_agent",
143
+ TRANSFER_TARGET_AGENT: "adk.transfer.target_agent",
144
+ TRANSFER_CHAIN: "adk.transfer.chain",
145
+ TRANSFER_DEPTH: "adk.transfer.depth",
146
+ TRANSFER_ROOT_AGENT: "adk.transfer.root_agent",
147
+ TRANSFER_REASON: "adk.transfer.reason",
148
+ // Tool attributes
149
+ TOOL_NAME: "adk.tool.name",
150
+ TOOL_ARGS: "adk.tool.args",
151
+ TOOL_RESPONSE: "adk.tool.response",
152
+ TOOL_EXECUTION_ORDER: "adk.tool.execution_order",
153
+ TOOL_PARALLEL_GROUP: "adk.tool.parallel_group",
154
+ TOOL_RETRY_COUNT: "adk.tool.retry_count",
155
+ TOOL_IS_CALLBACK_OVERRIDE: "adk.tool.is_callback_override",
156
+ // LLM attributes
157
+ LLM_MODEL: "adk.llm.model",
158
+ LLM_REQUEST: "adk.llm.request",
159
+ LLM_RESPONSE: "adk.llm.response",
160
+ LLM_STREAMING: "adk.llm.streaming",
161
+ LLM_TIME_TO_FIRST_TOKEN: "adk.llm.time_to_first_token_ms",
162
+ LLM_CHUNK_COUNT: "adk.llm.chunk_count",
163
+ LLM_CACHED_TOKENS: "adk.llm.cached_tokens",
164
+ LLM_CONTEXT_WINDOW_USED_PCT: "adk.llm.context_window_used_pct",
165
+ // Callback attributes
166
+ CALLBACK_TYPE: "adk.callback.type",
167
+ CALLBACK_NAME: "adk.callback.name",
168
+ CALLBACK_INDEX: "adk.callback.index",
169
+ // ============================================
170
+ // Error Categorization
171
+ // ============================================
172
+ ERROR_CATEGORY: "adk.error.category",
173
+ ERROR_RECOVERABLE: "adk.error.recoverable",
174
+ ERROR_RETRY_RECOMMENDED: "adk.error.retry_recommended",
175
+ // ============================================
176
+ // Memory & Session
177
+ // ============================================
178
+ MEMORY_QUERY: "adk.memory.query",
179
+ MEMORY_RESULTS_COUNT: "adk.memory.results_count",
180
+ // Plugin
181
+ PLUGIN_NAME: "adk.plugin.name",
182
+ PLUGIN_HOOK: "adk.plugin.hook"
183
+ };
184
+ var OPERATIONS = {
185
+ // ============================================
186
+ // Standard OpenTelemetry GenAI operations
187
+ // ============================================
188
+ CHAT: "chat",
189
+ // Chat completion (most common)
190
+ TEXT_COMPLETION: "text_completion",
191
+ // Legacy text completion
192
+ GENERATE_CONTENT: "generate_content",
193
+ // Generic content generation
194
+ // Agent operations
195
+ INVOKE_AGENT: "invoke_agent",
196
+ CREATE_AGENT: "create_agent",
197
+ // Tool operations
198
+ EXECUTE_TOOL: "execute_tool",
199
+ // ============================================
200
+ // ADK-specific operations (framework extensions)
201
+ // These are non-standard but useful for the ADK framework
202
+ // ============================================
203
+ TRANSFER_AGENT: "transfer_agent",
204
+ // Multi-agent transfer
205
+ EXECUTE_CALLBACK: "execute_callback",
206
+ // Callback execution
207
+ // Service operations
208
+ SEARCH_MEMORY: "search_memory",
209
+ // Memory search
210
+ INSERT_MEMORY: "insert_memory",
211
+ // Memory insert
212
+ EXECUTE_PLUGIN: "execute_plugin",
213
+ // Plugin execution
214
+ // ============================================
215
+ // DEPRECATED OPERATIONS (kept for backward compatibility)
216
+ // ============================================
217
+ /**
218
+ * @deprecated Use CHAT, TEXT_COMPLETION, or GENERATE_CONTENT instead
219
+ */
220
+ CALL_LLM: "call_llm"
221
+ };
222
+ var ADK_SYSTEM_NAME = "iqai-adk";
223
+ var ENV_VARS = {
224
+ // Privacy control
225
+ CAPTURE_MESSAGE_CONTENT: "ADK_CAPTURE_MESSAGE_CONTENT",
226
+ // OpenTelemetry standard env vars
227
+ OTEL_SERVICE_NAME: "OTEL_SERVICE_NAME",
228
+ OTEL_RESOURCE_ATTRIBUTES: "OTEL_RESOURCE_ATTRIBUTES",
229
+ OTEL_EXPORTER_OTLP_ENDPOINT: "OTEL_EXPORTER_OTLP_ENDPOINT",
230
+ OTEL_EXPORTER_OTLP_HEADERS: "OTEL_EXPORTER_OTLP_HEADERS",
231
+ // Node environment
232
+ NODE_ENV: "NODE_ENV"
233
+ };
234
+ var METRICS = {
235
+ // ============================================
236
+ // Standard OpenTelemetry GenAI Metrics
237
+ // Reference: https://opentelemetry.io/docs/specs/semconv/gen-ai/gen-ai-metrics/
238
+ // ============================================
239
+ // Required: Client operation duration (Histogram, seconds)
240
+ GEN_AI_CLIENT_OPERATION_DURATION: "gen_ai.client.operation.duration",
241
+ // Recommended: Token usage (Histogram, tokens)
242
+ // Use with gen_ai.token.type attribute: "input" or "output"
243
+ GEN_AI_CLIENT_TOKEN_USAGE: "gen_ai.client.token.usage",
244
+ // Server-side metrics (if hosting GenAI service)
245
+ GEN_AI_SERVER_REQUEST_DURATION: "gen_ai.server.request.duration",
246
+ GEN_AI_SERVER_TIME_TO_FIRST_TOKEN: "gen_ai.server.time_to_first_token",
247
+ GEN_AI_SERVER_TIME_PER_OUTPUT_TOKEN: "gen_ai.server.time_per_output_token",
248
+ // ============================================
249
+ // ADK-specific Metrics (framework extensions)
250
+ // ============================================
251
+ // Counters
252
+ AGENT_INVOCATIONS: "adk.agent.invocations",
253
+ TOOL_EXECUTIONS: "adk.tool.executions",
254
+ LLM_CALLS: "adk.llm.calls",
255
+ ERRORS: "adk.errors",
256
+ // Histograms
257
+ AGENT_DURATION: "adk.agent.duration",
258
+ TOOL_DURATION: "adk.tool.duration",
259
+ LLM_DURATION: "adk.llm.duration",
260
+ LLM_TOKENS: "adk.llm.tokens",
261
+ LLM_INPUT_TOKENS: "adk.llm.tokens.input",
262
+ LLM_OUTPUT_TOKENS: "adk.llm.tokens.output"
263
+ };
264
+ var SPAN_STATUS = {
265
+ UNSET: 0,
266
+ OK: 1,
267
+ ERROR: 2
268
+ };
269
+ var DEFAULTS = {
270
+ SAMPLING_RATIO: 1,
271
+ METRIC_EXPORT_INTERVAL_MS: 6e4,
272
+ // 1 minute
273
+ SHUTDOWN_TIMEOUT_MS: 5e3,
274
+ CAPTURE_MESSAGE_CONTENT: true,
275
+ ENABLE_TRACING: true,
276
+ ENABLE_METRICS: true,
277
+ ENABLE_AUTO_INSTRUMENTATION: false
278
+ };
279
+ // Annotate the CommonJS export names for ESM import in node:
280
+ 0 && (module.exports = {
281
+ ADK_ATTRS,
282
+ ADK_SYSTEM_NAME,
283
+ DEFAULTS,
284
+ ENV_VARS,
285
+ METRICS,
286
+ OPERATIONS,
287
+ SEMCONV,
288
+ SPAN_STATUS
289
+ });
@@ -0,0 +1,258 @@
1
+ // src/telemetry/constants.ts
2
+ var SEMCONV = {
3
+ // System identification (REQUIRED)
4
+ GEN_AI_PROVIDER_NAME: "gen_ai.provider.name",
5
+ // e.g., "openai", "anthropic", "aws.bedrock"
6
+ // Operation names (REQUIRED)
7
+ GEN_AI_OPERATION_NAME: "gen_ai.operation.name",
8
+ // Agent attributes
9
+ GEN_AI_AGENT_ID: "gen_ai.agent.id",
10
+ // Unique agent identifier
11
+ GEN_AI_AGENT_NAME: "gen_ai.agent.name",
12
+ GEN_AI_AGENT_DESCRIPTION: "gen_ai.agent.description",
13
+ GEN_AI_CONVERSATION_ID: "gen_ai.conversation.id",
14
+ // Tool attributes
15
+ GEN_AI_TOOL_NAME: "gen_ai.tool.name",
16
+ GEN_AI_TOOL_DESCRIPTION: "gen_ai.tool.description",
17
+ GEN_AI_TOOL_TYPE: "gen_ai.tool.type",
18
+ GEN_AI_TOOL_CALL_ID: "gen_ai.tool.call.id",
19
+ GEN_AI_TOOL_CALL_ARGUMENTS: "gen_ai.tool.call.arguments",
20
+ // Structured tool input (opt-in)
21
+ GEN_AI_TOOL_CALL_RESULT: "gen_ai.tool.call.result",
22
+ // Structured tool output (opt-in)
23
+ GEN_AI_TOOL_DEFINITIONS: "gen_ai.tool.definitions",
24
+ // Tool schemas (opt-in)
25
+ // LLM request attributes
26
+ GEN_AI_REQUEST_MODEL: "gen_ai.request.model",
27
+ // Conditionally required
28
+ GEN_AI_REQUEST_MAX_TOKENS: "gen_ai.request.max_tokens",
29
+ GEN_AI_REQUEST_TEMPERATURE: "gen_ai.request.temperature",
30
+ GEN_AI_REQUEST_TOP_P: "gen_ai.request.top_p",
31
+ GEN_AI_REQUEST_TOP_K: "gen_ai.request.top_k",
32
+ GEN_AI_REQUEST_FREQUENCY_PENALTY: "gen_ai.request.frequency_penalty",
33
+ GEN_AI_REQUEST_PRESENCE_PENALTY: "gen_ai.request.presence_penalty",
34
+ GEN_AI_REQUEST_STOP_SEQUENCES: "gen_ai.request.stop_sequences",
35
+ GEN_AI_REQUEST_CHOICE_COUNT: "gen_ai.request.choice.count",
36
+ // Conditionally required (if !=1)
37
+ GEN_AI_REQUEST_SEED: "gen_ai.request.seed",
38
+ // Conditionally required
39
+ // LLM response attributes
40
+ GEN_AI_RESPONSE_ID: "gen_ai.response.id",
41
+ // Recommended - completion ID
42
+ GEN_AI_RESPONSE_MODEL: "gen_ai.response.model",
43
+ // Recommended - actual model name returned
44
+ GEN_AI_RESPONSE_FINISH_REASONS: "gen_ai.response.finish_reasons",
45
+ GEN_AI_OUTPUT_TYPE: "gen_ai.output.type",
46
+ // Conditionally required - "text", "json", "image", "speech"
47
+ // Token usage (input/output only; total is computed client-side)
48
+ GEN_AI_USAGE_INPUT_TOKENS: "gen_ai.usage.input_tokens",
49
+ GEN_AI_USAGE_OUTPUT_TOKENS: "gen_ai.usage.output_tokens",
50
+ // Content attributes (opt-in, large/PII)
51
+ GEN_AI_SYSTEM_INSTRUCTIONS: "gen_ai.system_instructions",
52
+ // System prompt
53
+ GEN_AI_INPUT_MESSAGES: "gen_ai.input.messages",
54
+ // Full chat history input
55
+ GEN_AI_OUTPUT_MESSAGES: "gen_ai.output.messages",
56
+ // Model output messages
57
+ // Server attributes (Recommended)
58
+ SERVER_ADDRESS: "server.address",
59
+ // GenAI server host
60
+ SERVER_PORT: "server.port",
61
+ // Conditionally required if server.address is set
62
+ // Error attributes (Conditionally required on error)
63
+ ERROR_TYPE: "error.type",
64
+ // Low-cardinality error identifier
65
+ // Data source (for RAG/knowledge base)
66
+ GEN_AI_DATA_SOURCE_ID: "gen_ai.data_source.id",
67
+ // Embeddings (for future support)
68
+ GEN_AI_EMBEDDINGS_DIMENSION_COUNT: "gen_ai.embeddings.dimension.count",
69
+ GEN_AI_REQUEST_ENCODING_FORMATS: "gen_ai.request.encoding_formats",
70
+ // ============================================
71
+ // DEPRECATED ATTRIBUTES (kept for backward compatibility)
72
+ // These will be removed in a future release
73
+ // ============================================
74
+ /**
75
+ * @deprecated Use GEN_AI_PROVIDER_NAME instead
76
+ */
77
+ GEN_AI_SYSTEM: "gen_ai.system",
78
+ /**
79
+ * @deprecated Total tokens should be computed client-side from input + output
80
+ */
81
+ GEN_AI_USAGE_TOTAL_TOKENS: "gen_ai.usage.total_tokens",
82
+ /**
83
+ * @deprecated Use GEN_AI_INPUT_MESSAGES or structured events instead
84
+ */
85
+ GEN_AI_CONTENT_PROMPT: "gen_ai.content.prompt",
86
+ /**
87
+ * @deprecated Use GEN_AI_OUTPUT_MESSAGES or structured events instead
88
+ */
89
+ GEN_AI_CONTENT_COMPLETION: "gen_ai.content.completion"
90
+ };
91
+ var ADK_ATTRS = {
92
+ // ============================================
93
+ // TIER 1: Always Present (Core Identity)
94
+ // ============================================
95
+ // System identification
96
+ SYSTEM_NAME: "adk.system.name",
97
+ SYSTEM_VERSION: "adk.system.version",
98
+ // Session and context
99
+ SESSION_ID: "adk.session.id",
100
+ USER_ID: "adk.user.id",
101
+ INVOCATION_ID: "adk.invocation.id",
102
+ EVENT_ID: "adk.event.id",
103
+ // Environment
104
+ ENVIRONMENT: "adk.environment",
105
+ // ============================================
106
+ // TIER 2: Operation-Specific (Standard)
107
+ // ============================================
108
+ // Agent attributes
109
+ AGENT_NAME: "adk.agent.name",
110
+ AGENT_DESCRIPTION: "adk.agent.description",
111
+ // Transfer attributes (for multi-agent)
112
+ TRANSFER_SOURCE_AGENT: "adk.transfer.source_agent",
113
+ TRANSFER_TARGET_AGENT: "adk.transfer.target_agent",
114
+ TRANSFER_CHAIN: "adk.transfer.chain",
115
+ TRANSFER_DEPTH: "adk.transfer.depth",
116
+ TRANSFER_ROOT_AGENT: "adk.transfer.root_agent",
117
+ TRANSFER_REASON: "adk.transfer.reason",
118
+ // Tool attributes
119
+ TOOL_NAME: "adk.tool.name",
120
+ TOOL_ARGS: "adk.tool.args",
121
+ TOOL_RESPONSE: "adk.tool.response",
122
+ TOOL_EXECUTION_ORDER: "adk.tool.execution_order",
123
+ TOOL_PARALLEL_GROUP: "adk.tool.parallel_group",
124
+ TOOL_RETRY_COUNT: "adk.tool.retry_count",
125
+ TOOL_IS_CALLBACK_OVERRIDE: "adk.tool.is_callback_override",
126
+ // LLM attributes
127
+ LLM_MODEL: "adk.llm.model",
128
+ LLM_REQUEST: "adk.llm.request",
129
+ LLM_RESPONSE: "adk.llm.response",
130
+ LLM_STREAMING: "adk.llm.streaming",
131
+ LLM_TIME_TO_FIRST_TOKEN: "adk.llm.time_to_first_token_ms",
132
+ LLM_CHUNK_COUNT: "adk.llm.chunk_count",
133
+ LLM_CACHED_TOKENS: "adk.llm.cached_tokens",
134
+ LLM_CONTEXT_WINDOW_USED_PCT: "adk.llm.context_window_used_pct",
135
+ // Callback attributes
136
+ CALLBACK_TYPE: "adk.callback.type",
137
+ CALLBACK_NAME: "adk.callback.name",
138
+ CALLBACK_INDEX: "adk.callback.index",
139
+ // ============================================
140
+ // Error Categorization
141
+ // ============================================
142
+ ERROR_CATEGORY: "adk.error.category",
143
+ ERROR_RECOVERABLE: "adk.error.recoverable",
144
+ ERROR_RETRY_RECOMMENDED: "adk.error.retry_recommended",
145
+ // ============================================
146
+ // Memory & Session
147
+ // ============================================
148
+ MEMORY_QUERY: "adk.memory.query",
149
+ MEMORY_RESULTS_COUNT: "adk.memory.results_count",
150
+ // Plugin
151
+ PLUGIN_NAME: "adk.plugin.name",
152
+ PLUGIN_HOOK: "adk.plugin.hook"
153
+ };
154
+ var OPERATIONS = {
155
+ // ============================================
156
+ // Standard OpenTelemetry GenAI operations
157
+ // ============================================
158
+ CHAT: "chat",
159
+ // Chat completion (most common)
160
+ TEXT_COMPLETION: "text_completion",
161
+ // Legacy text completion
162
+ GENERATE_CONTENT: "generate_content",
163
+ // Generic content generation
164
+ // Agent operations
165
+ INVOKE_AGENT: "invoke_agent",
166
+ CREATE_AGENT: "create_agent",
167
+ // Tool operations
168
+ EXECUTE_TOOL: "execute_tool",
169
+ // ============================================
170
+ // ADK-specific operations (framework extensions)
171
+ // These are non-standard but useful for the ADK framework
172
+ // ============================================
173
+ TRANSFER_AGENT: "transfer_agent",
174
+ // Multi-agent transfer
175
+ EXECUTE_CALLBACK: "execute_callback",
176
+ // Callback execution
177
+ // Service operations
178
+ SEARCH_MEMORY: "search_memory",
179
+ // Memory search
180
+ INSERT_MEMORY: "insert_memory",
181
+ // Memory insert
182
+ EXECUTE_PLUGIN: "execute_plugin",
183
+ // Plugin execution
184
+ // ============================================
185
+ // DEPRECATED OPERATIONS (kept for backward compatibility)
186
+ // ============================================
187
+ /**
188
+ * @deprecated Use CHAT, TEXT_COMPLETION, or GENERATE_CONTENT instead
189
+ */
190
+ CALL_LLM: "call_llm"
191
+ };
192
+ var ADK_SYSTEM_NAME = "iqai-adk";
193
+ var ENV_VARS = {
194
+ // Privacy control
195
+ CAPTURE_MESSAGE_CONTENT: "ADK_CAPTURE_MESSAGE_CONTENT",
196
+ // OpenTelemetry standard env vars
197
+ OTEL_SERVICE_NAME: "OTEL_SERVICE_NAME",
198
+ OTEL_RESOURCE_ATTRIBUTES: "OTEL_RESOURCE_ATTRIBUTES",
199
+ OTEL_EXPORTER_OTLP_ENDPOINT: "OTEL_EXPORTER_OTLP_ENDPOINT",
200
+ OTEL_EXPORTER_OTLP_HEADERS: "OTEL_EXPORTER_OTLP_HEADERS",
201
+ // Node environment
202
+ NODE_ENV: "NODE_ENV"
203
+ };
204
+ var METRICS = {
205
+ // ============================================
206
+ // Standard OpenTelemetry GenAI Metrics
207
+ // Reference: https://opentelemetry.io/docs/specs/semconv/gen-ai/gen-ai-metrics/
208
+ // ============================================
209
+ // Required: Client operation duration (Histogram, seconds)
210
+ GEN_AI_CLIENT_OPERATION_DURATION: "gen_ai.client.operation.duration",
211
+ // Recommended: Token usage (Histogram, tokens)
212
+ // Use with gen_ai.token.type attribute: "input" or "output"
213
+ GEN_AI_CLIENT_TOKEN_USAGE: "gen_ai.client.token.usage",
214
+ // Server-side metrics (if hosting GenAI service)
215
+ GEN_AI_SERVER_REQUEST_DURATION: "gen_ai.server.request.duration",
216
+ GEN_AI_SERVER_TIME_TO_FIRST_TOKEN: "gen_ai.server.time_to_first_token",
217
+ GEN_AI_SERVER_TIME_PER_OUTPUT_TOKEN: "gen_ai.server.time_per_output_token",
218
+ // ============================================
219
+ // ADK-specific Metrics (framework extensions)
220
+ // ============================================
221
+ // Counters
222
+ AGENT_INVOCATIONS: "adk.agent.invocations",
223
+ TOOL_EXECUTIONS: "adk.tool.executions",
224
+ LLM_CALLS: "adk.llm.calls",
225
+ ERRORS: "adk.errors",
226
+ // Histograms
227
+ AGENT_DURATION: "adk.agent.duration",
228
+ TOOL_DURATION: "adk.tool.duration",
229
+ LLM_DURATION: "adk.llm.duration",
230
+ LLM_TOKENS: "adk.llm.tokens",
231
+ LLM_INPUT_TOKENS: "adk.llm.tokens.input",
232
+ LLM_OUTPUT_TOKENS: "adk.llm.tokens.output"
233
+ };
234
+ var SPAN_STATUS = {
235
+ UNSET: 0,
236
+ OK: 1,
237
+ ERROR: 2
238
+ };
239
+ var DEFAULTS = {
240
+ SAMPLING_RATIO: 1,
241
+ METRIC_EXPORT_INTERVAL_MS: 6e4,
242
+ // 1 minute
243
+ SHUTDOWN_TIMEOUT_MS: 5e3,
244
+ CAPTURE_MESSAGE_CONTENT: true,
245
+ ENABLE_TRACING: true,
246
+ ENABLE_METRICS: true,
247
+ ENABLE_AUTO_INSTRUMENTATION: false
248
+ };
249
+ export {
250
+ ADK_ATTRS,
251
+ ADK_SYSTEM_NAME,
252
+ DEFAULTS,
253
+ ENV_VARS,
254
+ METRICS,
255
+ OPERATIONS,
256
+ SEMCONV,
257
+ SPAN_STATUS
258
+ };