@ekanos/harness 0.18.0 → 0.19.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 (184) hide show
  1. package/dist/api-types.d.ts +490 -0
  2. package/dist/api-types.js +6 -0
  3. package/dist/api.d.ts +33 -0
  4. package/dist/api.js +36 -1
  5. package/dist/app.js +6 -1
  6. package/dist/internal/components/approvals-tray.d.ts +17 -0
  7. package/dist/internal/components/approvals-tray.js +116 -0
  8. package/dist/internal/components/connect-controls.d.ts +12 -0
  9. package/dist/internal/components/connect-controls.js +69 -0
  10. package/dist/internal/components/connect-dialog.d.ts +19 -0
  11. package/dist/internal/components/connect-dialog.js +61 -0
  12. package/dist/internal/components/connect-panel.d.ts +25 -0
  13. package/dist/internal/components/connect-panel.js +292 -0
  14. package/dist/internal/components/connection-chip.d.ts +14 -0
  15. package/dist/internal/components/connection-chip.js +75 -0
  16. package/dist/internal/components/dashboard-grid.js +38 -24
  17. package/dist/internal/components/dev-toolbar.js +176 -103
  18. package/dist/internal/components/events-panel.d.ts +10 -0
  19. package/dist/internal/components/events-panel.js +111 -0
  20. package/dist/internal/components/health-panel.d.ts +4 -0
  21. package/dist/internal/components/health-panel.js +56 -0
  22. package/dist/internal/components/integration-badge.d.ts +29 -0
  23. package/dist/internal/components/integration-badge.js +105 -0
  24. package/dist/internal/components/local-oauth-panel.js +21 -1
  25. package/dist/internal/components/operation-runner-panel.d.ts +12 -0
  26. package/dist/internal/components/operation-runner-panel.js +331 -0
  27. package/dist/internal/components/provenance-banner.d.ts +12 -0
  28. package/dist/internal/components/provenance-banner.js +107 -0
  29. package/dist/internal/components/repo-connection.d.ts +10 -0
  30. package/dist/internal/components/repo-connection.js +32 -0
  31. package/dist/internal/components/run-log.d.ts +9 -0
  32. package/dist/internal/components/run-log.js +228 -0
  33. package/dist/internal/components/runtime-strip.d.ts +12 -0
  34. package/dist/internal/components/runtime-strip.js +158 -0
  35. package/dist/internal/components/schema-form.d.ts +13 -0
  36. package/dist/internal/components/schema-form.js +382 -0
  37. package/dist/internal/components/scrollable-nav.d.ts +12 -0
  38. package/dist/internal/components/scrollable-nav.js +68 -0
  39. package/dist/internal/components/surface-nav.d.ts +31 -1
  40. package/dist/internal/components/surface-nav.js +238 -31
  41. package/dist/internal/components/workflow-runner.d.ts +14 -0
  42. package/dist/internal/components/workflow-runner.js +104 -0
  43. package/dist/internal/lib/bundled-secrets.d.ts +9 -0
  44. package/dist/internal/lib/bundled-secrets.js +24 -0
  45. package/dist/internal/lib/chrome-slot.d.ts +2 -0
  46. package/dist/internal/lib/chrome-slot.js +25 -0
  47. package/dist/internal/lib/connection-facts.d.ts +44 -0
  48. package/dist/internal/lib/connection-facts.js +116 -0
  49. package/dist/internal/lib/console-client.d.ts +55 -0
  50. package/dist/internal/lib/console-client.js +295 -0
  51. package/dist/internal/lib/console-context.d.ts +40 -0
  52. package/dist/internal/lib/console-context.js +67 -0
  53. package/dist/internal/lib/console-hooks.d.ts +33 -0
  54. package/dist/internal/lib/console-hooks.js +118 -0
  55. package/dist/internal/lib/console-types.d.ts +279 -0
  56. package/dist/internal/lib/console-types.js +0 -0
  57. package/dist/internal/lib/experience-runtime.d.ts +8 -0
  58. package/dist/internal/lib/experience-runtime.js +22 -0
  59. package/dist/internal/lib/preview-sections.d.ts +13 -0
  60. package/dist/internal/lib/preview-sections.js +32 -0
  61. package/dist/internal/lib/repo-context.d.ts +20 -0
  62. package/dist/internal/lib/repo-context.js +64 -0
  63. package/dist/internal/lib/run-log-view.d.ts +24 -0
  64. package/dist/internal/lib/run-log-view.js +57 -0
  65. package/dist/internal/lib/schema-form-model.d.ts +34 -0
  66. package/dist/internal/lib/schema-form-model.js +272 -0
  67. package/dist/internal/lib/toolbar-context.d.ts +9 -1
  68. package/dist/internal/lib/toolbar-context.js +13 -3
  69. package/dist/internal/lib/toolbar-visibility.d.ts +16 -0
  70. package/dist/internal/lib/toolbar-visibility.js +31 -0
  71. package/dist/internal/registry-context.d.ts +2 -0
  72. package/dist/internal/registry-context.js +11 -9
  73. package/dist/internal/routes/activation-page.js +44 -20
  74. package/dist/internal/routes/console-home-page.d.ts +5 -0
  75. package/dist/internal/routes/console-home-page.js +18 -0
  76. package/dist/internal/routes/experience-connect-page.d.ts +6 -0
  77. package/dist/internal/routes/experience-connect-page.js +127 -0
  78. package/dist/internal/routes/experience-page-host.d.ts +2 -0
  79. package/dist/internal/routes/experience-page-host.js +18 -0
  80. package/dist/internal/routes/experience-review-queue-page.d.ts +2 -0
  81. package/dist/internal/routes/experience-review-queue-page.js +60 -0
  82. package/dist/internal/routes/experience-runs-page.d.ts +1 -0
  83. package/dist/internal/routes/experience-runs-page.js +13 -0
  84. package/dist/internal/routes/experience-summary-page.d.ts +1 -0
  85. package/dist/internal/routes/experience-summary-page.js +101 -0
  86. package/dist/internal/routes/experience-widget-page.d.ts +1 -0
  87. package/dist/internal/routes/experience-widget-page.js +26 -0
  88. package/dist/internal/routes/experience-widgets-page.d.ts +6 -0
  89. package/dist/internal/routes/experience-widgets-page.js +22 -0
  90. package/dist/internal/routes/experience-workflow-page.d.ts +1 -0
  91. package/dist/internal/routes/experience-workflow-page.js +24 -0
  92. package/dist/internal/routes/experience-workflows-page.d.ts +1 -0
  93. package/dist/internal/routes/experience-workflows-page.js +44 -0
  94. package/dist/internal/routes/index-page.d.ts +10 -9
  95. package/dist/internal/routes/index-page.js +3 -68
  96. package/dist/internal/routes/integration-layout.d.ts +12 -1
  97. package/dist/internal/routes/integration-layout.js +20 -6
  98. package/dist/internal/routes/integrations-connect-page.d.ts +1 -0
  99. package/dist/internal/routes/integrations-connect-page.js +19 -0
  100. package/dist/internal/routes/integrations-events-page.d.ts +1 -0
  101. package/dist/internal/routes/integrations-events-page.js +10 -0
  102. package/dist/internal/routes/integrations-health-page.d.ts +1 -0
  103. package/dist/internal/routes/integrations-health-page.js +10 -0
  104. package/dist/internal/routes/integrations-layout.d.ts +17 -0
  105. package/dist/internal/routes/integrations-layout.js +106 -0
  106. package/dist/internal/routes/integrations-list-page.d.ts +2 -0
  107. package/dist/internal/routes/integrations-list-page.js +94 -0
  108. package/dist/internal/routes/integrations-operation-page.d.ts +1 -0
  109. package/dist/internal/routes/integrations-operation-page.js +29 -0
  110. package/dist/internal/routes/integrations-operations-page.d.ts +1 -0
  111. package/dist/internal/routes/integrations-operations-page.js +61 -0
  112. package/dist/internal/routes/integrations-overview-page.d.ts +1 -0
  113. package/dist/internal/routes/integrations-overview-page.js +90 -0
  114. package/dist/internal/routes/integrations-runs-page.d.ts +1 -0
  115. package/dist/internal/routes/integrations-runs-page.js +14 -0
  116. package/dist/internal/routes/integrations-scope.d.ts +12 -0
  117. package/dist/internal/routes/integrations-scope.js +39 -0
  118. package/dist/internal/routes/legacy-preview-redirect.d.ts +6 -0
  119. package/dist/internal/routes/legacy-preview-redirect.js +12 -0
  120. package/dist/internal/routes/preview-index-page.d.ts +2 -0
  121. package/dist/internal/routes/preview-index-page.js +14 -0
  122. package/dist/internal/routes/repo-connections-page.d.ts +6 -0
  123. package/dist/internal/routes/repo-connections-page.js +8 -0
  124. package/dist/internal/routes/repo-home-page.d.ts +2 -0
  125. package/dist/internal/routes/repo-home-page.js +320 -0
  126. package/dist/internal/routes/repo-layout.d.ts +7 -0
  127. package/dist/internal/routes/repo-layout.js +76 -0
  128. package/dist/internal/routes/repo-package-layouts.d.ts +20 -0
  129. package/dist/internal/routes/repo-package-layouts.js +104 -0
  130. package/dist/internal/routes/root-layout.d.ts +3 -1
  131. package/dist/internal/routes/root-layout.js +13 -3
  132. package/dist/internal/routes/single-widget-page.js +5 -12
  133. package/dist/internal/routes/tile-page.js +20 -41
  134. package/dist/internal/routes/triggers-page.js +55 -62
  135. package/dist/internal/routes/widgets-page.js +1 -1
  136. package/dist/internal/server/api-router.js +46 -4
  137. package/dist/internal/server/approvals.d.ts +44 -0
  138. package/dist/internal/server/approvals.js +76 -0
  139. package/dist/internal/server/contract-sources.d.ts +28 -0
  140. package/dist/internal/server/contract-sources.js +83 -0
  141. package/dist/internal/server/definition-loader.d.ts +22 -0
  142. package/dist/internal/server/definition-loader.js +125 -0
  143. package/dist/internal/server/ekanos-api-router.d.ts +34 -0
  144. package/dist/internal/server/ekanos-api-router.js +835 -0
  145. package/dist/internal/server/experience-loader.d.ts +57 -0
  146. package/dist/internal/server/experience-loader.js +146 -0
  147. package/dist/internal/server/integration-lookup.d.ts +29 -0
  148. package/dist/internal/server/integration-lookup.js +33 -0
  149. package/dist/internal/server/integration-resolver.d.ts +121 -0
  150. package/dist/internal/server/integration-resolver.js +605 -0
  151. package/dist/internal/server/live-invoker.d.ts +11 -0
  152. package/dist/internal/server/live-invoker.js +106 -0
  153. package/dist/internal/server/local-secrets.d.ts +82 -1
  154. package/dist/internal/server/local-secrets.js +112 -1
  155. package/dist/internal/server/local-state.d.ts +12 -0
  156. package/dist/internal/server/local-state.js +45 -0
  157. package/dist/internal/server/oauth-persistence.d.ts +19 -0
  158. package/dist/internal/server/oauth-persistence.js +76 -0
  159. package/dist/internal/server/operation-runner.d.ts +95 -0
  160. package/dist/internal/server/operation-runner.js +231 -0
  161. package/dist/internal/server/project-manifest.d.ts +71 -0
  162. package/dist/internal/server/project-manifest.js +215 -0
  163. package/dist/internal/server/registry-cache.d.ts +68 -0
  164. package/dist/internal/server/registry-cache.js +328 -0
  165. package/dist/internal/server/repo-api-router.d.ts +33 -0
  166. package/dist/internal/server/repo-api-router.js +391 -0
  167. package/dist/internal/server/run-log.d.ts +22 -0
  168. package/dist/internal/server/run-log.js +32 -0
  169. package/dist/internal/server/semantics.d.ts +28 -0
  170. package/dist/internal/server/semantics.js +67 -0
  171. package/dist/internal/server/session-catalog.d.ts +67 -0
  172. package/dist/internal/server/session-catalog.js +18 -0
  173. package/dist/internal/server/workflow-runner.d.ts +36 -0
  174. package/dist/internal/server/workflow-runner.js +183 -0
  175. package/dist/registry.d.ts +7 -0
  176. package/dist/resolver.d.ts +145 -0
  177. package/dist/resolver.js +211 -0
  178. package/dist/routes.d.ts +64 -2
  179. package/dist/routes.js +59 -3
  180. package/dist/runtime.d.ts +46 -0
  181. package/dist/runtime.js +60 -0
  182. package/package.json +23 -9
  183. package/dist/internal/routes/integration-index-page.d.ts +0 -13
  184. package/dist/internal/routes/integration-index-page.js +0 -17
@@ -1,46 +1,47 @@
1
1
  "use client";
2
- import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
3
  import Link from "next/link";
4
4
  import { usePathname } from "next/navigation";
5
5
  import { Icon } from "@ekanos/ui/icon";
6
6
  import { cn } from "@ekanos/ui/utils";
7
+ import { useConsoleLinks } from "../lib/console-context.js";
7
8
  import { SURFACE_DOCS } from "../lib/docs-links.js";
8
- import { HARNESS_SURFACES } from "../surfaces.js";
9
+ import { previewHref, previewSections } from "../lib/preview-sections.js";
9
10
  import { DocsLink } from "./docs-link.js";
10
- function SurfaceNav({
11
+ import { ProvenanceBadge } from "./integration-badge.js";
12
+ import { FOCUS_RING, ScrollableNav } from "./scrollable-nav.js";
13
+ function PreviewNav({
11
14
  integration
12
15
  }) {
13
16
  const pathname = usePathname();
14
- const activeSurface = HARNESS_SURFACES.find(
15
- (surface) => pathname.startsWith(`/${integration.slug}/${surface.segment}`)
17
+ const sections = previewSections(integration);
18
+ const activeSurface = sections.find(
19
+ (surface) => pathname.startsWith(previewHref(integration.slug, surface.segment))
16
20
  );
17
21
  const surfaceDocs = activeSurface ? SURFACE_DOCS[activeSurface.segment] : void 0;
18
- return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-5 border-b px-6 py-5", children: [
19
- /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-baseline gap-3", children: [
20
- /* @__PURE__ */ jsxs(
21
- Link,
22
- {
23
- href: "/",
24
- className: "text-muted-foreground hover:text-foreground text-meta",
25
- children: [
26
- /* @__PURE__ */ jsx(Icon, { name: "fa-solid fa-arrow-left", className: "mr-2 h-4 w-4" }),
27
- "All integrations"
28
- ]
29
- }
30
- ),
31
- /* @__PURE__ */ jsx("h1", { className: "heading-headline", children: integration.name }),
32
- /* @__PURE__ */ jsx("code", { className: "text-muted-foreground text-fine", children: integration.slug })
33
- ] }),
34
- /* @__PURE__ */ jsxs("nav", { className: "flex flex-wrap items-center gap-1", children: [
35
- HARNESS_SURFACES.map((surface) => {
36
- const href = `/${integration.slug}/${surface.segment}`;
22
+ if (sections.length === 0) {
23
+ return /* @__PURE__ */ jsx(
24
+ "p",
25
+ {
26
+ className: "text-muted-foreground text-meta py-6",
27
+ "data-test": "preview-empty",
28
+ children: "This integration registers no widgets, tile, activation form or event surfaces to preview."
29
+ }
30
+ );
31
+ }
32
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", "data-test": "preview-nav", children: [
33
+ /* @__PURE__ */ jsxs(ScrollableNav, { label: "Preview sections", children: [
34
+ sections.map((surface) => {
35
+ const href = previewHref(integration.slug, surface.segment);
37
36
  const active = pathname.startsWith(href);
38
37
  return /* @__PURE__ */ jsxs(
39
38
  Link,
40
39
  {
41
40
  href,
41
+ "aria-current": active ? "page" : void 0,
42
42
  className: cn(
43
- "flex items-center gap-2 rounded-md px-3 py-2 transition-colors",
43
+ "flex items-center gap-2 rounded-md px-3 py-2 whitespace-nowrap transition-colors",
44
+ FOCUS_RING,
44
45
  active ? "bg-accent text-accent-foreground text-label" : "text-muted-foreground hover:bg-accent/50 text-meta"
45
46
  ),
46
47
  children: [
@@ -55,7 +56,7 @@ function SurfaceNav({
55
56
  DocsLink,
56
57
  {
57
58
  href: surfaceDocs,
58
- className: "ml-auto px-3",
59
+ className: "ml-auto px-3 whitespace-nowrap",
59
60
  "data-test": "surface-docs-link",
60
61
  children: [
61
62
  activeSurface.label,
@@ -64,17 +65,18 @@ function SurfaceNav({
64
65
  }
65
66
  ) : null
66
67
  ] }),
67
- integration.widgets.length > 0 ? /* @__PURE__ */ jsxs("nav", { className: "flex flex-wrap gap-1", children: [
68
- /* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-fine px-3 py-2", children: "Focus one widget:" }),
68
+ activeSurface?.segment === "widgets" && integration.widgets.length > 1 ? /* @__PURE__ */ jsxs(ScrollableNav, { label: "Focus one widget", children: [
69
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-fine px-3 py-2 whitespace-nowrap", children: "Focus one widget:" }),
69
70
  integration.widgets.map((widget) => {
70
- const href = `/${integration.slug}/widgets/${widget.id}`;
71
+ const href = previewHref(integration.slug, `widgets/${widget.id}`);
71
72
  const active = pathname === href;
72
73
  return /* @__PURE__ */ jsx(
73
74
  Link,
74
75
  {
75
76
  href,
76
77
  className: cn(
77
- "rounded-md px-3 py-2 transition-colors",
78
+ "rounded-md px-3 py-2 whitespace-nowrap transition-colors",
79
+ FOCUS_RING,
78
80
  active ? "bg-accent text-accent-foreground text-label" : "text-muted-foreground hover:bg-accent/50 text-meta"
79
81
  ),
80
82
  children: widget.title
@@ -85,6 +87,211 @@ function SurfaceNav({
85
87
  ] }) : null
86
88
  ] });
87
89
  }
90
+ function integrationTabs(slug) {
91
+ const base = `/integrations/${slug}`;
92
+ return [
93
+ { href: base, label: "Overview", icon: "fa-solid fa-circle-info" },
94
+ {
95
+ href: `${base}/connect`,
96
+ label: "Connect",
97
+ icon: "fa-solid fa-key",
98
+ prefix: true
99
+ },
100
+ {
101
+ href: `${base}/operations`,
102
+ label: "Operations",
103
+ icon: "fa-solid fa-list",
104
+ prefix: true
105
+ },
106
+ {
107
+ href: `${base}/events`,
108
+ label: "Events",
109
+ icon: "fa-solid fa-bolt",
110
+ prefix: true
111
+ },
112
+ {
113
+ href: `${base}/health`,
114
+ label: "Health",
115
+ icon: "fa-solid fa-heart-pulse",
116
+ prefix: true
117
+ },
118
+ {
119
+ href: `${base}/runs`,
120
+ label: "Run log",
121
+ icon: "fa-solid fa-clock-rotate-left",
122
+ prefix: true
123
+ }
124
+ ];
125
+ }
126
+ function previewTab(slug) {
127
+ return {
128
+ href: previewHref(slug),
129
+ label: "Preview",
130
+ icon: "fa-solid fa-table-cells-large",
131
+ prefix: true,
132
+ testId: "preview-tab"
133
+ };
134
+ }
135
+ function experienceTabs(base = "/experience", repo = false) {
136
+ return [
137
+ { href: base, label: "Summary", icon: "fa-solid fa-table-list" },
138
+ {
139
+ href: `${base}/widgets`,
140
+ label: "Widgets",
141
+ icon: "fa-solid fa-table-cells-large",
142
+ prefix: true
143
+ },
144
+ {
145
+ href: `${base}/workflows`,
146
+ label: "Workflows",
147
+ icon: "fa-solid fa-diagram-project",
148
+ prefix: true
149
+ },
150
+ {
151
+ href: `${base}/review-queue`,
152
+ label: "Review queue",
153
+ icon: "fa-solid fa-inbox",
154
+ prefix: true
155
+ },
156
+ {
157
+ href: `${base}/runs`,
158
+ label: "Run log",
159
+ icon: "fa-solid fa-clock-rotate-left",
160
+ prefix: true
161
+ },
162
+ ...repo ? [
163
+ {
164
+ href: `${base}/connect`,
165
+ label: "Connect",
166
+ icon: "fa-solid fa-plug",
167
+ prefix: true
168
+ }
169
+ ] : []
170
+ ];
171
+ }
172
+ const EXPERIENCE_TABS = experienceTabs();
173
+ function tabActive(pathname, tab) {
174
+ return tab.prefix ? pathname === tab.href || pathname.startsWith(`${tab.href}/`) : pathname === tab.href;
175
+ }
176
+ function TabLink({ tab, pathname }) {
177
+ return /* @__PURE__ */ jsxs(
178
+ Link,
179
+ {
180
+ href: tab.href,
181
+ "aria-current": tabActive(pathname, tab) ? "page" : void 0,
182
+ ...tab.testId ? { "data-test": tab.testId } : {},
183
+ className: cn(
184
+ "flex items-center gap-2 rounded-md px-3 py-2 whitespace-nowrap transition-colors",
185
+ FOCUS_RING,
186
+ tabActive(pathname, tab) ? "bg-accent text-accent-foreground text-label" : "text-muted-foreground hover:bg-accent/50 text-meta"
187
+ ),
188
+ children: [
189
+ /* @__PURE__ */ jsx(Icon, { name: tab.icon, className: "h-4 w-4" }),
190
+ tab.label
191
+ ]
192
+ }
193
+ );
194
+ }
195
+ function IntegrationTab({
196
+ integration,
197
+ pathname
198
+ }) {
199
+ const href = `/integrations/${integration.integration}`;
200
+ const active = pathname === href || pathname.startsWith(`${href}/`);
201
+ return /* @__PURE__ */ jsxs(
202
+ Link,
203
+ {
204
+ href,
205
+ "aria-current": active ? "page" : void 0,
206
+ "data-test": `integration-tab-${integration.integration}`,
207
+ className: cn(
208
+ "flex items-center gap-2 rounded-md px-3 py-2 whitespace-nowrap transition-colors",
209
+ FOCUS_RING,
210
+ active ? "bg-accent text-accent-foreground text-label" : "text-muted-foreground hover:bg-accent/50 text-meta"
211
+ ),
212
+ children: [
213
+ integration.integration,
214
+ /* @__PURE__ */ jsx(ProvenanceBadge, { provenance: integration.provenance })
215
+ ]
216
+ }
217
+ );
218
+ }
219
+ function ConsoleNav({
220
+ project,
221
+ pendingApprovals = 0
222
+ }) {
223
+ const pathname = usePathname();
224
+ const links = useConsoleLinks();
225
+ const own = project.integrations[0];
226
+ return /* @__PURE__ */ jsxs(
227
+ "div",
228
+ {
229
+ className: "flex flex-col gap-3 border-b px-4 py-4 sm:px-6",
230
+ "data-test": "console-nav",
231
+ children: [
232
+ links.repoHome ? /* @__PURE__ */ jsxs(
233
+ Link,
234
+ {
235
+ href: links.repoHome,
236
+ className: "text-muted-foreground hover:text-foreground text-meta w-fit",
237
+ "data-test": "back-to-repo",
238
+ children: [
239
+ /* @__PURE__ */ jsx(Icon, { name: "fa-solid fa-arrow-left", className: "mr-2 h-4 w-4" }),
240
+ "This repo"
241
+ ]
242
+ }
243
+ ) : null,
244
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-baseline gap-3", children: [
245
+ /* @__PURE__ */ jsx("h1", { className: "heading-headline", children: project.name }),
246
+ /* @__PURE__ */ jsx(
247
+ "code",
248
+ {
249
+ className: "text-muted-foreground text-fine",
250
+ "data-test": "project-kind",
251
+ children: project.kind
252
+ }
253
+ ),
254
+ pendingApprovals > 0 ? /* @__PURE__ */ jsxs(
255
+ Link,
256
+ {
257
+ href: project.kind === "experience" ? `${links.experience}/workflows` : "#approvals",
258
+ className: "bg-warning text-warning-foreground text-label ml-auto rounded-full px-3 py-1",
259
+ "data-test": "pending-approvals",
260
+ children: [
261
+ pendingApprovals,
262
+ " awaiting approval"
263
+ ]
264
+ }
265
+ ) : null
266
+ ] }),
267
+ project.kind === "integration" ? own ? /* @__PURE__ */ jsxs(ScrollableNav, { label: "Integration console", children: [
268
+ integrationTabs(own.integration).map((tab) => /* @__PURE__ */ jsx(TabLink, { tab, pathname }, tab.href)),
269
+ project.legacySurfaces ? /* @__PURE__ */ jsx(TabLink, { tab: previewTab(own.integration), pathname }) : null
270
+ ] }) : null : /* @__PURE__ */ jsxs(Fragment, { children: [
271
+ /* @__PURE__ */ jsx(ScrollableNav, { label: "Experience", children: experienceTabs(links.experience, links.repoHome !== null).map(
272
+ (tab) => /* @__PURE__ */ jsx(TabLink, { tab, pathname }, tab.href)
273
+ ) }),
274
+ /* @__PURE__ */ jsxs(ScrollableNav, { label: "Integration consoles", className: "items-center", children: [
275
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-fine px-1 whitespace-nowrap", children: "Integrations:" }),
276
+ project.integrations.map((integration) => /* @__PURE__ */ jsx(
277
+ IntegrationTab,
278
+ {
279
+ integration,
280
+ pathname
281
+ },
282
+ integration.integration
283
+ ))
284
+ ] })
285
+ ] })
286
+ ]
287
+ }
288
+ );
289
+ }
88
290
  export {
89
- SurfaceNav
291
+ ConsoleNav,
292
+ EXPERIENCE_TABS,
293
+ PreviewNav,
294
+ experienceTabs,
295
+ integrationTabs,
296
+ previewTab
90
297
  };
@@ -0,0 +1,14 @@
1
+ import type { WorkflowStepDefinition, WorkflowTemplateSummary } from '../lib/console-types.js';
2
+ /** The step types the harness executes; everything else is listed, not run. */
3
+ export declare const SIMULATED_STEP_TYPES: readonly ['fusion_tool', 'approval_gate', 'ai_step'];
4
+ export declare function isSimulated(step: WorkflowStepDefinition): boolean;
5
+ /**
6
+ * A workflow template as a step list with a runner. `fusion_tool` steps run
7
+ * through the operation runner on the workflow channel; `approval_gate` and
8
+ * any write wait in the approvals tray (the run request stays open until they
9
+ * are decided); `ai_step` answers from its fixture; unsupported step types
10
+ * are listed as not simulated.
11
+ */
12
+ export declare function WorkflowRunner({ template, }: {
13
+ template: WorkflowTemplateSummary;
14
+ }): import("react").JSX.Element;
@@ -0,0 +1,104 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { Alert, AlertDescription } from "@ekanos/ui/alert";
4
+ import { Button } from "@ekanos/ui/button";
5
+ import { Card } from "@ekanos/ui/card";
6
+ import { StatusBadge } from "@ekanos/ui/status-badge";
7
+ import { useApprovals, useConsoleMutation } from "../lib/console-hooks.js";
8
+ const SIMULATED_STEP_TYPES = [
9
+ "fusion_tool",
10
+ "approval_gate",
11
+ "ai_step"
12
+ ];
13
+ function isSimulated(step) {
14
+ return SIMULATED_STEP_TYPES.includes(step.type);
15
+ }
16
+ const TONES = {
17
+ pending: "neutral",
18
+ running: "info",
19
+ done: "success",
20
+ rejected: "destructive",
21
+ failed: "destructive",
22
+ not_simulated: "neutral"
23
+ };
24
+ const LABELS = {
25
+ pending: "pending",
26
+ running: "running",
27
+ done: "done",
28
+ rejected: "rejected",
29
+ failed: "failed",
30
+ not_simulated: "not simulated"
31
+ };
32
+ function WorkflowRunner({
33
+ template
34
+ }) {
35
+ const start = useConsoleMutation((c, id) => c.startWorkflow(id));
36
+ const approvals = useApprovals();
37
+ const waiting = start.isPending ? approvals.data?.length ?? 0 : 0;
38
+ const run = start.data;
39
+ return /* @__PURE__ */ jsxs("section", { className: "flex flex-col gap-4", "data-test": "workflow-runner", children: [
40
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-3", children: [
41
+ /* @__PURE__ */ jsx(
42
+ Button,
43
+ {
44
+ type: "button",
45
+ disabled: start.isPending,
46
+ "data-test": "workflow-run",
47
+ onClick: () => start.mutate(template.id),
48
+ children: start.isPending ? "Running\u2026" : run ? "Run again" : "Run now"
49
+ }
50
+ ),
51
+ run?.completed ? /* @__PURE__ */ jsx(StatusBadge, { tone: "success", children: "finished" }) : null,
52
+ waiting > 0 ? /* @__PURE__ */ jsxs(StatusBadge, { tone: "warning", children: [
53
+ waiting,
54
+ " approval",
55
+ waiting === 1 ? "" : "s",
56
+ " waiting in the tray above"
57
+ ] }) : null
58
+ ] }),
59
+ start.isError ? /* @__PURE__ */ jsx(Alert, { variant: "destructive", children: /* @__PURE__ */ jsx(AlertDescription, { children: start.error.message }) }) : null,
60
+ /* @__PURE__ */ jsx("ol", { className: "flex flex-col gap-3", children: template.steps.map((step, index) => {
61
+ const state = start.isPending ? void 0 : run?.steps.find((entry) => entry.id === step.id);
62
+ const status = !isSimulated(step) ? "not_simulated" : start.isPending ? "running" : state?.status ?? "pending";
63
+ return /* @__PURE__ */ jsxs(
64
+ Card,
65
+ {
66
+ layout: "bleed",
67
+ render: /* @__PURE__ */ jsx("li", {}),
68
+ className: "flex flex-col gap-2 p-4",
69
+ "data-test": "workflow-step",
70
+ "data-step-id": step.id,
71
+ "data-status": status,
72
+ children: [
73
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
74
+ /* @__PURE__ */ jsx("span", { className: "text-muted-foreground text-fine", children: index + 1 }),
75
+ /* @__PURE__ */ jsx("span", { className: "text-label", children: step.label }),
76
+ /* @__PURE__ */ jsx("code", { className: "text-muted-foreground text-fine", children: step.type }),
77
+ step.integration && step.opKey ? /* @__PURE__ */ jsxs("code", { className: "text-fine", children: [
78
+ step.integration,
79
+ ":",
80
+ step.opKey
81
+ ] }) : null,
82
+ /* @__PURE__ */ jsx(StatusBadge, { tone: TONES[status], children: LABELS[status] })
83
+ ] }),
84
+ state?.detail ? /* @__PURE__ */ jsx(
85
+ "p",
86
+ {
87
+ className: status === "failed" || status === "rejected" ? "text-destructive-strong text-fine" : "text-muted-foreground text-fine",
88
+ role: status === "failed" ? "alert" : void 0,
89
+ children: state.detail
90
+ }
91
+ ) : null,
92
+ state?.output !== void 0 ? /* @__PURE__ */ jsx("pre", { className: "bg-muted text-fine max-h-48 overflow-auto rounded-md p-2", children: JSON.stringify(state.output, null, 2) }) : null
93
+ ]
94
+ },
95
+ step.id
96
+ );
97
+ }) })
98
+ ] });
99
+ }
100
+ export {
101
+ SIMULATED_STEP_TYPES,
102
+ WorkflowRunner,
103
+ isSimulated
104
+ };
@@ -0,0 +1,9 @@
1
+ import type { HarnessIntegration } from '../../registry.js';
2
+ export declare function looksLikePlaceholder(value: string): boolean;
3
+ export interface BundledSecretFinding {
4
+ slug: string;
5
+ /** Secret NAMES whose value does not look like a placeholder. Never the values. */
6
+ keys: string[];
7
+ }
8
+ export declare function findBundledSecrets(integrations: readonly Pick<HarnessIntegration, 'slug' | 'triggerMocks'>[]): BundledSecretFinding[];
9
+ export declare function bundledSecretsWarning(findings: readonly BundledSecretFinding[]): string | null;
@@ -0,0 +1,24 @@
1
+ const PLACEHOLDER = /fake|fixture|mock|dummy|placeholder|not[-_ ]?real|example|sample|redacted|xxx|0{6,}|(^|[^a-z])test([^a-z]|$)|^(secret|token|key|password|changeme)$/i;
2
+ function looksLikePlaceholder(value) {
3
+ return value.trim() === "" || PLACEHOLDER.test(value);
4
+ }
5
+ function findBundledSecrets(integrations) {
6
+ return integrations.flatMap((integration) => {
7
+ const secrets = integration.triggerMocks?.secrets;
8
+ const keys = [
9
+ ...Object.entries(secrets?.account ?? {}),
10
+ ...Object.entries(secrets?.admin ?? {})
11
+ ].filter(([, value]) => !looksLikePlaceholder(value)).map(([key]) => key);
12
+ return keys.length > 0 ? [{ slug: integration.slug, keys }] : [];
13
+ });
14
+ }
15
+ function bundledSecretsWarning(findings) {
16
+ if (findings.length === 0) return null;
17
+ const named = findings.map((finding) => `${finding.slug} (${finding.keys.join(", ")})`).join("; ");
18
+ return `[harness] triggerMocks.secrets for ${named} do not look like placeholders. Every registry entry is compiled into the browser bundle and written into the .next build output, so a real credential here is exposed. Use fake values, and store real ones from the Connect tab (.ekanos/local-secrets.json, server side only).`;
19
+ }
20
+ export {
21
+ bundledSecretsWarning,
22
+ findBundledSecrets,
23
+ looksLikePlaceholder
24
+ };
@@ -0,0 +1,2 @@
1
+ export declare function setChromeSlot(element: HTMLElement | null): void;
2
+ export declare function useChromeSlot(): HTMLElement | null;
@@ -0,0 +1,25 @@
1
+ import { useSyncExternalStore } from "react";
2
+ let integration = null;
3
+ const listeners = /* @__PURE__ */ new Set();
4
+ function setChromeSlot(element) {
5
+ if (integration === element) return;
6
+ integration = element;
7
+ listeners.forEach((listener) => listener());
8
+ }
9
+ function subscribe(listener) {
10
+ listeners.add(listener);
11
+ return () => {
12
+ listeners.delete(listener);
13
+ };
14
+ }
15
+ function useChromeSlot() {
16
+ return useSyncExternalStore(
17
+ subscribe,
18
+ () => integration,
19
+ () => null
20
+ );
21
+ }
22
+ export {
23
+ setChromeSlot,
24
+ useChromeSlot
25
+ };
@@ -0,0 +1,44 @@
1
+ import type { ConnectionFactState, ConnectionKind, ConnectionTargetField, IntegrationConnectionFacts, RunMode } from '../../api-types.js';
2
+ /**
3
+ * The one place connection status is decided. Both the package router (for the
4
+ * runtime strip, the Connect tab, the runner) and the repo router (home, the
5
+ * checklist) call it, so no screen can disagree with another.
6
+ *
7
+ * It accounts for the contract's auth, keys the code declares, and OAuth.
8
+ */
9
+ export interface ConnectionFactsInput {
10
+ /** `connection.auth` from the contract: `none`, `api_key` or `oauth2`. */
11
+ contractAuth: string;
12
+ /** The integration's code declares an OAuth loop. */
13
+ usesOauth: boolean;
14
+ /** Secret names the code declares. */
15
+ declared: readonly string[];
16
+ missing: readonly string[];
17
+ activationFieldsSet: readonly string[];
18
+ /** An OAuth connection is held in this process or stored locally. */
19
+ oauthHeld: boolean;
20
+ /** False for a registry integration: Ekanos holds its connection. */
21
+ manageable: boolean;
22
+ target: ConnectionTargetField[];
23
+ /** The integration has code to run live. */
24
+ supportsLive: boolean;
25
+ forced: boolean;
26
+ /** What an unconnected call answers from. */
27
+ defaultMode: RunMode;
28
+ /** The credentials could not be read. */
29
+ unreadable?: string;
30
+ }
31
+ export declare function deriveConnectionFacts(input: ConnectionFactsInput): IntegrationConnectionFacts;
32
+ export declare const CONNECTION_STATE_LABEL: Record<ConnectionFactState, string>;
33
+ export declare const CONNECTION_KIND_LABEL: Record<ConnectionKind, string>;
34
+ /** Nothing is left to connect. */
35
+ export declare function isReady(facts: IntegrationConnectionFacts | null): boolean;
36
+ /** Whether the integration has credentials the dev can enter or edit. */
37
+ export declare function isConnectable(facts: IntegrationConnectionFacts | null): boolean;
38
+ export declare function answerLabel(facts: IntegrationConnectionFacts): string;
39
+ /** The quiet second line beside an answer. */
40
+ export declare function answerNote(facts: IntegrationConnectionFacts): string | null;
41
+ /** What the stored local credentials are, in one line of words. */
42
+ export declare function targetLine(facts: IntegrationConnectionFacts): string | null;
43
+ /** `abs` shown relative to `root` when it lies inside it. */
44
+ export declare function relativePath(abs: string, root: string | undefined): string;
@@ -0,0 +1,116 @@
1
+ function kindOf(input) {
2
+ if (input.usesOauth || input.contractAuth === "oauth2") return "oauth";
3
+ if (input.declared.length > 0 || input.contractAuth === "api_key") {
4
+ return "keys";
5
+ }
6
+ return "none";
7
+ }
8
+ function stateOf(input, kind) {
9
+ if (input.unreadable !== void 0) {
10
+ return { state: "unreadable", detail: input.unreadable };
11
+ }
12
+ if (!input.manageable) return { state: "managed" };
13
+ if (kind === "none") return { state: "no_connection_needed" };
14
+ if (kind === "keys") {
15
+ const connected = input.declared.length > 0 ? input.missing.length === 0 : input.activationFieldsSet.length > 0;
16
+ return connected ? { state: "connected" } : {
17
+ state: "not_connected",
18
+ ...input.missing.length > 0 ? { detail: `Missing ${input.missing.join(", ")}` } : {}
19
+ };
20
+ }
21
+ if (input.missing.length > 0) {
22
+ return {
23
+ state: "not_connected",
24
+ detail: `Save the app keys first: ${input.missing.join(", ")}`
25
+ };
26
+ }
27
+ return { state: input.oauthHeld ? "connected" : "not_connected" };
28
+ }
29
+ function deriveConnectionFacts(input) {
30
+ const kind = kindOf(input);
31
+ const { state, detail } = stateOf(input, kind);
32
+ const usable = state === "connected" || state === "no_connection_needed";
33
+ let answers;
34
+ let answersWhy;
35
+ if (!input.supportsLive) {
36
+ answers = "fixtures";
37
+ answersWhy = "fixtures_only";
38
+ } else if (input.forced) {
39
+ answers = "fixtures";
40
+ answersWhy = "forced_fixtures";
41
+ } else if (usable) {
42
+ answers = "live";
43
+ answersWhy = state === "connected" ? "connected" : "no_connection_needed";
44
+ } else {
45
+ answers = input.defaultMode;
46
+ answersWhy = input.defaultMode === "live" ? "configured" : "not_connected";
47
+ }
48
+ return {
49
+ kind,
50
+ state,
51
+ ...detail ? { detail } : {},
52
+ target: state === "connected" ? input.target : [],
53
+ supportsLive: input.supportsLive,
54
+ answers,
55
+ answersWhy,
56
+ forced: input.forced
57
+ };
58
+ }
59
+ const CONNECTION_STATE_LABEL = {
60
+ connected: "Connected",
61
+ not_connected: "Not connected",
62
+ no_connection_needed: "No connection needed",
63
+ managed: "Managed by Ekanos",
64
+ unreadable: "Unreadable"
65
+ };
66
+ const CONNECTION_KIND_LABEL = {
67
+ none: "Nothing to connect",
68
+ keys: "API keys",
69
+ oauth: "OAuth"
70
+ };
71
+ function isReady(facts) {
72
+ return facts?.state === "connected" || facts?.state === "no_connection_needed" || facts?.state === "managed";
73
+ }
74
+ function isConnectable(facts) {
75
+ return facts !== null && facts.kind !== "none" && facts.state !== "managed" && facts.state !== "unreadable";
76
+ }
77
+ function answerLabel(facts) {
78
+ if (facts.forced) return "Fixtures \xB7 pinned";
79
+ return facts.answers === "live" ? "Live" : "Fixtures";
80
+ }
81
+ function answerNote(facts) {
82
+ switch (facts.answersWhy) {
83
+ case "forced_fixtures":
84
+ return "Saved for this repo";
85
+ case "no_connection_needed":
86
+ return "No connection needed";
87
+ case "not_connected":
88
+ return "Not connected";
89
+ case "fixtures_only":
90
+ return facts.state === "managed" ? "Managed by Ekanos" : null;
91
+ default:
92
+ return null;
93
+ }
94
+ }
95
+ function targetLine(facts) {
96
+ if (facts.state !== "connected") return null;
97
+ const fields = facts.target.map((field) => `${field.label} ${field.value}`);
98
+ if (fields.length > 0) return fields.join(" \xB7 ");
99
+ return facts.kind === "oauth" ? "OAuth" : "API keys";
100
+ }
101
+ function relativePath(abs, root) {
102
+ if (!root) return abs;
103
+ const base = root.endsWith("/") ? root : `${root}/`;
104
+ return abs.startsWith(base) ? abs.slice(base.length) : abs;
105
+ }
106
+ export {
107
+ CONNECTION_KIND_LABEL,
108
+ CONNECTION_STATE_LABEL,
109
+ answerLabel,
110
+ answerNote,
111
+ deriveConnectionFacts,
112
+ isConnectable,
113
+ isReady,
114
+ relativePath,
115
+ targetLine
116
+ };