@ekanos/harness 0.27.0 → 0.28.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.
Files changed (154) hide show
  1. package/README.md +6 -4
  2. package/dist/internal/components/approvals-tray.d.ts +44 -6
  3. package/dist/internal/components/approvals-tray.js +252 -30
  4. package/dist/internal/components/connect-controls.js +4 -2
  5. package/dist/internal/components/connect-dialog.d.ts +8 -1
  6. package/dist/internal/components/connect-dialog.js +23 -10
  7. package/dist/internal/components/connect-panel.d.ts +3 -2
  8. package/dist/internal/components/connect-panel.js +680 -340
  9. package/dist/internal/components/connect-steps.d.ts +72 -0
  10. package/dist/internal/components/connect-steps.js +341 -0
  11. package/dist/internal/components/console-not-found.d.ts +14 -0
  12. package/dist/internal/components/console-not-found.js +57 -0
  13. package/dist/internal/components/dashboard-grid.d.ts +10 -5
  14. package/dist/internal/components/dashboard-grid.js +8 -9
  15. package/dist/internal/components/dev-toolbar.d.ts +27 -5
  16. package/dist/internal/components/dev-toolbar.js +214 -176
  17. package/dist/internal/components/ekanos-logo.d.ts +18 -0
  18. package/dist/internal/components/ekanos-logo.js +74 -0
  19. package/dist/internal/components/events-panel.d.ts +13 -4
  20. package/dist/internal/components/events-panel.js +478 -81
  21. package/dist/internal/components/harness-widget-provider.d.ts +6 -8
  22. package/dist/internal/components/harness-widget-provider.js +5 -19
  23. package/dist/internal/components/health-panel.d.ts +8 -1
  24. package/dist/internal/components/health-panel.js +328 -31
  25. package/dist/internal/components/integration-badge.js +4 -2
  26. package/dist/internal/components/integration-tab-skeletons.d.ts +8 -0
  27. package/dist/internal/components/integration-tab-skeletons.js +76 -0
  28. package/dist/internal/components/not-found-state.d.ts +39 -0
  29. package/dist/internal/components/not-found-state.js +127 -0
  30. package/dist/internal/components/operation-runner-panel.d.ts +1 -1
  31. package/dist/internal/components/operation-runner-panel.js +624 -189
  32. package/dist/internal/components/operation-scope.d.ts +13 -0
  33. package/dist/internal/components/operation-scope.js +79 -0
  34. package/dist/internal/components/page-skeletons.d.ts +11 -0
  35. package/dist/internal/components/page-skeletons.js +61 -0
  36. package/dist/internal/components/provenance-banner.d.ts +13 -4
  37. package/dist/internal/components/provenance-banner.js +35 -10
  38. package/dist/internal/components/run-log-copy.d.ts +17 -0
  39. package/dist/internal/components/run-log-copy.js +67 -0
  40. package/dist/internal/components/run-log-detail.d.ts +22 -0
  41. package/dist/internal/components/run-log-detail.js +295 -0
  42. package/dist/internal/components/run-log-empty.d.ts +13 -0
  43. package/dist/internal/components/run-log-empty.js +46 -0
  44. package/dist/internal/components/run-log.d.ts +23 -3
  45. package/dist/internal/components/run-log.js +384 -130
  46. package/dist/internal/components/runtime-strip.d.ts +5 -1
  47. package/dist/internal/components/runtime-strip.js +82 -5
  48. package/dist/internal/components/schema-form.d.ts +2 -1
  49. package/dist/internal/components/schema-form.js +212 -79
  50. package/dist/internal/components/scrollable-nav.js +14 -2
  51. package/dist/internal/components/segmented-control.d.ts +19 -0
  52. package/dist/internal/components/segmented-control.js +46 -0
  53. package/dist/internal/components/shell-header.d.ts +25 -0
  54. package/dist/internal/components/shell-header.js +126 -0
  55. package/dist/internal/components/surface-nav.d.ts +12 -4
  56. package/dist/internal/components/surface-nav.js +77 -77
  57. package/dist/internal/components/widget-surface.d.ts +5 -1
  58. package/dist/internal/components/widget-surface.js +86 -14
  59. package/dist/internal/components/workflow-runner.d.ts +23 -10
  60. package/dist/internal/components/workflow-runner.js +451 -69
  61. package/dist/internal/lib/connect-model.d.ts +134 -0
  62. package/dist/internal/lib/connect-model.js +282 -0
  63. package/dist/internal/lib/connection-facts.js +2 -1
  64. package/dist/internal/lib/console-client.js +5 -2
  65. package/dist/internal/lib/console-hooks.d.ts +4 -1
  66. package/dist/internal/lib/console-hooks.js +3 -2
  67. package/dist/internal/lib/console-types.d.ts +6 -0
  68. package/dist/internal/lib/docs-links.d.ts +28 -0
  69. package/dist/internal/lib/docs-links.js +57 -1
  70. package/dist/internal/lib/event-delivery.d.ts +33 -0
  71. package/dist/internal/lib/event-delivery.js +66 -0
  72. package/dist/internal/lib/font-files/OFL-BricolageGrotesque.txt +93 -0
  73. package/dist/internal/lib/font-files/OFL-Figtree.txt +93 -0
  74. package/dist/internal/lib/font-files/bricolage-grotesque-latin-variable.woff2 +0 -0
  75. package/dist/internal/lib/font-files/figtree-latin-variable.woff2 +0 -0
  76. package/dist/internal/lib/fonts.js +13 -12
  77. package/dist/internal/lib/health-model.d.ts +58 -0
  78. package/dist/internal/lib/health-model.js +140 -0
  79. package/dist/internal/lib/integration-console-href.d.ts +5 -0
  80. package/dist/internal/lib/integration-console-href.js +7 -1
  81. package/dist/internal/lib/oauth-setup-guide.d.ts +28 -0
  82. package/dist/internal/lib/oauth-setup-guide.js +35 -1
  83. package/dist/internal/lib/operation-catalog.d.ts +70 -0
  84. package/dist/internal/lib/operation-catalog.js +261 -0
  85. package/dist/internal/lib/overview-model.d.ts +34 -0
  86. package/dist/internal/lib/overview-model.js +91 -0
  87. package/dist/internal/lib/registry-entry.d.ts +8 -0
  88. package/dist/internal/lib/registry-entry.js +11 -0
  89. package/dist/internal/lib/repo-name.d.ts +9 -0
  90. package/dist/internal/lib/repo-name.js +21 -0
  91. package/dist/internal/lib/run-log-view.d.ts +66 -1
  92. package/dist/internal/lib/run-log-view.js +183 -4
  93. package/dist/internal/lib/runner-view.d.ts +15 -0
  94. package/dist/internal/lib/runner-view.js +18 -0
  95. package/dist/internal/lib/schema-form-model.d.ts +17 -0
  96. package/dist/internal/lib/schema-form-model.js +50 -0
  97. package/dist/internal/lib/setup-checklist.d.ts +34 -0
  98. package/dist/internal/lib/setup-checklist.js +79 -0
  99. package/dist/internal/lib/toolbar-context.d.ts +0 -1
  100. package/dist/internal/lib/toolbar-context.js +0 -2
  101. package/dist/internal/lib/toolbar-visibility.d.ts +9 -2
  102. package/dist/internal/lib/toolbar-visibility.js +5 -0
  103. package/dist/internal/lib/use-operation-effects.d.ts +7 -0
  104. package/dist/internal/lib/use-operation-effects.js +28 -0
  105. package/dist/internal/lib/use-run-log-query.d.ts +9 -0
  106. package/dist/internal/lib/use-run-log-query.js +35 -0
  107. package/dist/internal/lib/widget-grid-gaps.d.ts +18 -0
  108. package/dist/internal/lib/widget-grid-gaps.js +41 -0
  109. package/dist/internal/lib/workflow-summary.d.ts +54 -0
  110. package/dist/internal/lib/workflow-summary.js +147 -0
  111. package/dist/internal/routes/console-home-page.js +2 -1
  112. package/dist/internal/routes/experience-connect-page.js +46 -17
  113. package/dist/internal/routes/experience-layout-page.js +75 -26
  114. package/dist/internal/routes/experience-page-host.js +63 -5
  115. package/dist/internal/routes/experience-review-queue-page.d.ts +4 -1
  116. package/dist/internal/routes/experience-review-queue-page.js +108 -12
  117. package/dist/internal/routes/experience-runs-page.js +57 -4
  118. package/dist/internal/routes/experience-summary-page.d.ts +19 -0
  119. package/dist/internal/routes/experience-summary-page.js +212 -52
  120. package/dist/internal/routes/experience-widget-page.js +58 -7
  121. package/dist/internal/routes/experience-widgets-page.d.ts +2 -3
  122. package/dist/internal/routes/experience-widgets-page.js +29 -4
  123. package/dist/internal/routes/experience-workflow-page.js +81 -9
  124. package/dist/internal/routes/experience-workflows-page.js +85 -21
  125. package/dist/internal/routes/integration-layout.js +28 -3
  126. package/dist/internal/routes/integrations-connect-page.js +16 -6
  127. package/dist/internal/routes/integrations-events-page.js +22 -1
  128. package/dist/internal/routes/integrations-health-page.js +16 -1
  129. package/dist/internal/routes/integrations-layout.js +28 -4
  130. package/dist/internal/routes/integrations-list-page.d.ts +0 -1
  131. package/dist/internal/routes/integrations-list-page.js +11 -9
  132. package/dist/internal/routes/integrations-operation-page.js +53 -17
  133. package/dist/internal/routes/integrations-operations-page.js +539 -49
  134. package/dist/internal/routes/integrations-overview-page.js +332 -69
  135. package/dist/internal/routes/integrations-runs-page.js +53 -3
  136. package/dist/internal/routes/integrations-scope.d.ts +15 -2
  137. package/dist/internal/routes/integrations-scope.js +66 -18
  138. package/dist/internal/routes/preview-index-page.js +2 -2
  139. package/dist/internal/routes/repo-home-page.d.ts +2 -2
  140. package/dist/internal/routes/repo-home-page.js +428 -236
  141. package/dist/internal/routes/repo-layout.d.ts +12 -0
  142. package/dist/internal/routes/repo-layout.js +50 -38
  143. package/dist/internal/routes/repo-package-layouts.js +22 -8
  144. package/dist/internal/routes/single-widget-page.d.ts +1 -1
  145. package/dist/internal/routes/single-widget-page.js +28 -5
  146. package/dist/internal/routes/tile-page.d.ts +1 -1
  147. package/dist/internal/routes/tile-page.js +1 -2
  148. package/dist/internal/routes/widgets-page.d.ts +1 -1
  149. package/dist/internal/routes/widgets-page.js +5 -3
  150. package/dist/registry.d.ts +4 -5
  151. package/dist/registry.js +0 -1
  152. package/dist/routes.d.ts +5 -0
  153. package/dist/routes.js +2 -0
  154. package/package.json +8 -8
@@ -1,16 +1,13 @@
1
1
  "use client";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import { useState } from "react";
4
- import { Alert, AlertDescription } from "@ekanos/ui/alert";
4
+ import { Alert, AlertDescription, AlertTitle } from "@ekanos/ui/alert";
5
+ import { Badge } from "@ekanos/ui/badge";
5
6
  import { Button } from "@ekanos/ui/button";
6
- import { Label } from "@ekanos/ui/label";
7
- import {
8
- Select,
9
- SelectContent,
10
- SelectItem,
11
- SelectTrigger,
12
- SelectValue
13
- } from "@ekanos/ui/select";
7
+ import { EmptyNote } from "@ekanos/ui/empty-note";
8
+ import { Icon } from "@ekanos/ui/icon";
9
+ import { SearchField } from "@ekanos/ui/search-field";
10
+ import { Skeleton } from "@ekanos/ui/skeleton";
14
11
  import { StatusBadge } from "@ekanos/ui/status-badge";
15
12
  import {
16
13
  Table,
@@ -23,164 +20,369 @@ import {
23
20
  import { useRuns } from "../lib/console-hooks.js";
24
21
  import {
25
22
  NO_RUN_FILTER,
23
+ RUN_LOG_KEEPS,
26
24
  RUN_OUTCOMES,
25
+ RUN_OUTCOME_LABELS,
27
26
  RUN_PAGE_SIZE,
28
- explainRunReason,
27
+ countOutcomes,
28
+ explainRun,
29
29
  filterRuns,
30
+ formatDuration,
31
+ groupRunsByDay,
32
+ isFiltered,
30
33
  pageRuns,
31
- runOutcome
34
+ runKind,
35
+ runNeighbours,
36
+ runOutcome,
37
+ runQueryString
32
38
  } from "../lib/run-log-view.js";
33
- const OUTCOME_TONES = {
34
- ok: "success",
35
- refused: "destructive",
36
- failed: "destructive",
37
- held: "warning"
38
- };
39
+ import { OUTCOME_TONES, RunDetailSheet } from "./run-log-detail.js";
40
+ const NO_QUERY = { filter: NO_RUN_FILTER, run: null };
41
+ const COLUMNS = 5;
42
+ function FilterChips({
43
+ label,
44
+ value,
45
+ options,
46
+ onChange,
47
+ testId
48
+ }) {
49
+ return /* @__PURE__ */ jsx(
50
+ "div",
51
+ {
52
+ role: "group",
53
+ "aria-label": label,
54
+ className: "flex flex-wrap items-center gap-1",
55
+ "data-test": testId,
56
+ children: options.map((option) => {
57
+ const pressed = option.value === value;
58
+ return /* @__PURE__ */ jsxs(
59
+ Button,
60
+ {
61
+ type: "button",
62
+ size: "sm",
63
+ variant: pressed ? "secondary" : "ghost",
64
+ "aria-pressed": pressed,
65
+ onClick: () => onChange(option.value),
66
+ "data-test": `${testId}-${option.value}`,
67
+ children: [
68
+ option.label,
69
+ option.count === void 0 ? null : /* @__PURE__ */ jsx("span", { className: "text-muted-foreground tabular-nums", children: option.count })
70
+ ]
71
+ },
72
+ option.value
73
+ );
74
+ })
75
+ }
76
+ );
77
+ }
39
78
  function RunFilters({
40
79
  filter,
80
+ runs,
41
81
  integrations,
42
82
  onChange
43
83
  }) {
44
- return /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-end gap-4", "data-test": "run-log-filters", children: [
45
- /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
46
- /* @__PURE__ */ jsx(Label, { className: "text-muted-foreground text-xs", children: "Outcome" }),
47
- /* @__PURE__ */ jsxs(
48
- Select,
84
+ const counts = countOutcomes(filterRuns(runs, { ...filter, outcome: "all" }));
85
+ const total = Object.values(counts).reduce((sum, n) => sum + n, 0);
86
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", "data-test": "run-log-filters", children: [
87
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3 lg:flex-row lg:items-center", children: [
88
+ /* @__PURE__ */ jsx(
89
+ SearchField,
90
+ {
91
+ size: "sm",
92
+ className: "lg:max-w-72",
93
+ value: filter.q ?? "",
94
+ onValueChange: (q) => onChange({ ...filter, q }),
95
+ placeholder: "Search by operation or event",
96
+ "aria-label": "Search runs by operation or event name",
97
+ id: "run-log-search",
98
+ "data-test": "run-filter-search"
99
+ }
100
+ ),
101
+ /* @__PURE__ */ jsx(
102
+ FilterChips,
49
103
  {
104
+ label: "Outcome",
50
105
  value: filter.outcome,
51
- onValueChange: (outcome) => onChange({
52
- ...filter,
53
- outcome: outcome ?? "all"
54
- }),
55
- children: [
56
- /* @__PURE__ */ jsx(SelectTrigger, { className: "w-36", "data-test": "run-filter-outcome", children: /* @__PURE__ */ jsx(SelectValue, {}) }),
57
- /* @__PURE__ */ jsxs(SelectContent, { children: [
58
- /* @__PURE__ */ jsx(SelectItem, { value: "all", children: "All outcomes" }),
59
- RUN_OUTCOMES.map((outcome) => /* @__PURE__ */ jsx(SelectItem, { value: outcome, children: outcome }, outcome))
60
- ] })
106
+ onChange: (outcome) => onChange({ ...filter, outcome }),
107
+ testId: "run-filter-outcome",
108
+ options: [
109
+ { value: "all", label: "All", count: total },
110
+ ...RUN_OUTCOMES.map((outcome) => ({
111
+ value: outcome,
112
+ label: RUN_OUTCOME_LABELS[outcome],
113
+ count: counts[outcome]
114
+ }))
61
115
  ]
62
116
  }
63
117
  )
64
118
  ] }),
65
- integrations.length > 1 ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
66
- /* @__PURE__ */ jsx(Label, { className: "text-muted-foreground text-xs", children: "Integration" }),
67
- /* @__PURE__ */ jsxs(
68
- Select,
119
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-x-6 gap-y-2", children: [
120
+ /* @__PURE__ */ jsx(
121
+ FilterChips,
122
+ {
123
+ label: "Kind",
124
+ value: filter.kind ?? "all",
125
+ onChange: (kind) => onChange({ ...filter, kind }),
126
+ testId: "run-filter-kind",
127
+ options: [
128
+ { value: "all", label: "Everything" },
129
+ { value: "operation", label: "Operations" },
130
+ { value: "event", label: "Test events" }
131
+ ]
132
+ }
133
+ ),
134
+ /* @__PURE__ */ jsx(
135
+ FilterChips,
69
136
  {
137
+ label: "Mode",
138
+ value: filter.mode ?? "all",
139
+ onChange: (mode) => onChange({ ...filter, mode }),
140
+ testId: "run-filter-mode",
141
+ options: [
142
+ { value: "all", label: "Any mode" },
143
+ { value: "fixtures", label: "Fixtures" },
144
+ { value: "live", label: "Live" }
145
+ ]
146
+ }
147
+ ),
148
+ integrations.length > 1 ? /* @__PURE__ */ jsx(
149
+ FilterChips,
150
+ {
151
+ label: "Integration",
70
152
  value: filter.integration,
71
- onValueChange: (integration) => onChange({ ...filter, integration: integration ?? "all" }),
72
- children: [
73
- /* @__PURE__ */ jsx(SelectTrigger, { className: "w-44", "data-test": "run-filter-integration", children: /* @__PURE__ */ jsx(SelectValue, {}) }),
74
- /* @__PURE__ */ jsxs(SelectContent, { children: [
75
- /* @__PURE__ */ jsx(SelectItem, { value: "all", children: "All integrations" }),
76
- integrations.map((name) => /* @__PURE__ */ jsx(SelectItem, { value: name, children: name }, name))
77
- ] })
153
+ onChange: (integration) => onChange({ ...filter, integration }),
154
+ testId: "run-filter-integration",
155
+ options: [
156
+ { value: "all", label: "All integrations" },
157
+ ...integrations.map((name) => ({ value: name, label: name }))
78
158
  ]
79
159
  }
80
- )
81
- ] }) : null
160
+ ) : null
161
+ ] })
82
162
  ] });
83
163
  }
164
+ function RunDayRow({ label, count }) {
165
+ return /* @__PURE__ */ jsx("tr", { className: "bg-muted border-b", "data-test": "run-log-day", children: /* @__PURE__ */ jsx(
166
+ "th",
167
+ {
168
+ scope: "rowgroup",
169
+ colSpan: COLUMNS,
170
+ className: "text-muted-foreground px-2 py-1.5 text-left text-xs font-medium",
171
+ children: /* @__PURE__ */ jsxs("span", { className: "flex items-center justify-between gap-4", children: [
172
+ /* @__PURE__ */ jsx("span", { children: label }),
173
+ /* @__PURE__ */ jsxs("span", { className: "tabular-nums", children: [
174
+ count,
175
+ " ",
176
+ count === 1 ? "run" : "runs"
177
+ ] })
178
+ ] })
179
+ }
180
+ ) });
181
+ }
182
+ function RunRow({
183
+ run,
184
+ showIntegration,
185
+ selected,
186
+ href,
187
+ onOpen
188
+ }) {
189
+ const outcome = runOutcome(run);
190
+ const explanation = outcome === "ok" ? null : explainRun(run);
191
+ const time = new Date(run.ts).toLocaleTimeString();
192
+ const kind = runKind(run);
193
+ return /* @__PURE__ */ jsxs(
194
+ TableRow,
195
+ {
196
+ "data-test": "run-log-row",
197
+ "data-run-id": run.id,
198
+ "data-outcome": outcome,
199
+ "data-state": selected ? "selected" : void 0,
200
+ className: "cursor-pointer",
201
+ onClick: () => onOpen(run.id),
202
+ children: [
203
+ /* @__PURE__ */ jsx(TableCell, { className: "w-24 align-top", children: /* @__PURE__ */ jsx(StatusBadge, { tone: OUTCOME_TONES[outcome], children: RUN_OUTCOME_LABELS[outcome] }) }),
204
+ /* @__PURE__ */ jsxs(TableCell, { className: "max-w-0 align-top whitespace-normal", children: [
205
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [
206
+ /* @__PURE__ */ jsxs(
207
+ "a",
208
+ {
209
+ href,
210
+ className: "focus-visible:ring-ring/50 min-w-0 truncate rounded-sm font-mono text-sm outline-none focus-visible:ring-3",
211
+ onClick: (click) => {
212
+ click.stopPropagation();
213
+ if (click.metaKey || click.ctrlKey || click.shiftKey) return;
214
+ click.preventDefault();
215
+ onOpen(run.id);
216
+ },
217
+ "aria-label": `Open run ${run.opKey} at ${time}`,
218
+ "data-test": "run-log-open",
219
+ children: [
220
+ showIntegration ? /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground", children: [
221
+ run.integration,
222
+ " \xB7",
223
+ " "
224
+ ] }) : null,
225
+ run.opKey
226
+ ]
227
+ }
228
+ ),
229
+ kind === "event" ? /* @__PURE__ */ jsx(Badge, { variant: "outline", size: "sm", className: "shrink-0", children: "Test event" }) : null
230
+ ] }),
231
+ /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground block text-xs sm:hidden", children: [
232
+ time,
233
+ run.mode ? ` \xB7 ${run.mode}` : ""
234
+ ] }),
235
+ explanation ? /* @__PURE__ */ jsx(
236
+ "span",
237
+ {
238
+ className: "text-muted-foreground mt-0.5 line-clamp-1 block text-xs",
239
+ "data-test": "run-reason",
240
+ children: explanation
241
+ }
242
+ ) : null
243
+ ] }),
244
+ /* @__PURE__ */ jsx(TableCell, { className: "text-muted-foreground hidden align-top text-xs leading-5 capitalize sm:table-cell", children: run.mode ?? "\u2014" }),
245
+ /* @__PURE__ */ jsx(TableCell, { className: "text-muted-foreground w-20 text-right align-top text-xs leading-5 tabular-nums", children: kind === "event" ? "\u2014" : formatDuration(run.durationMs) }),
246
+ /* @__PURE__ */ jsx(TableCell, { className: "text-muted-foreground hidden w-28 text-right align-top text-xs leading-5 tabular-nums sm:table-cell", children: time })
247
+ ]
248
+ }
249
+ );
250
+ }
84
251
  function RunLogTable({
85
252
  runs,
86
- integration
253
+ integration,
254
+ query: controlled,
255
+ onQueryChange,
256
+ targetHrefFor,
257
+ empty,
258
+ status
87
259
  }) {
88
- const [view, setView] = useState({
89
- filter: NO_RUN_FILTER,
90
- limit: RUN_PAGE_SIZE
91
- });
260
+ const [view, setView] = useState({ query: NO_QUERY, limit: RUN_PAGE_SIZE });
261
+ const query = controlled ?? view.query;
262
+ const setQuery = (next, resetLimit = false) => {
263
+ if (onQueryChange) onQueryChange(next);
264
+ setView((previous) => ({
265
+ query: next,
266
+ limit: resetLimit ? RUN_PAGE_SIZE : previous.limit
267
+ }));
268
+ };
92
269
  const scoped = integration ? runs.filter((run) => run.integration === integration) : runs;
93
270
  const integrations = [...new Set(scoped.map((run) => run.integration))];
94
- const filtered = filterRuns(scoped, view.filter);
271
+ const filtered = filterRuns(scoped, query.filter);
95
272
  const { shown, remaining } = pageRuns(filtered, view.limit);
273
+ const filteredOn = isFiltered(query.filter);
274
+ const openRun = query.run ? scoped.find((run) => run.id === query.run) ?? null : null;
275
+ const neighbours = runNeighbours(filtered, query.run);
276
+ const select = (id) => setQuery({ ...query, run: id });
277
+ const clearFilters = () => setQuery({ filter: NO_RUN_FILTER, run: query.run }, true);
278
+ const sheet = /* @__PURE__ */ jsx(
279
+ RunDetailSheet,
280
+ {
281
+ runId: query.run,
282
+ run: openRun,
283
+ position: neighbours.index >= 0 ? { index: neighbours.index, total: filtered.length } : null,
284
+ newer: neighbours.newer,
285
+ older: neighbours.older,
286
+ targetHref: openRun && targetHrefFor ? targetHrefFor(openRun) : null,
287
+ onSelect: select,
288
+ onClose: () => select(null)
289
+ }
290
+ );
96
291
  if (scoped.length === 0) {
97
- return /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm", "data-test": "run-log-empty", children: "No operations have run yet." });
292
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
293
+ status ? /* @__PURE__ */ jsx("div", { className: "flex justify-end", children: status }) : null,
294
+ /* @__PURE__ */ jsx("div", { "data-test": "run-log-empty", children: empty ?? /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm", children: "No operations have run yet." }) }),
295
+ query.run ? sheet : null
296
+ ] });
98
297
  }
298
+ const days = groupRunsByDay(shown);
299
+ const multiDay = days.length > 1;
300
+ const showIntegration = !integration && integrations.length > 1;
99
301
  return /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-col gap-4", children: [
100
302
  /* @__PURE__ */ jsx(
101
303
  RunFilters,
102
304
  {
103
- filter: view.filter,
305
+ filter: query.filter,
306
+ runs: scoped,
104
307
  integrations: integration ? [] : integrations,
105
- onChange: (filter) => setView({ filter, limit: RUN_PAGE_SIZE })
308
+ onChange: (filter) => setQuery({ ...query, filter }, true)
106
309
  }
107
310
  ),
108
- shown.length === 0 ? /* @__PURE__ */ jsx(
109
- "p",
311
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-x-3 gap-y-1 text-xs", children: [
312
+ /* @__PURE__ */ jsx(
313
+ "span",
314
+ {
315
+ className: "text-muted-foreground tabular-nums",
316
+ "aria-live": "polite",
317
+ "data-test": "run-log-count",
318
+ children: filteredOn ? `${filtered.length} of ${scoped.length} runs` : `${scoped.length} ${scoped.length === 1 ? "run" : "runs"}`
319
+ }
320
+ ),
321
+ filteredOn && shown.length > 0 ? /* @__PURE__ */ jsx(
322
+ Button,
323
+ {
324
+ type: "button",
325
+ variant: "link",
326
+ size: "xs",
327
+ className: "px-0",
328
+ onClick: clearFilters,
329
+ "data-test": "run-log-clear",
330
+ children: "Clear filters"
331
+ }
332
+ ) : null,
333
+ status ? /* @__PURE__ */ jsx("span", { className: "ml-auto", children: status }) : null
334
+ ] }),
335
+ shown.length === 0 ? /* @__PURE__ */ jsx("div", { "data-test": "run-log-no-match", children: /* @__PURE__ */ jsxs(
336
+ EmptyNote,
110
337
  {
111
- className: "text-muted-foreground text-sm",
112
- "data-test": "run-log-no-match",
113
- children: "No runs match these filters."
338
+ icon: "funnel-simple",
339
+ title: "No runs match these filters",
340
+ action: /* @__PURE__ */ jsx(
341
+ Button,
342
+ {
343
+ type: "button",
344
+ variant: "outline",
345
+ size: "sm",
346
+ onClick: clearFilters,
347
+ children: "Clear filters"
348
+ }
349
+ ),
350
+ children: [
351
+ scoped.length,
352
+ " ",
353
+ scoped.length === 1 ? "run is" : "runs are",
354
+ " in the log; the filters hide them all."
355
+ ]
114
356
  }
115
- ) : /* @__PURE__ */ jsx("div", { className: "overflow-x-auto", "data-test": "run-log", children: /* @__PURE__ */ jsxs(Table, { children: [
357
+ ) }) : /* @__PURE__ */ jsx("div", { "data-test": "run-log", children: /* @__PURE__ */ jsxs(Table, { "aria-label": "Runs, newest first", className: "table-fixed", children: [
116
358
  /* @__PURE__ */ jsx(TableHeader, { children: /* @__PURE__ */ jsxs(TableRow, { children: [
117
- /* @__PURE__ */ jsx(TableHead, { children: "Time" }),
359
+ /* @__PURE__ */ jsx(TableHead, { className: "w-24", children: "Status" }),
118
360
  /* @__PURE__ */ jsx(TableHead, { children: "Operation" }),
119
- /* @__PURE__ */ jsx(TableHead, { children: "Source" }),
120
- /* @__PURE__ */ jsx(TableHead, { children: "Mode" }),
121
- /* @__PURE__ */ jsx(TableHead, { children: "Channel" }),
122
- /* @__PURE__ */ jsx(TableHead, { children: "Status" }),
123
- /* @__PURE__ */ jsx(TableHead, { className: "text-right", children: "ms" })
361
+ /* @__PURE__ */ jsx(TableHead, { className: "hidden w-24 sm:table-cell", children: "Mode" }),
362
+ /* @__PURE__ */ jsx(TableHead, { className: "w-20 text-right", children: "Duration" }),
363
+ /* @__PURE__ */ jsx(TableHead, { className: "hidden w-28 text-right sm:table-cell", children: "Time" })
124
364
  ] }) }),
125
- /* @__PURE__ */ jsx(TableBody, { children: shown.map((run) => {
126
- const explanation = explainRunReason(run.reason);
127
- return /* @__PURE__ */ jsxs(
128
- TableRow,
365
+ /* @__PURE__ */ jsx(TableBody, { children: days.map((day) => [
366
+ multiDay ? /* @__PURE__ */ jsx(
367
+ RunDayRow,
129
368
  {
130
- "data-test": "run-log-row",
131
- "data-run-id": run.id,
132
- "data-outcome": runOutcome(run),
133
- children: [
134
- /* @__PURE__ */ jsx(TableCell, { className: "text-xs whitespace-nowrap", children: new Date(run.ts).toLocaleTimeString() }),
135
- /* @__PURE__ */ jsxs(TableCell, { children: [
136
- /* @__PURE__ */ jsxs("code", { className: "text-xs", children: [
137
- run.integration,
138
- "@",
139
- run.version,
140
- "/",
141
- run.opKey
142
- ] }),
143
- /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground block text-xs", children: [
144
- "integration ",
145
- run.integration,
146
- " \xB7",
147
- " ",
148
- run.effect ?? "unknown"
149
- ] })
150
- ] }),
151
- /* @__PURE__ */ jsx(TableCell, { className: "text-xs uppercase", children: run.provenance ?? "n/a" }),
152
- /* @__PURE__ */ jsx(TableCell, { className: "text-xs", children: run.mode ?? "n/a" }),
153
- /* @__PURE__ */ jsxs(TableCell, { className: "text-xs", children: [
154
- run.channel,
155
- run.origin ? /* @__PURE__ */ jsx("span", { className: "text-muted-foreground block", children: run.origin }) : null
156
- ] }),
157
- /* @__PURE__ */ jsxs(TableCell, { children: [
158
- /* @__PURE__ */ jsxs(
159
- StatusBadge,
160
- {
161
- tone: OUTCOME_TONES[runOutcome(run)],
162
- ...explanation ? { title: explanation } : {},
163
- children: [
164
- runOutcome(run),
165
- run.reason ? ` \xB7 ${run.reason}` : ""
166
- ]
167
- }
168
- ),
169
- explanation ? /* @__PURE__ */ jsx(
170
- "span",
171
- {
172
- className: "text-muted-foreground mt-1 block max-w-64 text-xs whitespace-normal",
173
- "data-test": "run-reason",
174
- children: explanation
175
- }
176
- ) : null
177
- ] }),
178
- /* @__PURE__ */ jsx(TableCell, { className: "text-right text-xs", children: run.durationMs })
179
- ]
369
+ label: day.label,
370
+ count: day.runs.length
371
+ },
372
+ `day-${day.key}`
373
+ ) : null,
374
+ ...day.runs.map((run) => /* @__PURE__ */ jsx(
375
+ RunRow,
376
+ {
377
+ run,
378
+ showIntegration,
379
+ selected: run.id === query.run,
380
+ href: runQueryString({ ...query, run: run.id }) || "?",
381
+ onOpen: select
180
382
  },
181
383
  run.id
182
- );
183
- }) })
384
+ ))
385
+ ]) })
184
386
  ] }) }),
185
387
  remaining > 0 ? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
186
388
  /* @__PURE__ */ jsx(
@@ -203,26 +405,78 @@ function RunLogTable({
203
405
  " of ",
204
406
  filtered.length
205
407
  ] })
206
- ] }) : null
408
+ ] }) : null,
409
+ sheet
207
410
  ] });
208
411
  }
209
- function RunLog({ integration }) {
412
+ function RunLogSkeleton() {
413
+ return /* @__PURE__ */ jsxs(
414
+ "div",
415
+ {
416
+ className: "flex flex-col gap-4",
417
+ "aria-busy": "true",
418
+ "aria-label": "Getting the run log",
419
+ "data-test": "run-log-loading",
420
+ children: [
421
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-2", children: [
422
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-8 w-72" }),
423
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-8 w-80" })
424
+ ] }),
425
+ /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2", children: [0, 1, 2, 3, 4].map((row) => /* @__PURE__ */ jsx(Skeleton, { className: "h-10 w-full" }, row)) })
426
+ ]
427
+ }
428
+ );
429
+ }
430
+ function RunLogLiveStatus() {
431
+ return /* @__PURE__ */ jsxs(
432
+ "span",
433
+ {
434
+ className: "text-muted-foreground inline-flex items-center gap-1.5 text-xs",
435
+ title: `Checks for new runs every second while this tab is visible, and pauses while it is hidden. The dev server keeps the latest ${RUN_LOG_KEEPS} in memory and forgets them when it restarts.`,
436
+ "data-test": "run-log-live",
437
+ children: [
438
+ /* @__PURE__ */ jsx("span", { className: "bg-success size-1.5 rounded-full", "aria-hidden": true }),
439
+ "Live \xB7 updates every second"
440
+ ]
441
+ }
442
+ );
443
+ }
444
+ function RunLog({
445
+ integration,
446
+ query,
447
+ onQueryChange,
448
+ targetHrefFor,
449
+ empty
450
+ }) {
210
451
  const runs = useRuns();
211
452
  if (runs.isError) {
212
- return /* @__PURE__ */ jsx(Alert, { variant: "destructive", children: /* @__PURE__ */ jsxs(AlertDescription, { children: [
213
- "Could not load the run log: ",
214
- runs.error.message
215
- ] }) });
453
+ return /* @__PURE__ */ jsxs(Alert, { variant: "destructive", "data-test": "run-log-error", children: [
454
+ /* @__PURE__ */ jsx(Icon, { name: "warning-circle" }),
455
+ /* @__PURE__ */ jsx(AlertTitle, { children: "Could not load the run log" }),
456
+ /* @__PURE__ */ jsxs(AlertDescription, { children: [
457
+ runs.error.message,
458
+ ". Check that ",
459
+ /* @__PURE__ */ jsx("code", { children: "ekanos dev" }),
460
+ " is still running in your terminal; the log retries every second."
461
+ ] })
462
+ ] });
216
463
  }
464
+ if (runs.isPending) return /* @__PURE__ */ jsx(RunLogSkeleton, {});
217
465
  return /* @__PURE__ */ jsx(
218
466
  RunLogTable,
219
467
  {
220
- runs: runs.data ?? [],
221
- ...integration ? { integration } : {}
468
+ runs: runs.data,
469
+ status: /* @__PURE__ */ jsx(RunLogLiveStatus, {}),
470
+ ...integration ? { integration } : {},
471
+ ...query ? { query } : {},
472
+ ...onQueryChange ? { onQueryChange } : {},
473
+ ...targetHrefFor ? { targetHrefFor } : {},
474
+ ...empty ? { empty } : {}
222
475
  }
223
476
  );
224
477
  }
225
478
  export {
226
479
  RunLog,
480
+ RunLogLiveStatus,
227
481
  RunLogTable
228
482
  };
@@ -9,4 +9,8 @@ export declare function runtimeChipText(integration: Pick<ConsoleIntegration, 'i
9
9
  *
10
10
  * When every integration is live and none is pinned, it collapses to one line.
11
11
  */
12
- export declare function RuntimeStrip(): import("react").JSX.Element | null;
12
+ export declare function RuntimeStrip({ variant, manageHref, }?: {
13
+ /** `compact`: one quiet line of where answers come from, linking `manageHref`. */
14
+ variant?: 'full' | 'compact';
15
+ manageHref?: string;
16
+ }): import("react").JSX.Element | null;