@voltro/plugin-ai-flows 0.32.0 → 0.34.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/index.js CHANGED
@@ -1,18 +1,18 @@
1
- import { BriefField as e, ChainPending as t, FlowCadence as n, FlowChain as r, FlowMode as i, FlowStatus as a, FlowStep as o, HumanResponse as s, Json as c, MAX_STEPS_DEFAULT as l, MAX_STEPS_MAX as u, MAX_STEPS_MIN as d, MediaInputSlot as f, MediaInputs as p, Modality as ee, ReviewMode as m, ReviewOption as h, RunReview as te, RunSource as ne, RunStatus as re, RunStep as ie, RunStepStatus as ae, StepType as oe, Visibility as se, clampMaxSteps as ce, normalizeFlow as g, sanitizeOutputKey as _ } from "./ir.js";
2
- import { FLOW_RUN_WORKFLOW as v, HUMAN_RESPONSE_SIGNAL as y } from "./workflow.js";
3
- import { FlowBriefIncomplete as le, FlowCapabilityMissing as b, FlowDependencyError as ue, FlowNotAwaitingResponse as de, FlowNotFound as fe, FlowRunNotFound as x, FlowValidationError as pe } from "./errors.js";
4
- import { n as me, t as he } from "./cadence-Bt6dPelT.js";
5
- import { Effect as S, Schema as C } from "effect";
6
- import { definePlugin as ge } from "@voltro/protocol";
7
- import { boolean as _e, eq as w, id as ve, integer as T, json as E, queryFor as D, table as ye, text as O, timestamp as k } from "@voltro/database";
8
- import { tenant as A } from "@voltro/plugin-multitenancy/mixin";
9
- import { audit as j } from "@voltro/plugin-audit/mixin";
10
- import { softDelete as be } from "@voltro/plugin-soft-delete/mixin";
11
- import { awaitSignalSuspending as xe, step as M } from "@voltro/workflow";
12
- import { defineTool as N, estimateCostUsd as P, gatewayCostUsd as Se, generateImage as Ce, generateObject as we, generateObjectWithTools as Te, generateSpeech as Ee, generateText as F, generateVideo as De } from "@voltro/ai";
1
+ import { BriefField as e, ChainPending as t, FlowCadence as n, FlowChain as r, FlowMode as i, FlowStatus as a, FlowStep as o, HumanResponse as s, Json as c, MAX_STEPS_DEFAULT as l, MAX_STEPS_MAX as u, MAX_STEPS_MIN as d, MediaInputSlot as f, MediaInputs as p, Modality as m, ReviewMode as h, ReviewOption as g, RunReview as ee, RunSource as te, RunStatus as ne, RunStep as re, RunStepStatus as ie, StepType as ae, Visibility as oe, clampMaxSteps as se, normalizeFlow as _, sanitizeOutputKey as ce } from "./ir.js";
2
+ import { FLOW_RUN_WORKFLOW as v, HUMAN_RESPONSE_SIGNAL_PREFIX as le, humanResponseSignalName as y } from "./workflow.js";
3
+ import { FlowBriefIncomplete as ue, FlowCapabilityMissing as b, FlowDependencyError as de, FlowNotAwaitingResponse as fe, FlowNotFound as pe, FlowRunNotFound as x, FlowValidationError as me } from "./errors.js";
4
+ import { n as he, t as ge } from "./cadence-Bt6dPelT.js";
5
+ import { Cause as _e, Effect as S, Schema as C } from "effect";
6
+ import { definePlugin as ve, pluginInstanceName as ye } from "@voltro/protocol";
7
+ import { boolean as be, eq as w, id as xe, inSet as Se, integer as T, json as E, queryFor as D, registerRetention as Ce, table as we, text as O, timestamp as k } from "@voltro/database";
8
+ import { tenant as Te } from "@voltro/plugin-multitenancy/mixin";
9
+ import { audit as Ee } from "@voltro/plugin-audit/mixin";
10
+ import { softDelete as De } from "@voltro/plugin-soft-delete/mixin";
11
+ import { awaitSignalSuspending as Oe, step as A } from "@voltro/workflow";
12
+ import { defineTool as j, estimateCostUsd as ke, gatewayCostUsd as Ae, generateImage as je, generateObject as Me, generateObjectWithTools as Ne, generateSpeech as Pe, generateText as M, generateVideo as Fe } from "@voltro/ai";
13
13
  //#region src/table.ts
14
- var I = ye("_voltro_ai_flows", {
15
- id: ve({ prefix: "aifl" }),
14
+ var N = we("_voltro_ai_flows", {
15
+ id: xe({ prefix: "aifl" }),
16
16
  name: O(),
17
17
  description: O().nullable(),
18
18
  mode: O().default("deterministic"),
@@ -25,15 +25,16 @@ var I = ye("_voltro_ai_flows", {
25
25
  inputSchema: E().nullable(),
26
26
  chainTo: E().nullable(),
27
27
  cadence: E().nullable(),
28
- isEnabled: _e().default(!0),
28
+ humanTimeoutMs: T().nullable(),
29
+ isEnabled: be().default(!0),
29
30
  metadata: E().nullable(),
30
31
  icon: O().nullable(),
31
32
  color: O().nullable(),
32
33
  avatarUrl: O().nullable(),
33
34
  usageCount: T().default(0),
34
35
  ownerId: O().nullable()
35
- }).renamedFrom("ai_flows").with(A(), j(), be()).index(["status"]).index(["visibility"]), L = ye("_voltro_ai_flow_runs", {
36
- id: ve({ prefix: "aifr" }),
36
+ }).renamedFrom("ai_flows").with(Te(), Ee(), De()).index(["status"]).index(["visibility"]), P = we("_voltro_ai_flow_runs", {
37
+ id: xe({ prefix: "aifr" }),
37
38
  flowRef: O(),
38
39
  flowName: O().nullable(),
39
40
  mode: O().default("deterministic"),
@@ -58,34 +59,85 @@ var I = ye("_voltro_ai_flows", {
58
59
  sessionName: O().nullable(),
59
60
  ownerId: O().nullable(),
60
61
  metadata: E().nullable()
61
- }).renamedFrom("ai_flow_runs").with(A(), j()).index(["flowRef"]).index(["status"]).index(["requestId"]), Oe = [I, L], ke = /\{\{\s*([\w.-]+)\s*\}\}/g, R = (e) => {
62
+ }).renamedFrom("ai_flow_runs").with(Te(), Ee()).index(["flowRef"]).index(["status"]).index(["requestId"]), Ie = [N, P], Le = 168, Re = "VOLTRO_AI_FLOW_HUMAN_REVIEW_TIMEOUT_HOURS", ze = 2160, Be = "VOLTRO_AI_FLOW_RUNS_TTL_HOURS", F = { current: {} }, Ve = (e) => {
63
+ F.current = e;
64
+ }, He = () => F.current, Ue = () => {
65
+ F.current = {};
66
+ }, I = (e, t) => {
67
+ if (e === void 0 || e.trim() === "") return t * 36e5;
68
+ let n = Number(e);
69
+ return !Number.isFinite(n) || n < 0 ? t * 36e5 : n * 36e5;
70
+ }, We = (e) => Number.isFinite(e) && e > 0 ? e : Infinity, Ge = (e) => {
71
+ let t = e.env ?? process.env;
72
+ return We(e.step?.timeoutMs ?? e.flow?.humanTimeoutMs ?? e.deps?.humanReviewTimeoutMs ?? He().humanReviewTimeoutMs ?? I(t.VOLTRO_AI_FLOW_HUMAN_REVIEW_TIMEOUT_HOURS, 168));
73
+ }, Ke = /\{\{\s*([\w.-]+)\s*\}\}/g, L = (e) => {
62
74
  let t = [];
63
- for (let n of e.matchAll(ke)) t.push(n[1]);
75
+ for (let n of e.matchAll(Ke)) t.push(n[1]);
64
76
  return t;
65
- }, z = (e, t) => e.replace(ke, (e, n) => {
77
+ }, R = (e, t) => e.replace(Ke, (e, n) => {
66
78
  let r = t[n];
67
79
  return r == null ? "" : typeof r == "string" ? r : JSON.stringify(r);
68
- }), Ae = (e, t) => {
80
+ }), qe = (e, t) => {
69
81
  let n = /* @__PURE__ */ new Set();
70
- for (let r of R(e)) t[r] == null && !n.has(r) && n.add(r);
82
+ for (let r of L(e)) t[r] == null && !n.has(r) && n.add(r);
71
83
  return [...n];
72
- }, B = /* @__PURE__ */ new Map(), V = (e) => {
73
- B.set(e.name, e);
74
- }, H = (e) => B.get(e), U = () => [...B.values()], je = () => B.clear(), W = (e) => e, Me = C.Struct({
84
+ }, z = /* @__PURE__ */ new Map(), Je = (e) => {
85
+ z.set(e.name, e);
86
+ }, Ye = (e) => z.get(e), Xe = () => [...z.values()], Ze = () => z.clear(), B = (e) => typeof e == "object" && e && !Array.isArray(e) ? e : void 0, V = (e) => Array.isArray(e) ? e : void 0, Qe = (e) => {
87
+ switch (e) {
88
+ case "string": return C.String;
89
+ case "number": return C.Number;
90
+ case "integer": return C.Int;
91
+ case "boolean": return C.Boolean;
92
+ case "null": return C.Null;
93
+ default: return C.Unknown;
94
+ }
95
+ }, H = (e, t) => {
96
+ let n = typeof t.description == "string" ? t.description : void 0, r = typeof t.title == "string" ? t.title : void 0;
97
+ return n === void 0 && r === void 0 ? e : e.annotations({
98
+ ...n === void 0 ? {} : { description: n },
99
+ ...r === void 0 ? {} : { title: r }
100
+ });
101
+ }, $e = (e) => e.length === 0 ? C.Unknown : e.length === 1 ? e[0] : C.Union(...e), et = () => C.Record({
102
+ key: C.String,
103
+ value: C.Unknown
104
+ }), U = (e) => {
105
+ let t = B(e);
106
+ if (t === void 0) return C.Unknown;
107
+ if ("const" in t) return H(C.Literal(t.const), t);
108
+ let n = V(t.enum);
109
+ if (n !== void 0 && n.length > 0) return H(C.Literal(...n), t);
110
+ let r = V(t.anyOf) ?? V(t.oneOf);
111
+ if (r !== void 0) return H($e(r.map(U)), t);
112
+ let i = t.type, a = typeof i == "string" ? [i] : V(i)?.filter((e) => typeof e == "string") ?? [], o = t.nullable === !0 || a.includes("null"), s = a.find((e) => e !== "null"), c = s === "object" || s === void 0 && t.properties !== void 0 ? tt(t) : s === "array" || s === void 0 && t.items !== void 0 ? C.Array(U(t.items)) : s === void 0 ? C.Unknown : Qe(s);
113
+ return H(o ? C.NullOr(c) : c, t);
114
+ }, tt = (e) => {
115
+ let t = B(e.properties);
116
+ if (t === void 0) return et();
117
+ let n = new Set((V(e.required) ?? []).filter((e) => typeof e == "string")), r = {};
118
+ for (let [e, i] of Object.entries(t)) {
119
+ let t = U(i);
120
+ r[e] = n.has(e) ? t : C.optional(t);
121
+ }
122
+ return C.Struct(r);
123
+ }, nt = (e) => {
124
+ let t = B(e);
125
+ return t === void 0 || Object.keys(t).length === 0 ? et() : U(t);
126
+ }, W = (e) => e, rt = C.Struct({
75
127
  value: C.optional(C.Unknown),
76
128
  text: C.optional(C.String),
77
129
  url: C.optional(C.String),
78
130
  costMicroUsd: C.optional(C.Number),
79
131
  requestId: C.optional(C.String),
80
132
  error: C.optional(C.String)
81
- }), G = () => (/* @__PURE__ */ new Date()).toISOString(), Ne = (e) => Math.round(e * 1e6), K = (e, t) => e.resolveModel?.(t) ?? K(e, t), q = (e, t, n) => {
82
- let r = Se(t);
83
- return typeof r == "number" ? Ne(r) : P(e, { model: n ?? "unknown" }).costMicroUsd ?? 0;
84
- }, J = (e, t, n) => S.promise(() => e.store.update(L.tableName, t, n).then(() => void 0)).pipe(S.catchAllCause(() => S.void)), Pe = (e, t) => S.promise(async () => (await e.store.query(D(L).where(w("id", t)).descriptor))[0]?.status === "cancelled").pipe(S.catchAllCause(() => S.succeed(!1))), Y = (e, t) => S.gen(function* () {
85
- let n = H(t);
133
+ }), G = () => (/* @__PURE__ */ new Date()).toISOString(), it = (e) => Math.round(e * 1e6), K = (e, t) => e.resolveModel?.(t) ?? K(e, t), q = (e, t, n) => {
134
+ let r = Ae(t);
135
+ return typeof r == "number" ? it(r) : ke(e, { model: n ?? "unknown" }).costMicroUsd ?? 0;
136
+ }, J = (e, t, n) => S.promise(() => e.store.update(P.tableName, t, n).then(() => void 0)).pipe(S.catchAllCause(() => S.void)), at = (e, t) => S.promise(async () => (await e.store.query(D(P).where(w("id", t)).descriptor))[0]?.status === "cancelled").pipe(S.catchAllCause(() => S.succeed(!1))), Y = (e, t) => S.gen(function* () {
137
+ let n = Ye(t);
86
138
  if (n) return n;
87
- let r = (yield* S.promise(() => e.store.query(D(I).where(w("id", t)).descriptor)))[0];
88
- return r ? g({
139
+ let r = (yield* S.promise(() => e.store.query(D(N).where(w("id", t)).descriptor)))[0];
140
+ return r ? _({
89
141
  name: r.name ?? t,
90
142
  mode: r.mode,
91
143
  steps: r.steps ?? [],
@@ -94,14 +146,15 @@ var I = ye("_voltro_ai_flows", {
94
146
  orchestratorModel: r.orchestratorModel ?? null,
95
147
  orchestratorInstructions: r.orchestratorInstructions ?? null,
96
148
  chain: r.chainTo ?? null,
97
- cadence: r.cadence ?? null
98
- }) : yield* S.fail(new fe({
149
+ cadence: r.cadence ?? null,
150
+ humanTimeoutMs: r.humanTimeoutMs ?? null
151
+ }) : yield* S.fail(new pe({
99
152
  flowRef: t,
100
153
  message: `no flow registered or stored for "${t}"`
101
154
  }));
102
- }), Fe = (e, t, n, r, i) => S.gen(function* () {
103
- let e = z(n.prompt ?? "", r), a = Ae(n.prompt ?? "", r);
104
- if (a.length > 0) return { error: new ue({
155
+ }), ot = (e, t, n, r, i) => S.gen(function* () {
156
+ let e = R(n.prompt ?? "", r), a = qe(n.prompt ?? "", r);
157
+ if (a.length > 0) return { error: new de({
105
158
  stepId: n.id,
106
159
  unresolvedRef: a[0],
107
160
  message: `step "${n.id}" references unresolved {{${a[0]}}}`
@@ -126,7 +179,7 @@ var I = ye("_voltro_ai_flows", {
126
179
  e
127
180
  })));
128
181
  if (!r.ok) return { error: r.e.message };
129
- let i = yield* F({
182
+ let i = yield* M({
130
183
  system: r.a.system,
131
184
  prompt: e,
132
185
  provider: K(t, r.a.model)
@@ -144,12 +197,9 @@ var I = ye("_voltro_ai_flows", {
144
197
  } : { error: String(i.e.message ?? i.e) };
145
198
  }
146
199
  case "structured": {
147
- let r = n.model ?? t.defaultModels?.text, i = yield* we({
200
+ let r = n.model ?? t.defaultModels?.text, i = yield* Me({
148
201
  prompt: e,
149
- schema: C.Record({
150
- key: C.String,
151
- value: C.Unknown
152
- }),
202
+ schema: nt(n.schema),
153
203
  ...r ? { provider: K(t, r) } : {}
154
204
  }).pipe(S.map((e) => ({
155
205
  ok: !0,
@@ -167,7 +217,7 @@ var I = ye("_voltro_ai_flows", {
167
217
  case "generate": {
168
218
  let r = n.modality ?? "text";
169
219
  if (r === "text") {
170
- let r = n.model ?? t.defaultModels?.text, i = yield* F({
220
+ let r = n.model ?? t.defaultModels?.text, i = yield* M({
171
221
  prompt: e,
172
222
  ...r ? { provider: K(t, r) } : {}
173
223
  }).pipe(S.map((e) => ({
@@ -209,11 +259,11 @@ var I = ye("_voltro_ai_flows", {
209
259
  }
210
260
  case "human": return { error: new b({
211
261
  capability: "human",
212
- message: "human-in-the-loop steps are not yet wired (task #35)"
262
+ message: "human step reached the step interpreter it should have been parked by the deterministic executor (routing bug)"
213
263
  }).message };
214
264
  default: return { error: `unknown step type: ${String(n.type)}` };
215
265
  }
216
- }), Ie = (e, t, n, r, i, a) => S.gen(function* () {
266
+ }), st = (e, t, n, r, i, a) => S.gen(function* () {
217
267
  let o = { ...i }, c = r.steps.map((e, t) => ({
218
268
  id: t,
219
269
  title: e.title ?? `Step ${t + 1}`,
@@ -229,7 +279,7 @@ var I = ye("_voltro_ai_flows", {
229
279
  startedAt: G()
230
280
  });
231
281
  for (let [i, u] of r.steps.entries()) {
232
- if (yield* Pe(e, n)) return {
282
+ if (yield* at(e, n)) return {
233
283
  runId: n,
234
284
  status: "cancelled"
235
285
  };
@@ -237,7 +287,7 @@ var I = ye("_voltro_ai_flows", {
237
287
  let d = {
238
288
  mode: u.reviewMode ?? "approve",
239
289
  ...u.options ? { options: u.options } : {},
240
- prompt: z(u.prompt ?? "", o)
290
+ prompt: R(u.prompt ?? "", o)
241
291
  };
242
292
  c[i] = {
243
293
  ...c[i],
@@ -255,33 +305,41 @@ var I = ye("_voltro_ai_flows", {
255
305
  ownerId: a.ownerId,
256
306
  source: a.source
257
307
  })).pipe(S.catchAllCause(() => S.void)));
258
- let f = yield* xe(e, {
259
- name: y,
260
- schema: s
308
+ let f = Ge({
309
+ step: u,
310
+ flow: r,
311
+ deps: t
312
+ }), p = yield* Oe(e, {
313
+ name: y(i),
314
+ schema: s,
315
+ timeoutMs: f
261
316
  }).pipe(S.map((e) => ({
262
317
  ok: !0,
263
318
  a: e
264
- })), S.catchAll((e) => S.succeed({
319
+ })), S.catchAllCause((e) => _e.isInterruptedOnly(e) ? S.failCause(e) : S.succeed({
265
320
  ok: !1,
266
- e
321
+ cause: e
267
322
  })));
268
- if (!f.ok) return c[i] = {
269
- ...c[i],
270
- status: "failed",
271
- completedAt: G(),
272
- errorMessage: "human review timed out or failed to decode"
273
- }, yield* J(e, n, {
274
- steps: c,
275
- status: "failed",
276
- errorMessage: "human review timed out",
277
- completedAt: G(),
278
- costMicroUsd: l
279
- }), {
280
- runId: n,
281
- status: "failed"
282
- };
283
- let p = f.a;
284
- if (p.decision === "reject") return c[i] = {
323
+ if (!p.ok) {
324
+ let t = Number.isFinite(f) ? `human review timed out after ${f}ms` : "human review failed";
325
+ return c[i] = {
326
+ ...c[i],
327
+ status: "failed",
328
+ completedAt: G(),
329
+ errorMessage: t
330
+ }, yield* J(e, n, {
331
+ steps: c,
332
+ status: "failed",
333
+ errorMessage: t,
334
+ completedAt: G(),
335
+ costMicroUsd: l
336
+ }), {
337
+ runId: n,
338
+ status: "failed"
339
+ };
340
+ }
341
+ let m = p.a;
342
+ if (m.decision === "reject") return c[i] = {
285
343
  ...c[i],
286
344
  status: "failed",
287
345
  completedAt: G(),
@@ -295,11 +353,11 @@ var I = ye("_voltro_ai_flows", {
295
353
  runId: n,
296
354
  status: "cancelled"
297
355
  };
298
- u.outputKey && (o[u.outputKey] = p.value ?? p.text ?? p.decision ?? !0), c[i] = {
356
+ u.outputKey && (o[u.outputKey] = m.value ?? m.text ?? m.decision ?? !0), c[i] = {
299
357
  ...c[i],
300
358
  status: "succeeded",
301
359
  completedAt: G(),
302
- output: { text: String(p.text ?? p.value ?? p.decision ?? "approved") }
360
+ output: { text: String(m.text ?? m.value ?? m.decision ?? "approved") }
303
361
  }, yield* J(e, n, {
304
362
  steps: c,
305
363
  status: "running",
@@ -315,11 +373,11 @@ var I = ye("_voltro_ai_flows", {
315
373
  steps: c,
316
374
  currentStep: i
317
375
  });
318
- let d = yield* M({
376
+ let d = yield* A({
319
377
  name: `flow-${i}-${u.id}`,
320
378
  input: { index: i },
321
- success: Me,
322
- execute: Fe(e, t, u, o, {
379
+ success: rt,
380
+ execute: ot(e, t, u, o, {
323
381
  runId: n,
324
382
  tenantId: a.tenantId
325
383
  })
@@ -365,7 +423,7 @@ var I = ye("_voltro_ai_flows", {
365
423
  status: "succeeded",
366
424
  output: u
367
425
  };
368
- }), Le = (e, t, n, r, i, a) => S.gen(function* () {
426
+ }), ct = (e, t, n, r, i, a) => S.gen(function* () {
369
427
  let o = n.chain;
370
428
  if (!o || o.flowRef === n.name || o.flowRef === a.flowRef) return;
371
429
  let s = {
@@ -386,7 +444,7 @@ var I = ye("_voltro_ai_flows", {
386
444
  let u = `${t}--chain`, d = `${a.requestId}--chain`;
387
445
  yield* S.promise(async () => {
388
446
  try {
389
- await e.store.insert(L.tableName, {
447
+ await e.store.insert(P.tableName, {
390
448
  id: u,
391
449
  flowRef: o.flowRef,
392
450
  flowName: o.flowRef,
@@ -404,32 +462,32 @@ var I = ye("_voltro_ai_flows", {
404
462
  requestId: d
405
463
  });
406
464
  }).pipe(S.catchAllCause(() => S.void));
407
- }), Re = (e) => e.steps.length === 0 ? "" : "Suggested plan (you MAY reorder, insert, or skip steps):\n" + e.steps.map((e, t) => `${t + 1}. [${e.type}${e.modality ? `/${e.modality}` : ""}] ${e.title ?? e.id}${e.prompt ? `: ${e.prompt}` : ""}`).join("\n"), ze = (e) => {
465
+ }), lt = (e) => e.steps.length === 0 ? "" : "Suggested plan (you MAY reorder, insert, or skip steps):\n" + e.steps.map((e, t) => `${t + 1}. [${e.type}${e.modality ? `/${e.modality}` : ""}] ${e.title ?? e.id}${e.prompt ? `: ${e.prompt}` : ""}`).join("\n"), ut = (e) => {
408
466
  let t = Object.entries(e);
409
467
  return t.length === 0 ? "Execute the flow." : "Brief for this run:\n" + t.map(([e, t]) => `- ${e}: ${typeof t == "string" ? t : JSON.stringify(t)}`).join("\n");
410
- }, Be = (e) => [
468
+ }, dt = (e) => [
411
469
  e.orchestrator?.instructions ?? "You are an orchestrator that uses the available tools to produce a bundled result.",
412
- Re(e),
470
+ lt(e),
413
471
  "When finished, emit a JSON object mapping each deliverable name (outputKey) to its value."
414
- ].filter(Boolean).join("\n\n"), Ve = C.Struct({
472
+ ].filter(Boolean).join("\n\n"), ft = C.Struct({
415
473
  object: C.Record({
416
474
  key: C.String,
417
475
  value: C.Unknown
418
476
  }),
419
477
  planCostMicroUsd: C.Number,
420
478
  toolCostMicroUsd: C.Number,
421
- steps: C.Array(ie),
479
+ steps: C.Array(re),
422
480
  error: C.optional(C.String)
423
- }), He = (e, t, n, r, i, a, o) => S.gen(function* () {
481
+ }), pt = (e, t, n, r, i, a, o) => S.gen(function* () {
424
482
  yield* J(e, n, {
425
483
  status: "running",
426
484
  startedAt: G(),
427
485
  totalSteps: r.steps.length
428
486
  });
429
- let s = yield* M({
487
+ let s = yield* A({
430
488
  name: "flow-agentic",
431
489
  input: { flowRef: r.name },
432
- success: Ve,
490
+ success: ft,
433
491
  execute: S.gen(function* () {
434
492
  let s = [], c = 0, l = (e) => {
435
493
  let t = s.length;
@@ -449,7 +507,7 @@ var I = ye("_voltro_ai_flows", {
449
507
  steps: s,
450
508
  currentStep: s.length,
451
509
  costMicroUsd: c
452
- }), f = N({
510
+ }), f = j({
453
511
  name: "run_agent",
454
512
  description: "Delegate a text task to an allowed sub-agent. Returns the agent's text.",
455
513
  input: C.Struct({
@@ -476,7 +534,7 @@ var I = ye("_voltro_ai_flows", {
476
534
  status: "failed",
477
535
  errorMessage: i.e.message
478
536
  }), yield* d(), `ERROR: ${i.e.message}`;
479
- let a = yield* F({
537
+ let a = yield* M({
480
538
  system: i.a.system,
481
539
  prompt: n,
482
540
  provider: K(t, i.a.model)
@@ -501,7 +559,7 @@ var I = ye("_voltro_ai_flows", {
501
559
  costMicroUsd: o
502
560
  }), yield* d(), a.r.text;
503
561
  })
504
- }), p = N({
562
+ }), p = j({
505
563
  name: "generate_media",
506
564
  description: "Generate an image, video, or audio artifact. Returns the hosted URL.",
507
565
  input: C.Struct({
@@ -543,7 +601,7 @@ var I = ye("_voltro_ai_flows", {
543
601
  errorMessage: s.e.message
544
602
  }), yield* d(), `ERROR: ${s.e.message}`);
545
603
  })
546
- }), ee = N({
604
+ }), m = j({
547
605
  name: "pick_structured",
548
606
  description: "Produce a JSON object for a task. Returns the object.",
549
607
  input: C.Struct({
@@ -556,7 +614,7 @@ var I = ye("_voltro_ai_flows", {
556
614
  type: "structured"
557
615
  });
558
616
  yield* d();
559
- let i = yield* we({
617
+ let i = yield* Me({
560
618
  prompt: e,
561
619
  schema: C.Record({
562
620
  key: C.String,
@@ -584,9 +642,9 @@ var I = ye("_voltro_ai_flows", {
584
642
  costMicroUsd: a
585
643
  }), yield* d(), i.r.object;
586
644
  })
587
- }), m = t.memoryPrefix ? yield* W(t.memoryPrefix(a)).pipe(S.catchAll(() => S.succeed(""))) : "", h = yield* Te({
588
- system: m ? `${m}\n\n${Be(r)}` : Be(r),
589
- prompt: ze(i),
645
+ }), h = t.memoryPrefix ? yield* W(t.memoryPrefix(a)).pipe(S.catchAll(() => S.succeed(""))) : "", g = yield* Ne({
646
+ system: h ? `${h}\n\n${dt(r)}` : dt(r),
647
+ prompt: ut(i),
590
648
  schema: C.Record({
591
649
  key: C.String,
592
650
  value: C.Unknown
@@ -594,7 +652,7 @@ var I = ye("_voltro_ai_flows", {
594
652
  tools: {
595
653
  run_agent: f,
596
654
  generate_media: p,
597
- pick_structured: ee
655
+ pick_structured: m
598
656
  },
599
657
  maxSteps: r.maxSteps,
600
658
  ...r.orchestrator?.model ? { provider: K(t, r.orchestrator.model) } : {}
@@ -605,9 +663,9 @@ var I = ye("_voltro_ai_flows", {
605
663
  ok: !1,
606
664
  e
607
665
  })));
608
- return h.ok ? {
609
- object: h.r.object,
610
- planCostMicroUsd: q(h.r.usage, h.r.providerMetadata, r.orchestrator?.model),
666
+ return g.ok ? {
667
+ object: g.r.object,
668
+ planCostMicroUsd: q(g.r.usage, g.r.providerMetadata, r.orchestrator?.model),
611
669
  toolCostMicroUsd: c,
612
670
  steps: s
613
671
  } : {
@@ -615,7 +673,7 @@ var I = ye("_voltro_ai_flows", {
615
673
  planCostMicroUsd: 0,
616
674
  toolCostMicroUsd: c,
617
675
  steps: s,
618
- error: String(h.e.message ?? h.e)
676
+ error: String(g.e.message ?? g.e)
619
677
  };
620
678
  })
621
679
  }), c = s.planCostMicroUsd + s.toolCostMicroUsd;
@@ -639,8 +697,8 @@ var I = ye("_voltro_ai_flows", {
639
697
  status: "succeeded",
640
698
  output: s.object
641
699
  });
642
- }), Ue = (e, t = {}) => (n, r) => S.gen(function* () {
643
- let { runId: r, flowRef: i, input: a } = n, o = yield* M({
700
+ }), mt = (e, t = {}) => (n, r) => S.gen(function* () {
701
+ let { runId: r, flowRef: i, input: a } = n, o = yield* A({
644
702
  name: "flow-0-resolve",
645
703
  input: { flowRef: i },
646
704
  success: C.Struct({
@@ -660,19 +718,19 @@ var I = ye("_voltro_ai_flows", {
660
718
  runId: r,
661
719
  status: "failed"
662
720
  };
663
- let s = o.ir, c = (yield* S.promise(() => e.store.query(D(L).where(w("id", r)).descriptor)).pipe(S.catchAllCause(() => S.succeed([]))))[0], l = c?.ownerId ?? null, u = c?.tenantId ?? null, d = s.mode === "agentic" ? yield* He(e, t, r, s, a, l, u) : yield* Ie(e, t, r, s, a, {
721
+ let s = o.ir, c = (yield* S.promise(() => e.store.query(D(P).where(w("id", r)).descriptor)).pipe(S.catchAllCause(() => S.succeed([]))))[0], l = c?.ownerId ?? null, u = c?.tenantId ?? null, d = s.mode === "agentic" ? yield* pt(e, t, r, s, a, l, u) : yield* st(e, t, r, s, a, {
664
722
  ownerId: l,
665
723
  tenantId: u,
666
724
  source: n.source
667
725
  });
668
- return d.status === "succeeded" && s.chain && (yield* Le(e, r, s, a, d.output ?? {}, n)), t.onEvent && (d.status === "succeeded" || d.status === "failed") && (yield* W(t.onEvent({
726
+ return d.status === "succeeded" && s.chain && (yield* ct(e, r, s, a, d.output ?? {}, n)), t.onEvent && (d.status === "succeeded" || d.status === "failed") && (yield* W(t.onEvent({
669
727
  kind: d.status,
670
728
  runId: r,
671
729
  flowName: s.name,
672
730
  ownerId: l,
673
731
  source: n.source
674
732
  })).pipe(S.catchAllCause(() => S.void))), d;
675
- }), We = {
733
+ }), ht = {
676
734
  text: (e) => ({
677
735
  type: "generate",
678
736
  modality: "text",
@@ -699,36 +757,37 @@ var I = ye("_voltro_ai_flows", {
699
757
  type: "human",
700
758
  ...e
701
759
  })
702
- }, Ge = (e) => e.map((e, t) => "id" in e && e.id ? e : {
760
+ }, gt = (e) => e.map((e, t) => "id" in e && e.id ? e : {
703
761
  id: `step-${t}`,
704
762
  ...e
705
- }), Ke = (e) => {
763
+ }), _t = (e) => {
706
764
  let t = new Set(e.brief.map((e) => e.key)), n = [];
707
765
  for (let r of e.steps) {
708
- for (let e of R(r.prompt ?? "")) t.has(e) || n.push(`step "${r.id}" references {{${e}}} which is not a brief field or a prior step outputKey`);
709
- r.outputKey && t.add(_(r.outputKey));
766
+ for (let e of L(r.prompt ?? "")) t.has(e) || n.push(`step "${r.id}" references {{${e}}} which is not a brief field or a prior step outputKey`);
767
+ r.outputKey && t.add(ce(r.outputKey));
710
768
  }
711
- if (n.length > 0) throw new pe({
769
+ if (n.length > 0) throw new me({
712
770
  flowRef: e.name,
713
771
  message: `flow "${e.name}" has ${n.length} unresolved reference(s)`,
714
772
  issues: n
715
773
  });
716
- }, qe = (e) => {
717
- let t = g({
774
+ }, vt = (e) => {
775
+ let t = _({
718
776
  name: e.name,
719
777
  mode: e.mode,
720
- steps: Ge(e.steps),
778
+ steps: gt(e.steps),
721
779
  maxSteps: e.maxSteps,
722
780
  brief: e.brief,
723
781
  orchestratorModel: e.orchestrator?.model,
724
782
  orchestratorInstructions: e.orchestrator?.instructions,
725
783
  chain: e.chain,
726
- cadence: e.cadence
784
+ cadence: e.cadence,
785
+ humanTimeoutMs: e.humanTimeoutMs
727
786
  });
728
- return Ke(t), V(t), t;
729
- }, X = (e) => String(e).padStart(2, "0"), Je = (e, t) => `cron-${e}-${t.getFullYear()}${X(t.getMonth() + 1)}${X(t.getDate())}-${X(t.getHours())}${X(t.getMinutes())}`, Ye = async (e) => {
787
+ return _t(t), Je(t), t;
788
+ }, X = (e) => String(e).padStart(2, "0"), yt = (e, t) => `cron-${e}-${t.getFullYear()}${X(t.getMonth() + 1)}${X(t.getDate())}-${X(t.getHours())}${X(t.getMinutes())}`, bt = async (e) => {
730
789
  let t = [];
731
- for (let e of U()) e.cadence && (e.cadence.repeats?.length ?? 0) > 0 && t.push({
790
+ for (let e of Xe()) e.cadence && (e.cadence.repeats?.length ?? 0) > 0 && t.push({
732
791
  flowRef: e.name,
733
792
  cadence: e.cadence,
734
793
  defaultInput: e.cadence.defaultInput ?? {}
@@ -740,11 +799,11 @@ var I = ye("_voltro_ai_flows", {
740
799
  defaultInput: e.cadence.defaultInput ?? {}
741
800
  });
742
801
  return t;
743
- }, Xe = async (e, t = /* @__PURE__ */ new Date()) => {
744
- let n = e.workflows, r = [], i = 0, a = await Ye(e).catch(() => []);
802
+ }, xt = async (e, t = /* @__PURE__ */ new Date()) => {
803
+ let n = e.workflows, r = [], i = 0, a = await bt(e).catch(() => []);
745
804
  for (let o of a) {
746
- if (!he(o.cadence, t) || (i += 1, !n)) continue;
747
- let a = Je(o.flowRef, t), s = `run-${a}`;
805
+ if (!ge(o.cadence, t) || (i += 1, !n)) continue;
806
+ let a = yt(o.flowRef, t), s = `run-${a}`;
748
807
  try {
749
808
  try {
750
809
  await e.store.insert("_voltro_ai_flow_runs", {
@@ -770,17 +829,17 @@ var I = ye("_voltro_ai_flows", {
770
829
  matched: i,
771
830
  started: r
772
831
  };
773
- }, Ze = (e) => ({
832
+ }, St = (e) => ({
774
833
  name: "gateway",
775
834
  model: e
776
- }), Qe = (e) => Math.round(e * 1e6), Z = (e, t, n) => {
777
- let r = Se(t);
778
- return typeof r == "number" ? Qe(r) : e ? P(e, { model: n ?? "unknown" }).costMicroUsd ?? 0 : 0;
779
- }, $e = (e, t) => (n) => {
780
- let r = n.model, i = (e) => t?.resolveModel?.(e) ?? Ze(e);
835
+ }), Ct = (e) => Math.round(e * 1e6), Z = (e, t, n) => {
836
+ let r = Ae(t);
837
+ return typeof r == "number" ? Ct(r) : e ? ke(e, { model: n ?? "unknown" }).costMicroUsd ?? 0 : 0;
838
+ }, wt = (e, t) => (n) => {
839
+ let r = n.model, i = (e) => t?.resolveModel?.(e) ?? St(e);
781
840
  return S.gen(function* () {
782
841
  if (n.modality === "image") {
783
- let t = yield* Ce({
842
+ let t = yield* je({
784
843
  prompt: n.prompt,
785
844
  ...r ? { provider: i(r) } : {}
786
845
  }), a = t.images[0];
@@ -800,7 +859,7 @@ var I = ye("_voltro_ai_flows", {
800
859
  };
801
860
  }
802
861
  if (n.modality === "audio") {
803
- let t = yield* Ee({
862
+ let t = yield* Pe({
804
863
  text: n.prompt,
805
864
  ...r ? { provider: i(r) } : {}
806
865
  }), a = yield* S.promise(() => e.put({
@@ -814,7 +873,7 @@ var I = ye("_voltro_ai_flows", {
814
873
  costMicroUsd: Z(t.usage, t.providerMetadata, r)
815
874
  };
816
875
  }
817
- let t = yield* De({
876
+ let t = yield* Fe({
818
877
  prompt: n.prompt,
819
878
  ...r ? { provider: i(r) } : {},
820
879
  ...n.params ? { params: n.params } : {}
@@ -838,14 +897,14 @@ var I = ye("_voltro_ai_flows", {
838
897
  capability: `media:${n.modality}`,
839
898
  message: String(e.message ?? e)
840
899
  }))));
841
- }, Q = () => globalThis.crypto?.randomUUID?.() ?? `req-${Date.now().toString(36)}`, et = (e) => e.request?.subject?.id ?? null, $ = (e, t) => S.promise(() => e.store.query(D(L).where(w("id", t)).descriptor)).pipe(S.map((e) => e[0])), tt = (e, t) => S.gen(function* () {
900
+ }, Q = () => globalThis.crypto?.randomUUID?.() ?? `req-${Date.now().toString(36)}`, Tt = (e) => e.request?.subject?.id ?? null, $ = (e, t) => S.promise(() => e.store.query(D(P).where(w("id", t)).descriptor)).pipe(S.map((e) => e[0])), Et = (e, t) => S.gen(function* () {
842
901
  let n = yield* Y(e, t.flowRef), r = t.input ?? {}, i = n.brief.filter((e) => e.required && e.type !== "boolean" && (r[e.key] === void 0 || r[e.key] === null || r[e.key] === "")).map((e) => e.key);
843
- if (i.length > 0) return yield* S.fail(new le({
902
+ if (i.length > 0) return yield* S.fail(new ue({
844
903
  missing: i,
845
904
  message: `missing required brief field(s): ${i.join(", ")}`
846
905
  }));
847
906
  let a = Q(), o = `run-${a}`, s = t.source ?? "manual";
848
- yield* S.promise(() => e.store.insert(L.tableName, {
907
+ yield* S.promise(() => e.store.insert(P.tableName, {
849
908
  id: o,
850
909
  flowRef: t.flowRef,
851
910
  flowName: n.name,
@@ -854,7 +913,7 @@ var I = ye("_voltro_ai_flows", {
854
913
  source: s,
855
914
  requestId: a,
856
915
  input: r,
857
- ownerId: et(e)
916
+ ownerId: Tt(e)
858
917
  }));
859
918
  let c = e.workflows;
860
919
  return c && (yield* S.promise(() => c.start(v, {
@@ -868,14 +927,14 @@ var I = ye("_voltro_ai_flows", {
868
927
  requestId: a,
869
928
  status: "pending"
870
929
  };
871
- }), nt = (e, t) => S.gen(function* () {
930
+ }), Dt = (e, t) => S.gen(function* () {
872
931
  let n = yield* $(e, t.runId);
873
932
  if (!n) return yield* S.fail(new x({
874
933
  runId: t.runId,
875
934
  message: "run not found"
876
935
  }));
877
936
  let r = n.requestId ?? Q(), i = n.flowRef, a = n.input ?? {}, o = n.source ?? "manual";
878
- yield* S.promise(() => e.store.update(L.tableName, t.runId, {
937
+ yield* S.promise(() => e.store.update(P.tableName, t.runId, {
879
938
  status: "pending",
880
939
  error: null,
881
940
  errorMessage: null
@@ -892,8 +951,8 @@ var I = ye("_voltro_ai_flows", {
892
951
  requestId: r,
893
952
  status: "pending"
894
953
  };
895
- }), rt = (e, t) => S.gen(function* () {
896
- return (yield* $(e, t.runId)) ? (yield* S.promise(() => e.store.update(L.tableName, t.runId, {
954
+ }), Ot = (e, t) => S.gen(function* () {
955
+ return (yield* $(e, t.runId)) ? (yield* S.promise(() => e.store.update(P.tableName, t.runId, {
897
956
  status: "cancelled",
898
957
  cancelledAt: (/* @__PURE__ */ new Date()).toISOString()
899
958
  })), {
@@ -903,14 +962,19 @@ var I = ye("_voltro_ai_flows", {
903
962
  runId: t.runId,
904
963
  message: "run not found"
905
964
  }));
906
- }), it = (e, t) => S.gen(function* () {
965
+ }), kt = (e) => {
966
+ let t = e.steps?.find((e) => e.status === "waiting");
967
+ if (t !== void 0) return t.id;
968
+ let n = e.currentStep;
969
+ return typeof n == "number" ? n : 0;
970
+ }, At = (e, t) => S.gen(function* () {
907
971
  let n = yield* $(e, t.runId);
908
972
  if (!n) return yield* S.fail(new x({
909
973
  runId: t.runId,
910
974
  message: "run not found"
911
975
  }));
912
976
  let r = n.status;
913
- if (r !== "waiting") return yield* S.fail(new de({
977
+ if (r !== "waiting") return yield* S.fail(new fe({
914
978
  runId: t.runId,
915
979
  status: r ?? "unknown",
916
980
  message: `run is "${r}", not awaiting a response`
@@ -919,27 +983,47 @@ var I = ye("_voltro_ai_flows", {
919
983
  ...t.response,
920
984
  respondedAt: (/* @__PURE__ */ new Date()).toISOString()
921
985
  };
922
- yield* S.promise(() => e.store.update(L.tableName, t.runId, { humanResponse: i }));
923
- let a = e.workflows, o = n.requestId;
986
+ yield* S.promise(() => e.store.update(P.tableName, t.runId, { humanResponse: i }));
987
+ let a = e.workflows, o = n.requestId, s = kt(n);
924
988
  return a && o && (yield* S.promise(() => a.signal({
925
989
  workflowName: v,
926
990
  executionId: `flow-run:${o}`
927
- }, y, i)).pipe(S.catchAllCause(() => S.void))), { runId: t.runId };
928
- }), at = (e, t) => S.promise(() => e.store.query(D(I).where(w("id", t.id)).descriptor)).pipe(S.map((e) => e[0])), ot = (e) => S.promise(() => e.store.query(D(I).descriptor)), st = (e, t) => S.promise(() => e.store.insert(I.tableName, {
991
+ }, y(s), i)).pipe(S.catchAllCause(() => S.void))), {
992
+ runId: t.runId,
993
+ stepIndex: s
994
+ };
995
+ }), jt = (e, t) => S.promise(() => e.store.query(D(N).where(w("id", t.id)).descriptor)).pipe(S.map((e) => e[0])), Mt = (e) => S.promise(() => e.store.query(D(N).descriptor)), Nt = (e, t) => S.promise(() => e.store.insert(N.tableName, {
929
996
  id: t.id ?? `flow-${Q()}`,
930
997
  ...t
931
- })), ct = (e, t) => S.promise(() => e.store.update(I.tableName, t.id, t.patch)), lt = (e, t) => S.promise(() => e.store.delete(I.tableName, t.id)), ut = (e = {}) => {
932
- let t = e.alias ?? "aiFlows", n = { current: void 0 }, r = (e) => ({
998
+ })), Pt = (e, t) => S.promise(() => e.store.update(N.tableName, t.id, t.patch)), Ft = (e, t) => S.promise(() => e.store.delete(N.tableName, t.id)), It = "aiFlows", Lt = (e = {}) => {
999
+ let t = ye({
1000
+ base: It,
1001
+ alias: e.alias
1002
+ });
1003
+ Ve(e.humanReviewTimeoutMs === void 0 ? {} : { humanReviewTimeoutMs: e.humanReviewTimeoutMs }), Ce({
1004
+ source: "plugin",
1005
+ table: P.tableName,
1006
+ timeColumn: "createdAt",
1007
+ ttlMs: e.runsTtlMs ?? I(process.env.VOLTRO_AI_FLOW_RUNS_TTL_HOURS, 2160),
1008
+ envVar: Be,
1009
+ label: "ai flow runs",
1010
+ where: Se("status", [
1011
+ "succeeded",
1012
+ "failed",
1013
+ "cancelled"
1014
+ ])
1015
+ });
1016
+ let n = Math.max(1, e.inspectPageMax ?? 200), r = { current: void 0 }, i = (e) => ({
933
1017
  kind: "json",
934
1018
  data: e
935
- }), i = (e, t) => ({
1019
+ }), a = (e, t) => ({
936
1020
  kind: "json",
937
1021
  status: e,
938
1022
  data: { error: t }
939
- }), a = (e, t) => S.promise(async () => {
940
- let a = n.current;
941
- if (!a) return i(503, "store not bound yet");
942
- let o = await a.query({
1023
+ }), o = (e, t) => S.promise(async () => {
1024
+ let n = r.current;
1025
+ if (!n) return a(503, "store not bound yet");
1026
+ let o = await n.query({
943
1027
  table: e,
944
1028
  predicate: void 0,
945
1029
  order: [],
@@ -947,31 +1031,36 @@ var I = ye("_voltro_ai_flows", {
947
1031
  skip: void 0,
948
1032
  projection: void 0
949
1033
  });
950
- return r({
1034
+ return i({
951
1035
  count: o.length,
952
- rows: o
1036
+ rows: o,
1037
+ take: t
953
1038
  });
954
- }).pipe(S.catchAllCause(() => S.succeed(i(500, "query failed"))));
955
- return ge({
1039
+ }).pipe(S.catchAllCause(() => S.succeed(a(500, "query failed")))), s = (e, t) => {
1040
+ let r = /[?&]take=(\d+)/.exec(e)?.[1], i = r === void 0 ? t : Number(r);
1041
+ return Math.min(n, Math.max(1, Number.isFinite(i) ? i : t));
1042
+ }, c = [{
1043
+ method: "GET",
1044
+ path: "/flows",
1045
+ description: "List flow definitions (`?take=` up to the configured max).",
1046
+ handler: (e) => o("_voltro_ai_flows", s(e.url, Math.min(200, n)))
1047
+ }, {
1048
+ method: "GET",
1049
+ path: "/runs",
1050
+ description: "List recent flow runs (`?take=` up to the configured max).",
1051
+ handler: (e) => o("_voltro_ai_flow_runs", s(e.url, Math.min(100, n)))
1052
+ }];
1053
+ return ve({
956
1054
  name: t,
1055
+ baseName: It,
957
1056
  description: "AI Flows — durable multi-step AI pipelines (deterministic + agentic) with human-in-the-loop, chaining, and cadence. Code-first (defineFlow) or data-driven.",
958
1057
  permissions: ["store:write", "inspect:read"],
959
- extendSchema: { tables: Oe },
960
- inspectEndpoints: [{
961
- method: "GET",
962
- path: "/flows",
963
- description: "List flow definitions.",
964
- handler: () => a("_voltro_ai_flows", 200)
965
- }, {
966
- method: "GET",
967
- path: "/runs",
968
- description: "List recent flow runs.",
969
- handler: () => a("_voltro_ai_flow_runs", 100)
970
- }],
1058
+ ...e.tables === !1 ? {} : { extendSchema: { tables: Ie } },
1059
+ inspectEndpoints: c,
971
1060
  bindDataStore: (e) => {
972
- n.current = e;
1061
+ r.current = e;
973
1062
  }
974
1063
  });
975
1064
  };
976
1065
  //#endregion
977
- export { e as BriefField, t as ChainPending, v as FLOW_RUN_WORKFLOW, n as FlowCadence, r as FlowChain, i as FlowMode, a as FlowStatus, o as FlowStep, y as HUMAN_RESPONSE_SIGNAL, s as HumanResponse, c as Json, l as MAX_STEPS_DEFAULT, u as MAX_STEPS_MAX, d as MAX_STEPS_MIN, f as MediaInputSlot, p as MediaInputs, ee as Modality, m as ReviewMode, h as ReviewOption, te as RunReview, ne as RunSource, re as RunStatus, ie as RunStep, ae as RunStepStatus, oe as StepType, se as Visibility, L as aiFlowRunsTable, ut as aiFlowsPlugin, I as aiFlowsTable, Oe as aiFlowsTables, Ue as buildFlowRunExecute, he as cadenceMatches, rt as cancelFlow, ce as clampMaxSteps, je as clearRegistry, R as collectRefs, st as createFlow, Je as cronRequestId, qe as defineFlow, lt as deleteFlow, We as flowStep, at as getFlow, H as getRegisteredFlow, z as interpolate, tt as launchFlow, ot as listFlows, U as listRegisteredFlows, $e as makeMediaGenerator, me as nextRuns, g as normalizeFlow, V as registerFlow, Y as resolveIr, it as respondToFlow, nt as retryFlow, Xe as runCadenceTick, _ as sanitizeOutputKey, Ae as unresolvedRefs, ct as updateFlow, Ke as validateFlow };
1066
+ export { e as BriefField, t as ChainPending, Be as FLOW_RUNS_TTL_ENV, ze as FLOW_RUNS_TTL_HOURS_DEFAULT, v as FLOW_RUN_WORKFLOW, n as FlowCadence, r as FlowChain, i as FlowMode, a as FlowStatus, o as FlowStep, le as HUMAN_RESPONSE_SIGNAL_PREFIX, Re as HUMAN_REVIEW_TIMEOUT_ENV, Le as HUMAN_REVIEW_TIMEOUT_HOURS_DEFAULT, s as HumanResponse, c as Json, l as MAX_STEPS_DEFAULT, u as MAX_STEPS_MAX, d as MAX_STEPS_MIN, f as MediaInputSlot, p as MediaInputs, m as Modality, h as ReviewMode, g as ReviewOption, ee as RunReview, te as RunSource, ne as RunStatus, re as RunStep, ie as RunStepStatus, ae as StepType, oe as Visibility, P as aiFlowRunsTable, Lt as aiFlowsPlugin, N as aiFlowsTable, Ie as aiFlowsTables, mt as buildFlowRunExecute, ge as cadenceMatches, Ot as cancelFlow, se as clampMaxSteps, Ze as clearRegistry, L as collectRefs, Nt as createFlow, yt as cronRequestId, vt as defineFlow, Ft as deleteFlow, ht as flowStep, He as getAiFlowsDefaults, jt as getFlow, Ye as getRegisteredFlow, y as humanResponseSignalName, R as interpolate, nt as jsonSchemaToEffectSchema, Et as launchFlow, Mt as listFlows, Xe as listRegisteredFlows, wt as makeMediaGenerator, he as nextRuns, _ as normalizeFlow, Je as registerFlow, Ue as resetAiFlowsDefaults, Ge as resolveHumanReviewTimeoutMs, Y as resolveIr, At as respondToFlow, Dt as retryFlow, xt as runCadenceTick, ce as sanitizeOutputKey, Ve as setAiFlowsDefaults, qe as unresolvedRefs, Pt as updateFlow, _t as validateFlow, kt as waitingStepIndex };