@voltro/plugin-ai-flows 0.1.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/dist/ir.d.ts ADDED
@@ -0,0 +1,279 @@
1
+ import { Schema } from 'effect';
2
+
3
+ /** A launch-form field. The run `input` is keyed by these `key`s. */
4
+ export declare const BriefField: Schema.Struct<{
5
+ key: typeof Schema.String;
6
+ label: typeof Schema.String;
7
+ type: Schema.Literal<["text", "textarea", "number", "boolean"]>;
8
+ required: Schema.optional<typeof Schema.Boolean>;
9
+ placeholder: Schema.optional<typeof Schema.String>;
10
+ }>;
11
+
12
+ export declare type BriefField = typeof BriefField.Type;
13
+
14
+ /** Staged follow-up when `chainTo.requireConfirmation` is set. */
15
+ export declare const ChainPending: Schema.Struct<{
16
+ flowRef: typeof Schema.String;
17
+ input: Schema.Record$<typeof Schema.String, typeof Schema.Unknown>;
18
+ status: Schema.Literal<["pending", "confirmed", "dismissed"]>;
19
+ }>;
20
+
21
+ export declare type ChainPending = typeof ChainPending.Type;
22
+
23
+ export declare const clampMaxSteps: (n: number | null | undefined) => number;
24
+
25
+ /** Schedule spec — richer than a single cron expr (weekly interval + anchor,
26
+ * monthly weekOfMonth), evaluated by the shared `cadenceMatches` predicate. */
27
+ export declare const FlowCadence: Schema.Struct<{
28
+ frequency: Schema.optional<Schema.Literal<["weekly", "monthly"]>>;
29
+ /** Weekdays, 0=Monday … 6=Sunday. */
30
+ repeats: Schema.Array$<typeof Schema.Number>;
31
+ /** Weekly cycle length: 1 | 2 | 4 (anchored by anchorDate). */
32
+ intervalWeeks: Schema.optional<typeof Schema.Number>;
33
+ /** ISO YYYY-MM-DD, cycle-0 week (interval > 1). */
34
+ anchorDate: Schema.optional<typeof Schema.String>;
35
+ weekOfMonth: Schema.optional<Schema.Union<[Schema.Literal<[1, 2, 3, 4]>, Schema.Literal<["last"]>]>>;
36
+ /** 0-23, default 9. */
37
+ hour: Schema.optional<typeof Schema.Number>;
38
+ minute: Schema.optional<Schema.Literal<[0, 15, 30, 45]>>;
39
+ /** Brief for unattended cron runs. */
40
+ defaultInput: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>;
41
+ }>;
42
+
43
+ export declare type FlowCadence = typeof FlowCadence.Type;
44
+
45
+ /** Follow-up flow spec. On success, map source → the child's brief. */
46
+ export declare const FlowChain: Schema.Struct<{
47
+ /** Child flow id (data) or name (code). */
48
+ flowRef: typeof Schema.String;
49
+ mappings: Schema.Array$<Schema.Struct<{
50
+ targetKey: typeof Schema.String;
51
+ sourceKey: typeof Schema.String;
52
+ }>>;
53
+ requireConfirmation: Schema.optional<typeof Schema.Boolean>;
54
+ }>;
55
+
56
+ export declare type FlowChain = typeof FlowChain.Type;
57
+
58
+ /** The raw flow definition either front door supplies before normalization.
59
+ * Optional fields tolerate explicit `undefined` (row reads produce it). */
60
+ export declare interface FlowDefinitionInput {
61
+ readonly name: string;
62
+ readonly mode?: FlowMode | undefined;
63
+ readonly steps?: ReadonlyArray<FlowStep> | undefined;
64
+ readonly maxSteps?: number | null | undefined;
65
+ readonly brief?: ReadonlyArray<BriefField> | undefined;
66
+ readonly orchestratorModel?: string | null | undefined;
67
+ readonly orchestratorInstructions?: string | null | undefined;
68
+ readonly chain?: FlowChain | null | undefined;
69
+ readonly cadence?: FlowCadence | null | undefined;
70
+ }
71
+
72
+ /** The single representation the engine interprets, from either front door. */
73
+ export declare interface FlowIR {
74
+ readonly name: string;
75
+ readonly mode: FlowMode;
76
+ readonly steps: ReadonlyArray<FlowStep>;
77
+ readonly maxSteps: number;
78
+ readonly brief: ReadonlyArray<BriefField>;
79
+ readonly orchestrator?: {
80
+ readonly model?: string;
81
+ readonly instructions?: string;
82
+ };
83
+ readonly chain?: FlowChain;
84
+ readonly cadence?: FlowCadence;
85
+ }
86
+
87
+ /** Execution mode. Replaces the legacy `allowDeviation` boolean — a mode is not
88
+ * a boolean. `deterministic` runs the plan verbatim (resumable per step);
89
+ * `agentic` lets an orchestrator LLM adapt the plan via the four tools. */
90
+ export declare const FlowMode: Schema.Literal<["deterministic", "agentic"]>;
91
+
92
+ export declare type FlowMode = typeof FlowMode.Type;
93
+
94
+ /** Flow-definition lifecycle. */
95
+ export declare const FlowStatus: Schema.Literal<["draft", "active", "archived"]>;
96
+
97
+ export declare type FlowStatus = typeof FlowStatus.Type;
98
+
99
+ /**
100
+ * A plan step. This is the AUTHORED shape — stored on `ai_flows.steps` (data
101
+ * front door) or produced by `defineFlow`'s builders (code front door). The
102
+ * engine interprets it; later steps reference an earlier step's deliverable via
103
+ * `{{outputKey}}` in `prompt` / media refs.
104
+ */
105
+ export declare const FlowStep: Schema.Struct<{
106
+ id: typeof Schema.String;
107
+ title: Schema.optional<typeof Schema.String>;
108
+ /** Informational; shown under the step in the run timeline. */
109
+ description: Schema.optional<typeof Schema.String>;
110
+ type: Schema.Literal<["agent", "generate", "structured", "note", "human"]>;
111
+ /** Sanitized [\w.-]; the result-bundle key + the `{{ref}}` name. */
112
+ outputKey: Schema.optional<typeof Schema.String>;
113
+ /** Template with `{{key}}` placeholders (brief inputs + prior outputKeys). */
114
+ prompt: Schema.optional<typeof Schema.String>;
115
+ modality: Schema.optional<Schema.Literal<["text", "image", "video", "audio"]>>;
116
+ model: Schema.optional<typeof Schema.String>;
117
+ params: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>;
118
+ mediaInputs: Schema.optional<Schema.Record$<typeof Schema.String, Schema.Union<[Schema.Struct<{
119
+ from: Schema.Literal<["upload"]>;
120
+ url: typeof Schema.String;
121
+ }>, Schema.Struct<{
122
+ from: Schema.Literal<["step"]>;
123
+ ref: typeof Schema.String;
124
+ }>]>>>;
125
+ /** Allowed sub-agent id/name. The framework resolves a real id; any
126
+ * legacy-numeric bridge stays in the consumer app's mapping. */
127
+ agentRef: Schema.optional<typeof Schema.String>;
128
+ /** JSON Schema of the desired object (adapted to an Effect Schema at run). */
129
+ schema: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>;
130
+ reviewMode: Schema.optional<Schema.Literal<["approve", "choice", "text"]>>;
131
+ options: Schema.optional<Schema.Array$<Schema.Struct<{
132
+ value: typeof Schema.String;
133
+ label: typeof Schema.String;
134
+ }>>>;
135
+ }>;
136
+
137
+ export declare type FlowStep = typeof FlowStep.Type;
138
+
139
+ /** The HITL answer, written by `respond`. */
140
+ export declare const HumanResponse: Schema.Struct<{
141
+ decision: Schema.optional<Schema.Literal<["approve", "reject"]>>;
142
+ value: Schema.optional<typeof Schema.String>;
143
+ text: Schema.optional<typeof Schema.String>;
144
+ respondedAt: Schema.optional<typeof Schema.String>;
145
+ }>;
146
+
147
+ export declare type HumanResponse = typeof HumanResponse.Type;
148
+
149
+ /** A JSON value (for `params` / `input` / a `structured` step's JSON Schema). */
150
+ export declare const Json: Schema.Record$<typeof Schema.String, typeof Schema.Unknown>;
151
+
152
+ export declare type Json = typeof Json.Type;
153
+
154
+ /** Legacy default was 30, clamped to [1,100]. (Distinct from `@voltro/ai`'s
155
+ * own `maxSteps` default of 8 for a single tool loop.) */
156
+ export declare const MAX_STEPS_DEFAULT = 30;
157
+
158
+ export declare const MAX_STEPS_MAX = 100;
159
+
160
+ export declare const MAX_STEPS_MIN = 1;
161
+
162
+ export declare const MediaInputs: Schema.Record$<typeof Schema.String, Schema.Union<[Schema.Struct<{
163
+ from: Schema.Literal<["upload"]>;
164
+ url: typeof Schema.String;
165
+ }>, Schema.Struct<{
166
+ from: Schema.Literal<["step"]>;
167
+ ref: typeof Schema.String;
168
+ }>]>>;
169
+
170
+ export declare type MediaInputs = typeof MediaInputs.Type;
171
+
172
+ /** A media-input slot for a video `generate` step — either an uploaded URL or a
173
+ * reference to a prior step's output. Keyed by capability slot name
174
+ * (`referenceImageUrl`, `lastFrameImageUrl`, `referenceVideoUrl`, …). */
175
+ export declare const MediaInputSlot: Schema.Union<[Schema.Struct<{
176
+ from: Schema.Literal<["upload"]>;
177
+ url: typeof Schema.String;
178
+ }>, Schema.Struct<{
179
+ from: Schema.Literal<["step"]>;
180
+ ref: typeof Schema.String;
181
+ }>]>;
182
+
183
+ export declare type MediaInputSlot = typeof MediaInputSlot.Type;
184
+
185
+ export declare const Modality: Schema.Literal<["text", "image", "video", "audio"]>;
186
+
187
+ export declare type Modality = typeof Modality.Type;
188
+
189
+ /**
190
+ * Lower a raw flow definition (from code or a row) to the normalized IR:
191
+ * default the mode, clamp maxSteps, sanitize outputKeys, drop empties. Pure +
192
+ * browser-safe so the editor can preview exactly what the engine will run.
193
+ */
194
+ export declare const normalizeFlow: (def: FlowDefinitionInput) => FlowIR;
195
+
196
+ export declare const ReviewMode: Schema.Literal<["approve", "choice", "text"]>;
197
+
198
+ export declare type ReviewMode = typeof ReviewMode.Type;
199
+
200
+ export declare const ReviewOption: Schema.Struct<{
201
+ value: typeof Schema.String;
202
+ label: typeof Schema.String;
203
+ }>;
204
+
205
+ export declare type ReviewOption = typeof ReviewOption.Type;
206
+
207
+ /** Human-review config projected onto a `waiting` run step. */
208
+ export declare const RunReview: Schema.Struct<{
209
+ mode: Schema.Literal<["approve", "choice", "text"]>;
210
+ options: Schema.optional<Schema.Array$<Schema.Struct<{
211
+ value: typeof Schema.String;
212
+ label: typeof Schema.String;
213
+ }>>>;
214
+ prompt: typeof Schema.String;
215
+ }>;
216
+
217
+ export declare type RunReview = typeof RunReview.Type;
218
+
219
+ /** What triggered a run. */
220
+ export declare const RunSource: Schema.Literal<["manual", "cron"]>;
221
+
222
+ export declare type RunSource = typeof RunSource.Type;
223
+
224
+ /** Run status — ONE canonical set (the legacy vocabulary; the Voltro-port
225
+ * additions `awaiting_human`/`completed`/`rejected` are collapsed: `waiting`
226
+ * covers the human pause, `succeeded` is the single terminal-success literal). */
227
+ export declare const RunStatus: Schema.Literal<["pending", "running", "waiting", "succeeded", "failed", "cancelled"]>;
228
+
229
+ export declare type RunStatus = typeof RunStatus.Type;
230
+
231
+ export declare const RunStep: Schema.Struct<{
232
+ id: typeof Schema.Number;
233
+ title: typeof Schema.String;
234
+ description: Schema.optional<typeof Schema.String>;
235
+ type: Schema.Literal<["agent", "generate", "structured", "note", "human"]>;
236
+ status: Schema.Literal<["pending", "running", "waiting", "succeeded", "failed"]>;
237
+ startedAt: Schema.optional<typeof Schema.String>;
238
+ completedAt: Schema.optional<typeof Schema.String>;
239
+ /** Per-step cost in micro-USD (the app view projects to €/cents). */
240
+ costMicroUsd: Schema.optional<typeof Schema.Number>;
241
+ /** Links a media step to its generation/usage record. */
242
+ requestId: Schema.optional<typeof Schema.String>;
243
+ /** Hosted media artifact URL (image/video/audio), via storage. */
244
+ url: Schema.optional<typeof Schema.String>;
245
+ /** Inline text output (rendered as markdown). */
246
+ output: Schema.optional<Schema.Struct<{
247
+ text: typeof Schema.String;
248
+ }>>;
249
+ errorMessage: Schema.optional<typeof Schema.String>;
250
+ review: Schema.optional<Schema.Struct<{
251
+ mode: Schema.Literal<["approve", "choice", "text"]>;
252
+ options: Schema.optional<Schema.Array$<Schema.Struct<{
253
+ value: typeof Schema.String;
254
+ label: typeof Schema.String;
255
+ }>>>;
256
+ prompt: typeof Schema.String;
257
+ }>>;
258
+ }>;
259
+
260
+ export declare type RunStep = typeof RunStep.Type;
261
+
262
+ export declare const RunStepStatus: Schema.Literal<["pending", "running", "waiting", "succeeded", "failed"]>;
263
+
264
+ export declare type RunStepStatus = typeof RunStepStatus.Type;
265
+
266
+ /** Sanitize an outputKey to the `{{ref}}`-safe charset. */
267
+ export declare const sanitizeOutputKey: (key: string) => string;
268
+
269
+ /** The five step types. `generate` fans out to four modalities. */
270
+ export declare const StepType: Schema.Literal<["agent", "generate", "structured", "note", "human"]>;
271
+
272
+ export declare type StepType = typeof StepType.Type;
273
+
274
+ /** Gallery scope. `shared` → per-subject share list; `organization` → tenant. */
275
+ export declare const Visibility: Schema.Literal<["private", "organization", "shared"]>;
276
+
277
+ export declare type Visibility = typeof Visibility.Type;
278
+
279
+ export { }
package/dist/ir.js ADDED
@@ -0,0 +1,102 @@
1
+ import { Schema as e } from "effect";
2
+ //#region src/ir.ts
3
+ var t = e.Literal("deterministic", "agentic"), n = e.Literal("draft", "active", "archived"), r = e.Literal("private", "organization", "shared"), i = e.Literal("pending", "running", "waiting", "succeeded", "failed", "cancelled"), a = e.Literal("manual", "cron"), o = e.Literal("agent", "generate", "structured", "note", "human"), s = e.Literal("text", "image", "video", "audio"), c = e.Literal("approve", "choice", "text"), l = e.Struct({
4
+ value: e.String,
5
+ label: e.String
6
+ }), u = e.Union(e.Struct({
7
+ from: e.Literal("upload"),
8
+ url: e.String
9
+ }), e.Struct({
10
+ from: e.Literal("step"),
11
+ ref: e.String
12
+ })), d = e.Record({
13
+ key: e.String,
14
+ value: u
15
+ }), f = e.Record({
16
+ key: e.String,
17
+ value: e.Unknown
18
+ }), p = e.Struct({
19
+ id: e.String,
20
+ title: e.optional(e.String),
21
+ description: e.optional(e.String),
22
+ type: o,
23
+ outputKey: e.optional(e.String),
24
+ prompt: e.optional(e.String),
25
+ modality: e.optional(s),
26
+ model: e.optional(e.String),
27
+ params: e.optional(f),
28
+ mediaInputs: e.optional(d),
29
+ agentRef: e.optional(e.String),
30
+ schema: e.optional(f),
31
+ reviewMode: e.optional(c),
32
+ options: e.optional(e.Array(l))
33
+ }), m = e.Struct({
34
+ key: e.String,
35
+ label: e.String,
36
+ type: e.Literal("text", "textarea", "number", "boolean"),
37
+ required: e.optional(e.Boolean),
38
+ placeholder: e.optional(e.String)
39
+ }), h = e.Struct({
40
+ flowRef: e.String,
41
+ mappings: e.Array(e.Struct({
42
+ targetKey: e.String,
43
+ sourceKey: e.String
44
+ })),
45
+ requireConfirmation: e.optional(e.Boolean)
46
+ }), g = e.Struct({
47
+ frequency: e.optional(e.Literal("weekly", "monthly")),
48
+ repeats: e.Array(e.Number),
49
+ intervalWeeks: e.optional(e.Number),
50
+ anchorDate: e.optional(e.String),
51
+ weekOfMonth: e.optional(e.Union(e.Literal(1, 2, 3, 4), e.Literal("last"))),
52
+ hour: e.optional(e.Number),
53
+ minute: e.optional(e.Literal(0, 15, 30, 45)),
54
+ defaultInput: e.optional(f)
55
+ }), _ = e.Literal("pending", "running", "waiting", "succeeded", "failed"), v = e.Struct({
56
+ mode: c,
57
+ options: e.optional(e.Array(l)),
58
+ prompt: e.String
59
+ }), y = e.Struct({
60
+ id: e.Number,
61
+ title: e.String,
62
+ description: e.optional(e.String),
63
+ type: o,
64
+ status: _,
65
+ startedAt: e.optional(e.String),
66
+ completedAt: e.optional(e.String),
67
+ costMicroUsd: e.optional(e.Number),
68
+ requestId: e.optional(e.String),
69
+ url: e.optional(e.String),
70
+ output: e.optional(e.Struct({ text: e.String })),
71
+ errorMessage: e.optional(e.String),
72
+ review: e.optional(v)
73
+ }), b = e.Struct({
74
+ decision: e.optional(e.Literal("approve", "reject")),
75
+ value: e.optional(e.String),
76
+ text: e.optional(e.String),
77
+ respondedAt: e.optional(e.String)
78
+ }), x = e.Struct({
79
+ flowRef: e.String,
80
+ input: f,
81
+ status: e.Literal("pending", "confirmed", "dismissed")
82
+ }), S = 30, C = 1, w = 100, T = (e) => e == null || !Number.isFinite(e) ? 30 : Math.min(100, Math.max(1, Math.trunc(e))), E = (e) => e.replace(/[^\w.-]/g, "_"), D = (e) => {
83
+ let t = (e.steps ?? []).map((e) => e.outputKey ? {
84
+ ...e,
85
+ outputKey: E(e.outputKey)
86
+ } : e), n = e.orchestratorModel || e.orchestratorInstructions ? {
87
+ ...e.orchestratorModel ? { model: e.orchestratorModel } : {},
88
+ ...e.orchestratorInstructions ? { instructions: e.orchestratorInstructions } : {}
89
+ } : void 0;
90
+ return {
91
+ name: e.name,
92
+ mode: e.mode ?? "deterministic",
93
+ steps: t,
94
+ maxSteps: T(e.maxSteps),
95
+ brief: e.brief ?? [],
96
+ ...n ? { orchestrator: n } : {},
97
+ ...e.chain ? { chain: e.chain } : {},
98
+ ...e.cadence ? { cadence: e.cadence } : {}
99
+ };
100
+ };
101
+ //#endregion
102
+ export { m as BriefField, x as ChainPending, g as FlowCadence, h as FlowChain, t as FlowMode, n as FlowStatus, p as FlowStep, b as HumanResponse, f as Json, S as MAX_STEPS_DEFAULT, w as MAX_STEPS_MAX, C as MAX_STEPS_MIN, u as MediaInputSlot, d as MediaInputs, s as Modality, c as ReviewMode, l as ReviewOption, v as RunReview, a as RunSource, i as RunStatus, y as RunStep, _ as RunStepStatus, o as StepType, r as Visibility, T as clampMaxSteps, D as normalizeFlow, E as sanitizeOutputKey };
package/dist/rpc.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ import { PluginRpcClientDescriptor } from '@voltro/protocol';
2
+
3
+ /** One `{ tag, kind, import }` per client-callable route. Populated when the
4
+ * launch/retry/cancel/respond descriptors land. */
5
+ export declare const aiFlowsRpcClientImports: ReadonlyArray<PluginRpcClientDescriptor>;
6
+
7
+ export { }
package/dist/rpc.js ADDED
@@ -0,0 +1,4 @@
1
+ //#region src/rpc.ts
2
+ var e = [];
3
+ //#endregion
4
+ export { e as aiFlowsRpcClientImports };
package/dist/web.d.ts ADDED
@@ -0,0 +1,176 @@
1
+ import { Schema } from 'effect';
2
+
3
+ /** A launch-form field. The run `input` is keyed by these `key`s. */
4
+ export declare const BriefField: Schema.Struct<{
5
+ key: typeof Schema.String;
6
+ label: typeof Schema.String;
7
+ type: Schema.Literal<["text", "textarea", "number", "boolean"]>;
8
+ required: Schema.optional<typeof Schema.Boolean>;
9
+ placeholder: Schema.optional<typeof Schema.String>;
10
+ }>;
11
+
12
+ export declare type BriefField = typeof BriefField.Type;
13
+
14
+ /**
15
+ * Does `cadence` fire at wall-clock `now`? True only on a 15-min slot matching
16
+ * the configured hour/minute, on a configured weekday, and — for interval-weekly
17
+ * or monthly cadences — in the right week/occurrence.
18
+ */
19
+ export declare const cadenceMatches: (cadence: FlowCadence, now: Date) => boolean;
20
+
21
+ /** Schedule spec — richer than a single cron expr (weekly interval + anchor,
22
+ * monthly weekOfMonth), evaluated by the shared `cadenceMatches` predicate. */
23
+ export declare const FlowCadence: Schema.Struct<{
24
+ frequency: Schema.optional<Schema.Literal<["weekly", "monthly"]>>;
25
+ /** Weekdays, 0=Monday … 6=Sunday. */
26
+ repeats: Schema.Array$<typeof Schema.Number>;
27
+ /** Weekly cycle length: 1 | 2 | 4 (anchored by anchorDate). */
28
+ intervalWeeks: Schema.optional<typeof Schema.Number>;
29
+ /** ISO YYYY-MM-DD, cycle-0 week (interval > 1). */
30
+ anchorDate: Schema.optional<typeof Schema.String>;
31
+ weekOfMonth: Schema.optional<Schema.Union<[Schema.Literal<[1, 2, 3, 4]>, Schema.Literal<["last"]>]>>;
32
+ /** 0-23, default 9. */
33
+ hour: Schema.optional<typeof Schema.Number>;
34
+ minute: Schema.optional<Schema.Literal<[0, 15, 30, 45]>>;
35
+ /** Brief for unattended cron runs. */
36
+ defaultInput: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>;
37
+ }>;
38
+
39
+ export declare type FlowCadence = typeof FlowCadence.Type;
40
+
41
+ /** Follow-up flow spec. On success, map source → the child's brief. */
42
+ export declare const FlowChain: Schema.Struct<{
43
+ /** Child flow id (data) or name (code). */
44
+ flowRef: typeof Schema.String;
45
+ mappings: Schema.Array$<Schema.Struct<{
46
+ targetKey: typeof Schema.String;
47
+ sourceKey: typeof Schema.String;
48
+ }>>;
49
+ requireConfirmation: Schema.optional<typeof Schema.Boolean>;
50
+ }>;
51
+
52
+ export declare type FlowChain = typeof FlowChain.Type;
53
+
54
+ /** Execution mode. Replaces the legacy `allowDeviation` boolean — a mode is not
55
+ * a boolean. `deterministic` runs the plan verbatim (resumable per step);
56
+ * `agentic` lets an orchestrator LLM adapt the plan via the four tools. */
57
+ export declare const FlowMode: Schema.Literal<["deterministic", "agentic"]>;
58
+
59
+ export declare type FlowMode = typeof FlowMode.Type;
60
+
61
+ /** Flow-definition lifecycle. */
62
+ export declare const FlowStatus: Schema.Literal<["draft", "active", "archived"]>;
63
+
64
+ export declare type FlowStatus = typeof FlowStatus.Type;
65
+
66
+ /**
67
+ * A plan step. This is the AUTHORED shape — stored on `ai_flows.steps` (data
68
+ * front door) or produced by `defineFlow`'s builders (code front door). The
69
+ * engine interprets it; later steps reference an earlier step's deliverable via
70
+ * `{{outputKey}}` in `prompt` / media refs.
71
+ */
72
+ export declare const FlowStep: Schema.Struct<{
73
+ id: typeof Schema.String;
74
+ title: Schema.optional<typeof Schema.String>;
75
+ /** Informational; shown under the step in the run timeline. */
76
+ description: Schema.optional<typeof Schema.String>;
77
+ type: Schema.Literal<["agent", "generate", "structured", "note", "human"]>;
78
+ /** Sanitized [\w.-]; the result-bundle key + the `{{ref}}` name. */
79
+ outputKey: Schema.optional<typeof Schema.String>;
80
+ /** Template with `{{key}}` placeholders (brief inputs + prior outputKeys). */
81
+ prompt: Schema.optional<typeof Schema.String>;
82
+ modality: Schema.optional<Schema.Literal<["text", "image", "video", "audio"]>>;
83
+ model: Schema.optional<typeof Schema.String>;
84
+ params: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>;
85
+ mediaInputs: Schema.optional<Schema.Record$<typeof Schema.String, Schema.Union<[Schema.Struct<{
86
+ from: Schema.Literal<["upload"]>;
87
+ url: typeof Schema.String;
88
+ }>, Schema.Struct<{
89
+ from: Schema.Literal<["step"]>;
90
+ ref: typeof Schema.String;
91
+ }>]>>>;
92
+ /** Allowed sub-agent id/name. The framework resolves a real id; any
93
+ * legacy-numeric bridge stays in the consumer app's mapping. */
94
+ agentRef: Schema.optional<typeof Schema.String>;
95
+ /** JSON Schema of the desired object (adapted to an Effect Schema at run). */
96
+ schema: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>;
97
+ reviewMode: Schema.optional<Schema.Literal<["approve", "choice", "text"]>>;
98
+ options: Schema.optional<Schema.Array$<Schema.Struct<{
99
+ value: typeof Schema.String;
100
+ label: typeof Schema.String;
101
+ }>>>;
102
+ }>;
103
+
104
+ export declare type FlowStep = typeof FlowStep.Type;
105
+
106
+ export declare const Modality: Schema.Literal<["text", "image", "video", "audio"]>;
107
+
108
+ export declare type Modality = typeof Modality.Type;
109
+
110
+ /**
111
+ * The next `count` fire times at/after `from`, by stepping 15-min slots and
112
+ * testing `cadenceMatches`. Bounded to a ~400-day horizon so a never-matching
113
+ * cadence can't loop forever. Returns the fire `Date`s.
114
+ */
115
+ export declare const nextRuns: (cadence: FlowCadence, from: Date, count?: number) => ReadonlyArray<Date>;
116
+
117
+ export declare const ReviewMode: Schema.Literal<["approve", "choice", "text"]>;
118
+
119
+ export declare type ReviewMode = typeof ReviewMode.Type;
120
+
121
+ export declare const ReviewOption: Schema.Struct<{
122
+ value: typeof Schema.String;
123
+ label: typeof Schema.String;
124
+ }>;
125
+
126
+ export declare type ReviewOption = typeof ReviewOption.Type;
127
+
128
+ /** Run status — ONE canonical set (the legacy vocabulary; the Voltro-port
129
+ * additions `awaiting_human`/`completed`/`rejected` are collapsed: `waiting`
130
+ * covers the human pause, `succeeded` is the single terminal-success literal). */
131
+ export declare const RunStatus: Schema.Literal<["pending", "running", "waiting", "succeeded", "failed", "cancelled"]>;
132
+
133
+ export declare type RunStatus = typeof RunStatus.Type;
134
+
135
+ export declare const RunStep: Schema.Struct<{
136
+ id: typeof Schema.Number;
137
+ title: typeof Schema.String;
138
+ description: Schema.optional<typeof Schema.String>;
139
+ type: Schema.Literal<["agent", "generate", "structured", "note", "human"]>;
140
+ status: Schema.Literal<["pending", "running", "waiting", "succeeded", "failed"]>;
141
+ startedAt: Schema.optional<typeof Schema.String>;
142
+ completedAt: Schema.optional<typeof Schema.String>;
143
+ /** Per-step cost in micro-USD (the app view projects to €/cents). */
144
+ costMicroUsd: Schema.optional<typeof Schema.Number>;
145
+ /** Links a media step to its generation/usage record. */
146
+ requestId: Schema.optional<typeof Schema.String>;
147
+ /** Hosted media artifact URL (image/video/audio), via storage. */
148
+ url: Schema.optional<typeof Schema.String>;
149
+ /** Inline text output (rendered as markdown). */
150
+ output: Schema.optional<Schema.Struct<{
151
+ text: typeof Schema.String;
152
+ }>>;
153
+ errorMessage: Schema.optional<typeof Schema.String>;
154
+ review: Schema.optional<Schema.Struct<{
155
+ mode: Schema.Literal<["approve", "choice", "text"]>;
156
+ options: Schema.optional<Schema.Array$<Schema.Struct<{
157
+ value: typeof Schema.String;
158
+ label: typeof Schema.String;
159
+ }>>>;
160
+ prompt: typeof Schema.String;
161
+ }>>;
162
+ }>;
163
+
164
+ export declare type RunStep = typeof RunStep.Type;
165
+
166
+ /** The five step types. `generate` fans out to four modalities. */
167
+ export declare const StepType: Schema.Literal<["agent", "generate", "structured", "note", "human"]>;
168
+
169
+ export declare type StepType = typeof StepType.Type;
170
+
171
+ /** Gallery scope. `shared` → per-subject share list; `organization` → tenant. */
172
+ export declare const Visibility: Schema.Literal<["private", "organization", "shared"]>;
173
+
174
+ export declare type Visibility = typeof Visibility.Type;
175
+
176
+ export { }
package/dist/web.js ADDED
@@ -0,0 +1,2 @@
1
+ import { n as e, t } from "./cadence-Bt6dPelT.js";
2
+ export { t as cadenceMatches, e as nextRuns };
@@ -0,0 +1,40 @@
1
+ import { Schema } from 'effect';
2
+ import { Workflow } from '@effect/workflow/Workflow';
3
+
4
+ /** The canonical name the launch action starts + the app re-export registers. */
5
+ export declare const FLOW_RUN_WORKFLOW = "flow.run";
6
+
7
+ /** The workflow payload shape (server executor input). */
8
+ export declare interface FlowRunPayload {
9
+ readonly runId: string;
10
+ readonly flowRef: string;
11
+ readonly input: Record<string, unknown>;
12
+ readonly source: 'manual' | 'cron';
13
+ readonly requestId: string;
14
+ }
15
+
16
+ /**
17
+ * `flow.run` — the single durable workflow that interprets a Flow IR (from a
18
+ * code registration or a stored `ai_flows` row) step-by-step. `requestId` is the
19
+ * idempotency key so repeated / crash-replayed starts collapse to one run.
20
+ */
21
+ export declare const flowRunWorkflow: Workflow<"flow.run", Schema.Struct<{
22
+ /** The pre-created `ai_flow_runs` row id the executor patches. */
23
+ runId: typeof Schema.String;
24
+ /** Name (code flow) or id (data flow) to resolve the IR from. */
25
+ flowRef: typeof Schema.String;
26
+ /** Brief values keyed by `BriefField.key`. */
27
+ input: Schema.Record$<typeof Schema.String, typeof Schema.Unknown>;
28
+ /** manual | cron. */
29
+ source: Schema.Literal<["manual", "cron"]>;
30
+ /** Correlation + idempotency key. */
31
+ requestId: typeof Schema.String;
32
+ }>, Schema.Struct<{
33
+ runId: typeof Schema.String;
34
+ status: Schema.Literal<["succeeded", "failed", "cancelled", "waiting"]>;
35
+ }>, typeof Schema.Never>;
36
+
37
+ /** The signal a `human` step parks on; `respondToFlow` sends it to resume. */
38
+ export declare const HUMAN_RESPONSE_SIGNAL = "flow-human-response";
39
+
40
+ export { }
@@ -0,0 +1,23 @@
1
+ import { Schema as e } from "effect";
2
+ import { workflow as t } from "@voltro/workflow/define";
3
+ //#region src/workflow.ts
4
+ var n = "flow.run", r = "flow-human-response", i = t({
5
+ name: n,
6
+ payload: {
7
+ runId: e.String,
8
+ flowRef: e.String,
9
+ input: e.Record({
10
+ key: e.String,
11
+ value: e.Unknown
12
+ }),
13
+ source: e.Literal("manual", "cron"),
14
+ requestId: e.String
15
+ },
16
+ success: e.Struct({
17
+ runId: e.String,
18
+ status: e.Literal("succeeded", "failed", "cancelled", "waiting")
19
+ }),
20
+ idempotencyKey: ({ requestId: e }) => `flow-run:${e}`
21
+ });
22
+ //#endregion
23
+ export { n as FLOW_RUN_WORKFLOW, r as HUMAN_RESPONSE_SIGNAL, i as flowRunWorkflow };