{"version":3,"sources":["../src/client-sdk/services/prompts/errors/prompts.error.ts","../src/client-sdk/services/prompts/errors/prompt-compilation.error.ts","../src/client-sdk/services/prompts/errors/prompt-validation.error.ts","../src/client-sdk/services/prompts/errors/prompts-api.error.ts","../src/client-sdk/services/prompts/prompts-api.service.ts","../src/client-sdk/services/prompts/tracing/prompt-tracing.decorator.ts","../src/client-sdk/services/prompts/tracing/prompt-service-tracing.decorator.ts","../src/client-sdk/services/prompts/tracing/tracer.ts","../src/client-sdk/services/prompts/types.ts","../src/client-sdk/services/prompts/prompt.ts","../src/client-sdk/services/prompts/schema/prompt.schema.ts","../src/client-sdk/services/prompts/constants.ts","../src/client-sdk/services/prompts/local-prompts.service.ts","../src/client-sdk/services/prompts/prompts.facade.ts"],"sourcesContent":["/**\n * Base error class for the Prompts domain.\n * All prompt-related errors should extend this class.\n */\nexport class PromptsError extends Error {\n  constructor(message: string) {\n    super(message);\n    this.name = \"PromptsError\";\n  }\n}\n","/**\n * Error class for template compilation issues\n */\nexport class PromptCompilationError extends Error {\n  constructor(\n    message: string,\n    public readonly template: string,\n    public readonly originalError?: any,\n  ) {\n    super(message);\n    this.name = \"PromptCompilationError\";\n  }\n}\n","import { type z } from \"zod\";\n\n/**\n * Error class for prompt validation issues\n */\nexport class PromptValidationError extends Error {\n  constructor(message: string, public readonly validationErrors: z.ZodError) {\n    super(message);\n    this.name = \"PromptValidationError\";\n  }\n}\n","import { PromptsError } from \"./prompts.error\";\n\n/**\n * Error class for Prompts API operations.\n * Provides context about the failed operation and the original error.\n */\nexport class PromptsApiError extends PromptsError {\n  constructor(\n    message: string,\n    public readonly operation: string,\n    public readonly originalError?: unknown,\n  ) {\n    super(message);\n    this.name = \"PromptsApiError\";\n  }\n}\n","import { z } from \"zod\";\nimport type { paths, operations } from \"@/internal/generated/openapi/api-client\";\nimport { type PromptResponse, type TagDefinition, type CreatedTag } from \"./types\";\nimport { PromptConverter } from \"@/cli/utils/promptConverter\";\nimport { PromptServiceTracingDecorator, tracer } from \"./tracing\";\nimport { createTracingProxy } from \"@/client-sdk/tracing/create-tracing-proxy\";\nimport { type InternalConfig } from \"@/client-sdk/types\";\nimport { type CreatePromptBody, type UpdatePromptBody } from \"./types\";\nimport { createLangWatchApiClient, type LangwatchApiClient } from \"@/internal/api/client\";\nimport { PromptsApiError } from \"./errors\";\nimport {\n  extractStatusFromResponse,\n  formatApiErrorForOperation,\n  formatApiErrorMessage,\n} from \"@/client-sdk/services/_shared/format-api-error\";\nimport type { RuntimeParameters } from \"@/cli/types\";\n\nconst syncActionSchema = z.enum([\n  \"created\",\n  \"updated\",\n  \"conflict\",\n  \"up_to_date\",\n]);\n\nexport type SyncAction = z.infer<typeof syncActionSchema>;\n\nconst syncResultSchema = z.object({\n  action: syncActionSchema,\n  // `prompt` and `conflictInfo` are passed through untyped — they come from\n  // the OpenAPI-derived shape which is already validated on the server side.\n  prompt: z.unknown().optional(),\n  conflictInfo: z\n    .object({\n      localVersion: z.number(),\n      remoteVersion: z.number(),\n      differences: z.array(z.string()),\n      remoteConfigData: z.unknown(),\n    })\n    .passthrough()\n    .optional(),\n});\n\nexport type AssignTagResult = NonNullable<\n  operations[\"putApiPromptsByIdTagsByTag\"][\"responses\"][\"200\"][\"content\"][\"application/json\"]\n>;\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    remoteParameters?: RuntimeParameters;\n  };\n}\n\n/**\n * Service for managing prompt resources via the Langwatch API.\n * Constructor creates a proxy that wraps the service and traces all methods.\n *\n * Responsibilities:\n * - CRUD operations for prompts\n * - Creating prompt versions\n * - Error handling with contextual information\n *\n * All methods return raw PromptResponse data from the API.\n */\nexport class PromptsApiService {\n  private readonly apiClient: LangwatchApiClient;\n\n  constructor(config?: Pick<InternalConfig, \"langwatchApiClient\">) {\n    this.apiClient = config?.langwatchApiClient ?? createLangWatchApiClient();\n\n    /**\n     * Wraps the service in a tracing proxy via the decorator.\n     */\n    return createTracingProxy(\n      this as PromptsApiService,\n      tracer,\n      PromptServiceTracingDecorator,\n    );\n  }\n\n  /**\n   * Handles API errors by throwing a PromptsApiError with operation context.\n   * @param operation Description of the operation being performed.\n   * @param error The error object returned from the API client.\n   * @throws {PromptsApiError}\n   */\n  private handleApiError(operation: string, error: any, status?: number): never {\n    const message = formatApiErrorForOperation({ operation: operation, error: error, options: {\n      status: status ?? extractStatusFromResponse(error),\n    } });\n\n    throw new PromptsApiError(message, operation, error);\n  }\n\n  /**\n   * Fetches all prompts from the API.\n   * @returns Array of raw PromptResponse data.\n   * @throws {PromptsApiError} If the API call fails.\n   */\n  async getAll(): Promise<PromptResponse[]> {\n    const { data, error } =\n      await this.apiClient.GET(\"/api/prompts\");\n    if (error) this.handleApiError(\"fetch all prompts\", error);\n    return data;\n  }\n\n  /**\n   * Fetches a single prompt by its ID.\n   * @param id The prompt's unique identifier.\n   * @param options Optional parameters for the request.\n   * @param options.version Specific version to fetch (numeric string or \"latest\").\n   * @param options.tag Tag to fetch (e.g., \"production\", \"staging\", or a custom tag).\n   * @returns Raw PromptResponse data.\n   * @throws {PromptsApiError} If the API call fails.\n   */\n  get = async (id: string, options?: { version?: string; tag?: string }): Promise<PromptResponse> => {\n    // Parse version to number, skip for \"latest\" or invalid values\n    const versionNumber = options?.version && options.version !== \"latest\"\n      ? parseInt(options.version, 10)\n      : undefined;\n\n    const { data, error } = await this.apiClient.GET(\n      \"/api/prompts/{id}\",\n      {\n        params: {\n          path: { id },\n          query: {\n            version: Number.isNaN(versionNumber) ? undefined : versionNumber,\n            tag: options?.tag,\n          },\n        },\n      },\n    );\n\n    if (error) {\n      this.handleApiError(`fetch prompt with ID \"${id}\"`, error);\n    }\n\n    return data;\n  }\n\n  /**\n   * Validates if a prompt exists.\n   * @param id The prompt's unique identifier.\n   * @returns True if prompt exists, false otherwise.\n   * @throws {PromptsApiError} If the API call fails (not 404).\n   */\n  async exists(id: string): Promise<boolean> {\n    try {\n      await this.get(id);\n      return true;\n    } catch (error) {\n      const originalError = error instanceof PromptsApiError ? error.originalError : null;\n      const statusCode = originalError != null && typeof originalError === \"object\" && \"statusCode\" in originalError\n        ? (originalError as { statusCode: unknown }).statusCode\n        : null;\n\n      if (statusCode === 404) {\n        return false;\n      }\n\n      throw error;\n    }\n  }\n\n  /**\n   * Creates a new prompt.\n   * @param params The prompt creation payload, matching the OpenAPI schema.\n   * @returns Raw PromptResponse data of the created prompt.\n   * @throws {PromptsApiError} If the API call fails.\n   */\n  async create(params: CreatePromptBody): Promise<PromptResponse> {\n    const { data, error } = await this.apiClient.POST(\n      \"/api/prompts\",\n      {\n        body: params,\n      },\n    );\n    if (error) this.handleApiError(\"create prompt\", error);\n    return data;\n  }\n\n  /**\n   * Updates an existing prompt.\n   * @param id The prompt's unique identifier.\n   * @param params The update payload, matching the OpenAPI schema.\n   * @returns Raw PromptResponse data of the updated prompt.\n   * @throws {PromptsApiError} If the API call fails.\n   */\n  async update(id: string, params: UpdatePromptBody): Promise<PromptResponse> {\n    const { error, data: updatedPrompt } =\n      await this.apiClient.PUT(\"/api/prompts/{id}\", {\n        params: { path: { id } },\n        body: params,\n      });\n    if (error) this.handleApiError(`update prompt with ID \"${id}\"`, error);\n    return updatedPrompt;\n  }\n\n  /**\n   * Lists all prompt tags (built-in and custom) for the organization.\n   * @returns Array of tag definitions.\n   * @throws {PromptsApiError} If the API call fails.\n   */\n  async listTags(): Promise<TagDefinition[]> {\n    const { data, error } = await this.apiClient.GET(\"/api/prompts/tags\");\n    if (error) this.handleApiError(\"list tags\", error);\n    return data;\n  }\n\n  /**\n   * Creates a custom prompt tag for the organization.\n   * @param params.name The tag name (must match /^[a-z][a-z0-9_-]*$/).\n   * @returns The created tag.\n   * @throws {PromptsApiError} If the API call fails.\n   */\n  async createTag({ name }: { name: string }): Promise<CreatedTag> {\n    const { data, error } = await this.apiClient.POST(\"/api/prompts/tags\", {\n      body: { name },\n    });\n    if (error) this.handleApiError(\"create tag\", error);\n    return data;\n  }\n\n  /**\n   * Deletes a custom prompt tag by name.\n   * @param tagName The tag name to delete.\n   * @throws {PromptsApiError} If the API call fails.\n   */\n  async deleteTag(tagName: string): Promise<void> {\n    const { error } = await this.apiClient.DELETE(\n      \"/api/prompts/tags/{tag}\" as any,\n      { params: { path: { tag: tagName } } } as any,\n    );\n    if (error) this.handleApiError(`delete tag \"${tagName}\"`, error);\n  }\n\n  /**\n   * Renames an existing prompt tag.\n   * @param tag The current tag name.\n   * @param name The new tag name.\n   * @throws {PromptsApiError} If the API call fails.\n   */\n  async renameTag({ tag, name }: { tag: string; name: string }): Promise<void> {\n    const { error } = await this.apiClient.PUT(\n      \"/api/prompts/tags/{tag}\",\n      { params: { path: { tag } }, body: { name } },\n    );\n    if (error) this.handleApiError(`rename tag \"${tag}\"`, error);\n  }\n\n  async assignTag({\n    id,\n    tag,\n    versionId,\n  }: {\n    id: string;\n    tag: string;\n    versionId: string;\n  }): Promise<AssignTagResult> {\n    const { data, error } = await this.apiClient.PUT(\n      \"/api/prompts/{id}/tags/{tag}\",\n      {\n        params: { path: { id, tag } },\n        body: { versionId },\n      },\n    );\n    if (error) this.handleApiError(`assign tag \"${tag}\" to prompt \"${id}\"`, error);\n    return data;\n  }\n\n  /**\n   * Deletes a prompt by its ID.\n   * @param id The prompt's unique identifier.\n   * @throws {PromptsApiError} If the API call fails.\n   */\n  async delete(id: string): Promise<{ success: boolean }> {\n    const { data, error } = await this.apiClient.DELETE(\n      \"/api/prompts/{id}\",\n      {\n        params: { path: { id } },\n      },\n    );\n    if (error) this.handleApiError(`delete prompt with ID \"${id}\"`, error);\n\n    return data;\n  }\n\n  /**\n   * Fetches all versions for a given prompt.\n   * @param id The prompt's unique identifier.\n   * @returns Array of raw PromptResponse data for each version.\n   * @throws {PromptsApiError} If the API call fails.\n   */\n  async getVersions(id: string): Promise<PromptResponse[]> {\n    const { data, error } = await this.apiClient.GET(\n      \"/api/prompts/{id}/versions\",\n      {\n        params: { path: { id } },\n      },\n    );\n    if (error)\n      this.handleApiError(`fetch versions for prompt with ID \"${id}\"`, error);\n\n    return data;\n  }\n\n  /**\n   * Upserts a prompt with local configuration - creates if doesn't exist, updates version if exists.\n   * @param handle The prompt's handle/identifier.\n   * @param config Local prompt configuration.\n   * @returns Object with created flag and raw PromptResponse data.\n   * @throws {PromptsApiError} If the API call fails.\n   */\n  async upsert(\n    handle: string,\n    config: {\n      model: string;\n      modelParameters?: {\n        temperature?: number;\n        max_tokens?: number;\n      };\n      messages: Array<{\n        role: \"system\" | \"user\" | \"assistant\";\n        content: string;\n      }>;\n      parameters?: RuntimeParameters;\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      parameters: config.parameters ?? {},\n      commitMessage: `Updated via CLI sync`,\n      schemaVersion: \"1.0\" as const,\n    };\n\n    // Creating a prompt with the same handle will fail, so we try to update instead\n    try {\n      const prompt = await this.create(payload);\n      return {\n        created: true,\n        prompt,\n      };\n    } catch {\n      const prompt = await this.update(handle, payload);\n\n      return {\n        created: false,\n        prompt,\n      };\n    }\n  }\n\n  /**\n   * Sync a prompt with local content, handling conflicts and version management\n   * You probably don't need to use this method directly.\n   */\n  async sync(params: {\n    name: string;\n    configData: ConfigData;\n    parameters?: RuntimeParameters;\n    localVersion?: number;\n    commitMessage?: string;\n  }): Promise<SyncResult> {\n    // openapi-fetch returns `{ data?, error?, response }`; we only need\n    // these fields from the response so an explicit shape keeps the\n    // no-redundant-type-constituents lint happy (the generic POST return is\n    // widened to `any` by the generated types).\n    interface SyncApiResponse {\n      data?: unknown;\n      error?: unknown;\n      response?: { status?: number };\n    }\n    let response: SyncApiResponse | undefined;\n    try {\n      response = await this.apiClient.POST(\n        \"/api/prompts/{id}/sync\",\n        {\n          params: { path: { id: params.name } },\n          body: {\n            configData: params.configData,\n            parameters: params.parameters ?? {},\n            localVersion: params.localVersion,\n            commitMessage: params.commitMessage,\n          },\n        },\n      );\n    } catch (error) {\n      // Transport-level failures (network errors, timeouts, unresolved DNS)\n      // surface here. Preserve the underlying message so the user knows\n      // whether the API is reachable.\n      const message = formatApiErrorForOperation({ operation: \"sync prompt\", error: error });\n      throw new PromptsApiError(message, \"sync\", error);\n    }\n\n    if (response?.error) {\n      const err: unknown = response.error;\n      const status =\n        response.response?.status ?? extractStatusFromResponse(err);\n      const message = formatApiErrorMessage({ error: err, options: { status } });\n      throw new PromptsApiError(\n        `Failed to sync prompt: ${message}`,\n        \"sync\",\n        err,\n      );\n    }\n\n    // Validate the shape at the boundary so a malformed 2xx payload\n    // (e.g. `{ action: undefined }`) surfaces as a PromptsApiError here\n    // instead of crashing downstream code with a confusing stack trace.\n    const parsed = syncResultSchema.safeParse(response?.data);\n    if (!parsed.success) {\n      throw new PromptsApiError(\n        \"Failed to sync prompt: server returned an invalid response body\",\n        \"sync\",\n        response?.data ?? response,\n      );\n    }\n    return {\n      action: parsed.data.action,\n      prompt: parsed.data.prompt as SyncResult[\"prompt\"],\n      conflictInfo: parsed.data.conflictInfo as SyncResult[\"conflictInfo\"],\n    };\n  }\n}\n","import { type Prompt, type TemplateVariables, type CompiledPrompt } from \"../prompt\";\nimport { shouldCaptureInput, shouldCaptureOutput } from \"@/observability-sdk\";\nimport type { LangWatchSpan } from \"@/observability-sdk\";\n\n/**\n * Class that decorates the target prompt,\n * adding tracing to specific methods.\n */\nexport class PromptTracingDecorator {\n  constructor(private readonly target: Prompt) {}\n\n  private traceCompilation(\n    span: LangWatchSpan,\n    variables: TemplateVariables,\n    compileFn: () => CompiledPrompt\n  ): CompiledPrompt {\n    span.setType(\"prompt\");\n\n    if (shouldCaptureInput()) {\n      span.setInput(this.target);\n\n      if (variables) {\n        span.setAttribute(\n          'langwatch.prompt.variables',\n          JSON.stringify({\n            type: \"json\",\n            value: variables,\n          }),\n        );\n      }\n    }\n\n    const result = compileFn();\n\n    // Only emit combined handle:version format when both are available\n    if (result.handle != null && result.version != null) {\n      span.setAttribute(\n        'langwatch.prompt.id',\n        `${result.handle}:${result.version}`,\n      );\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\n    const result = await this.target.get(id, options);\n\n    if (result) {\n      // Only emit combined format when both handle and version are available\n      if (result.handle != null && result.version != null) {\n        span.setAttribute(\n          'langwatch.prompt.id',\n          `${result.handle}:${result.version}`,\n        );\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 z } from \"zod\";\nimport type { paths } from \"@/internal/generated/openapi/api-client\";\nimport {\n  type corePromptDataSchema,\n  type promptMetadataSchema,\n  type promptDataSchema\n} from \"./schema\";\n\n/**\n * Type for template variables - supporting common data types\n */\nexport type TemplateVariables = Record<\n  string,\n  string | number | boolean | object | null\n>;\n\n/**\n * Core data needed for prompt functionality\n */\nexport type CorePromptData = z.infer<typeof corePromptDataSchema>;\n\n/**\n * Optional metadata for identification and tracing\n */\nexport type PromptMetadata = z.infer<typeof promptMetadataSchema>;\n\n/**\n * Combined type for creating prompts\n */\nexport type PromptData = z.infer<typeof promptDataSchema>;\n\n// Extract API types from OpenAPI schema for backwards compatibility\nexport type CreatePromptBody = NonNullable<\n  paths[\"/api/prompts\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n\nexport type UpdatePromptBody = NonNullable<\n  paths[\"/api/prompts/{id}\"][\"put\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n\nexport type PromptResponse = NonNullable<\n  paths[\"/api/prompts/{id}\"][\"get\"][\"responses\"][\"200\"][\"content\"][\"application/json\"]\n>;\n\n// Extract the PromptScope type from the API client\nexport type PromptScope = paths[\"/api/prompts\"][\"post\"][\"responses\"][\"200\"][\"content\"][\"application/json\"][\"scope\"];\n\n// Extract tag definition types from the OpenAPI schema\nexport type TagDefinition = NonNullable<\n  paths[\"/api/prompts/tags\"][\"get\"][\"responses\"][\"200\"][\"content\"][\"application/json\"]\n>[number];\n\nexport type CreatedTag = NonNullable<\n  paths[\"/api/prompts/tags\"][\"post\"][\"responses\"][\"201\"][\"content\"][\"application/json\"]\n>;\n\n/**\n * Fetch policy for prompt retrieval.\n * Controls how prompts are fetched and cached.\n */\nexport enum FetchPolicy {\n  /** Use local file if available, otherwise fetch from API (default) */\n  MATERIALIZED_FIRST = \"MATERIALIZED_FIRST\",\n  /** Always try API first, fall back to materialized */\n  ALWAYS_FETCH = \"ALWAYS_FETCH\",\n  /** Fetch every X minutes, use materialized between fetches */\n  CACHE_TTL = \"CACHE_TTL\",\n  /** Never fetch, use materialized files only */\n  MATERIALIZED_ONLY = \"MATERIALIZED_ONLY\",\n}\n\n","import { Liquid } from \"liquidjs\";\nimport { PromptTracingDecorator, tracer } from \"./tracing\";\nimport { createTracingProxy } from \"@/client-sdk/tracing/create-tracing-proxy\";\nimport { promptDataSchema } from \"./schema\";\nimport { type TemplateVariables, type PromptData, type CorePromptData, type PromptScope } from \"./types\";\nimport { PromptCompilationError, PromptValidationError } from \"./errors\";\n\n// Re-export types and errors for convenience\nexport type { TemplateVariables, PromptData, CorePromptData, PromptMetadata } from \"./types\";\nexport { PromptCompilationError, PromptValidationError } from \"./errors\";\n\n// Global Liquid instance - shared across all prompts for efficiency\nconst liquid = new Liquid({\n  strictFilters: true,\n});\n\n/**\n * The Prompt class provides a standardized interface for working with prompt objects\n * within the SDK, focusing on core functionality needed for template compilation and execution.\n * Keeps only essential fields while maintaining compatibility with tracing and observability.\n */\nexport class Prompt {\n  // === Core functionality (required) ===\n  public readonly model!: string;\n  public readonly messages!: Array<{\n    role: \"user\" | \"assistant\" | \"system\";\n    content: string;\n  }>;\n\n  // === Optional core fields ===\n  public readonly prompt?: string;\n  public readonly temperature?: number;\n  public readonly maxTokens?: number;\n  public readonly responseFormat?: CorePromptData[\"responseFormat\"];\n\n  // === Runtime parameters ===\n  public readonly parameters: Record<string, unknown> = {};\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  parameters: z.record(z.string(), z.unknown()).optional(),\n});\n","import { type PromptScope as PromptScopeType } from \"./types\";\n\nexport const PromptScope = {\n  ORGANIZATION: \"ORGANIZATION\" as const,\n  PROJECT: \"PROJECT\" as const,\n} satisfies Record<string, PromptScopeType>;\n","import type { LocalPromptConfig, PromptDependency } from \"@/cli/types\";\nimport { FileManager } from \"@/cli/utils/fileManager\";\nimport { type Logger, NoOpLogger } from \"@/logger\";\nimport { type PromptData } from \"./types\";\nimport { PromptFileNotFoundError } from \"@/cli/utils/errors/prompt-not-found.error\";\n\nexport interface LocalPromptsServiceConfig {\n  fileManager?: typeof FileManager;\n  logger?: Logger;\n}\n\n/**\n * Service for retrieving prompts from local filesystem sources.\n *\n * Searches for prompts in the following priority order:\n * 1. Explicit file mapping in prompts.json config\n * 2. Materialized path from prompts-lock.json\n * 3. Direct file scanning in prompts directory\n */\nexport class LocalPromptsService {\n  private readonly fileManager: typeof FileManager;\n  private readonly logger: Logger;\n\n  constructor(config?: LocalPromptsServiceConfig) {\n    this.fileManager = config?.fileManager ?? FileManager;\n    this.logger = config?.logger ?? new NoOpLogger();\n  }\n\n  /**\n   * Retrieves a prompt using the configured search strategy.\n   * Tries each source in priority order until found or all sources exhausted.\n   */\n  async get(handleOrId: string): Promise<PromptData | null> {\n    try {\n      const dependency = await this.getDependencyFromConfig(handleOrId);\n\n      // If no dependency is found, it means it's not a local prompt\n      if (!dependency) {\n        return null;\n      }\n\n      // Try each source in priority order until found or all sources exhausted\n      // We catch errors and return null if any of the sources fail so we\n      // can continue to the next source and return null if all sources fail\n      const localPromptConfig = (\n        (await this.getFromConfig(dependency).catch((e) => {\n          if (e instanceof PromptFileNotFoundError) return null;\n          throw e;\n        })) ??\n        (await this.getFromLockFile(handleOrId).catch((e) => {\n          if (e instanceof PromptFileNotFoundError) return null;\n          throw e;\n        })) ??\n        (await this.getFromLocalFiles(handleOrId).catch((e) => {\n          if (e instanceof PromptFileNotFoundError) return null;\n          throw e;\n        }))\n      );\n\n      return localPromptConfig ? this.convertToPromptData({\n        ...localPromptConfig,\n        handle: handleOrId,\n      }) : null;\n    } catch (error) {\n      this.logger.warn(`Failed to get prompt \"${handleOrId}\": ${error instanceof Error ? error.message : String(error)}`);\n      return null;\n    }\n  }\n\n\n  /**\n   * Searches for prompt using explicit file mapping in prompts.json.\n   * Looks for dependencies with a 'file' property pointing to a specific path.\n   */\n  private async getFromConfig(dependency: PromptDependency): Promise<LocalPromptConfig | null> {\n    if (typeof dependency === 'string' && dependency.startsWith('file:')) {\n      return this.fileManager.loadLocalPrompt(dependency.slice(5));\n    }\n\n    return null;\n  }\n\n  /**\n   * Searches for prompt using materialized path from lock file.\n   * Lock file contains resolved paths for prompts that have been synced/materialized.\n   */\n  private async getFromLockFile(handleOrId: string): Promise<LocalPromptConfig | null> {\n    const lock = this.fileManager.loadPromptsLock();\n    const lockEntry = lock.prompts[handleOrId];\n\n    if (lockEntry?.materialized) {\n      return this.fileManager.loadLocalPrompt(lockEntry.materialized);\n    }\n\n    return null;\n  }\n\n  /**\n   * Searches for prompt by scanning all .prompt.yaml files in prompts directory.\n   * Extracts prompt name from file path and matches against the requested handle.\n   * This is the fallback method when explicit mappings don't exist.\n   */\n  private async getFromLocalFiles(handleOrId: string): Promise<LocalPromptConfig | null> {\n    const localFiles = this.fileManager.getLocalPromptFiles();\n\n    for (const filePath of localFiles) {\n      const promptName = this.fileManager.promptNameFromPath(filePath);\n      if (promptName === handleOrId) {\n        return this.fileManager.loadLocalPrompt(filePath);\n      }\n    }\n\n    return null;\n  }\n\n  /**\n   * Get dependency from config\n   */\n  private async getDependencyFromConfig(handleOrId: string): Promise<PromptDependency | null> {\n    const config = this.fileManager.loadPromptsConfig();\n    const dependency = config.prompts[handleOrId];\n\n    return dependency ?? null;\n  }\n\n  /**\n   * Converts LocalPromptConfig to PromptData format\n   */\n  private convertToPromptData(config: LocalPromptConfig & { handle: string; }): PromptData {\n    const { modelParameters, ...rest } = config;\n    return {\n      maxTokens: modelParameters?.max_tokens,\n      temperature: modelParameters?.temperature,\n      ...rest,\n    };\n  }\n}\n","import { PromptsApiService, type AssignTagResult } from \"./prompts-api.service\";\nimport { Prompt } from \"./prompt\";\nimport type { CreatePromptBody, UpdatePromptBody, PromptData, TagDefinition, CreatedTag } from \"./types\";\nimport { FetchPolicy } from \"./types\";\nimport { type InternalConfig } from \"@/client-sdk/types\";\nimport { LocalPromptsService } from \"./local-prompts.service\";\nimport { PromptsError } from \"./errors\";\n\n/**\n * Options for fetching a prompt.\n */\nexport interface GetPromptOptions {\n  /** Specific version to fetch */\n  version?: string;\n  /** Tag to fetch (e.g., \"production\", \"staging\", or a custom tag) */\n  tag?: string;\n  /** Fetch policy to use */\n  fetchPolicy?: FetchPolicy;\n  /** Cache TTL in minutes (only used with CACHE_TTL policy) */\n  cacheTtlMinutes?: number;\n}\n\ninterface CacheEntry {\n  data: PromptData;\n  timestamp: number;\n}\n\ninterface PromptsFacadeDependencies {\n  promptsApiService: PromptsApiService;\n  localPromptsService: LocalPromptsService;\n}\n\n/**\n * Facade for prompt operations in the LangWatch SDK.\n * Provides a simplified interface for common prompt management tasks.\n */\nexport class PromptsFacade implements Pick<PromptsApiService, \"sync\" | \"delete\">{\n  private readonly promptsApiService: PromptsApiService;\n  private readonly localPromptsService: LocalPromptsService;\n  private readonly cache = new Map<string, CacheEntry>();\n  readonly tags: {\n    assign(id: string, params: { tag: string; versionId: string }): Promise<AssignTagResult>;\n    list(): Promise<TagDefinition[]>;\n    create(params: { name: string }): Promise<CreatedTag>;\n    delete(tagName: string): Promise<void>;\n    rename(oldName: string, newName: string): Promise<void>;\n  };\n\n  constructor(config: InternalConfig & PromptsFacadeDependencies) {\n    this.promptsApiService = config.promptsApiService ?? new PromptsApiService(config);\n    this.localPromptsService = config.localPromptsService ?? new LocalPromptsService();\n    this.tags = {\n      assign: (id, { tag, versionId }) =>\n        this.promptsApiService.assignTag({ id, tag, versionId }),\n      list: () => this.promptsApiService.listTags(),\n      create: ({ name }) => this.promptsApiService.createTag({ name }),\n      delete: (tagName) => this.promptsApiService.deleteTag(tagName),\n      rename: (oldName, newName) =>\n        this.promptsApiService.renameTag({ tag: oldName, name: newName }),\n    };\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   *\n   * Supports shorthand `handle:tag` syntax — e.g. `get(\"pizza-prompt:production\")`.\n   * Shorthand is parsed server-side; the SDK passes the string through as-is.\n   *\n   * @param handleOrId The prompt's handle, unique identifier, or `handle:tag` shorthand.\n   * @param options Optional parameters for the request.\n   * @returns The Prompt instance.\n   * @throws {PromptsError} If the prompt is not found or the API call fails.\n   */\n  async get(\n    handleOrId: string,\n    options?: GetPromptOptions,\n  ): Promise<Prompt> {\n    const fetchPolicy = options?.fetchPolicy ?? FetchPolicy.MATERIALIZED_FIRST;\n\n    switch (fetchPolicy) {\n      case FetchPolicy.MATERIALIZED_ONLY:\n        return this.getMaterializedOnly(handleOrId);\n\n      case FetchPolicy.ALWAYS_FETCH:\n        return this.getAlwaysFetch(handleOrId, options);\n\n      case FetchPolicy.CACHE_TTL:\n        return this.getCacheTtl(handleOrId, options);\n\n      case FetchPolicy.MATERIALIZED_FIRST:\n      default:\n        return this.getMaterializedFirst(handleOrId, options);\n    }\n  }\n\n  private async getMaterializedFirst(\n    handleOrId: string,\n    options?: GetPromptOptions,\n  ): Promise<Prompt> {\n    const localPrompt = await this.localPromptsService.get(handleOrId);\n    if (localPrompt) {\n      return new Prompt(localPrompt);\n    }\n    const serverPrompt = await this.promptsApiService.get(handleOrId, options);\n    return new Prompt(serverPrompt);\n  }\n\n  private async getAlwaysFetch(\n    handleOrId: string,\n    options?: GetPromptOptions,\n  ): Promise<Prompt> {\n    try {\n      const serverPrompt = await this.promptsApiService.get(handleOrId, options);\n      return new Prompt(serverPrompt);\n    } catch {\n      const localPrompt = await this.localPromptsService.get(handleOrId);\n      if (localPrompt) {\n        return new Prompt(localPrompt);\n      }\n      throw new PromptsError(`Prompt \"${handleOrId}\" not found locally or on server`);\n    }\n  }\n\n  private async getMaterializedOnly(handleOrId: string): Promise<Prompt> {\n    const localPrompt = await this.localPromptsService.get(handleOrId);\n    if (localPrompt) {\n      return new Prompt(localPrompt);\n    }\n    throw new PromptsError(`Prompt \"${handleOrId}\" not found in materialized files`);\n  }\n\n  private buildCacheKey(handleOrId: string, options?: GetPromptOptions): string {\n    const tagSegment = options?.tag != null ? `::tag:${options.tag}` : '';\n    return `${handleOrId}::version:${options?.version ?? ''}${tagSegment}`;\n  }\n\n  private async getCacheTtl(\n    handleOrId: string,\n    options?: GetPromptOptions,\n  ): Promise<Prompt> {\n    const cacheKey = this.buildCacheKey(handleOrId, options);\n    const ttlMs = (options?.cacheTtlMinutes ?? 5) * 60 * 1000;\n    const cached = this.cache.get(cacheKey);\n    const now = Date.now();\n\n    if (cached && now - cached.timestamp < ttlMs) {\n      return new Prompt(cached.data);\n    }\n\n    try {\n      const serverPrompt = await this.promptsApiService.get(handleOrId, options);\n      this.cache.set(cacheKey, { data: serverPrompt, timestamp: now });\n      return new Prompt(serverPrompt);\n    } catch {\n      const localPrompt = await this.localPromptsService.get(handleOrId);\n      if (localPrompt) {\n        return new Prompt(localPrompt);\n      }\n      throw new PromptsError(`Prompt \"${handleOrId}\" not found locally or on server`);\n    }\n  }\n\n  /**\n   * Retrieves all prompts.\n   * @returns Array of Prompt instances.\n   * @throws {PromptsError} If the API call fails.\n   */\n  async getAll(): Promise<Prompt[]> {\n    const serverPrompts = await this.promptsApiService.getAll();\n    return serverPrompts.map((prompt) => new Prompt(prompt));\n  }\n\n  /**\n   * Updates an existing prompt.\n   * @param handleOrId The prompt's handle or unique identifier.\n   * @param newData The update payload.\n   * @returns The updated Prompt instance.\n   * @throws {PromptsError} If the API call fails.\n   */\n  async update(handleOrId: string, newData: UpdatePromptBody): Promise<Prompt> {\n    const serverPrompt = await this.promptsApiService.update(handleOrId, newData);\n    return new Prompt(serverPrompt);\n  }\n\n  get delete() {\n    return this.promptsApiService.delete.bind(this.promptsApiService);\n  }\n\n  /**\n   * Delegated method to the prompts API service.\n   */\n  get sync() {\n    return this.promptsApiService.sync.bind(this.promptsApiService);\n  }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIO,IAAM,eAAN,cAA2B,MAAM;AAAA,EACtC,YAAY,SAAiB;AAC3B,UAAM,OAAO;AACb,SAAK,OAAO;AAAA,EACd;AACF;;;ACNO,IAAM,yBAAN,cAAqC,MAAM;AAAA,EAChD,YACE,SACgB,UACA,eAChB;AACA,UAAM,OAAO;AAHG;AACA;AAGhB,SAAK,OAAO;AAAA,EACd;AACF;;;ACPO,IAAM,wBAAN,cAAoC,MAAM;AAAA,EAC/C,YAAY,SAAiC,kBAA8B;AACzE,UAAM,OAAO;AAD8B;AAE3C,SAAK,OAAO;AAAA,EACd;AACF;;;ACJO,IAAM,kBAAN,cAA8B,aAAa;AAAA,EAChD,YACE,SACgB,WACA,eAChB;AACA,UAAM,OAAO;AAHG;AACA;AAGhB,SAAK,OAAO;AAAA,EACd;AACF;;;ACfA,SAAS,SAAS;;;ACQX,IAAM,yBAAN,MAA6B;AAAA,EAClC,YAA6B,QAAgB;AAAhB;AAAA,EAAiB;AAAA,EAEtC,iBACN,MACA,WACA,WACgB;AAChB,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;AAGzB,QAAI,OAAO,UAAU,QAAQ,OAAO,WAAW,MAAM;AACnD,WAAK;AAAA,QACH;AAAA,QACA,GAAG,OAAO,MAAM,IAAI,OAAO,OAAO;A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