@xemahq/ui-kernel 0.11.1 → 0.11.2

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 (234) hide show
  1. package/package.json +1 -2
  2. package/src/index.ts +0 -17
  3. package/src/lib/biome-host/agent-validation.ts +0 -239
  4. package/src/lib/biome-host/biome-builders.ts +0 -112
  5. package/src/lib/biome-host/biome-mode.ts +0 -6
  6. package/src/lib/biome-host/biome-navigation.ts +0 -37
  7. package/src/lib/biome-host/biome-registry.ts +0 -299
  8. package/src/lib/biome-host/biome-scope-hooks.ts +0 -41
  9. package/src/lib/biome-host/biome-scope.tsx +0 -52
  10. package/src/lib/biome-host/biome-scoped-query.ts +0 -134
  11. package/src/lib/biome-host/create-biome-orval-config.ts +0 -82
  12. package/src/lib/biome-host/define-web-biome.spec.ts +0 -221
  13. package/src/lib/biome-host/define-web-biome.ts +0 -222
  14. package/src/lib/biome-host/errors.ts +0 -220
  15. package/src/lib/biome-host/frontend-biome.ts +0 -256
  16. package/src/lib/biome-host/host-bridge.ts +0 -281
  17. package/src/lib/biome-host/host-sources.ts +0 -54
  18. package/src/lib/biome-host/i18n-hooks.ts +0 -51
  19. package/src/lib/biome-host/i18n-port.test.ts +0 -50
  20. package/src/lib/biome-host/i18n-port.ts +0 -96
  21. package/src/lib/biome-host/index.ts +0 -35
  22. package/src/lib/biome-host/realtime-hooks.ts +0 -75
  23. package/src/lib/biome-host/realtime-port.ts +0 -115
  24. package/src/lib/biome-host/session-contributions.ts +0 -296
  25. package/src/lib/biome-host/use-mutation-with-error-toast.ts +0 -90
  26. package/src/lib/biome-host/use-page-state.ts +0 -248
  27. package/src/lib/capabilities/capability-context.ts +0 -25
  28. package/src/lib/capabilities/capability-provider.tsx +0 -73
  29. package/src/lib/capabilities/index.ts +0 -17
  30. package/src/lib/capabilities/types.ts +0 -69
  31. package/src/lib/capabilities/use-capability.ts +0 -79
  32. package/src/lib/contribution-registry/contribution-registry.spec.ts +0 -141
  33. package/src/lib/contribution-registry/contribution-registry.ts +0 -204
  34. package/src/lib/contribution-registry/index.ts +0 -9
  35. package/src/lib/contribution-registry/renderable-registry.ts +0 -142
  36. package/src/lib/system-bus/capability-invoke.ts +0 -92
  37. package/src/lib/system-bus/deeplink.ts +0 -210
  38. package/src/lib/system-bus/enums.ts +0 -86
  39. package/src/lib/system-bus/host-ports.ts +0 -93
  40. package/src/lib/system-bus/index.ts +0 -16
  41. package/src/lib/system-bus/intent-registry.ts +0 -109
  42. package/src/lib/system-bus/intents.ts +0 -113
  43. package/src/lib/system-bus/palette.ts +0 -78
  44. package/src/lib/system-bus/system-bus-builder.ts +0 -159
  45. package/src/lib/system-bus/system-bus.ts +0 -37
  46. package/src/lib/system-bus/windows.ts +0 -51
  47. package/src/offline/id.ts +0 -16
  48. package/src/offline/index.ts +0 -54
  49. package/src/offline/mutation.ts +0 -75
  50. package/src/offline/offline-status-badge.tsx +0 -51
  51. package/src/offline/online-controller.ts +0 -105
  52. package/src/offline/outbox.test.ts +0 -172
  53. package/src/offline/outbox.ts +0 -348
  54. package/src/offline/react-hooks.ts +0 -40
  55. package/src/offline/react.tsx +0 -32
  56. package/src/offline/storage.ts +0 -112
  57. package/src/offline/types.ts +0 -77
  58. package/src/org-db/components/DbResultTable.tsx +0 -176
  59. package/src/org-db/index.ts +0 -1
  60. package/src/pdf/index.ts +0 -11
  61. package/src/registry/index.ts +0 -9
  62. package/src/registry/lib/agent-validation-host.ts +0 -36
  63. package/src/registry/lib/biome-slot.tsx +0 -50
  64. package/src/registry/lib/biomes-enabled-context.ts +0 -20
  65. package/src/registry/lib/extension-points.ts +0 -134
  66. package/src/registry/lib/primitives/SessionEventCard.tsx +0 -164
  67. package/src/registry/lib/primitives/SessionEventTimeline.tsx +0 -95
  68. package/src/registry/lib/primitives/SessionMutationBar.tsx +0 -76
  69. package/src/registry/lib/primitives/SessionTabbedDrawer.tsx +0 -165
  70. package/src/registry/lib/primitives/index.ts +0 -18
  71. package/src/registry/lib/session-context-builder.ts +0 -84
  72. package/src/registry/lib/session-context-provider.tsx +0 -33
  73. package/src/registry/lib/session-context.ts +0 -21
  74. package/src/registry/lib/session-selectors.ts +0 -272
  75. package/src/session/comments/CommentRail.tsx +0 -164
  76. package/src/session/index.ts +0 -3
  77. package/src/session/lib/cn.ts +0 -11
  78. package/src/session/shell/SessionWorkspaceShell.tsx +0 -147
  79. package/src/session-kit/approvals/ApprovalButton.tsx +0 -89
  80. package/src/session-kit/approvals/ApprovalCard.tsx +0 -341
  81. package/src/session-kit/approvals/ApprovalsCenter.tsx +0 -336
  82. package/src/session-kit/approvals/CapabilityApprovalStickyBar.tsx +0 -118
  83. package/src/session-kit/approvals/Obligation.tsx +0 -111
  84. package/src/session-kit/approvals/ScopedBody.tsx +0 -392
  85. package/src/session-kit/approvals/approval-icons.ts +0 -31
  86. package/src/session-kit/approvals/approval-model.ts +0 -204
  87. package/src/session-kit/approvals/index.ts +0 -22
  88. package/src/session-kit/approvals/obligation-display.ts +0 -100
  89. package/src/session-kit/approvals/risk-accent.ts +0 -47
  90. package/src/session-kit/approvals/scope-icons.ts +0 -19
  91. package/src/session-kit/combobox/Combobox.tsx +0 -358
  92. package/src/session-kit/combobox/use-click-outside.ts +0 -21
  93. package/src/session-kit/display/ContextHeader.tsx +0 -148
  94. package/src/session-kit/display/FileDiffCard.tsx +0 -140
  95. package/src/session-kit/display/MD.tsx +0 -162
  96. package/src/session-kit/display/MessageTurn.tsx +0 -157
  97. package/src/session-kit/display/ThinkingPanel.tsx +0 -81
  98. package/src/session-kit/display/TodoChecklist.tsx +0 -120
  99. package/src/session-kit/display/TokenMeter.tsx +0 -89
  100. package/src/session-kit/display/ToolStrip.tsx +0 -278
  101. package/src/session-kit/display/TypingDots.tsx +0 -24
  102. package/src/session-kit/index.ts +0 -44
  103. package/src/session-kit/lib/enums.ts +0 -66
  104. package/src/session-kit/lib/portal-accent.ts +0 -30
  105. package/src/session-kit/lib/status-dot.ts +0 -68
  106. package/src/session-kit/primitives/Avatar.tsx +0 -44
  107. package/src/session-kit/primitives/PortalGlyph.tsx +0 -51
  108. package/src/session-kit/primitives/RiskPill.tsx +0 -95
  109. package/src/session-kit/primitives/ScopeDot.tsx +0 -47
  110. package/src/session-kit/primitives/Segmented.tsx +0 -71
  111. package/src/ui/branding/app-branding-context.ts +0 -20
  112. package/src/ui/branding/app-branding-provider.tsx +0 -123
  113. package/src/ui/branding/sanitize.ts +0 -89
  114. package/src/ui/breakpoints.ts +0 -14
  115. package/src/ui/capture/document-preview.tsx +0 -166
  116. package/src/ui/capture/field-spec-to-zod.test.ts +0 -81
  117. package/src/ui/capture/field-spec-to-zod.ts +0 -174
  118. package/src/ui/capture/field-spec-validate.ts +0 -236
  119. package/src/ui/capture/field-spec.test.ts +0 -49
  120. package/src/ui/capture/field-spec.ts +0 -274
  121. package/src/ui/capture/index.ts +0 -51
  122. package/src/ui/capture/schema-field-input.tsx +0 -620
  123. package/src/ui/capture/schema-form.tsx +0 -149
  124. package/src/ui/capture/submit-values.test.ts +0 -70
  125. package/src/ui/capture/submit-values.ts +0 -63
  126. package/src/ui/capture/use-prefill.ts +0 -186
  127. package/src/ui/capture/use-schema-validation.ts +0 -145
  128. package/src/ui/capture/use-wizard.ts +0 -180
  129. package/src/ui/capture/value-format.ts +0 -32
  130. package/src/ui/capture/wizard.tsx +0 -105
  131. package/src/ui/charts/bar-chart.tsx +0 -139
  132. package/src/ui/charts/chart-frame.tsx +0 -125
  133. package/src/ui/charts/chart-types.ts +0 -52
  134. package/src/ui/charts/chart-utils.ts +0 -190
  135. package/src/ui/charts/charts.test.tsx +0 -204
  136. package/src/ui/charts/donut-chart.tsx +0 -129
  137. package/src/ui/charts/index.ts +0 -27
  138. package/src/ui/charts/line-chart.tsx +0 -202
  139. package/src/ui/charts/sparkline.tsx +0 -109
  140. package/src/ui/chrome/AsyncBoundary.tsx +0 -74
  141. package/src/ui/chrome/EmptyState.tsx +0 -257
  142. package/src/ui/chrome/ErrorCard.tsx +0 -63
  143. package/src/ui/chrome/LoadingState.tsx +0 -61
  144. package/src/ui/chrome/PageHeader.tsx +0 -137
  145. package/src/ui/chrome/RecordCardList.tsx +0 -98
  146. package/src/ui/chrome/StateCard.tsx +0 -150
  147. package/src/ui/chrome/confirm-delete-dialog.tsx +0 -59
  148. package/src/ui/chrome/page-shell.spec.tsx +0 -117
  149. package/src/ui/chrome/page-shell.tsx +0 -221
  150. package/src/ui/chrome/scope-badge.tsx +0 -40
  151. package/src/ui/chrome/status-badge.tsx +0 -79
  152. package/src/ui/cn.ts +0 -32
  153. package/src/ui/design-tokens.ts +0 -372
  154. package/src/ui/hooks/use-debounced-value.ts +0 -16
  155. package/src/ui/hooks/use-is-mobile.ts +0 -28
  156. package/src/ui/index.ts +0 -110
  157. package/src/ui/pdf/pdf-preview.tsx +0 -122
  158. package/src/ui/primitives/alert-dialog.tsx +0 -104
  159. package/src/ui/primitives/async-combobox.tsx +0 -182
  160. package/src/ui/primitives/badge-variants.ts +0 -21
  161. package/src/ui/primitives/badge.tsx +0 -25
  162. package/src/ui/primitives/button-variants.ts +0 -31
  163. package/src/ui/primitives/button.tsx +0 -29
  164. package/src/ui/primitives/card.tsx +0 -43
  165. package/src/ui/primitives/checkbox.tsx +0 -26
  166. package/src/ui/primitives/collapsible.tsx +0 -9
  167. package/src/ui/primitives/dialog.tsx +0 -103
  168. package/src/ui/primitives/dropdown-menu.tsx +0 -179
  169. package/src/ui/primitives/form-stepper.tsx +0 -94
  170. package/src/ui/primitives/form-stepper.types.ts +0 -15
  171. package/src/ui/primitives/input.tsx +0 -22
  172. package/src/ui/primitives/label.tsx +0 -17
  173. package/src/ui/primitives/overflow-tabs.tsx +0 -331
  174. package/src/ui/primitives/popover.tsx +0 -33
  175. package/src/ui/primitives/preview-device-frame.tsx +0 -213
  176. package/src/ui/primitives/radio-group.tsx +0 -36
  177. package/src/ui/primitives/resizable.tsx +0 -67
  178. package/src/ui/primitives/scroll-area.tsx +0 -38
  179. package/src/ui/primitives/select.tsx +0 -143
  180. package/src/ui/primitives/separator.tsx +0 -20
  181. package/src/ui/primitives/sheet.tsx +0 -107
  182. package/src/ui/primitives/skeleton.tsx +0 -99
  183. package/src/ui/primitives/switch.tsx +0 -27
  184. package/src/ui/primitives/table.tsx +0 -72
  185. package/src/ui/primitives/tabs.tsx +0 -53
  186. package/src/ui/primitives/tag-multi-select.tsx +0 -261
  187. package/src/ui/primitives/textarea.tsx +0 -21
  188. package/src/ui/primitives/tooltip.tsx +0 -30
  189. package/src/ui/primitives/url-preview-chrome.tsx +0 -103
  190. package/src/vista/GenericCatalogueSurface.tsx +0 -179
  191. package/src/vista/SurfaceFallbackCard.tsx +0 -109
  192. package/src/vista/VistaPanel.tsx +0 -163
  193. package/src/vista/form-payload.spec.ts +0 -139
  194. package/src/vista/html/CustomUiFrame.spec.tsx +0 -127
  195. package/src/vista/html/CustomUiFrame.tsx +0 -206
  196. package/src/vista/html/custom-ui-frame-bridge.spec.ts +0 -191
  197. package/src/vista/html/custom-ui-frame-bridge.ts +0 -98
  198. package/src/vista/html/custom-ui-frame-contract.ts +0 -88
  199. package/src/vista/html/custom-ui-intents.spec.ts +0 -135
  200. package/src/vista/html/custom-ui-intents.ts +0 -155
  201. package/src/vista/html/custom-ui-srcdoc.spec.ts +0 -151
  202. package/src/vista/html/custom-ui-srcdoc.ts +0 -193
  203. package/src/vista/html/index.ts +0 -13
  204. package/src/vista/index.ts +0 -52
  205. package/src/vista/surface-catalogue.spec.ts +0 -140
  206. package/src/vista/surface-catalogue.ts +0 -90
  207. package/src/vista/surface-icons.ts +0 -57
  208. package/src/vista/surface-registry.ts +0 -56
  209. package/src/vista/surfaces/ChartSurface.tsx +0 -34
  210. package/src/vista/surfaces/FilesSurface.tsx +0 -202
  211. package/src/vista/surfaces/FormSurface.tsx +0 -380
  212. package/src/vista/surfaces/HtmlSurface.tsx +0 -43
  213. package/src/vista/surfaces/TableSurface.tsx +0 -100
  214. package/src/vista/surfaces/UrlSurface.tsx +0 -40
  215. package/src/vista/surfaces/blob-surfaces.tsx +0 -139
  216. package/src/vista/surfaces/elicitation-transport.spec.ts +0 -369
  217. package/src/vista/surfaces/elicitation-transport.ts +0 -367
  218. package/src/vista/surfaces/file-surface-utils.ts +0 -69
  219. package/src/vista/surfaces/index.ts +0 -24
  220. package/src/vista/surfaces/register-surfaces.tsx +0 -139
  221. package/src/vista/surfaces/text-surfaces.tsx +0 -132
  222. package/src/vista/use-vista-tabs.ts +0 -196
  223. package/src/vista/vista-code-renderer-context.ts +0 -16
  224. package/src/vista/vista-code-renderer.tsx +0 -35
  225. package/src/vista/vista-file-context.ts +0 -14
  226. package/src/vista/vista-file-source.tsx +0 -141
  227. package/src/vista/vista-form-context.ts +0 -20
  228. package/src/vista/vista-form-host.tsx +0 -48
  229. package/src/vista/vista-model.ts +0 -137
  230. package/src/vista/vista-open-context.tsx +0 -27
  231. package/src/vista/vista-open-state.ts +0 -11
  232. package/src/vista/vista-payloads.ts +0 -635
  233. package/src/vista/vista-tabs-manifest.ts +0 -138
  234. package/src/vista/vista-tools.ts +0 -232
@@ -1,204 +0,0 @@
1
- /**
2
- * Approval primitive — generic frame model + scoped-body payloads.
3
- *
4
- * The approval is the runtime face of a kernel policy decision: a
5
- * capability call returns `allow | deny | needs_approval`
6
- * (`PolicyDecisionKind`); on `needs_approval` the gateway suspends the
7
- * call and renders a TYPED approval. The frame is identical platform-wide
8
- * (risk pill + capability ref + obligations + quorum + actions); each
9
- * biome supplies a typed `scope` body for rich detail — the same
10
- * generic-frame + biome-body pattern as the in-chat widget registry
11
- * and the preview-tab kinds.
12
- *
13
- * This module REUSES the kernel contracts rather than redefining them:
14
- * • `CapabilityRiskTier` (low/medium/high/critical) — risk pill + accent
15
- * • `PolicyObligationKind` (the closed 9-kind taxonomy) — obligation chips
16
- * • `CapabilityRef` (`domain.biome/action@v` mono ref)
17
- * It only ADDS the two things the kernel has no opinion on: the closed
18
- * `ApprovalScopeKind` set + its discriminated scope-payload union (the
19
- * biome-supplied detail), and the binary `ApprovalDecision` the surfaces
20
- * emit. Both are presentation contracts, not policy contracts.
21
- */
22
- import type { CapabilityRiskTier } from '@xemahq/kernel-contracts/capability';
23
- import type { PolicyObligationKind } from '@xemahq/kernel-contracts/policy';
24
-
25
- /**
26
- * Closed set of biome-supplied scoped-body kinds. This is the
27
- * approval analogue of `ChatWidgetKind` — a typed, versioned catalogue of
28
- * rich bodies that render UNDER the generic frame. The renderer
29
- * (`ScopedBody`) switches on `kind`; an unknown kind fails SAFE to a
30
- * visible "unknown scope" rendering rather than a silent drop.
31
- *
32
- * First-party kinds ship here; a biome registers a custom kind the same
33
- * way it registers a chat widget (backend-defined, versioned). Extend the
34
- * enum + add a body component + a `union` member in lockstep — never match
35
- * on a free-form string.
36
- */
37
- export enum ApprovalScopeKind {
38
- Payment = 'payment',
39
- Sql = 'sql',
40
- Slack = 'slack',
41
- Deploy = 'deploy',
42
- Files = 'files',
43
- }
44
-
45
- /** Disbursement / payment scope (finance biomes). */
46
- export interface PaymentScope {
47
- readonly kind: ApprovalScopeKind.Payment;
48
- /** Pre-formatted display amount (e.g. `$18,400.00`). */
49
- readonly amount: string;
50
- readonly payee: string;
51
- /** Payment rail, e.g. `ACH wire`. */
52
- readonly method: string;
53
- /** Masked account, e.g. `•••• 7741`. */
54
- readonly account: string;
55
- readonly memo?: string;
56
- }
57
-
58
- /** Write-query scope (data-warehouse biomes). */
59
- export interface SqlScope {
60
- readonly kind: ApprovalScopeKind.Sql;
61
- readonly dialect: string;
62
- readonly table: string;
63
- /** Pre-formatted affected-row estimate (e.g. `≈ 1,240`). */
64
- readonly rowsAffected: string;
65
- readonly query: string;
66
- }
67
-
68
- /** Outbound message scope (chat / outreach biomes). */
69
- export interface SlackScope {
70
- readonly kind: ApprovalScopeKind.Slack;
71
- readonly channel: string;
72
- readonly workspace: string;
73
- /** The identity the message is posted as (e.g. `@sales-bot`). */
74
- readonly as: string;
75
- readonly message: string;
76
- }
77
-
78
- /** Production-deploy scope (release biomes). */
79
- export interface DeployScope {
80
- readonly kind: ApprovalScopeKind.Deploy;
81
- readonly version: string;
82
- readonly cluster: string;
83
- readonly services: number;
84
- readonly migrations: number;
85
- readonly changelog: readonly string[];
86
- }
87
-
88
- /** A single changed file with line deltas. */
89
- export interface ApprovalFileChange {
90
- readonly path: string;
91
- readonly add: number;
92
- readonly del: number;
93
- }
94
-
95
- /** Working-tree write scope (software-dev biomes). */
96
- export interface FilesScope {
97
- readonly kind: ApprovalScopeKind.Files;
98
- readonly files: readonly ApprovalFileChange[];
99
- }
100
-
101
- /**
102
- * Discriminated union of every first-party scope payload. The `kind`
103
- * discriminant maps 1:1 onto `ApprovalScopeKind`; `ScopedBody` is an
104
- * exhaustive switch over it with a safe fallback for unknown kinds (so a
105
- * biome that ships a not-yet-known scope renders a visible placeholder
106
- * instead of crashing or silently dropping the body).
107
- */
108
- export type ApprovalScope =
109
- | PaymentScope
110
- | SqlScope
111
- | SlackScope
112
- | DeployScope
113
- | FilesScope;
114
-
115
- /**
116
- * A rendered obligation — the `PolicyObligationKind` discriminant plus a
117
- * pre-formatted display value the producer derived from the typed kernel
118
- * `PolicyObligation` payload (e.g. `max-cost-usd` → `$25,000`,
119
- * `max-duration-seconds` → `30s`). The kit deliberately takes a formatted
120
- * `value` string rather than the raw typed payload so the chip stays
121
- * presentation-only; the host's `obligationDisplay` helper does the
122
- * typed→display mapping from the wire `PolicyObligation`.
123
- */
124
- export interface ApprovalObligation {
125
- readonly kind: PolicyObligationKind;
126
- /** Pre-formatted display value for the chip's trailing mono span. */
127
- readonly value?: string;
128
- }
129
-
130
- /**
131
- * The generic approval request — the envelope every surface (inline card,
132
- * sticky bar, Center row) renders. Field names mirror the kernel/wire
133
- * shape so the backend approval envelope (capability ref, riskTier,
134
- * obligations[], requireRole, requireApproverCount, approvalsIn, scope)
135
- * maps onto it 1:1.
136
- */
137
- export interface ApprovalRequest {
138
- /** Stable id of the suspended invocation awaiting approval. */
139
- readonly id: string;
140
- /** Capability ref (`domain.biome/action@v`) rendered mono in the frame. */
141
- readonly capability: string;
142
- /** Owning biome id + display name (the scoped body's provenance). */
143
- readonly biomeId: string;
144
- readonly biomeName: string;
145
- /** Serif title + one-line summary (the generic frame's headline). */
146
- readonly title: string;
147
- readonly summary: string;
148
- /** Kernel risk tier — drives the pill + accent + low/critical action set. */
149
- readonly riskTier: CapabilityRiskTier;
150
- /** Obligations rendered as chips (closed `PolicyObligationKind` taxonomy). */
151
- readonly obligations?: readonly ApprovalObligation[];
152
- /** Approver role required by the matched `ApprovalRule`, if any. */
153
- readonly requireRole?: string;
154
- /** Quorum size; `1` (or absent) = single-approver. */
155
- readonly requireApproverCount?: number;
156
- /** Approvals already collected toward the quorum. */
157
- readonly approvalsIn?: number;
158
- /** Biome-supplied typed scope body. */
159
- readonly scope: ApprovalScope;
160
- }
161
-
162
- /**
163
- * Binary surface decision. Closed set — never a free-form string. The
164
- * "allow once" vs "approve & remember" distinction is a UI affordance on
165
- * top of the same `Approved` decision (the remember flag is carried
166
- * separately when the backend supports it); both resolve the suspended
167
- * call. The denied/override-rationale path is not yet implemented.
168
- */
169
- export enum ApprovalDecision {
170
- Approved = 'approved',
171
- Denied = 'denied',
172
- }
173
-
174
- /**
175
- * A pending approval as it appears in the cross-portal Approvals Center —
176
- * the request plus the portal/session context it was raised in. The
177
- * portal fields are first-class so the Portals surface can batch and group
178
- * approvals across portals without reshaping this model.
179
- */
180
- export interface ApprovalCenterItem {
181
- /** Mirrors `request.id`; kept distinct so a Center may track its own row id. */
182
- readonly id: string;
183
- readonly request: ApprovalRequest;
184
- /** Portal the approval was raised in (cross-portal context). */
185
- readonly portalId?: string;
186
- readonly portalName?: string;
187
- /** Portal accent token (`var(--p-*)`) for the row glyph; optional. */
188
- readonly portalAccentVar?: `var(--${string})`;
189
- /** Session the suspended capability belongs to ("Open session"). */
190
- readonly sessionId?: string;
191
- readonly sessionTitle?: string;
192
- }
193
-
194
- /** True when the tier always demands an explicit Approve (no allow-once). */
195
- export function isExplicitApprovalTier(tier: CapabilityRiskTier): boolean {
196
- // `critical` and `high` are explicit-only (critical always
197
- // explicit; high uses the warning accent and skips allow-once-remember).
198
- return tier === 'critical' || tier === 'high';
199
- }
200
-
201
- /** True when the request carries a multi-approver quorum. */
202
- export function isQuorum(req: ApprovalRequest): boolean {
203
- return (req.requireApproverCount ?? 1) > 1;
204
- }
@@ -1,22 +0,0 @@
1
- /**
2
- * `@xemahq/ui-kernel/session-kit` approvals — the generic approval
3
- * primitive.
4
- *
5
- * Generic frame + scoped bodies + sticky bar + Approvals Center. Models on
6
- * the kernel contracts (`CapabilityRiskTier`, `PolicyObligationKind`) and
7
- * adds only the presentation contracts the kernel has no opinion on
8
- * (`ApprovalScopeKind` + scope union, `ApprovalDecision`). Every component
9
- * is icon-agnostic and prop-driven — the host supplies the icon bundle and
10
- * the data.
11
- */
12
- export * from './approval-model';
13
- export * from './obligation-display';
14
- export * from './scope-icons';
15
- export * from './risk-accent';
16
- export * from './approval-icons';
17
- export * from './ApprovalButton';
18
- export * from './Obligation';
19
- export * from './ScopedBody';
20
- export * from './ApprovalCard';
21
- export * from './CapabilityApprovalStickyBar';
22
- export * from './ApprovalsCenter';
@@ -1,100 +0,0 @@
1
- /**
2
- * Obligation → display metadata map.
3
- *
4
- * Covers ALL NINE obligation kinds in the kernel closed taxonomy —
5
- * `audit`, `redact-secrets`, `require-runner-kind`,
6
- * `require-human-approval`, `max-duration-seconds`, `max-cost-usd`,
7
- * `restrict-output-classification`, `data-residency`, `egress-allowlist`.
8
- *
9
- * The map is typed `Record<PolicyObligationKind, …>` so it is EXHAUSTIVE
10
- * over the installed kernel enum: adding a new `PolicyObligationKind`
11
- * member is a COMPILE ERROR here until it gets a label + icon key. The
12
- * published `@xemahq/kernel-contracts` enum now ships all nine members
13
- * (incl. `egress-allowlist`), so every kind is keyed directly by its enum
14
- * value — no literal-wire fallback is needed.
15
- *
16
- * The kit is icon-agnostic: this module names a stable `iconKey`
17
- * (`ObligationIcon`) and the host translates it into a concrete icon node
18
- * via the `Obligation`/`renderIcon` prop. No icon dependency leaks into
19
- * the kernel package.
20
- */
21
- import { PolicyObligationKind } from '@xemahq/kernel-contracts/policy';
22
-
23
- /**
24
- * Stable, icon-set-agnostic glyph keys for obligation chips. The host
25
- * maps each onto a concrete icon (lucide, etc.); the kit never imports an
26
- * icon set. Closed set — one key per obligation family.
27
- */
28
- export enum ObligationIcon {
29
- Dollar = 'dollar',
30
- ShieldCheck = 'shield-check',
31
- Scroll = 'scroll',
32
- Eye = 'eye',
33
- Clock = 'clock',
34
- Layers = 'layers',
35
- Globe = 'globe',
36
- Lock = 'lock',
37
- Network = 'network',
38
- }
39
-
40
- export interface ObligationDisplayMeta {
41
- readonly iconKey: ObligationIcon;
42
- readonly label: string;
43
- }
44
-
45
- /**
46
- * Chip metadata for every member of the kernel `PolicyObligationKind`
47
- * enum. Typed as `Record<PolicyObligationKind, …>` so adding a new kernel
48
- * enum member is a COMPILE ERROR here until it gets a label + icon key —
49
- * the exhaustiveness guarantee.
50
- */
51
- const ENUM_OBLIGATION_DISPLAY: Record<
52
- PolicyObligationKind,
53
- ObligationDisplayMeta
54
- > = {
55
- [PolicyObligationKind.MaxCostUsd]: {
56
- iconKey: ObligationIcon.Dollar,
57
- label: 'Spend cap',
58
- },
59
- [PolicyObligationKind.RequireHumanApproval]: {
60
- iconKey: ObligationIcon.ShieldCheck,
61
- label: 'Human approval',
62
- },
63
- [PolicyObligationKind.Audit]: {
64
- iconKey: ObligationIcon.Scroll,
65
- label: 'Audited',
66
- },
67
- [PolicyObligationKind.RestrictOutputClassification]: {
68
- iconKey: ObligationIcon.Eye,
69
- label: 'Output limited',
70
- },
71
- [PolicyObligationKind.MaxDurationSeconds]: {
72
- iconKey: ObligationIcon.Clock,
73
- label: 'Time cap',
74
- },
75
- [PolicyObligationKind.RequireRunnerKind]: {
76
- iconKey: ObligationIcon.Layers,
77
- label: 'Runner',
78
- },
79
- [PolicyObligationKind.DataResidency]: {
80
- iconKey: ObligationIcon.Globe,
81
- label: 'Residency',
82
- },
83
- [PolicyObligationKind.RedactSecrets]: {
84
- iconKey: ObligationIcon.Lock,
85
- label: 'Redacted',
86
- },
87
- [PolicyObligationKind.EgressAllowlist]: {
88
- iconKey: ObligationIcon.Network,
89
- label: 'Egress',
90
- },
91
- };
92
-
93
- /**
94
- * The authoritative obligation-kind → chip metadata map, keyed by the
95
- * obligation wire-string. Exhaustive over the installed kernel enum via
96
- * `ENUM_OBLIGATION_DISPLAY` (compile-checked).
97
- */
98
- export const OBLIGATION_DISPLAY: Record<string, ObligationDisplayMeta> = {
99
- ...ENUM_OBLIGATION_DISPLAY,
100
- };
@@ -1,47 +0,0 @@
1
- /**
2
- * Risk-tier → colour expressions for the approval frame's accent rail and
3
- * the sticky bar. RiskPill owns the PILL styling; this map is
4
- * the matching surface accent (foreground / soft background / border) the
5
- * frame and bar paint with. Both read the SAME kernel `CapabilityRiskTier`
6
- * enum so the pill and the rail can never disagree on a tier's colour.
7
- *
8
- * low → ink / muted (quiet)
9
- * medium → --info
10
- * high → --warning
11
- * critical → --destructive / --danger
12
- */
13
- import { CapabilityRiskTier } from '@xemahq/kernel-contracts/capability';
14
-
15
- export interface RiskAccent {
16
- /** Solid accent (rail, icon, critical button). */
17
- readonly fg: string;
18
- /** Soft tinted background (sticky bar surface). */
19
- readonly bg: string;
20
- /** Border (sticky bar, critical card outline). */
21
- readonly bd: string;
22
- }
23
-
24
- const DANGER = 'var(--destructive, var(--danger))';
25
-
26
- export const RISK_ACCENT: Record<CapabilityRiskTier, RiskAccent> = {
27
- [CapabilityRiskTier.Low]: {
28
- fg: 'hsl(var(--ink-3))',
29
- bg: 'hsl(var(--muted))',
30
- bd: 'hsl(var(--rule))',
31
- },
32
- [CapabilityRiskTier.Medium]: {
33
- fg: 'hsl(var(--info))',
34
- bg: 'hsl(var(--info) / 0.07)',
35
- bd: 'hsl(var(--info) / 0.28)',
36
- },
37
- [CapabilityRiskTier.High]: {
38
- fg: 'hsl(var(--warning))',
39
- bg: 'hsl(var(--warning) / 0.08)',
40
- bd: 'hsl(var(--warning) / 0.3)',
41
- },
42
- [CapabilityRiskTier.Critical]: {
43
- fg: `hsl(${DANGER})`,
44
- bg: `hsl(${DANGER} / 0.07)`,
45
- bd: `hsl(${DANGER} / 0.32)`,
46
- },
47
- };
@@ -1,19 +0,0 @@
1
- /**
2
- * Stable, icon-set-agnostic glyph keys used by the scoped approval bodies
3
- * (`ScopedBody`). Kept in its own module (not alongside the body
4
- * components) so the icon bundle and the bodies can both import it without
5
- * a component file also exporting a non-component value.
6
- */
7
- import type { ReactNode } from 'react';
8
-
9
- export enum ScopeIcon {
10
- Database = 'database',
11
- Layers = 'layers',
12
- Alert = 'alert',
13
- Send = 'send',
14
- Globe = 'globe',
15
- ArrowRight = 'arrow-right',
16
- FileEdit = 'file-edit',
17
- }
18
-
19
- export type ScopeIconRenderer = (key: ScopeIcon, size: number) => ReactNode;