@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,11 +1,28 @@
1
1
  "use client";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
+ import Link from "next/link";
3
4
  import { Alert, AlertDescription } from "@ekanos/ui/alert";
5
+ import { Button } from "@ekanos/ui/button";
4
6
  import { Card } from "@ekanos/ui/card";
7
+ import { EmptyNote } from "@ekanos/ui/empty-note";
8
+ import {
9
+ EmptyMedia,
10
+ EmptyState,
11
+ EmptyStateHeading,
12
+ EmptyStateText
13
+ } from "@ekanos/ui/empty-state";
14
+ import { Icon } from "@ekanos/ui/icon";
15
+ import { Skeleton } from "@ekanos/ui/skeleton";
5
16
  import { StatusBadge } from "@ekanos/ui/status-badge";
6
17
  import { useQuery } from "@tanstack/react-query";
7
- import { useConsoleClient } from "../lib/console-context.js";
8
- import { useExperience } from "../lib/console-hooks.js";
18
+ import { ApprovalList, DecisionLog } from "../components/approvals-tray.js";
19
+ import { DocsLink } from "../components/docs-link.js";
20
+ import { PageSkeleton } from "../components/page-skeletons.js";
21
+ import { useConsoleClient, useConsoleLinks } from "../lib/console-context.js";
22
+ import { useApprovals, useExperience } from "../lib/console-hooks.js";
23
+ import { DOCS } from "../lib/docs-links.js";
24
+ import { shortName } from "../lib/setup-checklist.js";
25
+ import { hasApprovalGate, splitOpKey } from "../lib/workflow-summary.js";
9
26
  function Section({ section }) {
10
27
  const client = useConsoleClient();
11
28
  const result = useQuery({
@@ -29,30 +46,109 @@ function Section({ section }) {
29
46
  children: [
30
47
  /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
31
48
  /* @__PURE__ */ jsx("h3", { className: "text-sm font-medium", children: section.title }),
32
- /* @__PURE__ */ jsxs("code", { className: "text-muted-foreground text-xs", children: [
33
- section.integration,
34
- ":",
35
- section.opKey
49
+ /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground text-xs", children: [
50
+ "reads ",
51
+ shortName(section.integration),
52
+ " ",
53
+ /* @__PURE__ */ jsx("code", { children: splitOpKey(section.opKey)?.name ?? section.opKey })
36
54
  ] })
37
55
  ] }),
38
- result.isError ? /* @__PURE__ */ jsx(Alert, { variant: "destructive", children: /* @__PURE__ */ jsx(AlertDescription, { children: result.error.message }) }) : result.data?.status === "ok" ? /* @__PURE__ */ jsx("pre", { className: "bg-muted max-h-72 overflow-auto rounded-md p-3 text-xs", children: JSON.stringify(result.data.output, null, 2) }) : result.data?.status === "refused" ? /* @__PURE__ */ jsxs(StatusBadge, { tone: "destructive", children: [
56
+ result.isError ? /* @__PURE__ */ jsx(Alert, { variant: "destructive", children: /* @__PURE__ */ jsxs(AlertDescription, { children: [
57
+ "The read failed: ",
58
+ result.error.message
59
+ ] }) }) : result.data?.status === "ok" ? /* @__PURE__ */ jsx("pre", { className: "bg-muted max-h-72 overflow-auto rounded-md p-3 text-xs", children: JSON.stringify(result.data.output, null, 2) }) : result.data?.status === "refused" ? /* @__PURE__ */ jsxs(StatusBadge, { tone: "destructive", children: [
39
60
  result.data.reason,
40
61
  ": ",
41
62
  result.data.message
42
- ] }) : /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-xs", children: "Loading\u2026" })
63
+ ] }) : /* @__PURE__ */ jsx(Skeleton, { className: "h-24 w-full" })
43
64
  ]
44
65
  }
45
66
  );
46
67
  }
68
+ function NothingWaiting({
69
+ workflows
70
+ }) {
71
+ const links = useConsoleLinks();
72
+ const gated = workflows.find(hasApprovalGate);
73
+ return /* @__PURE__ */ jsxs(EmptyState, { className: "py-12", "data-test": "review-queue-empty", children: [
74
+ /* @__PURE__ */ jsx(EmptyMedia, { variant: "icon", children: /* @__PURE__ */ jsx(Icon, { name: "tray" }) }),
75
+ /* @__PURE__ */ jsx(EmptyStateHeading, { children: "Nothing waiting for approval" }),
76
+ /* @__PURE__ */ jsxs(EmptyStateText, { className: "max-w-md", children: [
77
+ "When a workflow reaches an approval gate, it stops here until you approve or reject it.",
78
+ " ",
79
+ gated ? `Run ${gated.title} to see one.` : "None of this experience\u2019s workflows has an approval gate yet."
80
+ ] }),
81
+ /* @__PURE__ */ jsx(
82
+ Button,
83
+ {
84
+ className: "mt-4",
85
+ nativeButton: false,
86
+ render: /* @__PURE__ */ jsx(
87
+ Link,
88
+ {
89
+ href: gated ? `${links.experience}/workflows/${gated.id}` : `${links.experience}/workflows`
90
+ }
91
+ ),
92
+ "data-test": "review-queue-empty-action",
93
+ children: gated ? `Open ${gated.title}` : "Open workflows"
94
+ }
95
+ )
96
+ ] });
97
+ }
47
98
  function ExperienceReviewQueuePage() {
48
99
  const experience = useExperience();
100
+ const approvals = useApprovals();
49
101
  const sections = experience.data?.reviewQueue ?? [];
102
+ const workflows = experience.data?.workflows ?? [];
103
+ const waiting = approvals.data ?? [];
50
104
  if (experience.isPending) {
51
- return /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm", children: "Loading\u2026" });
105
+ return /* @__PURE__ */ jsx(PageSkeleton, { label: "Loading the review queue" });
52
106
  }
53
- return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", "data-test": "experience-review-queue", children: [
54
- /* @__PURE__ */ jsx("h2", { className: "font-heading text-xl font-normal", children: "Review queue" }),
55
- sections.length === 0 ? /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm", children: "This experience declares no review-queue sections." }) : /* @__PURE__ */ jsx("ul", { className: "flex flex-col gap-3", children: sections.map((section) => /* @__PURE__ */ jsx(Section, { section }, section.id)) })
107
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-8", "data-test": "experience-review-queue", children: [
108
+ /* @__PURE__ */ jsxs("section", { className: "flex flex-col gap-3", "data-test": "review-approvals", children: [
109
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
110
+ /* @__PURE__ */ jsxs("h2", { className: "font-heading text-xl font-normal", children: [
111
+ "Waiting for approval",
112
+ waiting.length > 0 ? /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground", children: [
113
+ " (",
114
+ waiting.length,
115
+ ")"
116
+ ] }) : null
117
+ ] }),
118
+ /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm", children: "Workflow approval gates and held writes. Approving lets the run continue; rejecting stops it." })
119
+ ] }),
120
+ /* @__PURE__ */ jsx(DecisionLog, {}),
121
+ approvals.isPending ? /* @__PURE__ */ jsx(Skeleton, { className: "h-28 w-full" }) : waiting.length === 0 ? /* @__PURE__ */ jsx(NothingWaiting, { workflows }) : /* @__PURE__ */ jsx(
122
+ ApprovalList,
123
+ {
124
+ approvals: waiting,
125
+ workflowTitles: Object.fromEntries(
126
+ workflows.map((template) => [template.id, template.title])
127
+ )
128
+ }
129
+ )
130
+ ] }),
131
+ /* @__PURE__ */ jsxs("section", { className: "flex flex-col gap-3", "data-test": "review-sections", children: [
132
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
133
+ /* @__PURE__ */ jsx("h2", { className: "font-heading text-xl font-normal", children: "Review lists" }),
134
+ /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm", children: "Read-only lists this experience declares for a person to look over, each filled by one read operation." })
135
+ ] }),
136
+ sections.length === 0 ? /* @__PURE__ */ jsxs(
137
+ EmptyNote,
138
+ {
139
+ icon: "list-checks",
140
+ title: "No review lists",
141
+ action: /* @__PURE__ */ jsx(DocsLink, { href: DOCS.experiences, children: "defineExperience reference" }),
142
+ children: [
143
+ "Add ",
144
+ /* @__PURE__ */ jsx("code", { children: "reviewQueue" }),
145
+ " to ",
146
+ /* @__PURE__ */ jsx("code", { children: "defineExperience" }),
147
+ ", each section naming one read operation, and its results show here."
148
+ ]
149
+ }
150
+ ) : /* @__PURE__ */ jsx("ul", { className: "flex flex-col gap-3", children: sections.map((section) => /* @__PURE__ */ jsx(Section, { section }, section.id)) })
151
+ ] })
56
152
  ] });
57
153
  }
58
154
  export {
@@ -1,11 +1,64 @@
1
1
  "use client";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import { RunLog } from "../components/run-log.js";
4
+ import { RunLogEmpty } from "../components/run-log-empty.js";
5
+ import { useConsoleLinks } from "../lib/console-context.js";
6
+ import { useProject } from "../lib/console-hooks.js";
7
+ import { integrationConsoleHref } from "../lib/integration-console-href.js";
8
+ import { runTargetHref } from "../lib/run-log-view.js";
9
+ import { useRunLogQuery } from "../lib/use-run-log-query.js";
4
10
  function ExperienceRunsPage() {
5
- return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", "data-test": "experience-runs", children: [
6
- /* @__PURE__ */ jsx("h2", { className: "font-heading text-xl font-normal", children: "Run log" }),
7
- /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-xs", children: "Every operation call from any surface, with its provenance." }),
8
- /* @__PURE__ */ jsx(RunLog, {})
11
+ const links = useConsoleLinks();
12
+ const project = useProject();
13
+ const [query, setQuery] = useRunLogQuery();
14
+ const consoles = new Map(
15
+ (project.data?.integrations ?? []).map((integration) => [
16
+ integration.integration,
17
+ integrationConsoleHref(integration)
18
+ ])
19
+ );
20
+ const firstConsole = [...consoles.values()].find(
21
+ (href) => href !== null
22
+ );
23
+ const emptyLinks = [
24
+ {
25
+ href: `${links.experience}/workflows`,
26
+ label: "Run a workflow",
27
+ testId: "run-log-empty-workflows"
28
+ },
29
+ {
30
+ href: `${links.experience}/widgets`,
31
+ label: "Open the widgets",
32
+ testId: "run-log-empty-widgets"
33
+ },
34
+ ...firstConsole ? [
35
+ {
36
+ href: `${firstConsole}/operations`,
37
+ label: "Run an operation",
38
+ testId: "run-log-empty-operations"
39
+ }
40
+ ] : []
41
+ ];
42
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-6", "data-test": "experience-runs", children: [
43
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
44
+ /* @__PURE__ */ jsx("h2", { className: "font-heading text-xl font-normal", children: "Run log" }),
45
+ /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm", children: "Every operation this experience calls, from its widgets, pages, workflows and review queue, newest first. Open a run to see its status, timing and where it came from." })
46
+ ] }),
47
+ /* @__PURE__ */ jsx(
48
+ RunLog,
49
+ {
50
+ query,
51
+ onQueryChange: setQuery,
52
+ targetHrefFor: (run) => runTargetHref(consoles.get(run.integration) ?? null, run.opKey),
53
+ empty: /* @__PURE__ */ jsx(
54
+ RunLogEmpty,
55
+ {
56
+ text: "Each call the experience makes lands here as it happens: a widget loading, a workflow step, a review-queue action. Run a workflow or open a widget to see one.",
57
+ links: emptyLinks
58
+ }
59
+ )
60
+ }
61
+ )
9
62
  ] });
10
63
  }
11
64
  export {
@@ -1 +1,20 @@
1
+ import { type StatusTone } from '@ekanos/ui/status-badge';
2
+ import type { CheckStatus } from '../lib/console-types.js';
3
+ interface CheckLine {
4
+ id: string;
5
+ label: string;
6
+ tone: StatusTone;
7
+ status: string;
8
+ text: React.ReactNode;
9
+ }
10
+ /** The three checks, each in plain words: what it means and what to do. */
11
+ export declare function summaryChecks(input: {
12
+ overrides: number;
13
+ checks?: {
14
+ pins: CheckStatus;
15
+ boundary: CheckStatus;
16
+ } | undefined;
17
+ }): CheckLine[];
18
+ /** What this experience is, whether it is ready, and what there is to look at. */
1
19
  export declare function ExperienceSummaryPage(): import("react").JSX.Element;
20
+ export {};
@@ -1,98 +1,258 @@
1
1
  "use client";
2
2
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
3
  import Link from "next/link";
4
+ import { Card } from "@ekanos/ui/card";
5
+ import { Icon } from "@ekanos/ui/icon";
4
6
  import { StatusBadge } from "@ekanos/ui/status-badge";
5
- import {
6
- Table,
7
- TableBody,
8
- TableCell,
9
- TableHead,
10
- TableHeader,
11
- TableRow
12
- } from "@ekanos/ui/table";
7
+ import { cn } from "@ekanos/ui/utils";
13
8
  import {
14
9
  ProvenanceBadge,
15
- RunModeBadge,
16
10
  describeProvenance,
17
11
  provenanceDisplayPath,
18
12
  provenanceTitle
19
13
  } from "../components/integration-badge.js";
14
+ import { PageSkeleton } from "../components/page-skeletons.js";
20
15
  import { localIntegrations } from "../components/provenance-banner.js";
21
- import { useProject } from "../lib/console-hooks.js";
16
+ import { RuntimeStrip } from "../components/runtime-strip.js";
17
+ import { FOCUS_RING } from "../components/scrollable-nav.js";
18
+ import { useConsoleLinks, useExperienceSurfaces } from "../lib/console-context.js";
19
+ import { useExperience, useProject } from "../lib/console-hooks.js";
22
20
  import { integrationConsoleHref } from "../lib/integration-console-href.js";
23
21
  const CHECK_TONES = {
24
22
  ok: "success",
25
23
  failed: "destructive",
26
24
  unknown: "neutral"
27
25
  };
26
+ const BINDING_TEXT = {
27
+ team: "Uses the team's connection",
28
+ invoker: "Uses each person's own connection",
29
+ user: "Uses one named person's connection"
30
+ };
31
+ function summaryChecks(input) {
32
+ const lines = [
33
+ input.overrides > 0 ? {
34
+ id: "overrides",
35
+ label: "Local overrides",
36
+ tone: "warning",
37
+ status: `${input.overrides} active`,
38
+ text: /* @__PURE__ */ jsxs(Fragment, { children: [
39
+ input.overrides,
40
+ " integration",
41
+ input.overrides === 1 ? " is" : "s are",
42
+ " replaced by a local copy from ",
43
+ /* @__PURE__ */ jsx("code", { children: "ekanos.local.json" }),
44
+ ". Publishing is blocked until you delete that file."
45
+ ] })
46
+ } : {
47
+ id: "overrides",
48
+ label: "Local overrides",
49
+ tone: "success",
50
+ status: "None",
51
+ text: "Every integration resolves the way it will once published."
52
+ }
53
+ ];
54
+ if (input.checks) {
55
+ const { pins, boundary } = input.checks;
56
+ lines.push({
57
+ id: "pins",
58
+ label: "Integration versions",
59
+ tone: CHECK_TONES[pins],
60
+ status: pins === "ok" ? "Match" : pins === "failed" ? "Mismatch" : "Not checked",
61
+ text: pins === "ok" ? "Every integration version pinned in ekanos.json resolved to a contract." : pins === "failed" ? "A pinned integration version did not resolve. The errors at the top of the page say which; fix the version in ekanos.json or run ekanos sync." : "The harness did not check the pinned versions."
62
+ });
63
+ lines.push({
64
+ id: "boundary",
65
+ label: "Experience boundary",
66
+ tone: CHECK_TONES[boundary],
67
+ status: boundary === "ok" ? "Passed" : boundary === "failed" ? "Failed" : "Not checked here",
68
+ text: boundary === "unknown" ? /* @__PURE__ */ jsxs(Fragment, { children: [
69
+ "Whether the code reaches integrations only through their contracts (no direct imports of an integration package). Run",
70
+ " ",
71
+ /* @__PURE__ */ jsx("code", { children: "ekanos check" }),
72
+ " to check it."
73
+ ] }) : boundary === "ok" ? "The code reaches integrations only through their contracts." : /* @__PURE__ */ jsxs(Fragment, { children: [
74
+ "The code imports an integration package directly. Run",
75
+ " ",
76
+ /* @__PURE__ */ jsx("code", { children: "ekanos check" }),
77
+ " for the file and line."
78
+ ] })
79
+ });
80
+ }
81
+ return lines;
82
+ }
28
83
  function IntegrationConsoleLink({
29
84
  integration
30
85
  }) {
31
86
  const href = integrationConsoleHref(integration);
32
87
  const label = `${integration.integration}@${integration.version}`;
33
- return href ? /* @__PURE__ */ jsx(Link, { href, className: "hover:underline", children: label }) : /* @__PURE__ */ jsx("span", { children: label });
88
+ return href ? /* @__PURE__ */ jsx(
89
+ Link,
90
+ {
91
+ href,
92
+ className: cn("rounded-sm font-mono text-sm hover:underline", FOCUS_RING),
93
+ children: label
94
+ }
95
+ ) : /* @__PURE__ */ jsx("span", { className: "font-mono text-sm", children: label });
96
+ }
97
+ function SurfaceCard({
98
+ href,
99
+ icon,
100
+ title,
101
+ count: count2,
102
+ text,
103
+ testId
104
+ }) {
105
+ return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(
106
+ Card,
107
+ {
108
+ layout: "bleed",
109
+ render: /* @__PURE__ */ jsx(Link, { href }),
110
+ className: cn(
111
+ "hover:bg-muted group flex h-full flex-col gap-2 p-4 transition-colors",
112
+ FOCUS_RING
113
+ ),
114
+ "data-test": testId,
115
+ children: [
116
+ /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2 text-sm font-medium", children: [
117
+ /* @__PURE__ */ jsx(Icon, { name: icon, className: "text-muted-foreground h-4 w-4" }),
118
+ /* @__PURE__ */ jsx("span", { className: "group-hover:underline", children: title }),
119
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground ml-auto text-xs font-normal", children: count2 })
120
+ ] }),
121
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-xs", children: text })
122
+ ]
123
+ }
124
+ ) });
125
+ }
126
+ function count(value, noun) {
127
+ return `${value} ${noun}${value === 1 ? "" : "s"}`;
34
128
  }
35
129
  function ExperienceSummaryPage() {
36
130
  const project = useProject();
131
+ const experience = useExperience();
132
+ const links = useConsoleLinks();
133
+ const { widgets, pages, suggestedLayout } = useExperienceSurfaces();
37
134
  if (!project.data) {
38
- return /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm", children: "Loading\u2026" });
135
+ return /* @__PURE__ */ jsx(PageSkeleton, { label: "Loading the experience" });
39
136
  }
40
- const { integrations, checks } = project.data;
41
- const overrides = localIntegrations(integrations).length;
42
- return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-6", "data-test": "experience-summary", children: [
43
- /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-3", children: [
44
- /* @__PURE__ */ jsx("h2", { className: "font-heading text-xl font-normal", children: "Integrations" }),
45
- /* @__PURE__ */ jsx(StatusBadge, { tone: overrides > 0 ? "warning" : "success", children: overrides > 0 ? `${overrides} local override${overrides === 1 ? "" : "s"}` : "no overrides" }),
46
- checks ? /* @__PURE__ */ jsxs(Fragment, { children: [
47
- /* @__PURE__ */ jsxs(StatusBadge, { tone: CHECK_TONES[checks.pins], children: [
48
- "integration pins: ",
49
- checks.pins
50
- ] }),
51
- /* @__PURE__ */ jsxs(StatusBadge, { tone: CHECK_TONES[checks.boundary], children: [
52
- "boundary: ",
53
- checks.boundary
54
- ] })
55
- ] }) : null
137
+ const { integrations } = project.data;
138
+ const checks = experience.data?.checks ?? project.data.checks;
139
+ const workflows = experience.data?.workflows ?? [];
140
+ const reviewSections = experience.data?.reviewQueue ?? [];
141
+ const lines = summaryChecks({
142
+ overrides: localIntegrations(integrations).length,
143
+ checks
144
+ });
145
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-8", "data-test": "experience-summary", children: [
146
+ /* @__PURE__ */ jsxs("section", { className: "flex flex-col gap-3", children: [
147
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
148
+ /* @__PURE__ */ jsx("h2", { className: "font-heading text-xl font-normal", children: "Is it ready?" }),
149
+ /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm", children: "Each integration answers from fixtures until it is connected. Widgets and workflows work either way." })
150
+ ] }),
151
+ /* @__PURE__ */ jsx(RuntimeStrip, {})
152
+ ] }),
153
+ /* @__PURE__ */ jsxs("section", { className: "flex flex-col gap-3", children: [
154
+ /* @__PURE__ */ jsx("h2", { className: "font-heading text-xl font-normal", children: "What to look at" }),
155
+ /* @__PURE__ */ jsxs("ul", { className: "grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4", children: [
156
+ /* @__PURE__ */ jsx(
157
+ SurfaceCard,
158
+ {
159
+ href: `${links.experience}/widgets`,
160
+ icon: "grid-four",
161
+ title: "Widgets",
162
+ count: count(widgets.length, "widget"),
163
+ text: "Every widget rendered with the experience's data.",
164
+ testId: "summary-widgets"
165
+ }
166
+ ),
167
+ /* @__PURE__ */ jsx(
168
+ SurfaceCard,
169
+ {
170
+ href: `${links.experience}/workflows`,
171
+ icon: "flow-arrow",
172
+ title: "Workflows",
173
+ count: count(workflows.length, "template"),
174
+ text: "Step through each template and run it here.",
175
+ testId: "summary-workflows"
176
+ }
177
+ ),
178
+ /* @__PURE__ */ jsx(
179
+ SurfaceCard,
180
+ {
181
+ href: `${links.experience}/layout`,
182
+ icon: "layout",
183
+ title: "Layout",
184
+ count: suggestedLayout ? count(suggestedLayout.workspaces.length, "workspace") : "None yet",
185
+ text: `How ${count(pages.length, "page")} and the widgets would arrange into workspaces.`,
186
+ testId: "summary-layout"
187
+ }
188
+ ),
189
+ /* @__PURE__ */ jsx(
190
+ SurfaceCard,
191
+ {
192
+ href: `${links.experience}/review-queue`,
193
+ icon: "tray",
194
+ title: "Review queue",
195
+ count: count(reviewSections.length, "list"),
196
+ text: "Approvals waiting for you and the lists to review.",
197
+ testId: "summary-review-queue"
198
+ }
199
+ )
200
+ ] })
56
201
  ] }),
57
- /* @__PURE__ */ jsx("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxs(Table, { children: [
58
- /* @__PURE__ */ jsx(TableHeader, { children: /* @__PURE__ */ jsxs(TableRow, { children: [
59
- /* @__PURE__ */ jsx(TableHead, { children: "Integration" }),
60
- /* @__PURE__ */ jsx(TableHead, { children: "Provenance" }),
61
- /* @__PURE__ */ jsx(TableHead, { children: "Run modes" }),
62
- /* @__PURE__ */ jsx(TableHead, { children: "Binding" })
63
- ] }) }),
64
- /* @__PURE__ */ jsx(TableBody, { children: integrations.map((integration) => /* @__PURE__ */ jsxs(
65
- TableRow,
202
+ /* @__PURE__ */ jsxs("section", { className: "flex flex-col gap-3", "data-test": "summary-checks", children: [
203
+ /* @__PURE__ */ jsx("h2", { className: "font-heading text-xl font-normal", children: "Checks" }),
204
+ /* @__PURE__ */ jsx(Card, { layout: "bleed", className: "divide-y", children: lines.map((line) => /* @__PURE__ */ jsxs(
205
+ "div",
66
206
  {
207
+ className: "flex flex-col gap-1 px-4 py-3 sm:flex-row sm:items-start sm:gap-4",
208
+ "data-test": `check-${line.id}`,
209
+ children: [
210
+ /* @__PURE__ */ jsx("span", { className: "flex items-center gap-2 text-sm font-medium sm:w-48 sm:shrink-0", children: line.label }),
211
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground flex-1 text-sm", children: line.text }),
212
+ /* @__PURE__ */ jsx(StatusBadge, { tone: line.tone, className: "self-start", children: line.status })
213
+ ]
214
+ },
215
+ line.id
216
+ )) })
217
+ ] }),
218
+ /* @__PURE__ */ jsxs("section", { className: "flex flex-col gap-3", children: [
219
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
220
+ /* @__PURE__ */ jsx("h2", { className: "font-heading text-xl font-normal", children: "Integrations" }),
221
+ /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm", children: "Where each one is loaded from, and whose connection it uses." })
222
+ ] }),
223
+ /* @__PURE__ */ jsx(Card, { layout: "bleed", render: /* @__PURE__ */ jsx("ul", {}), className: "divide-y", children: integrations.map((integration) => /* @__PURE__ */ jsxs(
224
+ "li",
225
+ {
226
+ className: "flex flex-col gap-2 px-4 py-3 sm:flex-row sm:items-center sm:gap-4",
67
227
  "data-test": "integration-row",
68
228
  children: [
69
- /* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsx(IntegrationConsoleLink, { integration }) }),
70
- /* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
71
- /* @__PURE__ */ jsx(
72
- ProvenanceBadge,
73
- {
74
- provenance: integration.provenance,
75
- own: integration.own === true
76
- }
77
- ),
229
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
230
+ /* @__PURE__ */ jsx(IntegrationConsoleLink, { integration }),
78
231
  /* @__PURE__ */ jsx(
79
232
  "span",
80
233
  {
81
- className: "text-muted-foreground text-xs",
234
+ className: "text-muted-foreground truncate text-xs",
82
235
  title: provenanceTitle(integration.provenance),
83
236
  children: provenanceDisplayPath(integration.provenance) || describeProvenance(integration.provenance)
84
237
  }
85
238
  )
86
- ] }) }),
87
- /* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsx("div", { className: "flex gap-1", children: integration.runModes.map((mode) => /* @__PURE__ */ jsx(RunModeBadge, { mode }, mode)) }) }),
88
- /* @__PURE__ */ jsx(TableCell, { className: "text-xs", children: integration.bindingMode ?? "default" })
239
+ ] }),
240
+ /* @__PURE__ */ jsx(
241
+ ProvenanceBadge,
242
+ {
243
+ provenance: integration.provenance,
244
+ own: integration.own === true
245
+ }
246
+ ),
247
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-xs", children: BINDING_TEXT[integration.bindingMode ?? "team"] ?? `Binding: ${integration.bindingMode}` })
89
248
  ]
90
249
  },
91
250
  integration.integration
92
251
  )) })
93
- ] }) })
252
+ ] })
94
253
  ] });
95
254
  }
96
255
  export {
97
- ExperienceSummaryPage
256
+ ExperienceSummaryPage,
257
+ summaryChecks
98
258
  };
@@ -1,25 +1,76 @@
1
1
  "use client";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
- import { notFound, useParams } from "next/navigation";
3
+ import Link from "next/link";
4
+ import { useParams } from "next/navigation";
5
+ import { Icon } from "@ekanos/ui/icon";
6
+ import { cn } from "@ekanos/ui/utils";
7
+ import { NotFoundState } from "../components/not-found-state.js";
8
+ import { FOCUS_RING } from "../components/scrollable-nav.js";
4
9
  import {
5
10
  WidgetSurface,
6
11
  withFocusedDefault
7
12
  } from "../components/widget-surface.js";
8
- import { useExperienceSurfaces } from "../lib/console-context.js";
13
+ import { useConsoleLinks, useExperienceSurfaces } from "../lib/console-context.js";
9
14
  import { useProject } from "../lib/console-hooks.js";
15
+ import { declaredWidthLabel } from "../lib/widget-grid-gaps.js";
10
16
  function ExperienceWidgetPage() {
11
17
  const { id } = useParams();
12
18
  const project = useProject();
19
+ const links = useConsoleLinks();
13
20
  const { widgets } = useExperienceSurfaces();
14
- const widget = widgets.find((entry) => entry.id === id);
15
- if (!widget) notFound();
21
+ const widgetId = decodeURIComponent(id);
22
+ const widget = widgets.find((entry) => entry.id === widgetId);
23
+ const allHref = `${links.experience}/widgets`;
24
+ if (!widget) {
25
+ return /* @__PURE__ */ jsx(
26
+ NotFoundState,
27
+ {
28
+ testId: "widget-not-found",
29
+ title: `No widget called \u201C${widgetId}\u201D`,
30
+ description: "This experience registers no widget with that id. Pick one it does register.",
31
+ options: widgets.map((entry) => ({
32
+ label: entry.id,
33
+ href: `${allHref}/${encodeURIComponent(entry.id)}`,
34
+ hint: entry.title
35
+ })),
36
+ ...widgets.length > 0 ? { optionsLabel: "The widgets in this experience" } : {},
37
+ action: { label: "All widgets", href: allHref }
38
+ }
39
+ );
40
+ }
41
+ const focused = withFocusedDefault(widget);
16
42
  return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", "data-test": "experience-widget", children: [
17
- /* @__PURE__ */ jsx("h2", { className: "font-heading text-xl font-normal", children: widget.title }),
43
+ /* @__PURE__ */ jsxs(
44
+ Link,
45
+ {
46
+ href: allHref,
47
+ className: cn(
48
+ "text-muted-foreground hover:text-foreground flex w-fit items-center gap-1.5 rounded-sm text-sm",
49
+ FOCUS_RING
50
+ ),
51
+ "data-test": "widget-back",
52
+ children: [
53
+ /* @__PURE__ */ jsx(Icon, { name: "arrow-left", className: "h-4 w-4" }),
54
+ "All widgets"
55
+ ]
56
+ }
57
+ ),
58
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
59
+ /* @__PURE__ */ jsx("h2", { className: "font-heading text-xl font-normal", children: widget.title }),
60
+ /* @__PURE__ */ jsxs("p", { className: "text-muted-foreground text-sm", children: [
61
+ /* @__PURE__ */ jsx("code", { children: widget.id }),
62
+ " \xB7 declared ",
63
+ declaredWidthLabel(widget),
64
+ focused === widget ? "" : ", shown full width here",
65
+ ". The same grid and controls as the Widgets tab, with this widget alone."
66
+ ] })
67
+ ] }),
18
68
  /* @__PURE__ */ jsx(
19
69
  WidgetSurface,
20
70
  {
21
- widgets: [withFocusedDefault(widget)],
22
- productSlug: project.data?.name ?? "experience"
71
+ widgets: [focused],
72
+ productSlug: project.data?.name ?? "experience",
73
+ controls: true
23
74
  }
24
75
  )
25
76
  ] });
@@ -1,6 +1,5 @@
1
1
  /**
2
- * The experience's widgets in the dashboard grid. The variant switch
3
- * (default / empty / error) is the dev toolbar's, which drives the scenario
4
- * fixtures the runtime answers from.
2
+ * The experience's widgets in the dashboard grid, with the preview controls
3
+ * (render state, fixture scenario, viewport, unhealthy) directly above it.
5
4
  */
6
5
  export declare function ExperienceWidgetsPage(): import("react").JSX.Element;