@ekanos/harness 0.26.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 (159) hide show
  1. package/README.md +6 -4
  2. package/dist/api-types.d.ts +4 -0
  3. package/dist/internal/components/approvals-tray.d.ts +44 -6
  4. package/dist/internal/components/approvals-tray.js +252 -30
  5. package/dist/internal/components/connect-controls.js +4 -2
  6. package/dist/internal/components/connect-dialog.d.ts +8 -1
  7. package/dist/internal/components/connect-dialog.js +23 -10
  8. package/dist/internal/components/connect-panel.d.ts +3 -2
  9. package/dist/internal/components/connect-panel.js +680 -340
  10. package/dist/internal/components/connect-steps.d.ts +72 -0
  11. package/dist/internal/components/connect-steps.js +341 -0
  12. package/dist/internal/components/console-not-found.d.ts +14 -0
  13. package/dist/internal/components/console-not-found.js +57 -0
  14. package/dist/internal/components/dashboard-grid.d.ts +10 -5
  15. package/dist/internal/components/dashboard-grid.js +8 -9
  16. package/dist/internal/components/dev-toolbar.d.ts +27 -5
  17. package/dist/internal/components/dev-toolbar.js +214 -176
  18. package/dist/internal/components/ekanos-logo.d.ts +18 -0
  19. package/dist/internal/components/ekanos-logo.js +74 -0
  20. package/dist/internal/components/events-panel.d.ts +13 -4
  21. package/dist/internal/components/events-panel.js +478 -81
  22. package/dist/internal/components/harness-widget-provider.d.ts +6 -8
  23. package/dist/internal/components/harness-widget-provider.js +5 -19
  24. package/dist/internal/components/health-panel.d.ts +8 -1
  25. package/dist/internal/components/health-panel.js +328 -31
  26. package/dist/internal/components/integration-badge.js +4 -2
  27. package/dist/internal/components/integration-tab-skeletons.d.ts +8 -0
  28. package/dist/internal/components/integration-tab-skeletons.js +76 -0
  29. package/dist/internal/components/not-found-state.d.ts +39 -0
  30. package/dist/internal/components/not-found-state.js +127 -0
  31. package/dist/internal/components/operation-runner-panel.d.ts +1 -1
  32. package/dist/internal/components/operation-runner-panel.js +624 -189
  33. package/dist/internal/components/operation-scope.d.ts +13 -0
  34. package/dist/internal/components/operation-scope.js +79 -0
  35. package/dist/internal/components/page-skeletons.d.ts +11 -0
  36. package/dist/internal/components/page-skeletons.js +61 -0
  37. package/dist/internal/components/provenance-banner.d.ts +13 -4
  38. package/dist/internal/components/provenance-banner.js +35 -10
  39. package/dist/internal/components/run-log-copy.d.ts +17 -0
  40. package/dist/internal/components/run-log-copy.js +67 -0
  41. package/dist/internal/components/run-log-detail.d.ts +22 -0
  42. package/dist/internal/components/run-log-detail.js +295 -0
  43. package/dist/internal/components/run-log-empty.d.ts +13 -0
  44. package/dist/internal/components/run-log-empty.js +46 -0
  45. package/dist/internal/components/run-log.d.ts +23 -3
  46. package/dist/internal/components/run-log.js +384 -130
  47. package/dist/internal/components/runtime-strip.d.ts +5 -1
  48. package/dist/internal/components/runtime-strip.js +115 -10
  49. package/dist/internal/components/schema-form.d.ts +2 -1
  50. package/dist/internal/components/schema-form.js +212 -79
  51. package/dist/internal/components/scrollable-nav.js +14 -2
  52. package/dist/internal/components/segmented-control.d.ts +19 -0
  53. package/dist/internal/components/segmented-control.js +46 -0
  54. package/dist/internal/components/shell-header.d.ts +25 -0
  55. package/dist/internal/components/shell-header.js +126 -0
  56. package/dist/internal/components/surface-nav.d.ts +12 -3
  57. package/dist/internal/components/surface-nav.js +72 -83
  58. package/dist/internal/components/widget-surface.d.ts +5 -1
  59. package/dist/internal/components/widget-surface.js +86 -14
  60. package/dist/internal/components/workflow-runner.d.ts +23 -10
  61. package/dist/internal/components/workflow-runner.js +451 -69
  62. package/dist/internal/lib/connect-model.d.ts +134 -0
  63. package/dist/internal/lib/connect-model.js +282 -0
  64. package/dist/internal/lib/connection-facts.js +2 -1
  65. package/dist/internal/lib/console-client.js +5 -2
  66. package/dist/internal/lib/console-hooks.d.ts +4 -1
  67. package/dist/internal/lib/console-hooks.js +3 -2
  68. package/dist/internal/lib/console-types.d.ts +6 -0
  69. package/dist/internal/lib/docs-links.d.ts +28 -0
  70. package/dist/internal/lib/docs-links.js +57 -1
  71. package/dist/internal/lib/event-delivery.d.ts +33 -0
  72. package/dist/internal/lib/event-delivery.js +66 -0
  73. package/dist/internal/lib/experience-runtime.d.ts +2 -1
  74. package/dist/internal/lib/experience-runtime.js +5 -3
  75. package/dist/internal/lib/font-files/OFL-BricolageGrotesque.txt +93 -0
  76. package/dist/internal/lib/font-files/OFL-Figtree.txt +93 -0
  77. package/dist/internal/lib/font-files/bricolage-grotesque-latin-variable.woff2 +0 -0
  78. package/dist/internal/lib/font-files/figtree-latin-variable.woff2 +0 -0
  79. package/dist/internal/lib/fonts.js +13 -12
  80. package/dist/internal/lib/health-model.d.ts +58 -0
  81. package/dist/internal/lib/health-model.js +140 -0
  82. package/dist/internal/lib/integration-console-href.d.ts +15 -0
  83. package/dist/internal/lib/integration-console-href.js +16 -0
  84. package/dist/internal/lib/oauth-setup-guide.d.ts +28 -0
  85. package/dist/internal/lib/oauth-setup-guide.js +35 -1
  86. package/dist/internal/lib/operation-catalog.d.ts +70 -0
  87. package/dist/internal/lib/operation-catalog.js +261 -0
  88. package/dist/internal/lib/overview-model.d.ts +34 -0
  89. package/dist/internal/lib/overview-model.js +91 -0
  90. package/dist/internal/lib/registry-entry.d.ts +8 -0
  91. package/dist/internal/lib/registry-entry.js +11 -0
  92. package/dist/internal/lib/repo-name.d.ts +9 -0
  93. package/dist/internal/lib/repo-name.js +21 -0
  94. package/dist/internal/lib/run-log-view.d.ts +66 -1
  95. package/dist/internal/lib/run-log-view.js +183 -4
  96. package/dist/internal/lib/runner-view.d.ts +15 -0
  97. package/dist/internal/lib/runner-view.js +18 -0
  98. package/dist/internal/lib/schema-form-model.d.ts +17 -0
  99. package/dist/internal/lib/schema-form-model.js +50 -0
  100. package/dist/internal/lib/setup-checklist.d.ts +34 -0
  101. package/dist/internal/lib/setup-checklist.js +79 -0
  102. package/dist/internal/lib/toolbar-context.d.ts +0 -1
  103. package/dist/internal/lib/toolbar-context.js +0 -2
  104. package/dist/internal/lib/toolbar-visibility.d.ts +9 -2
  105. package/dist/internal/lib/toolbar-visibility.js +5 -0
  106. package/dist/internal/lib/use-operation-effects.d.ts +7 -0
  107. package/dist/internal/lib/use-operation-effects.js +28 -0
  108. package/dist/internal/lib/use-run-log-query.d.ts +9 -0
  109. package/dist/internal/lib/use-run-log-query.js +35 -0
  110. package/dist/internal/lib/widget-grid-gaps.d.ts +18 -0
  111. package/dist/internal/lib/widget-grid-gaps.js +41 -0
  112. package/dist/internal/lib/workflow-summary.d.ts +54 -0
  113. package/dist/internal/lib/workflow-summary.js +147 -0
  114. package/dist/internal/routes/console-home-page.js +2 -1
  115. package/dist/internal/routes/experience-connect-page.js +51 -22
  116. package/dist/internal/routes/experience-layout-page.js +75 -26
  117. package/dist/internal/routes/experience-page-host.js +63 -5
  118. package/dist/internal/routes/experience-review-queue-page.d.ts +4 -1
  119. package/dist/internal/routes/experience-review-queue-page.js +108 -12
  120. package/dist/internal/routes/experience-runs-page.js +57 -4
  121. package/dist/internal/routes/experience-summary-page.d.ts +19 -0
  122. package/dist/internal/routes/experience-summary-page.js +219 -62
  123. package/dist/internal/routes/experience-widget-page.js +58 -7
  124. package/dist/internal/routes/experience-widgets-page.d.ts +2 -3
  125. package/dist/internal/routes/experience-widgets-page.js +29 -4
  126. package/dist/internal/routes/experience-workflow-page.js +81 -9
  127. package/dist/internal/routes/experience-workflows-page.js +85 -21
  128. package/dist/internal/routes/integration-layout.js +28 -3
  129. package/dist/internal/routes/integrations-connect-page.js +16 -6
  130. package/dist/internal/routes/integrations-events-page.js +22 -1
  131. package/dist/internal/routes/integrations-health-page.js +16 -1
  132. package/dist/internal/routes/integrations-layout.js +28 -4
  133. package/dist/internal/routes/integrations-list-page.d.ts +0 -1
  134. package/dist/internal/routes/integrations-list-page.js +11 -9
  135. package/dist/internal/routes/integrations-operation-page.js +53 -17
  136. package/dist/internal/routes/integrations-operations-page.js +539 -49
  137. package/dist/internal/routes/integrations-overview-page.js +332 -69
  138. package/dist/internal/routes/integrations-runs-page.js +53 -3
  139. package/dist/internal/routes/integrations-scope.d.ts +15 -2
  140. package/dist/internal/routes/integrations-scope.js +66 -18
  141. package/dist/internal/routes/preview-index-page.js +2 -2
  142. package/dist/internal/routes/repo-home-page.d.ts +2 -2
  143. package/dist/internal/routes/repo-home-page.js +428 -236
  144. package/dist/internal/routes/repo-layout.d.ts +12 -0
  145. package/dist/internal/routes/repo-layout.js +50 -38
  146. package/dist/internal/routes/repo-package-layouts.js +22 -8
  147. package/dist/internal/routes/single-widget-page.d.ts +1 -1
  148. package/dist/internal/routes/single-widget-page.js +28 -5
  149. package/dist/internal/routes/tile-page.d.ts +1 -1
  150. package/dist/internal/routes/tile-page.js +1 -2
  151. package/dist/internal/routes/widgets-page.d.ts +1 -1
  152. package/dist/internal/routes/widgets-page.js +5 -3
  153. package/dist/internal/server/ekanos-api-router.js +20 -5
  154. package/dist/internal/server/repo-api-router.js +20 -7
  155. package/dist/registry.d.ts +4 -5
  156. package/dist/registry.js +0 -1
  157. package/dist/routes.d.ts +5 -0
  158. package/dist/routes.js +2 -0
  159. package/package.json +8 -8
@@ -0,0 +1,46 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { Button } from "@ekanos/ui/button";
4
+ import { cn } from "@ekanos/ui/utils";
5
+ function SegmentedControl({
6
+ label,
7
+ testPrefix,
8
+ options,
9
+ value,
10
+ onChange,
11
+ className
12
+ }) {
13
+ return /* @__PURE__ */ jsx(
14
+ "div",
15
+ {
16
+ role: "group",
17
+ "aria-label": label,
18
+ className: cn(
19
+ "bg-secondary inline-flex shrink-0 gap-0.5 rounded-md p-0.5",
20
+ className
21
+ ),
22
+ children: options.map((option) => {
23
+ const active = option.value === value;
24
+ const reason = option.disabledReason ?? null;
25
+ return /* @__PURE__ */ jsx(
26
+ Button,
27
+ {
28
+ type: "button",
29
+ size: "sm",
30
+ variant: active ? "outline" : "ghost",
31
+ disabled: reason !== null,
32
+ title: reason ?? void 0,
33
+ "aria-pressed": active,
34
+ "data-test": `${testPrefix}-${option.value}`,
35
+ onClick: () => onChange(option.value),
36
+ children: option.label
37
+ },
38
+ option.value
39
+ );
40
+ })
41
+ }
42
+ );
43
+ }
44
+ export {
45
+ SegmentedControl
46
+ };
@@ -0,0 +1,25 @@
1
+ import { type ReactNode } from 'react';
2
+ export interface Crumb {
3
+ label: string;
4
+ /** Absent on the page you are on. */
5
+ href?: string;
6
+ }
7
+ export declare function ThemeToggleButton(): import("react").JSX.Element;
8
+ export declare function Breadcrumb({ crumbs }: {
9
+ crumbs: readonly Crumb[];
10
+ }): import("react").JSX.Element | null;
11
+ /**
12
+ * The one header every harness page wears: breadcrumb, the title with its
13
+ * quiet facts beside it, Docs (for the screen you are on) and the theme
14
+ * toggle on the same line, then the tabs.
15
+ */
16
+ export declare function ShellHeader({ crumbs, title, kind, meta, tabs, testId, }: {
17
+ crumbs?: readonly Crumb[];
18
+ title: ReactNode;
19
+ /** `repo`, `integration`, `experience`. */
20
+ kind: string;
21
+ /** Chips beside the title. */
22
+ meta?: ReactNode;
23
+ tabs?: ReactNode;
24
+ testId?: string;
25
+ }): import("react").JSX.Element;
@@ -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,10 +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 repo gets the experience tabs plus
28
- * a console tab for every integration, each carrying its provenance badge.
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.
29
38
  */
30
39
  export declare function ConsoleNav({ project, pendingApprovals, }: {
31
40
  project: ConsoleProject;
@@ -6,10 +6,14 @@ import { Icon } from "@ekanos/ui/icon";
6
6
  import { cn } from "@ekanos/ui/utils";
7
7
  import { useConsoleLinks } from "../lib/console-context.js";
8
8
  import { SURFACE_DOCS } from "../lib/docs-links.js";
9
+ import { integrationConsoleHref } from "../lib/integration-console-href.js";
9
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";
10
13
  import { DocsLink } from "./docs-link.js";
11
- import { ProvenanceBadge } from "./integration-badge.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,98 +209,74 @@ function TabLink({ tab, pathname }) {
198
209
  }
199
210
  );
200
211
  }
201
- function IntegrationTab({
202
- integration,
203
- pathname
212
+ function ApprovalsBadge({
213
+ count,
214
+ href
204
215
  }) {
205
- const href = `/integrations/${integration.integration}`;
206
- const active = pathname === href || pathname.startsWith(`${href}/`);
207
- return /* @__PURE__ */ jsxs(
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(
208
219
  Link,
209
220
  {
210
221
  href,
211
- "aria-current": active ? "page" : void 0,
212
- "data-test": `integration-tab-${integration.integration}`,
213
- className: cn(
214
- "flex items-center gap-2 rounded-md px-3 py-2 whitespace-nowrap transition-colors",
215
- FOCUS_RING,
216
- active ? "bg-accent text-accent-foreground text-sm font-medium" : "text-muted-foreground hover:bg-accent text-sm"
217
- ),
222
+ className: cn(className, "hover:underline", FOCUS_RING),
223
+ "data-test": "pending-approvals",
218
224
  children: [
219
- integration.integration,
220
- /* @__PURE__ */ jsx(ProvenanceBadge, { provenance: integration.provenance })
225
+ /* @__PURE__ */ jsx(Icon, { name: "hand", className: "h-3.5 w-3.5" }),
226
+ label
221
227
  ]
222
228
  }
223
- );
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
+ ] });
224
233
  }
225
234
  function ConsoleNav({
226
235
  project,
227
236
  pendingApprovals = 0
228
237
  }) {
229
- const pathname = usePathname();
238
+ const pathname = usePathname() ?? "";
230
239
  const links = useConsoleLinks();
240
+ const repo = useRepoName();
231
241
  const own = project.integrations[0];
232
- return /* @__PURE__ */ jsxs(
233
- "div",
242
+ const current = project.kind === "experience" ? project.integrations.flatMap((integration) => {
243
+ const href = integrationConsoleHref(integration);
244
+ return href ? [{ integration, href }] : [];
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,
234
264
  {
235
- className: "flex flex-col gap-3 border-b px-4 py-4 sm:px-6",
236
- "data-test": "console-nav",
237
- children: [
238
- links.repoHome ? /* @__PURE__ */ jsxs(
239
- 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,
240
273
  {
241
- href: links.repoHome,
242
- className: "text-muted-foreground hover:text-foreground w-fit text-sm",
243
- "data-test": "back-to-repo",
244
- children: [
245
- /* @__PURE__ */ jsx(Icon, { name: "arrow-left", className: "mr-2 h-4 w-4" }),
246
- "This repo"
247
- ]
274
+ count: pendingApprovals,
275
+ href: project.kind === "experience" ? `${links.experience}/review-queue` : null
248
276
  }
249
- ) : null,
250
- /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-baseline gap-3", children: [
251
- /* @__PURE__ */ jsx("h1", { className: "font-heading font-heading-semibold text-2xl tracking-tight", children: project.name }),
252
- /* @__PURE__ */ jsx(
253
- "code",
254
- {
255
- className: "text-muted-foreground text-xs",
256
- "data-test": "project-kind",
257
- children: project.kind
258
- }
259
- ),
260
- pendingApprovals > 0 ? /* @__PURE__ */ jsxs(
261
- Link,
262
- {
263
- href: project.kind === "experience" ? `${links.experience}/workflows` : "#approvals",
264
- className: "bg-warning text-warning-foreground ml-auto rounded-full px-3 py-1 text-sm font-medium",
265
- "data-test": "pending-approvals",
266
- children: [
267
- pendingApprovals,
268
- " awaiting approval"
269
- ]
270
- }
271
- ) : null
272
- ] }),
273
- project.kind === "integration" ? own ? /* @__PURE__ */ jsxs(ScrollableNav, { label: "Integration console", children: [
274
- integrationTabs(own.integration).map((tab) => /* @__PURE__ */ jsx(TabLink, { tab, pathname }, tab.href)),
275
- project.legacySurfaces ? /* @__PURE__ */ jsx(TabLink, { tab: previewTab(own.integration), pathname }) : null
276
- ] }) : null : /* @__PURE__ */ jsxs(Fragment, { children: [
277
- /* @__PURE__ */ jsx(ScrollableNav, { label: "Experience", children: experienceTabs(links.experience, links.repoHome !== null).map(
278
- (tab) => /* @__PURE__ */ jsx(TabLink, { tab, pathname }, tab.href)
279
- ) }),
280
- /* @__PURE__ */ jsxs(ScrollableNav, { label: "Integration consoles", className: "items-center", children: [
281
- /* @__PURE__ */ jsx("span", { className: "text-muted-foreground px-1 text-xs whitespace-nowrap", children: "Integrations:" }),
282
- project.integrations.map((integration) => /* @__PURE__ */ jsx(
283
- IntegrationTab,
284
- {
285
- integration,
286
- pathname
287
- },
288
- integration.integration
289
- ))
290
- ] })
291
- ] })
292
- ]
277
+ ) : null
278
+ ] }),
279
+ tabs
293
280
  }
294
281
  );
295
282
  }
@@ -297,7 +284,9 @@ export {
297
284
  ConsoleNav,
298
285
  EXPERIENCE_TABS,
299
286
  PreviewNav,
287
+ TabLink,
300
288
  experienceTabs,
301
289
  integrationTabs,
302
- previewTab
290
+ previewTab,
291
+ tabActive
303
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;