langsmith 0.7.7 → 0.7.9
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 +161 -15
- package/dist/_openapi_client/client.cjs +814 -0
- package/dist/_openapi_client/client.d.ts +247 -0
- package/dist/_openapi_client/client.js +777 -0
- package/dist/_openapi_client/core/api-promise.cjs +100 -0
- package/dist/_openapi_client/core/api-promise.d.ts +45 -0
- package/dist/_openapi_client/core/api-promise.js +96 -0
- package/dist/_openapi_client/core/error.cjs +134 -0
- package/dist/_openapi_client/core/error.d.ts +45 -0
- package/dist/_openapi_client/core/error.js +118 -0
- package/dist/_openapi_client/core/pagination.cjs +374 -0
- package/dist/_openapi_client/core/pagination.d.ts +157 -0
- package/dist/_openapi_client/core/pagination.js +361 -0
- package/dist/_openapi_client/core/resource.cjs +17 -0
- package/dist/_openapi_client/core/resource.d.ts +5 -0
- package/dist/_openapi_client/core/resource.js +13 -0
- package/dist/_openapi_client/core/uploads.cjs +5 -0
- package/dist/_openapi_client/core/uploads.d.ts +2 -0
- package/dist/_openapi_client/core/uploads.js +1 -0
- package/dist/_openapi_client/index.cjs +29 -0
- package/dist/_openapi_client/index.d.ts +6 -0
- package/dist/_openapi_client/index.js +8 -0
- package/dist/_openapi_client/internal/builtin-types.cjs +4 -0
- package/dist/_openapi_client/internal/builtin-types.d.ts +72 -0
- package/dist/_openapi_client/internal/builtin-types.js +3 -0
- package/dist/_openapi_client/internal/detect-platform.cjs +162 -0
- package/dist/_openapi_client/internal/detect-platform.d.ts +14 -0
- package/dist/_openapi_client/internal/detect-platform.js +157 -0
- package/dist/_openapi_client/internal/errors.cjs +41 -0
- package/dist/_openapi_client/internal/errors.d.ts +2 -0
- package/dist/_openapi_client/internal/errors.js +36 -0
- package/dist/_openapi_client/internal/headers.cjs +79 -0
- package/dist/_openapi_client/internal/headers.d.ts +5 -0
- package/dist/_openapi_client/internal/headers.js +74 -0
- package/dist/_openapi_client/internal/parse.cjs +40 -0
- package/dist/_openapi_client/internal/parse.d.ts +11 -0
- package/dist/_openapi_client/internal/parse.js +37 -0
- package/dist/_openapi_client/internal/qs/formats.cjs +12 -0
- package/dist/_openapi_client/internal/qs/formats.d.ts +6 -0
- package/dist/_openapi_client/internal/qs/formats.js +8 -0
- package/dist/_openapi_client/internal/qs/stringify.cjs +277 -0
- package/dist/_openapi_client/internal/qs/stringify.d.ts +2 -0
- package/dist/_openapi_client/internal/qs/stringify.js +274 -0
- package/dist/_openapi_client/internal/qs/types.cjs +2 -0
- package/dist/_openapi_client/internal/qs/types.d.ts +56 -0
- package/dist/_openapi_client/internal/qs/types.js +1 -0
- package/dist/_openapi_client/internal/qs/utils.cjs +230 -0
- package/dist/_openapi_client/internal/qs/utils.d.ts +14 -0
- package/dist/_openapi_client/internal/qs/utils.js +217 -0
- package/dist/_openapi_client/internal/request-options.cjs +14 -0
- package/dist/_openapi_client/internal/request-options.d.ts +74 -0
- package/dist/_openapi_client/internal/request-options.js +10 -0
- package/dist/_openapi_client/internal/shim-types.cjs +4 -0
- package/dist/_openapi_client/internal/shim-types.d.ts +16 -0
- package/dist/_openapi_client/internal/shim-types.js +3 -0
- package/dist/_openapi_client/internal/shims.cjs +92 -0
- package/dist/_openapi_client/internal/shims.d.ts +25 -0
- package/dist/_openapi_client/internal/shims.js +85 -0
- package/dist/_openapi_client/internal/to-file.cjs +91 -0
- package/dist/_openapi_client/internal/to-file.d.ts +44 -0
- package/dist/_openapi_client/internal/to-file.js +88 -0
- package/dist/_openapi_client/internal/types.cjs +4 -0
- package/dist/_openapi_client/internal/types.d.ts +62 -0
- package/dist/_openapi_client/internal/types.js +3 -0
- package/dist/_openapi_client/internal/uploads.cjs +140 -0
- package/dist/_openapi_client/internal/uploads.d.ts +41 -0
- package/dist/_openapi_client/internal/uploads.js +130 -0
- package/dist/_openapi_client/internal/utils/env.cjs +22 -0
- package/dist/_openapi_client/internal/utils/env.d.ts +8 -0
- package/dist/_openapi_client/internal/utils/env.js +18 -0
- package/dist/_openapi_client/internal/utils/log.cjs +88 -0
- package/dist/_openapi_client/internal/utils/log.d.ts +36 -0
- package/dist/_openapi_client/internal/utils/log.js +82 -0
- package/dist/_openapi_client/internal/utils/path.cjs +79 -0
- package/dist/_openapi_client/internal/utils/path.d.ts +14 -0
- package/dist/_openapi_client/internal/utils/path.js +74 -0
- package/dist/_openapi_client/internal/utils/query.cjs +42 -0
- package/dist/_openapi_client/internal/utils/query.d.ts +1 -0
- package/dist/_openapi_client/internal/utils/query.js +6 -0
- package/dist/_openapi_client/internal/utils/sleep.cjs +7 -0
- package/dist/_openapi_client/internal/utils/sleep.d.ts +1 -0
- package/dist/_openapi_client/internal/utils/sleep.js +3 -0
- package/dist/_openapi_client/internal/utils/uuid.cjs +19 -0
- package/dist/_openapi_client/internal/utils/uuid.d.ts +4 -0
- package/dist/_openapi_client/internal/utils/uuid.js +15 -0
- package/dist/_openapi_client/internal/utils/values.cjs +112 -0
- package/dist/_openapi_client/internal/utils/values.d.ts +17 -0
- package/dist/_openapi_client/internal/utils/values.js +94 -0
- package/dist/_openapi_client/resources/annotation-queues/annotation-queues.cjs +138 -0
- package/dist/_openapi_client/resources/annotation-queues/annotation-queues.d.ts +367 -0
- package/dist/_openapi_client/resources/annotation-queues/annotation-queues.js +101 -0
- package/dist/_openapi_client/resources/annotation-queues/runs.cjs +46 -0
- package/dist/_openapi_client/resources/annotation-queues/runs.d.ts +128 -0
- package/dist/_openapi_client/resources/annotation-queues/runs.js +42 -0
- package/dist/_openapi_client/resources/commits.cjs +44 -0
- package/dist/_openapi_client/resources/commits.d.ts +204 -0
- package/dist/_openapi_client/resources/commits.js +40 -0
- package/dist/_openapi_client/resources/datasets/comparative.cjs +22 -0
- package/dist/_openapi_client/resources/datasets/comparative.d.ts +55 -0
- package/dist/_openapi_client/resources/datasets/comparative.js +18 -0
- package/dist/_openapi_client/resources/datasets/datasets.cjs +193 -0
- package/dist/_openapi_client/resources/datasets/datasets.d.ts +374 -0
- package/dist/_openapi_client/resources/datasets/datasets.js +156 -0
- package/dist/_openapi_client/resources/datasets/experiments.cjs +16 -0
- package/dist/_openapi_client/resources/datasets/experiments.d.ts +23 -0
- package/dist/_openapi_client/resources/datasets/experiments.js +12 -0
- package/dist/_openapi_client/resources/datasets/group.cjs +17 -0
- package/dist/_openapi_client/resources/datasets/group.d.ts +160 -0
- package/dist/_openapi_client/resources/datasets/group.js +13 -0
- package/dist/_openapi_client/resources/datasets/runs.cjs +29 -0
- package/dist/_openapi_client/resources/datasets/runs.d.ts +216 -0
- package/dist/_openapi_client/resources/datasets/runs.js +25 -0
- package/dist/_openapi_client/resources/datasets/share.cjs +32 -0
- package/dist/_openapi_client/resources/datasets/share.d.ts +28 -0
- package/dist/_openapi_client/resources/datasets/share.js +28 -0
- package/dist/_openapi_client/resources/datasets/splits.cjs +22 -0
- package/dist/_openapi_client/resources/datasets/splits.d.ts +30 -0
- package/dist/_openapi_client/resources/datasets/splits.js +18 -0
- package/dist/_openapi_client/resources/datasets/versions.cjs +23 -0
- package/dist/_openapi_client/resources/datasets/versions.d.ts +36 -0
- package/dist/_openapi_client/resources/datasets/versions.js +19 -0
- package/dist/_openapi_client/resources/evaluators.cjs +15 -0
- package/dist/_openapi_client/resources/evaluators.d.ts +125 -0
- package/dist/_openapi_client/resources/evaluators.js +11 -0
- package/dist/_openapi_client/resources/examples/bulk.cjs +24 -0
- package/dist/_openapi_client/resources/examples/bulk.d.ts +78 -0
- package/dist/_openapi_client/resources/examples/bulk.js +20 -0
- package/dist/_openapi_client/resources/examples/examples.cjs +124 -0
- package/dist/_openapi_client/resources/examples/examples.d.ts +182 -0
- package/dist/_openapi_client/resources/examples/examples.js +87 -0
- package/dist/_openapi_client/resources/examples/validate.cjs +21 -0
- package/dist/_openapi_client/resources/examples/validate.d.ts +38 -0
- package/dist/_openapi_client/resources/examples/validate.js +17 -0
- package/dist/_openapi_client/resources/feedback/configs.cjs +24 -0
- package/dist/_openapi_client/resources/feedback/configs.d.ts +18 -0
- package/dist/_openapi_client/resources/feedback/configs.js +20 -0
- package/dist/_openapi_client/resources/feedback/feedback.cjs +98 -0
- package/dist/_openapi_client/resources/feedback/feedback.d.ts +275 -0
- package/dist/_openapi_client/resources/feedback/feedback.js +61 -0
- package/dist/_openapi_client/resources/feedback/tokens.cjs +35 -0
- package/dist/_openapi_client/resources/feedback/tokens.d.ts +130 -0
- package/dist/_openapi_client/resources/feedback/tokens.js +31 -0
- package/dist/_openapi_client/resources/index.cjs +35 -0
- package/dist/_openapi_client/resources/index.d.ts +15 -0
- package/dist/_openapi_client/resources/index.js +17 -0
- package/dist/_openapi_client/resources/info.cjs +15 -0
- package/dist/_openapi_client/resources/info.d.ts +51 -0
- package/dist/_openapi_client/resources/info.js +11 -0
- package/dist/_openapi_client/resources/online-evaluators.cjs +70 -0
- package/dist/_openapi_client/resources/online-evaluators.d.ts +284 -0
- package/dist/_openapi_client/resources/online-evaluators.js +66 -0
- package/dist/_openapi_client/resources/public/datasets.cjs +47 -0
- package/dist/_openapi_client/resources/public/datasets.d.ts +152 -0
- package/dist/_openapi_client/resources/public/datasets.js +43 -0
- package/dist/_openapi_client/resources/public/public.cjs +62 -0
- package/dist/_openapi_client/resources/public/public.d.ts +32 -0
- package/dist/_openapi_client/resources/public/public.js +25 -0
- package/dist/_openapi_client/resources/repos/directories.cjs +40 -0
- package/dist/_openapi_client/resources/repos/directories.d.ts +72 -0
- package/dist/_openapi_client/resources/repos/directories.js +36 -0
- package/dist/_openapi_client/resources/repos/repos.cjs +93 -0
- package/dist/_openapi_client/resources/repos/repos.d.ts +188 -0
- package/dist/_openapi_client/resources/repos/repos.js +56 -0
- package/dist/_openapi_client/resources/runs/rules.cjs +9 -0
- package/dist/_openapi_client/resources/runs/rules.d.ts +3 -0
- package/dist/_openapi_client/resources/runs/rules.js +5 -0
- package/dist/_openapi_client/resources/runs/runs.cjs +102 -0
- package/dist/_openapi_client/resources/runs/runs.d.ts +542 -0
- package/dist/_openapi_client/resources/runs/runs.js +65 -0
- package/dist/_openapi_client/resources/sandboxes/boxes.cjs +86 -0
- package/dist/_openapi_client/resources/sandboxes/boxes.d.ts +1121 -0
- package/dist/_openapi_client/resources/sandboxes/boxes.js +82 -0
- package/dist/_openapi_client/resources/sandboxes/sandboxes.cjs +63 -0
- package/dist/_openapi_client/resources/sandboxes/sandboxes.d.ts +13 -0
- package/dist/_openapi_client/resources/sandboxes/sandboxes.js +26 -0
- package/dist/_openapi_client/resources/sandboxes/snapshots.cjs +39 -0
- package/dist/_openapi_client/resources/sandboxes/snapshots.d.ts +130 -0
- package/dist/_openapi_client/resources/sandboxes/snapshots.js +35 -0
- package/dist/_openapi_client/resources/sessions/insights.cjs +54 -0
- package/dist/_openapi_client/resources/sessions/insights.d.ts +246 -0
- package/dist/_openapi_client/resources/sessions/insights.js +50 -0
- package/dist/_openapi_client/resources/sessions/sessions.cjs +109 -0
- package/dist/_openapi_client/resources/sessions/sessions.d.ts +674 -0
- package/dist/_openapi_client/resources/sessions/sessions.js +72 -0
- package/dist/_openapi_client/resources/settings.cjs +15 -0
- package/dist/_openapi_client/resources/settings.d.ts +18 -0
- package/dist/_openapi_client/resources/settings.js +11 -0
- package/dist/_openapi_client/resources/workspaces.cjs +35 -0
- package/dist/_openapi_client/resources/workspaces.d.ts +84 -0
- package/dist/_openapi_client/resources/workspaces.js +31 -0
- package/dist/_openapi_client/version.cjs +5 -0
- package/dist/_openapi_client/version.d.ts +1 -0
- package/dist/_openapi_client/version.js +2 -0
- package/dist/client.cjs +48 -19
- package/dist/client.d.ts +5 -0
- package/dist/client.js +29 -0
- package/dist/env.cjs +3 -3
- package/dist/env.d.ts +1 -1
- package/dist/env.js +1 -1
- package/dist/evaluation/_runner.cjs +31 -3
- package/dist/evaluation/_runner.d.ts +2 -0
- package/dist/evaluation/_runner.js +30 -4
- package/dist/experimental/otel/exporter.cjs +1 -1
- package/dist/experimental/otel/exporter.js +2 -2
- package/dist/experimental/vercel/telemetry.cjs +1 -1
- package/dist/experimental/vercel/telemetry.js +2 -2
- package/dist/index.cjs +4 -2
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/run_trees.cjs +1 -1
- package/dist/run_trees.js +2 -2
- package/dist/sandbox/client.cjs +11 -3
- package/dist/sandbox/client.js +11 -3
- package/dist/sandbox/errors.cjs +2 -1
- package/dist/sandbox/errors.d.ts +2 -1
- package/dist/sandbox/errors.js +2 -1
- package/dist/sandbox/index.cjs +8 -2
- package/dist/sandbox/index.d.ts +3 -2
- package/dist/sandbox/index.js +2 -1
- package/dist/sandbox/mounts.cjs +114 -0
- package/dist/sandbox/mounts.d.ts +24 -0
- package/dist/sandbox/mounts.js +109 -0
- package/dist/sandbox/proxy_config.cjs +90 -5
- package/dist/sandbox/proxy_config.d.ts +19 -4
- package/dist/sandbox/proxy_config.js +86 -4
- package/dist/sandbox/types.d.ts +92 -3
- package/dist/traceable.cjs +1 -1
- package/dist/traceable.js +2 -2
- package/dist/utils/guard.cjs +13 -0
- package/dist/utils/guard.d.ts +6 -0
- package/dist/utils/guard.js +10 -0
- package/dist/utils/jestlike/globals.cjs +1 -1
- package/dist/utils/jestlike/globals.js +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { proxyConfig } from "./proxy_config.js";
|
|
2
|
+
function requireNonEmptyString(value, field) {
|
|
3
|
+
if (typeof value !== "string" || value.trim() === "") {
|
|
4
|
+
throw new Error(`${field} must be a non-empty string`);
|
|
5
|
+
}
|
|
6
|
+
return value.trim();
|
|
7
|
+
}
|
|
8
|
+
export function s3Mount({ id, mountPath, bucket, region = "us-east-1", prefix, endpointUrl = "https://s3.amazonaws.com", pathStyle = false, readOnly, cache, }) {
|
|
9
|
+
const mount = {
|
|
10
|
+
id: requireNonEmptyString(id, "id"),
|
|
11
|
+
type: "s3",
|
|
12
|
+
mount_path: requireNonEmptyString(mountPath, "mountPath"),
|
|
13
|
+
s3: {
|
|
14
|
+
endpoint_url: requireNonEmptyString(endpointUrl, "endpointUrl"),
|
|
15
|
+
region: requireNonEmptyString(region, "region"),
|
|
16
|
+
bucket: requireNonEmptyString(bucket, "bucket"),
|
|
17
|
+
path_style: pathStyle,
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
if (prefix !== undefined) {
|
|
21
|
+
mount.s3.prefix = requireNonEmptyString(prefix, "prefix");
|
|
22
|
+
}
|
|
23
|
+
if (readOnly !== undefined) {
|
|
24
|
+
mount.read_only = readOnly;
|
|
25
|
+
}
|
|
26
|
+
if (cache !== undefined) {
|
|
27
|
+
mount.cache = { ...cache };
|
|
28
|
+
}
|
|
29
|
+
return mount;
|
|
30
|
+
}
|
|
31
|
+
export function gcsMount({ id, mountPath, bucket, prefix, readOnly, cache, }) {
|
|
32
|
+
const mount = {
|
|
33
|
+
id: requireNonEmptyString(id, "id"),
|
|
34
|
+
type: "gcs",
|
|
35
|
+
mount_path: requireNonEmptyString(mountPath, "mountPath"),
|
|
36
|
+
gcs: {
|
|
37
|
+
bucket: requireNonEmptyString(bucket, "bucket"),
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
if (prefix !== undefined) {
|
|
41
|
+
mount.gcs.prefix = requireNonEmptyString(prefix, "prefix");
|
|
42
|
+
}
|
|
43
|
+
if (readOnly !== undefined) {
|
|
44
|
+
mount.read_only = readOnly;
|
|
45
|
+
}
|
|
46
|
+
if (cache !== undefined) {
|
|
47
|
+
mount.cache = { ...cache };
|
|
48
|
+
}
|
|
49
|
+
return mount;
|
|
50
|
+
}
|
|
51
|
+
function normalizeMounts(mounts) {
|
|
52
|
+
if (!Array.isArray(mounts) || mounts.length === 0) {
|
|
53
|
+
throw new Error("mounts must be a non-empty array of mount objects");
|
|
54
|
+
}
|
|
55
|
+
return mounts.map((mount) => {
|
|
56
|
+
if (mount === null || typeof mount !== "object" || Array.isArray(mount)) {
|
|
57
|
+
throw new Error("mounts must be a non-empty array of mount objects");
|
|
58
|
+
}
|
|
59
|
+
if (mount.type !== "s3" && mount.type !== "gcs") {
|
|
60
|
+
throw new Error("mountConfig only supports s3 and gcs mounts");
|
|
61
|
+
}
|
|
62
|
+
return mount;
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
function normalizeAuthRules(auth) {
|
|
66
|
+
if (!Array.isArray(auth)) {
|
|
67
|
+
throw new Error("auth must be an array of provider auth rules");
|
|
68
|
+
}
|
|
69
|
+
const byProvider = {};
|
|
70
|
+
for (const rule of auth) {
|
|
71
|
+
if (rule === null || typeof rule !== "object" || Array.isArray(rule)) {
|
|
72
|
+
throw new Error("auth must be an array of provider auth rules");
|
|
73
|
+
}
|
|
74
|
+
const provider = rule.type;
|
|
75
|
+
if (provider !== "aws" && provider !== "gcp") {
|
|
76
|
+
throw new Error("mountConfig auth only supports aws and gcp rules");
|
|
77
|
+
}
|
|
78
|
+
if (byProvider[provider] !== undefined) {
|
|
79
|
+
throw new Error(`duplicate ${provider} auth rule in mountConfig`);
|
|
80
|
+
}
|
|
81
|
+
byProvider[provider] = rule;
|
|
82
|
+
}
|
|
83
|
+
return byProvider;
|
|
84
|
+
}
|
|
85
|
+
export function mountConfig({ auth, mounts, }) {
|
|
86
|
+
const normalizedMounts = normalizeMounts(mounts);
|
|
87
|
+
const authByProvider = normalizeAuthRules(auth);
|
|
88
|
+
const mountProviders = new Set(normalizedMounts.map((mount) => mount.type));
|
|
89
|
+
if (mountProviders.has("s3") && authByProvider.aws === undefined) {
|
|
90
|
+
throw new Error("s3 mounts require aws auth in mountConfig");
|
|
91
|
+
}
|
|
92
|
+
if (mountProviders.has("gcs") && authByProvider.gcp === undefined) {
|
|
93
|
+
throw new Error("gcs mounts require gcp auth in mountConfig");
|
|
94
|
+
}
|
|
95
|
+
if (authByProvider.aws !== undefined && !mountProviders.has("s3")) {
|
|
96
|
+
throw new Error("aws auth requires at least one s3 mount in mountConfig");
|
|
97
|
+
}
|
|
98
|
+
if (authByProvider.gcp !== undefined && !mountProviders.has("gcs")) {
|
|
99
|
+
throw new Error("gcp auth requires at least one gcs mount in mountConfig");
|
|
100
|
+
}
|
|
101
|
+
return {
|
|
102
|
+
mounts: normalizedMounts,
|
|
103
|
+
proxyConfig: proxyConfig({
|
|
104
|
+
rules: ["aws", "gcp"]
|
|
105
|
+
.map((provider) => authByProvider[provider])
|
|
106
|
+
.filter((rule) => rule !== undefined),
|
|
107
|
+
}),
|
|
108
|
+
};
|
|
109
|
+
}
|
|
@@ -2,13 +2,41 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.workspaceSecret = workspaceSecret;
|
|
4
4
|
exports.opaqueSecret = opaqueSecret;
|
|
5
|
-
exports.
|
|
5
|
+
exports.proxyConfig = proxyConfig;
|
|
6
|
+
exports.mergeProxyConfigs = mergeProxyConfigs;
|
|
7
|
+
exports.awsAuth = awsAuth;
|
|
8
|
+
exports.gcpAuth = gcpAuth;
|
|
9
|
+
const DEFAULT_GCP_AUTH_MATCH_HOSTS = [
|
|
10
|
+
"storage.googleapis.com",
|
|
11
|
+
"www.googleapis.com",
|
|
12
|
+
];
|
|
13
|
+
const PROVIDER_RULE_TYPES = new Set(["aws", "gcp"]);
|
|
6
14
|
function requireNonEmptyString(value, field) {
|
|
7
15
|
if (typeof value !== "string" || value.trim() === "") {
|
|
8
16
|
throw new Error(`${field} must be a non-empty string`);
|
|
9
17
|
}
|
|
10
18
|
return value.trim();
|
|
11
19
|
}
|
|
20
|
+
function requireNonEmptyStringArray(values, field) {
|
|
21
|
+
if (!Array.isArray(values) || values.length === 0) {
|
|
22
|
+
throw new Error(`${field} must be a non-empty array of strings`);
|
|
23
|
+
}
|
|
24
|
+
return values.map((value) => requireNonEmptyString(value, field));
|
|
25
|
+
}
|
|
26
|
+
function requireProxyRules(rules) {
|
|
27
|
+
if (rules === undefined) {
|
|
28
|
+
return [];
|
|
29
|
+
}
|
|
30
|
+
if (!Array.isArray(rules)) {
|
|
31
|
+
throw new Error("rules must be an array of proxy rule objects");
|
|
32
|
+
}
|
|
33
|
+
return rules.map((rule) => {
|
|
34
|
+
if (rule === null || typeof rule !== "object" || Array.isArray(rule)) {
|
|
35
|
+
throw new Error("rules must be an array of proxy rule objects");
|
|
36
|
+
}
|
|
37
|
+
return rule;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
12
40
|
/** Reference a LangSmith workspace secret in a sandbox proxy configuration. */
|
|
13
41
|
function workspaceSecret(name) {
|
|
14
42
|
const normalized = requireNonEmptyString(name, "name");
|
|
@@ -32,9 +60,54 @@ function opaqueSecret(value) {
|
|
|
32
60
|
value: requireNonEmptyString(value, "value"),
|
|
33
61
|
};
|
|
34
62
|
}
|
|
35
|
-
/** Build a sandbox proxy config
|
|
36
|
-
function
|
|
37
|
-
const
|
|
63
|
+
/** Build a sandbox proxy config from one or more proxy rules. */
|
|
64
|
+
function proxyConfig({ rules, noProxy, accessControl, } = {}) {
|
|
65
|
+
const config = {
|
|
66
|
+
rules: requireProxyRules(rules),
|
|
67
|
+
};
|
|
68
|
+
if (noProxy !== undefined) {
|
|
69
|
+
config.no_proxy = requireNonEmptyStringArray(noProxy, "noProxy");
|
|
70
|
+
}
|
|
71
|
+
if (accessControl !== undefined) {
|
|
72
|
+
config.access_control = { ...accessControl };
|
|
73
|
+
}
|
|
74
|
+
return config;
|
|
75
|
+
}
|
|
76
|
+
function providerRuleTypes(config) {
|
|
77
|
+
const providers = new Set();
|
|
78
|
+
for (const rule of config.rules ?? []) {
|
|
79
|
+
if (rule === null || typeof rule !== "object" || Array.isArray(rule)) {
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
const ruleType = rule.type;
|
|
83
|
+
if (typeof ruleType === "string" && PROVIDER_RULE_TYPES.has(ruleType)) {
|
|
84
|
+
providers.add(ruleType);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return providers;
|
|
88
|
+
}
|
|
89
|
+
function mergeProxyConfigs(generatedConfig, explicitConfig) {
|
|
90
|
+
if (generatedConfig === undefined) {
|
|
91
|
+
return explicitConfig;
|
|
92
|
+
}
|
|
93
|
+
if (explicitConfig === undefined) {
|
|
94
|
+
return generatedConfig;
|
|
95
|
+
}
|
|
96
|
+
const generatedProviders = providerRuleTypes(generatedConfig);
|
|
97
|
+
for (const provider of providerRuleTypes(explicitConfig)) {
|
|
98
|
+
if (generatedProviders.has(provider)) {
|
|
99
|
+
throw new Error(`${provider} auth cannot be provided in both mountConfig and proxyConfig`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return {
|
|
103
|
+
...generatedConfig,
|
|
104
|
+
...explicitConfig,
|
|
105
|
+
rules: [...(generatedConfig.rules ?? []), ...(explicitConfig.rules ?? [])],
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
/** Build a sandbox proxy rule that signs AWS HTTPS requests with SigV4. */
|
|
109
|
+
function awsAuth({ accessKeyId, secretAccessKey, name = "aws", enabled = true, }) {
|
|
110
|
+
return {
|
|
38
111
|
name: requireNonEmptyString(name, "name"),
|
|
39
112
|
type: "aws",
|
|
40
113
|
enabled,
|
|
@@ -43,5 +116,17 @@ function awsAuthProxyConfig({ accessKeyId, secretAccessKey, name = "aws", enable
|
|
|
43
116
|
secret_access_key: secretAccessKey,
|
|
44
117
|
},
|
|
45
118
|
};
|
|
46
|
-
|
|
119
|
+
}
|
|
120
|
+
/** Build a sandbox proxy rule that injects GCP OAuth bearer auth. */
|
|
121
|
+
function gcpAuth({ serviceAccountJson, scopes, matchHosts = DEFAULT_GCP_AUTH_MATCH_HOSTS, name = "gcp", enabled = true, }) {
|
|
122
|
+
return {
|
|
123
|
+
name: requireNonEmptyString(name, "name"),
|
|
124
|
+
type: "gcp",
|
|
125
|
+
enabled,
|
|
126
|
+
match_hosts: requireNonEmptyStringArray(matchHosts, "matchHosts"),
|
|
127
|
+
gcp: {
|
|
128
|
+
service_account_json: serviceAccountJson,
|
|
129
|
+
scopes: requireNonEmptyStringArray(scopes, "scopes"),
|
|
130
|
+
},
|
|
131
|
+
};
|
|
47
132
|
}
|
|
@@ -1,12 +1,27 @@
|
|
|
1
|
-
import type { SandboxProxyConfig, SandboxProxySecret } from "./types.js";
|
|
1
|
+
import type { SandboxAccessControl, SandboxAwsAuthRule, SandboxGcpAuthRule, SandboxProxyConfig, SandboxProxyRule, SandboxProxySecret } from "./types.js";
|
|
2
2
|
/** Reference a LangSmith workspace secret in a sandbox proxy configuration. */
|
|
3
3
|
export declare function workspaceSecret(name: string): SandboxProxySecret;
|
|
4
4
|
/** Provide a write-only secret value for a sandbox proxy configuration. */
|
|
5
5
|
export declare function opaqueSecret(value: string): SandboxProxySecret;
|
|
6
|
-
/** Build a sandbox proxy config
|
|
7
|
-
export declare function
|
|
6
|
+
/** Build a sandbox proxy config from one or more proxy rules. */
|
|
7
|
+
export declare function proxyConfig({ rules, noProxy, accessControl, }?: {
|
|
8
|
+
rules?: SandboxProxyRule[];
|
|
9
|
+
noProxy?: string[];
|
|
10
|
+
accessControl?: SandboxAccessControl;
|
|
11
|
+
}): SandboxProxyConfig;
|
|
12
|
+
export declare function mergeProxyConfigs(generatedConfig: SandboxProxyConfig | undefined, explicitConfig: SandboxProxyConfig | undefined): SandboxProxyConfig | undefined;
|
|
13
|
+
/** Build a sandbox proxy rule that signs AWS HTTPS requests with SigV4. */
|
|
14
|
+
export declare function awsAuth({ accessKeyId, secretAccessKey, name, enabled, }: {
|
|
8
15
|
accessKeyId: SandboxProxySecret;
|
|
9
16
|
secretAccessKey: SandboxProxySecret;
|
|
10
17
|
name?: string;
|
|
11
18
|
enabled?: boolean;
|
|
12
|
-
}):
|
|
19
|
+
}): SandboxAwsAuthRule;
|
|
20
|
+
/** Build a sandbox proxy rule that injects GCP OAuth bearer auth. */
|
|
21
|
+
export declare function gcpAuth({ serviceAccountJson, scopes, matchHosts, name, enabled, }: {
|
|
22
|
+
serviceAccountJson: SandboxProxySecret;
|
|
23
|
+
scopes: string[];
|
|
24
|
+
matchHosts?: string[];
|
|
25
|
+
name?: string;
|
|
26
|
+
enabled?: boolean;
|
|
27
|
+
}): SandboxGcpAuthRule;
|
|
@@ -1,9 +1,34 @@
|
|
|
1
|
+
const DEFAULT_GCP_AUTH_MATCH_HOSTS = [
|
|
2
|
+
"storage.googleapis.com",
|
|
3
|
+
"www.googleapis.com",
|
|
4
|
+
];
|
|
5
|
+
const PROVIDER_RULE_TYPES = new Set(["aws", "gcp"]);
|
|
1
6
|
function requireNonEmptyString(value, field) {
|
|
2
7
|
if (typeof value !== "string" || value.trim() === "") {
|
|
3
8
|
throw new Error(`${field} must be a non-empty string`);
|
|
4
9
|
}
|
|
5
10
|
return value.trim();
|
|
6
11
|
}
|
|
12
|
+
function requireNonEmptyStringArray(values, field) {
|
|
13
|
+
if (!Array.isArray(values) || values.length === 0) {
|
|
14
|
+
throw new Error(`${field} must be a non-empty array of strings`);
|
|
15
|
+
}
|
|
16
|
+
return values.map((value) => requireNonEmptyString(value, field));
|
|
17
|
+
}
|
|
18
|
+
function requireProxyRules(rules) {
|
|
19
|
+
if (rules === undefined) {
|
|
20
|
+
return [];
|
|
21
|
+
}
|
|
22
|
+
if (!Array.isArray(rules)) {
|
|
23
|
+
throw new Error("rules must be an array of proxy rule objects");
|
|
24
|
+
}
|
|
25
|
+
return rules.map((rule) => {
|
|
26
|
+
if (rule === null || typeof rule !== "object" || Array.isArray(rule)) {
|
|
27
|
+
throw new Error("rules must be an array of proxy rule objects");
|
|
28
|
+
}
|
|
29
|
+
return rule;
|
|
30
|
+
});
|
|
31
|
+
}
|
|
7
32
|
/** Reference a LangSmith workspace secret in a sandbox proxy configuration. */
|
|
8
33
|
export function workspaceSecret(name) {
|
|
9
34
|
const normalized = requireNonEmptyString(name, "name");
|
|
@@ -27,9 +52,54 @@ export function opaqueSecret(value) {
|
|
|
27
52
|
value: requireNonEmptyString(value, "value"),
|
|
28
53
|
};
|
|
29
54
|
}
|
|
30
|
-
/** Build a sandbox proxy config
|
|
31
|
-
export function
|
|
32
|
-
const
|
|
55
|
+
/** Build a sandbox proxy config from one or more proxy rules. */
|
|
56
|
+
export function proxyConfig({ rules, noProxy, accessControl, } = {}) {
|
|
57
|
+
const config = {
|
|
58
|
+
rules: requireProxyRules(rules),
|
|
59
|
+
};
|
|
60
|
+
if (noProxy !== undefined) {
|
|
61
|
+
config.no_proxy = requireNonEmptyStringArray(noProxy, "noProxy");
|
|
62
|
+
}
|
|
63
|
+
if (accessControl !== undefined) {
|
|
64
|
+
config.access_control = { ...accessControl };
|
|
65
|
+
}
|
|
66
|
+
return config;
|
|
67
|
+
}
|
|
68
|
+
function providerRuleTypes(config) {
|
|
69
|
+
const providers = new Set();
|
|
70
|
+
for (const rule of config.rules ?? []) {
|
|
71
|
+
if (rule === null || typeof rule !== "object" || Array.isArray(rule)) {
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
const ruleType = rule.type;
|
|
75
|
+
if (typeof ruleType === "string" && PROVIDER_RULE_TYPES.has(ruleType)) {
|
|
76
|
+
providers.add(ruleType);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return providers;
|
|
80
|
+
}
|
|
81
|
+
export function mergeProxyConfigs(generatedConfig, explicitConfig) {
|
|
82
|
+
if (generatedConfig === undefined) {
|
|
83
|
+
return explicitConfig;
|
|
84
|
+
}
|
|
85
|
+
if (explicitConfig === undefined) {
|
|
86
|
+
return generatedConfig;
|
|
87
|
+
}
|
|
88
|
+
const generatedProviders = providerRuleTypes(generatedConfig);
|
|
89
|
+
for (const provider of providerRuleTypes(explicitConfig)) {
|
|
90
|
+
if (generatedProviders.has(provider)) {
|
|
91
|
+
throw new Error(`${provider} auth cannot be provided in both mountConfig and proxyConfig`);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return {
|
|
95
|
+
...generatedConfig,
|
|
96
|
+
...explicitConfig,
|
|
97
|
+
rules: [...(generatedConfig.rules ?? []), ...(explicitConfig.rules ?? [])],
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
/** Build a sandbox proxy rule that signs AWS HTTPS requests with SigV4. */
|
|
101
|
+
export function awsAuth({ accessKeyId, secretAccessKey, name = "aws", enabled = true, }) {
|
|
102
|
+
return {
|
|
33
103
|
name: requireNonEmptyString(name, "name"),
|
|
34
104
|
type: "aws",
|
|
35
105
|
enabled,
|
|
@@ -38,5 +108,17 @@ export function awsAuthProxyConfig({ accessKeyId, secretAccessKey, name = "aws",
|
|
|
38
108
|
secret_access_key: secretAccessKey,
|
|
39
109
|
},
|
|
40
110
|
};
|
|
41
|
-
|
|
111
|
+
}
|
|
112
|
+
/** Build a sandbox proxy rule that injects GCP OAuth bearer auth. */
|
|
113
|
+
export function gcpAuth({ serviceAccountJson, scopes, matchHosts = DEFAULT_GCP_AUTH_MATCH_HOSTS, name = "gcp", enabled = true, }) {
|
|
114
|
+
return {
|
|
115
|
+
name: requireNonEmptyString(name, "name"),
|
|
116
|
+
type: "gcp",
|
|
117
|
+
enabled,
|
|
118
|
+
match_hosts: requireNonEmptyStringArray(matchHosts, "matchHosts"),
|
|
119
|
+
gcp: {
|
|
120
|
+
service_account_json: serviceAccountJson,
|
|
121
|
+
scopes: requireNonEmptyStringArray(scopes, "scopes"),
|
|
122
|
+
},
|
|
123
|
+
};
|
|
42
124
|
}
|
package/dist/sandbox/types.d.ts
CHANGED
|
@@ -276,6 +276,24 @@ export interface SandboxAwsAuthRule {
|
|
|
276
276
|
secret_access_key: SandboxProxySecret;
|
|
277
277
|
};
|
|
278
278
|
}
|
|
279
|
+
/** GCP auth rule for sandbox proxy OAuth bearer injection. */
|
|
280
|
+
export interface SandboxGcpAuthRule {
|
|
281
|
+
/** Rule name. */
|
|
282
|
+
name: string;
|
|
283
|
+
/** GCP auth rules match explicit Google API host patterns. */
|
|
284
|
+
type: "gcp";
|
|
285
|
+
/** Whether the rule is enabled. */
|
|
286
|
+
enabled?: boolean;
|
|
287
|
+
/** Google API hosts covered by this rule, such as storage.googleapis.com. */
|
|
288
|
+
match_hosts: string[];
|
|
289
|
+
/** GCP service-account credential and OAuth scopes. */
|
|
290
|
+
gcp: {
|
|
291
|
+
service_account_json: SandboxProxySecret;
|
|
292
|
+
scopes: string[];
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
/** Proxy rule accepted by the sandbox proxy config. */
|
|
296
|
+
export type SandboxProxyRule = SandboxAwsAuthRule | SandboxGcpAuthRule | Record<string, unknown>;
|
|
279
297
|
/**
|
|
280
298
|
* Full proxy configuration forwarded to the sandbox server as-is (snake_case
|
|
281
299
|
* so it's wire-compatible with the backend). Mirrors the server's
|
|
@@ -283,12 +301,75 @@ export interface SandboxAwsAuthRule {
|
|
|
283
301
|
*/
|
|
284
302
|
export interface SandboxProxyConfig {
|
|
285
303
|
/** Header-injection rules keyed by host pattern. */
|
|
286
|
-
rules?:
|
|
304
|
+
rules?: SandboxProxyRule[];
|
|
287
305
|
/** Hosts that bypass the proxy entirely. */
|
|
288
306
|
no_proxy?: string[];
|
|
289
307
|
/** Allow/deny list enforced at the proxy sidecar. */
|
|
290
308
|
access_control?: SandboxAccessControl;
|
|
291
309
|
}
|
|
310
|
+
/** Optional per-mount cache configuration supported by all mount providers. */
|
|
311
|
+
export interface MountCacheConfig {
|
|
312
|
+
/** Maximum VFS cache size in bytes. */
|
|
313
|
+
max_size_bytes?: number;
|
|
314
|
+
/** Seconds rclone waits before writing cached changes back. */
|
|
315
|
+
writeback_seconds?: number;
|
|
316
|
+
}
|
|
317
|
+
interface SandboxMountBase {
|
|
318
|
+
/** Stable mount identifier. */
|
|
319
|
+
id: string;
|
|
320
|
+
/** Absolute path inside the sandbox where the mount appears. */
|
|
321
|
+
mount_path: string;
|
|
322
|
+
/** Whether the mount should be read-only. */
|
|
323
|
+
read_only?: boolean;
|
|
324
|
+
/** Optional per-mount VFS cache configuration. */
|
|
325
|
+
cache?: MountCacheConfig;
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* S3 configuration for a sandbox mount. Field names are snake_case so the
|
|
329
|
+
* object is wire-compatible with the backend `MountSpec` type.
|
|
330
|
+
*/
|
|
331
|
+
export interface S3MountConfig {
|
|
332
|
+
/** S3 or S3-compatible endpoint URL. */
|
|
333
|
+
endpoint_url: string;
|
|
334
|
+
/** AWS region for signing and bucket access. */
|
|
335
|
+
region: string;
|
|
336
|
+
/** Bucket name. */
|
|
337
|
+
bucket: string;
|
|
338
|
+
/** Optional key prefix inside the bucket. */
|
|
339
|
+
prefix?: string;
|
|
340
|
+
/** Whether to use path-style addressing for S3-compatible endpoints. */
|
|
341
|
+
path_style?: boolean;
|
|
342
|
+
}
|
|
343
|
+
/** S3-backed sandbox mount specification. */
|
|
344
|
+
export interface S3MountSpec extends SandboxMountBase {
|
|
345
|
+
/** Mount type. */
|
|
346
|
+
type: "s3";
|
|
347
|
+
/** S3 mount configuration. */
|
|
348
|
+
s3: S3MountConfig;
|
|
349
|
+
}
|
|
350
|
+
/** GCS configuration for a sandbox mount. */
|
|
351
|
+
export interface GCSMountConfig {
|
|
352
|
+
/** GCS bucket name. */
|
|
353
|
+
bucket: string;
|
|
354
|
+
/** Optional object prefix inside the bucket. */
|
|
355
|
+
prefix?: string;
|
|
356
|
+
}
|
|
357
|
+
/** GCS-backed sandbox mount specification. */
|
|
358
|
+
export interface GCSMountSpec extends SandboxMountBase {
|
|
359
|
+
/** Mount type. */
|
|
360
|
+
type: "gcs";
|
|
361
|
+
/** GCS mount configuration. */
|
|
362
|
+
gcs: GCSMountConfig;
|
|
363
|
+
}
|
|
364
|
+
/** Sandbox mount specification. */
|
|
365
|
+
export type SandboxMount = S3MountSpec | GCSMountSpec;
|
|
366
|
+
/** SDK-level mount config expanded into backend mounts and proxyConfig. */
|
|
367
|
+
export interface SandboxMountConfig {
|
|
368
|
+
/** Mounts attached to the sandbox. */
|
|
369
|
+
mounts: SandboxMount[];
|
|
370
|
+
/** Proxy auth config required by the mounts. */
|
|
371
|
+
proxyConfig: SandboxProxyConfig;
|
|
372
|
+
}
|
|
292
373
|
/**
|
|
293
374
|
* Options for creating a sandbox.
|
|
294
375
|
*/
|
|
@@ -335,12 +416,19 @@ export interface CreateSandboxOptions {
|
|
|
335
416
|
memBytes?: number;
|
|
336
417
|
/** Root filesystem capacity in bytes. */
|
|
337
418
|
fsCapacityBytes?: number;
|
|
419
|
+
/**
|
|
420
|
+
* High-level mount configuration. The SDK expands it into backend `mounts`
|
|
421
|
+
* and `proxy_config` fields. If `proxyConfig` is also provided, its rules are
|
|
422
|
+
* merged with the mount-generated proxy auth rules.
|
|
423
|
+
*/
|
|
424
|
+
mountConfig?: SandboxMountConfig;
|
|
338
425
|
/**
|
|
339
426
|
* Per-sandbox proxy configuration. Use
|
|
340
427
|
* `{ access_control: { allow_list: ["github.com", "*.example.com"] } }`
|
|
341
428
|
* to restrict outbound HTTPS to a set of host patterns. Forwarded to the
|
|
342
|
-
* server as-is on the wire. Use `
|
|
343
|
-
*
|
|
429
|
+
* server as-is on the wire. Use `proxyConfig` with provider rule helpers
|
|
430
|
+
* such as `awsAuth` for AWS SigV4 auth or `gcpAuth` for GCP OAuth bearer
|
|
431
|
+
* auth.
|
|
344
432
|
*/
|
|
345
433
|
proxyConfig?: SandboxProxyConfig;
|
|
346
434
|
}
|
|
@@ -485,3 +573,4 @@ export interface WaitForSandboxOptions {
|
|
|
485
573
|
/** AbortSignal for cancellation. */
|
|
486
574
|
signal?: AbortSignal;
|
|
487
575
|
}
|
|
576
|
+
export {};
|
package/dist/traceable.cjs
CHANGED
|
@@ -232,7 +232,7 @@ const handleRunAttachments = (rawInputs, extractAttachments) => {
|
|
|
232
232
|
}
|
|
233
233
|
};
|
|
234
234
|
const getTracingRunTree = (runTree, inputs, getInvocationParams, processInputs, extractAttachments) => {
|
|
235
|
-
if (!(0, env_js_1.
|
|
235
|
+
if (!(0, env_js_1.isEnvTracingEnabled)(runTree.tracingEnabled)) {
|
|
236
236
|
return { tracingEnabled: runTree.tracingEnabled };
|
|
237
237
|
}
|
|
238
238
|
const [attached, args] = handleRunAttachments(inputs, extractAttachments);
|
package/dist/traceable.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
2
|
import { RunTree, isRunTree, isRunnableConfigLike, } from "./run_trees.js";
|
|
3
|
-
import {
|
|
3
|
+
import { isEnvTracingEnabled } from "./env.js";
|
|
4
4
|
import { ROOT, AsyncLocalStorageProviderSingleton, getCurrentRunTree, } from "./singletons/traceable.js";
|
|
5
5
|
import { _LC_CHILD_RUN_END_PROMISES_KEY, _LC_CONTEXT_VARIABLES_KEY, } from "./singletons/constants.js";
|
|
6
6
|
import { isKVMap, isReadableStream, isAsyncIterable, isIteratorLike, isThenable, isGenerator, isPromiseMethod, } from "./utils/asserts.js";
|
|
@@ -228,7 +228,7 @@ const handleRunAttachments = (rawInputs, extractAttachments) => {
|
|
|
228
228
|
}
|
|
229
229
|
};
|
|
230
230
|
const getTracingRunTree = (runTree, inputs, getInvocationParams, processInputs, extractAttachments) => {
|
|
231
|
-
if (!
|
|
231
|
+
if (!isEnvTracingEnabled(runTree.tracingEnabled)) {
|
|
232
232
|
return { tracingEnabled: runTree.tracingEnabled };
|
|
233
233
|
}
|
|
234
234
|
const [attached, args] = handleRunAttachments(inputs, extractAttachments);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isTracingEnabled = isTracingEnabled;
|
|
4
|
+
const env_js_1 = require("../env.cjs");
|
|
5
|
+
const traceable_js_1 = require("../singletons/traceable.cjs");
|
|
6
|
+
/**
|
|
7
|
+
* Check if tracing is enabled for the current run tree or environment.
|
|
8
|
+
*
|
|
9
|
+
* @returns `true` if tracing is enabled, `false` otherwise.
|
|
10
|
+
*/
|
|
11
|
+
function isTracingEnabled() {
|
|
12
|
+
return (0, traceable_js_1.getCurrentRunTree)(true)?.tracingEnabled ?? (0, env_js_1.isEnvTracingEnabled)();
|
|
13
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { isEnvTracingEnabled } from "../env.js";
|
|
2
|
+
import { getCurrentRunTree } from "../singletons/traceable.js";
|
|
3
|
+
/**
|
|
4
|
+
* Check if tracing is enabled for the current run tree or environment.
|
|
5
|
+
*
|
|
6
|
+
* @returns `true` if tracing is enabled, `false` otherwise.
|
|
7
|
+
*/
|
|
8
|
+
export function isTracingEnabled() {
|
|
9
|
+
return getCurrentRunTree(true)?.tracingEnabled ?? isEnvTracingEnabled();
|
|
10
|
+
}
|
|
@@ -16,7 +16,7 @@ function trackingEnabled(context) {
|
|
|
16
16
|
if ((0, env_js_1.getEnvironmentVariable)("LANGSMITH_TEST_TRACKING") === "false") {
|
|
17
17
|
return false;
|
|
18
18
|
}
|
|
19
|
-
return (0, env_js_2.
|
|
19
|
+
return (0, env_js_2.isEnvTracingEnabled)();
|
|
20
20
|
}
|
|
21
21
|
exports.evaluatorLogFeedbackPromises = new Set();
|
|
22
22
|
exports.syncExamplePromises = new Map();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
2
|
import { Client } from "../../client.js";
|
|
3
3
|
import { getEnvironmentVariable } from "../env.js";
|
|
4
|
-
import {
|
|
4
|
+
import { isEnvTracingEnabled } from "../../env.js";
|
|
5
5
|
export const DEFAULT_TEST_CLIENT = new Client();
|
|
6
6
|
export const testWrapperAsyncLocalStorageInstance = new AsyncLocalStorage();
|
|
7
7
|
export function trackingEnabled(context) {
|
|
@@ -11,7 +11,7 @@ export function trackingEnabled(context) {
|
|
|
11
11
|
if (getEnvironmentVariable("LANGSMITH_TEST_TRACKING") === "false") {
|
|
12
12
|
return false;
|
|
13
13
|
}
|
|
14
|
-
return
|
|
14
|
+
return isEnvTracingEnabled();
|
|
15
15
|
}
|
|
16
16
|
export const evaluatorLogFeedbackPromises = new Set();
|
|
17
17
|
export const syncExamplePromises = new Map();
|