@arbidocs/blocks 0.4.142 → 0.4.144
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 +435 -432
- package/dist/agents/index.js +7 -4
- package/dist/chat/index.cjs +139 -138
- package/dist/chat/index.js +4 -3
- package/dist/{chunk-N5X37J3D.js → chunk-2FJMTZNJ.js} +8 -5
- package/dist/chunk-2FJMTZNJ.js.map +1 -0
- package/dist/chunk-33ZOUJXA.js +561 -0
- package/dist/chunk-33ZOUJXA.js.map +1 -0
- package/dist/{chunk-S24XEVPS.cjs → chunk-464YPRAE.cjs} +33 -2
- package/dist/chunk-464YPRAE.cjs.map +1 -0
- package/dist/{chunk-7YLJHTDC.cjs → chunk-5A2QQAF5.cjs} +11 -11
- package/dist/{chunk-7YLJHTDC.cjs.map → chunk-5A2QQAF5.cjs.map} +1 -1
- package/dist/chunk-76L6LOP3.cjs +308 -0
- package/dist/chunk-76L6LOP3.cjs.map +1 -0
- package/dist/{chunk-FXG7TFAG.js → chunk-7NGAWGA3.js} +3 -3
- package/dist/{chunk-FXG7TFAG.js.map → chunk-7NGAWGA3.js.map} +1 -1
- package/dist/chunk-A6J2IBUG.js +1602 -0
- package/dist/chunk-A6J2IBUG.js.map +1 -0
- package/dist/{chunk-DPGFEMVT.cjs → chunk-ABUO6PIQ.cjs} +51 -1659
- package/dist/chunk-ABUO6PIQ.cjs.map +1 -0
- package/dist/chunk-AOSUHWIL.js +98 -0
- package/dist/chunk-AOSUHWIL.js.map +1 -0
- package/dist/{chunk-GBS6QVGS.cjs → chunk-BUWBXJ2N.cjs} +5 -5
- package/dist/{chunk-GBS6QVGS.cjs.map → chunk-BUWBXJ2N.cjs.map} +1 -1
- package/dist/chunk-CQCC7LE7.js +210 -0
- package/dist/chunk-CQCC7LE7.js.map +1 -0
- package/dist/{chunk-UGCKUXRV.js → chunk-CSI2B2H5.js} +3 -3
- package/dist/{chunk-UGCKUXRV.js.map → chunk-CSI2B2H5.js.map} +1 -1
- package/dist/{chunk-JO3EMZ4X.js → chunk-GWSGIZQ5.js} +3 -3
- package/dist/{chunk-JO3EMZ4X.js.map → chunk-GWSGIZQ5.js.map} +1 -1
- package/dist/{chunk-OWCEQKAR.cjs → chunk-JSTKEZBS.cjs} +21 -318
- package/dist/chunk-JSTKEZBS.cjs.map +1 -0
- package/dist/{chunk-CKCBBYTA.js → chunk-KSHKTOY2.js} +5 -205
- package/dist/chunk-KSHKTOY2.js.map +1 -0
- package/dist/chunk-LJJJ6CYH.cjs +62 -0
- package/dist/chunk-LJJJ6CYH.cjs.map +1 -0
- package/dist/chunk-MHFF5N65.cjs +101 -0
- package/dist/chunk-MHFF5N65.cjs.map +1 -0
- package/dist/{chunk-GYAUJ4KT.js → chunk-MTSKK3BN.js} +32 -3
- package/dist/chunk-MTSKK3BN.js.map +1 -0
- package/dist/chunk-O2ODDTMA.cjs +1627 -0
- package/dist/chunk-O2ODDTMA.cjs.map +1 -0
- package/dist/{chunk-3BFGL2JL.cjs → chunk-ODRHHWHY.cjs} +4 -4
- package/dist/{chunk-3BFGL2JL.cjs.map → chunk-ODRHHWHY.cjs.map} +1 -1
- package/dist/{chunk-Y5KTM3V5.js → chunk-PDKM27DF.js} +17 -295
- package/dist/chunk-PDKM27DF.js.map +1 -0
- package/dist/{chunk-OAL3B2ZU.cjs → chunk-PLJ7PHWU.cjs} +5 -5
- package/dist/{chunk-OAL3B2ZU.cjs.map → chunk-PLJ7PHWU.cjs.map} +1 -1
- package/dist/chunk-RA3ZJ45L.cjs +574 -0
- package/dist/chunk-RA3ZJ45L.cjs.map +1 -0
- package/dist/chunk-RFIBUWLF.cjs +232 -0
- package/dist/chunk-RFIBUWLF.cjs.map +1 -0
- package/dist/{chunk-MIDXCYZB.cjs → chunk-RQ2Y7USX.cjs} +15 -235
- package/dist/chunk-RQ2Y7USX.cjs.map +1 -0
- package/dist/chunk-SV65E4QW.js +58 -0
- package/dist/chunk-SV65E4QW.js.map +1 -0
- package/dist/chunk-TZGBRLPK.js +288 -0
- package/dist/chunk-TZGBRLPK.js.map +1 -0
- package/dist/{chunk-PROK33G6.js → chunk-X3TGXEFS.js} +11 -1596
- package/dist/chunk-X3TGXEFS.js.map +1 -0
- package/dist/{chunk-HIJUXAWS.cjs → chunk-XGZX22ET.cjs} +77 -74
- package/dist/chunk-XGZX22ET.cjs.map +1 -0
- package/dist/{chunk-5BXEYYH6.js → chunk-ZM26YEOT.js} +3 -3
- package/dist/{chunk-5BXEYYH6.js.map → chunk-ZM26YEOT.js.map} +1 -1
- package/dist/connect/docx.cjs +35 -6
- package/dist/connect/docx.cjs.map +1 -1
- package/dist/connect/docx.d.ts +9 -2
- package/dist/connect/docx.js +29 -5
- package/dist/connect/docx.js.map +1 -1
- package/dist/connect/index.cjs +126 -339
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/index.d.ts +1 -0
- package/dist/connect/index.js +15 -260
- package/dist/connect/index.js.map +1 -1
- package/dist/connection/docx/ConnectedNativeDocxComparison.d.ts +5 -0
- package/dist/connection/docx/ConnectedNativeDocxEditor.d.ts +16 -0
- package/dist/connection/{ConnectedStreamedWordArtifact.d.ts → docx/ConnectedStreamedWordArtifact.d.ts} +1 -1
- package/dist/connection/docx/support.d.ts +27 -0
- package/dist/connection/docx/useConnectedDocxReferences.d.ts +2 -0
- package/dist/connection/docx/useConnectedHouseTemplate.d.ts +2 -0
- package/dist/docx/index.cjs +17 -63
- package/dist/docx/index.cjs.map +1 -1
- package/dist/docx/index.d.ts +1 -0
- package/dist/docx/index.js +2 -64
- package/dist/docx/index.js.map +1 -1
- package/dist/docx/template/candidates.d.ts +16 -0
- package/dist/index.cjs +625 -609
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +13 -9
- package/dist/index.js.map +1 -1
- package/dist/lib/deep-link.d.ts +46 -0
- package/dist/settings/index.cjs +10 -9
- 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/studio/index.cjs +5 -4
- package/dist/studio/index.cjs.map +1 -1
- package/dist/studio/index.js +4 -3
- package/dist/studio/index.js.map +1 -1
- package/dist/workflow-canvas/index.cjs +58 -55
- package/dist/workflow-canvas/index.cjs.map +1 -1
- package/dist/workflow-canvas/index.js +7 -4
- package/dist/workflow-canvas/index.js.map +1 -1
- package/node_modules/@arbidocs/coedit/package.json +1 -1
- package/package.json +4 -4
- package/dist/chunk-4TR5QCCX.cjs +0 -43
- package/dist/chunk-4TR5QCCX.cjs.map +0 -1
- package/dist/chunk-7NDW4KF4.cjs +0 -112
- package/dist/chunk-7NDW4KF4.cjs.map +0 -1
- package/dist/chunk-CKCBBYTA.js.map +0 -1
- package/dist/chunk-DPGFEMVT.cjs.map +0 -1
- package/dist/chunk-ETXYVO6E.js +0 -109
- package/dist/chunk-ETXYVO6E.js.map +0 -1
- package/dist/chunk-GYAUJ4KT.js.map +0 -1
- package/dist/chunk-HIJUXAWS.cjs.map +0 -1
- package/dist/chunk-MCKOZACC.js +0 -41
- package/dist/chunk-MCKOZACC.js.map +0 -1
- package/dist/chunk-MIDXCYZB.cjs.map +0 -1
- package/dist/chunk-N5X37J3D.js.map +0 -1
- package/dist/chunk-OWCEQKAR.cjs.map +0 -1
- package/dist/chunk-PROK33G6.js.map +0 -1
- package/dist/chunk-S24XEVPS.cjs.map +0 -1
- package/dist/chunk-Y5KTM3V5.js.map +0 -1
- package/dist/connection/ConnectedNativeDocxEditor.d.ts +0 -6
|
@@ -1,926 +1,23 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
+
var chunkO2ODDTMA_cjs = require('./chunk-O2ODDTMA.cjs');
|
|
4
5
|
var chunkWS5EX7DN_cjs = require('./chunk-WS5EX7DN.cjs');
|
|
5
6
|
var chunkAHDJXIUB_cjs = require('./chunk-AHDJXIUB.cjs');
|
|
6
|
-
var chunkMIDXCYZB_cjs = require('./chunk-MIDXCYZB.cjs');
|
|
7
|
-
var chunkZW6FPIFC_cjs = require('./chunk-ZW6FPIFC.cjs');
|
|
8
7
|
var chunkDETZZBG2_cjs = require('./chunk-DETZZBG2.cjs');
|
|
9
8
|
var chunkR26BK7YL_cjs = require('./chunk-R26BK7YL.cjs');
|
|
10
|
-
var chunkV4ISCZJ7_cjs = require('./chunk-V4ISCZJ7.cjs');
|
|
11
|
-
var chunk2EI7NCUA_cjs = require('./chunk-2EI7NCUA.cjs');
|
|
12
9
|
var chunkC2CWWEHO_cjs = require('./chunk-C2CWWEHO.cjs');
|
|
13
10
|
var chunk7RGLTF76_cjs = require('./chunk-7RGLTF76.cjs');
|
|
14
|
-
var
|
|
15
|
-
var
|
|
11
|
+
var chunkJSTKEZBS_cjs = require('./chunk-JSTKEZBS.cjs');
|
|
12
|
+
var chunk76L6LOP3_cjs = require('./chunk-76L6LOP3.cjs');
|
|
16
13
|
var chunkMHVNT4J3_cjs = require('./chunk-MHVNT4J3.cjs');
|
|
17
14
|
var chunkC4WSHRR6_cjs = require('./chunk-C4WSHRR6.cjs');
|
|
18
|
-
var chunkKDG6FER6_cjs = require('./chunk-KDG6FER6.cjs');
|
|
19
15
|
var react = require('react');
|
|
20
16
|
var lucideReact = require('lucide-react');
|
|
21
17
|
var ui = require('@arbidocs/react/ui');
|
|
22
18
|
var jsxRuntime = require('react/jsx-runtime');
|
|
23
19
|
var fflate = require('fflate');
|
|
24
20
|
|
|
25
|
-
var DEFAULT_SCHEMA_FORM_LABELS = {
|
|
26
|
-
optional: "(optional)",
|
|
27
|
-
advanced: "More options",
|
|
28
|
-
errors: {
|
|
29
|
-
required: "This is needed to continue",
|
|
30
|
-
min: "Too small",
|
|
31
|
-
max: "Too large",
|
|
32
|
-
number: "Enter a number"
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
var TILE_MAX = 4;
|
|
36
|
-
function FieldControl({
|
|
37
|
-
field,
|
|
38
|
-
value,
|
|
39
|
-
error,
|
|
40
|
-
onChange,
|
|
41
|
-
l,
|
|
42
|
-
idFor,
|
|
43
|
-
renderScope,
|
|
44
|
-
renderDocuments,
|
|
45
|
-
renderIcon,
|
|
46
|
-
onEnterSubmit,
|
|
47
|
-
people
|
|
48
|
-
}) {
|
|
49
|
-
const id = `${idFor()}-control`;
|
|
50
|
-
const testId = idFor();
|
|
51
|
-
switch (field.type) {
|
|
52
|
-
case "text":
|
|
53
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
54
|
-
ui.Input,
|
|
55
|
-
{
|
|
56
|
-
id,
|
|
57
|
-
"data-testid": testId,
|
|
58
|
-
value: String(value ?? ""),
|
|
59
|
-
placeholder: field.placeholder,
|
|
60
|
-
"aria-required": field.required || void 0,
|
|
61
|
-
"aria-invalid": error ? true : void 0,
|
|
62
|
-
"aria-describedby": error ? idFor("error") : void 0,
|
|
63
|
-
onChange: (e) => onChange(e.target.value)
|
|
64
|
-
}
|
|
65
|
-
);
|
|
66
|
-
case "longtext":
|
|
67
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
68
|
-
ui.Textarea,
|
|
69
|
-
{
|
|
70
|
-
id,
|
|
71
|
-
"data-testid": testId,
|
|
72
|
-
value: String(value ?? ""),
|
|
73
|
-
placeholder: field.placeholder,
|
|
74
|
-
"aria-required": field.required || void 0,
|
|
75
|
-
"aria-invalid": error ? true : void 0,
|
|
76
|
-
"aria-describedby": error ? idFor("error") : void 0,
|
|
77
|
-
className: "min-h-[96px]",
|
|
78
|
-
onChange: (e) => onChange(e.target.value),
|
|
79
|
-
onKeyDown: (e) => {
|
|
80
|
-
if (onEnterSubmit && e.key === "Enter" && !e.shiftKey && !e.nativeEvent.isComposing) {
|
|
81
|
-
e.preventDefault();
|
|
82
|
-
onEnterSubmit();
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
);
|
|
87
|
-
case "number":
|
|
88
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
89
|
-
ui.Input,
|
|
90
|
-
{
|
|
91
|
-
id,
|
|
92
|
-
"data-testid": testId,
|
|
93
|
-
type: "number",
|
|
94
|
-
inputMode: "decimal",
|
|
95
|
-
min: field.min,
|
|
96
|
-
max: field.max,
|
|
97
|
-
value: value === void 0 ? "" : String(value),
|
|
98
|
-
placeholder: field.placeholder,
|
|
99
|
-
"aria-invalid": error ? true : void 0,
|
|
100
|
-
"aria-describedby": error ? idFor("error") : void 0,
|
|
101
|
-
onChange: (e) => onChange(e.target.value === "" ? "" : Number(e.target.value))
|
|
102
|
-
}
|
|
103
|
-
);
|
|
104
|
-
case "date":
|
|
105
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
106
|
-
ui.Input,
|
|
107
|
-
{
|
|
108
|
-
id,
|
|
109
|
-
"data-testid": testId,
|
|
110
|
-
type: "date",
|
|
111
|
-
value: String(value ?? ""),
|
|
112
|
-
"aria-invalid": error ? true : void 0,
|
|
113
|
-
"aria-describedby": error ? idFor("error") : void 0,
|
|
114
|
-
onChange: (e) => onChange(e.target.value)
|
|
115
|
-
}
|
|
116
|
-
);
|
|
117
|
-
case "boolean":
|
|
118
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
119
|
-
ui.Switch,
|
|
120
|
-
{
|
|
121
|
-
id,
|
|
122
|
-
"data-testid": testId,
|
|
123
|
-
checked: Boolean(value),
|
|
124
|
-
onCheckedChange: (checked) => onChange(checked)
|
|
125
|
-
}
|
|
126
|
-
);
|
|
127
|
-
case "select": {
|
|
128
|
-
const options = field.options ?? [];
|
|
129
|
-
if (options.length > 0 && options.length <= TILE_MAX) {
|
|
130
|
-
const compact2 = options.every((o) => !o.icon && !o.description);
|
|
131
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
132
|
-
"div",
|
|
133
|
-
{
|
|
134
|
-
role: "radiogroup",
|
|
135
|
-
"aria-label": field.label,
|
|
136
|
-
className: "flex flex-wrap gap-2",
|
|
137
|
-
"data-testid": testId,
|
|
138
|
-
children: options.map((option) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
139
|
-
ChoiceTile,
|
|
140
|
-
{
|
|
141
|
-
option,
|
|
142
|
-
selected: value === option.value,
|
|
143
|
-
compact: compact2,
|
|
144
|
-
renderIcon,
|
|
145
|
-
testId: chunkMHVNT4J3_cjs.prefixedTestId(testId, option.value, {
|
|
146
|
-
testId: `workflow-field-${field.name}-${option.value}`
|
|
147
|
-
}),
|
|
148
|
-
onSelect: () => onChange(option.value)
|
|
149
|
-
},
|
|
150
|
-
option.value
|
|
151
|
-
))
|
|
152
|
-
}
|
|
153
|
-
);
|
|
154
|
-
}
|
|
155
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(ui.Select, { value: String(value ?? ""), onValueChange: (v) => onChange(v), children: [
|
|
156
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.SelectTrigger, { id, "data-testid": testId, className: "pointer-coarse:min-h-11", children: /* @__PURE__ */ jsxRuntime.jsx(ui.SelectValue, { placeholder: field.placeholder }) }),
|
|
157
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.SelectContent, { children: options.map((o) => /* @__PURE__ */ jsxRuntime.jsx(ui.SelectItem, { value: o.value, children: o.label }, o.value)) })
|
|
158
|
-
] });
|
|
159
|
-
}
|
|
160
|
-
case "scope": {
|
|
161
|
-
const scope = chunkOWCEQKAR_cjs.isWorkflowScope(value) ? value : { folders: [], labels: [] };
|
|
162
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-testid": testId, children: renderScope?.(field, scope, onChange) });
|
|
163
|
-
}
|
|
164
|
-
case "documents": {
|
|
165
|
-
const picked = chunkOWCEQKAR_cjs.isWorkflowScope(value) ? value : { folders: [], labels: [], documents: [] };
|
|
166
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-testid": testId, children: renderDocuments?.(field, picked, onChange) });
|
|
167
|
-
}
|
|
168
|
-
case "person":
|
|
169
|
-
return people?.length ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
170
|
-
"select",
|
|
171
|
-
{
|
|
172
|
-
id,
|
|
173
|
-
"data-testid": testId,
|
|
174
|
-
value: String(value ?? ""),
|
|
175
|
-
"aria-required": field.required || void 0,
|
|
176
|
-
"aria-invalid": error ? true : void 0,
|
|
177
|
-
onChange: (e) => onChange(e.target.value),
|
|
178
|
-
className: "flex h-9 w-full rounded-md border border-input bg-background px-2 text-sm shadow-sm",
|
|
179
|
-
children: [
|
|
180
|
-
/* @__PURE__ */ jsxRuntime.jsx("option", { value: "", children: field.placeholder ?? "" }),
|
|
181
|
-
people.map((p) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: p.value, children: p.label }, p.value))
|
|
182
|
-
]
|
|
183
|
-
}
|
|
184
|
-
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
185
|
-
ui.Input,
|
|
186
|
-
{
|
|
187
|
-
id,
|
|
188
|
-
"data-testid": testId,
|
|
189
|
-
value: String(value ?? ""),
|
|
190
|
-
placeholder: field.placeholder ?? "usr-\u2026",
|
|
191
|
-
"aria-required": field.required || void 0,
|
|
192
|
-
"aria-invalid": error ? true : void 0,
|
|
193
|
-
onChange: (e) => onChange(e.target.value)
|
|
194
|
-
}
|
|
195
|
-
);
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
function ChoiceTile({
|
|
199
|
-
option,
|
|
200
|
-
selected,
|
|
201
|
-
compact: compact2,
|
|
202
|
-
renderIcon,
|
|
203
|
-
testId,
|
|
204
|
-
onSelect
|
|
205
|
-
}) {
|
|
206
|
-
const tone = option.tone;
|
|
207
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
208
|
-
"button",
|
|
209
|
-
{
|
|
210
|
-
type: "button",
|
|
211
|
-
role: "radio",
|
|
212
|
-
"aria-checked": selected,
|
|
213
|
-
"data-testid": testId,
|
|
214
|
-
"data-tone": tone,
|
|
215
|
-
onClick: onSelect,
|
|
216
|
-
className: ui.cn(
|
|
217
|
-
// Sized to its label (flex-basis auto), growing to share the row, never wider than it.
|
|
218
|
-
"flex max-w-full min-w-[min(4rem,100%)] flex-auto flex-col items-center justify-center gap-1.5 rounded-lg border text-center transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
219
|
-
compact2 ? "min-h-9 px-3 py-1.5 pointer-coarse:min-h-11" : "min-h-24 p-3 pointer-coarse:min-h-28",
|
|
220
|
-
tone ? selected ? ui.cn(chunk32HW2Q33_cjs.TONE_SURFACE[tone], chunk32HW2Q33_cjs.TONE_SOLID_BORDER[tone]) : ui.cn(chunk32HW2Q33_cjs.TONE_BORDER[tone], "bg-card [&:hover]:bg-muted") : selected ? "border-primary bg-primary/10" : "border-border bg-card [&:hover]:border-primary [&:hover]:bg-muted"
|
|
221
|
-
),
|
|
222
|
-
children: [
|
|
223
|
-
option.icon && renderIcon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-muted-foreground", children: renderIcon(option.icon) }),
|
|
224
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
225
|
-
"span",
|
|
226
|
-
{
|
|
227
|
-
className: ui.cn(
|
|
228
|
-
"flex max-w-full items-center gap-1.5 text-sm font-medium",
|
|
229
|
-
tone && selected ? void 0 : "text-foreground"
|
|
230
|
-
),
|
|
231
|
-
children: [
|
|
232
|
-
selected ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { className: "size-3.5 shrink-0", "aria-hidden": true }) : tone && /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": true, className: ui.cn("size-2 shrink-0 rounded-full", chunk32HW2Q33_cjs.TONE_DOT[tone]) }),
|
|
233
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 break-words", children: option.label })
|
|
234
|
-
]
|
|
235
|
-
}
|
|
236
|
-
),
|
|
237
|
-
option.description && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "max-w-full text-xs break-words text-muted-foreground", children: option.description })
|
|
238
|
-
]
|
|
239
|
-
}
|
|
240
|
-
);
|
|
241
|
-
}
|
|
242
|
-
function FormField(props) {
|
|
243
|
-
const { field, error, l, idFor } = props;
|
|
244
|
-
const isBoolean = field.type === "boolean";
|
|
245
|
-
const showOptional = !field.required && field.type !== "boolean" && field.type !== "scope";
|
|
246
|
-
const label = /* @__PURE__ */ jsxRuntime.jsxs(
|
|
247
|
-
ui.Label,
|
|
248
|
-
{
|
|
249
|
-
htmlFor: `${idFor()}-control`,
|
|
250
|
-
className: isBoolean ? "cursor-pointer font-normal" : void 0,
|
|
251
|
-
children: [
|
|
252
|
-
field.label,
|
|
253
|
-
showOptional && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
254
|
-
" ",
|
|
255
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-normal text-muted-foreground", children: l.optional })
|
|
256
|
-
] })
|
|
257
|
-
]
|
|
258
|
-
}
|
|
259
|
-
);
|
|
260
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1.5", "data-slot": "schema-field", "data-field": field.name, children: [
|
|
261
|
-
isBoolean ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2.5 pointer-coarse:min-h-11", children: [
|
|
262
|
-
/* @__PURE__ */ jsxRuntime.jsx(FieldControl, { ...props }),
|
|
263
|
-
label
|
|
264
|
-
] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
265
|
-
field.type !== "scope" && label,
|
|
266
|
-
/* @__PURE__ */ jsxRuntime.jsx(FieldControl, { ...props })
|
|
267
|
-
] }),
|
|
268
|
-
field.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: field.description }),
|
|
269
|
-
error && /* @__PURE__ */ jsxRuntime.jsx(
|
|
270
|
-
"p",
|
|
271
|
-
{
|
|
272
|
-
id: idFor("error"),
|
|
273
|
-
role: "alert",
|
|
274
|
-
className: "text-xs text-destructive",
|
|
275
|
-
"data-testid": idFor("error"),
|
|
276
|
-
children: l.errors[error]
|
|
277
|
-
}
|
|
278
|
-
)
|
|
279
|
-
] });
|
|
280
|
-
}
|
|
281
|
-
function SchemaForm({
|
|
282
|
-
fields,
|
|
283
|
-
values,
|
|
284
|
-
onChange,
|
|
285
|
-
errors,
|
|
286
|
-
renderScope,
|
|
287
|
-
renderDocuments,
|
|
288
|
-
renderIcon,
|
|
289
|
-
onEnterSubmit,
|
|
290
|
-
people,
|
|
291
|
-
testIdPrefix,
|
|
292
|
-
labels,
|
|
293
|
-
className
|
|
294
|
-
}) {
|
|
295
|
-
const l = {
|
|
296
|
-
...DEFAULT_SCHEMA_FORM_LABELS,
|
|
297
|
-
...labels,
|
|
298
|
-
errors: { ...DEFAULT_SCHEMA_FORM_LABELS.errors, ...labels?.errors }
|
|
299
|
-
};
|
|
300
|
-
const [advancedOpen, setAdvancedOpen] = react.useState(false);
|
|
301
|
-
const common = fields.filter((f) => !f.advanced);
|
|
302
|
-
const advanced = fields.filter((f) => f.advanced);
|
|
303
|
-
const render = (field) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
304
|
-
FormField,
|
|
305
|
-
{
|
|
306
|
-
field,
|
|
307
|
-
value: values[field.name],
|
|
308
|
-
error: errors?.[field.name],
|
|
309
|
-
onChange: (v) => onChange(field.name, v),
|
|
310
|
-
l,
|
|
311
|
-
idFor: (suffix) => suffix ? `${chunkMHVNT4J3_cjs.testIdOr(testIdPrefix, { testId: "workflow-field" })}-${field.name}-${suffix}` : `${chunkMHVNT4J3_cjs.testIdOr(testIdPrefix, { testId: "workflow-field" })}-${field.name}`,
|
|
312
|
-
renderScope,
|
|
313
|
-
renderDocuments,
|
|
314
|
-
renderIcon,
|
|
315
|
-
onEnterSubmit,
|
|
316
|
-
people
|
|
317
|
-
},
|
|
318
|
-
field.name
|
|
319
|
-
);
|
|
320
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ui.cn("flex flex-col gap-4", className), "data-slot": "schema-form", children: [
|
|
321
|
-
common.map(render),
|
|
322
|
-
advanced.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
323
|
-
chunkWS5EX7DN_cjs.FoldSection,
|
|
324
|
-
{
|
|
325
|
-
label: l.advanced,
|
|
326
|
-
open: advancedOpen,
|
|
327
|
-
onOpenChange: setAdvancedOpen,
|
|
328
|
-
testId: `${chunkMHVNT4J3_cjs.testIdOr(testIdPrefix, { testId: "workflow-field" })}-advanced-toggle`,
|
|
329
|
-
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-4", children: advanced.map(render) })
|
|
330
|
-
}
|
|
331
|
-
)
|
|
332
|
-
] });
|
|
333
|
-
}
|
|
334
|
-
var DEFAULT_AGENT_SELECT_LABELS = {
|
|
335
|
-
label: "Run as",
|
|
336
|
-
myAssistant: "My assistant"
|
|
337
|
-
};
|
|
338
|
-
var ME = "__me__";
|
|
339
|
-
function AgentSelect({
|
|
340
|
-
agents,
|
|
341
|
-
value,
|
|
342
|
-
defaultValue = "",
|
|
343
|
-
onValueChange,
|
|
344
|
-
hideLabel,
|
|
345
|
-
disabled,
|
|
346
|
-
className,
|
|
347
|
-
labels,
|
|
348
|
-
testId,
|
|
349
|
-
optionTestId
|
|
350
|
-
}) {
|
|
351
|
-
const l = { ...DEFAULT_AGENT_SELECT_LABELS, ...labels };
|
|
352
|
-
const triggerId = react.useId();
|
|
353
|
-
const [current, setCurrent] = chunkAHDJXIUB_cjs.useControllableState(value, defaultValue, onValueChange);
|
|
354
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ui.cn("flex flex-col gap-1.5", className), "data-slot": "agent-select", children: [
|
|
355
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Label, { htmlFor: triggerId, className: hideLabel ? "sr-only" : void 0, children: l.label }),
|
|
356
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
357
|
-
ui.Select,
|
|
358
|
-
{
|
|
359
|
-
value: current === "" ? ME : current,
|
|
360
|
-
onValueChange: (v) => setCurrent(v === ME ? "" : v),
|
|
361
|
-
disabled,
|
|
362
|
-
children: [
|
|
363
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
364
|
-
ui.SelectTrigger,
|
|
365
|
-
{
|
|
366
|
-
id: triggerId,
|
|
367
|
-
"data-testid": chunkMHVNT4J3_cjs.testIdOr(testId, { testId: "agent-select" }),
|
|
368
|
-
className: "pointer-coarse:min-h-11",
|
|
369
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(ui.SelectValue, {})
|
|
370
|
-
}
|
|
371
|
-
),
|
|
372
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.SelectContent, { children: [
|
|
373
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
374
|
-
ui.SelectItem,
|
|
375
|
-
{
|
|
376
|
-
value: ME,
|
|
377
|
-
"data-testid": chunkMHVNT4J3_cjs.prefixedTestId(optionTestId, "me", {
|
|
378
|
-
testId: "agent-select-option-me"
|
|
379
|
-
}),
|
|
380
|
-
children: l.myAssistant
|
|
381
|
-
}
|
|
382
|
-
),
|
|
383
|
-
agents.map((agent) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
384
|
-
ui.SelectItem,
|
|
385
|
-
{
|
|
386
|
-
value: agent.id,
|
|
387
|
-
"data-testid": chunkMHVNT4J3_cjs.prefixedTestId(optionTestId, agent.id, {
|
|
388
|
-
testId: `agent-select-option-${agent.id}`
|
|
389
|
-
}),
|
|
390
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-2", children: [
|
|
391
|
-
agent.avatar,
|
|
392
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children: agent.label }),
|
|
393
|
-
agent.description && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground", children: agent.description })
|
|
394
|
-
] })
|
|
395
|
-
},
|
|
396
|
-
agent.id
|
|
397
|
-
))
|
|
398
|
-
] })
|
|
399
|
-
]
|
|
400
|
-
}
|
|
401
|
-
)
|
|
402
|
-
] });
|
|
403
|
-
}
|
|
404
|
-
var DEFAULT_WORKFLOW_CONFIG_DIALOG_LABELS = {
|
|
405
|
-
start: "Start",
|
|
406
|
-
starting: "Starting\u2026",
|
|
407
|
-
addFilesReason: "This reads your files, and there is nothing to read yet.",
|
|
408
|
-
agentLabel: "Run as"
|
|
409
|
-
};
|
|
410
|
-
function WorkflowConfigDialog({
|
|
411
|
-
workflow,
|
|
412
|
-
open,
|
|
413
|
-
onOpenChange,
|
|
414
|
-
onLaunch,
|
|
415
|
-
initialInputs,
|
|
416
|
-
inputs: inputsProp,
|
|
417
|
-
onInputsChange,
|
|
418
|
-
scopeSource,
|
|
419
|
-
renderScope,
|
|
420
|
-
renderDocuments,
|
|
421
|
-
renderIcon,
|
|
422
|
-
addFilesAction,
|
|
423
|
-
agents,
|
|
424
|
-
agentId: agentIdProp,
|
|
425
|
-
onAgentChange,
|
|
426
|
-
isLaunching,
|
|
427
|
-
submitLabel,
|
|
428
|
-
fieldPlaceholder,
|
|
429
|
-
renderNotice,
|
|
430
|
-
labels,
|
|
431
|
-
formLabels,
|
|
432
|
-
agentLabels,
|
|
433
|
-
testId,
|
|
434
|
-
startTestId,
|
|
435
|
-
className
|
|
436
|
-
}) {
|
|
437
|
-
const l = { ...DEFAULT_WORKFLOW_CONFIG_DIALOG_LABELS, ...labels };
|
|
438
|
-
const initialKey = JSON.stringify(initialInputs ?? {});
|
|
439
|
-
const seedKey = JSON.stringify({ ...chunkOWCEQKAR_cjs.defaultInputs(workflow), ...JSON.parse(initialKey) });
|
|
440
|
-
const seed = react.useMemo(() => JSON.parse(seedKey), [seedKey]);
|
|
441
|
-
const [inputs, setInputs] = chunkAHDJXIUB_cjs.useControllableState(inputsProp, seed, onInputsChange);
|
|
442
|
-
const [agentId, setAgentId] = chunkAHDJXIUB_cjs.useControllableState(
|
|
443
|
-
agentIdProp,
|
|
444
|
-
workflow.defaultAgentId ?? "",
|
|
445
|
-
onAgentChange
|
|
446
|
-
);
|
|
447
|
-
react.useEffect(() => {
|
|
448
|
-
if (open && inputsProp === void 0) setInputs(seed);
|
|
449
|
-
}, [open, seed]);
|
|
450
|
-
const setField = (name, value) => setInputs({ ...inputs, [name]: value });
|
|
451
|
-
const errors = chunkOWCEQKAR_cjs.validateInputs(workflow, inputs);
|
|
452
|
-
const valid = Object.keys(errors).length === 0;
|
|
453
|
-
const visibleErrors = Object.fromEntries(
|
|
454
|
-
Object.entries(errors).filter(([, e]) => e !== "required")
|
|
455
|
-
);
|
|
456
|
-
const scopeField = workflow.inputs.find((f) => f.type === "scope");
|
|
457
|
-
const rawScope = scopeField ? inputs[scopeField.name] : void 0;
|
|
458
|
-
const scopeValue = rawScope && typeof rawScope === "object" ? rawScope : { folders: [], labels: [] };
|
|
459
|
-
const matchedCount = scopeSource && scopeField ? scopeSource.countMatching(scopeValue) : null;
|
|
460
|
-
const noFiles = Boolean(workflow.requiresFiles && scopeSource && scopeSource.totalCount === 0);
|
|
461
|
-
const blockedByScope = matchedCount !== null && matchedCount === 0 && Boolean(workflow.requiresFiles);
|
|
462
|
-
const showAgent = workflow.run.kind === "prompt" && workflow.options?.agent !== false && agents !== void 0 && agents.length > 0;
|
|
463
|
-
const launch = (values) => {
|
|
464
|
-
Promise.resolve(onLaunch(chunkOWCEQKAR_cjs.buildLaunch(workflow, values, agentId))).catch(() => {
|
|
465
|
-
});
|
|
466
|
-
};
|
|
467
|
-
const submit = () => {
|
|
468
|
-
if (!valid || noFiles || blockedByScope || isLaunching) return;
|
|
469
|
-
launch(inputs);
|
|
470
|
-
};
|
|
471
|
-
const fields = react.useMemo(
|
|
472
|
-
() => workflow.inputs.map((f) => {
|
|
473
|
-
const placeholder = fieldPlaceholder?.(f, inputs, workflow);
|
|
474
|
-
return placeholder === void 0 ? f : { ...f, placeholder };
|
|
475
|
-
}),
|
|
476
|
-
[workflow, fieldPlaceholder, inputs]
|
|
477
|
-
);
|
|
478
|
-
const id = chunkMHVNT4J3_cjs.testIdOr(testId, { testId: "workflow-dialog" });
|
|
479
|
-
const formRef = react.useRef(null);
|
|
480
|
-
const firstField = workflow.inputs.find((f) => !f.advanced);
|
|
481
|
-
const focusPromptFirst = firstField?.type === "text" || firstField?.type === "longtext";
|
|
482
|
-
const defaultScopeRender = scopeSource ? (_field, value, onChange) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
483
|
-
chunkWS5EX7DN_cjs.ScopePicker,
|
|
484
|
-
{
|
|
485
|
-
folders: scopeSource.folders,
|
|
486
|
-
unfiledCount: scopeSource.unfiledCount,
|
|
487
|
-
labels: scopeSource.labels,
|
|
488
|
-
totalCount: scopeSource.totalCount,
|
|
489
|
-
matchedCount: scopeSource.countMatching(value),
|
|
490
|
-
scope: value,
|
|
491
|
-
onScopeChange: onChange
|
|
492
|
-
}
|
|
493
|
-
) : void 0;
|
|
494
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ui.Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
495
|
-
ui.DialogContent,
|
|
496
|
-
{
|
|
497
|
-
presentation: "sheet",
|
|
498
|
-
className: `max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-xl ${className ?? ""}`,
|
|
499
|
-
"data-testid": id,
|
|
500
|
-
"data-workflow": workflow.id,
|
|
501
|
-
onOpenAutoFocus: (event) => {
|
|
502
|
-
if (!focusPromptFirst || !firstField) return;
|
|
503
|
-
const control = formRef.current?.querySelector(
|
|
504
|
-
`[data-testid="${id}-field-${firstField.name}"]`
|
|
505
|
-
);
|
|
506
|
-
if (!control) return;
|
|
507
|
-
event.preventDefault();
|
|
508
|
-
control.focus();
|
|
509
|
-
if (control instanceof HTMLInputElement || control instanceof HTMLTextAreaElement) {
|
|
510
|
-
const end = control.value.length;
|
|
511
|
-
control.setSelectionRange(end, end);
|
|
512
|
-
}
|
|
513
|
-
},
|
|
514
|
-
children: [
|
|
515
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
516
|
-
chunkWS5EX7DN_cjs.QuickActionDialogHeader,
|
|
517
|
-
{
|
|
518
|
-
icon: workflow.icon && renderIcon ? renderIcon(workflow.icon) : null,
|
|
519
|
-
title: workflow.title,
|
|
520
|
-
description: workflow.details ?? workflow.description,
|
|
521
|
-
descriptionTestId: `${id}-description`
|
|
522
|
-
}
|
|
523
|
-
),
|
|
524
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
525
|
-
"form",
|
|
526
|
-
{
|
|
527
|
-
ref: formRef,
|
|
528
|
-
className: "mt-2 flex flex-col gap-4",
|
|
529
|
-
onSubmit: (event) => {
|
|
530
|
-
event.preventDefault();
|
|
531
|
-
submit();
|
|
532
|
-
},
|
|
533
|
-
children: noFiles ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
534
|
-
chunkWS5EX7DN_cjs.AddFilesFirst,
|
|
535
|
-
{
|
|
536
|
-
reason: l.addFilesReason,
|
|
537
|
-
action: addFilesAction,
|
|
538
|
-
testId: `${id}-empty-state`
|
|
539
|
-
}
|
|
540
|
-
) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
541
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
542
|
-
SchemaForm,
|
|
543
|
-
{
|
|
544
|
-
fields,
|
|
545
|
-
values: inputs,
|
|
546
|
-
onChange: setField,
|
|
547
|
-
errors: visibleErrors,
|
|
548
|
-
renderScope: renderScope ?? defaultScopeRender,
|
|
549
|
-
renderDocuments,
|
|
550
|
-
renderIcon,
|
|
551
|
-
labels: formLabels,
|
|
552
|
-
onEnterSubmit: submit,
|
|
553
|
-
testIdPrefix: `${id}-field`
|
|
554
|
-
}
|
|
555
|
-
),
|
|
556
|
-
renderNotice?.({ workflow, inputs }),
|
|
557
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
558
|
-
"div",
|
|
559
|
-
{
|
|
560
|
-
className: "flex flex-col gap-3 border-t border-border pt-3 sm:flex-row sm:items-end sm:justify-between",
|
|
561
|
-
"data-slot": "workflow-footer",
|
|
562
|
-
children: [
|
|
563
|
-
showAgent ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
564
|
-
AgentSelect,
|
|
565
|
-
{
|
|
566
|
-
agents: agents ?? [],
|
|
567
|
-
value: agentId,
|
|
568
|
-
onValueChange: setAgentId,
|
|
569
|
-
labels: { label: l.agentLabel, ...agentLabels },
|
|
570
|
-
testId: `${id}-agent`,
|
|
571
|
-
className: "sm:w-56"
|
|
572
|
-
}
|
|
573
|
-
) : /* @__PURE__ */ jsxRuntime.jsx("span", {}),
|
|
574
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
575
|
-
ui.Button,
|
|
576
|
-
{
|
|
577
|
-
type: "submit",
|
|
578
|
-
className: "gap-1.5 px-5 pointer-coarse:min-h-11",
|
|
579
|
-
disabled: !valid || blockedByScope || isLaunching,
|
|
580
|
-
"data-testid": chunkMHVNT4J3_cjs.testIdOr(startTestId, { testId: "workflow-start-button" }),
|
|
581
|
-
children: [
|
|
582
|
-
isLaunching ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "size-4 animate-spin" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Play, { className: "size-4" }),
|
|
583
|
-
isLaunching ? l.starting : submitLabel?.({ workflow, inputs, matchedCount }) ?? workflow.startLabel ?? l.start
|
|
584
|
-
]
|
|
585
|
-
}
|
|
586
|
-
)
|
|
587
|
-
]
|
|
588
|
-
}
|
|
589
|
-
)
|
|
590
|
-
] })
|
|
591
|
-
}
|
|
592
|
-
)
|
|
593
|
-
]
|
|
594
|
-
}
|
|
595
|
-
) });
|
|
596
|
-
}
|
|
597
|
-
function WorkflowLauncher({
|
|
598
|
-
workflows,
|
|
599
|
-
tileWorkflows,
|
|
600
|
-
onLaunch,
|
|
601
|
-
showTiles = true,
|
|
602
|
-
caption,
|
|
603
|
-
captionTestId,
|
|
604
|
-
tileTestId,
|
|
605
|
-
disabledReason,
|
|
606
|
-
activeId: activeIdProp,
|
|
607
|
-
onActiveIdChange,
|
|
608
|
-
initialInputsFor,
|
|
609
|
-
testId,
|
|
610
|
-
extraTiles = [],
|
|
611
|
-
className,
|
|
612
|
-
children,
|
|
613
|
-
renderIcon,
|
|
614
|
-
...dialog
|
|
615
|
-
}) {
|
|
616
|
-
const [activeId, setActiveId] = chunkAHDJXIUB_cjs.useControllableState(
|
|
617
|
-
activeIdProp,
|
|
618
|
-
null,
|
|
619
|
-
onActiveIdChange
|
|
620
|
-
);
|
|
621
|
-
const [isLaunching, setIsLaunching] = react.useState(false);
|
|
622
|
-
const active = workflows.find((w) => w.id === activeId) ?? null;
|
|
623
|
-
const run = async (launch) => {
|
|
624
|
-
setIsLaunching(true);
|
|
625
|
-
try {
|
|
626
|
-
await onLaunch(launch);
|
|
627
|
-
setActiveId(null);
|
|
628
|
-
} finally {
|
|
629
|
-
setIsLaunching(false);
|
|
630
|
-
}
|
|
631
|
-
};
|
|
632
|
-
const select = (workflow) => {
|
|
633
|
-
if (workflow.run.kind === "operation" && workflow.inputs.length === 0) {
|
|
634
|
-
const inputs = chunkOWCEQKAR_cjs.defaultInputs(workflow);
|
|
635
|
-
if (Object.keys(chunkOWCEQKAR_cjs.validateInputs(workflow, inputs)).length === 0) {
|
|
636
|
-
Promise.resolve(onLaunch(chunkOWCEQKAR_cjs.buildLaunch(workflow, inputs, void 0))).catch(() => {
|
|
637
|
-
});
|
|
638
|
-
return;
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
setActiveId(workflow.id);
|
|
642
|
-
};
|
|
643
|
-
const tiles = (tileWorkflows ?? workflows).map((workflow) => {
|
|
644
|
-
const reason = disabledReason?.(workflow);
|
|
645
|
-
return {
|
|
646
|
-
id: workflow.id,
|
|
647
|
-
iconNode: workflow.icon && renderIcon ? renderIcon(workflow.icon) : void 0,
|
|
648
|
-
title: workflow.title,
|
|
649
|
-
description: workflow.description,
|
|
650
|
-
onSelect: () => select(workflow),
|
|
651
|
-
disabled: reason !== void 0,
|
|
652
|
-
disabledReason: reason,
|
|
653
|
-
testId: tileTestId?.(workflow) ?? `workflow-tile-${workflow.id}`
|
|
654
|
-
};
|
|
655
|
-
});
|
|
656
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, "data-slot": "workflow-launcher", children: [
|
|
657
|
-
showTiles && /* @__PURE__ */ jsxRuntime.jsx(
|
|
658
|
-
chunkWS5EX7DN_cjs.StartTiles,
|
|
659
|
-
{
|
|
660
|
-
items: [...tiles, ...extraTiles],
|
|
661
|
-
caption,
|
|
662
|
-
captionTestId,
|
|
663
|
-
testId
|
|
664
|
-
}
|
|
665
|
-
),
|
|
666
|
-
children,
|
|
667
|
-
active && /* @__PURE__ */ jsxRuntime.jsx(
|
|
668
|
-
WorkflowConfigDialog,
|
|
669
|
-
{
|
|
670
|
-
...dialog,
|
|
671
|
-
renderIcon,
|
|
672
|
-
workflow: active,
|
|
673
|
-
open: true,
|
|
674
|
-
onOpenChange: (open) => !open && setActiveId(null),
|
|
675
|
-
onLaunch: run,
|
|
676
|
-
isLaunching,
|
|
677
|
-
initialInputs: initialInputsFor?.(active)
|
|
678
|
-
}
|
|
679
|
-
)
|
|
680
|
-
] });
|
|
681
|
-
}
|
|
682
|
-
function documentScopeLabels(tags) {
|
|
683
|
-
return tags.filter((tag) => {
|
|
684
|
-
if (tag.kind === "search") return false;
|
|
685
|
-
const onDocs = (tag.doctag_count ?? 0) > 0;
|
|
686
|
-
const onFacts = (tag.facttag_count ?? 0) > 0;
|
|
687
|
-
return onDocs || !onFacts;
|
|
688
|
-
});
|
|
689
|
-
}
|
|
690
|
-
var canonical = (path) => (path ?? "").split("/").map((part) => part.trim()).filter(Boolean).join("/");
|
|
691
|
-
function matchWorkflowScope(docs, scope) {
|
|
692
|
-
if (scope.documents?.length) {
|
|
693
|
-
const ids = new Set(scope.documents);
|
|
694
|
-
return docs.filter((doc) => ids.has(doc.external_id));
|
|
695
|
-
}
|
|
696
|
-
if (!scope.folders.length && !scope.labels.length) return docs;
|
|
697
|
-
const folders = scope.folders.map(canonical);
|
|
698
|
-
const labels = new Set(scope.labels);
|
|
699
|
-
return docs.filter((doc) => {
|
|
700
|
-
const folder = canonical(doc.folder);
|
|
701
|
-
return folders.some(
|
|
702
|
-
(path) => path === "" ? folder === "" : folder === path || folder.startsWith(`${path}/`)
|
|
703
|
-
) || doc.doctags?.some((tag) => labels.has(tag.tag_ext_id));
|
|
704
|
-
});
|
|
705
|
-
}
|
|
706
|
-
function buildWorkflowScopeSource(docs, labels = []) {
|
|
707
|
-
const counts = /* @__PURE__ */ new Map();
|
|
708
|
-
for (const doc of docs) {
|
|
709
|
-
const parts = canonical(doc.folder).split("/").filter(Boolean);
|
|
710
|
-
for (let i = 1; i <= parts.length; i++) {
|
|
711
|
-
const path = parts.slice(0, i).join("/");
|
|
712
|
-
counts.set(path, (counts.get(path) ?? 0) + 1);
|
|
713
|
-
}
|
|
714
|
-
}
|
|
715
|
-
return {
|
|
716
|
-
folders: [...counts].sort(([a], [b]) => a.localeCompare(b)).map(([path, count]) => ({
|
|
717
|
-
path,
|
|
718
|
-
count,
|
|
719
|
-
label: path.split("/").at(-1),
|
|
720
|
-
depth: path.split("/").length - 1
|
|
721
|
-
})),
|
|
722
|
-
unfiledCount: docs.filter((doc) => !canonical(doc.folder)).length,
|
|
723
|
-
labels: labels.map((label) => ({
|
|
724
|
-
id: label.external_id,
|
|
725
|
-
name: label.name,
|
|
726
|
-
color: label.color ?? ui.getEntityColor(label.external_id, "medium"),
|
|
727
|
-
count: docs.filter((doc) => doc.doctags?.some((tag) => tag.tag_ext_id === label.external_id)).length
|
|
728
|
-
})),
|
|
729
|
-
totalCount: docs.length,
|
|
730
|
-
countMatching: (scope) => matchWorkflowScope(docs, scope).length,
|
|
731
|
-
resolveDocuments: (scope) => matchWorkflowScope(docs, scope).map((doc) => doc.external_id)
|
|
732
|
-
};
|
|
733
|
-
}
|
|
734
|
-
var DEFAULT_WORKFLOW_DOCUMENTS_FIELD_LABELS = {
|
|
735
|
-
pickOne: "Pick a file",
|
|
736
|
-
pickMany: "Pick files",
|
|
737
|
-
allDocuments: "All documents",
|
|
738
|
-
addFiles: "Add files",
|
|
739
|
-
adding: "Adding\u2026",
|
|
740
|
-
empty: "No files in this workspace yet. Drop one here, or add it.",
|
|
741
|
-
remove: (name) => `Remove ${name}`,
|
|
742
|
-
pending: (name, status) => `${name}: ${status}. You can still pick it.`,
|
|
743
|
-
status: {
|
|
744
|
-
queued: "Queued",
|
|
745
|
-
uploading: "Uploading",
|
|
746
|
-
encrypting: "Encrypting",
|
|
747
|
-
processing: "Processing",
|
|
748
|
-
parsing: "Processing",
|
|
749
|
-
indexing: "Indexing",
|
|
750
|
-
analysing: "Analysing"
|
|
751
|
-
}
|
|
752
|
-
};
|
|
753
|
-
var isReady = (status) => !status || ["completed", "done", "ready", "success"].includes(status.toLowerCase());
|
|
754
|
-
var byTitle = (a, b) => a.title.toLowerCase().localeCompare(b.title.toLowerCase());
|
|
755
|
-
function WorkflowDocumentsField({
|
|
756
|
-
field,
|
|
757
|
-
value,
|
|
758
|
-
onChange,
|
|
759
|
-
documents,
|
|
760
|
-
loaded = true,
|
|
761
|
-
thumbnailOf,
|
|
762
|
-
onAddFiles,
|
|
763
|
-
adding,
|
|
764
|
-
labels
|
|
765
|
-
}) {
|
|
766
|
-
const l = { ...DEFAULT_WORKFLOW_DOCUMENTS_FIELD_LABELS, ...labels };
|
|
767
|
-
const ids = value.documents ?? [];
|
|
768
|
-
const max = field.max ?? 1;
|
|
769
|
-
const multiple = max > 1;
|
|
770
|
-
const [isOver, setIsOver] = react.useState(false);
|
|
771
|
-
const docOf = (id) => documents.find((d) => d.id === id);
|
|
772
|
-
const nameOf = (id) => docOf(id)?.title || id;
|
|
773
|
-
const set = (next) => onChange({ ...value, documents: next });
|
|
774
|
-
const toggle = (id) => set(ids.includes(id) ? ids.filter((d) => d !== id) : [...ids, id].slice(-max));
|
|
775
|
-
const offered = react.useMemo(
|
|
776
|
-
() => field.accept === "image" ? documents.filter((d) => d.isImage) : documents,
|
|
777
|
-
[documents, field.accept]
|
|
778
|
-
);
|
|
779
|
-
const awaitingAdd = react.useRef(false);
|
|
780
|
-
const known = react.useRef(null);
|
|
781
|
-
const latest = react.useRef({ ids, set });
|
|
782
|
-
latest.current = { ids, set };
|
|
783
|
-
react.useEffect(() => {
|
|
784
|
-
if (!loaded) return;
|
|
785
|
-
const current = new Set(documents.map((d) => d.id));
|
|
786
|
-
const before = known.current;
|
|
787
|
-
known.current = current;
|
|
788
|
-
if (!before || !awaitingAdd.current) return;
|
|
789
|
-
const fresh = [...current].filter((id) => !before.has(id));
|
|
790
|
-
if (fresh.length === 0) return;
|
|
791
|
-
awaitingAdd.current = false;
|
|
792
|
-
latest.current.set([...latest.current.ids, ...fresh].slice(-max));
|
|
793
|
-
}, [documents, loaded, max]);
|
|
794
|
-
const addFiles = (files) => {
|
|
795
|
-
if (!onAddFiles) return;
|
|
796
|
-
awaitingAdd.current = true;
|
|
797
|
-
onAddFiles(files?.length ? files : void 0);
|
|
798
|
-
};
|
|
799
|
-
const dropProps = onAddFiles ? {
|
|
800
|
-
onDragOver: (e) => {
|
|
801
|
-
e.preventDefault();
|
|
802
|
-
setIsOver(true);
|
|
803
|
-
},
|
|
804
|
-
onDragLeave: () => setIsOver(false),
|
|
805
|
-
onDrop: (e) => {
|
|
806
|
-
e.preventDefault();
|
|
807
|
-
setIsOver(false);
|
|
808
|
-
const files = Array.from(e.dataTransfer?.files ?? []);
|
|
809
|
-
if (files.length) addFiles(files);
|
|
810
|
-
}
|
|
811
|
-
} : {};
|
|
812
|
-
const dropClass = isOver ? "ring-2 ring-primary" : "";
|
|
813
|
-
const addButton = (className, variant = "outline") => onAddFiles && /* @__PURE__ */ jsxRuntime.jsx(
|
|
814
|
-
ui.Button,
|
|
815
|
-
{
|
|
816
|
-
type: "button",
|
|
817
|
-
size: "sm",
|
|
818
|
-
variant,
|
|
819
|
-
className,
|
|
820
|
-
disabled: adding,
|
|
821
|
-
onClick: () => addFiles(),
|
|
822
|
-
"data-testid": "workflow-add-files",
|
|
823
|
-
children: adding ? l.adding : l.addFiles
|
|
824
|
-
}
|
|
825
|
-
);
|
|
826
|
-
if (loaded && documents.length === 0) {
|
|
827
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
828
|
-
"div",
|
|
829
|
-
{
|
|
830
|
-
className: ui.cn(
|
|
831
|
-
"flex flex-col items-center gap-2 rounded-lg border border-dashed border-border bg-muted/40 px-4 py-6 text-center",
|
|
832
|
-
dropClass
|
|
833
|
-
),
|
|
834
|
-
"data-testid": "workflow-documents-empty",
|
|
835
|
-
...dropProps,
|
|
836
|
-
children: [
|
|
837
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.FolderPlus, { className: "size-5 text-muted-foreground", "aria-hidden": true }),
|
|
838
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: l.empty }),
|
|
839
|
-
addButton(void 0, "default")
|
|
840
|
-
]
|
|
841
|
-
}
|
|
842
|
-
);
|
|
843
|
-
}
|
|
844
|
-
const pending = ids.flatMap((id) => {
|
|
845
|
-
const status = docOf(id)?.status;
|
|
846
|
-
return isReady(status) ? [] : [{ id, label: l.status[String(status).toLowerCase()] ?? String(status) }];
|
|
847
|
-
});
|
|
848
|
-
const selected = multiple ? void 0 : docOf(ids[0] ?? "");
|
|
849
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
850
|
-
"div",
|
|
851
|
-
{
|
|
852
|
-
className: ui.cn("flex flex-col gap-3 rounded-lg", dropClass),
|
|
853
|
-
"data-testid": `workflow-documents-${field.name}`,
|
|
854
|
-
...dropProps,
|
|
855
|
-
children: [
|
|
856
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
857
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
858
|
-
chunkMIDXCYZB_cjs.DocumentPicker,
|
|
859
|
-
{
|
|
860
|
-
groups: [{ id: "all", heading: l.allDocuments, docs: [...offered].sort(byTitle) }],
|
|
861
|
-
value: multiple ? "" : ids[0] ?? "",
|
|
862
|
-
onValueChange: (id) => multiple ? toggle(id) : set([id]),
|
|
863
|
-
selected,
|
|
864
|
-
selectedIds: multiple ? ids : void 0,
|
|
865
|
-
labels: { placeholder: field.placeholder ?? (multiple ? l.pickMany : l.pickOne) }
|
|
866
|
-
}
|
|
867
|
-
) }),
|
|
868
|
-
addButton("shrink-0 pointer-coarse:h-11")
|
|
869
|
-
] }),
|
|
870
|
-
pending.map((p) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
871
|
-
"p",
|
|
872
|
-
{
|
|
873
|
-
className: "text-xs text-muted-foreground",
|
|
874
|
-
"data-testid": `workflow-document-status-${p.id}`,
|
|
875
|
-
children: l.pending(nameOf(p.id), p.label)
|
|
876
|
-
},
|
|
877
|
-
p.id
|
|
878
|
-
)),
|
|
879
|
-
multiple && ids.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
880
|
-
"div",
|
|
881
|
-
{
|
|
882
|
-
className: "grid grid-cols-2 gap-3 sm:grid-cols-3",
|
|
883
|
-
"data-testid": "workflow-documents-gallery",
|
|
884
|
-
children: ids.map((id) => {
|
|
885
|
-
const thumbnail = thumbnailOf?.(id);
|
|
886
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
887
|
-
"figure",
|
|
888
|
-
{
|
|
889
|
-
className: "relative overflow-hidden rounded-lg border border-border bg-muted/40",
|
|
890
|
-
"data-testid": `workflow-document-${id}`,
|
|
891
|
-
children: [
|
|
892
|
-
thumbnail ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
893
|
-
"img",
|
|
894
|
-
{
|
|
895
|
-
src: thumbnail,
|
|
896
|
-
alt: nameOf(id),
|
|
897
|
-
className: "aspect-square w-full object-cover"
|
|
898
|
-
}
|
|
899
|
-
) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex aspect-square w-full items-center justify-center text-muted-foreground/50", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ImageIcon, { className: "size-8" }) }),
|
|
900
|
-
/* @__PURE__ */ jsxRuntime.jsx("figcaption", { className: "truncate bg-background/90 px-2 py-1 text-xs text-muted-foreground", children: nameOf(id) }),
|
|
901
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
902
|
-
"button",
|
|
903
|
-
{
|
|
904
|
-
type: "button",
|
|
905
|
-
onClick: () => toggle(id),
|
|
906
|
-
"aria-label": l.remove(nameOf(id)),
|
|
907
|
-
className: "absolute right-1 top-1 flex size-6 items-center justify-center rounded-full bg-background/80 text-muted-foreground hover:text-foreground pointer-coarse:size-11",
|
|
908
|
-
"data-testid": `workflow-document-remove-${id}`,
|
|
909
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { className: "size-3.5" })
|
|
910
|
-
}
|
|
911
|
-
)
|
|
912
|
-
]
|
|
913
|
-
},
|
|
914
|
-
id
|
|
915
|
-
);
|
|
916
|
-
})
|
|
917
|
-
}
|
|
918
|
-
)
|
|
919
|
-
]
|
|
920
|
-
}
|
|
921
|
-
);
|
|
922
|
-
}
|
|
923
|
-
|
|
924
21
|
// src/agents/workflows/planSteps.ts
|
|
925
22
|
function toPlanAssignee(a) {
|
|
926
23
|
if ("user" in a) return { user: a.user };
|
|
@@ -1029,7 +126,7 @@ function toStepField(f) {
|
|
|
1029
126
|
}
|
|
1030
127
|
var compact = (o) => Object.fromEntries(Object.entries(o).filter(([, v]) => v !== void 0 && v !== ""));
|
|
1031
128
|
function placeholders(workflow) {
|
|
1032
|
-
return Object.fromEntries(
|
|
129
|
+
return Object.fromEntries(chunkJSTKEZBS_cjs.runFields(workflow).map((f) => [f.name, `{{${f.name}}}`]));
|
|
1033
130
|
}
|
|
1034
131
|
function agentStep(workflow, step, options) {
|
|
1035
132
|
const target = step.workflow ? options.resolveWorkflow?.(step.workflow) : void 0;
|
|
@@ -1038,11 +135,11 @@ function agentStep(workflow, step, options) {
|
|
|
1038
135
|
([, v]) => v !== void 0 && v !== null && v !== ""
|
|
1039
136
|
);
|
|
1040
137
|
const inputs = { ...placeholders(workflow), ...Object.fromEntries(given) };
|
|
1041
|
-
return { skill: null, inputs: null, prompt:
|
|
138
|
+
return { skill: null, inputs: null, prompt: chunkJSTKEZBS_cjs.composeStepPrompt(workflow, step, inputs, options) };
|
|
1042
139
|
}
|
|
1043
140
|
function toPlanSteps(workflow, options = {}) {
|
|
1044
141
|
const layout = workflow.run.kind === "steps" ? workflow.run.layout : void 0;
|
|
1045
|
-
return
|
|
142
|
+
return chunkJSTKEZBS_cjs.workflowSteps(workflow).map((step) => {
|
|
1046
143
|
const ui = compact({
|
|
1047
144
|
description: step.description,
|
|
1048
145
|
icon: step.icon,
|
|
@@ -1069,8 +166,8 @@ function toPlanSteps(workflow, options = {}) {
|
|
|
1069
166
|
ui,
|
|
1070
167
|
// An unfinished signal (still being typed) is not saved: the server would refuse it.
|
|
1071
168
|
...step.signals?.some((s) => !isIncompleteSignal(s)) ? { signals: step.signals.filter((s) => !isIncompleteSignal(s)).map(toPlanSignal) } : {},
|
|
1072
|
-
...step.assignee &&
|
|
1073
|
-
...step.remindAfterHours &&
|
|
169
|
+
...step.assignee && chunkJSTKEZBS_cjs.canAssign(step) ? { assignee: toPlanAssignee(step.assignee) } : {},
|
|
170
|
+
...step.remindAfterHours && chunkJSTKEZBS_cjs.canAssign(step) ? { remind_after_hours: step.remindAfterHours } : {},
|
|
1074
171
|
// A review's fields are what approving it is checked against (the server's `fields`).
|
|
1075
172
|
...step.kind === "review" && step.fields?.length ? { fields: step.fields.map(toStepField) } : {},
|
|
1076
173
|
...step.kind === "action" ? { action: toPlanAction(step.action) } : {},
|
|
@@ -1188,7 +285,7 @@ function workflowToSkillMarkdown(workflow) {
|
|
|
1188
285
|
if (workflow.landing !== "chat") lines.push(`landing: ${workflow.landing}`);
|
|
1189
286
|
if (workflow.requiresFiles) lines.push("requires_files: true");
|
|
1190
287
|
if (workflow.inputs.length > 0) {
|
|
1191
|
-
lines.push(`inputs: ${JSON.stringify(workflow.inputs.map(
|
|
288
|
+
lines.push(`inputs: ${JSON.stringify(workflow.inputs.map(chunk76L6LOP3_cjs.fieldToFrontmatter))}`);
|
|
1192
289
|
}
|
|
1193
290
|
lines.push("---", "", run.promptTemplate.trim(), "");
|
|
1194
291
|
return lines.join("\n");
|
|
@@ -1210,12 +307,12 @@ function workflowFromSkillMarkdown(id, text) {
|
|
|
1210
307
|
} else if (value === "true" || value === "false") frontmatter[key] = value === "true";
|
|
1211
308
|
else frontmatter[key] = value;
|
|
1212
309
|
}
|
|
1213
|
-
return
|
|
310
|
+
return chunk76L6LOP3_cjs.workflowFromFrontmatter(id, frontmatter, body);
|
|
1214
311
|
}
|
|
1215
312
|
var errorMessage = (e) => e instanceof Error ? e.message : typeof e === "string" ? e : "Something went wrong.";
|
|
1216
313
|
function firstOpen(steps, states) {
|
|
1217
314
|
const open = steps.find((s) => !["done", "skipped"].includes(states[s.id]?.status ?? "pending"));
|
|
1218
|
-
return open?.id ?? (steps.length &&
|
|
315
|
+
return open?.id ?? (steps.length && chunkJSTKEZBS_cjs.isRunFinished(steps, states) ? null : steps[0]?.id ?? null);
|
|
1219
316
|
}
|
|
1220
317
|
function useWorkflowView(options) {
|
|
1221
318
|
const { steps, states, inputs, setInput, loaded = true } = options;
|
|
@@ -1255,11 +352,11 @@ function useWorkflowView(options) {
|
|
|
1255
352
|
}),
|
|
1256
353
|
[]
|
|
1257
354
|
);
|
|
1258
|
-
const action = busy ? "wait" :
|
|
355
|
+
const action = busy ? "wait" : chunkJSTKEZBS_cjs.nextAction(steps, states, current, actionOptions(options));
|
|
1259
356
|
const next = react.useCallback(async () => {
|
|
1260
357
|
const { steps: s, states: st, inputs: values } = optionsRef.current;
|
|
1261
358
|
const at = s.find((x) => x.id === current);
|
|
1262
|
-
const act2 =
|
|
359
|
+
const act2 = chunkJSTKEZBS_cjs.nextAction(s, st, current, actionOptions(optionsRef.current));
|
|
1263
360
|
if (!at || act2 === "wait" || busy) return;
|
|
1264
361
|
setActionError(null);
|
|
1265
362
|
if (act2 === "finish") return setCurrent(null);
|
|
@@ -1270,7 +367,7 @@ function useWorkflowView(options) {
|
|
|
1270
367
|
await (act2 === "start" ? optionsRef.current.start?.() : optionsRef.current.retry?.(at.id));
|
|
1271
368
|
return;
|
|
1272
369
|
}
|
|
1273
|
-
if (Object.keys(
|
|
370
|
+
if (Object.keys(chunkJSTKEZBS_cjs.validateStep(at, values)).length > 0) {
|
|
1274
371
|
setShowErrors(true);
|
|
1275
372
|
return;
|
|
1276
373
|
}
|
|
@@ -1371,10 +468,10 @@ function useWorkflowView(options) {
|
|
|
1371
468
|
inputs,
|
|
1372
469
|
setInput,
|
|
1373
470
|
stateOf: (id) => states[id],
|
|
1374
|
-
phaseOf: (id) =>
|
|
1375
|
-
failedUpstreamOf: (id) =>
|
|
471
|
+
phaseOf: (id) => chunkJSTKEZBS_cjs.stepPhase(steps, states, id),
|
|
472
|
+
failedUpstreamOf: (id) => chunkJSTKEZBS_cjs.failedUpstream(steps, states, id),
|
|
1376
473
|
isLocked,
|
|
1377
|
-
errors: showErrors && step && !isLocked(step.id) ?
|
|
474
|
+
errors: showErrors && step && !isLocked(step.id) ? chunkJSTKEZBS_cjs.validateStep(step, inputs) : {},
|
|
1378
475
|
busy,
|
|
1379
476
|
actionError,
|
|
1380
477
|
isRunning: Object.values(states).some((s) => s.status === "running"),
|
|
@@ -1392,11 +489,11 @@ function useWorkflowView(options) {
|
|
|
1392
489
|
nameOf: options.nameOf,
|
|
1393
490
|
assigneeOf: (id) => {
|
|
1394
491
|
const s = steps.find((x) => x.id === id);
|
|
1395
|
-
if (!s || !
|
|
1396
|
-
return
|
|
492
|
+
if (!s || !chunkJSTKEZBS_cjs.canAssign(s)) return void 0;
|
|
493
|
+
return chunkJSTKEZBS_cjs.assigneeName(s.assignee, {
|
|
1397
494
|
nameOf: options.nameOf,
|
|
1398
495
|
inputs,
|
|
1399
|
-
fields:
|
|
496
|
+
fields: chunkJSTKEZBS_cjs.runFieldsOf(steps),
|
|
1400
497
|
announcedTo: states[id]?.announcedTo
|
|
1401
498
|
});
|
|
1402
499
|
},
|
|
@@ -1530,7 +627,7 @@ function StepBarFrame({
|
|
|
1530
627
|
}) {
|
|
1531
628
|
const l = { ...DEFAULT_STEP_BAR_LABELS, ...labels };
|
|
1532
629
|
const box = react.useRef(null);
|
|
1533
|
-
const { width } =
|
|
630
|
+
const { width } = chunkJSTKEZBS_cjs.useElementSize(box);
|
|
1534
631
|
const narrow = width > 0 && width < NARROW_PX;
|
|
1535
632
|
const [start, setStart] = react.useState(null);
|
|
1536
633
|
react.useEffect(() => setStart(null), [current]);
|
|
@@ -1597,7 +694,7 @@ function StepBarFrame({
|
|
|
1597
694
|
phase === "blocked" && "opacity-60"
|
|
1598
695
|
),
|
|
1599
696
|
"aria-hidden": true,
|
|
1600
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
697
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(chunkJSTKEZBS_cjs.StepBadgeMark, { phase, icon: icon?.(s) })
|
|
1601
698
|
}
|
|
1602
699
|
),
|
|
1603
700
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 flex-1 truncate", title: s.title, children: s.title }),
|
|
@@ -1705,7 +802,7 @@ function StepBarFrame({
|
|
|
1705
802
|
};
|
|
1706
803
|
const running = win.runningHidden;
|
|
1707
804
|
const outOfViewChip = (s, kind) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1708
|
-
|
|
805
|
+
chunkJSTKEZBS_cjs.StepChip,
|
|
1709
806
|
{
|
|
1710
807
|
kind: kindOf(s),
|
|
1711
808
|
phase: kind === "working" ? "running" : "failed",
|
|
@@ -1878,7 +975,7 @@ var DEFAULT_WORKFLOW_STEP_PARTS_LABELS = {
|
|
|
1878
975
|
someone: "someone"
|
|
1879
976
|
};
|
|
1880
977
|
var docName = (ref, nameOfDoc) => {
|
|
1881
|
-
const { id, version } =
|
|
978
|
+
const { id, version } = chunkJSTKEZBS_cjs.splitDocRef(ref);
|
|
1882
979
|
const name = nameOfDoc?.(id) ?? id;
|
|
1883
980
|
return version ? `${name} \xB7 v${version}` : name;
|
|
1884
981
|
};
|
|
@@ -1960,7 +1057,7 @@ function SendBackControl({
|
|
|
1960
1057
|
const states = Object.fromEntries(
|
|
1961
1058
|
run.steps.map((s) => [s.id, run.stateOf(s.id) ?? { status: "pending" }])
|
|
1962
1059
|
);
|
|
1963
|
-
const targets =
|
|
1060
|
+
const targets = chunkJSTKEZBS_cjs.sendBackTargets(run.steps, states, step.id);
|
|
1964
1061
|
const [open, setOpen] = react.useState(false);
|
|
1965
1062
|
const [to, setTo] = react.useState(targets[0]?.id ?? "");
|
|
1966
1063
|
const [note, setNote] = react.useState("");
|
|
@@ -2050,7 +1147,7 @@ function ApprovalEvidence({
|
|
|
2050
1147
|
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "flex flex-wrap items-center gap-1.5 text-sm font-medium", children: [
|
|
2051
1148
|
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ShieldCheck, { className: "size-4 text-primary" }),
|
|
2052
1149
|
approver ? l.approvedBy.replace("{name}", approver) : null,
|
|
2053
|
-
state.at && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-normal text-muted-foreground", children: l.approvedAt.replace("{date}",
|
|
1150
|
+
state.at && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-normal text-muted-foreground", children: l.approvedAt.replace("{date}", chunkJSTKEZBS_cjs.formatDate(state.at)) })
|
|
2054
1151
|
] }),
|
|
2055
1152
|
evidence.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", children: [
|
|
2056
1153
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: l.approvedWhat }),
|
|
@@ -2083,7 +1180,7 @@ function ApprovalEvidence({
|
|
|
2083
1180
|
] }),
|
|
2084
1181
|
(step.fields ?? []).length > 0 && /* @__PURE__ */ jsxRuntime.jsx("dl", { className: "grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5 text-xs", children: (step.fields ?? []).map((f) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "contents", children: [
|
|
2085
1182
|
/* @__PURE__ */ jsxRuntime.jsx("dt", { className: "text-muted-foreground", children: f.label }),
|
|
2086
|
-
/* @__PURE__ */ jsxRuntime.jsx("dd", { "data-testid": `${testId}-evidence-field-${f.name}`, children:
|
|
1183
|
+
/* @__PURE__ */ jsxRuntime.jsx("dd", { "data-testid": `${testId}-evidence-field-${f.name}`, children: chunkJSTKEZBS_cjs.shownValue(run.inputs[f.name], f, run.nameOf) })
|
|
2087
1184
|
] }, f.name)) })
|
|
2088
1185
|
] });
|
|
2089
1186
|
}
|
|
@@ -2179,7 +1276,7 @@ function ActionStepBody({
|
|
|
2179
1276
|
waiting?.expires_at && phase === "waiting" && /* @__PURE__ */ jsxRuntime.jsxs("p", { className: "flex items-center gap-1.5 text-xs text-muted-foreground", children: [
|
|
2180
1277
|
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Clock, { className: "size-3.5" }),
|
|
2181
1278
|
" ",
|
|
2182
|
-
l.expires.replace("{date}",
|
|
1279
|
+
l.expires.replace("{date}", chunkJSTKEZBS_cjs.formatDate(waiting.expires_at))
|
|
2183
1280
|
] }),
|
|
2184
1281
|
phase === "waiting" && mine && !declining && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap gap-2", children: [
|
|
2185
1282
|
actions?.sign && state && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -2337,7 +1434,7 @@ function WorkflowStepBar({
|
|
|
2337
1434
|
const name = `${title} (${l.phases[phase]})`;
|
|
2338
1435
|
if (s.id === DONE)
|
|
2339
1436
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2340
|
-
|
|
1437
|
+
chunkJSTKEZBS_cjs.StepChip,
|
|
2341
1438
|
{
|
|
2342
1439
|
inert: true,
|
|
2343
1440
|
kind: "start",
|
|
@@ -2351,17 +1448,17 @@ function WorkflowStepBar({
|
|
|
2351
1448
|
"data-testid": tid("step-done")
|
|
2352
1449
|
}
|
|
2353
1450
|
);
|
|
2354
|
-
const kind =
|
|
2355
|
-
const KindIcon =
|
|
1451
|
+
const kind = chunkJSTKEZBS_cjs.stepKindOf(s);
|
|
1452
|
+
const KindIcon = chunkJSTKEZBS_cjs.STEP_KIND_ICONS[kind];
|
|
2356
1453
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2357
|
-
|
|
1454
|
+
chunkJSTKEZBS_cjs.StepChip,
|
|
2358
1455
|
{
|
|
2359
1456
|
kind,
|
|
2360
1457
|
phase,
|
|
2361
1458
|
icon: icon(s.icon) ?? /* @__PURE__ */ jsxRuntime.jsx(KindIcon, {}),
|
|
2362
1459
|
label: s.title,
|
|
2363
1460
|
current: isCurrent,
|
|
2364
|
-
heading:
|
|
1461
|
+
heading: chunkJSTKEZBS_cjs.DEFAULT_STEP_KIND_LABELS[kind],
|
|
2365
1462
|
labelClassName: isCurrent ? STEP_LABEL_CURRENT : ui.cn(STEP_LABEL, STEP_LABEL_MAX),
|
|
2366
1463
|
labelTestId: tid(`step-${s.id}-label`),
|
|
2367
1464
|
onClick: () => run.goTo(s.id),
|
|
@@ -2394,7 +1491,7 @@ function WorkflowStepBar({
|
|
|
2394
1491
|
isSelectable: (id) => id !== DONE,
|
|
2395
1492
|
renderStep: (s) => pill(s),
|
|
2396
1493
|
icon: (s) => s.id === DONE ? doneIcon : icon(s.icon),
|
|
2397
|
-
kindOf: (s) => s.id === DONE ? "start" :
|
|
1494
|
+
kindOf: (s) => s.id === DONE ? "start" : chunkJSTKEZBS_cjs.stepKindOf(s),
|
|
2398
1495
|
disabled: run.busy,
|
|
2399
1496
|
labels,
|
|
2400
1497
|
tid,
|
|
@@ -2477,7 +1574,7 @@ function WorkflowRunner({
|
|
|
2477
1574
|
const { steps, step, isComplete, action } = run;
|
|
2478
1575
|
const completion = workflow.run.kind === "steps" ? workflow.run.completion : void 0;
|
|
2479
1576
|
const tid = (suffix) => `${testIdPrefix}-${suffix}`;
|
|
2480
|
-
const levels =
|
|
1577
|
+
const levels = chunkJSTKEZBS_cjs.stepLevels(steps);
|
|
2481
1578
|
const icon = (key) => key && renderIcon ? renderIcon(key) : void 0;
|
|
2482
1579
|
const added = step?.kind === "upload" ? (files ?? []).filter((f) => f.addedFor === step.id) : [];
|
|
2483
1580
|
const unread = added.filter((f) => f.status === "processing").length;
|
|
@@ -2485,7 +1582,7 @@ function WorkflowRunner({
|
|
|
2485
1582
|
const sending = added.filter((f) => f.status === "uploading").length;
|
|
2486
1583
|
const unsent = added.filter((f) => f.status === "upload-failed").length;
|
|
2487
1584
|
const uploadHold = step?.kind === "upload" && (sending > 0 || uploading || unsent > 0);
|
|
2488
|
-
const docsWait = !!step &&
|
|
1585
|
+
const docsWait = !!step && chunkJSTKEZBS_cjs.waitingDocuments(run.stateOf(step.id)).length > 0;
|
|
2489
1586
|
const nextLabel = sending ? sending === 1 ? l.uploadingFile : l.uploadingFiles.replace("{count}", String(sending)) : uploadHold && uploading ? l.uploadingAny : uploadHold ? unsent === 1 ? l.uploadFailed : l.uploadsFailed.replace("{count}", String(unsent)) : reading ? l.readingFiles.replace("{current}", String(Math.min(added.length - unread + 1, added.length))).replace("{count}", String(added.length)) : action === "start" ? l.start : action === "retry" ? l.retry : action === "finish" ? l.finish : action === "complete" && step?.kind === "review" ? l.approve : action === "complete" && step?.kind === "action" ? l.markSent : action === "wait" && (run.isRunning || run.busy || docsWait) ? l.working : (step && !run.isLocked(step.id) ? step.nextLabel : void 0) ?? l.next;
|
|
2490
1587
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ui.cn(compact2 ? "space-y-3" : "space-y-6", className), "data-testid": testIdPrefix, children: [
|
|
2491
1588
|
!hideStepBar && /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -2517,13 +1614,13 @@ function WorkflowRunner({
|
|
|
2517
1614
|
/* @__PURE__ */ jsxRuntime.jsx(StepNotices, { run, step, l, tid }),
|
|
2518
1615
|
run.phaseOf(step.id) === "blocked" ? /* @__PURE__ */ jsxRuntime.jsx(ui.Card, { className: ui.cn(box, "p-6"), "data-testid": tid(step.id), children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", "data-testid": tid(`${step.id}-blocked`), children: l.blocked.replace(
|
|
2519
1616
|
"{steps}",
|
|
2520
|
-
|
|
1617
|
+
chunkJSTKEZBS_cjs.stepDependencies(steps, step.id).map((d) => steps.find((s) => s.id === d)?.title ?? d).join(", ")
|
|
2521
1618
|
) }) }) : step.kind === "form" ? /* @__PURE__ */ jsxRuntime.jsxs(ui.Card, { className: ui.cn(box, "space-y-4"), "data-testid": tid(step.id), children: [
|
|
2522
1619
|
/* @__PURE__ */ jsxRuntime.jsx(StepHeading, { step, icon: icon(step.icon), testId: tid(`${step.id}-title`) }),
|
|
2523
1620
|
/* @__PURE__ */ jsxRuntime.jsx(SentBackNote, { state: run.stateOf(step.id), l: pl, testId: tid(step.id) }),
|
|
2524
1621
|
/* @__PURE__ */ jsxRuntime.jsx(AssigneeLine, { run, stepId: step.id, l: pl, testId: tid(step.id) }),
|
|
2525
1622
|
/* @__PURE__ */ jsxRuntime.jsx("fieldset", { disabled: run.isLocked(step.id), className: "contents", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2526
|
-
SchemaForm,
|
|
1623
|
+
chunkO2ODDTMA_cjs.SchemaForm,
|
|
2527
1624
|
{
|
|
2528
1625
|
fields: step.inputs,
|
|
2529
1626
|
values: run.inputs,
|
|
@@ -2573,11 +1670,11 @@ function WorkflowRunner({
|
|
|
2573
1670
|
] }) : step.kind === "review" ? /* @__PURE__ */ jsxRuntime.jsxs(ui.Card, { className: ui.cn(box, "space-y-4"), "data-testid": tid(step.id), children: [
|
|
2574
1671
|
/* @__PURE__ */ jsxRuntime.jsx(StepHeading, { step, icon: icon(step.icon) }),
|
|
2575
1672
|
/* @__PURE__ */ jsxRuntime.jsx(SentBackNote, { state: run.stateOf(step.id), l: pl, testId: tid(step.id) }),
|
|
2576
|
-
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "whitespace-pre-line text-sm text-muted-foreground", children:
|
|
1673
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "whitespace-pre-line text-sm text-muted-foreground", children: chunkJSTKEZBS_cjs.reviewInstructions(step, run.inputs) }),
|
|
2577
1674
|
/* @__PURE__ */ jsxRuntime.jsx(AssigneeLine, { run, stepId: step.id, l: pl, testId: tid(step.id) }),
|
|
2578
1675
|
!(run.phaseOf(step.id) === "done" && run.stateOf(step.id)?.by) && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm", "data-testid": tid(`${step.id}-status`), children: run.phaseOf(step.id) === "done" ? l.approved : run.phaseOf(step.id) === "skipped" ? l.skipped : l.awaitingReview }),
|
|
2579
1676
|
(step.fields ?? []).length > 0 && run.phaseOf(step.id) === "ready" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2580
|
-
SchemaForm,
|
|
1677
|
+
chunkO2ODDTMA_cjs.SchemaForm,
|
|
2581
1678
|
{
|
|
2582
1679
|
fields: step.fields ?? [],
|
|
2583
1680
|
values: run.inputs,
|
|
@@ -2840,8 +1937,8 @@ function AgentStepBody({
|
|
|
2840
1937
|
}) {
|
|
2841
1938
|
const state = run.stateOf(step.id);
|
|
2842
1939
|
const phase = run.phaseOf(step.id);
|
|
2843
|
-
const pending =
|
|
2844
|
-
const pendingNames = pending.flatMap((ref) => nameOfDoc?.(
|
|
1940
|
+
const pending = chunkJSTKEZBS_cjs.waitingDocuments(state);
|
|
1941
|
+
const pendingNames = pending.flatMap((ref) => nameOfDoc?.(chunkJSTKEZBS_cjs.splitDocRef(ref).id) ?? []);
|
|
2845
1942
|
const header = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start justify-between gap-3", children: [
|
|
2846
1943
|
/* @__PURE__ */ jsxRuntime.jsx(StepHeading, { step, icon }),
|
|
2847
1944
|
phase === "failed" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex shrink-0 items-center gap-2", children: run.retry && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -2926,7 +2023,7 @@ function StepNotices({
|
|
|
2926
2023
|
l,
|
|
2927
2024
|
tid
|
|
2928
2025
|
}) {
|
|
2929
|
-
const notStarted = !
|
|
2026
|
+
const notStarted = !chunkJSTKEZBS_cjs.isPersonStep(step) && run.needsStart && run.phaseOf(step.id) === "ready";
|
|
2930
2027
|
const failed = run.failedUpstreamOf(step.id);
|
|
2931
2028
|
if (!notStarted && failed.length === 0) return null;
|
|
2932
2029
|
const why = (error) => error ? `: ${error}` : "";
|
|
@@ -4262,7 +3359,7 @@ var SKILL_FIELD_TYPE_LABELS = {
|
|
|
4262
3359
|
person: "A person"
|
|
4263
3360
|
};
|
|
4264
3361
|
function buildLibrarySkills(builtins, listings) {
|
|
4265
|
-
const { host, skills } =
|
|
3362
|
+
const { host, skills } = chunk76L6LOP3_cjs.mergeSkillWorkflows(builtins, listings);
|
|
4266
3363
|
const builtinIds = new Set(builtins.map((w) => w.id));
|
|
4267
3364
|
const stored = new Map(listings.filter((s) => s.doc_ext_id).map((s) => [s.slug, s]));
|
|
4268
3365
|
return [...host, ...skills].flatMap((workflow) => {
|
|
@@ -4431,688 +3528,6 @@ function SkillLibraryDetail({
|
|
|
4431
3528
|
}
|
|
4432
3529
|
);
|
|
4433
3530
|
}
|
|
4434
|
-
function PersonPill({ person, size = "sm", testId }) {
|
|
4435
|
-
return /* @__PURE__ */ jsxRuntime.jsx("span", { "data-testid": testId, className: "inline-flex min-w-0", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4436
|
-
ui.UserEntity,
|
|
4437
|
-
{
|
|
4438
|
-
variant: "pill",
|
|
4439
|
-
size,
|
|
4440
|
-
interactive: false,
|
|
4441
|
-
showTooltip: false,
|
|
4442
|
-
initials: chunkKDG6FER6_cjs.initials(person.label),
|
|
4443
|
-
displayName: person.label,
|
|
4444
|
-
avatarStyle: person.id ? ui.getEntityColorStyles(person.id) : void 0,
|
|
4445
|
-
isAgent: person.isAgent,
|
|
4446
|
-
isMe: person.isMe
|
|
4447
|
-
}
|
|
4448
|
-
) });
|
|
4449
|
-
}
|
|
4450
|
-
var DEFAULT_TASK_TRIGGER_CHIP_LABELS = {
|
|
4451
|
-
after: (name) => `After \u201C${name}\u201D is done`,
|
|
4452
|
-
afterUnknown: "After another task is done",
|
|
4453
|
-
onDemand: "Manual"
|
|
4454
|
-
};
|
|
4455
|
-
function TriggerIcon({ type, chained }) {
|
|
4456
|
-
const cls = "size-3.5 shrink-0 text-muted-foreground";
|
|
4457
|
-
if (chained) return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Link2, { className: cls, "aria-hidden": true });
|
|
4458
|
-
switch (type) {
|
|
4459
|
-
case "on_demand":
|
|
4460
|
-
return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.MousePointerClick, { className: cls, "aria-hidden": true });
|
|
4461
|
-
case "recurring":
|
|
4462
|
-
return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Clock, { className: cls, "aria-hidden": true });
|
|
4463
|
-
case "event":
|
|
4464
|
-
return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Bell, { className: cls, "aria-hidden": true });
|
|
4465
|
-
default:
|
|
4466
|
-
return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Clock, { className: cls, "aria-hidden": true });
|
|
4467
|
-
}
|
|
4468
|
-
}
|
|
4469
|
-
function TaskTriggerChip({
|
|
4470
|
-
id,
|
|
4471
|
-
triggerType,
|
|
4472
|
-
summary,
|
|
4473
|
-
afterTaskId,
|
|
4474
|
-
afterTaskName,
|
|
4475
|
-
testId,
|
|
4476
|
-
labels
|
|
4477
|
-
}) {
|
|
4478
|
-
const l = { ...DEFAULT_TASK_TRIGGER_CHIP_LABELS, ...labels };
|
|
4479
|
-
const chained = Boolean(afterTaskId);
|
|
4480
|
-
const text = chained ? afterTaskName ? l.after(afterTaskName) : l.afterUnknown : triggerType === "on_demand" ? l.onDemand : summary;
|
|
4481
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4482
|
-
"span",
|
|
4483
|
-
{
|
|
4484
|
-
className: "inline-flex min-w-0 max-w-full items-center gap-1.5 text-sm font-normal text-foreground",
|
|
4485
|
-
"data-testid": chunkMHVNT4J3_cjs.testIdOr(testId, { testId: `task-trigger-${id}` }),
|
|
4486
|
-
"data-trigger": chained ? "task" : triggerType,
|
|
4487
|
-
children: [
|
|
4488
|
-
/* @__PURE__ */ jsxRuntime.jsx(TriggerIcon, { type: triggerType, chained }),
|
|
4489
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: text })
|
|
4490
|
-
]
|
|
4491
|
-
}
|
|
4492
|
-
);
|
|
4493
|
-
}
|
|
4494
|
-
|
|
4495
|
-
// src/agents/tasks/workflowRows.ts
|
|
4496
|
-
var isSkillRow = (row) => row.kind === "skill";
|
|
4497
|
-
var hasTrigger = (row) => !row.on_demand && Boolean(row.rrule || row.run_at || row.event_kind || row.after_conversation_ext_id);
|
|
4498
|
-
function workflowStatus(row) {
|
|
4499
|
-
if (isSkillRow(row) || !hasTrigger(row)) return "on_demand";
|
|
4500
|
-
return row.active ? "active" : "paused";
|
|
4501
|
-
}
|
|
4502
|
-
function workflowTriggerType(workflow) {
|
|
4503
|
-
if (workflow.on_demand) return "on_demand";
|
|
4504
|
-
if (workflow.after_conversation_ext_id) return "after";
|
|
4505
|
-
if (workflow.event_kind) return "event";
|
|
4506
|
-
if (workflow.rrule) return "recurring";
|
|
4507
|
-
if (workflow.run_at) return "one_time";
|
|
4508
|
-
return "on_demand";
|
|
4509
|
-
}
|
|
4510
|
-
function workflowRunStatusLabel(status) {
|
|
4511
|
-
if (!status) return "None";
|
|
4512
|
-
const labels = {
|
|
4513
|
-
completed: "Success",
|
|
4514
|
-
success: "Success",
|
|
4515
|
-
failed: "Failed",
|
|
4516
|
-
running: "In progress",
|
|
4517
|
-
awaiting_authorization: "Awaiting access"
|
|
4518
|
-
};
|
|
4519
|
-
return labels[status] ?? status.replaceAll("_", " ");
|
|
4520
|
-
}
|
|
4521
|
-
function listedRunStatus(status, threadStatus) {
|
|
4522
|
-
if (threadStatus === "done" && status === "running") return "completed";
|
|
4523
|
-
return status;
|
|
4524
|
-
}
|
|
4525
|
-
|
|
4526
|
-
// src/agents/tasks/workflowColumns.tsx
|
|
4527
|
-
var WORKFLOW_COLUMN_ORDER = [
|
|
4528
|
-
"name",
|
|
4529
|
-
"trigger",
|
|
4530
|
-
"last_run",
|
|
4531
|
-
"result",
|
|
4532
|
-
"status",
|
|
4533
|
-
"shared",
|
|
4534
|
-
"actions"
|
|
4535
|
-
];
|
|
4536
|
-
function cell(render) {
|
|
4537
|
-
return (params) => params.data ? render(params.data) : null;
|
|
4538
|
-
}
|
|
4539
|
-
var time = (iso) => iso ? Date.parse(iso) : Number.POSITIVE_INFINITY;
|
|
4540
|
-
function createWorkflowColumns(o) {
|
|
4541
|
-
const l = o.labels;
|
|
4542
|
-
const base = {
|
|
4543
|
-
sortable: false,
|
|
4544
|
-
cellStyle: { display: "flex", alignItems: "center" }
|
|
4545
|
-
};
|
|
4546
|
-
return [
|
|
4547
|
-
{
|
|
4548
|
-
...base,
|
|
4549
|
-
colId: "name",
|
|
4550
|
-
sortable: true,
|
|
4551
|
-
headerName: l.colName,
|
|
4552
|
-
flex: 3,
|
|
4553
|
-
minWidth: 210,
|
|
4554
|
-
valueGetter: (p) => p.data?.name.toLowerCase() ?? "",
|
|
4555
|
-
cellRenderer: cell(o.renderName)
|
|
4556
|
-
},
|
|
4557
|
-
{
|
|
4558
|
-
...base,
|
|
4559
|
-
colId: "trigger",
|
|
4560
|
-
headerName: l.colTrigger,
|
|
4561
|
-
flex: 2.4,
|
|
4562
|
-
minWidth: 185,
|
|
4563
|
-
valueGetter: (p) => p.data ? o.getTriggerText(p.data) : "",
|
|
4564
|
-
cellRenderer: cell(o.renderTrigger)
|
|
4565
|
-
},
|
|
4566
|
-
{
|
|
4567
|
-
...base,
|
|
4568
|
-
colId: "last_run",
|
|
4569
|
-
sortable: true,
|
|
4570
|
-
headerName: l.colLastRun,
|
|
4571
|
-
flex: 1.4,
|
|
4572
|
-
minWidth: 140,
|
|
4573
|
-
cellStyle: { display: "flex", alignItems: "center", padding: 0 },
|
|
4574
|
-
valueGetter: (p) => time(p.data?.last_fired_at),
|
|
4575
|
-
cellRenderer: cell(o.renderLastRun)
|
|
4576
|
-
},
|
|
4577
|
-
{
|
|
4578
|
-
...base,
|
|
4579
|
-
colId: "result",
|
|
4580
|
-
headerName: "Result",
|
|
4581
|
-
width: 130,
|
|
4582
|
-
valueGetter: (p) => p.data?.last_run_status ?? "",
|
|
4583
|
-
cellStyle: { display: "flex", alignItems: "center", padding: 0 },
|
|
4584
|
-
cellRenderer: cell(o.renderResult)
|
|
4585
|
-
},
|
|
4586
|
-
{
|
|
4587
|
-
...base,
|
|
4588
|
-
colId: "status",
|
|
4589
|
-
sortable: true,
|
|
4590
|
-
headerName: l.colStatus,
|
|
4591
|
-
width: 120,
|
|
4592
|
-
valueGetter: (p) => p.data ? workflowStatus(p.data) : "",
|
|
4593
|
-
cellRenderer: cell(o.renderStatus)
|
|
4594
|
-
},
|
|
4595
|
-
{
|
|
4596
|
-
...base,
|
|
4597
|
-
colId: "shared",
|
|
4598
|
-
headerName: l.colShared,
|
|
4599
|
-
headerTooltip: l.shared,
|
|
4600
|
-
width: 96,
|
|
4601
|
-
cellStyle: { display: "flex", alignItems: "center", justifyContent: "center" },
|
|
4602
|
-
valueGetter: (p) => p.data?.shared ?? false,
|
|
4603
|
-
cellRenderer: cell(o.renderShared)
|
|
4604
|
-
},
|
|
4605
|
-
{
|
|
4606
|
-
...base,
|
|
4607
|
-
colId: "actions",
|
|
4608
|
-
headerName: "",
|
|
4609
|
-
width: 180,
|
|
4610
|
-
minWidth: 180,
|
|
4611
|
-
cellStyle: { display: "flex", alignItems: "center", justifyContent: "flex-end" },
|
|
4612
|
-
cellRenderer: cell(o.renderActions)
|
|
4613
|
-
}
|
|
4614
|
-
];
|
|
4615
|
-
}
|
|
4616
|
-
|
|
4617
|
-
// src/agents/tasks/workflowTableLabels.ts
|
|
4618
|
-
var DEFAULT_WORKFLOW_LIST_LABELS = {
|
|
4619
|
-
colName: "Name",
|
|
4620
|
-
colType: "Type",
|
|
4621
|
-
colTrigger: "When",
|
|
4622
|
-
colAction: "What it does",
|
|
4623
|
-
colAgent: "Agent",
|
|
4624
|
-
colStatus: "Active",
|
|
4625
|
-
colShared: "Shared",
|
|
4626
|
-
colLastRun: "Last run",
|
|
4627
|
-
colNextRun: "Next run",
|
|
4628
|
-
shared: "Shared with the workspace",
|
|
4629
|
-
sharedOwnerOnly: "Only the creator can change who can see this",
|
|
4630
|
-
deleteOwnerOnly: "Only the creator or workspace owner can delete this",
|
|
4631
|
-
typeSkill: "Skill",
|
|
4632
|
-
typeWorkflow: "Workflow",
|
|
4633
|
-
statusActive: "Active",
|
|
4634
|
-
statusPaused: "Inactive",
|
|
4635
|
-
statusOnDemand: "On demand",
|
|
4636
|
-
activeSwitch: (name) => `Active: \u201C${name}\u201D`,
|
|
4637
|
-
agent: "Agent",
|
|
4638
|
-
myAssistant: "My assistant",
|
|
4639
|
-
me: "Me",
|
|
4640
|
-
someone: "Someone",
|
|
4641
|
-
never: "Never",
|
|
4642
|
-
none: "\u2014",
|
|
4643
|
-
reminder: "Reminder",
|
|
4644
|
-
failed: "Failed",
|
|
4645
|
-
lastRunFailed: "Last run failed",
|
|
4646
|
-
openLastRun: "Open the task this run created",
|
|
4647
|
-
editWorkflow: "Edit",
|
|
4648
|
-
run: "Run",
|
|
4649
|
-
runLater: "Run later",
|
|
4650
|
-
runNow: "Run now",
|
|
4651
|
-
runs: "Runs",
|
|
4652
|
-
delete: "Delete",
|
|
4653
|
-
moreActions: "More actions",
|
|
4654
|
-
searchLabel: "Search workflows",
|
|
4655
|
-
searchPlaceholder: "Search workflows and skills\u2026",
|
|
4656
|
-
emptyTitle: "Nothing to run yet",
|
|
4657
|
-
emptyMessage: "Skills and workflows you can run will appear here.",
|
|
4658
|
-
firstRun: "Run a skill now, or choose Run later to save it as a workflow that runs on its own.",
|
|
4659
|
-
noMatches: "Nothing in this view.",
|
|
4660
|
-
filterAll: "All",
|
|
4661
|
-
filterSkills: "Skills",
|
|
4662
|
-
filterWorkflows: "Workflows",
|
|
4663
|
-
filterActive: "Active",
|
|
4664
|
-
filterPaused: "Inactive",
|
|
4665
|
-
makeActive: "Make active",
|
|
4666
|
-
makePaused: "Deactivate",
|
|
4667
|
-
selectAll: "Select all",
|
|
4668
|
-
selectWorkflow: (name) => `Select ${name}`
|
|
4669
|
-
};
|
|
4670
|
-
var ROW_HEIGHT = 40;
|
|
4671
|
-
function WorkflowsTable(props) {
|
|
4672
|
-
const { workflows, isLoading, busyId, header, testId } = props;
|
|
4673
|
-
const l = { ...DEFAULT_WORKFLOW_LIST_LABELS, ...props.labels };
|
|
4674
|
-
const [filterStates, setFilterStates] = react.useState(/* @__PURE__ */ new Map());
|
|
4675
|
-
const [filterOpen, setFilterOpen] = react.useState(false);
|
|
4676
|
-
const [query, setQuery] = react.useState("");
|
|
4677
|
-
const [selected, setSelected] = react.useState([]);
|
|
4678
|
-
const apiRef = react.useRef(null);
|
|
4679
|
-
const q = query.trim().toLowerCase();
|
|
4680
|
-
const matches = (w) => !q || `${w.name} ${w.description ?? ""} ${w.prompt ?? ""} ${w.skill_ref ?? ""}`.toLowerCase().includes(q);
|
|
4681
|
-
const inFilter = (w, f) => f === "all" || f === "skills" && isSkillRow(w) || f === "workflows" && !isSkillRow(w) || f === "active" && workflowStatus(w) === "active" || f === "paused" && workflowStatus(w) === "paused";
|
|
4682
|
-
const counts = react.useMemo(() => {
|
|
4683
|
-
const out = { all: 0, skills: 0, workflows: 0, active: 0, paused: 0 };
|
|
4684
|
-
for (const w of workflows) {
|
|
4685
|
-
if (!matches(w)) continue;
|
|
4686
|
-
for (const f of Object.keys(out)) if (inFilter(w, f)) out[f] += 1;
|
|
4687
|
-
}
|
|
4688
|
-
return out;
|
|
4689
|
-
}, [workflows, q]);
|
|
4690
|
-
const shown = react.useMemo(
|
|
4691
|
-
() => workflows.filter((w) => {
|
|
4692
|
-
if (!matches(w)) return false;
|
|
4693
|
-
for (const group of [
|
|
4694
|
-
["skills", "workflows"],
|
|
4695
|
-
["active", "paused"]
|
|
4696
|
-
]) {
|
|
4697
|
-
const included = group.filter((f) => filterStates.get(f) === "include");
|
|
4698
|
-
if (included.length && !included.some((f) => inFilter(w, f))) return false;
|
|
4699
|
-
if (group.some((f) => filterStates.get(f) === "exclude" && inFilter(w, f))) return false;
|
|
4700
|
-
}
|
|
4701
|
-
return true;
|
|
4702
|
-
}),
|
|
4703
|
-
[workflows, filterStates, q]
|
|
4704
|
-
);
|
|
4705
|
-
const renderPerson = props.renderPerson ?? ((p) => /* @__PURE__ */ jsxRuntime.jsx(PersonPill, { person: p }));
|
|
4706
|
-
const actionText = (w) => {
|
|
4707
|
-
if (w.action)
|
|
4708
|
-
return w.action.type === "email_documents" ? "Email latest documents" : "AI Review";
|
|
4709
|
-
if (isSkillRow(w))
|
|
4710
|
-
return w.description || w.skill_ref && props.skillNames?.[w.skill_ref] || w.name;
|
|
4711
|
-
return w.skill_ref ? props.skillNames?.[w.skill_ref] ?? w.skill_ref : w.prompt?.trim() || l.reminder;
|
|
4712
|
-
};
|
|
4713
|
-
const latest = react.useRef({ props, l, renderPerson, actionText });
|
|
4714
|
-
latest.current = { props, l, renderPerson, actionText };
|
|
4715
|
-
const columnDefs = react.useMemo(
|
|
4716
|
-
() => createWorkflowColumns({
|
|
4717
|
-
labels: l,
|
|
4718
|
-
getTriggerText: (w) => isSkillRow(w) ? l.statusOnDemand : latest.current.props.describeTrigger(w),
|
|
4719
|
-
renderName: (w) => {
|
|
4720
|
-
const { l: lb } = latest.current;
|
|
4721
|
-
const skill = isSkillRow(w);
|
|
4722
|
-
const text = skill ? latest.current.actionText(w) : w.description || latest.current.actionText(w);
|
|
4723
|
-
const stem = w.name.replace(/…$/, "").trim();
|
|
4724
|
-
const about = text && text.trim() !== w.name.trim() && text.trim() !== stem ? text : "";
|
|
4725
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 leading-tight", children: [
|
|
4726
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex min-w-0 items-center gap-1.5", children: [
|
|
4727
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4728
|
-
"span",
|
|
4729
|
-
{
|
|
4730
|
-
className: ui.cn(
|
|
4731
|
-
"truncate text-sm font-normal",
|
|
4732
|
-
workflowStatus(w) === "paused" && "text-muted-foreground"
|
|
4733
|
-
),
|
|
4734
|
-
"data-testid": `workflow-name-${w.external_id}`,
|
|
4735
|
-
children: w.name
|
|
4736
|
-
}
|
|
4737
|
-
),
|
|
4738
|
-
skill && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4739
|
-
"span",
|
|
4740
|
-
{
|
|
4741
|
-
className: "shrink-0 rounded-full border border-border px-1.5 text-[11px] text-muted-foreground",
|
|
4742
|
-
"data-testid": `workflow-type-${w.external_id}`,
|
|
4743
|
-
children: lb.typeSkill
|
|
4744
|
-
}
|
|
4745
|
-
)
|
|
4746
|
-
] }),
|
|
4747
|
-
about && !latest.current.props.automationsOnly && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4748
|
-
"p",
|
|
4749
|
-
{
|
|
4750
|
-
className: "truncate text-xs text-muted-foreground",
|
|
4751
|
-
"data-testid": `workflow-action-${w.external_id}`,
|
|
4752
|
-
children: about
|
|
4753
|
-
}
|
|
4754
|
-
)
|
|
4755
|
-
] });
|
|
4756
|
-
},
|
|
4757
|
-
renderTrigger: (w) => {
|
|
4758
|
-
const { props: p } = latest.current;
|
|
4759
|
-
const after = w.after_conversation_ext_id;
|
|
4760
|
-
const skill = isSkillRow(w);
|
|
4761
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-w-0 leading-tight", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4762
|
-
TaskTriggerChip,
|
|
4763
|
-
{
|
|
4764
|
-
id: w.external_id,
|
|
4765
|
-
testId: `workflow-trigger-${w.external_id}`,
|
|
4766
|
-
triggerType: workflowTriggerType(w),
|
|
4767
|
-
summary: skill ? "" : p.describeTrigger(w),
|
|
4768
|
-
afterTaskId: after,
|
|
4769
|
-
afterTaskName: after ? p.taskNames?.[after] : void 0,
|
|
4770
|
-
labels: p.triggerChipLabels
|
|
4771
|
-
}
|
|
4772
|
-
) });
|
|
4773
|
-
},
|
|
4774
|
-
renderStatus: (w) => {
|
|
4775
|
-
const { props: p, l: lb } = latest.current;
|
|
4776
|
-
const canEdit = w.is_owner !== false || Boolean(p.canEditShared);
|
|
4777
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4778
|
-
ui.Switch,
|
|
4779
|
-
{
|
|
4780
|
-
checked: hasTrigger(w) && !isSkillRow(w) && Boolean(w.active),
|
|
4781
|
-
disabled: !hasTrigger(w) || isSkillRow(w) || !canEdit || p.busyId === w.external_id,
|
|
4782
|
-
onCheckedChange: (next) => p.onToggleActive(w, next),
|
|
4783
|
-
className: "disabled:data-[state=unchecked]:bg-muted dark:disabled:data-[state=unchecked]:bg-muted",
|
|
4784
|
-
"aria-label": lb.activeSwitch(w.name),
|
|
4785
|
-
"data-testid": `workflow-active-${w.external_id}`
|
|
4786
|
-
}
|
|
4787
|
-
);
|
|
4788
|
-
},
|
|
4789
|
-
renderShared: (w) => {
|
|
4790
|
-
const { props: p, l: lb } = latest.current;
|
|
4791
|
-
if (!p.onToggleShared || isSkillRow(w)) return null;
|
|
4792
|
-
const isCreator = w.is_owner !== false;
|
|
4793
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4794
|
-
ui.VisibilityToggle,
|
|
4795
|
-
{
|
|
4796
|
-
items: { shared: w.shared ?? false },
|
|
4797
|
-
onToggle: (share) => latest.current.props.onToggleShared?.(w, share),
|
|
4798
|
-
disabled: !isCreator || p.busyId === w.external_id,
|
|
4799
|
-
disabledTooltip: lb.sharedOwnerOnly,
|
|
4800
|
-
showLabel: false,
|
|
4801
|
-
"data-testid": `workflow-shared-${w.external_id}`
|
|
4802
|
-
}
|
|
4803
|
-
);
|
|
4804
|
-
},
|
|
4805
|
-
renderLastRun: (w) => {
|
|
4806
|
-
const { props: p, l: lb } = latest.current;
|
|
4807
|
-
const at = w.last_fired_at ?? p.lastRuns?.[w.external_id]?.at;
|
|
4808
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4809
|
-
"button",
|
|
4810
|
-
{
|
|
4811
|
-
type: "button",
|
|
4812
|
-
className: "h-full w-full truncate px-4 text-left text-sm hover:text-primary",
|
|
4813
|
-
onClick: () => p.onViewRuns?.(w),
|
|
4814
|
-
title: "View run history",
|
|
4815
|
-
"data-testid": `workflow-last-run-${w.external_id}`,
|
|
4816
|
-
children: at ? p.formatDate(at) : lb.never
|
|
4817
|
-
}
|
|
4818
|
-
);
|
|
4819
|
-
},
|
|
4820
|
-
renderResult: (w) => {
|
|
4821
|
-
const status = listedRunStatus(
|
|
4822
|
-
w.last_run_status,
|
|
4823
|
-
latest.current.props.lastRuns?.[w.external_id]?.threadStatus
|
|
4824
|
-
);
|
|
4825
|
-
const label = workflowRunStatusLabel(status);
|
|
4826
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4827
|
-
"button",
|
|
4828
|
-
{
|
|
4829
|
-
type: "button",
|
|
4830
|
-
onClick: () => latest.current.props.onViewRuns?.(w),
|
|
4831
|
-
title: "View run history",
|
|
4832
|
-
className: ui.cn(
|
|
4833
|
-
ui.badgeVariants({ variant: "outline" }),
|
|
4834
|
-
"mx-4 cursor-pointer text-xs font-medium",
|
|
4835
|
-
status === "failed" ? "border-red-border bg-red-bg text-red-text hover:bg-red-bg/80" : status === "completed" || status === "success" ? "border-green-border bg-green-bg text-green-text hover:bg-green-bg/80" : status ? "border-primary/20 bg-primary/10 text-primary hover:bg-primary/15" : "border-border bg-muted text-muted-foreground hover:bg-muted/80"
|
|
4836
|
-
),
|
|
4837
|
-
"data-testid": `workflow-result-${w.external_id}`,
|
|
4838
|
-
children: label
|
|
4839
|
-
}
|
|
4840
|
-
);
|
|
4841
|
-
},
|
|
4842
|
-
renderActions: (w) => {
|
|
4843
|
-
const { props: p, l: lb } = latest.current;
|
|
4844
|
-
const id = w.external_id;
|
|
4845
|
-
const skill = isSkillRow(w);
|
|
4846
|
-
const busy = p.busyId === id;
|
|
4847
|
-
const isOwner = w.is_owner !== false;
|
|
4848
|
-
const canEdit = isOwner || Boolean(p.canEditShared);
|
|
4849
|
-
const canAdmin = isOwner || Boolean(p.isWorkspaceOwner);
|
|
4850
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-end gap-1", children: [
|
|
4851
|
-
(skill || canEdit) && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4852
|
-
ui.Button,
|
|
4853
|
-
{
|
|
4854
|
-
size: "sm",
|
|
4855
|
-
variant: "outline",
|
|
4856
|
-
className: "h-8 gap-1.5 pointer-coarse:h-11",
|
|
4857
|
-
disabled: busy,
|
|
4858
|
-
onClick: () => p.onRun(w),
|
|
4859
|
-
"data-testid": `workflow-run-btn-${id}`,
|
|
4860
|
-
children: [
|
|
4861
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Play, { className: "size-3.5", "aria-hidden": true }),
|
|
4862
|
-
lb.run
|
|
4863
|
-
]
|
|
4864
|
-
}
|
|
4865
|
-
),
|
|
4866
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.DropdownMenu, { children: [
|
|
4867
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4868
|
-
ui.Button,
|
|
4869
|
-
{
|
|
4870
|
-
variant: "ghost",
|
|
4871
|
-
size: "icon",
|
|
4872
|
-
className: "size-8 pointer-coarse:size-11",
|
|
4873
|
-
"aria-label": lb.moreActions,
|
|
4874
|
-
"data-testid": `workflow-menu-${id}`,
|
|
4875
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.MoreHorizontal, { className: "size-4", "aria-hidden": true })
|
|
4876
|
-
}
|
|
4877
|
-
) }),
|
|
4878
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.DropdownMenuContent, { align: "end", children: [
|
|
4879
|
-
skill && p.onRunLater && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4880
|
-
ui.DropdownMenuItem,
|
|
4881
|
-
{
|
|
4882
|
-
onSelect: () => p.onRunLater?.(w),
|
|
4883
|
-
"data-testid": `workflow-run-later-${id}`,
|
|
4884
|
-
children: [
|
|
4885
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.History, { className: "mr-2 size-4", "aria-hidden": true }),
|
|
4886
|
-
lb.runLater
|
|
4887
|
-
]
|
|
4888
|
-
}
|
|
4889
|
-
),
|
|
4890
|
-
!skill && canEdit && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4891
|
-
ui.DropdownMenuItem,
|
|
4892
|
-
{
|
|
4893
|
-
onSelect: () => p.onEdit(w),
|
|
4894
|
-
"data-testid": `workflow-edit-${id}`,
|
|
4895
|
-
children: [
|
|
4896
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Pencil, { className: "mr-2 size-4", "aria-hidden": true }),
|
|
4897
|
-
lb.editWorkflow
|
|
4898
|
-
]
|
|
4899
|
-
}
|
|
4900
|
-
),
|
|
4901
|
-
!skill && p.onViewRuns && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4902
|
-
ui.DropdownMenuItem,
|
|
4903
|
-
{
|
|
4904
|
-
onSelect: () => p.onViewRuns?.(w),
|
|
4905
|
-
"data-testid": `workflow-runs-${id}`,
|
|
4906
|
-
children: [
|
|
4907
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.History, { className: "mr-2 size-4", "aria-hidden": true }),
|
|
4908
|
-
lb.runs
|
|
4909
|
-
]
|
|
4910
|
-
}
|
|
4911
|
-
),
|
|
4912
|
-
!skill && canEdit && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4913
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.DropdownMenuSeparator, {}),
|
|
4914
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
4915
|
-
ui.DropdownMenuItem,
|
|
4916
|
-
{
|
|
4917
|
-
disabled: busy || !canAdmin,
|
|
4918
|
-
onSelect: () => p.onDelete(w),
|
|
4919
|
-
title: canAdmin ? void 0 : lb.deleteOwnerOnly,
|
|
4920
|
-
className: "text-destructive focus:text-destructive",
|
|
4921
|
-
"data-testid": `workflow-delete-${id}`,
|
|
4922
|
-
children: [
|
|
4923
|
-
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Trash2, { className: "mr-2 size-4", "aria-hidden": true }),
|
|
4924
|
-
lb.delete
|
|
4925
|
-
]
|
|
4926
|
-
}
|
|
4927
|
-
)
|
|
4928
|
-
] })
|
|
4929
|
-
] })
|
|
4930
|
-
] })
|
|
4931
|
-
] });
|
|
4932
|
-
}
|
|
4933
|
-
}),
|
|
4934
|
-
// Stable on purpose: only the header texts rebuild the columns (see `latest`).
|
|
4935
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4936
|
-
[
|
|
4937
|
-
l.colName,
|
|
4938
|
-
l.colType,
|
|
4939
|
-
l.colTrigger,
|
|
4940
|
-
l.colAction,
|
|
4941
|
-
l.colAgent,
|
|
4942
|
-
l.colStatus,
|
|
4943
|
-
l.colShared,
|
|
4944
|
-
l.shared,
|
|
4945
|
-
l.colLastRun,
|
|
4946
|
-
l.colNextRun
|
|
4947
|
-
]
|
|
4948
|
-
);
|
|
4949
|
-
react.useEffect(() => {
|
|
4950
|
-
apiRef.current?.refreshCells({ force: true });
|
|
4951
|
-
}, [
|
|
4952
|
-
busyId,
|
|
4953
|
-
props.agentNames,
|
|
4954
|
-
props.skillNames,
|
|
4955
|
-
props.taskNames,
|
|
4956
|
-
props.lastRuns,
|
|
4957
|
-
props.renderPerson,
|
|
4958
|
-
props.labels,
|
|
4959
|
-
props.canEditShared,
|
|
4960
|
-
props.isWorkspaceOwner
|
|
4961
|
-
]);
|
|
4962
|
-
const mine = selected.filter((w) => !isSkillRow(w));
|
|
4963
|
-
const adminSelected = mine.filter((w) => w.is_owner !== false || props.isWorkspaceOwner);
|
|
4964
|
-
const editableSelected = mine.filter(
|
|
4965
|
-
(w) => hasTrigger(w) && (w.is_owner !== false || props.canEditShared)
|
|
4966
|
-
);
|
|
4967
|
-
const clearSelection = () => setSelected([]);
|
|
4968
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4969
|
-
"div",
|
|
4970
|
-
{
|
|
4971
|
-
className: "flex min-h-0 flex-1 flex-col",
|
|
4972
|
-
"data-testid": chunkMHVNT4J3_cjs.testIdOr(testId, { testId: "workflow-list" }),
|
|
4973
|
-
children: [
|
|
4974
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4975
|
-
chunk7RGLTF76_cjs.TabHeader,
|
|
4976
|
-
{
|
|
4977
|
-
testId: "automations-tab-header",
|
|
4978
|
-
tabs: [
|
|
4979
|
-
{
|
|
4980
|
-
id: "automations",
|
|
4981
|
-
label: "",
|
|
4982
|
-
count: shown.length,
|
|
4983
|
-
countIcon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Workflow, { className: "size-3.5" }),
|
|
4984
|
-
countPlacement: "leading",
|
|
4985
|
-
presentation: "count",
|
|
4986
|
-
hasActiveFilters: !!q || [...filterStates.values()].some(Boolean)
|
|
4987
|
-
},
|
|
4988
|
-
...props.tabs ?? []
|
|
4989
|
-
],
|
|
4990
|
-
activeTabId: props.activeTabId ?? "automations",
|
|
4991
|
-
onTabChange: props.onTabChange ?? (() => {
|
|
4992
|
-
}),
|
|
4993
|
-
firstTabContent: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4994
|
-
chunk2EI7NCUA_cjs.FilterInput,
|
|
4995
|
-
{
|
|
4996
|
-
value: query,
|
|
4997
|
-
onChange: setQuery,
|
|
4998
|
-
fields: ["text"],
|
|
4999
|
-
onFieldsChange: () => {
|
|
5000
|
-
},
|
|
5001
|
-
hideFieldPicker: true,
|
|
5002
|
-
ariaLabel: l.searchLabel,
|
|
5003
|
-
testIds: { input: "workflow-search" },
|
|
5004
|
-
filter: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5005
|
-
chunkMIDXCYZB_cjs.TriStateFilterMenu,
|
|
5006
|
-
{
|
|
5007
|
-
testId: "automations-filter-button",
|
|
5008
|
-
open: filterOpen,
|
|
5009
|
-
onOpenChange: setFilterOpen,
|
|
5010
|
-
filterStates,
|
|
5011
|
-
onFiltersChange: setFilterStates,
|
|
5012
|
-
triggerClassName: "flex h-5 items-center gap-0.5 rounded px-1 text-muted-foreground hover:text-foreground pointer-coarse:h-11! pointer-coarse:min-w-11 pointer-coarse:justify-center",
|
|
5013
|
-
renderChevron: true,
|
|
5014
|
-
disableHoverOpen: true,
|
|
5015
|
-
options: [
|
|
5016
|
-
...!props.automationsOnly ? [
|
|
5017
|
-
{ id: "skills", label: l.filterSkills, count: counts.skills },
|
|
5018
|
-
{
|
|
5019
|
-
id: "workflows",
|
|
5020
|
-
label: l.filterWorkflows,
|
|
5021
|
-
count: counts.workflows
|
|
5022
|
-
}
|
|
5023
|
-
] : [],
|
|
5024
|
-
{ id: "active", label: l.filterActive, count: counts.active },
|
|
5025
|
-
{ id: "paused", label: l.filterPaused, count: counts.paused }
|
|
5026
|
-
]
|
|
5027
|
-
}
|
|
5028
|
-
)
|
|
5029
|
-
}
|
|
5030
|
-
),
|
|
5031
|
-
rightContent: header
|
|
5032
|
-
}
|
|
5033
|
-
),
|
|
5034
|
-
props.content ? props.content : workflows.length === 0 && !isLoading ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
5035
|
-
chunkZW6FPIFC_cjs.EmptyState,
|
|
5036
|
-
{
|
|
5037
|
-
icon: lucideReact.Workflow,
|
|
5038
|
-
title: l.emptyTitle,
|
|
5039
|
-
description: l.emptyMessage,
|
|
5040
|
-
testId: "workflow-list-empty"
|
|
5041
|
-
}
|
|
5042
|
-
) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5043
|
-
chunkC2CWWEHO_cjs.GridView,
|
|
5044
|
-
{
|
|
5045
|
-
testId: "workflow-grid",
|
|
5046
|
-
gridId: props.gridId ?? "workflows-grid-v2",
|
|
5047
|
-
items: shown,
|
|
5048
|
-
columnDefs,
|
|
5049
|
-
getItemId: (w) => w.external_id,
|
|
5050
|
-
getRowTestId: (w) => `workflow-row-${w.external_id}`,
|
|
5051
|
-
isLoading,
|
|
5052
|
-
showEmpty: shown.length === 0,
|
|
5053
|
-
emptyState: { title: l.noMatches },
|
|
5054
|
-
rowHeight: ROW_HEIGHT,
|
|
5055
|
-
height: "100%",
|
|
5056
|
-
onGridReady: ({ api }) => {
|
|
5057
|
-
apiRef.current = api;
|
|
5058
|
-
},
|
|
5059
|
-
onRowClick: (row) => props.onOpenRow?.(row),
|
|
5060
|
-
selection: { mode: "multiple", selected, onSelectionChange: setSelected },
|
|
5061
|
-
gridOptions: GRID_OPTIONS
|
|
5062
|
-
}
|
|
5063
|
-
) }),
|
|
5064
|
-
!props.content && /* @__PURE__ */ jsxRuntime.jsx(chunkV4ISCZJ7_cjs.SelectionBar, { count: selected.length, onClear: clearSelection, children: (isCompact) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5065
|
-
props.onToggleActiveMany && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5066
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5067
|
-
chunkV4ISCZJ7_cjs.SelectionBarAction,
|
|
5068
|
-
{
|
|
5069
|
-
icon: lucideReact.Play,
|
|
5070
|
-
label: l.makeActive,
|
|
5071
|
-
onClick: () => {
|
|
5072
|
-
props.onToggleActiveMany?.(editableSelected, true);
|
|
5073
|
-
clearSelection();
|
|
5074
|
-
},
|
|
5075
|
-
disabled: editableSelected.length === 0,
|
|
5076
|
-
isCompact,
|
|
5077
|
-
testId: "workflow-bulk-activate"
|
|
5078
|
-
}
|
|
5079
|
-
),
|
|
5080
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5081
|
-
chunkV4ISCZJ7_cjs.SelectionBarAction,
|
|
5082
|
-
{
|
|
5083
|
-
icon: lucideReact.Workflow,
|
|
5084
|
-
label: l.makePaused,
|
|
5085
|
-
onClick: () => {
|
|
5086
|
-
props.onToggleActiveMany?.(editableSelected, false);
|
|
5087
|
-
clearSelection();
|
|
5088
|
-
},
|
|
5089
|
-
disabled: editableSelected.length === 0,
|
|
5090
|
-
isCompact,
|
|
5091
|
-
testId: "workflow-bulk-pause"
|
|
5092
|
-
}
|
|
5093
|
-
)
|
|
5094
|
-
] }),
|
|
5095
|
-
props.onDeleteMany && /* @__PURE__ */ jsxRuntime.jsx(
|
|
5096
|
-
chunkV4ISCZJ7_cjs.SelectionBarAction,
|
|
5097
|
-
{
|
|
5098
|
-
icon: lucideReact.Trash2,
|
|
5099
|
-
label: l.delete,
|
|
5100
|
-
onClick: () => {
|
|
5101
|
-
props.onDeleteMany?.(adminSelected);
|
|
5102
|
-
clearSelection();
|
|
5103
|
-
},
|
|
5104
|
-
disabled: adminSelected.length === 0,
|
|
5105
|
-
isCompact,
|
|
5106
|
-
className: "border-red-border text-red-text hover:bg-red-bg hover:text-red-text",
|
|
5107
|
-
testId: "workflow-bulk-delete"
|
|
5108
|
-
}
|
|
5109
|
-
)
|
|
5110
|
-
] }) })
|
|
5111
|
-
]
|
|
5112
|
-
}
|
|
5113
|
-
);
|
|
5114
|
-
}
|
|
5115
|
-
var GRID_OPTIONS = { suppressClickEdit: true };
|
|
5116
3531
|
var DEFAULT_TASK_ACTIVITY_LABELS = {
|
|
5117
3532
|
title: "Activity",
|
|
5118
3533
|
empty: "Nothing has happened yet.",
|
|
@@ -5199,12 +3614,12 @@ function taskActivityHeadline(e, labels = DEFAULT_TASK_ACTIVITY_LABELS, agentNam
|
|
|
5199
3614
|
case "step_skipped":
|
|
5200
3615
|
return "Step skipped";
|
|
5201
3616
|
case "step_waiting": {
|
|
5202
|
-
const documents =
|
|
5203
|
-
return documents ?
|
|
3617
|
+
const documents = chunkJSTKEZBS_cjs.eventWaitingDocuments(detail);
|
|
3618
|
+
return documents ? chunkJSTKEZBS_cjs.waitingForDocumentsText(documents.length) : "Waiting on people";
|
|
5204
3619
|
}
|
|
5205
3620
|
case "step_progress": {
|
|
5206
|
-
const documents =
|
|
5207
|
-
return documents ?
|
|
3621
|
+
const documents = chunkJSTKEZBS_cjs.eventWaitingDocuments(detail);
|
|
3622
|
+
return documents ? chunkJSTKEZBS_cjs.waitingForDocumentsText(documents.length) : detail.signed ? "Signed" : "Step moved on";
|
|
5208
3623
|
}
|
|
5209
3624
|
case "step_sent_back":
|
|
5210
3625
|
return "Sent the work back";
|
|
@@ -5379,7 +3794,7 @@ function TaskRunsDialog({
|
|
|
5379
3794
|
"rounded-full px-2 py-0.5 text-xs font-medium capitalize",
|
|
5380
3795
|
STATUS_STYLE[data.status] ?? "text-muted-foreground"
|
|
5381
3796
|
),
|
|
5382
|
-
children: workflowRunStatusLabel(data.status)
|
|
3797
|
+
children: chunkO2ODDTMA_cjs.workflowRunStatusLabel(data.status)
|
|
5383
3798
|
}
|
|
5384
3799
|
)
|
|
5385
3800
|
},
|
|
@@ -5474,7 +3889,6 @@ exports.ActionStepBody = ActionStepBody;
|
|
|
5474
3889
|
exports.AgentAvatarField = AgentAvatarField;
|
|
5475
3890
|
exports.AgentConnectInstructions = AgentConnectInstructions;
|
|
5476
3891
|
exports.AgentCreator = AgentCreator;
|
|
5477
|
-
exports.AgentSelect = AgentSelect;
|
|
5478
3892
|
exports.AgentTypeSelector = AgentTypeSelector;
|
|
5479
3893
|
exports.ApprovalEvidence = ApprovalEvidence;
|
|
5480
3894
|
exports.AssigneeLine = AssigneeLine;
|
|
@@ -5483,11 +3897,9 @@ exports.CapabilityTile = CapabilityTile;
|
|
|
5483
3897
|
exports.DEFAULT_AGENT_AVATAR_FIELD_LABELS = DEFAULT_AGENT_AVATAR_FIELD_LABELS;
|
|
5484
3898
|
exports.DEFAULT_AGENT_CAPABILITIES = DEFAULT_AGENT_CAPABILITIES;
|
|
5485
3899
|
exports.DEFAULT_AGENT_CREATOR_LABELS = DEFAULT_AGENT_CREATOR_LABELS;
|
|
5486
|
-
exports.DEFAULT_AGENT_SELECT_LABELS = DEFAULT_AGENT_SELECT_LABELS;
|
|
5487
3900
|
exports.DEFAULT_AGENT_TEMPLATES = DEFAULT_AGENT_TEMPLATES;
|
|
5488
3901
|
exports.DEFAULT_AGENT_TYPES = DEFAULT_AGENT_TYPES;
|
|
5489
3902
|
exports.DEFAULT_AGENT_TYPE_SELECTOR_LABELS = DEFAULT_AGENT_TYPE_SELECTOR_LABELS;
|
|
5490
|
-
exports.DEFAULT_SCHEMA_FORM_LABELS = DEFAULT_SCHEMA_FORM_LABELS;
|
|
5491
3903
|
exports.DEFAULT_SKILL_EDIT_FORM_LABELS = DEFAULT_SKILL_EDIT_FORM_LABELS;
|
|
5492
3904
|
exports.DEFAULT_SKILL_GENERATE_FORM_LABELS = DEFAULT_SKILL_GENERATE_FORM_LABELS;
|
|
5493
3905
|
exports.DEFAULT_SKILL_GLOBAL_BADGE_LABELS = DEFAULT_SKILL_GLOBAL_BADGE_LABELS;
|
|
@@ -5495,13 +3907,8 @@ exports.DEFAULT_SKILL_VIEW_TOGGLE_LABELS = DEFAULT_SKILL_VIEW_TOGGLE_LABELS;
|
|
|
5495
3907
|
exports.DEFAULT_STEP_BAR_LABELS = DEFAULT_STEP_BAR_LABELS;
|
|
5496
3908
|
exports.DEFAULT_TASK_ACTIVITY_LABELS = DEFAULT_TASK_ACTIVITY_LABELS;
|
|
5497
3909
|
exports.DEFAULT_TASK_RUNS_DIALOG_LABELS = DEFAULT_TASK_RUNS_DIALOG_LABELS;
|
|
5498
|
-
exports.DEFAULT_TASK_TRIGGER_CHIP_LABELS = DEFAULT_TASK_TRIGGER_CHIP_LABELS;
|
|
5499
|
-
exports.DEFAULT_WORKFLOW_CONFIG_DIALOG_LABELS = DEFAULT_WORKFLOW_CONFIG_DIALOG_LABELS;
|
|
5500
|
-
exports.DEFAULT_WORKFLOW_DOCUMENTS_FIELD_LABELS = DEFAULT_WORKFLOW_DOCUMENTS_FIELD_LABELS;
|
|
5501
|
-
exports.DEFAULT_WORKFLOW_LIST_LABELS = DEFAULT_WORKFLOW_LIST_LABELS;
|
|
5502
3910
|
exports.DEFAULT_WORKFLOW_RUNNER_LABELS = DEFAULT_WORKFLOW_RUNNER_LABELS;
|
|
5503
3911
|
exports.DEFAULT_WORKFLOW_STEP_PARTS_LABELS = DEFAULT_WORKFLOW_STEP_PARTS_LABELS;
|
|
5504
|
-
exports.PersonPill = PersonPill;
|
|
5505
3912
|
exports.SKILL_FIELD_TYPE_LABELS = SKILL_FIELD_TYPE_LABELS;
|
|
5506
3913
|
exports.SKILL_MAIN_FILENAME = SKILL_MAIN_FILENAME;
|
|
5507
3914
|
exports.SKILL_SOURCE_LABELS = SKILL_SOURCE_LABELS;
|
|
@@ -5510,7 +3917,6 @@ exports.SKILL_TYPE_LABELS = SKILL_TYPE_LABELS;
|
|
|
5510
3917
|
exports.STEP_LABEL = STEP_LABEL;
|
|
5511
3918
|
exports.STEP_LABEL_CURRENT = STEP_LABEL_CURRENT;
|
|
5512
3919
|
exports.STEP_LABEL_MAX = STEP_LABEL_MAX;
|
|
5513
|
-
exports.SchemaForm = SchemaForm;
|
|
5514
3920
|
exports.SendBackControl = SendBackControl;
|
|
5515
3921
|
exports.SkillActionButton = SkillActionButton;
|
|
5516
3922
|
exports.SkillDetail = SkillDetail;
|
|
@@ -5527,39 +3933,27 @@ exports.StepBarFrame = StepBarFrame;
|
|
|
5527
3933
|
exports.TaskActivityDialog = TaskActivityDialog;
|
|
5528
3934
|
exports.TaskActivityTimeline = TaskActivityTimeline;
|
|
5529
3935
|
exports.TaskRunsDialog = TaskRunsDialog;
|
|
5530
|
-
exports.TaskTriggerChip = TaskTriggerChip;
|
|
5531
|
-
exports.WORKFLOW_COLUMN_ORDER = WORKFLOW_COLUMN_ORDER;
|
|
5532
|
-
exports.WorkflowConfigDialog = WorkflowConfigDialog;
|
|
5533
|
-
exports.WorkflowDocumentsField = WorkflowDocumentsField;
|
|
5534
|
-
exports.WorkflowLauncher = WorkflowLauncher;
|
|
5535
3936
|
exports.WorkflowRunner = WorkflowRunner;
|
|
5536
3937
|
exports.WorkflowStepBar = WorkflowStepBar;
|
|
5537
|
-
exports.WorkflowsTable = WorkflowsTable;
|
|
5538
3938
|
exports.activateOnKey = activateOnKey;
|
|
5539
3939
|
exports.activeStepId = activeStepId;
|
|
5540
3940
|
exports.agentConfigSectionToValues = agentConfigSectionToValues;
|
|
5541
3941
|
exports.agentCreatorToConfigSection = agentCreatorToConfigSection;
|
|
5542
3942
|
exports.buildLibrarySkills = buildLibrarySkills;
|
|
5543
|
-
exports.buildWorkflowScopeSource = buildWorkflowScopeSource;
|
|
5544
3943
|
exports.buildZipSkillImport = buildZipSkillImport;
|
|
5545
3944
|
exports.composePersona = composePersona;
|
|
5546
|
-
exports.createWorkflowColumns = createWorkflowColumns;
|
|
5547
3945
|
exports.deriveAgentName = deriveAgentName;
|
|
5548
|
-
exports.documentScopeLabels = documentScopeLabels;
|
|
5549
3946
|
exports.filterLibrarySkills = filterLibrarySkills;
|
|
5550
3947
|
exports.fromPlanAssignee = fromPlanAssignee;
|
|
5551
3948
|
exports.fromPlanDocumentRef = fromPlanDocumentRef;
|
|
5552
3949
|
exports.fromPlanSteps = fromPlanSteps;
|
|
5553
|
-
exports.hasTrigger = hasTrigger;
|
|
5554
3950
|
exports.importMarkdownSkill = importMarkdownSkill;
|
|
5555
3951
|
exports.importSkillFile = importSkillFile;
|
|
5556
3952
|
exports.importSkillFromUrl = importSkillFromUrl;
|
|
5557
3953
|
exports.isIncompleteSignal = isIncompleteSignal;
|
|
5558
3954
|
exports.isMainSkillFile = isMainSkillFile;
|
|
5559
|
-
exports.isSkillRow = isSkillRow;
|
|
5560
3955
|
exports.isValidAgentName = isValidAgentName;
|
|
5561
3956
|
exports.layoutFromPlanSteps = layoutFromPlanSteps;
|
|
5562
|
-
exports.matchWorkflowScope = matchWorkflowScope;
|
|
5563
3957
|
exports.parseSkillFrontmatter = parseSkillFrontmatter;
|
|
5564
3958
|
exports.readSkillArchive = readSkillArchive;
|
|
5565
3959
|
exports.serializeSkill = serializeSkill;
|
|
@@ -5574,8 +3968,6 @@ exports.toPlanDocumentRef = toPlanDocumentRef;
|
|
|
5574
3968
|
exports.toPlanSteps = toPlanSteps;
|
|
5575
3969
|
exports.useWorkflowView = useWorkflowView;
|
|
5576
3970
|
exports.workflowFromSkillMarkdown = workflowFromSkillMarkdown;
|
|
5577
|
-
exports.workflowStatus = workflowStatus;
|
|
5578
3971
|
exports.workflowToSkillMarkdown = workflowToSkillMarkdown;
|
|
5579
|
-
|
|
5580
|
-
//# sourceMappingURL=chunk-
|
|
5581
|
-
//# sourceMappingURL=chunk-DPGFEMVT.cjs.map
|
|
3972
|
+
//# sourceMappingURL=chunk-ABUO6PIQ.cjs.map
|
|
3973
|
+
//# sourceMappingURL=chunk-ABUO6PIQ.cjs.map
|