@voltro/plugin-ai-flows 0.85.0 → 0.87.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.
@@ -1,273 +0,0 @@
1
- import { Schema as e } from "effect";
2
- import { WorkflowControlResultSchema as t, WorkflowRunHandleSchema as n } from "@voltro/protocol";
3
- //#region src/condition.ts
4
- var r = e.Literals([
5
- "truthy",
6
- "falsy",
7
- "eq",
8
- "neq",
9
- "contains"
10
- ]), i = e.Struct({
11
- ref: e.String,
12
- op: r,
13
- value: e.optional(e.Unknown)
14
- }), a = (e) => e == null ? !1 : typeof e == "boolean" ? e : !Array.isArray(e) || e.length > 0, o = (e, t) => {
15
- if (e === t) return !0;
16
- if (e === null || t === null || e === void 0 || t === void 0) return !1;
17
- if (typeof e == "object" || typeof t == "object") try {
18
- return JSON.stringify(e) === JSON.stringify(t);
19
- } catch {
20
- return !1;
21
- }
22
- return String(e) === String(t);
23
- }, s = (e, t) => {
24
- let n = t[e.ref];
25
- switch (e.op) {
26
- case "truthy": return a(n);
27
- case "falsy": return !a(n);
28
- case "eq": return o(n, e.value);
29
- case "neq": return !o(n, e.value);
30
- case "contains": {
31
- if (n == null) return !1;
32
- if (Array.isArray(n)) return n.some((t) => o(t, e.value));
33
- let t = e.value;
34
- return typeof t != "string" && typeof t != "number" ? !1 : String(n).includes(String(t));
35
- }
36
- }
37
- }, c = (e) => {
38
- switch (e.op) {
39
- case "truthy": return `{{${e.ref}}} is set`;
40
- case "falsy": return `{{${e.ref}}} is not set`;
41
- case "eq": return `{{${e.ref}}} equals ${JSON.stringify(e.value)}`;
42
- case "neq": return `{{${e.ref}}} does not equal ${JSON.stringify(e.value)}`;
43
- case "contains": return `{{${e.ref}}} contains ${JSON.stringify(e.value)}`;
44
- }
45
- }, l = e.Struct({
46
- runId: e.NonEmptyString,
47
- requestId: e.NonEmptyString,
48
- admission: n
49
- }), u = e.Literals(["deterministic", "agentic"]), d = e.Literals([
50
- "draft",
51
- "active",
52
- "archived"
53
- ]), f = e.Literals([
54
- "private",
55
- "organization",
56
- "shared"
57
- ]), p = e.Literals([
58
- "pending",
59
- "running",
60
- "waiting",
61
- "cancelling",
62
- "succeeded",
63
- "failed",
64
- "cancelled"
65
- ]), m = e.Struct({
66
- runId: e.NonEmptyString,
67
- status: p,
68
- engine: e.Literals([
69
- "cancelled",
70
- "accepted",
71
- "unknown",
72
- "already-terminal",
73
- "unreachable",
74
- "not-requested"
75
- ]),
76
- control: e.NullOr(t)
77
- }).pipe(e.check(e.makeFilter((e) => {
78
- let t = e.control;
79
- if (t !== null && t.operation !== "cancel") return !1;
80
- switch (e.engine) {
81
- case "cancelled": return e.status === "cancelled" && t !== null && t.snapshot.status === "cancelled" && (t.kind === "confirmed" || t.kind === "already-terminal");
82
- case "accepted": return t?.kind === "accepted";
83
- case "already-terminal": return t?.kind === "already-terminal" && t.snapshot.status !== "cancelled";
84
- case "unknown": return t === null || t.kind === "unknown";
85
- case "unreachable":
86
- case "not-requested": return t === null;
87
- }
88
- }, { message: "Flow cancellation acknowledgement contradicts its workflow control receipt" }))), h = e.Literals(["manual", "cron"]), g = e.Literals([
89
- "agent",
90
- "generate",
91
- "structured",
92
- "note",
93
- "human"
94
- ]), _ = e.Literals([
95
- "text",
96
- "image",
97
- "video",
98
- "audio"
99
- ]), v = e.Literals([
100
- "approve",
101
- "choice",
102
- "text"
103
- ]), y = e.Struct({
104
- value: e.String,
105
- label: e.String
106
- }), b = e.Union([e.Struct({
107
- from: e.Literal("upload"),
108
- url: e.String,
109
- mediaType: e.optional(e.NonEmptyString)
110
- }), e.Struct({
111
- from: e.Literal("step"),
112
- ref: e.String,
113
- artifact: e.optional(e.Int.pipe(e.check(e.isGreaterThanOrEqualTo(0))))
114
- })]), x = e.Record(e.String, b), S = e.Record(e.String, e.Unknown), C = e.Struct({
115
- url: e.NonEmptyString,
116
- mediaType: e.NonEmptyString,
117
- role: e.NonEmptyString,
118
- storageRefId: e.optional(e.NonEmptyString),
119
- providerMetadata: e.optional(e.Unknown)
120
- }), w = e.Array(C).pipe(e.check(e.makeFilter((e) => e.filter((e) => e.role === "primary").length === 1))), T = e.Struct({
121
- id: e.String,
122
- title: e.optional(e.String),
123
- description: e.optional(e.String),
124
- type: g,
125
- outputKey: e.optional(e.String),
126
- prompt: e.optional(e.String),
127
- modality: e.optional(_),
128
- model: e.optional(e.String),
129
- params: e.optional(S),
130
- mediaInputs: e.optional(x),
131
- agentRef: e.optional(e.String),
132
- schema: e.optional(S),
133
- reviewMode: e.optional(v),
134
- options: e.optional(e.Array(y)),
135
- when: e.optional(i),
136
- group: e.optional(e.String),
137
- timeoutMs: e.optional(e.Number)
138
- }), E = e.Struct({
139
- key: e.String,
140
- label: e.String,
141
- type: e.Literals([
142
- "text",
143
- "textarea",
144
- "number",
145
- "boolean"
146
- ]),
147
- required: e.optional(e.Boolean),
148
- placeholder: e.optional(e.String)
149
- }), D = e.Struct({
150
- flowRef: e.String,
151
- mappings: e.Array(e.Struct({
152
- targetKey: e.String,
153
- sourceKey: e.String
154
- })),
155
- requireConfirmation: e.optional(e.Boolean)
156
- }), O = e.Struct({
157
- frequency: e.optional(e.Literals(["weekly", "monthly"])),
158
- repeats: e.Array(e.Number),
159
- intervalWeeks: e.optional(e.Number),
160
- anchorDate: e.optional(e.String),
161
- weekOfMonth: e.optional(e.Union([e.Literals([
162
- 1,
163
- 2,
164
- 3,
165
- 4
166
- ]), e.Literal("last")])),
167
- hour: e.optional(e.Number),
168
- minute: e.optional(e.Literals([
169
- 0,
170
- 15,
171
- 30,
172
- 45
173
- ])),
174
- defaultInput: e.optional(S)
175
- }), k = e.Literals([
176
- "pending",
177
- "running",
178
- "waiting",
179
- "succeeded",
180
- "failed",
181
- "skipped"
182
- ]), A = e.Struct({
183
- mode: v,
184
- options: e.optional(e.Array(y)),
185
- prompt: e.String
186
- }), j = e.Literals([
187
- "gateway",
188
- "estimated",
189
- "unpriced"
190
- ]), M = e.Literals([
191
- "actual",
192
- "estimated",
193
- "incomplete",
194
- "unknown"
195
- ]), N = e.Struct({
196
- status: e.Literals(["reported", "unreported"]),
197
- unit: e.optional(e.Literals([
198
- "tokens",
199
- "characters",
200
- "seconds"
201
- ])),
202
- input: e.optional(e.Finite.pipe(e.check(e.isGreaterThanOrEqualTo(0)))),
203
- output: e.optional(e.Finite.pipe(e.check(e.isGreaterThanOrEqualTo(0))))
204
- }), P = e.Struct({
205
- costMicroUsd: e.optional(e.Finite.pipe(e.check(e.isGreaterThanOrEqualTo(0)))),
206
- costSource: e.optional(j),
207
- requestId: e.optional(e.NonEmptyString),
208
- usage: e.optional(N)
209
- }), F = e.Struct({
210
- id: e.Number,
211
- title: e.String,
212
- description: e.optional(e.String),
213
- type: g,
214
- status: k,
215
- agentRef: e.optional(e.String),
216
- modality: e.optional(_),
217
- startedAt: e.optional(e.String),
218
- completedAt: e.optional(e.String),
219
- costMicroUsd: e.optional(e.Number),
220
- costSource: e.optional(j),
221
- requestId: e.optional(e.String),
222
- usage: e.optional(N),
223
- url: e.optional(e.String),
224
- artifacts: e.optional(w),
225
- output: e.optional(e.Struct({ text: e.String })),
226
- errorMessage: e.optional(e.String),
227
- skipReason: e.optional(e.String),
228
- review: e.optional(A)
229
- }), I = e.Struct({
230
- decision: e.optional(e.Literals(["approve", "reject"])),
231
- value: e.optional(e.String),
232
- text: e.optional(e.String),
233
- respondedAt: e.optional(e.String)
234
- }), L = e.Struct({
235
- runId: e.NonEmptyString,
236
- stepIndex: e.Int.pipe(e.check(e.isGreaterThanOrEqualTo(0))),
237
- response: I
238
- }), R = e.Struct({
239
- runId: e.NonEmptyString,
240
- stepIndex: e.Int.pipe(e.check(e.isGreaterThanOrEqualTo(0))),
241
- executionId: e.NonEmptyString,
242
- eventId: e.NonEmptyString,
243
- status: e.Literal("accepted")
244
- }), z = e.Struct({
245
- flowRef: e.String,
246
- input: S,
247
- status: e.Literals([
248
- "pending",
249
- "confirmed",
250
- "dismissed"
251
- ])
252
- }), B = 30, V = 1, H = 100, U = (e) => e == null || !Number.isFinite(e) ? 30 : Math.min(100, Math.max(1, Math.trunc(e))), W = (e) => e.replace(/[^\w.-]/g, "_"), G = (e) => {
253
- let t = (e.steps ?? []).map((e) => e.outputKey ? {
254
- ...e,
255
- outputKey: W(e.outputKey)
256
- } : e), n = e.orchestratorModel || e.orchestratorInstructions ? {
257
- ...e.orchestratorModel ? { model: e.orchestratorModel } : {},
258
- ...e.orchestratorInstructions ? { instructions: e.orchestratorInstructions } : {}
259
- } : void 0;
260
- return {
261
- name: e.name,
262
- mode: e.mode ?? "deterministic",
263
- steps: t,
264
- maxSteps: U(e.maxSteps),
265
- brief: e.brief ?? [],
266
- ...n ? { orchestrator: n } : {},
267
- ...e.chain ? { chain: e.chain } : {},
268
- ...e.cadence ? { cadence: e.cadence } : {},
269
- ...e.humanTimeoutMs != null && Number.isFinite(e.humanTimeoutMs) ? { humanTimeoutMs: e.humanTimeoutMs } : {}
270
- };
271
- };
272
- //#endregion
273
- export { F as A, c as B, P as C, A as D, y as E, U as F, a as H, G as I, W as L, g as M, N, h as O, f as P, r as R, x as S, v as T, s as V, H as _, O as a, w as b, u as c, l as d, d as f, B as g, S as h, j as i, k as j, p as k, L as l, I as m, z as n, m as o, T as p, M as r, D as s, E as t, R as u, V as v, _ as w, b as x, C as y, i as z };