@ekanos/harness 0.17.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 +30 -16
  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,32 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { targetLine } from "../lib/connection-facts.js";
4
+ import { ConnectionChip } from "./connection-chip.js";
5
+ const CONNECTION_TYPE = {
6
+ keys: "API keys",
7
+ oauth: "OAuth",
8
+ shipped: "Shipped config"
9
+ };
10
+ const LEVEL_LABEL = {
11
+ source: "Source",
12
+ team: "Team",
13
+ user: "Each person"
14
+ };
15
+ function levelList(levels) {
16
+ return levels.length === 0 ? "none declared" : levels.map((level) => LEVEL_LABEL[level]).join(" \xB7 ");
17
+ }
18
+ function ConnectionStatusChip({
19
+ connection
20
+ }) {
21
+ return /* @__PURE__ */ jsx(ConnectionChip, { facts: connection?.facts ?? null });
22
+ }
23
+ function connectionTargetText(connection) {
24
+ return targetLine(connection.facts);
25
+ }
26
+ export {
27
+ CONNECTION_TYPE,
28
+ ConnectionStatusChip,
29
+ LEVEL_LABEL,
30
+ connectionTargetText,
31
+ levelList
32
+ };
@@ -0,0 +1,9 @@
1
+ import type { RunRecord } from '../lib/console-types.js';
2
+ export declare function RunLogTable({ runs, integration, }: {
3
+ runs: readonly RunRecord[];
4
+ integration?: string;
5
+ }): import("react").JSX.Element;
6
+ /** The live run log: every operation call from any surface. */
7
+ export declare function RunLog({ integration }: {
8
+ integration?: string;
9
+ }): import("react").JSX.Element;
@@ -0,0 +1,228 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useState } from "react";
4
+ import { Alert, AlertDescription } from "@ekanos/ui/alert";
5
+ import { Button } from "@ekanos/ui/button";
6
+ import { Label } from "@ekanos/ui/label";
7
+ import {
8
+ Select,
9
+ SelectContent,
10
+ SelectItem,
11
+ SelectTrigger,
12
+ SelectValue
13
+ } from "@ekanos/ui/select";
14
+ import { StatusBadge } from "@ekanos/ui/status-badge";
15
+ import {
16
+ Table,
17
+ TableBody,
18
+ TableCell,
19
+ TableHead,
20
+ TableHeader,
21
+ TableRow
22
+ } from "@ekanos/ui/table";
23
+ import { useRuns } from "../lib/console-hooks.js";
24
+ import {
25
+ NO_RUN_FILTER,
26
+ RUN_OUTCOMES,
27
+ RUN_PAGE_SIZE,
28
+ explainRunReason,
29
+ filterRuns,
30
+ pageRuns,
31
+ runOutcome
32
+ } from "../lib/run-log-view.js";
33
+ const OUTCOME_TONES = {
34
+ ok: "success",
35
+ refused: "destructive",
36
+ failed: "destructive",
37
+ held: "warning"
38
+ };
39
+ function RunFilters({
40
+ filter,
41
+ integrations,
42
+ onChange
43
+ }) {
44
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-end gap-4", "data-test": "run-log-filters", children: [
45
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
46
+ /* @__PURE__ */ jsx(Label, { className: "text-muted-foreground text-fine", children: "Outcome" }),
47
+ /* @__PURE__ */ jsxs(
48
+ Select,
49
+ {
50
+ value: filter.outcome,
51
+ onValueChange: (outcome) => onChange({
52
+ ...filter,
53
+ outcome: outcome ?? "all"
54
+ }),
55
+ children: [
56
+ /* @__PURE__ */ jsx(SelectTrigger, { className: "w-36", "data-test": "run-filter-outcome", children: /* @__PURE__ */ jsx(SelectValue, {}) }),
57
+ /* @__PURE__ */ jsxs(SelectContent, { children: [
58
+ /* @__PURE__ */ jsx(SelectItem, { value: "all", children: "All outcomes" }),
59
+ RUN_OUTCOMES.map((outcome) => /* @__PURE__ */ jsx(SelectItem, { value: outcome, children: outcome }, outcome))
60
+ ] })
61
+ ]
62
+ }
63
+ )
64
+ ] }),
65
+ integrations.length > 1 ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
66
+ /* @__PURE__ */ jsx(Label, { className: "text-muted-foreground text-fine", children: "Integration" }),
67
+ /* @__PURE__ */ jsxs(
68
+ Select,
69
+ {
70
+ value: filter.integration,
71
+ onValueChange: (integration) => onChange({ ...filter, integration: integration ?? "all" }),
72
+ children: [
73
+ /* @__PURE__ */ jsx(SelectTrigger, { className: "w-44", "data-test": "run-filter-integration", children: /* @__PURE__ */ jsx(SelectValue, {}) }),
74
+ /* @__PURE__ */ jsxs(SelectContent, { children: [
75
+ /* @__PURE__ */ jsx(SelectItem, { value: "all", children: "All integrations" }),
76
+ integrations.map((name) => /* @__PURE__ */ jsx(SelectItem, { value: name, children: name }, name))
77
+ ] })
78
+ ]
79
+ }
80
+ )
81
+ ] }) : null
82
+ ] });
83
+ }
84
+ function RunLogTable({
85
+ runs,
86
+ integration
87
+ }) {
88
+ const [view, setView] = useState({
89
+ filter: NO_RUN_FILTER,
90
+ limit: RUN_PAGE_SIZE
91
+ });
92
+ const scoped = integration ? runs.filter((run) => run.integration === integration) : runs;
93
+ const integrations = [...new Set(scoped.map((run) => run.integration))];
94
+ const filtered = filterRuns(scoped, view.filter);
95
+ const { shown, remaining } = pageRuns(filtered, view.limit);
96
+ if (scoped.length === 0) {
97
+ return /* @__PURE__ */ jsx("p", { className: "text-muted-foreground text-meta", "data-test": "run-log-empty", children: "No operations have run yet." });
98
+ }
99
+ return /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-col gap-4", children: [
100
+ /* @__PURE__ */ jsx(
101
+ RunFilters,
102
+ {
103
+ filter: view.filter,
104
+ integrations: integration ? [] : integrations,
105
+ onChange: (filter) => setView({ filter, limit: RUN_PAGE_SIZE })
106
+ }
107
+ ),
108
+ shown.length === 0 ? /* @__PURE__ */ jsx(
109
+ "p",
110
+ {
111
+ className: "text-muted-foreground text-meta",
112
+ "data-test": "run-log-no-match",
113
+ children: "No runs match these filters."
114
+ }
115
+ ) : /* @__PURE__ */ jsx("div", { className: "overflow-x-auto", "data-test": "run-log", children: /* @__PURE__ */ jsxs(Table, { children: [
116
+ /* @__PURE__ */ jsx(TableHeader, { children: /* @__PURE__ */ jsxs(TableRow, { children: [
117
+ /* @__PURE__ */ jsx(TableHead, { children: "Time" }),
118
+ /* @__PURE__ */ jsx(TableHead, { children: "Operation" }),
119
+ /* @__PURE__ */ jsx(TableHead, { children: "Source" }),
120
+ /* @__PURE__ */ jsx(TableHead, { children: "Mode" }),
121
+ /* @__PURE__ */ jsx(TableHead, { children: "Channel" }),
122
+ /* @__PURE__ */ jsx(TableHead, { children: "Status" }),
123
+ /* @__PURE__ */ jsx(TableHead, { className: "text-right", children: "ms" })
124
+ ] }) }),
125
+ /* @__PURE__ */ jsx(TableBody, { children: shown.map((run) => {
126
+ const explanation = explainRunReason(run.reason);
127
+ return /* @__PURE__ */ jsxs(
128
+ TableRow,
129
+ {
130
+ "data-test": "run-log-row",
131
+ "data-run-id": run.id,
132
+ "data-outcome": runOutcome(run),
133
+ children: [
134
+ /* @__PURE__ */ jsx(TableCell, { className: "text-fine whitespace-nowrap", children: new Date(run.ts).toLocaleTimeString() }),
135
+ /* @__PURE__ */ jsxs(TableCell, { children: [
136
+ /* @__PURE__ */ jsxs("code", { className: "text-fine", children: [
137
+ run.integration,
138
+ "@",
139
+ run.version,
140
+ "/",
141
+ run.opKey
142
+ ] }),
143
+ /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground text-fine block", children: [
144
+ "integration ",
145
+ run.integration,
146
+ " \xB7",
147
+ " ",
148
+ run.effect ?? "unknown"
149
+ ] })
150
+ ] }),
151
+ /* @__PURE__ */ jsx(TableCell, { className: "text-fine uppercase", children: run.provenance ?? "n/a" }),
152
+ /* @__PURE__ */ jsx(TableCell, { className: "text-fine", children: run.mode ?? "n/a" }),
153
+ /* @__PURE__ */ jsxs(TableCell, { className: "text-fine", children: [
154
+ run.channel,
155
+ run.origin ? /* @__PURE__ */ jsx("span", { className: "text-muted-foreground block", children: run.origin }) : null
156
+ ] }),
157
+ /* @__PURE__ */ jsxs(TableCell, { children: [
158
+ /* @__PURE__ */ jsxs(
159
+ StatusBadge,
160
+ {
161
+ tone: OUTCOME_TONES[runOutcome(run)],
162
+ ...explanation ? { title: explanation } : {},
163
+ children: [
164
+ runOutcome(run),
165
+ run.reason ? ` \xB7 ${run.reason}` : ""
166
+ ]
167
+ }
168
+ ),
169
+ explanation ? /* @__PURE__ */ jsx(
170
+ "span",
171
+ {
172
+ className: "text-muted-foreground text-fine mt-1 block max-w-64 whitespace-normal",
173
+ "data-test": "run-reason",
174
+ children: explanation
175
+ }
176
+ ) : null
177
+ ] }),
178
+ /* @__PURE__ */ jsx(TableCell, { className: "text-fine text-right", children: run.durationMs })
179
+ ]
180
+ },
181
+ run.id
182
+ );
183
+ }) })
184
+ ] }) }),
185
+ remaining > 0 ? /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
186
+ /* @__PURE__ */ jsx(
187
+ Button,
188
+ {
189
+ type: "button",
190
+ variant: "outline",
191
+ size: "sm",
192
+ onClick: () => setView((previous) => ({
193
+ ...previous,
194
+ limit: previous.limit + RUN_PAGE_SIZE
195
+ })),
196
+ "data-test": "run-log-more",
197
+ children: "Show more"
198
+ }
199
+ ),
200
+ /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground text-fine", children: [
201
+ "Showing ",
202
+ shown.length,
203
+ " of ",
204
+ filtered.length
205
+ ] })
206
+ ] }) : null
207
+ ] });
208
+ }
209
+ function RunLog({ integration }) {
210
+ const runs = useRuns();
211
+ if (runs.isError) {
212
+ return /* @__PURE__ */ jsx(Alert, { variant: "destructive", children: /* @__PURE__ */ jsxs(AlertDescription, { children: [
213
+ "Could not load the run log: ",
214
+ runs.error.message
215
+ ] }) });
216
+ }
217
+ return /* @__PURE__ */ jsx(
218
+ RunLogTable,
219
+ {
220
+ runs: runs.data ?? [],
221
+ ...integration ? { integration } : {}
222
+ }
223
+ );
224
+ }
225
+ export {
226
+ RunLog,
227
+ RunLogTable
228
+ };
@@ -0,0 +1,12 @@
1
+ import type { ConsoleIntegration } from '../lib/console-types.js';
2
+ export declare function runtimeChipText(integration: Pick<ConsoleIntegration, 'integration' | 'runtime'>): string | null;
3
+ /**
4
+ * Where each integration gets its answers right now, with what it takes to
5
+ * change that: Connect for one that is not connected, Disconnect for one that
6
+ * is, and a pin to fixtures. An integration that needs no connection has
7
+ * neither Connect nor Disconnect. A connected integration's reads run live with
8
+ * its stored credentials; writes are held for approval either way.
9
+ *
10
+ * When every integration is live and none is pinned, it collapses to one line.
11
+ */
12
+ export declare function RuntimeStrip(): import("react").JSX.Element | null;
@@ -0,0 +1,158 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { usePathname } from "next/navigation";
4
+ import { Button } from "@ekanos/ui/button";
5
+ import { ConfirmDialog } from "@ekanos/ui/confirm-dialog";
6
+ import { answerLabel } from "../lib/connection-facts.js";
7
+ import { useConsoleClient } from "../lib/console-context.js";
8
+ import {
9
+ useConsoleMutation,
10
+ useProject,
11
+ useRefreshRuntime
12
+ } from "../lib/console-hooks.js";
13
+ import { ConnectDialog } from "./connect-dialog.js";
14
+ import { ConnectionChip } from "./connection-chip.js";
15
+ function runtimeChipText(integration) {
16
+ const facts = integration.runtime?.facts;
17
+ if (!facts) return null;
18
+ return `${integration.integration} \xB7 ${answerLabel(facts)}`;
19
+ }
20
+ function onConnectTab(pathname) {
21
+ return Boolean(pathname && /\/connect\/?$/.test(pathname));
22
+ }
23
+ function RuntimeStrip() {
24
+ const project = useProject();
25
+ const client = useConsoleClient();
26
+ const refresh = useRefreshRuntime();
27
+ const pathname = usePathname();
28
+ const force = useConsoleMutation(
29
+ (c, input) => c.setRuntimeMode(input.integration, input.mode)
30
+ );
31
+ const disconnect = useConsoleMutation(
32
+ (c, input) => c.disconnect(input.integration, input.clearKeys)
33
+ );
34
+ const rows = (project.data?.integrations ?? []).filter(
35
+ (integration) => integration.runtime !== void 0
36
+ );
37
+ if (rows.length === 0 || onConnectTab(pathname)) return null;
38
+ const allLive = rows.every(
39
+ (row) => row.runtime?.facts.answers === "live" && !row.runtime.facts.forced
40
+ );
41
+ const list = /* @__PURE__ */ jsx(
42
+ "ul",
43
+ {
44
+ className: "flex flex-col gap-2",
45
+ "data-test": "runtime-strip",
46
+ "aria-label": "Where each integration gets its answers",
47
+ children: rows.map((integration) => {
48
+ const runtime = integration.runtime;
49
+ if (!runtime) return null;
50
+ const facts = runtime.facts;
51
+ const connectable = integration.runModes.includes("live");
52
+ const ready = facts.state === "connected" || facts.state === "no_connection_needed";
53
+ return /* @__PURE__ */ jsxs(
54
+ "li",
55
+ {
56
+ className: "flex flex-wrap items-center gap-x-3 gap-y-2",
57
+ "data-test": `runtime-${integration.integration}`,
58
+ "data-mode": runtime.mode,
59
+ "data-reason": runtime.reason,
60
+ children: [
61
+ /* @__PURE__ */ jsx("code", { className: "text-label w-28 shrink-0 truncate", children: integration.integration }),
62
+ /* @__PURE__ */ jsx("span", { className: "flex min-w-48 flex-1 flex-wrap items-center gap-x-3 gap-y-1", children: /* @__PURE__ */ jsx(ConnectionChip, { facts, variant: "answer" }) }),
63
+ /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-2", children: [
64
+ connectable && facts.state === "not_connected" ? /* @__PURE__ */ jsx(
65
+ ConnectDialog,
66
+ {
67
+ integration: integration.integration,
68
+ client,
69
+ oauth: runtime.oauth,
70
+ returnPath: typeof window === "undefined" ? "/" : window.location.pathname,
71
+ onChanged: refresh
72
+ }
73
+ ) : null,
74
+ connectable && (ready || facts.forced) ? /* @__PURE__ */ jsx(
75
+ Button,
76
+ {
77
+ variant: "outline",
78
+ size: "sm",
79
+ disabled: force.isPending,
80
+ "data-test": `force-${integration.integration}`,
81
+ onClick: async () => {
82
+ await force.mutateAsync({
83
+ integration: integration.integration,
84
+ mode: facts.forced ? "auto" : "fixtures"
85
+ });
86
+ await refresh();
87
+ },
88
+ children: facts.forced ? "Unpin" : "Pin to fixtures"
89
+ }
90
+ ) : null,
91
+ connectable && facts.state === "connected" ? /* @__PURE__ */ jsx(
92
+ ConfirmDialog,
93
+ {
94
+ trigger: /* @__PURE__ */ jsx(
95
+ Button,
96
+ {
97
+ variant: "outline",
98
+ size: "sm",
99
+ disabled: disconnect.isPending,
100
+ "data-test": `disconnect-${integration.integration}`,
101
+ children: "Disconnect"
102
+ }
103
+ ),
104
+ title: `Disconnect ${integration.integration}?`,
105
+ description: "This removes the local credentials stored for this integration, in its own folder only. Its reads go back to fixtures.",
106
+ confirmLabel: "Disconnect",
107
+ onConfirm: async () => {
108
+ try {
109
+ await disconnect.mutateAsync({
110
+ integration: integration.integration,
111
+ clearKeys: !runtime.oauth
112
+ });
113
+ await refresh();
114
+ return true;
115
+ } catch (error) {
116
+ console.error("[harness] disconnect failed", error);
117
+ return false;
118
+ }
119
+ }
120
+ }
121
+ ) : null
122
+ ] })
123
+ ]
124
+ },
125
+ integration.integration
126
+ );
127
+ })
128
+ }
129
+ );
130
+ if (allLive) {
131
+ return /* @__PURE__ */ jsxs(
132
+ "details",
133
+ {
134
+ className: "group rounded-md border px-4 py-2",
135
+ "data-test": "runtime-strip-collapsed",
136
+ children: [
137
+ /* @__PURE__ */ jsxs("summary", { className: "text-meta flex cursor-pointer list-none items-center gap-3", children: [
138
+ /* @__PURE__ */ jsx("span", { className: "text-label", children: "Integrations" }),
139
+ /* @__PURE__ */ jsxs("span", { className: "text-muted-foreground", children: [
140
+ "All ",
141
+ rows.length,
142
+ " live"
143
+ ] })
144
+ ] }),
145
+ /* @__PURE__ */ jsx("div", { className: "pt-3", children: list })
146
+ ]
147
+ }
148
+ );
149
+ }
150
+ return /* @__PURE__ */ jsxs("section", { className: "flex flex-col gap-2 rounded-md border px-4 py-3", children: [
151
+ /* @__PURE__ */ jsx("h2", { className: "text-label", children: "Integrations" }),
152
+ list
153
+ ] });
154
+ }
155
+ export {
156
+ RuntimeStrip,
157
+ runtimeChipText
158
+ };
@@ -0,0 +1,13 @@
1
+ import type { JsonSchema, ValidationIssue } from '../lib/console-types.js';
2
+ /**
3
+ * A controlled form generated from a JSON Schema. Supports object, array,
4
+ * enum, string (with `format`), number, integer, boolean and nullable
5
+ * variants; any node using a keyword outside that set is edited as JSON in
6
+ * place, with its parse error shown inline.
7
+ */
8
+ export declare function SchemaForm({ schema, value, onChange, issues, }: {
9
+ schema: JsonSchema;
10
+ value: unknown;
11
+ onChange: (value: unknown) => void;
12
+ issues?: readonly ValidationIssue[];
13
+ }): import("react").JSX.Element;