@nextclaw/ui 0.13.12 → 0.14.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/CHANGELOG.md +43 -0
- package/dist/assets/{api-DmxQnm30.js → api-B50yVdT8.js} +7 -7
- package/dist/assets/app-presenter-provider-BI-ewLbO.js +3 -0
- package/dist/assets/arrow-left-BOCJyLbQ.js +1 -0
- package/dist/assets/book-open-Bd2Xbrrc.js +1 -0
- package/dist/assets/channels-list-page-moJkpxtU.js +8 -0
- package/dist/assets/chat-page-CO27cl4v.js +105 -0
- package/dist/assets/config-split-page-CsQ2rIdq.js +1 -0
- package/dist/assets/{confirm-dialog-BWRNsRgb.js → confirm-dialog-DRSelLdI.js} +2 -2
- package/dist/assets/desktop-update-config-qa-SynOc.js +1 -0
- package/dist/assets/{dist-DzM2ZEVN.js → dist-D19wiQwB.js} +1 -1
- package/dist/assets/{dist-CyWdaJvr.js → dist-NZRV-BxD.js} +1 -1
- package/dist/assets/doc-browser-2ddUJCA0.js +1 -0
- package/dist/assets/doc-browser-BjHUczQb.js +1 -0
- package/dist/assets/doc-browser-context-C8KPbj-p.js +1 -0
- package/dist/assets/{ellipsis-BDgTYNDX.js → ellipsis-BYy8TP0A.js} +1 -1
- package/dist/assets/{es2015-WqekV0OK.js → es2015-BUIIKCNh.js} +1 -1
- package/dist/assets/{external-link-BLjo8z2a.js → external-link-528k6MDD.js} +1 -1
- package/dist/assets/host-capabilities-9bB_998Z.js +1 -0
- package/dist/assets/index-CMNrRhnG.js +101 -0
- package/dist/assets/index-UTmTW1eU.css +1 -0
- package/dist/assets/{key-round-Du8x3sWa.js → key-round-D3vD9dj7.js} +1 -1
- package/dist/assets/loader-circle-DV9TSRns.js +1 -0
- package/dist/assets/mcp-marketplace-page-CS5Lh3oA.js +1 -0
- package/dist/assets/mcp-marketplace-page-DEOMcWb0.js +40 -0
- package/dist/assets/model-config-page-BSc4o7pb.js +1 -0
- package/dist/assets/{notice-card-3a7FmAz-.js → notice-card-qqlbsOoR.js} +1 -1
- package/dist/assets/plus-Bf9qhPDO.js +1 -0
- package/dist/assets/{popover-BlJLguiZ.js → popover-BnmPOXe3.js} +1 -1
- package/dist/assets/provider-scoped-model-input-Ca56s475.js +1 -0
- package/dist/assets/providers-config-page-D8Kf4U3u.js +1 -0
- package/dist/assets/{react-BVjl1ZaK.js → react-Dsotw5vM.js} +1 -1
- package/dist/assets/{refresh-cw-DFR87zei.js → refresh-cw-Bmx4wc9P.js} +1 -1
- package/dist/assets/remote-DNMEy_c4.js +1 -0
- package/dist/assets/rotate-cw-CL0sVBel.js +1 -0
- package/dist/assets/runtime-config-page-CUFtKr0U.js +1 -0
- package/dist/assets/{save-BDmIlHvN.js → save-CHDnDTok.js} +1 -1
- package/dist/assets/search-D7L-TCH-.js +1 -0
- package/dist/assets/search-config-page-CA3RVAef.js +1 -0
- package/dist/assets/secrets-config-page-95yaH1fa.js +3 -0
- package/dist/assets/{status-dot-SVPjIyG5.js → status-dot-Dm4h-bjn.js} +1 -1
- package/dist/assets/tabs-CJvw5Lqp.js +1 -0
- package/dist/assets/{tag-chip-Cdwb3JSH.js → tag-chip-Cr8GwpRE.js} +1 -1
- package/dist/assets/{tooltip-CKGxLGnG.js → tooltip-Bxzi6aDL.js} +1 -1
- package/dist/assets/{trash-2-yLA8BEcE.js → trash-2-CSfX-BvU.js} +1 -1
- package/dist/assets/use-config-TzwzTgg0.js +1 -0
- package/dist/assets/x-fkIWvi07.js +1 -0
- package/dist/index.html +27 -25
- package/package.json +9 -8
- package/src/app/index.tsx +8 -4
- package/src/features/account/components/account-panel.tsx +3 -3
- package/src/features/account/hooks/{use-auth.test.ts → __tests__/use-auth.test.ts} +1 -1
- package/src/features/account/managers/account.manager.ts +6 -5
- package/src/features/agents/components/{agents-page.test.tsx → __tests__/agents-page.test.tsx} +41 -2
- package/src/features/agents/components/agent-dialogs.tsx +2 -2
- package/src/features/agents/components/agents-page.tsx +1 -1
- package/src/features/channels/components/config/channel-form.tsx +1 -1
- package/src/features/channels/pages/channels-list-page.tsx +18 -15
- package/src/features/channels/utils/{channel-form-fields.utils.test.ts → __tests__/channel-form-fields.utils.test.ts} +1 -1
- package/src/features/chat/components/{chat-welcome.test.tsx → __tests__/chat-welcome.test.tsx} +1 -1
- package/src/features/chat/components/conversation/{chat-conversation-header.test.tsx → __tests__/chat-conversation-header.test.tsx} +25 -32
- package/src/features/chat/components/conversation/{chat-conversation-panel.test.tsx → __tests__/chat-conversation-panel.test.tsx} +201 -37
- package/src/features/chat/components/conversation/chat-conversation-alerts.tsx +37 -0
- package/src/features/chat/components/conversation/chat-conversation-content.tsx +91 -0
- package/src/features/chat/components/conversation/chat-conversation-header-section.tsx +151 -0
- package/src/features/chat/components/conversation/chat-conversation-header.tsx +26 -89
- package/src/features/chat/components/conversation/chat-conversation-panel.tsx +13 -376
- package/src/features/chat/components/conversation/chat-conversation-parent-banner.tsx +16 -0
- package/src/features/chat/components/conversation/chat-conversation-skeleton.tsx +86 -0
- package/src/features/chat/components/conversation/chat-conversation-workspace-section.tsx +42 -0
- package/src/features/chat/components/layout/{chat-page-shell.test.tsx → __tests__/chat-page-shell.test.tsx} +1 -1
- package/src/features/chat/components/layout/__tests__/chat-sidebar-read-state.test.tsx +167 -0
- package/src/features/chat/components/layout/__tests__/chat-sidebar.test.tsx +834 -0
- package/src/features/chat/components/layout/chat-page-shell.tsx +11 -30
- package/src/features/chat/components/layout/chat-sidebar-toolbar.tsx +33 -53
- package/src/features/chat/components/layout/chat-sidebar-utility-menu.tsx +1 -1
- package/src/features/chat/components/layout/chat-sidebar.tsx +156 -202
- package/src/features/chat/components/providers/chat-presenter.provider.tsx +13 -44
- package/src/features/chat/{components/conversation → features/input/components/__tests__}/chat-attachment-upload-limit.test.ts +1 -1
- package/src/features/chat/{components/conversation → features/input/components}/chat-input-bar.container.tsx +133 -31
- package/src/features/chat/{hooks → features/input/hooks/__tests__}/use-chat-input-bar-controller.test.tsx +1 -1
- package/src/features/chat/{utils → features/input/utils/__tests__}/chat-composer-state.utils.test.ts +1 -1
- package/src/features/chat/{utils → features/input/utils/__tests__}/chat-inline-token.utils.test.ts +1 -1
- package/src/features/chat/{utils → features/input/utils/__tests__}/chat-input-bar.utils.test.ts +2 -2
- package/src/features/chat/{utils → features/input/utils/__tests__}/ncp-chat-input-availability.utils.test.ts +2 -1
- package/src/features/chat/{utils → features/input/utils}/ncp-chat-input-availability.utils.ts +6 -6
- package/src/features/chat/{components/conversation → features/message/components/__tests__}/chat-message-list.container.test.tsx +38 -3
- package/src/features/chat/{components/conversation → features/message/components}/chat-message-list.container.tsx +9 -13
- package/src/features/chat/{utils → features/message/utils/__tests__}/chat-message-invalid-tool-arguments.utils.test.ts +2 -2
- package/src/features/chat/{utils → features/message/utils/__tests__}/chat-message-session-spawn-tool-card.utils.test.ts +2 -2
- package/src/features/chat/features/message/utils/__tests__/chat-message-show-content-tool-card.utils.test.ts +54 -0
- package/src/features/chat/{utils → features/message/utils/__tests__}/chat-message-summary-truncation.utils.test.ts +2 -2
- package/src/features/chat/{utils → features/message/utils/__tests__}/chat-message-tool-agent-id.utils.test.ts +1 -1
- package/src/features/chat/{utils → features/message/utils/__tests__}/chat-message.utils.test.ts +2 -2
- package/src/features/chat/{utils → features/message/utils}/chat-message-inline-content.utils.ts +1 -1
- package/src/features/chat/{utils → features/message/utils}/chat-message-part.utils.ts +15 -2
- package/src/features/chat/{utils → features/message/utils}/chat-message-session-request-tool-card.utils.ts +1 -1
- package/src/features/chat/features/message/utils/chat-message-show-content-tool-card.utils.ts +165 -0
- package/src/features/chat/{utils → features/message/utils}/chat-message-tool-card.utils.ts +1 -1
- package/src/features/chat/{utils → features/message/utils}/chat-message.utils.ts +1 -1
- package/src/features/chat/features/ncp/hooks/__tests__/use-hydrated-ncp-agent.test.tsx +57 -0
- package/src/features/chat/{hooks → features/ncp/hooks/__tests__}/use-ncp-agent-runtime.test.tsx +2 -2
- package/src/features/chat/features/ncp/hooks/__tests__/use-ncp-chat-derived-state.test.tsx +22 -0
- package/src/features/chat/features/ncp/hooks/__tests__/use-ncp-chat-query-store-sync.test.tsx +101 -0
- package/src/features/chat/{hooks → features/ncp/hooks/__tests__}/use-ncp-session-conversation.test.tsx +1 -1
- package/src/features/chat/features/ncp/hooks/__tests__/use-ui-show-content-event.test.tsx +52 -0
- package/src/features/chat/features/ncp/hooks/use-ncp-chat-derived-state.ts +37 -0
- package/src/features/chat/features/ncp/hooks/use-ncp-chat-query-store-sync.ts +28 -0
- package/src/features/chat/{hooks → features/ncp/hooks}/use-ncp-child-session-tabs-view.ts +4 -4
- package/src/features/chat/{hooks → features/ncp/hooks}/use-ncp-session-conversation.ts +1 -1
- package/src/features/chat/{hooks → features/ncp/hooks}/use-ncp-session-list-view.ts +3 -3
- package/src/features/chat/features/ncp/hooks/use-ncp-session-queries.ts +32 -0
- package/src/features/chat/features/ncp/hooks/use-ui-show-content-event.ts +14 -0
- package/src/features/chat/features/ncp/utils/ncp-chat-query-derived.utils.ts +77 -0
- package/src/features/chat/{utils → features/runtime/utils/__tests__}/ncp-app-client-fetch.utils.test.ts +1 -1
- package/src/features/chat/{utils → features/runtime/utils/__tests__}/ncp-chat-runtime-availability.utils.test.ts +1 -1
- package/src/features/chat/{utils → features/runtime/utils}/chat-runtime.utils.ts +1 -1
- package/src/features/chat/{components → features/session/components}/chat-sidebar-project-groups.tsx +21 -42
- package/src/features/chat/{components/layout → features/session/components}/chat-sidebar-session-entry.tsx +40 -13
- package/src/features/chat/{components → features/session/components}/chat-sidebar-session-item.tsx +36 -44
- package/src/features/chat/features/session/components/chat-sidebar-session-list.tsx +78 -0
- package/src/features/chat/{components/session → features/session/components}/session-context-icon.tsx +1 -1
- package/src/features/chat/{components/conversation/session-header → features/session/components/session-header/__tests__}/chat-session-header-actions.test.tsx +3 -3
- package/src/features/chat/{components/conversation/session-header → features/session/components/session-header/__tests__}/chat-session-project-badge.test.tsx +3 -3
- package/src/features/chat/{components/conversation → features/session/components}/session-header/chat-session-header-actions.tsx +15 -27
- package/src/features/chat/{components/conversation → features/session/components}/session-header/chat-session-project-badge.tsx +1 -1
- package/src/features/chat/{hooks → features/session/hooks/__tests__}/use-chat-session-project.test.tsx +2 -2
- package/src/features/chat/{hooks → features/session/hooks/__tests__}/use-chat-session-update.test.tsx +1 -1
- package/src/features/chat/{hooks → features/session/hooks}/use-chat-session-project.ts +1 -1
- package/src/features/chat/{hooks → features/session/hooks}/use-chat-session-update.ts +17 -0
- package/src/features/chat/{hooks → features/session/hooks}/use-chat-sidebar-session-label-editor.ts +1 -1
- package/src/features/chat/{hooks → features/session/hooks}/use-selected-session-context-window-indicator.ts +1 -1
- package/src/features/chat/{utils → features/session/utils/__tests__}/chat-session-display.utils.test.ts +1 -1
- package/src/features/chat/{utils → features/session/utils/__tests__}/chat-session-route.utils.test.ts +1 -1
- package/src/features/chat/{utils → features/session/utils/__tests__}/ncp-session-adapter.utils.cancelled-tool.test.ts +2 -2
- package/src/features/chat/{utils → features/session/utils/__tests__}/ncp-session-adapter.utils.test.ts +2 -2
- package/src/features/chat/{utils → features/session/utils/__tests__}/session-context.utils.test.ts +1 -1
- package/src/features/chat/features/session/utils/chat-run-metadata.utils.ts +60 -0
- package/src/features/chat/{utils → features/session/utils}/chat-session-preference-governance.utils.ts +0 -128
- package/src/features/chat/features/session/utils/chat-sidebar-session-groups.utils.ts +144 -0
- package/src/features/chat/{components → features/session-type/components/__tests__}/chat-session-type-option-item.test.tsx +1 -1
- package/src/features/chat/{components → features/session-type/components}/chat-session-type-option-item.tsx +7 -16
- package/src/features/chat/features/session-type/components/chat-sidebar-create-menu.tsx +42 -0
- package/src/features/chat/{hooks → features/session-type/hooks/__tests__}/use-chat-session-type-state.test.tsx +1 -1
- package/src/features/chat/{hooks → features/session-type/hooks}/use-chat-session-type-state.ts +23 -94
- package/src/features/chat/features/session-type/utils/chat-session-type.utils.ts +105 -0
- package/src/features/chat/{components → features/workspace/components/__tests__}/chat-session-workspace-file-preview.test.tsx +1 -1
- package/src/features/chat/{components → features/workspace/components}/chat-session-workspace-file-preview.tsx +2 -2
- package/src/features/chat/features/workspace/components/chat-session-workspace-panel-content.tsx +156 -0
- package/src/features/chat/features/workspace/components/chat-session-workspace-panel-nav.tsx +84 -0
- package/src/features/chat/features/workspace/components/chat-session-workspace-panel.tsx +138 -0
- package/src/features/chat/{components/workspace → features/workspace/components}/session-cron-job-content.tsx +1 -1
- package/src/features/chat/features/workspace/hooks/use-chat-conversation-workspace-state.ts +63 -0
- package/src/features/chat/features/workspace/utils/__tests__/chat-workspace-panel-view-model.utils.test.ts +103 -0
- package/src/features/chat/features/workspace/utils/chat-workspace-panel-view-model.utils.ts +183 -0
- package/src/features/chat/index.ts +16 -6
- package/src/features/chat/managers/__tests__/chat-input.manager.test.ts +355 -0
- package/src/features/chat/managers/__tests__/chat-query.manager.test.ts +39 -0
- package/src/features/chat/managers/__tests__/chat-run.manager.test.ts +202 -0
- package/src/features/chat/managers/{chat-session-list.manager.test.ts → __tests__/chat-session-list.manager.test.ts} +98 -74
- package/src/features/chat/managers/{chat-session-preference-sync.manager.test.ts → __tests__/chat-session-preference-sync.manager.test.ts} +1 -1
- package/src/features/chat/managers/__tests__/chat-thread.manager.test.ts +622 -0
- package/src/features/chat/managers/__tests__/chat-ui.manager.test.ts +126 -0
- package/src/features/chat/managers/{recent-selection.manager.test.ts → __tests__/recent-selection.manager.test.ts} +1 -1
- package/src/features/chat/managers/{ncp-chat-input.manager.ts → chat-input.manager.ts} +108 -35
- package/src/features/chat/managers/chat-query.manager.ts +48 -0
- package/src/features/chat/managers/chat-run.manager.ts +107 -0
- package/src/features/chat/managers/chat-session-list.manager.ts +47 -15
- package/src/features/chat/managers/chat-session-preference-sync.manager.ts +60 -5
- package/src/features/chat/managers/{ncp-chat-thread.manager.ts → chat-thread.manager.ts} +210 -37
- package/src/features/chat/managers/chat-ui.manager.ts +55 -9
- package/src/features/chat/pages/{ncp-chat-page.test.ts → __tests__/ncp-chat-page.test.ts} +49 -12
- package/src/features/chat/pages/ncp-chat-page.tsx +123 -399
- package/src/features/chat/presenters/chat.presenter.ts +39 -0
- package/src/features/chat/stores/__tests__/chat-thread.store.test.ts +148 -0
- package/src/features/chat/stores/chat-input.store.ts +5 -1
- package/src/features/chat/stores/chat-thread.store.ts +287 -28
- package/src/features/chat/stores/ncp-chat-query.store.ts +25 -0
- package/src/features/chat/types/chat-input.types.ts +1 -0
- package/src/features/chat/types/chat-message.types.ts +1 -0
- package/src/features/chat/types/chat-run.types.ts +41 -0
- package/src/{shared → features/cron}/components/cron-config.tsx +1 -1
- package/src/features/cron/hooks/use-cron-jobs.ts +58 -0
- package/src/features/cron/index.ts +7 -0
- package/src/features/marketplace/components/{marketplace-page.test.tsx → __tests__/marketplace-page.test.tsx} +37 -1
- package/src/features/marketplace/components/curated-shelves/marketplace-curated-shelves.tsx +15 -61
- package/src/features/marketplace/components/marketplace-external-skill-source-action.tsx +14 -0
- package/src/features/marketplace/components/marketplace-item-list-view.tsx +167 -0
- package/src/features/marketplace/components/marketplace-list-card.tsx +27 -31
- package/src/features/marketplace/components/marketplace-page-data.ts +0 -6
- package/src/features/marketplace/components/marketplace-page-parts.tsx +10 -2
- package/src/features/marketplace/components/marketplace-page.tsx +110 -434
- package/src/features/marketplace/components/mcp/mcp-marketplace-card.tsx +1 -1
- package/src/features/marketplace/components/mcp/mcp-marketplace-dialogs.tsx +1 -1
- package/src/features/marketplace/components/mcp/mcp-marketplace-page.tsx +2 -1
- package/src/features/marketplace/hooks/__tests__/use-marketplace.test.tsx +109 -0
- package/src/features/marketplace/hooks/use-marketplace-item-actions.ts +101 -0
- package/src/features/marketplace/hooks/use-marketplace-item-detail.ts +109 -0
- package/src/features/marketplace/hooks/use-marketplace-list-model.ts +160 -0
- package/src/features/marketplace/hooks/use-marketplace.ts +3 -5
- package/src/features/marketplace/utils/{marketplace-installed-cache.utils.test.ts → __tests__/marketplace-installed-cache.utils.test.ts} +1 -1
- package/src/features/panel-apps/components/{panel-app-list-item.test.tsx → __tests__/panel-app-list-item.test.tsx} +1 -1
- package/src/features/panel-apps/components/{panel-app-toolbar.test.tsx → __tests__/panel-app-toolbar.test.tsx} +1 -1
- package/src/features/panel-apps/utils/{panel-app-view.utils.test.ts → __tests__/panel-app-view.utils.test.ts} +1 -1
- package/src/features/pwa/managers/{pwa-service-worker-cache.manager.test.ts → __tests__/pwa-service-worker-cache.manager.test.ts} +1 -1
- package/src/features/remote/components/remote-access-page.tsx +2 -2
- package/src/features/remote/services/{remote-access-feedback.service.test.ts → __tests__/remote-access-feedback.service.test.ts} +1 -1
- package/src/{shared → features/settings}/components/config/provider-form.tsx +7 -7
- package/src/{shared/components → features/settings/components/config}/provider-status-badge.tsx +1 -1
- package/src/{shared/components/model-config.test.tsx → features/settings/pages/__tests__/model-config-page.test.tsx} +40 -5
- package/src/{shared/components/config/providers-list.test.tsx → features/settings/pages/__tests__/providers-config-page.test.tsx} +48 -5
- package/src/{shared/components/search-config.test.tsx → features/settings/pages/__tests__/search-config-page.test.tsx} +3 -3
- package/src/{shared/components/config/secrets-config.test.tsx → features/settings/pages/__tests__/secrets-config-page.test.tsx} +3 -3
- package/src/{shared/components/model-config.tsx → features/settings/pages/model-config-page.tsx} +1 -1
- package/src/{shared/components/config/providers-list.tsx → features/settings/pages/providers-config-page.tsx} +3 -3
- package/src/{shared/components/search-config.tsx → features/settings/pages/search-config-page.tsx} +1 -1
- package/src/{shared/components/config/secrets-config.tsx → features/settings/pages/secrets-config-page.tsx} +2 -2
- package/src/{shared/components/config/provider-form-support.test.ts → features/settings/utils/__tests__/provider-form-support.utils.test.ts} +1 -1
- package/src/features/side-dock/components/{side-dock.test.tsx → __tests__/side-dock.test.tsx} +25 -0
- package/src/features/side-dock/components/side-dock.tsx +13 -0
- package/src/features/system-status/components/{runtime-control-card.test.tsx → __tests__/runtime-control-card.test.tsx} +1 -1
- package/src/features/system-status/components/{runtime-presence-card.test.tsx → __tests__/runtime-presence-card.test.tsx} +1 -1
- package/src/features/system-status/components/desktop-update-config.tsx +2 -1
- package/src/features/system-status/components/runtime-presence-card.tsx +2 -2
- package/src/features/system-status/managers/{system-status.manager.bootstrap-polling.test.ts → __tests__/system-status.manager.bootstrap-polling.test.ts} +1 -1
- package/src/features/system-status/managers/{system-status.manager.test.ts → __tests__/system-status.manager.test.ts} +1 -1
- package/src/features/system-status/utils/{system-status.utils.test.ts → __tests__/system-status.utils.test.ts} +1 -1
- package/src/platforms/desktop/types/desktop-update.types.ts +9 -0
- package/src/shared/components/actions/action-link.tsx +49 -0
- package/src/shared/components/common/{agent-avatar.test.tsx → __tests__/agent-avatar.test.tsx} +1 -1
- package/src/shared/components/common/agent-identity/use-agent-identity.ts +3 -8
- package/src/shared/components/common/brand-header.tsx +1 -1
- package/src/shared/components/common/tag-input.tsx +1 -1
- package/src/shared/components/doc-browser/{doc-browser-context.test.tsx → __tests__/doc-browser-context.test.tsx} +1 -1
- package/src/shared/components/doc-browser/doc-browser-tab-strip.tsx +64 -161
- package/src/shared/components/doc-browser/doc-browser.tsx +4 -4
- package/src/shared/components/doc-browser/managers/doc-browser.manager.ts +39 -32
- package/src/shared/components/resizable-right-panel/__tests__/resizable-right-panel.test.tsx +66 -0
- package/src/shared/components/resizable-right-panel/resizable-right-panel.tsx +11 -8
- package/src/shared/components/ui/actions/icon-action-button.tsx +53 -0
- package/src/shared/components/ui/tab-strip/__tests__/compact-tab-strip.test.tsx +52 -0
- package/src/shared/components/ui/tab-strip/compact-tab-strip.tsx +228 -0
- package/src/shared/hooks/use-app-meta.ts +10 -0
- package/src/shared/hooks/use-config.ts +1 -148
- package/src/shared/lib/api/{ncp-session.test.ts → __tests__/ncp-session.test.ts} +3 -3
- package/src/shared/lib/api/{raw-client.test.ts → __tests__/raw-client.test.ts} +1 -1
- package/src/shared/lib/api/chat-session-type.types.ts +3 -0
- package/src/shared/lib/cadence/services/{adaptive-cadence.service.test.ts → __tests__/adaptive-cadence.service.test.ts} +1 -1
- package/src/shared/lib/host-capabilities/__tests__/host-capability.manager.test.ts +50 -0
- package/src/shared/lib/host-capabilities/host-capability.manager.ts +62 -0
- package/src/shared/lib/host-capabilities/index.ts +1 -0
- package/src/shared/lib/i18n/README.md +16 -3
- package/src/shared/lib/i18n/index.ts +93 -426
- package/src/shared/lib/i18n/locales/en-US/agents.json +49 -0
- package/src/shared/lib/i18n/locales/en-US/channel-auth.json +51 -0
- package/src/shared/lib/i18n/locales/en-US/channels.json +50 -0
- package/src/shared/lib/i18n/locales/en-US/chat.json +183 -0
- package/src/shared/lib/i18n/locales/en-US/core.json +311 -0
- package/src/shared/lib/i18n/locales/en-US/cron.json +32 -0
- package/src/shared/lib/i18n/locales/en-US/desktop-update.json +90 -0
- package/src/shared/lib/i18n/locales/en-US/doc-browser.json +87 -0
- package/src/shared/lib/i18n/locales/en-US/marketplace.json +72 -0
- package/src/shared/lib/i18n/locales/en-US/path-picker.json +12 -0
- package/src/shared/lib/i18n/locales/en-US/pwa.json +26 -0
- package/src/shared/lib/i18n/locales/en-US/remote.json +168 -0
- package/src/shared/lib/i18n/locales/en-US/runtime-control.json +105 -0
- package/src/shared/lib/i18n/locales/en-US/search.json +28 -0
- package/src/shared/lib/i18n/locales/zh-CN/agents.json +49 -0
- package/src/shared/lib/i18n/locales/zh-CN/channel-auth.json +51 -0
- package/src/shared/lib/i18n/locales/zh-CN/channels.json +50 -0
- package/src/shared/lib/i18n/locales/zh-CN/chat.json +183 -0
- package/src/shared/lib/i18n/locales/zh-CN/core.json +311 -0
- package/src/shared/lib/i18n/locales/zh-CN/cron.json +32 -0
- package/src/shared/lib/i18n/locales/zh-CN/desktop-update.json +90 -0
- package/src/shared/lib/i18n/locales/zh-CN/doc-browser.json +87 -0
- package/src/shared/lib/i18n/locales/zh-CN/marketplace.json +72 -0
- package/src/shared/lib/i18n/locales/zh-CN/path-picker.json +12 -0
- package/src/shared/lib/i18n/locales/zh-CN/pwa.json +26 -0
- package/src/shared/lib/i18n/locales/zh-CN/remote.json +168 -0
- package/src/shared/lib/i18n/locales/zh-CN/runtime-control.json +105 -0
- package/src/shared/lib/i18n/locales/zh-CN/search.json +28 -0
- package/src/shared/lib/i18n/runtime/{i18n-language-owner.test.ts → __tests__/i18n-language-owner.test.ts} +2 -2
- package/src/shared/lib/navigation-history/__tests__/navigation-history.utils.test.ts +60 -0
- package/src/shared/lib/navigation-history/index.ts +1 -0
- package/src/shared/lib/navigation-history/navigation-history.utils.ts +105 -0
- package/src/shared/lib/provider-models/{index.test.ts → __tests__/index.test.ts} +1 -1
- package/src/shared/lib/transport/{app-client.test.ts → __tests__/app-client.test.ts} +3 -3
- package/src/shared/lib/transport/{remote.transport.test.ts → __tests__/remote.transport.test.ts} +1 -1
- package/src/shared/lib/transport/{sse-stream.test.ts → __tests__/sse-stream.test.ts} +1 -1
- package/tsconfig.json +2 -5
- package/vite.config.ts +4 -4
- package/vitest.config.ts +4 -0
- package/dist/assets/app-presenter-provider-CDSjiqfE.js +0 -3
- package/dist/assets/arrow-left-Dd45Mvr1.js +0 -1
- package/dist/assets/channels-list-page-D-WYFmcG.js +0 -8
- package/dist/assets/chat-page-D1X8YNTC.js +0 -105
- package/dist/assets/config-split-page-CdJEkWxv.js +0 -1
- package/dist/assets/desktop-update-config-DOi5R1fX.js +0 -1
- package/dist/assets/doc-browser-D5FJcAyz.js +0 -1
- package/dist/assets/doc-browser-DewXa6oX.js +0 -1
- package/dist/assets/doc-browser-context-CpL2m4Sp.js +0 -1
- package/dist/assets/index-Q891JiF_.css +0 -1
- package/dist/assets/index-ZDJP_uJc.js +0 -101
- package/dist/assets/loader-circle-Dz4FssYC.js +0 -1
- package/dist/assets/mcp-marketplace-page-LmMhKH5a.js +0 -1
- package/dist/assets/mcp-marketplace-page-RqISBSqO.js +0 -40
- package/dist/assets/model-config-JUsW1Khb.js +0 -1
- package/dist/assets/play-BziM-Y34.js +0 -1
- package/dist/assets/plus-DrpyArC8.js +0 -1
- package/dist/assets/provider-models-C_yOh6DE.js +0 -1
- package/dist/assets/provider-scoped-model-input-IMD4W0jD.js +0 -1
- package/dist/assets/providers-list-BsDpxNzy.js +0 -1
- package/dist/assets/remote-DjhVMpVd.js +0 -1
- package/dist/assets/rotate-cw-DMBnsYKm.js +0 -1
- package/dist/assets/runtime-config-page-DzbTVebD.js +0 -1
- package/dist/assets/search-CjHGYvTI.js +0 -1
- package/dist/assets/search-config-CJ6OPxAf.js +0 -1
- package/dist/assets/secrets-config-CYOHWL7P.js +0 -3
- package/dist/assets/tabs-Czd2mj6z.js +0 -1
- package/dist/assets/tabs-custom-Ix4nkp2h.js +0 -1
- package/dist/assets/x-dpDISboO.js +0 -1
- package/src/features/chat/components/chat-session-workspace-panel-nav.tsx +0 -232
- package/src/features/chat/components/chat-session-workspace-panel.tsx +0 -371
- package/src/features/chat/components/layout/chat-sidebar-read-state.test.tsx +0 -145
- package/src/features/chat/components/layout/chat-sidebar.test.tsx +0 -896
- package/src/features/chat/hooks/use-chat-session-label.ts +0 -18
- package/src/features/chat/hooks/use-hydrated-ncp-agent.test.tsx +0 -90
- package/src/features/chat/hooks/use-ncp-chat-derived-state.ts +0 -181
- package/src/features/chat/hooks/use-ncp-chat-page-data.test.tsx +0 -70
- package/src/features/chat/hooks/use-ncp-chat-page-data.ts +0 -260
- package/src/features/chat/managers/chat-stream-actions.manager.ts +0 -35
- package/src/features/chat/managers/ncp-chat-input.manager.test.ts +0 -232
- package/src/features/chat/managers/ncp-chat-presenter.manager.ts +0 -28
- package/src/features/chat/managers/ncp-chat-thread.manager.test.ts +0 -241
- package/src/features/chat/types/chat-stream.types.ts +0 -32
- package/src/features/chat/utils/chat-session-preference-governance.utils.test.tsx +0 -114
- package/src/features/marketplace/components/marketplace-catalog-grid.tsx +0 -114
- package/src/shared/components/resizable-right-panel/resizable-right-panel.test.tsx +0 -38
- package/src/shared/components/ui/action-link.tsx +0 -27
- package/src/shared/components/ui/config-card.tsx +0 -71
- package/src/shared/components/ui/highlight-card.tsx +0 -40
- package/src/shared/components/ui/tabs-custom.tsx +0 -49
- package/src/shared/lib/i18n/agents.ts +0 -85
- package/src/shared/lib/i18n/channel-auth.constants.ts +0 -87
- package/src/shared/lib/i18n/channels.ts +0 -53
- package/src/shared/lib/i18n/chat-labels.utils.ts +0 -206
- package/src/shared/lib/i18n/cron-labels.utils.ts +0 -32
- package/src/shared/lib/i18n/desktop-update-labels.utils.ts +0 -165
- package/src/shared/lib/i18n/marketplace-labels.utils.ts +0 -78
- package/src/shared/lib/i18n/pwa.ts +0 -62
- package/src/shared/lib/i18n/remote.ts +0 -273
- package/src/shared/lib/i18n/runtime/doc-browser-labels.utils.ts +0 -120
- package/src/shared/lib/i18n/runtime/i18n.path-picker.ts +0 -12
- package/src/shared/lib/i18n/runtime-control-labels.utils.ts +0 -180
- package/src/shared/lib/i18n/search.ts +0 -37
- /package/dist/assets/{config-hints-Ceiol9x4.js → config-hints-Cl2XAhzV.js} +0 -0
- /package/src/{app.test.tsx → __tests__/app.test.tsx} +0 -0
- /package/src/app/components/layout/{app-layout.test.tsx → __tests__/app-layout.test.tsx} +0 -0
- /package/src/app/components/layout/{runtime-status-entry.test.tsx → __tests__/runtime-status-entry.test.tsx} +0 -0
- /package/src/app/components/layout/{settings-entry-page.test.tsx → __tests__/settings-entry-page.test.tsx} +0 -0
- /package/src/app/components/layout/{sidebar.layout.test.tsx → __tests__/sidebar.layout.test.tsx} +0 -0
- /package/src/features/channels/components/config/{channel-form.test.tsx → __tests__/channel-form.test.tsx} +0 -0
- /package/src/features/channels/components/config/{weixin-channel-auth-section.test.tsx → __tests__/weixin-channel-auth-section.test.tsx} +0 -0
- /package/src/features/channels/pages/{channels-list-page.test.tsx → __tests__/channels-list-page.test.tsx} +0 -0
- /package/src/features/chat/{hooks → features/input/hooks}/use-chat-input-bar-controller.ts +0 -0
- /package/src/features/chat/{utils → features/input/utils}/chat-composer-state.utils.ts +0 -0
- /package/src/features/chat/{utils → features/input/utils}/chat-inline-token.utils.ts +0 -0
- /package/src/features/chat/{utils → features/input/utils}/chat-input-bar.utils.ts +0 -0
- /package/src/features/chat/{utils → features/input/utils}/chat-input-toolbar.utils.ts +0 -0
- /package/src/features/chat/{utils → features/message/utils}/chat-message-core.utils.ts +0 -0
- /package/src/features/chat/{utils → features/message/utils}/chat-message-partial-json.utils.ts +0 -0
- /package/src/features/chat/{utils → features/message/utils}/chat-message-tool-agent-id.utils.ts +0 -0
- /package/src/features/chat/{utils → features/message/utils}/file-operation/card.utils.ts +0 -0
- /package/src/features/chat/{utils → features/message/utils}/file-operation/diff.utils.ts +0 -0
- /package/src/features/chat/{utils → features/message/utils}/file-operation/line-builder.utils.ts +0 -0
- /package/src/features/chat/{utils → features/message/utils}/file-operation/parsed-block.utils.ts +0 -0
- /package/src/features/chat/{utils → features/message/utils}/file-operation/record-readers.utils.ts +0 -0
- /package/src/features/chat/{utils → features/runtime/utils}/ncp-app-client-fetch.utils.ts +0 -0
- /package/src/features/chat/{utils → features/runtime/utils}/ncp-chat-runtime-availability.utils.ts +0 -0
- /package/src/features/chat/{components/conversation → features/session/components}/session-header/chat-session-header-menu-item.tsx +0 -0
- /package/src/features/chat/{components/conversation → features/session/components}/session-header/chat-session-project-dialog.tsx +0 -0
- /package/src/features/chat/{components/session → features/session/components}/session-run-badge.tsx +0 -0
- /package/src/features/chat/{utils → features/session/utils}/chat-context-window-indicator.utils.ts +0 -0
- /package/src/features/chat/{utils → features/session/utils}/chat-session-display.utils.ts +0 -0
- /package/src/features/chat/{utils → features/session/utils}/chat-session-route.utils.ts +0 -0
- /package/src/features/chat/{utils → features/session/utils}/ncp-session-adapter.utils.ts +0 -0
- /package/src/features/chat/{utils → features/session/utils}/ncp-session-context-metadata.utils.ts +0 -0
- /package/src/features/chat/{utils → features/session/utils}/session-context.utils.ts +0 -0
- /package/src/features/chat/{hooks → features/session-type/hooks}/use-ncp-chat-session-types.ts +0 -0
- /package/src/features/chat/{components/workspace → features/workspace/components}/chat-session-workspace-file-breadcrumbs.tsx +0 -0
- /package/src/features/marketplace/components/{marketplace-page-detail.test.tsx → __tests__/marketplace-page-detail.test.tsx} +0 -0
- /package/src/features/marketplace/components/curated-shelves/{marketplace-curated-scene-route.test.tsx → __tests__/marketplace-curated-scene-route.test.tsx} +0 -0
- /package/src/features/marketplace/components/detail-doc/{marketplace-detail-doc.test.ts → __tests__/marketplace-detail-doc.test.ts} +0 -0
- /package/src/features/marketplace/components/mcp/{mcp-marketplace-page.test.tsx → __tests__/mcp-marketplace-page.test.tsx} +0 -0
- /package/src/features/panel-apps/managers/{panel-app-bridge.manager.test.ts → __tests__/panel-app-bridge.manager.test.ts} +0 -0
- /package/src/features/panel-apps/utils/{panel-app-doc-browser.utils.test.ts → __tests__/panel-app-doc-browser.utils.test.ts} +0 -0
- /package/src/features/pwa/components/{pwa-install-entry.test.tsx → __tests__/pwa-install-entry.test.tsx} +0 -0
- /package/src/features/pwa/managers/{pwa-install.manager.test.ts → __tests__/pwa-install.manager.test.ts} +0 -0
- /package/src/features/pwa/managers/{pwa-shell-theme.manager.test.ts → __tests__/pwa-shell-theme.manager.test.ts} +0 -0
- /package/src/features/remote/components/{remote-access-page.test.tsx → __tests__/remote-access-page.test.tsx} +0 -0
- /package/src/features/right-panel-resources/utils/{right-panel-resource-route-resolver.utils.test.ts → __tests__/right-panel-resource-route-resolver.utils.test.ts} +0 -0
- /package/src/features/right-panel-resources/utils/{right-panel-resource-uri.utils.test.ts → __tests__/right-panel-resource-uri.utils.test.ts} +0 -0
- /package/src/features/service-apps/components/{service-apps-panel.test.tsx → __tests__/service-apps-panel.test.tsx} +0 -0
- /package/src/{shared/components → features/settings/components/config}/provider-advanced-settings-section.tsx +0 -0
- /package/src/{shared/components → features/settings/components/config}/provider-auth-section.tsx +0 -0
- /package/src/{shared → features/settings}/components/config/provider-models-section.tsx +0 -0
- /package/src/{shared/components → features/settings/components/config}/provider-pill-selector.tsx +0 -0
- /package/src/{shared → features/settings}/components/config/secrets-config-form.tsx +0 -0
- /package/src/features/settings/pages/{language-settings-page.test.tsx → __tests__/language-settings-page.test.tsx} +0 -0
- /package/src/{shared/components/config/provider-form-support.ts → features/settings/utils/provider-form-support.utils.ts} +0 -0
- /package/src/features/side-dock/managers/{side-dock.manager.test.ts → __tests__/side-dock.manager.test.ts} +0 -0
- /package/src/features/side-dock/utils/{side-dock-item.utils.test.ts → __tests__/side-dock-item.utils.test.ts} +0 -0
- /package/src/features/system-status/components/{desktop-update-config.test.tsx → __tests__/desktop-update-config.test.tsx} +0 -0
- /package/src/features/system-status/pages/{runtime-config-page.test.tsx → __tests__/runtime-config-page.test.tsx} +0 -0
- /package/src/platforms/desktop/components/{desktop-app-shell.test.tsx → __tests__/desktop-app-shell.test.tsx} +0 -0
- /package/src/platforms/mobile/components/{mobile-app-shell.test.tsx → __tests__/mobile-app-shell.test.tsx} +0 -0
- /package/src/platforms/mobile/components/{mobile-bottom-nav.test.tsx → __tests__/mobile-bottom-nav.test.tsx} +0 -0
- /package/src/shared/components/common/{brand-header.test.tsx → __tests__/brand-header.test.tsx} +0 -0
- /package/src/shared/components/doc-browser/{doc-browser.test.tsx → __tests__/doc-browser.test.tsx} +0 -0
- /package/src/shared/components/{ui → feedback}/notice-card.tsx +0 -0
- /package/src/shared/components/path-picker/{server-path-picker-dialog.test.tsx → __tests__/server-path-picker-dialog.test.tsx} +0 -0
- /package/src/shared/components/{ui → settings}/setting-row.tsx +0 -0
- /package/src/shared/components/{ui → status}/status-dot.tsx +0 -0
- /package/src/shared/components/{ui → tags}/tag-chip.tsx +0 -0
- /package/src/shared/lib/api/{api-base.test.ts → __tests__/api-base.test.ts} +0 -0
- /package/src/shared/lib/api/{client.test.ts → __tests__/client.test.ts} +0 -0
- /package/src/shared/lib/api/{ncp-session-query-cache.utils.test.ts → __tests__/ncp-session-query-cache.utils.test.ts} +0 -0
- /package/src/shared/lib/app-resource-uri/{app-resource-uri.test.ts → __tests__/app-resource-uri.test.ts} +0 -0
- /package/src/shared/lib/resource-uri/utils/{resource-uri-resolver.utils.test.ts → __tests__/resource-uri-resolver.utils.test.ts} +0 -0
- /package/src/shared/lib/session-project/{workspace-file-breadcrumb.test.ts → __tests__/workspace-file-breadcrumb.test.ts} +0 -0
|
@@ -1,369 +1,77 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useEffect,
|
|
3
3
|
useMemo,
|
|
4
|
-
useRef,
|
|
5
4
|
useState,
|
|
6
5
|
} from "react";
|
|
7
|
-
import {
|
|
8
|
-
buildNcpRequestEnvelope,
|
|
9
|
-
} from "@nextclaw/ncp-react";
|
|
10
6
|
import { useLocation, useNavigate, useParams } from "react-router-dom";
|
|
11
7
|
import {
|
|
12
8
|
ChatPageLayout,
|
|
13
9
|
type ChatPageProps,
|
|
14
10
|
useChatSessionSync,
|
|
15
11
|
} from "@/features/chat/components/layout/chat-page-shell";
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import { useNcpChatPageData } from "@/features/chat/hooks/use-ncp-chat-page-data";
|
|
19
|
-
import { NcpChatPresenter } from "@/features/chat/managers/ncp-chat-presenter.manager";
|
|
12
|
+
import { parseSessionKeyFromRoute } from "@/features/chat/features/session/utils/chat-session-route.utils";
|
|
13
|
+
import { ChatPresenter } from "@/features/chat/presenters/chat.presenter";
|
|
20
14
|
import {
|
|
21
15
|
isNcpAgentStartupUnavailableErrorMessage,
|
|
22
16
|
useNcpSessionConversation,
|
|
23
|
-
} from "@/features/chat/hooks/use-ncp-session-conversation";
|
|
17
|
+
} from "@/features/chat/features/ncp/hooks/use-ncp-session-conversation";
|
|
18
|
+
import {
|
|
19
|
+
useNcpChatSelectedSession,
|
|
20
|
+
} from "@/features/chat/features/ncp/hooks/use-ncp-chat-derived-state";
|
|
21
|
+
import { useChatQueryStoreSync } from "@/features/chat/features/ncp/hooks/use-ncp-chat-query-store-sync";
|
|
24
22
|
import {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
} from "@/features/chat/
|
|
28
|
-
import { ChatPresenterProvider } from "@/features/chat/components/providers/chat-presenter.provider";
|
|
29
|
-
import type { ResumeRunParams } from "@/features/chat/types/chat-stream.types";
|
|
30
|
-
import { useChatInputStore } from "@/features/chat/stores/chat-input.store";
|
|
31
|
-
import { useChatSessionListStore } from "@/features/chat/stores/chat-session-list.store";
|
|
23
|
+
ChatPresenterProvider,
|
|
24
|
+
usePresenter,
|
|
25
|
+
} from "@/features/chat/components/providers/chat-presenter.provider";
|
|
32
26
|
import { useConfirmDialog } from "@/shared/hooks/use-confirm-dialog";
|
|
33
|
-
import { useAgents } from "@/shared/hooks/use-agents";
|
|
34
|
-
import { normalizeRequestedSkills } from "@/features/chat/utils/chat-runtime.utils";
|
|
35
27
|
import { useSystemStatus } from "@/features/system-status";
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
} from "@/shared/lib/session-project";
|
|
41
|
-
|
|
42
|
-
function createMetadataFields(value: string | undefined, fields: readonly string[]): Record<string, string> {
|
|
43
|
-
return value ? Object.fromEntries(fields.map((field) => [field, value])) : {};
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export function buildNcpSendMetadata(payload: {
|
|
47
|
-
agentId?: string;
|
|
48
|
-
model?: string;
|
|
49
|
-
thinkingLevel?: string;
|
|
50
|
-
sessionType?: string;
|
|
51
|
-
projectRoot?: string | null;
|
|
52
|
-
requestedSkills?: string[];
|
|
53
|
-
composerNodes?: Parameters<typeof buildInlineSkillTokensFromComposer>[0];
|
|
54
|
-
}): Record<string, unknown> {
|
|
55
|
-
const projectRoot = normalizeSessionProjectRootValue(payload.projectRoot);
|
|
56
|
-
const metadata: Record<string, unknown> = {
|
|
57
|
-
...createMetadataFields(payload.model?.trim(), ["model", "preferred_model"]),
|
|
58
|
-
...createMetadataFields(payload.thinkingLevel?.trim(), [
|
|
59
|
-
"thinkingEffort",
|
|
60
|
-
"thinking",
|
|
61
|
-
"preferred_thinking",
|
|
62
|
-
]),
|
|
63
|
-
...createMetadataFields(payload.sessionType?.trim(), [
|
|
64
|
-
"agentRuntimeId",
|
|
65
|
-
"session_type",
|
|
66
|
-
"runtime",
|
|
67
|
-
]),
|
|
68
|
-
...createMetadataFields(payload.agentId?.trim(), ["agentId", "agent_id"]),
|
|
69
|
-
...createMetadataFields(projectRoot ?? undefined, ["projectRoot", "project_root"]),
|
|
70
|
-
};
|
|
71
|
-
const requestedSkills = normalizeRequestedSkills(payload.requestedSkills);
|
|
72
|
-
if (requestedSkills.length > 0) {
|
|
73
|
-
metadata.requested_skill_refs = requestedSkills;
|
|
74
|
-
}
|
|
75
|
-
const inlineSkillTokens = payload.composerNodes
|
|
76
|
-
? buildInlineSkillTokensFromComposer(payload.composerNodes)
|
|
77
|
-
: [];
|
|
78
|
-
if (inlineSkillTokens.length > 0) {
|
|
79
|
-
metadata[CHAT_UI_INLINE_TOKENS_METADATA_KEY] = inlineSkillTokens;
|
|
80
|
-
}
|
|
81
|
-
return metadata;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export function shouldClearPendingProjectRootOverride(params: {
|
|
85
|
-
pendingProjectRoot: string | null;
|
|
86
|
-
pendingProjectRootSessionKey: string | null;
|
|
87
|
-
sessionKey: string | null | undefined;
|
|
88
|
-
selectedSessionProjectRoot: string | null | undefined;
|
|
89
|
-
}): boolean {
|
|
90
|
-
const {
|
|
91
|
-
pendingProjectRoot,
|
|
92
|
-
pendingProjectRootSessionKey,
|
|
93
|
-
sessionKey,
|
|
94
|
-
selectedSessionProjectRoot,
|
|
95
|
-
} = params;
|
|
96
|
-
return (
|
|
97
|
-
pendingProjectRoot !== null &&
|
|
98
|
-
pendingProjectRootSessionKey !== null &&
|
|
99
|
-
sessionKey === pendingProjectRootSessionKey &&
|
|
100
|
-
(selectedSessionProjectRoot ?? null) === pendingProjectRoot
|
|
101
|
-
);
|
|
102
|
-
}
|
|
28
|
+
import { useAppPresenter } from "@/app/components/app-presenter-provider";
|
|
29
|
+
import { isNcpChatRuntimeBlocked, resolveNcpChatSendErrorMessage } from "@/features/chat/features/runtime/utils/ncp-chat-runtime-availability.utils";
|
|
30
|
+
import { useUiShowContentEvent } from "@/features/chat/features/ncp/hooks/use-ui-show-content-event";
|
|
31
|
+
import { readNcpContextWindowValue } from "@/features/chat/features/session/utils/ncp-session-context-metadata.utils";
|
|
103
32
|
|
|
104
|
-
function
|
|
105
|
-
const query = useChatSessionListStore((state) => state.snapshot.query);
|
|
106
|
-
const selectedSessionKey = useChatSessionListStore(
|
|
107
|
-
(state) => state.snapshot.selectedSessionKey,
|
|
108
|
-
);
|
|
109
|
-
const selectedAgentId = useChatSessionListStore(
|
|
110
|
-
(state) => state.snapshot.selectedAgentId,
|
|
111
|
-
);
|
|
112
|
-
const pendingSessionType = useChatInputStore(
|
|
113
|
-
(state) => state.snapshot.pendingSessionType,
|
|
114
|
-
);
|
|
115
|
-
const pendingProjectRoot = useChatInputStore(
|
|
116
|
-
(state) => state.snapshot.pendingProjectRoot,
|
|
117
|
-
);
|
|
118
|
-
const pendingProjectRootSessionKey = useChatInputStore(
|
|
119
|
-
(state) => state.snapshot.pendingProjectRootSessionKey,
|
|
120
|
-
);
|
|
121
|
-
const currentSelectedModel = useChatInputStore(
|
|
122
|
-
(state) => state.snapshot.selectedModel,
|
|
123
|
-
);
|
|
124
|
-
const systemStatus = useSystemStatus();
|
|
125
|
-
const isRuntimeBlocked = isNcpChatRuntimeBlocked(systemStatus);
|
|
126
|
-
const agentsQuery = useAgents();
|
|
127
|
-
const { confirm, ConfirmDialog } = useConfirmDialog();
|
|
128
|
-
const location = useLocation();
|
|
129
|
-
const navigate = useNavigate();
|
|
33
|
+
function useNcpChatRouteSelection() {
|
|
130
34
|
const { sessionId: routeSessionIdParam } = useParams<{ sessionId?: string }>();
|
|
131
|
-
const threadRef = useRef<HTMLDivElement | null>(null);
|
|
132
|
-
const selectedSessionKeyRef = useRef<string | null>(selectedSessionKey);
|
|
133
35
|
const routeSessionKey = useMemo(
|
|
134
36
|
() => parseSessionKeyFromRoute(routeSessionIdParam),
|
|
135
37
|
[routeSessionIdParam],
|
|
136
38
|
);
|
|
137
|
-
const sessionKey = routeSessionKey ?? undefined;
|
|
138
|
-
const hasSessionProjectRootOverride =
|
|
139
|
-
pendingProjectRoot !== null &&
|
|
140
|
-
(!sessionKey || pendingProjectRootSessionKey === sessionKey);
|
|
141
|
-
const sessionProjectRootOverride = hasSessionProjectRootOverride
|
|
142
|
-
? pendingProjectRoot
|
|
143
|
-
: undefined;
|
|
144
|
-
const pageData = useNcpChatPageData({
|
|
145
|
-
query,
|
|
146
|
-
sessionKey: sessionKey ?? null,
|
|
147
|
-
projectRootOverride: sessionProjectRootOverride,
|
|
148
|
-
currentSelectedModel,
|
|
149
|
-
pendingSessionType,
|
|
150
|
-
setPendingSessionType: presenter.chatInputManager.setPendingSessionType,
|
|
151
|
-
setSelectedModel: presenter.chatInputManager.setSelectedModel,
|
|
152
|
-
setSelectedThinkingLevel:
|
|
153
|
-
presenter.chatInputManager.setSelectedThinkingLevel,
|
|
154
|
-
});
|
|
155
|
-
const agent = useNcpSessionConversation(sessionKey);
|
|
156
39
|
return {
|
|
157
|
-
presenter,
|
|
158
|
-
selectedSessionKey,
|
|
159
|
-
selectedAgentId,
|
|
160
|
-
pendingProjectRoot,
|
|
161
|
-
pendingProjectRootSessionKey,
|
|
162
|
-
systemStatus,
|
|
163
|
-
isRuntimeBlocked,
|
|
164
|
-
agentsQuery,
|
|
165
|
-
confirm,
|
|
166
|
-
ConfirmDialog,
|
|
167
|
-
location,
|
|
168
|
-
navigate,
|
|
169
|
-
threadRef,
|
|
170
|
-
selectedSessionKeyRef,
|
|
171
40
|
routeSessionKey,
|
|
172
|
-
sessionKey,
|
|
173
|
-
hasSessionProjectRootOverride,
|
|
174
|
-
agent,
|
|
175
|
-
...pageData,
|
|
41
|
+
sessionKey: routeSessionKey ?? undefined,
|
|
176
42
|
};
|
|
177
43
|
}
|
|
178
44
|
|
|
179
|
-
|
|
180
|
-
const baseState = useNcpChatPageBaseState(presenter);
|
|
181
|
-
const {
|
|
182
|
-
agent,
|
|
183
|
-
agentsQuery,
|
|
184
|
-
hasSessionProjectRootOverride,
|
|
185
|
-
pendingProjectRoot,
|
|
186
|
-
isRuntimeBlocked,
|
|
187
|
-
systemStatus,
|
|
188
|
-
selectedAgentId,
|
|
189
|
-
selectedSession,
|
|
190
|
-
selectedSessionType,
|
|
191
|
-
sessionKey,
|
|
192
|
-
sessionSummaries,
|
|
193
|
-
sessionTypeOptions,
|
|
194
|
-
} = baseState;
|
|
195
|
-
const effectiveSessionProjectRoot = hasSessionProjectRootOverride
|
|
196
|
-
? pendingProjectRoot
|
|
197
|
-
: (selectedSession?.projectRoot ?? null);
|
|
198
|
-
const effectiveSessionWorkingDir =
|
|
199
|
-
selectedSession?.workingDir ?? effectiveSessionProjectRoot;
|
|
200
|
-
const effectiveSessionProjectName = hasSessionProjectRootOverride
|
|
201
|
-
? getSessionProjectName(effectiveSessionProjectRoot)
|
|
202
|
-
: (selectedSession?.projectName ??
|
|
203
|
-
getSessionProjectName(effectiveSessionProjectRoot));
|
|
204
|
-
const rawLastSendError =
|
|
205
|
-
agent.hydrateError?.message ?? agent.snapshot.error?.message ?? null;
|
|
206
|
-
const filteredLastSendError =
|
|
207
|
-
systemStatus.phase === "ready" &&
|
|
208
|
-
isNcpAgentStartupUnavailableErrorMessage(rawLastSendError)
|
|
209
|
-
? null
|
|
210
|
-
: rawLastSendError;
|
|
211
|
-
const availableAgents = (agentsQuery.data?.agents?.length ?? 0) > 0
|
|
212
|
-
? (agentsQuery.data?.agents ?? [])
|
|
213
|
-
: [{ id: selectedSession?.agentId ?? selectedAgentId }];
|
|
214
|
-
const derivedState = useNcpChatDerivedState({
|
|
215
|
-
sessionKey: sessionKey ?? null,
|
|
216
|
-
selectedSession,
|
|
217
|
-
selectedAgentId,
|
|
218
|
-
availableAgents,
|
|
219
|
-
parentSessionId: selectedSession?.parentSessionId ?? null,
|
|
220
|
-
sessionSummaries,
|
|
221
|
-
selectedSessionType,
|
|
222
|
-
sessionTypeOptions,
|
|
223
|
-
});
|
|
224
|
-
const currentSessionRunning = agent.isRunning || selectedSession?.status === "running";
|
|
225
|
-
return {
|
|
226
|
-
...baseState,
|
|
227
|
-
availableAgents,
|
|
228
|
-
effectiveSessionProjectRoot,
|
|
229
|
-
effectiveSessionWorkingDir,
|
|
230
|
-
effectiveSessionProjectName,
|
|
231
|
-
isSending: agent.isSending || currentSessionRunning,
|
|
232
|
-
isAwaitingAssistantOutput: currentSessionRunning,
|
|
233
|
-
canStopCurrentRun: currentSessionRunning,
|
|
234
|
-
stopDisabledReason: currentSessionRunning ? null : "__preparing__",
|
|
235
|
-
lastSendError:
|
|
236
|
-
isRuntimeBlocked
|
|
237
|
-
? null
|
|
238
|
-
: systemStatus.phase === "ready"
|
|
239
|
-
? filteredLastSendError
|
|
240
|
-
: resolveNcpChatSendErrorMessage({
|
|
241
|
-
message: filteredLastSendError,
|
|
242
|
-
status: systemStatus,
|
|
243
|
-
}),
|
|
244
|
-
...derivedState,
|
|
245
|
-
};
|
|
246
|
-
}
|
|
45
|
+
type NcpChatConversation = ReturnType<typeof useNcpSessionConversation>;
|
|
247
46
|
|
|
248
|
-
function
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
selectedSession,
|
|
255
|
-
selectedSessionKeyRef,
|
|
256
|
-
sessionKey,
|
|
257
|
-
} = params;
|
|
47
|
+
function useChatRunRuntimeConnection(params: {
|
|
48
|
+
agent: NcpChatConversation;
|
|
49
|
+
sessionKey: string | undefined;
|
|
50
|
+
}) {
|
|
51
|
+
const presenter = usePresenter();
|
|
52
|
+
const { agent, sessionKey } = params;
|
|
258
53
|
useEffect(() => {
|
|
259
|
-
presenter.
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
const metadata = buildNcpSendMetadata({
|
|
265
|
-
agentId: payload.agentId,
|
|
266
|
-
model: payload.model,
|
|
267
|
-
thinkingLevel: payload.thinkingLevel,
|
|
268
|
-
sessionType: payload.sessionType,
|
|
269
|
-
projectRoot:
|
|
270
|
-
!payload.sessionKey || payload.sessionKey === pendingProjectRootSessionKey
|
|
271
|
-
? pendingProjectRoot
|
|
272
|
-
: (selectedSession?.projectRoot ?? null),
|
|
273
|
-
requestedSkills: payload.requestedSkills,
|
|
274
|
-
composerNodes: payload.composerNodes,
|
|
275
|
-
});
|
|
276
|
-
const envelope = buildNcpRequestEnvelope({
|
|
277
|
-
sessionId: payload.sessionKey,
|
|
278
|
-
text: payload.message,
|
|
279
|
-
attachments: payload.attachments,
|
|
280
|
-
parts: payload.parts,
|
|
281
|
-
metadata,
|
|
282
|
-
});
|
|
283
|
-
if (!envelope) {
|
|
284
|
-
return;
|
|
285
|
-
}
|
|
286
|
-
try {
|
|
287
|
-
const handle = await agent.send(envelope);
|
|
288
|
-
if (!payload.sessionKey && handle?.sessionId) {
|
|
289
|
-
presenter.chatSessionListManager.materializeRootSessionRoute(handle.sessionId);
|
|
290
|
-
}
|
|
291
|
-
} catch (error) {
|
|
292
|
-
if (payload.restoreDraftOnError) {
|
|
293
|
-
if (payload.composerNodes && payload.composerNodes.length > 0) {
|
|
294
|
-
presenter.chatInputManager.restoreComposerState?.(
|
|
295
|
-
payload.composerNodes,
|
|
296
|
-
payload.attachments ?? [],
|
|
297
|
-
);
|
|
298
|
-
} else {
|
|
299
|
-
presenter.chatInputManager.setDraft((currentDraft) =>
|
|
300
|
-
currentDraft.trim().length === 0
|
|
301
|
-
? payload.message
|
|
302
|
-
: currentDraft,
|
|
303
|
-
);
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
throw error;
|
|
307
|
-
}
|
|
308
|
-
},
|
|
309
|
-
stopCurrentRun: async () => {
|
|
310
|
-
await agent.abort();
|
|
311
|
-
},
|
|
312
|
-
resumeRun: async (run: ResumeRunParams) => {
|
|
313
|
-
if (run.sessionKey !== sessionKey) {
|
|
314
|
-
return;
|
|
315
|
-
}
|
|
316
|
-
await agent.streamRun();
|
|
317
|
-
},
|
|
318
|
-
resetStreamState: () => {
|
|
319
|
-
selectedSessionKeyRef.current = null;
|
|
320
|
-
},
|
|
321
|
-
applyHistoryMessages: () => {},
|
|
54
|
+
presenter.chatRunManager.setActiveRuntime({
|
|
55
|
+
sessionKey: sessionKey ?? null,
|
|
56
|
+
sendEnvelope: (envelope) => agent.send(envelope),
|
|
57
|
+
abortCurrentRun: () => agent.abort(),
|
|
58
|
+
resumeCurrentSessionRun: () => agent.streamRun(),
|
|
322
59
|
});
|
|
60
|
+
return () => {
|
|
61
|
+
presenter.chatRunManager.setActiveRuntime(null);
|
|
62
|
+
};
|
|
323
63
|
}, [
|
|
324
64
|
agent,
|
|
325
|
-
pendingProjectRoot,
|
|
326
|
-
pendingProjectRootSessionKey,
|
|
327
65
|
presenter,
|
|
328
|
-
selectedSession?.projectRoot,
|
|
329
|
-
selectedSessionKeyRef,
|
|
330
66
|
sessionKey,
|
|
331
67
|
]);
|
|
332
68
|
}
|
|
333
69
|
|
|
334
|
-
function
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
const
|
|
338
|
-
|
|
339
|
-
pendingProjectRootSessionKey,
|
|
340
|
-
selectedSession,
|
|
341
|
-
} = params;
|
|
342
|
-
useEffect(() => {
|
|
343
|
-
if (
|
|
344
|
-
!selectedSession ||
|
|
345
|
-
!shouldClearPendingProjectRootOverride({
|
|
346
|
-
pendingProjectRoot,
|
|
347
|
-
pendingProjectRootSessionKey,
|
|
348
|
-
sessionKey: selectedSession.key,
|
|
349
|
-
selectedSessionProjectRoot: selectedSession.projectRoot ?? null,
|
|
350
|
-
})
|
|
351
|
-
) {
|
|
352
|
-
return;
|
|
353
|
-
}
|
|
354
|
-
useChatInputStore.getState().setSnapshot({
|
|
355
|
-
pendingProjectRoot: null,
|
|
356
|
-
pendingProjectRootSessionKey: null,
|
|
357
|
-
});
|
|
358
|
-
}, [
|
|
359
|
-
pendingProjectRoot,
|
|
360
|
-
pendingProjectRootSessionKey,
|
|
361
|
-
selectedSession,
|
|
362
|
-
]);
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
function useNcpChatUiBindings(params: ReturnType<typeof useNcpChatPageState>) {
|
|
366
|
-
const { confirm, location, navigate, presenter } = params;
|
|
70
|
+
function useNcpChatUiBindings() {
|
|
71
|
+
const presenter = usePresenter();
|
|
72
|
+
const { confirm, ConfirmDialog } = useConfirmDialog();
|
|
73
|
+
const location = useLocation();
|
|
74
|
+
const navigate = useNavigate();
|
|
367
75
|
useEffect(() => {
|
|
368
76
|
presenter.chatUiManager.syncState({
|
|
369
77
|
pathname: location.pathname,
|
|
@@ -373,86 +81,102 @@ function useNcpChatUiBindings(params: ReturnType<typeof useNcpChatPageState>) {
|
|
|
373
81
|
confirm,
|
|
374
82
|
});
|
|
375
83
|
}, [confirm, location.pathname, navigate, presenter]);
|
|
84
|
+
return <ConfirmDialog />;
|
|
376
85
|
}
|
|
377
86
|
|
|
378
|
-
function
|
|
379
|
-
|
|
87
|
+
function useChatRunSnapshotSync(params: {
|
|
88
|
+
agent: NcpChatConversation;
|
|
89
|
+
isSending: boolean;
|
|
90
|
+
isRunning: boolean;
|
|
91
|
+
lastSendError: string | null;
|
|
92
|
+
routeSessionKey: string | null;
|
|
93
|
+
}) {
|
|
94
|
+
const presenter = usePresenter();
|
|
95
|
+
const { agent, isRunning, isSending, lastSendError, routeSessionKey } = params;
|
|
380
96
|
useEffect(() => {
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
97
|
+
presenter.chatRunManager.applyRunSnapshot({
|
|
98
|
+
routeSessionKey,
|
|
99
|
+
isHydrating: agent.isHydrating,
|
|
100
|
+
isSending,
|
|
101
|
+
isRunning,
|
|
102
|
+
visibleMessages: agent.visibleMessages,
|
|
103
|
+
contextWindow: readNcpContextWindowValue(agent.snapshot.contextWindow),
|
|
104
|
+
sendErrorMessage: lastSendError,
|
|
105
|
+
materializedSessionKey:
|
|
106
|
+
agent.snapshot.activeRun?.sessionId ??
|
|
107
|
+
agent.visibleMessages.find((message) => message.sessionId.trim())?.sessionId ??
|
|
108
|
+
null,
|
|
109
|
+
});
|
|
110
|
+
}, [
|
|
111
|
+
agent.isHydrating,
|
|
112
|
+
agent.snapshot.activeRun?.sessionId,
|
|
113
|
+
agent.snapshot.contextWindow,
|
|
114
|
+
agent.visibleMessages,
|
|
115
|
+
isRunning,
|
|
116
|
+
isSending,
|
|
117
|
+
lastSendError,
|
|
118
|
+
presenter,
|
|
119
|
+
routeSessionKey,
|
|
120
|
+
]);
|
|
386
121
|
}
|
|
387
122
|
|
|
388
|
-
function
|
|
389
|
-
|
|
390
|
-
)
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
useEffect(() => {
|
|
397
|
-
if (routeSessionKey || !materializedSessionKey) {
|
|
398
|
-
return;
|
|
399
|
-
}
|
|
400
|
-
presenter.chatSessionListManager.materializeRootSessionRoute(materializedSessionKey);
|
|
401
|
-
}, [materializedSessionKey, presenter, routeSessionKey]);
|
|
123
|
+
export function NcpChatPage({ view }: ChatPageProps) {
|
|
124
|
+
const appPresenter = useAppPresenter();
|
|
125
|
+
const [presenter] = useState(() => new ChatPresenter(appPresenter));
|
|
126
|
+
return (
|
|
127
|
+
<ChatPresenterProvider presenter={presenter}>
|
|
128
|
+
<NcpChatPageContent view={view} />
|
|
129
|
+
</ChatPresenterProvider>
|
|
130
|
+
);
|
|
402
131
|
}
|
|
403
132
|
|
|
404
|
-
|
|
405
|
-
const
|
|
406
|
-
const
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
133
|
+
function NcpChatPageContent({ view }: ChatPageProps) {
|
|
134
|
+
const presenter = usePresenter();
|
|
135
|
+
const systemStatus = useSystemStatus();
|
|
136
|
+
const isRuntimeBlocked = isNcpChatRuntimeBlocked(systemStatus);
|
|
137
|
+
const confirmDialog = useNcpChatUiBindings();
|
|
138
|
+
const routeSelection = useNcpChatRouteSelection();
|
|
139
|
+
const { routeSessionKey, sessionKey } = routeSelection;
|
|
140
|
+
useChatQueryStoreSync({
|
|
141
|
+
sessionKey: sessionKey ?? null,
|
|
142
|
+
});
|
|
143
|
+
const selectedSession = useNcpChatSelectedSession(sessionKey ?? null);
|
|
144
|
+
const agent = useNcpSessionConversation(sessionKey);
|
|
145
|
+
const rawLastSendError =
|
|
146
|
+
agent.hydrateError?.message ?? agent.snapshot.error?.message ?? null;
|
|
147
|
+
const filteredLastSendError =
|
|
148
|
+
systemStatus.phase === "ready" &&
|
|
149
|
+
isNcpAgentStartupUnavailableErrorMessage(rawLastSendError)
|
|
150
|
+
? null
|
|
151
|
+
: rawLastSendError;
|
|
152
|
+
const currentSessionRunning = agent.isRunning || selectedSession?.status === "running";
|
|
153
|
+
const isSending = agent.isSending || currentSessionRunning;
|
|
154
|
+
const lastSendError =
|
|
155
|
+
isRuntimeBlocked
|
|
156
|
+
? null
|
|
157
|
+
: systemStatus.phase === "ready"
|
|
158
|
+
? filteredLastSendError
|
|
159
|
+
: resolveNcpChatSendErrorMessage({
|
|
160
|
+
message: filteredLastSendError,
|
|
161
|
+
status: systemStatus,
|
|
162
|
+
});
|
|
163
|
+
useChatRunRuntimeConnection({
|
|
164
|
+
agent,
|
|
165
|
+
sessionKey,
|
|
166
|
+
});
|
|
412
167
|
useChatSessionSync({
|
|
413
168
|
view,
|
|
414
|
-
routeSessionKey
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
selectedSessionKeyRef: state.selectedSessionKeyRef,
|
|
418
|
-
resetStreamState: presenter.chatStreamActionsManager.resetStreamState,
|
|
169
|
+
routeSessionKey,
|
|
170
|
+
syncRouteSessionSelection:
|
|
171
|
+
presenter.chatSessionListManager.syncRouteSessionSelection,
|
|
419
172
|
});
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
isSending: state.isSending,
|
|
428
|
-
modelOptions: state.modelOptions,
|
|
429
|
-
sessionTypeOptions: state.sessionTypeOptions,
|
|
430
|
-
selectedSessionType: state.selectedSessionType,
|
|
431
|
-
canEditSessionType: state.canEditSessionType,
|
|
432
|
-
sessionTypeUnavailable: state.sessionTypeUnavailable,
|
|
433
|
-
skillRecords: state.skillRecords,
|
|
434
|
-
isSkillsLoading: state.sessionSkillsQuery.isLoading,
|
|
435
|
-
sessionTypeUnavailableMessage: state.sessionTypeUnavailableMessage,
|
|
436
|
-
currentSessionTypeLabel: state.currentSessionTypeLabel,
|
|
437
|
-
currentSessionTypeIcon: state.currentSessionTypeIcon,
|
|
438
|
-
sessionKey: state.sessionKey,
|
|
439
|
-
currentAgentId: state.currentAgentId,
|
|
440
|
-
currentAgent: state.currentAgent,
|
|
441
|
-
availableAgents: state.availableAgents,
|
|
442
|
-
currentSessionDisplayName: state.currentSessionDisplayName,
|
|
443
|
-
effectiveSessionProjectRoot: state.effectiveSessionProjectRoot,
|
|
444
|
-
effectiveSessionWorkingDir: state.effectiveSessionWorkingDir,
|
|
445
|
-
effectiveSessionProjectName: state.effectiveSessionProjectName,
|
|
446
|
-
selectedSession: state.selectedSession,
|
|
447
|
-
threadRef: state.threadRef,
|
|
448
|
-
agent: state.agent,
|
|
449
|
-
isAwaitingAssistantOutput: state.isAwaitingAssistantOutput,
|
|
450
|
-
parentSession: state.parentSession,
|
|
451
|
-
childSessionTabs: state.currentChildSessionTabs,
|
|
173
|
+
useUiShowContentEvent();
|
|
174
|
+
useChatRunSnapshotSync({
|
|
175
|
+
agent,
|
|
176
|
+
isRunning: currentSessionRunning,
|
|
177
|
+
routeSessionKey,
|
|
178
|
+
lastSendError,
|
|
179
|
+
isSending,
|
|
452
180
|
});
|
|
453
|
-
return
|
|
454
|
-
<ChatPresenterProvider presenter={presenter}>
|
|
455
|
-
<ChatPageLayout view={view} confirmDialog={<state.ConfirmDialog />} />
|
|
456
|
-
</ChatPresenterProvider>
|
|
457
|
-
);
|
|
181
|
+
return <ChatPageLayout view={view} confirmDialog={confirmDialog} />;
|
|
458
182
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ChatSessionListManager } from '@/features/chat/managers/chat-session-list.manager';
|
|
2
|
+
import { ChatRunManager } from '@/features/chat/managers/chat-run.manager';
|
|
3
|
+
import { ChatUiManager } from '@/features/chat/managers/chat-ui.manager';
|
|
4
|
+
import { ChatInputManager } from '@/features/chat/managers/chat-input.manager';
|
|
5
|
+
import { ChatQueryManager } from '@/features/chat/managers/chat-query.manager';
|
|
6
|
+
import { ChatThreadManager } from '@/features/chat/managers/chat-thread.manager';
|
|
7
|
+
import type { AppPresenter } from '@/app/presenters/app.presenter';
|
|
8
|
+
|
|
9
|
+
export class ChatPresenter {
|
|
10
|
+
readonly chatUiManager: ChatUiManager;
|
|
11
|
+
readonly chatRunManager: ChatRunManager;
|
|
12
|
+
readonly chatSessionListManager: ChatSessionListManager;
|
|
13
|
+
readonly chatInputManager: ChatInputManager;
|
|
14
|
+
readonly chatQueryManager: ChatQueryManager;
|
|
15
|
+
readonly chatThreadManager: ChatThreadManager;
|
|
16
|
+
|
|
17
|
+
constructor(appPresenter: AppPresenter) {
|
|
18
|
+
this.chatUiManager = new ChatUiManager(appPresenter.docBrowserManager);
|
|
19
|
+
this.chatRunManager = new ChatRunManager(this.chatUiManager);
|
|
20
|
+
this.chatSessionListManager = new ChatSessionListManager(this.chatUiManager, this.chatRunManager);
|
|
21
|
+
this.chatQueryManager = new ChatQueryManager();
|
|
22
|
+
this.chatInputManager = new ChatInputManager(
|
|
23
|
+
this.chatRunManager,
|
|
24
|
+
this.chatSessionListManager
|
|
25
|
+
);
|
|
26
|
+
this.chatThreadManager = new ChatThreadManager(
|
|
27
|
+
this.chatUiManager,
|
|
28
|
+
this.chatSessionListManager,
|
|
29
|
+
this.chatRunManager
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
startAgentCreationDraft = (prompt: string) => {
|
|
34
|
+
this.chatSessionListManager.createSession();
|
|
35
|
+
this.chatSessionListManager.setSelectedAgentId('main');
|
|
36
|
+
this.chatInputManager.setDraft(prompt);
|
|
37
|
+
this.chatInputManager.requestComposerFocusAtEnd();
|
|
38
|
+
};
|
|
39
|
+
}
|