@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
@@ -0,0 +1,75 @@
1
+ "use client";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import { StatusBadge } from "@ekanos/ui/status-badge";
4
+ import {
5
+ CONNECTION_STATE_LABEL,
6
+ answerLabel,
7
+ answerNote,
8
+ targetLine
9
+ } from "../lib/connection-facts.js";
10
+ const STATE_TONE = {
11
+ connected: "success",
12
+ not_connected: "warning",
13
+ no_connection_needed: "neutral",
14
+ managed: "neutral",
15
+ unreadable: "destructive"
16
+ };
17
+ function ConnectionChip({
18
+ facts,
19
+ variant = "status",
20
+ showTarget = true
21
+ }) {
22
+ if (!facts) {
23
+ return /* @__PURE__ */ jsx(StatusBadge, { tone: "destructive", "data-test": "connection-status", children: "Unreadable" });
24
+ }
25
+ const target = showTarget ? targetLine(facts) : null;
26
+ if (variant === "answer") {
27
+ const note = answerNote(facts);
28
+ const text = [note, target ? `local credentials \xB7 ${target}` : null].filter(Boolean).join(" \xB7 ");
29
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
30
+ /* @__PURE__ */ jsx(
31
+ StatusBadge,
32
+ {
33
+ tone: facts.answers === "live" ? "success" : "neutral",
34
+ "data-test": "connection-answer",
35
+ "data-answer": facts.answers,
36
+ "data-why": facts.answersWhy,
37
+ children: answerLabel(facts)
38
+ }
39
+ ),
40
+ text ? /* @__PURE__ */ jsx(
41
+ "span",
42
+ {
43
+ className: "text-muted-foreground text-fine",
44
+ "data-test": "connection-answer-note",
45
+ children: text
46
+ }
47
+ ) : null
48
+ ] });
49
+ }
50
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
51
+ /* @__PURE__ */ jsx(
52
+ StatusBadge,
53
+ {
54
+ tone: STATE_TONE[facts.state],
55
+ "data-test": "connection-status",
56
+ "data-status": facts.state,
57
+ children: CONNECTION_STATE_LABEL[facts.state]
58
+ }
59
+ ),
60
+ target ? /* @__PURE__ */ jsxs(
61
+ "span",
62
+ {
63
+ className: "text-muted-foreground text-fine",
64
+ "data-test": "connection-target",
65
+ children: [
66
+ "local credentials \xB7 ",
67
+ target
68
+ ]
69
+ }
70
+ ) : null
71
+ ] });
72
+ }
73
+ export {
74
+ ConnectionChip
75
+ };
@@ -60,30 +60,44 @@ function WidgetRenderer({
60
60
  }) {
61
61
  const Component = widget.component;
62
62
  const state = stateOverride ?? widget.widgetState;
63
- return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(
64
- HarnessWidgetProvider,
65
- {
66
- widgetId: widget.id,
67
- title: widget.name,
68
- state,
69
- isEnabled: state === "active",
70
- isCollapsible: widget.isCollapsible ?? false,
71
- isPinnable: widget.isPinnable ?? false,
72
- defaultCollapsed: collapsedOverride ?? widget.collapsed ?? false,
73
- defaultPinned: widget.isPinned ?? false,
74
- maxContentHeight: getMaxContentHeight(widget),
75
- aiFooterEnabled: widget.aiFooterEnabled,
76
- health: widget.health,
77
- children: /* @__PURE__ */ jsx(WidgetBoundary, { widgetId: widget.id, resetKey: `${state}-${resetKey}`, children: /* @__PURE__ */ jsx(
78
- Component,
79
- {
80
- accountId,
81
- productId: widget.integrationMetadata?.productId ?? "fusion"
82
- }
83
- ) })
84
- },
85
- `${state}-${String(collapsedOverride)}-${resetKey ?? ""}`
86
- ) });
63
+ return /* @__PURE__ */ jsxs("div", { children: [
64
+ state === "inactive" ? /* @__PURE__ */ jsxs(
65
+ "p",
66
+ {
67
+ className: "text-muted-foreground text-fine mb-1",
68
+ "data-test": "widget-state-label",
69
+ children: [
70
+ "Inactive (preview): ",
71
+ widget.name,
72
+ " is not switched on for this account."
73
+ ]
74
+ }
75
+ ) : null,
76
+ /* @__PURE__ */ jsx(
77
+ HarnessWidgetProvider,
78
+ {
79
+ widgetId: widget.id,
80
+ title: widget.name,
81
+ state,
82
+ isEnabled: state === "active",
83
+ isCollapsible: widget.isCollapsible ?? false,
84
+ isPinnable: widget.isPinnable ?? false,
85
+ defaultCollapsed: collapsedOverride ?? widget.collapsed ?? false,
86
+ defaultPinned: widget.isPinned ?? false,
87
+ maxContentHeight: getMaxContentHeight(widget),
88
+ aiFooterEnabled: widget.aiFooterEnabled,
89
+ health: widget.health,
90
+ children: /* @__PURE__ */ jsx(WidgetBoundary, { widgetId: widget.id, resetKey: `${state}-${resetKey}`, children: /* @__PURE__ */ jsx(
91
+ Component,
92
+ {
93
+ accountId,
94
+ productId: widget.integrationMetadata?.productId ?? "fusion"
95
+ }
96
+ ) })
97
+ },
98
+ `${state}-${String(collapsedOverride)}-${resetKey ?? ""}`
99
+ )
100
+ ] });
87
101
  }
88
102
  function getMaxContentHeight(widget) {
89
103
  const maxHeight = widget.layouts?.lg?.maxHeight;
@@ -1,5 +1,6 @@
1
1
  "use client";
2
- import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import { useState } from "react";
3
4
  import { usePathname } from "next/navigation";
4
5
  import { Button } from "@ekanos/ui/button";
5
6
  import { Icon } from "@ekanos/ui/icon";
@@ -22,15 +23,19 @@ import {
22
23
  resolveEgress,
23
24
  supportsLiveMode
24
25
  } from "../../registry.js";
26
+ import { setChromeSlot } from "../lib/chrome-slot.js";
25
27
  import { HARNESS_DOCS_URL } from "../lib/docs-links.js";
26
28
  import { getThemeToggleAccessibleLabel } from "../lib/theme-toggle.js";
27
29
  import {
28
30
  RENDER_STATES,
29
31
  VIEWPORTS,
32
+ useRepoMode,
30
33
  useToolbar
31
34
  } from "../lib/toolbar-context.js";
35
+ import { toolbarControlsFor } from "../lib/toolbar-visibility.js";
32
36
  import { useHarnessRegistry } from "../registry-context.js";
33
37
  import { DocsLink } from "./docs-link.js";
38
+ import { FOCUS_RING } from "./scrollable-nav.js";
34
39
  function Field({
35
40
  label,
36
41
  children
@@ -52,123 +57,191 @@ function useCurrentIntegration() {
52
57
  }
53
58
  function DevToolbar() {
54
59
  const { state, setState, reset } = useToolbar();
60
+ const repo = useRepoMode();
55
61
  const { resolvedTheme, setTheme } = useTheme();
56
62
  const integration = useCurrentIntegration();
57
63
  const liveAvailable = supportsLiveMode(integration);
58
64
  const effectiveMode = resolveEffectiveDataMode(integration, state.dataMode);
59
65
  const live = liveAvailable && effectiveMode === "live";
60
- return /* @__PURE__ */ jsx("div", { className: "bg-card sticky top-0 z-40 border-b", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-end gap-5 px-6 py-3", children: [
61
- /* @__PURE__ */ jsx(Field, { label: "Render state", children: /* @__PURE__ */ jsxs(
62
- Select,
63
- {
64
- value: state.renderState,
65
- onValueChange: (value) => setState({ renderState: value }),
66
- children: [
67
- /* @__PURE__ */ jsx(SelectTrigger, { className: "w-36", "data-test": "toolbar-render-state", children: /* @__PURE__ */ jsx(SelectValue, {}) }),
68
- /* @__PURE__ */ jsx(SelectContent, { children: RENDER_STATES.map((value) => /* @__PURE__ */ jsx(SelectItem, { value, children: value }, value)) })
69
- ]
70
- }
71
- ) }),
72
- /* @__PURE__ */ jsx(Field, { label: "Data", children: /* @__PURE__ */ jsxs(
73
- Select,
74
- {
75
- value: effectiveMode,
76
- onValueChange: (value) => setState({ dataMode: value }),
77
- disabled: !liveAvailable,
78
- children: [
79
- /* @__PURE__ */ jsx(SelectTrigger, { className: "w-32", "data-test": "toolbar-data-mode", children: /* @__PURE__ */ jsx(SelectValue, {}) }),
80
- /* @__PURE__ */ jsx(SelectContent, { children: DATA_MODES.map((value) => /* @__PURE__ */ jsx(SelectItem, { value, children: DATA_MODE_LABELS[value] }, value)) })
81
- ]
82
- }
83
- ) }),
84
- /* @__PURE__ */ jsx(Field, { label: "Fixtures", children: /* @__PURE__ */ jsxs(
85
- Select,
86
- {
87
- value: state.variant,
88
- onValueChange: (value) => setState({ variant: value }),
89
- disabled: live,
90
- children: [
91
- /* @__PURE__ */ jsx(SelectTrigger, { className: "w-32", "data-test": "toolbar-variant", children: /* @__PURE__ */ jsx(SelectValue, {}) }),
92
- /* @__PURE__ */ jsx(SelectContent, { children: FIXTURE_VARIANTS.map((value) => /* @__PURE__ */ jsx(SelectItem, { value, children: value }, value)) })
93
- ]
94
- }
95
- ) }),
96
- /* @__PURE__ */ jsx(Field, { label: "Viewport", children: /* @__PURE__ */ jsx("div", { className: "flex gap-1", children: Object.keys(VIEWPORTS).map((key) => /* @__PURE__ */ jsx(
97
- Button,
98
- {
99
- size: "sm",
100
- variant: state.viewport === key ? "default" : "outline",
101
- onClick: () => setState({ viewport: key }),
102
- children: VIEWPORTS[key].label
103
- },
104
- key
105
- )) }) }),
106
- /* @__PURE__ */ jsx(Field, { label: "Collapsed", children: /* @__PURE__ */ jsx(
107
- Switch,
108
- {
109
- checked: state.collapsed,
110
- onCheckedChange: (checked) => setState({ collapsed: checked }),
111
- "aria-label": "Toggle collapsed"
112
- }
113
- ) }),
114
- /* @__PURE__ */ jsx(Field, { label: "Unhealthy", children: /* @__PURE__ */ jsx(
115
- Switch,
116
- {
117
- checked: state.unhealthy,
118
- onCheckedChange: (checked) => setState({ unhealthy: checked }),
119
- "aria-label": "Simulate unhealthy integration"
120
- }
121
- ) }),
122
- /* @__PURE__ */ jsxs("div", { className: "ml-auto flex items-center gap-2", children: [
123
- /* @__PURE__ */ jsx(DocsLink, { href: HARNESS_DOCS_URL, "data-test": "toolbar-docs-link", children: "Docs" }),
124
- live ? /* @__PURE__ */ jsxs(
125
- "span",
126
- {
127
- className: "text-primary text-label flex items-center gap-2",
128
- "data-test": "toolbar-live-badge",
129
- children: [
130
- /* @__PURE__ */ jsx(Icon, { name: "fa-solid fa-tower-broadcast", className: "h-4 w-4" }),
131
- "Reaching ",
132
- resolveEgress(integration).join(", ")
133
- ]
134
- }
135
- ) : null,
136
- /* @__PURE__ */ jsxs(
137
- Button,
138
- {
139
- size: "sm",
140
- variant: "outline",
141
- onClick: () => setTheme(resolvedTheme === "dark" ? "light" : "dark"),
142
- "aria-label": getThemeToggleAccessibleLabel(resolvedTheme),
143
- children: [
144
- /* @__PURE__ */ jsxs(
66
+ const pathname = usePathname();
67
+ const controls = toolbarControlsFor(pathname);
68
+ const hasControls = controls.widget || controls.data;
69
+ const [open, setOpen] = useState(false);
70
+ return /* @__PURE__ */ jsxs(
71
+ "div",
72
+ {
73
+ className: "bg-card z-40 border-b md:sticky md:top-0",
74
+ "data-test": "sticky-chrome",
75
+ children: [
76
+ /* @__PURE__ */ jsx("div", { ref: setChromeSlot, "data-test": "chrome-slot" }),
77
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-end gap-3 px-4 py-3 sm:px-6 md:gap-5", children: [
78
+ hasControls ? /* @__PURE__ */ jsx(
79
+ Button,
80
+ {
81
+ type: "button",
82
+ size: "sm",
83
+ variant: "outline",
84
+ className: "md:hidden",
85
+ "aria-expanded": open,
86
+ "aria-controls": "toolbar-controls",
87
+ onClick: () => setOpen((value) => !value),
88
+ "data-test": "toolbar-controls-toggle",
89
+ children: open ? "Hide controls" : "Preview controls"
90
+ }
91
+ ) : null,
92
+ hasControls ? /* @__PURE__ */ jsxs(
93
+ "div",
94
+ {
95
+ id: "toolbar-controls",
96
+ className: cn(
97
+ "order-last w-full flex-wrap items-end gap-5 md:order-none md:flex md:w-auto",
98
+ open ? "flex" : "hidden"
99
+ ),
100
+ "data-test": "toolbar-controls",
101
+ children: [
102
+ controls.widget ? /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(Field, { label: "Render state", children: /* @__PURE__ */ jsxs(
103
+ Select,
104
+ {
105
+ value: state.renderState,
106
+ onValueChange: (value) => setState({
107
+ renderState: value
108
+ }),
109
+ children: [
110
+ /* @__PURE__ */ jsx(
111
+ SelectTrigger,
112
+ {
113
+ className: "w-36",
114
+ "data-test": "toolbar-render-state",
115
+ children: /* @__PURE__ */ jsx(SelectValue, {})
116
+ }
117
+ ),
118
+ /* @__PURE__ */ jsx(SelectContent, { children: RENDER_STATES.map((value) => /* @__PURE__ */ jsx(SelectItem, { value, children: value }, value)) })
119
+ ]
120
+ }
121
+ ) }) }) : null,
122
+ controls.data ? /* @__PURE__ */ jsx(Fragment, { children: repo ? null : /* @__PURE__ */ jsx(Field, { label: "Data", children: /* @__PURE__ */ jsxs(
123
+ Select,
124
+ {
125
+ value: effectiveMode,
126
+ onValueChange: (value) => setState({ dataMode: value }),
127
+ disabled: !liveAvailable,
128
+ children: [
129
+ /* @__PURE__ */ jsx(
130
+ SelectTrigger,
131
+ {
132
+ className: "w-32",
133
+ "data-test": "toolbar-data-mode",
134
+ children: /* @__PURE__ */ jsx(SelectValue, {})
135
+ }
136
+ ),
137
+ /* @__PURE__ */ jsx(SelectContent, { children: DATA_MODES.map((value) => /* @__PURE__ */ jsx(SelectItem, { value, children: DATA_MODE_LABELS[value] }, value)) })
138
+ ]
139
+ }
140
+ ) }) }) : null,
141
+ controls.widget ? /* @__PURE__ */ jsxs(Fragment, { children: [
142
+ /* @__PURE__ */ jsx(Field, { label: "Fixture scenario", children: /* @__PURE__ */ jsxs(
143
+ Select,
144
+ {
145
+ value: state.variant,
146
+ onValueChange: (value) => setState({ variant: value }),
147
+ disabled: live,
148
+ children: [
149
+ /* @__PURE__ */ jsx(SelectTrigger, { className: "w-32", "data-test": "toolbar-variant", children: /* @__PURE__ */ jsx(SelectValue, {}) }),
150
+ /* @__PURE__ */ jsx(SelectContent, { children: FIXTURE_VARIANTS.map((value) => /* @__PURE__ */ jsx(SelectItem, { value, children: value }, value)) })
151
+ ]
152
+ }
153
+ ) }),
154
+ /* @__PURE__ */ jsx(Field, { label: "Viewport", children: /* @__PURE__ */ jsx("div", { className: "flex gap-1", children: Object.keys(VIEWPORTS).map((key) => /* @__PURE__ */ jsx(
155
+ Button,
156
+ {
157
+ size: "sm",
158
+ variant: state.viewport === key ? "default" : "outline",
159
+ onClick: () => setState({ viewport: key }),
160
+ children: VIEWPORTS[key].label
161
+ },
162
+ key
163
+ )) }) }),
164
+ /* @__PURE__ */ jsx(Field, { label: "Collapsed", children: /* @__PURE__ */ jsx(
165
+ Switch,
166
+ {
167
+ checked: state.collapsed,
168
+ onCheckedChange: (checked) => setState({ collapsed: checked }),
169
+ "aria-label": "Toggle collapsed"
170
+ }
171
+ ) }),
172
+ /* @__PURE__ */ jsx(Field, { label: "Unhealthy", children: /* @__PURE__ */ jsx(
173
+ Switch,
174
+ {
175
+ checked: state.unhealthy,
176
+ onCheckedChange: (checked) => setState({ unhealthy: checked }),
177
+ "aria-label": "Simulate unhealthy integration"
178
+ }
179
+ ) })
180
+ ] }) : null
181
+ ]
182
+ }
183
+ ) : null,
184
+ /* @__PURE__ */ jsxs("div", { className: "ml-auto flex items-center gap-2", children: [
185
+ /* @__PURE__ */ jsx(
186
+ DocsLink,
187
+ {
188
+ href: HARNESS_DOCS_URL,
189
+ className: cn("rounded-md", FOCUS_RING),
190
+ "data-test": "toolbar-docs-link",
191
+ children: "Docs"
192
+ }
193
+ ),
194
+ live && controls.data ? /* @__PURE__ */ jsxs(
145
195
  "span",
146
196
  {
147
- "aria-hidden": "true",
148
- className: cn("flex items-center dark:hidden"),
197
+ className: "text-primary text-label flex items-center gap-2",
198
+ "data-test": "toolbar-live-badge",
149
199
  children: [
150
- /* @__PURE__ */ jsx(Icon, { name: "fa-solid fa-moon", className: "mr-2 h-4 w-4" }),
151
- "Dark"
200
+ /* @__PURE__ */ jsx(Icon, { name: "fa-solid fa-tower-broadcast", className: "h-4 w-4" }),
201
+ "Reaching ",
202
+ resolveEgress(integration).join(", ")
152
203
  ]
153
204
  }
154
- ),
205
+ ) : null,
155
206
  /* @__PURE__ */ jsxs(
156
- "span",
207
+ Button,
157
208
  {
158
- "aria-hidden": "true",
159
- className: cn("hidden items-center dark:flex"),
209
+ size: "sm",
210
+ variant: "outline",
211
+ onClick: () => setTheme(resolvedTheme === "dark" ? "light" : "dark"),
212
+ "aria-label": getThemeToggleAccessibleLabel(resolvedTheme),
160
213
  children: [
161
- /* @__PURE__ */ jsx(Icon, { name: "fa-solid fa-sun", className: "mr-2 h-4 w-4" }),
162
- "Light"
214
+ /* @__PURE__ */ jsxs(
215
+ "span",
216
+ {
217
+ "aria-hidden": "true",
218
+ className: cn("flex items-center dark:hidden"),
219
+ children: [
220
+ /* @__PURE__ */ jsx(Icon, { name: "fa-solid fa-moon", className: "mr-2 h-4 w-4" }),
221
+ "Dark"
222
+ ]
223
+ }
224
+ ),
225
+ /* @__PURE__ */ jsxs(
226
+ "span",
227
+ {
228
+ "aria-hidden": "true",
229
+ className: cn("hidden items-center dark:flex"),
230
+ children: [
231
+ /* @__PURE__ */ jsx(Icon, { name: "fa-solid fa-sun", className: "mr-2 h-4 w-4" }),
232
+ "Light"
233
+ ]
234
+ }
235
+ )
163
236
  ]
164
237
  }
165
- )
166
- ]
167
- }
168
- ),
169
- /* @__PURE__ */ jsx(Button, { size: "sm", variant: "ghost", onClick: reset, children: "Reset" })
170
- ] })
171
- ] }) });
238
+ ),
239
+ hasControls ? /* @__PURE__ */ jsx(Button, { size: "sm", variant: "ghost", onClick: reset, children: "Reset" }) : null
240
+ ] })
241
+ ] })
242
+ ]
243
+ }
244
+ );
172
245
  }
173
246
  export {
174
247
  DevToolbar
@@ -0,0 +1,10 @@
1
+ import type { ConsoleEvent, ConsoleIntegration } from '../lib/console-types.js';
2
+ /**
3
+ * Simulated events: pick one of the contract's events, edit its payload, emit.
4
+ * Fixtures mode validates the payload and lists the workflow triggers that
5
+ * would match; live-local mode runs the integration's own handler.
6
+ */
7
+ export declare function EventsPanel({ integration, events, }: {
8
+ integration: ConsoleIntegration;
9
+ events: ConsoleEvent[];
10
+ }): import("react").JSX.Element | null;
@@ -0,0 +1,111 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useState } from "react";
4
+ import { Alert, AlertDescription, AlertTitle } from "@ekanos/ui/alert";
5
+ import { Button } from "@ekanos/ui/button";
6
+ import { Label } from "@ekanos/ui/label";
7
+ import { StatusBadge } from "@ekanos/ui/status-badge";
8
+ import { Textarea } from "@ekanos/ui/textarea";
9
+ import { useConsoleMutation } from "../lib/console-hooks.js";
10
+ import { formatJson, parseJsonText } from "../lib/schema-form-model.js";
11
+ function EventsPanel({
12
+ integration,
13
+ events
14
+ }) {
15
+ const emit = useConsoleMutation(
16
+ (c, request) => c.emitEvent(request)
17
+ );
18
+ const [state, setState] = useState(() => ({
19
+ index: 0,
20
+ text: formatJson(events[0]?.payloadExample ?? {}),
21
+ parseError: null
22
+ }));
23
+ if (events.length === 0) {
24
+ return /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-meta", "data-test": "no-events", children: "This contract declares no events." });
25
+ }
26
+ const event = events[state.index] ?? events[0];
27
+ if (!event) return null;
28
+ const submit = () => {
29
+ const parsed = parseJsonText(state.text);
30
+ if (!parsed.ok) {
31
+ setState({ ...state, parseError: parsed.error });
32
+ return;
33
+ }
34
+ setState({ ...state, parseError: null });
35
+ emit.mutate({
36
+ integration: integration.integration,
37
+ event: event.name,
38
+ payload: parsed.value ?? {}
39
+ });
40
+ };
41
+ const result = emit.data;
42
+ return /* @__PURE__ */ jsxs("div", { className: "flex max-w-2xl flex-col gap-4", "data-test": "events-panel", children: [
43
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
44
+ /* @__PURE__ */ jsx(Label, { htmlFor: "event-name", className: "text-label", children: "Event" }),
45
+ /* @__PURE__ */ jsx(
46
+ "select",
47
+ {
48
+ id: "event-name",
49
+ className: "border-input bg-background text-body-sm shadow-control h-control rounded-md border px-3",
50
+ value: state.index,
51
+ onChange: (change) => {
52
+ const index = Number(change.target.value);
53
+ setState({
54
+ ...state,
55
+ index,
56
+ text: formatJson(events[index]?.payloadExample ?? {}),
57
+ parseError: null
58
+ });
59
+ },
60
+ children: events.map((entry, index) => /* @__PURE__ */ jsx("option", { value: index, children: entry.name }, entry.name))
61
+ }
62
+ ),
63
+ event.description ? /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-fine", children: event.description }) : null
64
+ ] }),
65
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
66
+ /* @__PURE__ */ jsx(Label, { htmlFor: "event-payload", className: "text-label", children: "Payload" }),
67
+ /* @__PURE__ */ jsx(
68
+ Textarea,
69
+ {
70
+ id: "event-payload",
71
+ className: "font-mono",
72
+ spellCheck: false,
73
+ value: state.text,
74
+ "aria-invalid": state.parseError ? true : void 0,
75
+ onChange: (change) => setState({ ...state, text: change.target.value, parseError: null })
76
+ }
77
+ ),
78
+ state.parseError ? /* @__PURE__ */ jsx("p", { role: "alert", className: "text-destructive-strong text-fine", children: state.parseError }) : null
79
+ ] }),
80
+ /* @__PURE__ */ jsx("div", { className: "flex flex-wrap items-center gap-3", children: /* @__PURE__ */ jsx(
81
+ Button,
82
+ {
83
+ type: "button",
84
+ onClick: submit,
85
+ disabled: emit.isPending,
86
+ "data-test": "emit-event",
87
+ children: emit.isPending ? "Emitting\u2026" : "Emit"
88
+ }
89
+ ) }),
90
+ emit.isError ? /* @__PURE__ */ jsx(Alert, { variant: "destructive", children: /* @__PURE__ */ jsx(AlertDescription, { children: emit.error.message }) }) : null,
91
+ result ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", "data-test": "event-result", children: [
92
+ /* @__PURE__ */ jsx(StatusBadge, { tone: result.valid ? "success" : "destructive", children: result.valid ? "Payload valid" : "Payload invalid" }),
93
+ result.issues.length > 0 ? /* @__PURE__ */ jsx("ul", { className: "text-destructive-strong text-fine list-disc pl-5", children: result.issues.map((issue) => /* @__PURE__ */ jsxs("li", { children: [
94
+ /* @__PURE__ */ jsx("code", { children: issue.path || "(root)" }),
95
+ " ",
96
+ issue.message
97
+ ] }, `${issue.path}:${issue.message}`)) }) : null,
98
+ result.outcome === "ran" ? /* @__PURE__ */ jsxs(Alert, { variant: "success", "data-test": "handler-ran", children: [
99
+ /* @__PURE__ */ jsx(AlertTitle, { children: "The integration's handler ran" }),
100
+ /* @__PURE__ */ jsx(AlertDescription, { children: result.detail ? /* @__PURE__ */ jsx("pre", { className: "text-fine mt-1 overflow-auto", children: result.detail }) : null })
101
+ ] }) : /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-fine", children: "Validated only: this integration does not run the integration's code." }),
102
+ /* @__PURE__ */ jsxs("div", { "data-test": "matched-triggers", children: [
103
+ /* @__PURE__ */ jsx("p", { className: "text-label", children: "Workflow triggers that would match" }),
104
+ result.matchedTriggers.length === 0 ? /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-fine", children: "None." }) : /* @__PURE__ */ jsx("ul", { className: "text-meta list-disc pl-5", children: result.matchedTriggers.map((trigger) => /* @__PURE__ */ jsx("li", { children: trigger }, trigger)) })
105
+ ] })
106
+ ] }) : null
107
+ ] });
108
+ }
109
+ export {
110
+ EventsPanel
111
+ };
@@ -0,0 +1,4 @@
1
+ import type { ConsoleIntegration } from '../lib/console-types.js';
2
+ export declare function HealthPanel({ integration, }: {
3
+ integration: ConsoleIntegration;
4
+ }): import("react").JSX.Element;
@@ -0,0 +1,56 @@
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 { StatusBadge } from "@ekanos/ui/status-badge";
6
+ import { useConsoleMutation } from "../lib/console-hooks.js";
7
+ const TONES = {
8
+ healthy: "success",
9
+ degraded: "warning",
10
+ unhealthy: "destructive",
11
+ unknown: "neutral"
12
+ };
13
+ function HealthPanel({
14
+ integration
15
+ }) {
16
+ const check = useConsoleMutation(
17
+ (c, integration2) => c.runHealth(integration2)
18
+ );
19
+ if (integration.provenance.kind === "registry" && !integration.runModes.includes("live")) {
20
+ return /* @__PURE__ */ jsx(
21
+ "p",
22
+ {
23
+ className: "text-muted-foreground text-meta",
24
+ "data-test": "health-published",
25
+ children: "Published: not checked locally. Health runs only against a local override."
26
+ }
27
+ );
28
+ }
29
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", "data-test": "health-panel", children: [
30
+ check.data || check.isError ? null : /* @__PURE__ */ jsxs("p", { className: "text-muted-foreground text-meta", "data-test": "health-empty", children: [
31
+ "Not run yet. Run a health check to see whether",
32
+ " ",
33
+ integration.integration,
34
+ " is reachable with the connection it has now."
35
+ ] }),
36
+ /* @__PURE__ */ jsx(
37
+ Button,
38
+ {
39
+ type: "button",
40
+ className: "self-start",
41
+ disabled: check.isPending,
42
+ onClick: () => check.mutate(integration.integration),
43
+ "data-test": "run-health",
44
+ children: check.isPending ? "Checking\u2026" : "Run health check"
45
+ }
46
+ ),
47
+ check.isError ? /* @__PURE__ */ jsx(Alert, { variant: "destructive", children: /* @__PURE__ */ jsx(AlertDescription, { children: check.error.message }) }) : null,
48
+ check.data ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", "data-test": "health-result", children: [
49
+ /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(StatusBadge, { tone: TONES[check.data.status], children: check.data.status }) }),
50
+ check.data.message ? /* @__PURE__ */ jsx("p", { className: "text-meta", children: check.data.message }) : null
51
+ ] }) : null
52
+ ] });
53
+ }
54
+ export {
55
+ HealthPanel
56
+ };