@xemahq/ui-kernel 0.11.1 → 0.12.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 (257) hide show
  1. package/dist/errors/http-error-status.d.ts +17 -0
  2. package/dist/errors/http-error-status.d.ts.map +1 -0
  3. package/dist/errors/http-error-status.js +59 -0
  4. package/dist/errors/http-error-status.js.map +1 -0
  5. package/dist/errors/index.d.ts +2 -0
  6. package/dist/errors/index.d.ts.map +1 -0
  7. package/dist/errors/index.js +2 -0
  8. package/dist/errors/index.js.map +1 -0
  9. package/dist/index.d.ts +1 -0
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +1 -0
  12. package/dist/index.js.map +1 -1
  13. package/dist/lib/biome-host/errors.d.ts.map +1 -1
  14. package/dist/lib/biome-host/errors.js +1 -19
  15. package/dist/lib/biome-host/errors.js.map +1 -1
  16. package/dist/offline/index.d.ts.map +1 -1
  17. package/dist/offline/index.js.map +1 -1
  18. package/dist/offline/online-controller.d.ts.map +1 -1
  19. package/dist/offline/online-controller.js +6 -1
  20. package/dist/offline/online-controller.js.map +1 -1
  21. package/dist/offline/outbox.d.ts.map +1 -1
  22. package/dist/offline/outbox.js +2 -24
  23. package/dist/offline/outbox.js.map +1 -1
  24. package/package.json +1 -2
  25. package/src/index.ts +0 -17
  26. package/src/lib/biome-host/agent-validation.ts +0 -239
  27. package/src/lib/biome-host/biome-builders.ts +0 -112
  28. package/src/lib/biome-host/biome-mode.ts +0 -6
  29. package/src/lib/biome-host/biome-navigation.ts +0 -37
  30. package/src/lib/biome-host/biome-registry.ts +0 -299
  31. package/src/lib/biome-host/biome-scope-hooks.ts +0 -41
  32. package/src/lib/biome-host/biome-scope.tsx +0 -52
  33. package/src/lib/biome-host/biome-scoped-query.ts +0 -134
  34. package/src/lib/biome-host/create-biome-orval-config.ts +0 -82
  35. package/src/lib/biome-host/define-web-biome.spec.ts +0 -221
  36. package/src/lib/biome-host/define-web-biome.ts +0 -222
  37. package/src/lib/biome-host/errors.ts +0 -220
  38. package/src/lib/biome-host/frontend-biome.ts +0 -256
  39. package/src/lib/biome-host/host-bridge.ts +0 -281
  40. package/src/lib/biome-host/host-sources.ts +0 -54
  41. package/src/lib/biome-host/i18n-hooks.ts +0 -51
  42. package/src/lib/biome-host/i18n-port.test.ts +0 -50
  43. package/src/lib/biome-host/i18n-port.ts +0 -96
  44. package/src/lib/biome-host/index.ts +0 -35
  45. package/src/lib/biome-host/realtime-hooks.ts +0 -75
  46. package/src/lib/biome-host/realtime-port.ts +0 -115
  47. package/src/lib/biome-host/session-contributions.ts +0 -296
  48. package/src/lib/biome-host/use-mutation-with-error-toast.ts +0 -90
  49. package/src/lib/biome-host/use-page-state.ts +0 -248
  50. package/src/lib/capabilities/capability-context.ts +0 -25
  51. package/src/lib/capabilities/capability-provider.tsx +0 -73
  52. package/src/lib/capabilities/index.ts +0 -17
  53. package/src/lib/capabilities/types.ts +0 -69
  54. package/src/lib/capabilities/use-capability.ts +0 -79
  55. package/src/lib/contribution-registry/contribution-registry.spec.ts +0 -141
  56. package/src/lib/contribution-registry/contribution-registry.ts +0 -204
  57. package/src/lib/contribution-registry/index.ts +0 -9
  58. package/src/lib/contribution-registry/renderable-registry.ts +0 -142
  59. package/src/lib/system-bus/capability-invoke.ts +0 -92
  60. package/src/lib/system-bus/deeplink.ts +0 -210
  61. package/src/lib/system-bus/enums.ts +0 -86
  62. package/src/lib/system-bus/host-ports.ts +0 -93
  63. package/src/lib/system-bus/index.ts +0 -16
  64. package/src/lib/system-bus/intent-registry.ts +0 -109
  65. package/src/lib/system-bus/intents.ts +0 -113
  66. package/src/lib/system-bus/palette.ts +0 -78
  67. package/src/lib/system-bus/system-bus-builder.ts +0 -159
  68. package/src/lib/system-bus/system-bus.ts +0 -37
  69. package/src/lib/system-bus/windows.ts +0 -51
  70. package/src/offline/id.ts +0 -16
  71. package/src/offline/index.ts +0 -54
  72. package/src/offline/mutation.ts +0 -75
  73. package/src/offline/offline-status-badge.tsx +0 -51
  74. package/src/offline/online-controller.ts +0 -105
  75. package/src/offline/outbox.test.ts +0 -172
  76. package/src/offline/outbox.ts +0 -348
  77. package/src/offline/react-hooks.ts +0 -40
  78. package/src/offline/react.tsx +0 -32
  79. package/src/offline/storage.ts +0 -112
  80. package/src/offline/types.ts +0 -77
  81. package/src/org-db/components/DbResultTable.tsx +0 -176
  82. package/src/org-db/index.ts +0 -1
  83. package/src/pdf/index.ts +0 -11
  84. package/src/registry/index.ts +0 -9
  85. package/src/registry/lib/agent-validation-host.ts +0 -36
  86. package/src/registry/lib/biome-slot.tsx +0 -50
  87. package/src/registry/lib/biomes-enabled-context.ts +0 -20
  88. package/src/registry/lib/extension-points.ts +0 -134
  89. package/src/registry/lib/primitives/SessionEventCard.tsx +0 -164
  90. package/src/registry/lib/primitives/SessionEventTimeline.tsx +0 -95
  91. package/src/registry/lib/primitives/SessionMutationBar.tsx +0 -76
  92. package/src/registry/lib/primitives/SessionTabbedDrawer.tsx +0 -165
  93. package/src/registry/lib/primitives/index.ts +0 -18
  94. package/src/registry/lib/session-context-builder.ts +0 -84
  95. package/src/registry/lib/session-context-provider.tsx +0 -33
  96. package/src/registry/lib/session-context.ts +0 -21
  97. package/src/registry/lib/session-selectors.ts +0 -272
  98. package/src/session/comments/CommentRail.tsx +0 -164
  99. package/src/session/index.ts +0 -3
  100. package/src/session/lib/cn.ts +0 -11
  101. package/src/session/shell/SessionWorkspaceShell.tsx +0 -147
  102. package/src/session-kit/approvals/ApprovalButton.tsx +0 -89
  103. package/src/session-kit/approvals/ApprovalCard.tsx +0 -341
  104. package/src/session-kit/approvals/ApprovalsCenter.tsx +0 -336
  105. package/src/session-kit/approvals/CapabilityApprovalStickyBar.tsx +0 -118
  106. package/src/session-kit/approvals/Obligation.tsx +0 -111
  107. package/src/session-kit/approvals/ScopedBody.tsx +0 -392
  108. package/src/session-kit/approvals/approval-icons.ts +0 -31
  109. package/src/session-kit/approvals/approval-model.ts +0 -204
  110. package/src/session-kit/approvals/index.ts +0 -22
  111. package/src/session-kit/approvals/obligation-display.ts +0 -100
  112. package/src/session-kit/approvals/risk-accent.ts +0 -47
  113. package/src/session-kit/approvals/scope-icons.ts +0 -19
  114. package/src/session-kit/combobox/Combobox.tsx +0 -358
  115. package/src/session-kit/combobox/use-click-outside.ts +0 -21
  116. package/src/session-kit/display/ContextHeader.tsx +0 -148
  117. package/src/session-kit/display/FileDiffCard.tsx +0 -140
  118. package/src/session-kit/display/MD.tsx +0 -162
  119. package/src/session-kit/display/MessageTurn.tsx +0 -157
  120. package/src/session-kit/display/ThinkingPanel.tsx +0 -81
  121. package/src/session-kit/display/TodoChecklist.tsx +0 -120
  122. package/src/session-kit/display/TokenMeter.tsx +0 -89
  123. package/src/session-kit/display/ToolStrip.tsx +0 -278
  124. package/src/session-kit/display/TypingDots.tsx +0 -24
  125. package/src/session-kit/index.ts +0 -44
  126. package/src/session-kit/lib/enums.ts +0 -66
  127. package/src/session-kit/lib/portal-accent.ts +0 -30
  128. package/src/session-kit/lib/status-dot.ts +0 -68
  129. package/src/session-kit/primitives/Avatar.tsx +0 -44
  130. package/src/session-kit/primitives/PortalGlyph.tsx +0 -51
  131. package/src/session-kit/primitives/RiskPill.tsx +0 -95
  132. package/src/session-kit/primitives/ScopeDot.tsx +0 -47
  133. package/src/session-kit/primitives/Segmented.tsx +0 -71
  134. package/src/ui/branding/app-branding-context.ts +0 -20
  135. package/src/ui/branding/app-branding-provider.tsx +0 -123
  136. package/src/ui/branding/sanitize.ts +0 -89
  137. package/src/ui/breakpoints.ts +0 -14
  138. package/src/ui/capture/document-preview.tsx +0 -166
  139. package/src/ui/capture/field-spec-to-zod.test.ts +0 -81
  140. package/src/ui/capture/field-spec-to-zod.ts +0 -174
  141. package/src/ui/capture/field-spec-validate.ts +0 -236
  142. package/src/ui/capture/field-spec.test.ts +0 -49
  143. package/src/ui/capture/field-spec.ts +0 -274
  144. package/src/ui/capture/index.ts +0 -51
  145. package/src/ui/capture/schema-field-input.tsx +0 -620
  146. package/src/ui/capture/schema-form.tsx +0 -149
  147. package/src/ui/capture/submit-values.test.ts +0 -70
  148. package/src/ui/capture/submit-values.ts +0 -63
  149. package/src/ui/capture/use-prefill.ts +0 -186
  150. package/src/ui/capture/use-schema-validation.ts +0 -145
  151. package/src/ui/capture/use-wizard.ts +0 -180
  152. package/src/ui/capture/value-format.ts +0 -32
  153. package/src/ui/capture/wizard.tsx +0 -105
  154. package/src/ui/charts/bar-chart.tsx +0 -139
  155. package/src/ui/charts/chart-frame.tsx +0 -125
  156. package/src/ui/charts/chart-types.ts +0 -52
  157. package/src/ui/charts/chart-utils.ts +0 -190
  158. package/src/ui/charts/charts.test.tsx +0 -204
  159. package/src/ui/charts/donut-chart.tsx +0 -129
  160. package/src/ui/charts/index.ts +0 -27
  161. package/src/ui/charts/line-chart.tsx +0 -202
  162. package/src/ui/charts/sparkline.tsx +0 -109
  163. package/src/ui/chrome/AsyncBoundary.tsx +0 -74
  164. package/src/ui/chrome/EmptyState.tsx +0 -257
  165. package/src/ui/chrome/ErrorCard.tsx +0 -63
  166. package/src/ui/chrome/LoadingState.tsx +0 -61
  167. package/src/ui/chrome/PageHeader.tsx +0 -137
  168. package/src/ui/chrome/RecordCardList.tsx +0 -98
  169. package/src/ui/chrome/StateCard.tsx +0 -150
  170. package/src/ui/chrome/confirm-delete-dialog.tsx +0 -59
  171. package/src/ui/chrome/page-shell.spec.tsx +0 -117
  172. package/src/ui/chrome/page-shell.tsx +0 -221
  173. package/src/ui/chrome/scope-badge.tsx +0 -40
  174. package/src/ui/chrome/status-badge.tsx +0 -79
  175. package/src/ui/cn.ts +0 -32
  176. package/src/ui/design-tokens.ts +0 -372
  177. package/src/ui/hooks/use-debounced-value.ts +0 -16
  178. package/src/ui/hooks/use-is-mobile.ts +0 -28
  179. package/src/ui/index.ts +0 -110
  180. package/src/ui/pdf/pdf-preview.tsx +0 -122
  181. package/src/ui/primitives/alert-dialog.tsx +0 -104
  182. package/src/ui/primitives/async-combobox.tsx +0 -182
  183. package/src/ui/primitives/badge-variants.ts +0 -21
  184. package/src/ui/primitives/badge.tsx +0 -25
  185. package/src/ui/primitives/button-variants.ts +0 -31
  186. package/src/ui/primitives/button.tsx +0 -29
  187. package/src/ui/primitives/card.tsx +0 -43
  188. package/src/ui/primitives/checkbox.tsx +0 -26
  189. package/src/ui/primitives/collapsible.tsx +0 -9
  190. package/src/ui/primitives/dialog.tsx +0 -103
  191. package/src/ui/primitives/dropdown-menu.tsx +0 -179
  192. package/src/ui/primitives/form-stepper.tsx +0 -94
  193. package/src/ui/primitives/form-stepper.types.ts +0 -15
  194. package/src/ui/primitives/input.tsx +0 -22
  195. package/src/ui/primitives/label.tsx +0 -17
  196. package/src/ui/primitives/overflow-tabs.tsx +0 -331
  197. package/src/ui/primitives/popover.tsx +0 -33
  198. package/src/ui/primitives/preview-device-frame.tsx +0 -213
  199. package/src/ui/primitives/radio-group.tsx +0 -36
  200. package/src/ui/primitives/resizable.tsx +0 -67
  201. package/src/ui/primitives/scroll-area.tsx +0 -38
  202. package/src/ui/primitives/select.tsx +0 -143
  203. package/src/ui/primitives/separator.tsx +0 -20
  204. package/src/ui/primitives/sheet.tsx +0 -107
  205. package/src/ui/primitives/skeleton.tsx +0 -99
  206. package/src/ui/primitives/switch.tsx +0 -27
  207. package/src/ui/primitives/table.tsx +0 -72
  208. package/src/ui/primitives/tabs.tsx +0 -53
  209. package/src/ui/primitives/tag-multi-select.tsx +0 -261
  210. package/src/ui/primitives/textarea.tsx +0 -21
  211. package/src/ui/primitives/tooltip.tsx +0 -30
  212. package/src/ui/primitives/url-preview-chrome.tsx +0 -103
  213. package/src/vista/GenericCatalogueSurface.tsx +0 -179
  214. package/src/vista/SurfaceFallbackCard.tsx +0 -109
  215. package/src/vista/VistaPanel.tsx +0 -163
  216. package/src/vista/form-payload.spec.ts +0 -139
  217. package/src/vista/html/CustomUiFrame.spec.tsx +0 -127
  218. package/src/vista/html/CustomUiFrame.tsx +0 -206
  219. package/src/vista/html/custom-ui-frame-bridge.spec.ts +0 -191
  220. package/src/vista/html/custom-ui-frame-bridge.ts +0 -98
  221. package/src/vista/html/custom-ui-frame-contract.ts +0 -88
  222. package/src/vista/html/custom-ui-intents.spec.ts +0 -135
  223. package/src/vista/html/custom-ui-intents.ts +0 -155
  224. package/src/vista/html/custom-ui-srcdoc.spec.ts +0 -151
  225. package/src/vista/html/custom-ui-srcdoc.ts +0 -193
  226. package/src/vista/html/index.ts +0 -13
  227. package/src/vista/index.ts +0 -52
  228. package/src/vista/surface-catalogue.spec.ts +0 -140
  229. package/src/vista/surface-catalogue.ts +0 -90
  230. package/src/vista/surface-icons.ts +0 -57
  231. package/src/vista/surface-registry.ts +0 -56
  232. package/src/vista/surfaces/ChartSurface.tsx +0 -34
  233. package/src/vista/surfaces/FilesSurface.tsx +0 -202
  234. package/src/vista/surfaces/FormSurface.tsx +0 -380
  235. package/src/vista/surfaces/HtmlSurface.tsx +0 -43
  236. package/src/vista/surfaces/TableSurface.tsx +0 -100
  237. package/src/vista/surfaces/UrlSurface.tsx +0 -40
  238. package/src/vista/surfaces/blob-surfaces.tsx +0 -139
  239. package/src/vista/surfaces/elicitation-transport.spec.ts +0 -369
  240. package/src/vista/surfaces/elicitation-transport.ts +0 -367
  241. package/src/vista/surfaces/file-surface-utils.ts +0 -69
  242. package/src/vista/surfaces/index.ts +0 -24
  243. package/src/vista/surfaces/register-surfaces.tsx +0 -139
  244. package/src/vista/surfaces/text-surfaces.tsx +0 -132
  245. package/src/vista/use-vista-tabs.ts +0 -196
  246. package/src/vista/vista-code-renderer-context.ts +0 -16
  247. package/src/vista/vista-code-renderer.tsx +0 -35
  248. package/src/vista/vista-file-context.ts +0 -14
  249. package/src/vista/vista-file-source.tsx +0 -141
  250. package/src/vista/vista-form-context.ts +0 -20
  251. package/src/vista/vista-form-host.tsx +0 -48
  252. package/src/vista/vista-model.ts +0 -137
  253. package/src/vista/vista-open-context.tsx +0 -27
  254. package/src/vista/vista-open-state.ts +0 -11
  255. package/src/vista/vista-payloads.ts +0 -635
  256. package/src/vista/vista-tabs-manifest.ts +0 -138
  257. package/src/vista/vista-tools.ts +0 -232
@@ -1,118 +0,0 @@
1
- /**
2
- * Sticky CAPABILITY-approval bar — pinned above the composer
3
- * so a pending capability approval is always actionable without scrolling
4
- * back to the inline card.
5
- *
6
- * NOTE on naming: this is DISTINCT from the clarification-gate
7
- * `StickyApprovalBar` (`src/components/clarification/StickyApprovalBar.tsx`),
8
- * which approves a clarification CONTRACT (attempt counters, reject
9
- * reasons, override rationale). This bar approves a suspended CAPABILITY
10
- * CALL (risk tier + biome + Review/Deny/Approve). The two concerns are
11
- * deliberately separate components so neither regresses the other.
12
- *
13
- * Title + RiskPill + biome + Review / Deny / Approve. The bar surface is
14
- * tinted with the risk accent; critical/high force the risk colour on the
15
- * approve button.
16
- */
17
- import {
18
- ApprovalDecision,
19
- isExplicitApprovalTier,
20
- type ApprovalRequest,
21
- } from './approval-model';
22
- import { ApprovalButton } from './ApprovalButton';
23
- import { RISK_ACCENT } from './risk-accent';
24
- import { RiskPill } from '../primitives/RiskPill';
25
-
26
- import type { ApprovalIcons } from './approval-icons';
27
- import type { ReactElement } from 'react';
28
-
29
- export interface CapabilityApprovalStickyBarProps {
30
- readonly request: ApprovalRequest;
31
- readonly icons: Pick<ApprovalIcons, 'shield' | 'check'>;
32
- readonly onResolve: (
33
- decision: ApprovalDecision,
34
- request: ApprovalRequest,
35
- ) => void;
36
- /** "Review" scrolls/opens the inline card; optional. */
37
- readonly onReview?: () => void;
38
- /** Portal/brand accent for the (non-critical) approve button. */
39
- readonly accent?: string;
40
- }
41
-
42
- export function CapabilityApprovalStickyBar({
43
- request,
44
- icons,
45
- onResolve,
46
- onReview,
47
- accent = 'hsl(var(--primary))',
48
- }: CapabilityApprovalStickyBarProps): ReactElement {
49
- const r = RISK_ACCENT[request.riskTier];
50
- const explicit = isExplicitApprovalTier(request.riskTier);
51
- return (
52
- <div
53
- style={{
54
- display: 'flex',
55
- alignItems: 'center',
56
- gap: 11,
57
- padding: '9px 13px',
58
- borderRadius: 11,
59
- border: `1px solid ${r.bd}`,
60
- background: r.bg,
61
- marginBottom: 9,
62
- }}
63
- >
64
- <span style={{ color: r.fg, flexShrink: 0, display: 'inline-flex' }}>
65
- {icons.shield(17)}
66
- </span>
67
- <div style={{ flex: 1, minWidth: 0 }}>
68
- <div style={{ display: 'flex', alignItems: 'center', gap: 7 }}>
69
- <span
70
- style={{
71
- fontSize: 13,
72
- fontWeight: 600,
73
- color: 'hsl(var(--ink))',
74
- overflow: 'hidden',
75
- textOverflow: 'ellipsis',
76
- whiteSpace: 'nowrap',
77
- }}
78
- >
79
- {request.title}
80
- </span>
81
- <RiskPill tier={request.riskTier} size="xs" />
82
- </div>
83
- <div
84
- style={{
85
- fontSize: 11.5,
86
- color: 'hsl(var(--ink-3))',
87
- overflow: 'hidden',
88
- textOverflow: 'ellipsis',
89
- whiteSpace: 'nowrap',
90
- }}
91
- >
92
- {request.biomeName} · awaiting your approval
93
- </div>
94
- </div>
95
- {onReview && (
96
- <ApprovalButton variant="ghost" size="sm" onClick={onReview}>
97
- Review
98
- </ApprovalButton>
99
- )}
100
- <ApprovalButton
101
- variant="ghost"
102
- size="sm"
103
- onClick={() => onResolve(ApprovalDecision.Denied, request)}
104
- >
105
- Deny
106
- </ApprovalButton>
107
- <ApprovalButton
108
- variant="primary"
109
- size="sm"
110
- icon={icons.check(13)}
111
- accent={explicit ? r.fg : accent}
112
- onClick={() => onResolve(ApprovalDecision.Approved, request)}
113
- >
114
- Approve
115
- </ApprovalButton>
116
- </div>
117
- );
118
- }
@@ -1,111 +0,0 @@
1
- /**
2
- * Obligation chip + quorum dots.
3
- *
4
- * `Obligation` renders one obligation as a chip: host-supplied icon (via
5
- * `renderIcon` from the stable `ObligationIcon` key) + label + optional
6
- * pre-formatted mono value. An obligation whose `kind` is outside the
7
- * known `PolicyObligationKind` map fails SAFE to a visible "unknown"
8
- * chip (shield glyph + the raw kind) — never a silent drop.
9
- *
10
- * `QuorumDots` renders `have/need` approver dots (filled = collected).
11
- */
12
- import { OBLIGATION_DISPLAY, ObligationIcon } from './obligation-display';
13
-
14
- import type { ApprovalObligation } from './approval-model';
15
- import type { ReactElement, ReactNode } from 'react';
16
-
17
- export interface ObligationProps {
18
- readonly obligation: ApprovalObligation;
19
- /** Host icon renderer for a stable `ObligationIcon` key (kit is icon-agnostic). */
20
- readonly renderIcon: (key: ObligationIcon, size: number) => ReactNode;
21
- }
22
-
23
- export function Obligation({
24
- obligation,
25
- renderIcon,
26
- }: ObligationProps): ReactElement {
27
- // Known kinds resolve to a label + icon key; an unknown discriminant
28
- // (a not-yet-mapped kernel kind) renders a visible fallback rather than
29
- // disappearing — fail-fast, but on screen.
30
- const meta = OBLIGATION_DISPLAY[obligation.kind];
31
- const iconKey = meta?.iconKey ?? ObligationIcon.ShieldCheck;
32
- const label = meta?.label ?? `unknown: ${obligation.kind}`;
33
- return (
34
- <span
35
- style={{
36
- display: 'inline-flex',
37
- alignItems: 'center',
38
- gap: 5,
39
- padding: '3px 8px',
40
- borderRadius: 6,
41
- whiteSpace: 'nowrap',
42
- background: 'hsl(var(--muted))',
43
- border: '1px solid hsl(var(--rule))',
44
- fontSize: 11.5,
45
- color: 'hsl(var(--ink-2))',
46
- }}
47
- >
48
- <span style={{ color: 'hsl(var(--ink-3))', display: 'inline-flex' }}>
49
- {renderIcon(iconKey, 12)}
50
- </span>
51
- <span style={{ color: 'hsl(var(--ink-3))' }}>{label}</span>
52
- {obligation.value && (
53
- <span
54
- className="mono"
55
- style={{ fontSize: 11, color: 'hsl(var(--ink))', fontWeight: 500 }}
56
- >
57
- {obligation.value}
58
- </span>
59
- )}
60
- </span>
61
- );
62
- }
63
-
64
- export interface QuorumDotsProps {
65
- readonly have: number;
66
- readonly need: number;
67
- /** Host icon for the leading "users" glyph. */
68
- readonly usersIcon?: ReactNode;
69
- }
70
-
71
- export function QuorumDots({
72
- have,
73
- need,
74
- usersIcon,
75
- }: QuorumDotsProps): ReactElement {
76
- return (
77
- <span
78
- style={{
79
- display: 'inline-flex',
80
- alignItems: 'center',
81
- gap: 6,
82
- fontSize: 12,
83
- color: 'hsl(var(--ink-3))',
84
- }}
85
- >
86
- {usersIcon}
87
- <span style={{ display: 'inline-flex', gap: 3 }}>
88
- {Array.from({ length: need }).map((_, i) => {
89
- const filled = i < have;
90
- return (
91
- <span
92
- key={`quorum-${i}`}
93
- style={{
94
- width: 7,
95
- height: 7,
96
- borderRadius: '50%',
97
- background: filled ? 'hsl(var(--success))' : 'transparent',
98
- border: `1.5px solid ${
99
- filled ? 'hsl(var(--success))' : 'hsl(var(--rule-2))'
100
- }`,
101
- }}
102
- />
103
- );
104
- })}
105
- </span>
106
- <span className="mono" style={{ fontSize: 11 }}>
107
- {have}/{need} approvers
108
- </span>
109
- </span>
110
- );
111
- }
@@ -1,392 +0,0 @@
1
- /**
2
- * Scoped approval bodies — the biome-supplied typed detail
3
- * that renders UNDER the generic frame.
4
- *
5
- * `ScopedBody` is an EXHAUSTIVE switch over `ApprovalScopeKind`. A scope
6
- * whose `kind` is outside the closed set fails SAFE to a visible
7
- * "unknown scope" placeholder (it surfaces the raw kind) rather than
8
- * silently dropping the body — the same fail-fast-but-visible contract as
9
- * the unknown-obligation and unknown-chat-widget paths.
10
- *
11
- * Icon-agnostic: bodies that need a glyph take a `renderIcon` mapping a
12
- * stable `ScopeIcon` key to a host icon node.
13
- */
14
- import {
15
- ApprovalScopeKind,
16
- type ApprovalScope,
17
- type DeployScope,
18
- type FilesScope,
19
- type PaymentScope,
20
- type SlackScope,
21
- type SqlScope,
22
- } from './approval-model';
23
- import { ScopeIcon, type ScopeIconRenderer } from './scope-icons';
24
-
25
- import type { ReactElement, ReactNode } from 'react';
26
-
27
- export interface ScopedBodyProps {
28
- readonly scope: ApprovalScope;
29
- readonly renderIcon: ScopeIconRenderer;
30
- }
31
-
32
- export function ScopedBody({
33
- scope,
34
- renderIcon,
35
- }: ScopedBodyProps): ReactElement {
36
- switch (scope.kind) {
37
- case ApprovalScopeKind.Payment:
38
- return <PaymentBody s={scope} />;
39
- case ApprovalScopeKind.Sql:
40
- return <SqlBody s={scope} renderIcon={renderIcon} />;
41
- case ApprovalScopeKind.Slack:
42
- return <SlackBody s={scope} renderIcon={renderIcon} />;
43
- case ApprovalScopeKind.Deploy:
44
- return <DeployBody s={scope} renderIcon={renderIcon} />;
45
- case ApprovalScopeKind.Files:
46
- return <FilesBody s={scope} renderIcon={renderIcon} />;
47
- default:
48
- return <UnknownScopeBody scope={scope} />;
49
- }
50
- }
51
-
52
- /** Visible fallback for a scope kind the host does not (yet) understand. */
53
- function UnknownScopeBody({
54
- scope,
55
- }: Readonly<{ scope: { readonly kind: string } }>): ReactElement {
56
- return (
57
- <div
58
- style={{
59
- padding: '8px 11px',
60
- borderRadius: 7,
61
- border: '1px dashed hsl(var(--rule-2))',
62
- background: 'hsl(var(--muted))',
63
- fontSize: 12,
64
- color: 'hsl(var(--ink-3))',
65
- }}
66
- >
67
- Unknown approval detail{' '}
68
- <span className="mono" style={{ color: 'hsl(var(--ink-2))' }}>
69
- {scope.kind}
70
- </span>{' '}
71
- — this biome ships a scope kind this host build cannot render. Review
72
- the request before deciding.
73
- </div>
74
- );
75
- }
76
-
77
- function KV({
78
- k,
79
- v,
80
- mono,
81
- strong,
82
- }: Readonly<{
83
- k: string;
84
- v: ReactNode;
85
- mono?: boolean;
86
- strong?: boolean;
87
- }>): ReactElement {
88
- return (
89
- <div
90
- style={{
91
- display: 'flex',
92
- justifyContent: 'space-between',
93
- gap: 12,
94
- padding: '3px 0',
95
- }}
96
- >
97
- <span
98
- style={{ fontSize: 12, color: 'hsl(var(--ink-3))', whiteSpace: 'nowrap' }}
99
- >
100
- {k}
101
- </span>
102
- <span
103
- className={mono ? 'mono' : undefined}
104
- style={{
105
- fontSize: mono ? 12 : 12.5,
106
- color: 'hsl(var(--ink))',
107
- fontWeight: strong ? 600 : 450,
108
- textAlign: 'right',
109
- whiteSpace: 'nowrap',
110
- }}
111
- >
112
- {v}
113
- </span>
114
- </div>
115
- );
116
- }
117
-
118
- function PaymentBody({ s }: Readonly<{ s: PaymentScope }>): ReactElement {
119
- return (
120
- <div>
121
- <div style={{ marginBottom: 9 }}>
122
- <div
123
- className="serif"
124
- style={{
125
- fontSize: 27,
126
- fontWeight: 600,
127
- color: 'hsl(var(--ink))',
128
- lineHeight: 1.05,
129
- }}
130
- >
131
- {s.amount}
132
- </div>
133
- <div
134
- style={{ fontSize: 12.5, color: 'hsl(var(--ink-3))', marginTop: 2 }}
135
- >
136
- to {s.payee}
137
- </div>
138
- </div>
139
- <div style={{ borderTop: '1px solid hsl(var(--rule))', paddingTop: 4 }}>
140
- <KV k="Method" v={s.method} />
141
- <KV k="Account" v={s.account} mono />
142
- {s.memo && <KV k="Memo" v={s.memo} />}
143
- </div>
144
- </div>
145
- );
146
- }
147
-
148
- function SqlBody({
149
- s,
150
- renderIcon,
151
- }: Readonly<{ s: SqlScope; renderIcon: ScopeIconRenderer }>): ReactElement {
152
- return (
153
- <div>
154
- <div
155
- style={{ display: 'flex', gap: 8, marginBottom: 7, flexWrap: 'wrap' }}
156
- >
157
- <Tag icon={renderIcon(ScopeIcon.Database, 12)} t={s.dialect} />
158
- <Tag icon={renderIcon(ScopeIcon.Layers, 12)} t={s.table} />
159
- <Tag
160
- icon={renderIcon(ScopeIcon.Alert, 12)}
161
- t={`${s.rowsAffected} rows`}
162
- warn
163
- />
164
- </div>
165
- <pre
166
- className="mono"
167
- style={{
168
- margin: 0,
169
- padding: '10px 12px',
170
- background: 'hsl(var(--ink) / 0.04)',
171
- border: '1px solid hsl(var(--rule))',
172
- borderRadius: 8,
173
- fontSize: 12,
174
- lineHeight: 1.6,
175
- color: 'hsl(var(--ink))',
176
- overflowX: 'auto',
177
- whiteSpace: 'pre',
178
- }}
179
- >
180
- {s.query}
181
- </pre>
182
- </div>
183
- );
184
- }
185
-
186
- function SlackBody({
187
- s,
188
- renderIcon,
189
- }: Readonly<{ s: SlackScope; renderIcon: ScopeIconRenderer }>): ReactElement {
190
- return (
191
- <div>
192
- <div
193
- style={{
194
- display: 'flex',
195
- alignItems: 'center',
196
- gap: 8,
197
- marginBottom: 7,
198
- fontSize: 12.5,
199
- }}
200
- >
201
- <span style={{ color: 'hsl(var(--ink-3))', display: 'inline-flex' }}>
202
- {renderIcon(ScopeIcon.Send, 13)}
203
- </span>
204
- <span
205
- className="mono"
206
- style={{ color: 'hsl(var(--ink))', fontWeight: 600 }}
207
- >
208
- {s.channel}
209
- </span>
210
- <span style={{ color: 'hsl(var(--ink-4))' }}>
211
- · {s.workspace} · as {s.as}
212
- </span>
213
- </div>
214
- <div
215
- style={{
216
- padding: '10px 12px',
217
- background: 'hsl(var(--paper-elev))',
218
- border: '1px solid hsl(var(--rule))',
219
- borderRadius: 8,
220
- fontSize: 13,
221
- lineHeight: 1.55,
222
- color: 'hsl(var(--ink-2))',
223
- whiteSpace: 'pre-wrap',
224
- }}
225
- >
226
- {s.message}
227
- </div>
228
- </div>
229
- );
230
- }
231
-
232
- function DeployBody({
233
- s,
234
- renderIcon,
235
- }: Readonly<{ s: DeployScope; renderIcon: ScopeIconRenderer }>): ReactElement {
236
- return (
237
- <div>
238
- <div
239
- style={{
240
- display: 'flex',
241
- alignItems: 'center',
242
- gap: 8,
243
- marginBottom: 8,
244
- }}
245
- >
246
- <span
247
- className="mono serif"
248
- style={{ fontSize: 18, fontWeight: 600, color: 'hsl(var(--ink))' }}
249
- >
250
- {s.version}
251
- </span>
252
- <span style={{ color: 'hsl(var(--ink-4))', display: 'inline-flex' }}>
253
- {renderIcon(ScopeIcon.ArrowRight, 14)}
254
- </span>
255
- <Tag icon={renderIcon(ScopeIcon.Globe, 12)} t={s.cluster} warn />
256
- </div>
257
- <div style={{ display: 'flex', gap: 14, marginBottom: 8 }}>
258
- <Stat2 n={s.services} l="services" />
259
- <Stat2 n={s.migrations} l="migrations" warn />
260
- </div>
261
- <div style={{ display: 'flex', flexDirection: 'column', gap: 3 }}>
262
- {s.changelog.map((c) => (
263
- <div
264
- key={c}
265
- style={{
266
- display: 'flex',
267
- gap: 8,
268
- fontSize: 12,
269
- color: 'hsl(var(--ink-2))',
270
- }}
271
- >
272
- <span
273
- style={{
274
- marginTop: 7,
275
- width: 3,
276
- height: 3,
277
- borderRadius: '50%',
278
- background: 'hsl(var(--ink-4))',
279
- flexShrink: 0,
280
- }}
281
- />
282
- <span className="mono" style={{ fontSize: 11.5 }}>
283
- {c}
284
- </span>
285
- </div>
286
- ))}
287
- </div>
288
- </div>
289
- );
290
- }
291
-
292
- function FilesBody({
293
- s,
294
- renderIcon,
295
- }: Readonly<{ s: FilesScope; renderIcon: ScopeIconRenderer }>): ReactElement {
296
- return (
297
- <div style={{ display: 'flex', flexDirection: 'column', gap: 5 }}>
298
- {s.files.map((f) => (
299
- <div
300
- key={f.path}
301
- style={{
302
- display: 'flex',
303
- alignItems: 'center',
304
- gap: 9,
305
- padding: '5px 9px',
306
- background: 'hsl(var(--paper-elev))',
307
- border: '1px solid hsl(var(--rule))',
308
- borderRadius: 7,
309
- }}
310
- >
311
- <span style={{ color: 'hsl(var(--warning))', display: 'inline-flex' }}>
312
- {renderIcon(ScopeIcon.FileEdit, 13)}
313
- </span>
314
- <span
315
- className="mono"
316
- style={{
317
- fontSize: 12,
318
- color: 'hsl(var(--ink))',
319
- flex: 1,
320
- overflow: 'hidden',
321
- textOverflow: 'ellipsis',
322
- whiteSpace: 'nowrap',
323
- }}
324
- >
325
- {f.path}
326
- </span>
327
- <span
328
- className="mono"
329
- style={{ fontSize: 11, color: 'hsl(var(--success))' }}
330
- >
331
- +{f.add}
332
- </span>
333
- <span
334
- className="mono"
335
- style={{ fontSize: 11, color: 'hsl(var(--danger))' }}
336
- >
337
- −{f.del}
338
- </span>
339
- </div>
340
- ))}
341
- </div>
342
- );
343
- }
344
-
345
- function Tag({
346
- icon,
347
- t,
348
- warn,
349
- }: Readonly<{ icon: ReactNode; t: string; warn?: boolean }>): ReactElement {
350
- return (
351
- <span
352
- style={{
353
- display: 'inline-flex',
354
- alignItems: 'center',
355
- gap: 5,
356
- padding: '2px 8px',
357
- borderRadius: 6,
358
- fontSize: 11.5,
359
- background: warn ? 'hsl(var(--warning) / 0.1)' : 'hsl(var(--muted))',
360
- border: `1px solid ${
361
- warn ? 'hsl(var(--warning) / 0.3)' : 'hsl(var(--rule))'
362
- }`,
363
- color: warn ? 'hsl(var(--warning))' : 'hsl(var(--ink-2))',
364
- }}
365
- >
366
- {icon}
367
- {t}
368
- </span>
369
- );
370
- }
371
-
372
- function Stat2({
373
- n,
374
- l,
375
- warn,
376
- }: Readonly<{ n: number; l: string; warn?: boolean }>): ReactElement {
377
- return (
378
- <span style={{ display: 'inline-flex', alignItems: 'baseline', gap: 5 }}>
379
- <span
380
- className="serif"
381
- style={{
382
- fontSize: 18,
383
- fontWeight: 600,
384
- color: warn ? 'hsl(var(--warning))' : 'hsl(var(--ink))',
385
- }}
386
- >
387
- {n}
388
- </span>
389
- <span style={{ fontSize: 11.5, color: 'hsl(var(--ink-3))' }}>{l}</span>
390
- </span>
391
- );
392
- }
@@ -1,31 +0,0 @@
1
- /**
2
- * The icon contract for the approval surfaces. The kit is icon-agnostic
3
- * (it never imports an icon set), so the host supplies one bundle that
4
- * resolves every glyph the approval frame, scoped bodies, obligation
5
- * chips and Center need. Keeping it as a single typed bundle means a
6
- * consumer wires icons ONCE and passes it to every approval surface.
7
- */
8
- import type { ObligationIcon } from './obligation-display';
9
- import type { ScopeIcon } from './scope-icons';
10
- import type { ReactNode } from 'react';
11
-
12
- export interface ApprovalIcons {
13
- /** Map a stable obligation-chip glyph key → host icon node. */
14
- readonly obligation: (key: ObligationIcon, size: number) => ReactNode;
15
- /** Map a stable scoped-body glyph key → host icon node. */
16
- readonly scope: (key: ScopeIcon, size: number) => ReactNode;
17
- /** Frame: the "approval required" / approve shield. */
18
- readonly shield: (size: number) => ReactNode;
19
- /** Frame: capability-ref leading bolt. */
20
- readonly capability: (size: number) => ReactNode;
21
- /** Frame: approver-role person glyph. */
22
- readonly user: (size: number) => ReactNode;
23
- /** Quorum: multi-approver glyph. */
24
- readonly users: (size: number) => ReactNode;
25
- /** Resolved state: approved tick. */
26
- readonly approved: (size: number) => ReactNode;
27
- /** Resolved state: denied cross. */
28
- readonly denied: (size: number) => ReactNode;
29
- /** Generic small check (action buttons / Center). */
30
- readonly check: (size: number) => ReactNode;
31
- }