langsmith 0.10.11 → 0.10.13
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/CHANGELOG.md +28 -0
- package/README.md +198 -198
- package/lib/address.d.mts +35 -56
- package/lib/address.d.mts.map +1 -1
- package/lib/address.d.ts +35 -56
- package/lib/address.d.ts.map +1 -1
- package/lib/address.js +91 -156
- package/lib/address.js.map +1 -1
- package/lib/address.mjs +83 -151
- package/lib/address.mjs.map +1 -1
- package/lib/client.d.mts +1 -1
- package/lib/client.d.mts.map +1 -1
- package/lib/client.d.ts +1 -1
- package/lib/client.d.ts.map +1 -1
- package/lib/client.js +11 -10
- package/lib/client.js.map +1 -1
- package/lib/client.mjs +4 -3
- package/lib/client.mjs.map +1 -1
- package/lib/run_trees.d.mts +1 -1
- package/lib/run_trees.d.mts.map +1 -1
- package/lib/run_trees.d.ts +1 -1
- package/lib/run_trees.d.ts.map +1 -1
- package/lib/run_trees.js +11 -9
- package/lib/run_trees.js.map +1 -1
- package/lib/run_trees.mjs +7 -5
- package/lib/run_trees.mjs.map +1 -1
- package/lib/sandbox/index.d.mts +1 -1
- package/lib/sandbox/index.d.mts.map +1 -1
- package/lib/sandbox/index.d.ts +1 -1
- package/lib/sandbox/index.d.ts.map +1 -1
- package/lib/sandbox/index.js.map +1 -1
- package/lib/sandbox/index.mjs.map +1 -1
- package/lib/sandbox/mounts.d.mts +3 -2
- package/lib/sandbox/mounts.d.mts.map +1 -1
- package/lib/sandbox/mounts.d.ts +3 -2
- package/lib/sandbox/mounts.d.ts.map +1 -1
- package/lib/sandbox/mounts.js +6 -1
- package/lib/sandbox/mounts.js.map +1 -1
- package/lib/sandbox/mounts.mjs +6 -1
- package/lib/sandbox/mounts.mjs.map +1 -1
- package/lib/sandbox/types.d.mts +7 -0
- package/lib/sandbox/types.d.mts.map +1 -1
- package/lib/sandbox/types.d.ts +7 -0
- package/lib/sandbox/types.d.ts.map +1 -1
- package/lib/sandbox/verify.d.mts.map +1 -1
- package/lib/sandbox/verify.d.ts.map +1 -1
- package/lib/sandbox/verify.js +81 -19
- package/lib/sandbox/verify.js.map +1 -1
- package/lib/sandbox/verify.mjs +81 -19
- package/lib/sandbox/verify.mjs.map +1 -1
- package/lib/utils/addressing.d.mts +1 -1
- package/lib/utils/addressing.d.mts.map +1 -1
- package/lib/utils/addressing.d.ts +1 -1
- package/lib/utils/addressing.d.ts.map +1 -1
- package/lib/utils/addressing.js +4 -4
- package/lib/utils/addressing.js.map +1 -1
- package/lib/utils/addressing.mjs +5 -5
- package/lib/utils/addressing.mjs.map +1 -1
- package/package.json +22 -10
- package/resources/annotation-queues/annotation-queues.d.mts +33 -2
- package/resources/annotation-queues/annotation-queues.d.mts.map +1 -1
- package/resources/annotation-queues/annotation-queues.d.ts +33 -2
- package/resources/annotation-queues/annotation-queues.d.ts.map +1 -1
- package/resources/annotation-queues/annotation-queues.js.map +1 -1
- package/resources/annotation-queues/annotation-queues.mjs.map +1 -1
- package/resources/runs/runs.d.mts +14 -1
- package/resources/runs/runs.d.mts.map +1 -1
- package/resources/runs/runs.d.ts +14 -1
- package/resources/runs/runs.d.ts.map +1 -1
- package/resources/runs/runs.js +4 -0
- package/resources/runs/runs.js.map +1 -1
- package/resources/runs/runs.mjs +4 -0
- package/resources/runs/runs.mjs.map +1 -1
- package/resources/sandboxes/boxes.d.mts +32 -0
- package/resources/sandboxes/boxes.d.mts.map +1 -1
- package/resources/sandboxes/boxes.d.ts +32 -0
- package/resources/sandboxes/boxes.d.ts.map +1 -1
- package/resources/sandboxes/sandboxes.d.mts +32 -0
- package/resources/sandboxes/sandboxes.d.mts.map +1 -1
- package/resources/sandboxes/sandboxes.d.ts +32 -0
- package/resources/sandboxes/sandboxes.d.ts.map +1 -1
- package/resources/sandboxes/sandboxes.js.map +1 -1
- package/resources/sandboxes/sandboxes.mjs.map +1 -1
- package/resources/threads/threads.d.mts +13 -1
- package/resources/threads/threads.d.mts.map +1 -1
- package/resources/threads/threads.d.ts +13 -1
- package/resources/threads/threads.d.ts.map +1 -1
- package/resources/threads/threads.js +4 -0
- package/resources/threads/threads.js.map +1 -1
- package/resources/threads/threads.mjs +4 -0
- package/resources/threads/threads.mjs.map +1 -1
- package/resources/traces.d.mts +34 -16
- package/resources/traces.d.mts.map +1 -1
- package/resources/traces.d.ts +34 -16
- package/resources/traces.d.ts.map +1 -1
- package/resources/traces.js +7 -1
- package/resources/traces.js.map +1 -1
- package/resources/traces.mjs +7 -1
- package/resources/traces.mjs.map +1 -1
- package/src/lib/address.ts +138 -180
- package/src/lib/client.ts +4 -5
- package/src/lib/run_trees.ts +8 -5
- package/src/lib/sandbox/README.md +3 -2
- package/src/lib/sandbox/index.ts +1 -0
- package/src/lib/sandbox/mounts.ts +8 -0
- package/src/lib/sandbox/types.ts +8 -0
- package/src/lib/sandbox/verify.ts +107 -28
- package/src/lib/utils/addressing.ts +8 -5
- package/src/resources/annotation-queues/annotation-queues.ts +46 -2
- package/src/resources/runs/runs.ts +15 -1
- package/src/resources/sandboxes/boxes.ts +40 -0
- package/src/resources/sandboxes/sandboxes.ts +40 -0
- package/src/resources/threads/threads.ts +14 -1
- package/src/resources/traces.ts +38 -16
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
package/lib/address.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.ensureAgent = ensureAgent;
|
|
3
|
+
exports.EnvAddressError = exports.EvaluatorAddress = exports.ExperimentAddress = exports.AgentAddress = void 0;
|
|
5
4
|
exports.ensureAddress = ensureAddress;
|
|
5
|
+
exports.ensureAgent = ensureAgent;
|
|
6
|
+
exports.addressToLrn = addressToLrn;
|
|
7
|
+
exports.addressFromLrn = addressFromLrn;
|
|
8
|
+
exports.addressFromEnv = addressFromEnv;
|
|
6
9
|
exports.envNames = envNames;
|
|
7
10
|
/**
|
|
8
11
|
* (beta) Addresses that name where runs are sent instead of a project.
|
|
@@ -22,16 +25,40 @@ exports.envNames = envNames;
|
|
|
22
25
|
* ```
|
|
23
26
|
*/
|
|
24
27
|
const env_js_1 = require("./utils/env.js");
|
|
28
|
+
/** (beta) Construct and validate an agent address; plain objects are also accepted. */
|
|
29
|
+
class AgentAddress {
|
|
30
|
+
constructor(id, environment) {
|
|
31
|
+
const address = ensureAgent({ kind: "AGENT", id, environment });
|
|
32
|
+
this.kind = address.kind;
|
|
33
|
+
this.id = address.id;
|
|
34
|
+
this.environment = address.environment;
|
|
35
|
+
Object.freeze(this);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.AgentAddress = AgentAddress;
|
|
39
|
+
/** (beta) Construct and validate an experiment address. */
|
|
40
|
+
class ExperimentAddress {
|
|
41
|
+
constructor(id) {
|
|
42
|
+
const address = ensureAddress({ kind: "EXPERIMENT", id });
|
|
43
|
+
this.kind = address.kind;
|
|
44
|
+
this.id = address.id;
|
|
45
|
+
Object.freeze(this);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.ExperimentAddress = ExperimentAddress;
|
|
49
|
+
/** (beta) Construct the workspace's evaluators address. */
|
|
50
|
+
class EvaluatorAddress {
|
|
51
|
+
constructor() {
|
|
52
|
+
this.kind = "EVALUATOR";
|
|
53
|
+
Object.freeze(this);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.EvaluatorAddress = EvaluatorAddress;
|
|
25
57
|
const UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
26
58
|
// The server's agent id rule: a DNS label, so a hostname can carry the id.
|
|
27
59
|
const AGENT_ID_PATTERN = /^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$/;
|
|
28
|
-
const ENVIRONMENTS = [
|
|
29
|
-
|
|
30
|
-
"development",
|
|
31
|
-
"staging",
|
|
32
|
-
"production",
|
|
33
|
-
];
|
|
34
|
-
// The wire form of an agent address. The parts are validated by `AgentAddress`.
|
|
60
|
+
const ENVIRONMENTS = ["local", "development", "staging", "production"];
|
|
61
|
+
// The wire form of an agent address. The parts are validated at entrypoints.
|
|
35
62
|
const LRN_PATTERN = /^lrn:agents\/([^/]+)\/environments\/([^/]+)$/;
|
|
36
63
|
const ENV_NAMES = ["LANGSMITH_AGENT_ID", "LANGSMITH_AGENT_ENVIRONMENT"];
|
|
37
64
|
/** (beta) The `LANGSMITH_AGENT_*` / project env vars name half an address, or both. */
|
|
@@ -42,169 +69,77 @@ class EnvAddressError extends Error {
|
|
|
42
69
|
}
|
|
43
70
|
}
|
|
44
71
|
exports.EnvAddressError = EnvAddressError;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
* new AgentAddress("customer-support", "production");
|
|
51
|
-
* ```
|
|
52
|
-
*/
|
|
53
|
-
class AgentAddress {
|
|
54
|
-
/**
|
|
55
|
-
* @param id 1 to 63 lowercase ASCII letters, digits or hyphens, starting
|
|
56
|
-
* with a letter and ending with a letter or digit. The server creates the
|
|
57
|
-
* agent on first use.
|
|
58
|
-
* @param environment One of `local`, `development`, `staging` or `production`, in
|
|
59
|
-
* any case.
|
|
60
|
-
* @throws If a value is invalid.
|
|
61
|
-
*/
|
|
62
|
-
constructor(id, environment) {
|
|
63
|
-
Object.defineProperty(this, "id", {
|
|
64
|
-
enumerable: true,
|
|
65
|
-
configurable: true,
|
|
66
|
-
writable: true,
|
|
67
|
-
value: void 0
|
|
68
|
-
});
|
|
69
|
-
/** Always lowercase. */
|
|
70
|
-
Object.defineProperty(this, "environment", {
|
|
71
|
-
enumerable: true,
|
|
72
|
-
configurable: true,
|
|
73
|
-
writable: true,
|
|
74
|
-
value: void 0
|
|
75
|
-
});
|
|
76
|
-
if (typeof id !== "string" || !AGENT_ID_PATTERN.test(id)) {
|
|
77
|
-
throw new Error("Address agent id must be 1 to 63 lowercase ASCII letters, digits, or " +
|
|
78
|
-
"hyphens, start with a letter, and end with a letter or digit, got " +
|
|
79
|
-
`${JSON.stringify(id)}. Use an id such as "support-agent".`);
|
|
80
|
-
}
|
|
81
|
-
const normalized = typeof environment === "string" ? environment.toLowerCase() : undefined;
|
|
82
|
-
if (normalized === undefined || !ENVIRONMENTS.includes(normalized)) {
|
|
83
|
-
throw new Error(`Address environment must be one of ${ENVIRONMENTS.join(", ")}, got ` +
|
|
84
|
-
`${JSON.stringify(environment)}.`);
|
|
85
|
-
}
|
|
86
|
-
this.id = id;
|
|
87
|
-
this.environment = normalized;
|
|
88
|
-
Object.freeze(this);
|
|
89
|
-
}
|
|
90
|
-
toApiAddress() {
|
|
91
|
-
return {
|
|
92
|
-
kind: "AGENT",
|
|
93
|
-
id: this.id,
|
|
94
|
-
environment: this.environment.toUpperCase(),
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
/** @internal */
|
|
98
|
-
_toLrn() {
|
|
99
|
-
return `lrn:agents/${this.id}/environments/${this.environment}`;
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* @internal Parse an LRN read from the wire, such as a `baggage` header. The
|
|
103
|
-
* value is untrusted, so it is not echoed in the error.
|
|
104
|
-
* @throws If `value` is not an agent LRN, or names an invalid id or environment.
|
|
105
|
-
*/
|
|
106
|
-
static _fromLrn(value) {
|
|
107
|
-
const match = typeof value === "string" ? LRN_PATTERN.exec(value) : null;
|
|
108
|
-
if (match === null) {
|
|
109
|
-
throw new Error("Not an agent address.");
|
|
110
|
-
}
|
|
111
|
-
return new AgentAddress(match[1], match[2]);
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Read the agent named by `LANGSMITH_AGENT_ID` and
|
|
115
|
-
* `LANGSMITH_AGENT_ENVIRONMENT`; `undefined` if neither is set.
|
|
116
|
-
* @throws {EnvAddressError} If only one is set, or a value is invalid.
|
|
117
|
-
*/
|
|
118
|
-
static fromEnv() {
|
|
119
|
-
const values = ENV_NAMES.map((name) => (0, env_js_1.getEnvironmentVariable)(name));
|
|
120
|
-
if (!values.some(Boolean)) {
|
|
121
|
-
return undefined;
|
|
122
|
-
}
|
|
123
|
-
try {
|
|
124
|
-
const missing = ENV_NAMES.filter((_, i) => !values[i]);
|
|
125
|
-
if (missing.length > 0) {
|
|
126
|
-
throw new Error(`An address needs ${missing.join(" and ")} as well.`);
|
|
127
|
-
}
|
|
128
|
-
return new AgentAddress(values[0], values[1]);
|
|
129
|
-
}
|
|
130
|
-
catch (e) {
|
|
131
|
-
const present = ENV_NAMES.flatMap((name, i) => values[i] ? [`${name}=${JSON.stringify(values[i])}`] : []).join(", ");
|
|
132
|
-
throw new EnvAddressError(`The LANGSMITH_AGENT_* env vars can't address a run (${present}): ${e.message}`);
|
|
133
|
-
}
|
|
72
|
+
function ensureAddress(value) {
|
|
73
|
+
if (value == null)
|
|
74
|
+
return undefined;
|
|
75
|
+
if (typeof value !== "object") {
|
|
76
|
+
throw new Error("address must be an AgentAddress, ExperimentAddress or EvaluatorAddress object.");
|
|
134
77
|
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* @param id The experiment's UUID.
|
|
141
|
-
* @throws If `id` is not a UUID.
|
|
142
|
-
*/
|
|
143
|
-
constructor(id) {
|
|
144
|
-
/** Always lowercase. */
|
|
145
|
-
Object.defineProperty(this, "id", {
|
|
146
|
-
enumerable: true,
|
|
147
|
-
configurable: true,
|
|
148
|
-
writable: true,
|
|
149
|
-
value: void 0
|
|
150
|
-
});
|
|
78
|
+
const { kind, id, environment } = value;
|
|
79
|
+
if (kind === "EVALUATOR")
|
|
80
|
+
return { kind };
|
|
81
|
+
if (kind === "EXPERIMENT") {
|
|
151
82
|
if (typeof id !== "string" || !UUID_PATTERN.test(id)) {
|
|
152
83
|
throw new Error(`Experiment id must be a UUID, got ${JSON.stringify(id)}.`);
|
|
153
84
|
}
|
|
154
|
-
|
|
155
|
-
Object.freeze(this);
|
|
85
|
+
return { kind, id: id.toLowerCase() };
|
|
156
86
|
}
|
|
157
|
-
|
|
158
|
-
|
|
87
|
+
if (kind !== "AGENT") {
|
|
88
|
+
throw new Error("address must be an AgentAddress, ExperimentAddress or EvaluatorAddress object.");
|
|
159
89
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
constructor() {
|
|
165
|
-
Object.freeze(this);
|
|
90
|
+
if (typeof id !== "string" || !AGENT_ID_PATTERN.test(id)) {
|
|
91
|
+
throw new Error("Address agent id must be 1 to 63 lowercase ASCII letters, digits, or " +
|
|
92
|
+
"hyphens, start with a letter, and end with a letter or digit, got " +
|
|
93
|
+
`${JSON.stringify(id)}. Use an id such as "support-agent".`);
|
|
166
94
|
}
|
|
167
|
-
|
|
168
|
-
|
|
95
|
+
const normalized = typeof environment === "string" ? environment.toLowerCase() : undefined;
|
|
96
|
+
if (normalized === undefined || !ENVIRONMENTS.includes(normalized)) {
|
|
97
|
+
throw new Error(`Address environment must be one of ${ENVIRONMENTS.join(", ")}, got ${JSON.stringify(environment)}.`);
|
|
169
98
|
}
|
|
99
|
+
return {
|
|
100
|
+
kind,
|
|
101
|
+
id,
|
|
102
|
+
environment: normalized.toUpperCase(),
|
|
103
|
+
};
|
|
170
104
|
}
|
|
171
|
-
exports.EvaluatorAddress = EvaluatorAddress;
|
|
172
|
-
/**
|
|
173
|
-
* @internal The ingestion entry-point guard: `value` must be an `AgentAddress` (or
|
|
174
|
-
* absent), and is returned as is. Other addresses and strings are rejected.
|
|
175
|
-
* @throws If `value` is not an `AgentAddress`.
|
|
176
|
-
*/
|
|
177
105
|
function ensureAgent(value) {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
if (value instanceof AgentAddress) {
|
|
182
|
-
return value;
|
|
106
|
+
const address = ensureAddress(value);
|
|
107
|
+
if (address && address.kind !== "AGENT") {
|
|
108
|
+
throw new Error(`Only an AgentAddress can receive traces, got ${address.kind}.`);
|
|
183
109
|
}
|
|
184
|
-
|
|
185
|
-
typeof value.toApiAddress === "function") {
|
|
186
|
-
throw new Error(`Only an AgentAddress can receive traces, got ${value.constructor?.name ?? "an unknown address"}.`);
|
|
187
|
-
}
|
|
188
|
-
throw new Error("address must be an AgentAddress such as `new AgentAddress(id, environment)`, got " +
|
|
189
|
-
`${typeof value === "string" ? JSON.stringify(value) : typeof value}.`);
|
|
110
|
+
return address;
|
|
190
111
|
}
|
|
191
|
-
/**
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
*/
|
|
196
|
-
function
|
|
197
|
-
|
|
112
|
+
/** @internal Convert a validated address to the ingestion wire format. */
|
|
113
|
+
function addressToLrn(address) {
|
|
114
|
+
return `lrn:agents/${address.id}/environments/${address.environment.toLowerCase()}`;
|
|
115
|
+
}
|
|
116
|
+
/** @internal Parse and validate an address from untrusted wire data. */
|
|
117
|
+
function addressFromLrn(value) {
|
|
118
|
+
const match = typeof value === "string" ? LRN_PATTERN.exec(value) : null;
|
|
119
|
+
if (!match)
|
|
120
|
+
throw new Error("Not an agent address.");
|
|
121
|
+
return ensureAgent({ kind: "AGENT", id: match[1], environment: match[2] });
|
|
122
|
+
}
|
|
123
|
+
/** @internal Read and validate the address named by environment variables. */
|
|
124
|
+
function addressFromEnv() {
|
|
125
|
+
const values = ENV_NAMES.map((name) => (0, env_js_1.getEnvironmentVariable)(name));
|
|
126
|
+
if (!values.some(Boolean))
|
|
198
127
|
return undefined;
|
|
128
|
+
try {
|
|
129
|
+
const missing = ENV_NAMES.filter((_, i) => !values[i]);
|
|
130
|
+
if (missing.length)
|
|
131
|
+
throw new Error(`An address needs ${missing.join(" and ")} as well.`);
|
|
132
|
+
return ensureAgent({
|
|
133
|
+
kind: "AGENT",
|
|
134
|
+
id: values[0],
|
|
135
|
+
environment: values[1],
|
|
136
|
+
});
|
|
199
137
|
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
return value;
|
|
138
|
+
catch (e) {
|
|
139
|
+
throw new EnvAddressError(`The LANGSMITH_AGENT_* env vars can't address a run: ${e.message}`);
|
|
203
140
|
}
|
|
204
|
-
throw new Error("address must be an AgentAddress, ExperimentAddress or EvaluatorAddress, got " +
|
|
205
|
-
`${typeof value === "string" ? JSON.stringify(value) : typeof value}.`);
|
|
206
141
|
}
|
|
207
|
-
/** @internal The
|
|
142
|
+
/** @internal The environment variable names an address reads. */
|
|
208
143
|
function envNames() {
|
|
209
144
|
return ENV_NAMES;
|
|
210
145
|
}
|
package/lib/address.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"address.js","sourceRoot":"","sources":["../src/lib/address.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"address.js","sourceRoot":"","sources":["../src/lib/address.ts"],"names":[],"mappings":";;;AA4GA,sCA2CC;AASD,kCAQC;AAGD,oCAIC;AAGD,wCAIC;AAGD,wCAmBC;AAGD,4BAEC;AAjND;;;;;;;;;;;;;;;;GAgBG;AACH,2CAAwD;AAkBxD,uFAAuF;AACvF,MAAa,YAAY;IACvB,YAAY,EAAU,EAAE,WAAwC;QAC9D,MAAM,OAAO,GAAG,WAAW,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC;QAChE,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QACzB,IAAI,CAAC,EAAE,GAAG,OAAO,CAAC,EAAE,CAAC;QACrB,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;QACvC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACtB,CAAC;CACF;AARD,oCAQC;AAQD,2DAA2D;AAC3D,MAAa,iBAAiB;IAC5B,YAAY,EAAU;QACpB,MAAM,OAAO,GAAG,aAAa,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,EAA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;YACb,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC;YACb,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC;SACvB,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,IAAI,eAAe,CACvB,uDACG,CAAW,CAAC,OACf,EAAE,CACH,CAAC;IACJ,CAAC;AACH,CAAC;AAED,iEAAiE;AACjE,SAAgB,QAAQ;IACtB,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
package/lib/address.mjs
CHANGED
|
@@ -16,16 +16,37 @@
|
|
|
16
16
|
* ```
|
|
17
17
|
*/
|
|
18
18
|
import { getEnvironmentVariable } from "./utils/env.mjs";
|
|
19
|
+
/** (beta) Construct and validate an agent address; plain objects are also accepted. */
|
|
20
|
+
export class AgentAddress {
|
|
21
|
+
constructor(id, environment) {
|
|
22
|
+
const address = ensureAgent({ kind: "AGENT", id, environment });
|
|
23
|
+
this.kind = address.kind;
|
|
24
|
+
this.id = address.id;
|
|
25
|
+
this.environment = address.environment;
|
|
26
|
+
Object.freeze(this);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/** (beta) Construct and validate an experiment address. */
|
|
30
|
+
export class ExperimentAddress {
|
|
31
|
+
constructor(id) {
|
|
32
|
+
const address = ensureAddress({ kind: "EXPERIMENT", id });
|
|
33
|
+
this.kind = address.kind;
|
|
34
|
+
this.id = address.id;
|
|
35
|
+
Object.freeze(this);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
/** (beta) Construct the workspace's evaluators address. */
|
|
39
|
+
export class EvaluatorAddress {
|
|
40
|
+
constructor() {
|
|
41
|
+
this.kind = "EVALUATOR";
|
|
42
|
+
Object.freeze(this);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
19
45
|
const UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
20
46
|
// The server's agent id rule: a DNS label, so a hostname can carry the id.
|
|
21
47
|
const AGENT_ID_PATTERN = /^[a-z]([a-z0-9-]{0,61}[a-z0-9])?$/;
|
|
22
|
-
const ENVIRONMENTS = [
|
|
23
|
-
|
|
24
|
-
"development",
|
|
25
|
-
"staging",
|
|
26
|
-
"production",
|
|
27
|
-
];
|
|
28
|
-
// The wire form of an agent address. The parts are validated by `AgentAddress`.
|
|
48
|
+
const ENVIRONMENTS = ["local", "development", "staging", "production"];
|
|
49
|
+
// The wire form of an agent address. The parts are validated at entrypoints.
|
|
29
50
|
const LRN_PATTERN = /^lrn:agents\/([^/]+)\/environments\/([^/]+)$/;
|
|
30
51
|
const ENV_NAMES = ["LANGSMITH_AGENT_ID", "LANGSMITH_AGENT_ENVIRONMENT"];
|
|
31
52
|
/** (beta) The `LANGSMITH_AGENT_*` / project env vars name half an address, or both. */
|
|
@@ -35,166 +56,77 @@ export class EnvAddressError extends Error {
|
|
|
35
56
|
this.name = "EnvAddressError";
|
|
36
57
|
}
|
|
37
58
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
* new AgentAddress("customer-support", "production");
|
|
44
|
-
* ```
|
|
45
|
-
*/
|
|
46
|
-
export class AgentAddress {
|
|
47
|
-
/**
|
|
48
|
-
* @param id 1 to 63 lowercase ASCII letters, digits or hyphens, starting
|
|
49
|
-
* with a letter and ending with a letter or digit. The server creates the
|
|
50
|
-
* agent on first use.
|
|
51
|
-
* @param environment One of `local`, `development`, `staging` or `production`, in
|
|
52
|
-
* any case.
|
|
53
|
-
* @throws If a value is invalid.
|
|
54
|
-
*/
|
|
55
|
-
constructor(id, environment) {
|
|
56
|
-
Object.defineProperty(this, "id", {
|
|
57
|
-
enumerable: true,
|
|
58
|
-
configurable: true,
|
|
59
|
-
writable: true,
|
|
60
|
-
value: void 0
|
|
61
|
-
});
|
|
62
|
-
/** Always lowercase. */
|
|
63
|
-
Object.defineProperty(this, "environment", {
|
|
64
|
-
enumerable: true,
|
|
65
|
-
configurable: true,
|
|
66
|
-
writable: true,
|
|
67
|
-
value: void 0
|
|
68
|
-
});
|
|
69
|
-
if (typeof id !== "string" || !AGENT_ID_PATTERN.test(id)) {
|
|
70
|
-
throw new Error("Address agent id must be 1 to 63 lowercase ASCII letters, digits, or " +
|
|
71
|
-
"hyphens, start with a letter, and end with a letter or digit, got " +
|
|
72
|
-
`${JSON.stringify(id)}. Use an id such as "support-agent".`);
|
|
73
|
-
}
|
|
74
|
-
const normalized = typeof environment === "string" ? environment.toLowerCase() : undefined;
|
|
75
|
-
if (normalized === undefined || !ENVIRONMENTS.includes(normalized)) {
|
|
76
|
-
throw new Error(`Address environment must be one of ${ENVIRONMENTS.join(", ")}, got ` +
|
|
77
|
-
`${JSON.stringify(environment)}.`);
|
|
78
|
-
}
|
|
79
|
-
this.id = id;
|
|
80
|
-
this.environment = normalized;
|
|
81
|
-
Object.freeze(this);
|
|
82
|
-
}
|
|
83
|
-
toApiAddress() {
|
|
84
|
-
return {
|
|
85
|
-
kind: "AGENT",
|
|
86
|
-
id: this.id,
|
|
87
|
-
environment: this.environment.toUpperCase(),
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
/** @internal */
|
|
91
|
-
_toLrn() {
|
|
92
|
-
return `lrn:agents/${this.id}/environments/${this.environment}`;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* @internal Parse an LRN read from the wire, such as a `baggage` header. The
|
|
96
|
-
* value is untrusted, so it is not echoed in the error.
|
|
97
|
-
* @throws If `value` is not an agent LRN, or names an invalid id or environment.
|
|
98
|
-
*/
|
|
99
|
-
static _fromLrn(value) {
|
|
100
|
-
const match = typeof value === "string" ? LRN_PATTERN.exec(value) : null;
|
|
101
|
-
if (match === null) {
|
|
102
|
-
throw new Error("Not an agent address.");
|
|
103
|
-
}
|
|
104
|
-
return new AgentAddress(match[1], match[2]);
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Read the agent named by `LANGSMITH_AGENT_ID` and
|
|
108
|
-
* `LANGSMITH_AGENT_ENVIRONMENT`; `undefined` if neither is set.
|
|
109
|
-
* @throws {EnvAddressError} If only one is set, or a value is invalid.
|
|
110
|
-
*/
|
|
111
|
-
static fromEnv() {
|
|
112
|
-
const values = ENV_NAMES.map((name) => getEnvironmentVariable(name));
|
|
113
|
-
if (!values.some(Boolean)) {
|
|
114
|
-
return undefined;
|
|
115
|
-
}
|
|
116
|
-
try {
|
|
117
|
-
const missing = ENV_NAMES.filter((_, i) => !values[i]);
|
|
118
|
-
if (missing.length > 0) {
|
|
119
|
-
throw new Error(`An address needs ${missing.join(" and ")} as well.`);
|
|
120
|
-
}
|
|
121
|
-
return new AgentAddress(values[0], values[1]);
|
|
122
|
-
}
|
|
123
|
-
catch (e) {
|
|
124
|
-
const present = ENV_NAMES.flatMap((name, i) => values[i] ? [`${name}=${JSON.stringify(values[i])}`] : []).join(", ");
|
|
125
|
-
throw new EnvAddressError(`The LANGSMITH_AGENT_* env vars can't address a run (${present}): ${e.message}`);
|
|
126
|
-
}
|
|
59
|
+
export function ensureAddress(value) {
|
|
60
|
+
if (value == null)
|
|
61
|
+
return undefined;
|
|
62
|
+
if (typeof value !== "object") {
|
|
63
|
+
throw new Error("address must be an AgentAddress, ExperimentAddress or EvaluatorAddress object.");
|
|
127
64
|
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
* @param id The experiment's UUID.
|
|
133
|
-
* @throws If `id` is not a UUID.
|
|
134
|
-
*/
|
|
135
|
-
constructor(id) {
|
|
136
|
-
/** Always lowercase. */
|
|
137
|
-
Object.defineProperty(this, "id", {
|
|
138
|
-
enumerable: true,
|
|
139
|
-
configurable: true,
|
|
140
|
-
writable: true,
|
|
141
|
-
value: void 0
|
|
142
|
-
});
|
|
65
|
+
const { kind, id, environment } = value;
|
|
66
|
+
if (kind === "EVALUATOR")
|
|
67
|
+
return { kind };
|
|
68
|
+
if (kind === "EXPERIMENT") {
|
|
143
69
|
if (typeof id !== "string" || !UUID_PATTERN.test(id)) {
|
|
144
70
|
throw new Error(`Experiment id must be a UUID, got ${JSON.stringify(id)}.`);
|
|
145
71
|
}
|
|
146
|
-
|
|
147
|
-
Object.freeze(this);
|
|
72
|
+
return { kind, id: id.toLowerCase() };
|
|
148
73
|
}
|
|
149
|
-
|
|
150
|
-
|
|
74
|
+
if (kind !== "AGENT") {
|
|
75
|
+
throw new Error("address must be an AgentAddress, ExperimentAddress or EvaluatorAddress object.");
|
|
151
76
|
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
Object.freeze(this);
|
|
77
|
+
if (typeof id !== "string" || !AGENT_ID_PATTERN.test(id)) {
|
|
78
|
+
throw new Error("Address agent id must be 1 to 63 lowercase ASCII letters, digits, or " +
|
|
79
|
+
"hyphens, start with a letter, and end with a letter or digit, got " +
|
|
80
|
+
`${JSON.stringify(id)}. Use an id such as "support-agent".`);
|
|
157
81
|
}
|
|
158
|
-
|
|
159
|
-
|
|
82
|
+
const normalized = typeof environment === "string" ? environment.toLowerCase() : undefined;
|
|
83
|
+
if (normalized === undefined || !ENVIRONMENTS.includes(normalized)) {
|
|
84
|
+
throw new Error(`Address environment must be one of ${ENVIRONMENTS.join(", ")}, got ${JSON.stringify(environment)}.`);
|
|
160
85
|
}
|
|
86
|
+
return {
|
|
87
|
+
kind,
|
|
88
|
+
id,
|
|
89
|
+
environment: normalized.toUpperCase(),
|
|
90
|
+
};
|
|
161
91
|
}
|
|
162
|
-
/**
|
|
163
|
-
* @internal The ingestion entry-point guard: `value` must be an `AgentAddress` (or
|
|
164
|
-
* absent), and is returned as is. Other addresses and strings are rejected.
|
|
165
|
-
* @throws If `value` is not an `AgentAddress`.
|
|
166
|
-
*/
|
|
167
92
|
export function ensureAgent(value) {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
if (value instanceof AgentAddress) {
|
|
172
|
-
return value;
|
|
173
|
-
}
|
|
174
|
-
if (typeof value === "object" &&
|
|
175
|
-
typeof value.toApiAddress === "function") {
|
|
176
|
-
throw new Error(`Only an AgentAddress can receive traces, got ${value.constructor?.name ?? "an unknown address"}.`);
|
|
93
|
+
const address = ensureAddress(value);
|
|
94
|
+
if (address && address.kind !== "AGENT") {
|
|
95
|
+
throw new Error(`Only an AgentAddress can receive traces, got ${address.kind}.`);
|
|
177
96
|
}
|
|
178
|
-
|
|
179
|
-
`${typeof value === "string" ? JSON.stringify(value) : typeof value}.`);
|
|
97
|
+
return address;
|
|
180
98
|
}
|
|
181
|
-
/**
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
*/
|
|
186
|
-
export function
|
|
187
|
-
|
|
99
|
+
/** @internal Convert a validated address to the ingestion wire format. */
|
|
100
|
+
export function addressToLrn(address) {
|
|
101
|
+
return `lrn:agents/${address.id}/environments/${address.environment.toLowerCase()}`;
|
|
102
|
+
}
|
|
103
|
+
/** @internal Parse and validate an address from untrusted wire data. */
|
|
104
|
+
export function addressFromLrn(value) {
|
|
105
|
+
const match = typeof value === "string" ? LRN_PATTERN.exec(value) : null;
|
|
106
|
+
if (!match)
|
|
107
|
+
throw new Error("Not an agent address.");
|
|
108
|
+
return ensureAgent({ kind: "AGENT", id: match[1], environment: match[2] });
|
|
109
|
+
}
|
|
110
|
+
/** @internal Read and validate the address named by environment variables. */
|
|
111
|
+
export function addressFromEnv() {
|
|
112
|
+
const values = ENV_NAMES.map((name) => getEnvironmentVariable(name));
|
|
113
|
+
if (!values.some(Boolean))
|
|
188
114
|
return undefined;
|
|
115
|
+
try {
|
|
116
|
+
const missing = ENV_NAMES.filter((_, i) => !values[i]);
|
|
117
|
+
if (missing.length)
|
|
118
|
+
throw new Error(`An address needs ${missing.join(" and ")} as well.`);
|
|
119
|
+
return ensureAgent({
|
|
120
|
+
kind: "AGENT",
|
|
121
|
+
id: values[0],
|
|
122
|
+
environment: values[1],
|
|
123
|
+
});
|
|
189
124
|
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
return value;
|
|
125
|
+
catch (e) {
|
|
126
|
+
throw new EnvAddressError(`The LANGSMITH_AGENT_* env vars can't address a run: ${e.message}`);
|
|
193
127
|
}
|
|
194
|
-
throw new Error("address must be an AgentAddress, ExperimentAddress or EvaluatorAddress, got " +
|
|
195
|
-
`${typeof value === "string" ? JSON.stringify(value) : typeof value}.`);
|
|
196
128
|
}
|
|
197
|
-
/** @internal The
|
|
129
|
+
/** @internal The environment variable names an address reads. */
|
|
198
130
|
export function envNames() {
|
|
199
131
|
return ENV_NAMES;
|
|
200
132
|
}
|
package/lib/address.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"address.mjs","sourceRoot":"","sources":["../src/lib/address.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,sBAAsB,EAAE,wBAAuB;
|
|
1
|
+
{"version":3,"file":"address.mjs","sourceRoot":"","sources":["../src/lib/address.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,sBAAsB,EAAE,wBAAuB;AAkBxD,uFAAuF;AACvF,MAAM,OAAO,YAAY;IACvB,YAAY,EAAU,EAAE,WAAwC;QAC9D,MAAM,OAAO,GAAG,WAAW,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC;QAChE,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QACzB,IAAI,CAAC,EAAE,GAAG,OAAO,CAAC,EAAE,CAAC;QACrB,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;QACvC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACtB,CAAC;CACF;AAQD,2DAA2D;AAC3D,MAAM,OAAO,iBAAiB;IAC5B,YAAY,EAAU;QACpB,MAAM,OAAO,GAAG,aAAa,CAAC,EAAE,IAAI,EA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,IAAI,EAAE,OAAO;YACb,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC;YACb,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC;SACvB,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,IAAI,eAAe,CACvB,uDACG,CAAW,CAAC,OACf,EAAE,CACH,CAAC;IACJ,CAAC;AACH,CAAC;AAED,iEAAiE;AACjE,MAAM,UAAU,QAAQ;IACtB,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
package/lib/client.d.mts
CHANGED
|
@@ -637,7 +637,7 @@ export declare class Client implements LangSmithTracingClientInterface {
|
|
|
637
637
|
get traces(): Traces;
|
|
638
638
|
/**
|
|
639
639
|
* (beta) Access the sessions resource, which resolves an address to the
|
|
640
|
-
* project its traces go to: `client.sessions.resolve(address
|
|
640
|
+
* project its traces go to: `client.sessions.resolve(address)`.
|
|
641
641
|
*/
|
|
642
642
|
get sessions(): Sessions;
|
|
643
643
|
/** Access the public shared-run resource. */
|