@xemahq/ui-kernel 0.1.5 → 0.1.7

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 (178) hide show
  1. package/dist/lib/biome-host/create-biome-orval-config.d.ts +14 -0
  2. package/dist/lib/biome-host/create-biome-orval-config.d.ts.map +1 -0
  3. package/dist/lib/biome-host/create-biome-orval-config.js +22 -0
  4. package/dist/lib/biome-host/create-biome-orval-config.js.map +1 -0
  5. package/dist/lib/biome-host/host-bridge.d.ts +2 -0
  6. package/dist/lib/biome-host/host-bridge.d.ts.map +1 -1
  7. package/dist/lib/biome-host/host-bridge.js.map +1 -1
  8. package/dist/lib/biome-host/host-sources.d.ts +2 -0
  9. package/dist/lib/biome-host/host-sources.d.ts.map +1 -1
  10. package/dist/lib/biome-host/index.d.ts +1 -0
  11. package/dist/lib/biome-host/index.d.ts.map +1 -1
  12. package/dist/lib/biome-host/index.js +1 -0
  13. package/dist/lib/biome-host/index.js.map +1 -1
  14. package/dist/session-kit/approvals/ApprovalButton.d.ts +14 -0
  15. package/dist/session-kit/approvals/ApprovalButton.d.ts.map +1 -0
  16. package/dist/session-kit/approvals/ApprovalButton.js +45 -0
  17. package/dist/session-kit/approvals/ApprovalButton.js.map +1 -0
  18. package/dist/session-kit/approvals/ApprovalCard.d.ts +12 -0
  19. package/dist/session-kit/approvals/ApprovalCard.d.ts.map +1 -0
  20. package/dist/session-kit/approvals/ApprovalCard.js +117 -0
  21. package/dist/session-kit/approvals/ApprovalCard.js.map +1 -0
  22. package/dist/session-kit/approvals/ApprovalsCenter.d.ts +11 -0
  23. package/dist/session-kit/approvals/ApprovalsCenter.d.ts.map +1 -0
  24. package/dist/session-kit/approvals/ApprovalsCenter.js +127 -0
  25. package/dist/session-kit/approvals/ApprovalsCenter.js.map +1 -0
  26. package/dist/session-kit/approvals/CapabilityApprovalStickyBar.d.ts +12 -0
  27. package/dist/session-kit/approvals/CapabilityApprovalStickyBar.d.ts.map +1 -0
  28. package/dist/session-kit/approvals/CapabilityApprovalStickyBar.js +36 -0
  29. package/dist/session-kit/approvals/CapabilityApprovalStickyBar.js.map +1 -0
  30. package/dist/session-kit/approvals/Obligation.d.ts +15 -0
  31. package/dist/session-kit/approvals/Obligation.d.ts.map +1 -0
  32. package/dist/session-kit/approvals/Obligation.js +42 -0
  33. package/dist/session-kit/approvals/Obligation.js.map +1 -0
  34. package/dist/session-kit/approvals/ScopedBody.d.ts +9 -0
  35. package/dist/session-kit/approvals/ScopedBody.d.ts.map +1 -0
  36. package/dist/session-kit/approvals/ScopedBody.js +145 -0
  37. package/dist/session-kit/approvals/ScopedBody.js.map +1 -0
  38. package/dist/session-kit/approvals/approval-icons.d.ts +15 -0
  39. package/dist/session-kit/approvals/approval-icons.d.ts.map +1 -0
  40. package/dist/session-kit/approvals/approval-icons.js +3 -0
  41. package/dist/session-kit/approvals/approval-icons.js.map +1 -0
  42. package/dist/session-kit/approvals/approval-model.d.ts +83 -0
  43. package/dist/session-kit/approvals/approval-model.d.ts.map +1 -0
  44. package/dist/session-kit/approvals/approval-model.js +25 -0
  45. package/dist/session-kit/approvals/approval-model.js.map +1 -0
  46. package/dist/session-kit/approvals/index.d.ts +12 -0
  47. package/dist/session-kit/approvals/index.d.ts.map +1 -0
  48. package/dist/session-kit/approvals/index.js +28 -0
  49. package/dist/session-kit/approvals/index.js.map +1 -0
  50. package/dist/session-kit/approvals/obligation-display.d.ts +17 -0
  51. package/dist/session-kit/approvals/obligation-display.d.ts.map +1 -0
  52. package/dist/session-kit/approvals/obligation-display.js +58 -0
  53. package/dist/session-kit/approvals/obligation-display.js.map +1 -0
  54. package/dist/session-kit/approvals/risk-accent.d.ts +8 -0
  55. package/dist/session-kit/approvals/risk-accent.d.ts.map +1 -0
  56. package/dist/session-kit/approvals/risk-accent.js +28 -0
  57. package/dist/session-kit/approvals/risk-accent.js.map +1 -0
  58. package/dist/session-kit/approvals/scope-icons.d.ts +12 -0
  59. package/dist/session-kit/approvals/scope-icons.d.ts.map +1 -0
  60. package/dist/session-kit/approvals/scope-icons.js +14 -0
  61. package/dist/session-kit/approvals/scope-icons.js.map +1 -0
  62. package/dist/session-kit/combobox/Combobox.d.ts +46 -0
  63. package/dist/session-kit/combobox/Combobox.d.ts.map +1 -0
  64. package/dist/session-kit/combobox/Combobox.js +113 -0
  65. package/dist/session-kit/combobox/Combobox.js.map +1 -0
  66. package/dist/session-kit/combobox/use-click-outside.d.ts +3 -0
  67. package/dist/session-kit/combobox/use-click-outside.d.ts.map +1 -0
  68. package/dist/session-kit/combobox/use-click-outside.js +18 -0
  69. package/dist/session-kit/combobox/use-click-outside.js.map +1 -0
  70. package/dist/session-kit/display/ContextHeader.d.ts +27 -0
  71. package/dist/session-kit/display/ContextHeader.d.ts.map +1 -0
  72. package/dist/session-kit/display/ContextHeader.js +47 -0
  73. package/dist/session-kit/display/ContextHeader.js.map +1 -0
  74. package/dist/session-kit/display/FileDiffCard.d.ts +18 -0
  75. package/dist/session-kit/display/FileDiffCard.d.ts.map +1 -0
  76. package/dist/session-kit/display/FileDiffCard.js +58 -0
  77. package/dist/session-kit/display/FileDiffCard.js.map +1 -0
  78. package/dist/session-kit/display/MD.d.ts +7 -0
  79. package/dist/session-kit/display/MD.d.ts.map +1 -0
  80. package/dist/session-kit/display/MD.js +89 -0
  81. package/dist/session-kit/display/MD.js.map +1 -0
  82. package/dist/session-kit/display/MessageTurn.d.ts +21 -0
  83. package/dist/session-kit/display/MessageTurn.d.ts.map +1 -0
  84. package/dist/session-kit/display/MessageTurn.js +62 -0
  85. package/dist/session-kit/display/MessageTurn.js.map +1 -0
  86. package/dist/session-kit/display/ThinkingPanel.d.ts +12 -0
  87. package/dist/session-kit/display/ThinkingPanel.d.ts.map +1 -0
  88. package/dist/session-kit/display/ThinkingPanel.js +30 -0
  89. package/dist/session-kit/display/ThinkingPanel.js.map +1 -0
  90. package/dist/session-kit/display/TodoChecklist.d.ts +17 -0
  91. package/dist/session-kit/display/TodoChecklist.d.ts.map +1 -0
  92. package/dist/session-kit/display/TodoChecklist.js +50 -0
  93. package/dist/session-kit/display/TodoChecklist.js.map +1 -0
  94. package/dist/session-kit/display/TokenMeter.d.ts +15 -0
  95. package/dist/session-kit/display/TokenMeter.d.ts.map +1 -0
  96. package/dist/session-kit/display/TokenMeter.js +35 -0
  97. package/dist/session-kit/display/TokenMeter.js.map +1 -0
  98. package/dist/session-kit/display/ToolStrip.d.ts +31 -0
  99. package/dist/session-kit/display/ToolStrip.d.ts.map +1 -0
  100. package/dist/session-kit/display/ToolStrip.js +99 -0
  101. package/dist/session-kit/display/ToolStrip.js.map +1 -0
  102. package/dist/session-kit/display/TypingDots.d.ts +3 -0
  103. package/dist/session-kit/display/TypingDots.d.ts.map +1 -0
  104. package/dist/session-kit/display/TypingDots.js +14 -0
  105. package/dist/session-kit/display/TypingDots.js.map +1 -0
  106. package/dist/session-kit/index.d.ts +21 -0
  107. package/dist/session-kit/index.d.ts.map +1 -0
  108. package/dist/session-kit/index.js +37 -0
  109. package/dist/session-kit/index.js.map +1 -0
  110. package/dist/session-kit/lib/enums.d.ts +34 -0
  111. package/dist/session-kit/lib/enums.d.ts.map +1 -0
  112. package/dist/session-kit/lib/enums.js +44 -0
  113. package/dist/session-kit/lib/enums.js.map +1 -0
  114. package/dist/session-kit/lib/portal-accent.d.ts +3 -0
  115. package/dist/session-kit/lib/portal-accent.d.ts.map +1 -0
  116. package/dist/session-kit/lib/portal-accent.js +9 -0
  117. package/dist/session-kit/lib/portal-accent.js.map +1 -0
  118. package/dist/session-kit/lib/status-dot.d.ts +10 -0
  119. package/dist/session-kit/lib/status-dot.d.ts.map +1 -0
  120. package/dist/session-kit/lib/status-dot.js +43 -0
  121. package/dist/session-kit/lib/status-dot.js.map +1 -0
  122. package/dist/session-kit/primitives/Avatar.d.ts +10 -0
  123. package/dist/session-kit/primitives/Avatar.d.ts.map +1 -0
  124. package/dist/session-kit/primitives/Avatar.js +21 -0
  125. package/dist/session-kit/primitives/Avatar.js.map +1 -0
  126. package/dist/session-kit/primitives/PortalGlyph.d.ts +12 -0
  127. package/dist/session-kit/primitives/PortalGlyph.d.ts.map +1 -0
  128. package/dist/session-kit/primitives/PortalGlyph.js +21 -0
  129. package/dist/session-kit/primitives/PortalGlyph.js.map +1 -0
  130. package/dist/session-kit/primitives/RiskPill.d.ts +12 -0
  131. package/dist/session-kit/primitives/RiskPill.d.ts.map +1 -0
  132. package/dist/session-kit/primitives/RiskPill.js +53 -0
  133. package/dist/session-kit/primitives/RiskPill.js.map +1 -0
  134. package/dist/session-kit/primitives/ScopeDot.d.ts +9 -0
  135. package/dist/session-kit/primitives/ScopeDot.d.ts.map +1 -0
  136. package/dist/session-kit/primitives/ScopeDot.js +23 -0
  137. package/dist/session-kit/primitives/ScopeDot.js.map +1 -0
  138. package/dist/session-kit/primitives/Segmented.d.ts +16 -0
  139. package/dist/session-kit/primitives/Segmented.d.ts.map +1 -0
  140. package/dist/session-kit/primitives/Segmented.js +31 -0
  141. package/dist/session-kit/primitives/Segmented.js.map +1 -0
  142. package/package.json +3 -3
  143. package/src/lib/biome-host/create-biome-orval-config.ts +76 -0
  144. package/src/lib/biome-host/host-bridge.ts +22 -0
  145. package/src/lib/biome-host/host-sources.ts +13 -0
  146. package/src/lib/biome-host/index.ts +1 -0
  147. package/src/session-kit/approvals/ApprovalButton.tsx +89 -0
  148. package/src/session-kit/approvals/ApprovalCard.tsx +336 -0
  149. package/src/session-kit/approvals/ApprovalsCenter.tsx +327 -0
  150. package/src/session-kit/approvals/CapabilityApprovalStickyBar.tsx +118 -0
  151. package/src/session-kit/approvals/Obligation.tsx +111 -0
  152. package/src/session-kit/approvals/ScopedBody.tsx +392 -0
  153. package/src/session-kit/approvals/approval-icons.ts +31 -0
  154. package/src/session-kit/approvals/approval-model.ts +205 -0
  155. package/src/session-kit/approvals/index.ts +22 -0
  156. package/src/session-kit/approvals/obligation-display.ts +100 -0
  157. package/src/session-kit/approvals/risk-accent.ts +47 -0
  158. package/src/session-kit/approvals/scope-icons.ts +19 -0
  159. package/src/session-kit/combobox/Combobox.tsx +327 -0
  160. package/src/session-kit/combobox/use-click-outside.ts +21 -0
  161. package/src/session-kit/display/ContextHeader.tsx +148 -0
  162. package/src/session-kit/display/FileDiffCard.tsx +140 -0
  163. package/src/session-kit/display/MD.tsx +153 -0
  164. package/src/session-kit/display/MessageTurn.tsx +157 -0
  165. package/src/session-kit/display/ThinkingPanel.tsx +78 -0
  166. package/src/session-kit/display/TodoChecklist.tsx +120 -0
  167. package/src/session-kit/display/TokenMeter.tsx +89 -0
  168. package/src/session-kit/display/ToolStrip.tsx +278 -0
  169. package/src/session-kit/display/TypingDots.tsx +24 -0
  170. package/src/session-kit/index.ts +44 -0
  171. package/src/session-kit/lib/enums.ts +66 -0
  172. package/src/session-kit/lib/portal-accent.ts +30 -0
  173. package/src/session-kit/lib/status-dot.ts +68 -0
  174. package/src/session-kit/primitives/Avatar.tsx +44 -0
  175. package/src/session-kit/primitives/PortalGlyph.tsx +51 -0
  176. package/src/session-kit/primitives/RiskPill.tsx +95 -0
  177. package/src/session-kit/primitives/ScopeDot.tsx +47 -0
  178. package/src/session-kit/primitives/Segmented.tsx +71 -0
@@ -0,0 +1,278 @@
1
+ /**
2
+ * Tool-call strip — a collapsed summary chip that expands into a row of
3
+ * per-tool chips. Tool icons and the summary stat icons are
4
+ * host-supplied; the dot/stat colours come from the authoritative
5
+ * status-dot map so every surface agrees on "amber pending / green done
6
+ * / red error".
7
+ */
8
+ import { useState, type ReactElement, type ReactNode } from 'react';
9
+
10
+ import { SessionSkin, ToolStatus } from '../lib/enums';
11
+ import { toolStatusColor } from '../lib/status-dot';
12
+
13
+ export interface ToolCall {
14
+ /** Tool label (e.g. "Read", "Shell"). */
15
+ readonly label: string;
16
+ /** Optional host-supplied tool icon. */
17
+ readonly icon?: ReactNode;
18
+ /** Primary argument shown in mono after the label. */
19
+ readonly arg?: string;
20
+ readonly status: ToolStatus;
21
+ /** Expandable raw detail; chip is only clickable when present. */
22
+ readonly detail?: string;
23
+ /** Repeat count badge (e.g. ×3) when the same call ran multiple times. */
24
+ readonly count?: number;
25
+ }
26
+
27
+ /** Host-supplied icons used by the collapsed-summary and per-chip UI. */
28
+ export interface ToolStripIcons {
29
+ /** Leading glyph on the collapsed summary (e.g. a zap). */
30
+ readonly summary?: ReactNode;
31
+ /** Chevron on the collapsed summary. */
32
+ readonly chevron?: ReactNode;
33
+ /** Done stat icon. */
34
+ readonly done?: ReactNode;
35
+ /** Pending stat icon (rendered spinning via `xk-spin`). */
36
+ readonly pending?: ReactNode;
37
+ /** Error stat icon. */
38
+ readonly error?: ReactNode;
39
+ /** Per-chip pending spinner. */
40
+ readonly chipSpinner?: ReactNode;
41
+ }
42
+
43
+ export interface ToolStripProps {
44
+ readonly tools: ReadonlyArray<ToolCall>;
45
+ readonly skin?: SessionSkin;
46
+ readonly icons?: ToolStripIcons;
47
+ /** Collapse threshold; above this the strip starts collapsed. */
48
+ readonly collapseAbove?: number;
49
+ }
50
+
51
+ function Stat({
52
+ icon,
53
+ n,
54
+ color,
55
+ spin,
56
+ }: {
57
+ readonly icon: ReactNode;
58
+ readonly n: number;
59
+ readonly color: string;
60
+ readonly spin?: boolean;
61
+ }): ReactElement {
62
+ return (
63
+ <span
64
+ className="mono"
65
+ style={{
66
+ display: 'inline-flex',
67
+ alignItems: 'center',
68
+ gap: 3,
69
+ fontSize: 11,
70
+ color,
71
+ }}
72
+ >
73
+ <span className={spin ? 'xk-spin' : ''} style={{ display: 'inline-flex' }}>
74
+ {icon}
75
+ </span>
76
+ {n}
77
+ </span>
78
+ );
79
+ }
80
+
81
+ export function ToolChip({
82
+ tool,
83
+ skin = SessionSkin.Minimal,
84
+ spinnerIcon,
85
+ }: {
86
+ readonly tool: ToolCall;
87
+ readonly skin?: SessionSkin;
88
+ readonly spinnerIcon?: ReactNode;
89
+ }): ReactElement {
90
+ const [expanded, setExpanded] = useState(false);
91
+ const dotColor = toolStatusColor(tool.status);
92
+ const tint = skin === SessionSkin.Functional;
93
+ const isError = tool.status === ToolStatus.Error;
94
+ return (
95
+ <div style={{ display: 'inline-flex', flexDirection: 'column' }}>
96
+ <button
97
+ type="button"
98
+ onClick={() => tool.detail && setExpanded((v) => !v)}
99
+ style={{
100
+ display: 'inline-flex',
101
+ alignItems: 'center',
102
+ gap: 7,
103
+ padding: '5px 10px',
104
+ borderRadius: 8,
105
+ border: `1px solid ${tint && isError ? 'hsl(var(--destructive, var(--danger)) / 0.3)' : 'hsl(var(--rule))'}`,
106
+ background:
107
+ tint && isError
108
+ ? 'hsl(var(--destructive, var(--danger)) / 0.05)'
109
+ : 'hsl(var(--paper-elev))',
110
+ cursor: tool.detail ? 'pointer' : 'default',
111
+ maxWidth: 320,
112
+ }}
113
+ >
114
+ <span
115
+ style={{
116
+ width: 6,
117
+ height: 6,
118
+ borderRadius: '50%',
119
+ background: dotColor,
120
+ flexShrink: 0,
121
+ }}
122
+ />
123
+ {tool.icon && (
124
+ <span style={{ display: 'inline-flex', color: 'hsl(var(--ink-3))' }}>
125
+ {tool.icon}
126
+ </span>
127
+ )}
128
+ <span style={{ fontSize: 12.5, fontWeight: 500, color: 'hsl(var(--ink-2))' }}>
129
+ {tool.label}
130
+ </span>
131
+ {tool.arg && (
132
+ <span
133
+ className="mono"
134
+ style={{
135
+ fontSize: 11,
136
+ color: 'hsl(var(--ink-3))',
137
+ overflow: 'hidden',
138
+ textOverflow: 'ellipsis',
139
+ whiteSpace: 'nowrap',
140
+ maxWidth: 180,
141
+ }}
142
+ >
143
+ {tool.arg}
144
+ </span>
145
+ )}
146
+ {tool.status === ToolStatus.Pending && spinnerIcon && (
147
+ <span className="xk-spin" style={{ display: 'inline-flex', color: 'hsl(var(--warning))' }}>
148
+ {spinnerIcon}
149
+ </span>
150
+ )}
151
+ {tool.count !== undefined && tool.count > 1 && (
152
+ <span
153
+ className="mono"
154
+ style={{
155
+ fontSize: 10,
156
+ color: 'hsl(var(--ink-3))',
157
+ padding: '0 5px',
158
+ background: 'hsl(var(--muted))',
159
+ borderRadius: 6,
160
+ }}
161
+ >
162
+ ×{tool.count}
163
+ </span>
164
+ )}
165
+ </button>
166
+ {expanded && tool.detail && (
167
+ <pre
168
+ className="mono"
169
+ style={{
170
+ margin: '5px 0 0',
171
+ padding: '9px 11px',
172
+ background: 'hsl(var(--paper-sunk))',
173
+ border: '1px solid hsl(var(--rule))',
174
+ borderRadius: 8,
175
+ fontSize: 11,
176
+ lineHeight: 1.55,
177
+ color: 'hsl(var(--ink-2))',
178
+ maxWidth: 460,
179
+ overflowX: 'auto',
180
+ whiteSpace: 'pre-wrap',
181
+ }}
182
+ >
183
+ {tool.detail}
184
+ </pre>
185
+ )}
186
+ </div>
187
+ );
188
+ }
189
+
190
+ export function ToolStrip({
191
+ tools,
192
+ skin = SessionSkin.Minimal,
193
+ icons,
194
+ collapseAbove = 4,
195
+ }: ToolStripProps): ReactElement {
196
+ const [open, setOpen] = useState(false);
197
+ const many = tools.length > collapseAbove;
198
+ const done = tools.filter((t) => t.status === ToolStatus.Done).length;
199
+ const error = tools.filter((t) => t.status === ToolStatus.Error).length;
200
+ const pending = tools.filter((t) => t.status === ToolStatus.Pending).length;
201
+
202
+ if (!many || open) {
203
+ return (
204
+ <div style={{ display: 'flex', flexWrap: 'wrap', gap: 6, marginTop: 9 }}>
205
+ {many && (
206
+ <button
207
+ type="button"
208
+ onClick={() => setOpen(false)}
209
+ style={{
210
+ fontSize: 11,
211
+ color: 'hsl(var(--ink-3))',
212
+ padding: '4px 8px',
213
+ borderRadius: 7,
214
+ border: '1px solid hsl(var(--rule))',
215
+ background: 'hsl(var(--paper-elev))',
216
+ }}
217
+ >
218
+ ‹ collapse
219
+ </button>
220
+ )}
221
+ {tools.map((tool, index) => (
222
+ <ToolChip
223
+ key={index}
224
+ tool={tool}
225
+ skin={skin}
226
+ spinnerIcon={icons?.chipSpinner}
227
+ />
228
+ ))}
229
+ </div>
230
+ );
231
+ }
232
+
233
+ return (
234
+ <button
235
+ type="button"
236
+ onClick={() => setOpen(true)}
237
+ style={{
238
+ marginTop: 9,
239
+ display: 'flex',
240
+ alignItems: 'center',
241
+ gap: 9,
242
+ width: '100%',
243
+ padding: '7px 11px',
244
+ borderRadius: 9,
245
+ border: '1px solid hsl(var(--rule))',
246
+ background:
247
+ skin === SessionSkin.Functional
248
+ ? 'hsl(var(--muted))'
249
+ : 'hsl(var(--paper-elev))',
250
+ textAlign: 'left',
251
+ }}
252
+ >
253
+ {icons?.summary && (
254
+ <span style={{ display: 'inline-flex', color: 'hsl(var(--primary))' }}>
255
+ {icons.summary}
256
+ </span>
257
+ )}
258
+ <span style={{ fontSize: 12.5, fontWeight: 500, color: 'hsl(var(--ink-2))' }}>
259
+ {tools.length} tool calls
260
+ </span>
261
+ <span style={{ flex: 1 }} />
262
+ {done > 0 && icons?.done && (
263
+ <Stat icon={icons.done} n={done} color={toolStatusColor(ToolStatus.Done)} />
264
+ )}
265
+ {pending > 0 && icons?.pending && (
266
+ <Stat icon={icons.pending} n={pending} color={toolStatusColor(ToolStatus.Pending)} spin />
267
+ )}
268
+ {error > 0 && icons?.error && (
269
+ <Stat icon={icons.error} n={error} color={toolStatusColor(ToolStatus.Error)} />
270
+ )}
271
+ {icons?.chevron && (
272
+ <span style={{ display: 'inline-flex', color: 'hsl(var(--ink-4))' }}>
273
+ {icons.chevron}
274
+ </span>
275
+ )}
276
+ </button>
277
+ );
278
+ }
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Three bouncing dots — the agent "typing"/streaming indicator.
3
+ * Animation = the namespaced `xk-dot-bounce` keyframe (host stylesheet).
4
+ */
5
+ import type { ReactElement } from 'react';
6
+
7
+ export function TypingDots(): ReactElement {
8
+ return (
9
+ <span style={{ display: 'inline-flex', gap: 3, alignItems: 'center' }}>
10
+ {[0, 1, 2].map((i) => (
11
+ <span
12
+ key={i}
13
+ style={{
14
+ width: 5,
15
+ height: 5,
16
+ borderRadius: '50%',
17
+ background: 'hsl(var(--primary))',
18
+ animation: `xk-dot-bounce 1.1s ${i * 0.15}s infinite`,
19
+ }}
20
+ />
21
+ ))}
22
+ </span>
23
+ );
24
+ }
@@ -0,0 +1,44 @@
1
+ /**
2
+ * `@xemahq/ui-kernel/session-kit` — the thin, prop-driven generic
3
+ * component substrate for agent-session surfaces and the Portals
4
+ * chrome (Pillar 1 of the Xema Portals design handoff).
5
+ *
6
+ * Everything here is presentational and icon-agnostic: components take
7
+ * data + host-supplied icon nodes and emit inline-styled markup against
8
+ * the CSS-variable design tokens. No data fetching, no registry
9
+ * subscriptions, no framework imports — so the same kit renders inside
10
+ * the host shell and inside a biome's own surfaces.
11
+ *
12
+ * Pillar 2 consumes these via `import { … } from '@xemahq/ui-kernel/session-kit'`.
13
+ */
14
+
15
+ // Closed-set enums + the authoritative status-dot map.
16
+ export * from './lib/enums';
17
+ export * from './lib/status-dot';
18
+ export * from './lib/portal-accent';
19
+
20
+ // Shared display primitives.
21
+ export * from './primitives/RiskPill';
22
+ export * from './primitives/ScopeDot';
23
+ export * from './primitives/PortalGlyph';
24
+ export * from './primitives/Avatar';
25
+ export * from './primitives/Segmented';
26
+
27
+ // Session display components.
28
+ export * from './display/MD';
29
+ export * from './display/TypingDots';
30
+ export * from './display/TokenMeter';
31
+ export * from './display/ContextHeader';
32
+ export * from './display/MessageTurn';
33
+ export * from './display/ToolStrip';
34
+ export * from './display/ThinkingPanel';
35
+ export * from './display/FileDiffCard';
36
+ export * from './display/TodoChecklist';
37
+
38
+ // Generic searchable picker.
39
+ export * from './combobox/Combobox';
40
+ export * from './combobox/use-click-outside';
41
+
42
+ // Approvals primitive (Pillar 3 — generic frame + scoped bodies + sticky
43
+ // bar + cross-portal Approvals Center).
44
+ export * from './approvals';
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Closed-set enums for the session-kit. Every variant a component
3
+ * branches on is a real enum value (no free-form string literals), so
4
+ * the kit stays type-safe and the colour/icon maps below can be
5
+ * exhaustive.
6
+ *
7
+ * Risk tier is NOT redefined here — it is owned by the kernel
8
+ * (`CapabilityRiskTier`, low/medium/high/critical) and re-exported from
9
+ * `../primitives/RiskPill` so consumers import one canonical enum.
10
+ */
11
+
12
+ /** Running status of a single tool call in the transcript. */
13
+ export enum ToolStatus {
14
+ Pending = 'pending',
15
+ Done = 'done',
16
+ Error = 'error',
17
+ }
18
+
19
+ /**
20
+ * The four authoritative transcript status-dot states (HANDOFF §3.1).
21
+ * `Narration` is the hollow dot used by a `say` event — it is not a
22
+ * tool, so it sits outside `ToolStatus`.
23
+ */
24
+ export enum SessionDotState {
25
+ Pending = 'pending',
26
+ Done = 'done',
27
+ Error = 'error',
28
+ Narration = 'narration',
29
+ }
30
+
31
+ /** Visual treatment of a status dot. */
32
+ export enum SessionDotKind {
33
+ /** Solid fill in the token colour. */
34
+ Solid = 'solid',
35
+ /** Hollow ring (paper fill + rule border) — narration. */
36
+ Hollow = 'hollow',
37
+ }
38
+
39
+ /** A todo/plan checklist item's state. */
40
+ export enum TodoState {
41
+ Todo = 'todo',
42
+ Active = 'active',
43
+ Done = 'done',
44
+ }
45
+
46
+ /** Biome provenance scope (drives the ScopeDot colour). */
47
+ export enum BiomeScope {
48
+ System = 'system',
49
+ Platform = 'platform',
50
+ Community = 'community',
51
+ }
52
+
53
+ /**
54
+ * Look-and-feel variant. The kit defaults to `Minimal` (the thin/clean
55
+ * look the design converged on); `Functional` adds tinted surfaces.
56
+ */
57
+ export enum SessionSkin {
58
+ Minimal = 'minimal',
59
+ Functional = 'functional',
60
+ }
61
+
62
+ /** A message turn's author role. */
63
+ export enum TurnRole {
64
+ User = 'user',
65
+ Agent = 'agent',
66
+ }
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Per-portal accent token helper. A portal stores its accent as a CSS
3
+ * custom-property reference (`var(--p-finance)`, …); these helpers turn
4
+ * that into a concrete `hsl(...)` expression, with the brand `--primary`
5
+ * as the no-portal fallback.
6
+ *
7
+ * The token VALUES live in the host stylesheet (`--p-finance`, …). This
8
+ * module only composes the colour expression — it never hard-codes a
9
+ * hue, so re-skinning happens entirely in CSS.
10
+ */
11
+
12
+ /** A portal's CSS accent variable, e.g. `var(--p-finance)`. */
13
+ export type PortalAccentVar = `var(--${string})`;
14
+
15
+ const PRIMARY = '--primary';
16
+
17
+ /**
18
+ * Resolve a portal accent to an `hsl(...)` expression.
19
+ *
20
+ * @param accentVar the portal's `var(--p-*)` reference, or undefined for
21
+ * "no active portal" (falls back to the brand `--primary`).
22
+ * @param alpha optional 0–1 alpha applied via the HSL `/ a` syntax.
23
+ */
24
+ export function portalAccent(
25
+ accentVar: PortalAccentVar | undefined,
26
+ alpha?: number,
27
+ ): string {
28
+ const inner = accentVar ?? `var(${PRIMARY})`;
29
+ return alpha !== undefined ? `hsl(${inner} / ${alpha})` : `hsl(${inner})`;
30
+ }
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Authoritative transcript status-dot colour map (HANDOFF §3.1).
3
+ *
4
+ * pending / running → amber, PULSING (--warning)
5
+ * done / success → green (--success)
6
+ * error → red (--danger / --destructive)
7
+ * narration (`say`) → hollow ring (--paper-elev fill + --rule-2 border)
8
+ *
9
+ * Encoded once here so every surface (rail dot, tool chip, tool-strip
10
+ * summary stat) reads from a single typed source instead of scattering
11
+ * the colour choices across components.
12
+ *
13
+ * Note on the danger token: host-web names it `--destructive`; the
14
+ * design names it `--danger`. We emit `--destructive` and fall back to
15
+ * `--danger` so the kit renders correctly under either token set.
16
+ */
17
+ import { SessionDotKind, SessionDotState, ToolStatus } from './enums';
18
+
19
+ export interface SessionDotStyle {
20
+ /** CSS colour expression for a solid dot. */
21
+ readonly color: string;
22
+ /** Solid vs hollow. */
23
+ readonly kind: SessionDotKind;
24
+ /** Whether the dot animates with the `xk-pulse-soft` keyframe. */
25
+ readonly pulsing: boolean;
26
+ }
27
+
28
+ const DANGER = 'hsl(var(--destructive, var(--danger)))';
29
+
30
+ export const SESSION_DOT_STYLE: Record<SessionDotState, SessionDotStyle> = {
31
+ [SessionDotState.Pending]: {
32
+ color: 'hsl(var(--warning))',
33
+ kind: SessionDotKind.Solid,
34
+ pulsing: true,
35
+ },
36
+ [SessionDotState.Done]: {
37
+ color: 'hsl(var(--success))',
38
+ kind: SessionDotKind.Solid,
39
+ pulsing: false,
40
+ },
41
+ [SessionDotState.Error]: {
42
+ color: DANGER,
43
+ kind: SessionDotKind.Solid,
44
+ pulsing: false,
45
+ },
46
+ [SessionDotState.Narration]: {
47
+ color: 'hsl(var(--paper-elev))',
48
+ kind: SessionDotKind.Hollow,
49
+ pulsing: false,
50
+ },
51
+ };
52
+
53
+ /** Map a tool's running status onto its dot state. */
54
+ export function dotStateForTool(status: ToolStatus): SessionDotState {
55
+ switch (status) {
56
+ case ToolStatus.Pending:
57
+ return SessionDotState.Pending;
58
+ case ToolStatus.Done:
59
+ return SessionDotState.Done;
60
+ case ToolStatus.Error:
61
+ return SessionDotState.Error;
62
+ }
63
+ }
64
+
65
+ /** Resolve the solid colour for a tool status (chips, summary stats). */
66
+ export function toolStatusColor(status: ToolStatus): string {
67
+ return SESSION_DOT_STYLE[dotStateForTool(status)].color;
68
+ }
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Circular initials avatar. Mono initials on a soft accent fill.
3
+ */
4
+ import type { CSSProperties, ReactElement } from 'react';
5
+
6
+ export interface AvatarProps {
7
+ readonly initials: string;
8
+ readonly size?: number;
9
+ /** Background fill. Defaults to the soft accent tint. */
10
+ readonly color?: string;
11
+ /** Initials colour. Defaults to the accent ink. */
12
+ readonly ink?: string;
13
+ readonly style?: CSSProperties;
14
+ }
15
+
16
+ export function Avatar({
17
+ initials,
18
+ size = 26,
19
+ color = 'hsl(var(--accent-2, var(--accent-tint)))',
20
+ ink = 'hsl(var(--primary-ink, var(--accent-ink)))',
21
+ style,
22
+ }: AvatarProps): ReactElement {
23
+ return (
24
+ <span
25
+ className="mono"
26
+ style={{
27
+ width: size,
28
+ height: size,
29
+ borderRadius: '50%',
30
+ flexShrink: 0,
31
+ display: 'grid',
32
+ placeItems: 'center',
33
+ background: color,
34
+ color: ink,
35
+ fontSize: size * 0.4,
36
+ fontWeight: 600,
37
+ letterSpacing: '-0.02em',
38
+ ...style,
39
+ }}
40
+ >
41
+ {initials}
42
+ </span>
43
+ );
44
+ }
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Portal glyph — a rounded-square badge tinted with the portal's accent
3
+ * token. The glyph icon itself is supplied by the host as a `ReactNode`
4
+ * (the kit carries no icon set), matching the icon-agnostic convention
5
+ * used elsewhere in ui-kernel.
6
+ */
7
+ import { portalAccent, type PortalAccentVar } from '../lib/portal-accent';
8
+
9
+ import type { CSSProperties, ReactElement, ReactNode } from 'react';
10
+
11
+
12
+ export interface PortalGlyphProps {
13
+ /** The portal's accent token, e.g. `var(--p-finance)`. Omit for the brand accent. */
14
+ readonly accentVar?: PortalAccentVar;
15
+ /** The portal's glyph (host-supplied icon node). */
16
+ readonly icon: ReactNode;
17
+ readonly size?: number;
18
+ readonly radius?: number;
19
+ /** Emphasised border + ring when the portal is the active one. */
20
+ readonly active?: boolean;
21
+ readonly style?: CSSProperties;
22
+ }
23
+
24
+ export function PortalGlyph({
25
+ accentVar,
26
+ icon,
27
+ size = 34,
28
+ radius = 9,
29
+ active = false,
30
+ style,
31
+ }: PortalGlyphProps): ReactElement {
32
+ return (
33
+ <span
34
+ style={{
35
+ width: size,
36
+ height: size,
37
+ borderRadius: radius,
38
+ flexShrink: 0,
39
+ display: 'grid',
40
+ placeItems: 'center',
41
+ background: portalAccent(accentVar, 0.13),
42
+ color: portalAccent(accentVar),
43
+ border: `1px solid ${portalAccent(accentVar, active ? 0.5 : 0.22)}`,
44
+ boxShadow: active ? `0 0 0 1px ${portalAccent(accentVar, 0.25)}` : 'none',
45
+ ...style,
46
+ }}
47
+ >
48
+ {icon}
49
+ </span>
50
+ );
51
+ }