@voltro/ai 0.58.0 → 0.59.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 +55 -0
- package/dist/index.d.ts +106 -9
- package/dist/index.js +451 -453
- package/dist/{inferenceQueue-EQJJepZ8.js → inferenceQueue-CS1VouiW.js} +213 -192
- package/dist/workflow.js +14 -14
- package/package.json +5 -5
package/dist/workflow.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as e } from "./provider-BOgeCRkg.js";
|
|
2
|
-
import { B as t, D as n,
|
|
2
|
+
import { B as t, D as n, G as r, K as i, O as a, b as o, m as s, o as c, p as l, s as u, t as d, w as f, y as p } from "./inferenceQueue-CS1VouiW.js";
|
|
3
3
|
import { Effect as m, Schema as h } from "effect";
|
|
4
4
|
import { eq as g } from "@voltro/database";
|
|
5
5
|
import { CurrentWorkflowExecutionId as _, awaitSignalSuspending as v, step as y, suspendForBudget as b } from "@voltro/workflow";
|
|
@@ -42,14 +42,14 @@ var x = {
|
|
|
42
42
|
}, E = (e) => ({
|
|
43
43
|
provider: String(e.provider ?? "unknown"),
|
|
44
44
|
model: String(e.model ?? "unknown")
|
|
45
|
-
}), D = (e, n,
|
|
45
|
+
}), D = (e, n, i, a, o) => {
|
|
46
46
|
let s = e.store;
|
|
47
47
|
if (s === void 0) return m.void;
|
|
48
48
|
let { provider: c, model: l } = E(n), u = t(a.providerMetadata);
|
|
49
|
-
return
|
|
49
|
+
return r(s, {
|
|
50
50
|
provider: c,
|
|
51
51
|
model: l,
|
|
52
|
-
operation:
|
|
52
|
+
operation: i,
|
|
53
53
|
agent: e.name,
|
|
54
54
|
usage: a.usage,
|
|
55
55
|
...e.tenantId === void 0 ? {} : { tenantId: e.tenantId },
|
|
@@ -136,12 +136,12 @@ var x = {
|
|
|
136
136
|
if (t === void 0) return;
|
|
137
137
|
let n = e.store;
|
|
138
138
|
if (n === void 0) return yield* m.die(new F(e.name));
|
|
139
|
-
let r = e.tenantId ?? null,
|
|
139
|
+
let r = e.tenantId ?? null, a = t.name ?? "ai-usd", o = () => i(n, {
|
|
140
140
|
tenantId: r,
|
|
141
141
|
limitUsd: t.limitUsd,
|
|
142
142
|
addUsd: 0,
|
|
143
143
|
...t.since === void 0 ? {} : { since: t.since }
|
|
144
|
-
}).pipe(m.as(null), m.catchTag("AiBudgetExceeded", (e) => m.succeed(e))), s = () => t.estimateUsd === void 0 ? m.void :
|
|
144
|
+
}).pipe(m.as(null), m.catchTag("AiBudgetExceeded", (e) => m.succeed(e))), s = () => t.estimateUsd === void 0 ? m.void : i(n, {
|
|
145
145
|
tenantId: r,
|
|
146
146
|
limitUsd: t.limitUsd,
|
|
147
147
|
addUsd: t.estimateUsd,
|
|
@@ -152,7 +152,7 @@ var x = {
|
|
|
152
152
|
let l = yield* _;
|
|
153
153
|
return l === void 0 ? yield* m.fail(c) : (yield* b({
|
|
154
154
|
store: n,
|
|
155
|
-
budget:
|
|
155
|
+
budget: a,
|
|
156
156
|
tenantId: r,
|
|
157
157
|
executionId: l,
|
|
158
158
|
workflowName: yield* L(n, l),
|
|
@@ -235,29 +235,29 @@ var x = {
|
|
|
235
235
|
})))
|
|
236
236
|
}));
|
|
237
237
|
}, V = (t) => {
|
|
238
|
-
let n = t.provider ?? e(),
|
|
238
|
+
let n = t.provider ?? e(), r = T(t), i = {
|
|
239
239
|
...E(n),
|
|
240
240
|
operation: "generateObject",
|
|
241
241
|
offloaded: t.offload === !0,
|
|
242
|
-
...w(
|
|
242
|
+
...w(r.text, r.system, t.recordPrompt ?? "digest", r.rendered)
|
|
243
243
|
}, o = (e) => t.budget === void 0 ? e : m.zipRight(I(t), e);
|
|
244
244
|
return t.offload === !0 ? o(m.gen(function* () {
|
|
245
|
-
let e = yield*
|
|
245
|
+
let e = yield* a(t.schema, "aiObjectStep"), o = yield* P(t, n, "object", e, i, r);
|
|
246
246
|
return yield* h.decodeUnknown(t.schema)(o);
|
|
247
247
|
})) : o(y({
|
|
248
248
|
name: t.name,
|
|
249
249
|
success: t.schema,
|
|
250
|
-
input:
|
|
250
|
+
input: i,
|
|
251
251
|
retry: t.retry ?? x,
|
|
252
252
|
execute: f({
|
|
253
|
-
prompt:
|
|
253
|
+
prompt: r.text,
|
|
254
254
|
schema: t.schema,
|
|
255
255
|
provider: n,
|
|
256
|
-
...
|
|
256
|
+
...r.system === void 0 ? {} : { system: r.system },
|
|
257
257
|
...t.fallbacks === void 0 ? {} : { fallbacks: t.fallbacks },
|
|
258
258
|
...t.maxTokens === void 0 ? {} : { maxTokens: t.maxTokens },
|
|
259
259
|
...t.providerOptions === void 0 ? {} : { providerOptions: t.providerOptions }
|
|
260
|
-
}).pipe(m.tap((e) => D(t, n, "generateObject", e,
|
|
260
|
+
}).pipe(m.tap((e) => D(t, n, "generateObject", e, r.rendered)), m.tap(() => O(t, r.rendered)), m.map((e) => e.object))
|
|
261
261
|
}));
|
|
262
262
|
};
|
|
263
263
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voltro/ai",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.59.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",
|
|
@@ -57,10 +57,10 @@
|
|
|
57
57
|
"@ai-sdk/gateway": "^4.0.47",
|
|
58
58
|
"@ai-sdk/openai": "^4.0.37",
|
|
59
59
|
"@ai-sdk/provider": "^4.0.7",
|
|
60
|
-
"@voltro/cache": "0.
|
|
61
|
-
"@voltro/database": "0.
|
|
62
|
-
"@voltro/protocol": "0.
|
|
63
|
-
"@voltro/workflow": "0.
|
|
60
|
+
"@voltro/cache": "0.59.0",
|
|
61
|
+
"@voltro/database": "0.59.0",
|
|
62
|
+
"@voltro/protocol": "0.59.0",
|
|
63
|
+
"@voltro/workflow": "0.59.0",
|
|
64
64
|
"ai": "^7.0.59"
|
|
65
65
|
},
|
|
66
66
|
"peerDependencies": {
|