@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
|
@@ -0,0 +1,544 @@
|
|
|
1
|
+
//#region src/components/composites/terminal/ansi.ts
|
|
2
|
+
var ANSI_MAX_LINE_LENGTH = 1e4;
|
|
3
|
+
var ANSI_RETAIN_LINES = 2e5;
|
|
4
|
+
/** Longest CSI parameter string worth reading; a real SGR is under 40 characters. */
|
|
5
|
+
var CSI_MAX = 256;
|
|
6
|
+
var PLAIN = Object.freeze({});
|
|
7
|
+
var styleCache = /* @__PURE__ */ new Map();
|
|
8
|
+
var STYLE_CACHE_LIMIT = 4096;
|
|
9
|
+
/**
|
|
10
|
+
* Styles are shared by value so a long run of identical style compares by
|
|
11
|
+
* reference when cells are merged into segments, and so a million coloured
|
|
12
|
+
* characters do not allocate a million style objects.
|
|
13
|
+
*/
|
|
14
|
+
function intern(style) {
|
|
15
|
+
const key = [
|
|
16
|
+
style.fg ?? "",
|
|
17
|
+
style.bg ?? "",
|
|
18
|
+
style.bold ? "b" : "",
|
|
19
|
+
style.dim ? "d" : "",
|
|
20
|
+
style.italic ? "i" : "",
|
|
21
|
+
style.underline ? "u" : "",
|
|
22
|
+
style.strike ? "s" : "",
|
|
23
|
+
style.inverse ? "r" : ""
|
|
24
|
+
].join("|");
|
|
25
|
+
if (key === "|||||||") return PLAIN;
|
|
26
|
+
const cached = styleCache.get(key);
|
|
27
|
+
if (cached) return cached;
|
|
28
|
+
const next = Object.freeze({
|
|
29
|
+
...style.fg !== void 0 && { fg: style.fg },
|
|
30
|
+
...style.bg !== void 0 && { bg: style.bg },
|
|
31
|
+
...style.bold && { bold: true },
|
|
32
|
+
...style.dim && { dim: true },
|
|
33
|
+
...style.italic && { italic: true },
|
|
34
|
+
...style.underline && { underline: true },
|
|
35
|
+
...style.strike && { strike: true },
|
|
36
|
+
...style.inverse && { inverse: true }
|
|
37
|
+
});
|
|
38
|
+
if (styleCache.size < STYLE_CACHE_LIMIT) styleCache.set(key, next);
|
|
39
|
+
return next;
|
|
40
|
+
}
|
|
41
|
+
/** Whether a style paints nothing, so the renderer can emit a bare text node. */
|
|
42
|
+
function isPlainStyle(style) {
|
|
43
|
+
return style.fg === void 0 && style.bg === void 0 && !style.bold && !style.dim && !style.italic && !style.underline && !style.strike && !style.inverse;
|
|
44
|
+
}
|
|
45
|
+
function resolveColors(style) {
|
|
46
|
+
if (!style.inverse) return {
|
|
47
|
+
fg: style.fg,
|
|
48
|
+
bg: style.bg
|
|
49
|
+
};
|
|
50
|
+
return {
|
|
51
|
+
fg: style.bg ?? "default-bg",
|
|
52
|
+
bg: style.fg ?? "default-fg"
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
var XTERM_16 = [
|
|
56
|
+
[
|
|
57
|
+
0,
|
|
58
|
+
0,
|
|
59
|
+
0
|
|
60
|
+
],
|
|
61
|
+
[
|
|
62
|
+
205,
|
|
63
|
+
0,
|
|
64
|
+
0
|
|
65
|
+
],
|
|
66
|
+
[
|
|
67
|
+
0,
|
|
68
|
+
205,
|
|
69
|
+
0
|
|
70
|
+
],
|
|
71
|
+
[
|
|
72
|
+
205,
|
|
73
|
+
205,
|
|
74
|
+
0
|
|
75
|
+
],
|
|
76
|
+
[
|
|
77
|
+
0,
|
|
78
|
+
0,
|
|
79
|
+
238
|
|
80
|
+
],
|
|
81
|
+
[
|
|
82
|
+
205,
|
|
83
|
+
0,
|
|
84
|
+
205
|
|
85
|
+
],
|
|
86
|
+
[
|
|
87
|
+
0,
|
|
88
|
+
205,
|
|
89
|
+
205
|
|
90
|
+
],
|
|
91
|
+
[
|
|
92
|
+
229,
|
|
93
|
+
229,
|
|
94
|
+
229
|
|
95
|
+
],
|
|
96
|
+
[
|
|
97
|
+
127,
|
|
98
|
+
127,
|
|
99
|
+
127
|
|
100
|
+
],
|
|
101
|
+
[
|
|
102
|
+
255,
|
|
103
|
+
0,
|
|
104
|
+
0
|
|
105
|
+
],
|
|
106
|
+
[
|
|
107
|
+
0,
|
|
108
|
+
255,
|
|
109
|
+
0
|
|
110
|
+
],
|
|
111
|
+
[
|
|
112
|
+
255,
|
|
113
|
+
255,
|
|
114
|
+
0
|
|
115
|
+
],
|
|
116
|
+
[
|
|
117
|
+
92,
|
|
118
|
+
92,
|
|
119
|
+
255
|
|
120
|
+
],
|
|
121
|
+
[
|
|
122
|
+
255,
|
|
123
|
+
0,
|
|
124
|
+
255
|
|
125
|
+
],
|
|
126
|
+
[
|
|
127
|
+
0,
|
|
128
|
+
255,
|
|
129
|
+
255
|
|
130
|
+
],
|
|
131
|
+
[
|
|
132
|
+
255,
|
|
133
|
+
255,
|
|
134
|
+
255
|
|
135
|
+
]
|
|
136
|
+
];
|
|
137
|
+
var CUBE_LEVELS = [
|
|
138
|
+
0,
|
|
139
|
+
95,
|
|
140
|
+
135,
|
|
141
|
+
175,
|
|
142
|
+
215,
|
|
143
|
+
255
|
|
144
|
+
];
|
|
145
|
+
var clamp = (value) => Math.min(255, Math.max(0, Math.round(value) || 0));
|
|
146
|
+
/** The palette index (0–15) nearest to an RGB colour. Channels are clamped to 0–255. */
|
|
147
|
+
function nearestAnsiColor(r, g, b) {
|
|
148
|
+
const red = clamp(r);
|
|
149
|
+
const green = clamp(g);
|
|
150
|
+
const blue = clamp(b);
|
|
151
|
+
let best = 0;
|
|
152
|
+
let bestDistance = Infinity;
|
|
153
|
+
for (let index = 0; index < XTERM_16.length; index += 1) {
|
|
154
|
+
const [pr, pg, pb] = XTERM_16[index];
|
|
155
|
+
const meanRed = (red + pr) / 2;
|
|
156
|
+
const dr = red - pr;
|
|
157
|
+
const dg = green - pg;
|
|
158
|
+
const db = blue - pb;
|
|
159
|
+
const distance = (2 + meanRed / 256) * dr * dr + 4 * dg * dg + (2 + (255 - meanRed) / 256) * db * db;
|
|
160
|
+
if (distance < bestDistance) {
|
|
161
|
+
bestDistance = distance;
|
|
162
|
+
best = index;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return best;
|
|
166
|
+
}
|
|
167
|
+
/** Map a 256-colour index to the sixteen. Out-of-range indices give `undefined`. */
|
|
168
|
+
function ansi256ToColor(index) {
|
|
169
|
+
if (!Number.isInteger(index) || index < 0 || index > 255) return void 0;
|
|
170
|
+
if (index < 16) return index;
|
|
171
|
+
if (index >= 232) {
|
|
172
|
+
const grey = 8 + (index - 232) * 10;
|
|
173
|
+
return nearestAnsiColor(grey, grey, grey);
|
|
174
|
+
}
|
|
175
|
+
const cube = index - 16;
|
|
176
|
+
return nearestAnsiColor(CUBE_LEVELS[Math.floor(cube / 36)], CUBE_LEVELS[Math.floor(cube / 6) % 6], CUBE_LEVELS[cube % 6]);
|
|
177
|
+
}
|
|
178
|
+
/** A parameter is a short run of digits; anything else is not a number we trust. */
|
|
179
|
+
function toNumber(token) {
|
|
180
|
+
if (token === void 0) return void 0;
|
|
181
|
+
if (token === "") return 0;
|
|
182
|
+
if (token.length > 5 || !/^\d+$/.test(token)) return void 0;
|
|
183
|
+
return Number(token);
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Apply one SGR parameter list to a style. Unknown parameters are skipped one
|
|
187
|
+
* at a time, so a program using a code we ignore still gets the colours around
|
|
188
|
+
* it. Extended colours (38/48) consume their operands whether or not they are
|
|
189
|
+
* valid, so a malformed one cannot be re-read as unrelated codes.
|
|
190
|
+
*/
|
|
191
|
+
function applySgr(current, params) {
|
|
192
|
+
const style = { ...current };
|
|
193
|
+
const tokens = params === "" ? ["0"] : params.split(";");
|
|
194
|
+
for (let i = 0; i < tokens.length; i += 1) {
|
|
195
|
+
const token = tokens[i];
|
|
196
|
+
if (token.includes(":")) {
|
|
197
|
+
const parts = token.split(":");
|
|
198
|
+
const head = toNumber(parts[0]);
|
|
199
|
+
if (head === 38 || head === 48) {
|
|
200
|
+
const color = extendedColor(parts[1] === void 0 ? [] : parts.slice(1), true);
|
|
201
|
+
if (color !== null) assign(style, head, color);
|
|
202
|
+
} else if (head === 4) {
|
|
203
|
+
if (parts[1] === "0") style.underline = false;
|
|
204
|
+
else style.underline = true;
|
|
205
|
+
}
|
|
206
|
+
continue;
|
|
207
|
+
}
|
|
208
|
+
const code = toNumber(token);
|
|
209
|
+
if (code === void 0) continue;
|
|
210
|
+
if (code === 38 || code === 48) {
|
|
211
|
+
const mode = toNumber(tokens[i + 1]);
|
|
212
|
+
const count = mode === 5 ? 1 : mode === 2 ? 3 : 0;
|
|
213
|
+
const operands = tokens.slice(i + 2, i + 2 + count);
|
|
214
|
+
i += 1 + count;
|
|
215
|
+
const color = extendedColor([String(mode ?? ""), ...operands], false);
|
|
216
|
+
if (color !== null) assign(style, code, color);
|
|
217
|
+
continue;
|
|
218
|
+
}
|
|
219
|
+
if (code === 58) {
|
|
220
|
+
const mode = toNumber(tokens[i + 1]);
|
|
221
|
+
i += 1 + (mode === 5 ? 1 : mode === 2 ? 3 : 0);
|
|
222
|
+
continue;
|
|
223
|
+
}
|
|
224
|
+
if (code === 0) {
|
|
225
|
+
delete style.fg;
|
|
226
|
+
delete style.bg;
|
|
227
|
+
style.bold = style.dim = style.italic = style.underline = false;
|
|
228
|
+
style.strike = style.inverse = false;
|
|
229
|
+
} else if (code === 1) style.bold = true;
|
|
230
|
+
else if (code === 2) style.dim = true;
|
|
231
|
+
else if (code === 3) style.italic = true;
|
|
232
|
+
else if (code === 4 || code === 21) style.underline = true;
|
|
233
|
+
else if (code === 7) style.inverse = true;
|
|
234
|
+
else if (code === 9) style.strike = true;
|
|
235
|
+
else if (code === 22) style.bold = style.dim = false;
|
|
236
|
+
else if (code === 23) style.italic = false;
|
|
237
|
+
else if (code === 24) style.underline = false;
|
|
238
|
+
else if (code === 27) style.inverse = false;
|
|
239
|
+
else if (code === 29) style.strike = false;
|
|
240
|
+
else if (code >= 30 && code <= 37) style.fg = code - 30;
|
|
241
|
+
else if (code === 39) delete style.fg;
|
|
242
|
+
else if (code >= 40 && code <= 47) style.bg = code - 40;
|
|
243
|
+
else if (code === 49) delete style.bg;
|
|
244
|
+
else if (code >= 90 && code <= 97) style.fg = code - 90 + 8;
|
|
245
|
+
else if (code >= 100 && code <= 107) style.bg = code - 100 + 8;
|
|
246
|
+
}
|
|
247
|
+
return intern(style);
|
|
248
|
+
}
|
|
249
|
+
/** The colour an extended-colour operand list names, or `null` when it is invalid. */
|
|
250
|
+
function extendedColor(parts, colon) {
|
|
251
|
+
const mode = toNumber(parts[0]);
|
|
252
|
+
if (mode === 5) {
|
|
253
|
+
const index = toNumber(parts[1]);
|
|
254
|
+
return (index === void 0 ? void 0 : ansi256ToColor(index)) ?? null;
|
|
255
|
+
}
|
|
256
|
+
if (mode === 2) {
|
|
257
|
+
const [r, g, b] = (colon && parts.length > 4 ? parts.slice(2) : parts.slice(1)).slice(0, 3).map(toNumber);
|
|
258
|
+
if (r === void 0 || g === void 0 || b === void 0) return null;
|
|
259
|
+
if (r > 255 || g > 255 || b > 255) return null;
|
|
260
|
+
return nearestAnsiColor(r, g, b);
|
|
261
|
+
}
|
|
262
|
+
return null;
|
|
263
|
+
}
|
|
264
|
+
function assign(style, code, color) {
|
|
265
|
+
if (code === 38) style.fg = color;
|
|
266
|
+
else style.bg = color;
|
|
267
|
+
}
|
|
268
|
+
/** Characters that are never rendered: C0 except tab, DEL, C1, and bidi controls. */
|
|
269
|
+
function isDroppedControl(code) {
|
|
270
|
+
return code < 32 && code !== 9 || code === 127 || code >= 128 && code <= 159 || code >= 8234 && code <= 8238 || code >= 8294 && code <= 8297 || code === 8232 || code === 8233;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* The line being written. While the cursor only ever moves right it is a list of
|
|
274
|
+
* styled runs, which is cheap; the first time something moves it left (`\r`,
|
|
275
|
+
* `\b`) it becomes one cell per UTF-16 unit so later text can overwrite.
|
|
276
|
+
*/
|
|
277
|
+
var LineBuffer = class {
|
|
278
|
+
max;
|
|
279
|
+
runs = [];
|
|
280
|
+
cells;
|
|
281
|
+
cellStyles;
|
|
282
|
+
cursor = 0;
|
|
283
|
+
length = 0;
|
|
284
|
+
dropped = 0;
|
|
285
|
+
/** A `\r` seen but not yet applied: `\r\n` is by far the common case. */
|
|
286
|
+
pendingReturn = false;
|
|
287
|
+
constructor(max) {
|
|
288
|
+
this.max = max;
|
|
289
|
+
}
|
|
290
|
+
isEmpty() {
|
|
291
|
+
return this.length === 0 && this.dropped === 0;
|
|
292
|
+
}
|
|
293
|
+
put(text, style) {
|
|
294
|
+
if (text === "") return;
|
|
295
|
+
this.applyReturn();
|
|
296
|
+
if (this.cells === void 0) {
|
|
297
|
+
const room = this.max - this.length;
|
|
298
|
+
if (room <= 0) {
|
|
299
|
+
this.dropped += text.length;
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
const kept = text.length > room ? text.slice(0, room) : text;
|
|
303
|
+
this.dropped += text.length - kept.length;
|
|
304
|
+
const last = this.runs[this.runs.length - 1];
|
|
305
|
+
if (last && last.style === style) last.text += kept;
|
|
306
|
+
else this.runs.push({
|
|
307
|
+
text: kept,
|
|
308
|
+
style
|
|
309
|
+
});
|
|
310
|
+
this.length += kept.length;
|
|
311
|
+
this.cursor = this.length;
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
for (let i = 0; i < text.length; i += 1) this.putCell(text[i], style);
|
|
315
|
+
}
|
|
316
|
+
putCell(char, style) {
|
|
317
|
+
const cells = this.cells;
|
|
318
|
+
const styles = this.cellStyles;
|
|
319
|
+
if (this.cursor >= this.max) {
|
|
320
|
+
this.dropped += 1;
|
|
321
|
+
return;
|
|
322
|
+
}
|
|
323
|
+
while (cells.length < this.cursor) {
|
|
324
|
+
cells.push(" ");
|
|
325
|
+
styles.push(PLAIN);
|
|
326
|
+
}
|
|
327
|
+
cells[this.cursor] = char;
|
|
328
|
+
styles[this.cursor] = style;
|
|
329
|
+
this.cursor += 1;
|
|
330
|
+
this.length = cells.length;
|
|
331
|
+
}
|
|
332
|
+
carriageReturn() {
|
|
333
|
+
this.pendingReturn = true;
|
|
334
|
+
}
|
|
335
|
+
backspace() {
|
|
336
|
+
this.applyReturn();
|
|
337
|
+
if (this.cursor === 0) return;
|
|
338
|
+
this.toCells();
|
|
339
|
+
this.cursor -= 1;
|
|
340
|
+
}
|
|
341
|
+
/** `ESC[nK`: 0 from the cursor to the end, 1 start to cursor, 2 the whole line. */
|
|
342
|
+
eraseInLine(mode) {
|
|
343
|
+
this.applyReturn();
|
|
344
|
+
if (mode === 0 && this.cursor >= this.length) return;
|
|
345
|
+
this.toCells();
|
|
346
|
+
const cells = this.cells;
|
|
347
|
+
const styles = this.cellStyles;
|
|
348
|
+
if (mode === 0) {
|
|
349
|
+
cells.length = this.cursor;
|
|
350
|
+
styles.length = this.cursor;
|
|
351
|
+
} else if (mode === 1) for (let i = 0; i <= this.cursor && i < cells.length; i += 1) {
|
|
352
|
+
cells[i] = " ";
|
|
353
|
+
styles[i] = PLAIN;
|
|
354
|
+
}
|
|
355
|
+
else if (mode === 2) {
|
|
356
|
+
cells.length = 0;
|
|
357
|
+
styles.length = 0;
|
|
358
|
+
}
|
|
359
|
+
this.length = cells.length;
|
|
360
|
+
}
|
|
361
|
+
applyReturn() {
|
|
362
|
+
if (!this.pendingReturn) return;
|
|
363
|
+
this.pendingReturn = false;
|
|
364
|
+
if (this.length === 0) {
|
|
365
|
+
this.cursor = 0;
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
this.toCells();
|
|
369
|
+
this.cursor = 0;
|
|
370
|
+
}
|
|
371
|
+
toCells() {
|
|
372
|
+
if (this.cells !== void 0) return;
|
|
373
|
+
const cells = [];
|
|
374
|
+
const styles = [];
|
|
375
|
+
for (const run of this.runs) for (let i = 0; i < run.text.length; i += 1) {
|
|
376
|
+
cells.push(run.text[i]);
|
|
377
|
+
styles.push(run.style);
|
|
378
|
+
}
|
|
379
|
+
this.cells = cells;
|
|
380
|
+
this.cellStyles = styles;
|
|
381
|
+
this.runs = [];
|
|
382
|
+
this.cursor = Math.min(this.cursor, cells.length);
|
|
383
|
+
}
|
|
384
|
+
snapshot() {
|
|
385
|
+
const segments = [];
|
|
386
|
+
if (this.cells === void 0) for (const run of this.runs) segments.push({
|
|
387
|
+
text: run.text,
|
|
388
|
+
style: run.style
|
|
389
|
+
});
|
|
390
|
+
else {
|
|
391
|
+
const cells = this.cells;
|
|
392
|
+
const styles = this.cellStyles;
|
|
393
|
+
let start = 0;
|
|
394
|
+
for (let i = 1; i <= cells.length; i += 1) if (i === cells.length || styles[i] !== styles[start]) {
|
|
395
|
+
segments.push({
|
|
396
|
+
text: cells.slice(start, i).join(""),
|
|
397
|
+
style: styles[start]
|
|
398
|
+
});
|
|
399
|
+
start = i;
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
return {
|
|
403
|
+
segments,
|
|
404
|
+
truncated: this.dropped
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
reset() {
|
|
408
|
+
this.runs = [];
|
|
409
|
+
this.cells = void 0;
|
|
410
|
+
this.cellStyles = void 0;
|
|
411
|
+
this.cursor = 0;
|
|
412
|
+
this.length = 0;
|
|
413
|
+
this.dropped = 0;
|
|
414
|
+
this.pendingReturn = false;
|
|
415
|
+
}
|
|
416
|
+
};
|
|
417
|
+
function createAnsiParser(options = {}) {
|
|
418
|
+
const maxLine = Math.max(1, Math.floor(options.maxLineLength ?? 1e4));
|
|
419
|
+
const retain = Math.max(1, Math.floor(options.retainLines ?? 2e5));
|
|
420
|
+
const lines = [];
|
|
421
|
+
let droppedLines = 0;
|
|
422
|
+
const line = new LineBuffer(maxLine);
|
|
423
|
+
let style = PLAIN;
|
|
424
|
+
let state = "text";
|
|
425
|
+
let csi = "";
|
|
426
|
+
let csiOverflow = false;
|
|
427
|
+
let csiHonoured = true;
|
|
428
|
+
const finishLine = () => {
|
|
429
|
+
lines.push(line.snapshot());
|
|
430
|
+
line.reset();
|
|
431
|
+
if (lines.length > retain + Math.max(64, retain >> 3)) {
|
|
432
|
+
const excess = lines.length - retain;
|
|
433
|
+
lines.splice(0, excess);
|
|
434
|
+
droppedLines += excess;
|
|
435
|
+
}
|
|
436
|
+
};
|
|
437
|
+
const runCsi = (final) => {
|
|
438
|
+
if (csiOverflow || !csiHonoured) return;
|
|
439
|
+
if (!/^[\d;:]*$/.test(csi)) return;
|
|
440
|
+
if (final === "m") style = applySgr(style, csi);
|
|
441
|
+
else if (final === "K") {
|
|
442
|
+
const mode = toNumber(csi.split(";")[0]);
|
|
443
|
+
if (mode !== void 0 && mode <= 2) line.eraseInLine(mode);
|
|
444
|
+
}
|
|
445
|
+
};
|
|
446
|
+
function write(chunk) {
|
|
447
|
+
for (let i = 0; i < chunk.length; i += 1) {
|
|
448
|
+
const code = chunk.charCodeAt(i);
|
|
449
|
+
switch (state) {
|
|
450
|
+
case "text":
|
|
451
|
+
if (!isDroppedControl(code)) {
|
|
452
|
+
let end = i + 1;
|
|
453
|
+
while (end < chunk.length && !isDroppedControl(chunk.charCodeAt(end))) end += 1;
|
|
454
|
+
line.put(chunk.slice(i, end), style);
|
|
455
|
+
i = end - 1;
|
|
456
|
+
break;
|
|
457
|
+
}
|
|
458
|
+
if (code === 27) state = "esc";
|
|
459
|
+
else if (code === 10) finishLine();
|
|
460
|
+
else if (code === 13) line.carriageReturn();
|
|
461
|
+
else if (code === 8) line.backspace();
|
|
462
|
+
else if (code === 155) {
|
|
463
|
+
state = "csi";
|
|
464
|
+
csi = "";
|
|
465
|
+
csiOverflow = false;
|
|
466
|
+
csiHonoured = false;
|
|
467
|
+
} else if (code === 157 || code === 144 || code === 152 || code === 158 || code === 159) state = "string";
|
|
468
|
+
break;
|
|
469
|
+
case "esc":
|
|
470
|
+
if (code === 91) {
|
|
471
|
+
state = "csi";
|
|
472
|
+
csi = "";
|
|
473
|
+
csiOverflow = false;
|
|
474
|
+
csiHonoured = true;
|
|
475
|
+
} else if (code === 93 || code === 80 || code === 88 || code === 94 || code === 95) state = "string";
|
|
476
|
+
else if (code >= 32 && code <= 47) state = "esc-intermediate";
|
|
477
|
+
else if (code >= 48 && code <= 126) state = "text";
|
|
478
|
+
else if (code === 27) state = "esc";
|
|
479
|
+
else {
|
|
480
|
+
state = "text";
|
|
481
|
+
i -= 1;
|
|
482
|
+
}
|
|
483
|
+
break;
|
|
484
|
+
case "esc-intermediate":
|
|
485
|
+
if (code >= 32 && code <= 47) break;
|
|
486
|
+
if (code >= 48 && code <= 126) state = "text";
|
|
487
|
+
else {
|
|
488
|
+
state = "text";
|
|
489
|
+
i -= 1;
|
|
490
|
+
}
|
|
491
|
+
break;
|
|
492
|
+
case "csi":
|
|
493
|
+
if (code >= 32 && code <= 63) {
|
|
494
|
+
if (csi.length < CSI_MAX) csi += chunk[i];
|
|
495
|
+
else csiOverflow = true;
|
|
496
|
+
} else if (code >= 64 && code <= 126) {
|
|
497
|
+
runCsi(chunk[i]);
|
|
498
|
+
state = "text";
|
|
499
|
+
} else if (code === 27) state = "esc";
|
|
500
|
+
else {
|
|
501
|
+
state = "text";
|
|
502
|
+
i -= 1;
|
|
503
|
+
}
|
|
504
|
+
break;
|
|
505
|
+
case "string":
|
|
506
|
+
if (code === 7 || code === 156) state = "text";
|
|
507
|
+
else if (code === 27) state = "string-esc";
|
|
508
|
+
else if (code === 10 || code === 13) {
|
|
509
|
+
state = "text";
|
|
510
|
+
i -= 1;
|
|
511
|
+
}
|
|
512
|
+
break;
|
|
513
|
+
case "string-esc": if (code === 92) state = "text";
|
|
514
|
+
else {
|
|
515
|
+
state = "esc";
|
|
516
|
+
i -= 1;
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
return {
|
|
522
|
+
write,
|
|
523
|
+
lines,
|
|
524
|
+
openLine: () => line.isEmpty() ? void 0 : line.snapshot(),
|
|
525
|
+
get droppedLines() {
|
|
526
|
+
return droppedLines;
|
|
527
|
+
}
|
|
528
|
+
};
|
|
529
|
+
}
|
|
530
|
+
/** Parse a whole output at once: finished lines plus the open one, if any. */
|
|
531
|
+
function parseAnsi(text, options) {
|
|
532
|
+
const parser = createAnsiParser(options);
|
|
533
|
+
parser.write(text);
|
|
534
|
+
const open = parser.openLine();
|
|
535
|
+
return open ? [...parser.lines, open] : [...parser.lines];
|
|
536
|
+
}
|
|
537
|
+
/** A line's text with styling removed, for tests and for accessible names. */
|
|
538
|
+
function ansiLineText(line) {
|
|
539
|
+
return line.segments.map((segment) => segment.text).join("");
|
|
540
|
+
}
|
|
541
|
+
//#endregion
|
|
542
|
+
export { ANSI_MAX_LINE_LENGTH, ANSI_RETAIN_LINES, ansi256ToColor, ansiLineText, createAnsiParser, isPlainStyle, nearestAnsiColor, parseAnsi, resolveColors };
|
|
543
|
+
|
|
544
|
+
//# sourceMappingURL=ansi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ansi.js","names":[],"sources":["../../../../src/components/composites/terminal/ansi.ts"],"sourcesContent":["/**\n * A terminal's text, read safely.\n *\n * Command output is untrusted bytes, not text: it carries colour for the human\n * who ran the command, cursor control for a screen that is not here, and — from\n * a hostile program — sequences that ask a terminal emulator to rewrite its\n * title, write to the clipboard (OSC 52) or hide what it printed. This parser\n * accepts exactly the part a transcript can honour and drops the rest:\n *\n * - **Kept:** printable text, `\\n`, `\\r` (the cursor returns to column 0 and\n * later text overwrites, which is how a progress bar redraws itself), `\\b`\n * (the cursor steps back one column), tab, `ESC[…K` (erase in line, which\n * progress bars pair with `\\r`), and SGR `ESC[…m` for the sixteen theme\n * colours, bold, dim, italic, underline, strike-through and reverse video.\n * - **Mapped:** 256-colour and truecolour SGR become the nearest of the sixteen,\n * so the output keeps the theme's palette and its contrast guarantees instead\n * of a program's idea of \"dark blue\" on a light terminal.\n * - **Dropped, never echoed:** every other CSI (cursor movement, scrolling,\n * private modes), OSC, DCS/SOS/PM/APC strings, charset designations, the 8-bit\n * C1 forms of all of these, every other control character, and the Unicode\n * bidirectional overrides that make text read differently from how it is\n * stored. A malformed or truncated sequence is dropped with its payload, so a\n * half-received `ESC[3` never shows up as the text \"3\".\n *\n * Nothing here produces markup. The result is plain strings with a style object,\n * and the renderer decides what a style looks like.\n *\n * ## Why a stateful parser\n *\n * Output arrives in chunks that split anywhere — inside an escape sequence, in\n * the middle of a line. `createAnsiParser` keeps the half-read sequence, the\n * current style and the line being written between `write` calls, so a chunk\n * boundary changes nothing about the result. Finished lines are immutable and\n * never touched again, which is what lets a renderer keep their DOM while the\n * last line keeps growing. `parseAnsi` is the same thing run once.\n */\n\n/** An index into the sixteen-colour palette: 0–7 normal, 8–15 bright. */\nexport type AnsiColor = number\n\nexport type AnsiStyle = Readonly<{\n fg?: AnsiColor\n bg?: AnsiColor\n bold?: true\n dim?: true\n italic?: true\n underline?: true\n strike?: true\n inverse?: true\n}>\n\nexport type AnsiSegment = Readonly<{ text: string; style: AnsiStyle }>\n\nexport type AnsiLine = Readonly<{\n segments: readonly AnsiSegment[]\n /** Characters past `maxLineLength` that were not kept. Zero for most lines. */\n truncated: number\n}>\n\nexport type AnsiParserOptions = {\n /** Characters kept per line; the rest are counted in `truncated`. Default 10 000. */\n maxLineLength?: number\n /**\n * Finished lines kept. The oldest are discarded (and counted in `droppedLines`)\n * past this, so a command that prints for an hour cannot grow the parser\n * without bound. Default 200 000.\n */\n retainLines?: number\n}\n\nexport type AnsiParser = {\n /** Feed the next chunk. Chunks may split anywhere, including inside an escape. */\n write(chunk: string): void\n /** Finished lines, oldest first. The array is mutated in place as lines arrive. */\n readonly lines: readonly AnsiLine[]\n /** The line still being written, or `undefined` while it is empty. */\n openLine(): AnsiLine | undefined\n /** Finished lines discarded because of `retainLines`. */\n readonly droppedLines: number\n}\n\nexport const ANSI_MAX_LINE_LENGTH = 10_000\nexport const ANSI_RETAIN_LINES = 200_000\n\n/** Longest CSI parameter string worth reading; a real SGR is under 40 characters. */\nconst CSI_MAX = 256\n\nconst PLAIN: AnsiStyle = Object.freeze({})\nconst styleCache = new Map<string, AnsiStyle>()\nconst STYLE_CACHE_LIMIT = 4096\n\n/**\n * Styles are shared by value so a long run of identical style compares by\n * reference when cells are merged into segments, and so a million coloured\n * characters do not allocate a million style objects.\n */\nfunction intern(style: {\n fg?: AnsiColor\n bg?: AnsiColor\n bold?: boolean\n dim?: boolean\n italic?: boolean\n underline?: boolean\n strike?: boolean\n inverse?: boolean\n}): AnsiStyle {\n const key = [\n style.fg ?? '',\n style.bg ?? '',\n style.bold ? 'b' : '',\n style.dim ? 'd' : '',\n style.italic ? 'i' : '',\n style.underline ? 'u' : '',\n style.strike ? 's' : '',\n style.inverse ? 'r' : '',\n ].join('|')\n if (key === '|||||||') return PLAIN\n const cached = styleCache.get(key)\n if (cached) return cached\n const next: AnsiStyle = Object.freeze({\n ...(style.fg !== undefined && { fg: style.fg }),\n ...(style.bg !== undefined && { bg: style.bg }),\n ...(style.bold && { bold: true as const }),\n ...(style.dim && { dim: true as const }),\n ...(style.italic && { italic: true as const }),\n ...(style.underline && { underline: true as const }),\n ...(style.strike && { strike: true as const }),\n ...(style.inverse && { inverse: true as const }),\n })\n if (styleCache.size < STYLE_CACHE_LIMIT) styleCache.set(key, next)\n return next\n}\n\n/** Whether a style paints nothing, so the renderer can emit a bare text node. */\nexport function isPlainStyle(style: AnsiStyle): boolean {\n return (\n style.fg === undefined &&\n style.bg === undefined &&\n !style.bold &&\n !style.dim &&\n !style.italic &&\n !style.underline &&\n !style.strike &&\n !style.inverse\n )\n}\n\n/**\n * The colours a style actually paints. Reverse video swaps them; a swapped side\n * with no colour of its own resolves to the terminal's default foreground or\n * background (`'default-fg'`, `'default-bg'`), which are themselves theme tokens.\n */\nexport type ResolvedColors = Readonly<{\n fg: AnsiColor | 'default-bg' | undefined\n bg: AnsiColor | 'default-fg' | undefined\n}>\n\nexport function resolveColors(style: AnsiStyle): ResolvedColors {\n if (!style.inverse) return { fg: style.fg, bg: style.bg }\n return { fg: style.bg ?? 'default-bg', bg: style.fg ?? 'default-fg' }\n}\n\n// The xterm default palette, used only to decide which of the sixteen theme\n// colours an extended colour is closest to.\nconst XTERM_16: readonly (readonly [number, number, number])[] = [\n [0, 0, 0],\n [205, 0, 0],\n [0, 205, 0],\n [205, 205, 0],\n [0, 0, 238],\n [205, 0, 205],\n [0, 205, 205],\n [229, 229, 229],\n [127, 127, 127],\n [255, 0, 0],\n [0, 255, 0],\n [255, 255, 0],\n [92, 92, 255],\n [255, 0, 255],\n [0, 255, 255],\n [255, 255, 255],\n]\nconst CUBE_LEVELS = [0, 95, 135, 175, 215, 255] as const\n\nconst clamp = (value: number) => Math.min(255, Math.max(0, Math.round(value) || 0))\n\n/** The palette index (0–15) nearest to an RGB colour. Channels are clamped to 0–255. */\nexport function nearestAnsiColor(r: number, g: number, b: number): AnsiColor {\n const red = clamp(r)\n const green = clamp(g)\n const blue = clamp(b)\n let best = 0\n let bestDistance = Infinity\n for (let index = 0; index < XTERM_16.length; index += 1) {\n const [pr, pg, pb] = XTERM_16[index]!\n // The weights are the \"redmean\" approximation: cheap, and much closer to how\n // the eye separates two colours than plain Euclidean distance.\n const meanRed = (red + pr) / 2\n const dr = red - pr\n const dg = green - pg\n const db = blue - pb\n const distance =\n (2 + meanRed / 256) * dr * dr + 4 * dg * dg + (2 + (255 - meanRed) / 256) * db * db\n if (distance < bestDistance) {\n bestDistance = distance\n best = index\n }\n }\n return best\n}\n\n/** Map a 256-colour index to the sixteen. Out-of-range indices give `undefined`. */\nexport function ansi256ToColor(index: number): AnsiColor | undefined {\n if (!Number.isInteger(index) || index < 0 || index > 255) return undefined\n if (index < 16) return index\n if (index >= 232) {\n const grey = 8 + (index - 232) * 10\n return nearestAnsiColor(grey, grey, grey)\n }\n const cube = index - 16\n return nearestAnsiColor(\n CUBE_LEVELS[Math.floor(cube / 36)]!,\n CUBE_LEVELS[Math.floor(cube / 6) % 6]!,\n CUBE_LEVELS[cube % 6]!\n )\n}\n\ntype MutableStyle = {\n fg?: AnsiColor\n bg?: AnsiColor\n bold?: boolean\n dim?: boolean\n italic?: boolean\n underline?: boolean\n strike?: boolean\n inverse?: boolean\n}\n\n/** A parameter is a short run of digits; anything else is not a number we trust. */\nfunction toNumber(token: string | undefined): number | undefined {\n if (token === undefined) return undefined\n if (token === '') return 0\n if (token.length > 5 || !/^\\d+$/.test(token)) return undefined\n return Number(token)\n}\n\n/**\n * Apply one SGR parameter list to a style. Unknown parameters are skipped one\n * at a time, so a program using a code we ignore still gets the colours around\n * it. Extended colours (38/48) consume their operands whether or not they are\n * valid, so a malformed one cannot be re-read as unrelated codes.\n */\nfunction applySgr(current: AnsiStyle, params: string): AnsiStyle {\n const style: MutableStyle = { ...current }\n const tokens = params === '' ? ['0'] : params.split(';')\n\n for (let i = 0; i < tokens.length; i += 1) {\n const token = tokens[i]!\n // The colon form `38:2::r:g:b` carries its operands in one token.\n if (token.includes(':')) {\n const parts = token.split(':')\n const head = toNumber(parts[0])\n if (head === 38 || head === 48) {\n const color = extendedColor(parts[1] === undefined ? [] : parts.slice(1), true)\n if (color !== null) assign(style, head, color)\n } else if (head === 4) {\n if (parts[1] === '0') style.underline = false\n else style.underline = true\n }\n continue\n }\n\n const code = toNumber(token)\n if (code === undefined) continue\n\n if (code === 38 || code === 48) {\n const mode = toNumber(tokens[i + 1])\n const count = mode === 5 ? 1 : mode === 2 ? 3 : 0\n const operands = tokens.slice(i + 2, i + 2 + count)\n i += 1 + count\n const color = extendedColor([String(mode ?? ''), ...operands], false)\n if (color !== null) assign(style, code, color)\n continue\n }\n if (code === 58) {\n // Underline colour: consumed so its operands are not read as codes, then ignored.\n const mode = toNumber(tokens[i + 1])\n i += 1 + (mode === 5 ? 1 : mode === 2 ? 3 : 0)\n continue\n }\n\n if (code === 0) {\n delete style.fg\n delete style.bg\n style.bold = style.dim = style.italic = style.underline = false\n style.strike = style.inverse = false\n } else if (code === 1) style.bold = true\n else if (code === 2) style.dim = true\n else if (code === 3) style.italic = true\n else if (code === 4 || code === 21) style.underline = true\n else if (code === 7) style.inverse = true\n else if (code === 9) style.strike = true\n else if (code === 22) style.bold = style.dim = false\n else if (code === 23) style.italic = false\n else if (code === 24) style.underline = false\n else if (code === 27) style.inverse = false\n else if (code === 29) style.strike = false\n else if (code >= 30 && code <= 37) style.fg = code - 30\n else if (code === 39) delete style.fg\n else if (code >= 40 && code <= 47) style.bg = code - 40\n else if (code === 49) delete style.bg\n else if (code >= 90 && code <= 97) style.fg = code - 90 + 8\n else if (code >= 100 && code <= 107) style.bg = code - 100 + 8\n // Blink (5, 6), conceal (8), overline (53) and the rest are ignored. Conceal\n // in particular is not honoured: output must not be able to hide itself.\n }\n return intern(style)\n}\n\n/** The colour an extended-colour operand list names, or `null` when it is invalid. */\nfunction extendedColor(parts: readonly string[], colon: boolean): AnsiColor | null {\n const mode = toNumber(parts[0])\n if (mode === 5) {\n const index = toNumber(parts[1])\n const color = index === undefined ? undefined : ansi256ToColor(index)\n return color ?? null\n }\n if (mode === 2) {\n // In the colon form a colour-space id may precede the channels, empty or not.\n const channels = colon && parts.length > 4 ? parts.slice(2) : parts.slice(1)\n const [r, g, b] = channels.slice(0, 3).map(toNumber)\n if (r === undefined || g === undefined || b === undefined) return null\n if (r > 255 || g > 255 || b > 255) return null\n return nearestAnsiColor(r, g, b)\n }\n return null\n}\n\nfunction assign(style: MutableStyle, code: number, color: AnsiColor): void {\n if (code === 38) style.fg = color\n else style.bg = color\n}\n\n/** Characters that are never rendered: C0 except tab, DEL, C1, and bidi controls. */\nfunction isDroppedControl(code: number): boolean {\n return (\n (code < 0x20 && code !== 0x09) ||\n code === 0x7f ||\n (code >= 0x80 && code <= 0x9f) ||\n (code >= 0x202a && code <= 0x202e) ||\n (code >= 0x2066 && code <= 0x2069) ||\n code === 0x2028 ||\n code === 0x2029\n )\n}\n\ntype Run = { text: string; style: AnsiStyle }\n\n/**\n * The line being written. While the cursor only ever moves right it is a list of\n * styled runs, which is cheap; the first time something moves it left (`\\r`,\n * `\\b`) it becomes one cell per UTF-16 unit so later text can overwrite.\n */\nclass LineBuffer {\n private runs: Run[] = []\n private cells: string[] | undefined\n private cellStyles: AnsiStyle[] | undefined\n private cursor = 0\n private length = 0\n private dropped = 0\n /** A `\\r` seen but not yet applied: `\\r\\n` is by far the common case. */\n private pendingReturn = false\n\n constructor(private readonly max: number) {}\n\n isEmpty(): boolean {\n return this.length === 0 && this.dropped === 0\n }\n\n put(text: string, style: AnsiStyle): void {\n if (text === '') return\n this.applyReturn()\n if (this.cells === undefined) {\n const room = this.max - this.length\n if (room <= 0) {\n this.dropped += text.length\n return\n }\n const kept = text.length > room ? text.slice(0, room) : text\n this.dropped += text.length - kept.length\n const last = this.runs[this.runs.length - 1]\n if (last && last.style === style) last.text += kept\n else this.runs.push({ text: kept, style })\n this.length += kept.length\n this.cursor = this.length\n return\n }\n for (let i = 0; i < text.length; i += 1) this.putCell(text[i]!, style)\n }\n\n private putCell(char: string, style: AnsiStyle): void {\n const cells = this.cells!\n const styles = this.cellStyles!\n if (this.cursor >= this.max) {\n this.dropped += 1\n return\n }\n while (cells.length < this.cursor) {\n cells.push(' ')\n styles.push(PLAIN)\n }\n cells[this.cursor] = char\n styles[this.cursor] = style\n this.cursor += 1\n this.length = cells.length\n }\n\n carriageReturn(): void {\n this.pendingReturn = true\n }\n\n backspace(): void {\n this.applyReturn()\n if (this.cursor === 0) return\n this.toCells()\n this.cursor -= 1\n }\n\n /** `ESC[nK`: 0 from the cursor to the end, 1 start to cursor, 2 the whole line. */\n eraseInLine(mode: number): void {\n this.applyReturn()\n if (mode === 0 && this.cursor >= this.length) return\n this.toCells()\n const cells = this.cells!\n const styles = this.cellStyles!\n if (mode === 0) {\n cells.length = this.cursor\n styles.length = this.cursor\n } else if (mode === 1) {\n for (let i = 0; i <= this.cursor && i < cells.length; i += 1) {\n cells[i] = ' '\n styles[i] = PLAIN\n }\n } else if (mode === 2) {\n cells.length = 0\n styles.length = 0\n }\n this.length = cells.length\n }\n\n private applyReturn(): void {\n if (!this.pendingReturn) return\n this.pendingReturn = false\n if (this.length === 0) {\n this.cursor = 0\n return\n }\n this.toCells()\n this.cursor = 0\n }\n\n private toCells(): void {\n if (this.cells !== undefined) return\n const cells: string[] = []\n const styles: AnsiStyle[] = []\n for (const run of this.runs) {\n for (let i = 0; i < run.text.length; i += 1) {\n cells.push(run.text[i]!)\n styles.push(run.style)\n }\n }\n this.cells = cells\n this.cellStyles = styles\n this.runs = []\n this.cursor = Math.min(this.cursor, cells.length)\n }\n\n snapshot(): AnsiLine {\n const segments: AnsiSegment[] = []\n if (this.cells === undefined) {\n for (const run of this.runs) segments.push({ text: run.text, style: run.style })\n } else {\n const cells = this.cells\n const styles = this.cellStyles!\n let start = 0\n for (let i = 1; i <= cells.length; i += 1) {\n if (i === cells.length || styles[i] !== styles[start]) {\n segments.push({ text: cells.slice(start, i).join(''), style: styles[start]! })\n start = i\n }\n }\n }\n return { segments, truncated: this.dropped }\n }\n\n reset(): void {\n this.runs = []\n this.cells = undefined\n this.cellStyles = undefined\n this.cursor = 0\n this.length = 0\n this.dropped = 0\n this.pendingReturn = false\n }\n}\n\ntype State = 'text' | 'esc' | 'esc-intermediate' | 'csi' | 'string' | 'string-esc'\n\nexport function createAnsiParser(options: AnsiParserOptions = {}): AnsiParser {\n const maxLine = Math.max(1, Math.floor(options.maxLineLength ?? ANSI_MAX_LINE_LENGTH))\n const retain = Math.max(1, Math.floor(options.retainLines ?? ANSI_RETAIN_LINES))\n const lines: AnsiLine[] = []\n let droppedLines = 0\n const line = new LineBuffer(maxLine)\n let style: AnsiStyle = PLAIN\n let state: State = 'text'\n let csi = ''\n let csiOverflow = false\n // Only the 7-bit `ESC [` introducer is honoured. The 8-bit form is consumed so\n // its parameters are not echoed, but it never changes the style: it is a rarity\n // in real output and a favourite of filter-evasion payloads.\n let csiHonoured = true\n\n const finishLine = () => {\n lines.push(line.snapshot())\n line.reset()\n // Trim in blocks so the common append stays O(1) amortised.\n if (lines.length > retain + Math.max(64, retain >> 3)) {\n const excess = lines.length - retain\n lines.splice(0, excess)\n droppedLines += excess\n }\n }\n\n const runCsi = (final: string) => {\n if (csiOverflow || !csiHonoured) return\n // Only plain numeric parameters are honoured; a private marker (`?`, `>`,\n // `<`, `=`) or an intermediate byte makes this some other command entirely.\n if (!/^[\\d;:]*$/.test(csi)) return\n if (final === 'm') style = applySgr(style, csi)\n else if (final === 'K') {\n const mode = toNumber(csi.split(';')[0])\n if (mode !== undefined && mode <= 2) line.eraseInLine(mode)\n }\n }\n\n function write(chunk: string): void {\n for (let i = 0; i < chunk.length; i += 1) {\n const code = chunk.charCodeAt(i)\n\n switch (state) {\n case 'text': {\n if (!isDroppedControl(code)) {\n // Take the whole run of ordinary characters at once.\n let end = i + 1\n while (end < chunk.length && !isDroppedControl(chunk.charCodeAt(end))) end += 1\n line.put(chunk.slice(i, end), style)\n i = end - 1\n break\n }\n if (code === 0x1b) state = 'esc'\n else if (code === 0x0a) finishLine()\n else if (code === 0x0d) line.carriageReturn()\n else if (code === 0x08) line.backspace()\n else if (code === 0x9b) {\n state = 'csi'\n csi = ''\n csiOverflow = false\n csiHonoured = false\n } else if (\n code === 0x9d ||\n code === 0x90 ||\n code === 0x98 ||\n code === 0x9e ||\n code === 0x9f\n ) {\n state = 'string'\n }\n // Every other control character is dropped.\n break\n }\n case 'esc': {\n if (code === 0x5b) {\n state = 'csi'\n csi = ''\n csiOverflow = false\n csiHonoured = true\n } else if (\n code === 0x5d ||\n code === 0x50 ||\n code === 0x58 ||\n code === 0x5e ||\n code === 0x5f\n ) {\n state = 'string'\n } else if (code >= 0x20 && code <= 0x2f) state = 'esc-intermediate'\n else if (code >= 0x30 && code <= 0x7e) state = 'text'\n else if (code === 0x1b) state = 'esc'\n else {\n state = 'text'\n i -= 1\n }\n break\n }\n case 'esc-intermediate': {\n if (code >= 0x20 && code <= 0x2f) break\n if (code >= 0x30 && code <= 0x7e) state = 'text'\n else {\n state = 'text'\n i -= 1\n }\n break\n }\n case 'csi': {\n if (code >= 0x20 && code <= 0x3f) {\n if (csi.length < CSI_MAX) csi += chunk[i]\n else csiOverflow = true\n } else if (code >= 0x40 && code <= 0x7e) {\n runCsi(chunk[i]!)\n state = 'text'\n } else if (code === 0x1b) state = 'esc'\n else {\n // A control character or non-ASCII byte cannot be part of a CSI: the\n // sequence was malformed. Drop it and read this character normally.\n state = 'text'\n i -= 1\n }\n break\n }\n case 'string': {\n if (code === 0x07 || code === 0x9c) state = 'text'\n else if (code === 0x1b) state = 'string-esc'\n else if (code === 0x0a || code === 0x0d) {\n // No real title or clipboard payload spans a line. Ending here bounds\n // what an unterminated string can swallow to the rest of its line.\n state = 'text'\n i -= 1\n }\n break\n }\n case 'string-esc': {\n if (code === 0x5c) state = 'text'\n else {\n state = 'esc'\n i -= 1\n }\n break\n }\n }\n }\n }\n\n return {\n write,\n lines,\n openLine: () => (line.isEmpty() ? undefined : line.snapshot()),\n get droppedLines() {\n return droppedLines\n },\n }\n}\n\n/** Parse a whole output at once: finished lines plus the open one, if any. */\nexport function parseAnsi(text: string, options?: AnsiParserOptions): AnsiLine[] {\n const parser = createAnsiParser(options)\n parser.write(text)\n const open = parser.openLine()\n return open ? [...parser.lines, open] : [...parser.lines]\n}\n\n/** A line's text with styling removed, for tests and for accessible names. */\nexport function ansiLineText(line: AnsiLine): string {\n return line.segments.map((segment) => segment.text).join('')\n}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, isPlainStyle, nearestAnsiColor, parseAnsi, resolveColors, type AnsiColor, type AnsiLine, type AnsiParser, type AnsiParserOptions, type AnsiSegment, type AnsiStyle, type ResolvedColors, } from './ansi';
|
|
3
|
+
export { isFailedExit, terminalStatusLabel, type TerminalStatus } from './terminal-model';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/composites/terminal/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAA;AAC7E,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,EAChB,SAAS,EACT,aAAa,EACb,KAAK,SAAS,EACd,KAAK,QAAQ,EACb,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,cAAc,GACpB,MAAM,QAAQ,CAAA;AACf,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ANSI_MAX_LINE_LENGTH, ANSI_RETAIN_LINES, ansi256ToColor, ansiLineText, createAnsiParser, isPlainStyle, nearestAnsiColor, parseAnsi, resolveColors } from "./ansi.js";
|
|
2
|
+
import { isFailedExit, terminalStatusLabel } from "./terminal-model.js";
|
|
3
|
+
import { TERMINAL_MAX_LINES, Terminal } from "./terminal.js";
|
|
4
|
+
export { ANSI_MAX_LINE_LENGTH, ANSI_RETAIN_LINES, TERMINAL_MAX_LINES, Terminal, ansi256ToColor, ansiLineText, createAnsiParser, isFailedExit, isPlainStyle, nearestAnsiColor, parseAnsi, resolveColors, terminalStatusLabel };
|