@arbidocs/blocks 0.4.90 → 0.4.92
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/agents/index.cjs +280 -279
- package/dist/agents/index.js +4 -3
- package/dist/agents/workflows/types.d.ts +6 -0
- package/dist/{chunk-ZPERNIMP.cjs → chunk-2WLXQGWC.cjs} +8 -3
- package/dist/chunk-2WLXQGWC.cjs.map +1 -0
- package/dist/chunk-32HW2Q33.cjs +59 -0
- package/dist/chunk-32HW2Q33.cjs.map +1 -0
- package/dist/{chunk-5XZU64E2.cjs → chunk-3US5OIDQ.cjs} +68 -33
- package/dist/chunk-3US5OIDQ.cjs.map +1 -0
- package/dist/{chunk-DPLRHEJZ.js → chunk-5LXQPP2K.js} +4 -33
- package/dist/chunk-5LXQPP2K.js.map +1 -0
- package/dist/{chunk-NQS7NFGM.js → chunk-5NQIBJPP.js} +4 -4
- package/dist/{chunk-NQS7NFGM.js.map → chunk-5NQIBJPP.js.map} +1 -1
- package/dist/{chunk-NXWKMKZY.js → chunk-5RQOVALO.js} +3 -3
- package/dist/{chunk-NXWKMKZY.js.map → chunk-5RQOVALO.js.map} +1 -1
- package/dist/chunk-AUS3KBHJ.js +52 -0
- package/dist/chunk-AUS3KBHJ.js.map +1 -0
- package/dist/{chunk-TMKJACMP.cjs → chunk-DDYXFALG.cjs} +44 -44
- package/dist/{chunk-TMKJACMP.cjs.map → chunk-DDYXFALG.cjs.map} +1 -1
- package/dist/chunk-DVUZTGVL.cjs +52 -0
- package/dist/chunk-DVUZTGVL.cjs.map +1 -0
- package/dist/{chunk-UCAYNE44.cjs → chunk-EHF63UYP.cjs} +5 -5
- package/dist/{chunk-UCAYNE44.cjs.map → chunk-EHF63UYP.cjs.map} +1 -1
- package/dist/{chunk-IC2VHFWR.js → chunk-JJA6GQKH.js} +8 -3
- package/dist/chunk-JJA6GQKH.js.map +1 -0
- package/dist/{chunk-YX466FWL.js → chunk-PGDL26TQ.js} +68 -33
- package/dist/chunk-PGDL26TQ.js.map +1 -0
- package/dist/components/tones.d.ts +5 -0
- package/dist/connect/index.cjs +24 -23
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/index.js +4 -3
- package/dist/connect/index.js.map +1 -1
- package/dist/facts/index.cjs +2 -2
- package/dist/facts/index.js +1 -1
- package/dist/files/ViewToggle.d.ts +6 -1
- package/dist/files/index.cjs +8 -7
- package/dist/files/index.cjs.map +1 -1
- package/dist/files/index.js +3 -2
- package/dist/files/index.js.map +1 -1
- package/dist/index.cjs +320 -311
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/dist/settings/index.cjs +6 -5
- package/dist/settings/index.cjs.map +1 -1
- package/dist/settings/index.js +2 -1
- package/dist/settings/index.js.map +1 -1
- package/dist/site/index.cjs +4 -3
- package/dist/site/index.js +2 -1
- package/dist/workflow-canvas/FieldOptionsEditor.d.ts +25 -0
- package/dist/workflow-canvas/StepInspector.d.ts +6 -2
- package/dist/workflow-canvas/index.cjs +176 -47
- package/dist/workflow-canvas/index.cjs.map +1 -1
- package/dist/workflow-canvas/index.d.ts +1 -0
- package/dist/workflow-canvas/index.js +133 -6
- package/dist/workflow-canvas/index.js.map +1 -1
- package/package.json +4 -4
- package/dist/chunk-5XZU64E2.cjs.map +0 -1
- package/dist/chunk-DPLRHEJZ.js.map +0 -1
- package/dist/chunk-IC2VHFWR.js.map +0 -1
- package/dist/chunk-VFUWWH52.cjs +0 -83
- package/dist/chunk-VFUWWH52.cjs.map +0 -1
- package/dist/chunk-YX466FWL.js.map +0 -1
- package/dist/chunk-ZPERNIMP.cjs.map +0 -1
package/dist/site/index.cjs
CHANGED
|
@@ -6,7 +6,8 @@ var chunkMJCCBMM5_cjs = require('../chunk-MJCCBMM5.cjs');
|
|
|
6
6
|
var chunkELR74ME6_cjs = require('../chunk-ELR74ME6.cjs');
|
|
7
7
|
var chunkVPPX5XUF_cjs = require('../chunk-VPPX5XUF.cjs');
|
|
8
8
|
var chunkPCB2BPN3_cjs = require('../chunk-PCB2BPN3.cjs');
|
|
9
|
-
var
|
|
9
|
+
var chunkDVUZTGVL_cjs = require('../chunk-DVUZTGVL.cjs');
|
|
10
|
+
require('../chunk-32HW2Q33.cjs');
|
|
10
11
|
var chunkKDG6FER6_cjs = require('../chunk-KDG6FER6.cjs');
|
|
11
12
|
require('../chunk-DES3K4SD.cjs');
|
|
12
13
|
|
|
@@ -290,11 +291,11 @@ Object.defineProperty(exports, "Callout", {
|
|
|
290
291
|
});
|
|
291
292
|
Object.defineProperty(exports, "Dot", {
|
|
292
293
|
enumerable: true,
|
|
293
|
-
get: function () { return
|
|
294
|
+
get: function () { return chunkDVUZTGVL_cjs.Dot; }
|
|
294
295
|
});
|
|
295
296
|
Object.defineProperty(exports, "ToneBadge", {
|
|
296
297
|
enumerable: true,
|
|
297
|
-
get: function () { return
|
|
298
|
+
get: function () { return chunkDVUZTGVL_cjs.ToneBadge; }
|
|
298
299
|
});
|
|
299
300
|
Object.defineProperty(exports, "daysUntil", {
|
|
300
301
|
enumerable: true,
|
package/dist/site/index.js
CHANGED
|
@@ -4,7 +4,8 @@ export { Accordion, AvatarBlock, Banner, BlockImage, BlockLink, CTABanner, Colum
|
|
|
4
4
|
export { Timeline } from '../chunk-OVEQERPO.js';
|
|
5
5
|
export { TimelineCalendar, TimelineGantt, dayKey, formatSpan, monthLabel, parseIso, utcDay } from '../chunk-4EZVCGRL.js';
|
|
6
6
|
export { Callout } from '../chunk-UJE32SST.js';
|
|
7
|
-
export { Dot, ToneBadge } from '../chunk-
|
|
7
|
+
export { Dot, ToneBadge } from '../chunk-5LXQPP2K.js';
|
|
8
|
+
import '../chunk-AUS3KBHJ.js';
|
|
8
9
|
export { daysUntil, fmtDate, fmtDateTime, formatCurrency, fromNow, hrs, initials, pct } from '../chunk-OXF2IFXG.js';
|
|
9
10
|
import '../chunk-VUNV25KB.js';
|
|
10
11
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The choices of a `select` field in the builder: each option's label and tone. An option's value
|
|
3
|
+
* follows its label (`High risk` → `high_risk`) while the option is new; a saved one keeps its
|
|
4
|
+
* value when relabelled (`{value: high, label: "High — refer to COLP"}`), as signals test it.
|
|
5
|
+
*/
|
|
6
|
+
import { type Tone } from '../components/tones';
|
|
7
|
+
import type { WorkflowFieldOption } from '../agents';
|
|
8
|
+
export interface FieldOptionsEditorLabels {
|
|
9
|
+
options: string;
|
|
10
|
+
addOption: string;
|
|
11
|
+
optionLabel: string;
|
|
12
|
+
optionTone: string;
|
|
13
|
+
/** The tone picker's "no tone" choice. */
|
|
14
|
+
noTone: string;
|
|
15
|
+
tones: Record<Tone, string>;
|
|
16
|
+
}
|
|
17
|
+
export declare const DEFAULT_FIELD_OPTIONS_EDITOR_LABELS: FieldOptionsEditorLabels;
|
|
18
|
+
/** A value from a label: lower case, `_` between words, unique among `taken`. */
|
|
19
|
+
export declare const optionValue: (label: string, taken: string[]) => string;
|
|
20
|
+
export declare function FieldOptionsEditor({ options, onChange, l, testId, }: {
|
|
21
|
+
options: WorkflowFieldOption[];
|
|
22
|
+
onChange: (options: WorkflowFieldOption[]) => void;
|
|
23
|
+
l: FieldOptionsEditorLabels;
|
|
24
|
+
testId: string;
|
|
25
|
+
}): import("react").JSX.Element;
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { type WorkflowDefinition, type WorkflowField } from '../agents';
|
|
6
6
|
import { type SignalsEditorLabels } from './SignalsEditor';
|
|
7
|
+
import { type FieldOptionsEditorLabels } from './FieldOptionsEditor';
|
|
7
8
|
import { type StepActionSettingsLabels, type StepInspectorOption } from './StepActionSettings';
|
|
8
9
|
export type { StepInspectorOption } from './StepActionSettings';
|
|
9
10
|
export interface StepInspectorLabels {
|
|
@@ -63,16 +64,19 @@ export interface StepInspectorProps {
|
|
|
63
64
|
actionLabels?: Partial<StepActionSettingsLabels>;
|
|
64
65
|
/** The "When done, signal…" editor's wording. */
|
|
65
66
|
signalLabels?: Partial<SignalsEditorLabels>;
|
|
67
|
+
/** A select field's choices editor wording. */
|
|
68
|
+
optionLabels?: Partial<FieldOptionsEditorLabels>;
|
|
66
69
|
testId?: string;
|
|
67
70
|
}
|
|
68
|
-
export declare function StepInspector({ workflow, stepId, onChange, onSelect, workflows, people, tags, documents, labels, actionLabels, signalLabels, testId, }: StepInspectorProps): import("react").JSX.Element;
|
|
71
|
+
export declare function StepInspector({ workflow, stepId, onChange, onSelect, workflows, people, tags, documents, labels, actionLabels, signalLabels, optionLabels, testId, }: StepInspectorProps): import("react").JSX.Element;
|
|
69
72
|
/** The fields editor: a form's fields, a review's fields. */
|
|
70
|
-
export declare function FormFields({ fields, taken, onChange, l, hint, testId, }: {
|
|
73
|
+
export declare function FormFields({ fields, taken, onChange, l, optionLabels, hint, testId, }: {
|
|
71
74
|
fields: WorkflowField[];
|
|
72
75
|
/** Codes used by other steps' fields: a field's code never collides with them. */
|
|
73
76
|
taken: string[];
|
|
74
77
|
onChange: (fields: WorkflowField[]) => void;
|
|
75
78
|
l: Pick<StepInspectorLabels, 'fields' | 'fieldLabel' | 'fieldType' | 'required' | 'addField'>;
|
|
79
|
+
optionLabels?: FieldOptionsEditorLabels;
|
|
76
80
|
hint?: string;
|
|
77
81
|
testId: string;
|
|
78
82
|
}): import("react").JSX.Element;
|
|
@@ -2,15 +2,16 @@
|
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
var chunkMUMH3Z6K_cjs = require('../chunk-MUMH3Z6K.cjs');
|
|
5
|
-
var
|
|
5
|
+
var chunkDDYXFALG_cjs = require('../chunk-DDYXFALG.cjs');
|
|
6
6
|
require('../chunk-S5HZBXZA.cjs');
|
|
7
7
|
require('../chunk-ZW6FPIFC.cjs');
|
|
8
|
-
var
|
|
8
|
+
var chunk3US5OIDQ_cjs = require('../chunk-3US5OIDQ.cjs');
|
|
9
9
|
require('../chunk-N26CXGXC.cjs');
|
|
10
10
|
require('../chunk-7RGLTF76.cjs');
|
|
11
11
|
require('../chunk-3AFWGEDJ.cjs');
|
|
12
|
-
require('../chunk-
|
|
12
|
+
require('../chunk-DVUZTGVL.cjs');
|
|
13
13
|
require('../chunk-DETZZBG2.cjs');
|
|
14
|
+
var chunk32HW2Q33_cjs = require('../chunk-32HW2Q33.cjs');
|
|
14
15
|
require('../chunk-V4ISCZJ7.cjs');
|
|
15
16
|
require('../chunk-2EI7NCUA.cjs');
|
|
16
17
|
require('../chunk-Z5VUZ6YD.cjs');
|
|
@@ -59,11 +60,11 @@ function withSteps(workflow, steps, layout) {
|
|
|
59
60
|
const run = workflow.run.kind === "steps" ? workflow.run : { kind: "steps", steps: [] };
|
|
60
61
|
return {
|
|
61
62
|
...workflow,
|
|
62
|
-
run: { ...run, steps:
|
|
63
|
+
run: { ...run, steps: chunk3US5OIDQ_cjs.orderSteps(steps), layout: layout ?? run.layout }
|
|
63
64
|
};
|
|
64
65
|
}
|
|
65
66
|
var layoutOf = (workflow) => workflow.run.kind === "steps" && workflow.run.layout || {};
|
|
66
|
-
var explicit = (steps) => steps.map((s) => ({ ...s, after:
|
|
67
|
+
var explicit = (steps) => steps.map((s) => ({ ...s, after: chunk3US5OIDQ_cjs.stepDependencies(steps, s.id) }));
|
|
67
68
|
function stepIdFor(steps, title) {
|
|
68
69
|
const base = title.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").replace(/^[^a-z]+/, "") || "step";
|
|
69
70
|
const taken = new Set(steps.map((s) => s.id));
|
|
@@ -110,7 +111,7 @@ function blankStep(kind, id, title) {
|
|
|
110
111
|
}
|
|
111
112
|
}
|
|
112
113
|
function addStep(workflow, kind, options = {}) {
|
|
113
|
-
const steps = explicit(
|
|
114
|
+
const steps = explicit(chunk3US5OIDQ_cjs.workflowSteps(workflow));
|
|
114
115
|
const title = options.title ?? DEFAULT_TITLES[kind];
|
|
115
116
|
const id = stepIdFor(steps, title);
|
|
116
117
|
const step = { ...blankStep(kind, id, title), after: options.after ? [options.after] : [] };
|
|
@@ -119,7 +120,7 @@ function addStep(workflow, kind, options = {}) {
|
|
|
119
120
|
return { workflow: withSteps(workflow, [...steps, step], layout), id };
|
|
120
121
|
}
|
|
121
122
|
function removeStep(workflow, id) {
|
|
122
|
-
const steps = explicit(
|
|
123
|
+
const steps = explicit(chunk3US5OIDQ_cjs.workflowSteps(workflow));
|
|
123
124
|
const removed = steps.find((s) => s.id === id);
|
|
124
125
|
if (!removed) return workflow;
|
|
125
126
|
const bridged = steps.filter((s) => s.id !== id).map(
|
|
@@ -132,8 +133,8 @@ function removeStep(workflow, id) {
|
|
|
132
133
|
return withSteps(workflow, bridged, layout);
|
|
133
134
|
}
|
|
134
135
|
function connectSteps(workflow, from, to) {
|
|
135
|
-
const steps = explicit(
|
|
136
|
-
if (from === to || !steps.some((s) => s.id === from) ||
|
|
136
|
+
const steps = explicit(chunk3US5OIDQ_cjs.workflowSteps(workflow));
|
|
137
|
+
if (from === to || !steps.some((s) => s.id === from) || chunk3US5OIDQ_cjs.dependsOn(steps, from, to)) {
|
|
137
138
|
return workflow;
|
|
138
139
|
}
|
|
139
140
|
return withSteps(
|
|
@@ -143,16 +144,16 @@ function connectSteps(workflow, from, to) {
|
|
|
143
144
|
)
|
|
144
145
|
);
|
|
145
146
|
}
|
|
146
|
-
var wouldCycle = (workflow, from, to) => from === to ||
|
|
147
|
+
var wouldCycle = (workflow, from, to) => from === to || chunk3US5OIDQ_cjs.dependsOn(chunk3US5OIDQ_cjs.workflowSteps(workflow), from, to);
|
|
147
148
|
function disconnectSteps(workflow, from, to) {
|
|
148
|
-
const steps = explicit(
|
|
149
|
+
const steps = explicit(chunk3US5OIDQ_cjs.workflowSteps(workflow));
|
|
149
150
|
return withSteps(
|
|
150
151
|
workflow,
|
|
151
152
|
steps.map((s) => s.id === to ? { ...s, after: (s.after ?? []).filter((d) => d !== from) } : s)
|
|
152
153
|
);
|
|
153
154
|
}
|
|
154
155
|
function updateStep(workflow, id, patch) {
|
|
155
|
-
const steps = explicit(
|
|
156
|
+
const steps = explicit(chunk3US5OIDQ_cjs.workflowSteps(workflow));
|
|
156
157
|
return withSteps(
|
|
157
158
|
workflow,
|
|
158
159
|
steps.map(
|
|
@@ -166,7 +167,7 @@ var renameIn = (text, from, to) => text.replace(
|
|
|
166
167
|
);
|
|
167
168
|
function renameInput(workflow, from, to) {
|
|
168
169
|
if (from === to) return workflow;
|
|
169
|
-
const steps =
|
|
170
|
+
const steps = chunk3US5OIDQ_cjs.workflowSteps(workflow).map((s) => {
|
|
170
171
|
if (s.kind === "agent")
|
|
171
172
|
return {
|
|
172
173
|
...s,
|
|
@@ -215,13 +216,13 @@ function renameInput(workflow, from, to) {
|
|
|
215
216
|
var renamePerson = (a, from, to) => "input" in a && a.input === from ? { input: to } : a;
|
|
216
217
|
var renameRef = (r, from, to) => "input" in r && r.input === from ? { input: to } : r;
|
|
217
218
|
function moveStep(workflow, id, position) {
|
|
218
|
-
return withSteps(workflow,
|
|
219
|
+
return withSteps(workflow, chunk3US5OIDQ_cjs.workflowSteps(workflow), { ...layoutOf(workflow), [id]: position });
|
|
219
220
|
}
|
|
220
221
|
var COLUMN = 300;
|
|
221
222
|
var ROW = 140;
|
|
222
223
|
function autoLayout(steps) {
|
|
223
224
|
const layout = {};
|
|
224
|
-
|
|
225
|
+
chunk3US5OIDQ_cjs.stepLevels(steps).forEach(
|
|
225
226
|
(level, x) => level.forEach((s, y) => {
|
|
226
227
|
layout[s.id] = { x: x * COLUMN, y: (y - (level.length - 1) / 2) * ROW };
|
|
227
228
|
})
|
|
@@ -229,7 +230,7 @@ function autoLayout(steps) {
|
|
|
229
230
|
return layout;
|
|
230
231
|
}
|
|
231
232
|
function layoutWithDefaults(workflow) {
|
|
232
|
-
const auto = autoLayout(
|
|
233
|
+
const auto = autoLayout(chunk3US5OIDQ_cjs.workflowSteps(workflow));
|
|
233
234
|
return { ...auto, ...layoutOf(workflow) };
|
|
234
235
|
}
|
|
235
236
|
var DEFAULT_SIGNALS_EDITOR_LABELS = {
|
|
@@ -326,9 +327,9 @@ function SignalsEditor({
|
|
|
326
327
|
{
|
|
327
328
|
className: ui.cn(
|
|
328
329
|
"space-y-1.5 rounded-md border p-2",
|
|
329
|
-
|
|
330
|
+
chunk3US5OIDQ_cjs.isIncompleteSignal(signal) ? "border-destructive/50" : "border-border"
|
|
330
331
|
),
|
|
331
|
-
"data-incomplete":
|
|
332
|
+
"data-incomplete": chunk3US5OIDQ_cjs.isIncompleteSignal(signal) || void 0,
|
|
332
333
|
"data-testid": `${testId}-${i}`,
|
|
333
334
|
children: [
|
|
334
335
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
@@ -979,6 +980,117 @@ function EditDocumentSettings({
|
|
|
979
980
|
)
|
|
980
981
|
] });
|
|
981
982
|
}
|
|
983
|
+
var DEFAULT_FIELD_OPTIONS_EDITOR_LABELS = {
|
|
984
|
+
options: "Choices",
|
|
985
|
+
addOption: "Add choice",
|
|
986
|
+
optionLabel: "Choice",
|
|
987
|
+
optionTone: "Colour",
|
|
988
|
+
noTone: "No colour",
|
|
989
|
+
tones: {
|
|
990
|
+
neutral: "Grey",
|
|
991
|
+
info: "Blue",
|
|
992
|
+
success: "Green",
|
|
993
|
+
warning: "Amber",
|
|
994
|
+
danger: "Red",
|
|
995
|
+
accent: "Purple",
|
|
996
|
+
ai: "AI"
|
|
997
|
+
}
|
|
998
|
+
};
|
|
999
|
+
var optionValue = (label, taken) => {
|
|
1000
|
+
const base = label.toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "") || "option";
|
|
1001
|
+
let value = base;
|
|
1002
|
+
let n = 2;
|
|
1003
|
+
while (taken.includes(value)) value = `${base}_${n++}`;
|
|
1004
|
+
return value;
|
|
1005
|
+
};
|
|
1006
|
+
function FieldOptionsEditor({
|
|
1007
|
+
options,
|
|
1008
|
+
onChange,
|
|
1009
|
+
l,
|
|
1010
|
+
testId
|
|
1011
|
+
}) {
|
|
1012
|
+
const [fresh, setFresh] = react.useState(() => /* @__PURE__ */ new Set());
|
|
1013
|
+
const others = (i) => options.filter((_, j) => j !== i).map((o) => o.value);
|
|
1014
|
+
const set = (i, p) => {
|
|
1015
|
+
const before = options[i]?.value;
|
|
1016
|
+
if (before !== void 0 && p.value !== void 0 && p.value !== before && fresh.has(before))
|
|
1017
|
+
setFresh((s) => new Set([...s].filter((v) => v !== before)).add(p.value));
|
|
1018
|
+
onChange(options.map((o, j) => j === i ? { ...o, ...p } : o));
|
|
1019
|
+
};
|
|
1020
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", "data-testid": `${testId}-options`, children: [
|
|
1021
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: l.options }),
|
|
1022
|
+
options.map((o, i) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", "data-testid": `${testId}-option-${i}`, children: [
|
|
1023
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1024
|
+
"span",
|
|
1025
|
+
{
|
|
1026
|
+
"aria-hidden": true,
|
|
1027
|
+
className: ui.cn(
|
|
1028
|
+
"size-2 shrink-0 rounded-full",
|
|
1029
|
+
o.tone ? chunk32HW2Q33_cjs.TONE_DOT[o.tone] : "border border-border"
|
|
1030
|
+
)
|
|
1031
|
+
}
|
|
1032
|
+
),
|
|
1033
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1034
|
+
ui.Input,
|
|
1035
|
+
{
|
|
1036
|
+
value: o.label,
|
|
1037
|
+
"aria-label": l.optionLabel,
|
|
1038
|
+
onChange: (e) => set(i, {
|
|
1039
|
+
label: e.target.value,
|
|
1040
|
+
// A saved option keeps its value: a signal (`equals: high`) may test it.
|
|
1041
|
+
value: fresh.has(o.value) ? optionValue(e.target.value, others(i)) : o.value
|
|
1042
|
+
}),
|
|
1043
|
+
className: "h-8 min-w-0 flex-1"
|
|
1044
|
+
}
|
|
1045
|
+
),
|
|
1046
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1047
|
+
"select",
|
|
1048
|
+
{
|
|
1049
|
+
"aria-label": l.optionTone,
|
|
1050
|
+
className: ui.cn(selectClass2, "h-8 w-28 shrink-0"),
|
|
1051
|
+
value: o.tone ?? "",
|
|
1052
|
+
onChange: (e) => set(i, { tone: chunk32HW2Q33_cjs.isTone(e.target.value) ? e.target.value : void 0 }),
|
|
1053
|
+
"data-testid": `${testId}-option-${i}-tone`,
|
|
1054
|
+
children: [
|
|
1055
|
+
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "", children: l.noTone }),
|
|
1056
|
+
chunk32HW2Q33_cjs.TONES.map((t) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: t, children: l.tones[t] }, t))
|
|
1057
|
+
]
|
|
1058
|
+
}
|
|
1059
|
+
),
|
|
1060
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1061
|
+
"button",
|
|
1062
|
+
{
|
|
1063
|
+
type: "button",
|
|
1064
|
+
"aria-label": `${o.label} \xD7`,
|
|
1065
|
+
onClick: () => onChange(options.filter((_, j) => j !== i)),
|
|
1066
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "size-4 text-muted-foreground" })
|
|
1067
|
+
}
|
|
1068
|
+
)
|
|
1069
|
+
] }, i)),
|
|
1070
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1071
|
+
ui.Button,
|
|
1072
|
+
{
|
|
1073
|
+
variant: "ghost",
|
|
1074
|
+
size: "sm",
|
|
1075
|
+
onClick: () => {
|
|
1076
|
+
const label = `${l.optionLabel} ${options.length + 1}`;
|
|
1077
|
+
const value = optionValue(
|
|
1078
|
+
label,
|
|
1079
|
+
options.map((o) => o.value)
|
|
1080
|
+
);
|
|
1081
|
+
setFresh((s) => new Set(s).add(value));
|
|
1082
|
+
onChange([...options, { value, label }]);
|
|
1083
|
+
},
|
|
1084
|
+
"data-testid": `${testId}-add-option`,
|
|
1085
|
+
children: [
|
|
1086
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Plus, { className: "size-4" }),
|
|
1087
|
+
" ",
|
|
1088
|
+
l.addOption
|
|
1089
|
+
]
|
|
1090
|
+
}
|
|
1091
|
+
)
|
|
1092
|
+
] });
|
|
1093
|
+
}
|
|
982
1094
|
var DEFAULT_STEP_INSPECTOR_LABELS = {
|
|
983
1095
|
workflow: "Workflow",
|
|
984
1096
|
title: "Title",
|
|
@@ -1016,6 +1128,7 @@ var FIELD_TYPES = [
|
|
|
1016
1128
|
"text",
|
|
1017
1129
|
"longtext",
|
|
1018
1130
|
"boolean",
|
|
1131
|
+
"select",
|
|
1019
1132
|
"number",
|
|
1020
1133
|
"date",
|
|
1021
1134
|
"scope",
|
|
@@ -1040,10 +1153,12 @@ function StepInspector({
|
|
|
1040
1153
|
labels,
|
|
1041
1154
|
actionLabels,
|
|
1042
1155
|
signalLabels,
|
|
1156
|
+
optionLabels,
|
|
1043
1157
|
testId = "step-inspector"
|
|
1044
1158
|
}) {
|
|
1045
1159
|
const l = { ...DEFAULT_STEP_INSPECTOR_LABELS, ...labels };
|
|
1046
|
-
const
|
|
1160
|
+
const ol = { ...DEFAULT_FIELD_OPTIONS_EDITOR_LABELS, ...optionLabels };
|
|
1161
|
+
const steps = chunk3US5OIDQ_cjs.workflowSteps(workflow);
|
|
1047
1162
|
const step = steps.find((s) => s.id === stepId);
|
|
1048
1163
|
const run = workflow.run.kind === "steps" ? workflow.run : void 0;
|
|
1049
1164
|
if (!step || !run) {
|
|
@@ -1070,8 +1185,8 @@ function StepInspector({
|
|
|
1070
1185
|
const patch = (p) => onChange(updateStep(workflow, step.id, p));
|
|
1071
1186
|
const al = { ...DEFAULT_STEP_ACTION_SETTINGS_LABELS, ...actionLabels };
|
|
1072
1187
|
const ctx = {
|
|
1073
|
-
earlier:
|
|
1074
|
-
fields:
|
|
1188
|
+
earlier: chunk3US5OIDQ_cjs.upstreamSteps(steps, step.id),
|
|
1189
|
+
fields: chunk3US5OIDQ_cjs.runFields(workflow),
|
|
1075
1190
|
people,
|
|
1076
1191
|
tags,
|
|
1077
1192
|
documents
|
|
@@ -1092,7 +1207,7 @@ function StepInspector({
|
|
|
1092
1207
|
)
|
|
1093
1208
|
);
|
|
1094
1209
|
};
|
|
1095
|
-
const deps =
|
|
1210
|
+
const deps = chunk3US5OIDQ_cjs.stepDependencies(steps, step.id);
|
|
1096
1211
|
const titleOf = (id) => steps.find((s) => s.id === id)?.title ?? id;
|
|
1097
1212
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", "data-testid": `${testId}-step`, children: [
|
|
1098
1213
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
@@ -1144,6 +1259,7 @@ function StepInspector({
|
|
|
1144
1259
|
taken: takenBy(step.id),
|
|
1145
1260
|
onChange: (inputs) => setFields(step.inputs, inputs, "inputs"),
|
|
1146
1261
|
l,
|
|
1262
|
+
optionLabels: ol,
|
|
1147
1263
|
testId
|
|
1148
1264
|
}
|
|
1149
1265
|
),
|
|
@@ -1172,7 +1288,7 @@ function StepInspector({
|
|
|
1172
1288
|
{
|
|
1173
1289
|
step,
|
|
1174
1290
|
workflows,
|
|
1175
|
-
fields:
|
|
1291
|
+
fields: chunk3US5OIDQ_cjs.runFields(workflow).map((f) => f.name),
|
|
1176
1292
|
patch,
|
|
1177
1293
|
l,
|
|
1178
1294
|
testId
|
|
@@ -1197,6 +1313,7 @@ function StepInspector({
|
|
|
1197
1313
|
taken: takenBy(step.id),
|
|
1198
1314
|
onChange: (fields) => setFields(step.fields ?? [], fields, "fields"),
|
|
1199
1315
|
l: { ...l, fields: l.reviewFields },
|
|
1316
|
+
optionLabels: ol,
|
|
1200
1317
|
hint: l.reviewFieldsHint,
|
|
1201
1318
|
testId: `${testId}-review`
|
|
1202
1319
|
}
|
|
@@ -1232,7 +1349,7 @@ function StepInspector({
|
|
|
1232
1349
|
testId: `${testId}-review-grid`
|
|
1233
1350
|
}
|
|
1234
1351
|
),
|
|
1235
|
-
|
|
1352
|
+
chunk3US5OIDQ_cjs.canAssign(step) && /* @__PURE__ */ jsxRuntime.jsx(AssigneeSettings, { step, patch, ctx, l: al, testId }),
|
|
1236
1353
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1237
1354
|
SignalsEditor,
|
|
1238
1355
|
{
|
|
@@ -1267,6 +1384,7 @@ function FormFields({
|
|
|
1267
1384
|
taken,
|
|
1268
1385
|
onChange,
|
|
1269
1386
|
l,
|
|
1387
|
+
optionLabels = DEFAULT_FIELD_OPTIONS_EDITOR_LABELS,
|
|
1270
1388
|
hint,
|
|
1271
1389
|
testId
|
|
1272
1390
|
}) {
|
|
@@ -1323,7 +1441,16 @@ function FormFields({
|
|
|
1323
1441
|
l.required
|
|
1324
1442
|
] }),
|
|
1325
1443
|
/* @__PURE__ */ jsxRuntime.jsx("code", { className: "shrink-0 text-[11px] text-muted-foreground", children: `{{${f.name}}}` })
|
|
1326
|
-
] })
|
|
1444
|
+
] }),
|
|
1445
|
+
f.type === "select" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1446
|
+
FieldOptionsEditor,
|
|
1447
|
+
{
|
|
1448
|
+
options: f.options ?? [],
|
|
1449
|
+
onChange: (options) => set(i, { options }),
|
|
1450
|
+
l: optionLabels,
|
|
1451
|
+
testId: `${testId}-field-${i}`
|
|
1452
|
+
}
|
|
1453
|
+
)
|
|
1327
1454
|
] }, i)),
|
|
1328
1455
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1329
1456
|
ui.Button,
|
|
@@ -1488,7 +1615,7 @@ function triggerFields(trigger, clearOthers) {
|
|
|
1488
1615
|
return {
|
|
1489
1616
|
timezone: trigger.timezone,
|
|
1490
1617
|
rrule: trigger.start === "repeat" ? trigger.rrule.trim() : none,
|
|
1491
|
-
run_at: trigger.start === "once" ?
|
|
1618
|
+
run_at: trigger.start === "once" ? chunkDDYXFALG_cjs.localInputToIso(trigger.runAt) : none,
|
|
1492
1619
|
event_kind: trigger.start === "event" ? trigger.eventKind.trim() : none,
|
|
1493
1620
|
// A step signal is `workflow_signal` narrowed to one signal name.
|
|
1494
1621
|
event_filter: filter ?? none,
|
|
@@ -1504,7 +1631,7 @@ function plan(value, options) {
|
|
|
1504
1631
|
criteria: [],
|
|
1505
1632
|
max_passes: 3,
|
|
1506
1633
|
documents: [],
|
|
1507
|
-
steps:
|
|
1634
|
+
steps: chunk3US5OIDQ_cjs.toPlanSteps(value.workflow, options)
|
|
1508
1635
|
};
|
|
1509
1636
|
}
|
|
1510
1637
|
function builderToWorkflowRequest(value, workspaceId, options = {}) {
|
|
@@ -1539,7 +1666,7 @@ function builderToWorkflowUpdate(value, options = {}) {
|
|
|
1539
1666
|
}
|
|
1540
1667
|
function workflowRecordToBuilder(record) {
|
|
1541
1668
|
const planned = record.plan?.steps ?? [];
|
|
1542
|
-
const steps = planned.length ?
|
|
1669
|
+
const steps = planned.length ? chunk3US5OIDQ_cjs.fromPlanSteps(planned) : record.prompt || record.skill_ref ? [
|
|
1543
1670
|
{
|
|
1544
1671
|
id: "work",
|
|
1545
1672
|
kind: "agent",
|
|
@@ -1547,7 +1674,7 @@ function workflowRecordToBuilder(record) {
|
|
|
1547
1674
|
...record.skill_ref ? { workflow: record.skill_ref } : { run: { kind: "prompt", promptTemplate: record.prompt } }
|
|
1548
1675
|
}
|
|
1549
1676
|
] : [];
|
|
1550
|
-
const when =
|
|
1677
|
+
const when = chunkDDYXFALG_cjs.workflowWhen(record);
|
|
1551
1678
|
return {
|
|
1552
1679
|
workflow: {
|
|
1553
1680
|
id: record.external_id,
|
|
@@ -1556,12 +1683,12 @@ function workflowRecordToBuilder(record) {
|
|
|
1556
1683
|
inputs: [],
|
|
1557
1684
|
landing: "chat",
|
|
1558
1685
|
schedulable: false,
|
|
1559
|
-
run: { kind: "steps", steps, layout:
|
|
1686
|
+
run: { kind: "steps", steps, layout: chunk3US5OIDQ_cjs.layoutFromPlanSteps(planned ?? []) }
|
|
1560
1687
|
},
|
|
1561
1688
|
trigger: {
|
|
1562
1689
|
...DEFAULT_WORKFLOW_TRIGGER,
|
|
1563
1690
|
start: when === "now" ? "manual" : when,
|
|
1564
|
-
runAt:
|
|
1691
|
+
runAt: chunkDDYXFALG_cjs.isoToLocalInput(record.run_at),
|
|
1565
1692
|
rrule: record.rrule ?? "",
|
|
1566
1693
|
timezone: record.timezone || DEFAULT_WORKFLOW_TRIGGER.timezone,
|
|
1567
1694
|
eventKind: record.event_kind ?? "",
|
|
@@ -1617,7 +1744,7 @@ function triggerSummary(trigger, options = {}) {
|
|
|
1617
1744
|
case "once":
|
|
1618
1745
|
return trigger.runAt ? new Date(trigger.runAt).toLocaleString() : l.starts.once;
|
|
1619
1746
|
case "repeat":
|
|
1620
|
-
return trigger.rrule ?
|
|
1747
|
+
return trigger.rrule ? chunkDDYXFALG_cjs.describeRRule(trigger.rrule) : l.starts.repeat;
|
|
1621
1748
|
case "event":
|
|
1622
1749
|
if (isSignalTrigger(trigger))
|
|
1623
1750
|
return trigger.signal ? l.signalSummary.replace("{signal}", trigger.signal) : l.stepSignals;
|
|
@@ -1676,7 +1803,7 @@ function TriggerInspector({
|
|
|
1676
1803
|
}
|
|
1677
1804
|
)
|
|
1678
1805
|
] }),
|
|
1679
|
-
trigger.start === "repeat" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
1806
|
+
trigger.start === "repeat" && /* @__PURE__ */ jsxRuntime.jsx(chunkDDYXFALG_cjs.RecurrenceBuilder, { rrule: trigger.rrule, onChange: (rrule) => set({ rrule }) }),
|
|
1680
1807
|
trigger.start === "event" && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
|
|
1681
1808
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Label, { className: "text-xs", children: l.event }),
|
|
1682
1809
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -1728,7 +1855,7 @@ function TriggerInspector({
|
|
|
1728
1855
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
|
|
1729
1856
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Label, { className: "text-xs", children: l.agent }),
|
|
1730
1857
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1731
|
-
|
|
1858
|
+
chunkDDYXFALG_cjs.AgentSelect,
|
|
1732
1859
|
{
|
|
1733
1860
|
agents,
|
|
1734
1861
|
value: trigger.agentId,
|
|
@@ -2038,12 +2165,12 @@ function WorkflowCanvas({
|
|
|
2038
2165
|
testId = "workflow-canvas"
|
|
2039
2166
|
}) {
|
|
2040
2167
|
const l = react.useMemo(() => ({ ...DEFAULT_WORKFLOW_CANVAS_LABELS, ...labels }), [labels]);
|
|
2041
|
-
const steps =
|
|
2168
|
+
const steps = chunk3US5OIDQ_cjs.workflowSteps(workflow);
|
|
2042
2169
|
const editable = !!onChange;
|
|
2043
2170
|
const built = react.useMemo(() => {
|
|
2044
2171
|
const layout = layoutWithDefaults(workflow);
|
|
2045
|
-
const all =
|
|
2046
|
-
const roots = all.filter((s) =>
|
|
2172
|
+
const all = chunk3US5OIDQ_cjs.workflowSteps(workflow);
|
|
2173
|
+
const roots = all.filter((s) => chunk3US5OIDQ_cjs.stepDependencies(all, s.id).length === 0);
|
|
2047
2174
|
const triggerNode = trigger ? [
|
|
2048
2175
|
{
|
|
2049
2176
|
id: TRIGGER_NODE,
|
|
@@ -2092,7 +2219,7 @@ function WorkflowCanvas({
|
|
|
2092
2219
|
react.useEffect(() => setNodes(built), [built]);
|
|
2093
2220
|
const edges = react.useMemo(
|
|
2094
2221
|
() => steps.flatMap((s) => {
|
|
2095
|
-
const deps =
|
|
2222
|
+
const deps = chunk3US5OIDQ_cjs.stepDependencies(steps, s.id);
|
|
2096
2223
|
const from = deps.length ? deps : trigger ? [TRIGGER_NODE] : [];
|
|
2097
2224
|
return from.map((d) => ({
|
|
2098
2225
|
id: `${d}->${s.id}`,
|
|
@@ -2343,12 +2470,12 @@ function WorkflowBuilder({
|
|
|
2343
2470
|
const [mode, setMode] = react.useState("design");
|
|
2344
2471
|
const [adding, setAdding] = react.useState(false);
|
|
2345
2472
|
const { workflow, trigger } = value;
|
|
2346
|
-
const steps =
|
|
2347
|
-
const problems =
|
|
2348
|
-
const missing =
|
|
2473
|
+
const steps = chunk3US5OIDQ_cjs.workflowSteps(workflow);
|
|
2474
|
+
const problems = chunk3US5OIDQ_cjs.validateWorkflowGraph(steps);
|
|
2475
|
+
const missing = chunk3US5OIDQ_cjs.stepConfigProblems(steps);
|
|
2349
2476
|
const nameOf = (id) => people.find((p) => p.value === id)?.label;
|
|
2350
|
-
const fields =
|
|
2351
|
-
const assigneeOf = (step) =>
|
|
2477
|
+
const fields = chunk3US5OIDQ_cjs.runFields(workflow);
|
|
2478
|
+
const assigneeOf = (step) => chunk3US5OIDQ_cjs.canAssign(step) ? chunk3US5OIDQ_cjs.assigneeName(step.assignee, { nameOf, fields }) : void 0;
|
|
2352
2479
|
const titles = react.useMemo(() => new Map(workflows.map((w) => [w.id, w.title])), [workflows]);
|
|
2353
2480
|
const setWorkflow = (next) => onChange({ ...value, workflow: next });
|
|
2354
2481
|
const addAfter = (from, kind) => {
|
|
@@ -2579,13 +2706,13 @@ function WorkflowPreview({
|
|
|
2579
2706
|
renderIcon,
|
|
2580
2707
|
testId
|
|
2581
2708
|
}) {
|
|
2582
|
-
const run =
|
|
2709
|
+
const run = chunkDDYXFALG_cjs.useWorkflowPreview(workflow, {
|
|
2583
2710
|
resolveWorkflow: (id) => workflows.find((w) => w.id === id),
|
|
2584
2711
|
compose,
|
|
2585
2712
|
answer
|
|
2586
2713
|
});
|
|
2587
2714
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2588
|
-
|
|
2715
|
+
chunk3US5OIDQ_cjs.WorkflowRunner,
|
|
2589
2716
|
{
|
|
2590
2717
|
workflow,
|
|
2591
2718
|
run,
|
|
@@ -2673,7 +2800,7 @@ function ConnectedWorkflowBuilder({
|
|
|
2673
2800
|
() => [
|
|
2674
2801
|
...hostWorkflows,
|
|
2675
2802
|
...(skills.data ?? []).map(
|
|
2676
|
-
(s) =>
|
|
2803
|
+
(s) => chunk3US5OIDQ_cjs.skillToWorkflow({
|
|
2677
2804
|
name: s.name,
|
|
2678
2805
|
slug: s.slug,
|
|
2679
2806
|
description: s.description,
|
|
@@ -2689,7 +2816,7 @@ function ConnectedWorkflowBuilder({
|
|
|
2689
2816
|
}));
|
|
2690
2817
|
const tasks = (conversations.data ?? []).filter((c) => c.status && c.status !== "done").map((c) => ({ value: c.external_id, label: c.title || c.external_id }));
|
|
2691
2818
|
const options = { resolveWorkflow: (wid) => workflows.find((w) => w.id === wid), compose };
|
|
2692
|
-
const problem = triggerProblem(value.trigger) ?? (
|
|
2819
|
+
const problem = triggerProblem(value.trigger) ?? (chunk3US5OIDQ_cjs.validateWorkflowGraph(chunk3US5OIDQ_cjs.workflowSteps(value.workflow)).length || chunk3US5OIDQ_cjs.stepConfigProblems(chunk3US5OIDQ_cjs.workflowSteps(value.workflow)).length ? "graph" : null);
|
|
2693
2820
|
const busy = !!pending || create.isPending || update.isPending || run.isPending;
|
|
2694
2821
|
const save = async () => {
|
|
2695
2822
|
if (!workspaceId) return void 0;
|
|
@@ -2775,6 +2902,7 @@ function ConnectedWorkflowBuilder({
|
|
|
2775
2902
|
|
|
2776
2903
|
exports.ConnectedWorkflowBuilder = ConnectedWorkflowBuilder;
|
|
2777
2904
|
exports.DEFAULT_CONNECTED_WORKFLOW_BUILDER_LABELS = DEFAULT_CONNECTED_WORKFLOW_BUILDER_LABELS;
|
|
2905
|
+
exports.DEFAULT_FIELD_OPTIONS_EDITOR_LABELS = DEFAULT_FIELD_OPTIONS_EDITOR_LABELS;
|
|
2778
2906
|
exports.DEFAULT_SIGNALS_EDITOR_LABELS = DEFAULT_SIGNALS_EDITOR_LABELS;
|
|
2779
2907
|
exports.DEFAULT_STEP_INSPECTOR_LABELS = DEFAULT_STEP_INSPECTOR_LABELS;
|
|
2780
2908
|
exports.DEFAULT_TRIGGER_INSPECTOR_LABELS = DEFAULT_TRIGGER_INSPECTOR_LABELS;
|
|
@@ -2782,6 +2910,7 @@ exports.DEFAULT_WORKFLOW_BUILDER_LABELS = DEFAULT_WORKFLOW_BUILDER_LABELS;
|
|
|
2782
2910
|
exports.DEFAULT_WORKFLOW_CANVAS_LABELS = DEFAULT_WORKFLOW_CANVAS_LABELS;
|
|
2783
2911
|
exports.DEFAULT_WORKFLOW_EVENT_KINDS = DEFAULT_WORKFLOW_EVENT_KINDS;
|
|
2784
2912
|
exports.DEFAULT_WORKFLOW_TRIGGER = DEFAULT_WORKFLOW_TRIGGER;
|
|
2913
|
+
exports.FieldOptionsEditor = FieldOptionsEditor;
|
|
2785
2914
|
exports.SignalsEditor = SignalsEditor;
|
|
2786
2915
|
exports.StepInspector = StepInspector;
|
|
2787
2916
|
exports.TRIGGER_NODE = TRIGGER_NODE;
|