@ekanos/cli 0.24.0 → 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/README.md +4 -0
  2. package/dist/catalog-api.d.ts +8 -1
  3. package/dist/catalog-api.js +26 -1
  4. package/dist/catalog-api.js.map +1 -1
  5. package/dist/commands/add.js +2 -1
  6. package/dist/commands/add.js.map +1 -1
  7. package/dist/commands/apps.js +6 -4
  8. package/dist/commands/apps.js.map +1 -1
  9. package/dist/commands/dev.d.ts +5 -0
  10. package/dist/commands/dev.js +25 -9
  11. package/dist/commands/dev.js.map +1 -1
  12. package/dist/commands/routes.js +7 -1
  13. package/dist/commands/routes.js.map +1 -1
  14. package/dist/commands/sources.js +11 -8
  15. package/dist/commands/sources.js.map +1 -1
  16. package/dist/commands/sync.js +3 -2
  17. package/dist/commands/sync.js.map +1 -1
  18. package/dist/commands/teams-events.js +9 -1
  19. package/dist/commands/teams-events.js.map +1 -1
  20. package/dist/commands/teams-lifecycle.js +9 -1
  21. package/dist/commands/teams-lifecycle.js.map +1 -1
  22. package/dist/commands/teams-onboard.js +9 -1
  23. package/dist/commands/teams-onboard.js.map +1 -1
  24. package/dist/commands/teams-overview.d.ts +1 -1
  25. package/dist/commands/teams-overview.js +41 -14
  26. package/dist/commands/teams-overview.js.map +1 -1
  27. package/dist/commands/teams.js +9 -1
  28. package/dist/commands/teams.js.map +1 -1
  29. package/dist/compatibility.d.ts +11 -1
  30. package/dist/compatibility.js +11 -1
  31. package/dist/compatibility.js.map +1 -1
  32. package/dist/contracts-api.d.ts +32 -0
  33. package/dist/contracts-api.js +66 -0
  34. package/dist/contracts-api.js.map +1 -0
  35. package/dist/experience/host-contract-source.d.ts +35 -0
  36. package/dist/experience/host-contract-source.js +121 -0
  37. package/dist/experience/host-contract-source.js.map +1 -0
  38. package/dist/harness-scaffold.js +6 -0
  39. package/dist/harness-scaffold.js.map +1 -1
  40. package/dist/host-snapshots.d.ts +66 -0
  41. package/dist/host-snapshots.js +273 -0
  42. package/dist/host-snapshots.js.map +1 -0
  43. package/dist/product-slug.d.ts +8 -0
  44. package/dist/product-slug.js +13 -0
  45. package/dist/product-slug.js.map +1 -0
  46. package/package.json +3 -3
  47. package/templates/experience/package.json.tmpl +4 -4
  48. package/templates/harness/app/catalog/[slug]/page.tsx.tmpl +1 -0
  49. package/templates/harness/app/catalog/layout.tsx.tmpl +1 -0
  50. package/templates/harness/app/catalog/page.tsx.tmpl +1 -0
  51. package/templates/harness/app/experience/pages/page.tsx.tmpl +1 -0
  52. package/templates/harness/app/experience/publishes/page.tsx.tmpl +1 -0
  53. package/templates/harness/app/integrations/[slug]/publishes/page.tsx.tmpl +1 -0
  54. package/templates/package.json.tmpl +4 -4
  55. package/templates/skills/build-integration/references/widget-design.md +24 -0
@@ -0,0 +1,273 @@
1
+ import { CatalogSnapshotSchema, PublishStatusSnapshotSchema, } from '@ekanos/integration-schema';
2
+ import * as fs from 'node:fs';
3
+ import * as path from 'node:path';
4
+ import { refreshStoredSession, resolveAuthEnvironment, } from './auth/session.js';
5
+ import { fetchPublicCatalog, fetchSourceCatalog } from './catalog-api.js';
6
+ import { readActiveSource } from './commands/sources.js';
7
+ import { CliError } from './errors.js';
8
+ import { listSubmissions } from './publish-api.js';
9
+ import { resolveSourceTarget } from './source-target.js';
10
+ /**
11
+ * What `ekanos dev` hands the harness about the host, beside the session
12
+ * catalog: the catalog a developer browses (`catalog.json`) and the Source's
13
+ * published packages (`publish-status.json`). The CLI holds the login, so the
14
+ * harness never sees a token and never refreshes one (a second refresher would
15
+ * race the CLI for the rotating refresh token). The harness asks for a fresh
16
+ * read by writing `refresh-request`.
17
+ */
18
+ export const CATALOG_SNAPSHOT_FILE = path.join('.ekanos', 'catalog.json');
19
+ export const PUBLISH_STATUS_FILE = path.join('.ekanos', 'publish-status.json');
20
+ export const REFRESH_REQUEST_FILE = 'refresh-request';
21
+ /** Poll fast while a version is still moving through the pipeline. */
22
+ const IN_FLIGHT_STATES = new Set(['submitted', 'gated']);
23
+ export const IN_FLIGHT_INTERVAL_MS = 30000;
24
+ export const IDLE_INTERVAL_MS = 300000;
25
+ const DEFAULT_DEPS = {
26
+ fetchSourceCatalog,
27
+ fetchPublicCatalog,
28
+ listSubmissions,
29
+ resolveSourceTarget,
30
+ refreshStoredSession,
31
+ now: () => new Date(),
32
+ };
33
+ function messageOf(error) {
34
+ return error instanceof Error ? error.message : String(error);
35
+ }
36
+ /** The error's message and, for a CLI error, what to do about it. */
37
+ function messageWithHint(error) {
38
+ if (error instanceof CliError)
39
+ return `${error.message} ${error.hint}`;
40
+ return messageOf(error);
41
+ }
42
+ /**
43
+ * Read both snapshots from the host, never throwing: every way it can fail is
44
+ * written down as `unavailable`, in words the harness shows as is.
45
+ */
46
+ export async function readHostSnapshots(params) {
47
+ const deps = Object.assign(Object.assign({}, DEFAULT_DEPS), params.deps);
48
+ const fetchedAt = deps.now().toISOString();
49
+ const empty = (host, unavailable) => ({
50
+ catalog: {
51
+ fetchedAt,
52
+ host,
53
+ scope: null,
54
+ source: null,
55
+ unavailable,
56
+ products: [],
57
+ },
58
+ publish: {
59
+ fetchedAt,
60
+ host,
61
+ source: null,
62
+ unavailable,
63
+ packages: [],
64
+ },
65
+ });
66
+ let auth;
67
+ try {
68
+ auth = resolveAuthEnvironment(params.ctx, undefined, params.env, {
69
+ projectDir: params.projectDir,
70
+ });
71
+ }
72
+ catch (_a) {
73
+ return empty(null, {
74
+ reason: 'not-logged-in',
75
+ message: 'No Ekanos host is known for this project. Run "ekanos login" to see the catalog and your publishes.',
76
+ });
77
+ }
78
+ const host = auth.host;
79
+ /** The host's public catalog, for a developer with no Source to read. */
80
+ const publicCatalog = async (unavailable) => {
81
+ const result = empty(host, unavailable);
82
+ try {
83
+ const catalog = await deps.fetchPublicCatalog(host);
84
+ if (catalog) {
85
+ result.catalog = Object.assign(Object.assign({}, result.catalog), { scope: 'public', unavailable: null, products: catalog.products });
86
+ }
87
+ }
88
+ catch (error) {
89
+ result.catalog.unavailable = {
90
+ reason: 'host-error',
91
+ message: `Could not read the public catalog from ${host}: ${messageOf(error)}`,
92
+ };
93
+ }
94
+ return result;
95
+ };
96
+ let session = auth.store.read(host);
97
+ if (!session) {
98
+ return publicCatalog({
99
+ reason: 'not-logged-in',
100
+ message: `Not logged in to ${host}. Run "ekanos login" to see your Source's catalog and your publishes.`,
101
+ });
102
+ }
103
+ let source;
104
+ try {
105
+ const target = await deps.resolveSourceTarget(auth, session, Object.assign({ dir: params.projectDir }, (params.fallbackSource && !readActiveSource(params.projectDir)
106
+ ? { source: params.fallbackSource }
107
+ : {})));
108
+ source = target.source;
109
+ session = target.session;
110
+ }
111
+ catch (error) {
112
+ return publicCatalog({
113
+ reason: 'no-source',
114
+ message: messageWithHint(error),
115
+ });
116
+ }
117
+ /** One call, retried once with a refreshed session on a 401. */
118
+ async function withSession(call) {
119
+ const current = session;
120
+ const first = await call(current.accessToken);
121
+ if (first.status !== 'unauthorized')
122
+ return first;
123
+ session = await deps.refreshStoredSession(auth, current);
124
+ return call(session.accessToken);
125
+ }
126
+ const result = empty(host, null);
127
+ result.publish.source = source;
128
+ try {
129
+ const catalog = await withSession((token) => deps.fetchSourceCatalog(host, token, { source }));
130
+ if (catalog.status === 'ok') {
131
+ result.catalog = {
132
+ fetchedAt,
133
+ host,
134
+ scope: 'source',
135
+ source: {
136
+ slug: catalog.catalog.source.slug,
137
+ name: catalog.catalog.source.name,
138
+ },
139
+ unavailable: null,
140
+ products: catalog.catalog.products,
141
+ };
142
+ }
143
+ else {
144
+ result.catalog.unavailable = {
145
+ reason: 'not-logged-in',
146
+ message: `The session for ${host} has expired. Run "ekanos login".`,
147
+ };
148
+ }
149
+ }
150
+ catch (error) {
151
+ result.catalog.unavailable = {
152
+ reason: 'host-error',
153
+ message: `Could not read the catalog for ${source}: ${messageOf(error)}`,
154
+ };
155
+ }
156
+ try {
157
+ const listed = await withSession((token) => deps.listSubmissions(host, token, source, { detail: 'findings' }));
158
+ if (listed.status === 'ok') {
159
+ result.publish.packages = listed.integrations;
160
+ }
161
+ else {
162
+ result.publish.unavailable = {
163
+ reason: 'not-logged-in',
164
+ message: `The session for ${host} has expired. Run "ekanos login".`,
165
+ };
166
+ }
167
+ }
168
+ catch (error) {
169
+ result.publish.unavailable = {
170
+ reason: 'host-error',
171
+ message: `Could not read the publishes for ${source}: ${messageOf(error)}`,
172
+ };
173
+ }
174
+ return result;
175
+ }
176
+ /**
177
+ * The one Source every package of a repo names in its `ekanos.json`, or null
178
+ * when they name none or disagree (then the account's seats decide, as for
179
+ * any project).
180
+ */
181
+ export function sharedPackageSource(dirs) {
182
+ const named = new Set(dirs.map((dir) => readActiveSource(dir)).filter((v) => !!v));
183
+ return named.size === 1 ? [...named][0] : null;
184
+ }
185
+ /** Write both snapshots for the harness, owner-only, never a token. */
186
+ export function writeHostSnapshots(projectDir, snapshots) {
187
+ const write = (file, value) => {
188
+ const target = path.join(projectDir, file);
189
+ fs.mkdirSync(path.dirname(target), { recursive: true });
190
+ const temp = `${target}.tmp`;
191
+ fs.writeFileSync(temp, `${JSON.stringify(value)}\n`, { mode: 0o600 });
192
+ fs.renameSync(temp, target);
193
+ };
194
+ const catalog = CatalogSnapshotSchema.safeParse(snapshots.catalog);
195
+ if (catalog.success)
196
+ write(CATALOG_SNAPSHOT_FILE, catalog.data);
197
+ const publish = PublishStatusSnapshotSchema.safeParse(snapshots.publish);
198
+ if (publish.success)
199
+ write(PUBLISH_STATUS_FILE, publish.data);
200
+ }
201
+ /** How long to wait before the next read: fast while a version is in flight. */
202
+ export function nextRefreshDelay(publish) {
203
+ const inFlight = publish.packages.some((pkg) => pkg.versions.some((version) => IN_FLIGHT_STATES.has(version.state)));
204
+ return inFlight ? IN_FLIGHT_INTERVAL_MS : IDLE_INTERVAL_MS;
205
+ }
206
+ /**
207
+ * Keep both snapshots fresh while the harness runs: read now, then again on a
208
+ * timer (30 s while a version is in flight, 5 min otherwise) and whenever the
209
+ * harness writes `.ekanos/refresh-request`. Returns a stop function.
210
+ */
211
+ export function startHostSnapshotRefresher(params) {
212
+ const dir = path.join(params.projectDir, '.ekanos');
213
+ fs.mkdirSync(dir, { recursive: true });
214
+ let stopped = false;
215
+ let running = false;
216
+ let queued = false;
217
+ let timer = null;
218
+ const schedule = (delay) => {
219
+ if (stopped)
220
+ return;
221
+ if (timer)
222
+ clearTimeout(timer);
223
+ timer = setTimeout(() => void refresh(), delay);
224
+ timer.unref();
225
+ };
226
+ const refresh = async () => {
227
+ if (stopped)
228
+ return;
229
+ if (running) {
230
+ queued = true;
231
+ return;
232
+ }
233
+ running = true;
234
+ let delay = IDLE_INTERVAL_MS;
235
+ try {
236
+ const snapshots = await readHostSnapshots(params);
237
+ if (!stopped)
238
+ writeHostSnapshots(params.projectDir, snapshots);
239
+ delay = nextRefreshDelay(snapshots.publish);
240
+ }
241
+ catch (error) {
242
+ params.ctx.log(params.ctx.ui.dim(`Could not refresh the catalog and publish status: ${messageOf(error)}`));
243
+ }
244
+ finally {
245
+ running = false;
246
+ }
247
+ if (queued) {
248
+ queued = false;
249
+ void refresh();
250
+ return;
251
+ }
252
+ schedule(delay);
253
+ };
254
+ let watcher = null;
255
+ try {
256
+ watcher = fs.watch(dir, (_event, filename) => {
257
+ if (filename === REFRESH_REQUEST_FILE)
258
+ void refresh();
259
+ });
260
+ watcher.unref();
261
+ }
262
+ catch (error) {
263
+ params.ctx.log(params.ctx.ui.dim(`The harness's Refresh button will wait for the next timed read: ${messageOf(error)}`));
264
+ }
265
+ void refresh();
266
+ return () => {
267
+ stopped = true;
268
+ if (timer)
269
+ clearTimeout(timer);
270
+ watcher === null || watcher === void 0 ? void 0 : watcher.close();
271
+ };
272
+ }
273
+ //# sourceMappingURL=host-snapshots.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host-snapshots.js","sourceRoot":"","sources":["../src/host-snapshots.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,qBAAqB,EACrB,2BAA2B,GAG5B,M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ACJ,CAAC","sourcesContent":["import {\n type CatalogProduct,\n type CatalogSnapshot,\n CatalogSnapshotSchema,\n PublishStatusSnapshotSchema,\n type PublishStatusSnapshot,\n type PublishedPackage,\n} from '@ekanos/integration-schema';\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\n\nimport type { StoredSession } from './auth/credential-store';\nimport {\n type AuthEnvironment,\n refreshStoredSession,\n resolveAuthEnvironment,\n} from './auth/session';\nimport { fetchPublicCatalog, fetchSourceCatalog } from './catalog-api';\nimport { readActiveSource } from './commands/sources';\nimport type { CliContext } from './context';\nimport { CliError } from './errors';\nimport { listSubmissions } from './publish-api';\nimport { resolveSourceTarget } from './source-target';\n\n/**\n * What `ekanos dev` hands the harness about the host, beside the session\n * catalog: the catalog a developer browses (`catalog.json`) and the Source's\n * published packages (`publish-status.json`). The CLI holds the login, so the\n * harness never sees a token and never refreshes one (a second refresher would\n * race the CLI for the rotating refresh token). The harness asks for a fresh\n * read by writing `refresh-request`.\n */\nexport const CATALOG_SNAPSHOT_FILE = path.join('.ekanos', 'catalog.json');\nexport const PUBLISH_STATUS_FILE = path.join('.ekanos', 'publish-status.json');\nexport const REFRESH_REQUEST_FILE = 'refresh-request';\n\n/** Poll fast while a version is still moving through the pipeline. */\nconst IN_FLIGHT_STATES = new Set(['submitted', 'gated']);\nexport const IN_FLIGHT_INTERVAL_MS = 30_000;\nexport const IDLE_INTERVAL_MS = 300_000;\n\ntype Unavailable = NonNullable<CatalogSnapshot['unavailable']>;\n\nexport interface HostSnapshots {\n catalog: CatalogSnapshot;\n publish: PublishStatusSnapshot;\n}\n\n/** The network calls, injectable for tests. */\nexport interface HostSnapshotDeps {\n fetchSourceCatalog: typeof fetchSourceCatalog;\n fetchPublicCatalog: typeof fetchPublicCatalog;\n listSubmissions: typeof listSubmissions;\n resolveSourceTarget: typeof resolveSourceTarget;\n refreshStoredSession: typeof refreshStoredSession;\n now: () => Date;\n}\n\nconst DEFAULT_DEPS: HostSnapshotDeps = {\n fetchSourceCatalog,\n fetchPublicCatalog,\n listSubmissions,\n resolveSourceTarget,\n refreshStoredSession,\n now: () => new Date(),\n};\n\nfunction messageOf(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\n\n/** The error's message and, for a CLI error, what to do about it. */\nfunction messageWithHint(error: unknown): string {\n if (error instanceof CliError) return `${error.message} ${error.hint}`;\n return messageOf(error);\n}\n\n/**\n * Read both snapshots from the host, never throwing: every way it can fail is\n * written down as `unavailable`, in words the harness shows as is.\n */\nexport async function readHostSnapshots(params: {\n ctx: CliContext;\n env: Record<string, string | undefined>;\n projectDir: string;\n /** The Source to read when the project itself names none (a repo's packages' shared one). */\n fallbackSource?: string | null;\n deps?: Partial<HostSnapshotDeps>;\n}): Promise<HostSnapshots> {\n const deps = { ...DEFAULT_DEPS, ...params.deps };\n const fetchedAt = deps.now().toISOString();\n\n const empty = (\n host: string | null,\n unavailable: Unavailable | null,\n ): HostSnapshots => ({\n catalog: {\n fetchedAt,\n host,\n scope: null,\n source: null,\n unavailable,\n products: [],\n },\n publish: {\n fetchedAt,\n host,\n source: null,\n unavailable,\n packages: [],\n },\n });\n\n let auth: AuthEnvironment;\n try {\n auth = resolveAuthEnvironment(params.ctx, undefined, params.env, {\n projectDir: params.projectDir,\n });\n } catch {\n return empty(null, {\n reason: 'not-logged-in',\n message:\n 'No Ekanos host is known for this project. Run \"ekanos login\" to see the catalog and your publishes.',\n });\n }\n const host = auth.host;\n\n /** The host's public catalog, for a developer with no Source to read. */\n const publicCatalog = async (\n unavailable: Unavailable,\n ): Promise<HostSnapshots> => {\n const result = empty(host, unavailable);\n try {\n const catalog = await deps.fetchPublicCatalog(host);\n if (catalog) {\n result.catalog = {\n ...result.catalog,\n scope: 'public',\n unavailable: null,\n products: catalog.products,\n };\n }\n } catch (error) {\n result.catalog.unavailable = {\n reason: 'host-error',\n message: `Could not read the public catalog from ${host}: ${messageOf(error)}`,\n };\n }\n return result;\n };\n\n let session: StoredSession | null = auth.store.read(host);\n if (!session) {\n return publicCatalog({\n reason: 'not-logged-in',\n message: `Not logged in to ${host}. Run \"ekanos login\" to see your Source's catalog and your publishes.`,\n });\n }\n\n let source: string;\n try {\n const target = await deps.resolveSourceTarget(auth, session, {\n dir: params.projectDir,\n ...(params.fallbackSource && !readActiveSource(params.projectDir)\n ? { source: params.fallbackSource }\n : {}),\n });\n source = target.source;\n session = target.session;\n } catch (error) {\n return publicCatalog({\n reason: 'no-source',\n message: messageWithHint(error),\n });\n }\n\n /** One call, retried once with a refreshed session on a 401. */\n async function withSession<T extends { status: string }>(\n call: (token: string) => Promise<T>,\n ): Promise<T> {\n const current = session!;\n const first = await call(current.accessToken);\n if (first.status !== 'unauthorized') return first;\n session = await deps.refreshStoredSession(auth, current);\n return call(session.accessToken);\n }\n\n const result = empty(host, null);\n result.publish.source = source;\n\n try {\n const catalog = await withSession((token) =>\n deps.fetchSourceCatalog(host, token, { source }),\n );\n if (catalog.status === 'ok') {\n result.catalog = {\n fetchedAt,\n host,\n scope: 'source',\n source: {\n slug: catalog.catalog.source.slug,\n name: catalog.catalog.source.name,\n },\n unavailable: null,\n products: catalog.catalog.products satisfies CatalogProduct[],\n };\n } else {\n result.catalog.unavailable = {\n reason: 'not-logged-in',\n message: `The session for ${host} has expired. Run \"ekanos login\".`,\n };\n }\n } catch (error) {\n result.catalog.unavailable = {\n reason: 'host-error',\n message: `Could not read the catalog for ${source}: ${messageOf(error)}`,\n };\n }\n\n try {\n const listed = await withSession((token) =>\n deps.listSubmissions(host, token, source, { detail: 'findings' }),\n );\n if (listed.status === 'ok') {\n result.publish.packages = listed.integrations as PublishedPackage[];\n } else {\n result.publish.unavailable = {\n reason: 'not-logged-in',\n message: `The session for ${host} has expired. Run \"ekanos login\".`,\n };\n }\n } catch (error) {\n result.publish.unavailable = {\n reason: 'host-error',\n message: `Could not read the publishes for ${source}: ${messageOf(error)}`,\n };\n }\n\n return result;\n}\n\n/**\n * The one Source every package of a repo names in its `ekanos.json`, or null\n * when they name none or disagree (then the account's seats decide, as for\n * any project).\n */\nexport function sharedPackageSource(dirs: readonly string[]): string | null {\n const named = new Set(\n dirs.map((dir) => readActiveSource(dir)).filter((v): v is string => !!v),\n );\n return named.size === 1 ? [...named][0]! : null;\n}\n\n/** Write both snapshots for the harness, owner-only, never a token. */\nexport function writeHostSnapshots(\n projectDir: string,\n snapshots: HostSnapshots,\n): void {\n const write = (file: string, value: unknown) => {\n const target = path.join(projectDir, file);\n fs.mkdirSync(path.dirname(target), { recursive: true });\n const temp = `${target}.tmp`;\n fs.writeFileSync(temp, `${JSON.stringify(value)}\\n`, { mode: 0o600 });\n fs.renameSync(temp, target);\n };\n const catalog = CatalogSnapshotSchema.safeParse(snapshots.catalog);\n if (catalog.success) write(CATALOG_SNAPSHOT_FILE, catalog.data);\n const publish = PublishStatusSnapshotSchema.safeParse(snapshots.publish);\n if (publish.success) write(PUBLISH_STATUS_FILE, publish.data);\n}\n\n/** How long to wait before the next read: fast while a version is in flight. */\nexport function nextRefreshDelay(publish: PublishStatusSnapshot): number {\n const inFlight = publish.packages.some((pkg) =>\n pkg.versions.some((version) => IN_FLIGHT_STATES.has(version.state)),\n );\n return inFlight ? IN_FLIGHT_INTERVAL_MS : IDLE_INTERVAL_MS;\n}\n\n/**\n * Keep both snapshots fresh while the harness runs: read now, then again on a\n * timer (30 s while a version is in flight, 5 min otherwise) and whenever the\n * harness writes `.ekanos/refresh-request`. Returns a stop function.\n */\nexport function startHostSnapshotRefresher(params: {\n ctx: CliContext;\n env: Record<string, string | undefined>;\n projectDir: string;\n fallbackSource?: string | null;\n deps?: Partial<HostSnapshotDeps>;\n}): () => void {\n const dir = path.join(params.projectDir, '.ekanos');\n fs.mkdirSync(dir, { recursive: true });\n\n let stopped = false;\n let running = false;\n let queued = false;\n let timer: NodeJS.Timeout | null = null;\n\n const schedule = (delay: number) => {\n if (stopped) return;\n if (timer) clearTimeout(timer);\n timer = setTimeout(() => void refresh(), delay);\n timer.unref();\n };\n\n const refresh = async () => {\n if (stopped) return;\n if (running) {\n queued = true;\n return;\n }\n running = true;\n let delay = IDLE_INTERVAL_MS;\n try {\n const snapshots = await readHostSnapshots(params);\n if (!stopped) writeHostSnapshots(params.projectDir, snapshots);\n delay = nextRefreshDelay(snapshots.publish);\n } catch (error) {\n params.ctx.log(\n params.ctx.ui.dim(\n `Could not refresh the catalog and publish status: ${messageOf(error)}`,\n ),\n );\n } finally {\n running = false;\n }\n if (queued) {\n queued = false;\n void refresh();\n return;\n }\n schedule(delay);\n };\n\n let watcher: fs.FSWatcher | null = null;\n try {\n watcher = fs.watch(dir, (_event, filename) => {\n if (filename === REFRESH_REQUEST_FILE) void refresh();\n });\n watcher.unref();\n } catch (error) {\n params.ctx.log(\n params.ctx.ui.dim(\n `The harness's Refresh button will wait for the next timed read: ${messageOf(error)}`,\n ),\n );\n }\n\n void refresh();\n\n return () => {\n stopped = true;\n if (timer) clearTimeout(timer);\n watcher?.close();\n };\n}\n"]}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * A product slug as the server names one: a bare slug (`linear`) or a
3
+ * partner package's token, namespaced by its publishing Source
4
+ * (`vastly-dev__linear`). Only operands a person typed go through this;
5
+ * slugs the server returned are used as they are.
6
+ */
7
+ export declare function isProductSlug(value: string): boolean;
8
+ export declare const PRODUCT_SLUG_SHAPE = "A product slug is kebab-case (\"linear\", \"google-workspace\"), or namespaced by the Source that publishes it (\"vastly-dev__linear\").";
@@ -0,0 +1,13 @@
1
+ import { isValidToken } from '@ekanos/integration-schema';
2
+ const MAX_LENGTH = 128;
3
+ /**
4
+ * A product slug as the server names one: a bare slug (`linear`) or a
5
+ * partner package's token, namespaced by its publishing Source
6
+ * (`vastly-dev__linear`). Only operands a person typed go through this;
7
+ * slugs the server returned are used as they are.
8
+ */
9
+ export function isProductSlug(value) {
10
+ return value.length <= MAX_LENGTH && isValidToken(value);
11
+ }
12
+ export const PRODUCT_SLUG_SHAPE = 'A product slug is kebab-case ("linear", "google-workspace"), or namespaced by the Source that publishes it ("vastly-dev__linear").';
13
+ //# sourceMappingURL=product-slug.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product-slug.js","sourceRoot":"","sources":["../src/product-slug.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,MAAM,UAAU,GAAG,GAAG,CAAC;AAEvB;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,KAAa;IACzC,OAAO,KAAK,CAAC,MAAM,IAAI,UAAU,IAAI,YAAY,CAAC,KAAK,CAAC,CAAC;AAC3D,CAAC;AAED,MAAM,CAAC,MAAM,kBAAkB,GAC7B,oIAAoI,CAAC","sourcesContent":["import { isValidToken } from '@ekanos/integration-schema';\n\nconst MAX_LENGTH = 128;\n\n/**\n * A product slug as the server names one: a bare slug (`linear`) or a\n * partner package's token, namespaced by its publishing Source\n * (`vastly-dev__linear`). Only operands a person typed go through this;\n * slugs the server returned are used as they are.\n */\nexport function isProductSlug(value: string): boolean {\n return value.length <= MAX_LENGTH && isValidToken(value);\n}\n\nexport const PRODUCT_SLUG_SHAPE =\n 'A product slug is kebab-case (\"linear\", \"google-workspace\"), or namespaced by the Source that publishes it (\"vastly-dev__linear\").';\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ekanos/cli",
3
- "version": "0.24.0",
3
+ "version": "0.26.0",
4
4
  "private": false,
5
5
  "description": "The Ekanos partner toolchain CLI: scaffold, validate, and test an Ekanos integration against the published @ekanos packages. Agent-native — every verb speaks JSON with a stable exit-code taxonomy.",
6
6
  "keywords": [
@@ -34,8 +34,8 @@
34
34
  "access": "public"
35
35
  },
36
36
  "dependencies": {
37
- "@clack/prompts": "1.8.1",
38
- "@ekanos/integration-schema": "0.28.0",
37
+ "@clack/prompts": "1.9.0",
38
+ "@ekanos/integration-schema": "0.30.0",
39
39
  "esbuild": "0.28.2",
40
40
  "picocolors": "1.1.1"
41
41
  },
@@ -22,16 +22,16 @@
22
22
  "build": "npx ekanos build"
23
23
  },
24
24
  "dependencies": {
25
- "@ekanos/sdk": "^0.28.0",
26
- "@ekanos/ui": "^0.28.0",
25
+ "@ekanos/sdk": "^0.30.0",
26
+ "@ekanos/ui": "^0.30.0",
27
27
  "@tanstack/react-query": "^5.101.4",
28
28
  "react": "^19.2.8",
29
29
  "react-dom": "^19.2.8",
30
30
  "zod": "^4.6.7"
31
31
  },
32
32
  "devDependencies": {
33
- "@ekanos/cli": "^0.24.0",
34
- "@ekanos/harness": "^0.28.0",
33
+ "@ekanos/cli": "^0.26.0",
34
+ "@ekanos/harness": "^0.30.0",
35
35
  "@tailwindcss/postcss": "^4.3.3",
36
36
  "@typescript-eslint/parser": "^8.46.2",
37
37
  "@types/react": "^19.2.0",
@@ -0,0 +1 @@
1
+ export { CatalogProductPage as default } from '@ekanos/harness/routes';
@@ -0,0 +1 @@
1
+ export { CatalogLayout as default } from '@ekanos/harness/routes';
@@ -0,0 +1 @@
1
+ export { CatalogPage as default } from '@ekanos/harness/routes';
@@ -0,0 +1 @@
1
+ export { ExperiencePagesPage as default } from '@ekanos/harness/routes';
@@ -0,0 +1 @@
1
+ export { ExperiencePublishesPage as default } from '@ekanos/harness/routes';
@@ -0,0 +1 @@
1
+ export { IntegrationPublishesPage as default } from '@ekanos/harness/routes';
@@ -12,12 +12,12 @@
12
12
  "prepare": "node scripts/setup-hooks.mjs"
13
13
  },
14
14
  "dependencies": {
15
- "@ekanos/sdk": "^0.28.0",
16
- "@ekanos/ui": "^0.28.0"
15
+ "@ekanos/sdk": "^0.30.0",
16
+ "@ekanos/ui": "^0.30.0"
17
17
  },
18
18
  "devDependencies": {
19
- "@ekanos/cli": "^0.24.0",
20
- "@ekanos/harness": "^0.28.0",
19
+ "@ekanos/cli": "^0.26.0",
20
+ "@ekanos/harness": "^0.30.0",
21
21
  "@hookform/resolvers": "^5.2.2",
22
22
  "@tailwindcss/postcss": "^4.3.3",
23
23
  "@tanstack/react-query": "^5.101.4",
@@ -227,6 +227,28 @@ high; lists and feeds 4–6 × 10–14; charts 6–8 × 10–12 (grid units, lg
227
227
  breakpoint). Give md/sm the same content priority order — cut columns, not
228
228
  meaning.
229
229
 
230
+ ## Load each widget on demand
231
+
232
+ The host loads every integration's definition for every page, so a widget
233
+ that `src/integration.ts` imports directly ships to the browser on every
234
+ page, whether it is on screen or not. Declare widgets, pages, the activation
235
+ form and the marketplace tile from one `'use client'` file through
236
+ `lazyComponent`, and import them from there:
237
+
238
+ ```tsx
239
+ // src/components/lazy.tsx
240
+ 'use client';
241
+
242
+ import { lazyComponent } from '@ekanos/sdk/components';
243
+
244
+ export const ForecastWidget = lazyComponent(() =>
245
+ import('./widgets/forecast-widget').then((m) => m.ForecastWidget),
246
+ );
247
+ ```
248
+
249
+ Keep the `'use client'` line and the literal `import()` path: without either,
250
+ the component is not split out.
251
+
230
252
  ## Checklist before calling a widget done
231
253
 
232
254
  - [ ] Four states render in the harness; user has seen them
@@ -239,6 +261,8 @@ meaning.
239
261
  - [ ] Mock data replaced by real data (or the mock is clearly temporary and
240
262
  the wiring phase is next)
241
263
  - [ ] Widget id is slug-prefixed and globally unique
264
+ - [ ] `integration.ts` takes the widget from your `lazyComponent` file, not
265
+ from the widget's own file
242
266
 
243
267
  A styling review of existing widgets — worst-first findings, before→after
244
268
  fixes, the tile — is the `polish-widgets` skill; use it rather than