@runtypelabs/flue-otel 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,105 @@
1
+ # @runtypelabs/flue-otel
2
+
3
+ ## 0.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 21f5bbb: Make the producing instrumentation's version detectable server-side. `@runtypelabs/flue-otel` now stamps `runtype.adapter.name` / `runtype.adapter.version` on each run's `invoke_agent` span, so a trace identifies its producer without the customer wiring `runtypeFlueResourceAttributes` into their SDK `Resource`. OTLP trace ingest resolves the pair (resource level first, envelope span second) and records it on the run's log row as `otlpAdapterName` / `otlpAdapterVersion`, regardless of logging policy.
8
+
9
+ ## 0.3.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 01df868: Add an opt-in `content` option that emits tool arguments (`gen_ai.tool.call.arguments`, at span open) and tool results (`gen_ai.tool.call.result`, before span end) on `execute_tool` spans, so a Flue run's tool cards in Runtype show their input and output. Off by default; per-kind switches, a per-value `maxChars` ceiling with an explicit truncation marker (clamped to the ingest per-attribute ceiling), and a `redact` hook. A failed tool's result, the host's shell call, and prompts/completions are still never sent.
14
+
15
+ ## 0.2.2
16
+
17
+ ### Patch Changes
18
+
19
+ - 5f00348: Carry Workers AI `gatewayLogId` and `providerFinishReason` onto the chat span
20
+
21
+ Flue's `turn` event carries two allowlisted raw-provider fields that
22
+ `@runtypelabs/flue-otel` previously dropped. Both are now emitted on the `chat`
23
+ span as `runtype.*` extension attributes, gated on presence so an absent value
24
+ costs nothing:
25
+ - `runtype.gateway.log_id` — the response's own gateway log id (e.g.
26
+ Cloudflare AI Gateway's `cf-aig-log-id`), a pointer to the request in the
27
+ customer's own AI Gateway dashboard without shipping the content.
28
+ - `runtype.provider.finish_reason` — the provider's exact finish value before
29
+ normalization (e.g. Workers AI's `tool_calls` behind the normalized
30
+ `toolUse`), for diagnosis when a run stops unexpectedly.
31
+
32
+ Both attribute names are added to the shared `RUNTYPE_ATTRIBUTES` vocabulary
33
+ (`packages/shared/src/otlp-runtype-semconv.ts`) so the emit side and the ingest
34
+ side stay in step. They are additive diagnostics and do not count toward the
35
+ achieved fidelity tier.
36
+
37
+ ## 0.2.1
38
+
39
+ ### Patch Changes
40
+
41
+ - 625c455: Rewrite the README from first principles. It now leads with install, quick
42
+ start and the no-SDK recipe, then configuration, attribution, shutdown, and
43
+ what the package emits, instead of narrating how the package differs from
44
+ earlier instrumentations.
45
+
46
+ ## 0.2.0
47
+
48
+ ### Minor Changes
49
+
50
+ - 2439b84: New package: `@runtypelabs/flue-otel`, an OpenTelemetry instrumentation for Flue
51
+ agents that reports runs to Runtype at `t2-runtype` fidelity.
52
+
53
+ Stock `@flue/opentelemetry` already exports GenAI semconv spans, and the ingest
54
+ normalizer shipped in #7336 lifts those to t2 by reading Flue's own `flue.*`
55
+ identifiers. This package is the client-side complement, for the facts a
56
+ server-side normalizer structurally cannot reach:
57
+ - **Absolute loop position.** `runtype.turn.index` / `runtype.iteration` are
58
+ deliberately NOT derived at ingest, because Flue puts no absolute ordinal on
59
+ the wire and ranking opaque turn ids ranks whatever the export batch happened
60
+ to carry — a five-turn run whose closing batch holds two turns would be
61
+ recorded as two iterations. In process the count is exact.
62
+ - **A run-level usage roll-up on the envelope.** Summed from `turn` leaves, so a
63
+ split export cannot lose the total: the batch carrying the terminal carries
64
+ the complete sum by construction.
65
+ - **Per-agent attribution for N agents in one process**, via the span-level
66
+ `runtype.agent.id` placement, keyed by Flue agent name.
67
+ - **One `invoke_agent` span per trace.** Stock opens a nested one for every
68
+ `task` delegation, which is a coin flip over which invocation bounds the run
69
+ (ingest's envelope selection is first-match over exporter-controlled array
70
+ order). Here a delegation is reported as an `execute_tool` span typed
71
+ `subagent`, and the sub-agent's work gets a non-agent `flue.task` span.
72
+
73
+ Works on both Flue lines (`>=1.0.0-beta.9` and 2.x) from one entry point, via a
74
+ capability probe rather than version comparison. Depends on `@opentelemetry/api`
75
+ only — no SDK, no provider, no exporter, no flush; the application owns those.
76
+
77
+ Emits no content in this release: no prompts, completions, tool arguments or
78
+ results, error messages, or stack traces.
79
+
80
+ `@runtypelabs/shared` exports the wire stop-reason tuple as `WIRE_STOP_REASONS`
81
+ (the zod enum is now derived from it, so the two cannot disagree). The ingest
82
+ reader writes `runtype.stop_reason` to `agent_executions.stop_reason` verbatim
83
+ with no enum validation, so an external producer has to spell those six strings
84
+ itself; exporting the tuple is what lets the producer's contract test pin its
85
+ copy and turn a rename into a red build instead of a silently wrong column.
86
+
87
+ ### Patch Changes
88
+
89
+ - 3b4f69c: License `@runtypelabs/flue-otel` under MIT rather than Apache-2.0, and ship the
90
+ license text in the published tarball.
91
+
92
+ The package declared `Apache-2.0` in `package.json` and in its README while
93
+ carrying no license file at all, so the published artifact asserted a grant
94
+ whose terms it never included. `LICENSE` is now added to `files`, matching how
95
+ every other published package here (`cli`, `python-sdk`, `ruby-sdk`,
96
+ `java-sdk`, `php-sdk`) ships its license.
97
+
98
+ - 3b4f69c: Normalize package authorship and copyright metadata.
99
+
100
+ The `author` field reads `Runtype` rather than `Runtype Labs` across every
101
+ workspace package that set it, and the copyright holder in each license file is
102
+ now `Runtype, Inc` — replacing `Travrse Labs, Inc` in the CLI and the four Fern
103
+ SDKs, and the `Runtype Labs` that the new `flue-otel` license was written with.
104
+
105
+ Metadata only: no source, dependency, or behavior change.
package/README.md CHANGED
@@ -106,7 +106,10 @@ subscriber. Its key is exported as `RUNTYPE_FLUE_INSTRUMENTATION_KEY`.
106
106
 
107
107
  - `runtypeFlueResourceAttributes({ agentId? })` builds the `runtype.*` resource
108
108
  attributes (`schema.version`, `adapter.name`, `adapter.version`, and
109
- `agent.id` when given). Spread it into your SDK `Resource`.
109
+ `agent.id` when given). Spread it into your SDK `Resource`. The adapter pair
110
+ is also stamped on each run's `invoke_agent` span, so Runtype can tell which
111
+ version produced a trace even when the resource is not wired; the resource
112
+ placement still wins where both are present.
110
113
  - `GEN_AI` and `RUNTYPE`: the attribute-name constants this package emits by
111
114
  default; `GEN_AI_CONTENT`: the two it emits under the `content` opt-in.
112
115
  - `DEFAULT_CONTENT_MAX_CHARS` and `INGEST_CONTENT_ATTRIBUTE_CEILING`: the
package/dist/index.cjs CHANGED
@@ -154,7 +154,7 @@ function isHighSurrogate(code) {
154
154
  }
155
155
 
156
156
  // package.json
157
- var version = "0.3.0";
157
+ var version = "0.4.0";
158
158
 
159
159
  // src/semconv.ts
160
160
  var GEN_AI = {
@@ -340,7 +340,12 @@ function createFlueProjection(options = {}) {
340
340
  // any inbound id; it does not key the row, which stays derived from
341
341
  // the trace id.
342
342
  ...isEnvelope && event.submissionId ? { [RUNTYPE.executionId]: event.submissionId } : {},
343
- ...isEnvelope && agentId ? { [RUNTYPE.agentId]: agentId } : {}
343
+ ...isEnvelope && agentId ? { [RUNTYPE.agentId]: agentId } : {},
344
+ // WHY(README.md): the resource placement is the customer's to wire and is routinely skipped.
345
+ ...isEnvelope ? {
346
+ [RUNTYPE.adapterName]: ADAPTER_NAME,
347
+ [RUNTYPE.adapterVersion]: ADAPTER_VERSION
348
+ } : {}
344
349
  }
345
350
  }
346
351
  ];
package/dist/index.mjs CHANGED
@@ -118,7 +118,7 @@ function isHighSurrogate(code) {
118
118
  }
119
119
 
120
120
  // package.json
121
- var version = "0.3.0";
121
+ var version = "0.4.0";
122
122
 
123
123
  // src/semconv.ts
124
124
  var GEN_AI = {
@@ -304,7 +304,12 @@ function createFlueProjection(options = {}) {
304
304
  // any inbound id; it does not key the row, which stays derived from
305
305
  // the trace id.
306
306
  ...isEnvelope && event.submissionId ? { [RUNTYPE.executionId]: event.submissionId } : {},
307
- ...isEnvelope && agentId ? { [RUNTYPE.agentId]: agentId } : {}
307
+ ...isEnvelope && agentId ? { [RUNTYPE.agentId]: agentId } : {},
308
+ // WHY(README.md): the resource placement is the customer's to wire and is routinely skipped.
309
+ ...isEnvelope ? {
310
+ [RUNTYPE.adapterName]: ADAPTER_NAME,
311
+ [RUNTYPE.adapterVersion]: ADAPTER_VERSION
312
+ } : {}
308
313
  }
309
314
  }
310
315
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@runtypelabs/flue-otel",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "OpenTelemetry instrumentation for Flue agents that emits GenAI semconv spans plus Runtype's runtype.* extension vocabulary, so a Flue run lands in Runtype at full fidelity.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -31,11 +31,11 @@
31
31
  "@opentelemetry/api": "^1.9.0",
32
32
  "@opentelemetry/context-async-hooks": "^2.1.0",
33
33
  "@opentelemetry/sdk-trace-base": "^2.1.0",
34
+ "@runtypelabs/execution-ingest": "0.6.18",
35
+ "@runtypelabs/shared": "3.35.1",
34
36
  "tsup": "^8.0.2",
35
37
  "typescript": "^6.0.3",
36
- "vitest": "^4.1.0",
37
- "@runtypelabs/execution-ingest": "0.6.12",
38
- "@runtypelabs/shared": "3.32.0"
38
+ "vitest": "^4.1.0"
39
39
  },
40
40
  "publishConfig": {
41
41
  "access": "public"