langwatch 1.9.0 → 1.11.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 (36) hide show
  1. package/dist/agent/index.d.mts +301 -0
  2. package/dist/agent/index.d.ts +301 -0
  3. package/dist/agent/index.js +1468 -0
  4. package/dist/agent/index.js.map +1 -0
  5. package/dist/agent/index.mjs +1424 -0
  6. package/dist/agent/index.mjs.map +1 -0
  7. package/dist/{chunk-NFFB3DWW.js → chunk-2PD3YA5H.js} +17 -6
  8. package/dist/chunk-2PD3YA5H.js.map +1 -0
  9. package/dist/{chunk-HUMHSRVP.js → chunk-AJDFFRSW.js} +12 -12
  10. package/dist/{chunk-HUMHSRVP.js.map → chunk-AJDFFRSW.js.map} +1 -1
  11. package/dist/{chunk-4XQHESU7.mjs → chunk-BS5CNZ5S.mjs} +17 -6
  12. package/dist/chunk-BS5CNZ5S.mjs.map +1 -0
  13. package/dist/{chunk-A52LX4C4.mjs → chunk-VMNKKJVI.mjs} +2 -2
  14. package/dist/cli/bundle.js +722 -379
  15. package/dist/{implementation-BvwOB77X.d.ts → implementation-D58yPTJW.d.ts} +1 -1
  16. package/dist/{implementation-C1F0eCHp.d.mts → implementation-aczLxVpV.d.mts} +1 -1
  17. package/dist/index.d.mts +166 -3
  18. package/dist/index.d.ts +166 -3
  19. package/dist/index.js +292 -60
  20. package/dist/index.js.map +1 -1
  21. package/dist/index.mjs +261 -29
  22. package/dist/index.mjs.map +1 -1
  23. package/dist/observability-sdk/index.d.mts +3 -3
  24. package/dist/observability-sdk/index.d.ts +3 -3
  25. package/dist/observability-sdk/index.js +2 -2
  26. package/dist/observability-sdk/index.mjs +1 -1
  27. package/dist/observability-sdk/instrumentation/langchain/index.d.mts +1 -1
  28. package/dist/observability-sdk/instrumentation/langchain/index.d.ts +1 -1
  29. package/dist/observability-sdk/setup/node/index.js +3 -3
  30. package/dist/observability-sdk/setup/node/index.mjs +2 -2
  31. package/dist/{types-C3NpCWi_.d.mts → types-BmMuUDrO.d.mts} +3858 -657
  32. package/dist/{types-jx13nj4M.d.ts → types-D_YNU-VL.d.ts} +3858 -657
  33. package/package.json +8 -1
  34. package/dist/chunk-4XQHESU7.mjs.map +0 -1
  35. package/dist/chunk-NFFB3DWW.js.map +0 -1
  36. /package/dist/{chunk-A52LX4C4.mjs.map → chunk-VMNKKJVI.mjs.map} +0 -0
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ var _chunk4ERRCKOHjs = require('./chunk-4ERRCKOH.js');
9
9
 
10
10
 
11
11
 
12
- var _chunkHUMHSRVPjs = require('./chunk-HUMHSRVP.js');
12
+ var _chunkAJDFFRSWjs = require('./chunk-AJDFFRSW.js');
13
13
 
14
14
 
15
15
 
@@ -20,7 +20,7 @@ var _chunkHUMHSRVPjs = require('./chunk-HUMHSRVP.js');
20
20
 
21
21
 
22
22
 
23
- var _chunkNFFB3DWWjs = require('./chunk-NFFB3DWW.js');
23
+ var _chunk2PD3YA5Hjs = require('./chunk-2PD3YA5H.js');
24
24
 
25
25
 
26
26
 
@@ -329,7 +329,7 @@ var PromptServiceTracingDecorator = class {
329
329
  };
330
330
 
331
331
  // src/client-sdk/services/prompts/tracing/tracer.ts
332
- var tracer = _chunk4ERRCKOHjs.getLangWatchTracer.call(void 0, `${_chunkNFFB3DWWjs.LANGWATCH_SDK_NAME_CLIENT}.prompts`, _chunkNFFB3DWWjs.LANGWATCH_SDK_VERSION);
332
+ var tracer = _chunk4ERRCKOHjs.getLangWatchTracer.call(void 0, `${_chunk2PD3YA5Hjs.LANGWATCH_SDK_NAME_CLIENT}.prompts`, _chunk2PD3YA5Hjs.LANGWATCH_SDK_VERSION);
333
333
 
334
334
  // src/client-sdk/tracing/create-tracing-proxy.ts
335
335
  var _api = require('@opentelemetry/api');
@@ -676,14 +676,14 @@ var handledErrorMiddleware = {
676
676
  };
677
677
  var createLangWatchApiClient = (apiKey = ((_b) => (_b = ((_a) => (_a = scopedApiKey()) != null ? _a : process.env.LANGWATCH_API_KEY)()) != null ? _b : "")(), endpoint, projectId = ((_c) => (_c = scopedProjectId()) != null ? _c : process.env.LANGWATCH_PROJECT_ID)()) => {
678
678
  const client = _openapifetch2.default.call(void 0, {
679
- baseUrl: _chunkHUMHSRVPjs.resolveEndpoint.call(void 0, endpoint),
680
- headers: _chunkLCG5Y2EGjs.__spreadProps.call(void 0, _chunkLCG5Y2EGjs.__spreadValues.call(void 0, {}, _chunkNFFB3DWWjs.buildAuthHeaders.call(void 0, { apiKey, projectId })), {
679
+ baseUrl: _chunkAJDFFRSWjs.resolveEndpoint.call(void 0, endpoint),
680
+ headers: _chunkLCG5Y2EGjs.__spreadProps.call(void 0, _chunkLCG5Y2EGjs.__spreadValues.call(void 0, {}, _chunk2PD3YA5Hjs.buildAuthHeaders.call(void 0, { apiKey, projectId })), {
681
681
  "content-type": "application/json",
682
- "user-agent": `langwatch-sdk-node/${_chunkNFFB3DWWjs.version}`,
683
- "x-langwatch-sdk-name": _chunkNFFB3DWWjs.LANGWATCH_SDK_NAME_OBSERVABILITY,
684
- "x-langwatch-sdk-language": _chunkNFFB3DWWjs.LANGWATCH_SDK_LANGUAGE,
685
- "x-langwatch-sdk-version": _chunkNFFB3DWWjs.LANGWATCH_SDK_VERSION,
686
- "x-langwatch-sdk-platform": _chunkNFFB3DWWjs.LANGWATCH_SDK_RUNTIME.call(void 0, )
682
+ "user-agent": `langwatch-sdk-node/${_chunk2PD3YA5Hjs.version}`,
683
+ "x-langwatch-sdk-name": _chunk2PD3YA5Hjs.LANGWATCH_SDK_NAME_OBSERVABILITY,
684
+ "x-langwatch-sdk-language": _chunk2PD3YA5Hjs.LANGWATCH_SDK_LANGUAGE,
685
+ "x-langwatch-sdk-version": _chunk2PD3YA5Hjs.LANGWATCH_SDK_VERSION,
686
+ "x-langwatch-sdk-platform": _chunk2PD3YA5Hjs.LANGWATCH_SDK_RUNTIME.call(void 0, )
687
687
  })
688
688
  });
689
689
  client.use(handledErrorMiddleware);
@@ -1960,12 +1960,12 @@ var DatasetPlanLimitError = class extends DatasetError {
1960
1960
  };
1961
1961
 
1962
1962
  // src/client-sdk/services/datasets/tracing/tracer.ts
1963
- var tracer2 = _chunk4ERRCKOHjs.getLangWatchTracer.call(void 0, `${_chunkNFFB3DWWjs.LANGWATCH_SDK_NAME_CLIENT}.datasets`, _chunkNFFB3DWWjs.LANGWATCH_SDK_VERSION);
1963
+ var tracer2 = _chunk4ERRCKOHjs.getLangWatchTracer.call(void 0, `${_chunk2PD3YA5Hjs.LANGWATCH_SDK_NAME_CLIENT}.datasets`, _chunk2PD3YA5Hjs.LANGWATCH_SDK_VERSION);
1964
1964
 
1965
1965
  // src/client-sdk/services/datasets/dataset.service.ts
1966
1966
  var DatasetService = class {
1967
1967
  constructor(config) {
1968
- this.config = _chunkLCG5Y2EGjs.__spreadProps.call(void 0, _chunkLCG5Y2EGjs.__spreadValues.call(void 0, {}, config), { endpoint: _chunkHUMHSRVPjs.resolveEndpoint.call(void 0, config.endpoint) });
1968
+ this.config = _chunkLCG5Y2EGjs.__spreadProps.call(void 0, _chunkLCG5Y2EGjs.__spreadValues.call(void 0, {}, config), { endpoint: _chunkAJDFFRSWjs.resolveEndpoint.call(void 0, config.endpoint) });
1969
1969
  return createTracingProxy(this, tracer2);
1970
1970
  }
1971
1971
  /**
@@ -2246,7 +2246,7 @@ var DatasetService = class {
2246
2246
  const url = `${endpoint}${path2}`;
2247
2247
  const response = await fetch(url, {
2248
2248
  method: "POST",
2249
- headers: _chunkNFFB3DWWjs.buildAuthHeaders.call(void 0, { apiKey }),
2249
+ headers: _chunk2PD3YA5Hjs.buildAuthHeaders.call(void 0, { apiKey }),
2250
2250
  body: formData
2251
2251
  });
2252
2252
  if (!response.ok) {
@@ -2945,7 +2945,7 @@ var Experiment = class _Experiment {
2945
2945
  this.experimentSlug = name;
2946
2946
  this.runId = (_a = options.runId) != null ? _a : generateHumanReadableId();
2947
2947
  this.apiClient = options.apiClient;
2948
- this.endpoint = _chunkHUMHSRVPjs.resolveEndpoint.call(void 0, options.endpoint);
2948
+ this.endpoint = _chunkAJDFFRSWjs.resolveEndpoint.call(void 0, options.endpoint);
2949
2949
  this.apiKey = options.apiKey;
2950
2950
  this.logger = options.logger;
2951
2951
  this.concurrency = (_b = options.concurrency) != null ? _b : DEFAULT_CONCURRENCY;
@@ -2955,7 +2955,7 @@ var Experiment = class _Experiment {
2955
2955
  * Initialize an evaluation session
2956
2956
  */
2957
2957
  static async init(name, options) {
2958
- _chunkHUMHSRVPjs.ensureSetup.call(void 0, );
2958
+ _chunkAJDFFRSWjs.ensureSetup.call(void 0, );
2959
2959
  const experiment = new _Experiment(name, options);
2960
2960
  await experiment.initialize();
2961
2961
  return experiment;
@@ -2974,7 +2974,7 @@ var Experiment = class _Experiment {
2974
2974
  method: "POST",
2975
2975
  headers: _chunkLCG5Y2EGjs.__spreadValues.call(void 0, {
2976
2976
  "Content-Type": "application/json"
2977
- }, _chunkNFFB3DWWjs.buildAuthHeaders.call(void 0, { apiKey: this.apiKey })),
2977
+ }, _chunk2PD3YA5Hjs.buildAuthHeaders.call(void 0, { apiKey: this.apiKey })),
2978
2978
  body: JSON.stringify({
2979
2979
  experiment_name: this.name,
2980
2980
  experiment_slug: this.experimentSlug,
@@ -3330,7 +3330,7 @@ var Experiment = class _Experiment {
3330
3330
  method: "POST",
3331
3331
  headers: _chunkLCG5Y2EGjs.__spreadValues.call(void 0, {
3332
3332
  "Content-Type": "application/json"
3333
- }, _chunkNFFB3DWWjs.buildAuthHeaders.call(void 0, { apiKey: this.apiKey })),
3333
+ }, _chunk2PD3YA5Hjs.buildAuthHeaders.call(void 0, { apiKey: this.apiKey })),
3334
3334
  body: JSON.stringify({
3335
3335
  trace_id: traceId != null ? traceId : null,
3336
3336
  span_id: spanId != null ? spanId : null,
@@ -3867,7 +3867,7 @@ var Experiment = class _Experiment {
3867
3867
  method: "POST",
3868
3868
  headers: _chunkLCG5Y2EGjs.__spreadValues.call(void 0, {
3869
3869
  "Content-Type": "application/json"
3870
- }, _chunkNFFB3DWWjs.buildAuthHeaders.call(void 0, { apiKey: this.apiKey })),
3870
+ }, _chunk2PD3YA5Hjs.buildAuthHeaders.call(void 0, { apiKey: this.apiKey })),
3871
3871
  body: JSON.stringify(body)
3872
3872
  }).then((response) => {
3873
3873
  if (!response.ok) {
@@ -4855,7 +4855,7 @@ var EvaluationsFacade = class {
4855
4855
  method: "POST",
4856
4856
  headers: _chunkLCG5Y2EGjs.__spreadValues.call(void 0, {
4857
4857
  "Content-Type": "application/json"
4858
- }, _chunkNFFB3DWWjs.buildAuthHeaders.call(void 0, { apiKey: _chunkLCG5Y2EGjs.__privateGet.call(void 0, this, _apiKey) })),
4858
+ }, _chunk2PD3YA5Hjs.buildAuthHeaders.call(void 0, { apiKey: _chunkLCG5Y2EGjs.__privateGet.call(void 0, this, _apiKey) })),
4859
4859
  body: JSON.stringify(requestBody)
4860
4860
  });
4861
4861
  if (!response.ok) {
@@ -5063,6 +5063,34 @@ var ScenariosApiService = class {
5063
5063
  this.handleApiError(`update scenario with ID "${id}"`, error);
5064
5064
  return data;
5065
5065
  }
5066
+ /** The saved versions of a scenario, newest first. */
5067
+ async listVersions(id, options) {
5068
+ const query = _chunkLCG5Y2EGjs.__spreadValues.call(void 0, _chunkLCG5Y2EGjs.__spreadValues.call(void 0, {}, (options == null ? void 0 : options.limit) !== void 0 && { limit: options.limit }), (options == null ? void 0 : options.cursor) !== void 0 && { cursor: options.cursor });
5069
+ const { data, error } = await this.apiClient.GET(
5070
+ "/api/scenarios/{id}/versions",
5071
+ {
5072
+ params: { path: { id }, query }
5073
+ }
5074
+ );
5075
+ if (error)
5076
+ this.handleApiError(`list versions of scenario "${id}"`, error);
5077
+ return data;
5078
+ }
5079
+ /** One saved version of a scenario, with the content it saved. */
5080
+ async getVersion(id, version2) {
5081
+ const { data, error } = await this.apiClient.GET(
5082
+ "/api/scenarios/{id}/versions/{version}",
5083
+ {
5084
+ params: { path: { id, version: version2 } }
5085
+ }
5086
+ );
5087
+ if (error)
5088
+ this.handleApiError(
5089
+ `get version ${version2} of scenario "${id}"`,
5090
+ error
5091
+ );
5092
+ return data;
5093
+ }
5066
5094
  async delete(id) {
5067
5095
  const { data, error } = await this.apiClient.DELETE(
5068
5096
  "/api/scenarios/{id}",
@@ -5096,8 +5124,10 @@ var SuitesApiService = class {
5096
5124
  } });
5097
5125
  throw new SuitesApiError(message, operation, error);
5098
5126
  }
5099
- async getAll() {
5100
- const { data, error } = await this.apiClient.GET("/api/suites");
5127
+ async getAll(options) {
5128
+ const { data, error } = await this.apiClient.GET("/api/suites", _chunkLCG5Y2EGjs.__spreadValues.call(void 0, {}, (options == null ? void 0 : options.kind) !== void 0 && {
5129
+ params: { query: { kind: options.kind } }
5130
+ }));
5101
5131
  if (error) this.handleApiError("list suites", error);
5102
5132
  return data;
5103
5133
  }
@@ -5131,12 +5161,14 @@ var SuitesApiService = class {
5131
5161
  return data;
5132
5162
  }
5133
5163
  async run(id, optionsOrIdempotencyKey) {
5134
- var _a;
5164
+ var _a, _b;
5135
5165
  const options = typeof optionsOrIdempotencyKey === "string" ? { idempotencyKey: optionsOrIdempotencyKey } : optionsOrIdempotencyKey != null ? optionsOrIdempotencyKey : {};
5136
5166
  const body = {
5137
5167
  idempotencyKey: (_a = options.idempotencyKey) != null ? _a : `cli-${Date.now()}-${Math.random().toString(36).slice(2)}`
5138
5168
  };
5139
5169
  if (options.parameters !== void 0) body.parameters = options.parameters;
5170
+ const note = (_b = options.note) == null ? void 0 : _b.trim();
5171
+ if (note) body.note = note;
5140
5172
  const { data, error } = await this.apiClient.POST("/api/suites/{id}/run", {
5141
5173
  params: { path: { id } },
5142
5174
  body
@@ -5153,6 +5185,198 @@ var SuitesApiService = class {
5153
5185
  }
5154
5186
  };
5155
5187
 
5188
+ // src/client-sdk/services/_shared/throw-handled-error.ts
5189
+ function throwIfHandledError({
5190
+ operation,
5191
+ error,
5192
+ response,
5193
+ status,
5194
+ message
5195
+ }) {
5196
+ var _a;
5197
+ const resolved = (_a = status != null ? status : response == null ? void 0 : response.status) != null ? _a : extractStatusFromResponse(error);
5198
+ const handledError = handledErrorFrom({
5199
+ operation,
5200
+ body: error,
5201
+ status: resolved,
5202
+ message
5203
+ });
5204
+ if (handledError) throw handledError;
5205
+ }
5206
+
5207
+ // src/client-sdk/services/run-plans/run-plans-api.service.ts
5208
+ var RunPlansApiError = class extends Error {
5209
+ constructor(message, operation, originalError, status) {
5210
+ super(message);
5211
+ this.operation = operation;
5212
+ this.originalError = originalError;
5213
+ this.status = status;
5214
+ this.name = "RunPlansApiError";
5215
+ }
5216
+ };
5217
+ var RunPlansApiService = class {
5218
+ constructor(config) {
5219
+ var _a;
5220
+ this.apiClient = (_a = config == null ? void 0 : config.langwatchApiClient) != null ? _a : createLangWatchApiClient();
5221
+ }
5222
+ handleApiError(operation, error, response) {
5223
+ var _a;
5224
+ const status = (_a = response == null ? void 0 : response.status) != null ? _a : extractStatusFromResponse(error);
5225
+ const message = formatApiErrorForOperation({
5226
+ operation,
5227
+ error,
5228
+ options: { status }
5229
+ });
5230
+ throwIfHandledError({ operation, error, response, message });
5231
+ throw new RunPlansApiError(message, operation, error, status);
5232
+ }
5233
+ /** The project's run plans. Archived plans are left out unless asked for. */
5234
+ async list(options) {
5235
+ const { data, error, response } = await this.apiClient.GET(
5236
+ "/api/v1/run-plans",
5237
+ _chunkLCG5Y2EGjs.__spreadValues.call(void 0, {}, (options == null ? void 0 : options.includeArchived) ? { params: { query: { includeArchived: "true" } } } : {})
5238
+ );
5239
+ if (error) this.handleApiError("list run plans", error, response);
5240
+ return data;
5241
+ }
5242
+ async get(id) {
5243
+ const { data, error, response } = await this.apiClient.GET(
5244
+ "/api/v1/run-plans/{id}",
5245
+ { params: { path: { id } } }
5246
+ );
5247
+ if (error) this.handleApiError(`get run plan "${id}"`, error, response);
5248
+ return data;
5249
+ }
5250
+ /**
5251
+ * Runs a configuration under a name.
5252
+ *
5253
+ * A note of only spaces is no note: sending an empty string would store a
5254
+ * value every reader then has to filter out.
5255
+ */
5256
+ async run(body) {
5257
+ const { data, error, response } = await this.apiClient.POST(
5258
+ "/api/v1/run-plans/run",
5259
+ { body: withTrimmedNote(body) }
5260
+ );
5261
+ if (error) this.handleApiError("run a run plan", error, response);
5262
+ return data;
5263
+ }
5264
+ /** Runs a plan again with the configuration it already holds. */
5265
+ async rerun(id, body = {}) {
5266
+ const { data, error, response } = await this.apiClient.POST(
5267
+ "/api/v1/run-plans/{id}/run",
5268
+ { params: { path: { id } }, body: withTrimmedNote(body) }
5269
+ );
5270
+ if (error) this.handleApiError(`rerun run plan "${id}"`, error, response);
5271
+ return data;
5272
+ }
5273
+ async archive(id) {
5274
+ const { data, error, response } = await this.apiClient.DELETE(
5275
+ "/api/v1/run-plans/{id}",
5276
+ { params: { path: { id } } }
5277
+ );
5278
+ if (error) this.handleApiError(`archive run plan "${id}"`, error, response);
5279
+ return data;
5280
+ }
5281
+ };
5282
+ function withTrimmedNote(body) {
5283
+ var _a;
5284
+ const note = (_a = body.note) == null ? void 0 : _a.trim();
5285
+ if (note) return _chunkLCG5Y2EGjs.__spreadProps.call(void 0, _chunkLCG5Y2EGjs.__spreadValues.call(void 0, {}, body), { note });
5286
+ const _b = body, { note: _dropped } = _b, rest = _chunkLCG5Y2EGjs.__objRest.call(void 0, _b, ["note"]);
5287
+ return rest;
5288
+ }
5289
+
5290
+ // src/client-sdk/services/test-suites/test-suites-api.service.ts
5291
+ var TestSuitesApiError = class extends Error {
5292
+ constructor(message, operation, originalError, status) {
5293
+ super(message);
5294
+ this.operation = operation;
5295
+ this.originalError = originalError;
5296
+ this.status = status;
5297
+ this.name = "TestSuitesApiError";
5298
+ }
5299
+ };
5300
+ var TestSuitesApiService = class {
5301
+ constructor(config) {
5302
+ var _a;
5303
+ this.apiClient = (_a = config == null ? void 0 : config.langwatchApiClient) != null ? _a : createLangWatchApiClient();
5304
+ }
5305
+ handleApiError(operation, error, response) {
5306
+ var _a;
5307
+ const status = (_a = response == null ? void 0 : response.status) != null ? _a : extractStatusFromResponse(error);
5308
+ const message = formatApiErrorForOperation({
5309
+ operation,
5310
+ error,
5311
+ options: { status }
5312
+ });
5313
+ throwIfHandledError({ operation, error, response, message });
5314
+ throw new TestSuitesApiError(message, operation, error, status);
5315
+ }
5316
+ /** The project's test suites. Archived suites are left out unless asked for. */
5317
+ async list(options) {
5318
+ const { data, error, response } = await this.apiClient.GET(
5319
+ "/api/v1/test-suites",
5320
+ _chunkLCG5Y2EGjs.__spreadValues.call(void 0, {}, (options == null ? void 0 : options.includeArchived) ? { params: { query: { includeArchived: "true" } } } : {})
5321
+ );
5322
+ if (error) this.handleApiError("list test suites", error, response);
5323
+ return data;
5324
+ }
5325
+ async create(params) {
5326
+ const { data, error, response } = await this.apiClient.POST(
5327
+ "/api/v1/test-suites",
5328
+ { body: params }
5329
+ );
5330
+ if (error) this.handleApiError("create test suite", error, response);
5331
+ return data;
5332
+ }
5333
+ async get(id) {
5334
+ const { data, error, response } = await this.apiClient.GET(
5335
+ "/api/v1/test-suites/{id}",
5336
+ { params: { path: { id } } }
5337
+ );
5338
+ if (error) this.handleApiError(`get test suite "${id}"`, error, response);
5339
+ return data;
5340
+ }
5341
+ /** Renames a suite. The slug is kept, so links and run history stay put. */
5342
+ async rename(id, params) {
5343
+ const { data, error, response } = await this.apiClient.PATCH(
5344
+ "/api/v1/test-suites/{id}",
5345
+ { params: { path: { id } }, body: params }
5346
+ );
5347
+ if (error) this.handleApiError(`rename test suite "${id}"`, error, response);
5348
+ return data;
5349
+ }
5350
+ /** Archives a suite. The scenarios filed in it are archived with it. */
5351
+ async archive(id) {
5352
+ const { data, error, response } = await this.apiClient.DELETE(
5353
+ "/api/v1/test-suites/{id}",
5354
+ { params: { path: { id } } }
5355
+ );
5356
+ if (error)
5357
+ this.handleApiError(`archive test suite "${id}"`, error, response);
5358
+ return data;
5359
+ }
5360
+ /**
5361
+ * Runs every scenario filed in the suite against the targets sent with the
5362
+ * request. A note of only spaces is no note.
5363
+ */
5364
+ async run(id, body) {
5365
+ var _a;
5366
+ const note = (_a = body.note) == null ? void 0 : _a.trim();
5367
+ const _b = body, { note: _dropped } = _b, rest = _chunkLCG5Y2EGjs.__objRest.call(void 0, _b, ["note"]);
5368
+ const { data, error, response } = await this.apiClient.POST(
5369
+ "/api/v1/test-suites/{id}/run",
5370
+ {
5371
+ params: { path: { id } },
5372
+ body: note ? _chunkLCG5Y2EGjs.__spreadProps.call(void 0, _chunkLCG5Y2EGjs.__spreadValues.call(void 0, {}, rest), { note }) : rest
5373
+ }
5374
+ );
5375
+ if (error) this.handleApiError(`run test suite "${id}"`, error, response);
5376
+ return data;
5377
+ }
5378
+ };
5379
+
5156
5380
  // src/client-sdk/services/workflows/workflows-api.service.ts
5157
5381
  var WorkflowsApiError = class extends Error {
5158
5382
  constructor(message, operation, originalError) {
@@ -5165,7 +5389,7 @@ var WorkflowsApiError = class extends Error {
5165
5389
  var WorkflowsApiService = class {
5166
5390
  constructor(config) {
5167
5391
  var _a;
5168
- this.endpoint = _chunkHUMHSRVPjs.resolveEndpoint.call(void 0, config == null ? void 0 : config.endpoint);
5392
+ this.endpoint = _chunkAJDFFRSWjs.resolveEndpoint.call(void 0, config == null ? void 0 : config.endpoint);
5169
5393
  this.apiClient = (_a = config == null ? void 0 : config.langwatchApiClient) != null ? _a : createLangWatchApiClient(void 0, this.endpoint);
5170
5394
  this.experimentsApiService = new ExperimentsApiService({
5171
5395
  langwatchApiClient: this.apiClient
@@ -5299,28 +5523,28 @@ var AgentsApiService = class {
5299
5523
  throw new AgentsApiError(message, operation, error);
5300
5524
  }
5301
5525
  async list(params) {
5302
- const { data, error } = await this.apiClient.GET("/api/agents", {
5526
+ const { data, error } = await this.apiClient.GET("/api/v1/agents", {
5303
5527
  params: { query: params }
5304
5528
  });
5305
5529
  if (error) this.handleApiError("list agents", error);
5306
5530
  return data;
5307
5531
  }
5308
5532
  async get(id) {
5309
- const { data, error } = await this.apiClient.GET("/api/agents/{id}", {
5533
+ const { data, error } = await this.apiClient.GET("/api/v1/agents/{id}", {
5310
5534
  params: { path: { id } }
5311
5535
  });
5312
5536
  if (error) this.handleApiError(`get agent "${id}"`, error);
5313
5537
  return data;
5314
5538
  }
5315
5539
  async create(params) {
5316
- const { data, error } = await this.apiClient.POST("/api/agents", {
5540
+ const { data, error } = await this.apiClient.POST("/api/v1/agents", {
5317
5541
  body: params
5318
5542
  });
5319
5543
  if (error) this.handleApiError("create agent", error);
5320
5544
  return data;
5321
5545
  }
5322
5546
  async update(id, params) {
5323
- const { data, error } = await this.apiClient.PATCH("/api/agents/{id}", {
5547
+ const { data, error } = await this.apiClient.PATCH("/api/v1/agents/{id}", {
5324
5548
  params: { path: { id } },
5325
5549
  body: params
5326
5550
  });
@@ -5328,12 +5552,37 @@ var AgentsApiService = class {
5328
5552
  return data;
5329
5553
  }
5330
5554
  async delete(id) {
5331
- const { data, error } = await this.apiClient.DELETE("/api/agents/{id}", {
5555
+ const { data, error } = await this.apiClient.DELETE("/api/v1/agents/{id}", {
5332
5556
  params: { path: { id } }
5333
5557
  });
5334
5558
  if (error) this.handleApiError(`delete agent "${id}"`, error);
5335
5559
  return data;
5336
5560
  }
5561
+ /**
5562
+ * Runs one turn of a connected agent through the relay: the platform
5563
+ * dispatches it to a live instance and answers with the function's output.
5564
+ */
5565
+ async call(id, body) {
5566
+ const { data, error } = await this.apiClient.POST("/api/v1/agents/{id}/call", {
5567
+ params: { path: { id } },
5568
+ body
5569
+ });
5570
+ if (error) this.handleApiError(`call agent "${id}"`, error);
5571
+ return data;
5572
+ }
5573
+ /**
5574
+ * Runs one scripted scenario against an agent: the user sends "ping", the
5575
+ * agent answers, and the run succeeds when the answer arrives. The project
5576
+ * gains no scenario, run plan or test suite, and the answer carries the run
5577
+ * ids to follow.
5578
+ */
5579
+ async test(id) {
5580
+ const { data, error } = await this.apiClient.POST("/api/v1/agents/{id}/test", {
5581
+ params: { path: { id } }
5582
+ });
5583
+ if (error) this.handleApiError(`test agent "${id}"`, error);
5584
+ return data;
5585
+ }
5337
5586
  };
5338
5587
 
5339
5588
  // src/client-sdk/services/annotations/annotations-api.service.ts
@@ -5693,25 +5942,6 @@ var SimulationRunsApiService = class {
5693
5942
  }
5694
5943
  };
5695
5944
 
5696
- // src/client-sdk/services/_shared/throw-handled-error.ts
5697
- function throwIfHandledError({
5698
- operation,
5699
- error,
5700
- response,
5701
- status,
5702
- message
5703
- }) {
5704
- var _a;
5705
- const resolved = (_a = status != null ? status : response == null ? void 0 : response.status) != null ? _a : extractStatusFromResponse(error);
5706
- const handledError = handledErrorFrom({
5707
- operation,
5708
- body: error,
5709
- status: resolved,
5710
- message
5711
- });
5712
- if (handledError) throw handledError;
5713
- }
5714
-
5715
5945
  // src/client-sdk/services/monitors/monitors-api.service.ts
5716
5946
  var MonitorsApiError = class extends Error {
5717
5947
  constructor(message, operation, originalError) {
@@ -5725,12 +5955,12 @@ var MonitorsApiService = class {
5725
5955
  constructor(config) {
5726
5956
  var _a, _b, _c;
5727
5957
  this.apiKey = (_c = (_b = (_a = config == null ? void 0 : config.apiKey) != null ? _a : scopedApiKey()) != null ? _b : process.env.LANGWATCH_API_KEY) != null ? _c : "";
5728
- this.endpoint = _chunkHUMHSRVPjs.resolveEndpoint.call(void 0, config == null ? void 0 : config.endpoint);
5958
+ this.endpoint = _chunkAJDFFRSWjs.resolveEndpoint.call(void 0, config == null ? void 0 : config.endpoint);
5729
5959
  }
5730
5960
  async request(path2, options) {
5731
5961
  var _a, _b;
5732
5962
  const response = await fetch(`${this.endpoint}${path2}`, _chunkLCG5Y2EGjs.__spreadProps.call(void 0, _chunkLCG5Y2EGjs.__spreadValues.call(void 0, {}, options), {
5733
- headers: _chunkLCG5Y2EGjs.__spreadValues.call(void 0, _chunkLCG5Y2EGjs.__spreadProps.call(void 0, _chunkLCG5Y2EGjs.__spreadValues.call(void 0, {}, _chunkNFFB3DWWjs.buildAuthHeaders.call(void 0, { apiKey: this.apiKey })), {
5963
+ headers: _chunkLCG5Y2EGjs.__spreadValues.call(void 0, _chunkLCG5Y2EGjs.__spreadProps.call(void 0, _chunkLCG5Y2EGjs.__spreadValues.call(void 0, {}, _chunk2PD3YA5Hjs.buildAuthHeaders.call(void 0, { apiKey: this.apiKey })), {
5734
5964
  "Content-Type": "application/json"
5735
5965
  }), options == null ? void 0 : options.headers)
5736
5966
  }));
@@ -5800,12 +6030,12 @@ var SecretsApiService = class {
5800
6030
  constructor(config) {
5801
6031
  var _a, _b, _c;
5802
6032
  this.apiKey = (_c = (_b = (_a = config == null ? void 0 : config.apiKey) != null ? _a : scopedApiKey()) != null ? _b : process.env.LANGWATCH_API_KEY) != null ? _c : "";
5803
- this.endpoint = _chunkHUMHSRVPjs.resolveEndpoint.call(void 0, config == null ? void 0 : config.endpoint);
6033
+ this.endpoint = _chunkAJDFFRSWjs.resolveEndpoint.call(void 0, config == null ? void 0 : config.endpoint);
5804
6034
  }
5805
6035
  async request(path2, options) {
5806
6036
  var _a, _b;
5807
6037
  const response = await fetch(`${this.endpoint}${path2}`, _chunkLCG5Y2EGjs.__spreadProps.call(void 0, _chunkLCG5Y2EGjs.__spreadValues.call(void 0, {}, options), {
5808
- headers: _chunkLCG5Y2EGjs.__spreadValues.call(void 0, _chunkLCG5Y2EGjs.__spreadProps.call(void 0, _chunkLCG5Y2EGjs.__spreadValues.call(void 0, {}, _chunkNFFB3DWWjs.buildAuthHeaders.call(void 0, { apiKey: this.apiKey })), {
6038
+ headers: _chunkLCG5Y2EGjs.__spreadValues.call(void 0, _chunkLCG5Y2EGjs.__spreadProps.call(void 0, _chunkLCG5Y2EGjs.__spreadValues.call(void 0, {}, _chunk2PD3YA5Hjs.buildAuthHeaders.call(void 0, { apiKey: this.apiKey })), {
5809
6039
  "Content-Type": "application/json"
5810
6040
  }), options == null ? void 0 : options.headers)
5811
6041
  }));
@@ -5935,7 +6165,7 @@ var VirtualKeysApiError = class extends Error {
5935
6165
  var VirtualKeysApiService = class {
5936
6166
  constructor(config) {
5937
6167
  var _a, _b, _c, _d;
5938
- this.endpoint = _chunkHUMHSRVPjs.resolveEndpoint.call(void 0, config == null ? void 0 : config.endpoint);
6168
+ this.endpoint = _chunkAJDFFRSWjs.resolveEndpoint.call(void 0, config == null ? void 0 : config.endpoint);
5939
6169
  this.apiKey = (_c = (_b = (_a = config == null ? void 0 : config.apiKey) != null ? _a : scopedApiKey()) != null ? _b : process.env.LANGWATCH_API_KEY) != null ? _c : "";
5940
6170
  this.projectId = (_d = config == null ? void 0 : config.projectId) != null ? _d : process.env.LANGWATCH_PROJECT_ID;
5941
6171
  }
@@ -6163,7 +6393,7 @@ var GatewayBudgetsApiError = class extends Error {
6163
6393
  var GatewayBudgetsApiService = class {
6164
6394
  constructor(config) {
6165
6395
  var _a, _b, _c, _d;
6166
- this.endpoint = _chunkHUMHSRVPjs.resolveEndpoint.call(void 0, config == null ? void 0 : config.endpoint);
6396
+ this.endpoint = _chunkAJDFFRSWjs.resolveEndpoint.call(void 0, config == null ? void 0 : config.endpoint);
6167
6397
  this.apiKey = (_c = (_b = (_a = config == null ? void 0 : config.apiKey) != null ? _a : scopedApiKey()) != null ? _b : process.env.LANGWATCH_API_KEY) != null ? _c : "";
6168
6398
  this.projectId = (_d = config == null ? void 0 : config.projectId) != null ? _d : process.env.LANGWATCH_PROJECT_ID;
6169
6399
  }
@@ -6422,7 +6652,7 @@ var SpendEventsApiError = class extends Error {
6422
6652
  var SpendEventsApiService = class {
6423
6653
  constructor(config) {
6424
6654
  var _a, _b, _c;
6425
- this.endpoint = _chunkHUMHSRVPjs.resolveEndpoint.call(void 0, config == null ? void 0 : config.endpoint);
6655
+ this.endpoint = _chunkAJDFFRSWjs.resolveEndpoint.call(void 0, config == null ? void 0 : config.endpoint);
6426
6656
  this.apiKey = (_c = (_b = (_a = config == null ? void 0 : config.apiKey) != null ? _a : scopedApiKey()) != null ? _b : process.env.LANGWATCH_API_KEY) != null ? _c : "";
6427
6657
  }
6428
6658
  async request(operation, path2, init) {
@@ -6639,7 +6869,7 @@ var WebhooksApiError = class extends Error {
6639
6869
  var WebhooksApiService = class {
6640
6870
  constructor(config) {
6641
6871
  var _a, _b, _c;
6642
- this.endpoint = _chunkHUMHSRVPjs.resolveEndpoint.call(void 0, config == null ? void 0 : config.endpoint);
6872
+ this.endpoint = _chunkAJDFFRSWjs.resolveEndpoint.call(void 0, config == null ? void 0 : config.endpoint);
6643
6873
  this.apiKey = (_c = (_b = (_a = config == null ? void 0 : config.apiKey) != null ? _a : scopedApiKey()) != null ? _b : process.env.LANGWATCH_API_KEY) != null ? _c : "";
6644
6874
  }
6645
6875
  async request(operation, path2, init) {
@@ -6976,7 +7206,7 @@ var TeamsApiService = class {
6976
7206
  constructor(config) {
6977
7207
  _chunkLCG5Y2EGjs.__privateAdd.call(void 0, this, _request);
6978
7208
  _chunkLCG5Y2EGjs.__privateSet.call(void 0, this, _request, createManagementRequest({
6979
- endpoint: _chunkHUMHSRVPjs.resolveEndpoint.call(void 0, config == null ? void 0 : config.endpoint),
7209
+ endpoint: _chunkAJDFFRSWjs.resolveEndpoint.call(void 0, config == null ? void 0 : config.endpoint),
6980
7210
  token: resolveManagementToken({ apiKey: config == null ? void 0 : config.apiKey }),
6981
7211
  errorFactory: ({ message, operation, body }) => new TeamsApiError(message, operation, body)
6982
7212
  }));
@@ -7063,7 +7293,7 @@ var ProjectsApiError = class extends Error {
7063
7293
  var ProjectsApiService = class {
7064
7294
  constructor(config) {
7065
7295
  var _a, _b, _c;
7066
- this.endpoint = _chunkHUMHSRVPjs.resolveEndpoint.call(void 0, config == null ? void 0 : config.endpoint);
7296
+ this.endpoint = _chunkAJDFFRSWjs.resolveEndpoint.call(void 0, config == null ? void 0 : config.endpoint);
7067
7297
  this.apiKey = (_c = (_b = (_a = config == null ? void 0 : config.apiKey) != null ? _a : scopedApiKey()) != null ? _b : process.env.LANGWATCH_API_KEY) != null ? _c : "";
7068
7298
  }
7069
7299
  /**
@@ -7161,7 +7391,7 @@ var TracesError = class extends Error {
7161
7391
  };
7162
7392
 
7163
7393
  // src/client-sdk/services/traces/tracing/tracer.ts
7164
- var tracer3 = _chunk4ERRCKOHjs.getLangWatchTracer.call(void 0, `${_chunkNFFB3DWWjs.LANGWATCH_SDK_NAME_CLIENT}.traces`, _chunkNFFB3DWWjs.LANGWATCH_SDK_VERSION);
7394
+ var tracer3 = _chunk4ERRCKOHjs.getLangWatchTracer.call(void 0, `${_chunk2PD3YA5Hjs.LANGWATCH_SDK_NAME_CLIENT}.traces`, _chunk2PD3YA5Hjs.LANGWATCH_SDK_VERSION);
7165
7395
 
7166
7396
  // src/client-sdk/services/traces/service.ts
7167
7397
  var TracesService = class {
@@ -7233,7 +7463,7 @@ var LangWatch = class {
7233
7463
  _chunkLCG5Y2EGjs.__privateAdd.call(void 0, this, _projects);
7234
7464
  var _a, _b, _c;
7235
7465
  const apiKey = (_c = (_b = (_a = options.apiKey) != null ? _a : scopedApiKey()) != null ? _b : process.env.LANGWATCH_API_KEY) != null ? _c : "";
7236
- const endpoint = _chunkHUMHSRVPjs.resolveEndpoint.call(void 0, options.endpoint);
7466
+ const endpoint = _chunkAJDFFRSWjs.resolveEndpoint.call(void 0, options.endpoint);
7237
7467
  this.config = _chunkLCG5Y2EGjs.__privateMethod.call(void 0, this, _LangWatch_instances, createInternalConfig_fn).call(this, {
7238
7468
  apiKey,
7239
7469
  endpoint,
@@ -7264,6 +7494,8 @@ var LangWatch = class {
7264
7494
  this.evaluators = new EvaluatorsApiService(this.config);
7265
7495
  this.scenarios = new ScenariosApiService(this.config);
7266
7496
  this.suites = new SuitesApiService(this.config);
7497
+ this.runPlans = new RunPlansApiService(this.config);
7498
+ this.testSuites = new TestSuitesApiService(this.config);
7267
7499
  this.workflows = new WorkflowsApiService(this.config);
7268
7500
  this.agents = new AgentsApiService(this.config);
7269
7501
  this.annotations = new AnnotationsApiService(this.config);
@@ -7473,5 +7705,5 @@ var logger = {
7473
7705
 
7474
7706
 
7475
7707
 
7476
- exports.ComparisonError = ComparisonError; 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 = _chunk73QOHSHUjs.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 = _chunkNFFB3DWWjs.LangWatchTraceExporter; exports.LangWatchHandledError = LangWatchHandledError; exports.ProjectsApiError = ProjectsApiError; exports.ProjectsApiService = ProjectsApiService; exports.SpendEventsApiError = SpendEventsApiError; exports.SpendEventsApiService = SpendEventsApiService; exports.TargetMetadataConflictError = TargetMetadataConflictError; exports.TeamsApiError = TeamsApiError; exports.TeamsApiService = TeamsApiService; 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 = _chunkLCG5Y2EGjs.attributes_exports; exports.getLangWatchLogger = _chunkNFFB3DWWjs.getLangWatchLogger; exports.getLangWatchTracer = _chunk4ERRCKOHjs.getLangWatchTracer; exports.isLangWatchHandledError = isLangWatchHandledError; exports.logger = logger; exports.verifyWebhookSignature = verifyWebhookSignature;
7708
+ exports.ComparisonError = ComparisonError; 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 = _chunk73QOHSHUjs.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 = _chunk2PD3YA5Hjs.LangWatchTraceExporter; exports.LangWatchHandledError = LangWatchHandledError; exports.ProjectsApiError = ProjectsApiError; exports.ProjectsApiService = ProjectsApiService; exports.SpendEventsApiError = SpendEventsApiError; exports.SpendEventsApiService = SpendEventsApiService; exports.TargetMetadataConflictError = TargetMetadataConflictError; exports.TeamsApiError = TeamsApiError; exports.TeamsApiService = TeamsApiService; 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 = _chunkLCG5Y2EGjs.attributes_exports; exports.getLangWatchLogger = _chunk2PD3YA5Hjs.getLangWatchLogger; exports.getLangWatchTracer = _chunk4ERRCKOHjs.getLangWatchTracer; exports.isLangWatchHandledError = isLangWatchHandledError; exports.logger = logger; exports.verifyWebhookSignature = verifyWebhookSignature;
7477
7709
  //# sourceMappingURL=index.js.map