@tylertech/forge-ai 0.15.3-dev.1 → 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 +5757 -15411
- 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 +1 -2
- package/dist/ai-assistant-response/ai-assistant-response.mjs +4 -236
- 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 +3 -3
- package/dist/ai-canvas/ai-canvas.mjs +4 -95
- package/dist/ai-canvas/ai-canvas2.mjs +74 -0
- package/dist/ai-canvas/index.d.ts +1 -1
- package/dist/ai-canvas/index.mjs +1 -5
- 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 +4 -3
- package/dist/ai-message-thread/ai-message-thread.mjs +4 -360
- 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-chatbot → ai-tool-call}/create-tool-renderer.d.ts +1 -1
- 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-chatbot → ai-tool-call}/tool-canvas.d.ts +1 -1
- 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 +1 -1
- 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 +3 -2
- package/dist/core/index.mjs +7 -8
- 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.mjs +132 -154
- 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 -53
- package/dist/index.mjs +100 -214
- 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-canvas/ai-canvas.scss.mjs +0 -4
- 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 -179
- package/dist/ai-chatbot/ai-chatbot-base.mjs +0 -684
- package/dist/ai-chatbot/ai-chatbot-tool-call.d.ts +0 -19
- package/dist/ai-chatbot/ai-chatbot-tool-call.mjs +0 -182
- package/dist/ai-chatbot/ai-chatbot-tool-call.scss.mjs +0 -4
- package/dist/ai-chatbot/ai-chatbot.d.ts +0 -196
- package/dist/ai-chatbot/ai-chatbot.mjs +0 -502
- package/dist/ai-chatbot/ai-chatbot.scss.mjs +0 -4
- 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 -18
- package/dist/ai-chatbot/index.mjs +0 -40
- 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/tool-canvas.mjs +0 -128
- package/dist/ai-chatbot/types.d.ts +0 -582
- package/dist/ai-chatbot/utils.d.ts +0 -49
- package/dist/ai-chatbot/utils.mjs +0 -114
- package/dist/ai-chatbot-launcher/ai-chatbot-launcher.d.ts +0 -190
- package/dist/ai-chatbot-launcher/ai-chatbot-launcher.mjs +0 -986
- 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 -173
- 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/canvas-controller.d.ts +0 -81
- package/dist/core/canvas-controller.mjs +0 -221
- package/dist/core/chatbot-core-controller.d.ts +0 -57
- package/dist/core/chatbot-core-controller.mjs +0 -545
- 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 -43
- 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 -70
- package/dist/tools/ai-mcp-app/ai-mcp-app.mjs +0 -589
- 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 -60
- package/dist/tools/ai-mcp-app/mcp-app-bridge-controller.mjs +0 -147
- package/dist/tools/ai-mcp-app/mcp-app-bridge-types.d.ts +0 -124
- 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 -51
- 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,684 +0,0 @@
|
|
|
1
|
-
import { provide } from "@lit/context";
|
|
2
|
-
import { LitElement } from "lit";
|
|
3
|
-
import { property } from "lit/decorators.js";
|
|
4
|
-
import { mcpAppHostContext } from "../tools/ai-mcp-app/mcp-app-context.mjs";
|
|
5
|
-
import { ChatbotCoreController } from "../core/chatbot-core-controller.mjs";
|
|
6
|
-
import { fileAttachmentsToContextItems, generateId, formatChatTranscript, downloadFile, createChatExportFilename } from "./utils.mjs";
|
|
7
|
-
var __defProp = Object.defineProperty;
|
|
8
|
-
var __decorateClass = (decorators, target, key, kind) => {
|
|
9
|
-
var result = void 0;
|
|
10
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
11
|
-
if (decorator = decorators[i])
|
|
12
|
-
result = decorator(target, key, result) || result;
|
|
13
|
-
if (result) __defProp(target, key, result);
|
|
14
|
-
return result;
|
|
15
|
-
};
|
|
16
|
-
function mcpAppHostCapabilities(adapter) {
|
|
17
|
-
return {
|
|
18
|
-
openLinks: {},
|
|
19
|
-
logging: {},
|
|
20
|
-
message: { text: {} },
|
|
21
|
-
...typeof adapter?.callMcpTool === "function" ? { serverTools: {} } : {},
|
|
22
|
-
...typeof adapter?.updateMcpModelContext === "function" ? { updateModelContext: { text: {}, structuredContent: {} } } : {}
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
function mcpAppEnvironment() {
|
|
26
|
-
return {
|
|
27
|
-
availableDisplayModes: ["inline", "fullscreen", "pip"],
|
|
28
|
-
locale: navigator.language,
|
|
29
|
-
timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
30
|
-
userAgent: navigator.userAgent,
|
|
31
|
-
platform: "web",
|
|
32
|
-
deviceCapabilities: {
|
|
33
|
-
touch: window.matchMedia("(pointer: coarse)").matches || navigator.maxTouchPoints > 0,
|
|
34
|
-
hover: window.matchMedia("(hover: hover)").matches
|
|
35
|
-
},
|
|
36
|
-
safeAreaInsets: { top: 0, right: 0, bottom: 0, left: 0 }
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
function mcpMessageText(content) {
|
|
40
|
-
return content.filter(
|
|
41
|
-
(block) => !!block && typeof block === "object" && block.type === "text" && typeof block.text === "string"
|
|
42
|
-
).map((block) => block.text).join("\n\n");
|
|
43
|
-
}
|
|
44
|
-
class AiChatbotBase extends LitElement {
|
|
45
|
-
constructor() {
|
|
46
|
-
super(...arguments);
|
|
47
|
-
this.fileUpload = "off";
|
|
48
|
-
this.maxFileSize = 10485760;
|
|
49
|
-
this.acceptedFileTypes = "";
|
|
50
|
-
this.voiceInput = "on";
|
|
51
|
-
this.placeholder = "Ask a question...";
|
|
52
|
-
this.enableReactions = false;
|
|
53
|
-
this.titleText = "AI Assistant";
|
|
54
|
-
this.headingLevel = 2;
|
|
55
|
-
this.debugMode = false;
|
|
56
|
-
this.disclaimerText = "AI can make mistakes. Always verify responses.";
|
|
57
|
-
this.debugCommand = "on";
|
|
58
|
-
this.exportOption = "on";
|
|
59
|
-
this.clearOption = "on";
|
|
60
|
-
this.agents = [];
|
|
61
|
-
this.contextItems = [];
|
|
62
|
-
this.#themeMediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
63
|
-
this.#mcpAppViews = /* @__PURE__ */ new Map();
|
|
64
|
-
this._mcpAppHost = {
|
|
65
|
-
callTool: (params) => this._coreController?.adapter?.callMcpTool?.(params) ?? Promise.reject(new Error("tools/call is not supported by this host")),
|
|
66
|
-
readResource: (params) => this._coreController?.adapter?.readMcpResource?.(params) ?? Promise.reject(new Error("resources/read is not supported by this host")),
|
|
67
|
-
updateModelContext: (params) => this._coreController?.adapter?.updateMcpModelContext?.(params) ?? Promise.resolve(),
|
|
68
|
-
draftMessage: ({ content }) => this.#draftMcpAppMessage(content),
|
|
69
|
-
teardownView: ({ toolCallId }) => this._teardownMcpAppViews({ toolCallIds: [toolCallId] }),
|
|
70
|
-
registerView: (view) => {
|
|
71
|
-
this.#mcpAppViews.set(view.toolCallId, view);
|
|
72
|
-
return () => {
|
|
73
|
-
if (this.#mcpAppViews.get(view.toolCallId) === view) {
|
|
74
|
-
this.#mcpAppViews.delete(view.toolCallId);
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
},
|
|
78
|
-
hostContext: { theme: this.#effectiveTheme, ...mcpAppEnvironment() },
|
|
79
|
-
sandboxUrl: void 0,
|
|
80
|
-
hostCapabilities: mcpAppHostCapabilities(void 0)
|
|
81
|
-
};
|
|
82
|
-
this.#handleThemeChange = () => {
|
|
83
|
-
this.#refreshMcpAppHostContext();
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
#themeMediaQuery;
|
|
87
|
-
get #effectiveTheme() {
|
|
88
|
-
return this.mcpAppTheme ?? (this.#themeMediaQuery.matches ? "dark" : "light");
|
|
89
|
-
}
|
|
90
|
-
#mcpAppViews;
|
|
91
|
-
/**
|
|
92
|
-
* Places a widget's `ui/message` text in the prompt for the user to review and send. A
|
|
93
|
-
* widget never starts a model turn on its own. Refused when the message has no text.
|
|
94
|
-
*/
|
|
95
|
-
async #draftMcpAppMessage(content) {
|
|
96
|
-
const text = mcpMessageText(content);
|
|
97
|
-
const prompt = this._promptRef.value;
|
|
98
|
-
if (!text.trim() || !prompt) {
|
|
99
|
-
return { isError: true };
|
|
100
|
-
}
|
|
101
|
-
prompt.value = text;
|
|
102
|
-
prompt.focus();
|
|
103
|
-
return {};
|
|
104
|
-
}
|
|
105
|
-
/**
|
|
106
|
-
* Sends `ui/resource-teardown` to mounted MCP-app widgets (all, or only `toolCallIds`) and
|
|
107
|
-
* releases them immediately, without waiting for acks. The adapter then drops any state it
|
|
108
|
-
* holds for them (e.g. a pending model context).
|
|
109
|
-
*/
|
|
110
|
-
_teardownMcpAppViews({ toolCallIds } = {}) {
|
|
111
|
-
const views = [...this.#mcpAppViews.values()].filter((view) => toolCallIds?.includes(view.toolCallId) ?? true);
|
|
112
|
-
for (const view of views) {
|
|
113
|
-
this.#mcpAppViews.delete(view.toolCallId);
|
|
114
|
-
view.teardown();
|
|
115
|
-
this._coreController?.adapter?.disposeMcpAppView?.({ toolCallId: view.toolCallId });
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
/** Tears down widgets rendered at or after `index`, then removes those items. */
|
|
119
|
-
#removeMessageItemsFrom(index) {
|
|
120
|
-
this._teardownMcpAppViews({ toolCallIds: this._coreController.getToolCallIdsFrom(index) });
|
|
121
|
-
this._coreController.removeMessageItemsFrom(index);
|
|
122
|
-
}
|
|
123
|
-
#handleThemeChange;
|
|
124
|
-
/** A new host context object makes every widget re-read its Forge styles and notify its View. */
|
|
125
|
-
#refreshMcpAppHostContext() {
|
|
126
|
-
this._mcpAppHost = {
|
|
127
|
-
...this._mcpAppHost,
|
|
128
|
-
hostContext: { ...this._mcpAppHost.hostContext, theme: this.#effectiveTheme }
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
get _isStreaming() {
|
|
132
|
-
return this._coreController?.isStreaming ?? false;
|
|
133
|
-
}
|
|
134
|
-
get _isUploading() {
|
|
135
|
-
return this._coreController?.isUploading ?? false;
|
|
136
|
-
}
|
|
137
|
-
get _tools() {
|
|
138
|
-
return this._coreController?.tools ?? /* @__PURE__ */ new Map();
|
|
139
|
-
}
|
|
140
|
-
get _messageItems() {
|
|
141
|
-
return this._coreController?.messageItems ?? [];
|
|
142
|
-
}
|
|
143
|
-
get _toolCalls() {
|
|
144
|
-
return this._messageItems.flatMap((item) => {
|
|
145
|
-
if (item.type === "toolCall") {
|
|
146
|
-
return [item.data];
|
|
147
|
-
}
|
|
148
|
-
if (item.type === "assistant") {
|
|
149
|
-
return item.data.children.flatMap((child) => child.type === "toolCall" ? [child.data] : []);
|
|
150
|
-
}
|
|
151
|
-
return [];
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
get _hasMessages() {
|
|
155
|
-
return this._coreController?.hasMessages ?? false;
|
|
156
|
-
}
|
|
157
|
-
get _allContextItems() {
|
|
158
|
-
return [
|
|
159
|
-
...this.contextItems,
|
|
160
|
-
...fileAttachmentsToContextItems(
|
|
161
|
-
this._coreController?.completedAttachments ?? [],
|
|
162
|
-
this._coreController?.pendingAttachments ?? []
|
|
163
|
-
)
|
|
164
|
-
];
|
|
165
|
-
}
|
|
166
|
-
connectedCallback() {
|
|
167
|
-
super.connectedCallback();
|
|
168
|
-
this._coreController = new ChatbotCoreController(this, {
|
|
169
|
-
callbacks: {
|
|
170
|
-
onRequestUpdate: () => this.requestUpdate(),
|
|
171
|
-
onScrollToBottom: () => this.scrollToBottom(),
|
|
172
|
-
onDispatchEvent: (type, detail, cancelable) => this._dispatchHostEvent({ type, detail, cancelable })
|
|
173
|
-
}
|
|
174
|
-
});
|
|
175
|
-
if (this.adapter) {
|
|
176
|
-
this._coreController.adapter = this.adapter;
|
|
177
|
-
}
|
|
178
|
-
this.#themeMediaQuery.addEventListener("change", this.#handleThemeChange);
|
|
179
|
-
this._onConnected();
|
|
180
|
-
}
|
|
181
|
-
disconnectedCallback() {
|
|
182
|
-
super.disconnectedCallback();
|
|
183
|
-
this.#themeMediaQuery.removeEventListener("change", this.#handleThemeChange);
|
|
184
|
-
}
|
|
185
|
-
willUpdate(changedProperties) {
|
|
186
|
-
if (changedProperties.has("adapter") && this._coreController) {
|
|
187
|
-
this._coreController.adapter = this.adapter;
|
|
188
|
-
}
|
|
189
|
-
if (changedProperties.has("adapter")) {
|
|
190
|
-
this._mcpAppHost = { ...this._mcpAppHost, hostCapabilities: mcpAppHostCapabilities(this.adapter) };
|
|
191
|
-
}
|
|
192
|
-
if (changedProperties.has("mcpAppSandboxUrl")) {
|
|
193
|
-
this._mcpAppHost = { ...this._mcpAppHost, sandboxUrl: this.mcpAppSandboxUrl };
|
|
194
|
-
}
|
|
195
|
-
if (changedProperties.has("mcpAppTheme")) {
|
|
196
|
-
this.#refreshMcpAppHostContext();
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
_onConnected() {
|
|
200
|
-
}
|
|
201
|
-
get _slashCommands() {
|
|
202
|
-
const commands = [];
|
|
203
|
-
if (this._hasMessages) {
|
|
204
|
-
commands.push({ id: "clear", name: "Clear", group: "Conversation" });
|
|
205
|
-
commands.push({ id: "export", name: "Export", group: "Conversation" });
|
|
206
|
-
}
|
|
207
|
-
commands.push({ id: "info", name: "Info", group: "Help" });
|
|
208
|
-
if (this.debugCommand === "on") {
|
|
209
|
-
commands.push({
|
|
210
|
-
id: "debug",
|
|
211
|
-
name: `${this.debugMode ? "Disable debug mode" : "Enable debug mode"}`,
|
|
212
|
-
group: "Help"
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
return commands;
|
|
216
|
-
}
|
|
217
|
-
_handleSlashCommand(evt) {
|
|
218
|
-
const commandId = evt.detail.commandId;
|
|
219
|
-
switch (commandId) {
|
|
220
|
-
case "clear":
|
|
221
|
-
this.clearMessages();
|
|
222
|
-
break;
|
|
223
|
-
case "export":
|
|
224
|
-
this._handleExport();
|
|
225
|
-
break;
|
|
226
|
-
case "info":
|
|
227
|
-
this._handleInfo();
|
|
228
|
-
break;
|
|
229
|
-
case "debug":
|
|
230
|
-
this._handleDebugToggle();
|
|
231
|
-
break;
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
_handleInfo() {
|
|
235
|
-
this._dispatchHostEvent({ type: "forge-ai-chatbot-info" });
|
|
236
|
-
}
|
|
237
|
-
_handleAgentChange(event) {
|
|
238
|
-
const { agent, previousAgentId } = event.detail;
|
|
239
|
-
const changeEvt = this._dispatchHostEvent({
|
|
240
|
-
type: "forge-ai-chatbot-agent-change",
|
|
241
|
-
detail: { agent, previousAgentId }
|
|
242
|
-
});
|
|
243
|
-
if (!changeEvt.defaultPrevented) {
|
|
244
|
-
this.selectedAgentId = agent?.id;
|
|
245
|
-
const adapter = this._coreController.adapter;
|
|
246
|
-
if (adapter) {
|
|
247
|
-
adapter.threadId = generateId();
|
|
248
|
-
}
|
|
249
|
-
if (this._hasMessages) {
|
|
250
|
-
const agentName = agent?.name ?? this.titleText;
|
|
251
|
-
this._coreController.finalizeActiveResponse();
|
|
252
|
-
this._coreController.addClientMessage({ content: `Switched to ${agentName}` });
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
_handleDebugToggle() {
|
|
257
|
-
this.debugMode = !this.debugMode;
|
|
258
|
-
}
|
|
259
|
-
_handleAttachmentRemove(evt) {
|
|
260
|
-
const { filename } = evt.detail;
|
|
261
|
-
const pendingAttachment = this._coreController.pendingAttachments.find((a) => a.filename === filename);
|
|
262
|
-
if (pendingAttachment) {
|
|
263
|
-
this._coreController.abortFileUpload(pendingAttachment.id);
|
|
264
|
-
return;
|
|
265
|
-
}
|
|
266
|
-
const completedAttachment = this._coreController.completedAttachments.find((a) => a.filename === filename);
|
|
267
|
-
if (completedAttachment) {
|
|
268
|
-
this._coreController.removeCompletedAttachment(completedAttachment.id);
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
_handleContextChipRemove(evt) {
|
|
272
|
-
const { id, item } = evt.detail;
|
|
273
|
-
const hostEvent = this._dispatchHostEvent({
|
|
274
|
-
type: "forge-ai-chatbot-context-remove",
|
|
275
|
-
detail: { id, item },
|
|
276
|
-
cancelable: true
|
|
277
|
-
});
|
|
278
|
-
if (!hostEvent.defaultPrevented) {
|
|
279
|
-
this.contextItems = this.contextItems.filter((i) => i.id !== id);
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
_handlePromptContextRemove(evt) {
|
|
283
|
-
const { id, item } = evt.detail;
|
|
284
|
-
if (item.type === "file") {
|
|
285
|
-
const hostEvent = this._dispatchHostEvent({
|
|
286
|
-
type: "forge-ai-chatbot-context-remove",
|
|
287
|
-
detail: { id, item },
|
|
288
|
-
cancelable: true
|
|
289
|
-
});
|
|
290
|
-
if (hostEvent.defaultPrevented) {
|
|
291
|
-
return;
|
|
292
|
-
}
|
|
293
|
-
const pendingFile = this._coreController?.pendingAttachments.find((a) => a.id === id);
|
|
294
|
-
if (pendingFile) {
|
|
295
|
-
this._handleAttachmentRemove(
|
|
296
|
-
new CustomEvent("forge-ai-attachment-remove", {
|
|
297
|
-
detail: { filename: pendingFile.filename }
|
|
298
|
-
})
|
|
299
|
-
);
|
|
300
|
-
return;
|
|
301
|
-
}
|
|
302
|
-
const completedFile = this._coreController?.completedAttachments.find((a) => a.id === id);
|
|
303
|
-
if (completedFile) {
|
|
304
|
-
this._handleAttachmentRemove(
|
|
305
|
-
new CustomEvent("forge-ai-attachment-remove", {
|
|
306
|
-
detail: { filename: completedFile.filename }
|
|
307
|
-
})
|
|
308
|
-
);
|
|
309
|
-
}
|
|
310
|
-
return;
|
|
311
|
-
}
|
|
312
|
-
this._handleContextChipRemove(evt);
|
|
313
|
-
}
|
|
314
|
-
async _handleSend(evt) {
|
|
315
|
-
const pendingAttachments = [...this._coreController.pendingAttachments];
|
|
316
|
-
await this._coreController.sendMessage({
|
|
317
|
-
content: evt.detail.value,
|
|
318
|
-
timestamp: evt.detail.date.getTime(),
|
|
319
|
-
attachments: pendingAttachments
|
|
320
|
-
});
|
|
321
|
-
}
|
|
322
|
-
_handleStop() {
|
|
323
|
-
this._coreController.abort();
|
|
324
|
-
}
|
|
325
|
-
_handleCancel() {
|
|
326
|
-
this._handleStop();
|
|
327
|
-
}
|
|
328
|
-
async _handleCopy(evt) {
|
|
329
|
-
const responseId = evt.detail.messageId;
|
|
330
|
-
const responseItem = this._messageItems.find((item) => item.type === "assistant" && item.data.id === responseId);
|
|
331
|
-
if (!responseItem || responseItem.type !== "assistant") {
|
|
332
|
-
return;
|
|
333
|
-
}
|
|
334
|
-
const textContent = responseItem.data.children.filter(
|
|
335
|
-
(c) => c.type === "text"
|
|
336
|
-
).map((c) => c.content).join("\n\n");
|
|
337
|
-
try {
|
|
338
|
-
await navigator.clipboard.writeText(textContent);
|
|
339
|
-
} catch {
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
async _handleUserCopy(evt) {
|
|
343
|
-
const messageId = evt.detail.messageId;
|
|
344
|
-
const message = this._coreController.getMessage(messageId);
|
|
345
|
-
if (!message || message.role !== "user") {
|
|
346
|
-
return;
|
|
347
|
-
}
|
|
348
|
-
try {
|
|
349
|
-
await navigator.clipboard.writeText(message.content);
|
|
350
|
-
} catch {
|
|
351
|
-
}
|
|
352
|
-
}
|
|
353
|
-
_handleUserResend(evt) {
|
|
354
|
-
const adapter = this._coreController.adapter;
|
|
355
|
-
if (!adapter) {
|
|
356
|
-
return;
|
|
357
|
-
}
|
|
358
|
-
const messageId = evt.detail.messageId;
|
|
359
|
-
const messageIndex = this._messageItems.findIndex((item) => item.type === "message" && item.data.id === messageId);
|
|
360
|
-
if (messageIndex === -1) {
|
|
361
|
-
return;
|
|
362
|
-
}
|
|
363
|
-
const responseIndex = messageIndex + 1;
|
|
364
|
-
if (responseIndex < this._messageItems.length) {
|
|
365
|
-
this.#removeMessageItemsFrom(responseIndex);
|
|
366
|
-
}
|
|
367
|
-
adapter.sendMessage(this.getMessages());
|
|
368
|
-
}
|
|
369
|
-
_handleUserEdit(evt) {
|
|
370
|
-
const adapter = this._coreController.adapter;
|
|
371
|
-
if (!adapter) {
|
|
372
|
-
return;
|
|
373
|
-
}
|
|
374
|
-
const { messageId, content } = evt.detail;
|
|
375
|
-
const messageIndex = this._messageItems.findIndex((item) => item.type === "message" && item.data.id === messageId);
|
|
376
|
-
if (messageIndex === -1) {
|
|
377
|
-
return;
|
|
378
|
-
}
|
|
379
|
-
this._coreController.updateMessageContent(messageId, content);
|
|
380
|
-
const responseIndex = messageIndex + 1;
|
|
381
|
-
if (responseIndex < this._messageItems.length) {
|
|
382
|
-
this.#removeMessageItemsFrom(responseIndex);
|
|
383
|
-
}
|
|
384
|
-
adapter.sendMessage(this.getMessages());
|
|
385
|
-
}
|
|
386
|
-
_handleResend(evt) {
|
|
387
|
-
const adapter = this._coreController.adapter;
|
|
388
|
-
if (!adapter) {
|
|
389
|
-
return;
|
|
390
|
-
}
|
|
391
|
-
const responseId = evt.detail.messageId;
|
|
392
|
-
const responseIndex = this._messageItems.findIndex(
|
|
393
|
-
(item) => item.type === "assistant" && item.data.id === responseId
|
|
394
|
-
);
|
|
395
|
-
if (responseIndex === -1) {
|
|
396
|
-
return;
|
|
397
|
-
}
|
|
398
|
-
this.#removeMessageItemsFrom(responseIndex);
|
|
399
|
-
adapter.sendMessage(this.getMessages());
|
|
400
|
-
}
|
|
401
|
-
_handleFeedback(evt, type) {
|
|
402
|
-
this._coreController.setResponseFeedback(evt.detail.messageId, {
|
|
403
|
-
type,
|
|
404
|
-
reason: evt.detail.feedback
|
|
405
|
-
});
|
|
406
|
-
this._dispatchHostEvent({
|
|
407
|
-
type: "forge-ai-chatbot-response-feedback",
|
|
408
|
-
detail: {
|
|
409
|
-
messageId: evt.detail.messageId,
|
|
410
|
-
type,
|
|
411
|
-
feedback: evt.detail.feedback
|
|
412
|
-
}
|
|
413
|
-
});
|
|
414
|
-
}
|
|
415
|
-
_handleThumbsUp(evt) {
|
|
416
|
-
this._handleFeedback(evt, "positive");
|
|
417
|
-
}
|
|
418
|
-
_handleThumbsDown(evt) {
|
|
419
|
-
this._handleFeedback(evt, "negative");
|
|
420
|
-
}
|
|
421
|
-
_handleFileSelect(evt) {
|
|
422
|
-
const { file, timestamp } = evt.detail;
|
|
423
|
-
const fileId = this._coreController.processFileUpload(file, timestamp);
|
|
424
|
-
const callbacks = this._coreController.createFileUploadCallbacks(fileId);
|
|
425
|
-
this._dispatchHostEvent({
|
|
426
|
-
type: "forge-ai-chatbot-file-select",
|
|
427
|
-
detail: {
|
|
428
|
-
fileId,
|
|
429
|
-
file,
|
|
430
|
-
filename: file.name,
|
|
431
|
-
size: file.size,
|
|
432
|
-
mimeType: file.type,
|
|
433
|
-
timestamp,
|
|
434
|
-
...callbacks
|
|
435
|
-
}
|
|
436
|
-
});
|
|
437
|
-
}
|
|
438
|
-
_handleFileError(evt) {
|
|
439
|
-
const errorMessage = {
|
|
440
|
-
id: generateId(),
|
|
441
|
-
role: "assistant",
|
|
442
|
-
content: evt.detail.message,
|
|
443
|
-
timestamp: Date.now(),
|
|
444
|
-
status: "error"
|
|
445
|
-
};
|
|
446
|
-
this._coreController.addMessage(errorMessage);
|
|
447
|
-
}
|
|
448
|
-
async _handleSuggestionSelect(evt) {
|
|
449
|
-
this._promptRef.value?.addToHistory(evt.detail.text);
|
|
450
|
-
await this.sendMessage(evt.detail.text);
|
|
451
|
-
}
|
|
452
|
-
_handleVoiceInputResult(evt) {
|
|
453
|
-
const { transcript } = evt.detail;
|
|
454
|
-
if (transcript && this._promptRef.value) {
|
|
455
|
-
this._promptRef.value.value = transcript;
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
/**
|
|
459
|
-
* Clears all messages from the chat.
|
|
460
|
-
*
|
|
461
|
-
* This is a lower-level operation that removes message history without
|
|
462
|
-
* the semantic meaning of "starting a new conversation". For user-facing
|
|
463
|
-
* "new chat" actions, prefer {@link startNewChat} which provides
|
|
464
|
-
* conversation-level cleanup.
|
|
465
|
-
*
|
|
466
|
-
* @returns true if messages were cleared, false if prevented via event.preventDefault()
|
|
467
|
-
* @fires forge-ai-chatbot-clear - Cancelable event fired before clearing
|
|
468
|
-
*/
|
|
469
|
-
clearMessages() {
|
|
470
|
-
const event = this._dispatchHostEvent({ type: "forge-ai-chatbot-clear", cancelable: true });
|
|
471
|
-
if (event.defaultPrevented) {
|
|
472
|
-
return false;
|
|
473
|
-
}
|
|
474
|
-
this._teardownMcpAppViews();
|
|
475
|
-
this._coreController.clearMessages();
|
|
476
|
-
return true;
|
|
477
|
-
}
|
|
478
|
-
/**
|
|
479
|
-
* Starts a new chat conversation.
|
|
480
|
-
*
|
|
481
|
-
* This clears all messages and resets the conversation to a fresh state.
|
|
482
|
-
* Use this when the user explicitly wants to begin a new conversation.
|
|
483
|
-
*
|
|
484
|
-
* Contrast with {@link clearMessages}, which fires events and can be prevented.
|
|
485
|
-
* This method does not fire events - it's meant for programmatic use.
|
|
486
|
-
* For user-initiated actions, use event handlers that fire events before calling this.
|
|
487
|
-
*
|
|
488
|
-
* Subclasses may override this to add conversation-specific cleanup like
|
|
489
|
-
* resetting thread IDs or closing panels.
|
|
490
|
-
*/
|
|
491
|
-
startNewChat() {
|
|
492
|
-
this._teardownMcpAppViews();
|
|
493
|
-
this._coreController.clearMessages();
|
|
494
|
-
}
|
|
495
|
-
getMessages() {
|
|
496
|
-
return this._coreController.getMessages();
|
|
497
|
-
}
|
|
498
|
-
setMessages(messages) {
|
|
499
|
-
this._coreController.setMessages(messages);
|
|
500
|
-
}
|
|
501
|
-
/**
|
|
502
|
-
* Inserts or upserts a client-only status message into the thread - never sent to
|
|
503
|
-
* the agent adapter and never included in the conversation history the adapter sees.
|
|
504
|
-
* Use this for host-driven UI feedback (e.g. "Your session expired", upload progress)
|
|
505
|
-
* instead of splicing {@link getMessages}/{@link setMessages} directly.
|
|
506
|
-
*
|
|
507
|
-
* Safe to call at any time, including while a response is streaming - it never
|
|
508
|
-
* finalizes or otherwise touches the in-progress response.
|
|
509
|
-
*
|
|
510
|
-
* @param message - Content and optional kind ('text' | 'info' | 'warning' | 'error' | 'success'),
|
|
511
|
-
* header, and actions. Pass the same `id` on a later call to upsert (replace) a
|
|
512
|
-
* previously added message.
|
|
513
|
-
* @returns The message id (generated if not provided).
|
|
514
|
-
*/
|
|
515
|
-
addClientMessage(message) {
|
|
516
|
-
return this._coreController.addClientMessage(message);
|
|
517
|
-
}
|
|
518
|
-
/**
|
|
519
|
-
* Removes a client-only message previously added via {@link addClientMessage}.
|
|
520
|
-
* No-ops if no message with that id exists. Safe to call at any time, including
|
|
521
|
-
* while a response is streaming. Removal is never automatic - call this when your
|
|
522
|
-
* host logic determines the message is no longer relevant.
|
|
523
|
-
*/
|
|
524
|
-
removeClientMessage(id) {
|
|
525
|
-
this._coreController.removeClientMessage(id);
|
|
526
|
-
}
|
|
527
|
-
async sendMessage(content, files) {
|
|
528
|
-
if (!this._coreController.adapter) {
|
|
529
|
-
console.warn("No adapter configured.");
|
|
530
|
-
return;
|
|
531
|
-
}
|
|
532
|
-
if (files) {
|
|
533
|
-
const timestamp = Date.now();
|
|
534
|
-
for (const file of files) {
|
|
535
|
-
const fileId = this._coreController.processFileUpload(file, timestamp);
|
|
536
|
-
const callbacks = this._coreController.createFileUploadCallbacks(fileId);
|
|
537
|
-
this._dispatchHostEvent({
|
|
538
|
-
type: "forge-ai-chatbot-file-select",
|
|
539
|
-
detail: {
|
|
540
|
-
fileId,
|
|
541
|
-
file,
|
|
542
|
-
filename: file.name,
|
|
543
|
-
size: file.size,
|
|
544
|
-
mimeType: file.type,
|
|
545
|
-
timestamp,
|
|
546
|
-
...callbacks
|
|
547
|
-
}
|
|
548
|
-
});
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
await this._coreController.sendMessage({
|
|
552
|
-
content,
|
|
553
|
-
attachments: this._coreController.pendingAttachments
|
|
554
|
-
});
|
|
555
|
-
}
|
|
556
|
-
abort() {
|
|
557
|
-
this._handleStop();
|
|
558
|
-
}
|
|
559
|
-
/**
|
|
560
|
-
* Re-sends the Forge-derived `styles.variables` to every MCP-app widget. Call after
|
|
561
|
-
* changing Forge tokens without a light/dark switch (e.g. a brand change); for light/dark,
|
|
562
|
-
* set {@link mcpAppTheme} instead.
|
|
563
|
-
*/
|
|
564
|
-
refreshMcpAppStyles() {
|
|
565
|
-
this.#refreshMcpAppHostContext();
|
|
566
|
-
}
|
|
567
|
-
async scrollToBottom({ behavior } = {}) {
|
|
568
|
-
await this._messageThreadRef.value?.updateComplete;
|
|
569
|
-
await new Promise(requestAnimationFrame);
|
|
570
|
-
this._messageThreadRef.value?.scrollToBottom({ behavior });
|
|
571
|
-
}
|
|
572
|
-
getThreadState() {
|
|
573
|
-
return {
|
|
574
|
-
threadId: this._coreController.adapter?.threadId,
|
|
575
|
-
messages: this.getMessages(),
|
|
576
|
-
timestamp: Date.now(),
|
|
577
|
-
selectedAgentId: this.selectedAgentId
|
|
578
|
-
};
|
|
579
|
-
}
|
|
580
|
-
getSelectedAgent() {
|
|
581
|
-
return this.agents.find((a) => a.id === this.selectedAgentId);
|
|
582
|
-
}
|
|
583
|
-
async setThreadState(threadState) {
|
|
584
|
-
this._teardownMcpAppViews();
|
|
585
|
-
this.setMessages(threadState.messages);
|
|
586
|
-
this.selectedAgentId = threadState.selectedAgentId;
|
|
587
|
-
if (threadState.threadId && this._coreController.adapter) {
|
|
588
|
-
this._coreController.adapter.threadId = threadState.threadId;
|
|
589
|
-
}
|
|
590
|
-
await this.updateComplete;
|
|
591
|
-
const userMessages = threadState.messages.filter((msg) => msg.role === "user").map((msg) => msg.content);
|
|
592
|
-
this._promptRef.value?.setHistory(userMessages);
|
|
593
|
-
this.scrollToBottom({ behavior: "instant" });
|
|
594
|
-
}
|
|
595
|
-
_dispatchHostEvent(config) {
|
|
596
|
-
const event = new CustomEvent(config.type, {
|
|
597
|
-
detail: config.detail,
|
|
598
|
-
bubbles: true,
|
|
599
|
-
composed: true,
|
|
600
|
-
cancelable: config.cancelable ?? false
|
|
601
|
-
});
|
|
602
|
-
this.dispatchEvent(event);
|
|
603
|
-
return event;
|
|
604
|
-
}
|
|
605
|
-
_handleExport() {
|
|
606
|
-
const messages = this.getMessages();
|
|
607
|
-
if (messages.length === 0) {
|
|
608
|
-
return;
|
|
609
|
-
}
|
|
610
|
-
const chatText = formatChatTranscript(messages, { includeToolCalls: this.debugMode });
|
|
611
|
-
const agentName = this.getSelectedAgent()?.name ?? this.titleText;
|
|
612
|
-
downloadFile(chatText, createChatExportFilename(agentName), "text/plain");
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
__decorateClass([
|
|
616
|
-
property({ attribute: false })
|
|
617
|
-
], AiChatbotBase.prototype, "adapter");
|
|
618
|
-
__decorateClass([
|
|
619
|
-
property({ attribute: "file-upload" })
|
|
620
|
-
], AiChatbotBase.prototype, "fileUpload");
|
|
621
|
-
__decorateClass([
|
|
622
|
-
property({ type: Number, attribute: "max-file-size" })
|
|
623
|
-
], AiChatbotBase.prototype, "maxFileSize");
|
|
624
|
-
__decorateClass([
|
|
625
|
-
property({ attribute: "accepted-file-types" })
|
|
626
|
-
], AiChatbotBase.prototype, "acceptedFileTypes");
|
|
627
|
-
__decorateClass([
|
|
628
|
-
property({ attribute: "voice-input" })
|
|
629
|
-
], AiChatbotBase.prototype, "voiceInput");
|
|
630
|
-
__decorateClass([
|
|
631
|
-
property()
|
|
632
|
-
], AiChatbotBase.prototype, "placeholder");
|
|
633
|
-
__decorateClass([
|
|
634
|
-
property({ attribute: false })
|
|
635
|
-
], AiChatbotBase.prototype, "suggestions");
|
|
636
|
-
__decorateClass([
|
|
637
|
-
property({ type: Boolean, attribute: "enable-reactions" })
|
|
638
|
-
], AiChatbotBase.prototype, "enableReactions");
|
|
639
|
-
__decorateClass([
|
|
640
|
-
property({ attribute: "title-text" })
|
|
641
|
-
], AiChatbotBase.prototype, "titleText");
|
|
642
|
-
__decorateClass([
|
|
643
|
-
property({ attribute: "heading-level", type: Number })
|
|
644
|
-
], AiChatbotBase.prototype, "headingLevel");
|
|
645
|
-
__decorateClass([
|
|
646
|
-
property({ type: Boolean, attribute: "debug-mode" })
|
|
647
|
-
], AiChatbotBase.prototype, "debugMode");
|
|
648
|
-
__decorateClass([
|
|
649
|
-
property({ attribute: "disclaimer-text" })
|
|
650
|
-
], AiChatbotBase.prototype, "disclaimerText");
|
|
651
|
-
__decorateClass([
|
|
652
|
-
property({ attribute: "debug-command" })
|
|
653
|
-
], AiChatbotBase.prototype, "debugCommand");
|
|
654
|
-
__decorateClass([
|
|
655
|
-
property({ attribute: "export-option" })
|
|
656
|
-
], AiChatbotBase.prototype, "exportOption");
|
|
657
|
-
__decorateClass([
|
|
658
|
-
property({ attribute: "clear-option" })
|
|
659
|
-
], AiChatbotBase.prototype, "clearOption");
|
|
660
|
-
__decorateClass([
|
|
661
|
-
property({ type: Object, attribute: false })
|
|
662
|
-
], AiChatbotBase.prototype, "agentInfo");
|
|
663
|
-
__decorateClass([
|
|
664
|
-
property({ attribute: false })
|
|
665
|
-
], AiChatbotBase.prototype, "agents");
|
|
666
|
-
__decorateClass([
|
|
667
|
-
property({ attribute: "selected-agent-id" })
|
|
668
|
-
], AiChatbotBase.prototype, "selectedAgentId");
|
|
669
|
-
__decorateClass([
|
|
670
|
-
property({ attribute: false })
|
|
671
|
-
], AiChatbotBase.prototype, "contextItems");
|
|
672
|
-
__decorateClass([
|
|
673
|
-
property({ attribute: "mcp-app-sandbox-url" })
|
|
674
|
-
], AiChatbotBase.prototype, "mcpAppSandboxUrl");
|
|
675
|
-
__decorateClass([
|
|
676
|
-
property({ attribute: "mcp-app-theme" })
|
|
677
|
-
], AiChatbotBase.prototype, "mcpAppTheme");
|
|
678
|
-
__decorateClass([
|
|
679
|
-
provide({ context: mcpAppHostContext }),
|
|
680
|
-
property({ attribute: false })
|
|
681
|
-
], AiChatbotBase.prototype, "_mcpAppHost");
|
|
682
|
-
export {
|
|
683
|
-
AiChatbotBase
|
|
684
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { LitElement, TemplateResult, nothing, PropertyValues, CSSResult } from 'lit';
|
|
2
|
-
import { ToolCall, AnyToolDefinition } from './types.js';
|
|
3
|
-
declare global {
|
|
4
|
-
interface HTMLElementTagNameMap {
|
|
5
|
-
'forge-ai-chatbot-tool-call': AiChatbotToolCallComponent;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
export declare const AiChatbotToolCallComponentTagName: keyof HTMLElementTagNameMap;
|
|
9
|
-
/**
|
|
10
|
-
* @tag forge-ai-chatbot-tool-call
|
|
11
|
-
*/
|
|
12
|
-
export declare class AiChatbotToolCallComponent extends LitElement {
|
|
13
|
-
#private;
|
|
14
|
-
static styles: CSSResult;
|
|
15
|
-
toolCall: ToolCall;
|
|
16
|
-
toolDefinition?: AnyToolDefinition;
|
|
17
|
-
updated(changedProperties: PropertyValues<this>): void;
|
|
18
|
-
render(): TemplateResult | typeof nothing;
|
|
19
|
-
}
|