langwatch 0.7.1 → 0.7.4

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 (86) hide show
  1. package/README.md +5 -62
  2. package/dist/{add-HWFRMAQX.mjs → add-XLEUNNZI.mjs} +7 -7
  3. package/dist/{add-5QV3TEWC.js → add-Y543UEBX.js} +24 -24
  4. package/dist/{add-5QV3TEWC.js.map → add-Y543UEBX.js.map} +1 -1
  5. package/dist/{chunk-5HAVK64Q.js → chunk-BKVMRI32.js} +2 -2
  6. package/dist/chunk-BKVMRI32.js.map +1 -0
  7. package/dist/{chunk-VMZUN4EF.js → chunk-BP2WGNIV.js} +3 -1
  8. package/dist/chunk-BP2WGNIV.js.map +1 -0
  9. package/dist/{chunk-UNMZPS55.mjs → chunk-DQU2PZAL.mjs} +3 -1
  10. package/dist/chunk-DQU2PZAL.mjs.map +1 -0
  11. package/dist/{chunk-DZH6SY3Z.js → chunk-GC7VHCU5.js} +10 -10
  12. package/dist/{chunk-DZH6SY3Z.js.map → chunk-GC7VHCU5.js.map} +1 -1
  13. package/dist/{chunk-7MG7DGPP.mjs → chunk-HRPIRC67.mjs} +2 -2
  14. package/dist/{chunk-D7UAKYVI.js → chunk-J4YLJUX5.js} +26 -16
  15. package/dist/chunk-J4YLJUX5.js.map +1 -0
  16. package/dist/{chunk-AD7QRYIJ.mjs → chunk-MBXENFRR.mjs} +2 -2
  17. package/dist/{chunk-J55AV2YW.js → chunk-MZ2O5ZJL.js} +14 -14
  18. package/dist/{chunk-J55AV2YW.js.map → chunk-MZ2O5ZJL.js.map} +1 -1
  19. package/dist/{chunk-PYVDTUA6.mjs → chunk-O6D3W3PG.mjs} +38 -49
  20. package/dist/chunk-O6D3W3PG.mjs.map +1 -0
  21. package/dist/{chunk-EPGKOTSN.mjs → chunk-QPHTXDJ5.mjs} +17 -7
  22. package/dist/chunk-QPHTXDJ5.mjs.map +1 -0
  23. package/dist/{chunk-7VHZNB2S.mjs → chunk-VMI2XPCC.mjs} +2 -2
  24. package/dist/chunk-VMI2XPCC.mjs.map +1 -0
  25. package/dist/{chunk-36XAYVMC.js → chunk-WAAQLJ67.js} +39 -50
  26. package/dist/chunk-WAAQLJ67.js.map +1 -0
  27. package/dist/cli/index.js +7 -7
  28. package/dist/cli/index.mjs +7 -7
  29. package/dist/{create-S5RDGF3H.js → create-ACGBGFVO.js} +8 -8
  30. package/dist/{create-S5RDGF3H.js.map → create-ACGBGFVO.js.map} +1 -1
  31. package/dist/{create-LXQB4EFB.mjs → create-YUOTG2TS.mjs} +3 -3
  32. package/dist/{implementation-nE9dgTwc.d.mts → implementation-BhgBtqp4.d.mts} +1 -1
  33. package/dist/{implementation-DsHp9FYU.d.ts → implementation-JKO2kHPl.d.ts} +1 -1
  34. package/dist/index.d.mts +4 -2
  35. package/dist/index.d.ts +4 -2
  36. package/dist/index.js +13 -13
  37. package/dist/index.mjs +5 -5
  38. package/dist/{init-T4YDPHBA.mjs → init-ED3OW3TK.mjs} +3 -3
  39. package/dist/{init-UADBKUJU.js → init-UFZF26SF.js} +4 -4
  40. package/dist/{init-UADBKUJU.js.map → init-UFZF26SF.js.map} +1 -1
  41. package/dist/{list-BQXECLEM.mjs → list-5C6V2OEO.mjs} +6 -6
  42. package/dist/{list-HSCIBC4Z.js → list-LULA2BWM.js} +9 -9
  43. package/dist/{list-HSCIBC4Z.js.map → list-LULA2BWM.js.map} +1 -1
  44. package/dist/{login-EUDCIJRM.js → login-RUMQOHW4.js} +3 -3
  45. package/dist/{login-EUDCIJRM.js.map → login-RUMQOHW4.js.map} +1 -1
  46. package/dist/{login-3IM3PYSJ.mjs → login-XY2RAXYR.mjs} +2 -2
  47. package/dist/observability-sdk/index.d.mts +3 -3
  48. package/dist/observability-sdk/index.d.ts +3 -3
  49. package/dist/observability-sdk/index.js +4 -4
  50. package/dist/observability-sdk/index.mjs +3 -3
  51. package/dist/observability-sdk/instrumentation/langchain/index.d.mts +1 -1
  52. package/dist/observability-sdk/instrumentation/langchain/index.d.ts +1 -1
  53. package/dist/observability-sdk/instrumentation/langchain/index.js +3 -3
  54. package/dist/observability-sdk/instrumentation/langchain/index.mjs +1 -1
  55. package/dist/observability-sdk/setup/node/index.js +29 -10
  56. package/dist/observability-sdk/setup/node/index.js.map +1 -1
  57. package/dist/observability-sdk/setup/node/index.mjs +21 -2
  58. package/dist/observability-sdk/setup/node/index.mjs.map +1 -1
  59. package/dist/{remove-IVFQAHNT.mjs → remove-GA3OQ5AQ.mjs} +6 -6
  60. package/dist/{remove-VDQ4M6JF.js → remove-NIEHQCQN.js} +14 -14
  61. package/dist/{remove-VDQ4M6JF.js.map → remove-NIEHQCQN.js.map} +1 -1
  62. package/dist/{sync-KUMBMGJS.js → sync-J2FH4OZC.js} +30 -31
  63. package/dist/sync-J2FH4OZC.js.map +1 -0
  64. package/dist/{sync-2MVHHWCX.mjs → sync-X3KE2DNE.mjs} +12 -13
  65. package/dist/sync-X3KE2DNE.mjs.map +1 -0
  66. package/dist/{types-B9772cUR.d.ts → types-DOVKZCnN.d.ts} +20 -10
  67. package/dist/{types-DbPAi4US.d.mts → types-DoNHhlm6.d.mts} +20 -10
  68. package/package.json +3 -2
  69. package/dist/chunk-36XAYVMC.js.map +0 -1
  70. package/dist/chunk-5HAVK64Q.js.map +0 -1
  71. package/dist/chunk-7VHZNB2S.mjs.map +0 -1
  72. package/dist/chunk-D7UAKYVI.js.map +0 -1
  73. package/dist/chunk-EPGKOTSN.mjs.map +0 -1
  74. package/dist/chunk-PYVDTUA6.mjs.map +0 -1
  75. package/dist/chunk-UNMZPS55.mjs.map +0 -1
  76. package/dist/chunk-VMZUN4EF.js.map +0 -1
  77. package/dist/sync-2MVHHWCX.mjs.map +0 -1
  78. package/dist/sync-KUMBMGJS.js.map +0 -1
  79. /package/dist/{add-HWFRMAQX.mjs.map → add-XLEUNNZI.mjs.map} +0 -0
  80. /package/dist/{chunk-7MG7DGPP.mjs.map → chunk-HRPIRC67.mjs.map} +0 -0
  81. /package/dist/{chunk-AD7QRYIJ.mjs.map → chunk-MBXENFRR.mjs.map} +0 -0
  82. /package/dist/{create-LXQB4EFB.mjs.map → create-YUOTG2TS.mjs.map} +0 -0
  83. /package/dist/{init-T4YDPHBA.mjs.map → init-ED3OW3TK.mjs.map} +0 -0
  84. /package/dist/{list-BQXECLEM.mjs.map → list-5C6V2OEO.mjs.map} +0 -0
  85. /package/dist/{login-3IM3PYSJ.mjs.map → login-XY2RAXYR.mjs.map} +0 -0
  86. /package/dist/{remove-IVFQAHNT.mjs.map → remove-GA3OQ5AQ.mjs.map} +0 -0
@@ -420,9 +420,11 @@ interface paths {
420
420
  message?: string;
421
421
  has_error?: boolean;
422
422
  } | null;
423
- /** @example [
423
+ /**
424
+ * @example [
424
425
  * "cccd21e0b70c706034dfd9f7772816a3"
425
- * ] */
426
+ * ]
427
+ */
426
428
  indexing_md5s?: string[];
427
429
  spans?: {
428
430
  /** @example trace_BKZL_X0TKSD4oa1aBJTc_ */
@@ -474,7 +476,8 @@ interface paths {
474
476
  input?: {
475
477
  /** @example chat_messages */
476
478
  type?: string;
477
- /** @example [
479
+ /**
480
+ * @example [
478
481
  * {
479
482
  * "role": "system",
480
483
  * "content": "You are a helpful assistant that only reply in short tweet-like responses, using lots of emojis."
@@ -483,7 +486,8 @@ interface paths {
483
486
  * "role": "user",
484
487
  * "content": "hi"
485
488
  * }
486
- * ] */
489
+ * ]
490
+ */
487
491
  value?: {
488
492
  /** @example system */
489
493
  role?: string;
@@ -494,12 +498,14 @@ interface paths {
494
498
  output?: {
495
499
  /** @example chat_messages */
496
500
  type?: string;
497
- /** @example [
501
+ /**
502
+ * @example [
498
503
  * {
499
504
  * "role": "assistant",
500
505
  * "content": "Hey there! 👋😊"
501
506
  * }
502
- * ] */
507
+ * ]
508
+ */
503
509
  value?: {
504
510
  /** @example assistant */
505
511
  role?: string;
@@ -528,9 +534,11 @@ interface paths {
528
534
  inserted_at?: number;
529
535
  };
530
536
  error?: {
531
- /** @example [
537
+ /**
538
+ * @example [
532
539
  * "TypeError: fetch failed"
533
- * ] */
540
+ * ]
541
+ */
534
542
  stacktrace?: string[];
535
543
  /** @example fetch failed */
536
544
  message?: string;
@@ -950,12 +958,14 @@ interface components {
950
958
  totalHits?: number;
951
959
  };
952
960
  DatasetPostEntries: {
953
- /** @example [
961
+ /**
962
+ * @example [
954
963
  * {
955
964
  * "input": "hi",
956
965
  * "output": "Hello, how can I help you today?"
957
966
  * }
958
- * ] */
967
+ * ]
968
+ */
959
969
  entries: {
960
970
  [key: string]: unknown;
961
971
  }[];
@@ -420,9 +420,11 @@ interface paths {
420
420
  message?: string;
421
421
  has_error?: boolean;
422
422
  } | null;
423
- /** @example [
423
+ /**
424
+ * @example [
424
425
  * "cccd21e0b70c706034dfd9f7772816a3"
425
- * ] */
426
+ * ]
427
+ */
426
428
  indexing_md5s?: string[];
427
429
  spans?: {
428
430
  /** @example trace_BKZL_X0TKSD4oa1aBJTc_ */
@@ -474,7 +476,8 @@ interface paths {
474
476
  input?: {
475
477
  /** @example chat_messages */
476
478
  type?: string;
477
- /** @example [
479
+ /**
480
+ * @example [
478
481
  * {
479
482
  * "role": "system",
480
483
  * "content": "You are a helpful assistant that only reply in short tweet-like responses, using lots of emojis."
@@ -483,7 +486,8 @@ interface paths {
483
486
  * "role": "user",
484
487
  * "content": "hi"
485
488
  * }
486
- * ] */
489
+ * ]
490
+ */
487
491
  value?: {
488
492
  /** @example system */
489
493
  role?: string;
@@ -494,12 +498,14 @@ interface paths {
494
498
  output?: {
495
499
  /** @example chat_messages */
496
500
  type?: string;
497
- /** @example [
501
+ /**
502
+ * @example [
498
503
  * {
499
504
  * "role": "assistant",
500
505
  * "content": "Hey there! 👋😊"
501
506
  * }
502
- * ] */
507
+ * ]
508
+ */
503
509
  value?: {
504
510
  /** @example assistant */
505
511
  role?: string;
@@ -528,9 +534,11 @@ interface paths {
528
534
  inserted_at?: number;
529
535
  };
530
536
  error?: {
531
- /** @example [
537
+ /**
538
+ * @example [
532
539
  * "TypeError: fetch failed"
533
- * ] */
540
+ * ]
541
+ */
534
542
  stacktrace?: string[];
535
543
  /** @example fetch failed */
536
544
  message?: string;
@@ -950,12 +958,14 @@ interface components {
950
958
  totalHits?: number;
951
959
  };
952
960
  DatasetPostEntries: {
953
- /** @example [
961
+ /**
962
+ * @example [
954
963
  * {
955
964
  * "input": "hi",
956
965
  * "output": "Hello, how can I help you today?"
957
966
  * }
958
- * ] */
967
+ * ]
968
+ */
959
969
  entries: {
960
970
  [key: string]: unknown;
961
971
  }[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "langwatch",
3
- "version": "0.7.1",
3
+ "version": "0.7.4",
4
4
  "description": "LangWatch TypeScript/JavaScript SDK. Interact with the full LangWatch API and use the LangWatch OpenTelemetry SDK to instrument your application. For more information, see https://docs.langwatch.ai/integration/typescript/guide",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -117,8 +117,9 @@
117
117
  "lint": "eslint .",
118
118
  "test": "vitest",
119
119
  "test:e2e": "vitest run -c ./vitest.e2e.config.mts",
120
- "prebuild": "pnpm i && pnpm run prepare",
120
+ "prebuild": "pnpm run prepare",
121
121
  "build": "tsc --noEmit && tsup",
122
+ "tarball": "pnpm build && pnpm pack",
122
123
  "typecheck": "tsc --noEmit",
123
124
  "prepublish": "pnpm run build",
124
125
  "generate:openapi-types": "npx openapi-typescript ../langwatch/src/app/api/openapiLangWatch.json -o ./src/internal/generated/openapi/api-client.ts",
@@ -1 +0,0 @@
1
- {"version":3,"sources":["/home/runner/work/langwatch/langwatch/typescript-sdk/dist/chunk-36XAYVMC.js","../src/cli/utils/promptConverter.ts","../src/cli/utils/fileManager.ts"],"names":["_a"],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B;AACA;ACQO,IAAM,gBAAA,EAAN,MAAsB;AAAA;AAAA;AAAA;AAAA;AAAA,EAK3B,OAAO,qBAAA,CAAsB,MAAA,EAA4C;AACvE,IAAA,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E,IAAA;AAC9E,MAAA;AACR,IAAA;AAC2G,IAAA;AAC7G,EAAA;AACF;AA8B6C;AACL,EAAA;AACU,EAAA;AAEhB,EAAA;AACtB,IAAA;AACV,EAAA;AAEyB,EAAA;AAEiC,EAAA;AACG,IAAA;AAE9B,IAAA;AACe,MAAA;AACiB,MAAA;AAElC,MAAA;AAEW,QAAA;AAChC,UAAA;AACF,QAAA;AACkC,QAAA;AAC8B,MAAA;AACd,QAAA;AACpD,MAAA;AACF,IAAA;AACF,EAAA;AAEkB,EAAA;AACX,EAAA;AACT;AAxMK;AFkVyG;AACA;AACA;AACA;AACA","file":"/home/runner/work/langwatch/langwatch/typescript-sdk/dist/chunk-36XAYVMC.js","sourcesContent":[null,"import type { LocalPromptConfig, MaterializedPrompt } from \"../types\";\nimport { type PromptResponse } from \"@/client-sdk/services/prompts/types\";\n\n/**\n * Converter utility for transforming between YAML prompt format and API service format.\n *\n * The YAML format follows the GitHub .prompt.yaml file format standard,\n * while the API format is our internal prompt service schema tied to the database.\n *\n * This separation allows us to maintain and evolve both formats independently\n * while keeping the conversion logic centralized and well-tested.\n */\nexport class PromptConverter {\n /**\n * Converts a Prompt instance from the API service to the MaterializedPrompt format\n * used for saving to the .materialized directory.\n */\n static fromApiToMaterialized(prompt: PromptResponse): MaterializedPrompt {\n return {\n id: prompt.id,\n name: prompt.name,\n version: prompt.version,\n versionId: prompt.versionId,\n model: prompt.model,\n messages: prompt.messages,\n prompt: prompt.prompt,\n temperature: prompt.temperature,\n maxTokens: prompt.maxTokens,\n inputs: prompt.inputs,\n outputs: prompt.outputs,\n updatedAt: prompt.updatedAt,\n };\n }\n\n /**\n * Converts a MaterializedPrompt to the YAML content structure\n * for saving to .prompt.yaml files.\n */\n static fromMaterializedToYaml(prompt: MaterializedPrompt): {\n model: string;\n modelParameters?: {\n temperature?: number;\n maxTokens?: number;\n };\n messages: Array<{\n role: \"system\" | \"user\" | \"assistant\";\n content: string;\n }>;\n } {\n const result: any = {\n model: prompt.model,\n messages: prompt.messages,\n };\n\n // Add modelParameters if temperature or maxTokens exist\n if (prompt.temperature !== undefined || prompt.maxTokens !== undefined) {\n result.modelParameters = {};\n if (prompt.temperature !== undefined) {\n result.modelParameters.temperature = prompt.temperature;\n }\n if (prompt.maxTokens !== undefined) {\n result.modelParameters.maxTokens = prompt.maxTokens;\n }\n }\n\n return result;\n }\n\n /**\n * Converts a LocalPromptConfig (loaded from YAML) to the format\n * expected by the API service for upserting.\n */\n static fromLocalToApiFormat(config: LocalPromptConfig): {\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 return {\n model: config.model,\n modelParameters: config.modelParameters,\n messages: config.messages,\n };\n }\n\n /**\n * Extracts the system prompt from messages array.\n * Used when converting to API format that separates system prompt from messages.\n */\n static extractSystemPrompt(\n messages: Array<{ role: string; content: string }>,\n ): string {\n return messages.find((m) => m.role === \"system\")?.content ?? \"\";\n }\n\n /**\n * Filters out system messages from the messages array.\n * Used when converting to API format that handles system prompt separately.\n */\n static filterNonSystemMessages(\n messages: Array<{\n role: \"system\" | \"user\" | \"assistant\";\n content: string;\n }>,\n ): Array<{ role: \"user\" | \"assistant\"; content: string }> {\n return messages.filter((m) => m.role !== \"system\") as Array<{\n role: \"user\" | \"assistant\";\n content: string;\n }>;\n }\n\n /**\n * Converts version specification strings to actual version constraints.\n * Handles npm-style version specs like \"latest\", \"5\", \"^5\", etc.\n */\n static parseVersionSpec(versionSpec: string): {\n type: \"latest\" | \"exact\" | \"tag\";\n value: string;\n } {\n if (versionSpec === \"latest\") {\n return { type: \"latest\", value: \"latest\" };\n }\n\n // For now, treat everything else as tags until we implement proper semver\n if (/^\\d+$/.test(versionSpec)) {\n return { type: \"exact\", value: versionSpec };\n }\n\n // Handle prefixes like ^, ~, etc. as tags for now\n return { type: \"tag\", value: versionSpec };\n }\n\n /**\n * Validates that a YAML config can be safely converted to API format.\n * Returns validation errors if any, or null if valid.\n */\n static validateForApiConversion(config: LocalPromptConfig): string[] {\n const errors: string[] = [];\n\n if (!config.model?.trim()) {\n errors.push(\"Model is required and cannot be empty\");\n }\n\n if (!config.messages || config.messages.length === 0) {\n errors.push(\"At least one message is required\");\n }\n\n if (config.messages) {\n config.messages.forEach((message, index) => {\n if (![\"system\", \"user\", \"assistant\"].includes(message.role)) {\n errors.push(\n `Message ${index}: role must be 'system', 'user', or 'assistant'`,\n );\n }\n if (!message.content?.trim()) {\n errors.push(`Message ${index}: content cannot be empty`);\n }\n });\n }\n\n return errors;\n }\n}\n","import * as fs from \"fs\";\nimport * as path from \"path\";\nimport * as yaml from \"js-yaml\";\nimport chalk from \"chalk\";\nimport type { PromptsConfig, LocalPromptConfig, MaterializedPrompt, PromptsLock } from \"../types\";\nimport { localPromptConfigSchema } from \"../types\";\nimport { PromptConverter } from \"@/cli/utils/promptConverter\";\n\nexport class FileManager {\n private static readonly PROMPTS_CONFIG_FILE = \"prompts.json\";\n private static readonly PROMPTS_LOCK_FILE = \"prompts-lock.json\";\n private static readonly PROMPTS_DIR = \"prompts\";\n private static readonly MATERIALIZED_DIR = \".materialized\";\n\n static getPromptsConfigPath(): string {\n return path.join(process.cwd(), this.PROMPTS_CONFIG_FILE);\n }\n\n static getPromptsLockPath(): string {\n return path.join(process.cwd(), this.PROMPTS_LOCK_FILE);\n }\n\n static getPromptsDir(): string {\n return path.join(process.cwd(), this.PROMPTS_DIR);\n }\n\n static getMaterializedDir(): string {\n return path.join(this.getPromptsDir(), this.MATERIALIZED_DIR);\n }\n\n static ensureDirectories(): void {\n const promptsDir = this.getPromptsDir();\n const materializedDir = this.getMaterializedDir();\n\n if (!fs.existsSync(promptsDir)) {\n fs.mkdirSync(promptsDir, { recursive: true });\n }\n\n if (!fs.existsSync(materializedDir)) {\n fs.mkdirSync(materializedDir, { recursive: true });\n }\n }\n\n static loadPromptsConfig(): PromptsConfig {\n const configPath = this.getPromptsConfigPath();\n\n if (!fs.existsSync(configPath)) {\n return { prompts: {} };\n }\n\n try {\n const content = fs.readFileSync(configPath, \"utf-8\");\n return JSON.parse(content) as PromptsConfig;\n } catch (error) {\n throw new Error(`Failed to parse prompts.json: ${error instanceof Error ? error.message : \"Unknown error\"}`);\n }\n }\n\n static savePromptsConfig(config: PromptsConfig): void {\n const configPath = this.getPromptsConfigPath();\n fs.writeFileSync(configPath, JSON.stringify(config, null, 2) + \"\\n\");\n }\n\n static initializePromptsConfig(): { created: boolean; path: string } {\n const configPath = this.getPromptsConfigPath();\n const existed = fs.existsSync(configPath);\n\n if (!existed) {\n const emptyConfig: PromptsConfig = { prompts: {} };\n this.savePromptsConfig(emptyConfig);\n return { created: true, path: configPath };\n }\n\n return { created: false, path: configPath };\n }\n\n static loadPromptsLock = (): PromptsLock => {\n const lockPath = this.getPromptsLockPath();\n\n if (!fs.existsSync(lockPath)) {\n return {\n lockfileVersion: 1,\n prompts: {}\n };\n }\n\n try {\n const content = fs.readFileSync(lockPath, \"utf-8\");\n return JSON.parse(content) as PromptsLock;\n } catch (error) {\n throw new Error(`Failed to parse prompts-lock.json: ${error instanceof Error ? error.message : \"Unknown error\"}`);\n }\n }\n\n static savePromptsLock(lock: PromptsLock): void {\n const lockPath = this.getPromptsLockPath();\n fs.writeFileSync(lockPath, JSON.stringify(lock, null, 2) + \"\\n\");\n }\n\n static initializePromptsLock(): { created: boolean; path: string } {\n const lockPath = this.getPromptsLockPath();\n const existed = fs.existsSync(lockPath);\n\n if (!existed) {\n const emptyLock: PromptsLock = {\n lockfileVersion: 1,\n prompts: {}\n };\n this.savePromptsLock(emptyLock);\n return { created: true, path: lockPath };\n }\n\n return { created: false, path: lockPath };\n }\n\n static loadLocalPrompt = (filePath: string): LocalPromptConfig => {\n const fullPath = path.resolve(filePath);\n\n if (!fs.existsSync(fullPath)) {\n throw new Error(`Local prompt file not found: ${filePath}`);\n }\n\n try {\n const content = fs.readFileSync(fullPath, \"utf-8\");\n const rawData = yaml.load(content);\n\n // Validate with zod and provide nice error messages\n const result = localPromptConfigSchema.safeParse(rawData);\n\n if (!result.success) {\n // Format zod errors nicely (manually since z.prettifyError might not be available)\n const prettyError = result.error.issues\n .map(issue => `✖ ${issue.message}${issue.path.length > 0 ? `\\n → at ${issue.path.join('.')}` : ''}`)\n .join('\\n');\n\n throw new Error(\n `Invalid prompt configuration in ${chalk.yellow(filePath)}:\\n${prettyError}`\n );\n }\n\n return result.data;\n } catch (error) {\n if (error instanceof Error && error.message.includes(\"Invalid prompt configuration\")) {\n throw error; // Re-throw zod validation errors as-is\n }\n throw new Error(`Failed to parse local prompt file ${filePath}: ${error instanceof Error ? error.message : \"Unknown error\"}`);\n }\n }\n\n static saveMaterializedPrompt(name: string, prompt: MaterializedPrompt): string {\n const materializedDir = this.getMaterializedDir();\n const parts = name.split(\"/\");\n const fileName = `${parts[parts.length - 1]}.prompt.yaml`;\n\n // Create nested directories if needed\n if (parts.length > 1) {\n const subDir = path.join(materializedDir, ...parts.slice(0, -1));\n if (!fs.existsSync(subDir)) {\n fs.mkdirSync(subDir, { recursive: true });\n }\n }\n\n const filePath = path.join(materializedDir, ...parts.slice(0, -1), fileName);\n\n // Convert to YAML format using the converter\n const yamlContent = PromptConverter.fromMaterializedToYaml(prompt);\n\n const yamlString = yaml.dump(yamlContent, {\n lineWidth: -1,\n noRefs: true,\n sortKeys: false\n });\n\n fs.writeFileSync(filePath, yamlString);\n return filePath;\n }\n\n static getLocalPromptFiles = (): string[] => {\n const promptsDir = this.getPromptsDir();\n const materializedDir = this.getMaterializedDir();\n\n if (!fs.existsSync(promptsDir)) {\n return [];\n }\n\n const files: string[] = [];\n\n const walkDir = (dir: string, relativePath = \"\"): void => {\n const entries = fs.readdirSync(dir, { withFileTypes: true });\n\n for (const entry of entries) {\n const fullPath = path.join(dir, entry.name);\n const relativeFilePath = path.join(relativePath, entry.name);\n\n if (entry.isDirectory()) {\n // Skip the .materialized directory\n if (fullPath === materializedDir) {\n continue;\n }\n walkDir(fullPath, relativeFilePath);\n } else if (entry.isFile() && entry.name.endsWith(\".prompt.yaml\")) {\n files.push(path.join(promptsDir, relativeFilePath));\n }\n }\n };\n\n walkDir(promptsDir);\n return files;\n }\n\n static promptNameFromPath(filePath: string): string {\n const promptsDir = this.getPromptsDir();\n const relativePath = path.relative(promptsDir, filePath);\n return relativePath.replace(/\\.prompt\\.yaml$/, \"\");\n }\n\n static cleanupOrphanedMaterializedFiles(currentDependencies: Set<string>): string[] {\n const materializedDir = this.getMaterializedDir();\n\n if (!fs.existsSync(materializedDir)) {\n return [];\n }\n\n const cleaned: string[] = [];\n\n const cleanupDir = (dir: string, relativePath = \"\"): void => {\n const entries = fs.readdirSync(dir, { withFileTypes: true });\n\n for (const entry of entries) {\n const fullPath = path.join(dir, entry.name);\n const relativeFilePath = path.join(relativePath, entry.name);\n\n if (entry.isDirectory()) {\n cleanupDir(fullPath, relativeFilePath);\n\n // Remove empty directories\n try {\n const dirEntries = fs.readdirSync(fullPath);\n if (dirEntries.length === 0) {\n fs.rmdirSync(fullPath);\n }\n } catch {\n // Directory not empty or other error, ignore\n }\n } else if (entry.isFile() && entry.name.endsWith(\".prompt.yaml\")) {\n // Extract prompt name from materialized file path\n const promptName = relativeFilePath.replace(/\\.prompt\\.yaml$/, \"\");\n\n if (!currentDependencies.has(promptName)) {\n fs.unlinkSync(fullPath);\n cleaned.push(promptName);\n }\n }\n }\n };\n\n cleanupDir(materializedDir);\n return cleaned;\n }\n\n static updateLockEntry(lock: PromptsLock, name: string, prompt: MaterializedPrompt, materializedPath: string): void {\n const relativePath = path.relative(process.cwd(), materializedPath);\n\n lock.prompts[name] = {\n version: prompt.version,\n versionId: prompt.versionId,\n materialized: relativePath,\n };\n }\n\n static removeFromLock(lock: PromptsLock, names: string[]): void {\n for (const name of names) {\n delete lock.prompts[name];\n }\n }\n\n static addToGitignore(entry: string): { added: boolean; existed: boolean } {\n const gitignorePath = path.join(process.cwd(), \".gitignore\");\n\n // Check if .gitignore exists\n if (!fs.existsSync(gitignorePath)) {\n // Create new .gitignore with the entry\n fs.writeFileSync(gitignorePath, `${entry}\\n`);\n return { added: true, existed: false };\n }\n\n // Read existing .gitignore\n const content = fs.readFileSync(gitignorePath, \"utf-8\");\n const lines = content.split(\"\\n\").map(line => line.trim());\n\n // Check if entry already exists\n if (lines.includes(entry)) {\n return { added: false, existed: true };\n }\n\n // Add entry to .gitignore\n const newContent = content.endsWith(\"\\n\") ? `${content}${entry}\\n` : `${content}\\n${entry}\\n`;\n fs.writeFileSync(gitignorePath, newContent);\n\n return { added: true, existed: false };\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["/home/runner/work/langwatch/langwatch/typescript-sdk/dist/chunk-5HAVK64Q.js","../package.json","../src/internal/runtime.ts","../src/internal/constants.ts"],"names":[],"mappings":"AAAA;ACEI,IAAA,QAAA,EAAW,OAAA;ADAf;AACA;AEDA,IAAI,QAAA;AAMG,IAAM,WAAA,EAAa,CAAA,EAAA,GAAiB;AACzC,EAAA,SAAA,GAAA,KAAA,EAAA,SAAA,EAAA,SAAA,EAAa,aAAA,CAAc,CAAA;AAC3B,EAAA,OAAO,QAAA;AACT,CAAA;AAcO,SAAS,aAAA,CAAc,OAAA,EAA0B;AAzBxD,EAAA,IAAA,EAAA;AA0BE,EAAA,IAAI,EAAA,EAAI,UAAA;AACR,EAAA,GAAA,CAAI,OAAA,EAAS;AACX,IAAA,GAAA,CAAI,OAAA,CAAQ,GAAA,CAAI,SAAA,IAAa,MAAA,EAAQ;AACnC,MAAA,EAAA,EAAI,OAAA;AAAA,IACN,EAAA,KAAO;AACL,MAAA,OAAA,CAAQ,IAAA,CAAK,oGAAoG,CAAA;AAAA,IACnH;AAAA,EACF;AAEA,EAAA,IAAI;AACF,IAAA,GAAA,CACE,OAAA,GAAU,EAAA,GACV,OAAO,CAAA,CAAE,KAAA,IAAS,SAAA,GAClB,CAAA,CAAE,KAAA,GACF,UAAA,GAAa,CAAA,CAAE,KAAA,GACf,OAAO,CAAA,CAAE,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Ac,qBAAA;AACpB,IAAM,UAAA,EAAY,mBAAA;AHmCzB;AACA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,ifAAC","file":"/home/runner/work/langwatch/langwatch/typescript-sdk/dist/chunk-5HAVK64Q.js","sourcesContent":[null,"{\n \"name\": \"langwatch\",\n \"version\": \"0.7.1\",\n \"description\": \"LangWatch TypeScript/JavaScript SDK. Interact with the full LangWatch API and use the LangWatch OpenTelemetry SDK to instrument your application. For more information, see https://docs.langwatch.ai/integration/typescript/guide\",\n \"main\": \"dist/index.js\",\n \"module\": \"dist/index.mjs\",\n \"types\": \"dist/index.d.ts\",\n \"author\": \"LangWatch\",\n \"license\": \"MIT\",\n \"engines\": {\n \"node\": \">=20\",\n \"pnpm\": \">=8\"\n },\n \"files\": [\n \"dist\",\n \"README.md\",\n \"LICENSE\"\n ],\n \"bin\": {\n \"langwatch\": \"./dist/cli/index.js\"\n },\n \"exports\": {\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"import\": \"./dist/index.mjs\",\n \"require\": \"./dist/index.js\"\n },\n \"./observability\": {\n \"types\": \"./dist/observability-sdk/index.d.ts\",\n \"require\": \"./dist/observability-sdk/index.js\",\n \"import\": \"./dist/observability-sdk/index.mjs\"\n },\n \"./observability/node\": {\n \"types\": \"./dist/observability-sdk/setup/node/index.d.ts\",\n \"require\": \"./dist/observability-sdk/setup/node/index.js\",\n \"import\": \"./dist/observability-sdk/setup/node/index.mjs\"\n },\n \"./observability/instrumentation/langchain\": {\n \"types\": \"./dist/observability-sdk/instrumentation/langchain/index.d.ts\",\n \"require\": \"./dist/observability-sdk/instrumentation/langchain/index.js\",\n \"import\": \"./dist/observability-sdk/instrumentation/langchain/index.mjs\"\n }\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/langwatch/langwatch.git\",\n \"directory\": \"typescript-sdk\"\n },\n \"scripts\": {\n \"prepare\": \"pnpm run generate:server-types && pnpm run generate:openapi-types\",\n \"cli\": \"node dist/cli/index.js\",\n \"lint\": \"eslint .\",\n \"test\": \"vitest\",\n \"test:e2e\": \"vitest run -c ./vitest.e2e.config.mts\",\n \"prebuild\": \"pnpm i && pnpm run prepare\",\n \"build\": \"tsc --noEmit && tsup\",\n \"typecheck\": \"tsc --noEmit\",\n \"prepublish\": \"pnpm run build\",\n \"generate:openapi-types\": \"npx openapi-typescript ../langwatch/src/app/api/openapiLangWatch.json -o ./src/internal/generated/openapi/api-client.ts\",\n \"generate:server-types\": \"./copy-types.sh\"\n },\n \"devDependencies\": {\n \"@eslint/js\": \"^9.32.0\",\n \"@langchain/core\": \">=0.3.68 <0.4.0\",\n \"@langchain/langgraph\": \">=0.4.0 <1.0.0\",\n \"@langchain/openai\": \">=0.6.0 <1.0.0\",\n \"@opentelemetry/sdk-node\": \"0.205.0\",\n \"@opentelemetry/sdk-trace-node\": \"^2.0.1\",\n \"@opentelemetry/sdk-trace-web\": \">=2.0.1\",\n \"@types/debug\": \"^4.1.12\",\n \"@types/js-yaml\": \"^4.0.9\",\n \"@types/node\": \"^24.1.0\",\n \"@typescript/native-preview\": \"7.0.0-dev.20250804.1\",\n \"@vercel/otel\": \"^1.13.0\",\n \"@vitest/coverage-v8\": \"3.2.4\",\n \"esbuild\": \"^0.25.8\",\n \"eslint\": \"^9.32.0\",\n \"fets\": \"^0.8.5\",\n \"fishery\": \"^2.3.1\",\n \"langchain\": \">=0.3.0 <1.0.0\",\n \"msw\": \"^2.10.4\",\n \"nock\": \"^14.0.8\",\n \"openapi-msw\": \"^1.2.0\",\n \"ts-to-zod\": \"4.0.1\",\n \"tsup\": \"^8.5.0\",\n \"typescript\": \"^5.9.2\",\n \"typescript-eslint\": \"^8.38.0\",\n \"vitest\": \"^3.2.4\",\n \"vitest-mock-extended\": \"^3.1.0\",\n \"yaml\": \"^2.8.1\"\n },\n \"dependencies\": {\n \"@opentelemetry/api\": \"^1.9.0\",\n \"@opentelemetry/api-logs\": \"0.205.0\",\n \"@opentelemetry/core\": \"^2.0.1\",\n \"@opentelemetry/exporter-logs-otlp-http\": \"0.205.0\",\n \"@opentelemetry/exporter-trace-otlp-http\": \"0.205.0\",\n \"@opentelemetry/instrumentation\": \"0.205.0\",\n \"@opentelemetry/resources\": \"^2.0.1\",\n \"@opentelemetry/sdk-logs\": \"0.205.0\",\n \"@opentelemetry/sdk-metrics\": \"^2.0.1\",\n \"@opentelemetry/sdk-trace-base\": \"^2.0.1\",\n \"@opentelemetry/semantic-conventions\": \"^1.36.0\",\n \"@types/prompts\": \"^2.4.9\",\n \"chalk\": \"^4.1.2\",\n \"commander\": \"^12.0.0\",\n \"dotenv\": \"^16.6.1\",\n \"js-yaml\": \"^4.1.0\",\n \"liquidjs\": \"^10.21.1\",\n \"open\": \"^10.2.0\",\n \"openapi-fetch\": \"^0.14.0\",\n \"ora\": \"^5.4.1\",\n \"prompts\": \"^2.4.2\",\n \"xksuid\": \"^0.0.4\",\n \"zod\": \"^4.0.14\"\n },\n \"peerDependencies\": {\n \"@ai-sdk/openai\": \">=2.0.0 <3.0.0\",\n \"@langchain/core\": \">=0.3.0 <1.0.0\",\n \"@langchain/langgraph\": \">=0.4.0 <1.0.0\",\n \"@langchain/openai\": \">=0.6.0 <1.0.0\",\n \"@opentelemetry/context-async-hooks\": \"^2.1.0\",\n \"@opentelemetry/context-zone\": \">=1.19.0 <3.0.0\",\n \"@opentelemetry/sdk-node\": \">=0.200.0 <1.0.0\",\n \"@opentelemetry/sdk-trace-web\": \">=1.19.0 <3.0.0\",\n \"langchain\": \">=0.3.0 <1.0.0\"\n },\n \"pnpm\": {\n \"overrides\": {\n \"@opentelemetry/api\": \"^1.9.0\",\n \"@opentelemetry/core\": \"^2.0.1\",\n \"@opentelemetry/resources\": \"^2.0.1\",\n \"@opentelemetry/sdk-trace-base\": \"^2.0.1\",\n \"@opentelemetry/instrumentation\": \"0.205.0\",\n \"@opentelemetry/sdk-node\": \"0.205.0\",\n \"@opentelemetry/context-async-hooks\": \"^2.1.0\",\n \"@opentelemetry/api-logs\": \"0.205.0\",\n \"@opentelemetry/sdk-logs\": \"0.205.0\",\n \"@opentelemetry/exporter-logs-otlp-http\": \"0.205.0\",\n \"@opentelemetry/exporter-trace-otlp-http\": \"0.205.0\",\n \"zod\": \"^4.0.14\"\n }\n }\n}\n","export type JsRuntime = \"node\" | \"deno\" | \"bun\" | \"web\" | \"unknown\";\n\nlet _runtime: JsRuntime | undefined;\n\n/**\n * Gets the cached JavaScript runtime environment.\n * @returns The detected runtime environment\n */\nexport const getRuntime = (): JsRuntime => {\n _runtime ??= detectRuntime();\n return _runtime;\n};\n\n/**\n * Resets the cached runtime. Only used for testing.\n * @internal\n */\nexport const resetRuntimeCache = (): void => {\n _runtime = undefined;\n};\n\n/**\n * Detects the JavaScript runtime environment.\n * @param globals - (Test only) Optionally override the global object for environment simulation. Only used if NODE_ENV === 'test'.\n */\nexport function detectRuntime(globals?: any): JsRuntime {\n let g = globalThis;\n if (globals) {\n if (process.env.NODE_ENV === \"test\") {\n g = globals;\n } else {\n console.warn(\"[LangWatch Observability] overriding detectRuntime is only supported when running in NODE_ENV=test\");\n }\n }\n\n try {\n if (\n \"Deno\" in g &&\n typeof g.Deno === \"object\" &&\n g.Deno &&\n 'version' in g.Deno &&\n typeof g.Deno.version === \"object\"\n ) {\n return \"deno\";\n }\n if (\n \"Bun\" in g &&\n typeof g.Bun === \"object\" &&\n g.Bun &&\n 'version' in g.Bun &&\n typeof g.Bun.version === \"string\"\n ) {\n return \"bun\";\n }\n if (\n \"process\" in g &&\n typeof g.process === \"object\" &&\n g.process &&\n typeof g.process.versions === \"object\" &&\n typeof g.process.versions.node === \"string\"\n ) {\n return \"node\";\n }\n if (\n typeof g.window?.document !== \"undefined\" &&\n g === g.window\n ) {\n return \"web\";\n }\n return \"unknown\";\n } catch (error) {\n console.warn(\"[LangWatch Observability] Failed to detect runtime\", error);\n return \"unknown\";\n }\n}\n","import { version } from \"../../package.json\";\nimport { getRuntime } from \"./runtime\";\n\nexport const LANGWATCH_SDK_RUNTIME = getRuntime;\n\nexport const LANGWATCH_SDK_NAME_OBSERVABILITY = \"langwatch-observability-sdk\";\nexport const LANGWATCH_SDK_NAME_CLIENT = \"langwatch-client-sdk\";\nexport const LANGWATCH_SDK_LANGUAGE = \"typescript\";\nexport const LANGWATCH_SDK_VERSION = version;\n\nexport const DEFAULT_ENDPOINT = \"https://app.langwatch.ai/\";\nexport const DEFAULT_SERVICE_NAME = \"unknown-service.langwatch\";\n\nexport const TRACES_PATH = \"/api/otel/v1/traces\";\nexport const LOGS_PATH = \"/api/otel/v1/logs\";\nexport const METRICS_PATH = \"/api/otel/v1/metrics\";\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../package.json","../src/internal/runtime.ts","../src/internal/constants.ts"],"sourcesContent":["{\n \"name\": \"langwatch\",\n \"version\": \"0.7.1\",\n \"description\": \"LangWatch TypeScript/JavaScript SDK. Interact with the full LangWatch API and use the LangWatch OpenTelemetry SDK to instrument your application. For more information, see https://docs.langwatch.ai/integration/typescript/guide\",\n \"main\": \"dist/index.js\",\n \"module\": \"dist/index.mjs\",\n \"types\": \"dist/index.d.ts\",\n \"author\": \"LangWatch\",\n \"license\": \"MIT\",\n \"engines\": {\n \"node\": \">=20\",\n \"pnpm\": \">=8\"\n },\n \"files\": [\n \"dist\",\n \"README.md\",\n \"LICENSE\"\n ],\n \"bin\": {\n \"langwatch\": \"./dist/cli/index.js\"\n },\n \"exports\": {\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"import\": \"./dist/index.mjs\",\n \"require\": \"./dist/index.js\"\n },\n \"./observability\": {\n \"types\": \"./dist/observability-sdk/index.d.ts\",\n \"require\": \"./dist/observability-sdk/index.js\",\n \"import\": \"./dist/observability-sdk/index.mjs\"\n },\n \"./observability/node\": {\n \"types\": \"./dist/observability-sdk/setup/node/index.d.ts\",\n \"require\": \"./dist/observability-sdk/setup/node/index.js\",\n \"import\": \"./dist/observability-sdk/setup/node/index.mjs\"\n },\n \"./observability/instrumentation/langchain\": {\n \"types\": \"./dist/observability-sdk/instrumentation/langchain/index.d.ts\",\n \"require\": \"./dist/observability-sdk/instrumentation/langchain/index.js\",\n \"import\": \"./dist/observability-sdk/instrumentation/langchain/index.mjs\"\n }\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/langwatch/langwatch.git\",\n \"directory\": \"typescript-sdk\"\n },\n \"scripts\": {\n \"prepare\": \"pnpm run generate:server-types && pnpm run generate:openapi-types\",\n \"cli\": \"node dist/cli/index.js\",\n \"lint\": \"eslint .\",\n \"test\": \"vitest\",\n \"test:e2e\": \"vitest run -c ./vitest.e2e.config.mts\",\n \"prebuild\": \"pnpm i && pnpm run prepare\",\n \"build\": \"tsc --noEmit && tsup\",\n \"typecheck\": \"tsc --noEmit\",\n \"prepublish\": \"pnpm run build\",\n \"generate:openapi-types\": \"npx openapi-typescript ../langwatch/src/app/api/openapiLangWatch.json -o ./src/internal/generated/openapi/api-client.ts\",\n \"generate:server-types\": \"./copy-types.sh\"\n },\n \"devDependencies\": {\n \"@eslint/js\": \"^9.32.0\",\n \"@langchain/core\": \">=0.3.68 <0.4.0\",\n \"@langchain/langgraph\": \">=0.4.0 <1.0.0\",\n \"@langchain/openai\": \">=0.6.0 <1.0.0\",\n \"@opentelemetry/sdk-node\": \"0.205.0\",\n \"@opentelemetry/sdk-trace-node\": \"^2.0.1\",\n \"@opentelemetry/sdk-trace-web\": \">=2.0.1\",\n \"@types/debug\": \"^4.1.12\",\n \"@types/js-yaml\": \"^4.0.9\",\n \"@types/node\": \"^24.1.0\",\n \"@typescript/native-preview\": \"7.0.0-dev.20250804.1\",\n \"@vercel/otel\": \"^1.13.0\",\n \"@vitest/coverage-v8\": \"3.2.4\",\n \"esbuild\": \"^0.25.8\",\n \"eslint\": \"^9.32.0\",\n \"fets\": \"^0.8.5\",\n \"fishery\": \"^2.3.1\",\n \"langchain\": \">=0.3.0 <1.0.0\",\n \"msw\": \"^2.10.4\",\n \"nock\": \"^14.0.8\",\n \"openapi-msw\": \"^1.2.0\",\n \"ts-to-zod\": \"4.0.1\",\n \"tsup\": \"^8.5.0\",\n \"typescript\": \"^5.9.2\",\n \"typescript-eslint\": \"^8.38.0\",\n \"vitest\": \"^3.2.4\",\n \"vitest-mock-extended\": \"^3.1.0\",\n \"yaml\": \"^2.8.1\"\n },\n \"dependencies\": {\n \"@opentelemetry/api\": \"^1.9.0\",\n \"@opentelemetry/api-logs\": \"0.205.0\",\n \"@opentelemetry/core\": \"^2.0.1\",\n \"@opentelemetry/exporter-logs-otlp-http\": \"0.205.0\",\n \"@opentelemetry/exporter-trace-otlp-http\": \"0.205.0\",\n \"@opentelemetry/instrumentation\": \"0.205.0\",\n \"@opentelemetry/resources\": \"^2.0.1\",\n \"@opentelemetry/sdk-logs\": \"0.205.0\",\n \"@opentelemetry/sdk-metrics\": \"^2.0.1\",\n \"@opentelemetry/sdk-trace-base\": \"^2.0.1\",\n \"@opentelemetry/semantic-conventions\": \"^1.36.0\",\n \"@types/prompts\": \"^2.4.9\",\n \"chalk\": \"^4.1.2\",\n \"commander\": \"^12.0.0\",\n \"dotenv\": \"^16.6.1\",\n \"js-yaml\": \"^4.1.0\",\n \"liquidjs\": \"^10.21.1\",\n \"open\": \"^10.2.0\",\n \"openapi-fetch\": \"^0.14.0\",\n \"ora\": \"^5.4.1\",\n \"prompts\": \"^2.4.2\",\n \"xksuid\": \"^0.0.4\",\n \"zod\": \"^4.0.14\"\n },\n \"peerDependencies\": {\n \"@ai-sdk/openai\": \">=2.0.0 <3.0.0\",\n \"@langchain/core\": \">=0.3.0 <1.0.0\",\n \"@langchain/langgraph\": \">=0.4.0 <1.0.0\",\n \"@langchain/openai\": \">=0.6.0 <1.0.0\",\n \"@opentelemetry/context-async-hooks\": \"^2.1.0\",\n \"@opentelemetry/context-zone\": \">=1.19.0 <3.0.0\",\n \"@opentelemetry/sdk-node\": \">=0.200.0 <1.0.0\",\n \"@opentelemetry/sdk-trace-web\": \">=1.19.0 <3.0.0\",\n \"langchain\": \">=0.3.0 <1.0.0\"\n },\n \"pnpm\": {\n \"overrides\": {\n \"@opentelemetry/api\": \"^1.9.0\",\n \"@opentelemetry/core\": \"^2.0.1\",\n \"@opentelemetry/resources\": \"^2.0.1\",\n \"@opentelemetry/sdk-trace-base\": \"^2.0.1\",\n \"@opentelemetry/instrumentation\": \"0.205.0\",\n \"@opentelemetry/sdk-node\": \"0.205.0\",\n \"@opentelemetry/context-async-hooks\": \"^2.1.0\",\n \"@opentelemetry/api-logs\": \"0.205.0\",\n \"@opentelemetry/sdk-logs\": \"0.205.0\",\n \"@opentelemetry/exporter-logs-otlp-http\": \"0.205.0\",\n \"@opentelemetry/exporter-trace-otlp-http\": \"0.205.0\",\n \"zod\": \"^4.0.14\"\n }\n }\n}\n","export type JsRuntime = \"node\" | \"deno\" | \"bun\" | \"web\" | \"unknown\";\n\nlet _runtime: JsRuntime | undefined;\n\n/**\n * Gets the cached JavaScript runtime environment.\n * @returns The detected runtime environment\n */\nexport const getRuntime = (): JsRuntime => {\n _runtime ??= detectRuntime();\n return _runtime;\n};\n\n/**\n * Resets the cached runtime. Only used for testing.\n * @internal\n */\nexport const resetRuntimeCache = (): void => {\n _runtime = undefined;\n};\n\n/**\n * Detects the JavaScript runtime environment.\n * @param globals - (Test only) Optionally override the global object for environment simulation. Only used if NODE_ENV === 'test'.\n */\nexport function detectRuntime(globals?: any): JsRuntime {\n let g = globalThis;\n if (globals) {\n if (process.env.NODE_ENV === \"test\") {\n g = globals;\n } else {\n console.warn(\"[LangWatch Observability] overriding detectRuntime is only supported when running in NODE_ENV=test\");\n }\n }\n\n try {\n if (\n \"Deno\" in g &&\n typeof g.Deno === \"object\" &&\n g.Deno &&\n 'version' in g.Deno &&\n typeof g.Deno.version === \"object\"\n ) {\n return \"deno\";\n }\n if (\n \"Bun\" in g &&\n typeof g.Bun === \"object\" &&\n g.Bun &&\n 'version' in g.Bun &&\n typeof g.Bun.version === \"string\"\n ) {\n return \"bun\";\n }\n if (\n \"process\" in g &&\n typeof g.process === \"object\" &&\n g.process &&\n typeof g.process.versions === \"object\" &&\n typeof g.process.versions.node === \"string\"\n ) {\n return \"node\";\n }\n if (\n typeof g.window?.document !== \"undefined\" &&\n g === g.window\n ) {\n return \"web\";\n }\n return \"unknown\";\n } catch (error) {\n console.warn(\"[LangWatch Observability] Failed to detect runtime\", error);\n return \"unknown\";\n }\n}\n","import { version } from \"../../package.json\";\nimport { getRuntime } from \"./runtime\";\n\nexport const LANGWATCH_SDK_RUNTIME = getRuntime;\n\nexport const LANGWATCH_SDK_NAME_OBSERVABILITY = \"langwatch-observability-sdk\";\nexport const LANGWATCH_SDK_NAME_CLIENT = \"langwatch-client-sdk\";\nexport const LANGWATCH_SDK_LANGUAGE = \"typescript\";\nexport const LANGWATCH_SDK_VERSION = version;\n\nexport const DEFAULT_ENDPOINT = \"https://app.langwatch.ai/\";\nexport const DEFAULT_SERVICE_NAME = \"unknown-service.langwatch\";\n\nexport const TRACES_PATH = \"/api/otel/v1/traces\";\nexport const LOGS_PATH = \"/api/otel/v1/logs\";\nexport const METRICS_PATH = \"/api/otel/v1/metrics\";\n"],"mappings":";AAEI,cAAW;;;ACAf,IAAI;AAMG,IAAM,aAAa,MAAiB;AACzC,2CAAa,cAAc;AAC3B,SAAO;AACT;AAcO,SAAS,cAAc,SAA0B;AAzBxD;AA0BE,MAAI,IAAI;AACR,MAAI,SAAS;AACX,QAAI,QAAQ,IAAI,aAAa,QAAQ;AACnC,UAAI;AAAA,IACN,OAAO;AACL,cAAQ,KAAK,oGAAoG;AAAA,IACnH;AAAA,EACF;AAEA,MAAI;AACF,QACE,UAAU,KACV,OAAO,EAAE,SAAS,YAClB,EAAE,QACF,aAAa,EAAE,QACf,OAAO,EAAE,KAAK,YAAY,UAC1B;AACA,aAAO;AAAA,IACT;AACA,QACE,SAAS,KACT,OAAO,EAAE,QAAQ,YACjB,EAAE,OACF,aAAa,EAAE,OACf,OAAO,EAAE,IAAI,YAAY,UACzB;AACA,aAAO;AAAA,IACT;AACA,QACE,aAAa,KACb,OAAO,EAAE,YAAY,YACrB,EAAE,WACF,OAAO,EAAE,QAAQ,aAAa,YAC9B,OAAO,EAAE,QAAQ,SAAS,SAAS,UACnC;AACA,aAAO;AAAA,IACT;AACA,QACE,SAAO,OAAE,WAAF,mBAAU,cAAa,eAC9B,MAAM,EAAE,QACR;AACA,aAAO;AAAA,IACT;AACA,WAAO;AAAA,EACT,SAAS,OAAO;AACd,YAAQ,KAAK,sDAAsD,KAAK;AACxE,WAAO;AAAA,EACT;AACF;;;ACvEO,IAAM,wBAAwB;AAE9B,IAAM,mCAAmC;AACzC,IAAM,4BAA4B;AAClC,IAAM,yBAAyB;AAC/B,IAAM,wBAAwB;AAE9B,IAAM,mBAAmB;AACzB,IAAM,uBAAuB;AAE7B,IAAM,cAAc;AACpB,IAAM,YAAY;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["/home/runner/work/langwatch/langwatch/typescript-sdk/dist/chunk-D7UAKYVI.js","../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/prompt.ts","../src/client-sdk/services/prompts/schema/prompt.schema.ts","../src/client-sdk/services/prompts/constants.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/local-prompts.service.ts","../src/client-sdk/services/prompts/prompts.facade.ts"],"names":["target"],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACF,sDAA4B;AAC5B;AACE;AACA;AACA;AACF,sDAA4B;AAC5B;AACE;AACA;AACF,sDAA4B;AAC5B;AACE;AACA;AACA;AACF,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MAAA;AACV,IAAA;AAEP,EAAA;AACF;AZkjBiC;AACA;Aa/pBN;AAIuC,EAAA;AAnBlE,IAAA;AAoB6B,IAAA;AACE,IAAA;AAC7B,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQsD,EAAA;AACzB,IAAA;AACT,IAAA;AACpB,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAY0B,EAAA;AACE,IAAA;AACT,IAAA;AACG,MAAA;AACpB,IAAA;AAC2B,IAAA;AACT,IAAA;AACpB,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOkC,EAAA;AACJ,IAAA;AACF,IAAA;AAC5B,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AASiC,EAAA;AACJ,IAAA;AACT,IAAA;AACpB,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOgE,EAAA;AAClD,IAAA;AACd,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAawB,EAAA;AACG,IAAA;AAClB,IAAA;AACT,EAAA;AACF;AbipBiC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/langwatch/langwatch/typescript-sdk/dist/chunk-D7UAKYVI.js","sourcesContent":[null,"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\";\n\n/**\n * Custom error class for Prompts API operations.\n * Provides context about the failed operation and the original error.\n */\nexport class PromptsError extends Error {\n constructor(\n message: string,\n public readonly operation: string,\n public readonly originalError?: any,\n ) {\n super(message);\n this.name = \"PromptsError\";\n }\n}\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 PromptsError 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 {PromptsError}\n */\n private handleApiError(operation: string, error: any): never {\n const errorMessage =\n typeof error === \"string\"\n ? error\n : error?.error ?? error?.message ?? \"Unknown error occurred\";\n throw new PromptsError(\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 {PromptsError} 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 {PromptsError} If the API call fails.\n */\n get = async (id: string, options?: { version?: string }): Promise<PromptResponse> => {\n const { data, error } = await this.apiClient.GET(\n \"/api/prompts/{id}\",\n {\n params: { path: { id } },\n query: {\n version: options?.version,\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 {PromptsError} 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 if (\n error instanceof PromptsError &&\n error.originalError?.statusCode === 404\n ) {\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 {PromptsError} 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 {PromptsError} 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 {PromptsError} 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 {PromptsError} 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 {PromptsError} 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 */\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 PromptsError(message, \"sync\", error);\n }\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","/**\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 type { LocalPromptConfig, PromptDependency } from \"@/cli/types\";\nimport { FileManager } from \"@/cli/utils/fileManager\";\nimport { type Logger, NoOpLogger } from \"@/logger\";\nimport { type PromptData } from \"./types\";\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 const localPromptConfig = (\n (await this.getFromConfig(dependency)) ??\n (await this.getFromLockFile(handleOrId)) ??\n (await this.getFromLocalFiles(handleOrId))\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, type SyncResult } from \"./prompts-api.service\";\nimport { Prompt } from \"./prompt\";\nimport type { CreatePromptBody, UpdatePromptBody } from \"./types\";\nimport { type InternalConfig } from \"@/client-sdk/types\";\nimport { LocalPromptsService } from \"./local-prompts.service\";\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 {\n private readonly promptsApiService: PromptsApiService;\n private readonly localPromptsService: LocalPromptsService;\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 or null if not found.\n * @throws {PromptsError} If the API call fails.\n */\n async get(\n handleOrId: string,\n options?: { version?: string },\n ): Promise<Prompt | null> {\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 /**\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 /**\n * Deletes a prompt by handle or ID.\n * @param handleOrId The prompt's handle or unique identifier.\n * @throws {PromptsError} If the API call fails.\n */\n async delete(handleOrId: string): Promise<{ success: boolean }> {\n return this.promptsApiService.delete(handleOrId);\n }\n\n /**\n * Syncs a prompt with the server.\n * @param params The sync parameters.\n * @returns The sync result.\n * @throws {PromptsError} If the API call fails.\n */\n async sync(params: {\n name: string;\n configData: any;\n localVersion?: number;\n commitMessage?: string;\n }): Promise<SyncResult> {\n const syncResult = await this.promptsApiService.sync(params);\n return syncResult;\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../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/prompt.ts","../src/client-sdk/services/prompts/schema/prompt.schema.ts","../src/client-sdk/services/prompts/constants.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/local-prompts.service.ts","../src/client-sdk/services/prompts/prompts.facade.ts"],"sourcesContent":["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\";\n\n/**\n * Custom error class for Prompts API operations.\n * Provides context about the failed operation and the original error.\n */\nexport class PromptsError extends Error {\n constructor(\n message: string,\n public readonly operation: string,\n public readonly originalError?: any,\n ) {\n super(message);\n this.name = \"PromptsError\";\n }\n}\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 PromptsError 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 {PromptsError}\n */\n private handleApiError(operation: string, error: any): never {\n const errorMessage =\n typeof error === \"string\"\n ? error\n : error?.error ?? error?.message ?? \"Unknown error occurred\";\n throw new PromptsError(\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 {PromptsError} 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 {PromptsError} If the API call fails.\n */\n get = async (id: string, options?: { version?: string }): Promise<PromptResponse> => {\n const { data, error } = await this.apiClient.GET(\n \"/api/prompts/{id}\",\n {\n params: { path: { id } },\n query: {\n version: options?.version,\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 {PromptsError} 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 if (\n error instanceof PromptsError &&\n error.originalError?.statusCode === 404\n ) {\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 {PromptsError} 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 {PromptsError} 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 {PromptsError} 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 {PromptsError} 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 {PromptsError} 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 */\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 PromptsError(message, \"sync\", error);\n }\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","/**\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 type { LocalPromptConfig, PromptDependency } from \"@/cli/types\";\nimport { FileManager } from \"@/cli/utils/fileManager\";\nimport { type Logger, NoOpLogger } from \"@/logger\";\nimport { type PromptData } from \"./types\";\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 const localPromptConfig = (\n (await this.getFromConfig(dependency)) ??\n (await this.getFromLockFile(handleOrId)) ??\n (await this.getFromLocalFiles(handleOrId))\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, type SyncResult } from \"./prompts-api.service\";\nimport { Prompt } from \"./prompt\";\nimport type { CreatePromptBody, UpdatePromptBody } from \"./types\";\nimport { type InternalConfig } from \"@/client-sdk/types\";\nimport { LocalPromptsService } from \"./local-prompts.service\";\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 {\n private readonly promptsApiService: PromptsApiService;\n private readonly localPromptsService: LocalPromptsService;\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 or null if not found.\n * @throws {PromptsError} If the API call fails.\n */\n async get(\n handleOrId: string,\n options?: { version?: string },\n ): Promise<Prompt | null> {\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 /**\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 /**\n * Deletes a prompt by handle or ID.\n * @param handleOrId The prompt's handle or unique identifier.\n * @throws {PromptsError} If the API call fails.\n */\n async delete(handleOrId: string): Promise<{ success: boolean }> {\n return this.promptsApiService.delete(handleOrId);\n }\n\n /**\n * Syncs a prompt with the server.\n * @param params The sync parameters.\n * @returns The sync result.\n * @throws {PromptsError} If the API call fails.\n */\n async sync(params: {\n name: string;\n configData: any;\n localVersion?: number;\n commitMessage?: string;\n }): Promise<SyncResult> {\n const syncResult = await this.promptsApiService.sync(params);\n return syncResult;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQO,IAAM,yBAAN,MAA6B;AAAA,EAClC,YAA6B,QAAgB;AAAhB;AAAA,EAAiB;AAAA,EAEtC,iBACN,MACA,WACA,WACgB;AAfpB;AAgBI,SAAK,QAAQ,QAAQ;AAErB,QAAI,mBAAmB,GAAG;AACxB,WAAK,SAAS,KAAK,MAAM;AAEzB,UAAI,WAAW;AACb,aAAK;AAAA,UACH;AAAA,UACA,KAAK,UAAU;AAAA,YACb,MAAM;AAAA,YACN,OAAO;AAAA,UACT,CAAC;AAAA,QACH;AAAA,MACF;AAAA,IACF;AAEA,UAAM,SAAS,UAAU;AAEzB,SAAK,cAAc;AAAA,MACjB,uBAAuB,OAAO;AAAA,MAC9B,4BAA2B,YAAO,WAAP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