@arbidocs/blocks 0.4.136 → 0.4.138

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.
Files changed (110) hide show
  1. package/dist/agents/index.cjs +384 -353
  2. package/dist/agents/index.js +8 -9
  3. package/dist/agents/skills/SkillLibraryDetail.d.ts +26 -0
  4. package/dist/agents/skills/index.d.ts +2 -0
  5. package/dist/agents/skills/skillLibrary.d.ts +46 -0
  6. package/dist/agents/workflows/WorkflowDocumentsField.d.ts +42 -5
  7. package/dist/agents/workflows/index.d.ts +2 -2
  8. package/dist/agents/workflows/workspaceScope.d.ts +12 -0
  9. package/dist/calls/index.cjs +3 -3
  10. package/dist/calls/index.js +2 -2
  11. package/dist/chunk-2KUCVSFF.js +51 -0
  12. package/dist/chunk-2KUCVSFF.js.map +1 -0
  13. package/dist/{chunk-LIHRGG4M.cjs → chunk-3BI6EWKP.cjs} +2022 -89
  14. package/dist/chunk-3BI6EWKP.cjs.map +1 -0
  15. package/dist/{chunk-3FFRYZKV.js → chunk-3RJN2VTL.js} +36 -6
  16. package/dist/chunk-3RJN2VTL.js.map +1 -0
  17. package/dist/{chunk-OR4CO743.cjs → chunk-AAFX64WD.cjs} +3 -3
  18. package/dist/{chunk-OR4CO743.cjs.map → chunk-AAFX64WD.cjs.map} +1 -1
  19. package/dist/chunk-CQCC7LE7.js +210 -0
  20. package/dist/chunk-CQCC7LE7.js.map +1 -0
  21. package/dist/{chunk-ZAVEMQ37.cjs → chunk-DWZXSPMB.cjs} +3 -3
  22. package/dist/{chunk-ZAVEMQ37.cjs.map → chunk-DWZXSPMB.cjs.map} +1 -1
  23. package/dist/{chunk-VIU7AMHF.js → chunk-E5OYHJMU.js} +3 -3
  24. package/dist/{chunk-VIU7AMHF.js.map → chunk-E5OYHJMU.js.map} +1 -1
  25. package/dist/{chunk-RUB62J2X.js → chunk-ED4HHTIA.js} +3 -3
  26. package/dist/{chunk-RUB62J2X.js.map → chunk-ED4HHTIA.js.map} +1 -1
  27. package/dist/{chunk-5HFPRI3W.js → chunk-FUTMU4FR.js} +3 -3
  28. package/dist/{chunk-5HFPRI3W.js.map → chunk-FUTMU4FR.js.map} +1 -1
  29. package/dist/{chunk-C44D4WFG.cjs → chunk-HLB4DIYV.cjs} +3 -3
  30. package/dist/{chunk-C44D4WFG.cjs.map → chunk-HLB4DIYV.cjs.map} +1 -1
  31. package/dist/{chunk-N55UIXVT.cjs → chunk-JVL7HUIQ.cjs} +5 -5
  32. package/dist/{chunk-N55UIXVT.cjs.map → chunk-JVL7HUIQ.cjs.map} +1 -1
  33. package/dist/{chunk-6S5FLMWG.js → chunk-KSHKTOY2.js} +203 -7
  34. package/dist/chunk-KSHKTOY2.js.map +1 -0
  35. package/dist/{chunk-OZLWSNUC.cjs → chunk-MJKBVIV3.cjs} +83 -1650
  36. package/dist/chunk-MJKBVIV3.cjs.map +1 -0
  37. package/dist/{chunk-DJM7DLCT.cjs → chunk-OPTBQSCV.cjs} +3 -3
  38. package/dist/{chunk-DJM7DLCT.cjs.map → chunk-OPTBQSCV.cjs.map} +1 -1
  39. package/dist/{chunk-GFYGYME3.js → chunk-OQ7RUNOC.js} +3 -3
  40. package/dist/{chunk-GFYGYME3.js.map → chunk-OQ7RUNOC.js.map} +1 -1
  41. package/dist/chunk-RFIBUWLF.cjs +232 -0
  42. package/dist/chunk-RFIBUWLF.cjs.map +1 -0
  43. package/dist/{chunk-N26CXGXC.cjs → chunk-RQ2Y7USX.cjs} +201 -3
  44. package/dist/chunk-RQ2Y7USX.cjs.map +1 -0
  45. package/dist/{chunk-LT2X5N37.js → chunk-UBEI6WFJ.js} +58 -1592
  46. package/dist/chunk-UBEI6WFJ.js.map +1 -0
  47. package/dist/chunk-UUHUQHXR.cjs +56 -0
  48. package/dist/chunk-UUHUQHXR.cjs.map +1 -0
  49. package/dist/{chunk-ECERC6TI.js → chunk-VHJHY7TT.js} +3 -3
  50. package/dist/{chunk-ECERC6TI.js.map → chunk-VHJHY7TT.js.map} +1 -1
  51. package/dist/{chunk-44R3CCZT.cjs → chunk-WS5EX7DN.cjs} +37 -6
  52. package/dist/chunk-WS5EX7DN.cjs.map +1 -0
  53. package/dist/{chunk-IQU2GI6V.js → chunk-XVME4XYD.js} +1982 -93
  54. package/dist/chunk-XVME4XYD.js.map +1 -0
  55. package/dist/collaboration/index.cjs +42 -42
  56. package/dist/collaboration/index.js +2 -2
  57. package/dist/connect/docx.cjs +5 -5
  58. package/dist/connect/docx.js +4 -4
  59. package/dist/connect/index.cjs +710 -51
  60. package/dist/connect/index.cjs.map +1 -1
  61. package/dist/connect/index.d.ts +4 -0
  62. package/dist/connect/index.js +655 -20
  63. package/dist/connect/index.js.map +1 -1
  64. package/dist/connection/ConnectedSkillsLibrary.d.ts +26 -0
  65. package/dist/connection/ConnectedWorkflowBuilder.d.ts +1 -1
  66. package/dist/connection/ConnectedWorkflowLauncher.d.ts +35 -0
  67. package/dist/connection/ConnectedWorkflowsTable.d.ts +62 -0
  68. package/dist/connection/workspaceData.d.ts +45 -0
  69. package/dist/facts/index.cjs +2 -2
  70. package/dist/facts/index.js +2 -2
  71. package/dist/files/index.cjs +3 -3
  72. package/dist/files/index.js +3 -3
  73. package/dist/home/index.cjs +22 -23
  74. package/dist/home/index.cjs.map +1 -1
  75. package/dist/home/index.js +4 -5
  76. package/dist/home/index.js.map +1 -1
  77. package/dist/index.cjs +503 -472
  78. package/dist/index.cjs.map +1 -1
  79. package/dist/index.js +12 -13
  80. package/dist/index.js.map +1 -1
  81. package/dist/retrieval/index.cjs +1 -1
  82. package/dist/retrieval/index.js +1 -1
  83. package/dist/settings/index.cjs +49 -49
  84. package/dist/settings/index.js +6 -6
  85. package/dist/shell/index.cjs +2 -2
  86. package/dist/shell/index.js +2 -2
  87. package/dist/studio/index.cjs +2 -2
  88. package/dist/studio/index.js +2 -2
  89. package/dist/workflow-canvas/index.cjs +32 -30
  90. package/dist/workflow-canvas/index.cjs.map +1 -1
  91. package/dist/workflow-canvas/index.js +20 -18
  92. package/dist/workflow-canvas/index.js.map +1 -1
  93. package/node_modules/@arbidocs/coedit/package.json +1 -1
  94. package/package.json +4 -4
  95. package/dist/chunk-3FFRYZKV.js.map +0 -1
  96. package/dist/chunk-44R3CCZT.cjs.map +0 -1
  97. package/dist/chunk-4XJZ6AAY.js +0 -407
  98. package/dist/chunk-4XJZ6AAY.js.map +0 -1
  99. package/dist/chunk-6S5FLMWG.js.map +0 -1
  100. package/dist/chunk-7D737FLE.cjs +0 -43
  101. package/dist/chunk-7D737FLE.cjs.map +0 -1
  102. package/dist/chunk-IQU2GI6V.js.map +0 -1
  103. package/dist/chunk-LIHRGG4M.cjs.map +0 -1
  104. package/dist/chunk-LT2X5N37.js.map +0 -1
  105. package/dist/chunk-N26CXGXC.cjs.map +0 -1
  106. package/dist/chunk-OZLWSNUC.cjs.map +0 -1
  107. package/dist/chunk-S5HZBXZA.cjs +0 -430
  108. package/dist/chunk-S5HZBXZA.cjs.map +0 -1
  109. package/dist/chunk-XD2M6LIG.js +0 -41
  110. package/dist/chunk-XD2M6LIG.js.map +0 -1
@@ -1,12 +1,11 @@
1
1
  "use client";
2
2
  'use strict';
3
3
 
4
- var chunk44R3CCZT_cjs = require('./chunk-44R3CCZT.cjs');
5
- var chunkS5HZBXZA_cjs = require('./chunk-S5HZBXZA.cjs');
4
+ var chunkRFIBUWLF_cjs = require('./chunk-RFIBUWLF.cjs');
5
+ var chunk3BI6EWKP_cjs = require('./chunk-3BI6EWKP.cjs');
6
+ var chunkWS5EX7DN_cjs = require('./chunk-WS5EX7DN.cjs');
7
+ var chunkRQ2Y7USX_cjs = require('./chunk-RQ2Y7USX.cjs');
6
8
  var chunkZW6FPIFC_cjs = require('./chunk-ZW6FPIFC.cjs');
7
- var chunkLIHRGG4M_cjs = require('./chunk-LIHRGG4M.cjs');
8
- var chunk7D737FLE_cjs = require('./chunk-7D737FLE.cjs');
9
- var chunkN26CXGXC_cjs = require('./chunk-N26CXGXC.cjs');
10
9
  var chunk3AFWGEDJ_cjs = require('./chunk-3AFWGEDJ.cjs');
11
10
  var chunkDVUZTGVL_cjs = require('./chunk-DVUZTGVL.cjs');
12
11
  var chunkR26BK7YL_cjs = require('./chunk-R26BK7YL.cjs');
@@ -14,301 +13,23 @@ var chunkV4ISCZJ7_cjs = require('./chunk-V4ISCZJ7.cjs');
14
13
  var chunk2EI7NCUA_cjs = require('./chunk-2EI7NCUA.cjs');
15
14
  var chunkC2CWWEHO_cjs = require('./chunk-C2CWWEHO.cjs');
16
15
  var chunk7RGLTF76_cjs = require('./chunk-7RGLTF76.cjs');
17
- var chunkC4WSHRR6_cjs = require('./chunk-C4WSHRR6.cjs');
18
- var chunkULWRNGGE_cjs = require('./chunk-ULWRNGGE.cjs');
19
16
  var chunkOWCEQKAR_cjs = require('./chunk-OWCEQKAR.cjs');
20
17
  var chunk7UTB4PHM_cjs = require('./chunk-7UTB4PHM.cjs');
21
18
  var chunkFX3K6LNZ_cjs = require('./chunk-FX3K6LNZ.cjs');
22
19
  var chunkMHVNT4J3_cjs = require('./chunk-MHVNT4J3.cjs');
20
+ var chunkC4WSHRR6_cjs = require('./chunk-C4WSHRR6.cjs');
21
+ var chunkULWRNGGE_cjs = require('./chunk-ULWRNGGE.cjs');
23
22
  var chunkKDG6FER6_cjs = require('./chunk-KDG6FER6.cjs');
24
- var react = require('react');
25
- var ui = require('@arbidocs/react/ui');
26
23
  var jsxRuntime = require('react/jsx-runtime');
24
+ var react = require('react');
27
25
  var lucideReact = require('lucide-react');
26
+ var ui = require('@arbidocs/react/ui');
28
27
 
29
- function useControllableState(value, defaultValue, onChange) {
30
- const [inner, setInner] = react.useState(defaultValue);
31
- const isControlled = value !== void 0;
32
- const current = isControlled ? value : inner;
33
- const onChangeRef = react.useRef(onChange);
34
- onChangeRef.current = onChange;
35
- const set = react.useCallback(
36
- (next) => {
37
- if (!isControlled) setInner(next);
38
- onChangeRef.current?.(next);
39
- },
40
- [isControlled]
41
- );
42
- return [current, set];
43
- }
44
- var DEFAULT_AGENT_SELECT_LABELS = {
45
- label: "Run as",
46
- myAssistant: "My assistant"
47
- };
48
- var ME = "__me__";
49
- function AgentSelect({
50
- agents,
51
- value,
52
- defaultValue = "",
53
- onValueChange,
54
- hideLabel,
55
- disabled,
56
- className,
57
- labels,
58
- testId,
59
- optionTestId
60
- }) {
61
- const l = { ...DEFAULT_AGENT_SELECT_LABELS, ...labels };
62
- const triggerId = react.useId();
63
- const [current, setCurrent] = useControllableState(value, defaultValue, onValueChange);
64
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ui.cn("flex flex-col gap-1.5", className), "data-slot": "agent-select", children: [
65
- /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { htmlFor: triggerId, className: hideLabel ? "sr-only" : void 0, children: l.label }),
66
- /* @__PURE__ */ jsxRuntime.jsxs(
67
- ui.Select,
68
- {
69
- value: current === "" ? ME : current,
70
- onValueChange: (v) => setCurrent(v === ME ? "" : v),
71
- disabled,
72
- children: [
73
- /* @__PURE__ */ jsxRuntime.jsx(
74
- ui.SelectTrigger,
75
- {
76
- id: triggerId,
77
- "data-testid": chunkMHVNT4J3_cjs.testIdOr(testId, { testId: "agent-select" }),
78
- className: "pointer-coarse:min-h-11",
79
- children: /* @__PURE__ */ jsxRuntime.jsx(ui.SelectValue, {})
80
- }
81
- ),
82
- /* @__PURE__ */ jsxRuntime.jsxs(ui.SelectContent, { children: [
83
- /* @__PURE__ */ jsxRuntime.jsx(
84
- ui.SelectItem,
85
- {
86
- value: ME,
87
- "data-testid": chunkMHVNT4J3_cjs.prefixedTestId(optionTestId, "me", {
88
- testId: "agent-select-option-me"
89
- }),
90
- children: l.myAssistant
91
- }
92
- ),
93
- agents.map((agent) => /* @__PURE__ */ jsxRuntime.jsx(
94
- ui.SelectItem,
95
- {
96
- value: agent.id,
97
- "data-testid": chunkMHVNT4J3_cjs.prefixedTestId(optionTestId, agent.id, {
98
- testId: `agent-select-option-${agent.id}`
99
- }),
100
- children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center gap-2", children: [
101
- agent.avatar,
102
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: agent.label }),
103
- agent.description && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground", children: agent.description })
104
- ] })
105
- },
106
- agent.id
107
- ))
108
- ] })
109
- ]
110
- }
111
- )
112
- ] });
113
- }
114
- var DEFAULT_WORKFLOW_CONFIG_DIALOG_LABELS = {
115
- start: "Start",
116
- starting: "Starting\u2026",
117
- addFilesReason: "This reads your files, and there is nothing to read yet.",
118
- agentLabel: "Run as"
119
- };
120
- function WorkflowConfigDialog({
121
- workflow,
122
- open,
123
- onOpenChange,
124
- onLaunch,
125
- initialInputs,
126
- inputs: inputsProp,
127
- onInputsChange,
128
- scopeSource,
129
- renderScope,
130
- renderDocuments,
131
- renderIcon,
132
- addFilesAction,
133
- agents,
134
- agentId: agentIdProp,
135
- onAgentChange,
136
- isLaunching,
137
- submitLabel,
138
- fieldPlaceholder,
139
- renderNotice,
140
- labels,
141
- formLabels,
142
- agentLabels,
143
- testId,
144
- startTestId,
145
- className
146
- }) {
147
- const l = { ...DEFAULT_WORKFLOW_CONFIG_DIALOG_LABELS, ...labels };
148
- const initialKey = JSON.stringify(initialInputs ?? {});
149
- const seedKey = JSON.stringify({ ...chunkOWCEQKAR_cjs.defaultInputs(workflow), ...JSON.parse(initialKey) });
150
- const seed = react.useMemo(() => JSON.parse(seedKey), [seedKey]);
151
- const [inputs, setInputs] = useControllableState(inputsProp, seed, onInputsChange);
152
- const [agentId, setAgentId] = useControllableState(
153
- agentIdProp,
154
- workflow.defaultAgentId ?? "",
155
- onAgentChange
156
- );
157
- react.useEffect(() => {
158
- if (open && inputsProp === void 0) setInputs(seed);
159
- }, [open, seed]);
160
- const setField = (name, value) => setInputs({ ...inputs, [name]: value });
161
- const errors = chunkOWCEQKAR_cjs.validateInputs(workflow, inputs);
162
- const valid = Object.keys(errors).length === 0;
163
- const visibleErrors = Object.fromEntries(
164
- Object.entries(errors).filter(([, e]) => e !== "required")
165
- );
166
- const scopeField = workflow.inputs.find((f) => f.type === "scope");
167
- const rawScope = scopeField ? inputs[scopeField.name] : void 0;
168
- const scopeValue = rawScope && typeof rawScope === "object" ? rawScope : { folders: [], labels: [] };
169
- const matchedCount = scopeSource && scopeField ? scopeSource.countMatching(scopeValue) : null;
170
- const noFiles = Boolean(workflow.requiresFiles && scopeSource && scopeSource.totalCount === 0);
171
- const blockedByScope = matchedCount !== null && matchedCount === 0 && Boolean(workflow.requiresFiles);
172
- const showAgent = workflow.run.kind === "prompt" && workflow.options?.agent !== false && agents !== void 0 && agents.length > 0;
173
- const launch = (values) => {
174
- Promise.resolve(onLaunch(chunkOWCEQKAR_cjs.buildLaunch(workflow, values, agentId))).catch(() => {
175
- });
176
- };
177
- const submit = () => {
178
- if (!valid || noFiles || blockedByScope || isLaunching) return;
179
- launch(inputs);
180
- };
181
- const fields = react.useMemo(
182
- () => workflow.inputs.map((f) => {
183
- const placeholder = fieldPlaceholder?.(f, inputs, workflow);
184
- return placeholder === void 0 ? f : { ...f, placeholder };
185
- }),
186
- [workflow, fieldPlaceholder, inputs]
187
- );
188
- const id = chunkMHVNT4J3_cjs.testIdOr(testId, { testId: "workflow-dialog" });
189
- const formRef = react.useRef(null);
190
- const firstField = workflow.inputs.find((f) => !f.advanced);
191
- const focusPromptFirst = firstField?.type === "text" || firstField?.type === "longtext";
192
- const defaultScopeRender = scopeSource ? (_field, value, onChange) => /* @__PURE__ */ jsxRuntime.jsx(
193
- chunk44R3CCZT_cjs.ScopePicker,
194
- {
195
- folders: scopeSource.folders,
196
- unfiledCount: scopeSource.unfiledCount,
197
- labels: scopeSource.labels,
198
- totalCount: scopeSource.totalCount,
199
- matchedCount: scopeSource.countMatching(value),
200
- scope: value,
201
- onScopeChange: onChange
202
- }
203
- ) : void 0;
204
- return /* @__PURE__ */ jsxRuntime.jsx(ui.Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxRuntime.jsxs(
205
- ui.DialogContent,
206
- {
207
- presentation: "sheet",
208
- className: `max-h-[calc(100dvh-2rem)] overflow-y-auto sm:max-w-xl ${className ?? ""}`,
209
- "data-testid": id,
210
- "data-workflow": workflow.id,
211
- onOpenAutoFocus: (event) => {
212
- if (!focusPromptFirst || !firstField) return;
213
- const control = formRef.current?.querySelector(
214
- `[data-testid="${id}-field-${firstField.name}"]`
215
- );
216
- if (!control) return;
217
- event.preventDefault();
218
- control.focus();
219
- if (control instanceof HTMLInputElement || control instanceof HTMLTextAreaElement) {
220
- const end = control.value.length;
221
- control.setSelectionRange(end, end);
222
- }
223
- },
224
- children: [
225
- /* @__PURE__ */ jsxRuntime.jsx(
226
- chunk44R3CCZT_cjs.QuickActionDialogHeader,
227
- {
228
- icon: workflow.icon && renderIcon ? renderIcon(workflow.icon) : null,
229
- title: workflow.title,
230
- description: workflow.details ?? workflow.description,
231
- descriptionTestId: `${id}-description`
232
- }
233
- ),
234
- /* @__PURE__ */ jsxRuntime.jsx(
235
- "form",
236
- {
237
- ref: formRef,
238
- className: "mt-2 flex flex-col gap-4",
239
- onSubmit: (event) => {
240
- event.preventDefault();
241
- submit();
242
- },
243
- children: noFiles ? /* @__PURE__ */ jsxRuntime.jsx(
244
- chunk44R3CCZT_cjs.AddFilesFirst,
245
- {
246
- reason: l.addFilesReason,
247
- action: addFilesAction,
248
- testId: `${id}-empty-state`
249
- }
250
- ) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
251
- /* @__PURE__ */ jsxRuntime.jsx(
252
- chunkLIHRGG4M_cjs.SchemaForm,
253
- {
254
- fields,
255
- values: inputs,
256
- onChange: setField,
257
- errors: visibleErrors,
258
- renderScope: renderScope ?? defaultScopeRender,
259
- renderDocuments,
260
- renderIcon,
261
- labels: formLabels,
262
- onEnterSubmit: submit,
263
- testIdPrefix: `${id}-field`
264
- }
265
- ),
266
- renderNotice?.({ workflow, inputs }),
267
- /* @__PURE__ */ jsxRuntime.jsxs(
268
- "div",
269
- {
270
- className: "flex flex-col gap-3 border-t border-border pt-3 sm:flex-row sm:items-end sm:justify-between",
271
- "data-slot": "workflow-footer",
272
- children: [
273
- showAgent ? /* @__PURE__ */ jsxRuntime.jsx(
274
- AgentSelect,
275
- {
276
- agents: agents ?? [],
277
- value: agentId,
278
- onValueChange: setAgentId,
279
- labels: { label: l.agentLabel, ...agentLabels },
280
- testId: `${id}-agent`,
281
- className: "sm:w-56"
282
- }
283
- ) : /* @__PURE__ */ jsxRuntime.jsx("span", {}),
284
- /* @__PURE__ */ jsxRuntime.jsxs(
285
- ui.Button,
286
- {
287
- type: "submit",
288
- className: "gap-1.5 px-5 pointer-coarse:min-h-11",
289
- disabled: !valid || blockedByScope || isLaunching,
290
- "data-testid": chunkMHVNT4J3_cjs.testIdOr(startTestId, { testId: "workflow-start-button" }),
291
- children: [
292
- isLaunching ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "size-4 animate-spin" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Play, { className: "size-4" }),
293
- isLaunching ? l.starting : submitLabel?.({ workflow, inputs, matchedCount }) ?? workflow.startLabel ?? l.start
294
- ]
295
- }
296
- )
297
- ]
298
- }
299
- )
300
- ] })
301
- }
302
- )
303
- ]
304
- }
305
- ) });
306
- }
307
28
  function defaultScopeRenderer(scopeSource) {
308
29
  if (!scopeSource) return void 0;
309
30
  return function renderScope(_field, value, onChange) {
310
31
  return /* @__PURE__ */ jsxRuntime.jsx(
311
- chunk44R3CCZT_cjs.ScopePicker,
32
+ chunkWS5EX7DN_cjs.ScopePicker,
312
33
  {
313
34
  folders: scopeSource.folders,
314
35
  unfiledCount: scopeSource.unfiledCount,
@@ -332,178 +53,6 @@ function resolveScopeInputs(workflow, inputs, scopeSource) {
332
53
  }
333
54
  return next;
334
55
  }
335
- function WorkflowLauncher({
336
- workflows,
337
- tileWorkflows,
338
- onLaunch,
339
- showTiles = true,
340
- caption,
341
- captionTestId,
342
- tileTestId,
343
- disabledReason,
344
- activeId: activeIdProp,
345
- onActiveIdChange,
346
- initialInputsFor,
347
- testId,
348
- extraTiles = [],
349
- className,
350
- children,
351
- renderIcon,
352
- ...dialog
353
- }) {
354
- const [activeId, setActiveId] = useControllableState(
355
- activeIdProp,
356
- null,
357
- onActiveIdChange
358
- );
359
- const [isLaunching, setIsLaunching] = react.useState(false);
360
- const active = workflows.find((w) => w.id === activeId) ?? null;
361
- const run = async (launch) => {
362
- setIsLaunching(true);
363
- try {
364
- await onLaunch(launch);
365
- setActiveId(null);
366
- } finally {
367
- setIsLaunching(false);
368
- }
369
- };
370
- const select = (workflow) => {
371
- if (workflow.run.kind === "operation" && workflow.inputs.length === 0) {
372
- const inputs = chunkOWCEQKAR_cjs.defaultInputs(workflow);
373
- if (Object.keys(chunkOWCEQKAR_cjs.validateInputs(workflow, inputs)).length === 0) {
374
- Promise.resolve(onLaunch(chunkOWCEQKAR_cjs.buildLaunch(workflow, inputs, void 0))).catch(() => {
375
- });
376
- return;
377
- }
378
- }
379
- setActiveId(workflow.id);
380
- };
381
- const tiles = (tileWorkflows ?? workflows).map((workflow) => {
382
- const reason = disabledReason?.(workflow);
383
- return {
384
- id: workflow.id,
385
- iconNode: workflow.icon && renderIcon ? renderIcon(workflow.icon) : void 0,
386
- title: workflow.title,
387
- description: workflow.description,
388
- onSelect: () => select(workflow),
389
- disabled: reason !== void 0,
390
- disabledReason: reason,
391
- testId: tileTestId?.(workflow) ?? `workflow-tile-${workflow.id}`
392
- };
393
- });
394
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, "data-slot": "workflow-launcher", children: [
395
- showTiles && /* @__PURE__ */ jsxRuntime.jsx(
396
- chunk44R3CCZT_cjs.StartTiles,
397
- {
398
- items: [...tiles, ...extraTiles],
399
- caption,
400
- captionTestId,
401
- testId
402
- }
403
- ),
404
- children,
405
- active && /* @__PURE__ */ jsxRuntime.jsx(
406
- WorkflowConfigDialog,
407
- {
408
- ...dialog,
409
- renderIcon,
410
- workflow: active,
411
- open: true,
412
- onOpenChange: (open) => !open && setActiveId(null),
413
- onLaunch: run,
414
- isLaunching,
415
- initialInputs: initialInputsFor?.(active)
416
- }
417
- )
418
- ] });
419
- }
420
-
421
- // src/agents/workflows/workspaceScope.ts
422
- var canonical = (path) => (path ?? "").split("/").map((part) => part.trim()).filter(Boolean).join("/");
423
- function matchWorkflowScope(docs, scope) {
424
- if (scope.documents?.length) {
425
- const ids = new Set(scope.documents);
426
- return docs.filter((doc) => ids.has(doc.external_id));
427
- }
428
- if (!scope.folders.length && !scope.labels.length) return docs;
429
- const folders = scope.folders.map(canonical);
430
- const labels = new Set(scope.labels);
431
- return docs.filter((doc) => {
432
- const folder = canonical(doc.folder);
433
- return folders.some(
434
- (path) => path === "" ? folder === "" : folder === path || folder.startsWith(`${path}/`)
435
- ) || doc.doctags?.some((tag) => labels.has(tag.tag_ext_id));
436
- });
437
- }
438
- function buildWorkflowScopeSource(docs, labels = []) {
439
- const counts = /* @__PURE__ */ new Map();
440
- for (const doc of docs) {
441
- const parts = canonical(doc.folder).split("/").filter(Boolean);
442
- for (let i = 1; i <= parts.length; i++) {
443
- const path = parts.slice(0, i).join("/");
444
- counts.set(path, (counts.get(path) ?? 0) + 1);
445
- }
446
- }
447
- return {
448
- folders: [...counts].sort(([a], [b]) => a.localeCompare(b)).map(([path, count]) => ({
449
- path,
450
- count,
451
- label: path.split("/").at(-1),
452
- depth: path.split("/").length - 1
453
- })),
454
- unfiledCount: docs.filter((doc) => !canonical(doc.folder)).length,
455
- labels: labels.map((label) => ({
456
- id: label.external_id,
457
- name: label.name,
458
- color: label.color ?? "currentColor",
459
- count: docs.filter((doc) => doc.doctags?.some((tag) => tag.tag_ext_id === label.external_id)).length
460
- })),
461
- totalCount: docs.length,
462
- countMatching: (scope) => matchWorkflowScope(docs, scope).length,
463
- resolveDocuments: (scope) => matchWorkflowScope(docs, scope).map((doc) => doc.external_id)
464
- };
465
- }
466
- function WorkflowDocumentsField({
467
- field,
468
- value,
469
- onChange,
470
- documents,
471
- addFilesAction
472
- }) {
473
- const ids = value.documents ?? [];
474
- const max = field.max ?? 1;
475
- const set = (documents2) => onChange({ ...value, documents: documents2 });
476
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-testid": `workflow-documents-${field.name}`, className: "space-y-2", children: [
477
- /* @__PURE__ */ jsxRuntime.jsx(
478
- chunkS5HZBXZA_cjs.DocumentPicker,
479
- {
480
- groups: [{ id: "workspace", docs: documents }],
481
- value: ids[0] ?? "",
482
- selected: documents.find((doc) => doc.id === ids[0]),
483
- selectedIds: max > 1 ? ids : void 0,
484
- onValueChange: (id) => set(
485
- ids.includes(id) ? ids.filter((selected) => selected !== id) : [...ids, id].slice(-max)
486
- )
487
- }
488
- ),
489
- ids.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-1", children: ids.map((id) => /* @__PURE__ */ jsxRuntime.jsxs(
490
- ui.Button,
491
- {
492
- type: "button",
493
- variant: "outline",
494
- size: "sm",
495
- onClick: () => set(ids.filter((selected) => selected !== id)),
496
- "aria-label": `Remove ${documents.find((doc) => doc.id === id)?.title ?? id}`,
497
- children: [
498
- documents.find((doc) => doc.id === id)?.title ?? id,
499
- " \xD7"
500
- ]
501
- },
502
- id
503
- )) }),
504
- addFilesAction
505
- ] });
506
- }
507
56
  function useWorkflowPreview(workflow, { answer = "{prompt}", delayMs = 400, resolveWorkflow, compose } = {}) {
508
57
  const steps = chunkOWCEQKAR_cjs.workflowSteps(workflow);
509
58
  const [inputs, setInputs] = react.useState(() => chunkOWCEQKAR_cjs.initialRunInputs(workflow));
@@ -544,7 +93,7 @@ function useWorkflowPreview(workflow, { answer = "{prompt}", delayMs = 400, reso
544
93
  }, delayMs)
545
94
  );
546
95
  }, [states, steps, workflow]);
547
- return chunkLIHRGG4M_cjs.useWorkflowView({
96
+ return chunk3BI6EWKP_cjs.useWorkflowView({
548
97
  steps,
549
98
  states,
550
99
  inputs,
@@ -1032,7 +581,7 @@ function AgentCreator({
1032
581
  // eslint-disable-next-line react-hooks/exhaustive-deps
1033
582
  [open]
1034
583
  );
1035
- const [values, setValues] = useControllableState(
584
+ const [values, setValues] = chunk3BI6EWKP_cjs.useControllableState(
1036
585
  valuesProp,
1037
586
  seed,
1038
587
  onValuesChange
@@ -1160,7 +709,7 @@ function AgentCreator({
1160
709
  ] })
1161
710
  ] }),
1162
711
  /* @__PURE__ */ jsxRuntime.jsx(
1163
- chunk7D737FLE_cjs.FoldSection,
712
+ chunkWS5EX7DN_cjs.FoldSection,
1164
713
  {
1165
714
  label: l.advanced,
1166
715
  open: advancedOpen,
@@ -1319,79 +868,6 @@ function agentConfigSectionToValues(section, capabilityKeys) {
1319
868
  capabilities: Object.fromEntries(capabilityKeys.map((k) => [k, Boolean(s[k])]))
1320
869
  };
1321
870
  }
1322
- function SkillTypeBadge({ type, className }) {
1323
- return /* @__PURE__ */ jsxRuntime.jsx(
1324
- "span",
1325
- {
1326
- className: ui.cn(
1327
- "shrink-0 rounded bg-background px-1.5 py-0.5 text-xs uppercase tracking-wide text-muted-foreground",
1328
- className
1329
- ),
1330
- "data-slot": "skill-type-badge",
1331
- children: type
1332
- }
1333
- );
1334
- }
1335
- var DEFAULT_SKILL_GLOBAL_BADGE_LABELS = {
1336
- global: "Global",
1337
- globalTitle: "Shared with everyone in the marketplace"
1338
- };
1339
- function SkillGlobalBadge({
1340
- className,
1341
- labels
1342
- }) {
1343
- const l = { ...DEFAULT_SKILL_GLOBAL_BADGE_LABELS, ...labels };
1344
- return /* @__PURE__ */ jsxRuntime.jsxs(
1345
- "span",
1346
- {
1347
- className: ui.cn(
1348
- "inline-flex shrink-0 items-center gap-1 rounded bg-accent px-1.5 py-0.5 text-xs uppercase tracking-wide text-accent-foreground",
1349
- className
1350
- ),
1351
- title: l.globalTitle,
1352
- "data-slot": "skill-global-badge",
1353
- children: [
1354
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Globe, { className: "size-3" }),
1355
- l.global
1356
- ]
1357
- }
1358
- );
1359
- }
1360
- function SkillActionButton({
1361
- label,
1362
- tooltip,
1363
- onClick,
1364
- children,
1365
- testId
1366
- }) {
1367
- return /* @__PURE__ */ jsxRuntime.jsxs(ui.Tooltip, { children: [
1368
- /* @__PURE__ */ jsxRuntime.jsx(ui.TooltipTrigger, { asChild: true, onFocusCapture: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsxRuntime.jsx(
1369
- ui.Button,
1370
- {
1371
- variant: "ghost",
1372
- size: "icon",
1373
- className: "size-7 shrink-0 pointer-coarse:size-11",
1374
- onClick: (e) => {
1375
- e.stopPropagation();
1376
- onClick(e);
1377
- },
1378
- "aria-label": label,
1379
- "data-testid": testId,
1380
- children
1381
- }
1382
- ) }),
1383
- /* @__PURE__ */ jsxRuntime.jsx(ui.TooltipContent, { children: /* @__PURE__ */ jsxRuntime.jsx("p", { children: tooltip ?? label }) })
1384
- ] });
1385
- }
1386
- function activateOnKey(handler) {
1387
- return (e) => {
1388
- if (e.target !== e.currentTarget) return;
1389
- if (e.key === "Enter" || e.key === " ") {
1390
- e.preventDefault();
1391
- handler();
1392
- }
1393
- };
1394
- }
1395
871
  var DEFAULT_SKILL_CARD_LABELS = {
1396
872
  global: "Global",
1397
873
  globalTitle: "Shared with everyone in the marketplace",
@@ -1434,7 +910,7 @@ function SkillCard({
1434
910
  className
1435
911
  ),
1436
912
  onClick,
1437
- onKeyDown: activateOnKey(onClick),
913
+ onKeyDown: chunk3BI6EWKP_cjs.activateOnKey(onClick),
1438
914
  "data-skill-name": name,
1439
915
  "data-testid": chunkMHVNT4J3_cjs.testIdOr(testId ?? testIds?.root, { testId: "skill-card" }),
1440
916
  "data-slot": "skill-card",
@@ -1458,12 +934,12 @@ function SkillCard({
1458
934
  "/",
1459
935
  name
1460
936
  ] }),
1461
- type && type !== "markdown" && /* @__PURE__ */ jsxRuntime.jsx(SkillTypeBadge, { type }),
1462
- isGlobal && /* @__PURE__ */ jsxRuntime.jsx(SkillGlobalBadge, { labels: l }),
937
+ type && type !== "markdown" && /* @__PURE__ */ jsxRuntime.jsx(chunk3BI6EWKP_cjs.SkillTypeBadge, { type }),
938
+ isGlobal && /* @__PURE__ */ jsxRuntime.jsx(chunk3BI6EWKP_cjs.SkillGlobalBadge, { labels: l }),
1463
939
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 text-sm text-muted-foreground max-sm:order-last max-sm:w-full max-sm:line-clamp-2 sm:flex-1 sm:truncate", children: description }),
1464
940
  /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "ml-auto flex shrink-0 items-center gap-1", "data-slot": "skill-card-actions", children: [
1465
941
  /* @__PURE__ */ jsxRuntime.jsx(
1466
- SkillActionButton,
942
+ chunk3BI6EWKP_cjs.SkillActionButton,
1467
943
  {
1468
944
  label: l.preview,
1469
945
  onClick: onPreview,
@@ -1472,7 +948,7 @@ function SkillCard({
1472
948
  }
1473
949
  ),
1474
950
  /* @__PURE__ */ jsxRuntime.jsx(
1475
- SkillActionButton,
951
+ chunk3BI6EWKP_cjs.SkillActionButton,
1476
952
  {
1477
953
  label: l.edit,
1478
954
  onClick: onEdit,
@@ -1481,7 +957,7 @@ function SkillCard({
1481
957
  }
1482
958
  ),
1483
959
  /* @__PURE__ */ jsxRuntime.jsx(
1484
- SkillActionButton,
960
+ chunk3BI6EWKP_cjs.SkillActionButton,
1485
961
  {
1486
962
  label: l.export,
1487
963
  onClick: onExport,
@@ -1490,7 +966,7 @@ function SkillCard({
1490
966
  }
1491
967
  ),
1492
968
  isOwner && onToggleVisibility && /* @__PURE__ */ jsxRuntime.jsx(
1493
- SkillActionButton,
969
+ chunk3BI6EWKP_cjs.SkillActionButton,
1494
970
  {
1495
971
  label: isGlobal ? l.makePrivate : l.publish,
1496
972
  tooltip: isGlobal ? l.makePrivateTooltip : l.publish,
@@ -1545,7 +1021,7 @@ function SkillRow({
1545
1021
  className
1546
1022
  ),
1547
1023
  onClick: onInvoke,
1548
- onKeyDown: activateOnKey(onInvoke),
1024
+ onKeyDown: chunk3BI6EWKP_cjs.activateOnKey(onInvoke),
1549
1025
  "data-testid": chunkMHVNT4J3_cjs.testIdOr(testId, { testId: `skills-panel-row-${name}` }),
1550
1026
  "data-slot": "skill-row",
1551
1027
  title: l.insertTitle(name),
@@ -1563,391 +1039,63 @@ function SkillRow({
1563
1039
  "/",
1564
1040
  name
1565
1041
  ] }),
1566
- type && type !== "markdown" && /* @__PURE__ */ jsxRuntime.jsx(SkillTypeBadge, { type }),
1567
- isGlobal && /* @__PURE__ */ jsxRuntime.jsx(SkillGlobalBadge, { labels: l })
1042
+ type && type !== "markdown" && /* @__PURE__ */ jsxRuntime.jsx(chunk3BI6EWKP_cjs.SkillTypeBadge, { type }),
1043
+ isGlobal && /* @__PURE__ */ jsxRuntime.jsx(chunk3BI6EWKP_cjs.SkillGlobalBadge, { labels: l })
1568
1044
  ] }),
1569
1045
  description && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "truncate text-xs text-muted-foreground", children: description })
1570
1046
  ] }),
1571
1047
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex shrink-0 items-center gap-0.5", children: [
1572
- /* @__PURE__ */ jsxRuntime.jsx(SkillActionButton, { label: l.preview, onClick: () => onPreview(), children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Eye, { className: "size-4" }) }),
1573
- onEdit && /* @__PURE__ */ jsxRuntime.jsx(SkillActionButton, { label: l.edit, onClick: () => onEdit(), children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Pencil, { className: "size-4" }) }),
1048
+ /* @__PURE__ */ jsxRuntime.jsx(chunk3BI6EWKP_cjs.SkillActionButton, { label: l.preview, onClick: () => onPreview(), children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Eye, { className: "size-4" }) }),
1049
+ onEdit && /* @__PURE__ */ jsxRuntime.jsx(chunk3BI6EWKP_cjs.SkillActionButton, { label: l.edit, onClick: () => onEdit(), children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Pencil, { className: "size-4" }) }),
1574
1050
  onTogglePublish && /* @__PURE__ */ jsxRuntime.jsx(
1575
- SkillActionButton,
1051
+ chunk3BI6EWKP_cjs.SkillActionButton,
1576
1052
  {
1577
1053
  label: isGlobal ? l.makePrivate : l.publish,
1578
1054
  onClick: () => onTogglePublish(),
1579
1055
  children: isGlobal ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Lock, { className: "size-4" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Globe, { className: "size-4 text-primary" })
1580
1056
  }
1581
1057
  ),
1582
- onDelete && /* @__PURE__ */ jsxRuntime.jsx(SkillActionButton, { label: l.delete, onClick: () => onDelete(), children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Trash2, { className: "size-4 text-destructive" }) })
1058
+ onDelete && /* @__PURE__ */ jsxRuntime.jsx(chunk3BI6EWKP_cjs.SkillActionButton, { label: l.delete, onClick: () => onDelete(), children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Trash2, { className: "size-4 text-destructive" }) })
1583
1059
  ] })
1584
1060
  ]
1585
1061
  }
1586
1062
  );
1587
1063
  }
1588
- var DEFAULT_SKILL_GENERATE_FORM_LABELS = {
1589
- title: "Generate with AI",
1590
- hint: "Describe what the skill should do. The assistant drafts it in chat, then you can edit it here.",
1591
- placeholder: "e.g. Summarize a contract into key obligations, dates, and parties",
1592
- generate: "Generate with AI",
1593
- writeManually: "\u2026or write it manually"
1064
+ var DEFAULT_TASK_PLAN_LABELS = {
1065
+ emptyTitle: "Draft a plan to review",
1066
+ emptyBody: "The assistant writes a short checklist of what its work must cover. You can edit it, and it checks its own draft against it before handing it to you.",
1067
+ drafting: "Drafting plan\u2026",
1068
+ generate: "Draft a plan",
1069
+ needWorkspace: "Open a workspace to plan: the checklist is encrypted under its key.",
1070
+ needObjective: "Say what the assistant should do first: the plan is drafted from it.",
1071
+ goalTask: "Drafted for your review",
1072
+ scopedTo: "for",
1073
+ redraft: "Redraft",
1074
+ removePlan: "Remove plan",
1075
+ goal: "Objective",
1076
+ goalPlaceholder: "What should the finished work achieve?",
1077
+ checklist: "The draft must",
1078
+ criteriaCount: (count) => `${count} ${count === 1 ? "criterion" : "criteria"}`,
1079
+ add: "Add",
1080
+ noCriteria: "Nothing yet. Add at least one thing the draft must cover.",
1081
+ criterionPlaceholder: "Something specific you can check\u2026",
1082
+ removeCriterion: (n) => `Remove item ${n}`,
1083
+ retryBudget: "Revision rounds",
1084
+ passes: (count) => `up to ${count} ${count === 1 ? "round" : "rounds"}`,
1085
+ passesHelp: "How many times the assistant may revise its own draft before it hands it over.",
1086
+ workingDocuments: "Documents it will use",
1087
+ workingDocumentsHelp: "The plan limits the assistant to these documents."
1594
1088
  };
1595
- function SkillGenerateForm({
1596
- onGenerate,
1597
- onManual,
1598
- icon,
1599
- labels,
1600
- testIds
1601
- }) {
1602
- const l = { ...DEFAULT_SKILL_GENERATE_FORM_LABELS, ...labels };
1603
- const [desc, setDesc] = react.useState("");
1604
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-1 flex-col gap-4 overflow-y-auto p-4", "data-slot": "skill-generate-form", children: [
1605
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "rounded-lg bg-muted p-4", children: [
1606
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-1 flex items-center gap-2", children: [
1607
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Wand2, { className: "size-4 text-primary" }),
1608
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-medium", children: l.title })
1609
- ] }),
1610
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mb-3 text-xs text-muted-foreground", children: l.hint }),
1611
- /* @__PURE__ */ jsxRuntime.jsx(
1612
- ui.Textarea,
1613
- {
1614
- value: desc,
1615
- onChange: (e) => setDesc(e.target.value),
1616
- rows: 4,
1617
- placeholder: l.placeholder,
1618
- "data-testid": chunkMHVNT4J3_cjs.testIdOr(testIds?.description, { testId: "skills-panel-ai-desc" })
1619
- }
1620
- ),
1621
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-3 flex justify-end", children: /* @__PURE__ */ jsxRuntime.jsxs(
1622
- ui.Button,
1623
- {
1624
- size: "sm",
1625
- disabled: !desc.trim(),
1626
- onClick: () => onGenerate(desc.trim()),
1627
- "data-testid": chunkMHVNT4J3_cjs.testIdOr(testIds?.generate, { testId: "skills-panel-ai-generate" }),
1628
- children: [
1629
- icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mr-1 [&>svg]:size-4", children: icon }),
1630
- l.generate
1631
- ]
1632
- }
1633
- ) })
1634
- ] }),
1635
- /* @__PURE__ */ jsxRuntime.jsx(
1636
- "button",
1637
- {
1638
- type: "button",
1639
- className: "self-start text-sm text-muted-foreground underline-offset-2 hover:text-foreground hover:underline pointer-coarse:min-h-11",
1640
- onClick: onManual,
1641
- "data-testid": chunkMHVNT4J3_cjs.testIdOr(testIds?.writeManually, { testId: "skills-panel-write-manually" }),
1642
- children: l.writeManually
1643
- }
1644
- )
1645
- ] });
1646
- }
1647
- var DEFAULT_SKILL_EDIT_FORM_LABELS = {
1648
- name: "Name",
1649
- namePlaceholder: "contract-summary",
1650
- invokedAs: (name) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1651
- "Invoked as ",
1652
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "font-mono", children: [
1653
- "/",
1654
- name || "skill-name"
1655
- ] })
1656
- ] }),
1657
- description: "Description",
1658
- descriptionPlaceholder: "What it does and when to use it",
1659
- instructions: "Instructions",
1660
- cancel: "Cancel",
1661
- saving: "Saving\u2026",
1662
- saveChanges: "Save changes",
1663
- create: "Create skill"
1664
- };
1665
- var FIELD_LABEL = "text-xs font-semibold uppercase tracking-wide text-muted-foreground";
1666
- function SkillEditForm({
1667
- name,
1668
- onNameChange,
1669
- isNameLocked,
1670
- nameError,
1671
- description,
1672
- onDescriptionChange,
1673
- editor,
1674
- isSaving,
1675
- isEditing,
1676
- onSave,
1677
- onCancel,
1678
- labels,
1679
- testIds
1680
- }) {
1681
- const l = { ...DEFAULT_SKILL_EDIT_FORM_LABELS, ...labels };
1682
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex h-full min-h-0 flex-col", "data-slot": "skill-edit-form", children: [
1683
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto p-4", children: [
1684
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1685
- /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { htmlFor: "sp-name", className: FIELD_LABEL, children: l.name }),
1686
- /* @__PURE__ */ jsxRuntime.jsx(
1687
- ui.Input,
1688
- {
1689
- id: "sp-name",
1690
- value: name,
1691
- disabled: isNameLocked,
1692
- placeholder: l.namePlaceholder,
1693
- onChange: (e) => onNameChange(e.target.value),
1694
- className: "mt-1",
1695
- "data-testid": chunkMHVNT4J3_cjs.testIdOr(testIds?.name, { testId: "skills-panel-edit-name" })
1696
- }
1697
- ),
1698
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-xs text-muted-foreground", children: l.invokedAs(name) }),
1699
- nameError && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-xs text-destructive", children: nameError })
1700
- ] }),
1701
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
1702
- /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { htmlFor: "sp-desc", className: FIELD_LABEL, children: l.description }),
1703
- /* @__PURE__ */ jsxRuntime.jsx(
1704
- ui.Input,
1705
- {
1706
- id: "sp-desc",
1707
- value: description,
1708
- placeholder: l.descriptionPlaceholder,
1709
- onChange: (e) => onDescriptionChange(e.target.value),
1710
- className: "mt-1",
1711
- "data-testid": chunkMHVNT4J3_cjs.testIdOr(testIds?.description, { testId: "skills-panel-edit-desc" })
1712
- }
1713
- )
1714
- ] }),
1715
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-h-0 flex-1 flex-col", children: [
1716
- /* @__PURE__ */ jsxRuntime.jsx(ui.Label, { className: `${FIELD_LABEL} mb-1`, children: l.instructions }),
1717
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-h-[240px] flex-1 overflow-hidden rounded-md border border-border", children: editor })
1718
- ] })
1719
- ] }),
1720
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col-reverse sm:flex-row sm:justify-end gap-2 border-t border-border px-4 py-3", children: [
1721
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "outline", size: "sm", onClick: onCancel, children: l.cancel }),
1722
- /* @__PURE__ */ jsxRuntime.jsx(
1723
- ui.Button,
1724
- {
1725
- size: "sm",
1726
- onClick: onSave,
1727
- disabled: isSaving,
1728
- "data-testid": chunkMHVNT4J3_cjs.testIdOr(testIds?.save, { testId: "skills-panel-edit-save" }),
1729
- children: isSaving ? l.saving : isEditing ? l.saveChanges : l.create
1730
- }
1731
- )
1732
- ] })
1733
- ] });
1734
- }
1735
- function SkillFilterChips({
1736
- options,
1737
- value,
1738
- onChange,
1739
- label,
1740
- testIdPrefix = "skills-filter",
1741
- className
1742
- }) {
1743
- return /* @__PURE__ */ jsxRuntime.jsx(
1744
- "div",
1745
- {
1746
- role: "radiogroup",
1747
- "aria-label": label,
1748
- className: ui.cn("flex flex-wrap gap-2", className),
1749
- "data-slot": "skill-filter-chips",
1750
- children: options.map((option) => {
1751
- const selected = option.id === value;
1752
- return /* @__PURE__ */ jsxRuntime.jsxs(
1753
- "button",
1754
- {
1755
- type: "button",
1756
- role: "radio",
1757
- "aria-checked": selected,
1758
- onClick: () => onChange(option.id),
1759
- "data-testid": `${testIdPrefix}-${option.id}`,
1760
- className: ui.cn(
1761
- "inline-flex min-h-8 items-center gap-1.5 rounded-full border px-3 text-sm transition-colors pointer-coarse:min-h-11 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
1762
- selected ? "border-primary bg-primary/10 text-foreground" : "border-border bg-background text-muted-foreground [&:hover]:bg-muted"
1763
- ),
1764
- children: [
1765
- option.label,
1766
- option.count !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground", children: option.count })
1767
- ]
1768
- },
1769
- option.id
1770
- );
1771
- })
1772
- }
1773
- );
1774
- }
1775
- var DEFAULT_SKILL_VIEW_TOGGLE_LABELS = {
1776
- group: "View",
1777
- gallery: "Gallery",
1778
- list: "List"
1779
- };
1780
- function SkillViewToggle({ value, onChange, labels, testId }) {
1781
- const l = { ...DEFAULT_SKILL_VIEW_TOGGLE_LABELS, ...labels };
1782
- const item = (view, label, icon) => /* @__PURE__ */ jsxRuntime.jsx(
1783
- "button",
1784
- {
1785
- type: "button",
1786
- role: "radio",
1787
- "aria-checked": value === view,
1788
- "aria-label": label,
1789
- title: label,
1790
- onClick: () => onChange(view),
1791
- "data-testid": `${testId ?? "skills-view-toggle"}-${view}`,
1792
- className: ui.cn(
1793
- "flex size-8 items-center justify-center rounded-md pointer-coarse:size-11 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
1794
- value === view ? "bg-background text-foreground shadow-sm" : "text-muted-foreground"
1795
- ),
1796
- children: icon
1797
- }
1798
- );
1799
- return /* @__PURE__ */ jsxRuntime.jsxs(
1800
- "div",
1801
- {
1802
- role: "radiogroup",
1803
- "aria-label": l.group,
1804
- className: "inline-flex shrink-0 gap-0.5 rounded-lg bg-muted p-0.5",
1805
- "data-testid": testId ?? "skills-view-toggle",
1806
- children: [
1807
- item("gallery", l.gallery, /* @__PURE__ */ jsxRuntime.jsx(lucideReact.LayoutGrid, { className: "size-4" })),
1808
- item("list", l.list, /* @__PURE__ */ jsxRuntime.jsx(lucideReact.List, { className: "size-4" }))
1809
- ]
1810
- }
1811
- );
1812
- }
1813
- function SkillTile({
1814
- name,
1815
- description,
1816
- sourceLabel,
1817
- type,
1818
- icon,
1819
- layout,
1820
- selected,
1821
- onSelect,
1822
- testId
1823
- }) {
1824
- const isRow = layout === "list";
1825
- return /* @__PURE__ */ jsxRuntime.jsxs(
1826
- "div",
1827
- {
1828
- role: "button",
1829
- tabIndex: 0,
1830
- "aria-pressed": selected,
1831
- onClick: onSelect,
1832
- onKeyDown: activateOnKey(onSelect),
1833
- "data-testid": testId ?? `skill-tile-${name}`,
1834
- "data-skill-name": name,
1835
- "data-slot": "skill-tile",
1836
- className: ui.cn(
1837
- "flex cursor-pointer rounded-lg border p-3 text-left transition-colors pointer-coarse:min-h-11 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
1838
- isRow ? "items-center gap-3" : "h-full flex-col gap-2",
1839
- selected ? "border-primary bg-primary/5" : "border-transparent bg-muted [&:hover]:bg-accent"
1840
- ),
1841
- children: [
1842
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [
1843
- icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "shrink-0 text-ai-ink [&>svg]:size-5", children: icon }),
1844
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 truncate text-sm font-semibold text-foreground", children: name })
1845
- ] }),
1846
- /* @__PURE__ */ jsxRuntime.jsx(
1847
- "p",
1848
- {
1849
- className: ui.cn(
1850
- "min-w-0 text-sm text-muted-foreground",
1851
- isRow ? "flex-1 truncate max-sm:hidden" : "line-clamp-3"
1852
- ),
1853
- children: description
1854
- }
1855
- ),
1856
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ui.cn("flex shrink-0 items-center gap-1.5", isRow && "ml-auto"), children: [
1857
- type && type !== "markdown" && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "rounded bg-background px-1.5 py-0.5 text-xs uppercase tracking-wide text-muted-foreground", children: type }),
1858
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "rounded bg-background px-1.5 py-0.5 text-xs text-muted-foreground", children: sourceLabel })
1859
- ] })
1860
- ]
1861
- }
1862
- );
1863
- }
1864
- function SkillDetail({
1865
- title,
1866
- sourceLabel,
1867
- description,
1868
- icon,
1869
- notice,
1870
- children,
1871
- actions,
1872
- testId
1873
- }) {
1874
- return /* @__PURE__ */ jsxRuntime.jsxs(
1875
- "section",
1876
- {
1877
- className: "flex min-h-0 flex-1 flex-col",
1878
- "data-testid": testId ?? "skill-detail",
1879
- "data-slot": "skill-detail",
1880
- "aria-label": title,
1881
- children: [
1882
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-h-0 flex-1 space-y-4 overflow-y-auto p-4", children: [
1883
- /* @__PURE__ */ jsxRuntime.jsxs("header", { className: "space-y-1", children: [
1884
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
1885
- icon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-ai-ink [&>svg]:size-5", children: icon }),
1886
- /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-base font-semibold text-foreground", children: title }),
1887
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "rounded bg-muted px-1.5 py-0.5 text-xs text-muted-foreground", children: sourceLabel })
1888
- ] }),
1889
- description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: description }),
1890
- notice && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-foreground", children: notice })
1891
- ] }),
1892
- children
1893
- ] }),
1894
- actions && /* @__PURE__ */ jsxRuntime.jsx(
1895
- "div",
1896
- {
1897
- className: "flex flex-wrap gap-2 border-t border-border bg-background p-3",
1898
- "data-slot": "skill-detail-actions",
1899
- children: actions
1900
- }
1901
- )
1902
- ]
1903
- }
1904
- );
1905
- }
1906
- function SkillDetailSection({
1907
- title,
1908
- children,
1909
- testId
1910
- }) {
1911
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-1.5", "data-testid": testId, children: [
1912
- /* @__PURE__ */ jsxRuntime.jsx("h4", { className: "text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: title }),
1913
- children
1914
- ] });
1915
- }
1916
- var DEFAULT_TASK_PLAN_LABELS = {
1917
- emptyTitle: "Draft a plan to review",
1918
- emptyBody: "The assistant writes a short checklist of what its work must cover. You can edit it, and it checks its own draft against it before handing it to you.",
1919
- drafting: "Drafting plan\u2026",
1920
- generate: "Draft a plan",
1921
- needWorkspace: "Open a workspace to plan: the checklist is encrypted under its key.",
1922
- needObjective: "Say what the assistant should do first: the plan is drafted from it.",
1923
- goalTask: "Drafted for your review",
1924
- scopedTo: "for",
1925
- redraft: "Redraft",
1926
- removePlan: "Remove plan",
1927
- goal: "Objective",
1928
- goalPlaceholder: "What should the finished work achieve?",
1929
- checklist: "The draft must",
1930
- criteriaCount: (count) => `${count} ${count === 1 ? "criterion" : "criteria"}`,
1931
- add: "Add",
1932
- noCriteria: "Nothing yet. Add at least one thing the draft must cover.",
1933
- criterionPlaceholder: "Something specific you can check\u2026",
1934
- removeCriterion: (n) => `Remove item ${n}`,
1935
- retryBudget: "Revision rounds",
1936
- passes: (count) => `up to ${count} ${count === 1 ? "round" : "rounds"}`,
1937
- passesHelp: "How many times the assistant may revise its own draft before it hands it over.",
1938
- workingDocuments: "Documents it will use",
1939
- workingDocumentsHelp: "The plan limits the assistant to these documents."
1940
- };
1941
- function nextCriterionId(criteria) {
1942
- const max = criteria.reduce((m, c) => {
1943
- const n = Number(/^c(\d+)$/.exec(c.id)?.[1] ?? 0);
1944
- return Number.isFinite(n) && n > m ? n : m;
1945
- }, 0);
1946
- return `c${max + 1}`;
1947
- }
1948
- function TaskPlan({
1949
- plan,
1950
- onChange,
1089
+ function nextCriterionId(criteria) {
1090
+ const max = criteria.reduce((m, c) => {
1091
+ const n = Number(/^c(\d+)$/.exec(c.id)?.[1] ?? 0);
1092
+ return Number.isFinite(n) && n > m ? n : m;
1093
+ }, 0);
1094
+ return `c${max + 1}`;
1095
+ }
1096
+ function TaskPlan({
1097
+ plan,
1098
+ onChange,
1951
1099
  onGenerate,
1952
1100
  isGenerating,
1953
1101
  workspaceName,
@@ -2444,13 +1592,13 @@ function describeRRule(rrule) {
2444
1592
  if (!rrule) return "Recurring";
2445
1593
  const preset = parseRRule(rrule);
2446
1594
  if (!preset) return rrule;
2447
- const time2 = `${pad2(preset.hour)}:${pad2(preset.minute)}`;
2448
- if (preset.frequency === "daily") return `Daily at ${time2}`;
1595
+ const time = `${pad2(preset.hour)}:${pad2(preset.minute)}`;
1596
+ if (preset.frequency === "daily") return `Daily at ${time}`;
2449
1597
  if (preset.frequency === "weekly") {
2450
1598
  const days = preset.weekdays.map((d) => WEEKDAY_LABELS[d]).join(", ");
2451
- return `Weekly on ${days} at ${time2}`;
1599
+ return `Weekly on ${days} at ${time}`;
2452
1600
  }
2453
- return `Monthly on the ${ordinal(preset.monthDay)} at ${time2}`;
1601
+ return `Monthly on the ${ordinal(preset.monthDay)} at ${time}`;
2454
1602
  }
2455
1603
  var DEFAULT_RECURRENCE_BUILDER_LABELS = {
2456
1604
  rruleLabel: "Custom schedule (iCalendar rule)",
@@ -2648,22 +1796,6 @@ function goalProgress(task) {
2648
1796
  if (!gs || gs.criteria_total == null) return null;
2649
1797
  return { met: gs.criteria_met ?? 0, total: gs.criteria_total, done: gs.done === true };
2650
1798
  }
2651
- function PersonPill({ person, size = "sm", testId }) {
2652
- return /* @__PURE__ */ jsxRuntime.jsx("span", { "data-testid": testId, className: "inline-flex min-w-0", children: /* @__PURE__ */ jsxRuntime.jsx(
2653
- ui.UserEntity,
2654
- {
2655
- variant: "pill",
2656
- size,
2657
- interactive: false,
2658
- showTooltip: false,
2659
- initials: chunkKDG6FER6_cjs.initials(person.label),
2660
- displayName: person.label,
2661
- avatarStyle: person.id ? ui.getEntityColorStyles(person.id) : void 0,
2662
- isAgent: person.isAgent,
2663
- isMe: person.isMe
2664
- }
2665
- ) });
2666
- }
2667
1799
  var DEFAULT_TASK_OUTPUTS_CELL_LABELS = {
2668
1800
  none: "\u2014",
2669
1801
  open: (count) => `${count} ${count === 1 ? "output" : "outputs"}`,
@@ -3357,7 +2489,7 @@ function TaskTable(props) {
3357
2489
  isMe: mine
3358
2490
  };
3359
2491
  };
3360
- const renderPerson = props.renderPerson ?? ((person) => /* @__PURE__ */ jsxRuntime.jsx(PersonPill, { person }));
2492
+ const renderPerson = props.renderPerson ?? ((person) => /* @__PURE__ */ jsxRuntime.jsx(chunk3BI6EWKP_cjs.PersonPill, { person }));
3361
2493
  const q = (query.trim() || (props.filterText ?? "").trim()).toLowerCase();
3362
2494
  const counts = react.useMemo(() => {
3363
2495
  const map = new Map(STATUS_ORDER.map((s) => [s, 0]));
@@ -3971,7 +3103,7 @@ function TaskInbox(p) {
3971
3103
  else next.add(id);
3972
3104
  return next;
3973
3105
  });
3974
- p.renderPerson ?? ((value) => /* @__PURE__ */ jsxRuntime.jsx(PersonPill, { person: value }));
3106
+ p.renderPerson ?? ((value) => /* @__PURE__ */ jsxRuntime.jsx(chunk3BI6EWKP_cjs.PersonPill, { person: value }));
3975
3107
  const taskById = new Map(all.map((t) => [t.external_id, t]));
3976
3108
  const visible = new Set(rows.map((t) => t.external_id));
3977
3109
  for (const task of rows) {
@@ -4159,7 +3291,7 @@ function TaskInbox(p) {
4159
3291
  fieldsButton: "tasks-filter-fields"
4160
3292
  },
4161
3293
  filter: /* @__PURE__ */ jsxRuntime.jsx(
4162
- chunkN26CXGXC_cjs.TriStateFilterMenu,
3294
+ chunkRQ2Y7USX_cjs.TriStateFilterMenu,
4163
3295
  {
4164
3296
  testId: "tasks-status-filter",
4165
3297
  open: filterOpen,
@@ -5537,672 +4669,6 @@ function NewThreadDialog({
5537
4669
  }
5538
4670
  ) });
5539
4671
  }
5540
- var DEFAULT_TASK_TRIGGER_CHIP_LABELS = {
5541
- after: (name) => `After \u201C${name}\u201D is done`,
5542
- afterUnknown: "After another task is done",
5543
- onDemand: "Manual"
5544
- };
5545
- function TriggerIcon({ type, chained }) {
5546
- const cls = "size-3.5 shrink-0 text-muted-foreground";
5547
- if (chained) return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Link2, { className: cls, "aria-hidden": true });
5548
- switch (type) {
5549
- case "on_demand":
5550
- return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.MousePointerClick, { className: cls, "aria-hidden": true });
5551
- case "recurring":
5552
- return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Clock, { className: cls, "aria-hidden": true });
5553
- case "event":
5554
- return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Bell, { className: cls, "aria-hidden": true });
5555
- default:
5556
- return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Clock, { className: cls, "aria-hidden": true });
5557
- }
5558
- }
5559
- function TaskTriggerChip({
5560
- id,
5561
- triggerType,
5562
- summary,
5563
- afterTaskId,
5564
- afterTaskName,
5565
- testId,
5566
- labels
5567
- }) {
5568
- const l = { ...DEFAULT_TASK_TRIGGER_CHIP_LABELS, ...labels };
5569
- const chained = Boolean(afterTaskId);
5570
- const text2 = chained ? afterTaskName ? l.after(afterTaskName) : l.afterUnknown : triggerType === "on_demand" ? l.onDemand : summary;
5571
- return /* @__PURE__ */ jsxRuntime.jsxs(
5572
- "span",
5573
- {
5574
- className: "inline-flex min-w-0 max-w-full items-center gap-1.5 text-sm font-normal text-foreground",
5575
- "data-testid": chunkMHVNT4J3_cjs.testIdOr(testId, { testId: `task-trigger-${id}` }),
5576
- "data-trigger": chained ? "task" : triggerType,
5577
- children: [
5578
- /* @__PURE__ */ jsxRuntime.jsx(TriggerIcon, { type: triggerType, chained }),
5579
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: text2 })
5580
- ]
5581
- }
5582
- );
5583
- }
5584
-
5585
- // src/agents/tasks/workflowRows.ts
5586
- var isSkillRow = (row) => row.kind === "skill";
5587
- var hasTrigger = (row) => !row.on_demand && Boolean(row.rrule || row.run_at || row.event_kind || row.after_conversation_ext_id);
5588
- function workflowStatus(row) {
5589
- if (isSkillRow(row) || !hasTrigger(row)) return "on_demand";
5590
- return row.active ? "active" : "paused";
5591
- }
5592
- function workflowTriggerType(workflow) {
5593
- if (workflow.on_demand) return "on_demand";
5594
- if (workflow.after_conversation_ext_id) return "after";
5595
- if (workflow.event_kind) return "event";
5596
- if (workflow.rrule) return "recurring";
5597
- if (workflow.run_at) return "one_time";
5598
- return "on_demand";
5599
- }
5600
- function workflowRunStatusLabel(status) {
5601
- if (!status) return "None";
5602
- const labels = {
5603
- completed: "Success",
5604
- success: "Success",
5605
- failed: "Failed",
5606
- running: "In progress",
5607
- awaiting_authorization: "Awaiting access"
5608
- };
5609
- return labels[status] ?? status.replaceAll("_", " ");
5610
- }
5611
- function listedRunStatus(status, threadStatus) {
5612
- if (threadStatus === "done" && status === "running") return "completed";
5613
- return status;
5614
- }
5615
-
5616
- // src/agents/tasks/workflowColumns.tsx
5617
- var WORKFLOW_COLUMN_ORDER = [
5618
- "name",
5619
- "trigger",
5620
- "last_run",
5621
- "result",
5622
- "status",
5623
- "shared",
5624
- "actions"
5625
- ];
5626
- function cell2(render) {
5627
- return (params) => params.data ? render(params.data) : null;
5628
- }
5629
- var time = (iso) => iso ? Date.parse(iso) : Number.POSITIVE_INFINITY;
5630
- function createWorkflowColumns(o) {
5631
- const l = o.labels;
5632
- const base = {
5633
- sortable: false,
5634
- cellStyle: { display: "flex", alignItems: "center" }
5635
- };
5636
- return [
5637
- {
5638
- ...base,
5639
- colId: "name",
5640
- sortable: true,
5641
- headerName: l.colName,
5642
- flex: 3,
5643
- minWidth: 210,
5644
- valueGetter: (p) => p.data?.name.toLowerCase() ?? "",
5645
- cellRenderer: cell2(o.renderName)
5646
- },
5647
- {
5648
- ...base,
5649
- colId: "trigger",
5650
- headerName: l.colTrigger,
5651
- flex: 2.4,
5652
- minWidth: 185,
5653
- valueGetter: (p) => p.data ? o.getTriggerText(p.data) : "",
5654
- cellRenderer: cell2(o.renderTrigger)
5655
- },
5656
- {
5657
- ...base,
5658
- colId: "last_run",
5659
- sortable: true,
5660
- headerName: l.colLastRun,
5661
- flex: 1.4,
5662
- minWidth: 140,
5663
- cellStyle: { display: "flex", alignItems: "center", padding: 0 },
5664
- valueGetter: (p) => time(p.data?.last_fired_at),
5665
- cellRenderer: cell2(o.renderLastRun)
5666
- },
5667
- {
5668
- ...base,
5669
- colId: "result",
5670
- headerName: "Result",
5671
- width: 130,
5672
- valueGetter: (p) => p.data?.last_run_status ?? "",
5673
- cellStyle: { display: "flex", alignItems: "center", padding: 0 },
5674
- cellRenderer: cell2(o.renderResult)
5675
- },
5676
- {
5677
- ...base,
5678
- colId: "status",
5679
- sortable: true,
5680
- headerName: l.colStatus,
5681
- width: 120,
5682
- valueGetter: (p) => p.data ? workflowStatus(p.data) : "",
5683
- cellRenderer: cell2(o.renderStatus)
5684
- },
5685
- {
5686
- ...base,
5687
- colId: "shared",
5688
- headerName: l.colShared,
5689
- headerTooltip: l.shared,
5690
- width: 96,
5691
- cellStyle: { display: "flex", alignItems: "center", justifyContent: "center" },
5692
- valueGetter: (p) => p.data?.shared ?? false,
5693
- cellRenderer: cell2(o.renderShared)
5694
- },
5695
- {
5696
- ...base,
5697
- colId: "actions",
5698
- headerName: "",
5699
- width: 180,
5700
- minWidth: 180,
5701
- cellStyle: { display: "flex", alignItems: "center", justifyContent: "flex-end" },
5702
- cellRenderer: cell2(o.renderActions)
5703
- }
5704
- ];
5705
- }
5706
-
5707
- // src/agents/tasks/workflowTableLabels.ts
5708
- var DEFAULT_WORKFLOW_LIST_LABELS = {
5709
- colName: "Name",
5710
- colType: "Type",
5711
- colTrigger: "When",
5712
- colAction: "What it does",
5713
- colAgent: "Agent",
5714
- colStatus: "Active",
5715
- colShared: "Shared",
5716
- colLastRun: "Last run",
5717
- colNextRun: "Next run",
5718
- shared: "Shared with the workspace",
5719
- sharedOwnerOnly: "Only the creator can change who can see this",
5720
- deleteOwnerOnly: "Only the creator or workspace owner can delete this",
5721
- typeSkill: "Skill",
5722
- typeWorkflow: "Workflow",
5723
- statusActive: "Active",
5724
- statusPaused: "Inactive",
5725
- statusOnDemand: "On demand",
5726
- activeSwitch: (name) => `Active: \u201C${name}\u201D`,
5727
- agent: "Agent",
5728
- myAssistant: "My assistant",
5729
- me: "Me",
5730
- someone: "Someone",
5731
- never: "Never",
5732
- none: "\u2014",
5733
- reminder: "Reminder",
5734
- failed: "Failed",
5735
- lastRunFailed: "Last run failed",
5736
- openLastRun: "Open the task this run created",
5737
- editWorkflow: "Edit",
5738
- run: "Run",
5739
- runLater: "Run later",
5740
- runNow: "Run now",
5741
- runs: "Runs",
5742
- delete: "Delete",
5743
- moreActions: "More actions",
5744
- searchLabel: "Search workflows",
5745
- searchPlaceholder: "Search workflows and skills\u2026",
5746
- emptyTitle: "Nothing to run yet",
5747
- emptyMessage: "Skills and workflows you can run will appear here.",
5748
- firstRun: "Run a skill now, or choose Run later to save it as a workflow that runs on its own.",
5749
- noMatches: "Nothing in this view.",
5750
- filterAll: "All",
5751
- filterSkills: "Skills",
5752
- filterWorkflows: "Workflows",
5753
- filterActive: "Active",
5754
- filterPaused: "Inactive",
5755
- makeActive: "Make active",
5756
- makePaused: "Deactivate",
5757
- selectAll: "Select all",
5758
- selectWorkflow: (name) => `Select ${name}`
5759
- };
5760
- var ROW_HEIGHT2 = 40;
5761
- function WorkflowsTable(props) {
5762
- const { workflows, isLoading, busyId, header, testId } = props;
5763
- const l = { ...DEFAULT_WORKFLOW_LIST_LABELS, ...props.labels };
5764
- const [filterStates, setFilterStates] = react.useState(/* @__PURE__ */ new Map());
5765
- const [filterOpen, setFilterOpen] = react.useState(false);
5766
- const [query, setQuery] = react.useState("");
5767
- const [selected, setSelected] = react.useState([]);
5768
- const apiRef = react.useRef(null);
5769
- const q = query.trim().toLowerCase();
5770
- const matches = (w) => !q || `${w.name} ${w.description ?? ""} ${w.prompt ?? ""} ${w.skill_ref ?? ""}`.toLowerCase().includes(q);
5771
- const inFilter = (w, f) => f === "all" || f === "skills" && isSkillRow(w) || f === "workflows" && !isSkillRow(w) || f === "active" && workflowStatus(w) === "active" || f === "paused" && workflowStatus(w) === "paused";
5772
- const counts = react.useMemo(() => {
5773
- const out = { all: 0, skills: 0, workflows: 0, active: 0, paused: 0 };
5774
- for (const w of workflows) {
5775
- if (!matches(w)) continue;
5776
- for (const f of Object.keys(out)) if (inFilter(w, f)) out[f] += 1;
5777
- }
5778
- return out;
5779
- }, [workflows, q]);
5780
- const shown = react.useMemo(
5781
- () => workflows.filter((w) => {
5782
- if (!matches(w)) return false;
5783
- for (const group of [
5784
- ["skills", "workflows"],
5785
- ["active", "paused"]
5786
- ]) {
5787
- const included = group.filter((f) => filterStates.get(f) === "include");
5788
- if (included.length && !included.some((f) => inFilter(w, f))) return false;
5789
- if (group.some((f) => filterStates.get(f) === "exclude" && inFilter(w, f))) return false;
5790
- }
5791
- return true;
5792
- }),
5793
- [workflows, filterStates, q]
5794
- );
5795
- const renderPerson = props.renderPerson ?? ((p) => /* @__PURE__ */ jsxRuntime.jsx(PersonPill, { person: p }));
5796
- const actionText = (w) => {
5797
- if (w.action)
5798
- return w.action.type === "email_documents" ? "Email latest documents" : "AI Review";
5799
- if (isSkillRow(w))
5800
- return w.description || w.skill_ref && props.skillNames?.[w.skill_ref] || w.name;
5801
- return w.skill_ref ? props.skillNames?.[w.skill_ref] ?? w.skill_ref : w.prompt?.trim() || l.reminder;
5802
- };
5803
- const latest = react.useRef({ props, l, renderPerson, actionText });
5804
- latest.current = { props, l, renderPerson, actionText };
5805
- const columnDefs = react.useMemo(
5806
- () => createWorkflowColumns({
5807
- labels: l,
5808
- getTriggerText: (w) => isSkillRow(w) ? l.statusOnDemand : latest.current.props.describeTrigger(w),
5809
- renderName: (w) => {
5810
- const { l: lb } = latest.current;
5811
- const skill = isSkillRow(w);
5812
- const text2 = skill ? latest.current.actionText(w) : w.description || latest.current.actionText(w);
5813
- const stem = w.name.replace(/…$/, "").trim();
5814
- const about = text2 && text2.trim() !== w.name.trim() && text2.trim() !== stem ? text2 : "";
5815
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 leading-tight", children: [
5816
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex min-w-0 items-center gap-1.5", children: [
5817
- /* @__PURE__ */ jsxRuntime.jsx(
5818
- "span",
5819
- {
5820
- className: ui.cn(
5821
- "truncate text-sm font-normal",
5822
- workflowStatus(w) === "paused" && "text-muted-foreground"
5823
- ),
5824
- "data-testid": `workflow-name-${w.external_id}`,
5825
- children: w.name
5826
- }
5827
- ),
5828
- skill && /* @__PURE__ */ jsxRuntime.jsx(
5829
- "span",
5830
- {
5831
- className: "shrink-0 rounded-full border border-border px-1.5 text-[11px] text-muted-foreground",
5832
- "data-testid": `workflow-type-${w.external_id}`,
5833
- children: lb.typeSkill
5834
- }
5835
- )
5836
- ] }),
5837
- about && !latest.current.props.automationsOnly && /* @__PURE__ */ jsxRuntime.jsx(
5838
- "p",
5839
- {
5840
- className: "truncate text-xs text-muted-foreground",
5841
- "data-testid": `workflow-action-${w.external_id}`,
5842
- children: about
5843
- }
5844
- )
5845
- ] });
5846
- },
5847
- renderTrigger: (w) => {
5848
- const { props: p } = latest.current;
5849
- const after = w.after_conversation_ext_id;
5850
- const skill = isSkillRow(w);
5851
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-w-0 leading-tight", children: /* @__PURE__ */ jsxRuntime.jsx(
5852
- TaskTriggerChip,
5853
- {
5854
- id: w.external_id,
5855
- testId: `workflow-trigger-${w.external_id}`,
5856
- triggerType: workflowTriggerType(w),
5857
- summary: skill ? "" : p.describeTrigger(w),
5858
- afterTaskId: after,
5859
- afterTaskName: after ? p.taskNames?.[after] : void 0,
5860
- labels: p.triggerChipLabels
5861
- }
5862
- ) });
5863
- },
5864
- renderStatus: (w) => {
5865
- const { props: p, l: lb } = latest.current;
5866
- const canEdit = w.is_owner !== false || Boolean(p.canEditShared);
5867
- return /* @__PURE__ */ jsxRuntime.jsx(
5868
- ui.Switch,
5869
- {
5870
- checked: hasTrigger(w) && !isSkillRow(w) && Boolean(w.active),
5871
- disabled: !hasTrigger(w) || isSkillRow(w) || !canEdit || p.busyId === w.external_id,
5872
- onCheckedChange: (next) => p.onToggleActive(w, next),
5873
- className: "disabled:data-[state=unchecked]:bg-muted dark:disabled:data-[state=unchecked]:bg-muted",
5874
- "aria-label": lb.activeSwitch(w.name),
5875
- "data-testid": `workflow-active-${w.external_id}`
5876
- }
5877
- );
5878
- },
5879
- renderShared: (w) => {
5880
- const { props: p, l: lb } = latest.current;
5881
- if (!p.onToggleShared || isSkillRow(w)) return null;
5882
- const isCreator = w.is_owner !== false;
5883
- return /* @__PURE__ */ jsxRuntime.jsx(
5884
- ui.VisibilityToggle,
5885
- {
5886
- items: { shared: w.shared ?? false },
5887
- onToggle: (share) => latest.current.props.onToggleShared?.(w, share),
5888
- disabled: !isCreator || p.busyId === w.external_id,
5889
- disabledTooltip: lb.sharedOwnerOnly,
5890
- showLabel: false,
5891
- "data-testid": `workflow-shared-${w.external_id}`
5892
- }
5893
- );
5894
- },
5895
- renderLastRun: (w) => {
5896
- const { props: p, l: lb } = latest.current;
5897
- const at = w.last_fired_at ?? p.lastRuns?.[w.external_id]?.at;
5898
- return /* @__PURE__ */ jsxRuntime.jsx(
5899
- "button",
5900
- {
5901
- type: "button",
5902
- className: "h-full w-full truncate px-4 text-left text-sm hover:text-primary",
5903
- onClick: () => p.onViewRuns?.(w),
5904
- title: "View run history",
5905
- "data-testid": `workflow-last-run-${w.external_id}`,
5906
- children: at ? p.formatDate(at) : lb.never
5907
- }
5908
- );
5909
- },
5910
- renderResult: (w) => {
5911
- const status = listedRunStatus(
5912
- w.last_run_status,
5913
- latest.current.props.lastRuns?.[w.external_id]?.threadStatus
5914
- );
5915
- const label = workflowRunStatusLabel(status);
5916
- return /* @__PURE__ */ jsxRuntime.jsx(
5917
- "button",
5918
- {
5919
- type: "button",
5920
- onClick: () => latest.current.props.onViewRuns?.(w),
5921
- title: "View run history",
5922
- className: ui.cn(
5923
- ui.badgeVariants({ variant: "outline" }),
5924
- "mx-4 cursor-pointer text-xs font-medium",
5925
- 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"
5926
- ),
5927
- "data-testid": `workflow-result-${w.external_id}`,
5928
- children: label
5929
- }
5930
- );
5931
- },
5932
- renderActions: (w) => {
5933
- const { props: p, l: lb } = latest.current;
5934
- const id = w.external_id;
5935
- const skill = isSkillRow(w);
5936
- const busy = p.busyId === id;
5937
- const isOwner = w.is_owner !== false;
5938
- const canEdit = isOwner || Boolean(p.canEditShared);
5939
- const canAdmin = isOwner || Boolean(p.isWorkspaceOwner);
5940
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-end gap-1", children: [
5941
- (skill || canEdit) && /* @__PURE__ */ jsxRuntime.jsxs(
5942
- ui.Button,
5943
- {
5944
- size: "sm",
5945
- variant: "outline",
5946
- className: "h-8 gap-1.5 pointer-coarse:h-11",
5947
- disabled: busy,
5948
- onClick: () => p.onRun(w),
5949
- "data-testid": `workflow-run-btn-${id}`,
5950
- children: [
5951
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Play, { className: "size-3.5", "aria-hidden": true }),
5952
- lb.run
5953
- ]
5954
- }
5955
- ),
5956
- /* @__PURE__ */ jsxRuntime.jsxs(ui.DropdownMenu, { children: [
5957
- /* @__PURE__ */ jsxRuntime.jsx(ui.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
5958
- ui.Button,
5959
- {
5960
- variant: "ghost",
5961
- size: "icon",
5962
- className: "size-8 pointer-coarse:size-11",
5963
- "aria-label": lb.moreActions,
5964
- "data-testid": `workflow-menu-${id}`,
5965
- children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.MoreHorizontal, { className: "size-4", "aria-hidden": true })
5966
- }
5967
- ) }),
5968
- /* @__PURE__ */ jsxRuntime.jsxs(ui.DropdownMenuContent, { align: "end", children: [
5969
- skill && p.onRunLater && /* @__PURE__ */ jsxRuntime.jsxs(
5970
- ui.DropdownMenuItem,
5971
- {
5972
- onSelect: () => p.onRunLater?.(w),
5973
- "data-testid": `workflow-run-later-${id}`,
5974
- children: [
5975
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.History, { className: "mr-2 size-4", "aria-hidden": true }),
5976
- lb.runLater
5977
- ]
5978
- }
5979
- ),
5980
- !skill && canEdit && /* @__PURE__ */ jsxRuntime.jsxs(
5981
- ui.DropdownMenuItem,
5982
- {
5983
- onSelect: () => p.onEdit(w),
5984
- "data-testid": `workflow-edit-${id}`,
5985
- children: [
5986
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Pencil, { className: "mr-2 size-4", "aria-hidden": true }),
5987
- lb.editWorkflow
5988
- ]
5989
- }
5990
- ),
5991
- !skill && p.onViewRuns && /* @__PURE__ */ jsxRuntime.jsxs(
5992
- ui.DropdownMenuItem,
5993
- {
5994
- onSelect: () => p.onViewRuns?.(w),
5995
- "data-testid": `workflow-runs-${id}`,
5996
- children: [
5997
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.History, { className: "mr-2 size-4", "aria-hidden": true }),
5998
- lb.runs
5999
- ]
6000
- }
6001
- ),
6002
- !skill && canEdit && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
6003
- /* @__PURE__ */ jsxRuntime.jsx(ui.DropdownMenuSeparator, {}),
6004
- /* @__PURE__ */ jsxRuntime.jsxs(
6005
- ui.DropdownMenuItem,
6006
- {
6007
- disabled: busy || !canAdmin,
6008
- onSelect: () => p.onDelete(w),
6009
- title: canAdmin ? void 0 : lb.deleteOwnerOnly,
6010
- className: "text-destructive focus:text-destructive",
6011
- "data-testid": `workflow-delete-${id}`,
6012
- children: [
6013
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Trash2, { className: "mr-2 size-4", "aria-hidden": true }),
6014
- lb.delete
6015
- ]
6016
- }
6017
- )
6018
- ] })
6019
- ] })
6020
- ] })
6021
- ] });
6022
- }
6023
- }),
6024
- // Stable on purpose: only the header texts rebuild the columns (see `latest`).
6025
- // eslint-disable-next-line react-hooks/exhaustive-deps
6026
- [
6027
- l.colName,
6028
- l.colType,
6029
- l.colTrigger,
6030
- l.colAction,
6031
- l.colAgent,
6032
- l.colStatus,
6033
- l.colShared,
6034
- l.shared,
6035
- l.colLastRun,
6036
- l.colNextRun
6037
- ]
6038
- );
6039
- react.useEffect(() => {
6040
- apiRef.current?.refreshCells({ force: true });
6041
- }, [
6042
- busyId,
6043
- props.agentNames,
6044
- props.skillNames,
6045
- props.taskNames,
6046
- props.lastRuns,
6047
- props.renderPerson,
6048
- props.labels,
6049
- props.canEditShared,
6050
- props.isWorkspaceOwner
6051
- ]);
6052
- const mine = selected.filter((w) => !isSkillRow(w));
6053
- const adminSelected = mine.filter((w) => w.is_owner !== false || props.isWorkspaceOwner);
6054
- const editableSelected = mine.filter(
6055
- (w) => hasTrigger(w) && (w.is_owner !== false || props.canEditShared)
6056
- );
6057
- const clearSelection = () => setSelected([]);
6058
- return /* @__PURE__ */ jsxRuntime.jsxs(
6059
- "div",
6060
- {
6061
- className: "flex min-h-0 flex-1 flex-col",
6062
- "data-testid": chunkMHVNT4J3_cjs.testIdOr(testId, { testId: "workflow-list" }),
6063
- children: [
6064
- /* @__PURE__ */ jsxRuntime.jsx(
6065
- chunk7RGLTF76_cjs.TabHeader,
6066
- {
6067
- testId: "automations-tab-header",
6068
- tabs: [
6069
- {
6070
- id: "automations",
6071
- label: "",
6072
- count: shown.length,
6073
- countIcon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Workflow, { className: "size-3.5" }),
6074
- countPlacement: "leading",
6075
- presentation: "count",
6076
- hasActiveFilters: !!q || [...filterStates.values()].some(Boolean)
6077
- },
6078
- ...props.tabs ?? []
6079
- ],
6080
- activeTabId: props.activeTabId ?? "automations",
6081
- onTabChange: props.onTabChange ?? (() => {
6082
- }),
6083
- firstTabContent: /* @__PURE__ */ jsxRuntime.jsx(
6084
- chunk2EI7NCUA_cjs.FilterInput,
6085
- {
6086
- value: query,
6087
- onChange: setQuery,
6088
- fields: ["text"],
6089
- onFieldsChange: () => {
6090
- },
6091
- hideFieldPicker: true,
6092
- ariaLabel: l.searchLabel,
6093
- testIds: { input: "workflow-search" },
6094
- filter: /* @__PURE__ */ jsxRuntime.jsx(
6095
- chunkN26CXGXC_cjs.TriStateFilterMenu,
6096
- {
6097
- testId: "automations-filter-button",
6098
- open: filterOpen,
6099
- onOpenChange: setFilterOpen,
6100
- filterStates,
6101
- onFiltersChange: setFilterStates,
6102
- 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",
6103
- renderChevron: true,
6104
- disableHoverOpen: true,
6105
- options: [
6106
- ...!props.automationsOnly ? [
6107
- { id: "skills", label: l.filterSkills, count: counts.skills },
6108
- {
6109
- id: "workflows",
6110
- label: l.filterWorkflows,
6111
- count: counts.workflows
6112
- }
6113
- ] : [],
6114
- { id: "active", label: l.filterActive, count: counts.active },
6115
- { id: "paused", label: l.filterPaused, count: counts.paused }
6116
- ]
6117
- }
6118
- )
6119
- }
6120
- ),
6121
- rightContent: header
6122
- }
6123
- ),
6124
- props.content ? props.content : workflows.length === 0 && !isLoading ? /* @__PURE__ */ jsxRuntime.jsx(
6125
- chunkZW6FPIFC_cjs.EmptyState,
6126
- {
6127
- icon: lucideReact.Workflow,
6128
- title: l.emptyTitle,
6129
- description: l.emptyMessage,
6130
- testId: "workflow-list-empty"
6131
- }
6132
- ) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "min-h-0 flex-1", children: /* @__PURE__ */ jsxRuntime.jsx(
6133
- chunkC2CWWEHO_cjs.GridView,
6134
- {
6135
- testId: "workflow-grid",
6136
- gridId: props.gridId ?? "workflows-grid-v2",
6137
- items: shown,
6138
- columnDefs,
6139
- getItemId: (w) => w.external_id,
6140
- getRowTestId: (w) => `workflow-row-${w.external_id}`,
6141
- isLoading,
6142
- showEmpty: shown.length === 0,
6143
- emptyState: { title: l.noMatches },
6144
- rowHeight: ROW_HEIGHT2,
6145
- height: "100%",
6146
- onGridReady: ({ api }) => {
6147
- apiRef.current = api;
6148
- },
6149
- onRowClick: (row) => props.onOpenRow?.(row),
6150
- selection: { mode: "multiple", selected, onSelectionChange: setSelected },
6151
- gridOptions: GRID_OPTIONS
6152
- }
6153
- ) }),
6154
- !props.content && /* @__PURE__ */ jsxRuntime.jsx(chunkV4ISCZJ7_cjs.SelectionBar, { count: selected.length, onClear: clearSelection, children: (isCompact) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
6155
- props.onToggleActiveMany && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
6156
- /* @__PURE__ */ jsxRuntime.jsx(
6157
- chunkV4ISCZJ7_cjs.SelectionBarAction,
6158
- {
6159
- icon: lucideReact.Play,
6160
- label: l.makeActive,
6161
- onClick: () => {
6162
- props.onToggleActiveMany?.(editableSelected, true);
6163
- clearSelection();
6164
- },
6165
- disabled: editableSelected.length === 0,
6166
- isCompact,
6167
- testId: "workflow-bulk-activate"
6168
- }
6169
- ),
6170
- /* @__PURE__ */ jsxRuntime.jsx(
6171
- chunkV4ISCZJ7_cjs.SelectionBarAction,
6172
- {
6173
- icon: lucideReact.Workflow,
6174
- label: l.makePaused,
6175
- onClick: () => {
6176
- props.onToggleActiveMany?.(editableSelected, false);
6177
- clearSelection();
6178
- },
6179
- disabled: editableSelected.length === 0,
6180
- isCompact,
6181
- testId: "workflow-bulk-pause"
6182
- }
6183
- )
6184
- ] }),
6185
- props.onDeleteMany && /* @__PURE__ */ jsxRuntime.jsx(
6186
- chunkV4ISCZJ7_cjs.SelectionBarAction,
6187
- {
6188
- icon: lucideReact.Trash2,
6189
- label: l.delete,
6190
- onClick: () => {
6191
- props.onDeleteMany?.(adminSelected);
6192
- clearSelection();
6193
- },
6194
- disabled: adminSelected.length === 0,
6195
- isCompact,
6196
- className: "border-red-border text-red-text hover:bg-red-bg hover:text-red-text",
6197
- testId: "workflow-bulk-delete"
6198
- }
6199
- )
6200
- ] }) })
6201
- ]
6202
- }
6203
- );
6204
- }
6205
- var GRID_OPTIONS = { suppressClickEdit: true };
6206
4672
  function TaskActivityDialog({
6207
4673
  open,
6208
4674
  onOpenChange,
@@ -6214,7 +4680,7 @@ function TaskActivityDialog({
6214
4680
  testId,
6215
4681
  ...timeline
6216
4682
  }) {
6217
- const l = { ...chunkLIHRGG4M_cjs.DEFAULT_TASK_ACTIVITY_LABELS, ...labels };
4683
+ const l = { ...chunk3BI6EWKP_cjs.DEFAULT_TASK_ACTIVITY_LABELS, ...labels };
6218
4684
  const id = chunkMHVNT4J3_cjs.testIdOr(testId, { testId: "task-activity" });
6219
4685
  const count = events?.length ?? 0;
6220
4686
  const scrollToEnd = react.useCallback(
@@ -6229,7 +4695,7 @@ function TaskActivityDialog({
6229
4695
  /* @__PURE__ */ jsxRuntime.jsx(ui.DialogDescription, { className: "truncate", children: taskName })
6230
4696
  ] }),
6231
4697
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "max-h-[55dvh] overflow-y-auto pr-1", "data-testid": `${id}-scroll`, children: [
6232
- isLoading && !events ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: l.loading }) : isError && !events ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-destructive", children: l.error }) : count === 0 ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: l.empty }) : /* @__PURE__ */ jsxRuntime.jsx(chunkLIHRGG4M_cjs.TaskActivityTimeline, { events: events ?? [], labels, testId: id, ...timeline }),
4698
+ isLoading && !events ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: l.loading }) : isError && !events ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-destructive", children: l.error }) : count === 0 ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground", children: l.empty }) : /* @__PURE__ */ jsxRuntime.jsx(chunk3BI6EWKP_cjs.TaskActivityTimeline, { events: events ?? [], labels, testId: id, ...timeline }),
6233
4699
  /* @__PURE__ */ jsxRuntime.jsx("div", { ref: scrollToEnd })
6234
4700
  ] })
6235
4701
  ] }) });
@@ -6607,7 +5073,7 @@ function WorkflowRunStatus({
6607
5073
  const ordered = chunkOWCEQKAR_cjs.stepLevels(steps).flat();
6608
5074
  const phaseOf = (id) => isLoading ? "blocked" : chunkOWCEQKAR_cjs.stepPhase(steps, states, id);
6609
5075
  const finished = !isLoading && chunkOWCEQKAR_cjs.isRunFinished(steps, states);
6610
- const atId = finished || isLoading ? void 0 : chunkLIHRGG4M_cjs.activeStepId(chunkOWCEQKAR_cjs.stepLevels(steps), phaseOf);
5076
+ const atId = finished || isLoading ? void 0 : chunk3BI6EWKP_cjs.activeStepId(chunkOWCEQKAR_cjs.stepLevels(steps), phaseOf);
6611
5077
  const at = ordered.find((s) => s.id === atId);
6612
5078
  const phase = at ? phaseOf(at.id) : "done";
6613
5079
  const assignee = at && ["ready", "waiting"].includes(phase) ? assigneeOf?.(at) : void 0;
@@ -6880,7 +5346,7 @@ function WorkflowThreadStrip({
6880
5346
  className
6881
5347
  }) {
6882
5348
  const l = { ...DEFAULT_WORKFLOW_THREAD_STRIP_LABELS, ...labels };
6883
- const barL = { ...chunkLIHRGG4M_cjs.DEFAULT_STEP_BAR_LABELS, ...barLabels };
5349
+ const barL = { ...chunk3BI6EWKP_cjs.DEFAULT_STEP_BAR_LABELS, ...barLabels };
6884
5350
  const grouped = groupThreadActivity(steps, items);
6885
5351
  const strays = signals.filter((s) => !steps.some((step) => step.id === s.step));
6886
5352
  const link = /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": true, className: "wf-link wf-kind-start max-w-6", "data-done": true });
@@ -6934,7 +5400,7 @@ function WorkflowThreadStrip({
6934
5400
  waiting
6935
5401
  ] })
6936
5402
  ] }),
6937
- labelClassName: isCurrent ? chunkLIHRGG4M_cjs.STEP_LABEL_CURRENT : ui.cn(chunkLIHRGG4M_cjs.STEP_LABEL, chunkLIHRGG4M_cjs.STEP_LABEL_MAX),
5403
+ labelClassName: isCurrent ? chunk3BI6EWKP_cjs.STEP_LABEL_CURRENT : ui.cn(chunk3BI6EWKP_cjs.STEP_LABEL, chunk3BI6EWKP_cjs.STEP_LABEL_MAX),
6938
5404
  className: ui.cn(latestDoc && "rounded-r-none"),
6939
5405
  title: waiting ? `${step.title} \xB7 ${waiting}` : step.title,
6940
5406
  "data-testid": `workflow-thread-step-${step.id}`,
@@ -7054,7 +5520,7 @@ function WorkflowThreadStrip({
7054
5520
  ] }),
7055
5521
  strays.map((s) => /* @__PURE__ */ jsxRuntime.jsx(SignalPill, { signal: s, l }, `${s.step}-${s.signal}`))
7056
5522
  ] }) : null;
7057
- const at = steps.find((s) => s.id === (selected ?? chunkLIHRGG4M_cjs.activeStepId(chunkOWCEQKAR_cjs.stepLevels(steps), phaseOf)));
5523
+ const at = steps.find((s) => s.id === (selected ?? chunk3BI6EWKP_cjs.activeStepId(chunkOWCEQKAR_cjs.stepLevels(steps), phaseOf)));
7058
5524
  const headingPx = (step) => `${l.kinds[chunkOWCEQKAR_cjs.stepKindOf(step)]} \xB7 ${waitingOf(step.id) ?? ""}`.length * 5.6 - step.title.length * 6.5;
7059
5525
  const reserve = {
7060
5526
  always: (at ? Math.max(0, headingPx(at)) : 0) + steps.filter((s) => grouped.byStep[s.id]?.length).length * BEADS_PX + (onOpenDocument ? steps.filter((s) => chunkOWCEQKAR_cjs.stepDocuments(steps, states, s.id).length).length * DOC_BUTTON_PX : 0),
@@ -7062,7 +5528,7 @@ function WorkflowThreadStrip({
7062
5528
  trailing: trailing ? 120 : 0
7063
5529
  };
7064
5530
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: ui.cn("min-w-0 flex-1", className), "data-testid": "workflow-thread-strip", children: /* @__PURE__ */ jsxRuntime.jsx(
7065
- chunkLIHRGG4M_cjs.StepBarFrame,
5531
+ chunk3BI6EWKP_cjs.StepBarFrame,
7066
5532
  {
7067
5533
  levels: chunkOWCEQKAR_cjs.stepLevels(steps),
7068
5534
  phaseOf,
@@ -7297,7 +5763,7 @@ function TaskRunsDialog({
7297
5763
  "rounded-full px-2 py-0.5 text-xs font-medium capitalize",
7298
5764
  STATUS_STYLE[data.status] ?? "text-muted-foreground"
7299
5765
  ),
7300
- children: workflowRunStatusLabel(data.status)
5766
+ children: chunk3BI6EWKP_cjs.workflowRunStatusLabel(data.status)
7301
5767
  }
7302
5768
  )
7303
5769
  },
@@ -7640,7 +6106,7 @@ function WorkflowComposer({
7640
6106
  // eslint-disable-next-line react-hooks/exhaustive-deps
7641
6107
  [workflows, open]
7642
6108
  );
7643
- const [values, setValues] = useControllableState(
6109
+ const [values, setValues] = chunk3BI6EWKP_cjs.useControllableState(
7644
6110
  valuesProp,
7645
6111
  seed,
7646
6112
  onValuesChange
@@ -7813,7 +6279,7 @@ function WorkflowComposer({
7813
6279
  },
7814
6280
  "data-testid": `${id}-dropzone`,
7815
6281
  children: /* @__PURE__ */ jsxRuntime.jsx(
7816
- chunk44R3CCZT_cjs.AddFilesFirst,
6282
+ chunkWS5EX7DN_cjs.AddFilesFirst,
7817
6283
  {
7818
6284
  reason: l.addFilesReason,
7819
6285
  action: addFilesAction,
@@ -7823,7 +6289,7 @@ function WorkflowComposer({
7823
6289
  }
7824
6290
  ),
7825
6291
  !noFiles && workflow && fields.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
7826
- chunkLIHRGG4M_cjs.SchemaForm,
6292
+ chunk3BI6EWKP_cjs.SchemaForm,
7827
6293
  {
7828
6294
  fields,
7829
6295
  values: values.inputs,
@@ -8248,7 +6714,7 @@ function WorkTaskComposer({
8248
6714
  // eslint-disable-next-line react-hooks/exhaustive-deps
8249
6715
  [workflows, open]
8250
6716
  );
8251
- const [values, setValues] = useControllableState(
6717
+ const [values, setValues] = chunk3BI6EWKP_cjs.useControllableState(
8252
6718
  valuesProp,
8253
6719
  seed,
8254
6720
  onValuesChange
@@ -8456,7 +6922,7 @@ function WorkTaskComposer({
8456
6922
  )
8457
6923
  ] }),
8458
6924
  workflow && fields.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
8459
- chunkLIHRGG4M_cjs.SchemaForm,
6925
+ chunk3BI6EWKP_cjs.SchemaForm,
8460
6926
  {
8461
6927
  fields,
8462
6928
  values: values.inputs,
@@ -10400,7 +8866,7 @@ function AgentCreateView({
10400
8866
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-normal text-muted-foreground", children: l.optional })
10401
8867
  ] }),
10402
8868
  /* @__PURE__ */ jsxRuntime.jsx(
10403
- chunkS5HZBXZA_cjs.MultiSelect,
8869
+ chunkRFIBUWLF_cjs.MultiSelect,
10404
8870
  {
10405
8871
  data: workspaces.map((ws) => ({ label: ws.name, value: ws.id })),
10406
8872
  value: selectedWorkspaces,
@@ -10447,7 +8913,6 @@ exports.AgentCreator = AgentCreator;
10447
8913
  exports.AgentEditView = AgentEditView;
10448
8914
  exports.AgentGallery = AgentGallery;
10449
8915
  exports.AgentMainView = AgentMainView;
10450
- exports.AgentSelect = AgentSelect;
10451
8916
  exports.AgentTypeSelector = AgentTypeSelector;
10452
8917
  exports.CapabilityGrid = CapabilityGrid;
10453
8918
  exports.CapabilityTile = CapabilityTile;
@@ -10473,7 +8938,6 @@ exports.DEFAULT_AGENT_BAR_LABELS = DEFAULT_AGENT_BAR_LABELS;
10473
8938
  exports.DEFAULT_AGENT_CARD_LABELS = DEFAULT_AGENT_CARD_LABELS;
10474
8939
  exports.DEFAULT_AGENT_CREATOR_LABELS = DEFAULT_AGENT_CREATOR_LABELS;
10475
8940
  exports.DEFAULT_AGENT_GALLERY_LABELS = DEFAULT_AGENT_GALLERY_LABELS;
10476
- exports.DEFAULT_AGENT_SELECT_LABELS = DEFAULT_AGENT_SELECT_LABELS;
10477
8941
  exports.DEFAULT_AGENT_STEPS_LABELS = DEFAULT_AGENT_STEPS_LABELS;
10478
8942
  exports.DEFAULT_AGENT_TYPE_SELECTOR_LABELS = DEFAULT_AGENT_TYPE_SELECTOR_LABELS;
10479
8943
  exports.DEFAULT_AUTHORIZE_AGENT_LABELS = DEFAULT_AUTHORIZE_AGENT_LABELS;
@@ -10486,11 +8950,7 @@ exports.DEFAULT_PILL_SELECT_LABELS = DEFAULT_PILL_SELECT_LABELS;
10486
8950
  exports.DEFAULT_RECURRENCE = DEFAULT_RECURRENCE;
10487
8951
  exports.DEFAULT_RECURRENCE_BUILDER_LABELS = DEFAULT_RECURRENCE_BUILDER_LABELS;
10488
8952
  exports.DEFAULT_SKILL_CARD_LABELS = DEFAULT_SKILL_CARD_LABELS;
10489
- exports.DEFAULT_SKILL_EDIT_FORM_LABELS = DEFAULT_SKILL_EDIT_FORM_LABELS;
10490
- exports.DEFAULT_SKILL_GENERATE_FORM_LABELS = DEFAULT_SKILL_GENERATE_FORM_LABELS;
10491
- exports.DEFAULT_SKILL_GLOBAL_BADGE_LABELS = DEFAULT_SKILL_GLOBAL_BADGE_LABELS;
10492
8953
  exports.DEFAULT_SKILL_ROW_LABELS = DEFAULT_SKILL_ROW_LABELS;
10493
- exports.DEFAULT_SKILL_VIEW_TOGGLE_LABELS = DEFAULT_SKILL_VIEW_TOGGLE_LABELS;
10494
8954
  exports.DEFAULT_SUBAGENT_ROSTER_LABELS = DEFAULT_SUBAGENT_ROSTER_LABELS;
10495
8955
  exports.DEFAULT_TASKS_CHROME_LABELS = DEFAULT_TASKS_CHROME_LABELS;
10496
8956
  exports.DEFAULT_TASK_COMPOSER_LABELS = DEFAULT_TASK_COMPOSER_LABELS;
@@ -10500,15 +8960,12 @@ exports.DEFAULT_TASK_PLAN_LABELS = DEFAULT_TASK_PLAN_LABELS;
10500
8960
  exports.DEFAULT_TASK_RUNS_DIALOG_LABELS = DEFAULT_TASK_RUNS_DIALOG_LABELS;
10501
8961
  exports.DEFAULT_TASK_STATUS_PILL_LABELS = DEFAULT_TASK_STATUS_PILL_LABELS;
10502
8962
  exports.DEFAULT_TASK_THREAD_CHIP_LABELS = DEFAULT_TASK_THREAD_CHIP_LABELS;
10503
- exports.DEFAULT_TASK_TRIGGER_CHIP_LABELS = DEFAULT_TASK_TRIGGER_CHIP_LABELS;
10504
8963
  exports.DEFAULT_THREAD_LAUNCHER_LABELS = DEFAULT_THREAD_LAUNCHER_LABELS;
10505
8964
  exports.DEFAULT_THREAD_STATE_LABELS = DEFAULT_THREAD_STATE_LABELS;
10506
8965
  exports.DEFAULT_TUPLE_ARRAY_FIELD_LABELS = DEFAULT_TUPLE_ARRAY_FIELD_LABELS;
10507
8966
  exports.DEFAULT_UPLOAD_TASK_ITEM_LABELS = DEFAULT_UPLOAD_TASK_ITEM_LABELS;
10508
8967
  exports.DEFAULT_UPLOAD_TASK_LIST_LABELS = DEFAULT_UPLOAD_TASK_LIST_LABELS;
10509
8968
  exports.DEFAULT_WORKFLOWS_CHROME_LABELS = DEFAULT_WORKFLOWS_CHROME_LABELS;
10510
- exports.DEFAULT_WORKFLOW_CONFIG_DIALOG_LABELS = DEFAULT_WORKFLOW_CONFIG_DIALOG_LABELS;
10511
- exports.DEFAULT_WORKFLOW_LIST_LABELS = DEFAULT_WORKFLOW_LIST_LABELS;
10512
8969
  exports.DEFAULT_WORKFLOW_RUN_STATUS_LABELS = DEFAULT_WORKFLOW_RUN_STATUS_LABELS;
10513
8970
  exports.DEFAULT_WORKFLOW_THREAD_STRIP_LABELS = DEFAULT_WORKFLOW_THREAD_STRIP_LABELS;
10514
8971
  exports.DERIVED_NAME_WORDS = DERIVED_NAME_WORDS;
@@ -10517,24 +8974,13 @@ exports.EntityChip = EntityChip;
10517
8974
  exports.GoalCriteria = GoalCriteria;
10518
8975
  exports.MAX_TASK_DEPTH = MAX_TASK_DEPTH;
10519
8976
  exports.NewThreadDialog = NewThreadDialog;
10520
- exports.PersonPill = PersonPill;
10521
8977
  exports.PillSelect = PillSelect;
10522
8978
  exports.RecurrenceBuilder = RecurrenceBuilder;
10523
8979
  exports.STATUS_LABELS = STATUS_LABELS;
10524
8980
  exports.STATUS_ORDER = STATUS_ORDER;
10525
8981
  exports.STATUS_TONE = STATUS_TONE;
10526
- exports.SkillActionButton = SkillActionButton;
10527
8982
  exports.SkillCard = SkillCard;
10528
- exports.SkillDetail = SkillDetail;
10529
- exports.SkillDetailSection = SkillDetailSection;
10530
- exports.SkillEditForm = SkillEditForm;
10531
- exports.SkillFilterChips = SkillFilterChips;
10532
- exports.SkillGenerateForm = SkillGenerateForm;
10533
- exports.SkillGlobalBadge = SkillGlobalBadge;
10534
8983
  exports.SkillRow = SkillRow;
10535
- exports.SkillTile = SkillTile;
10536
- exports.SkillTypeBadge = SkillTypeBadge;
10537
- exports.SkillViewToggle = SkillViewToggle;
10538
8984
  exports.StepDetail = StepDetail;
10539
8985
  exports.StepNarration = StepNarration;
10540
8986
  exports.StepOutcome = StepOutcome;
@@ -10560,7 +9006,6 @@ exports.TaskStartDialog = TaskStartDialog;
10560
9006
  exports.TaskStatusPill = TaskStatusPill;
10561
9007
  exports.TaskTable = TaskTable;
10562
9008
  exports.TaskThreadChip = TaskThreadChip;
10563
- exports.TaskTriggerChip = TaskTriggerChip;
10564
9009
  exports.TasksToolbar = TasksToolbar;
10565
9010
  exports.ThreadActivity = ThreadActivity;
10566
9011
  exports.ThreadLauncher = ThreadLauncher;
@@ -10570,14 +9015,9 @@ exports.TupleArrayField = TupleArrayField;
10570
9015
  exports.UploadTaskItem = UploadTaskItem;
10571
9016
  exports.UploadTaskList = UploadTaskList;
10572
9017
  exports.WEEKDAYS = WEEKDAYS;
10573
- exports.WORKFLOW_COLUMN_ORDER = WORKFLOW_COLUMN_ORDER;
10574
- exports.WorkflowConfigDialog = WorkflowConfigDialog;
10575
- exports.WorkflowDocumentsField = WorkflowDocumentsField;
10576
- exports.WorkflowLauncher = WorkflowLauncher;
10577
9018
  exports.WorkflowRunStatus = WorkflowRunStatus;
10578
9019
  exports.WorkflowThreadStartedBy = WorkflowThreadStartedBy;
10579
9020
  exports.WorkflowThreadStrip = WorkflowThreadStrip;
10580
- exports.WorkflowsTable = WorkflowsTable;
10581
9021
  exports.WorkflowsToolbar = WorkflowsToolbar;
10582
9022
  exports.agentConfigSectionToValues = agentConfigSectionToValues;
10583
9023
  exports.agentCreatorToConfigSection = agentCreatorToConfigSection;
@@ -10585,7 +9025,6 @@ exports.asTaskStatus = asTaskStatus;
10585
9025
  exports.authModeFor = authModeFor;
10586
9026
  exports.buildRRule = buildRRule;
10587
9027
  exports.buildTaskRows = buildTaskRows;
10588
- exports.buildWorkflowScopeSource = buildWorkflowScopeSource;
10589
9028
  exports.compactThreadActivity = compactThreadActivity;
10590
9029
  exports.composePersona = composePersona;
10591
9030
  exports.composerToTaskQuery = composerToTaskQuery;
@@ -10593,7 +9032,6 @@ exports.composerToWorkRequest = composerToWorkRequest;
10593
9032
  exports.composerToWorkflowRequest = composerToWorkflowRequest;
10594
9033
  exports.composerToWorkflowUpdate = composerToWorkflowUpdate;
10595
9034
  exports.createTaskColumns = createTaskColumns;
10596
- exports.createWorkflowColumns = createWorkflowColumns;
10597
9035
  exports.createsWork = createsWork;
10598
9036
  exports.defaultScopeRenderer = defaultScopeRenderer;
10599
9037
  exports.defaultTaskComposerValues = defaultTaskComposerValues;
@@ -10607,7 +9045,6 @@ exports.formatElapsed = formatElapsed;
10607
9045
  exports.goalProgress = goalProgress;
10608
9046
  exports.groupThreadActivity = groupThreadActivity;
10609
9047
  exports.hasTaskFields = hasTaskFields;
10610
- exports.hasTrigger = hasTrigger;
10611
9048
  exports.humanizeSection = humanizeSection;
10612
9049
  exports.indexTasks = indexTasks;
10613
9050
  exports.inferType = inferType;
@@ -10615,12 +9052,10 @@ exports.inputDocumentIds = inputDocumentIds;
10615
9052
  exports.isAgenticWorkflow = isAgenticWorkflow;
10616
9053
  exports.isOutOfBounds = isOutOfBounds;
10617
9054
  exports.isPlainTodo = isPlainTodo;
10618
- exports.isSkillRow = isSkillRow;
10619
9055
  exports.isValidAgentName = isValidAgentName;
10620
9056
  exports.isoToLocalInput = isoToLocalInput;
10621
9057
  exports.linkedRunsFromActivity = linkedRunsFromActivity;
10622
9058
  exports.localInputToIso = localInputToIso;
10623
- exports.matchWorkflowScope = matchWorkflowScope;
10624
9059
  exports.moveTargets = moveTargets;
10625
9060
  exports.newThreadToRequest = newThreadToRequest;
10626
9061
  exports.nextCriterionId = nextCriterionId;
@@ -10636,10 +9071,8 @@ exports.taskComposerToUpdateRequest = taskComposerToUpdateRequest;
10636
9071
  exports.taskNeedsAccess = taskNeedsAccess;
10637
9072
  exports.taskToComposerValues = taskToComposerValues;
10638
9073
  exports.useWorkflowPreview = useWorkflowPreview;
10639
- exports.workflowStatus = workflowStatus;
10640
9074
  exports.workflowTaskFields = workflowTaskFields;
10641
9075
  exports.workflowToComposerValues = workflowToComposerValues;
10642
- exports.workflowTriggerType = workflowTriggerType;
10643
9076
  exports.workflowWhen = workflowWhen;
10644
- //# sourceMappingURL=chunk-OZLWSNUC.cjs.map
10645
- //# sourceMappingURL=chunk-OZLWSNUC.cjs.map
9077
+ //# sourceMappingURL=chunk-MJKBVIV3.cjs.map
9078
+ //# sourceMappingURL=chunk-MJKBVIV3.cjs.map