@voltro/ai 0.70.0 → 0.71.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/CHANGELOG.md +1289 -111
- package/THIRD-PARTY-NOTICES.md +178 -1
- package/dist/events.d.ts +16 -0
- package/dist/events.js +8 -2
- package/dist/index.d.ts +174 -74
- package/dist/index.js +640 -527
- package/dist/inferenceQueue-TwTEBG3Q.js +864 -0
- package/dist/{provider-RA0getTL.js → provider-C_Sms_DA.js} +90 -52
- package/dist/test.js +1 -1
- package/dist/workflow.d.ts +4 -0
- package/dist/workflow.js +51 -49
- package/package.json +7 -5
- package/dist/inferenceQueue-BS3PVSkk.js +0 -664
package/dist/index.d.ts
CHANGED
|
@@ -6,12 +6,14 @@ import { defaultSettingsMiddleware } from 'ai';
|
|
|
6
6
|
import { Effect } from 'effect';
|
|
7
7
|
import { EmbeddingModelV4 } from '@ai-sdk/provider';
|
|
8
8
|
import { Experimental_VideoModelV4 } from '@ai-sdk/provider';
|
|
9
|
+
import { Experimental_VideoModelV4File } from '@ai-sdk/provider';
|
|
9
10
|
import { extractReasoningMiddleware } from 'ai';
|
|
10
11
|
import { GatewayLanguageModelEntry } from '@ai-sdk/gateway';
|
|
11
12
|
import { Guards } from '@voltro/protocol';
|
|
12
13
|
import { ImageModelV4 } from '@ai-sdk/provider';
|
|
13
14
|
import { LanguageModelMiddleware } from 'ai';
|
|
14
15
|
import { LanguageModelV4 } from '@ai-sdk/provider';
|
|
16
|
+
import { LanguageModelV4Source } from '@ai-sdk/provider';
|
|
15
17
|
import { ModelMessage } from 'ai';
|
|
16
18
|
import { QueryDescriptor } from '@voltro/database';
|
|
17
19
|
import { QueryProcedureDescriptor } from '@voltro/protocol';
|
|
@@ -113,10 +115,18 @@ export declare const AgentEvent: Schema.Union<[Schema.Struct<{
|
|
|
113
115
|
title: Schema.optional<typeof Schema.String>;
|
|
114
116
|
mediaType: Schema.optional<typeof Schema.String>;
|
|
115
117
|
filename: Schema.optional<typeof Schema.String>;
|
|
118
|
+
/** Provider-owned citation attribution; not normalized or interpreted. */
|
|
119
|
+
providerMetadata: Schema.optional<typeof Schema.Unknown>;
|
|
116
120
|
}>, Schema.Struct<{
|
|
117
121
|
_tag: Schema.Literal<["file"]>;
|
|
118
122
|
mediaType: typeof Schema.String;
|
|
119
123
|
data: typeof Schema.String;
|
|
124
|
+
/** Metadata for this file, not the whole model step. */
|
|
125
|
+
providerMetadata: Schema.optional<typeof Schema.Unknown>;
|
|
126
|
+
}>, Schema.Struct<{
|
|
127
|
+
_tag: Schema.Literal<["stepMetadata"]>;
|
|
128
|
+
step: Schema.filter<typeof Schema.Int>;
|
|
129
|
+
providerMetadata: typeof Schema.Unknown;
|
|
120
130
|
}>, Schema.Struct<{
|
|
121
131
|
_tag: Schema.Literal<["message"]>;
|
|
122
132
|
role: typeof Schema.String;
|
|
@@ -283,13 +293,15 @@ declare const AgentThreadAccessDenied_base: Schema.TaggedErrorClass<AgentThreadA
|
|
|
283
293
|
|
|
284
294
|
export declare const agentThreadsTable: Table<typeof AGENT_THREADS_TABLE, Record<string, ColumnDefinition<unknown>>, true>;
|
|
285
295
|
|
|
296
|
+
export declare const AI_BUDGET_RESERVATIONS_TABLE = "_voltro_ai_budget_reservations";
|
|
297
|
+
|
|
286
298
|
export declare const AI_BUDGET_TABLE = "_voltro_ai_budget";
|
|
287
299
|
|
|
288
300
|
export declare const AI_INFERENCES_TABLE = "_voltro_ai_inferences";
|
|
289
301
|
|
|
290
302
|
export declare const AI_USAGE_TABLE = "_voltro_ai_usage";
|
|
291
303
|
|
|
292
|
-
/**
|
|
304
|
+
/** A refused reservation, not evidence of a provider charge. */
|
|
293
305
|
export declare class AiBudgetExceeded extends AiBudgetExceeded_base {
|
|
294
306
|
}
|
|
295
307
|
|
|
@@ -302,21 +314,17 @@ declare const AiBudgetExceeded_base: Schema.TaggedErrorClass<AiBudgetExceeded, "
|
|
|
302
314
|
attemptedUsd: typeof Schema.Number;
|
|
303
315
|
}>;
|
|
304
316
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
* counter. `.maxLength(191)` keeps the UNIQUE a plain cross-dialect BTREE.
|
|
317
|
-
* The counter is a RESERVATION ledger separate from the descriptive
|
|
318
|
-
* `_voltro_ai_usage` spend ledger; it too is bounded by the retention sweep.
|
|
319
|
-
*/
|
|
317
|
+
export declare interface AiBudgetReservation {
|
|
318
|
+
readonly reservationId: string;
|
|
319
|
+
readonly tenantId: string | null;
|
|
320
|
+
readonly amountMicroUsd: string;
|
|
321
|
+
readonly status: 'reserved' | 'replayed';
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
/** Receipt and release tombstone. A receipt and its counter change commit together. */
|
|
325
|
+
export declare const aiBudgetReservationsTable: Table<typeof AI_BUDGET_RESERVATIONS_TABLE, Record<string, ColumnDefinition<unknown>>, true>;
|
|
326
|
+
|
|
327
|
+
/** Exact micro-USD counter, shared by a tenant's window. */
|
|
320
328
|
export declare const aiBudgetTable: Table<typeof AI_BUDGET_TABLE, Record<string, ColumnDefinition<unknown>>, true>;
|
|
321
329
|
|
|
322
330
|
/** Attributes stamped on the span + used as metric labels. Derived from the
|
|
@@ -331,6 +339,29 @@ export declare interface AiCallAttributes {
|
|
|
331
339
|
/** Derive span/metric attributes from a resolved provider config + operation. */
|
|
332
340
|
export declare const aiCallAttributes: (config: ProviderConfig, operation: string) => AiCallAttributes;
|
|
333
341
|
|
|
342
|
+
export declare type AiCallEvidence = typeof AiCallEvidenceSchema.Type;
|
|
343
|
+
|
|
344
|
+
/** Allowlisted consumption evidence, never a provider response or SDK error.
|
|
345
|
+
* Completeness describes the three token counters, not billing completeness. */
|
|
346
|
+
export declare const AiCallEvidenceSchema: Schema.Struct<{
|
|
347
|
+
provider: typeof Schema.String;
|
|
348
|
+
model: typeof Schema.String;
|
|
349
|
+
usage: Schema.Struct<{
|
|
350
|
+
inputTokens: Schema.optional<Schema.filter<Schema.filter<Schema.filter<typeof Schema.Number>>>>;
|
|
351
|
+
outputTokens: Schema.optional<Schema.filter<Schema.filter<Schema.filter<typeof Schema.Number>>>>;
|
|
352
|
+
totalTokens: Schema.optional<Schema.filter<Schema.filter<Schema.filter<typeof Schema.Number>>>>;
|
|
353
|
+
completeness: Schema.Literal<["complete", "partial", "unknown"]>;
|
|
354
|
+
}>;
|
|
355
|
+
cost: Schema.Union<[Schema.Struct<{
|
|
356
|
+
status: Schema.Literal<["actual"]>;
|
|
357
|
+
source: Schema.Literal<["gateway"]>;
|
|
358
|
+
usd: Schema.filter<Schema.filter<typeof Schema.Number>>;
|
|
359
|
+
}>, Schema.Struct<{
|
|
360
|
+
status: Schema.Literal<["unknown"]>;
|
|
361
|
+
source: Schema.Literal<["unreported"]>;
|
|
362
|
+
}>]>;
|
|
363
|
+
}>;
|
|
364
|
+
|
|
334
365
|
/** One logged AI call. `usage` is the SDK's token-usage object (present for
|
|
335
366
|
* generate; a stream logs the call at start, before usage is known). */
|
|
336
367
|
export declare interface AiCallLog {
|
|
@@ -353,6 +384,24 @@ declare const AiError_base: Schema.TaggedErrorClass<AiError, "AiError", {
|
|
|
353
384
|
} & {
|
|
354
385
|
reason: Schema.Literal<["generation", "decode"]>;
|
|
355
386
|
message: typeof Schema.String;
|
|
387
|
+
evidence: Schema.optional<Schema.Struct<{
|
|
388
|
+
provider: typeof Schema.String;
|
|
389
|
+
model: typeof Schema.String;
|
|
390
|
+
usage: Schema.Struct<{
|
|
391
|
+
inputTokens: Schema.optional<Schema.filter<Schema.filter<Schema.filter<typeof Schema.Number>>>>;
|
|
392
|
+
outputTokens: Schema.optional<Schema.filter<Schema.filter<Schema.filter<typeof Schema.Number>>>>;
|
|
393
|
+
totalTokens: Schema.optional<Schema.filter<Schema.filter<Schema.filter<typeof Schema.Number>>>>;
|
|
394
|
+
completeness: Schema.Literal<["complete", "partial", "unknown"]>;
|
|
395
|
+
}>;
|
|
396
|
+
cost: Schema.Union<[Schema.Struct<{
|
|
397
|
+
status: Schema.Literal<["actual"]>;
|
|
398
|
+
source: Schema.Literal<["gateway"]>;
|
|
399
|
+
usd: Schema.filter<Schema.filter<typeof Schema.Number>>;
|
|
400
|
+
}>, Schema.Struct<{
|
|
401
|
+
status: Schema.Literal<["unknown"]>;
|
|
402
|
+
source: Schema.Literal<["unreported"]>;
|
|
403
|
+
}>]>;
|
|
404
|
+
}>>;
|
|
356
405
|
}>;
|
|
357
406
|
|
|
358
407
|
/**
|
|
@@ -1052,6 +1101,13 @@ export declare interface EmbeddingProviderConfig {
|
|
|
1052
1101
|
readonly model: string;
|
|
1053
1102
|
/** Mock-only: the deterministic output-vector length. Default 8. */
|
|
1054
1103
|
readonly mockDim?: number;
|
|
1104
|
+
/** Native SDK options, e.g. `{ openai: { dimensions: 512 } }` or
|
|
1105
|
+
* `{ voyage: { inputType: 'query', outputDimension: 512 } }`.
|
|
1106
|
+
* Model support is provider-specific; these are passed to every SDK batch. */
|
|
1107
|
+
readonly providerOptions?: AiProviderOptions;
|
|
1108
|
+
/** Validate the returned vector length. This does not configure the model:
|
|
1109
|
+
* request its dimension through providerOptions (or mockDim for mock). */
|
|
1110
|
+
readonly expectedDimensions?: number;
|
|
1055
1111
|
}
|
|
1056
1112
|
|
|
1057
1113
|
/**
|
|
@@ -1245,8 +1301,9 @@ export declare const fromRaw: (raw: RawGatewayModel) => GatewayModelInfo;
|
|
|
1245
1301
|
* Pull the ACTUAL per-call cost (USD) out of an AI-SDK result's provider
|
|
1246
1302
|
* metadata, when the Vercel AI Gateway reported it. The gateway attaches
|
|
1247
1303
|
* `providerMetadata.gateway.cost` (a USD number or numeric string) to
|
|
1248
|
-
* generate/stream results; returns `undefined` when absent
|
|
1249
|
-
*
|
|
1304
|
+
* generate/stream results; returns `undefined` when absent or invalid so the
|
|
1305
|
+
* caller falls back to the price table. Empty, negative and non-finite values
|
|
1306
|
+
* are not evidence of a charge. An explicit zero remains authoritative.
|
|
1250
1307
|
*/
|
|
1251
1308
|
export declare const gatewayCostUsd: (providerMetadata: unknown) => number | undefined;
|
|
1252
1309
|
|
|
@@ -1337,6 +1394,15 @@ export declare interface GeneratedAudio {
|
|
|
1337
1394
|
export declare interface GeneratedImage {
|
|
1338
1395
|
readonly data: Uint8Array | string;
|
|
1339
1396
|
readonly mediaType: string;
|
|
1397
|
+
/** Metadata belonging to this image, not the entire generation. */
|
|
1398
|
+
readonly providerMetadata?: unknown;
|
|
1399
|
+
}
|
|
1400
|
+
|
|
1401
|
+
/** Preserve provider-call boundaries: grounding for one batch is not another's. */
|
|
1402
|
+
export declare interface GeneratedImageCall {
|
|
1403
|
+
readonly images: ReadonlyArray<GeneratedImage>;
|
|
1404
|
+
readonly usage?: MediaUsage;
|
|
1405
|
+
readonly providerMetadata?: unknown;
|
|
1340
1406
|
}
|
|
1341
1407
|
|
|
1342
1408
|
/** The produced video. Providers return EITHER a `url` (the common case — video
|
|
@@ -1357,6 +1423,14 @@ export declare const generateImage: (options: GenerateImageOptions) => Effect.Ef
|
|
|
1357
1423
|
export declare interface GenerateImageOptions {
|
|
1358
1424
|
/** What to draw. */
|
|
1359
1425
|
readonly prompt: string;
|
|
1426
|
+
/** Image-editing references and optional mask: URLs, data URLs, base64 or bytes. */
|
|
1427
|
+
readonly inputs?: {
|
|
1428
|
+
readonly images: ReadonlyArray<string | Uint8Array>;
|
|
1429
|
+
readonly mask?: string | Uint8Array;
|
|
1430
|
+
};
|
|
1431
|
+
readonly seed?: number;
|
|
1432
|
+
/** Interrupt the call and signal provider I/O. Fiber interruption does the same. */
|
|
1433
|
+
readonly abortSignal?: AbortSignal;
|
|
1360
1434
|
/** Override the provider/model for a single call (defaults to `providerFromEnv()`).
|
|
1361
1435
|
* `anthropic` has no image model; use `openai` or `gateway`. */
|
|
1362
1436
|
readonly provider?: ProviderConfig;
|
|
@@ -1373,6 +1447,8 @@ export declare interface GenerateImageOptions {
|
|
|
1373
1447
|
|
|
1374
1448
|
export declare interface GenerateImageResult {
|
|
1375
1449
|
readonly images: ReadonlyArray<GeneratedImage>;
|
|
1450
|
+
/** Original per-call metadata, including grounding. No response headers or bodies. */
|
|
1451
|
+
readonly calls: ReadonlyArray<GeneratedImageCall>;
|
|
1376
1452
|
readonly usage?: MediaUsage;
|
|
1377
1453
|
/** Raw provider/gateway metadata — feed to `gatewayCostUsd(...)` for the
|
|
1378
1454
|
* gateway's real per-call cost (see {@link GenerateTextResult.providerMetadata}). */
|
|
@@ -1382,8 +1458,7 @@ export declare interface GenerateImageResult {
|
|
|
1382
1458
|
export declare const generateObject: <A, I>(options: GenerateObjectOptions<A, I>) => Effect.Effect<GenerateObjectResult<A>, AiError>;
|
|
1383
1459
|
|
|
1384
1460
|
/**
|
|
1385
|
-
* Structured output against
|
|
1386
|
-
* step.
|
|
1461
|
+
* Structured output validated against its already-rendered JSON Schema.
|
|
1387
1462
|
*
|
|
1388
1463
|
* Extracted from `generateObject` rather than written beside it: an offloaded
|
|
1389
1464
|
* inference is performed by a dispatcher that has the stored JSON Schema and no
|
|
@@ -1402,6 +1477,7 @@ export declare interface GenerateObjectJsonOptions {
|
|
|
1402
1477
|
readonly provider?: ProviderConfig;
|
|
1403
1478
|
readonly fallbacks?: ProviderFallbacks;
|
|
1404
1479
|
readonly maxTokens?: number;
|
|
1480
|
+
readonly temperature?: number;
|
|
1405
1481
|
readonly providerOptions?: AiProviderOptions;
|
|
1406
1482
|
}
|
|
1407
1483
|
|
|
@@ -1418,6 +1494,7 @@ export declare interface GenerateObjectOptions<A, I> {
|
|
|
1418
1494
|
* mismatch); only a `generation` failure does. */
|
|
1419
1495
|
readonly fallbacks?: ProviderFallbacks;
|
|
1420
1496
|
readonly maxTokens?: number;
|
|
1497
|
+
readonly temperature?: number;
|
|
1421
1498
|
/** Provider-specific options forwarded to the SDK (e.g. reasoning effort).
|
|
1422
1499
|
* See `AiProviderOptions`. */
|
|
1423
1500
|
readonly providerOptions?: AiProviderOptions;
|
|
@@ -1425,6 +1502,8 @@ export declare interface GenerateObjectOptions<A, I> {
|
|
|
1425
1502
|
|
|
1426
1503
|
export declare interface GenerateObjectResult<A> {
|
|
1427
1504
|
readonly object: A;
|
|
1505
|
+
/** Allowlisted usage/cost evidence from the provider that actually answered. */
|
|
1506
|
+
readonly evidence: AiCallEvidence;
|
|
1428
1507
|
readonly usage: {
|
|
1429
1508
|
readonly inputTokens: number | undefined;
|
|
1430
1509
|
readonly outputTokens: number | undefined;
|
|
@@ -1466,6 +1545,7 @@ export declare interface GenerateObjectWithToolsOptions<A, I> {
|
|
|
1466
1545
|
/** Ordered provider/model fallback chain — see {@link ProviderFallbacks}. */
|
|
1467
1546
|
readonly fallbacks?: ProviderFallbacks;
|
|
1468
1547
|
readonly maxTokens?: number;
|
|
1548
|
+
readonly temperature?: number;
|
|
1469
1549
|
/** Provider-specific options forwarded to the SDK (e.g. reasoning effort).
|
|
1470
1550
|
* See `AiProviderOptions`. */
|
|
1471
1551
|
readonly providerOptions?: AiProviderOptions;
|
|
@@ -1487,6 +1567,8 @@ export declare const generateSpeech: (options: GenerateSpeechOptions) => Effect.
|
|
|
1487
1567
|
export declare interface GenerateSpeechOptions {
|
|
1488
1568
|
/** Text to speak. */
|
|
1489
1569
|
readonly text: string;
|
|
1570
|
+
/** Interrupt native or registered providers and signal their I/O. */
|
|
1571
|
+
readonly abortSignal?: AbortSignal;
|
|
1490
1572
|
/** Override the provider/model (defaults to `providerFromEnv()`). `anthropic`
|
|
1491
1573
|
* has no speech model; use `openai` or `gateway`. */
|
|
1492
1574
|
readonly provider?: ProviderConfig | RegisteredSpeechConfig;
|
|
@@ -1525,10 +1607,7 @@ export declare interface GenerateSpeechResult {
|
|
|
1525
1607
|
}
|
|
1526
1608
|
|
|
1527
1609
|
/**
|
|
1528
|
-
* Generate text from a
|
|
1529
|
-
* plus a usage tally; provider-specific extras (tool calls, finish reason)
|
|
1530
|
-
* are dropped — a richer surface will follow when the framework grows
|
|
1531
|
-
* dedicated *.agent.tsx primitives that need them.
|
|
1610
|
+
* Generate text from a prompt or conversation. Returns text, sources and usage.
|
|
1532
1611
|
*/
|
|
1533
1612
|
export declare const generateText: (options: GenerateTextOptions) => Effect.Effect<GenerateTextResult, AiError>;
|
|
1534
1613
|
|
|
@@ -1542,7 +1621,9 @@ export declare interface GenerateTextOptions {
|
|
|
1542
1621
|
/** Request context threaded into the tool executors. */
|
|
1543
1622
|
readonly toolContext?: ToolContext;
|
|
1544
1623
|
/** The user prompt. The SDK auto-wraps it as the single user message. */
|
|
1545
|
-
readonly prompt
|
|
1624
|
+
readonly prompt?: string;
|
|
1625
|
+
/** Complete conversation, including the latest user message. Supply instead of prompt. */
|
|
1626
|
+
readonly messages?: ReadonlyArray<ModelMessage>;
|
|
1546
1627
|
/** Optional system message. Steers the model independently of the prompt. */
|
|
1547
1628
|
readonly system?: string;
|
|
1548
1629
|
/** Override the provider/model for a single call. */
|
|
@@ -1551,6 +1632,8 @@ export declare interface GenerateTextOptions {
|
|
|
1551
1632
|
readonly fallbacks?: ProviderFallbacks;
|
|
1552
1633
|
/** Soft ceiling on output tokens. Provider-dependent. */
|
|
1553
1634
|
readonly maxTokens?: number;
|
|
1635
|
+
/** Model sampling temperature; explicit zero is preserved. Provider support varies. */
|
|
1636
|
+
readonly temperature?: number;
|
|
1554
1637
|
/** Provider-specific options forwarded to the SDK (e.g. reasoning effort).
|
|
1555
1638
|
* See `AiProviderOptions`. */
|
|
1556
1639
|
readonly providerOptions?: AiProviderOptions;
|
|
@@ -1558,6 +1641,7 @@ export declare interface GenerateTextOptions {
|
|
|
1558
1641
|
|
|
1559
1642
|
export declare interface GenerateTextResult {
|
|
1560
1643
|
readonly text: string;
|
|
1644
|
+
readonly sources: ReadonlyArray<LanguageModelV4Source>;
|
|
1561
1645
|
readonly usage: {
|
|
1562
1646
|
readonly inputTokens: number | undefined;
|
|
1563
1647
|
readonly outputTokens: number | undefined;
|
|
@@ -1586,22 +1670,33 @@ export declare interface GenerateTextResult {
|
|
|
1586
1670
|
*/
|
|
1587
1671
|
export declare const generateVideo: (options: GenerateVideoOptions) => Effect.Effect<GenerateVideoResult, AiError>;
|
|
1588
1672
|
|
|
1673
|
+
/** A URL shorthand or an explicitly typed file/URL for provider routing. */
|
|
1674
|
+
export declare type GenerateVideoInput = string | Experimental_VideoModelV4File;
|
|
1675
|
+
|
|
1589
1676
|
export declare interface GenerateVideoInputs {
|
|
1590
1677
|
/** Reference / starting-frame image URL (image-to-video). */
|
|
1591
|
-
readonly image?:
|
|
1678
|
+
readonly image?: GenerateVideoInput;
|
|
1592
1679
|
/** Reference image/video URLs (reference-to-video). */
|
|
1593
|
-
readonly references?: ReadonlyArray<
|
|
1680
|
+
readonly references?: ReadonlyArray<GenerateVideoInput>;
|
|
1681
|
+
readonly frameImages?: ReadonlyArray<{
|
|
1682
|
+
readonly frameType: 'first_frame' | 'last_frame';
|
|
1683
|
+
readonly image: GenerateVideoInput;
|
|
1684
|
+
}>;
|
|
1594
1685
|
}
|
|
1595
1686
|
|
|
1596
1687
|
export declare interface GenerateVideoOptions {
|
|
1597
1688
|
/** What to animate. */
|
|
1598
1689
|
readonly prompt: string;
|
|
1690
|
+
/** Interrupt the call and signal provider I/O. Fiber interruption does the same. */
|
|
1691
|
+
readonly abortSignal?: AbortSignal;
|
|
1599
1692
|
/** Override the provider/model (defaults to `providerFromEnv()`). Only the
|
|
1600
1693
|
* Vercel AI Gateway (`gateway`) ships a video model among the wired
|
|
1601
1694
|
* providers; `openai` / `anthropic` raise an `AiError`. */
|
|
1602
1695
|
readonly provider?: ProviderConfig;
|
|
1603
1696
|
readonly params?: GenerateVideoParams;
|
|
1604
1697
|
readonly inputs?: GenerateVideoInputs;
|
|
1698
|
+
/** Maximum decoded inline video bytes. Default 64 MiB; URL results are not downloaded. */
|
|
1699
|
+
readonly maxInlineBytes?: number;
|
|
1605
1700
|
/** Provider-specific options forwarded to the model. */
|
|
1606
1701
|
readonly providerOptions?: AiProviderOptions;
|
|
1607
1702
|
}
|
|
@@ -1612,6 +1707,7 @@ export declare interface GenerateVideoParams {
|
|
|
1612
1707
|
readonly resolution?: `${number}x${number}`;
|
|
1613
1708
|
readonly fps?: number;
|
|
1614
1709
|
readonly seed?: number;
|
|
1710
|
+
readonly generateAudio?: boolean;
|
|
1615
1711
|
}
|
|
1616
1712
|
|
|
1617
1713
|
export declare interface GenerateVideoResult {
|
|
@@ -2017,6 +2113,10 @@ export declare interface McpToolInfo {
|
|
|
2017
2113
|
readonly name: string;
|
|
2018
2114
|
readonly description: string;
|
|
2019
2115
|
readonly inputSchema: Record<string, unknown>;
|
|
2116
|
+
/** Advertised execution contract. This client does not negotiate MCP tasks. */
|
|
2117
|
+
readonly execution?: {
|
|
2118
|
+
readonly taskSupport: 'forbidden' | 'optional' | 'required';
|
|
2119
|
+
};
|
|
2020
2120
|
/**
|
|
2021
2121
|
* The server's own hints about the tool. ADVISORY ONLY — see
|
|
2022
2122
|
* `mcpTools.ts`; the server is the untrusted party, so its claim that a tool
|
|
@@ -2128,11 +2228,6 @@ export declare interface MediaUsage {
|
|
|
2128
2228
|
*/
|
|
2129
2229
|
export declare const memoryResumableStreamStore: () => ResumableStreamStore;
|
|
2130
2230
|
|
|
2131
|
-
/**
|
|
2132
|
-
* One structured part of an assistant message. Either streamed assistant text
|
|
2133
|
-
* or a record of a tool call + its result. Stored in `agent_messages.parts`
|
|
2134
|
-
* and rendered by the frontend (`toUIMessages`).
|
|
2135
|
-
*/
|
|
2136
2231
|
export declare type MessagePart = {
|
|
2137
2232
|
readonly type: 'text';
|
|
2138
2233
|
readonly text: string;
|
|
@@ -2155,22 +2250,12 @@ export declare type MessagePart = {
|
|
|
2155
2250
|
/** A cited source (RAG / web-search grounding). `url` variant carries `url`;
|
|
2156
2251
|
* `document` variant carries `mediaType`/`filename`. Rendered as a citation
|
|
2157
2252
|
* chip / footnote. */
|
|
2158
|
-
|
|
|
2159
|
-
readonly type: 'source';
|
|
2160
|
-
readonly sourceType: 'url' | 'document';
|
|
2161
|
-
readonly id: string;
|
|
2162
|
-
readonly url?: string;
|
|
2163
|
-
readonly title?: string;
|
|
2164
|
-
readonly mediaType?: string;
|
|
2165
|
-
readonly filename?: string;
|
|
2166
|
-
}
|
|
2253
|
+
| StoredEventPart<'source'>
|
|
2167
2254
|
/** An inline file the model produced (usually an image): IANA `mediaType` +
|
|
2168
2255
|
* base64 `data`. A UI renders `image/*` inline. */
|
|
2169
|
-
|
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
readonly data: string;
|
|
2173
|
-
};
|
|
2256
|
+
| StoredEventPart<'file'>
|
|
2257
|
+
/** Provider-owned attribution for each model step, not answer text. */
|
|
2258
|
+
| StoredEventPart<'stepMetadata'>;
|
|
2174
2259
|
|
|
2175
2260
|
/**
|
|
2176
2261
|
* A tally in a unit that is not tokens.
|
|
@@ -2799,6 +2884,13 @@ export declare interface RegisterSpeechProviderOptions {
|
|
|
2799
2884
|
*/
|
|
2800
2885
|
export declare const registerStream: (streamId: string) => AbortController;
|
|
2801
2886
|
|
|
2887
|
+
/** Release the STORED amount once. Supply the owning tenant, never an amount.
|
|
2888
|
+
* A missing/expired receipt cannot be reconstructed and returns not-found. */
|
|
2889
|
+
export declare const releaseAiBudget: (store: DataStore, opts: {
|
|
2890
|
+
readonly reservationId: string;
|
|
2891
|
+
readonly tenantId: string | null;
|
|
2892
|
+
}) => Effect.Effect<"released" | "already-released" | "not-found">;
|
|
2893
|
+
|
|
2802
2894
|
export declare const releasedAtOf: (raw: RawGatewayModel) => string | undefined;
|
|
2803
2895
|
|
|
2804
2896
|
/** What `.render(vars)` produces — a stamp plus the text to send. */
|
|
@@ -2816,36 +2908,17 @@ export declare interface RenderedPrompt extends PromptStamp {
|
|
|
2816
2908
|
/** Whether `name` is a registration standing in front of a built-in. */
|
|
2817
2909
|
export declare const replacesBuiltinSpeechProvider: (name: string) => boolean;
|
|
2818
2910
|
|
|
2819
|
-
/**
|
|
2820
|
-
*
|
|
2821
|
-
* the
|
|
2822
|
-
*
|
|
2823
|
-
* when `reserved + addUsd` would exceed `limitUsd`. Call it BEFORE the provider
|
|
2824
|
-
* call, estimating `addUsd` from the prompt; record the actual cost with
|
|
2825
|
-
* `recordAiUsage` after (for the spend dashboard).
|
|
2826
|
-
*
|
|
2827
|
-
* Cross-replica-safe WITHOUT a `SELECT … FOR UPDATE` (the DataStore contract
|
|
2828
|
-
* exposes no row lock): a bounded compare-and-set loop over the single
|
|
2829
|
-
* `_voltro_ai_budget` counter row for the bucket. Read the counter, decide,
|
|
2830
|
-
* then EITHER conditionally `updateMany` the row only if the reservation we
|
|
2831
|
-
* read still holds (`affected === 1` ⇒ we won) OR `insertIgnore` the first row
|
|
2832
|
-
* (ON CONFLICT over the UNIQUE `bucket`). A lost CAS / ignored insert means a
|
|
2833
|
-
* concurrent reservation moved the counter → retry. So N concurrent calls
|
|
2834
|
-
* reserve exactly the budgeted amount — no overshoot — where the old
|
|
2835
|
-
* check-then-act SUM admitted all of them.
|
|
2836
|
-
*
|
|
2837
|
-
* NB the reservation is optimistic: it does NOT auto-release if the provider
|
|
2838
|
-
* call later fails (like billing's consume). For a rolling budget that's the
|
|
2839
|
-
* correct conservative bound; a rare failed-call over-reservation ages out with
|
|
2840
|
-
* the window. Pass `addUsd: 0` to check-only (no reservation) — useful for a UI
|
|
2841
|
-
* pre-flight where you don't want to consume headroom.
|
|
2842
|
-
*/
|
|
2911
|
+
/** Reserve before provider I/O. Reuse reservationId only for the same logical
|
|
2912
|
+
* spend, tenant, amount and window. Zero is check-only and returns null.
|
|
2913
|
+
* Call outside another transaction; the receipt and counter need one commit.
|
|
2914
|
+
* A provider failure does not automatically release possibly billed spend. */
|
|
2843
2915
|
export declare const requireAiBudget: (store: DataStore, opts: {
|
|
2844
2916
|
readonly tenantId?: string | null;
|
|
2845
2917
|
readonly limitUsd: number;
|
|
2846
2918
|
readonly addUsd?: number;
|
|
2847
2919
|
readonly since?: Date;
|
|
2848
|
-
|
|
2920
|
+
readonly reservationId?: string;
|
|
2921
|
+
}) => Effect.Effect<AiBudgetReservation | null, AiBudgetExceeded>;
|
|
2849
2922
|
|
|
2850
2923
|
/**
|
|
2851
2924
|
* Rerank `documents` by relevance to `query`, highest score first. Returns
|
|
@@ -3302,10 +3375,18 @@ export declare const SeqEvent: Schema.Struct<{
|
|
|
3302
3375
|
title: Schema.optional<typeof Schema.String>;
|
|
3303
3376
|
mediaType: Schema.optional<typeof Schema.String>;
|
|
3304
3377
|
filename: Schema.optional<typeof Schema.String>;
|
|
3378
|
+
/** Provider-owned citation attribution; not normalized or interpreted. */
|
|
3379
|
+
providerMetadata: Schema.optional<typeof Schema.Unknown>;
|
|
3305
3380
|
}>, Schema.Struct<{
|
|
3306
3381
|
_tag: Schema.Literal<["file"]>;
|
|
3307
3382
|
mediaType: typeof Schema.String;
|
|
3308
3383
|
data: typeof Schema.String;
|
|
3384
|
+
/** Metadata for this file, not the whole model step. */
|
|
3385
|
+
providerMetadata: Schema.optional<typeof Schema.Unknown>;
|
|
3386
|
+
}>, Schema.Struct<{
|
|
3387
|
+
_tag: Schema.Literal<["stepMetadata"]>;
|
|
3388
|
+
step: Schema.filter<typeof Schema.Int>;
|
|
3389
|
+
providerMetadata: typeof Schema.Unknown;
|
|
3309
3390
|
}>, Schema.Struct<{
|
|
3310
3391
|
_tag: Schema.Literal<["message"]>;
|
|
3311
3392
|
role: typeof Schema.String;
|
|
@@ -3365,6 +3446,8 @@ export declare const speechProvider: (name: string) => SpeechProvider | undefine
|
|
|
3365
3446
|
* minus the parts the framework resolves. */
|
|
3366
3447
|
export declare interface SpeechSynthesisRequest {
|
|
3367
3448
|
readonly text: string;
|
|
3449
|
+
/** Aborted on external cancellation or Effect interruption; pass to provider I/O. */
|
|
3450
|
+
readonly abortSignal?: AbortSignal;
|
|
3368
3451
|
readonly model?: string;
|
|
3369
3452
|
readonly voice?: string;
|
|
3370
3453
|
readonly outputFormat?: string;
|
|
@@ -3376,9 +3459,10 @@ export declare interface SpeechSynthesisRequest {
|
|
|
3376
3459
|
|
|
3377
3460
|
/**
|
|
3378
3461
|
* Run the underlying stream ONCE and persist every event. Assigns a monotonic
|
|
3379
|
-
* `seq
|
|
3380
|
-
*
|
|
3381
|
-
*
|
|
3462
|
+
* `seq` and persists a terminal event BEFORE marking done. Defects, a throwing
|
|
3463
|
+
* source factory, missing terminals and producer interruption become sanitized
|
|
3464
|
+
* error events. If persistence itself fails, the Effect fails; it must not
|
|
3465
|
+
* advertise a completed log. A process kill cannot run this finalization.
|
|
3382
3466
|
*/
|
|
3383
3467
|
export declare const startResumableProducer: (streamId: string, store: ResumableStreamStore, source: () => Stream.Stream<AgentEvent>) => Effect.Effect<void>;
|
|
3384
3468
|
|
|
@@ -3407,6 +3491,17 @@ export declare interface StdioMcpTransportOptions {
|
|
|
3407
3491
|
readonly bounds?: Partial<McpBounds>;
|
|
3408
3492
|
}
|
|
3409
3493
|
|
|
3494
|
+
/**
|
|
3495
|
+
* One structured part of an assistant message. Either streamed assistant text
|
|
3496
|
+
* or a record of a tool call + its result. Stored in `agent_messages.parts`
|
|
3497
|
+
* and rendered by the frontend (`toUIMessages`).
|
|
3498
|
+
*/
|
|
3499
|
+
declare type StoredEventPart<Tag extends AgentEvent['_tag']> = Omit<Extract<AgentEvent, {
|
|
3500
|
+
_tag: Tag;
|
|
3501
|
+
}>, '_tag'> & {
|
|
3502
|
+
readonly type: Tag;
|
|
3503
|
+
};
|
|
3504
|
+
|
|
3410
3505
|
export declare const STREAM_EVENTS_TABLE = "_voltro_stream_events";
|
|
3411
3506
|
|
|
3412
3507
|
export declare const STREAM_STATE_TABLE = "_voltro_stream_state";
|
|
@@ -3461,6 +3556,7 @@ export declare interface StreamTextOptions {
|
|
|
3461
3556
|
* only the primary provider. */
|
|
3462
3557
|
readonly fallbacks?: ReadonlyArray<ProviderConfig>;
|
|
3463
3558
|
readonly maxTokens?: number;
|
|
3559
|
+
readonly temperature?: number;
|
|
3464
3560
|
/** Tools the model may call. The SDK dispatches them + loops. */
|
|
3465
3561
|
readonly tools?: Record<string, AnyTool>;
|
|
3466
3562
|
/** Max LLM↔tool round-trips before the loop stops. Default 8. */
|
|
@@ -3587,6 +3683,10 @@ export declare interface ToolContext {
|
|
|
3587
3683
|
readonly subject?: unknown;
|
|
3588
3684
|
};
|
|
3589
3685
|
readonly runtime?: Runtime.Runtime<unknown>;
|
|
3686
|
+
/** SDK tool-call identity for this execution, not a durable application idempotency key. */
|
|
3687
|
+
readonly invocationId?: string;
|
|
3688
|
+
/** The SDK's cancellation signal; Promise handlers must pass it to their I/O. */
|
|
3689
|
+
readonly abortSignal?: AbortSignal;
|
|
3590
3690
|
}
|
|
3591
3691
|
|
|
3592
3692
|
export declare interface ToolDef<A, I, O> {
|