langwatch 1.10.0 → 1.12.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 (36) hide show
  1. package/dist/agent/index.d.mts +307 -0
  2. package/dist/agent/index.d.ts +307 -0
  3. package/dist/agent/index.js +1493 -0
  4. package/dist/agent/index.js.map +1 -0
  5. package/dist/agent/index.mjs +1449 -0
  6. package/dist/agent/index.mjs.map +1 -0
  7. package/dist/{chunk-ZG2F6QBC.js → chunk-3WIN2UXZ.js} +17 -6
  8. package/dist/chunk-3WIN2UXZ.js.map +1 -0
  9. package/dist/{chunk-6QIASJKJ.mjs → chunk-BAE4KYKJ.mjs} +2 -2
  10. package/dist/{chunk-LFUK5LSB.mjs → chunk-F5UYCQT3.mjs} +17 -6
  11. package/dist/chunk-F5UYCQT3.mjs.map +1 -0
  12. package/dist/{chunk-ODURZH6D.js → chunk-QLYKPPAW.js} +12 -12
  13. package/dist/{chunk-ODURZH6D.js.map → chunk-QLYKPPAW.js.map} +1 -1
  14. package/dist/cli/bundle.js +818 -402
  15. package/dist/{implementation-C1F0eCHp.d.mts → implementation-BA3xa5UR.d.mts} +1 -1
  16. package/dist/{implementation-BvwOB77X.d.ts → implementation-rpImK8WS.d.ts} +1 -1
  17. package/dist/index.d.mts +219 -3
  18. package/dist/index.d.ts +219 -3
  19. package/dist/index.js +348 -60
  20. package/dist/index.js.map +1 -1
  21. package/dist/index.mjs +317 -29
  22. package/dist/index.mjs.map +1 -1
  23. package/dist/observability-sdk/index.d.mts +3 -3
  24. package/dist/observability-sdk/index.d.ts +3 -3
  25. package/dist/observability-sdk/index.js +2 -2
  26. package/dist/observability-sdk/index.mjs +1 -1
  27. package/dist/observability-sdk/instrumentation/langchain/index.d.mts +1 -1
  28. package/dist/observability-sdk/instrumentation/langchain/index.d.ts +1 -1
  29. package/dist/observability-sdk/setup/node/index.js +3 -3
  30. package/dist/observability-sdk/setup/node/index.mjs +2 -2
  31. package/dist/{types-jx13nj4M.d.ts → types-Cr25FO-i.d.ts} +4320 -1017
  32. package/dist/{types-C3NpCWi_.d.mts → types-DJyJypkv.d.mts} +4320 -1017
  33. package/package.json +8 -1
  34. package/dist/chunk-LFUK5LSB.mjs.map +0 -1
  35. package/dist/chunk-ZG2F6QBC.js.map +0 -1
  36. /package/dist/{chunk-6QIASJKJ.mjs.map → chunk-BAE4KYKJ.mjs.map} +0 -0
@@ -4,7 +4,7 @@ import { ExportResult } from '@opentelemetry/core';
4
4
  import { Logger, LogRecord, LoggerProvider } from '@opentelemetry/api-logs';
5
5
  import { b as SemConvLogRecordAttributes, a as SemConvAttributes } from './types-VOZv9LYO.mjs';
6
6
  import { TracerProvider } from '@opentelemetry/api';
7
- import { j as LangWatchTracer } from './types-C3NpCWi_.mjs';
7
+ import { j as LangWatchTracer } from './types-DJyJypkv.mjs';
8
8
 
9
9
  /**
10
10
  * Filterable Batch Span Exporter for OpenTelemetry
@@ -4,7 +4,7 @@ import { ExportResult } from '@opentelemetry/core';
4
4
  import { Logger, LogRecord, LoggerProvider } from '@opentelemetry/api-logs';
5
5
  import { b as SemConvLogRecordAttributes, a as SemConvAttributes } from './types-VOZv9LYO.js';
6
6
  import { TracerProvider } from '@opentelemetry/api';
7
- import { j as LangWatchTracer } from './types-jx13nj4M.js';
7
+ import { j as LangWatchTracer } from './types-Cr25FO-i.js';
8
8
 
9
9
  /**
10
10
  * Filterable Batch Span Exporter for OpenTelemetry
package/dist/index.d.mts CHANGED
@@ -1,7 +1,7 @@
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-C1F0eCHp.mjs';
2
+ export { F as FilterableBatchSpanProcessor, L as LangWatchExporter, S as SpanProcessingExcludeRule, g as getLangWatchLogger, a as getLangWatchTracer } from './implementation-BA3xa5UR.mjs';
3
3
  import { z } from 'zod';
4
- 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-C3NpCWi_.mjs';
4
+ 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-DJyJypkv.mjs';
5
5
  import openApiCreateClient from 'openapi-fetch';
6
6
  export { l as attributes } from './types-VOZv9LYO.mjs';
7
7
  import { CliHandledErrorReason, CliHandledError } from '@langwatch/langy/cards/handled-error';
@@ -1941,6 +1941,8 @@ type ScenarioResponse = NonNullable<paths["/api/scenarios"]["get"]["responses"][
1941
1941
  type CreateScenarioBody = NonNullable<paths["/api/scenarios"]["post"]["requestBody"]>["content"]["application/json"];
1942
1942
  type UpdateScenarioBody = NonNullable<paths["/api/scenarios/{id}"]["put"]["requestBody"]>["content"]["application/json"];
1943
1943
  type DeleteScenarioResponse = paths["/api/scenarios/{id}"]["delete"]["responses"]["200"]["content"]["application/json"];
1944
+ type ScenarioVersionListResponse = paths["/api/scenarios/{id}/versions"]["get"]["responses"]["200"]["content"]["application/json"];
1945
+ type ScenarioVersionDetail = paths["/api/scenarios/{id}/versions/{version}"]["get"]["responses"]["200"]["content"]["application/json"];
1944
1946
 
1945
1947
  declare class ScenariosApiService {
1946
1948
  private readonly apiClient;
@@ -1950,6 +1952,13 @@ declare class ScenariosApiService {
1950
1952
  get(id: string): Promise<ScenarioResponse>;
1951
1953
  create(params: CreateScenarioBody): Promise<ScenarioResponse>;
1952
1954
  update(id: string, params: UpdateScenarioBody): Promise<ScenarioResponse>;
1955
+ /** The saved versions of a scenario, newest first. */
1956
+ listVersions(id: string, options?: {
1957
+ limit?: number;
1958
+ cursor?: number;
1959
+ }): Promise<ScenarioVersionListResponse>;
1960
+ /** One saved version of a scenario, with the content it saved. */
1961
+ getVersion(id: string, version: number): Promise<ScenarioVersionDetail>;
1953
1962
  delete(id: string): Promise<DeleteScenarioResponse>;
1954
1963
  }
1955
1964
 
@@ -1974,12 +1983,25 @@ interface SuiteRunOptions {
1974
1983
  * that name.
1975
1984
  */
1976
1985
  parameters?: Record<string, string | number | boolean>;
1986
+ /**
1987
+ * One short line saying why this batch was run, e.g. a commit hash or what
1988
+ * changed. Every run of the batch carries it. Spaces around it are removed,
1989
+ * and a note of only spaces is sent as no note at all.
1990
+ */
1991
+ note?: string;
1977
1992
  }
1993
+ /** Which kind of suite `getAll` returns. Defaults to run plans. */
1994
+ type SuiteKind = "custom" | "folder";
1995
+ /**
1996
+ * @deprecated Use runPlans and testSuites; /api/suites is a frozen alias.
1997
+ */
1978
1998
  declare class SuitesApiService {
1979
1999
  private readonly apiClient;
1980
2000
  constructor(config?: Pick<InternalConfig, "langwatchApiClient">);
1981
2001
  private handleApiError;
1982
- getAll(): Promise<SuiteResponse[]>;
2002
+ getAll(options?: {
2003
+ kind?: SuiteKind;
2004
+ }): Promise<SuiteResponse[]>;
1983
2005
  get(id: string): Promise<SuiteResponse>;
1984
2006
  create(params: CreateSuiteBody): Promise<SuiteResponse>;
1985
2007
  update(id: string, params: UpdateSuiteBody): Promise<SuiteResponse>;
@@ -1996,6 +2018,93 @@ declare class SuitesApiService {
1996
2018
  }>;
1997
2019
  }
1998
2020
 
2021
+ /** One run plan, exactly as the REST surface answers it. */
2022
+ type RunPlan = paths["/api/v1/run-plans/{id}"]["get"]["responses"]["200"]["content"]["application/json"];
2023
+ /** The body `POST /api/v1/run-plans/run` takes. */
2024
+ type RunPlanRunBody = NonNullable<paths["/api/v1/run-plans/run"]["post"]["requestBody"]>["content"]["application/json"];
2025
+ /** What a scheduled run answers with. */
2026
+ type RunPlanRunResult = paths["/api/v1/run-plans/run"]["post"]["responses"]["200"]["content"]["application/json"];
2027
+ /** The body `POST /api/v1/run-plans/{id}/run` takes. */
2028
+ type RunPlanRerunBody = NonNullable<paths["/api/v1/run-plans/{id}/run"]["post"]["requestBody"]>["content"]["application/json"];
2029
+ /**
2030
+ * Typed client for the run plan family (`/api/v1/run-plans`).
2031
+ *
2032
+ * A run plan is identified by its NAME. Posting a configuration under a name
2033
+ * already in use replaces that plan's configuration and joins its history;
2034
+ * posting under a new name creates the plan; posting no name lets the platform
2035
+ * derive one from what the run covers and what it runs against.
2036
+ *
2037
+ * @see specs/typescript-sdk/run-plans-and-test-suites.feature
2038
+ */
2039
+ declare class RunPlansApiService {
2040
+ private readonly apiClient;
2041
+ constructor(config?: Pick<InternalConfig, "langwatchApiClient">);
2042
+ private handleApiError;
2043
+ /** The project's run plans. Archived plans are left out unless asked for. */
2044
+ list(options?: {
2045
+ includeArchived?: boolean;
2046
+ }): Promise<RunPlan[]>;
2047
+ get(id: string): Promise<RunPlan>;
2048
+ /**
2049
+ * Runs a configuration under a name.
2050
+ *
2051
+ * A note of only spaces is no note: sending an empty string would store a
2052
+ * value every reader then has to filter out.
2053
+ */
2054
+ run(body: RunPlanRunBody): Promise<RunPlanRunResult>;
2055
+ /** Runs a plan again with the configuration it already holds. */
2056
+ rerun(id: string, body?: RunPlanRerunBody): Promise<RunPlanRunResult>;
2057
+ archive(id: string): Promise<{
2058
+ id: string;
2059
+ archived: true;
2060
+ }>;
2061
+ }
2062
+
2063
+ /** One test suite as the list answers it: a name and the scenarios filed in it. */
2064
+ type TestSuite = NonNullable<paths["/api/v1/test-suites"]["get"]["responses"]["200"]["content"]["application/json"]>[number];
2065
+ /** One test suite read on its own, with its scenarios named. */
2066
+ type TestSuiteDetail = paths["/api/v1/test-suites/{id}"]["get"]["responses"]["200"]["content"]["application/json"];
2067
+ /** The body `POST /api/v1/test-suites` takes. */
2068
+ type CreateTestSuiteBody = NonNullable<paths["/api/v1/test-suites"]["post"]["requestBody"]>["content"]["application/json"];
2069
+ /** The body `PATCH /api/v1/test-suites/{id}` takes. */
2070
+ type RenameTestSuiteBody = NonNullable<paths["/api/v1/test-suites/{id}"]["patch"]["requestBody"]>["content"]["application/json"];
2071
+ /** The body `POST /api/v1/test-suites/{id}/run` takes. */
2072
+ type RunTestSuiteBody = NonNullable<paths["/api/v1/test-suites/{id}/run"]["post"]["requestBody"]>["content"]["application/json"];
2073
+ /** What a scheduled suite run answers with. It is a run plan run. */
2074
+ type TestSuiteRunResult = RunPlanRunResult;
2075
+ /**
2076
+ * Typed client for the test suite family (`/api/v1/test-suites`).
2077
+ *
2078
+ * A test suite is a group of scenarios: a name, and the scenarios filed in it.
2079
+ * It holds no targets and no configuration, so running one sends its targets with
2080
+ * the request and the platform files the run under a run plan.
2081
+ *
2082
+ * @see specs/typescript-sdk/run-plans-and-test-suites.feature
2083
+ */
2084
+ declare class TestSuitesApiService {
2085
+ private readonly apiClient;
2086
+ constructor(config?: Pick<InternalConfig, "langwatchApiClient">);
2087
+ private handleApiError;
2088
+ /** The project's test suites. Archived suites are left out unless asked for. */
2089
+ list(options?: {
2090
+ includeArchived?: boolean;
2091
+ }): Promise<TestSuite[]>;
2092
+ create(params: CreateTestSuiteBody): Promise<TestSuite>;
2093
+ get(id: string): Promise<TestSuiteDetail>;
2094
+ /** Renames a suite. The slug is kept, so links and run history stay put. */
2095
+ rename(id: string, params: RenameTestSuiteBody): Promise<TestSuite>;
2096
+ /** Archives a suite. The scenarios filed in it are archived with it. */
2097
+ archive(id: string): Promise<{
2098
+ id: string;
2099
+ archived: true;
2100
+ }>;
2101
+ /**
2102
+ * Runs every scenario filed in the suite against the targets sent with the
2103
+ * request. A note of only spaces is no note.
2104
+ */
2105
+ run(id: string, body: RunTestSuiteBody): Promise<TestSuiteRunResult>;
2106
+ }
2107
+
1999
2108
  type WorkflowResponse = NonNullable<paths["/api/workflows"]["get"]["responses"]["200"]["content"]["application/json"]>[number];
2000
2109
  type WorkflowDeleteResponse = paths["/api/workflows/{id}"]["delete"]["responses"]["200"]["content"]["application/json"];
2001
2110
  declare class WorkflowsApiService {
@@ -2037,6 +2146,23 @@ declare class WorkflowsApiService {
2037
2146
  }): Promise<ExperimentRunWithResults>;
2038
2147
  }
2039
2148
 
2149
+ /** One run parameter an agent declares, as the platform lists it. */
2150
+ interface AgentParameterSpec {
2151
+ name: string;
2152
+ type: "string" | "number" | "boolean";
2153
+ options?: string[];
2154
+ default?: string | number | boolean;
2155
+ description?: string;
2156
+ required?: boolean;
2157
+ secret?: boolean;
2158
+ }
2159
+ /** One process connected as an instance of a connected agent. */
2160
+ interface AgentInstance {
2161
+ id: string;
2162
+ hostname: string;
2163
+ label?: string | null;
2164
+ connectedAt: string;
2165
+ }
2040
2166
  interface AgentResponse {
2041
2167
  id: string;
2042
2168
  name: string;
@@ -2045,6 +2171,20 @@ interface AgentResponse {
2045
2171
  createdAt: string;
2046
2172
  updatedAt: string;
2047
2173
  platformUrl?: string;
2174
+ /** Connected agents: the environment the SDK registered under. */
2175
+ environment?: string | null;
2176
+ /** Connected agents: online while at least one instance is connected. */
2177
+ status?: "online" | "offline" | null;
2178
+ instances?: AgentInstance[];
2179
+ lastSeenAt?: string | null;
2180
+ /** The owner of a personal agent. */
2181
+ owner?: {
2182
+ userId: string;
2183
+ name: string;
2184
+ } | null;
2185
+ /** The machine a host-scoped development agent belongs to. */
2186
+ hostLabel?: string | null;
2187
+ parameters?: AgentParameterSpec[];
2048
2188
  }
2049
2189
  interface AgentListResponse {
2050
2190
  data: AgentResponse[];
@@ -2055,6 +2195,12 @@ interface AgentListResponse {
2055
2195
  totalPages: number;
2056
2196
  };
2057
2197
  }
2198
+ /** The body `POST /api/v1/agents/{id}/call` takes. */
2199
+ type AgentCallBody = NonNullable<paths["/api/v1/agents/{id}/call"]["post"]["requestBody"]>["content"]["application/json"];
2200
+ /** The reply of the relay: the function's output and the instance that ran it. */
2201
+ type AgentCallResponse = paths["/api/v1/agents/{id}/call"]["post"]["responses"][200]["content"]["application/json"];
2202
+ /** The ids `POST /api/v1/agents/{id}/test` answers with. */
2203
+ type AgentTestRunResponse = paths["/api/v1/agents/{id}/test"]["post"]["responses"][200]["content"]["application/json"];
2058
2204
  declare class AgentsApiService {
2059
2205
  private readonly apiClient;
2060
2206
  constructor(config?: Pick<InternalConfig, "langwatchApiClient">);
@@ -2079,6 +2225,18 @@ declare class AgentsApiService {
2079
2225
  id: string;
2080
2226
  name: string;
2081
2227
  }>;
2228
+ /**
2229
+ * Runs one turn of a connected agent through the relay: the platform
2230
+ * dispatches it to a live instance and answers with the function's output.
2231
+ */
2232
+ call(id: string, body: AgentCallBody): Promise<AgentCallResponse>;
2233
+ /**
2234
+ * Runs one scripted scenario against an agent: the user sends "ping", the
2235
+ * agent answers, and the run succeeds when the answer arrives. The project
2236
+ * gains no scenario, run plan or test suite, and the answer carries the run
2237
+ * ids to follow.
2238
+ */
2239
+ test(id: string): Promise<AgentTestRunResponse>;
2082
2240
  }
2083
2241
 
2084
2242
  type AnnotationResponse = components["schemas"]["Annotation"];
@@ -2154,6 +2312,57 @@ declare class AnalyticsApiService {
2154
2312
  timeseries(params: AnalyticsTimeseriesBody): Promise<AnalyticsTimeseriesResponse>;
2155
2313
  }
2156
2314
 
2315
+ /** The typed columns/rows/statistics payload `POST /api/v1/query` answers with. */
2316
+ type QueryRunResult = paths["/api/v1/query"]["post"]["responses"]["200"]["content"]["application/json"];
2317
+ /** The queryable dataset/column catalog `GET /api/v1/query/schema` answers with. */
2318
+ type QuerySchemaResult = paths["/api/v1/query/schema"]["get"]["responses"]["200"]["content"]["application/json"];
2319
+ /**
2320
+ * The body a query request sends.
2321
+ *
2322
+ * Derived from the generated request body so a contract change to what the
2323
+ * endpoint accepts breaks this at compile time rather than drifting silently.
2324
+ */
2325
+ type QueryRunParams = NonNullable<paths["/api/v1/query"]["post"]["requestBody"]>["content"]["application/json"];
2326
+ /**
2327
+ * Typed client for the LangWatchQL query doors (`POST /api/v1/query` and
2328
+ * `GET /api/v1/query/schema`) — the same governed query surface the workbench
2329
+ * and saved charts run through, exposed directly rather than only via a saved
2330
+ * chart's statement.
2331
+ *
2332
+ * Unlike the chart family, these routes carry no `projectId` in their path or
2333
+ * body — the generated operations declare `path?: never`. Project scope is
2334
+ * resolved once, when the underlying `LangwatchApiClient` is built
2335
+ * (`createLangWatchApiClient` bakes `scopedProjectId() ?? LANGWATCH_PROJECT_ID`
2336
+ * into that client's `Authorization`/`Basic` header at construction time —
2337
+ * see `src/internal/api/client.ts` and `src/internal/api/auth.ts`). A
2338
+ * per-call `projectId()` resolution the way `ChartsApiService` has one would
2339
+ * therefore be dead code here: there is no URL slot to put it in, and it
2340
+ * cannot retroactively change a header already baked into an existing
2341
+ * client. It would also wrongly force every caller to have a project in
2342
+ * scope — legacy `sk-lw-*` project keys carry their own project identity and
2343
+ * need none (see `buildAuthHeaders`). So this service takes the plain,
2344
+ * project-implicit config `AnalyticsApiService` does, and lets the api
2345
+ * client resolve the credential itself.
2346
+ */
2347
+ declare class QueryApiService {
2348
+ private readonly apiClient;
2349
+ constructor(config?: Pick<InternalConfig, "langwatchApiClient">);
2350
+ private handleApiError;
2351
+ /**
2352
+ * Runs one read-only LangWatchQL `SELECT` over the analytics datasets and
2353
+ * returns typed columns, rows, execution statistics, truncation state and
2354
+ * diagnostics, scoped to the caller's project.
2355
+ */
2356
+ query(params: QueryRunParams): Promise<QueryRunResult>;
2357
+ /**
2358
+ * Lists the LangWatchQL analytics datasets this key may query, with each
2359
+ * column's type, description, the permissions that unlock it, and whether
2360
+ * this caller holds them — plus each dataset's grain, join keys,
2361
+ * partition-pruning time column, freshness and a runnable example query.
2362
+ */
2363
+ schema(): Promise<QuerySchemaResult>;
2364
+ }
2365
+
2157
2366
  type TriggerResponse = NonNullable<paths["/api/triggers"]["get"]["responses"]["200"]["content"]["application/json"]>[number];
2158
2367
  type CreateTriggerBody = NonNullable<paths["/api/triggers"]["post"]["requestBody"]>["content"]["application/json"];
2159
2368
  type UpdateTriggerBody = NonNullable<paths["/api/triggers/{id}"]["patch"]["requestBody"]>["content"]["application/json"];
@@ -3654,13 +3863,20 @@ declare class LangWatch {
3654
3863
  readonly evaluations: EvaluationsFacade;
3655
3864
  readonly evaluators: EvaluatorsApiService;
3656
3865
  readonly scenarios: ScenariosApiService;
3866
+ /**
3867
+ * @deprecated Use runPlans and testSuites; /api/suites is a frozen alias.
3868
+ */
3657
3869
  readonly suites: SuitesApiService;
3870
+ readonly runPlans: RunPlansApiService;
3871
+ readonly testSuites: TestSuitesApiService;
3658
3872
  readonly workflows: WorkflowsApiService;
3659
3873
  readonly agents: AgentsApiService;
3660
3874
  readonly annotations: AnnotationsApiService;
3661
3875
  readonly dashboards: DashboardsApiService;
3662
3876
  readonly modelProviders: ModelProvidersApiService;
3663
3877
  readonly analytics: AnalyticsApiService;
3878
+ /** The raw LangWatchQL door — run a governed SELECT or discover the analytics schema directly, outside a saved chart. */
3879
+ readonly query: QueryApiService;
3664
3880
  readonly triggers: TriggersApiService;
3665
3881
  readonly graphs: GraphsApiService;
3666
3882
  readonly simulationRuns: SimulationRunsApiService;
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
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-BvwOB77X.js';
2
+ export { F as FilterableBatchSpanProcessor, L as LangWatchExporter, S as SpanProcessingExcludeRule, g as getLangWatchLogger, a as getLangWatchTracer } from './implementation-rpImK8WS.js';
3
3
  import { z } from 'zod';
4
- 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-jx13nj4M.js';
4
+ 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-Cr25FO-i.js';
5
5
  import openApiCreateClient from 'openapi-fetch';
6
6
  export { l as attributes } from './types-VOZv9LYO.js';
7
7
  import { CliHandledErrorReason, CliHandledError } from '@langwatch/langy/cards/handled-error';
@@ -1941,6 +1941,8 @@ type ScenarioResponse = NonNullable<paths["/api/scenarios"]["get"]["responses"][
1941
1941
  type CreateScenarioBody = NonNullable<paths["/api/scenarios"]["post"]["requestBody"]>["content"]["application/json"];
1942
1942
  type UpdateScenarioBody = NonNullable<paths["/api/scenarios/{id}"]["put"]["requestBody"]>["content"]["application/json"];
1943
1943
  type DeleteScenarioResponse = paths["/api/scenarios/{id}"]["delete"]["responses"]["200"]["content"]["application/json"];
1944
+ type ScenarioVersionListResponse = paths["/api/scenarios/{id}/versions"]["get"]["responses"]["200"]["content"]["application/json"];
1945
+ type ScenarioVersionDetail = paths["/api/scenarios/{id}/versions/{version}"]["get"]["responses"]["200"]["content"]["application/json"];
1944
1946
 
1945
1947
  declare class ScenariosApiService {
1946
1948
  private readonly apiClient;
@@ -1950,6 +1952,13 @@ declare class ScenariosApiService {
1950
1952
  get(id: string): Promise<ScenarioResponse>;
1951
1953
  create(params: CreateScenarioBody): Promise<ScenarioResponse>;
1952
1954
  update(id: string, params: UpdateScenarioBody): Promise<ScenarioResponse>;
1955
+ /** The saved versions of a scenario, newest first. */
1956
+ listVersions(id: string, options?: {
1957
+ limit?: number;
1958
+ cursor?: number;
1959
+ }): Promise<ScenarioVersionListResponse>;
1960
+ /** One saved version of a scenario, with the content it saved. */
1961
+ getVersion(id: string, version: number): Promise<ScenarioVersionDetail>;
1953
1962
  delete(id: string): Promise<DeleteScenarioResponse>;
1954
1963
  }
1955
1964
 
@@ -1974,12 +1983,25 @@ interface SuiteRunOptions {
1974
1983
  * that name.
1975
1984
  */
1976
1985
  parameters?: Record<string, string | number | boolean>;
1986
+ /**
1987
+ * One short line saying why this batch was run, e.g. a commit hash or what
1988
+ * changed. Every run of the batch carries it. Spaces around it are removed,
1989
+ * and a note of only spaces is sent as no note at all.
1990
+ */
1991
+ note?: string;
1977
1992
  }
1993
+ /** Which kind of suite `getAll` returns. Defaults to run plans. */
1994
+ type SuiteKind = "custom" | "folder";
1995
+ /**
1996
+ * @deprecated Use runPlans and testSuites; /api/suites is a frozen alias.
1997
+ */
1978
1998
  declare class SuitesApiService {
1979
1999
  private readonly apiClient;
1980
2000
  constructor(config?: Pick<InternalConfig, "langwatchApiClient">);
1981
2001
  private handleApiError;
1982
- getAll(): Promise<SuiteResponse[]>;
2002
+ getAll(options?: {
2003
+ kind?: SuiteKind;
2004
+ }): Promise<SuiteResponse[]>;
1983
2005
  get(id: string): Promise<SuiteResponse>;
1984
2006
  create(params: CreateSuiteBody): Promise<SuiteResponse>;
1985
2007
  update(id: string, params: UpdateSuiteBody): Promise<SuiteResponse>;
@@ -1996,6 +2018,93 @@ declare class SuitesApiService {
1996
2018
  }>;
1997
2019
  }
1998
2020
 
2021
+ /** One run plan, exactly as the REST surface answers it. */
2022
+ type RunPlan = paths["/api/v1/run-plans/{id}"]["get"]["responses"]["200"]["content"]["application/json"];
2023
+ /** The body `POST /api/v1/run-plans/run` takes. */
2024
+ type RunPlanRunBody = NonNullable<paths["/api/v1/run-plans/run"]["post"]["requestBody"]>["content"]["application/json"];
2025
+ /** What a scheduled run answers with. */
2026
+ type RunPlanRunResult = paths["/api/v1/run-plans/run"]["post"]["responses"]["200"]["content"]["application/json"];
2027
+ /** The body `POST /api/v1/run-plans/{id}/run` takes. */
2028
+ type RunPlanRerunBody = NonNullable<paths["/api/v1/run-plans/{id}/run"]["post"]["requestBody"]>["content"]["application/json"];
2029
+ /**
2030
+ * Typed client for the run plan family (`/api/v1/run-plans`).
2031
+ *
2032
+ * A run plan is identified by its NAME. Posting a configuration under a name
2033
+ * already in use replaces that plan's configuration and joins its history;
2034
+ * posting under a new name creates the plan; posting no name lets the platform
2035
+ * derive one from what the run covers and what it runs against.
2036
+ *
2037
+ * @see specs/typescript-sdk/run-plans-and-test-suites.feature
2038
+ */
2039
+ declare class RunPlansApiService {
2040
+ private readonly apiClient;
2041
+ constructor(config?: Pick<InternalConfig, "langwatchApiClient">);
2042
+ private handleApiError;
2043
+ /** The project's run plans. Archived plans are left out unless asked for. */
2044
+ list(options?: {
2045
+ includeArchived?: boolean;
2046
+ }): Promise<RunPlan[]>;
2047
+ get(id: string): Promise<RunPlan>;
2048
+ /**
2049
+ * Runs a configuration under a name.
2050
+ *
2051
+ * A note of only spaces is no note: sending an empty string would store a
2052
+ * value every reader then has to filter out.
2053
+ */
2054
+ run(body: RunPlanRunBody): Promise<RunPlanRunResult>;
2055
+ /** Runs a plan again with the configuration it already holds. */
2056
+ rerun(id: string, body?: RunPlanRerunBody): Promise<RunPlanRunResult>;
2057
+ archive(id: string): Promise<{
2058
+ id: string;
2059
+ archived: true;
2060
+ }>;
2061
+ }
2062
+
2063
+ /** One test suite as the list answers it: a name and the scenarios filed in it. */
2064
+ type TestSuite = NonNullable<paths["/api/v1/test-suites"]["get"]["responses"]["200"]["content"]["application/json"]>[number];
2065
+ /** One test suite read on its own, with its scenarios named. */
2066
+ type TestSuiteDetail = paths["/api/v1/test-suites/{id}"]["get"]["responses"]["200"]["content"]["application/json"];
2067
+ /** The body `POST /api/v1/test-suites` takes. */
2068
+ type CreateTestSuiteBody = NonNullable<paths["/api/v1/test-suites"]["post"]["requestBody"]>["content"]["application/json"];
2069
+ /** The body `PATCH /api/v1/test-suites/{id}` takes. */
2070
+ type RenameTestSuiteBody = NonNullable<paths["/api/v1/test-suites/{id}"]["patch"]["requestBody"]>["content"]["application/json"];
2071
+ /** The body `POST /api/v1/test-suites/{id}/run` takes. */
2072
+ type RunTestSuiteBody = NonNullable<paths["/api/v1/test-suites/{id}/run"]["post"]["requestBody"]>["content"]["application/json"];
2073
+ /** What a scheduled suite run answers with. It is a run plan run. */
2074
+ type TestSuiteRunResult = RunPlanRunResult;
2075
+ /**
2076
+ * Typed client for the test suite family (`/api/v1/test-suites`).
2077
+ *
2078
+ * A test suite is a group of scenarios: a name, and the scenarios filed in it.
2079
+ * It holds no targets and no configuration, so running one sends its targets with
2080
+ * the request and the platform files the run under a run plan.
2081
+ *
2082
+ * @see specs/typescript-sdk/run-plans-and-test-suites.feature
2083
+ */
2084
+ declare class TestSuitesApiService {
2085
+ private readonly apiClient;
2086
+ constructor(config?: Pick<InternalConfig, "langwatchApiClient">);
2087
+ private handleApiError;
2088
+ /** The project's test suites. Archived suites are left out unless asked for. */
2089
+ list(options?: {
2090
+ includeArchived?: boolean;
2091
+ }): Promise<TestSuite[]>;
2092
+ create(params: CreateTestSuiteBody): Promise<TestSuite>;
2093
+ get(id: string): Promise<TestSuiteDetail>;
2094
+ /** Renames a suite. The slug is kept, so links and run history stay put. */
2095
+ rename(id: string, params: RenameTestSuiteBody): Promise<TestSuite>;
2096
+ /** Archives a suite. The scenarios filed in it are archived with it. */
2097
+ archive(id: string): Promise<{
2098
+ id: string;
2099
+ archived: true;
2100
+ }>;
2101
+ /**
2102
+ * Runs every scenario filed in the suite against the targets sent with the
2103
+ * request. A note of only spaces is no note.
2104
+ */
2105
+ run(id: string, body: RunTestSuiteBody): Promise<TestSuiteRunResult>;
2106
+ }
2107
+
1999
2108
  type WorkflowResponse = NonNullable<paths["/api/workflows"]["get"]["responses"]["200"]["content"]["application/json"]>[number];
2000
2109
  type WorkflowDeleteResponse = paths["/api/workflows/{id}"]["delete"]["responses"]["200"]["content"]["application/json"];
2001
2110
  declare class WorkflowsApiService {
@@ -2037,6 +2146,23 @@ declare class WorkflowsApiService {
2037
2146
  }): Promise<ExperimentRunWithResults>;
2038
2147
  }
2039
2148
 
2149
+ /** One run parameter an agent declares, as the platform lists it. */
2150
+ interface AgentParameterSpec {
2151
+ name: string;
2152
+ type: "string" | "number" | "boolean";
2153
+ options?: string[];
2154
+ default?: string | number | boolean;
2155
+ description?: string;
2156
+ required?: boolean;
2157
+ secret?: boolean;
2158
+ }
2159
+ /** One process connected as an instance of a connected agent. */
2160
+ interface AgentInstance {
2161
+ id: string;
2162
+ hostname: string;
2163
+ label?: string | null;
2164
+ connectedAt: string;
2165
+ }
2040
2166
  interface AgentResponse {
2041
2167
  id: string;
2042
2168
  name: string;
@@ -2045,6 +2171,20 @@ interface AgentResponse {
2045
2171
  createdAt: string;
2046
2172
  updatedAt: string;
2047
2173
  platformUrl?: string;
2174
+ /** Connected agents: the environment the SDK registered under. */
2175
+ environment?: string | null;
2176
+ /** Connected agents: online while at least one instance is connected. */
2177
+ status?: "online" | "offline" | null;
2178
+ instances?: AgentInstance[];
2179
+ lastSeenAt?: string | null;
2180
+ /** The owner of a personal agent. */
2181
+ owner?: {
2182
+ userId: string;
2183
+ name: string;
2184
+ } | null;
2185
+ /** The machine a host-scoped development agent belongs to. */
2186
+ hostLabel?: string | null;
2187
+ parameters?: AgentParameterSpec[];
2048
2188
  }
2049
2189
  interface AgentListResponse {
2050
2190
  data: AgentResponse[];
@@ -2055,6 +2195,12 @@ interface AgentListResponse {
2055
2195
  totalPages: number;
2056
2196
  };
2057
2197
  }
2198
+ /** The body `POST /api/v1/agents/{id}/call` takes. */
2199
+ type AgentCallBody = NonNullable<paths["/api/v1/agents/{id}/call"]["post"]["requestBody"]>["content"]["application/json"];
2200
+ /** The reply of the relay: the function's output and the instance that ran it. */
2201
+ type AgentCallResponse = paths["/api/v1/agents/{id}/call"]["post"]["responses"][200]["content"]["application/json"];
2202
+ /** The ids `POST /api/v1/agents/{id}/test` answers with. */
2203
+ type AgentTestRunResponse = paths["/api/v1/agents/{id}/test"]["post"]["responses"][200]["content"]["application/json"];
2058
2204
  declare class AgentsApiService {
2059
2205
  private readonly apiClient;
2060
2206
  constructor(config?: Pick<InternalConfig, "langwatchApiClient">);
@@ -2079,6 +2225,18 @@ declare class AgentsApiService {
2079
2225
  id: string;
2080
2226
  name: string;
2081
2227
  }>;
2228
+ /**
2229
+ * Runs one turn of a connected agent through the relay: the platform
2230
+ * dispatches it to a live instance and answers with the function's output.
2231
+ */
2232
+ call(id: string, body: AgentCallBody): Promise<AgentCallResponse>;
2233
+ /**
2234
+ * Runs one scripted scenario against an agent: the user sends "ping", the
2235
+ * agent answers, and the run succeeds when the answer arrives. The project
2236
+ * gains no scenario, run plan or test suite, and the answer carries the run
2237
+ * ids to follow.
2238
+ */
2239
+ test(id: string): Promise<AgentTestRunResponse>;
2082
2240
  }
2083
2241
 
2084
2242
  type AnnotationResponse = components["schemas"]["Annotation"];
@@ -2154,6 +2312,57 @@ declare class AnalyticsApiService {
2154
2312
  timeseries(params: AnalyticsTimeseriesBody): Promise<AnalyticsTimeseriesResponse>;
2155
2313
  }
2156
2314
 
2315
+ /** The typed columns/rows/statistics payload `POST /api/v1/query` answers with. */
2316
+ type QueryRunResult = paths["/api/v1/query"]["post"]["responses"]["200"]["content"]["application/json"];
2317
+ /** The queryable dataset/column catalog `GET /api/v1/query/schema` answers with. */
2318
+ type QuerySchemaResult = paths["/api/v1/query/schema"]["get"]["responses"]["200"]["content"]["application/json"];
2319
+ /**
2320
+ * The body a query request sends.
2321
+ *
2322
+ * Derived from the generated request body so a contract change to what the
2323
+ * endpoint accepts breaks this at compile time rather than drifting silently.
2324
+ */
2325
+ type QueryRunParams = NonNullable<paths["/api/v1/query"]["post"]["requestBody"]>["content"]["application/json"];
2326
+ /**
2327
+ * Typed client for the LangWatchQL query doors (`POST /api/v1/query` and
2328
+ * `GET /api/v1/query/schema`) — the same governed query surface the workbench
2329
+ * and saved charts run through, exposed directly rather than only via a saved
2330
+ * chart's statement.
2331
+ *
2332
+ * Unlike the chart family, these routes carry no `projectId` in their path or
2333
+ * body — the generated operations declare `path?: never`. Project scope is
2334
+ * resolved once, when the underlying `LangwatchApiClient` is built
2335
+ * (`createLangWatchApiClient` bakes `scopedProjectId() ?? LANGWATCH_PROJECT_ID`
2336
+ * into that client's `Authorization`/`Basic` header at construction time —
2337
+ * see `src/internal/api/client.ts` and `src/internal/api/auth.ts`). A
2338
+ * per-call `projectId()` resolution the way `ChartsApiService` has one would
2339
+ * therefore be dead code here: there is no URL slot to put it in, and it
2340
+ * cannot retroactively change a header already baked into an existing
2341
+ * client. It would also wrongly force every caller to have a project in
2342
+ * scope — legacy `sk-lw-*` project keys carry their own project identity and
2343
+ * need none (see `buildAuthHeaders`). So this service takes the plain,
2344
+ * project-implicit config `AnalyticsApiService` does, and lets the api
2345
+ * client resolve the credential itself.
2346
+ */
2347
+ declare class QueryApiService {
2348
+ private readonly apiClient;
2349
+ constructor(config?: Pick<InternalConfig, "langwatchApiClient">);
2350
+ private handleApiError;
2351
+ /**
2352
+ * Runs one read-only LangWatchQL `SELECT` over the analytics datasets and
2353
+ * returns typed columns, rows, execution statistics, truncation state and
2354
+ * diagnostics, scoped to the caller's project.
2355
+ */
2356
+ query(params: QueryRunParams): Promise<QueryRunResult>;
2357
+ /**
2358
+ * Lists the LangWatchQL analytics datasets this key may query, with each
2359
+ * column's type, description, the permissions that unlock it, and whether
2360
+ * this caller holds them — plus each dataset's grain, join keys,
2361
+ * partition-pruning time column, freshness and a runnable example query.
2362
+ */
2363
+ schema(): Promise<QuerySchemaResult>;
2364
+ }
2365
+
2157
2366
  type TriggerResponse = NonNullable<paths["/api/triggers"]["get"]["responses"]["200"]["content"]["application/json"]>[number];
2158
2367
  type CreateTriggerBody = NonNullable<paths["/api/triggers"]["post"]["requestBody"]>["content"]["application/json"];
2159
2368
  type UpdateTriggerBody = NonNullable<paths["/api/triggers/{id}"]["patch"]["requestBody"]>["content"]["application/json"];
@@ -3654,13 +3863,20 @@ declare class LangWatch {
3654
3863
  readonly evaluations: EvaluationsFacade;
3655
3864
  readonly evaluators: EvaluatorsApiService;
3656
3865
  readonly scenarios: ScenariosApiService;
3866
+ /**
3867
+ * @deprecated Use runPlans and testSuites; /api/suites is a frozen alias.
3868
+ */
3657
3869
  readonly suites: SuitesApiService;
3870
+ readonly runPlans: RunPlansApiService;
3871
+ readonly testSuites: TestSuitesApiService;
3658
3872
  readonly workflows: WorkflowsApiService;
3659
3873
  readonly agents: AgentsApiService;
3660
3874
  readonly annotations: AnnotationsApiService;
3661
3875
  readonly dashboards: DashboardsApiService;
3662
3876
  readonly modelProviders: ModelProvidersApiService;
3663
3877
  readonly analytics: AnalyticsApiService;
3878
+ /** The raw LangWatchQL door — run a governed SELECT or discover the analytics schema directly, outside a saved chart. */
3879
+ readonly query: QueryApiService;
3664
3880
  readonly triggers: TriggersApiService;
3665
3881
  readonly graphs: GraphsApiService;
3666
3882
  readonly simulationRuns: SimulationRunsApiService;