@ekanos/harness 0.27.0 → 0.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -4
- package/dist/internal/components/approvals-tray.d.ts +44 -6
- package/dist/internal/components/approvals-tray.js +252 -30
- package/dist/internal/components/ask-assistant-bridge.js +7 -1
- package/dist/internal/components/connect-controls.js +4 -2
- package/dist/internal/components/connect-dialog.d.ts +8 -1
- package/dist/internal/components/connect-dialog.js +23 -10
- package/dist/internal/components/connect-panel.d.ts +3 -2
- package/dist/internal/components/connect-panel.js +680 -340
- package/dist/internal/components/connect-steps.d.ts +72 -0
- package/dist/internal/components/connect-steps.js +341 -0
- package/dist/internal/components/console-not-found.d.ts +14 -0
- package/dist/internal/components/console-not-found.js +57 -0
- package/dist/internal/components/dashboard-grid.d.ts +10 -5
- package/dist/internal/components/dashboard-grid.js +8 -9
- package/dist/internal/components/dev-toolbar.d.ts +27 -5
- package/dist/internal/components/dev-toolbar.js +214 -176
- package/dist/internal/components/ekanos-logo.d.ts +18 -0
- package/dist/internal/components/ekanos-logo.js +74 -0
- package/dist/internal/components/events-panel.d.ts +13 -4
- package/dist/internal/components/events-panel.js +478 -81
- package/dist/internal/components/harness-widget-provider.d.ts +6 -8
- package/dist/internal/components/harness-widget-provider.js +5 -19
- package/dist/internal/components/health-panel.d.ts +8 -1
- package/dist/internal/components/health-panel.js +328 -31
- package/dist/internal/components/integration-badge.js +4 -2
- package/dist/internal/components/integration-tab-skeletons.d.ts +8 -0
- package/dist/internal/components/integration-tab-skeletons.js +76 -0
- package/dist/internal/components/not-found-state.d.ts +39 -0
- package/dist/internal/components/not-found-state.js +127 -0
- package/dist/internal/components/operation-runner-panel.d.ts +1 -1
- package/dist/internal/components/operation-runner-panel.js +624 -189
- package/dist/internal/components/operation-scope.d.ts +13 -0
- package/dist/internal/components/operation-scope.js +79 -0
- package/dist/internal/components/page-skeletons.d.ts +11 -0
- package/dist/internal/components/page-skeletons.js +61 -0
- package/dist/internal/components/provenance-banner.d.ts +13 -4
- package/dist/internal/components/provenance-banner.js +35 -10
- package/dist/internal/components/run-log-copy.d.ts +17 -0
- package/dist/internal/components/run-log-copy.js +67 -0
- package/dist/internal/components/run-log-detail.d.ts +22 -0
- package/dist/internal/components/run-log-detail.js +295 -0
- package/dist/internal/components/run-log-empty.d.ts +13 -0
- package/dist/internal/components/run-log-empty.js +46 -0
- package/dist/internal/components/run-log.d.ts +23 -3
- package/dist/internal/components/run-log.js +384 -130
- package/dist/internal/components/runtime-strip.d.ts +5 -1
- package/dist/internal/components/runtime-strip.js +82 -5
- package/dist/internal/components/schema-form.d.ts +2 -1
- package/dist/internal/components/schema-form.js +212 -79
- package/dist/internal/components/scrollable-nav.js +14 -2
- package/dist/internal/components/segmented-control.d.ts +19 -0
- package/dist/internal/components/segmented-control.js +46 -0
- package/dist/internal/components/shell-header.d.ts +25 -0
- package/dist/internal/components/shell-header.js +126 -0
- package/dist/internal/components/surface-nav.d.ts +12 -4
- package/dist/internal/components/surface-nav.js +79 -80
- package/dist/internal/components/widget-surface.d.ts +5 -1
- package/dist/internal/components/widget-surface.js +86 -14
- package/dist/internal/components/workflow-runner.d.ts +23 -10
- package/dist/internal/components/workflow-runner.js +451 -69
- package/dist/internal/lib/connect-model.d.ts +134 -0
- package/dist/internal/lib/connect-model.js +282 -0
- package/dist/internal/lib/connection-facts.js +2 -1
- package/dist/internal/lib/console-client.js +5 -2
- package/dist/internal/lib/console-hooks.d.ts +4 -1
- package/dist/internal/lib/console-hooks.js +3 -2
- package/dist/internal/lib/console-types.d.ts +6 -0
- package/dist/internal/lib/docs-links.d.ts +27 -0
- package/dist/internal/lib/docs-links.js +55 -1
- package/dist/internal/lib/event-delivery.d.ts +33 -0
- package/dist/internal/lib/event-delivery.js +66 -0
- package/dist/internal/lib/font-files/OFL-BricolageGrotesque.txt +93 -0
- package/dist/internal/lib/font-files/OFL-Figtree.txt +93 -0
- package/dist/internal/lib/font-files/bricolage-grotesque-latin-variable.woff2 +0 -0
- package/dist/internal/lib/font-files/figtree-latin-variable.woff2 +0 -0
- package/dist/internal/lib/fonts.js +13 -12
- package/dist/internal/lib/health-model.d.ts +58 -0
- package/dist/internal/lib/health-model.js +140 -0
- package/dist/internal/lib/integration-console-href.d.ts +5 -0
- package/dist/internal/lib/integration-console-href.js +7 -1
- package/dist/internal/lib/oauth-setup-guide.d.ts +28 -0
- package/dist/internal/lib/oauth-setup-guide.js +35 -1
- package/dist/internal/lib/operation-catalog.d.ts +70 -0
- package/dist/internal/lib/operation-catalog.js +261 -0
- package/dist/internal/lib/overview-model.d.ts +34 -0
- package/dist/internal/lib/overview-model.js +91 -0
- package/dist/internal/lib/registry-entry.d.ts +8 -0
- package/dist/internal/lib/registry-entry.js +11 -0
- package/dist/internal/lib/repo-name.d.ts +9 -0
- package/dist/internal/lib/repo-name.js +21 -0
- package/dist/internal/lib/run-log-view.d.ts +66 -1
- package/dist/internal/lib/run-log-view.js +183 -4
- package/dist/internal/lib/runner-view.d.ts +15 -0
- package/dist/internal/lib/runner-view.js +18 -0
- package/dist/internal/lib/schema-form-model.d.ts +17 -0
- package/dist/internal/lib/schema-form-model.js +50 -0
- package/dist/internal/lib/setup-checklist.d.ts +34 -0
- package/dist/internal/lib/setup-checklist.js +79 -0
- package/dist/internal/lib/toolbar-context.d.ts +0 -1
- package/dist/internal/lib/toolbar-context.js +0 -2
- package/dist/internal/lib/toolbar-visibility.d.ts +9 -2
- package/dist/internal/lib/toolbar-visibility.js +5 -0
- package/dist/internal/lib/use-operation-effects.d.ts +7 -0
- package/dist/internal/lib/use-operation-effects.js +28 -0
- package/dist/internal/lib/use-run-log-query.d.ts +9 -0
- package/dist/internal/lib/use-run-log-query.js +35 -0
- package/dist/internal/lib/widget-grid-gaps.d.ts +18 -0
- package/dist/internal/lib/widget-grid-gaps.js +41 -0
- package/dist/internal/lib/workflow-summary.d.ts +54 -0
- package/dist/internal/lib/workflow-summary.js +147 -0
- package/dist/internal/routes/console-home-page.js +2 -1
- package/dist/internal/routes/experience-connect-page.js +46 -17
- package/dist/internal/routes/experience-layout-page.d.ts +6 -6
- package/dist/internal/routes/experience-layout-page.js +3 -119
- package/dist/internal/routes/experience-page-host.js +61 -5
- package/dist/internal/routes/experience-pages-page.d.ts +5 -0
- package/dist/internal/routes/experience-pages-page.js +118 -0
- package/dist/internal/routes/experience-review-queue-page.d.ts +4 -1
- package/dist/internal/routes/experience-review-queue-page.js +108 -12
- package/dist/internal/routes/experience-runs-page.js +57 -4
- package/dist/internal/routes/experience-summary-page.d.ts +19 -0
- package/dist/internal/routes/experience-summary-page.js +212 -52
- package/dist/internal/routes/experience-widget-page.js +58 -7
- package/dist/internal/routes/experience-widgets-page.d.ts +2 -3
- package/dist/internal/routes/experience-widgets-page.js +29 -4
- package/dist/internal/routes/experience-workflow-page.js +81 -9
- package/dist/internal/routes/experience-workflows-page.js +85 -21
- package/dist/internal/routes/integration-layout.js +28 -3
- package/dist/internal/routes/integrations-connect-page.js +16 -6
- package/dist/internal/routes/integrations-events-page.js +22 -1
- package/dist/internal/routes/integrations-health-page.js +16 -1
- package/dist/internal/routes/integrations-layout.js +28 -4
- package/dist/internal/routes/integrations-list-page.d.ts +0 -1
- package/dist/internal/routes/integrations-list-page.js +11 -9
- package/dist/internal/routes/integrations-operation-page.js +53 -17
- package/dist/internal/routes/integrations-operations-page.js +539 -49
- package/dist/internal/routes/integrations-overview-page.js +332 -69
- package/dist/internal/routes/integrations-runs-page.js +53 -3
- package/dist/internal/routes/integrations-scope.d.ts +15 -2
- package/dist/internal/routes/integrations-scope.js +66 -18
- package/dist/internal/routes/preview-index-page.js +2 -2
- package/dist/internal/routes/repo-home-page.d.ts +2 -2
- package/dist/internal/routes/repo-home-page.js +429 -236
- package/dist/internal/routes/repo-layout.d.ts +12 -0
- package/dist/internal/routes/repo-layout.js +50 -38
- package/dist/internal/routes/repo-package-layouts.js +22 -8
- package/dist/internal/routes/single-widget-page.d.ts +1 -1
- package/dist/internal/routes/single-widget-page.js +28 -5
- package/dist/internal/routes/tile-page.d.ts +1 -1
- package/dist/internal/routes/tile-page.js +1 -2
- package/dist/internal/routes/widgets-page.d.ts +1 -1
- package/dist/internal/routes/widgets-page.js +5 -3
- package/dist/registry.d.ts +4 -5
- package/dist/registry.js +0 -1
- package/dist/routes.d.ts +8 -1
- package/dist/routes.js +4 -0
- package/package.json +14 -14
|
@@ -1,104 +1,486 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import Link from "next/link";
|
|
3
4
|
import { Alert, AlertDescription } from "@ekanos/ui/alert";
|
|
4
5
|
import { Button } from "@ekanos/ui/button";
|
|
5
6
|
import { Card } from "@ekanos/ui/card";
|
|
7
|
+
import { Icon } from "@ekanos/ui/icon";
|
|
6
8
|
import { StatusBadge } from "@ekanos/ui/status-badge";
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
9
|
+
import { cn } from "@ekanos/ui/utils";
|
|
10
|
+
import {
|
|
11
|
+
useMutation,
|
|
12
|
+
useMutationState,
|
|
13
|
+
useQueryClient
|
|
14
|
+
} from "@tanstack/react-query";
|
|
15
|
+
import { useConsoleClient, useConsoleLinks } from "../lib/console-context.js";
|
|
16
|
+
import { consoleKeys, useApprovals, useProject } from "../lib/console-hooks.js";
|
|
17
|
+
import { integrationConsoleHref } from "../lib/integration-console-href.js";
|
|
18
|
+
import { shortName } from "../lib/setup-checklist.js";
|
|
19
|
+
import {
|
|
20
|
+
gateStepId,
|
|
21
|
+
groupSteps,
|
|
22
|
+
humanizeStepLabel,
|
|
23
|
+
isSimulated,
|
|
24
|
+
splitOpKey,
|
|
25
|
+
stepTypeLabel
|
|
26
|
+
} from "../lib/workflow-summary.js";
|
|
27
|
+
import { ApprovalList, DecisionLog, ProposalText } from "./approvals-tray.js";
|
|
28
|
+
import { FOCUS_RING } from "./scrollable-nav.js";
|
|
29
|
+
import { SIMULATED_STEP_TYPES, isSimulated as isSimulated2 } from "../lib/workflow-summary.js";
|
|
16
30
|
const TONES = {
|
|
31
|
+
idle: "neutral",
|
|
17
32
|
pending: "neutral",
|
|
33
|
+
queued: "neutral",
|
|
18
34
|
running: "info",
|
|
35
|
+
waiting: "warning",
|
|
19
36
|
done: "success",
|
|
20
37
|
rejected: "destructive",
|
|
21
38
|
failed: "destructive",
|
|
22
39
|
not_simulated: "neutral"
|
|
23
40
|
};
|
|
24
41
|
const LABELS = {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
42
|
+
idle: "",
|
|
43
|
+
pending: "Not reached",
|
|
44
|
+
queued: "Queued",
|
|
45
|
+
running: "Running",
|
|
46
|
+
waiting: "Waiting for you",
|
|
47
|
+
done: "Done",
|
|
48
|
+
rejected: "Rejected",
|
|
49
|
+
failed: "Failed",
|
|
50
|
+
not_simulated: "Not simulated"
|
|
51
|
+
};
|
|
52
|
+
const TYPE_ICON = {
|
|
53
|
+
fusion_tool: "wrench",
|
|
54
|
+
ai_step: "brain",
|
|
55
|
+
approval_gate: "hand"
|
|
31
56
|
};
|
|
57
|
+
function displayFor(step, index, context) {
|
|
58
|
+
if (!isSimulated(step)) return "not_simulated";
|
|
59
|
+
if (context.running) {
|
|
60
|
+
if (context.waitingGateIndex === -1) return "running";
|
|
61
|
+
if (index < context.waitingGateIndex) return "done";
|
|
62
|
+
return index === context.waitingGateIndex ? "waiting" : "queued";
|
|
63
|
+
}
|
|
64
|
+
if (!context.run) return "idle";
|
|
65
|
+
return context.run.steps.find((entry) => entry.id === step.id)?.status ?? "pending";
|
|
66
|
+
}
|
|
67
|
+
function OperationRef({
|
|
68
|
+
step,
|
|
69
|
+
integrations
|
|
70
|
+
}) {
|
|
71
|
+
if (!step.integration || !step.opKey) return null;
|
|
72
|
+
const op = splitOpKey(step.opKey);
|
|
73
|
+
const owner = integrations.find(
|
|
74
|
+
(entry) => entry.integration === step.integration
|
|
75
|
+
);
|
|
76
|
+
const base = owner ? integrationConsoleHref(owner) : null;
|
|
77
|
+
const name = op?.name ?? step.opKey;
|
|
78
|
+
const text = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
79
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: shortName(step.integration) }),
|
|
80
|
+
" ",
|
|
81
|
+
/* @__PURE__ */ jsx("code", { className: "text-foreground", children: name })
|
|
82
|
+
] });
|
|
83
|
+
return base && op ? /* @__PURE__ */ jsx(
|
|
84
|
+
Link,
|
|
85
|
+
{
|
|
86
|
+
href: `${base}/operations/${op.kind}/${op.name}`,
|
|
87
|
+
className: cn(
|
|
88
|
+
"rounded-sm text-xs underline-offset-2 hover:underline",
|
|
89
|
+
FOCUS_RING
|
|
90
|
+
),
|
|
91
|
+
title: `Open ${step.integration} ${step.opKey} in the operation runner`,
|
|
92
|
+
"data-test": "workflow-step-op",
|
|
93
|
+
children: text
|
|
94
|
+
}
|
|
95
|
+
) : /* @__PURE__ */ jsx("span", { className: "text-xs", title: `${step.integration} ${step.opKey}`, children: text });
|
|
96
|
+
}
|
|
97
|
+
function StepRow({
|
|
98
|
+
step,
|
|
99
|
+
index,
|
|
100
|
+
status,
|
|
101
|
+
detail,
|
|
102
|
+
output,
|
|
103
|
+
integrations,
|
|
104
|
+
effect,
|
|
105
|
+
compact
|
|
106
|
+
}) {
|
|
107
|
+
return /* @__PURE__ */ jsxs(
|
|
108
|
+
"li",
|
|
109
|
+
{
|
|
110
|
+
className: cn("relative flex min-w-0 gap-3", compact ? "py-1.5" : "py-3"),
|
|
111
|
+
"data-test": "workflow-step",
|
|
112
|
+
"data-step-id": step.id,
|
|
113
|
+
"data-status": status === "idle" ? "pending" : status,
|
|
114
|
+
children: [
|
|
115
|
+
/* @__PURE__ */ jsx(
|
|
116
|
+
"span",
|
|
117
|
+
{
|
|
118
|
+
className: cn(
|
|
119
|
+
"bg-background text-muted-foreground relative z-10 flex shrink-0 items-center justify-center rounded-full border text-xs tabular-nums",
|
|
120
|
+
compact ? "mt-0.5 size-6" : "size-8",
|
|
121
|
+
status === "done" && "border-success text-success",
|
|
122
|
+
status === "waiting" && "border-warning text-warning",
|
|
123
|
+
(status === "failed" || status === "rejected") && "border-destructive text-destructive"
|
|
124
|
+
),
|
|
125
|
+
"aria-hidden": "true",
|
|
126
|
+
children: status === "done" ? /* @__PURE__ */ jsx(Icon, { name: "check", className: "h-3.5 w-3.5" }) : index + 1
|
|
127
|
+
}
|
|
128
|
+
),
|
|
129
|
+
/* @__PURE__ */ jsxs(
|
|
130
|
+
"div",
|
|
131
|
+
{
|
|
132
|
+
className: cn(
|
|
133
|
+
"flex min-w-0 flex-1 flex-col justify-center gap-1",
|
|
134
|
+
compact ? "min-h-6" : "min-h-8"
|
|
135
|
+
),
|
|
136
|
+
children: [
|
|
137
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1", children: [
|
|
138
|
+
/* @__PURE__ */ jsxs("span", { className: "sr-only", children: [
|
|
139
|
+
"Step ",
|
|
140
|
+
index + 1,
|
|
141
|
+
":"
|
|
142
|
+
] }),
|
|
143
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: humanizeStepLabel(step.label) }),
|
|
144
|
+
compact ? null : /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground flex items-center gap-1 text-xs", children: [
|
|
145
|
+
/* @__PURE__ */ jsx(
|
|
146
|
+
Icon,
|
|
147
|
+
{
|
|
148
|
+
name: TYPE_ICON[step.type] ?? "circle",
|
|
149
|
+
className: "h-3.5 w-3.5"
|
|
150
|
+
}
|
|
151
|
+
),
|
|
152
|
+
stepTypeLabel(step.type),
|
|
153
|
+
effect ? ` \xB7 ${effect}` : null
|
|
154
|
+
] }),
|
|
155
|
+
compact ? null : /* @__PURE__ */ jsx(OperationRef, { step, integrations }),
|
|
156
|
+
LABELS[status] ? /* @__PURE__ */ jsx(StatusBadge, { tone: TONES[status], className: "ml-auto", children: LABELS[status] }) : null
|
|
157
|
+
] }),
|
|
158
|
+
detail && step.type === "approval_gate" && status === "done" ? /* @__PURE__ */ jsx(
|
|
159
|
+
ProposalText,
|
|
160
|
+
{
|
|
161
|
+
text: detail,
|
|
162
|
+
className: "text-muted-foreground text-xs"
|
|
163
|
+
}
|
|
164
|
+
) : detail ? /* @__PURE__ */ jsx(
|
|
165
|
+
"p",
|
|
166
|
+
{
|
|
167
|
+
className: cn(
|
|
168
|
+
"text-xs break-words whitespace-pre-line",
|
|
169
|
+
status === "failed" ? "text-destructive" : "text-muted-foreground"
|
|
170
|
+
),
|
|
171
|
+
role: status === "failed" ? "alert" : void 0,
|
|
172
|
+
children: detail.charAt(0).toUpperCase() + detail.slice(1)
|
|
173
|
+
}
|
|
174
|
+
) : null,
|
|
175
|
+
output !== void 0 ? /* @__PURE__ */ jsxs("details", { className: "group", children: [
|
|
176
|
+
/* @__PURE__ */ jsx(
|
|
177
|
+
"summary",
|
|
178
|
+
{
|
|
179
|
+
className: cn(
|
|
180
|
+
"text-muted-foreground hover:text-foreground w-fit cursor-pointer rounded-sm text-xs",
|
|
181
|
+
FOCUS_RING
|
|
182
|
+
),
|
|
183
|
+
children: "Output"
|
|
184
|
+
}
|
|
185
|
+
),
|
|
186
|
+
/* @__PURE__ */ jsx("pre", { className: "bg-muted mt-1 max-h-48 overflow-auto rounded-md p-2 text-xs", children: JSON.stringify(output, null, 2) })
|
|
187
|
+
] }) : null
|
|
188
|
+
]
|
|
189
|
+
}
|
|
190
|
+
)
|
|
191
|
+
]
|
|
192
|
+
}
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
function GroupBlock({
|
|
196
|
+
group,
|
|
197
|
+
statusOf,
|
|
198
|
+
run,
|
|
199
|
+
integrations,
|
|
200
|
+
effectOf
|
|
201
|
+
}) {
|
|
202
|
+
const [first] = group.steps;
|
|
203
|
+
if (!first) return null;
|
|
204
|
+
const effectFor = (step) => step.integration && step.opKey ? effectOf(step.integration, step.opKey) : void 0;
|
|
205
|
+
const rows = (compact) => group.steps.map(({ step, index }) => {
|
|
206
|
+
const state = run?.steps.find((entry) => entry.id === step.id);
|
|
207
|
+
const effect2 = effectFor(step);
|
|
208
|
+
return /* @__PURE__ */ jsx(
|
|
209
|
+
StepRow,
|
|
210
|
+
{
|
|
211
|
+
step,
|
|
212
|
+
index,
|
|
213
|
+
status: statusOf(step, index),
|
|
214
|
+
...state?.detail ? { detail: state.detail } : {},
|
|
215
|
+
...state?.output !== void 0 ? { output: state.output } : {},
|
|
216
|
+
integrations,
|
|
217
|
+
...effect2 ? { effect: effect2 } : {},
|
|
218
|
+
compact
|
|
219
|
+
},
|
|
220
|
+
step.id
|
|
221
|
+
);
|
|
222
|
+
});
|
|
223
|
+
if (group.steps.length === 1) return /* @__PURE__ */ jsx(Fragment, { children: rows(false) });
|
|
224
|
+
const effect = effectFor(first.step);
|
|
225
|
+
return /* @__PURE__ */ jsx("li", { className: "py-3", "data-test": "workflow-step-group", children: /* @__PURE__ */ jsxs(Card, { layout: "bleed", className: "flex flex-col px-3 py-2", children: [
|
|
226
|
+
/* @__PURE__ */ jsxs("p", { className: "text-muted-foreground flex flex-wrap items-center gap-1 pb-1 text-xs", children: [
|
|
227
|
+
/* @__PURE__ */ jsx(
|
|
228
|
+
Icon,
|
|
229
|
+
{
|
|
230
|
+
name: TYPE_ICON[first.step.type] ?? "circle",
|
|
231
|
+
className: "h-3.5 w-3.5"
|
|
232
|
+
}
|
|
233
|
+
),
|
|
234
|
+
group.steps.length,
|
|
235
|
+
" ",
|
|
236
|
+
stepTypeLabel(first.step.type).toLowerCase(),
|
|
237
|
+
"s",
|
|
238
|
+
effect ? ` (${effect}s)` : null,
|
|
239
|
+
" to the same operation:",
|
|
240
|
+
/* @__PURE__ */ jsx(OperationRef, { step: first.step, integrations })
|
|
241
|
+
] }),
|
|
242
|
+
/* @__PURE__ */ jsx("ol", { className: "flex flex-col", children: rows(true) })
|
|
243
|
+
] }) });
|
|
244
|
+
}
|
|
245
|
+
function WhatRunDoes({
|
|
246
|
+
template,
|
|
247
|
+
integrations
|
|
248
|
+
}) {
|
|
249
|
+
const links = useConsoleLinks();
|
|
250
|
+
const used = [
|
|
251
|
+
...new Set(
|
|
252
|
+
template.steps.flatMap(
|
|
253
|
+
(step) => step.integration ? [step.integration] : []
|
|
254
|
+
)
|
|
255
|
+
)
|
|
256
|
+
];
|
|
257
|
+
const live = used.filter(
|
|
258
|
+
(name) => integrations.find((entry) => entry.integration === name)?.runtime?.facts.answers === "live"
|
|
259
|
+
);
|
|
260
|
+
const fixtures = used.filter((name) => !live.includes(name));
|
|
261
|
+
const hasAi = template.steps.some((step) => step.type === "ai_step");
|
|
262
|
+
const hasGate = template.steps.some((step) => step.type === "approval_gate");
|
|
263
|
+
return /* @__PURE__ */ jsxs(
|
|
264
|
+
"div",
|
|
265
|
+
{
|
|
266
|
+
className: "bg-secondary text-muted-foreground flex flex-col gap-1.5 rounded-lg border px-4 py-3 text-sm",
|
|
267
|
+
"data-test": "workflow-run-explainer",
|
|
268
|
+
children: [
|
|
269
|
+
/* @__PURE__ */ jsx("p", { className: "text-foreground font-medium", children: "What Run now does" }),
|
|
270
|
+
/* @__PURE__ */ jsxs("ul", { className: "flex list-disc flex-col gap-1 pl-5", children: [
|
|
271
|
+
/* @__PURE__ */ jsx("li", { children: "Runs every step below here in the harness, in order." }),
|
|
272
|
+
fixtures.length > 0 ? /* @__PURE__ */ jsxs("li", { children: [
|
|
273
|
+
"Tool calls to ",
|
|
274
|
+
fixtures.map(shortName).join(", "),
|
|
275
|
+
" answer from fixtures, so nothing reaches",
|
|
276
|
+
" ",
|
|
277
|
+
fixtures.length === 1 ? "the real service" : "the real services",
|
|
278
|
+
"."
|
|
279
|
+
] }) : null,
|
|
280
|
+
live.length > 0 ? /* @__PURE__ */ jsxs("li", { children: [
|
|
281
|
+
live.map(shortName).join(", "),
|
|
282
|
+
" ",
|
|
283
|
+
live.length === 1 ? "is" : "are",
|
|
284
|
+
" ",
|
|
285
|
+
"connected: reads run live with your local credentials, and writes run live once you approve them."
|
|
286
|
+
] }) : null,
|
|
287
|
+
hasAi ? /* @__PURE__ */ jsxs("li", { children: [
|
|
288
|
+
"AI steps answer from ",
|
|
289
|
+
/* @__PURE__ */ jsx("code", { children: "fixtures/ai/" }),
|
|
290
|
+
", not a model."
|
|
291
|
+
] }) : null,
|
|
292
|
+
hasGate ? /* @__PURE__ */ jsxs("li", { children: [
|
|
293
|
+
"The run stops at each approval gate until you approve or reject it, here or in the",
|
|
294
|
+
" ",
|
|
295
|
+
/* @__PURE__ */ jsx(
|
|
296
|
+
Link,
|
|
297
|
+
{
|
|
298
|
+
href: `${links.experience}/review-queue`,
|
|
299
|
+
className: cn(
|
|
300
|
+
"text-foreground rounded-sm underline underline-offset-2",
|
|
301
|
+
FOCUS_RING
|
|
302
|
+
),
|
|
303
|
+
children: "Review queue"
|
|
304
|
+
}
|
|
305
|
+
),
|
|
306
|
+
"."
|
|
307
|
+
] }) : null
|
|
308
|
+
] })
|
|
309
|
+
]
|
|
310
|
+
}
|
|
311
|
+
);
|
|
312
|
+
}
|
|
313
|
+
const workflowRunKey = (id) => ["console", "workflow-run", id];
|
|
314
|
+
const RUN_GC_MS = 60 * 6e4;
|
|
315
|
+
function isRunState(value) {
|
|
316
|
+
return typeof value === "object" && value !== null && "steps" in value;
|
|
317
|
+
}
|
|
318
|
+
function useWorkflowRun(id) {
|
|
319
|
+
const client = useConsoleClient();
|
|
320
|
+
const queryClient = useQueryClient();
|
|
321
|
+
const start = useMutation({
|
|
322
|
+
mutationKey: workflowRunKey(id),
|
|
323
|
+
gcTime: RUN_GC_MS,
|
|
324
|
+
mutationFn: (templateId) => client.startWorkflow(templateId),
|
|
325
|
+
onSettled: () => Promise.all([
|
|
326
|
+
queryClient.invalidateQueries({ queryKey: consoleKeys.runs }),
|
|
327
|
+
queryClient.invalidateQueries({ queryKey: consoleKeys.approvals })
|
|
328
|
+
])
|
|
329
|
+
});
|
|
330
|
+
const latest = useMutationState({
|
|
331
|
+
filters: { mutationKey: workflowRunKey(id) },
|
|
332
|
+
select: (mutation) => ({
|
|
333
|
+
status: mutation.state.status,
|
|
334
|
+
data: mutation.state.data,
|
|
335
|
+
error: mutation.state.error?.message ?? null,
|
|
336
|
+
startedAt: mutation.state.submittedAt
|
|
337
|
+
})
|
|
338
|
+
}).at(-1);
|
|
339
|
+
return {
|
|
340
|
+
run: () => start.mutate(id),
|
|
341
|
+
running: latest?.status === "pending",
|
|
342
|
+
result: latest?.status === "success" && isRunState(latest.data) ? latest.data : void 0,
|
|
343
|
+
error: latest?.status === "error" ? latest.error : null,
|
|
344
|
+
startedAt: latest?.startedAt ?? 0
|
|
345
|
+
};
|
|
346
|
+
}
|
|
32
347
|
function WorkflowRunner({
|
|
33
|
-
template
|
|
348
|
+
template,
|
|
349
|
+
effectOf = () => void 0
|
|
34
350
|
}) {
|
|
35
|
-
const
|
|
351
|
+
const links = useConsoleLinks();
|
|
352
|
+
const current = useWorkflowRun(template.id);
|
|
36
353
|
const approvals = useApprovals();
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
|
|
354
|
+
const project = useProject();
|
|
355
|
+
const integrations = project.data?.integrations ?? [];
|
|
356
|
+
const run = current.running ? void 0 : current.result;
|
|
357
|
+
const mine = current.running ? (approvals.data ?? []).filter(
|
|
358
|
+
(approval) => approval.integration === template.id || approval.channel === "workflow"
|
|
359
|
+
) : [];
|
|
360
|
+
const waitingGate = mine.map(
|
|
361
|
+
(approval) => approval.integration === template.id ? gateStepId(approval.opKey) : null
|
|
362
|
+
).find((id) => id !== null);
|
|
363
|
+
const waitingGateIndex = waitingGate ? template.steps.findIndex((step) => step.id === waitingGate) : -1;
|
|
364
|
+
const context = { running: current.running, run, waitingGateIndex };
|
|
365
|
+
const statusOf = (step, index) => displayFor(step, index, context);
|
|
366
|
+
const counts = run ? {
|
|
367
|
+
done: run.steps.filter((step) => step.status === "done").length,
|
|
368
|
+
total: template.steps.filter(isSimulated).length
|
|
369
|
+
} : null;
|
|
370
|
+
const ended = Boolean(run) || current.error !== null;
|
|
371
|
+
const stopped = run?.steps.find(
|
|
372
|
+
(step) => step.status === "failed" || step.status === "rejected"
|
|
373
|
+
);
|
|
374
|
+
const stoppedStep = stopped ? template.steps.find((step) => step.id === stopped.id) : void 0;
|
|
375
|
+
const stoppedAt = stopped && stoppedStep ? {
|
|
376
|
+
status: stopped.status,
|
|
377
|
+
label: humanizeStepLabel(stoppedStep.label)
|
|
378
|
+
} : void 0;
|
|
379
|
+
return /* @__PURE__ */ jsxs("section", { className: "flex flex-col gap-5", "data-test": "workflow-runner", children: [
|
|
380
|
+
/* @__PURE__ */ jsx(WhatRunDoes, { template, integrations }),
|
|
40
381
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
41
|
-
/* @__PURE__ */
|
|
382
|
+
/* @__PURE__ */ jsxs(
|
|
42
383
|
Button,
|
|
43
384
|
{
|
|
44
385
|
type: "button",
|
|
45
|
-
disabled:
|
|
386
|
+
disabled: current.running,
|
|
46
387
|
"data-test": "workflow-run",
|
|
47
|
-
onClick:
|
|
48
|
-
children:
|
|
388
|
+
onClick: current.run,
|
|
389
|
+
children: [
|
|
390
|
+
/* @__PURE__ */ jsx(Icon, { name: ended ? "arrow-clockwise" : "play", className: "h-4 w-4" }),
|
|
391
|
+
current.running ? "Running\u2026" : ended ? "Run again" : "Run now"
|
|
392
|
+
]
|
|
49
393
|
}
|
|
50
394
|
),
|
|
51
|
-
run?.completed ? /* @__PURE__ */
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
"
|
|
55
|
-
|
|
56
|
-
"
|
|
57
|
-
] }) :
|
|
58
|
-
|
|
59
|
-
start.isError ? /* @__PURE__ */ jsx(Alert, { variant: "destructive", children: /* @__PURE__ */ jsx(AlertDescription, { children: start.error.message }) }) : null,
|
|
60
|
-
/* @__PURE__ */ jsx("ol", { className: "flex flex-col gap-3", children: template.steps.map((step, index) => {
|
|
61
|
-
const state = start.isPending ? void 0 : run?.steps.find((entry) => entry.id === step.id);
|
|
62
|
-
const status = !isSimulated(step) ? "not_simulated" : start.isPending ? "running" : state?.status ?? "pending";
|
|
63
|
-
return /* @__PURE__ */ jsxs(
|
|
64
|
-
Card,
|
|
395
|
+
run?.completed ? /* @__PURE__ */ jsxs(StatusBadge, { tone: "success", "data-test": "workflow-result", children: [
|
|
396
|
+
"Run finished \xB7 ",
|
|
397
|
+
counts?.done,
|
|
398
|
+
" of ",
|
|
399
|
+
counts?.total,
|
|
400
|
+
" steps done"
|
|
401
|
+
] }) : run ? /* @__PURE__ */ jsxs(
|
|
402
|
+
StatusBadge,
|
|
65
403
|
{
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
className: "flex flex-col gap-2 p-4",
|
|
69
|
-
"data-test": "workflow-step",
|
|
70
|
-
"data-step-id": step.id,
|
|
71
|
-
"data-status": status,
|
|
404
|
+
tone: stoppedAt?.status === "failed" ? "destructive" : "warning",
|
|
405
|
+
"data-test": "workflow-result",
|
|
72
406
|
children: [
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
407
|
+
stoppedAt ? `Run ${stoppedAt.status === "failed" ? "failed" : "stopped"} at ${stoppedAt.label}` : "Run stopped",
|
|
408
|
+
" ",
|
|
409
|
+
"\xB7 ",
|
|
410
|
+
counts?.done,
|
|
411
|
+
" of ",
|
|
412
|
+
counts?.total,
|
|
413
|
+
" steps done"
|
|
414
|
+
]
|
|
415
|
+
}
|
|
416
|
+
) : null,
|
|
417
|
+
current.running && mine.length === 0 ? /* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-sm", role: "status", children: "Running the steps\u2026" }) : null,
|
|
418
|
+
ended ? /* @__PURE__ */ jsxs(
|
|
419
|
+
Link,
|
|
420
|
+
{
|
|
421
|
+
href: `${links.experience}/runs`,
|
|
422
|
+
className: cn(
|
|
423
|
+
"text-muted-foreground hover:text-foreground ml-auto flex items-center gap-1.5 rounded-sm text-sm underline-offset-2 hover:underline",
|
|
424
|
+
FOCUS_RING
|
|
425
|
+
),
|
|
426
|
+
title: "Every operation this run made is in the run log, on the workflow channel",
|
|
427
|
+
"data-test": "workflow-run-log",
|
|
428
|
+
children: [
|
|
429
|
+
/* @__PURE__ */ jsx(Icon, { name: "clock-counter-clockwise", className: "h-4 w-4" }),
|
|
430
|
+
"See its calls in the run log"
|
|
93
431
|
]
|
|
432
|
+
}
|
|
433
|
+
) : null
|
|
434
|
+
] }),
|
|
435
|
+
current.error !== null ? /* @__PURE__ */ jsx(Alert, { variant: "destructive", "data-test": "workflow-run-error", children: /* @__PURE__ */ jsxs(AlertDescription, { children: [
|
|
436
|
+
"The run could not finish: ",
|
|
437
|
+
current.error,
|
|
438
|
+
". Check the terminal running ",
|
|
439
|
+
/* @__PURE__ */ jsx("code", { children: "ekanos dev" }),
|
|
440
|
+
", then run it again."
|
|
441
|
+
] }) }) : null,
|
|
442
|
+
current.startedAt > 0 ? /* @__PURE__ */ jsx(DecisionLog, { workflowId: template.id, since: current.startedAt }) : null,
|
|
443
|
+
mine.length > 0 ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", "data-test": "workflow-waiting", children: [
|
|
444
|
+
/* @__PURE__ */ jsxs("p", { className: "text-sm font-medium", role: "status", children: [
|
|
445
|
+
mine.length,
|
|
446
|
+
" approval",
|
|
447
|
+
mine.length === 1 ? "" : "s",
|
|
448
|
+
" waiting for you. The run continues once you decide."
|
|
449
|
+
] }),
|
|
450
|
+
/* @__PURE__ */ jsx(
|
|
451
|
+
ApprovalList,
|
|
452
|
+
{
|
|
453
|
+
approvals: mine,
|
|
454
|
+
workflowTitles: { [template.id]: template.title },
|
|
455
|
+
workflowId: template.id
|
|
456
|
+
}
|
|
457
|
+
)
|
|
458
|
+
] }) : null,
|
|
459
|
+
/* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
460
|
+
/* @__PURE__ */ jsx(
|
|
461
|
+
"span",
|
|
462
|
+
{
|
|
463
|
+
"aria-hidden": "true",
|
|
464
|
+
className: "bg-border absolute top-4 bottom-4 left-4 w-px"
|
|
465
|
+
}
|
|
466
|
+
),
|
|
467
|
+
/* @__PURE__ */ jsx("ol", { className: "relative flex flex-col", "aria-label": "Steps", children: groupSteps(template.steps).map((group) => /* @__PURE__ */ jsx(
|
|
468
|
+
GroupBlock,
|
|
469
|
+
{
|
|
470
|
+
group,
|
|
471
|
+
statusOf,
|
|
472
|
+
run,
|
|
473
|
+
integrations,
|
|
474
|
+
effectOf
|
|
94
475
|
},
|
|
95
|
-
step.id
|
|
96
|
-
)
|
|
97
|
-
|
|
476
|
+
group.steps[0]?.step.id
|
|
477
|
+
)) })
|
|
478
|
+
] })
|
|
98
479
|
] });
|
|
99
480
|
}
|
|
100
481
|
export {
|
|
101
482
|
SIMULATED_STEP_TYPES,
|
|
102
483
|
WorkflowRunner,
|
|
103
|
-
isSimulated
|
|
484
|
+
isSimulated2 as isSimulated,
|
|
485
|
+
useWorkflowRun
|
|
104
486
|
};
|