@tylertech/forge-ai 0.15.3-dev.0 → 0.16.0-dev.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/MIGRATION.md +192 -0
- package/README.md +76 -2
- package/custom-elements.json +5156 -13880
- package/dist/_virtual/_@oxc-project_runtime@0.154.0/helpers/esm/decorate.mjs +9 -0
- package/dist/ai-agent-info/ai-agent-info.mjs +4 -78
- package/dist/ai-agent-info/ai-agent-info2.mjs +55 -0
- package/dist/ai-agent-info/index.d.ts +1 -1
- package/dist/ai-agent-info/index.mjs +1 -5
- package/dist/ai-agent-selector/ai-agent-selector.d.ts +2 -2
- package/dist/ai-agent-selector/ai-agent-selector.mjs +4 -439
- package/dist/ai-agent-selector/ai-agent-selector2.mjs +344 -0
- package/dist/ai-agent-selector/index.mjs +1 -5
- package/dist/ai-artifact/ai-artifact.mjs +4 -39
- package/dist/ai-artifact/ai-artifact2.mjs +31 -0
- package/dist/ai-artifact/index.d.ts +1 -1
- package/dist/ai-artifact/index.mjs +1 -5
- package/dist/ai-artifact-card/ai-artifact-card.mjs +4 -142
- package/dist/ai-artifact-card/ai-artifact-card2.mjs +103 -0
- package/dist/ai-artifact-card/index.d.ts +1 -1
- package/dist/ai-artifact-card/index.mjs +1 -5
- package/dist/ai-artifact-card-group/ai-artifact-card-group.mjs +4 -137
- package/dist/ai-artifact-card-group/ai-artifact-card-group2.mjs +100 -0
- package/dist/ai-artifact-card-group/index.d.ts +1 -1
- package/dist/ai-artifact-card-group/index.mjs +1 -5
- package/dist/ai-assistant-response/ai-assistant-response.d.ts +2 -3
- package/dist/ai-assistant-response/ai-assistant-response.mjs +4 -235
- package/dist/ai-assistant-response/ai-assistant-response2.mjs +137 -0
- package/dist/ai-assistant-response/index.d.ts +1 -1
- package/dist/ai-assistant-response/index.mjs +1 -5
- package/dist/ai-canvas/ai-canvas.d.ts +43 -0
- package/dist/ai-canvas/ai-canvas.mjs +4 -0
- package/dist/ai-canvas/ai-canvas2.mjs +74 -0
- package/dist/ai-canvas/index.d.ts +1 -0
- package/dist/ai-canvas/index.mjs +1 -0
- package/dist/ai-chain-of-thought/ai-chain-of-thought.mjs +4 -45
- package/dist/ai-chain-of-thought/ai-chain-of-thought2.mjs +35 -0
- package/dist/ai-chain-of-thought/index.d.ts +5 -5
- package/dist/ai-chain-of-thought/index.mjs +6 -17
- package/dist/ai-chain-of-thought/thought-base/index.mjs +1 -5
- package/dist/ai-chain-of-thought/thought-base/thought-base.mjs +4 -43
- package/dist/ai-chain-of-thought/thought-base/thought-base2.mjs +31 -0
- package/dist/ai-chain-of-thought/thought-detail/index.mjs +1 -5
- package/dist/ai-chain-of-thought/thought-detail/thought-detail.mjs +4 -34
- package/dist/ai-chain-of-thought/thought-detail/thought-detail2.mjs +26 -0
- package/dist/ai-chain-of-thought/thought-image/index.mjs +1 -5
- package/dist/ai-chain-of-thought/thought-image/thought-image.mjs +4 -43
- package/dist/ai-chain-of-thought/thought-image/thought-image2.mjs +30 -0
- package/dist/ai-chain-of-thought/thought-search-result/index.mjs +1 -5
- package/dist/ai-chain-of-thought/thought-search-result/thought-search-result.mjs +4 -62
- package/dist/ai-chain-of-thought/thought-search-result/thought-search-result2.mjs +45 -0
- package/dist/ai-chat-header/ai-chat-header.d.ts +7 -5
- package/dist/ai-chat-header/ai-chat-header.mjs +4 -439
- package/dist/ai-chat-header/ai-chat-header2.mjs +319 -0
- package/dist/ai-chat-header/index.d.ts +2 -2
- package/dist/ai-chat-header/index.mjs +1 -5
- package/dist/ai-chat-interface/ai-chat-interface.d.ts +1 -0
- package/dist/ai-chat-interface/ai-chat-interface.mjs +4 -103
- package/dist/ai-chat-interface/ai-chat-interface2.mjs +73 -0
- package/dist/ai-chat-interface/index.mjs +1 -5
- package/dist/ai-client-message/ai-client-message.d.ts +5 -6
- package/dist/ai-client-message/ai-client-message.mjs +4 -112
- package/dist/ai-client-message/ai-client-message2.mjs +76 -0
- package/dist/ai-client-message/index.mjs +1 -5
- package/dist/ai-context-chip/ai-context-chip.d.ts +1 -1
- package/dist/ai-context-chip/ai-context-chip.mjs +4 -169
- package/dist/ai-context-chip/ai-context-chip2.mjs +113 -0
- package/dist/ai-context-chip/index.mjs +1 -5
- package/dist/ai-context-items/ai-context-items.d.ts +11 -5
- package/dist/ai-context-items/ai-context-items.mjs +4 -78
- package/dist/ai-context-items/ai-context-items2.mjs +53 -0
- package/dist/ai-context-items/index.d.ts +1 -1
- package/dist/ai-context-items/index.mjs +1 -5
- package/dist/ai-conversations-panel/ai-conversations-panel.d.ts +2 -2
- package/dist/ai-conversations-panel/ai-conversations-panel.mjs +4 -632
- package/dist/ai-conversations-panel/ai-conversations-panel2.mjs +531 -0
- package/dist/ai-conversations-panel/index.mjs +1 -5
- package/dist/ai-copy-button/ai-copy-button.mjs +4 -116
- package/dist/ai-copy-button/ai-copy-button2.mjs +88 -0
- package/dist/ai-copy-button/index.mjs +1 -5
- package/dist/ai-dialog/ai-dialog.mjs +4 -304
- package/dist/ai-dialog/ai-dialog2.mjs +237 -0
- package/dist/ai-dialog/index.d.ts +1 -1
- package/dist/ai-dialog/index.mjs +1 -5
- package/dist/ai-disclaimer/ai-disclaimer.mjs +4 -70
- package/dist/ai-disclaimer/ai-disclaimer2.mjs +46 -0
- package/dist/ai-disclaimer/index.d.ts +1 -1
- package/dist/ai-disclaimer/index.mjs +1 -5
- package/dist/ai-dropdown-menu/ai-dropdown-menu-item-group.mjs +4 -80
- package/dist/ai-dropdown-menu/ai-dropdown-menu-item-group2.mjs +51 -0
- package/dist/ai-dropdown-menu/ai-dropdown-menu-item.d.ts +5 -1
- package/dist/ai-dropdown-menu/ai-dropdown-menu-item.mjs +4 -330
- package/dist/ai-dropdown-menu/ai-dropdown-menu-item2.mjs +280 -0
- package/dist/ai-dropdown-menu/ai-dropdown-menu-separator.mjs +4 -26
- package/dist/ai-dropdown-menu/ai-dropdown-menu-separator2.mjs +19 -0
- package/dist/ai-dropdown-menu/ai-dropdown-menu.d.ts +5 -0
- package/dist/ai-dropdown-menu/ai-dropdown-menu.mjs +4 -351
- package/dist/ai-dropdown-menu/ai-dropdown-menu2.mjs +268 -0
- package/dist/ai-dropdown-menu/index.d.ts +1 -0
- package/dist/ai-dropdown-menu/index.mjs +5 -10
- package/dist/ai-dropdown-menu/navigation-controller.d.ts +9 -1
- package/dist/ai-dropdown-menu/navigation-controller.mjs +214 -204
- package/dist/ai-dropdown-menu/selection-manager.mjs +202 -182
- package/dist/ai-edit-thread/ai-edit-thread.d.ts +1 -1
- package/dist/ai-edit-thread/ai-edit-thread.mjs +4 -137
- package/dist/ai-edit-thread/ai-edit-thread2.mjs +96 -0
- package/dist/ai-edit-thread/index.d.ts +1 -1
- package/dist/ai-edit-thread/index.mjs +1 -5
- package/dist/ai-empty-state/ai-empty-state.mjs +4 -38
- package/dist/ai-empty-state/ai-empty-state2.mjs +28 -0
- package/dist/ai-empty-state/index.d.ts +1 -1
- package/dist/ai-empty-state/index.mjs +1 -5
- package/dist/ai-error-message/ai-error-message.mjs +4 -80
- package/dist/ai-error-message/ai-error-message2.mjs +62 -0
- package/dist/ai-error-message/index.mjs +1 -5
- package/dist/ai-fab/ai-fab.mjs +4 -81
- package/dist/ai-fab/ai-fab2.mjs +54 -0
- package/dist/ai-fab/index.d.ts +1 -1
- package/dist/ai-fab/index.mjs +1 -5
- package/dist/ai-file-picker/ai-file-picker.d.ts +1 -0
- package/dist/ai-file-picker/ai-file-picker.mjs +4 -224
- package/dist/ai-file-picker/ai-file-picker2.mjs +172 -0
- package/dist/ai-file-picker/index.mjs +1 -4
- package/dist/ai-gradient-container/ai-gradient-container.mjs +4 -61
- package/dist/ai-gradient-container/ai-gradient-container2.mjs +38 -0
- package/dist/ai-gradient-container/index.d.ts +1 -1
- package/dist/ai-gradient-container/index.mjs +1 -5
- package/dist/ai-icon/ai-icon.d.ts +3 -0
- package/dist/ai-icon/ai-icon.mjs +4 -71
- package/dist/ai-icon/ai-icon2.mjs +41 -0
- package/dist/ai-icon/index.d.ts +1 -1
- package/dist/ai-icon/index.mjs +1 -5
- package/dist/ai-message-thread/ai-message-thread.d.ts +5 -4
- package/dist/ai-message-thread/ai-message-thread.mjs +4 -359
- package/dist/ai-message-thread/ai-message-thread2.mjs +279 -0
- package/dist/ai-message-thread/index.mjs +1 -5
- package/dist/ai-modal/ai-modal.mjs +4 -178
- package/dist/ai-modal/ai-modal2.mjs +141 -0
- package/dist/ai-modal/index.mjs +1 -4
- package/dist/ai-prompt/ai-prompt.d.ts +10 -6
- package/dist/ai-prompt/ai-prompt.mjs +4 -534
- package/dist/ai-prompt/ai-prompt2.mjs +438 -0
- package/dist/ai-prompt/index.mjs +1 -5
- package/dist/ai-reasoning/ai-reasoning.mjs +4 -44
- package/dist/ai-reasoning/ai-reasoning2.mjs +35 -0
- package/dist/ai-reasoning/index.d.ts +2 -2
- package/dist/ai-reasoning/index.mjs +4 -8
- package/dist/ai-reasoning/reasoning-content/index.d.ts +1 -1
- package/dist/ai-reasoning/reasoning-content/index.mjs +1 -5
- package/dist/ai-reasoning/reasoning-content/reasoning-content.mjs +4 -90
- package/dist/ai-reasoning/reasoning-content/reasoning-content2.mjs +68 -0
- package/dist/ai-reasoning-header/ai-reasoning-header.d.ts +7 -1
- package/dist/ai-reasoning-header/ai-reasoning-header.mjs +4 -68
- package/dist/ai-reasoning-header/ai-reasoning-header2.mjs +51 -0
- package/dist/ai-reasoning-header/index.d.ts +1 -1
- package/dist/ai-reasoning-header/index.mjs +1 -5
- package/dist/ai-response-message/ai-response-message.mjs +4 -25
- package/dist/ai-response-message/ai-response-message2.mjs +17 -0
- package/dist/ai-response-message/index.mjs +1 -5
- package/dist/ai-response-message-toolbar/ai-response-message-toolbar.d.ts +1 -1
- package/dist/ai-response-message-toolbar/ai-response-message-toolbar.mjs +4 -230
- package/dist/ai-response-message-toolbar/ai-response-message-toolbar2.mjs +171 -0
- package/dist/ai-response-message-toolbar/index.mjs +1 -5
- package/dist/ai-sidebar/ai-sidebar.d.ts +4 -4
- package/dist/ai-sidebar/ai-sidebar.mjs +4 -256
- package/dist/ai-sidebar/ai-sidebar2.mjs +211 -0
- package/dist/ai-sidebar/index.d.ts +2 -2
- package/dist/ai-sidebar/index.mjs +1 -5
- package/dist/ai-slash-command-menu/ai-slash-command-menu.d.ts +1 -1
- package/dist/ai-slash-command-menu/ai-slash-command-menu.mjs +4 -200
- package/dist/ai-slash-command-menu/ai-slash-command-menu2.mjs +156 -0
- package/dist/ai-slash-command-menu/index.mjs +1 -5
- package/dist/ai-spinner/ai-spinner.mjs +4 -41
- package/dist/ai-spinner/ai-spinner2.mjs +29 -0
- package/dist/ai-spinner/index.d.ts +1 -1
- package/dist/ai-spinner/index.mjs +1 -5
- package/dist/ai-steps/ai-steps.mjs +4 -163
- package/dist/ai-steps/ai-steps2.mjs +133 -0
- package/dist/ai-steps/index.d.ts +1 -1
- package/dist/ai-steps/index.mjs +1 -5
- package/dist/ai-suggestions/ai-suggestions.d.ts +2 -5
- package/dist/ai-suggestions/ai-suggestions.mjs +4 -164
- package/dist/ai-suggestions/ai-suggestions2.mjs +125 -0
- package/dist/ai-suggestions/index.d.ts +2 -1
- package/dist/ai-suggestions/index.mjs +1 -5
- package/dist/ai-thinking-indicator/ai-thinking-indicator.d.ts +2 -1
- package/dist/ai-thinking-indicator/ai-thinking-indicator.mjs +4 -160
- package/dist/ai-thinking-indicator/ai-thinking-indicator2.mjs +143 -0
- package/dist/ai-thinking-indicator/index.d.ts +1 -1
- package/dist/ai-thinking-indicator/index.mjs +1 -5
- package/dist/ai-thread-actions-menu/ai-thread-actions-menu.d.ts +2 -2
- package/dist/ai-thread-actions-menu/ai-thread-actions-menu.mjs +4 -152
- package/dist/ai-thread-actions-menu/ai-thread-actions-menu2.mjs +109 -0
- package/dist/ai-thread-actions-menu/index.d.ts +1 -1
- package/dist/ai-thread-actions-menu/index.mjs +1 -5
- package/dist/ai-threads-search/ai-threads-search.d.ts +3 -4
- package/dist/ai-threads-search/ai-threads-search.mjs +4 -602
- package/dist/ai-threads-search/ai-threads-search2.mjs +495 -0
- package/dist/ai-threads-search/index.d.ts +1 -1
- package/dist/ai-threads-search/index.mjs +1 -5
- package/dist/ai-tool-call/ai-tool-call.d.ts +21 -0
- package/dist/ai-tool-call/ai-tool-call.mjs +4 -0
- package/dist/ai-tool-call/ai-tool-call2.mjs +132 -0
- package/dist/ai-tool-call/create-tool-renderer.d.ts +9 -0
- package/dist/ai-tool-call/create-tool-renderer.mjs +10 -0
- package/dist/ai-tool-call/index.d.ts +6 -0
- package/dist/ai-tool-call/index.mjs +5 -0
- package/dist/ai-tool-call/tool-canvas.d.ts +60 -0
- package/dist/ai-tool-call/tool-canvas.mjs +135 -0
- package/dist/ai-tool-call/utils.d.ts +12 -0
- package/dist/ai-tool-call/utils.mjs +20 -0
- package/dist/ai-tool-call-indicator/ai-tool-call-indicator.d.ts +2 -2
- package/dist/ai-tool-call-indicator/ai-tool-call-indicator.mjs +4 -331
- package/dist/ai-tool-call-indicator/ai-tool-call-indicator2.mjs +225 -0
- package/dist/ai-tool-call-indicator/index.mjs +1 -5
- package/dist/ai-user-message/ai-user-message.mjs +4 -151
- package/dist/ai-user-message/ai-user-message2.mjs +105 -0
- package/dist/ai-user-message/index.mjs +1 -5
- package/dist/ai-user-message-toolbar/ai-user-message-toolbar.mjs +4 -160
- package/dist/ai-user-message-toolbar/ai-user-message-toolbar2.mjs +102 -0
- package/dist/ai-user-message-toolbar/index.mjs +1 -5
- package/dist/ai-voice-input/ai-voice-input.d.ts +1 -1
- package/dist/ai-voice-input/ai-voice-input.mjs +4 -113
- package/dist/ai-voice-input/ai-voice-input2.mjs +92 -0
- package/dist/ai-voice-input/index.d.ts +1 -1
- package/dist/ai-voice-input/index.mjs +1 -5
- package/dist/core/drag-controller.mjs +196 -221
- package/dist/core/index.d.ts +4 -2
- package/dist/core/index.mjs +7 -6
- package/dist/core/overlay/index.mjs +1 -4
- package/dist/core/overlay/overlay.d.ts +1 -1
- package/dist/core/overlay/overlay.mjs +4 -180
- package/dist/core/overlay/overlay2.mjs +146 -0
- package/dist/core/popover/index.mjs +1 -4
- package/dist/core/popover/popover.mjs +4 -98
- package/dist/core/popover/popover2.mjs +71 -0
- package/dist/core/resize-controller.d.ts +5 -0
- package/dist/core/resize-controller.mjs +132 -152
- package/dist/core/tooltip/index.mjs +1 -4
- package/dist/core/tooltip/tooltip.mjs +4 -279
- package/dist/core/tooltip/tooltip2.mjs +213 -0
- package/dist/index.d.ts +45 -52
- package/dist/index.mjs +100 -208
- package/dist/jsx.d.ts +895 -0
- package/dist/tools/ai-data-table/ai-data-table.d.ts +1 -2
- package/dist/tools/ai-data-table/ai-data-table.mjs +4 -257
- package/dist/tools/ai-data-table/ai-data-table2.mjs +185 -0
- package/dist/tools/ai-data-table/index.d.ts +0 -1
- package/dist/tools/ai-data-table/index.mjs +1 -6
- package/dist/tools/ai-paginator/ai-paginator.d.ts +14 -0
- package/dist/tools/ai-paginator/ai-paginator.mjs +4 -115
- package/dist/tools/ai-paginator/ai-paginator2.mjs +90 -0
- package/dist/tools/ai-paginator/index.mjs +1 -4
- package/dist/tools/ai-steps/ai-steps.d.ts +2 -3
- package/dist/tools/ai-steps/ai-steps.mjs +4 -49
- package/dist/tools/ai-steps/ai-steps2.mjs +30 -0
- package/dist/tools/ai-steps/index.d.ts +0 -1
- package/dist/tools/ai-steps/index.mjs +1 -6
- package/dist/tools/index.d.ts +3 -3
- package/dist/tools/index.mjs +7 -12
- package/dist/types/chat.d.ts +102 -0
- package/dist/types/feature.d.ts +1 -0
- package/dist/types/file.d.ts +36 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.mjs +0 -0
- package/dist/types/thread.d.ts +14 -0
- package/dist/types/tool.d.ts +197 -0
- package/dist/utils/csv-utils.mjs +37 -57
- package/dist/utils/delete-thread-controller.d.ts +1 -1
- package/dist/utils/delete-thread-controller.mjs +48 -71
- package/dist/utils/dom.d.ts +14 -0
- package/dist/utils/dom.mjs +30 -0
- package/dist/utils/format.d.ts +9 -0
- package/dist/utils/format.mjs +27 -0
- package/dist/utils/index.d.ts +9 -6
- package/dist/utils/index.mjs +6 -16
- package/dist/utils/infinite-scroll-controller.mjs +88 -94
- package/dist/utils/keyboard-navigation-controller.mjs +62 -70
- package/dist/utils/markdown-stream-controller.mjs +48 -0
- package/dist/utils/markdown.d.ts +10 -1
- package/dist/utils/markdown.mjs +261 -40
- package/dist/utils/storage-utils.mjs +30 -24
- package/package.json +39 -103
- package/dist/ai-agent-info/ai-agent-info.scss.mjs +0 -4
- package/dist/ai-agent-selector/ai-agent-selector.scss.mjs +0 -4
- package/dist/ai-artifact/ai-artifact.scss.mjs +0 -4
- package/dist/ai-artifact-card/ai-artifact-card.scss.mjs +0 -283
- package/dist/ai-artifact-card-group/ai-artifact-card-group.scss.mjs +0 -173
- package/dist/ai-assistant-response/ai-assistant-response.scss.mjs +0 -4
- package/dist/ai-attachment/ai-attachment.d.ts +0 -39
- package/dist/ai-attachment/ai-attachment.mjs +0 -130
- package/dist/ai-attachment/ai-attachment.scss.mjs +0 -4
- package/dist/ai-attachment/index.d.ts +0 -1
- package/dist/ai-attachment/index.mjs +0 -5
- package/dist/ai-button/ai-button.d.ts +0 -21
- package/dist/ai-button/ai-button.mjs +0 -68
- package/dist/ai-button/ai-button.scss.mjs +0 -4
- package/dist/ai-button/index.d.ts +0 -1
- package/dist/ai-button/index.mjs +0 -5
- package/dist/ai-chain-of-thought/ai-chain-of-thought.scss.mjs +0 -4
- package/dist/ai-chain-of-thought/thought-base/thought-base.scss.mjs +0 -4
- package/dist/ai-chain-of-thought/thought-detail/thought-detail.scss.mjs +0 -4
- package/dist/ai-chain-of-thought/thought-image/thought-image.scss.mjs +0 -4
- package/dist/ai-chain-of-thought/thought-search-result/thought-search-result.scss.mjs +0 -4
- package/dist/ai-chat-header/ai-chat-header.scss.mjs +0 -4
- package/dist/ai-chat-interface/ai-chat-interface.scss.mjs +0 -4
- package/dist/ai-chatbot/ag-ui-adapter.d.ts +0 -24
- package/dist/ai-chatbot/ag-ui-adapter.mjs +0 -388
- package/dist/ai-chatbot/agent-adapter.d.ts +0 -310
- package/dist/ai-chatbot/agent-adapter.mjs +0 -221
- package/dist/ai-chatbot/agent-runner.d.ts +0 -41
- package/dist/ai-chatbot/agent-runner.mjs +0 -265
- package/dist/ai-chatbot/ai-chatbot-base.d.ts +0 -178
- package/dist/ai-chatbot/ai-chatbot-base.mjs +0 -673
- package/dist/ai-chatbot/ai-chatbot-tool-call.d.ts +0 -19
- package/dist/ai-chatbot/ai-chatbot-tool-call.mjs +0 -104
- package/dist/ai-chatbot/ai-chatbot-tool-call.scss.mjs +0 -4
- package/dist/ai-chatbot/ai-chatbot.d.ts +0 -173
- package/dist/ai-chatbot/ai-chatbot.mjs +0 -402
- package/dist/ai-chatbot/ai-chatbot.scss.mjs +0 -4
- package/dist/ai-chatbot/create-tool-renderer.d.ts +0 -9
- package/dist/ai-chatbot/create-tool-renderer.mjs +0 -16
- package/dist/ai-chatbot/event-emitter.d.ts +0 -43
- package/dist/ai-chatbot/event-emitter.mjs +0 -81
- package/dist/ai-chatbot/file-upload-manager.d.ts +0 -27
- package/dist/ai-chatbot/file-upload-manager.mjs +0 -106
- package/dist/ai-chatbot/http-agent-with-credentials.d.ts +0 -8
- package/dist/ai-chatbot/http-agent-with-credentials.mjs +0 -14
- package/dist/ai-chatbot/index.d.ts +0 -17
- package/dist/ai-chatbot/index.mjs +0 -37
- package/dist/ai-chatbot/markdown-stream-controller.mjs +0 -50
- package/dist/ai-chatbot/message-state-controller.d.ts +0 -72
- package/dist/ai-chatbot/message-state-controller.mjs +0 -392
- package/dist/ai-chatbot/request-serialization.d.ts +0 -33
- package/dist/ai-chatbot/request-serialization.mjs +0 -31
- package/dist/ai-chatbot/types.d.ts +0 -470
- package/dist/ai-chatbot/utils.d.ts +0 -44
- package/dist/ai-chatbot/utils.mjs +0 -110
- package/dist/ai-chatbot-launcher/ai-chatbot-launcher.d.ts +0 -152
- package/dist/ai-chatbot-launcher/ai-chatbot-launcher.mjs +0 -767
- package/dist/ai-chatbot-launcher/ai-chatbot-launcher.scss.mjs +0 -4
- package/dist/ai-chatbot-launcher/index.d.ts +0 -1
- package/dist/ai-chatbot-launcher/index.mjs +0 -5
- package/dist/ai-client-message/ai-client-message.scss.mjs +0 -4
- package/dist/ai-confirmation-prompt/ai-confirmation-prompt.d.ts +0 -34
- package/dist/ai-confirmation-prompt/ai-confirmation-prompt.mjs +0 -134
- package/dist/ai-confirmation-prompt/ai-confirmation-prompt.scss.mjs +0 -4
- package/dist/ai-confirmation-prompt/index.d.ts +0 -1
- package/dist/ai-confirmation-prompt/index.mjs +0 -5
- package/dist/ai-context-chip/ai-context-chip.scss.mjs +0 -4
- package/dist/ai-context-items/ai-context-items.scss.mjs +0 -4
- package/dist/ai-conversations-panel/ai-conversations-panel.scss.mjs +0 -4
- package/dist/ai-copy-button/ai-copy-button.scss.mjs +0 -4
- package/dist/ai-dialog/ai-dialog.scss.mjs +0 -4
- package/dist/ai-disclaimer/ai-disclaimer.scss.mjs +0 -4
- package/dist/ai-dropdown-menu/ai-dropdown-menu-item-group.scss.mjs +0 -4
- package/dist/ai-dropdown-menu/ai-dropdown-menu-item.scss.mjs +0 -4
- package/dist/ai-dropdown-menu/ai-dropdown-menu-separator.scss.mjs +0 -4
- package/dist/ai-dropdown-menu/ai-dropdown-menu.scss.mjs +0 -4
- package/dist/ai-edit-thread/ai-edit-thread.scss.mjs +0 -4
- package/dist/ai-embedded-chat/ai-embedded-chat.d.ts +0 -64
- package/dist/ai-embedded-chat/ai-embedded-chat.mjs +0 -172
- package/dist/ai-embedded-chat/ai-embedded-chat.scss.mjs +0 -4
- package/dist/ai-embedded-chat/index.d.ts +0 -1
- package/dist/ai-embedded-chat/index.mjs +0 -5
- package/dist/ai-empty-state/ai-empty-state.scss.mjs +0 -4
- package/dist/ai-error-message/ai-error-message.scss.mjs +0 -4
- package/dist/ai-fab/ai-fab.scss.mjs +0 -4
- package/dist/ai-file-picker/ai-file-picker.scss.mjs +0 -4
- package/dist/ai-floating-chat/ai-floating-chat.d.ts +0 -53
- package/dist/ai-floating-chat/ai-floating-chat.mjs +0 -147
- package/dist/ai-floating-chat/ai-floating-chat.scss.mjs +0 -4
- package/dist/ai-floating-chat/index.d.ts +0 -1
- package/dist/ai-floating-chat/index.mjs +0 -5
- package/dist/ai-gradient-container/ai-gradient-container.scss.mjs +0 -4
- package/dist/ai-icon/ai-icon.scss.mjs +0 -4
- package/dist/ai-icon-button/ai-icon-button.d.ts +0 -19
- package/dist/ai-icon-button/ai-icon-button.mjs +0 -66
- package/dist/ai-icon-button/ai-icon-button.scss.mjs +0 -4
- package/dist/ai-icon-button/index.d.ts +0 -1
- package/dist/ai-icon-button/index.mjs +0 -5
- package/dist/ai-message-thread/ai-message-thread.scss.mjs +0 -4
- package/dist/ai-modal/ai-modal.scss.mjs +0 -4
- package/dist/ai-prompt/ai-prompt.scss.mjs +0 -4
- package/dist/ai-prompt/prompt-button/index.d.ts +0 -1
- package/dist/ai-prompt/prompt-button/index.mjs +0 -5
- package/dist/ai-prompt/prompt-button/prompt-button.d.ts +0 -16
- package/dist/ai-prompt/prompt-button/prompt-button.mjs +0 -40
- package/dist/ai-prompt/prompt-button/prompt-button.scss.mjs +0 -4
- package/dist/ai-reasoning/ai-reasoning.scss.mjs +0 -4
- package/dist/ai-reasoning/reasoning-content/reasoning-content.scss.mjs +0 -4
- package/dist/ai-reasoning-header/ai-reasoning-header.scss.mjs +0 -4
- package/dist/ai-response-message/ai-response-message.scss.mjs +0 -4
- package/dist/ai-response-message-toolbar/ai-response-message-toolbar.scss.mjs +0 -4
- package/dist/ai-sidebar/ai-sidebar.scss.mjs +0 -4
- package/dist/ai-sidebar-chat/ai-sidebar-chat.d.ts +0 -54
- package/dist/ai-sidebar-chat/ai-sidebar-chat.mjs +0 -163
- package/dist/ai-sidebar-chat/ai-sidebar-chat.scss.mjs +0 -4
- package/dist/ai-sidebar-chat/index.d.ts +0 -1
- package/dist/ai-sidebar-chat/index.mjs +0 -5
- package/dist/ai-slash-command-menu/ai-slash-command-menu.scss.mjs +0 -4
- package/dist/ai-spinner/ai-spinner.scss.mjs +0 -4
- package/dist/ai-steps/ai-steps.scss.mjs +0 -4
- package/dist/ai-suggestions/ai-suggestions.scss.mjs +0 -500
- package/dist/ai-thinking-indicator/ai-thinking-indicator.scss.mjs +0 -143
- package/dist/ai-thread-actions-menu/ai-thread-actions-menu.scss.mjs +0 -4
- package/dist/ai-threads/ai-threads.d.ts +0 -82
- package/dist/ai-threads/ai-threads.mjs +0 -343
- package/dist/ai-threads/ai-threads.scss.mjs +0 -4
- package/dist/ai-threads/index.d.ts +0 -1
- package/dist/ai-threads/index.mjs +0 -5
- package/dist/ai-threads-search/ai-threads-search.scss.mjs +0 -4
- package/dist/ai-tool-call-indicator/ai-tool-call-indicator.scss.mjs +0 -4
- package/dist/ai-user-message/ai-user-message.scss.mjs +0 -4
- package/dist/ai-user-message-toolbar/ai-user-message-toolbar.scss.mjs +0 -4
- package/dist/ai-voice-input/ai-voice-input.scss.mjs +0 -4
- package/dist/core/chatbot-core-controller.d.ts +0 -57
- package/dist/core/chatbot-core-controller.mjs +0 -523
- package/dist/core/overlay/overlay.scss.mjs +0 -4
- package/dist/core/popover/popover.scss.mjs +0 -4
- package/dist/core/tooltip/tooltip.scss.mjs +0 -4
- package/dist/tools/ai-data-table/ai-data-table-definition.d.ts +0 -2
- package/dist/tools/ai-data-table/ai-data-table-definition.mjs +0 -42
- package/dist/tools/ai-data-table/ai-data-table.scss.mjs +0 -4
- package/dist/tools/ai-mcp-app/ai-mcp-app.d.ts +0 -69
- package/dist/tools/ai-mcp-app/ai-mcp-app.mjs +0 -574
- package/dist/tools/ai-mcp-app/ai-mcp-app.scss.mjs +0 -4
- package/dist/tools/ai-mcp-app/index.d.ts +0 -3
- package/dist/tools/ai-mcp-app/index.mjs +0 -6
- package/dist/tools/ai-mcp-app/mcp-app-bridge-controller.d.ts +0 -61
- package/dist/tools/ai-mcp-app/mcp-app-bridge-controller.mjs +0 -156
- package/dist/tools/ai-mcp-app/mcp-app-bridge-types.d.ts +0 -123
- package/dist/tools/ai-mcp-app/mcp-app-bridge.d.ts +0 -41
- package/dist/tools/ai-mcp-app/mcp-app-bridge.mjs +0 -293
- package/dist/tools/ai-mcp-app/mcp-app-context.d.ts +0 -46
- package/dist/tools/ai-mcp-app/mcp-app-context.mjs +0 -5
- package/dist/tools/ai-paginator/ai-paginator.scss.mjs +0 -4
- package/dist/tools/ai-steps/ai-steps-definition.d.ts +0 -2
- package/dist/tools/ai-steps/ai-steps-definition.mjs +0 -50
- package/dist/tools/ai-steps/ai-steps.scss.mjs +0 -4
- package/dist/utils/inert-outside.d.ts +0 -7
- package/dist/utils/inert-outside.mjs +0 -28
- package/dist/utils.d.ts +0 -32
- package/dist/utils.mjs +0 -57
- /package/dist/{ai-chatbot → utils}/markdown-stream-controller.d.ts +0 -0
|
@@ -1,392 +0,0 @@
|
|
|
1
|
-
import { generateId } from "./utils.mjs";
|
|
2
|
-
function withoutUiResource(toolCall) {
|
|
3
|
-
if (!toolCall.uiResource) {
|
|
4
|
-
return toolCall;
|
|
5
|
-
}
|
|
6
|
-
const { uiResource: _uiResource, ...rest } = toolCall;
|
|
7
|
-
return rest;
|
|
8
|
-
}
|
|
9
|
-
function responseItemWithoutUiResource(item) {
|
|
10
|
-
return item.type === "toolCall" ? { type: "toolCall", data: withoutUiResource(item.data) } : item;
|
|
11
|
-
}
|
|
12
|
-
class MessageStateController {
|
|
13
|
-
constructor(_host, _config) {
|
|
14
|
-
this._host = _host;
|
|
15
|
-
this._config = _config;
|
|
16
|
-
this._messageItems = [];
|
|
17
|
-
this._toolCalls = /* @__PURE__ */ new Map();
|
|
18
|
-
this._activeResponse = null;
|
|
19
|
-
_host.addController(this);
|
|
20
|
-
}
|
|
21
|
-
hostConnected() {
|
|
22
|
-
}
|
|
23
|
-
hostDisconnected() {
|
|
24
|
-
this._messageItems = [];
|
|
25
|
-
this._toolCalls.clear();
|
|
26
|
-
this._activeResponse = null;
|
|
27
|
-
}
|
|
28
|
-
updateConfig(config) {
|
|
29
|
-
this._config = { ...this._config, ...config };
|
|
30
|
-
}
|
|
31
|
-
get messageItems() {
|
|
32
|
-
return this._messageItems;
|
|
33
|
-
}
|
|
34
|
-
getToolCall(id) {
|
|
35
|
-
return this._toolCalls.get(id);
|
|
36
|
-
}
|
|
37
|
-
getActiveResponse() {
|
|
38
|
-
return this._activeResponse;
|
|
39
|
-
}
|
|
40
|
-
startResponse() {
|
|
41
|
-
if (this._activeResponse) {
|
|
42
|
-
return this._activeResponse;
|
|
43
|
-
}
|
|
44
|
-
const response = {
|
|
45
|
-
id: generateId(),
|
|
46
|
-
children: [],
|
|
47
|
-
status: "streaming",
|
|
48
|
-
timestamp: Date.now()
|
|
49
|
-
};
|
|
50
|
-
this._activeResponse = response;
|
|
51
|
-
this._messageItems = [...this._messageItems, { type: "assistant", data: response }];
|
|
52
|
-
this.#notifyStateChange();
|
|
53
|
-
return response;
|
|
54
|
-
}
|
|
55
|
-
markResponseThinking() {
|
|
56
|
-
if (!this._activeResponse || this._activeResponse.isThinking) {
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
this._activeResponse.isThinking = true;
|
|
60
|
-
this.#updateResponseInItems();
|
|
61
|
-
this.#notifyStateChange();
|
|
62
|
-
}
|
|
63
|
-
clearResponseThinking() {
|
|
64
|
-
if (!this._activeResponse || !this._activeResponse.isThinking) {
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
this._activeResponse.isThinking = false;
|
|
68
|
-
this.#updateResponseInItems();
|
|
69
|
-
this.#notifyStateChange();
|
|
70
|
-
}
|
|
71
|
-
addTextToResponse(messageId, content) {
|
|
72
|
-
const response = this._activeResponse ?? this.startResponse();
|
|
73
|
-
response.isThinking = false;
|
|
74
|
-
const lastChild = response.children[response.children.length - 1];
|
|
75
|
-
if (lastChild?.type === "text" && lastChild.messageId === messageId) {
|
|
76
|
-
lastChild.content = content;
|
|
77
|
-
lastChild.status = "streaming";
|
|
78
|
-
} else {
|
|
79
|
-
response.children.push({ type: "text", messageId, content, status: "streaming" });
|
|
80
|
-
}
|
|
81
|
-
this.#updateResponseInItems();
|
|
82
|
-
this.#notifyStateChange();
|
|
83
|
-
}
|
|
84
|
-
appendTextDelta(messageId, delta) {
|
|
85
|
-
const response = this._activeResponse ?? this.startResponse();
|
|
86
|
-
response.isThinking = false;
|
|
87
|
-
const lastChild = response.children[response.children.length - 1];
|
|
88
|
-
if (lastChild?.type === "text" && lastChild.messageId === messageId) {
|
|
89
|
-
lastChild.content += delta;
|
|
90
|
-
} else {
|
|
91
|
-
response.children.push({ type: "text", messageId, content: delta, status: "streaming" });
|
|
92
|
-
}
|
|
93
|
-
this.#updateResponseInItems();
|
|
94
|
-
this.#notifyStateChange();
|
|
95
|
-
}
|
|
96
|
-
markTextComplete(messageId) {
|
|
97
|
-
if (!this._activeResponse) {
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
const textChild = [...this._activeResponse.children].reverse().find((c) => c.type === "text" && c.messageId === messageId);
|
|
101
|
-
if (textChild && textChild.type === "text") {
|
|
102
|
-
textChild.status = "complete";
|
|
103
|
-
}
|
|
104
|
-
this.#updateResponseInItems();
|
|
105
|
-
this.#notifyStateChange();
|
|
106
|
-
}
|
|
107
|
-
addToolCallToResponse(toolCall) {
|
|
108
|
-
const response = this._activeResponse ?? this.startResponse();
|
|
109
|
-
response.isThinking = false;
|
|
110
|
-
const toolCallWithTimestamp = { ...toolCall, startTimestamp: Date.now() };
|
|
111
|
-
this._toolCalls.set(toolCall.id, toolCallWithTimestamp);
|
|
112
|
-
response.children.push({ type: "toolCall", data: toolCallWithTimestamp });
|
|
113
|
-
this.#updateResponseInItems();
|
|
114
|
-
this.#notifyStateChange();
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Applies `updates` to a tool call wherever it is rendered: the in-progress response,
|
|
118
|
-
* an already finalized/restored response, or a top-level tool-call item.
|
|
119
|
-
*/
|
|
120
|
-
updateToolCallInResponse(toolCallId, updates) {
|
|
121
|
-
const toolCall = this._toolCalls.get(toolCallId);
|
|
122
|
-
if (!toolCall) {
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
const isFinishing = updates.status === "complete" || updates.status === "error" || updates.status === "cancelled";
|
|
126
|
-
const updated = {
|
|
127
|
-
...toolCall,
|
|
128
|
-
...updates,
|
|
129
|
-
...isFinishing && !toolCall.endTimestamp ? { endTimestamp: Date.now() } : {}
|
|
130
|
-
};
|
|
131
|
-
this._toolCalls.set(toolCallId, updated);
|
|
132
|
-
this.#replaceToolCall(updated);
|
|
133
|
-
this.#notifyStateChange();
|
|
134
|
-
}
|
|
135
|
-
completeToolCallInResponse(toolCallId, result, event) {
|
|
136
|
-
this.updateToolCallInResponse(toolCallId, {
|
|
137
|
-
result,
|
|
138
|
-
status: this.#resultStatus(event),
|
|
139
|
-
...event ? {
|
|
140
|
-
structuredContent: event.structuredContent,
|
|
141
|
-
structuredContentOmitted: event.structuredContentOmitted,
|
|
142
|
-
mcpResult: event.mcpResult,
|
|
143
|
-
mcpResultOmitted: event.mcpResultOmitted
|
|
144
|
-
} : {}
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
#resultStatus(event) {
|
|
148
|
-
if (event?.cancelled) {
|
|
149
|
-
return "cancelled";
|
|
150
|
-
}
|
|
151
|
-
return event?.isError ? "error" : "complete";
|
|
152
|
-
}
|
|
153
|
-
#replaceToolCall(updated) {
|
|
154
|
-
const matches = (child) => child.type === "toolCall" && child.data.id === updated.id;
|
|
155
|
-
const replace = (children) => children.map((child) => matches(child) ? { type: "toolCall", data: updated } : child);
|
|
156
|
-
const activeResponse = this._activeResponse;
|
|
157
|
-
if (activeResponse?.children.some(matches)) {
|
|
158
|
-
activeResponse.children = replace(activeResponse.children);
|
|
159
|
-
}
|
|
160
|
-
this._messageItems = this._messageItems.map((item) => {
|
|
161
|
-
if (item.type === "toolCall" && item.data.id === updated.id) {
|
|
162
|
-
return { type: "toolCall", data: updated };
|
|
163
|
-
}
|
|
164
|
-
if (item.type !== "assistant" || !item.data.children.some(matches)) {
|
|
165
|
-
return item;
|
|
166
|
-
}
|
|
167
|
-
if (item.data.id === activeResponse?.id) {
|
|
168
|
-
return { type: "assistant", data: { ...activeResponse } };
|
|
169
|
-
}
|
|
170
|
-
return { type: "assistant", data: { ...item.data, children: replace(item.data.children) } };
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
tryFinalizeResponse() {
|
|
174
|
-
if (!this._activeResponse) {
|
|
175
|
-
return;
|
|
176
|
-
}
|
|
177
|
-
this._activeResponse.status = "complete";
|
|
178
|
-
this.#updateResponseInItems();
|
|
179
|
-
this._activeResponse = null;
|
|
180
|
-
this.#notifyStateChange();
|
|
181
|
-
this._config.onThreadSettled?.();
|
|
182
|
-
}
|
|
183
|
-
#updateResponseInItems() {
|
|
184
|
-
const activeResponse = this._activeResponse;
|
|
185
|
-
if (!activeResponse) {
|
|
186
|
-
return;
|
|
187
|
-
}
|
|
188
|
-
this._messageItems = this._messageItems.map((item) => {
|
|
189
|
-
if (item.type === "assistant" && item.data.id === activeResponse.id) {
|
|
190
|
-
return { type: "assistant", data: { ...activeResponse } };
|
|
191
|
-
}
|
|
192
|
-
return item;
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
#notifyStateChange() {
|
|
196
|
-
this._host.requestUpdate();
|
|
197
|
-
}
|
|
198
|
-
addMessageItem(item) {
|
|
199
|
-
this._messageItems = [...this._messageItems, item];
|
|
200
|
-
this.#notifyStateChange();
|
|
201
|
-
}
|
|
202
|
-
addMessage(message) {
|
|
203
|
-
this.tryFinalizeResponse();
|
|
204
|
-
const existing = this.getMessage(message.id);
|
|
205
|
-
if (existing) {
|
|
206
|
-
return;
|
|
207
|
-
}
|
|
208
|
-
this.addMessageItem({ type: "message", data: message });
|
|
209
|
-
if (message.status === "complete" || message.status === "error") {
|
|
210
|
-
this._config.onThreadSettled?.();
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
getMessage(id) {
|
|
214
|
-
const item = this._messageItems.find((i) => i.type === "message" && i.data.id === id);
|
|
215
|
-
return item?.type === "message" ? item.data : void 0;
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
* Inserts or upserts a client-only message, never touching `_activeResponse`.
|
|
219
|
-
* Unlike {@link addMessage}, this never finalizes an in-progress response -
|
|
220
|
-
* safe to call while a real reply is streaming.
|
|
221
|
-
*/
|
|
222
|
-
addClientMessage(message) {
|
|
223
|
-
const id = message.id ?? generateId();
|
|
224
|
-
const chatMessage = {
|
|
225
|
-
id,
|
|
226
|
-
role: "system",
|
|
227
|
-
content: message.content,
|
|
228
|
-
timestamp: Date.now(),
|
|
229
|
-
status: "complete",
|
|
230
|
-
clientOnly: true,
|
|
231
|
-
kind: message.kind,
|
|
232
|
-
header: message.header,
|
|
233
|
-
actions: message.actions
|
|
234
|
-
};
|
|
235
|
-
this._messageItems = [
|
|
236
|
-
...this._messageItems.filter((item) => !(item.type === "message" && item.data.id === id)),
|
|
237
|
-
{ type: "message", data: chatMessage }
|
|
238
|
-
];
|
|
239
|
-
this.#notifyStateChange();
|
|
240
|
-
return id;
|
|
241
|
-
}
|
|
242
|
-
/** Removes a client message by id. No-ops if not found. Safe to call at any time. */
|
|
243
|
-
removeClientMessage(id) {
|
|
244
|
-
const hasMessage = this._messageItems.some((item) => item.type === "message" && item.data.id === id);
|
|
245
|
-
if (!hasMessage) {
|
|
246
|
-
return;
|
|
247
|
-
}
|
|
248
|
-
this._messageItems = this._messageItems.filter((item) => !(item.type === "message" && item.data.id === id));
|
|
249
|
-
this.#notifyStateChange();
|
|
250
|
-
}
|
|
251
|
-
updateMessageStatus(id, status) {
|
|
252
|
-
this._messageItems = this._messageItems.map((item) => {
|
|
253
|
-
if (item.type === "message" && item.data.id === id) {
|
|
254
|
-
return { ...item, data: { ...item.data, status } };
|
|
255
|
-
}
|
|
256
|
-
return item;
|
|
257
|
-
});
|
|
258
|
-
this.#notifyStateChange();
|
|
259
|
-
if (status === "complete" || status === "error") {
|
|
260
|
-
this._config.onThreadSettled?.();
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
updateMessageContent(id, content) {
|
|
264
|
-
this._messageItems = this._messageItems.map((item) => {
|
|
265
|
-
if (item.type === "message" && item.data.id === id) {
|
|
266
|
-
return { ...item, data: { ...item.data, content } };
|
|
267
|
-
}
|
|
268
|
-
return item;
|
|
269
|
-
});
|
|
270
|
-
this.#notifyStateChange();
|
|
271
|
-
}
|
|
272
|
-
removeMessageItem(index) {
|
|
273
|
-
this._messageItems = this._messageItems.filter((_, i) => i !== index);
|
|
274
|
-
this.#notifyStateChange();
|
|
275
|
-
}
|
|
276
|
-
clearMessages() {
|
|
277
|
-
this._messageItems = [];
|
|
278
|
-
this._toolCalls.clear();
|
|
279
|
-
this._activeResponse = null;
|
|
280
|
-
this.#notifyStateChange();
|
|
281
|
-
this._config.onThreadSettled?.();
|
|
282
|
-
}
|
|
283
|
-
/** Tool call ids rendered at or after `index`, inside assistant responses or as top-level items. */
|
|
284
|
-
getToolCallIdsFrom(index) {
|
|
285
|
-
return this._messageItems.slice(index).flatMap((item) => {
|
|
286
|
-
if (item.type === "toolCall") {
|
|
287
|
-
return [item.data.id];
|
|
288
|
-
}
|
|
289
|
-
if (item.type === "assistant") {
|
|
290
|
-
return item.data.children.flatMap((child) => child.type === "toolCall" ? [child.data.id] : []);
|
|
291
|
-
}
|
|
292
|
-
return [];
|
|
293
|
-
});
|
|
294
|
-
}
|
|
295
|
-
/** Removes items from `index` onward and returns the ids of the tool calls they held. */
|
|
296
|
-
removeMessageItemsFrom(index) {
|
|
297
|
-
const removedToolCallIds = this.getToolCallIdsFrom(index);
|
|
298
|
-
removedToolCallIds.forEach((id) => this._toolCalls.delete(id));
|
|
299
|
-
this._messageItems = this._messageItems.slice(0, index);
|
|
300
|
-
this._activeResponse = null;
|
|
301
|
-
this.#notifyStateChange();
|
|
302
|
-
return removedToolCallIds;
|
|
303
|
-
}
|
|
304
|
-
/**
|
|
305
|
-
* Reconstructs the message hierarchy for API compatibility.
|
|
306
|
-
* Converts assistant responses back to ChatMessage format with tool calls.
|
|
307
|
-
* MCP-app `uiResource`s are stripped: they are re-resolved via the adapter on restore,
|
|
308
|
-
* never persisted or sent back to the agent.
|
|
309
|
-
*/
|
|
310
|
-
getMessages() {
|
|
311
|
-
const messages = [];
|
|
312
|
-
for (const item of this._messageItems) {
|
|
313
|
-
if (item.type === "message") {
|
|
314
|
-
messages.push({ ...item.data, toolCalls: [] });
|
|
315
|
-
} else if (item.type === "assistant") {
|
|
316
|
-
const response = item.data;
|
|
317
|
-
const children = response.children.map(responseItemWithoutUiResource);
|
|
318
|
-
const textContent = children.filter((c) => c.type === "text").map((c) => c.content).join("");
|
|
319
|
-
const toolCalls = children.filter((c) => c.type === "toolCall").map((c) => c.data);
|
|
320
|
-
const message = {
|
|
321
|
-
id: response.id,
|
|
322
|
-
role: "assistant",
|
|
323
|
-
content: textContent,
|
|
324
|
-
timestamp: response.timestamp,
|
|
325
|
-
status: response.status === "streaming" ? "streaming" : response.status === "error" ? "error" : "complete",
|
|
326
|
-
toolCalls: toolCalls.length ? toolCalls : void 0,
|
|
327
|
-
feedback: response.feedback,
|
|
328
|
-
children
|
|
329
|
-
};
|
|
330
|
-
messages.push(message);
|
|
331
|
-
} else if (item.type === "toolCall") {
|
|
332
|
-
const lastMsg = messages[messages.length - 1];
|
|
333
|
-
if (lastMsg && lastMsg.role === "assistant") {
|
|
334
|
-
lastMsg.toolCalls = [...lastMsg.toolCalls || [], withoutUiResource(item.data)];
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
return messages;
|
|
339
|
-
}
|
|
340
|
-
setMessages(messages) {
|
|
341
|
-
const messageItems = [];
|
|
342
|
-
this._toolCalls.clear();
|
|
343
|
-
this._activeResponse = null;
|
|
344
|
-
for (const msg of messages) {
|
|
345
|
-
if (msg.role === "assistant" && msg.status !== "error") {
|
|
346
|
-
let children;
|
|
347
|
-
if (msg.children?.length) {
|
|
348
|
-
children = msg.children.map((child) => {
|
|
349
|
-
const restored = responseItemWithoutUiResource(child);
|
|
350
|
-
if (restored.type === "toolCall") {
|
|
351
|
-
this._toolCalls.set(restored.data.id, restored.data);
|
|
352
|
-
}
|
|
353
|
-
return restored;
|
|
354
|
-
});
|
|
355
|
-
} else {
|
|
356
|
-
children = [];
|
|
357
|
-
if (msg.content?.trim()) {
|
|
358
|
-
children.push({ type: "text", messageId: msg.id, content: msg.content, status: "complete" });
|
|
359
|
-
}
|
|
360
|
-
if (msg.toolCalls) {
|
|
361
|
-
for (const toolCall of msg.toolCalls.map(withoutUiResource)) {
|
|
362
|
-
children.push({ type: "toolCall", data: toolCall });
|
|
363
|
-
this._toolCalls.set(toolCall.id, toolCall);
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
const response = {
|
|
368
|
-
id: msg.id,
|
|
369
|
-
children,
|
|
370
|
-
status: msg.status === "streaming" ? "streaming" : "complete",
|
|
371
|
-
timestamp: msg.timestamp,
|
|
372
|
-
feedback: msg.feedback
|
|
373
|
-
};
|
|
374
|
-
messageItems.push({ type: "assistant", data: response });
|
|
375
|
-
} else {
|
|
376
|
-
messageItems.push({ type: "message", data: { ...msg, toolCalls: void 0 } });
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
this._messageItems = messageItems;
|
|
380
|
-
this.#notifyStateChange();
|
|
381
|
-
}
|
|
382
|
-
setResponseFeedback(responseId, feedback) {
|
|
383
|
-
const item = this._messageItems.find((i) => i.type === "assistant" && i.data.id === responseId);
|
|
384
|
-
if (item?.type === "assistant") {
|
|
385
|
-
item.data.feedback = feedback;
|
|
386
|
-
this.#notifyStateChange();
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
export {
|
|
391
|
-
MessageStateController
|
|
392
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { ChatMessage, ToolCall } from './types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Wire shape for a tool call sent back to an agent endpoint: the final `args`
|
|
4
|
-
* and its `result`, and nothing else. Local-only fields (`eventStream`,
|
|
5
|
-
* `argsBuffer`, `children`, timing metadata) are deliberately absent - no
|
|
6
|
-
* backend reads them and they grow without bound across turns.
|
|
7
|
-
*/
|
|
8
|
-
export interface RequestToolCall {
|
|
9
|
-
id: string;
|
|
10
|
-
name: string;
|
|
11
|
-
args: Record<string, unknown>;
|
|
12
|
-
status: ToolCall['status'];
|
|
13
|
-
result?: unknown;
|
|
14
|
-
}
|
|
15
|
-
/** Wire shape for a single message sent to an agent endpoint. */
|
|
16
|
-
export interface RequestMessage {
|
|
17
|
-
role: ChatMessage['role'];
|
|
18
|
-
content: string;
|
|
19
|
-
toolCallId?: string;
|
|
20
|
-
toolCalls?: RequestToolCall[];
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Projects a tool call onto its wire shape. This is the single boundary at which
|
|
24
|
-
* local state is dropped, so adapters never have to remember to omit it.
|
|
25
|
-
*/
|
|
26
|
-
export declare function toRequestToolCall(toolCall: ToolCall): RequestToolCall;
|
|
27
|
-
/**
|
|
28
|
-
* Projects the thread onto the messages an agent endpoint is sent: client-only
|
|
29
|
-
* messages and empty assistant turns are dropped, and every remaining message is
|
|
30
|
-
* rebuilt field by field rather than spread, so no local state can leak into a
|
|
31
|
-
* request body.
|
|
32
|
-
*/
|
|
33
|
-
export declare function toRequestMessages(messages: ChatMessage[]): RequestMessage[];
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
function toRequestToolCall(toolCall) {
|
|
2
|
-
const { id, name, args, status, result } = toolCall;
|
|
3
|
-
return {
|
|
4
|
-
id,
|
|
5
|
-
name,
|
|
6
|
-
args,
|
|
7
|
-
status,
|
|
8
|
-
...result === void 0 ? {} : { result }
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
function toRequestMessages(messages) {
|
|
12
|
-
return messages.filter(isSendableMessage).map((message) => ({
|
|
13
|
-
role: message.role,
|
|
14
|
-
content: message.content,
|
|
15
|
-
...message.toolCallId ? { toolCallId: message.toolCallId } : {},
|
|
16
|
-
...message.toolCalls?.length ? { toolCalls: message.toolCalls.map(toRequestToolCall) } : {}
|
|
17
|
-
}));
|
|
18
|
-
}
|
|
19
|
-
function isSendableMessage(message) {
|
|
20
|
-
if (message.clientOnly) {
|
|
21
|
-
return false;
|
|
22
|
-
}
|
|
23
|
-
if (message.role === "assistant") {
|
|
24
|
-
return message.content.trim().length > 0 || !!message.toolCalls?.length;
|
|
25
|
-
}
|
|
26
|
-
return true;
|
|
27
|
-
}
|
|
28
|
-
export {
|
|
29
|
-
toRequestMessages,
|
|
30
|
-
toRequestToolCall
|
|
31
|
-
};
|