@ekanos/harness 0.27.0 → 0.29.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 (158) 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/ask-assistant-bridge.js +7 -1
  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 +82 -5
  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 -4
  57. package/dist/internal/components/surface-nav.js +79 -80
  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 +27 -0
  70. package/dist/internal/lib/docs-links.js +55 -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/font-files/OFL-BricolageGrotesque.txt +93 -0
  74. package/dist/internal/lib/font-files/OFL-Figtree.txt +93 -0
  75. package/dist/internal/lib/font-files/bricolage-grotesque-latin-variable.woff2 +0 -0
  76. package/dist/internal/lib/font-files/figtree-latin-variable.woff2 +0 -0
  77. package/dist/internal/lib/fonts.js +13 -12
  78. package/dist/internal/lib/health-model.d.ts +58 -0
  79. package/dist/internal/lib/health-model.js +140 -0
  80. package/dist/internal/lib/integration-console-href.d.ts +5 -0
  81. package/dist/internal/lib/integration-console-href.js +7 -1
  82. package/dist/internal/lib/oauth-setup-guide.d.ts +28 -0
  83. package/dist/internal/lib/oauth-setup-guide.js +35 -1
  84. package/dist/internal/lib/operation-catalog.d.ts +70 -0
  85. package/dist/internal/lib/operation-catalog.js +261 -0
  86. package/dist/internal/lib/overview-model.d.ts +34 -0
  87. package/dist/internal/lib/overview-model.js +91 -0
  88. package/dist/internal/lib/registry-entry.d.ts +8 -0
  89. package/dist/internal/lib/registry-entry.js +11 -0
  90. package/dist/internal/lib/repo-name.d.ts +9 -0
  91. package/dist/internal/lib/repo-name.js +21 -0
  92. package/dist/internal/lib/run-log-view.d.ts +66 -1
  93. package/dist/internal/lib/run-log-view.js +183 -4
  94. package/dist/internal/lib/runner-view.d.ts +15 -0
  95. package/dist/internal/lib/runner-view.js +18 -0
  96. package/dist/internal/lib/schema-form-model.d.ts +17 -0
  97. package/dist/internal/lib/schema-form-model.js +50 -0
  98. package/dist/internal/lib/setup-checklist.d.ts +34 -0
  99. package/dist/internal/lib/setup-checklist.js +79 -0
  100. package/dist/internal/lib/toolbar-context.d.ts +0 -1
  101. package/dist/internal/lib/toolbar-context.js +0 -2
  102. package/dist/internal/lib/toolbar-visibility.d.ts +9 -2
  103. package/dist/internal/lib/toolbar-visibility.js +5 -0
  104. package/dist/internal/lib/use-operation-effects.d.ts +7 -0
  105. package/dist/internal/lib/use-operation-effects.js +28 -0
  106. package/dist/internal/lib/use-run-log-query.d.ts +9 -0
  107. package/dist/internal/lib/use-run-log-query.js +35 -0
  108. package/dist/internal/lib/widget-grid-gaps.d.ts +18 -0
  109. package/dist/internal/lib/widget-grid-gaps.js +41 -0
  110. package/dist/internal/lib/workflow-summary.d.ts +54 -0
  111. package/dist/internal/lib/workflow-summary.js +147 -0
  112. package/dist/internal/routes/console-home-page.js +2 -1
  113. package/dist/internal/routes/experience-connect-page.js +46 -17
  114. package/dist/internal/routes/experience-layout-page.d.ts +6 -6
  115. package/dist/internal/routes/experience-layout-page.js +3 -119
  116. package/dist/internal/routes/experience-page-host.js +61 -5
  117. package/dist/internal/routes/experience-pages-page.d.ts +5 -0
  118. package/dist/internal/routes/experience-pages-page.js +118 -0
  119. package/dist/internal/routes/experience-review-queue-page.d.ts +4 -1
  120. package/dist/internal/routes/experience-review-queue-page.js +108 -12
  121. package/dist/internal/routes/experience-runs-page.js +57 -4
  122. package/dist/internal/routes/experience-summary-page.d.ts +19 -0
  123. package/dist/internal/routes/experience-summary-page.js +212 -52
  124. package/dist/internal/routes/experience-widget-page.js +58 -7
  125. package/dist/internal/routes/experience-widgets-page.d.ts +2 -3
  126. package/dist/internal/routes/experience-widgets-page.js +29 -4
  127. package/dist/internal/routes/experience-workflow-page.js +81 -9
  128. package/dist/internal/routes/experience-workflows-page.js +85 -21
  129. package/dist/internal/routes/integration-layout.js +28 -3
  130. package/dist/internal/routes/integrations-connect-page.js +16 -6
  131. package/dist/internal/routes/integrations-events-page.js +22 -1
  132. package/dist/internal/routes/integrations-health-page.js +16 -1
  133. package/dist/internal/routes/integrations-layout.js +28 -4
  134. package/dist/internal/routes/integrations-list-page.d.ts +0 -1
  135. package/dist/internal/routes/integrations-list-page.js +11 -9
  136. package/dist/internal/routes/integrations-operation-page.js +53 -17
  137. package/dist/internal/routes/integrations-operations-page.js +539 -49
  138. package/dist/internal/routes/integrations-overview-page.js +332 -69
  139. package/dist/internal/routes/integrations-runs-page.js +53 -3
  140. package/dist/internal/routes/integrations-scope.d.ts +15 -2
  141. package/dist/internal/routes/integrations-scope.js +66 -18
  142. package/dist/internal/routes/preview-index-page.js +2 -2
  143. package/dist/internal/routes/repo-home-page.d.ts +2 -2
  144. package/dist/internal/routes/repo-home-page.js +429 -236
  145. package/dist/internal/routes/repo-layout.d.ts +12 -0
  146. package/dist/internal/routes/repo-layout.js +50 -38
  147. package/dist/internal/routes/repo-package-layouts.js +22 -8
  148. package/dist/internal/routes/single-widget-page.d.ts +1 -1
  149. package/dist/internal/routes/single-widget-page.js +28 -5
  150. package/dist/internal/routes/tile-page.d.ts +1 -1
  151. package/dist/internal/routes/tile-page.js +1 -2
  152. package/dist/internal/routes/widgets-page.d.ts +1 -1
  153. package/dist/internal/routes/widgets-page.js +5 -3
  154. package/dist/registry.d.ts +4 -5
  155. package/dist/registry.js +0 -1
  156. package/dist/routes.d.ts +8 -1
  157. package/dist/routes.js +4 -0
  158. package/package.json +14 -14
@@ -0,0 +1,54 @@
1
+ import type { OperationEffect, WorkflowStepDefinition, WorkflowTemplateSummary } from './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: Pick<WorkflowStepDefinition, 'type'>): boolean;
5
+ /** `fusion_tool` -> `Tool call`; an unknown type reads as itself. */
6
+ export declare function stepTypeLabel(type: string): string;
7
+ /** `guard_nonempty` -> `Guard nonempty`. */
8
+ export declare function humanizeStepLabel(label: string): string;
9
+ /** `tool/update_issue` -> `{ kind: 'tool', name: 'update_issue' }`. */
10
+ export declare function splitOpKey(opKey: string): {
11
+ kind: string;
12
+ name: string;
13
+ } | null;
14
+ /** Whether the step reads or writes, when the contract is known. */
15
+ export type EffectOf = (integration: string, opKey: string) => OperationEffect | undefined;
16
+ export interface StepGroup {
17
+ /** Consecutive steps that do the same thing (same type, integration and operation). */
18
+ steps: Array<{
19
+ step: WorkflowStepDefinition;
20
+ index: number;
21
+ }>;
22
+ }
23
+ /** Runs of consecutive tool calls to the same operation, so ten identical writes read as one block. */
24
+ export declare function groupSteps(steps: readonly WorkflowStepDefinition[]): StepGroup[];
25
+ /**
26
+ * What a template does, in one line, in step order:
27
+ * `4 reads from linear, then an AI step, then waits for your approval, then 10 writes to linear`.
28
+ */
29
+ export declare function workflowSummary(template: Pick<WorkflowTemplateSummary, 'steps'>, effectOf?: EffectOf): string;
30
+ /** The integrations a template's tool steps call, short names, in first-use order. */
31
+ export declare function workflowIntegrations(template: Pick<WorkflowTemplateSummary, 'steps'>): string[];
32
+ export declare function hasApprovalGate(template: Pick<WorkflowTemplateSummary, 'steps'>): boolean;
33
+ /** The gate step id a pending gate approval waits on (`approval_gate/<step>`), or null. */
34
+ export declare function gateStepId(opKey: string): string | null;
35
+ export type ProposalBlock = {
36
+ kind: 'text';
37
+ text: string;
38
+ } | {
39
+ kind: 'numbered';
40
+ items: {
41
+ number: number;
42
+ text: string;
43
+ }[];
44
+ } | {
45
+ kind: 'bulleted';
46
+ items: string[];
47
+ };
48
+ /**
49
+ * An approval's summary as blocks a reviewer can scan: runs of `1.` / `2)`
50
+ * lines become a numbered list (keeping the author's numbers), runs of `-`,
51
+ * `*` or `•` lines a bulleted list, and everything else paragraphs, one per
52
+ * line. Blank lines only separate.
53
+ */
54
+ export declare function proposalBlocks(text: string): ProposalBlock[];
@@ -0,0 +1,147 @@
1
+ import { shortName } from "./setup-checklist.js";
2
+ const SIMULATED_STEP_TYPES = [
3
+ "fusion_tool",
4
+ "approval_gate",
5
+ "ai_step"
6
+ ];
7
+ function isSimulated(step) {
8
+ return SIMULATED_STEP_TYPES.includes(step.type);
9
+ }
10
+ const STEP_TYPE_LABEL = {
11
+ fusion_tool: "Tool call",
12
+ ai_step: "AI step",
13
+ approval_gate: "Approval gate"
14
+ };
15
+ function stepTypeLabel(type) {
16
+ return STEP_TYPE_LABEL[type] ?? type.replaceAll("_", " ");
17
+ }
18
+ function humanizeStepLabel(label) {
19
+ const words = label.replaceAll(/[_-]+/g, " ").trim();
20
+ return words.charAt(0).toUpperCase() + words.slice(1);
21
+ }
22
+ function splitOpKey(opKey) {
23
+ const slash = opKey.indexOf("/");
24
+ if (slash <= 0 || slash === opKey.length - 1) return null;
25
+ return { kind: opKey.slice(0, slash), name: opKey.slice(slash + 1) };
26
+ }
27
+ function sameAction(a, b) {
28
+ return a.type === b.type && a.type === "fusion_tool" && a.integration === b.integration && a.opKey === b.opKey;
29
+ }
30
+ function groupSteps(steps) {
31
+ const groups = [];
32
+ steps.forEach((step, index) => {
33
+ const last = groups.at(-1);
34
+ const previous = last?.steps.at(-1)?.step;
35
+ if (last && previous && sameAction(previous, step)) {
36
+ last.steps.push({ step, index });
37
+ } else {
38
+ groups.push({ steps: [{ step, index }] });
39
+ }
40
+ });
41
+ return groups;
42
+ }
43
+ function phaseOf(step, effectOf) {
44
+ if (step.type === "ai_step") return { kind: "ai", count: 1 };
45
+ if (step.type === "approval_gate") return { kind: "gate", count: 1 };
46
+ if (step.type === "fusion_tool" && step.integration) {
47
+ const effect = step.opKey ? effectOf?.(step.integration, step.opKey) : void 0;
48
+ return {
49
+ kind: effect ?? "call",
50
+ integration: shortName(step.integration),
51
+ count: 1
52
+ };
53
+ }
54
+ return { kind: "other", type: step.type, count: 1 };
55
+ }
56
+ function samePhase(a, b) {
57
+ if (a.kind !== b.kind) return false;
58
+ if ("integration" in a && "integration" in b) {
59
+ return a.integration === b.integration;
60
+ }
61
+ if (a.kind === "other" && b.kind === "other") return a.type === b.type;
62
+ return true;
63
+ }
64
+ function plural(count, one, many = `${one}s`) {
65
+ return count === 1 ? one : many;
66
+ }
67
+ function phaseText(phase) {
68
+ switch (phase.kind) {
69
+ case "read":
70
+ return phase.count === 1 ? `reads ${phase.integration}` : `${phase.count} reads from ${phase.integration}`;
71
+ case "write":
72
+ return phase.count === 1 ? `writes to ${phase.integration}` : `${phase.count} writes to ${phase.integration}`;
73
+ case "call":
74
+ return `${phase.count} ${plural(phase.count, "call")} to ${phase.integration}`;
75
+ case "ai":
76
+ return phase.count === 1 ? "an AI step" : `${phase.count} AI steps`;
77
+ case "gate":
78
+ return "waits for your approval";
79
+ case "other":
80
+ return `${phase.count} ${stepTypeLabel(phase.type)} ${plural(phase.count, "step")} (not simulated)`;
81
+ }
82
+ }
83
+ function workflowSummary(template, effectOf) {
84
+ const phases = [];
85
+ for (const step of template.steps) {
86
+ const phase = phaseOf(step, effectOf);
87
+ const last = phases.at(-1);
88
+ if (last && samePhase(last, phase)) last.count += 1;
89
+ else phases.push(phase);
90
+ }
91
+ if (phases.length === 0) return "No steps.";
92
+ const text = phases.map(phaseText).join(", then ");
93
+ return text.charAt(0).toUpperCase() + text.slice(1) + ".";
94
+ }
95
+ function workflowIntegrations(template) {
96
+ return [
97
+ ...new Set(
98
+ template.steps.flatMap(
99
+ (step) => step.type === "fusion_tool" && step.integration ? [step.integration] : []
100
+ )
101
+ )
102
+ ];
103
+ }
104
+ function hasApprovalGate(template) {
105
+ return template.steps.some((step) => step.type === "approval_gate");
106
+ }
107
+ function gateStepId(opKey) {
108
+ return opKey.startsWith("approval_gate/") ? opKey.slice("approval_gate/".length) || null : null;
109
+ }
110
+ const NUMBERED_LINE = /^\s*(\d+)[.)]\s+(.*)$/;
111
+ const BULLETED_LINE = /^\s*[-*•]\s+(.*)$/;
112
+ function proposalBlocks(text) {
113
+ const blocks = [];
114
+ for (const line of text.split(/\r?\n/)) {
115
+ if (line.trim() === "") continue;
116
+ const last = blocks.at(-1);
117
+ const numbered = NUMBERED_LINE.exec(line);
118
+ if (numbered) {
119
+ const item = { number: Number(numbered[1]), text: numbered[2] ?? "" };
120
+ if (last?.kind === "numbered") last.items.push(item);
121
+ else blocks.push({ kind: "numbered", items: [item] });
122
+ continue;
123
+ }
124
+ const bulleted = BULLETED_LINE.exec(line);
125
+ if (bulleted) {
126
+ const item = bulleted[1] ?? "";
127
+ if (last?.kind === "bulleted") last.items.push(item);
128
+ else blocks.push({ kind: "bulleted", items: [item] });
129
+ continue;
130
+ }
131
+ blocks.push({ kind: "text", text: line.trim() });
132
+ }
133
+ return blocks;
134
+ }
135
+ export {
136
+ SIMULATED_STEP_TYPES,
137
+ gateStepId,
138
+ groupSteps,
139
+ hasApprovalGate,
140
+ humanizeStepLabel,
141
+ isSimulated,
142
+ proposalBlocks,
143
+ splitOpKey,
144
+ stepTypeLabel,
145
+ workflowIntegrations,
146
+ workflowSummary
147
+ };
@@ -1,11 +1,12 @@
1
1
  "use client";
2
2
  import { jsx } from "react/jsx-runtime";
3
3
  import { redirect } from "next/navigation";
4
+ import { PageSkeleton } from "../components/page-skeletons.js";
4
5
  import { useProject } from "../lib/console-hooks.js";
5
6
  function ConsoleHomePage() {
6
7
  const project = useProject();
7
8
  if (!project.data) {
8
- return /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm", children: "Loading\u2026" });
9
+ return /* @__PURE__ */ jsx(PageSkeleton, { label: "Loading project" });
9
10
  }
10
11
  const first = project.data.integrations[0];
11
12
  if (project.data.kind === "integration" && first) {
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
3
  import { use } from "react";
4
4
  import Link from "next/link";
5
5
  import { useParams } from "next/navigation";
@@ -9,6 +9,7 @@ import {
9
9
  useQueryClient
10
10
  } from "@tanstack/react-query";
11
11
  import { ConnectControls } from "../components/connect-controls.js";
12
+ import { PageSkeleton } from "../components/page-skeletons.js";
12
13
  import {
13
14
  CONNECTION_TYPE,
14
15
  ConnectionStatusChip,
@@ -17,6 +18,7 @@ import {
17
18
  import { isReady } from "../lib/connection-facts.js";
18
19
  import { refreshRuntime } from "../lib/console-hooks.js";
19
20
  import { RepoProviders, repoKeys, useRepo } from "../lib/repo-context.js";
21
+ import { keysNeededLabel, missingKeys } from "../lib/setup-checklist.js";
20
22
  function Checklist({
21
23
  name,
22
24
  consoleQueryClient
@@ -28,7 +30,7 @@ function Checklist({
28
30
  consoleQueryClient ? refreshRuntime(consoleQueryClient) : void 0
29
31
  ]);
30
32
  if (!repo.data) {
31
- return /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm", children: "Loading\u2026" });
33
+ return /* @__PURE__ */ jsx(PageSkeleton, { label: "Loading the connect checklist" });
32
34
  }
33
35
  const experience = repo.data.experiences.find((entry) => entry.name === name);
34
36
  if (!experience) {
@@ -44,20 +46,27 @@ function Checklist({
44
46
  ).length;
45
47
  return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", "data-test": "connect-checklist", children: [
46
48
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
47
- /* @__PURE__ */ jsx("h2", { className: "font-heading text-xl font-normal", children: "Connect" }),
48
- /* @__PURE__ */ jsxs(
49
- "p",
50
- {
51
- className: "text-muted-foreground text-xs",
52
- "data-test": "checklist-progress",
53
- children: [
54
- ready,
55
- " of ",
56
- experience.integrations.length,
57
- " integrations ready."
58
- ]
59
- }
60
- )
49
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-baseline justify-between gap-2", children: [
50
+ /* @__PURE__ */ jsx("h2", { className: "font-heading text-xl font-normal", children: "Connect" }),
51
+ /* @__PURE__ */ jsxs(
52
+ "span",
53
+ {
54
+ className: "text-muted-foreground text-sm tabular-nums",
55
+ "data-test": "checklist-progress",
56
+ children: [
57
+ ready,
58
+ " of ",
59
+ experience.integrations.length,
60
+ " integrations ready."
61
+ ]
62
+ }
63
+ )
64
+ ] }),
65
+ /* @__PURE__ */ jsxs("p", { className: "text-muted-foreground text-sm", children: [
66
+ "Connect each integration ",
67
+ experience.name,
68
+ " uses to run it live. Until then it answers from fixtures, so everything still works here."
69
+ ] })
61
70
  ] }),
62
71
  /* @__PURE__ */ jsx("ol", { className: "flex flex-col gap-3", children: experience.integrations.map((used, index) => /* @__PURE__ */ jsxs(
63
72
  Card,
@@ -91,7 +100,27 @@ function Checklist({
91
100
  /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: " after publishing" })
92
101
  ] }),
93
102
  used.levelProblem ? /* @__PURE__ */ jsx("p", { className: "text-warning-foreground bg-warning rounded-md px-3 py-2 text-xs", children: used.levelProblem }) : null,
94
- used.connection?.detail ? /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-xs", children: used.connection.detail }) : null,
103
+ used.connection?.detail && used.connection.facts.state !== "connected" ? /* @__PURE__ */ jsxs(
104
+ "p",
105
+ {
106
+ className: "text-muted-foreground text-xs",
107
+ title: missingKeys(used.connection.detail).join(", "),
108
+ children: [
109
+ keysNeededLabel(used.connection.facts) ?? used.connection.detail,
110
+ used.connectHref ? /* @__PURE__ */ jsxs(Fragment, { children: [
111
+ " \xB7 ",
112
+ /* @__PURE__ */ jsx(
113
+ Link,
114
+ {
115
+ href: used.connectHref,
116
+ className: "text-foreground underline-offset-2 hover:underline",
117
+ children: "Open its Connect tab"
118
+ }
119
+ )
120
+ ] }) : null
121
+ ]
122
+ }
123
+ ) : null,
95
124
  used.packageName ? /* @__PURE__ */ jsx(
96
125
  ConnectControls,
97
126
  {
@@ -1,8 +1,8 @@
1
1
  /**
2
- * How the experience's `suggestedLayout` would arrange for each audience: a nav
3
- * of workspaces, each a canvas of widgets and a list of pages. The "viewing as"
4
- * switcher is built from the audience names the layout itself carries, plus
5
- * Everyone. A Source maps a name to its own audience of the same name when the
6
- * layout is applied; this view shows what each name would get.
2
+ * The retired Layout tab. Arranging an experience's pages and widgets into
3
+ * workspaces is the job of whoever manages the Source, so the harness no longer
4
+ * previews it; an old link to `/layout` lands on the experience's pages.
5
+ *
6
+ * @deprecated Mount `ExperiencePagesPage` at `/experience/pages`.
7
7
  */
8
- export declare function ExperienceLayoutPage(): import("react").JSX.Element;
8
+ export declare function ExperienceLayoutPage(): never;
@@ -1,125 +1,9 @@
1
1
  "use client";
2
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
- import { useState } from "react";
4
- import Link from "next/link";
5
- import {
6
- layoutAudienceNames,
7
- resolveLayoutForAudience
8
- } from "@ekanos/sdk/experience";
9
- import { Button } from "@ekanos/ui/button";
10
- import { Card } from "@ekanos/ui/card";
11
- import { StatusBadge } from "@ekanos/ui/status-badge";
12
- import { WidgetSurface } from "../components/widget-surface.js";
13
- import { useConsoleLinks, useExperienceSurfaces } from "../lib/console-context.js";
14
- import { useProject } from "../lib/console-hooks.js";
15
- const EVERYONE = "";
2
+ import { redirect } from "next/navigation";
3
+ import { useConsoleLinks } from "../lib/console-context.js";
16
4
  function ExperienceLayoutPage() {
17
- const project = useProject();
18
5
  const links = useConsoleLinks();
19
- const { widgets, pages, suggestedLayout } = useExperienceSurfaces();
20
- const [view, setView] = useState({ audience: EVERYONE, workspace: "" });
21
- if (!suggestedLayout) {
22
- return /* @__PURE__ */ jsxs("p", { className: "text-muted-foreground text-sm", "data-test": "layout-empty", children: [
23
- "This experience suggests no layout. Add ",
24
- /* @__PURE__ */ jsx("code", { children: "suggestedLayout" }),
25
- " to",
26
- " ",
27
- /* @__PURE__ */ jsx("code", { children: "defineExperience" }),
28
- " to show how its widgets and pages would arrange into workspaces."
29
- ] });
30
- }
31
- const audiences = layoutAudienceNames(suggestedLayout);
32
- const resolved = resolveLayoutForAudience(
33
- suggestedLayout,
34
- view.audience === EVERYONE ? null : view.audience
35
- );
36
- const active = resolved.workspaces.find(
37
- (workspace) => workspace.slug === view.workspace
38
- ) ?? resolved.workspaces[0];
39
- const productSlug = project.data?.name ?? "experience";
40
- const shown = (refs) => refs.flatMap((ref) => {
41
- const id = ref.slice(ref.indexOf(":") + 1);
42
- const widget = widgets.find((w) => w.id === id);
43
- return widget ? [widget] : [];
44
- });
45
- const itemRefs = active?.items.map((item) => item.ref) ?? [];
46
- const widgetItems = shown(
47
- itemRefs.filter((ref) => ref.startsWith("widget:"))
48
- );
49
- const pageItems = itemRefs.filter((ref) => ref.startsWith("page:")).map((ref) => ref.slice("page:".length)).flatMap((id) => {
50
- const page = pages.find((p) => p.id === id);
51
- return page ? [page] : [];
52
- });
53
- return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", "data-test": "experience-layout", children: [
54
- /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-3", children: [
55
- /* @__PURE__ */ jsx("h2", { className: "font-heading text-xl font-normal", children: "Suggested layout" }),
56
- /* @__PURE__ */ jsxs("label", { className: "ml-auto flex items-center gap-2 text-sm", children: [
57
- /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Viewing as" }),
58
- /* @__PURE__ */ jsxs(
59
- "select",
60
- {
61
- value: view.audience,
62
- onChange: (event) => setView({ audience: event.target.value, workspace: "" }),
63
- className: "border-input bg-background rounded-md border px-3 py-2 text-sm",
64
- "data-test": "layout-audience",
65
- children: [
66
- /* @__PURE__ */ jsx("option", { value: EVERYONE, children: "Everyone" }),
67
- audiences.map((name) => /* @__PURE__ */ jsx("option", { value: name, children: name }, name))
68
- ]
69
- }
70
- )
71
- ] })
72
- ] }),
73
- resolved.workspaces.length === 0 ? /* @__PURE__ */ jsxs("p", { className: "text-muted-foreground text-sm", "data-test": "layout-none", children: [
74
- "Nothing in this layout is for",
75
- " ",
76
- view.audience === EVERYONE ? "everyone" : view.audience,
77
- "."
78
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
79
- /* @__PURE__ */ jsx(
80
- "nav",
81
- {
82
- "aria-label": "Workspaces",
83
- className: "flex flex-wrap gap-1",
84
- "data-test": "layout-workspaces",
85
- children: resolved.workspaces.map((workspace) => /* @__PURE__ */ jsx(
86
- Button,
87
- {
88
- variant: workspace.slug === active?.slug ? "secondary" : "ghost",
89
- size: "sm",
90
- "aria-current": workspace.slug === active?.slug ? "page" : void 0,
91
- onClick: () => setView((prev) => ({ ...prev, workspace: workspace.slug })),
92
- "data-test": `layout-workspace-${workspace.slug}`,
93
- children: workspace.name
94
- },
95
- workspace.slug
96
- ))
97
- }
98
- ),
99
- widgetItems.length > 0 ? /* @__PURE__ */ jsx(WidgetSurface, { widgets: widgetItems, productSlug }) : null,
100
- pageItems.length > 0 ? /* @__PURE__ */ jsx("ul", { className: "flex flex-col gap-2", "data-test": "layout-pages", children: pageItems.map((page) => /* @__PURE__ */ jsxs(
101
- Card,
102
- {
103
- layout: "bleed",
104
- render: /* @__PURE__ */ jsx("li", {}),
105
- className: "flex items-center gap-3 p-4",
106
- "data-test": `layout-page-${page.id}`,
107
- children: [
108
- /* @__PURE__ */ jsx(
109
- Link,
110
- {
111
- href: `${links.experience}/pages/${page.id}`,
112
- className: "text-sm font-medium hover:underline",
113
- children: page.title
114
- }
115
- ),
116
- /* @__PURE__ */ jsx(StatusBadge, { tone: "neutral", children: page.kind ?? "custom" })
117
- ]
118
- },
119
- page.id
120
- )) }) : null
121
- ] })
122
- ] });
6
+ return redirect(`${links.experience}/pages`);
123
7
  }
124
8
  export {
125
9
  ExperienceLayoutPage
@@ -1,27 +1,66 @@
1
1
  "use client";
2
2
  import { jsx, jsxs } from "react/jsx-runtime";
3
3
  import Link from "next/link";
4
- import { notFound, useParams } from "next/navigation";
4
+ import { useParams } from "next/navigation";
5
+ import { Icon } from "@ekanos/ui/icon";
5
6
  import { PageBody } from "@ekanos/ui/page";
6
7
  import { cn } from "@ekanos/ui/utils";
8
+ import { NotFoundState } from "../components/not-found-state.js";
7
9
  import { WidgetSurface } from "../components/widget-surface.js";
8
10
  import { useConsoleLinks, useExperienceSurfaces } from "../lib/console-context.js";
9
11
  import { useProject } from "../lib/console-hooks.js";
12
+ import { pageKindLabel } from "./experience-pages-page.js";
10
13
  function ExperiencePageHost() {
11
14
  const { id, path: rawPath } = useParams();
12
15
  const { pages, widgets } = useExperienceSurfaces();
13
16
  const links = useConsoleLinks();
14
17
  const project = useProject();
15
18
  const page = pages.find((entry) => entry.id === id);
16
- if (!page) notFound();
19
+ if (!page) {
20
+ const name = decodeURIComponent(id);
21
+ return /* @__PURE__ */ jsx(
22
+ NotFoundState,
23
+ {
24
+ testId: "page-not-found",
25
+ title: `No page called \u201C${name}\u201D`,
26
+ description: "This experience registers no page with that id. Pick one it does register.",
27
+ options: pages.map((entry) => ({
28
+ label: entry.id,
29
+ href: `${links.experience}/pages/${entry.id}`,
30
+ hint: entry.title
31
+ })),
32
+ ...pages.length > 0 ? { optionsLabel: "The pages in this experience" } : {},
33
+ action: {
34
+ label: "Back to pages",
35
+ href: `${links.experience}/pages`
36
+ }
37
+ }
38
+ );
39
+ }
17
40
  const kind = page.kind ?? "custom";
18
41
  const path = rawPath ?? [];
19
42
  const sub = path.join("/");
20
43
  const productSlug = project.data?.name ?? "experience";
44
+ const base = `${links.experience}/pages/${page.id}`;
21
45
  if (sub !== "" && !page.routes?.some((route) => route.path === sub)) {
22
- notFound();
46
+ return /* @__PURE__ */ jsx(
47
+ NotFoundState,
48
+ {
49
+ testId: "page-not-found",
50
+ title: `${page.title} has no section \u201C${sub}\u201D`,
51
+ description: "The page declares no route at that path. Pick one of its sections.",
52
+ options: [{ path: "", title: page.title }, ...page.routes ?? []].map(
53
+ (route) => ({
54
+ label: route.path === "" ? "/" : route.path,
55
+ href: route.path === "" ? base : `${base}/${route.path}`,
56
+ hint: route.title
57
+ })
58
+ ),
59
+ optionsLabel: `The sections of ${page.title}`,
60
+ action: { label: `Back to ${page.title}`, href: base }
61
+ }
62
+ );
23
63
  }
24
- const base = `${links.experience}/pages/${page.id}`;
25
64
  const Page = page.component;
26
65
  return /* @__PURE__ */ jsxs(
27
66
  "div",
@@ -30,7 +69,24 @@ function ExperiencePageHost() {
30
69
  "data-test": "experience-page",
31
70
  "data-page-kind": kind,
32
71
  children: [
33
- /* @__PURE__ */ jsx("h1", { className: "font-heading px-4 pt-4 text-xl font-normal", children: page.title }),
72
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1 px-4 pt-4", children: [
73
+ /* @__PURE__ */ jsxs(
74
+ Link,
75
+ {
76
+ href: `${links.experience}/pages`,
77
+ className: "text-muted-foreground hover:text-foreground focus-visible:ring-ring flex w-fit items-center gap-1 rounded-sm text-sm focus-visible:ring-2 focus-visible:outline-none",
78
+ "data-test": "experience-page-back",
79
+ children: [
80
+ /* @__PURE__ */ jsx(Icon, { name: "arrow-left", className: "size-3.5", "aria-hidden": true }),
81
+ "Pages"
82
+ ]
83
+ }
84
+ ),
85
+ /* @__PURE__ */ jsxs("h2", { className: "font-heading text-xl font-normal", children: [
86
+ page.title,
87
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground ml-2 align-middle text-xs font-normal", children: pageKindLabel(page.kind) })
88
+ ] })
89
+ ] }),
34
90
  page.routes && page.routes.length > 0 ? /* @__PURE__ */ jsx(
35
91
  "nav",
36
92
  {
@@ -0,0 +1,5 @@
1
+ import { type ExperienceSurfacePage } from '../lib/console-context.js';
2
+ /** The words a developer sees for a page's kind; a page with none is custom. */
3
+ export declare function pageKindLabel(kind: ExperienceSurfacePage['kind']): string;
4
+ /** Every page the experience ships, each opening in the page host. */
5
+ export declare function ExperiencePagesPage(): import("react").JSX.Element;