langwatch 1.20.0 → 2.0.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 (44) hide show
  1. package/README.md +2 -2
  2. package/dist/agent/index.js +19 -2
  3. package/dist/agent/index.js.map +1 -1
  4. package/dist/agent/index.mjs +19 -2
  5. package/dist/agent/index.mjs.map +1 -1
  6. package/dist/{chunk-ET5KYCG2.mjs → chunk-2GKEMCKT.mjs} +1 -1
  7. package/dist/chunk-2GKEMCKT.mjs.map +1 -0
  8. package/dist/{chunk-BDQ2RG7R.mjs → chunk-AYPQNLCC.mjs} +2 -2
  9. package/dist/{chunk-EQ5CFQGJ.js → chunk-DLZCOUXC.js} +12 -12
  10. package/dist/{chunk-EQ5CFQGJ.js.map → chunk-DLZCOUXC.js.map} +1 -1
  11. package/dist/{chunk-5ZNEXSAB.js → chunk-F7BVJW3S.js} +1 -1
  12. package/dist/chunk-F7BVJW3S.js.map +1 -0
  13. package/dist/{chunk-FKYYEGJ7.mjs → chunk-M3DSPR5S.mjs} +6 -2
  14. package/dist/chunk-M3DSPR5S.mjs.map +1 -0
  15. package/dist/{chunk-HCK7TCSK.js → chunk-MAO3SIBB.js} +7 -3
  16. package/dist/chunk-MAO3SIBB.js.map +1 -0
  17. package/dist/cli/bundle.js +523 -505
  18. package/dist/{implementation-B4Z2ksnA.d.mts → implementation-BXVPzwOt.d.mts} +1 -1
  19. package/dist/{implementation-BFUgzz5C.d.ts → implementation-DJ-JveZl.d.ts} +1 -1
  20. package/dist/index.d.mts +84 -10
  21. package/dist/index.d.ts +84 -10
  22. package/dist/index.js +979 -632
  23. package/dist/index.js.map +1 -1
  24. package/dist/index.mjs +907 -560
  25. package/dist/index.mjs.map +1 -1
  26. package/dist/observability-sdk/index.d.mts +3 -3
  27. package/dist/observability-sdk/index.d.ts +3 -3
  28. package/dist/observability-sdk/index.js +4 -4
  29. package/dist/observability-sdk/index.js.map +1 -1
  30. package/dist/observability-sdk/index.mjs +8 -8
  31. package/dist/observability-sdk/instrumentation/langchain/index.d.mts +1 -1
  32. package/dist/observability-sdk/instrumentation/langchain/index.d.ts +1 -1
  33. package/dist/observability-sdk/instrumentation/langchain/index.js +4 -4
  34. package/dist/observability-sdk/instrumentation/langchain/index.mjs +1 -1
  35. package/dist/observability-sdk/setup/node/index.js +3 -3
  36. package/dist/observability-sdk/setup/node/index.mjs +2 -2
  37. package/dist/{types-B696jWYQ.d.mts → types--ExXvd26.d.mts} +911 -338
  38. package/dist/{types-Bo6OvFct.d.ts → types-CpT3iEIj.d.ts} +911 -338
  39. package/package.json +3 -4
  40. package/dist/chunk-5ZNEXSAB.js.map +0 -1
  41. package/dist/chunk-ET5KYCG2.mjs.map +0 -1
  42. package/dist/chunk-FKYYEGJ7.mjs.map +0 -1
  43. package/dist/chunk-HCK7TCSK.js.map +0 -1
  44. /package/dist/{chunk-BDQ2RG7R.mjs.map → chunk-AYPQNLCC.mjs.map} +0 -0
@@ -44,10 +44,12 @@ import { randomUUID } from "crypto";
44
44
  import * as os from "os";
45
45
 
46
46
  // package.json
47
- var version = "1.20.0";
47
+ var version = "2.0.0";
48
48
 
49
49
  // src/internal/constants.ts
50
50
  var LANGWATCH_SDK_VERSION = version;
51
+ var API_VERSION_HEADER = "X-API-Version";
52
+ var LANGWATCH_API_VERSION = "2026-10-26";
51
53
  var DEFAULT_ENDPOINT = "https://app.langwatch.ai";
52
54
 
53
55
  // src/internal/endpoint.ts
@@ -342,6 +344,20 @@ var LangWatchRedirectError = class extends Error {
342
344
  this.status = status;
343
345
  }
344
346
  };
347
+ var isPlainHeaders = (headers) => !(headers instanceof Headers) && !Array.isArray(headers);
348
+ var withApiVersion = ({
349
+ input,
350
+ init
351
+ }) => {
352
+ const sent = init?.headers ?? (typeof Request !== "undefined" && input instanceof Request ? input.headers : void 0);
353
+ if (new Headers(sent).has(API_VERSION_HEADER)) return { ...init };
354
+ if (sent === void 0 || isPlainHeaders(sent)) {
355
+ return { ...init, headers: { ...sent, [API_VERSION_HEADER]: LANGWATCH_API_VERSION } };
356
+ }
357
+ const headers = new Headers(sent);
358
+ headers.set(API_VERSION_HEADER, LANGWATCH_API_VERSION);
359
+ return { ...init, headers };
360
+ };
345
361
  var warnedOrigins = /* @__PURE__ */ new Set();
346
362
  var isRedirect = (response) => response.type === "opaqueredirect" || REDIRECT_STATUSES.has(response.status);
347
363
  var isStream = (body) => typeof ReadableStream !== "undefined" && body instanceof ReadableStream;
@@ -514,7 +530,8 @@ var createLangWatchFetch = ({
514
530
  } = {}) => {
515
531
  const send = fetchImpl ?? ((input, init) => globalThis.fetch(input, init));
516
532
  const log = logger ?? new ConsoleLogger({ level: "warn", prefix: "LangWatch" });
517
- return async (input, init) => {
533
+ return async (input, given) => {
534
+ const init = withApiVersion({ input, init: given });
518
535
  const url = requestUrl(input);
519
536
  const effective = effectiveRequest({ input, init });
520
537
  const method = (effective?.method ?? init?.method ?? "GET").toUpperCase();