@corbits/react-ui 0.1.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/LICENSE +501 -0
- package/README.md +125 -0
- package/dist/blocks/login/auth-layout.d.ts +38 -0
- package/dist/blocks/login/auth-layout.js +52 -0
- package/dist/blocks/login/login-form.d.ts +60 -0
- package/dist/blocks/login/login-form.js +151 -0
- package/dist/hooks/use-command-palette-navigation.d.ts +25 -0
- package/dist/hooks/use-command-palette-navigation.js +52 -0
- package/dist/hooks/use-controllable-state.d.ts +28 -0
- package/dist/hooks/use-controllable-state.js +44 -0
- package/dist/hooks/use-delayed-autofocus.d.ts +9 -0
- package/dist/hooks/use-delayed-autofocus.js +20 -0
- package/dist/hooks/use-dismissable-popover.d.ts +37 -0
- package/dist/hooks/use-dismissable-popover.js +64 -0
- package/dist/hooks/use-list-selection.d.ts +66 -0
- package/dist/hooks/use-list-selection.js +147 -0
- package/dist/hooks/use-prefers-reduced-motion.d.ts +13 -0
- package/dist/hooks/use-prefers-reduced-motion.js +28 -0
- package/dist/hooks/use-scroll-current-into-view.d.ts +19 -0
- package/dist/hooks/use-scroll-current-into-view.js +33 -0
- package/dist/index.d.ts +122 -0
- package/dist/index.js +131 -0
- package/dist/lib/artifact.d.ts +72 -0
- package/dist/lib/artifact.js +67 -0
- package/dist/lib/chart-geometry.d.ts +62 -0
- package/dist/lib/chart-geometry.js +86 -0
- package/dist/lib/chart-palette.d.ts +76 -0
- package/dist/lib/chart-palette.js +92 -0
- package/dist/lib/chat-message.d.ts +115 -0
- package/dist/lib/chat-message.js +41 -0
- package/dist/lib/chat-parts.d.ts +64 -0
- package/dist/lib/chat-parts.js +16 -0
- package/dist/lib/csv.d.ts +60 -0
- package/dist/lib/csv.js +108 -0
- package/dist/lib/metrics.d.ts +70 -0
- package/dist/lib/metrics.js +101 -0
- package/dist/lib/now-item.d.ts +65 -0
- package/dist/lib/now-item.js +59 -0
- package/dist/lib/relative-time.d.ts +9 -0
- package/dist/lib/relative-time.js +47 -0
- package/dist/lib/theme.d.ts +30 -0
- package/dist/lib/theme.js +77 -0
- package/dist/lib/url.d.ts +26 -0
- package/dist/lib/url.js +37 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/lib/utils.js +5 -0
- package/dist/lib/workflow-display-flow.d.ts +83 -0
- package/dist/lib/workflow-display-flow.js +104 -0
- package/dist/lib/workflow-registry.d.ts +90 -0
- package/dist/lib/workflow-registry.js +56 -0
- package/dist/lib/workflow-run-error.d.ts +31 -0
- package/dist/lib/workflow-run-error.js +105 -0
- package/dist/lib/workflow-run-progress.d.ts +97 -0
- package/dist/lib/workflow-run-progress.js +135 -0
- package/dist/lib/workflow-run.d.ts +43 -0
- package/dist/lib/workflow-run.js +56 -0
- package/dist/styles.css +3080 -0
- package/dist/test/render-hook.d.ts +14 -0
- package/dist/test/render-hook.js +38 -0
- package/dist/theme.css +628 -0
- package/dist/ui/agent-turn.d.ts +26 -0
- package/dist/ui/agent-turn.js +60 -0
- package/dist/ui/animated-number.d.ts +25 -0
- package/dist/ui/animated-number.js +63 -0
- package/dist/ui/approval-card.d.ts +46 -0
- package/dist/ui/approval-card.js +116 -0
- package/dist/ui/artifact-body.d.ts +26 -0
- package/dist/ui/artifact-body.js +170 -0
- package/dist/ui/artifact-notice.d.ts +21 -0
- package/dist/ui/artifact-notice.js +36 -0
- package/dist/ui/avatar.d.ts +37 -0
- package/dist/ui/avatar.js +73 -0
- package/dist/ui/badge.d.ts +10 -0
- package/dist/ui/badge.js +35 -0
- package/dist/ui/bar-chart.d.ts +38 -0
- package/dist/ui/bar-chart.js +118 -0
- package/dist/ui/block-card.d.ts +29 -0
- package/dist/ui/block-card.js +66 -0
- package/dist/ui/boot-screen.d.ts +23 -0
- package/dist/ui/boot-screen.js +49 -0
- package/dist/ui/bulk-action-bar.d.ts +37 -0
- package/dist/ui/bulk-action-bar.js +64 -0
- package/dist/ui/button.d.ts +12 -0
- package/dist/ui/button.js +73 -0
- package/dist/ui/card.d.ts +6 -0
- package/dist/ui/card.js +37 -0
- package/dist/ui/category-bars.d.ts +20 -0
- package/dist/ui/category-bars.js +69 -0
- package/dist/ui/chart-frame.d.ts +54 -0
- package/dist/ui/chart-frame.js +108 -0
- package/dist/ui/chat-composer.d.ts +24 -0
- package/dist/ui/chat-composer.js +32 -0
- package/dist/ui/chat-dock-timing.d.ts +15 -0
- package/dist/ui/chat-dock-timing.js +11 -0
- package/dist/ui/chat-input.d.ts +38 -0
- package/dist/ui/chat-input.js +138 -0
- package/dist/ui/chat-panel.d.ts +20 -0
- package/dist/ui/chat-panel.js +56 -0
- package/dist/ui/chat-thread.d.ts +28 -0
- package/dist/ui/chat-thread.js +61 -0
- package/dist/ui/checkbox.d.ts +25 -0
- package/dist/ui/checkbox.js +63 -0
- package/dist/ui/command-palette.d.ts +100 -0
- package/dist/ui/command-palette.js +341 -0
- package/dist/ui/compare-body.d.ts +52 -0
- package/dist/ui/compare-body.js +140 -0
- package/dist/ui/confirm-button.d.ts +29 -0
- package/dist/ui/confirm-button.js +41 -0
- package/dist/ui/corbits-mark.d.ts +29 -0
- package/dist/ui/corbits-mark.js +33 -0
- package/dist/ui/csv-table.d.ts +22 -0
- package/dist/ui/csv-table.js +85 -0
- package/dist/ui/dialog.d.ts +37 -0
- package/dist/ui/dialog.js +105 -0
- package/dist/ui/dictation-status-line.d.ts +20 -0
- package/dist/ui/dictation-status-line.js +38 -0
- package/dist/ui/dither-canvas.d.ts +31 -0
- package/dist/ui/dither-canvas.js +169 -0
- package/dist/ui/embed-body.d.ts +30 -0
- package/dist/ui/embed-body.js +92 -0
- package/dist/ui/empty-state.d.ts +26 -0
- package/dist/ui/empty-state.js +42 -0
- package/dist/ui/file-input.d.ts +25 -0
- package/dist/ui/file-input.js +66 -0
- package/dist/ui/filter-bar.d.ts +42 -0
- package/dist/ui/filter-bar.js +95 -0
- package/dist/ui/filter-chip.d.ts +14 -0
- package/dist/ui/filter-chip.js +23 -0
- package/dist/ui/gate-block.d.ts +16 -0
- package/dist/ui/gate-block.js +37 -0
- package/dist/ui/horizontal-stepper.d.ts +13 -0
- package/dist/ui/horizontal-stepper.js +65 -0
- package/dist/ui/input.d.ts +2 -0
- package/dist/ui/input.js +14 -0
- package/dist/ui/inspector-shell.d.ts +47 -0
- package/dist/ui/inspector-shell.js +98 -0
- package/dist/ui/intake-form.d.ts +39 -0
- package/dist/ui/intake-form.js +119 -0
- package/dist/ui/kind-card-grid.d.ts +23 -0
- package/dist/ui/kind-card-grid.js +43 -0
- package/dist/ui/library-page-header.d.ts +20 -0
- package/dist/ui/library-page-header.js +43 -0
- package/dist/ui/list-detail.d.ts +28 -0
- package/dist/ui/list-detail.js +55 -0
- package/dist/ui/live-run-banner.d.ts +13 -0
- package/dist/ui/live-run-banner.js +23 -0
- package/dist/ui/live-status-line.d.ts +22 -0
- package/dist/ui/live-status-line.js +37 -0
- package/dist/ui/menu.d.ts +18 -0
- package/dist/ui/menu.js +45 -0
- package/dist/ui/message-bubble.d.ts +24 -0
- package/dist/ui/message-bubble.js +64 -0
- package/dist/ui/mic-button.d.ts +35 -0
- package/dist/ui/mic-button.js +61 -0
- package/dist/ui/mic-permission-dialog.d.ts +20 -0
- package/dist/ui/mic-permission-dialog.js +50 -0
- package/dist/ui/notifications-bell.d.ts +28 -0
- package/dist/ui/notifications-bell.js +69 -0
- package/dist/ui/now-cards.d.ts +37 -0
- package/dist/ui/now-cards.js +116 -0
- package/dist/ui/page-panel.d.ts +37 -0
- package/dist/ui/page-panel.js +23 -0
- package/dist/ui/page-shell.d.ts +21 -0
- package/dist/ui/page-shell.js +26 -0
- package/dist/ui/parts-renderer.d.ts +22 -0
- package/dist/ui/parts-renderer.js +234 -0
- package/dist/ui/profile-card.d.ts +39 -0
- package/dist/ui/profile-card.js +124 -0
- package/dist/ui/progress-checklist.d.ts +25 -0
- package/dist/ui/progress-checklist.js +70 -0
- package/dist/ui/provider-mark.d.ts +32 -0
- package/dist/ui/provider-mark.js +31 -0
- package/dist/ui/quick-reply-chips.d.ts +14 -0
- package/dist/ui/quick-reply-chips.js +24 -0
- package/dist/ui/quote-card.d.ts +39 -0
- package/dist/ui/quote-card.js +66 -0
- package/dist/ui/reasoning-block.d.ts +35 -0
- package/dist/ui/reasoning-block.js +60 -0
- package/dist/ui/research-body.d.ts +70 -0
- package/dist/ui/research-body.js +270 -0
- package/dist/ui/rich-empty-state.d.ts +35 -0
- package/dist/ui/rich-empty-state.js +65 -0
- package/dist/ui/run-now-button.d.ts +23 -0
- package/dist/ui/run-now-button.js +42 -0
- package/dist/ui/section.d.ts +20 -0
- package/dist/ui/section.js +48 -0
- package/dist/ui/select.d.ts +2 -0
- package/dist/ui/select.js +22 -0
- package/dist/ui/selection-checkbox.d.ts +42 -0
- package/dist/ui/selection-checkbox.js +54 -0
- package/dist/ui/settings-panel.d.ts +35 -0
- package/dist/ui/settings-panel.js +68 -0
- package/dist/ui/shimmer-text.d.ts +19 -0
- package/dist/ui/shimmer-text.js +20 -0
- package/dist/ui/sidebar-item-row.d.ts +40 -0
- package/dist/ui/sidebar-item-row.js +64 -0
- package/dist/ui/sidebar-panel.d.ts +25 -0
- package/dist/ui/sidebar-panel.js +56 -0
- package/dist/ui/sidebar.d.ts +46 -0
- package/dist/ui/sidebar.js +111 -0
- package/dist/ui/skeleton.d.ts +13 -0
- package/dist/ui/skeleton.js +20 -0
- package/dist/ui/sortable-table.d.ts +43 -0
- package/dist/ui/sortable-table.js +103 -0
- package/dist/ui/sparkline.d.ts +27 -0
- package/dist/ui/sparkline.js +68 -0
- package/dist/ui/stat-grid.d.ts +55 -0
- package/dist/ui/stat-grid.js +87 -0
- package/dist/ui/status-dot.d.ts +13 -0
- package/dist/ui/status-dot.js +51 -0
- package/dist/ui/step-list.d.ts +21 -0
- package/dist/ui/step-list.js +77 -0
- package/dist/ui/switch.d.ts +23 -0
- package/dist/ui/switch.js +29 -0
- package/dist/ui/table.d.ts +8 -0
- package/dist/ui/table.js +48 -0
- package/dist/ui/tabs.d.ts +44 -0
- package/dist/ui/tabs.js +101 -0
- package/dist/ui/textarea.d.ts +8 -0
- package/dist/ui/textarea.js +32 -0
- package/dist/ui/theme-provider.d.ts +36 -0
- package/dist/ui/theme-provider.js +126 -0
- package/dist/ui/theme-toggle.d.ts +11 -0
- package/dist/ui/theme-toggle.js +32 -0
- package/dist/ui/thinking-indicator.d.ts +7 -0
- package/dist/ui/thinking-indicator.js +19 -0
- package/dist/ui/thinking-label.d.ts +19 -0
- package/dist/ui/thinking-label.js +54 -0
- package/dist/ui/thinking-mark.d.ts +10 -0
- package/dist/ui/thinking-mark.js +153 -0
- package/dist/ui/time-series-chart.d.ts +55 -0
- package/dist/ui/time-series-chart.js +249 -0
- package/dist/ui/toast.d.ts +16 -0
- package/dist/ui/toast.js +41 -0
- package/dist/ui/token-mosaic.d.ts +22 -0
- package/dist/ui/token-mosaic.js +65 -0
- package/dist/ui/tool-block.d.ts +54 -0
- package/dist/ui/tool-block.js +170 -0
- package/dist/ui/tool-narrative.d.ts +22 -0
- package/dist/ui/tool-narrative.js +77 -0
- package/dist/ui/tool-picker.d.ts +44 -0
- package/dist/ui/tool-picker.js +200 -0
- package/dist/ui/tooltip.d.ts +21 -0
- package/dist/ui/tooltip.js +48 -0
- package/dist/ui/top-bar.d.ts +53 -0
- package/dist/ui/top-bar.js +98 -0
- package/dist/ui/trace-waterfall.d.ts +38 -0
- package/dist/ui/trace-waterfall.js +121 -0
- package/dist/ui/typing-indicator.d.ts +9 -0
- package/dist/ui/typing-indicator.js +25 -0
- package/dist/ui/view-toggle.d.ts +17 -0
- package/dist/ui/view-toggle.js +46 -0
- package/dist/ui/voice-waveform.d.ts +16 -0
- package/dist/ui/voice-waveform.js +23 -0
- package/package.json +583 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { classifyRunError } from "./workflow-run-error.js";
|
|
2
|
+
/** Label colour for a step's status, shared by every stepper/sidebar rendering. */ export function workflowStepLabelClass(status) {
|
|
3
|
+
if (status === "current") return "text-foreground";
|
|
4
|
+
if (status === "failed") return "text-destructive";
|
|
5
|
+
return "text-muted-foreground";
|
|
6
|
+
}
|
|
7
|
+
/** Mark glyph for a step's status: a checkmark, an exclamation, or its number. */ export function workflowStepGlyph(status, number) {
|
|
8
|
+
if (status === "completed") return "✓";
|
|
9
|
+
if (status === "failed") return "!";
|
|
10
|
+
return String(number);
|
|
11
|
+
}
|
|
12
|
+
export function getStepPhase(progress, stepId) {
|
|
13
|
+
return progress?.steps.get(stepId)?.phase;
|
|
14
|
+
}
|
|
15
|
+
export function isStepRunning(phase) {
|
|
16
|
+
return phase === "in-flight" || phase === "awaiting-signal" || phase === "awaiting-timer";
|
|
17
|
+
}
|
|
18
|
+
/** The aggregate phase of a display step from its runtime steps. */ export function displayStepPhase(progress, stepIds) {
|
|
19
|
+
if (stepIds.length === 0) return undefined;
|
|
20
|
+
const terminal = stepIds[stepIds.length - 1];
|
|
21
|
+
if (terminal !== undefined && getStepPhase(progress, terminal) === "completed") return "completed";
|
|
22
|
+
for (const id of stepIds){
|
|
23
|
+
const phase = getStepPhase(progress, id);
|
|
24
|
+
if (isStepRunning(phase)) return phase;
|
|
25
|
+
}
|
|
26
|
+
for (const id of stepIds){
|
|
27
|
+
if (getStepPhase(progress, id) === "failed") return "failed";
|
|
28
|
+
}
|
|
29
|
+
for (const id of stepIds){
|
|
30
|
+
if (getStepPhase(progress, id) !== undefined) return "in-flight";
|
|
31
|
+
}
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
function hasAnyProgress(progress, step) {
|
|
35
|
+
return step.stepIds.some((id)=>getStepPhase(progress, id) !== undefined);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Index of the display step the run is currently on. A step whose own phase
|
|
39
|
+
* is `failed` is never treated as passed even when a later, independently
|
|
40
|
+
* running branch has progressed — independent steps can run concurrently, so
|
|
41
|
+
* a later step's progress says nothing about whether this one failed.
|
|
42
|
+
* Returns the last index once every step is complete.
|
|
43
|
+
*/ export function activeDisplayStepIndex(progress, steps) {
|
|
44
|
+
for(let i = 0; i < steps.length; i++){
|
|
45
|
+
const step = steps[i];
|
|
46
|
+
if (step === undefined) continue;
|
|
47
|
+
const phase = displayStepPhase(progress, step.stepIds);
|
|
48
|
+
if (phase === "completed") continue;
|
|
49
|
+
if (phase === "failed") return i;
|
|
50
|
+
const laterProgressed = steps.slice(i + 1).some((later)=>hasAnyProgress(progress, later));
|
|
51
|
+
if (laterProgressed) continue;
|
|
52
|
+
return i;
|
|
53
|
+
}
|
|
54
|
+
return Math.max(0, steps.length - 1);
|
|
55
|
+
}
|
|
56
|
+
export function buildStepperSteps(progress, steps) {
|
|
57
|
+
const activeIdx = activeDisplayStepIndex(progress, steps);
|
|
58
|
+
// A completed run marks every entry done: the final step's output can lag
|
|
59
|
+
// behind the run's own terminal phase, and without this it would linger
|
|
60
|
+
// as "current" on an already-finished run.
|
|
61
|
+
const runCompleted = progress?.phase === "completed";
|
|
62
|
+
return steps.map((step, i)=>{
|
|
63
|
+
let status;
|
|
64
|
+
if (runCompleted || i < activeIdx) {
|
|
65
|
+
status = "completed";
|
|
66
|
+
} else if (i > activeIdx) {
|
|
67
|
+
status = "pending";
|
|
68
|
+
} else {
|
|
69
|
+
const phase = displayStepPhase(progress, step.stepIds);
|
|
70
|
+
status = phase === "completed" ? "completed" : phase === "failed" ? "failed" : "current";
|
|
71
|
+
}
|
|
72
|
+
return {
|
|
73
|
+
number: i + 1,
|
|
74
|
+
label: step.label,
|
|
75
|
+
status
|
|
76
|
+
};
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
/** The active display step, or `null` while the run is terminal. */ export function activeDisplayStep(progress, steps) {
|
|
80
|
+
if (steps.length === 0) return null;
|
|
81
|
+
return steps[activeDisplayStepIndex(progress, steps)] ?? null;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* The "what's happening now" verb for a live status line, taken from the
|
|
85
|
+
* active step's `activityLabel`. Returns `null` — showing no line — once the
|
|
86
|
+
* run is terminal, while the first step owns its own loading UI, once the
|
|
87
|
+
* active group is done or parked on a human gate, or when the active step
|
|
88
|
+
* carries no `activityLabel` at all (a gate or intake step): silence there is
|
|
89
|
+
* correct, never a stepper noun standing in for it.
|
|
90
|
+
*/ export function liveStatusLabel(progress, steps) {
|
|
91
|
+
if (progress === null) return null;
|
|
92
|
+
if (progress.phase === "failed" || progress.phase === "completed") return null;
|
|
93
|
+
const idx = activeDisplayStepIndex(progress, steps);
|
|
94
|
+
if (idx === 0) return null;
|
|
95
|
+
const step = steps[idx];
|
|
96
|
+
if (step === undefined) return null;
|
|
97
|
+
const phase = displayStepPhase(progress, step.stepIds);
|
|
98
|
+
if (phase === "completed" || phase === "awaiting-signal") return null;
|
|
99
|
+
return step.activityLabel ?? null;
|
|
100
|
+
}
|
|
101
|
+
/** Label of the first display step whose aggregate phase is `failed`. Does
|
|
102
|
+
* not require `progress.phase === "failed"` — a caller flagging failure from
|
|
103
|
+
* a single failed step ahead of the run's own phase flip still gets a name. */ export function failedDisplayStepLabel(progress, steps) {
|
|
104
|
+
if (progress === null) return null;
|
|
105
|
+
for (const step of steps){
|
|
106
|
+
if (displayStepPhase(progress, step.stepIds) === "failed") return step.label;
|
|
107
|
+
}
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
/** The sanitized end-user message from whichever step failed the run, or
|
|
111
|
+
* `null` if the run has not failed or no step carries an error. Uses the
|
|
112
|
+
* first error found in map-iteration order — a run design that attaches an
|
|
113
|
+
* error to more than one step at once is a design this cannot disambiguate. */ export function failedRunErrorMessage(progress) {
|
|
114
|
+
if (progress?.phase !== "failed") return null;
|
|
115
|
+
for (const step of progress.steps.values()){
|
|
116
|
+
if (step.lastErrorMessage !== undefined) return classifyRunError(step.lastErrorMessage).userMessage;
|
|
117
|
+
}
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* True only for a genuine never-started run: a non-null progress with an
|
|
122
|
+
* empty step map, where that emptiness came from an event log that was
|
|
123
|
+
* actually read. `logRead` distinguishes that from a log-unavailable fallback
|
|
124
|
+
* (a legacy run, or a read error) that can synthesize the same empty-step
|
|
125
|
+
* shape regardless of phase — in that case whether it started is unknown, so
|
|
126
|
+
* this returns `false` rather than making a false "never started" claim.
|
|
127
|
+
*/ export function runNeverStarted(progress, logRead) {
|
|
128
|
+
return progress !== null && logRead && progress.steps.size === 0;
|
|
129
|
+
}
|
|
130
|
+
/** Honest copy for the pre-interactive window before a run's first step has
|
|
131
|
+
* recorded any activity: queued (`pending`, or no progress yet) reads
|
|
132
|
+
* differently from a runtime already booting that first step. */ export function runStartLabel(progress) {
|
|
133
|
+
if (progress === null || progress.phase === "pending") return "Starting your workflow…";
|
|
134
|
+
return "Preparing your workflow…";
|
|
135
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { BadgeTone } from "../ui/badge.js";
|
|
2
|
+
import type { StatusDotTone } from "../ui/status-dot.js";
|
|
3
|
+
/**
|
|
4
|
+
* What a caller needs to know about a run without knowing what the run *did*.
|
|
5
|
+
*
|
|
6
|
+
* Status, identity and timing only. What a run produced — its blocks, its
|
|
7
|
+
* output, its event log — is a separate contract and deliberately not modelled
|
|
8
|
+
* here: a strip that lists runs should not have to understand their contents,
|
|
9
|
+
* and a surface that renders contents can take this alongside them.
|
|
10
|
+
*/
|
|
11
|
+
export type RunStatus =
|
|
12
|
+
/** Accepted, not yet executing. */
|
|
13
|
+
"provisioning" | "running"
|
|
14
|
+
/** Parked on a human decision. The only status that is *asking* for something. */
|
|
15
|
+
| "awaiting" | "completed" | "failed" | "stopped";
|
|
16
|
+
export type WorkflowRunSummary = {
|
|
17
|
+
readonly runId: string;
|
|
18
|
+
/** Human title for the run's kind, e.g. "Daily brief". Already humanised. */
|
|
19
|
+
readonly title: string;
|
|
20
|
+
readonly status: RunStatus;
|
|
21
|
+
/** ISO timestamp of when the run started. */
|
|
22
|
+
readonly startedAt: string;
|
|
23
|
+
/** Where the run opens. */
|
|
24
|
+
readonly href?: string;
|
|
25
|
+
};
|
|
26
|
+
export declare const RUN_STATUS_LABEL: Record<RunStatus, string>;
|
|
27
|
+
/**
|
|
28
|
+
* State is the only colour on these surfaces. `awaiting` is the one orange:
|
|
29
|
+
* it is the single status a person can act on, and orange is the registry's
|
|
30
|
+
* "this is for you" tone.
|
|
31
|
+
*/
|
|
32
|
+
export declare const RUN_STATUS_TONE: Record<RunStatus, BadgeTone>;
|
|
33
|
+
/**
|
|
34
|
+
* The dot only marks liveness and failure — the badge above carries the full
|
|
35
|
+
* status colour. See `status-dot.tsx` for why it is three tones and not six.
|
|
36
|
+
*/
|
|
37
|
+
export declare const RUN_STATUS_DOT_TONE: Record<RunStatus, StatusDotTone>;
|
|
38
|
+
/** A run that will not change again without someone starting a new one. */
|
|
39
|
+
export declare function isTerminalRun(status: RunStatus): boolean;
|
|
40
|
+
/** Still moving or still asking — what an "active runs" strip shows. */
|
|
41
|
+
export declare function isActiveRun(status: RunStatus): boolean;
|
|
42
|
+
/** Attention order, newest first within a band. Sorts a copy. */
|
|
43
|
+
export declare function sortRunsByAttention(runs: readonly WorkflowRunSummary[]): readonly WorkflowRunSummary[];
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export const RUN_STATUS_LABEL = {
|
|
2
|
+
provisioning: "Starting",
|
|
3
|
+
running: "Running",
|
|
4
|
+
awaiting: "Needs you",
|
|
5
|
+
completed: "Completed",
|
|
6
|
+
failed: "Failed",
|
|
7
|
+
stopped: "Stopped"
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* State is the only colour on these surfaces. `awaiting` is the one orange:
|
|
11
|
+
* it is the single status a person can act on, and orange is the registry's
|
|
12
|
+
* "this is for you" tone.
|
|
13
|
+
*/ export const RUN_STATUS_TONE = {
|
|
14
|
+
provisioning: "neutral",
|
|
15
|
+
running: "info",
|
|
16
|
+
awaiting: "accent",
|
|
17
|
+
completed: "success",
|
|
18
|
+
failed: "danger",
|
|
19
|
+
stopped: "neutral"
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* The dot only marks liveness and failure — the badge above carries the full
|
|
23
|
+
* status colour. See `status-dot.tsx` for why it is three tones and not six.
|
|
24
|
+
*/ export const RUN_STATUS_DOT_TONE = {
|
|
25
|
+
provisioning: "neutral",
|
|
26
|
+
running: "emphasis",
|
|
27
|
+
awaiting: "emphasis",
|
|
28
|
+
completed: "neutral",
|
|
29
|
+
failed: "danger",
|
|
30
|
+
stopped: "neutral"
|
|
31
|
+
};
|
|
32
|
+
/** A run that will not change again without someone starting a new one. */ export function isTerminalRun(status) {
|
|
33
|
+
return status === "completed" || status === "failed" || status === "stopped";
|
|
34
|
+
}
|
|
35
|
+
/** Still moving or still asking — what an "active runs" strip shows. */ export function isActiveRun(status) {
|
|
36
|
+
return !isTerminalRun(status);
|
|
37
|
+
}
|
|
38
|
+
// Needs-you first, then in-flight, then whatever finished. Failed sorts above
|
|
39
|
+
// completed because a failure is the finished run most likely to need a human.
|
|
40
|
+
const ATTENTION_RANK = {
|
|
41
|
+
awaiting: 0,
|
|
42
|
+
running: 1,
|
|
43
|
+
provisioning: 1,
|
|
44
|
+
failed: 2,
|
|
45
|
+
completed: 3,
|
|
46
|
+
stopped: 4
|
|
47
|
+
};
|
|
48
|
+
/** Attention order, newest first within a band. Sorts a copy. */ export function sortRunsByAttention(runs) {
|
|
49
|
+
return [
|
|
50
|
+
...runs
|
|
51
|
+
].sort((a, b)=>{
|
|
52
|
+
const byAttention = ATTENTION_RANK[a.status] - ATTENTION_RANK[b.status];
|
|
53
|
+
if (byAttention !== 0) return byAttention;
|
|
54
|
+
return Date.parse(b.startedAt) - Date.parse(a.startedAt);
|
|
55
|
+
});
|
|
56
|
+
}
|