@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,61 +0,0 @@
|
|
|
1
|
-
import { McpAppHostCapabilities, McpAppHostContext, McpAppResourceCsp, McpAppResourcePermissions, ToolCall } from '../../ai-chatbot';
|
|
2
|
-
import { IMcpAppBridge, McpAppViewToolResult } from './mcp-app-bridge-types.js';
|
|
3
|
-
/**
|
|
4
|
-
* The view→host handler slots the element supplies; registered on the bridge BEFORE
|
|
5
|
-
* `connect()` so they are live for the very first widget request.
|
|
6
|
-
*/
|
|
7
|
-
export type McpAppHandlers = Pick<IMcpAppBridge, 'oncalltool' | 'onreadresource' | 'onopenlink' | 'onmessage' | 'onloggingmessage' | 'onsizechange' | 'onrequestdisplaymode' | 'onupdatemodelcontext' | 'onrequestteardown'>;
|
|
8
|
-
export interface McpAppConnectConfig {
|
|
9
|
-
iframe: HTMLIFrameElement;
|
|
10
|
-
sandboxUrl: string;
|
|
11
|
-
html: string;
|
|
12
|
-
hostContext: McpAppHostContext;
|
|
13
|
-
hostCapabilities: McpAppHostCapabilities;
|
|
14
|
-
csp: McpAppResourceCsp;
|
|
15
|
-
permissions: McpAppResourcePermissions;
|
|
16
|
-
sandbox?: string;
|
|
17
|
-
handlers: McpAppHandlers;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Compose the CSP header value the sandbox server expects on `?csp=` (spec "CSP
|
|
21
|
-
* Construction from Metadata"). Empty allow-lists produce the restrictive default:
|
|
22
|
-
* `connect-src 'none'`, `frame-src 'none'`, `base-uri 'self'`, `object-src 'none'`.
|
|
23
|
-
*/
|
|
24
|
-
export declare function buildCspHeader(csp: McpAppResourceCsp): string;
|
|
25
|
-
/**
|
|
26
|
-
* The requested permissions the sandbox can enforce, normalized to the spec shape. A key
|
|
27
|
-
* is requested when present (`{ camera: {} }`); `false`/`null` values are ignored.
|
|
28
|
-
*/
|
|
29
|
-
export declare function enforcedPermissions(permissions: McpAppResourcePermissions): McpAppResourcePermissions;
|
|
30
|
-
/** Map requested permissions onto the iframe `allow` attribute. */
|
|
31
|
-
export declare function buildAllowAttribute(permissions: McpAppResourcePermissions): string;
|
|
32
|
-
/**
|
|
33
|
-
* Build the View's `CallToolResult` from the raw MCP result + structured content — never
|
|
34
|
-
* from the model-facing `result`. When the backend omitted a field (size caps) the View
|
|
35
|
-
* gets what remains; when both are missing it gets an empty `content` array, flagged
|
|
36
|
-
* `isError` only if the tool call itself errored.
|
|
37
|
-
*/
|
|
38
|
-
export declare function buildViewToolResult(toolCall: ToolCall): McpAppViewToolResult;
|
|
39
|
-
/**
|
|
40
|
-
* Drives an {@link IMcpAppBridge} through the sandbox handshake and the streaming
|
|
41
|
-
* tool-call lifecycle. Bridge-agnostic — talks to the interface only.
|
|
42
|
-
*
|
|
43
|
-
* The controller owns the OUTER sandbox iframe DOM (its `src` with the `?csp=` param and
|
|
44
|
-
* its `allow` attribute); the bridge owns the postMessage lifecycle.
|
|
45
|
-
*/
|
|
46
|
-
export declare class McpAppBridgeController {
|
|
47
|
-
#private;
|
|
48
|
-
constructor(bridge: IMcpAppBridge);
|
|
49
|
-
connect(config: McpAppConnectConfig): Promise<void>;
|
|
50
|
-
/**
|
|
51
|
-
* Reconcile the widget with the current tool-call state. Streams partial args, sends
|
|
52
|
-
* final args once, then exactly one of `tool-result` (complete/error) or
|
|
53
|
-
* `tool-cancelled` — all gated on the `initialized` handshake. Safe to call on every
|
|
54
|
-
* `toolCall` update.
|
|
55
|
-
*/
|
|
56
|
-
syncToolCall(toolCall: ToolCall): void;
|
|
57
|
-
/** Forward a host-context change; the bridge holds it until the View is initialized. */
|
|
58
|
-
sendHostContextChange(hostContext: McpAppHostContext): void;
|
|
59
|
-
/** Send `ui/resource-teardown` and release the bridge; the iframe is removed without waiting for the ack. */
|
|
60
|
-
teardown(): void;
|
|
61
|
-
}
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
const PERMISSION_FEATURES = {
|
|
2
|
-
camera: "camera",
|
|
3
|
-
microphone: "microphone",
|
|
4
|
-
geolocation: "geolocation",
|
|
5
|
-
clipboardWrite: "clipboard-write"
|
|
6
|
-
};
|
|
7
|
-
const UNSAFE_CSP_SOURCE = /[\s;,'"]/;
|
|
8
|
-
function cspSources(domains, fallback) {
|
|
9
|
-
const safe = (domains ?? []).filter((domain) => !!domain && !UNSAFE_CSP_SOURCE.test(domain));
|
|
10
|
-
return safe.length ? safe.join(" ") : fallback;
|
|
11
|
-
}
|
|
12
|
-
function buildCspHeader(csp) {
|
|
13
|
-
const resource = cspSources(csp.resourceDomains, "");
|
|
14
|
-
const extra = resource ? ` ${resource}` : "";
|
|
15
|
-
return [
|
|
16
|
-
"default-src 'none'",
|
|
17
|
-
`script-src 'self' 'unsafe-inline'${extra}`,
|
|
18
|
-
`style-src 'self' 'unsafe-inline'${extra}`,
|
|
19
|
-
`img-src 'self' data:${extra}`,
|
|
20
|
-
`media-src 'self' data:${extra}`,
|
|
21
|
-
`font-src 'self' data:${extra}`,
|
|
22
|
-
`connect-src ${cspSources(csp.connectDomains, "'none'")}`,
|
|
23
|
-
`frame-src ${cspSources(csp.frameDomains, "'none'")}`,
|
|
24
|
-
`base-uri ${cspSources(csp.baseUriDomains, "'self'")}`,
|
|
25
|
-
"object-src 'none'"
|
|
26
|
-
].join("; ");
|
|
27
|
-
}
|
|
28
|
-
function enforcedPermissions(permissions) {
|
|
29
|
-
const keys = Object.keys(PERMISSION_FEATURES).filter((key) => {
|
|
30
|
-
const value = permissions[key];
|
|
31
|
-
return value !== void 0 && value !== null && value !== false;
|
|
32
|
-
});
|
|
33
|
-
return Object.fromEntries(keys.map((key) => [key, {}]));
|
|
34
|
-
}
|
|
35
|
-
function buildAllowAttribute(permissions) {
|
|
36
|
-
return Object.keys(enforcedPermissions(permissions)).map((key) => PERMISSION_FEATURES[key]).join("; ");
|
|
37
|
-
}
|
|
38
|
-
function buildViewToolResult(toolCall) {
|
|
39
|
-
const mcpResult = toolCall.mcpResultOmitted ? void 0 : toolCall.mcpResult;
|
|
40
|
-
const structuredContent = toolCall.structuredContentOmitted ? void 0 : toolCall.structuredContent;
|
|
41
|
-
const isError = mcpResult?.isError ?? (toolCall.status === "error" || void 0);
|
|
42
|
-
return {
|
|
43
|
-
content: Array.isArray(mcpResult?.content) ? mcpResult.content : [],
|
|
44
|
-
...structuredContent !== void 0 ? { structuredContent } : {},
|
|
45
|
-
...isError !== void 0 ? { isError } : {},
|
|
46
|
-
...mcpResult?._meta !== void 0 ? { _meta: mcpResult._meta } : {}
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
class McpAppBridgeController {
|
|
50
|
-
#bridge;
|
|
51
|
-
#connected = null;
|
|
52
|
-
#lastArgsSent = null;
|
|
53
|
-
#inputSent = false;
|
|
54
|
-
#outcome = "pending";
|
|
55
|
-
constructor(bridge) {
|
|
56
|
-
this.#bridge = bridge;
|
|
57
|
-
}
|
|
58
|
-
connect(config) {
|
|
59
|
-
if (this.#connected) {
|
|
60
|
-
return this.#connected;
|
|
61
|
-
}
|
|
62
|
-
Object.assign(this.#bridge, config.handlers);
|
|
63
|
-
const { iframe, sandboxUrl, csp, permissions } = config;
|
|
64
|
-
const outerAllow = buildAllowAttribute(permissions);
|
|
65
|
-
if (outerAllow) {
|
|
66
|
-
iframe.setAttribute("allow", outerAllow);
|
|
67
|
-
} else {
|
|
68
|
-
iframe.removeAttribute("allow");
|
|
69
|
-
}
|
|
70
|
-
const sandboxWindow = iframe.contentWindow;
|
|
71
|
-
if (!sandboxWindow) {
|
|
72
|
-
return Promise.reject(new Error("sandbox iframe has no contentWindow"));
|
|
73
|
-
}
|
|
74
|
-
let sandboxOrigin;
|
|
75
|
-
try {
|
|
76
|
-
sandboxOrigin = new URL(sandboxUrl, window.location.href).origin;
|
|
77
|
-
} catch {
|
|
78
|
-
return Promise.reject(new Error(`invalid sandbox URL: ${sandboxUrl}`));
|
|
79
|
-
}
|
|
80
|
-
if (sandboxOrigin === "null" || sandboxOrigin === window.location.origin) {
|
|
81
|
-
return Promise.reject(new Error("sandbox URL must be on a distinct, non-opaque origin"));
|
|
82
|
-
}
|
|
83
|
-
this.#connected = this.#bridge.connect({
|
|
84
|
-
sandboxWindow,
|
|
85
|
-
sandboxOrigin,
|
|
86
|
-
html: config.html,
|
|
87
|
-
hostContext: config.hostContext,
|
|
88
|
-
hostCapabilities: config.hostCapabilities,
|
|
89
|
-
permissions: enforcedPermissions(permissions),
|
|
90
|
-
sandbox: config.sandbox
|
|
91
|
-
});
|
|
92
|
-
const separator = sandboxUrl.includes("?") ? "&" : "?";
|
|
93
|
-
iframe.src = `${sandboxUrl}${separator}csp=${encodeURIComponent(buildCspHeader(csp))}`;
|
|
94
|
-
return this.#connected;
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Reconcile the widget with the current tool-call state. Streams partial args, sends
|
|
98
|
-
* final args once, then exactly one of `tool-result` (complete/error) or
|
|
99
|
-
* `tool-cancelled` — all gated on the `initialized` handshake. Safe to call on every
|
|
100
|
-
* `toolCall` update.
|
|
101
|
-
*/
|
|
102
|
-
syncToolCall(toolCall) {
|
|
103
|
-
if (!this.#connected || this.#outcome !== "pending") {
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
void this.#connected.then(() => {
|
|
107
|
-
if (this.#outcome !== "pending") {
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
if (toolCall.status === "cancelled") {
|
|
111
|
-
this.#outcome = "cancel-sent";
|
|
112
|
-
this.#bridge.sendToolCancelled();
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
const partialArgs = this.#coerceArgs(toolCall.args);
|
|
116
|
-
const partialString = JSON.stringify(partialArgs);
|
|
117
|
-
if (!this.#inputSent && Object.keys(partialArgs).length && partialString !== this.#lastArgsSent) {
|
|
118
|
-
this.#lastArgsSent = partialString;
|
|
119
|
-
this.#bridge.sendToolInputPartial(partialArgs);
|
|
120
|
-
}
|
|
121
|
-
const isFinished = toolCall.status === "complete" || toolCall.status === "error";
|
|
122
|
-
if ((toolCall.status === "executing" || isFinished) && !this.#inputSent) {
|
|
123
|
-
this.#inputSent = true;
|
|
124
|
-
this.#bridge.sendToolInput(this.#coerceArgs(toolCall.args));
|
|
125
|
-
}
|
|
126
|
-
if (isFinished) {
|
|
127
|
-
this.#outcome = "result-sent";
|
|
128
|
-
this.#bridge.sendToolResult(buildViewToolResult(toolCall));
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
/** Forward a host-context change; the bridge holds it until the View is initialized. */
|
|
133
|
-
sendHostContextChange(hostContext) {
|
|
134
|
-
if (this.#connected) {
|
|
135
|
-
this.#bridge.sendHostContextChange(hostContext);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
/** Send `ui/resource-teardown` and release the bridge; the iframe is removed without waiting for the ack. */
|
|
139
|
-
teardown() {
|
|
140
|
-
if (!this.#connected) {
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
this.#outcome = "torn-down";
|
|
144
|
-
this.#bridge.sendTeardown();
|
|
145
|
-
}
|
|
146
|
-
#coerceArgs(args) {
|
|
147
|
-
return args && typeof args === "object" ? args : {};
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
export {
|
|
151
|
-
McpAppBridgeController,
|
|
152
|
-
buildAllowAttribute,
|
|
153
|
-
buildCspHeader,
|
|
154
|
-
buildViewToolResult,
|
|
155
|
-
enforcedPermissions
|
|
156
|
-
};
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import { McpAppDisplayMode, McpAppHostCapabilities, McpAppHostContext, McpAppResourcePermissions, McpModelContextUpdateParams, McpResourceReadParams, McpToolCallParams, McpToolResult } from '../../ai-chatbot';
|
|
2
|
-
/**
|
|
3
|
-
* The host-side bridge surface `mcp-app-bridge.ts` (`McpAppBridge`) implements. The
|
|
4
|
-
* element + controller depend on this interface only.
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* A View's `tools/call` as received by the bridge. The bridge has no widget identity;
|
|
8
|
-
* the element adds its `toolCallId` before forwarding to the host.
|
|
9
|
-
*/
|
|
10
|
-
export type McpAppToolCallRequest = Omit<McpToolCallParams, 'toolCallId'>;
|
|
11
|
-
/** A View's `resources/read` as received by the bridge (no widget identity). */
|
|
12
|
-
export type McpAppResourceReadRequest = Omit<McpResourceReadParams, 'toolCallId'>;
|
|
13
|
-
/** The `CallToolResult` delivered to the View via `ui/notifications/tool-result`. */
|
|
14
|
-
export interface McpAppViewToolResult extends McpToolResult {
|
|
15
|
-
structuredContent?: unknown;
|
|
16
|
-
}
|
|
17
|
-
/** Parameters a widget passes to `ui/open-link`. */
|
|
18
|
-
export interface McpAppOpenLinkParams {
|
|
19
|
-
url: string;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Result of a View request the host may decline (`ui/open-link`, `ui/message`): `{}` on
|
|
23
|
-
* success, `{ isError: true }` when the host refused or could not deliver it.
|
|
24
|
-
*/
|
|
25
|
-
export interface McpAppRequestResult {
|
|
26
|
-
isError?: boolean;
|
|
27
|
-
}
|
|
28
|
-
/** Parameters a widget passes to `ui/message`. `role` is always `user` (never trusted from the View). */
|
|
29
|
-
export interface McpAppMessageParams {
|
|
30
|
-
/** The View's MCP content blocks, unvalidated. */
|
|
31
|
-
content: unknown[];
|
|
32
|
-
role: 'user';
|
|
33
|
-
}
|
|
34
|
-
/** Parameters a widget passes to `ui/update-model-context` (no widget identity). */
|
|
35
|
-
export type McpAppUpdateModelContextParams = Omit<McpModelContextUpdateParams, 'toolCallId'>;
|
|
36
|
-
/** Parameters a widget passes to `ui/request-display-mode`. */
|
|
37
|
-
export interface McpAppRequestDisplayModeParams {
|
|
38
|
-
mode: McpAppDisplayMode;
|
|
39
|
-
/** Modes the View declared in `ui/initialize` (`appCapabilities.availableDisplayModes`). */
|
|
40
|
-
appDisplayModes: McpAppDisplayMode[];
|
|
41
|
-
}
|
|
42
|
-
/** Result the host returns for a display-mode request — echoes the mode actually set. */
|
|
43
|
-
export interface McpAppRequestDisplayModeResult {
|
|
44
|
-
mode: McpAppDisplayMode;
|
|
45
|
-
}
|
|
46
|
-
/** Payload for a widget `notifications/message` (logging). */
|
|
47
|
-
export interface McpAppLoggingMessage {
|
|
48
|
-
level: string;
|
|
49
|
-
data?: unknown;
|
|
50
|
-
logger?: string;
|
|
51
|
-
}
|
|
52
|
-
/** Payload for a widget `size-changed` notification. */
|
|
53
|
-
export interface McpAppSizeChange {
|
|
54
|
-
width?: number;
|
|
55
|
-
height: number;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Config for the `ui/initialize` handshake and injecting the resource into the sandbox.
|
|
59
|
-
*
|
|
60
|
-
* The controller owns the outer sandbox iframe DOM (setting `src` with the `?csp=` query
|
|
61
|
-
* param + the outer `allow` attribute); it hands the bridge the loaded iframe's
|
|
62
|
-
* `contentWindow` so the bridge can scope its transport to that window and drive the
|
|
63
|
-
* `sandbox-proxy-ready` → `sandbox-resource-ready` → `initialized` handshake. All fields
|
|
64
|
-
* are bridge-agnostic (no ext-apps types leak through this surface).
|
|
65
|
-
*/
|
|
66
|
-
export interface McpAppBridgeConnectConfig {
|
|
67
|
-
/** The loaded outer sandbox proxy iframe's window; the bridge scopes its transport here. */
|
|
68
|
-
sandboxWindow: Window;
|
|
69
|
-
/** Origin of the sandbox proxy; only messages from it are accepted and all posts target it. */
|
|
70
|
-
sandboxOrigin: string;
|
|
71
|
-
/** The complete standalone app HTML to inject into the inner sandboxed frame. */
|
|
72
|
-
html: string;
|
|
73
|
-
/** Initial host context sent to the widget on `ui/initialize`. */
|
|
74
|
-
hostContext: McpAppHostContext;
|
|
75
|
-
/** Iframe permission policy forwarded to the inner frame via `sandbox-resource-ready`. */
|
|
76
|
-
permissions?: McpAppResourcePermissions;
|
|
77
|
-
/** Optional override for the inner iframe's `sandbox` attribute. */
|
|
78
|
-
sandbox?: string;
|
|
79
|
-
/** Advertised to the View in the `ui/initialize` result. */
|
|
80
|
-
hostCapabilities: McpAppHostCapabilities;
|
|
81
|
-
}
|
|
82
|
-
export interface IMcpAppBridge {
|
|
83
|
-
/**
|
|
84
|
-
* Connect to the loaded sandbox proxy: perform the `ui/initialize` handshake and send
|
|
85
|
-
* the resource in via `sandbox-resource-ready`. Resolves once the widget has sent
|
|
86
|
-
* `initialized`. The host MUST NOT send tool input before this resolves.
|
|
87
|
-
*/
|
|
88
|
-
connect(config: McpAppBridgeConnectConfig): Promise<void>;
|
|
89
|
-
/** Streaming partial tool arguments (each args delta). */
|
|
90
|
-
sendToolInputPartial(args: Record<string, unknown>): void;
|
|
91
|
-
/** Final, complete tool arguments (args complete). */
|
|
92
|
-
sendToolInput(args: Record<string, unknown>): void;
|
|
93
|
-
/** The final tool result, built from the raw MCP result + structured content. */
|
|
94
|
-
sendToolResult(result: McpAppViewToolResult): void;
|
|
95
|
-
/** Notify the widget its tool call was cancelled. */
|
|
96
|
-
sendToolCancelled(reason?: string): void;
|
|
97
|
-
/**
|
|
98
|
-
* Push an updated host context (e.g. theme or container-size change). Before the View
|
|
99
|
-
* is initialized the change is held and returned from `ui/initialize` / flushed on
|
|
100
|
-
* `initialized` instead of being sent.
|
|
101
|
-
*/
|
|
102
|
-
sendHostContextChange(hostContext: McpAppHostContext): void;
|
|
103
|
-
/** Notify the widget it is being torn down (`ui/resource-teardown`) and release the bridge without waiting for the ack. */
|
|
104
|
-
sendTeardown(): void;
|
|
105
|
-
/** Widget forwarded a `tools/call` to the server. Rejections become JSON-RPC errors. */
|
|
106
|
-
oncalltool?: (params: McpAppToolCallRequest) => Promise<unknown>;
|
|
107
|
-
/** Widget forwarded a `resources/read` to the server. Rejections become JSON-RPC errors. */
|
|
108
|
-
onreadresource?: (params: McpAppResourceReadRequest) => Promise<unknown>;
|
|
109
|
-
/** Widget requested opening an external link. Absent → `{ isError: true }`. */
|
|
110
|
-
onopenlink?: (params: McpAppOpenLinkParams) => Promise<McpAppRequestResult>;
|
|
111
|
-
/** Widget sent a chat message (`ui/message`). Absent → `{ isError: true }`. */
|
|
112
|
-
onmessage?: (params: McpAppMessageParams) => Promise<McpAppRequestResult>;
|
|
113
|
-
/** Widget emitted a logging message (`notifications/message`). */
|
|
114
|
-
onloggingmessage?: (params: McpAppLoggingMessage) => void;
|
|
115
|
-
/** Widget reported a size change. */
|
|
116
|
-
onsizechange?: (params: McpAppSizeChange) => void;
|
|
117
|
-
/** Widget requested a display-mode change; the host echoes the resulting mode. */
|
|
118
|
-
onrequestdisplaymode?: (params: McpAppRequestDisplayModeParams) => Promise<McpAppRequestDisplayModeResult>;
|
|
119
|
-
/** Widget requested a silent model-context update. */
|
|
120
|
-
onupdatemodelcontext?: (params: McpAppUpdateModelContextParams) => Promise<void>;
|
|
121
|
-
/** Widget asked the host to tear it down (`ui/notifications/request-teardown`). */
|
|
122
|
-
onrequestteardown?: () => void;
|
|
123
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { McpAppHostContext } from '../../ai-chatbot';
|
|
2
|
-
import { IMcpAppBridge, McpAppBridgeConnectConfig, McpAppViewToolResult } from './mcp-app-bridge-types.js';
|
|
3
|
-
/**
|
|
4
|
-
* Hand-rolled, zero-dependency {@link IMcpAppBridge}. A `postMessage` listener speaking
|
|
5
|
-
* JSON-RPC 2.0 directly: no SDK, no zod, no schema validation. The cross-origin sandbox
|
|
6
|
-
* iframe is the security boundary here, not message-schema checking — every inbound
|
|
7
|
-
* field is narrowed defensively before use.
|
|
8
|
-
*
|
|
9
|
-
* Drives the handshake against the sandbox proxy (`packages/ai/sandbox/sandbox.js`):
|
|
10
|
-
* `sandbox-proxy-ready` -> `sandbox-resource-ready` -> `ui/initialize` ->
|
|
11
|
-
* `ui/notifications/initialized`, then streaming `ui/notifications/*`. Forwards
|
|
12
|
-
* non-`ui/` methods (`tools/call`, `resources/read`) to the same handler slots the
|
|
13
|
-
* interface defines.
|
|
14
|
-
*/
|
|
15
|
-
export declare class McpAppBridge implements IMcpAppBridge {
|
|
16
|
-
#private;
|
|
17
|
-
oncalltool?: IMcpAppBridge['oncalltool'];
|
|
18
|
-
onreadresource?: IMcpAppBridge['onreadresource'];
|
|
19
|
-
onopenlink?: IMcpAppBridge['onopenlink'];
|
|
20
|
-
onmessage?: IMcpAppBridge['onmessage'];
|
|
21
|
-
onloggingmessage?: IMcpAppBridge['onloggingmessage'];
|
|
22
|
-
onsizechange?: IMcpAppBridge['onsizechange'];
|
|
23
|
-
onrequestdisplaymode?: IMcpAppBridge['onrequestdisplaymode'];
|
|
24
|
-
onupdatemodelcontext?: IMcpAppBridge['onupdatemodelcontext'];
|
|
25
|
-
onrequestteardown?: IMcpAppBridge['onrequestteardown'];
|
|
26
|
-
constructor(hostInfo: {
|
|
27
|
-
name: string;
|
|
28
|
-
version: string;
|
|
29
|
-
});
|
|
30
|
-
connect(config: McpAppBridgeConnectConfig): Promise<void>;
|
|
31
|
-
sendToolInputPartial(args: Record<string, unknown>): void;
|
|
32
|
-
sendToolInput(args: Record<string, unknown>): void;
|
|
33
|
-
sendToolResult(result: McpAppViewToolResult): void;
|
|
34
|
-
sendToolCancelled(reason?: string): void;
|
|
35
|
-
sendHostContextChange(hostContext: McpAppHostContext): void;
|
|
36
|
-
/**
|
|
37
|
-
* Send `ui/resource-teardown` and dispose immediately; the host doesn't wait for the ack,
|
|
38
|
-
* so the iframe is removed right away. A View that never initialized isn't messaged.
|
|
39
|
-
*/
|
|
40
|
-
sendTeardown(): void;
|
|
41
|
-
}
|
|
@@ -1,293 +0,0 @@
|
|
|
1
|
-
const PROTOCOL_VERSION = "2026-01-26";
|
|
2
|
-
const METHOD_NOT_FOUND = -32601;
|
|
3
|
-
const INVALID_PARAMS = -32602;
|
|
4
|
-
const SERVER_ERROR = -32e3;
|
|
5
|
-
const DISPLAY_MODES = ["inline", "fullscreen", "pip"];
|
|
6
|
-
class JsonRpcError extends Error {
|
|
7
|
-
constructor(config) {
|
|
8
|
-
super(config.message);
|
|
9
|
-
this.code = config.code;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
function invalidParams(message) {
|
|
13
|
-
return new JsonRpcError({ code: INVALID_PARAMS, message });
|
|
14
|
-
}
|
|
15
|
-
function methodNotFound(method) {
|
|
16
|
-
return new JsonRpcError({ code: METHOD_NOT_FOUND, message: `Method not found: ${method}` });
|
|
17
|
-
}
|
|
18
|
-
function asParams(params) {
|
|
19
|
-
if (params === void 0 || params === null) {
|
|
20
|
-
return {};
|
|
21
|
-
}
|
|
22
|
-
if (typeof params !== "object" || Array.isArray(params)) {
|
|
23
|
-
throw invalidParams("params must be an object");
|
|
24
|
-
}
|
|
25
|
-
return params;
|
|
26
|
-
}
|
|
27
|
-
function asJsonRpc(data) {
|
|
28
|
-
if (!data || typeof data !== "object") {
|
|
29
|
-
return null;
|
|
30
|
-
}
|
|
31
|
-
const payload = data;
|
|
32
|
-
return payload.jsonrpc === "2.0" ? payload : null;
|
|
33
|
-
}
|
|
34
|
-
function asDisplayModes(value) {
|
|
35
|
-
return Array.isArray(value) ? DISPLAY_MODES.filter((mode) => value.includes(mode)) : [];
|
|
36
|
-
}
|
|
37
|
-
class McpAppBridge {
|
|
38
|
-
#hostInfo;
|
|
39
|
-
#capabilities = {};
|
|
40
|
-
#phase = "idle";
|
|
41
|
-
#sandboxWindow = null;
|
|
42
|
-
#sandboxOrigin = "";
|
|
43
|
-
#hostContext = { theme: "light" };
|
|
44
|
-
/** The host context the View last received (in the `ui/initialize` result or a change notification). */
|
|
45
|
-
#deliveredHostContext = null;
|
|
46
|
-
#appDisplayModes = [];
|
|
47
|
-
#nextId = 1;
|
|
48
|
-
#pending = /* @__PURE__ */ new Map();
|
|
49
|
-
#resolveProxyReady;
|
|
50
|
-
#initialized = null;
|
|
51
|
-
#resolveInitialized;
|
|
52
|
-
constructor(hostInfo) {
|
|
53
|
-
this.#hostInfo = hostInfo;
|
|
54
|
-
}
|
|
55
|
-
connect(config) {
|
|
56
|
-
if (this.#phase !== "idle") {
|
|
57
|
-
throw new Error("Bridge has already been connected; create a new bridge per widget.");
|
|
58
|
-
}
|
|
59
|
-
this.#phase = "connecting";
|
|
60
|
-
this.#capabilities = config.hostCapabilities;
|
|
61
|
-
this.#hostContext = config.hostContext;
|
|
62
|
-
this.#sandboxWindow = config.sandboxWindow;
|
|
63
|
-
this.#sandboxOrigin = config.sandboxOrigin;
|
|
64
|
-
window.addEventListener("message", this.#handleMessage);
|
|
65
|
-
const proxyReady = new Promise((resolve) => {
|
|
66
|
-
this.#resolveProxyReady = resolve;
|
|
67
|
-
});
|
|
68
|
-
this.#initialized = new Promise((resolve) => {
|
|
69
|
-
this.#resolveInitialized = resolve;
|
|
70
|
-
}).then(() => {
|
|
71
|
-
this.#phase = "ready";
|
|
72
|
-
this.#flushHostContext();
|
|
73
|
-
});
|
|
74
|
-
return proxyReady.then(
|
|
75
|
-
() => this.#sendNotification("ui/notifications/sandbox-resource-ready", {
|
|
76
|
-
html: config.html,
|
|
77
|
-
permissions: config.permissions,
|
|
78
|
-
sandbox: config.sandbox
|
|
79
|
-
})
|
|
80
|
-
).then(() => this.#initialized);
|
|
81
|
-
}
|
|
82
|
-
sendToolInputPartial(args) {
|
|
83
|
-
this.#sendNotification("ui/notifications/tool-input-partial", { arguments: args });
|
|
84
|
-
}
|
|
85
|
-
sendToolInput(args) {
|
|
86
|
-
this.#sendNotification("ui/notifications/tool-input", { arguments: args });
|
|
87
|
-
}
|
|
88
|
-
sendToolResult(result) {
|
|
89
|
-
this.#sendNotification("ui/notifications/tool-result", result);
|
|
90
|
-
}
|
|
91
|
-
sendToolCancelled(reason) {
|
|
92
|
-
this.#sendNotification("ui/notifications/tool-cancelled", { reason: reason ?? "cancelled" });
|
|
93
|
-
}
|
|
94
|
-
sendHostContextChange(hostContext) {
|
|
95
|
-
this.#hostContext = hostContext;
|
|
96
|
-
if (this.#phase === "ready") {
|
|
97
|
-
this.#flushHostContext();
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Send `ui/resource-teardown` and dispose immediately; the host doesn't wait for the ack,
|
|
102
|
-
* so the iframe is removed right away. A View that never initialized isn't messaged.
|
|
103
|
-
*/
|
|
104
|
-
sendTeardown() {
|
|
105
|
-
if (this.#phase === "ready") {
|
|
106
|
-
this.#sendRequest("ui/resource-teardown", {}).catch(() => void 0);
|
|
107
|
-
}
|
|
108
|
-
this.#dispose();
|
|
109
|
-
}
|
|
110
|
-
#flushHostContext() {
|
|
111
|
-
if (this.#hostContext === this.#deliveredHostContext) {
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
this.#deliveredHostContext = this.#hostContext;
|
|
115
|
-
this.#sendNotification("ui/notifications/host-context-changed", this.#hostContext);
|
|
116
|
-
}
|
|
117
|
-
/** Release the `message` listener + reject any in-flight requests. Idempotent. */
|
|
118
|
-
#dispose() {
|
|
119
|
-
this.#phase = "disposed";
|
|
120
|
-
window.removeEventListener("message", this.#handleMessage);
|
|
121
|
-
for (const pending of this.#pending.values()) {
|
|
122
|
-
pending.reject(new Error("Bridge disposed"));
|
|
123
|
-
}
|
|
124
|
-
this.#pending.clear();
|
|
125
|
-
this.#sandboxWindow = null;
|
|
126
|
-
}
|
|
127
|
-
#handleMessage = (event) => {
|
|
128
|
-
if (event.source !== this.#sandboxWindow || event.origin !== this.#sandboxOrigin) {
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
const payload = asJsonRpc(event.data);
|
|
132
|
-
if (!payload || typeof payload.method !== "string") {
|
|
133
|
-
if (payload && payload.id !== void 0) {
|
|
134
|
-
this.#handleResponse(payload);
|
|
135
|
-
} else if (payload) {
|
|
136
|
-
console.warn("[forge-ai-mcp-app] Ignoring malformed JSON-RPC message", event.data);
|
|
137
|
-
}
|
|
138
|
-
return;
|
|
139
|
-
}
|
|
140
|
-
if (payload.id !== void 0) {
|
|
141
|
-
void this.#handleRequest(payload.method, payload.params, payload.id);
|
|
142
|
-
} else {
|
|
143
|
-
this.#handleNotification(payload.method, payload.params);
|
|
144
|
-
}
|
|
145
|
-
};
|
|
146
|
-
#handleResponse(payload) {
|
|
147
|
-
const id = payload.id;
|
|
148
|
-
const pending = this.#pending.get(id);
|
|
149
|
-
if (!pending) {
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
this.#pending.delete(id);
|
|
153
|
-
if (payload.error) {
|
|
154
|
-
pending.reject(new Error(payload.error.message));
|
|
155
|
-
} else {
|
|
156
|
-
pending.resolve(payload.result);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
async #handleRequest(method, params, id) {
|
|
160
|
-
try {
|
|
161
|
-
const result = await this.#dispatchRequest(method, params);
|
|
162
|
-
this.#post({ jsonrpc: "2.0", id, result: result ?? {} });
|
|
163
|
-
} catch (error) {
|
|
164
|
-
this.#post({
|
|
165
|
-
jsonrpc: "2.0",
|
|
166
|
-
id,
|
|
167
|
-
error: {
|
|
168
|
-
code: error instanceof JsonRpcError ? error.code : SERVER_ERROR,
|
|
169
|
-
message: error instanceof Error ? error.message : "Request failed"
|
|
170
|
-
}
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
/** Unknown or unadvertised methods (`tools/list`, `sampling/createMessage`, `ui/download-file`, …) reject with -32601. */
|
|
175
|
-
async #dispatchRequest(method, params) {
|
|
176
|
-
const p = asParams(params);
|
|
177
|
-
switch (method) {
|
|
178
|
-
case "ui/initialize": {
|
|
179
|
-
const appCapabilities = p.appCapabilities ?? {};
|
|
180
|
-
this.#appDisplayModes = asDisplayModes(appCapabilities.availableDisplayModes);
|
|
181
|
-
this.#deliveredHostContext = this.#hostContext;
|
|
182
|
-
return {
|
|
183
|
-
protocolVersion: PROTOCOL_VERSION,
|
|
184
|
-
hostInfo: this.#hostInfo,
|
|
185
|
-
hostCapabilities: this.#capabilities,
|
|
186
|
-
hostContext: this.#hostContext
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
case "ui/open-link":
|
|
190
|
-
if (typeof p.url !== "string") {
|
|
191
|
-
throw invalidParams("ui/open-link requires a string url");
|
|
192
|
-
}
|
|
193
|
-
return await this.onopenlink?.({ url: p.url }) ?? { isError: true };
|
|
194
|
-
case "ui/message":
|
|
195
|
-
if (!Array.isArray(p.content)) {
|
|
196
|
-
throw invalidParams("ui/message requires a content array");
|
|
197
|
-
}
|
|
198
|
-
return await this.onmessage?.({ content: p.content, role: "user" }) ?? { isError: true };
|
|
199
|
-
case "ui/update-model-context":
|
|
200
|
-
await this.onupdatemodelcontext?.({
|
|
201
|
-
content: Array.isArray(p.content) ? p.content : void 0,
|
|
202
|
-
structuredContent: p.structuredContent
|
|
203
|
-
});
|
|
204
|
-
return {};
|
|
205
|
-
case "ui/request-display-mode": {
|
|
206
|
-
const current = this.#hostContext.displayMode ?? "inline";
|
|
207
|
-
const [mode] = asDisplayModes([p.mode]);
|
|
208
|
-
if (!mode || !this.onrequestdisplaymode) {
|
|
209
|
-
return { mode: current };
|
|
210
|
-
}
|
|
211
|
-
return this.onrequestdisplaymode({ mode, appDisplayModes: this.#appDisplayModes });
|
|
212
|
-
}
|
|
213
|
-
case "ui/resource-teardown":
|
|
214
|
-
case "ping":
|
|
215
|
-
return {};
|
|
216
|
-
case "tools/call":
|
|
217
|
-
if (!this.oncalltool || !this.#capabilities.serverTools) {
|
|
218
|
-
throw methodNotFound(method);
|
|
219
|
-
}
|
|
220
|
-
this.#assertReady(method);
|
|
221
|
-
if (typeof p.name !== "string" || !p.name) {
|
|
222
|
-
throw invalidParams("tools/call requires a tool name");
|
|
223
|
-
}
|
|
224
|
-
return this.oncalltool({ name: p.name, arguments: asParams(p.arguments) });
|
|
225
|
-
case "resources/read":
|
|
226
|
-
if (!this.onreadresource) {
|
|
227
|
-
throw methodNotFound(method);
|
|
228
|
-
}
|
|
229
|
-
this.#assertReady(method);
|
|
230
|
-
if (typeof p.uri !== "string" || !p.uri) {
|
|
231
|
-
throw invalidParams("resources/read requires a uri");
|
|
232
|
-
}
|
|
233
|
-
return this.onreadresource({ uri: p.uri });
|
|
234
|
-
default:
|
|
235
|
-
throw methodNotFound(method);
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
/** Server-bound requests reach the adapter only after the View completes the handshake. */
|
|
239
|
-
#assertReady(method) {
|
|
240
|
-
if (this.#phase !== "ready") {
|
|
241
|
-
throw new JsonRpcError({
|
|
242
|
-
code: SERVER_ERROR,
|
|
243
|
-
message: `${method} is not allowed before ui/notifications/initialized`
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
#handleNotification(method, params) {
|
|
248
|
-
const p = params && typeof params === "object" ? params : {};
|
|
249
|
-
switch (method) {
|
|
250
|
-
case "ui/notifications/sandbox-proxy-ready":
|
|
251
|
-
this.#resolveProxyReady?.();
|
|
252
|
-
return;
|
|
253
|
-
case "ui/notifications/initialized":
|
|
254
|
-
this.#resolveInitialized?.();
|
|
255
|
-
return;
|
|
256
|
-
case "ui/notifications/size-changed":
|
|
257
|
-
this.onsizechange?.({
|
|
258
|
-
width: typeof p.width === "number" ? p.width : void 0,
|
|
259
|
-
height: typeof p.height === "number" ? p.height : 0
|
|
260
|
-
});
|
|
261
|
-
return;
|
|
262
|
-
case "notifications/message":
|
|
263
|
-
this.onloggingmessage?.({
|
|
264
|
-
level: typeof p.level === "string" ? p.level : "info",
|
|
265
|
-
logger: typeof p.logger === "string" ? p.logger : void 0,
|
|
266
|
-
data: p.data
|
|
267
|
-
});
|
|
268
|
-
return;
|
|
269
|
-
case "ui/notifications/request-teardown":
|
|
270
|
-
this.onrequestteardown?.();
|
|
271
|
-
return;
|
|
272
|
-
default:
|
|
273
|
-
console.warn(`[forge-ai-mcp-app] Unhandled notification method: ${method}`);
|
|
274
|
-
return;
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
#sendNotification(method, params) {
|
|
278
|
-
this.#post({ jsonrpc: "2.0", method, params });
|
|
279
|
-
}
|
|
280
|
-
#sendRequest(method, params) {
|
|
281
|
-
const id = this.#nextId++;
|
|
282
|
-
return new Promise((resolve, reject) => {
|
|
283
|
-
this.#pending.set(id, { resolve, reject });
|
|
284
|
-
this.#post({ jsonrpc: "2.0", id, method, params });
|
|
285
|
-
});
|
|
286
|
-
}
|
|
287
|
-
#post(data) {
|
|
288
|
-
this.#sandboxWindow?.postMessage(data, this.#sandboxOrigin);
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
export {
|
|
292
|
-
McpAppBridge
|
|
293
|
-
};
|