@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,95 +0,0 @@
1
- /**
2
- * Generic event timeline a biome can use to render a stream of its
3
- * own events inside a custom surface — e.g. a "Deploys" panel that
4
- * lists deploy attempts the same way the session console lists tool
5
- * calls. Biomes keep ownership of the data model; this primitive
6
- * supplies the scroll behaviour, auto-stick-to-bottom, and consistent
7
- * spacing.
8
- *
9
- * The primitive does NOT subscribe to the biome registry or any SSE
10
- * stream — callers pass in an items array. Auto-scroll-to-latest
11
- * fires only when the user is already pinned to the bottom; if they
12
- * scrolled up to read history we stay parked so live events don't
13
- * yank context away.
14
- */
15
- import {
16
- type CSSProperties,
17
- type ReactElement,
18
- type ReactNode,
19
- useEffect,
20
- useLayoutEffect,
21
- useRef,
22
- useState,
23
- } from 'react';
24
-
25
- export interface SessionEventTimelineProps<TItem> {
26
- readonly items: readonly TItem[];
27
- readonly getKey: (item: TItem) => string;
28
- readonly renderItem: (item: TItem) => ReactNode;
29
- /** Banner above the list (e.g. "stream recovering…"). */
30
- readonly banner?: ReactNode;
31
- /** Empty state when `items.length === 0`. */
32
- readonly empty?: ReactNode;
33
- /** Pixel threshold for "pinned to bottom" detection. Default 32. */
34
- readonly stickThreshold?: number;
35
- readonly style?: CSSProperties;
36
- readonly className?: string;
37
- }
38
-
39
- export function SessionEventTimeline<TItem>({
40
- items,
41
- getKey,
42
- renderItem,
43
- banner,
44
- empty,
45
- stickThreshold = 32,
46
- style,
47
- className,
48
- }: SessionEventTimelineProps<TItem>): ReactElement {
49
- const scrollRef = useRef<HTMLDivElement>(null);
50
- const [stuckToBottom, setStuckToBottom] = useState(true);
51
-
52
- useEffect(() => {
53
- const node = scrollRef.current;
54
- if (!node) {
55
- return;
56
- }
57
- const handler = () => {
58
- const distanceFromBottom =
59
- node.scrollHeight - node.scrollTop - node.clientHeight;
60
- setStuckToBottom(distanceFromBottom < stickThreshold);
61
- };
62
- node.addEventListener('scroll', handler, { passive: true });
63
- return () => node.removeEventListener('scroll', handler);
64
- }, [stickThreshold]);
65
-
66
- useLayoutEffect(() => {
67
- if (!stuckToBottom) {
68
- return;
69
- }
70
- const node = scrollRef.current;
71
- if (!node) {
72
- return;
73
- }
74
- node.scrollTop = node.scrollHeight;
75
- }, [items, stuckToBottom]);
76
-
77
- return (
78
- <div
79
- ref={scrollRef}
80
- className={className}
81
- style={{
82
- height: '100%',
83
- overflowY: 'auto',
84
- padding: '8px 4px',
85
- ...style,
86
- }}
87
- >
88
- {banner}
89
- {items.length === 0 && empty}
90
- {items.map((item) => (
91
- <div key={getKey(item)}>{renderItem(item)}</div>
92
- ))}
93
- </div>
94
- );
95
- }
@@ -1,76 +0,0 @@
1
- /**
2
- * Generic sticky strip a biome can use as a session-level status row
3
- * (linked Jira ticket, AWS deploy state, git branch, …). Wraps the
4
- * biome's content in the host's editorial chrome — rule border,
5
- * paper-elev background, consistent padding — so bars contributed by
6
- * different biomes look like one product surface even when authored
7
- * independently.
8
- *
9
- * The primitive is intentionally style-agnostic at the JS layer: it
10
- * inlines CSS-variable references so it works against any host whose
11
- * design system publishes `--paper-elev` / `--rule` / `--ink` on
12
- * `:root`. Tailwind classes are NOT used because biomes must work
13
- * across hosts whose CSS pipelines differ.
14
- */
15
- import { type CSSProperties, type ReactNode, type ReactElement } from 'react';
16
-
17
- export type SessionMutationBarTone = 'default' | 'accent' | 'warning' | 'destructive';
18
-
19
- const TONE_STYLES: Record<SessionMutationBarTone, CSSProperties> = {
20
- default: {
21
- background: 'hsl(var(--paper-elev, 0 0% 100%))',
22
- borderBottom: '1px solid hsl(var(--rule, 40 14% 86%))',
23
- },
24
- accent: {
25
- background: 'hsl(var(--accent-tint, 230 50% 96%))',
26
- borderBottom: '1px solid hsl(var(--rule, 40 14% 86%))',
27
- color: 'hsl(var(--accent-ink, 230 50% 30%))',
28
- },
29
- warning: {
30
- background: 'hsl(var(--warning, 32 80% 50%) / 0.10)',
31
- borderBottom: '1px solid hsl(var(--warning, 32 80% 50%) / 0.30)',
32
- color: 'hsl(var(--ink, 228 14% 11%))',
33
- },
34
- destructive: {
35
- background: 'hsl(var(--destructive, 8 70% 50%) / 0.10)',
36
- borderBottom: '1px solid hsl(var(--destructive, 8 70% 50%) / 0.30)',
37
- color: 'hsl(var(--ink, 228 14% 11%))',
38
- },
39
- };
40
-
41
- export interface SessionMutationBarProps {
42
- readonly tone?: SessionMutationBarTone;
43
- readonly children: ReactNode;
44
- /**
45
- * Extra inline styles merged on top of the tone styles. Use for one-off
46
- * sizing tweaks; do not override `background` or `borderBottom` here
47
- * because that defeats the visual-consistency point of the primitive.
48
- */
49
- readonly style?: CSSProperties;
50
- /** Optional className passthrough for hosts that DO use Tailwind. */
51
- readonly className?: string;
52
- }
53
-
54
- export function SessionMutationBar({
55
- tone = 'default',
56
- children,
57
- style,
58
- className,
59
- }: SessionMutationBarProps): ReactElement {
60
- return (
61
- <div
62
- className={className}
63
- style={{
64
- ...TONE_STYLES[tone],
65
- padding: '6px 12px',
66
- fontSize: 13,
67
- display: 'flex',
68
- alignItems: 'center',
69
- gap: 8,
70
- ...style,
71
- }}
72
- >
73
- {children}
74
- </div>
75
- );
76
- }
@@ -1,165 +0,0 @@
1
- /**
2
- * Generic tabbed drawer primitive a biome can use to build its own
3
- * inspector surface — same shape as the host's session secondary
4
- * drawer (tab strip across the top, switch-bodies below). Biome
5
- * authors compose this when their biome owns a side surface that
6
- * isn't part of the canonical session drawer.
7
- *
8
- * Headless on purpose: this primitive does NOT own a Dialog wrapper.
9
- * Biomes decide whether to mount it inside their own dialog, a
10
- * resizable panel, or inline — the only behaviour the primitive
11
- * guarantees is "render exactly one tab body at a time, with a
12
- * shared tab strip and keyboard navigation".
13
- */
14
- import {
15
- type CSSProperties,
16
- type ReactElement,
17
- type ReactNode,
18
- useEffect,
19
- useMemo,
20
- useState,
21
- } from 'react';
22
-
23
- export interface SessionTabbedDrawerTab {
24
- readonly id: string;
25
- readonly label: ReactNode;
26
- readonly icon?: ReactNode;
27
- readonly badge?: ReactNode;
28
- readonly render: () => ReactNode;
29
- }
30
-
31
- export interface SessionTabbedDrawerProps {
32
- readonly tabs: readonly SessionTabbedDrawerTab[];
33
- readonly initialTabId?: string;
34
- readonly activeTabId?: string;
35
- readonly onActiveTabChange?: (id: string) => void;
36
- /**
37
- * When true, ⌘1..⌘N / Ctrl+1..N selects the corresponding tab while
38
- * the drawer is mounted. Defaults to true.
39
- */
40
- readonly enableKeyboardShortcuts?: boolean;
41
- readonly style?: CSSProperties;
42
- readonly className?: string;
43
- }
44
-
45
- export function SessionTabbedDrawer({
46
- tabs,
47
- initialTabId,
48
- activeTabId,
49
- onActiveTabChange,
50
- enableKeyboardShortcuts = true,
51
- style,
52
- className,
53
- }: SessionTabbedDrawerProps): ReactElement {
54
- const fallbackTabId = initialTabId ?? tabs[0]?.id ?? '';
55
- const [internalActive, setInternalActive] = useState<string>(fallbackTabId);
56
- const effectiveActive = activeTabId ?? internalActive;
57
-
58
- const select = useMemo(() => {
59
- return (id: string) => {
60
- if (activeTabId === undefined) {
61
- setInternalActive(id);
62
- }
63
- onActiveTabChange?.(id);
64
- };
65
- }, [activeTabId, onActiveTabChange]);
66
-
67
- useEffect(() => {
68
- if (!enableKeyboardShortcuts) {
69
- return;
70
- }
71
- const handler = (event: KeyboardEvent) => {
72
- if (!(event.metaKey || event.ctrlKey)) {
73
- return;
74
- }
75
- const idx = Number.parseInt(event.key, 10);
76
- if (Number.isNaN(idx) || idx < 1 || idx > tabs.length) {
77
- return;
78
- }
79
- const target = tabs[idx - 1];
80
- if (!target) {
81
- return;
82
- }
83
- event.preventDefault();
84
- select(target.id);
85
- };
86
- window.addEventListener('keydown', handler);
87
- return () => window.removeEventListener('keydown', handler);
88
- }, [enableKeyboardShortcuts, tabs, select]);
89
-
90
- const active = tabs.find((tab) => tab.id === effectiveActive) ?? tabs[0];
91
-
92
- return (
93
- <div
94
- className={className}
95
- style={{
96
- display: 'flex',
97
- flexDirection: 'column',
98
- height: '100%',
99
- minHeight: 0,
100
- ...style,
101
- }}
102
- >
103
- <div
104
- role="tablist"
105
- style={{
106
- display: 'flex',
107
- alignItems: 'center',
108
- gap: 4,
109
- padding: '8px 16px 0',
110
- borderBottom: '1px solid hsl(var(--rule, 40 14% 86%))',
111
- overflowX: 'auto',
112
- }}
113
- >
114
- {tabs.map((tab, idx) => {
115
- const isActive = tab.id === active?.id;
116
- return (
117
- <button
118
- key={tab.id}
119
- type="button"
120
- role="tab"
121
- aria-selected={isActive}
122
- onClick={() => select(tab.id)}
123
- title={`${typeof tab.label === 'string' ? tab.label : 'Tab'} (⌘${idx + 1})`}
124
- style={{
125
- position: 'relative',
126
- display: 'inline-flex',
127
- alignItems: 'center',
128
- gap: 6,
129
- padding: '8px 12px',
130
- fontSize: 13,
131
- background: 'transparent',
132
- border: 'none',
133
- cursor: 'pointer',
134
- color: isActive
135
- ? 'hsl(var(--ink, 228 14% 11%))'
136
- : 'hsl(var(--ink-3, 228 6% 40%))',
137
- whiteSpace: 'nowrap',
138
- }}
139
- >
140
- {tab.icon}
141
- {tab.label}
142
- {tab.badge}
143
- {isActive && (
144
- <span
145
- aria-hidden
146
- style={{
147
- position: 'absolute',
148
- inset: '0 4px -1px',
149
- top: 'auto',
150
- height: 2,
151
- background: 'hsl(var(--primary, 230 50% 45%))',
152
- borderRadius: 1,
153
- }}
154
- />
155
- )}
156
- </button>
157
- );
158
- })}
159
- </div>
160
- <div style={{ flex: 1, minHeight: 0, overflow: 'auto' }}>
161
- {active?.render()}
162
- </div>
163
- </div>
164
- );
165
- }
@@ -1,18 +0,0 @@
1
- /**
2
- * Reusable session-shell primitives exported from the SDK so biome
3
- * authors can compose the same UI vocabulary the host shell uses —
4
- * mutation bars, event cards, event timelines, tabbed drawers —
5
- * without forking the host or rebuilding the editorial chrome from
6
- * scratch.
7
- *
8
- * Every primitive in this directory:
9
- * - Is style-portable (inline styles + CSS-variable tokens; no
10
- * Tailwind dependency).
11
- * - Has zero registry subscriptions (biomes pass data in).
12
- * - Composes with the host's session shell as well as with a
13
- * biome's own bespoke surfaces.
14
- */
15
- export * from './SessionEventCard';
16
- export * from './SessionEventTimeline';
17
- export * from './SessionMutationBar';
18
- export * from './SessionTabbedDrawer';
@@ -1,84 +0,0 @@
1
- /**
2
- * Single helper hook the host's session shell calls once per render to
3
- * build the `SessionContext` it passes into every contribution selector.
4
- *
5
- * Inputs are the host's session fields plus the resolved Agent projection.
6
- * The helper freezes capability refs and returns a stable `SessionContext`.
7
- * It never fabricates a profile or capability fallback.
8
- *
9
- * Keeping this helper in the SDK (rather than the host) is what lets
10
- * biomes also build a context — e.g. from inside a slash command
11
- * handler that wants to gate behaviour against capabilities.
12
- */
13
- import { useMemo } from 'react';
14
-
15
- import type { SessionContext } from '../../index';
16
-
17
- export interface SessionResolvedAgentInput {
18
- readonly ref: string;
19
- readonly requiredCapabilities: readonly string[];
20
- readonly mayEditRepositories: boolean;
21
- readonly mayWriteKnowledgeBase: boolean;
22
- readonly hasOutputSurface: boolean;
23
- }
24
-
25
- export interface BuildSessionContextInput {
26
- readonly sessionId: string;
27
- readonly orgId: string;
28
- readonly projectId: string;
29
- readonly biomeId?: string;
30
- readonly repositoryId?: string;
31
- readonly agent?: SessionResolvedAgentInput;
32
- readonly status: string;
33
- readonly isActive: boolean;
34
- }
35
-
36
- const TERMINAL_STATUSES = new Set([
37
- 'paused',
38
- 'completed',
39
- 'cancelled',
40
- 'failed',
41
- 'terminated',
42
- ]);
43
-
44
- export function isStatusActive(status: string): boolean {
45
- return !TERMINAL_STATUSES.has(status);
46
- }
47
-
48
- export function useSessionContext(
49
- input: BuildSessionContextInput,
50
- ): SessionContext {
51
- return useMemo<SessionContext>(
52
- () => ({
53
- sessionId: input.sessionId,
54
- orgId: input.orgId,
55
- projectId: input.projectId,
56
- ...(input.biomeId !== undefined ? { biomeId: input.biomeId } : {}),
57
- ...(input.repositoryId !== undefined
58
- ? { repositoryId: input.repositoryId }
59
- : {}),
60
- ...(input.agent !== undefined
61
- ? {
62
- agent: {
63
- ...input.agent,
64
- requiredCapabilities: Object.freeze(
65
- new Set(input.agent.requiredCapabilities),
66
- ),
67
- },
68
- }
69
- : {}),
70
- status: input.status,
71
- isActive: input.isActive,
72
- }),
73
- [
74
- input.sessionId,
75
- input.orgId,
76
- input.projectId,
77
- input.biomeId,
78
- input.repositoryId,
79
- input.agent,
80
- input.status,
81
- input.isActive,
82
- ],
83
- );
84
- }
@@ -1,33 +0,0 @@
1
- /**
2
- * React context that publishes the current `SessionContext` to every
3
- * descendant. The host's session shell mounts the provider once around
4
- * the entire session page; biome-rendered slot panels and host
5
- * primitives both read the context via `useCurrentSessionContext()`
6
- * (throws fail-fast if no provider is mounted, since reading the
7
- * context outside a session view is a wiring bug).
8
- *
9
- * Keeping this in the SDK rather than the host gives biome authors a
10
- * stable, importable hook — `import { useCurrentSessionContext } from
11
- * '@xemahq/ui-kernel/registry'`.
12
- */
13
-
14
- import { SessionContextValue } from './session-context';
15
-
16
- import type { SessionContext } from '../../index';
17
- import type { ReactElement, ReactNode } from 'react';
18
-
19
- export interface SessionContextProviderProps {
20
- readonly value: SessionContext;
21
- readonly children: ReactNode;
22
- }
23
-
24
- export function SessionContextProvider({
25
- value,
26
- children,
27
- }: SessionContextProviderProps): ReactElement {
28
- return (
29
- <SessionContextValue.Provider value={value}>
30
- {children}
31
- </SessionContextValue.Provider>
32
- );
33
- }
@@ -1,21 +0,0 @@
1
- import { createContext, useContext } from 'react';
2
-
3
- import type { SessionContext } from '../../index';
4
-
5
- export const SessionContextValue = createContext<SessionContext | null>(null);
6
- SessionContextValue.displayName = 'SessionContext';
7
-
8
- export function useCurrentSessionContext(): SessionContext {
9
- const ctx = useContext(SessionContextValue);
10
- if (!ctx) {
11
- throw new Error(
12
- '[biome-registry-web] useCurrentSessionContext() called outside <SessionContextProvider>. ' +
13
- 'The host shell must wrap session UI with the provider before any biome reads it.',
14
- );
15
- }
16
- return ctx;
17
- }
18
-
19
- export function useOptionalSessionContext(): SessionContext | null {
20
- return useContext(SessionContextValue);
21
- }