@vibe-forge/client 2.0.0 → 3.0.0-alpha.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/AGENTS.md +4 -1
- package/dist/assets/{arc-CbOXL0l9.js → arc-1JbypnRY.js} +1 -1
- package/dist/assets/{blockDiagram-c4efeb88-CqxINvsS.js → blockDiagram-c4efeb88-jT5b9nId.js} +1 -1
- package/dist/assets/{c4Diagram-c83219d4-BKazU0hb.js → c4Diagram-c83219d4-KNPh-1ta.js} +1 -1
- package/dist/assets/channel-pzvjJnfd.js +1 -0
- package/dist/assets/{classDiagram-beda092f-fAFX5BpB.js → classDiagram-beda092f-vvXuOT3F.js} +1 -1
- package/dist/assets/{classDiagram-v2-2358418a-w1VkNGJj.js → classDiagram-v2-2358418a-vH4j7skr.js} +1 -1
- package/dist/assets/clone-CtWwIeUb.js +1 -0
- package/dist/assets/{createText-1719965b-CEinakVP.js → createText-1719965b-COeSYnf3.js} +1 -1
- package/dist/assets/{cssMode-DPqRki4y.js → cssMode-Doc7QRKn.js} +1 -1
- package/dist/assets/{edges-96097737-Cb0F1_3K.js → edges-96097737-D09v6R_r.js} +1 -1
- package/dist/assets/{erDiagram-0228fc6a-C-N2fx-J.js → erDiagram-0228fc6a-CbZ6rfxl.js} +1 -1
- package/dist/assets/{flowDb-c6c81e3f-D1Xz_8Gf.js → flowDb-c6c81e3f-CnZOzhdk.js} +1 -1
- package/dist/assets/{flowDiagram-50d868cf-DyPSZyAj.js → flowDiagram-50d868cf-jv-xWM2p.js} +1 -1
- package/dist/assets/flowDiagram-v2-4f6560a1-BiyrkIKs.js +1 -0
- package/dist/assets/{flowchart-elk-definition-6af322e1-Dr1DDXwE.js → flowchart-elk-definition-6af322e1-D8pf677G.js} +1 -1
- package/dist/assets/{freemarker2-C3DvPFaK.js → freemarker2-CL0o23Gj.js} +1 -1
- package/dist/assets/{ganttDiagram-a2739b55-DmvY1GRj.js → ganttDiagram-a2739b55-BAPQzC4u.js} +1 -1
- package/dist/assets/{gitGraphDiagram-82fe8481-CoXfPYYi.js → gitGraphDiagram-82fe8481-BI2x71m0.js} +1 -1
- package/dist/assets/{graph-BkDQy7Qt.js → graph-CZK4Bjpq.js} +1 -1
- package/dist/assets/{handlebars-BcTFdqjl.js → handlebars-CCG38Pg6.js} +1 -1
- package/dist/assets/{html-Dg-O6XFr.js → html-BddshTWG.js} +1 -1
- package/dist/assets/{htmlMode-B_wqYWvn.js → htmlMode-xKXiYcDz.js} +1 -1
- package/dist/assets/{index-5325376f-kxPTR3_e.js → index-5325376f-BWMTD8RU.js} +1 -1
- package/dist/assets/{index-wkhI4dr6.js → index-CBe7kDkV.js} +398 -377
- package/dist/assets/index-MWOwVzqE.css +32 -0
- package/dist/assets/{infoDiagram-8eee0895-BEvqkwPI.js → infoDiagram-8eee0895-CR78btIF.js} +1 -1
- package/dist/assets/{javascript-DhlOH8_z.js → javascript-BPlRHPjg.js} +1 -1
- package/dist/assets/{journeyDiagram-c64418c1-gKtLYmmp.js → journeyDiagram-c64418c1-DZRv6FKz.js} +1 -1
- package/dist/assets/{jsonMode-DxTbF9OD.js → jsonMode-BYLVfdkf.js} +1 -1
- package/dist/assets/{layout-CDaZEk6E.js → layout-BtudyPU2.js} +1 -1
- package/dist/assets/{line-DNRQu8iq.js → line-DgHXrIhS.js} +1 -1
- package/dist/assets/{linear-Cph9Z6_j.js → linear-DtBoKICx.js} +1 -1
- package/dist/assets/{liquid-ByZ6JgRG.js → liquid-DxBlJk0W.js} +1 -1
- package/dist/assets/{lspLanguageFeatures-DzvhkgnM.js → lspLanguageFeatures-DmKVpmeH.js} +1 -1
- package/dist/assets/{mdx-D8RGHTl6.js → mdx-DrScsd-w.js} +1 -1
- package/dist/assets/{mermaid.core-BgcryF__.js → mermaid.core-Cj_NJ_lZ.js} +4 -4
- package/dist/assets/{mindmap-definition-8da855dc-WrxK0FcB.js → mindmap-definition-8da855dc-CMXbwtsc.js} +1 -1
- package/dist/assets/{pieDiagram-a8764435-VsZBsiQy.js → pieDiagram-a8764435-Bd6rfpJv.js} +1 -1
- package/dist/assets/{python-CXVtk_cg.js → python-Crbi7B7n.js} +1 -1
- package/dist/assets/{quadrantDiagram-1e28029f-BVlgwOvU.js → quadrantDiagram-1e28029f-H-FdBQn6.js} +1 -1
- package/dist/assets/{razor-0tind7h2.js → razor-DHyrzIfE.js} +1 -1
- package/dist/assets/{requirementDiagram-08caed73-CpPMPoYp.js → requirementDiagram-08caed73-BSyCVDSG.js} +1 -1
- package/dist/assets/{sankeyDiagram-a04cb91d-Cm5nnRmc.js → sankeyDiagram-a04cb91d-S6E6BReg.js} +1 -1
- package/dist/assets/{sequenceDiagram-c5b8d532-DpMlJvJB.js → sequenceDiagram-c5b8d532-BMHY4KMj.js} +1 -1
- package/dist/assets/{stateDiagram-1ecb1508-DU1zc7vq.js → stateDiagram-1ecb1508-BMrMw6XR.js} +1 -1
- package/dist/assets/{stateDiagram-v2-c2b004d7-D-0RgmAp.js → stateDiagram-v2-c2b004d7-B5SIFUb_.js} +1 -1
- package/dist/assets/{styles-b4e223ce-BSO-yNWV.js → styles-b4e223ce-DqiXwnx3.js} +1 -1
- package/dist/assets/{styles-ca3715f6-CHnsn2Ro.js → styles-ca3715f6-jNxW2Db8.js} +1 -1
- package/dist/assets/{styles-d45a18b0-B-rVGjEq.js → styles-d45a18b0-C4nlfLcZ.js} +1 -1
- package/dist/assets/{svgDrawCommon-b86b1483-CA3Pl89f.js → svgDrawCommon-b86b1483-FIWFuZfb.js} +1 -1
- package/dist/assets/{timeline-definition-faaaa080-BcihLR6s.js → timeline-definition-faaaa080-CEQDoqdf.js} +1 -1
- package/dist/assets/{tsMode-D9GGa5Ur.js → tsMode-DnNy3rE9.js} +1 -1
- package/dist/assets/{typescript-BT9CK_EL.js → typescript-YBZ4vw5B.js} +1 -1
- package/dist/assets/{xml-DNO75J-T.js → xml-BJGGYD70.js} +1 -1
- package/dist/assets/{xychartDiagram-f5964ef8-DJTwe32X.js → xychartDiagram-f5964ef8-DUNOFOk0.js} +1 -1
- package/dist/assets/{yaml-7CVzhiP2.js → yaml-BMY4mu5s.js} +1 -1
- package/dist/index.html +8 -3
- package/dist/manifest.webmanifest +30 -0
- package/dist/pwa-icon-192.png +0 -0
- package/dist/pwa-icon-512.png +0 -0
- package/dist/sw.js +105 -0
- package/index.html +6 -1
- package/package.json +13 -13
- package/public/manifest.webmanifest +30 -0
- package/public/pwa-icon-192.png +0 -0
- package/public/pwa-icon-512.png +0 -0
- package/public/sw.js +105 -0
- package/src/App.tsx +13 -1
- package/src/api/README.md +1 -0
- package/src/api/adapters.ts +63 -0
- package/src/api/auth-token.ts +51 -0
- package/src/api/auth.ts +46 -0
- package/src/api/automation.ts +10 -0
- package/src/api/base.ts +20 -17
- package/src/api/config.ts +5 -1
- package/src/api/knowledge.ts +59 -0
- package/src/api/sessions.ts +35 -3
- package/src/api/skill-hub.ts +126 -0
- package/src/api/workspace.ts +33 -1
- package/src/api/worktree-environments.ts +53 -0
- package/src/api.ts +62 -7
- package/src/client-build-info.ts +19 -0
- package/src/components/ConfigView.scss +596 -28
- package/src/components/ConfigView.tsx +569 -138
- package/src/components/NavRail.scss +1 -2
- package/src/components/NavRail.tsx +33 -3
- package/src/components/Sidebar.scss +0 -44
- package/src/components/Sidebar.tsx +110 -37
- package/src/components/auth/AuthGate.scss +79 -0
- package/src/components/auth/AuthGate.tsx +174 -0
- package/src/components/automation-view/@components/AutomationTaskComposer.tsx +220 -0
- package/src/components/automation-view/@components/AutomationTriggerRow.tsx +192 -0
- package/src/components/automation-view/@hooks/use-automation-startup-options-data.tsx +289 -0
- package/src/components/automation-view/@hooks/use-automation-startup-static-options.ts +51 -0
- package/src/components/automation-view/@utils/sender-model-options.tsx +52 -0
- package/src/components/automation-view/@utils/startup-options.ts +26 -0
- package/src/components/automation-view/AutomationEmptyGuide.tsx +61 -0
- package/src/components/automation-view/AutomationEmptyLanding.scss +165 -0
- package/src/components/automation-view/AutomationEmptyLanding.tsx +211 -0
- package/src/components/automation-view/AutomationRuleDetailPreview.tsx +179 -0
- package/src/components/automation-view/PanelTitleActions.tsx +66 -0
- package/src/components/automation-view/RuleFormPanel.scss +172 -49
- package/src/components/automation-view/RuleFormPanel.tsx +196 -91
- package/src/components/automation-view/RuleSidebar.scss +128 -41
- package/src/components/automation-view/RuleSidebar.tsx +173 -89
- package/src/components/automation-view/RunHistoryPanel.scss +307 -72
- package/src/components/automation-view/RunHistoryPanel.tsx +185 -165
- package/src/components/automation-view/TaskList.scss +130 -64
- package/src/components/automation-view/TaskList.tsx +15 -31
- package/src/components/automation-view/TriggerList.scss +87 -8
- package/src/components/automation-view/TriggerList.tsx +14 -173
- package/src/components/automation-view/index.scss +165 -37
- package/src/components/automation-view/index.tsx +174 -87
- package/src/components/automation-view/types.ts +13 -0
- package/src/components/chat/AGENTS.md +3 -1
- package/src/components/chat/ChatHeader.tsx +56 -33
- package/src/components/chat/ChatHistoryView.tsx +254 -123
- package/src/components/chat/NewSessionGuide.scss +274 -204
- package/src/components/chat/NewSessionGuide.tsx +46 -111
- package/src/components/chat/NewSessionGuideStarterList.tsx +190 -0
- package/src/components/chat/NewSessionGuideStarterSection.tsx +121 -0
- package/src/components/chat/bottom-dock-constants.ts +4 -0
- package/src/components/chat/conversation-starter-apply.ts +181 -0
- package/src/components/chat/git-controls/ChatGitControls.scss +65 -0
- package/src/components/chat/git-controls/DraftGitControls.tsx +14 -0
- package/src/components/chat/git-controls/DraftWorktreeEnvironmentDropdown.tsx +115 -0
- package/src/components/chat/messages/MessageItem.tsx +21 -6
- package/src/components/chat/messages/MessageStatusNotice.tsx +12 -4
- package/src/components/chat/messages/build-chat-history-status-notices.ts +18 -13
- package/src/components/chat/messages/message-action-utils.ts +29 -0
- package/src/components/chat/new-session-guide-config.ts +19 -0
- package/src/components/chat/new-session-guide-items.ts +172 -0
- package/src/components/chat/new-session-guide-list-order.ts +58 -0
- package/src/components/chat/sender/@components/account-select/AccountSelectControl.scss +112 -0
- package/src/components/chat/sender/@components/account-select/AccountSelectControl.tsx +280 -0
- package/src/components/chat/sender/@components/account-select/AccountSelectDropdown.scss +155 -0
- package/src/components/chat/sender/@components/adapter-select/AdapterSelectControl.scss +51 -12
- package/src/components/chat/sender/@components/adapter-select/AdapterSelectDropdown.scss +14 -0
- package/src/components/chat/sender/@components/effort-select/EffortSelectControl.scss +36 -0
- package/src/components/chat/sender/@components/effort-select/EffortSelectControl.tsx +17 -12
- package/src/components/chat/sender/@components/model-select/ModelSelectControl.scss +62 -0
- package/src/components/chat/sender/@components/model-select/ModelSelectControl.tsx +17 -12
- package/src/components/chat/sender/@components/model-select/ModelSelectMenu.scss +2 -0
- package/src/components/chat/sender/@components/model-select/ModelSelectMenuLabels.scss +24 -0
- package/src/components/chat/sender/@components/permission-mode-control/PermissionModeControl.scss +199 -0
- package/src/components/chat/sender/@components/permission-mode-control/PermissionModeControl.tsx +172 -0
- package/src/components/chat/sender/@components/reference-actions/ReferenceActionsControl.scss +1 -10
- package/src/components/chat/sender/@components/reference-actions/ReferenceActionsControl.tsx +16 -65
- package/src/components/chat/sender/@components/sender-body/SenderBody.tsx +13 -1
- package/src/components/chat/sender/@components/sender-header-controls/SenderHeaderControls.tsx +157 -0
- package/src/components/chat/sender/@components/sender-monaco-editor/monaco-runtime.ts +1 -17
- package/src/components/chat/sender/@components/sender-toolbar/SenderSelectBase.scss +18 -2
- package/src/components/chat/sender/@components/sender-toolbar/SenderSelectShared.scss +18 -1
- package/src/components/chat/sender/@components/sender-toolbar/SenderToolbar.scss +2 -0
- package/src/components/chat/sender/@components/sender-toolbar/SenderToolbar.tsx +40 -40
- package/src/components/chat/sender/@components/session-target/SenderSessionTargetBar.scss +215 -0
- package/src/components/chat/sender/@components/session-target/SenderSessionTargetBar.tsx +185 -0
- package/src/components/chat/sender/@core/build-sender-toolbar.ts +6 -0
- package/src/components/chat/sender/@core/create-sender-toolbar-handlers.ts +21 -1
- package/src/components/chat/sender/@core/get-sender-runtime-state.ts +3 -2
- package/src/components/chat/sender/@core/sender-toolbar-bindings.ts +12 -0
- package/src/components/chat/sender/@hooks/use-sender-controller.ts +56 -1
- package/src/components/chat/sender/@hooks/use-sender-reference-actions.ts +9 -66
- package/src/components/chat/sender/@types/sender-props.ts +18 -0
- package/src/components/chat/sender/@types/sender-toolbar-types.ts +8 -1
- package/src/components/chat/sender/@types/sender-types.ts +1 -3
- package/src/components/chat/sender/@utils/sender-constants.ts +1 -1
- package/src/components/chat/sender/Sender.scss +257 -2
- package/src/components/chat/sender/Sender.tsx +1 -0
- package/src/components/chat/status-bar/ChatStatusBar.scss +85 -0
- package/src/components/chat/status-bar/ChatStatusBar.tsx +48 -0
- package/src/components/chat/terminal/@components/TerminalManagerList.tsx +191 -0
- package/src/components/chat/terminal/@components/TerminalPane.scss +71 -0
- package/src/components/chat/terminal/@components/TerminalPane.tsx +137 -0
- package/src/components/chat/terminal/@components/TerminalPanelActions.tsx +75 -0
- package/src/components/chat/terminal/@hooks/use-terminal-instance.ts +36 -0
- package/src/components/chat/terminal/@hooks/use-terminal-session.ts +18 -21
- package/src/components/chat/terminal/@hooks/use-terminal-title-editor.ts +72 -0
- package/src/components/chat/terminal/@utils/terminal-keyboard.ts +141 -0
- package/src/components/chat/terminal/@utils/terminal-panes.ts +123 -0
- package/src/components/chat/terminal/ChatTerminalView.scss +310 -38
- package/src/components/chat/terminal/ChatTerminalView.tsx +151 -79
- package/src/components/chat/tools/core/ToolDiffViewer.tsx +3 -17
- package/src/components/chat/workspace-drawer/ChatWorkspaceDrawer.scss +778 -0
- package/src/components/chat/workspace-drawer/ChatWorkspaceDrawer.tsx +112 -0
- package/src/components/chat/workspace-drawer/ChatWorkspaceDrawerToolbar.tsx +183 -0
- package/src/components/chat/workspace-drawer/WorkspaceDrawerChangedFileRow.tsx +75 -0
- package/src/components/chat/workspace-drawer/WorkspaceDrawerChangedFiles.tsx +161 -0
- package/src/components/chat/workspace-drawer/WorkspaceDrawerChangedFolderTree.tsx +191 -0
- package/src/components/chat/workspace-drawer/WorkspaceDrawerTree.tsx +35 -0
- package/src/components/chat/workspace-drawer/WorkspaceDrawerTreeState.tsx +17 -0
- package/src/components/chat/workspace-drawer/changed-files-model.ts +152 -0
- package/src/components/chat/workspace-drawer/workspace-drawer-icons.ts +110 -0
- package/src/components/chat/workspace-file-editor/WorkspaceFileBreadcrumb.tsx +17 -0
- package/src/components/chat/workspace-file-editor/WorkspaceFileEditorView.scss +283 -0
- package/src/components/chat/workspace-file-editor/WorkspaceFileEditorView.tsx +165 -0
- package/src/components/chat/workspace-file-editor/WorkspaceFileTabs.tsx +135 -0
- package/src/components/chat/workspace-file-editor/use-workspace-file-editor-state.ts +113 -0
- package/src/components/chat/workspace-file-editor/workspace-file-editor-language.ts +55 -0
- package/src/components/composer-landing/ComposerLanding.scss +75 -0
- package/src/components/composer-landing/ComposerLanding.tsx +47 -0
- package/src/components/config/AGENTS.md +45 -0
- package/src/components/config/AdapterAccountsManager.scss +540 -0
- package/src/components/config/AdapterAccountsManager.tsx +846 -0
- package/src/components/config/AppSettingsPanel.tsx +85 -9
- package/src/components/config/ConfigAboutSection.scss +7 -1
- package/src/components/config/ConfigAboutSection.tsx +21 -3
- package/src/components/config/ConfigEditors.scss +12 -0
- package/src/components/config/ConfigFieldRow.scss +88 -4
- package/src/components/config/ConfigSectionForm.scss +88 -3
- package/src/components/config/ConfigSectionForm.tsx +948 -138
- package/src/components/config/ConfigSectionPanel.tsx +188 -12
- package/src/components/config/ConfigSourceSwitch.tsx +32 -18
- package/src/components/config/DetailCollectionFieldActions.tsx +63 -0
- package/src/components/config/DetailListField.tsx +413 -0
- package/src/components/config/McpServerItemEditor.tsx +154 -0
- package/src/components/config/RecommendedModelsItemEditor.tsx +146 -0
- package/src/components/config/WorktreeEnvironmentDetailView.tsx +126 -0
- package/src/components/config/WorktreeEnvironmentListView.tsx +126 -0
- package/src/components/config/WorktreeEnvironmentPanel.scss +430 -0
- package/src/components/config/WorktreeEnvironmentPanel.tsx +147 -0
- package/src/components/config/WorktreeEnvironmentScriptEditorCard.tsx +125 -0
- package/src/components/config/WorktreeEnvironmentScriptEditors.tsx +189 -0
- package/src/components/config/configConflict.ts +41 -0
- package/src/components/config/configDetail.ts +381 -0
- package/src/components/config/configSchema.ts +850 -179
- package/src/components/config/configUtils.ts +1 -1
- package/src/components/config/record-editors/RecordEditors.scss +187 -2
- package/src/components/config/record-editors/RecordJsonEditor.tsx +27 -2
- package/src/components/config/record-editors/SchemaObjectEditor.tsx +183 -0
- package/src/components/config/record-editors/SchemaRecordEditor.tsx +184 -0
- package/src/components/config/record-editors/index.tsx +2 -1
- package/src/components/config/record-editors/schemaRecordUtils.ts +55 -0
- package/src/components/config/use-worktree-environment-auto-save.ts +386 -0
- package/src/components/config/worktree-environment-panel-model.ts +108 -0
- package/src/components/dock-panel/DockPanel.scss +84 -17
- package/src/components/dock-panel/DockPanel.tsx +37 -34
- package/src/components/dock-panel/DockPanelHeader.tsx +65 -0
- package/src/components/dock-panel/use-dock-panel-fullscreen.ts +51 -0
- package/src/components/knowledge-base/KnowledgeBaseView.scss +276 -38
- package/src/components/knowledge-base/KnowledgeBaseView.tsx +252 -46
- package/src/components/knowledge-base/components/@hooks/use-skills-cli-modal-controller.ts +157 -0
- package/src/components/knowledge-base/components/@hooks/use-skills-tab-actions.ts +63 -0
- package/src/components/knowledge-base/components/ActionButton.scss +30 -4
- package/src/components/knowledge-base/components/ActionButton.tsx +13 -3
- package/src/components/knowledge-base/components/CreateSkillModal.tsx +59 -0
- package/src/components/knowledge-base/components/EmptyState.scss +4 -2
- package/src/components/knowledge-base/components/EntitiesTab.tsx +20 -20
- package/src/components/knowledge-base/components/EntityList.scss +3 -0
- package/src/components/knowledge-base/components/FilterBar.scss +1 -0
- package/src/components/knowledge-base/components/FilterBar.tsx +12 -8
- package/src/components/knowledge-base/components/FlowsTab.tsx +20 -20
- package/src/components/knowledge-base/components/KnowledgeBaseHeader.tsx +7 -6
- package/src/components/knowledge-base/components/KnowledgeContentControls.tsx +35 -0
- package/src/components/knowledge-base/components/KnowledgeList.scss +14 -3
- package/src/components/knowledge-base/components/KnowledgeMobilePanel.tsx +122 -0
- package/src/components/knowledge-base/components/KnowledgeSidebar.tsx +97 -0
- package/src/components/knowledge-base/components/LoadingState.scss +2 -1
- package/src/components/knowledge-base/components/ProjectSkillsList.tsx +79 -0
- package/src/components/knowledge-base/components/RuleList.scss +3 -0
- package/src/components/knowledge-base/components/RulesTab.tsx +31 -30
- package/src/components/knowledge-base/components/SectionHeader.scss +13 -1
- package/src/components/knowledge-base/components/SectionHeader.tsx +5 -3
- package/src/components/knowledge-base/components/SkillArchiveInput.tsx +43 -0
- package/src/components/knowledge-base/components/SkillHubResultItem.tsx +112 -0
- package/src/components/knowledge-base/components/SkillMarketResults.tsx +98 -0
- package/src/components/knowledge-base/components/SkillMarketView.tsx +198 -0
- package/src/components/knowledge-base/components/SkillMarketView.types.ts +28 -0
- package/src/components/knowledge-base/components/SkillRegistryErrors.tsx +21 -0
- package/src/components/knowledge-base/components/SkillRegistryModal.tsx +74 -0
- package/src/components/knowledge-base/components/SkillsCliModal.tsx +154 -0
- package/src/components/knowledge-base/components/SkillsTab.scss +424 -0
- package/src/components/knowledge-base/components/SkillsTab.tsx +166 -35
- package/src/components/knowledge-base/components/SkillsTabActions.tsx +88 -0
- package/src/components/knowledge-base/components/SpecList.scss +3 -0
- package/src/components/knowledge-base/components/TabContent.scss +4 -3
- package/src/components/knowledge-base/components/skill-hub-utils.ts +108 -0
- package/src/components/knowledge-base/components/use-skill-market-filters.ts +37 -0
- package/src/components/knowledge-base/components/use-skill-market-query-input.ts +44 -0
- package/src/components/knowledge-base/components/use-skill-market-search.ts +49 -0
- package/src/components/knowledge-base/components/use-skill-registry-modal.ts +68 -0
- package/src/components/monaco/monaco-runtime.ts +44 -0
- package/src/components/monaco/use-monaco-theme.ts +63 -0
- package/src/components/nav-rail-account-actions.tsx +104 -0
- package/src/components/server-connection/ServerConnectionGate.scss +356 -0
- package/src/components/server-connection/ServerConnectionGate.tsx +238 -0
- package/src/components/server-connection/ServerConnectionProfileModal.tsx +145 -0
- package/src/components/server-connection/ServerConnectionProfiles.tsx +113 -0
- package/src/components/server-connection/ServerConnectionUrlInput.tsx +85 -0
- package/src/components/sidebar/SidebarHeader.scss +5 -41
- package/src/components/sidebar/SidebarHeader.tsx +117 -91
- package/src/components/sidebar/SidebarHeaderSearchActions.tsx +24 -28
- package/src/components/sidebar/sidebar-search-visibility.ts +18 -0
- package/src/components/sidebar-list/SidebarListHeader.scss +246 -0
- package/src/components/sidebar-list/SidebarListHeader.tsx +146 -0
- package/src/components/workspace/ContextFilePicker.scss +9 -26
- package/src/components/workspace/ContextFilePicker.tsx +31 -113
- package/src/components/workspace/context-file-types.ts +36 -0
- package/src/components/workspace/project-file-tree/ProjectFileTree.scss +298 -0
- package/src/components/workspace/project-file-tree/ProjectFileTree.tsx +138 -0
- package/src/components/workspace/project-file-tree/ProjectFileTreeRow.tsx +167 -0
- package/src/components/workspace/project-file-tree/ProjectFileTreeRowContextMenu.tsx +106 -0
- package/src/components/workspace/project-file-tree/ProjectFileTreeRows.tsx +139 -0
- package/src/components/workspace/project-file-tree/project-file-tree-helpers.ts +101 -0
- package/src/components/workspace/project-file-tree/project-file-tree-icons.ts +93 -0
- package/src/components/workspace/project-file-tree/project-file-tree-types.ts +27 -0
- package/src/components/workspace/project-file-tree/use-project-file-tree-data.ts +197 -0
- package/src/components/workspace/project-file-tree/use-project-file-tree-selection.ts +144 -0
- package/src/hooks/chat/chat-session-target.ts +69 -0
- package/src/hooks/chat/chat-session-workspace-draft.ts +11 -4
- package/src/hooks/chat/interaction-state.ts +1 -0
- package/src/hooks/chat/optimistic-session-creation.ts +189 -0
- package/src/hooks/chat/use-chat-adapter-account-selection.tsx +156 -0
- package/src/hooks/chat/use-chat-route-bottom-panel.ts +181 -0
- package/src/hooks/chat/use-chat-route-deep-link-view.ts +33 -0
- package/src/hooks/chat/use-chat-session-actions.ts +259 -65
- package/src/hooks/chat/use-chat-session-messages.ts +71 -4
- package/src/hooks/chat/use-chat-session.ts +36 -1
- package/src/hooks/chat/workspace-file-panel-state.ts +43 -0
- package/src/hooks/session-subscription-cache.ts +25 -0
- package/src/hooks/use-chat-layout-query-state.ts +29 -0
- package/src/hooks/use-sender-header-query-state.ts +35 -0
- package/src/hooks/use-session-subscription.ts +17 -8
- package/src/hooks/useQueryParams.ts +91 -23
- package/src/i18n-resources.ts +44 -0
- package/src/i18n.ts +21 -6
- package/src/main.tsx +8 -0
- package/src/pwa.ts +46 -0
- package/src/resources/locales/en.json +741 -24
- package/src/resources/locales/zh.json +743 -26
- package/src/routes/ChatRoute.scss +110 -7
- package/src/routes/ChatRoute.tsx +11 -165
- package/src/routes/ChatRouteBottomPanel.tsx +47 -0
- package/src/routes/ChatRouteView.tsx +199 -0
- package/src/runtime-config.ts +155 -2
- package/src/server-connection-history.ts +179 -0
- package/src/store/index.ts +151 -3
- package/src/styles/global.scss +3 -0
- package/src/utils/mobile-viewport.ts +67 -0
- package/src/version-compatibility.ts +37 -0
- package/src/vite-env.d.ts +9 -0
- package/src/ws.ts +20 -9
- package/vite.config.ts +23 -1
- package/dist/assets/channel-Dnopc5A6.js +0 -1
- package/dist/assets/clone-sQthahUA.js +0 -1
- package/dist/assets/flowDiagram-v2-4f6560a1-OazrdWQO.js +0 -1
- package/dist/assets/index-o93dlo92.css +0 -32
- package/src/components/chat/NewSessionGuideCompactPanel.tsx +0 -130
- package/src/components/chat/NewSessionGuideGrid.tsx +0 -141
- package/src/components/chat/sender/@components/reference-actions/ReferencePermissionActionsPopover.tsx +0 -114
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { SessionWorkspaceFileState } from '@vibe-forge/core'
|
|
2
|
+
|
|
3
|
+
export interface WorkspaceFilePanelState {
|
|
4
|
+
openPaths: string[]
|
|
5
|
+
selectedPath: string | null
|
|
6
|
+
isOpen: boolean
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const uniqueNonEmptyPaths = (paths: Array<string | null | undefined>) => {
|
|
10
|
+
const result: string[] = []
|
|
11
|
+
const seen = new Set<string>()
|
|
12
|
+
for (const path of paths) {
|
|
13
|
+
const trimmed = path?.trim()
|
|
14
|
+
if (trimmed == null || trimmed === '' || seen.has(trimmed)) continue
|
|
15
|
+
seen.add(trimmed)
|
|
16
|
+
result.push(trimmed)
|
|
17
|
+
}
|
|
18
|
+
return result
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const normalizeWorkspaceFileState = (
|
|
22
|
+
state: SessionWorkspaceFileState | WorkspaceFilePanelState | undefined
|
|
23
|
+
): WorkspaceFilePanelState => {
|
|
24
|
+
const selectedPath = state?.selectedPath?.trim() || null
|
|
25
|
+
const openPaths = uniqueNonEmptyPaths([
|
|
26
|
+
...(state?.openPaths ?? []),
|
|
27
|
+
selectedPath
|
|
28
|
+
])
|
|
29
|
+
const normalizedSelectedPath = selectedPath != null && openPaths.includes(selectedPath)
|
|
30
|
+
? selectedPath
|
|
31
|
+
: openPaths.at(0) ?? null
|
|
32
|
+
return {
|
|
33
|
+
openPaths,
|
|
34
|
+
selectedPath: normalizedSelectedPath,
|
|
35
|
+
isOpen: state?.isOpen === true && normalizedSelectedPath != null
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export const toSessionWorkspaceFileState = (state: WorkspaceFilePanelState): SessionWorkspaceFileState => ({
|
|
40
|
+
openPaths: state.openPaths,
|
|
41
|
+
...(state.selectedPath == null ? {} : { selectedPath: state.selectedPath }),
|
|
42
|
+
isOpen: state.isOpen
|
|
43
|
+
})
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ScopedMutator } from 'swr'
|
|
2
|
+
|
|
3
|
+
const isAdapterConfigCacheKey = (key: unknown) => {
|
|
4
|
+
if (Array.isArray(key)) {
|
|
5
|
+
return key[0] === '/api/adapters'
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
return typeof key === 'string' && key.startsWith('/api/adapters/')
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const isConfigRelatedDerivedCacheKey = (key: unknown) => {
|
|
12
|
+
if (Array.isArray(key)) {
|
|
13
|
+
return key[0] === 'worktree-environment' || key[0] === '/api/adapters'
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return isAdapterConfigCacheKey(key)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export async function revalidateConfigRelatedCaches(mutate: ScopedMutator) {
|
|
20
|
+
await Promise.all([
|
|
21
|
+
mutate('/api/config'),
|
|
22
|
+
mutate('worktree-environments'),
|
|
23
|
+
mutate(isConfigRelatedDerivedCacheKey)
|
|
24
|
+
])
|
|
25
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { useQueryParams } from '#~/hooks/useQueryParams.js'
|
|
2
|
+
|
|
3
|
+
type ChatLayoutMode = 'workspace'
|
|
4
|
+
|
|
5
|
+
const toChatLayoutMode = (value: string): ChatLayoutMode | undefined => {
|
|
6
|
+
return value === 'workspace' ? value : undefined
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function useChatLayoutQueryState() {
|
|
10
|
+
const { values, update } = useQueryParams<{
|
|
11
|
+
layout: string
|
|
12
|
+
}>({
|
|
13
|
+
keys: ['layout'],
|
|
14
|
+
defaults: {
|
|
15
|
+
layout: ''
|
|
16
|
+
},
|
|
17
|
+
omit: {
|
|
18
|
+
layout: value => value === ''
|
|
19
|
+
}
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
const activeLayout = toChatLayoutMode(values.layout)
|
|
23
|
+
|
|
24
|
+
return {
|
|
25
|
+
activeLayout,
|
|
26
|
+
isWorkspaceDrawerOpen: activeLayout === 'workspace',
|
|
27
|
+
setWorkspaceDrawerOpen: (open: boolean) => update({ layout: open ? 'workspace' : '' })
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { useAtomValue } from 'jotai'
|
|
2
|
+
|
|
3
|
+
import { useQueryParams } from '#~/hooks/useQueryParams.js'
|
|
4
|
+
import { senderHeaderDisplayAtom } from '#~/store/index.js'
|
|
5
|
+
|
|
6
|
+
const isSenderHeaderQueryValue = (
|
|
7
|
+
value: string | null
|
|
8
|
+
): value is 'collapsed' | 'expanded' => {
|
|
9
|
+
return value === 'collapsed' || value === 'expanded'
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function useSenderHeaderQueryState() {
|
|
13
|
+
const senderHeaderDisplay = useAtomValue(senderHeaderDisplayAtom)
|
|
14
|
+
const { update, searchParams } = useQueryParams<{
|
|
15
|
+
senderHeader: string
|
|
16
|
+
}>({
|
|
17
|
+
keys: ['senderHeader'],
|
|
18
|
+
defaults: {
|
|
19
|
+
senderHeader: ''
|
|
20
|
+
},
|
|
21
|
+
omit: {
|
|
22
|
+
senderHeader: value => value === ''
|
|
23
|
+
}
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
const rawSenderHeader = searchParams.get('senderHeader')
|
|
27
|
+
const senderHeaderState = isSenderHeaderQueryValue(rawSenderHeader)
|
|
28
|
+
? rawSenderHeader
|
|
29
|
+
: senderHeaderDisplay
|
|
30
|
+
|
|
31
|
+
return {
|
|
32
|
+
isHeaderCollapsed: senderHeaderState === 'collapsed',
|
|
33
|
+
setHeaderCollapsed: (collapsed: boolean) => update({ senderHeader: collapsed ? 'collapsed' : 'expanded' })
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -3,6 +3,7 @@ import { useSWRConfig } from 'swr'
|
|
|
3
3
|
|
|
4
4
|
import type { Session, WSEvent } from '@vibe-forge/core'
|
|
5
5
|
|
|
6
|
+
import { revalidateConfigRelatedCaches } from '#~/hooks/session-subscription-cache'
|
|
6
7
|
import { createSocket } from '#~/ws.js'
|
|
7
8
|
|
|
8
9
|
interface SessionListResponse {
|
|
@@ -101,16 +102,24 @@ export function useSessionSubscription() {
|
|
|
101
102
|
|
|
102
103
|
socket = createSocket({
|
|
103
104
|
onMessage: (data: WSEvent) => {
|
|
104
|
-
if (disposed
|
|
105
|
-
|
|
105
|
+
if (disposed) return
|
|
106
|
+
|
|
107
|
+
if (data.type === 'session_updated') {
|
|
108
|
+
const updatedSession = data.session as SessionUpdate
|
|
109
|
+
|
|
110
|
+
void mutate('/api/sessions', (prev: SessionListResponse | undefined) => {
|
|
111
|
+
return mergeSessionList(prev, updatedSession, 'active')
|
|
112
|
+
}, false)
|
|
106
113
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
114
|
+
void mutate('/api/sessions/archived', (prev: SessionListResponse | undefined) => {
|
|
115
|
+
return mergeSessionList(prev, updatedSession, 'archived')
|
|
116
|
+
}, false)
|
|
117
|
+
return
|
|
118
|
+
}
|
|
110
119
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
120
|
+
if (data.type === 'config_updated') {
|
|
121
|
+
void revalidateConfigRelatedCaches(mutate)
|
|
122
|
+
}
|
|
114
123
|
},
|
|
115
124
|
onClose: () => {
|
|
116
125
|
if (disposed) return
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { useCallback, useMemo } from 'react'
|
|
2
|
-
import { useSearchParams } from 'react-router-dom'
|
|
2
|
+
import { useNavigate, useSearchParams } from 'react-router-dom'
|
|
3
|
+
|
|
4
|
+
import { getClientBase } from '#~/runtime-config.js'
|
|
3
5
|
|
|
4
6
|
type QueryParamKey<T> = Extract<keyof T, string>
|
|
5
7
|
|
|
@@ -9,12 +11,79 @@ interface QueryParamConfig<T extends Record<string, string>> {
|
|
|
9
11
|
omit?: Partial<Record<QueryParamKey<T>, (value: string) => boolean>>
|
|
10
12
|
}
|
|
11
13
|
|
|
14
|
+
export const resolveQueryParamPathname = (rawPathname: string, clientBase: string) => {
|
|
15
|
+
if (!rawPathname.startsWith(clientBase)) {
|
|
16
|
+
return rawPathname === '' ? '/' : rawPathname
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const relativePath = rawPathname.slice(clientBase.length)
|
|
20
|
+
if (relativePath === '') {
|
|
21
|
+
return '/'
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return relativePath.startsWith('/') ? relativePath : `/${relativePath}`
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const buildQueryParamNavigationTarget = <T extends Record<string, string>>({
|
|
28
|
+
clientBase,
|
|
29
|
+
currentHash,
|
|
30
|
+
currentPathname,
|
|
31
|
+
currentSearch,
|
|
32
|
+
defaults,
|
|
33
|
+
keySet,
|
|
34
|
+
keys,
|
|
35
|
+
omit,
|
|
36
|
+
patch
|
|
37
|
+
}: {
|
|
38
|
+
clientBase: string
|
|
39
|
+
currentHash: string
|
|
40
|
+
currentPathname: string
|
|
41
|
+
currentSearch: string
|
|
42
|
+
defaults?: Partial<T>
|
|
43
|
+
keySet: Set<string>
|
|
44
|
+
keys: QueryParamKey<T>[]
|
|
45
|
+
omit?: Partial<Record<QueryParamKey<T>, (value: string) => boolean>>
|
|
46
|
+
patch: Partial<T>
|
|
47
|
+
}) => {
|
|
48
|
+
const currentSearchParams = new URLSearchParams(currentSearch)
|
|
49
|
+
const nextParams = new URLSearchParams()
|
|
50
|
+
const merged = keys.reduce((acc, key) => {
|
|
51
|
+
const raw = currentSearchParams.get(key)
|
|
52
|
+
const fallback = defaults?.[key] ?? ''
|
|
53
|
+
acc[key] = (raw ?? fallback) as T[QueryParamKey<T>]
|
|
54
|
+
return acc
|
|
55
|
+
}, {} as T)
|
|
56
|
+
|
|
57
|
+
Object.assign(merged, patch)
|
|
58
|
+
|
|
59
|
+
keys.forEach((key) => {
|
|
60
|
+
const value = merged[key] ?? ''
|
|
61
|
+
const shouldOmit = value === '' || (omit?.[key] ? omit[key]!(value) : false)
|
|
62
|
+
if (!shouldOmit) nextParams.set(key, value)
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
for (const [key, value] of currentSearchParams.entries()) {
|
|
66
|
+
if (!keySet.has(key)) nextParams.append(key, value)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (nextParams.toString() === currentSearchParams.toString()) {
|
|
70
|
+
return null
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return {
|
|
74
|
+
pathname: resolveQueryParamPathname(currentPathname, clientBase),
|
|
75
|
+
search: nextParams.toString() === '' ? '' : `?${nextParams.toString()}`,
|
|
76
|
+
hash: currentHash
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
12
80
|
export const useQueryParams = <T extends Record<string, string>>({
|
|
13
81
|
keys,
|
|
14
82
|
defaults,
|
|
15
83
|
omit
|
|
16
84
|
}: QueryParamConfig<T>) => {
|
|
17
|
-
const
|
|
85
|
+
const navigate = useNavigate()
|
|
86
|
+
const [searchParams] = useSearchParams()
|
|
18
87
|
const keySet = useMemo(() => new Set<string>(keys), [keys])
|
|
19
88
|
|
|
20
89
|
const values = useMemo(() => {
|
|
@@ -27,30 +96,29 @@ export const useQueryParams = <T extends Record<string, string>>({
|
|
|
27
96
|
}, [defaults, keys, searchParams])
|
|
28
97
|
|
|
29
98
|
const update = useCallback((patch: Partial<T>) => {
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
99
|
+
const currentLocation = typeof window === 'undefined'
|
|
100
|
+
? {
|
|
101
|
+
hash: '',
|
|
102
|
+
pathname: '/',
|
|
103
|
+
search: searchParams.toString() === '' ? '' : `?${searchParams.toString()}`
|
|
104
|
+
}
|
|
105
|
+
: window.location
|
|
106
|
+
const target = buildQueryParamNavigationTarget<T>({
|
|
107
|
+
clientBase: getClientBase(),
|
|
108
|
+
currentHash: currentLocation.hash,
|
|
109
|
+
currentPathname: currentLocation.pathname,
|
|
110
|
+
currentSearch: currentLocation.search,
|
|
111
|
+
defaults,
|
|
112
|
+
keySet,
|
|
113
|
+
keys,
|
|
114
|
+
omit,
|
|
115
|
+
patch
|
|
44
116
|
})
|
|
45
117
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
if (nextParams.toString() !== searchParams.toString()) {
|
|
51
|
-
setSearchParams(nextParams, { replace: true })
|
|
118
|
+
if (target != null) {
|
|
119
|
+
void navigate(target, { replace: true })
|
|
52
120
|
}
|
|
53
|
-
}, [defaults, keySet, keys, omit, searchParams
|
|
121
|
+
}, [defaults, keySet, keys, navigate, omit, searchParams])
|
|
54
122
|
|
|
55
123
|
return { values, update, searchParams }
|
|
56
124
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { Resource, i18n as I18nInstance } from 'i18next'
|
|
2
|
+
|
|
3
|
+
export type LocaleMessages = Record<string, unknown>
|
|
4
|
+
|
|
5
|
+
export interface LocaleModule {
|
|
6
|
+
default: LocaleMessages
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export type LocaleModuleMap = Record<string, LocaleModule>
|
|
10
|
+
|
|
11
|
+
export const getLocaleCodeFromPath = (path: string) => (
|
|
12
|
+
path.match(/\/([^/]+)\.json$/)?.[1] ?? path
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
export const buildTranslationResources = (modules: LocaleModuleMap): Resource => (
|
|
16
|
+
Object.fromEntries(
|
|
17
|
+
Object.entries(modules).map(([path, mod]) => [
|
|
18
|
+
getLocaleCodeFromPath(path),
|
|
19
|
+
{ translation: mod.default }
|
|
20
|
+
])
|
|
21
|
+
)
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
export const applyHotTranslationUpdates = ({
|
|
25
|
+
instance,
|
|
26
|
+
modulePaths,
|
|
27
|
+
nextModules
|
|
28
|
+
}: {
|
|
29
|
+
instance: I18nInstance
|
|
30
|
+
modulePaths: string[]
|
|
31
|
+
nextModules: Array<LocaleModule | undefined>
|
|
32
|
+
}) => {
|
|
33
|
+
modulePaths.forEach((path, index) => {
|
|
34
|
+
const nextModule = nextModules[index]
|
|
35
|
+
if (nextModule == null) return
|
|
36
|
+
const localeCode = getLocaleCodeFromPath(path)
|
|
37
|
+
instance.removeResourceBundle(localeCode, 'translation')
|
|
38
|
+
instance.addResourceBundle(
|
|
39
|
+
localeCode,
|
|
40
|
+
'translation',
|
|
41
|
+
nextModule.default
|
|
42
|
+
)
|
|
43
|
+
})
|
|
44
|
+
}
|
package/src/i18n.ts
CHANGED
|
@@ -2,21 +2,36 @@ import i18n from 'i18next'
|
|
|
2
2
|
import LanguageDetector from 'i18next-browser-languagedetector'
|
|
3
3
|
import { initReactI18next } from 'react-i18next'
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
import
|
|
5
|
+
import { applyHotTranslationUpdates, buildTranslationResources } from './i18n-resources'
|
|
6
|
+
import type { LocaleModule, LocaleModuleMap } from './i18n-resources'
|
|
7
|
+
|
|
8
|
+
const localeModules = import.meta.glob('./resources/locales/*.json', {
|
|
9
|
+
eager: true
|
|
10
|
+
}) as LocaleModuleMap
|
|
11
|
+
const localeModulePaths = Object.keys(localeModules).sort()
|
|
7
12
|
|
|
8
13
|
void i18n
|
|
9
14
|
.use(LanguageDetector)
|
|
10
15
|
.use(initReactI18next)
|
|
11
16
|
.init({
|
|
12
|
-
resources:
|
|
13
|
-
zh: { translation: zh },
|
|
14
|
-
en: { translation: en }
|
|
15
|
-
},
|
|
17
|
+
resources: buildTranslationResources(localeModules),
|
|
16
18
|
fallbackLng: 'zh',
|
|
17
19
|
interpolation: {
|
|
18
20
|
escapeValue: false
|
|
21
|
+
},
|
|
22
|
+
react: {
|
|
23
|
+
bindI18nStore: 'added'
|
|
19
24
|
}
|
|
20
25
|
})
|
|
21
26
|
|
|
27
|
+
if (import.meta.hot) {
|
|
28
|
+
import.meta.hot.accept(localeModulePaths, (nextModules) => {
|
|
29
|
+
applyHotTranslationUpdates({
|
|
30
|
+
instance: i18n,
|
|
31
|
+
modulePaths: localeModulePaths,
|
|
32
|
+
nextModules: nextModules as Array<LocaleModule | undefined>
|
|
33
|
+
})
|
|
34
|
+
})
|
|
35
|
+
}
|
|
36
|
+
|
|
22
37
|
export default i18n
|
package/src/main.tsx
CHANGED
|
@@ -12,7 +12,9 @@ import { BrowserRouter } from 'react-router-dom'
|
|
|
12
12
|
import { SWRConfig } from 'swr'
|
|
13
13
|
|
|
14
14
|
import { fetchApiJson } from '#~/api/base.js'
|
|
15
|
+
import { setupPwa } from '#~/pwa.js'
|
|
15
16
|
import { getClientBase, resolveDevDocumentTitle } from '#~/runtime-config.js'
|
|
17
|
+
import { setupMobileViewport } from '#~/utils/mobile-viewport.js'
|
|
16
18
|
|
|
17
19
|
import App from './App'
|
|
18
20
|
|
|
@@ -26,7 +28,13 @@ document.title = appTitle
|
|
|
26
28
|
|
|
27
29
|
const root = createRoot(document.getElementById('root')!)
|
|
28
30
|
|
|
31
|
+
setupMobileViewport()
|
|
32
|
+
|
|
29
33
|
const clientBase = getClientBase()
|
|
34
|
+
setupPwa({
|
|
35
|
+
clientBase,
|
|
36
|
+
isProd: import.meta.env.PROD
|
|
37
|
+
})
|
|
30
38
|
|
|
31
39
|
document.title = resolveDevDocumentTitle(document.title, {
|
|
32
40
|
isDev: import.meta.env.DEV,
|
package/src/pwa.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
const normalizeBasePath = (clientBase: string) => {
|
|
2
|
+
const trimmed = clientBase.trim()
|
|
3
|
+
const withLeadingSlash = trimmed.startsWith('/') ? trimmed : `/${trimmed}`
|
|
4
|
+
return withLeadingSlash.endsWith('/') ? withLeadingSlash : `${withLeadingSlash}/`
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
const getServiceWorkerRegistration = (clientBase: string) => {
|
|
8
|
+
const scope = normalizeBasePath(clientBase)
|
|
9
|
+
return {
|
|
10
|
+
scope,
|
|
11
|
+
url: `${scope}sw.js`
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const unregisterDevServiceWorker = async (scope: string) => {
|
|
16
|
+
if (typeof navigator.serviceWorker.getRegistrations !== 'function') return
|
|
17
|
+
|
|
18
|
+
const scopeUrl = new URL(scope, window.location.origin).href
|
|
19
|
+
const registrations = await navigator.serviceWorker.getRegistrations()
|
|
20
|
+
await Promise.all(
|
|
21
|
+
registrations
|
|
22
|
+
.filter(registration => registration.scope === scopeUrl)
|
|
23
|
+
.map(registration => registration.unregister())
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const setupPwa = (input: {
|
|
28
|
+
clientBase: string
|
|
29
|
+
isProd: boolean
|
|
30
|
+
}) => {
|
|
31
|
+
if (!('serviceWorker' in navigator)) return
|
|
32
|
+
|
|
33
|
+
const registration = getServiceWorkerRegistration(input.clientBase)
|
|
34
|
+
if (!input.isProd) {
|
|
35
|
+
void unregisterDevServiceWorker(registration.scope)
|
|
36
|
+
return
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
window.addEventListener('load', () => {
|
|
40
|
+
void navigator.serviceWorker
|
|
41
|
+
.register(registration.url, { scope: registration.scope })
|
|
42
|
+
.catch((error: unknown) => {
|
|
43
|
+
console.warn('[pwa] service worker registration failed', error)
|
|
44
|
+
})
|
|
45
|
+
})
|
|
46
|
+
}
|