@voltro/plugin-ai-flows 0.74.0 → 0.75.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.
@@ -108,6 +108,16 @@ var n = e.Literal("truthy", "falsy", "eq", "neq", "contains"), r = e.Struct({
108
108
  options: e.optional(e.Array(_)),
109
109
  prompt: e.String
110
110
  }), k = e.Literal("gateway", "estimated", "unpriced"), A = e.Literal("actual", "estimated", "incomplete", "unknown"), j = e.Struct({
111
+ status: e.Literal("reported", "unreported"),
112
+ unit: e.optional(e.Literal("tokens", "characters", "seconds")),
113
+ input: e.optional(e.Finite.pipe(e.nonNegative())),
114
+ output: e.optional(e.Finite.pipe(e.nonNegative()))
115
+ }), M = e.Struct({
116
+ costMicroUsd: e.optional(e.Finite.pipe(e.nonNegative())),
117
+ costSource: e.optional(k),
118
+ requestId: e.optional(e.NonEmptyString),
119
+ usage: e.optional(j)
120
+ }), N = e.Struct({
111
121
  id: e.Number,
112
122
  title: e.String,
113
123
  description: e.optional(e.String),
@@ -118,35 +128,36 @@ var n = e.Literal("truthy", "falsy", "eq", "neq", "contains"), r = e.Struct({
118
128
  costMicroUsd: e.optional(e.Number),
119
129
  costSource: e.optional(k),
120
130
  requestId: e.optional(e.String),
131
+ usage: e.optional(j),
121
132
  url: e.optional(e.String),
122
133
  artifacts: e.optional(S),
123
134
  output: e.optional(e.Struct({ text: e.String })),
124
135
  errorMessage: e.optional(e.String),
125
136
  skipReason: e.optional(e.String),
126
137
  review: e.optional(O)
127
- }), M = e.Struct({
138
+ }), P = e.Struct({
128
139
  decision: e.optional(e.Literal("approve", "reject")),
129
140
  value: e.optional(e.String),
130
141
  text: e.optional(e.String),
131
142
  respondedAt: e.optional(e.String)
132
- }), N = e.Struct({
143
+ }), F = e.Struct({
133
144
  runId: e.NonEmptyString,
134
145
  stepIndex: e.Int.pipe(e.nonNegative()),
135
- response: M
136
- }), P = e.Struct({
146
+ response: P
147
+ }), I = e.Struct({
137
148
  runId: e.NonEmptyString,
138
149
  stepIndex: e.Int.pipe(e.nonNegative()),
139
150
  executionId: e.NonEmptyString,
140
151
  eventId: e.NonEmptyString,
141
152
  status: e.Literal("accepted")
142
- }), F = e.Struct({
153
+ }), L = e.Struct({
143
154
  flowRef: e.String,
144
155
  input: b,
145
156
  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) => {
157
+ }), R = 30, z = 1, B = 100, V = (e) => e == null || !Number.isFinite(e) ? 30 : Math.min(100, Math.max(1, Math.trunc(e))), H = (e) => e.replace(/[^\w.-]/g, "_"), U = (e) => {
147
158
  let t = (e.steps ?? []).map((e) => e.outputKey ? {
148
159
  ...e,
149
- outputKey: B(e.outputKey)
160
+ outputKey: H(e.outputKey)
150
161
  } : e), n = e.orchestratorModel || e.orchestratorInstructions ? {
151
162
  ...e.orchestratorModel ? { model: e.orchestratorModel } : {},
152
163
  ...e.orchestratorInstructions ? { instructions: e.orchestratorInstructions } : {}
@@ -155,7 +166,7 @@ var n = e.Literal("truthy", "falsy", "eq", "neq", "contains"), r = e.Struct({
155
166
  name: e.name,
156
167
  mode: e.mode ?? "deterministic",
157
168
  steps: t,
158
- maxSteps: z(e.maxSteps),
169
+ maxSteps: V(e.maxSteps),
159
170
  brief: e.brief ?? [],
160
171
  ...n ? { orchestrator: n } : {},
161
172
  ...e.chain ? { chain: e.chain } : {},
@@ -164,4 +175,4 @@ var n = e.Literal("truthy", "falsy", "eq", "neq", "contains"), r = e.Struct({
164
175
  };
165
176
  };
166
177
  //#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 };
178
+ export { D as A, o as B, h as C, p as D, O as E, U as F, H as I, n as L, j as M, d as N, f as O, V as P, r as R, M as S, _ as T, i as V, z as _, E as a, v as b, F as c, u as d, C as f, B as g, R as h, k as i, m as j, N as k, I as l, b as m, L as n, T as o, P as p, A as r, l as s, w as t, c as u, x as v, g as w, y as x, S as y, s as z };
package/dist/ir.d.ts CHANGED
@@ -412,6 +412,26 @@ export declare const MediaInputSlot: Schema.Union<[Schema.Struct<{
412
412
 
413
413
  export declare type MediaInputSlot = typeof MediaInputSlot.Type;
414
414
 
415
+ /**
416
+ * The evidence of a charge that happened BEFORE a step failed — a provider that
417
+ * generated (and billed) while a later part of the step, typically storing the
418
+ * artifact, did not succeed. A failed step that carries one is priced like a
419
+ * succeeded one; the run's `costCompleteness` counts it.
420
+ */
421
+ export declare const MediaReceipt: Schema.Struct<{
422
+ costMicroUsd: Schema.optional<Schema.filter<typeof Schema.Finite>>;
423
+ costSource: Schema.optional<Schema.Literal<["gateway", "estimated", "unpriced"]>>;
424
+ requestId: Schema.optional<typeof Schema.NonEmptyString>;
425
+ usage: Schema.optional<Schema.Struct<{
426
+ status: Schema.Literal<["reported", "unreported"]>;
427
+ unit: Schema.optional<Schema.Literal<["tokens", "characters", "seconds"]>>;
428
+ input: Schema.optional<Schema.filter<typeof Schema.Finite>>;
429
+ output: Schema.optional<Schema.filter<typeof Schema.Finite>>;
430
+ }>>;
431
+ }>;
432
+
433
+ export declare type MediaReceipt = typeof MediaReceipt.Type;
434
+
415
435
  export declare const Modality: Schema.Literal<["text", "image", "video", "audio"]>;
416
436
 
417
437
  export declare type Modality = typeof Modality.Type;
@@ -473,6 +493,13 @@ export declare const RunStep: Schema.Struct<{
473
493
  costSource: Schema.optional<Schema.Literal<["gateway", "estimated", "unpriced"]>>;
474
494
  /** Links a media step to its generation/usage record. */
475
495
  requestId: Schema.optional<typeof Schema.String>;
496
+ /** What the step consumed — also on a FAILED step that was charged. */
497
+ usage: Schema.optional<Schema.Struct<{
498
+ status: Schema.Literal<["reported", "unreported"]>;
499
+ unit: Schema.optional<Schema.Literal<["tokens", "characters", "seconds"]>>;
500
+ input: Schema.optional<Schema.filter<typeof Schema.Finite>>;
501
+ output: Schema.optional<Schema.filter<typeof Schema.Finite>>;
502
+ }>>;
476
503
  /** Hosted media artifact URL (image/video/audio), via storage. */
477
504
  url: Schema.optional<typeof Schema.String>;
478
505
  /** All media variants, including roles and storage references; url projects the primary artifact. */
@@ -515,6 +542,8 @@ export declare interface RunStep {
515
542
  readonly costMicroUsd?: number | undefined;
516
543
  readonly costSource?: CostSource | undefined;
517
544
  readonly requestId?: string | undefined;
545
+ /** What the step consumed — also on a FAILED step that was charged. */
546
+ readonly usage?: StepUsage | undefined;
518
547
  readonly url?: string | undefined;
519
548
  readonly artifacts?: ReadonlyArray<MediaArtifact> | undefined;
520
549
  readonly output?: {
@@ -556,6 +585,25 @@ export declare const StepType: Schema.Literal<["agent", "generate", "structured"
556
585
 
557
586
  export declare type StepType = typeof StepType.Type;
558
587
 
588
+ /**
589
+ * What a step CONSUMED, in the provider's own unit — the quantity a cost was, or
590
+ * could have been, priced from. `reported`: the provider said so. `unreported`:
591
+ * the call returned no tally, so there is nothing to price and nothing to
592
+ * dispute, and saying that is different from saying zero.
593
+ *
594
+ * Without it a step priced `unpriced` read the same whether the provider had
595
+ * reported 7/150 tokens or nothing at all — and only the first can be priced
596
+ * later, or reconciled against an invoice.
597
+ */
598
+ export declare const StepUsage: Schema.Struct<{
599
+ status: Schema.Literal<["reported", "unreported"]>;
600
+ unit: Schema.optional<Schema.Literal<["tokens", "characters", "seconds"]>>;
601
+ input: Schema.optional<Schema.filter<typeof Schema.Finite>>;
602
+ output: Schema.optional<Schema.filter<typeof Schema.Finite>>;
603
+ }>;
604
+
605
+ export declare type StepUsage = typeof StepUsage.Type;
606
+
559
607
  /** Gallery scope. `shared` → per-subject share list; `organization` → tenant. */
560
608
  export declare const Visibility: Schema.Literal<["private", "organization", "shared"]>;
561
609
 
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, I as o, L as s, M as c, N as l, O as u, P as d, R as f, S as p, T as m, V as h, _ as g, a as _, b as v, c as y, d as b, f as x, g as S, h as C, i as w, j as T, k as E, l as D, m as O, n as k, o as A, p as j, r as M, s as N, t as P, u as F, v as I, w as L, x as R, y as z, z as B } from "./ir-C2ewescS.js";
2
+ export { P as BriefField, k as ChainPending, s as ConditionOp, M as CostCompleteness, w as CostSource, _ as FlowCadence, A as FlowChain, N as FlowMode, y as FlowReviewInput, D as FlowReviewReceipt, F as FlowStartReceipt, b as FlowStatus, x as FlowStep, j as HumanResponse, O as Json, C as MAX_STEPS_DEFAULT, S as MAX_STEPS_MAX, g as MAX_STEPS_MIN, I as MediaArtifact, z as MediaArtifacts, v as MediaInputSlot, R as MediaInputs, p as MediaReceipt, n as Modality, L as ReviewMode, m as ReviewOption, i as RunReview, r as RunSource, u as RunStatus, E as RunStep, e as RunStepStatus, f as StepCondition, T as StepType, c as StepUsage, l as Visibility, d as clampMaxSteps, B as describeCondition, t as evaluateCondition, h as isTruthy, a as normalizeFlow, o 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.75.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,16 +58,16 @@
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.75.0",
62
+ "@voltro/client": "0.75.0",
63
+ "@voltro/database": "0.75.0",
64
+ "@voltro/env": "0.75.0",
65
+ "@voltro/plugin-audit": "0.75.0",
66
+ "@voltro/plugin-multitenancy": "0.75.0",
67
+ "@voltro/plugin-soft-delete": "0.75.0",
68
+ "@voltro/protocol": "0.75.0",
69
+ "@voltro/runtime": "0.75.0",
70
+ "@voltro/workflow": "0.75.0"
71
71
  },
72
72
  "peerDependencies": {
73
73
  "effect": "^3.22.1"