@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,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,
@@ -73,14 +82,14 @@ function Checklist({
73
82
  index + 1,
74
83
  "."
75
84
  ] }),
76
- /* @__PURE__ */ jsx(
85
+ used.consoleHref ? /* @__PURE__ */ jsx(
77
86
  Link,
78
87
  {
79
- href: `/integrations/${used.name}`,
88
+ href: used.consoleHref,
80
89
  className: "text-sm font-medium hover:underline",
81
90
  children: used.name
82
91
  }
83
- ),
92
+ ) : /* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: used.name }),
84
93
  /* @__PURE__ */ jsx(ConnectionStatusChip, { connection: used.connection }),
85
94
  used.connection && used.connection.facts.kind !== "none" && used.connection.facts.state !== "connected" ? /* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-xs", children: CONNECTION_TYPE[used.connection.type] }) : null,
86
95
  !used.sameRepo ? /* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-xs", children: "from the registry" }) : null
@@ -91,11 +100,31 @@ 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,
95
- used.sameRepo ? /* @__PURE__ */ jsx(
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,
124
+ used.packageName ? /* @__PURE__ */ jsx(
96
125
  ConnectControls,
97
126
  {
98
- name: used.name,
127
+ name: used.packageName,
99
128
  connection: used.connection,
100
129
  returnPath: `/experiences/${experience.name}/connect`,
101
130
  onChanged: refresh
@@ -8,25 +8,55 @@ import {
8
8
  } from "@ekanos/sdk/experience";
9
9
  import { Button } from "@ekanos/ui/button";
10
10
  import { Card } from "@ekanos/ui/card";
11
+ import {
12
+ EmptyMedia,
13
+ EmptyState,
14
+ EmptyStateHeading,
15
+ EmptyStateText
16
+ } from "@ekanos/ui/empty-state";
17
+ import { Icon } from "@ekanos/ui/icon";
11
18
  import { StatusBadge } from "@ekanos/ui/status-badge";
19
+ import { DocsLink } from "../components/docs-link.js";
12
20
  import { WidgetSurface } from "../components/widget-surface.js";
13
21
  import { useConsoleLinks, useExperienceSurfaces } from "../lib/console-context.js";
14
22
  import { useProject } from "../lib/console-hooks.js";
23
+ import { DOCS } from "../lib/docs-links.js";
15
24
  const EVERYONE = "";
25
+ const LAYOUT_HINT = `suggestedLayout: {
26
+ workspaces: [
27
+ {
28
+ slug: 'triage',
29
+ name: 'Triage',
30
+ items: [{ ref: 'widget:<widget-id>' }, { ref: 'page:<page-id>' }],
31
+ },
32
+ ],
33
+ },`;
16
34
  function ExperienceLayoutPage() {
17
35
  const project = useProject();
18
36
  const links = useConsoleLinks();
19
37
  const { widgets, pages, suggestedLayout } = useExperienceSurfaces();
20
38
  const [view, setView] = useState({ audience: EVERYONE, workspace: "" });
21
39
  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
- ] });
40
+ return /* @__PURE__ */ jsxs(
41
+ EmptyState,
42
+ {
43
+ className: "min-w-0 py-12 *:max-w-full *:min-w-0",
44
+ "data-test": "layout-empty",
45
+ children: [
46
+ /* @__PURE__ */ jsx(EmptyMedia, { variant: "icon", children: /* @__PURE__ */ jsx(Icon, { name: "layout" }) }),
47
+ /* @__PURE__ */ jsx(EmptyStateHeading, { children: "No suggested layout" }),
48
+ /* @__PURE__ */ jsxs(EmptyStateText, { className: "max-w-md", children: [
49
+ "A suggested layout shows how this experience's widgets and pages would arrange into workspaces; whoever manages the account applies it. Add ",
50
+ /* @__PURE__ */ jsx("code", { children: "suggestedLayout" }),
51
+ " to ",
52
+ /* @__PURE__ */ jsx("code", { children: "defineExperience" }),
53
+ " and it previews here, for each audience it names."
54
+ ] }),
55
+ /* @__PURE__ */ jsx("pre", { className: "bg-muted mt-3 w-full max-w-md min-w-0 overflow-x-auto rounded-md px-3 py-2 text-left text-xs", children: LAYOUT_HINT }),
56
+ /* @__PURE__ */ jsx(DocsLink, { href: DOCS.layout, className: "mt-3", children: "Suggest a layout" })
57
+ ]
58
+ }
59
+ );
30
60
  }
31
61
  const audiences = layoutAudienceNames(suggestedLayout);
32
62
  const resolved = resolveLayoutForAudience(
@@ -52,7 +82,10 @@ function ExperienceLayoutPage() {
52
82
  });
53
83
  return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", "data-test": "experience-layout", children: [
54
84
  /* @__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" }),
85
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-col gap-1", children: [
86
+ /* @__PURE__ */ jsx("h2", { className: "font-heading text-xl font-normal", children: "Suggested layout" }),
87
+ /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm", children: "How the widgets and pages would arrange into workspaces for each audience. Whoever manages the account applies it." })
88
+ ] }),
56
89
  /* @__PURE__ */ jsxs("label", { className: "ml-auto flex items-center gap-2 text-sm", children: [
57
90
  /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Viewing as" }),
58
91
  /* @__PURE__ */ jsxs(
@@ -97,27 +130,43 @@ function ExperienceLayoutPage() {
97
130
  }
98
131
  ),
99
132
  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(
133
+ pageItems.length > 0 ? /* @__PURE__ */ jsxs("section", { className: "flex flex-col gap-2", "data-test": "layout-pages", children: [
134
+ /* @__PURE__ */ jsxs("h3", { className: "text-sm font-medium", children: [
135
+ "Pages in ",
136
+ active?.name ?? "this workspace"
137
+ ] }),
138
+ /* @__PURE__ */ jsx(
139
+ Card,
140
+ {
141
+ layout: "bleed",
142
+ render: /* @__PURE__ */ jsx("ul", {}),
143
+ className: "gap-0 divide-y overflow-hidden py-0",
144
+ children: pageItems.map((page) => /* @__PURE__ */ jsx("li", { "data-test": `layout-page-${page.id}`, children: /* @__PURE__ */ jsxs(
109
145
  Link,
110
146
  {
111
147
  href: `${links.experience}/pages/${page.id}`,
112
- className: "text-sm font-medium hover:underline",
113
- children: page.title
148
+ className: "hover:bg-muted focus-visible:ring-ring flex items-center gap-3 px-4 py-3 text-sm focus-visible:ring-2 focus-visible:outline-none focus-visible:ring-inset",
149
+ children: [
150
+ /* @__PURE__ */ jsx("span", { className: "font-medium", children: page.title }),
151
+ /* @__PURE__ */ jsx("code", { className: "text-muted-foreground truncate font-mono text-xs", children: page.id }),
152
+ /* @__PURE__ */ jsxs(StatusBadge, { tone: "neutral", className: "ml-auto", children: [
153
+ page.kind ?? "custom",
154
+ " page"
155
+ ] }),
156
+ /* @__PURE__ */ jsx(
157
+ Icon,
158
+ {
159
+ name: "caret-right",
160
+ className: "text-muted-foreground size-4 shrink-0",
161
+ "aria-hidden": true
162
+ }
163
+ )
164
+ ]
114
165
  }
115
- ),
116
- /* @__PURE__ */ jsx(StatusBadge, { tone: "neutral", children: page.kind ?? "custom" })
117
- ]
118
- },
119
- page.id
120
- )) }) : null
166
+ ) }, page.id))
167
+ }
168
+ )
169
+ ] }) : null
121
170
  ] })
122
171
  ] });
123
172
  }
@@ -1,9 +1,11 @@
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";
@@ -13,15 +15,51 @@ function ExperiencePageHost() {
13
15
  const links = useConsoleLinks();
14
16
  const project = useProject();
15
17
  const page = pages.find((entry) => entry.id === id);
16
- if (!page) notFound();
18
+ if (!page) {
19
+ const name = decodeURIComponent(id);
20
+ return /* @__PURE__ */ jsx(
21
+ NotFoundState,
22
+ {
23
+ testId: "page-not-found",
24
+ title: `No page called \u201C${name}\u201D`,
25
+ description: "This experience registers no page with that id. Pick one it does register.",
26
+ options: pages.map((entry) => ({
27
+ label: entry.id,
28
+ href: `${links.experience}/pages/${entry.id}`,
29
+ hint: entry.title
30
+ })),
31
+ ...pages.length > 0 ? { optionsLabel: "The pages in this experience" } : {},
32
+ action: {
33
+ label: "Back to the layout",
34
+ href: `${links.experience}/layout`
35
+ }
36
+ }
37
+ );
38
+ }
17
39
  const kind = page.kind ?? "custom";
18
40
  const path = rawPath ?? [];
19
41
  const sub = path.join("/");
20
42
  const productSlug = project.data?.name ?? "experience";
43
+ const base = `${links.experience}/pages/${page.id}`;
21
44
  if (sub !== "" && !page.routes?.some((route) => route.path === sub)) {
22
- notFound();
45
+ return /* @__PURE__ */ jsx(
46
+ NotFoundState,
47
+ {
48
+ testId: "page-not-found",
49
+ title: `${page.title} has no section \u201C${sub}\u201D`,
50
+ description: "The page declares no route at that path. Pick one of its sections.",
51
+ options: [{ path: "", title: page.title }, ...page.routes ?? []].map(
52
+ (route) => ({
53
+ label: route.path === "" ? "/" : route.path,
54
+ href: route.path === "" ? base : `${base}/${route.path}`,
55
+ hint: route.title
56
+ })
57
+ ),
58
+ optionsLabel: `The sections of ${page.title}`,
59
+ action: { label: `Back to ${page.title}`, href: base }
60
+ }
61
+ );
23
62
  }
24
- const base = `${links.experience}/pages/${page.id}`;
25
63
  const Page = page.component;
26
64
  return /* @__PURE__ */ jsxs(
27
65
  "div",
@@ -30,7 +68,27 @@ function ExperiencePageHost() {
30
68
  "data-test": "experience-page",
31
69
  "data-page-kind": kind,
32
70
  children: [
33
- /* @__PURE__ */ jsx("h1", { className: "font-heading px-4 pt-4 text-xl font-normal", children: page.title }),
71
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1 px-4 pt-4", children: [
72
+ /* @__PURE__ */ jsxs(
73
+ Link,
74
+ {
75
+ href: `${links.experience}/layout`,
76
+ 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",
77
+ "data-test": "experience-page-back",
78
+ children: [
79
+ /* @__PURE__ */ jsx(Icon, { name: "arrow-left", className: "size-3.5", "aria-hidden": true }),
80
+ "Layout"
81
+ ]
82
+ }
83
+ ),
84
+ /* @__PURE__ */ jsxs("h2", { className: "font-heading text-xl font-normal", children: [
85
+ page.title,
86
+ /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground ml-2 align-middle text-xs font-normal", children: [
87
+ kind,
88
+ " page"
89
+ ] })
90
+ ] })
91
+ ] }),
34
92
  page.routes && page.routes.length > 0 ? /* @__PURE__ */ jsx(
35
93
  "nav",
36
94
  {
@@ -1,2 +1,5 @@
1
- /** The declared review-queue sections, each rendered through the runner. */
1
+ /**
2
+ * What needs a person: approvals waiting on a decision (workflow gates and
3
+ * held writes), then the read-only lists the experience declares for review.
4
+ */
2
5
  export declare function ExperienceReviewQueuePage(): import("react").JSX.Element;