langsmith 0.5.16 → 0.5.18
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/anonymizer/index.cjs +46 -20
- package/dist/anonymizer/index.js +46 -17
- package/dist/client.cjs +112 -143
- package/dist/client.d.ts +19 -40
- package/dist/client.js +112 -143
- package/dist/experimental/anthropic/index.cjs +4 -1
- package/dist/experimental/anthropic/index.js +4 -1
- package/dist/experimental/vercel/index.cjs +1 -0
- package/dist/experimental/vercel/index.js +1 -0
- package/dist/experimental/vercel/middleware.cjs +2 -0
- package/dist/experimental/vercel/middleware.js +2 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/schemas.d.ts +1 -3
- package/dist/utils/chalk/source/index.cjs +187 -0
- package/dist/utils/chalk/source/index.d.ts +19 -0
- package/dist/utils/chalk/source/index.js +173 -0
- package/dist/utils/chalk/source/utilities.cjs +35 -0
- package/dist/utils/chalk/source/utilities.d.ts +2 -0
- package/dist/utils/chalk/source/utilities.js +31 -0
- package/dist/utils/chalk/source/vendor/ansi-styles/index.cjs +193 -0
- package/dist/utils/chalk/source/vendor/ansi-styles/index.d.ts +58 -0
- package/dist/utils/chalk/source/vendor/ansi-styles/index.js +190 -0
- package/dist/utils/chalk/source/vendor/supports-color/browser.cjs +31 -0
- package/dist/utils/chalk/source/vendor/supports-color/browser.d.ts +15 -0
- package/dist/utils/chalk/source/vendor/supports-color/browser.js +29 -0
- package/dist/utils/chalk/source/vendor/supports-color/index.cjs +155 -0
- package/dist/utils/chalk/source/vendor/supports-color/index.d.ts +21 -0
- package/dist/utils/chalk/source/vendor/supports-color/index.js +149 -0
- package/dist/utils/console-table-printer/index.cjs +11 -0
- package/dist/utils/console-table-printer/index.d.ts +4 -0
- package/dist/utils/console-table-printer/index.js +3 -0
- package/dist/utils/console-table-printer/src/console-table-printer.cjs +42 -0
- package/dist/utils/console-table-printer/src/console-table-printer.d.ts +14 -0
- package/dist/utils/console-table-printer/src/console-table-printer.js +36 -0
- package/dist/utils/console-table-printer/src/internalTable/input-converter.cjs +25 -0
- package/dist/utils/console-table-printer/src/internalTable/input-converter.d.ts +6 -0
- package/dist/utils/console-table-printer/src/internalTable/input-converter.js +20 -0
- package/dist/utils/console-table-printer/src/internalTable/internal-table-printer.cjs +142 -0
- package/dist/utils/console-table-printer/src/internalTable/internal-table-printer.d.ts +6 -0
- package/dist/utils/console-table-printer/src/internalTable/internal-table-printer.js +133 -0
- package/dist/utils/console-table-printer/src/internalTable/internal-table.cjs +186 -0
- package/dist/utils/console-table-printer/src/internalTable/internal-table.d.ts +31 -0
- package/dist/utils/console-table-printer/src/internalTable/internal-table.js +184 -0
- package/dist/utils/console-table-printer/src/internalTable/table-pre-processors.cjs +53 -0
- package/dist/utils/console-table-printer/src/internalTable/table-pre-processors.d.ts +3 -0
- package/dist/utils/console-table-printer/src/internalTable/table-pre-processors.js +48 -0
- package/dist/utils/console-table-printer/src/models/common.cjs +2 -0
- package/dist/utils/console-table-printer/src/models/common.d.ts +14 -0
- package/dist/utils/console-table-printer/src/models/common.js +1 -0
- package/dist/utils/console-table-printer/src/models/external-table.cjs +2 -0
- package/dist/utils/console-table-printer/src/models/external-table.d.ts +99 -0
- package/dist/utils/console-table-printer/src/models/external-table.js +1 -0
- package/dist/utils/console-table-printer/src/models/internal-table.cjs +2 -0
- package/dist/utils/console-table-printer/src/models/internal-table.d.ts +24 -0
- package/dist/utils/console-table-printer/src/models/internal-table.js +1 -0
- package/dist/utils/console-table-printer/src/utils/colored-console-line.cjs +43 -0
- package/dist/utils/console-table-printer/src/utils/colored-console-line.d.ts +12 -0
- package/dist/utils/console-table-printer/src/utils/colored-console-line.js +39 -0
- package/dist/utils/console-table-printer/src/utils/console-utils.cjs +23 -0
- package/dist/utils/console-table-printer/src/utils/console-utils.d.ts +3 -0
- package/dist/utils/console-table-printer/src/utils/console-utils.js +18 -0
- package/dist/utils/console-table-printer/src/utils/string-utils.cjs +68 -0
- package/dist/utils/console-table-printer/src/utils/string-utils.d.ts +4 -0
- package/dist/utils/console-table-printer/src/utils/string-utils.js +62 -0
- package/dist/utils/console-table-printer/src/utils/table-constants.cjs +55 -0
- package/dist/utils/console-table-printer/src/utils/table-constants.d.ts +11 -0
- package/dist/utils/console-table-printer/src/utils/table-constants.js +52 -0
- package/dist/utils/console-table-printer/src/utils/table-helpers.cjs +101 -0
- package/dist/utils/console-table-printer/src/utils/table-helpers.d.ts +29 -0
- package/dist/utils/console-table-printer/src/utils/table-helpers.js +88 -0
- package/dist/utils/jestlike/reporter.cjs +23 -23
- package/dist/utils/jestlike/reporter.js +2 -2
- package/dist/utils/prompts.cjs +0 -10
- package/dist/utils/prompts.d.ts +0 -1
- package/dist/utils/prompts.js +0 -9
- package/dist/utils/simple-wcswidth/index.cjs +10 -0
- package/dist/utils/simple-wcswidth/index.d.ts +3 -0
- package/dist/utils/simple-wcswidth/index.js +3 -0
- package/dist/utils/simple-wcswidth/src/binary-search.cjs +24 -0
- package/dist/utils/simple-wcswidth/src/binary-search.d.ts +3 -0
- package/dist/utils/simple-wcswidth/src/binary-search.js +22 -0
- package/dist/utils/simple-wcswidth/src/models.cjs +2 -0
- package/dist/utils/simple-wcswidth/src/models.d.ts +4 -0
- package/dist/utils/simple-wcswidth/src/models.js +1 -0
- package/dist/utils/simple-wcswidth/src/non-spacing-chars.cjs +149 -0
- package/dist/utils/simple-wcswidth/src/non-spacing-chars.d.ts +3 -0
- package/dist/utils/simple-wcswidth/src/non-spacing-chars.js +147 -0
- package/dist/utils/simple-wcswidth/src/wcswidth.cjs +20 -0
- package/dist/utils/simple-wcswidth/src/wcswidth.d.ts +2 -0
- package/dist/utils/simple-wcswidth/src/wcswidth.js +15 -0
- package/dist/utils/simple-wcswidth/src/wcwidth.cjs +67 -0
- package/dist/utils/simple-wcswidth/src/wcwidth.d.ts +2 -0
- package/dist/utils/simple-wcswidth/src/wcwidth.js +62 -0
- package/package.json +5 -7
- package/dist/utils/lodash/assignValue.cjs +0 -29
- package/dist/utils/lodash/assignValue.d.ts +0 -10
- package/dist/utils/lodash/assignValue.js +0 -24
- package/dist/utils/lodash/baseAssignValue.cjs +0 -25
- package/dist/utils/lodash/baseAssignValue.d.ts +0 -11
- package/dist/utils/lodash/baseAssignValue.js +0 -23
- package/dist/utils/lodash/baseSet.cjs +0 -50
- package/dist/utils/lodash/baseSet.d.ts +0 -12
- package/dist/utils/lodash/baseSet.js +0 -45
- package/dist/utils/lodash/castPath.cjs +0 -22
- package/dist/utils/lodash/castPath.d.ts +0 -10
- package/dist/utils/lodash/castPath.js +0 -17
- package/dist/utils/lodash/eq.cjs +0 -36
- package/dist/utils/lodash/eq.d.ts +0 -32
- package/dist/utils/lodash/eq.js +0 -34
- package/dist/utils/lodash/getTag.cjs +0 -18
- package/dist/utils/lodash/getTag.d.ts +0 -9
- package/dist/utils/lodash/getTag.js +0 -16
- package/dist/utils/lodash/isIndex.cjs +0 -25
- package/dist/utils/lodash/isIndex.d.ts +0 -10
- package/dist/utils/lodash/isIndex.js +0 -23
- package/dist/utils/lodash/isKey.cjs +0 -34
- package/dist/utils/lodash/isKey.d.ts +0 -10
- package/dist/utils/lodash/isKey.js +0 -29
- package/dist/utils/lodash/isObject.cjs +0 -31
- package/dist/utils/lodash/isObject.d.ts +0 -25
- package/dist/utils/lodash/isObject.js +0 -29
- package/dist/utils/lodash/isSymbol.cjs +0 -28
- package/dist/utils/lodash/isSymbol.d.ts +0 -17
- package/dist/utils/lodash/isSymbol.js +0 -23
- package/dist/utils/lodash/memoizeCapped.cjs +0 -65
- package/dist/utils/lodash/memoizeCapped.d.ts +0 -50
- package/dist/utils/lodash/memoizeCapped.js +0 -63
- package/dist/utils/lodash/set.cjs +0 -41
- package/dist/utils/lodash/set.d.ts +0 -32
- package/dist/utils/lodash/set.js +0 -36
- package/dist/utils/lodash/stringToPath.cjs +0 -49
- package/dist/utils/lodash/stringToPath.d.ts +0 -12
- package/dist/utils/lodash/stringToPath.js +0 -44
- package/dist/utils/lodash/toKey.cjs +0 -24
- package/dist/utils/lodash/toKey.d.ts +0 -9
- package/dist/utils/lodash/toKey.js +0 -19
|
@@ -1,37 +1,50 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.createAnonymizer = createAnonymizer;
|
|
7
|
-
const set_js_1 = __importDefault(require("../utils/lodash/set.cjs"));
|
|
8
4
|
function extractStringNodes(data, options) {
|
|
9
5
|
const parsedOptions = { ...options, maxDepth: options.maxDepth ?? 10 };
|
|
10
|
-
const queue = [
|
|
11
|
-
|
|
12
|
-
];
|
|
6
|
+
const queue = [[data, 0, "", null, ""]];
|
|
7
|
+
let nextId = 0;
|
|
13
8
|
const result = [];
|
|
14
9
|
while (queue.length > 0) {
|
|
15
10
|
const task = queue.shift();
|
|
16
11
|
if (task == null)
|
|
17
12
|
continue;
|
|
18
|
-
const [value, depth, path] = task;
|
|
19
|
-
if (typeof value === "
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
13
|
+
const [value, depth, path, parent, key] = task;
|
|
14
|
+
if (typeof value === "string") {
|
|
15
|
+
result.push({
|
|
16
|
+
value,
|
|
17
|
+
path,
|
|
18
|
+
parent: parent,
|
|
19
|
+
key,
|
|
20
|
+
_id: nextId++,
|
|
21
|
+
});
|
|
25
22
|
}
|
|
26
23
|
else if (Array.isArray(value)) {
|
|
27
24
|
if (depth >= parsedOptions.maxDepth)
|
|
28
25
|
continue;
|
|
29
26
|
for (let i = 0; i < value.length; i++) {
|
|
30
|
-
queue.push([
|
|
27
|
+
queue.push([
|
|
28
|
+
value[i],
|
|
29
|
+
depth + 1,
|
|
30
|
+
`${path}[${i}]`,
|
|
31
|
+
value,
|
|
32
|
+
String(i),
|
|
33
|
+
]);
|
|
31
34
|
}
|
|
32
35
|
}
|
|
33
|
-
else if (typeof value === "
|
|
34
|
-
|
|
36
|
+
else if (typeof value === "object" && value != null) {
|
|
37
|
+
if (depth >= parsedOptions.maxDepth)
|
|
38
|
+
continue;
|
|
39
|
+
for (const [k, nestedValue] of Object.entries(value)) {
|
|
40
|
+
queue.push([
|
|
41
|
+
nestedValue,
|
|
42
|
+
depth + 1,
|
|
43
|
+
path ? `${path}.${k}` : k,
|
|
44
|
+
value,
|
|
45
|
+
k,
|
|
46
|
+
]);
|
|
47
|
+
}
|
|
35
48
|
}
|
|
36
49
|
}
|
|
37
50
|
return result;
|
|
@@ -69,7 +82,7 @@ function createAnonymizer(replacer, options) {
|
|
|
69
82
|
return result;
|
|
70
83
|
}, item.value);
|
|
71
84
|
if (newValue !== item.value) {
|
|
72
|
-
memo.push({ value: newValue
|
|
85
|
+
memo.push({ ...item, value: newValue });
|
|
73
86
|
}
|
|
74
87
|
return memo;
|
|
75
88
|
}, []);
|
|
@@ -81,19 +94,32 @@ function createAnonymizer(replacer, options) {
|
|
|
81
94
|
maskNodes: (nodes) => nodes.reduce((memo, item) => {
|
|
82
95
|
const newValue = replacer(item.value, item.path);
|
|
83
96
|
if (newValue !== item.value) {
|
|
84
|
-
memo.push({ value: newValue
|
|
97
|
+
memo.push({ ...item, value: newValue });
|
|
85
98
|
}
|
|
86
99
|
return memo;
|
|
87
100
|
}, []),
|
|
88
101
|
}
|
|
89
102
|
: replacer;
|
|
103
|
+
// Build a lookup from _id to internal node for direct write-back.
|
|
104
|
+
const nodesById = new Map();
|
|
105
|
+
for (const node of nodes) {
|
|
106
|
+
nodesById.set(node._id, node);
|
|
107
|
+
}
|
|
90
108
|
const toUpdate = processor.maskNodes(nodes);
|
|
91
109
|
for (const node of toUpdate) {
|
|
92
110
|
if (node.path === "") {
|
|
93
111
|
mutateValue = node.value;
|
|
94
112
|
}
|
|
95
113
|
else {
|
|
96
|
-
|
|
114
|
+
// Match by _id if available (built-in replacers propagate it from
|
|
115
|
+
// the input nodes), otherwise fall back to path matching.
|
|
116
|
+
const asInternal = node;
|
|
117
|
+
const internal = asInternal._id !== undefined
|
|
118
|
+
? nodesById.get(asInternal._id)
|
|
119
|
+
: nodes.find((n) => n.path === node.path);
|
|
120
|
+
if (internal) {
|
|
121
|
+
internal.parent[internal.key] = node.value;
|
|
122
|
+
}
|
|
97
123
|
}
|
|
98
124
|
}
|
|
99
125
|
return mutateValue;
|
package/dist/anonymizer/index.js
CHANGED
|
@@ -1,31 +1,47 @@
|
|
|
1
|
-
import set from "../utils/lodash/set.js";
|
|
2
1
|
function extractStringNodes(data, options) {
|
|
3
2
|
const parsedOptions = { ...options, maxDepth: options.maxDepth ?? 10 };
|
|
4
|
-
const queue = [
|
|
5
|
-
|
|
6
|
-
];
|
|
3
|
+
const queue = [[data, 0, "", null, ""]];
|
|
4
|
+
let nextId = 0;
|
|
7
5
|
const result = [];
|
|
8
6
|
while (queue.length > 0) {
|
|
9
7
|
const task = queue.shift();
|
|
10
8
|
if (task == null)
|
|
11
9
|
continue;
|
|
12
|
-
const [value, depth, path] = task;
|
|
13
|
-
if (typeof value === "
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
10
|
+
const [value, depth, path, parent, key] = task;
|
|
11
|
+
if (typeof value === "string") {
|
|
12
|
+
result.push({
|
|
13
|
+
value,
|
|
14
|
+
path,
|
|
15
|
+
parent: parent,
|
|
16
|
+
key,
|
|
17
|
+
_id: nextId++,
|
|
18
|
+
});
|
|
19
19
|
}
|
|
20
20
|
else if (Array.isArray(value)) {
|
|
21
21
|
if (depth >= parsedOptions.maxDepth)
|
|
22
22
|
continue;
|
|
23
23
|
for (let i = 0; i < value.length; i++) {
|
|
24
|
-
queue.push([
|
|
24
|
+
queue.push([
|
|
25
|
+
value[i],
|
|
26
|
+
depth + 1,
|
|
27
|
+
`${path}[${i}]`,
|
|
28
|
+
value,
|
|
29
|
+
String(i),
|
|
30
|
+
]);
|
|
25
31
|
}
|
|
26
32
|
}
|
|
27
|
-
else if (typeof value === "
|
|
28
|
-
|
|
33
|
+
else if (typeof value === "object" && value != null) {
|
|
34
|
+
if (depth >= parsedOptions.maxDepth)
|
|
35
|
+
continue;
|
|
36
|
+
for (const [k, nestedValue] of Object.entries(value)) {
|
|
37
|
+
queue.push([
|
|
38
|
+
nestedValue,
|
|
39
|
+
depth + 1,
|
|
40
|
+
path ? `${path}.${k}` : k,
|
|
41
|
+
value,
|
|
42
|
+
k,
|
|
43
|
+
]);
|
|
44
|
+
}
|
|
29
45
|
}
|
|
30
46
|
}
|
|
31
47
|
return result;
|
|
@@ -63,7 +79,7 @@ export function createAnonymizer(replacer, options) {
|
|
|
63
79
|
return result;
|
|
64
80
|
}, item.value);
|
|
65
81
|
if (newValue !== item.value) {
|
|
66
|
-
memo.push({ value: newValue
|
|
82
|
+
memo.push({ ...item, value: newValue });
|
|
67
83
|
}
|
|
68
84
|
return memo;
|
|
69
85
|
}, []);
|
|
@@ -75,19 +91,32 @@ export function createAnonymizer(replacer, options) {
|
|
|
75
91
|
maskNodes: (nodes) => nodes.reduce((memo, item) => {
|
|
76
92
|
const newValue = replacer(item.value, item.path);
|
|
77
93
|
if (newValue !== item.value) {
|
|
78
|
-
memo.push({ value: newValue
|
|
94
|
+
memo.push({ ...item, value: newValue });
|
|
79
95
|
}
|
|
80
96
|
return memo;
|
|
81
97
|
}, []),
|
|
82
98
|
}
|
|
83
99
|
: replacer;
|
|
100
|
+
// Build a lookup from _id to internal node for direct write-back.
|
|
101
|
+
const nodesById = new Map();
|
|
102
|
+
for (const node of nodes) {
|
|
103
|
+
nodesById.set(node._id, node);
|
|
104
|
+
}
|
|
84
105
|
const toUpdate = processor.maskNodes(nodes);
|
|
85
106
|
for (const node of toUpdate) {
|
|
86
107
|
if (node.path === "") {
|
|
87
108
|
mutateValue = node.value;
|
|
88
109
|
}
|
|
89
110
|
else {
|
|
90
|
-
|
|
111
|
+
// Match by _id if available (built-in replacers propagate it from
|
|
112
|
+
// the input nodes), otherwise fall back to path matching.
|
|
113
|
+
const asInternal = node;
|
|
114
|
+
const internal = asInternal._id !== undefined
|
|
115
|
+
? nodesById.get(asInternal._id)
|
|
116
|
+
: nodes.find((n) => n.path === node.path);
|
|
117
|
+
if (internal) {
|
|
118
|
+
internal.parent[internal.key] = node.value;
|
|
119
|
+
}
|
|
91
120
|
}
|
|
92
121
|
}
|
|
93
122
|
return mutateValue;
|