langwatch 1.0.0 → 1.2.0

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.
Files changed (56) hide show
  1. package/README.md +33 -0
  2. package/dist/{chunk-TKSTXX3D.js → chunk-CLTKABMO.js} +52 -2
  3. package/dist/chunk-CLTKABMO.js.map +1 -0
  4. package/dist/{chunk-L5KBRKHS.mjs → chunk-CMZFFKLA.mjs} +51 -1
  5. package/dist/{chunk-L5KBRKHS.mjs.map → chunk-CMZFFKLA.mjs.map} +1 -1
  6. package/dist/{chunk-52VMSJ4O.js → chunk-DTSULVK5.js} +39 -19
  7. package/dist/chunk-DTSULVK5.js.map +1 -0
  8. package/dist/{chunk-5Q2DUSMQ.mjs → chunk-JYTJEAOU.mjs} +3 -3
  9. package/dist/chunk-JYTJEAOU.mjs.map +1 -0
  10. package/dist/chunk-K6KPNTQO.js +15624 -0
  11. package/dist/chunk-K6KPNTQO.js.map +1 -0
  12. package/dist/{chunk-2O4ILSP5.mjs → chunk-LTDUROCE.mjs} +2 -2
  13. package/dist/{chunk-ALPIFEXL.mjs → chunk-PDNXHBSL.mjs} +26 -6
  14. package/dist/chunk-PDNXHBSL.mjs.map +1 -0
  15. package/dist/chunk-SYJIEBJY.mjs +15624 -0
  16. package/dist/chunk-SYJIEBJY.mjs.map +1 -0
  17. package/dist/{chunk-WHBCX64R.js → chunk-UOFSG6R4.js} +19 -19
  18. package/dist/chunk-UOFSG6R4.js.map +1 -0
  19. package/dist/{chunk-IUSLT65Z.js → chunk-ZTOXEWNX.js} +2 -2
  20. package/dist/chunk-ZTOXEWNX.js.map +1 -0
  21. package/dist/cli/bundle.js +265 -180
  22. package/dist/{implementation-CPfDot-W.d.mts → implementation-CHXrVq_q.d.mts} +1 -1
  23. package/dist/{implementation-aYHmyVZ_.d.ts → implementation-D_v0fUvU.d.ts} +1 -1
  24. package/dist/index.d.mts +1125 -5
  25. package/dist/index.d.ts +1125 -5
  26. package/dist/index.js +1272 -151
  27. package/dist/index.js.map +1 -1
  28. package/dist/index.mjs +1197 -76
  29. package/dist/index.mjs.map +1 -1
  30. package/dist/observability-sdk/index.d.mts +3 -3
  31. package/dist/observability-sdk/index.d.ts +3 -3
  32. package/dist/observability-sdk/index.js +5 -5
  33. package/dist/observability-sdk/index.js.map +1 -1
  34. package/dist/observability-sdk/index.mjs +4 -4
  35. package/dist/observability-sdk/instrumentation/langchain/index.d.mts +1 -1
  36. package/dist/observability-sdk/instrumentation/langchain/index.d.ts +1 -1
  37. package/dist/observability-sdk/instrumentation/langchain/index.js +18 -18
  38. package/dist/observability-sdk/instrumentation/langchain/index.js.map +1 -1
  39. package/dist/observability-sdk/instrumentation/langchain/index.mjs +2 -2
  40. package/dist/observability-sdk/setup/node/index.js +4 -4
  41. package/dist/observability-sdk/setup/node/index.js.map +1 -1
  42. package/dist/observability-sdk/setup/node/index.mjs +3 -3
  43. package/dist/{types-Cw-3VUv7.d.mts → types-DlP7QdqU.d.mts} +15065 -6184
  44. package/dist/{types-CeZ-M8JZ.d.ts → types-av2kmt_i.d.ts} +15065 -6184
  45. package/package.json +9 -10
  46. package/dist/chunk-52VMSJ4O.js.map +0 -1
  47. package/dist/chunk-5Q2DUSMQ.mjs.map +0 -1
  48. package/dist/chunk-ADJOFPAZ.js +0 -1005
  49. package/dist/chunk-ADJOFPAZ.js.map +0 -1
  50. package/dist/chunk-ALPIFEXL.mjs.map +0 -1
  51. package/dist/chunk-C323F5VC.mjs +0 -1005
  52. package/dist/chunk-C323F5VC.mjs.map +0 -1
  53. package/dist/chunk-IUSLT65Z.js.map +0 -1
  54. package/dist/chunk-TKSTXX3D.js.map +0 -1
  55. package/dist/chunk-WHBCX64R.js.map +0 -1
  56. /package/dist/{chunk-2O4ILSP5.mjs.map → chunk-LTDUROCE.mjs.map} +0 -0
package/dist/index.js CHANGED
@@ -1,15 +1,15 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2
2
 
3
- var _chunkIUSLT65Zjs = require('./chunk-IUSLT65Z.js');
3
+ var _chunkZTOXEWNXjs = require('./chunk-ZTOXEWNX.js');
4
4
 
5
5
 
6
6
 
7
- var _chunkADJOFPAZjs = require('./chunk-ADJOFPAZ.js');
8
7
 
8
+ var _chunkK6KPNTQOjs = require('./chunk-K6KPNTQO.js');
9
9
 
10
- var _chunk52VMSJ4Ojs = require('./chunk-52VMSJ4O.js');
11
10
 
12
11
 
12
+ var _chunkDTSULVK5js = require('./chunk-DTSULVK5.js');
13
13
 
14
14
 
15
15
 
@@ -19,7 +19,10 @@ var _chunk52VMSJ4Ojs = require('./chunk-52VMSJ4O.js');
19
19
 
20
20
 
21
21
 
22
- var _chunkWHBCX64Rjs = require('./chunk-WHBCX64R.js');
22
+
23
+ var _chunkUOFSG6R4js = require('./chunk-UOFSG6R4.js');
24
+
25
+
23
26
 
24
27
 
25
28
 
@@ -33,10 +36,21 @@ var _chunkWHBCX64Rjs = require('./chunk-WHBCX64R.js');
33
36
 
34
37
 
35
38
 
36
- var _chunkTKSTXX3Djs = require('./chunk-TKSTXX3D.js');
37
39
 
38
- // src/client-sdk/services/prompts/prompts-api.service.ts
39
- var _zod = require('zod');
40
+
41
+ var _chunkCLTKABMOjs = require('./chunk-CLTKABMO.js');
42
+
43
+ // src/internal/credentialContext.ts
44
+ var _async_hooks = require('async_hooks');
45
+ var storage = new (0, _async_hooks.AsyncLocalStorage)();
46
+ var fallbackHolder = {};
47
+ function currentHolder() {
48
+ var _a;
49
+ return (_a = storage.getStore()) != null ? _a : fallbackHolder;
50
+ }
51
+ function scopedApiKey() {
52
+ return currentHolder().apiKey;
53
+ }
40
54
 
41
55
  // src/cli/utils/responseFormat.ts
42
56
  var DEFAULT_TEXT_OUTPUT = {
@@ -174,7 +188,7 @@ var PromptTracingDecorator = class {
174
188
  }
175
189
  traceCompilation(span, variables, compileFn) {
176
190
  span.setType("prompt");
177
- if (_chunkTKSTXX3Djs.shouldCaptureInput.call(void 0, )) {
191
+ if (_chunkCLTKABMOjs.shouldCaptureInput.call(void 0, )) {
178
192
  span.setInput(this.target);
179
193
  if (variables) {
180
194
  span.setAttribute(
@@ -193,8 +207,8 @@ var PromptTracingDecorator = class {
193
207
  `${result.handle}:${result.version}`
194
208
  );
195
209
  }
196
- if (_chunkTKSTXX3Djs.shouldCaptureOutput.call(void 0, )) {
197
- span.setOutput(_chunkTKSTXX3Djs.__spreadProps.call(void 0, _chunkTKSTXX3Djs.__spreadValues.call(void 0, {}, result), {
210
+ if (_chunkCLTKABMOjs.shouldCaptureOutput.call(void 0, )) {
211
+ span.setOutput(_chunkCLTKABMOjs.__spreadProps.call(void 0, _chunkCLTKABMOjs.__spreadValues.call(void 0, {}, result), {
198
212
  raw: void 0
199
213
  // TODO(afr): Figure out a better way to do this.
200
214
  }));
@@ -233,7 +247,7 @@ var PromptServiceTracingDecorator = class {
233
247
  );
234
248
  }
235
249
  }
236
- if (result && _chunkTKSTXX3Djs.shouldCaptureOutput.call(void 0, )) {
250
+ if (result && _chunkCLTKABMOjs.shouldCaptureOutput.call(void 0, )) {
237
251
  span.setOutput("json", result);
238
252
  }
239
253
  return result;
@@ -241,7 +255,7 @@ var PromptServiceTracingDecorator = class {
241
255
  async create(span, params) {
242
256
  var _a;
243
257
  span.setType("prompt");
244
- if (_chunkTKSTXX3Djs.shouldCaptureInput.call(void 0, )) {
258
+ if (_chunkCLTKABMOjs.shouldCaptureInput.call(void 0, )) {
245
259
  span.setInput(params);
246
260
  }
247
261
  const result = await this.target.create(params);
@@ -256,7 +270,7 @@ var PromptServiceTracingDecorator = class {
256
270
  }
257
271
  async update(span, id, params) {
258
272
  var _a;
259
- if (_chunkTKSTXX3Djs.shouldCaptureInput.call(void 0, )) {
273
+ if (_chunkCLTKABMOjs.shouldCaptureInput.call(void 0, )) {
260
274
  span.setInput(params);
261
275
  }
262
276
  const result = await this.target.update(id, params);
@@ -278,7 +292,7 @@ var PromptServiceTracingDecorator = class {
278
292
  return result;
279
293
  }
280
294
  async upsert(span, handle, config) {
281
- if (_chunkTKSTXX3Djs.shouldCaptureInput.call(void 0, )) {
295
+ if (_chunkCLTKABMOjs.shouldCaptureInput.call(void 0, )) {
282
296
  span.setInput(config);
283
297
  }
284
298
  const result = await this.target.upsert(handle, config);
@@ -293,7 +307,7 @@ var PromptServiceTracingDecorator = class {
293
307
  return result;
294
308
  }
295
309
  async sync(span, params) {
296
- if (_chunkTKSTXX3Djs.shouldCaptureInput.call(void 0, )) {
310
+ if (_chunkCLTKABMOjs.shouldCaptureInput.call(void 0, )) {
297
311
  span.setInput(params);
298
312
  }
299
313
  const result = await this.target.sync(params);
@@ -312,7 +326,7 @@ var PromptServiceTracingDecorator = class {
312
326
  };
313
327
 
314
328
  // src/client-sdk/services/prompts/tracing/tracer.ts
315
- var tracer = _chunkADJOFPAZjs.getLangWatchTracer.call(void 0, `${_chunkWHBCX64Rjs.LANGWATCH_SDK_NAME_CLIENT}.prompts`, _chunkWHBCX64Rjs.LANGWATCH_SDK_VERSION);
329
+ var tracer = _chunkK6KPNTQOjs.getLangWatchTracer.call(void 0, `${_chunkUOFSG6R4js.LANGWATCH_SDK_NAME_CLIENT}.prompts`, _chunkUOFSG6R4js.LANGWATCH_SDK_VERSION);
316
330
 
317
331
  // src/client-sdk/tracing/create-tracing-proxy.ts
318
332
  var _api = require('@opentelemetry/api');
@@ -381,7 +395,7 @@ var isBuiltInMethod = (prop) => {
381
395
  // src/internal/api/client.ts
382
396
  var _openapifetch = require('openapi-fetch'); var _openapifetch2 = _interopRequireDefault(_openapifetch);
383
397
 
384
- // ../packages/langy/src/cards/handled-error.ts
398
+ // ../../packages/langy/src/cards/handled-error.ts
385
399
  var SERVER_ERROR_STATUS = 500;
386
400
  var GENERIC_CODES = /* @__PURE__ */ new Set([
387
401
  "internal server error",
@@ -395,7 +409,7 @@ var asReasons = (value) => {
395
409
  if (!Array.isArray(value)) return void 0;
396
410
  const reasons = value.map(asRecord).filter(
397
411
  (r) => !!r && (typeof r.code === "string" || typeof r.kind === "string")
398
- ).map((r) => _chunkTKSTXX3Djs.__spreadValues.call(void 0, _chunkTKSTXX3Djs.__spreadValues.call(void 0, {
412
+ ).map((r) => _chunkCLTKABMOjs.__spreadValues.call(void 0, _chunkCLTKABMOjs.__spreadValues.call(void 0, {
399
413
  kind: typeof r.code === "string" ? r.code : r.kind
400
414
  }, asRecord(r.meta) ? { meta: asRecord(r.meta) } : {}), asReasons(r.reasons) ? { reasons: asReasons(r.reasons) } : {}));
401
415
  return reasons.length > 0 ? reasons : void 0;
@@ -450,7 +464,7 @@ var asErrorBody = (value) => {
450
464
  tips: tips,
451
465
  docsUrl,
452
466
  fault: fault
453
- } = _c, rest = _chunkTKSTXX3Djs.__objRest.call(void 0, _c, [
467
+ } = _c, rest = _chunkCLTKABMOjs.__objRest.call(void 0, _c, [
454
468
  "error",
455
469
  "message",
456
470
  "kind",
@@ -524,7 +538,7 @@ var parseHandledError = ({
524
538
  isHandled: false
525
539
  };
526
540
  }
527
- return _chunkTKSTXX3Djs.__spreadProps.call(void 0, _chunkTKSTXX3Djs.__spreadValues.call(void 0, _chunkTKSTXX3Djs.__spreadValues.call(void 0, _chunkTKSTXX3Djs.__spreadValues.call(void 0, _chunkTKSTXX3Djs.__spreadValues.call(void 0, _chunkTKSTXX3Djs.__spreadValues.call(void 0, _chunkTKSTXX3Djs.__spreadValues.call(void 0, {
541
+ return _chunkCLTKABMOjs.__spreadProps.call(void 0, _chunkCLTKABMOjs.__spreadValues.call(void 0, _chunkCLTKABMOjs.__spreadValues.call(void 0, _chunkCLTKABMOjs.__spreadValues.call(void 0, _chunkCLTKABMOjs.__spreadValues.call(void 0, _chunkCLTKABMOjs.__spreadValues.call(void 0, _chunkCLTKABMOjs.__spreadValues.call(void 0, {
528
542
  code: parsed.code,
529
543
  // Deprecated back-compat alias — see CliHandledError.kind.
530
544
  kind: parsed.code,
@@ -643,16 +657,16 @@ var handledErrorMiddleware = {
643
657
  if (handledError) throw handledError;
644
658
  }
645
659
  };
646
- var createLangWatchApiClient = (apiKey = ((_a) => (_a = process.env.LANGWATCH_API_KEY) != null ? _a : "")(), endpoint = ((_b) => (_b = process.env.LANGWATCH_ENDPOINT) != null ? _b : (0, _chunkWHBCX64Rjs.DEFAULT_ENDPOINT))(), projectId = process.env.LANGWATCH_PROJECT_ID) => {
660
+ var createLangWatchApiClient = (apiKey = ((_b) => (_b = ((_a) => (_a = scopedApiKey()) != null ? _a : process.env.LANGWATCH_API_KEY)()) != null ? _b : "")(), endpoint, projectId = process.env.LANGWATCH_PROJECT_ID) => {
647
661
  const client = _openapifetch2.default.call(void 0, {
648
- baseUrl: endpoint,
649
- headers: _chunkTKSTXX3Djs.__spreadProps.call(void 0, _chunkTKSTXX3Djs.__spreadValues.call(void 0, {}, _chunkWHBCX64Rjs.buildAuthHeaders.call(void 0, { apiKey, projectId })), {
662
+ baseUrl: _chunkDTSULVK5js.resolveEndpoint.call(void 0, endpoint),
663
+ headers: _chunkCLTKABMOjs.__spreadProps.call(void 0, _chunkCLTKABMOjs.__spreadValues.call(void 0, {}, _chunkUOFSG6R4js.buildAuthHeaders.call(void 0, { apiKey, projectId })), {
650
664
  "content-type": "application/json",
651
- "user-agent": `langwatch-sdk-node/${_chunkWHBCX64Rjs.version}`,
652
- "x-langwatch-sdk-name": _chunkWHBCX64Rjs.LANGWATCH_SDK_NAME_OBSERVABILITY,
653
- "x-langwatch-sdk-language": _chunkWHBCX64Rjs.LANGWATCH_SDK_LANGUAGE,
654
- "x-langwatch-sdk-version": _chunkWHBCX64Rjs.LANGWATCH_SDK_VERSION,
655
- "x-langwatch-sdk-platform": _chunkWHBCX64Rjs.LANGWATCH_SDK_RUNTIME.call(void 0, )
665
+ "user-agent": `langwatch-sdk-node/${_chunkUOFSG6R4js.version}`,
666
+ "x-langwatch-sdk-name": _chunkUOFSG6R4js.LANGWATCH_SDK_NAME_OBSERVABILITY,
667
+ "x-langwatch-sdk-language": _chunkUOFSG6R4js.LANGWATCH_SDK_LANGUAGE,
668
+ "x-langwatch-sdk-version": _chunkUOFSG6R4js.LANGWATCH_SDK_VERSION,
669
+ "x-langwatch-sdk-platform": _chunkUOFSG6R4js.LANGWATCH_SDK_RUNTIME.call(void 0, )
656
670
  })
657
671
  });
658
672
  client.use(handledErrorMiddleware);
@@ -843,22 +857,22 @@ function extractStatusFromResponse(value) {
843
857
  }
844
858
 
845
859
  // src/client-sdk/services/prompts/prompts-api.service.ts
846
- var syncActionSchema = _zod.z.enum([
860
+ var syncActionSchema = _chunkK6KPNTQOjs.external_exports.enum([
847
861
  "created",
848
862
  "updated",
849
863
  "conflict",
850
864
  "up_to_date"
851
865
  ]);
852
- var syncResultSchema = _zod.z.object({
866
+ var syncResultSchema = _chunkK6KPNTQOjs.external_exports.object({
853
867
  action: syncActionSchema,
854
868
  // `prompt` and `conflictInfo` are passed through untyped — they come from
855
869
  // the OpenAPI-derived shape which is already validated on the server side.
856
- prompt: _zod.z.unknown().optional(),
857
- conflictInfo: _zod.z.object({
858
- localVersion: _zod.z.number(),
859
- remoteVersion: _zod.z.number(),
860
- differences: _zod.z.array(_zod.z.string()),
861
- remoteConfigData: _zod.z.unknown()
870
+ prompt: _chunkK6KPNTQOjs.external_exports.unknown().optional(),
871
+ conflictInfo: _chunkK6KPNTQOjs.external_exports.object({
872
+ localVersion: _chunkK6KPNTQOjs.external_exports.number(),
873
+ remoteVersion: _chunkK6KPNTQOjs.external_exports.number(),
874
+ differences: _chunkK6KPNTQOjs.external_exports.array(_chunkK6KPNTQOjs.external_exports.string()),
875
+ remoteConfigData: _chunkK6KPNTQOjs.external_exports.unknown()
862
876
  }).passthrough().optional()
863
877
  });
864
878
  var PromptsApiService = class {
@@ -1159,9 +1173,6 @@ var PromptsApiService = class {
1159
1173
  // src/client-sdk/services/prompts/prompt.ts
1160
1174
  var _liquidjs = require('liquidjs');
1161
1175
 
1162
- // src/client-sdk/services/prompts/schema/prompt.schema.ts
1163
-
1164
-
1165
1176
  // src/client-sdk/services/prompts/constants.ts
1166
1177
  var PromptScope = {
1167
1178
  ORGANIZATION: "ORGANIZATION",
@@ -1169,34 +1180,34 @@ var PromptScope = {
1169
1180
  };
1170
1181
 
1171
1182
  // src/client-sdk/services/prompts/schema/prompt.schema.ts
1172
- var messageSchema = _zod.z.object({
1173
- role: _zod.z.enum(["user", "assistant", "system"]),
1174
- content: _zod.z.string()
1183
+ var messageSchema = _chunkK6KPNTQOjs.external_exports.object({
1184
+ role: _chunkK6KPNTQOjs.external_exports.enum(["user", "assistant", "system"]),
1185
+ content: _chunkK6KPNTQOjs.external_exports.string()
1175
1186
  });
1176
- var responseFormatSchema = _zod.z.object({
1177
- type: _zod.z.literal("json_schema"),
1178
- json_schema: _zod.z.object({
1179
- name: _zod.z.string(),
1180
- schema: _zod.z.record(_zod.z.string(), _zod.z.unknown())
1187
+ var responseFormatSchema = _chunkK6KPNTQOjs.external_exports.object({
1188
+ type: _chunkK6KPNTQOjs.external_exports.literal("json_schema"),
1189
+ json_schema: _chunkK6KPNTQOjs.external_exports.object({
1190
+ name: _chunkK6KPNTQOjs.external_exports.string(),
1191
+ schema: _chunkK6KPNTQOjs.external_exports.record(_chunkK6KPNTQOjs.external_exports.string(), _chunkK6KPNTQOjs.external_exports.unknown())
1181
1192
  }).nullable()
1182
1193
  }).optional();
1183
- var corePromptDataSchema = _zod.z.object({
1184
- model: _zod.z.string().min(1, "Model cannot be empty"),
1185
- messages: _zod.z.array(messageSchema).min(1, "At least one message is required"),
1186
- prompt: _zod.z.string().optional(),
1187
- temperature: _zod.z.number().min(0).max(2).optional(),
1188
- maxTokens: _zod.z.number().positive().optional(),
1194
+ var corePromptDataSchema = _chunkK6KPNTQOjs.external_exports.object({
1195
+ model: _chunkK6KPNTQOjs.external_exports.string().min(1, "Model cannot be empty"),
1196
+ messages: _chunkK6KPNTQOjs.external_exports.array(messageSchema).min(1, "At least one message is required"),
1197
+ prompt: _chunkK6KPNTQOjs.external_exports.string().optional(),
1198
+ temperature: _chunkK6KPNTQOjs.external_exports.number().min(0).max(2).optional(),
1199
+ maxTokens: _chunkK6KPNTQOjs.external_exports.number().positive().optional(),
1189
1200
  responseFormat: responseFormatSchema
1190
1201
  });
1191
- var promptMetadataSchema = _zod.z.object({
1192
- id: _zod.z.string().optional(),
1193
- handle: _zod.z.string().nullable().optional(),
1194
- version: _zod.z.number().min(0).optional(),
1195
- versionId: _zod.z.string().optional(),
1196
- scope: _zod.z.enum(PromptScope).optional()
1202
+ var promptMetadataSchema = _chunkK6KPNTQOjs.external_exports.object({
1203
+ id: _chunkK6KPNTQOjs.external_exports.string().optional(),
1204
+ handle: _chunkK6KPNTQOjs.external_exports.string().nullable().optional(),
1205
+ version: _chunkK6KPNTQOjs.external_exports.number().min(0).optional(),
1206
+ versionId: _chunkK6KPNTQOjs.external_exports.string().optional(),
1207
+ scope: _chunkK6KPNTQOjs.external_exports.enum(PromptScope).optional()
1197
1208
  });
1198
- var promptDataSchema = _zod.z.object(_chunkTKSTXX3Djs.__spreadProps.call(void 0, _chunkTKSTXX3Djs.__spreadValues.call(void 0, _chunkTKSTXX3Djs.__spreadValues.call(void 0, {}, corePromptDataSchema.shape), promptMetadataSchema.shape), {
1199
- parameters: _zod.z.record(_zod.z.string(), _zod.z.unknown()).optional()
1209
+ var promptDataSchema = _chunkK6KPNTQOjs.external_exports.object(_chunkCLTKABMOjs.__spreadProps.call(void 0, _chunkCLTKABMOjs.__spreadValues.call(void 0, _chunkCLTKABMOjs.__spreadValues.call(void 0, {}, corePromptDataSchema.shape), promptMetadataSchema.shape), {
1210
+ parameters: _chunkK6KPNTQOjs.external_exports.record(_chunkK6KPNTQOjs.external_exports.string(), _chunkK6KPNTQOjs.external_exports.unknown()).optional()
1200
1211
  }));
1201
1212
 
1202
1213
  // src/client-sdk/services/prompts/prompt.ts
@@ -1234,12 +1245,12 @@ var Prompt = class {
1234
1245
  const compiledPrompt = this.prompt ? liquid.parseAndRenderSync(this.prompt, variables, {
1235
1246
  strictVariables: strict
1236
1247
  }) : "";
1237
- const compiledMessages = (this.messages || []).map((message) => _chunkTKSTXX3Djs.__spreadProps.call(void 0, _chunkTKSTXX3Djs.__spreadValues.call(void 0, {}, message), {
1248
+ const compiledMessages = (this.messages || []).map((message) => _chunkCLTKABMOjs.__spreadProps.call(void 0, _chunkCLTKABMOjs.__spreadValues.call(void 0, {}, message), {
1238
1249
  content: message.content ? liquid.parseAndRenderSync(message.content, variables, {
1239
1250
  strictVariables: strict
1240
1251
  }) : message.content
1241
1252
  }));
1242
- const compiledData = _chunkTKSTXX3Djs.__spreadProps.call(void 0, _chunkTKSTXX3Djs.__spreadValues.call(void 0, {}, this), {
1253
+ const compiledData = _chunkCLTKABMOjs.__spreadProps.call(void 0, _chunkCLTKABMOjs.__spreadValues.call(void 0, {}, this), {
1243
1254
  prompt: compiledPrompt,
1244
1255
  messages: compiledMessages
1245
1256
  });
@@ -1288,20 +1299,32 @@ var _jsyaml = require('js-yaml'); var yaml = _interopRequireWildcard(_jsyaml);
1288
1299
  var _chalk = require('chalk'); var _chalk2 = _interopRequireDefault(_chalk);
1289
1300
 
1290
1301
  // src/cli/types-prompt.ts
1291
-
1292
- var localPromptConfigSchema = _zod.z.object({
1293
- model: _zod.z.string().min(1, "Model is required"),
1294
- modelParameters: _zod.z.object({
1295
- temperature: _zod.z.number().optional(),
1296
- max_tokens: _zod.z.number().optional()
1302
+ var jsonValueSchema = _chunkK6KPNTQOjs.external_exports.lazy(
1303
+ () => _chunkK6KPNTQOjs.external_exports.union([
1304
+ _chunkK6KPNTQOjs.external_exports.string(),
1305
+ _chunkK6KPNTQOjs.external_exports.number(),
1306
+ _chunkK6KPNTQOjs.external_exports.boolean(),
1307
+ _chunkK6KPNTQOjs.external_exports.null(),
1308
+ _chunkK6KPNTQOjs.external_exports.array(jsonValueSchema),
1309
+ _chunkK6KPNTQOjs.external_exports.record(_chunkK6KPNTQOjs.external_exports.string(), jsonValueSchema)
1310
+ ])
1311
+ );
1312
+ var localPromptConfigSchema = _chunkK6KPNTQOjs.external_exports.object({
1313
+ model: _chunkK6KPNTQOjs.external_exports.string().min(1, "Model is required"),
1314
+ modelParameters: _chunkK6KPNTQOjs.external_exports.object({
1315
+ temperature: _chunkK6KPNTQOjs.external_exports.number().optional(),
1316
+ max_tokens: _chunkK6KPNTQOjs.external_exports.number().optional()
1297
1317
  }).loose().optional(),
1298
- messages: _zod.z.array(
1299
- _zod.z.object({
1300
- role: _zod.z.enum(["system", "user", "assistant"]),
1301
- content: _zod.z.string().min(1, "Message content cannot be empty")
1318
+ messages: _chunkK6KPNTQOjs.external_exports.array(
1319
+ _chunkK6KPNTQOjs.external_exports.object({
1320
+ role: _chunkK6KPNTQOjs.external_exports.enum(["system", "user", "assistant"]),
1321
+ content: _chunkK6KPNTQOjs.external_exports.string().min(1, "Message content cannot be empty")
1302
1322
  }).loose()
1303
1323
  ).min(1, "At least one message is required"),
1304
- parameters: _zod.z.record(_zod.z.string(), _zod.z.unknown()).optional().default({})
1324
+ // Parameters persist as JSON: parse them AS json so the value's type
1325
+ // matches the API contract (the spec's recursive JsonValue) instead of
1326
+ // laundering unknowns into a typed pipeline.
1327
+ parameters: _chunkK6KPNTQOjs.external_exports.record(_chunkK6KPNTQOjs.external_exports.string(), jsonValueSchema).optional().default({})
1305
1328
  }).loose();
1306
1329
 
1307
1330
  // src/cli/utils/errors/prompt-not-found.error.ts
@@ -1591,7 +1614,7 @@ var LocalPromptsService = class {
1591
1614
  constructor(config) {
1592
1615
  var _a, _b;
1593
1616
  this.fileManager = (_a = config == null ? void 0 : config.fileManager) != null ? _a : FileManager;
1594
- this.logger = (_b = config == null ? void 0 : config.logger) != null ? _b : new (0, _chunkTKSTXX3Djs.NoOpLogger)();
1617
+ this.logger = (_b = config == null ? void 0 : config.logger) != null ? _b : new (0, _chunkCLTKABMOjs.NoOpLogger)();
1595
1618
  }
1596
1619
  /**
1597
1620
  * Retrieves a prompt using the configured search strategy.
@@ -1614,7 +1637,7 @@ var LocalPromptsService = class {
1614
1637
  if (e instanceof PromptFileNotFoundError) return null;
1615
1638
  throw e;
1616
1639
  });
1617
- return localPromptConfig ? this.convertToPromptData(_chunkTKSTXX3Djs.__spreadProps.call(void 0, _chunkTKSTXX3Djs.__spreadValues.call(void 0, {}, localPromptConfig), {
1640
+ return localPromptConfig ? this.convertToPromptData(_chunkCLTKABMOjs.__spreadProps.call(void 0, _chunkCLTKABMOjs.__spreadValues.call(void 0, {}, localPromptConfig), {
1618
1641
  handle: handleOrId
1619
1642
  })) : null;
1620
1643
  } catch (error) {
@@ -1671,8 +1694,8 @@ var LocalPromptsService = class {
1671
1694
  * Converts LocalPromptConfig to PromptData format
1672
1695
  */
1673
1696
  convertToPromptData(config) {
1674
- const _a = config, { modelParameters } = _a, rest = _chunkTKSTXX3Djs.__objRest.call(void 0, _a, ["modelParameters"]);
1675
- return _chunkTKSTXX3Djs.__spreadValues.call(void 0, {
1697
+ const _a = config, { modelParameters } = _a, rest = _chunkCLTKABMOjs.__objRest.call(void 0, _a, ["modelParameters"]);
1698
+ return _chunkCLTKABMOjs.__spreadValues.call(void 0, {
1676
1699
  maxTokens: modelParameters == null ? void 0 : modelParameters.max_tokens,
1677
1700
  temperature: modelParameters == null ? void 0 : modelParameters.temperature
1678
1701
  }, rest);
@@ -1858,12 +1881,12 @@ var DatasetPlanLimitError = class extends DatasetError {
1858
1881
  };
1859
1882
 
1860
1883
  // src/client-sdk/services/datasets/tracing/tracer.ts
1861
- var tracer2 = _chunkADJOFPAZjs.getLangWatchTracer.call(void 0, `${_chunkWHBCX64Rjs.LANGWATCH_SDK_NAME_CLIENT}.datasets`, _chunkWHBCX64Rjs.LANGWATCH_SDK_VERSION);
1884
+ var tracer2 = _chunkK6KPNTQOjs.getLangWatchTracer.call(void 0, `${_chunkUOFSG6R4js.LANGWATCH_SDK_NAME_CLIENT}.datasets`, _chunkUOFSG6R4js.LANGWATCH_SDK_VERSION);
1862
1885
 
1863
1886
  // src/client-sdk/services/datasets/dataset.service.ts
1864
1887
  var DatasetService = class {
1865
1888
  constructor(config) {
1866
- this.config = config;
1889
+ this.config = _chunkCLTKABMOjs.__spreadProps.call(void 0, _chunkCLTKABMOjs.__spreadValues.call(void 0, {}, config), { endpoint: _chunkDTSULVK5js.resolveEndpoint.call(void 0, config.endpoint) });
1867
1890
  return createTracingProxy(this, tracer2);
1868
1891
  }
1869
1892
  /**
@@ -2141,10 +2164,10 @@ var DatasetService = class {
2141
2164
  */
2142
2165
  async fetchMultipart(path2, formData, operation, slugOrId) {
2143
2166
  const { endpoint, apiKey } = this.config;
2144
- const url = `${endpoint.replace(/\/$/, "")}${path2}`;
2167
+ const url = `${endpoint}${path2}`;
2145
2168
  const response = await fetch(url, {
2146
2169
  method: "POST",
2147
- headers: _chunkWHBCX64Rjs.buildAuthHeaders.call(void 0, { apiKey }),
2170
+ headers: _chunkUOFSG6R4js.buildAuthHeaders.call(void 0, { apiKey }),
2148
2171
  body: formData
2149
2172
  });
2150
2173
  if (!response.ok) {
@@ -2306,7 +2329,7 @@ var DatasetService = class {
2306
2329
  var _datasetService;
2307
2330
  var DatasetsFacade = class {
2308
2331
  constructor(config) {
2309
- _chunkTKSTXX3Djs.__privateAdd.call(void 0, this, _datasetService);
2332
+ _chunkCLTKABMOjs.__privateAdd.call(void 0, this, _datasetService);
2310
2333
  /**
2311
2334
  * Lists all datasets for the project, with optional pagination.
2312
2335
  *
@@ -2314,7 +2337,7 @@ var DatasetsFacade = class {
2314
2337
  * @returns Paginated list of datasets with metadata
2315
2338
  */
2316
2339
  this.list = (options) => {
2317
- return _chunkTKSTXX3Djs.__privateGet.call(void 0, this, _datasetService).listDatasets(options);
2340
+ return _chunkCLTKABMOjs.__privateGet.call(void 0, this, _datasetService).listDatasets(options);
2318
2341
  };
2319
2342
  /**
2320
2343
  * Creates a new dataset.
@@ -2326,7 +2349,7 @@ var DatasetsFacade = class {
2326
2349
  if (!options.name || options.name.trim().length === 0) {
2327
2350
  throw new DatasetValidationError("Dataset name must not be empty");
2328
2351
  }
2329
- return _chunkTKSTXX3Djs.__privateGet.call(void 0, this, _datasetService).createDataset(options);
2352
+ return _chunkCLTKABMOjs.__privateGet.call(void 0, this, _datasetService).createDataset(options);
2330
2353
  };
2331
2354
  /**
2332
2355
  * Fetches a dataset by its slug or ID, returning metadata and entries.
@@ -2351,7 +2374,7 @@ var DatasetsFacade = class {
2351
2374
  * ```
2352
2375
  */
2353
2376
  this.get = (slugOrId, options) => {
2354
- return _chunkTKSTXX3Djs.__privateGet.call(void 0, this, _datasetService).getDataset(slugOrId, options);
2377
+ return _chunkCLTKABMOjs.__privateGet.call(void 0, this, _datasetService).getDataset(slugOrId, options);
2355
2378
  };
2356
2379
  /**
2357
2380
  * Updates a dataset by its slug or ID.
@@ -2366,7 +2389,7 @@ var DatasetsFacade = class {
2366
2389
  "At least one field (name or columnTypes) must be provided for update"
2367
2390
  );
2368
2391
  }
2369
- return _chunkTKSTXX3Djs.__privateGet.call(void 0, this, _datasetService).updateDataset(slugOrId, options);
2392
+ return _chunkCLTKABMOjs.__privateGet.call(void 0, this, _datasetService).updateDataset(slugOrId, options);
2370
2393
  };
2371
2394
  /**
2372
2395
  * Deletes (archives) a dataset by its slug or ID.
@@ -2375,7 +2398,7 @@ var DatasetsFacade = class {
2375
2398
  * @returns The archived dataset metadata
2376
2399
  */
2377
2400
  this.delete = (slugOrId) => {
2378
- return _chunkTKSTXX3Djs.__privateGet.call(void 0, this, _datasetService).deleteDataset(slugOrId);
2401
+ return _chunkCLTKABMOjs.__privateGet.call(void 0, this, _datasetService).deleteDataset(slugOrId);
2379
2402
  };
2380
2403
  /**
2381
2404
  * Creates records in a dataset in batch.
@@ -2388,7 +2411,7 @@ var DatasetsFacade = class {
2388
2411
  if (!entries || entries.length === 0) {
2389
2412
  throw new DatasetValidationError("Entries must not be empty");
2390
2413
  }
2391
- return _chunkTKSTXX3Djs.__privateGet.call(void 0, this, _datasetService).createRecords(slugOrId, entries);
2414
+ return _chunkCLTKABMOjs.__privateGet.call(void 0, this, _datasetService).createRecords(slugOrId, entries);
2392
2415
  };
2393
2416
  /**
2394
2417
  * Updates a single record in a dataset.
@@ -2399,7 +2422,7 @@ var DatasetsFacade = class {
2399
2422
  * @returns The updated record
2400
2423
  */
2401
2424
  this.updateRecord = (slugOrId, recordId, entry) => {
2402
- return _chunkTKSTXX3Djs.__privateGet.call(void 0, this, _datasetService).updateRecord(slugOrId, recordId, entry);
2425
+ return _chunkCLTKABMOjs.__privateGet.call(void 0, this, _datasetService).updateRecord(slugOrId, recordId, entry);
2403
2426
  };
2404
2427
  /**
2405
2428
  * Deletes records from a dataset by IDs.
@@ -2409,7 +2432,7 @@ var DatasetsFacade = class {
2409
2432
  * @returns Object with the count of deleted records
2410
2433
  */
2411
2434
  this.deleteRecords = (slugOrId, recordIds) => {
2412
- return _chunkTKSTXX3Djs.__privateGet.call(void 0, this, _datasetService).deleteRecords(slugOrId, recordIds);
2435
+ return _chunkCLTKABMOjs.__privateGet.call(void 0, this, _datasetService).deleteRecords(slugOrId, recordIds);
2413
2436
  };
2414
2437
  /**
2415
2438
  * Lists records in a dataset with optional pagination.
@@ -2428,7 +2451,7 @@ var DatasetsFacade = class {
2428
2451
  * ```
2429
2452
  */
2430
2453
  this.listRecords = (slugOrId, options) => {
2431
- return _chunkTKSTXX3Djs.__privateGet.call(void 0, this, _datasetService).listRecords(slugOrId, options);
2454
+ return _chunkCLTKABMOjs.__privateGet.call(void 0, this, _datasetService).listRecords(slugOrId, options);
2432
2455
  };
2433
2456
  /**
2434
2457
  * Uploads a file to a dataset with a configurable strategy for handling existing datasets.
@@ -2462,19 +2485,19 @@ var DatasetsFacade = class {
2462
2485
  if (!file) {
2463
2486
  throw new DatasetValidationError("File must be provided for upload");
2464
2487
  }
2465
- return _chunkTKSTXX3Djs.__privateGet.call(void 0, this, _datasetService).uploadWithStrategy(
2488
+ return _chunkCLTKABMOjs.__privateGet.call(void 0, this, _datasetService).uploadWithStrategy(
2466
2489
  slugOrId,
2467
2490
  file,
2468
2491
  (_a = options == null ? void 0 : options.ifExists) != null ? _a : "append"
2469
2492
  );
2470
2493
  };
2471
- _chunkTKSTXX3Djs.__privateSet.call(void 0, this, _datasetService, new DatasetService(config));
2494
+ _chunkCLTKABMOjs.__privateSet.call(void 0, this, _datasetService, new DatasetService(config));
2472
2495
  }
2473
2496
  };
2474
2497
  _datasetService = new WeakMap();
2475
2498
 
2476
2499
  // src/client-sdk/services/experiments/experiment.ts
2477
- var _async_hooks = require('async_hooks');
2500
+
2478
2501
 
2479
2502
 
2480
2503
  // src/client-sdk/services/experiments/humanReadableId.ts
@@ -2718,7 +2741,7 @@ var Experiment = class _Experiment {
2718
2741
  this.experimentSlug = name;
2719
2742
  this.runId = (_a = options.runId) != null ? _a : generateHumanReadableId();
2720
2743
  this.apiClient = options.apiClient;
2721
- this.endpoint = options.endpoint;
2744
+ this.endpoint = _chunkDTSULVK5js.resolveEndpoint.call(void 0, options.endpoint);
2722
2745
  this.apiKey = options.apiKey;
2723
2746
  this.logger = options.logger;
2724
2747
  this.concurrency = (_b = options.concurrency) != null ? _b : DEFAULT_CONCURRENCY;
@@ -2728,7 +2751,7 @@ var Experiment = class _Experiment {
2728
2751
  * Initialize an evaluation session
2729
2752
  */
2730
2753
  static async init(name, options) {
2731
- _chunk52VMSJ4Ojs.ensureSetup.call(void 0, );
2754
+ _chunkDTSULVK5js.ensureSetup.call(void 0, );
2732
2755
  const experiment = new _Experiment(name, options);
2733
2756
  await experiment.initialize();
2734
2757
  return experiment;
@@ -2745,9 +2768,9 @@ var Experiment = class _Experiment {
2745
2768
  try {
2746
2769
  const response = await fetch(`${this.endpoint}/api/experiment/init`, {
2747
2770
  method: "POST",
2748
- headers: _chunkTKSTXX3Djs.__spreadValues.call(void 0, {
2771
+ headers: _chunkCLTKABMOjs.__spreadValues.call(void 0, {
2749
2772
  "Content-Type": "application/json"
2750
- }, _chunkWHBCX64Rjs.buildAuthHeaders.call(void 0, { apiKey: this.apiKey })),
2773
+ }, _chunkUOFSG6R4js.buildAuthHeaders.call(void 0, { apiKey: this.apiKey })),
2751
2774
  body: JSON.stringify({
2752
2775
  experiment_name: this.name,
2753
2776
  experiment_slug: this.experimentSlug,
@@ -2764,7 +2787,7 @@ var Experiment = class _Experiment {
2764
2787
  const data = await response.json();
2765
2788
  this.experimentSlug = data.slug;
2766
2789
  const encodedRunId = encodeURIComponent(this.runId);
2767
- this.runUrl = `${this.endpoint.replace(/\/$/, "")}${data.path}?runId=${encodedRunId}`;
2790
+ this.runUrl = `${this.endpoint}${data.path}?runId=${encodedRunId}`;
2768
2791
  console.log(`Follow results at: ${this.runUrl}`);
2769
2792
  this.initialized = true;
2770
2793
  } catch (error) {
@@ -2865,7 +2888,7 @@ var Experiment = class _Experiment {
2865
2888
  }
2866
2889
  },
2867
2890
  async (otelSpan) => {
2868
- const span = _chunkADJOFPAZjs.createLangWatchSpan.call(void 0, otelSpan);
2891
+ const span = _chunkK6KPNTQOjs.createLangWatchSpan.call(void 0, otelSpan);
2869
2892
  const spanContext = otelSpan.spanContext();
2870
2893
  const traceId = spanContext.traceId;
2871
2894
  this.currentTraceId = traceId;
@@ -3035,9 +3058,9 @@ var Experiment = class _Experiment {
3035
3058
  `${this.endpoint}/api/evaluations/${evaluatorSlug}/evaluate`,
3036
3059
  {
3037
3060
  method: "POST",
3038
- headers: _chunkTKSTXX3Djs.__spreadValues.call(void 0, {
3061
+ headers: _chunkCLTKABMOjs.__spreadValues.call(void 0, {
3039
3062
  "Content-Type": "application/json"
3040
- }, _chunkWHBCX64Rjs.buildAuthHeaders.call(void 0, { apiKey: this.apiKey })),
3063
+ }, _chunkUOFSG6R4js.buildAuthHeaders.call(void 0, { apiKey: this.apiKey })),
3041
3064
  body: JSON.stringify({
3042
3065
  trace_id: traceId != null ? traceId : null,
3043
3066
  span_id: spanId != null ? spanId : null,
@@ -3128,7 +3151,7 @@ var Experiment = class _Experiment {
3128
3151
  },
3129
3152
  _api.ROOT_CONTEXT,
3130
3153
  async (otelSpan) => {
3131
- const span = _chunkADJOFPAZjs.createLangWatchSpan.call(void 0, otelSpan);
3154
+ const span = _chunkK6KPNTQOjs.createLangWatchSpan.call(void 0, otelSpan);
3132
3155
  const spanContext = otelSpan.spanContext();
3133
3156
  const rawTraceId = spanContext.traceId;
3134
3157
  spanId = spanContext.spanId;
@@ -3368,7 +3391,7 @@ var Experiment = class _Experiment {
3368
3391
  run_id: this.runId,
3369
3392
  dataset: this.batch.dataset.map((entry) => {
3370
3393
  var _a, _b;
3371
- return _chunkTKSTXX3Djs.__spreadValues.call(void 0, {
3394
+ return _chunkCLTKABMOjs.__spreadValues.call(void 0, {
3372
3395
  index: entry.index,
3373
3396
  entry: entry.entry,
3374
3397
  duration: entry.duration,
@@ -3403,9 +3426,9 @@ var Experiment = class _Experiment {
3403
3426
  };
3404
3427
  this.pendingFlush = fetch(`${this.endpoint}/api/evaluations/batch/log_results`, {
3405
3428
  method: "POST",
3406
- headers: _chunkTKSTXX3Djs.__spreadValues.call(void 0, {
3429
+ headers: _chunkCLTKABMOjs.__spreadValues.call(void 0, {
3407
3430
  "Content-Type": "application/json"
3408
- }, _chunkWHBCX64Rjs.buildAuthHeaders.call(void 0, { apiKey: this.apiKey })),
3431
+ }, _chunkUOFSG6R4js.buildAuthHeaders.call(void 0, { apiKey: this.apiKey })),
3409
3432
  body: JSON.stringify(body)
3410
3433
  }).then((response) => {
3411
3434
  if (!response.ok) {
@@ -3522,7 +3545,7 @@ var ExperimentsApiService = class {
3522
3545
  }) {
3523
3546
  let result;
3524
3547
  try {
3525
- result = await this.apiClient.POST(path2, _chunkTKSTXX3Djs.__spreadProps.call(void 0, _chunkTKSTXX3Djs.__spreadValues.call(void 0, {}, body !== void 0 ? { body } : {}), {
3548
+ result = await this.apiClient.POST(path2, _chunkCLTKABMOjs.__spreadProps.call(void 0, _chunkCLTKABMOjs.__spreadValues.call(void 0, {}, body !== void 0 ? { body } : {}), {
3526
3549
  parseAs: "json"
3527
3550
  }));
3528
3551
  } catch (error) {
@@ -3821,7 +3844,7 @@ var mapRunResultsToRows = (response) => {
3821
3844
  const output = predicted && typeof predicted === "object" && "output" in predicted ? predicted.output : predicted;
3822
3845
  const row = {
3823
3846
  index: (_a2 = entry.index) != null ? _a2 : 0,
3824
- input: _chunkTKSTXX3Djs.__spreadValues.call(void 0, {}, entryData),
3847
+ input: _chunkCLTKABMOjs.__spreadValues.call(void 0, {}, entryData),
3825
3848
  output,
3826
3849
  traceId: (_b2 = entry.traceId) != null ? _b2 : "",
3827
3850
  evaluations: {}
@@ -3881,7 +3904,7 @@ var ExperimentsFacade = class {
3881
3904
  * ```
3882
3905
  */
3883
3906
  async init(name, options) {
3884
- return Experiment.init(name, _chunkTKSTXX3Djs.__spreadValues.call(void 0, {
3907
+ return Experiment.init(name, _chunkCLTKABMOjs.__spreadValues.call(void 0, {
3885
3908
  apiClient: this.config.langwatchApiClient,
3886
3909
  endpoint: this.config.endpoint,
3887
3910
  apiKey: this.config.apiKey,
@@ -4206,9 +4229,9 @@ var EvaluationsApiError = class extends EvaluationError {
4206
4229
  var _endpoint, _apiKey, _logger;
4207
4230
  var EvaluationsFacade = class {
4208
4231
  constructor(config) {
4209
- _chunkTKSTXX3Djs.__privateAdd.call(void 0, this, _endpoint);
4210
- _chunkTKSTXX3Djs.__privateAdd.call(void 0, this, _apiKey);
4211
- _chunkTKSTXX3Djs.__privateAdd.call(void 0, this, _logger);
4232
+ _chunkCLTKABMOjs.__privateAdd.call(void 0, this, _endpoint);
4233
+ _chunkCLTKABMOjs.__privateAdd.call(void 0, this, _apiKey);
4234
+ _chunkCLTKABMOjs.__privateAdd.call(void 0, this, _logger);
4212
4235
  /**
4213
4236
  * Run an evaluator or guardrail against provided data
4214
4237
  *
@@ -4265,9 +4288,9 @@ var EvaluationsFacade = class {
4265
4288
  },
4266
4289
  _api.context.active()
4267
4290
  );
4268
- const langwatchSpan = _chunkADJOFPAZjs.createLangWatchSpan.call(void 0, otelSpan);
4291
+ const langwatchSpan = _chunkK6KPNTQOjs.createLangWatchSpan.call(void 0, otelSpan);
4269
4292
  langwatchSpan.setType(spanType);
4270
- langwatchSpan.setInput(_chunkTKSTXX3Djs.__spreadValues.call(void 0, {
4293
+ langwatchSpan.setInput(_chunkCLTKABMOjs.__spreadValues.call(void 0, {
4271
4294
  data
4272
4295
  }, settings && { settings }));
4273
4296
  try {
@@ -4279,13 +4302,13 @@ var EvaluationsFacade = class {
4279
4302
  settings,
4280
4303
  as_guardrail: asGuardrail
4281
4304
  };
4282
- const url = `${_chunkTKSTXX3Djs.__privateGet.call(void 0, this, _endpoint)}/api/evaluations/${slug}/evaluate`;
4283
- _chunkTKSTXX3Djs.__privateGet.call(void 0, this, _logger).debug(`Calling evaluation API: ${url}`);
4305
+ const url = `${_chunkCLTKABMOjs.__privateGet.call(void 0, this, _endpoint)}/api/evaluations/${slug}/evaluate`;
4306
+ _chunkCLTKABMOjs.__privateGet.call(void 0, this, _logger).debug(`Calling evaluation API: ${url}`);
4284
4307
  const response = await fetch(url, {
4285
4308
  method: "POST",
4286
- headers: _chunkTKSTXX3Djs.__spreadValues.call(void 0, {
4309
+ headers: _chunkCLTKABMOjs.__spreadValues.call(void 0, {
4287
4310
  "Content-Type": "application/json"
4288
- }, _chunkWHBCX64Rjs.buildAuthHeaders.call(void 0, { apiKey: _chunkTKSTXX3Djs.__privateGet.call(void 0, this, _apiKey) })),
4311
+ }, _chunkUOFSG6R4js.buildAuthHeaders.call(void 0, { apiKey: _chunkCLTKABMOjs.__privateGet.call(void 0, this, _apiKey) })),
4289
4312
  body: JSON.stringify(requestBody)
4290
4313
  });
4291
4314
  if (!response.ok) {
@@ -4299,7 +4322,7 @@ var EvaluationsFacade = class {
4299
4322
  );
4300
4323
  }
4301
4324
  const responseData = await response.json();
4302
- const result = _chunkTKSTXX3Djs.__spreadValues.call(void 0, _chunkTKSTXX3Djs.__spreadValues.call(void 0, _chunkTKSTXX3Djs.__spreadValues.call(void 0, _chunkTKSTXX3Djs.__spreadValues.call(void 0, _chunkTKSTXX3Djs.__spreadValues.call(void 0, {
4325
+ const result = _chunkCLTKABMOjs.__spreadValues.call(void 0, _chunkCLTKABMOjs.__spreadValues.call(void 0, _chunkCLTKABMOjs.__spreadValues.call(void 0, _chunkCLTKABMOjs.__spreadValues.call(void 0, _chunkCLTKABMOjs.__spreadValues.call(void 0, {
4303
4326
  status: responseData.status
4304
4327
  }, responseData.passed !== null && responseData.passed !== void 0 && { passed: responseData.passed }), responseData.score !== null && responseData.score !== void 0 && { score: responseData.score }), responseData.details !== null && responseData.details !== void 0 && { details: responseData.details }), responseData.label !== null && responseData.label !== void 0 && { label: responseData.label }), responseData.cost !== null && responseData.cost !== void 0 && { cost: responseData.cost });
4305
4328
  langwatchSpan.setOutput({
@@ -4345,9 +4368,9 @@ var EvaluationsFacade = class {
4345
4368
  otelSpan.end();
4346
4369
  }
4347
4370
  };
4348
- _chunkTKSTXX3Djs.__privateSet.call(void 0, this, _endpoint, config.endpoint);
4349
- _chunkTKSTXX3Djs.__privateSet.call(void 0, this, _apiKey, config.apiKey);
4350
- _chunkTKSTXX3Djs.__privateSet.call(void 0, this, _logger, config.logger);
4371
+ _chunkCLTKABMOjs.__privateSet.call(void 0, this, _endpoint, config.endpoint);
4372
+ _chunkCLTKABMOjs.__privateSet.call(void 0, this, _apiKey, config.apiKey);
4373
+ _chunkCLTKABMOjs.__privateSet.call(void 0, this, _logger, config.logger);
4351
4374
  }
4352
4375
  };
4353
4376
  _endpoint = new WeakMap();
@@ -4590,9 +4613,9 @@ var WorkflowsApiError = class extends Error {
4590
4613
  };
4591
4614
  var WorkflowsApiService = class {
4592
4615
  constructor(config) {
4593
- var _a, _b, _c;
4594
- this.apiClient = (_a = config == null ? void 0 : config.langwatchApiClient) != null ? _a : createLangWatchApiClient();
4595
- this.endpoint = (_c = (_b = config == null ? void 0 : config.endpoint) != null ? _b : process.env.LANGWATCH_ENDPOINT) != null ? _c : "https://app.langwatch.ai";
4616
+ var _a;
4617
+ this.endpoint = _chunkDTSULVK5js.resolveEndpoint.call(void 0, config == null ? void 0 : config.endpoint);
4618
+ this.apiClient = (_a = config == null ? void 0 : config.langwatchApiClient) != null ? _a : createLangWatchApiClient(void 0, this.endpoint);
4596
4619
  this.experimentsApiService = new ExperimentsApiService({
4597
4620
  langwatchApiClient: this.apiClient
4598
4621
  });
@@ -4610,7 +4633,7 @@ var WorkflowsApiService = class {
4610
4633
  }) {
4611
4634
  let result;
4612
4635
  try {
4613
- result = await this.apiClient.POST(path2, _chunkTKSTXX3Djs.__spreadProps.call(void 0, _chunkTKSTXX3Djs.__spreadValues.call(void 0, {}, body !== void 0 ? { body } : {}), {
4636
+ result = await this.apiClient.POST(path2, _chunkCLTKABMOjs.__spreadProps.call(void 0, _chunkCLTKABMOjs.__spreadValues.call(void 0, {}, body !== void 0 ? { body } : {}), {
4614
4637
  parseAs: "json"
4615
4638
  }));
4616
4639
  } catch (error) {
@@ -5149,14 +5172,14 @@ var MonitorsApiError = class extends Error {
5149
5172
  };
5150
5173
  var MonitorsApiService = class {
5151
5174
  constructor(config) {
5152
- var _a, _b, _c, _d;
5153
- this.apiKey = (_b = (_a = config == null ? void 0 : config.apiKey) != null ? _a : process.env.LANGWATCH_API_KEY) != null ? _b : "";
5154
- this.endpoint = (_d = (_c = config == null ? void 0 : config.endpoint) != null ? _c : process.env.LANGWATCH_ENDPOINT) != null ? _d : _chunkWHBCX64Rjs.DEFAULT_ENDPOINT;
5175
+ var _a, _b, _c;
5176
+ this.apiKey = (_c = (_b = (_a = config == null ? void 0 : config.apiKey) != null ? _a : scopedApiKey()) != null ? _b : process.env.LANGWATCH_API_KEY) != null ? _c : "";
5177
+ this.endpoint = _chunkDTSULVK5js.resolveEndpoint.call(void 0, config == null ? void 0 : config.endpoint);
5155
5178
  }
5156
5179
  async request(path2, options) {
5157
5180
  var _a, _b;
5158
- const response = await fetch(`${this.endpoint}${path2}`, _chunkTKSTXX3Djs.__spreadProps.call(void 0, _chunkTKSTXX3Djs.__spreadValues.call(void 0, {}, options), {
5159
- headers: _chunkTKSTXX3Djs.__spreadValues.call(void 0, _chunkTKSTXX3Djs.__spreadProps.call(void 0, _chunkTKSTXX3Djs.__spreadValues.call(void 0, {}, _chunkWHBCX64Rjs.buildAuthHeaders.call(void 0, { apiKey: this.apiKey })), {
5181
+ const response = await fetch(`${this.endpoint}${path2}`, _chunkCLTKABMOjs.__spreadProps.call(void 0, _chunkCLTKABMOjs.__spreadValues.call(void 0, {}, options), {
5182
+ headers: _chunkCLTKABMOjs.__spreadValues.call(void 0, _chunkCLTKABMOjs.__spreadProps.call(void 0, _chunkCLTKABMOjs.__spreadValues.call(void 0, {}, _chunkUOFSG6R4js.buildAuthHeaders.call(void 0, { apiKey: this.apiKey })), {
5160
5183
  "Content-Type": "application/json"
5161
5184
  }), options == null ? void 0 : options.headers)
5162
5185
  }));
@@ -5224,14 +5247,14 @@ var SecretsApiError = class extends Error {
5224
5247
  };
5225
5248
  var SecretsApiService = class {
5226
5249
  constructor(config) {
5227
- var _a, _b, _c, _d;
5228
- this.apiKey = (_b = (_a = config == null ? void 0 : config.apiKey) != null ? _a : process.env.LANGWATCH_API_KEY) != null ? _b : "";
5229
- this.endpoint = (_d = (_c = config == null ? void 0 : config.endpoint) != null ? _c : process.env.LANGWATCH_ENDPOINT) != null ? _d : _chunkWHBCX64Rjs.DEFAULT_ENDPOINT;
5250
+ var _a, _b, _c;
5251
+ this.apiKey = (_c = (_b = (_a = config == null ? void 0 : config.apiKey) != null ? _a : scopedApiKey()) != null ? _b : process.env.LANGWATCH_API_KEY) != null ? _c : "";
5252
+ this.endpoint = _chunkDTSULVK5js.resolveEndpoint.call(void 0, config == null ? void 0 : config.endpoint);
5230
5253
  }
5231
5254
  async request(path2, options) {
5232
5255
  var _a, _b;
5233
- const response = await fetch(`${this.endpoint}${path2}`, _chunkTKSTXX3Djs.__spreadProps.call(void 0, _chunkTKSTXX3Djs.__spreadValues.call(void 0, {}, options), {
5234
- headers: _chunkTKSTXX3Djs.__spreadValues.call(void 0, _chunkTKSTXX3Djs.__spreadProps.call(void 0, _chunkTKSTXX3Djs.__spreadValues.call(void 0, {}, _chunkWHBCX64Rjs.buildAuthHeaders.call(void 0, { apiKey: this.apiKey })), {
5256
+ const response = await fetch(`${this.endpoint}${path2}`, _chunkCLTKABMOjs.__spreadProps.call(void 0, _chunkCLTKABMOjs.__spreadValues.call(void 0, {}, options), {
5257
+ headers: _chunkCLTKABMOjs.__spreadValues.call(void 0, _chunkCLTKABMOjs.__spreadProps.call(void 0, _chunkCLTKABMOjs.__spreadValues.call(void 0, {}, _chunkUOFSG6R4js.buildAuthHeaders.call(void 0, { apiKey: this.apiKey })), {
5235
5258
  "Content-Type": "application/json"
5236
5259
  }), options == null ? void 0 : options.headers)
5237
5260
  }));
@@ -5282,6 +5305,1003 @@ var SecretsApiService = class {
5282
5305
  }
5283
5306
  };
5284
5307
 
5308
+ // src/client-sdk/services/_shared/collect-cursor-pages.ts
5309
+ var CURSOR_WALK_PAGE_SIZE = 200;
5310
+ var MAX_CURSOR_WALK_PAGES = 1e3;
5311
+ function walkCursorPages(options) {
5312
+ return _chunkCLTKABMOjs.__asyncGenerator.call(void 0, this, null, function* () {
5313
+ var _a;
5314
+ const served = /* @__PURE__ */ new Set();
5315
+ let cursor = options.startCursor;
5316
+ let pagesRead = 0;
5317
+ for (; ; ) {
5318
+ const page = yield new (0, _chunkCLTKABMOjs.__await)(options.fetchPage(cursor));
5319
+ pagesRead += 1;
5320
+ yield page;
5321
+ const next = (_a = options.nextCursorOf(page)) != null ? _a : null;
5322
+ if (next === null) return;
5323
+ if (served.has(next)) {
5324
+ throw options.onEndlessWalk(
5325
+ "the endpoint served the same page cursor twice, so the walk cannot advance"
5326
+ );
5327
+ }
5328
+ if (pagesRead >= MAX_CURSOR_WALK_PAGES) {
5329
+ throw options.onEndlessWalk(
5330
+ `the walk passed ${MAX_CURSOR_WALK_PAGES} pages without the cursor coming back null`
5331
+ );
5332
+ }
5333
+ served.add(next);
5334
+ cursor = next;
5335
+ }
5336
+ });
5337
+ }
5338
+ async function collectCursorPages(options) {
5339
+ const pages = [];
5340
+ try {
5341
+ for (var iter = _chunkCLTKABMOjs.__forAwait.call(void 0, walkCursorPages(options)), more, temp, error; more = !(temp = await iter.next()).done; more = false) {
5342
+ const page = temp.value;
5343
+ pages.push(page);
5344
+ }
5345
+ } catch (temp) {
5346
+ error = [temp];
5347
+ } finally {
5348
+ try {
5349
+ more && (temp = iter.return) && await temp.call(iter);
5350
+ } finally {
5351
+ if (error)
5352
+ throw error[0];
5353
+ }
5354
+ }
5355
+ return pages;
5356
+ }
5357
+
5358
+ // src/client-sdk/services/_shared/mutation-options.ts
5359
+ var IDEMPOTENCY_KEY_HEADER = "Idempotency-Key";
5360
+ var IDEMPOTENT_REPLAY_HEADER = "X-Idempotent-Replay";
5361
+ function mutationInit(options) {
5362
+ return (options == null ? void 0 : options.signal) ? { signal: options.signal } : {};
5363
+ }
5364
+ function idempotentCreateInit(options) {
5365
+ const onIdempotentReplay = options == null ? void 0 : options.onIdempotentReplay;
5366
+ return _chunkCLTKABMOjs.__spreadValues.call(void 0, _chunkCLTKABMOjs.__spreadValues.call(void 0, _chunkCLTKABMOjs.__spreadValues.call(void 0, {}, mutationInit(options)), (options == null ? void 0 : options.idempotencyKey) !== void 0 ? { headers: { [IDEMPOTENCY_KEY_HEADER]: options.idempotencyKey } } : {}), onIdempotentReplay ? {
5367
+ onResponse: (response) => {
5368
+ if (response.headers.get(IDEMPOTENT_REPLAY_HEADER) === "true") {
5369
+ onIdempotentReplay();
5370
+ }
5371
+ }
5372
+ } : {});
5373
+ }
5374
+
5375
+ // src/client-sdk/services/virtual-keys/virtual-keys-api.service.ts
5376
+ var VirtualKeysApiError = class extends Error {
5377
+ constructor(message, operation, originalError) {
5378
+ super(message);
5379
+ this.operation = operation;
5380
+ this.originalError = originalError;
5381
+ this.name = "VirtualKeysApiError";
5382
+ }
5383
+ };
5384
+ var VirtualKeysApiService = class {
5385
+ constructor(config) {
5386
+ var _a, _b, _c, _d;
5387
+ this.endpoint = _chunkDTSULVK5js.resolveEndpoint.call(void 0, config == null ? void 0 : config.endpoint);
5388
+ this.apiKey = (_c = (_b = (_a = config == null ? void 0 : config.apiKey) != null ? _a : scopedApiKey()) != null ? _b : process.env.LANGWATCH_API_KEY) != null ? _c : "";
5389
+ this.projectId = (_d = config == null ? void 0 : config.projectId) != null ? _d : process.env.LANGWATCH_PROJECT_ID;
5390
+ }
5391
+ headers() {
5392
+ return _chunkCLTKABMOjs.__spreadValues.call(void 0, {
5393
+ Authorization: `Bearer ${this.apiKey}`,
5394
+ "Content-Type": "application/json"
5395
+ }, this.projectId ? { "X-Project-Id": this.projectId } : {});
5396
+ }
5397
+ async request(operation, path2, init) {
5398
+ var _a, _b, _c;
5399
+ const response = await fetch(`${this.endpoint}${path2}`, _chunkCLTKABMOjs.__spreadProps.call(void 0, _chunkCLTKABMOjs.__spreadValues.call(void 0, {}, init), {
5400
+ // A hung control plane must fail the command, not freeze it.
5401
+ signal: (_a = init == null ? void 0 : init.signal) != null ? _a : AbortSignal.timeout(3e4),
5402
+ headers: _chunkCLTKABMOjs.__spreadValues.call(void 0, _chunkCLTKABMOjs.__spreadValues.call(void 0, {}, this.headers()), (_b = init == null ? void 0 : init.headers) != null ? _b : {})
5403
+ }));
5404
+ if (!response.ok) {
5405
+ let parsedBody;
5406
+ try {
5407
+ parsedBody = await response.json();
5408
+ } catch (e) {
5409
+ parsedBody = await response.text();
5410
+ }
5411
+ const message = formatApiErrorForOperation({
5412
+ operation,
5413
+ error: parsedBody,
5414
+ options: { status: response.status }
5415
+ });
5416
+ throwIfHandledError({
5417
+ operation,
5418
+ error: parsedBody,
5419
+ status: response.status,
5420
+ message
5421
+ });
5422
+ throw new VirtualKeysApiError(message, operation, parsedBody);
5423
+ }
5424
+ (_c = init == null ? void 0 : init.onResponse) == null ? void 0 : _c.call(init, response);
5425
+ return await response.json();
5426
+ }
5427
+ /**
5428
+ * ONE page of the virtual keys visible to the caller, newest first. Pass
5429
+ * `next_cursor` back as `cursor` for the next page, verbatim: a cursor this
5430
+ * endpoint did not issue answers 400 rather than restarting the walk.
5431
+ *
5432
+ * `limit` is the page size (server default 50, capped at 200), and it caps
5433
+ * the rows READ, not the rows returned: the visibility filter runs on the
5434
+ * page afterwards. Prefer `list()` unless you mean to page deliberately.
5435
+ */
5436
+ async listPage(options) {
5437
+ const params = new URLSearchParams();
5438
+ if (options == null ? void 0 : options.externalId) params.set("external_id", options.externalId);
5439
+ if (options == null ? void 0 : options.cursor) params.set("cursor", options.cursor);
5440
+ if ((options == null ? void 0 : options.limit) !== void 0) params.set("limit", String(options.limit));
5441
+ const query = params.toString() !== "" ? `?${params.toString()}` : "";
5442
+ const { data, next_cursor } = await this.request("list virtual keys", `/api/gateway/v1/virtual-keys${query}`);
5443
+ return { data, next_cursor: next_cursor != null ? next_cursor : null };
5444
+ }
5445
+ /**
5446
+ * Every virtual key visible to the caller: keys scoped to this project, to
5447
+ * its team, or to the whole organization.
5448
+ *
5449
+ * The endpoint pages; this follows `next_cursor` until it comes back null.
5450
+ * Stopping on a short page would be wrong here specifically, because the
5451
+ * server filters each page for visibility after reading it, so a page can
5452
+ * hold fewer rows than the limit with more still to come.
5453
+ *
5454
+ * `limit` sizes each request in the walk, it does NOT cap what comes back.
5455
+ * `cursor` resumes an interrupted walk. Take a single page with
5456
+ * `listPage()`, or stream the walk with `iterate()`.
5457
+ */
5458
+ async list(options) {
5459
+ const pages = await collectCursorPages({
5460
+ startCursor: options == null ? void 0 : options.cursor,
5461
+ nextCursorOf: (page) => page.next_cursor,
5462
+ onEndlessWalk: (reason) => new VirtualKeysApiError(
5463
+ `Failed to list virtual keys: ${reason}.`,
5464
+ "list virtual keys"
5465
+ ),
5466
+ fetchPage: (cursor) => {
5467
+ var _a;
5468
+ return this.listPage({
5469
+ cursor,
5470
+ limit: (_a = options == null ? void 0 : options.limit) != null ? _a : CURSOR_WALK_PAGE_SIZE,
5471
+ externalId: options == null ? void 0 : options.externalId
5472
+ });
5473
+ }
5474
+ });
5475
+ return pages.flatMap((page) => page.data);
5476
+ }
5477
+ /**
5478
+ * Every visible virtual key, one row at a time, fetching each page only
5479
+ * when the consumer reaches it. Stop early and the rest is never read,
5480
+ * which `list()` cannot offer because it materialises the whole listing
5481
+ * first. Raises rather than looping forever on a cursor chain that never
5482
+ * ends, exactly like `list()`.
5483
+ */
5484
+ iterate(options) {
5485
+ return _chunkCLTKABMOjs.__asyncGenerator.call(void 0, this, null, function* () {
5486
+ const pages = walkCursorPages({
5487
+ startCursor: options == null ? void 0 : options.cursor,
5488
+ nextCursorOf: (page) => page.next_cursor,
5489
+ onEndlessWalk: (reason) => new VirtualKeysApiError(
5490
+ `Failed to list virtual keys: ${reason}.`,
5491
+ "list virtual keys"
5492
+ ),
5493
+ fetchPage: (cursor) => {
5494
+ var _a;
5495
+ return this.listPage({
5496
+ cursor,
5497
+ limit: (_a = options == null ? void 0 : options.limit) != null ? _a : CURSOR_WALK_PAGE_SIZE,
5498
+ externalId: options == null ? void 0 : options.externalId
5499
+ });
5500
+ }
5501
+ });
5502
+ try {
5503
+ for (var iter = _chunkCLTKABMOjs.__forAwait.call(void 0, pages), more, temp, error; more = !(temp = yield new (0, _chunkCLTKABMOjs.__await)(iter.next())).done; more = false) {
5504
+ const page = temp.value;
5505
+ yield* _chunkCLTKABMOjs.__yieldStar.call(void 0, page.data);
5506
+ }
5507
+ } catch (temp) {
5508
+ error = [temp];
5509
+ } finally {
5510
+ try {
5511
+ more && (temp = iter.return) && (yield new (0, _chunkCLTKABMOjs.__await)(temp.call(iter)));
5512
+ } finally {
5513
+ if (error)
5514
+ throw error[0];
5515
+ }
5516
+ }
5517
+ });
5518
+ }
5519
+ async get(id) {
5520
+ const { virtual_key } = await this.request(
5521
+ `get virtual key "${id}"`,
5522
+ `/api/gateway/v1/virtual-keys/${encodeURIComponent(id)}`
5523
+ );
5524
+ return virtual_key;
5525
+ }
5526
+ /**
5527
+ * Mint a key. The response carries the secret ONCE; nothing ever serves it
5528
+ * again, so a create that times out is recovered with `idempotencyKey`
5529
+ * rather than by listing.
5530
+ */
5531
+ async create(input, options) {
5532
+ return this.request(
5533
+ "create virtual key",
5534
+ "/api/gateway/v1/virtual-keys",
5535
+ _chunkCLTKABMOjs.__spreadValues.call(void 0, {
5536
+ method: "POST",
5537
+ body: JSON.stringify(input)
5538
+ }, idempotentCreateInit(options))
5539
+ );
5540
+ }
5541
+ async update(id, input, options) {
5542
+ const { virtual_key } = await this.request(
5543
+ `update virtual key "${id}"`,
5544
+ `/api/gateway/v1/virtual-keys/${encodeURIComponent(id)}`,
5545
+ _chunkCLTKABMOjs.__spreadValues.call(void 0, { method: "PATCH", body: JSON.stringify(input) }, mutationInit(options))
5546
+ );
5547
+ return virtual_key;
5548
+ }
5549
+ async rotate(id, options) {
5550
+ return this.request(
5551
+ `rotate virtual key "${id}"`,
5552
+ `/api/gateway/v1/virtual-keys/${encodeURIComponent(id)}/rotate`,
5553
+ _chunkCLTKABMOjs.__spreadValues.call(void 0, { method: "POST" }, mutationInit(options))
5554
+ );
5555
+ }
5556
+ async revoke(id, options) {
5557
+ const { virtual_key } = await this.request(
5558
+ `revoke virtual key "${id}"`,
5559
+ `/api/gateway/v1/virtual-keys/${encodeURIComponent(id)}/revoke`,
5560
+ _chunkCLTKABMOjs.__spreadValues.call(void 0, { method: "POST" }, mutationInit(options))
5561
+ );
5562
+ return virtual_key;
5563
+ }
5564
+ /** Reversible stop; enable() restores the key exactly as it was. */
5565
+ async disable(id, options = {}) {
5566
+ const { virtual_key } = await this.request(
5567
+ `disable virtual key "${id}"`,
5568
+ `/api/gateway/v1/virtual-keys/${encodeURIComponent(id)}/disable`,
5569
+ _chunkCLTKABMOjs.__spreadValues.call(void 0, {
5570
+ method: "POST",
5571
+ headers: { "Content-Type": "application/json" },
5572
+ body: JSON.stringify(options.reason ? { reason: options.reason } : {})
5573
+ }, mutationInit(options))
5574
+ );
5575
+ return virtual_key;
5576
+ }
5577
+ async enable(id, options) {
5578
+ const { virtual_key } = await this.request(
5579
+ `enable virtual key "${id}"`,
5580
+ `/api/gateway/v1/virtual-keys/${encodeURIComponent(id)}/enable`,
5581
+ _chunkCLTKABMOjs.__spreadValues.call(void 0, { method: "POST" }, mutationInit(options))
5582
+ );
5583
+ return virtual_key;
5584
+ }
5585
+ /**
5586
+ * Aggregate spend for one key over a window in epoch milliseconds.
5587
+ * Defaults to the current UTC calendar month server-side. Reads the same
5588
+ * cost path the dashboard reads, so this number and the UI agree by
5589
+ * construction.
5590
+ */
5591
+ async spend(id, options) {
5592
+ const params = new URLSearchParams();
5593
+ if ((options == null ? void 0 : options.from) !== void 0) params.set("from", String(options.from));
5594
+ if ((options == null ? void 0 : options.to) !== void 0) params.set("to", String(options.to));
5595
+ const query = params.size > 0 ? `?${params.toString()}` : "";
5596
+ return this.request(
5597
+ `read virtual key spend "${id}"`,
5598
+ `/api/gateway/v1/virtual-keys/${encodeURIComponent(id)}/spend${query}`
5599
+ );
5600
+ }
5601
+ };
5602
+
5603
+ // src/client-sdk/services/gateway-budgets/gateway-budgets-api.service.ts
5604
+ var GatewayBudgetsApiError = class extends Error {
5605
+ constructor(message, operation, originalError) {
5606
+ super(message);
5607
+ this.operation = operation;
5608
+ this.originalError = originalError;
5609
+ this.name = "GatewayBudgetsApiError";
5610
+ }
5611
+ };
5612
+ var GatewayBudgetsApiService = class {
5613
+ constructor(config) {
5614
+ var _a, _b, _c, _d;
5615
+ this.endpoint = _chunkDTSULVK5js.resolveEndpoint.call(void 0, config == null ? void 0 : config.endpoint);
5616
+ this.apiKey = (_c = (_b = (_a = config == null ? void 0 : config.apiKey) != null ? _a : scopedApiKey()) != null ? _b : process.env.LANGWATCH_API_KEY) != null ? _c : "";
5617
+ this.projectId = (_d = config == null ? void 0 : config.projectId) != null ? _d : process.env.LANGWATCH_PROJECT_ID;
5618
+ }
5619
+ headers() {
5620
+ return _chunkCLTKABMOjs.__spreadValues.call(void 0, {
5621
+ Authorization: `Bearer ${this.apiKey}`,
5622
+ "Content-Type": "application/json"
5623
+ }, this.projectId ? { "X-Project-Id": this.projectId } : {});
5624
+ }
5625
+ async request(operation, path2, init) {
5626
+ var _a, _b, _c;
5627
+ const response = await fetch(`${this.endpoint}${path2}`, _chunkCLTKABMOjs.__spreadProps.call(void 0, _chunkCLTKABMOjs.__spreadValues.call(void 0, {}, init), {
5628
+ // A hung control plane must fail the command, not freeze it.
5629
+ signal: (_a = init == null ? void 0 : init.signal) != null ? _a : AbortSignal.timeout(3e4),
5630
+ headers: _chunkCLTKABMOjs.__spreadValues.call(void 0, _chunkCLTKABMOjs.__spreadValues.call(void 0, {}, this.headers()), (_b = init == null ? void 0 : init.headers) != null ? _b : {})
5631
+ }));
5632
+ if (!response.ok) {
5633
+ let parsedBody;
5634
+ try {
5635
+ parsedBody = await response.json();
5636
+ } catch (e) {
5637
+ parsedBody = await response.text();
5638
+ }
5639
+ const message = formatApiErrorForOperation({
5640
+ operation,
5641
+ error: parsedBody,
5642
+ options: { status: response.status }
5643
+ });
5644
+ throwIfHandledError({
5645
+ operation,
5646
+ error: parsedBody,
5647
+ status: response.status,
5648
+ message
5649
+ });
5650
+ throw new GatewayBudgetsApiError(message, operation, parsedBody);
5651
+ }
5652
+ (_c = init == null ? void 0 : init.onResponse) == null ? void 0 : _c.call(init, response);
5653
+ return await response.json();
5654
+ }
5655
+ /**
5656
+ * ONE page of non-archived budgets, exactly as the wire serves it. Pass
5657
+ * `next_cursor` back as `cursor` for the next page, verbatim: a cursor this
5658
+ * endpoint did not issue answers 400 rather than restarting the walk.
5659
+ *
5660
+ * `limit` is the page size (server default 50, capped at 200). Prefer
5661
+ * `list()` unless you mean to page deliberately: a full page is not a
5662
+ * promise of more, and a null `next_cursor` is the only end of the walk.
5663
+ */
5664
+ async listPage(options) {
5665
+ var _a;
5666
+ const params = new URLSearchParams();
5667
+ if (options == null ? void 0 : options.externalId) params.set("external_id", options.externalId);
5668
+ if ((_a = options == null ? void 0 : options.scopeTypes) == null ? void 0 : _a.length) {
5669
+ params.set("scope_type", options.scopeTypes.join(","));
5670
+ }
5671
+ if (options == null ? void 0 : options.cursor) params.set("cursor", options.cursor);
5672
+ if ((options == null ? void 0 : options.limit) !== void 0) params.set("limit", String(options.limit));
5673
+ const query = params.toString() !== "" ? `?${params.toString()}` : "";
5674
+ const { data, spend_available, next_cursor } = await this.request("list gateway budgets", `/api/gateway/v1/budgets${query}`);
5675
+ return {
5676
+ data,
5677
+ spend_available,
5678
+ next_cursor: next_cursor != null ? next_cursor : null
5679
+ };
5680
+ }
5681
+ /**
5682
+ * Every non-archived budget in the organization across all seven scope
5683
+ * types, optionally filtered by `scopeTypes`.
5684
+ *
5685
+ * The endpoint pages; this follows `next_cursor` until it comes back null,
5686
+ * so the result is the complete listing and carries no cursor of its own.
5687
+ * Callers that count, total, or decide an all-clear on this list need that
5688
+ * completeness for correctness, not just for display.
5689
+ *
5690
+ * `limit` sizes each request in the walk, it does NOT cap what comes back.
5691
+ * `cursor` resumes an interrupted walk. Take a single page with
5692
+ * `listPage()`, or stream the walk with `iterate()`.
5693
+ *
5694
+ * A plain array, like every other exhaustive `list()` in the SDK: a walk
5695
+ * that ran to the end has no cursor left to report. Null `spent_usd` /
5696
+ * `spent_nano_usd` on a row is not by itself "spend unavailable": an
5697
+ * `attributed_user` template row serves null deliberately, because one
5698
+ * allowance per person has no single total. Use `listPage()` when you need
5699
+ * `spend_available` stated outright.
5700
+ */
5701
+ async list(options) {
5702
+ const pages = await collectCursorPages({
5703
+ startCursor: options == null ? void 0 : options.cursor,
5704
+ nextCursorOf: (page) => page.next_cursor,
5705
+ onEndlessWalk: (reason) => new GatewayBudgetsApiError(
5706
+ `Failed to list gateway budgets: ${reason}.`,
5707
+ "list gateway budgets"
5708
+ ),
5709
+ fetchPage: (cursor) => {
5710
+ var _a;
5711
+ return this.listPage({
5712
+ scopeTypes: options == null ? void 0 : options.scopeTypes,
5713
+ cursor,
5714
+ limit: (_a = options == null ? void 0 : options.limit) != null ? _a : CURSOR_WALK_PAGE_SIZE,
5715
+ externalId: options == null ? void 0 : options.externalId
5716
+ });
5717
+ }
5718
+ });
5719
+ return pages.flatMap((page) => page.data);
5720
+ }
5721
+ /**
5722
+ * Every non-archived budget, one row at a time, fetching each page only
5723
+ * when the consumer reaches it.
5724
+ *
5725
+ * A null `spent_usd` means spend could not be totalled rather than that
5726
+ * nothing was spent.
5727
+ */
5728
+ iterate(options) {
5729
+ return _chunkCLTKABMOjs.__asyncGenerator.call(void 0, this, null, function* () {
5730
+ const pages = walkCursorPages({
5731
+ startCursor: options == null ? void 0 : options.cursor,
5732
+ nextCursorOf: (page) => page.next_cursor,
5733
+ onEndlessWalk: (reason) => new GatewayBudgetsApiError(
5734
+ `Failed to list gateway budgets: ${reason}.`,
5735
+ "list gateway budgets"
5736
+ ),
5737
+ fetchPage: (cursor) => {
5738
+ var _a;
5739
+ return this.listPage({
5740
+ scopeTypes: options == null ? void 0 : options.scopeTypes,
5741
+ cursor,
5742
+ limit: (_a = options == null ? void 0 : options.limit) != null ? _a : CURSOR_WALK_PAGE_SIZE,
5743
+ externalId: options == null ? void 0 : options.externalId
5744
+ });
5745
+ }
5746
+ });
5747
+ try {
5748
+ for (var iter = _chunkCLTKABMOjs.__forAwait.call(void 0, pages), more, temp, error; more = !(temp = yield new (0, _chunkCLTKABMOjs.__await)(iter.next())).done; more = false) {
5749
+ const page = temp.value;
5750
+ yield* _chunkCLTKABMOjs.__yieldStar.call(void 0, page.data);
5751
+ }
5752
+ } catch (temp) {
5753
+ error = [temp];
5754
+ } finally {
5755
+ try {
5756
+ more && (temp = iter.return) && (yield new (0, _chunkCLTKABMOjs.__await)(temp.call(iter)));
5757
+ } finally {
5758
+ if (error)
5759
+ throw error[0];
5760
+ }
5761
+ }
5762
+ });
5763
+ }
5764
+ /**
5765
+ * One budget by id, in the same row shape the listing serves.
5766
+ *
5767
+ * Archived budgets are not served, so a budget that existed yesterday can
5768
+ * answer 404 today. A null `spent_usd` means spend could not be totalled
5769
+ * rather than that nothing was spent, which is the same signal the listing
5770
+ * carries as `spend_available`.
5771
+ */
5772
+ async get(id) {
5773
+ const { budget } = await this.request(
5774
+ `get gateway budget "${id}"`,
5775
+ `/api/gateway/v1/budgets/${encodeURIComponent(id)}`
5776
+ );
5777
+ return budget;
5778
+ }
5779
+ async create(input, options) {
5780
+ const { budget } = await this.request(
5781
+ "create gateway budget",
5782
+ "/api/gateway/v1/budgets",
5783
+ _chunkCLTKABMOjs.__spreadValues.call(void 0, {
5784
+ method: "POST",
5785
+ body: JSON.stringify(input)
5786
+ }, idempotentCreateInit(options))
5787
+ );
5788
+ return budget;
5789
+ }
5790
+ async update(id, input, options) {
5791
+ const { budget } = await this.request(
5792
+ `update gateway budget "${id}"`,
5793
+ `/api/gateway/v1/budgets/${encodeURIComponent(id)}`,
5794
+ _chunkCLTKABMOjs.__spreadValues.call(void 0, { method: "PATCH", body: JSON.stringify(input) }, mutationInit(options))
5795
+ );
5796
+ return budget;
5797
+ }
5798
+ async archive(id, options) {
5799
+ const { budget } = await this.request(
5800
+ `archive gateway budget "${id}"`,
5801
+ `/api/gateway/v1/budgets/${encodeURIComponent(id)}`,
5802
+ _chunkCLTKABMOjs.__spreadValues.call(void 0, { method: "DELETE" }, mutationInit(options))
5803
+ );
5804
+ return budget;
5805
+ }
5806
+ /**
5807
+ * Move the budget's period boundary to now. Recorded spend is never
5808
+ * mutated; with `endUserId` only that end-user bucket's boundary moves.
5809
+ */
5810
+ async reset(id, options = {}) {
5811
+ const query = options.endUserId ? `?end_user_id=${encodeURIComponent(options.endUserId)}` : "";
5812
+ const { budget } = await this.request(
5813
+ `reset gateway budget "${id}"`,
5814
+ `/api/gateway/v1/budgets/${encodeURIComponent(id)}/reset${query}`,
5815
+ _chunkCLTKABMOjs.__spreadValues.call(void 0, {
5816
+ method: "POST",
5817
+ headers: { "Content-Type": "application/json" },
5818
+ body: JSON.stringify(options.reason ? { reason: options.reason } : {})
5819
+ }, mutationInit(options))
5820
+ );
5821
+ return budget;
5822
+ }
5823
+ };
5824
+
5825
+ // src/client-sdk/services/spend-events/spend-events-api.service.ts
5826
+ var SpendEventsApiError = class extends Error {
5827
+ constructor(message, operation, originalError) {
5828
+ super(message);
5829
+ this.operation = operation;
5830
+ this.originalError = originalError;
5831
+ this.name = "SpendEventsApiError";
5832
+ }
5833
+ };
5834
+ var SpendEventsApiService = class {
5835
+ constructor(config) {
5836
+ var _a, _b, _c;
5837
+ this.endpoint = _chunkDTSULVK5js.resolveEndpoint.call(void 0, config == null ? void 0 : config.endpoint);
5838
+ this.apiKey = (_c = (_b = (_a = config == null ? void 0 : config.apiKey) != null ? _a : scopedApiKey()) != null ? _b : process.env.LANGWATCH_API_KEY) != null ? _c : "";
5839
+ }
5840
+ async request(operation, path2, init) {
5841
+ var _a, _b;
5842
+ const response = await fetch(`${this.endpoint}${path2}`, _chunkCLTKABMOjs.__spreadProps.call(void 0, _chunkCLTKABMOjs.__spreadValues.call(void 0, {}, init), {
5843
+ // A hung control plane must fail the command, not freeze it.
5844
+ signal: (_a = init == null ? void 0 : init.signal) != null ? _a : AbortSignal.timeout(3e4),
5845
+ headers: _chunkCLTKABMOjs.__spreadValues.call(void 0, {
5846
+ Authorization: `Bearer ${this.apiKey}`,
5847
+ "Content-Type": "application/json"
5848
+ }, (_b = init == null ? void 0 : init.headers) != null ? _b : {})
5849
+ }));
5850
+ if (!response.ok) {
5851
+ let parsedBody;
5852
+ try {
5853
+ parsedBody = await response.json();
5854
+ } catch (e) {
5855
+ parsedBody = await response.text();
5856
+ }
5857
+ const message = formatApiErrorForOperation({
5858
+ operation,
5859
+ error: parsedBody,
5860
+ options: { status: response.status }
5861
+ });
5862
+ throwIfHandledError({
5863
+ operation,
5864
+ error: parsedBody,
5865
+ status: response.status,
5866
+ message
5867
+ });
5868
+ throw new SpendEventsApiError(message, operation, parsedBody);
5869
+ }
5870
+ return await response.json();
5871
+ }
5872
+ /**
5873
+ * ONE page of the per-request spend ledger for a window. Pass `next_cursor`
5874
+ * back as `cursor` for the next page, verbatim.
5875
+ *
5876
+ * A full page does NOT mean there is more and a short page does NOT mean
5877
+ * there is no more: only a null cursor ends the walk. A reconciler that
5878
+ * stops on the first page silently under-counts the window, so read every
5879
+ * page or stream them with `iterate()`.
5880
+ */
5881
+ async listPage(options) {
5882
+ const params = new URLSearchParams();
5883
+ params.set("from", String(options.from));
5884
+ params.set("to", String(options.to));
5885
+ if (options.cursor) params.set("cursor", options.cursor);
5886
+ if (options.limit !== void 0) params.set("limit", String(options.limit));
5887
+ if (options.virtualKeyId) params.set("virtual_key_id", options.virtualKeyId);
5888
+ if (options.endUserId) params.set("end_user_id", options.endUserId);
5889
+ if (options.projectId) params.set("project_id", options.projectId);
5890
+ if (options.model) params.set("model", options.model);
5891
+ if (options.status) params.set("status", options.status);
5892
+ const qs = params.toString() !== "" ? `?${params.toString()}` : "";
5893
+ return await this.request(
5894
+ "list spend events",
5895
+ `/api/gateway/v1/spend-events${qs}`
5896
+ );
5897
+ }
5898
+ /**
5899
+ * Every spend event in the window, one row at a time, fetching each page
5900
+ * only when the consumer reaches it.
5901
+ *
5902
+ * This is how a reconciler reads a whole window without holding it: the
5903
+ * ledger is unbounded, so there is deliberately no eager `list()` to
5904
+ * collect it into an array. Raises rather than looping forever on a cursor
5905
+ * chain that never ends.
5906
+ */
5907
+ iterate(options) {
5908
+ return _chunkCLTKABMOjs.__asyncGenerator.call(void 0, this, null, function* () {
5909
+ const pages = walkCursorPages({
5910
+ startCursor: options.cursor,
5911
+ nextCursorOf: (page) => page.next_cursor,
5912
+ onEndlessWalk: (reason) => new SpendEventsApiError(
5913
+ `Failed to list spend events: ${reason}.`,
5914
+ "list spend events"
5915
+ ),
5916
+ fetchPage: (cursor) => {
5917
+ var _a;
5918
+ return this.listPage(_chunkCLTKABMOjs.__spreadProps.call(void 0, _chunkCLTKABMOjs.__spreadValues.call(void 0, {}, options), {
5919
+ cursor,
5920
+ limit: (_a = options.limit) != null ? _a : CURSOR_WALK_PAGE_SIZE
5921
+ }));
5922
+ }
5923
+ });
5924
+ try {
5925
+ for (var iter = _chunkCLTKABMOjs.__forAwait.call(void 0, pages), more, temp, error; more = !(temp = yield new (0, _chunkCLTKABMOjs.__await)(iter.next())).done; more = false) {
5926
+ const page = temp.value;
5927
+ yield* _chunkCLTKABMOjs.__yieldStar.call(void 0, page.data);
5928
+ }
5929
+ } catch (temp) {
5930
+ error = [temp];
5931
+ } finally {
5932
+ try {
5933
+ more && (temp = iter.return) && (yield new (0, _chunkCLTKABMOjs.__await)(temp.call(iter)));
5934
+ } finally {
5935
+ if (error)
5936
+ throw error[0];
5937
+ }
5938
+ }
5939
+ });
5940
+ }
5941
+ /**
5942
+ * ONE page of per-key spend rollups for a window, paged by group key
5943
+ * ascending.
5944
+ *
5945
+ * The page is a step of a walk, not a whole answer: follow `next_cursor`
5946
+ * until it comes back null, or stream the walk with `iterSummaries()`. A
5947
+ * reconciler that reads only the first page silently under-counts every
5948
+ * tenant past the limit.
5949
+ */
5950
+ async summariesPage(options) {
5951
+ const params = new URLSearchParams();
5952
+ params.set("group_by", options.groupBy);
5953
+ params.set("from", String(options.from));
5954
+ params.set("to", String(options.to));
5955
+ if (options.projectId) params.set("project_id", options.projectId);
5956
+ if (options.virtualKeyId)
5957
+ params.set("virtual_key_id", options.virtualKeyId);
5958
+ if (options.cursor) params.set("cursor", options.cursor);
5959
+ if (options.limit !== void 0) params.set("limit", String(options.limit));
5960
+ return await this.request(
5961
+ "read spend summaries",
5962
+ `/api/gateway/v1/spend-summaries?${params.toString()}`
5963
+ );
5964
+ }
5965
+ /**
5966
+ * Every rollup row for the window, one at a time, fetching each page only
5967
+ * when the consumer reaches it.
5968
+ *
5969
+ * The rollup has one row per tenant seen in the window, which no bound
5970
+ * covers, so there is deliberately no eager whole-set read here either: a
5971
+ * checksum that quietly covers part of the window is worse than none.
5972
+ */
5973
+ iterSummaries(options) {
5974
+ return _chunkCLTKABMOjs.__asyncGenerator.call(void 0, this, null, function* () {
5975
+ const pages = walkCursorPages({
5976
+ startCursor: options.cursor,
5977
+ nextCursorOf: (page) => page.next_cursor,
5978
+ onEndlessWalk: (reason) => new SpendEventsApiError(
5979
+ `Failed to read spend summaries: ${reason}.`,
5980
+ "read spend summaries"
5981
+ ),
5982
+ fetchPage: (cursor) => {
5983
+ var _a;
5984
+ return this.summariesPage(_chunkCLTKABMOjs.__spreadProps.call(void 0, _chunkCLTKABMOjs.__spreadValues.call(void 0, {}, options), {
5985
+ cursor,
5986
+ limit: (_a = options.limit) != null ? _a : CURSOR_WALK_PAGE_SIZE
5987
+ }));
5988
+ }
5989
+ });
5990
+ try {
5991
+ for (var iter = _chunkCLTKABMOjs.__forAwait.call(void 0, pages), more, temp, error; more = !(temp = yield new (0, _chunkCLTKABMOjs.__await)(iter.next())).done; more = false) {
5992
+ const page = temp.value;
5993
+ yield* _chunkCLTKABMOjs.__yieldStar.call(void 0, page.data);
5994
+ }
5995
+ } catch (temp) {
5996
+ error = [temp];
5997
+ } finally {
5998
+ try {
5999
+ more && (temp = iter.return) && (yield new (0, _chunkCLTKABMOjs.__await)(temp.call(iter)));
6000
+ } finally {
6001
+ if (error)
6002
+ throw error[0];
6003
+ }
6004
+ }
6005
+ });
6006
+ }
6007
+ /**
6008
+ * Re-deliver a window's spend envelopes to ONE endpoint through the
6009
+ * normal delivery path. Envelope ids are unchanged (your consumer's
6010
+ * dedup key); mind your downstream billing system's finite dedup
6011
+ * window before replaying old ranges. The window is capped server-side
6012
+ * at 7 days per call.
6013
+ */
6014
+ async replay(options) {
6015
+ const response = await this.request(
6016
+ "replay spend events",
6017
+ "/api/gateway/v1/spend-events/replay",
6018
+ _chunkCLTKABMOjs.__spreadValues.call(void 0, {
6019
+ method: "POST",
6020
+ body: JSON.stringify({
6021
+ from: options.from,
6022
+ to: options.to,
6023
+ endpoint_id: options.endpointId
6024
+ })
6025
+ }, mutationInit(options))
6026
+ );
6027
+ return response.data;
6028
+ }
6029
+ async endUserSpend(endUserId, options) {
6030
+ const params = new URLSearchParams();
6031
+ if (options == null ? void 0 : options.window) params.set("window", options.window);
6032
+ if ((options == null ? void 0 : options.from) !== void 0) params.set("from", String(options.from));
6033
+ if ((options == null ? void 0 : options.to) !== void 0) params.set("to", String(options.to));
6034
+ if (options == null ? void 0 : options.virtualKeyId) params.set("virtual_key_id", options.virtualKeyId);
6035
+ const qs = params.toString() !== "" ? `?${params.toString()}` : "";
6036
+ const res = await this.request(
6037
+ "read end-user spend",
6038
+ `/api/gateway/v1/end-users/${encodeURIComponent(endUserId)}/spend${qs}`
6039
+ );
6040
+ return res.data;
6041
+ }
6042
+ };
6043
+
6044
+ // src/client-sdk/services/webhooks/webhooks-api.service.ts
6045
+ var WebhooksApiError = class extends Error {
6046
+ constructor(message, operation, originalError) {
6047
+ super(message);
6048
+ this.operation = operation;
6049
+ this.originalError = originalError;
6050
+ this.name = "WebhooksApiError";
6051
+ }
6052
+ };
6053
+ var WebhooksApiService = class {
6054
+ constructor(config) {
6055
+ var _a, _b, _c;
6056
+ this.endpoint = _chunkDTSULVK5js.resolveEndpoint.call(void 0, config == null ? void 0 : config.endpoint);
6057
+ this.apiKey = (_c = (_b = (_a = config == null ? void 0 : config.apiKey) != null ? _a : scopedApiKey()) != null ? _b : process.env.LANGWATCH_API_KEY) != null ? _c : "";
6058
+ }
6059
+ async request(operation, path2, init) {
6060
+ var _a, _b, _c;
6061
+ const response = await fetch(`${this.endpoint}${path2}`, _chunkCLTKABMOjs.__spreadProps.call(void 0, _chunkCLTKABMOjs.__spreadValues.call(void 0, {}, init), {
6062
+ // A hung control plane must fail the command, not freeze it.
6063
+ signal: (_a = init == null ? void 0 : init.signal) != null ? _a : AbortSignal.timeout(3e4),
6064
+ headers: _chunkCLTKABMOjs.__spreadValues.call(void 0, {
6065
+ Authorization: `Bearer ${this.apiKey}`,
6066
+ "Content-Type": "application/json"
6067
+ }, (_b = init == null ? void 0 : init.headers) != null ? _b : {})
6068
+ }));
6069
+ if (!response.ok) {
6070
+ let parsedBody;
6071
+ try {
6072
+ parsedBody = await response.json();
6073
+ } catch (e) {
6074
+ parsedBody = await response.text();
6075
+ }
6076
+ const message = formatApiErrorForOperation({
6077
+ operation,
6078
+ error: parsedBody,
6079
+ options: { status: response.status }
6080
+ });
6081
+ throwIfHandledError({
6082
+ operation,
6083
+ error: parsedBody,
6084
+ status: response.status,
6085
+ message
6086
+ });
6087
+ throw new WebhooksApiError(message, operation, parsedBody);
6088
+ }
6089
+ (_c = init == null ? void 0 : init.onResponse) == null ? void 0 : _c.call(init, response);
6090
+ return await response.json();
6091
+ }
6092
+ async list() {
6093
+ const res = await this.request(
6094
+ "list webhook endpoints",
6095
+ "/api/webhooks/v1/endpoints"
6096
+ );
6097
+ return res.data;
6098
+ }
6099
+ async get(id) {
6100
+ const res = await this.request(
6101
+ "get webhook endpoint",
6102
+ `/api/webhooks/v1/endpoints/${encodeURIComponent(id)}`
6103
+ );
6104
+ return res.data;
6105
+ }
6106
+ /**
6107
+ * The signing secret comes back on this response and never again, so a
6108
+ * create that times out is recovered with `idempotencyKey`: the replay
6109
+ * carries the same secret, and nothing else ever will.
6110
+ */
6111
+ async create(input, options) {
6112
+ const res = await this.request(
6113
+ "create webhook endpoint",
6114
+ "/api/webhooks/v1/endpoints",
6115
+ _chunkCLTKABMOjs.__spreadValues.call(void 0, {
6116
+ method: "POST",
6117
+ body: JSON.stringify(input)
6118
+ }, idempotentCreateInit(options))
6119
+ );
6120
+ return res.data;
6121
+ }
6122
+ async update(id, input, options) {
6123
+ const res = await this.request(
6124
+ "update webhook endpoint",
6125
+ `/api/webhooks/v1/endpoints/${encodeURIComponent(id)}`,
6126
+ _chunkCLTKABMOjs.__spreadValues.call(void 0, { method: "PATCH", body: JSON.stringify(input) }, mutationInit(options))
6127
+ );
6128
+ return res.data;
6129
+ }
6130
+ /**
6131
+ * Retire an endpoint: the server soft-archives the row, stamping
6132
+ * `archived_at` and dropping the status to disabled, so the delivery
6133
+ * history stays readable for audit while nothing more is ever sent. The
6134
+ * row is archived, not removed, and `gatewayBudgets.archive()` already
6135
+ * names that operation, so the billing surfaces agree on the verb.
6136
+ *
6137
+ * Nothing comes back: the response body carries only an `archived: true`
6138
+ * acknowledgement, and a non-2xx already raises.
6139
+ */
6140
+ async archive(id, options) {
6141
+ await this.request(
6142
+ "archive webhook endpoint",
6143
+ `/api/webhooks/v1/endpoints/${encodeURIComponent(id)}`,
6144
+ _chunkCLTKABMOjs.__spreadValues.call(void 0, { method: "DELETE" }, mutationInit(options))
6145
+ );
6146
+ }
6147
+ async rollSecret(id, options) {
6148
+ const res = await this.request(
6149
+ "roll webhook endpoint secret",
6150
+ `/api/webhooks/v1/endpoints/${encodeURIComponent(id)}/roll-secret`,
6151
+ _chunkCLTKABMOjs.__spreadValues.call(void 0, { method: "POST" }, mutationInit(options))
6152
+ );
6153
+ return res.data;
6154
+ }
6155
+ async test(id, options) {
6156
+ const res = await this.request(
6157
+ "test webhook endpoint",
6158
+ `/api/webhooks/v1/endpoints/${encodeURIComponent(id)}/test`,
6159
+ _chunkCLTKABMOjs.__spreadValues.call(void 0, { method: "POST" }, mutationInit(options))
6160
+ );
6161
+ return res.data;
6162
+ }
6163
+ /**
6164
+ * ONE page of the endpoint's delivery attempts, newest first.
6165
+ *
6166
+ * The cursor is why this is a page: the route has always served one, and
6167
+ * dropping it truncated the delivery log at whatever the first page held,
6168
+ * with nothing in the result to say the rest existed. Pass `next_cursor`
6169
+ * back as `cursor`, or walk the whole log with `iterDeliveries()`.
6170
+ */
6171
+ async deliveriesPage(id, options) {
6172
+ const params = new URLSearchParams();
6173
+ if (options == null ? void 0 : options.cursor) params.set("cursor", options.cursor);
6174
+ if ((options == null ? void 0 : options.limit) !== void 0) params.set("limit", String(options.limit));
6175
+ const qs = params.toString() !== "" ? `?${params.toString()}` : "";
6176
+ const { data, next_cursor } = await this.request(
6177
+ "list webhook deliveries",
6178
+ `/api/webhooks/v1/endpoints/${encodeURIComponent(id)}/deliveries${qs}`
6179
+ );
6180
+ return { data, next_cursor: next_cursor != null ? next_cursor : null };
6181
+ }
6182
+ /**
6183
+ * Every recorded delivery attempt for the endpoint, one at a time,
6184
+ * fetching each page only when the consumer reaches it.
6185
+ */
6186
+ iterDeliveries(id, options) {
6187
+ return _chunkCLTKABMOjs.__asyncGenerator.call(void 0, this, null, function* () {
6188
+ const pages = walkCursorPages({
6189
+ startCursor: options == null ? void 0 : options.cursor,
6190
+ nextCursorOf: (page) => page.next_cursor,
6191
+ onEndlessWalk: (reason) => new WebhooksApiError(
6192
+ `Failed to list webhook deliveries: ${reason}.`,
6193
+ "list webhook deliveries"
6194
+ ),
6195
+ fetchPage: (cursor) => {
6196
+ var _a;
6197
+ return this.deliveriesPage(id, {
6198
+ cursor,
6199
+ limit: (_a = options == null ? void 0 : options.limit) != null ? _a : CURSOR_WALK_PAGE_SIZE
6200
+ });
6201
+ }
6202
+ });
6203
+ try {
6204
+ for (var iter = _chunkCLTKABMOjs.__forAwait.call(void 0, pages), more, temp, error; more = !(temp = yield new (0, _chunkCLTKABMOjs.__await)(iter.next())).done; more = false) {
6205
+ const page = temp.value;
6206
+ yield* _chunkCLTKABMOjs.__yieldStar.call(void 0, page.data);
6207
+ }
6208
+ } catch (temp) {
6209
+ error = [temp];
6210
+ } finally {
6211
+ try {
6212
+ more && (temp = iter.return) && (yield new (0, _chunkCLTKABMOjs.__await)(temp.call(iter)));
6213
+ } finally {
6214
+ if (error)
6215
+ throw error[0];
6216
+ }
6217
+ }
6218
+ });
6219
+ }
6220
+ async health(id) {
6221
+ const res = await this.request(
6222
+ "read webhook endpoint health",
6223
+ `/api/webhooks/v1/endpoints/${encodeURIComponent(id)}/health`
6224
+ );
6225
+ return res.data;
6226
+ }
6227
+ async eventTypes() {
6228
+ const res = await this.request(
6229
+ "list webhook event types",
6230
+ "/api/webhooks/v1/event-types"
6231
+ );
6232
+ return res.data;
6233
+ }
6234
+ /**
6235
+ * ONE page of the organization's emitted-events log, newest first.
6236
+ *
6237
+ * Webhooks are a push over this log, never the only copy of it: a consumer
6238
+ * that missed a delivery reads the window back from here. Walk the whole
6239
+ * window with `iterEvents()`.
6240
+ */
6241
+ async eventsPage(options) {
6242
+ const params = new URLSearchParams();
6243
+ if (options == null ? void 0 : options.type) params.set("type", options.type);
6244
+ if ((options == null ? void 0 : options.from) !== void 0) params.set("from", String(options.from));
6245
+ if ((options == null ? void 0 : options.to) !== void 0) params.set("to", String(options.to));
6246
+ if (options == null ? void 0 : options.cursor) params.set("cursor", options.cursor);
6247
+ if ((options == null ? void 0 : options.limit) !== void 0) params.set("limit", String(options.limit));
6248
+ const qs = params.toString() !== "" ? `?${params.toString()}` : "";
6249
+ const { data, next_cursor } = await this.request("list emitted events", `/api/webhooks/v1/events${qs}`);
6250
+ return { data, next_cursor: next_cursor != null ? next_cursor : null };
6251
+ }
6252
+ /**
6253
+ * Every emitted event matching the filter, one at a time, fetching each
6254
+ * page only when the consumer reaches it.
6255
+ */
6256
+ iterEvents(options) {
6257
+ return _chunkCLTKABMOjs.__asyncGenerator.call(void 0, this, null, function* () {
6258
+ const pages = walkCursorPages({
6259
+ startCursor: options == null ? void 0 : options.cursor,
6260
+ nextCursorOf: (page) => page.next_cursor,
6261
+ onEndlessWalk: (reason) => new WebhooksApiError(
6262
+ `Failed to list emitted events: ${reason}.`,
6263
+ "list emitted events"
6264
+ ),
6265
+ fetchPage: (cursor) => {
6266
+ var _a;
6267
+ return this.eventsPage(_chunkCLTKABMOjs.__spreadProps.call(void 0, _chunkCLTKABMOjs.__spreadValues.call(void 0, {}, options), {
6268
+ cursor,
6269
+ limit: (_a = options == null ? void 0 : options.limit) != null ? _a : CURSOR_WALK_PAGE_SIZE
6270
+ }));
6271
+ }
6272
+ });
6273
+ try {
6274
+ for (var iter = _chunkCLTKABMOjs.__forAwait.call(void 0, pages), more, temp, error; more = !(temp = yield new (0, _chunkCLTKABMOjs.__await)(iter.next())).done; more = false) {
6275
+ const page = temp.value;
6276
+ yield* _chunkCLTKABMOjs.__yieldStar.call(void 0, page.data);
6277
+ }
6278
+ } catch (temp) {
6279
+ error = [temp];
6280
+ } finally {
6281
+ try {
6282
+ more && (temp = iter.return) && (yield new (0, _chunkCLTKABMOjs.__await)(temp.call(iter)));
6283
+ } finally {
6284
+ if (error)
6285
+ throw error[0];
6286
+ }
6287
+ }
6288
+ });
6289
+ }
6290
+ /**
6291
+ * One emitted event by id, the envelope exactly as it was delivered.
6292
+ *
6293
+ * A 404 covers every reason the log cannot answer: never emitted, past the
6294
+ * retention horizon, or belonging to another organization.
6295
+ */
6296
+ async getEvent(id) {
6297
+ const res = await this.request(
6298
+ "get emitted event",
6299
+ `/api/webhooks/v1/events/${encodeURIComponent(id)}`
6300
+ );
6301
+ return res.data;
6302
+ }
6303
+ };
6304
+
5285
6305
  // src/client-sdk/services/traces/types.ts
5286
6306
  var TracesError = class extends Error {
5287
6307
  constructor(message, operation, originalError) {
@@ -5293,7 +6313,7 @@ var TracesError = class extends Error {
5293
6313
  };
5294
6314
 
5295
6315
  // src/client-sdk/services/traces/tracing/tracer.ts
5296
- var tracer3 = _chunkADJOFPAZjs.getLangWatchTracer.call(void 0, `${_chunkWHBCX64Rjs.LANGWATCH_SDK_NAME_CLIENT}.traces`, _chunkWHBCX64Rjs.LANGWATCH_SDK_VERSION);
6316
+ var tracer3 = _chunkK6KPNTQOjs.getLangWatchTracer.call(void 0, `${_chunkUOFSG6R4js.LANGWATCH_SDK_NAME_CLIENT}.traces`, _chunkUOFSG6R4js.LANGWATCH_SDK_VERSION);
5297
6317
 
5298
6318
  // src/client-sdk/services/traces/service.ts
5299
6319
  var TracesService = class {
@@ -5347,11 +6367,11 @@ var TracesService = class {
5347
6367
  var _service;
5348
6368
  var TracesFacade = class {
5349
6369
  constructor(config) {
5350
- _chunkTKSTXX3Djs.__privateAdd.call(void 0, this, _service);
5351
- _chunkTKSTXX3Djs.__privateSet.call(void 0, this, _service, new TracesService(config));
6370
+ _chunkCLTKABMOjs.__privateAdd.call(void 0, this, _service);
6371
+ _chunkCLTKABMOjs.__privateSet.call(void 0, this, _service, new TracesService(config));
5352
6372
  }
5353
6373
  async get(traceId, params) {
5354
- return _chunkTKSTXX3Djs.__privateGet.call(void 0, this, _service).get(traceId, params);
6374
+ return _chunkCLTKABMOjs.__privateGet.call(void 0, this, _service).get(traceId, params);
5355
6375
  }
5356
6376
  };
5357
6377
  _service = new WeakMap();
@@ -5360,16 +6380,16 @@ _service = new WeakMap();
5360
6380
  var _LangWatch_instances, createInternalConfig_fn;
5361
6381
  var LangWatch = class {
5362
6382
  constructor(options = {}) {
5363
- _chunkTKSTXX3Djs.__privateAdd.call(void 0, this, _LangWatch_instances);
5364
- var _a, _b, _c, _d;
5365
- const apiKey = (_b = (_a = options.apiKey) != null ? _a : process.env.LANGWATCH_API_KEY) != null ? _b : "";
5366
- const endpoint = (_d = (_c = options.endpoint) != null ? _c : process.env.LANGWATCH_ENDPOINT) != null ? _d : _chunkWHBCX64Rjs.DEFAULT_ENDPOINT;
5367
- this.config = _chunkTKSTXX3Djs.__privateMethod.call(void 0, this, _LangWatch_instances, createInternalConfig_fn).call(this, {
6383
+ _chunkCLTKABMOjs.__privateAdd.call(void 0, this, _LangWatch_instances);
6384
+ var _a, _b, _c;
6385
+ const apiKey = (_c = (_b = (_a = options.apiKey) != null ? _a : scopedApiKey()) != null ? _b : process.env.LANGWATCH_API_KEY) != null ? _c : "";
6386
+ const endpoint = _chunkDTSULVK5js.resolveEndpoint.call(void 0, options.endpoint);
6387
+ this.config = _chunkCLTKABMOjs.__privateMethod.call(void 0, this, _LangWatch_instances, createInternalConfig_fn).call(this, {
5368
6388
  apiKey,
5369
6389
  endpoint,
5370
6390
  options: options.options
5371
6391
  });
5372
- this.prompts = new PromptsFacade(_chunkTKSTXX3Djs.__spreadValues.call(void 0, {
6392
+ this.prompts = new PromptsFacade(_chunkCLTKABMOjs.__spreadValues.call(void 0, {
5373
6393
  promptsApiService: new PromptsApiService(this.config),
5374
6394
  localPromptsService: new LocalPromptsService()
5375
6395
  }, this.config));
@@ -5405,6 +6425,10 @@ var LangWatch = class {
5405
6425
  this.simulationRuns = new SimulationRunsApiService(this.config);
5406
6426
  this.monitors = new MonitorsApiService({ apiKey, endpoint });
5407
6427
  this.secrets = new SecretsApiService({ apiKey, endpoint });
6428
+ this.virtualKeys = new VirtualKeysApiService({ apiKey, endpoint });
6429
+ this.gatewayBudgets = new GatewayBudgetsApiService({ apiKey, endpoint });
6430
+ this.spendEvents = new SpendEventsApiService({ apiKey, endpoint });
6431
+ this.webhooks = new WebhooksApiService({ apiKey, endpoint });
5408
6432
  }
5409
6433
  get apiClient() {
5410
6434
  return this.config.langwatchApiClient;
@@ -5418,17 +6442,98 @@ createInternalConfig_fn = function({
5418
6442
  }) {
5419
6443
  var _a;
5420
6444
  return {
5421
- logger: (_a = options == null ? void 0 : options.logger) != null ? _a : new (0, _chunkTKSTXX3Djs.NoOpLogger)(),
6445
+ logger: (_a = options == null ? void 0 : options.logger) != null ? _a : new (0, _chunkCLTKABMOjs.NoOpLogger)(),
5422
6446
  langwatchApiClient: createLangWatchApiClient(apiKey, endpoint),
5423
6447
  endpoint,
5424
6448
  apiKey
5425
6449
  };
5426
6450
  };
5427
6451
 
6452
+ // src/client-sdk/services/webhooks/verify-signature.ts
6453
+ var _crypto = require('crypto');
6454
+ var WEBHOOK_SIGNATURE_HEADER = "X-LangWatch-Signature";
6455
+ var WEBHOOK_DELIVERY_ID_HEADER = "X-LangWatch-Delivery-Id";
6456
+ var WEBHOOK_EVENT_ID_HEADER = "X-LangWatch-Event-Id";
6457
+ var WEBHOOK_SIGNATURE_DEFAULT_TOLERANCE_SECONDS = 300;
6458
+ var WebhookSignatureVerificationError = class extends Error {
6459
+ constructor(code, message) {
6460
+ super(message);
6461
+ this.name = "WebhookSignatureVerificationError";
6462
+ this.code = code;
6463
+ }
6464
+ };
6465
+ function parseSignatureHeader(header) {
6466
+ let timestamp;
6467
+ const candidates = [];
6468
+ for (const piece of header.split(",")) {
6469
+ const eq = piece.indexOf("=");
6470
+ if (eq <= 0) continue;
6471
+ const key = piece.slice(0, eq).trim();
6472
+ const value = piece.slice(eq + 1).trim();
6473
+ if (key === "v1") candidates.push(value);
6474
+ else if (key === "t" && value.length > 0) timestamp = Number(value);
6475
+ }
6476
+ return { timestamp, candidates };
6477
+ }
6478
+ function digestsMatch(expected, candidate) {
6479
+ const a = Buffer.from(expected, "utf8");
6480
+ const b = Buffer.from(candidate, "utf8");
6481
+ return a.length === b.length && _crypto.timingSafeEqual.call(void 0, a, b);
6482
+ }
6483
+ function signedPayload(timestamp, body) {
6484
+ const prefix = Buffer.from(`${timestamp}.`, "utf8");
6485
+ const bytes = typeof body === "string" ? Buffer.from(body, "utf8") : Buffer.from(body);
6486
+ return Buffer.concat([prefix, bytes]);
6487
+ }
6488
+ function verifyWebhookSignature(options) {
6489
+ var _a, _b;
6490
+ const secrets = (typeof options.secret === "string" ? [options.secret] : options.secret).filter((secret) => typeof secret === "string" && secret.length > 0);
6491
+ if (secrets.length === 0) {
6492
+ throw new TypeError(
6493
+ "verifyWebhookSignature needs at least one non-empty signing secret"
6494
+ );
6495
+ }
6496
+ const tolerance = (_a = options.toleranceSeconds) != null ? _a : WEBHOOK_SIGNATURE_DEFAULT_TOLERANCE_SECONDS;
6497
+ const now = (_b = options.nowSeconds) != null ? _b : Math.floor(Date.now() / 1e3);
6498
+ const { timestamp, candidates } = parseSignatureHeader(options.header);
6499
+ if (timestamp === void 0 || !Number.isFinite(timestamp)) {
6500
+ throw new WebhookSignatureVerificationError(
6501
+ "malformed_header",
6502
+ `${WEBHOOK_SIGNATURE_HEADER} carries no readable t= timestamp, so the delivery cannot be checked for freshness`
6503
+ );
6504
+ }
6505
+ if (candidates.length === 0) {
6506
+ throw new WebhookSignatureVerificationError(
6507
+ "malformed_header",
6508
+ `${WEBHOOK_SIGNATURE_HEADER} carries no v1= signature, so there is nothing to compare`
6509
+ );
6510
+ }
6511
+ if (Math.abs(now - timestamp) > tolerance) {
6512
+ throw new WebhookSignatureVerificationError(
6513
+ "stale_timestamp",
6514
+ `the delivery was signed ${Math.abs(now - timestamp)}s from now, outside the ${tolerance}s tolerance`
6515
+ );
6516
+ }
6517
+ const payload = signedPayload(timestamp, options.body);
6518
+ let matched = false;
6519
+ for (const secret of secrets) {
6520
+ const expected = _crypto.createHmac.call(void 0, "sha256", secret).update(payload).digest("hex");
6521
+ for (const candidate of candidates) {
6522
+ if (digestsMatch(expected, candidate)) matched = true;
6523
+ }
6524
+ }
6525
+ if (!matched) {
6526
+ throw new WebhookSignatureVerificationError(
6527
+ "invalid_signature",
6528
+ `no v1 signature in ${WEBHOOK_SIGNATURE_HEADER} matched the ${secrets.length === 1 ? "secret" : "secrets"} held, so the body was signed with something else or changed in transit`
6529
+ );
6530
+ }
6531
+ }
6532
+
5428
6533
  // src/index.ts
5429
6534
  var logger = {
5430
- ConsoleLogger: _chunkTKSTXX3Djs.ConsoleLogger,
5431
- NoOpLogger: _chunkTKSTXX3Djs.NoOpLogger
6535
+ ConsoleLogger: _chunkCLTKABMOjs.ConsoleLogger,
6536
+ NoOpLogger: _chunkCLTKABMOjs.NoOpLogger
5432
6537
  };
5433
6538
 
5434
6539
 
@@ -5462,5 +6567,21 @@ var logger = {
5462
6567
 
5463
6568
 
5464
6569
 
5465
- exports.DatasetApiError = DatasetApiError; exports.DatasetError = DatasetError; exports.DatasetNotFoundError = DatasetNotFoundError; exports.DatasetPlanLimitError = DatasetPlanLimitError; exports.DatasetValidationError = DatasetValidationError; exports.DatasetsFacade = DatasetsFacade; exports.EvaluationError = EvaluationError; exports.EvaluationsApiError = EvaluationsApiError; exports.EvaluationsFacade = EvaluationsFacade; exports.EvaluatorCallError = EvaluatorCallError; exports.EvaluatorError = EvaluatorError; exports.EvaluatorNotFoundError = EvaluatorNotFoundError; exports.EvaluatorsApiError = EvaluatorsApiError; exports.EvaluatorsApiService = EvaluatorsApiService; exports.Experiment = Experiment; exports.ExperimentApiError = ExperimentApiError; exports.ExperimentError = ExperimentError; exports.ExperimentInitError = ExperimentInitError; exports.ExperimentsFacade = ExperimentsFacade; exports.FetchPolicy = FetchPolicy; exports.FilterableBatchSpanProcessor = _chunkIUSLT65Zjs.FilterableBatchSpanProcessor; exports.LangWatch = LangWatch; exports.LangWatchApiError = LangWatchApiError; exports.LangWatchExporter = _chunkWHBCX64Rjs.LangWatchTraceExporter; exports.LangWatchHandledError = LangWatchHandledError; exports.TargetMetadataConflictError = TargetMetadataConflictError; exports.attributes = _chunkTKSTXX3Djs.attributes_exports; exports.getLangWatchLogger = _chunkWHBCX64Rjs.getLangWatchLogger; exports.getLangWatchTracer = _chunkADJOFPAZjs.getLangWatchTracer; exports.isLangWatchHandledError = isLangWatchHandledError; exports.logger = logger;
6570
+
6571
+
6572
+
6573
+
6574
+
6575
+
6576
+
6577
+
6578
+
6579
+
6580
+
6581
+
6582
+
6583
+
6584
+
6585
+
6586
+ exports.DatasetApiError = DatasetApiError; exports.DatasetError = DatasetError; exports.DatasetNotFoundError = DatasetNotFoundError; exports.DatasetPlanLimitError = DatasetPlanLimitError; exports.DatasetValidationError = DatasetValidationError; exports.DatasetsFacade = DatasetsFacade; exports.EvaluationError = EvaluationError; exports.EvaluationsApiError = EvaluationsApiError; exports.EvaluationsFacade = EvaluationsFacade; exports.EvaluatorCallError = EvaluatorCallError; exports.EvaluatorError = EvaluatorError; exports.EvaluatorNotFoundError = EvaluatorNotFoundError; exports.EvaluatorsApiError = EvaluatorsApiError; exports.EvaluatorsApiService = EvaluatorsApiService; exports.Experiment = Experiment; exports.ExperimentApiError = ExperimentApiError; exports.ExperimentError = ExperimentError; exports.ExperimentInitError = ExperimentInitError; exports.ExperimentsFacade = ExperimentsFacade; exports.FetchPolicy = FetchPolicy; exports.FilterableBatchSpanProcessor = _chunkZTOXEWNXjs.FilterableBatchSpanProcessor; exports.GatewayBudgetsApiError = GatewayBudgetsApiError; exports.GatewayBudgetsApiService = GatewayBudgetsApiService; exports.IDEMPOTENCY_KEY_HEADER = IDEMPOTENCY_KEY_HEADER; exports.IDEMPOTENT_REPLAY_HEADER = IDEMPOTENT_REPLAY_HEADER; exports.LangWatch = LangWatch; exports.LangWatchApiError = LangWatchApiError; exports.LangWatchExporter = _chunkUOFSG6R4js.LangWatchTraceExporter; exports.LangWatchHandledError = LangWatchHandledError; exports.SpendEventsApiError = SpendEventsApiError; exports.SpendEventsApiService = SpendEventsApiService; exports.TargetMetadataConflictError = TargetMetadataConflictError; exports.VirtualKeysApiError = VirtualKeysApiError; exports.VirtualKeysApiService = VirtualKeysApiService; exports.WEBHOOK_DELIVERY_ID_HEADER = WEBHOOK_DELIVERY_ID_HEADER; exports.WEBHOOK_EVENT_ID_HEADER = WEBHOOK_EVENT_ID_HEADER; exports.WEBHOOK_SIGNATURE_DEFAULT_TOLERANCE_SECONDS = WEBHOOK_SIGNATURE_DEFAULT_TOLERANCE_SECONDS; exports.WEBHOOK_SIGNATURE_HEADER = WEBHOOK_SIGNATURE_HEADER; exports.WebhookSignatureVerificationError = WebhookSignatureVerificationError; exports.WebhooksApiError = WebhooksApiError; exports.WebhooksApiService = WebhooksApiService; exports.attributes = _chunkCLTKABMOjs.attributes_exports; exports.getLangWatchLogger = _chunkUOFSG6R4js.getLangWatchLogger; exports.getLangWatchTracer = _chunkK6KPNTQOjs.getLangWatchTracer; exports.isLangWatchHandledError = isLangWatchHandledError; exports.logger = logger; exports.verifyWebhookSignature = verifyWebhookSignature;
5466
6587
  //# sourceMappingURL=index.js.map