@voltro/plugin-ai-flows 0.33.0 → 0.35.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/CHANGELOG.md +1968 -0
- package/dist/index.d.ts +415 -58
- package/dist/index.js +523 -291
- package/dist/ir-BOv5uwYI.js +142 -0
- package/dist/ir.d.ts +142 -7
- package/dist/ir.js +2 -102
- package/dist/web.d.ts +306 -7
- package/dist/web.js +96 -1
- package/dist/workflow.d.ts +42 -3
- package/dist/workflow.js +4 -3
- package/package.json +11 -10
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { Schema as e } from "effect";
|
|
2
|
+
//#region src/condition.ts
|
|
3
|
+
var t = e.Literal("truthy", "falsy", "eq", "neq", "contains"), n = e.Struct({
|
|
4
|
+
ref: e.String,
|
|
5
|
+
op: t,
|
|
6
|
+
value: e.optional(e.Unknown)
|
|
7
|
+
}), r = (e) => e == null ? !1 : typeof e == "boolean" ? e : !Array.isArray(e) || e.length > 0, i = (e, t) => {
|
|
8
|
+
if (e === t) return !0;
|
|
9
|
+
if (e === null || t === null || e === void 0 || t === void 0) return !1;
|
|
10
|
+
if (typeof e == "object" || typeof t == "object") try {
|
|
11
|
+
return JSON.stringify(e) === JSON.stringify(t);
|
|
12
|
+
} catch {
|
|
13
|
+
return !1;
|
|
14
|
+
}
|
|
15
|
+
return String(e) === String(t);
|
|
16
|
+
}, a = (e, t) => {
|
|
17
|
+
let n = t[e.ref];
|
|
18
|
+
switch (e.op) {
|
|
19
|
+
case "truthy": return r(n);
|
|
20
|
+
case "falsy": return !r(n);
|
|
21
|
+
case "eq": return i(n, e.value);
|
|
22
|
+
case "neq": return !i(n, e.value);
|
|
23
|
+
case "contains": {
|
|
24
|
+
if (n == null) return !1;
|
|
25
|
+
if (Array.isArray(n)) return n.some((t) => i(t, e.value));
|
|
26
|
+
let t = e.value;
|
|
27
|
+
return typeof t != "string" && typeof t != "number" ? !1 : String(n).includes(String(t));
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}, o = (e) => {
|
|
31
|
+
switch (e.op) {
|
|
32
|
+
case "truthy": return `{{${e.ref}}} is set`;
|
|
33
|
+
case "falsy": return `{{${e.ref}}} is not set`;
|
|
34
|
+
case "eq": return `{{${e.ref}}} equals ${JSON.stringify(e.value)}`;
|
|
35
|
+
case "neq": return `{{${e.ref}}} does not equal ${JSON.stringify(e.value)}`;
|
|
36
|
+
case "contains": return `{{${e.ref}}} contains ${JSON.stringify(e.value)}`;
|
|
37
|
+
}
|
|
38
|
+
}, s = e.Literal("deterministic", "agentic"), c = e.Literal("draft", "active", "archived"), l = e.Literal("private", "organization", "shared"), u = e.Literal("pending", "running", "waiting", "succeeded", "failed", "cancelled"), d = e.Literal("manual", "cron"), f = e.Literal("agent", "generate", "structured", "note", "human"), p = e.Literal("text", "image", "video", "audio"), m = e.Literal("approve", "choice", "text"), h = e.Struct({
|
|
39
|
+
value: e.String,
|
|
40
|
+
label: e.String
|
|
41
|
+
}), g = e.Union(e.Struct({
|
|
42
|
+
from: e.Literal("upload"),
|
|
43
|
+
url: e.String
|
|
44
|
+
}), e.Struct({
|
|
45
|
+
from: e.Literal("step"),
|
|
46
|
+
ref: e.String
|
|
47
|
+
})), _ = e.Record({
|
|
48
|
+
key: e.String,
|
|
49
|
+
value: g
|
|
50
|
+
}), v = e.Record({
|
|
51
|
+
key: e.String,
|
|
52
|
+
value: e.Unknown
|
|
53
|
+
}), y = e.Struct({
|
|
54
|
+
id: e.String,
|
|
55
|
+
title: e.optional(e.String),
|
|
56
|
+
description: e.optional(e.String),
|
|
57
|
+
type: f,
|
|
58
|
+
outputKey: e.optional(e.String),
|
|
59
|
+
prompt: e.optional(e.String),
|
|
60
|
+
modality: e.optional(p),
|
|
61
|
+
model: e.optional(e.String),
|
|
62
|
+
params: e.optional(v),
|
|
63
|
+
mediaInputs: e.optional(_),
|
|
64
|
+
agentRef: e.optional(e.String),
|
|
65
|
+
schema: e.optional(v),
|
|
66
|
+
reviewMode: e.optional(m),
|
|
67
|
+
options: e.optional(e.Array(h)),
|
|
68
|
+
when: e.optional(n),
|
|
69
|
+
group: e.optional(e.String),
|
|
70
|
+
timeoutMs: e.optional(e.Number)
|
|
71
|
+
}), b = e.Struct({
|
|
72
|
+
key: e.String,
|
|
73
|
+
label: e.String,
|
|
74
|
+
type: e.Literal("text", "textarea", "number", "boolean"),
|
|
75
|
+
required: e.optional(e.Boolean),
|
|
76
|
+
placeholder: e.optional(e.String)
|
|
77
|
+
}), x = e.Struct({
|
|
78
|
+
flowRef: e.String,
|
|
79
|
+
mappings: e.Array(e.Struct({
|
|
80
|
+
targetKey: e.String,
|
|
81
|
+
sourceKey: e.String
|
|
82
|
+
})),
|
|
83
|
+
requireConfirmation: e.optional(e.Boolean)
|
|
84
|
+
}), S = e.Struct({
|
|
85
|
+
frequency: e.optional(e.Literal("weekly", "monthly")),
|
|
86
|
+
repeats: e.Array(e.Number),
|
|
87
|
+
intervalWeeks: e.optional(e.Number),
|
|
88
|
+
anchorDate: e.optional(e.String),
|
|
89
|
+
weekOfMonth: e.optional(e.Union(e.Literal(1, 2, 3, 4), e.Literal("last"))),
|
|
90
|
+
hour: e.optional(e.Number),
|
|
91
|
+
minute: e.optional(e.Literal(0, 15, 30, 45)),
|
|
92
|
+
defaultInput: e.optional(v)
|
|
93
|
+
}), C = e.Literal("pending", "running", "waiting", "succeeded", "failed", "skipped"), w = e.Struct({
|
|
94
|
+
mode: m,
|
|
95
|
+
options: e.optional(e.Array(h)),
|
|
96
|
+
prompt: e.String
|
|
97
|
+
}), T = e.Struct({
|
|
98
|
+
id: e.Number,
|
|
99
|
+
title: e.String,
|
|
100
|
+
description: e.optional(e.String),
|
|
101
|
+
type: f,
|
|
102
|
+
status: C,
|
|
103
|
+
startedAt: e.optional(e.String),
|
|
104
|
+
completedAt: e.optional(e.String),
|
|
105
|
+
costMicroUsd: e.optional(e.Number),
|
|
106
|
+
requestId: e.optional(e.String),
|
|
107
|
+
url: e.optional(e.String),
|
|
108
|
+
output: e.optional(e.Struct({ text: e.String })),
|
|
109
|
+
errorMessage: e.optional(e.String),
|
|
110
|
+
skipReason: e.optional(e.String),
|
|
111
|
+
review: e.optional(w)
|
|
112
|
+
}), E = e.Struct({
|
|
113
|
+
decision: e.optional(e.Literal("approve", "reject")),
|
|
114
|
+
value: e.optional(e.String),
|
|
115
|
+
text: e.optional(e.String),
|
|
116
|
+
respondedAt: e.optional(e.String)
|
|
117
|
+
}), D = e.Struct({
|
|
118
|
+
flowRef: e.String,
|
|
119
|
+
input: v,
|
|
120
|
+
status: e.Literal("pending", "confirmed", "dismissed")
|
|
121
|
+
}), O = 30, k = 1, A = 100, j = (e) => e == null || !Number.isFinite(e) ? 30 : Math.min(100, Math.max(1, Math.trunc(e))), M = (e) => e.replace(/[^\w.-]/g, "_"), N = (e) => {
|
|
122
|
+
let t = (e.steps ?? []).map((e) => e.outputKey ? {
|
|
123
|
+
...e,
|
|
124
|
+
outputKey: M(e.outputKey)
|
|
125
|
+
} : e), n = e.orchestratorModel || e.orchestratorInstructions ? {
|
|
126
|
+
...e.orchestratorModel ? { model: e.orchestratorModel } : {},
|
|
127
|
+
...e.orchestratorInstructions ? { instructions: e.orchestratorInstructions } : {}
|
|
128
|
+
} : void 0;
|
|
129
|
+
return {
|
|
130
|
+
name: e.name,
|
|
131
|
+
mode: e.mode ?? "deterministic",
|
|
132
|
+
steps: t,
|
|
133
|
+
maxSteps: j(e.maxSteps),
|
|
134
|
+
brief: e.brief ?? [],
|
|
135
|
+
...n ? { orchestrator: n } : {},
|
|
136
|
+
...e.chain ? { chain: e.chain } : {},
|
|
137
|
+
...e.cadence ? { cadence: e.cadence } : {},
|
|
138
|
+
...e.humanTimeoutMs != null && Number.isFinite(e.humanTimeoutMs) ? { humanTimeoutMs: e.humanTimeoutMs } : {}
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
//#endregion
|
|
142
|
+
export { o as A, f as C, M as D, N as E, r as M, t as O, C as S, j as T, h as _, s as a, u as b, E as c, A as d, k as f, m as g, p as h, x as i, a as j, n as k, v as l, _ as m, D as n, c as o, g as p, S as r, y as s, b as t, O as u, w as v, l as w, T as x, d as y };
|
package/dist/ir.d.ts
CHANGED
|
@@ -9,7 +9,17 @@ export declare const BriefField: Schema.Struct<{
|
|
|
9
9
|
placeholder: Schema.optional<typeof Schema.String>;
|
|
10
10
|
}>;
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
/** An INTERFACE for the same reason as {@link FlowStep} — it is reached from an
|
|
13
|
+
* exported table (`aiFlows.inputSchema`), so an alias to a mapped type gets
|
|
14
|
+
* expanded structurally into the api report, in an order that is not stable
|
|
15
|
+
* across build scopes. The `Equals` pin below fails to compile on any drift. */
|
|
16
|
+
export declare interface BriefField {
|
|
17
|
+
readonly key: string;
|
|
18
|
+
readonly label: string;
|
|
19
|
+
readonly type: 'text' | 'textarea' | 'number' | 'boolean';
|
|
20
|
+
readonly required?: boolean | undefined;
|
|
21
|
+
readonly placeholder?: string | undefined;
|
|
22
|
+
}
|
|
13
23
|
|
|
14
24
|
/** Staged follow-up when `chainTo.requireConfirmation` is set. */
|
|
15
25
|
export declare const ChainPending: Schema.Struct<{
|
|
@@ -18,10 +28,35 @@ export declare const ChainPending: Schema.Struct<{
|
|
|
18
28
|
status: Schema.Literal<["pending", "confirmed", "dismissed"]>;
|
|
19
29
|
}>;
|
|
20
30
|
|
|
21
|
-
|
|
31
|
+
/** An INTERFACE — reached from `aiFlowRuns.chainPending`; see {@link BriefField}. */
|
|
32
|
+
export declare interface ChainPending {
|
|
33
|
+
readonly flowRef: string;
|
|
34
|
+
readonly input: Json;
|
|
35
|
+
readonly status: 'pending' | 'confirmed' | 'dismissed';
|
|
36
|
+
}
|
|
22
37
|
|
|
23
38
|
export declare const clampMaxSteps: (n: number | null | undefined) => number;
|
|
24
39
|
|
|
40
|
+
/** The comparison a `when:` performs. */
|
|
41
|
+
export declare const ConditionOp: Schema.Literal<["truthy", "falsy", "eq", "neq", "contains"]>;
|
|
42
|
+
|
|
43
|
+
export declare type ConditionOp = typeof ConditionOp.Type;
|
|
44
|
+
|
|
45
|
+
/** A one-line rendering for the run timeline and the editor preview. Exported
|
|
46
|
+
* so the reason a step was skipped is the SAME sentence in both places. */
|
|
47
|
+
export declare const describeCondition: (condition: StepCondition) => string;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Evaluate `condition` against a run context.
|
|
51
|
+
*
|
|
52
|
+
* A condition on a ref the context does not carry evaluates as ABSENT — false
|
|
53
|
+
* for `truthy`/`eq`/`contains`, true for `falsy`/`neq`. That asymmetry is the
|
|
54
|
+
* honest reading of "the producing step did not run", and it is why
|
|
55
|
+
* `validateFlow` refuses a dangling ref at registration: at run time, a typo and
|
|
56
|
+
* a genuinely-skipped producer are indistinguishable here.
|
|
57
|
+
*/
|
|
58
|
+
export declare const evaluateCondition: (condition: StepCondition, context: Readonly<Record<string, unknown>>) => boolean;
|
|
59
|
+
|
|
25
60
|
/** Schedule spec — richer than a single cron expr (weekly interval + anchor,
|
|
26
61
|
* monthly weekOfMonth), evaluated by the shared `cadenceMatches` predicate. */
|
|
27
62
|
export declare const FlowCadence: Schema.Struct<{
|
|
@@ -40,7 +75,25 @@ export declare const FlowCadence: Schema.Struct<{
|
|
|
40
75
|
defaultInput: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>;
|
|
41
76
|
}>;
|
|
42
77
|
|
|
43
|
-
|
|
78
|
+
/**
|
|
79
|
+
* An INTERFACE — reached from `aiFlows.cadence`; see {@link BriefField}.
|
|
80
|
+
*
|
|
81
|
+
* This one is not hypothetical: a single-package `api:report` and a
|
|
82
|
+
* full-monorepo build emitted `hour`/`minute` in DIFFERENT positions inside the
|
|
83
|
+
* structurally-expanded alias, so the api-surface gate rejected a file nobody
|
|
84
|
+
* had touched, showing the same members moving. That is the exact failure
|
|
85
|
+
* {@link FlowStep}'s comment describes.
|
|
86
|
+
*/
|
|
87
|
+
export declare interface FlowCadence {
|
|
88
|
+
readonly frequency?: 'weekly' | 'monthly' | undefined;
|
|
89
|
+
readonly repeats: ReadonlyArray<number>;
|
|
90
|
+
readonly intervalWeeks?: number | undefined;
|
|
91
|
+
readonly anchorDate?: string | undefined;
|
|
92
|
+
readonly weekOfMonth?: 1 | 2 | 3 | 4 | 'last' | undefined;
|
|
93
|
+
readonly hour?: number | undefined;
|
|
94
|
+
readonly minute?: 0 | 15 | 30 | 45 | undefined;
|
|
95
|
+
readonly defaultInput?: Json | undefined;
|
|
96
|
+
}
|
|
44
97
|
|
|
45
98
|
/** Follow-up flow spec. On success, map source → the child's brief. */
|
|
46
99
|
export declare const FlowChain: Schema.Struct<{
|
|
@@ -53,7 +106,15 @@ export declare const FlowChain: Schema.Struct<{
|
|
|
53
106
|
requireConfirmation: Schema.optional<typeof Schema.Boolean>;
|
|
54
107
|
}>;
|
|
55
108
|
|
|
56
|
-
|
|
109
|
+
/** An INTERFACE — reached from `aiFlows.chainTo`; see {@link BriefField}. */
|
|
110
|
+
export declare interface FlowChain {
|
|
111
|
+
readonly flowRef: string;
|
|
112
|
+
readonly mappings: ReadonlyArray<{
|
|
113
|
+
readonly targetKey: string;
|
|
114
|
+
readonly sourceKey: string;
|
|
115
|
+
}>;
|
|
116
|
+
readonly requireConfirmation?: boolean | undefined;
|
|
117
|
+
}
|
|
57
118
|
|
|
58
119
|
/** The raw flow definition either front door supplies before normalization.
|
|
59
120
|
* Optional fields tolerate explicit `undefined` (row reads produce it). */
|
|
@@ -67,6 +128,7 @@ export declare interface FlowDefinitionInput {
|
|
|
67
128
|
readonly orchestratorInstructions?: string | null | undefined;
|
|
68
129
|
readonly chain?: FlowChain | null | undefined;
|
|
69
130
|
readonly cadence?: FlowCadence | null | undefined;
|
|
131
|
+
readonly humanTimeoutMs?: number | null | undefined;
|
|
70
132
|
}
|
|
71
133
|
|
|
72
134
|
/** The single representation the engine interprets, from either front door. */
|
|
@@ -82,6 +144,10 @@ export declare interface FlowIR {
|
|
|
82
144
|
};
|
|
83
145
|
readonly chain?: FlowChain;
|
|
84
146
|
readonly cadence?: FlowCadence;
|
|
147
|
+
/** Flow-wide default for a `human` step's park bound, in ms. A step's own
|
|
148
|
+
* `timeoutMs` wins; absent here too → the engine/plugin default. `0` = wait
|
|
149
|
+
* forever. */
|
|
150
|
+
readonly humanTimeoutMs?: number;
|
|
85
151
|
}
|
|
86
152
|
|
|
87
153
|
/** Execution mode. Replaces the legacy `allowDeviation` boolean — a mode is not
|
|
@@ -132,6 +198,29 @@ export declare const FlowStep: Schema.Struct<{
|
|
|
132
198
|
value: typeof Schema.String;
|
|
133
199
|
label: typeof Schema.String;
|
|
134
200
|
}>>>;
|
|
201
|
+
/** Gate this step on a prior value. Absent → the step always runs. A step
|
|
202
|
+
* whose condition is false is SKIPPED, not failed: it produces no output, so
|
|
203
|
+
* anything referencing its `outputKey` sees an absent value. */
|
|
204
|
+
when: Schema.optional<Schema.Struct<{
|
|
205
|
+
ref: typeof Schema.String;
|
|
206
|
+
op: Schema.Literal<["truthy", "falsy", "eq", "neq", "contains"]>;
|
|
207
|
+
value: Schema.optional<typeof Schema.Unknown>;
|
|
208
|
+
}>>;
|
|
209
|
+
/**
|
|
210
|
+
* Fan-out group. CONSECUTIVE steps sharing a group name run CONCURRENTLY,
|
|
211
|
+
* each still journaled as its own durable step.
|
|
212
|
+
*
|
|
213
|
+
* Steps in one group may not reference each other's outputs — they have no
|
|
214
|
+
* order between them — and `validateFlow` refuses a flow that tries. A `human`
|
|
215
|
+
* step may not join a group either: it suspends the whole workflow, which is
|
|
216
|
+
* not a thing one branch of a fan-out can do.
|
|
217
|
+
*/
|
|
218
|
+
group: Schema.optional<typeof Schema.String>;
|
|
219
|
+
/** `human` step only — how long the run parks awaiting this review before it
|
|
220
|
+
* fails, in milliseconds. Omitted → the flow's `humanTimeoutMs`, then the
|
|
221
|
+
* engine/plugin default (see `resolveHumanReviewTimeoutMs`). `0` means WAIT
|
|
222
|
+
* FOREVER (the park is slot-free, so an unbounded wait costs no worker). */
|
|
223
|
+
timeoutMs: Schema.optional<typeof Schema.Number>;
|
|
135
224
|
}>;
|
|
136
225
|
|
|
137
226
|
/**
|
|
@@ -172,6 +261,9 @@ export declare interface FlowStep {
|
|
|
172
261
|
readonly schema?: Json | undefined;
|
|
173
262
|
readonly reviewMode?: ReviewMode | undefined;
|
|
174
263
|
readonly options?: ReadonlyArray<ReviewOption> | undefined;
|
|
264
|
+
readonly when?: StepCondition | undefined;
|
|
265
|
+
readonly group?: string | undefined;
|
|
266
|
+
readonly timeoutMs?: number | undefined;
|
|
175
267
|
}
|
|
176
268
|
|
|
177
269
|
/** The HITL answer, written by `respond`. */
|
|
@@ -182,7 +274,27 @@ export declare const HumanResponse: Schema.Struct<{
|
|
|
182
274
|
respondedAt: Schema.optional<typeof Schema.String>;
|
|
183
275
|
}>;
|
|
184
276
|
|
|
185
|
-
|
|
277
|
+
/** An INTERFACE — reached from `aiFlowRuns.humanResponse`; see {@link BriefField}. */
|
|
278
|
+
export declare interface HumanResponse {
|
|
279
|
+
readonly decision?: 'approve' | 'reject' | undefined;
|
|
280
|
+
readonly value?: string | undefined;
|
|
281
|
+
readonly text?: string | undefined;
|
|
282
|
+
readonly respondedAt?: string | undefined;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Truthiness, defined once so the engine and the editor cannot disagree.
|
|
287
|
+
*
|
|
288
|
+
* Deliberately NOT JavaScript's: `0` and `''` are falsy in JS, and a step gated
|
|
289
|
+
* on a count or a generated string would then be skipped for a legitimate value.
|
|
290
|
+
* A flow author writing `when: { ref: 'count', op: 'truthy' }` means "there is a
|
|
291
|
+
* count", not "the count is non-zero" — the second is `{ op: 'neq', value: 0 }`,
|
|
292
|
+
* which they can say if they mean it.
|
|
293
|
+
*
|
|
294
|
+
* Absent, null and the empty ARRAY are the falsy set: those are the three
|
|
295
|
+
* shapes a step that produced nothing actually leaves behind.
|
|
296
|
+
*/
|
|
297
|
+
export declare const isTruthy: (v: unknown) => boolean;
|
|
186
298
|
|
|
187
299
|
/** A JSON value (for `params` / `input` / a `structured` step's JSON Schema). */
|
|
188
300
|
export declare const Json: Schema.Record$<typeof Schema.String, typeof Schema.Unknown>;
|
|
@@ -271,7 +383,7 @@ export declare const RunStep: Schema.Struct<{
|
|
|
271
383
|
title: typeof Schema.String;
|
|
272
384
|
description: Schema.optional<typeof Schema.String>;
|
|
273
385
|
type: Schema.Literal<["agent", "generate", "structured", "note", "human"]>;
|
|
274
|
-
status: Schema.Literal<["pending", "running", "waiting", "succeeded", "failed"]>;
|
|
386
|
+
status: Schema.Literal<["pending", "running", "waiting", "succeeded", "failed", "skipped"]>;
|
|
275
387
|
startedAt: Schema.optional<typeof Schema.String>;
|
|
276
388
|
completedAt: Schema.optional<typeof Schema.String>;
|
|
277
389
|
/** Per-step cost in micro-USD (the app view projects to €/cents). */
|
|
@@ -285,6 +397,9 @@ export declare const RunStep: Schema.Struct<{
|
|
|
285
397
|
text: typeof Schema.String;
|
|
286
398
|
}>>;
|
|
287
399
|
errorMessage: Schema.optional<typeof Schema.String>;
|
|
400
|
+
/** Why a `skipped` step was skipped — the rendered condition, so the timeline
|
|
401
|
+
* says "{{approved}} is not set" instead of leaving a silent gap. */
|
|
402
|
+
skipReason: Schema.optional<typeof Schema.String>;
|
|
288
403
|
review: Schema.optional<Schema.Struct<{
|
|
289
404
|
mode: Schema.Literal<["approve", "choice", "text"]>;
|
|
290
405
|
options: Schema.optional<Schema.Array$<Schema.Struct<{
|
|
@@ -313,16 +428,36 @@ export declare interface RunStep {
|
|
|
313
428
|
readonly text: string;
|
|
314
429
|
} | undefined;
|
|
315
430
|
readonly errorMessage?: string | undefined;
|
|
431
|
+
readonly skipReason?: string | undefined;
|
|
316
432
|
readonly review?: RunReview | undefined;
|
|
317
433
|
}
|
|
318
434
|
|
|
319
|
-
export declare const RunStepStatus: Schema.Literal<["pending", "running", "waiting", "succeeded", "failed"]>;
|
|
435
|
+
export declare const RunStepStatus: Schema.Literal<["pending", "running", "waiting", "succeeded", "failed", "skipped"]>;
|
|
320
436
|
|
|
321
437
|
export declare type RunStepStatus = typeof RunStepStatus.Type;
|
|
322
438
|
|
|
323
439
|
/** Sanitize an outputKey to the `{{ref}}`-safe charset. */
|
|
324
440
|
export declare const sanitizeOutputKey: (key: string) => string;
|
|
325
441
|
|
|
442
|
+
declare const StepCondition: Schema.Struct<{
|
|
443
|
+
/** A brief-field key or an EARLIER step's `outputKey`. */
|
|
444
|
+
ref: typeof Schema.String;
|
|
445
|
+
op: Schema.Literal<["truthy", "falsy", "eq", "neq", "contains"]>;
|
|
446
|
+
/** The right-hand side for `eq` / `neq` / `contains`. Ignored by the unary ops. */
|
|
447
|
+
value: Schema.optional<typeof Schema.Unknown>;
|
|
448
|
+
}>;
|
|
449
|
+
|
|
450
|
+
/** An INTERFACE, for the same api-report reason as `FlowStep` — it is reached
|
|
451
|
+
* from an exported table column, and an alias to a mapped type gets expanded
|
|
452
|
+
* structurally in an order that is not stable across build scopes. */
|
|
453
|
+
declare interface StepCondition {
|
|
454
|
+
readonly ref: string;
|
|
455
|
+
readonly op: ConditionOp;
|
|
456
|
+
readonly value?: unknown;
|
|
457
|
+
}
|
|
458
|
+
export { StepCondition }
|
|
459
|
+
export { StepCondition as StepConditionType }
|
|
460
|
+
|
|
326
461
|
/** The five step types. `generate` fans out to four modalities. */
|
|
327
462
|
export declare const StepType: Schema.Literal<["agent", "generate", "structured", "note", "human"]>;
|
|
328
463
|
|
package/dist/ir.js
CHANGED
|
@@ -1,102 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
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 };
|
|
1
|
+
import { A as e, C as t, D as n, E as r, M as i, O as a, S as o, T as s, _ as c, a as l, b as u, c as d, d as f, f as p, g as m, h, i as g, j as _, k as v, l as y, m as b, n as x, o as S, p as C, r as w, s as T, t as E, u as D, v as O, w as k, x as A, y as j } from "./ir-BOv5uwYI.js";
|
|
2
|
+
export { E as BriefField, x as ChainPending, a as ConditionOp, w as FlowCadence, g as FlowChain, l as FlowMode, S as FlowStatus, T as FlowStep, d as HumanResponse, y as Json, D as MAX_STEPS_DEFAULT, f as MAX_STEPS_MAX, p as MAX_STEPS_MIN, C as MediaInputSlot, b as MediaInputs, h as Modality, m as ReviewMode, c as ReviewOption, O as RunReview, j as RunSource, u as RunStatus, A as RunStep, o as RunStepStatus, v as StepCondition, t as StepType, k as Visibility, s as clampMaxSteps, e as describeCondition, _ as evaluateCondition, i as isTruthy, r as normalizeFlow, n as sanitizeOutputKey };
|