@jambonz/llm 0.5.0 → 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.
@@ -105,6 +105,29 @@ type LlmEvent = {
105
105
  * `vendor_metadata`.
106
106
  */
107
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
+ };
108
131
  };
109
132
  /** Convenience alias for the fully-accumulated tool-call event shape. */
110
133
  type ToolCallEvent = Extract<LlmEvent, {
@@ -105,6 +105,29 @@ type LlmEvent = {
105
105
  * `vendor_metadata`.
106
106
  */
107
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
+ };
108
131
  };
109
132
  /** Convenience alias for the fully-accumulated tool-call event shape. */
110
133
  type ToolCallEvent = Extract<LlmEvent, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jambonz/llm",
3
- "version": "0.5.0",
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",