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
package/README.md CHANGED
@@ -126,8 +126,8 @@ span.end();
126
126
  ```ts
127
127
  span.setRAGContexts([{ document_id: "doc1", chunk_id: "c1", content: "..." }]);
128
128
  span.setMetrics({ promptTokens: 10, completionTokens: 20, cost: 0.002 });
129
- span.setRequestModel("gpt-4");
130
- span.setResponseModel("gpt-4");
129
+ span.setRequestModel("gpt-6-luna");
130
+ span.setResponseModel("gpt-6-luna");
131
131
  ```
132
132
 
133
133
  ### 2. Prompt Management
@@ -89,10 +89,12 @@ var import_node_crypto = require("crypto");
89
89
  var os = __toESM(require("os"));
90
90
 
91
91
  // package.json
92
- var version = "1.20.0";
92
+ var version = "2.0.0";
93
93
 
94
94
  // src/internal/constants.ts
95
95
  var LANGWATCH_SDK_VERSION = version;
96
+ var API_VERSION_HEADER = "X-API-Version";
97
+ var LANGWATCH_API_VERSION = "2026-10-26";
96
98
  var DEFAULT_ENDPOINT = "https://app.langwatch.ai";
97
99
 
98
100
  // src/internal/endpoint.ts
@@ -387,6 +389,20 @@ var LangWatchRedirectError = class extends Error {
387
389
  this.status = status;
388
390
  }
389
391
  };
392
+ var isPlainHeaders = (headers) => !(headers instanceof Headers) && !Array.isArray(headers);
393
+ var withApiVersion = ({
394
+ input,
395
+ init
396
+ }) => {
397
+ const sent = init?.headers ?? (typeof Request !== "undefined" && input instanceof Request ? input.headers : void 0);
398
+ if (new Headers(sent).has(API_VERSION_HEADER)) return { ...init };
399
+ if (sent === void 0 || isPlainHeaders(sent)) {
400
+ return { ...init, headers: { ...sent, [API_VERSION_HEADER]: LANGWATCH_API_VERSION } };
401
+ }
402
+ const headers = new Headers(sent);
403
+ headers.set(API_VERSION_HEADER, LANGWATCH_API_VERSION);
404
+ return { ...init, headers };
405
+ };
390
406
  var warnedOrigins = /* @__PURE__ */ new Set();
391
407
  var isRedirect = (response) => response.type === "opaqueredirect" || REDIRECT_STATUSES.has(response.status);
392
408
  var isStream = (body) => typeof ReadableStream !== "undefined" && body instanceof ReadableStream;
@@ -559,7 +575,8 @@ var createLangWatchFetch = ({
559
575
  } = {}) => {
560
576
  const send = fetchImpl ?? ((input, init) => globalThis.fetch(input, init));
561
577
  const log = logger ?? new ConsoleLogger({ level: "warn", prefix: "LangWatch" });
562
- return async (input, init) => {
578
+ return async (input, given) => {
579
+ const init = withApiVersion({ input, init: given });
563
580
  const url = requestUrl(input);
564
581
  const effective = effectiveRequest({ input, init });
565
582
  const method = (effective?.method ?? init?.method ?? "GET").toUpperCase();