@arbidocs/blocks 0.4.122 → 0.4.123
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{StreamedArtifactEditor-IZWYNFMM.cjs → StreamedArtifactEditor-DNBDUNP2.cjs} +5 -5
- package/dist/{StreamedArtifactEditor-IZWYNFMM.cjs.map → StreamedArtifactEditor-DNBDUNP2.cjs.map} +1 -1
- package/dist/{StreamedArtifactEditor-HTNPG4NB.js → StreamedArtifactEditor-WDHPTWX7.js} +3 -3
- package/dist/{StreamedArtifactEditor-HTNPG4NB.js.map → StreamedArtifactEditor-WDHPTWX7.js.map} +1 -1
- package/dist/agents/index.cjs +388 -324
- package/dist/agents/index.js +7 -7
- package/dist/agents/tasks/ConversationListView.d.ts +2 -1
- package/dist/agents/tasks/ConversationTurnSpeaker.d.ts +3 -1
- package/dist/agents/tasks/TaskFlow.d.ts +17 -0
- package/dist/agents/tasks/ThreadLauncher.d.ts +51 -0
- package/dist/agents/tasks/ThreadStatusLine.d.ts +33 -0
- package/dist/agents/tasks/WorkflowRunStatus.d.ts +32 -0
- package/dist/agents/tasks/WorkflowThreadStrip.d.ts +29 -3
- package/dist/agents/tasks/compact-thread-activity.d.ts +5 -2
- package/dist/agents/tasks/index.d.ts +3 -0
- package/dist/agents/workflows/StepBarFrame.d.ts +18 -17
- package/dist/agents/workflows/StepChip.d.ts +37 -0
- package/dist/agents/workflows/StepDocuments.d.ts +64 -0
- package/dist/agents/workflows/WorkflowStepBar.d.ts +1 -2
- package/dist/agents/workflows/index.d.ts +2 -0
- package/dist/agents/workflows/stepKinds.d.ts +24 -0
- package/dist/artifacts/VersionTimeline.d.ts +7 -0
- package/dist/artifacts/index.cjs +21 -21
- package/dist/artifacts/index.js +1 -1
- package/dist/chat/ChatPage.d.ts +1 -1
- package/dist/chat/DraftingDocChip.d.ts +22 -0
- package/dist/chat/WorkflowStepChip.d.ts +23 -5
- package/dist/chat/chat-page-types.d.ts +18 -2
- package/dist/chat/flashMessage.d.ts +6 -0
- package/dist/chat/index.cjs +144 -131
- package/dist/chat/index.d.ts +2 -0
- package/dist/chat/index.js +4 -3
- package/dist/{chunk-UDK553WP.cjs → chunk-4VCKYR4D.cjs} +4 -4
- package/dist/{chunk-UDK553WP.cjs.map → chunk-4VCKYR4D.cjs.map} +1 -1
- package/dist/{chunk-XSUOEJB3.cjs → chunk-7FZWNDPU.cjs} +162 -836
- package/dist/chunk-7FZWNDPU.cjs.map +1 -0
- package/dist/chunk-7HAM7Y5U.js +907 -0
- package/dist/chunk-7HAM7Y5U.js.map +1 -0
- package/dist/{chunk-TCNYKDYE.js → chunk-CXLVI3SB.js} +73 -40
- package/dist/chunk-CXLVI3SB.js.map +1 -0
- package/dist/chunk-HM23LXUP.cjs +976 -0
- package/dist/chunk-HM23LXUP.cjs.map +1 -0
- package/dist/{chunk-WN64RF46.js → chunk-HQH35JWC.js} +3 -3
- package/dist/{chunk-WN64RF46.js.map → chunk-HQH35JWC.js.map} +1 -1
- package/dist/{chunk-AY32GGKU.js → chunk-MD7RVFKA.js} +131 -751
- package/dist/chunk-MD7RVFKA.js.map +1 -0
- package/dist/{chunk-65HZ36MY.js → chunk-OTDGTBAS.js} +20 -3
- package/dist/chunk-OTDGTBAS.js.map +1 -0
- package/dist/{chunk-ZP4IFW2E.js → chunk-RARHNGKM.js} +731 -183
- package/dist/chunk-RARHNGKM.js.map +1 -0
- package/dist/{chunk-XFZ7HNPG.js → chunk-SOZNA52K.js} +3 -3
- package/dist/{chunk-XFZ7HNPG.js.map → chunk-SOZNA52K.js.map} +1 -1
- package/dist/{chunk-US5ASM4G.cjs → chunk-U2F4SSJR.cjs} +5 -5
- package/dist/{chunk-US5ASM4G.cjs.map → chunk-U2F4SSJR.cjs.map} +1 -1
- package/dist/{chunk-Z2NSU7D5.cjs → chunk-V4V2CVNE.cjs} +768 -214
- package/dist/chunk-V4V2CVNE.cjs.map +1 -0
- package/dist/{chunk-CK4C3IQR.cjs → chunk-VMZXFYHK.cjs} +47 -6
- package/dist/chunk-VMZXFYHK.cjs.map +1 -0
- package/dist/{chunk-SVJQWLOF.cjs → chunk-W4GXDARU.cjs} +20 -3
- package/dist/chunk-W4GXDARU.cjs.map +1 -0
- package/dist/{chunk-S2KVJYBD.cjs → chunk-WV4IDVDQ.cjs} +76 -43
- package/dist/chunk-WV4IDVDQ.cjs.map +1 -0
- package/dist/{chunk-2FUJXMGO.js → chunk-Y4X3RBFI.js} +44 -6
- package/dist/{chunk-CK4C3IQR.cjs.map → chunk-Y4X3RBFI.js.map} +1 -1
- package/dist/collaboration/index.cjs +1 -1
- package/dist/collaboration/index.js +1 -1
- package/dist/connect/index.cjs +63 -46
- package/dist/connect/index.cjs.map +1 -1
- package/dist/connect/index.js +33 -16
- package/dist/connect/index.js.map +1 -1
- package/dist/connection/WorkflowRunThread.d.ts +4 -4
- package/dist/connection/ai.d.ts +2 -0
- package/dist/facts/index.cjs +2 -2
- package/dist/facts/index.js +2 -2
- package/dist/files/index.cjs +3 -3
- package/dist/files/index.js +3 -3
- package/dist/home/index.cjs +1 -1
- package/dist/home/index.js +1 -1
- package/dist/index.cjs +840 -764
- package/dist/index.js +14 -14
- package/dist/retrieval/index.cjs +1 -1
- package/dist/retrieval/index.js +1 -1
- package/dist/settings/index.cjs +1 -1
- package/dist/settings/index.js +1 -1
- package/dist/shell/index.cjs +10 -10
- package/dist/shell/index.js +2 -2
- package/dist/studio/index.cjs +6 -5
- package/dist/studio/index.cjs.map +1 -1
- package/dist/studio/index.js +5 -4
- package/dist/studio/index.js.map +1 -1
- package/dist/workflow-canvas/WorkflowCanvas.d.ts +0 -9
- package/dist/workflow-canvas/edit.d.ts +2 -11
- package/dist/workflow-canvas/index.cjs +61 -85
- package/dist/workflow-canvas/index.cjs.map +1 -1
- package/dist/workflow-canvas/index.js +12 -36
- package/dist/workflow-canvas/index.js.map +1 -1
- package/node_modules/@arbidocs/coedit/package.json +1 -1
- package/package.json +4 -4
- package/src/blocks.css +168 -0
- package/src/workflow-canvas/canvas.css +2 -40
- package/dist/chunk-2FUJXMGO.js.map +0 -1
- package/dist/chunk-65HZ36MY.js.map +0 -1
- package/dist/chunk-AY32GGKU.js.map +0 -1
- package/dist/chunk-B4SRYJLM.cjs +0 -107
- package/dist/chunk-B4SRYJLM.cjs.map +0 -1
- package/dist/chunk-HOXKR26S.js +0 -103
- package/dist/chunk-HOXKR26S.js.map +0 -1
- package/dist/chunk-S2KVJYBD.cjs.map +0 -1
- package/dist/chunk-SVJQWLOF.cjs.map +0 -1
- package/dist/chunk-TCNYKDYE.js.map +0 -1
- package/dist/chunk-XSUOEJB3.cjs.map +0 -1
- package/dist/chunk-Z2NSU7D5.cjs.map +0 -1
- package/dist/chunk-ZP4IFW2E.js.map +0 -1
|
@@ -1,276 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { FoldSection } from './chunk-XD2M6LIG.js';
|
|
3
3
|
import { UploadDropzone } from './chunk-EVUEIBNU.js';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { workflowSteps, canAssign, nextAction, validateStep, assigneeName, runFieldsOf, failedUpstream, stepPhase, useElementSize, sendBackTargets, formatDate, shownValue, stepKindOf, stepLevels, waitingDocuments, stepDependencies, reviewInstructions, splitDocRef, isPersonStep, eventWaitingDocuments, waitingForDocumentsText, StepBadgeMark, StepChip, STEP_KIND_ICONS, DEFAULT_STEP_KIND_LABELS, composeStepPrompt, isRunFinished, runFields, isWorkflowScope } from './chunk-7HAM7Y5U.js';
|
|
5
|
+
import { TONE_DOT, TONE_SURFACE, TONE_SOLID_BORDER, TONE_BORDER } from './chunk-AUS3KBHJ.js';
|
|
6
6
|
import { testIdOr, prefixedTestId } from './chunk-7F6CBP3Z.js';
|
|
7
7
|
import { useState, useRef, useEffect, useCallback, useMemo } from 'react';
|
|
8
|
-
import {
|
|
8
|
+
import { Loader2, UserRound, CornerUpLeft, ShieldCheck, MessageSquare, Check, Hourglass, Clock, PenLine, X, ExternalLink, Mail, Table2, CheckCircle2, ArrowLeft, ArrowRight, RotateCw, GitBranch, AlertTriangle, ChevronLeft, ChevronRight, FileText, ArrowUpRight, BellRing, Flag, RotateCcw, Play, Disc, Phone, UserRoundCog, Sparkles, MessageSquareReply, Square, KeyRound, Lock } from 'lucide-react';
|
|
9
9
|
import { cn, Popover, PopoverTrigger, PopoverContent, Button, Textarea, Card, Label, Input, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, Switch } from '@arbidocs/react/ui';
|
|
10
10
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
11
11
|
|
|
12
|
-
// src/agents/workflows/types.ts
|
|
13
|
-
var EMPTY_WORKFLOW_SCOPE = { folders: [], labels: [] };
|
|
14
|
-
|
|
15
|
-
// src/agents/workflows/workflow.ts
|
|
16
|
-
var isWorkflowScope = (value) => typeof value === "object" && value !== null && Array.isArray(value.folders) && Array.isArray(value.labels);
|
|
17
|
-
var isEmptyWorkflowScope = (scope) => scope.folders.length === 0 && scope.labels.length === 0 && !scope.documents?.length;
|
|
18
|
-
var isFileField = (field) => field.type === "scope" || field.type === "documents";
|
|
19
|
-
function emptyValue(field) {
|
|
20
|
-
switch (field.type) {
|
|
21
|
-
case "boolean":
|
|
22
|
-
return false;
|
|
23
|
-
case "scope":
|
|
24
|
-
return { folders: [], labels: [] };
|
|
25
|
-
case "documents":
|
|
26
|
-
return { folders: [], labels: [], documents: [] };
|
|
27
|
-
default:
|
|
28
|
-
return "";
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
function defaultInputs(workflow) {
|
|
32
|
-
const inputs = {};
|
|
33
|
-
for (const field of workflow.inputs) {
|
|
34
|
-
const d = field.default;
|
|
35
|
-
inputs[field.name] = d === void 0 ? emptyValue(field) : isWorkflowScope(d) ? { ...d } : d;
|
|
36
|
-
}
|
|
37
|
-
return inputs;
|
|
38
|
-
}
|
|
39
|
-
function validateInputs(workflow, inputs) {
|
|
40
|
-
const errors = {};
|
|
41
|
-
for (const field of workflow.inputs) {
|
|
42
|
-
const value = inputs[field.name];
|
|
43
|
-
if (field.type === "number") {
|
|
44
|
-
const blank = value === "" || value === void 0;
|
|
45
|
-
if (blank) {
|
|
46
|
-
if (field.required) errors[field.name] = "required";
|
|
47
|
-
continue;
|
|
48
|
-
}
|
|
49
|
-
const n = Number(value);
|
|
50
|
-
if (Number.isNaN(n)) errors[field.name] = "number";
|
|
51
|
-
else if (field.min !== void 0 && n < field.min) errors[field.name] = "min";
|
|
52
|
-
else if (field.max !== void 0 && n > field.max) errors[field.name] = "max";
|
|
53
|
-
continue;
|
|
54
|
-
}
|
|
55
|
-
if (!field.required) continue;
|
|
56
|
-
if (field.type === "documents") {
|
|
57
|
-
if (!isWorkflowScope(value) || !value.documents?.length) errors[field.name] = "required";
|
|
58
|
-
continue;
|
|
59
|
-
}
|
|
60
|
-
if (field.type === "boolean" || field.type === "scope") continue;
|
|
61
|
-
if (typeof value !== "string" || value.trim() === "") errors[field.name] = "required";
|
|
62
|
-
}
|
|
63
|
-
return errors;
|
|
64
|
-
}
|
|
65
|
-
function promptFieldName(workflow) {
|
|
66
|
-
return workflow.inputs.find((f) => !f.advanced && (f.type === "text" || f.type === "longtext"))?.name;
|
|
67
|
-
}
|
|
68
|
-
var quoteList = (names) => {
|
|
69
|
-
const quoted = names.map((n) => `"${n}"`);
|
|
70
|
-
return quoted.length <= 1 ? quoted[0] ?? "" : `${quoted.slice(0, -1).join(", ")} and ${quoted[quoted.length - 1]}`;
|
|
71
|
-
};
|
|
72
|
-
function fragment(field, value, ctx) {
|
|
73
|
-
switch (field.type) {
|
|
74
|
-
case "documents": {
|
|
75
|
-
const ids = isWorkflowScope(value) ? value.documents ?? [] : [];
|
|
76
|
-
const names = ids.flatMap((id) => {
|
|
77
|
-
const title = ctx?.documentTitles?.[id];
|
|
78
|
-
return title ? [title] : [];
|
|
79
|
-
});
|
|
80
|
-
return quoteList(names);
|
|
81
|
-
}
|
|
82
|
-
case "boolean":
|
|
83
|
-
return value ? field.trueText ?? "yes" : field.falseText ?? "no";
|
|
84
|
-
case "select": {
|
|
85
|
-
const option = field.options?.find((o) => o.value === value);
|
|
86
|
-
return option ? option.text ?? option.label : String(value ?? "");
|
|
87
|
-
}
|
|
88
|
-
case "scope":
|
|
89
|
-
return "";
|
|
90
|
-
default:
|
|
91
|
-
return typeof value === "string" ? value.trim() : String(value ?? "");
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
function composeWorkflowPrompt(workflow, inputs, ctx) {
|
|
95
|
-
if (workflow.run.kind !== "prompt") return "";
|
|
96
|
-
const byName = new Map(workflow.inputs.map((f) => [f.name, f]));
|
|
97
|
-
const template = workflow.run.promptTemplate;
|
|
98
|
-
let out = "";
|
|
99
|
-
let last = 0;
|
|
100
|
-
const append = (text, isValue) => {
|
|
101
|
-
let t = text;
|
|
102
|
-
if (!isValue) {
|
|
103
|
-
t = t.replace(/[ \t]{2,}/g, " ");
|
|
104
|
-
if (/[ \t]$/.test(out)) t = t.replace(/^[ \t]+/, "");
|
|
105
|
-
}
|
|
106
|
-
out += t;
|
|
107
|
-
};
|
|
108
|
-
for (const m of template.matchAll(/\{\{\s*([a-z][a-z0-9_]*)\s*\}\}/gi)) {
|
|
109
|
-
append(template.slice(last, m.index), false);
|
|
110
|
-
const field = byName.get(m[1]);
|
|
111
|
-
append(field ? fragment(field, inputs[m[1]], ctx) : "", true);
|
|
112
|
-
last = m.index + m[0].length;
|
|
113
|
-
}
|
|
114
|
-
append(template.slice(last), false);
|
|
115
|
-
return out.trim();
|
|
116
|
-
}
|
|
117
|
-
function buildLaunch(workflow, inputs, agentId) {
|
|
118
|
-
const scopeField = workflow.inputs.find(isFileField);
|
|
119
|
-
const raw = scopeField ? inputs[scopeField.name] : void 0;
|
|
120
|
-
const scope = isWorkflowScope(raw) ? raw : { ...EMPTY_WORKFLOW_SCOPE };
|
|
121
|
-
return { workflow, inputs, scope, agentId: agentId || workflow.defaultAgentId || void 0 };
|
|
122
|
-
}
|
|
123
|
-
function workflowAccepts(workflow) {
|
|
124
|
-
const kinds = /* @__PURE__ */ new Set();
|
|
125
|
-
for (const field of workflow.inputs) if (field.context) kinds.add(field.context);
|
|
126
|
-
return [...kinds];
|
|
127
|
-
}
|
|
128
|
-
function workflowsAccepting(workflows, supplied) {
|
|
129
|
-
return workflows.filter((w) => workflowAccepts(w).some((k) => supplied.includes(k)));
|
|
130
|
-
}
|
|
131
|
-
function workflowsForHost(workflows, host) {
|
|
132
|
-
return workflows.filter((w) => !w.host || w.host === host);
|
|
133
|
-
}
|
|
134
|
-
function inputsFromContext(workflow, context) {
|
|
135
|
-
const inputs = {};
|
|
136
|
-
for (const field of workflow.inputs) {
|
|
137
|
-
if (!field.context) continue;
|
|
138
|
-
if (field.context === "selection") {
|
|
139
|
-
if (context.selection) inputs[field.name] = context.selection;
|
|
140
|
-
continue;
|
|
141
|
-
}
|
|
142
|
-
const ids = field.context === "image" ? context.image ? [context.image] : [] : context.documents;
|
|
143
|
-
if (ids?.length && isFileField(field)) {
|
|
144
|
-
inputs[field.name] = { folders: [], labels: [], documents: ids.slice(0, field.max ?? 1) };
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
return inputs;
|
|
148
|
-
}
|
|
149
|
-
var SKILL_PROMPT_LABEL = "What should it work on?";
|
|
150
|
-
var SKILL_PROMPT_FALLBACK_PLACEHOLDER = "Describe what you want";
|
|
151
|
-
var plainHint = (hint) => hint.replace(/^[<[]\s*|\s*[>\]]$/g, "").trim();
|
|
152
|
-
function skillToWorkflow(skill) {
|
|
153
|
-
const hint = plainHint((skill.arg_hint ?? "").trim());
|
|
154
|
-
const inputs = [
|
|
155
|
-
{
|
|
156
|
-
name: "args",
|
|
157
|
-
type: "longtext",
|
|
158
|
-
label: SKILL_PROMPT_LABEL,
|
|
159
|
-
placeholder: hint || SKILL_PROMPT_FALLBACK_PLACEHOLDER,
|
|
160
|
-
required: true
|
|
161
|
-
}
|
|
162
|
-
];
|
|
163
|
-
return {
|
|
164
|
-
id: skill.slug,
|
|
165
|
-
skill: skill.slug,
|
|
166
|
-
title: skill.name || skill.slug,
|
|
167
|
-
description: skill.description ?? "",
|
|
168
|
-
inputs,
|
|
169
|
-
run: { kind: "prompt", promptTemplate: `/${skill.slug} {{args}}` },
|
|
170
|
-
landing: "chat",
|
|
171
|
-
schedulable: true
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
var FIELD_TYPES = [
|
|
175
|
-
"text",
|
|
176
|
-
"longtext",
|
|
177
|
-
"boolean",
|
|
178
|
-
"select",
|
|
179
|
-
"number",
|
|
180
|
-
"date",
|
|
181
|
-
"scope",
|
|
182
|
-
"documents"
|
|
183
|
-
];
|
|
184
|
-
var str = (v) => typeof v === "string" ? v : void 0;
|
|
185
|
-
var num = (v) => typeof v === "number" ? v : void 0;
|
|
186
|
-
var bool = (v) => typeof v === "boolean" ? v : void 0;
|
|
187
|
-
function fieldFromFrontmatter(raw) {
|
|
188
|
-
if (typeof raw !== "object" || raw === null) return null;
|
|
189
|
-
const r = raw;
|
|
190
|
-
const name = str(r.name);
|
|
191
|
-
const type = FIELD_TYPES.find((t) => t === r.type);
|
|
192
|
-
if (!name || !/^[a-z][a-z0-9_]*$/.test(name) || !type) return null;
|
|
193
|
-
const options = Array.isArray(r.options) ? r.options.flatMap((o) => {
|
|
194
|
-
const ro = o;
|
|
195
|
-
const value = str(ro?.value);
|
|
196
|
-
const label = str(ro?.label);
|
|
197
|
-
return value && label ? [
|
|
198
|
-
{
|
|
199
|
-
value,
|
|
200
|
-
label,
|
|
201
|
-
description: str(ro.description),
|
|
202
|
-
text: str(ro.text),
|
|
203
|
-
icon: str(ro.icon),
|
|
204
|
-
tone: isTone(ro.tone) ? ro.tone : void 0
|
|
205
|
-
}
|
|
206
|
-
] : [];
|
|
207
|
-
}) : void 0;
|
|
208
|
-
return {
|
|
209
|
-
name,
|
|
210
|
-
type,
|
|
211
|
-
label: str(r.label) ?? name,
|
|
212
|
-
description: str(r.description),
|
|
213
|
-
placeholder: str(r.placeholder),
|
|
214
|
-
required: bool(r.required),
|
|
215
|
-
default: r.default,
|
|
216
|
-
options,
|
|
217
|
-
min: num(r.min),
|
|
218
|
-
max: num(r.max),
|
|
219
|
-
trueText: str(r.true_text),
|
|
220
|
-
falseText: str(r.false_text),
|
|
221
|
-
advanced: bool(r.advanced),
|
|
222
|
-
accept: r.accept === "image" ? "image" : void 0,
|
|
223
|
-
context: r.context === "documents" || r.context === "selection" || r.context === "image" ? r.context : void 0,
|
|
224
|
-
by: Array.isArray(r.by) ? r.by.filter((b) => b === "folders" || b === "labels") : void 0
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
function workflowFromFrontmatter(id, frontmatter, body) {
|
|
228
|
-
const inputs = Array.isArray(frontmatter.inputs) ? frontmatter.inputs.flatMap((f) => {
|
|
229
|
-
const field = fieldFromFrontmatter(f);
|
|
230
|
-
return field ? [field] : [];
|
|
231
|
-
}) : [];
|
|
232
|
-
return {
|
|
233
|
-
id,
|
|
234
|
-
title: str(frontmatter.name) ?? id,
|
|
235
|
-
description: str(frontmatter.description) ?? "",
|
|
236
|
-
icon: str(frontmatter.icon),
|
|
237
|
-
inputs,
|
|
238
|
-
run: { kind: "prompt", promptTemplate: body.trim() },
|
|
239
|
-
landing: frontmatter.landing === "files" ? "files" : "chat",
|
|
240
|
-
requiresFiles: bool(frontmatter.requires_files),
|
|
241
|
-
schedulable: bool(frontmatter.schedulable) ?? true
|
|
242
|
-
};
|
|
243
|
-
}
|
|
244
|
-
function fieldToFrontmatter(field) {
|
|
245
|
-
return compact({
|
|
246
|
-
name: field.name,
|
|
247
|
-
type: field.type,
|
|
248
|
-
label: field.label,
|
|
249
|
-
description: field.description,
|
|
250
|
-
placeholder: field.placeholder,
|
|
251
|
-
required: field.required,
|
|
252
|
-
default: field.default,
|
|
253
|
-
options: field.options?.map(
|
|
254
|
-
(o) => compact({
|
|
255
|
-
value: o.value,
|
|
256
|
-
label: o.label,
|
|
257
|
-
description: o.description,
|
|
258
|
-
text: o.text,
|
|
259
|
-
icon: o.icon,
|
|
260
|
-
tone: o.tone
|
|
261
|
-
})
|
|
262
|
-
),
|
|
263
|
-
min: field.min,
|
|
264
|
-
max: field.max,
|
|
265
|
-
true_text: field.trueText,
|
|
266
|
-
false_text: field.falseText,
|
|
267
|
-
advanced: field.advanced,
|
|
268
|
-
by: field.by,
|
|
269
|
-
accept: field.accept,
|
|
270
|
-
context: field.context
|
|
271
|
-
});
|
|
272
|
-
}
|
|
273
|
-
var compact = (o) => Object.fromEntries(Object.entries(o).filter(([, v]) => v !== void 0));
|
|
274
12
|
var DEFAULT_SCHEMA_FORM_LABELS = {
|
|
275
13
|
optional: "(optional)",
|
|
276
14
|
advanced: "More options",
|
|
@@ -376,7 +114,7 @@ function FieldControl({
|
|
|
376
114
|
case "select": {
|
|
377
115
|
const options = field.options ?? [];
|
|
378
116
|
if (options.length > 0 && options.length <= TILE_MAX) {
|
|
379
|
-
const
|
|
117
|
+
const compact2 = options.every((o) => !o.icon && !o.description);
|
|
380
118
|
return /* @__PURE__ */ jsx(
|
|
381
119
|
"div",
|
|
382
120
|
{
|
|
@@ -389,7 +127,7 @@ function FieldControl({
|
|
|
389
127
|
{
|
|
390
128
|
option,
|
|
391
129
|
selected: value === option.value,
|
|
392
|
-
compact:
|
|
130
|
+
compact: compact2,
|
|
393
131
|
renderIcon,
|
|
394
132
|
testId: prefixedTestId(testId, option.value, {
|
|
395
133
|
testId: `workflow-field-${field.name}-${option.value}`
|
|
@@ -447,7 +185,7 @@ function FieldControl({
|
|
|
447
185
|
function ChoiceTile({
|
|
448
186
|
option,
|
|
449
187
|
selected,
|
|
450
|
-
compact:
|
|
188
|
+
compact: compact2,
|
|
451
189
|
renderIcon,
|
|
452
190
|
testId,
|
|
453
191
|
onSelect
|
|
@@ -465,7 +203,7 @@ function ChoiceTile({
|
|
|
465
203
|
className: cn(
|
|
466
204
|
// Sized to its label (flex-basis auto), growing to share the row, never wider than it.
|
|
467
205
|
"flex max-w-full min-w-[min(4rem,100%)] flex-auto flex-col items-center justify-center gap-1.5 rounded-lg border text-center transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
468
|
-
|
|
206
|
+
compact2 ? "min-h-9 px-3 py-1.5 pointer-coarse:min-h-11" : "min-h-24 p-3 pointer-coarse:min-h-28",
|
|
469
207
|
tone ? selected ? cn(TONE_SURFACE[tone], TONE_SOLID_BORDER[tone]) : cn(TONE_BORDER[tone], "bg-card [&:hover]:bg-muted") : selected ? "border-primary bg-primary/10" : "border-border bg-card [&:hover]:border-primary [&:hover]:bg-muted"
|
|
470
208
|
),
|
|
471
209
|
children: [
|
|
@@ -581,313 +319,6 @@ function SchemaForm({
|
|
|
581
319
|
] });
|
|
582
320
|
}
|
|
583
321
|
|
|
584
|
-
// src/agents/workflows/run.ts
|
|
585
|
-
function workflowSteps(workflow) {
|
|
586
|
-
return workflow.run.kind === "steps" ? workflow.run.steps : [];
|
|
587
|
-
}
|
|
588
|
-
var isSteppedWorkflow = (workflow) => workflow.run.kind === "steps";
|
|
589
|
-
function stepDependencies(steps, id) {
|
|
590
|
-
const i = steps.findIndex((s) => s.id === id);
|
|
591
|
-
if (i < 0) return [];
|
|
592
|
-
return steps[i].after ?? (i > 0 ? [steps[i - 1].id] : []);
|
|
593
|
-
}
|
|
594
|
-
function dependsOn(steps, a, b) {
|
|
595
|
-
const seen = /* @__PURE__ */ new Set();
|
|
596
|
-
const stack = [...stepDependencies(steps, a)];
|
|
597
|
-
while (stack.length) {
|
|
598
|
-
const id = stack.pop();
|
|
599
|
-
if (id === b) return true;
|
|
600
|
-
if (seen.has(id)) continue;
|
|
601
|
-
seen.add(id);
|
|
602
|
-
stack.push(...stepDependencies(steps, id));
|
|
603
|
-
}
|
|
604
|
-
return false;
|
|
605
|
-
}
|
|
606
|
-
function orderSteps(steps) {
|
|
607
|
-
const explicit = steps.map((s) => ({ ...s, after: stepDependencies(steps, s.id) }));
|
|
608
|
-
const known = new Set(explicit.map((s) => s.id));
|
|
609
|
-
const placed = /* @__PURE__ */ new Set();
|
|
610
|
-
const out = [];
|
|
611
|
-
let progress = true;
|
|
612
|
-
while (out.length < explicit.length && progress) {
|
|
613
|
-
progress = false;
|
|
614
|
-
for (const s of explicit) {
|
|
615
|
-
if (placed.has(s.id)) continue;
|
|
616
|
-
if (s.after.every((d) => placed.has(d) || !known.has(d))) {
|
|
617
|
-
out.push(s);
|
|
618
|
-
placed.add(s.id);
|
|
619
|
-
progress = true;
|
|
620
|
-
break;
|
|
621
|
-
}
|
|
622
|
-
}
|
|
623
|
-
}
|
|
624
|
-
return [...out, ...explicit.filter((s) => !placed.has(s.id))];
|
|
625
|
-
}
|
|
626
|
-
function validateWorkflowGraph(steps) {
|
|
627
|
-
const problems = [];
|
|
628
|
-
const ids = /* @__PURE__ */ new Set();
|
|
629
|
-
for (const s of steps) {
|
|
630
|
-
if (ids.has(s.id)) problems.push({ code: "duplicate", step: s.id });
|
|
631
|
-
ids.add(s.id);
|
|
632
|
-
}
|
|
633
|
-
steps.forEach((s, i) => {
|
|
634
|
-
for (const d of stepDependencies(steps, s.id)) {
|
|
635
|
-
if (!ids.has(d)) problems.push({ code: "unknown", step: s.id, dependency: d });
|
|
636
|
-
else if (d === s.id || dependsOn(steps, d, s.id)) problems.push({ code: "cycle", step: s.id });
|
|
637
|
-
else if (steps.findIndex((x) => x.id === d) > i)
|
|
638
|
-
problems.push({ code: "order", step: s.id, dependency: d });
|
|
639
|
-
}
|
|
640
|
-
});
|
|
641
|
-
return problems;
|
|
642
|
-
}
|
|
643
|
-
function stepLevels(steps) {
|
|
644
|
-
const depth = /* @__PURE__ */ new Map();
|
|
645
|
-
for (const s of steps) {
|
|
646
|
-
const deps = stepDependencies(steps, s.id).filter((d) => depth.has(d));
|
|
647
|
-
depth.set(s.id, deps.length ? Math.max(...deps.map((d) => depth.get(d))) + 1 : 0);
|
|
648
|
-
}
|
|
649
|
-
const levels = [];
|
|
650
|
-
for (const s of steps) (levels[depth.get(s.id)] ??= []).push(s);
|
|
651
|
-
return levels.filter(Boolean);
|
|
652
|
-
}
|
|
653
|
-
var STEP_EVENTS = {
|
|
654
|
-
step_started: "running",
|
|
655
|
-
step_waiting: "waiting",
|
|
656
|
-
step_done: "done",
|
|
657
|
-
step_skipped: "skipped",
|
|
658
|
-
step_failed: "failed"
|
|
659
|
-
};
|
|
660
|
-
var str2 = (v) => typeof v === "string" && v ? v : void 0;
|
|
661
|
-
var ACTION_TYPES = ["sign", "email_draft", "tabular_review"];
|
|
662
|
-
var asAction = (v) => ACTION_TYPES.includes(v) ? v : void 0;
|
|
663
|
-
var asRecord = (v) => v && typeof v === "object" && !Array.isArray(v) ? v : void 0;
|
|
664
|
-
var asStrings = (v) => Array.isArray(v) ? v.filter((x) => typeof x === "string") : void 0;
|
|
665
|
-
function waitingDocuments(state) {
|
|
666
|
-
return state?.status === "waiting" ? asStrings(state.waiting?.documents) ?? [] : [];
|
|
667
|
-
}
|
|
668
|
-
function eventWaitingDocuments(detail) {
|
|
669
|
-
return asStrings(asRecord(detail?.waiting)?.documents);
|
|
670
|
-
}
|
|
671
|
-
function waitingForDocumentsText(count) {
|
|
672
|
-
return `Waiting for ${count} ${count === 1 ? "document" : "documents"} to finish processing`;
|
|
673
|
-
}
|
|
674
|
-
function reopenedBy(detail) {
|
|
675
|
-
const to = str2(detail.to);
|
|
676
|
-
return asStrings(detail.reopened) ?? (to ? [to] : []);
|
|
677
|
-
}
|
|
678
|
-
function stepStatesFromActivity(events) {
|
|
679
|
-
const states = {};
|
|
680
|
-
for (const e of events) {
|
|
681
|
-
const detail = e.detail ?? {};
|
|
682
|
-
const step = str2(detail.step);
|
|
683
|
-
if (!step) continue;
|
|
684
|
-
if (e.kind === "step_sent_back") {
|
|
685
|
-
const to = str2(detail.to);
|
|
686
|
-
for (const id of reopenedBy(detail))
|
|
687
|
-
states[id] = id === to ? {
|
|
688
|
-
status: "pending",
|
|
689
|
-
sentBack: true,
|
|
690
|
-
hasNote: typeof detail.note_encrypted === "string"
|
|
691
|
-
} : { status: "pending" };
|
|
692
|
-
continue;
|
|
693
|
-
}
|
|
694
|
-
if (e.kind === "step_ready") {
|
|
695
|
-
states[step] = { ...states[step] ?? { status: "pending" }, announcedTo: str2(detail.to) };
|
|
696
|
-
continue;
|
|
697
|
-
}
|
|
698
|
-
if (e.kind === "step_progress") {
|
|
699
|
-
const before2 = states[step];
|
|
700
|
-
const waiting2 = asRecord(detail.waiting);
|
|
701
|
-
if (before2?.status === "waiting" && waiting2) states[step] = { ...before2, waiting: waiting2 };
|
|
702
|
-
continue;
|
|
703
|
-
}
|
|
704
|
-
const status = STEP_EVENTS[e.kind];
|
|
705
|
-
if (!status) continue;
|
|
706
|
-
const before = states[step];
|
|
707
|
-
const responseId = str2(detail.response_id) ?? before?.responseId ?? null;
|
|
708
|
-
const startedAt = status === "running" ? e.created_at : before?.startedAt;
|
|
709
|
-
const action = asAction(detail.action) ?? before?.action;
|
|
710
|
-
const documents = asStrings(detail.documents) ?? before?.documents;
|
|
711
|
-
const waiting = status === "waiting" ? asRecord(detail.waiting) : void 0;
|
|
712
|
-
const output = status === "done" ? asRecord(detail.output) : void 0;
|
|
713
|
-
const approved = Array.isArray(detail.approved) ? detail.approved.filter(asRecord) : void 0;
|
|
714
|
-
const finished2 = status === "done" || status === "skipped" || status === "failed";
|
|
715
|
-
const declinedBy = str2(detail.declined_by);
|
|
716
|
-
const afterFailure = status === "skipped" && (before?.status === "failed" || !!before?.skippedAfterFailure);
|
|
717
|
-
states[step] = {
|
|
718
|
-
status,
|
|
719
|
-
responseId,
|
|
720
|
-
error: str2(detail.error) ?? (afterFailure ? before?.error ?? null : null),
|
|
721
|
-
...afterFailure ? { skippedAfterFailure: true } : {},
|
|
722
|
-
...startedAt ? { startedAt } : {},
|
|
723
|
-
...action ? { action } : {},
|
|
724
|
-
...documents?.length ? { documents } : {},
|
|
725
|
-
...waiting ? { waiting } : {},
|
|
726
|
-
...output ? { output } : {},
|
|
727
|
-
...approved ? { approved } : {},
|
|
728
|
-
...finished2 ? { by: e.actor_ext_id ?? null } : {},
|
|
729
|
-
...finished2 && e.created_at ? { at: e.created_at } : {},
|
|
730
|
-
...declinedBy ? { declinedBy } : {}
|
|
731
|
-
};
|
|
732
|
-
}
|
|
733
|
-
return states;
|
|
734
|
-
}
|
|
735
|
-
function stepFields(step) {
|
|
736
|
-
return step.kind === "form" ? step.inputs : step.kind === "review" ? step.fields ?? [] : [];
|
|
737
|
-
}
|
|
738
|
-
var runFieldsOf = (steps) => steps.flatMap(stepFields);
|
|
739
|
-
function runFields(workflow) {
|
|
740
|
-
return [...workflow.inputs, ...workflowSteps(workflow).flatMap(stepFields)];
|
|
741
|
-
}
|
|
742
|
-
function initialRunInputs(workflow, inputs = {}) {
|
|
743
|
-
return { ...defaultInputs({ ...workflow, inputs: runFields(workflow) }), ...inputs };
|
|
744
|
-
}
|
|
745
|
-
var finished = (s) => s?.status === "done" || s?.status === "skipped";
|
|
746
|
-
function stepPhase(steps, states, id) {
|
|
747
|
-
const s = states[id];
|
|
748
|
-
if (s && s.status !== "pending") return s.status;
|
|
749
|
-
return stepDependencies(steps, id).every((d) => finished(states[d])) ? "ready" : "blocked";
|
|
750
|
-
}
|
|
751
|
-
var isRunFinished = (steps, states) => steps.length > 0 && steps.every((s) => finished(states[s.id]));
|
|
752
|
-
var isPersonStep = (step) => step.kind !== "agent" && step.kind !== "action";
|
|
753
|
-
var isPersonAction = (step) => step.kind === "action" && (step.action.type === "sign" || step.action.type === "email_draft");
|
|
754
|
-
var canAssign = (step) => isPersonStep(step) || isPersonAction(step);
|
|
755
|
-
function nextAction(steps, states, current, { needsStart = false, canRetry = false } = {}) {
|
|
756
|
-
const i = steps.findIndex((s) => s.id === current);
|
|
757
|
-
const step = steps[i];
|
|
758
|
-
if (!step) return "wait";
|
|
759
|
-
const phase = stepPhase(steps, states, step.id);
|
|
760
|
-
if (phase === "blocked") return "wait";
|
|
761
|
-
const following = steps[i + 1];
|
|
762
|
-
const independentNext = !!following && !dependsOn(steps, following.id, step.id);
|
|
763
|
-
if (phase === "done" || phase === "skipped") {
|
|
764
|
-
if (following) return "move";
|
|
765
|
-
return isRunFinished(steps, states) ? "finish" : "wait";
|
|
766
|
-
}
|
|
767
|
-
if (isPersonStep(step)) return "complete";
|
|
768
|
-
if (phase === "waiting" && step.kind === "action" && step.action.type === "email_draft")
|
|
769
|
-
return "complete";
|
|
770
|
-
if (phase === "ready" && needsStart) return "start";
|
|
771
|
-
if (phase !== "failed") return independentNext ? "move" : "wait";
|
|
772
|
-
const waitedFor = steps.slice(i + 1).some((s) => dependsOn(steps, s.id, step.id));
|
|
773
|
-
if (!waitedFor && following) return "move";
|
|
774
|
-
return canRetry ? "retry" : "wait";
|
|
775
|
-
}
|
|
776
|
-
function failedUpstream(steps, states, id) {
|
|
777
|
-
return upstreamSteps(steps, id).flatMap((s) => {
|
|
778
|
-
const state = states[s.id];
|
|
779
|
-
return state && (state.status === "failed" || state.skippedAfterFailure) ? [{ step: s, state }] : [];
|
|
780
|
-
});
|
|
781
|
-
}
|
|
782
|
-
function validateStep(step, inputs) {
|
|
783
|
-
const fields = stepFields(step);
|
|
784
|
-
if (!fields.length) return {};
|
|
785
|
-
return validateInputs(
|
|
786
|
-
{
|
|
787
|
-
id: step.id,
|
|
788
|
-
title: step.title,
|
|
789
|
-
inputs: fields},
|
|
790
|
-
inputs
|
|
791
|
-
);
|
|
792
|
-
}
|
|
793
|
-
function upstreamSteps(steps, id) {
|
|
794
|
-
return steps.filter((s) => s.id !== id && dependsOn(steps, id, s.id));
|
|
795
|
-
}
|
|
796
|
-
function sendBackTargets(steps, states, id) {
|
|
797
|
-
return upstreamSteps(steps, id).filter((s) => ["done", "skipped", "failed"].includes(states[s.id]?.status ?? "pending")).reverse();
|
|
798
|
-
}
|
|
799
|
-
var isBlankRef = (ref) => "step" in ref ? !ref.step : "input" in ref ? !ref.input : !ref.id.trim();
|
|
800
|
-
function stepConfigProblems(steps) {
|
|
801
|
-
const out = [];
|
|
802
|
-
for (const s of steps) {
|
|
803
|
-
if (s.kind === "action") {
|
|
804
|
-
const a = s.action;
|
|
805
|
-
if (a.type === "sign") {
|
|
806
|
-
if (!a.document || isBlankRef(a.document)) out.push({ step: s.id, missing: "document" });
|
|
807
|
-
if (!a.signers.length) out.push({ step: s.id, missing: "signers" });
|
|
808
|
-
} else if (a.type === "email_draft") {
|
|
809
|
-
if (!a.to.some((t) => t.trim())) out.push({ step: s.id, missing: "recipients" });
|
|
810
|
-
} else {
|
|
811
|
-
if (!a.tags.length) out.push({ step: s.id, missing: "tags" });
|
|
812
|
-
if (Array.isArray(a.documents) && !a.documents.length)
|
|
813
|
-
out.push({ step: s.id, missing: "documents" });
|
|
814
|
-
}
|
|
815
|
-
}
|
|
816
|
-
if (s.kind === "agent" && s.editDocument && isBlankRef(s.editDocument))
|
|
817
|
-
out.push({ step: s.id, missing: "document" });
|
|
818
|
-
}
|
|
819
|
-
return out;
|
|
820
|
-
}
|
|
821
|
-
function splitDocRef(ref) {
|
|
822
|
-
const m = /^(doc-[A-Za-z0-9]+)(?:@v(\d+))?$/.exec(ref);
|
|
823
|
-
return m ? { id: m[1], ...m[2] ? { version: Number(m[2]) } : {} } : { id: ref };
|
|
824
|
-
}
|
|
825
|
-
var DEFAULT_ASSIGNEE_WORDING = {
|
|
826
|
-
runOwner: "whoever started the run",
|
|
827
|
-
projectLead: "the project lead",
|
|
828
|
-
input: "the person in \u201C{field}\u201D"
|
|
829
|
-
};
|
|
830
|
-
function assigneeName(assignee, options = {}) {
|
|
831
|
-
const w = { ...DEFAULT_ASSIGNEE_WORDING, ...options.wording };
|
|
832
|
-
const name = (id) => options.nameOf?.(id) ?? id;
|
|
833
|
-
const told = options.announcedTo ? options.nameOf?.(options.announcedTo) : void 0;
|
|
834
|
-
if (told) return told;
|
|
835
|
-
if (!assignee) return void 0;
|
|
836
|
-
if ("user" in assignee) return name(assignee.user);
|
|
837
|
-
if ("input" in assignee) {
|
|
838
|
-
const value = options.inputs?.[assignee.input];
|
|
839
|
-
if (typeof value === "string" && value) return name(value);
|
|
840
|
-
const label = options.fields?.find((f) => f.name === assignee.input)?.label ?? assignee.input;
|
|
841
|
-
return w.input.replace("{field}", label);
|
|
842
|
-
}
|
|
843
|
-
if ("runOwner" in assignee) return w.runOwner;
|
|
844
|
-
return w.projectLead;
|
|
845
|
-
}
|
|
846
|
-
var asText = (value) => typeof value === "string" ? value.trim() : typeof value === "number" ? String(value) : "";
|
|
847
|
-
function fillStepInputs(templates, inputs) {
|
|
848
|
-
const out = {};
|
|
849
|
-
for (const [name, template] of Object.entries(templates ?? {})) {
|
|
850
|
-
const bare = /^\{\{\s*([a-z][a-z0-9_]*)\s*\}\}$/i.exec(template);
|
|
851
|
-
if (bare) {
|
|
852
|
-
out[name] = inputs[bare[1]] ?? "";
|
|
853
|
-
continue;
|
|
854
|
-
}
|
|
855
|
-
out[name] = fillRunText(template, inputs);
|
|
856
|
-
}
|
|
857
|
-
return out;
|
|
858
|
-
}
|
|
859
|
-
function fillRunText(template, inputs) {
|
|
860
|
-
return template.replace(/\{\{([^}]*)\}\}/g, (_, expr) => {
|
|
861
|
-
for (const ref of expr.split("||")) {
|
|
862
|
-
const text = asText(inputs[ref.trim()]);
|
|
863
|
-
if (text) return text;
|
|
864
|
-
}
|
|
865
|
-
return "";
|
|
866
|
-
}).trim();
|
|
867
|
-
}
|
|
868
|
-
function runThreadTitle(workflow, inputs) {
|
|
869
|
-
const template = workflow.run.kind === "steps" ? workflow.run.threadTitle : void 0;
|
|
870
|
-
return template && fillRunText(template, inputs) || workflow.title;
|
|
871
|
-
}
|
|
872
|
-
function reviewInstructions(step, inputs) {
|
|
873
|
-
return step.instructions && fillRunText(step.instructions, inputs) || step.title;
|
|
874
|
-
}
|
|
875
|
-
function composeStepPrompt(workflow, step, runInputs, { resolveWorkflow, compose } = {}) {
|
|
876
|
-
if (step.workflow) {
|
|
877
|
-
const target = resolveWorkflow?.(step.workflow);
|
|
878
|
-
if (!target) return "";
|
|
879
|
-
const inputs = { ...defaultInputs(target), ...fillStepInputs(step.with, runInputs) };
|
|
880
|
-
return target.run.kind === "prompt" ? composeWorkflowPrompt(target, inputs) : compose?.(target.id, inputs, runInputs) ?? "";
|
|
881
|
-
}
|
|
882
|
-
if (step.run?.kind === "prompt") {
|
|
883
|
-
return composeWorkflowPrompt(
|
|
884
|
-
{ ...workflow, inputs: runFields(workflow), run: step.run },
|
|
885
|
-
runInputs
|
|
886
|
-
);
|
|
887
|
-
}
|
|
888
|
-
return compose?.(step.id, runInputs, runInputs) ?? "";
|
|
889
|
-
}
|
|
890
|
-
|
|
891
322
|
// src/agents/workflows/planSteps.ts
|
|
892
323
|
function toPlanAssignee(a) {
|
|
893
324
|
if ("user" in a) return { user: a.user };
|
|
@@ -994,7 +425,7 @@ function toStepField(f) {
|
|
|
994
425
|
...f.max !== void 0 ? { max: f.max } : {}
|
|
995
426
|
};
|
|
996
427
|
}
|
|
997
|
-
var
|
|
428
|
+
var compact = (o) => Object.fromEntries(Object.entries(o).filter(([, v]) => v !== void 0 && v !== ""));
|
|
998
429
|
function placeholders(workflow) {
|
|
999
430
|
return Object.fromEntries(runFields(workflow).map((f) => [f.name, `{{${f.name}}}`]));
|
|
1000
431
|
}
|
|
@@ -1010,7 +441,7 @@ function agentStep(workflow, step, options) {
|
|
|
1010
441
|
function toPlanSteps(workflow, options = {}) {
|
|
1011
442
|
const layout = workflow.run.kind === "steps" ? workflow.run.layout : void 0;
|
|
1012
443
|
return workflowSteps(workflow).map((step) => {
|
|
1013
|
-
const ui =
|
|
444
|
+
const ui = compact({
|
|
1014
445
|
description: step.description,
|
|
1015
446
|
icon: step.icon,
|
|
1016
447
|
commit: step.commit,
|
|
@@ -1116,7 +547,7 @@ function layoutFromPlanSteps(steps) {
|
|
|
1116
547
|
});
|
|
1117
548
|
return entries.length ? Object.fromEntries(entries) : void 0;
|
|
1118
549
|
}
|
|
1119
|
-
var
|
|
550
|
+
var FIELD_TYPES = /* @__PURE__ */ new Set([
|
|
1120
551
|
"text",
|
|
1121
552
|
"longtext",
|
|
1122
553
|
"boolean",
|
|
@@ -1130,7 +561,7 @@ var FIELD_TYPES2 = /* @__PURE__ */ new Set([
|
|
|
1130
561
|
function fromStepField(f) {
|
|
1131
562
|
return {
|
|
1132
563
|
name: f.name,
|
|
1133
|
-
type:
|
|
564
|
+
type: FIELD_TYPES.has(f.type) ? f.type : "text",
|
|
1134
565
|
label: f.label ?? f.name,
|
|
1135
566
|
...f.required ? { required: true } : {},
|
|
1136
567
|
...f.options?.length ? { options: f.options.map((o) => ({ value: o.value, label: o.label ?? o.value })) } : {},
|
|
@@ -1337,7 +768,7 @@ function useWorkflowView(options) {
|
|
|
1337
768
|
// src/agents/workflows/stepWindow.ts
|
|
1338
769
|
var LABEL_MAX_PX = 320;
|
|
1339
770
|
var CHAR_PX = 6.5;
|
|
1340
|
-
var LEVEL_CHROME_PX =
|
|
771
|
+
var LEVEL_CHROME_PX = 60;
|
|
1341
772
|
var GROUP_CHIP_PX = 32;
|
|
1342
773
|
function levelRoomPx(titles) {
|
|
1343
774
|
const label = Math.max(0, ...titles.map((t) => Math.min(LABEL_MAX_PX, t.length * CHAR_PX)));
|
|
@@ -1405,20 +836,12 @@ function stepWindow({
|
|
|
1405
836
|
total: all.length
|
|
1406
837
|
};
|
|
1407
838
|
}
|
|
1408
|
-
function PhaseMark({ phase, icon }) {
|
|
1409
|
-
if (phase === "done") return /* @__PURE__ */ jsx(Check, { className: "size-3.5 shrink-0" });
|
|
1410
|
-
if (phase === "running") return /* @__PURE__ */ jsx(Loader2, { className: "size-3.5 shrink-0 animate-spin" });
|
|
1411
|
-
if (phase === "waiting") return /* @__PURE__ */ jsx(Hourglass, { className: "size-3.5 shrink-0" });
|
|
1412
|
-
if (phase === "failed") return /* @__PURE__ */ jsx(AlertTriangle, { className: "size-3.5 shrink-0" });
|
|
1413
|
-
if (phase === "skipped") return /* @__PURE__ */ jsx(MinusCircle, { className: "size-3.5 shrink-0" });
|
|
1414
|
-
return icon ? /* @__PURE__ */ jsx("span", { className: "flex size-3.5 shrink-0 items-center justify-center [&_svg]:size-3.5", children: icon }) : /* @__PURE__ */ jsx("span", { className: "mx-1 size-1.5 shrink-0 rounded-full bg-current opacity-60" });
|
|
1415
|
-
}
|
|
1416
839
|
var DEFAULT_STEP_BAR_LABELS = {
|
|
1417
840
|
nav: "Workflow steps",
|
|
1418
841
|
back: "Earlier steps",
|
|
1419
842
|
forward: "Later steps",
|
|
1420
|
-
hiddenBefore: "{count} earlier steps
|
|
1421
|
-
hiddenAfter: "{count} later steps
|
|
843
|
+
hiddenBefore: "{count} earlier steps",
|
|
844
|
+
hiddenAfter: "{count} later steps",
|
|
1422
845
|
position: "Step {position} of {total}",
|
|
1423
846
|
parallel: "{count} more in parallel",
|
|
1424
847
|
inParallel: "In parallel",
|
|
@@ -1436,53 +859,27 @@ var DEFAULT_STEP_BAR_LABELS = {
|
|
|
1436
859
|
failed: "Failed"
|
|
1437
860
|
}
|
|
1438
861
|
};
|
|
1439
|
-
function stepPillTone(phase, current) {
|
|
1440
|
-
if (current) return "border-primary bg-primary/10 text-primary font-semibold shadow-sm";
|
|
1441
|
-
switch (phase) {
|
|
1442
|
-
case "done":
|
|
1443
|
-
return "border-emerald-600/30 text-emerald-700 dark:border-emerald-400/30 dark:text-emerald-400";
|
|
1444
|
-
case "running":
|
|
1445
|
-
return "border-primary/40 bg-primary/5 text-primary";
|
|
1446
|
-
case "waiting":
|
|
1447
|
-
return "border-amber-500/40 text-amber-700 dark:text-amber-300";
|
|
1448
|
-
case "failed":
|
|
1449
|
-
return "border-destructive/40 text-destructive";
|
|
1450
|
-
case "skipped":
|
|
1451
|
-
return "border-border text-muted-foreground line-through decoration-1";
|
|
1452
|
-
case "ready":
|
|
1453
|
-
return "border-border text-foreground";
|
|
1454
|
-
default:
|
|
1455
|
-
return "border-dashed border-border text-muted-foreground";
|
|
1456
|
-
}
|
|
1457
|
-
}
|
|
1458
|
-
var PHASE_TEXT = {
|
|
1459
|
-
done: "text-emerald-700 dark:text-emerald-400",
|
|
1460
|
-
running: "text-primary",
|
|
1461
|
-
waiting: "text-amber-700 dark:text-amber-300",
|
|
1462
|
-
failed: "text-destructive",
|
|
1463
|
-
skipped: "text-muted-foreground",
|
|
1464
|
-
ready: "text-foreground",
|
|
1465
|
-
blocked: "text-muted-foreground"
|
|
1466
|
-
};
|
|
1467
|
-
var STEP_PILL = "flex min-w-0 items-center gap-1.5 whitespace-nowrap rounded-full border px-2.5 py-1 text-xs font-medium transition-colors";
|
|
1468
862
|
var STEP_LABEL = "min-w-[2.5rem] truncate";
|
|
1469
863
|
var STEP_LABEL_MAX = "max-w-[20rem]";
|
|
1470
|
-
var STEP_LABEL_CURRENT = "min-w-[2.5rem] max-w-[26rem]
|
|
864
|
+
var STEP_LABEL_CURRENT = "block min-w-[2.5rem] max-w-[26rem] truncate";
|
|
1471
865
|
var STEP_EXTRA = "min-w-[3rem] shrink-[1000000] truncate font-normal opacity-80";
|
|
1472
866
|
var fill = (template, values) => Object.entries(values).reduce((s, [k, v]) => s.replace(`{${k}}`, String(v)), template);
|
|
1473
867
|
var NARROW_PX = 560;
|
|
868
|
+
var ARROWS_PX = 56;
|
|
869
|
+
var HIDDEN_PX = 40;
|
|
1474
870
|
function StepBarFrame({
|
|
1475
871
|
levels,
|
|
1476
872
|
phaseOf,
|
|
1477
873
|
current,
|
|
1478
874
|
onSelect,
|
|
1479
875
|
renderStep,
|
|
1480
|
-
noteOf,
|
|
1481
876
|
renderAfter,
|
|
1482
877
|
leading,
|
|
1483
878
|
trailing,
|
|
879
|
+
reservePx = {},
|
|
1484
880
|
isSelectable = () => true,
|
|
1485
881
|
icon,
|
|
882
|
+
kindOf = () => "adhoc",
|
|
1486
883
|
disabled,
|
|
1487
884
|
labels,
|
|
1488
885
|
tid,
|
|
@@ -1494,11 +891,29 @@ function StepBarFrame({
|
|
|
1494
891
|
const narrow = width > 0 && width < NARROW_PX;
|
|
1495
892
|
const [start, setStart] = useState(null);
|
|
1496
893
|
useEffect(() => setStart(null), [current]);
|
|
1497
|
-
const
|
|
1498
|
-
const
|
|
894
|
+
const roomOf = (lv) => levelRoomPx(lv.map((s) => s.title));
|
|
895
|
+
const fits = (k) => {
|
|
896
|
+
const w = stepWindow({ levels, phaseOf, current, start, span: k });
|
|
897
|
+
const reserve = (reservePx.always ?? 0) + (w.start === 0 ? reservePx.leading ?? 0 : 0) + (w.canForward ? 0 : reservePx.trailing ?? 0) + ARROWS_PX + (w.hiddenBefore ? HIDDEN_PX : 0) + (w.hiddenAfter ? HIDDEN_PX : 0);
|
|
898
|
+
return width - reserve >= w.visible.reduce((sum, lv) => sum + roomOf(lv.steps), 0);
|
|
899
|
+
};
|
|
900
|
+
let span = width > 0 ? 1 : 3;
|
|
901
|
+
if (!narrow && width > 0) {
|
|
902
|
+
for (let k = levels.length; k > 1; k--)
|
|
903
|
+
if (fits(k)) {
|
|
904
|
+
span = k;
|
|
905
|
+
break;
|
|
906
|
+
}
|
|
907
|
+
}
|
|
1499
908
|
const win = stepWindow({ levels, phaseOf, current, start, span });
|
|
1500
909
|
const [listOpen, setListOpen] = useState(null);
|
|
1501
910
|
const move = (to) => setStart(Math.max(0, Math.min(win.levels.length - 1, to)));
|
|
911
|
+
const keyMoved = useRef(false);
|
|
912
|
+
useEffect(() => {
|
|
913
|
+
if (!keyMoved.current) return;
|
|
914
|
+
keyMoved.current = false;
|
|
915
|
+
box.current?.querySelector("[data-role] button")?.focus();
|
|
916
|
+
}, [win.start]);
|
|
1502
917
|
const select = (id) => {
|
|
1503
918
|
setListOpen(null);
|
|
1504
919
|
setStart(null);
|
|
@@ -1509,6 +924,7 @@ function StepBarFrame({
|
|
|
1509
924
|
const to = e.key === "ArrowLeft" ? win.start - 1 : e.key === "ArrowRight" ? win.start + 1 : e.key === "Home" ? 0 : e.key === "End" ? win.levels.length : null;
|
|
1510
925
|
if (to === null) return;
|
|
1511
926
|
e.preventDefault();
|
|
927
|
+
keyMoved.current = true;
|
|
1512
928
|
move(to);
|
|
1513
929
|
};
|
|
1514
930
|
const row = (s, isCurrent) => {
|
|
@@ -1522,13 +938,25 @@ function StepBarFrame({
|
|
|
1522
938
|
onClick: () => select(s.id),
|
|
1523
939
|
"aria-current": isCurrent ? "step" : void 0,
|
|
1524
940
|
className: cn(
|
|
941
|
+
`wf-kind-${kindOf(s)}`,
|
|
1525
942
|
"flex w-full min-w-0 items-center gap-2 rounded-md px-2 py-1 text-left text-xs hover:bg-accent disabled:cursor-default disabled:hover:bg-transparent",
|
|
1526
|
-
isCurrent && "bg-
|
|
943
|
+
isCurrent && "bg-accent font-semibold"
|
|
1527
944
|
),
|
|
1528
945
|
"data-phase": phase,
|
|
1529
946
|
"data-testid": tid(`list-step-${s.id}`),
|
|
1530
947
|
children: [
|
|
1531
|
-
/* @__PURE__ */ jsx(
|
|
948
|
+
/* @__PURE__ */ jsx(
|
|
949
|
+
"span",
|
|
950
|
+
{
|
|
951
|
+
className: cn(
|
|
952
|
+
"wf-badge flex size-5 shrink-0 items-center justify-center rounded-md [&_svg]:size-3",
|
|
953
|
+
phase === "done" && "bg-[hsl(var(--wf-accent))] text-card",
|
|
954
|
+
phase === "blocked" && "opacity-60"
|
|
955
|
+
),
|
|
956
|
+
"aria-hidden": true,
|
|
957
|
+
children: /* @__PURE__ */ jsx(StepBadgeMark, { phase, icon: icon?.(s) })
|
|
958
|
+
}
|
|
959
|
+
),
|
|
1532
960
|
/* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate", title: s.title, children: s.title }),
|
|
1533
961
|
/* @__PURE__ */ jsx("span", { className: "shrink-0 text-[10px] font-normal text-muted-foreground", children: l.phases[phase] })
|
|
1534
962
|
]
|
|
@@ -1547,12 +975,14 @@ function StepBarFrame({
|
|
|
1547
975
|
el.focus();
|
|
1548
976
|
el.scrollIntoView?.({ block: "nearest" });
|
|
1549
977
|
};
|
|
1550
|
-
const
|
|
1551
|
-
/* @__PURE__ */ jsx("p", { className: "px-2 py-1 text-[11px] font-medium text-muted-foreground", children: fill(
|
|
1552
|
-
|
|
978
|
+
const stepList = (side) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
979
|
+
/* @__PURE__ */ jsx("p", { className: "px-2 py-1 text-[11px] font-medium text-muted-foreground", children: side ? fill(side === "before" ? l.hiddenBefore : l.hiddenAfter, {
|
|
980
|
+
count: side === "before" ? win.hiddenBefore : win.hiddenAfter
|
|
981
|
+
}) : fill(l.position, { position: win.position, total: win.total }) }),
|
|
982
|
+
/* @__PURE__ */ jsx("ol", { children: (side === "before" ? win.levels.slice(0, win.start) : side === "after" ? win.levels.slice(win.end) : win.levels).map((level) => /* @__PURE__ */ jsxs(
|
|
1553
983
|
"li",
|
|
1554
984
|
{
|
|
1555
|
-
className: cn(level.steps.length > 1 && "my-0.5 border-l-2 border-
|
|
985
|
+
className: cn(level.steps.length > 1 && "my-0.5 border-l-2 border-border pl-1"),
|
|
1556
986
|
children: [
|
|
1557
987
|
level.steps.length > 1 && /* @__PURE__ */ jsx("p", { className: "px-2 text-[10px] uppercase tracking-wide text-muted-foreground", children: l.inParallel }),
|
|
1558
988
|
level.steps.map((s) => row(s, s.id === atId))
|
|
@@ -1584,7 +1014,7 @@ function StepBarFrame({
|
|
|
1584
1014
|
className: "max-h-[min(24rem,70vh)] w-72 overflow-y-auto p-1",
|
|
1585
1015
|
onOpenAutoFocus: focusCurrent,
|
|
1586
1016
|
"data-testid": tid("all-steps"),
|
|
1587
|
-
children:
|
|
1017
|
+
children: stepList()
|
|
1588
1018
|
}
|
|
1589
1019
|
)
|
|
1590
1020
|
] }) : null : count > 0 ? /* @__PURE__ */ jsxs(Popover, { open: listOpen === side, onOpenChange: (o) => setListOpen(o ? side : null), children: [
|
|
@@ -1609,7 +1039,7 @@ function StepBarFrame({
|
|
|
1609
1039
|
className: "max-h-[min(24rem,70vh)] w-80 overflow-y-auto p-1",
|
|
1610
1040
|
onOpenAutoFocus: focusCurrent,
|
|
1611
1041
|
"data-testid": tid("all-steps"),
|
|
1612
|
-
children:
|
|
1042
|
+
children: stepList(side)
|
|
1613
1043
|
}
|
|
1614
1044
|
)
|
|
1615
1045
|
] }) : null;
|
|
@@ -1631,33 +1061,17 @@ function StepBarFrame({
|
|
|
1631
1061
|
);
|
|
1632
1062
|
};
|
|
1633
1063
|
const running = win.runningHidden;
|
|
1634
|
-
const
|
|
1635
|
-
|
|
1636
|
-
{
|
|
1637
|
-
type: "button",
|
|
1638
|
-
onClick: () => select(s.id),
|
|
1639
|
-
className: "flex min-w-0 max-w-[14rem] shrink items-center gap-1.5 rounded-full border border-primary/40 bg-primary/5 px-2 py-1 text-xs text-primary hover:bg-primary/10",
|
|
1640
|
-
title: fill(l.working, { title: s.title }),
|
|
1641
|
-
"data-testid": tid(`working-${s.id}`),
|
|
1642
|
-
children: [
|
|
1643
|
-
/* @__PURE__ */ jsx(Loader2, { className: "size-3.5 shrink-0 animate-spin" }),
|
|
1644
|
-
/* @__PURE__ */ jsx("span", { className: "truncate", children: fill(l.working, { title: s.title }) })
|
|
1645
|
-
]
|
|
1646
|
-
},
|
|
1647
|
-
s.id
|
|
1648
|
-
);
|
|
1649
|
-
const failedPill = (s) => /* @__PURE__ */ jsxs(
|
|
1650
|
-
"button",
|
|
1064
|
+
const outOfViewChip = (s, kind) => /* @__PURE__ */ jsx(
|
|
1065
|
+
StepChip,
|
|
1651
1066
|
{
|
|
1652
|
-
|
|
1067
|
+
kind: kindOf(s),
|
|
1068
|
+
phase: kind === "working" ? "running" : "failed",
|
|
1069
|
+
label: fill(l[kind], { title: s.title }),
|
|
1070
|
+
labelClassName: narrow ? "sr-only" : "truncate",
|
|
1653
1071
|
onClick: () => select(s.id),
|
|
1654
|
-
className: "
|
|
1655
|
-
title: fill(l
|
|
1656
|
-
"data-testid": tid(
|
|
1657
|
-
children: [
|
|
1658
|
-
/* @__PURE__ */ jsx(AlertTriangle, { className: "size-3.5 shrink-0" }),
|
|
1659
|
-
/* @__PURE__ */ jsx("span", { className: "truncate", children: fill(l.failedStep, { title: s.title }) })
|
|
1660
|
-
]
|
|
1072
|
+
className: "max-w-[14rem] shrink",
|
|
1073
|
+
title: fill(l[kind], { title: s.title }),
|
|
1074
|
+
"data-testid": tid(`${kind === "working" ? "working" : "failed"}-${s.id}`)
|
|
1661
1075
|
},
|
|
1662
1076
|
s.id
|
|
1663
1077
|
);
|
|
@@ -1667,7 +1081,7 @@ function StepBarFrame({
|
|
|
1667
1081
|
ref: box,
|
|
1668
1082
|
"aria-label": l.nav,
|
|
1669
1083
|
onKeyDown,
|
|
1670
|
-
className: cn("flex min-w-0 items-center gap-1",
|
|
1084
|
+
className: cn("flex min-w-0 items-center gap-1", className),
|
|
1671
1085
|
"data-testid": tid("steps"),
|
|
1672
1086
|
"data-narrow": narrow || void 0,
|
|
1673
1087
|
children: [
|
|
@@ -1700,10 +1114,8 @@ function StepBarFrame({
|
|
|
1700
1114
|
"span",
|
|
1701
1115
|
{
|
|
1702
1116
|
"aria-hidden": true,
|
|
1703
|
-
className: cn(
|
|
1704
|
-
|
|
1705
|
-
level.steps.every((s) => ["done", "skipped"].includes(phaseOf(s.id))) ? "bg-emerald-600/40" : "bg-border"
|
|
1706
|
-
)
|
|
1117
|
+
className: cn("wf-link", `wf-kind-${kindOf(level.primary)}`),
|
|
1118
|
+
"data-done": level.steps.every((s) => ["done", "skipped"].includes(phaseOf(s.id))) || void 0
|
|
1707
1119
|
}
|
|
1708
1120
|
)
|
|
1709
1121
|
]
|
|
@@ -1713,30 +1125,21 @@ function StepBarFrame({
|
|
|
1713
1125
|
overflow("after", win.hiddenAfter),
|
|
1714
1126
|
!win.canForward && trailing,
|
|
1715
1127
|
arrow("forward"),
|
|
1716
|
-
narrow && atId && noteOf?.(atId) && /* @__PURE__ */ jsx(
|
|
1717
|
-
"p",
|
|
1718
|
-
{
|
|
1719
|
-
className: "min-w-0 basis-full truncate px-1 text-[11px] text-muted-foreground",
|
|
1720
|
-
"data-testid": tid("note"),
|
|
1721
|
-
children: noteOf(atId)
|
|
1722
|
-
}
|
|
1723
|
-
),
|
|
1724
1128
|
running.length > 0 && /* @__PURE__ */ jsxs(
|
|
1725
1129
|
"div",
|
|
1726
1130
|
{
|
|
1727
|
-
className: cn(
|
|
1728
|
-
"flex min-w-[6.5rem] shrink-[1000] items-center gap-1",
|
|
1729
|
-
narrow && "basis-full"
|
|
1730
|
-
),
|
|
1131
|
+
className: cn("flex shrink-[1000] items-center gap-1", !narrow && "min-w-[6.5rem]"),
|
|
1731
1132
|
"data-testid": tid("working"),
|
|
1732
1133
|
children: [
|
|
1733
|
-
(running.length > 2 ? running.slice(0, 1) : running).map(
|
|
1134
|
+
(running.length > 2 ? running.slice(0, 1) : running).map(
|
|
1135
|
+
(s) => outOfViewChip(s, "working")
|
|
1136
|
+
),
|
|
1734
1137
|
running.length > 2 && /* @__PURE__ */ jsxs(Popover, { children: [
|
|
1735
1138
|
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
1736
1139
|
"button",
|
|
1737
1140
|
{
|
|
1738
1141
|
type: "button",
|
|
1739
|
-
className: "flex shrink-0 items-center gap-1 rounded-
|
|
1142
|
+
className: "flex shrink-0 items-center gap-1 rounded-lg border border-border bg-card px-2 py-1 text-xs text-muted-foreground hover:text-foreground",
|
|
1740
1143
|
"data-testid": tid("working-more"),
|
|
1741
1144
|
children: [
|
|
1742
1145
|
/* @__PURE__ */ jsx(Loader2, { className: "size-3.5 animate-spin" }),
|
|
@@ -1752,12 +1155,9 @@ function StepBarFrame({
|
|
|
1752
1155
|
win.failedHidden.length > 0 && /* @__PURE__ */ jsx(
|
|
1753
1156
|
"div",
|
|
1754
1157
|
{
|
|
1755
|
-
className: cn(
|
|
1756
|
-
"flex min-w-[6.5rem] shrink-[1000] items-center gap-1",
|
|
1757
|
-
narrow && "basis-full"
|
|
1758
|
-
),
|
|
1158
|
+
className: cn("flex shrink-[1000] items-center gap-1", !narrow && "min-w-[6.5rem]"),
|
|
1759
1159
|
"data-testid": tid("failed"),
|
|
1760
|
-
children: win.failedHidden.map(
|
|
1160
|
+
children: win.failedHidden.map((s) => outOfViewChip(s, "failedStep"))
|
|
1761
1161
|
}
|
|
1762
1162
|
)
|
|
1763
1163
|
]
|
|
@@ -1776,7 +1176,7 @@ function GroupChip({
|
|
|
1776
1176
|
"button",
|
|
1777
1177
|
{
|
|
1778
1178
|
type: "button",
|
|
1779
|
-
className: "shrink-0 rounded-
|
|
1179
|
+
className: "shrink-0 rounded-md border border-border bg-card px-1.5 py-0.5 text-[11px] font-medium tabular-nums text-muted-foreground shadow-sm hover:text-foreground",
|
|
1780
1180
|
"aria-label": label,
|
|
1781
1181
|
title: label,
|
|
1782
1182
|
"data-testid": tid(`group-${level.steps[0].id}`),
|
|
@@ -1834,10 +1234,6 @@ var DEFAULT_WORKFLOW_STEP_PARTS_LABELS = {
|
|
|
1834
1234
|
redlineHint: "The edits are tracked changes: accept or reject each one in Word.",
|
|
1835
1235
|
someone: "someone"
|
|
1836
1236
|
};
|
|
1837
|
-
var formatDate = (iso) => {
|
|
1838
|
-
const t = iso ? Date.parse(iso) : NaN;
|
|
1839
|
-
return Number.isNaN(t) ? "" : new Date(t).toLocaleString(void 0, { dateStyle: "medium", timeStyle: "short" });
|
|
1840
|
-
};
|
|
1841
1237
|
var docName = (ref, nameOfDoc) => {
|
|
1842
1238
|
const { id, version } = splitDocRef(ref);
|
|
1843
1239
|
const name = nameOfDoc?.(id) ?? id;
|
|
@@ -1994,13 +1390,6 @@ function SendBackControl({
|
|
|
1994
1390
|
}
|
|
1995
1391
|
);
|
|
1996
1392
|
}
|
|
1997
|
-
var shownValue = (v, field, nameOf) => {
|
|
1998
|
-
if (v === void 0 || v === null || v === "") return "\u2014";
|
|
1999
|
-
if (typeof v === "boolean") return v ? "\u2713" : "\u2717";
|
|
2000
|
-
if (field.type === "person" && typeof v === "string") return nameOf?.(v) ?? v;
|
|
2001
|
-
if (field.type === "select") return field.options?.find((o) => o.value === v)?.label ?? String(v);
|
|
2002
|
-
return typeof v === "object" ? JSON.stringify(v) : String(v);
|
|
2003
|
-
};
|
|
2004
1393
|
function ApprovalEvidence({
|
|
2005
1394
|
run,
|
|
2006
1395
|
step,
|
|
@@ -2294,12 +1683,7 @@ function WorkflowStepBar({
|
|
|
2294
1683
|
const done = { id: DONE, title: doneTitle };
|
|
2295
1684
|
const phaseOf = (id) => id === DONE ? run.isComplete ? "done" : "blocked" : run.phaseOf(id);
|
|
2296
1685
|
const current = run.isComplete ? DONE : run.current;
|
|
2297
|
-
const
|
|
2298
|
-
if (id === DONE || !["ready", "waiting"].includes(phaseOf(id))) return void 0;
|
|
2299
|
-
const assignee = run.assigneeOf(id);
|
|
2300
|
-
return assignee ? l.waitingFor.replace("{name}", assignee) : void 0;
|
|
2301
|
-
};
|
|
2302
|
-
const pill = (s, narrow = false) => {
|
|
1686
|
+
const pill = (s) => {
|
|
2303
1687
|
const phase = phaseOf(s.id);
|
|
2304
1688
|
const isCurrent = s.id === current;
|
|
2305
1689
|
const assignee = ["ready", "waiting"].includes(phase) ? run.assigneeOf(s.id) : void 0;
|
|
@@ -2309,55 +1693,51 @@ function WorkflowStepBar({
|
|
|
2309
1693
|
const title = [s.title, waiting, failure].filter(Boolean).join(" \xB7 ");
|
|
2310
1694
|
const name = `${title} (${l.phases[phase]})`;
|
|
2311
1695
|
if (s.id === DONE)
|
|
2312
|
-
return /* @__PURE__ */
|
|
2313
|
-
|
|
1696
|
+
return /* @__PURE__ */ jsx(
|
|
1697
|
+
StepChip,
|
|
2314
1698
|
{
|
|
2315
|
-
|
|
2316
|
-
|
|
1699
|
+
inert: true,
|
|
1700
|
+
kind: "start",
|
|
1701
|
+
phase: run.isComplete ? "done" : "ready",
|
|
1702
|
+
icon: doneIcon,
|
|
1703
|
+
label: doneTitle,
|
|
1704
|
+
labelClassName: cn(STEP_LABEL, STEP_LABEL_MAX),
|
|
1705
|
+
current: isCurrent,
|
|
2317
1706
|
"aria-label": name,
|
|
2318
1707
|
title: doneTitle,
|
|
2319
|
-
"data-
|
|
2320
|
-
"data-testid": tid("step-done"),
|
|
2321
|
-
children: [
|
|
2322
|
-
/* @__PURE__ */ jsx(PhaseMark, { phase: run.isComplete ? "done" : "ready", icon: doneIcon }),
|
|
2323
|
-
/* @__PURE__ */ jsx("span", { className: cn(STEP_LABEL, STEP_LABEL_MAX), children: doneTitle })
|
|
2324
|
-
]
|
|
1708
|
+
"data-testid": tid("step-done")
|
|
2325
1709
|
}
|
|
2326
1710
|
);
|
|
2327
|
-
|
|
2328
|
-
|
|
1711
|
+
const kind = stepKindOf(s);
|
|
1712
|
+
const KindIcon = STEP_KIND_ICONS[kind];
|
|
1713
|
+
return /* @__PURE__ */ jsx(
|
|
1714
|
+
StepChip,
|
|
2329
1715
|
{
|
|
2330
|
-
|
|
1716
|
+
kind,
|
|
1717
|
+
phase,
|
|
1718
|
+
icon: icon(s.icon) ?? /* @__PURE__ */ jsx(KindIcon, {}),
|
|
1719
|
+
label: s.title,
|
|
1720
|
+
current: isCurrent,
|
|
1721
|
+
heading: DEFAULT_STEP_KIND_LABELS[kind],
|
|
1722
|
+
labelClassName: isCurrent ? STEP_LABEL_CURRENT : cn(STEP_LABEL, STEP_LABEL_MAX),
|
|
1723
|
+
labelTestId: tid(`step-${s.id}-label`),
|
|
2331
1724
|
onClick: () => run.goTo(s.id),
|
|
2332
1725
|
disabled: run.busy,
|
|
2333
|
-
className:
|
|
2334
|
-
"aria-current": isCurrent ? "step" : void 0,
|
|
1726
|
+
className: "disabled:cursor-default",
|
|
2335
1727
|
"aria-label": name,
|
|
2336
1728
|
title,
|
|
2337
|
-
"data-phase": phase,
|
|
2338
1729
|
"data-testid": tid(`step-${s.id}`),
|
|
2339
|
-
children:
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
"
|
|
2343
|
-
{
|
|
2344
|
-
|
|
2345
|
-
"
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
"span",
|
|
2351
|
-
{
|
|
2352
|
-
className: cn(STEP_EXTRA, "max-w-[12rem]"),
|
|
2353
|
-
"data-testid": tid(`step-${s.id}-assignee`),
|
|
2354
|
-
children: [
|
|
2355
|
-
"\xB7 ",
|
|
2356
|
-
waiting
|
|
2357
|
-
]
|
|
2358
|
-
}
|
|
2359
|
-
)
|
|
2360
|
-
]
|
|
1730
|
+
children: assignee && isCurrent && /* @__PURE__ */ jsxs(
|
|
1731
|
+
"span",
|
|
1732
|
+
{
|
|
1733
|
+
className: cn(STEP_EXTRA, "max-w-[12rem]"),
|
|
1734
|
+
"data-testid": tid(`step-${s.id}-assignee`),
|
|
1735
|
+
children: [
|
|
1736
|
+
"\xB7 ",
|
|
1737
|
+
waiting
|
|
1738
|
+
]
|
|
1739
|
+
}
|
|
1740
|
+
)
|
|
2361
1741
|
}
|
|
2362
1742
|
);
|
|
2363
1743
|
};
|
|
@@ -2369,9 +1749,9 @@ function WorkflowStepBar({
|
|
|
2369
1749
|
current,
|
|
2370
1750
|
onSelect: (id) => id !== DONE && run.goTo(id),
|
|
2371
1751
|
isSelectable: (id) => id !== DONE,
|
|
2372
|
-
renderStep: (s
|
|
2373
|
-
noteOf: waitingOf,
|
|
1752
|
+
renderStep: (s) => pill(s),
|
|
2374
1753
|
icon: (s) => s.id === DONE ? doneIcon : icon(s.icon),
|
|
1754
|
+
kindOf: (s) => s.id === DONE ? "start" : stepKindOf(s),
|
|
2375
1755
|
disabled: run.busy,
|
|
2376
1756
|
labels,
|
|
2377
1757
|
tid,
|
|
@@ -2442,7 +1822,7 @@ function WorkflowRunner({
|
|
|
2442
1822
|
actions,
|
|
2443
1823
|
nameOfDoc,
|
|
2444
1824
|
hideStepBar,
|
|
2445
|
-
compact:
|
|
1825
|
+
compact: compact2,
|
|
2446
1826
|
labels,
|
|
2447
1827
|
partsLabels,
|
|
2448
1828
|
testIdPrefix = "workflow-run",
|
|
@@ -2450,7 +1830,7 @@ function WorkflowRunner({
|
|
|
2450
1830
|
}) {
|
|
2451
1831
|
const l = { ...DEFAULT_WORKFLOW_RUNNER_LABELS, ...labels };
|
|
2452
1832
|
const pl = { ...DEFAULT_WORKFLOW_STEP_PARTS_LABELS, ...partsLabels };
|
|
2453
|
-
const box =
|
|
1833
|
+
const box = compact2 ? "p-4" : "max-w-2xl p-6";
|
|
2454
1834
|
const { steps, step, isComplete, action } = run;
|
|
2455
1835
|
const completion = workflow.run.kind === "steps" ? workflow.run.completion : void 0;
|
|
2456
1836
|
const tid = (suffix) => `${testIdPrefix}-${suffix}`;
|
|
@@ -2464,7 +1844,7 @@ function WorkflowRunner({
|
|
|
2464
1844
|
const uploadHold = step?.kind === "upload" && (sending > 0 || uploading || unsent > 0);
|
|
2465
1845
|
const docsWait = !!step && waitingDocuments(run.stateOf(step.id)).length > 0;
|
|
2466
1846
|
const nextLabel = sending ? sending === 1 ? l.uploadingFile : l.uploadingFiles.replace("{count}", String(sending)) : uploadHold && uploading ? l.uploadingAny : uploadHold ? unsent === 1 ? l.uploadFailed : l.uploadsFailed.replace("{count}", String(unsent)) : reading ? l.readingFiles.replace("{current}", String(Math.min(added.length - unread + 1, added.length))).replace("{count}", String(added.length)) : action === "start" ? l.start : action === "retry" ? l.retry : action === "finish" ? l.finish : action === "complete" && step?.kind === "review" ? l.approve : action === "complete" && step?.kind === "action" ? l.markSent : action === "wait" && (run.isRunning || run.busy || docsWait) ? l.working : (step && !run.isLocked(step.id) ? step.nextLabel : void 0) ?? l.next;
|
|
2467
|
-
return /* @__PURE__ */ jsxs("div", { className: cn(
|
|
1847
|
+
return /* @__PURE__ */ jsxs("div", { className: cn(compact2 ? "space-y-3" : "space-y-6", className), "data-testid": testIdPrefix, children: [
|
|
2468
1848
|
!hideStepBar && /* @__PURE__ */ jsx(
|
|
2469
1849
|
WorkflowStepBar,
|
|
2470
1850
|
{
|
|
@@ -2605,7 +1985,7 @@ function WorkflowRunner({
|
|
|
2605
1985
|
renderAgentOutput,
|
|
2606
1986
|
icon: icon(step.icon),
|
|
2607
1987
|
renderStepNote,
|
|
2608
|
-
compact:
|
|
1988
|
+
compact: compact2,
|
|
2609
1989
|
nameOfDoc,
|
|
2610
1990
|
extra: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2611
1991
|
/* @__PURE__ */ jsx(SentBackNote, { state: run.stateOf(step.id), l: pl, testId: tid(step.id) }),
|
|
@@ -2630,7 +2010,7 @@ function WorkflowRunner({
|
|
|
2630
2010
|
{
|
|
2631
2011
|
className: cn(
|
|
2632
2012
|
"flex items-center justify-between border-t border-border pt-4",
|
|
2633
|
-
|
|
2013
|
+
compact2 && "flex-wrap gap-2 pt-3"
|
|
2634
2014
|
),
|
|
2635
2015
|
children: [
|
|
2636
2016
|
/* @__PURE__ */ jsxs(
|
|
@@ -2650,7 +2030,7 @@ function WorkflowRunner({
|
|
|
2650
2030
|
/* @__PURE__ */ jsxs(
|
|
2651
2031
|
"div",
|
|
2652
2032
|
{
|
|
2653
|
-
className: cn("flex items-center gap-2",
|
|
2033
|
+
className: cn("flex items-center gap-2", compact2 && "ml-auto flex-wrap justify-end"),
|
|
2654
2034
|
children: [
|
|
2655
2035
|
step && // A step that commits (creates the matter, starts the thread) is what the run stands on.
|
|
2656
2036
|
!step.commit && ["ready", "blocked", "failed"].includes(run.phaseOf(step.id)) && /* @__PURE__ */ jsx(
|
|
@@ -2810,7 +2190,7 @@ function AgentStepBody({
|
|
|
2810
2190
|
icon,
|
|
2811
2191
|
renderStepNote,
|
|
2812
2192
|
extra,
|
|
2813
|
-
compact:
|
|
2193
|
+
compact: compact2,
|
|
2814
2194
|
nameOfDoc,
|
|
2815
2195
|
l,
|
|
2816
2196
|
tid
|
|
@@ -2873,7 +2253,7 @@ function AgentStepBody({
|
|
|
2873
2253
|
phase === "skipped" && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", "data-testid": tid(`${step.id}-skipped`), children: state?.skippedAfterFailure ? l.skippedAfterFailure.replace("{error}", state.error ? `: ${state.error}` : "") : l.skipped }),
|
|
2874
2254
|
extra
|
|
2875
2255
|
] });
|
|
2876
|
-
if (step.output === "artifact" && !
|
|
2256
|
+
if (step.output === "artifact" && !compact2) {
|
|
2877
2257
|
return /* @__PURE__ */ jsxs(
|
|
2878
2258
|
"div",
|
|
2879
2259
|
{
|
|
@@ -2890,7 +2270,7 @@ function AgentStepBody({
|
|
|
2890
2270
|
}
|
|
2891
2271
|
);
|
|
2892
2272
|
}
|
|
2893
|
-
return /* @__PURE__ */ jsxs(Card, { className: cn("space-y-3",
|
|
2273
|
+
return /* @__PURE__ */ jsxs(Card, { className: cn("space-y-3", compact2 ? "p-4" : "p-6"), "data-testid": tid(step.id), children: [
|
|
2894
2274
|
header,
|
|
2895
2275
|
status,
|
|
2896
2276
|
renderAgentOutput(step, state),
|
|
@@ -3131,6 +2511,6 @@ function TaskActivityTimeline({
|
|
|
3131
2511
|
}) });
|
|
3132
2512
|
}
|
|
3133
2513
|
|
|
3134
|
-
export { ActionStepBody, ApprovalEvidence, AssigneeLine,
|
|
3135
|
-
//# sourceMappingURL=chunk-
|
|
3136
|
-
//# sourceMappingURL=chunk-
|
|
2514
|
+
export { ActionStepBody, ApprovalEvidence, AssigneeLine, DEFAULT_SCHEMA_FORM_LABELS, DEFAULT_STEP_BAR_LABELS, DEFAULT_TASK_ACTIVITY_LABELS, DEFAULT_WORKFLOW_RUNNER_LABELS, DEFAULT_WORKFLOW_STEP_PARTS_LABELS, STEP_LABEL, STEP_LABEL_CURRENT, STEP_LABEL_MAX, SchemaForm, SendBackControl, StepBarFrame, TaskActivityTimeline, WorkflowRunner, WorkflowStepBar, activeStepId, fromPlanAssignee, fromPlanDocumentRef, fromPlanSteps, isIncompleteSignal, layoutFromPlanSteps, stepWindow, taskActivityHeadline, toPlanAssignee, toPlanDocumentRef, toPlanSteps, useWorkflowView };
|
|
2515
|
+
//# sourceMappingURL=chunk-MD7RVFKA.js.map
|
|
2516
|
+
//# sourceMappingURL=chunk-MD7RVFKA.js.map
|