@zeyos/zx 5.5.0 → 5.7.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 (235) hide show
  1. package/CHANGELOG.md +210 -0
  2. package/README.md +73 -7
  3. package/bin/zx-css.js +328 -0
  4. package/dist/types/components/account-menu/account-menu.d.ts +4 -2
  5. package/dist/types/components/activity-list/activity-list.d.ts +14 -8
  6. package/dist/types/components/agent-thread/ag-ui.d.ts +340 -0
  7. package/dist/types/components/agent-thread/agent-thread.d.ts +711 -0
  8. package/dist/types/components/agent-thread/ui-message-stream.d.ts +401 -0
  9. package/dist/types/components/app-sidebar/app-sidebar.d.ts +14 -8
  10. package/dist/types/components/approval-card/approval-card.d.ts +596 -0
  11. package/dist/types/components/avatar/avatar.d.ts +91 -4
  12. package/dist/types/components/block-view/block-view.d.ts +205 -0
  13. package/dist/types/components/breadcrumb/breadcrumb.d.ts +3 -3
  14. package/dist/types/components/calendar/calendar-model.d.ts +9 -2
  15. package/dist/types/components/calendar/calendar.d.ts +12 -4
  16. package/dist/types/components/chart/chart.d.ts +25 -13
  17. package/dist/types/components/code-editor/code-editor.d.ts +7 -2
  18. package/dist/types/components/composer/composer.d.ts +938 -0
  19. package/dist/types/components/composer/queue.d.ts +76 -0
  20. package/dist/types/components/copy/copy-button.d.ts +6 -4
  21. package/dist/types/components/copy/copy-input.d.ts +10 -6
  22. package/dist/types/components/datebox/date-range-box.d.ts +33 -0
  23. package/dist/types/components/datebox/placeholder.d.ts +7 -0
  24. package/dist/types/components/dock/dock.d.ts +12 -3
  25. package/dist/types/components/entity-ref/entity-ref.d.ts +5 -3
  26. package/dist/types/components/field-upload/field-upload.d.ts +3 -2
  27. package/dist/types/components/file-item/file-item.d.ts +3 -2
  28. package/dist/types/components/file-list/file-list.d.ts +14 -8
  29. package/dist/types/components/filter/filter-model.d.ts +31 -1
  30. package/dist/types/components/filter/filter.d.ts +20 -2
  31. package/dist/types/components/finder/finder.d.ts +14 -6
  32. package/dist/types/components/flag/flag.d.ts +99 -0
  33. package/dist/types/components/grid/grid.d.ts +1 -1
  34. package/dist/types/components/kanban-view/kanban-view.d.ts +8 -66
  35. package/dist/types/components/launcher/launcher.d.ts +2 -0
  36. package/dist/types/components/multi-value-editor/multi-value-editor.d.ts +3 -2
  37. package/dist/types/components/number-field/number-field.d.ts +17 -6
  38. package/dist/types/components/prompt-starters/prompt-starters.d.ts +107 -0
  39. package/dist/types/components/prose/prose.d.ts +9 -6
  40. package/dist/types/components/questionnaire/conditions.d.ts +270 -0
  41. package/dist/types/components/questionnaire/items.d.ts +52 -30
  42. package/dist/types/components/questionnaire/questionnaire.d.ts +44 -4
  43. package/dist/types/components/rating/rating.d.ts +5 -3
  44. package/dist/types/components/run-status/run-status.d.ts +393 -0
  45. package/dist/types/components/run-trace/run-trace.d.ts +624 -0
  46. package/dist/types/components/select/country.d.ts +106 -0
  47. package/dist/types/components/select/field-adapter.d.ts +2 -1
  48. package/dist/types/components/select/locale.d.ts +102 -0
  49. package/dist/types/components/select/select.d.ts +41 -2
  50. package/dist/types/components/slider/slider.d.ts +1 -0
  51. package/dist/types/components/sort-control/sort-control.d.ts +7 -3
  52. package/dist/types/components/source-list/source-list.d.ts +179 -0
  53. package/dist/types/components/split-view/split-view.d.ts +5 -3
  54. package/dist/types/components/surface/catalog.d.ts +260 -0
  55. package/dist/types/components/surface/elicit.d.ts +81 -0
  56. package/dist/types/components/surface/mcp.d.ts +165 -0
  57. package/dist/types/components/surface/schema.d.ts +314 -0
  58. package/dist/types/components/surface/stream.d.ts +118 -0
  59. package/dist/types/components/surface/surface.d.ts +718 -0
  60. package/dist/types/components/surface/text.d.ts +277 -0
  61. package/dist/types/components/surface/validate.d.ts +339 -0
  62. package/dist/types/components/table/table.d.ts +55 -3
  63. package/dist/types/components/table/window.d.ts +203 -0
  64. package/dist/types/components/toolbar/toolbar.d.ts +10 -6
  65. package/dist/types/components/tooltip/tooltip.d.ts +2 -2
  66. package/dist/types/components/tree/tree.d.ts +20 -13
  67. package/dist/types/core/component.d.ts +10 -0
  68. package/dist/types/core/date.d.ts +8 -1
  69. package/dist/types/core/dom.d.ts +1 -0
  70. package/dist/types/core/http.d.ts +10 -0
  71. package/dist/types/core/i18n.d.ts +38 -0
  72. package/dist/types/core/messages.d.ts +479 -1
  73. package/dist/types/core/storage.d.ts +7 -2
  74. package/dist/types/elements/define.d.ts +21 -46
  75. package/dist/types/elements/definitions.d.ts +147 -0
  76. package/dist/types/elements/kit.d.ts +7 -0
  77. package/dist/types/elements/reflect.d.ts +6 -3
  78. package/dist/types/index.d.ts +18 -1
  79. package/dist/types/internal/agent-model.d.ts +587 -0
  80. package/dist/types/internal/date-locale.d.ts +7 -0
  81. package/dist/types/internal/highlight.d.ts +24 -0
  82. package/dist/types/internal/json-patch.d.ts +146 -0
  83. package/dist/types/internal/presence-loop.d.ts +148 -0
  84. package/dist/types/locales/de.d.ts +13 -0
  85. package/dist/types/locales/en.d.ts +2 -0
  86. package/dist/types/locales/index.d.ts +823 -0
  87. package/dist/types/zeyos/view.d.ts +8 -1
  88. package/dist/zx-zeyos.esm.js +20505 -18748
  89. package/dist/zx-zeyos.esm.min.js +5 -5
  90. package/dist/zx.core.css +1276 -0
  91. package/dist/zx.core.min.css +1 -0
  92. package/dist/zx.css +2424 -134
  93. package/dist/zx.esm.js +46167 -28468
  94. package/dist/zx.esm.min.js +40 -8
  95. package/dist/zx.global.js +46167 -28468
  96. package/dist/zx.global.min.js +40 -8
  97. package/dist/zx.layered.css +17302 -0
  98. package/dist/zx.layered.min.css +1 -0
  99. package/dist/zx.min.css +1 -1
  100. package/docs/agent-catalog.json +12501 -0
  101. package/docs/agent-surfaces.md +340 -0
  102. package/docs/api.json +2057 -166
  103. package/docs/llms.md +1458 -58
  104. package/docs/llms.txt +38 -8
  105. package/package.json +29 -6
  106. package/src/components/account-menu/account-menu.js +6 -3
  107. package/src/components/activity-item/activity-item.js +2 -1
  108. package/src/components/activity-list/activity-list.js +16 -10
  109. package/src/components/agent-thread/ag-ui.js +1439 -0
  110. package/src/components/agent-thread/agent-thread.css +417 -0
  111. package/src/components/agent-thread/agent-thread.js +1670 -0
  112. package/src/components/agent-thread/ui-message-stream.js +1281 -0
  113. package/src/components/app-sidebar/app-sidebar.js +18 -8
  114. package/src/components/approval-card/approval-card.css +289 -0
  115. package/src/components/approval-card/approval-card.js +1378 -0
  116. package/src/components/avatar/avatar.css +56 -1
  117. package/src/components/avatar/avatar.js +148 -26
  118. package/src/components/block-view/block-view.css +300 -0
  119. package/src/components/block-view/block-view.js +524 -0
  120. package/src/components/breadcrumb/breadcrumb.js +8 -5
  121. package/src/components/calendar/calendar-model.js +8 -2
  122. package/src/components/calendar/calendar.js +53 -18
  123. package/src/components/chart/chart.js +54 -23
  124. package/src/components/code-editor/code-editor.js +45 -8
  125. package/src/components/code-editor/field-adapter.js +1 -1
  126. package/src/components/composer/composer.css +482 -0
  127. package/src/components/composer/composer.js +1815 -0
  128. package/src/components/composer/queue.js +78 -0
  129. package/src/components/context-menu/context-menu.js +12 -1
  130. package/src/components/copy/copy-button.js +9 -7
  131. package/src/components/copy/copy-input.js +10 -6
  132. package/src/components/date-picker/date-picker.js +2 -1
  133. package/src/components/date-picker/date-range-picker.js +8 -7
  134. package/src/components/datebox/date-range-box.js +3 -9
  135. package/src/components/datebox/datebox.js +18 -21
  136. package/src/components/datebox/placeholder.js +18 -0
  137. package/src/components/dialog/dialog.js +1 -1
  138. package/src/components/dock/dock.js +34 -13
  139. package/src/components/entity-ref/entity-ref.js +16 -5
  140. package/src/components/field-upload/field-upload.js +81 -38
  141. package/src/components/file-item/file-item.js +70 -40
  142. package/src/components/file-list/file-list.js +15 -9
  143. package/src/components/filter/filter-model.js +46 -8
  144. package/src/components/filter/filter.css +3 -3
  145. package/src/components/filter/filter.js +29 -10
  146. package/src/components/filter-panel/filter-panel.js +13 -5
  147. package/src/components/finder/finder.js +50 -26
  148. package/src/components/flag/flag.css +40 -0
  149. package/src/components/flag/flag.js +177 -0
  150. package/src/components/form/form.js +1 -1
  151. package/src/components/grid/grid.js +22 -8
  152. package/src/components/kanban-view/kanban-view.js +51 -81
  153. package/src/components/launcher/launcher.js +17 -2
  154. package/src/components/list-toolbar/list-toolbar.js +2 -1
  155. package/src/components/master-panel/master-panel.js +1 -1
  156. package/src/components/menu-button/menu-button.js +4 -0
  157. package/src/components/message/message.js +3 -0
  158. package/src/components/multi-value-editor/multi-value-editor.js +10 -9
  159. package/src/components/navigation-bar/navigation-bar.js +3 -3
  160. package/src/components/number-field/number-field.js +29 -13
  161. package/src/components/prompt-starters/prompt-starters.css +91 -0
  162. package/src/components/prompt-starters/prompt-starters.js +206 -0
  163. package/src/components/prose/prose.js +14 -10
  164. package/src/components/questionnaire/conditions.js +666 -0
  165. package/src/components/questionnaire/items.js +150 -41
  166. package/src/components/questionnaire/questionnaire.js +126 -32
  167. package/src/components/rating/rating.js +5 -4
  168. package/src/components/run-status/run-status.css +208 -0
  169. package/src/components/run-status/run-status.js +782 -0
  170. package/src/components/run-trace/run-trace.css +443 -0
  171. package/src/components/run-trace/run-trace.js +1209 -0
  172. package/src/components/select/country.js +136 -0
  173. package/src/components/select/field-adapter.js +7 -2
  174. package/src/components/select/locale.js +219 -0
  175. package/src/components/select/select.css +20 -22
  176. package/src/components/select/select.js +94 -12
  177. package/src/components/sheet/sheet-stack.js +10 -1
  178. package/src/components/slider/slider.js +7 -2
  179. package/src/components/sort-control/sort-control.js +15 -5
  180. package/src/components/source-list/source-list.css +208 -0
  181. package/src/components/source-list/source-list.js +358 -0
  182. package/src/components/split-view/split-view.js +5 -3
  183. package/src/components/surface/catalog.js +1334 -0
  184. package/src/components/surface/elicit.js +107 -0
  185. package/src/components/surface/mcp.js +243 -0
  186. package/src/components/surface/schema.js +644 -0
  187. package/src/components/surface/stream.js +245 -0
  188. package/src/components/surface/surface.css +308 -0
  189. package/src/components/surface/surface.js +2291 -0
  190. package/src/components/surface/text.js +513 -0
  191. package/src/components/surface/validate.js +2218 -0
  192. package/src/components/tabbox/tabbox.js +9 -0
  193. package/src/components/table/table.css +63 -3
  194. package/src/components/table/table.js +167 -28
  195. package/src/components/table/window.js +317 -0
  196. package/src/components/toolbar/toolbar.js +12 -7
  197. package/src/components/tooltip/tooltip.css +2 -3
  198. package/src/components/tooltip/tooltip.js +32 -5
  199. package/src/components/tree/tree.js +53 -23
  200. package/src/core/component.js +25 -1
  201. package/src/core/date.js +62 -16
  202. package/src/core/dom.js +22 -2
  203. package/src/core/format.js +15 -13
  204. package/src/core/http.js +29 -20
  205. package/src/core/i18n.js +83 -10
  206. package/src/core/keyboard.js +79 -8
  207. package/src/core/messages.js +519 -2
  208. package/src/core/overlay-host.js +1 -0
  209. package/src/core/storage.js +59 -6
  210. package/src/elements/define.js +178 -130
  211. package/src/elements/definitions.js +229 -0
  212. package/src/elements/kit.js +444 -0
  213. package/src/elements/reflect.js +8 -3
  214. package/src/index.js +18 -1
  215. package/src/internal/agent-model.js +488 -0
  216. package/src/internal/date-locale.js +11 -0
  217. package/src/internal/highlight.js +104 -0
  218. package/src/internal/json-patch.js +405 -0
  219. package/src/internal/presence-loop.js +343 -0
  220. package/src/locales/de.js +911 -0
  221. package/src/locales/en.js +2 -0
  222. package/src/locales/index.js +7 -0
  223. package/src/zeyos/calendar.js +2 -1
  224. package/src/zeyos/form.js +2 -1
  225. package/src/zeyos/launcher.js +7 -6
  226. package/src/zeyos/module-bar.js +2 -1
  227. package/src/zeyos/schema.js +37 -23
  228. package/src/zeyos/select.js +4 -3
  229. package/src/zeyos/table.js +2 -13
  230. package/src/zeyos/view.js +57 -17
  231. package/styles/core.css +11 -0
  232. package/styles/tokens/semantic.css +1 -0
  233. package/styles/zeyos.css +2 -0
  234. package/styles/zx.css +11 -8
  235. package/styles/zx.layered.css +1 -0
@@ -0,0 +1,587 @@
1
+ export type RunState = 'queued' | 'running' | 'waiting' | 'paused' | 'blocked' | 'done' | 'failed' | 'stopped' | 'skipped';
2
+ export type AgentActivity = 'idle' | 'thinking' | 'working' | 'needs-you' | 'blocked' | 'offline';
3
+ export type FigureRow = [string, string, string] | {
4
+ label: string;
5
+ detail?: string;
6
+ value: string;
7
+ call?: string;
8
+ };
9
+ export type Block = {
10
+ type: 'p';
11
+ text: string;
12
+ } | {
13
+ type: 'quote';
14
+ text: string;
15
+ } | {
16
+ type: 'heading';
17
+ level?: 2 | 3;
18
+ text: string;
19
+ } | {
20
+ type: 'list';
21
+ ordered?: boolean;
22
+ items: string[];
23
+ } | {
24
+ type: 'code';
25
+ language?: string;
26
+ code: string;
27
+ lines?: boolean;
28
+ } | {
29
+ type: 'table';
30
+ columns: string[];
31
+ rows: string[][];
32
+ align?: Array<'start' | 'center' | 'end' | null>;
33
+ } | {
34
+ type: 'figures';
35
+ rows: FigureRow[];
36
+ } | {
37
+ type: 'callout';
38
+ tone?: 'info' | 'success' | 'warning' | 'danger';
39
+ title?: string;
40
+ text: string;
41
+ } | {
42
+ type: 'artifact';
43
+ id: string;
44
+ title: string;
45
+ kind?: 'document' | 'code';
46
+ versions?: number;
47
+ };
48
+ export type Source = {
49
+ /**
50
+ * Stable identity.
51
+ */
52
+ id: string;
53
+ /**
54
+ * Full title, shown in the source card.
55
+ */
56
+ title: string;
57
+ /**
58
+ * What the source is.
59
+ */
60
+ kind?: 'web' | 'file' | 'record' | 'call';
61
+ /**
62
+ * Short name shown on the chip: a host, a file name, a record type.
63
+ */
64
+ site?: string;
65
+ /**
66
+ * The passage the answer used.
67
+ */
68
+ snippet?: string;
69
+ /**
70
+ * Address of a `web` source.
71
+ */
72
+ href?: string;
73
+ /**
74
+ * The application record a `record` source names.
75
+ */
76
+ ref?: {
77
+ entity: string;
78
+ id: string;
79
+ };
80
+ /**
81
+ * The trace step the source came from.
82
+ */
83
+ call?: string;
84
+ };
85
+ export type ItemRef = {
86
+ /**
87
+ * Stable identity, handed back on activation.
88
+ */
89
+ id: string;
90
+ /**
91
+ * What the link says.
92
+ */
93
+ label: string;
94
+ /**
95
+ * Glyph name.
96
+ */
97
+ icon?: string;
98
+ /**
99
+ * What kind of thing it is, for the application: `task`, `file`, …
100
+ */
101
+ entity?: string;
102
+ };
103
+ export type TraceStep = {
104
+ /**
105
+ * Stable identity.
106
+ */
107
+ id: string;
108
+ /**
109
+ * What kind of step it is; sets the glyph and how the summary counts it. `task` is a planned step,
110
+ * `ask` a request a person made, `decision` a person's answer; with `think` and `handoff` they are
111
+ * not tool calls.
112
+ */
113
+ kind?: 'search' | 'read' | 'query' | 'write' | 'run' | 'call' | 'handoff' | 'think' | 'task' | 'ask' | 'decision';
114
+ /**
115
+ * What was done, in the past tense: "Read the dunning policy".
116
+ */
117
+ label: string;
118
+ /**
119
+ * Where the step stands.
120
+ */
121
+ status?: RunState;
122
+ /**
123
+ * The present-tense line shown while it runs: "Reading the policy".
124
+ */
125
+ doing?: string;
126
+ /**
127
+ * A muted detail.
128
+ */
129
+ detail?: string;
130
+ /**
131
+ * How long it took.
132
+ */
133
+ ms?: number;
134
+ /**
135
+ * A short result count: "42 rows".
136
+ */
137
+ count?: string;
138
+ /**
139
+ * How many sources a search looked at.
140
+ */
141
+ sources?: number;
142
+ /**
143
+ * The tool's name, shown in mono.
144
+ */
145
+ tool?: string;
146
+ /**
147
+ * The call's arguments, JSON or text.
148
+ */
149
+ args?: string;
150
+ /**
151
+ * What the call returned.
152
+ */
153
+ result?: string;
154
+ /**
155
+ * Why the call failed.
156
+ */
157
+ error?: string;
158
+ /**
159
+ * The id of the step this one repeats.
160
+ */
161
+ retryOf?: string;
162
+ /**
163
+ * Author key of whoever took the step.
164
+ */
165
+ actor?: string;
166
+ /**
167
+ * Author key a `handoff` hands over to.
168
+ */
169
+ to?: string;
170
+ /**
171
+ * Local ISO date-time it started; a running step's clock counts from it.
172
+ */
173
+ at?: string;
174
+ /**
175
+ * Tokens the step used.
176
+ */
177
+ tokens?: number;
178
+ /**
179
+ * Links to what the step touched — a file it wrote, a record it read.
180
+ */
181
+ refs?: ItemRef[];
182
+ };
183
+ export type Author = {
184
+ /**
185
+ * Display name.
186
+ */
187
+ name: string;
188
+ /**
189
+ * What the author is.
190
+ */
191
+ kind?: 'person' | 'agent' | 'model';
192
+ /**
193
+ * Avatar initials; derived from the name when absent.
194
+ */
195
+ initials?: string;
196
+ /**
197
+ * Categorical avatar tone.
198
+ */
199
+ tone?: string;
200
+ /**
201
+ * What an agent is doing now.
202
+ */
203
+ activity?: AgentActivity | null;
204
+ /**
205
+ * The model an agent answers through, shown in the byline.
206
+ */
207
+ via?: string;
208
+ /**
209
+ * A glyph drawn in a tinted tile instead of initials — a model's mark.
210
+ */
211
+ icon?: string;
212
+ };
213
+ export type Attachment = {
214
+ name: string;
215
+ size?: number;
216
+ type?: string;
217
+ };
218
+ export type AnswerVersion = {
219
+ blocks: Block[];
220
+ sources?: Source[];
221
+ steps?: TraceStep[];
222
+ at?: string;
223
+ model?: string;
224
+ stopped?: boolean;
225
+ rating?: 'up' | 'down' | null;
226
+ };
227
+ export type ThreadItem = {
228
+ id: string;
229
+ type: 'user';
230
+ at?: string;
231
+ author?: string;
232
+ text: string;
233
+ files?: Attachment[];
234
+ mentions?: Array<string | {
235
+ name: string;
236
+ tone?: string;
237
+ }>;
238
+ refs?: ItemRef[];
239
+ } | {
240
+ id: string;
241
+ type: 'text';
242
+ at?: string;
243
+ author?: string;
244
+ text: string;
245
+ refs?: ItemRef[];
246
+ } | {
247
+ id: string;
248
+ type: 'answer';
249
+ at?: string;
250
+ author?: string;
251
+ blocks: Block[];
252
+ sources?: Source[];
253
+ steps?: TraceStep[];
254
+ stepsOpen?: boolean;
255
+ streaming?: boolean;
256
+ stopped?: boolean;
257
+ versions?: AnswerVersion[];
258
+ version?: number;
259
+ rating?: 'up' | 'down' | null;
260
+ refs?: ItemRef[];
261
+ } | {
262
+ id: string;
263
+ type: 'trace';
264
+ at?: string;
265
+ author?: string;
266
+ steps: TraceStep[];
267
+ open?: boolean;
268
+ title?: string;
269
+ refs?: ItemRef[];
270
+ } | {
271
+ id: string;
272
+ type: 'approval';
273
+ at?: string;
274
+ author?: string;
275
+ title: string;
276
+ description?: string;
277
+ icon?: string | null;
278
+ tone?: string;
279
+ status?: 'pending' | 'approved' | 'rejected' | 'expired';
280
+ details?: Block[];
281
+ preview?: {
282
+ label: string;
283
+ blocks: Block[];
284
+ };
285
+ fields?: Record<string, Record<string, unknown>>;
286
+ values?: Record<string, unknown>;
287
+ confirmText?: string | null;
288
+ reason?: 'optional' | 'required' | 'none';
289
+ edited?: boolean;
290
+ editedKeys?: string[] | null;
291
+ rejectReason?: string | null;
292
+ answeredBy?: string;
293
+ answeredAt?: string;
294
+ } | {
295
+ id: string;
296
+ type: 'notice';
297
+ at?: string;
298
+ author?: string;
299
+ text: string;
300
+ tone?: 'neutral' | 'info' | 'success' | 'warning' | 'danger';
301
+ action?: {
302
+ id: string;
303
+ label: string;
304
+ };
305
+ } | {
306
+ id: string;
307
+ type: string;
308
+ at?: string;
309
+ author?: string;
310
+ [key: string]: unknown;
311
+ };
312
+ export type StateTone = 'neutral' | 'info' | 'success' | 'warning' | 'danger' | 'muted';
313
+ export type StateEntry = {
314
+ status: string;
315
+ tone: StateTone;
316
+ key: string;
317
+ };
318
+ /**
319
+ * Where a run, or one step of it, stands.
320
+ * @typedef {'queued'|'running'|'waiting'|'paused'|'blocked'|'done'|'failed'|'stopped'|'skipped'} RunState
321
+ */
322
+ /**
323
+ * What an agent is doing, shown beside its avatar.
324
+ * @typedef {'idle'|'thinking'|'working'|'needs-you'|'blocked'|'offline'} AgentActivity
325
+ */
326
+ /**
327
+ * A row of figures: what it is, a muted detail, and the value. The tuple form is shorthand for the
328
+ * object form; `call` names the trace step the value came from.
329
+ * @typedef {[string, string, string]|{label: string, detail?: string, value: string, call?: string}} FigureRow
330
+ */
331
+ /**
332
+ * One block of an answer. Text runs use the inline grammar of `parseInline()`; nothing in a block
333
+ * is ever read as HTML.
334
+ * @typedef {{type: 'p', text: string}
335
+ * | {type: 'quote', text: string}
336
+ * | {type: 'heading', level?: 2|3, text: string}
337
+ * | {type: 'list', ordered?: boolean, items: string[]}
338
+ * | {type: 'code', language?: string, code: string, lines?: boolean}
339
+ * | {type: 'table', columns: string[], rows: string[][], align?: Array<'start'|'center'|'end'|null>}
340
+ * | {type: 'figures', rows: FigureRow[]}
341
+ * | {type: 'callout', tone?: 'info'|'success'|'warning'|'danger', title?: string, text: string}
342
+ * | {type: 'artifact', id: string, title: string, kind?: 'document'|'code', versions?: number}} Block
343
+ */
344
+ /**
345
+ * A source an answer draws on. `web` sources may carry an `href`; a `record` names an application
346
+ * record; a `call` names the trace step it came from.
347
+ * @typedef {Object} Source
348
+ * @property {string} id Stable identity.
349
+ * @property {string} title Full title, shown in the source card.
350
+ * @property {'web'|'file'|'record'|'call'} [kind='web'] What the source is.
351
+ * @property {string} [site] Short name shown on the chip: a host, a file name, a record type.
352
+ * @property {string} [snippet] The passage the answer used.
353
+ * @property {string} [href] Address of a `web` source.
354
+ * @property {{entity: string, id: string}} [ref] The application record a `record` source names.
355
+ * @property {string} [call] The trace step the source came from.
356
+ */
357
+ /**
358
+ * A link from an item or a step to something of the application's own — a task, a file, a
359
+ * record. The application resolves it; the components only draw the label and report the click.
360
+ * @typedef {Object} ItemRef
361
+ * @property {string} id Stable identity, handed back on activation.
362
+ * @property {string} label What the link says.
363
+ * @property {string} [icon] Glyph name.
364
+ * @property {string} [entity] What kind of thing it is, for the application: `task`, `file`, …
365
+ */
366
+ /**
367
+ * One thing an agent did during a run.
368
+ * @typedef {Object} TraceStep
369
+ * @property {string} id Stable identity.
370
+ * @property {'search'|'read'|'query'|'write'|'run'|'call'|'handoff'|'think'|'task'|'ask'|'decision'} [kind='call']
371
+ * What kind of step it is; sets the glyph and how the summary counts it. `task` is a planned step,
372
+ * `ask` a request a person made, `decision` a person's answer; with `think` and `handoff` they are
373
+ * not tool calls.
374
+ * @property {string} label What was done, in the past tense: "Read the dunning policy".
375
+ * @property {RunState} [status='done'] Where the step stands.
376
+ * @property {string} [doing] The present-tense line shown while it runs: "Reading the policy".
377
+ * @property {string} [detail] A muted detail.
378
+ * @property {number} [ms] How long it took.
379
+ * @property {string} [count] A short result count: "42 rows".
380
+ * @property {number} [sources] How many sources a search looked at.
381
+ * @property {string} [tool] The tool's name, shown in mono.
382
+ * @property {string} [args] The call's arguments, JSON or text.
383
+ * @property {string} [result] What the call returned.
384
+ * @property {string} [error] Why the call failed.
385
+ * @property {string} [retryOf] The id of the step this one repeats.
386
+ * @property {string} [actor] Author key of whoever took the step.
387
+ * @property {string} [to] Author key a `handoff` hands over to.
388
+ * @property {string} [at] Local ISO date-time it started; a running step's clock counts from it.
389
+ * @property {number} [tokens] Tokens the step used.
390
+ * @property {ItemRef[]} [refs] Links to what the step touched — a file it wrote, a record it read.
391
+ */
392
+ /**
393
+ * Who wrote an item or took a step.
394
+ * @typedef {Object} Author
395
+ * @property {string} name Display name.
396
+ * @property {'person'|'agent'|'model'} [kind='agent'] What the author is.
397
+ * @property {string} [initials] Avatar initials; derived from the name when absent.
398
+ * @property {string} [tone] Categorical avatar tone.
399
+ * @property {AgentActivity|null} [activity] What an agent is doing now.
400
+ * @property {string} [via] The model an agent answers through, shown in the byline.
401
+ * @property {string} [icon] A glyph drawn in a tinted tile instead of initials — a model's mark.
402
+ */
403
+ /** @typedef {{name: string, size?: number, type?: string}} Attachment */
404
+ /**
405
+ * One version of a regenerated answer.
406
+ * @typedef {{blocks: Block[], sources?: Source[], steps?: TraceStep[], at?: string, model?: string,
407
+ * stopped?: boolean, rating?: 'up'|'down'|null}} AnswerVersion
408
+ */
409
+ /**
410
+ * One item in a conversation thread.
411
+ * `refs` on any item draws links to the application's own things after its content; `mentions` on a
412
+ * person's message marks each `@name` in the text; an answer's `steps` show the work it did inline,
413
+ * above its text, and change with its version.
414
+ * @typedef {{id: string, type: 'user', at?: string, author?: string, text: string, files?: Attachment[],
415
+ * mentions?: Array<string|{name: string, tone?: string}>, refs?: ItemRef[]}
416
+ * | {id: string, type: 'text', at?: string, author?: string, text: string, refs?: ItemRef[]}
417
+ * | {id: string, type: 'answer', at?: string, author?: string, blocks: Block[], sources?: Source[],
418
+ * steps?: TraceStep[], stepsOpen?: boolean, streaming?: boolean, stopped?: boolean, versions?: AnswerVersion[],
419
+ * version?: number, rating?: 'up'|'down'|null, refs?: ItemRef[]}
420
+ * | {id: string, type: 'trace', at?: string, author?: string, steps: TraceStep[], open?: boolean,
421
+ * title?: string, refs?: ItemRef[]}
422
+ * | {id: string, type: 'approval', at?: string, author?: string, title: string, description?: string,
423
+ * icon?: string|null, tone?: string,
424
+ * status?: 'pending'|'approved'|'rejected'|'expired', details?: Block[],
425
+ * preview?: {label: string, blocks: Block[]}, fields?: Record<string, Record<string, unknown>>,
426
+ * values?: Record<string, unknown>, confirmText?: string|null, reason?: 'optional'|'required'|'none',
427
+ * edited?: boolean, editedKeys?: string[]|null, rejectReason?: string|null, answeredBy?: string,
428
+ * answeredAt?: string}
429
+ * | {id: string, type: 'notice', at?: string, author?: string, text: string,
430
+ * tone?: 'neutral'|'info'|'success'|'warning'|'danger', action?: {id: string, label: string}}
431
+ * | {id: string, type: string, at?: string, author?: string, [key: string]: unknown}} ThreadItem
432
+ */
433
+ /** @typedef {'neutral'|'info'|'success'|'warning'|'danger'|'muted'} StateTone */
434
+ /** @typedef {{status: string, tone: StateTone, key: string}} StateEntry */
435
+ /**
436
+ * How each run or step state is drawn: the `statusIcon()` status, its tone, and the message key of
437
+ * the word beside it. A state is always a glyph and a word; its colour never stands alone.
438
+ * @type {Readonly<Record<RunState, StateEntry>>}
439
+ */
440
+ export declare const STATUS: Readonly<Record<RunState, StateEntry>>;
441
+ /**
442
+ * How each agent activity is drawn beside an avatar: the tone of its dot and the message key of
443
+ * its word.
444
+ * @type {Readonly<Record<AgentActivity, {tone: StateTone, key: string}>>}
445
+ */
446
+ export declare const ACTIVITY: Readonly<Record<AgentActivity, {
447
+ tone: StateTone;
448
+ key: string;
449
+ }>>;
450
+ /**
451
+ * The English words for `STATUS` and `ACTIVITY`, for a component's `msg` defaults.
452
+ * @type {Readonly<Record<string, string>>}
453
+ */
454
+ export declare const AGENT_MESSAGES: Readonly<Record<string, string>>;
455
+ /**
456
+ * Reads a state, falling back to `done` for anything the model does not know.
457
+ * @param {unknown} state
458
+ * @returns {RunState}
459
+ */
460
+ export declare function normalizeRunState(state: unknown): RunState;
461
+ /**
462
+ * Reads an activity, or null for none or anything unknown.
463
+ * @param {unknown} activity
464
+ * @returns {AgentActivity|null}
465
+ */
466
+ export declare function normalizeActivity(activity: unknown): AgentActivity | null;
467
+ export type InlineSegment = {
468
+ kind: 'text' | 'strong' | 'code';
469
+ text: string;
470
+ } | {
471
+ kind: 'cite';
472
+ text: string;
473
+ n: number;
474
+ };
475
+ /**
476
+ * Splits a run of model text into plain text, `**bold**`, `` `code` ``, and `[n]` citation
477
+ * segments. That is the whole grammar: there are no links, no HTML, and no nesting. A backslash
478
+ * makes the next `*`, `` ` ``, `[`, or backslash literal; a marker that is never closed stays
479
+ * literal text, which is also what a half-streamed marker looks like until its close arrives.
480
+ * Code spans are verbatim: escapes inside them are not processed.
481
+ * @param {unknown} text
482
+ * @returns {InlineSegment[]}
483
+ */
484
+ export declare function parseInline(text: unknown): InlineSegment[];
485
+ /**
486
+ * The visible text of a run of model text: markers dropped, citations kept as `[n]`.
487
+ * @param {unknown} text
488
+ * @returns {string}
489
+ */
490
+ export declare function inlineText(text: unknown): string;
491
+ /**
492
+ * Reads a figures row in either form.
493
+ * @param {FigureRow} row
494
+ * @returns {{label: string, detail: string, value: string, call: string|null}}
495
+ */
496
+ export declare function figureRow(row: FigureRow): {
497
+ label: string;
498
+ detail: string;
499
+ value: string;
500
+ call: string | null;
501
+ };
502
+ /**
503
+ * An answer as plain text, for search and screen-reader summaries: markers dropped, one blank line
504
+ * between blocks.
505
+ * @param {Block[]} blocks
506
+ * @returns {string}
507
+ */
508
+ export declare function blocksToText(blocks: Block[]): string;
509
+ /**
510
+ * An answer as Markdown, for copying and export. Inline markers are already Markdown and pass
511
+ * through as written.
512
+ * @param {Block[]} blocks
513
+ * @returns {string}
514
+ */
515
+ export declare function blocksToMarkdown(blocks: Block[]): string;
516
+ export type TraceSummary = {
517
+ /**
518
+ * Steps that are not retries.
519
+ */
520
+ steps: number;
521
+ /**
522
+ * Tool calls made, retries included.
523
+ */
524
+ calls: number;
525
+ /**
526
+ * Steps that repeat another.
527
+ */
528
+ retries: number;
529
+ /**
530
+ * Steps that failed and were not retried successfully.
531
+ */
532
+ failed: number;
533
+ /**
534
+ * Sources looked at, across all searches.
535
+ */
536
+ sources: number;
537
+ /**
538
+ * Time spent on finished steps.
539
+ */
540
+ ms: number;
541
+ /**
542
+ * The step running now, if any.
543
+ */
544
+ running: TraceStep | null;
545
+ /**
546
+ * The step the run was stopped at, if any.
547
+ */
548
+ stopped: TraceStep | null;
549
+ };
550
+ /**
551
+ * What a run's steps add up to, for the one-line summary its trace folds into.
552
+ * @param {TraceStep[]} steps
553
+ * @returns {TraceSummary}
554
+ */
555
+ export declare function traceSummary(steps: TraceStep[]): TraceSummary;
556
+ /**
557
+ * How long something took, the way a person says it: "0.8 s" below ten seconds, then "12 s",
558
+ * "1 min 42 s", "1 h 5 min".
559
+ * @param {number} ms
560
+ * @param {{locale?: string}} [options]
561
+ * @returns {string}
562
+ */
563
+ export declare function formatDuration(ms: number, options?: {
564
+ locale?: string;
565
+ }): string;
566
+ /**
567
+ * A running clock in whole units: "2 s", "41 s", "1 min 42 s", "1 h 5 min".
568
+ * @param {number} ms
569
+ * @returns {string}
570
+ */
571
+ export declare function formatElapsed(ms: number): string;
572
+ /**
573
+ * What a run cost, from its token counts and per-token prices.
574
+ * @param {[number, number]|null|undefined} tokens Input and output tokens.
575
+ * @param {{in: number, out: number}} price Price per input and per output token.
576
+ * @returns {number}
577
+ */
578
+ export declare function runCost(tokens: [number, number] | null | undefined, price: {
579
+ in: number;
580
+ out: number;
581
+ }): number;
582
+ /**
583
+ * Initials for an avatar from a name: "Finance agent" → "FA".
584
+ * @param {string} name
585
+ * @returns {string}
586
+ */
587
+ export declare function initialsOf(name: string): string;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * The locale `Intl` writes a date in: a supported component option, then the active language,
3
+ * including regional English, then English when neither can be used.
4
+ * @param {string|string[]|null} [option] The component's `locale` option.
5
+ * @returns {string|string[]}
6
+ */
7
+ export declare function dateLocale(option?: string | string[] | null): string | string[];
@@ -0,0 +1,24 @@
1
+ /**
2
+ * A small syntax tokenizer for code an agent writes into an answer. It recognises comments,
3
+ * strings, numbers, and keywords — enough to make code readable, never enough to be an editor —
4
+ * and returns segments, never markup, so the caller builds text nodes and spans from them.
5
+ */
6
+ export type TokenKind = 'comment' | 'string' | 'number' | 'keyword';
7
+ export type CodeSegment = {
8
+ text: string;
9
+ token: TokenKind | null;
10
+ };
11
+ /**
12
+ * Whether code in this language is coloured.
13
+ * @param {unknown} language
14
+ * @returns {boolean}
15
+ */
16
+ export declare function isHighlighted(language: unknown): boolean;
17
+ /**
18
+ * Splits code into plain and coloured segments. An unknown language is one plain segment.
19
+ * Python's `True`/`None` and SQL's upper-case keywords are matched without regard to case.
20
+ * @param {unknown} language
21
+ * @param {unknown} source
22
+ * @returns {CodeSegment[]}
23
+ */
24
+ export declare function highlight(language: unknown, source: unknown): CodeSegment[];