@voltro/plugin-ai-flows 0.70.0 → 0.71.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,10 +1,11 @@
1
1
  import { Schema as e } from "effect";
2
+ import { WorkflowRunHandleSchema as t } from "@voltro/protocol";
2
3
  //#region src/condition.ts
3
- var t = e.Literal("truthy", "falsy", "eq", "neq", "contains"), n = e.Struct({
4
+ var n = e.Literal("truthy", "falsy", "eq", "neq", "contains"), r = e.Struct({
4
5
  ref: e.String,
5
- op: t,
6
+ op: n,
6
7
  value: e.optional(e.Unknown)
7
- }), r = (e) => e == null ? !1 : typeof e == "boolean" ? e : !Array.isArray(e) || e.length > 0, i = (e, t) => {
8
+ }), i = (e) => e == null ? !1 : typeof e == "boolean" ? e : !Array.isArray(e) || e.length > 0, a = (e, t) => {
8
9
  if (e === t) return !0;
9
10
  if (e === null || t === null || e === void 0 || t === void 0) return !1;
10
11
  if (typeof e == "object" || typeof t == "object") try {
@@ -13,21 +14,21 @@ var t = e.Literal("truthy", "falsy", "eq", "neq", "contains"), n = e.Struct({
13
14
  return !1;
14
15
  }
15
16
  return String(e) === String(t);
16
- }, a = (e, t) => {
17
+ }, o = (e, t) => {
17
18
  let n = t[e.ref];
18
19
  switch (e.op) {
19
- case "truthy": return r(n);
20
- case "falsy": return !r(n);
21
- case "eq": return i(n, e.value);
22
- case "neq": return !i(n, e.value);
20
+ case "truthy": return i(n);
21
+ case "falsy": return !i(n);
22
+ case "eq": return a(n, e.value);
23
+ case "neq": return !a(n, e.value);
23
24
  case "contains": {
24
25
  if (n == null) return !1;
25
- if (Array.isArray(n)) return n.some((t) => i(t, e.value));
26
+ if (Array.isArray(n)) return n.some((t) => a(t, e.value));
26
27
  let t = e.value;
27
28
  return typeof t != "string" && typeof t != "number" ? !1 : String(n).includes(String(t));
28
29
  }
29
30
  }
30
- }, o = (e) => {
31
+ }, s = (e) => {
31
32
  switch (e.op) {
32
33
  case "truthy": return `{{${e.ref}}} is set`;
33
34
  case "falsy": return `{{${e.ref}}} is not set`;
@@ -35,53 +36,64 @@ var t = e.Literal("truthy", "falsy", "eq", "neq", "contains"), n = e.Struct({
35
36
  case "neq": return `{{${e.ref}}} does not equal ${JSON.stringify(e.value)}`;
36
37
  case "contains": return `{{${e.ref}}} contains ${JSON.stringify(e.value)}`;
37
38
  }
38
- }, s = e.Literal("deterministic", "agentic"), c = e.Literal("draft", "active", "archived"), l = e.Literal("private", "organization", "shared"), u = e.Literal("pending", "running", "waiting", "succeeded", "failed", "cancelled"), d = e.Literal("manual", "cron"), f = e.Literal("agent", "generate", "structured", "note", "human"), p = e.Literal("text", "image", "video", "audio"), m = e.Literal("approve", "choice", "text"), h = e.Struct({
39
+ }, c = e.Struct({
40
+ runId: e.NonEmptyString,
41
+ requestId: e.NonEmptyString,
42
+ admission: t
43
+ }), l = e.Literal("deterministic", "agentic"), u = e.Literal("draft", "active", "archived"), d = e.Literal("private", "organization", "shared"), f = e.Literal("pending", "running", "waiting", "succeeded", "failed", "cancelled"), p = e.Literal("manual", "cron"), m = e.Literal("agent", "generate", "structured", "note", "human"), h = e.Literal("text", "image", "video", "audio"), g = e.Literal("approve", "choice", "text"), _ = e.Struct({
39
44
  value: e.String,
40
45
  label: e.String
41
- }), g = e.Union(e.Struct({
46
+ }), v = e.Union(e.Struct({
42
47
  from: e.Literal("upload"),
43
48
  url: e.String
44
49
  }), e.Struct({
45
50
  from: e.Literal("step"),
46
- ref: e.String
47
- })), _ = e.Record({
51
+ ref: e.String,
52
+ artifact: e.optional(e.Int.pipe(e.nonNegative()))
53
+ })), y = e.Record({
48
54
  key: e.String,
49
- value: g
50
- }), v = e.Record({
55
+ value: v
56
+ }), b = e.Record({
51
57
  key: e.String,
52
58
  value: e.Unknown
53
- }), y = e.Struct({
59
+ }), x = e.Struct({
60
+ url: e.NonEmptyString,
61
+ mediaType: e.NonEmptyString,
62
+ role: e.NonEmptyString,
63
+ storageRefId: e.optional(e.NonEmptyString),
64
+ providerMetadata: e.optional(e.Unknown)
65
+ }), S = e.Array(x).pipe(e.filter((e) => e.filter((e) => e.role === "primary").length === 1)), C = e.Struct({
54
66
  id: e.String,
55
67
  title: e.optional(e.String),
56
68
  description: e.optional(e.String),
57
- type: f,
69
+ type: m,
58
70
  outputKey: e.optional(e.String),
59
71
  prompt: e.optional(e.String),
60
- modality: e.optional(p),
72
+ modality: e.optional(h),
61
73
  model: e.optional(e.String),
62
- params: e.optional(v),
63
- mediaInputs: e.optional(_),
74
+ params: e.optional(b),
75
+ mediaInputs: e.optional(y),
64
76
  agentRef: e.optional(e.String),
65
- schema: e.optional(v),
66
- reviewMode: e.optional(m),
67
- options: e.optional(e.Array(h)),
68
- when: e.optional(n),
77
+ schema: e.optional(b),
78
+ reviewMode: e.optional(g),
79
+ options: e.optional(e.Array(_)),
80
+ when: e.optional(r),
69
81
  group: e.optional(e.String),
70
82
  timeoutMs: e.optional(e.Number)
71
- }), b = e.Struct({
83
+ }), w = e.Struct({
72
84
  key: e.String,
73
85
  label: e.String,
74
86
  type: e.Literal("text", "textarea", "number", "boolean"),
75
87
  required: e.optional(e.Boolean),
76
88
  placeholder: e.optional(e.String)
77
- }), x = e.Struct({
89
+ }), T = e.Struct({
78
90
  flowRef: e.String,
79
91
  mappings: e.Array(e.Struct({
80
92
  targetKey: e.String,
81
93
  sourceKey: e.String
82
94
  })),
83
95
  requireConfirmation: e.optional(e.Boolean)
84
- }), S = e.Struct({
96
+ }), E = e.Struct({
85
97
  frequency: e.optional(e.Literal("weekly", "monthly")),
86
98
  repeats: e.Array(e.Number),
87
99
  intervalWeeks: e.optional(e.Number),
@@ -89,39 +101,50 @@ var t = e.Literal("truthy", "falsy", "eq", "neq", "contains"), n = e.Struct({
89
101
  weekOfMonth: e.optional(e.Union(e.Literal(1, 2, 3, 4), e.Literal("last"))),
90
102
  hour: e.optional(e.Number),
91
103
  minute: e.optional(e.Literal(0, 15, 30, 45)),
92
- defaultInput: e.optional(v)
93
- }), C = e.Literal("pending", "running", "waiting", "succeeded", "failed", "skipped"), w = e.Struct({
94
- mode: m,
95
- options: e.optional(e.Array(h)),
104
+ defaultInput: e.optional(b)
105
+ }), D = e.Literal("pending", "running", "waiting", "succeeded", "failed", "skipped"), O = e.Struct({
106
+ mode: g,
107
+ options: e.optional(e.Array(_)),
96
108
  prompt: e.String
97
- }), T = e.Struct({
109
+ }), k = e.Struct({
98
110
  id: e.Number,
99
111
  title: e.String,
100
112
  description: e.optional(e.String),
101
- type: f,
102
- status: C,
113
+ type: m,
114
+ status: D,
103
115
  startedAt: e.optional(e.String),
104
116
  completedAt: e.optional(e.String),
105
117
  costMicroUsd: e.optional(e.Number),
106
118
  requestId: e.optional(e.String),
107
119
  url: e.optional(e.String),
120
+ artifacts: e.optional(S),
108
121
  output: e.optional(e.Struct({ text: e.String })),
109
122
  errorMessage: e.optional(e.String),
110
123
  skipReason: e.optional(e.String),
111
- review: e.optional(w)
112
- }), E = e.Struct({
124
+ review: e.optional(O)
125
+ }), A = e.Struct({
113
126
  decision: e.optional(e.Literal("approve", "reject")),
114
127
  value: e.optional(e.String),
115
128
  text: e.optional(e.String),
116
129
  respondedAt: e.optional(e.String)
117
- }), D = e.Struct({
130
+ }), j = e.Struct({
131
+ runId: e.NonEmptyString,
132
+ stepIndex: e.Int.pipe(e.nonNegative()),
133
+ response: A
134
+ }), M = e.Struct({
135
+ runId: e.NonEmptyString,
136
+ stepIndex: e.Int.pipe(e.nonNegative()),
137
+ executionId: e.NonEmptyString,
138
+ eventId: e.NonEmptyString,
139
+ status: e.Literal("accepted")
140
+ }), N = e.Struct({
118
141
  flowRef: e.String,
119
- input: v,
142
+ input: b,
120
143
  status: e.Literal("pending", "confirmed", "dismissed")
121
- }), O = 30, k = 1, A = 100, j = (e) => e == null || !Number.isFinite(e) ? 30 : Math.min(100, Math.max(1, Math.trunc(e))), M = (e) => e.replace(/[^\w.-]/g, "_"), N = (e) => {
144
+ }), P = 30, F = 1, I = 100, L = (e) => e == null || !Number.isFinite(e) ? 30 : Math.min(100, Math.max(1, Math.trunc(e))), R = (e) => e.replace(/[^\w.-]/g, "_"), z = (e) => {
122
145
  let t = (e.steps ?? []).map((e) => e.outputKey ? {
123
146
  ...e,
124
- outputKey: M(e.outputKey)
147
+ outputKey: R(e.outputKey)
125
148
  } : e), n = e.orchestratorModel || e.orchestratorInstructions ? {
126
149
  ...e.orchestratorModel ? { model: e.orchestratorModel } : {},
127
150
  ...e.orchestratorInstructions ? { instructions: e.orchestratorInstructions } : {}
@@ -130,7 +153,7 @@ var t = e.Literal("truthy", "falsy", "eq", "neq", "contains"), n = e.Struct({
130
153
  name: e.name,
131
154
  mode: e.mode ?? "deterministic",
132
155
  steps: t,
133
- maxSteps: j(e.maxSteps),
156
+ maxSteps: L(e.maxSteps),
134
157
  brief: e.brief ?? [],
135
158
  ...n ? { orchestrator: n } : {},
136
159
  ...e.chain ? { chain: e.chain } : {},
@@ -139,4 +162,4 @@ var t = e.Literal("truthy", "falsy", "eq", "neq", "contains"), n = e.Struct({
139
162
  };
140
163
  };
141
164
  //#endregion
142
- export { o as A, f as C, M as D, N as E, r as M, t as O, C as S, j as T, h as _, s as a, u as b, E as c, A as d, k as f, m as g, p as h, x as i, a as j, n as k, v as l, _ as m, D as n, c as o, g as p, S as r, y as s, b as t, O as u, w as v, l as w, T as x, d as y };
165
+ export { L as A, O as C, D, k as E, s as F, o as I, i as L, R as M, n as N, m as O, r as P, _ as S, f as T, S as _, l as a, h as b, c, A as d, b as f, x as g, F as h, T as i, z as j, d as k, u as l, I as m, N as n, j as o, P as p, E as r, M as s, w as t, C as u, v, p as w, g as x, y };
package/dist/ir.d.ts CHANGED
@@ -157,6 +157,51 @@ export declare const FlowMode: Schema.Literal<["deterministic", "agentic"]>;
157
157
 
158
158
  export declare type FlowMode = typeof FlowMode.Type;
159
159
 
160
+ /** Bind the answer to the review actually displayed, not the latest waiting step. */
161
+ export declare const FlowReviewInput: Schema.Struct<{
162
+ runId: typeof Schema.NonEmptyString;
163
+ stepIndex: Schema.filter<typeof Schema.Int>;
164
+ response: Schema.Struct<{
165
+ decision: Schema.optional<Schema.Literal<["approve", "reject"]>>;
166
+ value: Schema.optional<typeof Schema.String>;
167
+ text: Schema.optional<typeof Schema.String>;
168
+ respondedAt: Schema.optional<typeof Schema.String>;
169
+ }>;
170
+ }>;
171
+
172
+ export declare type FlowReviewInput = typeof FlowReviewInput.Type;
173
+
174
+ /** Delivery accepted; consumption and the run's eventual outcome remain reactive state. */
175
+ export declare const FlowReviewReceipt: Schema.Struct<{
176
+ runId: typeof Schema.NonEmptyString;
177
+ stepIndex: Schema.filter<typeof Schema.Int>;
178
+ executionId: typeof Schema.NonEmptyString;
179
+ eventId: typeof Schema.NonEmptyString;
180
+ status: Schema.Literal<["accepted"]>;
181
+ }>;
182
+
183
+ export declare type FlowReviewReceipt = typeof FlowReviewReceipt.Type;
184
+
185
+ /** Submission evidence, separate from the flow run's execution status. */
186
+ export declare const FlowStartReceipt: Schema.Struct<{
187
+ runId: typeof Schema.NonEmptyString;
188
+ requestId: typeof Schema.NonEmptyString;
189
+ admission: Schema.Struct<{
190
+ id: typeof Schema.String;
191
+ workflowName: typeof Schema.String;
192
+ executionId: Schema.NullOr<typeof Schema.String>;
193
+ status: Schema.Literal<["running", "succeeded", "queued", "dropped", "skipped", "replayed"]>;
194
+ deferral: Schema.optional<Schema.Struct<{
195
+ mode: typeof Schema.String;
196
+ dueAt: Schema.NullOr<typeof Schema.Number>;
197
+ retryAfterMs: Schema.NullOr<typeof Schema.Number>;
198
+ intentId: Schema.NullOr<typeof Schema.String>;
199
+ }>>;
200
+ }>;
201
+ }>;
202
+
203
+ export declare type FlowStartReceipt = typeof FlowStartReceipt.Type;
204
+
160
205
  /** Flow-definition lifecycle. */
161
206
  export declare const FlowStatus: Schema.Literal<["draft", "active", "archived"]>;
162
207
 
@@ -187,11 +232,11 @@ export declare const FlowStep: Schema.Struct<{
187
232
  }>, Schema.Struct<{
188
233
  from: Schema.Literal<["step"]>;
189
234
  ref: typeof Schema.String;
235
+ artifact: Schema.optional<Schema.filter<typeof Schema.Int>>;
190
236
  }>]>>>;
191
- /** Allowed sub-agent id/name. The framework resolves a real id; any
192
- * legacy-numeric bridge stays in the consumer app's mapping. */
237
+ /** Allowed sub-agent id/name, resolved and authorized by the host. */
193
238
  agentRef: Schema.optional<typeof Schema.String>;
194
- /** JSON Schema of the desired object (adapted to an Effect Schema at run). */
239
+ /** JSON Schema of the desired object, preserved and validated at run. */
195
240
  schema: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>;
196
241
  reviewMode: Schema.optional<Schema.Literal<["approve", "choice", "text"]>>;
197
242
  options: Schema.optional<Schema.Array$<Schema.Struct<{
@@ -266,7 +311,7 @@ export declare interface FlowStep {
266
311
  readonly timeoutMs?: number | undefined;
267
312
  }
268
313
 
269
- /** The HITL answer, written by `respond`. */
314
+ /** The HITL answer; the engine projects it after consuming the durable signal. */
270
315
  export declare const HumanResponse: Schema.Struct<{
271
316
  decision: Schema.optional<Schema.Literal<["approve", "reject"]>>;
272
317
  value: Schema.optional<typeof Schema.String>;
@@ -309,18 +354,39 @@ export declare const MAX_STEPS_MAX = 100;
309
354
 
310
355
  export declare const MAX_STEPS_MIN = 1;
311
356
 
357
+ /** One persisted media artifact. Storage identity is not a provider request ID.
358
+ * Exactly one artifact per result has role `primary`; other roles are host-defined. */
359
+ export declare const MediaArtifact: Schema.Struct<{
360
+ url: typeof Schema.NonEmptyString;
361
+ mediaType: typeof Schema.NonEmptyString;
362
+ role: typeof Schema.NonEmptyString;
363
+ storageRefId: Schema.optional<typeof Schema.NonEmptyString>;
364
+ providerMetadata: Schema.optional<typeof Schema.Unknown>;
365
+ }>;
366
+
367
+ export declare type MediaArtifact = typeof MediaArtifact.Type;
368
+
369
+ export declare const MediaArtifacts: Schema.filter<Schema.Array$<Schema.Struct<{
370
+ url: typeof Schema.NonEmptyString;
371
+ mediaType: typeof Schema.NonEmptyString;
372
+ role: typeof Schema.NonEmptyString;
373
+ storageRefId: Schema.optional<typeof Schema.NonEmptyString>;
374
+ providerMetadata: Schema.optional<typeof Schema.Unknown>;
375
+ }>>>;
376
+
312
377
  export declare const MediaInputs: Schema.Record$<typeof Schema.String, Schema.Union<[Schema.Struct<{
313
378
  from: Schema.Literal<["upload"]>;
314
379
  url: typeof Schema.String;
315
380
  }>, Schema.Struct<{
316
381
  from: Schema.Literal<["step"]>;
317
382
  ref: typeof Schema.String;
383
+ artifact: Schema.optional<Schema.filter<typeof Schema.Int>>;
318
384
  }>]>>;
319
385
 
320
386
  export declare type MediaInputs = typeof MediaInputs.Type;
321
387
 
322
- /** A media-input slot for a video `generate` step — either an uploaded URL or a
323
- * reference to a prior step's output. Keyed by capability slot name
388
+ /** A media-input slot — an absolute HTTP(S) uploaded URL or a reference to a
389
+ * brief field/prior step's URL output. Keyed by capability slot name
324
390
  * (`referenceImageUrl`, `lastFrameImageUrl`, `referenceVideoUrl`, …). */
325
391
  export declare const MediaInputSlot: Schema.Union<[Schema.Struct<{
326
392
  from: Schema.Literal<["upload"]>;
@@ -328,6 +394,7 @@ export declare const MediaInputSlot: Schema.Union<[Schema.Struct<{
328
394
  }>, Schema.Struct<{
329
395
  from: Schema.Literal<["step"]>;
330
396
  ref: typeof Schema.String;
397
+ artifact: Schema.optional<Schema.filter<typeof Schema.Int>>;
331
398
  }>]>;
332
399
 
333
400
  export declare type MediaInputSlot = typeof MediaInputSlot.Type;
@@ -392,6 +459,14 @@ export declare const RunStep: Schema.Struct<{
392
459
  requestId: Schema.optional<typeof Schema.String>;
393
460
  /** Hosted media artifact URL (image/video/audio), via storage. */
394
461
  url: Schema.optional<typeof Schema.String>;
462
+ /** All media variants, including roles and storage references; url projects the primary artifact. */
463
+ artifacts: Schema.optional<Schema.filter<Schema.Array$<Schema.Struct<{
464
+ url: typeof Schema.NonEmptyString;
465
+ mediaType: typeof Schema.NonEmptyString;
466
+ role: typeof Schema.NonEmptyString;
467
+ storageRefId: Schema.optional<typeof Schema.NonEmptyString>;
468
+ providerMetadata: Schema.optional<typeof Schema.Unknown>;
469
+ }>>>>;
395
470
  /** Inline text output (rendered as markdown). */
396
471
  output: Schema.optional<Schema.Struct<{
397
472
  text: typeof Schema.String;
@@ -424,6 +499,7 @@ export declare interface RunStep {
424
499
  readonly costMicroUsd?: number | undefined;
425
500
  readonly requestId?: string | undefined;
426
501
  readonly url?: string | undefined;
502
+ readonly artifacts?: ReadonlyArray<MediaArtifact> | undefined;
427
503
  readonly output?: {
428
504
  readonly text: string;
429
505
  } | undefined;
package/dist/ir.js CHANGED
@@ -1,2 +1,2 @@
1
- import { A as e, C as t, D as n, E as r, M as i, O as a, S as o, T as s, _ as c, a as l, b as u, c as d, d as f, f as p, g as m, h, i as g, j as _, k as v, l as y, m as b, n as x, o as S, p as C, r as w, s as T, t as E, u as D, v as O, w as k, x as A, y as j } from "./ir-BOv5uwYI.js";
2
- export { E as BriefField, x as ChainPending, a as ConditionOp, w as FlowCadence, g as FlowChain, l as FlowMode, S as FlowStatus, T as FlowStep, d as HumanResponse, y as Json, D as MAX_STEPS_DEFAULT, f as MAX_STEPS_MAX, p as MAX_STEPS_MIN, C as MediaInputSlot, b as MediaInputs, h as Modality, m as ReviewMode, c as ReviewOption, O as RunReview, j as RunSource, u as RunStatus, A as RunStep, o as RunStepStatus, v as StepCondition, t as StepType, k as Visibility, s as clampMaxSteps, e as describeCondition, _ as evaluateCondition, i as isTruthy, r as normalizeFlow, n as sanitizeOutputKey };
1
+ import { A as e, C as t, D as n, E as r, F as i, I as a, L as o, M as s, N as c, O as l, P as u, S as d, T as f, _ as p, a as m, b as h, c as g, d as _, f as v, g as y, h as b, i as x, j as S, k as C, l as w, m as T, n as E, o as D, p as O, r as k, s as A, t as j, u as M, v as N, w as P, x as F, y as I } from "./ir-B0rox9qW.js";
2
+ export { j as BriefField, E as ChainPending, c as ConditionOp, k as FlowCadence, x as FlowChain, m as FlowMode, D as FlowReviewInput, A as FlowReviewReceipt, g as FlowStartReceipt, w as FlowStatus, M as FlowStep, _ as HumanResponse, v as Json, O as MAX_STEPS_DEFAULT, T as MAX_STEPS_MAX, b as MAX_STEPS_MIN, y as MediaArtifact, p as MediaArtifacts, N as MediaInputSlot, I as MediaInputs, h as Modality, F as ReviewMode, d as ReviewOption, t as RunReview, P as RunSource, f as RunStatus, r as RunStep, n as RunStepStatus, u as StepCondition, l as StepType, C as Visibility, e as clampMaxSteps, i as describeCondition, a as evaluateCondition, o as isTruthy, S as normalizeFlow, s as sanitizeOutputKey };