@ekanos/harness 0.30.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.
@@ -172,8 +172,27 @@ export interface ActiveOverride {
172
172
  via: 'file' | 'env';
173
173
  mode: RunMode;
174
174
  }
175
+ /**
176
+ * How a local package is named when it publishes, as its files declare it:
177
+ * `global`, a bare name (`availability.mode: "global"` in its `ekanos.json`,
178
+ * which needs an approved global name), or `restricted`, the default, named
179
+ * under the publishing Source's namespace (`acme/google-drive`). The host's
180
+ * answer once it is published (`PublishedPackage.namespace`) is authoritative.
181
+ * Naming only: who may see a package is set separately.
182
+ */
183
+ export interface PackageNaming {
184
+ availability: 'global' | 'restricted';
185
+ /**
186
+ * The namespace it publishes under, as far as the files say: the repo's
187
+ * root `ekanos.json` `namespace`, else the Source every integration names.
188
+ * Null when nothing says.
189
+ */
190
+ namespace: string | null;
191
+ }
175
192
  export interface IntegrationsResponse {
176
193
  kind: HarnessKind;
194
+ /** How the project's own package is named when it publishes. */
195
+ naming?: PackageNaming;
177
196
  integrations: IntegrationView[];
178
197
  overrides: ActiveOverride[];
179
198
  /** True while any override is active: `ekanos publish` refuses. */
@@ -543,6 +562,7 @@ export interface RepoIntegrationRow {
543
562
  consoleHref: string;
544
563
  /** Experience packages of this repo that use it. */
545
564
  usedBy: string[];
565
+ naming: PackageNaming;
546
566
  }
547
567
  export interface RepoExperienceIntegration {
548
568
  name: string;
@@ -568,6 +588,7 @@ export interface RepoExperienceRow {
568
588
  connectHref: string;
569
589
  integrations: RepoExperienceIntegration[];
570
590
  error?: string;
591
+ naming: PackageNaming;
571
592
  }
572
593
  export interface RepoResponse {
573
594
  root: string;
@@ -1,4 +1,5 @@
1
1
  import type { PublishFinding } from '@ekanos/integration-schema';
2
+ import type { PackageNaming } from '../lib/console-types.js';
2
3
  /**
3
4
  * The latest published version of a local package, as a chip: "Live on dev ·
4
5
  * 0.3.1". Nothing at all when the host could not be read, so a missing login
@@ -7,10 +8,21 @@ import type { PublishFinding } from '@ekanos/integration-schema';
7
8
  export declare function PublishChip({ name }: {
8
9
  name: string;
9
10
  }): import("react").JSX.Element | null;
11
+ /**
12
+ * Whether a local package is global or named under a namespace: the host's
13
+ * answer once it is published, else what its `ekanos.json` declares. Nothing
14
+ * when neither says.
15
+ */
16
+ export declare function NameScopeBadge({ name, naming, }: {
17
+ name: string;
18
+ naming?: PackageNaming | null | undefined;
19
+ }): import("react").JSX.Element | null;
10
20
  /** One line on the latest publish, for an Overview, linking to its Publishes tab. */
11
- export declare function LatestPublishLine({ name, href, }: {
21
+ export declare function LatestPublishLine({ name, href, naming, }: {
12
22
  name: string;
13
23
  href: string;
24
+ /** The package's declared naming, shown as a global/namespaced badge. */
25
+ naming?: PackageNaming | null | undefined;
14
26
  }): import("react").JSX.Element | null;
15
27
  /**
16
28
  * The checks can report the same finding more than once (one per stage that
@@ -13,6 +13,7 @@ import {
13
13
  sortVersions,
14
14
  usePublishSnapshot
15
15
  } from "../lib/host-data.js";
16
+ import { describeNameScope } from "../lib/name-scope.js";
16
17
  import { HostFreshness, fullTime, timeAgo } from "./host-freshness.js";
17
18
  import { PageSkeleton } from "./page-skeletons.js";
18
19
  import { FOCUS_RING } from "./scrollable-nav.js";
@@ -53,13 +54,47 @@ function PublishChip({ name }) {
53
54
  }
54
55
  );
55
56
  }
57
+ function NameScopeBadge({
58
+ name,
59
+ naming
60
+ }) {
61
+ const publish = usePublishSnapshot();
62
+ const snapshot = publish.data?.snapshot;
63
+ const published = snapshot && !snapshot.unavailable ? findPublishedPackage(snapshot, name) : null;
64
+ const scope = describeNameScope({ name, published, declared: naming });
65
+ if (!scope) return null;
66
+ return /* @__PURE__ */ jsxs(
67
+ "span",
68
+ {
69
+ "data-test": "name-scope",
70
+ "data-scope": scope.scope,
71
+ "data-confirmed": scope.confirmed,
72
+ title: scope.detail,
73
+ className: "text-foreground inline-flex h-6 w-fit shrink-0 items-center gap-1 rounded-full border px-2 text-xs font-semibold tracking-wide whitespace-nowrap",
74
+ children: [
75
+ /* @__PURE__ */ jsx(
76
+ Icon,
77
+ {
78
+ name: scope.scope === "global" ? "globe" : "folder-simple",
79
+ className: "size-3",
80
+ "aria-hidden": true
81
+ }
82
+ ),
83
+ scope.label
84
+ ]
85
+ }
86
+ );
87
+ }
56
88
  function LatestPublishLine({
57
89
  name,
58
- href
90
+ href,
91
+ naming
59
92
  }) {
60
93
  const publish = usePublishSnapshot();
61
94
  const snapshot = publish.data?.snapshot;
62
- if (!snapshot || snapshot.unavailable) return null;
95
+ if (!snapshot || snapshot.unavailable) {
96
+ return naming ? /* @__PURE__ */ jsx("p", { className: "flex flex-wrap items-center gap-2", "data-test": "naming-line", children: /* @__PURE__ */ jsx(NameScopeBadge, { name, naming }) }) : null;
97
+ }
63
98
  const pkg = findPublishedPackage(snapshot, name);
64
99
  const latest = pkg ? sortVersions(pkg.versions)[0] : void 0;
65
100
  return /* @__PURE__ */ jsxs(
@@ -77,6 +112,7 @@ function LatestPublishLine({
77
112
  /* @__PURE__ */ jsx(StatusBadge, { tone: describePublishState(latest.state).tone, children: describePublishState(latest.state).label }),
78
113
  /* @__PURE__ */ jsx("span", { title: fullTime(latest.submittedAt), children: timeAgo(latest.submittedAt) })
79
114
  ] }) : /* @__PURE__ */ jsx("span", { children: "Not published yet." }),
115
+ /* @__PURE__ */ jsx(NameScopeBadge, { name, naming }),
80
116
  /* @__PURE__ */ jsx(
81
117
  Link,
82
118
  {
@@ -320,6 +356,7 @@ function PublishesView({ name }) {
320
356
  }
321
357
  export {
322
358
  LatestPublishLine,
359
+ NameScopeBadge,
323
360
  PublishChip,
324
361
  PublishesView,
325
362
  uniqueFindings
@@ -140,7 +140,8 @@ function createHttpConsoleClient(fetcher = (input, init) => globalThis.fetch(inp
140
140
  integrations: wire.integrations.map(integrationView),
141
141
  notices: wire.notices,
142
142
  errors: wire.errors,
143
- ...experience?.checks ? { checks: experience.checks } : {}
143
+ ...experience?.checks ? { checks: experience.checks } : {},
144
+ ...wire.naming ? { naming: wire.naming } : {}
144
145
  };
145
146
  },
146
147
  getContract: async (integration) => contractView(
@@ -6,8 +6,8 @@
6
6
  * so the UI builds and is tested against fakes; once `src/api.ts` publishes
7
7
  * the real types, this file is the one place to re-point.
8
8
  */
9
- import type { ActivationCredentialStatus, HarnessConnectAs, HarnessRunAs, IntegrationConnectionFacts, IntegrationRuntime, OAuthConnectionStatus } from '../../api-types.js';
10
- export type { ActivationCredentialStatus, HarnessConnectAs, HarnessRunAs, OAuthConnectionStatus, };
9
+ import type { ActivationCredentialStatus, HarnessConnectAs, HarnessRunAs, IntegrationConnectionFacts, IntegrationRuntime, OAuthConnectionStatus, PackageNaming } from '../../api-types.js';
10
+ export type { ActivationCredentialStatus, PackageNaming, HarnessConnectAs, HarnessRunAs, OAuthConnectionStatus, };
11
11
  export type JsonSchema = {
12
12
  [key: string]: unknown;
13
13
  };
@@ -123,6 +123,8 @@ export interface ConsoleProject {
123
123
  };
124
124
  /** The repo's integration also registers widgets/tile/activation surfaces. */
125
125
  legacySurfaces?: boolean;
126
+ /** How the project's own package is named when it publishes. */
127
+ naming?: PackageNaming;
126
128
  }
127
129
  export interface RunRecord {
128
130
  id: string;
@@ -0,0 +1,28 @@
1
+ import type { PublishedPackage } from '@ekanos/integration-schema';
2
+ import type { PackageNaming } from './console-types.js';
3
+ /**
4
+ * Whether a local package is a global package (`news`) or named under a
5
+ * namespace (`acme/news`), in words. The host's answer for a published package
6
+ * wins over what the files declare, because the host may keep an older name
7
+ * (a package admitted under its bare slug stays global). An older host that
8
+ * sends no `namespace` leaves the declaration in charge.
9
+ */
10
+ export interface NameScope {
11
+ scope: 'global' | 'namespaced';
12
+ /** Null when namespaced under a namespace nothing local names. */
13
+ namespace: string | null;
14
+ /** What an experience writes to name it: `acme/news`, or `news`. */
15
+ displayName: string;
16
+ /** Short chip text. */
17
+ label: string;
18
+ /** One or two sentences: what decided it, and what it means. */
19
+ detail: string;
20
+ /** The host said so (published), rather than the files declaring it. */
21
+ confirmed: boolean;
22
+ }
23
+ export declare function describeNameScope({ name, published, declared, }: {
24
+ /** The package's bare slug (a namespaced form is accepted and stripped). */
25
+ name: string;
26
+ published?: PublishedPackage | null;
27
+ declared?: PackageNaming | null;
28
+ }): NameScope | null;
@@ -0,0 +1,54 @@
1
+ const VISIBILITY_NOTE = "Which Sources can see it is set separately, by Ekanos.";
2
+ function describeNameScope({
3
+ name,
4
+ published,
5
+ declared
6
+ }) {
7
+ const slug = name.slice(name.lastIndexOf("/") + 1);
8
+ if (published && published.namespace !== void 0) {
9
+ const namespace2 = published.namespace;
10
+ if (namespace2 === null) {
11
+ return {
12
+ scope: "global",
13
+ namespace: null,
14
+ displayName: slug,
15
+ label: "Global",
16
+ detail: `Published under the global name ${slug}, with no namespace. ${VISIBILITY_NOTE}`,
17
+ confirmed: true
18
+ };
19
+ }
20
+ const displayName2 = `${namespace2}/${slug}`;
21
+ return {
22
+ scope: "namespaced",
23
+ namespace: namespace2,
24
+ displayName: displayName2,
25
+ label: `Namespaced \xB7 ${namespace2}`,
26
+ detail: `Published as ${displayName2}, under your Source's namespace. Experiences name it ${displayName2}. ${VISIBILITY_NOTE}`,
27
+ confirmed: true
28
+ };
29
+ }
30
+ if (!declared) return null;
31
+ if (declared.availability === "global") {
32
+ return {
33
+ scope: "global",
34
+ namespace: null,
35
+ displayName: slug,
36
+ label: "Global",
37
+ detail: `ekanos.json sets availability.mode "global", so it publishes under the global name ${slug}. That needs an approved name first: ekanos names claim ${slug}. ${VISIBILITY_NOTE}`,
38
+ confirmed: false
39
+ };
40
+ }
41
+ const namespace = declared.namespace;
42
+ const displayName = namespace ? `${namespace}/${slug}` : slug;
43
+ return {
44
+ scope: "namespaced",
45
+ namespace,
46
+ displayName,
47
+ label: namespace ? `Namespaced \xB7 ${namespace}` : "Namespaced",
48
+ detail: `${namespace ? `Publishes as ${displayName}, under your Source's namespace.` : "Publishes under your Source's namespace."} That is the default; availability.mode "global" in ekanos.json publishes under a global name instead. ${VISIBILITY_NOTE}`,
49
+ confirmed: false
50
+ };
51
+ }
52
+ export {
53
+ describeNameScope
54
+ };
@@ -148,7 +148,8 @@ function ExperienceSummaryPage() {
148
148
  LatestPublishLine,
149
149
  {
150
150
  name: project.data.name,
151
- href: `${links.experience}/publishes`
151
+ href: `${links.experience}/publishes`,
152
+ naming: project.data.naming
152
153
  }
153
154
  ),
154
155
  /* @__PURE__ */ jsxs("section", { className: "flex flex-col gap-3", children: [
@@ -18,7 +18,7 @@ import {
18
18
  import { OverviewSkeleton } from "../components/integration-tab-skeletons.js";
19
19
  import { LatestPublishLine } from "../components/publish-status.js";
20
20
  import { CONNECTION_KIND_LABEL } from "../lib/connection-facts.js";
21
- import { useConnection, useRuns } from "../lib/console-hooks.js";
21
+ import { useConnection, useProject, useRuns } from "../lib/console-hooks.js";
22
22
  import {
23
23
  hasHealthCheck,
24
24
  healthKey,
@@ -169,6 +169,7 @@ function Overview({
169
169
  const slug = integration.integration;
170
170
  const connection = useConnection(slug);
171
171
  const runs = useRuns();
172
+ const project = useProject();
172
173
  const health = useQuery({
173
174
  queryKey: healthKey(slug),
174
175
  queryFn: () => null,
@@ -199,7 +200,14 @@ function Overview({
199
200
  slug
200
201
  });
201
202
  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,
203
+ base ? /* @__PURE__ */ jsx(
204
+ LatestPublishLine,
205
+ {
206
+ name: slug,
207
+ href: `${base}/publishes`,
208
+ ...integration.own ? { naming: project.data?.naming } : {}
209
+ }
210
+ ) : null,
203
211
  next ? /* @__PURE__ */ jsx(NextAction, { next, base }) : connection.isError ? /* @__PURE__ */ jsxs("p", { className: "text-destructive text-sm", role: "alert", children: [
204
212
  "Could not read the connection: ",
205
213
  connection.error.message
@@ -11,7 +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
+ import { NameScopeBadge, PublishChip } from "../components/publish-status.js";
15
15
  import {
16
16
  CONNECTION_TYPE,
17
17
  ConnectionStatusChip,
@@ -246,6 +246,7 @@ function IntegrationRow({
246
246
  row.version
247
247
  ] }),
248
248
  /* @__PURE__ */ jsx(PublishChip, { name: row.name }),
249
+ /* @__PURE__ */ jsx(NameScopeBadge, { name: row.name, naming: row.naming }),
249
250
  row.contractVersion ? /* @__PURE__ */ jsxs(
250
251
  "span",
251
252
  {
@@ -376,7 +377,8 @@ function ExperienceRow({ row }) {
376
377
  "v",
377
378
  row.version
378
379
  ] }),
379
- /* @__PURE__ */ jsx(PublishChip, { name: row.name })
380
+ /* @__PURE__ */ jsx(PublishChip, { name: row.name }),
381
+ /* @__PURE__ */ jsx(NameScopeBadge, { name: row.name, naming: row.naming })
380
382
  ] }),
381
383
  row.error ? /* @__PURE__ */ jsx("p", { className: "text-destructive text-xs", children: row.error }) : null,
382
384
  row.integrations.length > 0 ? /* @__PURE__ */ jsxs(
@@ -42,6 +42,7 @@ import {
42
42
  createFileFixtureSource,
43
43
  runOperation
44
44
  } from "./operation-runner.js";
45
+ import { readProjectNaming } from "./package-naming.js";
45
46
  import { resolveProjectRoot } from "./project-root.js";
46
47
  import { createRunLog } from "./run-log.js";
47
48
  import { readSessionCatalog } from "./session-catalog.js";
@@ -348,8 +349,10 @@ function createEkanosApiRouter(partial = {}) {
348
349
  if (method !== "GET")
349
350
  return apiError(405, "method_not_allowed", "GET only.");
350
351
  const state = await getResolution();
352
+ const naming = readProjectNaming(projectRoot());
351
353
  const body = {
352
354
  kind: state.kind,
355
+ ...naming ? { naming } : {},
353
356
  integrations: await Promise.all(
354
357
  state.integrations.map(
355
358
  async (integration) => toIntegrationView(integration, await runtimeOf(integration))
@@ -0,0 +1,14 @@
1
+ import { type Availability } from '@ekanos/integration-schema/repo';
2
+ import type { PackageNaming } from '../../api-types.js';
3
+ /**
4
+ * How a package publishes, from its `ekanos.json` and the repo around it. The
5
+ * namespace falls back to the package's own `source` (the Source slug a new
6
+ * Source's namespace defaults from), the same inference discovery makes for a
7
+ * repo.
8
+ */
9
+ export declare function namingOf(pkg: {
10
+ ekanosJson: Record<string, unknown>;
11
+ availability?: Availability;
12
+ }, repoNamespace: string | null): PackageNaming;
13
+ /** {@link namingOf} for the project at `projectRoot`; null when it has no readable `ekanos.json`. */
14
+ export declare function readProjectNaming(projectRoot: string): PackageNaming | null;
@@ -0,0 +1,43 @@
1
+ import { isValidNamespace } from "@ekanos/integration-schema";
2
+ import {
3
+ AvailabilitySchema
4
+ } from "@ekanos/integration-schema/repo";
5
+ import * as fs from "node:fs";
6
+ import * as path from "node:path";
7
+ import { repoOf } from "./integration-resolver.js";
8
+ function namingOf(pkg, repoNamespace) {
9
+ const source = pkg.ekanosJson.source;
10
+ return {
11
+ availability: pkg.availability?.mode === "global" ? "global" : "restricted",
12
+ namespace: repoNamespace ?? (typeof source === "string" && isValidNamespace(source) ? source : null)
13
+ };
14
+ }
15
+ function readProjectNaming(projectRoot) {
16
+ let ekanosJson;
17
+ try {
18
+ const parsed = JSON.parse(
19
+ fs.readFileSync(path.join(projectRoot, "ekanos.json"), "utf8")
20
+ );
21
+ if (typeof parsed !== "object" || parsed === null) return null;
22
+ ekanosJson = parsed;
23
+ } catch (error) {
24
+ if (error.code === "ENOENT") return null;
25
+ console.error(
26
+ `[harness:naming] ${projectRoot}/ekanos.json could not be read`,
27
+ error
28
+ );
29
+ return null;
30
+ }
31
+ const availability = AvailabilitySchema.safeParse(ekanosJson.availability);
32
+ return namingOf(
33
+ {
34
+ ekanosJson,
35
+ ...availability.success ? { availability: availability.data } : {}
36
+ },
37
+ repoOf(projectRoot)?.namespace ?? null
38
+ );
39
+ }
40
+ export {
41
+ namingOf,
42
+ readProjectNaming
43
+ };
@@ -9,6 +9,7 @@ import { handleHostRoute } from "./host-snapshots.js";
9
9
  import { getLiveStore } from "./live-context.js";
10
10
  import { isLoopbackHost, loopbackRefusal } from "./loopback-guard.js";
11
11
  import { hasStoredOauthConnection } from "./oauth-persistence.js";
12
+ import { namingOf } from "./package-naming.js";
12
13
  import { readSessionCatalog } from "./session-catalog.js";
13
14
  function json(body, init = {}) {
14
15
  return new Response(JSON.stringify(body), {
@@ -264,13 +265,17 @@ function createRepoApiRouter(partial) {
264
265
  for (const pkg of integrationPackages) {
265
266
  const { row, connection } = await integrationRow(request, pkg);
266
267
  connections.set(pkg.name, connection);
267
- integrations.push(row);
268
+ integrations.push({ ...row, naming: namingOf(pkg, repo.namespace) });
268
269
  }
269
270
  const experiences = [];
270
271
  for (const pkg of experiencePackages) {
271
- experiences.push(
272
- await experienceRow(request, pkg, connections, repoPackageName)
272
+ const row = await experienceRow(
273
+ request,
274
+ pkg,
275
+ connections,
276
+ repoPackageName
273
277
  );
278
+ experiences.push({ ...row, naming: namingOf(pkg, repo.namespace) });
274
279
  }
275
280
  for (const experience of experiences) {
276
281
  for (const used of experience.integrations) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ekanos/harness",
3
- "version": "0.30.0",
3
+ "version": "0.31.0",
4
4
  "private": false,
5
5
  "description": "The Ekanos integration dev harness — every surface of an integration rendered in real Ekanos chrome, from fixtures, with no Supabase or auth; and, in live mode, a real localhost OAuth loop over your own dev-app credentials.",
6
6
  "homepage": "https://sdk.ekanos.dev/harness/overview",
@@ -72,13 +72,13 @@
72
72
  "access": "public"
73
73
  },
74
74
  "dependencies": {
75
- "@ekanos/integration-schema": "0.30.0",
75
+ "@ekanos/integration-schema": "0.31.0",
76
76
  "next-themes": "0.4.6",
77
77
  "tw-animate-css": "1.4.0"
78
78
  },
79
79
  "devDependencies": {
80
- "@ekanos/sdk": "0.30.0",
81
- "@ekanos/ui": "0.30.0",
80
+ "@ekanos/sdk": "0.31.0",
81
+ "@ekanos/ui": "0.31.0",
82
82
  "@kit/tsconfig": "0.1.0",
83
83
  "@tailwindcss/postcss": "4.3.5",
84
84
  "@tanstack/react-query": "5.107.1",
@@ -98,8 +98,8 @@
98
98
  "zod": "4.6.7"
99
99
  },
100
100
  "peerDependencies": {
101
- "@ekanos/sdk": "^0.30.0",
102
- "@ekanos/ui": "^0.30.0",
101
+ "@ekanos/sdk": "^0.31.0",
102
+ "@ekanos/ui": "^0.31.0",
103
103
  "@tanstack/react-query": "^5.101.4",
104
104
  "next": "^16.0.0",
105
105
  "next-intl": "^4.14.7",