@lmnr-ai/types 0.8.52 → 0.8.54

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
@@ -1,11 +1,10 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- //#region src/debug-session.ts
2
+ // src/debug-session.ts
3
3
  /** Directory the debug-session file lives in, relative to the working dir. */
4
4
  const DEBUG_SESSION_DIR = ".lmnr";
5
5
  /** Filename of the debug-session file inside {@link DEBUG_SESSION_DIR}. */
6
6
  const DEBUG_SESSION_FILE = "debug-session.json";
7
- //#endregion
8
- //#region src/tracing.ts
7
+ // src/tracing.ts
9
8
  /**
10
9
  * Tracing levels to conditionally disable tracing.
11
10
  *
@@ -19,13 +18,15 @@ let TracingLevel = /* @__PURE__ */ function(TracingLevel) {
19
18
  TracingLevel["ALL"] = "all";
20
19
  return TracingLevel;
21
20
  }({});
22
- //#endregion
23
- //#region src/utils.ts
21
+ // src/utils.ts
24
22
  const errorMessage = (error) => error instanceof Error ? error.message : String(error);
25
- //#endregion
23
+ /** Whether `obj` has `key` as an own property (never an inherited one, like
24
+ * `"constructor" in {}`). `Object.hasOwn` is ES2022. */
25
+ const hasOwn = (obj, key) => Object.prototype.hasOwnProperty.call(obj, key);
26
26
  exports.DEBUG_SESSION_DIR = DEBUG_SESSION_DIR;
27
27
  exports.DEBUG_SESSION_FILE = DEBUG_SESSION_FILE;
28
28
  exports.TracingLevel = TracingLevel;
29
29
  exports.errorMessage = errorMessage;
30
+ exports.hasOwn = hasOwn;
30
31
 
31
32
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":[],"sources":["../src/debug-session.ts","../src/tracing.ts","../src/utils.ts"],"sourcesContent":["/**\n * Shared `.lmnr/debug-session.json` contract.\n *\n * Single source of truth for the persisted debug-session record's SHAPE and\n * location, imported by both `@lmnr-ai/lmnr` (the SDK — reads at init, writes at\n * shutdown) and `lmnr-cli` (resets it via `debug session new`). `@lmnr-ai/types`\n * stays type-only (no `node:fs`), so the fs read/write helpers live in each\n * consumer; they all import this interface + the filename consts, which is what\n * keeps the on-disk shape from drifting between writers.\n */\n\n/**\n * Persisted debug-session record at `${CWD}/.lmnr/debug-session.json`.\n *\n * Replaces the old `.lmnr/last-run.json` pointer; it is the default persistence\n * for a debug run (no opt-in env var). `session_id` is the PRIMARY field read at\n * startup to decide \"join existing session vs. mint a new one\".\n */\nexport interface DebugSessionFile {\n /** Current debug session id (UUID). The thing read at startup. Required. */\n session_id: string;\n /** Root trace id produced by the most recent run in this session, or null. */\n trace_id: string | null;\n /** Replay-source trace id, or null. */\n replay_trace_id: string | null;\n /** Span-id needle bounding the replay window, or null. Verbatim. */\n cache_until: string | null;\n /** Full per-session debugger URL, or null until known. */\n debugger_url: string | null;\n /** ISO-8601 timestamp this session was created/started. */\n started_at: string;\n}\n\n/** Directory the debug-session file lives in, relative to the working dir. */\nexport const DEBUG_SESSION_DIR = \".lmnr\";\n/** Filename of the debug-session file inside {@link DEBUG_SESSION_DIR}. */\nexport const DEBUG_SESSION_FILE = \"debug-session.json\";\n","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 * Debugger context propagated as ONE nested block of a LaminarSpanContext.\n *\n * Carries the debug-replay v2 coordinates a downstream run needs to consult the\n * same server-side cache window as the run that produced this context. Laminar\n * is the only producer; a hand-forged or `enabled: false` block is treated as\n * absent by the consumer (behaviour is explicitly undefined).\n *\n * enabled - armed flag — only `true` blocks are ever constructed by us.\n * sessionId - the run's session id, a hyphenated UUID (undefined when absent).\n * replayTraceId - the source trace to replay, a hyphenated UUID (undefined when\n * absent).\n * cacheUntil - the cache-window span-id needle, kept VERBATIM (hyphenated or\n * not, full UUID or short suffix) — the server resolves it.\n */\nexport type DebugContext = {\n enabled: boolean;\n sessionId?: string;\n replayTraceId?: string;\n cacheUntil?: string;\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 * debug - Propagated debugger context, if any (debug-replay v2).\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 debug?: DebugContext;\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":";;;AAkCA,MAAa,oBAAoB;;AAEjC,MAAa,qBAAqB;;;;;;;;;;ACJlC,IAAY,eAAL,yBAAA,cAAA;CACL,aAAA,SAAA;CACA,aAAA,eAAA;CACA,aAAA,SAAA;;AACF,EAAA,CAAA,CAAA;;;ACjCA,MAAa,gBAAgB,UAC3B,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK"}
1
+ {"version":3,"file":"index.cjs","names":[],"sources":["../src/debug-session.ts","../src/tracing.ts","../src/utils.ts"],"sourcesContent":["/**\n * Shared `.lmnr/debug-session.json` contract.\n *\n * Single source of truth for the persisted debug-session record's SHAPE and\n * location, imported by both `@lmnr-ai/lmnr` (the SDK — reads at init, writes at\n * shutdown) and `lmnr-cli` (resets it via `debug session new`). `@lmnr-ai/types`\n * stays type-only (no `node:fs`), so the fs read/write helpers live in each\n * consumer; they all import this interface + the filename consts, which is what\n * keeps the on-disk shape from drifting between writers.\n */\n\n/**\n * Persisted debug-session record at `${CWD}/.lmnr/debug-session.json`.\n *\n * Replaces the old `.lmnr/last-run.json` pointer; it is the default persistence\n * for a debug run (no opt-in env var). `session_id` is the PRIMARY field read at\n * startup to decide \"join existing session vs. mint a new one\".\n */\nexport interface DebugSessionFile {\n /** Current debug session id (UUID). The thing read at startup. Required. */\n session_id: string;\n /** Root trace id produced by the most recent run in this session, or null. */\n trace_id: string | null;\n /** Replay-source trace id, or null. */\n replay_trace_id: string | null;\n /** Span-id needle bounding the replay window, or null. Verbatim. */\n cache_until: string | null;\n /** Full per-session debugger URL, or null until known. */\n debugger_url: string | null;\n /** ISO-8601 timestamp this session was created/started. */\n started_at: string;\n}\n\n/** Directory the debug-session file lives in, relative to the working dir. */\nexport const DEBUG_SESSION_DIR = \".lmnr\";\n/** Filename of the debug-session file inside {@link DEBUG_SESSION_DIR}. */\nexport const DEBUG_SESSION_FILE = \"debug-session.json\";\n","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 * Debugger context propagated as ONE nested block of a LaminarSpanContext.\n *\n * Carries the debug-replay v2 coordinates a downstream run needs to consult the\n * same server-side cache window as the run that produced this context. Laminar\n * is the only producer; a hand-forged or `enabled: false` block is treated as\n * absent by the consumer (behaviour is explicitly undefined).\n *\n * enabled - armed flag — only `true` blocks are ever constructed by us.\n * sessionId - the run's session id, a hyphenated UUID (undefined when absent).\n * replayTraceId - the source trace to replay, a hyphenated UUID (undefined when\n * absent).\n * cacheUntil - the cache-window span-id needle, kept VERBATIM (hyphenated or\n * not, full UUID or short suffix) — the server resolves it.\n */\nexport type DebugContext = {\n enabled: boolean;\n sessionId?: string;\n replayTraceId?: string;\n cacheUntil?: string;\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 * debug - Propagated debugger context, if any (debug-replay v2).\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 debug?: DebugContext;\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/** Whether `obj` has `key` as an own property (never an inherited one, like\n * `\"constructor\" in {}`). `Object.hasOwn` is ES2022. */\nexport const hasOwn = (obj: object, key: PropertyKey): boolean =>\n // biome-ignore lint/suspicious/noPrototypeBuiltins: `Object.hasOwn` is ES2022\n Object.prototype.hasOwnProperty.call(obj, key);\n"],"mappings":";;;AAkCA,MAAa,oBAAoB;;AAEjC,MAAa,qBAAqB;;;;;;;;;ACJlC,IAAY,eAAL,yBAAA,cAAA;CACL,aAAA,SAAA;CACA,aAAA,eAAA;CACA,aAAA,SAAA;;AACF,EAAA,CAAA,CAAA;;ACjCA,MAAa,gBAAgB,UAC3B,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;;;AAIvD,MAAa,UAAU,KAAa,QAElC,OAAO,UAAU,eAAe,KAAK,KAAK,GAAG"}
package/dist/index.d.cts CHANGED
@@ -1,4 +1,3 @@
1
- //#region src/browser.d.ts
2
1
  /**
3
2
  * Options for masking different types of input fields during browser session recording.
4
3
  */
@@ -16,8 +15,6 @@ export interface MaskInputOptions {
16
15
  export interface SessionRecordingOptions {
17
16
  maskInputOptions?: MaskInputOptions;
18
17
  }
19
- //#endregion
20
- //#region src/debug.d.ts
21
18
  /**
22
19
  * A single cached LLM response served by a debug-replay cache HIT. The provider
23
20
  * wrappers consume `output` (a JSON string) and `attributes` to reconstruct the
@@ -29,8 +26,6 @@ export interface CachedSpan {
29
26
  output: string;
30
27
  attributes: Record<string, any>;
31
28
  }
32
- //#endregion
33
- //#region src/debug-session.d.ts
34
29
  /**
35
30
  * Shared `.lmnr/debug-session.json` contract.
36
31
  *
@@ -66,12 +61,11 @@ export interface DebugSessionFile {
66
61
  export declare const DEBUG_SESSION_DIR = ".lmnr";
67
62
  /** Filename of the debug-session file inside {@link DEBUG_SESSION_DIR}. */
68
63
  export declare const DEBUG_SESSION_FILE = "debug-session.json";
69
- //#endregion
70
- //#region src/utils.d.ts
71
64
  export type StringUUID = `${string}-${string}-${string}-${string}-${string}`;
72
65
  export declare const errorMessage: (error: unknown) => string;
73
- //#endregion
74
- //#region src/evaluation.d.ts
66
+ /** Whether `obj` has `key` as an own property (never an inherited one, like
67
+ * `"constructor" in {}`). `Object.hasOwn` is ES2022. */
68
+ export declare const hasOwn: (obj: object, key: PropertyKey) => boolean;
75
69
  export type InitEvaluationResponse = {
76
70
  id: StringUUID;
77
71
  createdAt: Date;
@@ -101,6 +95,8 @@ export type EvaluationDatapoint<D, T, O> = {
101
95
  scores?: Record<string, number | null>;
102
96
  traceId: string;
103
97
  index: number;
98
+ /** Identifies the Task (test case); every Trial of a Task shares it. */
99
+ taskId?: string;
104
100
  executorSpanId?: string;
105
101
  datasetLink?: EvaluationDatapointDatasetLink;
106
102
  };
@@ -108,6 +104,8 @@ export interface Datapoint<D = any, T = any> {
108
104
  data: D;
109
105
  target?: T;
110
106
  metadata?: Record<string, any>;
107
+ /** Stable Task id. Missing on datapoints pulled from older servers. */
108
+ taskId?: string;
111
109
  }
112
110
  export type GetDatapointsResponse<D, T> = {
113
111
  items: Datapoint<D, T>[];
@@ -123,8 +121,6 @@ export type SemanticSearchResult = {
123
121
  export type SemanticSearchResponse = {
124
122
  results: SemanticSearchResult[];
125
123
  };
126
- //#endregion
127
- //#region src/initialize-options.d.ts
128
124
  /**
129
125
  * OpenTelemetry SDK types (imported as needed by implementations)
130
126
  */
@@ -262,8 +258,6 @@ export interface InitializeOptions {
262
258
  */
263
259
  spanProcessor?: SpanProcessor;
264
260
  }
265
- //#endregion
266
- //#region src/llm-profiles.d.ts
267
261
  /**
268
262
  * Workspace LLM profile wire shapes (`/v1/cli/llm-profiles`, mirrored from
269
263
  * app-server's `LlmProfileResponse`). Self-hosted only; on Laminar Cloud every
@@ -322,8 +316,6 @@ export interface LlmProfile {
322
316
  createdAt: string;
323
317
  updatedAt: string;
324
318
  }
325
- //#endregion
326
- //#region src/session-block.d.ts
327
319
  /**
328
320
  * Shared contract for debugger-session blocks — an ordered list of blocks (see
329
321
  * app-server `debugger_session_blocks`), each with a `type` and type-specific
@@ -386,8 +378,6 @@ export interface SessionBlock {
386
378
  /** Type-specific payload; narrow via the `*BlockContent` interfaces. */
387
379
  content: Record<string, unknown>;
388
380
  }
389
- //#endregion
390
- //#region src/signals.d.ts
391
381
  /**
392
382
  * A signal's payload schema — the structured output the LLM must return. Every
393
383
  * field is required; enums are a string field with an `enum` array.
@@ -481,8 +471,6 @@ export interface SignalBackfillResult {
481
471
  signalId: string;
482
472
  totalTraces: number;
483
473
  }
484
- //#endregion
485
- //#region src/sql-schema.d.ts
486
474
  /**
487
475
  * Shared contract for `GET /v1/sql/schema` (and its `/v1/cli` twin) — the
488
476
  * logical tables, columns, and enums the SQL engine exposes.
@@ -520,8 +508,6 @@ export interface SqlSchema {
520
508
  tables: SqlSchemaTable[];
521
509
  enums: SqlSchemaEnum[];
522
510
  }
523
- //#endregion
524
- //#region src/tracing.d.ts
525
511
  /**
526
512
  * Span types to categorize spans.
527
513
  *
@@ -598,5 +584,4 @@ export type Event = {
598
584
  spanId: StringUUID;
599
585
  value: number | string | null;
600
586
  };
601
- //#endregion
602
587
  //# sourceMappingURL=index.d.cts.map
package/dist/index.d.mts CHANGED
@@ -1,4 +1,3 @@
1
- //#region src/browser.d.ts
2
1
  /**
3
2
  * Options for masking different types of input fields during browser session recording.
4
3
  */
@@ -16,8 +15,6 @@ export interface MaskInputOptions {
16
15
  export interface SessionRecordingOptions {
17
16
  maskInputOptions?: MaskInputOptions;
18
17
  }
19
- //#endregion
20
- //#region src/debug.d.ts
21
18
  /**
22
19
  * A single cached LLM response served by a debug-replay cache HIT. The provider
23
20
  * wrappers consume `output` (a JSON string) and `attributes` to reconstruct the
@@ -29,8 +26,6 @@ export interface CachedSpan {
29
26
  output: string;
30
27
  attributes: Record<string, any>;
31
28
  }
32
- //#endregion
33
- //#region src/debug-session.d.ts
34
29
  /**
35
30
  * Shared `.lmnr/debug-session.json` contract.
36
31
  *
@@ -66,12 +61,11 @@ export interface DebugSessionFile {
66
61
  export declare const DEBUG_SESSION_DIR = ".lmnr";
67
62
  /** Filename of the debug-session file inside {@link DEBUG_SESSION_DIR}. */
68
63
  export declare const DEBUG_SESSION_FILE = "debug-session.json";
69
- //#endregion
70
- //#region src/utils.d.ts
71
64
  export type StringUUID = `${string}-${string}-${string}-${string}-${string}`;
72
65
  export declare const errorMessage: (error: unknown) => string;
73
- //#endregion
74
- //#region src/evaluation.d.ts
66
+ /** Whether `obj` has `key` as an own property (never an inherited one, like
67
+ * `"constructor" in {}`). `Object.hasOwn` is ES2022. */
68
+ export declare const hasOwn: (obj: object, key: PropertyKey) => boolean;
75
69
  export type InitEvaluationResponse = {
76
70
  id: StringUUID;
77
71
  createdAt: Date;
@@ -101,6 +95,8 @@ export type EvaluationDatapoint<D, T, O> = {
101
95
  scores?: Record<string, number | null>;
102
96
  traceId: string;
103
97
  index: number;
98
+ /** Identifies the Task (test case); every Trial of a Task shares it. */
99
+ taskId?: string;
104
100
  executorSpanId?: string;
105
101
  datasetLink?: EvaluationDatapointDatasetLink;
106
102
  };
@@ -108,6 +104,8 @@ export interface Datapoint<D = any, T = any> {
108
104
  data: D;
109
105
  target?: T;
110
106
  metadata?: Record<string, any>;
107
+ /** Stable Task id. Missing on datapoints pulled from older servers. */
108
+ taskId?: string;
111
109
  }
112
110
  export type GetDatapointsResponse<D, T> = {
113
111
  items: Datapoint<D, T>[];
@@ -123,8 +121,6 @@ export type SemanticSearchResult = {
123
121
  export type SemanticSearchResponse = {
124
122
  results: SemanticSearchResult[];
125
123
  };
126
- //#endregion
127
- //#region src/initialize-options.d.ts
128
124
  /**
129
125
  * OpenTelemetry SDK types (imported as needed by implementations)
130
126
  */
@@ -262,8 +258,6 @@ export interface InitializeOptions {
262
258
  */
263
259
  spanProcessor?: SpanProcessor;
264
260
  }
265
- //#endregion
266
- //#region src/llm-profiles.d.ts
267
261
  /**
268
262
  * Workspace LLM profile wire shapes (`/v1/cli/llm-profiles`, mirrored from
269
263
  * app-server's `LlmProfileResponse`). Self-hosted only; on Laminar Cloud every
@@ -322,8 +316,6 @@ export interface LlmProfile {
322
316
  createdAt: string;
323
317
  updatedAt: string;
324
318
  }
325
- //#endregion
326
- //#region src/session-block.d.ts
327
319
  /**
328
320
  * Shared contract for debugger-session blocks — an ordered list of blocks (see
329
321
  * app-server `debugger_session_blocks`), each with a `type` and type-specific
@@ -386,8 +378,6 @@ export interface SessionBlock {
386
378
  /** Type-specific payload; narrow via the `*BlockContent` interfaces. */
387
379
  content: Record<string, unknown>;
388
380
  }
389
- //#endregion
390
- //#region src/signals.d.ts
391
381
  /**
392
382
  * A signal's payload schema — the structured output the LLM must return. Every
393
383
  * field is required; enums are a string field with an `enum` array.
@@ -481,8 +471,6 @@ export interface SignalBackfillResult {
481
471
  signalId: string;
482
472
  totalTraces: number;
483
473
  }
484
- //#endregion
485
- //#region src/sql-schema.d.ts
486
474
  /**
487
475
  * Shared contract for `GET /v1/sql/schema` (and its `/v1/cli` twin) — the
488
476
  * logical tables, columns, and enums the SQL engine exposes.
@@ -520,8 +508,6 @@ export interface SqlSchema {
520
508
  tables: SqlSchemaTable[];
521
509
  enums: SqlSchemaEnum[];
522
510
  }
523
- //#endregion
524
- //#region src/tracing.d.ts
525
511
  /**
526
512
  * Span types to categorize spans.
527
513
  *
@@ -598,5 +584,4 @@ export type Event = {
598
584
  spanId: StringUUID;
599
585
  value: number | string | null;
600
586
  };
601
- //#endregion
602
587
  //# sourceMappingURL=index.d.mts.map
package/dist/index.mjs CHANGED
@@ -1,10 +1,9 @@
1
- //#region src/debug-session.ts
1
+ // src/debug-session.ts
2
2
  /** Directory the debug-session file lives in, relative to the working dir. */
3
3
  const DEBUG_SESSION_DIR = ".lmnr";
4
4
  /** Filename of the debug-session file inside {@link DEBUG_SESSION_DIR}. */
5
5
  const DEBUG_SESSION_FILE = "debug-session.json";
6
- //#endregion
7
- //#region src/tracing.ts
6
+ // src/tracing.ts
8
7
  /**
9
8
  * Tracing levels to conditionally disable tracing.
10
9
  *
@@ -18,10 +17,11 @@ let TracingLevel = /* @__PURE__ */ function(TracingLevel) {
18
17
  TracingLevel["ALL"] = "all";
19
18
  return TracingLevel;
20
19
  }({});
21
- //#endregion
22
- //#region src/utils.ts
20
+ // src/utils.ts
23
21
  const errorMessage = (error) => error instanceof Error ? error.message : String(error);
24
- //#endregion
25
- export { DEBUG_SESSION_DIR, DEBUG_SESSION_FILE, TracingLevel, errorMessage };
22
+ /** Whether `obj` has `key` as an own property (never an inherited one, like
23
+ * `"constructor" in {}`). `Object.hasOwn` is ES2022. */
24
+ const hasOwn = (obj, key) => Object.prototype.hasOwnProperty.call(obj, key);
25
+ export { DEBUG_SESSION_DIR, DEBUG_SESSION_FILE, TracingLevel, errorMessage, hasOwn };
26
26
 
27
27
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/debug-session.ts","../src/tracing.ts","../src/utils.ts"],"sourcesContent":["/**\n * Shared `.lmnr/debug-session.json` contract.\n *\n * Single source of truth for the persisted debug-session record's SHAPE and\n * location, imported by both `@lmnr-ai/lmnr` (the SDK — reads at init, writes at\n * shutdown) and `lmnr-cli` (resets it via `debug session new`). `@lmnr-ai/types`\n * stays type-only (no `node:fs`), so the fs read/write helpers live in each\n * consumer; they all import this interface + the filename consts, which is what\n * keeps the on-disk shape from drifting between writers.\n */\n\n/**\n * Persisted debug-session record at `${CWD}/.lmnr/debug-session.json`.\n *\n * Replaces the old `.lmnr/last-run.json` pointer; it is the default persistence\n * for a debug run (no opt-in env var). `session_id` is the PRIMARY field read at\n * startup to decide \"join existing session vs. mint a new one\".\n */\nexport interface DebugSessionFile {\n /** Current debug session id (UUID). The thing read at startup. Required. */\n session_id: string;\n /** Root trace id produced by the most recent run in this session, or null. */\n trace_id: string | null;\n /** Replay-source trace id, or null. */\n replay_trace_id: string | null;\n /** Span-id needle bounding the replay window, or null. Verbatim. */\n cache_until: string | null;\n /** Full per-session debugger URL, or null until known. */\n debugger_url: string | null;\n /** ISO-8601 timestamp this session was created/started. */\n started_at: string;\n}\n\n/** Directory the debug-session file lives in, relative to the working dir. */\nexport const DEBUG_SESSION_DIR = \".lmnr\";\n/** Filename of the debug-session file inside {@link DEBUG_SESSION_DIR}. */\nexport const DEBUG_SESSION_FILE = \"debug-session.json\";\n","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 * Debugger context propagated as ONE nested block of a LaminarSpanContext.\n *\n * Carries the debug-replay v2 coordinates a downstream run needs to consult the\n * same server-side cache window as the run that produced this context. Laminar\n * is the only producer; a hand-forged or `enabled: false` block is treated as\n * absent by the consumer (behaviour is explicitly undefined).\n *\n * enabled - armed flag — only `true` blocks are ever constructed by us.\n * sessionId - the run's session id, a hyphenated UUID (undefined when absent).\n * replayTraceId - the source trace to replay, a hyphenated UUID (undefined when\n * absent).\n * cacheUntil - the cache-window span-id needle, kept VERBATIM (hyphenated or\n * not, full UUID or short suffix) — the server resolves it.\n */\nexport type DebugContext = {\n enabled: boolean;\n sessionId?: string;\n replayTraceId?: string;\n cacheUntil?: string;\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 * debug - Propagated debugger context, if any (debug-replay v2).\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 debug?: DebugContext;\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":";;AAkCA,MAAa,oBAAoB;;AAEjC,MAAa,qBAAqB;;;;;;;;;;ACJlC,IAAY,eAAL,yBAAA,cAAA;CACL,aAAA,SAAA;CACA,aAAA,eAAA;CACA,aAAA,SAAA;;AACF,EAAA,CAAA,CAAA;;;ACjCA,MAAa,gBAAgB,UAC3B,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/debug-session.ts","../src/tracing.ts","../src/utils.ts"],"sourcesContent":["/**\n * Shared `.lmnr/debug-session.json` contract.\n *\n * Single source of truth for the persisted debug-session record's SHAPE and\n * location, imported by both `@lmnr-ai/lmnr` (the SDK — reads at init, writes at\n * shutdown) and `lmnr-cli` (resets it via `debug session new`). `@lmnr-ai/types`\n * stays type-only (no `node:fs`), so the fs read/write helpers live in each\n * consumer; they all import this interface + the filename consts, which is what\n * keeps the on-disk shape from drifting between writers.\n */\n\n/**\n * Persisted debug-session record at `${CWD}/.lmnr/debug-session.json`.\n *\n * Replaces the old `.lmnr/last-run.json` pointer; it is the default persistence\n * for a debug run (no opt-in env var). `session_id` is the PRIMARY field read at\n * startup to decide \"join existing session vs. mint a new one\".\n */\nexport interface DebugSessionFile {\n /** Current debug session id (UUID). The thing read at startup. Required. */\n session_id: string;\n /** Root trace id produced by the most recent run in this session, or null. */\n trace_id: string | null;\n /** Replay-source trace id, or null. */\n replay_trace_id: string | null;\n /** Span-id needle bounding the replay window, or null. Verbatim. */\n cache_until: string | null;\n /** Full per-session debugger URL, or null until known. */\n debugger_url: string | null;\n /** ISO-8601 timestamp this session was created/started. */\n started_at: string;\n}\n\n/** Directory the debug-session file lives in, relative to the working dir. */\nexport const DEBUG_SESSION_DIR = \".lmnr\";\n/** Filename of the debug-session file inside {@link DEBUG_SESSION_DIR}. */\nexport const DEBUG_SESSION_FILE = \"debug-session.json\";\n","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 * Debugger context propagated as ONE nested block of a LaminarSpanContext.\n *\n * Carries the debug-replay v2 coordinates a downstream run needs to consult the\n * same server-side cache window as the run that produced this context. Laminar\n * is the only producer; a hand-forged or `enabled: false` block is treated as\n * absent by the consumer (behaviour is explicitly undefined).\n *\n * enabled - armed flag — only `true` blocks are ever constructed by us.\n * sessionId - the run's session id, a hyphenated UUID (undefined when absent).\n * replayTraceId - the source trace to replay, a hyphenated UUID (undefined when\n * absent).\n * cacheUntil - the cache-window span-id needle, kept VERBATIM (hyphenated or\n * not, full UUID or short suffix) — the server resolves it.\n */\nexport type DebugContext = {\n enabled: boolean;\n sessionId?: string;\n replayTraceId?: string;\n cacheUntil?: string;\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 * debug - Propagated debugger context, if any (debug-replay v2).\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 debug?: DebugContext;\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/** Whether `obj` has `key` as an own property (never an inherited one, like\n * `\"constructor\" in {}`). `Object.hasOwn` is ES2022. */\nexport const hasOwn = (obj: object, key: PropertyKey): boolean =>\n // biome-ignore lint/suspicious/noPrototypeBuiltins: `Object.hasOwn` is ES2022\n Object.prototype.hasOwnProperty.call(obj, key);\n"],"mappings":";;AAkCA,MAAa,oBAAoB;;AAEjC,MAAa,qBAAqB;;;;;;;;;ACJlC,IAAY,eAAL,yBAAA,cAAA;CACL,aAAA,SAAA;CACA,aAAA,eAAA;CACA,aAAA,SAAA;;AACF,EAAA,CAAA,CAAA;;ACjCA,MAAa,gBAAgB,UAC3B,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;;;AAIvD,MAAa,UAAU,KAAa,QAElC,OAAO,UAAU,eAAe,KAAK,KAAK,GAAG"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lmnr-ai/types",
3
- "version": "0.8.52",
3
+ "version": "0.8.54",
4
4
  "description": "Shared types for Laminar AI SDK",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",