langwatch 1.14.0 → 1.16.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 (34) hide show
  1. package/dist/agent/index.js +1 -1
  2. package/dist/agent/index.js.map +1 -1
  3. package/dist/agent/index.mjs +1 -1
  4. package/dist/agent/index.mjs.map +1 -1
  5. package/dist/{chunk-MGASIVXD.js → chunk-6SSJPQAW.js} +2 -2
  6. package/dist/chunk-6SSJPQAW.js.map +1 -0
  7. package/dist/{chunk-7FIG44IG.js → chunk-FUDF46YW.js} +12 -12
  8. package/dist/{chunk-7FIG44IG.js.map → chunk-FUDF46YW.js.map} +1 -1
  9. package/dist/{chunk-QKIDVFHZ.mjs → chunk-NZP72HTX.mjs} +2 -2
  10. package/dist/chunk-NZP72HTX.mjs.map +1 -0
  11. package/dist/{chunk-MCM4C66E.mjs → chunk-XC6AXWVR.mjs} +2 -2
  12. package/dist/cli/bundle.js +328 -294
  13. package/dist/{implementation-BXX0qdV7.d.mts → implementation-BvHTdJLg.d.mts} +1 -1
  14. package/dist/{implementation-Cv7sBdwj.d.ts → implementation-Dlxw5hlM.d.ts} +1 -1
  15. package/dist/index.d.mts +141 -28
  16. package/dist/index.d.ts +141 -28
  17. package/dist/index.js +229 -43
  18. package/dist/index.js.map +1 -1
  19. package/dist/index.mjs +198 -12
  20. package/dist/index.mjs.map +1 -1
  21. package/dist/observability-sdk/index.d.mts +3 -3
  22. package/dist/observability-sdk/index.d.ts +3 -3
  23. package/dist/observability-sdk/index.js +2 -2
  24. package/dist/observability-sdk/index.mjs +1 -1
  25. package/dist/observability-sdk/instrumentation/langchain/index.d.mts +1 -1
  26. package/dist/observability-sdk/instrumentation/langchain/index.d.ts +1 -1
  27. package/dist/observability-sdk/setup/node/index.js +3 -3
  28. package/dist/observability-sdk/setup/node/index.mjs +2 -2
  29. package/dist/{types-BejNp4Dw.d.ts → types-CzElA_6o.d.ts} +1439 -247
  30. package/dist/{types-DXNIJdZx.d.mts → types-Dd2d9hCy.d.mts} +1439 -247
  31. package/package.json +1 -3
  32. package/dist/chunk-MGASIVXD.js.map +0 -1
  33. package/dist/chunk-QKIDVFHZ.mjs.map +0 -1
  34. /package/dist/{chunk-MCM4C66E.mjs.map → chunk-XC6AXWVR.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-DXNIJdZx.mjs';
7
+ import { j as LangWatchTracer } from './types-Dd2d9hCy.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-BejNp4Dw.js';
7
+ import { j as LangWatchTracer } from './types-CzElA_6o.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-BXX0qdV7.mjs';
2
+ export { F as FilterableBatchSpanProcessor, L as LangWatchExporter, S as SpanProcessingExcludeRule, g as getLangWatchLogger, a as getLangWatchTracer } from './implementation-BvHTdJLg.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-DXNIJdZx.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-Dd2d9hCy.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';
@@ -2060,6 +2060,72 @@ declare class RunPlansApiService {
2060
2060
  }>;
2061
2061
  }
2062
2062
 
2063
+ /** One Instant Eval run, exactly as the REST surface answers it. */
2064
+ type InstantEvalRun = paths["/api/v1/instant-evals/{id}"]["get"]["responses"]["200"]["content"]["application/json"];
2065
+ /** The body that starts a run, and the same body that prices one. */
2066
+ type InstantEvalRunBody = NonNullable<paths["/api/v1/instant-evals"]["post"]["requestBody"]>["content"]["application/json"];
2067
+ /** What a run would read and what judging it would cost. */
2068
+ type InstantEvalEstimate = paths["/api/v1/instant-evals/estimate"]["post"]["responses"]["200"]["content"]["application/json"];
2069
+ /** One page of a run's judgements, and where the next one starts. */
2070
+ type InstantEvalResultsPage = paths["/api/v1/instant-evals/{id}/results"]["get"]["responses"]["200"]["content"]["application/json"];
2071
+ /** One judgement the run recorded. */
2072
+ type InstantEvalJudgment = InstantEvalResultsPage["judgments"][number];
2073
+ /** A few of a run's rows, with the judged text beside the verdict. */
2074
+ type InstantEvalSample = paths["/api/v1/instant-evals/{id}/sample"]["get"]["responses"]["200"]["content"]["application/json"];
2075
+ /**
2076
+ * Typed client for the Instant Evals family (`/api/v1/instant-evals`).
2077
+ *
2078
+ * A run judges one LangWatchQL statement across the project's history. The
2079
+ * statement is the same one the query door runs, so a working query is a
2080
+ * working run once it projects `TraceId` and at least one eval function
2081
+ * column. Starting one answers the queued run, and its progress is polled.
2082
+ *
2083
+ * The project comes from the credential, so no method takes a project id.
2084
+ *
2085
+ * @see specs/instant-evals/instant-eval-api.feature
2086
+ */
2087
+ declare class InstantEvalsApiService {
2088
+ private readonly apiClient;
2089
+ constructor(config?: Pick<InternalConfig, "langwatchApiClient">);
2090
+ private handleApiError;
2091
+ /**
2092
+ * The body of a successful answer. A failed response can arrive with no body
2093
+ * at all (a proxy answering 502 while the platform restarts), which leaves
2094
+ * `error` empty, so the response status decides and not the error alone.
2095
+ */
2096
+ private unwrap;
2097
+ /** Starts a run. The judging happens on the queue. */
2098
+ create(body: InstantEvalRunBody): Promise<InstantEvalRun>;
2099
+ /** Prices a run without starting it. Nothing is judged and nothing is charged. */
2100
+ estimate(body: InstantEvalRunBody): Promise<InstantEvalEstimate>;
2101
+ /** The project's runs, newest first. */
2102
+ list(options?: {
2103
+ limit?: number;
2104
+ before?: string;
2105
+ beforeId?: string;
2106
+ }): Promise<InstantEvalRun[]>;
2107
+ get(id: string): Promise<InstantEvalRun>;
2108
+ /** Asks a run to stop. It stops before its next page. */
2109
+ cancel(id: string): Promise<InstantEvalRun>;
2110
+ /**
2111
+ * One page of a run's judgements.
2112
+ *
2113
+ * Pass the `nextCursor` a page answers with to read the page after it. The
2114
+ * last page carries none.
2115
+ */
2116
+ results(id: string, options?: {
2117
+ questionId?: string;
2118
+ isMatched?: boolean;
2119
+ status?: InstantEvalJudgment["status"];
2120
+ limit?: number;
2121
+ cursor?: string;
2122
+ }): Promise<InstantEvalResultsPage>;
2123
+ /** A few of the run's rows, with the judged text beside the verdict. */
2124
+ sample(id: string, options?: {
2125
+ n?: number;
2126
+ }): Promise<InstantEvalSample>;
2127
+ }
2128
+
2063
2129
  /** One test suite as the list answers it: a name and the scenarios filed in it. */
2064
2130
  type TestSuite = NonNullable<paths["/api/v1/test-suites"]["get"]["responses"]["200"]["content"]["application/json"]>[number];
2065
2131
  /** One test suite read on its own, with its scenarios named. */
@@ -2335,6 +2401,15 @@ declare class AnalyticsApiService {
2335
2401
  type QueryRunResult = paths["/api/v1/query"]["post"]["responses"]["200"]["content"]["application/json"];
2336
2402
  /** The queryable dataset/column catalog `GET /api/v1/query/schema` answers with. */
2337
2403
  type QuerySchemaResult = paths["/api/v1/query/schema"]["get"]["responses"]["200"]["content"]["application/json"];
2404
+ /**
2405
+ * Both query languages, as `GET /api/v1/query/reference` describes them.
2406
+ *
2407
+ * A superset of {@link QuerySchemaResult} in one direction only: it embeds the
2408
+ * schema and adds the trace filter language, worked examples and the decision
2409
+ * table. Nothing here is tenant data — the values a field holds come from
2410
+ * `GET /api/traces/facets`.
2411
+ */
2412
+ type QueryReferenceResult = paths["/api/v1/query/reference"]["get"]["responses"]["200"]["content"]["application/json"];
2338
2413
  /**
2339
2414
  * The body a query request sends.
2340
2415
  *
@@ -2343,8 +2418,9 @@ type QuerySchemaResult = paths["/api/v1/query/schema"]["get"]["responses"]["200"
2343
2418
  */
2344
2419
  type QueryRunParams = NonNullable<paths["/api/v1/query"]["post"]["requestBody"]>["content"]["application/json"];
2345
2420
  /**
2346
- * Typed client for the LangWatchQL query doors (`POST /api/v1/query` and
2347
- * `GET /api/v1/query/schema`) — the same governed query surface the workbench
2421
+ * Typed client for the query doors (`POST /api/v1/query`,
2422
+ * `GET /api/v1/query/schema` and `GET /api/v1/query/reference`) — the same
2423
+ * governed query surface the workbench
2348
2424
  * and saved charts run through, exposed directly rather than only via a saved
2349
2425
  * chart's statement.
2350
2426
  *
@@ -2368,18 +2444,25 @@ declare class QueryApiService {
2368
2444
  constructor(config?: Pick<InternalConfig, "langwatchApiClient">);
2369
2445
  private handleApiError;
2370
2446
  /**
2371
- * Runs one read-only LangWatchQL `SELECT` over the analytics datasets and
2447
+ * Runs one read-only LangWatchQL `SELECT` over the analytics views and
2372
2448
  * returns typed columns, rows, execution statistics, truncation state and
2373
2449
  * diagnostics, scoped to the caller's project.
2374
2450
  */
2375
2451
  query(params: QueryRunParams): Promise<QueryRunResult>;
2376
2452
  /**
2377
- * Lists the LangWatchQL analytics datasets this key may query, with each
2453
+ * Lists the LangWatchQL analytics views this key may query, with each
2378
2454
  * column's type, description, the permissions that unlock it, and whether
2379
2455
  * this caller holds them — plus each dataset's grain, join keys,
2380
2456
  * partition-pruning time column, freshness and a runnable example query.
2381
2457
  */
2382
2458
  schema(): Promise<QuerySchemaResult>;
2459
+ /**
2460
+ * Describes both query languages in one payload: the LangWatchQL schema,
2461
+ * limits and endpoints, the trace filter's syntax and fields, worked examples
2462
+ * validated in both, and which language answers which kind of
2463
+ * question.
2464
+ */
2465
+ reference(): Promise<QueryReferenceResult>;
2383
2466
  }
2384
2467
 
2385
2468
  type TriggerResponse = NonNullable<paths["/api/triggers"]["get"]["responses"]["200"]["content"]["application/json"]>[number];
@@ -2668,6 +2751,13 @@ interface CreateVirtualKeyInput {
2668
2751
  * `{}` clears it.
2669
2752
  */
2670
2753
  metadata?: Record<string, string>;
2754
+ /**
2755
+ * Withhold the secret from the response and get a one-time reveal id
2756
+ * instead. The secret is parked for 24 hours and served once, to the
2757
+ * person the key is for, through the LangWatch app; the caller never
2758
+ * holds it.
2759
+ */
2760
+ reveal_once?: boolean;
2671
2761
  }
2672
2762
  interface UpdateVirtualKeyInput {
2673
2763
  name?: string;
@@ -2702,6 +2792,13 @@ interface VirtualKeyWithSecret {
2702
2792
  virtual_key: VirtualKey;
2703
2793
  secret: string;
2704
2794
  }
2795
+ /** What a create with `reveal_once` answers: the id that reads the secret once. */
2796
+ interface VirtualKeyWithReveal {
2797
+ virtual_key: VirtualKey;
2798
+ reveal_id: string;
2799
+ /** The display prefix, safe to show in place of the secret. */
2800
+ preview: string;
2801
+ }
2705
2802
  /** One page of the virtual-key listing, exactly as the wire serves it. */
2706
2803
  interface VirtualKeyPage {
2707
2804
  data: VirtualKey[];
@@ -2799,8 +2896,12 @@ declare class VirtualKeysApiService {
2799
2896
  /**
2800
2897
  * Mint a key. The response carries the secret ONCE; nothing ever serves it
2801
2898
  * again, so a create that times out is recovered with `idempotencyKey`
2802
- * rather than by listing.
2899
+ * rather than by listing. With `reveal_once` the response carries a reveal
2900
+ * id in place of the secret.
2803
2901
  */
2902
+ create(input: CreateVirtualKeyInput & {
2903
+ reveal_once: true;
2904
+ }, options?: IdempotentCreateOptions): Promise<VirtualKeyWithReveal>;
2804
2905
  create(input: CreateVirtualKeyInput, options?: IdempotentCreateOptions): Promise<VirtualKeyWithSecret>;
2805
2906
  update(id: string, input: UpdateVirtualKeyInput, options?: MutationOptions): Promise<VirtualKey>;
2806
2907
  rotate(id: string, options?: MutationOptions): Promise<VirtualKeyWithSecret>;
@@ -3051,6 +3152,28 @@ declare class GatewayBudgetsApiService {
3051
3152
  } & MutationOptions): Promise<GatewayBudget>;
3052
3153
  }
3053
3154
 
3155
+ /**
3156
+ * The quantities one priced request or rollup carries. Every field is always
3157
+ * present; a bucket the request never used reports 0.
3158
+ *
3159
+ * The token buckets are disjoint, not nested. An image generation reports its
3160
+ * render under `output_image_tokens` with `output_tokens` at 0, so reading
3161
+ * `output_tokens` alone sees none of the image traffic.
3162
+ *
3163
+ * Every priced quantity is charged once at its own rate. `reasoning_tokens`
3164
+ * is a subset of `output_tokens` and `image_count` is a count of images, so
3165
+ * no rate prices either and neither belongs in a cost sum.
3166
+ */
3167
+ interface SpendUsage {
3168
+ input_tokens: number;
3169
+ output_tokens: number;
3170
+ cache_read_input_tokens: number;
3171
+ cache_creation_input_tokens: number;
3172
+ reasoning_tokens: number;
3173
+ input_image_tokens: number;
3174
+ output_image_tokens: number;
3175
+ image_count: number;
3176
+ }
3054
3177
  interface SpendEvent {
3055
3178
  id: string;
3056
3179
  type: string;
@@ -3078,13 +3201,7 @@ interface SpendEvent {
3078
3201
  model_provider_id: string | null;
3079
3202
  request_type: string | null;
3080
3203
  /** Null on settled events: unknown is not zero. */
3081
- usage: {
3082
- input_tokens: number;
3083
- output_tokens: number;
3084
- cache_read_input_tokens: number;
3085
- cache_creation_input_tokens: number;
3086
- reasoning_tokens: number;
3087
- } | null;
3204
+ usage: SpendUsage | null;
3088
3205
  /** Null on settled events: unknown is not zero. */
3089
3206
  cost: {
3090
3207
  total_usd: string;
@@ -3119,13 +3236,7 @@ interface SpendSummaryRow {
3119
3236
  event_count: number;
3120
3237
  /** Unpriced settled requests, counted separately: never in cost sums. */
3121
3238
  settled_count: number;
3122
- usage: {
3123
- input_tokens: number;
3124
- output_tokens: number;
3125
- cache_read_input_tokens: number;
3126
- cache_creation_input_tokens: number;
3127
- reasoning_tokens: number;
3128
- };
3239
+ usage: SpendUsage;
3129
3240
  cost: {
3130
3241
  total_usd: string;
3131
3242
  nano_usd: number;
@@ -3239,13 +3350,7 @@ interface EndUserSpend {
3239
3350
  nano_usd?: number;
3240
3351
  };
3241
3352
  request_count: number;
3242
- usage: {
3243
- input_tokens: number;
3244
- output_tokens: number;
3245
- cache_read_input_tokens: number;
3246
- cache_creation_input_tokens: number;
3247
- reasoning_tokens: number;
3248
- };
3353
+ usage: SpendUsage;
3249
3354
  /**
3250
3355
  * The attributed-user template caps that apply to this end user, each
3251
3356
  * with its boundary-aware current-period spend. Empty when the
@@ -3818,6 +3923,12 @@ declare class ProjectsApiService {
3818
3923
  limit?: number;
3819
3924
  }): Promise<PaginatedProjects>;
3820
3925
  get(id: string): Promise<Project>;
3926
+ /**
3927
+ * The project's ingest key. The platform hands it out only to a credential
3928
+ * with `project:update` on the project, so a 403 here is the answer "this
3929
+ * login may not", not a transport failure.
3930
+ */
3931
+ getApiKey(id: string): Promise<string>;
3821
3932
  create(input: CreateProjectInput): Promise<ProjectWithServiceKey>;
3822
3933
  update(id: string, input: UpdateProjectInput): Promise<Project>;
3823
3934
  archive(id: string): Promise<ArchivedProject>;
@@ -3887,6 +3998,8 @@ declare class LangWatch {
3887
3998
  */
3888
3999
  readonly suites: SuitesApiService;
3889
4000
  readonly runPlans: RunPlansApiService;
4001
+ /** Judge one LangWatchQL statement across the project's history as a job. */
4002
+ readonly instantEvals: InstantEvalsApiService;
3890
4003
  readonly testSuites: TestSuitesApiService;
3891
4004
  readonly workflows: WorkflowsApiService;
3892
4005
  readonly agents: AgentsApiService;
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-Cv7sBdwj.js';
2
+ export { F as FilterableBatchSpanProcessor, L as LangWatchExporter, S as SpanProcessingExcludeRule, g as getLangWatchLogger, a as getLangWatchTracer } from './implementation-Dlxw5hlM.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-BejNp4Dw.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-CzElA_6o.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';
@@ -2060,6 +2060,72 @@ declare class RunPlansApiService {
2060
2060
  }>;
2061
2061
  }
2062
2062
 
2063
+ /** One Instant Eval run, exactly as the REST surface answers it. */
2064
+ type InstantEvalRun = paths["/api/v1/instant-evals/{id}"]["get"]["responses"]["200"]["content"]["application/json"];
2065
+ /** The body that starts a run, and the same body that prices one. */
2066
+ type InstantEvalRunBody = NonNullable<paths["/api/v1/instant-evals"]["post"]["requestBody"]>["content"]["application/json"];
2067
+ /** What a run would read and what judging it would cost. */
2068
+ type InstantEvalEstimate = paths["/api/v1/instant-evals/estimate"]["post"]["responses"]["200"]["content"]["application/json"];
2069
+ /** One page of a run's judgements, and where the next one starts. */
2070
+ type InstantEvalResultsPage = paths["/api/v1/instant-evals/{id}/results"]["get"]["responses"]["200"]["content"]["application/json"];
2071
+ /** One judgement the run recorded. */
2072
+ type InstantEvalJudgment = InstantEvalResultsPage["judgments"][number];
2073
+ /** A few of a run's rows, with the judged text beside the verdict. */
2074
+ type InstantEvalSample = paths["/api/v1/instant-evals/{id}/sample"]["get"]["responses"]["200"]["content"]["application/json"];
2075
+ /**
2076
+ * Typed client for the Instant Evals family (`/api/v1/instant-evals`).
2077
+ *
2078
+ * A run judges one LangWatchQL statement across the project's history. The
2079
+ * statement is the same one the query door runs, so a working query is a
2080
+ * working run once it projects `TraceId` and at least one eval function
2081
+ * column. Starting one answers the queued run, and its progress is polled.
2082
+ *
2083
+ * The project comes from the credential, so no method takes a project id.
2084
+ *
2085
+ * @see specs/instant-evals/instant-eval-api.feature
2086
+ */
2087
+ declare class InstantEvalsApiService {
2088
+ private readonly apiClient;
2089
+ constructor(config?: Pick<InternalConfig, "langwatchApiClient">);
2090
+ private handleApiError;
2091
+ /**
2092
+ * The body of a successful answer. A failed response can arrive with no body
2093
+ * at all (a proxy answering 502 while the platform restarts), which leaves
2094
+ * `error` empty, so the response status decides and not the error alone.
2095
+ */
2096
+ private unwrap;
2097
+ /** Starts a run. The judging happens on the queue. */
2098
+ create(body: InstantEvalRunBody): Promise<InstantEvalRun>;
2099
+ /** Prices a run without starting it. Nothing is judged and nothing is charged. */
2100
+ estimate(body: InstantEvalRunBody): Promise<InstantEvalEstimate>;
2101
+ /** The project's runs, newest first. */
2102
+ list(options?: {
2103
+ limit?: number;
2104
+ before?: string;
2105
+ beforeId?: string;
2106
+ }): Promise<InstantEvalRun[]>;
2107
+ get(id: string): Promise<InstantEvalRun>;
2108
+ /** Asks a run to stop. It stops before its next page. */
2109
+ cancel(id: string): Promise<InstantEvalRun>;
2110
+ /**
2111
+ * One page of a run's judgements.
2112
+ *
2113
+ * Pass the `nextCursor` a page answers with to read the page after it. The
2114
+ * last page carries none.
2115
+ */
2116
+ results(id: string, options?: {
2117
+ questionId?: string;
2118
+ isMatched?: boolean;
2119
+ status?: InstantEvalJudgment["status"];
2120
+ limit?: number;
2121
+ cursor?: string;
2122
+ }): Promise<InstantEvalResultsPage>;
2123
+ /** A few of the run's rows, with the judged text beside the verdict. */
2124
+ sample(id: string, options?: {
2125
+ n?: number;
2126
+ }): Promise<InstantEvalSample>;
2127
+ }
2128
+
2063
2129
  /** One test suite as the list answers it: a name and the scenarios filed in it. */
2064
2130
  type TestSuite = NonNullable<paths["/api/v1/test-suites"]["get"]["responses"]["200"]["content"]["application/json"]>[number];
2065
2131
  /** One test suite read on its own, with its scenarios named. */
@@ -2335,6 +2401,15 @@ declare class AnalyticsApiService {
2335
2401
  type QueryRunResult = paths["/api/v1/query"]["post"]["responses"]["200"]["content"]["application/json"];
2336
2402
  /** The queryable dataset/column catalog `GET /api/v1/query/schema` answers with. */
2337
2403
  type QuerySchemaResult = paths["/api/v1/query/schema"]["get"]["responses"]["200"]["content"]["application/json"];
2404
+ /**
2405
+ * Both query languages, as `GET /api/v1/query/reference` describes them.
2406
+ *
2407
+ * A superset of {@link QuerySchemaResult} in one direction only: it embeds the
2408
+ * schema and adds the trace filter language, worked examples and the decision
2409
+ * table. Nothing here is tenant data — the values a field holds come from
2410
+ * `GET /api/traces/facets`.
2411
+ */
2412
+ type QueryReferenceResult = paths["/api/v1/query/reference"]["get"]["responses"]["200"]["content"]["application/json"];
2338
2413
  /**
2339
2414
  * The body a query request sends.
2340
2415
  *
@@ -2343,8 +2418,9 @@ type QuerySchemaResult = paths["/api/v1/query/schema"]["get"]["responses"]["200"
2343
2418
  */
2344
2419
  type QueryRunParams = NonNullable<paths["/api/v1/query"]["post"]["requestBody"]>["content"]["application/json"];
2345
2420
  /**
2346
- * Typed client for the LangWatchQL query doors (`POST /api/v1/query` and
2347
- * `GET /api/v1/query/schema`) — the same governed query surface the workbench
2421
+ * Typed client for the query doors (`POST /api/v1/query`,
2422
+ * `GET /api/v1/query/schema` and `GET /api/v1/query/reference`) — the same
2423
+ * governed query surface the workbench
2348
2424
  * and saved charts run through, exposed directly rather than only via a saved
2349
2425
  * chart's statement.
2350
2426
  *
@@ -2368,18 +2444,25 @@ declare class QueryApiService {
2368
2444
  constructor(config?: Pick<InternalConfig, "langwatchApiClient">);
2369
2445
  private handleApiError;
2370
2446
  /**
2371
- * Runs one read-only LangWatchQL `SELECT` over the analytics datasets and
2447
+ * Runs one read-only LangWatchQL `SELECT` over the analytics views and
2372
2448
  * returns typed columns, rows, execution statistics, truncation state and
2373
2449
  * diagnostics, scoped to the caller's project.
2374
2450
  */
2375
2451
  query(params: QueryRunParams): Promise<QueryRunResult>;
2376
2452
  /**
2377
- * Lists the LangWatchQL analytics datasets this key may query, with each
2453
+ * Lists the LangWatchQL analytics views this key may query, with each
2378
2454
  * column's type, description, the permissions that unlock it, and whether
2379
2455
  * this caller holds them — plus each dataset's grain, join keys,
2380
2456
  * partition-pruning time column, freshness and a runnable example query.
2381
2457
  */
2382
2458
  schema(): Promise<QuerySchemaResult>;
2459
+ /**
2460
+ * Describes both query languages in one payload: the LangWatchQL schema,
2461
+ * limits and endpoints, the trace filter's syntax and fields, worked examples
2462
+ * validated in both, and which language answers which kind of
2463
+ * question.
2464
+ */
2465
+ reference(): Promise<QueryReferenceResult>;
2383
2466
  }
2384
2467
 
2385
2468
  type TriggerResponse = NonNullable<paths["/api/triggers"]["get"]["responses"]["200"]["content"]["application/json"]>[number];
@@ -2668,6 +2751,13 @@ interface CreateVirtualKeyInput {
2668
2751
  * `{}` clears it.
2669
2752
  */
2670
2753
  metadata?: Record<string, string>;
2754
+ /**
2755
+ * Withhold the secret from the response and get a one-time reveal id
2756
+ * instead. The secret is parked for 24 hours and served once, to the
2757
+ * person the key is for, through the LangWatch app; the caller never
2758
+ * holds it.
2759
+ */
2760
+ reveal_once?: boolean;
2671
2761
  }
2672
2762
  interface UpdateVirtualKeyInput {
2673
2763
  name?: string;
@@ -2702,6 +2792,13 @@ interface VirtualKeyWithSecret {
2702
2792
  virtual_key: VirtualKey;
2703
2793
  secret: string;
2704
2794
  }
2795
+ /** What a create with `reveal_once` answers: the id that reads the secret once. */
2796
+ interface VirtualKeyWithReveal {
2797
+ virtual_key: VirtualKey;
2798
+ reveal_id: string;
2799
+ /** The display prefix, safe to show in place of the secret. */
2800
+ preview: string;
2801
+ }
2705
2802
  /** One page of the virtual-key listing, exactly as the wire serves it. */
2706
2803
  interface VirtualKeyPage {
2707
2804
  data: VirtualKey[];
@@ -2799,8 +2896,12 @@ declare class VirtualKeysApiService {
2799
2896
  /**
2800
2897
  * Mint a key. The response carries the secret ONCE; nothing ever serves it
2801
2898
  * again, so a create that times out is recovered with `idempotencyKey`
2802
- * rather than by listing.
2899
+ * rather than by listing. With `reveal_once` the response carries a reveal
2900
+ * id in place of the secret.
2803
2901
  */
2902
+ create(input: CreateVirtualKeyInput & {
2903
+ reveal_once: true;
2904
+ }, options?: IdempotentCreateOptions): Promise<VirtualKeyWithReveal>;
2804
2905
  create(input: CreateVirtualKeyInput, options?: IdempotentCreateOptions): Promise<VirtualKeyWithSecret>;
2805
2906
  update(id: string, input: UpdateVirtualKeyInput, options?: MutationOptions): Promise<VirtualKey>;
2806
2907
  rotate(id: string, options?: MutationOptions): Promise<VirtualKeyWithSecret>;
@@ -3051,6 +3152,28 @@ declare class GatewayBudgetsApiService {
3051
3152
  } & MutationOptions): Promise<GatewayBudget>;
3052
3153
  }
3053
3154
 
3155
+ /**
3156
+ * The quantities one priced request or rollup carries. Every field is always
3157
+ * present; a bucket the request never used reports 0.
3158
+ *
3159
+ * The token buckets are disjoint, not nested. An image generation reports its
3160
+ * render under `output_image_tokens` with `output_tokens` at 0, so reading
3161
+ * `output_tokens` alone sees none of the image traffic.
3162
+ *
3163
+ * Every priced quantity is charged once at its own rate. `reasoning_tokens`
3164
+ * is a subset of `output_tokens` and `image_count` is a count of images, so
3165
+ * no rate prices either and neither belongs in a cost sum.
3166
+ */
3167
+ interface SpendUsage {
3168
+ input_tokens: number;
3169
+ output_tokens: number;
3170
+ cache_read_input_tokens: number;
3171
+ cache_creation_input_tokens: number;
3172
+ reasoning_tokens: number;
3173
+ input_image_tokens: number;
3174
+ output_image_tokens: number;
3175
+ image_count: number;
3176
+ }
3054
3177
  interface SpendEvent {
3055
3178
  id: string;
3056
3179
  type: string;
@@ -3078,13 +3201,7 @@ interface SpendEvent {
3078
3201
  model_provider_id: string | null;
3079
3202
  request_type: string | null;
3080
3203
  /** Null on settled events: unknown is not zero. */
3081
- usage: {
3082
- input_tokens: number;
3083
- output_tokens: number;
3084
- cache_read_input_tokens: number;
3085
- cache_creation_input_tokens: number;
3086
- reasoning_tokens: number;
3087
- } | null;
3204
+ usage: SpendUsage | null;
3088
3205
  /** Null on settled events: unknown is not zero. */
3089
3206
  cost: {
3090
3207
  total_usd: string;
@@ -3119,13 +3236,7 @@ interface SpendSummaryRow {
3119
3236
  event_count: number;
3120
3237
  /** Unpriced settled requests, counted separately: never in cost sums. */
3121
3238
  settled_count: number;
3122
- usage: {
3123
- input_tokens: number;
3124
- output_tokens: number;
3125
- cache_read_input_tokens: number;
3126
- cache_creation_input_tokens: number;
3127
- reasoning_tokens: number;
3128
- };
3239
+ usage: SpendUsage;
3129
3240
  cost: {
3130
3241
  total_usd: string;
3131
3242
  nano_usd: number;
@@ -3239,13 +3350,7 @@ interface EndUserSpend {
3239
3350
  nano_usd?: number;
3240
3351
  };
3241
3352
  request_count: number;
3242
- usage: {
3243
- input_tokens: number;
3244
- output_tokens: number;
3245
- cache_read_input_tokens: number;
3246
- cache_creation_input_tokens: number;
3247
- reasoning_tokens: number;
3248
- };
3353
+ usage: SpendUsage;
3249
3354
  /**
3250
3355
  * The attributed-user template caps that apply to this end user, each
3251
3356
  * with its boundary-aware current-period spend. Empty when the
@@ -3818,6 +3923,12 @@ declare class ProjectsApiService {
3818
3923
  limit?: number;
3819
3924
  }): Promise<PaginatedProjects>;
3820
3925
  get(id: string): Promise<Project>;
3926
+ /**
3927
+ * The project's ingest key. The platform hands it out only to a credential
3928
+ * with `project:update` on the project, so a 403 here is the answer "this
3929
+ * login may not", not a transport failure.
3930
+ */
3931
+ getApiKey(id: string): Promise<string>;
3821
3932
  create(input: CreateProjectInput): Promise<ProjectWithServiceKey>;
3822
3933
  update(id: string, input: UpdateProjectInput): Promise<Project>;
3823
3934
  archive(id: string): Promise<ArchivedProject>;
@@ -3887,6 +3998,8 @@ declare class LangWatch {
3887
3998
  */
3888
3999
  readonly suites: SuitesApiService;
3889
4000
  readonly runPlans: RunPlansApiService;
4001
+ /** Judge one LangWatchQL statement across the project's history as a job. */
4002
+ readonly instantEvals: InstantEvalsApiService;
3890
4003
  readonly testSuites: TestSuitesApiService;
3891
4004
  readonly workflows: WorkflowsApiService;
3892
4005
  readonly agents: AgentsApiService;