@lmnr-ai/types 0.8.25 → 0.8.27

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.cjs CHANGED
@@ -17,14 +17,7 @@ let TracingLevel = /* @__PURE__ */ function(TracingLevel) {
17
17
  //#region src/utils.ts
18
18
  const errorMessage = (error) => error instanceof Error ? error.message : String(error);
19
19
  //#endregion
20
- //#region src/worker-protocol.ts
21
- /**
22
- * Message prefix for protocol messages in stdout
23
- */
24
- const WORKER_MESSAGE_PREFIX = "__LMNR_WORKER__:";
25
- //#endregion
26
20
  exports.TracingLevel = TracingLevel;
27
- exports.WORKER_MESSAGE_PREFIX = WORKER_MESSAGE_PREFIX;
28
21
  exports.errorMessage = errorMessage;
29
22
 
30
23
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":[],"sources":["../src/tracing.ts","../src/utils.ts","../src/worker-protocol.ts"],"sourcesContent":["import { type StringUUID } from \"./utils\";\n\n/**\n * Span types to categorize spans.\n *\n * LLM spans are auto-instrumented LLM spans.\n * Pipeline spans are top-level spans created by the pipeline runner.\n * Executor and evaluator spans are top-level spans added automatically when doing evaluations.\n */\nexport type SpanType =\n | 'DEFAULT'\n | 'LLM'\n | 'EXECUTOR'\n | 'EVALUATOR'\n | 'HUMAN_EVALUATOR'\n | 'EVALUATION'\n | 'TOOL'\n | 'CACHED';\n\n/**\n * Trace types to categorize traces.\n * They are used as association properties passed to all spans in a trace.\n */\nexport type TraceType = 'DEFAULT' | 'EVALUATION';\n\n/**\n * Tracing levels to conditionally disable tracing.\n *\n * OFF - No tracing is sent.\n * META_ONLY - Only metadata is sent (e.g. tokens, costs, etc.).\n * ALL - All data is sent.\n */\nexport enum TracingLevel {\n OFF = 'off',\n META_ONLY = 'meta_only',\n ALL = 'all',\n}\n\n/**\n * Laminar representation of an OpenTelemetry span context.\n *\n * spanId - The ID of the span.\n * traceId - The ID of the trace.\n * isRemote - Whether the span is remote.\n * spanPath - The span path (span names) leading to this span.\n * spanIdsPath - The span IDs path leading to this span.\n */\nexport type LaminarSpanContext = {\n spanId: StringUUID;\n traceId: StringUUID;\n isRemote: boolean;\n spanPath?: string[];\n spanIdsPath?: StringUUID[];\n userId?: string;\n sessionId?: string;\n rolloutSessionId?: string;\n metadata?: Record<string, any>;\n traceType?: TraceType;\n tracingLevel?: TracingLevel;\n};\n\nexport type Event = {\n id: StringUUID;\n templateName: string;\n timestamp: Date;\n spanId: StringUUID;\n value: number | string | null;\n};\n","// UUID type alias\nexport type StringUUID = `${string}-${string}-${string}-${string}-${string}`;\n\nexport const errorMessage = (error: unknown): string =>\n error instanceof Error ? error.message : String(error);\n","/**\n * Worker protocol types for subprocess communication between CLI and language-specific workers.\n *\n * The protocol uses stdin/stdout for communication:\n * - Input: JSON configuration sent via stdin (single line)\n * - Output: Protocol messages prefixed with __LMNR_WORKER__: via stdout\n * - User output: Unprefixed stdout (passed through transparently)\n */\n\n/**\n * Configuration sent to worker process via stdin\n */\nexport interface WorkerConfig {\n filePath?: string; // File path for script mode (TS/JS/Python)\n modulePath?: string; // Module path for Python module mode (e.g., 'src.myfile')\n functionName?: string;\n args: Record<string, any> | any[];\n env: Record<string, string>;\n cacheServerPort: number;\n baseUrl: string;\n projectApiKey?: string;\n httpPort: number;\n grpcPort: number;\n externalPackages?: string[];\n dynamicImportsToSkip?: string[];\n}\n\n/**\n * Log message from worker to parent\n */\nexport interface WorkerLogMessage {\n type: 'log';\n level: 'info' | 'debug' | 'error' | 'warn';\n message: string;\n}\n\n/**\n * Error message when function fails\n */\nexport interface WorkerErrorMessage {\n type: 'error';\n error: string;\n stack?: string;\n}\n\n/**\n * Union of all worker message types\n */\nexport type WorkerMessage =\n | WorkerLogMessage\n | WorkerErrorMessage;\n\n/**\n * Message prefix for protocol messages in stdout\n */\nexport const WORKER_MESSAGE_PREFIX = '__LMNR_WORKER__:';\n"],"mappings":";;;;;;;;;AAgCA,IAAY,eAAL,yBAAA,cAAA;CACL,aAAA,SAAA;CACA,aAAA,eAAA;CACA,aAAA,SAAA;;KACD;;;ACjCD,MAAa,gBAAgB,UAC3B,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM;;;;;;ACmDxD,MAAa,wBAAwB"}
1
+ {"version":3,"file":"index.cjs","names":[],"sources":["../src/tracing.ts","../src/utils.ts"],"sourcesContent":["import { type StringUUID } from \"./utils\";\n\n/**\n * Span types to categorize spans.\n *\n * LLM spans are auto-instrumented LLM spans.\n * Pipeline spans are top-level spans created by the pipeline runner.\n * Executor and evaluator spans are top-level spans added automatically when doing evaluations.\n */\nexport type SpanType =\n | 'DEFAULT'\n | 'LLM'\n | 'EXECUTOR'\n | 'EVALUATOR'\n | 'HUMAN_EVALUATOR'\n | 'EVALUATION'\n | 'TOOL'\n | 'CACHED';\n\n/**\n * Trace types to categorize traces.\n * They are used as association properties passed to all spans in a trace.\n */\nexport type TraceType = 'DEFAULT' | 'EVALUATION';\n\n/**\n * Tracing levels to conditionally disable tracing.\n *\n * OFF - No tracing is sent.\n * META_ONLY - Only metadata is sent (e.g. tokens, costs, etc.).\n * ALL - All data is sent.\n */\nexport enum TracingLevel {\n OFF = 'off',\n META_ONLY = 'meta_only',\n ALL = 'all',\n}\n\n/**\n * Laminar representation of an OpenTelemetry span context.\n *\n * spanId - The ID of the span.\n * traceId - The ID of the trace.\n * isRemote - Whether the span is remote.\n * spanPath - The span path (span names) leading to this span.\n * spanIdsPath - The span IDs path leading to this span.\n */\nexport type LaminarSpanContext = {\n spanId: StringUUID;\n traceId: StringUUID;\n isRemote: boolean;\n spanPath?: string[];\n spanIdsPath?: StringUUID[];\n userId?: string;\n sessionId?: string;\n metadata?: Record<string, any>;\n traceType?: TraceType;\n tracingLevel?: TracingLevel;\n};\n\nexport type Event = {\n id: StringUUID;\n templateName: string;\n timestamp: Date;\n spanId: StringUUID;\n value: number | string | null;\n};\n","// UUID type alias\nexport type StringUUID = `${string}-${string}-${string}-${string}-${string}`;\n\nexport const errorMessage = (error: unknown): string =>\n error instanceof Error ? error.message : String(error);\n"],"mappings":";;;;;;;;;AAgCA,IAAY,eAAL,yBAAA,cAAA;CACL,aAAA,SAAA;CACA,aAAA,eAAA;CACA,aAAA,SAAA;;KACD;;;ACjCD,MAAa,gBAAgB,UAC3B,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM"}
package/dist/index.d.cts CHANGED
@@ -17,6 +17,31 @@ interface SessionRecordingOptions {
17
17
  maskInputOptions?: MaskInputOptions;
18
18
  }
19
19
  //#endregion
20
+ //#region src/debug.d.ts
21
+ /**
22
+ * A single cached LLM span fetched from a source trace. Shaped like the row the
23
+ * SQL/query endpoint returns so the provider wrappers consume it unchanged.
24
+ */
25
+ interface CachedSpan {
26
+ name: string;
27
+ input: string;
28
+ output: string;
29
+ attributes: Record<string, any>;
30
+ }
31
+ /**
32
+ * The debug-run pointer (§5). Emitted once at process shutdown as a console line
33
+ * and to `${CWD}/.lmnr/last-run.json`. Key order is part of the cross-language
34
+ * parity contract with the Python SDK.
35
+ */
36
+ interface DebugRunPointer {
37
+ trace_id: string;
38
+ session_id: string;
39
+ replay_trace_id: string | null;
40
+ cache_until: number;
41
+ debugger_url: string | null;
42
+ started_at: string;
43
+ }
44
+ //#endregion
20
45
  //#region src/utils.d.ts
21
46
  type StringUUID = `${string}-${string}-${string}-${string}-${string}`;
22
47
  declare const errorMessage: (error: unknown) => string;
@@ -213,67 +238,6 @@ interface InitializeOptions {
213
238
  spanProcessor?: SpanProcessor;
214
239
  }
215
240
  //#endregion
216
- //#region src/rollout.d.ts
217
- interface LanguageModelTextBlock {
218
- type: 'text';
219
- text: string;
220
- }
221
- interface LanguageModelToolDefinitionOverride {
222
- name: string;
223
- description?: string;
224
- parameters?: Record<string, any>;
225
- }
226
- /**
227
- * Event payload for rollout debugging sessions run events
228
- */
229
- interface RolloutRunEvent {
230
- event_type: 'run';
231
- data: {
232
- trace_id?: string;
233
- path_to_count?: Record<string, number>;
234
- args: Record<string, any> | any[];
235
- overrides?: Record<string, {
236
- system?: string | LanguageModelTextBlock[];
237
- tools?: LanguageModelToolDefinitionOverride[];
238
- }>;
239
- };
240
- }
241
- interface RolloutHandshakeEvent {
242
- event_type: 'handshake';
243
- data: {
244
- session_id: string;
245
- project_id: string;
246
- };
247
- }
248
- /**
249
- * Parameter metadata for rollout functions
250
- */
251
- interface RolloutParam {
252
- name: string;
253
- type?: string;
254
- required?: boolean;
255
- nested?: RolloutParam[];
256
- default?: string;
257
- }
258
- interface CachedSpan {
259
- name: string;
260
- input: string;
261
- output: string;
262
- attributes: Record<string, any>;
263
- }
264
- interface CacheMetadata {
265
- pathToCount: Record<string, number>;
266
- overrides?: Record<string, {
267
- system?: string | LanguageModelTextBlock[];
268
- tools?: LanguageModelToolDefinitionOverride[];
269
- }>;
270
- }
271
- interface CacheServerResponse {
272
- pathToCount: CacheMetadata['pathToCount'];
273
- overrides?: CacheMetadata['overrides'];
274
- span?: CachedSpan;
275
- }
276
- //#endregion
277
241
  //#region src/tracing.d.ts
278
242
  /**
279
243
  * Span types to categorize spans.
@@ -317,7 +281,6 @@ type LaminarSpanContext = {
317
281
  spanIdsPath?: StringUUID[];
318
282
  userId?: string;
319
283
  sessionId?: string;
320
- rolloutSessionId?: string;
321
284
  metadata?: Record<string, any>;
322
285
  traceType?: TraceType;
323
286
  tracingLevel?: TracingLevel;
@@ -330,56 +293,5 @@ type Event = {
330
293
  value: number | string | null;
331
294
  };
332
295
  //#endregion
333
- //#region src/worker-protocol.d.ts
334
- /**
335
- * Worker protocol types for subprocess communication between CLI and language-specific workers.
336
- *
337
- * The protocol uses stdin/stdout for communication:
338
- * - Input: JSON configuration sent via stdin (single line)
339
- * - Output: Protocol messages prefixed with __LMNR_WORKER__: via stdout
340
- * - User output: Unprefixed stdout (passed through transparently)
341
- */
342
- /**
343
- * Configuration sent to worker process via stdin
344
- */
345
- interface WorkerConfig {
346
- filePath?: string;
347
- modulePath?: string;
348
- functionName?: string;
349
- args: Record<string, any> | any[];
350
- env: Record<string, string>;
351
- cacheServerPort: number;
352
- baseUrl: string;
353
- projectApiKey?: string;
354
- httpPort: number;
355
- grpcPort: number;
356
- externalPackages?: string[];
357
- dynamicImportsToSkip?: string[];
358
- }
359
- /**
360
- * Log message from worker to parent
361
- */
362
- interface WorkerLogMessage {
363
- type: 'log';
364
- level: 'info' | 'debug' | 'error' | 'warn';
365
- message: string;
366
- }
367
- /**
368
- * Error message when function fails
369
- */
370
- interface WorkerErrorMessage {
371
- type: 'error';
372
- error: string;
373
- stack?: string;
374
- }
375
- /**
376
- * Union of all worker message types
377
- */
378
- type WorkerMessage = WorkerLogMessage | WorkerErrorMessage;
379
- /**
380
- * Message prefix for protocol messages in stdout
381
- */
382
- declare const WORKER_MESSAGE_PREFIX = "__LMNR_WORKER__:";
383
- //#endregion
384
- export { CacheMetadata, CacheServerResponse, CachedSpan, Datapoint, Dataset, EvaluationDatapoint, EvaluationDatapointDatasetLink, Event, GetDatapointsResponse, InitEvaluationResponse, InitializeOptions, LaminarSpanContext, LanguageModelTextBlock, LanguageModelToolDefinitionOverride, MaskInputOptions, PushDatapointsResponse, RolloutHandshakeEvent, RolloutParam, RolloutRunEvent, SemanticSearchResponse, SemanticSearchResult, SessionRecordingOptions, SpanExporter, SpanProcessor, SpanType, StringUUID, TraceType, TracingLevel, WORKER_MESSAGE_PREFIX, WorkerConfig, WorkerErrorMessage, WorkerLogMessage, WorkerMessage, errorMessage };
296
+ export { CachedSpan, Datapoint, Dataset, DebugRunPointer, EvaluationDatapoint, EvaluationDatapointDatasetLink, Event, GetDatapointsResponse, InitEvaluationResponse, InitializeOptions, LaminarSpanContext, MaskInputOptions, PushDatapointsResponse, SemanticSearchResponse, SemanticSearchResult, SessionRecordingOptions, SpanExporter, SpanProcessor, SpanType, StringUUID, TraceType, TracingLevel, errorMessage };
385
297
  //# sourceMappingURL=index.d.cts.map
package/dist/index.d.mts CHANGED
@@ -17,6 +17,31 @@ interface SessionRecordingOptions {
17
17
  maskInputOptions?: MaskInputOptions;
18
18
  }
19
19
  //#endregion
20
+ //#region src/debug.d.ts
21
+ /**
22
+ * A single cached LLM span fetched from a source trace. Shaped like the row the
23
+ * SQL/query endpoint returns so the provider wrappers consume it unchanged.
24
+ */
25
+ interface CachedSpan {
26
+ name: string;
27
+ input: string;
28
+ output: string;
29
+ attributes: Record<string, any>;
30
+ }
31
+ /**
32
+ * The debug-run pointer (§5). Emitted once at process shutdown as a console line
33
+ * and to `${CWD}/.lmnr/last-run.json`. Key order is part of the cross-language
34
+ * parity contract with the Python SDK.
35
+ */
36
+ interface DebugRunPointer {
37
+ trace_id: string;
38
+ session_id: string;
39
+ replay_trace_id: string | null;
40
+ cache_until: number;
41
+ debugger_url: string | null;
42
+ started_at: string;
43
+ }
44
+ //#endregion
20
45
  //#region src/utils.d.ts
21
46
  type StringUUID = `${string}-${string}-${string}-${string}-${string}`;
22
47
  declare const errorMessage: (error: unknown) => string;
@@ -213,67 +238,6 @@ interface InitializeOptions {
213
238
  spanProcessor?: SpanProcessor;
214
239
  }
215
240
  //#endregion
216
- //#region src/rollout.d.ts
217
- interface LanguageModelTextBlock {
218
- type: 'text';
219
- text: string;
220
- }
221
- interface LanguageModelToolDefinitionOverride {
222
- name: string;
223
- description?: string;
224
- parameters?: Record<string, any>;
225
- }
226
- /**
227
- * Event payload for rollout debugging sessions run events
228
- */
229
- interface RolloutRunEvent {
230
- event_type: 'run';
231
- data: {
232
- trace_id?: string;
233
- path_to_count?: Record<string, number>;
234
- args: Record<string, any> | any[];
235
- overrides?: Record<string, {
236
- system?: string | LanguageModelTextBlock[];
237
- tools?: LanguageModelToolDefinitionOverride[];
238
- }>;
239
- };
240
- }
241
- interface RolloutHandshakeEvent {
242
- event_type: 'handshake';
243
- data: {
244
- session_id: string;
245
- project_id: string;
246
- };
247
- }
248
- /**
249
- * Parameter metadata for rollout functions
250
- */
251
- interface RolloutParam {
252
- name: string;
253
- type?: string;
254
- required?: boolean;
255
- nested?: RolloutParam[];
256
- default?: string;
257
- }
258
- interface CachedSpan {
259
- name: string;
260
- input: string;
261
- output: string;
262
- attributes: Record<string, any>;
263
- }
264
- interface CacheMetadata {
265
- pathToCount: Record<string, number>;
266
- overrides?: Record<string, {
267
- system?: string | LanguageModelTextBlock[];
268
- tools?: LanguageModelToolDefinitionOverride[];
269
- }>;
270
- }
271
- interface CacheServerResponse {
272
- pathToCount: CacheMetadata['pathToCount'];
273
- overrides?: CacheMetadata['overrides'];
274
- span?: CachedSpan;
275
- }
276
- //#endregion
277
241
  //#region src/tracing.d.ts
278
242
  /**
279
243
  * Span types to categorize spans.
@@ -317,7 +281,6 @@ type LaminarSpanContext = {
317
281
  spanIdsPath?: StringUUID[];
318
282
  userId?: string;
319
283
  sessionId?: string;
320
- rolloutSessionId?: string;
321
284
  metadata?: Record<string, any>;
322
285
  traceType?: TraceType;
323
286
  tracingLevel?: TracingLevel;
@@ -330,56 +293,5 @@ type Event = {
330
293
  value: number | string | null;
331
294
  };
332
295
  //#endregion
333
- //#region src/worker-protocol.d.ts
334
- /**
335
- * Worker protocol types for subprocess communication between CLI and language-specific workers.
336
- *
337
- * The protocol uses stdin/stdout for communication:
338
- * - Input: JSON configuration sent via stdin (single line)
339
- * - Output: Protocol messages prefixed with __LMNR_WORKER__: via stdout
340
- * - User output: Unprefixed stdout (passed through transparently)
341
- */
342
- /**
343
- * Configuration sent to worker process via stdin
344
- */
345
- interface WorkerConfig {
346
- filePath?: string;
347
- modulePath?: string;
348
- functionName?: string;
349
- args: Record<string, any> | any[];
350
- env: Record<string, string>;
351
- cacheServerPort: number;
352
- baseUrl: string;
353
- projectApiKey?: string;
354
- httpPort: number;
355
- grpcPort: number;
356
- externalPackages?: string[];
357
- dynamicImportsToSkip?: string[];
358
- }
359
- /**
360
- * Log message from worker to parent
361
- */
362
- interface WorkerLogMessage {
363
- type: 'log';
364
- level: 'info' | 'debug' | 'error' | 'warn';
365
- message: string;
366
- }
367
- /**
368
- * Error message when function fails
369
- */
370
- interface WorkerErrorMessage {
371
- type: 'error';
372
- error: string;
373
- stack?: string;
374
- }
375
- /**
376
- * Union of all worker message types
377
- */
378
- type WorkerMessage = WorkerLogMessage | WorkerErrorMessage;
379
- /**
380
- * Message prefix for protocol messages in stdout
381
- */
382
- declare const WORKER_MESSAGE_PREFIX = "__LMNR_WORKER__:";
383
- //#endregion
384
- export { CacheMetadata, CacheServerResponse, CachedSpan, Datapoint, Dataset, EvaluationDatapoint, EvaluationDatapointDatasetLink, Event, GetDatapointsResponse, InitEvaluationResponse, InitializeOptions, LaminarSpanContext, LanguageModelTextBlock, LanguageModelToolDefinitionOverride, MaskInputOptions, PushDatapointsResponse, RolloutHandshakeEvent, RolloutParam, RolloutRunEvent, SemanticSearchResponse, SemanticSearchResult, SessionRecordingOptions, SpanExporter, SpanProcessor, SpanType, StringUUID, TraceType, TracingLevel, WORKER_MESSAGE_PREFIX, WorkerConfig, WorkerErrorMessage, WorkerLogMessage, WorkerMessage, errorMessage };
296
+ export { CachedSpan, Datapoint, Dataset, DebugRunPointer, EvaluationDatapoint, EvaluationDatapointDatasetLink, Event, GetDatapointsResponse, InitEvaluationResponse, InitializeOptions, LaminarSpanContext, MaskInputOptions, PushDatapointsResponse, SemanticSearchResponse, SemanticSearchResult, SessionRecordingOptions, SpanExporter, SpanProcessor, SpanType, StringUUID, TraceType, TracingLevel, errorMessage };
385
297
  //# sourceMappingURL=index.d.mts.map
package/dist/index.mjs CHANGED
@@ -16,12 +16,6 @@ let TracingLevel = /* @__PURE__ */ function(TracingLevel) {
16
16
  //#region src/utils.ts
17
17
  const errorMessage = (error) => error instanceof Error ? error.message : String(error);
18
18
  //#endregion
19
- //#region src/worker-protocol.ts
20
- /**
21
- * Message prefix for protocol messages in stdout
22
- */
23
- const WORKER_MESSAGE_PREFIX = "__LMNR_WORKER__:";
24
- //#endregion
25
- export { TracingLevel, WORKER_MESSAGE_PREFIX, errorMessage };
19
+ export { TracingLevel, errorMessage };
26
20
 
27
21
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/tracing.ts","../src/utils.ts","../src/worker-protocol.ts"],"sourcesContent":["import { type StringUUID } from \"./utils\";\n\n/**\n * Span types to categorize spans.\n *\n * LLM spans are auto-instrumented LLM spans.\n * Pipeline spans are top-level spans created by the pipeline runner.\n * Executor and evaluator spans are top-level spans added automatically when doing evaluations.\n */\nexport type SpanType =\n | 'DEFAULT'\n | 'LLM'\n | 'EXECUTOR'\n | 'EVALUATOR'\n | 'HUMAN_EVALUATOR'\n | 'EVALUATION'\n | 'TOOL'\n | 'CACHED';\n\n/**\n * Trace types to categorize traces.\n * They are used as association properties passed to all spans in a trace.\n */\nexport type TraceType = 'DEFAULT' | 'EVALUATION';\n\n/**\n * Tracing levels to conditionally disable tracing.\n *\n * OFF - No tracing is sent.\n * META_ONLY - Only metadata is sent (e.g. tokens, costs, etc.).\n * ALL - All data is sent.\n */\nexport enum TracingLevel {\n OFF = 'off',\n META_ONLY = 'meta_only',\n ALL = 'all',\n}\n\n/**\n * Laminar representation of an OpenTelemetry span context.\n *\n * spanId - The ID of the span.\n * traceId - The ID of the trace.\n * isRemote - Whether the span is remote.\n * spanPath - The span path (span names) leading to this span.\n * spanIdsPath - The span IDs path leading to this span.\n */\nexport type LaminarSpanContext = {\n spanId: StringUUID;\n traceId: StringUUID;\n isRemote: boolean;\n spanPath?: string[];\n spanIdsPath?: StringUUID[];\n userId?: string;\n sessionId?: string;\n rolloutSessionId?: string;\n metadata?: Record<string, any>;\n traceType?: TraceType;\n tracingLevel?: TracingLevel;\n};\n\nexport type Event = {\n id: StringUUID;\n templateName: string;\n timestamp: Date;\n spanId: StringUUID;\n value: number | string | null;\n};\n","// UUID type alias\nexport type StringUUID = `${string}-${string}-${string}-${string}-${string}`;\n\nexport const errorMessage = (error: unknown): string =>\n error instanceof Error ? error.message : String(error);\n","/**\n * Worker protocol types for subprocess communication between CLI and language-specific workers.\n *\n * The protocol uses stdin/stdout for communication:\n * - Input: JSON configuration sent via stdin (single line)\n * - Output: Protocol messages prefixed with __LMNR_WORKER__: via stdout\n * - User output: Unprefixed stdout (passed through transparently)\n */\n\n/**\n * Configuration sent to worker process via stdin\n */\nexport interface WorkerConfig {\n filePath?: string; // File path for script mode (TS/JS/Python)\n modulePath?: string; // Module path for Python module mode (e.g., 'src.myfile')\n functionName?: string;\n args: Record<string, any> | any[];\n env: Record<string, string>;\n cacheServerPort: number;\n baseUrl: string;\n projectApiKey?: string;\n httpPort: number;\n grpcPort: number;\n externalPackages?: string[];\n dynamicImportsToSkip?: string[];\n}\n\n/**\n * Log message from worker to parent\n */\nexport interface WorkerLogMessage {\n type: 'log';\n level: 'info' | 'debug' | 'error' | 'warn';\n message: string;\n}\n\n/**\n * Error message when function fails\n */\nexport interface WorkerErrorMessage {\n type: 'error';\n error: string;\n stack?: string;\n}\n\n/**\n * Union of all worker message types\n */\nexport type WorkerMessage =\n | WorkerLogMessage\n | WorkerErrorMessage;\n\n/**\n * Message prefix for protocol messages in stdout\n */\nexport const WORKER_MESSAGE_PREFIX = '__LMNR_WORKER__:';\n"],"mappings":";;;;;;;;AAgCA,IAAY,eAAL,yBAAA,cAAA;CACL,aAAA,SAAA;CACA,aAAA,eAAA;CACA,aAAA,SAAA;;KACD;;;ACjCD,MAAa,gBAAgB,UAC3B,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM;;;;;;ACmDxD,MAAa,wBAAwB"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/tracing.ts","../src/utils.ts"],"sourcesContent":["import { type StringUUID } from \"./utils\";\n\n/**\n * Span types to categorize spans.\n *\n * LLM spans are auto-instrumented LLM spans.\n * Pipeline spans are top-level spans created by the pipeline runner.\n * Executor and evaluator spans are top-level spans added automatically when doing evaluations.\n */\nexport type SpanType =\n | 'DEFAULT'\n | 'LLM'\n | 'EXECUTOR'\n | 'EVALUATOR'\n | 'HUMAN_EVALUATOR'\n | 'EVALUATION'\n | 'TOOL'\n | 'CACHED';\n\n/**\n * Trace types to categorize traces.\n * They are used as association properties passed to all spans in a trace.\n */\nexport type TraceType = 'DEFAULT' | 'EVALUATION';\n\n/**\n * Tracing levels to conditionally disable tracing.\n *\n * OFF - No tracing is sent.\n * META_ONLY - Only metadata is sent (e.g. tokens, costs, etc.).\n * ALL - All data is sent.\n */\nexport enum TracingLevel {\n OFF = 'off',\n META_ONLY = 'meta_only',\n ALL = 'all',\n}\n\n/**\n * Laminar representation of an OpenTelemetry span context.\n *\n * spanId - The ID of the span.\n * traceId - The ID of the trace.\n * isRemote - Whether the span is remote.\n * spanPath - The span path (span names) leading to this span.\n * spanIdsPath - The span IDs path leading to this span.\n */\nexport type LaminarSpanContext = {\n spanId: StringUUID;\n traceId: StringUUID;\n isRemote: boolean;\n spanPath?: string[];\n spanIdsPath?: StringUUID[];\n userId?: string;\n sessionId?: string;\n metadata?: Record<string, any>;\n traceType?: TraceType;\n tracingLevel?: TracingLevel;\n};\n\nexport type Event = {\n id: StringUUID;\n templateName: string;\n timestamp: Date;\n spanId: StringUUID;\n value: number | string | null;\n};\n","// UUID type alias\nexport type StringUUID = `${string}-${string}-${string}-${string}-${string}`;\n\nexport const errorMessage = (error: unknown): string =>\n error instanceof Error ? error.message : String(error);\n"],"mappings":";;;;;;;;AAgCA,IAAY,eAAL,yBAAA,cAAA;CACL,aAAA,SAAA;CACA,aAAA,eAAA;CACA,aAAA,SAAA;;KACD;;;ACjCD,MAAa,gBAAgB,UAC3B,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lmnr-ai/types",
3
- "version": "0.8.25",
3
+ "version": "0.8.27",
4
4
  "description": "Shared types for Laminar AI SDK",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",