@vinhnt-sdk/trace 0.4.3 → 0.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +156 -139
- package/dist/gen-ai-attributes.d.ts +99 -0
- package/dist/gen-ai-attributes.d.ts.map +1 -0
- package/dist/gen-ai-attributes.js +126 -0
- package/dist/gen-ai-attributes.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/timeline.d.ts +26 -3
- package/dist/timeline.d.ts.map +1 -1
- package/dist/timeline.js +33 -14
- package/dist/timeline.js.map +1 -1
- package/dist/tracing.d.ts +6 -3
- package/dist/tracing.d.ts.map +1 -1
- package/dist/tracing.js +8 -5
- package/dist/tracing.js.map +1 -1
- package/package.json +9 -10
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Nguyen Thanh Vinh
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Nguyen Thanh Vinh
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,110 +1,110 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
>
|
|
4
|
-
|
|
5
|
-
Observability for vinhnt-sdk — OpenTelemetry-compatible spans, timeline replay, telemetry aggregation, and cost tracking.
|
|
6
|
-
|
|
7
|
-
## Install
|
|
8
|
-
|
|
9
|
-
`ash
|
|
10
|
-
# npm
|
|
11
|
-
npm install @vinhnt-sdk/trace
|
|
12
|
-
|
|
13
|
-
# pnpm (monorepo)
|
|
14
|
-
pnpm add @vinhnt-sdk/trace
|
|
15
|
-
`
|
|
16
|
-
|
|
17
|
-
## Features
|
|
18
|
-
|
|
1
|
+
# @vinhnt-sdk/trace
|
|
2
|
+
|
|
3
|
+
> Status: STABLE
|
|
4
|
+
|
|
5
|
+
Observability for vinhnt-sdk — OpenTelemetry-compatible spans, timeline replay, telemetry aggregation, and cost tracking.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
`ash
|
|
10
|
+
# npm
|
|
11
|
+
npm install @vinhnt-sdk/trace
|
|
12
|
+
|
|
13
|
+
# pnpm (monorepo)
|
|
14
|
+
pnpm add @vinhnt-sdk/trace
|
|
15
|
+
`
|
|
16
|
+
|
|
17
|
+
## Features
|
|
18
|
+
|
|
19
19
|
- **SpanRecorder** — Record and query OpenTelemetry-compatible spans
|
|
20
|
+
- **GenAI semconv** — OTel `gen_ai.*` attribute keys + builders for chat/tool/agent spans (ADK profile)
|
|
20
21
|
- **Timeline** — Build transcripts from run events for replay
|
|
21
22
|
- **CostMeter** — Track token usage and calculate costs per model
|
|
22
23
|
- **ContextPressure** — Monitor context window utilization
|
|
23
24
|
- **TelemetryProvider** — Interface for custom telemetry backends
|
|
24
25
|
- **OTLP exporter** — `createOtlpSpanExporter` ships spans to any OTLP/HTTP collector (optional)
|
|
25
|
-
- **DEFAULT_MODEL_PRICING** — Built-in pricing for common models
|
|
26
|
-
|
|
27
|
-
## Quick Start
|
|
28
|
-
|
|
29
|
-
` ypescript
|
|
30
|
-
import {
|
|
31
|
-
SpanRecorder,
|
|
32
|
-
CostMeter, calculateCost, DEFAULT_MODEL_PRICING,
|
|
33
|
-
Timeline, buildTranscript,
|
|
34
|
-
} from "@vinhnt-sdk/trace";
|
|
35
|
-
|
|
36
|
-
// Create and record spans
|
|
37
|
-
const recorder = new SpanRecorder();
|
|
38
|
-
const span =
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
|
66
|
-
|
|
|
67
|
-
|
|
|
68
|
-
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
|
76
|
-
|
|
|
77
|
-
|
|
|
78
|
-
|
|
|
79
|
-
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
|
87
|
-
|
|
|
88
|
-
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
|
96
|
-
|
|
|
97
|
-
|
|
|
98
|
-
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
|
106
|
-
|
|
|
107
|
-
| ContextPressure | Interface | Context window utilization |
|
|
26
|
+
- **DEFAULT_MODEL_PRICING** — Built-in pricing for common models
|
|
27
|
+
|
|
28
|
+
## Quick Start
|
|
29
|
+
|
|
30
|
+
` ypescript
|
|
31
|
+
import {
|
|
32
|
+
SpanRecorder,
|
|
33
|
+
CostMeter, calculateCost, DEFAULT_MODEL_PRICING,
|
|
34
|
+
Timeline, buildTranscript,
|
|
35
|
+
} from "@vinhnt-sdk/trace";
|
|
36
|
+
|
|
37
|
+
// Create and record spans
|
|
38
|
+
const recorder = new SpanRecorder();
|
|
39
|
+
const span = recorder.startSpan("llm-call", "client");
|
|
40
|
+
|
|
41
|
+
// ... do work ...
|
|
42
|
+
|
|
43
|
+
recorder.endSpan(span, "ok");
|
|
44
|
+
|
|
45
|
+
// Calculate costs
|
|
46
|
+
const meter = new CostMeter();
|
|
47
|
+
meter.record({
|
|
48
|
+
inputTokens: 1000,
|
|
49
|
+
outputTokens: 500,
|
|
50
|
+
model: "gpt-4o",
|
|
51
|
+
});
|
|
52
|
+
console.log(meter.totalCost); // Cost in USD
|
|
53
|
+
|
|
54
|
+
// Build transcript from events
|
|
55
|
+
const transcript = buildTranscript(events);
|
|
56
|
+
console.log(transcript);
|
|
57
|
+
`
|
|
58
|
+
|
|
59
|
+
## API Reference
|
|
60
|
+
|
|
61
|
+
### Tracing
|
|
62
|
+
|
|
63
|
+
| Export | Type | Description |
|
|
64
|
+
|--------|------|-------------|
|
|
65
|
+
| SpanRecorder | Class | Record and query spans |
|
|
66
|
+
| createSpan | Function | Create a new span |
|
|
67
|
+
| endSpan | Function | End a span with status |
|
|
68
|
+
| ddSpanEvent | Function | Add an event to a span |
|
|
69
|
+
| generateTraceId | Function | Generate a unique trace ID |
|
|
70
|
+
|
|
71
|
+
### Span Types
|
|
72
|
+
|
|
73
|
+
| Export | Type | Description |
|
|
74
|
+
|--------|------|-------------|
|
|
75
|
+
| Span | Interface | A single trace span |
|
|
76
|
+
| SpanKind | Type | Span type (client, server, internal) |
|
|
77
|
+
| SpanStatus | Type | Span completion status |
|
|
78
|
+
| SpanEvent | Interface | Event within a span |
|
|
79
|
+
| SpanNode | Interface | Span tree node |
|
|
80
|
+
| TraceContext | Interface | Trace propagation context |
|
|
81
|
+
|
|
82
|
+
### Timeline
|
|
83
|
+
|
|
84
|
+
| Export | Type | Description |
|
|
85
|
+
|--------|------|-------------|
|
|
86
|
+
| Timeline | Class | Build and query run timelines |
|
|
87
|
+
| uildTranscript | Function | Build transcript from events |
|
|
88
|
+
| TimelineEvent | Interface | Event in a timeline |
|
|
89
|
+
| TranscriptEntry | Interface | Transcript line item |
|
|
90
|
+
|
|
91
|
+
### Telemetry
|
|
92
|
+
|
|
93
|
+
| Export | Type | Description |
|
|
94
|
+
|--------|------|-------------|
|
|
95
|
+
| CostMeter | Class | Track token costs |
|
|
96
|
+
| calculateCost | Function | Calculate cost from tokens |
|
|
97
|
+
| calculateContextPressure | Function | Calculate context utilization |
|
|
98
|
+
| DEFAULT_MODEL_PRICING | Constant | Default pricing for common models |
|
|
99
|
+
| ConsoleTelemetryProvider | Class | Console-based telemetry output |
|
|
100
|
+
|
|
101
|
+
### Telemetry Types
|
|
102
|
+
|
|
103
|
+
| Export | Type | Description |
|
|
104
|
+
|--------|------|-------------|
|
|
105
|
+
| UsageStats | Interface | Token usage statistics |
|
|
106
|
+
| ModelPricing | Interface | Per-1M-token pricing |
|
|
107
|
+
| ContextPressure | Interface | Context window utilization |
|
|
108
108
|
| TelemetryProvider | Interface | Custom telemetry backend |
|
|
109
109
|
|
|
110
110
|
### OTLP Export (P1-9)
|
|
@@ -126,6 +126,23 @@ Endpoint resolution (first match wins):
|
|
|
126
126
|
Headers: `OTEL_EXPORTER_OTLP_HEADERS` (`k1=v1,k2=v2`) merged with `config.headers`.
|
|
127
127
|
Resource: `config.resourceAttributes` (default `service.name=vinhnt-sdk`, override via `OTEL_SERVICE_NAME` in attributes).
|
|
128
128
|
|
|
129
|
+
### GenAI Semconv (G3.1)
|
|
130
|
+
|
|
131
|
+
| Export | Type | Description |
|
|
132
|
+
|--------|------|-------------|
|
|
133
|
+
| GEN_AI_OPERATIONS | Constant | Operation names: `chat`, `text_completion`, `embeddings`, `invoke_agent`, `execute_tool`, `retrieve`, `invoke_workflow` |
|
|
134
|
+
| GenAiOperation | Type | Union of operation names (autocomplete + extensible) |
|
|
135
|
+
| GEN_AI_* | Constants | OTel `gen_ai.*` attribute keys (request/response/usage/tool/content) |
|
|
136
|
+
| genAiChatRequestAttributes | Function | Request-side attrs (`operation.name`, `provider.name`, `request.model`) |
|
|
137
|
+
| genAiResponseAttributes | Function | Served model + `response.finish_reasons` |
|
|
138
|
+
| genAiUsageAttributes | Function | `usage.input_tokens` / `output_tokens` / `reasoning_tokens` |
|
|
139
|
+
| genAiContentAttributes | Function | Opt-in message attrs — `contentMode: "full"` only (default `no_content`) |
|
|
140
|
+
| genAiToolAttributes | Function | `execute_tool` span attrs (`gen_ai.tool.name` / `tool.call.id`) |
|
|
141
|
+
| genAiInvokeAgentAttributes | Function | Root `invoke_agent` span attrs |
|
|
142
|
+
|
|
143
|
+
Content capture is privacy-gated: without `contentMode: "full"` the builders
|
|
144
|
+
return `{}` — metadata only. Custom attributes use the `vnt.` namespace.
|
|
145
|
+
|
|
129
146
|
```typescript
|
|
130
147
|
import { createOtlpSpanExporter, SpanRecorder } from "@vinhnt-sdk/trace";
|
|
131
148
|
|
|
@@ -142,42 +159,42 @@ await exporter.shutdown();
|
|
|
142
159
|
|
|
143
160
|
No exporter is created unless you call `createOtlpSpanExporter` — default telemetry path unchanged.
|
|
144
161
|
|
|
145
|
-
## Usage Examples
|
|
146
|
-
|
|
147
|
-
### Cost Tracking
|
|
148
|
-
|
|
149
|
-
` ypescript
|
|
150
|
-
import { CostMeter, DEFAULT_MODEL_PRICING } from "@vinhnt-sdk/trace";
|
|
151
|
-
|
|
152
|
-
const meter = new CostMeter();
|
|
153
|
-
|
|
154
|
-
// Track usage across multiple calls
|
|
155
|
-
meter.record({ inputTokens: 1000, outputTokens: 500, model: "gpt-4o" });
|
|
156
|
-
meter.record({ inputTokens: 2000, outputTokens: 1000, model: "gpt-4o-mini" });
|
|
157
|
-
|
|
158
|
-
console.log(meter.totalCost); // Total cost in USD
|
|
159
|
-
`
|
|
160
|
-
|
|
161
|
-
### Custom Telemetry Provider
|
|
162
|
-
|
|
163
|
-
` ypescript
|
|
164
|
-
import type { TelemetryProvider } from "@vinhnt-sdk/trace";
|
|
165
|
-
|
|
166
|
-
const customProvider: TelemetryProvider = {
|
|
167
|
-
name: "datadog",
|
|
168
|
-
async recordSpan(span) {
|
|
169
|
-
await sendToDatadog(span);
|
|
170
|
-
},
|
|
171
|
-
async recordUsage(usage) {
|
|
172
|
-
await sendMetricsToDatadog(usage);
|
|
173
|
-
},
|
|
174
|
-
};
|
|
175
|
-
`
|
|
176
|
-
|
|
177
|
-
## Dependencies
|
|
178
|
-
|
|
179
|
-
- @vinhnt-sdk/schema >=0.5.0
|
|
180
|
-
|
|
181
|
-
## License
|
|
182
|
-
|
|
162
|
+
## Usage Examples
|
|
163
|
+
|
|
164
|
+
### Cost Tracking
|
|
165
|
+
|
|
166
|
+
` ypescript
|
|
167
|
+
import { CostMeter, DEFAULT_MODEL_PRICING } from "@vinhnt-sdk/trace";
|
|
168
|
+
|
|
169
|
+
const meter = new CostMeter();
|
|
170
|
+
|
|
171
|
+
// Track usage across multiple calls
|
|
172
|
+
meter.record({ inputTokens: 1000, outputTokens: 500, model: "gpt-4o" });
|
|
173
|
+
meter.record({ inputTokens: 2000, outputTokens: 1000, model: "gpt-4o-mini" });
|
|
174
|
+
|
|
175
|
+
console.log(meter.totalCost); // Total cost in USD
|
|
176
|
+
`
|
|
177
|
+
|
|
178
|
+
### Custom Telemetry Provider
|
|
179
|
+
|
|
180
|
+
` ypescript
|
|
181
|
+
import type { TelemetryProvider } from "@vinhnt-sdk/trace";
|
|
182
|
+
|
|
183
|
+
const customProvider: TelemetryProvider = {
|
|
184
|
+
name: "datadog",
|
|
185
|
+
async recordSpan(span) {
|
|
186
|
+
await sendToDatadog(span);
|
|
187
|
+
},
|
|
188
|
+
async recordUsage(usage) {
|
|
189
|
+
await sendMetricsToDatadog(usage);
|
|
190
|
+
},
|
|
191
|
+
};
|
|
192
|
+
`
|
|
193
|
+
|
|
194
|
+
## Dependencies
|
|
195
|
+
|
|
196
|
+
- @vinhnt-sdk/schema >=0.5.0
|
|
197
|
+
|
|
198
|
+
## License
|
|
199
|
+
|
|
183
200
|
MIT
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GenAI semantic-convention attribute layer — OTel `gen_ai.*` attributes
|
|
3
|
+
* (ADK profile; research: .agents/research/ai-observability-research.md).
|
|
4
|
+
*
|
|
5
|
+
* Pure constants + tiny builders — zero runtime deps. Spans stay plain
|
|
6
|
+
* `Span` objects (see ./tracing.ts); this module only supplies the standard
|
|
7
|
+
* attribute keys/values so every producer agrees on names.
|
|
8
|
+
*
|
|
9
|
+
* Privacy: content capture is OPT-IN (`contentMode: "full"`). The default
|
|
10
|
+
* `no_content` tier records metadata only (research "Privacy Tiers" #1).
|
|
11
|
+
*/
|
|
12
|
+
/** Attribute keys — core set (research table "Core Attributes"). */
|
|
13
|
+
export declare const GEN_AI_OPERATION_NAME = "gen_ai.operation.name";
|
|
14
|
+
export declare const GEN_AI_PROVIDER_NAME = "gen_ai.provider.name";
|
|
15
|
+
export declare const GEN_AI_REQUEST_MODEL = "gen_ai.request.model";
|
|
16
|
+
export declare const GEN_AI_RESPONSE_MODEL = "gen_ai.response.model";
|
|
17
|
+
export declare const GEN_AI_USAGE_INPUT_TOKENS = "gen_ai.usage.input_tokens";
|
|
18
|
+
export declare const GEN_AI_USAGE_OUTPUT_TOKENS = "gen_ai.usage.output_tokens";
|
|
19
|
+
export declare const GEN_AI_USAGE_REASONING_TOKENS = "gen_ai.usage.reasoning_tokens";
|
|
20
|
+
export declare const GEN_AI_RESPONSE_FINISH_REASONS = "gen_ai.response.finish_reasons";
|
|
21
|
+
export declare const GEN_AI_CONVERSATION_ID = "gen_ai.conversation.id";
|
|
22
|
+
/** Attribute keys — tool calls (gen_ai.tool.* span attributes). */
|
|
23
|
+
export declare const GEN_AI_TOOL_NAME = "gen_ai.tool.name";
|
|
24
|
+
export declare const GEN_AI_TOOL_CALL_ID = "gen_ai.tool.call.id";
|
|
25
|
+
/** Attribute keys — opt-in content capture (`contentMode: "full"` only). */
|
|
26
|
+
export declare const GEN_AI_INPUT_MESSAGES = "gen_ai.input.messages";
|
|
27
|
+
export declare const GEN_AI_OUTPUT_MESSAGES = "gen_ai.output.messages";
|
|
28
|
+
/**
|
|
29
|
+
* Operation names — research "Agent Spans (5 types)" ∪ core-attributes
|
|
30
|
+
* operations (`chat`, `text_completion`, `embeddings`).
|
|
31
|
+
*/
|
|
32
|
+
export declare const GEN_AI_OPERATIONS: {
|
|
33
|
+
readonly chat: "chat";
|
|
34
|
+
readonly textCompletion: "text_completion";
|
|
35
|
+
readonly embeddings: "embeddings";
|
|
36
|
+
readonly invokeAgent: "invoke_agent";
|
|
37
|
+
readonly executeTool: "execute_tool";
|
|
38
|
+
readonly retrieve: "retrieve";
|
|
39
|
+
readonly invokeWorkflow: "invoke_workflow";
|
|
40
|
+
};
|
|
41
|
+
export type GenAiOperation = (typeof GEN_AI_OPERATIONS)[keyof typeof GEN_AI_OPERATIONS];
|
|
42
|
+
/**
|
|
43
|
+
* Content capture tier — research privacy tiers #1 (default) and #4.
|
|
44
|
+
* `metadata_only`/`redacted` belong to the PromptLogger work (out of scope).
|
|
45
|
+
*/
|
|
46
|
+
export type GenAiContentMode = "no_content" | "full";
|
|
47
|
+
/** Default cap for opt-in content attributes (chars). */
|
|
48
|
+
export declare const DEFAULT_GEN_AI_MAX_CONTENT_LENGTH = 4096;
|
|
49
|
+
/** Custom (non-semconv) attribute keys used by the SDK — `vnt.` namespace. */
|
|
50
|
+
export declare const VNT_TRACE_CONTENT_TRUNCATED = "vnt.trace.content_truncated";
|
|
51
|
+
/** Structural usage subset of `ModelUsage` (kept dependency-free). */
|
|
52
|
+
export interface GenAiUsage {
|
|
53
|
+
readonly promptTokens?: number | undefined;
|
|
54
|
+
readonly completionTokens?: number | undefined;
|
|
55
|
+
readonly reasoningTokens?: number | undefined;
|
|
56
|
+
}
|
|
57
|
+
export interface GenAiContentOptions {
|
|
58
|
+
/** `no_content` (default) → content attributes are omitted entirely. */
|
|
59
|
+
readonly contentMode?: GenAiContentMode | undefined;
|
|
60
|
+
/** Truncation cap for content attributes. Default 4096 chars. */
|
|
61
|
+
readonly maxContentLength?: number | undefined;
|
|
62
|
+
}
|
|
63
|
+
/** Conversation grouping attribute (emitted only when a session id exists). */
|
|
64
|
+
export declare function genAiConversationAttributes(conversationId?: string | undefined): Record<string, unknown>;
|
|
65
|
+
/** Attributes for the start of a chat/completion request. */
|
|
66
|
+
export declare function genAiChatRequestAttributes(params: {
|
|
67
|
+
readonly provider: string;
|
|
68
|
+
readonly model: string;
|
|
69
|
+
readonly conversationId?: string | undefined;
|
|
70
|
+
}): Record<string, unknown>;
|
|
71
|
+
/** Response-side attributes: served model + finish reasons. Omits unset fields. */
|
|
72
|
+
export declare function genAiResponseAttributes(params: {
|
|
73
|
+
readonly model?: string | undefined;
|
|
74
|
+
readonly finishReason?: string | undefined;
|
|
75
|
+
}): Record<string, unknown>;
|
|
76
|
+
/** Token usage attributes — ints, only the fields actually present. */
|
|
77
|
+
export declare function genAiUsageAttributes(usage?: GenAiUsage | undefined): Record<string, unknown>;
|
|
78
|
+
/**
|
|
79
|
+
* Opt-in content attributes — `no_content` (default) returns `{}`.
|
|
80
|
+
* `full` emits `gen_ai.input.messages` / `gen_ai.output.messages` as
|
|
81
|
+
* (possibly truncated) JSON strings + a `vnt.trace.content_truncated` flag.
|
|
82
|
+
*/
|
|
83
|
+
export declare function genAiContentAttributes(params: {
|
|
84
|
+
/** Serialized conversation (request side), ready for JSON encoding. */
|
|
85
|
+
readonly inputJson?: string | undefined;
|
|
86
|
+
/** Serialized assistant output (response side). */
|
|
87
|
+
readonly outputJson?: string | undefined;
|
|
88
|
+
}, options?: GenAiContentOptions | undefined): Record<string, unknown>;
|
|
89
|
+
/** Attributes for an `execute_tool` span. */
|
|
90
|
+
export declare function genAiToolAttributes(params: {
|
|
91
|
+
readonly toolName: string;
|
|
92
|
+
readonly toolCallId?: string | undefined;
|
|
93
|
+
readonly conversationId?: string | undefined;
|
|
94
|
+
}): Record<string, unknown>;
|
|
95
|
+
/** Attributes for a top-level `invoke_agent` span. */
|
|
96
|
+
export declare function genAiInvokeAgentAttributes(params: {
|
|
97
|
+
readonly conversationId?: string | undefined;
|
|
98
|
+
}): Record<string, unknown>;
|
|
99
|
+
//# sourceMappingURL=gen-ai-attributes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gen-ai-attributes.d.ts","sourceRoot":"","sources":["../src/gen-ai-attributes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,oEAAoE;AACpE,eAAO,MAAM,qBAAqB,0BAA0B,CAAC;AAC7D,eAAO,MAAM,oBAAoB,yBAAyB,CAAC;AAC3D,eAAO,MAAM,oBAAoB,yBAAyB,CAAC;AAC3D,eAAO,MAAM,qBAAqB,0BAA0B,CAAC;AAC7D,eAAO,MAAM,yBAAyB,8BAA8B,CAAC;AACrE,eAAO,MAAM,0BAA0B,+BAA+B,CAAC;AACvE,eAAO,MAAM,6BAA6B,kCAAkC,CAAC;AAC7E,eAAO,MAAM,8BAA8B,mCAAmC,CAAC;AAC/E,eAAO,MAAM,sBAAsB,2BAA2B,CAAC;AAE/D,mEAAmE;AACnE,eAAO,MAAM,gBAAgB,qBAAqB,CAAC;AACnD,eAAO,MAAM,mBAAmB,wBAAwB,CAAC;AAEzD,4EAA4E;AAC5E,eAAO,MAAM,qBAAqB,0BAA0B,CAAC;AAC7D,eAAO,MAAM,sBAAsB,2BAA2B,CAAC;AAE/D;;;GAGG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;CAQpB,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAC;AAExF;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,YAAY,GAAG,MAAM,CAAC;AAErD,yDAAyD;AACzD,eAAO,MAAM,iCAAiC,OAAQ,CAAC;AA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AAOD;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE;IACN,uEAAuE;IACvE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,mDAAmD;IACnD,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1C,EACD,OAAO,CAAC,EAAE,mBAAmB,GAAG,SAAS,GACxC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAiBzB;AAED,6CAA6C;AAC7C,wBAAgB,mBAAmB,CAAC,MAAM,EAAE;IAC1C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzC,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9C,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAO1B;AAED,sDAAsD;AACtD,wBAAgB,0BAA0B,CAAC,MAAM,EAAE;IACjD,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9C,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAK1B"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GenAI semantic-convention attribute layer — OTel `gen_ai.*` attributes
|
|
3
|
+
* (ADK profile; research: .agents/research/ai-observability-research.md).
|
|
4
|
+
*
|
|
5
|
+
* Pure constants + tiny builders — zero runtime deps. Spans stay plain
|
|
6
|
+
* `Span` objects (see ./tracing.ts); this module only supplies the standard
|
|
7
|
+
* attribute keys/values so every producer agrees on names.
|
|
8
|
+
*
|
|
9
|
+
* Privacy: content capture is OPT-IN (`contentMode: "full"`). The default
|
|
10
|
+
* `no_content` tier records metadata only (research "Privacy Tiers" #1).
|
|
11
|
+
*/
|
|
12
|
+
/** Attribute keys — core set (research table "Core Attributes"). */
|
|
13
|
+
export const GEN_AI_OPERATION_NAME = "gen_ai.operation.name";
|
|
14
|
+
export const GEN_AI_PROVIDER_NAME = "gen_ai.provider.name";
|
|
15
|
+
export const GEN_AI_REQUEST_MODEL = "gen_ai.request.model";
|
|
16
|
+
export const GEN_AI_RESPONSE_MODEL = "gen_ai.response.model";
|
|
17
|
+
export const GEN_AI_USAGE_INPUT_TOKENS = "gen_ai.usage.input_tokens";
|
|
18
|
+
export const GEN_AI_USAGE_OUTPUT_TOKENS = "gen_ai.usage.output_tokens";
|
|
19
|
+
export const GEN_AI_USAGE_REASONING_TOKENS = "gen_ai.usage.reasoning_tokens";
|
|
20
|
+
export const GEN_AI_RESPONSE_FINISH_REASONS = "gen_ai.response.finish_reasons";
|
|
21
|
+
export const GEN_AI_CONVERSATION_ID = "gen_ai.conversation.id";
|
|
22
|
+
/** Attribute keys — tool calls (gen_ai.tool.* span attributes). */
|
|
23
|
+
export const GEN_AI_TOOL_NAME = "gen_ai.tool.name";
|
|
24
|
+
export const GEN_AI_TOOL_CALL_ID = "gen_ai.tool.call.id";
|
|
25
|
+
/** Attribute keys — opt-in content capture (`contentMode: "full"` only). */
|
|
26
|
+
export const GEN_AI_INPUT_MESSAGES = "gen_ai.input.messages";
|
|
27
|
+
export const GEN_AI_OUTPUT_MESSAGES = "gen_ai.output.messages";
|
|
28
|
+
/**
|
|
29
|
+
* Operation names — research "Agent Spans (5 types)" ∪ core-attributes
|
|
30
|
+
* operations (`chat`, `text_completion`, `embeddings`).
|
|
31
|
+
*/
|
|
32
|
+
export const GEN_AI_OPERATIONS = {
|
|
33
|
+
chat: "chat",
|
|
34
|
+
textCompletion: "text_completion",
|
|
35
|
+
embeddings: "embeddings",
|
|
36
|
+
invokeAgent: "invoke_agent",
|
|
37
|
+
executeTool: "execute_tool",
|
|
38
|
+
retrieve: "retrieve",
|
|
39
|
+
invokeWorkflow: "invoke_workflow",
|
|
40
|
+
};
|
|
41
|
+
/** Default cap for opt-in content attributes (chars). */
|
|
42
|
+
export const DEFAULT_GEN_AI_MAX_CONTENT_LENGTH = 4_096;
|
|
43
|
+
/** Custom (non-semconv) attribute keys used by the SDK — `vnt.` namespace. */
|
|
44
|
+
export const VNT_TRACE_CONTENT_TRUNCATED = "vnt.trace.content_truncated";
|
|
45
|
+
/** Conversation grouping attribute (emitted only when a session id exists). */
|
|
46
|
+
export function genAiConversationAttributes(conversationId) {
|
|
47
|
+
return conversationId ? { [GEN_AI_CONVERSATION_ID]: conversationId } : {};
|
|
48
|
+
}
|
|
49
|
+
/** Attributes for the start of a chat/completion request. */
|
|
50
|
+
export function genAiChatRequestAttributes(params) {
|
|
51
|
+
return {
|
|
52
|
+
[GEN_AI_OPERATION_NAME]: GEN_AI_OPERATIONS.chat,
|
|
53
|
+
[GEN_AI_PROVIDER_NAME]: params.provider,
|
|
54
|
+
[GEN_AI_REQUEST_MODEL]: params.model,
|
|
55
|
+
...genAiConversationAttributes(params.conversationId),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/** Response-side attributes: served model + finish reasons. Omits unset fields. */
|
|
59
|
+
export function genAiResponseAttributes(params) {
|
|
60
|
+
const attrs = {};
|
|
61
|
+
if (params.model)
|
|
62
|
+
attrs[GEN_AI_RESPONSE_MODEL] = params.model;
|
|
63
|
+
if (params.finishReason)
|
|
64
|
+
attrs[GEN_AI_RESPONSE_FINISH_REASONS] = [params.finishReason];
|
|
65
|
+
return attrs;
|
|
66
|
+
}
|
|
67
|
+
/** Token usage attributes — ints, only the fields actually present. */
|
|
68
|
+
export function genAiUsageAttributes(usage) {
|
|
69
|
+
if (!usage)
|
|
70
|
+
return {};
|
|
71
|
+
const attrs = {};
|
|
72
|
+
if (typeof usage.promptTokens === "number")
|
|
73
|
+
attrs[GEN_AI_USAGE_INPUT_TOKENS] = usage.promptTokens;
|
|
74
|
+
if (typeof usage.completionTokens === "number")
|
|
75
|
+
attrs[GEN_AI_USAGE_OUTPUT_TOKENS] = usage.completionTokens;
|
|
76
|
+
if (typeof usage.reasoningTokens === "number")
|
|
77
|
+
attrs[GEN_AI_USAGE_REASONING_TOKENS] = usage.reasoningTokens;
|
|
78
|
+
return attrs;
|
|
79
|
+
}
|
|
80
|
+
function truncateContent(value, maxLength) {
|
|
81
|
+
if (value.length <= maxLength)
|
|
82
|
+
return { text: value, truncated: false };
|
|
83
|
+
return { text: value.slice(0, maxLength), truncated: true };
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Opt-in content attributes — `no_content` (default) returns `{}`.
|
|
87
|
+
* `full` emits `gen_ai.input.messages` / `gen_ai.output.messages` as
|
|
88
|
+
* (possibly truncated) JSON strings + a `vnt.trace.content_truncated` flag.
|
|
89
|
+
*/
|
|
90
|
+
export function genAiContentAttributes(params, options) {
|
|
91
|
+
if ((options?.contentMode ?? "no_content") !== "full")
|
|
92
|
+
return {};
|
|
93
|
+
const max = options?.maxContentLength ?? DEFAULT_GEN_AI_MAX_CONTENT_LENGTH;
|
|
94
|
+
const attrs = {};
|
|
95
|
+
let truncated = false;
|
|
96
|
+
if (params.inputJson !== undefined) {
|
|
97
|
+
const r = truncateContent(params.inputJson, max);
|
|
98
|
+
attrs[GEN_AI_INPUT_MESSAGES] = r.text;
|
|
99
|
+
truncated = truncated || r.truncated;
|
|
100
|
+
}
|
|
101
|
+
if (params.outputJson !== undefined) {
|
|
102
|
+
const r = truncateContent(params.outputJson, max);
|
|
103
|
+
attrs[GEN_AI_OUTPUT_MESSAGES] = r.text;
|
|
104
|
+
truncated = truncated || r.truncated;
|
|
105
|
+
}
|
|
106
|
+
if (truncated)
|
|
107
|
+
attrs[VNT_TRACE_CONTENT_TRUNCATED] = true;
|
|
108
|
+
return attrs;
|
|
109
|
+
}
|
|
110
|
+
/** Attributes for an `execute_tool` span. */
|
|
111
|
+
export function genAiToolAttributes(params) {
|
|
112
|
+
return {
|
|
113
|
+
[GEN_AI_OPERATION_NAME]: GEN_AI_OPERATIONS.executeTool,
|
|
114
|
+
[GEN_AI_TOOL_NAME]: params.toolName,
|
|
115
|
+
...genAiConversationAttributes(params.conversationId),
|
|
116
|
+
...(params.toolCallId ? { [GEN_AI_TOOL_CALL_ID]: params.toolCallId } : {}),
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
/** Attributes for a top-level `invoke_agent` span. */
|
|
120
|
+
export function genAiInvokeAgentAttributes(params) {
|
|
121
|
+
return {
|
|
122
|
+
[GEN_AI_OPERATION_NAME]: GEN_AI_OPERATIONS.invokeAgent,
|
|
123
|
+
...genAiConversationAttributes(params.conversationId),
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=gen-ai-attributes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gen-ai-attributes.js","sourceRoot":"","sources":["../src/gen-ai-attributes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,oEAAoE;AACpE,MAAM,CAAC,MAAM,qBAAqB,GAAG,uBAAuB,CAAC;AAC7D,MAAM,CAAC,MAAM,oBAAoB,GAAG,sBAAsB,CAAC;AAC3D,MAAM,CAAC,MAAM,oBAAoB,GAAG,sBAAsB,CAAC;AAC3D,MAAM,CAAC,MAAM,qBAAqB,GAAG,uBAAuB,CAAC;AAC7D,MAAM,CAAC,MAAM,yBAAyB,GAAG,2BAA2B,CAAC;AACrE,MAAM,CAAC,MAAM,0BAA0B,GAAG,4BAA4B,CAAC;AACvE,MAAM,CAAC,MAAM,6BAA6B,GAAG,+BAA+B,CAAC;AAC7E,MAAM,CAAC,MAAM,8BAA8B,GAAG,gCAAgC,CAAC;AAC/E,MAAM,CAAC,MAAM,sBAAsB,GAAG,wBAAwB,CAAC;AAE/D,mEAAmE;AACnE,MAAM,CAAC,MAAM,gBAAgB,GAAG,kBAAkB,CAAC;AACnD,MAAM,CAAC,MAAM,mBAAmB,GAAG,qBAAqB,CAAC;AAEzD,4EAA4E;AAC5E,MAAM,CAAC,MAAM,qBAAqB,GAAG,uBAAuB,CAAC;AAC7D,MAAM,CAAC,MA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qB,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;QACtC,SAAS,GAAG,SAAS,IAAI,CAAC,CAAC,SAAS,CAAC;IACvC,CAAC;IACD,IAAI,MAAM,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;QACpC,MAAM,CAAC,GAAG,eAAe,CAAC,MAAM,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;QAClD,KAAK,CAAC,sBAAsB,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;QACvC,SAAS,GAAG,SAAS,IAAI,CAAC,CAAC,SAAS,CAAC;IACvC,CAAC;IACD,IAAI,SAAS;QAAE,KAAK,CAAC,2BAA2B,CAAC,GAAG,IAAI,CAAC;IACzD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,6CAA6C;AAC7C,MAAM,UAAU,mBAAmB,CAAC,MAInC;IACC,OAAO;QACL,CAAC,qBAAqB,CAAC,EAAE,iBAAiB,CAAC,WAAW;QACtD,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC,QAAQ;QACnC,GAAG,2BAA2B,CAAC,MAAM,CAAC,cAAc,CAAC;QACrD,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC3E,CAAC;AACJ,CAAC;AAED,sDAAsD;AACtD,MAAM,UAAU,0BAA0B,CAAC,MAE1C;IACC,OAAO;QACL,CAAC,qBAAqB,CAAC,EAAE,iBAAiB,CAAC,WAAW;QACtD,GAAG,2BAA2B,CAAC,MAAM,CAAC,cAAc,CAAC;KACtD,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
*/
|
|
10
10
|
export { SpanRecorder, createSpan, endSpan, addSpanEvent, generateTraceId, } from "./tracing.js";
|
|
11
11
|
export type { Span, SpanKind, SpanStatus, SpanEvent, SpanNode, TraceContext } from "./tracing.js";
|
|
12
|
+
export { GEN_AI_OPERATION_NAME, GEN_AI_PROVIDER_NAME, GEN_AI_REQUEST_MODEL, GEN_AI_RESPONSE_MODEL, GEN_AI_USAGE_INPUT_TOKENS, GEN_AI_USAGE_OUTPUT_TOKENS, GEN_AI_USAGE_REASONING_TOKENS, GEN_AI_RESPONSE_FINISH_REASONS, GEN_AI_CONVERSATION_ID, GEN_AI_TOOL_NAME, GEN_AI_TOOL_CALL_ID, GEN_AI_INPUT_MESSAGES, GEN_AI_OUTPUT_MESSAGES, GEN_AI_OPERATIONS, DEFAULT_GEN_AI_MAX_CONTENT_LENGTH, VNT_TRACE_CONTENT_TRUNCATED, genAiConversationAttributes, genAiChatRequestAttributes, genAiResponseAttributes, genAiUsageAttributes, genAiContentAttributes, genAiToolAttributes, genAiInvokeAgentAttributes, } from "./gen-ai-attributes.js";
|
|
13
|
+
export type { GenAiOperation, GenAiContentMode, GenAiUsage, GenAiContentOptions, } from "./gen-ai-attributes.js";
|
|
12
14
|
export { Timeline, buildTranscript } from "./timeline.js";
|
|
13
15
|
export type { TimelineEvent, TimelineEventType, TranscriptEntry } from "./timeline.js";
|
|
14
16
|
export { CostMeter, calculateCost, calculateContextPressure, DEFAULT_MODEL_PRICING, MODEL_PRICING, ConsoleTelemetryProvider } from "./telemetry.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EACL,YAAY,EAAE,UAAU,EAAE,OAAO,EAAE,YAAY,EAC/C,eAAe,GAChB,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAGlG,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAC1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C1B,uBAAuB,EACvB,oBAAoB,EACpB,sBAAsB,EACtB,mBAAmB,EACnB,0BAA0B,GAC3B,MAAM,wBAAwB,CAAC;AAChC,YAAY,EACV,cAAc,EACd,gBAAgB,EAChB,UAAU,EACV,mBAAmB,GACpB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAC1D,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAGvF,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,aAAa,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AACpJ,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAGnG,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,EACb,sBAAsB,EACtB,cAAc,EACd,gBAAgB,EAChB,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACV,kBAAkB,EAClB,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,oBAAoB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
*/
|
|
10
10
|
// ── Tracing ──
|
|
11
11
|
export { SpanRecorder, createSpan, endSpan, addSpanEvent, generateTraceId, } from "./tracing.js";
|
|
12
|
+
// ── GenAI semantic conventions (OTel gen_ai.*, ADK profile) ──
|
|
13
|
+
export { GEN_AI_OPERATION_NAME, GEN_AI_PROVIDER_NAME, GEN_AI_REQUEST_MODEL, GEN_AI_RESPONSE_MODEL, GEN_AI_USAGE_INPUT_TOKENS, GEN_AI_USAGE_OUTPUT_TOKENS, GEN_AI_USAGE_REASONING_TOKENS, GEN_AI_RESPONSE_FINISH_REASONS, GEN_AI_CONVERSATION_ID, GEN_AI_TOOL_NAME, GEN_AI_TOOL_CALL_ID, GEN_AI_INPUT_MESSAGES, GEN_AI_OUTPUT_MESSAGES, GEN_AI_OPERATIONS, DEFAULT_GEN_AI_MAX_CONTENT_LENGTH, VNT_TRACE_CONTENT_TRUNCATED, genAiConversationAttributes, genAiChatRequestAttributes, genAiResponseAttributes, genAiUsageAttributes, genAiContentAttributes, genAiToolAttributes, genAiInvokeAgentAttributes, } from "./gen-ai-attributes.js";
|
|
12
14
|
// ── Timeline ──
|
|
13
15
|
export { Timeline, buildTranscript } from "./timeline.js";
|
|
14
16
|
// ── Telemetry ──
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,gBAAgB;AAChB,OAAO,EACL,YAAY,EAAE,UAAU,EAAE,OAAO,EAAE,YAAY,EAC/C,eAAe,GAChB,MAAM,cAAc,CAAC;AAGtB,iBAAiB;AACjB,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAG1D,kBAAkB;AAClB,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,aAAa,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAGpJ,2BAA2B;AAC3B,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,EACb,sBAAsB,EACtB,cAAc,EACd,gBAAgB,EAChB,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,gBAAgB;AAChB,OAAO,EACL,YAAY,EAAE,UAAU,EAAE,OAAO,EAAE,YAAY,EAC/C,eAAe,GAChB,MAAM,cAAc,CAAC;AAGtB,gEAAgE;AAChE,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,yBAAyB,EACzB,0BAA0B,EAC1B,6BAA6B,EAC7B,8BAA8B,EAC9B,sBAAsB,EACtB,gBAAgB,EAChB,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,EACtB,iBAAiB,EACjB,iCAAiC,EACjC,2BAA2B,EAC3B,2BAA2B,EAC3B,0BAA0B,EAC1B,uBAAuB,EACvB,oBAAoB,EACpB,sBAAsB,EACtB,mBAAmB,EACnB,0BAA0B,GAC3B,MAAM,wBAAwB,CAAC;AAQhC,iBAAiB;AACjB,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAG1D,kBAAkB;AAClB,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,aAAa,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAGpJ,2BAA2B;AAC3B,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,gBAAgB,EAChB,aAAa,EACb,sBAAsB,EACtB,cAAc,EACd,gBAAgB,EAChB,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,oBAAoB,CAAC"}
|
package/dist/timeline.d.ts
CHANGED
|
@@ -7,9 +7,31 @@
|
|
|
7
7
|
* The timeline is a linear sequence of events that can be replayed
|
|
8
8
|
* to reconstruct the full conversation history.
|
|
9
9
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
import type { KnownRunEvent } from "@vinhnt-sdk/schema";
|
|
11
|
+
/**
|
|
12
|
+
* Timeline event types — DERIVED from `KnownRunEvent["type"]` (the canonical
|
|
13
|
+
* run-event vocabulary). There is intentionally no `(string & {})` escape
|
|
14
|
+
* hatch: a name that is not emitted by the SDK cannot enter the timeline, so
|
|
15
|
+
* phantom names (`turn.ended`, `permission.asked`, `assistant.chunk`, …) are
|
|
16
|
+
* rejected at compile time.
|
|
17
|
+
*/
|
|
18
|
+
export type TimelineEventType = KnownRunEvent["type"];
|
|
19
|
+
/**
|
|
20
|
+
* Every timeline event type the SDK emits, in emission order.
|
|
21
|
+
*
|
|
22
|
+
* Checked both ways at compile time:
|
|
23
|
+
* - `satisfies` → an unknown name fails typecheck (no phantoms);
|
|
24
|
+
* - {@link TimelineCoversAllRunEvents} → a missing name fails typecheck
|
|
25
|
+
* (adding a `KnownRunEvent` without updating this list is a build error).
|
|
26
|
+
*/
|
|
27
|
+
export declare const KNOWN_TIMELINE_EVENT_TYPES: readonly ["run.started", "step.started", "token.streamed", "thinking.started", "thinking.content", "thinking.completed", "context.compressed", "token.counted", "tool.invoked", "tool.completed", "tool.failed", "tool.cancelled", "tool.self_correcting", "step.completed", "step.failed", "run.completed", "permission.requested", "permission.replied", "step.type_changed", "model.cost", "turn.started", "turn.end", "agent.handoff", "llm.retry", "llm.retry_started", "llm.failover", "approval.asked", "approval.decided", "request.header", "request.context", "llm.request", "llm.response"];
|
|
28
|
+
/** Compile-time helper: constrains `T` to `never` (errors on anything else). */
|
|
29
|
+
type AssertNever<T extends never> = T;
|
|
30
|
+
/**
|
|
31
|
+
* Compile-time drift check: fails to typecheck when a `KnownRunEvent` type
|
|
32
|
+
* is missing from {@link KNOWN_TIMELINE_EVENT_TYPES}.
|
|
33
|
+
*/
|
|
34
|
+
export type TimelineCoversAllRunEvents = AssertNever<Exclude<KnownRunEvent["type"], (typeof KNOWN_TIMELINE_EVENT_TYPES)[number]>>;
|
|
13
35
|
/** A single timeline event */
|
|
14
36
|
export interface TimelineEvent {
|
|
15
37
|
/** Event type */
|
|
@@ -60,4 +82,5 @@ export interface TranscriptEntry {
|
|
|
60
82
|
output?: unknown;
|
|
61
83
|
timestampMs: number;
|
|
62
84
|
}
|
|
85
|
+
export {};
|
|
63
86
|
//# sourceMappingURL=timeline.d.ts.map
|
package/dist/timeline.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timeline.d.ts","sourceRoot":"","sources":["../src/timeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH
|
|
1
|
+
{"version":3,"file":"timeline.d.ts","sourceRoot":"","sources":["../src/timeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD;;;;;;GAMG;AACH,MAAM,MAAM,iBAAiB,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;AAEtD;;;;;;;GAOG;AACH,eAAO,MAAM,0BAA0B,wkBAiCc,CAAC;AAEtD,gFAAgF;AAChF,KAAK,WAAW,CAAC,CAAC,SAAS,KAAK,IAAI,CAAC,CAAC;AAEtC;;;GAGG;AACH,MAAM,MAAM,0BAA0B,GAAG,WAAW,CAClD,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,0BAA0B,CAAC,CAAC,MAAM,CAAC,CAAC,CAC5E,CAAC;AAEF,8BAA8B;AAC9B,MAAM,WAAW,aAAa;IAC5B,iBAAiB;IACjB,QAAQ,CAAC,IAAI,EAAE,iBAAiB,CAAC;IACjC,0BAA0B;IAC1B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,iCAAiC;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvC,mDAAmD;IACnD,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,qBAAa,QAAQ;IACnB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAuB;IAC9C,OAAO,CAAC,GAAG,CAAK;IAEhB,sBAAsB;IACtB,MAAM,CAAC,IAAI,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,aAAa;IAW7E,qBAAqB;IACrB,SAAS,IAAI,SAAS,aAAa,EAAE;IAIrC,kCAAkC;IAClC,eAAe,CAAC,IAAI,EAAE,iBAAiB,GAAG,SAAS,aAAa,EAAE;IAIlE,iCAAiC;IACjC,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,aAAa,EAAE;IAI1E,sBAAsB;IACtB,KAAK,IAAI,MAAM;IAIf,mCAAmC;IACnC,aAAa,IAAI,MAAM;IAKvB,sCAAsC;IAChC,MAAM,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAM7E,4BAA4B;IAC5B,MAAM,IAAI,aAAa,EAAE;IAIzB,8BAA8B;IAC9B,MAAM,CAAC,MAAM,EAAE,aAAa,EAAE,GAAG,IAAI;CAOtC;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,aAAa,EAAE,GAAG,eAAe,EAAE,CAuCnF;AAED,kDAAkD;AAClD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,WAAW,GAAG,aAAa,CAAC;IACzD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;CACrB"}
|
package/dist/timeline.js
CHANGED
|
@@ -7,28 +7,47 @@
|
|
|
7
7
|
* The timeline is a linear sequence of events that can be replayed
|
|
8
8
|
* to reconstruct the full conversation history.
|
|
9
9
|
*/
|
|
10
|
+
/**
|
|
11
|
+
* Every timeline event type the SDK emits, in emission order.
|
|
12
|
+
*
|
|
13
|
+
* Checked both ways at compile time:
|
|
14
|
+
* - `satisfies` → an unknown name fails typecheck (no phantoms);
|
|
15
|
+
* - {@link TimelineCoversAllRunEvents} → a missing name fails typecheck
|
|
16
|
+
* (adding a `KnownRunEvent` without updating this list is a build error).
|
|
17
|
+
*/
|
|
10
18
|
export const KNOWN_TIMELINE_EVENT_TYPES = [
|
|
11
19
|
"run.started",
|
|
12
|
-
"run.completed",
|
|
13
|
-
"run.failed",
|
|
14
20
|
"step.started",
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
21
|
+
"token.streamed",
|
|
22
|
+
"thinking.started",
|
|
23
|
+
"thinking.content",
|
|
24
|
+
"thinking.completed",
|
|
25
|
+
"context.compressed",
|
|
26
|
+
"token.counted",
|
|
19
27
|
"tool.invoked",
|
|
20
28
|
"tool.completed",
|
|
21
29
|
"tool.failed",
|
|
22
30
|
"tool.cancelled",
|
|
23
|
-
"
|
|
24
|
-
"
|
|
31
|
+
"tool.self_correcting",
|
|
32
|
+
"step.completed",
|
|
33
|
+
"step.failed",
|
|
34
|
+
"run.completed",
|
|
35
|
+
"permission.requested",
|
|
36
|
+
"permission.replied",
|
|
37
|
+
"step.type_changed",
|
|
38
|
+
"model.cost",
|
|
39
|
+
"turn.started",
|
|
40
|
+
"turn.end",
|
|
41
|
+
"agent.handoff",
|
|
25
42
|
"llm.retry",
|
|
26
43
|
"llm.retry_started",
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
44
|
+
"llm.failover",
|
|
45
|
+
"approval.asked",
|
|
46
|
+
"approval.decided",
|
|
47
|
+
"request.header",
|
|
48
|
+
"request.context",
|
|
49
|
+
"llm.request",
|
|
50
|
+
"llm.response",
|
|
32
51
|
];
|
|
33
52
|
/**
|
|
34
53
|
* Timeline — ordered sequence of events for a session.
|
|
@@ -103,7 +122,7 @@ export function buildTranscript(events) {
|
|
|
103
122
|
timestampMs: event.timestampMs,
|
|
104
123
|
});
|
|
105
124
|
break;
|
|
106
|
-
case "
|
|
125
|
+
case "token.streamed":
|
|
107
126
|
entries.push({
|
|
108
127
|
type: "assistant",
|
|
109
128
|
content: event.data.content,
|
package/dist/timeline.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timeline.js","sourceRoot":"","sources":["../src/timeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"timeline.js","sourceRoot":"","sources":["../src/timeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAaH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG;IACxC,aAAa;IACb,cAAc;IACd,gBAAgB;IAChB,kBAAkB;IAClB,kBAAkB;IAClB,oBAAoB;IACpB,oBAAoB;IACpB,eAAe;IACf,cAAc;IACd,gBAAgB;IAChB,aAAa;IACb,gBAAgB;IAChB,sBAAsB;IACtB,gBAAgB;IAChB,aAAa;IACb,eAAe;IACf,sBAAsB;IACtB,oBAAoB;IACpB,mBAAmB;IACnB,YAAY;IACZ,cAAc;IACd,UAAU;IACV,eAAe;IACf,WAAW;IACX,mBAAmB;IACnB,cAAc;IACd,gBAAgB;IAChB,kBAAkB;IAClB,gBAAgB;IAChB,iBAAiB;IACjB,aAAa;IACb,cAAc;CACqC,CAAC;AAyBtD;;GAEG;AACH,MAAM,OAAO,QAAQ;IACF,MAAM,GAAoB,EAAE,CAAC;IACtC,GAAG,GAAG,CAAC,CAAC;IAEhB,sBAAsB;IACtB,MAAM,CAAC,IAAuB,EAAE,IAA6B;QAC3D,MAAM,KAAK,GAAkB;YAC3B,IAAI;YACJ,WAAW,EAAE,IAAI,CAAC,GAAG,EAAE;YACvB,IAAI;YACJ,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE;SAChB,CAAC;QACF,IAAI,CAAC,MAAM,CAAC,IAA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AAa;oBACnB,QAAQ,EAAE,KAAK,CAAC,IAAI,CAAC,QAAkB;oBACvC,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM;oBACzB,WAAW,EAAE,KAAK,CAAC,WAAW;iBAC/B,CAAC,CAAC;gBACH,MAAM;QACV,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/dist/tracing.d.ts
CHANGED
|
@@ -53,8 +53,11 @@ export interface TraceContext {
|
|
|
53
53
|
export declare function generateTraceId(): string;
|
|
54
54
|
/**
|
|
55
55
|
* Create a new span.
|
|
56
|
+
*
|
|
57
|
+
* `startTimeMs` back-dates the span — used when a span is recorded after the
|
|
58
|
+
* work finished (e.g. tool batches, failed calls) but must keep its real start.
|
|
56
59
|
*/
|
|
57
|
-
export declare function createSpan(name: string, kind: SpanKind, parentId?: string, traceId?: string): Span;
|
|
60
|
+
export declare function createSpan(name: string, kind: SpanKind, parentId?: string, traceId?: string, startTimeMs?: number): Span;
|
|
58
61
|
/**
|
|
59
62
|
* End a span with a status.
|
|
60
63
|
*/
|
|
@@ -70,8 +73,8 @@ export declare class SpanRecorder {
|
|
|
70
73
|
private readonly spans;
|
|
71
74
|
private readonly traceId;
|
|
72
75
|
constructor(traceId?: string);
|
|
73
|
-
/** Start a new span */
|
|
74
|
-
startSpan(name: string, kind: SpanKind, parentId?: string): Span;
|
|
76
|
+
/** Start a new span — `startTimeMs` optionally back-dates the start. */
|
|
77
|
+
startSpan(name: string, kind: SpanKind, parentId?: string, startTimeMs?: number): Span;
|
|
75
78
|
/** End a span */
|
|
76
79
|
endSpan(span: Span, status?: SpanStatus): void;
|
|
77
80
|
/** Get all recorded spans */
|
package/dist/tracing.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tracing.d.ts","sourceRoot":"","sources":["../src/tracing.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,kBAAkB;AAClB,MAAM,MAAM,UAAU,GA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AC7B,QAAQ,IAAI,SAAS,IAAI,EAAE;IAI3B,sCAAsC;IACtC,WAAW,IAAI,QAAQ,EAAE;IA0BzB,sCAAsC;IACtC,kBAAkB,IAAI,MAAM;CAM7B;AAED,8BAA8B;AAC9B,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,IAAI,CAAC;IACX,QAAQ,EAAE,QAAQ,EAAE,CAAC;CACtB"}
|
package/dist/tracing.js
CHANGED
|
@@ -19,15 +19,18 @@ export function generateTraceId() {
|
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
21
|
* Create a new span.
|
|
22
|
+
*
|
|
23
|
+
* `startTimeMs` back-dates the span — used when a span is recorded after the
|
|
24
|
+
* work finished (e.g. tool batches, failed calls) but must keep its real start.
|
|
22
25
|
*/
|
|
23
|
-
export function createSpan(name, kind, parentId, traceId) {
|
|
26
|
+
export function createSpan(name, kind, parentId, traceId, startTimeMs) {
|
|
24
27
|
return {
|
|
25
28
|
id: generateSpanId(),
|
|
26
29
|
traceId,
|
|
27
30
|
parentId,
|
|
28
31
|
name,
|
|
29
32
|
kind,
|
|
30
|
-
startTimeMs: Date.now(),
|
|
33
|
+
startTimeMs: startTimeMs ?? Date.now(),
|
|
31
34
|
endTimeMs: 0,
|
|
32
35
|
status: "ok",
|
|
33
36
|
attributes: {},
|
|
@@ -60,9 +63,9 @@ export class SpanRecorder {
|
|
|
60
63
|
constructor(traceId) {
|
|
61
64
|
this.traceId = traceId ?? generateTraceId();
|
|
62
65
|
}
|
|
63
|
-
/** Start a new span */
|
|
64
|
-
startSpan(name, kind, parentId) {
|
|
65
|
-
const span = createSpan(name, kind, parentId ?? this.spans[this.spans.length - 1]?.id, this.traceId);
|
|
66
|
+
/** Start a new span — `startTimeMs` optionally back-dates the start. */
|
|
67
|
+
startSpan(name, kind, parentId, startTimeMs) {
|
|
68
|
+
const span = createSpan(name, kind, parentId ?? this.spans[this.spans.length - 1]?.id, this.traceId, startTimeMs);
|
|
66
69
|
this.spans.push(span);
|
|
67
70
|
return span;
|
|
68
71
|
}
|
package/dist/tracing.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tracing.js","sourceRoot":"","sources":["../src/tracing.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,MAAM,CAAC,MAAM,mBAAmB,GAA0B,CAAC,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;AA6ClG,IAAI,WAAW,GAAG,CAAC,CAAC;AAEpB,gCAAgC;AAChC,SAAS,cAAc;IACrB,OAAO,QAAQ,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC;AAC3E,CAAC;AAED,iCAAiC;AACjC,MAAM,UAAU,eAAe;IAC7B,OAAO,SAAS,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;AACtF,CAAC;AAED
|
|
1
|
+
{"version":3,"file":"tracing.js","sourceRoot":"","sources":["../src/tracing.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,MAAM,CAAC,MAAM,mBAAmB,GAA0B,CAAC,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;AA6ClG,IAAI,WAAW,GAAG,CAAC,CAAC;AAEpB,gCAAgC;AAChC,SAAS,cAAc;IACrB,OAAO,QAAQ,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC;AAC3E,CAAC;AAED,iCAAiC;AACjC,MAAM,UAAU,eAAe;IAC7B,OAAO,SAAS,IA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ACN,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACnB,CAAC;QACH,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;IAED,sCAAsC;IACtC,kBAAkB;QAChB,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,CAAC,CAAC;QACtC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;QAChE,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QAC1E,OAAO,GAAG,GAAG,KAAK,CAAC;IACrB,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vinhnt-sdk/trace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.1",
|
|
4
4
|
"description": "Observability - OpenTelemetry spans, timeline replay, telemetry aggregation",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
},
|
|
26
26
|
"repository": {
|
|
27
27
|
"type": "git",
|
|
28
|
-
"url": "https://github.com/vinhnt-develop/vinhnt-sdk.git",
|
|
28
|
+
"url": "git+https://github.com/vinhnt-develop/vinhnt-sdk.git",
|
|
29
29
|
"directory": "packages/trace"
|
|
30
30
|
},
|
|
31
31
|
"homepage": "https://github.com/vinhnt-develop/vinhnt-sdk/tree/main/packages/trace",
|
|
@@ -42,18 +42,17 @@
|
|
|
42
42
|
"publishConfig": {
|
|
43
43
|
"access": "public"
|
|
44
44
|
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@vinhnt-sdk/schema": "0.11.1"
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"vitest": "^3.2.7"
|
|
50
|
+
},
|
|
45
51
|
"scripts": {
|
|
46
52
|
"build": "tsc -b",
|
|
47
53
|
"typecheck": "tsc --noEmit",
|
|
48
54
|
"clean": "node -e \"try{require('fs').rmSync('dist',{recursive:true,force:true})}catch(e){}\" && node -e \"try{require('fs').rmSync('tsconfig.tsbuildinfo',{force:true})}catch(e){}\"",
|
|
49
|
-
"prepublishOnly": "pnpm build",
|
|
50
55
|
"test": "vitest run",
|
|
51
56
|
"lint": "eslint ."
|
|
52
|
-
},
|
|
53
|
-
"dependencies": {
|
|
54
|
-
"@vinhnt-sdk/schema": "0.5.9"
|
|
55
|
-
},
|
|
56
|
-
"devDependencies": {
|
|
57
|
-
"vitest": "^3.2.7"
|
|
58
57
|
}
|
|
59
|
-
}
|
|
58
|
+
}
|