langwatch 1.3.0 → 1.4.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 (30) hide show
  1. package/dist/{chunk-KUJACQJ2.js → chunk-DINMABRW.js} +12 -12
  2. package/dist/{chunk-KUJACQJ2.js.map → chunk-DINMABRW.js.map} +1 -1
  3. package/dist/{chunk-GOGMRTV5.js → chunk-G724AXIB.js} +2 -2
  4. package/dist/chunk-G724AXIB.js.map +1 -0
  5. package/dist/{chunk-SOODMKTN.mjs → chunk-H7FNDLEM.mjs} +2 -2
  6. package/dist/{chunk-SOODMKTN.mjs.map → chunk-H7FNDLEM.mjs.map} +1 -1
  7. package/dist/{chunk-7SZIBH2A.mjs → chunk-TMIZYFEI.mjs} +2 -2
  8. package/dist/chunk-TMIZYFEI.mjs.map +1 -0
  9. package/dist/cli/bundle.js +279 -197
  10. package/dist/{implementation-Bd2Z0kjH.d.mts → implementation-WfGxOvyq.d.mts} +1 -1
  11. package/dist/{implementation-Cdrj3mBw.d.ts → implementation-bVu7gJFf.d.ts} +1 -1
  12. package/dist/index.d.mts +17 -2
  13. package/dist/index.d.ts +17 -2
  14. package/dist/index.js +31 -31
  15. package/dist/index.js.map +1 -1
  16. package/dist/index.mjs +2 -2
  17. package/dist/index.mjs.map +1 -1
  18. package/dist/observability-sdk/index.d.mts +3 -3
  19. package/dist/observability-sdk/index.d.ts +3 -3
  20. package/dist/observability-sdk/index.js +2 -2
  21. package/dist/observability-sdk/index.mjs +1 -1
  22. package/dist/observability-sdk/instrumentation/langchain/index.d.mts +1 -1
  23. package/dist/observability-sdk/instrumentation/langchain/index.d.ts +1 -1
  24. package/dist/observability-sdk/setup/node/index.js +3 -3
  25. package/dist/observability-sdk/setup/node/index.mjs +2 -2
  26. package/dist/{types-DzSFwVBw.d.ts → types-DB6nS7nW.d.ts} +75 -3
  27. package/dist/{types-ruthADbq.d.mts → types-NCH43GuW.d.mts} +75 -3
  28. package/package.json +4 -1
  29. package/dist/chunk-7SZIBH2A.mjs.map +0 -1
  30. package/dist/chunk-GOGMRTV5.js.map +0 -1
@@ -1,9 +1,9 @@
1
- export { F as FilterableBatchSpanProcessor, L as LangWatchExporter, b as LangWatchExporterOptions, c as LangWatchLogger, L as LangWatchTraceExporter, b as LangWatchTraceExporterOptions, S as SpanProcessingExcludeRule, g as getLangWatchLogger, d as getLangWatchLoggerFromProvider, a as getLangWatchTracer, e as getLangWatchTracerFromProvider } from '../implementation-Bd2Z0kjH.mjs';
1
+ export { F as FilterableBatchSpanProcessor, L as LangWatchExporter, b as LangWatchExporterOptions, c as LangWatchLogger, L as LangWatchTraceExporter, b as LangWatchTraceExporterOptions, S as SpanProcessingExcludeRule, g as getLangWatchLogger, d as getLangWatchLoggerFromProvider, a as getLangWatchTracer, e as getLangWatchTracerFromProvider } from '../implementation-WfGxOvyq.mjs';
2
2
  import { OTLPLogExporter } from '@opentelemetry/exporter-logs-otlp-http';
3
3
  import { D as DataCaptureMode } from '../types-DLfhJb38.mjs';
4
4
  export { a as DataCaptureConfig, b as DataCaptureContext, c as DataCaptureOptions, d as DataCapturePredicate } from '../types-DLfhJb38.mjs';
5
- import { L as LangWatchSpan } from '../types-ruthADbq.mjs';
6
- export { A as AddEvaluationParams, E as EvaluationStatus, e as EvaluationTimestamps, I as INPUT_OUTPUT_TYPES, f as InputOutputType, J as JsonSerializable, g as LangWatchSpanMetrics, h as LangWatchSpanOptions, i as LangWatchSpanRAGContext, j as LangWatchTracer, S as SimpleChatMessage, k as SpanType, l as emitEvaluationEvent, s as spanTypes } from '../types-ruthADbq.mjs';
5
+ import { L as LangWatchSpan } from '../types-NCH43GuW.mjs';
6
+ export { A as AddEvaluationParams, E as EvaluationStatus, e as EvaluationTimestamps, I as INPUT_OUTPUT_TYPES, f as InputOutputType, J as JsonSerializable, g as LangWatchSpanMetrics, h as LangWatchSpanOptions, i as LangWatchSpanRAGContext, j as LangWatchTracer, S as SimpleChatMessage, k as SpanType, l as emitEvaluationEvent, s as spanTypes } from '../types-NCH43GuW.mjs';
7
7
  import { Span } from '@opentelemetry/api';
8
8
  export { S as SemConvAttributeKey, a as SemConvAttributes, b as SemConvLogRecordAttributes, l as attributes } from '../types-VOZv9LYO.mjs';
9
9
  import '@opentelemetry/sdk-trace-base';
@@ -1,9 +1,9 @@
1
- export { F as FilterableBatchSpanProcessor, L as LangWatchExporter, b as LangWatchExporterOptions, c as LangWatchLogger, L as LangWatchTraceExporter, b as LangWatchTraceExporterOptions, S as SpanProcessingExcludeRule, g as getLangWatchLogger, d as getLangWatchLoggerFromProvider, a as getLangWatchTracer, e as getLangWatchTracerFromProvider } from '../implementation-Cdrj3mBw.js';
1
+ export { F as FilterableBatchSpanProcessor, L as LangWatchExporter, b as LangWatchExporterOptions, c as LangWatchLogger, L as LangWatchTraceExporter, b as LangWatchTraceExporterOptions, S as SpanProcessingExcludeRule, g as getLangWatchLogger, d as getLangWatchLoggerFromProvider, a as getLangWatchTracer, e as getLangWatchTracerFromProvider } from '../implementation-bVu7gJFf.js';
2
2
  import { OTLPLogExporter } from '@opentelemetry/exporter-logs-otlp-http';
3
3
  import { D as DataCaptureMode } from '../types-DLfhJb38.js';
4
4
  export { a as DataCaptureConfig, b as DataCaptureContext, c as DataCaptureOptions, d as DataCapturePredicate } from '../types-DLfhJb38.js';
5
- import { L as LangWatchSpan } from '../types-DzSFwVBw.js';
6
- export { A as AddEvaluationParams, E as EvaluationStatus, e as EvaluationTimestamps, I as INPUT_OUTPUT_TYPES, f as InputOutputType, J as JsonSerializable, g as LangWatchSpanMetrics, h as LangWatchSpanOptions, i as LangWatchSpanRAGContext, j as LangWatchTracer, S as SimpleChatMessage, k as SpanType, l as emitEvaluationEvent, s as spanTypes } from '../types-DzSFwVBw.js';
5
+ import { L as LangWatchSpan } from '../types-DB6nS7nW.js';
6
+ export { A as AddEvaluationParams, E as EvaluationStatus, e as EvaluationTimestamps, I as INPUT_OUTPUT_TYPES, f as InputOutputType, J as JsonSerializable, g as LangWatchSpanMetrics, h as LangWatchSpanOptions, i as LangWatchSpanRAGContext, j as LangWatchTracer, S as SimpleChatMessage, k as SpanType, l as emitEvaluationEvent, s as spanTypes } from '../types-DB6nS7nW.js';
7
7
  import { Span } from '@opentelemetry/api';
8
8
  export { S as SemConvAttributeKey, a as SemConvAttributes, b as SemConvLogRecordAttributes, l as attributes } from '../types-VOZv9LYO.js';
9
9
  import '@opentelemetry/sdk-trace-base';
@@ -14,7 +14,7 @@ var _chunkK6KPNTQOjs = require('../chunk-K6KPNTQO.js');
14
14
 
15
15
 
16
16
 
17
- var _chunkGOGMRTV5js = require('../chunk-GOGMRTV5.js');
17
+ var _chunkG724AXIBjs = require('../chunk-G724AXIB.js');
18
18
 
19
19
 
20
20
 
@@ -38,5 +38,5 @@ var _chunkCLTKABMOjs = require('../chunk-CLTKABMO.js');
38
38
 
39
39
 
40
40
 
41
- exports.DataCapturePresets = _chunkZTOXEWNXjs.DataCapturePresets; exports.FilterableBatchSpanProcessor = _chunkZTOXEWNXjs.FilterableBatchSpanProcessor; exports.LangWatchExporter = _chunkGOGMRTV5js.LangWatchTraceExporter; exports.LangWatchLogsExporter = _chunkGOGMRTV5js.LangWatchLogsExporter; exports.LangWatchTraceExporter = _chunkGOGMRTV5js.LangWatchTraceExporter; exports.attributes = _chunkCLTKABMOjs.attributes_exports; exports.createLangWatchSpan = _chunkK6KPNTQOjs.createLangWatchSpan; exports.emitEvaluationEvent = _chunkK6KPNTQOjs.emitEvaluationEvent; exports.getDataCaptureMode = _chunkCLTKABMOjs.getDataCaptureMode; exports.getLangWatchLogger = _chunkGOGMRTV5js.getLangWatchLogger; exports.getLangWatchLoggerFromProvider = _chunkGOGMRTV5js.getLangWatchLoggerFromProvider; exports.getLangWatchTracer = _chunkK6KPNTQOjs.getLangWatchTracer; exports.getLangWatchTracerFromProvider = _chunkK6KPNTQOjs.getLangWatchTracerFromProvider; exports.shouldCaptureInput = _chunkCLTKABMOjs.shouldCaptureInput; exports.shouldCaptureOutput = _chunkCLTKABMOjs.shouldCaptureOutput; exports.spanTypes = _chunkK6KPNTQOjs.spanTypes;
41
+ exports.DataCapturePresets = _chunkZTOXEWNXjs.DataCapturePresets; exports.FilterableBatchSpanProcessor = _chunkZTOXEWNXjs.FilterableBatchSpanProcessor; exports.LangWatchExporter = _chunkG724AXIBjs.LangWatchTraceExporter; exports.LangWatchLogsExporter = _chunkG724AXIBjs.LangWatchLogsExporter; exports.LangWatchTraceExporter = _chunkG724AXIBjs.LangWatchTraceExporter; exports.attributes = _chunkCLTKABMOjs.attributes_exports; exports.createLangWatchSpan = _chunkK6KPNTQOjs.createLangWatchSpan; exports.emitEvaluationEvent = _chunkK6KPNTQOjs.emitEvaluationEvent; exports.getDataCaptureMode = _chunkCLTKABMOjs.getDataCaptureMode; exports.getLangWatchLogger = _chunkG724AXIBjs.getLangWatchLogger; exports.getLangWatchLoggerFromProvider = _chunkG724AXIBjs.getLangWatchLoggerFromProvider; exports.getLangWatchTracer = _chunkK6KPNTQOjs.getLangWatchTracer; exports.getLangWatchTracerFromProvider = _chunkK6KPNTQOjs.getLangWatchTracerFromProvider; exports.shouldCaptureInput = _chunkCLTKABMOjs.shouldCaptureInput; exports.shouldCaptureOutput = _chunkCLTKABMOjs.shouldCaptureOutput; exports.spanTypes = _chunkK6KPNTQOjs.spanTypes;
42
42
  //# sourceMappingURL=index.js.map
@@ -14,7 +14,7 @@ import {
14
14
  LangWatchTraceExporter,
15
15
  getLangWatchLogger,
16
16
  getLangWatchLoggerFromProvider
17
- } from "../chunk-7SZIBH2A.mjs";
17
+ } from "../chunk-TMIZYFEI.mjs";
18
18
  import {
19
19
  attributes_exports,
20
20
  getDataCaptureMode,
@@ -1,6 +1,6 @@
1
1
  import * as _opentelemetry_api from '@opentelemetry/api';
2
2
  import { Attributes } from '@opentelemetry/api';
3
- import { j as LangWatchTracer, L as LangWatchSpan, m as ChatMessage } from '../../../types-ruthADbq.mjs';
3
+ import { j as LangWatchTracer, L as LangWatchSpan, m as ChatMessage } from '../../../types-NCH43GuW.mjs';
4
4
  import { AgentAction, AgentFinish } from '@langchain/core/agents';
5
5
  import { BaseCallbackHandler } from '@langchain/core/callbacks/base';
6
6
  import { DocumentInterface } from '@langchain/core/documents';
@@ -1,6 +1,6 @@
1
1
  import * as _opentelemetry_api from '@opentelemetry/api';
2
2
  import { Attributes } from '@opentelemetry/api';
3
- import { j as LangWatchTracer, L as LangWatchSpan, m as ChatMessage } from '../../../types-DzSFwVBw.js';
3
+ import { j as LangWatchTracer, L as LangWatchSpan, m as ChatMessage } from '../../../types-DB6nS7nW.js';
4
4
  import { AgentAction, AgentFinish } from '@langchain/core/agents';
5
5
  import { BaseCallbackHandler } from '@langchain/core/callbacks/base';
6
6
  import { DocumentInterface } from '@langchain/core/documents';
@@ -1,11 +1,11 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
- var _chunkKUJACQJ2js = require('../../../chunk-KUJACQJ2.js');
5
- require('../../../chunk-GOGMRTV5.js');
4
+ var _chunkDINMABRWjs = require('../../../chunk-DINMABRW.js');
5
+ require('../../../chunk-G724AXIB.js');
6
6
  require('../../../chunk-CLTKABMO.js');
7
7
 
8
8
 
9
9
 
10
- exports.ensureSetup = _chunkKUJACQJ2js.ensureSetup; exports.setupObservability = _chunkKUJACQJ2js.setupObservability;
10
+ exports.ensureSetup = _chunkDINMABRWjs.ensureSetup; exports.setupObservability = _chunkDINMABRWjs.setupObservability;
11
11
  //# sourceMappingURL=index.js.map
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  ensureSetup,
3
3
  setupObservability
4
- } from "../../../chunk-SOODMKTN.mjs";
5
- import "../../../chunk-7SZIBH2A.mjs";
4
+ } from "../../../chunk-H7FNDLEM.mjs";
5
+ import "../../../chunk-TMIZYFEI.mjs";
6
6
  import "../../../chunk-CMZFFKLA.mjs";
7
7
  export {
8
8
  ensureSetup,
@@ -2088,7 +2088,7 @@ interface paths {
2088
2088
  put?: never;
2089
2089
  /**
2090
2090
  * Create virtual key
2091
- * @description Mints a new virtual key and returns the secret exactly once. The caller MUST persist the `secret` value, because LangWatch stores only a hash. `scopes` defaults to the caller's project; org- and team-scoped keys require a scoped API key holding `virtualKeys:manage` at each requested scope. An org- or team-scoped key also needs a place for its traces and spend to land: pass `trace_project_id` (needs `virtualKeys:manage` on that project), or the organization's governance project is used, and creation refuses with `trace_project_required` when neither exists. Send `Idempotency-Key` to make a retry safe: a replay returns the original response including its `secret`, which is the only way to recover a secret whose response was lost in transit.
2091
+ * @description Mints a new virtual key and returns the secret exactly once. The caller MUST persist the `secret` value, because LangWatch stores only a hash. `scopes` defaults to the caller's project; org- and team-scoped keys require a scoped API key holding `virtualKeys:manage` at each requested scope. An org- or team-scoped key also needs a place for its traces and spend to land, and must say where: pass `trace_project_id` (needs `virtualKeys:manage` on that project). Without it, and without exactly one project scope to take it from, creation refuses with `gateway_trace_project_ambiguous`, because the spend would be attributed to the organization's hidden governance project and counted by no budget on the project you had in mind. An organization whose only project is the governance one is exempt, since there is nothing else to name; one with no governance project either refuses with `trace_project_required`. Send `Idempotency-Key` to make a retry safe: a replay returns the original response including its `secret`, which is the only way to recover a secret whose response was lost in transit.
2092
2092
  */
2093
2093
  post: operations["postApiGatewayV1Virtual-keys"];
2094
2094
  delete?: never;
@@ -2257,7 +2257,7 @@ interface paths {
2257
2257
  put?: never;
2258
2258
  /**
2259
2259
  * Create budget
2260
- * @description Creates an organization-owned budget. The scope discriminates which resource the budget covers (organization / team / project / virtual_key / principal / group). `group` budgets are per-member allowances and require a deployment with the ClickHouse spend ledger (`group_budget_requires_clickhouse` otherwise). `provider_key` optionally pins the budget to one model provider. `cycle_anchor_at` optionally phases the window off a chosen instant instead of the calendar, for budgets that have to line up with a billing date. Send `Idempotency-Key` to make a retry safe.
2260
+ * @description Creates an organization-owned budget. The scope discriminates which resource the budget covers, across all seven scope types (organization / team / project / virtual_key / principal / group / attributed_user). `group` budgets are per-member allowances and `attributed_user` budgets are per-end-user templates; both require a deployment with the ClickHouse spend ledger (`group_budget_requires_clickhouse` otherwise). `provider_key` optionally pins the budget to one model provider. `cycle_anchor_at` optionally phases the window off a chosen instant instead of the calendar, for budgets that have to line up with a billing date. A `team`, `project` or `group` budget that none of the organization's active keys can produce traffic for is refused with `gateway_budget_scope_unreachable`, since it would never spend and never block; send `allow_unreachable` to keep it anyway, and note that an organization with no active keys is never refused. Send `Idempotency-Key` to make a retry safe.
2261
2261
  */
2262
2262
  post: operations["postApiGatewayV1Budgets"];
2263
2263
  delete?: never;
@@ -3470,7 +3470,7 @@ interface paths {
3470
3470
  };
3471
3471
  /**
3472
3472
  * Read one end user's spend
3473
- * @description Windowed spend rollup for one external end user across the organization (the /customer/info-style read a rebilling integration polls). `cap` is the applicable attributed-user budget cap and its remaining headroom once such a budget template applies; null until then.
3473
+ * @description Windowed spend rollup for one external end user across the organization (the /customer/info-style read a rebilling integration polls). `caps` lists every attributed-user budget that applies to this end user, each with its limit and the spend against it. It is an empty array until such a budget template applies, never null.
3474
3474
  */
3475
3475
  get: operations["getApiGatewayV1End-usersByIdSpend"];
3476
3476
  put?: never;
@@ -9349,6 +9349,11 @@ interface operations {
9349
9349
  display_prefix: string;
9350
9350
  principal_user_id: string | null;
9351
9351
  trace_project_id: string | null;
9352
+ /**
9353
+ * @description Which rule puts this key's traces and costs where they go: `explicit` is the `trace_project_id` on the key, `project_scope` is its single project scope, and `governance_fallback` means the key names no destination and its spend is attributed to the organization's hidden governance project. Only the first two name a project the key itself chose, so a `governance_fallback` key is counted by no project budget a reader would think to look at. New keys can no longer be written in that shape.
9354
+ * @enum {string}
9355
+ */
9356
+ trace_project_source: "explicit" | "project_scope" | "governance_fallback";
9352
9357
  external_id: string | null;
9353
9358
  metadata: {
9354
9359
  [key: string]: string;
@@ -9597,6 +9602,11 @@ interface operations {
9597
9602
  display_prefix: string;
9598
9603
  principal_user_id: string | null;
9599
9604
  trace_project_id: string | null;
9605
+ /**
9606
+ * @description Which rule puts this key's traces and costs where they go: `explicit` is the `trace_project_id` on the key, `project_scope` is its single project scope, and `governance_fallback` means the key names no destination and its spend is attributed to the organization's hidden governance project. Only the first two name a project the key itself chose, so a `governance_fallback` key is counted by no project budget a reader would think to look at. New keys can no longer be written in that shape.
9607
+ * @enum {string}
9608
+ */
9609
+ trace_project_source: "explicit" | "project_scope" | "governance_fallback";
9600
9610
  external_id: string | null;
9601
9611
  metadata: {
9602
9612
  [key: string]: string;
@@ -9752,6 +9762,11 @@ interface operations {
9752
9762
  display_prefix: string;
9753
9763
  principal_user_id: string | null;
9754
9764
  trace_project_id: string | null;
9765
+ /**
9766
+ * @description Which rule puts this key's traces and costs where they go: `explicit` is the `trace_project_id` on the key, `project_scope` is its single project scope, and `governance_fallback` means the key names no destination and its spend is attributed to the organization's hidden governance project. Only the first two name a project the key itself chose, so a `governance_fallback` key is counted by no project budget a reader would think to look at. New keys can no longer be written in that shape.
9767
+ * @enum {string}
9768
+ */
9769
+ trace_project_source: "explicit" | "project_scope" | "governance_fallback";
9755
9770
  external_id: string | null;
9756
9771
  metadata: {
9757
9772
  [key: string]: string;
@@ -10012,6 +10027,11 @@ interface operations {
10012
10027
  display_prefix: string;
10013
10028
  principal_user_id: string | null;
10014
10029
  trace_project_id: string | null;
10030
+ /**
10031
+ * @description Which rule puts this key's traces and costs where they go: `explicit` is the `trace_project_id` on the key, `project_scope` is its single project scope, and `governance_fallback` means the key names no destination and its spend is attributed to the organization's hidden governance project. Only the first two name a project the key itself chose, so a `governance_fallback` key is counted by no project budget a reader would think to look at. New keys can no longer be written in that shape.
10032
+ * @enum {string}
10033
+ */
10034
+ trace_project_source: "explicit" | "project_scope" | "governance_fallback";
10015
10035
  external_id: string | null;
10016
10036
  metadata: {
10017
10037
  [key: string]: string;
@@ -10300,6 +10320,11 @@ interface operations {
10300
10320
  display_prefix: string;
10301
10321
  principal_user_id: string | null;
10302
10322
  trace_project_id: string | null;
10323
+ /**
10324
+ * @description Which rule puts this key's traces and costs where they go: `explicit` is the `trace_project_id` on the key, `project_scope` is its single project scope, and `governance_fallback` means the key names no destination and its spend is attributed to the organization's hidden governance project. Only the first two name a project the key itself chose, so a `governance_fallback` key is counted by no project budget a reader would think to look at. New keys can no longer be written in that shape.
10325
+ * @enum {string}
10326
+ */
10327
+ trace_project_source: "explicit" | "project_scope" | "governance_fallback";
10303
10328
  external_id: string | null;
10304
10329
  metadata: {
10305
10330
  [key: string]: string;
@@ -10442,6 +10467,11 @@ interface operations {
10442
10467
  display_prefix: string;
10443
10468
  principal_user_id: string | null;
10444
10469
  trace_project_id: string | null;
10470
+ /**
10471
+ * @description Which rule puts this key's traces and costs where they go: `explicit` is the `trace_project_id` on the key, `project_scope` is its single project scope, and `governance_fallback` means the key names no destination and its spend is attributed to the organization's hidden governance project. Only the first two name a project the key itself chose, so a `governance_fallback` key is counted by no project budget a reader would think to look at. New keys can no longer be written in that shape.
10472
+ * @enum {string}
10473
+ */
10474
+ trace_project_source: "explicit" | "project_scope" | "governance_fallback";
10445
10475
  external_id: string | null;
10446
10476
  metadata: {
10447
10477
  [key: string]: string;
@@ -10576,6 +10606,11 @@ interface operations {
10576
10606
  display_prefix: string;
10577
10607
  principal_user_id: string | null;
10578
10608
  trace_project_id: string | null;
10609
+ /**
10610
+ * @description Which rule puts this key's traces and costs where they go: `explicit` is the `trace_project_id` on the key, `project_scope` is its single project scope, and `governance_fallback` means the key names no destination and its spend is attributed to the organization's hidden governance project. Only the first two name a project the key itself chose, so a `governance_fallback` key is counted by no project budget a reader would think to look at. New keys can no longer be written in that shape.
10611
+ * @enum {string}
10612
+ */
10613
+ trace_project_source: "explicit" | "project_scope" | "governance_fallback";
10579
10614
  external_id: string | null;
10580
10615
  metadata: {
10581
10616
  [key: string]: string;
@@ -10710,6 +10745,11 @@ interface operations {
10710
10745
  display_prefix: string;
10711
10746
  principal_user_id: string | null;
10712
10747
  trace_project_id: string | null;
10748
+ /**
10749
+ * @description Which rule puts this key's traces and costs where they go: `explicit` is the `trace_project_id` on the key, `project_scope` is its single project scope, and `governance_fallback` means the key names no destination and its spend is attributed to the organization's hidden governance project. Only the first two name a project the key itself chose, so a `governance_fallback` key is counted by no project budget a reader would think to look at. New keys can no longer be written in that shape.
10750
+ * @enum {string}
10751
+ */
10752
+ trace_project_source: "explicit" | "project_scope" | "governance_fallback";
10713
10753
  external_id: string | null;
10714
10754
  metadata: {
10715
10755
  [key: string]: string;
@@ -11095,6 +11135,11 @@ interface operations {
11095
11135
  member_count?: number;
11096
11136
  end_users_seen?: number;
11097
11137
  end_users_over?: number;
11138
+ /**
11139
+ * @description Whether any active key in the organization can produce traffic this budget matches. `unreachable` means it will never accrue and never block as configured: scope a key to its target, or move the budget where the keys already run. This is the only field that tells a budget nothing can reach apart from one that simply has not been breached.
11140
+ * @enum {string}
11141
+ */
11142
+ scope_reach?: "reachable" | "unreachable";
11098
11143
  }[];
11099
11144
  spend_available: boolean;
11100
11145
  /** @description Pass back as `cursor` for the next page. Null means the walk is exhausted; a full page does NOT mean there is more. */
@@ -11245,6 +11290,8 @@ interface operations {
11245
11290
  * @description Phases the budget's cycle off this instant instead of the calendar, so a `month` budget anchored 2026-01-17T09:00:00Z starts a fresh period every 17th at 09:00 UTC. Omit for calendar alignment, which is the default and unchanged behaviour. A month cycle anchored past the 28th clamps into shorter months and springs back: anchored on the 31st gives Feb 28, then Mar 31. Immutable after create, since moving it would redraw periods the budget has already reported and enforced on. Rejected with `gateway_budget_cycle_anchor_invalid` on `total` and `manual`, which do not cycle.
11246
11291
  */
11247
11292
  cycle_anchor_at?: string;
11293
+ /** @description Keeps a `team`, `project` or `group` budget that no active key can produce traffic for, which is otherwise refused with `gateway_budget_scope_unreachable`. Send it to provision ahead of the keys that will use the budget. An organization with no active keys is never refused, so this is not needed during first setup. */
11294
+ allow_unreachable?: boolean;
11248
11295
  };
11249
11296
  };
11250
11297
  };
@@ -11296,6 +11343,11 @@ interface operations {
11296
11343
  member_count?: number;
11297
11344
  end_users_seen?: number;
11298
11345
  end_users_over?: number;
11346
+ /**
11347
+ * @description Whether any active key in the organization can produce traffic this budget matches. `unreachable` means it will never accrue and never block as configured: scope a key to its target, or move the budget where the keys already run. This is the only field that tells a budget nothing can reach apart from one that simply has not been breached.
11348
+ * @enum {string}
11349
+ */
11350
+ scope_reach?: "reachable" | "unreachable";
11299
11351
  };
11300
11352
  };
11301
11353
  };
@@ -11458,6 +11510,11 @@ interface operations {
11458
11510
  member_count?: number;
11459
11511
  end_users_seen?: number;
11460
11512
  end_users_over?: number;
11513
+ /**
11514
+ * @description Whether any active key in the organization can produce traffic this budget matches. `unreachable` means it will never accrue and never block as configured: scope a key to its target, or move the budget where the keys already run. This is the only field that tells a budget nothing can reach apart from one that simply has not been breached.
11515
+ * @enum {string}
11516
+ */
11517
+ scope_reach?: "reachable" | "unreachable";
11461
11518
  };
11462
11519
  spend_available: boolean;
11463
11520
  };
@@ -11621,6 +11678,11 @@ interface operations {
11621
11678
  member_count?: number;
11622
11679
  end_users_seen?: number;
11623
11680
  end_users_over?: number;
11681
+ /**
11682
+ * @description Whether any active key in the organization can produce traffic this budget matches. `unreachable` means it will never accrue and never block as configured: scope a key to its target, or move the budget where the keys already run. This is the only field that tells a budget nothing can reach apart from one that simply has not been breached.
11683
+ * @enum {string}
11684
+ */
11685
+ scope_reach?: "reachable" | "unreachable";
11624
11686
  };
11625
11687
  };
11626
11688
  };
@@ -11778,6 +11840,11 @@ interface operations {
11778
11840
  member_count?: number;
11779
11841
  end_users_seen?: number;
11780
11842
  end_users_over?: number;
11843
+ /**
11844
+ * @description Whether any active key in the organization can produce traffic this budget matches. `unreachable` means it will never accrue and never block as configured: scope a key to its target, or move the budget where the keys already run. This is the only field that tells a budget nothing can reach apart from one that simply has not been breached.
11845
+ * @enum {string}
11846
+ */
11847
+ scope_reach?: "reachable" | "unreachable";
11781
11848
  };
11782
11849
  };
11783
11850
  };
@@ -11929,6 +11996,11 @@ interface operations {
11929
11996
  member_count?: number;
11930
11997
  end_users_seen?: number;
11931
11998
  end_users_over?: number;
11999
+ /**
12000
+ * @description Whether any active key in the organization can produce traffic this budget matches. `unreachable` means it will never accrue and never block as configured: scope a key to its target, or move the budget where the keys already run. This is the only field that tells a budget nothing can reach apart from one that simply has not been breached.
12001
+ * @enum {string}
12002
+ */
12003
+ scope_reach?: "reachable" | "unreachable";
11932
12004
  };
11933
12005
  };
11934
12006
  };
@@ -2088,7 +2088,7 @@ interface paths {
2088
2088
  put?: never;
2089
2089
  /**
2090
2090
  * Create virtual key
2091
- * @description Mints a new virtual key and returns the secret exactly once. The caller MUST persist the `secret` value, because LangWatch stores only a hash. `scopes` defaults to the caller's project; org- and team-scoped keys require a scoped API key holding `virtualKeys:manage` at each requested scope. An org- or team-scoped key also needs a place for its traces and spend to land: pass `trace_project_id` (needs `virtualKeys:manage` on that project), or the organization's governance project is used, and creation refuses with `trace_project_required` when neither exists. Send `Idempotency-Key` to make a retry safe: a replay returns the original response including its `secret`, which is the only way to recover a secret whose response was lost in transit.
2091
+ * @description Mints a new virtual key and returns the secret exactly once. The caller MUST persist the `secret` value, because LangWatch stores only a hash. `scopes` defaults to the caller's project; org- and team-scoped keys require a scoped API key holding `virtualKeys:manage` at each requested scope. An org- or team-scoped key also needs a place for its traces and spend to land, and must say where: pass `trace_project_id` (needs `virtualKeys:manage` on that project). Without it, and without exactly one project scope to take it from, creation refuses with `gateway_trace_project_ambiguous`, because the spend would be attributed to the organization's hidden governance project and counted by no budget on the project you had in mind. An organization whose only project is the governance one is exempt, since there is nothing else to name; one with no governance project either refuses with `trace_project_required`. Send `Idempotency-Key` to make a retry safe: a replay returns the original response including its `secret`, which is the only way to recover a secret whose response was lost in transit.
2092
2092
  */
2093
2093
  post: operations["postApiGatewayV1Virtual-keys"];
2094
2094
  delete?: never;
@@ -2257,7 +2257,7 @@ interface paths {
2257
2257
  put?: never;
2258
2258
  /**
2259
2259
  * Create budget
2260
- * @description Creates an organization-owned budget. The scope discriminates which resource the budget covers (organization / team / project / virtual_key / principal / group). `group` budgets are per-member allowances and require a deployment with the ClickHouse spend ledger (`group_budget_requires_clickhouse` otherwise). `provider_key` optionally pins the budget to one model provider. `cycle_anchor_at` optionally phases the window off a chosen instant instead of the calendar, for budgets that have to line up with a billing date. Send `Idempotency-Key` to make a retry safe.
2260
+ * @description Creates an organization-owned budget. The scope discriminates which resource the budget covers, across all seven scope types (organization / team / project / virtual_key / principal / group / attributed_user). `group` budgets are per-member allowances and `attributed_user` budgets are per-end-user templates; both require a deployment with the ClickHouse spend ledger (`group_budget_requires_clickhouse` otherwise). `provider_key` optionally pins the budget to one model provider. `cycle_anchor_at` optionally phases the window off a chosen instant instead of the calendar, for budgets that have to line up with a billing date. A `team`, `project` or `group` budget that none of the organization's active keys can produce traffic for is refused with `gateway_budget_scope_unreachable`, since it would never spend and never block; send `allow_unreachable` to keep it anyway, and note that an organization with no active keys is never refused. Send `Idempotency-Key` to make a retry safe.
2261
2261
  */
2262
2262
  post: operations["postApiGatewayV1Budgets"];
2263
2263
  delete?: never;
@@ -3470,7 +3470,7 @@ interface paths {
3470
3470
  };
3471
3471
  /**
3472
3472
  * Read one end user's spend
3473
- * @description Windowed spend rollup for one external end user across the organization (the /customer/info-style read a rebilling integration polls). `cap` is the applicable attributed-user budget cap and its remaining headroom once such a budget template applies; null until then.
3473
+ * @description Windowed spend rollup for one external end user across the organization (the /customer/info-style read a rebilling integration polls). `caps` lists every attributed-user budget that applies to this end user, each with its limit and the spend against it. It is an empty array until such a budget template applies, never null.
3474
3474
  */
3475
3475
  get: operations["getApiGatewayV1End-usersByIdSpend"];
3476
3476
  put?: never;
@@ -9349,6 +9349,11 @@ interface operations {
9349
9349
  display_prefix: string;
9350
9350
  principal_user_id: string | null;
9351
9351
  trace_project_id: string | null;
9352
+ /**
9353
+ * @description Which rule puts this key's traces and costs where they go: `explicit` is the `trace_project_id` on the key, `project_scope` is its single project scope, and `governance_fallback` means the key names no destination and its spend is attributed to the organization's hidden governance project. Only the first two name a project the key itself chose, so a `governance_fallback` key is counted by no project budget a reader would think to look at. New keys can no longer be written in that shape.
9354
+ * @enum {string}
9355
+ */
9356
+ trace_project_source: "explicit" | "project_scope" | "governance_fallback";
9352
9357
  external_id: string | null;
9353
9358
  metadata: {
9354
9359
  [key: string]: string;
@@ -9597,6 +9602,11 @@ interface operations {
9597
9602
  display_prefix: string;
9598
9603
  principal_user_id: string | null;
9599
9604
  trace_project_id: string | null;
9605
+ /**
9606
+ * @description Which rule puts this key's traces and costs where they go: `explicit` is the `trace_project_id` on the key, `project_scope` is its single project scope, and `governance_fallback` means the key names no destination and its spend is attributed to the organization's hidden governance project. Only the first two name a project the key itself chose, so a `governance_fallback` key is counted by no project budget a reader would think to look at. New keys can no longer be written in that shape.
9607
+ * @enum {string}
9608
+ */
9609
+ trace_project_source: "explicit" | "project_scope" | "governance_fallback";
9600
9610
  external_id: string | null;
9601
9611
  metadata: {
9602
9612
  [key: string]: string;
@@ -9752,6 +9762,11 @@ interface operations {
9752
9762
  display_prefix: string;
9753
9763
  principal_user_id: string | null;
9754
9764
  trace_project_id: string | null;
9765
+ /**
9766
+ * @description Which rule puts this key's traces and costs where they go: `explicit` is the `trace_project_id` on the key, `project_scope` is its single project scope, and `governance_fallback` means the key names no destination and its spend is attributed to the organization's hidden governance project. Only the first two name a project the key itself chose, so a `governance_fallback` key is counted by no project budget a reader would think to look at. New keys can no longer be written in that shape.
9767
+ * @enum {string}
9768
+ */
9769
+ trace_project_source: "explicit" | "project_scope" | "governance_fallback";
9755
9770
  external_id: string | null;
9756
9771
  metadata: {
9757
9772
  [key: string]: string;
@@ -10012,6 +10027,11 @@ interface operations {
10012
10027
  display_prefix: string;
10013
10028
  principal_user_id: string | null;
10014
10029
  trace_project_id: string | null;
10030
+ /**
10031
+ * @description Which rule puts this key's traces and costs where they go: `explicit` is the `trace_project_id` on the key, `project_scope` is its single project scope, and `governance_fallback` means the key names no destination and its spend is attributed to the organization's hidden governance project. Only the first two name a project the key itself chose, so a `governance_fallback` key is counted by no project budget a reader would think to look at. New keys can no longer be written in that shape.
10032
+ * @enum {string}
10033
+ */
10034
+ trace_project_source: "explicit" | "project_scope" | "governance_fallback";
10015
10035
  external_id: string | null;
10016
10036
  metadata: {
10017
10037
  [key: string]: string;
@@ -10300,6 +10320,11 @@ interface operations {
10300
10320
  display_prefix: string;
10301
10321
  principal_user_id: string | null;
10302
10322
  trace_project_id: string | null;
10323
+ /**
10324
+ * @description Which rule puts this key's traces and costs where they go: `explicit` is the `trace_project_id` on the key, `project_scope` is its single project scope, and `governance_fallback` means the key names no destination and its spend is attributed to the organization's hidden governance project. Only the first two name a project the key itself chose, so a `governance_fallback` key is counted by no project budget a reader would think to look at. New keys can no longer be written in that shape.
10325
+ * @enum {string}
10326
+ */
10327
+ trace_project_source: "explicit" | "project_scope" | "governance_fallback";
10303
10328
  external_id: string | null;
10304
10329
  metadata: {
10305
10330
  [key: string]: string;
@@ -10442,6 +10467,11 @@ interface operations {
10442
10467
  display_prefix: string;
10443
10468
  principal_user_id: string | null;
10444
10469
  trace_project_id: string | null;
10470
+ /**
10471
+ * @description Which rule puts this key's traces and costs where they go: `explicit` is the `trace_project_id` on the key, `project_scope` is its single project scope, and `governance_fallback` means the key names no destination and its spend is attributed to the organization's hidden governance project. Only the first two name a project the key itself chose, so a `governance_fallback` key is counted by no project budget a reader would think to look at. New keys can no longer be written in that shape.
10472
+ * @enum {string}
10473
+ */
10474
+ trace_project_source: "explicit" | "project_scope" | "governance_fallback";
10445
10475
  external_id: string | null;
10446
10476
  metadata: {
10447
10477
  [key: string]: string;
@@ -10576,6 +10606,11 @@ interface operations {
10576
10606
  display_prefix: string;
10577
10607
  principal_user_id: string | null;
10578
10608
  trace_project_id: string | null;
10609
+ /**
10610
+ * @description Which rule puts this key's traces and costs where they go: `explicit` is the `trace_project_id` on the key, `project_scope` is its single project scope, and `governance_fallback` means the key names no destination and its spend is attributed to the organization's hidden governance project. Only the first two name a project the key itself chose, so a `governance_fallback` key is counted by no project budget a reader would think to look at. New keys can no longer be written in that shape.
10611
+ * @enum {string}
10612
+ */
10613
+ trace_project_source: "explicit" | "project_scope" | "governance_fallback";
10579
10614
  external_id: string | null;
10580
10615
  metadata: {
10581
10616
  [key: string]: string;
@@ -10710,6 +10745,11 @@ interface operations {
10710
10745
  display_prefix: string;
10711
10746
  principal_user_id: string | null;
10712
10747
  trace_project_id: string | null;
10748
+ /**
10749
+ * @description Which rule puts this key's traces and costs where they go: `explicit` is the `trace_project_id` on the key, `project_scope` is its single project scope, and `governance_fallback` means the key names no destination and its spend is attributed to the organization's hidden governance project. Only the first two name a project the key itself chose, so a `governance_fallback` key is counted by no project budget a reader would think to look at. New keys can no longer be written in that shape.
10750
+ * @enum {string}
10751
+ */
10752
+ trace_project_source: "explicit" | "project_scope" | "governance_fallback";
10713
10753
  external_id: string | null;
10714
10754
  metadata: {
10715
10755
  [key: string]: string;
@@ -11095,6 +11135,11 @@ interface operations {
11095
11135
  member_count?: number;
11096
11136
  end_users_seen?: number;
11097
11137
  end_users_over?: number;
11138
+ /**
11139
+ * @description Whether any active key in the organization can produce traffic this budget matches. `unreachable` means it will never accrue and never block as configured: scope a key to its target, or move the budget where the keys already run. This is the only field that tells a budget nothing can reach apart from one that simply has not been breached.
11140
+ * @enum {string}
11141
+ */
11142
+ scope_reach?: "reachable" | "unreachable";
11098
11143
  }[];
11099
11144
  spend_available: boolean;
11100
11145
  /** @description Pass back as `cursor` for the next page. Null means the walk is exhausted; a full page does NOT mean there is more. */
@@ -11245,6 +11290,8 @@ interface operations {
11245
11290
  * @description Phases the budget's cycle off this instant instead of the calendar, so a `month` budget anchored 2026-01-17T09:00:00Z starts a fresh period every 17th at 09:00 UTC. Omit for calendar alignment, which is the default and unchanged behaviour. A month cycle anchored past the 28th clamps into shorter months and springs back: anchored on the 31st gives Feb 28, then Mar 31. Immutable after create, since moving it would redraw periods the budget has already reported and enforced on. Rejected with `gateway_budget_cycle_anchor_invalid` on `total` and `manual`, which do not cycle.
11246
11291
  */
11247
11292
  cycle_anchor_at?: string;
11293
+ /** @description Keeps a `team`, `project` or `group` budget that no active key can produce traffic for, which is otherwise refused with `gateway_budget_scope_unreachable`. Send it to provision ahead of the keys that will use the budget. An organization with no active keys is never refused, so this is not needed during first setup. */
11294
+ allow_unreachable?: boolean;
11248
11295
  };
11249
11296
  };
11250
11297
  };
@@ -11296,6 +11343,11 @@ interface operations {
11296
11343
  member_count?: number;
11297
11344
  end_users_seen?: number;
11298
11345
  end_users_over?: number;
11346
+ /**
11347
+ * @description Whether any active key in the organization can produce traffic this budget matches. `unreachable` means it will never accrue and never block as configured: scope a key to its target, or move the budget where the keys already run. This is the only field that tells a budget nothing can reach apart from one that simply has not been breached.
11348
+ * @enum {string}
11349
+ */
11350
+ scope_reach?: "reachable" | "unreachable";
11299
11351
  };
11300
11352
  };
11301
11353
  };
@@ -11458,6 +11510,11 @@ interface operations {
11458
11510
  member_count?: number;
11459
11511
  end_users_seen?: number;
11460
11512
  end_users_over?: number;
11513
+ /**
11514
+ * @description Whether any active key in the organization can produce traffic this budget matches. `unreachable` means it will never accrue and never block as configured: scope a key to its target, or move the budget where the keys already run. This is the only field that tells a budget nothing can reach apart from one that simply has not been breached.
11515
+ * @enum {string}
11516
+ */
11517
+ scope_reach?: "reachable" | "unreachable";
11461
11518
  };
11462
11519
  spend_available: boolean;
11463
11520
  };
@@ -11621,6 +11678,11 @@ interface operations {
11621
11678
  member_count?: number;
11622
11679
  end_users_seen?: number;
11623
11680
  end_users_over?: number;
11681
+ /**
11682
+ * @description Whether any active key in the organization can produce traffic this budget matches. `unreachable` means it will never accrue and never block as configured: scope a key to its target, or move the budget where the keys already run. This is the only field that tells a budget nothing can reach apart from one that simply has not been breached.
11683
+ * @enum {string}
11684
+ */
11685
+ scope_reach?: "reachable" | "unreachable";
11624
11686
  };
11625
11687
  };
11626
11688
  };
@@ -11778,6 +11840,11 @@ interface operations {
11778
11840
  member_count?: number;
11779
11841
  end_users_seen?: number;
11780
11842
  end_users_over?: number;
11843
+ /**
11844
+ * @description Whether any active key in the organization can produce traffic this budget matches. `unreachable` means it will never accrue and never block as configured: scope a key to its target, or move the budget where the keys already run. This is the only field that tells a budget nothing can reach apart from one that simply has not been breached.
11845
+ * @enum {string}
11846
+ */
11847
+ scope_reach?: "reachable" | "unreachable";
11781
11848
  };
11782
11849
  };
11783
11850
  };
@@ -11929,6 +11996,11 @@ interface operations {
11929
11996
  member_count?: number;
11930
11997
  end_users_seen?: number;
11931
11998
  end_users_over?: number;
11999
+ /**
12000
+ * @description Whether any active key in the organization can produce traffic this budget matches. `unreachable` means it will never accrue and never block as configured: scope a key to its target, or move the budget where the keys already run. This is the only field that tells a budget nothing can reach apart from one that simply has not been breached.
12001
+ * @enum {string}
12002
+ */
12003
+ scope_reach?: "reachable" | "unreachable";
11932
12004
  };
11933
12005
  };
11934
12006
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "langwatch",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "LangWatch TypeScript/JavaScript SDK. Interact with the full LangWatch API and use the LangWatch OpenTelemetry SDK to instrument your application. For more information, see https://docs.langwatch.ai/integration/typescript/guide",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -15,6 +15,7 @@
15
15
  "dist",
16
16
  "!dist/bin",
17
17
  "!dist/cli/*.map",
18
+ "!dist/plugin",
18
19
  "README.md",
19
20
  "LICENSE"
20
21
  ],
@@ -99,6 +100,7 @@
99
100
  "commander": "^15.0.0",
100
101
  "dotenv": "^17.3.1",
101
102
  "js-yaml": "^5.2.0",
103
+ "jsonc-parser": "^3.3.1",
102
104
  "liquidjs": "^10.27.0",
103
105
  "open": "^11.0.0",
104
106
  "openapi-fetch": "^0.17.0",
@@ -158,6 +160,7 @@
158
160
  "build": "tsc --noEmit && rm -rf dist && tsup",
159
161
  "postbuild": "node -e \"const{statSync}=require('node:fs'),{execFileSync}=require('node:child_process');const f='dist/cli/index.js',want=require('./package.json').version;const s=statSync(f);if(process.platform!=='win32'&&!(s.mode&0o111))throw new Error(f+' is not executable');const got=execFileSync(process.execPath,[f,'--version'],{encoding:'utf8',env:{...process.env,LANGWATCH_NO_DAEMON:'1'}}).trim();if(got!==want)throw new Error('version mismatch: '+f+' reports '+got+', package.json says '+want);console.log('postbuild: '+f+' ok ('+got+')')\"",
160
162
  "build:binary": "bun run scripts/build-cli-binary.ts",
163
+ "build:plugin-hook": "tsup --config tsup.plugin-hook.config.ts",
161
164
  "tarball": "pnpm build && pnpm pack",
162
165
  "typecheck": "tsc --noEmit",
163
166
  "prepublish": "pnpm run build",