langwatch 1.0.0 → 1.1.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.
- package/dist/{chunk-5Q2DUSMQ.mjs → chunk-5AGWTUI2.mjs} +2 -2
- package/dist/{chunk-5Q2DUSMQ.mjs.map → chunk-5AGWTUI2.mjs.map} +1 -1
- package/dist/{chunk-ALPIFEXL.mjs → chunk-EW233MAD.mjs} +2 -2
- package/dist/{chunk-C323F5VC.mjs → chunk-PYODMDPV.mjs} +1 -1
- package/dist/chunk-PYODMDPV.mjs.map +1 -0
- package/dist/{chunk-WHBCX64R.js → chunk-R7NIGAEB.js} +2 -2
- package/dist/{chunk-WHBCX64R.js.map → chunk-R7NIGAEB.js.map} +1 -1
- package/dist/{chunk-ADJOFPAZ.js → chunk-SCLFEMNK.js} +1 -1
- package/dist/chunk-SCLFEMNK.js.map +1 -0
- package/dist/{chunk-52VMSJ4O.js → chunk-Z7RP3LP5.js} +12 -12
- package/dist/{chunk-52VMSJ4O.js.map → chunk-Z7RP3LP5.js.map} +1 -1
- package/dist/cli/bundle.js +165 -148
- package/dist/{implementation-CPfDot-W.d.mts → implementation-DmWrukzX.d.mts} +1 -1
- package/dist/{implementation-aYHmyVZ_.d.ts → implementation-Psro9xt4.d.ts} +1 -1
- package/dist/index.d.mts +225 -3
- package/dist/index.d.ts +225 -3
- package/dist/index.js +244 -35
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +225 -16
- package/dist/index.mjs.map +1 -1
- package/dist/observability-sdk/index.d.mts +3 -3
- package/dist/observability-sdk/index.d.ts +3 -3
- package/dist/observability-sdk/index.js +3 -3
- package/dist/observability-sdk/index.mjs +2 -2
- package/dist/observability-sdk/instrumentation/langchain/index.d.mts +1 -1
- package/dist/observability-sdk/instrumentation/langchain/index.d.ts +1 -1
- package/dist/observability-sdk/instrumentation/langchain/index.js +3 -3
- package/dist/observability-sdk/instrumentation/langchain/index.mjs +1 -1
- package/dist/observability-sdk/setup/node/index.js +3 -3
- package/dist/observability-sdk/setup/node/index.mjs +2 -2
- package/dist/{types-Cw-3VUv7.d.mts → types-Ck1U3XCH.d.mts} +6060 -5780
- package/dist/{types-CeZ-M8JZ.d.ts → types-DGBGlP9B.d.ts} +6060 -5780
- package/package.json +1 -1
- package/dist/chunk-ADJOFPAZ.js.map +0 -1
- package/dist/chunk-C323F5VC.mjs.map +0 -1
- /package/dist/{chunk-ALPIFEXL.mjs.map → chunk-EW233MAD.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-
|
|
7
|
+
import { j as LangWatchTracer } from './types-Ck1U3XCH.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-
|
|
7
|
+
import { j as LangWatchTracer } from './types-DGBGlP9B.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-
|
|
2
|
+
export { F as FilterableBatchSpanProcessor, L as LangWatchExporter, S as SpanProcessingExcludeRule, g as getLangWatchLogger, a as getLangWatchTracer } from './implementation-DmWrukzX.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-
|
|
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-Ck1U3XCH.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';
|
|
@@ -2236,9 +2236,231 @@ declare class LangWatchApiError extends Error {
|
|
|
2236
2236
|
safeParseBody(response: Response): Promise<void>;
|
|
2237
2237
|
}
|
|
2238
2238
|
|
|
2239
|
+
type VirtualKeyScopeType = "ORGANIZATION" | "TEAM" | "PROJECT";
|
|
2240
|
+
interface VirtualKeyScope {
|
|
2241
|
+
scope_type: VirtualKeyScopeType;
|
|
2242
|
+
scope_id: string;
|
|
2243
|
+
}
|
|
2244
|
+
type VirtualKeyRoutingMode = "NONE" | "FALLBACK_ALL" | "POLICY";
|
|
2245
|
+
/**
|
|
2246
|
+
* The snake DTO the server returns (`toVirtualKeySnakeDto`). The token
|
|
2247
|
+
* format is `vk-lw-<ulid>` with no live/test discriminator; the gateway
|
|
2248
|
+
* never branches on environment, so there is no env field.
|
|
2249
|
+
*/
|
|
2250
|
+
interface VirtualKey {
|
|
2251
|
+
id: string;
|
|
2252
|
+
organization_id: string;
|
|
2253
|
+
name: string;
|
|
2254
|
+
description: string | null;
|
|
2255
|
+
status: "active" | "revoked";
|
|
2256
|
+
/** "langy" marks a product-managed key; customers can only mint "user". */
|
|
2257
|
+
purpose: "user" | "langy";
|
|
2258
|
+
/** e.g. "vk-lw-01HZX9" — the only secret material kept after creation. */
|
|
2259
|
+
display_prefix: string;
|
|
2260
|
+
principal_user_id: string | null;
|
|
2261
|
+
/**
|
|
2262
|
+
* Where an org- or team-owned key's traces and costs land. Not a
|
|
2263
|
+
* scope: it grants no access to the key.
|
|
2264
|
+
*/
|
|
2265
|
+
trace_project_id: string | null;
|
|
2266
|
+
scopes: VirtualKeyScope[];
|
|
2267
|
+
routing_policy_id: string | null;
|
|
2268
|
+
routing_mode: VirtualKeyRoutingMode;
|
|
2269
|
+
config: Record<string, unknown>;
|
|
2270
|
+
revision: string;
|
|
2271
|
+
created_at: string;
|
|
2272
|
+
updated_at: string;
|
|
2273
|
+
last_used_at: string | null;
|
|
2274
|
+
revoked_at: string | null;
|
|
2275
|
+
}
|
|
2276
|
+
/**
|
|
2277
|
+
* The cap a key carries on itself, created atomically with the key. Only
|
|
2278
|
+
* the calendar windows a person reasons about; string amounts survive
|
|
2279
|
+
* JSON round-trips without float drift (numbers are stringified).
|
|
2280
|
+
*/
|
|
2281
|
+
interface VirtualKeyBudgetInput {
|
|
2282
|
+
limit_usd: string | number;
|
|
2283
|
+
window: "DAY" | "WEEK" | "MONTH";
|
|
2284
|
+
on_breach?: "BLOCK" | "WARN";
|
|
2285
|
+
name?: string;
|
|
2286
|
+
}
|
|
2287
|
+
interface CreateVirtualKeyInput {
|
|
2288
|
+
name: string;
|
|
2289
|
+
description?: string;
|
|
2290
|
+
principal_user_id?: string | null;
|
|
2291
|
+
/** Defaults to the caller's project when omitted. */
|
|
2292
|
+
scopes?: VirtualKeyScope[];
|
|
2293
|
+
/**
|
|
2294
|
+
* Explicit trace destination for org- and team-owned keys; requires
|
|
2295
|
+
* `virtualKeys:manage` on that project. NOT a scope.
|
|
2296
|
+
*/
|
|
2297
|
+
trace_project_id?: string | null;
|
|
2298
|
+
routing_policy_id?: string | null;
|
|
2299
|
+
routing_mode?: VirtualKeyRoutingMode;
|
|
2300
|
+
/** Optional cap created atomically with the key. */
|
|
2301
|
+
budget?: VirtualKeyBudgetInput | null;
|
|
2302
|
+
config?: Record<string, unknown>;
|
|
2303
|
+
}
|
|
2304
|
+
interface UpdateVirtualKeyInput {
|
|
2305
|
+
name?: string;
|
|
2306
|
+
description?: string | null;
|
|
2307
|
+
scopes?: VirtualKeyScope[];
|
|
2308
|
+
trace_project_id?: string | null;
|
|
2309
|
+
routing_policy_id?: string | null;
|
|
2310
|
+
routing_mode?: VirtualKeyRoutingMode;
|
|
2311
|
+
/** Undefined leaves the cap alone; a value upserts it; null archives it. */
|
|
2312
|
+
budget?: VirtualKeyBudgetInput | null;
|
|
2313
|
+
config?: Record<string, unknown>;
|
|
2314
|
+
}
|
|
2315
|
+
interface VirtualKeyWithSecret {
|
|
2316
|
+
virtual_key: VirtualKey;
|
|
2317
|
+
secret: string;
|
|
2318
|
+
}
|
|
2319
|
+
/** Aggregate spend for one key over a window, from the cost path. */
|
|
2320
|
+
interface VirtualKeySpendSummary {
|
|
2321
|
+
virtual_key_id: string;
|
|
2322
|
+
spent_usd: string;
|
|
2323
|
+
requests: number;
|
|
2324
|
+
window: {
|
|
2325
|
+
from: string;
|
|
2326
|
+
to: string;
|
|
2327
|
+
};
|
|
2328
|
+
}
|
|
2329
|
+
declare class VirtualKeysApiError extends Error {
|
|
2330
|
+
readonly operation: string;
|
|
2331
|
+
readonly originalError?: unknown | undefined;
|
|
2332
|
+
constructor(message: string, operation: string, originalError?: unknown | undefined);
|
|
2333
|
+
}
|
|
2334
|
+
declare class VirtualKeysApiService {
|
|
2335
|
+
private readonly endpoint;
|
|
2336
|
+
private readonly apiKey;
|
|
2337
|
+
constructor(config?: {
|
|
2338
|
+
endpoint?: string;
|
|
2339
|
+
apiKey?: string;
|
|
2340
|
+
});
|
|
2341
|
+
private headers;
|
|
2342
|
+
private request;
|
|
2343
|
+
list(): Promise<VirtualKey[]>;
|
|
2344
|
+
get(id: string): Promise<VirtualKey>;
|
|
2345
|
+
create(input: CreateVirtualKeyInput): Promise<VirtualKeyWithSecret>;
|
|
2346
|
+
update(id: string, input: UpdateVirtualKeyInput): Promise<VirtualKey>;
|
|
2347
|
+
rotate(id: string): Promise<VirtualKeyWithSecret>;
|
|
2348
|
+
revoke(id: string): Promise<VirtualKey>;
|
|
2349
|
+
/**
|
|
2350
|
+
* Aggregate spend for one key. Defaults to the current UTC calendar
|
|
2351
|
+
* month server-side. Reads the same cost path the dashboard reads, so
|
|
2352
|
+
* this number and the UI agree by construction.
|
|
2353
|
+
*/
|
|
2354
|
+
spend(id: string, window?: {
|
|
2355
|
+
from?: string;
|
|
2356
|
+
to?: string;
|
|
2357
|
+
}): Promise<VirtualKeySpendSummary>;
|
|
2358
|
+
}
|
|
2359
|
+
|
|
2360
|
+
type BudgetScopeKind = "ORGANIZATION" | "TEAM" | "PROJECT" | "VIRTUAL_KEY" | "PRINCIPAL" | "GROUP";
|
|
2361
|
+
type BudgetWindow = "MINUTE" | "HOUR" | "DAY" | "WEEK" | "MONTH" | "TOTAL";
|
|
2362
|
+
type BudgetOnBreach = "BLOCK" | "WARN";
|
|
2363
|
+
interface GatewayBudget {
|
|
2364
|
+
id: string;
|
|
2365
|
+
organization_id: string;
|
|
2366
|
+
scope_type: BudgetScopeKind;
|
|
2367
|
+
scope_id: string;
|
|
2368
|
+
name: string;
|
|
2369
|
+
description: string | null;
|
|
2370
|
+
window: BudgetWindow;
|
|
2371
|
+
on_breach: BudgetOnBreach;
|
|
2372
|
+
/**
|
|
2373
|
+
* For GROUP rows this is the PER-MEMBER allowance, not a group total;
|
|
2374
|
+
* `spent_usd` sums the whole group and `member_count` says how many
|
|
2375
|
+
* members the allowance currently covers.
|
|
2376
|
+
*/
|
|
2377
|
+
limit_usd: string;
|
|
2378
|
+
spent_usd: string;
|
|
2379
|
+
timezone: string | null;
|
|
2380
|
+
/** ModelProvider id the budget counts; null counts every provider. */
|
|
2381
|
+
provider_key: string | null;
|
|
2382
|
+
current_period_started_at: string;
|
|
2383
|
+
resets_at: string;
|
|
2384
|
+
last_reset_at: string | null;
|
|
2385
|
+
archived_at: string | null;
|
|
2386
|
+
created_at: string;
|
|
2387
|
+
/** GROUP rows only. */
|
|
2388
|
+
member_count?: number;
|
|
2389
|
+
}
|
|
2390
|
+
interface GatewayBudgetList {
|
|
2391
|
+
budgets: GatewayBudget[];
|
|
2392
|
+
/**
|
|
2393
|
+
* False when spend could not be totalled — render "unavailable" rather
|
|
2394
|
+
* than trusting `spent_usd` as real spend.
|
|
2395
|
+
*/
|
|
2396
|
+
spend_available: boolean;
|
|
2397
|
+
}
|
|
2398
|
+
type CreateGatewayBudgetScope = {
|
|
2399
|
+
kind: "ORGANIZATION";
|
|
2400
|
+
organization_id: string;
|
|
2401
|
+
} | {
|
|
2402
|
+
kind: "TEAM";
|
|
2403
|
+
team_id: string;
|
|
2404
|
+
} | {
|
|
2405
|
+
kind: "PROJECT";
|
|
2406
|
+
project_id: string;
|
|
2407
|
+
} | {
|
|
2408
|
+
kind: "VIRTUAL_KEY";
|
|
2409
|
+
virtual_key_id: string;
|
|
2410
|
+
} | {
|
|
2411
|
+
kind: "PRINCIPAL";
|
|
2412
|
+
principal_user_id: string;
|
|
2413
|
+
} | {
|
|
2414
|
+
kind: "GROUP";
|
|
2415
|
+
group_id: string;
|
|
2416
|
+
};
|
|
2417
|
+
interface CreateGatewayBudgetInput {
|
|
2418
|
+
scope: CreateGatewayBudgetScope;
|
|
2419
|
+
name: string;
|
|
2420
|
+
description?: string;
|
|
2421
|
+
window: BudgetWindow;
|
|
2422
|
+
limit_usd: number | string;
|
|
2423
|
+
on_breach?: BudgetOnBreach;
|
|
2424
|
+
timezone?: string | null;
|
|
2425
|
+
/** ModelProvider id to pin the budget to one provider. */
|
|
2426
|
+
provider_key?: string | null;
|
|
2427
|
+
}
|
|
2428
|
+
interface UpdateGatewayBudgetInput {
|
|
2429
|
+
name?: string;
|
|
2430
|
+
description?: string | null;
|
|
2431
|
+
limit_usd?: number | string;
|
|
2432
|
+
on_breach?: BudgetOnBreach;
|
|
2433
|
+
timezone?: string | null;
|
|
2434
|
+
}
|
|
2435
|
+
declare class GatewayBudgetsApiError extends Error {
|
|
2436
|
+
readonly operation: string;
|
|
2437
|
+
readonly originalError?: unknown | undefined;
|
|
2438
|
+
constructor(message: string, operation: string, originalError?: unknown | undefined);
|
|
2439
|
+
}
|
|
2440
|
+
declare class GatewayBudgetsApiService {
|
|
2441
|
+
private readonly endpoint;
|
|
2442
|
+
private readonly apiKey;
|
|
2443
|
+
constructor(config?: {
|
|
2444
|
+
endpoint?: string;
|
|
2445
|
+
apiKey?: string;
|
|
2446
|
+
});
|
|
2447
|
+
private headers;
|
|
2448
|
+
private request;
|
|
2449
|
+
/**
|
|
2450
|
+
* Every non-archived budget in the organization across all six scope
|
|
2451
|
+
* types, optionally filtered by `scopeTypes`.
|
|
2452
|
+
*/
|
|
2453
|
+
list(options?: {
|
|
2454
|
+
scopeTypes?: BudgetScopeKind[];
|
|
2455
|
+
}): Promise<GatewayBudgetList>;
|
|
2456
|
+
create(input: CreateGatewayBudgetInput): Promise<GatewayBudget>;
|
|
2457
|
+
update(id: string, input: UpdateGatewayBudgetInput): Promise<GatewayBudget>;
|
|
2458
|
+
archive(id: string): Promise<GatewayBudget>;
|
|
2459
|
+
}
|
|
2460
|
+
|
|
2239
2461
|
declare const logger: {
|
|
2240
2462
|
ConsoleLogger: typeof ConsoleLogger;
|
|
2241
2463
|
NoOpLogger: typeof NoOpLogger;
|
|
2242
2464
|
};
|
|
2243
2465
|
|
|
2244
|
-
export { type BatchCreateRecordsResponse, type CreateDatasetOptions, type CreateEvaluatorBody, type CreateFromUploadResponse, type Dataset, DatasetApiError, type DatasetColumnType, type DatasetEntry, DatasetError, type DatasetListItem, type DatasetMetadata, DatasetNotFoundError, DatasetPlanLimitError, type DatasetRecordResponse, DatasetValidationError, DatasetsFacade, type DeleteRecordsResponse, type EvaluateOptions, type EvaluationCost, EvaluationError, type EvaluationResult, type EvaluationStatus, EvaluationsApiError, EvaluationsFacade, EvaluatorCallError, EvaluatorError, type EvaluatorField, EvaluatorNotFoundError, type EvaluatorResponse, EvaluatorsApiError, EvaluatorsApiService, Experiment, ExperimentApiError, ExperimentError, type EvaluateOptions$1 as ExperimentEvaluateOptions, type EvaluationResult$1 as ExperimentEvaluationResult, type EvaluationStatus$1 as ExperimentEvaluationStatus, ExperimentInitError, type ExperimentInitOptions, type ExperimentRowResult, type ExperimentRunWithResults, ExperimentsFacade, FetchPolicy, type GetDatasetOptions, type GetPromptOptions, LangWatch, LangWatchApiError, LangWatchHandledError, type ListDatasetsApiResponse, type ListDatasetsOptions, type ListRecordsApiResponse, type ListRecordsOptions, type LogOptions, type PaginatedResponse, type Pagination, type RunCallback, type RunContext, type RunOptions, type RunWithResultsOptions, type TargetInfo, type TargetMetadata, TargetMetadataConflictError, type TargetType, type UpdateDatasetOptions, type UploadResponse, isLangWatchHandledError, logger };
|
|
2466
|
+
export { type BatchCreateRecordsResponse, type BudgetOnBreach, type BudgetScopeKind, type BudgetWindow, type CreateDatasetOptions, type CreateEvaluatorBody, type CreateFromUploadResponse, type CreateGatewayBudgetInput, type CreateGatewayBudgetScope, type CreateVirtualKeyInput, type Dataset, DatasetApiError, type DatasetColumnType, type DatasetEntry, DatasetError, type DatasetListItem, type DatasetMetadata, DatasetNotFoundError, DatasetPlanLimitError, type DatasetRecordResponse, DatasetValidationError, DatasetsFacade, type DeleteRecordsResponse, type EvaluateOptions, type EvaluationCost, EvaluationError, type EvaluationResult, type EvaluationStatus, EvaluationsApiError, EvaluationsFacade, EvaluatorCallError, EvaluatorError, type EvaluatorField, EvaluatorNotFoundError, type EvaluatorResponse, EvaluatorsApiError, EvaluatorsApiService, Experiment, ExperimentApiError, ExperimentError, type EvaluateOptions$1 as ExperimentEvaluateOptions, type EvaluationResult$1 as ExperimentEvaluationResult, type EvaluationStatus$1 as ExperimentEvaluationStatus, ExperimentInitError, type ExperimentInitOptions, type ExperimentRowResult, type ExperimentRunWithResults, ExperimentsFacade, FetchPolicy, type GatewayBudget, type GatewayBudgetList, GatewayBudgetsApiError, GatewayBudgetsApiService, type GetDatasetOptions, type GetPromptOptions, LangWatch, LangWatchApiError, LangWatchHandledError, type ListDatasetsApiResponse, type ListDatasetsOptions, type ListRecordsApiResponse, type ListRecordsOptions, type LogOptions, type PaginatedResponse, type Pagination, type RunCallback, type RunContext, type RunOptions, type RunWithResultsOptions, type TargetInfo, type TargetMetadata, TargetMetadataConflictError, type TargetType, type UpdateDatasetOptions, type UpdateGatewayBudgetInput, type UpdateVirtualKeyInput, type UploadResponse, type VirtualKey, type VirtualKeyBudgetInput, type VirtualKeyRoutingMode, type VirtualKeyScope, type VirtualKeyScopeType, type VirtualKeySpendSummary, type VirtualKeyWithSecret, VirtualKeysApiError, VirtualKeysApiService, isLangWatchHandledError, logger };
|
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-
|
|
2
|
+
export { F as FilterableBatchSpanProcessor, L as LangWatchExporter, S as SpanProcessingExcludeRule, g as getLangWatchLogger, a as getLangWatchTracer } from './implementation-Psro9xt4.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-
|
|
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-DGBGlP9B.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';
|
|
@@ -2236,9 +2236,231 @@ declare class LangWatchApiError extends Error {
|
|
|
2236
2236
|
safeParseBody(response: Response): Promise<void>;
|
|
2237
2237
|
}
|
|
2238
2238
|
|
|
2239
|
+
type VirtualKeyScopeType = "ORGANIZATION" | "TEAM" | "PROJECT";
|
|
2240
|
+
interface VirtualKeyScope {
|
|
2241
|
+
scope_type: VirtualKeyScopeType;
|
|
2242
|
+
scope_id: string;
|
|
2243
|
+
}
|
|
2244
|
+
type VirtualKeyRoutingMode = "NONE" | "FALLBACK_ALL" | "POLICY";
|
|
2245
|
+
/**
|
|
2246
|
+
* The snake DTO the server returns (`toVirtualKeySnakeDto`). The token
|
|
2247
|
+
* format is `vk-lw-<ulid>` with no live/test discriminator; the gateway
|
|
2248
|
+
* never branches on environment, so there is no env field.
|
|
2249
|
+
*/
|
|
2250
|
+
interface VirtualKey {
|
|
2251
|
+
id: string;
|
|
2252
|
+
organization_id: string;
|
|
2253
|
+
name: string;
|
|
2254
|
+
description: string | null;
|
|
2255
|
+
status: "active" | "revoked";
|
|
2256
|
+
/** "langy" marks a product-managed key; customers can only mint "user". */
|
|
2257
|
+
purpose: "user" | "langy";
|
|
2258
|
+
/** e.g. "vk-lw-01HZX9" — the only secret material kept after creation. */
|
|
2259
|
+
display_prefix: string;
|
|
2260
|
+
principal_user_id: string | null;
|
|
2261
|
+
/**
|
|
2262
|
+
* Where an org- or team-owned key's traces and costs land. Not a
|
|
2263
|
+
* scope: it grants no access to the key.
|
|
2264
|
+
*/
|
|
2265
|
+
trace_project_id: string | null;
|
|
2266
|
+
scopes: VirtualKeyScope[];
|
|
2267
|
+
routing_policy_id: string | null;
|
|
2268
|
+
routing_mode: VirtualKeyRoutingMode;
|
|
2269
|
+
config: Record<string, unknown>;
|
|
2270
|
+
revision: string;
|
|
2271
|
+
created_at: string;
|
|
2272
|
+
updated_at: string;
|
|
2273
|
+
last_used_at: string | null;
|
|
2274
|
+
revoked_at: string | null;
|
|
2275
|
+
}
|
|
2276
|
+
/**
|
|
2277
|
+
* The cap a key carries on itself, created atomically with the key. Only
|
|
2278
|
+
* the calendar windows a person reasons about; string amounts survive
|
|
2279
|
+
* JSON round-trips without float drift (numbers are stringified).
|
|
2280
|
+
*/
|
|
2281
|
+
interface VirtualKeyBudgetInput {
|
|
2282
|
+
limit_usd: string | number;
|
|
2283
|
+
window: "DAY" | "WEEK" | "MONTH";
|
|
2284
|
+
on_breach?: "BLOCK" | "WARN";
|
|
2285
|
+
name?: string;
|
|
2286
|
+
}
|
|
2287
|
+
interface CreateVirtualKeyInput {
|
|
2288
|
+
name: string;
|
|
2289
|
+
description?: string;
|
|
2290
|
+
principal_user_id?: string | null;
|
|
2291
|
+
/** Defaults to the caller's project when omitted. */
|
|
2292
|
+
scopes?: VirtualKeyScope[];
|
|
2293
|
+
/**
|
|
2294
|
+
* Explicit trace destination for org- and team-owned keys; requires
|
|
2295
|
+
* `virtualKeys:manage` on that project. NOT a scope.
|
|
2296
|
+
*/
|
|
2297
|
+
trace_project_id?: string | null;
|
|
2298
|
+
routing_policy_id?: string | null;
|
|
2299
|
+
routing_mode?: VirtualKeyRoutingMode;
|
|
2300
|
+
/** Optional cap created atomically with the key. */
|
|
2301
|
+
budget?: VirtualKeyBudgetInput | null;
|
|
2302
|
+
config?: Record<string, unknown>;
|
|
2303
|
+
}
|
|
2304
|
+
interface UpdateVirtualKeyInput {
|
|
2305
|
+
name?: string;
|
|
2306
|
+
description?: string | null;
|
|
2307
|
+
scopes?: VirtualKeyScope[];
|
|
2308
|
+
trace_project_id?: string | null;
|
|
2309
|
+
routing_policy_id?: string | null;
|
|
2310
|
+
routing_mode?: VirtualKeyRoutingMode;
|
|
2311
|
+
/** Undefined leaves the cap alone; a value upserts it; null archives it. */
|
|
2312
|
+
budget?: VirtualKeyBudgetInput | null;
|
|
2313
|
+
config?: Record<string, unknown>;
|
|
2314
|
+
}
|
|
2315
|
+
interface VirtualKeyWithSecret {
|
|
2316
|
+
virtual_key: VirtualKey;
|
|
2317
|
+
secret: string;
|
|
2318
|
+
}
|
|
2319
|
+
/** Aggregate spend for one key over a window, from the cost path. */
|
|
2320
|
+
interface VirtualKeySpendSummary {
|
|
2321
|
+
virtual_key_id: string;
|
|
2322
|
+
spent_usd: string;
|
|
2323
|
+
requests: number;
|
|
2324
|
+
window: {
|
|
2325
|
+
from: string;
|
|
2326
|
+
to: string;
|
|
2327
|
+
};
|
|
2328
|
+
}
|
|
2329
|
+
declare class VirtualKeysApiError extends Error {
|
|
2330
|
+
readonly operation: string;
|
|
2331
|
+
readonly originalError?: unknown | undefined;
|
|
2332
|
+
constructor(message: string, operation: string, originalError?: unknown | undefined);
|
|
2333
|
+
}
|
|
2334
|
+
declare class VirtualKeysApiService {
|
|
2335
|
+
private readonly endpoint;
|
|
2336
|
+
private readonly apiKey;
|
|
2337
|
+
constructor(config?: {
|
|
2338
|
+
endpoint?: string;
|
|
2339
|
+
apiKey?: string;
|
|
2340
|
+
});
|
|
2341
|
+
private headers;
|
|
2342
|
+
private request;
|
|
2343
|
+
list(): Promise<VirtualKey[]>;
|
|
2344
|
+
get(id: string): Promise<VirtualKey>;
|
|
2345
|
+
create(input: CreateVirtualKeyInput): Promise<VirtualKeyWithSecret>;
|
|
2346
|
+
update(id: string, input: UpdateVirtualKeyInput): Promise<VirtualKey>;
|
|
2347
|
+
rotate(id: string): Promise<VirtualKeyWithSecret>;
|
|
2348
|
+
revoke(id: string): Promise<VirtualKey>;
|
|
2349
|
+
/**
|
|
2350
|
+
* Aggregate spend for one key. Defaults to the current UTC calendar
|
|
2351
|
+
* month server-side. Reads the same cost path the dashboard reads, so
|
|
2352
|
+
* this number and the UI agree by construction.
|
|
2353
|
+
*/
|
|
2354
|
+
spend(id: string, window?: {
|
|
2355
|
+
from?: string;
|
|
2356
|
+
to?: string;
|
|
2357
|
+
}): Promise<VirtualKeySpendSummary>;
|
|
2358
|
+
}
|
|
2359
|
+
|
|
2360
|
+
type BudgetScopeKind = "ORGANIZATION" | "TEAM" | "PROJECT" | "VIRTUAL_KEY" | "PRINCIPAL" | "GROUP";
|
|
2361
|
+
type BudgetWindow = "MINUTE" | "HOUR" | "DAY" | "WEEK" | "MONTH" | "TOTAL";
|
|
2362
|
+
type BudgetOnBreach = "BLOCK" | "WARN";
|
|
2363
|
+
interface GatewayBudget {
|
|
2364
|
+
id: string;
|
|
2365
|
+
organization_id: string;
|
|
2366
|
+
scope_type: BudgetScopeKind;
|
|
2367
|
+
scope_id: string;
|
|
2368
|
+
name: string;
|
|
2369
|
+
description: string | null;
|
|
2370
|
+
window: BudgetWindow;
|
|
2371
|
+
on_breach: BudgetOnBreach;
|
|
2372
|
+
/**
|
|
2373
|
+
* For GROUP rows this is the PER-MEMBER allowance, not a group total;
|
|
2374
|
+
* `spent_usd` sums the whole group and `member_count` says how many
|
|
2375
|
+
* members the allowance currently covers.
|
|
2376
|
+
*/
|
|
2377
|
+
limit_usd: string;
|
|
2378
|
+
spent_usd: string;
|
|
2379
|
+
timezone: string | null;
|
|
2380
|
+
/** ModelProvider id the budget counts; null counts every provider. */
|
|
2381
|
+
provider_key: string | null;
|
|
2382
|
+
current_period_started_at: string;
|
|
2383
|
+
resets_at: string;
|
|
2384
|
+
last_reset_at: string | null;
|
|
2385
|
+
archived_at: string | null;
|
|
2386
|
+
created_at: string;
|
|
2387
|
+
/** GROUP rows only. */
|
|
2388
|
+
member_count?: number;
|
|
2389
|
+
}
|
|
2390
|
+
interface GatewayBudgetList {
|
|
2391
|
+
budgets: GatewayBudget[];
|
|
2392
|
+
/**
|
|
2393
|
+
* False when spend could not be totalled — render "unavailable" rather
|
|
2394
|
+
* than trusting `spent_usd` as real spend.
|
|
2395
|
+
*/
|
|
2396
|
+
spend_available: boolean;
|
|
2397
|
+
}
|
|
2398
|
+
type CreateGatewayBudgetScope = {
|
|
2399
|
+
kind: "ORGANIZATION";
|
|
2400
|
+
organization_id: string;
|
|
2401
|
+
} | {
|
|
2402
|
+
kind: "TEAM";
|
|
2403
|
+
team_id: string;
|
|
2404
|
+
} | {
|
|
2405
|
+
kind: "PROJECT";
|
|
2406
|
+
project_id: string;
|
|
2407
|
+
} | {
|
|
2408
|
+
kind: "VIRTUAL_KEY";
|
|
2409
|
+
virtual_key_id: string;
|
|
2410
|
+
} | {
|
|
2411
|
+
kind: "PRINCIPAL";
|
|
2412
|
+
principal_user_id: string;
|
|
2413
|
+
} | {
|
|
2414
|
+
kind: "GROUP";
|
|
2415
|
+
group_id: string;
|
|
2416
|
+
};
|
|
2417
|
+
interface CreateGatewayBudgetInput {
|
|
2418
|
+
scope: CreateGatewayBudgetScope;
|
|
2419
|
+
name: string;
|
|
2420
|
+
description?: string;
|
|
2421
|
+
window: BudgetWindow;
|
|
2422
|
+
limit_usd: number | string;
|
|
2423
|
+
on_breach?: BudgetOnBreach;
|
|
2424
|
+
timezone?: string | null;
|
|
2425
|
+
/** ModelProvider id to pin the budget to one provider. */
|
|
2426
|
+
provider_key?: string | null;
|
|
2427
|
+
}
|
|
2428
|
+
interface UpdateGatewayBudgetInput {
|
|
2429
|
+
name?: string;
|
|
2430
|
+
description?: string | null;
|
|
2431
|
+
limit_usd?: number | string;
|
|
2432
|
+
on_breach?: BudgetOnBreach;
|
|
2433
|
+
timezone?: string | null;
|
|
2434
|
+
}
|
|
2435
|
+
declare class GatewayBudgetsApiError extends Error {
|
|
2436
|
+
readonly operation: string;
|
|
2437
|
+
readonly originalError?: unknown | undefined;
|
|
2438
|
+
constructor(message: string, operation: string, originalError?: unknown | undefined);
|
|
2439
|
+
}
|
|
2440
|
+
declare class GatewayBudgetsApiService {
|
|
2441
|
+
private readonly endpoint;
|
|
2442
|
+
private readonly apiKey;
|
|
2443
|
+
constructor(config?: {
|
|
2444
|
+
endpoint?: string;
|
|
2445
|
+
apiKey?: string;
|
|
2446
|
+
});
|
|
2447
|
+
private headers;
|
|
2448
|
+
private request;
|
|
2449
|
+
/**
|
|
2450
|
+
* Every non-archived budget in the organization across all six scope
|
|
2451
|
+
* types, optionally filtered by `scopeTypes`.
|
|
2452
|
+
*/
|
|
2453
|
+
list(options?: {
|
|
2454
|
+
scopeTypes?: BudgetScopeKind[];
|
|
2455
|
+
}): Promise<GatewayBudgetList>;
|
|
2456
|
+
create(input: CreateGatewayBudgetInput): Promise<GatewayBudget>;
|
|
2457
|
+
update(id: string, input: UpdateGatewayBudgetInput): Promise<GatewayBudget>;
|
|
2458
|
+
archive(id: string): Promise<GatewayBudget>;
|
|
2459
|
+
}
|
|
2460
|
+
|
|
2239
2461
|
declare const logger: {
|
|
2240
2462
|
ConsoleLogger: typeof ConsoleLogger;
|
|
2241
2463
|
NoOpLogger: typeof NoOpLogger;
|
|
2242
2464
|
};
|
|
2243
2465
|
|
|
2244
|
-
export { type BatchCreateRecordsResponse, type CreateDatasetOptions, type CreateEvaluatorBody, type CreateFromUploadResponse, type Dataset, DatasetApiError, type DatasetColumnType, type DatasetEntry, DatasetError, type DatasetListItem, type DatasetMetadata, DatasetNotFoundError, DatasetPlanLimitError, type DatasetRecordResponse, DatasetValidationError, DatasetsFacade, type DeleteRecordsResponse, type EvaluateOptions, type EvaluationCost, EvaluationError, type EvaluationResult, type EvaluationStatus, EvaluationsApiError, EvaluationsFacade, EvaluatorCallError, EvaluatorError, type EvaluatorField, EvaluatorNotFoundError, type EvaluatorResponse, EvaluatorsApiError, EvaluatorsApiService, Experiment, ExperimentApiError, ExperimentError, type EvaluateOptions$1 as ExperimentEvaluateOptions, type EvaluationResult$1 as ExperimentEvaluationResult, type EvaluationStatus$1 as ExperimentEvaluationStatus, ExperimentInitError, type ExperimentInitOptions, type ExperimentRowResult, type ExperimentRunWithResults, ExperimentsFacade, FetchPolicy, type GetDatasetOptions, type GetPromptOptions, LangWatch, LangWatchApiError, LangWatchHandledError, type ListDatasetsApiResponse, type ListDatasetsOptions, type ListRecordsApiResponse, type ListRecordsOptions, type LogOptions, type PaginatedResponse, type Pagination, type RunCallback, type RunContext, type RunOptions, type RunWithResultsOptions, type TargetInfo, type TargetMetadata, TargetMetadataConflictError, type TargetType, type UpdateDatasetOptions, type UploadResponse, isLangWatchHandledError, logger };
|
|
2466
|
+
export { type BatchCreateRecordsResponse, type BudgetOnBreach, type BudgetScopeKind, type BudgetWindow, type CreateDatasetOptions, type CreateEvaluatorBody, type CreateFromUploadResponse, type CreateGatewayBudgetInput, type CreateGatewayBudgetScope, type CreateVirtualKeyInput, type Dataset, DatasetApiError, type DatasetColumnType, type DatasetEntry, DatasetError, type DatasetListItem, type DatasetMetadata, DatasetNotFoundError, DatasetPlanLimitError, type DatasetRecordResponse, DatasetValidationError, DatasetsFacade, type DeleteRecordsResponse, type EvaluateOptions, type EvaluationCost, EvaluationError, type EvaluationResult, type EvaluationStatus, EvaluationsApiError, EvaluationsFacade, EvaluatorCallError, EvaluatorError, type EvaluatorField, EvaluatorNotFoundError, type EvaluatorResponse, EvaluatorsApiError, EvaluatorsApiService, Experiment, ExperimentApiError, ExperimentError, type EvaluateOptions$1 as ExperimentEvaluateOptions, type EvaluationResult$1 as ExperimentEvaluationResult, type EvaluationStatus$1 as ExperimentEvaluationStatus, ExperimentInitError, type ExperimentInitOptions, type ExperimentRowResult, type ExperimentRunWithResults, ExperimentsFacade, FetchPolicy, type GatewayBudget, type GatewayBudgetList, GatewayBudgetsApiError, GatewayBudgetsApiService, type GetDatasetOptions, type GetPromptOptions, LangWatch, LangWatchApiError, LangWatchHandledError, type ListDatasetsApiResponse, type ListDatasetsOptions, type ListRecordsApiResponse, type ListRecordsOptions, type LogOptions, type PaginatedResponse, type Pagination, type RunCallback, type RunContext, type RunOptions, type RunWithResultsOptions, type TargetInfo, type TargetMetadata, TargetMetadataConflictError, type TargetType, type UpdateDatasetOptions, type UpdateGatewayBudgetInput, type UpdateVirtualKeyInput, type UploadResponse, type VirtualKey, type VirtualKeyBudgetInput, type VirtualKeyRoutingMode, type VirtualKeyScope, type VirtualKeyScopeType, type VirtualKeySpendSummary, type VirtualKeyWithSecret, VirtualKeysApiError, VirtualKeysApiService, isLangWatchHandledError, logger };
|