@lmnr-ai/types 0.8.22 → 0.8.24
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 +4 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.mts +2 -1
- package/dist/index.mjs +4 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -14,6 +14,9 @@ let TracingLevel = /* @__PURE__ */ function(TracingLevel) {
|
|
|
14
14
|
return TracingLevel;
|
|
15
15
|
}({});
|
|
16
16
|
//#endregion
|
|
17
|
+
//#region src/utils.ts
|
|
18
|
+
const errorMessage = (error) => error instanceof Error ? error.message : String(error);
|
|
19
|
+
//#endregion
|
|
17
20
|
//#region src/worker-protocol.ts
|
|
18
21
|
/**
|
|
19
22
|
* Message prefix for protocol messages in stdout
|
|
@@ -22,5 +25,6 @@ const WORKER_MESSAGE_PREFIX = "__LMNR_WORKER__:";
|
|
|
22
25
|
//#endregion
|
|
23
26
|
exports.TracingLevel = TracingLevel;
|
|
24
27
|
exports.WORKER_MESSAGE_PREFIX = WORKER_MESSAGE_PREFIX;
|
|
28
|
+
exports.errorMessage = errorMessage;
|
|
25
29
|
|
|
26
30
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":[],"sources":["../src/tracing.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","/**\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;AACL,cAAA,SAAA;AACA,cAAA,eAAA;AACA,cAAA,SAAA;;KACD;;;;;;
|
|
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;AACL,cAAA,SAAA;AACA,cAAA,eAAA;AACA,cAAA,SAAA;;KACD;;;ACjCD,MAAa,gBAAgB,UAC3B,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM;;;;;;ACmDxD,MAAa,wBAAwB"}
|
package/dist/index.d.cts
CHANGED
|
@@ -19,6 +19,7 @@ interface SessionRecordingOptions {
|
|
|
19
19
|
//#endregion
|
|
20
20
|
//#region src/utils.d.ts
|
|
21
21
|
type StringUUID = `${string}-${string}-${string}-${string}-${string}`;
|
|
22
|
+
declare const errorMessage: (error: unknown) => string;
|
|
22
23
|
//#endregion
|
|
23
24
|
//#region src/evaluation.d.ts
|
|
24
25
|
type InitEvaluationResponse = {
|
|
@@ -380,5 +381,5 @@ type WorkerMessage = WorkerLogMessage | WorkerErrorMessage;
|
|
|
380
381
|
*/
|
|
381
382
|
declare const WORKER_MESSAGE_PREFIX = "__LMNR_WORKER__:";
|
|
382
383
|
//#endregion
|
|
383
|
-
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 };
|
|
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 };
|
|
384
385
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.mts
CHANGED
|
@@ -19,6 +19,7 @@ interface SessionRecordingOptions {
|
|
|
19
19
|
//#endregion
|
|
20
20
|
//#region src/utils.d.ts
|
|
21
21
|
type StringUUID = `${string}-${string}-${string}-${string}-${string}`;
|
|
22
|
+
declare const errorMessage: (error: unknown) => string;
|
|
22
23
|
//#endregion
|
|
23
24
|
//#region src/evaluation.d.ts
|
|
24
25
|
type InitEvaluationResponse = {
|
|
@@ -380,5 +381,5 @@ type WorkerMessage = WorkerLogMessage | WorkerErrorMessage;
|
|
|
380
381
|
*/
|
|
381
382
|
declare const WORKER_MESSAGE_PREFIX = "__LMNR_WORKER__:";
|
|
382
383
|
//#endregion
|
|
383
|
-
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 };
|
|
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 };
|
|
384
385
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
CHANGED
|
@@ -13,12 +13,15 @@ let TracingLevel = /* @__PURE__ */ function(TracingLevel) {
|
|
|
13
13
|
return TracingLevel;
|
|
14
14
|
}({});
|
|
15
15
|
//#endregion
|
|
16
|
+
//#region src/utils.ts
|
|
17
|
+
const errorMessage = (error) => error instanceof Error ? error.message : String(error);
|
|
18
|
+
//#endregion
|
|
16
19
|
//#region src/worker-protocol.ts
|
|
17
20
|
/**
|
|
18
21
|
* Message prefix for protocol messages in stdout
|
|
19
22
|
*/
|
|
20
23
|
const WORKER_MESSAGE_PREFIX = "__LMNR_WORKER__:";
|
|
21
24
|
//#endregion
|
|
22
|
-
export { TracingLevel, WORKER_MESSAGE_PREFIX };
|
|
25
|
+
export { TracingLevel, WORKER_MESSAGE_PREFIX, errorMessage };
|
|
23
26
|
|
|
24
27
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/tracing.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","/**\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;AACL,cAAA,SAAA;AACA,cAAA,eAAA;AACA,cAAA,SAAA;;KACD;;;;;;
|
|
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;AACL,cAAA,SAAA;AACA,cAAA,eAAA;AACA,cAAA,SAAA;;KACD;;;ACjCD,MAAa,gBAAgB,UAC3B,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM;;;;;;ACmDxD,MAAa,wBAAwB"}
|