langwatch 0.9.0 → 0.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 (81) hide show
  1. package/dist/{add-V2V2U6OX.js → add-UB5U3K3M.js} +11 -11
  2. package/dist/add-UB5U3K3M.js.map +1 -0
  3. package/dist/{add-KNE3HWRY.mjs → add-XV5SUAXF.mjs} +8 -8
  4. package/dist/add-XV5SUAXF.mjs.map +1 -0
  5. package/dist/{chunk-XBHIDR76.mjs → chunk-556ZFJMK.mjs} +3 -3
  6. package/dist/{chunk-CKIZDPIJ.js → chunk-5MQQRSVM.js} +1 -1
  7. package/dist/{chunk-CKIZDPIJ.js.map → chunk-5MQQRSVM.js.map} +1 -1
  8. package/dist/{chunk-SNDTNU3T.js → chunk-ASTAIRXG.js} +2 -2
  9. package/dist/{chunk-SNDTNU3T.js.map → chunk-ASTAIRXG.js.map} +1 -1
  10. package/dist/{chunk-FISQBF2P.js → chunk-D4H6PR6H.js} +153 -76
  11. package/dist/chunk-D4H6PR6H.js.map +1 -0
  12. package/dist/{chunk-WHPBZSTS.mjs → chunk-IIUI2XYW.mjs} +2 -2
  13. package/dist/{chunk-2UTO2QPL.js → chunk-JQYW7RY7.js} +17 -17
  14. package/dist/{chunk-2UTO2QPL.js.map → chunk-JQYW7RY7.js.map} +1 -1
  15. package/dist/{chunk-SMUOMBKY.mjs → chunk-LKE6DMUP.mjs} +2 -2
  16. package/dist/chunk-LKE6DMUP.mjs.map +1 -0
  17. package/dist/{chunk-NQ7TYHRT.js → chunk-N7PJJMU2.js} +2 -2
  18. package/dist/chunk-N7PJJMU2.js.map +1 -0
  19. package/dist/{chunk-A43BYF5Q.js → chunk-ONXIZKC6.js} +11 -11
  20. package/dist/{chunk-A43BYF5Q.js.map → chunk-ONXIZKC6.js.map} +1 -1
  21. package/dist/{chunk-I2SOBPAF.mjs → chunk-RSIPLYVA.mjs} +1 -1
  22. package/dist/{chunk-I2SOBPAF.mjs.map → chunk-RSIPLYVA.mjs.map} +1 -1
  23. package/dist/{chunk-6VUZPNOC.mjs → chunk-WZ7FYUHN.mjs} +139 -62
  24. package/dist/chunk-WZ7FYUHN.mjs.map +1 -0
  25. package/dist/{chunk-FEL5FLHA.mjs → chunk-ZEPKV5YO.mjs} +2 -2
  26. package/dist/cli/index.js +6 -6
  27. package/dist/cli/index.js.map +1 -1
  28. package/dist/cli/index.mjs +6 -6
  29. package/dist/cli/index.mjs.map +1 -1
  30. package/dist/{implementation-TF91Gn0l.d.ts → implementation-CPxv2BdW.d.ts} +1 -1
  31. package/dist/{implementation-pq0g2B5y.d.mts → implementation-CVrmD0bz.d.mts} +1 -1
  32. package/dist/index.d.mts +581 -31
  33. package/dist/index.d.ts +581 -31
  34. package/dist/index.js +977 -17
  35. package/dist/index.js.map +1 -1
  36. package/dist/index.mjs +969 -9
  37. package/dist/index.mjs.map +1 -1
  38. package/dist/{list-VWXENE3O.js → list-DUNP46AD.js} +10 -10
  39. package/dist/{list-VWXENE3O.js.map → list-DUNP46AD.js.map} +1 -1
  40. package/dist/{list-4BFJIHYB.mjs → list-T4QS6CT2.mjs} +7 -7
  41. package/dist/{login-6PM2MUZS.js → login-3H27NIOD.js} +4 -4
  42. package/dist/{login-6PM2MUZS.js.map → login-3H27NIOD.js.map} +1 -1
  43. package/dist/{login-CEO47GSW.mjs → login-T2ET7TKH.mjs} +3 -3
  44. package/dist/login-T2ET7TKH.mjs.map +1 -0
  45. package/dist/observability-sdk/index.d.mts +3 -3
  46. package/dist/observability-sdk/index.d.ts +3 -3
  47. package/dist/observability-sdk/index.js +6 -6
  48. package/dist/observability-sdk/index.js.map +1 -1
  49. package/dist/observability-sdk/index.mjs +10 -10
  50. package/dist/observability-sdk/instrumentation/langchain/index.d.mts +1 -1
  51. package/dist/observability-sdk/instrumentation/langchain/index.d.ts +1 -1
  52. package/dist/observability-sdk/instrumentation/langchain/index.js +16 -16
  53. package/dist/observability-sdk/instrumentation/langchain/index.mjs +2 -2
  54. package/dist/observability-sdk/setup/node/index.js +14 -14
  55. package/dist/observability-sdk/setup/node/index.js.map +1 -1
  56. package/dist/observability-sdk/setup/node/index.mjs +4 -4
  57. package/dist/observability-sdk/setup/node/index.mjs.map +1 -1
  58. package/dist/{remove-5YFEQXTZ.mjs → remove-F5RM4775.mjs} +7 -7
  59. package/dist/{remove-KVWGJOJY.js → remove-V4JL5Z4U.js} +9 -9
  60. package/dist/{remove-KVWGJOJY.js.map → remove-V4JL5Z4U.js.map} +1 -1
  61. package/dist/{sync-6BHY2J72.js → sync-DIOKWE6R.js} +11 -11
  62. package/dist/sync-DIOKWE6R.js.map +1 -0
  63. package/dist/{sync-3P54PWWR.mjs → sync-VGWOLOLJ.mjs} +9 -9
  64. package/dist/sync-VGWOLOLJ.mjs.map +1 -0
  65. package/dist/{types-DhEYjnRD.d.mts → types-Kts5RGLY.d.mts} +15 -1
  66. package/dist/{types-CAQOMGrf.d.ts → types-usU5mTCX.d.ts} +15 -1
  67. package/package.json +3 -2
  68. package/dist/add-KNE3HWRY.mjs.map +0 -1
  69. package/dist/add-V2V2U6OX.js.map +0 -1
  70. package/dist/chunk-6VUZPNOC.mjs.map +0 -1
  71. package/dist/chunk-FISQBF2P.js.map +0 -1
  72. package/dist/chunk-NQ7TYHRT.js.map +0 -1
  73. package/dist/chunk-SMUOMBKY.mjs.map +0 -1
  74. package/dist/login-CEO47GSW.mjs.map +0 -1
  75. package/dist/sync-3P54PWWR.mjs.map +0 -1
  76. package/dist/sync-6BHY2J72.js.map +0 -1
  77. /package/dist/{chunk-XBHIDR76.mjs.map → chunk-556ZFJMK.mjs.map} +0 -0
  78. /package/dist/{chunk-WHPBZSTS.mjs.map → chunk-IIUI2XYW.mjs.map} +0 -0
  79. /package/dist/{chunk-FEL5FLHA.mjs.map → chunk-ZEPKV5YO.mjs.map} +0 -0
  80. /package/dist/{list-4BFJIHYB.mjs.map → list-T4QS6CT2.mjs.map} +0 -0
  81. /package/dist/{remove-5YFEQXTZ.mjs.map → remove-F5RM4775.mjs.map} +0 -0
@@ -1,3 +1,6 @@
1
+ import {
2
+ getLangWatchTracer
3
+ } from "./chunk-IIUI2XYW.mjs";
1
4
  import {
2
5
  DEFAULT_ENDPOINT,
3
6
  LANGWATCH_SDK_LANGUAGE,
@@ -6,15 +9,12 @@ import {
6
9
  LANGWATCH_SDK_RUNTIME,
7
10
  LANGWATCH_SDK_VERSION,
8
11
  version
9
- } from "./chunk-SMUOMBKY.mjs";
10
- import {
11
- getLangWatchTracer
12
- } from "./chunk-WHPBZSTS.mjs";
12
+ } from "./chunk-LKE6DMUP.mjs";
13
13
  import {
14
14
  NoOpLogger,
15
15
  shouldCaptureInput,
16
16
  shouldCaptureOutput
17
- } from "./chunk-I2SOBPAF.mjs";
17
+ } from "./chunk-RSIPLYVA.mjs";
18
18
  import {
19
19
  FileManager,
20
20
  PromptConverter,
@@ -26,6 +26,43 @@ import {
26
26
  __spreadValues
27
27
  } from "./chunk-URTD2WOC.mjs";
28
28
 
29
+ // src/client-sdk/services/prompts/errors/prompts.error.ts
30
+ var PromptsError = class extends Error {
31
+ constructor(message) {
32
+ super(message);
33
+ this.name = "PromptsError";
34
+ }
35
+ };
36
+
37
+ // src/client-sdk/services/prompts/errors/prompt-compilation.error.ts
38
+ var PromptCompilationError = class extends Error {
39
+ constructor(message, template, originalError) {
40
+ super(message);
41
+ this.template = template;
42
+ this.originalError = originalError;
43
+ this.name = "PromptCompilationError";
44
+ }
45
+ };
46
+
47
+ // src/client-sdk/services/prompts/errors/prompt-validation.error.ts
48
+ var PromptValidationError = class extends Error {
49
+ constructor(message, validationErrors) {
50
+ super(message);
51
+ this.validationErrors = validationErrors;
52
+ this.name = "PromptValidationError";
53
+ }
54
+ };
55
+
56
+ // src/client-sdk/services/prompts/errors/prompts-api.error.ts
57
+ var PromptsApiError = class extends PromptsError {
58
+ constructor(message, operation, originalError) {
59
+ super(message);
60
+ this.operation = operation;
61
+ this.originalError = originalError;
62
+ this.name = "PromptsApiError";
63
+ }
64
+ };
65
+
29
66
  // src/client-sdk/services/prompts/tracing/prompt-tracing.decorator.ts
30
67
  var PromptTracingDecorator = class {
31
68
  constructor(target) {
@@ -257,29 +294,22 @@ var createLangWatchApiClient = (apiKey = ((_a) => (_a = process.env.LANGWATCH_AP
257
294
  };
258
295
 
259
296
  // src/client-sdk/services/prompts/prompts-api.service.ts
260
- var PromptsError = class extends Error {
261
- constructor(message, operation, originalError) {
262
- super(message);
263
- this.operation = operation;
264
- this.originalError = originalError;
265
- this.name = "PromptsError";
266
- }
267
- };
268
297
  var PromptsApiService = class {
269
298
  constructor(config) {
270
299
  /**
271
300
  * Fetches a single prompt by its ID.
272
301
  * @param id The prompt's unique identifier.
273
302
  * @returns Raw PromptResponse data.
274
- * @throws {PromptsError} If the API call fails.
303
+ * @throws {PromptsApiError} If the API call fails.
275
304
  */
276
305
  this.get = async (id, options) => {
306
+ const versionNumber = (options == null ? void 0 : options.version) && options.version !== "latest" ? parseInt(options.version, 10) : void 0;
277
307
  const { data, error } = await this.apiClient.GET(
278
308
  "/api/prompts/{id}",
279
309
  {
280
310
  params: { path: { id } },
281
311
  query: {
282
- version: options == null ? void 0 : options.version
312
+ version: Number.isNaN(versionNumber) ? void 0 : versionNumber
283
313
  }
284
314
  }
285
315
  );
@@ -297,15 +327,15 @@ var PromptsApiService = class {
297
327
  );
298
328
  }
299
329
  /**
300
- * Handles API errors by throwing a PromptsError with operation context.
330
+ * Handles API errors by throwing a PromptsApiError with operation context.
301
331
  * @param operation Description of the operation being performed.
302
332
  * @param error The error object returned from the API client.
303
- * @throws {PromptsError}
333
+ * @throws {PromptsApiError}
304
334
  */
305
335
  handleApiError(operation, error) {
306
336
  var _a, _b;
307
337
  const errorMessage = typeof error === "string" ? error : (error == null ? void 0 : error.error) != null ? typeof error.error === "string" ? error.error : (_a = error.error.message) != null ? _a : JSON.stringify(error.error, Object.getOwnPropertyNames(error.error)) : (_b = error == null ? void 0 : error.message) != null ? _b : "Unknown error occurred";
308
- throw new PromptsError(
338
+ throw new PromptsApiError(
309
339
  `Failed to ${operation}: ${errorMessage}`,
310
340
  operation,
311
341
  error
@@ -314,7 +344,7 @@ var PromptsApiService = class {
314
344
  /**
315
345
  * Fetches all prompts from the API.
316
346
  * @returns Array of raw PromptResponse data.
317
- * @throws {PromptsError} If the API call fails.
347
+ * @throws {PromptsApiError} If the API call fails.
318
348
  */
319
349
  async getAll() {
320
350
  const { data, error } = await this.apiClient.GET("/api/prompts");
@@ -325,15 +355,16 @@ var PromptsApiService = class {
325
355
  * Validates if a prompt exists.
326
356
  * @param id The prompt's unique identifier.
327
357
  * @returns True if prompt exists, false otherwise.
328
- * @throws {PromptsError} If the API call fails (not 404).
358
+ * @throws {PromptsApiError} If the API call fails (not 404).
329
359
  */
330
360
  async exists(id) {
331
- var _a;
332
361
  try {
333
362
  await this.get(id);
334
363
  return true;
335
364
  } catch (error) {
336
- if (error instanceof PromptsError && ((_a = error.originalError) == null ? void 0 : _a.statusCode) === 404) {
365
+ const originalError = error instanceof PromptsApiError ? error.originalError : null;
366
+ const statusCode = originalError != null && typeof originalError === "object" && "statusCode" in originalError ? originalError.statusCode : null;
367
+ if (statusCode === 404) {
337
368
  return false;
338
369
  }
339
370
  throw error;
@@ -343,7 +374,7 @@ var PromptsApiService = class {
343
374
  * Creates a new prompt.
344
375
  * @param params The prompt creation payload, matching the OpenAPI schema.
345
376
  * @returns Raw PromptResponse data of the created prompt.
346
- * @throws {PromptsError} If the API call fails.
377
+ * @throws {PromptsApiError} If the API call fails.
347
378
  */
348
379
  async create(params) {
349
380
  const { data, error } = await this.apiClient.POST(
@@ -360,7 +391,7 @@ var PromptsApiService = class {
360
391
  * @param id The prompt's unique identifier.
361
392
  * @param params The update payload, matching the OpenAPI schema.
362
393
  * @returns Raw PromptResponse data of the updated prompt.
363
- * @throws {PromptsError} If the API call fails.
394
+ * @throws {PromptsApiError} If the API call fails.
364
395
  */
365
396
  async update(id, params) {
366
397
  const { error, data: updatedPrompt } = await this.apiClient.PUT("/api/prompts/{id}", {
@@ -373,7 +404,7 @@ var PromptsApiService = class {
373
404
  /**
374
405
  * Deletes a prompt by its ID.
375
406
  * @param id The prompt's unique identifier.
376
- * @throws {PromptsError} If the API call fails.
407
+ * @throws {PromptsApiError} If the API call fails.
377
408
  */
378
409
  async delete(id) {
379
410
  const { data, error } = await this.apiClient.DELETE(
@@ -389,7 +420,7 @@ var PromptsApiService = class {
389
420
  * Fetches all versions for a given prompt.
390
421
  * @param id The prompt's unique identifier.
391
422
  * @returns Array of raw PromptResponse data for each version.
392
- * @throws {PromptsError} If the API call fails.
423
+ * @throws {PromptsApiError} If the API call fails.
393
424
  */
394
425
  async getVersions(id) {
395
426
  const { data, error } = await this.apiClient.GET(
@@ -407,7 +438,7 @@ var PromptsApiService = class {
407
438
  * @param handle The prompt's handle/identifier.
408
439
  * @param config Local prompt configuration.
409
440
  * @returns Object with created flag and raw PromptResponse data.
410
- * @throws {PromptsError} If the API call fails.
441
+ * @throws {PromptsApiError} If the API call fails.
411
442
  */
412
443
  async upsert(handle, config) {
413
444
  var _a, _b;
@@ -439,6 +470,7 @@ var PromptsApiService = class {
439
470
  }
440
471
  /**
441
472
  * Sync a prompt with local content, handling conflicts and version management
473
+ * You probably don't need to use this method directly.
442
474
  */
443
475
  async sync(params) {
444
476
  var _a, _b;
@@ -465,11 +497,20 @@ var PromptsApiService = class {
465
497
  };
466
498
  } catch (error) {
467
499
  const message = error instanceof Error ? error.message : "Unknown error occurred";
468
- throw new PromptsError(message, "sync", error);
500
+ throw new PromptsApiError(message, "sync", error);
469
501
  }
470
502
  }
471
503
  };
472
504
 
505
+ // src/client-sdk/services/prompts/types.ts
506
+ var FetchPolicy = /* @__PURE__ */ ((FetchPolicy2) => {
507
+ FetchPolicy2["MATERIALIZED_FIRST"] = "MATERIALIZED_FIRST";
508
+ FetchPolicy2["ALWAYS_FETCH"] = "ALWAYS_FETCH";
509
+ FetchPolicy2["CACHE_TTL"] = "CACHE_TTL";
510
+ FetchPolicy2["MATERIALIZED_ONLY"] = "MATERIALIZED_ONLY";
511
+ return FetchPolicy2;
512
+ })(FetchPolicy || {});
513
+
473
514
  // src/client-sdk/services/prompts/prompt.ts
474
515
  import { Liquid } from "liquidjs";
475
516
 
@@ -511,25 +552,6 @@ var promptMetadataSchema = z.object({
511
552
  });
512
553
  var promptDataSchema = z.object(__spreadValues(__spreadValues({}, corePromptDataSchema.shape), promptMetadataSchema.shape));
513
554
 
514
- // src/client-sdk/services/prompts/errors/prompt-compilation.error.ts
515
- var PromptCompilationError = class extends Error {
516
- constructor(message, template, originalError) {
517
- super(message);
518
- this.template = template;
519
- this.originalError = originalError;
520
- this.name = "PromptCompilationError";
521
- }
522
- };
523
-
524
- // src/client-sdk/services/prompts/errors/prompt-validation.error.ts
525
- var PromptValidationError = class extends Error {
526
- constructor(message, validationErrors) {
527
- super(message);
528
- this.validationErrors = validationErrors;
529
- this.name = "PromptValidationError";
530
- }
531
- };
532
-
533
555
  // src/client-sdk/services/prompts/prompt.ts
534
556
  var liquid = new Liquid({
535
557
  strictFilters: true
@@ -697,6 +719,7 @@ var LocalPromptsService = class {
697
719
  // src/client-sdk/services/prompts/prompts.facade.ts
698
720
  var PromptsFacade = class {
699
721
  constructor(config) {
722
+ this.cache = /* @__PURE__ */ new Map();
700
723
  var _a, _b;
701
724
  this.promptsApiService = (_a = config.promptsApiService) != null ? _a : new PromptsApiService(config);
702
725
  this.localPromptsService = (_b = config.localPromptsService) != null ? _b : new LocalPromptsService();
@@ -719,6 +742,21 @@ var PromptsFacade = class {
719
742
  * @throws {PromptsError} If the prompt is not found or the API call fails.
720
743
  */
721
744
  async get(handleOrId, options) {
745
+ var _a;
746
+ const fetchPolicy = (_a = options == null ? void 0 : options.fetchPolicy) != null ? _a : "MATERIALIZED_FIRST" /* MATERIALIZED_FIRST */;
747
+ switch (fetchPolicy) {
748
+ case "MATERIALIZED_ONLY" /* MATERIALIZED_ONLY */:
749
+ return this.getMaterializedOnly(handleOrId);
750
+ case "ALWAYS_FETCH" /* ALWAYS_FETCH */:
751
+ return this.getAlwaysFetch(handleOrId, options);
752
+ case "CACHE_TTL" /* CACHE_TTL */:
753
+ return this.getCacheTtl(handleOrId, options);
754
+ case "MATERIALIZED_FIRST" /* MATERIALIZED_FIRST */:
755
+ default:
756
+ return this.getMaterializedFirst(handleOrId, options);
757
+ }
758
+ }
759
+ async getMaterializedFirst(handleOrId, options) {
722
760
  const localPrompt = await this.localPromptsService.get(handleOrId);
723
761
  if (localPrompt) {
724
762
  return new Prompt(localPrompt);
@@ -726,6 +764,53 @@ var PromptsFacade = class {
726
764
  const serverPrompt = await this.promptsApiService.get(handleOrId, options);
727
765
  return new Prompt(serverPrompt);
728
766
  }
767
+ async getAlwaysFetch(handleOrId, options) {
768
+ try {
769
+ const serverPrompt = await this.promptsApiService.get(handleOrId, options);
770
+ return new Prompt(serverPrompt);
771
+ } catch (e) {
772
+ const localPrompt = await this.localPromptsService.get(handleOrId);
773
+ if (localPrompt) {
774
+ return new Prompt(localPrompt);
775
+ }
776
+ throw new Error(`Prompt "${handleOrId}" not found locally or on server`);
777
+ }
778
+ }
779
+ async getMaterializedOnly(handleOrId) {
780
+ const localPrompt = await this.localPromptsService.get(handleOrId);
781
+ if (localPrompt) {
782
+ return new Prompt(localPrompt);
783
+ }
784
+ throw new Error(`Prompt "${handleOrId}" not found in materialized files`);
785
+ }
786
+ /**
787
+ * Builds a cache key that includes both handle and version to prevent collisions.
788
+ */
789
+ buildCacheKey(handleOrId, options) {
790
+ var _a;
791
+ return `${handleOrId}::version:${(_a = options == null ? void 0 : options.version) != null ? _a : ""}`;
792
+ }
793
+ async getCacheTtl(handleOrId, options) {
794
+ var _a;
795
+ const cacheKey = this.buildCacheKey(handleOrId, options);
796
+ const ttlMs = ((_a = options == null ? void 0 : options.cacheTtlMinutes) != null ? _a : 5) * 60 * 1e3;
797
+ const cached = this.cache.get(cacheKey);
798
+ const now = Date.now();
799
+ if (cached && now - cached.timestamp < ttlMs) {
800
+ return new Prompt(cached.data);
801
+ }
802
+ try {
803
+ const serverPrompt = await this.promptsApiService.get(handleOrId, options);
804
+ this.cache.set(cacheKey, { data: serverPrompt, timestamp: now });
805
+ return new Prompt(serverPrompt);
806
+ } catch (e) {
807
+ const localPrompt = await this.localPromptsService.get(handleOrId);
808
+ if (localPrompt) {
809
+ return new Prompt(localPrompt);
810
+ }
811
+ throw new Error(`Prompt "${handleOrId}" not found locally or on server`);
812
+ }
813
+ }
729
814
  /**
730
815
  * Retrieves all prompts.
731
816
  * @returns Array of Prompt instances.
@@ -746,23 +831,14 @@ var PromptsFacade = class {
746
831
  const serverPrompt = await this.promptsApiService.update(handleOrId, newData);
747
832
  return new Prompt(serverPrompt);
748
833
  }
749
- /**
750
- * Deletes a prompt by handle or ID.
751
- * @param handleOrId The prompt's handle or unique identifier.
752
- * @throws {PromptsError} If the API call fails.
753
- */
754
- async delete(handleOrId) {
755
- return this.promptsApiService.delete(handleOrId);
834
+ get delete() {
835
+ return this.promptsApiService.delete.bind(this.promptsApiService);
756
836
  }
757
837
  /**
758
- * Syncs a prompt with the server.
759
- * @param params The sync parameters.
760
- * @returns The sync result.
761
- * @throws {PromptsError} If the API call fails.
838
+ * Delegated method to the prompts API service.
762
839
  */
763
- async sync(params) {
764
- const syncResult = await this.promptsApiService.sync(params);
765
- return syncResult;
840
+ get sync() {
841
+ return this.promptsApiService.sync.bind(this.promptsApiService);
766
842
  }
767
843
  };
768
844
 
@@ -771,7 +847,8 @@ export {
771
847
  createLangWatchApiClient,
772
848
  PromptsError,
773
849
  PromptsApiService,
850
+ FetchPolicy,
774
851
  LocalPromptsService,
775
852
  PromptsFacade
776
853
  };
777
- //# sourceMappingURL=chunk-6VUZPNOC.mjs.map
854
+ //# sourceMappingURL=chunk-WZ7FYUHN.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/client-sdk/services/prompts/errors/prompts.error.ts","../src/client-sdk/services/prompts/errors/prompt-compilation.error.ts","../src/client-sdk/services/prompts/errors/prompt-validation.error.ts","../src/client-sdk/services/prompts/errors/prompts-api.error.ts","../src/client-sdk/services/prompts/tracing/prompt-tracing.decorator.ts","../src/client-sdk/services/prompts/tracing/prompt-service-tracing.decorator.ts","../src/client-sdk/services/prompts/tracing/tracer.ts","../src/client-sdk/tracing/create-tracing-proxy.ts","../src/internal/api/client.ts","../src/client-sdk/services/prompts/prompts-api.service.ts","../src/client-sdk/services/prompts/types.ts","../src/client-sdk/services/prompts/prompt.ts","../src/client-sdk/services/prompts/schema/prompt.schema.ts","../src/client-sdk/services/prompts/constants.ts","../src/client-sdk/services/prompts/local-prompts.service.ts","../src/client-sdk/services/prompts/prompts.facade.ts"],"sourcesContent":["/**\n * Base error class for the Prompts domain.\n * All prompt-related errors should extend this class.\n */\nexport class PromptsError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"PromptsError\";\n }\n}\n","/**\n * Error class for template compilation issues\n */\nexport class PromptCompilationError extends Error {\n constructor(\n message: string,\n public readonly template: string,\n public readonly originalError?: any,\n ) {\n super(message);\n this.name = \"PromptCompilationError\";\n }\n}\n","import { type z } from \"zod\";\n\n/**\n * Error class for prompt validation issues\n */\nexport class PromptValidationError extends Error {\n constructor(message: string, public readonly validationErrors: z.ZodError) {\n super(message);\n this.name = \"PromptValidationError\";\n }\n}\n","import { PromptsError } from \"./prompts.error\";\n\n/**\n * Error class for Prompts API operations.\n * Provides context about the failed operation and the original error.\n */\nexport class PromptsApiError extends PromptsError {\n constructor(\n message: string,\n public readonly operation: string,\n public readonly originalError?: unknown,\n ) {\n super(message);\n this.name = \"PromptsApiError\";\n }\n}\n","import { type Prompt, type TemplateVariables, type CompiledPrompt } from \"../prompt\";\nimport { shouldCaptureInput, shouldCaptureOutput } from \"@/observability-sdk\";\nimport type { LangWatchSpan } from \"@/observability-sdk\";\n\n/**\n * Class that decorates the target prompt,\n * adding tracing to specific methods.\n */\nexport class PromptTracingDecorator {\n constructor(private readonly target: Prompt) {}\n\n private traceCompilation(\n span: LangWatchSpan,\n variables: TemplateVariables,\n compileFn: () => CompiledPrompt\n ): CompiledPrompt {\n span.setType(\"prompt\");\n\n if (shouldCaptureInput()) {\n span.setInput(this.target);\n\n if (variables) {\n span.setAttribute(\n 'langwatch.prompt.variables',\n JSON.stringify({\n type: \"json\",\n value: variables,\n }),\n );\n }\n }\n\n const result = compileFn();\n\n span.setAttributes({\n 'langwatch.prompt.id': result.id,\n 'langwatch.prompt.handle': result.handle ?? '',\n 'langwatch.prompt.version.id': result.versionId,\n 'langwatch.prompt.version.number': result.version,\n });\n\n if (shouldCaptureOutput()) {\n span.setOutput({\n ...result,\n raw: void 0, // TODO(afr): Figure out a better way to do this.\n });\n }\n\n return result;\n }\n\n compile(span: LangWatchSpan, variables: TemplateVariables = {}): CompiledPrompt {\n return this.traceCompilation(\n span,\n variables,\n () => this.target.compile(variables),\n );\n }\n\n compileStrict(span: LangWatchSpan, variables: TemplateVariables): CompiledPrompt {\n return this.traceCompilation(\n span,\n variables,\n () => this.target.compileStrict(variables),\n );\n }\n}\n","import { type PromptsApiService } from \"../prompts-api.service\";\nimport type { LangWatchSpan } from \"@/observability-sdk\";\nimport { shouldCaptureInput, shouldCaptureOutput } from \"@/observability-sdk\";\nimport type { CreatePromptBody, UpdatePromptBody, PromptResponse } from \"../types\";\n\n/**\n * Class that decorates the target prompt service,\n * adding tracing to key methods.\n */\nexport class PromptServiceTracingDecorator {\n constructor(private readonly target: PromptsApiService) {}\n\n async get(\n span: LangWatchSpan,\n id: string,\n options?: { version?: string }\n ): Promise<PromptResponse> {\n span.setType(\"prompt\");\n span.setAttribute('langwatch.prompt.id', id);\n\n const result = await this.target.get(id, options);\n\n if (result) {\n span.setAttributes({\n 'langwatch.prompt.id': result.id,\n 'langwatch.prompt.handle': result.handle ?? '',\n 'langwatch.prompt.version.id': result.versionId,\n 'langwatch.prompt.version.number': result.version,\n });\n }\n\n if (result && shouldCaptureOutput()) {\n span.setOutput(\"json\", result);\n }\n\n return result;\n }\n\n async create(\n span: LangWatchSpan,\n params: CreatePromptBody\n ): Promise<PromptResponse> {\n span.setType(\"prompt\");\n\n if (shouldCaptureInput()) {\n span.setInput(params);\n }\n\n const result = await this.target.create(params);\n\n span.setAttributes({\n 'langwatch.prompt.id': result.id,\n 'langwatch.prompt.handle': result.handle ?? undefined,\n 'langwatch.prompt.scope': result.scope,\n 'langwatch.prompt.version.id': result.versionId,\n 'langwatch.prompt.version.number': result.version,\n });\n\n return result;\n }\n\n async update(\n span: LangWatchSpan,\n id: string,\n params: UpdatePromptBody\n ): Promise<PromptResponse> {\n\n if (shouldCaptureInput()) {\n span.setInput(params);\n }\n\n const result = await this.target.update(id, params);\n\n span.setType(\"prompt\");\n span.setAttributes({\n 'langwatch.prompt.id': id,\n 'langwatch.prompt.handle': result.handle ?? undefined,\n 'langwatch.prompt.scope': result.scope,\n 'langwatch.prompt.version.id': result.versionId,\n 'langwatch.prompt.version.number': result.version,\n });\n\n return result;\n }\n\n async delete(\n span: LangWatchSpan,\n id: string\n ): Promise<{ success: boolean }> {\n const result = await this.target.delete(id);\n\n span.setType(\"prompt\");\n span.setAttribute('langwatch.prompt.id', id);\n span.setAttribute('langwatch.prompt.deleted', 'true');\n\n return result;\n }\n\n async upsert(\n span: LangWatchSpan,\n handle: string,\n config: any\n ): Promise<{ created: boolean; prompt: PromptResponse }> {\n if (shouldCaptureInput()) {\n span.setInput(config);\n }\n\n const result = await this.target.upsert(handle, config);\n\n span.setType(\"prompt\");\n span.setAttributes({\n 'langwatch.prompt.handle': handle,\n 'langwatch.prompt.created': result.created.toString(),\n 'langwatch.prompt.id': result.prompt.id,\n 'langwatch.prompt.version.id': result.prompt.versionId,\n 'langwatch.prompt.version.number': result.prompt.version,\n });\n\n return result;\n }\n\n async sync(\n span: LangWatchSpan,\n params: any\n ): Promise<any> {\n if (shouldCaptureInput()) {\n span.setInput(params);\n }\n\n const result = await this.target.sync(params);\n\n span.setType(\"prompt\");\n span.setAttribute('langwatch.prompt.name', params.name);\n span.setAttribute('langwatch.prompt.sync.action', result.action);\n\n if (result.conflictInfo) {\n span.setAttributes({\n 'langwatch.prompt.sync.has_conflict': 'true',\n 'langwatch.prompt.sync.local_version': result.conflictInfo.localVersion.toString(),\n 'langwatch.prompt.sync.remote_version': result.conflictInfo.remoteVersion.toString(),\n });\n }\n\n return result;\n }\n}\n","import { getLangWatchTracer } from \"@/observability-sdk/tracer\";\nimport { LANGWATCH_SDK_NAME_CLIENT, LANGWATCH_SDK_VERSION } from \"@/internal/constants\";\n\nexport const tracer = getLangWatchTracer(`${LANGWATCH_SDK_NAME_CLIENT}.prompts`, LANGWATCH_SDK_VERSION);\n","import { type LangWatchTracer } from \"@/observability-sdk\";\nimport { SpanKind } from \"@opentelemetry/api\";\n\n// Type for decorator methods that receive span as first parameter\ntype DecoratorMethodWithSpan<T extends (...args: any[]) => any> =\n (span: any, ...args: Parameters<T>) => ReturnType<T>;\n\n// Type for decorator class that maps original methods to span-aware versions\n// Only requires methods that are actually implemented in the decorator\ntype DecoratorClass<T> = new (target: T) => Partial<{\n [K in keyof T]: T[K] extends (...args: any[]) => any\n ? DecoratorMethodWithSpan<T[K]>\n : T[K];\n }>;\n\n/**\n * Creates a proxy that always creates spans for public methods.\n * Decorators can access the span as the first parameter to add additional attributes.\n *\n * @param target - The target to wrap\n * @param tracer - The tracer instance to use\n * @param DecoratorClass - Optional decorator class for custom logic\n * @returns A proxy that wraps the target with consistent tracing\n */\nexport function createTracingProxy<\n T extends object,\n D extends DecoratorClass<T> | undefined = undefined\n>(\n target: T,\n tracer: LangWatchTracer,\n DecoratorClass?: D,\n): T {\n const decorator = DecoratorClass ? new DecoratorClass(target) : null;\n\n return new Proxy(target, {\n get(target, prop, receiver) {\n const value = Reflect.get(target, prop, receiver);\n\n // If it's not a function, return as-is\n if (typeof value !== \"function\") {\n return value;\n }\n\n // Only trace public methods\n if (\n typeof prop === \"string\" &&\n !prop.startsWith(\"_\") && // Skip private methods\n !isGetterOrSetter(target, prop) && // Skip actual getters/setters\n !isBuiltInMethod(prop) // Skip built-in methods\n ) {\n return (...args: any[]) => {\n const spanName = `${target.constructor.name}.${prop}`;\n\n return tracer.withActiveSpan(spanName, {\n kind: SpanKind.CLIENT,\n attributes: {\n 'code.function': prop,\n 'code.namespace': target.constructor.name,\n },\n }, (span) => {\n // If decorator has this method, call it with span as first parameter\n if (decorator && prop in decorator) {\n const decoratorMethod = decorator[prop as keyof typeof decorator];\n if (typeof decoratorMethod === \"function\") {\n return decoratorMethod.apply(decorator, [span, ...args]);\n }\n }\n\n // Default: just call the original method\n return value.apply(target, args);\n });\n };\n }\n\n return typeof value === \"function\" ? value.bind(target) : value;\n },\n });\n}\n\n// Helper function to check if a property is a getter or setter\nconst isGetterOrSetter = (target: any, prop: string | symbol): boolean => {\n // First check own properties\n let descriptor = Object.getOwnPropertyDescriptor(target, prop);\n\n // If not found on own properties, check prototype chain\n if (!descriptor) {\n const prototype = Object.getPrototypeOf(target);\n if (prototype) {\n descriptor = Object.getOwnPropertyDescriptor(prototype, prop);\n }\n }\n\n // Return true if it's a getter or setter\n return !!(descriptor?.get ?? descriptor?.set);\n};\n\n// Helper function to check if a method is a built-in method that should not be traced\nconst isBuiltInMethod = (prop: string | symbol): boolean => {\n if (typeof prop !== \"string\") {\n return false;\n }\n\n // List of built-in methods that should not be traced\n const builtInMethods = [\n 'toString',\n 'valueOf',\n 'toJSON',\n 'toLocaleString',\n 'hasOwnProperty',\n 'isPrototypeOf',\n 'propertyIsEnumerable',\n 'constructor'\n ];\n\n return builtInMethods.includes(prop);\n};\n","import openApiCreateClient from \"openapi-fetch\";\nimport type { paths } from \"../generated/openapi/api-client\";\nimport { version } from \"../../../package.json\";\nimport {\n LANGWATCH_SDK_LANGUAGE,\n LANGWATCH_SDK_NAME_OBSERVABILITY,\n LANGWATCH_SDK_RUNTIME,\n LANGWATCH_SDK_VERSION,\n} from \"../constants\";\nimport { DEFAULT_ENDPOINT } from \"@/internal/constants\";\n\n\n/**\n * Creates a new LangWatch API client.\n * @param apiKey - The API key to use for authentication. Defaults to LANGWATCH_API_KEY environment variable.\n * @param endpoint - The endpoint to use for the API client. Defaults to LANGWATCH_ENDPOINT environment variable or internal DEFAULT_ENDPOINT.\n * @returns A new LangWatch API client.\n */\nexport const createLangWatchApiClient = (\n apiKey: string = process.env.LANGWATCH_API_KEY ?? \"\",\n endpoint: string = process.env.LANGWATCH_ENDPOINT ?? DEFAULT_ENDPOINT,\n) => {\n return openApiCreateClient<paths>({\n baseUrl: endpoint,\n headers: {\n ...(apiKey ? { authorization: `Bearer ${apiKey}`, 'x-auth-token': apiKey } : {}),\n \"content-type\": \"application/json\",\n \"user-agent\": `langwatch-sdk-node/${version}`,\n \"x-langwatch-sdk-name\": LANGWATCH_SDK_NAME_OBSERVABILITY,\n \"x-langwatch-sdk-language\": LANGWATCH_SDK_LANGUAGE,\n \"x-langwatch-sdk-version\": LANGWATCH_SDK_VERSION,\n \"x-langwatch-sdk-platform\": LANGWATCH_SDK_RUNTIME(),\n },\n });\n};\n\n\nexport type LangwatchApiClient = ReturnType<typeof createLangWatchApiClient>;\n","import type { paths } from \"@/internal/generated/openapi/api-client\";\nimport { type PromptResponse } from \"./types\";\nimport { PromptConverter } from \"@/cli/utils/promptConverter\";\nimport { PromptServiceTracingDecorator, tracer } from \"./tracing\";\nimport { createTracingProxy } from \"@/client-sdk/tracing/create-tracing-proxy\";\nimport { type InternalConfig } from \"@/client-sdk/types\";\nimport { type CreatePromptBody, type UpdatePromptBody } from \"./types\";\nimport { createLangWatchApiClient, type LangwatchApiClient } from \"@/internal/api/client\";\nimport { PromptsApiError } from \"./errors\";\n\nexport type SyncAction = \"created\" | \"updated\" | \"conflict\" | \"up_to_date\";\n\nexport type ConfigData = NonNullable<\n paths[\"/api/prompts/{id}/sync\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"][\"configData\"];\n\nexport interface SyncResult {\n action: SyncAction;\n prompt?: PromptResponse;\n conflictInfo?: {\n localVersion: number;\n remoteVersion: number;\n differences: string[];\n remoteConfigData: ConfigData;\n };\n}\n\n/**\n * Service for managing prompt resources via the Langwatch API.\n * Constructor creates a proxy that wraps the service and traces all methods.\n *\n * Responsibilities:\n * - CRUD operations for prompts\n * - Creating prompt versions\n * - Error handling with contextual information\n *\n * All methods return raw PromptResponse data from the API.\n */\nexport class PromptsApiService {\n private readonly apiClient: LangwatchApiClient;\n\n constructor(config?: Pick<InternalConfig, \"langwatchApiClient\">) {\n this.apiClient = config?.langwatchApiClient ?? createLangWatchApiClient();\n\n /**\n * Wraps the service in a tracing proxy via the decorator.\n */\n return createTracingProxy(\n this as PromptsApiService,\n tracer,\n PromptServiceTracingDecorator,\n );\n }\n\n /**\n * Handles API errors by throwing a PromptsApiError with operation context.\n * @param operation Description of the operation being performed.\n * @param error The error object returned from the API client.\n * @throws {PromptsApiError}\n */\n private handleApiError(operation: string, error: any): never {\n const errorMessage =\n typeof error === \"string\"\n ? error\n : error?.error != null\n ? typeof error.error === \"string\"\n ? error.error\n : error.error.message ??\n JSON.stringify(error.error, Object.getOwnPropertyNames(error.error))\n : error?.message ?? \"Unknown error occurred\";\n\n throw new PromptsApiError(\n `Failed to ${operation}: ${errorMessage}`,\n operation,\n error,\n );\n }\n\n /**\n * Fetches all prompts from the API.\n * @returns Array of raw PromptResponse data.\n * @throws {PromptsApiError} If the API call fails.\n */\n async getAll(): Promise<PromptResponse[]> {\n const { data, error } =\n await this.apiClient.GET(\"/api/prompts\");\n if (error) this.handleApiError(\"fetch all prompts\", error);\n return data;\n }\n\n /**\n * Fetches a single prompt by its ID.\n * @param id The prompt's unique identifier.\n * @returns Raw PromptResponse data.\n * @throws {PromptsApiError} If the API call fails.\n */\n get = async (id: string, options?: { version?: string }): Promise<PromptResponse> => {\n // Parse version to number, skip for \"latest\" or invalid values\n const versionNumber = options?.version && options.version !== \"latest\"\n ? parseInt(options.version, 10)\n : undefined;\n\n const { data, error } = await this.apiClient.GET(\n \"/api/prompts/{id}\",\n {\n params: { path: { id } },\n query: {\n version: Number.isNaN(versionNumber) ? undefined : versionNumber,\n },\n },\n );\n\n if (error) {\n this.handleApiError(`fetch prompt with ID \"${id}\"`, error);\n }\n\n return data;\n }\n\n /**\n * Validates if a prompt exists.\n * @param id The prompt's unique identifier.\n * @returns True if prompt exists, false otherwise.\n * @throws {PromptsApiError} If the API call fails (not 404).\n */\n async exists(id: string): Promise<boolean> {\n try {\n await this.get(id);\n return true;\n } catch (error) {\n const originalError = error instanceof PromptsApiError ? error.originalError : null;\n const statusCode = originalError != null && typeof originalError === \"object\" && \"statusCode\" in originalError\n ? (originalError as { statusCode: unknown }).statusCode\n : null;\n\n if (statusCode === 404) {\n return false;\n }\n\n throw error;\n }\n }\n\n /**\n * Creates a new prompt.\n * @param params The prompt creation payload, matching the OpenAPI schema.\n * @returns Raw PromptResponse data of the created prompt.\n * @throws {PromptsApiError} If the API call fails.\n */\n async create(params: CreatePromptBody): Promise<PromptResponse> {\n const { data, error } = await this.apiClient.POST(\n \"/api/prompts\",\n {\n body: params,\n },\n );\n if (error) this.handleApiError(\"create prompt\", error);\n return data;\n }\n\n /**\n * Updates an existing prompt.\n * @param id The prompt's unique identifier.\n * @param params The update payload, matching the OpenAPI schema.\n * @returns Raw PromptResponse data of the updated prompt.\n * @throws {PromptsApiError} If the API call fails.\n */\n async update(id: string, params: UpdatePromptBody): Promise<PromptResponse> {\n const { error, data: updatedPrompt } =\n await this.apiClient.PUT(\"/api/prompts/{id}\", {\n params: { path: { id } },\n body: params,\n });\n if (error) this.handleApiError(`update prompt with ID \"${id}\"`, error);\n return updatedPrompt;\n }\n\n /**\n * Deletes a prompt by its ID.\n * @param id The prompt's unique identifier.\n * @throws {PromptsApiError} If the API call fails.\n */\n async delete(id: string): Promise<{ success: boolean }> {\n const { data, error } = await this.apiClient.DELETE(\n \"/api/prompts/{id}\",\n {\n params: { path: { id } },\n },\n );\n if (error) this.handleApiError(`delete prompt with ID \"${id}\"`, error);\n\n return data;\n }\n\n /**\n * Fetches all versions for a given prompt.\n * @param id The prompt's unique identifier.\n * @returns Array of raw PromptResponse data for each version.\n * @throws {PromptsApiError} If the API call fails.\n */\n async getVersions(id: string): Promise<PromptResponse[]> {\n const { data, error } = await this.apiClient.GET(\n \"/api/prompts/{id}/versions\",\n {\n params: { path: { id } },\n },\n );\n if (error)\n this.handleApiError(`fetch versions for prompt with ID \"${id}\"`, error);\n\n return data;\n }\n\n /**\n * Upserts a prompt with local configuration - creates if doesn't exist, updates version if exists.\n * @param handle The prompt's handle/identifier.\n * @param config Local prompt configuration.\n * @returns Object with created flag and raw PromptResponse data.\n * @throws {PromptsApiError} If the API call fails.\n */\n async upsert(\n handle: string,\n config: {\n model: string;\n modelParameters?: {\n temperature?: number;\n max_tokens?: number;\n };\n messages: Array<{\n role: \"system\" | \"user\" | \"assistant\";\n content: string;\n }>;\n },\n ): Promise<{ created: boolean; prompt: PromptResponse }> {\n const payload = {\n handle,\n model: config.model,\n prompt: PromptConverter.extractSystemPrompt(config.messages),\n messages: PromptConverter.filterNonSystemMessages(config.messages),\n temperature: config.modelParameters?.temperature,\n maxTokens: config.modelParameters?.max_tokens,\n inputs: [{ identifier: \"input\", type: \"str\" as const }],\n outputs: [{ identifier: \"output\", type: \"str\" as const }],\n commitMessage: `Updated via CLI sync`,\n schemaVersion: \"1.0\" as const,\n };\n\n // Creating a prompt with the same handle will fail, so we try to update instead\n try {\n const prompt = await this.create(payload);\n return {\n created: true,\n prompt,\n };\n } catch {\n const prompt = await this.update(handle, payload);\n\n return {\n created: false,\n prompt,\n };\n }\n }\n\n /**\n * Sync a prompt with local content, handling conflicts and version management\n * You probably don't need to use this method directly.\n */\n async sync(params: {\n name: string;\n configData: ConfigData;\n localVersion?: number;\n commitMessage?: string;\n }): Promise<SyncResult> {\n try {\n const response = await this.apiClient.POST(\n \"/api/prompts/{id}/sync\",\n {\n params: { path: { id: params.name } },\n body: {\n configData: params.configData,\n localVersion: params.localVersion,\n commitMessage: params.commitMessage,\n },\n },\n );\n\n if (response.error) {\n const errorMessage =\n response.error?.error ?? JSON.stringify(response.error);\n throw new Error(`Failed to sync prompt: ${errorMessage}`);\n }\n\n return {\n action: response.data.action as SyncAction,\n prompt: response.data.prompt,\n conflictInfo: response.data.conflictInfo,\n };\n } catch (error) {\n const message =\n error instanceof Error ? error.message : \"Unknown error occurred\";\n throw new PromptsApiError(message, \"sync\", error);\n }\n }\n}\n","import { type z } from \"zod\";\nimport type { paths } from \"@/internal/generated/openapi/api-client\";\nimport {\n type corePromptDataSchema,\n type promptMetadataSchema,\n type promptDataSchema\n} from \"./schema\";\n\n/**\n * Type for template variables - supporting common data types\n */\nexport type TemplateVariables = Record<\n string,\n string | number | boolean | object | null\n>;\n\n/**\n * Core data needed for prompt functionality\n */\nexport type CorePromptData = z.infer<typeof corePromptDataSchema>;\n\n/**\n * Optional metadata for identification and tracing\n */\nexport type PromptMetadata = z.infer<typeof promptMetadataSchema>;\n\n/**\n * Combined type for creating prompts\n */\nexport type PromptData = z.infer<typeof promptDataSchema>;\n\n// Extract API types from OpenAPI schema for backwards compatibility\nexport type CreatePromptBody = NonNullable<\n paths[\"/api/prompts\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n\nexport type UpdatePromptBody = NonNullable<\n paths[\"/api/prompts/{id}\"][\"put\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n\nexport type PromptResponse = NonNullable<\n paths[\"/api/prompts/{id}\"][\"get\"][\"responses\"][\"200\"][\"content\"][\"application/json\"]\n>;\n\n// Extract the PromptScope type from the API client\nexport type PromptScope = paths[\"/api/prompts\"][\"post\"][\"responses\"][\"200\"][\"content\"][\"application/json\"][\"scope\"];\n\n/**\n * Fetch policy for prompt retrieval.\n * Controls how prompts are fetched and cached.\n */\nexport enum FetchPolicy {\n /** Use local file if available, otherwise fetch from API (default) */\n MATERIALIZED_FIRST = \"MATERIALIZED_FIRST\",\n /** Always try API first, fall back to materialized */\n ALWAYS_FETCH = \"ALWAYS_FETCH\",\n /** Fetch every X minutes, use materialized between fetches */\n CACHE_TTL = \"CACHE_TTL\",\n /** Never fetch, use materialized files only */\n MATERIALIZED_ONLY = \"MATERIALIZED_ONLY\",\n}\n\n","import { Liquid } from \"liquidjs\";\nimport { PromptTracingDecorator, tracer } from \"./tracing\";\nimport { createTracingProxy } from \"@/client-sdk/tracing/create-tracing-proxy\";\nimport { promptDataSchema } from \"./schema\";\nimport { type TemplateVariables, type PromptData, type CorePromptData, type PromptScope } from \"./types\";\nimport { PromptCompilationError, PromptValidationError } from \"./errors\";\n\n// Re-export types and errors for convenience\nexport type { TemplateVariables, PromptData, CorePromptData, PromptMetadata } from \"./types\";\nexport { PromptCompilationError, PromptValidationError } from \"./errors\";\n\n// Global Liquid instance - shared across all prompts for efficiency\nconst liquid = new Liquid({\n strictFilters: true,\n});\n\n/**\n * The Prompt class provides a standardized interface for working with prompt objects\n * within the SDK, focusing on core functionality needed for template compilation and execution.\n * Keeps only essential fields while maintaining compatibility with tracing and observability.\n */\nexport class Prompt {\n // === Core functionality (required) ===\n public readonly model!: string;\n public readonly messages!: Array<{\n role: \"user\" | \"assistant\" | \"system\";\n content: string;\n }>;\n\n // === Optional core fields ===\n public readonly prompt?: string;\n public readonly temperature?: number;\n public readonly maxTokens?: number;\n public readonly responseFormat?: CorePromptData[\"responseFormat\"];\n\n // === Optional identification (for tracing) ===\n public readonly id?: string;\n public readonly handle?: string | null;\n public readonly version?: number;\n public readonly versionId?: string;\n public readonly scope?: PromptScope;\n\n constructor(data: PromptData) {\n // Validate input using Zod\n const validationResult = promptDataSchema.strip().safeParse(data);\n\n if (!validationResult.success) {\n throw new PromptValidationError(\n \"Invalid prompt data provided\",\n validationResult.error\n );\n }\n\n // Assign validated data\n Object.assign(this, validationResult.data);\n\n // Set default for prompt if not provided\n this.prompt ??= this.extractSystemPrompt();\n\n // Return a proxy that wraps specific methods for tracing\n return createTracingProxy(this as Prompt, tracer, PromptTracingDecorator);\n }\n\n private extractSystemPrompt(): string {\n return this.messages.find(m => m.role === \"system\")?.content ?? \"\";\n }\n\n /**\n * Compile the prompt template with provided variables (lenient - missing variables become empty)\n * @param variables - Object containing variable values for template compilation\n * @returns CompiledPrompt instance with compiled content\n */\n private _compile(\n variables: TemplateVariables,\n strict: boolean,\n ): CompiledPrompt {\n try {\n // Compile main prompt\n const compiledPrompt = this.prompt\n ? liquid.parseAndRenderSync(this.prompt, variables, {\n strictVariables: strict,\n })\n : \"\";\n\n // Compile messages\n const compiledMessages = (this.messages || []).map((message) => ({\n ...message,\n content: message.content\n ? liquid.parseAndRenderSync(message.content, variables, {\n strictVariables: strict,\n })\n : message.content,\n }));\n\n // Create new prompt data with compiled content\n const compiledData: PromptData = {\n ...this,\n prompt: compiledPrompt,\n messages: compiledMessages,\n };\n\n return new CompiledPrompt(compiledData, this);\n } catch (error) {\n const templateStr = this.prompt ?? JSON.stringify(this.messages);\n throw new PromptCompilationError(\n `Failed to compile prompt template: ${\n error instanceof Error ? error.message : \"Unknown error\"\n }`,\n templateStr,\n error,\n );\n }\n }\n\n compile(variables: TemplateVariables = {}): CompiledPrompt {\n return this._compile(variables, false);\n }\n\n /**\n * Compile with validation - throws error if required variables are missing\n * @param variables - Template variables\n * @returns CompiledPrompt instance with compiled content\n */\n compileStrict(variables: TemplateVariables): CompiledPrompt {\n return this._compile(variables, true);\n }\n}\n\n\n/**\n * Represents a compiled prompt that extends Prompt with reference to the original template\n */\nexport class CompiledPrompt extends Prompt {\n constructor(\n compiledData: PromptData,\n public readonly original: Prompt,\n ) {\n super(compiledData);\n }\n}\n","// TODO: Move these to their own files\nimport { z } from \"zod\";\nimport { PromptScope } from \"../constants\";\n\n/**\n * Zod schema for message objects in prompts\n */\nexport const messageSchema = z.object({\n role: z.enum([\"user\", \"assistant\", \"system\"]),\n content: z.string(),\n});\n\n/**\n * Zod schema for response format configuration\n */\nexport const responseFormatSchema = z.object({\n type: z.literal(\"json_schema\"),\n json_schema: z.object({\n name: z.string(),\n schema: z.record(z.string(), z.unknown()),\n }).nullable(),\n}).optional();\n\n/**\n * Zod schema for core prompt data - the essential fields needed for functionality\n */\nexport const corePromptDataSchema = z.object({\n model: z.string().min(1, \"Model cannot be empty\"),\n messages: z.array(messageSchema).min(1, \"At least one message is required\"),\n prompt: z.string().optional(),\n temperature: z.number().min(0).max(2).optional(),\n maxTokens: z.number().positive().optional(),\n responseFormat: responseFormatSchema,\n});\n\n/**\n * Zod schema for prompt metadata - optional fields for identification and tracing\n */\nexport const promptMetadataSchema = z.object({\n id: z.string().optional(),\n handle: z.string().nullable().optional(),\n version: z.number().min(0).optional(),\n versionId: z.string().optional(),\n scope: z.enum(PromptScope).optional(),\n});\n\n/**\n * Combined schema for complete prompt data\n */\nexport const promptDataSchema = z.object({\n ...corePromptDataSchema.shape,\n ...promptMetadataSchema.shape,\n});\n","import { type PromptScope as PromptScopeType } from \"./types\";\n\nexport const PromptScope = {\n ORGANIZATION: \"ORGANIZATION\" as const,\n PROJECT: \"PROJECT\" as const,\n} satisfies Record<string, PromptScopeType>;\n","import type { LocalPromptConfig, PromptDependency } from \"@/cli/types\";\nimport { FileManager } from \"@/cli/utils/fileManager\";\nimport { type Logger, NoOpLogger } from \"@/logger\";\nimport { type PromptData } from \"./types\";\nimport { PromptFileNotFoundError } from \"@/cli/utils/errors/prompt-not-found.error\";\n\nexport interface LocalPromptsServiceConfig {\n fileManager?: typeof FileManager;\n logger?: Logger;\n}\n\n/**\n * Service for retrieving prompts from local filesystem sources.\n *\n * Searches for prompts in the following priority order:\n * 1. Explicit file mapping in prompts.json config\n * 2. Materialized path from prompts-lock.json\n * 3. Direct file scanning in prompts directory\n */\nexport class LocalPromptsService {\n private readonly fileManager: typeof FileManager;\n private readonly logger: Logger;\n\n constructor(config?: LocalPromptsServiceConfig) {\n this.fileManager = config?.fileManager ?? FileManager;\n this.logger = config?.logger ?? new NoOpLogger();\n }\n\n /**\n * Retrieves a prompt using the configured search strategy.\n * Tries each source in priority order until found or all sources exhausted.\n */\n async get(handleOrId: string): Promise<PromptData | null> {\n try {\n const dependency = await this.getDependencyFromConfig(handleOrId);\n\n // If no dependency is found, it means it's not a local prompt\n if (!dependency) {\n return null;\n }\n\n // Try each source in priority order until found or all sources exhausted\n // We catch errors and return null if any of the sources fail so we\n // can continue to the next source and return null if all sources fail\n const localPromptConfig = (\n (await this.getFromConfig(dependency).catch((e) => {\n if (e instanceof PromptFileNotFoundError) return null;\n throw e;\n })) ??\n (await this.getFromLockFile(handleOrId).catch((e) => {\n if (e instanceof PromptFileNotFoundError) return null;\n throw e;\n })) ??\n (await this.getFromLocalFiles(handleOrId).catch((e) => {\n if (e instanceof PromptFileNotFoundError) return null;\n throw e;\n }))\n );\n\n return localPromptConfig ? this.convertToPromptData({\n ...localPromptConfig,\n handle: handleOrId,\n }) : null;\n } catch (error) {\n this.logger.warn(`Failed to get prompt \"${handleOrId}\": ${error instanceof Error ? error.message : String(error)}`);\n return null;\n }\n }\n\n\n /**\n * Searches for prompt using explicit file mapping in prompts.json.\n * Looks for dependencies with a 'file' property pointing to a specific path.\n */\n private async getFromConfig(dependency: PromptDependency): Promise<LocalPromptConfig | null> {\n if (typeof dependency === 'string' && dependency.startsWith('file:')) {\n return this.fileManager.loadLocalPrompt(dependency.slice(5));\n }\n\n return null;\n }\n\n /**\n * Searches for prompt using materialized path from lock file.\n * Lock file contains resolved paths for prompts that have been synced/materialized.\n */\n private async getFromLockFile(handleOrId: string): Promise<LocalPromptConfig | null> {\n const lock = this.fileManager.loadPromptsLock();\n const lockEntry = lock.prompts[handleOrId];\n\n if (lockEntry?.materialized) {\n return this.fileManager.loadLocalPrompt(lockEntry.materialized);\n }\n\n return null;\n }\n\n /**\n * Searches for prompt by scanning all .prompt.yaml files in prompts directory.\n * Extracts prompt name from file path and matches against the requested handle.\n * This is the fallback method when explicit mappings don't exist.\n */\n private async getFromLocalFiles(handleOrId: string): Promise<LocalPromptConfig | null> {\n const localFiles = this.fileManager.getLocalPromptFiles();\n\n for (const filePath of localFiles) {\n const promptName = this.fileManager.promptNameFromPath(filePath);\n if (promptName === handleOrId) {\n return this.fileManager.loadLocalPrompt(filePath);\n }\n }\n\n return null;\n }\n\n /**\n * Get dependency from config\n */\n private async getDependencyFromConfig(handleOrId: string): Promise<PromptDependency | null> {\n const config = this.fileManager.loadPromptsConfig();\n const dependency = config.prompts[handleOrId];\n\n return dependency ?? null;\n }\n\n /**\n * Converts LocalPromptConfig to PromptData format\n */\n private convertToPromptData(config: LocalPromptConfig & { handle: string; }): PromptData {\n const { modelParameters, ...rest } = config;\n return {\n maxTokens: modelParameters?.max_tokens,\n temperature: modelParameters?.temperature,\n ...rest,\n };\n }\n}\n","import { PromptsApiService } from \"./prompts-api.service\";\nimport { Prompt } from \"./prompt\";\nimport type { CreatePromptBody, UpdatePromptBody, PromptData } from \"./types\";\nimport { FetchPolicy } from \"./types\";\nimport { type InternalConfig } from \"@/client-sdk/types\";\nimport { LocalPromptsService } from \"./local-prompts.service\";\n\n/**\n * Options for fetching a prompt.\n */\nexport interface GetPromptOptions {\n /** Specific version to fetch */\n version?: string;\n /** Fetch policy to use */\n fetchPolicy?: FetchPolicy;\n /** Cache TTL in minutes (only used with CACHE_TTL policy) */\n cacheTtlMinutes?: number;\n}\n\ninterface CacheEntry {\n data: PromptData;\n timestamp: number;\n}\n\ninterface PromptsFacadeDependencies {\n promptsApiService: PromptsApiService;\n localPromptsService: LocalPromptsService;\n}\n\n/**\n * Facade for prompt operations in the LangWatch SDK.\n * Provides a simplified interface for common prompt management tasks.\n */\nexport class PromptsFacade implements Pick<PromptsApiService, \"sync\" | \"delete\">{\n private readonly promptsApiService: PromptsApiService;\n private readonly localPromptsService: LocalPromptsService;\n private readonly cache = new Map<string, CacheEntry>();\n\n constructor(config: InternalConfig & PromptsFacadeDependencies) {\n this.promptsApiService = config.promptsApiService ?? new PromptsApiService(config);\n this.localPromptsService = config.localPromptsService ?? new LocalPromptsService();\n }\n\n /**\n * Creates a new prompt.\n * @param data The prompt creation payload.\n * @returns The created Prompt instance.\n * @throws {PromptsError} If the API call fails.\n */\n async create(data: CreatePromptBody): Promise<Prompt> {\n const serverPrompt = await this.promptsApiService.create(data);\n return new Prompt(serverPrompt);\n }\n\n /**\n * Retrieves a prompt by handle or ID.\n * @param handleOrId The prompt's handle or unique identifier.\n * @param options Optional parameters for the request.\n * @returns The Prompt instance.\n * @throws {PromptsError} If the prompt is not found or the API call fails.\n */\n async get(\n handleOrId: string,\n options?: GetPromptOptions,\n ): Promise<Prompt> {\n const fetchPolicy = options?.fetchPolicy ?? FetchPolicy.MATERIALIZED_FIRST;\n\n switch (fetchPolicy) {\n case FetchPolicy.MATERIALIZED_ONLY:\n return this.getMaterializedOnly(handleOrId);\n\n case FetchPolicy.ALWAYS_FETCH:\n return this.getAlwaysFetch(handleOrId, options);\n\n case FetchPolicy.CACHE_TTL:\n return this.getCacheTtl(handleOrId, options);\n\n case FetchPolicy.MATERIALIZED_FIRST:\n default:\n return this.getMaterializedFirst(handleOrId, options);\n }\n }\n\n private async getMaterializedFirst(\n handleOrId: string,\n options?: GetPromptOptions,\n ): Promise<Prompt> {\n const localPrompt = await this.localPromptsService.get(handleOrId);\n if (localPrompt) {\n return new Prompt(localPrompt);\n }\n const serverPrompt = await this.promptsApiService.get(handleOrId, options);\n return new Prompt(serverPrompt);\n }\n\n private async getAlwaysFetch(\n handleOrId: string,\n options?: GetPromptOptions,\n ): Promise<Prompt> {\n try {\n const serverPrompt = await this.promptsApiService.get(handleOrId, options);\n return new Prompt(serverPrompt);\n } catch {\n const localPrompt = await this.localPromptsService.get(handleOrId);\n if (localPrompt) {\n return new Prompt(localPrompt);\n }\n throw new Error(`Prompt \"${handleOrId}\" not found locally or on server`);\n }\n }\n\n private async getMaterializedOnly(handleOrId: string): Promise<Prompt> {\n const localPrompt = await this.localPromptsService.get(handleOrId);\n if (localPrompt) {\n return new Prompt(localPrompt);\n }\n throw new Error(`Prompt \"${handleOrId}\" not found in materialized files`);\n }\n\n /**\n * Builds a cache key that includes both handle and version to prevent collisions.\n */\n private buildCacheKey(handleOrId: string, options?: GetPromptOptions): string {\n return `${handleOrId}::version:${options?.version ?? ''}`;\n }\n\n private async getCacheTtl(\n handleOrId: string,\n options?: GetPromptOptions,\n ): Promise<Prompt> {\n const cacheKey = this.buildCacheKey(handleOrId, options);\n const ttlMs = (options?.cacheTtlMinutes ?? 5) * 60 * 1000;\n const cached = this.cache.get(cacheKey);\n const now = Date.now();\n\n if (cached && now - cached.timestamp < ttlMs) {\n return new Prompt(cached.data);\n }\n\n try {\n const serverPrompt = await this.promptsApiService.get(handleOrId, options);\n this.cache.set(cacheKey, { data: serverPrompt, timestamp: now });\n return new Prompt(serverPrompt);\n } catch {\n const localPrompt = await this.localPromptsService.get(handleOrId);\n if (localPrompt) {\n return new Prompt(localPrompt);\n }\n throw new Error(`Prompt \"${handleOrId}\" not found locally or on server`);\n }\n }\n\n /**\n * Retrieves all prompts.\n * @returns Array of Prompt instances.\n * @throws {PromptsError} If the API call fails.\n */\n async getAll(): Promise<Prompt[]> {\n const serverPrompts = await this.promptsApiService.getAll();\n return serverPrompts.map((prompt) => new Prompt(prompt));\n }\n\n /**\n * Updates an existing prompt.\n * @param handleOrId The prompt's handle or unique identifier.\n * @param newData The update payload.\n * @returns The updated Prompt instance.\n * @throws {PromptsError} If the API call fails.\n */\n async update(handleOrId: string, newData: UpdatePromptBody): Promise<Prompt> {\n const serverPrompt = await this.promptsApiService.update(handleOrId, newData);\n return new Prompt(serverPrompt);\n }\n\n get delete() {\n return this.promptsApiService.delete.bind(this.promptsApiService);\n }\n\n /**\n * Delegated method to the prompts API service.\n */\n get sync() {\n return this.promptsApiService.sync.bind(this.promptsApiService);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIO,IAAM,eAAN,cAA2B,MAAM;AAAA,EACtC,YAAY,SAAiB;AAC3B,UAAM,OAAO;AACb,SAAK,OAAO;AAAA,EACd;AACF;;;ACNO,IAAM,yBAAN,cAAqC,MAAM;AAAA,EAChD,YACE,SACgB,UACA,eACh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YAAM,IAAI,MAAM,WAAW,UAAU,kCAAkC;AAAA,IACzE;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAM,SAA4B;AAChC,UAAM,gBAAgB,MAAM,KAAK,kBAAkB,OAAO;AAC1D,WAAO,cAAc,IAAI,CAAC,WAAW,IAAI,OAAO,MAAM,CAAC;AAAA,EACzD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,MAAM,OAAO,YAAoB,SAA4C;AAC3E,UAAM,eAAe,MAAM,KAAK,kBAAkB,OAAO,YAAY,OAAO;AAC5E,WAAO,IAAI,OAAO,YAAY;AAAA,EAChC;AAAA,EAEA,IAAI,SAAS;AACX,WAAO,KAAK,kBAAkB,OAAO,KAAK,KAAK,iBAAiB;AAAA,EAClE;AAAA;AAAA;AAAA;AAAA,EAKA,IAAI,OAAO;AACT,WAAO,KAAK,kBAAkB,KAAK,KAAK,KAAK,iBAAiB;AAAA,EAChE;AACF;","names":["tracer","target","FetchPolicy"]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  attributes_exports
3
- } from "./chunk-I2SOBPAF.mjs";
3
+ } from "./chunk-RSIPLYVA.mjs";
4
4
 
5
5
  // src/observability-sdk/processors/filterable-batch-span-processor.ts
6
6
  import {
@@ -72,4 +72,4 @@ export {
72
72
  FilterableBatchSpanProcessor,
73
73
  DataCapturePresets
74
74
  };
75
- //# sourceMappingURL=chunk-FEL5FLHA.mjs.map
75
+ //# sourceMappingURL=chunk-ZEPKV5YO.mjs.map
package/dist/cli/index.js CHANGED
@@ -9,11 +9,11 @@ var _dotenv = require('dotenv');
9
9
  var _commander = require('commander');
10
10
  _dotenv.config.call(void 0, );
11
11
  var addCommand = async (name, options) => {
12
- const { addCommand: addCommandImpl } = await Promise.resolve().then(() => _interopRequireWildcard(require("../add-V2V2U6OX.js")));
12
+ const { addCommand: addCommandImpl } = await Promise.resolve().then(() => _interopRequireWildcard(require("../add-UB5U3K3M.js")));
13
13
  return addCommandImpl(name, options);
14
14
  };
15
15
  var removeCommand = async (name) => {
16
- const { removeCommand: removeCommandImpl } = await Promise.resolve().then(() => _interopRequireWildcard(require("../remove-KVWGJOJY.js")));
16
+ const { removeCommand: removeCommandImpl } = await Promise.resolve().then(() => _interopRequireWildcard(require("../remove-V4JL5Z4U.js")));
17
17
  return removeCommandImpl(name);
18
18
  };
19
19
  var initCommand = async () => {
@@ -21,15 +21,15 @@ var initCommand = async () => {
21
21
  return initCommandImpl();
22
22
  };
23
23
  var loginCommand = async () => {
24
- const { loginCommand: loginCommandImpl } = await Promise.resolve().then(() => _interopRequireWildcard(require("../login-6PM2MUZS.js")));
24
+ const { loginCommand: loginCommandImpl } = await Promise.resolve().then(() => _interopRequireWildcard(require("../login-3H27NIOD.js")));
25
25
  return loginCommandImpl();
26
26
  };
27
27
  var listCommand = async () => {
28
- const { listCommand: listCommandImpl } = await Promise.resolve().then(() => _interopRequireWildcard(require("../list-VWXENE3O.js")));
28
+ const { listCommand: listCommandImpl } = await Promise.resolve().then(() => _interopRequireWildcard(require("../list-DUNP46AD.js")));
29
29
  return listCommandImpl();
30
30
  };
31
31
  var syncCommand = async () => {
32
- const { syncCommand: syncCommandImpl } = await Promise.resolve().then(() => _interopRequireWildcard(require("../sync-6BHY2J72.js")));
32
+ const { syncCommand: syncCommandImpl } = await Promise.resolve().then(() => _interopRequireWildcard(require("../sync-DIOKWE6R.js")));
33
33
  return syncCommandImpl();
34
34
  };
35
35
  var createCommand = async (name, options) => {
@@ -37,7 +37,7 @@ var createCommand = async (name, options) => {
37
37
  return createCommandImpl(name, options);
38
38
  };
39
39
  var program = new (0, _commander.Command)();
40
- program.name("langwatch").description("LangWatch CLI - The npm of prompts").version("0.9.0", "-v, --version", "Display the current version").configureHelp({
40
+ program.name("langwatch").description("LangWatch CLI - The npm of prompts").version("0.11.0", "-v, --version", "Display the current version").configureHelp({
41
41
  showGlobalOptions: true
42
42
  }).showHelpAfterError().showSuggestionAfterError();
43
43
  program.command("login").description("Login to LangWatch and save API key").action(async () => {
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/langwatch/langwatch/typescript-sdk/dist/cli/index.js","../../src/cli/index.ts"],"names":[],"mappings":"AAAA;AACA;AACE;AACF,uDAA6B;AAC7B,gCAA6B;AAC7B;AACA;ACHA,gCAAuB;AAGvB,sCAAwB;AAFxB,4BAAA,CAAO;AAQP,IAAM,WAAA,EAAa,MAAA,CAAO,IAAA,EAAc,OAAA,EAAA,GAAqE;AAC3G,EAAA,MAAM,EAAE,UAAA,EAAY,eAAe,EAAA,EAAI,MAAM,4DAAA,CAAO,oBAAmB,GAAA;AACvE,EAAA,OAAO,cAAA,CAAe,IAAA,EAAM,OAAO,CAAA;AACrC,CAAA;AAEA,IAAM,cAAA,EAAgB,MAAA,CAAO,IAAA,EAAA,GAAgC;AAC3D,EAAA,MAAM,EAAE,aAAA,EAAe,kBAAkB,EAAA,EAAI,MAAM,4DAAA,CAAO,uBAAsB,GAAA;AAChF,EAAA,OAAO,iBAAA,CAAkB,IAAI,CAAA;AAC/B,CAAA;AAEA,IAAM,YAAA,EAAc,MAAA,CAAA,EAAA,GAA2B;AAC7C,EAAA,MAAM,EAAE,WAAA,EAAa,gBAAgB,EAAA,EAAI,MAAM,4DAAA,CAAO,qBAAoB,GAAA;AAC1E,EAAA,OAAO,eAAA,CAAgB,CAAA;AACzB,CAAA;AAEA,IAAM,aAAA,EAAe,MAAA,CAAA,EAAA,GAA2B;AAC9C,EAAA,MAAM,EAAE,YAAA,EAAc,iBAAiB,EAAA,EAAI,MAAM,4DAAA,CAAO,sBAAqB,GAAA;AAC7E,EAAA,OAAO,gBAAA,CAAiB,CAAA;AAC1B,CAAA;AAEA,IAAM,YAAA,EAAc,MAAA,CAAA,EAAA,GAA2B;AAC7C,EAAA,MAAM,EAAE,WAAA,EAAa,gBAAgB,EAAA,EAAI,MAAM,4DAAA,CAAO,qBAAoB,GAAA;AAC1E,EAAA,OAAO,eAAA,CAAgB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;AACkE,IAAA;AAClE,IAAA;AAChB,EAAA;AACD;AAIY;AAEP,EAAA;AACa,IAAA;AACuB,MAAA;AAC/B,IAAA;AACyC,MAAA;AACZ,MAAA;AACpC,IAAA;AACc,EAAA;AACkE,IAAA;AAClE,IAAA;AAChB,EAAA;AACD;AAKO;AACF,EAAA;AACsB,IAAA;AACV,EAAA;AACkE,IAAA;AAClE,IAAA;AAChB,EAAA;AACD;AAKA;AACK,EAAA;AACgB,IAAA;AACJ,EAAA;AACkE,IAAA;AAClE,IAAA;AAChB,EAAA;AACD;AAKA;AACK,EAAA;AACgB,IAAA;AACJ,EAAA;AACkE,IAAA;AAClE,IAAA;AAChB,EAAA;AACD;AAEuB","file":"/home/runner/work/langwatch/langwatch/typescript-sdk/dist/cli/index.js","sourcesContent":[null,"#!/usr/bin/env node\n\n// Load environment variables BEFORE any other imports\nimport { config } from \"dotenv\";\nconfig();\n\nimport { Command } from \"commander\";\nimport { parsePromptSpec } from \"./types\";\n\ndeclare const __CLI_VERSION__: string;\n\n// Import commands with proper async handling\nconst addCommand = async (name: string, options: { version?: string; localFile?: string }): Promise<void> => {\n const { addCommand: addCommandImpl } = await import(\"./commands/add.js\");\n return addCommandImpl(name, options);\n};\n\nconst removeCommand = async (name: string): Promise<void> => {\n const { removeCommand: removeCommandImpl } = await import(\"./commands/remove.js\");\n return removeCommandImpl(name);\n};\n\nconst initCommand = async (): Promise<void> => {\n const { initCommand: initCommandImpl } = await import(\"./commands/init.js\");\n return initCommandImpl();\n};\n\nconst loginCommand = async (): Promise<void> => {\n const { loginCommand: loginCommandImpl } = await import(\"./commands/login.js\");\n return loginCommandImpl();\n};\n\nconst listCommand = async (): Promise<void> => {\n const { listCommand: listCommandImpl } = await import(\"./commands/list.js\");\n return listCommandImpl();\n};\n\nconst syncCommand = async (): Promise<void> => {\n const { syncCommand: syncCommandImpl } = await import(\"./commands/sync.js\");\n return syncCommandImpl();\n};\n\nconst createCommand = async (name: string, options: Record<string, unknown>): Promise<void> => {\n const { createCommand: createCommandImpl } = await import(\"./commands/create.js\");\n return createCommandImpl(name, options);\n};\n\nconst program = new Command();\n\nprogram\n .name(\"langwatch\")\n .description(\"LangWatch CLI - The npm of prompts\")\n .version(__CLI_VERSION__, \"-v, --version\", \"Display the current version\")\n .configureHelp({\n showGlobalOptions: true,\n })\n .showHelpAfterError()\n .showSuggestionAfterError();\n\n// Top-level commands\nprogram\n .command(\"login\")\n .description(\"Login to LangWatch and save API key\")\n .action(async () => {\n try {\n await loginCommand();\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : \"Unknown error\"}`);\n process.exit(1);\n }\n });\n\n// Add prompt command group\nconst promptCmd = program\n .command(\"prompt\")\n .description(\"Manage prompt dependencies\");\n\npromptCmd\n .command(\"init\")\n .description(\"Initialize a new prompts project\")\n .action(async () => {\n try {\n await initCommand();\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : \"Unknown error\"}`);\n process.exit(1);\n }\n });\n\npromptCmd\n .command(\"create <name>\")\n .description(\"Create a new prompt YAML file with default content\")\n .action(async (name: string) => {\n try {\n await createCommand(name, {});\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : \"Unknown error\"}`);\n process.exit(1);\n }\n });\n\npromptCmd\n .command(\"add <spec> [localFile]\")\n .description(\"Add a prompt dependency (e.g., 'agent/foo', 'agent/bar@5') or local file\")\n .action(async (spec: string, localFile?: string) => {\n try {\n if (localFile) {\n await addCommand(spec, { localFile });\n } else {\n const { name, version } = parsePromptSpec(spec);\n await addCommand(name, { version });\n }\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : \"Unknown error\"}`);\n process.exit(1);\n }\n });\n\npromptCmd\n .command(\"remove <name>\")\n .description(\"Remove a prompt dependency\")\n .action(async (name: string) => {\n try {\n await removeCommand(name);\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : \"Unknown error\"}`);\n process.exit(1);\n }\n });\n\npromptCmd\n .command(\"list\")\n .description(\"List all available prompts on the server\")\n .action(async () => {\n try {\n await listCommand();\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : \"Unknown error\"}`);\n process.exit(1);\n }\n });\n\npromptCmd\n .command(\"sync\")\n .description(\"Sync prompts - fetch remote and push local\")\n .action(async () => {\n try {\n await syncCommand();\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : \"Unknown error\"}`);\n process.exit(1);\n }\n });\n\nprogram.parse(process.argv);"]}
1
+ {"version":3,"sources":["/home/runner/work/langwatch/langwatch/typescript-sdk/dist/cli/index.js","../../src/cli/index.ts"],"names":[],"mappings":"AAAA;AACA;AACE;AACF,uDAA6B;AAC7B,gCAA6B;AAC7B;AACA;ACHA,gCAAuB;AAGvB,sCAAwB;AAFxB,4BAAA,CAAO;AAQP,IAAM,WAAA,EAAa,MAAA,CAAO,IAAA,EAAc,OAAA,EAAA,GAAqE;AAC3G,EAAA,MAAM,EAAE,UAAA,EAAY,eAAe,EAAA,EAAI,MAAM,4DAAA,CAAO,oBAAmB,GAAA;AACvE,EAAA,OAAO,cAAA,CAAe,IAAA,EAAM,OAAO,CAAA;AACrC,CAAA;AAEA,IAAM,cAAA,EAAgB,MAAA,CAAO,IAAA,EAAA,GAAgC;AAC3D,EAAA,MAAM,EAAE,aAAA,EAAe,kBAAkB,EAAA,EAAI,MAAM,4DAAA,CAAO,uBAAsB,GAAA;AAChF,EAAA,OAAO,iBAAA,CAAkB,IAAI,CAAA;AAC/B,CAAA;AAEA,IAAM,YAAA,EAAc,MAAA,CAAA,EAAA,GAA2B;AAC7C,EAAA,MAAM,EAAE,WAAA,EAAa,gBAAgB,EAAA,EAAI,MAAM,4DAAA,CAAO,qBAAoB,GAAA;AAC1E,EAAA,OAAO,eAAA,CAAgB,CAAA;AACzB,CAAA;AAEA,IAAM,aAAA,EAAe,MAAA,CAAA,EAAA,GAA2B;AAC9C,EAAA,MAAM,EAAE,YAAA,EAAc,iBAAiB,EAAA,EAAI,MAAM,4DAAA,CAAO,sBAAqB,GAA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AAA,WAAiB,MAAA,EAAQ,KAAA,CAAM,QAAA,EAAU,eAAe,CAAA,CAAA;AAClE,IAAA;AAChB,EAAA;AACD;AAKwC;AAKjC;AACF,EAAA;AACgB,IAAA;AACJ,EAAA;AACkE,IAAA;AAClE,IAAA;AAChB,EAAA;AACD;AAIY;AAEP,EAAA;AAC0B,IAAA;AACd,EAAA;AACkE,IAAA;AAClE,IAAA;AAChB,EAAA;AACD;AAIY;AAEP,EAAA;AACa,IAAA;AACuB,MAAA;AAC/B,IAAA;AACyC,MAAA;AACZ,MAAA;AACpC,IAAA;AACc,EAAA;AACkE,IAAA;AAClE,IAAA;AAChB,EAAA;AACD;AAKO;AACF,EAAA;AACsB,IAAA;AACV,EAAA;AACkE,IAAA;AAClE,IAAA;AAChB,EAAA;AACD;AAKA;AACK,EAAA;AACgB,IAAA;AACJ,EAAA;AACkE,IAAA;AAClE,IAAA;AAChB,EAAA;AACD;AAKA;AACK,EAAA;AACgB,IAAA;AACJ,EAAA;AACkE,IAAA;AAClE,IAAA;AAChB,EAAA;AACD;AAEuB","file":"/home/runner/work/langwatch/langwatch/typescript-sdk/dist/cli/index.js","sourcesContent":[null,"#!/usr/bin/env node\n\n// Load environment variables BEFORE any other imports\nimport { config } from \"dotenv\";\nconfig();\n\nimport { Command } from \"commander\";\nimport { parsePromptSpec } from \"./types\";\n\ndeclare const __CLI_VERSION__: string;\n\n// Import commands with proper async handling\nconst addCommand = async (name: string, options: { version?: string; localFile?: string }): Promise<void> => {\n const { addCommand: addCommandImpl } = await import(\"./commands/add.js\");\n return addCommandImpl(name, options);\n};\n\nconst removeCommand = async (name: string): Promise<void> => {\n const { removeCommand: removeCommandImpl } = await import(\"./commands/remove.js\");\n return removeCommandImpl(name);\n};\n\nconst initCommand = async (): Promise<void> => {\n const { initCommand: initCommandImpl } = await import(\"./commands/init.js\");\n return initCommandImpl();\n};\n\nconst loginCommand = async (): Promise<void> => {\n const { loginCommand: loginCommandImpl } = await import(\"./commands/login.js\");\n return loginCommandImpl();\n};\n\nconst listCommand = async (): Promise<void> => {\n const { listCommand: listCommandImpl } = await import(\"./commands/list.js\");\n return listCommandImpl();\n};\n\nconst syncCommand = async (): Promise<void> => {\n const { syncCommand: syncCommandImpl } = await import(\"./commands/sync.js\");\n return syncCommandImpl();\n};\n\nconst createCommand = async (name: string, options: Record<string, unknown>): Promise<void> => {\n const { createCommand: createCommandImpl } = await import(\"./commands/create.js\");\n return createCommandImpl(name, options);\n};\n\nconst program = new Command();\n\nprogram\n .name(\"langwatch\")\n .description(\"LangWatch CLI - The npm of prompts\")\n .version(__CLI_VERSION__, \"-v, --version\", \"Display the current version\")\n .configureHelp({\n showGlobalOptions: true,\n })\n .showHelpAfterError()\n .showSuggestionAfterError();\n\n// Top-level commands\nprogram\n .command(\"login\")\n .description(\"Login to LangWatch and save API key\")\n .action(async () => {\n try {\n await loginCommand();\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : \"Unknown error\"}`);\n process.exit(1);\n }\n });\n\n// Add prompt command group\nconst promptCmd = program\n .command(\"prompt\")\n .description(\"Manage prompt dependencies\");\n\npromptCmd\n .command(\"init\")\n .description(\"Initialize a new prompts project\")\n .action(async () => {\n try {\n await initCommand();\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : \"Unknown error\"}`);\n process.exit(1);\n }\n });\n\npromptCmd\n .command(\"create <name>\")\n .description(\"Create a new prompt YAML file with default content\")\n .action(async (name: string) => {\n try {\n await createCommand(name, {});\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : \"Unknown error\"}`);\n process.exit(1);\n }\n });\n\npromptCmd\n .command(\"add <spec> [localFile]\")\n .description(\"Add a prompt dependency (e.g., 'agent/foo', 'agent/bar@5') or local file\")\n .action(async (spec: string, localFile?: string) => {\n try {\n if (localFile) {\n await addCommand(spec, { localFile });\n } else {\n const { name, version } = parsePromptSpec(spec);\n await addCommand(name, { version });\n }\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : \"Unknown error\"}`);\n process.exit(1);\n }\n });\n\npromptCmd\n .command(\"remove <name>\")\n .description(\"Remove a prompt dependency\")\n .action(async (name: string) => {\n try {\n await removeCommand(name);\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : \"Unknown error\"}`);\n process.exit(1);\n }\n });\n\npromptCmd\n .command(\"list\")\n .description(\"List all available prompts on the server\")\n .action(async () => {\n try {\n await listCommand();\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : \"Unknown error\"}`);\n process.exit(1);\n }\n });\n\npromptCmd\n .command(\"sync\")\n .description(\"Sync prompts - fetch remote and push local\")\n .action(async () => {\n try {\n await syncCommand();\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : \"Unknown error\"}`);\n process.exit(1);\n }\n });\n\nprogram.parse(process.argv);"]}
@@ -9,11 +9,11 @@ import { config } from "dotenv";
9
9
  import { Command } from "commander";
10
10
  config();
11
11
  var addCommand = async (name, options) => {
12
- const { addCommand: addCommandImpl } = await import("../add-KNE3HWRY.mjs");
12
+ const { addCommand: addCommandImpl } = await import("../add-XV5SUAXF.mjs");
13
13
  return addCommandImpl(name, options);
14
14
  };
15
15
  var removeCommand = async (name) => {
16
- const { removeCommand: removeCommandImpl } = await import("../remove-5YFEQXTZ.mjs");
16
+ const { removeCommand: removeCommandImpl } = await import("../remove-F5RM4775.mjs");
17
17
  return removeCommandImpl(name);
18
18
  };
19
19
  var initCommand = async () => {
@@ -21,15 +21,15 @@ var initCommand = async () => {
21
21
  return initCommandImpl();
22
22
  };
23
23
  var loginCommand = async () => {
24
- const { loginCommand: loginCommandImpl } = await import("../login-CEO47GSW.mjs");
24
+ const { loginCommand: loginCommandImpl } = await import("../login-T2ET7TKH.mjs");
25
25
  return loginCommandImpl();
26
26
  };
27
27
  var listCommand = async () => {
28
- const { listCommand: listCommandImpl } = await import("../list-4BFJIHYB.mjs");
28
+ const { listCommand: listCommandImpl } = await import("../list-T4QS6CT2.mjs");
29
29
  return listCommandImpl();
30
30
  };
31
31
  var syncCommand = async () => {
32
- const { syncCommand: syncCommandImpl } = await import("../sync-3P54PWWR.mjs");
32
+ const { syncCommand: syncCommandImpl } = await import("../sync-VGWOLOLJ.mjs");
33
33
  return syncCommandImpl();
34
34
  };
35
35
  var createCommand = async (name, options) => {
@@ -37,7 +37,7 @@ var createCommand = async (name, options) => {
37
37
  return createCommandImpl(name, options);
38
38
  };
39
39
  var program = new Command();
40
- program.name("langwatch").description("LangWatch CLI - The npm of prompts").version("0.9.0", "-v, --version", "Display the current version").configureHelp({
40
+ program.name("langwatch").description("LangWatch CLI - The npm of prompts").version("0.11.0", "-v, --version", "Display the current version").configureHelp({
41
41
  showGlobalOptions: true
42
42
  }).showHelpAfterError().showSuggestionAfterError();
43
43
  program.command("login").description("Login to LangWatch and save API key").action(async () => {