langwatch 0.3.0 → 0.3.2
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 +5 -2
- package/dist/add-LBBS4I3H.js +114 -0
- package/dist/add-LBBS4I3H.js.map +1 -0
- package/dist/add-RD3ZKFAT.mjs +114 -0
- package/dist/add-RD3ZKFAT.mjs.map +1 -0
- package/dist/chunk-2JU376G7.js +242 -0
- package/dist/chunk-2JU376G7.js.map +1 -0
- package/dist/chunk-2ODBGSBI.js +4 -0
- package/dist/{chunk-G3AUABT7.js.map → chunk-2ODBGSBI.js.map} +1 -1
- package/dist/chunk-3GKPQB4R.mjs +242 -0
- package/dist/chunk-3GKPQB4R.mjs.map +1 -0
- package/dist/chunk-4NRLVT2U.mjs +35 -0
- package/dist/chunk-4NRLVT2U.mjs.map +1 -0
- package/dist/{chunk-SVJ7SCGB.js → chunk-52GXX3MA.js} +33 -31
- package/dist/chunk-52GXX3MA.js.map +1 -0
- package/dist/chunk-5NC5ILKA.js +94 -0
- package/dist/chunk-5NC5ILKA.js.map +1 -0
- package/dist/chunk-AAROJADR.mjs +49 -0
- package/dist/chunk-AAROJADR.mjs.map +1 -0
- package/dist/chunk-DHJKJVY7.mjs +20 -0
- package/dist/chunk-DHJKJVY7.mjs.map +1 -0
- package/dist/{chunk-VJSOCNPA.js → chunk-DTEKFQ4U.js} +6 -28
- package/dist/chunk-DTEKFQ4U.js.map +1 -0
- package/dist/chunk-E7UE2MPD.mjs +93 -0
- package/dist/chunk-E7UE2MPD.mjs.map +1 -0
- package/dist/chunk-F6E4XQQU.js +20 -0
- package/dist/chunk-F6E4XQQU.js.map +1 -0
- package/dist/chunk-FJLK5CFL.js +37 -0
- package/dist/chunk-FJLK5CFL.js.map +1 -0
- package/dist/{chunk-Z5J5UI5E.mjs → chunk-GJSEBQXF.mjs} +139 -107
- package/dist/chunk-GJSEBQXF.mjs.map +1 -0
- package/dist/chunk-HA3LI5IK.js +35 -0
- package/dist/chunk-HA3LI5IK.js.map +1 -0
- package/dist/chunk-HJU67C7H.js +93 -0
- package/dist/chunk-HJU67C7H.js.map +1 -0
- package/dist/chunk-IGHXIIIK.js +49 -0
- package/dist/chunk-IGHXIIIK.js.map +1 -0
- package/dist/{chunk-PMBEK6YE.mjs → chunk-J7ICRUU4.mjs} +5 -3
- package/dist/{chunk-PMBEK6YE.mjs.map → chunk-J7ICRUU4.mjs.map} +1 -1
- package/dist/{chunk-HPC6Z7J4.js → chunk-PWZBLTHR.js} +3 -3
- package/dist/{chunk-HPC6Z7J4.js.map → chunk-PWZBLTHR.js.map} +1 -1
- package/dist/chunk-SMXXAVMB.js +100 -0
- package/dist/chunk-SMXXAVMB.js.map +1 -0
- package/dist/{chunk-CSC3CMIT.mjs → chunk-STV4ZVNA.mjs} +2 -2
- package/dist/chunk-T5AZMMVS.mjs +94 -0
- package/dist/chunk-T5AZMMVS.mjs.map +1 -0
- package/dist/{chunk-4BZATFKJ.mjs → chunk-UU33HCCZ.mjs} +4 -26
- package/dist/{chunk-4BZATFKJ.mjs.map → chunk-UU33HCCZ.mjs.map} +1 -1
- package/dist/{chunk-PTJ6AAI7.js → chunk-VGHLQXKB.js} +138 -106
- package/dist/chunk-VGHLQXKB.js.map +1 -0
- package/dist/chunk-W5ZEP3CI.mjs +100 -0
- package/dist/chunk-W5ZEP3CI.mjs.map +1 -0
- package/dist/chunk-Y666BJA5.mjs +4 -0
- package/dist/chunk-YN4436PK.mjs +37 -0
- package/dist/chunk-YN4436PK.mjs.map +1 -0
- package/dist/cli/index.d.mts +1 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +106 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/index.mjs +106 -0
- package/dist/cli/index.mjs.map +1 -0
- package/dist/client-browser.js +15 -10
- package/dist/client-browser.js.map +1 -1
- package/dist/client-browser.mjs +9 -4
- package/dist/client-browser.mjs.map +1 -1
- package/dist/client-node.js +14 -9
- package/dist/client-node.js.map +1 -1
- package/dist/client-node.mjs +11 -6
- package/dist/client-node.mjs.map +1 -1
- package/dist/create-G5MTGOOH.js +70 -0
- package/dist/create-G5MTGOOH.js.map +1 -0
- package/dist/create-QUZYBMQB.mjs +70 -0
- package/dist/create-QUZYBMQB.mjs.map +1 -0
- package/dist/evaluation/index.js +5 -4
- package/dist/evaluation/index.js.map +1 -1
- package/dist/evaluation/index.mjs +4 -3
- package/dist/index.d.mts +21 -14
- package/dist/index.d.ts +21 -14
- package/dist/index.js +10 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -6
- package/dist/init-H67RW22E.mjs +16 -0
- package/dist/init-H67RW22E.mjs.map +1 -0
- package/dist/init-XU2JFY6N.js +16 -0
- package/dist/init-XU2JFY6N.js.map +1 -0
- package/dist/list-7NPSX2E4.mjs +136 -0
- package/dist/list-7NPSX2E4.mjs.map +1 -0
- package/dist/list-ZXFLAF52.js +136 -0
- package/dist/list-ZXFLAF52.js.map +1 -0
- package/dist/login-76NQIHKR.js +110 -0
- package/dist/login-76NQIHKR.js.map +1 -0
- package/dist/login-EK4WVOI2.mjs +110 -0
- package/dist/login-EK4WVOI2.mjs.map +1 -0
- package/dist/observability/index.d.mts +3 -3
- package/dist/observability/index.d.ts +3 -3
- package/dist/observability/index.js +5 -4
- package/dist/observability/index.js.map +1 -1
- package/dist/observability/index.mjs +4 -3
- package/dist/observability/instrumentation/langchain/index.d.mts +2 -2
- package/dist/observability/instrumentation/langchain/index.d.ts +2 -2
- package/dist/observability/instrumentation/langchain/index.js +29 -27
- package/dist/observability/instrumentation/langchain/index.js.map +1 -1
- package/dist/observability/instrumentation/langchain/index.mjs +5 -3
- package/dist/observability/instrumentation/langchain/index.mjs.map +1 -1
- package/dist/prompt/index.d.mts +2 -2
- package/dist/prompt/index.d.ts +2 -2
- package/dist/prompt/index.js +8 -4
- package/dist/prompt/index.js.map +1 -1
- package/dist/prompt/index.mjs +10 -6
- package/dist/{prompt-BXJWdbQp.d.mts → prompt-D-jpMrLS.d.mts} +245 -0
- package/dist/{prompt-BXJWdbQp.d.ts → prompt-D-jpMrLS.d.ts} +245 -0
- package/dist/remove-SDJYEPAY.mjs +106 -0
- package/dist/remove-SDJYEPAY.mjs.map +1 -0
- package/dist/remove-XBNGIVMR.js +106 -0
- package/dist/remove-XBNGIVMR.js.map +1 -0
- package/dist/sync-EISKGPTL.js +403 -0
- package/dist/sync-EISKGPTL.js.map +1 -0
- package/dist/sync-ST2IWXSB.mjs +403 -0
- package/dist/sync-ST2IWXSB.mjs.map +1 -0
- package/dist/{trace-G2312klE.d.ts → trace-CqaKo0kZ.d.ts} +1 -1
- package/dist/{trace-D-bZOuqb.d.mts → trace-DtVc5GhF.d.mts} +1 -1
- package/package.json +23 -12
- package/dist/chunk-76KNOWLS.js +0 -39
- package/dist/chunk-76KNOWLS.js.map +0 -1
- package/dist/chunk-G3AUABT7.js +0 -4
- package/dist/chunk-OM7VY3XT.mjs +0 -4
- package/dist/chunk-PTJ6AAI7.js.map +0 -1
- package/dist/chunk-SVJ7SCGB.js.map +0 -1
- package/dist/chunk-VJSOCNPA.js.map +0 -1
- package/dist/chunk-X62YT4WB.mjs +0 -39
- package/dist/chunk-X62YT4WB.mjs.map +0 -1
- package/dist/chunk-Z5J5UI5E.mjs.map +0 -1
- /package/dist/{chunk-CSC3CMIT.mjs.map → chunk-STV4ZVNA.mjs.map} +0 -0
- /package/dist/{chunk-OM7VY3XT.mjs.map → chunk-Y666BJA5.mjs.map} +0 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ensureProjectInitialized
|
|
3
|
+
} from "./chunk-E7UE2MPD.mjs";
|
|
4
|
+
import {
|
|
5
|
+
FileManager
|
|
6
|
+
} from "./chunk-3GKPQB4R.mjs";
|
|
7
|
+
import {
|
|
8
|
+
checkApiKey
|
|
9
|
+
} from "./chunk-DHJKJVY7.mjs";
|
|
10
|
+
import "./chunk-4NRLVT2U.mjs";
|
|
11
|
+
import "./chunk-W5ZEP3CI.mjs";
|
|
12
|
+
import "./chunk-YN4436PK.mjs";
|
|
13
|
+
|
|
14
|
+
// src/cli/commands/create.ts
|
|
15
|
+
import * as fs from "fs";
|
|
16
|
+
import * as path from "path";
|
|
17
|
+
import chalk from "chalk";
|
|
18
|
+
var createCommand = async (name, options) => {
|
|
19
|
+
try {
|
|
20
|
+
if (!name || name.trim() === "") {
|
|
21
|
+
console.error(chalk.red("Error: Prompt name cannot be empty"));
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
checkApiKey();
|
|
25
|
+
await ensureProjectInitialized();
|
|
26
|
+
const promptPath = path.join(process.cwd(), "prompts", `${name}.prompt.yaml`);
|
|
27
|
+
if (fs.existsSync(promptPath)) {
|
|
28
|
+
console.error(chalk.red(`Error: Prompt file already exists at ${promptPath}`));
|
|
29
|
+
process.exit(1);
|
|
30
|
+
}
|
|
31
|
+
const promptsDir = path.dirname(promptPath);
|
|
32
|
+
if (!fs.existsSync(promptsDir)) {
|
|
33
|
+
fs.mkdirSync(promptsDir, { recursive: true });
|
|
34
|
+
}
|
|
35
|
+
const defaultContent = `model: openai/gpt-4o-mini
|
|
36
|
+
modelParameters:
|
|
37
|
+
temperature: 0.7
|
|
38
|
+
messages:
|
|
39
|
+
- role: system
|
|
40
|
+
content: You are a helpful assistant.
|
|
41
|
+
- role: user
|
|
42
|
+
content: "{{input}}"
|
|
43
|
+
`;
|
|
44
|
+
fs.writeFileSync(promptPath, defaultContent, "utf8");
|
|
45
|
+
const promptsConfig = FileManager.loadPromptsConfig();
|
|
46
|
+
const relativePath = path.relative(process.cwd(), promptPath);
|
|
47
|
+
promptsConfig.prompts[name] = `file:${relativePath}`;
|
|
48
|
+
FileManager.savePromptsConfig(promptsConfig);
|
|
49
|
+
const lock = FileManager.loadPromptsLock();
|
|
50
|
+
lock.prompts[name] = {
|
|
51
|
+
version: 0,
|
|
52
|
+
// Local files start at version 0
|
|
53
|
+
versionId: "local",
|
|
54
|
+
materialized: relativePath
|
|
55
|
+
// Store the original file path
|
|
56
|
+
};
|
|
57
|
+
FileManager.savePromptsLock(lock);
|
|
58
|
+
const displayPath = `./${relativePath}`;
|
|
59
|
+
console.log(chalk.green(`\u2713 Created prompt file: ${chalk.cyan(displayPath)}`));
|
|
60
|
+
console.log(chalk.gray(` Edit this file and then run:`));
|
|
61
|
+
console.log(chalk.cyan(` langwatch prompt sync`));
|
|
62
|
+
} catch (error) {
|
|
63
|
+
console.error(chalk.red("Unexpected error:"), error instanceof Error ? error.message : error);
|
|
64
|
+
process.exit(1);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
export {
|
|
68
|
+
createCommand
|
|
69
|
+
};
|
|
70
|
+
//# sourceMappingURL=create-QUZYBMQB.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cli/commands/create.ts"],"sourcesContent":["import * as fs from \"fs\";\nimport * as path from \"path\";\nimport chalk from \"chalk\";\nimport { FileManager } from \"../utils/fileManager\";\nimport { checkApiKey } from \"../utils/apiKey\";\nimport { ensureProjectInitialized } from \"../utils/init\";\n\ninterface CreateOptions {\n // Future options can be added here\n}\n\nexport const createCommand = async (name: string, options: CreateOptions): 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 // Check API key before doing anything else\n checkApiKey();\n\n // Ensure project is initialized\n await ensureProjectInitialized();\n\n // Check if file already exists\n const promptPath = path.join(process.cwd(), \"prompts\", `${name}.prompt.yaml`);\n\n if (fs.existsSync(promptPath)) {\n console.error(chalk.red(`Error: Prompt file already exists at ${promptPath}`));\n process.exit(1);\n }\n\n // Create prompts directory if it doesn't exist\n const promptsDir = path.dirname(promptPath);\n if (!fs.existsSync(promptsDir)) {\n fs.mkdirSync(promptsDir, { recursive: true });\n }\n\n // Default prompt content\n const defaultContent = `model: openai/gpt-4o-mini\nmodelParameters:\n temperature: 0.7\nmessages:\n - role: system\n content: You are a helpful assistant.\n - role: user\n content: \"{{input}}\"\n`;\n\n // Write the file\n fs.writeFileSync(promptPath, defaultContent, \"utf8\");\n\n // Add to prompts.json as a file: dependency\n const promptsConfig = FileManager.loadPromptsConfig();\n const relativePath = path.relative(process.cwd(), promptPath);\n promptsConfig.prompts[name] = `file:${relativePath}`;\n FileManager.savePromptsConfig(promptsConfig);\n\n // Update lock file\n const lock = FileManager.loadPromptsLock();\n lock.prompts[name] = {\n version: 0, // Local files start at version 0\n versionId: \"local\",\n materialized: relativePath, // Store the original file path\n };\n FileManager.savePromptsLock(lock);\n\n const displayPath = `./${relativePath}`;\n console.log(chalk.green(`✓ Created prompt file: ${chalk.cyan(displayPath)}`));\n console.log(chalk.gray(` Edit this file and then run:`));\n console.log(chalk.cyan(` langwatch prompt sync`));\n\n } catch (error) {\n console.error(chalk.red(\"Unexpected error:\"), error instanceof Error ? error.message : error);\n process.exit(1);\n }\n};"],"mappings":";;;;;;;;;;;;;;AAAA,YAAY,QAAQ;AACpB,YAAY,UAAU;AACtB,OAAO,WAAW;AASX,IAAM,gBAAgB,OAAO,MAAc,YAA0C;AAC1F,MAAI;AAEF,QAAI,CAAC,QAAQ,KAAK,KAAK,MAAM,IAAI;AAC/B,cAAQ,MAAM,MAAM,IAAI,oCAAoC,CAAC;AAC7D,cAAQ,KAAK,CAAC;AAAA,IAChB;AAGA,gBAAY;AAGZ,UAAM,yBAAyB;AAG/B,UAAM,aAAkB,UAAK,QAAQ,IAAI,GAAG,WAAW,GAAG,IAAI,cAAc;AAE5E,QAAO,cAAW,UAAU,GAAG;AAC7B,cAAQ,MAAM,MAAM,IAAI,wCAAwC,UAAU,EAAE,CAAC;AAC7E,cAAQ,KAAK,CAAC;AAAA,IAChB;AAGA,UAAM,aAAkB,aAAQ,UAAU;AAC1C,QAAI,CAAI,cAAW,UAAU,GAAG;AAC9B,MAAG,aAAU,YAAY,EAAE,WAAW,KAAK,CAAC;AAAA,IAC9C;AAGA,UAAM,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWvB,IAAG,iBAAc,YAAY,gBAAgB,MAAM;AAGnD,UAAM,gBAAgB,YAAY,kBAAkB;AACpD,UAAM,eAAoB,cAAS,QAAQ,IAAI,GAAG,UAAU;AAC5D,kBAAc,QAAQ,IAAI,IAAI,QAAQ,YAAY;AAClD,gBAAY,kBAAkB,aAAa;AAG3C,UAAM,OAAO,YAAY,gBAAgB;AACzC,SAAK,QAAQ,IAAI,IAAI;AAAA,MACnB,SAAS;AAAA;AAAA,MACT,WAAW;AAAA,MACX,cAAc;AAAA;AAAA,IAChB;AACA,gBAAY,gBAAgB,IAAI;AAEhC,UAAM,cAAc,KAAK,YAAY;AACrC,YAAQ,IAAI,MAAM,MAAM,+BAA0B,MAAM,KAAK,WAAW,CAAC,EAAE,CAAC;AAC5E,YAAQ,IAAI,MAAM,KAAK,gCAAgC,CAAC;AACxD,YAAQ,IAAI,MAAM,KAAK,yBAAyB,CAAC;AAAA,EAEnD,SAAS,OAAO;AACd,YAAQ,MAAM,MAAM,IAAI,mBAAmB,GAAG,iBAAiB,QAAQ,MAAM,UAAU,KAAK;AAC5F,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF;","names":[]}
|
package/dist/evaluation/index.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkPWZBLTHRjs = require('../chunk-PWZBLTHR.js');
|
|
4
4
|
require('../chunk-PCQVQ7SB.js');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
8
|
-
require('../chunk-
|
|
7
|
+
var _chunk52GXX3MAjs = require('../chunk-52GXX3MA.js');
|
|
8
|
+
require('../chunk-DTEKFQ4U.js');
|
|
9
|
+
require('../chunk-FJLK5CFL.js');
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
|
|
12
|
-
exports.recordEvaluation =
|
|
13
|
+
exports.recordEvaluation = _chunk52GXX3MAjs.recordEvaluation; exports.runEvaluation = _chunkPWZBLTHRjs.runEvaluation;
|
|
13
14
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/langwatch/langwatch/typescript-sdk/dist/evaluation/index.js"],"names":[],"mappings":"AAAA;AACE;AACF,uDAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACF,uDAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACA;AACF,qHAAC","file":"/home/runner/work/langwatch/langwatch/typescript-sdk/dist/evaluation/index.js"}
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/langwatch/langwatch/typescript-sdk/dist/evaluation/index.js"],"names":[],"mappings":"AAAA;AACE;AACF,uDAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACF,uDAA6B;AAC7B,gCAA6B;AAC7B,gCAA6B;AAC7B;AACE;AACA;AACF,qHAAC","file":"/home/runner/work/langwatch/langwatch/typescript-sdk/dist/evaluation/index.js"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runEvaluation
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-STV4ZVNA.mjs";
|
|
4
4
|
import "../chunk-QEWDG5QE.mjs";
|
|
5
5
|
import {
|
|
6
6
|
recordEvaluation
|
|
7
|
-
} from "../chunk-
|
|
8
|
-
import "../chunk-
|
|
7
|
+
} from "../chunk-J7ICRUU4.mjs";
|
|
8
|
+
import "../chunk-UU33HCCZ.mjs";
|
|
9
|
+
import "../chunk-YN4436PK.mjs";
|
|
9
10
|
export {
|
|
10
11
|
recordEvaluation,
|
|
11
12
|
runEvaluation
|
package/dist/index.d.mts
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
export { L as LangWatchSpan, g as getLangWatchTracer } from './trace-
|
|
1
|
+
export { L as LangWatchSpan, g as getLangWatchTracer } from './trace-DtVc5GhF.mjs';
|
|
2
2
|
export { F as FilterableBatchSpanProcessor, S as SpanProcessingExcludeRule } from './filterable-batch-span-processor-zO5kcjBY.mjs';
|
|
3
3
|
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';
|
|
4
4
|
export { runEvaluation } from './evaluation/index.mjs';
|
|
5
5
|
export { r as recordEvaluation } from './record-evaluation-CmxMXa-3.mjs';
|
|
6
6
|
export { getPrompt, getPromptVersion } from './prompt/index.mjs';
|
|
7
7
|
import '@opentelemetry/api';
|
|
8
|
-
import './prompt-
|
|
8
|
+
import './prompt-D-jpMrLS.mjs';
|
|
9
9
|
import '@opentelemetry/sdk-trace-base';
|
|
10
10
|
|
|
11
|
+
interface LangWatchExporterOptions {
|
|
12
|
+
endpoint?: string;
|
|
13
|
+
apiKey?: string;
|
|
14
|
+
includeAllSpans?: boolean;
|
|
15
|
+
debug?: boolean;
|
|
16
|
+
}
|
|
11
17
|
/**
|
|
12
18
|
* LangWatchExporter extends the OpenTelemetry OTLP HTTP trace exporter
|
|
13
19
|
* to send trace data to LangWatch with proper authentication and metadata headers.
|
|
@@ -24,25 +30,26 @@ import '@opentelemetry/sdk-trace-base';
|
|
|
24
30
|
* // Using environment variables/fallback configuration
|
|
25
31
|
* const exporter = new LangWatchExporter();
|
|
26
32
|
*
|
|
27
|
-
* // Using custom
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* // With custom API key and endpoint
|
|
33
|
-
* const exporter = new LangWatchExporter('api-key', 'https://custom.langwatch.com');
|
|
33
|
+
* // Using custom options
|
|
34
|
+
* const exporter = new LangWatchExporter({
|
|
35
|
+
* apiKey: 'your-api-key',
|
|
36
|
+
* endpoint: 'https://custom.langwatch.com'
|
|
37
|
+
* });
|
|
34
38
|
* ```
|
|
35
39
|
*/
|
|
36
40
|
declare class LangWatchExporter extends OTLPTraceExporter {
|
|
37
41
|
/**
|
|
38
42
|
* Creates a new LangWatchExporter instance.
|
|
39
43
|
*
|
|
40
|
-
* @param
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
+
* @param opts - Optional configuration options for the exporter
|
|
45
|
+
* @param opts.apiKey - Optional API key for LangWatch authentication. If not provided,
|
|
46
|
+
* will use environment variables or fallback configuration.
|
|
47
|
+
* @param opts.endpoint - Optional custom endpoint URL for LangWatch ingestion.
|
|
48
|
+
* If not provided, will use environment variables or fallback configuration.
|
|
49
|
+
* @param opts.includeAllSpans - Deprecated: This option is deprecated and will be removed in a future version
|
|
50
|
+
* @param opts.debug - Deprecated: This option is deprecated and will be removed in a future version
|
|
44
51
|
*/
|
|
45
|
-
constructor(
|
|
52
|
+
constructor(opts?: LangWatchExporterOptions);
|
|
46
53
|
}
|
|
47
54
|
|
|
48
55
|
export { LangWatchExporter };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
export { L as LangWatchSpan, g as getLangWatchTracer } from './trace-
|
|
1
|
+
export { L as LangWatchSpan, g as getLangWatchTracer } from './trace-CqaKo0kZ.js';
|
|
2
2
|
export { F as FilterableBatchSpanProcessor, S as SpanProcessingExcludeRule } from './filterable-batch-span-processor-zO5kcjBY.js';
|
|
3
3
|
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';
|
|
4
4
|
export { runEvaluation } from './evaluation/index.js';
|
|
5
5
|
export { r as recordEvaluation } from './record-evaluation-CmxMXa-3.js';
|
|
6
6
|
export { getPrompt, getPromptVersion } from './prompt/index.js';
|
|
7
7
|
import '@opentelemetry/api';
|
|
8
|
-
import './prompt-
|
|
8
|
+
import './prompt-D-jpMrLS.js';
|
|
9
9
|
import '@opentelemetry/sdk-trace-base';
|
|
10
10
|
|
|
11
|
+
interface LangWatchExporterOptions {
|
|
12
|
+
endpoint?: string;
|
|
13
|
+
apiKey?: string;
|
|
14
|
+
includeAllSpans?: boolean;
|
|
15
|
+
debug?: boolean;
|
|
16
|
+
}
|
|
11
17
|
/**
|
|
12
18
|
* LangWatchExporter extends the OpenTelemetry OTLP HTTP trace exporter
|
|
13
19
|
* to send trace data to LangWatch with proper authentication and metadata headers.
|
|
@@ -24,25 +30,26 @@ import '@opentelemetry/sdk-trace-base';
|
|
|
24
30
|
* // Using environment variables/fallback configuration
|
|
25
31
|
* const exporter = new LangWatchExporter();
|
|
26
32
|
*
|
|
27
|
-
* // Using custom
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* // With custom API key and endpoint
|
|
33
|
-
* const exporter = new LangWatchExporter('api-key', 'https://custom.langwatch.com');
|
|
33
|
+
* // Using custom options
|
|
34
|
+
* const exporter = new LangWatchExporter({
|
|
35
|
+
* apiKey: 'your-api-key',
|
|
36
|
+
* endpoint: 'https://custom.langwatch.com'
|
|
37
|
+
* });
|
|
34
38
|
* ```
|
|
35
39
|
*/
|
|
36
40
|
declare class LangWatchExporter extends OTLPTraceExporter {
|
|
37
41
|
/**
|
|
38
42
|
* Creates a new LangWatchExporter instance.
|
|
39
43
|
*
|
|
40
|
-
* @param
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
+
* @param opts - Optional configuration options for the exporter
|
|
45
|
+
* @param opts.apiKey - Optional API key for LangWatch authentication. If not provided,
|
|
46
|
+
* will use environment variables or fallback configuration.
|
|
47
|
+
* @param opts.endpoint - Optional custom endpoint URL for LangWatch ingestion.
|
|
48
|
+
* If not provided, will use environment variables or fallback configuration.
|
|
49
|
+
* @param opts.includeAllSpans - Deprecated: This option is deprecated and will be removed in a future version
|
|
50
|
+
* @param opts.debug - Deprecated: This option is deprecated and will be removed in a future version
|
|
44
51
|
*/
|
|
45
|
-
constructor(
|
|
52
|
+
constructor(opts?: LangWatchExporterOptions);
|
|
46
53
|
}
|
|
47
54
|
|
|
48
55
|
export { LangWatchExporter };
|
package/dist/index.js
CHANGED
|
@@ -1,23 +1,26 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkIGHXIIIKjs = require('./chunk-IGHXIIIK.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
7
|
-
require('./chunk-
|
|
6
|
+
var _chunkPWZBLTHRjs = require('./chunk-PWZBLTHR.js');
|
|
7
|
+
require('./chunk-2ODBGSBI.js');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
var _chunkKGDAENGDjs = require('./chunk-KGDAENGD.js');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _chunk5NC5ILKAjs = require('./chunk-5NC5ILKA.js');
|
|
15
|
+
require('./chunk-VGHLQXKB.js');
|
|
16
|
+
require('./chunk-SMXXAVMB.js');
|
|
15
17
|
require('./chunk-PCQVQ7SB.js');
|
|
16
18
|
|
|
17
19
|
|
|
18
20
|
|
|
19
|
-
var
|
|
20
|
-
require('./chunk-
|
|
21
|
+
var _chunk52GXX3MAjs = require('./chunk-52GXX3MA.js');
|
|
22
|
+
require('./chunk-DTEKFQ4U.js');
|
|
23
|
+
require('./chunk-FJLK5CFL.js');
|
|
21
24
|
|
|
22
25
|
|
|
23
26
|
|
|
@@ -26,5 +29,5 @@ require('./chunk-VJSOCNPA.js');
|
|
|
26
29
|
|
|
27
30
|
|
|
28
31
|
|
|
29
|
-
exports.FilterableBatchSpanProcessor = _chunkKGDAENGDjs.FilterableBatchSpanProcessor; exports.LangWatchExporter =
|
|
32
|
+
exports.FilterableBatchSpanProcessor = _chunkKGDAENGDjs.FilterableBatchSpanProcessor; exports.LangWatchExporter = _chunkIGHXIIIKjs.LangWatchExporter; exports.getLangWatchTracer = _chunk52GXX3MAjs.getLangWatchTracer; exports.getPrompt = _chunk5NC5ILKAjs.getPrompt; exports.getPromptVersion = _chunk5NC5ILKAjs.getPromptVersion; exports.recordEvaluation = _chunk52GXX3MAjs.recordEvaluation; exports.runEvaluation = _chunkPWZBLTHRjs.runEvaluation;
|
|
30
33
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/langwatch/langwatch/typescript-sdk/dist/index.js"],"names":[],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B,+BAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACE;AACA;AACF,sDAA4B;AAC5B,+BAA4B;AAC5B;AACE;AACA;AACF,sDAA4B;AAC5B,+BAA4B;AAC5B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACF,2bAAC","file":"/home/runner/work/langwatch/langwatch/typescript-sdk/dist/index.js"}
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/langwatch/langwatch/typescript-sdk/dist/index.js"],"names":[],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B,+BAA4B;AAC5B;AACE;AACF,sDAA4B;AAC5B;AACE;AACA;AACF,sDAA4B;AAC5B,+BAA4B;AAC5B,+BAA4B;AAC5B,+BAA4B;AAC5B;AACE;AACA;AACF,sDAA4B;AAC5B,+BAA4B;AAC5B,+BAA4B;AAC5B;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACF,2bAAC","file":"/home/runner/work/langwatch/langwatch/typescript-sdk/dist/index.js"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,23 +1,26 @@
|
|
|
1
1
|
import {
|
|
2
2
|
LangWatchExporter
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-AAROJADR.mjs";
|
|
4
4
|
import {
|
|
5
5
|
runEvaluation
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-STV4ZVNA.mjs";
|
|
7
|
+
import "./chunk-Y666BJA5.mjs";
|
|
8
8
|
import {
|
|
9
9
|
FilterableBatchSpanProcessor
|
|
10
10
|
} from "./chunk-PR3JDWC3.mjs";
|
|
11
11
|
import {
|
|
12
12
|
getPrompt,
|
|
13
13
|
getPromptVersion
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-T5AZMMVS.mjs";
|
|
15
|
+
import "./chunk-GJSEBQXF.mjs";
|
|
16
|
+
import "./chunk-W5ZEP3CI.mjs";
|
|
15
17
|
import "./chunk-QEWDG5QE.mjs";
|
|
16
18
|
import {
|
|
17
19
|
getLangWatchTracer,
|
|
18
20
|
recordEvaluation
|
|
19
|
-
} from "./chunk-
|
|
20
|
-
import "./chunk-
|
|
21
|
+
} from "./chunk-J7ICRUU4.mjs";
|
|
22
|
+
import "./chunk-UU33HCCZ.mjs";
|
|
23
|
+
import "./chunk-YN4436PK.mjs";
|
|
21
24
|
export {
|
|
22
25
|
FilterableBatchSpanProcessor,
|
|
23
26
|
LangWatchExporter,
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
initializeProject
|
|
3
|
+
} from "./chunk-E7UE2MPD.mjs";
|
|
4
|
+
import "./chunk-3GKPQB4R.mjs";
|
|
5
|
+
import "./chunk-4NRLVT2U.mjs";
|
|
6
|
+
import "./chunk-W5ZEP3CI.mjs";
|
|
7
|
+
import "./chunk-YN4436PK.mjs";
|
|
8
|
+
|
|
9
|
+
// src/cli/commands/init.ts
|
|
10
|
+
var initCommand = async () => {
|
|
11
|
+
await initializeProject();
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
initCommand
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=init-H67RW22E.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cli/commands/init.ts"],"sourcesContent":["import { initializeProject } from \"../utils/init\";\n\nexport const initCommand = async (): Promise<void> => {\n await initializeProject();\n};"],"mappings":";;;;;;;;;AAEO,IAAM,cAAc,YAA2B;AACpD,QAAM,kBAAkB;AAC1B;","names":[]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkHJU67C7Hjs = require('./chunk-HJU67C7H.js');
|
|
4
|
+
require('./chunk-2JU376G7.js');
|
|
5
|
+
require('./chunk-HA3LI5IK.js');
|
|
6
|
+
require('./chunk-SMXXAVMB.js');
|
|
7
|
+
require('./chunk-FJLK5CFL.js');
|
|
8
|
+
|
|
9
|
+
// src/cli/commands/init.ts
|
|
10
|
+
var initCommand = async () => {
|
|
11
|
+
await _chunkHJU67C7Hjs.initializeProject.call(void 0, );
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
exports.initCommand = initCommand;
|
|
16
|
+
//# sourceMappingURL=init-XU2JFY6N.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/langwatch/langwatch/typescript-sdk/dist/init-XU2JFY6N.js","../src/cli/commands/init.ts"],"names":[],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B,+BAA4B;AAC5B,+BAA4B;AAC5B,+BAA4B;AAC5B,+BAA4B;AAC5B;AACA;ACNO,IAAM,YAAA,EAAc,MAAA,CAAA,EAAA,GAA2B;AACpD,EAAA,MAAM,gDAAA,CAAkB;AAC1B,CAAA;ADQA;AACE;AACF,kCAAC","file":"/home/runner/work/langwatch/langwatch/typescript-sdk/dist/init-XU2JFY6N.js","sourcesContent":[null,"import { initializeProject } from \"../utils/init\";\n\nexport const initCommand = async (): Promise<void> => {\n await initializeProject();\n};"]}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import {
|
|
2
|
+
checkApiKey
|
|
3
|
+
} from "./chunk-DHJKJVY7.mjs";
|
|
4
|
+
import {
|
|
5
|
+
PromptService,
|
|
6
|
+
PromptsError
|
|
7
|
+
} from "./chunk-GJSEBQXF.mjs";
|
|
8
|
+
import "./chunk-W5ZEP3CI.mjs";
|
|
9
|
+
import "./chunk-QEWDG5QE.mjs";
|
|
10
|
+
import "./chunk-YN4436PK.mjs";
|
|
11
|
+
|
|
12
|
+
// src/cli/commands/list.ts
|
|
13
|
+
import chalk from "chalk";
|
|
14
|
+
import ora from "ora";
|
|
15
|
+
var stripAnsi = (str) => {
|
|
16
|
+
return str.replace(/\u001b\[[0-9;]*m/g, "");
|
|
17
|
+
};
|
|
18
|
+
var formatTable = (data, headers) => {
|
|
19
|
+
if (data.length === 0) {
|
|
20
|
+
console.log(chalk.gray("No prompts found"));
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const colWidths = {};
|
|
24
|
+
headers.forEach((header) => {
|
|
25
|
+
colWidths[header] = Math.max(
|
|
26
|
+
header.length,
|
|
27
|
+
...data.map((row) => stripAnsi(row[header] || "").length)
|
|
28
|
+
);
|
|
29
|
+
});
|
|
30
|
+
const headerRow = headers.map((header) => chalk.bold(header.padEnd(colWidths[header]))).join(" ");
|
|
31
|
+
console.log(headerRow);
|
|
32
|
+
const separator = headers.map((header) => "\u2500".repeat(colWidths[header])).join(" ");
|
|
33
|
+
console.log(chalk.gray(separator));
|
|
34
|
+
data.forEach((row) => {
|
|
35
|
+
const dataRow = headers.map((header) => {
|
|
36
|
+
const value = row[header] || "";
|
|
37
|
+
const strippedLength = stripAnsi(value).length;
|
|
38
|
+
const paddingNeeded = colWidths[header] - strippedLength;
|
|
39
|
+
const paddedValue = value + " ".repeat(Math.max(0, paddingNeeded));
|
|
40
|
+
if (header === "Name") {
|
|
41
|
+
return chalk.cyan(paddedValue);
|
|
42
|
+
} else if (header === "Version") {
|
|
43
|
+
return chalk.green(paddedValue);
|
|
44
|
+
} else if (header === "Model") {
|
|
45
|
+
return chalk.yellow(paddedValue);
|
|
46
|
+
} else {
|
|
47
|
+
return chalk.gray(paddedValue);
|
|
48
|
+
}
|
|
49
|
+
}).join(" ");
|
|
50
|
+
console.log(dataRow);
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
var formatRelativeTime = (dateString) => {
|
|
54
|
+
const date = new Date(dateString);
|
|
55
|
+
const now = /* @__PURE__ */ new Date();
|
|
56
|
+
const diffMs = now.getTime() - date.getTime();
|
|
57
|
+
const seconds = Math.floor(diffMs / 1e3);
|
|
58
|
+
const minutes = Math.floor(seconds / 60);
|
|
59
|
+
const hours = Math.floor(minutes / 60);
|
|
60
|
+
const days = Math.floor(hours / 24);
|
|
61
|
+
const months = Math.floor(days / 30);
|
|
62
|
+
const years = Math.floor(days / 365);
|
|
63
|
+
if (years > 0) return `${years}y ago`;
|
|
64
|
+
if (months > 0) return `${months}mo ago`;
|
|
65
|
+
if (days > 0) return `${days}d ago`;
|
|
66
|
+
if (hours > 0) return `${hours}h ago`;
|
|
67
|
+
if (minutes > 0) return `${minutes}m ago`;
|
|
68
|
+
return `${seconds}s ago`;
|
|
69
|
+
};
|
|
70
|
+
var listCommand = async () => {
|
|
71
|
+
try {
|
|
72
|
+
checkApiKey();
|
|
73
|
+
const promptService = PromptService.getInstance();
|
|
74
|
+
const spinner = ora("Fetching prompts from server...").start();
|
|
75
|
+
try {
|
|
76
|
+
const allPrompts = await promptService.getAll();
|
|
77
|
+
const prompts = allPrompts.filter((prompt) => prompt.version);
|
|
78
|
+
const draftPrompts = allPrompts.filter((prompt) => !prompt.version);
|
|
79
|
+
spinner.succeed(
|
|
80
|
+
`Found ${prompts.length} published prompt${prompts.length !== 1 ? "s" : ""} ` + chalk.gray(
|
|
81
|
+
`(+${draftPrompts.length} draft${draftPrompts.length !== 1 ? "s" : ""})`
|
|
82
|
+
)
|
|
83
|
+
);
|
|
84
|
+
if (prompts.length === 0) {
|
|
85
|
+
console.log();
|
|
86
|
+
console.log(chalk.gray("No prompts found on the server."));
|
|
87
|
+
console.log(chalk.gray("Create your first prompt with:"));
|
|
88
|
+
console.log(chalk.cyan(" langwatch prompt init"));
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
console.log();
|
|
92
|
+
const tableData = prompts.map((prompt) => ({
|
|
93
|
+
Name: prompt.handle || `${prompt.name} ` + chalk.gray(`(${prompt.id})`),
|
|
94
|
+
Version: prompt.version ? `${prompt.version}` : "N/A",
|
|
95
|
+
Model: prompt.model || "N/A",
|
|
96
|
+
Updated: formatRelativeTime(prompt.updatedAt)
|
|
97
|
+
}));
|
|
98
|
+
formatTable(tableData, ["Name", "Version", "Model", "Updated"]);
|
|
99
|
+
console.log();
|
|
100
|
+
console.log(
|
|
101
|
+
chalk.gray(
|
|
102
|
+
`Use ${chalk.cyan(
|
|
103
|
+
"langwatch prompt add <name>"
|
|
104
|
+
)} to add a prompt to your project`
|
|
105
|
+
)
|
|
106
|
+
);
|
|
107
|
+
} catch (error) {
|
|
108
|
+
spinner.fail();
|
|
109
|
+
if (error instanceof PromptsError) {
|
|
110
|
+
console.error(chalk.red(`Error: ${error.message}`));
|
|
111
|
+
} else {
|
|
112
|
+
console.error(
|
|
113
|
+
chalk.red(
|
|
114
|
+
`Error fetching prompts: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
115
|
+
)
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
process.exit(1);
|
|
119
|
+
}
|
|
120
|
+
} catch (error) {
|
|
121
|
+
if (error instanceof PromptsError) {
|
|
122
|
+
console.error(chalk.red(`Error: ${error.message}`));
|
|
123
|
+
} else {
|
|
124
|
+
console.error(
|
|
125
|
+
chalk.red(
|
|
126
|
+
`Unexpected error: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
127
|
+
)
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
process.exit(1);
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
export {
|
|
134
|
+
listCommand
|
|
135
|
+
};
|
|
136
|
+
//# sourceMappingURL=list-7NPSX2E4.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cli/commands/list.ts"],"sourcesContent":["import chalk from \"chalk\";\nimport ora from \"ora\";\nimport { PromptService, PromptsError } from \"../../prompt/service\";\nimport { checkApiKey } from \"../utils/apiKey\";\n\n// Helper to strip ANSI codes for length calculation\nconst stripAnsi = (str: string): string => {\n return str.replace(/\\u001b\\[[0-9;]*m/g, \"\");\n};\n\n// Simple table formatting helper\nconst formatTable = (\n data: Array<Record<string, string>>,\n headers: string[],\n): void => {\n if (data.length === 0) {\n console.log(chalk.gray(\"No prompts found\"));\n return;\n }\n\n // Calculate column widths (strip ANSI codes for accurate length calculation)\n const colWidths: Record<string, number> = {};\n headers.forEach((header) => {\n colWidths[header] = Math.max(\n header.length,\n ...data.map((row) => stripAnsi(row[header] || \"\").length),\n );\n });\n\n // Print header\n const headerRow = headers\n .map((header) => chalk.bold(header.padEnd(colWidths[header]!)))\n .join(\" \");\n console.log(headerRow);\n\n // Print separator\n const separator = headers\n .map((header) => \"─\".repeat(colWidths[header]!))\n .join(\" \");\n console.log(chalk.gray(separator));\n\n // Print data rows\n data.forEach((row) => {\n const dataRow = headers\n .map((header) => {\n const value = row[header] || \"\";\n const strippedLength = stripAnsi(value).length;\n const paddingNeeded = colWidths[header]! - strippedLength;\n const paddedValue = value + \" \".repeat(Math.max(0, paddingNeeded));\n\n // Color coding\n if (header === \"Name\") {\n return chalk.cyan(paddedValue);\n } else if (header === \"Version\") {\n return chalk.green(paddedValue);\n } else if (header === \"Model\") {\n return chalk.yellow(paddedValue);\n } else {\n return chalk.gray(paddedValue);\n }\n })\n .join(\" \");\n console.log(dataRow);\n });\n};\n\nconst formatRelativeTime = (dateString: string): string => {\n const date = new Date(dateString);\n const now = new Date();\n const diffMs = now.getTime() - date.getTime();\n\n const seconds = Math.floor(diffMs / 1000);\n const minutes = Math.floor(seconds / 60);\n const hours = Math.floor(minutes / 60);\n const days = Math.floor(hours / 24);\n const months = Math.floor(days / 30);\n const years = Math.floor(days / 365);\n\n if (years > 0) return `${years}y ago`;\n if (months > 0) return `${months}mo ago`;\n if (days > 0) return `${days}d ago`;\n if (hours > 0) return `${hours}h ago`;\n if (minutes > 0) return `${minutes}m ago`;\n return `${seconds}s ago`;\n};\n\nexport const listCommand = async (): Promise<void> => {\n try {\n // Check API key before doing anything else\n checkApiKey();\n\n // Get prompt service\n const promptService = PromptService.getInstance();\n\n const spinner = ora(\"Fetching prompts from server...\").start();\n\n try {\n // Fetch all prompts\n const allPrompts = await promptService.getAll();\n const prompts = allPrompts.filter((prompt) => prompt.version);\n const draftPrompts = allPrompts.filter((prompt) => !prompt.version);\n\n spinner.succeed(\n `Found ${prompts.length} published prompt${prompts.length !== 1 ? \"s\" : \"\"} ` +\n chalk.gray(\n `(+${draftPrompts.length} draft${\n draftPrompts.length !== 1 ? \"s\" : \"\"\n })`,\n ),\n );\n\n if (prompts.length === 0) {\n console.log();\n console.log(chalk.gray(\"No prompts found on the server.\"));\n console.log(chalk.gray(\"Create your first prompt with:\"));\n console.log(chalk.cyan(\" langwatch prompt init\"));\n return;\n }\n\n console.log();\n\n // Format prompts for table display\n const tableData = prompts.map((prompt) => ({\n Name: prompt.handle || `${prompt.name} ` + chalk.gray(`(${prompt.id})`),\n Version: prompt.version ? `${prompt.version}` : \"N/A\",\n Model: prompt.model || \"N/A\",\n Updated: formatRelativeTime(prompt.updatedAt),\n }));\n\n // Display table\n formatTable(tableData, [\"Name\", \"Version\", \"Model\", \"Updated\"]);\n\n console.log();\n console.log(\n chalk.gray(\n `Use ${chalk.cyan(\n \"langwatch prompt add <name>\",\n )} to add a prompt to your project`,\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(\n chalk.red(\n `Error fetching prompts: ${\n error instanceof Error ? error.message : \"Unknown error\"\n }`,\n ),\n );\n }\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,OAAO,WAAW;AAClB,OAAO,SA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