@voltro/ai 0.63.0 → 0.65.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 +157 -0
- package/dist/agent.d.ts +54 -3
- package/dist/agent.js +2 -2
- package/dist/agentDescriptor-DuxvWGDi.js +63 -0
- package/dist/index.d.ts +113 -16
- package/dist/index.js +424 -381
- package/dist/{inferenceQueue-CS1VouiW.js → inferenceQueue-BS3PVSkk.js} +85 -74
- package/dist/{provider-BOgeCRkg.js → provider-RA0getTL.js} +9 -2
- package/dist/test.js +13 -13
- package/dist/workflow.d.ts +56 -0
- package/dist/workflow.js +115 -101
- package/package.json +5 -5
- package/dist/agentDescriptor-Bv-ikWax.js +0 -46
package/dist/workflow.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { r as e } from "./provider-
|
|
2
|
-
import { B as t, D as n,
|
|
3
|
-
import { Effect as
|
|
4
|
-
import { eq as
|
|
5
|
-
import { CurrentWorkflowExecutionId as
|
|
1
|
+
import { r as e } from "./provider-RA0getTL.js";
|
|
2
|
+
import { B as t, D as n, E as r, G as i, K as a, O as o, b as s, m as c, o as l, p as u, s as d, t as f, w as p, y as m } from "./inferenceQueue-BS3PVSkk.js";
|
|
3
|
+
import { Effect as h, Schema as g } from "effect";
|
|
4
|
+
import { eq as _ } from "@voltro/database";
|
|
5
|
+
import { CurrentWorkflowExecutionId as v, awaitSignalSuspending as y, step as b, suspendForBudget as x } from "@voltro/workflow";
|
|
6
6
|
//#region src/inferStep.ts
|
|
7
|
-
var
|
|
7
|
+
var S = {
|
|
8
8
|
maxAttempts: 4,
|
|
9
9
|
strategy: "exponential",
|
|
10
10
|
baseDelay: "1 second",
|
|
11
11
|
maxDelay: "30 seconds",
|
|
12
12
|
jitter: !0,
|
|
13
13
|
respectRetryAfter: !0
|
|
14
|
-
},
|
|
14
|
+
}, C = 36e5, w = "ai-usd", T = (e, t, n, r) => {
|
|
15
15
|
let i = r === void 0 ? {} : {
|
|
16
16
|
promptId: r.promptId,
|
|
17
17
|
promptVersion: r.digest,
|
|
@@ -24,14 +24,14 @@ var x = {
|
|
|
24
24
|
...t === void 0 ? {} : { system: t }
|
|
25
25
|
} : {
|
|
26
26
|
...i,
|
|
27
|
-
promptDigest:
|
|
27
|
+
promptDigest: c(e),
|
|
28
28
|
promptChars: e.length,
|
|
29
29
|
...t === void 0 ? {} : {
|
|
30
|
-
systemDigest:
|
|
30
|
+
systemDigest: c(t),
|
|
31
31
|
systemChars: t.length
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
|
-
},
|
|
34
|
+
}, E = (e) => u(e.prompt) ? {
|
|
35
35
|
text: e.prompt.prompt,
|
|
36
36
|
system: e.system ?? e.prompt.system,
|
|
37
37
|
rendered: e.prompt
|
|
@@ -39,68 +39,68 @@ var x = {
|
|
|
39
39
|
text: e.prompt,
|
|
40
40
|
system: e.system,
|
|
41
41
|
rendered: void 0
|
|
42
|
-
},
|
|
42
|
+
}, D = (e) => ({
|
|
43
43
|
provider: String(e.provider ?? "unknown"),
|
|
44
44
|
model: String(e.model ?? "unknown")
|
|
45
|
-
}),
|
|
45
|
+
}), O = (e, n, r, a, o) => {
|
|
46
46
|
let s = e.store;
|
|
47
|
-
if (s === void 0) return
|
|
48
|
-
let { provider: c, model: l } =
|
|
49
|
-
return
|
|
47
|
+
if (s === void 0) return h.void;
|
|
48
|
+
let { provider: c, model: l } = D(n), u = t(a.providerMetadata);
|
|
49
|
+
return i(s, {
|
|
50
50
|
provider: c,
|
|
51
51
|
model: l,
|
|
52
|
-
operation:
|
|
52
|
+
operation: r,
|
|
53
53
|
agent: e.name,
|
|
54
54
|
usage: a.usage,
|
|
55
55
|
...e.tenantId === void 0 ? {} : { tenantId: e.tenantId },
|
|
56
56
|
...u === void 0 ? {} : { actualCostUsd: u },
|
|
57
57
|
...o === void 0 ? {} : { prompt: o }
|
|
58
|
-
}).pipe(
|
|
59
|
-
},
|
|
58
|
+
}).pipe(h.asVoid, h.catchAllCause(() => h.void));
|
|
59
|
+
}, k = (e, t) => {
|
|
60
60
|
let n = e.store;
|
|
61
|
-
return n === void 0 || t === void 0 ?
|
|
61
|
+
return n === void 0 || t === void 0 ? h.void : m(n, {
|
|
62
62
|
...t.definition,
|
|
63
63
|
digest: t.digest
|
|
64
|
-
}).pipe(
|
|
65
|
-
},
|
|
66
|
-
text:
|
|
67
|
-
inputTokens:
|
|
68
|
-
outputTokens:
|
|
69
|
-
totalTokens:
|
|
70
|
-
}),
|
|
64
|
+
}).pipe(h.asVoid, h.catchAllCause(() => h.void));
|
|
65
|
+
}, A = g.Struct({
|
|
66
|
+
text: g.String,
|
|
67
|
+
inputTokens: g.NullOr(g.Number),
|
|
68
|
+
outputTokens: g.NullOr(g.Number),
|
|
69
|
+
totalTokens: g.NullOr(g.Number)
|
|
70
|
+
}), j = (e) => typeof e == "object" && !!e && e.__voltro_ai_error === !0, M = class extends Error {
|
|
71
71
|
attempts;
|
|
72
72
|
constructor(e, t, n) {
|
|
73
73
|
super(`aiStep('${e}'): the offloaded model call gave up after ${n} attempt(s): ${t}. The queued call is in _voltro_ai_inferences with status 'failed' — the Flow tab shows it with the provider's own message.`), this.name = "AiOffloadError", this.attempts = n;
|
|
74
74
|
}
|
|
75
|
-
},
|
|
75
|
+
}, N = class extends Error {
|
|
76
76
|
constructor(e) {
|
|
77
77
|
super(`aiStep('${e}'): offload: true needs \`store\` — the queued call lives in a table and the dispatcher reads it from there. Pass ctx.store.`), this.name = "AiOffloadMisuseError";
|
|
78
78
|
}
|
|
79
|
-
},
|
|
79
|
+
}, P = (e, t, n, r, i, a) => h.gen(function* () {
|
|
80
80
|
let o = e.store;
|
|
81
|
-
if (o === void 0) return yield*
|
|
82
|
-
let s = yield*
|
|
83
|
-
if (s === void 0) return yield*
|
|
84
|
-
let { provider:
|
|
81
|
+
if (o === void 0) return yield* h.die(new N(e.name));
|
|
82
|
+
let s = yield* v;
|
|
83
|
+
if (s === void 0) return yield* h.die(/* @__PURE__ */ Error(`aiStep('${e.name}'): offload: true is only valid inside a workflow body — there is no execution to suspend here.`));
|
|
84
|
+
let { provider: c, model: u } = D(t), p = d(s, e.name), m = yield* h.promise(() => o.query({
|
|
85
85
|
table: "_voltro_workflow_runs",
|
|
86
|
-
predicate:
|
|
86
|
+
predicate: _("executionId", s),
|
|
87
87
|
order: [],
|
|
88
88
|
take: 1,
|
|
89
89
|
skip: void 0,
|
|
90
90
|
projection: void 0
|
|
91
|
-
})),
|
|
92
|
-
return yield*
|
|
91
|
+
})), g = String(m[0]?.tag ?? ""), y = m[0]?.id;
|
|
92
|
+
return yield* h.promise(() => o.insertIgnore(f, {
|
|
93
93
|
id: p,
|
|
94
94
|
tenantId: e.tenantId ?? null,
|
|
95
95
|
executionId: s,
|
|
96
|
-
workflowName:
|
|
96
|
+
workflowName: g,
|
|
97
97
|
runId: typeof y == "string" ? y : null,
|
|
98
|
-
signalName:
|
|
98
|
+
signalName: l(p),
|
|
99
99
|
stepName: e.name,
|
|
100
100
|
status: "pending",
|
|
101
101
|
kind: n,
|
|
102
|
-
provider:
|
|
103
|
-
model:
|
|
102
|
+
provider: c,
|
|
103
|
+
model: u,
|
|
104
104
|
prompt: i.text,
|
|
105
105
|
system: i.system ?? null,
|
|
106
106
|
promptId: i.rendered?.promptId ?? null,
|
|
@@ -113,97 +113,100 @@ var x = {
|
|
|
113
113
|
attempts: 0,
|
|
114
114
|
enqueuedAt: /* @__PURE__ */ new Date()
|
|
115
115
|
}, { conflictColumns: ["id"] })), p;
|
|
116
|
-
}),
|
|
117
|
-
let s = yield*
|
|
116
|
+
}), F = (e, t, n, r, i, a, o) => h.gen(function* () {
|
|
117
|
+
let s = yield* b({
|
|
118
118
|
name: `${e.name}:enqueue`,
|
|
119
|
-
success:
|
|
119
|
+
success: g.String,
|
|
120
120
|
input: i,
|
|
121
|
-
execute:
|
|
121
|
+
execute: P(e, t, n, r, a, o)
|
|
122
122
|
});
|
|
123
|
-
yield*
|
|
124
|
-
let
|
|
125
|
-
name:
|
|
126
|
-
schema:
|
|
123
|
+
yield* k(e, a.rendered);
|
|
124
|
+
let c = yield* y({ store: e.store }, {
|
|
125
|
+
name: l(s),
|
|
126
|
+
schema: g.Unknown,
|
|
127
127
|
timeoutMs: e.offloadTimeoutMs ?? 36e5
|
|
128
128
|
});
|
|
129
|
-
return
|
|
130
|
-
}),
|
|
129
|
+
return j(c) ? yield* h.die(new M(e.name, c.message, c.attempts)) : c;
|
|
130
|
+
}), I = class extends Error {
|
|
131
131
|
constructor(e) {
|
|
132
132
|
super(`aiStep('${e}'): budget needs \`store\` — the reservation counter and the hold both live in tables. Pass ctx.store.`), this.name = "AiBudgetMisuseError";
|
|
133
133
|
}
|
|
134
|
-
},
|
|
134
|
+
}, L = (e) => h.gen(function* () {
|
|
135
135
|
let t = e.budget;
|
|
136
136
|
if (t === void 0) return;
|
|
137
137
|
let n = e.store;
|
|
138
|
-
if (n === void 0) return yield*
|
|
139
|
-
let r = e.tenantId ?? null,
|
|
138
|
+
if (n === void 0) return yield* h.die(new I(e.name));
|
|
139
|
+
let r = e.tenantId ?? null, i = t.name ?? "ai-usd", o = () => a(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(
|
|
144
|
+
}).pipe(h.as(null), h.catchTag("AiBudgetExceeded", (e) => h.succeed(e))), s = () => t.estimateUsd === void 0 ? h.void : a(n, {
|
|
145
145
|
tenantId: r,
|
|
146
146
|
limitUsd: t.limitUsd,
|
|
147
147
|
addUsd: t.estimateUsd,
|
|
148
148
|
...t.since === void 0 ? {} : { since: t.since }
|
|
149
149
|
}), c = yield* o();
|
|
150
150
|
if (c === null) return yield* s();
|
|
151
|
-
if ((t.onExceeded ?? "fail") !== "suspend") return yield*
|
|
152
|
-
let l = yield*
|
|
153
|
-
return l === void 0 ? yield*
|
|
151
|
+
if ((t.onExceeded ?? "fail") !== "suspend") return yield* h.fail(c);
|
|
152
|
+
let l = yield* v;
|
|
153
|
+
return l === void 0 ? yield* h.fail(c) : (yield* x({
|
|
154
154
|
store: n,
|
|
155
|
-
budget:
|
|
155
|
+
budget: i,
|
|
156
156
|
tenantId: r,
|
|
157
157
|
executionId: l,
|
|
158
|
-
workflowName: yield*
|
|
158
|
+
workflowName: yield* R(n, l),
|
|
159
159
|
stepName: e.name,
|
|
160
160
|
spentMicroUsd: Math.round(c.spentUsd * 1e6),
|
|
161
161
|
limitMicroUsd: Math.round(t.limitUsd * 1e6),
|
|
162
|
-
hasHeadroom: o().pipe(
|
|
162
|
+
hasHeadroom: o().pipe(h.map((e) => e === null)),
|
|
163
163
|
...t.holdTimeoutMs === void 0 ? {} : { timeoutMs: t.holdTimeoutMs },
|
|
164
164
|
...t.recheckEveryMs === void 0 ? {} : { recheckEveryMs: t.recheckEveryMs }
|
|
165
|
-
}).pipe(
|
|
166
|
-
}),
|
|
165
|
+
}).pipe(h.catchAll((e) => h.die(e))), yield* s());
|
|
166
|
+
}), R = (e, t) => h.promise(async () => {
|
|
167
167
|
let n = await e.query({
|
|
168
168
|
table: "_voltro_workflow_runs",
|
|
169
|
-
predicate:
|
|
169
|
+
predicate: _("executionId", t),
|
|
170
170
|
order: [],
|
|
171
171
|
take: 1,
|
|
172
172
|
skip: void 0,
|
|
173
173
|
projection: void 0
|
|
174
174
|
});
|
|
175
175
|
return String(n[0]?.tag ?? "");
|
|
176
|
-
}),
|
|
177
|
-
let r = t.provider ?? e(), i =
|
|
178
|
-
...
|
|
176
|
+
}), z = (t) => {
|
|
177
|
+
let r = t.provider ?? e(), i = E(t), a = {
|
|
178
|
+
...D(r),
|
|
179
179
|
operation: "generateText",
|
|
180
180
|
offloaded: t.offload === !0,
|
|
181
|
-
...
|
|
182
|
-
}, o = (e) => t.budget === void 0 ? e :
|
|
183
|
-
return t.offload === !0 ? o(
|
|
181
|
+
...T(i.text, i.system, t.recordPrompt ?? "digest", i.rendered)
|
|
182
|
+
}, o = (e) => t.budget === void 0 ? e : h.zipRight(L(t), e);
|
|
183
|
+
return t.offload === !0 ? o(F(t, r, "text", null, a, i)) : o(b({
|
|
184
184
|
name: t.name,
|
|
185
|
-
success:
|
|
185
|
+
success: A,
|
|
186
186
|
input: a,
|
|
187
|
-
retry: t.retry ??
|
|
187
|
+
retry: t.retry ?? S,
|
|
188
188
|
execute: n({
|
|
189
189
|
prompt: i.text,
|
|
190
190
|
provider: r,
|
|
191
191
|
...i.system === void 0 ? {} : { system: i.system },
|
|
192
192
|
...t.fallbacks === void 0 ? {} : { fallbacks: t.fallbacks },
|
|
193
193
|
...t.maxTokens === void 0 ? {} : { maxTokens: t.maxTokens },
|
|
194
|
-
...t.providerOptions === void 0 ? {} : { providerOptions: t.providerOptions }
|
|
195
|
-
|
|
194
|
+
...t.providerOptions === void 0 ? {} : { providerOptions: t.providerOptions },
|
|
195
|
+
...t.tools === void 0 ? {} : { tools: t.tools },
|
|
196
|
+
...t.maxSteps === void 0 ? {} : { maxSteps: t.maxSteps },
|
|
197
|
+
...t.toolContext === void 0 ? {} : { toolContext: t.toolContext }
|
|
198
|
+
}).pipe(h.tap((e) => O(t, r, "generateText", e, i.rendered)), h.tap(() => k(t, i.rendered)), h.map((e) => ({
|
|
196
199
|
text: e.text,
|
|
197
200
|
inputTokens: e.usage.inputTokens ?? null,
|
|
198
201
|
outputTokens: e.usage.outputTokens ?? null,
|
|
199
202
|
totalTokens: e.usage.totalTokens ?? null
|
|
200
203
|
})))
|
|
201
204
|
}));
|
|
202
|
-
},
|
|
203
|
-
text:
|
|
204
|
-
language:
|
|
205
|
-
durationSec:
|
|
206
|
-
}),
|
|
205
|
+
}, B = g.Struct({
|
|
206
|
+
text: g.String,
|
|
207
|
+
language: g.optional(g.String),
|
|
208
|
+
durationSec: g.optional(g.Number)
|
|
209
|
+
}), V = (t) => {
|
|
207
210
|
let n = t.provider ?? e(), r = {
|
|
208
211
|
source: t.source,
|
|
209
212
|
...t.language === void 0 ? {} : { language: t.language },
|
|
@@ -211,54 +214,65 @@ var x = {
|
|
|
211
214
|
...t.diarize === void 0 ? {} : { diarize: t.diarize },
|
|
212
215
|
...t.translateToEnglish === void 0 ? {} : { translateToEnglish: t.translateToEnglish }
|
|
213
216
|
}, i = {
|
|
214
|
-
...
|
|
217
|
+
...D(n),
|
|
215
218
|
operation: "transcribe",
|
|
216
219
|
offloaded: t.offload === !0
|
|
217
|
-
}, a = (e) => t.budget === void 0 ? e :
|
|
218
|
-
return t.offload === !0 ? a(
|
|
220
|
+
}, a = (e) => t.budget === void 0 ? e : h.zipRight(L(t), e);
|
|
221
|
+
return t.offload === !0 ? a(F(t, n, "transcription", null, i, {
|
|
219
222
|
text: "",
|
|
220
223
|
system: void 0,
|
|
221
224
|
rendered: void 0
|
|
222
|
-
}, r)) : a(
|
|
225
|
+
}, r)) : a(b({
|
|
223
226
|
name: t.name,
|
|
224
|
-
success:
|
|
227
|
+
success: B,
|
|
225
228
|
input: i,
|
|
226
|
-
retry: t.retry ??
|
|
227
|
-
execute:
|
|
229
|
+
retry: t.retry ?? S,
|
|
230
|
+
execute: s({
|
|
228
231
|
...r,
|
|
229
232
|
provider: n,
|
|
230
233
|
...t.resolveRef === void 0 ? {} : { resolveRef: t.resolveRef }
|
|
231
|
-
}).pipe(
|
|
234
|
+
}).pipe(h.map((e) => ({
|
|
232
235
|
text: e.text,
|
|
233
236
|
...e.language === void 0 ? {} : { language: e.language },
|
|
234
237
|
...e.durationSec === void 0 ? {} : { durationSec: e.durationSec }
|
|
235
238
|
})))
|
|
236
239
|
}));
|
|
237
|
-
},
|
|
238
|
-
let n = t.provider ?? e(),
|
|
239
|
-
...
|
|
240
|
+
}, H = (t) => {
|
|
241
|
+
let n = t.provider ?? e(), i = E(t), a = {
|
|
242
|
+
...D(n),
|
|
240
243
|
operation: "generateObject",
|
|
241
244
|
offloaded: t.offload === !0,
|
|
242
|
-
...
|
|
243
|
-
},
|
|
244
|
-
return t.offload === !0 ?
|
|
245
|
-
let e = yield*
|
|
246
|
-
return yield*
|
|
247
|
-
})) :
|
|
245
|
+
...T(i.text, i.system, t.recordPrompt ?? "digest", i.rendered)
|
|
246
|
+
}, s = (e) => t.budget === void 0 ? e : h.zipRight(L(t), e);
|
|
247
|
+
return t.offload === !0 ? s(h.gen(function* () {
|
|
248
|
+
let e = yield* o(t.schema, "aiObjectStep"), r = yield* F(t, n, "object", e, a, i);
|
|
249
|
+
return yield* g.decodeUnknown(t.schema)(r);
|
|
250
|
+
})) : s(b({
|
|
248
251
|
name: t.name,
|
|
249
252
|
success: t.schema,
|
|
250
|
-
input:
|
|
251
|
-
retry: t.retry ??
|
|
252
|
-
execute:
|
|
253
|
-
prompt:
|
|
253
|
+
input: a,
|
|
254
|
+
retry: t.retry ?? S,
|
|
255
|
+
execute: (t.tools === void 0 ? p({
|
|
256
|
+
prompt: i.text,
|
|
254
257
|
schema: t.schema,
|
|
255
258
|
provider: n,
|
|
256
|
-
...
|
|
259
|
+
...i.system === void 0 ? {} : { system: i.system },
|
|
260
|
+
...t.fallbacks === void 0 ? {} : { fallbacks: t.fallbacks },
|
|
261
|
+
...t.maxTokens === void 0 ? {} : { maxTokens: t.maxTokens },
|
|
262
|
+
...t.providerOptions === void 0 ? {} : { providerOptions: t.providerOptions }
|
|
263
|
+
}) : r({
|
|
264
|
+
prompt: i.text,
|
|
265
|
+
schema: t.schema,
|
|
266
|
+
provider: n,
|
|
267
|
+
tools: t.tools,
|
|
268
|
+
...t.maxSteps === void 0 ? {} : { maxSteps: t.maxSteps },
|
|
269
|
+
...t.toolContext === void 0 ? {} : { toolContext: t.toolContext },
|
|
270
|
+
...i.system === void 0 ? {} : { system: i.system },
|
|
257
271
|
...t.fallbacks === void 0 ? {} : { fallbacks: t.fallbacks },
|
|
258
272
|
...t.maxTokens === void 0 ? {} : { maxTokens: t.maxTokens },
|
|
259
273
|
...t.providerOptions === void 0 ? {} : { providerOptions: t.providerOptions }
|
|
260
|
-
}).pipe(
|
|
274
|
+
})).pipe(h.tap((e) => O(t, n, "generateObject", e, i.rendered)), h.tap(() => k(t, i.rendered)), h.map((e) => e.object))
|
|
261
275
|
}));
|
|
262
276
|
};
|
|
263
277
|
//#endregion
|
|
264
|
-
export {
|
|
278
|
+
export { S as AI_STEP_RETRY, I as AiBudgetMisuseError, M as AiOffloadError, N as AiOffloadMisuseError, w as DEFAULT_AI_BUDGET_NAME, C as DEFAULT_OFFLOAD_TIMEOUT_MS, B as TranscriptionStepResult, H as aiObjectStep, z as aiStep, c as promptDigest, T as promptRecordFor, E as resolveStepPrompt, V as transcribeStep };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voltro/ai",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.65.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.65.0",
|
|
61
|
+
"@voltro/database": "0.65.0",
|
|
62
|
+
"@voltro/protocol": "0.65.0",
|
|
63
|
+
"@voltro/workflow": "0.65.0",
|
|
64
64
|
"ai": "^7.0.59"
|
|
65
65
|
},
|
|
66
66
|
"peerDependencies": {
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { Schema as e } from "effect";
|
|
2
|
-
import { defineAction as t, defineQuery as n } from "@voltro/protocol";
|
|
3
|
-
//#region src/agentConstants.ts
|
|
4
|
-
var r = "_voltro_agent_threads", i = "_voltro_agent_messages", a = e.Struct({ prompt: e.String }), o = "@voltro/ai/AgentDescriptor", s = (e) => ({
|
|
5
|
-
_brand: o,
|
|
6
|
-
name: e.name,
|
|
7
|
-
...e.input === void 0 ? {} : { input: e.input }
|
|
8
|
-
}), c = (e) => typeof e == "object" && !!e && e._brand === o, l = (e) => e.input ?? a, u = e.Struct({ type: e.String }, {
|
|
9
|
-
key: e.String,
|
|
10
|
-
value: e.Unknown
|
|
11
|
-
}), d = e.Struct({
|
|
12
|
-
id: e.String,
|
|
13
|
-
threadId: e.String,
|
|
14
|
-
role: e.String,
|
|
15
|
-
content: e.String,
|
|
16
|
-
streaming: e.Boolean,
|
|
17
|
-
order: e.Number,
|
|
18
|
-
stepOrder: e.Number,
|
|
19
|
-
parts: e.Array(u)
|
|
20
|
-
}), f = (t) => {
|
|
21
|
-
let n = l(t), r = e.Struct({
|
|
22
|
-
threadId: e.String,
|
|
23
|
-
order: e.Number
|
|
24
|
-
});
|
|
25
|
-
try {
|
|
26
|
-
return e.extend(n, r);
|
|
27
|
-
} catch {
|
|
28
|
-
return r;
|
|
29
|
-
}
|
|
30
|
-
}, p = (r) => ({
|
|
31
|
-
send: t({
|
|
32
|
-
name: `${r.name}.send`,
|
|
33
|
-
input: f(r),
|
|
34
|
-
output: e.Struct({ text: e.String }),
|
|
35
|
-
openAccess: "the synthesized agent chat surface serves any session this app authenticates; defineAgent declares no per-agent guard vocabulary today"
|
|
36
|
-
}),
|
|
37
|
-
messages: n({
|
|
38
|
-
name: `${r.name}.messages`,
|
|
39
|
-
input: e.Struct({ threadId: e.String }),
|
|
40
|
-
output: e.Array(d),
|
|
41
|
-
source: i,
|
|
42
|
-
openAccess: "the synthesized agent chat surface serves any session this app authenticates; messages are keyed by the caller-supplied threadId"
|
|
43
|
-
})
|
|
44
|
-
});
|
|
45
|
-
//#endregion
|
|
46
|
-
export { c as a, s as i, d as n, i as o, p as r, r as s, l as t };
|