@voltro/plugin-ai-flows 0.75.0 → 0.76.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 +404 -0
- package/THIRD-PARTY-NOTICES.md +7 -7
- package/dist/errors.js +1 -1
- package/dist/index.d.ts +53 -13
- package/dist/index.js +397 -358
- package/dist/{ir-C2ewescS.js → ir-BW5JRUiH.js} +72 -56
- package/dist/ir.d.ts +26 -0
- package/dist/ir.js +2 -2
- package/package.json +12 -12
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Schema as e } from "effect";
|
|
2
|
-
import {
|
|
2
|
+
import { WorkflowControlResultSchema as t, WorkflowRunHandleSchema as n } from "@voltro/protocol";
|
|
3
3
|
//#region src/condition.ts
|
|
4
|
-
var
|
|
4
|
+
var r = e.Literal("truthy", "falsy", "eq", "neq", "contains"), i = e.Struct({
|
|
5
5
|
ref: e.String,
|
|
6
|
-
op:
|
|
6
|
+
op: r,
|
|
7
7
|
value: e.optional(e.Unknown)
|
|
8
|
-
}),
|
|
8
|
+
}), a = (e) => e == null ? !1 : typeof e == "boolean" ? e : !Array.isArray(e) || e.length > 0, o = (e, t) => {
|
|
9
9
|
if (e === t) return !0;
|
|
10
10
|
if (e === null || t === null || e === void 0 || t === void 0) return !1;
|
|
11
11
|
if (typeof e == "object" || typeof t == "object") try {
|
|
@@ -14,21 +14,21 @@ var n = e.Literal("truthy", "falsy", "eq", "neq", "contains"), r = e.Struct({
|
|
|
14
14
|
return !1;
|
|
15
15
|
}
|
|
16
16
|
return String(e) === String(t);
|
|
17
|
-
},
|
|
17
|
+
}, s = (e, t) => {
|
|
18
18
|
let n = t[e.ref];
|
|
19
19
|
switch (e.op) {
|
|
20
|
-
case "truthy": return
|
|
21
|
-
case "falsy": return !
|
|
22
|
-
case "eq": return
|
|
23
|
-
case "neq": return !
|
|
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
24
|
case "contains": {
|
|
25
25
|
if (n == null) return !1;
|
|
26
|
-
if (Array.isArray(n)) return n.some((t) =>
|
|
26
|
+
if (Array.isArray(n)) return n.some((t) => o(t, e.value));
|
|
27
27
|
let t = e.value;
|
|
28
28
|
return typeof t != "string" && typeof t != "number" ? !1 : String(n).includes(String(t));
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
-
},
|
|
31
|
+
}, c = (e) => {
|
|
32
32
|
switch (e.op) {
|
|
33
33
|
case "truthy": return `{{${e.ref}}} is set`;
|
|
34
34
|
case "falsy": return `{{${e.ref}}} is not set`;
|
|
@@ -36,14 +36,30 @@ var n = e.Literal("truthy", "falsy", "eq", "neq", "contains"), r = e.Struct({
|
|
|
36
36
|
case "neq": return `{{${e.ref}}} does not equal ${JSON.stringify(e.value)}`;
|
|
37
37
|
case "contains": return `{{${e.ref}}} contains ${JSON.stringify(e.value)}`;
|
|
38
38
|
}
|
|
39
|
-
},
|
|
39
|
+
}, l = e.Struct({
|
|
40
40
|
runId: e.NonEmptyString,
|
|
41
41
|
requestId: e.NonEmptyString,
|
|
42
|
-
admission:
|
|
43
|
-
}),
|
|
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", "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 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({
|
|
44
60
|
value: e.String,
|
|
45
61
|
label: e.String
|
|
46
|
-
}),
|
|
62
|
+
}), b = e.Union(e.Struct({
|
|
47
63
|
from: e.Literal("upload"),
|
|
48
64
|
url: e.String,
|
|
49
65
|
mediaType: e.optional(e.NonEmptyString)
|
|
@@ -51,50 +67,50 @@ var n = e.Literal("truthy", "falsy", "eq", "neq", "contains"), r = e.Struct({
|
|
|
51
67
|
from: e.Literal("step"),
|
|
52
68
|
ref: e.String,
|
|
53
69
|
artifact: e.optional(e.Int.pipe(e.nonNegative()))
|
|
54
|
-
})),
|
|
70
|
+
})), x = e.Record({
|
|
55
71
|
key: e.String,
|
|
56
|
-
value:
|
|
57
|
-
}),
|
|
72
|
+
value: b
|
|
73
|
+
}), S = e.Record({
|
|
58
74
|
key: e.String,
|
|
59
75
|
value: e.Unknown
|
|
60
|
-
}),
|
|
76
|
+
}), C = e.Struct({
|
|
61
77
|
url: e.NonEmptyString,
|
|
62
78
|
mediaType: e.NonEmptyString,
|
|
63
79
|
role: e.NonEmptyString,
|
|
64
80
|
storageRefId: e.optional(e.NonEmptyString),
|
|
65
81
|
providerMetadata: e.optional(e.Unknown)
|
|
66
|
-
}),
|
|
82
|
+
}), w = e.Array(C).pipe(e.filter((e) => e.filter((e) => e.role === "primary").length === 1)), T = e.Struct({
|
|
67
83
|
id: e.String,
|
|
68
84
|
title: e.optional(e.String),
|
|
69
85
|
description: e.optional(e.String),
|
|
70
|
-
type:
|
|
86
|
+
type: g,
|
|
71
87
|
outputKey: e.optional(e.String),
|
|
72
88
|
prompt: e.optional(e.String),
|
|
73
|
-
modality: e.optional(
|
|
89
|
+
modality: e.optional(_),
|
|
74
90
|
model: e.optional(e.String),
|
|
75
|
-
params: e.optional(
|
|
76
|
-
mediaInputs: e.optional(
|
|
91
|
+
params: e.optional(S),
|
|
92
|
+
mediaInputs: e.optional(x),
|
|
77
93
|
agentRef: e.optional(e.String),
|
|
78
|
-
schema: e.optional(
|
|
79
|
-
reviewMode: e.optional(
|
|
80
|
-
options: e.optional(e.Array(
|
|
81
|
-
when: e.optional(
|
|
94
|
+
schema: e.optional(S),
|
|
95
|
+
reviewMode: e.optional(v),
|
|
96
|
+
options: e.optional(e.Array(y)),
|
|
97
|
+
when: e.optional(i),
|
|
82
98
|
group: e.optional(e.String),
|
|
83
99
|
timeoutMs: e.optional(e.Number)
|
|
84
|
-
}),
|
|
100
|
+
}), E = e.Struct({
|
|
85
101
|
key: e.String,
|
|
86
102
|
label: e.String,
|
|
87
103
|
type: e.Literal("text", "textarea", "number", "boolean"),
|
|
88
104
|
required: e.optional(e.Boolean),
|
|
89
105
|
placeholder: e.optional(e.String)
|
|
90
|
-
}),
|
|
106
|
+
}), D = e.Struct({
|
|
91
107
|
flowRef: e.String,
|
|
92
108
|
mappings: e.Array(e.Struct({
|
|
93
109
|
targetKey: e.String,
|
|
94
110
|
sourceKey: e.String
|
|
95
111
|
})),
|
|
96
112
|
requireConfirmation: e.optional(e.Boolean)
|
|
97
|
-
}),
|
|
113
|
+
}), O = e.Struct({
|
|
98
114
|
frequency: e.optional(e.Literal("weekly", "monthly")),
|
|
99
115
|
repeats: e.Array(e.Number),
|
|
100
116
|
intervalWeeks: e.optional(e.Number),
|
|
@@ -102,62 +118,62 @@ var n = e.Literal("truthy", "falsy", "eq", "neq", "contains"), r = e.Struct({
|
|
|
102
118
|
weekOfMonth: e.optional(e.Union(e.Literal(1, 2, 3, 4), e.Literal("last"))),
|
|
103
119
|
hour: e.optional(e.Number),
|
|
104
120
|
minute: e.optional(e.Literal(0, 15, 30, 45)),
|
|
105
|
-
defaultInput: e.optional(
|
|
106
|
-
}),
|
|
107
|
-
mode:
|
|
108
|
-
options: e.optional(e.Array(
|
|
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)),
|
|
109
125
|
prompt: e.String
|
|
110
|
-
}),
|
|
126
|
+
}), j = e.Literal("gateway", "estimated", "unpriced"), M = e.Literal("actual", "estimated", "incomplete", "unknown"), N = e.Struct({
|
|
111
127
|
status: e.Literal("reported", "unreported"),
|
|
112
128
|
unit: e.optional(e.Literal("tokens", "characters", "seconds")),
|
|
113
129
|
input: e.optional(e.Finite.pipe(e.nonNegative())),
|
|
114
130
|
output: e.optional(e.Finite.pipe(e.nonNegative()))
|
|
115
|
-
}),
|
|
131
|
+
}), P = e.Struct({
|
|
116
132
|
costMicroUsd: e.optional(e.Finite.pipe(e.nonNegative())),
|
|
117
|
-
costSource: e.optional(
|
|
133
|
+
costSource: e.optional(j),
|
|
118
134
|
requestId: e.optional(e.NonEmptyString),
|
|
119
|
-
usage: e.optional(
|
|
120
|
-
}),
|
|
135
|
+
usage: e.optional(N)
|
|
136
|
+
}), F = e.Struct({
|
|
121
137
|
id: e.Number,
|
|
122
138
|
title: e.String,
|
|
123
139
|
description: e.optional(e.String),
|
|
124
|
-
type:
|
|
125
|
-
status:
|
|
140
|
+
type: g,
|
|
141
|
+
status: k,
|
|
126
142
|
startedAt: e.optional(e.String),
|
|
127
143
|
completedAt: e.optional(e.String),
|
|
128
144
|
costMicroUsd: e.optional(e.Number),
|
|
129
|
-
costSource: e.optional(
|
|
145
|
+
costSource: e.optional(j),
|
|
130
146
|
requestId: e.optional(e.String),
|
|
131
|
-
usage: e.optional(
|
|
147
|
+
usage: e.optional(N),
|
|
132
148
|
url: e.optional(e.String),
|
|
133
|
-
artifacts: e.optional(
|
|
149
|
+
artifacts: e.optional(w),
|
|
134
150
|
output: e.optional(e.Struct({ text: e.String })),
|
|
135
151
|
errorMessage: e.optional(e.String),
|
|
136
152
|
skipReason: e.optional(e.String),
|
|
137
|
-
review: e.optional(
|
|
138
|
-
}),
|
|
153
|
+
review: e.optional(A)
|
|
154
|
+
}), I = e.Struct({
|
|
139
155
|
decision: e.optional(e.Literal("approve", "reject")),
|
|
140
156
|
value: e.optional(e.String),
|
|
141
157
|
text: e.optional(e.String),
|
|
142
158
|
respondedAt: e.optional(e.String)
|
|
143
|
-
}),
|
|
159
|
+
}), L = e.Struct({
|
|
144
160
|
runId: e.NonEmptyString,
|
|
145
161
|
stepIndex: e.Int.pipe(e.nonNegative()),
|
|
146
|
-
response:
|
|
147
|
-
}),
|
|
162
|
+
response: I
|
|
163
|
+
}), R = e.Struct({
|
|
148
164
|
runId: e.NonEmptyString,
|
|
149
165
|
stepIndex: e.Int.pipe(e.nonNegative()),
|
|
150
166
|
executionId: e.NonEmptyString,
|
|
151
167
|
eventId: e.NonEmptyString,
|
|
152
168
|
status: e.Literal("accepted")
|
|
153
|
-
}),
|
|
169
|
+
}), z = e.Struct({
|
|
154
170
|
flowRef: e.String,
|
|
155
|
-
input:
|
|
171
|
+
input: S,
|
|
156
172
|
status: e.Literal("pending", "confirmed", "dismissed")
|
|
157
|
-
}),
|
|
173
|
+
}), 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) => {
|
|
158
174
|
let t = (e.steps ?? []).map((e) => e.outputKey ? {
|
|
159
175
|
...e,
|
|
160
|
-
outputKey:
|
|
176
|
+
outputKey: W(e.outputKey)
|
|
161
177
|
} : e), n = e.orchestratorModel || e.orchestratorInstructions ? {
|
|
162
178
|
...e.orchestratorModel ? { model: e.orchestratorModel } : {},
|
|
163
179
|
...e.orchestratorInstructions ? { instructions: e.orchestratorInstructions } : {}
|
|
@@ -166,7 +182,7 @@ var n = e.Literal("truthy", "falsy", "eq", "neq", "contains"), r = e.Struct({
|
|
|
166
182
|
name: e.name,
|
|
167
183
|
mode: e.mode ?? "deterministic",
|
|
168
184
|
steps: t,
|
|
169
|
-
maxSteps:
|
|
185
|
+
maxSteps: U(e.maxSteps),
|
|
170
186
|
brief: e.brief ?? [],
|
|
171
187
|
...n ? { orchestrator: n } : {},
|
|
172
188
|
...e.chain ? { chain: e.chain } : {},
|
|
@@ -175,4 +191,4 @@ var n = e.Literal("truthy", "falsy", "eq", "neq", "contains"), r = e.Struct({
|
|
|
175
191
|
};
|
|
176
192
|
};
|
|
177
193
|
//#endregion
|
|
178
|
-
export {
|
|
194
|
+
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 };
|
package/dist/ir.d.ts
CHANGED
|
@@ -105,6 +105,32 @@ export declare interface FlowCadence {
|
|
|
105
105
|
readonly defaultInput?: Json | undefined;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
+
/** Row state and engine acknowledgement are separate observations. Retain the
|
|
109
|
+
* control request identity so an accepted/unknown request can be observed. */
|
|
110
|
+
export declare const FlowCancelReceipt: Schema.filter<Schema.Struct<{
|
|
111
|
+
runId: typeof Schema.NonEmptyString;
|
|
112
|
+
status: Schema.Literal<["pending", "running", "waiting", "succeeded", "failed", "cancelled"]>;
|
|
113
|
+
engine: Schema.Literal<["cancelled", "accepted", "unknown", "already-terminal", "unreachable", "not-requested"]>;
|
|
114
|
+
control: Schema.NullOr<Schema.filter<Schema.Struct<{
|
|
115
|
+
operation: Schema.Literal<["cancel", "resume"]>;
|
|
116
|
+
kind: Schema.Literal<["accepted", "confirmed", "unknown", "already-terminal"]>;
|
|
117
|
+
requestId: Schema.NullOr<typeof Schema.NonEmptyString>;
|
|
118
|
+
snapshot: Schema.Struct<{
|
|
119
|
+
id: typeof Schema.String;
|
|
120
|
+
workflowName: typeof Schema.String;
|
|
121
|
+
executionId: typeof Schema.String;
|
|
122
|
+
status: Schema.Union<[Schema.Literal<["running", "succeeded", "failed", "cancelled", "suspended"]>, Schema.Literal<["unknown"]>]>;
|
|
123
|
+
output: Schema.optional<typeof Schema.Unknown>;
|
|
124
|
+
error: Schema.optional<Schema.Struct<{
|
|
125
|
+
tag: Schema.NullOr<typeof Schema.String>;
|
|
126
|
+
message: typeof Schema.String;
|
|
127
|
+
}>>;
|
|
128
|
+
}>;
|
|
129
|
+
}>>>;
|
|
130
|
+
}>>;
|
|
131
|
+
|
|
132
|
+
export declare type FlowCancelReceipt = typeof FlowCancelReceipt.Type;
|
|
133
|
+
|
|
108
134
|
/** Follow-up flow spec. On success, map source → the child's brief. */
|
|
109
135
|
export declare const FlowChain: Schema.Struct<{
|
|
110
136
|
/** Child flow id (data) or name (code). */
|
package/dist/ir.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as e, B as t, C as n, D as r, E as i, F as a,
|
|
2
|
-
export {
|
|
1
|
+
import { A as e, B as t, C as n, D as r, E as i, F as a, H as o, I as s, L as c, M as l, N as u, O as d, P as f, R as p, S as m, T as h, V as g, _, a as v, b as y, c as b, d as x, f as S, g as C, h as w, i as T, j as E, k as D, l as O, m as k, n as A, o as j, p as M, r as N, s as P, t as F, u as I, v as L, w as R, x as z, y as B, z as V } from "./ir-BW5JRUiH.js";
|
|
2
|
+
export { F as BriefField, A as ChainPending, p as ConditionOp, N as CostCompleteness, T as CostSource, v as FlowCadence, j as FlowCancelReceipt, P as FlowChain, b as FlowMode, O as FlowReviewInput, I as FlowReviewReceipt, x as FlowStartReceipt, S as FlowStatus, M as FlowStep, k as HumanResponse, w as Json, C as MAX_STEPS_DEFAULT, _ as MAX_STEPS_MAX, L as MAX_STEPS_MIN, B as MediaArtifact, y as MediaArtifacts, z as MediaInputSlot, m as MediaInputs, n as MediaReceipt, R as Modality, h as ReviewMode, i as ReviewOption, r as RunReview, d as RunSource, D as RunStatus, e as RunStep, E as RunStepStatus, V as StepCondition, l as StepType, u as StepUsage, f as Visibility, a as clampMaxSteps, t as describeCondition, g as evaluateCondition, o as isTruthy, s as normalizeFlow, c as sanitizeOutputKey };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voltro/plugin-ai-flows",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.76.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.76.0",
|
|
62
|
+
"@voltro/client": "0.76.0",
|
|
63
|
+
"@voltro/database": "0.76.0",
|
|
64
|
+
"@voltro/env": "0.76.0",
|
|
65
|
+
"@voltro/plugin-audit": "0.76.0",
|
|
66
|
+
"@voltro/plugin-multitenancy": "0.76.0",
|
|
67
|
+
"@voltro/plugin-soft-delete": "0.76.0",
|
|
68
|
+
"@voltro/protocol": "0.76.0",
|
|
69
|
+
"@voltro/runtime": "0.76.0",
|
|
70
|
+
"@voltro/workflow": "0.76.0"
|
|
71
71
|
},
|
|
72
72
|
"peerDependencies": {
|
|
73
|
-
"effect": "^3.22.
|
|
73
|
+
"effect": "^3.22.2"
|
|
74
74
|
},
|
|
75
75
|
"publishConfig": {
|
|
76
76
|
"access": "public"
|