langwatch 0.5.1 → 0.7.1
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/README.md +19 -0
- package/dist/{add-4WXEWG5H.js → add-5QV3TEWC.js} +28 -32
- package/dist/add-5QV3TEWC.js.map +1 -0
- package/dist/{add-D2WVVKIP.mjs → add-HWFRMAQX.mjs} +14 -18
- package/dist/add-HWFRMAQX.mjs.map +1 -0
- package/dist/{chunk-CAZONSXV.js → chunk-36XAYVMC.js} +186 -76
- package/dist/chunk-36XAYVMC.js.map +1 -0
- package/dist/{chunk-QCYYSMCU.js → chunk-5HAVK64Q.js} +2 -2
- package/dist/chunk-5HAVK64Q.js.map +1 -0
- package/dist/{chunk-ZIULPOMQ.mjs → chunk-7MG7DGPP.mjs} +4 -4
- package/dist/{chunk-YKFTFYKK.mjs → chunk-7VHZNB2S.mjs} +2 -2
- package/dist/chunk-7VHZNB2S.mjs.map +1 -0
- package/dist/{chunk-DLJO7AK5.mjs → chunk-AD7QRYIJ.mjs} +2 -2
- package/dist/{chunk-DISMHYXC.js → chunk-CKIZDPIJ.js} +24 -22
- package/dist/chunk-CKIZDPIJ.js.map +1 -0
- package/dist/{chunk-SVXNUWZI.js → chunk-D7UAKYVI.js} +345 -154
- package/dist/chunk-D7UAKYVI.js.map +1 -0
- package/dist/{chunk-7OZKH5K2.js → chunk-DZH6SY3Z.js} +10 -10
- package/dist/{chunk-7OZKH5K2.js.map → chunk-DZH6SY3Z.js.map} +1 -1
- package/dist/{chunk-H5PON53W.mjs → chunk-EPGKOTSN.mjs} +334 -143
- package/dist/chunk-EPGKOTSN.mjs.map +1 -0
- package/dist/{chunk-N2V6J3U2.mjs → chunk-FEL5FLHA.mjs} +2 -2
- package/dist/{chunk-YNQ44U6D.mjs → chunk-I2SOBPAF.mjs} +23 -21
- package/dist/chunk-I2SOBPAF.mjs.map +1 -0
- package/dist/{chunk-P4SQTYGN.js → chunk-J55AV2YW.js} +32 -32
- package/dist/{chunk-P4SQTYGN.js.map → chunk-J55AV2YW.js.map} +1 -1
- package/dist/{chunk-OXBO24RB.js → chunk-OHM7JUMR.js} +15 -2
- package/dist/chunk-OHM7JUMR.js.map +1 -0
- package/dist/chunk-PYVDTUA6.mjs +352 -0
- package/dist/chunk-PYVDTUA6.mjs.map +1 -0
- package/dist/{chunk-YH5TIVK2.js → chunk-SNDTNU3T.js} +2 -2
- package/dist/{chunk-YH5TIVK2.js.map → chunk-SNDTNU3T.js.map} +1 -1
- package/dist/{chunk-QZGTM76F.mjs → chunk-UNMZPS55.mjs} +7 -3
- package/dist/chunk-UNMZPS55.mjs.map +1 -0
- package/dist/{chunk-CU3443HD.mjs → chunk-URTD2WOC.mjs} +14 -1
- package/dist/{chunk-ECOC36EA.js → chunk-VMZUN4EF.js} +16 -12
- package/dist/chunk-VMZUN4EF.js.map +1 -0
- package/dist/cli/index.js +8 -8
- package/dist/cli/index.mjs +8 -8
- package/dist/{create-OQEMO4MU.mjs → create-LXQB4EFB.mjs} +4 -5
- package/dist/{create-OQEMO4MU.mjs.map → create-LXQB4EFB.mjs.map} +1 -1
- package/dist/{create-4LG4N2A4.js → create-S5RDGF3H.js} +9 -10
- package/dist/create-S5RDGF3H.js.map +1 -0
- package/dist/{implementation-BIlL6-SW.d.ts → implementation-DsHp9FYU.d.ts} +1 -1
- package/dist/{implementation-fAgqv8OM.d.mts → implementation-nE9dgTwc.d.mts} +1 -1
- package/dist/{index-DTEZr0Jn.d.mts → index-D7rKIGrO.d.mts} +12 -12
- package/dist/{index-DTEZr0Jn.d.ts → index-D7rKIGrO.d.ts} +12 -12
- package/dist/index.d.mts +256 -11
- package/dist/index.d.ts +256 -11
- package/dist/index.js +135 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +133 -10
- package/dist/index.mjs.map +1 -1
- package/dist/{init-MQXXHCNT.mjs → init-T4YDPHBA.mjs} +4 -5
- package/dist/{init-MQXXHCNT.mjs.map → init-T4YDPHBA.mjs.map} +1 -1
- package/dist/init-UADBKUJU.js +15 -0
- package/dist/init-UADBKUJU.js.map +1 -0
- package/dist/{list-PFWV7IU6.mjs → list-BQXECLEM.mjs} +13 -14
- package/dist/list-BQXECLEM.mjs.map +1 -0
- package/dist/{list-GIAXAAH5.js → list-HSCIBC4Z.js} +14 -15
- package/dist/list-HSCIBC4Z.js.map +1 -0
- package/dist/{login-BYLXS23I.mjs → login-3IM3PYSJ.mjs} +3 -3
- package/dist/{login-3STX2FAO.js → login-EUDCIJRM.js} +4 -4
- package/dist/{login-3STX2FAO.js.map → login-EUDCIJRM.js.map} +1 -1
- package/dist/observability-sdk/index.d.mts +4 -3
- package/dist/observability-sdk/index.d.ts +4 -3
- package/dist/observability-sdk/index.js +7 -7
- package/dist/observability-sdk/index.mjs +6 -6
- package/dist/observability-sdk/instrumentation/langchain/index.d.mts +2 -1
- package/dist/observability-sdk/instrumentation/langchain/index.d.ts +2 -1
- package/dist/observability-sdk/instrumentation/langchain/index.js +19 -19
- package/dist/observability-sdk/instrumentation/langchain/index.mjs +3 -3
- package/dist/observability-sdk/setup/node/index.d.mts +1 -1
- package/dist/observability-sdk/setup/node/index.d.ts +1 -1
- package/dist/observability-sdk/setup/node/index.js +15 -15
- package/dist/observability-sdk/setup/node/index.mjs +4 -4
- package/dist/{remove-FTF3EBYV.mjs → remove-IVFQAHNT.mjs} +9 -10
- package/dist/{remove-FTF3EBYV.mjs.map → remove-IVFQAHNT.mjs.map} +1 -1
- package/dist/{remove-U3PILQDV.js → remove-VDQ4M6JF.js} +17 -18
- package/dist/remove-VDQ4M6JF.js.map +1 -0
- package/dist/{sync-FOW7DHAH.mjs → sync-2MVHHWCX.mjs} +16 -20
- package/dist/sync-2MVHHWCX.mjs.map +1 -0
- package/dist/{sync-T3T22GVZ.js → sync-KUMBMGJS.js} +31 -35
- package/dist/sync-KUMBMGJS.js.map +1 -0
- package/dist/{types-DyUmlaDx.d.ts → types-B9772cUR.d.ts} +98 -29
- package/dist/{types-jrEEZt9d.d.mts → types-DbPAi4US.d.mts} +98 -29
- package/package.json +16 -11
- package/dist/add-4WXEWG5H.js.map +0 -1
- package/dist/add-D2WVVKIP.mjs.map +0 -1
- package/dist/chunk-CAZONSXV.js.map +0 -1
- package/dist/chunk-CKVDNVFL.mjs +0 -242
- package/dist/chunk-CKVDNVFL.mjs.map +0 -1
- package/dist/chunk-DISMHYXC.js.map +0 -1
- package/dist/chunk-DSIQSULK.js +0 -152
- package/dist/chunk-DSIQSULK.js.map +0 -1
- package/dist/chunk-ECOC36EA.js.map +0 -1
- package/dist/chunk-H5PON53W.mjs.map +0 -1
- package/dist/chunk-OXBO24RB.js.map +0 -1
- package/dist/chunk-QCYYSMCU.js.map +0 -1
- package/dist/chunk-QZGTM76F.mjs.map +0 -1
- package/dist/chunk-R6FBJN7K.js +0 -115
- package/dist/chunk-R6FBJN7K.js.map +0 -1
- package/dist/chunk-SVXNUWZI.js.map +0 -1
- package/dist/chunk-V5M3HUBV.mjs +0 -115
- package/dist/chunk-V5M3HUBV.mjs.map +0 -1
- package/dist/chunk-YEGQXDTE.mjs +0 -152
- package/dist/chunk-YEGQXDTE.mjs.map +0 -1
- package/dist/chunk-YKFTFYKK.mjs.map +0 -1
- package/dist/chunk-YNQ44U6D.mjs.map +0 -1
- package/dist/create-4LG4N2A4.js.map +0 -1
- package/dist/init-EKNL2SQE.js +0 -16
- package/dist/init-EKNL2SQE.js.map +0 -1
- package/dist/list-GIAXAAH5.js.map +0 -1
- package/dist/list-PFWV7IU6.mjs.map +0 -1
- package/dist/remove-U3PILQDV.js.map +0 -1
- package/dist/sync-FOW7DHAH.mjs.map +0 -1
- package/dist/sync-T3T22GVZ.js.map +0 -1
- /package/dist/{chunk-ZIULPOMQ.mjs.map → chunk-7MG7DGPP.mjs.map} +0 -0
- /package/dist/{chunk-DLJO7AK5.mjs.map → chunk-AD7QRYIJ.mjs.map} +0 -0
- /package/dist/{chunk-N2V6J3U2.mjs.map → chunk-FEL5FLHA.mjs.map} +0 -0
- /package/dist/{chunk-CU3443HD.mjs.map → chunk-URTD2WOC.mjs.map} +0 -0
- /package/dist/{login-BYLXS23I.mjs.map → login-3IM3PYSJ.mjs.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/langwatch/langwatch/typescript-sdk/dist/login-
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/langwatch/langwatch/typescript-sdk/dist/login-EUDCIJRM.js","../src/cli/commands/login.ts"],"names":[],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B,+BAA4B;AAC5B;AACA;ACLA,+DAAoB;AACpB,uEAAsB;AACtB,4EAAkB;AAClB,oEAAgB;AAChB,oFAAoB;AAGpB,IAAM,YAAA,EAAc,CAAA,EAAA,GAAc;AAPlC,EAAA,IAAA,EAAA;AAQE,EAAA,OAAA,CAAO,GAAA,EAAA,OAAA,CAAQ,GAAA,CAAI,kBAAA,EAAA,GAAZ,KAAA,EAAA,GAAA,EAAkC,iCAAA;AAC3C,CAAA;AAEA,IAAM,cAAA,EAAgB,CACpB,MAAA,EAAA,GACyD;AACzD,EAAA,MAAM,QAAA,EAAe,IAAA,CAAA,IAAA,CAAK,OAAA,CAAQ,GAAA,CAAI,CAAA,EAAG,MAAM,CAAA;AAG/C,EAAA,GAAA,CAAI,CAAI,EAAA,CAAA,UAAA,CAAW,OAAO,CAAA,EAAG;AAE3B,IAAG,EAAA,CAAA,aAAA,CAAc,OAAA,EAAS,CAAA,kBAAA,EAAqB,MAAM,CAAA;AAAA,CAAI,CAAA;AACzD,IAAA,OAAO,EAAE,OAAA,EAAS,IAAA,EAAM,OAAA,EAAS,KAAA,EAAO,IAAA,EAAM,QAAQ,CAAA;AAAA,EACxD;AAGA,EAAA,MAAM,QAAA,EAAa,EAAA,CAAA,YAAA,CAAa,OAAA,EAAS,OAAO,CAAA;AAChD,EAAA,MAAM,MAAA,EAAQ,OAAA,CAAQ,KAAA,CAAM,IAAI,CAAA;AAGhC,EAAA,IAAI,MA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IJRM.js","sourcesContent":[null,"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"]}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
export { F as FilterableBatchSpanProcessor, L as LangWatchExporter, a as LangWatchExporterOptions, c as LangWatchLogger, L as LangWatchTraceExporter, a as LangWatchTraceExporterOptions, S as SpanProcessingExcludeRule, g as getLangWatchLogger, b as getLangWatchLoggerFromProvider, d as getLangWatchTracer, e as getLangWatchTracerFromProvider } from '../implementation-
|
|
1
|
+
export { F as FilterableBatchSpanProcessor, L as LangWatchExporter, a as LangWatchExporterOptions, c as LangWatchLogger, L as LangWatchTraceExporter, a as LangWatchTraceExporterOptions, S as SpanProcessingExcludeRule, g as getLangWatchLogger, b as getLangWatchLoggerFromProvider, d as getLangWatchTracer, e as getLangWatchTracerFromProvider } from '../implementation-nE9dgTwc.mjs';
|
|
2
2
|
import { OTLPLogExporter } from '@opentelemetry/exporter-logs-otlp-http';
|
|
3
3
|
import { a as DataCaptureMode } from '../types-Dmazk5Bk.mjs';
|
|
4
4
|
export { b as DataCaptureConfig, c as DataCaptureContext, D as DataCaptureOptions, d as DataCapturePredicate } from '../types-Dmazk5Bk.mjs';
|
|
5
|
-
import { L as LangWatchSpan } from '../types-
|
|
6
|
-
export { f as INPUT_OUTPUT_TYPES, I as InputOutputType, J as JsonSerializable, b as LangWatchSpanMetrics, d as LangWatchSpanOptions, c as LangWatchSpanRAGContext, a as LangWatchTracer, e as SimpleChatMessage, S as SpanType, s as spanTypes } from '../types-
|
|
5
|
+
import { L as LangWatchSpan } from '../types-DbPAi4US.mjs';
|
|
6
|
+
export { f as INPUT_OUTPUT_TYPES, I as InputOutputType, J as JsonSerializable, b as LangWatchSpanMetrics, d as LangWatchSpanOptions, c as LangWatchSpanRAGContext, a as LangWatchTracer, e as SimpleChatMessage, S as SpanType, s as spanTypes } from '../types-DbPAi4US.mjs';
|
|
7
7
|
import { Span } from '@opentelemetry/api';
|
|
8
8
|
export { b as SemConvAttributeKey, S as SemConvAttributes, a as SemConvLogRecordAttributes, l as attributes } from '../types-DRiQaKFG.mjs';
|
|
9
9
|
import '@opentelemetry/sdk-trace-base';
|
|
10
10
|
import '@opentelemetry/exporter-trace-otlp-http';
|
|
11
11
|
import '@opentelemetry/api-logs';
|
|
12
|
+
import 'zod';
|
|
12
13
|
import '@opentelemetry/semantic-conventions';
|
|
13
14
|
import '@opentelemetry/semantic-conventions/incubating';
|
|
14
15
|
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
export { F as FilterableBatchSpanProcessor, L as LangWatchExporter, a as LangWatchExporterOptions, c as LangWatchLogger, L as LangWatchTraceExporter, a as LangWatchTraceExporterOptions, S as SpanProcessingExcludeRule, g as getLangWatchLogger, b as getLangWatchLoggerFromProvider, d as getLangWatchTracer, e as getLangWatchTracerFromProvider } from '../implementation-
|
|
1
|
+
export { F as FilterableBatchSpanProcessor, L as LangWatchExporter, a as LangWatchExporterOptions, c as LangWatchLogger, L as LangWatchTraceExporter, a as LangWatchTraceExporterOptions, S as SpanProcessingExcludeRule, g as getLangWatchLogger, b as getLangWatchLoggerFromProvider, d as getLangWatchTracer, e as getLangWatchTracerFromProvider } from '../implementation-DsHp9FYU.js';
|
|
2
2
|
import { OTLPLogExporter } from '@opentelemetry/exporter-logs-otlp-http';
|
|
3
3
|
import { a as DataCaptureMode } from '../types-Dmazk5Bk.js';
|
|
4
4
|
export { b as DataCaptureConfig, c as DataCaptureContext, D as DataCaptureOptions, d as DataCapturePredicate } from '../types-Dmazk5Bk.js';
|
|
5
|
-
import { L as LangWatchSpan } from '../types-
|
|
6
|
-
export { f as INPUT_OUTPUT_TYPES, I as InputOutputType, J as JsonSerializable, b as LangWatchSpanMetrics, d as LangWatchSpanOptions, c as LangWatchSpanRAGContext, a as LangWatchTracer, e as SimpleChatMessage, S as SpanType, s as spanTypes } from '../types-
|
|
5
|
+
import { L as LangWatchSpan } from '../types-B9772cUR.js';
|
|
6
|
+
export { f as INPUT_OUTPUT_TYPES, I as InputOutputType, J as JsonSerializable, b as LangWatchSpanMetrics, d as LangWatchSpanOptions, c as LangWatchSpanRAGContext, a as LangWatchTracer, e as SimpleChatMessage, S as SpanType, s as spanTypes } from '../types-B9772cUR.js';
|
|
7
7
|
import { Span } from '@opentelemetry/api';
|
|
8
8
|
export { b as SemConvAttributeKey, S as SemConvAttributes, a as SemConvLogRecordAttributes, l as attributes } from '../types-DRiQaKFG.js';
|
|
9
9
|
import '@opentelemetry/sdk-trace-base';
|
|
10
10
|
import '@opentelemetry/exporter-trace-otlp-http';
|
|
11
11
|
import '@opentelemetry/api-logs';
|
|
12
|
+
import 'zod';
|
|
12
13
|
import '@opentelemetry/semantic-conventions';
|
|
13
14
|
import '@opentelemetry/semantic-conventions/incubating';
|
|
14
15
|
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkSNDTNU3Tjs = require('../chunk-SNDTNU3T.js');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkVMZUN4EFjs = require('../chunk-VMZUN4EF.js');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
var
|
|
17
|
-
require('../chunk-
|
|
16
|
+
var _chunkJ55AV2YWjs = require('../chunk-J55AV2YW.js');
|
|
17
|
+
require('../chunk-5HAVK64Q.js');
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
var
|
|
24
|
-
require('../chunk-
|
|
23
|
+
var _chunkCKIZDPIJjs = require('../chunk-CKIZDPIJ.js');
|
|
24
|
+
require('../chunk-OHM7JUMR.js');
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
|
|
@@ -38,5 +38,5 @@ require('../chunk-OXBO24RB.js');
|
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
|
|
41
|
-
exports.DataCapturePresets =
|
|
41
|
+
exports.DataCapturePresets = _chunkSNDTNU3Tjs.DataCapturePresets; exports.FilterableBatchSpanProcessor = _chunkSNDTNU3Tjs.FilterableBatchSpanProcessor; exports.LangWatchExporter = _chunkJ55AV2YWjs.LangWatchTraceExporter; exports.LangWatchLogsExporter = _chunkJ55AV2YWjs.LangWatchLogsExporter; exports.LangWatchTraceExporter = _chunkJ55AV2YWjs.LangWatchTraceExporter; exports.attributes = _chunkCKIZDPIJjs.attributes_exports; exports.createLangWatchSpan = _chunkVMZUN4EFjs.createLangWatchSpan; exports.getDataCaptureMode = _chunkCKIZDPIJjs.getDataCaptureMode; exports.getLangWatchLogger = _chunkJ55AV2YWjs.getLangWatchLogger; exports.getLangWatchLoggerFromProvider = _chunkJ55AV2YWjs.getLangWatchLoggerFromProvider; exports.getLangWatchTracer = _chunkVMZUN4EFjs.getLangWatchTracer; exports.getLangWatchTracerFromProvider = _chunkVMZUN4EFjs.getLangWatchTracerFromProvider; exports.shouldCaptureInput = _chunkCKIZDPIJjs.shouldCaptureInput; exports.shouldCaptureOutput = _chunkCKIZDPIJjs.shouldCaptureOutput; exports.spanTypes = _chunkVMZUN4EFjs.spanTypes;
|
|
42
42
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DataCapturePresets,
|
|
3
3
|
FilterableBatchSpanProcessor
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-FEL5FLHA.mjs";
|
|
5
5
|
import {
|
|
6
6
|
createLangWatchSpan,
|
|
7
7
|
getLangWatchTracer,
|
|
8
8
|
getLangWatchTracerFromProvider,
|
|
9
9
|
spanTypes
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-UNMZPS55.mjs";
|
|
11
11
|
import {
|
|
12
12
|
LangWatchLogsExporter,
|
|
13
13
|
LangWatchTraceExporter,
|
|
14
14
|
getLangWatchLogger,
|
|
15
15
|
getLangWatchLoggerFromProvider
|
|
16
|
-
} from "../chunk-
|
|
17
|
-
import "../chunk-
|
|
16
|
+
} from "../chunk-7MG7DGPP.mjs";
|
|
17
|
+
import "../chunk-7VHZNB2S.mjs";
|
|
18
18
|
import {
|
|
19
19
|
attributes_exports,
|
|
20
20
|
getDataCaptureMode,
|
|
21
21
|
shouldCaptureInput,
|
|
22
22
|
shouldCaptureOutput
|
|
23
|
-
} from "../chunk-
|
|
24
|
-
import "../chunk-
|
|
23
|
+
} from "../chunk-I2SOBPAF.mjs";
|
|
24
|
+
import "../chunk-URTD2WOC.mjs";
|
|
25
25
|
export {
|
|
26
26
|
DataCapturePresets,
|
|
27
27
|
FilterableBatchSpanProcessor,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _opentelemetry_api from '@opentelemetry/api';
|
|
2
2
|
import { Attributes } from '@opentelemetry/api';
|
|
3
|
-
import { L as LangWatchSpan, a as LangWatchTracer, C as ChatMessage } from '../../../types-
|
|
3
|
+
import { L as LangWatchSpan, a as LangWatchTracer, C as ChatMessage } from '../../../types-DbPAi4US.mjs';
|
|
4
4
|
import { AgentAction, AgentFinish } from '@langchain/core/agents';
|
|
5
5
|
import { BaseCallbackHandler } from '@langchain/core/callbacks/base';
|
|
6
6
|
import { DocumentInterface } from '@langchain/core/documents';
|
|
@@ -8,6 +8,7 @@ import { Serialized } from '@langchain/core/load/serializable';
|
|
|
8
8
|
import { BaseMessage } from '@langchain/core/messages';
|
|
9
9
|
import { LLMResult } from '@langchain/core/outputs';
|
|
10
10
|
import { ChainValues } from '@langchain/core/utils/types';
|
|
11
|
+
import 'zod';
|
|
11
12
|
import '../../../types-DRiQaKFG.mjs';
|
|
12
13
|
import '@opentelemetry/api-logs';
|
|
13
14
|
import '@opentelemetry/semantic-conventions';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _opentelemetry_api from '@opentelemetry/api';
|
|
2
2
|
import { Attributes } from '@opentelemetry/api';
|
|
3
|
-
import { L as LangWatchSpan, a as LangWatchTracer, C as ChatMessage } from '../../../types-
|
|
3
|
+
import { L as LangWatchSpan, a as LangWatchTracer, C as ChatMessage } from '../../../types-B9772cUR.js';
|
|
4
4
|
import { AgentAction, AgentFinish } from '@langchain/core/agents';
|
|
5
5
|
import { BaseCallbackHandler } from '@langchain/core/callbacks/base';
|
|
6
6
|
import { DocumentInterface } from '@langchain/core/documents';
|
|
@@ -8,6 +8,7 @@ import { Serialized } from '@langchain/core/load/serializable';
|
|
|
8
8
|
import { BaseMessage } from '@langchain/core/messages';
|
|
9
9
|
import { LLMResult } from '@langchain/core/outputs';
|
|
10
10
|
import { ChainValues } from '@langchain/core/utils/types';
|
|
11
|
+
import 'zod';
|
|
11
12
|
import '../../../types-DRiQaKFG.js';
|
|
12
13
|
import '@opentelemetry/api-logs';
|
|
13
14
|
import '@opentelemetry/semantic-conventions';
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkVMZUN4EFjs = require('../../../chunk-VMZUN4EF.js');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkCKIZDPIJjs = require('../../../chunk-CKIZDPIJ.js');
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunkOHM7JUMRjs = require('../../../chunk-OHM7JUMR.js');
|
|
12
12
|
|
|
13
13
|
// src/observability-sdk/instrumentation/langchain/index.ts
|
|
14
14
|
var _base = require('@langchain/core/callbacks/base');
|
|
@@ -31,7 +31,7 @@ var LangWatchCallbackHandler = class extends _base.BaseCallbackHandler {
|
|
|
31
31
|
constructor() {
|
|
32
32
|
super(...arguments);
|
|
33
33
|
this.name = "LangWatchCallbackHandler";
|
|
34
|
-
this.tracer =
|
|
34
|
+
this.tracer = _chunkVMZUN4EFjs.getLangWatchTracer.call(void 0, "langwatch.instrumentation.langchain");
|
|
35
35
|
this.spans = {};
|
|
36
36
|
this.parentOf = {};
|
|
37
37
|
this.skipped = {};
|
|
@@ -66,7 +66,7 @@ var LangWatchCallbackHandler = class extends _base.BaseCallbackHandler {
|
|
|
66
66
|
span.setType(type);
|
|
67
67
|
if ((_a = args.tags) == null ? void 0 : _a.length)
|
|
68
68
|
span.setAttribute("langwatch.langchain.run.tags", args.tags.slice(0, 50));
|
|
69
|
-
if (
|
|
69
|
+
if (_chunkCKIZDPIJjs.shouldCaptureInput.call(void 0, ) && args.input !== void 0) {
|
|
70
70
|
const i = args.input;
|
|
71
71
|
if (i && typeof i === "object" && "type" in i && "value" in i) {
|
|
72
72
|
span.setInput(i.type, i.value);
|
|
@@ -106,7 +106,7 @@ var LangWatchCallbackHandler = class extends _base.BaseCallbackHandler {
|
|
|
106
106
|
if (end.err) {
|
|
107
107
|
span.recordException(end.err);
|
|
108
108
|
span.setStatus({ code: _api.SpanStatusCode.ERROR, message: end.err.message });
|
|
109
|
-
} else if (
|
|
109
|
+
} else if (_chunkCKIZDPIJjs.shouldCaptureOutput.call(void 0, ) && end.output !== void 0) {
|
|
110
110
|
span.setOutput(end.output);
|
|
111
111
|
}
|
|
112
112
|
span.end();
|
|
@@ -116,7 +116,7 @@ var LangWatchCallbackHandler = class extends _base.BaseCallbackHandler {
|
|
|
116
116
|
this.seenStarts.delete(runId);
|
|
117
117
|
}
|
|
118
118
|
async handleLLMStart(llm, prompts, runId, parentRunId, extraParams, tags, metadata, name) {
|
|
119
|
-
const input =
|
|
119
|
+
const input = _chunkCKIZDPIJjs.shouldCaptureInput.call(void 0, ) && prompts ? {
|
|
120
120
|
type: "list",
|
|
121
121
|
value: prompts.map((p) => ({ type: "text", value: p }))
|
|
122
122
|
} : void 0;
|
|
@@ -133,7 +133,7 @@ var LangWatchCallbackHandler = class extends _base.BaseCallbackHandler {
|
|
|
133
133
|
});
|
|
134
134
|
}
|
|
135
135
|
async handleChatModelStart(llm, messages, runId, parentRunId, extraParams, tags, metadata, name) {
|
|
136
|
-
const input =
|
|
136
|
+
const input = _chunkCKIZDPIJjs.shouldCaptureInput.call(void 0, ) ? {
|
|
137
137
|
type: "chat_messages",
|
|
138
138
|
value: messages.flatMap(convertFromLangChainMessages)
|
|
139
139
|
} : void 0;
|
|
@@ -160,7 +160,7 @@ var LangWatchCallbackHandler = class extends _base.BaseCallbackHandler {
|
|
|
160
160
|
"gen_ai.usage.total_tokens": (_d = tu.totalTokens) != null ? _d : 0
|
|
161
161
|
});
|
|
162
162
|
}
|
|
163
|
-
const outputs =
|
|
163
|
+
const outputs = _chunkCKIZDPIJjs.shouldCaptureOutput.call(void 0, ) ? response.generations.flat().map((g) => {
|
|
164
164
|
if ("message" in g && g.message) {
|
|
165
165
|
return convertFromLangChainMessages([
|
|
166
166
|
g.message
|
|
@@ -188,7 +188,7 @@ var LangWatchCallbackHandler = class extends _base.BaseCallbackHandler {
|
|
|
188
188
|
metadata,
|
|
189
189
|
tags,
|
|
190
190
|
name,
|
|
191
|
-
input:
|
|
191
|
+
input: _chunkCKIZDPIJjs.shouldCaptureInput.call(void 0, ) ? inputs : void 0
|
|
192
192
|
});
|
|
193
193
|
if (_runType) {
|
|
194
194
|
const span = this.spans[runId];
|
|
@@ -216,7 +216,7 @@ var LangWatchCallbackHandler = class extends _base.BaseCallbackHandler {
|
|
|
216
216
|
metadata,
|
|
217
217
|
tags,
|
|
218
218
|
name,
|
|
219
|
-
input:
|
|
219
|
+
input: _chunkCKIZDPIJjs.shouldCaptureInput.call(void 0, ) ? { type: "text", value: input } : void 0
|
|
220
220
|
});
|
|
221
221
|
const span = this.spans[runId];
|
|
222
222
|
if (span) {
|
|
@@ -228,7 +228,7 @@ var LangWatchCallbackHandler = class extends _base.BaseCallbackHandler {
|
|
|
228
228
|
}
|
|
229
229
|
async handleToolEnd(output, runId, parentRunId) {
|
|
230
230
|
this.finishRun(runId, {
|
|
231
|
-
output:
|
|
231
|
+
output: _chunkCKIZDPIJjs.shouldCaptureOutput.call(void 0, ) ? { type: "text", value: output } : void 0,
|
|
232
232
|
event: "handleToolEnd",
|
|
233
233
|
parentRunId
|
|
234
234
|
});
|
|
@@ -245,7 +245,7 @@ var LangWatchCallbackHandler = class extends _base.BaseCallbackHandler {
|
|
|
245
245
|
metadata,
|
|
246
246
|
tags,
|
|
247
247
|
name,
|
|
248
|
-
input:
|
|
248
|
+
input: _chunkCKIZDPIJjs.shouldCaptureInput.call(void 0, ) ? { type: "text", value: query } : void 0
|
|
249
249
|
});
|
|
250
250
|
const span = this.spans[runId];
|
|
251
251
|
if (span) {
|
|
@@ -257,10 +257,10 @@ var LangWatchCallbackHandler = class extends _base.BaseCallbackHandler {
|
|
|
257
257
|
}
|
|
258
258
|
async handleRetrieverEnd(documents, runId, parentRunId, tags) {
|
|
259
259
|
const span = this.spans[runId];
|
|
260
|
-
if (span &&
|
|
260
|
+
if (span && _chunkCKIZDPIJjs.shouldCaptureOutput.call(void 0, )) {
|
|
261
261
|
span.setOutput(documents);
|
|
262
262
|
}
|
|
263
|
-
if (span &&
|
|
263
|
+
if (span && _chunkCKIZDPIJjs.shouldCaptureInput.call(void 0, )) {
|
|
264
264
|
span.setRAGContexts(
|
|
265
265
|
documents.map((document) => ({
|
|
266
266
|
document_id: document.metadata.id,
|
|
@@ -288,7 +288,7 @@ var LangWatchCallbackHandler = class extends _base.BaseCallbackHandler {
|
|
|
288
288
|
}
|
|
289
289
|
async handleAgentEnd(action, runId, parentRunId, tags) {
|
|
290
290
|
this.finishRun(runId, {
|
|
291
|
-
output:
|
|
291
|
+
output: _chunkCKIZDPIJjs.shouldCaptureOutput.call(void 0, ) ? { type: "json", value: action.returnValues } : void 0,
|
|
292
292
|
event: "handleAgentEnd",
|
|
293
293
|
parentRunId,
|
|
294
294
|
tags
|
|
@@ -330,7 +330,7 @@ function convertFromLangChainMessage(message) {
|
|
|
330
330
|
(c) => (c == null ? void 0 : c.type) === "text" ? { type: "text", text: c.text } : (c == null ? void 0 : c.type) === "image_url" ? { type: "image_url", image_url: c.image_url } : { type: "text", text: JSON.stringify(c) }
|
|
331
331
|
) : JSON.stringify(message.content);
|
|
332
332
|
const functionCall = message.additional_kwargs;
|
|
333
|
-
return
|
|
333
|
+
return _chunkOHM7JUMRjs.__spreadValues.call(void 0, {
|
|
334
334
|
role,
|
|
335
335
|
content
|
|
336
336
|
}, functionCall && typeof functionCall === "object" && Object.keys(functionCall).length > 0 ? { function_call: functionCall } : {});
|
|
@@ -362,7 +362,7 @@ function wrapNonScalarValues(value) {
|
|
|
362
362
|
if (value === null) return JSON.stringify(null);
|
|
363
363
|
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean")
|
|
364
364
|
return value;
|
|
365
|
-
const chatMessages =
|
|
365
|
+
const chatMessages = _chunkVMZUN4EFjs.chatMessageSchema.array().safeParse(value);
|
|
366
366
|
if (Array.isArray(value) && chatMessages.success) {
|
|
367
367
|
return JSON.stringify({ type: "chat_messages", value: chatMessages.data });
|
|
368
368
|
}
|
|
@@ -381,7 +381,7 @@ function wrapNonScalarValues(value) {
|
|
|
381
381
|
}
|
|
382
382
|
}
|
|
383
383
|
function addLangChainEvent(span, eventName, runId, parentRunId, tags, metadata, attributes) {
|
|
384
|
-
const attrs =
|
|
384
|
+
const attrs = _chunkOHM7JUMRjs.__spreadValues.call(void 0, {
|
|
385
385
|
"langwatch.langchain.run.id": runId,
|
|
386
386
|
"langwatch.langchain.run.parent_id": parentRunId,
|
|
387
387
|
"langwatch.langchain.event.name": eventName
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
chatMessageSchema,
|
|
3
3
|
getLangWatchTracer
|
|
4
|
-
} from "../../../chunk-
|
|
4
|
+
} from "../../../chunk-UNMZPS55.mjs";
|
|
5
5
|
import {
|
|
6
6
|
shouldCaptureInput,
|
|
7
7
|
shouldCaptureOutput
|
|
8
|
-
} from "../../../chunk-
|
|
8
|
+
} from "../../../chunk-I2SOBPAF.mjs";
|
|
9
9
|
import {
|
|
10
10
|
__spreadValues
|
|
11
|
-
} from "../../../chunk-
|
|
11
|
+
} from "../../../chunk-URTD2WOC.mjs";
|
|
12
12
|
|
|
13
13
|
// src/observability-sdk/instrumentation/langchain/index.ts
|
|
14
14
|
import { BaseCallbackHandler } from "@langchain/core/callbacks/base";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { L as Logger } from '../../../index-
|
|
1
|
+
import { L as Logger } from '../../../index-D7rKIGrO.mjs';
|
|
2
2
|
import { Instrumentation } from '@opentelemetry/instrumentation';
|
|
3
3
|
import { SpanExporter, SpanProcessor, SpanLimits, Sampler, IdGenerator } from '@opentelemetry/sdk-trace-base';
|
|
4
4
|
import { ContextManager, TextMapPropagator } from '@opentelemetry/api';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { L as Logger } from '../../../index-
|
|
1
|
+
import { L as Logger } from '../../../index-D7rKIGrO.js';
|
|
2
2
|
import { Instrumentation } from '@opentelemetry/instrumentation';
|
|
3
3
|
import { SpanExporter, SpanProcessor, SpanLimits, Sampler, IdGenerator } from '@opentelemetry/sdk-trace-base';
|
|
4
4
|
import { ContextManager, TextMapPropagator } from '@opentelemetry/api';
|
|
@@ -2,21 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkJ55AV2YWjs = require('../../../chunk-J55AV2YW.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunk5HAVK64Qjs = require('../../../chunk-5HAVK64Q.js');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _chunkCKIZDPIJjs = require('../../../chunk-CKIZDPIJ.js');
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
var
|
|
19
|
+
var _chunkOHM7JUMRjs = require('../../../chunk-OHM7JUMR.js');
|
|
20
20
|
|
|
21
21
|
// src/observability-sdk/setup/node/setup.ts
|
|
22
22
|
var _sdknode = require('@opentelemetry/sdk-node');
|
|
@@ -30,12 +30,12 @@ var _resources = require('@opentelemetry/resources');
|
|
|
30
30
|
var _incubating = require('@opentelemetry/semantic-conventions/incubating'); var semconv = _interopRequireWildcard(_incubating);
|
|
31
31
|
function createMergedResource(attributes, serviceName, givenResource) {
|
|
32
32
|
const langwatchResource = _resources.resourceFromAttributes.call(void 0, {
|
|
33
|
-
[semconv.ATTR_TELEMETRY_SDK_NAME]:
|
|
34
|
-
[semconv.ATTR_TELEMETRY_SDK_LANGUAGE]:
|
|
35
|
-
[semconv.ATTR_TELEMETRY_SDK_VERSION]:
|
|
33
|
+
[semconv.ATTR_TELEMETRY_SDK_NAME]: _chunk5HAVK64Qjs.LANGWATCH_SDK_NAME_OBSERVABILITY,
|
|
34
|
+
[semconv.ATTR_TELEMETRY_SDK_LANGUAGE]: _chunk5HAVK64Qjs.LANGWATCH_SDK_LANGUAGE,
|
|
35
|
+
[semconv.ATTR_TELEMETRY_SDK_VERSION]: _chunk5HAVK64Qjs.LANGWATCH_SDK_VERSION
|
|
36
36
|
});
|
|
37
|
-
const userResource = _resources.resourceFromAttributes.call(void 0,
|
|
38
|
-
[semconv.ATTR_SERVICE_NAME]: serviceName != null ? serviceName :
|
|
37
|
+
const userResource = _resources.resourceFromAttributes.call(void 0, _chunkOHM7JUMRjs.__spreadValues.call(void 0, {
|
|
38
|
+
[semconv.ATTR_SERVICE_NAME]: serviceName != null ? serviceName : _chunk5HAVK64Qjs.DEFAULT_SERVICE_NAME
|
|
39
39
|
}, attributes != null ? attributes : {}));
|
|
40
40
|
return (givenResource != null ? givenResource : _resources.defaultResource.call(void 0, )).merge(langwatchResource).merge(userResource);
|
|
41
41
|
}
|
|
@@ -89,7 +89,7 @@ var getLangWatchConfig = (options) => {
|
|
|
89
89
|
return {
|
|
90
90
|
disabled: isDisabled,
|
|
91
91
|
apiKey: isDisabled ? void 0 : (_a = config.apiKey) != null ? _a : process.env.LANGWATCH_API_KEY,
|
|
92
|
-
endpoint: isDisabled ? void 0 : (_c = (_b = config.endpoint) != null ? _b : process.env.LANGWATCH_ENDPOINT) != null ? _c :
|
|
92
|
+
endpoint: isDisabled ? void 0 : (_c = (_b = config.endpoint) != null ? _b : process.env.LANGWATCH_ENDPOINT) != null ? _c : _chunk5HAVK64Qjs.DEFAULT_ENDPOINT,
|
|
93
93
|
processorType: (_d = config.processorType) != null ? _d : "simple"
|
|
94
94
|
};
|
|
95
95
|
};
|
|
@@ -143,11 +143,11 @@ var warnIfMisconfigured = (options, langwatch, logger) => {
|
|
|
143
143
|
};
|
|
144
144
|
function setupObservability(options = {}) {
|
|
145
145
|
var _a, _b, _c, _d, _e;
|
|
146
|
-
const logger = (_d = (_a = options.debug) == null ? void 0 : _a.logger) != null ? _d : new (0,
|
|
146
|
+
const logger = (_d = (_a = options.debug) == null ? void 0 : _a.logger) != null ? _d : new (0, _chunkCKIZDPIJjs.ConsoleLogger)({
|
|
147
147
|
level: (_c = (_b = options.debug) == null ? void 0 : _b.logLevel) != null ? _c : "warn",
|
|
148
148
|
prefix: "LangWatch Observability SDK"
|
|
149
149
|
});
|
|
150
|
-
|
|
150
|
+
_chunkCKIZDPIJjs.initializeObservabilitySdkConfig.call(void 0, {
|
|
151
151
|
logger,
|
|
152
152
|
dataCapture: options.dataCapture
|
|
153
153
|
});
|
|
@@ -196,11 +196,11 @@ function createAndStartNodeSdk(options, logger, resource) {
|
|
|
196
196
|
logger.debug("Console recording of logs enabled; adding console log record processor");
|
|
197
197
|
}
|
|
198
198
|
if (!langwatch.disabled) {
|
|
199
|
-
const traceExporter = new (0,
|
|
199
|
+
const traceExporter = new (0, _chunkJ55AV2YWjs.LangWatchTraceExporter)({
|
|
200
200
|
apiKey: langwatch.apiKey,
|
|
201
201
|
endpoint: langwatch.endpoint
|
|
202
202
|
});
|
|
203
|
-
const logExporter = new (0,
|
|
203
|
+
const logExporter = new (0, _chunkJ55AV2YWjs.LangWatchLogsExporter)({
|
|
204
204
|
apiKey: langwatch.apiKey,
|
|
205
205
|
endpoint: langwatch.endpoint
|
|
206
206
|
});
|
|
@@ -253,7 +253,7 @@ function createAndStartNodeSdk(options, logger, resource) {
|
|
|
253
253
|
sdk.start();
|
|
254
254
|
logger.info("NodeSDK started successfully");
|
|
255
255
|
if (loggerProvider) {
|
|
256
|
-
|
|
256
|
+
_chunkJ55AV2YWjs.setLangWatchLoggerProvider.call(void 0, loggerProvider);
|
|
257
257
|
logger.debug("Set LangWatch logger provider");
|
|
258
258
|
}
|
|
259
259
|
if (!((_e = options.advanced) == null ? void 0 : _e.disableAutoShutdown)) {
|
|
@@ -2,21 +2,21 @@ import {
|
|
|
2
2
|
LangWatchLogsExporter,
|
|
3
3
|
LangWatchTraceExporter,
|
|
4
4
|
setLangWatchLoggerProvider
|
|
5
|
-
} from "../../../chunk-
|
|
5
|
+
} from "../../../chunk-7MG7DGPP.mjs";
|
|
6
6
|
import {
|
|
7
7
|
DEFAULT_ENDPOINT,
|
|
8
8
|
DEFAULT_SERVICE_NAME,
|
|
9
9
|
LANGWATCH_SDK_LANGUAGE,
|
|
10
10
|
LANGWATCH_SDK_NAME_OBSERVABILITY,
|
|
11
11
|
LANGWATCH_SDK_VERSION
|
|
12
|
-
} from "../../../chunk-
|
|
12
|
+
} from "../../../chunk-7VHZNB2S.mjs";
|
|
13
13
|
import {
|
|
14
14
|
ConsoleLogger,
|
|
15
15
|
initializeObservabilitySdkConfig
|
|
16
|
-
} from "../../../chunk-
|
|
16
|
+
} from "../../../chunk-I2SOBPAF.mjs";
|
|
17
17
|
import {
|
|
18
18
|
__spreadValues
|
|
19
|
-
} from "../../../chunk-
|
|
19
|
+
} from "../../../chunk-URTD2WOC.mjs";
|
|
20
20
|
|
|
21
21
|
// src/observability-sdk/setup/node/setup.ts
|
|
22
22
|
import { NodeSDK } from "@opentelemetry/sdk-node";
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
PromptsError
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-EPGKOTSN.mjs";
|
|
4
|
+
import "./chunk-FEL5FLHA.mjs";
|
|
5
|
+
import "./chunk-UNMZPS55.mjs";
|
|
6
|
+
import "./chunk-7MG7DGPP.mjs";
|
|
7
|
+
import "./chunk-7VHZNB2S.mjs";
|
|
8
|
+
import "./chunk-I2SOBPAF.mjs";
|
|
9
9
|
import {
|
|
10
10
|
FileManager
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-V5M3HUBV.mjs";
|
|
11
|
+
} from "./chunk-PYVDTUA6.mjs";
|
|
13
12
|
import "./chunk-BTBSMJTY.mjs";
|
|
14
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-URTD2WOC.mjs";
|
|
15
14
|
|
|
16
15
|
// src/cli/commands/remove.ts
|
|
17
16
|
import * as fs from "fs";
|
|
@@ -107,4 +106,4 @@ var removeCommand = async (name) => {
|
|
|
107
106
|
export {
|
|
108
107
|
removeCommand
|
|
109
108
|
};
|
|
110
|
-
//# sourceMappingURL=remove-
|
|
109
|
+
//# sourceMappingURL=remove-IVFQAHNT.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cli/commands/remove.ts"],"sourcesContent":["import * as fs from \"fs\";\nimport * as path from \"path\";\nimport chalk from \"chalk\";\nimport ora from \"ora\";\nimport { FileManager } from \"../utils/fileManager\";\nimport { PromptsError } from \"@/client-sdk/services/prompts\";\n\nexport const removeCommand = async (name: string): Promise<void> => {\n try {\n // Validate prompt name\n if (!name || name.trim() === \"\") {\n console.error(chalk.red(\"Error: Prompt name cannot be empty\"));\n process.exit(1);\n }\n\n // Load existing config and lock\n const config = FileManager.loadPromptsConfig();\n const lock = FileManager.loadPromptsLock();\n\n // Check if prompt exists in dependencies\n if (!config.prompts[name]) {\n console.error(chalk.red(`Error: Prompt \"${name}\" not found in dependencies`));\n console.log(chalk.gray(`Available prompts: ${Object.keys(config.prompts).join(', ') || 'none'}`));\n process.exit(1);\n }\n\n const dependency = config.prompts[name];\n const isLocalPrompt = (typeof dependency === \"string\" && dependency.startsWith(\"file:\")) ||\n (typeof dependency === \"object\" && dependency.file);\n\n const spinner = ora(`Removing ${chalk.cyan(name)}...`).start();\n\n try {\n // Handle local prompts\n if (isLocalPrompt) {\n let localFilePath: string;\n\n if (typeof dependency === \"string\" && dependency.startsWith(\"file:\")) {\n localFilePath = path.resolve(dependency.slice(5)); // Remove \"file:\" prefix\n } else if (typeof dependency === \"object\" && dependency.file) {\n localFilePath = path.resolve(dependency.file);\n } else {\n // Fallback: assume it's in the prompts directory\n localFilePath = path.join(FileManager.getPromptsDir(), `${name}.prompt.yaml`);\n }\n\n // Delete the local file if it exists\n if (fs.existsSync(localFilePath)) {\n fs.unlinkSync(localFilePath);\n const relativePath = path.relative(process.cwd(), localFilePath);\n spinner.succeed();\n console.log(chalk.green(`✓ Removed local file ${chalk.gray(relativePath)}`));\n } else {\n spinner.succeed();\n console.log(chalk.yellow(`⚠ Local file not found (already deleted?)`));\n }\n\n console.log(chalk.yellow(`⚠ Note: This prompt may still exist on the server. Visit LangWatch to fully delete it.`));\n }\n\n // Remove materialized file if it exists\n const lockEntry = lock.prompts[name];\n if (lockEntry?.materialized) {\n const materializedPath = path.resolve(lockEntry.materialized);\n if (fs.existsSync(materializedPath)) {\n fs.unlinkSync(materializedPath);\n\n // Clean up empty directories\n const materializedDir = path.dirname(materializedPath);\n const rootMaterializedDir = FileManager.getMaterializedDir();\n\n let currentDir = materializedDir;\n while (currentDir !== rootMaterializedDir && currentDir !== path.dirname(currentDir)) {\n try {\n const entries = fs.readdirSync(currentDir);\n if (entries.length === 0) {\n fs.rmdirSync(currentDir);\n currentDir = path.dirname(currentDir);\n } else {\n break;\n }\n } catch {\n break;\n }\n }\n }\n }\n\n // Remove from config and lock\n delete config.prompts[name];\n delete lock.prompts[name];\n\n // Save updated files\n FileManager.savePromptsConfig(config);\n FileManager.savePromptsLock(lock);\n\n if (!isLocalPrompt) {\n spinner.succeed();\n console.log(chalk.green(`✓ Removed ${chalk.cyan(name)} from dependencies`));\n }\n\n } catch (error) {\n spinner.fail();\n if (error instanceof PromptsError) {\n console.error(chalk.red(`Error: ${error.message}`));\n } else {\n console.error(chalk.red(`Error removing prompt: ${error instanceof Error ? error.message : \"Unknown error\"}`));\n }\n process.exit(1);\n }\n\n } catch (error) {\n if (error instanceof PromptsError) {\n console.error(chalk.red(`Error: ${error.message}`));\n } else {\n console.error(chalk.red(`Unexpected error: ${error instanceof Error ? error.message : \"Unknown error\"}`));\n }\n process.exit(1);\n }\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/cli/commands/remove.ts"],"sourcesContent":["import * as fs from \"fs\";\nimport * as path from \"path\";\nimport chalk from \"chalk\";\nimport ora from \"ora\";\nimport { FileManager } from \"../utils/fileManager\";\nimport { PromptsError } from \"@/client-sdk/services/prompts\";\n\nexport const removeCommand = async (name: string): Promise<void> => {\n try {\n // Validate prompt name\n if (!name || name.trim() === \"\") {\n console.error(chalk.red(\"Error: Prompt name cannot be empty\"));\n process.exit(1);\n }\n\n // Load existing config and lock\n const config = FileManager.loadPromptsConfig();\n const lock = FileManager.loadPromptsLock();\n\n // Check if prompt exists in dependencies\n if (!config.prompts[name]) {\n console.error(chalk.red(`Error: Prompt \"${name}\" not found in dependencies`));\n console.log(chalk.gray(`Available prompts: ${Object.keys(config.prompts).join(', ') || 'none'}`));\n process.exit(1);\n }\n\n const dependency = config.prompts[name];\n const isLocalPrompt = (typeof dependency === \"string\" && dependency.startsWith(\"file:\")) ||\n (typeof dependency === \"object\" && dependency.file);\n\n const spinner = ora(`Removing ${chalk.cyan(name)}...`).start();\n\n try {\n // Handle local prompts\n if (isLocalPrompt) {\n let localFilePath: string;\n\n if (typeof dependency === \"string\" && dependency.startsWith(\"file:\")) {\n localFilePath = path.resolve(dependency.slice(5)); // Remove \"file:\" prefix\n } else if (typeof dependency === \"object\" && dependency.file) {\n localFilePath = path.resolve(dependency.file);\n } else {\n // Fallback: assume it's in the prompts directory\n localFilePath = path.join(FileManager.getPromptsDir(), `${name}.prompt.yaml`);\n }\n\n // Delete the local file if it exists\n if (fs.existsSync(localFilePath)) {\n fs.unlinkSync(localFilePath);\n const relativePath = path.relative(process.cwd(), localFilePath);\n spinner.succeed();\n console.log(chalk.green(`✓ Removed local file ${chalk.gray(relativePath)}`));\n } else {\n spinner.succeed();\n console.log(chalk.yellow(`⚠ Local file not found (already deleted?)`));\n }\n\n console.log(chalk.yellow(`⚠ Note: This prompt may still exist on the server. Visit LangWatch to fully delete it.`));\n }\n\n // Remove materialized file if it exists\n const lockEntry = lock.prompts[name];\n if (lockEntry?.materialized) {\n const materializedPath = path.resolve(lockEntry.materialized);\n if (fs.existsSync(materializedPath)) {\n fs.unlinkSync(materializedPath);\n\n // Clean up empty directories\n const materializedDir = path.dirname(materializedPath);\n const rootMaterializedDir = FileManager.getMaterializedDir();\n\n let currentDir = materializedDir;\n while (currentDir !== rootMaterializedDir && currentDir !== path.dirname(currentDir)) {\n try {\n const entries = fs.readdirSync(currentDir);\n if (entries.length === 0) {\n fs.rmdirSync(currentDir);\n currentDir = path.dirname(currentDir);\n } else {\n break;\n }\n } catch {\n break;\n }\n }\n }\n }\n\n // Remove from config and lock\n delete config.prompts[name];\n delete lock.prompts[name];\n\n // Save updated files\n FileManager.savePromptsConfig(config);\n FileManager.savePromptsLock(lock);\n\n if (!isLocalPrompt) {\n spinner.succeed();\n console.log(chalk.green(`✓ Removed ${chalk.cyan(name)} from dependencies`));\n }\n\n } catch (error) {\n spinner.fail();\n if (error instanceof PromptsError) {\n console.error(chalk.red(`Error: ${error.message}`));\n } else {\n console.error(chalk.red(`Error removing prompt: ${error instanceof Error ? error.message : \"Unknown error\"}`));\n }\n process.exit(1);\n }\n\n } catch (error) {\n if (error instanceof PromptsError) {\n console.error(chalk.red(`Error: ${error.message}`));\n } else {\n console.error(chalk.red(`Unexpected error: ${error instanceof Error ? error.message : \"Unknown error\"}`));\n }\n process.exit(1);\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;AAAA,YAAY,QAAQ;AACpB,YAAY,UAAU;AACtB,OAAO,WAAW;AAClB,OAAO,SAAS;AAIT,IAAM,gBAAgB,OAAO,SAAgC;AAClE,MAAI;AAEF,QAAI,CAAC,QAAQ,KAAK,KAAK,MAAM,IAAI;AAC/B,cAAQ,MAAM,MAAM,IAAI,oC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