@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,221 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from "./event-emitter.mjs";
|
|
2
|
-
class AgentAdapter {
|
|
3
|
-
constructor() {
|
|
4
|
-
this._state = { isConnected: false, isConnecting: false, isRunning: false };
|
|
5
|
-
this._tools = [];
|
|
6
|
-
this._events = {
|
|
7
|
-
runStarted: new EventEmitter(),
|
|
8
|
-
runFinished: new EventEmitter(),
|
|
9
|
-
runAborted: new EventEmitter(),
|
|
10
|
-
messageStart: new EventEmitter(),
|
|
11
|
-
messageDelta: new EventEmitter(),
|
|
12
|
-
messageEnd: new EventEmitter(),
|
|
13
|
-
toolCall: new EventEmitter(),
|
|
14
|
-
toolCallStart: new EventEmitter(),
|
|
15
|
-
toolCallArgs: new EventEmitter(),
|
|
16
|
-
toolCallEnd: new EventEmitter(),
|
|
17
|
-
toolResult: new EventEmitter(),
|
|
18
|
-
mcpUiResource: new EventEmitter(),
|
|
19
|
-
fileUpload: new EventEmitter(),
|
|
20
|
-
fileRemove: new EventEmitter(),
|
|
21
|
-
error: new EventEmitter(),
|
|
22
|
-
stateChange: new EventEmitter(),
|
|
23
|
-
customEvent: new EventEmitter(),
|
|
24
|
-
rawEvent: new EventEmitter(),
|
|
25
|
-
runStartedEvent: new EventEmitter(),
|
|
26
|
-
stepStarted: new EventEmitter(),
|
|
27
|
-
stepFinished: new EventEmitter(),
|
|
28
|
-
stateSnapshot: new EventEmitter(),
|
|
29
|
-
stateDelta: new EventEmitter(),
|
|
30
|
-
activitySnapshot: new EventEmitter(),
|
|
31
|
-
activityDelta: new EventEmitter()
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
setTools(tools) {
|
|
35
|
-
this._tools = tools;
|
|
36
|
-
}
|
|
37
|
-
getTools() {
|
|
38
|
-
return [...this._tools];
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Tools to forward to the backend agent, excluding MCP-app tools (`ToolDefinition.mcpApp`).
|
|
42
|
-
* MCP-app tools are a host-internal mechanism for streaming a UI resource into an existing
|
|
43
|
-
* tool call — the model never calls them directly, so they must never reach the agent.
|
|
44
|
-
*/
|
|
45
|
-
getModelFacingTools() {
|
|
46
|
-
return this._tools.filter((tool) => tool.mcpApp === void 0);
|
|
47
|
-
}
|
|
48
|
-
getState() {
|
|
49
|
-
return { ...this._state };
|
|
50
|
-
}
|
|
51
|
-
get isConnected() {
|
|
52
|
-
return this._state.isConnected;
|
|
53
|
-
}
|
|
54
|
-
get isConnecting() {
|
|
55
|
-
return this._state.isConnecting;
|
|
56
|
-
}
|
|
57
|
-
get isRunning() {
|
|
58
|
-
return this._state.isRunning;
|
|
59
|
-
}
|
|
60
|
-
onRunStarted(callback) {
|
|
61
|
-
return this._events.runStarted.subscribe(callback);
|
|
62
|
-
}
|
|
63
|
-
onRunFinished(callback) {
|
|
64
|
-
return this._events.runFinished.subscribe(callback);
|
|
65
|
-
}
|
|
66
|
-
onRunAborted(callback) {
|
|
67
|
-
return this._events.runAborted.subscribe(callback);
|
|
68
|
-
}
|
|
69
|
-
onMessageStart(callback) {
|
|
70
|
-
return this._events.messageStart.subscribe(callback);
|
|
71
|
-
}
|
|
72
|
-
onMessageDelta(callback) {
|
|
73
|
-
return this._events.messageDelta.subscribe(callback);
|
|
74
|
-
}
|
|
75
|
-
onMessageEnd(callback) {
|
|
76
|
-
return this._events.messageEnd.subscribe(callback);
|
|
77
|
-
}
|
|
78
|
-
onToolCall(callback) {
|
|
79
|
-
return this._events.toolCall.subscribe(callback);
|
|
80
|
-
}
|
|
81
|
-
onToolCallStart(callback) {
|
|
82
|
-
return this._events.toolCallStart.subscribe(callback);
|
|
83
|
-
}
|
|
84
|
-
onToolCallArgs(callback) {
|
|
85
|
-
return this._events.toolCallArgs.subscribe(callback);
|
|
86
|
-
}
|
|
87
|
-
onToolCallEnd(callback) {
|
|
88
|
-
return this._events.toolCallEnd.subscribe(callback);
|
|
89
|
-
}
|
|
90
|
-
onToolCallResult(callback) {
|
|
91
|
-
return this._events.toolResult.subscribe(callback);
|
|
92
|
-
}
|
|
93
|
-
onMcpUiResource(callback) {
|
|
94
|
-
return this._events.mcpUiResource.subscribe(callback);
|
|
95
|
-
}
|
|
96
|
-
onFileUpload(callback) {
|
|
97
|
-
return this._events.fileUpload.subscribe(callback);
|
|
98
|
-
}
|
|
99
|
-
onFileRemove(callback) {
|
|
100
|
-
return this._events.fileRemove.subscribe(callback);
|
|
101
|
-
}
|
|
102
|
-
onError(callback) {
|
|
103
|
-
return this._events.error.subscribe(callback);
|
|
104
|
-
}
|
|
105
|
-
onStateChange(callback) {
|
|
106
|
-
return this._events.stateChange.subscribe(callback);
|
|
107
|
-
}
|
|
108
|
-
onCustomEvent(callback) {
|
|
109
|
-
return this._events.customEvent.subscribe(callback);
|
|
110
|
-
}
|
|
111
|
-
onRawEvent(callback) {
|
|
112
|
-
return this._events.rawEvent.subscribe(callback);
|
|
113
|
-
}
|
|
114
|
-
onRunStartedEvent(callback) {
|
|
115
|
-
return this._events.runStartedEvent.subscribe(callback);
|
|
116
|
-
}
|
|
117
|
-
onStepStarted(callback) {
|
|
118
|
-
return this._events.stepStarted.subscribe(callback);
|
|
119
|
-
}
|
|
120
|
-
onStepFinished(callback) {
|
|
121
|
-
return this._events.stepFinished.subscribe(callback);
|
|
122
|
-
}
|
|
123
|
-
onStateSnapshot(callback) {
|
|
124
|
-
return this._events.stateSnapshot.subscribe(callback);
|
|
125
|
-
}
|
|
126
|
-
onStateDelta(callback) {
|
|
127
|
-
return this._events.stateDelta.subscribe(callback);
|
|
128
|
-
}
|
|
129
|
-
onActivitySnapshot(callback) {
|
|
130
|
-
return this._events.activitySnapshot.subscribe(callback);
|
|
131
|
-
}
|
|
132
|
-
onActivityDelta(callback) {
|
|
133
|
-
return this._events.activityDelta.subscribe(callback);
|
|
134
|
-
}
|
|
135
|
-
_emitRunStarted() {
|
|
136
|
-
this._events.runStarted.emit();
|
|
137
|
-
}
|
|
138
|
-
_emitRunFinished() {
|
|
139
|
-
this._events.runFinished.emit();
|
|
140
|
-
}
|
|
141
|
-
_emitRunAborted() {
|
|
142
|
-
this._events.runAborted.emit();
|
|
143
|
-
}
|
|
144
|
-
_emitMessageStart(messageId, rawEvent) {
|
|
145
|
-
this._events.messageStart.emit({ messageId, rawEvent });
|
|
146
|
-
}
|
|
147
|
-
_emitMessageDelta(messageId, delta, rawEvent) {
|
|
148
|
-
this._events.messageDelta.emit({ messageId, delta, rawEvent });
|
|
149
|
-
}
|
|
150
|
-
_emitMessageEnd(messageId, rawEvent) {
|
|
151
|
-
this._events.messageEnd.emit({ messageId, rawEvent });
|
|
152
|
-
}
|
|
153
|
-
_emitToolCall(event, rawEvent) {
|
|
154
|
-
this._events.toolCall.emit({ ...event, rawEvent });
|
|
155
|
-
}
|
|
156
|
-
_emitToolCallStart(event, rawEvent) {
|
|
157
|
-
this._events.toolCallStart.emit({ ...event, rawEvent });
|
|
158
|
-
}
|
|
159
|
-
_emitToolCallArgs(event, rawEvent) {
|
|
160
|
-
this._events.toolCallArgs.emit({ ...event, rawEvent });
|
|
161
|
-
}
|
|
162
|
-
_emitToolCallEnd(event, rawEvent) {
|
|
163
|
-
this._events.toolCallEnd.emit({ ...event, rawEvent });
|
|
164
|
-
}
|
|
165
|
-
_emitToolResult(event, rawEvent) {
|
|
166
|
-
this._events.toolResult.emit({ ...event, rawEvent });
|
|
167
|
-
}
|
|
168
|
-
/**
|
|
169
|
-
* Announce that a tool call renders as an MCP-app widget. Also the way to remount
|
|
170
|
-
* widgets restored from history: call it per widget after `setMessages`/`setThreadState`
|
|
171
|
-
* — the resource is resolved and stamped onto the restored (already finalized) tool
|
|
172
|
-
* call. If the tool call isn't in state yet, the resource is held and applied when it
|
|
173
|
-
* arrives.
|
|
174
|
-
*/
|
|
175
|
-
_emitMcpUiResource(event, rawEvent) {
|
|
176
|
-
this._events.mcpUiResource.emit({ ...event, rawEvent });
|
|
177
|
-
}
|
|
178
|
-
emitFileUpload(file, callbacks) {
|
|
179
|
-
this._events.fileUpload.emit({ file, ...callbacks });
|
|
180
|
-
}
|
|
181
|
-
emitFileRemove(fileId, callbacks) {
|
|
182
|
-
this._events.fileRemove.emit({ fileId, ...callbacks });
|
|
183
|
-
}
|
|
184
|
-
_emitError(message) {
|
|
185
|
-
this._events.error.emit({ message });
|
|
186
|
-
}
|
|
187
|
-
_emitCustomEvent(name, value, rawEvent) {
|
|
188
|
-
this._events.customEvent.emit({ name, value, rawEvent });
|
|
189
|
-
}
|
|
190
|
-
_emitRawEvent(event, rawEvent) {
|
|
191
|
-
this._events.rawEvent.emit({ event, rawEvent });
|
|
192
|
-
}
|
|
193
|
-
_emitRunStartedEvent(threadId, runId, rawEvent) {
|
|
194
|
-
this._events.runStartedEvent.emit({ threadId, runId, rawEvent });
|
|
195
|
-
}
|
|
196
|
-
_emitStepStarted(stepName, rawEvent) {
|
|
197
|
-
this._events.stepStarted.emit({ stepName, rawEvent });
|
|
198
|
-
}
|
|
199
|
-
_emitStepFinished(stepName, rawEvent) {
|
|
200
|
-
this._events.stepFinished.emit({ stepName, rawEvent });
|
|
201
|
-
}
|
|
202
|
-
_emitStateSnapshot(state, rawEvent) {
|
|
203
|
-
this._events.stateSnapshot.emit({ state, rawEvent });
|
|
204
|
-
}
|
|
205
|
-
_emitStateDelta(delta, rawEvent) {
|
|
206
|
-
this._events.stateDelta.emit({ delta, rawEvent });
|
|
207
|
-
}
|
|
208
|
-
_emitActivitySnapshot(activity, activityMessage, existingMessage, rawEvent) {
|
|
209
|
-
this._events.activitySnapshot.emit({ activity, activityMessage, existingMessage, rawEvent });
|
|
210
|
-
}
|
|
211
|
-
_emitActivityDelta(delta, activityMessage, rawEvent) {
|
|
212
|
-
this._events.activityDelta.emit({ delta, activityMessage, rawEvent });
|
|
213
|
-
}
|
|
214
|
-
_updateState(updates) {
|
|
215
|
-
this._state = { ...this._state, ...updates };
|
|
216
|
-
this._events.stateChange.emit(this.getState());
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
export {
|
|
220
|
-
AgentAdapter
|
|
221
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { AgentAdapter } from './agent-adapter.js';
|
|
2
|
-
import { ChatMessage, ToolCall, ToolDefinition } from './types.js';
|
|
3
|
-
export interface AgentRunnerConfig {
|
|
4
|
-
/** The adapter instance that handles communication with the AI model */
|
|
5
|
-
adapter: AgentAdapter;
|
|
6
|
-
/** The user prompt to send to the agent */
|
|
7
|
-
prompt: string;
|
|
8
|
-
/** Optional tools the agent can call during execution */
|
|
9
|
-
tools?: ToolDefinition[];
|
|
10
|
-
/** Execution mode: 'one-shot' stops after first response, 'multi-turn' allows tool usage loops. @default 'one-shot' */
|
|
11
|
-
mode?: 'one-shot' | 'multi-turn';
|
|
12
|
-
/** Maximum conversation turns in multi-turn mode to prevent infinite loops. @default 20 */
|
|
13
|
-
maxTurns?: number;
|
|
14
|
-
/** Callback fired when agent starts generating a new message */
|
|
15
|
-
onStart?: (messageId: string) => void;
|
|
16
|
-
/** Callback fired for each text chunk as it streams in */
|
|
17
|
-
onDelta?: (delta: string) => void;
|
|
18
|
-
/** Callback fired when agent requests a tool call */
|
|
19
|
-
onToolCall?: (toolCall: ToolCall) => void;
|
|
20
|
-
/** Callback fired when execution completes with final result */
|
|
21
|
-
onComplete?: (result: AgentRunnerResult) => void;
|
|
22
|
-
}
|
|
23
|
-
export interface AgentRunnerResult {
|
|
24
|
-
/** Complete message history including user, assistant, and tool messages */
|
|
25
|
-
messages: ChatMessage[];
|
|
26
|
-
/** The final assistant message returned by the agent */
|
|
27
|
-
finalMessage: ChatMessage;
|
|
28
|
-
/** All tool calls executed during the conversation */
|
|
29
|
-
toolCalls: ToolCall[];
|
|
30
|
-
/** Number of conversation turns completed */
|
|
31
|
-
turns: number;
|
|
32
|
-
/** Whether execution completed successfully without errors */
|
|
33
|
-
success: boolean;
|
|
34
|
-
/** Reason execution stopped: 'text-response' (natural completion), 'max-turns' (hit turn limit), 'error' (failed), or 'one-shot-complete' (single turn mode) */
|
|
35
|
-
stoppedReason: 'text-response' | 'max-turns' | 'error' | 'one-shot-complete';
|
|
36
|
-
}
|
|
37
|
-
export declare class AgentRunner {
|
|
38
|
-
#private;
|
|
39
|
-
private constructor();
|
|
40
|
-
static run(config: AgentRunnerConfig): Promise<AgentRunnerResult>;
|
|
41
|
-
}
|
|
@@ -1,265 +0,0 @@
|
|
|
1
|
-
import { SubscriptionManager } from "./event-emitter.mjs";
|
|
2
|
-
import { generateId } from "./utils.mjs";
|
|
3
|
-
class AgentRunner {
|
|
4
|
-
constructor() {
|
|
5
|
-
}
|
|
6
|
-
static async run(config) {
|
|
7
|
-
const {
|
|
8
|
-
adapter,
|
|
9
|
-
tools,
|
|
10
|
-
prompt,
|
|
11
|
-
mode = "one-shot",
|
|
12
|
-
maxTurns = 20,
|
|
13
|
-
onStart,
|
|
14
|
-
onDelta,
|
|
15
|
-
onToolCall,
|
|
16
|
-
onComplete
|
|
17
|
-
} = config;
|
|
18
|
-
await this.#ensureConnected(adapter);
|
|
19
|
-
if (tools) {
|
|
20
|
-
adapter.setTools(tools);
|
|
21
|
-
}
|
|
22
|
-
const userMessage = this.#createUserMessage(prompt);
|
|
23
|
-
return this.#executePrompt(adapter, userMessage, tools, mode, maxTurns, {
|
|
24
|
-
onStart,
|
|
25
|
-
onDelta,
|
|
26
|
-
onToolCall,
|
|
27
|
-
onComplete
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
static #executePrompt(adapter, userMessage, tools, mode, maxTurns, callbacks) {
|
|
31
|
-
return new Promise((resolve, reject) => {
|
|
32
|
-
const state = {
|
|
33
|
-
mode,
|
|
34
|
-
maxTurns,
|
|
35
|
-
turns: 0,
|
|
36
|
-
messages: [userMessage],
|
|
37
|
-
currentMessage: null,
|
|
38
|
-
toolCalls: [],
|
|
39
|
-
toolResultMessages: /* @__PURE__ */ new Map(),
|
|
40
|
-
pendingToolExecutions: /* @__PURE__ */ new Set(),
|
|
41
|
-
runFinished: false,
|
|
42
|
-
hasTextResponse: false,
|
|
43
|
-
hasErrors: false,
|
|
44
|
-
resolved: false,
|
|
45
|
-
subscriptions: new SubscriptionManager(),
|
|
46
|
-
onToolCall: callbacks.onToolCall,
|
|
47
|
-
resolve,
|
|
48
|
-
reject
|
|
49
|
-
};
|
|
50
|
-
state.subscriptions.add(
|
|
51
|
-
adapter.onMessageStart(this.#createMessageStartHandler(state, callbacks.onStart)),
|
|
52
|
-
adapter.onMessageDelta(this.#createMessageDeltaHandler(state, callbacks.onDelta)),
|
|
53
|
-
adapter.onRunFinished(this.#createFinishHandler(state, callbacks.onComplete)),
|
|
54
|
-
adapter.onError(this.#createErrorHandler(state)),
|
|
55
|
-
adapter.onToolCall(this.#createToolCallHandler(adapter, tools, state))
|
|
56
|
-
);
|
|
57
|
-
adapter.sendMessage([userMessage]);
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
static async #ensureConnected(adapter) {
|
|
61
|
-
if (!adapter.isConnected) {
|
|
62
|
-
await adapter.connect();
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
static #createUserMessage(prompt) {
|
|
66
|
-
return {
|
|
67
|
-
id: generateId(),
|
|
68
|
-
role: "user",
|
|
69
|
-
content: prompt,
|
|
70
|
-
timestamp: Date.now(),
|
|
71
|
-
status: "complete"
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
static #createMessageStartHandler(state, onStart) {
|
|
75
|
-
return (event) => {
|
|
76
|
-
state.turns++;
|
|
77
|
-
state.currentMessage = {
|
|
78
|
-
id: event.messageId,
|
|
79
|
-
role: "assistant",
|
|
80
|
-
content: "",
|
|
81
|
-
timestamp: Date.now(),
|
|
82
|
-
status: "streaming"
|
|
83
|
-
};
|
|
84
|
-
onStart?.(event.messageId);
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
static #createMessageDeltaHandler(state, onDelta) {
|
|
88
|
-
return (event) => {
|
|
89
|
-
if (state.currentMessage) {
|
|
90
|
-
state.currentMessage.content = (state.currentMessage.content ?? "") + event.delta;
|
|
91
|
-
if (event.delta.trim().length > 0) {
|
|
92
|
-
state.hasTextResponse = true;
|
|
93
|
-
}
|
|
94
|
-
onDelta?.(event.delta);
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
static #createFinishHandler(state, onComplete) {
|
|
99
|
-
return () => {
|
|
100
|
-
state.runFinished = true;
|
|
101
|
-
this.#tryFinish(state, onComplete);
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
static #createErrorHandler(state) {
|
|
105
|
-
return (event) => {
|
|
106
|
-
if (state.resolved) {
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
state.resolved = true;
|
|
110
|
-
state.subscriptions.unsubscribe();
|
|
111
|
-
state.reject(new Error(event.message));
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
static #createToolCallHandler(adapter, tools, state) {
|
|
115
|
-
return async (event) => {
|
|
116
|
-
await this.#executeToolCall(event, tools, state, adapter);
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
static #createToolResponse(toolName, handlerReturn) {
|
|
120
|
-
if (typeof handlerReturn === "string") {
|
|
121
|
-
return handlerReturn;
|
|
122
|
-
}
|
|
123
|
-
if (handlerReturn && typeof handlerReturn === "object") {
|
|
124
|
-
return handlerReturn;
|
|
125
|
-
}
|
|
126
|
-
return `Tool '${toolName}' executed successfully`;
|
|
127
|
-
}
|
|
128
|
-
static #buildMessageHistory(state) {
|
|
129
|
-
const messages = [...state.messages];
|
|
130
|
-
if (state.currentMessage) {
|
|
131
|
-
const assistantMessage = {
|
|
132
|
-
...state.currentMessage,
|
|
133
|
-
status: "complete",
|
|
134
|
-
toolCalls: state.toolCalls.filter((tc) => tc.messageId === state.currentMessage?.id)
|
|
135
|
-
};
|
|
136
|
-
messages.push(assistantMessage);
|
|
137
|
-
}
|
|
138
|
-
for (const toolCall of state.toolCalls) {
|
|
139
|
-
if (toolCall.status === "complete" || toolCall.status === "error") {
|
|
140
|
-
let toolMessage = state.toolResultMessages.get(toolCall.id);
|
|
141
|
-
if (!toolMessage) {
|
|
142
|
-
toolMessage = {
|
|
143
|
-
id: generateId(),
|
|
144
|
-
role: "tool",
|
|
145
|
-
content: JSON.stringify(toolCall.result),
|
|
146
|
-
timestamp: Date.now(),
|
|
147
|
-
status: "complete",
|
|
148
|
-
toolCallId: toolCall.id
|
|
149
|
-
};
|
|
150
|
-
state.toolResultMessages.set(toolCall.id, toolMessage);
|
|
151
|
-
}
|
|
152
|
-
messages.push(toolMessage);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
return messages;
|
|
156
|
-
}
|
|
157
|
-
static async #executeToolCall(event, tools, state, adapter) {
|
|
158
|
-
const execution = (async () => {
|
|
159
|
-
let result;
|
|
160
|
-
const toolDef = tools?.find((t) => t.name === event.name);
|
|
161
|
-
const toolCall = {
|
|
162
|
-
id: event.id,
|
|
163
|
-
messageId: state.currentMessage?.id ?? "",
|
|
164
|
-
name: event.name,
|
|
165
|
-
args: event.args,
|
|
166
|
-
status: "executing",
|
|
167
|
-
type: toolDef ? "client" : "agent"
|
|
168
|
-
};
|
|
169
|
-
state.toolCalls.push(toolCall);
|
|
170
|
-
state.onToolCall?.(toolCall);
|
|
171
|
-
if (toolDef?.handler) {
|
|
172
|
-
try {
|
|
173
|
-
const context = {
|
|
174
|
-
args: event.args,
|
|
175
|
-
toolCallId: event.id,
|
|
176
|
-
toolName: event.name,
|
|
177
|
-
signal: void 0
|
|
178
|
-
};
|
|
179
|
-
const handlerReturn = await toolDef.handler(context);
|
|
180
|
-
result = this.#createToolResponse(event.name, handlerReturn);
|
|
181
|
-
} catch (error) {
|
|
182
|
-
const err = error;
|
|
183
|
-
console.error(`Tool handler error [${event.name}]:`, err);
|
|
184
|
-
result = { error: err.message };
|
|
185
|
-
toolCall.status = "error";
|
|
186
|
-
toolCall.result = result;
|
|
187
|
-
state.hasErrors = true;
|
|
188
|
-
if (state.mode === "multi-turn") {
|
|
189
|
-
state.runFinished = false;
|
|
190
|
-
state.hasTextResponse = false;
|
|
191
|
-
const messages = this.#buildMessageHistory(state);
|
|
192
|
-
adapter.sendToolResult(event.id, result, messages);
|
|
193
|
-
}
|
|
194
|
-
return;
|
|
195
|
-
}
|
|
196
|
-
} else {
|
|
197
|
-
result = this.#createToolResponse(event.name);
|
|
198
|
-
}
|
|
199
|
-
toolCall.status = "complete";
|
|
200
|
-
toolCall.result = result;
|
|
201
|
-
if (state.mode === "multi-turn") {
|
|
202
|
-
state.runFinished = false;
|
|
203
|
-
state.hasTextResponse = false;
|
|
204
|
-
const messages = this.#buildMessageHistory(state);
|
|
205
|
-
adapter.sendToolResult(event.id, result, messages);
|
|
206
|
-
}
|
|
207
|
-
})();
|
|
208
|
-
state.pendingToolExecutions.add(execution);
|
|
209
|
-
execution.finally(() => {
|
|
210
|
-
state.pendingToolExecutions.delete(execution);
|
|
211
|
-
this.#tryFinish(state);
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
static #tryFinish(state, onComplete) {
|
|
215
|
-
if (state.resolved || state.pendingToolExecutions.size > 0) {
|
|
216
|
-
return;
|
|
217
|
-
}
|
|
218
|
-
const shouldFinish = state.mode === "one-shot" && state.runFinished || state.mode === "multi-turn" && state.runFinished && (state.hasTextResponse || state.turns >= state.maxTurns);
|
|
219
|
-
if (!shouldFinish) {
|
|
220
|
-
return;
|
|
221
|
-
}
|
|
222
|
-
state.resolved = true;
|
|
223
|
-
state.subscriptions.unsubscribe();
|
|
224
|
-
const messages = this.#buildMessageHistory(state);
|
|
225
|
-
const finalMessage = state.currentMessage ? this.#buildSuccessResult(state) : this.#buildEmptyMessage();
|
|
226
|
-
let stoppedReason;
|
|
227
|
-
if (state.hasErrors) {
|
|
228
|
-
stoppedReason = "error";
|
|
229
|
-
} else if (state.mode === "one-shot") {
|
|
230
|
-
stoppedReason = "one-shot-complete";
|
|
231
|
-
} else if (state.turns >= state.maxTurns) {
|
|
232
|
-
stoppedReason = "max-turns";
|
|
233
|
-
} else {
|
|
234
|
-
stoppedReason = "text-response";
|
|
235
|
-
}
|
|
236
|
-
const result = {
|
|
237
|
-
messages,
|
|
238
|
-
finalMessage,
|
|
239
|
-
toolCalls: state.toolCalls,
|
|
240
|
-
turns: state.turns,
|
|
241
|
-
success: !state.hasErrors,
|
|
242
|
-
stoppedReason
|
|
243
|
-
};
|
|
244
|
-
onComplete?.(result);
|
|
245
|
-
state.resolve(result);
|
|
246
|
-
}
|
|
247
|
-
static #buildSuccessResult(state) {
|
|
248
|
-
return {
|
|
249
|
-
...state.currentMessage,
|
|
250
|
-
status: "complete"
|
|
251
|
-
};
|
|
252
|
-
}
|
|
253
|
-
static #buildEmptyMessage() {
|
|
254
|
-
return {
|
|
255
|
-
id: generateId(),
|
|
256
|
-
role: "assistant",
|
|
257
|
-
content: "",
|
|
258
|
-
timestamp: Date.now(),
|
|
259
|
-
status: "complete"
|
|
260
|
-
};
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
export {
|
|
264
|
-
AgentRunner
|
|
265
|
-
};
|
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
import { LitElement, PropertyValues } from 'lit';
|
|
2
|
-
import { Ref } from 'lit/directives/ref.js';
|
|
3
|
-
import { AgentInfo } from '../ai-agent-info';
|
|
4
|
-
import { ForgeAiChatHeaderAgentChangeEventData } from '../ai-chat-header';
|
|
5
|
-
import { AiMessageThreadComponent, ForgeAiMessageThreadThumbsEventData } from '../ai-message-thread';
|
|
6
|
-
import { ForgeAiAttachmentRemoveEventData } from '../ai-attachment';
|
|
7
|
-
import { ForgeAiFilePickerChangeEventData, ForgeAiFilePickerErrorEventData } from '../ai-file-picker';
|
|
8
|
-
import { AiPromptComponent, ForgeAiPromptCommandEventData, ForgeAiPromptSendEventData } from '../ai-prompt';
|
|
9
|
-
import { ForgeAiSuggestionsEventData, Suggestion } from '../ai-suggestions';
|
|
10
|
-
import { ForgeAiVoiceInputResultEvent } from '../ai-voice-input';
|
|
11
|
-
import { AgentAdapter } from './agent-adapter.js';
|
|
12
|
-
import { ChatbotCoreController } from '../core/chatbot-core-controller.js';
|
|
13
|
-
import { Agent, ChatMessage, ClientMessageInput, ContextItem, HeadingLevel, MessageItem, SlashCommand, ThreadState, ToolDefinition } from './types.js';
|
|
14
|
-
export type FeatureToggle = 'on' | 'off';
|
|
15
|
-
export declare abstract class AiChatbotBase extends LitElement {
|
|
16
|
-
#private;
|
|
17
|
-
protected abstract _messageThreadRef: Ref<AiMessageThreadComponent>;
|
|
18
|
-
protected abstract _promptRef: Ref<AiPromptComponent>;
|
|
19
|
-
adapter?: AgentAdapter;
|
|
20
|
-
fileUpload: FeatureToggle;
|
|
21
|
-
maxFileSize: number;
|
|
22
|
-
acceptedFileTypes: string;
|
|
23
|
-
voiceInput: FeatureToggle;
|
|
24
|
-
placeholder: string;
|
|
25
|
-
suggestions?: Suggestion[];
|
|
26
|
-
enableReactions: boolean;
|
|
27
|
-
titleText: string;
|
|
28
|
-
headingLevel: HeadingLevel;
|
|
29
|
-
debugMode: boolean;
|
|
30
|
-
disclaimerText: string | null | undefined;
|
|
31
|
-
debugCommand: FeatureToggle;
|
|
32
|
-
exportOption: FeatureToggle;
|
|
33
|
-
clearOption: FeatureToggle;
|
|
34
|
-
agentInfo?: AgentInfo;
|
|
35
|
-
agents: Agent[];
|
|
36
|
-
selectedAgentId?: string;
|
|
37
|
-
contextItems: ContextItem[];
|
|
38
|
-
mcpAppSandboxUrl?: string;
|
|
39
|
-
/**
|
|
40
|
-
* Theme fed into an MCP-app widget's `hostContext.theme`. The chatbot's own appearance
|
|
41
|
-
* comes from Forge tokens and is unaffected. Set this whenever the app switches between
|
|
42
|
-
* light and dark: it is the signal that re-sends `theme` and the Forge-derived
|
|
43
|
-
* `styles.variables` to widgets, since token changes alone can't be detected. Absent →
|
|
44
|
-
* follows `prefers-color-scheme`.
|
|
45
|
-
*/
|
|
46
|
-
mcpAppTheme?: 'light' | 'dark';
|
|
47
|
-
private _mcpAppHost;
|
|
48
|
-
/**
|
|
49
|
-
* Sends `ui/resource-teardown` to mounted MCP-app widgets (all, or only `toolCallIds`) and
|
|
50
|
-
* releases them immediately, without waiting for acks. The adapter then drops any state it
|
|
51
|
-
* holds for them (e.g. a pending model context).
|
|
52
|
-
*/
|
|
53
|
-
protected _teardownMcpAppViews({ toolCallIds }?: {
|
|
54
|
-
toolCallIds?: string[];
|
|
55
|
-
}): void;
|
|
56
|
-
protected _coreController: ChatbotCoreController;
|
|
57
|
-
protected get _isStreaming(): boolean;
|
|
58
|
-
protected get _isUploading(): boolean;
|
|
59
|
-
protected get _tools(): Map<string, ToolDefinition>;
|
|
60
|
-
protected get _messageItems(): MessageItem[];
|
|
61
|
-
protected get _hasMessages(): boolean;
|
|
62
|
-
protected get _allContextItems(): ContextItem[];
|
|
63
|
-
connectedCallback(): void;
|
|
64
|
-
disconnectedCallback(): void;
|
|
65
|
-
willUpdate(changedProperties: PropertyValues<this>): void;
|
|
66
|
-
protected _onConnected(): void;
|
|
67
|
-
protected get _slashCommands(): SlashCommand[];
|
|
68
|
-
protected _handleSlashCommand(evt: CustomEvent<ForgeAiPromptCommandEventData>): void;
|
|
69
|
-
protected _handleInfo(): void;
|
|
70
|
-
protected _handleAgentChange(event: CustomEvent<ForgeAiChatHeaderAgentChangeEventData>): void;
|
|
71
|
-
protected _handleDebugToggle(): void;
|
|
72
|
-
protected _handleAttachmentRemove(evt: CustomEvent<ForgeAiAttachmentRemoveEventData>): void;
|
|
73
|
-
protected _handleContextChipRemove(evt: CustomEvent<{
|
|
74
|
-
id: string;
|
|
75
|
-
item: ContextItem;
|
|
76
|
-
}>): void;
|
|
77
|
-
protected _handlePromptContextRemove(evt: CustomEvent<{
|
|
78
|
-
id: string;
|
|
79
|
-
item: ContextItem;
|
|
80
|
-
}>): void;
|
|
81
|
-
protected _handleSend(evt: CustomEvent<ForgeAiPromptSendEventData>): Promise<void>;
|
|
82
|
-
protected _handleStop(): void;
|
|
83
|
-
protected _handleCancel(): void;
|
|
84
|
-
protected _handleCopy(evt: CustomEvent<{
|
|
85
|
-
messageId: string;
|
|
86
|
-
}>): Promise<void>;
|
|
87
|
-
protected _handleUserCopy(evt: CustomEvent<{
|
|
88
|
-
messageId: string;
|
|
89
|
-
}>): Promise<void>;
|
|
90
|
-
protected _handleUserResend(evt: CustomEvent<{
|
|
91
|
-
messageId: string;
|
|
92
|
-
}>): void;
|
|
93
|
-
protected _handleUserEdit(evt: CustomEvent<{
|
|
94
|
-
messageId: string;
|
|
95
|
-
content: string;
|
|
96
|
-
}>): void;
|
|
97
|
-
protected _handleResend(evt: CustomEvent<{
|
|
98
|
-
messageId: string;
|
|
99
|
-
}>): void;
|
|
100
|
-
protected _handleFeedback(evt: CustomEvent<ForgeAiMessageThreadThumbsEventData>, type: 'positive' | 'negative'): void;
|
|
101
|
-
protected _handleThumbsUp(evt: CustomEvent<ForgeAiMessageThreadThumbsEventData>): void;
|
|
102
|
-
protected _handleThumbsDown(evt: CustomEvent<ForgeAiMessageThreadThumbsEventData>): void;
|
|
103
|
-
protected _handleFileSelect(evt: CustomEvent<ForgeAiFilePickerChangeEventData>): void;
|
|
104
|
-
protected _handleFileError(evt: CustomEvent<ForgeAiFilePickerErrorEventData>): void;
|
|
105
|
-
protected _handleSuggestionSelect(evt: CustomEvent<ForgeAiSuggestionsEventData>): Promise<void>;
|
|
106
|
-
protected _handleVoiceInputResult(evt: CustomEvent<ForgeAiVoiceInputResultEvent>): void;
|
|
107
|
-
/**
|
|
108
|
-
* Clears all messages from the chat.
|
|
109
|
-
*
|
|
110
|
-
* This is a lower-level operation that removes message history without
|
|
111
|
-
* the semantic meaning of "starting a new conversation". For user-facing
|
|
112
|
-
* "new chat" actions, prefer {@link startNewChat} which provides
|
|
113
|
-
* conversation-level cleanup.
|
|
114
|
-
*
|
|
115
|
-
* @returns true if messages were cleared, false if prevented via event.preventDefault()
|
|
116
|
-
* @fires forge-ai-chatbot-clear - Cancelable event fired before clearing
|
|
117
|
-
*/
|
|
118
|
-
clearMessages(): boolean;
|
|
119
|
-
/**
|
|
120
|
-
* Starts a new chat conversation.
|
|
121
|
-
*
|
|
122
|
-
* This clears all messages and resets the conversation to a fresh state.
|
|
123
|
-
* Use this when the user explicitly wants to begin a new conversation.
|
|
124
|
-
*
|
|
125
|
-
* Contrast with {@link clearMessages}, which fires events and can be prevented.
|
|
126
|
-
* This method does not fire events - it's meant for programmatic use.
|
|
127
|
-
* For user-initiated actions, use event handlers that fire events before calling this.
|
|
128
|
-
*
|
|
129
|
-
* Subclasses may override this to add conversation-specific cleanup like
|
|
130
|
-
* resetting thread IDs or closing panels.
|
|
131
|
-
*/
|
|
132
|
-
startNewChat(): void;
|
|
133
|
-
getMessages(): ChatMessage[];
|
|
134
|
-
setMessages(messages: ChatMessage[]): void;
|
|
135
|
-
/**
|
|
136
|
-
* Inserts or upserts a client-only status message into the thread - never sent to
|
|
137
|
-
* the agent adapter and never included in the conversation history the adapter sees.
|
|
138
|
-
* Use this for host-driven UI feedback (e.g. "Your session expired", upload progress)
|
|
139
|
-
* instead of splicing {@link getMessages}/{@link setMessages} directly.
|
|
140
|
-
*
|
|
141
|
-
* Safe to call at any time, including while a response is streaming - it never
|
|
142
|
-
* finalizes or otherwise touches the in-progress response.
|
|
143
|
-
*
|
|
144
|
-
* @param message - Content and optional kind ('text' | 'info' | 'warning' | 'error' | 'success'),
|
|
145
|
-
* header, and actions. Pass the same `id` on a later call to upsert (replace) a
|
|
146
|
-
* previously added message.
|
|
147
|
-
* @returns The message id (generated if not provided).
|
|
148
|
-
*/
|
|
149
|
-
addClientMessage(message: ClientMessageInput): string;
|
|
150
|
-
/**
|
|
151
|
-
* Removes a client-only message previously added via {@link addClientMessage}.
|
|
152
|
-
* No-ops if no message with that id exists. Safe to call at any time, including
|
|
153
|
-
* while a response is streaming. Removal is never automatic - call this when your
|
|
154
|
-
* host logic determines the message is no longer relevant.
|
|
155
|
-
*/
|
|
156
|
-
removeClientMessage(id: string): void;
|
|
157
|
-
sendMessage(content: string, files?: File[]): Promise<void>;
|
|
158
|
-
abort(): void;
|
|
159
|
-
/**
|
|
160
|
-
* Re-sends the Forge-derived `styles.variables` to every MCP-app widget. Call after
|
|
161
|
-
* changing Forge tokens without a light/dark switch (e.g. a brand change); for light/dark,
|
|
162
|
-
* set {@link mcpAppTheme} instead.
|
|
163
|
-
*/
|
|
164
|
-
refreshMcpAppStyles(): void;
|
|
165
|
-
scrollToBottom({ behavior }?: {
|
|
166
|
-
behavior?: ScrollBehavior;
|
|
167
|
-
}): Promise<void>;
|
|
168
|
-
abstract focus(): void;
|
|
169
|
-
getThreadState(): ThreadState;
|
|
170
|
-
getSelectedAgent(): Agent | undefined;
|
|
171
|
-
setThreadState(threadState: ThreadState): Promise<void>;
|
|
172
|
-
protected _dispatchHostEvent(config: {
|
|
173
|
-
type: string;
|
|
174
|
-
detail?: unknown;
|
|
175
|
-
cancelable?: boolean;
|
|
176
|
-
}): CustomEvent;
|
|
177
|
-
protected _handleExport(): void;
|
|
178
|
-
}
|