@xemahq/ui-kernel 0.11.0 → 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 (237) hide show
  1. package/dist/ui/chrome/page-shell.d.ts +1 -1
  2. package/dist/ui/chrome/page-shell.d.ts.map +1 -1
  3. package/dist/ui/chrome/page-shell.js +9 -4
  4. package/dist/ui/chrome/page-shell.js.map +1 -1
  5. package/package.json +6 -4
  6. package/src/index.ts +0 -17
  7. package/src/lib/biome-host/agent-validation.ts +0 -239
  8. package/src/lib/biome-host/biome-builders.ts +0 -112
  9. package/src/lib/biome-host/biome-mode.ts +0 -6
  10. package/src/lib/biome-host/biome-navigation.ts +0 -37
  11. package/src/lib/biome-host/biome-registry.ts +0 -299
  12. package/src/lib/biome-host/biome-scope-hooks.ts +0 -41
  13. package/src/lib/biome-host/biome-scope.tsx +0 -52
  14. package/src/lib/biome-host/biome-scoped-query.ts +0 -134
  15. package/src/lib/biome-host/create-biome-orval-config.ts +0 -82
  16. package/src/lib/biome-host/define-web-biome.spec.ts +0 -221
  17. package/src/lib/biome-host/define-web-biome.ts +0 -222
  18. package/src/lib/biome-host/errors.ts +0 -220
  19. package/src/lib/biome-host/frontend-biome.ts +0 -256
  20. package/src/lib/biome-host/host-bridge.ts +0 -281
  21. package/src/lib/biome-host/host-sources.ts +0 -54
  22. package/src/lib/biome-host/i18n-hooks.ts +0 -51
  23. package/src/lib/biome-host/i18n-port.test.ts +0 -50
  24. package/src/lib/biome-host/i18n-port.ts +0 -96
  25. package/src/lib/biome-host/index.ts +0 -35
  26. package/src/lib/biome-host/realtime-hooks.ts +0 -75
  27. package/src/lib/biome-host/realtime-port.ts +0 -115
  28. package/src/lib/biome-host/session-contributions.ts +0 -296
  29. package/src/lib/biome-host/use-mutation-with-error-toast.ts +0 -90
  30. package/src/lib/biome-host/use-page-state.ts +0 -248
  31. package/src/lib/capabilities/capability-context.ts +0 -25
  32. package/src/lib/capabilities/capability-provider.tsx +0 -73
  33. package/src/lib/capabilities/index.ts +0 -17
  34. package/src/lib/capabilities/types.ts +0 -69
  35. package/src/lib/capabilities/use-capability.ts +0 -79
  36. package/src/lib/contribution-registry/contribution-registry.spec.ts +0 -141
  37. package/src/lib/contribution-registry/contribution-registry.ts +0 -204
  38. package/src/lib/contribution-registry/index.ts +0 -9
  39. package/src/lib/contribution-registry/renderable-registry.ts +0 -142
  40. package/src/lib/system-bus/capability-invoke.ts +0 -92
  41. package/src/lib/system-bus/deeplink.ts +0 -210
  42. package/src/lib/system-bus/enums.ts +0 -86
  43. package/src/lib/system-bus/host-ports.ts +0 -93
  44. package/src/lib/system-bus/index.ts +0 -16
  45. package/src/lib/system-bus/intent-registry.ts +0 -109
  46. package/src/lib/system-bus/intents.ts +0 -113
  47. package/src/lib/system-bus/palette.ts +0 -78
  48. package/src/lib/system-bus/system-bus-builder.ts +0 -159
  49. package/src/lib/system-bus/system-bus.ts +0 -37
  50. package/src/lib/system-bus/windows.ts +0 -51
  51. package/src/offline/id.ts +0 -16
  52. package/src/offline/index.ts +0 -54
  53. package/src/offline/mutation.ts +0 -75
  54. package/src/offline/offline-status-badge.tsx +0 -51
  55. package/src/offline/online-controller.ts +0 -105
  56. package/src/offline/outbox.test.ts +0 -172
  57. package/src/offline/outbox.ts +0 -348
  58. package/src/offline/react-hooks.ts +0 -40
  59. package/src/offline/react.tsx +0 -32
  60. package/src/offline/storage.ts +0 -112
  61. package/src/offline/types.ts +0 -77
  62. package/src/org-db/components/DbResultTable.tsx +0 -176
  63. package/src/org-db/index.ts +0 -1
  64. package/src/pdf/index.ts +0 -11
  65. package/src/registry/index.ts +0 -9
  66. package/src/registry/lib/agent-validation-host.ts +0 -36
  67. package/src/registry/lib/biome-slot.tsx +0 -50
  68. package/src/registry/lib/biomes-enabled-context.ts +0 -20
  69. package/src/registry/lib/extension-points.ts +0 -134
  70. package/src/registry/lib/primitives/SessionEventCard.tsx +0 -164
  71. package/src/registry/lib/primitives/SessionEventTimeline.tsx +0 -95
  72. package/src/registry/lib/primitives/SessionMutationBar.tsx +0 -76
  73. package/src/registry/lib/primitives/SessionTabbedDrawer.tsx +0 -165
  74. package/src/registry/lib/primitives/index.ts +0 -18
  75. package/src/registry/lib/session-context-builder.ts +0 -84
  76. package/src/registry/lib/session-context-provider.tsx +0 -33
  77. package/src/registry/lib/session-context.ts +0 -21
  78. package/src/registry/lib/session-selectors.ts +0 -272
  79. package/src/session/comments/CommentRail.tsx +0 -164
  80. package/src/session/index.ts +0 -3
  81. package/src/session/lib/cn.ts +0 -11
  82. package/src/session/shell/SessionWorkspaceShell.tsx +0 -147
  83. package/src/session-kit/approvals/ApprovalButton.tsx +0 -89
  84. package/src/session-kit/approvals/ApprovalCard.tsx +0 -341
  85. package/src/session-kit/approvals/ApprovalsCenter.tsx +0 -336
  86. package/src/session-kit/approvals/CapabilityApprovalStickyBar.tsx +0 -118
  87. package/src/session-kit/approvals/Obligation.tsx +0 -111
  88. package/src/session-kit/approvals/ScopedBody.tsx +0 -392
  89. package/src/session-kit/approvals/approval-icons.ts +0 -31
  90. package/src/session-kit/approvals/approval-model.ts +0 -204
  91. package/src/session-kit/approvals/index.ts +0 -22
  92. package/src/session-kit/approvals/obligation-display.ts +0 -100
  93. package/src/session-kit/approvals/risk-accent.ts +0 -47
  94. package/src/session-kit/approvals/scope-icons.ts +0 -19
  95. package/src/session-kit/combobox/Combobox.tsx +0 -358
  96. package/src/session-kit/combobox/use-click-outside.ts +0 -21
  97. package/src/session-kit/display/ContextHeader.tsx +0 -148
  98. package/src/session-kit/display/FileDiffCard.tsx +0 -140
  99. package/src/session-kit/display/MD.tsx +0 -162
  100. package/src/session-kit/display/MessageTurn.tsx +0 -157
  101. package/src/session-kit/display/ThinkingPanel.tsx +0 -81
  102. package/src/session-kit/display/TodoChecklist.tsx +0 -120
  103. package/src/session-kit/display/TokenMeter.tsx +0 -89
  104. package/src/session-kit/display/ToolStrip.tsx +0 -278
  105. package/src/session-kit/display/TypingDots.tsx +0 -24
  106. package/src/session-kit/index.ts +0 -44
  107. package/src/session-kit/lib/enums.ts +0 -66
  108. package/src/session-kit/lib/portal-accent.ts +0 -30
  109. package/src/session-kit/lib/status-dot.ts +0 -68
  110. package/src/session-kit/primitives/Avatar.tsx +0 -44
  111. package/src/session-kit/primitives/PortalGlyph.tsx +0 -51
  112. package/src/session-kit/primitives/RiskPill.tsx +0 -95
  113. package/src/session-kit/primitives/ScopeDot.tsx +0 -47
  114. package/src/session-kit/primitives/Segmented.tsx +0 -71
  115. package/src/ui/branding/app-branding-context.ts +0 -20
  116. package/src/ui/branding/app-branding-provider.tsx +0 -123
  117. package/src/ui/branding/sanitize.ts +0 -89
  118. package/src/ui/breakpoints.ts +0 -14
  119. package/src/ui/capture/document-preview.tsx +0 -166
  120. package/src/ui/capture/field-spec-to-zod.test.ts +0 -81
  121. package/src/ui/capture/field-spec-to-zod.ts +0 -174
  122. package/src/ui/capture/field-spec-validate.ts +0 -236
  123. package/src/ui/capture/field-spec.test.ts +0 -49
  124. package/src/ui/capture/field-spec.ts +0 -274
  125. package/src/ui/capture/index.ts +0 -51
  126. package/src/ui/capture/schema-field-input.tsx +0 -620
  127. package/src/ui/capture/schema-form.tsx +0 -149
  128. package/src/ui/capture/submit-values.test.ts +0 -70
  129. package/src/ui/capture/submit-values.ts +0 -63
  130. package/src/ui/capture/use-prefill.ts +0 -186
  131. package/src/ui/capture/use-schema-validation.ts +0 -145
  132. package/src/ui/capture/use-wizard.ts +0 -180
  133. package/src/ui/capture/value-format.ts +0 -32
  134. package/src/ui/capture/wizard.tsx +0 -105
  135. package/src/ui/charts/bar-chart.tsx +0 -139
  136. package/src/ui/charts/chart-frame.tsx +0 -125
  137. package/src/ui/charts/chart-types.ts +0 -52
  138. package/src/ui/charts/chart-utils.ts +0 -190
  139. package/src/ui/charts/charts.test.tsx +0 -204
  140. package/src/ui/charts/donut-chart.tsx +0 -129
  141. package/src/ui/charts/index.ts +0 -27
  142. package/src/ui/charts/line-chart.tsx +0 -202
  143. package/src/ui/charts/sparkline.tsx +0 -109
  144. package/src/ui/chrome/AsyncBoundary.tsx +0 -74
  145. package/src/ui/chrome/EmptyState.tsx +0 -257
  146. package/src/ui/chrome/ErrorCard.tsx +0 -63
  147. package/src/ui/chrome/LoadingState.tsx +0 -61
  148. package/src/ui/chrome/PageHeader.tsx +0 -137
  149. package/src/ui/chrome/RecordCardList.tsx +0 -98
  150. package/src/ui/chrome/StateCard.tsx +0 -150
  151. package/src/ui/chrome/confirm-delete-dialog.tsx +0 -59
  152. package/src/ui/chrome/page-shell.tsx +0 -189
  153. package/src/ui/chrome/scope-badge.tsx +0 -40
  154. package/src/ui/chrome/status-badge.tsx +0 -79
  155. package/src/ui/cn.ts +0 -32
  156. package/src/ui/design-tokens.ts +0 -372
  157. package/src/ui/hooks/use-debounced-value.ts +0 -16
  158. package/src/ui/hooks/use-is-mobile.ts +0 -28
  159. package/src/ui/index.ts +0 -110
  160. package/src/ui/pdf/pdf-preview.tsx +0 -122
  161. package/src/ui/primitives/alert-dialog.tsx +0 -104
  162. package/src/ui/primitives/async-combobox.tsx +0 -182
  163. package/src/ui/primitives/badge-variants.ts +0 -21
  164. package/src/ui/primitives/badge.tsx +0 -25
  165. package/src/ui/primitives/button-variants.ts +0 -31
  166. package/src/ui/primitives/button.tsx +0 -29
  167. package/src/ui/primitives/card.tsx +0 -43
  168. package/src/ui/primitives/checkbox.tsx +0 -26
  169. package/src/ui/primitives/collapsible.tsx +0 -9
  170. package/src/ui/primitives/dialog.tsx +0 -103
  171. package/src/ui/primitives/dropdown-menu.tsx +0 -179
  172. package/src/ui/primitives/form-stepper.tsx +0 -94
  173. package/src/ui/primitives/form-stepper.types.ts +0 -15
  174. package/src/ui/primitives/input.tsx +0 -22
  175. package/src/ui/primitives/label.tsx +0 -17
  176. package/src/ui/primitives/overflow-tabs.tsx +0 -331
  177. package/src/ui/primitives/popover.tsx +0 -33
  178. package/src/ui/primitives/preview-device-frame.tsx +0 -213
  179. package/src/ui/primitives/radio-group.tsx +0 -36
  180. package/src/ui/primitives/resizable.tsx +0 -67
  181. package/src/ui/primitives/scroll-area.tsx +0 -38
  182. package/src/ui/primitives/select.tsx +0 -143
  183. package/src/ui/primitives/separator.tsx +0 -20
  184. package/src/ui/primitives/sheet.tsx +0 -107
  185. package/src/ui/primitives/skeleton.tsx +0 -99
  186. package/src/ui/primitives/switch.tsx +0 -27
  187. package/src/ui/primitives/table.tsx +0 -72
  188. package/src/ui/primitives/tabs.tsx +0 -53
  189. package/src/ui/primitives/tag-multi-select.tsx +0 -261
  190. package/src/ui/primitives/textarea.tsx +0 -21
  191. package/src/ui/primitives/tooltip.tsx +0 -30
  192. package/src/ui/primitives/url-preview-chrome.tsx +0 -103
  193. package/src/vista/GenericCatalogueSurface.tsx +0 -179
  194. package/src/vista/SurfaceFallbackCard.tsx +0 -109
  195. package/src/vista/VistaPanel.tsx +0 -163
  196. package/src/vista/form-payload.spec.ts +0 -139
  197. package/src/vista/html/CustomUiFrame.spec.tsx +0 -127
  198. package/src/vista/html/CustomUiFrame.tsx +0 -206
  199. package/src/vista/html/custom-ui-frame-bridge.spec.ts +0 -191
  200. package/src/vista/html/custom-ui-frame-bridge.ts +0 -98
  201. package/src/vista/html/custom-ui-frame-contract.ts +0 -88
  202. package/src/vista/html/custom-ui-intents.spec.ts +0 -135
  203. package/src/vista/html/custom-ui-intents.ts +0 -155
  204. package/src/vista/html/custom-ui-srcdoc.spec.ts +0 -151
  205. package/src/vista/html/custom-ui-srcdoc.ts +0 -193
  206. package/src/vista/html/index.ts +0 -13
  207. package/src/vista/index.ts +0 -52
  208. package/src/vista/surface-catalogue.spec.ts +0 -140
  209. package/src/vista/surface-catalogue.ts +0 -90
  210. package/src/vista/surface-icons.ts +0 -57
  211. package/src/vista/surface-registry.ts +0 -56
  212. package/src/vista/surfaces/ChartSurface.tsx +0 -34
  213. package/src/vista/surfaces/FilesSurface.tsx +0 -202
  214. package/src/vista/surfaces/FormSurface.tsx +0 -380
  215. package/src/vista/surfaces/HtmlSurface.tsx +0 -43
  216. package/src/vista/surfaces/TableSurface.tsx +0 -100
  217. package/src/vista/surfaces/UrlSurface.tsx +0 -40
  218. package/src/vista/surfaces/blob-surfaces.tsx +0 -139
  219. package/src/vista/surfaces/elicitation-transport.spec.ts +0 -369
  220. package/src/vista/surfaces/elicitation-transport.ts +0 -367
  221. package/src/vista/surfaces/file-surface-utils.ts +0 -69
  222. package/src/vista/surfaces/index.ts +0 -24
  223. package/src/vista/surfaces/register-surfaces.tsx +0 -139
  224. package/src/vista/surfaces/text-surfaces.tsx +0 -132
  225. package/src/vista/use-vista-tabs.ts +0 -196
  226. package/src/vista/vista-code-renderer-context.ts +0 -16
  227. package/src/vista/vista-code-renderer.tsx +0 -35
  228. package/src/vista/vista-file-context.ts +0 -14
  229. package/src/vista/vista-file-source.tsx +0 -141
  230. package/src/vista/vista-form-context.ts +0 -20
  231. package/src/vista/vista-form-host.tsx +0 -48
  232. package/src/vista/vista-model.ts +0 -137
  233. package/src/vista/vista-open-context.tsx +0 -27
  234. package/src/vista/vista-open-state.ts +0 -11
  235. package/src/vista/vista-payloads.ts +0 -635
  236. package/src/vista/vista-tabs-manifest.ts +0 -138
  237. package/src/vista/vista-tools.ts +0 -232
@@ -1,162 +0,0 @@
1
- /**
2
- * Minimal, dependency-free markdown renderer for transcript bodies
3
- * (bold, inline code, fenced blocks, bullet lists). The host shell has
4
- * a full `MarkdownRenderer` (ReactMarkdown + mermaid + syntax
5
- * highlighting), but that renderer imports framework modules
6
- * (`next/navigation`, …) and cannot live in this layer-agnostic kernel
7
- * package.
8
- *
9
- * So the kit ships this tiny fallback AND every body-rendering component
10
- * accepts a `renderMarkdown` prop — the host injects its own renderer
11
- * for rich content, the kit falls back to `MD` when none is supplied.
12
- *
13
- * Inline formatting is parsed into real React nodes (no
14
- * `dangerouslySetInnerHTML`) so it is XSS-safe by construction.
15
- */
16
- import { Fragment, type ReactElement, type ReactNode } from 'react';
17
-
18
- /** Signature a host markdown renderer must satisfy to plug into the kit. */
19
- export type MarkdownRender = (text: string) => ReactNode;
20
-
21
- const INLINE_CODE_STYLE = {
22
- fontSize: 12,
23
- padding: '1px 5px',
24
- background: 'hsl(var(--paper-sunk))',
25
- border: '1px solid hsl(var(--rule))',
26
- borderRadius: 4,
27
- color: 'hsl(var(--ink))',
28
- } as const;
29
-
30
- /** Parse `**bold**` and `` `code` `` spans into React nodes. */
31
- function renderInline(text: string): ReactNode[] {
32
- const nodes: ReactNode[] = [];
33
- // Split on bold or inline-code tokens, keeping the delimiters.
34
- const parts = text.split(/(\*\*[^*]+\*\*|`[^`]+`)/g);
35
- parts.forEach((part, index) => {
36
- if (!part) {
37
- return;
38
- }
39
- if (part.startsWith('**') && part.endsWith('**')) {
40
- nodes.push(
41
- <strong
42
- key={index}
43
- style={{ fontWeight: 600, color: 'hsl(var(--ink))' }}
44
- >
45
- {part.slice(2, -2)}
46
- </strong>,
47
- );
48
- return;
49
- }
50
- if (part.startsWith('`') && part.endsWith('`')) {
51
- nodes.push(
52
- <code key={index} className="mono" style={INLINE_CODE_STYLE}>
53
- {part.slice(1, -1)}
54
- </code>,
55
- );
56
- return;
57
- }
58
- // Plain text — preserve hard line breaks.
59
- const lines = part.split('\n');
60
- lines.forEach((line, lineIndex) => {
61
- if (lineIndex > 0) {
62
- nodes.push(<br key={`${index}-br-${lineIndex}`} />);
63
- }
64
- if (line) {
65
- nodes.push(<Fragment key={`${index}-t-${lineIndex}`}>{line}</Fragment>);
66
- }
67
- });
68
- });
69
- return nodes;
70
- }
71
-
72
- export interface MDProps {
73
- readonly children: string;
74
- }
75
-
76
- export function MD({ children }: MDProps): ReactElement {
77
- const text = children;
78
- const blocks = text.split(/\n\n+/);
79
- return (
80
- <div style={{ display: 'flex', flexDirection: 'column', gap: 9 }}>
81
- {blocks.map((block, index) => {
82
- if (block.startsWith('```')) {
83
- const code = block.replace(/```[a-z]*\n?/i, '').replace(/```$/, '');
84
- return (
85
- <pre
86
- key={index}
87
- className="mono"
88
- style={{
89
- margin: 0,
90
- padding: '11px 13px',
91
- background: 'hsl(var(--paper-sunk))',
92
- border: '1px solid hsl(var(--rule))',
93
- borderRadius: 8,
94
- fontSize: 12,
95
- lineHeight: 1.6,
96
- overflowX: 'auto',
97
- color: 'hsl(var(--ink-2))',
98
- whiteSpace: 'pre',
99
- }}
100
- >
101
- {code}
102
- </pre>
103
- );
104
- }
105
- if (/^[-•]\s/m.test(block)) {
106
- const items = block.split('\n').filter(Boolean);
107
- return (
108
- <ul
109
- key={index}
110
- style={{
111
- margin: 0,
112
- paddingLeft: 2,
113
- listStyle: 'none',
114
- display: 'flex',
115
- flexDirection: 'column',
116
- gap: 5,
117
- }}
118
- >
119
- {items.map((item, itemIndex) => (
120
- <li
121
- key={itemIndex}
122
- style={{
123
- display: 'flex',
124
- gap: 9,
125
- fontSize: 13.5,
126
- lineHeight: 1.55,
127
- color: 'hsl(var(--ink-2))',
128
- }}
129
- >
130
- <span
131
- style={{
132
- marginTop: 8,
133
- width: 4,
134
- height: 4,
135
- borderRadius: '50%',
136
- background: 'hsl(var(--ink-4))',
137
- flexShrink: 0,
138
- }}
139
- />
140
- <span>{renderInline(item.replace(/^[-•]\s/, ''))}</span>
141
- </li>
142
- ))}
143
- </ul>
144
- );
145
- }
146
- return (
147
- <p
148
- key={index}
149
- style={{
150
- margin: 0,
151
- fontSize: 13.5,
152
- lineHeight: 1.62,
153
- color: 'hsl(var(--ink-2))',
154
- }}
155
- >
156
- {renderInline(block)}
157
- </p>
158
- );
159
- })}
160
- </div>
161
- );
162
- }
@@ -1,157 +0,0 @@
1
- /**
2
- * A single message turn. User turns render a right-aligned soft bubble;
3
- * agent turns render a thin gutter + role caption + flowing body.
4
- *
5
- * The body is rendered by `renderMarkdown` when supplied (host shells wire
6
- * the host's full `MarkdownRenderer` here) and falls back to the kit's
7
- * built-in `MD` otherwise — so the kit is self-contained but never
8
- * forces its tiny renderer on a host that has a richer one.
9
- */
10
-
11
- import { MD, type MarkdownRender } from './MD';
12
- import { TypingDots } from './TypingDots';
13
- import { SessionSkin, TurnRole } from '../lib/enums';
14
- import { portalAccent, type PortalAccentVar } from '../lib/portal-accent';
15
-
16
- import type { ReactElement, ReactNode } from 'react';
17
-
18
- export interface SessionMessage {
19
- readonly role: TurnRole;
20
- readonly content?: string;
21
- /** Agent display name (caption). */
22
- readonly agent?: string;
23
- /** Optional phase chip text. */
24
- readonly phase?: string;
25
- /** True while this turn is actively streaming. */
26
- readonly streaming?: boolean;
27
- }
28
-
29
- export interface MessageTurnProps {
30
- readonly msg: SessionMessage;
31
- readonly skin?: SessionSkin;
32
- /** Active portal accent token; defaults to the brand accent. */
33
- readonly accentVar?: PortalAccentVar;
34
- /** Host markdown renderer; falls back to the kit's `MD`. */
35
- readonly renderMarkdown?: MarkdownRender;
36
- /** Agent avatar glyph (host-supplied) shown in the gutter. */
37
- readonly agentIcon?: ReactNode;
38
- /** Inline widgets (tool strip, diff, todo, …) rendered below the body. */
39
- readonly children?: ReactNode;
40
- }
41
-
42
- export function MessageTurn({
43
- msg,
44
- skin = SessionSkin.Minimal,
45
- accentVar,
46
- renderMarkdown,
47
- agentIcon,
48
- children,
49
- }: MessageTurnProps): ReactElement {
50
- if (msg.role === TurnRole.User) {
51
- return (
52
- <div style={{ display: 'flex', justifyContent: 'flex-end', padding: '2px 0' }}>
53
- <div
54
- style={{
55
- maxWidth: '78%',
56
- padding: '9px 13px',
57
- borderRadius: '12px 12px 4px 12px',
58
- background: 'hsl(var(--paper-sunk))',
59
- border: '1px solid hsl(var(--rule))',
60
- fontSize: 13.5,
61
- lineHeight: 1.55,
62
- color: 'hsl(var(--ink))',
63
- }}
64
- >
65
- {msg.content}
66
- </div>
67
- </div>
68
- );
69
- }
70
-
71
- const accent = portalAccent(accentVar);
72
- const renderBody: MarkdownRender = renderMarkdown ?? ((t) => <MD>{t}</MD>);
73
- const functional = skin === SessionSkin.Functional;
74
-
75
- return (
76
- <div style={{ display: 'flex', gap: 12, padding: '2px 0' }}>
77
- <div
78
- style={{
79
- width: 26,
80
- flexShrink: 0,
81
- display: 'flex',
82
- flexDirection: 'column',
83
- alignItems: 'center',
84
- gap: 4,
85
- }}
86
- >
87
- <span
88
- style={{
89
- width: 26,
90
- height: 26,
91
- borderRadius: 8,
92
- display: 'grid',
93
- placeItems: 'center',
94
- background: functional ? portalAccent(accentVar, 0.12) : 'transparent',
95
- color: accent,
96
- border: functional ? 'none' : '1px solid hsl(var(--rule-2))',
97
- }}
98
- >
99
- {agentIcon}
100
- </span>
101
- <span
102
- style={{
103
- flex: 1,
104
- width: 1.5,
105
- background: 'hsl(var(--rule))',
106
- borderRadius: 1,
107
- minHeight: 8,
108
- }}
109
- />
110
- </div>
111
- <div style={{ flex: 1, minWidth: 0, paddingBottom: 6 }}>
112
- <div style={{ display: 'flex', alignItems: 'center', gap: 8, marginBottom: 7 }}>
113
- <span className="cap" style={{ color: 'hsl(var(--ink-3))' }}>
114
- {msg.agent ?? 'Agent'}
115
- </span>
116
- {msg.phase && (
117
- <span
118
- className="mono"
119
- style={{
120
- fontSize: 10,
121
- color: accent,
122
- padding: '1px 6px',
123
- background: portalAccent(accentVar, 0.09),
124
- borderRadius: 5,
125
- border: `1px solid ${portalAccent(accentVar, 0.2)}`,
126
- }}
127
- >
128
- {msg.phase}
129
- </span>
130
- )}
131
- {msg.streaming && (
132
- <span
133
- style={{
134
- display: 'inline-flex',
135
- alignItems: 'center',
136
- gap: 5,
137
- fontSize: 11,
138
- color: 'hsl(var(--info))',
139
- }}
140
- >
141
- <TypingDots />
142
- </span>
143
- )}
144
- </div>
145
- {msg.content && (
146
- <div
147
- className={msg.streaming && !children ? 'xk-caret' : ''}
148
- style={{ display: 'inline' }}
149
- >
150
- {renderBody(msg.content)}
151
- </div>
152
- )}
153
- {children}
154
- </div>
155
- </div>
156
- );
157
- }
@@ -1,81 +0,0 @@
1
- /**
2
- * Collapsible agent-reasoning panel. Dashed left border when open.
3
- * The disclosure + brain icons are host-supplied.
4
- */
5
- import { useState, type ReactElement, type ReactNode } from 'react';
6
-
7
- import { SessionSkin } from '../lib/enums';
8
-
9
- export interface ThinkingPanelProps {
10
- readonly text: string;
11
- readonly skin?: SessionSkin;
12
- readonly defaultOpen?: boolean;
13
- /** Icon shown when collapsed (e.g. a chevron-right). */
14
- readonly collapsedIcon?: ReactNode;
15
- /** Icon shown when expanded (e.g. a chevron-down). */
16
- readonly expandedIcon?: ReactNode;
17
- /** Leading "thinking" glyph (e.g. a brain). */
18
- readonly leadingIcon?: ReactNode;
19
- }
20
-
21
- export function ThinkingPanel({
22
- text,
23
- skin = SessionSkin.Minimal,
24
- defaultOpen = false,
25
- collapsedIcon,
26
- expandedIcon,
27
- leadingIcon,
28
- }: ThinkingPanelProps): ReactElement {
29
- // `skin` is accepted for API parity with the rest of the kit; the
30
- // thinking panel renders identically in both skins today.
31
- void skin;
32
- const [open, setOpen] = useState(defaultOpen);
33
- return (
34
- <div style={{ marginTop: 9 }}>
35
- <button
36
- type="button"
37
- onClick={() => setOpen((v) => !v)}
38
- style={{
39
- display: 'inline-flex',
40
- alignItems: 'center',
41
- gap: 7,
42
- fontSize: 12,
43
- color: 'hsl(var(--ink-3))',
44
- padding: '3px 2px',
45
- transition: 'color 140ms ease',
46
- }}
47
- >
48
- {open ? expandedIcon : collapsedIcon}
49
- {leadingIcon && (
50
- <span style={{ display: 'inline-flex', color: 'hsl(var(--p-people))' }}>
51
- {leadingIcon}
52
- </span>
53
- )}
54
- <span style={{ fontWeight: 500 }}>Thinking</span>
55
- <span className="mono" style={{ fontSize: 10.5, opacity: 0.6 }}>
56
- {text.length} chars
57
- </span>
58
- </button>
59
- {open && (
60
- <div
61
- style={{
62
- marginTop: 5,
63
- marginLeft: 6,
64
- paddingLeft: 12,
65
- borderLeft: '1.5px dashed hsl(var(--rule-2))',
66
- fontSize: 12.5,
67
- lineHeight: 1.6,
68
- fontStyle: 'italic',
69
- color: 'hsl(var(--ink-3))',
70
- whiteSpace: 'pre-wrap',
71
- overflowWrap: 'anywhere',
72
- wordBreak: 'break-word',
73
- minWidth: 0,
74
- }}
75
- >
76
- {text}
77
- </div>
78
- )}
79
- </div>
80
- );
81
- }
@@ -1,120 +0,0 @@
1
- /**
2
- * Plan / todo checklist. Each row's state is a `TodoState` enum value.
3
- * The header glyph, the "done" check, and the "active" spinner are
4
- * host-supplied icon nodes.
5
- */
6
- import { SessionSkin, TodoState } from '../lib/enums';
7
-
8
- import type { CSSProperties, ReactElement, ReactNode } from 'react';
9
-
10
-
11
- export interface TodoItem {
12
- readonly label: string;
13
- readonly state: TodoState;
14
- }
15
-
16
- export interface TodoChecklistProps {
17
- readonly items: ReadonlyArray<TodoItem>;
18
- readonly skin?: SessionSkin;
19
- readonly title?: string;
20
- /** Header glyph (e.g. a check icon). */
21
- readonly titleIcon?: ReactNode;
22
- /** Check mark rendered inside a completed item's box. */
23
- readonly doneIcon?: ReactNode;
24
- /** Spinner rendered inside the active item's box. */
25
- readonly activeIcon?: ReactNode;
26
- readonly style?: CSSProperties;
27
- }
28
-
29
- export function TodoChecklist({
30
- items,
31
- skin = SessionSkin.Minimal,
32
- title = 'Plan',
33
- titleIcon,
34
- doneIcon,
35
- activeIcon,
36
- style,
37
- }: TodoChecklistProps): ReactElement {
38
- const done = items.filter((i) => i.state === TodoState.Done).length;
39
- return (
40
- <div
41
- style={{
42
- marginTop: 9,
43
- border: '1px solid hsl(var(--rule))',
44
- borderRadius: 9,
45
- background: 'hsl(var(--paper-elev))',
46
- overflow: 'hidden',
47
- ...style,
48
- }}
49
- >
50
- <div
51
- style={{
52
- display: 'flex',
53
- alignItems: 'center',
54
- gap: 8,
55
- padding: '8px 12px',
56
- borderBottom: '1px solid hsl(var(--rule))',
57
- background:
58
- skin === SessionSkin.Functional ? 'hsl(var(--muted))' : 'transparent',
59
- }}
60
- >
61
- {titleIcon && (
62
- <span style={{ display: 'inline-flex', color: 'hsl(var(--primary))' }}>
63
- {titleIcon}
64
- </span>
65
- )}
66
- <span className="cap">{title}</span>
67
- <span style={{ flex: 1 }} />
68
- <span className="mono" style={{ fontSize: 11, color: 'hsl(var(--ink-3))' }}>
69
- {done}/{items.length}
70
- </span>
71
- </div>
72
- <div style={{ padding: '6px 0' }}>
73
- {items.map((item, index) => {
74
- const isDone = item.state === TodoState.Done;
75
- const isActive = item.state === TodoState.Active;
76
- return (
77
- <div
78
- key={index}
79
- style={{
80
- display: 'flex',
81
- alignItems: 'center',
82
- gap: 10,
83
- padding: '5px 12px',
84
- }}
85
- >
86
- <span
87
- style={{
88
- width: 16,
89
- height: 16,
90
- borderRadius: 5,
91
- flexShrink: 0,
92
- display: 'grid',
93
- placeItems: 'center',
94
- border: isDone
95
- ? 'none'
96
- : `1.5px solid ${isActive ? 'hsl(var(--warning))' : 'hsl(var(--rule-2))'}`,
97
- background: isDone ? 'hsl(var(--success))' : 'transparent',
98
- color: '#fff',
99
- }}
100
- >
101
- {isDone && doneIcon}
102
- {isActive && activeIcon}
103
- </span>
104
- <span
105
- style={{
106
- fontSize: 13,
107
- color: isDone ? 'hsl(var(--ink-4))' : 'hsl(var(--ink-2))',
108
- textDecoration: isDone ? 'line-through' : 'none',
109
- fontWeight: isActive ? 500 : 400,
110
- }}
111
- >
112
- {item.label}
113
- </span>
114
- </div>
115
- );
116
- })}
117
- </div>
118
- </div>
119
- );
120
- }
@@ -1,89 +0,0 @@
1
- /**
2
- * Token/cost meter — input & output token counts plus a running dollar
3
- * cost. Used both inside the ContextHeader and (in host shells) absolute
4
- * top-right of the composer.
5
- */
6
- import { SessionSkin } from '../lib/enums';
7
-
8
- import type { CSSProperties, ReactElement } from 'react';
9
-
10
-
11
- export interface TokenCounts {
12
- readonly input: number;
13
- readonly output: number;
14
- }
15
-
16
- export interface TokenMeterProps {
17
- readonly tokens: TokenCounts;
18
- readonly cost: number;
19
- readonly skin?: SessionSkin;
20
- /**
21
- * When true, shows a pulsing `--info` dot — used by the composer while
22
- * the agent is streaming (that is when token movement matters).
23
- */
24
- readonly streaming?: boolean;
25
- readonly style?: CSSProperties;
26
- }
27
-
28
- function fmt(n: number): string {
29
- return n >= 1000 ? `${(n / 1000).toFixed(1)}k` : String(n);
30
- }
31
-
32
- export function TokenMeter({
33
- tokens,
34
- cost,
35
- skin = SessionSkin.Minimal,
36
- streaming = false,
37
- style,
38
- }: TokenMeterProps): ReactElement {
39
- const functional = skin === SessionSkin.Functional;
40
- return (
41
- <span
42
- className="mono"
43
- style={{
44
- display: 'inline-flex',
45
- alignItems: 'center',
46
- gap: 9,
47
- fontSize: 11,
48
- color: 'hsl(var(--ink-3))',
49
- padding: functional ? '3px 9px' : 0,
50
- background: functional ? 'hsl(var(--muted))' : 'transparent',
51
- border: functional ? '1px solid hsl(var(--rule))' : 'none',
52
- borderRadius: 7,
53
- ...style,
54
- }}
55
- >
56
- {streaming && (
57
- <span
58
- className="xk-pulse-soft"
59
- style={{
60
- width: 5,
61
- height: 5,
62
- borderRadius: '50%',
63
- background: 'hsl(var(--info))',
64
- flexShrink: 0,
65
- }}
66
- />
67
- )}
68
- <span title="input tokens">
69
- {fmt(tokens.input)}
70
- <span style={{ opacity: 0.55 }}> in</span>
71
- </span>
72
- <span title="output tokens">
73
- {fmt(tokens.output)}
74
- <span style={{ opacity: 0.55 }}> out</span>
75
- </span>
76
- <span
77
- style={{
78
- width: 3,
79
- height: 3,
80
- borderRadius: '50%',
81
- background: 'hsl(var(--ink-4))',
82
- }}
83
- />
84
- <span style={{ color: 'hsl(var(--ink-2))', fontWeight: 600 }}>
85
- ${cost.toFixed(3)}
86
- </span>
87
- </span>
88
- );
89
- }