@runtypelabs/flue-otel 0.5.3 → 0.5.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.
package/dist/index.d.cts CHANGED
@@ -1,49 +1,49 @@
1
- import { Tracer } from '@opentelemetry/api';
2
-
1
+ import { Tracer } from "@opentelemetry/api";
2
+ //#region src/flue-types.d.ts
3
3
  /** Correlation fields stamped onto every delivered observation. */
4
4
  interface FlueEventEnvelope {
5
- /** Durable event-format version. `3` on both supported lines. */
6
- v?: number;
7
- eventIndex?: number;
8
- timestamp?: string;
9
- instanceId?: string;
10
- submissionId?: string;
11
- agentName?: string;
12
- conversationId?: string;
13
- session?: string;
14
- parentSession?: string;
15
- taskId?: string;
16
- harness?: string;
17
- operationId?: string;
18
- turnId?: string;
5
+ /** Durable event-format version. `3` on both supported lines. */
6
+ v?: number;
7
+ eventIndex?: number;
8
+ timestamp?: string;
9
+ instanceId?: string;
10
+ submissionId?: string;
11
+ agentName?: string;
12
+ conversationId?: string;
13
+ session?: string;
14
+ parentSession?: string;
15
+ taskId?: string;
16
+ harness?: string;
17
+ operationId?: string;
18
+ turnId?: string;
19
19
  }
20
20
  /** Token counts and cost for one model turn. Byte-identical on both lines. */
21
21
  interface FluePromptUsage {
22
+ input: number;
23
+ output: number;
24
+ cacheRead: number;
25
+ cacheWrite: number;
26
+ totalTokens: number;
27
+ cost?: {
22
28
  input: number;
23
29
  output: number;
24
30
  cacheRead: number;
25
31
  cacheWrite: number;
26
- totalTokens: number;
27
- cost?: {
28
- input: number;
29
- output: number;
30
- cacheRead: number;
31
- cacheWrite: number;
32
- total: number;
33
- };
32
+ total: number;
33
+ };
34
34
  }
35
35
  /** The non-content half of a model request. */
36
36
  interface FlueModelRequestInfo {
37
- providerId?: string;
38
- providerName?: string;
39
- requestedModel?: string;
40
- api?: string;
41
- serverAddress?: string;
42
- serverPort?: number;
43
- reasoningLevel?: string;
44
- maxTokens?: number;
45
- temperature?: number;
46
- contextCompacted?: true;
37
+ providerId?: string;
38
+ providerName?: string;
39
+ requestedModel?: string;
40
+ api?: string;
41
+ serverAddress?: string;
42
+ serverPort?: number;
43
+ reasoningLevel?: string;
44
+ maxTokens?: number;
45
+ temperature?: number;
46
+ contextCompacted?: true;
47
47
  }
48
48
  /**
49
49
  * The request's payload half. `tools` is read for its PRESENCE only (`runtype.tools.reported`).
@@ -51,41 +51,41 @@ interface FlueModelRequestInfo {
51
51
  * byte-identical on both lines, read only when message content is opted in — see `messages.ts`.
52
52
  */
53
53
  interface FlueModelRequestInput {
54
- systemPrompt?: string;
55
- messages?: unknown[];
56
- tools?: unknown[];
54
+ systemPrompt?: string;
55
+ messages?: unknown[];
56
+ tools?: unknown[];
57
57
  }
58
58
  interface FlueModelRequest extends FlueModelRequestInfo {
59
- input?: FlueModelRequestInput;
59
+ input?: FlueModelRequestInput;
60
60
  }
61
61
  interface FlueModelResponse {
62
- responseId?: string;
63
- responseModel?: string;
64
- /** The assistant message this turn produced, in Flue's normalized `LlmAssistantMessage` shape. */
65
- output?: unknown;
66
- usage?: FluePromptUsage;
67
- finishReason?: string;
68
- /** 2.x only. The provider's raw finish value before normalization. */
69
- providerFinishReason?: string;
70
- /**
71
- * The response's own gateway log id (e.g. Cloudflare AI Gateway's
72
- * `cf-aig-log-id`), for correlating a specific turn with its entry in the
73
- * gateway dashboard. Telemetry only — present only when the provider records
74
- * one. The Workers AI provider attaches it today.
75
- */
76
- gatewayLogId?: string;
77
- error?: FlueErrorInfo;
62
+ responseId?: string;
63
+ responseModel?: string;
64
+ /** The assistant message this turn produced, in Flue's normalized `LlmAssistantMessage` shape. */
65
+ output?: unknown;
66
+ usage?: FluePromptUsage;
67
+ finishReason?: string;
68
+ /** 2.x only. The provider's raw finish value before normalization. */
69
+ providerFinishReason?: string;
70
+ /**
71
+ * The response's own gateway log id (e.g. Cloudflare AI Gateway's
72
+ * `cf-aig-log-id`), for correlating a specific turn with its entry in the
73
+ * gateway dashboard. Telemetry only — present only when the provider records
74
+ * one. The Workers AI provider attaches it today.
75
+ */
76
+ gatewayLogId?: string;
77
+ error?: FlueErrorInfo;
78
78
  }
79
79
  /**
80
80
  * Classified error details. stack is described but never read or exported because it can expose
81
81
  * deployment paths.
82
82
  */
83
83
  interface FlueErrorInfo {
84
- type?: string;
85
- name?: string;
86
- message?: string;
87
- stack?: string;
88
- meta?: Record<string, unknown>;
84
+ type?: string;
85
+ name?: string;
86
+ message?: string;
87
+ stack?: string;
88
+ meta?: Record<string, unknown>;
89
89
  }
90
90
  /** 1.x-only implementation-class axis; absent on 2.x. */
91
91
  type FlueToolSemanticType = 'function' | 'extension' | 'datastore';
@@ -96,10 +96,10 @@ type FlueToolOrigin = 'model' | 'caller' | 'framework' | 'adapter';
96
96
  * `toolType` exists only on 1.x, which is what `compat.ts` probes for.
97
97
  */
98
98
  interface FlueObservationDetail {
99
- origin?: FlueToolOrigin;
100
- toolType?: FlueToolSemanticType;
101
- toolCallId?: string;
102
- errorInfo?: FlueErrorInfo;
99
+ origin?: FlueToolOrigin;
100
+ toolType?: FlueToolSemanticType;
101
+ toolCallId?: string;
102
+ errorInfo?: FlueErrorInfo;
103
103
  }
104
104
  /**
105
105
  * The event variants this package acts on. Every other variant Flue emits is
@@ -107,69 +107,69 @@ interface FlueObservationDetail {
107
107
  * through the projection's switch untouched.
108
108
  */
109
109
  type FlueEventVariant = {
110
- type: 'operation_start';
111
- operationId: string;
112
- operationKind: string;
110
+ type: 'operation_start';
111
+ operationId: string;
112
+ operationKind: string;
113
113
  } | {
114
- type: 'operation';
115
- operationId: string;
116
- operationKind: string;
117
- durationMs?: number;
118
- isError?: boolean;
119
- error?: unknown;
120
- usage?: FluePromptUsage;
114
+ type: 'operation';
115
+ operationId: string;
116
+ operationKind: string;
117
+ durationMs?: number;
118
+ isError?: boolean;
119
+ error?: unknown;
120
+ usage?: FluePromptUsage;
121
121
  } | {
122
- type: 'task_start';
123
- taskId: string;
124
- prompt?: string;
125
- agent?: string;
122
+ type: 'task_start';
123
+ taskId: string;
124
+ prompt?: string;
125
+ agent?: string;
126
126
  } | {
127
- type: 'task';
128
- taskId: string;
129
- agent?: string;
130
- isError?: boolean;
131
- result?: unknown;
127
+ type: 'task';
128
+ taskId: string;
129
+ agent?: string;
130
+ isError?: boolean;
131
+ result?: unknown;
132
132
  } | {
133
- type: 'compaction_start';
134
- reason?: string;
135
- estimatedTokens?: number;
133
+ type: 'compaction_start';
134
+ reason?: string;
135
+ estimatedTokens?: number;
136
136
  } | {
137
- type: 'compaction';
138
- isError?: boolean;
139
- error?: unknown;
140
- usage?: FluePromptUsage;
137
+ type: 'compaction';
138
+ isError?: boolean;
139
+ error?: unknown;
140
+ usage?: FluePromptUsage;
141
141
  } | {
142
- type: 'turn_request';
143
- turnId: string;
144
- purpose?: string;
145
- request: FlueModelRequest;
142
+ type: 'turn_request';
143
+ turnId: string;
144
+ purpose?: string;
145
+ request: FlueModelRequest;
146
146
  } | {
147
- type: 'turn';
148
- turnId: string;
149
- purpose?: string;
150
- durationMs?: number;
151
- request?: FlueModelRequestInfo;
152
- response: FlueModelResponse;
153
- isError?: boolean;
147
+ type: 'turn';
148
+ turnId: string;
149
+ purpose?: string;
150
+ durationMs?: number;
151
+ request?: FlueModelRequestInfo;
152
+ response: FlueModelResponse;
153
+ isError?: boolean;
154
154
  } | {
155
- type: 'tool_start';
156
- toolName: string;
157
- toolCallId: string;
158
- args?: unknown;
155
+ type: 'tool_start';
156
+ toolName: string;
157
+ toolCallId: string;
158
+ args?: unknown;
159
159
  } | {
160
- type: 'tool';
161
- toolName: string;
162
- toolCallId: string;
163
- isError?: boolean;
164
- result?: unknown;
165
- effectiveResult?: unknown;
166
- durationMs?: number;
160
+ type: 'tool';
161
+ toolName: string;
162
+ toolCallId: string;
163
+ isError?: boolean;
164
+ result?: unknown;
165
+ effectiveResult?: unknown;
166
+ durationMs?: number;
167
167
  } | {
168
- type: 'submission_settled';
169
- submissionId: string;
170
- outcome: string;
168
+ type: 'submission_settled';
169
+ submissionId: string;
170
+ outcome: string;
171
171
  } | {
172
- type: string;
172
+ type: string;
173
173
  };
174
174
  /** One delivered observation: an event, its envelope, and its detail sidecar. */
175
175
  type FlueObservation = FlueEventVariant & FlueEventEnvelope & FlueObservationDetail;
@@ -178,50 +178,50 @@ type FlueObservation = FlueEventVariant & FlueEventEnvelope & FlueObservationDet
178
178
  * matters here — the fields this package needs all live on the envelope.
179
179
  */
180
180
  interface FlueEventContext {
181
- readonly id?: string;
182
- readonly agentName?: string;
181
+ readonly id?: string;
182
+ readonly agentName?: string;
183
183
  }
184
184
  /** W3C trace context offered by the host on a detached execution. */
185
185
  interface FlueTraceCarrier {
186
- traceparent: string;
187
- tracestate?: string;
186
+ traceparent: string;
187
+ tracestate?: string;
188
188
  }
189
189
  /**
190
190
  * The operation the interceptor wraps. `coordinator` exists on 2.x only; the
191
191
  * open arm makes an unknown future kind fall through rather than crash.
192
192
  */
193
193
  type FlueExecutionOperation = {
194
- type: 'agent';
195
- operationId: string;
196
- operationKind?: string;
194
+ type: 'agent';
195
+ operationId: string;
196
+ operationKind?: string;
197
197
  } | {
198
- type: 'model';
199
- turnId: string;
198
+ type: 'model';
199
+ turnId: string;
200
200
  } | {
201
- type: 'tool';
202
- toolCallId: string;
203
- toolName?: string;
201
+ type: 'tool';
202
+ toolCallId: string;
203
+ toolName?: string;
204
204
  } | {
205
- type: 'task';
206
- taskId: string;
205
+ type: 'task';
206
+ taskId: string;
207
207
  } | {
208
- type: 'coordinator';
209
- phase?: string;
208
+ type: 'coordinator';
209
+ phase?: string;
210
210
  } | {
211
- type: string;
211
+ type: string;
212
212
  };
213
213
  interface FlueExecutionContext {
214
- eventContext?: FlueEventContext;
215
- instanceId?: string;
216
- submissionId?: string;
217
- agentName?: string;
218
- conversationId?: string;
219
- harness?: string;
220
- session?: string;
221
- operationId?: string;
222
- turnId?: string;
223
- taskId?: string;
224
- traceCarrier?: FlueTraceCarrier;
214
+ eventContext?: FlueEventContext;
215
+ instanceId?: string;
216
+ submissionId?: string;
217
+ agentName?: string;
218
+ conversationId?: string;
219
+ harness?: string;
220
+ session?: string;
221
+ operationId?: string;
222
+ turnId?: string;
223
+ taskId?: string;
224
+ traceCarrier?: FlueTraceCarrier;
225
225
  }
226
226
  type FlueObservationSubscriber = (observation: FlueObservation, ctx: FlueEventContext) => void | Promise<void>;
227
227
  type FlueExecutionInterceptor = <T>(operation: FlueExecutionOperation, ctx: FlueExecutionContext, next: () => Promise<T>) => Promise<T>;
@@ -231,67 +231,69 @@ type FlueExecutionInterceptor = <T>(operation: FlueExecutionOperation, ctx: Flue
231
231
  * one of these.
232
232
  */
233
233
  interface FlueInstrumentation {
234
- key?: symbol;
235
- observe: FlueObservationSubscriber;
236
- interceptor: FlueExecutionInterceptor;
237
- dispose(): void | Promise<void>;
234
+ key?: symbol;
235
+ observe: FlueObservationSubscriber;
236
+ interceptor: FlueExecutionInterceptor;
237
+ dispose(): void | Promise<void>;
238
238
  }
239
-
239
+ //#endregion
240
+ //#region src/messages.d.ts
240
241
  /**
241
242
  * One semconv structured message, the element shape of `gen_ai.input.messages`
242
243
  * and `gen_ai.output.messages`. Text parts only; see the README's content section.
243
244
  */
244
245
  interface FlueContentMessage {
245
- role: 'system' | 'user' | 'assistant';
246
- parts: Array<{
247
- type: 'text';
248
- content: string;
249
- }>;
246
+ role: 'system' | 'user' | 'assistant';
247
+ parts: Array<{
248
+ type: 'text';
249
+ content: string;
250
+ }>;
250
251
  }
251
-
252
+ //#endregion
253
+ //#region src/content.d.ts
252
254
  /**
253
255
  * What to emit. Every switch defaults to ON, so `{}` and an absent option both
254
256
  * emit everything; set a switch to `false` to drop that one kind, or pass
255
257
  * `content: false` to emit no content at all.
256
258
  */
257
259
  interface FlueContentOptions {
258
- /**
259
- * Emit the call's arguments as `gen_ai.tool.call.arguments` when the
260
- * `execute_tool` span opens. Read from Flue's stable `tool_start.args`.
261
- */
262
- toolArguments?: boolean;
263
- /**
264
- * Emit successful tool results when the span closes; failed-tool payloads stay off the wire. Prefer
265
- * effectiveResult when present, including undefined; otherwise use result.
266
- */
267
- toolResults?: boolean;
268
- /**
269
- * Emit the conversation the run was given as `gen_ai.input.messages` on the `invoke_agent` span:
270
- * text-only user and assistant rows from Flue's normalized `turn_request.request.input.messages`,
271
- * plus any user message a later turn's history carries, minus the run's own assistant rows.
272
- */
273
- inputMessages?: boolean;
274
- /**
275
- * Emit the run's final assistant text as `gen_ai.output.messages` on the `invoke_agent` span, read
276
- * from the last agent turn whose `turn.response.output` carried text.
277
- */
278
- outputMessages?: boolean;
279
- /**
280
- * Emit the system prompt as `gen_ai.system_instructions` on the `invoke_agent` span, read from
281
- * `turn_request.request.input.systemPrompt`. Usually the largest value a run carries; mind `maxChars`.
282
- */
283
- systemInstructions?: boolean;
284
- /**
285
- * Per-value UTF-16 code-unit ceiling, including the truncation marker. Defaults to
286
- * DEFAULT_CONTENT_MAX_CHARS and clamps to INGEST_CONTENT_ATTRIBUTE_CEILING, above which ingest drops
287
- * the whole attribute.
288
- */
289
- maxChars?: number;
290
- /**
291
- * Redact the raw value before encoding or truncation. Returning undefined or throwing suppresses only
292
- * this attribute, not the span.
293
- */
294
- redact?: (value: unknown, context: FlueContentRedactContext) => unknown;
260
+ /**
261
+ * Emit the call's arguments as `gen_ai.tool.call.arguments` when the
262
+ * `execute_tool` span opens. Read from Flue's stable `tool_start.args`.
263
+ */
264
+ toolArguments?: boolean;
265
+ /**
266
+ * Emit successful tool results when the span closes; failed-tool payloads stay off the wire. Prefer
267
+ * effectiveResult when present, including undefined; otherwise use result.
268
+ */
269
+ toolResults?: boolean;
270
+ /**
271
+ * Emit the conversation the run was given as `gen_ai.input.messages` on the `invoke_agent` span:
272
+ * text-only user and assistant rows from Flue's normalized `turn_request.request.input.messages`,
273
+ * plus any user message a later turn's history carries, minus the run's own assistant rows.
274
+ */
275
+ inputMessages?: boolean;
276
+ /**
277
+ * Emit the run's final assistant text as `gen_ai.output.messages` on the `invoke_agent` span, read
278
+ * from the last agent turn whose `turn.response.output` carried text.
279
+ */
280
+ outputMessages?: boolean;
281
+ /**
282
+ * Emit the system prompt as `gen_ai.system_instructions` on the `invoke_agent` span, read from
283
+ * `turn_request.request.input.systemPrompt`. Usually the largest value a run carries; mind `maxChars`.
284
+ */
285
+ systemInstructions?: boolean;
286
+ /**
287
+ * Per-value UTF-16 code-unit ceiling, including the truncation marker. Defaults to
288
+ * DEFAULT_CONTENT_MAX_CHARS and clamps to INGEST_CONTENT_ATTRIBUTE_CEILING, above which ingest drops
289
+ * the whole attribute.
290
+ */
291
+ maxChars?: number;
292
+ /**
293
+ * Redact the raw value before encoding or truncation. Returning undefined or throwing suppresses only
294
+ * this attribute, not the span.
295
+ */
296
+ redact?: (value: unknown, context: FlueContentRedactContext) => unknown;
295
297
  }
296
298
  /**
297
299
  * What `redact` is looking at. Tool kinds receive the raw Flue payload; `input_messages` and
@@ -299,11 +301,11 @@ interface FlueContentOptions {
299
301
  * receives the prompt string.
300
302
  */
301
303
  type FlueContentRedactContext = {
302
- kind: 'arguments' | 'result';
303
- toolName: string;
304
+ kind: 'arguments' | 'result';
305
+ toolName: string;
304
306
  } | {
305
- kind: 'input_messages' | 'output_messages' | 'system_instructions';
306
- toolName?: undefined;
307
+ kind: 'input_messages' | 'output_messages' | 'system_instructions';
308
+ toolName?: undefined;
307
309
  };
308
310
  type FlueMessageContentKind = 'input_messages' | 'output_messages';
309
311
  /**
@@ -312,73 +314,74 @@ type FlueMessageContentKind = 'input_messages' | 'output_messages';
312
314
  * arguments plus result on one span sit well inside ingest's 384 KiB per-span
313
315
  * ceiling — a customer who raises it should know that ceiling exists.
314
316
  */
315
- declare const DEFAULT_CONTENT_MAX_CHARS = 65536;
317
+ export declare const DEFAULT_CONTENT_MAX_CHARS = 65536;
316
318
  /**
317
319
  * Inline the private ingest per-attribute ceiling so npm installs need no private dependency.
318
320
  * tests/contract.test.ts pins equality.
319
321
  */
320
- declare const INGEST_CONTENT_ATTRIBUTE_CEILING = 262144;
322
+ export declare const INGEST_CONTENT_ATTRIBUTE_CEILING = 262144;
321
323
  /** The resolved, always-complete policy the projection consults. */
322
324
  type FlueContentSetting = FlueContentOptions | false;
323
-
325
+ //#endregion
326
+ //#region src/projection.d.ts
324
327
  /** Attribute values OTLP can carry. Deliberately narrower than OTel's type. */
325
328
  type SpanAttributes = Record<string, string | number | boolean | string[]>;
326
329
  /** Where a span sits relative to the process boundary. */
327
330
  type ProjectedSpanKind = 'internal' | 'client';
328
331
  interface OpenSpanIntent {
329
- kind: 'open';
330
- /** Stable identity for the span; the driver keys its live-span map on it. */
331
- ref: string;
332
- name: string;
333
- spanKind: ProjectedSpanKind;
334
- /**
335
- * The span this one nests under, when the projection knows it. Absent means
336
- * "use whatever is active" — which, inside Flue's interceptor, is the
337
- * enclosing span, so the driver's fallback repairs chains the correlation
338
- * fields cannot express (a task nested inside another task, most notably).
339
- */
340
- parentRef?: string;
341
- /** Flue's own event timestamp, ISO-8601. Spans stay on the runtime's clock. */
342
- startTime?: string;
343
- attributes: SpanAttributes;
344
- /**
345
- * Drop bookkeeping spans without a parent: ingest could otherwise treat a host shell or compaction
346
- * span as a phantom run envelope.
347
- */
348
- requiresParent?: boolean;
332
+ kind: 'open';
333
+ /** Stable identity for the span; the driver keys its live-span map on it. */
334
+ ref: string;
335
+ name: string;
336
+ spanKind: ProjectedSpanKind;
337
+ /**
338
+ * The span this one nests under, when the projection knows it. Absent means
339
+ * "use whatever is active" — which, inside Flue's interceptor, is the
340
+ * enclosing span, so the driver's fallback repairs chains the correlation
341
+ * fields cannot express (a task nested inside another task, most notably).
342
+ */
343
+ parentRef?: string;
344
+ /** Flue's own event timestamp, ISO-8601. Spans stay on the runtime's clock. */
345
+ startTime?: string;
346
+ attributes: SpanAttributes;
347
+ /**
348
+ * Drop bookkeeping spans without a parent: ingest could otherwise treat a host shell or compaction
349
+ * span as a phantom run envelope.
350
+ */
351
+ requiresParent?: boolean;
349
352
  }
350
353
  interface UpdateSpanIntent {
351
- kind: 'update';
352
- ref: string;
353
- attributes: SpanAttributes;
354
+ kind: 'update';
355
+ ref: string;
356
+ attributes: SpanAttributes;
354
357
  }
355
358
  interface CloseSpanIntent {
356
- kind: 'close';
357
- ref: string;
358
- endTime?: string;
359
- /**
360
- * Failure type and exception class only. Error messages and stacks can expose prompts or deployment
361
- * paths and are excluded even when tool-content export is enabled.
362
- */
363
- error?: {
364
- type: string;
365
- exceptionType?: string;
366
- };
359
+ kind: 'close';
360
+ ref: string;
361
+ endTime?: string;
362
+ /**
363
+ * Failure type and exception class only. Error messages and stacks can expose prompts or deployment
364
+ * paths and are excluded even when tool-content export is enabled.
365
+ */
366
+ error?: {
367
+ type: string;
368
+ exceptionType?: string;
369
+ };
367
370
  }
368
371
  type SpanIntent = OpenSpanIntent | UpdateSpanIntent | CloseSpanIntent;
369
372
  interface FlueProjectionOptions {
370
- /**
371
- * Agent id by Flue agent name, stamped on the envelope. Resource attribution takes precedence;
372
- * delegated subagents are not separate executions. Use runtypeFlueResourceAttributes for single-agent
373
- * processes.
374
- */
375
- agents?: Record<string, string>;
376
- /**
377
- * Content: tool arguments and results on `execute_tool` spans, messages and the system prompt on
378
- * the `invoke_agent` envelope. All ON by default; set a switch to `false` to drop one kind, or
379
- * `content: false` for none. See {@link FlueContentOptions} for the size ceiling and redaction hook.
380
- */
381
- content?: FlueContentSetting;
373
+ /**
374
+ * Agent id by Flue agent name, stamped on the envelope. Resource attribution takes precedence;
375
+ * delegated subagents are not separate executions. Use runtypeFlueResourceAttributes for single-agent
376
+ * processes.
377
+ */
378
+ agents?: Record<string, string>;
379
+ /**
380
+ * Content: tool arguments and results on `execute_tool` spans, messages and the system prompt on
381
+ * the `invoke_agent` envelope. All ON by default; set a switch to `false` to drop one kind, or
382
+ * `content: false` for none. See {@link FlueContentOptions} for the size ceiling and redaction hook.
383
+ */
384
+ content?: FlueContentSetting;
382
385
  }
383
386
  /**
384
387
  * Resource attributes for the customer's `Resource`. Exported rather than set
@@ -386,74 +389,75 @@ interface FlueProjectionOptions {
386
389
  * processor, the exporter and the resource are all the application's, and a
387
390
  * library that reached into them would fight whatever the customer already runs.
388
391
  */
389
- declare function runtypeFlueResourceAttributes(resource?: {
390
- agentId?: string | null;
392
+ export declare function runtypeFlueResourceAttributes(resource?: {
393
+ agentId?: string | null;
391
394
  }): SpanAttributes;
392
-
395
+ //#endregion
396
+ //#region src/semconv.d.ts
393
397
  /**
394
398
  * GenAI semantic-convention attribute names. Mirrors the subset of
395
399
  * `packages/shared/src/gen-ai-semconv.ts` this instrumentation can populate
396
400
  * from Flue's STABLE observation plane.
397
401
  */
398
- declare const GEN_AI: {
399
- readonly operationName: "gen_ai.operation.name";
400
- readonly providerName: "gen_ai.provider.name";
401
- readonly agentName: "gen_ai.agent.name";
402
- readonly conversationId: "gen_ai.conversation.id";
403
- readonly requestModel: "gen_ai.request.model";
404
- readonly responseModel: "gen_ai.response.model";
405
- readonly responseId: "gen_ai.response.id";
406
- readonly requestStream: "gen_ai.request.stream";
407
- readonly reasoningLevel: "gen_ai.request.reasoning.level";
408
- readonly maxTokens: "gen_ai.request.max_tokens";
409
- readonly temperature: "gen_ai.request.temperature";
410
- readonly finishReasons: "gen_ai.response.finish_reasons";
411
- readonly usageInputTokens: "gen_ai.usage.input_tokens";
412
- readonly usageOutputTokens: "gen_ai.usage.output_tokens";
413
- readonly usageCacheReadTokens: "gen_ai.usage.cache_read.input_tokens";
414
- readonly usageCacheCreationTokens: "gen_ai.usage.cache_creation.input_tokens";
415
- readonly toolName: "gen_ai.tool.name";
416
- readonly toolCallId: "gen_ai.tool.call.id";
417
- readonly toolType: "gen_ai.tool.type";
418
- readonly conversationCompacted: "gen_ai.conversation.compacted";
419
- readonly errorType: "error.type";
420
- readonly serverAddress: "server.address";
421
- readonly serverPort: "server.port";
402
+ export declare const GEN_AI: {
403
+ readonly operationName: "gen_ai.operation.name";
404
+ readonly providerName: "gen_ai.provider.name";
405
+ readonly agentName: "gen_ai.agent.name";
406
+ readonly conversationId: "gen_ai.conversation.id";
407
+ readonly requestModel: "gen_ai.request.model";
408
+ readonly responseModel: "gen_ai.response.model";
409
+ readonly responseId: "gen_ai.response.id";
410
+ readonly requestStream: "gen_ai.request.stream";
411
+ readonly reasoningLevel: "gen_ai.request.reasoning.level";
412
+ readonly maxTokens: "gen_ai.request.max_tokens";
413
+ readonly temperature: "gen_ai.request.temperature";
414
+ readonly finishReasons: "gen_ai.response.finish_reasons";
415
+ readonly usageInputTokens: "gen_ai.usage.input_tokens";
416
+ readonly usageOutputTokens: "gen_ai.usage.output_tokens";
417
+ readonly usageCacheReadTokens: "gen_ai.usage.cache_read.input_tokens";
418
+ readonly usageCacheCreationTokens: "gen_ai.usage.cache_creation.input_tokens";
419
+ readonly toolName: "gen_ai.tool.name";
420
+ readonly toolCallId: "gen_ai.tool.call.id";
421
+ readonly toolType: "gen_ai.tool.type";
422
+ readonly conversationCompacted: "gen_ai.conversation.compacted";
423
+ readonly errorType: "error.type";
424
+ readonly serverAddress: "server.address";
425
+ readonly serverPort: "server.port";
422
426
  };
423
427
  /**
424
428
  * Content attribute names, separate from the structural GEN_AI set. Tool content goes on
425
429
  * `execute_tool` spans, message content on the `invoke_agent` envelope; each kind can be switched
426
430
  * off through the content options. Mirrored in shared ingest semconv.
427
431
  */
428
- declare const GEN_AI_CONTENT: {
429
- readonly inputMessages: "gen_ai.input.messages";
430
- readonly outputMessages: "gen_ai.output.messages";
431
- readonly systemInstructions: "gen_ai.system_instructions";
432
- readonly toolCallArguments: "gen_ai.tool.call.arguments";
433
- readonly toolCallResult: "gen_ai.tool.call.result";
432
+ export declare const GEN_AI_CONTENT: {
433
+ readonly inputMessages: "gen_ai.input.messages";
434
+ readonly outputMessages: "gen_ai.output.messages";
435
+ readonly systemInstructions: "gen_ai.system_instructions";
436
+ readonly toolCallArguments: "gen_ai.tool.call.arguments";
437
+ readonly toolCallResult: "gen_ai.tool.call.result";
434
438
  };
435
439
  /**
436
440
  * Runtype's extension vocabulary. Placement is part of the contract and the
437
441
  * reader enforces it — see the `RUNTYPE_ATTRIBUTES` doc block in the shared
438
442
  * module for which level each name belongs on.
439
443
  */
440
- declare const RUNTYPE: {
441
- readonly agentId: "runtype.agent.id";
442
- readonly schemaVersion: "runtype.schema.version";
443
- readonly adapterName: "runtype.adapter.name";
444
- readonly adapterVersion: "runtype.adapter.version";
445
- readonly executionId: "runtype.execution.id";
446
- readonly iteration: "runtype.iteration";
447
- readonly iterations: "runtype.iterations";
448
- readonly totalCost: "runtype.total_cost";
449
- readonly stopReason: "runtype.stop_reason";
450
- readonly toolsReported: "runtype.tools.reported";
451
- readonly toolType: "runtype.tool.type";
452
- readonly turnId: "runtype.turn.id";
453
- readonly turnIndex: "runtype.turn.index";
454
- readonly providerFinishReason: "runtype.provider.finish_reason";
455
- readonly providerServiceTier: "runtype.provider.service_tier";
456
- readonly gatewayLogId: "runtype.gateway.log_id";
444
+ export declare const RUNTYPE: {
445
+ readonly agentId: "runtype.agent.id";
446
+ readonly schemaVersion: "runtype.schema.version";
447
+ readonly adapterName: "runtype.adapter.name";
448
+ readonly adapterVersion: "runtype.adapter.version";
449
+ readonly executionId: "runtype.execution.id";
450
+ readonly iteration: "runtype.iteration";
451
+ readonly iterations: "runtype.iterations";
452
+ readonly totalCost: "runtype.total_cost";
453
+ readonly stopReason: "runtype.stop_reason";
454
+ readonly toolsReported: "runtype.tools.reported";
455
+ readonly toolType: "runtype.tool.type";
456
+ readonly turnId: "runtype.turn.id";
457
+ readonly turnIndex: "runtype.turn.index";
458
+ readonly providerFinishReason: "runtype.provider.finish_reason";
459
+ readonly providerServiceTier: "runtype.provider.service_tier";
460
+ readonly gatewayLogId: "runtype.gateway.log_id";
457
461
  };
458
462
  /**
459
463
  * `runtype.tool.type` values — the closed domain that drives display and
@@ -461,7 +465,7 @@ declare const RUNTYPE: {
461
465
  * members this instrumentation can honestly assert are ever emitted (see
462
466
  * `projection.ts`).
463
467
  */
464
- declare const RUNTYPE_TOOL_TYPES: readonly ["flow", "mcp", "builtin", "custom", "external", "advisor", "subagent", "local", "data_connection", "search"];
468
+ export declare const RUNTYPE_TOOL_TYPES: readonly ["flow", "mcp", "builtin", "custom", "external", "advisor", "subagent", "local", "data_connection", "search"];
465
469
  type RuntypeToolType = (typeof RUNTYPE_TOOL_TYPES)[number];
466
470
  /**
467
471
  * Terminal stop reasons, in Runtype's own wire vocabulary
@@ -469,35 +473,37 @@ type RuntypeToolType = (typeof RUNTYPE_TOOL_TYPES)[number];
469
473
  * `runtype.stop_reason` is written to the run row verbatim, so an invented
470
474
  * value would render in the dashboard as a real fact.
471
475
  */
472
- declare const RUNTYPE_STOP_REASONS: readonly ["end_turn", "max_tool_calls", "length", "content_filter", "error", "unknown"];
476
+ export declare const RUNTYPE_STOP_REASONS: readonly ["end_turn", "max_tool_calls", "length", "content_filter", "error", "unknown"];
473
477
  type RuntypeStopReason = (typeof RUNTYPE_STOP_REASONS)[number];
474
478
  /** The version of the `runtype.*` vocabulary this package was built against. */
475
- declare const RUNTYPE_SCHEMA_VERSION = "1";
479
+ export declare const RUNTYPE_SCHEMA_VERSION = "1";
476
480
  /** What this package reports itself as in `runtype.adapter.name`. */
477
- declare const ADAPTER_NAME = "@runtypelabs/flue-otel";
481
+ export declare const ADAPTER_NAME = "@runtypelabs/flue-otel";
478
482
  /** What this package reports itself as in `runtype.adapter.version`. */
479
- declare const ADAPTER_VERSION: string;
480
-
483
+ export declare const ADAPTER_VERSION: string;
484
+ //#endregion
485
+ //#region src/index.d.ts
481
486
  /**
482
487
  * The instrumentation key. Distinct from stock's
483
488
  * `Symbol.for('@flue/opentelemetry')` so `instrument()` treats the two as
484
489
  * different subscribers and composes them rather than replacing one.
485
490
  */
486
- declare const RUNTYPE_FLUE_INSTRUMENTATION_KEY: unique symbol;
487
- interface RuntypeFlueInstrumentationOptions extends FlueProjectionOptions {
488
- /**
489
- * Where spans are written. Defaults to the globally registered provider's
490
- * tracer, which is what an application that called `setGlobalTracerProvider`
491
- * (or `NodeSDK.start()`) already has. Pass one explicitly to route Runtype's
492
- * spans through a provider separate from the rest of the process.
493
- */
494
- tracer?: Tracer;
491
+ export declare const RUNTYPE_FLUE_INSTRUMENTATION_KEY: unique symbol;
492
+ export interface RuntypeFlueInstrumentationOptions extends FlueProjectionOptions {
493
+ /**
494
+ * Where spans are written. Defaults to the globally registered provider's
495
+ * tracer, which is what an application that called `setGlobalTracerProvider`
496
+ * (or `NodeSDK.start()`) already has. Pass one explicitly to route Runtype's
497
+ * spans through a provider separate from the rest of the process.
498
+ */
499
+ tracer?: Tracer;
495
500
  }
496
501
  /**
497
502
  * Build an observe/interceptor pair for Flue's instrument(). The interceptor activates spans and joins
498
503
  * dispatched trace carriers. Configure the OTel SDK externally, and point only one instrumentation at
499
504
  * Runtype to avoid double counting.
500
505
  */
501
- declare function createRuntypeFlueInstrumentation(options?: RuntypeFlueInstrumentationOptions): FlueInstrumentation;
502
-
503
- export { ADAPTER_NAME, ADAPTER_VERSION, DEFAULT_CONTENT_MAX_CHARS, type FlueContentMessage, type FlueContentOptions, type FlueContentRedactContext, type FlueContentSetting, type FlueInstrumentation, type FlueMessageContentKind, type FlueProjectionOptions, GEN_AI, GEN_AI_CONTENT, INGEST_CONTENT_ATTRIBUTE_CEILING, RUNTYPE, RUNTYPE_FLUE_INSTRUMENTATION_KEY, RUNTYPE_SCHEMA_VERSION, RUNTYPE_STOP_REASONS, RUNTYPE_TOOL_TYPES, type RuntypeFlueInstrumentationOptions, type RuntypeStopReason, type RuntypeToolType, type SpanAttributes, type SpanIntent, createRuntypeFlueInstrumentation, runtypeFlueResourceAttributes };
506
+ export declare function createRuntypeFlueInstrumentation(options?: RuntypeFlueInstrumentationOptions): FlueInstrumentation;
507
+ //#endregion
508
+ export type { FlueContentMessage, FlueContentOptions, FlueContentRedactContext, FlueContentSetting, FlueInstrumentation, FlueMessageContentKind, FlueProjectionOptions, RuntypeStopReason, RuntypeToolType, SpanAttributes, SpanIntent };
509
+ export {}