@voltro/plugin-ai-flows 0.74.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.
@@ -1,11 +1,11 @@
1
1
  import { Schema as e } from "effect";
2
- import { WorkflowRunHandleSchema as t } from "@voltro/protocol";
2
+ import { WorkflowControlResultSchema as t, WorkflowRunHandleSchema as n } from "@voltro/protocol";
3
3
  //#region src/condition.ts
4
- var n = e.Literal("truthy", "falsy", "eq", "neq", "contains"), r = e.Struct({
4
+ var r = e.Literal("truthy", "falsy", "eq", "neq", "contains"), i = e.Struct({
5
5
  ref: e.String,
6
- op: n,
6
+ op: r,
7
7
  value: e.optional(e.Unknown)
8
- }), i = (e) => e == null ? !1 : typeof e == "boolean" ? e : !Array.isArray(e) || e.length > 0, a = (e, t) => {
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
- }, o = (e, t) => {
17
+ }, s = (e, t) => {
18
18
  let n = t[e.ref];
19
19
  switch (e.op) {
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);
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) => a(t, e.value));
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
- }, s = (e) => {
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
- }, c = e.Struct({
39
+ }, l = e.Struct({
40
40
  runId: e.NonEmptyString,
41
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({
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
- }), v = e.Union(e.Struct({
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
- })), y = e.Record({
70
+ })), x = e.Record({
55
71
  key: e.String,
56
- value: v
57
- }), b = e.Record({
72
+ value: b
73
+ }), S = e.Record({
58
74
  key: e.String,
59
75
  value: e.Unknown
60
- }), x = e.Struct({
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
- }), S = e.Array(x).pipe(e.filter((e) => e.filter((e) => e.role === "primary").length === 1)), C = e.Struct({
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: m,
86
+ type: g,
71
87
  outputKey: e.optional(e.String),
72
88
  prompt: e.optional(e.String),
73
- modality: e.optional(h),
89
+ modality: e.optional(_),
74
90
  model: e.optional(e.String),
75
- params: e.optional(b),
76
- mediaInputs: e.optional(y),
91
+ params: e.optional(S),
92
+ mediaInputs: e.optional(x),
77
93
  agentRef: e.optional(e.String),
78
- schema: e.optional(b),
79
- reviewMode: e.optional(g),
80
- options: e.optional(e.Array(_)),
81
- when: e.optional(r),
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
- }), w = e.Struct({
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
- }), T = e.Struct({
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
- }), E = e.Struct({
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,51 +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(b)
106
- }), D = e.Literal("pending", "running", "waiting", "succeeded", "failed", "skipped"), O = e.Struct({
107
- mode: g,
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
- }), k = e.Literal("gateway", "estimated", "unpriced"), A = e.Literal("actual", "estimated", "incomplete", "unknown"), j = e.Struct({
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({
111
137
  id: e.Number,
112
138
  title: e.String,
113
139
  description: e.optional(e.String),
114
- type: m,
115
- status: D,
140
+ type: g,
141
+ status: k,
116
142
  startedAt: e.optional(e.String),
117
143
  completedAt: e.optional(e.String),
118
144
  costMicroUsd: e.optional(e.Number),
119
- costSource: e.optional(k),
145
+ costSource: e.optional(j),
120
146
  requestId: e.optional(e.String),
147
+ usage: e.optional(N),
121
148
  url: e.optional(e.String),
122
- artifacts: e.optional(S),
149
+ artifacts: e.optional(w),
123
150
  output: e.optional(e.Struct({ text: e.String })),
124
151
  errorMessage: e.optional(e.String),
125
152
  skipReason: e.optional(e.String),
126
- review: e.optional(O)
127
- }), M = e.Struct({
153
+ review: e.optional(A)
154
+ }), I = e.Struct({
128
155
  decision: e.optional(e.Literal("approve", "reject")),
129
156
  value: e.optional(e.String),
130
157
  text: e.optional(e.String),
131
158
  respondedAt: e.optional(e.String)
132
- }), N = e.Struct({
159
+ }), L = e.Struct({
133
160
  runId: e.NonEmptyString,
134
161
  stepIndex: e.Int.pipe(e.nonNegative()),
135
- response: M
136
- }), P = e.Struct({
162
+ response: I
163
+ }), R = e.Struct({
137
164
  runId: e.NonEmptyString,
138
165
  stepIndex: e.Int.pipe(e.nonNegative()),
139
166
  executionId: e.NonEmptyString,
140
167
  eventId: e.NonEmptyString,
141
168
  status: e.Literal("accepted")
142
- }), F = e.Struct({
169
+ }), z = e.Struct({
143
170
  flowRef: e.String,
144
- input: b,
171
+ input: S,
145
172
  status: e.Literal("pending", "confirmed", "dismissed")
146
- }), I = 30, L = 1, R = 100, z = (e) => e == null || !Number.isFinite(e) ? 30 : Math.min(100, Math.max(1, Math.trunc(e))), B = (e) => e.replace(/[^\w.-]/g, "_"), V = (e) => {
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) => {
147
174
  let t = (e.steps ?? []).map((e) => e.outputKey ? {
148
175
  ...e,
149
- outputKey: B(e.outputKey)
176
+ outputKey: W(e.outputKey)
150
177
  } : e), n = e.orchestratorModel || e.orchestratorInstructions ? {
151
178
  ...e.orchestratorModel ? { model: e.orchestratorModel } : {},
152
179
  ...e.orchestratorInstructions ? { instructions: e.orchestratorInstructions } : {}
@@ -155,7 +182,7 @@ var n = e.Literal("truthy", "falsy", "eq", "neq", "contains"), r = e.Struct({
155
182
  name: e.name,
156
183
  mode: e.mode ?? "deterministic",
157
184
  steps: t,
158
- maxSteps: z(e.maxSteps),
185
+ maxSteps: U(e.maxSteps),
159
186
  brief: e.brief ?? [],
160
187
  ...n ? { orchestrator: n } : {},
161
188
  ...e.chain ? { chain: e.chain } : {},
@@ -164,4 +191,4 @@ var n = e.Literal("truthy", "falsy", "eq", "neq", "contains"), r = e.Struct({
164
191
  };
165
192
  };
166
193
  //#endregion
167
- export { m as A, g as C, f as D, p as E, n as F, r as I, s as L, z as M, V as N, j as O, B as P, o as R, h as S, O as T, L as _, E as a, v as b, N as c, u as d, C as f, R as g, I as h, k as i, d as j, D as k, P as l, b as m, F as n, T as o, M as p, A as r, l as s, w as t, c as u, x as v, _ as w, y as x, S as y, i as z };
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). */
@@ -412,6 +438,26 @@ export declare const MediaInputSlot: Schema.Union<[Schema.Struct<{
412
438
 
413
439
  export declare type MediaInputSlot = typeof MediaInputSlot.Type;
414
440
 
441
+ /**
442
+ * The evidence of a charge that happened BEFORE a step failed — a provider that
443
+ * generated (and billed) while a later part of the step, typically storing the
444
+ * artifact, did not succeed. A failed step that carries one is priced like a
445
+ * succeeded one; the run's `costCompleteness` counts it.
446
+ */
447
+ export declare const MediaReceipt: Schema.Struct<{
448
+ costMicroUsd: Schema.optional<Schema.filter<typeof Schema.Finite>>;
449
+ costSource: Schema.optional<Schema.Literal<["gateway", "estimated", "unpriced"]>>;
450
+ requestId: Schema.optional<typeof Schema.NonEmptyString>;
451
+ usage: Schema.optional<Schema.Struct<{
452
+ status: Schema.Literal<["reported", "unreported"]>;
453
+ unit: Schema.optional<Schema.Literal<["tokens", "characters", "seconds"]>>;
454
+ input: Schema.optional<Schema.filter<typeof Schema.Finite>>;
455
+ output: Schema.optional<Schema.filter<typeof Schema.Finite>>;
456
+ }>>;
457
+ }>;
458
+
459
+ export declare type MediaReceipt = typeof MediaReceipt.Type;
460
+
415
461
  export declare const Modality: Schema.Literal<["text", "image", "video", "audio"]>;
416
462
 
417
463
  export declare type Modality = typeof Modality.Type;
@@ -473,6 +519,13 @@ export declare const RunStep: Schema.Struct<{
473
519
  costSource: Schema.optional<Schema.Literal<["gateway", "estimated", "unpriced"]>>;
474
520
  /** Links a media step to its generation/usage record. */
475
521
  requestId: Schema.optional<typeof Schema.String>;
522
+ /** What the step consumed — also on a FAILED step that was charged. */
523
+ usage: Schema.optional<Schema.Struct<{
524
+ status: Schema.Literal<["reported", "unreported"]>;
525
+ unit: Schema.optional<Schema.Literal<["tokens", "characters", "seconds"]>>;
526
+ input: Schema.optional<Schema.filter<typeof Schema.Finite>>;
527
+ output: Schema.optional<Schema.filter<typeof Schema.Finite>>;
528
+ }>>;
476
529
  /** Hosted media artifact URL (image/video/audio), via storage. */
477
530
  url: Schema.optional<typeof Schema.String>;
478
531
  /** All media variants, including roles and storage references; url projects the primary artifact. */
@@ -515,6 +568,8 @@ export declare interface RunStep {
515
568
  readonly costMicroUsd?: number | undefined;
516
569
  readonly costSource?: CostSource | undefined;
517
570
  readonly requestId?: string | undefined;
571
+ /** What the step consumed — also on a FAILED step that was charged. */
572
+ readonly usage?: StepUsage | undefined;
518
573
  readonly url?: string | undefined;
519
574
  readonly artifacts?: ReadonlyArray<MediaArtifact> | undefined;
520
575
  readonly output?: {
@@ -556,6 +611,25 @@ export declare const StepType: Schema.Literal<["agent", "generate", "structured"
556
611
 
557
612
  export declare type StepType = typeof StepType.Type;
558
613
 
614
+ /**
615
+ * What a step CONSUMED, in the provider's own unit — the quantity a cost was, or
616
+ * could have been, priced from. `reported`: the provider said so. `unreported`:
617
+ * the call returned no tally, so there is nothing to price and nothing to
618
+ * dispute, and saying that is different from saying zero.
619
+ *
620
+ * Without it a step priced `unpriced` read the same whether the provider had
621
+ * reported 7/150 tokens or nothing at all — and only the first can be priced
622
+ * later, or reconciled against an invoice.
623
+ */
624
+ export declare const StepUsage: Schema.Struct<{
625
+ status: Schema.Literal<["reported", "unreported"]>;
626
+ unit: Schema.optional<Schema.Literal<["tokens", "characters", "seconds"]>>;
627
+ input: Schema.optional<Schema.filter<typeof Schema.Finite>>;
628
+ output: Schema.optional<Schema.filter<typeof Schema.Finite>>;
629
+ }>;
630
+
631
+ export declare type StepUsage = typeof StepUsage.Type;
632
+
559
633
  /** Gallery scope. `shared` → per-subject share list; `organization` → tenant. */
560
634
  export declare const Visibility: Schema.Literal<["private", "organization", "shared"]>;
561
635
 
package/dist/ir.js CHANGED
@@ -1,2 +1,2 @@
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, R as d, S as f, T as p, _ as m, a as h, b as g, c as _, d as v, f as y, g as b, h as x, i as S, j as C, k as w, l as T, m as E, n as D, o as O, p as k, r as A, s as j, t as M, u as N, v as P, w as F, x as I, y as L, z as R } from "./ir-BP8rOTuf.js";
2
- export { M as BriefField, D as ChainPending, i as ConditionOp, A as CostCompleteness, S as CostSource, h as FlowCadence, O as FlowChain, j as FlowMode, _ as FlowReviewInput, T as FlowReviewReceipt, N as FlowStartReceipt, v as FlowStatus, y as FlowStep, k as HumanResponse, E as Json, x as MAX_STEPS_DEFAULT, b as MAX_STEPS_MAX, m as MAX_STEPS_MIN, P as MediaArtifact, L as MediaArtifacts, g as MediaInputSlot, I as MediaInputs, f as Modality, t as ReviewMode, F as ReviewOption, p as RunReview, r as RunSource, n as RunStatus, l as RunStep, w as RunStepStatus, a as StepCondition, e as StepType, C as Visibility, s as clampMaxSteps, o as describeCondition, d as evaluateCondition, R as isTruthy, c as normalizeFlow, u as sanitizeOutputKey };
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/dist/web.d.ts CHANGED
@@ -428,6 +428,13 @@ export declare const RunStep: Schema.Struct<{
428
428
  costSource: Schema.optional<Schema.Literal<["gateway", "estimated", "unpriced"]>>;
429
429
  /** Links a media step to its generation/usage record. */
430
430
  requestId: Schema.optional<typeof Schema.String>;
431
+ /** What the step consumed — also on a FAILED step that was charged. */
432
+ usage: Schema.optional<Schema.Struct<{
433
+ status: Schema.Literal<["reported", "unreported"]>;
434
+ unit: Schema.optional<Schema.Literal<["tokens", "characters", "seconds"]>>;
435
+ input: Schema.optional<Schema.filter<typeof Schema.Finite>>;
436
+ output: Schema.optional<Schema.filter<typeof Schema.Finite>>;
437
+ }>>;
431
438
  /** Hosted media artifact URL (image/video/audio), via storage. */
432
439
  url: Schema.optional<typeof Schema.String>;
433
440
  /** All media variants, including roles and storage references; url projects the primary artifact. */
@@ -470,6 +477,8 @@ export declare interface RunStep {
470
477
  readonly costMicroUsd?: number | undefined;
471
478
  readonly costSource?: CostSource | undefined;
472
479
  readonly requestId?: string | undefined;
480
+ /** What the step consumed — also on a FAILED step that was charged. */
481
+ readonly usage?: StepUsage | undefined;
473
482
  readonly url?: string | undefined;
474
483
  readonly artifacts?: ReadonlyArray<MediaArtifact> | undefined;
475
484
  readonly output?: {
@@ -506,6 +515,25 @@ export declare const StepType: Schema.Literal<["agent", "generate", "structured"
506
515
 
507
516
  export declare type StepType = typeof StepType.Type;
508
517
 
518
+ /**
519
+ * What a step CONSUMED, in the provider's own unit — the quantity a cost was, or
520
+ * could have been, priced from. `reported`: the provider said so. `unreported`:
521
+ * the call returned no tally, so there is nothing to price and nothing to
522
+ * dispute, and saying that is different from saying zero.
523
+ *
524
+ * Without it a step priced `unpriced` read the same whether the provider had
525
+ * reported 7/150 tokens or nothing at all — and only the first can be priced
526
+ * later, or reconciled against an invoice.
527
+ */
528
+ declare const StepUsage: Schema.Struct<{
529
+ status: Schema.Literal<["reported", "unreported"]>;
530
+ unit: Schema.optional<Schema.Literal<["tokens", "characters", "seconds"]>>;
531
+ input: Schema.optional<Schema.filter<typeof Schema.Finite>>;
532
+ output: Schema.optional<Schema.filter<typeof Schema.Finite>>;
533
+ }>;
534
+
535
+ declare type StepUsage = typeof StepUsage.Type;
536
+
509
537
  /** Cooperatively cancel a run (the engine stops before its next step). */
510
538
  export declare const useCancelFlow: (options?: FlowHookOptions) => {
511
539
  cancel: (runId: string) => Promise<{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voltro/plugin-ai-flows",
3
- "version": "0.74.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.74.0",
62
- "@voltro/client": "0.74.0",
63
- "@voltro/database": "0.74.0",
64
- "@voltro/env": "0.74.0",
65
- "@voltro/plugin-audit": "0.74.0",
66
- "@voltro/plugin-multitenancy": "0.74.0",
67
- "@voltro/plugin-soft-delete": "0.74.0",
68
- "@voltro/protocol": "0.74.0",
69
- "@voltro/runtime": "0.74.0",
70
- "@voltro/workflow": "0.74.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.1"
73
+ "effect": "^3.22.2"
74
74
  },
75
75
  "publishConfig": {
76
76
  "access": "public"