@ekanos/harness 0.29.0 → 0.31.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/api-types.d.ts +21 -0
- 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 +39 -0
- package/dist/internal/components/publish-status.js +363 -0
- package/dist/internal/components/shell-header.js +16 -0
- package/dist/internal/components/surface-nav.js +12 -0
- package/dist/internal/lib/console-client.js +2 -1
- package/dist/internal/lib/console-types.d.ts +4 -2
- package/dist/internal/lib/docs-links.d.ts +2 -0
- package/dist/internal/lib/docs-links.js +6 -1
- package/dist/internal/lib/host-data.d.ts +44 -0
- package/dist/internal/lib/host-data.js +159 -0
- package/dist/internal/lib/name-scope.d.ts +28 -0
- package/dist/internal/lib/name-scope.js +54 -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-summary-page.js +9 -0
- package/dist/internal/routes/integrations-overview-page.js +11 -1
- 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 +7 -2
- package/dist/internal/server/ekanos-api-router.js +8 -0
- package/dist/internal/server/host-snapshots.d.ts +18 -0
- package/dist/internal/server/host-snapshots.js +67 -0
- package/dist/internal/server/package-naming.d.ts +14 -0
- package/dist/internal/server/package-naming.js +43 -0
- package/dist/internal/server/repo-api-router.js +17 -3
- package/dist/internal/server/session-catalog.d.ts +12 -0
- package/dist/routes.d.ts +7 -0
- package/dist/routes.js +14 -0
- package/package.json +7 -7
|
@@ -0,0 +1,425 @@
|
|
|
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 { useParams } from "next/navigation";
|
|
6
|
+
import { Alert, AlertDescription } from "@ekanos/ui/alert";
|
|
7
|
+
import { Badge } from "@ekanos/ui/badge";
|
|
8
|
+
import { Card } from "@ekanos/ui/card";
|
|
9
|
+
import { EmptyNote } from "@ekanos/ui/empty-note";
|
|
10
|
+
import { Icon } from "@ekanos/ui/icon";
|
|
11
|
+
import { SearchField } from "@ekanos/ui/search-field";
|
|
12
|
+
import { StatusBadge } from "@ekanos/ui/status-badge";
|
|
13
|
+
import { cn } from "@ekanos/ui/utils";
|
|
14
|
+
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
15
|
+
import { HostFreshness } from "../components/host-freshness.js";
|
|
16
|
+
import { NotFoundState } from "../components/not-found-state.js";
|
|
17
|
+
import { PageSkeleton } from "../components/page-skeletons.js";
|
|
18
|
+
import { RunLogCopyButton } from "../components/run-log-copy.js";
|
|
19
|
+
import { FOCUS_RING } from "../components/scrollable-nav.js";
|
|
20
|
+
import { SegmentedControl } from "../components/segmented-control.js";
|
|
21
|
+
import { ShellHeader } from "../components/shell-header.js";
|
|
22
|
+
import {
|
|
23
|
+
catalogHref,
|
|
24
|
+
catalogPackageName,
|
|
25
|
+
filterCatalog,
|
|
26
|
+
useCatalogSnapshot
|
|
27
|
+
} from "../lib/host-data.js";
|
|
28
|
+
function CatalogLayout({ children }) {
|
|
29
|
+
const [queryClient] = useState(
|
|
30
|
+
() => new QueryClient({
|
|
31
|
+
defaultOptions: { queries: { retry: false, staleTime: 2e3 } }
|
|
32
|
+
})
|
|
33
|
+
);
|
|
34
|
+
return /* @__PURE__ */ jsx(QueryClientProvider, { client: queryClient, children: /* @__PURE__ */ jsxs("div", { className: "flex min-h-screen flex-col", "data-test": "catalog-frame", children: [
|
|
35
|
+
/* @__PURE__ */ jsx(
|
|
36
|
+
ShellHeader,
|
|
37
|
+
{
|
|
38
|
+
title: "Catalog",
|
|
39
|
+
kind: "ekanos",
|
|
40
|
+
crumbs: [{ label: "Home", href: "/" }]
|
|
41
|
+
}
|
|
42
|
+
),
|
|
43
|
+
/* @__PURE__ */ jsx(
|
|
44
|
+
"main",
|
|
45
|
+
{
|
|
46
|
+
id: "main-content",
|
|
47
|
+
tabIndex: -1,
|
|
48
|
+
className: "mx-auto flex w-full max-w-5xl min-w-0 flex-col gap-6 px-4 py-8 outline-none sm:px-6",
|
|
49
|
+
children
|
|
50
|
+
}
|
|
51
|
+
)
|
|
52
|
+
] }) });
|
|
53
|
+
}
|
|
54
|
+
const AVAILABILITY_WORDS = {
|
|
55
|
+
enabled: { label: "On for your Source", tone: "clear" },
|
|
56
|
+
available: { label: "Available", tone: "neutral" },
|
|
57
|
+
"turned-off": { label: "Turned off", tone: "warning" }
|
|
58
|
+
};
|
|
59
|
+
function ownerLabel(product) {
|
|
60
|
+
if (product.owned) return "Your Source";
|
|
61
|
+
if (product.partner) return "Partner";
|
|
62
|
+
return "Ekanos";
|
|
63
|
+
}
|
|
64
|
+
function count(value, noun) {
|
|
65
|
+
return `${value} ${noun}${value === 1 ? "" : "s"}`;
|
|
66
|
+
}
|
|
67
|
+
function productReach(product) {
|
|
68
|
+
if (product.kind === "experience") {
|
|
69
|
+
const parts2 = [];
|
|
70
|
+
const summary = product.experience;
|
|
71
|
+
if (summary) {
|
|
72
|
+
if (summary.integrations.length > 0) {
|
|
73
|
+
parts2.push(
|
|
74
|
+
`Uses ${summary.integrations.map((entry) => entry.name).join(", ")}`
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
parts2.push(
|
|
78
|
+
count(summary.widgets, "widget"),
|
|
79
|
+
count(summary.pages, "page"),
|
|
80
|
+
count(summary.workflows, "workflow")
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
return parts2.join(" \xB7 ");
|
|
84
|
+
}
|
|
85
|
+
const reads = product.tools.filter((tool) => tool.effect === "read").length;
|
|
86
|
+
const writes = product.tools.length - reads;
|
|
87
|
+
const parts = [count(reads, "read"), count(writes, "write")];
|
|
88
|
+
if (product.agentEvents.length > 0) {
|
|
89
|
+
parts.push(count(product.agentEvents.length, "event"));
|
|
90
|
+
}
|
|
91
|
+
return parts.join(" \xB7 ");
|
|
92
|
+
}
|
|
93
|
+
function scopeLine(snapshot) {
|
|
94
|
+
if (!snapshot) return null;
|
|
95
|
+
if (snapshot.scope === "source") {
|
|
96
|
+
return `Everything ${snapshot.source?.name ?? snapshot.source?.slug ?? "your Source"} can use, including what it has not turned on yet.`;
|
|
97
|
+
}
|
|
98
|
+
if (snapshot.scope === "public") {
|
|
99
|
+
return "Everything available on Ekanos to any Source. Log in with a Source to see its own integrations too.";
|
|
100
|
+
}
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
function CatalogPage() {
|
|
104
|
+
const catalog = useCatalogSnapshot();
|
|
105
|
+
const [filters, setFilters] = useState({ query: "", kind: "all", availability: "all" });
|
|
106
|
+
if (catalog.isPending) return /* @__PURE__ */ jsx(PageSkeleton, { label: "Loading the catalog" });
|
|
107
|
+
if (catalog.isError) {
|
|
108
|
+
return /* @__PURE__ */ jsx(Alert, { variant: "destructive", "data-test": "catalog-error", children: /* @__PURE__ */ jsxs(AlertDescription, { children: [
|
|
109
|
+
"Could not read the catalog from the harness server:",
|
|
110
|
+
" ",
|
|
111
|
+
catalog.error.message,
|
|
112
|
+
". Check that ",
|
|
113
|
+
/* @__PURE__ */ jsx("code", { children: "ekanos dev" }),
|
|
114
|
+
" is still running, then reload."
|
|
115
|
+
] }) });
|
|
116
|
+
}
|
|
117
|
+
const snapshot = catalog.data.snapshot;
|
|
118
|
+
if (!snapshot) {
|
|
119
|
+
return /* @__PURE__ */ jsxs(EmptyNote, { icon: "books", title: "No catalog yet", "data-test": "catalog-none", children: [
|
|
120
|
+
/* @__PURE__ */ jsx("code", { children: "ekanos dev" }),
|
|
121
|
+
" reads the catalog from Ekanos when it starts. If this stays empty, upgrade with ",
|
|
122
|
+
/* @__PURE__ */ jsx("code", { children: "ekanos upgrade" }),
|
|
123
|
+
" and restart",
|
|
124
|
+
" ",
|
|
125
|
+
/* @__PURE__ */ jsx("code", { children: "ekanos dev" }),
|
|
126
|
+
"."
|
|
127
|
+
] });
|
|
128
|
+
}
|
|
129
|
+
const buildable = snapshot.products.filter(
|
|
130
|
+
(product) => product.kind !== "feature"
|
|
131
|
+
);
|
|
132
|
+
const shown = filterCatalog(snapshot.products, filters);
|
|
133
|
+
const integrations = buildable.filter((p) => p.kind === "integration").length;
|
|
134
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", "data-test": "catalog", children: [
|
|
135
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
136
|
+
/* @__PURE__ */ jsx("h2", { className: "font-heading text-xl font-normal", children: "Integrations and experiences to build on" }),
|
|
137
|
+
/* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm", children: scopeLine(snapshot) }),
|
|
138
|
+
/* @__PURE__ */ jsx(HostFreshness, { fetchedAt: snapshot.fetchedAt, host: snapshot.host })
|
|
139
|
+
] }),
|
|
140
|
+
snapshot.unavailable ? /* @__PURE__ */ jsx(Alert, { variant: "warning", "data-test": "catalog-unavailable", children: /* @__PURE__ */ jsx(AlertDescription, { children: snapshot.unavailable.message }) }) : null,
|
|
141
|
+
/* @__PURE__ */ jsxs(
|
|
142
|
+
"div",
|
|
143
|
+
{
|
|
144
|
+
className: "bg-background sticky top-0 z-30 flex flex-col gap-2 border-b py-3 lg:flex-row lg:items-center lg:gap-3",
|
|
145
|
+
"data-test": "catalog-toolbar",
|
|
146
|
+
children: [
|
|
147
|
+
/* @__PURE__ */ jsx(
|
|
148
|
+
SearchField,
|
|
149
|
+
{
|
|
150
|
+
value: filters.query,
|
|
151
|
+
onValueChange: (query) => setFilters((prev) => ({ ...prev, query })),
|
|
152
|
+
"aria-label": "Search the catalog",
|
|
153
|
+
placeholder: "Search by name or what it does",
|
|
154
|
+
className: "lg:max-w-md lg:flex-1",
|
|
155
|
+
"data-test": "catalog-search"
|
|
156
|
+
}
|
|
157
|
+
),
|
|
158
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-x-3 gap-y-2", children: [
|
|
159
|
+
/* @__PURE__ */ jsx(
|
|
160
|
+
SegmentedControl,
|
|
161
|
+
{
|
|
162
|
+
label: "Kind",
|
|
163
|
+
testPrefix: "catalog-kind",
|
|
164
|
+
value: filters.kind,
|
|
165
|
+
onChange: (kind) => setFilters((prev) => ({ ...prev, kind })),
|
|
166
|
+
options: [
|
|
167
|
+
{ value: "all", label: "All" },
|
|
168
|
+
{ value: "integration", label: `Integrations ${integrations}` },
|
|
169
|
+
{
|
|
170
|
+
value: "experience",
|
|
171
|
+
label: `Experiences ${buildable.length - integrations}`
|
|
172
|
+
}
|
|
173
|
+
]
|
|
174
|
+
}
|
|
175
|
+
),
|
|
176
|
+
snapshot.scope === "source" ? /* @__PURE__ */ jsx(
|
|
177
|
+
SegmentedControl,
|
|
178
|
+
{
|
|
179
|
+
label: "Availability",
|
|
180
|
+
testPrefix: "catalog-availability",
|
|
181
|
+
value: filters.availability,
|
|
182
|
+
onChange: (availability) => setFilters((prev) => ({ ...prev, availability })),
|
|
183
|
+
options: [
|
|
184
|
+
{ value: "all", label: "All" },
|
|
185
|
+
{ value: "enabled", label: "On" },
|
|
186
|
+
{ value: "available", label: "Available" },
|
|
187
|
+
{ value: "mine", label: "Your Source" }
|
|
188
|
+
]
|
|
189
|
+
}
|
|
190
|
+
) : null
|
|
191
|
+
] })
|
|
192
|
+
]
|
|
193
|
+
}
|
|
194
|
+
),
|
|
195
|
+
shown.length === 0 ? /* @__PURE__ */ jsx(
|
|
196
|
+
EmptyNote,
|
|
197
|
+
{
|
|
198
|
+
icon: "magnifying-glass",
|
|
199
|
+
title: filters.query ? `Nothing matches \u201C${filters.query}\u201D` : "Nothing in this view",
|
|
200
|
+
"data-test": "catalog-empty",
|
|
201
|
+
children: "Search matches names, descriptions and what each operation does. Clear the search or pick All to see everything."
|
|
202
|
+
}
|
|
203
|
+
) : /* @__PURE__ */ jsx(
|
|
204
|
+
Card,
|
|
205
|
+
{
|
|
206
|
+
layout: "bleed",
|
|
207
|
+
render: /* @__PURE__ */ jsx("ul", {}),
|
|
208
|
+
className: "gap-0 divide-y overflow-hidden py-0",
|
|
209
|
+
"data-test": "catalog-list",
|
|
210
|
+
children: shown.map((product) => /* @__PURE__ */ jsx("li", { "data-test": `catalog-row-${product.slug}`, children: /* @__PURE__ */ jsxs(
|
|
211
|
+
Link,
|
|
212
|
+
{
|
|
213
|
+
href: catalogHref(product.slug),
|
|
214
|
+
className: cn(
|
|
215
|
+
"hover:bg-muted flex flex-col gap-1.5 px-4 py-3 sm:flex-row sm:items-start sm:gap-4",
|
|
216
|
+
FOCUS_RING
|
|
217
|
+
),
|
|
218
|
+
children: [
|
|
219
|
+
/* @__PURE__ */ jsxs("span", { className: "flex min-w-0 flex-1 flex-col gap-1", children: [
|
|
220
|
+
/* @__PURE__ */ jsxs("span", { className: "flex flex-wrap items-center gap-2", children: [
|
|
221
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium", children: product.name }),
|
|
222
|
+
/* @__PURE__ */ jsx(Badge, { variant: "outline", children: product.kind }),
|
|
223
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-xs", children: ownerLabel(product) })
|
|
224
|
+
] }),
|
|
225
|
+
product.summary ? /* @__PURE__ */ jsx("span", { className: "text-muted-foreground line-clamp-2 text-sm", children: product.summary }) : null,
|
|
226
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-xs", children: productReach(product) })
|
|
227
|
+
] }),
|
|
228
|
+
snapshot.scope === "source" ? /* @__PURE__ */ jsx(
|
|
229
|
+
StatusBadge,
|
|
230
|
+
{
|
|
231
|
+
tone: AVAILABILITY_WORDS[product.availability].tone,
|
|
232
|
+
className: "shrink-0 self-start",
|
|
233
|
+
children: AVAILABILITY_WORDS[product.availability].label
|
|
234
|
+
}
|
|
235
|
+
) : null
|
|
236
|
+
]
|
|
237
|
+
}
|
|
238
|
+
) }, product.slug))
|
|
239
|
+
}
|
|
240
|
+
)
|
|
241
|
+
] });
|
|
242
|
+
}
|
|
243
|
+
function Section({
|
|
244
|
+
title,
|
|
245
|
+
children,
|
|
246
|
+
testId
|
|
247
|
+
}) {
|
|
248
|
+
return /* @__PURE__ */ jsxs("section", { className: "flex flex-col gap-2", "data-test": testId, children: [
|
|
249
|
+
/* @__PURE__ */ jsx("h3", { className: "font-heading text-lg font-normal", children: title }),
|
|
250
|
+
children
|
|
251
|
+
] });
|
|
252
|
+
}
|
|
253
|
+
function CatalogProductPage() {
|
|
254
|
+
const { slug } = useParams();
|
|
255
|
+
const catalog = useCatalogSnapshot();
|
|
256
|
+
const name = decodeURIComponent(slug);
|
|
257
|
+
if (catalog.isPending) return /* @__PURE__ */ jsx(PageSkeleton, { label: "Loading the catalog" });
|
|
258
|
+
const snapshot = catalog.data?.snapshot ?? null;
|
|
259
|
+
const product = snapshot?.products.find((entry) => entry.slug === name);
|
|
260
|
+
if (!product) {
|
|
261
|
+
return /* @__PURE__ */ jsx(
|
|
262
|
+
NotFoundState,
|
|
263
|
+
{
|
|
264
|
+
testId: "catalog-product-not-found",
|
|
265
|
+
title: `Nothing called \u201C${name}\u201D in the catalog`,
|
|
266
|
+
description: "The catalog has no integration or experience with that name. It may be private to another Source, or not published yet.",
|
|
267
|
+
action: { label: "Back to the catalog", href: "/catalog" }
|
|
268
|
+
}
|
|
269
|
+
);
|
|
270
|
+
}
|
|
271
|
+
const isExperience = product.kind === "experience";
|
|
272
|
+
const command = `ekanos add ${catalogPackageName(product.slug)}`;
|
|
273
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-6", "data-test": "catalog-product", children: [
|
|
274
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
|
|
275
|
+
/* @__PURE__ */ jsxs(
|
|
276
|
+
Link,
|
|
277
|
+
{
|
|
278
|
+
href: "/catalog",
|
|
279
|
+
className: cn(
|
|
280
|
+
"text-muted-foreground hover:text-foreground flex w-fit items-center gap-1 rounded-sm text-sm",
|
|
281
|
+
FOCUS_RING
|
|
282
|
+
),
|
|
283
|
+
"data-test": "catalog-back",
|
|
284
|
+
children: [
|
|
285
|
+
/* @__PURE__ */ jsx(Icon, { name: "arrow-left", className: "size-3.5", "aria-hidden": true }),
|
|
286
|
+
"Catalog"
|
|
287
|
+
]
|
|
288
|
+
}
|
|
289
|
+
),
|
|
290
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
291
|
+
/* @__PURE__ */ jsx("h2", { className: "font-heading text-2xl font-normal", children: product.name }),
|
|
292
|
+
/* @__PURE__ */ jsx(Badge, { variant: "outline", children: product.kind }),
|
|
293
|
+
/* @__PURE__ */ jsxs("span", { className: "text-muted-foreground text-sm", children: [
|
|
294
|
+
ownerLabel(product),
|
|
295
|
+
product.version ? ` \xB7 v${product.version}` : ""
|
|
296
|
+
] }),
|
|
297
|
+
snapshot?.scope === "source" ? /* @__PURE__ */ jsx(StatusBadge, { tone: AVAILABILITY_WORDS[product.availability].tone, children: AVAILABILITY_WORDS[product.availability].label }) : null
|
|
298
|
+
] }),
|
|
299
|
+
product.summary ? /* @__PURE__ */ jsx("p", { className: "text-base", children: product.summary }) : null,
|
|
300
|
+
product.description ? /* @__PURE__ */ jsx("p", { className: "text-muted-foreground max-w-3xl text-sm whitespace-pre-line", children: product.description }) : null,
|
|
301
|
+
/* @__PURE__ */ jsxs("p", { className: "text-muted-foreground text-xs", children: [
|
|
302
|
+
/* @__PURE__ */ jsx("code", { children: catalogPackageName(product.slug) }),
|
|
303
|
+
product.href ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
304
|
+
" \xB7 ",
|
|
305
|
+
/* @__PURE__ */ jsx(
|
|
306
|
+
"a",
|
|
307
|
+
{
|
|
308
|
+
href: product.href,
|
|
309
|
+
target: "_blank",
|
|
310
|
+
rel: "noreferrer",
|
|
311
|
+
className: "underline",
|
|
312
|
+
"data-test": "catalog-product-link",
|
|
313
|
+
children: "Open in Ekanos"
|
|
314
|
+
}
|
|
315
|
+
)
|
|
316
|
+
] }) : null
|
|
317
|
+
] })
|
|
318
|
+
] }),
|
|
319
|
+
isExperience ? /* @__PURE__ */ jsx(Section, { title: "What it includes", testId: "catalog-includes", children: product.experience ? /* @__PURE__ */ jsxs(Card, { layout: "bleed", className: "flex flex-col gap-3 p-4 text-sm", children: [
|
|
320
|
+
/* @__PURE__ */ jsx("p", { children: productReach(product) }),
|
|
321
|
+
product.experience.integrations.length > 0 ? /* @__PURE__ */ jsx("ul", { className: "flex flex-wrap gap-2", children: product.experience.integrations.map((entry) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(
|
|
322
|
+
Link,
|
|
323
|
+
{
|
|
324
|
+
href: catalogHref(entry.name.replace("/", "__")),
|
|
325
|
+
className: cn(
|
|
326
|
+
"bg-muted rounded-md px-2 py-1 font-mono text-xs hover:underline",
|
|
327
|
+
FOCUS_RING
|
|
328
|
+
),
|
|
329
|
+
children: [
|
|
330
|
+
entry.name,
|
|
331
|
+
"@",
|
|
332
|
+
entry.version
|
|
333
|
+
]
|
|
334
|
+
}
|
|
335
|
+
) }, entry.name)) }) : null
|
|
336
|
+
] }) : /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm", children: "Ekanos did not say what this experience includes." }) }) : /* @__PURE__ */ jsx(Section, { title: "Build on it", testId: "catalog-use", children: /* @__PURE__ */ jsxs(Card, { layout: "bleed", className: "flex flex-col gap-2 p-4 text-sm", children: [
|
|
337
|
+
/* @__PURE__ */ jsx("p", { className: "text-muted-foreground", children: "In an experience package, add it and pin the operations you call:" }),
|
|
338
|
+
/* @__PURE__ */ jsxs("div", { className: "bg-muted flex items-center justify-between gap-2 rounded-md px-3 py-2", children: [
|
|
339
|
+
/* @__PURE__ */ jsx("code", { className: "font-mono text-sm", children: command }),
|
|
340
|
+
/* @__PURE__ */ jsx(RunLogCopyButton, { value: command, label: "the add command" })
|
|
341
|
+
] })
|
|
342
|
+
] }) }),
|
|
343
|
+
product.tools.length > 0 ? /* @__PURE__ */ jsx(
|
|
344
|
+
Section,
|
|
345
|
+
{
|
|
346
|
+
title: `Operations (${product.tools.length})`,
|
|
347
|
+
testId: "catalog-operations",
|
|
348
|
+
children: /* @__PURE__ */ jsx(
|
|
349
|
+
Card,
|
|
350
|
+
{
|
|
351
|
+
layout: "bleed",
|
|
352
|
+
render: /* @__PURE__ */ jsx("ul", {}),
|
|
353
|
+
className: "gap-0 divide-y overflow-hidden py-0",
|
|
354
|
+
children: product.tools.map((tool) => /* @__PURE__ */ jsxs(
|
|
355
|
+
"li",
|
|
356
|
+
{
|
|
357
|
+
className: "flex flex-col gap-1 px-4 py-3 sm:flex-row sm:items-start sm:gap-4",
|
|
358
|
+
children: [
|
|
359
|
+
/* @__PURE__ */ jsxs("span", { className: "flex min-w-0 flex-1 flex-col gap-0.5", children: [
|
|
360
|
+
/* @__PURE__ */ jsx("code", { className: "font-mono text-sm", children: tool.name }),
|
|
361
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-sm", children: tool.description })
|
|
362
|
+
] }),
|
|
363
|
+
/* @__PURE__ */ jsxs("span", { className: "flex shrink-0 gap-2", children: [
|
|
364
|
+
/* @__PURE__ */ jsx(
|
|
365
|
+
StatusBadge,
|
|
366
|
+
{
|
|
367
|
+
tone: tool.effect === "read" ? "info" : "warning",
|
|
368
|
+
children: tool.effect === "read" ? "Read" : "Write"
|
|
369
|
+
}
|
|
370
|
+
),
|
|
371
|
+
tool.sensitivity !== "public" && tool.sensitivity !== "undeclared" ? /* @__PURE__ */ jsx(Badge, { variant: "outline", children: tool.sensitivity }) : null
|
|
372
|
+
] })
|
|
373
|
+
]
|
|
374
|
+
},
|
|
375
|
+
tool.name
|
|
376
|
+
))
|
|
377
|
+
}
|
|
378
|
+
)
|
|
379
|
+
}
|
|
380
|
+
) : null,
|
|
381
|
+
product.agentEvents.length > 0 ? /* @__PURE__ */ jsx(
|
|
382
|
+
Section,
|
|
383
|
+
{
|
|
384
|
+
title: `Events it raises (${product.agentEvents.length})`,
|
|
385
|
+
testId: "catalog-events",
|
|
386
|
+
children: /* @__PURE__ */ jsx(
|
|
387
|
+
Card,
|
|
388
|
+
{
|
|
389
|
+
layout: "bleed",
|
|
390
|
+
render: /* @__PURE__ */ jsx("ul", {}),
|
|
391
|
+
className: "gap-0 divide-y overflow-hidden py-0",
|
|
392
|
+
children: product.agentEvents.map((event) => /* @__PURE__ */ jsxs("li", { className: "flex flex-col gap-0.5 px-4 py-3", children: [
|
|
393
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: event.label }),
|
|
394
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-sm", children: event.description })
|
|
395
|
+
] }, event.id))
|
|
396
|
+
}
|
|
397
|
+
)
|
|
398
|
+
}
|
|
399
|
+
) : null,
|
|
400
|
+
product.setupSteps.length > 0 ? /* @__PURE__ */ jsx(Section, { title: "Setting it up", testId: "catalog-setup", children: /* @__PURE__ */ jsx(
|
|
401
|
+
Card,
|
|
402
|
+
{
|
|
403
|
+
layout: "bleed",
|
|
404
|
+
render: /* @__PURE__ */ jsx("ol", {}),
|
|
405
|
+
className: "gap-0 divide-y overflow-hidden py-0",
|
|
406
|
+
children: product.setupSteps.map((step, index) => /* @__PURE__ */ jsxs("li", { className: "flex gap-3 px-4 py-3 text-sm", children: [
|
|
407
|
+
/* @__PURE__ */ jsxs("span", { className: "text-muted-foreground tabular-nums", children: [
|
|
408
|
+
index + 1,
|
|
409
|
+
"."
|
|
410
|
+
] }),
|
|
411
|
+
/* @__PURE__ */ jsxs("span", { className: "flex flex-col gap-0.5", children: [
|
|
412
|
+
/* @__PURE__ */ jsx("span", { className: "font-medium", children: step.title }),
|
|
413
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: step.detail })
|
|
414
|
+
] })
|
|
415
|
+
] }, step.key))
|
|
416
|
+
}
|
|
417
|
+
) }) : null
|
|
418
|
+
] });
|
|
419
|
+
}
|
|
420
|
+
export {
|
|
421
|
+
CatalogLayout,
|
|
422
|
+
CatalogPage,
|
|
423
|
+
CatalogProductPage,
|
|
424
|
+
productReach
|
|
425
|
+
};
|
|
@@ -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";
|
|
@@ -143,6 +144,14 @@ 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
|
+
naming: project.data.naming
|
|
153
|
+
}
|
|
154
|
+
),
|
|
146
155
|
/* @__PURE__ */ jsxs("section", { className: "flex flex-col gap-3", children: [
|
|
147
156
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
148
157
|
/* @__PURE__ */ jsx("h2", { className: "font-heading text-xl font-normal", children: "Is it ready?" }),
|
|
@@ -16,8 +16,9 @@ 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
|
-
import { useConnection, useRuns } from "../lib/console-hooks.js";
|
|
21
|
+
import { useConnection, useProject, useRuns } from "../lib/console-hooks.js";
|
|
21
22
|
import {
|
|
22
23
|
hasHealthCheck,
|
|
23
24
|
healthKey,
|
|
@@ -168,6 +169,7 @@ function Overview({
|
|
|
168
169
|
const slug = integration.integration;
|
|
169
170
|
const connection = useConnection(slug);
|
|
170
171
|
const runs = useRuns();
|
|
172
|
+
const project = useProject();
|
|
171
173
|
const health = useQuery({
|
|
172
174
|
queryKey: healthKey(slug),
|
|
173
175
|
queryFn: () => null,
|
|
@@ -198,6 +200,14 @@ function Overview({
|
|
|
198
200
|
slug
|
|
199
201
|
});
|
|
200
202
|
return /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-col gap-6", "data-test": "overview", children: [
|
|
203
|
+
base ? /* @__PURE__ */ jsx(
|
|
204
|
+
LatestPublishLine,
|
|
205
|
+
{
|
|
206
|
+
name: slug,
|
|
207
|
+
href: `${base}/publishes`,
|
|
208
|
+
...integration.own ? { naming: project.data?.naming } : {}
|
|
209
|
+
}
|
|
210
|
+
) : null,
|
|
201
211
|
next ? /* @__PURE__ */ jsx(NextAction, { next, base }) : connection.isError ? /* @__PURE__ */ jsxs("p", { className: "text-destructive text-sm", role: "alert", children: [
|
|
202
212
|
"Could not read the connection: ",
|
|
203
213
|
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 { NameScopeBadge, PublishChip } from "../components/publish-status.js";
|
|
14
15
|
import {
|
|
15
16
|
CONNECTION_TYPE,
|
|
16
17
|
ConnectionStatusChip,
|
|
@@ -244,6 +245,8 @@ function IntegrationRow({
|
|
|
244
245
|
"v",
|
|
245
246
|
row.version
|
|
246
247
|
] }),
|
|
248
|
+
/* @__PURE__ */ jsx(PublishChip, { name: row.name }),
|
|
249
|
+
/* @__PURE__ */ jsx(NameScopeBadge, { name: row.name, naming: row.naming }),
|
|
247
250
|
row.contractVersion ? /* @__PURE__ */ jsxs(
|
|
248
251
|
"span",
|
|
249
252
|
{
|
|
@@ -373,7 +376,9 @@ function ExperienceRow({ row }) {
|
|
|
373
376
|
/* @__PURE__ */ jsxs("span", { className: "text-muted-foreground font-mono text-xs", children: [
|
|
374
377
|
"v",
|
|
375
378
|
row.version
|
|
376
|
-
] })
|
|
379
|
+
] }),
|
|
380
|
+
/* @__PURE__ */ jsx(PublishChip, { name: row.name }),
|
|
381
|
+
/* @__PURE__ */ jsx(NameScopeBadge, { name: row.name, naming: row.naming })
|
|
377
382
|
] }),
|
|
378
383
|
row.error ? /* @__PURE__ */ jsx("p", { className: "text-destructive text-xs", children: row.error }) : null,
|
|
379
384
|
row.integrations.length > 0 ? /* @__PURE__ */ jsxs(
|
|
@@ -491,7 +496,7 @@ function RepoHomePage() {
|
|
|
491
496
|
/* @__PURE__ */ jsxs("section", { className: "flex flex-col gap-3", "data-test": "repo-experiences", children: [
|
|
492
497
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
|
|
493
498
|
/* @__PURE__ */ jsx("h2", { className: "font-heading text-xl font-normal", children: "Experiences" }),
|
|
494
|
-
/* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm", children: "Each previews its widgets,
|
|
499
|
+
/* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-sm", children: "Each previews its widgets, pages and workflows against the integrations it uses." })
|
|
495
500
|
] }),
|
|
496
501
|
experiences.length === 0 ? /* @__PURE__ */ jsxs(
|
|
497
502
|
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,
|
|
@@ -41,6 +42,7 @@ import {
|
|
|
41
42
|
createFileFixtureSource,
|
|
42
43
|
runOperation
|
|
43
44
|
} from "./operation-runner.js";
|
|
45
|
+
import { readProjectNaming } from "./package-naming.js";
|
|
44
46
|
import { resolveProjectRoot } from "./project-root.js";
|
|
45
47
|
import { createRunLog } from "./run-log.js";
|
|
46
48
|
import { readSessionCatalog } from "./session-catalog.js";
|
|
@@ -338,13 +340,19 @@ function createEkanosApiRouter(partial = {}) {
|
|
|
338
340
|
return apiError(500, "no_project_root", `${root.message} ${root.hint}`);
|
|
339
341
|
const method = request.method.toUpperCase();
|
|
340
342
|
const [head, ...rest] = segments;
|
|
343
|
+
if (head === "host") {
|
|
344
|
+
const hosted = handleHostRoute(root.root, method, rest);
|
|
345
|
+
if (hosted) return hosted;
|
|
346
|
+
}
|
|
341
347
|
try {
|
|
342
348
|
if ((head === "integrations" || head === "slots") && rest.length === 0) {
|
|
343
349
|
if (method !== "GET")
|
|
344
350
|
return apiError(405, "method_not_allowed", "GET only.");
|
|
345
351
|
const state = await getResolution();
|
|
352
|
+
const naming = readProjectNaming(projectRoot());
|
|
346
353
|
const body = {
|
|
347
354
|
kind: state.kind,
|
|
355
|
+
...naming ? { naming } : {},
|
|
348
356
|
integrations: await Promise.all(
|
|
349
357
|
state.integrations.map(
|
|
350
358
|
async (integration) => toIntegrationView(integration, await runtimeOf(integration))
|
|
@@ -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
|
+
};
|