@voltro/ai 0.84.0 → 0.85.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 +549 -0
- package/THIRD-PARTY-NOTICES.md +1 -119
- package/dist/agent.d.ts +34 -41
- package/dist/agent.js +1 -1
- package/dist/{agentDescriptor-DuxvWGDi.js → agentDescriptor-DhoiXVqO.js} +5 -5
- package/dist/agentEvent-Bl4egdM5.js +211 -0
- package/dist/events.d.ts +167 -168
- package/dist/events.js +1 -1
- package/dist/index.d.ts +317 -326
- package/dist/index.js +745 -576
- package/dist/{inferenceQueue-BmtEm3YI.js → inferenceQueue-DcEulZep.js} +200 -184
- package/dist/workflow.d.ts +10 -10
- package/dist/workflow.js +8 -8
- package/package.json +6 -6
- package/dist/agentEvent-BuXA7sRt.js +0 -152
package/dist/workflow.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { Context } from 'effect';
|
|
1
2
|
import { DataStore } from '@voltro/database';
|
|
2
3
|
import { Effect } from 'effect';
|
|
3
4
|
import { PluginMediaPersistMetadata } from '@voltro/protocol';
|
|
4
|
-
import { Runtime } from 'effect';
|
|
5
5
|
import { Schema } from 'effect';
|
|
6
6
|
import { StepRetryPolicy } from '@voltro/workflow';
|
|
7
7
|
|
|
@@ -39,7 +39,7 @@ declare type AiJsonValue = null | boolean | number | string | {
|
|
|
39
39
|
export declare const aiObjectStep: <A, I>(options: AiObjectStepOptions<A, I>) => Effect.Effect<A, unknown>;
|
|
40
40
|
|
|
41
41
|
export declare interface AiObjectStepOptions<A, I> extends AiStepBaseOptions {
|
|
42
|
-
readonly schema: Schema.
|
|
42
|
+
readonly schema: Schema.Codec<A, I>;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
export declare class AiOffloadError extends Error {
|
|
@@ -209,11 +209,11 @@ declare type AnthropicModel = 'claude-opus-4-8' | 'claude-sonnet-4-6' | 'claude-
|
|
|
209
209
|
declare interface AnyTool {
|
|
210
210
|
readonly name: string;
|
|
211
211
|
readonly description: string;
|
|
212
|
-
readonly input: Schema.
|
|
212
|
+
readonly input: Schema.Top;
|
|
213
213
|
/** See `ToolDef.inputJsonSchema` — a foreign parameter schema shown to the
|
|
214
214
|
* model in place of a rendered `input`. */
|
|
215
215
|
readonly inputJsonSchema?: Record<string, unknown>;
|
|
216
|
-
readonly output?: Schema.
|
|
216
|
+
readonly output?: Schema.Top;
|
|
217
217
|
readonly execute?: (input: never) => Effect.Effect<unknown, never, unknown>;
|
|
218
218
|
readonly handler?: ToolHandler<never, unknown>;
|
|
219
219
|
readonly timeoutMs?: number;
|
|
@@ -547,18 +547,18 @@ export declare const resolveStepPrompt: (options: Pick<AiStepBaseOptions, "promp
|
|
|
547
547
|
* CLI discovery path passes the real `AppContext`, which is a superset.
|
|
548
548
|
*
|
|
549
549
|
* `runtime` is the caller's ambient Effect `Runtime`. When present, tool
|
|
550
|
-
* bodies are run through it (`
|
|
550
|
+
* bodies are run through it (`Effect.runPromiseWith(runtime)(eff)`) instead of
|
|
551
551
|
* bare `Effect.runPromise`, so a body may `yield*` any service the caller's
|
|
552
552
|
* runtime carries — `JiraService`, the data store layer, `HttpClient`, … —
|
|
553
553
|
* rather than being limited to `R = never`. The agent loop
|
|
554
|
-
* (`streamText`/`runAssistant`) captures `yield* Effect.
|
|
554
|
+
* (`streamText`/`runAssistant`) captures `yield* Effect.context<never>()` and threads
|
|
555
555
|
* it here; without a runtime, behaviour is unchanged. */
|
|
556
556
|
declare interface ToolContext {
|
|
557
557
|
readonly store: unknown;
|
|
558
558
|
readonly request?: {
|
|
559
559
|
readonly subject?: unknown;
|
|
560
560
|
};
|
|
561
|
-
readonly runtime?:
|
|
561
|
+
readonly runtime?: Context.Context<never>;
|
|
562
562
|
/** SDK tool-call identity for this execution, not a durable application idempotency key. */
|
|
563
563
|
readonly invocationId?: string;
|
|
564
564
|
/** Cancellation from either the caller's turn or SDK invocation; Promise handlers must pass it to their I/O. */
|
|
@@ -628,9 +628,9 @@ declare type TranscriptionSource =
|
|
|
628
628
|
/** What a `transcribeStep` journals. Structural, because a durable step's
|
|
629
629
|
* success schema is what a replay decodes through — see `AiStepText`. */
|
|
630
630
|
export declare const TranscriptionStepResult: Schema.Struct<{
|
|
631
|
-
text:
|
|
632
|
-
language: Schema.optional<
|
|
633
|
-
durationSec: Schema.optional<
|
|
631
|
+
readonly text: Schema.String;
|
|
632
|
+
readonly language: Schema.optional<Schema.String>;
|
|
633
|
+
readonly durationSec: Schema.optional<Schema.Number>;
|
|
634
634
|
}>;
|
|
635
635
|
|
|
636
636
|
/** How much timestamp detail to ask for. Providers charge for it. */
|
package/dist/workflow.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as e } from "./provider-BnemgE4D.js";
|
|
2
|
-
import { D as t, O as n, T as r, V as i, b as a, k as o, m as s, o as c, p as l, q as u, rt as d, s as f, t as p, y as m } from "./inferenceQueue-
|
|
2
|
+
import { D as t, O as n, T as r, V as i, b as a, k as o, m as s, o as c, p as l, q as u, rt as d, s as f, t as p, y as m } from "./inferenceQueue-DcEulZep.js";
|
|
3
3
|
import { Effect as h, Schema as g } from "effect";
|
|
4
4
|
import { eq as _ } from "@voltro/database";
|
|
5
5
|
import { BudgetHoldExpired as v, CurrentWorkflowExecutionId as y, SuspensionUnavailable as b, WorkflowCannotPark as x, awaitSignalSuspending as S, step as C, suspendForBudget as w } from "@voltro/workflow";
|
|
@@ -61,7 +61,7 @@ var T = {
|
|
|
61
61
|
return n === void 0 || t === void 0 ? h.void : m(n, {
|
|
62
62
|
...t.definition,
|
|
63
63
|
digest: t.digest
|
|
64
|
-
}).pipe(h.asVoid, h.
|
|
64
|
+
}).pipe(h.asVoid, h.catchCause(() => h.void));
|
|
65
65
|
}, N = g.Struct({
|
|
66
66
|
text: g.String,
|
|
67
67
|
inputTokens: g.NullOr(g.Number),
|
|
@@ -170,7 +170,7 @@ var T = {
|
|
|
170
170
|
hasHeadroom: o().pipe(h.map((e) => e === null)),
|
|
171
171
|
...t.holdTimeoutMs === void 0 ? {} : { timeoutMs: t.holdTimeoutMs },
|
|
172
172
|
...t.recheckEveryMs === void 0 ? {} : { recheckEveryMs: t.recheckEveryMs }
|
|
173
|
-
}).pipe(h.
|
|
173
|
+
}).pipe(h.catch((e) => e instanceof v ? h.die(e) : h.fail(e))), yield* s());
|
|
174
174
|
}), V = (e, t) => h.promise(async () => {
|
|
175
175
|
let n = await e.query({
|
|
176
176
|
table: "_voltro_workflow_runs",
|
|
@@ -187,7 +187,7 @@ var T = {
|
|
|
187
187
|
operation: "generateText",
|
|
188
188
|
offloaded: t.offload === !0,
|
|
189
189
|
...O(i.text, i.system, t.recordPrompt ?? "digest", i.rendered)
|
|
190
|
-
}, o = (e) => t.budget === void 0 ? e : h.
|
|
190
|
+
}, o = (e) => t.budget === void 0 ? e : h.andThen(B(t), e);
|
|
191
191
|
return t.offload === !0 ? o(R(t, r, "text", null, a, i)) : o(C({
|
|
192
192
|
name: t.name,
|
|
193
193
|
success: N,
|
|
@@ -225,7 +225,7 @@ var T = {
|
|
|
225
225
|
...A(n),
|
|
226
226
|
operation: "transcribe",
|
|
227
227
|
offloaded: t.offload === !0
|
|
228
|
-
}, o = (e) => t.budget === void 0 ? e : h.
|
|
228
|
+
}, o = (e) => t.budget === void 0 ? e : h.andThen(B(t), e);
|
|
229
229
|
return t.offload === !0 ? o(R(t, n, "transcription", null, i, {
|
|
230
230
|
text: "",
|
|
231
231
|
system: void 0,
|
|
@@ -261,7 +261,7 @@ var T = {
|
|
|
261
261
|
modality: t.modality,
|
|
262
262
|
...O(r.text, void 0, t.recordPrompt ?? "digest", r.rendered)
|
|
263
263
|
};
|
|
264
|
-
return ((e) => t.budget === void 0 ? e : h.
|
|
264
|
+
return ((e) => t.budget === void 0 ? e : h.andThen(B(t), e))(R({
|
|
265
265
|
...t,
|
|
266
266
|
offload: !0
|
|
267
267
|
}, n, "media", null, a, r, void 0, i));
|
|
@@ -271,10 +271,10 @@ var T = {
|
|
|
271
271
|
operation: "generateObject",
|
|
272
272
|
offloaded: n.offload === !0,
|
|
273
273
|
...O(a.text, a.system, n.recordPrompt ?? "digest", a.rendered)
|
|
274
|
-
}, c = (e) => n.budget === void 0 ? e : h.
|
|
274
|
+
}, c = (e) => n.budget === void 0 ? e : h.andThen(B(n), e);
|
|
275
275
|
return n.offload === !0 ? c(h.gen(function* () {
|
|
276
276
|
let e = yield* o(n.schema, "aiObjectStep"), t = yield* R(n, i, "object", e, s, a);
|
|
277
|
-
return yield* g.
|
|
277
|
+
return yield* g.decodeUnknownEffect(n.schema)(t);
|
|
278
278
|
})) : c(C({
|
|
279
279
|
name: n.name,
|
|
280
280
|
success: n.schema,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voltro/ai",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.85.0",
|
|
4
4
|
"description": "Effect-native AI primitives — generateText / generateObject / streamText, tools, agents, media generation, cost tracking + budgets, and provider fallback.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"voltro",
|
|
@@ -55,10 +55,10 @@
|
|
|
55
55
|
"dependencies": {
|
|
56
56
|
"@ai-sdk/anthropic": "^4.0.56",
|
|
57
57
|
"@ai-sdk/openai": "^4.0.69",
|
|
58
|
-
"@voltro/cache": "0.
|
|
59
|
-
"@voltro/database": "0.
|
|
60
|
-
"@voltro/protocol": "0.
|
|
61
|
-
"@voltro/workflow": "0.
|
|
58
|
+
"@voltro/cache": "0.85.0",
|
|
59
|
+
"@voltro/database": "0.85.0",
|
|
60
|
+
"@voltro/protocol": "0.85.0",
|
|
61
|
+
"@voltro/workflow": "0.85.0",
|
|
62
62
|
"ajv": "^8.20.0",
|
|
63
63
|
"ajv-formats": "^3.0.1",
|
|
64
64
|
"ws": "^8.21.3"
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"@ai-sdk/gateway": "^4.0.74",
|
|
68
68
|
"@ai-sdk/provider": "^4.0.10",
|
|
69
69
|
"ai": "^7.0.92",
|
|
70
|
-
"effect": "
|
|
70
|
+
"effect": "4.0.1"
|
|
71
71
|
},
|
|
72
72
|
"publishConfig": {
|
|
73
73
|
"access": "public"
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
import { Schema as e } from "effect";
|
|
2
|
-
//#region src/transcriptionEvent.ts
|
|
3
|
-
var t = class extends e.TaggedError()("TranscriptionStreamError", {
|
|
4
|
-
reason: e.Literal("input", "unsupported", "provider", "cancelled"),
|
|
5
|
-
message: e.String
|
|
6
|
-
}) {}, n = e.Struct({
|
|
7
|
-
text: e.String,
|
|
8
|
-
start: e.Number,
|
|
9
|
-
end: e.Number
|
|
10
|
-
}), r = { id: e.optional(e.String) }, i = e.Union(e.Struct({
|
|
11
|
-
type: e.Literal("transcript-delta"),
|
|
12
|
-
...r,
|
|
13
|
-
delta: e.String
|
|
14
|
-
}), e.Struct({
|
|
15
|
-
type: e.Literal("transcript-partial"),
|
|
16
|
-
...r,
|
|
17
|
-
text: e.String,
|
|
18
|
-
startSecond: e.optional(e.Number),
|
|
19
|
-
durationInSeconds: e.optional(e.Number),
|
|
20
|
-
channelIndex: e.optional(e.Number)
|
|
21
|
-
}), e.Struct({
|
|
22
|
-
type: e.Literal("transcript-final"),
|
|
23
|
-
...r,
|
|
24
|
-
text: e.String,
|
|
25
|
-
startSecond: e.optional(e.Number),
|
|
26
|
-
endSecond: e.optional(e.Number),
|
|
27
|
-
channelIndex: e.optional(e.Number)
|
|
28
|
-
}), e.Struct({
|
|
29
|
-
type: e.Literal("finish"),
|
|
30
|
-
text: e.String,
|
|
31
|
-
segments: e.Array(n),
|
|
32
|
-
language: e.optional(e.String),
|
|
33
|
-
durationSec: e.optional(e.Number)
|
|
34
|
-
})), a = e.String.pipe(e.pattern(/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/)), o = e.Number.pipe(e.finite(), e.nonNegative()), s = e.Union(e.Struct({
|
|
35
|
-
type: e.Literal("input-audio-append"),
|
|
36
|
-
audio: a
|
|
37
|
-
}), e.Struct({ type: e.Literal("input-audio-commit", "input-audio-clear", "response-create", "response-cancel") }), e.Struct({
|
|
38
|
-
type: e.Literal("conversation-item-create"),
|
|
39
|
-
item: e.Struct({
|
|
40
|
-
type: e.Literal("text-message"),
|
|
41
|
-
role: e.Literal("user"),
|
|
42
|
-
text: e.String
|
|
43
|
-
})
|
|
44
|
-
}), e.Struct({
|
|
45
|
-
type: e.Literal("conversation-item-truncate"),
|
|
46
|
-
itemId: e.String,
|
|
47
|
-
contentIndex: o.pipe(e.int()),
|
|
48
|
-
audioEndMs: o
|
|
49
|
-
})), c = { itemId: e.String }, l = {
|
|
50
|
-
responseId: e.String,
|
|
51
|
-
...c
|
|
52
|
-
}, u = e.Union(e.Struct({ type: e.Literal("ready") }), e.Struct({
|
|
53
|
-
type: e.Literal("session-created"),
|
|
54
|
-
sessionId: e.optional(e.String)
|
|
55
|
-
}), e.Struct({ type: e.Literal("session-updated") }), e.Struct({
|
|
56
|
-
type: e.Literal("speech-started", "speech-stopped"),
|
|
57
|
-
itemId: e.optional(e.String)
|
|
58
|
-
}), e.Struct({
|
|
59
|
-
type: e.Literal("audio-committed"),
|
|
60
|
-
itemId: e.optional(e.String),
|
|
61
|
-
previousItemId: e.optional(e.String)
|
|
62
|
-
}), e.Struct({
|
|
63
|
-
type: e.Literal("conversation-item-added"),
|
|
64
|
-
...c
|
|
65
|
-
}), e.Struct({
|
|
66
|
-
type: e.Literal("input-transcription-completed"),
|
|
67
|
-
...c,
|
|
68
|
-
transcript: e.String
|
|
69
|
-
}), e.Struct({
|
|
70
|
-
type: e.Literal("response-created"),
|
|
71
|
-
responseId: e.String
|
|
72
|
-
}), e.Struct({
|
|
73
|
-
type: e.Literal("response-done"),
|
|
74
|
-
responseId: e.String,
|
|
75
|
-
status: e.String
|
|
76
|
-
}), e.Struct({
|
|
77
|
-
type: e.Literal("output-item-added", "output-item-done", "content-part-added", "content-part-done", "audio-done"),
|
|
78
|
-
...l
|
|
79
|
-
}), e.Struct({
|
|
80
|
-
type: e.Literal("audio-delta"),
|
|
81
|
-
...l,
|
|
82
|
-
delta: a
|
|
83
|
-
}), e.Struct({
|
|
84
|
-
type: e.Literal("text-delta", "audio-transcript-delta"),
|
|
85
|
-
...l,
|
|
86
|
-
delta: e.String
|
|
87
|
-
}), e.Struct({
|
|
88
|
-
type: e.Literal("text-done"),
|
|
89
|
-
...l,
|
|
90
|
-
text: e.optional(e.String)
|
|
91
|
-
}), e.Struct({
|
|
92
|
-
type: e.Literal("audio-transcript-done"),
|
|
93
|
-
...l,
|
|
94
|
-
transcript: e.optional(e.String)
|
|
95
|
-
})), d = e.Literal("provider", "tool", "timeout", "cancelled", "decode", "internal"), f = e.Struct({
|
|
96
|
-
inputTokens: e.optional(e.Number),
|
|
97
|
-
outputTokens: e.optional(e.Number),
|
|
98
|
-
totalTokens: e.optional(e.Number)
|
|
99
|
-
}), p = e.Union(e.Struct({
|
|
100
|
-
_tag: e.Literal("token"),
|
|
101
|
-
text: e.String
|
|
102
|
-
}), e.Struct({
|
|
103
|
-
_tag: e.Literal("reasoning"),
|
|
104
|
-
text: e.String
|
|
105
|
-
}), e.Struct({
|
|
106
|
-
_tag: e.Literal("toolCall"),
|
|
107
|
-
id: e.String,
|
|
108
|
-
name: e.String,
|
|
109
|
-
input: e.Unknown
|
|
110
|
-
}), e.Struct({
|
|
111
|
-
_tag: e.Literal("toolResult"),
|
|
112
|
-
id: e.String,
|
|
113
|
-
name: e.String,
|
|
114
|
-
output: e.optional(e.Unknown),
|
|
115
|
-
error: e.optional(e.String)
|
|
116
|
-
}), e.Struct({
|
|
117
|
-
_tag: e.Literal("source"),
|
|
118
|
-
sourceType: e.Literal("url", "document"),
|
|
119
|
-
id: e.String,
|
|
120
|
-
url: e.optional(e.String),
|
|
121
|
-
title: e.optional(e.String),
|
|
122
|
-
mediaType: e.optional(e.String),
|
|
123
|
-
filename: e.optional(e.String),
|
|
124
|
-
providerMetadata: e.optional(e.Unknown)
|
|
125
|
-
}), e.Struct({
|
|
126
|
-
_tag: e.Literal("file"),
|
|
127
|
-
mediaType: e.String,
|
|
128
|
-
data: e.String,
|
|
129
|
-
providerMetadata: e.optional(e.Unknown)
|
|
130
|
-
}), e.Struct({
|
|
131
|
-
_tag: e.Literal("stepMetadata"),
|
|
132
|
-
step: e.Int.pipe(e.nonNegative()),
|
|
133
|
-
providerMetadata: e.Unknown
|
|
134
|
-
}), e.Struct({
|
|
135
|
-
_tag: e.Literal("message"),
|
|
136
|
-
role: e.String,
|
|
137
|
-
content: e.String
|
|
138
|
-
}), e.Struct({
|
|
139
|
-
_tag: e.Literal("error"),
|
|
140
|
-
code: d,
|
|
141
|
-
message: e.String,
|
|
142
|
-
retryable: e.Boolean
|
|
143
|
-
}), e.Struct({
|
|
144
|
-
_tag: e.Literal("done"),
|
|
145
|
-
finishReason: e.String,
|
|
146
|
-
usage: f
|
|
147
|
-
})), m = e.Struct({
|
|
148
|
-
seq: e.Number,
|
|
149
|
-
event: p
|
|
150
|
-
});
|
|
151
|
-
//#endregion
|
|
152
|
-
export { u as a, s as i, p as n, t as o, m as r, i as s, d as t };
|