@kitn.ai/ui 0.28.0 → 0.29.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 (376) hide show
  1. package/README.md +1 -1
  2. package/dist/agent-tooling/construct/public.d.ts +15 -0
  3. package/dist/agent-tooling/construct/schema.d.ts +111 -0
  4. package/dist/construct-cli.es.js +3 -3
  5. package/dist/construct.d.ts +5 -0
  6. package/dist/construct.js +327 -0
  7. package/dist/core-C8fzo39E.js +1 -12
  8. package/dist/engine-javascript-C1x7zo1_.js +1 -141
  9. package/dist/mcp.es.js +1 -1
  10. package/package.json +16 -16
  11. package/bin/route.test.js +0 -58
  12. package/src/agent-tooling/README.md +0 -192
  13. package/src/agent-tooling/archetypes.ts +0 -205
  14. package/src/agent-tooling/catalog/README.md +0 -676
  15. package/src/agent-tooling/catalog/catalog-types.ts +0 -231
  16. package/src/agent-tooling/catalog/fabrications.ts +0 -96
  17. package/src/agent-tooling/catalog/invariants.ts +0 -284
  18. package/src/agent-tooling/catalog/labs-titles.ts +0 -114
  19. package/src/agent-tooling/catalog/scenarios.ts +0 -87
  20. package/src/agent-tooling/catalog/surfaces.ts +0 -347
  21. package/src/agent-tooling/construct/cli-entry.ts +0 -8
  22. package/src/agent-tooling/construct/cli.ts +0 -147
  23. package/src/agent-tooling/construct/codegen.ts +0 -1635
  24. package/src/agent-tooling/construct/construct.v1.schema.json +0 -319
  25. package/src/agent-tooling/construct/dev.ts +0 -148
  26. package/src/agent-tooling/construct/fixtures/demo-widget.construct.json +0 -7
  27. package/src/agent-tooling/construct/fixtures/ops-console.construct.json +0 -44
  28. package/src/agent-tooling/construct/fixtures/owner-widget.construct.json +0 -32
  29. package/src/agent-tooling/construct/schema.ts +0 -452
  30. package/src/agent-tooling/integrations/anthropic.ts +0 -442
  31. package/src/agent-tooling/integrations/cloudflare.ts +0 -218
  32. package/src/agent-tooling/integrations/langgraph.ts +0 -133
  33. package/src/agent-tooling/integrations/mastra.ts +0 -182
  34. package/src/agent-tooling/integrations/mock.ts +0 -148
  35. package/src/agent-tooling/integrations/ollama.ts +0 -97
  36. package/src/agent-tooling/integrations/openai.ts +0 -95
  37. package/src/agent-tooling/integrations/openrouter.ts +0 -82
  38. package/src/agent-tooling/integrations/pi.ts +0 -176
  39. package/src/agent-tooling/integrations/pydantic-ai.ts +0 -108
  40. package/src/agent-tooling/integrations/vercel-ai-sdk.ts +0 -398
  41. package/src/agent-tooling/mcp/css-raw.d.ts +0 -12
  42. package/src/agent-tooling/mcp/manifest.ts +0 -422
  43. package/src/agent-tooling/mcp/server.ts +0 -116
  44. package/src/agent-tooling/mcp/stdio.ts +0 -18
  45. package/src/agent-tooling/mcp/tools/construct.ts +0 -130
  46. package/src/agent-tooling/mcp/tools/debug.ts +0 -621
  47. package/src/agent-tooling/mcp/tools/reference.ts +0 -980
  48. package/src/agent-tooling/mcp/tools/scaffold.ts +0 -6708
  49. package/src/agent-tooling/mcp/tools/theme.ts +0 -456
  50. package/src/agent-tooling/mcp/tools/types.ts +0 -14
  51. package/src/agent-tooling/mcp/validate-args.ts +0 -141
  52. package/src/agent-tooling/recipes/composed-thread.ts +0 -714
  53. package/src/agent-tooling/recipes/index.ts +0 -22
  54. package/src/agent-tooling/recipes/types.ts +0 -32
  55. package/src/agent-tooling/registry.ts +0 -132
  56. package/src/agent-tooling/route-emit.ts +0 -305
  57. package/src/agent-tooling/types.ts +0 -390
  58. package/src/components/artifact-card.tsx +0 -120
  59. package/src/components/artifact.tsx +0 -914
  60. package/src/components/attachment-types.ts +0 -66
  61. package/src/components/attachments.tsx +0 -536
  62. package/src/components/audio-visualizer/audio-visualizer.voice-fixture.ts +0 -257
  63. package/src/components/audio-visualizer/aurora.glsl.ts +0 -330
  64. package/src/components/audio-visualizer/fit-scale.ts +0 -112
  65. package/src/components/audio-visualizer/index.tsx +0 -528
  66. package/src/components/audio-visualizer/labs/lab-choreography.ts +0 -187
  67. package/src/components/audio-visualizer/labs/lab-shaders.ts +0 -363
  68. package/src/components/audio-visualizer/labs/lab-visualizer.tsx +0 -102
  69. package/src/components/audio-visualizer/shader-canvas.tsx +0 -876
  70. package/src/components/audio-visualizer/sizes.ts +0 -54
  71. package/src/components/audio-visualizer/variant-aurora.tsx +0 -305
  72. package/src/components/audio-visualizer/variant-bar.tsx +0 -175
  73. package/src/components/audio-visualizer/variant-custom.tsx +0 -344
  74. package/src/components/audio-visualizer/variant-grid.tsx +0 -175
  75. package/src/components/audio-visualizer/variant-radial.tsx +0 -163
  76. package/src/components/audio-visualizer/variant-wave.tsx +0 -130
  77. package/src/components/audio-visualizer/wave.glsl.ts +0 -130
  78. package/src/components/card-fallback.tsx +0 -60
  79. package/src/components/card-renderer.tsx +0 -220
  80. package/src/components/card.tsx +0 -212
  81. package/src/components/chain-of-thought.tsx +0 -348
  82. package/src/components/chat-container.tsx +0 -89
  83. package/src/components/chat-scope-picker.tsx +0 -57
  84. package/src/components/chat-thread.tsx +0 -1014
  85. package/src/components/checkpoint.tsx +0 -88
  86. package/src/components/choice-card.tsx +0 -743
  87. package/src/components/coachmark.tsx +0 -249
  88. package/src/components/code-block.tsx +0 -181
  89. package/src/components/composer-dom.ts +0 -159
  90. package/src/components/composer-highlight.ts +0 -242
  91. package/src/components/composer-history.ts +0 -82
  92. package/src/components/composer.tsx +0 -1075
  93. package/src/components/confirm-card.tsx +0 -402
  94. package/src/components/context.tsx +0 -377
  95. package/src/components/conversation-item.tsx +0 -241
  96. package/src/components/conversation-list.tsx +0 -429
  97. package/src/components/conversation-panel.tsx +0 -118
  98. package/src/components/dismissed-stub.tsx +0 -80
  99. package/src/components/embed.tsx +0 -200
  100. package/src/components/empty.tsx +0 -177
  101. package/src/components/feedback-bar.tsx +0 -166
  102. package/src/components/file-tree.tsx +0 -530
  103. package/src/components/file-upload.tsx +0 -167
  104. package/src/components/form-widgets.tsx +0 -525
  105. package/src/components/form.tsx +0 -1296
  106. package/src/components/home-panel.tsx +0 -159
  107. package/src/components/image.tsx +0 -65
  108. package/src/components/link-preview.tsx +0 -195
  109. package/src/components/loader.tsx +0 -367
  110. package/src/components/markdown.tsx +0 -162
  111. package/src/components/message-skills.tsx +0 -40
  112. package/src/components/message.tsx +0 -765
  113. package/src/components/model-switcher.tsx +0 -132
  114. package/src/components/prompt-input.tsx +0 -188
  115. package/src/components/prompt-suggestion.tsx +0 -150
  116. package/src/components/reasoning.tsx +0 -293
  117. package/src/components/response-compare-types.ts +0 -152
  118. package/src/components/response-compare.tsx +0 -455
  119. package/src/components/response-stream.tsx +0 -109
  120. package/src/components/screen.tsx +0 -181
  121. package/src/components/scroll-button.tsx +0 -93
  122. package/src/components/source.tsx +0 -192
  123. package/src/components/tasks-card.tsx +0 -801
  124. package/src/components/text-shimmer.tsx +0 -37
  125. package/src/components/thinking-bar.tsx +0 -50
  126. package/src/components/thread.tsx +0 -228
  127. package/src/components/toast.tsx +0 -503
  128. package/src/components/tool-classify.ts +0 -26
  129. package/src/components/tool-types.ts +0 -49
  130. package/src/components/tool.tsx +0 -190
  131. package/src/components/use-card-resolution.ts +0 -44
  132. package/src/components/voice-input.tsx +0 -222
  133. package/src/components/voice-output.tsx +0 -242
  134. package/src/components/widget-tab-bar.tsx +0 -73
  135. package/src/components/workspace-shell.tsx +0 -285
  136. package/src/diagnostics/hook.ts +0 -352
  137. package/src/diagnostics/index.ts +0 -82
  138. package/src/diagnostics/report-request.ts +0 -296
  139. package/src/elements/agent-card.tsx +0 -67
  140. package/src/elements/artifact.tsx +0 -194
  141. package/src/elements/attachments.tsx +0 -140
  142. package/src/elements/audio-visualizer.tsx +0 -227
  143. package/src/elements/autoloader.ts +0 -89
  144. package/src/elements/avatar.tsx +0 -33
  145. package/src/elements/badge.tsx +0 -32
  146. package/src/elements/button.tsx +0 -149
  147. package/src/elements/card.tsx +0 -133
  148. package/src/elements/cards.tsx +0 -266
  149. package/src/elements/chain-of-thought.tsx +0 -141
  150. package/src/elements/chat-scope-picker.tsx +0 -65
  151. package/src/elements/chat-types.ts +0 -102
  152. package/src/elements/chat-workspace.tsx +0 -188
  153. package/src/elements/chat.tsx +0 -304
  154. package/src/elements/checkbox-group.tsx +0 -164
  155. package/src/elements/checkbox.tsx +0 -134
  156. package/src/elements/checkpoint.tsx +0 -47
  157. package/src/elements/choice.tsx +0 -100
  158. package/src/elements/coachmark.tsx +0 -90
  159. package/src/elements/code-block.tsx +0 -60
  160. package/src/elements/command.tsx +0 -197
  161. package/src/elements/compare.tsx +0 -111
  162. package/src/elements/compiled.css +0 -2
  163. package/src/elements/composer.tsx +0 -162
  164. package/src/elements/confirm-card.tsx +0 -76
  165. package/src/elements/context-meter.tsx +0 -107
  166. package/src/elements/conversation-item.tsx +0 -120
  167. package/src/elements/conversation-list.tsx +0 -203
  168. package/src/elements/css.ts +0 -5
  169. package/src/elements/default-input.tsx +0 -392
  170. package/src/elements/define-entry.ts +0 -12
  171. package/src/elements/define.tsx +0 -563
  172. package/src/elements/diagnostic-events.ts +0 -114
  173. package/src/elements/dialog.tsx +0 -145
  174. package/src/elements/disclosure.ts +0 -95
  175. package/src/elements/dock.tsx +0 -215
  176. package/src/elements/dropdown.tsx +0 -123
  177. package/src/elements/editable-label.tsx +0 -140
  178. package/src/elements/element-data-types.ts +0 -152
  179. package/src/elements/element-diagnostics.ts +0 -392
  180. package/src/elements/element-manifest.json +0 -354
  181. package/src/elements/element-nonscalar.json +0 -187
  182. package/src/elements/element-types.d.ts +0 -4353
  183. package/src/elements/embed.tsx +0 -35
  184. package/src/elements/empty.tsx +0 -29
  185. package/src/elements/feedback-bar.tsx +0 -66
  186. package/src/elements/file-tree.tsx +0 -62
  187. package/src/elements/file-upload.tsx +0 -44
  188. package/src/elements/form.tsx +0 -94
  189. package/src/elements/hover-card.tsx +0 -80
  190. package/src/elements/icon.tsx +0 -41
  191. package/src/elements/image.tsx +0 -32
  192. package/src/elements/input.tsx +0 -492
  193. package/src/elements/kbd.tsx +0 -45
  194. package/src/elements/link-preview.tsx +0 -34
  195. package/src/elements/loader.tsx +0 -25
  196. package/src/elements/markdown.tsx +0 -38
  197. package/src/elements/menu.tsx +0 -241
  198. package/src/elements/message-skills.tsx +0 -83
  199. package/src/elements/message.tsx +0 -361
  200. package/src/elements/model-switcher.tsx +0 -121
  201. package/src/elements/nav.tsx +0 -87
  202. package/src/elements/notice.tsx +0 -53
  203. package/src/elements/pane-grid.tsx +0 -111
  204. package/src/elements/pane-group.tsx +0 -119
  205. package/src/elements/pane.tsx +0 -129
  206. package/src/elements/popover.tsx +0 -81
  207. package/src/elements/progress-bar.tsx +0 -39
  208. package/src/elements/prompt-dock.tsx +0 -82
  209. package/src/elements/prompt-input.tsx +0 -240
  210. package/src/elements/prompt-suggestions.tsx +0 -113
  211. package/src/elements/radio-group.tsx +0 -129
  212. package/src/elements/reasoning.tsx +0 -71
  213. package/src/elements/register-impl.ts +0 -148
  214. package/src/elements/register.ts +0 -76
  215. package/src/elements/remote.tsx +0 -225
  216. package/src/elements/resizable.globals.d.ts +0 -36
  217. package/src/elements/resizable.tsx +0 -704
  218. package/src/elements/response-stream.tsx +0 -40
  219. package/src/elements/screen.tsx +0 -90
  220. package/src/elements/scroll-area.tsx +0 -33
  221. package/src/elements/scroll-button.tsx +0 -179
  222. package/src/elements/search.tsx +0 -185
  223. package/src/elements/segmented.tsx +0 -129
  224. package/src/elements/select.tsx +0 -165
  225. package/src/elements/separator.tsx +0 -36
  226. package/src/elements/setting-item.tsx +0 -50
  227. package/src/elements/settings-group.tsx +0 -37
  228. package/src/elements/skeleton.tsx +0 -45
  229. package/src/elements/slider.tsx +0 -171
  230. package/src/elements/slot-text.ts +0 -73
  231. package/src/elements/slots.ts +0 -787
  232. package/src/elements/source.tsx +0 -126
  233. package/src/elements/status.tsx +0 -42
  234. package/src/elements/styles.css +0 -328
  235. package/src/elements/switch.tsx +0 -118
  236. package/src/elements/tabs.tsx +0 -95
  237. package/src/elements/tasks.tsx +0 -103
  238. package/src/elements/text-shimmer.tsx +0 -28
  239. package/src/elements/thinking-bar.tsx +0 -43
  240. package/src/elements/thread.tsx +0 -139
  241. package/src/elements/toast.tsx +0 -106
  242. package/src/elements/tool.tsx +0 -78
  243. package/src/elements/tooltip.tsx +0 -85
  244. package/src/elements/validate-messages.ts +0 -76
  245. package/src/elements/voice-input.tsx +0 -100
  246. package/src/elements/voice-output.tsx +0 -82
  247. package/src/index.ts +0 -430
  248. package/src/primitives/audio-bands.ts +0 -174
  249. package/src/primitives/card-component-types.ts +0 -63
  250. package/src/primitives/card-contract.ts +0 -80
  251. package/src/primitives/card-data-types.ts +0 -361
  252. package/src/primitives/card-host.tsx +0 -37
  253. package/src/primitives/card-recovery.ts +0 -160
  254. package/src/primitives/card-registry.tsx +0 -78
  255. package/src/primitives/card-resolution.ts +0 -36
  256. package/src/primitives/card-routing.ts +0 -85
  257. package/src/primitives/card-schemas/artifact.schema.json +0 -92
  258. package/src/primitives/card-schemas/card-envelope.schema.json +0 -14
  259. package/src/primitives/card-schemas/card-event.schema.json +0 -12
  260. package/src/primitives/card-schemas/choice.schema.json +0 -75
  261. package/src/primitives/card-schemas/confirm.schema.json +0 -65
  262. package/src/primitives/card-schemas/embed.schema.json +0 -63
  263. package/src/primitives/card-schemas/form.result.schema.json +0 -7
  264. package/src/primitives/card-schemas/form.schema.json +0 -53
  265. package/src/primitives/card-schemas/link.schema.json +0 -54
  266. package/src/primitives/card-schemas/tasks.result.schema.json +0 -16
  267. package/src/primitives/card-schemas/tasks.schema.json +0 -83
  268. package/src/primitives/card-tags.ts +0 -61
  269. package/src/primitives/card-validate-cards.ts +0 -255
  270. package/src/primitives/card-validate-schemas.ts +0 -58
  271. package/src/primitives/card-validate.ts +0 -131
  272. package/src/primitives/chat-config.tsx +0 -103
  273. package/src/primitives/composer-model.ts +0 -49
  274. package/src/primitives/composer-triggers.ts +0 -35
  275. package/src/primitives/controllable.ts +0 -21
  276. package/src/primitives/conversation-store.ts +0 -248
  277. package/src/primitives/create-kai-chat.ts +0 -66
  278. package/src/primitives/create-tween.ts +0 -266
  279. package/src/primitives/embed-providers.ts +0 -254
  280. package/src/primitives/field-mask.ts +0 -256
  281. package/src/primitives/field-semantics.ts +0 -115
  282. package/src/primitives/highlighter.ts +0 -157
  283. package/src/primitives/input-mask.ts +0 -853
  284. package/src/primitives/link-preview.ts +0 -87
  285. package/src/primitives/message-feedback.ts +0 -124
  286. package/src/primitives/pdf-preview.ts +0 -121
  287. package/src/primitives/toast-store.ts +0 -338
  288. package/src/primitives/url-scheme-policy.ts +0 -70
  289. package/src/primitives/use-audio-analysis.ts +0 -340
  290. package/src/primitives/use-auto-resize.ts +0 -31
  291. package/src/primitives/use-resize-observer.ts +0 -45
  292. package/src/primitives/use-sequencer.ts +0 -72
  293. package/src/primitives/use-speech-recognition.ts +0 -146
  294. package/src/primitives/use-stick-to-bottom.ts +0 -75
  295. package/src/primitives/use-text-stream.ts +0 -143
  296. package/src/primitives/use-voice-recorder.ts +0 -62
  297. package/src/primitives/visualizer-sequences.ts +0 -350
  298. package/src/remote/host-embed.ts +0 -345
  299. package/src/remote/index.ts +0 -2
  300. package/src/remote/origin.ts +0 -30
  301. package/src/remote/provider-runtime.ts +0 -262
  302. package/src/remote/provider.ts +0 -2
  303. package/src/remote/validate.ts +0 -22
  304. package/src/remote/version.ts +0 -12
  305. package/src/remote/wire.ts +0 -48
  306. package/src/schemas/from-tool-call.ts +0 -151
  307. package/src/schemas/index.ts +0 -341
  308. package/src/schemas/provider-subsets.ts +0 -538
  309. package/src/schemas/registry.ts +0 -355
  310. package/src/schemas/tool-defs.ts +0 -793
  311. package/src/solid.ts +0 -173
  312. package/src/state/index.ts +0 -44
  313. package/src/state/messages.ts +0 -53
  314. package/src/state/mock.ts +0 -297
  315. package/src/state/parts.ts +0 -295
  316. package/src/state/persistence.ts +0 -180
  317. package/src/state/stream.ts +0 -246
  318. package/src/state/suggestions.ts +0 -9
  319. package/src/state/threads.ts +0 -142
  320. package/src/test-utils/fake-clock.ts +0 -88
  321. package/src/types.ts +0 -95
  322. package/src/ui/action-icons.ts +0 -53
  323. package/src/ui/agent-card.tsx +0 -218
  324. package/src/ui/avatar.tsx +0 -23
  325. package/src/ui/badge.tsx +0 -21
  326. package/src/ui/button.tsx +0 -49
  327. package/src/ui/card.tsx +0 -245
  328. package/src/ui/checkbox-group.tsx +0 -153
  329. package/src/ui/checkbox.tsx +0 -63
  330. package/src/ui/collapsible.tsx +0 -163
  331. package/src/ui/command.tsx +0 -103
  332. package/src/ui/dialog.tsx +0 -223
  333. package/src/ui/dock.tsx +0 -630
  334. package/src/ui/dropdown.tsx +0 -636
  335. package/src/ui/editable-label.tsx +0 -112
  336. package/src/ui/hover-card.tsx +0 -345
  337. package/src/ui/icon.tsx +0 -167
  338. package/src/ui/input.tsx +0 -391
  339. package/src/ui/kbd.tsx +0 -118
  340. package/src/ui/nav.tsx +0 -282
  341. package/src/ui/notice.tsx +0 -84
  342. package/src/ui/overlay.tsx +0 -277
  343. package/src/ui/pane-grid.tsx +0 -117
  344. package/src/ui/pane-group.tsx +0 -291
  345. package/src/ui/pane.tsx +0 -193
  346. package/src/ui/popover.tsx +0 -106
  347. package/src/ui/progress-bar.tsx +0 -83
  348. package/src/ui/prompt-dock.tsx +0 -145
  349. package/src/ui/radio.tsx +0 -150
  350. package/src/ui/resizable.tsx +0 -693
  351. package/src/ui/scroll-area.tsx +0 -26
  352. package/src/ui/segmented.tsx +0 -109
  353. package/src/ui/select.tsx +0 -168
  354. package/src/ui/separator.tsx +0 -10
  355. package/src/ui/settings-group.tsx +0 -67
  356. package/src/ui/skeleton.tsx +0 -73
  357. package/src/ui/slider.tsx +0 -178
  358. package/src/ui/status.tsx +0 -48
  359. package/src/ui/switch.tsx +0 -119
  360. package/src/ui/tabs.tsx +0 -168
  361. package/src/ui/textarea.tsx +0 -21
  362. package/src/ui/tooltip.tsx +0 -118
  363. package/src/utils/cn.ts +0 -30
  364. package/src/wire/chunk.ts +0 -248
  365. package/src/wire/consume.ts +0 -599
  366. package/src/wire/diagnostics.ts +0 -727
  367. package/src/wire/encode-probe.ts +0 -214
  368. package/src/wire/encode.ts +0 -947
  369. package/src/wire/files.ts +0 -342
  370. package/src/wire/formats/anthropic.ts +0 -274
  371. package/src/wire/formats/openai.ts +0 -228
  372. package/src/wire/index.ts +0 -95
  373. package/src/wire/media-types.ts +0 -344
  374. package/src/wire/read.ts +0 -396
  375. package/src/wire/sink-helpers.ts +0 -50
  376. package/src/wire/sse.ts +0 -153
@@ -1,503 +0,0 @@
1
- import {
2
- createSignal, createEffect, onCleanup, on, For, Show, createMemo,
3
- } from 'solid-js';
4
- import { X, Check, AlertTriangle, XCircle, Info } from 'lucide-solid';
5
- import { cn } from '../utils/cn';
6
- import { createPresence } from '../ui/overlay';
7
- import {
8
- type ToastItem, type ToastVariant, type ToastAppearance, resolveDuration,
9
- } from '../primitives/toast-store';
10
-
11
- export type { ToastItem, ToastVariant, ToastAppearance };
12
-
13
- /** Why a toast went away — surfaced to `onDismiss` (and the facade event). */
14
- export type ToastDismissReason = 'timeout' | 'close' | 'action';
15
-
16
- export type ToastPosition = 'top-center' | 'top-right' | 'top-left' | 'bottom-center' | 'bottom-right' | 'bottom-left';
17
-
18
- export interface ToastRegionProps {
19
- /** The toasts to render. Newest is shown on top. Set as a JS property on the
20
- * element; mutate by passing a new array reference. */
21
- toasts: ToastItem[];
22
- /** Where the stack anchors. Defaults to `'top-center'`. */
23
- position?: ToastPosition;
24
- /** Max simultaneously-visible toasts; the rest queue and promote as slots
25
- * free up. Defaults to `3`. */
26
- max?: number;
27
- /** Stacking: 'expanded' (default, full column) | 'collapsed' (Sonner-style
28
- * pile that expands on hover/focus). Attribute: stack. */
29
- stack?: 'expanded' | 'collapsed';
30
- /** Region-level default appearance for toasts that don't set their own. A
31
- * per-toast `appearance` always wins. Defaults to `'pill'`. */
32
- appearance?: ToastAppearance;
33
- /** Region-level default inverse treatment for toasts that don't set their own.
34
- * A per-toast `inverse` always wins. Defaults to `false`. */
35
- inverse?: boolean;
36
- /** When set, this region renders only the toasts scoped to that element and
37
- * anchors over its bounds (top-center), following it on scroll/resize. Unset =
38
- * the global, viewport-anchored region. */
39
- target?: HTMLElement;
40
- /** Fired when a toast leaves, with the reason. */
41
- onDismiss?: (id: string, reason: ToastDismissReason) => void;
42
- /** Fired when a toast's action button is pressed. */
43
- onAction?: (id: string, label: string) => void;
44
- }
45
-
46
- /** Reactive `prefers-reduced-motion`. SSR-safe (returns false when no window). */
47
- function usePrefersReducedMotion() {
48
- const [reduced, setReduced] = createSignal(
49
- typeof window !== 'undefined' && window.matchMedia?.('(prefers-reduced-motion: reduce)').matches === true,
50
- );
51
- if (typeof window !== 'undefined' && window.matchMedia) {
52
- const mq = window.matchMedia('(prefers-reduced-motion: reduce)');
53
- const on = () => setReduced(mq.matches);
54
- mq.addEventListener?.('change', on);
55
- onCleanup(() => mq.removeEventListener?.('change', on));
56
- }
57
- return reduced;
58
- }
59
-
60
- // ── Single toast pill ────────────────────────────────────────────────────────
61
-
62
- export interface ToastProps {
63
- item: ToastItem;
64
- onDismiss: (reason: ToastDismissReason) => void;
65
- onAction?: (label: string) => void;
66
- /** Hold the auto-dismiss timer (the region sets this true while the whole stack
67
- * is hovered/expanded, so peers don't dismiss out from under the cursor). */
68
- paused?: boolean;
69
- /** Region-level default appearance, used when the item doesn't set its own. */
70
- appearance?: ToastAppearance;
71
- /** Region-level default inverse, used when the item doesn't set its own. */
72
- inverse?: boolean;
73
- }
74
-
75
- /**
76
- * A single toast pill. Auto-dismisses after its (action-floored) duration, holds
77
- * the timer while hovered (this pill) OR while `paused` (the whole stack is
78
- * hovered), and animates in/out via `createPresence`. Pure + prop-driven — the
79
- * parent `ToastRegion` owns the list + queue.
80
- */
81
- export function Toast(props: ToastProps) {
82
- const [open, setOpen] = createSignal(true);
83
- const presence = createPresence(open);
84
- const variant = () => props.item.variant ?? 'neutral';
85
- const dismissible = () => props.item.dismissible !== false;
86
- // Item-level value wins, then the region-level default, then the built-in default.
87
- const appearance = (): ToastAppearance => props.item.appearance ?? props.appearance ?? 'pill';
88
- const inverse = (): boolean => props.item.inverse ?? props.inverse ?? false;
89
-
90
- // Surface + accent colors, swapped for the high-contrast inverse treatment so the
91
- // toast pops on EITHER appearance, in light AND dark. The inverse surface is the
92
- // foreground color, so action/close/muted text switch to the background color.
93
- const surfaceClass = () =>
94
- inverse() ? 'bg-foreground text-background border-transparent' : 'bg-popover text-popover-foreground border-border';
95
- const mutedClass = () => (inverse() ? 'text-background/70' : 'text-muted-foreground');
96
- const actionClass = () => (inverse() ? 'text-background hover:text-background/80' : 'text-primary hover:text-primary/80');
97
- const closeClass = () => (inverse() ? 'text-background/70 hover:text-background' : 'text-muted-foreground hover:text-foreground');
98
-
99
- let remaining = resolveDuration(props.item);
100
- let startedAt = 0;
101
- let timer: ReturnType<typeof setTimeout> | undefined;
102
- let reason: ToastDismissReason = 'timeout';
103
-
104
- const clear = () => { if (timer !== undefined) { clearTimeout(timer); timer = undefined; } };
105
-
106
- const begin = () => {
107
- clear();
108
- if (remaining <= 0) return; // sticky (duration 0)
109
- startedAt = Date.now();
110
- timer = setTimeout(() => { reason = 'timeout'; setOpen(false); }, remaining);
111
- };
112
- const pause = () => {
113
- if (timer === undefined) return;
114
- clear();
115
- remaining -= Date.now() - startedAt;
116
- };
117
-
118
- const [hovered, setHovered] = createSignal(false);
119
- // Held = this pill is hovered, OR the region says the whole stack is hovered.
120
- const held = (): boolean => props.paused === true || hovered();
121
-
122
- // (Re)start the timer whenever the resolved duration changes (mount + update());
123
- // resets the remaining time to full. Holds instead of running if currently held.
124
- createEffect(on(() => resolveDuration(props.item), (d) => {
125
- remaining = d;
126
- if (held()) clear();
127
- else begin();
128
- }));
129
- // Pause/resume on hover (this pill or the whole stack) WITHOUT resetting remaining,
130
- // so the countdown continues from where it left off. Deferred — the duration
131
- // effect already armed it on mount.
132
- createEffect(on(held, (isHeld) => {
133
- if (isHeld) pause();
134
- else begin();
135
- }, { defer: true }));
136
- onCleanup(clear);
137
-
138
- // When presence has fully exited, notify the parent so it drops the item.
139
- createEffect(() => {
140
- if (!presence.present() && !open()) props.onDismiss(reason);
141
- });
142
-
143
- const close = () => { clear(); reason = 'close'; setOpen(false); };
144
-
145
- const act = () => {
146
- const action = props.item.action;
147
- if (!action) return;
148
- props.onAction?.(action.label);
149
- const keepOpen = action.onAction() === false;
150
- if (!keepOpen) { clear(); reason = 'action'; setOpen(false); }
151
- };
152
-
153
- // Leading variant icon — shared by both appearances. In the card it sits at the
154
- // top, so nudge it down to align with the title's cap height.
155
- const iconAlign = () => (appearance() === 'card' ? 'mt-0.5' : undefined);
156
- const VariantIcon = () => (
157
- <>
158
- <Show when={variant() === 'success'}>
159
- <Check class={cn('size-4 shrink-0 text-emerald-500', iconAlign())} />
160
- </Show>
161
- <Show when={variant() === 'warning'}>
162
- <AlertTriangle class={cn('size-4 shrink-0 text-warning', iconAlign())} />
163
- </Show>
164
- <Show when={variant() === 'error'}>
165
- <XCircle class={cn('size-4 shrink-0 text-destructive', iconAlign())} />
166
- </Show>
167
- <Show when={variant() === 'info'}>
168
- <Info class={cn('size-4 shrink-0 text-info', iconAlign())} />
169
- </Show>
170
- </>
171
- );
172
-
173
- const ActionButton = (p: { class?: string }) => (
174
- <Show when={props.item.action}>
175
- {(action) => (
176
- <button
177
- type="button"
178
- onClick={act}
179
- class={cn(
180
- appearance() === 'card'
181
- ? cn(
182
- 'inline-flex shrink-0 items-center rounded-md border px-2.5 py-1 text-xs font-medium transition-colors',
183
- inverse()
184
- ? 'border-background/30 text-background hover:bg-background/10'
185
- : 'border-border text-foreground hover:bg-accent',
186
- )
187
- : cn('shrink-0 rounded-md text-sm font-medium underline-offset-2 hover:underline', actionClass()),
188
- p.class,
189
- )}
190
- >
191
- {action().label}
192
- </button>
193
- )}
194
- </Show>
195
- );
196
-
197
- const CloseButton = () => (
198
- <Show when={dismissible()}>
199
- <button
200
- type="button"
201
- onClick={close}
202
- aria-label="Dismiss"
203
- class={cn(
204
- '-mr-1 flex size-5 shrink-0 items-center justify-center rounded-md transition-colors',
205
- closeClass(),
206
- )}
207
- >
208
- <X class="size-3.5" />
209
- </button>
210
- </Show>
211
- );
212
-
213
- return (
214
- <Show when={presence.present()}>
215
- <div
216
- ref={presence.setRef}
217
- // `variant` already picks the error ICON; it has to pick the ROLE too, or
218
- // a failure is announced with the same (polite, easily missed) urgency as
219
- // a success. `alert` is implicitly assertive and interrupts, which is what
220
- // the region's `aria-live="polite"` alone will not do for the toast that
221
- // actually matters. Same expression as ui/notice.tsx.
222
- role={variant() === 'error' ? 'alert' : 'status'}
223
- data-appearance={appearance()}
224
- data-inverse={inverse() ? '' : undefined}
225
- data-closed={presence.state() === 'closed' ? '' : undefined}
226
- onPointerEnter={() => setHovered(true)}
227
- onPointerLeave={() => setHovered(false)}
228
- class={cn(
229
- 'pointer-events-auto border text-sm shadow-lg',
230
- surfaceClass(),
231
- 'animate-in fade-in-0 slide-in-from-top-4',
232
- 'data-[closed]:animate-out data-[closed]:fade-out-0 data-[closed]:slide-out-to-top-2',
233
- appearance() === 'card'
234
- ? 'flex min-w-[24rem] items-start gap-3 rounded-xl p-4 shadow-xl'
235
- : 'flex items-center gap-3 rounded-full px-4 py-2.5',
236
- )}
237
- >
238
- <VariantIcon />
239
- <Show
240
- when={appearance() === 'card'}
241
- fallback={
242
- <>
243
- <span class="min-w-0 flex-1 truncate">{props.item.message}</span>
244
- <ActionButton />
245
- <CloseButton />
246
- </>
247
- }
248
- >
249
- <div class="min-w-0 flex-1">
250
- <div class="font-medium leading-snug">{props.item.message}</div>
251
- <Show when={props.item.description}>
252
- <div class={cn('mt-1 line-clamp-2 text-xs leading-snug', mutedClass())}>
253
- {props.item.description}
254
- </div>
255
- </Show>
256
- <ActionButton class="mt-2" />
257
- </div>
258
- <CloseButton />
259
- </Show>
260
- </div>
261
- </Show>
262
- );
263
- }
264
-
265
- // ── Region (stack + queue) ───────────────────────────────────────────────────
266
-
267
- const POSITION_CLASSES: Record<ToastPosition, string> = {
268
- 'top-center': 'top-4 left-1/2 -translate-x-1/2 items-center',
269
- 'top-right': 'top-4 right-4 items-end',
270
- 'top-left': 'top-4 left-4 items-start',
271
- 'bottom-center': 'bottom-4 left-1/2 -translate-x-1/2 items-center flex-col-reverse',
272
- 'bottom-right': 'bottom-4 right-4 items-end flex-col-reverse',
273
- 'bottom-left': 'bottom-4 left-4 items-start flex-col-reverse',
274
- };
275
-
276
- // Flex alignment + stack direction per position, for a TARGET-anchored region (the
277
- // stack hugs the chosen corner; bottom rows grow upward so the newest sits at the
278
- // anchored edge). Mirrors POSITION_CLASSES minus the viewport-edge offsets.
279
- const ANCHOR_FLEX: Record<ToastPosition, string> = {
280
- 'top-center': 'items-center',
281
- 'top-left': 'items-start',
282
- 'top-right': 'items-end',
283
- 'bottom-center': 'items-center flex-col-reverse',
284
- 'bottom-left': 'items-start flex-col-reverse',
285
- 'bottom-right': 'items-end flex-col-reverse',
286
- };
287
-
288
- /** Inset from the target's edges, in px. */
289
- const ANCHOR_PAD = 12;
290
-
291
- interface TargetRect { top: number; left: number; right: number; bottom: number; width: number }
292
-
293
- /**
294
- * The fixed-position style pinning a target-anchored stack to the corner named by
295
- * `position`, computed from the target's rect. The region is `position: fixed`, so
296
- * we resolve absolute top/left + a transform that grows the stack inward from that
297
- * edge. (Rect-based, like the popover's anchor math — no collision flipping needed.)
298
- */
299
- function anchorStyle(position: ToastPosition, r: TargetRect): Record<string, string> {
300
- const cx = r.left + r.width / 2;
301
- const top = r.top + ANCHOR_PAD;
302
- const bottom = r.bottom - ANCHOR_PAD;
303
- const left = r.left + ANCHOR_PAD;
304
- const right = r.right - ANCHOR_PAD;
305
- const maxWidth = `${Math.max(0, r.width - ANCHOR_PAD * 2)}px`;
306
- switch (position) {
307
- case 'top-left':
308
- return { top: `${top}px`, left: `${left}px`, transform: 'none', 'max-width': maxWidth };
309
- case 'top-right':
310
- return { top: `${top}px`, left: `${right}px`, transform: 'translateX(-100%)', 'max-width': maxWidth };
311
- case 'bottom-center':
312
- return { top: `${bottom}px`, left: `${cx}px`, transform: 'translate(-50%, -100%)', 'max-width': maxWidth };
313
- case 'bottom-left':
314
- return { top: `${bottom}px`, left: `${left}px`, transform: 'translateY(-100%)', 'max-width': maxWidth };
315
- case 'bottom-right':
316
- return { top: `${bottom}px`, left: `${right}px`, transform: 'translate(-100%, -100%)', 'max-width': maxWidth };
317
- case 'top-center':
318
- default:
319
- return { top: `${top}px`, left: `${cx}px`, transform: 'translateX(-50%)', 'max-width': maxWidth };
320
- }
321
- }
322
-
323
- /** The overlay layer both region roots sit on. One token, one default:
324
- * your app chrome must stay below the toast layer; set `--kai-toast-z`
325
- * (default 100) on the host to move the layer. */
326
- const TOAST_Z = 'var(--kai-toast-z, 100)';
327
-
328
- /**
329
- * Renders a stack of toasts at a viewport edge. Caps the visible count at `max`
330
- * (newest on top); overflow waits in a queue and is promoted as visible toasts
331
- * leave. `aria-live=polite` / `role=region` so screen readers announce new
332
- * toasts without stealing focus. Your app chrome must stay below the toast
333
- * layer; set `--kai-toast-z` (default 100) on the host to move the layer.
334
- */
335
- export function ToastRegion(props: ToastRegionProps) {
336
- const max = () => props.max ?? 3;
337
- const position = () => props.position ?? 'top-center';
338
-
339
- const stack = () => props.stack ?? 'expanded';
340
- const reduced = usePrefersReducedMotion();
341
- const collapsed = () => stack() === 'collapsed' && !reduced();
342
- // Expanded while the stack is hovered OR holds focus (collapsed mode). These are
343
- // tracked SEPARATELY and OR'd: dismissing a toast (clicking its ×) removes the
344
- // focused button → a focusout — but if the pointer is still over the stack we must
345
- // stay expanded (and paused), so focusout alone must not collapse it.
346
- const [hovered, setHovered] = createSignal(false);
347
- const [focused, setFocused] = createSignal(false);
348
- const open = () => hovered() || focused();
349
-
350
- // Tunable look (IVP). Resting peek + per-depth shrink; uniform expanded row height.
351
- const OFFSET = 20; // px each deeper toast peeks past the one in front
352
- const SCALE_STEP = 0.05; // each deeper toast is 5% smaller
353
- const ROW_FALLBACK = 48; // px; used until the front pill is measured
354
- const GAP = 8; // matches gap-2 in the expanded column
355
-
356
- const isBottom = () => position().startsWith('bottom');
357
- const dir = () => (isBottom() ? -1 : 1);
358
-
359
- // Measure ONE pill (all are single-line/uniform) to size the expanded spacing.
360
- const [rowH, setRowH] = createSignal(ROW_FALLBACK);
361
- const measure = (el: HTMLElement | undefined) => {
362
- if (!el || typeof window === 'undefined') return;
363
- const set = () => { const h = el.offsetHeight; if (h) setRowH(h); };
364
- set();
365
- // jsdom (and SSR) lack ResizeObserver; the fallback height is fine there.
366
- if (typeof ResizeObserver === 'undefined') return;
367
- const ro = new ResizeObserver(set);
368
- ro.observe(el);
369
- onCleanup(() => ro.disconnect());
370
- };
371
-
372
- // The transform for the wrapper at depth i, given the current open/resting state.
373
- const depthTransform = (i: number): string => {
374
- if (open()) return `translateY(${dir() * (rowH() + GAP) * i}px) scale(1)`;
375
- return `translateY(${dir() * OFFSET * i}px) scale(${1 - SCALE_STEP * i})`;
376
- };
377
- // The collapsed stage gets an explicit height covering the whole stack extent —
378
- // resting (the pile) vs expanded (the full column) — so the region is ONE
379
- // continuous hover surface. Without it the cursor falls into the gaps between
380
- // expanded pills (or the spot a just-dismissed pill vacated) and the region
381
- // flickers collapsed→expanded. Grows away from the anchored edge in both modes.
382
- const stageHeight = (): number => {
383
- const n = visible().length;
384
- if (!n) return 0;
385
- return open() ? n * rowH() + (n - 1) * GAP : rowH() + (n - 1) * OFFSET;
386
- };
387
-
388
- // Only the toasts for THIS region's target (undefined target = the global one).
389
- // Newest-first so the freshest toast sits at the top; the queue (past `max`)
390
- // stays mounted-but-hidden until a slot frees up.
391
- const ordered = createMemo(() =>
392
- [...(props.toasts ?? []).filter((t) => (t.target ?? undefined) === props.target)].reverse(),
393
- );
394
- const visible = createMemo(() => ordered().slice(0, max()));
395
-
396
- // Scoped to a target → anchor the stack to the `position` corner of the target,
397
- // following it on scroll/resize. Otherwise it's a viewport-fixed corner/center.
398
- const [anchor, setAnchor] = createSignal<TargetRect | null>(null);
399
- createEffect(() => {
400
- const t = props.target;
401
- if (!t || typeof window === 'undefined') { setAnchor(null); return; }
402
- // Captured at SETUP and closed over, never re-resolved as a global inside
403
- // `onCleanup`: cleanup can run after the host removed the DOM globals (a
404
- // `kai-*` release is deferred one microtask past detachment, so an
405
- // environment teardown gets in between), and a bare `window` there throws.
406
- // See tests/components/teardown-without-dom-globals.test.tsx.
407
- const win = window;
408
- const update = () => {
409
- const r = t.getBoundingClientRect();
410
- setAnchor({ top: r.top, left: r.left, right: r.right, bottom: r.bottom, width: r.width });
411
- };
412
- update();
413
- const ro = new ResizeObserver(update);
414
- ro.observe(t);
415
- win.addEventListener('scroll', update, true);
416
- win.addEventListener('resize', update);
417
- onCleanup(() => {
418
- ro.disconnect();
419
- win.removeEventListener('scroll', update, true);
420
- win.removeEventListener('resize', update);
421
- });
422
- });
423
-
424
- return (
425
- <Show
426
- when={collapsed()}
427
- fallback={
428
- <div
429
- role="region"
430
- aria-label="Notifications"
431
- aria-live="polite"
432
- data-stack="expanded"
433
- class={cn(
434
- 'pointer-events-none fixed flex flex-col gap-2',
435
- anchor()
436
- ? ANCHOR_FLEX[position()]
437
- : cn('max-w-[min(30rem,calc(100vw-2rem))]', POSITION_CLASSES[position()]),
438
- )}
439
- style={{ 'z-index': TOAST_Z, ...(anchor() ? anchorStyle(position(), anchor()!) : undefined) }}
440
- >
441
- <For each={visible()}>
442
- {(item) => (
443
- <Toast
444
- item={item}
445
- appearance={props.appearance}
446
- inverse={props.inverse}
447
- onDismiss={(reason) => props.onDismiss?.(item.id, reason)}
448
- onAction={(label) => props.onAction?.(item.id, label)}
449
- />
450
- )}
451
- </For>
452
- </div>
453
- }
454
- >
455
- <div
456
- role="region"
457
- aria-label="Notifications"
458
- aria-live="polite"
459
- data-stack="collapsed"
460
- data-expanded={open() ? '' : undefined}
461
- onPointerEnter={() => setHovered(true)}
462
- onPointerLeave={() => setHovered(false)}
463
- onFocusIn={() => setFocused(true)}
464
- onFocusOut={() => setFocused(false)}
465
- class={cn('pointer-events-none fixed', !anchor() && POSITION_CLASSES[position()])}
466
- style={{ 'z-index': TOAST_Z, ...(anchor() ? anchorStyle(position(), anchor()!) : undefined) }}
467
- >
468
- {/* Relative stage with an explicit height so it's ONE continuous hover
469
- surface (pointer-events-auto) — no flicker when the cursor crosses gaps
470
- or a dismissed pill's vacated spot. Pills are absolutely stacked from the
471
- anchored edge. */}
472
- <div
473
- class="pointer-events-auto relative transition-[height] duration-200 ease-out"
474
- style={{ 'min-width': '16rem', 'max-width': 'min(30rem, calc(100vw - 2rem))', height: `${stageHeight()}px` }}
475
- >
476
- <For each={visible()}>
477
- {(item, i) => (
478
- <div
479
- data-depth={i()}
480
- ref={(el) => { if (i() === 0) measure(el); }}
481
- class={cn(
482
- 'absolute inset-x-0 flex transition-[transform,opacity] duration-200 ease-out',
483
- isBottom() ? 'bottom-0 origin-bottom' : 'top-0 origin-top',
484
- position().endsWith('right') ? 'justify-end' : position().endsWith('left') ? 'justify-start' : 'justify-center',
485
- )}
486
- style={{ 'z-index': String(max() - i()), transform: depthTransform(i()) }}
487
- >
488
- <Toast
489
- item={item}
490
- paused={open()}
491
- appearance={props.appearance}
492
- inverse={props.inverse}
493
- onDismiss={(reason) => props.onDismiss?.(item.id, reason)}
494
- onAction={(label) => props.onAction?.(item.id, label)}
495
- />
496
- </div>
497
- )}
498
- </For>
499
- </div>
500
- </div>
501
- </Show>
502
- );
503
- }
@@ -1,26 +0,0 @@
1
- /** Semantic classification of a tool call, used to pick a rendering. Derived from
2
- * the provider-chosen tool NAME, which is arbitrary, so this stays conservative and
3
- * prefers 'generic' over a confident wrong answer. */
4
- export type ToolKind =
5
- | 'command'
6
- | 'file-change'
7
- | 'search'
8
- | 'fetch'
9
- | 'mcp'
10
- | 'image'
11
- | 'generic';
12
-
13
- /** Total, deterministic, side-effect free. ALWAYS terminates in 'generic' so an
14
- * unrecognized tool still renders a panel instead of a blank. Order matters:
15
- * 'search' is tested before 'fetch' so `web_search` classifies as a search. */
16
- export function classifyTool(name: string): ToolKind {
17
- const n = name.toLowerCase();
18
- if (!n) return 'generic';
19
- if (n.includes('bash') || n.includes('command') || n.includes('shell') || n.includes('terminal') || n.includes('exec')) return 'command';
20
- if (n.includes('edit') || n.includes('write') || n.includes('patch') || n.includes('replace') || n.includes('delete')) return 'file-change';
21
- if (n.includes('search') || n.includes('grep') || n.includes('glob') || n.includes('find')) return 'search';
22
- if (n.includes('fetch') || n.includes('http') || n.includes('browse') || n.includes('crawl')) return 'fetch';
23
- if (n.includes('mcp')) return 'mcp';
24
- if (n.includes('image') || n.includes('screenshot') || n.includes('vision')) return 'image';
25
- return 'generic';
26
- }
@@ -1,49 +0,0 @@
1
- import type { ToolKind } from './tool-classify';
2
-
3
- /** The untranslated provider payload a part was normalized from.
4
- *
5
- * Optional in the type but REQUIRED in practice for round-trip fidelity. Anthropic
6
- * returns a 400 invalid_request_error if `thinking` blocks are modified, reordered,
7
- * filtered or RECONSTRUCTED, so an encoder must send `raw.payload` back verbatim
8
- * rather than rebuilding a block from `text` + `signature`. */
9
- export interface RawOrigin {
10
- /** Tagged origin, e.g. 'anthropic.content_block', 'openai.delta', `custom.${string}`. */
11
- source: string;
12
- payload: unknown;
13
- }
14
-
15
- /** A tool-call part rendered by <Tool>. Pure type — kept JSX-free so it can be
16
- * imported by the framework-neutral state core and the React typecheck pass.
17
- *
18
- * Adding a field here also requires adding it to `TOOL_KEYS` (and a comparator
19
- * in `TOOL_COMPARATORS`) in `state/parts.ts`, or `tsc` fails to compile: those
20
- * drive `upsertToolPart`'s dedupe check, and a field missing from them would
21
- * silently make that check ignore the new field, keeping a stale array
22
- * reference alive when only that field changed. */
23
- export interface ToolPart {
24
- /** The tool name exactly as the provider reported it. */
25
- type: string;
26
- /** Semantic classification for rendering. Derive with classifyTool(type). */
27
- kind?: ToolKind;
28
- /** The call's lifecycle. A provider stream (real or `createMockResponder`)
29
- * only ever ANNOUNCES a call: arguments stream in (`input-streaming`), then
30
- * the part parks at `input-available` — and stays there. The kit parses and
31
- * renders the call; EXECUTING it and answering is the host's side of the
32
- * seam: after the read settles, run the tool and patch the part forward with
33
- * `stream.upsertTool(id, { state: 'output-available', output })` (or
34
- * `upsertToolPart`), or `output-error` + `errorText` on failure. The one
35
- * exception is a call the provider ran itself (`raw` carries the result and
36
- * the wire sets `output` directly) — never re-execute those. */
37
- state: 'input-streaming' | 'input-available' | 'output-available' | 'output-error';
38
- /** Last VALID parsed snapshot, fingerprint-deduped. The primary channel: this is
39
- * what the kit renders. */
40
- input?: Record<string, unknown>;
41
- /** Raw accumulated argument fragments, for consumers wanting character-level
42
- * streaming. Most consumers should read `input` instead. */
43
- rawInput?: string;
44
- output?: Record<string, unknown>;
45
- toolCallId?: string;
46
- errorText?: string;
47
- /** The untranslated provider payload this was normalized from. */
48
- raw?: RawOrigin;
49
- }