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
@@ -6,7 +6,7 @@ import { Logger, LogRecord, LoggerProvider } from '@opentelemetry/api-logs';
6
6
  import { V as VAL_GEN_AI_SYSTEMS, a as VAL_GEN_AI_FINISH_REASONS } from './values-1yj9l0Sa.mjs';
7
7
  import { b as SemConvLogRecordAttributes, a as SemConvAttributes } from './types-CoS5PmeU.mjs';
8
8
  import { TracerProvider } from '@opentelemetry/api';
9
- import { j as LangWatchTracer } from './types-B696jWYQ.mjs';
9
+ import { j as LangWatchTracer } from './types--ExXvd26.mjs';
10
10
 
11
11
  /**
12
12
  * A BatchSpanProcessor subclass that filters spans before export by
@@ -6,7 +6,7 @@ import { Logger, LogRecord, LoggerProvider } from '@opentelemetry/api-logs';
6
6
  import { V as VAL_GEN_AI_SYSTEMS, a as VAL_GEN_AI_FINISH_REASONS } from './values-1yj9l0Sa.js';
7
7
  import { b as SemConvLogRecordAttributes, a as SemConvAttributes } from './types-CoS5PmeU.js';
8
8
  import { TracerProvider } from '@opentelemetry/api';
9
- import { j as LangWatchTracer } from './types-Bo6OvFct.js';
9
+ import { j as LangWatchTracer } from './types-CpT3iEIj.js';
10
10
 
11
11
  /**
12
12
  * A BatchSpanProcessor subclass that filters spans before export by
package/dist/index.d.mts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { L as Logger, C as ConsoleLogger, N as NoOpLogger } from './index-D7rKIGrO.mjs';
2
- export { F as FilterableBatchSpanProcessor, L as LangWatchExporter, S as SpanProcessingExcludeRule, g as getLangWatchLogger, a as getLangWatchTracer } from './implementation-B4Z2ksnA.mjs';
2
+ export { F as FilterableBatchSpanProcessor, L as LangWatchExporter, S as SpanProcessingExcludeRule, g as getLangWatchLogger, a as getLangWatchTracer } from './implementation-BXVPzwOt.mjs';
3
3
  import { z } from 'zod';
4
4
  import openApiCreateClient from 'openapi-fetch';
5
- import { p as paths, P as PromptResponse, C as CreatePromptBody, U as UpdatePromptBody, T as TagDefinition, a as CreatedTag, o as operations, b as PromptData, F as FetchPolicy, c as Prompt, L as LangWatchSpan, d as components } from './types-B696jWYQ.mjs';
5
+ import { p as paths, P as PromptResponse, C as CreatePromptBody, U as UpdatePromptBody, T as TagDefinition, a as CreatedTag, o as operations, b as PromptData, F as FetchPolicy, c as Prompt, L as LangWatchSpan, d as components } from './types--ExXvd26.mjs';
6
6
  export { l as attributes } from './types-CoS5PmeU.mjs';
7
7
  import { LangWatchHandledErrorReason, LangWatchHandledErrorShape } from '@langwatch/handled-error/langwatch-handled-error';
8
8
  export { LangWatchHandledErrorReason, LangWatchHandledErrorShape } from '@langwatch/handled-error/langwatch-handled-error';
@@ -1893,7 +1893,73 @@ declare class AnnotationsApiService {
1893
1893
  delete(id: string): Promise<DeleteAnnotationResponse>;
1894
1894
  }
1895
1895
 
1896
- interface DashboardSummary {
1896
+ type Json<T> = T extends {
1897
+ content: {
1898
+ "application/json": infer Body;
1899
+ };
1900
+ } ? Body : never;
1901
+ /** A dashboard as `/api/v1/dashboards/{dashboardId}` answers it. */
1902
+ type Dashboard = Json<paths["/api/v1/dashboards/{dashboardId}"]["get"]["responses"]["200"]>;
1903
+ /** One row of the dashboards list, with its widget count. */
1904
+ type DashboardListItem = Json<paths["/api/v1/dashboards"]["get"]["responses"]["200"]>["data"][number];
1905
+ /** A widget on a dashboard, as the dashboard's widget routes answer it. */
1906
+ type DashboardWidget = Json<paths["/api/v1/dashboards/{dashboardId}/widgets/{widgetId}"]["get"]["responses"]["200"]>;
1907
+ /** What creating a widget on a dashboard submits. */
1908
+ type CreateDashboardWidgetInput = NonNullable<paths["/api/v1/dashboards/{dashboardId}/widgets"]["post"]["requestBody"]>["content"]["application/json"];
1909
+ /** What updating a widget on a dashboard submits; a field left out keeps its value. */
1910
+ type UpdateDashboardWidgetInput = NonNullable<paths["/api/v1/dashboards/{dashboardId}/widgets/{widgetId}"]["patch"]["requestBody"]>["content"]["application/json"];
1911
+ /**
1912
+ * Typed client for `/api/v1/dashboards`: the key's project's dashboards and the widgets on them.
1913
+ * The project comes from the API key; while Dashboards is off the routes answer 404.
1914
+ */
1915
+ declare class DashboardsApiService {
1916
+ private readonly apiClient;
1917
+ constructor(config?: Pick<InternalConfig, "langwatchApiClient">);
1918
+ private handleApiError;
1919
+ list(): Promise<{
1920
+ data: DashboardListItem[];
1921
+ }>;
1922
+ get(dashboardId: string): Promise<Dashboard>;
1923
+ create({ name }: {
1924
+ name: string;
1925
+ }): Promise<Dashboard>;
1926
+ /** `description: null` clears it; a field left out keeps its value. */
1927
+ update({ dashboardId, name, description, }: {
1928
+ dashboardId: string;
1929
+ name?: string;
1930
+ description?: string | null;
1931
+ }): Promise<Dashboard>;
1932
+ /** Deletes the dashboard with the widgets on it; answers its id and name. */
1933
+ delete(dashboardId: string): Promise<{
1934
+ id: string;
1935
+ name: string;
1936
+ }>;
1937
+ listWidgets(dashboardId: string): Promise<{
1938
+ data: DashboardWidget[];
1939
+ }>;
1940
+ /** Creates a widget placed on this dashboard. */
1941
+ createWidget({ dashboardId, widget, }: {
1942
+ dashboardId: string;
1943
+ widget: CreateDashboardWidgetInput;
1944
+ }): Promise<DashboardWidget>;
1945
+ getWidget({ dashboardId, widgetId, }: {
1946
+ dashboardId: string;
1947
+ widgetId: string;
1948
+ }): Promise<DashboardWidget>;
1949
+ updateWidget({ dashboardId, widgetId, changes, }: {
1950
+ dashboardId: string;
1951
+ widgetId: string;
1952
+ changes: UpdateDashboardWidgetInput;
1953
+ }): Promise<DashboardWidget>;
1954
+ /** The route answers `204` with no body. */
1955
+ deleteWidget({ dashboardId, widgetId, }: {
1956
+ dashboardId: string;
1957
+ widgetId: string;
1958
+ }): Promise<void>;
1959
+ }
1960
+
1961
+ /** One Analytics Report in the list, with how many graphs it holds. */
1962
+ interface AnalyticsReportSummary {
1897
1963
  id: string;
1898
1964
  name: string;
1899
1965
  order: number;
@@ -1902,7 +1968,8 @@ interface DashboardSummary {
1902
1968
  updatedAt: string;
1903
1969
  platformUrl?: string;
1904
1970
  }
1905
- interface DashboardDetail {
1971
+ /** One Analytics Report with its graphs. */
1972
+ interface AnalyticsReportDetail {
1906
1973
  id: string;
1907
1974
  name: string;
1908
1975
  order: number;
@@ -1911,20 +1978,24 @@ interface DashboardDetail {
1911
1978
  updatedAt: string;
1912
1979
  platformUrl?: string;
1913
1980
  }
1914
- declare class DashboardsApiService {
1981
+ /**
1982
+ * Typed client for the Analytics Reports at `/api/v1/analytics/reports`, deprecated by the
1983
+ * platform in favour of the Dashboards API (`DashboardsApiService`, `/api/v1/dashboards`).
1984
+ */
1985
+ declare class AnalyticsReportsApiService {
1915
1986
  private readonly apiClient;
1916
1987
  constructor(config?: Pick<InternalConfig, "langwatchApiClient">);
1917
1988
  private handleApiError;
1918
1989
  list(): Promise<{
1919
- data: DashboardSummary[];
1990
+ data: AnalyticsReportSummary[];
1920
1991
  }>;
1921
- get(id: string): Promise<DashboardDetail>;
1992
+ get(id: string): Promise<AnalyticsReportDetail>;
1922
1993
  create(params: {
1923
1994
  name: string;
1924
- }): Promise<DashboardDetail>;
1995
+ }): Promise<AnalyticsReportDetail>;
1925
1996
  rename(id: string, params: {
1926
1997
  name: string;
1927
- }): Promise<DashboardDetail>;
1998
+ }): Promise<AnalyticsReportDetail>;
1928
1999
  delete(id: string): Promise<{
1929
2000
  id: string;
1930
2001
  name: string;
@@ -2677,7 +2748,7 @@ interface SpendSummaryRow {
2677
2748
  * two dimensions, two rows can share a key: read `group` to tell them apart.
2678
2749
  */
2679
2750
  key: string;
2680
- /** Every grouping dimension by name, e.g. `{ model: "gpt-5-mini" }`. */
2751
+ /** Every grouping dimension by name, e.g. `{ model: "gpt-6-luna" }`. */
2681
2752
  group: Record<string, string>;
2682
2753
  /** Start of the time bucket in the requested zone, null when unbucketed. */
2683
2754
  bucket_start: string | null;
@@ -3403,7 +3474,10 @@ declare class LangWatch {
3403
3474
  readonly workflows: WorkflowsApiService;
3404
3475
  readonly agents: AgentsApiService;
3405
3476
  readonly annotations: AnnotationsApiService;
3477
+ /** The project's dashboards and the widgets on them, over /api/v1/dashboards. */
3406
3478
  readonly dashboards: DashboardsApiService;
3479
+ /** The Analytics Reports, over /api/v1/analytics/reports; the platform deprecates them. */
3480
+ readonly analyticsReports: AnalyticsReportsApiService;
3407
3481
  readonly modelProviders: ModelProvidersApiService;
3408
3482
  readonly analytics: AnalyticsApiService;
3409
3483
  /** The raw LangWatchQL door: a governed SELECT or schema discovery outside a saved chart. */
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { L as Logger, C as ConsoleLogger, N as NoOpLogger } from './index-D7rKIGrO.js';
2
- export { F as FilterableBatchSpanProcessor, L as LangWatchExporter, S as SpanProcessingExcludeRule, g as getLangWatchLogger, a as getLangWatchTracer } from './implementation-BFUgzz5C.js';
2
+ export { F as FilterableBatchSpanProcessor, L as LangWatchExporter, S as SpanProcessingExcludeRule, g as getLangWatchLogger, a as getLangWatchTracer } from './implementation-DJ-JveZl.js';
3
3
  import { z } from 'zod';
4
4
  import openApiCreateClient from 'openapi-fetch';
5
- import { p as paths, P as PromptResponse, C as CreatePromptBody, U as UpdatePromptBody, T as TagDefinition, a as CreatedTag, o as operations, b as PromptData, F as FetchPolicy, c as Prompt, L as LangWatchSpan, d as components } from './types-Bo6OvFct.js';
5
+ import { p as paths, P as PromptResponse, C as CreatePromptBody, U as UpdatePromptBody, T as TagDefinition, a as CreatedTag, o as operations, b as PromptData, F as FetchPolicy, c as Prompt, L as LangWatchSpan, d as components } from './types-CpT3iEIj.js';
6
6
  export { l as attributes } from './types-CoS5PmeU.js';
7
7
  import { LangWatchHandledErrorReason, LangWatchHandledErrorShape } from '@langwatch/handled-error/langwatch-handled-error';
8
8
  export { LangWatchHandledErrorReason, LangWatchHandledErrorShape } from '@langwatch/handled-error/langwatch-handled-error';
@@ -1893,7 +1893,73 @@ declare class AnnotationsApiService {
1893
1893
  delete(id: string): Promise<DeleteAnnotationResponse>;
1894
1894
  }
1895
1895
 
1896
- interface DashboardSummary {
1896
+ type Json<T> = T extends {
1897
+ content: {
1898
+ "application/json": infer Body;
1899
+ };
1900
+ } ? Body : never;
1901
+ /** A dashboard as `/api/v1/dashboards/{dashboardId}` answers it. */
1902
+ type Dashboard = Json<paths["/api/v1/dashboards/{dashboardId}"]["get"]["responses"]["200"]>;
1903
+ /** One row of the dashboards list, with its widget count. */
1904
+ type DashboardListItem = Json<paths["/api/v1/dashboards"]["get"]["responses"]["200"]>["data"][number];
1905
+ /** A widget on a dashboard, as the dashboard's widget routes answer it. */
1906
+ type DashboardWidget = Json<paths["/api/v1/dashboards/{dashboardId}/widgets/{widgetId}"]["get"]["responses"]["200"]>;
1907
+ /** What creating a widget on a dashboard submits. */
1908
+ type CreateDashboardWidgetInput = NonNullable<paths["/api/v1/dashboards/{dashboardId}/widgets"]["post"]["requestBody"]>["content"]["application/json"];
1909
+ /** What updating a widget on a dashboard submits; a field left out keeps its value. */
1910
+ type UpdateDashboardWidgetInput = NonNullable<paths["/api/v1/dashboards/{dashboardId}/widgets/{widgetId}"]["patch"]["requestBody"]>["content"]["application/json"];
1911
+ /**
1912
+ * Typed client for `/api/v1/dashboards`: the key's project's dashboards and the widgets on them.
1913
+ * The project comes from the API key; while Dashboards is off the routes answer 404.
1914
+ */
1915
+ declare class DashboardsApiService {
1916
+ private readonly apiClient;
1917
+ constructor(config?: Pick<InternalConfig, "langwatchApiClient">);
1918
+ private handleApiError;
1919
+ list(): Promise<{
1920
+ data: DashboardListItem[];
1921
+ }>;
1922
+ get(dashboardId: string): Promise<Dashboard>;
1923
+ create({ name }: {
1924
+ name: string;
1925
+ }): Promise<Dashboard>;
1926
+ /** `description: null` clears it; a field left out keeps its value. */
1927
+ update({ dashboardId, name, description, }: {
1928
+ dashboardId: string;
1929
+ name?: string;
1930
+ description?: string | null;
1931
+ }): Promise<Dashboard>;
1932
+ /** Deletes the dashboard with the widgets on it; answers its id and name. */
1933
+ delete(dashboardId: string): Promise<{
1934
+ id: string;
1935
+ name: string;
1936
+ }>;
1937
+ listWidgets(dashboardId: string): Promise<{
1938
+ data: DashboardWidget[];
1939
+ }>;
1940
+ /** Creates a widget placed on this dashboard. */
1941
+ createWidget({ dashboardId, widget, }: {
1942
+ dashboardId: string;
1943
+ widget: CreateDashboardWidgetInput;
1944
+ }): Promise<DashboardWidget>;
1945
+ getWidget({ dashboardId, widgetId, }: {
1946
+ dashboardId: string;
1947
+ widgetId: string;
1948
+ }): Promise<DashboardWidget>;
1949
+ updateWidget({ dashboardId, widgetId, changes, }: {
1950
+ dashboardId: string;
1951
+ widgetId: string;
1952
+ changes: UpdateDashboardWidgetInput;
1953
+ }): Promise<DashboardWidget>;
1954
+ /** The route answers `204` with no body. */
1955
+ deleteWidget({ dashboardId, widgetId, }: {
1956
+ dashboardId: string;
1957
+ widgetId: string;
1958
+ }): Promise<void>;
1959
+ }
1960
+
1961
+ /** One Analytics Report in the list, with how many graphs it holds. */
1962
+ interface AnalyticsReportSummary {
1897
1963
  id: string;
1898
1964
  name: string;
1899
1965
  order: number;
@@ -1902,7 +1968,8 @@ interface DashboardSummary {
1902
1968
  updatedAt: string;
1903
1969
  platformUrl?: string;
1904
1970
  }
1905
- interface DashboardDetail {
1971
+ /** One Analytics Report with its graphs. */
1972
+ interface AnalyticsReportDetail {
1906
1973
  id: string;
1907
1974
  name: string;
1908
1975
  order: number;
@@ -1911,20 +1978,24 @@ interface DashboardDetail {
1911
1978
  updatedAt: string;
1912
1979
  platformUrl?: string;
1913
1980
  }
1914
- declare class DashboardsApiService {
1981
+ /**
1982
+ * Typed client for the Analytics Reports at `/api/v1/analytics/reports`, deprecated by the
1983
+ * platform in favour of the Dashboards API (`DashboardsApiService`, `/api/v1/dashboards`).
1984
+ */
1985
+ declare class AnalyticsReportsApiService {
1915
1986
  private readonly apiClient;
1916
1987
  constructor(config?: Pick<InternalConfig, "langwatchApiClient">);
1917
1988
  private handleApiError;
1918
1989
  list(): Promise<{
1919
- data: DashboardSummary[];
1990
+ data: AnalyticsReportSummary[];
1920
1991
  }>;
1921
- get(id: string): Promise<DashboardDetail>;
1992
+ get(id: string): Promise<AnalyticsReportDetail>;
1922
1993
  create(params: {
1923
1994
  name: string;
1924
- }): Promise<DashboardDetail>;
1995
+ }): Promise<AnalyticsReportDetail>;
1925
1996
  rename(id: string, params: {
1926
1997
  name: string;
1927
- }): Promise<DashboardDetail>;
1998
+ }): Promise<AnalyticsReportDetail>;
1928
1999
  delete(id: string): Promise<{
1929
2000
  id: string;
1930
2001
  name: string;
@@ -2677,7 +2748,7 @@ interface SpendSummaryRow {
2677
2748
  * two dimensions, two rows can share a key: read `group` to tell them apart.
2678
2749
  */
2679
2750
  key: string;
2680
- /** Every grouping dimension by name, e.g. `{ model: "gpt-5-mini" }`. */
2751
+ /** Every grouping dimension by name, e.g. `{ model: "gpt-6-luna" }`. */
2681
2752
  group: Record<string, string>;
2682
2753
  /** Start of the time bucket in the requested zone, null when unbucketed. */
2683
2754
  bucket_start: string | null;
@@ -3403,7 +3474,10 @@ declare class LangWatch {
3403
3474
  readonly workflows: WorkflowsApiService;
3404
3475
  readonly agents: AgentsApiService;
3405
3476
  readonly annotations: AnnotationsApiService;
3477
+ /** The project's dashboards and the widgets on them, over /api/v1/dashboards. */
3406
3478
  readonly dashboards: DashboardsApiService;
3479
+ /** The Analytics Reports, over /api/v1/analytics/reports; the platform deprecates them. */
3480
+ readonly analyticsReports: AnalyticsReportsApiService;
3407
3481
  readonly modelProviders: ModelProvidersApiService;
3408
3482
  readonly analytics: AnalyticsApiService;
3409
3483
  /** The raw LangWatchQL door: a governed SELECT or schema discovery outside a saved chart. */