langsmith 0.10.7 → 0.10.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.
Files changed (101) hide show
  1. package/dist/_openapi_client/client.cjs +26 -2
  2. package/dist/_openapi_client/client.d.ts +15 -6
  3. package/dist/_openapi_client/client.js +27 -3
  4. package/dist/_openapi_client/internal/detect-platform.cjs +1 -1
  5. package/dist/_openapi_client/internal/detect-platform.js +1 -1
  6. package/dist/_openapi_client/resources/annotation-queues/items.cjs +13 -6
  7. package/dist/_openapi_client/resources/annotation-queues/items.d.ts +33 -8
  8. package/dist/_openapi_client/resources/annotation-queues/items.js +13 -6
  9. package/dist/_openapi_client/resources/datasets/datasets.cjs +9 -0
  10. package/dist/_openapi_client/resources/datasets/datasets.d.ts +4 -0
  11. package/dist/_openapi_client/resources/datasets/datasets.js +9 -0
  12. package/dist/_openapi_client/resources/datasets/examples.cjs +26 -0
  13. package/dist/_openapi_client/resources/datasets/examples.d.ts +23 -0
  14. package/dist/_openapi_client/resources/datasets/examples.js +22 -0
  15. package/dist/_openapi_client/resources/fleet/fleet.cjs +54 -0
  16. package/dist/_openapi_client/resources/fleet/fleet.d.ts +9 -0
  17. package/dist/_openapi_client/resources/fleet/fleet.js +17 -0
  18. package/dist/_openapi_client/resources/fleet/threads.cjs +18 -0
  19. package/dist/_openapi_client/resources/fleet/threads.d.ts +19 -0
  20. package/dist/_openapi_client/resources/fleet/threads.js +14 -0
  21. package/dist/_openapi_client/resources/index.cjs +8 -2
  22. package/dist/_openapi_client/resources/index.d.ts +6 -3
  23. package/dist/_openapi_client/resources/index.js +5 -2
  24. package/dist/_openapi_client/resources/info.d.ts +6 -0
  25. package/dist/_openapi_client/resources/issues.cjs +2 -2
  26. package/dist/_openapi_client/resources/issues.d.ts +188 -4
  27. package/dist/_openapi_client/resources/issues.js +2 -2
  28. package/dist/_openapi_client/resources/online-evaluators.cjs +7 -4
  29. package/dist/_openapi_client/resources/online-evaluators.d.ts +63 -4
  30. package/dist/_openapi_client/resources/online-evaluators.js +7 -4
  31. package/dist/_openapi_client/resources/product-feedback.cjs +33 -0
  32. package/dist/_openapi_client/resources/product-feedback.d.ts +77 -0
  33. package/dist/_openapi_client/resources/product-feedback.js +29 -0
  34. package/dist/_openapi_client/resources/runs/runs.d.ts +26 -16
  35. package/dist/_openapi_client/resources/sandboxes/boxes.cjs +44 -4
  36. package/dist/_openapi_client/resources/sandboxes/boxes.d.ts +256 -21
  37. package/dist/_openapi_client/resources/sandboxes/boxes.js +44 -4
  38. package/dist/_openapi_client/resources/sandboxes/registries.d.ts +10 -2
  39. package/dist/_openapi_client/resources/sandboxes/sandboxes.cjs +13 -0
  40. package/dist/_openapi_client/resources/sandboxes/sandboxes.d.ts +169 -14
  41. package/dist/_openapi_client/resources/sandboxes/sandboxes.js +13 -0
  42. package/dist/_openapi_client/resources/sandboxes/snapshots.cjs +10 -6
  43. package/dist/_openapi_client/resources/sandboxes/snapshots.d.ts +37 -6
  44. package/dist/_openapi_client/resources/sandboxes/snapshots.js +10 -6
  45. package/dist/_openapi_client/resources/sessions.cjs +23 -0
  46. package/dist/_openapi_client/resources/sessions.d.ts +732 -0
  47. package/dist/_openapi_client/resources/sessions.js +19 -0
  48. package/dist/_openapi_client/resources/threads/index.cjs +9 -0
  49. package/dist/_openapi_client/resources/threads/index.d.ts +2 -0
  50. package/dist/_openapi_client/resources/threads/index.js +4 -0
  51. package/dist/_openapi_client/resources/threads/share.cjs +61 -0
  52. package/dist/_openapi_client/resources/threads/share.d.ts +71 -0
  53. package/dist/_openapi_client/resources/threads/share.js +57 -0
  54. package/dist/_openapi_client/resources/threads/threads.cjs +143 -0
  55. package/dist/_openapi_client/resources/threads/threads.d.ts +973 -0
  56. package/dist/_openapi_client/resources/threads/threads.js +106 -0
  57. package/dist/_openapi_client/resources/threads.cjs +15 -67
  58. package/dist/_openapi_client/resources/threads.d.ts +1 -709
  59. package/dist/_openapi_client/resources/threads.js +1 -65
  60. package/dist/_openapi_client/resources/traces.d.ts +7 -1
  61. package/dist/_openapi_client/version.cjs +1 -1
  62. package/dist/_openapi_client/version.js +1 -1
  63. package/dist/address.cjs +176 -99
  64. package/dist/address.d.ts +63 -8
  65. package/dist/address.js +170 -90
  66. package/dist/anonymizer/index.cjs +1 -1
  67. package/dist/anonymizer/index.js +1 -1
  68. package/dist/client.cjs +39 -19
  69. package/dist/client.d.ts +20 -4
  70. package/dist/client.js +34 -14
  71. package/dist/experimental/otel/exporter.cjs +21 -4
  72. package/dist/experimental/otel/exporter.d.ts +4 -2
  73. package/dist/experimental/otel/exporter.js +21 -4
  74. package/dist/index.cjs +5 -2
  75. package/dist/index.d.ts +2 -2
  76. package/dist/index.js +2 -2
  77. package/dist/run_trees.cjs +26 -43
  78. package/dist/run_trees.d.ts +4 -4
  79. package/dist/run_trees.js +23 -40
  80. package/dist/sandbox/client.cjs +33 -4
  81. package/dist/sandbox/client.d.ts +4 -0
  82. package/dist/sandbox/client.js +34 -5
  83. package/dist/sandbox/command_handle.cjs +8 -0
  84. package/dist/sandbox/command_handle.js +8 -0
  85. package/dist/sandbox/sandbox.cjs +7 -0
  86. package/dist/sandbox/sandbox.js +7 -0
  87. package/dist/sandbox/service_url.cjs +9 -1
  88. package/dist/sandbox/service_url.d.ts +2 -1
  89. package/dist/sandbox/service_url.js +9 -1
  90. package/dist/sandbox/tracing.cjs +13 -0
  91. package/dist/sandbox/tracing.d.ts +1 -0
  92. package/dist/sandbox/tracing.js +10 -0
  93. package/dist/schemas.d.ts +3 -3
  94. package/dist/traceable.cjs +5 -4
  95. package/dist/traceable.js +4 -3
  96. package/dist/utils/{agent_addressing.cjs → addressing.cjs} +22 -23
  97. package/dist/utils/{agent_addressing.d.ts → addressing.d.ts} +5 -8
  98. package/dist/utils/{agent_addressing.js → addressing.js} +23 -23
  99. package/dist/utils/env.cjs +6 -4
  100. package/dist/utils/env.js +6 -4
  101. package/package.json +1 -1
@@ -1,19 +1,10 @@
1
- import { EnvAddressError, addressFromEnv, envNames, normalizeAddress, toPayload, } from "../address.js";
1
+ import { AgentAddress, EnvAddressError, ensureAgent, envNames, } from "../address.js";
2
2
  import { getEnvironmentVariable, getLangSmithEnvironmentVariable, } from "./env.js";
3
3
  import { warnOnce } from "./warn.js";
4
- function isRendered(value) {
5
- return (value != null &&
6
- typeof value === "object" &&
7
- "kind" in value);
8
- }
9
- /** Validate an address at an entry point; the SDK carries the frozen copy. */
10
- export function checkAddress(address) {
11
- return address == null ? undefined : normalizeAddress(address);
12
- }
13
4
  export function rejectConflicting(project, address) {
14
5
  if (project && address) {
15
6
  throw new Error(`A run is sent to a project (${JSON.stringify(project)}) or to an ` +
16
- `address (${JSON.stringify(address)}), not both.`);
7
+ "address, not both.");
17
8
  }
18
9
  }
19
10
  /** The highest level naming a project or an address, whichever it names. */
@@ -37,7 +28,7 @@ function getEnvProject() {
37
28
  */
38
29
  export function resolveFromEnv() {
39
30
  const project = getEnvProject();
40
- const address = addressFromEnv();
31
+ const address = AgentAddress.fromEnv();
41
32
  if (project && address) {
42
33
  throw new EnvAddressError("LANGSMITH_AGENT_* and a project are both set in the environment.");
43
34
  }
@@ -60,30 +51,39 @@ export function warnOnEnv() {
60
51
  }
61
52
  }
62
53
  /**
63
- * Render `address` into its wire fields, in place. Without one, a create
64
- * naming no project takes the env address. Already-rendered payloads (runs
65
- * re-prepared when batched) are left alone.
54
+ * Put the run's address in its payload field, in its wire form.
55
+ * Without one, a create naming no project takes the env address.
66
56
  *
67
57
  * @throws {EnvAddressError} If the env names half an address.
68
58
  */
69
59
  export function applyToPayload(run, { update = false } = {}) {
70
60
  const payload = run;
71
- // Already rendered into its wire object by an earlier call.
72
- const rendered = isRendered(payload.address);
73
- let address = rendered ? undefined : checkAddress(payload.address);
74
- if (!rendered) {
75
- delete payload.address;
61
+ let address;
62
+ if (typeof payload.address === "string") {
63
+ // Wire data already applied: a queued run is applied again when its batch
64
+ // is sent. It is parsed again, so a malformed one cannot fail the whole
65
+ // batch in the backend.
66
+ try {
67
+ address = AgentAddress._fromLrn(payload.address);
68
+ }
69
+ catch {
70
+ throw new Error("The run's `address` is not a valid agent address.");
71
+ }
72
+ }
73
+ else {
74
+ address = ensureAgent(payload.address);
76
75
  }
76
+ delete payload.address;
77
77
  const namedProject = payload.session_id != null || payload.session_name != null;
78
- if (!address && !update && !namedProject && !rendered) {
79
- address = addressFromEnv();
78
+ if (!address && !update && !namedProject) {
79
+ address = AgentAddress.fromEnv();
80
80
  }
81
81
  if (!address) {
82
82
  return;
83
83
  }
84
84
  warnOnce("Sending runs to an `address` is in beta and enabled per workspace; a " +
85
85
  "workspace without it rejects the runs.");
86
- Object.assign(payload, toPayload(address));
86
+ payload.address = address._toLrn();
87
87
  if (!namedProject) {
88
88
  delete payload.session_name;
89
89
  delete payload.session_id;
@@ -120,14 +120,16 @@ function getLangSmithEnvVarsMetadata() {
120
120
  if (typeof value === "string" &&
121
121
  !excluded.includes(key) &&
122
122
  !isSensitiveEnvVarName(key)) {
123
- if (key === "LANGCHAIN_REVISION_ID") {
124
- envVars["revision_id"] = value;
125
- }
126
- else {
123
+ // LANGCHAIN_REVISION_ID is the legacy name for LANGSMITH_REVISION_ID.
124
+ if (key !== "LANGSMITH_REVISION_ID" && key !== "LANGCHAIN_REVISION_ID") {
127
125
  envVars[key] = value;
128
126
  }
129
127
  }
130
128
  }
129
+ const revisionId = allEnvVars.LANGSMITH_REVISION_ID || allEnvVars.LANGCHAIN_REVISION_ID;
130
+ if (revisionId) {
131
+ envVars["revision_id"] = revisionId;
132
+ }
131
133
  return envVars;
132
134
  }
133
135
  /**
package/dist/utils/env.js CHANGED
@@ -102,14 +102,16 @@ export function getLangSmithEnvVarsMetadata() {
102
102
  if (typeof value === "string" &&
103
103
  !excluded.includes(key) &&
104
104
  !isSensitiveEnvVarName(key)) {
105
- if (key === "LANGCHAIN_REVISION_ID") {
106
- envVars["revision_id"] = value;
107
- }
108
- else {
105
+ // LANGCHAIN_REVISION_ID is the legacy name for LANGSMITH_REVISION_ID.
106
+ if (key !== "LANGSMITH_REVISION_ID" && key !== "LANGCHAIN_REVISION_ID") {
109
107
  envVars[key] = value;
110
108
  }
111
109
  }
112
110
  }
111
+ const revisionId = allEnvVars.LANGSMITH_REVISION_ID || allEnvVars.LANGCHAIN_REVISION_ID;
112
+ if (revisionId) {
113
+ envVars["revision_id"] = revisionId;
114
+ }
113
115
  return envVars;
114
116
  }
115
117
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "langsmith",
3
- "version": "0.10.7",
3
+ "version": "0.10.9",
4
4
  "description": "Client library to connect to the LangSmith Observability and Evaluation Platform.",
5
5
  "packageManager": "pnpm@10.33.0",
6
6
  "files": [