@ekanos/harness 0.28.0 → 0.30.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.
- package/dist/internal/components/ask-assistant-bridge.js +7 -1
- package/dist/internal/components/host-freshness.d.ts +12 -0
- package/dist/internal/components/host-freshness.js +61 -0
- package/dist/internal/components/publish-status.d.ts +27 -0
- package/dist/internal/components/publish-status.js +326 -0
- package/dist/internal/components/shell-header.js +16 -0
- package/dist/internal/components/surface-nav.js +17 -6
- package/dist/internal/components/workflow-runner.js +1 -1
- package/dist/internal/lib/docs-links.d.ts +2 -1
- package/dist/internal/lib/docs-links.js +6 -3
- package/dist/internal/lib/host-data.d.ts +44 -0
- package/dist/internal/lib/host-data.js +159 -0
- package/dist/internal/routes/catalog-pages.d.ts +15 -0
- package/dist/internal/routes/catalog-pages.js +425 -0
- package/dist/internal/routes/experience-layout-page.d.ts +6 -6
- package/dist/internal/routes/experience-layout-page.js +3 -168
- package/dist/internal/routes/experience-page-host.js +6 -8
- package/dist/internal/routes/experience-pages-page.d.ts +5 -0
- package/dist/internal/routes/experience-pages-page.js +118 -0
- package/dist/internal/routes/experience-summary-page.js +22 -14
- package/dist/internal/routes/experience-workflow-page.js +1 -1
- package/dist/internal/routes/experience-workflows-page.js +4 -4
- package/dist/internal/routes/integrations-overview-page.js +2 -0
- package/dist/internal/routes/publishes-pages.d.ts +4 -0
- package/dist/internal/routes/publishes-pages.js +19 -0
- package/dist/internal/routes/repo-home-page.js +6 -2
- package/dist/internal/server/ekanos-api-router.js +5 -0
- package/dist/internal/server/host-snapshots.d.ts +18 -0
- package/dist/internal/server/host-snapshots.js +67 -0
- package/dist/internal/server/repo-api-router.js +9 -0
- package/dist/internal/server/session-catalog.d.ts +12 -0
- package/dist/routes.d.ts +10 -1
- package/dist/routes.js +16 -0
- package/package.json +13 -13
|
@@ -1,174 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
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 {
|
|
12
|
-
EmptyMedia,
|
|
13
|
-
EmptyState,
|
|
14
|
-
EmptyStateHeading,
|
|
15
|
-
EmptyStateText
|
|
16
|
-
} from "@ekanos/ui/empty-state";
|
|
17
|
-
import { Icon } from "@ekanos/ui/icon";
|
|
18
|
-
import { StatusBadge } from "@ekanos/ui/status-badge";
|
|
19
|
-
import { DocsLink } from "../components/docs-link.js";
|
|
20
|
-
import { WidgetSurface } from "../components/widget-surface.js";
|
|
21
|
-
import { useConsoleLinks, useExperienceSurfaces } from "../lib/console-context.js";
|
|
22
|
-
import { useProject } from "../lib/console-hooks.js";
|
|
23
|
-
import { DOCS } from "../lib/docs-links.js";
|
|
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
|
-
},`;
|
|
2
|
+
import { redirect } from "next/navigation";
|
|
3
|
+
import { useConsoleLinks } from "../lib/console-context.js";
|
|
34
4
|
function ExperienceLayoutPage() {
|
|
35
|
-
const project = useProject();
|
|
36
5
|
const links = useConsoleLinks();
|
|
37
|
-
|
|
38
|
-
const [view, setView] = useState({ audience: EVERYONE, workspace: "" });
|
|
39
|
-
if (!suggestedLayout) {
|
|
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
|
-
);
|
|
60
|
-
}
|
|
61
|
-
const audiences = layoutAudienceNames(suggestedLayout);
|
|
62
|
-
const resolved = resolveLayoutForAudience(
|
|
63
|
-
suggestedLayout,
|
|
64
|
-
view.audience === EVERYONE ? null : view.audience
|
|
65
|
-
);
|
|
66
|
-
const active = resolved.workspaces.find(
|
|
67
|
-
(workspace) => workspace.slug === view.workspace
|
|
68
|
-
) ?? resolved.workspaces[0];
|
|
69
|
-
const productSlug = project.data?.name ?? "experience";
|
|
70
|
-
const shown = (refs) => refs.flatMap((ref) => {
|
|
71
|
-
const id = ref.slice(ref.indexOf(":") + 1);
|
|
72
|
-
const widget = widgets.find((w) => w.id === id);
|
|
73
|
-
return widget ? [widget] : [];
|
|
74
|
-
});
|
|
75
|
-
const itemRefs = active?.items.map((item) => item.ref) ?? [];
|
|
76
|
-
const widgetItems = shown(
|
|
77
|
-
itemRefs.filter((ref) => ref.startsWith("widget:"))
|
|
78
|
-
);
|
|
79
|
-
const pageItems = itemRefs.filter((ref) => ref.startsWith("page:")).map((ref) => ref.slice("page:".length)).flatMap((id) => {
|
|
80
|
-
const page = pages.find((p) => p.id === id);
|
|
81
|
-
return page ? [page] : [];
|
|
82
|
-
});
|
|
83
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", "data-test": "experience-layout", children: [
|
|
84
|
-
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
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
|
-
] }),
|
|
89
|
-
/* @__PURE__ */ jsxs("label", { className: "ml-auto flex items-center gap-2 text-sm", children: [
|
|
90
|
-
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: "Viewing as" }),
|
|
91
|
-
/* @__PURE__ */ jsxs(
|
|
92
|
-
"select",
|
|
93
|
-
{
|
|
94
|
-
value: view.audience,
|
|
95
|
-
onChange: (event) => setView({ audience: event.target.value, workspace: "" }),
|
|
96
|
-
className: "border-input bg-background rounded-md border px-3 py-2 text-sm",
|
|
97
|
-
"data-test": "layout-audience",
|
|
98
|
-
children: [
|
|
99
|
-
/* @__PURE__ */ jsx("option", { value: EVERYONE, children: "Everyone" }),
|
|
100
|
-
audiences.map((name) => /* @__PURE__ */ jsx("option", { value: name, children: name }, name))
|
|
101
|
-
]
|
|
102
|
-
}
|
|
103
|
-
)
|
|
104
|
-
] })
|
|
105
|
-
] }),
|
|
106
|
-
resolved.workspaces.length === 0 ? /* @__PURE__ */ jsxs("p", { className: "text-muted-foreground text-sm", "data-test": "layout-none", children: [
|
|
107
|
-
"Nothing in this layout is for",
|
|
108
|
-
" ",
|
|
109
|
-
view.audience === EVERYONE ? "everyone" : view.audience,
|
|
110
|
-
"."
|
|
111
|
-
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
112
|
-
/* @__PURE__ */ jsx(
|
|
113
|
-
"nav",
|
|
114
|
-
{
|
|
115
|
-
"aria-label": "Workspaces",
|
|
116
|
-
className: "flex flex-wrap gap-1",
|
|
117
|
-
"data-test": "layout-workspaces",
|
|
118
|
-
children: resolved.workspaces.map((workspace) => /* @__PURE__ */ jsx(
|
|
119
|
-
Button,
|
|
120
|
-
{
|
|
121
|
-
variant: workspace.slug === active?.slug ? "secondary" : "ghost",
|
|
122
|
-
size: "sm",
|
|
123
|
-
"aria-current": workspace.slug === active?.slug ? "page" : void 0,
|
|
124
|
-
onClick: () => setView((prev) => ({ ...prev, workspace: workspace.slug })),
|
|
125
|
-
"data-test": `layout-workspace-${workspace.slug}`,
|
|
126
|
-
children: workspace.name
|
|
127
|
-
},
|
|
128
|
-
workspace.slug
|
|
129
|
-
))
|
|
130
|
-
}
|
|
131
|
-
),
|
|
132
|
-
widgetItems.length > 0 ? /* @__PURE__ */ jsx(WidgetSurface, { widgets: widgetItems, productSlug }) : null,
|
|
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(
|
|
145
|
-
Link,
|
|
146
|
-
{
|
|
147
|
-
href: `${links.experience}/pages/${page.id}`,
|
|
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
|
-
]
|
|
165
|
-
}
|
|
166
|
-
) }, page.id))
|
|
167
|
-
}
|
|
168
|
-
)
|
|
169
|
-
] }) : null
|
|
170
|
-
] })
|
|
171
|
-
] });
|
|
6
|
+
return redirect(`${links.experience}/pages`);
|
|
172
7
|
}
|
|
173
8
|
export {
|
|
174
9
|
ExperienceLayoutPage
|
|
@@ -9,6 +9,7 @@ import { NotFoundState } from "../components/not-found-state.js";
|
|
|
9
9
|
import { WidgetSurface } from "../components/widget-surface.js";
|
|
10
10
|
import { useConsoleLinks, useExperienceSurfaces } from "../lib/console-context.js";
|
|
11
11
|
import { useProject } from "../lib/console-hooks.js";
|
|
12
|
+
import { pageKindLabel } from "./experience-pages-page.js";
|
|
12
13
|
function ExperiencePageHost() {
|
|
13
14
|
const { id, path: rawPath } = useParams();
|
|
14
15
|
const { pages, widgets } = useExperienceSurfaces();
|
|
@@ -30,8 +31,8 @@ function ExperiencePageHost() {
|
|
|
30
31
|
})),
|
|
31
32
|
...pages.length > 0 ? { optionsLabel: "The pages in this experience" } : {},
|
|
32
33
|
action: {
|
|
33
|
-
label: "Back to
|
|
34
|
-
href: `${links.experience}/
|
|
34
|
+
label: "Back to pages",
|
|
35
|
+
href: `${links.experience}/pages`
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
38
|
);
|
|
@@ -72,21 +73,18 @@ function ExperiencePageHost() {
|
|
|
72
73
|
/* @__PURE__ */ jsxs(
|
|
73
74
|
Link,
|
|
74
75
|
{
|
|
75
|
-
href: `${links.experience}/
|
|
76
|
+
href: `${links.experience}/pages`,
|
|
76
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",
|
|
77
78
|
"data-test": "experience-page-back",
|
|
78
79
|
children: [
|
|
79
80
|
/* @__PURE__ */ jsx(Icon, { name: "arrow-left", className: "size-3.5", "aria-hidden": true }),
|
|
80
|
-
"
|
|
81
|
+
"Pages"
|
|
81
82
|
]
|
|
82
83
|
}
|
|
83
84
|
),
|
|
84
85
|
/* @__PURE__ */ jsxs("h2", { className: "font-heading text-xl font-normal", children: [
|
|
85
86
|
page.title,
|
|
86
|
-
/* @__PURE__ */
|
|
87
|
-
kind,
|
|
88
|
-
" page"
|
|
89
|
-
] })
|
|
87
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground ml-2 align-middle text-xs font-normal", children: pageKindLabel(page.kind) })
|
|
90
88
|
] })
|
|
91
89
|
] }),
|
|
92
90
|
page.routes && page.routes.length > 0 ? /* @__PURE__ */ jsx(
|
|
@@ -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;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import Link from "next/link";
|
|
4
|
+
import { Card } from "@ekanos/ui/card";
|
|
5
|
+
import {
|
|
6
|
+
EmptyMedia,
|
|
7
|
+
EmptyState,
|
|
8
|
+
EmptyStateHeading,
|
|
9
|
+
EmptyStateText
|
|
10
|
+
} from "@ekanos/ui/empty-state";
|
|
11
|
+
import { Icon } from "@ekanos/ui/icon";
|
|
12
|
+
import { StatusBadge } from "@ekanos/ui/status-badge";
|
|
13
|
+
import { DocsLink } from "../components/docs-link.js";
|
|
14
|
+
import {
|
|
15
|
+
useConsoleLinks,
|
|
16
|
+
useExperienceSurfaces
|
|
17
|
+
} from "../lib/console-context.js";
|
|
18
|
+
import { DOCS } from "../lib/docs-links.js";
|
|
19
|
+
const PAGE_HINT = `pages: [
|
|
20
|
+
{
|
|
21
|
+
id: 'desk',
|
|
22
|
+
title: 'Desk',
|
|
23
|
+
path: 'desk',
|
|
24
|
+
component: DeskPage,
|
|
25
|
+
},
|
|
26
|
+
],`;
|
|
27
|
+
const KIND_LABELS = {
|
|
28
|
+
custom: "Page",
|
|
29
|
+
canvas: "Widget page",
|
|
30
|
+
overview: "Overview page"
|
|
31
|
+
};
|
|
32
|
+
function pageKindLabel(kind) {
|
|
33
|
+
return KIND_LABELS[kind ?? "custom"] ?? "Page";
|
|
34
|
+
}
|
|
35
|
+
function pageDetail(page) {
|
|
36
|
+
if (page.kind === "canvas") {
|
|
37
|
+
const count = page.widgets?.length ?? 0;
|
|
38
|
+
return `${count} widget${count === 1 ? "" : "s"}`;
|
|
39
|
+
}
|
|
40
|
+
const sections = page.routes?.length ?? 0;
|
|
41
|
+
if (sections > 0) {
|
|
42
|
+
return `${sections + 1} sections`;
|
|
43
|
+
}
|
|
44
|
+
return page.kind === "overview" && !page.component ? "Shows every widget in the experience" : null;
|
|
45
|
+
}
|
|
46
|
+
function ExperiencePagesPage() {
|
|
47
|
+
const links = useConsoleLinks();
|
|
48
|
+
const { pages } = useExperienceSurfaces();
|
|
49
|
+
if (pages.length === 0) {
|
|
50
|
+
return /* @__PURE__ */ jsxs(
|
|
51
|
+
EmptyState,
|
|
52
|
+
{
|
|
53
|
+
className: "min-w-0 py-12 *:max-w-full *:min-w-0",
|
|
54
|
+
"data-test": "pages-empty",
|
|
55
|
+
children: [
|
|
56
|
+
/* @__PURE__ */ jsx(EmptyMedia, { variant: "icon", children: /* @__PURE__ */ jsx(Icon, { name: "browser" }) }),
|
|
57
|
+
/* @__PURE__ */ jsx(EmptyStateHeading, { children: "No pages yet" }),
|
|
58
|
+
/* @__PURE__ */ jsxs(EmptyStateText, { className: "max-w-md", children: [
|
|
59
|
+
"A page is a full screen this experience ships, such as a desk or a detail view. Add ",
|
|
60
|
+
/* @__PURE__ */ jsx("code", { children: "pages" }),
|
|
61
|
+
" to ",
|
|
62
|
+
/* @__PURE__ */ jsx("code", { children: "defineExperience" }),
|
|
63
|
+
" ",
|
|
64
|
+
"and each one opens here."
|
|
65
|
+
] }),
|
|
66
|
+
/* @__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: PAGE_HINT }),
|
|
67
|
+
/* @__PURE__ */ jsx(DocsLink, { href: DOCS.pageKinds, className: "mt-3", children: "Pages" })
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", "data-test": "experience-pages", children: [
|
|
73
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
74
|
+
/* @__PURE__ */ jsx("h2", { className: "font-heading text-xl font-normal", children: "Pages" }),
|
|
75
|
+
/* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm", children: "Every page this experience ships. Where each one appears is set by whoever arranges the workspaces." })
|
|
76
|
+
] }),
|
|
77
|
+
/* @__PURE__ */ jsx(
|
|
78
|
+
Card,
|
|
79
|
+
{
|
|
80
|
+
layout: "bleed",
|
|
81
|
+
render: /* @__PURE__ */ jsx("ul", {}),
|
|
82
|
+
className: "gap-0 divide-y overflow-hidden py-0",
|
|
83
|
+
children: pages.map((page) => {
|
|
84
|
+
const detail = pageDetail(page);
|
|
85
|
+
return /* @__PURE__ */ jsx("li", { "data-test": `page-row-${page.id}`, children: /* @__PURE__ */ jsxs(
|
|
86
|
+
Link,
|
|
87
|
+
{
|
|
88
|
+
href: `${links.experience}/pages/${page.id}`,
|
|
89
|
+
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",
|
|
90
|
+
children: [
|
|
91
|
+
/* @__PURE__ */ jsxs("span", { className: "flex min-w-0 flex-col gap-0.5", children: [
|
|
92
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium", children: page.title }),
|
|
93
|
+
/* @__PURE__ */ jsxs("span", { className: "text-muted-foreground flex min-w-0 gap-2 text-xs", children: [
|
|
94
|
+
/* @__PURE__ */ jsx("code", { className: "truncate font-mono", children: page.id }),
|
|
95
|
+
detail ? /* @__PURE__ */ jsx("span", { children: detail }) : null
|
|
96
|
+
] })
|
|
97
|
+
] }),
|
|
98
|
+
/* @__PURE__ */ jsx(StatusBadge, { tone: "neutral", className: "ml-auto shrink-0", children: pageKindLabel(page.kind) }),
|
|
99
|
+
/* @__PURE__ */ jsx(
|
|
100
|
+
Icon,
|
|
101
|
+
{
|
|
102
|
+
name: "caret-right",
|
|
103
|
+
className: "text-muted-foreground size-4 shrink-0",
|
|
104
|
+
"aria-hidden": true
|
|
105
|
+
}
|
|
106
|
+
)
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
) }, page.id);
|
|
110
|
+
})
|
|
111
|
+
}
|
|
112
|
+
)
|
|
113
|
+
] });
|
|
114
|
+
}
|
|
115
|
+
export {
|
|
116
|
+
ExperiencePagesPage,
|
|
117
|
+
pageKindLabel
|
|
118
|
+
};
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
} from "../components/integration-badge.js";
|
|
14
14
|
import { PageSkeleton } from "../components/page-skeletons.js";
|
|
15
15
|
import { localIntegrations } from "../components/provenance-banner.js";
|
|
16
|
+
import { LatestPublishLine } from "../components/publish-status.js";
|
|
16
17
|
import { RuntimeStrip } from "../components/runtime-strip.js";
|
|
17
18
|
import { FOCUS_RING } from "../components/scrollable-nav.js";
|
|
18
19
|
import { useConsoleLinks, useExperienceSurfaces } from "../lib/console-context.js";
|
|
@@ -130,7 +131,7 @@ function ExperienceSummaryPage() {
|
|
|
130
131
|
const project = useProject();
|
|
131
132
|
const experience = useExperience();
|
|
132
133
|
const links = useConsoleLinks();
|
|
133
|
-
const { widgets, pages
|
|
134
|
+
const { widgets, pages } = useExperienceSurfaces();
|
|
134
135
|
if (!project.data) {
|
|
135
136
|
return /* @__PURE__ */ jsx(PageSkeleton, { label: "Loading the experience" });
|
|
136
137
|
}
|
|
@@ -143,6 +144,13 @@ function ExperienceSummaryPage() {
|
|
|
143
144
|
checks
|
|
144
145
|
});
|
|
145
146
|
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-8", "data-test": "experience-summary", children: [
|
|
147
|
+
/* @__PURE__ */ jsx(
|
|
148
|
+
LatestPublishLine,
|
|
149
|
+
{
|
|
150
|
+
name: project.data.name,
|
|
151
|
+
href: `${links.experience}/publishes`
|
|
152
|
+
}
|
|
153
|
+
),
|
|
146
154
|
/* @__PURE__ */ jsxs("section", { className: "flex flex-col gap-3", children: [
|
|
147
155
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
148
156
|
/* @__PURE__ */ jsx("h2", { className: "font-heading text-xl font-normal", children: "Is it ready?" }),
|
|
@@ -151,7 +159,7 @@ function ExperienceSummaryPage() {
|
|
|
151
159
|
/* @__PURE__ */ jsx(RuntimeStrip, {})
|
|
152
160
|
] }),
|
|
153
161
|
/* @__PURE__ */ jsxs("section", { className: "flex flex-col gap-3", children: [
|
|
154
|
-
/* @__PURE__ */ jsx("h2", { className: "font-heading text-xl font-normal", children: "What
|
|
162
|
+
/* @__PURE__ */ jsx("h2", { className: "font-heading text-xl font-normal", children: "What it ships" }),
|
|
155
163
|
/* @__PURE__ */ jsxs("ul", { className: "grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4", children: [
|
|
156
164
|
/* @__PURE__ */ jsx(
|
|
157
165
|
SurfaceCard,
|
|
@@ -167,23 +175,23 @@ function ExperienceSummaryPage() {
|
|
|
167
175
|
/* @__PURE__ */ jsx(
|
|
168
176
|
SurfaceCard,
|
|
169
177
|
{
|
|
170
|
-
href: `${links.experience}/
|
|
171
|
-
icon: "
|
|
172
|
-
title: "
|
|
173
|
-
count: count(
|
|
174
|
-
text: "
|
|
175
|
-
testId: "summary-
|
|
178
|
+
href: `${links.experience}/pages`,
|
|
179
|
+
icon: "browser",
|
|
180
|
+
title: "Pages",
|
|
181
|
+
count: count(pages.length, "page"),
|
|
182
|
+
text: "Every full screen the experience ships, opened as the host shows it.",
|
|
183
|
+
testId: "summary-pages"
|
|
176
184
|
}
|
|
177
185
|
),
|
|
178
186
|
/* @__PURE__ */ jsx(
|
|
179
187
|
SurfaceCard,
|
|
180
188
|
{
|
|
181
|
-
href: `${links.experience}/
|
|
182
|
-
icon: "
|
|
183
|
-
title: "
|
|
184
|
-
count:
|
|
185
|
-
text:
|
|
186
|
-
testId: "summary-
|
|
189
|
+
href: `${links.experience}/workflows`,
|
|
190
|
+
icon: "flow-arrow",
|
|
191
|
+
title: "Workflows",
|
|
192
|
+
count: count(workflows.length, "workflow"),
|
|
193
|
+
text: "Step through each workflow and run it here.",
|
|
194
|
+
testId: "summary-workflows"
|
|
187
195
|
}
|
|
188
196
|
),
|
|
189
197
|
/* @__PURE__ */ jsx(
|
|
@@ -33,7 +33,7 @@ function ExperienceWorkflowPage() {
|
|
|
33
33
|
{
|
|
34
34
|
testId: "workflow-not-found",
|
|
35
35
|
title: `No workflow called \u201C${name}\u201D`,
|
|
36
|
-
description: workflows.length > 0 ? "This experience has no workflow
|
|
36
|
+
description: workflows.length > 0 ? "This experience has no workflow with that id. Pick one it does have." : "This experience has no workflows yet.",
|
|
37
37
|
options: workflows.map((entry) => ({
|
|
38
38
|
label: entry.id,
|
|
39
39
|
href: `${links.experience}/workflows/${entry.id}`,
|
|
@@ -30,15 +30,15 @@ function ExperienceWorkflowsPage() {
|
|
|
30
30
|
}
|
|
31
31
|
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", "data-test": "experience-workflows", children: [
|
|
32
32
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
33
|
-
/* @__PURE__ */ jsx("h2", { className: "font-heading text-xl font-normal", children: "
|
|
34
|
-
/* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm", children: "Each
|
|
33
|
+
/* @__PURE__ */ jsx("h2", { className: "font-heading text-xl font-normal", children: "Workflows" }),
|
|
34
|
+
/* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm", children: "Each workflow runs here against fixtures. Open one to see its steps and run it." })
|
|
35
35
|
] }),
|
|
36
36
|
workflows.length === 0 ? /* @__PURE__ */ jsxs(
|
|
37
37
|
EmptyNote,
|
|
38
38
|
{
|
|
39
39
|
icon: "flow-arrow",
|
|
40
|
-
title: "No
|
|
41
|
-
action: /* @__PURE__ */ jsx(DocsLink, { href: DOCS.workflows, children: "Write a workflow
|
|
40
|
+
title: "No workflows yet",
|
|
41
|
+
action: /* @__PURE__ */ jsx(DocsLink, { href: DOCS.workflows, children: "Write a workflow" }),
|
|
42
42
|
children: [
|
|
43
43
|
"Add ",
|
|
44
44
|
/* @__PURE__ */ jsx("code", { children: "workflows" }),
|
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
provenanceTitle
|
|
17
17
|
} from "../components/integration-badge.js";
|
|
18
18
|
import { OverviewSkeleton } from "../components/integration-tab-skeletons.js";
|
|
19
|
+
import { LatestPublishLine } from "../components/publish-status.js";
|
|
19
20
|
import { CONNECTION_KIND_LABEL } from "../lib/connection-facts.js";
|
|
20
21
|
import { useConnection, useRuns } from "../lib/console-hooks.js";
|
|
21
22
|
import {
|
|
@@ -198,6 +199,7 @@ function Overview({
|
|
|
198
199
|
slug
|
|
199
200
|
});
|
|
200
201
|
return /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-col gap-6", "data-test": "overview", children: [
|
|
202
|
+
base ? /* @__PURE__ */ jsx(LatestPublishLine, { name: slug, href: `${base}/publishes` }) : null,
|
|
201
203
|
next ? /* @__PURE__ */ jsx(NextAction, { next, base }) : connection.isError ? /* @__PURE__ */ jsxs("p", { className: "text-destructive text-sm", role: "alert", children: [
|
|
202
204
|
"Could not read the connection: ",
|
|
203
205
|
connection.error.message
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useParams } from "next/navigation";
|
|
4
|
+
import { PageSkeleton } from "../components/page-skeletons.js";
|
|
5
|
+
import { PublishesView } from "../components/publish-status.js";
|
|
6
|
+
import { useProject } from "../lib/console-hooks.js";
|
|
7
|
+
function IntegrationPublishesPage() {
|
|
8
|
+
const { slug } = useParams();
|
|
9
|
+
return /* @__PURE__ */ jsx(PublishesView, { name: decodeURIComponent(slug) });
|
|
10
|
+
}
|
|
11
|
+
function ExperiencePublishesPage() {
|
|
12
|
+
const project = useProject();
|
|
13
|
+
if (!project.data) return /* @__PURE__ */ jsx(PageSkeleton, { label: "Loading the experience" });
|
|
14
|
+
return /* @__PURE__ */ jsx(PublishesView, { name: project.data.name });
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
ExperiencePublishesPage,
|
|
18
|
+
IntegrationPublishesPage
|
|
19
|
+
};
|
|
@@ -11,6 +11,7 @@ import { cn } from "@ekanos/ui/utils";
|
|
|
11
11
|
import { useQueryClient } from "@tanstack/react-query";
|
|
12
12
|
import { ConnectControls } from "../components/connect-controls.js";
|
|
13
13
|
import { DocsLink } from "../components/docs-link.js";
|
|
14
|
+
import { PublishChip } from "../components/publish-status.js";
|
|
14
15
|
import {
|
|
15
16
|
CONNECTION_TYPE,
|
|
16
17
|
ConnectionStatusChip,
|
|
@@ -244,6 +245,7 @@ function IntegrationRow({
|
|
|
244
245
|
"v",
|
|
245
246
|
row.version
|
|
246
247
|
] }),
|
|
248
|
+
/* @__PURE__ */ jsx(PublishChip, { name: row.name }),
|
|
247
249
|
row.contractVersion ? /* @__PURE__ */ jsxs(
|
|
248
250
|
"span",
|
|
249
251
|
{
|
|
@@ -373,7 +375,8 @@ function ExperienceRow({ row }) {
|
|
|
373
375
|
/* @__PURE__ */ jsxs("span", { className: "text-muted-foreground font-mono text-xs", children: [
|
|
374
376
|
"v",
|
|
375
377
|
row.version
|
|
376
|
-
] })
|
|
378
|
+
] }),
|
|
379
|
+
/* @__PURE__ */ jsx(PublishChip, { name: row.name })
|
|
377
380
|
] }),
|
|
378
381
|
row.error ? /* @__PURE__ */ jsx("p", { className: "text-destructive text-xs", children: row.error }) : null,
|
|
379
382
|
row.integrations.length > 0 ? /* @__PURE__ */ jsxs(
|
|
@@ -400,6 +403,7 @@ function ExperienceRow({ row }) {
|
|
|
400
403
|
) : /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-xs", children: "Uses no integrations." }),
|
|
401
404
|
/* @__PURE__ */ jsxs("p", { className: "flex flex-wrap gap-x-3 gap-y-1", children: [
|
|
402
405
|
/* @__PURE__ */ jsx(Link, { href: `${row.viewHref}/widgets`, className: QUIET_LINK, children: "Widgets" }),
|
|
406
|
+
/* @__PURE__ */ jsx(Link, { href: `${row.viewHref}/pages`, className: QUIET_LINK, children: "Pages" }),
|
|
403
407
|
/* @__PURE__ */ jsx(Link, { href: `${row.viewHref}/workflows`, className: QUIET_LINK, children: "Workflows" }),
|
|
404
408
|
/* @__PURE__ */ jsx(Link, { href: `${row.viewHref}/review-queue`, className: QUIET_LINK, children: "Review queue" })
|
|
405
409
|
] })
|
|
@@ -490,7 +494,7 @@ function RepoHomePage() {
|
|
|
490
494
|
/* @__PURE__ */ jsxs("section", { className: "flex flex-col gap-3", "data-test": "repo-experiences", children: [
|
|
491
495
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
492
496
|
/* @__PURE__ */ jsx("h2", { className: "font-heading text-xl font-normal", children: "Experiences" }),
|
|
493
|
-
/* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm", children: "Each previews its widgets,
|
|
497
|
+
/* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm", children: "Each previews its widgets, pages and workflows against the integrations it uses." })
|
|
494
498
|
] }),
|
|
495
499
|
experiences.length === 0 ? /* @__PURE__ */ jsxs(
|
|
496
500
|
EmptyNote,
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
loadExperience,
|
|
15
15
|
usedByIndex
|
|
16
16
|
} from "./experience-loader.js";
|
|
17
|
+
import { handleHostRoute } from "./host-snapshots.js";
|
|
17
18
|
import { publishIntegrationLookup } from "./integration-lookup.js";
|
|
18
19
|
import {
|
|
19
20
|
formatProvenanceLines,
|
|
@@ -338,6 +339,10 @@ function createEkanosApiRouter(partial = {}) {
|
|
|
338
339
|
return apiError(500, "no_project_root", `${root.message} ${root.hint}`);
|
|
339
340
|
const method = request.method.toUpperCase();
|
|
340
341
|
const [head, ...rest] = segments;
|
|
342
|
+
if (head === "host") {
|
|
343
|
+
const hosted = handleHostRoute(root.root, method, rest);
|
|
344
|
+
if (hosted) return hosted;
|
|
345
|
+
}
|
|
341
346
|
try {
|
|
342
347
|
if ((head === "integrations" || head === "slots") && rest.length === 0) {
|
|
343
348
|
if (method !== "GET")
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type CatalogSnapshot, type PublishStatusSnapshot } from '@ekanos/integration-schema';
|
|
2
|
+
export interface HostCatalogResponse {
|
|
3
|
+
/** Null until `ekanos dev` has written one: an older CLI, or the first read still in flight. */
|
|
4
|
+
snapshot: CatalogSnapshot | null;
|
|
5
|
+
}
|
|
6
|
+
export interface HostPublishResponse {
|
|
7
|
+
snapshot: PublishStatusSnapshot | null;
|
|
8
|
+
}
|
|
9
|
+
export declare function readCatalogSnapshot(root: string): CatalogSnapshot | null;
|
|
10
|
+
export declare function readPublishSnapshot(root: string): PublishStatusSnapshot | null;
|
|
11
|
+
/** Ask the running `ekanos dev` for a fresh read of both snapshots. */
|
|
12
|
+
export declare function requestHostRefresh(root: string): void;
|
|
13
|
+
/**
|
|
14
|
+
* `GET host/catalog`, `GET host/publish-status`, `POST host/refresh`, served
|
|
15
|
+
* from `root` (the project, or the repo root). Null for anything else, so the
|
|
16
|
+
* caller answers its own 404.
|
|
17
|
+
*/
|
|
18
|
+
export declare function handleHostRoute(root: string, method: string, rest: readonly string[]): Response | null;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CatalogSnapshotSchema,
|
|
3
|
+
PublishStatusSnapshotSchema
|
|
4
|
+
} from "@ekanos/integration-schema";
|
|
5
|
+
import * as fs from "node:fs";
|
|
6
|
+
import * as path from "node:path";
|
|
7
|
+
const CATALOG_FILE = path.join(".ekanos", "catalog.json");
|
|
8
|
+
const PUBLISH_FILE = path.join(".ekanos", "publish-status.json");
|
|
9
|
+
const REFRESH_REQUEST = path.join(".ekanos", "refresh-request");
|
|
10
|
+
function readJson(root, file) {
|
|
11
|
+
try {
|
|
12
|
+
return JSON.parse(fs.readFileSync(path.join(root, file), "utf8"));
|
|
13
|
+
} catch {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function readCatalogSnapshot(root) {
|
|
18
|
+
const parsed = CatalogSnapshotSchema.safeParse(readJson(root, CATALOG_FILE));
|
|
19
|
+
return parsed.success ? parsed.data : null;
|
|
20
|
+
}
|
|
21
|
+
function readPublishSnapshot(root) {
|
|
22
|
+
const parsed = PublishStatusSnapshotSchema.safeParse(
|
|
23
|
+
readJson(root, PUBLISH_FILE)
|
|
24
|
+
);
|
|
25
|
+
return parsed.success ? parsed.data : null;
|
|
26
|
+
}
|
|
27
|
+
function requestHostRefresh(root) {
|
|
28
|
+
const file = path.join(root, REFRESH_REQUEST);
|
|
29
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
30
|
+
fs.writeFileSync(file, `${(/* @__PURE__ */ new Date()).toISOString()}
|
|
31
|
+
`);
|
|
32
|
+
}
|
|
33
|
+
function json(body, status = 200) {
|
|
34
|
+
return new Response(JSON.stringify(body), {
|
|
35
|
+
status,
|
|
36
|
+
headers: {
|
|
37
|
+
"content-type": "application/json",
|
|
38
|
+
"cache-control": "no-store"
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
function handleHostRoute(root, method, rest) {
|
|
43
|
+
const [name] = rest;
|
|
44
|
+
if (rest.length !== 1) return null;
|
|
45
|
+
if (name === "catalog") {
|
|
46
|
+
if (method !== "GET") return json({ error: "GET only." }, 405);
|
|
47
|
+
const body = { snapshot: readCatalogSnapshot(root) };
|
|
48
|
+
return json(body);
|
|
49
|
+
}
|
|
50
|
+
if (name === "publish-status") {
|
|
51
|
+
if (method !== "GET") return json({ error: "GET only." }, 405);
|
|
52
|
+
const body = { snapshot: readPublishSnapshot(root) };
|
|
53
|
+
return json(body);
|
|
54
|
+
}
|
|
55
|
+
if (name === "refresh") {
|
|
56
|
+
if (method !== "POST") return json({ error: "POST only." }, 405);
|
|
57
|
+
requestHostRefresh(root);
|
|
58
|
+
return json({ requested: true }, 202);
|
|
59
|
+
}
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
export {
|
|
63
|
+
handleHostRoute,
|
|
64
|
+
readCatalogSnapshot,
|
|
65
|
+
readPublishSnapshot,
|
|
66
|
+
requestHostRefresh
|
|
67
|
+
};
|