@adea-ai/ui 0.140.0 → 0.142.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.
- package/dist/components/composites/appearance-editor/appearance-editor.js +2 -2
- package/dist/components/composites/appearance-editor/appearance-editor.js.map +1 -1
- package/dist/components/composites/catalog-browser/catalog-browser-group.js +1 -1
- package/dist/components/composites/chain-of-thought/chain-of-thought.d.ts +56 -0
- package/dist/components/composites/chain-of-thought/chain-of-thought.d.ts.map +1 -0
- package/dist/components/composites/chain-of-thought/chain-of-thought.js +117 -0
- package/dist/components/composites/chain-of-thought/chain-of-thought.js.map +1 -0
- package/dist/components/composites/chain-of-thought/index.d.ts +2 -0
- package/dist/components/composites/chain-of-thought/index.d.ts.map +1 -0
- package/dist/components/composites/chain-of-thought/index.js +2 -0
- package/dist/components/composites/chat/chat.d.ts +67 -0
- package/dist/components/composites/chat/chat.d.ts.map +1 -0
- package/dist/components/composites/chat/chat.js +179 -0
- package/dist/components/composites/chat/chat.js.map +1 -0
- package/dist/components/composites/chat/index.d.ts +2 -0
- package/dist/components/composites/chat/index.d.ts.map +1 -0
- package/dist/components/composites/chat/index.js +2 -0
- package/dist/components/composites/checkpoint/checkpoint-model.d.ts +34 -0
- package/dist/components/composites/checkpoint/checkpoint-model.d.ts.map +1 -0
- package/dist/components/composites/checkpoint/checkpoint-model.js +48 -0
- package/dist/components/composites/checkpoint/checkpoint-model.js.map +1 -0
- package/dist/components/composites/checkpoint/checkpoint.d.ts +48 -0
- package/dist/components/composites/checkpoint/checkpoint.d.ts.map +1 -0
- package/dist/components/composites/checkpoint/checkpoint.js +160 -0
- package/dist/components/composites/checkpoint/checkpoint.js.map +1 -0
- package/dist/components/composites/checkpoint/index.d.ts +3 -0
- package/dist/components/composites/checkpoint/index.d.ts.map +1 -0
- package/dist/components/composites/checkpoint/index.js +3 -0
- package/dist/components/composites/confirmation/confirmation-model.d.ts +45 -0
- package/dist/components/composites/confirmation/confirmation-model.d.ts.map +1 -0
- package/dist/components/composites/confirmation/confirmation-model.js +51 -0
- package/dist/components/composites/confirmation/confirmation-model.js.map +1 -0
- package/dist/components/composites/confirmation/confirmation.d.ts +72 -0
- package/dist/components/composites/confirmation/confirmation.d.ts.map +1 -0
- package/dist/components/composites/confirmation/confirmation.js +300 -0
- package/dist/components/composites/confirmation/confirmation.js.map +1 -0
- package/dist/components/composites/confirmation/index.d.ts +3 -0
- package/dist/components/composites/confirmation/index.d.ts.map +1 -0
- package/dist/components/composites/confirmation/index.js +3 -0
- package/dist/components/composites/context/context-model.d.ts +69 -0
- package/dist/components/composites/context/context-model.d.ts.map +1 -0
- package/dist/components/composites/context/context-model.js +122 -0
- package/dist/components/composites/context/context-model.js.map +1 -0
- package/dist/components/composites/context/context.d.ts +38 -0
- package/dist/components/composites/context/context.d.ts.map +1 -0
- package/dist/components/composites/context/context.js +234 -0
- package/dist/components/composites/context/context.js.map +1 -0
- package/dist/components/composites/context/index.d.ts +3 -0
- package/dist/components/composites/context/index.d.ts.map +1 -0
- package/dist/components/composites/context/index.js +3 -0
- package/dist/components/composites/file-tree/build-file-tree.d.ts +138 -0
- package/dist/components/composites/file-tree/build-file-tree.d.ts.map +1 -0
- package/dist/components/composites/file-tree/build-file-tree.js +325 -0
- package/dist/components/composites/file-tree/build-file-tree.js.map +1 -0
- package/dist/components/composites/file-tree/file-tree.d.ts +74 -0
- package/dist/components/composites/file-tree/file-tree.d.ts.map +1 -0
- package/dist/components/composites/file-tree/file-tree.js +389 -0
- package/dist/components/composites/file-tree/file-tree.js.map +1 -0
- package/dist/components/composites/file-tree/index.d.ts +3 -0
- package/dist/components/composites/file-tree/index.d.ts.map +1 -0
- package/dist/components/composites/file-tree/index.js +3 -0
- package/dist/components/composites/inline-citation/citation.d.ts +37 -0
- package/dist/components/composites/inline-citation/citation.d.ts.map +1 -0
- package/dist/components/composites/inline-citation/citation.js +52 -0
- package/dist/components/composites/inline-citation/citation.js.map +1 -0
- package/dist/components/composites/inline-citation/index.d.ts +3 -0
- package/dist/components/composites/inline-citation/index.d.ts.map +1 -0
- package/dist/components/composites/inline-citation/index.js +3 -0
- package/dist/components/composites/inline-citation/inline-citation.d.ts +64 -0
- package/dist/components/composites/inline-citation/inline-citation.d.ts.map +1 -0
- package/dist/components/composites/inline-citation/inline-citation.js +272 -0
- package/dist/components/composites/inline-citation/inline-citation.js.map +1 -0
- package/dist/components/composites/message-scroller/index.d.ts +3 -0
- package/dist/components/composites/message-scroller/index.d.ts.map +1 -0
- package/dist/components/composites/message-scroller/index.js +3 -0
- package/dist/components/composites/message-scroller/message-scroller.d.ts +55 -0
- package/dist/components/composites/message-scroller/message-scroller.d.ts.map +1 -0
- package/dist/components/composites/message-scroller/message-scroller.js +201 -0
- package/dist/components/composites/message-scroller/message-scroller.js.map +1 -0
- package/dist/components/composites/message-scroller/scroll-anchor.d.ts +66 -0
- package/dist/components/composites/message-scroller/scroll-anchor.d.ts.map +1 -0
- package/dist/components/composites/message-scroller/scroll-anchor.js +122 -0
- package/dist/components/composites/message-scroller/scroll-anchor.js.map +1 -0
- package/dist/components/composites/model-selector/index.d.ts +3 -0
- package/dist/components/composites/model-selector/index.d.ts.map +1 -0
- package/dist/components/composites/model-selector/index.js +3 -0
- package/dist/components/composites/model-selector/model-selector.d.ts +55 -0
- package/dist/components/composites/model-selector/model-selector.d.ts.map +1 -0
- package/dist/components/composites/model-selector/model-selector.js +490 -0
- package/dist/components/composites/model-selector/model-selector.js.map +1 -0
- package/dist/components/composites/model-selector/models.d.ts +51 -0
- package/dist/components/composites/model-selector/models.d.ts.map +1 -0
- package/dist/components/composites/model-selector/models.js +71 -0
- package/dist/components/composites/model-selector/models.js.map +1 -0
- package/dist/components/composites/plan/index.d.ts +2 -0
- package/dist/components/composites/plan/index.d.ts.map +1 -0
- package/dist/components/composites/plan/index.js +2 -0
- package/dist/components/composites/plan/plan.d.ts +61 -0
- package/dist/components/composites/plan/plan.d.ts.map +1 -0
- package/dist/components/composites/plan/plan.js +130 -0
- package/dist/components/composites/plan/plan.js.map +1 -0
- package/dist/components/composites/queue/index.d.ts +2 -0
- package/dist/components/composites/queue/index.d.ts.map +1 -0
- package/dist/components/composites/queue/index.js +2 -0
- package/dist/components/composites/queue/queue.d.ts +77 -0
- package/dist/components/composites/queue/queue.d.ts.map +1 -0
- package/dist/components/composites/queue/queue.js +271 -0
- package/dist/components/composites/queue/queue.js.map +1 -0
- package/dist/components/composites/reasoning/index.d.ts +2 -0
- package/dist/components/composites/reasoning/index.d.ts.map +1 -0
- package/dist/components/composites/reasoning/index.js +2 -0
- package/dist/components/composites/reasoning/reasoning.d.ts +62 -0
- package/dist/components/composites/reasoning/reasoning.d.ts.map +1 -0
- package/dist/components/composites/reasoning/reasoning.js +156 -0
- package/dist/components/composites/reasoning/reasoning.js.map +1 -0
- package/dist/components/composites/sources/index.d.ts +3 -0
- package/dist/components/composites/sources/index.d.ts.map +1 -0
- package/dist/components/composites/sources/index.js +3 -0
- package/dist/components/composites/sources/source.d.ts +46 -0
- package/dist/components/composites/sources/source.d.ts.map +1 -0
- package/dist/components/composites/sources/source.js +74 -0
- package/dist/components/composites/sources/source.js.map +1 -0
- package/dist/components/composites/sources/sources.d.ts +45 -0
- package/dist/components/composites/sources/sources.d.ts.map +1 -0
- package/dist/components/composites/sources/sources.js +175 -0
- package/dist/components/composites/sources/sources.js.map +1 -0
- package/dist/components/composites/stack-trace/index.d.ts +3 -0
- package/dist/components/composites/stack-trace/index.d.ts.map +1 -0
- package/dist/components/composites/stack-trace/index.js +3 -0
- package/dist/components/composites/stack-trace/parse-stack-trace.d.ts +118 -0
- package/dist/components/composites/stack-trace/parse-stack-trace.d.ts.map +1 -0
- package/dist/components/composites/stack-trace/parse-stack-trace.js +376 -0
- package/dist/components/composites/stack-trace/parse-stack-trace.js.map +1 -0
- package/dist/components/composites/stack-trace/stack-trace.d.ts +63 -0
- package/dist/components/composites/stack-trace/stack-trace.d.ts.map +1 -0
- package/dist/components/composites/stack-trace/stack-trace.js +491 -0
- package/dist/components/composites/stack-trace/stack-trace.js.map +1 -0
- package/dist/components/composites/subagent/index.d.ts +2 -0
- package/dist/components/composites/subagent/index.d.ts.map +1 -0
- package/dist/components/composites/subagent/index.js +2 -0
- package/dist/components/composites/subagent/subagent.d.ts +55 -0
- package/dist/components/composites/subagent/subagent.d.ts.map +1 -0
- package/dist/components/composites/subagent/subagent.js +138 -0
- package/dist/components/composites/subagent/subagent.js.map +1 -0
- package/dist/components/composites/suggestion/index.d.ts +2 -0
- package/dist/components/composites/suggestion/index.d.ts.map +1 -0
- package/dist/components/composites/suggestion/index.js +2 -0
- package/dist/components/composites/suggestion/suggestion.d.ts +37 -0
- package/dist/components/composites/suggestion/suggestion.d.ts.map +1 -0
- package/dist/components/composites/suggestion/suggestion.js +100 -0
- package/dist/components/composites/suggestion/suggestion.js.map +1 -0
- package/dist/components/composites/task/index.d.ts +2 -0
- package/dist/components/composites/task/index.d.ts.map +1 -0
- package/dist/components/composites/task/index.js +2 -0
- package/dist/components/composites/task/task.d.ts +96 -0
- package/dist/components/composites/task/task.d.ts.map +1 -0
- package/dist/components/composites/task/task.js +311 -0
- package/dist/components/composites/task/task.js.map +1 -0
- package/dist/components/composites/terminal/ansi.d.ts +101 -0
- package/dist/components/composites/terminal/ansi.d.ts.map +1 -0
- package/dist/components/composites/terminal/ansi.js +544 -0
- package/dist/components/composites/terminal/ansi.js.map +1 -0
- package/dist/components/composites/terminal/index.d.ts +4 -0
- package/dist/components/composites/terminal/index.d.ts.map +1 -0
- package/dist/components/composites/terminal/index.js +4 -0
- package/dist/components/composites/terminal/terminal-model.d.ts +63 -0
- package/dist/components/composites/terminal/terminal-model.d.ts.map +1 -0
- package/dist/components/composites/terminal/terminal-model.js +69 -0
- package/dist/components/composites/terminal/terminal-model.js.map +1 -0
- package/dist/components/composites/terminal/terminal.d.ts +88 -0
- package/dist/components/composites/terminal/terminal.d.ts.map +1 -0
- package/dist/components/composites/terminal/terminal.js +500 -0
- package/dist/components/composites/terminal/terminal.js.map +1 -0
- package/dist/components/composites/test-results/index.d.ts +3 -0
- package/dist/components/composites/test-results/index.d.ts.map +1 -0
- package/dist/components/composites/test-results/index.js +3 -0
- package/dist/components/composites/test-results/test-results-model.d.ts +154 -0
- package/dist/components/composites/test-results/test-results-model.d.ts.map +1 -0
- package/dist/components/composites/test-results/test-results-model.js +252 -0
- package/dist/components/composites/test-results/test-results-model.js.map +1 -0
- package/dist/components/composites/test-results/test-results.d.ts +60 -0
- package/dist/components/composites/test-results/test-results.d.ts.map +1 -0
- package/dist/components/composites/test-results/test-results.js +631 -0
- package/dist/components/composites/test-results/test-results.js.map +1 -0
- package/dist/components/composites/tool/format-tool-value.d.ts +37 -0
- package/dist/components/composites/tool/format-tool-value.d.ts.map +1 -0
- package/dist/components/composites/tool/format-tool-value.js +135 -0
- package/dist/components/composites/tool/format-tool-value.js.map +1 -0
- package/dist/components/composites/tool/index.d.ts +3 -0
- package/dist/components/composites/tool/index.d.ts.map +1 -0
- package/dist/components/composites/tool/index.js +3 -0
- package/dist/components/composites/tool/tool.d.ts +69 -0
- package/dist/components/composites/tool/tool.d.ts.map +1 -0
- package/dist/components/composites/tool/tool.js +214 -0
- package/dist/components/composites/tool/tool.js.map +1 -0
- package/dist/components/composites/update-dialog/update-dialog.js +1 -1
- package/dist/components/conversation/conversation-surface.d.ts +7 -0
- package/dist/components/conversation/conversation-surface.d.ts.map +1 -1
- package/dist/components/conversation/conversation-surface.js +2 -0
- package/dist/components/conversation/conversation-surface.js.map +1 -1
- package/dist/components/conversation/scroll-follow-core.d.ts +24 -0
- package/dist/components/conversation/scroll-follow-core.d.ts.map +1 -1
- package/dist/components/conversation/scroll-follow-core.js +23 -1
- package/dist/components/conversation/scroll-follow-core.js.map +1 -1
- package/dist/components/conversation/scroll-follow.d.ts +3 -0
- package/dist/components/conversation/scroll-follow.d.ts.map +1 -1
- package/dist/components/conversation/scroll-follow.js +80 -1
- package/dist/components/conversation/scroll-follow.js.map +1 -1
- package/dist/components/ui/attachment/attachment.d.ts +58 -0
- package/dist/components/ui/attachment/attachment.d.ts.map +1 -0
- package/dist/components/ui/attachment/attachment.js +279 -0
- package/dist/components/ui/attachment/attachment.js.map +1 -0
- package/dist/components/ui/attachment/index.d.ts +2 -0
- package/dist/components/ui/attachment/index.d.ts.map +1 -0
- package/dist/components/ui/attachment/index.js +2 -0
- package/dist/components/ui/badge/badge.d.ts +1 -1
- package/dist/components/ui/bubble/bubble.d.ts +33 -0
- package/dist/components/ui/bubble/bubble.d.ts.map +1 -0
- package/dist/components/ui/bubble/bubble.js +95 -0
- package/dist/components/ui/bubble/bubble.js.map +1 -0
- package/dist/components/ui/bubble/index.d.ts +2 -0
- package/dist/components/ui/bubble/index.d.ts.map +1 -0
- package/dist/components/ui/bubble/index.js +2 -0
- package/dist/components/ui/button/button.d.ts +1 -1
- package/dist/components/ui/code-block/code-block.d.ts +56 -3
- package/dist/components/ui/code-block/code-block.d.ts.map +1 -1
- package/dist/components/ui/code-block/code-block.js +231 -50
- package/dist/components/ui/code-block/code-block.js.map +1 -1
- package/dist/components/ui/code-block/index.d.ts +1 -1
- package/dist/components/ui/code-block/index.d.ts.map +1 -1
- package/dist/components/ui/code-block/index.js +2 -2
- package/dist/components/ui/field/number-field.d.ts +21 -4
- package/dist/components/ui/field/number-field.d.ts.map +1 -1
- package/dist/components/ui/field/number-field.js +22 -11
- package/dist/components/ui/field/number-field.js.map +1 -1
- package/dist/components/ui/marker/index.d.ts +2 -0
- package/dist/components/ui/marker/index.d.ts.map +1 -0
- package/dist/components/ui/marker/index.js +2 -0
- package/dist/components/ui/marker/marker.d.ts +35 -0
- package/dist/components/ui/marker/marker.d.ts.map +1 -0
- package/dist/components/ui/marker/marker.js +123 -0
- package/dist/components/ui/marker/marker.js.map +1 -0
- package/dist/components/ui/message/cite-ranges.d.ts +42 -0
- package/dist/components/ui/message/cite-ranges.d.ts.map +1 -0
- package/dist/components/ui/message/cite-ranges.js +105 -0
- package/dist/components/ui/message/cite-ranges.js.map +1 -0
- package/dist/components/ui/message/index.d.ts +4 -0
- package/dist/components/ui/message/index.d.ts.map +1 -0
- package/dist/components/ui/message/index.js +4 -0
- package/dist/components/ui/message/message.d.ts +95 -0
- package/dist/components/ui/message/message.d.ts.map +1 -0
- package/dist/components/ui/message/message.js +443 -0
- package/dist/components/ui/message/message.js.map +1 -0
- package/dist/components/ui/message/parse-message-text.d.ts +93 -0
- package/dist/components/ui/message/parse-message-text.d.ts.map +1 -0
- package/dist/components/ui/message/parse-message-text.js +365 -0
- package/dist/components/ui/message/parse-message-text.js.map +1 -0
- package/dist/components/ui/questionnaire/index.d.ts +2 -0
- package/dist/components/ui/questionnaire/index.d.ts.map +1 -0
- package/dist/components/ui/questionnaire/index.js +2 -0
- package/dist/components/ui/questionnaire/questionnaire.d.ts +83 -0
- package/dist/components/ui/questionnaire/questionnaire.d.ts.map +1 -0
- package/dist/components/ui/questionnaire/questionnaire.js +470 -0
- package/dist/components/ui/questionnaire/questionnaire.js.map +1 -0
- package/dist/components/ui/status-chip/status-chip.d.ts +1 -1
- package/dist/components/ui/switch/switch.js +11 -11
- package/dist/components/ui/switch/switch.js.map +1 -1
- package/dist/components/ui/trace/index.d.ts +2 -0
- package/dist/components/ui/trace/index.d.ts.map +1 -0
- package/dist/components/ui/trace/index.js +2 -0
- package/dist/components/ui/trace/trace.d.ts +72 -0
- package/dist/components/ui/trace/trace.d.ts.map +1 -0
- package/dist/components/ui/trace/trace.js +340 -0
- package/dist/components/ui/trace/trace.js.map +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +46 -5
- package/dist/r/attachment.json +25 -0
- package/dist/r/bubble.json +22 -0
- package/dist/r/chain-of-thought.json +26 -0
- package/dist/r/chat.json +24 -0
- package/dist/r/checkpoint.json +35 -0
- package/dist/r/confirmation.json +34 -0
- package/dist/r/context.json +33 -0
- package/dist/r/file-tree.json +32 -0
- package/dist/r/inline-citation.json +35 -0
- package/dist/r/marker.json +22 -0
- package/dist/r/message-scroller.json +31 -0
- package/dist/r/message.json +33 -0
- package/dist/r/model-selector.json +34 -0
- package/dist/r/plan.json +26 -0
- package/dist/r/questionnaire.json +28 -0
- package/dist/r/queue.json +26 -0
- package/dist/r/reasoning.json +26 -0
- package/dist/r/registry.json +811 -52
- package/dist/r/sources.json +32 -0
- package/dist/r/src/components/composites/chain-of-thought/chain-of-thought.tsx +141 -0
- package/dist/r/src/components/composites/chain-of-thought/index.ts +11 -0
- package/dist/r/src/components/composites/chat/chat.tsx +190 -0
- package/dist/r/src/components/composites/chat/index.ts +11 -0
- package/dist/r/src/components/composites/checkpoint/checkpoint-model.ts +71 -0
- package/dist/r/src/components/composites/checkpoint/checkpoint.tsx +214 -0
- package/dist/r/src/components/composites/checkpoint/index.ts +8 -0
- package/dist/r/src/components/composites/confirmation/confirmation-model.ts +83 -0
- package/dist/r/src/components/composites/confirmation/confirmation.tsx +311 -0
- package/dist/r/src/components/composites/confirmation/index.ts +9 -0
- package/dist/r/src/components/composites/context/context-model.ts +168 -0
- package/dist/r/src/components/composites/context/context.tsx +187 -0
- package/dist/r/src/components/composites/context/index.ts +18 -0
- package/dist/r/src/components/composites/file-tree/build-file-tree.ts +456 -0
- package/dist/r/src/components/composites/file-tree/file-tree.tsx +405 -0
- package/dist/r/src/components/composites/file-tree/index.ts +25 -0
- package/dist/r/src/components/composites/inline-citation/citation.ts +78 -0
- package/dist/r/src/components/composites/inline-citation/index.ts +9 -0
- package/dist/r/src/components/composites/inline-citation/inline-citation.tsx +285 -0
- package/dist/r/src/components/composites/message-scroller/index.ts +2 -0
- package/dist/r/src/components/composites/message-scroller/message-scroller.tsx +301 -0
- package/dist/r/src/components/composites/message-scroller/scroll-anchor.ts +170 -0
- package/dist/r/src/components/composites/model-selector/index.ts +14 -0
- package/dist/r/src/components/composites/model-selector/model-selector.tsx +420 -0
- package/dist/r/src/components/composites/model-selector/models.ts +103 -0
- package/dist/r/src/components/composites/plan/index.ts +1 -0
- package/dist/r/src/components/composites/plan/plan.tsx +155 -0
- package/dist/r/src/components/composites/queue/index.ts +10 -0
- package/dist/r/src/components/composites/queue/queue.tsx +264 -0
- package/dist/r/src/components/composites/reasoning/index.ts +1 -0
- package/dist/r/src/components/composites/reasoning/reasoning.tsx +176 -0
- package/dist/r/src/components/composites/sources/index.ts +11 -0
- package/dist/r/src/components/composites/sources/source.ts +116 -0
- package/dist/r/src/components/composites/sources/sources.tsx +163 -0
- package/dist/r/src/components/composites/stack-trace/index.ts +19 -0
- package/dist/r/src/components/composites/stack-trace/parse-stack-trace.ts +507 -0
- package/dist/r/src/components/composites/stack-trace/stack-trace.tsx +395 -0
- package/dist/r/src/components/composites/subagent/index.ts +1 -0
- package/dist/r/src/components/composites/subagent/subagent.tsx +159 -0
- package/dist/r/src/components/composites/suggestion/index.ts +1 -0
- package/dist/r/src/components/composites/suggestion/suggestion.tsx +140 -0
- package/dist/r/src/components/composites/task/index.ts +14 -0
- package/dist/r/src/components/composites/task/task.tsx +317 -0
- package/dist/r/src/components/composites/terminal/ansi.ts +674 -0
- package/dist/r/src/components/composites/terminal/index.ts +20 -0
- package/dist/r/src/components/composites/terminal/terminal-model.ts +111 -0
- package/dist/r/src/components/composites/terminal/terminal.tsx +574 -0
- package/dist/r/src/components/composites/test-results/index.ts +20 -0
- package/dist/r/src/components/composites/test-results/test-results-model.ts +368 -0
- package/dist/r/src/components/composites/test-results/test-results.tsx +586 -0
- package/dist/r/src/components/composites/tool/format-tool-value.ts +221 -0
- package/dist/r/src/components/composites/tool/index.ts +2 -0
- package/dist/r/src/components/composites/tool/tool.tsx +228 -0
- package/dist/r/src/components/conversation/conversation-surface.tsx +9 -0
- package/dist/r/src/components/conversation/scroll-follow-core.ts +31 -0
- package/dist/r/src/components/conversation/scroll-follow.ts +92 -0
- package/dist/r/src/components/ui/attachment/attachment.tsx +282 -0
- package/dist/r/src/components/ui/attachment/index.ts +10 -0
- package/dist/r/src/components/ui/bubble/bubble.tsx +86 -0
- package/dist/r/src/components/ui/bubble/index.ts +1 -0
- package/dist/r/src/components/ui/code-block/code-block.tsx +256 -26
- package/dist/r/src/components/ui/code-block/index.ts +9 -1
- package/dist/r/src/components/ui/field/number-field.tsx +51 -14
- package/dist/r/src/components/ui/marker/index.ts +1 -0
- package/dist/r/src/components/ui/marker/marker.tsx +90 -0
- package/dist/r/src/components/ui/message/cite-ranges.ts +144 -0
- package/dist/r/src/components/ui/message/index.ts +23 -0
- package/dist/r/src/components/ui/message/message.tsx +434 -0
- package/dist/r/src/components/ui/message/parse-message-text.ts +450 -0
- package/dist/r/src/components/ui/questionnaire/index.ts +10 -0
- package/dist/r/src/components/ui/questionnaire/questionnaire.tsx +446 -0
- package/dist/r/src/components/ui/trace/index.ts +9 -0
- package/dist/r/src/components/ui/trace/trace.tsx +334 -0
- package/dist/r/src/styles/base.css +34 -0
- package/dist/r/stack-trace.json +32 -0
- package/dist/r/subagent.json +27 -0
- package/dist/r/suggestion.json +24 -0
- package/dist/r/task.json +28 -0
- package/dist/r/terminal.json +35 -0
- package/dist/r/test-results.json +33 -0
- package/dist/r/tool.json +31 -0
- package/dist/r/trace.json +25 -0
- package/package.json +6 -3
- package/registry.json +811 -52
- package/src/components/composites/chain-of-thought/chain-of-thought.tsx +141 -0
- package/src/components/composites/chain-of-thought/index.ts +11 -0
- package/src/components/composites/chat/chat.tsx +190 -0
- package/src/components/composites/chat/index.ts +11 -0
- package/src/components/composites/checkpoint/checkpoint-model.ts +71 -0
- package/src/components/composites/checkpoint/checkpoint.tsx +214 -0
- package/src/components/composites/checkpoint/index.ts +8 -0
- package/src/components/composites/confirmation/confirmation-model.ts +83 -0
- package/src/components/composites/confirmation/confirmation.tsx +311 -0
- package/src/components/composites/confirmation/index.ts +9 -0
- package/src/components/composites/context/context-model.ts +168 -0
- package/src/components/composites/context/context.tsx +187 -0
- package/src/components/composites/context/index.ts +18 -0
- package/src/components/composites/file-tree/build-file-tree.ts +456 -0
- package/src/components/composites/file-tree/file-tree.tsx +405 -0
- package/src/components/composites/file-tree/index.ts +25 -0
- package/src/components/composites/inline-citation/citation.ts +78 -0
- package/src/components/composites/inline-citation/index.ts +9 -0
- package/src/components/composites/inline-citation/inline-citation.tsx +285 -0
- package/src/components/composites/message-scroller/index.ts +2 -0
- package/src/components/composites/message-scroller/message-scroller.tsx +301 -0
- package/src/components/composites/message-scroller/scroll-anchor.ts +170 -0
- package/src/components/composites/model-selector/index.ts +14 -0
- package/src/components/composites/model-selector/model-selector.tsx +420 -0
- package/src/components/composites/model-selector/models.ts +103 -0
- package/src/components/composites/plan/index.ts +1 -0
- package/src/components/composites/plan/plan.tsx +155 -0
- package/src/components/composites/queue/index.ts +10 -0
- package/src/components/composites/queue/queue.tsx +264 -0
- package/src/components/composites/reasoning/index.ts +1 -0
- package/src/components/composites/reasoning/reasoning.tsx +176 -0
- package/src/components/composites/sources/index.ts +11 -0
- package/src/components/composites/sources/source.ts +116 -0
- package/src/components/composites/sources/sources.tsx +163 -0
- package/src/components/composites/stack-trace/index.ts +19 -0
- package/src/components/composites/stack-trace/parse-stack-trace.ts +507 -0
- package/src/components/composites/stack-trace/stack-trace.tsx +395 -0
- package/src/components/composites/subagent/index.ts +1 -0
- package/src/components/composites/subagent/subagent.tsx +159 -0
- package/src/components/composites/suggestion/index.ts +1 -0
- package/src/components/composites/suggestion/suggestion.tsx +140 -0
- package/src/components/composites/task/index.ts +14 -0
- package/src/components/composites/task/task.tsx +317 -0
- package/src/components/composites/terminal/ansi.ts +674 -0
- package/src/components/composites/terminal/index.ts +20 -0
- package/src/components/composites/terminal/terminal-model.ts +111 -0
- package/src/components/composites/terminal/terminal.tsx +574 -0
- package/src/components/composites/test-results/index.ts +20 -0
- package/src/components/composites/test-results/test-results-model.ts +368 -0
- package/src/components/composites/test-results/test-results.tsx +586 -0
- package/src/components/composites/tool/format-tool-value.ts +221 -0
- package/src/components/composites/tool/index.ts +2 -0
- package/src/components/composites/tool/tool.tsx +228 -0
- package/src/components/conversation/conversation-surface.tsx +9 -0
- package/src/components/conversation/scroll-follow-core.ts +31 -0
- package/src/components/conversation/scroll-follow.ts +92 -0
- package/src/components/ui/attachment/attachment.tsx +282 -0
- package/src/components/ui/attachment/index.ts +10 -0
- package/src/components/ui/bubble/bubble.tsx +86 -0
- package/src/components/ui/bubble/index.ts +1 -0
- package/src/components/ui/code-block/code-block.tsx +256 -26
- package/src/components/ui/code-block/index.ts +9 -1
- package/src/components/ui/field/number-field.tsx +51 -14
- package/src/components/ui/marker/index.ts +1 -0
- package/src/components/ui/marker/marker.tsx +90 -0
- package/src/components/ui/message/cite-ranges.ts +144 -0
- package/src/components/ui/message/index.ts +23 -0
- package/src/components/ui/message/message.tsx +434 -0
- package/src/components/ui/message/parse-message-text.ts +450 -0
- package/src/components/ui/questionnaire/index.ts +10 -0
- package/src/components/ui/questionnaire/questionnaire.tsx +446 -0
- package/src/components/ui/trace/index.ts +9 -0
- package/src/components/ui/trace/trace.tsx +334 -0
- package/src/index.ts +26 -0
- package/src/styles/base.css +34 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number-field.js","names":["createEffect","createSignal","JSX","FormField","Input","
|
|
1
|
+
{"version":3,"file":"number-field.js","names":["createEffect","createSignal","JSX","FormField","Input","NumberFieldBaseProps","label","hint","min","max","step","integer","disabled","class","onBlur","EventHandler","HTMLInputElement","FocusEvent","NumberFieldProps","optional","value","onChange","text","String","NumberField","props","draft","setDraft","error","setError","undefined","Number","isInteger","validate","raw","badInput","next","isFinite","steps","Math","abs","round","_$createComponent","children","type","required","onInput","event","currentTarget","validity","nextError","_$createComponent"],"sources":["../../../../src/components/ui/field/number-field.tsx"],"sourcesContent":["import { createEffect, createSignal, type JSX } from 'solid-js'\nimport { FormField } from './field'\nimport { Input } from '../input/input'\n\ntype NumberFieldBaseProps = {\n label: string\n hint?: string\n min: number\n max: number\n /**\n * The increment of the spinner and the arrow keys, and the grid a typed value\n * must sit on: `min` plus a whole number of steps. Use it for stepped or\n * fractional values (`0.05` for a 0-1 score, `5` for a percentage in fives).\n * Without it a field steps by 1, or by `any` when `integer` is `false`, which\n * accepts every decimal but leaves the spinner moving in whole numbers.\n */\n step?: number\n /**\n * Whether only whole numbers are valid. It defaults to `true`, or, when a\n * `step` is given, to whether both the step and its base `min` are whole\n * numbers, so `step={0.05}` accepts decimals without also saying\n * `integer={false}`, and `min={0.5} step={1}` accepts 0.5, 1.5, 2.5.\n */\n integer?: boolean\n /** Locks the input; a locked field keeps its value and reports nothing. */\n disabled?: boolean\n class?: string\n onBlur?: JSX.EventHandler<HTMLInputElement, FocusEvent>\n}\n\nexport type NumberFieldProps = NumberFieldBaseProps &\n (\n | {\n optional?: false\n value: number\n onChange: (value: number) => void\n }\n | {\n /**\n * Lets the field be left blank: a blank field is valid and reports `null`,\n * and a `null` value shows a blank field. Use it for a limit that falls\n * back to a default when unset, so a caller never maps `''` to\n * `undefined` of its own.\n */\n optional: true\n value: number | null\n onChange: (value: number | null) => void\n }\n )\n\nconst text = (value: number | null) => (value === null ? '' : String(value))\n\n/**\n * A controlled numeric field that keeps an editable draft while validating\n * range, integer and step constraints. Invalid drafts are announced and restored\n * to the latest controlled value when focus leaves the input, so `onChange`\n * only ever receives a value the field accepts — a caller never needs a\n * `Number(value) || fallback` of its own. With `optional`, blank is accepted and\n * reported as `null`.\n */\nexport function NumberField(props: NumberFieldProps) {\n const [draft, setDraft] = createSignal(text(props.value))\n const [error, setError] = createSignal('')\n // Whole numbers only when nothing on the grid is fractional: a whole step from\n // a fractional `min` (0.5, 1.5, 2.5) puts the spinner's own values off the\n // integers, so inference needs the step and its base to both be whole.\n const integer = () =>\n props.integer ??\n (props.step === undefined || (Number.isInteger(props.step) && Number.isInteger(props.min)))\n\n createEffect(() => {\n setDraft(text(props.value))\n })\n\n // A number input reports '' both when it is empty and when it holds text it cannot parse\n // (\"abc\", \"-\", \"1e\"); only `validity.badInput` tells them apart, and a bad draft must never\n // count as blank (it would report `null` and clear the limit).\n const validate = (raw: string, badInput: boolean) => {\n if (badInput) return `${props.label} must be a valid number.`\n if (!raw) return props.optional ? '' : `${props.label} is required.`\n const next = Number(raw)\n if (!Number.isFinite(next)) return `${props.label} must be a valid number.`\n if (integer() && !Number.isInteger(next)) {\n return `${props.label} must be a whole number.`\n }\n if (next < props.min || next > props.max) {\n return `${props.label} must be between ${props.min} and ${props.max}.`\n }\n if (props.step !== undefined && props.step > 0) {\n // Compare in whole steps with a tolerance: 0.15 / 0.05 is 3.0000000000000004,\n // and rejecting it would make the spinner's own values invalid.\n const steps = (next - props.min) / props.step\n if (Math.abs(steps - Math.round(steps)) > 1e-9) {\n return props.min === 0\n ? `${props.label} must be a multiple of ${props.step}.`\n : `${props.label} must be ${props.min} plus a multiple of ${props.step}.`\n }\n }\n return ''\n }\n\n return (\n <FormField label={props.label} hint={props.hint} error={error()} class={props.class}>\n <Input\n type=\"number\"\n value={draft()}\n min={props.min}\n max={props.max}\n step={props.step ?? (integer() ? 1 : 'any')}\n required={!props.optional}\n disabled={props.disabled}\n onInput={(event) => {\n const raw = event.currentTarget.value\n // Read before touching the draft: writing '' back to the input would clear the entry and\n // with it `badInput`. An unparsable entry keeps the last draft and the text on screen, so\n // the user can correct it; blur restores the last good value.\n const badInput = event.currentTarget.validity.badInput\n if (!badInput) setDraft(raw)\n const nextError = validate(raw, badInput)\n setError(nextError)\n if (nextError) return\n // `optional` narrows the callback to `number | null`; a required field never sees `''`.\n ;(props.onChange as (value: number | null) => void)(raw ? Number(raw) : null)\n }}\n onBlur={(event) => {\n const nextError = validate(draft(), event.currentTarget.validity.badInput)\n if (nextError) {\n setDraft(text(props.value))\n setError('')\n // The draft of an unparsable entry is '' and so is the restored blank value: the signal\n // does not change, so the DOM has to be reset by hand to drop the leftover text.\n event.currentTarget.value = text(props.value)\n }\n props.onBlur?.(event)\n }}\n />\n </FormField>\n )\n}\n"],"mappings":";;;;;AAkDA,IAAMsB,QAAQF,UAA0BA,UAAU,OAAO,KAAKG,OAAOH,KAAK;;;;;;;;;AAU1E,SAAgBI,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,EAAE,cAAc,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type ComponentProps, type JSX } from 'solid-js';
|
|
2
|
+
import { type VariantProps } from '#lib/variants';
|
|
3
|
+
/**
|
|
4
|
+
* Marker.
|
|
5
|
+
*
|
|
6
|
+
* A note or divider *between* turns: a day change, a reconnect, a cancelled run,
|
|
7
|
+
* an event the transcript does not recognise. It is deliberately the quietest
|
|
8
|
+
* element in the column — a hairline with a label — because the transcript has
|
|
9
|
+
* dozens of these and any one that shouts teaches the reader to stop looking.
|
|
10
|
+
*
|
|
11
|
+
* `variant="rule"` draws the hairline either side (a boundary: "Today",
|
|
12
|
+
* "Reconnected"); `variant="note"` is a bare line of text with its mark (an
|
|
13
|
+
* observation that sits inside the flow). `tone` colours the mark and label and
|
|
14
|
+
* is never the only signal — the `label` always says it in words.
|
|
15
|
+
*
|
|
16
|
+
* A marker is static by default. Pass `live` for one that reports a change the
|
|
17
|
+
* reader must not miss (connection lost): it becomes a status region (`polite`)
|
|
18
|
+
* or an alert (`assertive`). A divider is not an ARIA separator, because
|
|
19
|
+
* `separator` is defined to carry no content.
|
|
20
|
+
*/
|
|
21
|
+
export declare const markerVariants: (props?: ({
|
|
22
|
+
tone?: "success" | "warning" | "info" | "neutral" | "danger" | null | undefined;
|
|
23
|
+
variant?: "note" | "rule" | null | undefined;
|
|
24
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
25
|
+
export type MarkerProps = Omit<ComponentProps<'div'>, 'children'> & VariantProps<typeof markerVariants> & {
|
|
26
|
+
label: JSX.Element;
|
|
27
|
+
icon?: JSX.Element;
|
|
28
|
+
/** Secondary text after the label: a time, a count. */
|
|
29
|
+
description?: JSX.Element;
|
|
30
|
+
/** A control that belongs to the note: Retry, Reconnect. */
|
|
31
|
+
action?: JSX.Element;
|
|
32
|
+
live?: 'polite' | 'assertive';
|
|
33
|
+
};
|
|
34
|
+
export declare function Marker(props: MarkerProps): JSX.Element;
|
|
35
|
+
//# sourceMappingURL=marker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"marker.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/marker/marker.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,cAAc,EAAE,KAAK,GAAG,EAAE,MAAM,UAAU,CAAA;AAE1E,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,eAAe,CAAA;AAEtD;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,cAAc;;;8EAezB,CAAA;AAEF,MAAM,MAAM,WAAW,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,GAC/D,YAAY,CAAC,OAAO,cAAc,CAAC,GAAG;IACpC,KAAK,EAAE,GAAG,CAAC,OAAO,CAAA;IAClB,IAAI,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IAClB,uDAAuD;IACvD,WAAW,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IACzB,4DAA4D;IAC5D,MAAM,CAAC,EAAE,GAAG,CAAC,OAAO,CAAA;IACpB,IAAI,CAAC,EAAE,QAAQ,GAAG,WAAW,CAAA;CAC9B,CAAA;AAEH,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,eAuCxC"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { cn } from "../../../lib/utils.js";
|
|
2
|
+
import { cva } from "../../../lib/variants.js";
|
|
3
|
+
import { createComponent, insert, memo, mergeProps, spread, template } from "solid-js/web";
|
|
4
|
+
import { Show, splitProps } from "solid-js";
|
|
5
|
+
//#region src/components/ui/marker/marker.tsx
|
|
6
|
+
var _tmpl$ = /*#__PURE__*/ template(`<span aria-hidden=true class="h-px min-w-4 flex-1 bg-border">`);
|
|
7
|
+
var _tmpl$2 = /*#__PURE__*/ template(`<span aria-hidden=true class="grid shrink-0 place-items-center [&_svg]:size-3.5">`);
|
|
8
|
+
var _tmpl$3 = /*#__PURE__*/ template(`<span class="text-muted-foreground [overflow-wrap:anywhere]">`);
|
|
9
|
+
var _tmpl$4 = /*#__PURE__*/ template(`<div data-slot=marker><span class="flex min-w-0 items-center gap-1.5"><span class="font-medium [overflow-wrap:anywhere]">`);
|
|
10
|
+
/**
|
|
11
|
+
* Marker.
|
|
12
|
+
*
|
|
13
|
+
* A note or divider *between* turns: a day change, a reconnect, a cancelled run,
|
|
14
|
+
* an event the transcript does not recognise. It is deliberately the quietest
|
|
15
|
+
* element in the column — a hairline with a label — because the transcript has
|
|
16
|
+
* dozens of these and any one that shouts teaches the reader to stop looking.
|
|
17
|
+
*
|
|
18
|
+
* `variant="rule"` draws the hairline either side (a boundary: "Today",
|
|
19
|
+
* "Reconnected"); `variant="note"` is a bare line of text with its mark (an
|
|
20
|
+
* observation that sits inside the flow). `tone` colours the mark and label and
|
|
21
|
+
* is never the only signal — the `label` always says it in words.
|
|
22
|
+
*
|
|
23
|
+
* A marker is static by default. Pass `live` for one that reports a change the
|
|
24
|
+
* reader must not miss (connection lost): it becomes a status region (`polite`)
|
|
25
|
+
* or an alert (`assertive`). A divider is not an ARIA separator, because
|
|
26
|
+
* `separator` is defined to carry no content.
|
|
27
|
+
*/
|
|
28
|
+
var markerVariants = cva("flex min-w-0 items-center gap-3 text-xs", {
|
|
29
|
+
variants: {
|
|
30
|
+
tone: {
|
|
31
|
+
neutral: "text-muted-foreground",
|
|
32
|
+
info: "text-info",
|
|
33
|
+
success: "text-success",
|
|
34
|
+
warning: "text-warning",
|
|
35
|
+
danger: "text-destructive"
|
|
36
|
+
},
|
|
37
|
+
variant: {
|
|
38
|
+
rule: "w-full",
|
|
39
|
+
note: "w-full justify-start"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
defaultVariants: {
|
|
43
|
+
tone: "neutral",
|
|
44
|
+
variant: "rule"
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
function Marker(props) {
|
|
48
|
+
const [local, rest] = splitProps(props, [
|
|
49
|
+
"class",
|
|
50
|
+
"tone",
|
|
51
|
+
"variant",
|
|
52
|
+
"label",
|
|
53
|
+
"icon",
|
|
54
|
+
"description",
|
|
55
|
+
"action",
|
|
56
|
+
"live"
|
|
57
|
+
]);
|
|
58
|
+
const rule = () => (local.variant ?? "rule") === "rule";
|
|
59
|
+
return (() => {
|
|
60
|
+
var _el$ = _tmpl$4(), _el$3 = _el$.firstChild, _el$5 = _el$3.firstChild;
|
|
61
|
+
spread(_el$, mergeProps({
|
|
62
|
+
get role() {
|
|
63
|
+
return memo(() => local.live === "assertive")() ? "alert" : local.live === "polite" ? "status" : void 0;
|
|
64
|
+
},
|
|
65
|
+
get ["class"]() {
|
|
66
|
+
return cn(markerVariants({
|
|
67
|
+
tone: local.tone,
|
|
68
|
+
variant: local.variant
|
|
69
|
+
}), local.class);
|
|
70
|
+
}
|
|
71
|
+
}, rest), false, true);
|
|
72
|
+
insert(_el$, createComponent(Show, {
|
|
73
|
+
get when() {
|
|
74
|
+
return rule();
|
|
75
|
+
},
|
|
76
|
+
get children() {
|
|
77
|
+
return _tmpl$();
|
|
78
|
+
}
|
|
79
|
+
}), _el$3);
|
|
80
|
+
insert(_el$3, createComponent(Show, {
|
|
81
|
+
get when() {
|
|
82
|
+
return local.icon;
|
|
83
|
+
},
|
|
84
|
+
get children() {
|
|
85
|
+
var _el$4 = _tmpl$2();
|
|
86
|
+
insert(_el$4, () => local.icon);
|
|
87
|
+
return _el$4;
|
|
88
|
+
}
|
|
89
|
+
}), _el$5);
|
|
90
|
+
insert(_el$5, () => local.label);
|
|
91
|
+
insert(_el$3, createComponent(Show, {
|
|
92
|
+
get when() {
|
|
93
|
+
return local.description;
|
|
94
|
+
},
|
|
95
|
+
get children() {
|
|
96
|
+
var _el$6 = _tmpl$3();
|
|
97
|
+
insert(_el$6, () => local.description);
|
|
98
|
+
return _el$6;
|
|
99
|
+
}
|
|
100
|
+
}), null);
|
|
101
|
+
insert(_el$3, createComponent(Show, {
|
|
102
|
+
get when() {
|
|
103
|
+
return local.action;
|
|
104
|
+
},
|
|
105
|
+
get children() {
|
|
106
|
+
return local.action;
|
|
107
|
+
}
|
|
108
|
+
}), null);
|
|
109
|
+
insert(_el$, createComponent(Show, {
|
|
110
|
+
get when() {
|
|
111
|
+
return rule();
|
|
112
|
+
},
|
|
113
|
+
get children() {
|
|
114
|
+
return _tmpl$();
|
|
115
|
+
}
|
|
116
|
+
}), null);
|
|
117
|
+
return _el$;
|
|
118
|
+
})();
|
|
119
|
+
}
|
|
120
|
+
//#endregion
|
|
121
|
+
export { Marker, markerVariants };
|
|
122
|
+
|
|
123
|
+
//# sourceMappingURL=marker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"marker.js","names":["Show","splitProps","ComponentProps","JSX","cn","cva","VariantProps","markerVariants","variants","tone","neutral","info","success","warning","danger","variant","rule","note","defaultVariants","MarkerProps","Omit","label","Element","icon","description","action","live","Marker","props","local","rest","_el$","_tmpl$4","_el$3","firstChild","_el$5","_$spread","_$mergeProps","role","_$memo","undefined","class","_$insert","_$createComponent","when","children","_tmpl$","_el$4","_tmpl$2","_el$6","_tmpl$3","_$mergeProps","_$memo","_$createComponent"],"sources":["../../../../src/components/ui/marker/marker.tsx"],"sourcesContent":["import { Show, splitProps, type ComponentProps, type JSX } from 'solid-js'\nimport { cn } from '#lib/utils'\nimport { cva, type VariantProps } from '#lib/variants'\n\n/**\n * Marker.\n *\n * A note or divider *between* turns: a day change, a reconnect, a cancelled run,\n * an event the transcript does not recognise. It is deliberately the quietest\n * element in the column — a hairline with a label — because the transcript has\n * dozens of these and any one that shouts teaches the reader to stop looking.\n *\n * `variant=\"rule\"` draws the hairline either side (a boundary: \"Today\",\n * \"Reconnected\"); `variant=\"note\"` is a bare line of text with its mark (an\n * observation that sits inside the flow). `tone` colours the mark and label and\n * is never the only signal — the `label` always says it in words.\n *\n * A marker is static by default. Pass `live` for one that reports a change the\n * reader must not miss (connection lost): it becomes a status region (`polite`)\n * or an alert (`assertive`). A divider is not an ARIA separator, because\n * `separator` is defined to carry no content.\n */\nexport const markerVariants = cva('flex min-w-0 items-center gap-3 text-xs', {\n variants: {\n tone: {\n neutral: 'text-muted-foreground',\n info: 'text-info',\n success: 'text-success',\n warning: 'text-warning',\n danger: 'text-destructive',\n },\n variant: {\n rule: 'w-full',\n note: 'w-full justify-start',\n },\n },\n defaultVariants: { tone: 'neutral', variant: 'rule' },\n})\n\nexport type MarkerProps = Omit<ComponentProps<'div'>, 'children'> &\n VariantProps<typeof markerVariants> & {\n label: JSX.Element\n icon?: JSX.Element\n /** Secondary text after the label: a time, a count. */\n description?: JSX.Element\n /** A control that belongs to the note: Retry, Reconnect. */\n action?: JSX.Element\n live?: 'polite' | 'assertive'\n }\n\nexport function Marker(props: MarkerProps) {\n const [local, rest] = splitProps(props, [\n 'class',\n 'tone',\n 'variant',\n 'label',\n 'icon',\n 'description',\n 'action',\n 'live',\n ])\n const rule = () => (local.variant ?? 'rule') === 'rule'\n return (\n <div\n data-slot=\"marker\"\n role={local.live === 'assertive' ? 'alert' : local.live === 'polite' ? 'status' : undefined}\n class={cn(markerVariants({ tone: local.tone, variant: local.variant }), local.class)}\n {...rest}\n >\n <Show when={rule()}>\n <span aria-hidden=\"true\" class=\"h-px min-w-4 flex-1 bg-border\" />\n </Show>\n <span class=\"flex min-w-0 items-center gap-1.5\">\n <Show when={local.icon}>\n <span aria-hidden=\"true\" class=\"grid shrink-0 place-items-center [&_svg]:size-3.5\">\n {local.icon}\n </span>\n </Show>\n <span class=\"font-medium [overflow-wrap:anywhere]\">{local.label}</span>\n <Show when={local.description}>\n <span class=\"text-muted-foreground [overflow-wrap:anywhere]\">{local.description}</span>\n </Show>\n <Show when={local.action}>{local.action}</Show>\n </span>\n <Show when={rule()}>\n <span aria-hidden=\"true\" class=\"h-px min-w-4 flex-1 bg-border\" />\n </Show>\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;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T,OAAAU,gBAC9D3C,MAAI;GAAA,IAAC4C,OAAI;IAAA,OAAEf,MAAML;GAAW;GAAA,IAAAqB,WAAA;IAAA,IAAAI,QAAAC,QAAA;IAAAR,OAAAO,aACmCpB,MAAML,WAAW;IAAA,OAAAyB;GAAA;EAAA,CAAA,GAAA,IAAA;EAAAP,OAAAT,OAAAU,gBAEhF3C,MAAI;GAAA,IAAC4C,OAAI;IAAA,OAAEf,MAAMJ;GAAM;GAAA,IAAAoB,WAAA;IAAA,OAAGhB,MAAMJ;GAAM;EAAA,CAAA,GAAA,IAAA;EAAAiB,OAAAX,MAAAY,gBAExC3C,MAAI;GAAA,IAAC4C,OAAI;IAAA,OAAE5B,KAAK;GAAC;GAAA,IAAA6B,WAAA;IAAA,OAAAC,OAAA;GAAA;EAAA,CAAA,GAAA,IAAA;EAAA,OAAAf;CAAA,EAAA,CAAA;AAKxB"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Citations that arrive as positions in the text, placed as markers.
|
|
3
|
+
*
|
|
4
|
+
* A producer that cites a passage says *where*: a half-open span of the exact
|
|
5
|
+
* text and the sources behind it. `MessageText` binds `[^n]` markers, so this
|
|
6
|
+
* turns the one into the other without ever changing what the text says:
|
|
7
|
+
*
|
|
8
|
+
* - A marker goes at the **end** of the span, nowhere else, and only for numbers
|
|
9
|
+
* within `count`. Several spans ending at one place share one marker.
|
|
10
|
+
* - **The parser is the judge of where a marker may go.** The text is parsed
|
|
11
|
+
* without the markers and again with them; a marker is kept only if everything
|
|
12
|
+
* that is not a marker reads exactly as before. A position inside a code
|
|
13
|
+
* block, an inline code span, a link target or anything else the parser reads
|
|
14
|
+
* as something other than prose changes that reading, so it is dropped (the
|
|
15
|
+
* source still belongs in `Sources`; it just has no badge there). No second
|
|
16
|
+
* copy of the Markdown rules exists to drift from the real one.
|
|
17
|
+
* - **Text that already has footnote marks gets none.** `[^1]` typed by a model
|
|
18
|
+
* would otherwise be indistinguishable from a marker placed here, and a
|
|
19
|
+
* citation must never come from the text alone.
|
|
20
|
+
*
|
|
21
|
+
* The result's `text` is for display only. Copy the original.
|
|
22
|
+
*/
|
|
23
|
+
export type CitationPlacement = Readonly<{
|
|
24
|
+
/** Offset into the text after which the marker goes (the span's end). */
|
|
25
|
+
end: number;
|
|
26
|
+
/** 1-based positions in the host's source list. */
|
|
27
|
+
numbers: readonly number[];
|
|
28
|
+
}>;
|
|
29
|
+
export type PlacedCitations = Readonly<{
|
|
30
|
+
/** The text with markers, for `MessageText` with `citations`. */
|
|
31
|
+
text: string;
|
|
32
|
+
/** Distinct end positions that received a marker. */
|
|
33
|
+
placed: number;
|
|
34
|
+
/** Those positions, ascending: a span is represented exactly when its end is among them. */
|
|
35
|
+
ends: readonly number[];
|
|
36
|
+
/** Distinct end positions left without one, for any reason. */
|
|
37
|
+
skipped: number;
|
|
38
|
+
/** The text had footnote marks of its own, so nothing was placed. */
|
|
39
|
+
collision: boolean;
|
|
40
|
+
}>;
|
|
41
|
+
export declare function placeCitationMarkers(text: string, citations: readonly CitationPlacement[], count: number): PlacedCitations;
|
|
42
|
+
//# sourceMappingURL=cite-ranges.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cite-ranges.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/message/cite-ranges.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,MAAM,iBAAiB,GAAG,QAAQ,CAAC;IACvC,yEAAyE;IACzE,GAAG,EAAE,MAAM,CAAA;IACX,mDAAmD;IACnD,OAAO,EAAE,SAAS,MAAM,EAAE,CAAA;CAC3B,CAAC,CAAA;AAEF,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC;IACrC,iEAAiE;IACjE,IAAI,EAAE,MAAM,CAAA;IACZ,qDAAqD;IACrD,MAAM,EAAE,MAAM,CAAA;IACd,4FAA4F;IAC5F,IAAI,EAAE,SAAS,MAAM,EAAE,CAAA;IACvB,+DAA+D;IAC/D,OAAO,EAAE,MAAM,CAAA;IACf,qEAAqE;IACrE,SAAS,EAAE,OAAO,CAAA;CACnB,CAAC,CAAA;AA2CF,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,SAAS,iBAAiB,EAAE,EACvC,KAAK,EAAE,MAAM,GACZ,eAAe,CAsDjB"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { parseMessageText } from "./parse-message-text.js";
|
|
2
|
+
//#region src/components/ui/message/cite-ranges.ts
|
|
3
|
+
var FOOTNOTE = /\[\^\d/;
|
|
4
|
+
var PER_MARKER = 6;
|
|
5
|
+
function marker(numbers) {
|
|
6
|
+
const parts = [];
|
|
7
|
+
for (let index = 0; index < numbers.length; index += PER_MARKER) parts.push(`[^${numbers.slice(index, index + PER_MARKER).join(",")}]`);
|
|
8
|
+
return parts.join("");
|
|
9
|
+
}
|
|
10
|
+
function normalise(nodes) {
|
|
11
|
+
const out = [];
|
|
12
|
+
for (const node of nodes) {
|
|
13
|
+
if (node.kind === "cite") continue;
|
|
14
|
+
if (node.kind === "strong" || node.kind === "em" || node.kind === "link") {
|
|
15
|
+
out.push({
|
|
16
|
+
...node,
|
|
17
|
+
children: normalise(node.children)
|
|
18
|
+
});
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
const last = out.at(-1);
|
|
22
|
+
if (node.kind === "text" && last?.kind === "text") out[out.length - 1] = {
|
|
23
|
+
kind: "text",
|
|
24
|
+
text: `${last.text}${node.text}`
|
|
25
|
+
};
|
|
26
|
+
else out.push(node);
|
|
27
|
+
}
|
|
28
|
+
return out;
|
|
29
|
+
}
|
|
30
|
+
/** What the blocks say with the markers and every `raw` slice taken out. */
|
|
31
|
+
function reading(blocks) {
|
|
32
|
+
return JSON.stringify(blocks.map((block) => {
|
|
33
|
+
const { raw: _raw, ...rest } = block;
|
|
34
|
+
if (block.kind === "list") return {
|
|
35
|
+
...rest,
|
|
36
|
+
items: block.items.map(normalise)
|
|
37
|
+
};
|
|
38
|
+
if (block.kind === "code") return rest;
|
|
39
|
+
return {
|
|
40
|
+
...rest,
|
|
41
|
+
inline: normalise(block.inline)
|
|
42
|
+
};
|
|
43
|
+
}));
|
|
44
|
+
}
|
|
45
|
+
function placeCitationMarkers(text, citations, count) {
|
|
46
|
+
const byEnd = /* @__PURE__ */ new Map();
|
|
47
|
+
for (const { end, numbers } of citations) {
|
|
48
|
+
if (!Number.isInteger(end) || end <= 0 || end > text.length) continue;
|
|
49
|
+
for (const number of numbers) {
|
|
50
|
+
if (!Number.isInteger(number) || number < 1 || number > count) continue;
|
|
51
|
+
const set = byEnd.get(end) ?? /* @__PURE__ */ new Set();
|
|
52
|
+
set.add(number);
|
|
53
|
+
byEnd.set(end, set);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
const candidates = [...byEnd.entries()].toSorted(([left], [right]) => left - right).map(([end, numbers]) => ({
|
|
57
|
+
end,
|
|
58
|
+
marker: marker([...numbers].toSorted((a, b) => a - b))
|
|
59
|
+
}));
|
|
60
|
+
if (candidates.length === 0) return {
|
|
61
|
+
text,
|
|
62
|
+
placed: 0,
|
|
63
|
+
ends: [],
|
|
64
|
+
skipped: 0,
|
|
65
|
+
collision: false
|
|
66
|
+
};
|
|
67
|
+
if (FOOTNOTE.test(text)) return {
|
|
68
|
+
text,
|
|
69
|
+
placed: 0,
|
|
70
|
+
ends: [],
|
|
71
|
+
skipped: candidates.length,
|
|
72
|
+
collision: true
|
|
73
|
+
};
|
|
74
|
+
const insert = (chosen) => {
|
|
75
|
+
let out = "";
|
|
76
|
+
let cursor = 0;
|
|
77
|
+
for (const item of chosen) {
|
|
78
|
+
out += text.slice(cursor, item.end) + item.marker;
|
|
79
|
+
cursor = item.end;
|
|
80
|
+
}
|
|
81
|
+
return out + text.slice(cursor);
|
|
82
|
+
};
|
|
83
|
+
const baseline = reading(parseMessageText(text));
|
|
84
|
+
const holds = (chosen) => reading(parseMessageText(insert(chosen), { citations: count })) === baseline;
|
|
85
|
+
if (holds(candidates)) return {
|
|
86
|
+
text: insert(candidates),
|
|
87
|
+
placed: candidates.length,
|
|
88
|
+
ends: candidates.map((candidate) => candidate.end),
|
|
89
|
+
skipped: 0,
|
|
90
|
+
collision: false
|
|
91
|
+
};
|
|
92
|
+
const accepted = [];
|
|
93
|
+
for (const candidate of candidates) if (holds([...accepted, candidate])) accepted.push(candidate);
|
|
94
|
+
return {
|
|
95
|
+
text: insert(accepted),
|
|
96
|
+
placed: accepted.length,
|
|
97
|
+
ends: accepted.map((candidate) => candidate.end),
|
|
98
|
+
skipped: candidates.length - accepted.length,
|
|
99
|
+
collision: false
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
//#endregion
|
|
103
|
+
export { placeCitationMarkers };
|
|
104
|
+
|
|
105
|
+
//# sourceMappingURL=cite-ranges.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cite-ranges.js","names":[],"sources":["../../../../src/components/ui/message/cite-ranges.ts"],"sourcesContent":["import { parseMessageText, type MessageBlock, type MessageInline } from './parse-message-text'\n\n/**\n * Citations that arrive as positions in the text, placed as markers.\n *\n * A producer that cites a passage says *where*: a half-open span of the exact\n * text and the sources behind it. `MessageText` binds `[^n]` markers, so this\n * turns the one into the other without ever changing what the text says:\n *\n * - A marker goes at the **end** of the span, nowhere else, and only for numbers\n * within `count`. Several spans ending at one place share one marker.\n * - **The parser is the judge of where a marker may go.** The text is parsed\n * without the markers and again with them; a marker is kept only if everything\n * that is not a marker reads exactly as before. A position inside a code\n * block, an inline code span, a link target or anything else the parser reads\n * as something other than prose changes that reading, so it is dropped (the\n * source still belongs in `Sources`; it just has no badge there). No second\n * copy of the Markdown rules exists to drift from the real one.\n * - **Text that already has footnote marks gets none.** `[^1]` typed by a model\n * would otherwise be indistinguishable from a marker placed here, and a\n * citation must never come from the text alone.\n *\n * The result's `text` is for display only. Copy the original.\n */\nexport type CitationPlacement = Readonly<{\n /** Offset into the text after which the marker goes (the span's end). */\n end: number\n /** 1-based positions in the host's source list. */\n numbers: readonly number[]\n}>\n\nexport type PlacedCitations = Readonly<{\n /** The text with markers, for `MessageText` with `citations`. */\n text: string\n /** Distinct end positions that received a marker. */\n placed: number\n /** Those positions, ascending: a span is represented exactly when its end is among them. */\n ends: readonly number[]\n /** Distinct end positions left without one, for any reason. */\n skipped: number\n /** The text had footnote marks of its own, so nothing was placed. */\n collision: boolean\n}>\n\nconst FOOTNOTE = /\\[\\^\\d/\nconst PER_MARKER = 6\n\nfunction marker(numbers: readonly number[]): string {\n const parts: string[] = []\n for (let index = 0; index < numbers.length; index += PER_MARKER) {\n parts.push(`[^${numbers.slice(index, index + PER_MARKER).join(',')}]`)\n }\n return parts.join('')\n}\n\nfunction normalise(nodes: readonly MessageInline[]): unknown[] {\n const out: unknown[] = []\n for (const node of nodes) {\n if (node.kind === 'cite') continue\n if (node.kind === 'strong' || node.kind === 'em' || node.kind === 'link') {\n out.push({ ...node, children: normalise(node.children) })\n continue\n }\n const last = out.at(-1) as { kind?: string; text?: string } | undefined\n if (node.kind === 'text' && last?.kind === 'text') {\n out[out.length - 1] = { kind: 'text', text: `${last.text}${node.text}` }\n } else {\n out.push(node)\n }\n }\n return out\n}\n\n/** What the blocks say with the markers and every `raw` slice taken out. */\nfunction reading(blocks: readonly MessageBlock[]): string {\n return JSON.stringify(\n blocks.map((block) => {\n const { raw: _raw, ...rest } = block\n if (block.kind === 'list') return { ...rest, items: block.items.map(normalise) }\n if (block.kind === 'code') return rest\n return { ...rest, inline: normalise(block.inline) }\n })\n )\n}\n\nexport function placeCitationMarkers(\n text: string,\n citations: readonly CitationPlacement[],\n count: number\n): PlacedCitations {\n const byEnd = new Map<number, Set<number>>()\n for (const { end, numbers } of citations) {\n if (!Number.isInteger(end) || end <= 0 || end > text.length) continue\n for (const number of numbers) {\n if (!Number.isInteger(number) || number < 1 || number > count) continue\n const set = byEnd.get(end) ?? new Set<number>()\n set.add(number)\n byEnd.set(end, set)\n }\n }\n const candidates = [...byEnd.entries()]\n .toSorted(([left], [right]) => left - right)\n .map(([end, numbers]) => ({ end, marker: marker([...numbers].toSorted((a, b) => a - b)) }))\n if (candidates.length === 0) return { text, placed: 0, ends: [], skipped: 0, collision: false }\n if (FOOTNOTE.test(text)) {\n return { text, placed: 0, ends: [], skipped: candidates.length, collision: true }\n }\n\n const insert = (chosen: readonly { end: number; marker: string }[]): string => {\n let out = ''\n let cursor = 0\n for (const item of chosen) {\n out += text.slice(cursor, item.end) + item.marker\n cursor = item.end\n }\n return out + text.slice(cursor)\n }\n\n const baseline = reading(parseMessageText(text))\n const holds = (chosen: readonly { end: number; marker: string }[]) =>\n reading(parseMessageText(insert(chosen), { citations: count })) === baseline\n\n // Usual case: every position is prose, one check covers all of them.\n if (holds(candidates)) {\n return {\n text: insert(candidates),\n placed: candidates.length,\n ends: candidates.map((candidate) => candidate.end),\n skipped: 0,\n collision: false,\n }\n }\n const accepted: { end: number; marker: string }[] = []\n for (const candidate of candidates) {\n if (holds([...accepted, candidate])) accepted.push(candidate)\n }\n return {\n text: insert(accepted),\n placed: accepted.length,\n ends: accepted.map((candidate) => candidate.end),\n skipped: candidates.length - accepted.length,\n collision: false,\n }\n}\n"],"mappings":";;AA4CA,IAAM,WAAW;AACjB,IAAM,aAAa;AAEnB,SAAS,OAAO,SAAoC;CAClD,MAAM,QAAkB,CAAC;CACzB,KAAK,IAAI,QAAQ,GAAG,QAAQ,QAAQ,QAAQ,SAAS,YACnD,MAAM,KAAK,KAAK,QAAQ,MAAM,OAAO,QAAQ,UAAU,CAAC,CAAC,KAAK,GAAG,EAAE,EAAE;CAEvE,OAAO,MAAM,KAAK,EAAE;AACtB;AAEA,SAAS,UAAU,OAA4C;CAC7D,MAAM,MAAiB,CAAC;CACxB,KAAK,MAAM,QAAQ,OAAO;EACxB,IAAI,KAAK,SAAS,QAAQ;EAC1B,IAAI,KAAK,SAAS,YAAY,KAAK,SAAS,QAAQ,KAAK,SAAS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U,GAAG,MAAM,IAAI,CAAC,CAAC;CAAE,EAAE;CAC5F,IAAI,WAAW,WAAW,GAAG,OAAO;EAAE;EAAM,QAAQ;EAAG,MAAM,CAAC;EAAG,SAAS;EAAG,WAAW;CAAM;CAC9F,IAAI,SAAS,KAAK,IAAI,GACpB,OAAO;EAAE;EAAM,QAAQ;EAAG,MAAM,CAAC;EAAG,SAAS,WAAW;EAAQ,WAAW;CAAK;CAGlF,MAAM,UAAU,WAA+D;EAC7E,IAAI,MAAM;EACV,IAAI,SAAS;EACb,KAAK,MAAM,QAAQ,QAAQ;GACzB,OAAO,KAAK,MAAM,QAAQ,KAAK,GAAG,IAAI,KAAK;GAC3C,SAAS,KAAK;EAChB;EACA,OAAO,MAAM,KAAK,MAAM,MAAM;CAChC;CAEA,MAAM,WAAW,QAAQ,iBAAiB,IAAI,CAAC;CAC/C,MAAM,SAAS,WACb,QAAQ,iBAAiB,OAAO,MAAM,GAAG,EAAE,WAAW,MAAM,CAAC,CAAC,MAAM;CAGtE,IAAI,MAAM,UAAU,GAClB,OAAO;EACL,MAAM,OAAO,UAAU;EACvB,QAAQ,WAAW;EACnB,MAAM,WAAW,KAAK,cAAc,UAAU,GAAG;EACjD,SAAS;EACT,WAAW;CACb;CAEF,MAAM,WAA8C,CAAC;CACrD,KAAK,MAAM,aAAa,YACtB,IAAI,MAAM,CAAC,GAAG,UAAU,SAAS,CAAC,GAAG,SAAS,KAAK,SAAS;CAE9D,OAAO;EACL,MAAM,OAAO,QAAQ;EACrB,QAAQ,SAAS;EACjB,MAAM,SAAS,KAAK,cAAc,UAAU,GAAG;EAC/C,SAAS,WAAW,SAAS,SAAS;EACtC,WAAW;CACb;AACF"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { Message, MessageActions, MessageContent, MessageFooter, MessageHeader, MessageText, type MessageCitations, type MessageCodeBlockInfo, type MessageCodeBlockProps, type MessageProps, type MessageRole, type MessageTextProps, } from './message';
|
|
2
|
+
export { placeCitationMarkers, type CitationPlacement, type PlacedCitations } from './cite-ranges';
|
|
3
|
+
export { parseInline, parseMessageText, safeHref, type MessageBlock, type MessageInline, type ParseInlineOptions, } from './parse-message-text';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/message/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,cAAc,EACd,cAAc,EACd,aAAa,EACb,aAAa,EACb,WAAW,EACX,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,gBAAgB,GACtB,MAAM,WAAW,CAAA;AAClB,OAAO,EAAE,oBAAoB,EAAE,KAAK,iBAAiB,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAA;AAClG,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,QAAQ,EACR,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,kBAAkB,GACxB,MAAM,sBAAsB,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { parseInline, parseMessageText, safeHref } from "./parse-message-text.js";
|
|
2
|
+
import { Message, MessageActions, MessageContent, MessageFooter, MessageHeader, MessageText } from "./message.js";
|
|
3
|
+
import { placeCitationMarkers } from "./cite-ranges.js";
|
|
4
|
+
export { Message, MessageActions, MessageContent, MessageFooter, MessageHeader, MessageText, parseInline, parseMessageText, placeCitationMarkers, safeHref };
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { type ComponentProps, type JSX } from 'solid-js';
|
|
2
|
+
import { type CodeBlockProps } from '../code-block';
|
|
3
|
+
/**
|
|
4
|
+
* Message.
|
|
5
|
+
*
|
|
6
|
+
* One turn. The two speakers are laid out differently on purpose, and that is
|
|
7
|
+
* the whole design:
|
|
8
|
+
*
|
|
9
|
+
* - **The person's turn is a bubble on the trailing edge** — short, bounded, and
|
|
10
|
+
* easy to find when scrolling back through a long session.
|
|
11
|
+
* - **The assistant's turn is the page.** It has no surface, spans the reading
|
|
12
|
+
* column, and holds everything the agent did *for that request* — activity
|
|
13
|
+
* (a `Trace`), prose, code, a pending decision — in one place, so a turn
|
|
14
|
+
* reads as an answer with its working underneath it rather than as a chain of
|
|
15
|
+
* unrelated cards.
|
|
16
|
+
*
|
|
17
|
+
* `label` is the turn's accessible name ("You", "Assistant"): the avatar and
|
|
18
|
+
* name are not drawn for every turn, because a transcript that repeats a speaker
|
|
19
|
+
* on every line is one nobody reads, but the name must still be announced.
|
|
20
|
+
* `streaming` sets `aria-busy`, which tells assistive technology to wait for the
|
|
21
|
+
* turn to settle before reading it instead of announcing every token.
|
|
22
|
+
*
|
|
23
|
+
* `anchorId` is the stable identity `MessageScroller` uses to keep the reader's
|
|
24
|
+
* place when older turns are inserted above it.
|
|
25
|
+
*/
|
|
26
|
+
export type MessageRole = 'user' | 'assistant' | 'system';
|
|
27
|
+
export type MessageProps = Omit<ComponentProps<'article'>, 'role'> & {
|
|
28
|
+
role: MessageRole;
|
|
29
|
+
/** The turn's accessible name. */
|
|
30
|
+
label: string;
|
|
31
|
+
streaming?: boolean;
|
|
32
|
+
anchorId?: string;
|
|
33
|
+
};
|
|
34
|
+
export declare function Message(props: MessageProps): JSX.Element;
|
|
35
|
+
/** The speaker's mark and name, for the turns that draw one. */
|
|
36
|
+
export declare function MessageHeader(props: ComponentProps<'header'> & {
|
|
37
|
+
avatar?: JSX.Element;
|
|
38
|
+
time?: JSX.Element;
|
|
39
|
+
}): JSX.Element;
|
|
40
|
+
/** The turn's parts, stacked. Gap is the rhythm between prose, activity and code. */
|
|
41
|
+
export declare function MessageContent(props: ComponentProps<'div'>): JSX.Element;
|
|
42
|
+
/**
|
|
43
|
+
* Actions that belong to the turn (copy, retry). Hidden until the turn is hovered
|
|
44
|
+
* or focused so the column is not a wall of buttons, but never `display: none`:
|
|
45
|
+
* a control that only exists under the pointer cannot be reached by keyboard,
|
|
46
|
+
* and on a touch screen there is no hover, so coarse pointers always see them.
|
|
47
|
+
*/
|
|
48
|
+
export declare function MessageActions(props: ComponentProps<'div'>): JSX.Element;
|
|
49
|
+
export declare function MessageFooter(props: ComponentProps<'footer'>): JSX.Element;
|
|
50
|
+
/** The props of a fenced block the host may set. */
|
|
51
|
+
export type MessageCodeBlockProps = Pick<CodeBlockProps, 'loadHighlight' | 'maxHeight' | 'wrap' | 'showLineNumbers' | 'lineMarks' | 'lineLimit'>;
|
|
52
|
+
/** What the host is told about a fenced block when it chooses that block's props. */
|
|
53
|
+
export type MessageCodeBlockInfo = Readonly<{
|
|
54
|
+
/** Position among the text's fenced blocks, from 0. */
|
|
55
|
+
index: number;
|
|
56
|
+
language: string | undefined;
|
|
57
|
+
code: string;
|
|
58
|
+
complete: boolean;
|
|
59
|
+
}>;
|
|
60
|
+
/**
|
|
61
|
+
* How `MessageText` draws citation markers. `count` is how many sources the host
|
|
62
|
+
* has; a `[^n]` marker is a citation only when every `n` is within it. `render`
|
|
63
|
+
* receives the 1-based source numbers and draws the marker, so the host decides
|
|
64
|
+
* what a number means (`messageCitations` in the inline-citation composite does
|
|
65
|
+
* this for a `Source` list).
|
|
66
|
+
*/
|
|
67
|
+
export type MessageCitations = Readonly<{
|
|
68
|
+
count: number;
|
|
69
|
+
render: (numbers: readonly number[]) => JSX.Element;
|
|
70
|
+
}>;
|
|
71
|
+
export type MessageTextProps = Omit<ComponentProps<'div'>, 'children'> & {
|
|
72
|
+
text: string;
|
|
73
|
+
/** True while text may still arrive: a trailing open fence renders as partial code. */
|
|
74
|
+
streaming?: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Forwarded to each fenced block, e.g. to supply a lazy highlighter. A function
|
|
77
|
+
* chooses per block, which is how line marks reach a block: marks belong to the
|
|
78
|
+
* host's knowledge of the code (a diff, a failing line), never to the text.
|
|
79
|
+
*/
|
|
80
|
+
codeBlockProps?: MessageCodeBlockProps | ((block: MessageCodeBlockInfo) => MessageCodeBlockProps);
|
|
81
|
+
/** Without it, `[^1]` stays the literal text it was written as. */
|
|
82
|
+
citations?: MessageCitations;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Text, read safely.
|
|
86
|
+
*
|
|
87
|
+
* Renders `parseMessageText`'s blocks as elements: nothing is interpreted as
|
|
88
|
+
* HTML and a link only becomes an anchor when its scheme is http, https or
|
|
89
|
+
* mailto. Blocks are kept by *position* and reuse their previous parsed object
|
|
90
|
+
* when unchanged, so a streaming turn updates the block that is growing and
|
|
91
|
+
* leaves every earlier paragraph and code block — and any selection or focus
|
|
92
|
+
* inside them — untouched.
|
|
93
|
+
*/
|
|
94
|
+
export declare function MessageText(props: MessageTextProps): JSX.Element;
|
|
95
|
+
//# sourceMappingURL=message.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/message/message.tsx"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,cAAc,EACnB,KAAK,GAAG,EACT,MAAM,UAAU,CAAA;AAEjB,OAAO,EAAyB,KAAK,cAAc,EAAE,MAAM,eAAe,CAAA;AAG1E;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAA;AAEzD,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC,GAAG;IACnE,IAAI,EAAE,WAAW,CAAA;IACjB,kCAAkC;IAClC,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,eAgC1C;AAED,gEAAgE;AAChE,wBAAgB,aAAa,CAC3B,KAAK,EAAE,cAAc,CAAC,QAAQ,CAAC,G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