@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
@@ -0,0 +1,126 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useSyncExternalStore } from "react";
4
+ import Link from "next/link";
5
+ import { usePathname } from "next/navigation";
6
+ import { Button } from "@ekanos/ui/button";
7
+ import { Icon } from "@ekanos/ui/icon";
8
+ import { cn } from "@ekanos/ui/utils";
9
+ import { useTheme } from "next-themes";
10
+ import { docsHrefFor } from "../lib/docs-links.js";
11
+ import { getThemeToggleAccessibleLabel } from "../lib/theme-toggle.js";
12
+ import { DocsLink } from "./docs-link.js";
13
+ import { EkanosHomeLink } from "./ekanos-logo.js";
14
+ import { FOCUS_RING } from "./scrollable-nav.js";
15
+ const noSubscribe = () => () => {
16
+ };
17
+ function ThemeToggleButton() {
18
+ const { resolvedTheme, setTheme } = useTheme();
19
+ const hydrated = useSyncExternalStore(
20
+ noSubscribe,
21
+ () => true,
22
+ () => false
23
+ );
24
+ return /* @__PURE__ */ jsxs(
25
+ Button,
26
+ {
27
+ size: "sm",
28
+ variant: "ghost",
29
+ onClick: () => setTheme(resolvedTheme === "dark" ? "light" : "dark"),
30
+ "aria-label": getThemeToggleAccessibleLabel(
31
+ hydrated ? resolvedTheme : void 0
32
+ ),
33
+ "data-test": "theme-toggle",
34
+ children: [
35
+ /* @__PURE__ */ jsxs("span", { "aria-hidden": "true", className: "flex items-center gap-2 dark:hidden", children: [
36
+ /* @__PURE__ */ jsx(Icon, { name: "moon", className: "h-4 w-4" }),
37
+ /* @__PURE__ */ jsx("span", { className: "hidden sm:inline", children: "Dark" })
38
+ ] }),
39
+ /* @__PURE__ */ jsxs("span", { "aria-hidden": "true", className: "hidden items-center gap-2 dark:flex", children: [
40
+ /* @__PURE__ */ jsx(Icon, { name: "sun", className: "h-4 w-4" }),
41
+ /* @__PURE__ */ jsx("span", { className: "hidden sm:inline", children: "Light" })
42
+ ] })
43
+ ]
44
+ }
45
+ );
46
+ }
47
+ function Breadcrumb({ crumbs }) {
48
+ if (crumbs.length < 2) return null;
49
+ return /* @__PURE__ */ jsx("nav", { "aria-label": "Breadcrumb", "data-test": "breadcrumb", children: /* @__PURE__ */ jsx("ol", { className: "text-muted-foreground flex min-w-0 flex-wrap items-center gap-1 text-sm", children: crumbs.map((crumb, index) => /* @__PURE__ */ jsxs(
50
+ "li",
51
+ {
52
+ className: "flex min-w-0 items-center gap-1",
53
+ children: [
54
+ index > 0 ? /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "text-muted-foreground", children: "/" }) : null,
55
+ crumb.href ? /* @__PURE__ */ jsx(
56
+ Link,
57
+ {
58
+ href: crumb.href,
59
+ className: cn(
60
+ "hover:text-foreground truncate rounded-sm hover:underline",
61
+ FOCUS_RING
62
+ ),
63
+ "data-test": index === 0 ? "back-to-repo" : void 0,
64
+ children: crumb.label
65
+ }
66
+ ) : /* @__PURE__ */ jsx("span", { "aria-current": "page", className: "text-foreground truncate", children: crumb.label })
67
+ ]
68
+ },
69
+ `${crumb.label}-${index}`
70
+ )) }) });
71
+ }
72
+ function ShellHeader({
73
+ crumbs = [],
74
+ title,
75
+ kind,
76
+ meta,
77
+ tabs,
78
+ testId
79
+ }) {
80
+ const pathname = usePathname() ?? "/";
81
+ return /* @__PURE__ */ jsxs(
82
+ "header",
83
+ {
84
+ className: "bg-background flex flex-col gap-3 border-b px-4 pt-4 sm:px-6",
85
+ "data-test": testId,
86
+ children: [
87
+ /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3", children: [
88
+ /* @__PURE__ */ jsx(EkanosHomeLink, { className: "mt-0.5 border-r pr-3 sm:pr-4" }),
89
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
90
+ /* @__PURE__ */ jsx(Breadcrumb, { crumbs }),
91
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-wrap items-center gap-x-3 gap-y-2", children: [
92
+ /* @__PURE__ */ jsx("h1", { className: "font-heading font-heading-semibold truncate text-2xl tracking-tight", children: title }),
93
+ /* @__PURE__ */ jsx(
94
+ "span",
95
+ {
96
+ className: "text-muted-foreground bg-muted rounded-sm px-1.5 py-0.5 font-mono text-xs",
97
+ "data-test": "project-kind",
98
+ children: kind
99
+ }
100
+ ),
101
+ meta
102
+ ] })
103
+ ] }),
104
+ /* @__PURE__ */ jsxs("div", { className: "flex shrink-0 items-center gap-1", children: [
105
+ /* @__PURE__ */ jsx(
106
+ DocsLink,
107
+ {
108
+ href: docsHrefFor(pathname),
109
+ className: cn("rounded-md px-2 py-1.5", FOCUS_RING),
110
+ "data-test": "header-docs-link",
111
+ children: "Docs"
112
+ }
113
+ ),
114
+ /* @__PURE__ */ jsx(ThemeToggleButton, {})
115
+ ] })
116
+ ] }),
117
+ tabs ?? /* @__PURE__ */ jsx("div", { className: "pb-1" })
118
+ ]
119
+ }
120
+ );
121
+ }
122
+ export {
123
+ Breadcrumb,
124
+ ShellHeader,
125
+ ThemeToggleButton
126
+ };
@@ -14,6 +14,8 @@ interface ConsoleTab {
14
14
  icon: string;
15
15
  /** Match any path under `href`, not just the exact one. */
16
16
  prefix?: boolean;
17
+ /** Other paths this tab owns, such as the pages its screen links to. */
18
+ owns?: readonly string[];
17
19
  testId?: string;
18
20
  }
19
21
  /** Console tabs for one integration: `/integrations/<slug>/…`. */
@@ -22,11 +24,17 @@ export declare function integrationTabs(slug: string): ConsoleTab[];
22
24
  export declare function previewTab(slug: string): ConsoleTab;
23
25
  export declare function experienceTabs(base?: string, repo?: boolean): ConsoleTab[];
24
26
  export declare const EXPERIENCE_TABS: readonly ConsoleTab[];
27
+ export declare function tabActive(pathname: string, tab: ConsoleTab): boolean;
28
+ /** One header tab: an underline marks the page you are on. */
29
+ export declare function TabLink({ tab, pathname, }: {
30
+ tab: ConsoleTab;
31
+ pathname: string;
32
+ }): import("react").JSX.Element;
25
33
  /**
26
- * The mode-aware console nav. An integration repo gets the console as home:
27
- * one integration, six tabs. An experience gets the experience tabs; the
28
- * runtime strip under the nav lists its integrations and links each console.
29
- * Inside one of those consoles, that integration's own tabs follow.
34
+ * The mode-aware console header. An integration repo gets the console as home:
35
+ * one integration, six tabs. An experience gets the experience tabs. Inside the
36
+ * console of an integration an experience uses, that integration's own tabs
37
+ * follow, with the experience one step up the breadcrumb.
30
38
  */
31
39
  export declare function ConsoleNav({ project, pendingApprovals, }: {
32
40
  project: ConsoleProject;
@@ -8,8 +8,12 @@ import { useConsoleLinks } from "../lib/console-context.js";
8
8
  import { SURFACE_DOCS } from "../lib/docs-links.js";
9
9
  import { integrationConsoleHref } from "../lib/integration-console-href.js";
10
10
  import { previewHref, previewSections } from "../lib/preview-sections.js";
11
+ import { useRepoName } from "../lib/repo-name.js";
12
+ import { shortName } from "../lib/setup-checklist.js";
11
13
  import { DocsLink } from "./docs-link.js";
14
+ import { ProvenanceChip } from "./provenance-banner.js";
12
15
  import { FOCUS_RING, ScrollableNav } from "./scrollable-nav.js";
16
+ import { ShellHeader } from "./shell-header.js";
13
17
  function PreviewNav({
14
18
  integration
15
19
  }) {
@@ -145,7 +149,8 @@ function experienceTabs(base = "/experience", repo = false) {
145
149
  href: `${base}/layout`,
146
150
  label: "Layout",
147
151
  icon: "columns",
148
- prefix: true
152
+ prefix: true,
153
+ owns: [`${base}/pages`]
149
154
  },
150
155
  {
151
156
  href: `${base}/workflows`,
@@ -177,19 +182,25 @@ function experienceTabs(base = "/experience", repo = false) {
177
182
  }
178
183
  const EXPERIENCE_TABS = experienceTabs();
179
184
  function tabActive(pathname, tab) {
180
- return tab.prefix ? pathname === tab.href || pathname.startsWith(`${tab.href}/`) : pathname === tab.href;
185
+ const under = (href) => pathname === href || pathname.startsWith(`${href}/`);
186
+ if (tab.owns?.some(under)) return true;
187
+ return tab.prefix ? under(tab.href) : pathname === tab.href;
181
188
  }
182
- function TabLink({ tab, pathname }) {
189
+ function TabLink({
190
+ tab,
191
+ pathname
192
+ }) {
193
+ const active = tabActive(pathname, tab);
183
194
  return /* @__PURE__ */ jsxs(
184
195
  Link,
185
196
  {
186
197
  href: tab.href,
187
- "aria-current": tabActive(pathname, tab) ? "page" : void 0,
198
+ "aria-current": active ? "page" : void 0,
188
199
  ...tab.testId ? { "data-test": tab.testId } : {},
189
200
  className: cn(
190
- "flex items-center gap-2 rounded-md px-3 py-2 whitespace-nowrap transition-colors",
201
+ "flex items-center gap-2 rounded-t-md border-b-2 px-3 pt-2 pb-2.5 text-sm whitespace-nowrap transition-colors",
191
202
  FOCUS_RING,
192
- tabActive(pathname, tab) ? "bg-accent text-accent-foreground text-sm font-medium" : "text-muted-foreground hover:bg-accent text-sm"
203
+ active ? "border-primary text-foreground font-medium" : "text-muted-foreground hover:text-foreground border-transparent"
193
204
  ),
194
205
  children: [
195
206
  /* @__PURE__ */ jsx(Icon, { name: tab.icon, className: "h-4 w-4" }),
@@ -198,87 +209,74 @@ function TabLink({ tab, pathname }) {
198
209
  }
199
210
  );
200
211
  }
212
+ function ApprovalsBadge({
213
+ count,
214
+ href
215
+ }) {
216
+ const label = `${count} awaiting approval`;
217
+ const className = "bg-warning-surface text-warning flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-xs font-medium";
218
+ return href ? /* @__PURE__ */ jsxs(
219
+ Link,
220
+ {
221
+ href,
222
+ className: cn(className, "hover:underline", FOCUS_RING),
223
+ "data-test": "pending-approvals",
224
+ children: [
225
+ /* @__PURE__ */ jsx(Icon, { name: "hand", className: "h-3.5 w-3.5" }),
226
+ label
227
+ ]
228
+ }
229
+ ) : /* @__PURE__ */ jsxs("span", { className, "data-test": "pending-approvals", children: [
230
+ /* @__PURE__ */ jsx(Icon, { name: "hand", className: "h-3.5 w-3.5" }),
231
+ label
232
+ ] });
233
+ }
201
234
  function ConsoleNav({
202
235
  project,
203
236
  pendingApprovals = 0
204
237
  }) {
205
- const pathname = usePathname();
238
+ const pathname = usePathname() ?? "";
206
239
  const links = useConsoleLinks();
240
+ const repo = useRepoName();
207
241
  const own = project.integrations[0];
208
- const current = project.integrations.flatMap((integration) => {
242
+ const current = project.kind === "experience" ? project.integrations.flatMap((integration) => {
209
243
  const href = integrationConsoleHref(integration);
210
244
  return href ? [{ integration, href }] : [];
211
- }).find(({ href }) => pathname === href || pathname.startsWith(`${href}/`));
212
- return /* @__PURE__ */ jsxs(
213
- "div",
245
+ }).find(
246
+ ({ href }) => pathname === href || pathname.startsWith(`${href}/`)
247
+ ) : void 0;
248
+ const repoCrumb = links.repoHome ? [{ label: repo ?? "This repo", href: links.repoHome }] : [];
249
+ const crumbs = current ? [
250
+ ...repoCrumb,
251
+ { label: project.name, href: links.experience },
252
+ { label: shortName(current.integration.integration) }
253
+ ] : [...repoCrumb, { label: project.name }];
254
+ const tabs = project.kind === "integration" ? own ? /* @__PURE__ */ jsxs(ScrollableNav, { label: "Integration console", children: [
255
+ integrationTabs(own.integration).map((tab) => /* @__PURE__ */ jsx(TabLink, { tab, pathname }, tab.href)),
256
+ project.legacySurfaces ? /* @__PURE__ */ jsx(TabLink, { tab: previewTab(own.integration), pathname }) : null
257
+ ] }) : null : current ? /* @__PURE__ */ jsx(ScrollableNav, { label: `${current.integration.integration} console`, children: integrationTabs(current.href.slice("/integrations/".length)).map(
258
+ (tab) => /* @__PURE__ */ jsx(TabLink, { tab, pathname }, tab.href)
259
+ ) }) : /* @__PURE__ */ jsx(ScrollableNav, { label: "Experience", children: experienceTabs(links.experience, links.repoHome !== null).map(
260
+ (tab) => /* @__PURE__ */ jsx(TabLink, { tab, pathname }, tab.href)
261
+ ) });
262
+ return /* @__PURE__ */ jsx(
263
+ ShellHeader,
214
264
  {
215
- className: "flex flex-col gap-3 border-b px-4 py-4 sm:px-6",
216
- "data-test": "console-nav",
217
- children: [
218
- links.repoHome ? /* @__PURE__ */ jsxs(
219
- Link,
265
+ testId: "console-nav",
266
+ crumbs,
267
+ title: current ? /* @__PURE__ */ jsx("span", { "data-test": "current-integration", children: shortName(current.integration.integration) }) : project.name,
268
+ kind: current ? "integration" : project.kind,
269
+ meta: /* @__PURE__ */ jsxs(Fragment, { children: [
270
+ /* @__PURE__ */ jsx(ProvenanceChip, { integrations: project.integrations }),
271
+ pendingApprovals > 0 ? /* @__PURE__ */ jsx(
272
+ ApprovalsBadge,
220
273
  {
221
- href: links.repoHome,
222
- className: "text-muted-foreground hover:text-foreground w-fit text-sm",
223
- "data-test": "back-to-repo",
224
- children: [
225
- /* @__PURE__ */ jsx(Icon, { name: "arrow-left", className: "mr-2 h-4 w-4" }),
226
- "This repo"
227
- ]
274
+ count: pendingApprovals,
275
+ href: project.kind === "experience" ? `${links.experience}/review-queue` : null
228
276
  }
229
- ) : null,
230
- /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-baseline gap-3", children: [
231
- /* @__PURE__ */ jsx("h1", { className: "font-heading font-heading-semibold text-2xl tracking-tight", children: project.name }),
232
- /* @__PURE__ */ jsx(
233
- "code",
234
- {
235
- className: "text-muted-foreground text-xs",
236
- "data-test": "project-kind",
237
- children: project.kind
238
- }
239
- ),
240
- pendingApprovals > 0 ? /* @__PURE__ */ jsxs(
241
- Link,
242
- {
243
- href: project.kind === "experience" ? `${links.experience}/workflows` : "#approvals",
244
- className: "bg-warning text-warning-foreground ml-auto rounded-full px-3 py-1 text-sm font-medium",
245
- "data-test": "pending-approvals",
246
- children: [
247
- pendingApprovals,
248
- " awaiting approval"
249
- ]
250
- }
251
- ) : null
252
- ] }),
253
- project.kind === "integration" ? own ? /* @__PURE__ */ jsxs(ScrollableNav, { label: "Integration console", children: [
254
- integrationTabs(own.integration).map((tab) => /* @__PURE__ */ jsx(TabLink, { tab, pathname }, tab.href)),
255
- project.legacySurfaces ? /* @__PURE__ */ jsx(TabLink, { tab: previewTab(own.integration), pathname }) : null
256
- ] }) : null : /* @__PURE__ */ jsxs(Fragment, { children: [
257
- /* @__PURE__ */ jsx(ScrollableNav, { label: "Experience", children: experienceTabs(links.experience, links.repoHome !== null).map(
258
- (tab) => /* @__PURE__ */ jsx(TabLink, { tab, pathname }, tab.href)
259
- ) }),
260
- current ? /* @__PURE__ */ jsxs(
261
- ScrollableNav,
262
- {
263
- label: `${current.integration.integration} console`,
264
- className: "items-center",
265
- children: [
266
- /* @__PURE__ */ jsx(
267
- "code",
268
- {
269
- className: "px-1 text-sm font-medium whitespace-nowrap",
270
- "data-test": "current-integration",
271
- children: current.integration.integration
272
- }
273
- ),
274
- integrationTabs(current.href.slice("/integrations/".length)).map(
275
- (tab) => /* @__PURE__ */ jsx(TabLink, { tab, pathname }, tab.href)
276
- )
277
- ]
278
- }
279
- ) : null
280
- ] })
281
- ]
277
+ ) : null
278
+ ] }),
279
+ tabs
282
280
  }
283
281
  );
284
282
  }
@@ -286,7 +284,9 @@ export {
286
284
  ConsoleNav,
287
285
  EXPERIENCE_TABS,
288
286
  PreviewNav,
287
+ TabLink,
289
288
  experienceTabs,
290
289
  integrationTabs,
291
- previewTab
290
+ previewTab,
291
+ tabActive
292
292
  };
@@ -17,9 +17,13 @@ export declare function withFocusedDefault(widget: HarnessWidget): HarnessWidget
17
17
  * exercise deliberately instead of trip over.
18
18
  */
19
19
  export declare function toWidgetConfig(widget: HarnessWidget, productSlug: string, unhealthy: boolean): WidgetConfig;
20
- export declare function WidgetSurface({ widgets, productSlug, layout, }: {
20
+ export declare function WidgetSurface({ widgets, productSlug, layout, controls, widgetHref, }: {
21
21
  widgets: HarnessWidget[];
22
22
  productSlug: string;
23
23
  layout?: 'masonry' | 'two-column';
24
+ /** Draw the preview controls inline above the grid. */
25
+ controls?: boolean;
26
+ /** Where one widget's own page is; with it, every widget gets a caption. */
27
+ widgetHref?: (id: string) => string | null;
24
28
  }): import("react").JSX.Element;
25
29
  export { HARNESS_ACCOUNT_ID, HARNESS_SOURCE_ID };
@@ -1,12 +1,21 @@
1
1
  "use client";
2
- import { jsx } from "react/jsx-runtime";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
3
  import { useMemo } from "react";
4
+ import Link from "next/link";
5
+ import { Icon } from "@ekanos/ui/icon";
6
+ import { cn } from "@ekanos/ui/utils";
4
7
  import {
5
8
  HARNESS_ACCOUNT_ID,
6
9
  HARNESS_SOURCE_ID
7
10
  } from "../../registry.js";
8
11
  import { useToolbar } from "../lib/toolbar-context.js";
12
+ import {
13
+ declaredWidthLabel,
14
+ widgetsLeavingGaps
15
+ } from "../lib/widget-grid-gaps.js";
9
16
  import { DashboardGrid } from "./dashboard-grid.js";
17
+ import { PreviewControls } from "./dev-toolbar.js";
18
+ import { FOCUS_RING } from "./scrollable-nav.js";
10
19
  import { ViewportFrame } from "./viewport-frame.js";
11
20
  function withFocusedDefault(widget) {
12
21
  return widget.size || widget.layouts || widget.width ? widget : { ...widget, width: "full" };
@@ -24,17 +33,9 @@ function toWidgetConfig(widget, productSlug, unhealthy) {
24
33
  layouts: widget.layouts ?? {
25
34
  lg: { x: 0, y: 0, w: WIDTH_COLUMNS[widget.width ?? "half"], h: 4 }
26
35
  },
27
- // Passed through ONLY when the registry entry declared them, so the
36
+ // Passed through ONLY when the registry entry declared it, so the
28
37
  // default lives in exactly one place: `dashboard-grid.tsx`, which is a copy
29
38
  // of the host's own grid and applies the host's own `?? false`.
30
- //
31
- // This used to default `isCollapsible` to `true` here, which silently
32
- // shadowed that copy — `?? false` one layer down never saw `undefined`, so
33
- // every widget grew a collapse control whether it asked for one or not, and
34
- // the harness showed chrome production would not. Two defaults where one is
35
- // unreachable is also the shape of thing that gets "fixed" later by
36
- // deleting the wrong one.
37
- ...widget.isCollapsible === void 0 ? {} : { isCollapsible: widget.isCollapsible },
38
39
  ...widget.isPinnable === void 0 ? {} : { isPinnable: widget.isPinnable },
39
40
  aiFooterEnabled: widget.aiFooterEnabled,
40
41
  integrationMetadata: {
@@ -54,10 +55,69 @@ function toWidgetConfig(widget, productSlug, unhealthy) {
54
55
  } : void 0
55
56
  };
56
57
  }
58
+ function WidgetCaption({
59
+ widget,
60
+ href
61
+ }) {
62
+ const text = /* @__PURE__ */ jsxs(Fragment, { children: [
63
+ /* @__PURE__ */ jsx("code", { className: "truncate", children: widget.id }),
64
+ /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: "\xB7" }),
65
+ /* @__PURE__ */ jsx("span", { className: "shrink-0", children: declaredWidthLabel(widget) })
66
+ ] });
67
+ const className = "text-muted-foreground mb-1.5 flex w-fit max-w-full min-w-0 items-center gap-1.5 rounded-sm text-xs";
68
+ return href ? /* @__PURE__ */ jsxs(
69
+ Link,
70
+ {
71
+ href,
72
+ className: cn(className, "hover:text-foreground group", FOCUS_RING),
73
+ title: `Open ${widget.name} on its own`,
74
+ "data-test": "widget-caption",
75
+ children: [
76
+ text,
77
+ /* @__PURE__ */ jsx(
78
+ Icon,
79
+ {
80
+ name: "arrows-out",
81
+ className: "h-3 w-3 shrink-0 opacity-0 transition-opacity group-hover:opacity-100 group-focus-visible:opacity-100"
82
+ }
83
+ )
84
+ ]
85
+ }
86
+ ) : /* @__PURE__ */ jsx("p", { className, "data-test": "widget-caption", children: text });
87
+ }
88
+ function GridGapNote({ titles }) {
89
+ const { state } = useToolbar();
90
+ const wide = state.viewport === "full" || state.viewport === "desktop";
91
+ if (!wide || titles.length === 0) return null;
92
+ const names = titles.length === 1 ? titles[0] : `${titles.slice(0, -1).join(", ")} and ${titles.at(-1)}`;
93
+ return /* @__PURE__ */ jsxs(
94
+ "p",
95
+ {
96
+ className: "text-muted-foreground hidden items-start gap-2 text-xs xl:flex",
97
+ "data-test": "grid-gap-note",
98
+ children: [
99
+ /* @__PURE__ */ jsx(Icon, { name: "info", className: "mt-0.5 h-3.5 w-3.5 shrink-0" }),
100
+ /* @__PURE__ */ jsxs("span", { children: [
101
+ "Laid out the way the product dashboard lays them out: in registration order, half-width widgets two to a row, compact tiles four to a row.",
102
+ " ",
103
+ names,
104
+ " ",
105
+ titles.length === 1 ? "has" : "have",
106
+ " nothing beside",
107
+ " ",
108
+ titles.length === 1 ? "it" : "them",
109
+ ", so that space is empty in the product too. Reorder or resize widgets to fill it."
110
+ ] })
111
+ ]
112
+ }
113
+ );
114
+ }
57
115
  function WidgetSurface({
58
116
  widgets,
59
117
  productSlug,
60
- layout = "masonry"
118
+ layout = "masonry",
119
+ controls = false,
120
+ widgetHref
61
121
  }) {
62
122
  const { state } = useToolbar();
63
123
  const configs = useMemo(
@@ -66,17 +126,29 @@ function WidgetSurface({
66
126
  ),
67
127
  [widgets, productSlug, state.unhealthy]
68
128
  );
69
- return /* @__PURE__ */ jsx(ViewportFrame, { children: /* @__PURE__ */ jsx(
129
+ const lone = useMemo(() => {
130
+ const ids = new Set(widgetsLeavingGaps(configs));
131
+ return configs.filter((config) => ids.has(config.id)).map((config) => config.name);
132
+ }, [configs]);
133
+ const grid = /* @__PURE__ */ jsx(ViewportFrame, { children: /* @__PURE__ */ jsx(
70
134
  DashboardGrid,
71
135
  {
72
136
  widgets: configs,
73
137
  accountId: HARNESS_ACCOUNT_ID,
74
138
  layout,
75
139
  stateOverride: state.renderState,
76
- collapsedOverride: state.collapsed,
77
- resetKey: `${state.variant}-${String(state.unhealthy)}`
140
+ resetKey: `${state.variant}-${String(state.unhealthy)}`,
141
+ ...widgetHref ? {
142
+ caption: (widget) => /* @__PURE__ */ jsx(WidgetCaption, { widget, href: widgetHref(widget.id) })
143
+ } : {}
78
144
  }
79
145
  ) });
146
+ if (!controls) return grid;
147
+ return /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-col gap-4", "data-test": "widget-surface", children: [
148
+ /* @__PURE__ */ jsx(PreviewControls, { inline: true }),
149
+ layout === "masonry" && configs.length > 1 ? /* @__PURE__ */ jsx(GridGapNote, { titles: lone }) : null,
150
+ grid
151
+ ] });
80
152
  }
81
153
  export {
82
154
  HARNESS_ACCOUNT_ID,
@@ -1,14 +1,27 @@
1
- import type { WorkflowStepDefinition, WorkflowTemplateSummary } from '../lib/console-types.js';
2
- /** The step types the harness executes; everything else is listed, not run. */
3
- export declare const SIMULATED_STEP_TYPES: readonly ['fusion_tool', 'approval_gate', 'ai_step'];
4
- export declare function isSimulated(step: WorkflowStepDefinition): boolean;
1
+ import type { WorkflowRunState, WorkflowTemplateSummary } from '../lib/console-types.js';
2
+ import { type EffectOf } from '../lib/workflow-summary.js';
3
+ export { SIMULATED_STEP_TYPES, isSimulated } from '../lib/workflow-summary.js';
5
4
  /**
6
- * A workflow template as a step list with a runner. `fusion_tool` steps run
7
- * through the operation runner on the workflow channel; `approval_gate` and
8
- * any write wait in the approvals tray (the run request stays open until they
9
- * are decided); `ai_step` answers from its fixture; unsupported step types
10
- * are listed as not simulated.
5
+ * The latest run of one workflow template, read from the console's mutation
6
+ * cache rather than the component, so leaving the page mid-run and coming
7
+ * back shows the run where it is (and an approval decided elsewhere moves it
8
+ * on). The request itself keeps running while you are away.
11
9
  */
12
- export declare function WorkflowRunner({ template, }: {
10
+ export declare function useWorkflowRun(id: string): {
11
+ run: () => void;
12
+ running: boolean;
13
+ result: WorkflowRunState | undefined;
14
+ error: string | null;
15
+ startedAt: number;
16
+ };
17
+ /**
18
+ * A workflow template as a readable sequence with a runner. `fusion_tool`
19
+ * steps run through the operation runner on the workflow channel;
20
+ * `approval_gate` and any held write wait for a decision (the run request
21
+ * stays open until it is made); `ai_step` answers from its fixture;
22
+ * unsupported step types are listed as not simulated.
23
+ */
24
+ export declare function WorkflowRunner({ template, effectOf, }: {
13
25
  template: WorkflowTemplateSummary;
26
+ effectOf?: EffectOf;
14
27
  }): import("react").JSX.Element;