@lmnr-ai/lmnr 0.8.28 → 0.8.29

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/cli.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  const require_chunk = require("./chunk-BN4qSVkS.cjs");
3
3
  const require_utils = require("./utils-C_Pf3r64.cjs");
4
- const require_dist = require("./dist-BWFjum5L.cjs");
4
+ const require_dist = require("./dist-CvLra1Dm.cjs");
5
5
  const require_file_utils = require("./file-utils-Cysp1Ym1.cjs");
6
6
  let fs = require("fs");
7
7
  fs = require_chunk.__toESM(fs);
package/dist/cli.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { n as Evaluation } from "./evaluations-Db2jWbjf.cjs";
1
+ import { n as Evaluation } from "./evaluations-DLNweSzE.cjs";
2
2
 
3
3
  //#region src/cli/index.d.ts
4
4
  declare global {
package/dist/cli.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { n as Evaluation } from "./evaluations-Cs-tqViJ.mjs";
1
+ import { n as Evaluation } from "./evaluations-fF1Y_olL.mjs";
2
2
 
3
3
  //#region src/cli/index.d.ts
4
4
  declare global {
package/dist/cli.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { r as __require } from "./chunk-hT5z_Zn9.mjs";
3
3
  import { L as errorMessage, i as getDirname, s as initializeLogger } from "./utils-Bdv7YZH7.mjs";
4
- import { n as version, t as LaminarClient } from "./dist-K0otr9Ia.mjs";
4
+ import { n as version, t as LaminarClient } from "./dist-CvQVYVO4.mjs";
5
5
  import { i as writeToFile, n as loadFromPaths, r as printToConsole } from "./file-utils-CHgYB_Ei.mjs";
6
6
  import * as fs from "fs";
7
7
  import { Command } from "commander";
@@ -8,25 +8,31 @@ pino = require_chunk.__toESM(pino, 1);
8
8
  let pino_pretty = require("pino-pretty");
9
9
  let uuid = require("uuid");
10
10
  //#region package.json
11
- var version$1 = "0.8.28";
11
+ var version$1 = "0.8.29";
12
12
  //#endregion
13
13
  //#region ../client/dist/index.mjs
14
- var version = "0.8.28";
14
+ var version = "0.8.29";
15
15
  function getLangVersion() {
16
16
  if (typeof process !== "undefined" && process.versions && process.versions.node) return `node-${process.versions.node}`;
17
17
  if (typeof navigator !== "undefined" && navigator.userAgent) return `browser-${navigator.userAgent}`;
18
18
  return null;
19
19
  }
20
20
  var BaseResource = class {
21
- constructor(baseHttpUrl, projectApiKey) {
21
+ constructor(baseHttpUrl, auth) {
22
22
  this.baseHttpUrl = baseHttpUrl;
23
- this.projectApiKey = projectApiKey;
23
+ this.auth = auth;
24
+ this.credential = auth.type === "apiKey" ? auth.key : auth.token;
25
+ }
26
+ /** API path prefix: `/v1/cli` for CLI user-token auth, `/v1` otherwise. */
27
+ get apiPrefix() {
28
+ return this.auth.type === "userToken" ? "/v1/cli" : "/v1";
24
29
  }
25
30
  headers() {
26
31
  return {
27
- Authorization: `Bearer ${this.projectApiKey}`,
32
+ Authorization: `Bearer ${this.credential}`,
28
33
  "Content-Type": "application/json",
29
- Accept: "application/json"
34
+ Accept: "application/json",
35
+ ...this.auth.type === "userToken" ? { "x-lmnr-project-id": this.auth.projectId } : {}
30
36
  };
31
37
  }
32
38
  async handleError(response) {
@@ -35,8 +41,8 @@ var BaseResource = class {
35
41
  }
36
42
  };
37
43
  var BrowserEventsResource = class extends BaseResource {
38
- constructor(baseHttpUrl, projectApiKey) {
39
- super(baseHttpUrl, projectApiKey);
44
+ constructor(baseHttpUrl, auth) {
45
+ super(baseHttpUrl, auth);
40
46
  }
41
47
  async send({ sessionId, traceId, events }) {
42
48
  const payload = {
@@ -60,6 +66,33 @@ var BrowserEventsResource = class extends BaseResource {
60
66
  if (!response.ok) await this.handleError(response);
61
67
  }
62
68
  };
69
+ /**
70
+ * User-scoped CLI endpoints that don't target a specific project. Authed by the
71
+ * BetterAuth user JWT (the `credential`); deliberately does NOT send an
72
+ * `x-lmnr-project-id` header (these routes are project discovery, pre-selection).
73
+ *
74
+ * Discovery exception: this resource always hits `/v1/cli/projects` with the
75
+ * bare bearer and overrides `BaseResource.headers()`/`apiPrefix`, so it works
76
+ * even when constructed with a `userToken` auth that has no real project id yet.
77
+ */
78
+ var CliResource = class extends BaseResource {
79
+ constructor(baseHttpUrl, auth) {
80
+ super(baseHttpUrl, auth);
81
+ }
82
+ /** Workspaces + projects the authenticated user can access. */
83
+ async listProjects() {
84
+ const response = await fetch(`${this.baseHttpUrl}/v1/cli/projects`, {
85
+ method: "GET",
86
+ headers: {
87
+ Authorization: `Bearer ${this.credential}`,
88
+ Accept: "application/json"
89
+ }
90
+ });
91
+ if (!response.ok) await this.handleError(response);
92
+ const body = await response.json();
93
+ return Array.isArray(body?.projects) ? body.projects : [];
94
+ }
95
+ };
63
96
  function initializeLogger(options) {
64
97
  const colorize = options?.colorize ?? true;
65
98
  const level = options?.level ?? process.env.LMNR_LOG_LEVEL?.toLowerCase()?.trim() ?? "info";
@@ -121,8 +154,8 @@ const logger$3 = initializeLogger();
121
154
  const DEFAULT_DATASET_PULL_LIMIT = 100;
122
155
  const DEFAULT_DATASET_PUSH_BATCH_SIZE = 100;
123
156
  var DatasetsResource = class extends BaseResource {
124
- constructor(baseHttpUrl, projectApiKey) {
125
- super(baseHttpUrl, projectApiKey);
157
+ constructor(baseHttpUrl, auth) {
158
+ super(baseHttpUrl, auth);
126
159
  }
127
160
  /**
128
161
  * List all datasets.
@@ -130,7 +163,7 @@ var DatasetsResource = class extends BaseResource {
130
163
  * @returns {Promise<Dataset[]>} Array of datasets
131
164
  */
132
165
  async listDatasets() {
133
- const response = await fetch(this.baseHttpUrl + "/v1/datasets", {
166
+ const response = await fetch(this.baseHttpUrl + this.apiPrefix + "/datasets", {
134
167
  method: "GET",
135
168
  headers: this.headers()
136
169
  });
@@ -145,7 +178,7 @@ var DatasetsResource = class extends BaseResource {
145
178
  */
146
179
  async getDatasetByName(name) {
147
180
  const params = new URLSearchParams({ name });
148
- const response = await fetch(this.baseHttpUrl + `/v1/datasets?${params.toString()}`, {
181
+ const response = await fetch(this.baseHttpUrl + `${this.apiPrefix}/datasets?${params.toString()}`, {
149
182
  method: "GET",
150
183
  headers: this.headers()
151
184
  });
@@ -174,7 +207,7 @@ var DatasetsResource = class extends BaseResource {
174
207
  const batchNum = Math.floor(i / batchSize) + 1;
175
208
  logger$3.debug(`Pushing batch ${batchNum} of ${totalBatches}`);
176
209
  const batch = points.slice(i, i + batchSize);
177
- const fetchResponse = await fetch(this.baseHttpUrl + "/v1/datasets/datapoints", {
210
+ const fetchResponse = await fetch(this.baseHttpUrl + this.apiPrefix + "/datasets/datapoints", {
178
211
  method: "POST",
179
212
  headers: this.headers(),
180
213
  body: JSON.stringify({
@@ -212,7 +245,7 @@ var DatasetsResource = class extends BaseResource {
212
245
  if (name) paramsObj.name = name;
213
246
  else paramsObj.datasetId = id;
214
247
  const params = new URLSearchParams(paramsObj);
215
- const response = await fetch(this.baseHttpUrl + `/v1/datasets/datapoints?${params.toString()}`, {
248
+ const response = await fetch(this.baseHttpUrl + `${this.apiPrefix}/datasets/datapoints?${params.toString()}`, {
216
249
  method: "GET",
217
250
  headers: this.headers()
218
251
  });
@@ -223,8 +256,8 @@ var DatasetsResource = class extends BaseResource {
223
256
  const logger$2 = initializeLogger();
224
257
  const INITIAL_EVALUATION_DATAPOINT_MAX_DATA_LENGTH = 16e6;
225
258
  var EvalsResource = class extends BaseResource {
226
- constructor(baseHttpUrl, projectApiKey) {
227
- super(baseHttpUrl, projectApiKey);
259
+ constructor(baseHttpUrl, auth) {
260
+ super(baseHttpUrl, auth);
228
261
  }
229
262
  /**
230
263
  * Initialize an evaluation.
@@ -398,8 +431,8 @@ var EvalsResource = class extends BaseResource {
398
431
  * Resource for creating evaluator scores
399
432
  */
400
433
  var EvaluatorsResource = class extends BaseResource {
401
- constructor(baseHttpUrl, projectApiKey) {
402
- super(baseHttpUrl, projectApiKey);
434
+ constructor(baseHttpUrl, auth) {
435
+ super(baseHttpUrl, auth);
403
436
  }
404
437
  /**
405
438
  * Create a score for a span or trace
@@ -477,8 +510,8 @@ const toCachedSpan = (response) => {
477
510
  };
478
511
  };
479
512
  var RolloutSessionsResource = class extends BaseResource {
480
- constructor(baseHttpUrl, projectApiKey) {
481
- super(baseHttpUrl, projectApiKey);
513
+ constructor(baseHttpUrl, auth) {
514
+ super(baseHttpUrl, auth);
482
515
  }
483
516
  /**
484
517
  * Idempotently register (upsert) a debug session on the backend, keyed on the
@@ -489,7 +522,7 @@ var RolloutSessionsResource = class extends BaseResource {
489
522
  * caller can build the debugger URL; null if the body can't be parsed.
490
523
  */
491
524
  async register({ sessionId, name }) {
492
- const response = await fetch(`${this.baseHttpUrl}/v1/rollouts/${sessionId}`, {
525
+ const response = await fetch(`${this.baseHttpUrl}${this.apiPrefix}/rollouts/${sessionId}`, {
493
526
  method: "POST",
494
527
  headers: this.headers(),
495
528
  body: JSON.stringify({ name })
@@ -509,7 +542,7 @@ var RolloutSessionsResource = class extends BaseResource {
509
542
  * stays the SDK's job via {@link register}.
510
543
  */
511
544
  async setName({ sessionId, name }) {
512
- const response = await fetch(`${this.baseHttpUrl}/v1/rollouts/${sessionId}/name`, {
545
+ const response = await fetch(`${this.baseHttpUrl}${this.apiPrefix}/rollouts/${sessionId}/name`, {
513
546
  method: "PATCH",
514
547
  headers: this.headers(),
515
548
  body: JSON.stringify({ name })
@@ -533,7 +566,7 @@ var RolloutSessionsResource = class extends BaseResource {
533
566
  async cache({ sessionId, replayTraceId, cacheUntil, inputHash }) {
534
567
  let response;
535
568
  try {
536
- response = await fetch(`${this.baseHttpUrl}/v1/rollouts/${sessionId}/cache`, {
569
+ response = await fetch(`${this.baseHttpUrl}${this.apiPrefix}/rollouts/${sessionId}/cache`, {
537
570
  method: "POST",
538
571
  headers: this.headers(),
539
572
  body: JSON.stringify({
@@ -575,7 +608,7 @@ var RolloutSessionsResource = class extends BaseResource {
575
608
  }
576
609
  }
577
610
  async delete({ sessionId }) {
578
- const response = await fetch(`${this.baseHttpUrl}/v1/rollouts/${sessionId}`, {
611
+ const response = await fetch(`${this.baseHttpUrl}${this.apiPrefix}/rollouts/${sessionId}`, {
579
612
  method: "DELETE",
580
613
  headers: this.headers()
581
614
  });
@@ -583,11 +616,11 @@ var RolloutSessionsResource = class extends BaseResource {
583
616
  }
584
617
  };
585
618
  var SqlResource = class extends BaseResource {
586
- constructor(baseHttpUrl, projectApiKey) {
587
- super(baseHttpUrl, projectApiKey);
619
+ constructor(baseHttpUrl, auth) {
620
+ super(baseHttpUrl, auth);
588
621
  }
589
622
  async query(sql, parameters = {}) {
590
- const response = await fetch(`${this.baseHttpUrl}/v1/sql/query`, {
623
+ const response = await fetch(`${this.baseHttpUrl}${this.apiPrefix}/sql/query`, {
591
624
  method: "POST",
592
625
  headers: { ...this.headers() },
593
626
  body: JSON.stringify({
@@ -602,8 +635,8 @@ var SqlResource = class extends BaseResource {
602
635
  /** Resource for tagging traces. */
603
636
  var TagsResource = class extends BaseResource {
604
637
  /** Resource for tagging traces. */
605
- constructor(baseHttpUrl, projectApiKey) {
606
- super(baseHttpUrl, projectApiKey);
638
+ constructor(baseHttpUrl, auth) {
639
+ super(baseHttpUrl, auth);
607
640
  }
608
641
  /**
609
642
  * Tag a trace with a list of tags. Note that the trace must be ended before
@@ -658,8 +691,8 @@ var TagsResource = class extends BaseResource {
658
691
  const logger = initializeLogger();
659
692
  var TracesResource = class extends BaseResource {
660
693
  /** Resource for post-factum operations on existing traces. */
661
- constructor(baseHttpUrl, projectApiKey) {
662
- super(baseHttpUrl, projectApiKey);
694
+ constructor(baseHttpUrl, auth) {
695
+ super(baseHttpUrl, auth);
663
696
  }
664
697
  /**
665
698
  * Push a metadata patch to an existing trace.
@@ -714,7 +747,7 @@ var TracesResource = class extends BaseResource {
714
747
  async pushMetadata(traceId, metadata, options) {
715
748
  if (!metadata || Object.keys(metadata).length === 0) throw new Error("metadata must be a non-empty object");
716
749
  const formattedTraceId = isStringUUID(traceId) ? traceId : otelTraceIdToUUID(traceId);
717
- const url = this.baseHttpUrl + "/v1/traces/metadata";
750
+ const url = this.baseHttpUrl + this.apiPrefix + "/traces/metadata";
718
751
  const response = await fetch(url, {
719
752
  method: "POST",
720
753
  headers: this.headers(),
@@ -732,25 +765,49 @@ var TracesResource = class extends BaseResource {
732
765
  if (!response.ok) await this.handleError(response);
733
766
  }
734
767
  };
735
- var LaminarClient = class {
736
- constructor({ baseUrl, projectApiKey, port } = {}) {
768
+ var LaminarClient = class LaminarClient {
769
+ constructor({ baseUrl, port, auth, projectApiKey, cliUserProjectId } = {}) {
737
770
  loadEnv();
738
- this.projectApiKey = projectApiKey ?? process.env.LMNR_PROJECT_API_KEY;
771
+ this.auth = LaminarClient.normalizeAuth(auth, projectApiKey, cliUserProjectId);
739
772
  const httpPort = port ?? (baseUrl?.match(/:\d{1,5}$/g) ? parseInt(baseUrl.match(/:\d{1,5}$/g)[0].slice(1)) : 443);
740
773
  const baseUrlNoPort = (baseUrl ?? process.env.LMNR_BASE_URL)?.replace(/\/$/, "").replace(/:\d{1,5}$/g, "");
741
774
  this.baseUrl = `${baseUrlNoPort ?? "https://api.lmnr.ai"}:${httpPort}`;
742
- this._browserEvents = new BrowserEventsResource(this.baseUrl, this.projectApiKey);
743
- this._datasets = new DatasetsResource(this.baseUrl, this.projectApiKey);
744
- this._evals = new EvalsResource(this.baseUrl, this.projectApiKey);
745
- this._evaluators = new EvaluatorsResource(this.baseUrl, this.projectApiKey);
746
- this._rolloutSessions = new RolloutSessionsResource(this.baseUrl, this.projectApiKey);
747
- this._sql = new SqlResource(this.baseUrl, this.projectApiKey);
748
- this._tags = new TagsResource(this.baseUrl, this.projectApiKey);
749
- this._traces = new TracesResource(this.baseUrl, this.projectApiKey);
775
+ this._browserEvents = new BrowserEventsResource(this.baseUrl, this.auth);
776
+ this._cli = new CliResource(this.baseUrl, this.auth);
777
+ this._datasets = new DatasetsResource(this.baseUrl, this.auth);
778
+ this._evals = new EvalsResource(this.baseUrl, this.auth);
779
+ this._evaluators = new EvaluatorsResource(this.baseUrl, this.auth);
780
+ this._rolloutSessions = new RolloutSessionsResource(this.baseUrl, this.auth);
781
+ this._sql = new SqlResource(this.baseUrl, this.auth);
782
+ this._tags = new TagsResource(this.baseUrl, this.auth);
783
+ this._traces = new TracesResource(this.baseUrl, this.auth);
784
+ }
785
+ /**
786
+ * Normalize the constructor's auth inputs into a {@link LaminarAuth} union.
787
+ * Precedence: an explicit `auth` wins; otherwise the legacy
788
+ * `projectApiKey` (+ optional `cliUserProjectId`) is mapped — a present
789
+ * `cliUserProjectId` selects the user-token surface, otherwise the project
790
+ * key surface. Falls back to `LMNR_PROJECT_API_KEY` as a project key.
791
+ */
792
+ static normalizeAuth(auth, projectApiKey, cliUserProjectId) {
793
+ if (auth) return auth;
794
+ const key = projectApiKey ?? process.env.LMNR_PROJECT_API_KEY;
795
+ if (cliUserProjectId) return {
796
+ type: "userToken",
797
+ token: key,
798
+ projectId: cliUserProjectId
799
+ };
800
+ return {
801
+ type: "apiKey",
802
+ key
803
+ };
750
804
  }
751
805
  get browserEvents() {
752
806
  return this._browserEvents;
753
807
  }
808
+ get cli() {
809
+ return this._cli;
810
+ }
754
811
  get datasets() {
755
812
  return this._datasets;
756
813
  }
@@ -787,4 +844,4 @@ Object.defineProperty(exports, "version", {
787
844
  }
788
845
  });
789
846
 
790
- //# sourceMappingURL=dist-BWFjum5L.cjs.map
847
+ //# sourceMappingURL=dist-CvLra1Dm.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dist-CvLra1Dm.cjs","names":["errorMessage"],"sources":["../package.json","../../client/dist/index.mjs"],"sourcesContent":["","import { config } from \"dotenv\";\nimport * as path from \"path\";\nimport pino from \"pino\";\nimport { PinoPretty } from \"pino-pretty\";\nimport { v4 } from \"uuid\";\nimport { errorMessage } from \"@lmnr-ai/types\";\n//#region package.json\nvar version = \"0.8.29\";\n//#endregion\n//#region src/version.ts\nfunction getLangVersion() {\n\tif (typeof process !== \"undefined\" && process.versions && process.versions.node) return `node-${process.versions.node}`;\n\tif (typeof navigator !== \"undefined\" && navigator.userAgent) return `browser-${navigator.userAgent}`;\n\treturn null;\n}\n//#endregion\n//#region src/resources/index.ts\nvar BaseResource = class {\n\tconstructor(baseHttpUrl, auth) {\n\t\tthis.baseHttpUrl = baseHttpUrl;\n\t\tthis.auth = auth;\n\t\tthis.credential = auth.type === \"apiKey\" ? auth.key : auth.token;\n\t}\n\t/** API path prefix: `/v1/cli` for CLI user-token auth, `/v1` otherwise. */\n\tget apiPrefix() {\n\t\treturn this.auth.type === \"userToken\" ? \"/v1/cli\" : \"/v1\";\n\t}\n\theaders() {\n\t\treturn {\n\t\t\tAuthorization: `Bearer ${this.credential}`,\n\t\t\t\"Content-Type\": \"application/json\",\n\t\t\tAccept: \"application/json\",\n\t\t\t...this.auth.type === \"userToken\" ? { \"x-lmnr-project-id\": this.auth.projectId } : {}\n\t\t};\n\t}\n\tasync handleError(response) {\n\t\tconst errorMsg = await response.text();\n\t\tthrow new Error(`${response.status} ${errorMsg}`);\n\t}\n};\n//#endregion\n//#region src/resources/browser-events.ts\nvar BrowserEventsResource = class extends BaseResource {\n\tconstructor(baseHttpUrl, auth) {\n\t\tsuper(baseHttpUrl, auth);\n\t}\n\tasync send({ sessionId, traceId, events }) {\n\t\tconst payload = {\n\t\t\tsessionId,\n\t\t\ttraceId,\n\t\t\tevents,\n\t\t\tsource: getLangVersion() ?? \"javascript\",\n\t\t\tsdkVersion: version\n\t\t};\n\t\tconst jsonString = JSON.stringify(payload);\n\t\tconst compressedStream = new Blob([jsonString], { type: \"application/json\" }).stream().pipeThrough(new CompressionStream(\"gzip\"));\n\t\tconst compressedData = await new Response(compressedStream).arrayBuffer();\n\t\tconst response = await fetch(this.baseHttpUrl + \"/v1/browser-sessions/events\", {\n\t\t\tmethod: \"POST\",\n\t\t\theaders: {\n\t\t\t\t...this.headers(),\n\t\t\t\t\"Content-Encoding\": \"gzip\"\n\t\t\t},\n\t\t\tbody: compressedData\n\t\t});\n\t\tif (!response.ok) await this.handleError(response);\n\t}\n};\n//#endregion\n//#region src/resources/cli.ts\n/**\n* User-scoped CLI endpoints that don't target a specific project. Authed by the\n* BetterAuth user JWT (the `credential`); deliberately does NOT send an\n* `x-lmnr-project-id` header (these routes are project discovery, pre-selection).\n*\n* Discovery exception: this resource always hits `/v1/cli/projects` with the\n* bare bearer and overrides `BaseResource.headers()`/`apiPrefix`, so it works\n* even when constructed with a `userToken` auth that has no real project id yet.\n*/\nvar CliResource = class extends BaseResource {\n\tconstructor(baseHttpUrl, auth) {\n\t\tsuper(baseHttpUrl, auth);\n\t}\n\t/** Workspaces + projects the authenticated user can access. */\n\tasync listProjects() {\n\t\tconst response = await fetch(`${this.baseHttpUrl}/v1/cli/projects`, {\n\t\t\tmethod: \"GET\",\n\t\t\theaders: {\n\t\t\t\tAuthorization: `Bearer ${this.credential}`,\n\t\t\t\tAccept: \"application/json\"\n\t\t\t}\n\t\t});\n\t\tif (!response.ok) await this.handleError(response);\n\t\tconst body = await response.json();\n\t\treturn Array.isArray(body?.projects) ? body.projects : [];\n\t}\n};\n//#endregion\n//#region src/utils.ts\nfunction initializeLogger(options) {\n\tconst colorize = options?.colorize ?? true;\n\tconst level = options?.level ?? process.env.LMNR_LOG_LEVEL?.toLowerCase()?.trim() ?? \"info\";\n\treturn pino({ level }, PinoPretty({\n\t\tcolorize,\n\t\tminimumLevel: level\n\t}));\n}\nconst logger$4 = initializeLogger();\nconst isStringUUID = (id) => /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/.test(id);\nconst newUUID = () => {\n\tif (typeof crypto !== \"undefined\" && typeof crypto.randomUUID === \"function\") return crypto.randomUUID();\n\telse return v4();\n};\nconst otelSpanIdToUUID = (spanId) => {\n\tlet id = spanId.toLowerCase();\n\tif (id.startsWith(\"0x\")) id = id.slice(2);\n\tif (id.length !== 16) logger$4.warn(`Span ID ${spanId} is not 16 hex chars long. This is not a valid OpenTelemetry span ID.`);\n\tif (!/^[0-9a-f]+$/.test(id)) {\n\t\tlogger$4.error(`Span ID ${spanId} is not a valid hex string. Generating a random UUID instead.`);\n\t\treturn newUUID();\n\t}\n\treturn id.padStart(32, \"0\").replace(/^([0-9a-f]{8})([0-9a-f]{4})([0-9a-f]{4})([0-9a-f]{4})([0-9a-f]{12})$/, \"$1-$2-$3-$4-$5\");\n};\nconst otelTraceIdToUUID = (traceId) => {\n\tlet id = traceId.toLowerCase();\n\tif (id.startsWith(\"0x\")) id = id.slice(2);\n\tif (id.length !== 32) logger$4.warn(`Trace ID ${traceId} is not 32 hex chars long. This is not a valid OpenTelemetry trace ID.`);\n\tif (!/^[0-9a-f]+$/.test(id)) {\n\t\tlogger$4.error(`Trace ID ${traceId} is not a valid hex string. Generating a random UUID instead.`);\n\t\treturn newUUID();\n\t}\n\treturn id.replace(/^([0-9a-f]{8})([0-9a-f]{4})([0-9a-f]{4})([0-9a-f]{4})([0-9a-f]{12})$/, \"$1-$2-$3-$4-$5\");\n};\nconst slicePayload = (value, length) => {\n\tif (value === null || value === void 0) return value;\n\tconst str = JSON.stringify(value);\n\tif (str.length <= length) return value;\n\treturn str.slice(0, length) + \"...\";\n};\nconst loadEnv = (options) => {\n\tconst nodeEnv = process.env.NODE_ENV || \"development\";\n\tconst envDir = process.cwd();\n\tconst envFiles = [\n\t\t\".env\",\n\t\t\".env.local\",\n\t\t`.env.${nodeEnv}`,\n\t\t`.env.${nodeEnv}.local`\n\t];\n\tconst logLevel = process.env.LMNR_LOG_LEVEL ?? \"info\";\n\tconst verbose = [\"debug\", \"trace\"].includes(logLevel.trim().toLowerCase());\n\tconst quiet = options?.quiet ?? !verbose;\n\tconfig({\n\t\tpath: options?.paths ?? envFiles.map((envFile) => path.resolve(envDir, envFile)),\n\t\tquiet\n\t});\n};\n//#endregion\n//#region src/resources/datasets.ts\nconst logger$3 = initializeLogger();\nconst DEFAULT_DATASET_PULL_LIMIT = 100;\nconst DEFAULT_DATASET_PUSH_BATCH_SIZE = 100;\nvar DatasetsResource = class extends BaseResource {\n\tconstructor(baseHttpUrl, auth) {\n\t\tsuper(baseHttpUrl, auth);\n\t}\n\t/**\n\t* List all datasets.\n\t*\n\t* @returns {Promise<Dataset[]>} Array of datasets\n\t*/\n\tasync listDatasets() {\n\t\tconst response = await fetch(this.baseHttpUrl + this.apiPrefix + \"/datasets\", {\n\t\t\tmethod: \"GET\",\n\t\t\theaders: this.headers()\n\t\t});\n\t\tif (!response.ok) await this.handleError(response);\n\t\treturn response.json();\n\t}\n\t/**\n\t* Get a dataset by name.\n\t*\n\t* @param {string} name - Name of the dataset\n\t* @returns {Promise<Dataset[]>} Array of datasets with matching name\n\t*/\n\tasync getDatasetByName(name) {\n\t\tconst params = new URLSearchParams({ name });\n\t\tconst response = await fetch(this.baseHttpUrl + `${this.apiPrefix}/datasets?${params.toString()}`, {\n\t\t\tmethod: \"GET\",\n\t\t\theaders: this.headers()\n\t\t});\n\t\tif (!response.ok) await this.handleError(response);\n\t\treturn response.json();\n\t}\n\t/**\n\t* Push datapoints to a dataset.\n\t*\n\t* @param {Object} options - Push options\n\t* @param {Datapoint<D, T>[]} options.points - Datapoints to push\n\t* @param {string} [options.name] - Name of the dataset (either name or id must be provided)\n\t* @param {StringUUID} [options.id] - ID of the dataset (either name or id must be provided)\n\t* @param {number} [options.batchSize] - Batch size for pushing (default: 100)\n\t* @param {boolean} [options.createDataset] - Whether to create the dataset if it doesn't exist\n\t* @returns {Promise<PushDatapointsResponse | undefined>}\n\t*/\n\tasync push({ points, name, id, batchSize = DEFAULT_DATASET_PUSH_BATCH_SIZE, createDataset = false }) {\n\t\tif (!name && !id) throw new Error(\"Either name or id must be provided\");\n\t\tif (name && id) throw new Error(\"Only one of name or id must be provided\");\n\t\tif (createDataset && !name) throw new Error(\"Name must be provided when creating a new dataset\");\n\t\tconst identifier = name ? { name } : { datasetId: id };\n\t\tconst totalBatches = Math.ceil(points.length / batchSize);\n\t\tlet response;\n\t\tfor (let i = 0; i < points.length; i += batchSize) {\n\t\t\tconst batchNum = Math.floor(i / batchSize) + 1;\n\t\t\tlogger$3.debug(`Pushing batch ${batchNum} of ${totalBatches}`);\n\t\t\tconst batch = points.slice(i, i + batchSize);\n\t\t\tconst fetchResponse = await fetch(this.baseHttpUrl + this.apiPrefix + \"/datasets/datapoints\", {\n\t\t\t\tmethod: \"POST\",\n\t\t\t\theaders: this.headers(),\n\t\t\t\tbody: JSON.stringify({\n\t\t\t\t\t...identifier,\n\t\t\t\t\tdatapoints: batch.map((point) => ({\n\t\t\t\t\t\tdata: point.data,\n\t\t\t\t\t\ttarget: point.target ?? {},\n\t\t\t\t\t\tmetadata: point.metadata ?? {}\n\t\t\t\t\t})),\n\t\t\t\t\tcreateDataset\n\t\t\t\t})\n\t\t\t});\n\t\t\tif (fetchResponse.status !== 200 && fetchResponse.status !== 201) await this.handleError(fetchResponse);\n\t\t\tresponse = await fetchResponse.json();\n\t\t}\n\t\treturn response;\n\t}\n\t/**\n\t* Pull datapoints from a dataset.\n\t*\n\t* @param {Object} options - Pull options\n\t* @param {string} [options.name] - Name of the dataset (either name or id must be provided)\n\t* @param {StringUUID} [options.id] - ID of the dataset (either name or id must be provided)\n\t* @param {number} [options.limit] - Maximum number of datapoints to return (default: 100)\n\t* @param {number} [options.offset] - Offset for pagination (default: 0)\n\t* @returns {Promise<GetDatapointsResponse<D, T>>}\n\t*/\n\tasync pull({ name, id, limit = DEFAULT_DATASET_PULL_LIMIT, offset = 0 }) {\n\t\tif (!name && !id) throw new Error(\"Either name or id must be provided\");\n\t\tif (name && id) throw new Error(\"Only one of name or id must be provided\");\n\t\tconst paramsObj = {\n\t\t\toffset: offset.toString(),\n\t\t\tlimit: limit.toString()\n\t\t};\n\t\tif (name) paramsObj.name = name;\n\t\telse paramsObj.datasetId = id;\n\t\tconst params = new URLSearchParams(paramsObj);\n\t\tconst response = await fetch(this.baseHttpUrl + `${this.apiPrefix}/datasets/datapoints?${params.toString()}`, {\n\t\t\tmethod: \"GET\",\n\t\t\theaders: this.headers()\n\t\t});\n\t\tif (!response.ok) await this.handleError(response);\n\t\treturn response.json();\n\t}\n};\n//#endregion\n//#region src/resources/evals.ts\nconst logger$2 = initializeLogger();\nconst INITIAL_EVALUATION_DATAPOINT_MAX_DATA_LENGTH = 16e6;\nvar EvalsResource = class extends BaseResource {\n\tconstructor(baseHttpUrl, auth) {\n\t\tsuper(baseHttpUrl, auth);\n\t}\n\t/**\n\t* Initialize an evaluation.\n\t*\n\t* @param {string} name - Name of the evaluation\n\t* @param {string} groupName - Group name of the evaluation\n\t* @param {Record<string, any>} metadata - Optional metadata\n\t* @returns {Promise<InitEvaluationResponse>} Response from the evaluation initialization\n\t*/\n\tasync init(name, groupName, metadata) {\n\t\tconst response = await fetch(this.baseHttpUrl + \"/v1/evals\", {\n\t\t\tmethod: \"POST\",\n\t\t\theaders: this.headers(),\n\t\t\tbody: JSON.stringify({\n\t\t\t\tname: name ?? null,\n\t\t\t\tgroupName: groupName ?? null,\n\t\t\t\tmetadata: metadata ?? null\n\t\t\t})\n\t\t});\n\t\tif (!response.ok) await this.handleError(response);\n\t\treturn response.json();\n\t}\n\t/**\n\t* Create a new evaluation and return its ID.\n\t*\n\t* @param {string} [name] - Optional name of the evaluation\n\t* @param {string} [groupName] - An identifier to group evaluations\n\t* @param {Record<string, any>} [metadata] - Optional metadata\n\t* @returns {Promise<StringUUID>} The evaluation ID\n\t*/\n\tasync create(args) {\n\t\treturn (await this.init(args?.name, args?.groupName, args?.metadata)).id;\n\t}\n\t/**\n\t* Create a new evaluation and return its ID.\n\t* @deprecated use `create` instead.\n\t*/\n\tasync createEvaluation(name, groupName, metadata) {\n\t\treturn (await this.init(name, groupName, metadata)).id;\n\t}\n\t/**\n\t* Create a datapoint for an evaluation.\n\t*\n\t* @param {Object} options - Create datapoint options\n\t* @param {string} options.evalId - The evaluation ID\n\t* @param {D} options.data - The input data for the executor\n\t* @param {T} [options.target] - The target/expected output for evaluators\n\t* @param {Record<string, any>} [options.metadata] - Optional metadata\n\t* @param {number} [options.index] - Optional index of the datapoint\n\t* @param {string} [options.traceId] - Optional trace ID\n\t* @returns {Promise<StringUUID>} The datapoint ID\n\t*/\n\tasync createDatapoint({ evalId, data, target, metadata, index, traceId }) {\n\t\tconst datapointId = newUUID();\n\t\tconst partialDatapoint = {\n\t\t\tid: datapointId,\n\t\t\tdata,\n\t\t\ttarget,\n\t\t\tindex: index ?? 0,\n\t\t\ttraceId: traceId ?? newUUID(),\n\t\t\texecutorSpanId: newUUID(),\n\t\t\tmetadata\n\t\t};\n\t\tawait this.saveDatapoints({\n\t\t\tevalId,\n\t\t\tdatapoints: [partialDatapoint]\n\t\t});\n\t\treturn datapointId;\n\t}\n\t/**\n\t* Update a datapoint with evaluation results.\n\t*\n\t* @param {Object} options - Update datapoint options\n\t* @param {string} options.evalId - The evaluation ID\n\t* @param {string} options.datapointId - The datapoint ID\n\t* @param {Record<string, number>} options.scores - The scores\n\t* @param {O} [options.executorOutput] - The executor output\n\t* @returns {Promise<void>}\n\t*/\n\tasync updateDatapoint({ evalId, datapointId, scores, executorOutput }) {\n\t\tconst response = await fetch(this.baseHttpUrl + `/v1/evals/${evalId}/datapoints/${datapointId}`, {\n\t\t\tmethod: \"POST\",\n\t\t\theaders: this.headers(),\n\t\t\tbody: JSON.stringify({\n\t\t\t\texecutorOutput,\n\t\t\t\tscores\n\t\t\t})\n\t\t});\n\t\tif (!response.ok) await this.handleError(response);\n\t}\n\t/**\n\t* Save evaluation datapoints.\n\t*\n\t* @param {Object} options - Save datapoints options\n\t* @param {string} options.evalId - ID of the evaluation\n\t* @param {EvaluationDatapoint<D, T, O>[]} options.datapoints - Datapoint to add\n\t* @param {string} [options.groupName] - Group name of the evaluation\n\t* @returns {Promise<void>} Response from the datapoint addition\n\t*/\n\tasync saveDatapoints({ evalId, datapoints, groupName }) {\n\t\tconst response = await fetch(this.baseHttpUrl + `/v1/evals/${evalId}/datapoints`, {\n\t\t\tmethod: \"POST\",\n\t\t\theaders: this.headers(),\n\t\t\tbody: JSON.stringify({\n\t\t\t\tpoints: datapoints.map((d) => ({\n\t\t\t\t\t...d,\n\t\t\t\t\tdata: slicePayload(d.data, INITIAL_EVALUATION_DATAPOINT_MAX_DATA_LENGTH),\n\t\t\t\t\ttarget: slicePayload(d.target, INITIAL_EVALUATION_DATAPOINT_MAX_DATA_LENGTH),\n\t\t\t\t\texecutorOutput: slicePayload(d.executorOutput, INITIAL_EVALUATION_DATAPOINT_MAX_DATA_LENGTH)\n\t\t\t\t})),\n\t\t\t\tgroupName: groupName ?? null\n\t\t\t})\n\t\t});\n\t\tif (response.status === 413) return await this.retrySaveDatapoints({\n\t\t\tevalId,\n\t\t\tdatapoints,\n\t\t\tgroupName\n\t\t});\n\t\tif (!response.ok) await this.handleError(response);\n\t}\n\t/**\n\t* Get evaluation datapoints.\n\t*\n\t* @deprecated Use `client.datasets.pull()` instead.\n\t* @param {Object} options - Get datapoints options\n\t* @param {string} options.datasetName - Name of the dataset\n\t* @param {number} options.offset - Offset at which to start the query\n\t* @param {number} options.limit - Maximum number of datapoints to return\n\t* @returns {Promise<GetDatapointsResponse>} Response from the datapoint retrieval\n\t*/\n\tasync getDatapoints({ datasetName, offset, limit }) {\n\t\tlogger$2.warn(\"evals.getDatapoints() is deprecated. Use client.datasets.pull() instead.\");\n\t\tconst params = new URLSearchParams({\n\t\t\tname: datasetName,\n\t\t\toffset: offset.toString(),\n\t\t\tlimit: limit.toString()\n\t\t});\n\t\tconst response = await fetch(this.baseHttpUrl + `/v1/datasets/datapoints?${params.toString()}`, {\n\t\t\tmethod: \"GET\",\n\t\t\theaders: this.headers()\n\t\t});\n\t\tif (!response.ok) await this.handleError(response);\n\t\treturn await response.json();\n\t}\n\tasync retrySaveDatapoints({ evalId, datapoints, groupName, maxRetries = 25, initialLength = INITIAL_EVALUATION_DATAPOINT_MAX_DATA_LENGTH }) {\n\t\tlet length = initialLength;\n\t\tlet lastResponse = null;\n\t\tfor (let i = 0; i < maxRetries; i++) {\n\t\t\tlogger$2.debug(`Retrying save datapoints... ${i + 1} of ${maxRetries}, length: ${length}`);\n\t\t\tconst response = await fetch(this.baseHttpUrl + `/v1/evals/${evalId}/datapoints`, {\n\t\t\t\tmethod: \"POST\",\n\t\t\t\theaders: this.headers(),\n\t\t\t\tbody: JSON.stringify({\n\t\t\t\t\tpoints: datapoints.map((d) => ({\n\t\t\t\t\t\t...d,\n\t\t\t\t\t\tdata: slicePayload(d.data, length),\n\t\t\t\t\t\ttarget: slicePayload(d.target, length),\n\t\t\t\t\t\texecutorOutput: slicePayload(d.executorOutput, length)\n\t\t\t\t\t})),\n\t\t\t\t\tgroupName: groupName ?? null\n\t\t\t\t})\n\t\t\t});\n\t\t\tlastResponse = response;\n\t\t\tlength = Math.floor(length / 2);\n\t\t\tif (response.status !== 413) break;\n\t\t}\n\t\tif (lastResponse && !lastResponse.ok) await this.handleError(lastResponse);\n\t}\n};\n//#endregion\n//#region src/resources/evaluators.ts\n/**\n* Resource for creating evaluator scores\n*/\nvar EvaluatorsResource = class extends BaseResource {\n\tconstructor(baseHttpUrl, auth) {\n\t\tsuper(baseHttpUrl, auth);\n\t}\n\t/**\n\t* Create a score for a span or trace\n\t*\n\t* @param {ScoreOptions} options - Score creation options\n\t* @param {string} options.name - Name of the score\n\t* @param {string} [options.traceId] - The trace ID to score (will be attached to top-level span)\n\t* @param {string} [options.spanId] - The span ID to score\n\t* @param {Record<string, any>} [options.metadata] - Additional metadata\n\t* @param {number} options.score - The score value (float)\n\t* @returns {Promise<void>}\n\t*\n\t* @example\n\t* // Score by trace ID (will attach to root span)\n\t* await evaluators.score({\n\t* name: \"quality\",\n\t* traceId: \"trace-id-here\",\n\t* score: 0.95,\n\t* metadata: { model: \"gpt-4\" }\n\t* });\n\t*\n\t* @example\n\t* // Score by span ID\n\t* await evaluators.score({\n\t* name: \"relevance\",\n\t* spanId: \"span-id-here\",\n\t* score: 0.87\n\t* });\n\t*/\n\tasync score(options) {\n\t\tconst { name, metadata, score } = options;\n\t\tlet payload;\n\t\tif (\"traceId\" in options && options.traceId) payload = {\n\t\t\tname,\n\t\t\tmetadata,\n\t\t\tscore,\n\t\t\tsource: \"Code\",\n\t\t\ttraceId: isStringUUID(options.traceId) ? options.traceId : otelTraceIdToUUID(options.traceId)\n\t\t};\n\t\telse if (\"spanId\" in options && options.spanId) payload = {\n\t\t\tname,\n\t\t\tmetadata,\n\t\t\tscore,\n\t\t\tsource: \"Code\",\n\t\t\tspanId: isStringUUID(options.spanId) ? options.spanId : otelSpanIdToUUID(options.spanId)\n\t\t};\n\t\telse throw new Error(\"Either 'traceId' or 'spanId' must be provided.\");\n\t\tconst response = await fetch(this.baseHttpUrl + \"/v1/evaluators/score\", {\n\t\t\tmethod: \"POST\",\n\t\t\theaders: this.headers(),\n\t\t\tbody: JSON.stringify(payload)\n\t\t});\n\t\tif (!response.ok) await this.handleError(response);\n\t}\n};\n//#endregion\n//#region src/resources/rollout-sessions.ts\nconst logger$1 = initializeLogger();\n/**\n* Map the opaque HIT `response` payload onto a {@link CachedSpan} the provider\n* wrappers can replay. The server-side shape of `response` is not yet frozen\n* (app-server plan 01 leaves it as a `serde_json::Value`), so this stays\n* deliberately tolerant: the whole payload is serialized into `output` (the only\n* field the AI SDK wrapper's `parseCachedSpan` actually reads, via\n* `JSON.parse`), and a `finishReason` is surfaced into `attributes` when the\n* payload carries one. `name`/`input` are irrelevant to replay and left empty.\n*/\nconst toCachedSpan = (response) => {\n\tconst output = typeof response === \"string\" ? response : JSON.stringify(response ?? null);\n\tconst attributes = {};\n\tif (response !== null && typeof response === \"object\" && typeof response.finishReason === \"string\") attributes[\"ai.response.finishReason\"] = response.finishReason;\n\treturn {\n\t\tname: \"\",\n\t\tinput: \"\",\n\t\toutput,\n\t\tattributes\n\t};\n};\nvar RolloutSessionsResource = class extends BaseResource {\n\tconstructor(baseHttpUrl, auth) {\n\t\tsuper(baseHttpUrl, auth);\n\t}\n\t/**\n\t* Idempotently register (upsert) a debug session on the backend, keyed on the\n\t* SDK-supplied session id. The backend stores the row so the session is\n\t* visible in the UI; a null/omitted name never clobbers a name set elsewhere.\n\t*\n\t* Returns the backend-resolved `projectId` (derived from the API key) so the\n\t* caller can build the debugger URL; null if the body can't be parsed.\n\t*/\n\tasync register({ sessionId, name }) {\n\t\tconst response = await fetch(`${this.baseHttpUrl}${this.apiPrefix}/rollouts/${sessionId}`, {\n\t\t\tmethod: \"POST\",\n\t\t\theaders: this.headers(),\n\t\t\tbody: JSON.stringify({ name })\n\t\t});\n\t\tif (!response.ok) await this.handleError(response);\n\t\ttry {\n\t\t\treturn (await response.json()).projectId ?? null;\n\t\t} catch (e) {\n\t\t\tlogger$1.warn(`Failed to parse rollout register response: ${errorMessage(e)}`);\n\t\t\treturn null;\n\t\t}\n\t}\n\t/**\n\t* Rename an existing debug session. Update-only: the backend returns 404 (and\n\t* this throws) when the session id is unknown for the project, so a mistyped\n\t* id surfaces as an error rather than silently creating a session. Creation\n\t* stays the SDK's job via {@link register}.\n\t*/\n\tasync setName({ sessionId, name }) {\n\t\tconst response = await fetch(`${this.baseHttpUrl}${this.apiPrefix}/rollouts/${sessionId}/name`, {\n\t\t\tmethod: \"PATCH\",\n\t\t\theaders: this.headers(),\n\t\t\tbody: JSON.stringify({ name })\n\t\t});\n\t\tif (!response.ok) await this.handleError(response);\n\t}\n\t/**\n\t* Look up the debug-replay cache for a single LLM call (debug-replay v2).\n\t*\n\t* The server is keyed by `inputHash` (hex blake3 of the canonicalized,\n\t* system-stripped input messages). It returns one of three outcomes:\n\t* - `{ outcome: \"hit\", response }` — a cached response to replay.\n\t* - `{ outcome: \"miss\" }` — no entry; caller latches live mode.\n\t* - `{ outcome: \"live\" }` — run this call live (COLD degrade).\n\t*\n\t* Error posture: a non-OK response or a transport error degrades to\n\t* `{ kind: \"live\" }` for THIS call only — it never throws and never latches\n\t* the process-wide live flag (only a real MISS does that). This keeps a flaky\n\t* cache backend from turning a replay into a crash.\n\t*/\n\tasync cache({ sessionId, replayTraceId, cacheUntil, inputHash }) {\n\t\tlet response;\n\t\ttry {\n\t\t\tresponse = await fetch(`${this.baseHttpUrl}${this.apiPrefix}/rollouts/${sessionId}/cache`, {\n\t\t\t\tmethod: \"POST\",\n\t\t\t\theaders: this.headers(),\n\t\t\t\tbody: JSON.stringify({\n\t\t\t\t\treplayTraceId,\n\t\t\t\t\tcacheUntil,\n\t\t\t\t\tinputHash\n\t\t\t\t})\n\t\t\t});\n\t\t} catch (e) {\n\t\t\tlogger$1.warn(`Debug cache lookup failed, running live: ${errorMessage(e)}`);\n\t\t\treturn { kind: \"live\" };\n\t\t}\n\t\tif (!response.ok) {\n\t\t\tlogger$1.warn(`Debug cache lookup returned ${response.status}, running live`);\n\t\t\treturn { kind: \"live\" };\n\t\t}\n\t\tlet body;\n\t\ttry {\n\t\t\tbody = await response.json();\n\t\t} catch (e) {\n\t\t\tlogger$1.warn(`Failed to parse debug cache response, running live: ${errorMessage(e)}`);\n\t\t\treturn { kind: \"live\" };\n\t\t}\n\t\tswitch (body.outcome) {\n\t\t\tcase \"hit\":\n\t\t\t\tif (body.response === null || body.response === void 0) {\n\t\t\t\t\tlogger$1.warn(\"Debug cache HIT had no response payload, running live\");\n\t\t\t\t\treturn { kind: \"live\" };\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tkind: \"hit\",\n\t\t\t\t\tcached: toCachedSpan(body.response)\n\t\t\t\t};\n\t\t\tcase \"miss\": return { kind: \"miss\" };\n\t\t\tcase \"live\": return { kind: \"live\" };\n\t\t\tdefault:\n\t\t\t\tlogger$1.warn(`Unknown debug cache outcome \"${body.outcome}\", running live`);\n\t\t\t\treturn { kind: \"live\" };\n\t\t}\n\t}\n\tasync delete({ sessionId }) {\n\t\tconst response = await fetch(`${this.baseHttpUrl}${this.apiPrefix}/rollouts/${sessionId}`, {\n\t\t\tmethod: \"DELETE\",\n\t\t\theaders: this.headers()\n\t\t});\n\t\tif (!response.ok) await this.handleError(response);\n\t}\n};\n//#endregion\n//#region src/resources/sql.ts\nvar SqlResource = class extends BaseResource {\n\tconstructor(baseHttpUrl, auth) {\n\t\tsuper(baseHttpUrl, auth);\n\t}\n\tasync query(sql, parameters = {}) {\n\t\tconst response = await fetch(`${this.baseHttpUrl}${this.apiPrefix}/sql/query`, {\n\t\t\tmethod: \"POST\",\n\t\t\theaders: { ...this.headers() },\n\t\t\tbody: JSON.stringify({\n\t\t\t\tquery: sql,\n\t\t\t\tparameters\n\t\t\t})\n\t\t});\n\t\tif (!response.ok) await this.handleError(response);\n\t\treturn (await response.json()).data;\n\t}\n};\n//#endregion\n//#region src/resources/tags.ts\n/** Resource for tagging traces. */\nvar TagsResource = class extends BaseResource {\n\t/** Resource for tagging traces. */\n\tconstructor(baseHttpUrl, auth) {\n\t\tsuper(baseHttpUrl, auth);\n\t}\n\t/**\n\t* Tag a trace with a list of tags. Note that the trace must be ended before\n\t* tagging it. You may want to call `await Laminar.flush()` after the trace\n\t* that you want to tag.\n\t*\n\t* @param {string | StringUUID} trace_id - The trace id to tag.\n\t* @param {string[] | string} tags - The tag or list of tags to add to the trace.\n\t* @returns {Promise<any>} The response from the server.\n\t* @example\n\t* ```javascript\n\t* import { Laminar, observe, LaminarClient } from \"@lmnr-ai/lmnr\";\n\t* Laminar.initialize();\n\t* const client = new LaminarClient();\n\t* let traceId: StringUUID | null = null;\n\t* // Make sure this is called outside of traced context.\n\t* await observe(\n\t* {\n\t* name: \"my-trace\",\n\t* },\n\t* async () => {\n\t* traceId = await Laminar.getTraceId();\n\t* await foo();\n\t* },\n\t* );\n\t*\n\t* // or make sure the trace is ended by this point.\n\t* await Laminar.flush();\n\t* if (traceId) {\n\t* await client.tags.tag(traceId, [\"tag1\", \"tag2\"]);\n\t* }\n\t* ```\n\t*/\n\tasync tag(trace_id, tags) {\n\t\tconst traceTags = Array.isArray(tags) ? tags : [tags];\n\t\tconst formattedTraceId = isStringUUID(trace_id) ? trace_id : otelTraceIdToUUID(trace_id);\n\t\tconst url = this.baseHttpUrl + \"/v1/tag\";\n\t\tconst payload = {\n\t\t\t\"traceId\": formattedTraceId,\n\t\t\t\"names\": traceTags\n\t\t};\n\t\tconst response = await fetch(url, {\n\t\t\tmethod: \"POST\",\n\t\t\theaders: this.headers(),\n\t\t\tbody: JSON.stringify(payload)\n\t\t});\n\t\tif (!response.ok) await this.handleError(response);\n\t\treturn response.json();\n\t}\n};\n//#endregion\n//#region src/resources/traces.ts\n/** Resource for post-factum operations on existing traces. */\nconst logger = initializeLogger();\nvar TracesResource = class extends BaseResource {\n\t/** Resource for post-factum operations on existing traces. */\n\tconstructor(baseHttpUrl, auth) {\n\t\tsuper(baseHttpUrl, auth);\n\t}\n\t/**\n\t* Push a metadata patch to an existing trace.\n\t*\n\t* The patch is shallow-merged server-side into the trace's existing metadata\n\t* (`existing || patch`, last-write-wins per top-level key). Useful for\n\t* attaching post-factum signals — quality scores, human edits, triage labels —\n\t* to a trace that has already finished. The patch does NOT extend `endTime`\n\t* or change tokens / cost / top span / tags / span names. `numSpans` is\n\t* incremented by 1 (paid by the virtual span that carried the patch through\n\t* the ingestion queue) so the new ClickHouse row beats the prior version on\n\t* `ReplacingMergeTree(numSpans)`. No row is added to the `spans` table.\n\t*\n\t* Compared to `Laminar.setTraceMetadata` (which sets metadata on the\n\t* currently in-flight trace via OpenTelemetry attributes), this method\n\t* operates on a finished trace by trace id, so it must be called after the\n\t* trace has been flushed.\n\t*\n\t* A 404 response (the trace was not found in the project — typically because\n\t* it has not been flushed yet) is logged as a warning and the call returns\n\t* without throwing, since the 404 may be expected when pushing too soon\n\t* after the trace run. Pass `failOnNotFound: true` to throw instead (e.g.\n\t* CLI callers that must report the failure). Any other non-OK status throws.\n\t*\n\t* @param traceId - The trace id to push metadata to. Accepts a UUID string\n\t* or a 32-char OTel hex trace id.\n\t* @param metadata - The metadata patch. Top-level keys are merged into the\n\t* trace's existing metadata. Must be non-empty (the server rejects empty\n\t* patches with 400).\n\t* @param options - `failOnNotFound`: throw on 404 instead of warn-and-return.\n\t* @example\n\t* ```typescript\n\t* import { Laminar, observe, LaminarClient } from \"@lmnr-ai/lmnr\";\n\t* Laminar.initialize();\n\t* const client = new LaminarClient();\n\t*\n\t* let traceId: string | null = null;\n\t* await observe({ name: \"generate\" }, async () => {\n\t* traceId = await Laminar.getTraceId();\n\t* });\n\t* await Laminar.flush();\n\t*\n\t* if (traceId) {\n\t* await client.traces.pushMetadata(traceId, {\n\t* score: 0.85,\n\t* reviewer: \"alice\",\n\t* needsReview: false,\n\t* });\n\t* }\n\t* ```\n\t*/\n\tasync pushMetadata(traceId, metadata, options) {\n\t\tif (!metadata || Object.keys(metadata).length === 0) throw new Error(\"metadata must be a non-empty object\");\n\t\tconst formattedTraceId = isStringUUID(traceId) ? traceId : otelTraceIdToUUID(traceId);\n\t\tconst url = this.baseHttpUrl + this.apiPrefix + \"/traces/metadata\";\n\t\tconst response = await fetch(url, {\n\t\t\tmethod: \"POST\",\n\t\t\theaders: this.headers(),\n\t\t\tbody: JSON.stringify({\n\t\t\t\ttraceId: formattedTraceId,\n\t\t\t\tmetadata\n\t\t\t})\n\t\t});\n\t\tif (response.status === 404) {\n\t\t\tconst message = `Trace ${formattedTraceId} not found. The trace may not have been flushed yet — call await Laminar.flush() and retry.`;\n\t\t\tif (options?.failOnNotFound) throw new Error(message);\n\t\t\tlogger.warn(message);\n\t\t\treturn;\n\t\t}\n\t\tif (!response.ok) await this.handleError(response);\n\t}\n};\n//#endregion\n//#region src/index.ts\nvar LaminarClient = class LaminarClient {\n\tconstructor({ baseUrl, port, auth, projectApiKey, cliUserProjectId } = {}) {\n\t\tloadEnv();\n\t\tthis.auth = LaminarClient.normalizeAuth(auth, projectApiKey, cliUserProjectId);\n\t\tconst httpPort = port ?? (baseUrl?.match(/:\\d{1,5}$/g) ? parseInt(baseUrl.match(/:\\d{1,5}$/g)[0].slice(1)) : 443);\n\t\tconst baseUrlNoPort = (baseUrl ?? process.env.LMNR_BASE_URL)?.replace(/\\/$/, \"\").replace(/:\\d{1,5}$/g, \"\");\n\t\tthis.baseUrl = `${baseUrlNoPort ?? \"https://api.lmnr.ai\"}:${httpPort}`;\n\t\tthis._browserEvents = new BrowserEventsResource(this.baseUrl, this.auth);\n\t\tthis._cli = new CliResource(this.baseUrl, this.auth);\n\t\tthis._datasets = new DatasetsResource(this.baseUrl, this.auth);\n\t\tthis._evals = new EvalsResource(this.baseUrl, this.auth);\n\t\tthis._evaluators = new EvaluatorsResource(this.baseUrl, this.auth);\n\t\tthis._rolloutSessions = new RolloutSessionsResource(this.baseUrl, this.auth);\n\t\tthis._sql = new SqlResource(this.baseUrl, this.auth);\n\t\tthis._tags = new TagsResource(this.baseUrl, this.auth);\n\t\tthis._traces = new TracesResource(this.baseUrl, this.auth);\n\t}\n\t/**\n\t* Normalize the constructor's auth inputs into a {@link LaminarAuth} union.\n\t* Precedence: an explicit `auth` wins; otherwise the legacy\n\t* `projectApiKey` (+ optional `cliUserProjectId`) is mapped — a present\n\t* `cliUserProjectId` selects the user-token surface, otherwise the project\n\t* key surface. Falls back to `LMNR_PROJECT_API_KEY` as a project key.\n\t*/\n\tstatic normalizeAuth(auth, projectApiKey, cliUserProjectId) {\n\t\tif (auth) return auth;\n\t\tconst key = projectApiKey ?? process.env.LMNR_PROJECT_API_KEY;\n\t\tif (cliUserProjectId) return {\n\t\t\ttype: \"userToken\",\n\t\t\ttoken: key,\n\t\t\tprojectId: cliUserProjectId\n\t\t};\n\t\treturn {\n\t\t\ttype: \"apiKey\",\n\t\t\tkey\n\t\t};\n\t}\n\tget browserEvents() {\n\t\treturn this._browserEvents;\n\t}\n\tget cli() {\n\t\treturn this._cli;\n\t}\n\tget datasets() {\n\t\treturn this._datasets;\n\t}\n\tget evals() {\n\t\treturn this._evals;\n\t}\n\tget evaluators() {\n\t\treturn this._evaluators;\n\t}\n\tget rolloutSessions() {\n\t\treturn this._rolloutSessions;\n\t}\n\tget sql() {\n\t\treturn this._sql;\n\t}\n\tget tags() {\n\t\treturn this._tags;\n\t}\n\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