langwatch 0.10.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{add-5FRWEQ32.mjs → add-2UHFYNUA.mjs} +8 -8
- package/dist/add-2UHFYNUA.mjs.map +1 -0
- package/dist/{add-CXUS4ZSQ.js → add-LUETMKBD.js} +11 -11
- package/dist/add-LUETMKBD.js.map +1 -0
- package/dist/{chunk-CKIZDPIJ.js → chunk-5MQQRSVM.js} +1 -1
- package/dist/{chunk-CKIZDPIJ.js.map → chunk-5MQQRSVM.js.map} +1 -1
- package/dist/{chunk-NM5OKM7F.js → chunk-6SSCBYJM.js} +21 -20
- package/dist/chunk-6SSCBYJM.js.map +1 -0
- package/dist/{chunk-SNDTNU3T.js → chunk-ASTAIRXG.js} +2 -2
- package/dist/{chunk-SNDTNU3T.js.map → chunk-ASTAIRXG.js.map} +1 -1
- package/dist/{chunk-BTCJWUS5.js → chunk-BQRUUTN3.js} +17 -17
- package/dist/{chunk-BTCJWUS5.js.map → chunk-BQRUUTN3.js.map} +1 -1
- package/dist/{chunk-YWO3NE5A.js → chunk-C4XUWCQR.js} +2 -2
- package/dist/{chunk-YWO3NE5A.js.map → chunk-C4XUWCQR.js.map} +1 -1
- package/dist/{chunk-WHPBZSTS.mjs → chunk-IIUI2XYW.mjs} +2 -2
- package/dist/{chunk-A43BYF5Q.js → chunk-ONXIZKC6.js} +11 -11
- package/dist/{chunk-A43BYF5Q.js.map → chunk-ONXIZKC6.js.map} +1 -1
- package/dist/{chunk-I3X7VMSP.mjs → chunk-OTID7S7K.mjs} +8 -7
- package/dist/chunk-OTID7S7K.mjs.map +1 -0
- package/dist/{chunk-I2SOBPAF.mjs → chunk-RSIPLYVA.mjs} +1 -1
- package/dist/{chunk-I2SOBPAF.mjs.map → chunk-RSIPLYVA.mjs.map} +1 -1
- package/dist/{chunk-W6FD5ZO3.mjs → chunk-TB5KB737.mjs} +2 -2
- package/dist/{chunk-W6FD5ZO3.mjs.map → chunk-TB5KB737.mjs.map} +1 -1
- package/dist/{chunk-VGVWXKVM.mjs → chunk-WCNDT5SD.mjs} +3 -3
- package/dist/{chunk-FEL5FLHA.mjs → chunk-ZEPKV5YO.mjs} +2 -2
- package/dist/cli/index.js +6 -6
- package/dist/cli/index.mjs +6 -6
- package/dist/{implementation-CPxv2BdW.d.ts → implementation-Bnc8Aymq.d.ts} +1 -1
- package/dist/{implementation-CVrmD0bz.d.mts → implementation-Ck58nRkT.d.mts} +1 -1
- package/dist/index.d.mts +666 -3
- package/dist/index.d.ts +666 -3
- package/dist/index.js +1249 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1241 -9
- package/dist/index.mjs.map +1 -1
- package/dist/{list-K6E3OGYH.js → list-7U3M64GY.js} +10 -10
- package/dist/{list-K6E3OGYH.js.map → list-7U3M64GY.js.map} +1 -1
- package/dist/{list-DQ6XLQCK.mjs → list-WV5LA6LD.mjs} +7 -7
- package/dist/{login-HX7WMLPL.js → login-B7DKMN7P.js} +4 -4
- package/dist/{login-HX7WMLPL.js.map → login-B7DKMN7P.js.map} +1 -1
- package/dist/{login-TJ2NCUAJ.mjs → login-QKRT6PXA.mjs} +3 -3
- package/dist/login-QKRT6PXA.mjs.map +1 -0
- package/dist/observability-sdk/index.d.mts +3 -3
- package/dist/observability-sdk/index.d.ts +3 -3
- package/dist/observability-sdk/index.js +6 -6
- package/dist/observability-sdk/index.js.map +1 -1
- package/dist/observability-sdk/index.mjs +10 -10
- package/dist/observability-sdk/instrumentation/langchain/index.d.mts +1 -1
- package/dist/observability-sdk/instrumentation/langchain/index.d.ts +1 -1
- package/dist/observability-sdk/instrumentation/langchain/index.js +16 -16
- package/dist/observability-sdk/instrumentation/langchain/index.mjs +2 -2
- package/dist/observability-sdk/setup/node/index.js +13 -13
- package/dist/observability-sdk/setup/node/index.mjs +3 -3
- package/dist/{remove-5ZOYQTF4.mjs → remove-2OGMXSTR.mjs} +7 -7
- package/dist/{remove-45A7WUCB.js → remove-A4DKCN7A.js} +9 -9
- package/dist/{remove-45A7WUCB.js.map → remove-A4DKCN7A.js.map} +1 -1
- package/dist/{sync-LL6TTFMS.mjs → sync-TNVCKWTC.mjs} +9 -9
- package/dist/sync-TNVCKWTC.mjs.map +1 -0
- package/dist/{sync-BE7XZC2A.js → sync-WRZXIBZS.js} +11 -11
- package/dist/sync-WRZXIBZS.js.map +1 -0
- package/dist/{types-Kts5RGLY.d.mts → types-5h2Im4pl.d.mts} +162 -0
- package/dist/{types-usU5mTCX.d.ts → types-fo-Ij9pl.d.ts} +162 -0
- package/package.json +125 -142
- package/dist/add-5FRWEQ32.mjs.map +0 -1
- package/dist/add-CXUS4ZSQ.js.map +0 -1
- package/dist/chunk-I3X7VMSP.mjs.map +0 -1
- package/dist/chunk-NM5OKM7F.js.map +0 -1
- package/dist/login-TJ2NCUAJ.mjs.map +0 -1
- package/dist/sync-BE7XZC2A.js.map +0 -1
- package/dist/sync-LL6TTFMS.mjs.map +0 -1
- /package/dist/{chunk-WHPBZSTS.mjs.map → chunk-IIUI2XYW.mjs.map} +0 -0
- /package/dist/{chunk-VGVWXKVM.mjs.map → chunk-WCNDT5SD.mjs.map} +0 -0
- /package/dist/{chunk-FEL5FLHA.mjs.map → chunk-ZEPKV5YO.mjs.map} +0 -0
- /package/dist/{list-DQ6XLQCK.mjs.map → list-WV5LA6LD.mjs.map} +0 -0
- /package/dist/{remove-5ZOYQTF4.mjs.map → remove-2OGMXSTR.mjs.map} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/client-sdk/services/prompts/errors/prompts.error.ts","../src/client-sdk/services/prompts/errors/prompt-compilation.error.ts","../src/client-sdk/services/prompts/errors/prompt-validation.error.ts","../src/client-sdk/services/prompts/errors/prompts-api.error.ts","../src/client-sdk/services/prompts/tracing/prompt-tracing.decorator.ts","../src/client-sdk/services/prompts/tracing/prompt-service-tracing.decorator.ts","../src/client-sdk/services/prompts/tracing/tracer.ts","../src/client-sdk/tracing/create-tracing-proxy.ts","../src/internal/api/client.ts","../src/client-sdk/services/prompts/prompts-api.service.ts","../src/client-sdk/services/prompts/types.ts","../src/client-sdk/services/prompts/prompt.ts","../src/client-sdk/services/prompts/schema/prompt.schema.ts","../src/client-sdk/services/prompts/constants.ts","../src/client-sdk/services/prompts/local-prompts.service.ts","../src/client-sdk/services/prompts/prompts.facade.ts"],"sourcesContent":["/**\n * Base error class for the Prompts domain.\n * All prompt-related errors should extend this class.\n */\nexport class PromptsError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"PromptsError\";\n }\n}\n","/**\n * Error class for template compilation issues\n */\nexport class PromptCompilationError extends Error {\n constructor(\n message: string,\n public readonly template: string,\n public readonly originalError?: any,\n ) {\n super(message);\n this.name = \"PromptCompilationError\";\n }\n}\n","import { type z } from \"zod\";\n\n/**\n * Error class for prompt validation issues\n */\nexport class PromptValidationError extends Error {\n constructor(message: string, public readonly validationErrors: z.ZodError) {\n super(message);\n this.name = \"PromptValidationError\";\n }\n}\n","import { PromptsError } from \"./prompts.error\";\n\n/**\n * Error class for Prompts API operations.\n * Provides context about the failed operation and the original error.\n */\nexport class PromptsApiError extends PromptsError {\n constructor(\n message: string,\n public readonly operation: string,\n public readonly originalError?: unknown,\n ) {\n super(message);\n this.name = \"PromptsApiError\";\n }\n}\n","import { type Prompt, type TemplateVariables, type CompiledPrompt } from \"../prompt\";\nimport { shouldCaptureInput, shouldCaptureOutput } from \"@/observability-sdk\";\nimport type { LangWatchSpan } from \"@/observability-sdk\";\n\n/**\n * Class that decorates the target prompt,\n * adding tracing to specific methods.\n */\nexport class PromptTracingDecorator {\n constructor(private readonly target: Prompt) {}\n\n private traceCompilation(\n span: LangWatchSpan,\n variables: TemplateVariables,\n compileFn: () => CompiledPrompt\n ): CompiledPrompt {\n span.setType(\"prompt\");\n\n if (shouldCaptureInput()) {\n span.setInput(this.target);\n\n if (variables) {\n span.setAttribute(\n 'langwatch.prompt.variables',\n JSON.stringify({\n type: \"json\",\n value: variables,\n }),\n );\n }\n }\n\n const result = compileFn();\n\n span.setAttributes({\n 'langwatch.prompt.id': result.id,\n 'langwatch.prompt.handle': result.handle ?? '',\n 'langwatch.prompt.version.id': result.versionId,\n 'langwatch.prompt.version.number': result.version,\n });\n\n if (shouldCaptureOutput()) {\n span.setOutput({\n ...result,\n raw: void 0, // TODO(afr): Figure out a better way to do this.\n });\n }\n\n return result;\n }\n\n compile(span: LangWatchSpan, variables: TemplateVariables = {}): CompiledPrompt {\n return this.traceCompilation(\n span,\n variables,\n () => this.target.compile(variables),\n );\n }\n\n compileStrict(span: LangWatchSpan, variables: TemplateVariables): CompiledPrompt {\n return this.traceCompilation(\n span,\n variables,\n () => this.target.compileStrict(variables),\n );\n }\n}\n","import { type PromptsApiService } from \"../prompts-api.service\";\nimport type { LangWatchSpan } from \"@/observability-sdk\";\nimport { shouldCaptureInput, shouldCaptureOutput } from \"@/observability-sdk\";\nimport type { CreatePromptBody, UpdatePromptBody, PromptResponse } from \"../types\";\n\n/**\n * Class that decorates the target prompt service,\n * adding tracing to key methods.\n */\nexport class PromptServiceTracingDecorator {\n constructor(private readonly target: PromptsApiService) {}\n\n async get(\n span: LangWatchSpan,\n id: string,\n options?: { version?: string }\n ): Promise<PromptResponse> {\n span.setType(\"prompt\");\n span.setAttribute('langwatch.prompt.id', id);\n\n const result = await this.target.get(id, options);\n\n if (result) {\n span.setAttributes({\n 'langwatch.prompt.id': result.id,\n 'langwatch.prompt.handle': result.handle ?? '',\n 'langwatch.prompt.version.id': result.versionId,\n 'langwatch.prompt.version.number': result.version,\n });\n }\n\n if (result && shouldCaptureOutput()) {\n span.setOutput(\"json\", result);\n }\n\n return result;\n }\n\n async create(\n span: LangWatchSpan,\n params: CreatePromptBody\n ): Promise<PromptResponse> {\n span.setType(\"prompt\");\n\n if (shouldCaptureInput()) {\n span.setInput(params);\n }\n\n const result = await this.target.create(params);\n\n span.setAttributes({\n 'langwatch.prompt.id': result.id,\n 'langwatch.prompt.handle': result.handle ?? undefined,\n 'langwatch.prompt.scope': result.scope,\n 'langwatch.prompt.version.id': result.versionId,\n 'langwatch.prompt.version.number': result.version,\n });\n\n return result;\n }\n\n async update(\n span: LangWatchSpan,\n id: string,\n params: UpdatePromptBody\n ): Promise<PromptResponse> {\n\n if (shouldCaptureInput()) {\n span.setInput(params);\n }\n\n const result = await this.target.update(id, params);\n\n span.setType(\"prompt\");\n span.setAttributes({\n 'langwatch.prompt.id': id,\n 'langwatch.prompt.handle': result.handle ?? undefined,\n 'langwatch.prompt.scope': result.scope,\n 'langwatch.prompt.version.id': result.versionId,\n 'langwatch.prompt.version.number': result.version,\n });\n\n return result;\n }\n\n async delete(\n span: LangWatchSpan,\n id: string\n ): Promise<{ success: boolean }> {\n const result = await this.target.delete(id);\n\n span.setType(\"prompt\");\n span.setAttribute('langwatch.prompt.id', id);\n span.setAttribute('langwatch.prompt.deleted', 'true');\n\n return result;\n }\n\n async upsert(\n span: LangWatchSpan,\n handle: string,\n config: any\n ): Promise<{ created: boolean; prompt: PromptResponse }> {\n if (shouldCaptureInput()) {\n span.setInput(config);\n }\n\n const result = await this.target.upsert(handle, config);\n\n span.setType(\"prompt\");\n span.setAttributes({\n 'langwatch.prompt.handle': handle,\n 'langwatch.prompt.created': result.created.toString(),\n 'langwatch.prompt.id': result.prompt.id,\n 'langwatch.prompt.version.id': result.prompt.versionId,\n 'langwatch.prompt.version.number': result.prompt.version,\n });\n\n return result;\n }\n\n async sync(\n span: LangWatchSpan,\n params: any\n ): Promise<any> {\n if (shouldCaptureInput()) {\n span.setInput(params);\n }\n\n const result = await this.target.sync(params);\n\n span.setType(\"prompt\");\n span.setAttribute('langwatch.prompt.name', params.name);\n span.setAttribute('langwatch.prompt.sync.action', result.action);\n\n if (result.conflictInfo) {\n span.setAttributes({\n 'langwatch.prompt.sync.has_conflict': 'true',\n 'langwatch.prompt.sync.local_version': result.conflictInfo.localVersion.toString(),\n 'langwatch.prompt.sync.remote_version': result.conflictInfo.remoteVersion.toString(),\n });\n }\n\n return result;\n }\n}\n","import { getLangWatchTracer } from \"@/observability-sdk/tracer\";\nimport { LANGWATCH_SDK_NAME_CLIENT, LANGWATCH_SDK_VERSION } from \"@/internal/constants\";\n\nexport const tracer = getLangWatchTracer(`${LANGWATCH_SDK_NAME_CLIENT}.prompts`, LANGWATCH_SDK_VERSION);\n","import { type LangWatchTracer } from \"@/observability-sdk\";\nimport { SpanKind } from \"@opentelemetry/api\";\n\n// Type for decorator methods that receive span as first parameter\ntype DecoratorMethodWithSpan<T extends (...args: any[]) => any> =\n (span: any, ...args: Parameters<T>) => ReturnType<T>;\n\n// Type for decorator class that maps original methods to span-aware versions\n// Only requires methods that are actually implemented in the decorator\ntype DecoratorClass<T> = new (target: T) => Partial<{\n [K in keyof T]: T[K] extends (...args: any[]) => any\n ? DecoratorMethodWithSpan<T[K]>\n : T[K];\n }>;\n\n/**\n * Creates a proxy that always creates spans for public methods.\n * Decorators can access the span as the first parameter to add additional attributes.\n *\n * @param target - The target to wrap\n * @param tracer - The tracer instance to use\n * @param DecoratorClass - Optional decorator class for custom logic\n * @returns A proxy that wraps the target with consistent tracing\n */\nexport function createTracingProxy<\n T extends object,\n D extends DecoratorClass<T> | undefined = undefined\n>(\n target: T,\n tracer: LangWatchTracer,\n DecoratorClass?: D,\n): T {\n const decorator = DecoratorClass ? new DecoratorClass(target) : null;\n\n return new Proxy(target, {\n get(target, prop, receiver) {\n const value = Reflect.get(target, prop, receiver);\n\n // If it's not a function, return as-is\n if (typeof value !== \"function\") {\n return value;\n }\n\n // Only trace public methods\n if (\n typeof prop === \"string\" &&\n !prop.startsWith(\"_\") && // Skip private methods\n !isGetterOrSetter(target, prop) && // Skip actual getters/setters\n !isBuiltInMethod(prop) // Skip built-in methods\n ) {\n return (...args: any[]) => {\n const spanName = `${target.constructor.name}.${prop}`;\n\n return tracer.withActiveSpan(spanName, {\n kind: SpanKind.CLIENT,\n attributes: {\n 'code.function': prop,\n 'code.namespace': target.constructor.name,\n },\n }, (span) => {\n // If decorator has this method, call it with span as first parameter\n if (decorator && prop in decorator) {\n const decoratorMethod = decorator[prop as keyof typeof decorator];\n if (typeof decoratorMethod === \"function\") {\n return decoratorMethod.apply(decorator, [span, ...args]);\n }\n }\n\n // Default: just call the original method\n return value.apply(target, args);\n });\n };\n }\n\n return typeof value === \"function\" ? value.bind(target) : value;\n },\n });\n}\n\n// Helper function to check if a property is a getter or setter\nconst isGetterOrSetter = (target: any, prop: string | symbol): boolean => {\n // First check own properties\n let descriptor = Object.getOwnPropertyDescriptor(target, prop);\n\n // If not found on own properties, check prototype chain\n if (!descriptor) {\n const prototype = Object.getPrototypeOf(target);\n if (prototype) {\n descriptor = Object.getOwnPropertyDescriptor(prototype, prop);\n }\n }\n\n // Return true if it's a getter or setter\n return !!(descriptor?.get ?? descriptor?.set);\n};\n\n// Helper function to check if a method is a built-in method that should not be traced\nconst isBuiltInMethod = (prop: string | symbol): boolean => {\n if (typeof prop !== \"string\") {\n return false;\n }\n\n // List of built-in methods that should not be traced\n const builtInMethods = [\n 'toString',\n 'valueOf',\n 'toJSON',\n 'toLocaleString',\n 'hasOwnProperty',\n 'isPrototypeOf',\n 'propertyIsEnumerable',\n 'constructor'\n ];\n\n return builtInMethods.includes(prop);\n};\n","import openApiCreateClient from \"openapi-fetch\";\nimport type { paths } from \"../generated/openapi/api-client\";\nimport { version } from \"../../../package.json\";\nimport {\n LANGWATCH_SDK_LANGUAGE,\n LANGWATCH_SDK_NAME_OBSERVABILITY,\n LANGWATCH_SDK_RUNTIME,\n LANGWATCH_SDK_VERSION,\n} from \"../constants\";\nimport { DEFAULT_ENDPOINT } from \"@/internal/constants\";\n\n\n/**\n * Creates a new LangWatch API client.\n * @param apiKey - The API key to use for authentication. Defaults to LANGWATCH_API_KEY environment variable.\n * @param endpoint - The endpoint to use for the API client. Defaults to LANGWATCH_ENDPOINT environment variable or internal DEFAULT_ENDPOINT.\n * @returns A new LangWatch API client.\n */\nexport const createLangWatchApiClient = (\n apiKey: string = process.env.LANGWATCH_API_KEY ?? \"\",\n endpoint: string = process.env.LANGWATCH_ENDPOINT ?? DEFAULT_ENDPOINT,\n) => {\n return openApiCreateClient<paths>({\n baseUrl: endpoint,\n headers: {\n ...(apiKey ? { authorization: `Bearer ${apiKey}`, 'x-auth-token': apiKey } : {}),\n \"content-type\": \"application/json\",\n \"user-agent\": `langwatch-sdk-node/${version}`,\n \"x-langwatch-sdk-name\": LANGWATCH_SDK_NAME_OBSERVABILITY,\n \"x-langwatch-sdk-language\": LANGWATCH_SDK_LANGUAGE,\n \"x-langwatch-sdk-version\": LANGWATCH_SDK_VERSION,\n \"x-langwatch-sdk-platform\": LANGWATCH_SDK_RUNTIME(),\n },\n });\n};\n\n\nexport type LangwatchApiClient = ReturnType<typeof createLangWatchApiClient>;\n","import type { paths } from \"@/internal/generated/openapi/api-client\";\nimport { type PromptResponse } from \"./types\";\nimport { PromptConverter } from \"@/cli/utils/promptConverter\";\nimport { PromptServiceTracingDecorator, tracer } from \"./tracing\";\nimport { createTracingProxy } from \"@/client-sdk/tracing/create-tracing-proxy\";\nimport { type InternalConfig } from \"@/client-sdk/types\";\nimport { type CreatePromptBody, type UpdatePromptBody } from \"./types\";\nimport { createLangWatchApiClient, type LangwatchApiClient } from \"@/internal/api/client\";\nimport { PromptsApiError } from \"./errors\";\n\nexport type SyncAction = \"created\" | \"updated\" | \"conflict\" | \"up_to_date\";\n\nexport type ConfigData = NonNullable<\n paths[\"/api/prompts/{id}/sync\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"][\"configData\"];\n\nexport interface SyncResult {\n action: SyncAction;\n prompt?: PromptResponse;\n conflictInfo?: {\n localVersion: number;\n remoteVersion: number;\n differences: string[];\n remoteConfigData: ConfigData;\n };\n}\n\n/**\n * Service for managing prompt resources via the Langwatch API.\n * Constructor creates a proxy that wraps the service and traces all methods.\n *\n * Responsibilities:\n * - CRUD operations for prompts\n * - Creating prompt versions\n * - Error handling with contextual information\n *\n * All methods return raw PromptResponse data from the API.\n */\nexport class PromptsApiService {\n private readonly apiClient: LangwatchApiClient;\n\n constructor(config?: Pick<InternalConfig, \"langwatchApiClient\">) {\n this.apiClient = config?.langwatchApiClient ?? createLangWatchApiClient();\n\n /**\n * Wraps the service in a tracing proxy via the decorator.\n */\n return createTracingProxy(\n this as PromptsApiService,\n tracer,\n PromptServiceTracingDecorator,\n );\n }\n\n /**\n * Handles API errors by throwing a PromptsApiError with operation context.\n * @param operation Description of the operation being performed.\n * @param error The error object returned from the API client.\n * @throws {PromptsApiError}\n */\n private handleApiError(operation: string, error: any): never {\n const errorMessage =\n typeof error === \"string\"\n ? error\n : error?.error != null\n ? typeof error.error === \"string\"\n ? error.error\n : error.error.message ??\n JSON.stringify(error.error, Object.getOwnPropertyNames(error.error))\n : error?.message ?? \"Unknown error occurred\";\n\n throw new PromptsApiError(\n `Failed to ${operation}: ${errorMessage}`,\n operation,\n error,\n );\n }\n\n /**\n * Fetches all prompts from the API.\n * @returns Array of raw PromptResponse data.\n * @throws {PromptsApiError} If the API call fails.\n */\n async getAll(): Promise<PromptResponse[]> {\n const { data, error } =\n await this.apiClient.GET(\"/api/prompts\");\n if (error) this.handleApiError(\"fetch all prompts\", error);\n return data;\n }\n\n /**\n * Fetches a single prompt by its ID.\n * @param id The prompt's unique identifier.\n * @returns Raw PromptResponse data.\n * @throws {PromptsApiError} If the API call fails.\n */\n get = async (id: string, options?: { version?: string }): Promise<PromptResponse> => {\n 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 {PromptsApiError} If the API call fails (not 404).\n */\n async exists(id: string): Promise<boolean> {\n try {\n await this.get(id);\n return true;\n } catch (error) {\n const originalError = error instanceof PromptsApiError ? error.originalError : null;\n const statusCode = originalError != null && typeof originalError === \"object\" && \"statusCode\" in originalError\n ? (originalError as { statusCode: unknown }).statusCode\n : null;\n\n if (statusCode === 404) {\n return false;\n }\n\n throw error;\n }\n }\n\n /**\n * Creates a new prompt.\n * @param params The prompt creation payload, matching the OpenAPI schema.\n * @returns Raw PromptResponse data of the created prompt.\n * @throws {PromptsApiError} If the API call fails.\n */\n async create(params: CreatePromptBody): Promise<PromptResponse> {\n const { data, error } = await this.apiClient.POST(\n \"/api/prompts\",\n {\n body: params,\n },\n );\n if (error) this.handleApiError(\"create prompt\", error);\n return data;\n }\n\n /**\n * Updates an existing prompt.\n * @param id The prompt's unique identifier.\n * @param params The update payload, matching the OpenAPI schema.\n * @returns Raw PromptResponse data of the updated prompt.\n * @throws {PromptsApiError} If the API call fails.\n */\n async update(id: string, params: UpdatePromptBody): Promise<PromptResponse> {\n const { error, data: updatedPrompt } =\n await this.apiClient.PUT(\"/api/prompts/{id}\", {\n params: { path: { id } },\n body: params,\n });\n if (error) this.handleApiError(`update prompt with ID \"${id}\"`, error);\n return updatedPrompt;\n }\n\n /**\n * Deletes a prompt by its ID.\n * @param id The prompt's unique identifier.\n * @throws {PromptsApiError} If the API call fails.\n */\n async delete(id: string): Promise<{ success: boolean }> {\n const { data, error } = await this.apiClient.DELETE(\n \"/api/prompts/{id}\",\n {\n params: { path: { id } },\n },\n );\n if (error) this.handleApiError(`delete prompt with ID \"${id}\"`, error);\n\n return data;\n }\n\n /**\n * Fetches all versions for a given prompt.\n * @param id The prompt's unique identifier.\n * @returns Array of raw PromptResponse data for each version.\n * @throws {PromptsApiError} If the API call fails.\n */\n async getVersions(id: string): Promise<PromptResponse[]> {\n const { data, error } = await this.apiClient.GET(\n \"/api/prompts/{id}/versions\",\n {\n params: { path: { id } },\n },\n );\n if (error)\n this.handleApiError(`fetch versions for prompt with ID \"${id}\"`, error);\n\n return data;\n }\n\n /**\n * Upserts a prompt with local configuration - creates if doesn't exist, updates version if exists.\n * @param handle The prompt's handle/identifier.\n * @param config Local prompt configuration.\n * @returns Object with created flag and raw PromptResponse data.\n * @throws {PromptsApiError} If the API call fails.\n */\n async upsert(\n handle: string,\n config: {\n model: string;\n modelParameters?: {\n temperature?: number;\n max_tokens?: number;\n };\n messages: Array<{\n role: \"system\" | \"user\" | \"assistant\";\n content: string;\n }>;\n },\n ): Promise<{ created: boolean; prompt: PromptResponse }> {\n const payload = {\n handle,\n model: config.model,\n prompt: PromptConverter.extractSystemPrompt(config.messages),\n messages: PromptConverter.filterNonSystemMessages(config.messages),\n temperature: config.modelParameters?.temperature,\n maxTokens: config.modelParameters?.max_tokens,\n inputs: [{ identifier: \"input\", type: \"str\" as const }],\n outputs: [{ identifier: \"output\", type: \"str\" as const }],\n commitMessage: `Updated via CLI sync`,\n schemaVersion: \"1.0\" as const,\n };\n\n // Creating a prompt with the same handle will fail, so we try to update instead\n try {\n const prompt = await this.create(payload);\n return {\n created: true,\n prompt,\n };\n } catch {\n const prompt = await this.update(handle, payload);\n\n return {\n created: false,\n prompt,\n };\n }\n }\n\n /**\n * Sync a prompt with local content, handling conflicts and version management\n * You probably don't need to use this method directly.\n */\n async sync(params: {\n name: string;\n configData: ConfigData;\n localVersion?: number;\n commitMessage?: string;\n }): Promise<SyncResult> {\n try {\n const response = await this.apiClient.POST(\n \"/api/prompts/{id}/sync\",\n {\n params: { path: { id: params.name } },\n body: {\n configData: params.configData,\n localVersion: params.localVersion,\n commitMessage: params.commitMessage,\n },\n },\n );\n\n if (response.error) {\n const errorMessage =\n response.error?.error ?? JSON.stringify(response.error);\n throw new Error(`Failed to sync prompt: ${errorMessage}`);\n }\n\n return {\n action: response.data.action as SyncAction,\n prompt: response.data.prompt,\n conflictInfo: response.data.conflictInfo,\n };\n } catch (error) {\n const message =\n error instanceof Error ? error.message : \"Unknown error occurred\";\n throw new PromptsApiError(message, \"sync\", error);\n }\n }\n}\n","import { type z } from \"zod\";\nimport type { paths } from \"@/internal/generated/openapi/api-client\";\nimport {\n type corePromptDataSchema,\n type promptMetadataSchema,\n type promptDataSchema\n} from \"./schema\";\n\n/**\n * Type for template variables - supporting common data types\n */\nexport type TemplateVariables = Record<\n string,\n string | number | boolean | object | null\n>;\n\n/**\n * Core data needed for prompt functionality\n */\nexport type CorePromptData = z.infer<typeof corePromptDataSchema>;\n\n/**\n * Optional metadata for identification and tracing\n */\nexport type PromptMetadata = z.infer<typeof promptMetadataSchema>;\n\n/**\n * Combined type for creating prompts\n */\nexport type PromptData = z.infer<typeof promptDataSchema>;\n\n// Extract API types from OpenAPI schema for backwards compatibility\nexport type CreatePromptBody = NonNullable<\n paths[\"/api/prompts\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n\nexport type UpdatePromptBody = NonNullable<\n paths[\"/api/prompts/{id}\"][\"put\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n\nexport type PromptResponse = NonNullable<\n paths[\"/api/prompts/{id}\"][\"get\"][\"responses\"][\"200\"][\"content\"][\"application/json\"]\n>;\n\n// Extract the PromptScope type from the API client\nexport type PromptScope = paths[\"/api/prompts\"][\"post\"][\"responses\"][\"200\"][\"content\"][\"application/json\"][\"scope\"];\n\n/**\n * Fetch policy for prompt retrieval.\n * Controls how prompts are fetched and cached.\n */\nexport enum FetchPolicy {\n /** Use local file if available, otherwise fetch from API (default) */\n MATERIALIZED_FIRST = \"MATERIALIZED_FIRST\",\n /** Always try API first, fall back to materialized */\n ALWAYS_FETCH = \"ALWAYS_FETCH\",\n /** Fetch every X minutes, use materialized between fetches */\n CACHE_TTL = \"CACHE_TTL\",\n /** Never fetch, use materialized files only */\n MATERIALIZED_ONLY = \"MATERIALIZED_ONLY\",\n}\n\n","import { Liquid } from \"liquidjs\";\nimport { PromptTracingDecorator, tracer } from \"./tracing\";\nimport { createTracingProxy } from \"@/client-sdk/tracing/create-tracing-proxy\";\nimport { promptDataSchema } from \"./schema\";\nimport { type TemplateVariables, type PromptData, type CorePromptData, type PromptScope } from \"./types\";\nimport { PromptCompilationError, PromptValidationError } from \"./errors\";\n\n// Re-export types and errors for convenience\nexport type { TemplateVariables, PromptData, CorePromptData, PromptMetadata } from \"./types\";\nexport { PromptCompilationError, PromptValidationError } from \"./errors\";\n\n// Global Liquid instance - shared across all prompts for efficiency\nconst liquid = new Liquid({\n strictFilters: true,\n});\n\n/**\n * The Prompt class provides a standardized interface for working with prompt objects\n * within the SDK, focusing on core functionality needed for template compilation and execution.\n * Keeps only essential fields while maintaining compatibility with tracing and observability.\n */\nexport class Prompt {\n // === Core functionality (required) ===\n public readonly model!: string;\n public readonly messages!: Array<{\n role: \"user\" | \"assistant\" | \"system\";\n content: string;\n }>;\n\n // === Optional core fields ===\n public readonly prompt?: string;\n public readonly temperature?: number;\n public readonly maxTokens?: number;\n public readonly responseFormat?: CorePromptData[\"responseFormat\"];\n\n // === Optional identification (for tracing) ===\n public readonly id?: string;\n public readonly handle?: string | null;\n public readonly version?: number;\n public readonly versionId?: string;\n public readonly scope?: PromptScope;\n\n constructor(data: PromptData) {\n // Validate input using Zod\n const validationResult = promptDataSchema.strip().safeParse(data);\n\n if (!validationResult.success) {\n throw new PromptValidationError(\n \"Invalid prompt data provided\",\n validationResult.error\n );\n }\n\n // Assign validated data\n Object.assign(this, validationResult.data);\n\n // Set default for prompt if not provided\n this.prompt ??= this.extractSystemPrompt();\n\n // Return a proxy that wraps specific methods for tracing\n return createTracingProxy(this as Prompt, tracer, PromptTracingDecorator);\n }\n\n private extractSystemPrompt(): string {\n return this.messages.find(m => m.role === \"system\")?.content ?? \"\";\n }\n\n /**\n * Compile the prompt template with provided variables (lenient - missing variables become empty)\n * @param variables - Object containing variable values for template compilation\n * @returns CompiledPrompt instance with compiled content\n */\n private _compile(\n variables: TemplateVariables,\n strict: boolean,\n ): CompiledPrompt {\n try {\n // Compile main prompt\n const compiledPrompt = this.prompt\n ? liquid.parseAndRenderSync(this.prompt, variables, {\n strictVariables: strict,\n })\n : \"\";\n\n // Compile messages\n const compiledMessages = (this.messages || []).map((message) => ({\n ...message,\n content: message.content\n ? liquid.parseAndRenderSync(message.content, variables, {\n strictVariables: strict,\n })\n : message.content,\n }));\n\n // Create new prompt data with compiled content\n const compiledData: PromptData = {\n ...this,\n prompt: compiledPrompt,\n messages: compiledMessages,\n };\n\n return new CompiledPrompt(compiledData, this);\n } catch (error) {\n const templateStr = this.prompt ?? JSON.stringify(this.messages);\n throw new PromptCompilationError(\n `Failed to compile prompt template: ${\n error instanceof Error ? error.message : \"Unknown error\"\n }`,\n templateStr,\n error,\n );\n }\n }\n\n compile(variables: TemplateVariables = {}): CompiledPrompt {\n return this._compile(variables, false);\n }\n\n /**\n * Compile with validation - throws error if required variables are missing\n * @param variables - Template variables\n * @returns CompiledPrompt instance with compiled content\n */\n compileStrict(variables: TemplateVariables): CompiledPrompt {\n return this._compile(variables, true);\n }\n}\n\n\n/**\n * Represents a compiled prompt that extends Prompt with reference to the original template\n */\nexport class CompiledPrompt extends Prompt {\n constructor(\n compiledData: PromptData,\n public readonly original: Prompt,\n ) {\n super(compiledData);\n }\n}\n","// TODO: Move these to their own files\nimport { z } from \"zod\";\nimport { PromptScope } from \"../constants\";\n\n/**\n * Zod schema for message objects in prompts\n */\nexport const messageSchema = z.object({\n role: z.enum([\"user\", \"assistant\", \"system\"]),\n content: z.string(),\n});\n\n/**\n * Zod schema for response format configuration\n */\nexport const responseFormatSchema = z.object({\n type: z.literal(\"json_schema\"),\n json_schema: z.object({\n name: z.string(),\n schema: z.record(z.string(), z.unknown()),\n }).nullable(),\n}).optional();\n\n/**\n * Zod schema for core prompt data - the essential fields needed for functionality\n */\nexport const corePromptDataSchema = z.object({\n model: z.string().min(1, \"Model cannot be empty\"),\n messages: z.array(messageSchema).min(1, \"At least one message is required\"),\n prompt: z.string().optional(),\n temperature: z.number().min(0).max(2).optional(),\n maxTokens: z.number().positive().optional(),\n responseFormat: responseFormatSchema,\n});\n\n/**\n * Zod schema for prompt metadata - optional fields for identification and tracing\n */\nexport const promptMetadataSchema = z.object({\n id: z.string().optional(),\n handle: z.string().nullable().optional(),\n version: z.number().min(0).optional(),\n versionId: z.string().optional(),\n scope: z.enum(PromptScope).optional(),\n});\n\n/**\n * Combined schema for complete prompt data\n */\nexport const promptDataSchema = z.object({\n ...corePromptDataSchema.shape,\n ...promptMetadataSchema.shape,\n});\n","import { type PromptScope as PromptScopeType } from \"./types\";\n\nexport const PromptScope = {\n ORGANIZATION: \"ORGANIZATION\" as const,\n PROJECT: \"PROJECT\" as const,\n} satisfies Record<string, PromptScopeType>;\n","import type { LocalPromptConfig, PromptDependency } from \"@/cli/types\";\nimport { FileManager } from \"@/cli/utils/fileManager\";\nimport { type Logger, NoOpLogger } from \"@/logger\";\nimport { type PromptData } from \"./types\";\nimport { PromptFileNotFoundError } from \"@/cli/utils/errors/prompt-not-found.error\";\n\nexport interface LocalPromptsServiceConfig {\n fileManager?: typeof FileManager;\n logger?: Logger;\n}\n\n/**\n * Service for retrieving prompts from local filesystem sources.\n *\n * Searches for prompts in the following priority order:\n * 1. Explicit file mapping in prompts.json config\n * 2. Materialized path from prompts-lock.json\n * 3. Direct file scanning in prompts directory\n */\nexport class LocalPromptsService {\n private readonly fileManager: typeof FileManager;\n private readonly logger: Logger;\n\n constructor(config?: LocalPromptsServiceConfig) {\n this.fileManager = config?.fileManager ?? FileManager;\n this.logger = config?.logger ?? new NoOpLogger();\n }\n\n /**\n * Retrieves a prompt using the configured search strategy.\n * Tries each source in priority order until found or all sources exhausted.\n */\n async get(handleOrId: string): Promise<PromptData | null> {\n try {\n const dependency = await this.getDependencyFromConfig(handleOrId);\n\n // If no dependency is found, it means it's not a local prompt\n if (!dependency) {\n return null;\n }\n\n // Try each source in priority order until found or all sources exhausted\n // We catch errors and return null if any of the sources fail so we\n // can continue to the next source and return null if all sources fail\n const localPromptConfig = (\n (await this.getFromConfig(dependency).catch((e) => {\n if (e instanceof PromptFileNotFoundError) return null;\n throw e;\n })) ??\n (await this.getFromLockFile(handleOrId).catch((e) => {\n if (e instanceof PromptFileNotFoundError) return null;\n throw e;\n })) ??\n (await this.getFromLocalFiles(handleOrId).catch((e) => {\n if (e instanceof PromptFileNotFoundError) return null;\n throw e;\n }))\n );\n\n return localPromptConfig ? this.convertToPromptData({\n ...localPromptConfig,\n handle: handleOrId,\n }) : null;\n } catch (error) {\n this.logger.warn(`Failed to get prompt \"${handleOrId}\": ${error instanceof Error ? error.message : String(error)}`);\n return null;\n }\n }\n\n\n /**\n * Searches for prompt using explicit file mapping in prompts.json.\n * Looks for dependencies with a 'file' property pointing to a specific path.\n */\n private async getFromConfig(dependency: PromptDependency): Promise<LocalPromptConfig | null> {\n if (typeof dependency === 'string' && dependency.startsWith('file:')) {\n return this.fileManager.loadLocalPrompt(dependency.slice(5));\n }\n\n return null;\n }\n\n /**\n * Searches for prompt using materialized path from lock file.\n * Lock file contains resolved paths for prompts that have been synced/materialized.\n */\n private async getFromLockFile(handleOrId: string): Promise<LocalPromptConfig | null> {\n const lock = this.fileManager.loadPromptsLock();\n const lockEntry = lock.prompts[handleOrId];\n\n if (lockEntry?.materialized) {\n return this.fileManager.loadLocalPrompt(lockEntry.materialized);\n }\n\n return null;\n }\n\n /**\n * Searches for prompt by scanning all .prompt.yaml files in prompts directory.\n * Extracts prompt name from file path and matches against the requested handle.\n * This is the fallback method when explicit mappings don't exist.\n */\n private async getFromLocalFiles(handleOrId: string): Promise<LocalPromptConfig | null> {\n const localFiles = this.fileManager.getLocalPromptFiles();\n\n for (const filePath of localFiles) {\n const promptName = this.fileManager.promptNameFromPath(filePath);\n if (promptName === handleOrId) {\n return this.fileManager.loadLocalPrompt(filePath);\n }\n }\n\n return null;\n }\n\n /**\n * Get dependency from config\n */\n private async getDependencyFromConfig(handleOrId: string): Promise<PromptDependency | null> {\n const config = this.fileManager.loadPromptsConfig();\n const dependency = config.prompts[handleOrId];\n\n return dependency ?? null;\n }\n\n /**\n * Converts LocalPromptConfig to PromptData format\n */\n private convertToPromptData(config: LocalPromptConfig & { handle: string; }): PromptData {\n const { modelParameters, ...rest } = config;\n return {\n maxTokens: modelParameters?.max_tokens,\n temperature: modelParameters?.temperature,\n ...rest,\n };\n }\n}\n","import { PromptsApiService, type SyncResult } from \"./prompts-api.service\";\nimport { Prompt } from \"./prompt\";\nimport type { CreatePromptBody, UpdatePromptBody, PromptData } from \"./types\";\nimport { FetchPolicy } from \"./types\";\nimport { type InternalConfig } from \"@/client-sdk/types\";\nimport { LocalPromptsService } from \"./local-prompts.service\";\n\n/**\n * Options for fetching a prompt.\n */\nexport interface GetPromptOptions {\n /** Specific version to fetch */\n version?: string;\n /** Fetch policy to use */\n fetchPolicy?: FetchPolicy;\n /** Cache TTL in minutes (only used with CACHE_TTL policy) */\n cacheTtlMinutes?: number;\n}\n\ninterface CacheEntry {\n data: PromptData;\n timestamp: number;\n}\n\ninterface PromptsFacadeDependencies {\n promptsApiService: PromptsApiService;\n localPromptsService: LocalPromptsService;\n}\n\n/**\n * Facade for prompt operations in the LangWatch SDK.\n * Provides a simplified interface for common prompt management tasks.\n */\nexport class PromptsFacade implements Pick<PromptsApiService, \"sync\" | \"delete\">{\n private readonly promptsApiService: PromptsApiService;\n private readonly localPromptsService: LocalPromptsService;\n private readonly cache = new Map<string, CacheEntry>();\n\n constructor(config: InternalConfig & PromptsFacadeDependencies) {\n this.promptsApiService = config.promptsApiService ?? new PromptsApiService(config);\n this.localPromptsService = config.localPromptsService ?? new LocalPromptsService();\n }\n\n /**\n * Creates a new prompt.\n * @param data The prompt creation payload.\n * @returns The created Prompt instance.\n * @throws {PromptsError} If the API call fails.\n */\n async create(data: CreatePromptBody): Promise<Prompt> {\n const serverPrompt = await this.promptsApiService.create(data);\n return new Prompt(serverPrompt);\n }\n\n /**\n * Retrieves a prompt by handle or ID.\n * @param handleOrId The prompt's handle or unique identifier.\n * @param options Optional parameters for the request.\n * @returns The Prompt instance.\n * @throws {PromptsError} If the prompt is not found or the API call fails.\n */\n async get(\n handleOrId: string,\n options?: GetPromptOptions,\n ): Promise<Prompt> {\n const fetchPolicy = options?.fetchPolicy ?? FetchPolicy.MATERIALIZED_FIRST;\n\n switch (fetchPolicy) {\n case FetchPolicy.MATERIALIZED_ONLY:\n return this.getMaterializedOnly(handleOrId);\n\n case FetchPolicy.ALWAYS_FETCH:\n return this.getAlwaysFetch(handleOrId, options);\n\n case FetchPolicy.CACHE_TTL:\n return this.getCacheTtl(handleOrId, options);\n\n case FetchPolicy.MATERIALIZED_FIRST:\n default:\n return this.getMaterializedFirst(handleOrId, options);\n }\n }\n\n private async getMaterializedFirst(\n handleOrId: string,\n options?: GetPromptOptions,\n ): Promise<Prompt> {\n const localPrompt = await this.localPromptsService.get(handleOrId);\n if (localPrompt) {\n return new Prompt(localPrompt);\n }\n const serverPrompt = await this.promptsApiService.get(handleOrId, options);\n return new Prompt(serverPrompt);\n }\n\n private async getAlwaysFetch(\n handleOrId: string,\n options?: GetPromptOptions,\n ): Promise<Prompt> {\n try {\n const serverPrompt = await this.promptsApiService.get(handleOrId, options);\n return new Prompt(serverPrompt);\n } catch {\n const localPrompt = await this.localPromptsService.get(handleOrId);\n if (localPrompt) {\n return new Prompt(localPrompt);\n }\n throw new Error(`Prompt \"${handleOrId}\" not found locally or on server`);\n }\n }\n\n private async getMaterializedOnly(handleOrId: string): Promise<Prompt> {\n const localPrompt = await this.localPromptsService.get(handleOrId);\n if (localPrompt) {\n return new Prompt(localPrompt);\n }\n throw new Error(`Prompt \"${handleOrId}\" not found in materialized files`);\n }\n\n /**\n * Builds a cache key that includes both handle and version to prevent collisions.\n */\n private buildCacheKey(handleOrId: string, options?: GetPromptOptions): string {\n return `${handleOrId}::version:${options?.version ?? ''}`;\n }\n\n private async getCacheTtl(\n handleOrId: string,\n options?: GetPromptOptions,\n ): Promise<Prompt> {\n const cacheKey = this.buildCacheKey(handleOrId, options);\n const ttlMs = (options?.cacheTtlMinutes ?? 5) * 60 * 1000;\n const cached = this.cache.get(cacheKey);\n const now = Date.now();\n\n if (cached && now - cached.timestamp < ttlMs) {\n return new Prompt(cached.data);\n }\n\n try {\n const serverPrompt = await this.promptsApiService.get(handleOrId, options);\n this.cache.set(cacheKey, { data: serverPrompt, timestamp: now });\n return new Prompt(serverPrompt);\n } catch {\n const localPrompt = await this.localPromptsService.get(handleOrId);\n if (localPrompt) {\n return new Prompt(localPrompt);\n }\n throw new Error(`Prompt \"${handleOrId}\" not found locally or on server`);\n }\n }\n\n /**\n * Retrieves all prompts.\n * @returns Array of Prompt instances.\n * @throws {PromptsError} If the API call fails.\n */\n async getAll(): Promise<Prompt[]> {\n const serverPrompts = await this.promptsApiService.getAll();\n return serverPrompts.map((prompt) => new Prompt(prompt));\n }\n\n /**\n * Updates an existing prompt.\n * @param handleOrId The prompt's handle or unique identifier.\n * @param newData The update payload.\n * @returns The updated Prompt instance.\n * @throws {PromptsError} If the API call fails.\n */\n async update(handleOrId: string, newData: UpdatePromptBody): Promise<Prompt> {\n const serverPrompt = await this.promptsApiService.update(handleOrId, newData);\n return new Prompt(serverPrompt);\n }\n\n get delete() {\n return this.promptsApiService.delete.bind(this.promptsApiService);\n }\n\n /**\n * Delegated method to the prompts API service.\n */\n get sync() {\n return this.promptsApiService.sync.bind(this.promptsApiService);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIO,IAAM,eAAN,cAA2B,MAAM;AAAA,EACtC,YAAY,SAAiB;AAC3B,UAAM,OAAO;AACb,SAAK,OAAO;AAAA,EACd;AACF;;;ACNO,IAAM,yBAAN,cAAqC,MAAM;AAAA,EAChD,YACE,SACgB,UACA,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,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O,IAAI,OAAO,YAAY;AAAA,EAChC;AAAA,EAEA,IAAI,SAAS;AACX,WAAO,KAAK,kBAAkB,OAAO,KAAK,KAAK,iBAAiB;AAAA,EAClE;AAAA;AAAA;AAAA;AAAA,EAKA,IAAI,OAAO;AACT,WAAO,KAAK,kBAAkB,KAAK,KAAK,KAAK,iBAAiB;AAAA,EAChE;AACF;","names":["tracer","target","FetchPolicy"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/langwatch/langwatch/typescript-sdk/dist/chunk-NM5OKM7F.js","../src/client-sdk/services/prompts/errors/prompts.error.ts","../src/client-sdk/services/prompts/errors/prompt-compilation.error.ts","../src/client-sdk/services/prompts/errors/prompt-validation.error.ts","../src/client-sdk/services/prompts/errors/prompts-api.error.ts","../src/client-sdk/services/prompts/tracing/prompt-tracing.decorator.ts","../src/client-sdk/services/prompts/tracing/prompt-service-tracing.decorator.ts","../src/client-sdk/services/prompts/tracing/tracer.ts","../src/client-sdk/tracing/create-tracing-proxy.ts","../src/internal/api/client.ts","../src/client-sdk/services/prompts/prompts-api.service.ts","../src/client-sdk/services/prompts/types.ts","../src/client-sdk/services/prompts/prompt.ts","../src/client-sdk/services/prompts/schema/prompt.schema.ts","../src/client-sdk/services/prompts/constants.ts","../src/client-sdk/services/prompts/local-prompts.service.ts","../src/client-sdk/services/prompts/prompts.facade.ts"],"names":["target","FetchPolicy"],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACE;AACA;AACA;AACF,sDAA4B;AAC5B;AACE;AACA;AACA;AACF,sDAA4B;AAC5B;AACE;AACA;AACA;AACF,sDAA4B;AAC5B;AACA;ACxBO,IAAM,aAAA,EAAN,MAAA,QAA2B,MAAM;AAAA,EACtC,WAAA,CAAY,OAAA,EAAiB;AAC3B,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,CAAK,KAAA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AA;AAChB,IAAA;AACF,EAAA;AAGE,EAAA;AAG0B,IAAA;AACT,IAAA;AACG,MAAA;AACpB,IAAA;AAC2B,IAAA;AACT,IAAA;AACpB,EAAA;AAGE,EAAA;AAGI,IAAA;AACyB,MAAA;AACT,MAAA;AACZ,IAAA;AACoB,MAAA;AACT,MAAA;AACG,QAAA;AACpB,MAAA;AAC2B,MAAA;AAC7B,IAAA;AACF,EAAA;AAEkC,EAAA;AACN,IAAA;AACT,IAAA;AACG,MAAA;AACpB,IAAA;AAC2B,IAAA;AAC7B,EAAA;AAAA;AAAA;AAAA;AAK0C,EAAA;AA1H5C,IAAA;AA2HwB,IAAA;AACtB,EAAA;AAIE,EAAA;AAhIJ,IAAA;AAkI0B,IAAA;AACP,IAAA;AACW,IAAA;AACL,IAAA;AAEM,IAAA;AACA,MAAA;AAC3B,IAAA;AAEI,IAAA;AACyB,MAAA;AACA,MAAA;AACT,MAAA;AACZ,IAAA;AACoB,MAAA;AACT,MAAA;AACG,QAAA;AACpB,MAAA;AAC2B,MAAA;AAC7B,IAAA;AACF,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;AAEa,EAAA;AACC,IAAA;AACd,EAAA;AAAA;AAAA;AAAA;AAKW,EAAA;AACG,IAAA;AACd,EAAA;AACF;AhBkpBiC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/langwatch/langwatch/typescript-sdk/dist/chunk-NM5OKM7F.js","sourcesContent":[null,"/**\n * Base error class for the Prompts domain.\n * All prompt-related errors should extend this class.\n */\nexport class PromptsError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"PromptsError\";\n }\n}\n","/**\n * Error class for template compilation issues\n */\nexport class PromptCompilationError extends Error {\n constructor(\n message: string,\n public readonly template: string,\n public readonly originalError?: any,\n ) {\n super(message);\n this.name = \"PromptCompilationError\";\n }\n}\n","import { type z } from \"zod\";\n\n/**\n * Error class for prompt validation issues\n */\nexport class PromptValidationError extends Error {\n constructor(message: string, public readonly validationErrors: z.ZodError) {\n super(message);\n this.name = \"PromptValidationError\";\n }\n}\n","import { PromptsError } from \"./prompts.error\";\n\n/**\n * Error class for Prompts API operations.\n * Provides context about the failed operation and the original error.\n */\nexport class PromptsApiError extends PromptsError {\n constructor(\n message: string,\n public readonly operation: string,\n public readonly originalError?: unknown,\n ) {\n super(message);\n this.name = \"PromptsApiError\";\n }\n}\n","import { type Prompt, type TemplateVariables, type CompiledPrompt } from \"../prompt\";\nimport { shouldCaptureInput, shouldCaptureOutput } from \"@/observability-sdk\";\nimport type { LangWatchSpan } from \"@/observability-sdk\";\n\n/**\n * Class that decorates the target prompt,\n * adding tracing to specific methods.\n */\nexport class PromptTracingDecorator {\n constructor(private readonly target: Prompt) {}\n\n private traceCompilation(\n span: LangWatchSpan,\n variables: TemplateVariables,\n compileFn: () => CompiledPrompt\n ): CompiledPrompt {\n span.setType(\"prompt\");\n\n if (shouldCaptureInput()) {\n span.setInput(this.target);\n\n if (variables) {\n span.setAttribute(\n 'langwatch.prompt.variables',\n JSON.stringify({\n type: \"json\",\n value: variables,\n }),\n );\n }\n }\n\n const result = compileFn();\n\n span.setAttributes({\n 'langwatch.prompt.id': result.id,\n 'langwatch.prompt.handle': result.handle ?? '',\n 'langwatch.prompt.version.id': result.versionId,\n 'langwatch.prompt.version.number': result.version,\n });\n\n if (shouldCaptureOutput()) {\n span.setOutput({\n ...result,\n raw: void 0, // TODO(afr): Figure out a better way to do this.\n });\n }\n\n return result;\n }\n\n compile(span: LangWatchSpan, variables: TemplateVariables = {}): CompiledPrompt {\n return this.traceCompilation(\n span,\n variables,\n () => this.target.compile(variables),\n );\n }\n\n compileStrict(span: LangWatchSpan, variables: TemplateVariables): CompiledPrompt {\n return this.traceCompilation(\n span,\n variables,\n () => this.target.compileStrict(variables),\n );\n }\n}\n","import { type PromptsApiService } from \"../prompts-api.service\";\nimport type { LangWatchSpan } from \"@/observability-sdk\";\nimport { shouldCaptureInput, shouldCaptureOutput } from \"@/observability-sdk\";\nimport type { CreatePromptBody, UpdatePromptBody, PromptResponse } from \"../types\";\n\n/**\n * Class that decorates the target prompt service,\n * adding tracing to key methods.\n */\nexport class PromptServiceTracingDecorator {\n constructor(private readonly target: PromptsApiService) {}\n\n async get(\n span: LangWatchSpan,\n id: string,\n options?: { version?: string }\n ): Promise<PromptResponse> {\n span.setType(\"prompt\");\n span.setAttribute('langwatch.prompt.id', id);\n\n const result = await this.target.get(id, options);\n\n if (result) {\n span.setAttributes({\n 'langwatch.prompt.id': result.id,\n 'langwatch.prompt.handle': result.handle ?? '',\n 'langwatch.prompt.version.id': result.versionId,\n 'langwatch.prompt.version.number': result.version,\n });\n }\n\n if (result && shouldCaptureOutput()) {\n span.setOutput(\"json\", result);\n }\n\n return result;\n }\n\n async create(\n span: LangWatchSpan,\n params: CreatePromptBody\n ): Promise<PromptResponse> {\n span.setType(\"prompt\");\n\n if (shouldCaptureInput()) {\n span.setInput(params);\n }\n\n const result = await this.target.create(params);\n\n span.setAttributes({\n 'langwatch.prompt.id': result.id,\n 'langwatch.prompt.handle': result.handle ?? undefined,\n 'langwatch.prompt.scope': result.scope,\n 'langwatch.prompt.version.id': result.versionId,\n 'langwatch.prompt.version.number': result.version,\n });\n\n return result;\n }\n\n async update(\n span: LangWatchSpan,\n id: string,\n params: UpdatePromptBody\n ): Promise<PromptResponse> {\n\n if (shouldCaptureInput()) {\n span.setInput(params);\n }\n\n const result = await this.target.update(id, params);\n\n span.setType(\"prompt\");\n span.setAttributes({\n 'langwatch.prompt.id': id,\n 'langwatch.prompt.handle': result.handle ?? undefined,\n 'langwatch.prompt.scope': result.scope,\n 'langwatch.prompt.version.id': result.versionId,\n 'langwatch.prompt.version.number': result.version,\n });\n\n return result;\n }\n\n async delete(\n span: LangWatchSpan,\n id: string\n ): Promise<{ success: boolean }> {\n const result = await this.target.delete(id);\n\n span.setType(\"prompt\");\n span.setAttribute('langwatch.prompt.id', id);\n span.setAttribute('langwatch.prompt.deleted', 'true');\n\n return result;\n }\n\n async upsert(\n span: LangWatchSpan,\n handle: string,\n config: any\n ): Promise<{ created: boolean; prompt: PromptResponse }> {\n if (shouldCaptureInput()) {\n span.setInput(config);\n }\n\n const result = await this.target.upsert(handle, config);\n\n span.setType(\"prompt\");\n span.setAttributes({\n 'langwatch.prompt.handle': handle,\n 'langwatch.prompt.created': result.created.toString(),\n 'langwatch.prompt.id': result.prompt.id,\n 'langwatch.prompt.version.id': result.prompt.versionId,\n 'langwatch.prompt.version.number': result.prompt.version,\n });\n\n return result;\n }\n\n async sync(\n span: LangWatchSpan,\n params: any\n ): Promise<any> {\n if (shouldCaptureInput()) {\n span.setInput(params);\n }\n\n const result = await this.target.sync(params);\n\n span.setType(\"prompt\");\n span.setAttribute('langwatch.prompt.name', params.name);\n span.setAttribute('langwatch.prompt.sync.action', result.action);\n\n if (result.conflictInfo) {\n span.setAttributes({\n 'langwatch.prompt.sync.has_conflict': 'true',\n 'langwatch.prompt.sync.local_version': result.conflictInfo.localVersion.toString(),\n 'langwatch.prompt.sync.remote_version': result.conflictInfo.remoteVersion.toString(),\n });\n }\n\n return result;\n }\n}\n","import { getLangWatchTracer } from \"@/observability-sdk/tracer\";\nimport { LANGWATCH_SDK_NAME_CLIENT, LANGWATCH_SDK_VERSION } from \"@/internal/constants\";\n\nexport const tracer = getLangWatchTracer(`${LANGWATCH_SDK_NAME_CLIENT}.prompts`, LANGWATCH_SDK_VERSION);\n","import { type LangWatchTracer } from \"@/observability-sdk\";\nimport { SpanKind } from \"@opentelemetry/api\";\n\n// Type for decorator methods that receive span as first parameter\ntype DecoratorMethodWithSpan<T extends (...args: any[]) => any> =\n (span: any, ...args: Parameters<T>) => ReturnType<T>;\n\n// Type for decorator class that maps original methods to span-aware versions\n// Only requires methods that are actually implemented in the decorator\ntype DecoratorClass<T> = new (target: T) => Partial<{\n [K in keyof T]: T[K] extends (...args: any[]) => any\n ? DecoratorMethodWithSpan<T[K]>\n : T[K];\n }>;\n\n/**\n * Creates a proxy that always creates spans for public methods.\n * Decorators can access the span as the first parameter to add additional attributes.\n *\n * @param target - The target to wrap\n * @param tracer - The tracer instance to use\n * @param DecoratorClass - Optional decorator class for custom logic\n * @returns A proxy that wraps the target with consistent tracing\n */\nexport function createTracingProxy<\n T extends object,\n D extends DecoratorClass<T> | undefined = undefined\n>(\n target: T,\n tracer: LangWatchTracer,\n DecoratorClass?: D,\n): T {\n const decorator = DecoratorClass ? new DecoratorClass(target) : null;\n\n return new Proxy(target, {\n get(target, prop, receiver) {\n const value = Reflect.get(target, prop, receiver);\n\n // If it's not a function, return as-is\n if (typeof value !== \"function\") {\n return value;\n }\n\n // Only trace public methods\n if (\n typeof prop === \"string\" &&\n !prop.startsWith(\"_\") && // Skip private methods\n !isGetterOrSetter(target, prop) && // Skip actual getters/setters\n !isBuiltInMethod(prop) // Skip built-in methods\n ) {\n return (...args: any[]) => {\n const spanName = `${target.constructor.name}.${prop}`;\n\n return tracer.withActiveSpan(spanName, {\n kind: SpanKind.CLIENT,\n attributes: {\n 'code.function': prop,\n 'code.namespace': target.constructor.name,\n },\n }, (span) => {\n // If decorator has this method, call it with span as first parameter\n if (decorator && prop in decorator) {\n const decoratorMethod = decorator[prop as keyof typeof decorator];\n if (typeof decoratorMethod === \"function\") {\n return decoratorMethod.apply(decorator, [span, ...args]);\n }\n }\n\n // Default: just call the original method\n return value.apply(target, args);\n });\n };\n }\n\n return typeof value === \"function\" ? value.bind(target) : value;\n },\n });\n}\n\n// Helper function to check if a property is a getter or setter\nconst isGetterOrSetter = (target: any, prop: string | symbol): boolean => {\n // First check own properties\n let descriptor = Object.getOwnPropertyDescriptor(target, prop);\n\n // If not found on own properties, check prototype chain\n if (!descriptor) {\n const prototype = Object.getPrototypeOf(target);\n if (prototype) {\n descriptor = Object.getOwnPropertyDescriptor(prototype, prop);\n }\n }\n\n // Return true if it's a getter or setter\n return !!(descriptor?.get ?? descriptor?.set);\n};\n\n// Helper function to check if a method is a built-in method that should not be traced\nconst isBuiltInMethod = (prop: string | symbol): boolean => {\n if (typeof prop !== \"string\") {\n return false;\n }\n\n // List of built-in methods that should not be traced\n const builtInMethods = [\n 'toString',\n 'valueOf',\n 'toJSON',\n 'toLocaleString',\n 'hasOwnProperty',\n 'isPrototypeOf',\n 'propertyIsEnumerable',\n 'constructor'\n ];\n\n return builtInMethods.includes(prop);\n};\n","import openApiCreateClient from \"openapi-fetch\";\nimport type { paths } from \"../generated/openapi/api-client\";\nimport { version } from \"../../../package.json\";\nimport {\n LANGWATCH_SDK_LANGUAGE,\n LANGWATCH_SDK_NAME_OBSERVABILITY,\n LANGWATCH_SDK_RUNTIME,\n LANGWATCH_SDK_VERSION,\n} from \"../constants\";\nimport { DEFAULT_ENDPOINT } from \"@/internal/constants\";\n\n\n/**\n * Creates a new LangWatch API client.\n * @param apiKey - The API key to use for authentication. Defaults to LANGWATCH_API_KEY environment variable.\n * @param endpoint - The endpoint to use for the API client. Defaults to LANGWATCH_ENDPOINT environment variable or internal DEFAULT_ENDPOINT.\n * @returns A new LangWatch API client.\n */\nexport const createLangWatchApiClient = (\n apiKey: string = process.env.LANGWATCH_API_KEY ?? \"\",\n endpoint: string = process.env.LANGWATCH_ENDPOINT ?? DEFAULT_ENDPOINT,\n) => {\n return openApiCreateClient<paths>({\n baseUrl: endpoint,\n headers: {\n ...(apiKey ? { authorization: `Bearer ${apiKey}`, 'x-auth-token': apiKey } : {}),\n \"content-type\": \"application/json\",\n \"user-agent\": `langwatch-sdk-node/${version}`,\n \"x-langwatch-sdk-name\": LANGWATCH_SDK_NAME_OBSERVABILITY,\n \"x-langwatch-sdk-language\": LANGWATCH_SDK_LANGUAGE,\n \"x-langwatch-sdk-version\": LANGWATCH_SDK_VERSION,\n \"x-langwatch-sdk-platform\": LANGWATCH_SDK_RUNTIME(),\n },\n });\n};\n\n\nexport type LangwatchApiClient = ReturnType<typeof createLangWatchApiClient>;\n","import type { paths } from \"@/internal/generated/openapi/api-client\";\nimport { type PromptResponse } from \"./types\";\nimport { PromptConverter } from \"@/cli/utils/promptConverter\";\nimport { PromptServiceTracingDecorator, tracer } from \"./tracing\";\nimport { createTracingProxy } from \"@/client-sdk/tracing/create-tracing-proxy\";\nimport { type InternalConfig } from \"@/client-sdk/types\";\nimport { type CreatePromptBody, type UpdatePromptBody } from \"./types\";\nimport { createLangWatchApiClient, type LangwatchApiClient } from \"@/internal/api/client\";\nimport { PromptsApiError } from \"./errors\";\n\nexport type SyncAction = \"created\" | \"updated\" | \"conflict\" | \"up_to_date\";\n\nexport type ConfigData = NonNullable<\n paths[\"/api/prompts/{id}/sync\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"][\"configData\"];\n\nexport interface SyncResult {\n action: SyncAction;\n prompt?: PromptResponse;\n conflictInfo?: {\n localVersion: number;\n remoteVersion: number;\n differences: string[];\n remoteConfigData: ConfigData;\n };\n}\n\n/**\n * Service for managing prompt resources via the Langwatch API.\n * Constructor creates a proxy that wraps the service and traces all methods.\n *\n * Responsibilities:\n * - CRUD operations for prompts\n * - Creating prompt versions\n * - Error handling with contextual information\n *\n * All methods return raw PromptResponse data from the API.\n */\nexport class PromptsApiService {\n private readonly apiClient: LangwatchApiClient;\n\n constructor(config?: Pick<InternalConfig, \"langwatchApiClient\">) {\n this.apiClient = config?.langwatchApiClient ?? createLangWatchApiClient();\n\n /**\n * Wraps the service in a tracing proxy via the decorator.\n */\n return createTracingProxy(\n this as PromptsApiService,\n tracer,\n PromptServiceTracingDecorator,\n );\n }\n\n /**\n * Handles API errors by throwing a PromptsApiError with operation context.\n * @param operation Description of the operation being performed.\n * @param error The error object returned from the API client.\n * @throws {PromptsApiError}\n */\n private handleApiError(operation: string, error: any): never {\n const errorMessage =\n typeof error === \"string\"\n ? error\n : error?.error != null\n ? typeof error.error === \"string\"\n ? error.error\n : error.error.message ??\n JSON.stringify(error.error, Object.getOwnPropertyNames(error.error))\n : error?.message ?? \"Unknown error occurred\";\n\n throw new PromptsApiError(\n `Failed to ${operation}: ${errorMessage}`,\n operation,\n error,\n );\n }\n\n /**\n * Fetches all prompts from the API.\n * @returns Array of raw PromptResponse data.\n * @throws {PromptsApiError} If the API call fails.\n */\n async getAll(): Promise<PromptResponse[]> {\n const { data, error } =\n await this.apiClient.GET(\"/api/prompts\");\n if (error) this.handleApiError(\"fetch all prompts\", error);\n return data;\n }\n\n /**\n * Fetches a single prompt by its ID.\n * @param id The prompt's unique identifier.\n * @returns Raw PromptResponse data.\n * @throws {PromptsApiError} If the API call fails.\n */\n get = async (id: string, options?: { version?: string }): Promise<PromptResponse> => {\n 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 {PromptsApiError} If the API call fails (not 404).\n */\n async exists(id: string): Promise<boolean> {\n try {\n await this.get(id);\n return true;\n } catch (error) {\n const originalError = error instanceof PromptsApiError ? error.originalError : null;\n const statusCode = originalError != null && typeof originalError === \"object\" && \"statusCode\" in originalError\n ? (originalError as { statusCode: unknown }).statusCode\n : null;\n\n if (statusCode === 404) {\n return false;\n }\n\n throw error;\n }\n }\n\n /**\n * Creates a new prompt.\n * @param params The prompt creation payload, matching the OpenAPI schema.\n * @returns Raw PromptResponse data of the created prompt.\n * @throws {PromptsApiError} If the API call fails.\n */\n async create(params: CreatePromptBody): Promise<PromptResponse> {\n const { data, error } = await this.apiClient.POST(\n \"/api/prompts\",\n {\n body: params,\n },\n );\n if (error) this.handleApiError(\"create prompt\", error);\n return data;\n }\n\n /**\n * Updates an existing prompt.\n * @param id The prompt's unique identifier.\n * @param params The update payload, matching the OpenAPI schema.\n * @returns Raw PromptResponse data of the updated prompt.\n * @throws {PromptsApiError} If the API call fails.\n */\n async update(id: string, params: UpdatePromptBody): Promise<PromptResponse> {\n const { error, data: updatedPrompt } =\n await this.apiClient.PUT(\"/api/prompts/{id}\", {\n params: { path: { id } },\n body: params,\n });\n if (error) this.handleApiError(`update prompt with ID \"${id}\"`, error);\n return updatedPrompt;\n }\n\n /**\n * Deletes a prompt by its ID.\n * @param id The prompt's unique identifier.\n * @throws {PromptsApiError} If the API call fails.\n */\n async delete(id: string): Promise<{ success: boolean }> {\n const { data, error } = await this.apiClient.DELETE(\n \"/api/prompts/{id}\",\n {\n params: { path: { id } },\n },\n );\n if (error) this.handleApiError(`delete prompt with ID \"${id}\"`, error);\n\n return data;\n }\n\n /**\n * Fetches all versions for a given prompt.\n * @param id The prompt's unique identifier.\n * @returns Array of raw PromptResponse data for each version.\n * @throws {PromptsApiError} If the API call fails.\n */\n async getVersions(id: string): Promise<PromptResponse[]> {\n const { data, error } = await this.apiClient.GET(\n \"/api/prompts/{id}/versions\",\n {\n params: { path: { id } },\n },\n );\n if (error)\n this.handleApiError(`fetch versions for prompt with ID \"${id}\"`, error);\n\n return data;\n }\n\n /**\n * Upserts a prompt with local configuration - creates if doesn't exist, updates version if exists.\n * @param handle The prompt's handle/identifier.\n * @param config Local prompt configuration.\n * @returns Object with created flag and raw PromptResponse data.\n * @throws {PromptsApiError} If the API call fails.\n */\n async upsert(\n handle: string,\n config: {\n model: string;\n modelParameters?: {\n temperature?: number;\n max_tokens?: number;\n };\n messages: Array<{\n role: \"system\" | \"user\" | \"assistant\";\n content: string;\n }>;\n },\n ): Promise<{ created: boolean; prompt: PromptResponse }> {\n const payload = {\n handle,\n model: config.model,\n prompt: PromptConverter.extractSystemPrompt(config.messages),\n messages: PromptConverter.filterNonSystemMessages(config.messages),\n temperature: config.modelParameters?.temperature,\n maxTokens: config.modelParameters?.max_tokens,\n inputs: [{ identifier: \"input\", type: \"str\" as const }],\n outputs: [{ identifier: \"output\", type: \"str\" as const }],\n commitMessage: `Updated via CLI sync`,\n schemaVersion: \"1.0\" as const,\n };\n\n // Creating a prompt with the same handle will fail, so we try to update instead\n try {\n const prompt = await this.create(payload);\n return {\n created: true,\n prompt,\n };\n } catch {\n const prompt = await this.update(handle, payload);\n\n return {\n created: false,\n prompt,\n };\n }\n }\n\n /**\n * Sync a prompt with local content, handling conflicts and version management\n * You probably don't need to use this method directly.\n */\n async sync(params: {\n name: string;\n configData: ConfigData;\n localVersion?: number;\n commitMessage?: string;\n }): Promise<SyncResult> {\n try {\n const response = await this.apiClient.POST(\n \"/api/prompts/{id}/sync\",\n {\n params: { path: { id: params.name } },\n body: {\n configData: params.configData,\n localVersion: params.localVersion,\n commitMessage: params.commitMessage,\n },\n },\n );\n\n if (response.error) {\n const errorMessage =\n response.error?.error ?? JSON.stringify(response.error);\n throw new Error(`Failed to sync prompt: ${errorMessage}`);\n }\n\n return {\n action: response.data.action as SyncAction,\n prompt: response.data.prompt,\n conflictInfo: response.data.conflictInfo,\n };\n } catch (error) {\n const message =\n error instanceof Error ? error.message : \"Unknown error occurred\";\n throw new PromptsApiError(message, \"sync\", error);\n }\n }\n}\n","import { type z } from \"zod\";\nimport type { paths } from \"@/internal/generated/openapi/api-client\";\nimport {\n type corePromptDataSchema,\n type promptMetadataSchema,\n type promptDataSchema\n} from \"./schema\";\n\n/**\n * Type for template variables - supporting common data types\n */\nexport type TemplateVariables = Record<\n string,\n string | number | boolean | object | null\n>;\n\n/**\n * Core data needed for prompt functionality\n */\nexport type CorePromptData = z.infer<typeof corePromptDataSchema>;\n\n/**\n * Optional metadata for identification and tracing\n */\nexport type PromptMetadata = z.infer<typeof promptMetadataSchema>;\n\n/**\n * Combined type for creating prompts\n */\nexport type PromptData = z.infer<typeof promptDataSchema>;\n\n// Extract API types from OpenAPI schema for backwards compatibility\nexport type CreatePromptBody = NonNullable<\n paths[\"/api/prompts\"][\"post\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n\nexport type UpdatePromptBody = NonNullable<\n paths[\"/api/prompts/{id}\"][\"put\"][\"requestBody\"]\n>[\"content\"][\"application/json\"];\n\nexport type PromptResponse = NonNullable<\n paths[\"/api/prompts/{id}\"][\"get\"][\"responses\"][\"200\"][\"content\"][\"application/json\"]\n>;\n\n// Extract the PromptScope type from the API client\nexport type PromptScope = paths[\"/api/prompts\"][\"post\"][\"responses\"][\"200\"][\"content\"][\"application/json\"][\"scope\"];\n\n/**\n * Fetch policy for prompt retrieval.\n * Controls how prompts are fetched and cached.\n */\nexport enum FetchPolicy {\n /** Use local file if available, otherwise fetch from API (default) */\n MATERIALIZED_FIRST = \"MATERIALIZED_FIRST\",\n /** Always try API first, fall back to materialized */\n ALWAYS_FETCH = \"ALWAYS_FETCH\",\n /** Fetch every X minutes, use materialized between fetches */\n CACHE_TTL = \"CACHE_TTL\",\n /** Never fetch, use materialized files only */\n MATERIALIZED_ONLY = \"MATERIALIZED_ONLY\",\n}\n\n","import { Liquid } from \"liquidjs\";\nimport { PromptTracingDecorator, tracer } from \"./tracing\";\nimport { createTracingProxy } from \"@/client-sdk/tracing/create-tracing-proxy\";\nimport { promptDataSchema } from \"./schema\";\nimport { type TemplateVariables, type PromptData, type CorePromptData, type PromptScope } from \"./types\";\nimport { PromptCompilationError, PromptValidationError } from \"./errors\";\n\n// Re-export types and errors for convenience\nexport type { TemplateVariables, PromptData, CorePromptData, PromptMetadata } from \"./types\";\nexport { PromptCompilationError, PromptValidationError } from \"./errors\";\n\n// Global Liquid instance - shared across all prompts for efficiency\nconst liquid = new Liquid({\n strictFilters: true,\n});\n\n/**\n * The Prompt class provides a standardized interface for working with prompt objects\n * within the SDK, focusing on core functionality needed for template compilation and execution.\n * Keeps only essential fields while maintaining compatibility with tracing and observability.\n */\nexport class Prompt {\n // === Core functionality (required) ===\n public readonly model!: string;\n public readonly messages!: Array<{\n role: \"user\" | \"assistant\" | \"system\";\n content: string;\n }>;\n\n // === Optional core fields ===\n public readonly prompt?: string;\n public readonly temperature?: number;\n public readonly maxTokens?: number;\n public readonly responseFormat?: CorePromptData[\"responseFormat\"];\n\n // === Optional identification (for tracing) ===\n public readonly id?: string;\n public readonly handle?: string | null;\n public readonly version?: number;\n public readonly versionId?: string;\n public readonly scope?: PromptScope;\n\n constructor(data: PromptData) {\n // Validate input using Zod\n const validationResult = promptDataSchema.strip().safeParse(data);\n\n if (!validationResult.success) {\n throw new PromptValidationError(\n \"Invalid prompt data provided\",\n validationResult.error\n );\n }\n\n // Assign validated data\n Object.assign(this, validationResult.data);\n\n // Set default for prompt if not provided\n this.prompt ??= this.extractSystemPrompt();\n\n // Return a proxy that wraps specific methods for tracing\n return createTracingProxy(this as Prompt, tracer, PromptTracingDecorator);\n }\n\n private extractSystemPrompt(): string {\n return this.messages.find(m => m.role === \"system\")?.content ?? \"\";\n }\n\n /**\n * Compile the prompt template with provided variables (lenient - missing variables become empty)\n * @param variables - Object containing variable values for template compilation\n * @returns CompiledPrompt instance with compiled content\n */\n private _compile(\n variables: TemplateVariables,\n strict: boolean,\n ): CompiledPrompt {\n try {\n // Compile main prompt\n const compiledPrompt = this.prompt\n ? liquid.parseAndRenderSync(this.prompt, variables, {\n strictVariables: strict,\n })\n : \"\";\n\n // Compile messages\n const compiledMessages = (this.messages || []).map((message) => ({\n ...message,\n content: message.content\n ? liquid.parseAndRenderSync(message.content, variables, {\n strictVariables: strict,\n })\n : message.content,\n }));\n\n // Create new prompt data with compiled content\n const compiledData: PromptData = {\n ...this,\n prompt: compiledPrompt,\n messages: compiledMessages,\n };\n\n return new CompiledPrompt(compiledData, this);\n } catch (error) {\n const templateStr = this.prompt ?? JSON.stringify(this.messages);\n throw new PromptCompilationError(\n `Failed to compile prompt template: ${\n error instanceof Error ? error.message : \"Unknown error\"\n }`,\n templateStr,\n error,\n );\n }\n }\n\n compile(variables: TemplateVariables = {}): CompiledPrompt {\n return this._compile(variables, false);\n }\n\n /**\n * Compile with validation - throws error if required variables are missing\n * @param variables - Template variables\n * @returns CompiledPrompt instance with compiled content\n */\n compileStrict(variables: TemplateVariables): CompiledPrompt {\n return this._compile(variables, true);\n }\n}\n\n\n/**\n * Represents a compiled prompt that extends Prompt with reference to the original template\n */\nexport class CompiledPrompt extends Prompt {\n constructor(\n compiledData: PromptData,\n public readonly original: Prompt,\n ) {\n super(compiledData);\n }\n}\n","// TODO: Move these to their own files\nimport { z } from \"zod\";\nimport { PromptScope } from \"../constants\";\n\n/**\n * Zod schema for message objects in prompts\n */\nexport const messageSchema = z.object({\n role: z.enum([\"user\", \"assistant\", \"system\"]),\n content: z.string(),\n});\n\n/**\n * Zod schema for response format configuration\n */\nexport const responseFormatSchema = z.object({\n type: z.literal(\"json_schema\"),\n json_schema: z.object({\n name: z.string(),\n schema: z.record(z.string(), z.unknown()),\n }).nullable(),\n}).optional();\n\n/**\n * Zod schema for core prompt data - the essential fields needed for functionality\n */\nexport const corePromptDataSchema = z.object({\n model: z.string().min(1, \"Model cannot be empty\"),\n messages: z.array(messageSchema).min(1, \"At least one message is required\"),\n prompt: z.string().optional(),\n temperature: z.number().min(0).max(2).optional(),\n maxTokens: z.number().positive().optional(),\n responseFormat: responseFormatSchema,\n});\n\n/**\n * Zod schema for prompt metadata - optional fields for identification and tracing\n */\nexport const promptMetadataSchema = z.object({\n id: z.string().optional(),\n handle: z.string().nullable().optional(),\n version: z.number().min(0).optional(),\n versionId: z.string().optional(),\n scope: z.enum(PromptScope).optional(),\n});\n\n/**\n * Combined schema for complete prompt data\n */\nexport const promptDataSchema = z.object({\n ...corePromptDataSchema.shape,\n ...promptMetadataSchema.shape,\n});\n","import { type PromptScope as PromptScopeType } from \"./types\";\n\nexport const PromptScope = {\n ORGANIZATION: \"ORGANIZATION\" as const,\n PROJECT: \"PROJECT\" as const,\n} satisfies Record<string, PromptScopeType>;\n","import type { LocalPromptConfig, PromptDependency } from \"@/cli/types\";\nimport { FileManager } from \"@/cli/utils/fileManager\";\nimport { type Logger, NoOpLogger } from \"@/logger\";\nimport { type PromptData } from \"./types\";\nimport { PromptFileNotFoundError } from \"@/cli/utils/errors/prompt-not-found.error\";\n\nexport interface LocalPromptsServiceConfig {\n fileManager?: typeof FileManager;\n logger?: Logger;\n}\n\n/**\n * Service for retrieving prompts from local filesystem sources.\n *\n * Searches for prompts in the following priority order:\n * 1. Explicit file mapping in prompts.json config\n * 2. Materialized path from prompts-lock.json\n * 3. Direct file scanning in prompts directory\n */\nexport class LocalPromptsService {\n private readonly fileManager: typeof FileManager;\n private readonly logger: Logger;\n\n constructor(config?: LocalPromptsServiceConfig) {\n this.fileManager = config?.fileManager ?? FileManager;\n this.logger = config?.logger ?? new NoOpLogger();\n }\n\n /**\n * Retrieves a prompt using the configured search strategy.\n * Tries each source in priority order until found or all sources exhausted.\n */\n async get(handleOrId: string): Promise<PromptData | null> {\n try {\n const dependency = await this.getDependencyFromConfig(handleOrId);\n\n // If no dependency is found, it means it's not a local prompt\n if (!dependency) {\n return null;\n }\n\n // Try each source in priority order until found or all sources exhausted\n // We catch errors and return null if any of the sources fail so we\n // can continue to the next source and return null if all sources fail\n const localPromptConfig = (\n (await this.getFromConfig(dependency).catch((e) => {\n if (e instanceof PromptFileNotFoundError) return null;\n throw e;\n })) ??\n (await this.getFromLockFile(handleOrId).catch((e) => {\n if (e instanceof PromptFileNotFoundError) return null;\n throw e;\n })) ??\n (await this.getFromLocalFiles(handleOrId).catch((e) => {\n if (e instanceof PromptFileNotFoundError) return null;\n throw e;\n }))\n );\n\n return localPromptConfig ? this.convertToPromptData({\n ...localPromptConfig,\n handle: handleOrId,\n }) : null;\n } catch (error) {\n this.logger.warn(`Failed to get prompt \"${handleOrId}\": ${error instanceof Error ? error.message : String(error)}`);\n return null;\n }\n }\n\n\n /**\n * Searches for prompt using explicit file mapping in prompts.json.\n * Looks for dependencies with a 'file' property pointing to a specific path.\n */\n private async getFromConfig(dependency: PromptDependency): Promise<LocalPromptConfig | null> {\n if (typeof dependency === 'string' && dependency.startsWith('file:')) {\n return this.fileManager.loadLocalPrompt(dependency.slice(5));\n }\n\n return null;\n }\n\n /**\n * Searches for prompt using materialized path from lock file.\n * Lock file contains resolved paths for prompts that have been synced/materialized.\n */\n private async getFromLockFile(handleOrId: string): Promise<LocalPromptConfig | null> {\n const lock = this.fileManager.loadPromptsLock();\n const lockEntry = lock.prompts[handleOrId];\n\n if (lockEntry?.materialized) {\n return this.fileManager.loadLocalPrompt(lockEntry.materialized);\n }\n\n return null;\n }\n\n /**\n * Searches for prompt by scanning all .prompt.yaml files in prompts directory.\n * Extracts prompt name from file path and matches against the requested handle.\n * This is the fallback method when explicit mappings don't exist.\n */\n private async getFromLocalFiles(handleOrId: string): Promise<LocalPromptConfig | null> {\n const localFiles = this.fileManager.getLocalPromptFiles();\n\n for (const filePath of localFiles) {\n const promptName = this.fileManager.promptNameFromPath(filePath);\n if (promptName === handleOrId) {\n return this.fileManager.loadLocalPrompt(filePath);\n }\n }\n\n return null;\n }\n\n /**\n * Get dependency from config\n */\n private async getDependencyFromConfig(handleOrId: string): Promise<PromptDependency | null> {\n const config = this.fileManager.loadPromptsConfig();\n const dependency = config.prompts[handleOrId];\n\n return dependency ?? null;\n }\n\n /**\n * Converts LocalPromptConfig to PromptData format\n */\n private convertToPromptData(config: LocalPromptConfig & { handle: string; }): PromptData {\n const { modelParameters, ...rest } = config;\n return {\n maxTokens: modelParameters?.max_tokens,\n temperature: modelParameters?.temperature,\n ...rest,\n };\n }\n}\n","import { PromptsApiService, type SyncResult } from \"./prompts-api.service\";\nimport { Prompt } from \"./prompt\";\nimport type { CreatePromptBody, UpdatePromptBody, PromptData } from \"./types\";\nimport { FetchPolicy } from \"./types\";\nimport { type InternalConfig } from \"@/client-sdk/types\";\nimport { LocalPromptsService } from \"./local-prompts.service\";\n\n/**\n * Options for fetching a prompt.\n */\nexport interface GetPromptOptions {\n /** Specific version to fetch */\n version?: string;\n /** Fetch policy to use */\n fetchPolicy?: FetchPolicy;\n /** Cache TTL in minutes (only used with CACHE_TTL policy) */\n cacheTtlMinutes?: number;\n}\n\ninterface CacheEntry {\n data: PromptData;\n timestamp: number;\n}\n\ninterface PromptsFacadeDependencies {\n promptsApiService: PromptsApiService;\n localPromptsService: LocalPromptsService;\n}\n\n/**\n * Facade for prompt operations in the LangWatch SDK.\n * Provides a simplified interface for common prompt management tasks.\n */\nexport class PromptsFacade implements Pick<PromptsApiService, \"sync\" | \"delete\">{\n private readonly promptsApiService: PromptsApiService;\n private readonly localPromptsService: LocalPromptsService;\n private readonly cache = new Map<string, CacheEntry>();\n\n constructor(config: InternalConfig & PromptsFacadeDependencies) {\n this.promptsApiService = config.promptsApiService ?? new PromptsApiService(config);\n this.localPromptsService = config.localPromptsService ?? new LocalPromptsService();\n }\n\n /**\n * Creates a new prompt.\n * @param data The prompt creation payload.\n * @returns The created Prompt instance.\n * @throws {PromptsError} If the API call fails.\n */\n async create(data: CreatePromptBody): Promise<Prompt> {\n const serverPrompt = await this.promptsApiService.create(data);\n return new Prompt(serverPrompt);\n }\n\n /**\n * Retrieves a prompt by handle or ID.\n * @param handleOrId The prompt's handle or unique identifier.\n * @param options Optional parameters for the request.\n * @returns The Prompt instance.\n * @throws {PromptsError} If the prompt is not found or the API call fails.\n */\n async get(\n handleOrId: string,\n options?: GetPromptOptions,\n ): Promise<Prompt> {\n const fetchPolicy = options?.fetchPolicy ?? FetchPolicy.MATERIALIZED_FIRST;\n\n switch (fetchPolicy) {\n case FetchPolicy.MATERIALIZED_ONLY:\n return this.getMaterializedOnly(handleOrId);\n\n case FetchPolicy.ALWAYS_FETCH:\n return this.getAlwaysFetch(handleOrId, options);\n\n case FetchPolicy.CACHE_TTL:\n return this.getCacheTtl(handleOrId, options);\n\n case FetchPolicy.MATERIALIZED_FIRST:\n default:\n return this.getMaterializedFirst(handleOrId, options);\n }\n }\n\n private async getMaterializedFirst(\n handleOrId: string,\n options?: GetPromptOptions,\n ): Promise<Prompt> {\n const localPrompt = await this.localPromptsService.get(handleOrId);\n if (localPrompt) {\n return new Prompt(localPrompt);\n }\n const serverPrompt = await this.promptsApiService.get(handleOrId, options);\n return new Prompt(serverPrompt);\n }\n\n private async getAlwaysFetch(\n handleOrId: string,\n options?: GetPromptOptions,\n ): Promise<Prompt> {\n try {\n const serverPrompt = await this.promptsApiService.get(handleOrId, options);\n return new Prompt(serverPrompt);\n } catch {\n const localPrompt = await this.localPromptsService.get(handleOrId);\n if (localPrompt) {\n return new Prompt(localPrompt);\n }\n throw new Error(`Prompt \"${handleOrId}\" not found locally or on server`);\n }\n }\n\n private async getMaterializedOnly(handleOrId: string): Promise<Prompt> {\n const localPrompt = await this.localPromptsService.get(handleOrId);\n if (localPrompt) {\n return new Prompt(localPrompt);\n }\n throw new Error(`Prompt \"${handleOrId}\" not found in materialized files`);\n }\n\n /**\n * Builds a cache key that includes both handle and version to prevent collisions.\n */\n private buildCacheKey(handleOrId: string, options?: GetPromptOptions): string {\n return `${handleOrId}::version:${options?.version ?? ''}`;\n }\n\n private async getCacheTtl(\n handleOrId: string,\n options?: GetPromptOptions,\n ): Promise<Prompt> {\n const cacheKey = this.buildCacheKey(handleOrId, options);\n const ttlMs = (options?.cacheTtlMinutes ?? 5) * 60 * 1000;\n const cached = this.cache.get(cacheKey);\n const now = Date.now();\n\n if (cached && now - cached.timestamp < ttlMs) {\n return new Prompt(cached.data);\n }\n\n try {\n const serverPrompt = await this.promptsApiService.get(handleOrId, options);\n this.cache.set(cacheKey, { data: serverPrompt, timestamp: now });\n return new Prompt(serverPrompt);\n } catch {\n const localPrompt = await this.localPromptsService.get(handleOrId);\n if (localPrompt) {\n return new Prompt(localPrompt);\n }\n throw new Error(`Prompt \"${handleOrId}\" not found locally or on server`);\n }\n }\n\n /**\n * Retrieves all prompts.\n * @returns Array of Prompt instances.\n * @throws {PromptsError} If the API call fails.\n */\n async getAll(): Promise<Prompt[]> {\n const serverPrompts = await this.promptsApiService.getAll();\n return serverPrompts.map((prompt) => new Prompt(prompt));\n }\n\n /**\n * Updates an existing prompt.\n * @param handleOrId The prompt's handle or unique identifier.\n * @param newData The update payload.\n * @returns The updated Prompt instance.\n * @throws {PromptsError} If the API call fails.\n */\n async update(handleOrId: string, newData: UpdatePromptBody): Promise<Prompt> {\n const serverPrompt = await this.promptsApiService.update(handleOrId, newData);\n return new Prompt(serverPrompt);\n }\n\n get delete() {\n return this.promptsApiService.delete.bind(this.promptsApiService);\n }\n\n /**\n * Delegated method to the prompts API service.\n */\n get sync() {\n return this.promptsApiService.sync.bind(this.promptsApiService);\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cli/commands/login.ts"],"sourcesContent":["import * as fs from \"fs\";\nimport * as path from \"path\";\nimport chalk from \"chalk\";\nimport ora from \"ora\";\nimport prompts from \"prompts\";\nimport { DEFAULT_ENDPOINT } from \"@/internal/constants\";\n\nconst getEndpoint = (): string => {\n return process.env.LANGWATCH_ENDPOINT ?? DEFAULT_ENDPOINT;\n};\n\nconst updateEnvFile = (\n apiKey: string,\n): { created: boolean; updated: boolean; path: string } => {\n const envPath = path.join(process.cwd(), \".env\");\n\n // Check if .env exists\n if (!fs.existsSync(envPath)) {\n // Create new .env file\n fs.writeFileSync(envPath, `LANGWATCH_API_KEY=${apiKey}\\n`);\n return { created: true, updated: false, path: envPath };\n }\n\n // Read existing .env file\n const content = fs.readFileSync(envPath, \"utf-8\");\n const lines = content.split(\"\\n\");\n\n // Check if LANGWATCH_API_KEY already exists and update it\n let found = false;\n const updatedLines = lines.map((line) => {\n if (line.startsWith(\"LANGWATCH_API_KEY=\")) {\n found = true;\n return `LANGWATCH_API_KEY=${apiKey}`;\n }\n return line;\n });\n\n if (!found) {\n // Add to end of file\n if (content.endsWith(\"\\n\") || content === \"\") {\n updatedLines.push(`LANGWATCH_API_KEY=${apiKey}`);\n } else {\n updatedLines.push(\"\", `LANGWATCH_API_KEY=${apiKey}`);\n }\n }\n\n fs.writeFileSync(envPath, updatedLines.join(\"\\n\"));\n return { created: false, updated: found, path: envPath };\n};\n\nexport const loginCommand = async (): Promise<void> => {\n try {\n console.log(chalk.blue(\"🔐 LangWatch Login\"));\n console.log(\n chalk.gray(\n \"This will open your browser to get an API key from LangWatch.\",\n ),\n );\n console.log();\n\n // Get the authorization URL\n const endpoint = getEndpoint();\n const authUrl = `${endpoint}/authorize`;\n\n console.log(chalk.cyan(`Opening: ${authUrl}`));\n\n // Open browser\n const spinner = ora(\"Opening browser...\").start();\n\n try {\n const open = (await import(\"open\")).default;\n await open(authUrl);\n spinner.succeed(\"Browser opened\");\n } catch (error) {\n spinner.fail(\"Failed to open browser\");\n console.log(chalk.yellow(`Please manually open: ${chalk.cyan(authUrl)}`));\n }\n\n console.log();\n console.log(chalk.gray(\"1. Log in to LangWatch in your browser\"));\n console.log(chalk.gray(\"2. Copy your API key\"));\n console.log(chalk.gray(\"3. Come back here and paste it\"));\n console.log();\n\n // Wait for user input using prompts library\n const response = await prompts({\n type: \"password\",\n name: \"apiKey\",\n message: \"Paste your API key here:\",\n validate: (value: string) => {\n if (!value || value.trim() === \"\") {\n return \"API key is required\";\n }\n if (value.length < 10) {\n return \"API key seems too short. Please check and try again.\";\n }\n return true;\n },\n });\n\n if (!response.apiKey) {\n console.log(chalk.yellow(\"Login cancelled\"));\n process.exit(0);\n }\n\n const apiKey = response.apiKey.trim();\n\n // Save to .env file\n const envResult = updateEnvFile(apiKey);\n\n console.log();\n console.log(chalk.green(\"✓ API key saved successfully!\"));\n\n if (envResult.created) {\n console.log(chalk.gray(`• Created .env file with your API key`));\n } else if (envResult.updated) {\n console.log(chalk.gray(`• Updated existing API key in .env file`));\n } else {\n console.log(chalk.gray(`• Added API key to existing .env file`));\n }\n\n console.log();\n console.log(chalk.green(\"🎉 You're all set! You can now use:\"));\n console.log(chalk.cyan(\" langwatch prompt add <name>\"));\n console.log(chalk.cyan(\" langwatch prompt sync\"));\n } catch (error) {\n console.error(\n chalk.red(\n `Error during login: ${\n error instanceof Error ? error.message : \"Unknown error\"\n }`,\n ),\n );\n process.exit(1);\n }\n};\n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4CAAuC,CAAC;AAAA,IACjE;AAEA,YAAQ,IAAI;AACZ,YAAQ,IAAI,MAAM,MAAM,4CAAqC,CAAC;AAC9D,YAAQ,IAAI,MAAM,KAAK,+BAA+B,CAAC;AACvD,YAAQ,IAAI,MAAM,KAAK,yBAAyB,CAAC;AAAA,EACnD,SAAS,OAAO;AACd,YAAQ;AAAA,MACN,MAAM;AAAA,QACJ,uBACE,iBAAiB,QAAQ,MAAM,UAAU,eAC3C;AAAA,MACF;AAAA,IACF;AACA,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/langwatch/langwatch/typescript-sdk/dist/sync-BE7XZC2A.js","../src/cli/commands/sync.ts"],"names":[],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B;AACE;AACA;AACF,sDAA4B;AAC5B,+BAA4B;AAC5B,+BAA4B;AAC5B,+BAA4B;AAC5B,+BAA4B;AAC5B,+BAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACE;AACA;AACF,sDAA4B;AAC5B,+BAA4B;AAC5B;AACE;AACA;AACF,sDAA4B;AAC5B;AACA;ACzBA,+DAAoB;AACpB,uEAAsB;AACtB,4EAAkB;AAClB,oEAAgB;AAChB,8EAAsB;AAYtB,wFAAqB;AAGrB,IAAM,eAAA,EAAiB,MAAA,CACrB,UAAA,EACA,YAAA,EAAA,GAM0C;AAC1C,EAAA,OAAA,CAAQ,GAAA;AAAA,IACN,eAAA,CAAM,MAAA,CAAO,CAAA;AAAA,qCAAA,EAAqC,eAAA,CAAM,IAAA,CAAK,UAAU,CAAC,CAAA,CAAA;AAC1E,EAAA;AACQ,EAAA;AACA,IAAA;AACuC,MAAA;AAC7C,IAAA;AACF,EAAA;AAEyC,EAAA;AACG,IAAA;AACC,IAAA;AACJ,MAAA;AACtC,IAAA;AACH,EAAA;AAEsC,EAAA;AACkB,EAAA;AACA,EAAA;AACV,EAAA;AAE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A;AACM,MAAA;AACzB,QAAA;AACA,UAAA;AACyB,YAAA;AAC/B,UAAA;AACF,QAAA;AACF,MAAA;AACF,IAAA;AAG8B,IAAA;AACiB,MAAA;AACM,QAAA;AACnD,MAAA;AACF,IAAA;AAG2D,IAAA;AAE1B,IAAA;AAEqB,IAAA;AACR,MAAA;AACvC,IAAA;AACY,MAAA;AACW,MAAA;AACqB,QAAA;AACtB,MAAA;AACoB,QAAA;AACnB,MAAA;AACqB,QAAA;AACtB,MAAA;AACoB,QAAA;AAEI,MAAA;AACrD,IAAA;AAE8B,IAAA;AACd,MAAA;AAChB,IAAA;AACc,EAAA;AACqB,IAAA;AACiB,MAAA;AAC7C,IAAA;AACG,MAAA;AACA,QAAA;AAE6B,UAAA;AAEnC,QAAA;AACF,MAAA;AACF,IAAA;AACc,IAAA;AAChB,EAAA;AACF;AD/G8D;AACA;AACA","file":"/home/runner/work/langwatch/langwatch/typescript-sdk/dist/sync-BE7XZC2A.js","sourcesContent":[null,"import * as fs from \"fs\";\nimport * as path from \"path\";\nimport chalk from \"chalk\";\nimport ora from \"ora\";\nimport * as yaml from \"js-yaml\";\nimport { PromptConverter } from \"@/cli/utils/promptConverter\";\nimport {\n type ConfigData,\n PromptsApiService,\n PromptsError,\n type SyncAction,\n} from \"@/client-sdk/services/prompts\";\nimport type { SyncResult } from \"../types\";\nimport { FileManager } from \"../utils/fileManager\";\nimport { ensureProjectInitialized } from \"../utils/init\";\nimport { checkApiKey } from \"../utils/apiKey\";\nimport readline from \"node:readline\";\n\n// Handle conflict resolution - show diff and ask user to choose\nconst handleConflict = async (\n promptName: string,\n conflictInfo: {\n localVersion: number;\n remoteVersion: number;\n differences: string[];\n remoteConfigData: any;\n }\n): Promise<\"local\" | \"remote\" | \"abort\"> => {\n console.log(\n chalk.yellow(`\\n⚠ Conflict detected for prompt: ${chalk.cyan(promptName)}`)\n );\n console.log(\n chalk.gray(\n `Local version: ${conflictInfo.localVersion}, Remote version: ${conflictInfo.remoteVersion}`\n )\n );\n\n if (conflictInfo.differences.length > 0) {\n console.log(chalk.yellow(\"\\nDifferences:\"));\n conflictInfo.differences.forEach((diff) => {\n console.log(chalk.gray(` • ${diff}`));\n });\n }\n\n console.log(chalk.yellow(\"\\nOptions:\"));\n console.log(\" [l] Use local version (overwrite remote)\");\n console.log(\" [r] Use remote version (overwrite local)\");\n console.log(\" [a] Abort sync for this prompt\");\n\n const rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n });\n\n return new Promise((resolve) => {\n rl.question(\"Choose resolution (l/r/a): \", (answer: string) => {\n rl.close();\n const choice = answer.toLowerCase();\n if (choice === \"l\" || choice === \"local\") {\n resolve(\"local\");\n } else if (choice === \"r\" || choice === \"remote\") {\n resolve(\"remote\");\n } else {\n resolve(\"abort\");\n }\n });\n });\n};\n\nexport const syncCommand = async (): Promise<void> => {\n console.log(\"🔄 Starting sync...\");\n\n const startTime = Date.now();\n\n try {\n // Check API key before doing anything else\n checkApiKey();\n\n // Get prompts API service\n const promptsApiService = new PromptsApiService();\n\n // Ensure project is initialized (prompts.json, lock file, directories)\n await ensureProjectInitialized(false); // Don't prompt for .gitignore in sync\n\n // Load prompts config and lock\n const config = FileManager.loadPromptsConfig();\n const lock = FileManager.loadPromptsLock();\n\n const result: SyncResult = {\n fetched: [],\n pushed: [],\n unchanged: [],\n cleaned: [],\n errors: [],\n };\n\n // Process remote prompts (fetch and materialize)\n const remoteDeps = Object.entries(config.prompts).filter(\n ([, dependency]) => {\n // Skip local file dependencies (both object format and string format)\n if (typeof dependency === \"object\" && dependency.file) {\n return false;\n }\n if (typeof dependency === \"string\" && dependency.startsWith(\"file:\")) {\n return false;\n }\n return true;\n }\n );\n\n if (remoteDeps.length > 0) {\n const fetchSpinner = ora(\n `Checking ${remoteDeps.length} remote prompts...`\n ).start();\n\n for (const [name, dependency] of remoteDeps) {\n try {\n const versionSpec =\n typeof dependency === \"string\"\n ? dependency\n : dependency.version ?? \"latest\";\n\n // Check if we already have this prompt with the same version\n const lockEntry = lock.prompts[name];\n\n // Fetch the prompt from the API to check current version\n const prompt = await promptsApiService.get(name);\n\n if (prompt) {\n // Check if we need to update (new version or not materialized)\n const needsUpdate =\n !lockEntry ||\n lockEntry.version !== prompt.version ||\n !lockEntry.materialized ||\n !fs.existsSync(path.resolve(lockEntry.materialized));\n\n if (needsUpdate) {\n // Convert to MaterializedPrompt format using the converter\n const materializedPrompt =\n PromptConverter.fromApiToMaterialized(prompt);\n\n const savedPath = FileManager.saveMaterializedPrompt(\n name,\n materializedPrompt\n );\n const relativePath = path.relative(process.cwd(), savedPath);\n result.fetched.push({\n name,\n version: prompt.version,\n versionSpec,\n });\n\n // Update lock file entry\n FileManager.updateLockEntry(\n lock,\n name,\n materializedPrompt,\n savedPath\n );\n\n fetchSpinner.text = `Fetched ${chalk.cyan(\n `${name}@${versionSpec}`\n )} ${chalk.gray(`(version ${prompt.version})`)} → ${chalk.gray(\n relativePath\n )}`;\n } else {\n // No change needed, track as unchanged\n result.unchanged.push(name);\n }\n } else {\n result.errors.push({ name, error: \"Prompt not found\" });\n }\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : \"Unknown error\";\n result.errors.push({ name, error: errorMessage });\n }\n }\n\n fetchSpinner.stop();\n }\n\n // Process local prompts (push to API) - only those explicitly declared in prompts.json\n const localFileRefs = Object.entries(config.prompts).filter(\n ([, dependency]) => {\n return typeof dependency === \"string\" && dependency.startsWith(\"file:\");\n }\n );\n\n if (localFileRefs.length > 0) {\n const pushSpinner = ora(\n `Pushing ${localFileRefs.length} local prompts...`\n ).start();\n\n // Use the existing lock file instead of reloading it\n // const lock = FileManager.loadPromptsLock(); // Don't reload - use existing lock\n\n for (const [promptName, dependency] of localFileRefs) {\n try {\n const filePath = (dependency as string).slice(5); // Remove \"file:\" prefix\n\n // Load local prompt config\n const localConfig = FileManager.loadLocalPrompt(filePath);\n\n // Get current version from lock file\n const currentVersion = lock.prompts[promptName]?.version;\n\n // Convert local config to API configData format\n const configData: ConfigData = {\n model: localConfig.model,\n prompt: PromptConverter.extractSystemPrompt(localConfig.messages),\n messages: PromptConverter.filterNonSystemMessages(\n localConfig.messages\n ) as Array<{\n role: \"system\" | \"user\" | \"assistant\";\n content: string;\n }>,\n temperature: localConfig.modelParameters?.temperature,\n max_tokens: localConfig.modelParameters?.max_tokens,\n inputs: [{ identifier: \"input\", type: \"str\" }],\n outputs: [{ identifier: \"output\", type: \"str\" }],\n };\n\n // Use new sync API with conflict detection\n const syncResult = await promptsApiService.sync({\n name: promptName,\n configData,\n localVersion: currentVersion,\n commitMessage: `Synced from local file: ${path.basename(filePath)}`,\n });\n\n const relativePath = path.relative(process.cwd(), filePath);\n\n let conflictResolution: \"local\" | \"remote\" | \"abort\" | null = null;\n if (syncResult.action === \"conflict\") {\n // Handle conflict - prompt user for resolution\n pushSpinner.stop();\n conflictResolution = await handleConflict(\n promptName,\n syncResult.conflictInfo!\n );\n if (conflictResolution === \"abort\") {\n result.errors.push({\n name: promptName,\n error: \"Sync aborted due to conflict\",\n });\n continue;\n }\n\n // If user chose remote, we should pull the remote version to local file\n if (conflictResolution === \"remote\" && syncResult.conflictInfo) {\n // Update local file with remote content\n const remoteConfig = {\n model: syncResult.conflictInfo.remoteConfigData.model,\n modelParameters: {\n temperature:\n syncResult.conflictInfo.remoteConfigData.temperature,\n max_tokens:\n syncResult.conflictInfo.remoteConfigData.max_tokens,\n },\n messages: [\n {\n role: \"system\" as const,\n content: syncResult.conflictInfo.remoteConfigData.prompt,\n },\n ...(syncResult.conflictInfo.remoteConfigData.messages ?? []),\n ],\n };\n\n const yamlContent = yaml.dump(remoteConfig, {\n lineWidth: -1,\n noRefs: true,\n sortKeys: false,\n });\n\n fs.writeFileSync(filePath, yamlContent);\n }\n\n // If user chose to proceed, we continue with the sync\n pushSpinner.start();\n }\n\n // Update lock file with new version info\n if (syncResult.prompt) {\n lock.prompts[promptName] = {\n version: syncResult.prompt.version,\n versionId: syncResult.prompt.versionId,\n materialized: filePath,\n };\n } else if (syncResult.action === \"conflict\") {\n const remoteVersion = syncResult.conflictInfo?.remoteVersion ?? 0;\n if (conflictResolution === \"remote\") {\n // User chose remote - use remote version\n lock.prompts[promptName] = {\n version: remoteVersion,\n versionId: \"remote_version\", // We don't have the actual versionId from conflict info\n materialized: filePath,\n };\n } else {\n // User chose local - force push\n const formattedConfig = PromptConverter.fromLocalToApiFormat(localConfig);\n const updatedPrompt = await promptsApiService.update(promptName, {\n ...formattedConfig,\n commitMessage: `Updated via CLI: synced from local file`\n });\n lock.prompts[promptName] = {\n version: updatedPrompt.version,\n versionId: updatedPrompt.versionId,\n materialized: filePath,\n };\n }\n }\n\n // Determine the action text based on sync result and conflict resolution\n let actionText: string;\n if (syncResult.action === \"conflict\") {\n if (conflictResolution === \"remote\") {\n actionText = \"Pulled\"; // User chose to use remote version\n result.fetched.push({\n name: promptName,\n version: syncResult.conflictInfo?.remoteVersion ?? 0,\n versionSpec: \"latest\", // Default for conflict resolution\n });\n } else {\n actionText = \"Pushed\"; // User chose to use local version (or forced push)\n result.pushed.push({\n name: promptName,\n version: (syncResult.conflictInfo?.remoteVersion ?? 0) + 1, // New version after push\n });\n }\n } else if (syncResult.action === \"up_to_date\") {\n // For up-to-date prompts, add to unchanged instead of pushed\n actionText = \"Up-to-date\";\n result.unchanged.push(promptName);\n } else {\n const actionMap: Record<SyncAction, string> = {\n created: \"Created\",\n updated: \"Updated\",\n conflict: \"Conflict resolved\",\n up_to_date: \"Up to date\",\n };\n actionText = actionMap[syncResult.action as SyncAction] || \"Pushed\";\n result.pushed.push({\n name: promptName,\n version: syncResult.prompt?.version ?? 0,\n });\n }\n\n pushSpinner.text = `${actionText} ${chalk.cyan(\n promptName\n )} ${chalk.gray(\n `(version ${\n syncResult.prompt?.version ??\n syncResult.conflictInfo?.remoteVersion ??\n \"unknown\"\n })`\n )} ${conflictResolution === \"remote\" ? \"to\" : \"from\"} ${chalk.gray(\n relativePath\n )}`;\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : \"Unknown error\";\n result.errors.push({ name: promptName, error: errorMessage });\n }\n }\n\n // Save lock file with all updates\n FileManager.savePromptsLock(lock);\n\n pushSpinner.stop();\n }\n\n // Check for orphan local prompt files and show helpful warnings\n const discoveredLocalFiles = FileManager.getLocalPromptFiles();\n const orphanFiles = discoveredLocalFiles.filter((filePath) => {\n const promptName = FileManager.promptNameFromPath(filePath);\n return !config.prompts[promptName]; // Not declared in prompts.json\n });\n\n if (orphanFiles.length > 0) {\n console.log(\n chalk.yellow(\n `\\n⚠ Found ${orphanFiles.length} orphan prompt file${\n orphanFiles.length > 1 ? \"s\" : \"\"\n }:`\n )\n );\n\n for (const filePath of orphanFiles) {\n const promptName = FileManager.promptNameFromPath(filePath);\n const relativePath = path.relative(process.cwd(), filePath);\n\n console.log(chalk.yellow(` ${relativePath}`));\n console.log(\n chalk.gray(\n ` Add to prompts.json: \"${promptName}\": \"file:${relativePath}\"`\n )\n );\n }\n\n console.log(\n chalk.gray(\n `\\nTip: Add these to prompts.json to include them in sync operations.`\n )\n );\n }\n\n // Cleanup orphaned materialized files\n const currentDependencies = new Set(\n Object.keys(config.prompts).filter((name) => {\n const dependency = config.prompts[name];\n // Only include remote dependencies (not local file: dependencies)\n if (typeof dependency === \"object\" && dependency.file) {\n return false;\n }\n if (typeof dependency === \"string\" && dependency.startsWith(\"file:\")) {\n return false;\n }\n return true;\n })\n );\n\n const cleanedFiles =\n FileManager.cleanupOrphanedMaterializedFiles(currentDependencies);\n if (cleanedFiles.length > 0) {\n result.cleaned = cleanedFiles;\n FileManager.removeFromLock(lock, cleanedFiles);\n }\n\n // Save the updated lock file\n FileManager.savePromptsLock(lock);\n\n // Print individual results if there were actions\n if (result.fetched.length > 0) {\n for (const { name, version, versionSpec } of result.fetched) {\n // Get the actual saved path from lock file for display consistency\n const lockEntry = lock.prompts[name];\n const displayPath = lockEntry?.materialized\n ? `./${lockEntry.materialized}`\n : `./prompts/.materialized/${name}.prompt.yaml`;\n\n console.log(\n chalk.green(\n `✓ Pulled ${chalk.cyan(`${name}@${versionSpec}`)} ${chalk.gray(\n `(version ${version})`\n )} → ${chalk.gray(displayPath)}`\n )\n );\n }\n }\n\n if (result.pushed.length > 0) {\n for (const { name, version } of result.pushed) {\n const localPath = `./prompts/${name}.prompt.yaml`;\n console.log(\n chalk.green(\n `✓ Pushed ${chalk.cyan(name)} ${chalk.gray(\n `(version ${version})`\n )} from ${chalk.gray(localPath)}`\n )\n );\n }\n }\n\n // Print cleaned up files\n if (result.cleaned.length > 0) {\n for (const name of result.cleaned) {\n console.log(\n chalk.yellow(\n `✓ Cleaned ${chalk.cyan(name)} (no longer in dependencies)`\n )\n );\n }\n }\n\n // Print errors\n if (result.errors.length > 0) {\n for (const { name, error } of result.errors) {\n console.log(chalk.red(`✗ Failed ${chalk.cyan(name)}: ${error}`));\n }\n }\n\n // Print summary\n const duration = ((Date.now() - startTime) / 1000).toFixed(1);\n const totalActions =\n result.fetched.length + result.pushed.length + result.cleaned.length;\n\n if (totalActions === 0 && result.errors.length === 0) {\n console.log(chalk.gray(`Synced in ${duration}s, no changes`));\n } else {\n const summary = [];\n if (result.fetched.length > 0)\n summary.push(`${result.fetched.length} fetched`);\n if (result.pushed.length > 0)\n summary.push(`${result.pushed.length} pushed`);\n if (result.cleaned.length > 0)\n summary.push(`${result.cleaned.length} cleaned`);\n if (result.errors.length > 0)\n summary.push(`${result.errors.length} errors`);\n\n console.log(chalk.gray(`Synced ${summary.join(\", \")} in ${duration}s`));\n }\n\n if (result.errors.length > 0) {\n process.exit(1);\n }\n } catch (error) {\n if (error instanceof PromptsError) {\n console.error(chalk.red(`Error: ${error.message}`));\n } else {\n console.error(\n chalk.red(\n `Unexpected error: ${\n error instanceof Error ? error.message : \"Unknown error\"\n }`\n )\n );\n }\n process.exit(1);\n }\n};\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cli/commands/sync.ts"],"sourcesContent":["import * as fs from \"fs\";\nimport * as path from \"path\";\nimport chalk from \"chalk\";\nimport ora from \"ora\";\nimport * as yaml from \"js-yaml\";\nimport { PromptConverter } from \"@/cli/utils/promptConverter\";\nimport {\n type ConfigData,\n PromptsApiService,\n PromptsError,\n type SyncAction,\n} from \"@/client-sdk/services/prompts\";\nimport type { SyncResult } from \"../types\";\nimport { FileManager } from \"../utils/fileManager\";\nimport { ensureProjectInitialized } from \"../utils/init\";\nimport { checkApiKey } from \"../utils/apiKey\";\nimport readline from \"node:readline\";\n\n// Handle conflict resolution - show diff and ask user to choose\nconst handleConflict = async (\n promptName: string,\n conflictInfo: {\n localVersion: number;\n remoteVersion: number;\n differences: string[];\n remoteConfigData: any;\n }\n): Promise<\"local\" | \"remote\" | \"abort\"> => {\n console.log(\n chalk.yellow(`\\n⚠ Conflict detected for prompt: ${chalk.cyan(promptName)}`)\n );\n console.log(\n chalk.gray(\n `Local version: ${conflictInfo.localVersion}, Remote version: ${conflictInfo.remoteVersion}`\n )\n );\n\n if (conflictInfo.differences.length > 0) {\n console.log(chalk.yellow(\"\\nDifferences:\"));\n conflictInfo.differences.forEach((diff) => {\n console.log(chalk.gray(` • ${diff}`));\n });\n }\n\n console.log(chalk.yellow(\"\\nOptions:\"));\n console.log(\" [l] Use local version (overwrite remote)\");\n console.log(\" [r] Use remote version (overwrite local)\");\n console.log(\" [a] Abort sync for this prompt\");\n\n const rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n });\n\n return new Promise((resolve) => {\n rl.question(\"Choose resolution (l/r/a): \", (answer: string) => {\n rl.close();\n const choice = answer.toLowerCase();\n if (choice === \"l\" || choice === \"local\") {\n resolve(\"local\");\n } else if (choice === \"r\" || choice === \"remote\") {\n resolve(\"remote\");\n } else {\n resolve(\"abort\");\n }\n });\n });\n};\n\nexport const syncCommand = async (): Promise<void> => {\n console.log(\"🔄 Starting sync...\");\n\n const startTime = Date.now();\n\n try {\n // Check API key before doing anything else\n checkApiKey();\n\n // Get prompts API service\n const promptsApiService = new PromptsApiService();\n\n // Ensure project is initialized (prompts.json, lock file, directories)\n await ensureProjectInitialized(false); // Don't prompt for .gitignore in sync\n\n // Load prompts config and lock\n const config = FileManager.loadPromptsConfig();\n const lock = FileManager.loadPromptsLock();\n\n const result: SyncResult = {\n fetched: [],\n pushed: [],\n unchanged: [],\n cleaned: [],\n errors: [],\n };\n\n // Process remote prompts (fetch and materialize)\n const remoteDeps = Object.entries(config.prompts).filter(\n ([, dependency]) => {\n // Skip local file dependencies (both object format and string format)\n if (typeof dependency === \"object\" && dependency.file) {\n return false;\n }\n if (typeof dependency === \"string\" && dependency.startsWith(\"file:\")) {\n return false;\n }\n return true;\n }\n );\n\n if (remoteDeps.length > 0) {\n const fetchSpinner = ora(\n `Checking ${remoteDeps.length} remote prompts...`\n ).start();\n\n for (const [name, dependency] of remoteDeps) {\n try {\n const versionSpec =\n typeof dependency === \"string\"\n ? dependency\n : dependency.version ?? \"latest\";\n\n // Check if we already have this prompt with the same version\n const lockEntry = lock.prompts[name];\n\n // Fetch the prompt from the API to check current version\n const prompt = await promptsApiService.get(name);\n\n if (prompt) {\n // Check if we need to update (new version or not materialized)\n const needsUpdate =\n !lockEntry ||\n lockEntry.version !== prompt.version ||\n !lockEntry.materialized ||\n !fs.existsSync(path.resolve(lockEntry.materialized));\n\n if (needsUpdate) {\n // Convert to MaterializedPrompt format using the converter\n const materializedPrompt =\n PromptConverter.fromApiToMaterialized(prompt);\n\n const savedPath = FileManager.saveMaterializedPrompt(\n name,\n materializedPrompt\n );\n const relativePath = path.relative(process.cwd(), savedPath);\n result.fetched.push({\n name,\n version: prompt.version,\n versionSpec,\n });\n\n // Update lock file entry\n FileManager.updateLockEntry(\n lock,\n name,\n materializedPrompt,\n savedPath\n );\n\n fetchSpinner.text = `Fetched ${chalk.cyan(\n `${name}@${versionSpec}`\n )} ${chalk.gray(`(version ${prompt.version})`)} → ${chalk.gray(\n relativePath\n )}`;\n } else {\n // No change needed, track as unchanged\n result.unchanged.push(name);\n }\n } else {\n result.errors.push({ name, error: \"Prompt not found\" });\n }\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : \"Unknown error\";\n result.errors.push({ name, error: errorMessage });\n }\n }\n\n fetchSpinner.stop();\n }\n\n // Process local prompts (push to API) - only those explicitly declared in prompts.json\n const localFileRefs = Object.entries(config.prompts).filter(\n ([, dependency]) => {\n return typeof dependency === \"string\" && dependency.startsWith(\"file:\");\n }\n );\n\n if (localFileRefs.length > 0) {\n const pushSpinner = ora(\n `Pushing ${localFileRefs.length} local prompts...`\n ).start();\n\n // Use the existing lock file instead of reloading it\n // const lock = FileManager.loadPromptsLock(); // Don't reload - use existing lock\n\n for (const [promptName, dependency] of localFileRefs) {\n try {\n const filePath = (dependency as string).slice(5); // Remove \"file:\" prefix\n\n // Load local prompt config\n const localConfig = FileManager.loadLocalPrompt(filePath);\n\n // Get current version from lock file\n const currentVersion = lock.prompts[promptName]?.version;\n\n // Convert local config to API configData format\n const configData: ConfigData = {\n model: localConfig.model,\n prompt: PromptConverter.extractSystemPrompt(localConfig.messages),\n messages: PromptConverter.filterNonSystemMessages(\n localConfig.messages\n ) as Array<{\n role: \"system\" | \"user\" | \"assistant\";\n content: string;\n }>,\n temperature: localConfig.modelParameters?.temperature,\n max_tokens: localConfig.modelParameters?.max_tokens,\n inputs: [{ identifier: \"input\", type: \"str\" }],\n outputs: [{ identifier: \"output\", type: \"str\" }],\n };\n\n // Use new sync API with conflict detection\n const syncResult = await promptsApiService.sync({\n name: promptName,\n configData,\n localVersion: currentVersion,\n commitMessage: `Synced from local file: ${path.basename(filePath)}`,\n });\n\n const relativePath = path.relative(process.cwd(), filePath);\n\n let conflictResolution: \"local\" | \"remote\" | \"abort\" | null = null;\n if (syncResult.action === \"conflict\") {\n // Handle conflict - prompt user for resolution\n pushSpinner.stop();\n conflictResolution = await handleConflict(\n promptName,\n syncResult.conflictInfo!\n );\n if (conflictResolution === \"abort\") {\n result.errors.push({\n name: promptName,\n error: \"Sync aborted due to conflict\",\n });\n continue;\n }\n\n // If user chose remote, we should pull the remote version to local file\n if (conflictResolution === \"remote\" && syncResult.conflictInfo) {\n // Update local file with remote content\n const remoteConfig = {\n model: syncResult.conflictInfo.remoteConfigData.model,\n modelParameters: {\n temperature:\n syncResult.conflictInfo.remoteConfigData.temperature,\n max_tokens:\n syncResult.conflictInfo.remoteConfigData.max_tokens,\n },\n messages: [\n {\n role: \"system\" as const,\n content: syncResult.conflictInfo.remoteConfigData.prompt,\n },\n ...(syncResult.conflictInfo.remoteConfigData.messages ?? []),\n ],\n };\n\n const yamlContent = yaml.dump(remoteConfig, {\n lineWidth: -1,\n noRefs: true,\n sortKeys: false,\n });\n\n fs.writeFileSync(filePath, yamlContent);\n }\n\n // If user chose to proceed, we continue with the sync\n pushSpinner.start();\n }\n\n // Update lock file with new version info\n if (syncResult.prompt) {\n lock.prompts[promptName] = {\n version: syncResult.prompt.version,\n versionId: syncResult.prompt.versionId,\n materialized: filePath,\n };\n } else if (syncResult.action === \"conflict\") {\n const remoteVersion = syncResult.conflictInfo?.remoteVersion ?? 0;\n if (conflictResolution === \"remote\") {\n // User chose remote - use remote version\n lock.prompts[promptName] = {\n version: remoteVersion,\n versionId: \"remote_version\", // We don't have the actual versionId from conflict info\n materialized: filePath,\n };\n } else {\n // User chose local - force push\n const formattedConfig = PromptConverter.fromLocalToApiFormat(localConfig);\n const updatedPrompt = await promptsApiService.update(promptName, {\n ...formattedConfig,\n commitMessage: `Updated via CLI: synced from local file`\n });\n lock.prompts[promptName] = {\n version: updatedPrompt.version,\n versionId: updatedPrompt.versionId,\n materialized: filePath,\n };\n }\n }\n\n // Determine the action text based on sync result and conflict resolution\n let actionText: string;\n if (syncResult.action === \"conflict\") {\n if (conflictResolution === \"remote\") {\n actionText = \"Pulled\"; // User chose to use remote version\n result.fetched.push({\n name: promptName,\n version: syncResult.conflictInfo?.remoteVersion ?? 0,\n versionSpec: \"latest\", // Default for conflict resolution\n });\n } else {\n actionText = \"Pushed\"; // User chose to use local version (or forced push)\n result.pushed.push({\n name: promptName,\n version: (syncResult.conflictInfo?.remoteVersion ?? 0) + 1, // New version after push\n });\n }\n } else if (syncResult.action === \"up_to_date\") {\n // For up-to-date prompts, add to unchanged instead of pushed\n actionText = \"Up-to-date\";\n result.unchanged.push(promptName);\n } else {\n const actionMap: Record<SyncAction, string> = {\n created: \"Created\",\n updated: \"Updated\",\n conflict: \"Conflict resolved\",\n up_to_date: \"Up to date\",\n };\n actionText = actionMap[syncResult.action as SyncAction] || \"Pushed\";\n result.pushed.push({\n name: promptName,\n version: syncResult.prompt?.version ?? 0,\n });\n }\n\n pushSpinner.text = `${actionText} ${chalk.cyan(\n promptName\n )} ${chalk.gray(\n `(version ${\n syncResult.prompt?.version ??\n syncResult.conflictInfo?.remoteVersion ??\n \"unknown\"\n })`\n )} ${conflictResolution === \"remote\" ? \"to\" : \"from\"} ${chalk.gray(\n relativePath\n )}`;\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : \"Unknown error\";\n result.errors.push({ name: promptName, error: errorMessage });\n }\n }\n\n // Save lock file with all updates\n FileManager.savePromptsLock(lock);\n\n pushSpinner.stop();\n }\n\n // Check for orphan local prompt files and show helpful warnings\n const discoveredLocalFiles = FileManager.getLocalPromptFiles();\n const orphanFiles = discoveredLocalFiles.filter((filePath) => {\n const promptName = FileManager.promptNameFromPath(filePath);\n return !config.prompts[promptName]; // Not declared in prompts.json\n });\n\n if (orphanFiles.length > 0) {\n console.log(\n chalk.yellow(\n `\\n⚠ Found ${orphanFiles.length} orphan prompt file${\n orphanFiles.length > 1 ? \"s\" : \"\"\n }:`\n )\n );\n\n for (const filePath of orphanFiles) {\n const promptName = FileManager.promptNameFromPath(filePath);\n const relativePath = path.relative(process.cwd(), filePath);\n\n console.log(chalk.yellow(` ${relativePath}`));\n console.log(\n chalk.gray(\n ` Add to prompts.json: \"${promptName}\": \"file:${relativePath}\"`\n )\n );\n }\n\n console.log(\n chalk.gray(\n `\\nTip: Add these to prompts.json to include them in sync operations.`\n )\n );\n }\n\n // Cleanup orphaned materialized files\n const currentDependencies = new Set(\n Object.keys(config.prompts).filter((name) => {\n const dependency = config.prompts[name];\n // Only include remote dependencies (not local file: dependencies)\n if (typeof dependency === \"object\" && dependency.file) {\n return false;\n }\n if (typeof dependency === \"string\" && dependency.startsWith(\"file:\")) {\n return false;\n }\n return true;\n })\n );\n\n const cleanedFiles =\n FileManager.cleanupOrphanedMaterializedFiles(currentDependencies);\n if (cleanedFiles.length > 0) {\n result.cleaned = cleanedFiles;\n FileManager.removeFromLock(lock, cleanedFiles);\n }\n\n // Save the updated lock file\n FileManager.savePromptsLock(lock);\n\n // Print individual results if there were actions\n if (result.fetched.length > 0) {\n for (const { name, version, versionSpec } of result.fetched) {\n // Get the actual saved path from lock file for display consistency\n const lockEntry = lock.prompts[name];\n const displayPath = lockEntry?.materialized\n ? `./${lockEntry.materialized}`\n : `./prompts/.materialized/${name}.prompt.yaml`;\n\n console.log(\n chalk.green(\n `✓ Pulled ${chalk.cyan(`${name}@${versionSpec}`)} ${chalk.gray(\n `(version ${version})`\n )} → ${chalk.gray(displayPath)}`\n )\n );\n }\n }\n\n if (result.pushed.length > 0) {\n for (const { name, version } of result.pushed) {\n const localPath = `./prompts/${name}.prompt.yaml`;\n console.log(\n chalk.green(\n `✓ Pushed ${chalk.cyan(name)} ${chalk.gray(\n `(version ${version})`\n )} from ${chalk.gray(localPath)}`\n )\n );\n }\n }\n\n // Print cleaned up files\n if (result.cleaned.length > 0) {\n for (const name of result.cleaned) {\n console.log(\n chalk.yellow(\n `✓ Cleaned ${chalk.cyan(name)} (no longer in dependencies)`\n )\n );\n }\n }\n\n // Print errors\n if (result.errors.length > 0) {\n for (const { name, error } of result.errors) {\n console.log(chalk.red(`✗ Failed ${chalk.cyan(name)}: ${error}`));\n }\n }\n\n // Print summary\n const duration = ((Date.now() - startTime) / 1000).toFixed(1);\n const totalActions =\n result.fetched.length + result.pushed.length + result.cleaned.length;\n\n if (totalActions === 0 && result.errors.length === 0) {\n console.log(chalk.gray(`Synced in ${duration}s, no changes`));\n } else {\n const summary = [];\n if (result.fetched.length > 0)\n summary.push(`${result.fetched.length} fetched`);\n if (result.pushed.length > 0)\n summary.push(`${result.pushed.length} pushed`);\n if (result.cleaned.length > 0)\n summary.push(`${result.cleaned.length} cleaned`);\n if (result.errors.length > 0)\n summary.push(`${result.errors.length} errors`);\n\n console.log(chalk.gray(`Synced ${summary.join(\", \")} in ${duration}s`));\n }\n\n if (result.errors.length > 0) {\n process.exit(1);\n }\n } catch (error) {\n if (error instanceof PromptsError) {\n console.error(chalk.red(`Error: ${error.message}`));\n } else {\n console.error(\n chalk.red(\n `Unexpected error: ${\n error instanceof Error ? error.message : \"Unknown error\"\n }`\n )\n );\n }\n process.exit(1);\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,YAAY,QAAQ;AACpB,YAAY,UAAU;AACtB,OAAO,WAAW;AAClB,OAAO,SAAS;AAChB,YAAY,UAAU;AAYtB,OAAO,cAAc;AAGrB,IAAM,iBAAiB,OACrB,YACA,iBAM0C;AAC1C,UAAQ;AAAA,IACN,MAAM,OAAO;AAAA,uCAAqC,MAAM,KAAK,UAAU,CAAC,EAAE;AAAA,EAC5E;AACA,UAAQ;AAAA,IACN,MAAM;AAAA,MACJ,kBAAkB,aAAa,YAAY,qBAAqB,aAAa,aAAa;AAAA,IAC5F;AAAA,EACF;AAEA,MAAI,aAAa,YAAY,SAAS,GAAG;AACvC,YAAQ,IAAI,MAAM,OAAO,gBAAgB,CAAC;AAC1C,iBAAa,YAAY,QAAQ,CAAC,SAAS;AACzC,cAAQ,IAAI,MAAM,KAAK,YAAO,IAAI,EAAE,CAAC;AAAA,IACvC,CAAC;AAAA,EACH;AAEA,UAAQ,IAAI,MAAM,OAAO,YAAY,CAAC;AACtC,UAAQ,IAAI,4CAA4C;AACxD,UAAQ,IAAI,4CAA4C;AACxD,UAAQ,IAAI,kCAAkC;AAE9C,QAAM,KAAK,SAAS,gBAAgB;AAAA,IACl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