@voltro/plugin-ai-flows 0.84.0 → 0.86.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 +1215 -0
- package/THIRD-PARTY-NOTICES.md +123 -605
- package/dist/{cadence-_9Izk_fL.js → cadence.js} +1 -1
- package/dist/cadenceTick.js +80 -0
- package/dist/condition.js +46 -0
- package/dist/defaults.js +18 -0
- package/dist/define.js +71 -0
- package/dist/engine.js +906 -0
- package/dist/errors.d.ts +52 -69
- package/dist/errors.js +12 -3
- package/dist/index.d.ts +267 -280
- package/dist/index.js +76 -1766
- package/dist/interpolate.js +15 -0
- package/dist/ir.d.ts +193 -193
- package/dist/ir.js +233 -2
- package/dist/jsonParams.js +12 -0
- package/dist/mediaAdapter.js +179 -0
- package/dist/mediaInputs.js +57 -0
- package/dist/mediaParams.js +42 -0
- package/dist/mediaResult.js +15 -0
- package/dist/procedures.js +208 -0
- package/dist/registry.js +6 -0
- package/dist/segments.js +33 -0
- package/dist/startReceipt.js +12 -0
- package/dist/startReconcile.js +81 -0
- package/dist/table.js +59 -0
- package/dist/textParams.js +21 -0
- package/dist/web.d.ts +169 -169
- package/dist/web.js +2 -2
- package/dist/workflow.d.ts +12 -10
- package/dist/workflow.js +8 -6
- package/package.json +12 -12
- package/dist/ir-CdDUTf98.js +0 -196
package/dist/workflow.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Schema } from 'effect';
|
|
2
|
-
import { Workflow } from '
|
|
2
|
+
import { Workflow } from 'effect/workflow/Workflow';
|
|
3
3
|
import { WorkflowMessagesCarrier } from '@voltro/workflow';
|
|
4
4
|
|
|
5
5
|
/** The canonical name the launch action starts + the app re-export registers. */
|
|
@@ -22,15 +22,15 @@ export declare interface FlowRunPayload {
|
|
|
22
22
|
*/
|
|
23
23
|
export declare const flowRunWorkflow: Workflow<"flow.run", Schema.Struct<{
|
|
24
24
|
/** The pre-created `ai_flow_runs` row id the executor patches. */
|
|
25
|
-
runId:
|
|
25
|
+
runId: Schema.String;
|
|
26
26
|
/** Name (code flow) or id (data flow) to resolve the IR from. */
|
|
27
|
-
flowRef:
|
|
27
|
+
flowRef: Schema.String;
|
|
28
28
|
/** Brief values keyed by `BriefField.key`. */
|
|
29
|
-
input: Schema
|
|
29
|
+
input: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
30
30
|
/** manual | cron. */
|
|
31
|
-
source: Schema.
|
|
31
|
+
source: Schema.Literals<readonly ["manual", "cron"]>;
|
|
32
32
|
/** Correlation + idempotency key. */
|
|
33
|
-
requestId:
|
|
33
|
+
requestId: Schema.String;
|
|
34
34
|
/**
|
|
35
35
|
* The chain of flows that led here, oldest first, INCLUDING this one.
|
|
36
36
|
*
|
|
@@ -43,11 +43,13 @@ export declare const flowRunWorkflow: Workflow<"flow.run", Schema.Struct<{
|
|
|
43
43
|
* Optional so a run started by an older caller (or by hand) still decodes;
|
|
44
44
|
* an absent path is read as "this is the first flow", which it is.
|
|
45
45
|
*/
|
|
46
|
-
chainPath: Schema.optional<Schema
|
|
46
|
+
chainPath: Schema.optional<Schema.$Array<Schema.String>>;
|
|
47
47
|
}>, Schema.Struct<{
|
|
48
|
-
runId:
|
|
49
|
-
status: Schema.
|
|
50
|
-
}>,
|
|
48
|
+
readonly runId: Schema.String;
|
|
49
|
+
readonly status: Schema.Literals<readonly ["succeeded", "failed", "cancelled", "waiting"]>;
|
|
50
|
+
}>, Schema.Never> & {
|
|
51
|
+
readonly name: "flow.run";
|
|
52
|
+
} & WorkflowMessagesCarrier<{
|
|
51
53
|
readonly signals: {};
|
|
52
54
|
readonly updates: {};
|
|
53
55
|
}>;
|
package/dist/workflow.js
CHANGED
|
@@ -6,17 +6,19 @@ var n = "flow.run", r = "flow-human-response", i = (e) => `${r}:${e}`, a = t({
|
|
|
6
6
|
payload: {
|
|
7
7
|
runId: e.String,
|
|
8
8
|
flowRef: e.String,
|
|
9
|
-
input: e.Record(
|
|
10
|
-
|
|
11
|
-
value: e.Unknown
|
|
12
|
-
}),
|
|
13
|
-
source: e.Literal("manual", "cron"),
|
|
9
|
+
input: e.Record(e.String, e.Unknown),
|
|
10
|
+
source: e.Literals(["manual", "cron"]),
|
|
14
11
|
requestId: e.String,
|
|
15
12
|
chainPath: e.optional(e.Array(e.String))
|
|
16
13
|
},
|
|
17
14
|
success: e.Struct({
|
|
18
15
|
runId: e.String,
|
|
19
|
-
status: e.
|
|
16
|
+
status: e.Literals([
|
|
17
|
+
"succeeded",
|
|
18
|
+
"failed",
|
|
19
|
+
"cancelled",
|
|
20
|
+
"waiting"
|
|
21
|
+
])
|
|
20
22
|
}),
|
|
21
23
|
idempotencyKey: ({ requestId: e }) => `flow-run:${e}`,
|
|
22
24
|
internal: !0
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voltro/plugin-ai-flows",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.86.0",
|
|
4
4
|
"description": "AI Flows — durable multi-step AI pipelines (deterministic + agentic) with human-in-the-loop, chaining, and cadence. Author flows in code (defineFlow) or as data (visual editor rows); one engine runs both on @voltro/workflow durability, @voltro/ai generation, storage artifacts, and notifications.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"voltro",
|
|
@@ -58,19 +58,19 @@
|
|
|
58
58
|
"node": ">=24.0.0"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@voltro/ai": "0.
|
|
62
|
-
"@voltro/client": "0.
|
|
63
|
-
"@voltro/database": "0.
|
|
64
|
-
"@voltro/env": "0.
|
|
65
|
-
"@voltro/plugin-audit": "0.
|
|
66
|
-
"@voltro/plugin-multitenancy": "0.
|
|
67
|
-
"@voltro/plugin-soft-delete": "0.
|
|
68
|
-
"@voltro/protocol": "0.
|
|
69
|
-
"@voltro/runtime": "0.
|
|
70
|
-
"@voltro/workflow": "0.
|
|
61
|
+
"@voltro/ai": "0.86.0",
|
|
62
|
+
"@voltro/client": "0.86.0",
|
|
63
|
+
"@voltro/database": "0.86.0",
|
|
64
|
+
"@voltro/env": "0.86.0",
|
|
65
|
+
"@voltro/plugin-audit": "0.86.0",
|
|
66
|
+
"@voltro/plugin-multitenancy": "0.86.0",
|
|
67
|
+
"@voltro/plugin-soft-delete": "0.86.0",
|
|
68
|
+
"@voltro/protocol": "0.86.0",
|
|
69
|
+
"@voltro/runtime": "0.86.0",
|
|
70
|
+
"@voltro/workflow": "0.86.0"
|
|
71
71
|
},
|
|
72
72
|
"peerDependencies": {
|
|
73
|
-
"effect": "
|
|
73
|
+
"effect": "4.0.1"
|
|
74
74
|
},
|
|
75
75
|
"publishConfig": {
|
|
76
76
|
"access": "public"
|
package/dist/ir-CdDUTf98.js
DELETED
|
@@ -1,196 +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.Literal("truthy", "falsy", "eq", "neq", "contains"), i = e.Struct({
|
|
5
|
-
ref: e.String,
|
|
6
|
-
op: r,
|
|
7
|
-
value: e.optional(e.Unknown)
|
|
8
|
-
}), a = (e) => e == null ? !1 : typeof e == "boolean" ? e : !Array.isArray(e) || e.length > 0, o = (e, t) => {
|
|
9
|
-
if (e === t) return !0;
|
|
10
|
-
if (e === null || t === null || e === void 0 || t === void 0) return !1;
|
|
11
|
-
if (typeof e == "object" || typeof t == "object") try {
|
|
12
|
-
return JSON.stringify(e) === JSON.stringify(t);
|
|
13
|
-
} catch {
|
|
14
|
-
return !1;
|
|
15
|
-
}
|
|
16
|
-
return String(e) === String(t);
|
|
17
|
-
}, s = (e, t) => {
|
|
18
|
-
let n = t[e.ref];
|
|
19
|
-
switch (e.op) {
|
|
20
|
-
case "truthy": return a(n);
|
|
21
|
-
case "falsy": return !a(n);
|
|
22
|
-
case "eq": return o(n, e.value);
|
|
23
|
-
case "neq": return !o(n, e.value);
|
|
24
|
-
case "contains": {
|
|
25
|
-
if (n == null) return !1;
|
|
26
|
-
if (Array.isArray(n)) return n.some((t) => o(t, e.value));
|
|
27
|
-
let t = e.value;
|
|
28
|
-
return typeof t != "string" && typeof t != "number" ? !1 : String(n).includes(String(t));
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}, c = (e) => {
|
|
32
|
-
switch (e.op) {
|
|
33
|
-
case "truthy": return `{{${e.ref}}} is set`;
|
|
34
|
-
case "falsy": return `{{${e.ref}}} is not set`;
|
|
35
|
-
case "eq": return `{{${e.ref}}} equals ${JSON.stringify(e.value)}`;
|
|
36
|
-
case "neq": return `{{${e.ref}}} does not equal ${JSON.stringify(e.value)}`;
|
|
37
|
-
case "contains": return `{{${e.ref}}} contains ${JSON.stringify(e.value)}`;
|
|
38
|
-
}
|
|
39
|
-
}, l = e.Struct({
|
|
40
|
-
runId: e.NonEmptyString,
|
|
41
|
-
requestId: e.NonEmptyString,
|
|
42
|
-
admission: n
|
|
43
|
-
}), u = e.Literal("deterministic", "agentic"), d = e.Literal("draft", "active", "archived"), f = e.Literal("private", "organization", "shared"), p = e.Literal("pending", "running", "waiting", "cancelling", "succeeded", "failed", "cancelled"), m = e.Struct({
|
|
44
|
-
runId: e.NonEmptyString,
|
|
45
|
-
status: p,
|
|
46
|
-
engine: e.Literal("cancelled", "accepted", "unknown", "already-terminal", "unreachable", "not-requested"),
|
|
47
|
-
control: e.NullOr(t)
|
|
48
|
-
}).pipe(e.filter((e) => {
|
|
49
|
-
let t = e.control;
|
|
50
|
-
if (t !== null && t.operation !== "cancel") return !1;
|
|
51
|
-
switch (e.engine) {
|
|
52
|
-
case "cancelled": return e.status === "cancelled" && t !== null && t.snapshot.status === "cancelled" && (t.kind === "confirmed" || t.kind === "already-terminal");
|
|
53
|
-
case "accepted": return t?.kind === "accepted";
|
|
54
|
-
case "already-terminal": return t?.kind === "already-terminal" && t.snapshot.status !== "cancelled";
|
|
55
|
-
case "unknown": return t === null || t.kind === "unknown";
|
|
56
|
-
case "unreachable":
|
|
57
|
-
case "not-requested": return t === null;
|
|
58
|
-
}
|
|
59
|
-
}, { message: () => "Flow cancellation acknowledgement contradicts its workflow control receipt" })), h = e.Literal("manual", "cron"), g = e.Literal("agent", "generate", "structured", "note", "human"), _ = e.Literal("text", "image", "video", "audio"), v = e.Literal("approve", "choice", "text"), y = e.Struct({
|
|
60
|
-
value: e.String,
|
|
61
|
-
label: e.String
|
|
62
|
-
}), b = e.Union(e.Struct({
|
|
63
|
-
from: e.Literal("upload"),
|
|
64
|
-
url: e.String,
|
|
65
|
-
mediaType: e.optional(e.NonEmptyString)
|
|
66
|
-
}), e.Struct({
|
|
67
|
-
from: e.Literal("step"),
|
|
68
|
-
ref: e.String,
|
|
69
|
-
artifact: e.optional(e.Int.pipe(e.nonNegative()))
|
|
70
|
-
})), x = e.Record({
|
|
71
|
-
key: e.String,
|
|
72
|
-
value: b
|
|
73
|
-
}), S = e.Record({
|
|
74
|
-
key: e.String,
|
|
75
|
-
value: e.Unknown
|
|
76
|
-
}), C = e.Struct({
|
|
77
|
-
url: e.NonEmptyString,
|
|
78
|
-
mediaType: e.NonEmptyString,
|
|
79
|
-
role: e.NonEmptyString,
|
|
80
|
-
storageRefId: e.optional(e.NonEmptyString),
|
|
81
|
-
providerMetadata: e.optional(e.Unknown)
|
|
82
|
-
}), w = e.Array(C).pipe(e.filter((e) => e.filter((e) => e.role === "primary").length === 1)), T = e.Struct({
|
|
83
|
-
id: e.String,
|
|
84
|
-
title: e.optional(e.String),
|
|
85
|
-
description: e.optional(e.String),
|
|
86
|
-
type: g,
|
|
87
|
-
outputKey: e.optional(e.String),
|
|
88
|
-
prompt: e.optional(e.String),
|
|
89
|
-
modality: e.optional(_),
|
|
90
|
-
model: e.optional(e.String),
|
|
91
|
-
params: e.optional(S),
|
|
92
|
-
mediaInputs: e.optional(x),
|
|
93
|
-
agentRef: e.optional(e.String),
|
|
94
|
-
schema: e.optional(S),
|
|
95
|
-
reviewMode: e.optional(v),
|
|
96
|
-
options: e.optional(e.Array(y)),
|
|
97
|
-
when: e.optional(i),
|
|
98
|
-
group: e.optional(e.String),
|
|
99
|
-
timeoutMs: e.optional(e.Number)
|
|
100
|
-
}), E = e.Struct({
|
|
101
|
-
key: e.String,
|
|
102
|
-
label: e.String,
|
|
103
|
-
type: e.Literal("text", "textarea", "number", "boolean"),
|
|
104
|
-
required: e.optional(e.Boolean),
|
|
105
|
-
placeholder: e.optional(e.String)
|
|
106
|
-
}), D = e.Struct({
|
|
107
|
-
flowRef: e.String,
|
|
108
|
-
mappings: e.Array(e.Struct({
|
|
109
|
-
targetKey: e.String,
|
|
110
|
-
sourceKey: e.String
|
|
111
|
-
})),
|
|
112
|
-
requireConfirmation: e.optional(e.Boolean)
|
|
113
|
-
}), O = e.Struct({
|
|
114
|
-
frequency: e.optional(e.Literal("weekly", "monthly")),
|
|
115
|
-
repeats: e.Array(e.Number),
|
|
116
|
-
intervalWeeks: e.optional(e.Number),
|
|
117
|
-
anchorDate: e.optional(e.String),
|
|
118
|
-
weekOfMonth: e.optional(e.Union(e.Literal(1, 2, 3, 4), e.Literal("last"))),
|
|
119
|
-
hour: e.optional(e.Number),
|
|
120
|
-
minute: e.optional(e.Literal(0, 15, 30, 45)),
|
|
121
|
-
defaultInput: e.optional(S)
|
|
122
|
-
}), k = e.Literal("pending", "running", "waiting", "succeeded", "failed", "skipped"), A = e.Struct({
|
|
123
|
-
mode: v,
|
|
124
|
-
options: e.optional(e.Array(y)),
|
|
125
|
-
prompt: e.String
|
|
126
|
-
}), j = e.Literal("gateway", "estimated", "unpriced"), M = e.Literal("actual", "estimated", "incomplete", "unknown"), N = e.Struct({
|
|
127
|
-
status: e.Literal("reported", "unreported"),
|
|
128
|
-
unit: e.optional(e.Literal("tokens", "characters", "seconds")),
|
|
129
|
-
input: e.optional(e.Finite.pipe(e.nonNegative())),
|
|
130
|
-
output: e.optional(e.Finite.pipe(e.nonNegative()))
|
|
131
|
-
}), P = e.Struct({
|
|
132
|
-
costMicroUsd: e.optional(e.Finite.pipe(e.nonNegative())),
|
|
133
|
-
costSource: e.optional(j),
|
|
134
|
-
requestId: e.optional(e.NonEmptyString),
|
|
135
|
-
usage: e.optional(N)
|
|
136
|
-
}), F = e.Struct({
|
|
137
|
-
id: e.Number,
|
|
138
|
-
title: e.String,
|
|
139
|
-
description: e.optional(e.String),
|
|
140
|
-
type: g,
|
|
141
|
-
status: k,
|
|
142
|
-
agentRef: e.optional(e.String),
|
|
143
|
-
modality: e.optional(_),
|
|
144
|
-
startedAt: e.optional(e.String),
|
|
145
|
-
completedAt: e.optional(e.String),
|
|
146
|
-
costMicroUsd: e.optional(e.Number),
|
|
147
|
-
costSource: e.optional(j),
|
|
148
|
-
requestId: e.optional(e.String),
|
|
149
|
-
usage: e.optional(N),
|
|
150
|
-
url: e.optional(e.String),
|
|
151
|
-
artifacts: e.optional(w),
|
|
152
|
-
output: e.optional(e.Struct({ text: e.String })),
|
|
153
|
-
errorMessage: e.optional(e.String),
|
|
154
|
-
skipReason: e.optional(e.String),
|
|
155
|
-
review: e.optional(A)
|
|
156
|
-
}), I = e.Struct({
|
|
157
|
-
decision: e.optional(e.Literal("approve", "reject")),
|
|
158
|
-
value: e.optional(e.String),
|
|
159
|
-
text: e.optional(e.String),
|
|
160
|
-
respondedAt: e.optional(e.String)
|
|
161
|
-
}), L = e.Struct({
|
|
162
|
-
runId: e.NonEmptyString,
|
|
163
|
-
stepIndex: e.Int.pipe(e.nonNegative()),
|
|
164
|
-
response: I
|
|
165
|
-
}), R = e.Struct({
|
|
166
|
-
runId: e.NonEmptyString,
|
|
167
|
-
stepIndex: e.Int.pipe(e.nonNegative()),
|
|
168
|
-
executionId: e.NonEmptyString,
|
|
169
|
-
eventId: e.NonEmptyString,
|
|
170
|
-
status: e.Literal("accepted")
|
|
171
|
-
}), z = e.Struct({
|
|
172
|
-
flowRef: e.String,
|
|
173
|
-
input: S,
|
|
174
|
-
status: e.Literal("pending", "confirmed", "dismissed")
|
|
175
|
-
}), 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) => {
|
|
176
|
-
let t = (e.steps ?? []).map((e) => e.outputKey ? {
|
|
177
|
-
...e,
|
|
178
|
-
outputKey: W(e.outputKey)
|
|
179
|
-
} : e), n = e.orchestratorModel || e.orchestratorInstructions ? {
|
|
180
|
-
...e.orchestratorModel ? { model: e.orchestratorModel } : {},
|
|
181
|
-
...e.orchestratorInstructions ? { instructions: e.orchestratorInstructions } : {}
|
|
182
|
-
} : void 0;
|
|
183
|
-
return {
|
|
184
|
-
name: e.name,
|
|
185
|
-
mode: e.mode ?? "deterministic",
|
|
186
|
-
steps: t,
|
|
187
|
-
maxSteps: U(e.maxSteps),
|
|
188
|
-
brief: e.brief ?? [],
|
|
189
|
-
...n ? { orchestrator: n } : {},
|
|
190
|
-
...e.chain ? { chain: e.chain } : {},
|
|
191
|
-
...e.cadence ? { cadence: e.cadence } : {},
|
|
192
|
-
...e.humanTimeoutMs != null && Number.isFinite(e.humanTimeoutMs) ? { humanTimeoutMs: e.humanTimeoutMs } : {}
|
|
193
|
-
};
|
|
194
|
-
};
|
|
195
|
-
//#endregion
|
|
196
|
-
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 };
|