teckel-ai 0.5.1 → 0.7.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/dist/index.d.ts CHANGED
@@ -1,107 +1,11 @@
1
+ import { T as TeckelConfig, a as TraceData, F as FeedbackData } from './types-c7iVpo4d.js';
2
+ export { B as BatchConfig, D as Document, g as FeedbackResult, e as FeedbackType, S as SpanData, d as SpanStatus, c as SpanType, b as TokenUsage, f as TraceResult } from './types-c7iVpo4d.js';
1
3
  import { z } from 'zod';
2
4
 
3
- /**
4
- * Type definitions for teckel-ai SDK
5
- */
6
- interface TeckelConfig {
7
- /** Teckel API key (tk_live_...) */
8
- apiKey: string;
9
- /** API endpoint (default: https://app.teckel.ai/api) */
10
- endpoint?: string;
11
- /** Enable debug logging */
12
- debug?: boolean;
13
- /** Network timeout in ms (default: 5000) */
14
- timeoutMs?: number;
15
- }
16
- /**
17
- * Document/chunk from your RAG pipeline.
18
- * The `id` field is your stable identifier - server generates internal UUIDs via deterministic hashing.
19
- */
20
- interface Document {
21
- /** Your document identifier (any format: "overview.md", "doc-123", etc.) */
22
- id: string;
23
- /** Human-readable document name */
24
- name: string;
25
- /** The actual text/chunk content */
26
- text: string;
27
- /** ISO 8601 timestamp - enables version tracking */
28
- lastUpdated?: string;
29
- /** Link to source (URL, intranet, file://) */
30
- url?: string;
31
- /** Storage platform: confluence, slack, gdrive, etc. */
32
- source?: string;
33
- /** File format: pdf, docx, md, etc. */
34
- fileFormat?: string;
35
- /** Vector similarity score (0-1) */
36
- similarity?: number;
37
- /** Position in results */
38
- rank?: number;
39
- /** Document owner email */
40
- ownerEmail?: string;
41
- }
42
- interface TokenUsage {
43
- prompt: number;
44
- completion: number;
45
- total: number;
46
- }
47
- /**
48
- * Trace data for a single query-response interaction.
49
- * Sessions are created implicitly when traces share the same sessionId.
50
- */
51
- interface TraceData {
52
- /** User's question/prompt */
53
- query: string;
54
- /** LLM's response */
55
- response: string;
56
- /** Model name (e.g., 'gpt-4') */
57
- model?: string;
58
- /** Response time in milliseconds */
59
- latencyMs?: number;
60
- /** Token usage */
61
- tokens?: TokenUsage;
62
- /** Source documents used in RAG */
63
- documents?: Document[];
64
- /** Groups traces into a session (any string up to 200 chars, OTEL compatible) */
65
- sessionId?: string;
66
- /** User identifier */
67
- userId?: string;
68
- /** Client-provided trace ID (UUID, auto-generated if omitted) */
69
- traceId?: string;
70
- /** LLM system prompt/instructions */
71
- systemPrompt?: string;
72
- /** Custom metadata (max 10KB) */
73
- metadata?: Record<string, unknown>;
74
- }
75
- type FeedbackType = 'thumbs_up' | 'thumbs_down' | 'flag' | 'rating';
76
- /**
77
- * User feedback signal. Target either a specific trace or an entire session.
78
- */
79
- interface FeedbackData {
80
- /** Target trace (UUID) */
81
- traceId?: string;
82
- /** Target session (any string up to 200 chars) */
83
- sessionId?: string;
84
- /** Feedback type */
85
- type: FeedbackType;
86
- /** For ratings: '1'-'5' */
87
- value?: string;
88
- /** Optional comment */
89
- comment?: string;
90
- }
91
- interface TraceResult {
92
- traceId: string;
93
- sessionId?: string;
94
- chunkCount: number;
95
- }
96
- interface FeedbackResult {
97
- feedbackId: string;
98
- type: FeedbackType;
99
- traceId?: string;
100
- sessionId?: string;
101
- }
102
-
103
5
  /**
104
6
  * TeckelTracer - Fire-and-forget trace collection for AI applications
7
+ *
8
+ * v0.6.0: Added batch ingestion for high-throughput scenarios (100x improvement)
105
9
  */
106
10
 
107
11
  declare class TeckelTracer {
@@ -109,24 +13,82 @@ declare class TeckelTracer {
109
13
  private readonly endpoint;
110
14
  private readonly debug;
111
15
  private readonly timeoutMs;
16
+ private readonly batchConfig;
112
17
  private sendQueue;
18
+ private batchBuffer;
19
+ private batchByteCount;
20
+ private batchFlushTimer;
21
+ private isDestroyed;
113
22
  constructor(config: TeckelConfig);
114
23
  /**
115
24
  * Record a trace. Fire-and-forget - call flush() in serverless before termination.
25
+ *
26
+ * With batching enabled (default), traces are buffered and sent in batches
27
+ * for dramatically improved throughput (100x for high-volume scenarios).
28
+ *
29
+ * Token auto-aggregation: If you provide `spans` but not `tokens`, the tracer
30
+ * automatically aggregates token counts from all spans. OTel spans contain
31
+ * per-span token usage (promptTokens, completionTokens) which are summed to
32
+ * produce the trace-level totals. You can also provide your own `tokens` object
33
+ * to override this behavior.
34
+ *
35
+ * Cost calculation: If you provide `costUsd`, we use your value directly.
36
+ * Otherwise, cost is automatically calculated server-side from token counts.
37
+ * Per-span `costUsd` is also supported for detailed breakdown.
116
38
  */
117
39
  trace(data: TraceData): void;
118
40
  /**
119
41
  * Submit feedback for a trace or session.
42
+ * Feedback is always sent immediately (not batched).
120
43
  */
121
44
  feedback(data: FeedbackData): void;
122
45
  /**
123
46
  * Wait for queued requests to complete. Essential for serverless environments.
47
+ * This will flush any pending batch and wait for all requests to complete.
124
48
  */
125
49
  flush(timeoutMs?: number): Promise<void>;
50
+ /**
51
+ * Cleanup tracer resources. Call when done with the tracer.
52
+ * This flushes pending traces and stops the auto-flush timer.
53
+ */
54
+ destroy(): Promise<void>;
55
+ /**
56
+ * Get current batch buffer size (for testing/debugging)
57
+ */
58
+ get pendingTraceCount(): number;
59
+ /**
60
+ * Start the auto-flush timer
61
+ */
62
+ private startFlushTimer;
63
+ /**
64
+ * Stop the auto-flush timer
65
+ */
66
+ private stopFlushTimer;
67
+ /**
68
+ * Flush the current batch buffer
69
+ */
70
+ private flushBatch;
71
+ /**
72
+ * Send a batch of traces
73
+ */
74
+ private sendBatch;
126
75
  private send;
127
76
  private fetchWithRetry;
128
77
  private enqueue;
78
+ /**
79
+ * Log validation errors with actionable hints for common issues.
80
+ * Optionally reports to platform for internal debugging.
81
+ */
129
82
  private logValidationError;
83
+ /**
84
+ * Provide actionable hints for common validation errors.
85
+ */
86
+ private getValidationHint;
87
+ /**
88
+ * Report dropped traces to platform for internal debugging.
89
+ * Fire-and-forget - never blocks or throws.
90
+ */
91
+ private reportDropped;
130
92
  private logHttpError;
131
93
  }
132
94
 
@@ -187,9 +149,121 @@ declare const TokenUsageSchema: z.ZodObject<{
187
149
  completion: number;
188
150
  total: number;
189
151
  }>;
152
+ /** Span size limits */
153
+ declare const SPAN_SIZE_LIMITS: {
154
+ readonly MAX_SPANS: 100;
155
+ readonly JSONB_MAX_BYTES: 512000;
156
+ };
157
+ /** Span type enum - 6 meaningful operation types */
158
+ declare const SpanTypeSchema: z.ZodEnum<["llm_call", "tool_call", "retrieval", "agent", "guardrail", "custom"]>;
159
+ /** Span status enum */
160
+ declare const SpanStatusSchema: z.ZodEnum<["running", "completed", "error"]>;
161
+ /** Schema for span data */
162
+ declare const SpanDataSchema: z.ZodEffects<z.ZodObject<{
163
+ spanId: z.ZodOptional<z.ZodString>;
164
+ parentSpanId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
165
+ name: z.ZodString;
166
+ type: z.ZodDefault<z.ZodEnum<["llm_call", "tool_call", "retrieval", "agent", "guardrail", "custom"]>>;
167
+ startedAt: z.ZodString;
168
+ endedAt: z.ZodNullable<z.ZodOptional<z.ZodString>>;
169
+ durationMs: z.ZodOptional<z.ZodNumber>;
170
+ status: z.ZodDefault<z.ZodEnum<["running", "completed", "error"]>>;
171
+ statusMessage: z.ZodNullable<z.ZodOptional<z.ZodString>>;
172
+ toolName: z.ZodNullable<z.ZodOptional<z.ZodString>>;
173
+ toolArguments: z.ZodEffects<z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>, Record<string, unknown> | null | undefined, Record<string, unknown> | null | undefined>;
174
+ toolResult: z.ZodEffects<z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>, Record<string, unknown> | null | undefined, Record<string, unknown> | null | undefined>;
175
+ model: z.ZodNullable<z.ZodOptional<z.ZodString>>;
176
+ promptTokens: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
177
+ completionTokens: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
178
+ costUsd: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
179
+ input: z.ZodEffects<z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>, Record<string, unknown> | null | undefined, Record<string, unknown> | null | undefined>;
180
+ output: z.ZodEffects<z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>, Record<string, unknown> | null | undefined, Record<string, unknown> | null | undefined>;
181
+ metadata: z.ZodEffects<z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>, Record<string, unknown> | null | undefined, Record<string, unknown> | null | undefined>;
182
+ }, "strip", z.ZodTypeAny, {
183
+ name: string;
184
+ type: "llm_call" | "tool_call" | "retrieval" | "agent" | "guardrail" | "custom";
185
+ status: "running" | "completed" | "error";
186
+ startedAt: string;
187
+ spanId?: string | undefined;
188
+ parentSpanId?: string | null | undefined;
189
+ endedAt?: string | null | undefined;
190
+ durationMs?: number | undefined;
191
+ statusMessage?: string | null | undefined;
192
+ toolName?: string | null | undefined;
193
+ toolArguments?: Record<string, unknown> | null | undefined;
194
+ toolResult?: Record<string, unknown> | null | undefined;
195
+ model?: string | null | undefined;
196
+ promptTokens?: number | null | undefined;
197
+ completionTokens?: number | null | undefined;
198
+ costUsd?: number | null | undefined;
199
+ input?: Record<string, unknown> | null | undefined;
200
+ output?: Record<string, unknown> | null | undefined;
201
+ metadata?: Record<string, unknown> | null | undefined;
202
+ }, {
203
+ name: string;
204
+ startedAt: string;
205
+ type?: "llm_call" | "tool_call" | "retrieval" | "agent" | "guardrail" | "custom" | undefined;
206
+ status?: "running" | "completed" | "error" | undefined;
207
+ spanId?: string | undefined;
208
+ parentSpanId?: string | null | undefined;
209
+ endedAt?: string | null | undefined;
210
+ durationMs?: number | undefined;
211
+ statusMessage?: string | null | undefined;
212
+ toolName?: string | null | undefined;
213
+ toolArguments?: Record<string, unknown> | null | undefined;
214
+ toolResult?: Record<string, unknown> | null | undefined;
215
+ model?: string | null | undefined;
216
+ promptTokens?: number | null | undefined;
217
+ completionTokens?: number | null | undefined;
218
+ costUsd?: number | null | undefined;
219
+ input?: Record<string, unknown> | null | undefined;
220
+ output?: Record<string, unknown> | null | undefined;
221
+ metadata?: Record<string, unknown> | null | undefined;
222
+ }>, {
223
+ name: string;
224
+ type: "llm_call" | "tool_call" | "retrieval" | "agent" | "guardrail" | "custom";
225
+ status: "running" | "completed" | "error";
226
+ startedAt: string;
227
+ spanId?: string | undefined;
228
+ parentSpanId?: string | null | undefined;
229
+ endedAt?: string | null | undefined;
230
+ durationMs?: number | undefined;
231
+ statusMessage?: string | null | undefined;
232
+ toolName?: string | null | undefined;
233
+ toolArguments?: Record<string, unknown> | null | undefined;
234
+ toolResult?: Record<string, unknown> | null | undefined;
235
+ model?: string | null | undefined;
236
+ promptTokens?: number | null | undefined;
237
+ completionTokens?: number | null | undefined;
238
+ costUsd?: number | null | undefined;
239
+ input?: Record<string, unknown> | null | undefined;
240
+ output?: Record<string, unknown> | null | undefined;
241
+ metadata?: Record<string, unknown> | null | undefined;
242
+ }, {
243
+ name: string;
244
+ startedAt: string;
245
+ type?: "llm_call" | "tool_call" | "retrieval" | "agent" | "guardrail" | "custom" | undefined;
246
+ status?: "running" | "completed" | "error" | undefined;
247
+ spanId?: string | undefined;
248
+ parentSpanId?: string | null | undefined;
249
+ endedAt?: string | null | undefined;
250
+ durationMs?: number | undefined;
251
+ statusMessage?: string | null | undefined;
252
+ toolName?: string | null | undefined;
253
+ toolArguments?: Record<string, unknown> | null | undefined;
254
+ toolResult?: Record<string, unknown> | null | undefined;
255
+ model?: string | null | undefined;
256
+ promptTokens?: number | null | undefined;
257
+ completionTokens?: number | null | undefined;
258
+ costUsd?: number | null | undefined;
259
+ input?: Record<string, unknown> | null | undefined;
260
+ output?: Record<string, unknown> | null | undefined;
261
+ metadata?: Record<string, unknown> | null | undefined;
262
+ }>;
190
263
  declare const TraceDataSchema: z.ZodEffects<z.ZodObject<{
191
264
  query: z.ZodString;
192
265
  response: z.ZodString;
266
+ agentName: z.ZodNullable<z.ZodOptional<z.ZodString>>;
193
267
  model: z.ZodOptional<z.ZodString>;
194
268
  latencyMs: z.ZodOptional<z.ZodNumber>;
195
269
  tokens: z.ZodOptional<z.ZodObject<{
@@ -205,6 +279,7 @@ declare const TraceDataSchema: z.ZodEffects<z.ZodObject<{
205
279
  completion: number;
206
280
  total: number;
207
281
  }>>;
282
+ costUsd: z.ZodOptional<z.ZodNumber>;
208
283
  documents: z.ZodOptional<z.ZodArray<z.ZodObject<{
209
284
  id: z.ZodString;
210
285
  name: z.ZodString;
@@ -239,6 +314,107 @@ declare const TraceDataSchema: z.ZodEffects<z.ZodObject<{
239
314
  rank?: number | undefined;
240
315
  ownerEmail?: string | undefined;
241
316
  }>, "many">>;
317
+ spans: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodObject<{
318
+ spanId: z.ZodOptional<z.ZodString>;
319
+ parentSpanId: z.ZodNullable<z.ZodOptional<z.ZodString>>;
320
+ name: z.ZodString;
321
+ type: z.ZodDefault<z.ZodEnum<["llm_call", "tool_call", "retrieval", "agent", "guardrail", "custom"]>>;
322
+ startedAt: z.ZodString;
323
+ endedAt: z.ZodNullable<z.ZodOptional<z.ZodString>>;
324
+ durationMs: z.ZodOptional<z.ZodNumber>;
325
+ status: z.ZodDefault<z.ZodEnum<["running", "completed", "error"]>>;
326
+ statusMessage: z.ZodNullable<z.ZodOptional<z.ZodString>>;
327
+ toolName: z.ZodNullable<z.ZodOptional<z.ZodString>>;
328
+ toolArguments: z.ZodEffects<z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>, Record<string, unknown> | null | undefined, Record<string, unknown> | null | undefined>;
329
+ toolResult: z.ZodEffects<z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>, Record<string, unknown> | null | undefined, Record<string, unknown> | null | undefined>;
330
+ model: z.ZodNullable<z.ZodOptional<z.ZodString>>;
331
+ promptTokens: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
332
+ completionTokens: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
333
+ costUsd: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
334
+ input: z.ZodEffects<z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>, Record<string, unknown> | null | undefined, Record<string, unknown> | null | undefined>;
335
+ output: z.ZodEffects<z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>, Record<string, unknown> | null | undefined, Record<string, unknown> | null | undefined>;
336
+ metadata: z.ZodEffects<z.ZodNullable<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>>, Record<string, unknown> | null | undefined, Record<string, unknown> | null | undefined>;
337
+ }, "strip", z.ZodTypeAny, {
338
+ name: string;
339
+ type: "llm_call" | "tool_call" | "retrieval" | "agent" | "guardrail" | "custom";
340
+ status: "running" | "completed" | "error";
341
+ startedAt: string;
342
+ spanId?: string | undefined;
343
+ parentSpanId?: string | null | undefined;
344
+ endedAt?: string | null | undefined;
345
+ durationMs?: number | undefined;
346
+ statusMessage?: string | null | undefined;
347
+ toolName?: string | null | undefined;
348
+ toolArguments?: Record<string, unknown> | null | undefined;
349
+ toolResult?: Record<string, unknown> | null | undefined;
350
+ model?: string | null | undefined;
351
+ promptTokens?: number | null | undefined;
352
+ completionTokens?: number | null | undefined;
353
+ costUsd?: number | null | undefined;
354
+ input?: Record<string, unknown> | null | undefined;
355
+ output?: Record<string, unknown> | null | undefined;
356
+ metadata?: Record<string, unknown> | null | undefined;
357
+ }, {
358
+ name: string;
359
+ startedAt: string;
360
+ type?: "llm_call" | "tool_call" | "retrieval" | "agent" | "guardrail" | "custom" | undefined;
361
+ status?: "running" | "completed" | "error" | undefined;
362
+ spanId?: string | undefined;
363
+ parentSpanId?: string | null | undefined;
364
+ endedAt?: string | null | undefined;
365
+ durationMs?: number | undefined;
366
+ statusMessage?: string | null | undefined;
367
+ toolName?: string | null | undefined;
368
+ toolArguments?: Record<string, unknown> | null | undefined;
369
+ toolResult?: Record<string, unknown> | null | undefined;
370
+ model?: string | null | undefined;
371
+ promptTokens?: number | null | undefined;
372
+ completionTokens?: number | null | undefined;
373
+ costUsd?: number | null | undefined;
374
+ input?: Record<string, unknown> | null | undefined;
375
+ output?: Record<string, unknown> | null | undefined;
376
+ metadata?: Record<string, unknown> | null | undefined;
377
+ }>, {
378
+ name: string;
379
+ type: "llm_call" | "tool_call" | "retrieval" | "agent" | "guardrail" | "custom";
380
+ status: "running" | "completed" | "error";
381
+ startedAt: string;
382
+ spanId?: string | undefined;
383
+ parentSpanId?: string | null | undefined;
384
+ endedAt?: string | null | undefined;
385
+ durationMs?: number | undefined;
386
+ statusMessage?: string | null | undefined;
387
+ toolName?: string | null | undefined;
388
+ toolArguments?: Record<string, unknown> | null | undefined;
389
+ toolResult?: Record<string, unknown> | null | undefined;
390
+ model?: string | null | undefined;
391
+ promptTokens?: number | null | undefined;
392
+ completionTokens?: number | null | undefined;
393
+ costUsd?: number | null | undefined;
394
+ input?: Record<string, unknown> | null | undefined;
395
+ output?: Record<string, unknown> | null | undefined;
396
+ metadata?: Record<string, unknown> | null | undefined;
397
+ }, {
398
+ name: string;
399
+ startedAt: string;
400
+ type?: "llm_call" | "tool_call" | "retrieval" | "agent" | "guardrail" | "custom" | undefined;
401
+ status?: "running" | "completed" | "error" | undefined;
402
+ spanId?: string | undefined;
403
+ parentSpanId?: string | null | undefined;
404
+ endedAt?: string | null | undefined;
405
+ durationMs?: number | undefined;
406
+ statusMessage?: string | null | undefined;
407
+ toolName?: string | null | undefined;
408
+ toolArguments?: Record<string, unknown> | null | undefined;
409
+ toolResult?: Record<string, unknown> | null | undefined;
410
+ model?: string | null | undefined;
411
+ promptTokens?: number | null | undefined;
412
+ completionTokens?: number | null | undefined;
413
+ costUsd?: number | null | undefined;
414
+ input?: Record<string, unknown> | null | undefined;
415
+ output?: Record<string, unknown> | null | undefined;
416
+ metadata?: Record<string, unknown> | null | undefined;
417
+ }>, "many">>;
242
418
  sessionId: z.ZodOptional<z.ZodString>;
243
419
  userId: z.ZodOptional<z.ZodString>;
244
420
  traceId: z.ZodOptional<z.ZodString>;
@@ -248,6 +424,9 @@ declare const TraceDataSchema: z.ZodEffects<z.ZodObject<{
248
424
  query: string;
249
425
  response: string;
250
426
  model?: string | undefined;
427
+ costUsd?: number | undefined;
428
+ metadata?: Record<string, unknown> | undefined;
429
+ agentName?: string | null | undefined;
251
430
  latencyMs?: number | undefined;
252
431
  tokens?: {
253
432
  prompt: number;
@@ -266,15 +445,38 @@ declare const TraceDataSchema: z.ZodEffects<z.ZodObject<{
266
445
  rank?: number | undefined;
267
446
  ownerEmail?: string | undefined;
268
447
  }[] | undefined;
448
+ spans?: {
449
+ name: string;
450
+ type: "llm_call" | "tool_call" | "retrieval" | "agent" | "guardrail" | "custom";
451
+ status: "running" | "completed" | "error";
452
+ startedAt: string;
453
+ spanId?: string | undefined;
454
+ parentSpanId?: string | null | undefined;
455
+ endedAt?: string | null | undefined;
456
+ durationMs?: number | undefined;
457
+ statusMessage?: string | null | undefined;
458
+ toolName?: string | null | undefined;
459
+ toolArguments?: Record<string, unknown> | null | undefined;
460
+ toolResult?: Record<string, unknown> | null | undefined;
461
+ model?: string | null | undefined;
462
+ promptTokens?: number | null | undefined;
463
+ completionTokens?: number | null | undefined;
464
+ costUsd?: number | null | undefined;
465
+ input?: Record<string, unknown> | null | undefined;
466
+ output?: Record<string, unknown> | null | undefined;
467
+ metadata?: Record<string, unknown> | null | undefined;
468
+ }[] | undefined;
269
469
  sessionId?: string | undefined;
270
470
  userId?: string | undefined;
271
471
  traceId?: string | undefined;
272
472
  systemPrompt?: string | undefined;
273
- metadata?: Record<string, unknown> | undefined;
274
473
  }, {
275
474
  query: string;
276
475
  response: string;
277
476
  model?: string | undefined;
477
+ costUsd?: number | undefined;
478
+ metadata?: Record<string, unknown> | undefined;
479
+ agentName?: string | null | undefined;
278
480
  latencyMs?: number | undefined;
279
481
  tokens?: {
280
482
  prompt: number;
@@ -293,15 +495,38 @@ declare const TraceDataSchema: z.ZodEffects<z.ZodObject<{
293
495
  rank?: number | undefined;
294
496
  ownerEmail?: string | undefined;
295
497
  }[] | undefined;
498
+ spans?: {
499
+ name: string;
500
+ startedAt: string;
501
+ type?: "llm_call" | "tool_call" | "retrieval" | "agent" | "guardrail" | "custom" | undefined;
502
+ status?: "running" | "completed" | "error" | undefined;
503
+ spanId?: string | undefined;
504
+ parentSpanId?: string | null | undefined;
505
+ endedAt?: string | null | undefined;
506
+ durationMs?: number | undefined;
507
+ statusMessage?: string | null | undefined;
508
+ toolName?: string | null | undefined;
509
+ toolArguments?: Record<string, unknown> | null | undefined;
510
+ toolResult?: Record<string, unknown> | null | undefined;
511
+ model?: string | null | undefined;
512
+ promptTokens?: number | null | undefined;
513
+ completionTokens?: number | null | undefined;
514
+ costUsd?: number | null | undefined;
515
+ input?: Record<string, unknown> | null | undefined;
516
+ output?: Record<string, unknown> | null | undefined;
517
+ metadata?: Record<string, unknown> | null | undefined;
518
+ }[] | undefined;
296
519
  sessionId?: string | undefined;
297
520
  userId?: string | undefined;
298
521
  traceId?: string | undefined;
299
522
  systemPrompt?: string | undefined;
300
- metadata?: Record<string, unknown> | undefined;
301
523
  }>, {
302
524
  query: string;
303
525
  response: string;
304
526
  model?: string | undefined;
527
+ costUsd?: number | undefined;
528
+ metadata?: Record<string, unknown> | undefined;
529
+ agentName?: string | null | undefined;
305
530
  latencyMs?: number | undefined;
306
531
  tokens?: {
307
532
  prompt: number;
@@ -320,15 +545,38 @@ declare const TraceDataSchema: z.ZodEffects<z.ZodObject<{
320
545
  rank?: number | undefined;
321
546
  ownerEmail?: string | undefined;
322
547
  }[] | undefined;
548
+ spans?: {
549
+ name: string;
550
+ type: "llm_call" | "tool_call" | "retrieval" | "agent" | "guardrail" | "custom";
551
+ status: "running" | "completed" | "error";
552
+ startedAt: string;
553
+ spanId?: string | undefined;
554
+ parentSpanId?: string | null | undefined;
555
+ endedAt?: string | null | undefined;
556
+ durationMs?: number | undefined;
557
+ statusMessage?: string | null | undefined;
558
+ toolName?: string | null | undefined;
559
+ toolArguments?: Record<string, unknown> | null | undefined;
560
+ toolResult?: Record<string, unknown> | null | undefined;
561
+ model?: string | null | undefined;
562
+ promptTokens?: number | null | undefined;
563
+ completionTokens?: number | null | undefined;
564
+ costUsd?: number | null | undefined;
565
+ input?: Record<string, unknown> | null | undefined;
566
+ output?: Record<string, unknown> | null | undefined;
567
+ metadata?: Record<string, unknown> | null | undefined;
568
+ }[] | undefined;
323
569
  sessionId?: string | undefined;
324
570
  userId?: string | undefined;
325
571
  traceId?: string | undefined;
326
572
  systemPrompt?: string | undefined;
327
- metadata?: Record<string, unknown> | undefined;
328
573
  }, {
329
574
  query: string;
330
575
  response: string;
331
576
  model?: string | undefined;
577
+ costUsd?: number | undefined;
578
+ metadata?: Record<string, unknown> | undefined;
579
+ agentName?: string | null | undefined;
332
580
  latencyMs?: number | undefined;
333
581
  tokens?: {
334
582
  prompt: number;
@@ -347,11 +595,31 @@ declare const TraceDataSchema: z.ZodEffects<z.ZodObject<{
347
595
  rank?: number | undefined;
348
596
  ownerEmail?: string | undefined;
349
597
  }[] | undefined;
598
+ spans?: {
599
+ name: string;
600
+ startedAt: string;
601
+ type?: "llm_call" | "tool_call" | "retrieval" | "agent" | "guardrail" | "custom" | undefined;
602
+ status?: "running" | "completed" | "error" | undefined;
603
+ spanId?: string | undefined;
604
+ parentSpanId?: string | null | undefined;
605
+ endedAt?: string | null | undefined;
606
+ durationMs?: number | undefined;
607
+ statusMessage?: string | null | undefined;
608
+ toolName?: string | null | undefined;
609
+ toolArguments?: Record<string, unknown> | null | undefined;
610
+ toolResult?: Record<string, unknown> | null | undefined;
611
+ model?: string | null | undefined;
612
+ promptTokens?: number | null | undefined;
613
+ completionTokens?: number | null | undefined;
614
+ costUsd?: number | null | undefined;
615
+ input?: Record<string, unknown> | null | undefined;
616
+ output?: Record<string, unknown> | null | undefined;
617
+ metadata?: Record<string, unknown> | null | undefined;
618
+ }[] | undefined;
350
619
  sessionId?: string | undefined;
351
620
  userId?: string | undefined;
352
621
  traceId?: string | undefined;
353
622
  systemPrompt?: string | undefined;
354
- metadata?: Record<string, unknown> | undefined;
355
623
  }>;
356
624
  declare const FeedbackDataSchema: z.ZodEffects<z.ZodObject<{
357
625
  traceId: z.ZodOptional<z.ZodString>;
@@ -384,21 +652,58 @@ declare const FeedbackDataSchema: z.ZodEffects<z.ZodObject<{
384
652
  traceId?: string | undefined;
385
653
  comment?: string | undefined;
386
654
  }>;
655
+ /** Batch configuration schema for high-throughput ingestion */
656
+ declare const BatchConfigSchema: z.ZodObject<{
657
+ maxSize: z.ZodOptional<z.ZodNumber>;
658
+ maxBytes: z.ZodOptional<z.ZodNumber>;
659
+ flushIntervalMs: z.ZodOptional<z.ZodNumber>;
660
+ }, "strip", z.ZodTypeAny, {
661
+ maxSize?: number | undefined;
662
+ maxBytes?: number | undefined;
663
+ flushIntervalMs?: number | undefined;
664
+ }, {
665
+ maxSize?: number | undefined;
666
+ maxBytes?: number | undefined;
667
+ flushIntervalMs?: number | undefined;
668
+ }>;
387
669
  declare const TeckelConfigSchema: z.ZodObject<{
388
670
  apiKey: z.ZodString;
389
671
  endpoint: z.ZodOptional<z.ZodString>;
390
672
  debug: z.ZodOptional<z.ZodBoolean>;
391
673
  timeoutMs: z.ZodOptional<z.ZodNumber>;
674
+ batch: z.ZodOptional<z.ZodObject<{
675
+ maxSize: z.ZodOptional<z.ZodNumber>;
676
+ maxBytes: z.ZodOptional<z.ZodNumber>;
677
+ flushIntervalMs: z.ZodOptional<z.ZodNumber>;
678
+ }, "strip", z.ZodTypeAny, {
679
+ maxSize?: number | undefined;
680
+ maxBytes?: number | undefined;
681
+ flushIntervalMs?: number | undefined;
682
+ }, {
683
+ maxSize?: number | undefined;
684
+ maxBytes?: number | undefined;
685
+ flushIntervalMs?: number | undefined;
686
+ }>>;
392
687
  }, "strip", z.ZodTypeAny, {
393
688
  apiKey: string;
394
689
  endpoint?: string | undefined;
395
690
  debug?: boolean | undefined;
396
691
  timeoutMs?: number | undefined;
692
+ batch?: {
693
+ maxSize?: number | undefined;
694
+ maxBytes?: number | undefined;
695
+ flushIntervalMs?: number | undefined;
696
+ } | undefined;
397
697
  }, {
398
698
  apiKey: string;
399
699
  endpoint?: string | undefined;
400
700
  debug?: boolean | undefined;
401
701
  timeoutMs?: number | undefined;
702
+ batch?: {
703
+ maxSize?: number | undefined;
704
+ maxBytes?: number | undefined;
705
+ flushIntervalMs?: number | undefined;
706
+ } | undefined;
402
707
  }>;
403
708
 
404
- export { type Document, DocumentSchema, type FeedbackData, FeedbackDataSchema, type FeedbackResult, type FeedbackType, TRACE_SIZE_LIMITS, type TeckelConfig, TeckelConfigSchema, TeckelTracer, type TokenUsage, TokenUsageSchema, type TraceData, TraceDataSchema, type TraceResult };
709
+ export { BatchConfigSchema, DocumentSchema, FeedbackData, FeedbackDataSchema, SPAN_SIZE_LIMITS, SpanDataSchema, SpanStatusSchema, SpanTypeSchema, TRACE_SIZE_LIMITS, TeckelConfig, TeckelConfigSchema, TeckelTracer, TokenUsageSchema, TraceData, TraceDataSchema };