langsmith 0.10.5 → 0.10.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/run_trees.js CHANGED
@@ -4,11 +4,12 @@ import { isConflictingEndpointsError, ConflictingEndpointsError, } from "./utils
4
4
  import { _LC_CONTEXT_VARIABLES_KEY, _REPLICA_TRACE_ROOTS_KEY, } from "./singletons/constants.js";
5
5
  import { getContextVar, setContextVar } from "./utils/context_vars.js";
6
6
  import { getEnvironmentVariable, getRuntimeEnvironment, } from "./utils/env.js";
7
- import { getDefaultProjectName } from "./utils/project.js";
8
7
  import { getLangSmithEnvironmentVariable } from "./utils/env.js";
9
8
  import { warnOnce } from "./utils/warn.js";
10
9
  import { uuid7FromTime, nonCryptographicUuid7Deterministic, } from "./utils/_uuid.js";
11
10
  import { v5 as uuidv5 } from "./utils/uuid/src/index.js";
11
+ import { checkAddress, logUntraced, rejectConflicting, resolveFromEnv, } from "./utils/agent_addressing.js";
12
+ import { EnvAddressError, fromWire, sameAddress, seed as addressSeed, toWire, wireKeys, } from "./address.js";
12
13
  const TIMESTAMP_LENGTH = 36;
13
14
  // DNS namespace for UUID v5 (same as Python's uuid.NAMESPACE_DNS)
14
15
  const UUID_NAMESPACE_DNS = "6ba7b810-9dad-11d1-80b4-00c04fd430c8";
@@ -43,7 +44,31 @@ const HEADER_SAFE_REPLICA_FIELDS = new Set([
43
44
  "primary",
44
45
  "updates",
45
46
  "reroot",
47
+ ...wireKeys(),
46
48
  ]);
49
+ // URL-encoded JSON of the address's wire fields.
50
+ const LANGSMITH_ADDRESS = "langsmith-address";
51
+ /** Pops the address wire keys off untrusted `values`; never throws. */
52
+ function takeHeaderAddress(values) {
53
+ const wire = {};
54
+ for (const key of wireKeys()) {
55
+ if (key in values) {
56
+ wire[key] = values[key];
57
+ delete values[key];
58
+ }
59
+ }
60
+ try {
61
+ return {
62
+ named: Object.keys(wire).length > 0,
63
+ address: fromWire(wire),
64
+ };
65
+ }
66
+ catch {
67
+ // Values are untrusted, so not logged.
68
+ console.warn("Ignoring an invalid address in a `baggage` header.");
69
+ return { named: true };
70
+ }
71
+ }
47
72
  function filterReplicaForHeaders(replica) {
48
73
  const filtered = {};
49
74
  for (const key of Object.keys(replica)) {
@@ -60,7 +85,7 @@ function filterReplicaForHeaders(replica) {
60
85
  * Baggage header information
61
86
  */
62
87
  class Baggage {
63
- constructor(metadata, tags, project_name, replicas) {
88
+ constructor(metadata, tags, project_name, replicas, address) {
64
89
  Object.defineProperty(this, "metadata", {
65
90
  enumerable: true,
66
91
  configurable: true,
@@ -85,10 +110,17 @@ class Baggage {
85
110
  writable: true,
86
111
  value: void 0
87
112
  });
113
+ Object.defineProperty(this, "address", {
114
+ enumerable: true,
115
+ configurable: true,
116
+ writable: true,
117
+ value: void 0
118
+ });
88
119
  this.metadata = metadata;
89
120
  this.tags = tags;
90
121
  this.project_name = project_name;
91
122
  this.replicas = replicas;
123
+ this.address = address;
92
124
  }
93
125
  static fromHeader(value) {
94
126
  const items = value.split(",");
@@ -96,6 +128,7 @@ class Baggage {
96
128
  let tags = [];
97
129
  let project_name;
98
130
  let replicas;
131
+ let address;
99
132
  for (const item of items) {
100
133
  const [key, uriValue] = item.split("=");
101
134
  const value = decodeURIComponent(uriValue);
@@ -108,17 +141,36 @@ class Baggage {
108
141
  else if (key === "langsmith-project") {
109
142
  project_name = value;
110
143
  }
144
+ else if (key === LANGSMITH_ADDRESS) {
145
+ let parsed;
146
+ try {
147
+ parsed = JSON.parse(value);
148
+ }
149
+ catch {
150
+ parsed = undefined;
151
+ }
152
+ if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
153
+ address = takeHeaderAddress({ ...parsed }).address;
154
+ }
155
+ }
111
156
  else if (key === "langsmith-replicas") {
112
157
  const parsed = JSON.parse(value);
113
- replicas = parsed.map((replica) => {
158
+ replicas = parsed.flatMap((replica) => {
114
159
  if (Array.isArray(replica)) {
115
- return replica;
160
+ return [replica];
116
161
  }
117
- return filterReplicaForHeaders(replica);
162
+ const filtered = filterReplicaForHeaders(replica);
163
+ const { named, address } = takeHeaderAddress(filtered);
164
+ // A project wins over an address; a replica with an invalid
165
+ // address and no project is dropped.
166
+ if (filtered.projectName || !named) {
167
+ return [filtered];
168
+ }
169
+ return address ? [{ ...filtered, address }] : [];
118
170
  });
119
171
  }
120
172
  }
121
- return new Baggage(metadata, tags, project_name, replicas);
173
+ return new Baggage(metadata, tags, project_name, replicas, address);
122
174
  }
123
175
  toHeader() {
124
176
  const items = [];
@@ -131,6 +183,9 @@ class Baggage {
131
183
  if (this.project_name) {
132
184
  items.push(`langsmith-project=${encodeURIComponent(this.project_name)}`);
133
185
  }
186
+ if (this.address) {
187
+ items.push(`${LANGSMITH_ADDRESS}=${encodeURIComponent(JSON.stringify(toWire(this.address)))}`);
188
+ }
134
189
  return items.join(",");
135
190
  }
136
191
  }
@@ -158,12 +213,20 @@ export class RunTree {
158
213
  writable: true,
159
214
  value: void 0
160
215
  });
216
+ /** Unset for a run sent to an `address`. */
161
217
  Object.defineProperty(this, "project_name", {
162
218
  enumerable: true,
163
219
  configurable: true,
164
220
  writable: true,
165
221
  value: void 0
166
222
  });
223
+ /** (beta) Set instead of `project_name` for an addressed run. */
224
+ Object.defineProperty(this, "address", {
225
+ enumerable: true,
226
+ configurable: true,
227
+ writable: true,
228
+ value: void 0
229
+ });
167
230
  Object.defineProperty(this, "parent_run", {
168
231
  enumerable: true,
169
232
  configurable: true,
@@ -338,6 +401,7 @@ export class RunTree {
338
401
  delete config.id;
339
402
  }
340
403
  Object.assign(this, { ...defaultConfig, ...config, client });
404
+ this._resolveAddressing(config);
341
405
  this.execution_order ??= 1;
342
406
  this.child_execution_order ??= 1;
343
407
  // Generate serialized start time for ID generation
@@ -368,6 +432,31 @@ export class RunTree {
368
432
  }
369
433
  }
370
434
  }
435
+ /** Falls back to the env; a bad env leaves the run untraced. */
436
+ _resolveAddressing(config) {
437
+ const address = checkAddress(config.address);
438
+ const project = config.project_name || undefined;
439
+ rejectConflicting(project, address);
440
+ if (project || address) {
441
+ this.project_name = project;
442
+ this.address = address;
443
+ return;
444
+ }
445
+ try {
446
+ [this.project_name, this.address] = resolveFromEnv();
447
+ }
448
+ catch (e) {
449
+ if (!(e instanceof EnvAddressError)) {
450
+ throw e;
451
+ }
452
+ if (isEnvTracingEnabled(this.tracingEnabled)) {
453
+ logUntraced(e);
454
+ }
455
+ this.project_name = undefined;
456
+ this.address = undefined;
457
+ this.tracingEnabled = false;
458
+ }
459
+ }
371
460
  set metadata(metadata) {
372
461
  this.extra = {
373
462
  ...this.extra,
@@ -384,7 +473,6 @@ export class RunTree {
384
473
  const start_time = Date.now();
385
474
  return {
386
475
  run_type: "chain",
387
- project_name: getDefaultProjectName(),
388
476
  child_runs: [],
389
477
  api_url: getEnvironmentVariable("LANGCHAIN_ENDPOINT") ?? "http://localhost:1984",
390
478
  api_key: getEnvironmentVariable("LANGCHAIN_API_KEY"),
@@ -414,6 +502,7 @@ export class RunTree {
414
502
  ...config,
415
503
  parent_run: this,
416
504
  project_name: this.project_name,
505
+ address: this.address,
417
506
  replicas: childReplicas,
418
507
  client: this.client,
419
508
  tracingEnabled: this.tracingEnabled,
@@ -512,6 +601,7 @@ export class RunTree {
512
601
  inputs: run.inputs,
513
602
  outputs: run.outputs,
514
603
  session_name: run.project_name,
604
+ address: run.address,
515
605
  child_runs: child_runs,
516
606
  parent_run_id: parent_run_id,
517
607
  trace_id: run.trace_id,
@@ -568,16 +658,33 @@ export class RunTree {
568
658
  child._setReplicaTraceRoot(replicaKey, traceRootId);
569
659
  }
570
660
  }
661
+ /** A replica naming neither inherits the run tree's destination. */
662
+ _replicaAddressing(replica) {
663
+ const address = checkAddress(replica.address);
664
+ if (replica.projectName != null) {
665
+ rejectConflicting(replica.projectName, address);
666
+ return [replica.projectName, undefined];
667
+ }
668
+ if (address) {
669
+ return [undefined, address];
670
+ }
671
+ return [this.project_name, this.address];
672
+ }
571
673
  _remapForProject(params) {
572
- const { projectName, primary, runtimeEnv, excludeChildRuns = true, reroot = false, distributedParentId, apiUrl, apiKey, workspaceId, } = params;
674
+ const { projectName, address, primary, runtimeEnv, excludeChildRuns = true, reroot = false, distributedParentId, apiUrl, apiKey, workspaceId, } = params;
573
675
  const baseRun = this._convertToCreate(this, runtimeEnv, excludeChildRuns);
574
- // Preserve legacy behavior when `primary` is omitted.
575
- if (primary === undefined && projectName === this.project_name) {
676
+ // Preserve legacy behavior when `primary` is omitted, unless another replica is primary.
677
+ if (primary === undefined &&
678
+ !this.replicas?.some((r) => r.primary === true) &&
679
+ projectName === this.project_name &&
680
+ sameAddress(address, this.address)) {
576
681
  return {
577
682
  ...baseRun,
578
683
  session_name: projectName,
684
+ address,
579
685
  };
580
686
  }
687
+ const seed = projectName ?? (address ? addressSeed(address) : undefined) ?? "agent//";
581
688
  // Apply reroot logic before ID remapping
582
689
  if (reroot) {
583
690
  if (distributedParentId) {
@@ -601,7 +708,7 @@ export class RunTree {
601
708
  // Store this run's original ID in context vars so descendants know the new trace root
602
709
  // We store the original ID (before remapping) so it can be found in dotted_order
603
710
  const replicaKey = getReplicaKey({
604
- projectName,
711
+ projectName: seed,
605
712
  apiUrl,
606
713
  apiKey,
607
714
  workspaceId,
@@ -614,7 +721,7 @@ export class RunTree {
614
721
  if (!reroot) {
615
722
  const replicaTraceRoots = getContextVar(this, _REPLICA_TRACE_ROOTS_KEY) ?? {};
616
723
  const replicaKey = getReplicaKey({
617
- projectName,
724
+ projectName: seed,
618
725
  apiUrl,
619
726
  apiKey,
620
727
  workspaceId,
@@ -649,17 +756,18 @@ export class RunTree {
649
756
  return {
650
757
  ...baseRun,
651
758
  session_name: projectName,
759
+ address,
652
760
  };
653
761
  }
654
762
  // Remap IDs for the replica using nonCryptographicUuid7Deterministic
655
763
  // This ensures consistency across runs in the same replica while
656
764
  // preserving UUID7 properties (time-ordering, monotonicity)
657
765
  const oldId = baseRun.id;
658
- const newId = nonCryptographicUuid7Deterministic(oldId, projectName);
766
+ const newId = nonCryptographicUuid7Deterministic(oldId, seed);
659
767
  // Remap trace_id
660
768
  let newTraceId;
661
769
  if (baseRun.trace_id) {
662
- newTraceId = nonCryptographicUuid7Deterministic(baseRun.trace_id, projectName);
770
+ newTraceId = nonCryptographicUuid7Deterministic(baseRun.trace_id, seed);
663
771
  }
664
772
  else {
665
773
  newTraceId = newId;
@@ -667,7 +775,7 @@ export class RunTree {
667
775
  // Remap parent_run_id
668
776
  let newParentId;
669
777
  if (baseRun.parent_run_id) {
670
- newParentId = nonCryptographicUuid7Deterministic(baseRun.parent_run_id, projectName);
778
+ newParentId = nonCryptographicUuid7Deterministic(baseRun.parent_run_id, seed);
671
779
  }
672
780
  // Remap dotted_order segments
673
781
  let newDottedOrder;
@@ -676,7 +784,7 @@ export class RunTree {
676
784
  const remappedSegs = segs.map((seg) => {
677
785
  // Extract the UUID from the segment (last TIMESTAMP_LENGTH characters)
678
786
  const segId = seg.slice(-TIMESTAMP_LENGTH);
679
- const remappedId = nonCryptographicUuid7Deterministic(segId, projectName);
787
+ const remappedId = nonCryptographicUuid7Deterministic(segId, seed);
680
788
  // Replace the UUID part while keeping the timestamp prefix
681
789
  return seg.slice(0, -TIMESTAMP_LENGTH) + remappedId;
682
790
  });
@@ -689,6 +797,7 @@ export class RunTree {
689
797
  parent_run_id: newParentId,
690
798
  dotted_order: newDottedOrder,
691
799
  session_name: projectName,
800
+ address,
692
801
  };
693
802
  }
694
803
  async postRun(excludeChildRuns = true) {
@@ -699,9 +808,12 @@ export class RunTree {
699
808
  try {
700
809
  const runtimeEnv = getRuntimeEnvironment();
701
810
  if (this.replicas && this.replicas.length > 0) {
702
- for (const { projectName, primary, apiKey, apiUrl, workspaceId, reroot, client: replicaClient, } of this.replicas) {
811
+ for (const replica of this.replicas) {
812
+ const { primary, apiKey, apiUrl, workspaceId, reroot, client: replicaClient, } = replica;
813
+ const [projectName, address] = this._replicaAddressing(replica);
703
814
  const runCreate = this._remapForProject({
704
- projectName: projectName ?? this.project_name,
815
+ projectName,
816
+ address,
705
817
  primary,
706
818
  runtimeEnv,
707
819
  excludeChildRuns: true,
@@ -750,9 +862,12 @@ export class RunTree {
750
862
  async patchRun(options) {
751
863
  const excludeInputs = options?.excludeInputs ?? getExcludeInputsOnPatch();
752
864
  if (this.replicas && this.replicas.length > 0) {
753
- for (const { projectName, primary, apiKey, apiUrl, workspaceId, updates, reroot, client: replicaClient, } of this.replicas) {
865
+ for (const replica of this.replicas) {
866
+ const { primary, apiKey, apiUrl, workspaceId, updates, reroot, client: replicaClient, } = replica;
867
+ const [projectName, address] = this._replicaAddressing(replica);
754
868
  const runData = this._remapForProject({
755
- projectName: projectName ?? this.project_name,
869
+ projectName,
870
+ address,
756
871
  primary,
757
872
  runtimeEnv: undefined,
758
873
  excludeChildRuns: true,
@@ -771,6 +886,7 @@ export class RunTree {
771
886
  error: runData.error,
772
887
  parent_run_id: runData.parent_run_id,
773
888
  session_name: runData.session_name,
889
+ address: runData.address,
774
890
  reference_example_id: runData.reference_example_id,
775
891
  end_time: runData.end_time,
776
892
  dotted_order: runData.dotted_order,
@@ -813,6 +929,7 @@ export class RunTree {
813
929
  tags: this.tags,
814
930
  attachments: this.attachments,
815
931
  session_name: this.project_name,
932
+ address: this.address,
816
933
  };
817
934
  // Important that inputs is not a key in the run update
818
935
  // if excluded because it will overwrite the run create if the
@@ -873,7 +990,7 @@ export class RunTree {
873
990
  ...props,
874
991
  client,
875
992
  tracingEnabled,
876
- project_name: projectName,
993
+ project_name: props.address ? undefined : projectName,
877
994
  });
878
995
  }
879
996
  const parentRunTree = new RunTree({
@@ -928,7 +1045,19 @@ export class RunTree {
928
1045
  const baggage = Baggage.fromHeader(rawHeaders["baggage"]);
929
1046
  config.metadata = baggage.metadata;
930
1047
  config.tags = baggage.tags;
931
- config.project_name = baggage.project_name;
1048
+ if (baggage.project_name && baggage.address) {
1049
+ console.warn("Ignoring a `baggage` header that names both a project and an address.");
1050
+ return undefined;
1051
+ }
1052
+ // The header's destination outranks the caller's.
1053
+ if (baggage.project_name) {
1054
+ config.project_name = baggage.project_name;
1055
+ delete config.address;
1056
+ }
1057
+ else if (baggage.address) {
1058
+ config.address = baggage.address;
1059
+ delete config.project_name;
1060
+ }
932
1061
  config.replicas = baggage.replicas;
933
1062
  }
934
1063
  const runTree = new RunTree(config);
@@ -939,7 +1068,7 @@ export class RunTree {
939
1068
  toHeaders(headers) {
940
1069
  const result = {
941
1070
  "langsmith-trace": this.dotted_order,
942
- baggage: new Baggage(this.extra?.metadata, this.tags, this.project_name, this.replicas).toHeader(),
1071
+ baggage: new Baggage(this.extra?.metadata, this.tags, this.project_name, this.replicas, this.address).toHeader(),
943
1072
  };
944
1073
  if (headers) {
945
1074
  for (const [key, value] of Object.entries(result)) {
@@ -1075,7 +1204,8 @@ function _ensureWriteReplicas(replicas) {
1075
1204
  updates: replica[1],
1076
1205
  };
1077
1206
  }
1078
- return replica;
1207
+ const address = checkAddress(replica.address);
1208
+ return address ? { ...replica, address } : replica;
1079
1209
  })
1080
1210
  : _getWriteReplicasFromEnv();
1081
1211
  if (ensured.filter((replica) => replica.primary === true).length > 1) {
@@ -7,7 +7,7 @@
7
7
  * properties for specific handling when needed.
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.LangSmithSandboxServerReloadError = exports.LangSmithSandboxConnectTimeoutError = exports.LangSmithStreamEndedBeforeStartedError = exports.LangSmithCommandTimeoutError = exports.LangSmithSandboxOperationError = exports.LangSmithSandboxNotReadyError = exports.LangSmithDataplaneNotConfiguredError = exports.LangSmithSandboxCreationError = exports.LangSmithResourceCreationError = exports.LangSmithQuotaExceededError = exports.LangSmithValidationError = exports.LangSmithResourceNameConflictError = exports.LangSmithResourceAlreadyExistsError = exports.LangSmithResourceInUseError = exports.LangSmithResourceTimeoutError = exports.LangSmithResourceNotFoundError = exports.LangSmithSandboxRetryableConnectionError = exports.LangSmithSandboxConnectionError = exports.LangSmithSandboxAuthenticationError = exports.LangSmithSandboxAPIError = exports.LangSmithSandboxError = void 0;
10
+ exports.LangSmithSandboxTokenVerificationError = exports.LangSmithSandboxServerReloadError = exports.LangSmithSandboxConnectTimeoutError = exports.LangSmithStreamEndedBeforeStartedError = exports.LangSmithCommandTimeoutError = exports.LangSmithSandboxOperationError = exports.LangSmithSandboxNotReadyError = exports.LangSmithDataplaneNotConfiguredError = exports.LangSmithSandboxCreationError = exports.LangSmithResourceCreationError = exports.LangSmithQuotaExceededError = exports.LangSmithValidationError = exports.LangSmithResourceNameConflictError = exports.LangSmithResourceAlreadyExistsError = exports.LangSmithResourceInUseError = exports.LangSmithResourceTimeoutError = exports.LangSmithResourceNotFoundError = exports.LangSmithSandboxRetryableConnectionError = exports.LangSmithSandboxConnectionError = exports.LangSmithSandboxAuthenticationError = exports.LangSmithSandboxAPIError = exports.LangSmithSandboxError = void 0;
11
11
  /**
12
12
  * Base exception for sandbox client errors.
13
13
  */
@@ -417,3 +417,14 @@ class LangSmithSandboxServerReloadError extends LangSmithSandboxConnectionError
417
417
  }
418
418
  }
419
419
  exports.LangSmithSandboxServerReloadError = LangSmithSandboxServerReloadError;
420
+ /**
421
+ * Raised when a sandbox user token or proxy callback signature fails
422
+ * verification.
423
+ */
424
+ class LangSmithSandboxTokenVerificationError extends LangSmithSandboxError {
425
+ constructor(message) {
426
+ super(message);
427
+ this.name = "LangSmithSandboxTokenVerificationError";
428
+ }
429
+ }
430
+ exports.LangSmithSandboxTokenVerificationError = LangSmithSandboxTokenVerificationError;
@@ -192,3 +192,10 @@ export declare class LangSmithSandboxConnectTimeoutError extends LangSmithSandbo
192
192
  export declare class LangSmithSandboxServerReloadError extends LangSmithSandboxConnectionError {
193
193
  constructor(message: string);
194
194
  }
195
+ /**
196
+ * Raised when a sandbox user token or proxy callback signature fails
197
+ * verification.
198
+ */
199
+ export declare class LangSmithSandboxTokenVerificationError extends LangSmithSandboxError {
200
+ constructor(message: string);
201
+ }
@@ -393,3 +393,13 @@ export class LangSmithSandboxServerReloadError extends LangSmithSandboxConnectio
393
393
  this.name = "LangSmithSandboxServerReloadError";
394
394
  }
395
395
  }
396
+ /**
397
+ * Raised when a sandbox user token or proxy callback signature fails
398
+ * verification.
399
+ */
400
+ export class LangSmithSandboxTokenVerificationError extends LangSmithSandboxError {
401
+ constructor(message) {
402
+ super(message);
403
+ this.name = "LangSmithSandboxTokenVerificationError";
404
+ }
405
+ }
@@ -29,7 +29,7 @@
29
29
  * @packageDocumentation
30
30
  */
31
31
  Object.defineProperty(exports, "__esModule", { value: true });
32
- exports.LangSmithDataplaneNotConfiguredError = exports.LangSmithCommandTimeoutError = exports.LangSmithSandboxOperationError = exports.LangSmithSandboxNotReadyError = exports.LangSmithSandboxCreationError = exports.LangSmithResourceCreationError = exports.LangSmithQuotaExceededError = exports.LangSmithValidationError = exports.LangSmithResourceNameConflictError = exports.LangSmithResourceAlreadyExistsError = exports.LangSmithResourceInUseError = exports.LangSmithResourceTimeoutError = exports.LangSmithResourceNotFoundError = exports.LangSmithSandboxServerReloadError = exports.LangSmithSandboxConnectTimeoutError = exports.LangSmithSandboxRetryableConnectionError = exports.LangSmithSandboxConnectionError = exports.LangSmithSandboxAuthenticationError = exports.LangSmithSandboxAPIError = exports.LangSmithSandboxError = exports.s3Mount = exports.mountConfig = exports.gitMount = exports.gcsMount = exports.contextHubMount = exports.SERVICE_TOKEN_HEADER = exports.ServiceLoginUrl = exports.ServiceUrl = exports.validateAccessDelegation = exports.workspaceSecret = exports.proxyConfig = exports.opaqueSecret = exports.gcpAuth = exports.awsAuth = exports.CommandHandle = exports.Sandbox = exports.SandboxClient = void 0;
32
+ exports.LangSmithSandboxTokenVerificationError = exports.LangSmithDataplaneNotConfiguredError = exports.LangSmithCommandTimeoutError = exports.LangSmithSandboxOperationError = exports.LangSmithSandboxNotReadyError = exports.LangSmithSandboxCreationError = exports.LangSmithResourceCreationError = exports.LangSmithQuotaExceededError = exports.LangSmithValidationError = exports.LangSmithResourceNameConflictError = exports.LangSmithResourceAlreadyExistsError = exports.LangSmithResourceInUseError = exports.LangSmithResourceTimeoutError = exports.LangSmithResourceNotFoundError = exports.LangSmithSandboxServerReloadError = exports.LangSmithSandboxConnectTimeoutError = exports.LangSmithSandboxRetryableConnectionError = exports.LangSmithSandboxConnectionError = exports.LangSmithSandboxAuthenticationError = exports.LangSmithSandboxAPIError = exports.LangSmithSandboxError = exports.s3Mount = exports.mountConfig = exports.gitMount = exports.gcsMount = exports.contextHubMount = exports.CALLBACK_SIGNATURE_HEADER = exports.USER_TOKEN_HEADER = exports.SandboxTokenVerifier = exports.SERVICE_TOKEN_HEADER = exports.ServiceLoginUrl = exports.ServiceUrl = exports.validateAccessDelegation = exports.workspaceSecret = exports.proxyConfig = exports.opaqueSecret = exports.gcpAuth = exports.awsAuth = exports.CommandHandle = exports.Sandbox = exports.SandboxClient = void 0;
33
33
  // Main classes
34
34
  var client_js_1 = require("./client.cjs");
35
35
  Object.defineProperty(exports, "SandboxClient", { enumerable: true, get: function () { return client_js_1.SandboxClient; } });
@@ -49,6 +49,10 @@ var service_url_js_1 = require("./service_url.cjs");
49
49
  Object.defineProperty(exports, "ServiceUrl", { enumerable: true, get: function () { return service_url_js_1.ServiceUrl; } });
50
50
  Object.defineProperty(exports, "ServiceLoginUrl", { enumerable: true, get: function () { return service_url_js_1.ServiceLoginUrl; } });
51
51
  Object.defineProperty(exports, "SERVICE_TOKEN_HEADER", { enumerable: true, get: function () { return service_url_js_1.SERVICE_TOKEN_HEADER; } });
52
+ var verify_js_1 = require("./verify.cjs");
53
+ Object.defineProperty(exports, "SandboxTokenVerifier", { enumerable: true, get: function () { return verify_js_1.SandboxTokenVerifier; } });
54
+ Object.defineProperty(exports, "USER_TOKEN_HEADER", { enumerable: true, get: function () { return verify_js_1.USER_TOKEN_HEADER; } });
55
+ Object.defineProperty(exports, "CALLBACK_SIGNATURE_HEADER", { enumerable: true, get: function () { return verify_js_1.CALLBACK_SIGNATURE_HEADER; } });
52
56
  var mounts_js_1 = require("./mounts.cjs");
53
57
  Object.defineProperty(exports, "contextHubMount", { enumerable: true, get: function () { return mounts_js_1.contextHubMount; } });
54
58
  Object.defineProperty(exports, "gcsMount", { enumerable: true, get: function () { return mounts_js_1.gcsMount; } });
@@ -82,3 +86,4 @@ Object.defineProperty(exports, "LangSmithSandboxNotReadyError", { enumerable: tr
82
86
  Object.defineProperty(exports, "LangSmithSandboxOperationError", { enumerable: true, get: function () { return errors_js_1.LangSmithSandboxOperationError; } });
83
87
  Object.defineProperty(exports, "LangSmithCommandTimeoutError", { enumerable: true, get: function () { return errors_js_1.LangSmithCommandTimeoutError; } });
84
88
  Object.defineProperty(exports, "LangSmithDataplaneNotConfiguredError", { enumerable: true, get: function () { return errors_js_1.LangSmithDataplaneNotConfiguredError; } });
89
+ Object.defineProperty(exports, "LangSmithSandboxTokenVerificationError", { enumerable: true, get: function () { return errors_js_1.LangSmithSandboxTokenVerificationError; } });
@@ -33,8 +33,10 @@ export { CommandHandle } from "./command_handle.js";
33
33
  export { awsAuth, gcpAuth, opaqueSecret, proxyConfig, workspaceSecret, } from "./proxy_config.js";
34
34
  export { validateAccessDelegation } from "./access_delegation.js";
35
35
  export { ServiceUrl, ServiceLoginUrl, SERVICE_TOKEN_HEADER, } from "./service_url.js";
36
+ export { SandboxTokenVerifier, USER_TOKEN_HEADER, CALLBACK_SIGNATURE_HEADER, } from "./verify.js";
37
+ export type { AudienceMatcher, SandboxCallback, SandboxCallbackIdentity, SandboxCallbackRequest, SandboxTokenVerifierConfig, SandboxUser, VerifyCallbackOptions, VerifyUserTokenOptions, } from "./verify.js";
36
38
  export { contextHubMount, gcsMount, gitMount, mountConfig, s3Mount, } from "./mounts.js";
37
39
  export type { AccessDelegation, AccessDelegationMode, } from "./access_delegation.js";
38
40
  export type { ServiceAccess, ServiceUrlData } from "./service_url.js";
39
41
  export type { ExecutionResult, FileChunk, FileInfo, FileStat, GlobOptions, GlobResult, GrepMatch, GrepOptions, GrepResult, ReadRangeOptions, RunConfig, OutputChunk, WsMessage, WsRunOptions, ResourceStatus, Snapshot, SandboxData, SandboxClientConfig, RunOptions, CreateSandboxOptions, SandboxAccessControl, SandboxAwsAuthRule, SandboxAwsMountAuthConfig, SandboxGcpAuthRule, SandboxGcpMountAuthConfig, SandboxMountAuth, SandboxMountAuthConfig, SandboxMountConfig, SandboxProxyConfig, SandboxProxyRule, SandboxProxySecret, SandboxMount, MountCacheConfig, ContextHubMountConfig, ContextHubMountSpec, GCSMountConfig, GCSMountSpec, GitMountConfig, GitMountRefSpec, GitMountSpec, S3MountConfig, S3MountSpec, CreateSnapshotOptions, CreateDockerfileSnapshotOptions, CaptureSnapshotOptions, DownloadContentDisposition, DownloadURL, GenerateDownloadURLOptions, ListSnapshotsOptions, WaitForSnapshotOptions, StartSandboxOptions, UpdateSandboxOptions, WaitForSandboxOptions, } from "./types.js";
40
- export { LangSmithSandboxError, LangSmithSandboxAPIError, LangSmithSandboxAuthenticationError, LangSmithSandboxConnectionError, LangSmithSandboxRetryableConnectionError, LangSmithSandboxConnectTimeoutError, LangSmithSandboxServerReloadError, LangSmithResourceNotFoundError, LangSmithResourceTimeoutError, LangSmithResourceInUseError, LangSmithResourceAlreadyExistsError, LangSmithResourceNameConflictError, LangSmithValidationError, LangSmithQuotaExceededError, LangSmithResourceCreationError, LangSmithSandboxCreationError, LangSmithSandboxNotReadyError, LangSmithSandboxOperationError, LangSmithCommandTimeoutError, LangSmithDataplaneNotConfiguredError, } from "./errors.js";
42
+ export { LangSmithSandboxError, LangSmithSandboxAPIError, LangSmithSandboxAuthenticationError, LangSmithSandboxConnectionError, LangSmithSandboxRetryableConnectionError, LangSmithSandboxConnectTimeoutError, LangSmithSandboxServerReloadError, LangSmithResourceNotFoundError, LangSmithResourceTimeoutError, LangSmithResourceInUseError, LangSmithResourceAlreadyExistsError, LangSmithResourceNameConflictError, LangSmithValidationError, LangSmithQuotaExceededError, LangSmithResourceCreationError, LangSmithSandboxCreationError, LangSmithSandboxNotReadyError, LangSmithSandboxOperationError, LangSmithCommandTimeoutError, LangSmithDataplaneNotConfiguredError, LangSmithSandboxTokenVerificationError, } from "./errors.js";
@@ -34,6 +34,7 @@ export { CommandHandle } from "./command_handle.js";
34
34
  export { awsAuth, gcpAuth, opaqueSecret, proxyConfig, workspaceSecret, } from "./proxy_config.js";
35
35
  export { validateAccessDelegation } from "./access_delegation.js";
36
36
  export { ServiceUrl, ServiceLoginUrl, SERVICE_TOKEN_HEADER, } from "./service_url.js";
37
+ export { SandboxTokenVerifier, USER_TOKEN_HEADER, CALLBACK_SIGNATURE_HEADER, } from "./verify.js";
37
38
  export { contextHubMount, gcsMount, gitMount, mountConfig, s3Mount, } from "./mounts.js";
38
39
  // Errors
39
40
  export {
@@ -46,4 +47,4 @@ LangSmithValidationError, LangSmithQuotaExceededError,
46
47
  // Resource creation errors
47
48
  LangSmithResourceCreationError,
48
49
  // Sandbox-specific errors
49
- LangSmithSandboxCreationError, LangSmithSandboxNotReadyError, LangSmithSandboxOperationError, LangSmithCommandTimeoutError, LangSmithDataplaneNotConfiguredError, } from "./errors.js";
50
+ LangSmithSandboxCreationError, LangSmithSandboxNotReadyError, LangSmithSandboxOperationError, LangSmithCommandTimeoutError, LangSmithDataplaneNotConfiguredError, LangSmithSandboxTokenVerificationError, } from "./errors.js";