@jambonz/llm 0.4.6 → 0.5.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.
@@ -92,6 +92,42 @@ type LlmEvent = {
92
92
  finishReason: FinishReason;
93
93
  usage?: Usage;
94
94
  rawReason?: string;
95
+ /**
96
+ * Optional vendor-specific diagnostic data captured from response
97
+ * headers — request id, rate-limit remaining, routing/region, vendor
98
+ * processing time, cache token counts, etc. Each adapter contributes
99
+ * an allowlisted subset; never present unless the adapter populated it.
100
+ *
101
+ * Shape is `Record<string, string | number>` so consumers can render
102
+ * it as a key/value table without per-vendor knowledge. The webapp
103
+ * surfaces this on the per-turn detail view; feature-server forwards
104
+ * it on the agent verb's `turn_end` eventHook payload as
105
+ * `vendor_metadata`.
106
+ */
107
+ vendorMetadata?: Record<string, string | number>;
108
+ /**
109
+ * Optional client-side timing breakdown for diagnosing latency.
110
+ * Captured by the adapter using `process.hrtime`. Numbers are
111
+ * milliseconds. When present:
112
+ * - `requestToHeadersMs`: from when the SDK call was initiated
113
+ * to when response headers were received. Includes TLS/TCP
114
+ * handshake (if connection was cold), network RTT in both
115
+ * directions, and any vendor-side queueing/processing time
116
+ * before the first byte.
117
+ * - `headersToFirstTokenMs`: from response headers received to
118
+ * first content chunk emitted. Usually small (<50ms) if the
119
+ * vendor is streaming normally; larger values suggest SSE
120
+ * buffering or chunk-transfer issues. Undefined if no token
121
+ * was emitted (error or empty response).
122
+ * - `totalMs`: full wall-clock from SDK call to stream end.
123
+ * Adapters that cannot measure these (different SDK shape) omit
124
+ * the field entirely.
125
+ */
126
+ clientTiming?: {
127
+ requestToHeadersMs: number;
128
+ headersToFirstTokenMs?: number;
129
+ totalMs: number;
130
+ };
95
131
  };
96
132
  /** Convenience alias for the fully-accumulated tool-call event shape. */
97
133
  type ToolCallEvent = Extract<LlmEvent, {
@@ -92,6 +92,42 @@ type LlmEvent = {
92
92
  finishReason: FinishReason;
93
93
  usage?: Usage;
94
94
  rawReason?: string;
95
+ /**
96
+ * Optional vendor-specific diagnostic data captured from response
97
+ * headers — request id, rate-limit remaining, routing/region, vendor
98
+ * processing time, cache token counts, etc. Each adapter contributes
99
+ * an allowlisted subset; never present unless the adapter populated it.
100
+ *
101
+ * Shape is `Record<string, string | number>` so consumers can render
102
+ * it as a key/value table without per-vendor knowledge. The webapp
103
+ * surfaces this on the per-turn detail view; feature-server forwards
104
+ * it on the agent verb's `turn_end` eventHook payload as
105
+ * `vendor_metadata`.
106
+ */
107
+ vendorMetadata?: Record<string, string | number>;
108
+ /**
109
+ * Optional client-side timing breakdown for diagnosing latency.
110
+ * Captured by the adapter using `process.hrtime`. Numbers are
111
+ * milliseconds. When present:
112
+ * - `requestToHeadersMs`: from when the SDK call was initiated
113
+ * to when response headers were received. Includes TLS/TCP
114
+ * handshake (if connection was cold), network RTT in both
115
+ * directions, and any vendor-side queueing/processing time
116
+ * before the first byte.
117
+ * - `headersToFirstTokenMs`: from response headers received to
118
+ * first content chunk emitted. Usually small (<50ms) if the
119
+ * vendor is streaming normally; larger values suggest SSE
120
+ * buffering or chunk-transfer issues. Undefined if no token
121
+ * was emitted (error or empty response).
122
+ * - `totalMs`: full wall-clock from SDK call to stream end.
123
+ * Adapters that cannot measure these (different SDK shape) omit
124
+ * the field entirely.
125
+ */
126
+ clientTiming?: {
127
+ requestToHeadersMs: number;
128
+ headersToFirstTokenMs?: number;
129
+ totalMs: number;
130
+ };
95
131
  };
96
132
  /** Convenience alias for the fully-accumulated tool-call event shape. */
97
133
  type ToolCallEvent = Extract<LlmEvent, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jambonz/llm",
3
- "version": "0.4.6",
3
+ "version": "0.5.1",
4
4
  "description": "Voice-oriented LLM adapter library — a uniform interface for streaming chat completions from multiple LLM vendors, with first-class support for tool calls, AbortSignal interruption, and lossless history round-tripping.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",