langsmith 0.5.5 → 0.5.7
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/client.cjs +377 -2
- package/dist/client.d.ts +202 -2
- package/dist/client.js +377 -2
- package/dist/experimental/anthropic/index.cjs +15 -1
- package/dist/experimental/anthropic/index.js +15 -1
- package/dist/experimental/vercel/index.cjs +23 -5
- package/dist/experimental/vercel/index.js +23 -5
- package/dist/experimental/vercel/middleware.cjs +13 -2
- package/dist/experimental/vercel/middleware.js +13 -2
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/utils/error.cjs +16 -0
- package/dist/utils/error.d.ts +8 -0
- package/dist/utils/error.js +15 -0
- package/dist/utils/fs.browser.cjs +51 -0
- package/dist/utils/fs.browser.d.ts +25 -0
- package/dist/utils/fs.browser.js +37 -0
- package/dist/utils/fs.cjs +101 -0
- package/dist/utils/fs.d.ts +21 -0
- package/dist/utils/fs.js +54 -0
- package/dist/utils/prompt_cache/index.cjs +31 -5
- package/dist/utils/prompt_cache/index.d.ts +3 -2
- package/dist/utils/prompt_cache/index.js +31 -5
- package/dist/utils/prompts.cjs +4 -3
- package/dist/utils/prompts.js +4 -3
- package/package.json +2 -2
- package/dist/utils/prompt_cache/fs.browser.cjs +0 -24
- package/dist/utils/prompt_cache/fs.browser.d.ts +0 -16
- package/dist/utils/prompt_cache/fs.browser.js +0 -20
- package/dist/utils/prompt_cache/fs.cjs +0 -86
- package/dist/utils/prompt_cache/fs.d.ts +0 -16
- package/dist/utils/prompt_cache/fs.js +0 -49
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* File system operations for prompt cache (Browser version).
|
|
3
|
-
*
|
|
4
|
-
* This stub is used in browser builds via the package.json browser field.
|
|
5
|
-
* File operations are not supported in browser environments.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Dump cache entries to a JSON file.
|
|
9
|
-
* @throws Error - Always throws in browser environments.
|
|
10
|
-
*/
|
|
11
|
-
export declare function dumpCache(_filePath: string, _entries: Record<string, unknown>): void;
|
|
12
|
-
/**
|
|
13
|
-
* Load cache entries from a JSON file.
|
|
14
|
-
* @throws Error - Always throws in browser environments.
|
|
15
|
-
*/
|
|
16
|
-
export declare function loadCache(_filePath: string): Record<string, unknown> | null;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* File system operations for prompt cache (Browser version).
|
|
3
|
-
*
|
|
4
|
-
* This stub is used in browser builds via the package.json browser field.
|
|
5
|
-
* File operations are not supported in browser environments.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Dump cache entries to a JSON file.
|
|
9
|
-
* @throws Error - Always throws in browser environments.
|
|
10
|
-
*/
|
|
11
|
-
export function dumpCache(_filePath, _entries) {
|
|
12
|
-
throw new Error("dump() is not supported in browser environments.");
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Load cache entries from a JSON file.
|
|
16
|
-
* @throws Error - Always throws in browser environments.
|
|
17
|
-
*/
|
|
18
|
-
export function loadCache(_filePath) {
|
|
19
|
-
throw new Error("load() is not supported in browser environments.");
|
|
20
|
-
}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* File system operations for prompt cache (Node.js version).
|
|
4
|
-
*
|
|
5
|
-
* This file is swapped with prompts_cache_fs.browser.ts for browser builds
|
|
6
|
-
* via the package.json browser field.
|
|
7
|
-
*/
|
|
8
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
-
if (k2 === undefined) k2 = k;
|
|
10
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
-
}
|
|
14
|
-
Object.defineProperty(o, k2, desc);
|
|
15
|
-
}) : (function(o, m, k, k2) {
|
|
16
|
-
if (k2 === undefined) k2 = k;
|
|
17
|
-
o[k2] = m[k];
|
|
18
|
-
}));
|
|
19
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
20
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
21
|
-
}) : function(o, v) {
|
|
22
|
-
o["default"] = v;
|
|
23
|
-
});
|
|
24
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
-
var ownKeys = function(o) {
|
|
26
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
-
var ar = [];
|
|
28
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
-
return ar;
|
|
30
|
-
};
|
|
31
|
-
return ownKeys(o);
|
|
32
|
-
};
|
|
33
|
-
return function (mod) {
|
|
34
|
-
if (mod && mod.__esModule) return mod;
|
|
35
|
-
var result = {};
|
|
36
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
-
__setModuleDefault(result, mod);
|
|
38
|
-
return result;
|
|
39
|
-
};
|
|
40
|
-
})();
|
|
41
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports.dumpCache = dumpCache;
|
|
43
|
-
exports.loadCache = loadCache;
|
|
44
|
-
const fs = __importStar(require("node:fs"));
|
|
45
|
-
const path = __importStar(require("node:path"));
|
|
46
|
-
/**
|
|
47
|
-
* Dump cache entries to a JSON file.
|
|
48
|
-
*/
|
|
49
|
-
function dumpCache(filePath, entries) {
|
|
50
|
-
const dir = path.dirname(filePath);
|
|
51
|
-
if (!fs.existsSync(dir)) {
|
|
52
|
-
fs.mkdirSync(dir, { recursive: true });
|
|
53
|
-
}
|
|
54
|
-
const data = { entries };
|
|
55
|
-
// Atomic write: write to temp file then rename
|
|
56
|
-
const tempPath = `${filePath}.tmp`;
|
|
57
|
-
try {
|
|
58
|
-
fs.writeFileSync(tempPath, JSON.stringify(data, null, 2));
|
|
59
|
-
fs.renameSync(tempPath, filePath);
|
|
60
|
-
}
|
|
61
|
-
catch (e) {
|
|
62
|
-
// Clean up temp file on failure
|
|
63
|
-
if (fs.existsSync(tempPath)) {
|
|
64
|
-
fs.unlinkSync(tempPath);
|
|
65
|
-
}
|
|
66
|
-
throw e;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Load cache entries from a JSON file.
|
|
71
|
-
*
|
|
72
|
-
* @returns The entries object, or null if file doesn't exist or is invalid.
|
|
73
|
-
*/
|
|
74
|
-
function loadCache(filePath) {
|
|
75
|
-
if (!fs.existsSync(filePath)) {
|
|
76
|
-
return null;
|
|
77
|
-
}
|
|
78
|
-
try {
|
|
79
|
-
const content = fs.readFileSync(filePath, "utf-8");
|
|
80
|
-
const data = JSON.parse(content);
|
|
81
|
-
return data.entries ?? null;
|
|
82
|
-
}
|
|
83
|
-
catch {
|
|
84
|
-
return null;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* File system operations for prompt cache (Node.js version).
|
|
3
|
-
*
|
|
4
|
-
* This file is swapped with prompts_cache_fs.browser.ts for browser builds
|
|
5
|
-
* via the package.json browser field.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Dump cache entries to a JSON file.
|
|
9
|
-
*/
|
|
10
|
-
export declare function dumpCache(filePath: string, entries: Record<string, unknown>): void;
|
|
11
|
-
/**
|
|
12
|
-
* Load cache entries from a JSON file.
|
|
13
|
-
*
|
|
14
|
-
* @returns The entries object, or null if file doesn't exist or is invalid.
|
|
15
|
-
*/
|
|
16
|
-
export declare function loadCache(filePath: string): Record<string, unknown> | null;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* File system operations for prompt cache (Node.js version).
|
|
3
|
-
*
|
|
4
|
-
* This file is swapped with prompts_cache_fs.browser.ts for browser builds
|
|
5
|
-
* via the package.json browser field.
|
|
6
|
-
*/
|
|
7
|
-
import * as fs from "node:fs";
|
|
8
|
-
import * as path from "node:path";
|
|
9
|
-
/**
|
|
10
|
-
* Dump cache entries to a JSON file.
|
|
11
|
-
*/
|
|
12
|
-
export function dumpCache(filePath, entries) {
|
|
13
|
-
const dir = path.dirname(filePath);
|
|
14
|
-
if (!fs.existsSync(dir)) {
|
|
15
|
-
fs.mkdirSync(dir, { recursive: true });
|
|
16
|
-
}
|
|
17
|
-
const data = { entries };
|
|
18
|
-
// Atomic write: write to temp file then rename
|
|
19
|
-
const tempPath = `${filePath}.tmp`;
|
|
20
|
-
try {
|
|
21
|
-
fs.writeFileSync(tempPath, JSON.stringify(data, null, 2));
|
|
22
|
-
fs.renameSync(tempPath, filePath);
|
|
23
|
-
}
|
|
24
|
-
catch (e) {
|
|
25
|
-
// Clean up temp file on failure
|
|
26
|
-
if (fs.existsSync(tempPath)) {
|
|
27
|
-
fs.unlinkSync(tempPath);
|
|
28
|
-
}
|
|
29
|
-
throw e;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Load cache entries from a JSON file.
|
|
34
|
-
*
|
|
35
|
-
* @returns The entries object, or null if file doesn't exist or is invalid.
|
|
36
|
-
*/
|
|
37
|
-
export function loadCache(filePath) {
|
|
38
|
-
if (!fs.existsSync(filePath)) {
|
|
39
|
-
return null;
|
|
40
|
-
}
|
|
41
|
-
try {
|
|
42
|
-
const content = fs.readFileSync(filePath, "utf-8");
|
|
43
|
-
const data = JSON.parse(content);
|
|
44
|
-
return data.entries ?? null;
|
|
45
|
-
}
|
|
46
|
-
catch {
|
|
47
|
-
return null;
|
|
48
|
-
}
|
|
49
|
-
}
|