@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
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
3
|
+
import { CONSOLE_API_BASE } from "./console-client.js";
|
|
4
|
+
const HOST_API = `${CONSOLE_API_BASE}/host`;
|
|
5
|
+
const POLL_MS = 5e3;
|
|
6
|
+
async function getJson(url) {
|
|
7
|
+
const response = await fetch(url, {
|
|
8
|
+
headers: { accept: "application/json" }
|
|
9
|
+
});
|
|
10
|
+
if (!response.ok) {
|
|
11
|
+
throw new Error(`${url} answered ${response.status}`);
|
|
12
|
+
}
|
|
13
|
+
return await response.json();
|
|
14
|
+
}
|
|
15
|
+
const HOST_KEYS = {
|
|
16
|
+
catalog: ["host", "catalog"],
|
|
17
|
+
publish: ["host", "publish-status"]
|
|
18
|
+
};
|
|
19
|
+
function useCatalogSnapshot() {
|
|
20
|
+
return useQuery({
|
|
21
|
+
queryKey: HOST_KEYS.catalog,
|
|
22
|
+
queryFn: () => getJson(`${HOST_API}/catalog`),
|
|
23
|
+
refetchInterval: POLL_MS
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function usePublishSnapshot() {
|
|
27
|
+
return useQuery({
|
|
28
|
+
queryKey: HOST_KEYS.publish,
|
|
29
|
+
queryFn: () => getJson(
|
|
30
|
+
`${HOST_API}/publish-status`
|
|
31
|
+
),
|
|
32
|
+
refetchInterval: POLL_MS
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
function useRefreshHostData() {
|
|
36
|
+
const queryClient = useQueryClient();
|
|
37
|
+
return useMutation({
|
|
38
|
+
mutationFn: async () => {
|
|
39
|
+
const response = await fetch(`${HOST_API}/refresh`, { method: "POST" });
|
|
40
|
+
if (!response.ok) {
|
|
41
|
+
throw new Error(`Refresh answered ${response.status}`);
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
onSuccess: () => {
|
|
45
|
+
for (const delay of [1500, 4e3]) {
|
|
46
|
+
setTimeout(() => {
|
|
47
|
+
void queryClient.invalidateQueries({ queryKey: ["host"] });
|
|
48
|
+
}, delay);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
const STATE_WORDS = {
|
|
54
|
+
submitted: {
|
|
55
|
+
label: "Waiting for checks",
|
|
56
|
+
tone: "info",
|
|
57
|
+
detail: "Submitted. The checks have not run on it yet."
|
|
58
|
+
},
|
|
59
|
+
gated: {
|
|
60
|
+
label: "Passed checks",
|
|
61
|
+
tone: "info",
|
|
62
|
+
detail: "Passed the checks and is being admitted to dev."
|
|
63
|
+
},
|
|
64
|
+
dev: {
|
|
65
|
+
label: "Live on dev",
|
|
66
|
+
tone: "clear",
|
|
67
|
+
detail: "Live on dev, where Sources can turn it on."
|
|
68
|
+
},
|
|
69
|
+
prod: {
|
|
70
|
+
label: "Live in production",
|
|
71
|
+
tone: "clear",
|
|
72
|
+
detail: "Live in production."
|
|
73
|
+
},
|
|
74
|
+
rejected: {
|
|
75
|
+
label: "Failed checks",
|
|
76
|
+
tone: "destructive",
|
|
77
|
+
detail: "Failed the checks. Fix the errors below and publish a new version."
|
|
78
|
+
},
|
|
79
|
+
revoked: {
|
|
80
|
+
label: "Revoked",
|
|
81
|
+
tone: "destructive",
|
|
82
|
+
detail: "Withdrawn after it went live. The findings say why."
|
|
83
|
+
},
|
|
84
|
+
superseded: {
|
|
85
|
+
label: "Replaced",
|
|
86
|
+
tone: "neutral",
|
|
87
|
+
detail: "A newer version replaced it on dev."
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
function describePublishState(state) {
|
|
91
|
+
return STATE_WORDS[state] ?? {
|
|
92
|
+
label: state,
|
|
93
|
+
tone: "neutral",
|
|
94
|
+
detail: `The host reports "${state}".`
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
function sortVersions(versions) {
|
|
98
|
+
return [...versions].sort((a, b) => {
|
|
99
|
+
const at = a.submittedAt ?? "";
|
|
100
|
+
const bt = b.submittedAt ?? "";
|
|
101
|
+
if (at !== bt) return bt.localeCompare(at);
|
|
102
|
+
return b.version.localeCompare(a.version, void 0, { numeric: true });
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
function findPublishedPackage(snapshot, name) {
|
|
106
|
+
if (!snapshot) return null;
|
|
107
|
+
const slug = name.includes("/") ? name.slice(name.lastIndexOf("/") + 1) : name;
|
|
108
|
+
return snapshot.packages.find(
|
|
109
|
+
(pkg) => pkg.slug === slug || pkg.displayName === name || (pkg.namespace ? `${pkg.namespace}/${pkg.slug}` === name : false)
|
|
110
|
+
) ?? null;
|
|
111
|
+
}
|
|
112
|
+
function haystack(product) {
|
|
113
|
+
return [
|
|
114
|
+
product.slug,
|
|
115
|
+
product.name,
|
|
116
|
+
product.summary ?? "",
|
|
117
|
+
product.description ?? "",
|
|
118
|
+
...product.tools.flatMap((tool) => [tool.name, tool.description]),
|
|
119
|
+
...product.agentEvents.flatMap((event) => [event.label, event.description]),
|
|
120
|
+
...product.experience?.integrations.map((entry) => entry.name) ?? []
|
|
121
|
+
].join(" ").toLowerCase();
|
|
122
|
+
}
|
|
123
|
+
function filterCatalog(products, filters) {
|
|
124
|
+
const words = filters.query.toLowerCase().split(/\s+/).filter(Boolean);
|
|
125
|
+
const matches = products.filter((product) => {
|
|
126
|
+
if (product.kind === "feature") return false;
|
|
127
|
+
if (filters.kind !== "all" && product.kind !== filters.kind) return false;
|
|
128
|
+
if (filters.availability === "mine" && !product.owned) return false;
|
|
129
|
+
if ((filters.availability === "enabled" || filters.availability === "available") && product.availability !== filters.availability) {
|
|
130
|
+
return false;
|
|
131
|
+
}
|
|
132
|
+
if (words.length === 0) return true;
|
|
133
|
+
const text = haystack(product);
|
|
134
|
+
return words.every((word) => text.includes(word));
|
|
135
|
+
});
|
|
136
|
+
if (words.length === 0) return matches;
|
|
137
|
+
const nameHit = (product) => words.some(
|
|
138
|
+
(word) => `${product.name} ${product.slug}`.toLowerCase().includes(word)
|
|
139
|
+
) ? 0 : 1;
|
|
140
|
+
return [...matches].sort((a, b) => nameHit(a) - nameHit(b));
|
|
141
|
+
}
|
|
142
|
+
function catalogPackageName(slug) {
|
|
143
|
+
return slug.replace("__", "/");
|
|
144
|
+
}
|
|
145
|
+
function catalogHref(slug) {
|
|
146
|
+
return `/catalog/${encodeURIComponent(slug)}`;
|
|
147
|
+
}
|
|
148
|
+
export {
|
|
149
|
+
HOST_KEYS,
|
|
150
|
+
catalogHref,
|
|
151
|
+
catalogPackageName,
|
|
152
|
+
describePublishState,
|
|
153
|
+
filterCatalog,
|
|
154
|
+
findPublishedPackage,
|
|
155
|
+
sortVersions,
|
|
156
|
+
useCatalogSnapshot,
|
|
157
|
+
usePublishSnapshot,
|
|
158
|
+
useRefreshHostData
|
|
159
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { CatalogProduct } from '@ekanos/integration-schema';
|
|
3
|
+
/**
|
|
4
|
+
* The Catalog: the integrations and experiences a developer can build on,
|
|
5
|
+
* read from the host by `ekanos dev`. With a Source it is everything that
|
|
6
|
+
* Source can use, including what it has not turned on yet; without one it is
|
|
7
|
+
* everything global on the host.
|
|
8
|
+
*/
|
|
9
|
+
export declare function CatalogLayout({ children }: {
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
}): import("react").JSX.Element;
|
|
12
|
+
/** One line on what a product offers to build on. */
|
|
13
|
+
export declare function productReach(product: CatalogProduct): string;
|
|
14
|
+
export declare function CatalogPage(): import("react").JSX.Element;
|
|
15
|
+
export declare function CatalogProductPage(): import("react").JSX.Element;
|
|
@@ -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
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
2
|
+
* The retired Layout tab. Arranging an experience's pages and widgets into
|
|
3
|
+
* workspaces is the job of whoever manages the Source, so the harness no longer
|
|
4
|
+
* previews it; an old link to `/layout` lands on the experience's pages.
|
|
5
|
+
*
|
|
6
|
+
* @deprecated Mount `ExperiencePagesPage` at `/experience/pages`.
|
|
7
7
|
*/
|
|
8
|
-
export declare function ExperienceLayoutPage():
|
|
8
|
+
export declare function ExperienceLayoutPage(): never;
|