@voltro/plugin-ai-flows 0.83.1 → 0.85.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,7 +1,13 @@
1
1
  import { Schema as e } from "effect";
2
2
  import { WorkflowControlResultSchema as t, WorkflowRunHandleSchema as n } from "@voltro/protocol";
3
3
  //#region src/condition.ts
4
- var r = e.Literal("truthy", "falsy", "eq", "neq", "contains"), i = e.Struct({
4
+ var r = e.Literals([
5
+ "truthy",
6
+ "falsy",
7
+ "eq",
8
+ "neq",
9
+ "contains"
10
+ ]), i = e.Struct({
5
11
  ref: e.String,
6
12
  op: r,
7
13
  value: e.optional(e.Unknown)
@@ -40,12 +46,35 @@ var r = e.Literal("truthy", "falsy", "eq", "neq", "contains"), i = e.Struct({
40
46
  runId: e.NonEmptyString,
41
47
  requestId: e.NonEmptyString,
42
48
  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({
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({
44
66
  runId: e.NonEmptyString,
45
67
  status: p,
46
- engine: e.Literal("cancelled", "accepted", "unknown", "already-terminal", "unreachable", "not-requested"),
68
+ engine: e.Literals([
69
+ "cancelled",
70
+ "accepted",
71
+ "unknown",
72
+ "already-terminal",
73
+ "unreachable",
74
+ "not-requested"
75
+ ]),
47
76
  control: e.NullOr(t)
48
- }).pipe(e.filter((e) => {
77
+ }).pipe(e.check(e.makeFilter((e) => {
49
78
  let t = e.control;
50
79
  if (t !== null && t.operation !== "cancel") return !1;
51
80
  switch (e.engine) {
@@ -56,30 +85,39 @@ var r = e.Literal("truthy", "falsy", "eq", "neq", "contains"), i = e.Struct({
56
85
  case "unreachable":
57
86
  case "not-requested": return t === null;
58
87
  }
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({
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({
60
104
  value: e.String,
61
105
  label: e.String
62
- }), b = e.Union(e.Struct({
106
+ }), b = e.Union([e.Struct({
63
107
  from: e.Literal("upload"),
64
108
  url: e.String,
65
109
  mediaType: e.optional(e.NonEmptyString)
66
110
  }), e.Struct({
67
111
  from: e.Literal("step"),
68
112
  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({
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({
77
115
  url: e.NonEmptyString,
78
116
  mediaType: e.NonEmptyString,
79
117
  role: e.NonEmptyString,
80
118
  storageRefId: e.optional(e.NonEmptyString),
81
119
  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({
120
+ }), w = e.Array(C).pipe(e.check(e.makeFilter((e) => e.filter((e) => e.role === "primary").length === 1))), T = e.Struct({
83
121
  id: e.String,
84
122
  title: e.optional(e.String),
85
123
  description: e.optional(e.String),
@@ -100,7 +138,12 @@ var r = e.Literal("truthy", "falsy", "eq", "neq", "contains"), i = e.Struct({
100
138
  }), E = e.Struct({
101
139
  key: e.String,
102
140
  label: e.String,
103
- type: e.Literal("text", "textarea", "number", "boolean"),
141
+ type: e.Literals([
142
+ "text",
143
+ "textarea",
144
+ "number",
145
+ "boolean"
146
+ ]),
104
147
  required: e.optional(e.Boolean),
105
148
  placeholder: e.optional(e.String)
106
149
  }), D = e.Struct({
@@ -111,25 +154,55 @@ var r = e.Literal("truthy", "falsy", "eq", "neq", "contains"), i = e.Struct({
111
154
  })),
112
155
  requireConfirmation: e.optional(e.Boolean)
113
156
  }), O = e.Struct({
114
- frequency: e.optional(e.Literal("weekly", "monthly")),
157
+ frequency: e.optional(e.Literals(["weekly", "monthly"])),
115
158
  repeats: e.Array(e.Number),
116
159
  intervalWeeks: e.optional(e.Number),
117
160
  anchorDate: e.optional(e.String),
118
- weekOfMonth: e.optional(e.Union(e.Literal(1, 2, 3, 4), e.Literal("last"))),
161
+ weekOfMonth: e.optional(e.Union([e.Literals([
162
+ 1,
163
+ 2,
164
+ 3,
165
+ 4
166
+ ]), e.Literal("last")])),
119
167
  hour: e.optional(e.Number),
120
- minute: e.optional(e.Literal(0, 15, 30, 45)),
168
+ minute: e.optional(e.Literals([
169
+ 0,
170
+ 15,
171
+ 30,
172
+ 45
173
+ ])),
121
174
  defaultInput: e.optional(S)
122
- }), k = e.Literal("pending", "running", "waiting", "succeeded", "failed", "skipped"), A = e.Struct({
175
+ }), k = e.Literals([
176
+ "pending",
177
+ "running",
178
+ "waiting",
179
+ "succeeded",
180
+ "failed",
181
+ "skipped"
182
+ ]), A = e.Struct({
123
183
  mode: v,
124
184
  options: e.optional(e.Array(y)),
125
185
  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()))
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))))
131
204
  }), P = e.Struct({
132
- costMicroUsd: e.optional(e.Finite.pipe(e.nonNegative())),
205
+ costMicroUsd: e.optional(e.Finite.pipe(e.check(e.isGreaterThanOrEqualTo(0)))),
133
206
  costSource: e.optional(j),
134
207
  requestId: e.optional(e.NonEmptyString),
135
208
  usage: e.optional(N)
@@ -154,24 +227,28 @@ var r = e.Literal("truthy", "falsy", "eq", "neq", "contains"), i = e.Struct({
154
227
  skipReason: e.optional(e.String),
155
228
  review: e.optional(A)
156
229
  }), I = e.Struct({
157
- decision: e.optional(e.Literal("approve", "reject")),
230
+ decision: e.optional(e.Literals(["approve", "reject"])),
158
231
  value: e.optional(e.String),
159
232
  text: e.optional(e.String),
160
233
  respondedAt: e.optional(e.String)
161
234
  }), L = e.Struct({
162
235
  runId: e.NonEmptyString,
163
- stepIndex: e.Int.pipe(e.nonNegative()),
236
+ stepIndex: e.Int.pipe(e.check(e.isGreaterThanOrEqualTo(0))),
164
237
  response: I
165
238
  }), R = e.Struct({
166
239
  runId: e.NonEmptyString,
167
- stepIndex: e.Int.pipe(e.nonNegative()),
240
+ stepIndex: e.Int.pipe(e.check(e.isGreaterThanOrEqualTo(0))),
168
241
  executionId: e.NonEmptyString,
169
242
  eventId: e.NonEmptyString,
170
243
  status: e.Literal("accepted")
171
244
  }), z = e.Struct({
172
245
  flowRef: e.String,
173
246
  input: S,
174
- status: e.Literal("pending", "confirmed", "dismissed")
247
+ status: e.Literals([
248
+ "pending",
249
+ "confirmed",
250
+ "dismissed"
251
+ ])
175
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) => {
176
253
  let t = (e.steps ?? []).map((e) => e.outputKey ? {
177
254
  ...e,