langsmith 0.9.0 → 0.10.0

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 (49) hide show
  1. package/dist/_openapi_client/client.cjs +1 -1
  2. package/dist/_openapi_client/client.d.ts +2 -2
  3. package/dist/_openapi_client/client.js +1 -1
  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/annotation-queues.d.ts +1 -0
  7. package/dist/_openapi_client/resources/index.d.ts +1 -1
  8. package/dist/_openapi_client/resources/issues.cjs +1 -1
  9. package/dist/_openapi_client/resources/issues.d.ts +18 -1
  10. package/dist/_openapi_client/resources/issues.js +1 -1
  11. package/dist/_openapi_client/resources/online-evaluators.d.ts +2 -2
  12. package/dist/_openapi_client/resources/sandboxes/boxes.cjs +20 -3
  13. package/dist/_openapi_client/resources/sandboxes/boxes.d.ts +40 -9
  14. package/dist/_openapi_client/resources/sandboxes/boxes.js +20 -3
  15. package/dist/_openapi_client/resources/sandboxes/sandboxes.d.ts +46 -3
  16. package/dist/_openapi_client/resources/sandboxes/snapshots.cjs +6 -2
  17. package/dist/_openapi_client/resources/sandboxes/snapshots.d.ts +16 -6
  18. package/dist/_openapi_client/resources/sandboxes/snapshots.js +6 -2
  19. package/dist/client.cjs +56 -83
  20. package/dist/client.d.ts +16 -14
  21. package/dist/client.js +56 -83
  22. package/dist/env.cjs +14 -1
  23. package/dist/env.d.ts +9 -0
  24. package/dist/env.js +12 -0
  25. package/dist/evaluation/evaluate_comparative.cjs +2 -0
  26. package/dist/evaluation/evaluate_comparative.js +2 -0
  27. package/dist/experimental/vercel/telemetry.cjs +19 -6
  28. package/dist/experimental/vercel/telemetry.js +17 -4
  29. package/dist/index.cjs +1 -1
  30. package/dist/index.d.ts +1 -1
  31. package/dist/index.js +1 -1
  32. package/dist/schemas.d.ts +2 -0
  33. package/dist/singletons/constants.cjs +7 -1
  34. package/dist/singletons/constants.d.ts +3 -0
  35. package/dist/singletons/constants.js +5 -0
  36. package/dist/traceable.cjs +46 -15
  37. package/dist/traceable.js +48 -17
  38. package/dist/utils/_uuid.cjs +11 -19
  39. package/dist/utils/_uuid.d.ts +7 -7
  40. package/dist/utils/_uuid.js +11 -19
  41. package/dist/utils/redaction.cjs +38 -0
  42. package/dist/utils/redaction.d.ts +10 -0
  43. package/dist/utils/redaction.js +33 -0
  44. package/dist/utils/sampling.cjs +34 -0
  45. package/dist/utils/sampling.d.ts +10 -0
  46. package/dist/utils/sampling.js +30 -0
  47. package/dist/wrappers/anthropic.cjs +21 -24
  48. package/dist/wrappers/anthropic.js +21 -24
  49. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  import { wrapManagedAgentSessionEvents } from "./utils/anthropic_managed.js";
2
2
  import { isTraceableFunction, traceable, } from "../traceable.js";
3
3
  import { convertAnthropicUsageToInputTokenDetails } from "../utils/usage.js";
4
- import { SECRET_PLACEHOLDER } from "../anonymizer/index.js";
4
+ import { mask, overParams, redactOutside } from "../utils/redaction.js";
5
5
  const TRACED_INVOCATION_KEYS = ["top_k", "top_p", "stream", "thinking"];
6
6
  /** Keys of an MCP server definition that are safe to trace. */
7
7
  const MCP_SERVER_SAFE_KEYS = new Set([
@@ -10,27 +10,20 @@ const MCP_SERVER_SAFE_KEYS = new Set([
10
10
  "url",
11
11
  "tool_configuration",
12
12
  ]);
13
- /**
14
- * Mask credentials in `mcp_servers` before tracing. Anything outside
15
- * {@link MCP_SERVER_SAFE_KEYS} keeps its name but gets
16
- * {@link SECRET_PLACEHOLDER} as its value, so the trace shows the field was set
17
- * without exposing it, and fields the API adds later are masked by default.
18
- *
19
- * Returns new objects; the caller's are also sent to Anthropic.
20
- */
13
+ /** Mask `mcp_servers` credentials outside {@link MCP_SERVER_SAFE_KEYS}. */
21
14
  function redactMcpServers(servers) {
22
15
  if (!Array.isArray(servers))
23
16
  return servers;
24
- return servers.map((server) => {
25
- if (typeof server !== "object" || server == null || Array.isArray(server)) {
26
- return server;
27
- }
28
- return Object.fromEntries(Object.entries(server).map(([key, value]) => [
29
- key,
30
- MCP_SERVER_SAFE_KEYS.has(key) ? value : SECRET_PLACEHOLDER,
31
- ]));
32
- });
17
+ return servers.map((server) => redactOutside(server, MCP_SERVER_SAFE_KEYS));
33
18
  }
19
+ /** Request-transport keys that are credentials by construction. */
20
+ const TRANSPORT_SECRET_KEYS = new Set([
21
+ "headers",
22
+ "query",
23
+ "extra_headers",
24
+ "extra_body",
25
+ "extra_query",
26
+ ]);
34
27
  /**
35
28
  * Create usage metadata from Anthropic's token usage format.
36
29
  */
@@ -242,17 +235,18 @@ export const wrapAnthropic = (anthropic, options) => {
242
235
  ...options,
243
236
  metadata: restMetadata,
244
237
  };
245
- /**
246
- * Transform system parameter into visible message for playground editability.
247
- * This provides parity with the Python SDK behavior and enables system prompts
248
- * to be viewed and edited in the LangSmith playground.
249
- */
250
- function processTracedInputs(params) {
238
+ /** Mask credentials and surface `system` as a message the playground can edit. */
239
+ function redactAnthropicParams(params) {
251
240
  // Copy first: `params` also goes to the API and must keep its real values.
252
241
  const processed = { ...params };
253
242
  if (processed.mcp_servers != null) {
254
243
  processed.mcp_servers = redactMcpServers(processed.mcp_servers);
255
244
  }
245
+ for (const key of TRANSPORT_SECRET_KEYS) {
246
+ if (processed[key] != null) {
247
+ processed[key] = mask(processed[key]);
248
+ }
249
+ }
256
250
  if (!params.system) {
257
251
  return processed;
258
252
  }
@@ -271,6 +265,9 @@ export const wrapAnthropic = (anthropic, options) => {
271
265
  delete processed.system;
272
266
  return processed;
273
267
  }
268
+ function processTracedInputs(inputs) {
269
+ return overParams(inputs, redactAnthropicParams);
270
+ }
274
271
  // Common configuration for messages.create
275
272
  const messagesCreateConfig = {
276
273
  name: "ChatAnthropic",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "langsmith",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "description": "Client library to connect to the LangSmith Observability and Evaluation Platform.",
5
5
  "packageManager": "pnpm@10.33.0",
6
6
  "files": [