@kingsoftcloud/ksadk-web 0.3.0 → 0.3.2
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 +138 -0
- package/RELEASE_PROVENANCE.json +7 -0
- package/dist-ksadk/assets/{ArtifactsPanel-Cjnqt-8W.js → ArtifactsPanel-DSU1sWD_.js} +1 -1
- package/dist-ksadk/assets/{CodeBlock-BqyqZfuB.js → CodeBlock-DOH6MVcn.js} +4 -4
- package/dist-ksadk/assets/{MathMessageMarkdown-BpH7jiFM.js → MathMessageMarkdown-BL8my1R2.js} +4 -4
- package/dist-ksadk/assets/MathMessageMarkdown-BorAY7qD.css +1 -0
- package/dist-ksadk/assets/MermaidBlock-Dz4IP-Tx.js +312 -0
- package/dist-ksadk/assets/NativeTerminalPanel-DUrK0JpZ.js +1 -0
- package/dist-ksadk/assets/abnfDiagram-VCTEODGH-g20pFzNV.js +1 -0
- package/dist-ksadk/assets/arc-C4FzinUA.js +1 -0
- package/dist-ksadk/assets/architecture-7GRP2DOG-DjKratdf.js +1 -0
- package/dist-ksadk/assets/architectureDiagram-5GKGNRK7-DpIqL5h4.js +36 -0
- package/dist-ksadk/assets/blockDiagram-NRAW4CY4-BjkljTNz.js +129 -0
- package/dist-ksadk/assets/c4Diagram-UCG6FXSJ-Dk_ieq2X.js +38 -0
- package/dist-ksadk/assets/channel-4cQHKtx1.js +1 -0
- package/dist-ksadk/assets/chunk-2Q5K7J3B-DmgWkESh.js +1 -0
- package/dist-ksadk/assets/{chunk-FMBD7UC4-BGhvzDYt.js → chunk-5VM5RSS4-BVHAchFb.js} +1 -1
- package/dist-ksadk/assets/{chunk-ND2GUHAM-D98vPd-E.js → chunk-F27PBJKO-C-ipQzuS.js} +1 -1
- package/dist-ksadk/assets/chunk-G27WJ6UU-C2EyJbIK.js +231 -0
- package/dist-ksadk/assets/{chunk-4BX2VUAB-CsWIQRhc.js → chunk-JWPE2WC7-vYvVJb_M.js} +1 -1
- package/dist-ksadk/assets/chunk-LCL6LL3I-BcI6ysPT.js +206 -0
- package/dist-ksadk/assets/chunk-POPQ4Y6H-C030x_Z1.js +1 -0
- package/dist-ksadk/assets/chunk-RHFEMEQ7-yyGpsz4n.js +168 -0
- package/dist-ksadk/assets/chunk-SVP7TREG-BLTlmMU7.js +88 -0
- package/dist-ksadk/assets/chunk-XXDRQBXY-C_32ArgP.js +1 -0
- package/dist-ksadk/assets/classDiagram-DTDB5LWJ-DLFd9Xi0.js +1 -0
- package/dist-ksadk/assets/classDiagram-v2-JRS7N3AN-DLFd9Xi0.js +1 -0
- package/dist-ksadk/assets/{cose-bilkent-S5V4N54A-CX3yotHq.js → cose-bilkent-JH36ORCC-9YQYwdl0.js} +1 -1
- package/dist-ksadk/assets/cynefin-OW5HDTMX-DjEM48Qp.js +1 -0
- package/dist-ksadk/assets/cynefinDiagram-5FMLGOSQ-ErLF5N13.js +62 -0
- package/dist-ksadk/assets/cytoscape.esm-CyCl8rPi.js +321 -0
- package/dist-ksadk/assets/dagre-3AP2YEHR-DFiQF-6f.js +4 -0
- package/dist-ksadk/assets/dagre-BuhGnRI1.js +1 -0
- package/dist-ksadk/assets/diagram-S7CK7UJ4-Bt1v8-GC.js +30 -0
- package/dist-ksadk/assets/diagram-UQ7AKVKN-DSCxJdBK.js +41 -0
- package/dist-ksadk/assets/diagram-VSXAHHWV-DHfYwp_9.js +3 -0
- package/dist-ksadk/assets/diagram-VX7I27RA-DdzD-4Le.js +24 -0
- package/dist-ksadk/assets/diagram-Z3DM3KII-Du-nAJ9F.js +24 -0
- package/dist-ksadk/assets/{dist-D82mtD2s.js → dist-8hqcx0sU.js} +1 -1
- package/dist-ksadk/assets/dist-B7seoj3d.js +1 -0
- package/dist-ksadk/assets/{dist-DHn6nBzr.js → dist-BE7bu-DL.js} +1 -1
- package/dist-ksadk/assets/{dist-eoW6tZXA.js → dist-BVDffZ0U.js} +1 -1
- package/dist-ksadk/assets/{dist-C2xjE7cO.js → dist-BX8z72IC.js} +1 -1
- package/dist-ksadk/assets/{dist-CgF3fj15.js → dist-Bf2M8m3N.js} +1 -1
- package/dist-ksadk/assets/{dist-Bs-jQcRX.js → dist-BjU6y-A2.js} +1 -1
- package/dist-ksadk/assets/{dist-Djgl2wVZ.js → dist-BytlxIDT.js} +1 -1
- package/dist-ksadk/assets/{dist-CVQRZjPu.js → dist-CSh_DE14.js} +1 -1
- package/dist-ksadk/assets/{dist-6CVKuTAe.js → dist-CXYYBw3_.js} +1 -1
- package/dist-ksadk/assets/{dist-DlzCRy0S.js → dist-C_wsv-Qd.js} +1 -1
- package/dist-ksadk/assets/{dist-DF06ORQo.js → dist-ClxGviKw.js} +1 -1
- package/dist-ksadk/assets/{dist-Cf23NY4L.js → dist-CttYUqzS.js} +1 -1
- package/dist-ksadk/assets/{dist-ivOya1LD.js → dist-DNp6rLRA.js} +1 -1
- package/dist-ksadk/assets/{dist-BibcG1V9.js → dist-DUX-id_F.js} +1 -1
- package/dist-ksadk/assets/{dist-BUHRxvDG.js → dist-DmldrHd_.js} +1 -1
- package/dist-ksadk/assets/{dist-BZ9n9AjO.js → dist-DnfXs8Vn.js} +2 -2
- package/dist-ksadk/assets/{dist-DqNnNFrw.js → dist-Dq9gLD7L.js} +1 -1
- package/dist-ksadk/assets/{dist-CGcp2ex8.js → dist-W-TIVntx.js} +1 -1
- package/dist-ksadk/assets/{dist-Cwt7koer.js → dist-dDdADKFA.js} +1 -1
- package/dist-ksadk/assets/{dist-C7-3jInC.js → dist-dydu68Fl.js} +1 -1
- package/dist-ksadk/assets/{dist-C99THtIA.js → dist-ngtN0DJB.js} +1 -1
- package/dist-ksadk/assets/ebnfDiagram-PWID7BFC-Da9C9NO1.js +1 -0
- package/dist-ksadk/assets/erDiagram-SSCWMZ5O-EAGqqR79.js +99 -0
- package/dist-ksadk/assets/eventmodeling-NTZA5JFV-CMgMaJrC.js +1 -0
- package/dist-ksadk/assets/flowDiagram-A5DVABFB-BBKL0x3P.js +1 -0
- package/dist-ksadk/assets/ganttDiagram-EL5Y4UJY-DqJsKb59.js +292 -0
- package/dist-ksadk/assets/gitGraph-4MIJSDKK-Dw63mrhw.js +1 -0
- package/dist-ksadk/assets/gitGraphDiagram-WWUBYQGX-B6g4dtDi.js +106 -0
- package/dist-ksadk/assets/index-8ipRcQ-M.js +240 -0
- package/dist-ksadk/assets/index-ByFCqjlh.css +2 -0
- package/dist-ksadk/assets/info-A6RAGUB7-B6iAblII.js +1 -0
- package/dist-ksadk/assets/infoDiagram-RXCK75RN-Djm_nbd5.js +2 -0
- package/dist-ksadk/assets/{ishikawaDiagram-YF4QCWOH-DLOHGvWw.js → ishikawaDiagram-5VMMS53U-DWya9SG2.js} +6 -6
- package/dist-ksadk/assets/{journeyDiagram-JHISSGLW-BIzKeejT.js → journeyDiagram-EYS64GPL-DutxhSNI.js} +6 -6
- package/dist-ksadk/assets/{kanban-definition-UN3LZRKU-BWHoFSw2.js → kanban-definition-3QL26DDD-DJdOF8Fm.js} +10 -10
- package/dist-ksadk/assets/katex-vFWytM5c.js +257 -0
- package/dist-ksadk/assets/{linear-CvMBw9cA.js → linear-BHjG8b-J.js} +1 -1
- package/dist-ksadk/assets/mermaid-parser.core-KGSy4jWT.js +166 -0
- package/dist-ksadk/assets/{mindmap-definition-RKZ34NQL-CSAQxEAe.js → mindmap-definition-FBJOCRG2-9-HC88D4.js} +29 -29
- package/dist-ksadk/assets/packet-AYTQ26CC-BOYAipuq.js +1 -0
- package/dist-ksadk/assets/pegDiagram-XKGWAZYB-DrEZd4fD.js +1 -0
- package/dist-ksadk/assets/pie-WAS4IAKB-Ctq0Kbku.js +1 -0
- package/dist-ksadk/assets/pieDiagram-E7YTZNPT-DpjqOFFp.js +39 -0
- package/dist-ksadk/assets/{quadrantDiagram-W4KKPZXB-CxIR4JXI.js → quadrantDiagram-AXDQQJYC-BiNhgOXX.js} +6 -6
- package/dist-ksadk/assets/radar-RG4KPBEZ-DN0-ul_0.js +1 -0
- package/dist-ksadk/assets/railroad-74A4TZTK-C6cC_to0.js +1 -0
- package/dist-ksadk/assets/railroad-abnf-HS5TGJTU-BimjIuRc.js +1 -0
- package/dist-ksadk/assets/railroad-ebnf-LZEXJU2U-CvY65ABq.js +1 -0
- package/dist-ksadk/assets/railroad-peg-WCYAUIDC-D72Iq_Tv.js +1 -0
- package/dist-ksadk/assets/railroadDiagram-O6MQD6OU-_Y3Ojg6G.js +1 -0
- package/dist-ksadk/assets/requirementDiagram-EFPCY7ZU-DeCFdg9K.js +84 -0
- package/dist-ksadk/assets/{sankeyDiagram-5OEKKPKP-DpGa6EAV.js → sankeyDiagram-P5KCCOFB-CPH75rhw.js} +7 -7
- package/dist-ksadk/assets/{sequenceDiagram-3UESZ5HK-NTKNGGe5.js → sequenceDiagram-WJ2MYXX4-OEpQQdr4.js} +10 -10
- package/dist-ksadk/assets/sizeCapture-X5ZJPWSS-heUErzhI.js +1 -0
- package/dist-ksadk/assets/stateDiagram-HBIQ2CUA-DvA3jSMB.js +1 -0
- package/dist-ksadk/assets/stateDiagram-v2-4QOOHH4V-BgQY03nz.js +1 -0
- package/dist-ksadk/assets/swimlanes-XN3QIQJK-CR-dfN_t.js +1 -0
- package/dist-ksadk/assets/swimlanesDiagram-VK2B7HYN-DLVw3q5Q.js +8 -0
- package/dist-ksadk/assets/{timeline-definition-PNZ67QCA-jqoYs3jQ.js → timeline-definition-24CTP7MA-DAVJf1TX.js} +7 -7
- package/dist-ksadk/assets/treeView-Q6P3EWNA-BMpO0wsB.js +1 -0
- package/dist-ksadk/assets/treemap-WGGIJYW6-Et0aqzU3.js +1 -0
- package/dist-ksadk/assets/vennDiagram-4TSXK5OY-DwM8eDkh.js +34 -0
- package/dist-ksadk/assets/wardley-WFR3VGLG-CbY0mhpl.js +1 -0
- package/dist-ksadk/assets/wardleyDiagram-VM6X3IG4-DZL-Zz2t.js +78 -0
- package/dist-ksadk/assets/xychartDiagram-S5SC5T6Z-Dy6Yh_hu.js +7 -0
- package/dist-ksadk/index.html +2 -2
- package/dist-lib/App.d.ts.map +1 -1
- package/dist-lib/{ArtifactsPanel-BAfHt4bC.js → ArtifactsPanel-DDCKcvaL.js} +1 -1
- package/dist-lib/{CodeBlock-Cbl6cxYC.js → CodeBlock-BS9DcS5a.js} +3 -3
- package/dist-lib/{MathMessageMarkdown-DbMSeHQa.js → MathMessageMarkdown-CpCcJFjZ.js} +2 -2
- package/dist-lib/{NativeTerminalPanel-BTPHqbvY.js → NativeTerminalPanel-CDqCdIly.js} +14 -6
- package/dist-lib/{WorkspacePanelContainer-Iy0LhhgG.js → WorkspacePanelContainer-DzbAkIfx.js} +1746 -913
- package/dist-lib/api/client.d.ts.map +1 -1
- package/dist-lib/api/events.d.ts +7 -0
- package/dist-lib/api/events.d.ts.map +1 -1
- package/dist-lib/api/run.d.ts +32 -0
- package/dist-lib/api/run.d.ts.map +1 -1
- package/dist-lib/api/session.d.ts +10 -1
- package/dist-lib/api/session.d.ts.map +1 -1
- package/dist-lib/capabilities-njdklP3r.js +200 -0
- package/dist-lib/capabilities.js +1 -1
- package/dist-lib/components/chat/ChatComposer.d.ts +9 -1
- package/dist-lib/components/chat/ChatComposer.d.ts.map +1 -1
- package/dist-lib/components/chat/ChatMessageList.d.ts +4 -1
- package/dist-lib/components/chat/ChatMessageList.d.ts.map +1 -1
- package/dist-lib/components/chat/ChatSidebar.d.ts.map +1 -1
- package/dist-lib/components/chat/ConnectedComposer.d.ts +13 -2
- package/dist-lib/components/chat/ConnectedComposer.d.ts.map +1 -1
- package/dist-lib/components/chat/ConnectedMessageList.d.ts +2 -1
- package/dist-lib/components/chat/ConnectedMessageList.d.ts.map +1 -1
- package/dist-lib/components/chat/ExecutionModeMenu.d.ts +12 -0
- package/dist-lib/components/chat/ExecutionModeMenu.d.ts.map +1 -0
- package/dist-lib/components/chat/InteractionA2uiSurface.d.ts +14 -0
- package/dist-lib/components/chat/InteractionA2uiSurface.d.ts.map +1 -0
- package/dist-lib/components/chat/InteractionHistoryAnchor.d.ts +12 -0
- package/dist-lib/components/chat/InteractionHistoryAnchor.d.ts.map +1 -0
- package/dist-lib/components/chat/InteractionSchemaForm.d.ts +14 -0
- package/dist-lib/components/chat/InteractionSchemaForm.d.ts.map +1 -0
- package/dist-lib/components/chat/InteractionTray.d.ts +23 -0
- package/dist-lib/components/chat/InteractionTray.d.ts.map +1 -0
- package/dist-lib/components/chat/ModelSettingsMenu.d.ts +13 -0
- package/dist-lib/components/chat/ModelSettingsMenu.d.ts.map +1 -0
- package/dist-lib/components/chat/PermissionMenu.d.ts.map +1 -1
- package/dist-lib/components/chat/ProcessingBlocksView.d.ts +4 -1
- package/dist-lib/components/chat/ProcessingBlocksView.d.ts.map +1 -1
- package/dist-lib/components/chat/schema-fields.d.ts +13 -0
- package/dist-lib/components/chat/schema-fields.d.ts.map +1 -0
- package/dist-lib/components/chat/types.d.ts +8 -0
- package/dist-lib/components/chat/types.d.ts.map +1 -1
- package/dist-lib/components/native/NativeTerminalPanel.d.ts.map +1 -1
- package/dist-lib/components.js +3 -3
- package/dist-lib/core/api/facade.d.ts +26 -1
- package/dist-lib/core/api/facade.d.ts.map +1 -1
- package/dist-lib/core/api/types.d.ts +29 -1
- package/dist-lib/core/api/types.d.ts.map +1 -1
- package/dist-lib/core/interaction/a2ui-validate.d.ts +21 -0
- package/dist-lib/core/interaction/a2ui-validate.d.ts.map +1 -0
- package/dist-lib/core/interaction/adapters/agui.d.ts +23 -0
- package/dist-lib/core/interaction/adapters/agui.d.ts.map +1 -0
- package/dist-lib/core/interaction/adapters/normalize.d.ts +29 -0
- package/dist-lib/core/interaction/adapters/normalize.d.ts.map +1 -0
- package/dist-lib/core/interaction/adapters/responses.d.ts +25 -0
- package/dist-lib/core/interaction/adapters/responses.d.ts.map +1 -0
- package/dist-lib/core/interaction/adapters/session-events.d.ts +17 -0
- package/dist-lib/core/interaction/adapters/session-events.d.ts.map +1 -0
- package/dist-lib/core/interaction/client.d.ts +63 -0
- package/dist-lib/core/interaction/client.d.ts.map +1 -0
- package/dist-lib/core/interaction/index.d.ts +41 -0
- package/dist-lib/core/interaction/index.d.ts.map +1 -0
- package/dist-lib/core/interaction/store.d.ts +0 -0
- package/dist-lib/core/interaction/store.d.ts.map +1 -0
- package/dist-lib/core/interaction/types.d.ts +91 -0
- package/dist-lib/core/interaction/types.d.ts.map +1 -0
- package/dist-lib/core/run/dispatcher.d.ts.map +1 -1
- package/dist-lib/core/run/engine.d.ts +24 -1
- package/dist-lib/core/run/engine.d.ts.map +1 -1
- package/dist-lib/core/run/types.d.ts +32 -0
- package/dist-lib/core/run/types.d.ts.map +1 -1
- package/dist-lib/core/stream/index.d.ts +2 -0
- package/dist-lib/core/stream/index.d.ts.map +1 -1
- package/dist-lib/core/stream/kernel-events.d.ts +56 -0
- package/dist-lib/core/stream/kernel-events.d.ts.map +1 -0
- package/dist-lib/core/stream/responses-protocol.d.ts +7 -0
- package/dist-lib/core/stream/responses-protocol.d.ts.map +1 -1
- package/dist-lib/core/stream/runtime-items.d.ts +174 -0
- package/dist-lib/core/stream/runtime-items.d.ts.map +1 -0
- package/dist-lib/core/stream/types.d.ts +4 -0
- package/dist-lib/core/stream/types.d.ts.map +1 -1
- package/dist-lib/hooks/useBootstrap.d.ts +1 -0
- package/dist-lib/hooks/useBootstrap.d.ts.map +1 -1
- package/dist-lib/hooks/useInteractions.d.ts +34 -0
- package/dist-lib/hooks/useInteractions.d.ts.map +1 -0
- package/dist-lib/hooks/useRunAgent.d.ts +8 -6
- package/dist-lib/hooks/useRunAgent.d.ts.map +1 -1
- package/dist-lib/hooks/useSessionLifecycle.d.ts.map +1 -1
- package/dist-lib/public/runtime.d.ts +7 -0
- package/dist-lib/public/runtime.d.ts.map +1 -1
- package/dist-lib/runtime.js +2393 -1157
- package/dist-lib/stores/bootstrap.d.ts +4 -0
- package/dist-lib/stores/bootstrap.d.ts.map +1 -1
- package/dist-lib/stores/streaming.d.ts +8 -0
- package/dist-lib/stores/streaming.d.ts.map +1 -1
- package/dist-lib/stores/ui.d.ts +8 -14
- package/dist-lib/stores/ui.d.ts.map +1 -1
- package/dist-lib/styles.css +1 -1
- package/dist-lib/types/agent-control.d.ts +93 -0
- package/dist-lib/types/agent-control.d.ts.map +1 -0
- package/dist-lib/types/capabilities.d.ts +7 -0
- package/dist-lib/types/capabilities.d.ts.map +1 -1
- package/dist-lib/types/runtime-capability-matrix.d.ts +15 -0
- package/dist-lib/types/runtime-capability-matrix.d.ts.map +1 -0
- package/dist-lib/utils/capabilities.d.ts.map +1 -1
- package/dist-lib/utils/feedback.d.ts +0 -1
- package/dist-lib/utils/feedback.d.ts.map +1 -1
- package/dist-lib/utils/responses-stream.d.ts +2 -1
- package/dist-lib/utils/responses-stream.d.ts.map +1 -1
- package/dist-lib/utils/session-event-history.d.ts +54 -0
- package/dist-lib/utils/session-event-history.d.ts.map +1 -0
- package/dist-lib/utils/session-events.d.ts +8 -0
- package/dist-lib/utils/session-events.d.ts.map +1 -1
- package/dist-lib/utils/session-list.d.ts +1 -0
- package/dist-lib/utils/session-list.d.ts.map +1 -1
- package/package.json +4 -1
- package/dist-ksadk/assets/MathMessageMarkdown-DeYh8QPr.css +0 -1
- package/dist-ksadk/assets/MermaidBlock-DWuxETaJ.js +0 -303
- package/dist-ksadk/assets/NativeTerminalPanel-MDTopWMO.js +0 -1
- package/dist-ksadk/assets/arc-CFKwSk_B.js +0 -1
- package/dist-ksadk/assets/architecture-7EHR7CIX-CynqOWjZ.js +0 -1
- package/dist-ksadk/assets/architectureDiagram-3BPJPVTR-Dej8jX8c.js +0 -36
- package/dist-ksadk/assets/blockDiagram-GPEHLZMM-1F64jqvy.js +0 -132
- package/dist-ksadk/assets/c4Diagram-AAUBKEIU-9q7AUAKb.js +0 -10
- package/dist-ksadk/assets/channel-iUGv2N24.js +0 -1
- package/dist-ksadk/assets/chunk-2J33WTMH-6qgwJm7Q.js +0 -1
- package/dist-ksadk/assets/chunk-55IACEB6-BK8paA20.js +0 -1
- package/dist-ksadk/assets/chunk-727SXJPM-B-JEhy7h.js +0 -206
- package/dist-ksadk/assets/chunk-AQP2D5EJ-DYBvMHAa.js +0 -231
- package/dist-ksadk/assets/chunk-QZHKN3VN-YQIEXeF6.js +0 -1
- package/dist-ksadk/assets/classDiagram-4FO5ZUOK-CDAUuoXK.js +0 -1
- package/dist-ksadk/assets/classDiagram-v2-Q7XG4LA2-CDAUuoXK.js +0 -1
- package/dist-ksadk/assets/cytoscape.esm-DelgaX4f.js +0 -321
- package/dist-ksadk/assets/dagre-BM42HDAG-C7TguAWo.js +0 -4
- package/dist-ksadk/assets/dagre-Bx709z4p.js +0 -1
- package/dist-ksadk/assets/diagram-2AECGRRQ-Dd17_kws.js +0 -43
- package/dist-ksadk/assets/diagram-5GNKFQAL-DVIClIil.js +0 -10
- package/dist-ksadk/assets/diagram-KO2AKTUF-Df_3gYQa.js +0 -3
- package/dist-ksadk/assets/diagram-LMA3HP47-BhLk6ZtA.js +0 -24
- package/dist-ksadk/assets/diagram-OG6HWLK6-D4GNGvuu.js +0 -24
- package/dist-ksadk/assets/dist-DyvYLMW9.js +0 -1
- package/dist-ksadk/assets/erDiagram-TEJ5UH35-CnfRcY2M.js +0 -85
- package/dist-ksadk/assets/eventmodeling-FCH6USID-ChYO-ijM.js +0 -1
- package/dist-ksadk/assets/flowDiagram-I6XJVG4X-DGaJjGNJ.js +0 -162
- package/dist-ksadk/assets/ganttDiagram-6RSMTGT7-DpCoB2g9.js +0 -292
- package/dist-ksadk/assets/gitGraph-WXDBUCRP-BN_0Fk-j.js +0 -1
- package/dist-ksadk/assets/gitGraphDiagram-PVQCEYII-9IKVFBVT.js +0 -106
- package/dist-ksadk/assets/graphlib-B8gBHxth.js +0 -1
- package/dist-ksadk/assets/index-QSwCHuB8.js +0 -177
- package/dist-ksadk/assets/index-jOPmTOZH.css +0 -2
- package/dist-ksadk/assets/info-J43DQDTF-Cp6o3vId.js +0 -1
- package/dist-ksadk/assets/infoDiagram-5YYISTIA-CYIIsb8y.js +0 -2
- package/dist-ksadk/assets/katex-DATssjp1.js +0 -265
- package/dist-ksadk/assets/mermaid-parser.core-mGAcEwcq.js +0 -161
- package/dist-ksadk/assets/packet-YPE3B663-wQzct3cT.js +0 -1
- package/dist-ksadk/assets/pie-LRSECV5Y-BgTQiv-9.js +0 -1
- package/dist-ksadk/assets/pieDiagram-4H26LBE5-By-ra07M.js +0 -30
- package/dist-ksadk/assets/radar-GUYGQ44K-BIq5fXsn.js +0 -1
- package/dist-ksadk/assets/requirementDiagram-4Y6WPE33-DpW90iu3.js +0 -84
- package/dist-ksadk/assets/stateDiagram-AJRCARHV-DGpd9yFG.js +0 -1
- package/dist-ksadk/assets/stateDiagram-v2-BHNVJYJU-B3o579IQ.js +0 -1
- package/dist-ksadk/assets/treeView-BLDUP644-Dqi-E0EM.js +0 -1
- package/dist-ksadk/assets/treemap-LRROVOQU-ClQP9CJ9.js +0 -1
- package/dist-ksadk/assets/vennDiagram-CIIHVFJN-l3Z7-wbP.js +0 -34
- package/dist-ksadk/assets/wardley-L42UT6IY-8XLvnNIs.js +0 -1
- package/dist-ksadk/assets/wardleyDiagram-YWT4CUSO-BR54GPmr.js +0 -78
- package/dist-ksadk/assets/xychartDiagram-2RQKCTM6-SkiH8GsK.js +0 -7
- package/dist-lib/capabilities-CxHZ869f.js +0 -133
- package/dist-lib/components/chat/MenuChip.d.ts +0 -19
- package/dist-lib/components/chat/MenuChip.d.ts.map +0 -1
package/dist-lib/{WorkspacePanelContainer-Iy0LhhgG.js → WorkspacePanelContainer-DzbAkIfx.js}
RENAMED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { ArrowDown as e, ArrowUp as t, Bot as n, Check as r, ChevronDown as i,
|
|
2
|
-
import { clsx as
|
|
3
|
-
import { twMerge as
|
|
4
|
-
import { create as
|
|
1
|
+
import { ArrowDown as e, ArrowUp as t, Bot as n, Check as r, ChevronDown as i, ChevronLeft as a, ChevronRight as o, Code as s, Copy as c, Download as l, ExternalLink as u, Eye as d, FileCode2 as f, FileDiff as p, FileText as m, FolderOpen as h, Globe2 as g, Hand as _, Image as v, ListTodo as y, Loader2 as b, LoaderCircle as x, Maximize2 as S, MessageSquarePlus as C, MessageSquareText as w, Minimize2 as ee, MoreHorizontal as T, Package as E, PanelLeft as te, PanelLeftClose as D, Paperclip as ne, Pin as re, PinOff as ie, Plus as O, RefreshCcw as k, RefreshCw as ae, Save as oe, Search as se, ShieldAlert as A, ShieldCheck as j, Sparkles as M, Square as N, StopCircle as ce, Target as le, TerminalSquare as P, ThumbsDown as ue, ThumbsUp as de, Trash2 as fe, Upload as pe, WifiOff as F, Wrench as I, X as me, XCircle as L, ZapOff as he } from "lucide-react";
|
|
2
|
+
import { clsx as ge } from "clsx";
|
|
3
|
+
import { twMerge as _e } from "tailwind-merge";
|
|
4
|
+
import { create as ve } from "zustand";
|
|
5
5
|
import { Fragment as R, jsx as z, jsxs as B } from "react/jsx-runtime";
|
|
6
6
|
import * as V from "react";
|
|
7
|
-
import
|
|
7
|
+
import H, { Suspense as U, lazy as ye, useCallback as W, useEffect as G, useId as be, useLayoutEffect as xe, useMemo as Se, useRef as K, useState as q } from "react";
|
|
8
8
|
import * as J from "@radix-ui/react-dialog";
|
|
9
|
-
import { cva as
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import { A2UIProvider as
|
|
14
|
-
import { EditorView as
|
|
15
|
-
import { Compartment as
|
|
16
|
-
import { defaultKeymap as
|
|
17
|
-
import { LanguageDescription as
|
|
18
|
-
import { oneDark as
|
|
19
|
-
import { highlightSelectionMatches as
|
|
20
|
-
import { autocompletion as
|
|
21
|
-
import { languages as
|
|
9
|
+
import { cva as Ce } from "class-variance-authority";
|
|
10
|
+
import we from "react-markdown";
|
|
11
|
+
import Te from "remark-gfm";
|
|
12
|
+
import Ee from "remark-breaks";
|
|
13
|
+
import { A2UIProvider as De, A2UIRenderer as Oe, A2UI_SCHEMA_CONTEXT_DESCRIPTION as ke, basicCatalog as Ae, buildCatalogContextValue as je, useA2UI as Me } from "@copilotkit/a2ui-renderer";
|
|
14
|
+
import { EditorView as Ne, crosshairCursor as Pe, drawSelection as Fe, dropCursor as Ie, highlightActiveLine as Le, highlightActiveLineGutter as Re, keymap as ze, lineNumbers as Be, rectangularSelection as Ve } from "@codemirror/view";
|
|
15
|
+
import { Compartment as He, EditorState as Ue } from "@codemirror/state";
|
|
16
|
+
import { defaultKeymap as We, history as Ge, historyKeymap as Ke, indentWithTab as qe } from "@codemirror/commands";
|
|
17
|
+
import { LanguageDescription as Je, bracketMatching as Ye, defaultHighlightStyle as Xe, foldGutter as Ze, foldKeymap as Qe, indentOnInput as $e, syntaxHighlighting as et } from "@codemirror/language";
|
|
18
|
+
import { oneDark as tt } from "@codemirror/theme-one-dark";
|
|
19
|
+
import { highlightSelectionMatches as nt, searchKeymap as rt } from "@codemirror/search";
|
|
20
|
+
import { autocompletion as it, closeBrackets as at, closeBracketsKeymap as ot, completionKeymap as st } from "@codemirror/autocomplete";
|
|
21
|
+
import { languages as ct } from "@codemirror/language-data";
|
|
22
22
|
//#region src/lib/utils.ts
|
|
23
23
|
function Y(...e) {
|
|
24
|
-
return
|
|
24
|
+
return _e(ge(e));
|
|
25
25
|
}
|
|
26
26
|
//#endregion
|
|
27
27
|
//#region src/stores/model.ts
|
|
28
|
-
function
|
|
28
|
+
function lt(e, t) {
|
|
29
29
|
let n = /* @__PURE__ */ new Map();
|
|
30
30
|
for (let t of e) t?.id && n.set(t.id, t);
|
|
31
31
|
for (let e of t) e?.id && n.set(e.id, {
|
|
@@ -34,34 +34,21 @@ function it(e, t) {
|
|
|
34
34
|
});
|
|
35
35
|
return Array.from(n.values()).sort((e, t) => e.id.localeCompare(t.id));
|
|
36
36
|
}
|
|
37
|
-
var
|
|
37
|
+
var ut = ve()((e) => ({
|
|
38
38
|
availableModels: [],
|
|
39
39
|
selectedModel: "",
|
|
40
40
|
modelSource: "",
|
|
41
41
|
modelCatalogLoaded: !1,
|
|
42
42
|
thinkingMode: "auto",
|
|
43
|
-
upsertModels: (t) => e((e) => ({ availableModels:
|
|
43
|
+
upsertModels: (t) => e((e) => ({ availableModels: lt(e.availableModels, t) })),
|
|
44
44
|
setSelectedModel: (t) => e({ selectedModel: t }),
|
|
45
45
|
setModelSource: (t) => e({ modelSource: t }),
|
|
46
46
|
setModelCatalogLoaded: (t) => e({ modelCatalogLoaded: t }),
|
|
47
47
|
setThinkingMode: (t) => e({ thinkingMode: t })
|
|
48
|
-
}))
|
|
49
|
-
"auto",
|
|
50
|
-
"enabled",
|
|
51
|
-
"disabled"
|
|
52
|
-
]);
|
|
53
|
-
function st(e) {
|
|
54
|
-
let t = String(e || "").trim().toLowerCase();
|
|
55
|
-
return ot.has(t) ? t : "auto";
|
|
56
|
-
}
|
|
57
|
-
function ct(e) {
|
|
58
|
-
let t = st(e);
|
|
59
|
-
if (t === "disabled") return { thinking: { type: "disabled" } };
|
|
60
|
-
if (t === "enabled") return { thinking: { type: "enabled" } };
|
|
61
|
-
}
|
|
48
|
+
}));
|
|
62
49
|
//#endregion
|
|
63
50
|
//#region src/components/chat/ContextUsageIndicator.tsx
|
|
64
|
-
function
|
|
51
|
+
function dt({ indicator: e }) {
|
|
65
52
|
let t = Math.max(0, Math.min(100, e.percent ?? 0));
|
|
66
53
|
return /* @__PURE__ */ B("div", {
|
|
67
54
|
className: "group relative flex h-8 w-8 items-center justify-center",
|
|
@@ -86,108 +73,337 @@ function lt({ indicator: e }) {
|
|
|
86
73
|
}),
|
|
87
74
|
/* @__PURE__ */ z("div", {
|
|
88
75
|
className: "whitespace-nowrap font-light text-text-muted",
|
|
89
|
-
children: e.usedTokens && e.contextWindowTokens ? `${
|
|
76
|
+
children: e.usedTokens && e.contextWindowTokens ? `${ft(e.usedTokens)} / ${ft(e.contextWindowTokens)}` : e.label
|
|
90
77
|
})
|
|
91
78
|
]
|
|
92
79
|
})]
|
|
93
80
|
});
|
|
94
81
|
}
|
|
95
|
-
function
|
|
82
|
+
function ft(e) {
|
|
96
83
|
return e >= 1e6 ? `${(e / 1e6).toFixed(1)}m` : e >= 1e3 ? `${(e / 1e3).toFixed(0)}k` : String(e);
|
|
97
84
|
}
|
|
98
85
|
//#endregion
|
|
99
|
-
//#region src/components/chat/
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
86
|
+
//#region src/components/chat/ExecutionModeMenu.tsx
|
|
87
|
+
var pt = [{
|
|
88
|
+
value: "plan",
|
|
89
|
+
label: "计划模式",
|
|
90
|
+
description: "先分析并形成可执行计划",
|
|
91
|
+
icon: y
|
|
92
|
+
}, {
|
|
93
|
+
value: "goal",
|
|
94
|
+
label: "设定目标",
|
|
95
|
+
description: "朝可验证的停止条件持续推进",
|
|
96
|
+
icon: le
|
|
97
|
+
}], mt = {
|
|
98
|
+
plan: "计划模式",
|
|
99
|
+
goal: "目标"
|
|
100
|
+
};
|
|
101
|
+
function ht({ attachmentsEnabled: e, mode: t, support: n, onSelectMode: a, onUpload: o }) {
|
|
102
|
+
let [s, c] = q(!1), l = K(null), u = pt.filter((e) => n[e.value]);
|
|
103
|
+
return G(() => {
|
|
104
|
+
if (!s) return;
|
|
105
|
+
let e = (e) => {
|
|
106
|
+
l.current && !l.current.contains(e.target) && c(!1);
|
|
107
|
+
}, t = (e) => {
|
|
108
|
+
e.key === "Escape" && c(!1);
|
|
109
|
+
};
|
|
110
|
+
return document.addEventListener("mousedown", e), document.addEventListener("keydown", t), () => {
|
|
111
|
+
document.removeEventListener("mousedown", e), document.removeEventListener("keydown", t);
|
|
112
|
+
};
|
|
113
|
+
}, [s]), !e && u.length === 0 ? null : /* @__PURE__ */ B("div", {
|
|
114
|
+
ref: l,
|
|
115
|
+
className: "relative flex min-w-0 items-center gap-1",
|
|
116
|
+
children: [
|
|
117
|
+
/* @__PURE__ */ z("button", {
|
|
118
|
+
type: "button",
|
|
119
|
+
onClick: () => c((e) => !e),
|
|
120
|
+
className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-xl text-text-secondary transition hover:bg-muted hover:text-text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/25",
|
|
121
|
+
"aria-expanded": s,
|
|
122
|
+
"aria-haspopup": "menu",
|
|
123
|
+
"aria-label": "添加附件或选择执行模式",
|
|
124
|
+
title: "添加附件或选择执行模式",
|
|
125
|
+
children: /* @__PURE__ */ z(O, { className: "h-[19px] w-[19px]" })
|
|
126
|
+
}),
|
|
127
|
+
t ? /* @__PURE__ */ B("button", {
|
|
128
|
+
type: "button",
|
|
129
|
+
onClick: () => c((e) => !e),
|
|
130
|
+
className: Y("flex h-8 max-w-[8.5rem] items-center gap-1 rounded-xl px-2 text-[12px] transition", t === "goal" ? "bg-amber-50 text-amber-700 hover:bg-amber-100 dark:bg-amber-950/40 dark:text-amber-300" : "text-text-secondary hover:bg-muted hover:text-text-primary"),
|
|
131
|
+
"aria-label": `当前执行模式:${mt[t]}`,
|
|
132
|
+
children: [/* @__PURE__ */ z("span", {
|
|
133
|
+
className: "truncate",
|
|
134
|
+
children: mt[t]
|
|
135
|
+
}), /* @__PURE__ */ z(i, { className: "h-3.5 w-3.5 shrink-0" })]
|
|
136
|
+
}) : null,
|
|
137
|
+
s ? /* @__PURE__ */ B("div", {
|
|
138
|
+
role: "menu",
|
|
139
|
+
"aria-label": "附件与执行模式",
|
|
140
|
+
className: "absolute bottom-[calc(100%+0.65rem)] left-0 z-40 w-[min(19rem,calc(100vw-2rem))] rounded-2xl border border-border/80 bg-popover p-1.5 shadow-[0_18px_44px_rgba(15,23,42,0.16)]",
|
|
141
|
+
children: [
|
|
142
|
+
e ? /* @__PURE__ */ B("button", {
|
|
143
|
+
type: "button",
|
|
144
|
+
role: "menuitem",
|
|
145
|
+
onClick: () => {
|
|
146
|
+
o(), c(!1);
|
|
147
|
+
},
|
|
148
|
+
className: "flex w-full items-center gap-2.5 rounded-xl px-2.5 py-2.5 text-left transition hover:bg-muted/70",
|
|
149
|
+
children: [/* @__PURE__ */ z(pe, { className: "h-4 w-4 shrink-0 text-text-muted" }), /* @__PURE__ */ B("span", { children: [/* @__PURE__ */ z("span", {
|
|
150
|
+
className: "block text-[13px] font-medium text-text-primary",
|
|
151
|
+
children: "上传附件"
|
|
152
|
+
}), /* @__PURE__ */ z("span", {
|
|
153
|
+
className: "block text-[11px] text-text-muted",
|
|
154
|
+
children: "添加文件或图片到当前消息"
|
|
155
|
+
})] })]
|
|
156
|
+
}) : null,
|
|
157
|
+
e && u.length > 0 ? /* @__PURE__ */ z("div", { className: "my-1 h-px bg-border/70" }) : null,
|
|
158
|
+
u.map((e) => {
|
|
159
|
+
let n = e.icon, i = t === e.value;
|
|
160
|
+
return /* @__PURE__ */ B("button", {
|
|
161
|
+
type: "button",
|
|
162
|
+
role: "menuitemradio",
|
|
163
|
+
"aria-checked": i,
|
|
164
|
+
onClick: () => {
|
|
165
|
+
a(e.value), c(!1);
|
|
166
|
+
},
|
|
167
|
+
className: Y("flex w-full items-center gap-2.5 rounded-xl px-2.5 py-2.5 text-left transition", i ? "bg-muted" : "hover:bg-muted/70"),
|
|
168
|
+
children: [
|
|
169
|
+
/* @__PURE__ */ z(n, { className: "h-4 w-4 shrink-0 text-text-muted" }),
|
|
170
|
+
/* @__PURE__ */ B("span", {
|
|
171
|
+
className: "min-w-0 flex-1",
|
|
172
|
+
children: [/* @__PURE__ */ z("span", {
|
|
173
|
+
className: "block text-[13px] font-medium text-text-primary",
|
|
174
|
+
children: e.label
|
|
175
|
+
}), /* @__PURE__ */ z("span", {
|
|
176
|
+
className: "block text-[11px] text-text-muted",
|
|
177
|
+
children: e.description
|
|
178
|
+
})]
|
|
179
|
+
}),
|
|
180
|
+
i ? /* @__PURE__ */ z(r, { className: "h-4 w-4 shrink-0 text-text-primary" }) : null
|
|
181
|
+
]
|
|
182
|
+
}, e.value);
|
|
183
|
+
})
|
|
184
|
+
]
|
|
185
|
+
}) : null
|
|
186
|
+
]
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
//#endregion
|
|
190
|
+
//#region src/components/chat/ModelSettingsMenu.tsx
|
|
191
|
+
var gt = [
|
|
192
|
+
{
|
|
193
|
+
value: "auto",
|
|
194
|
+
label: "自动",
|
|
195
|
+
description: "使用模型或 Agent 的默认设置"
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
value: "enabled",
|
|
199
|
+
label: "开启",
|
|
200
|
+
description: "请求模型输出推理过程"
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
value: "disabled",
|
|
204
|
+
label: "关闭",
|
|
205
|
+
description: "不额外请求模型推理"
|
|
206
|
+
}
|
|
207
|
+
], _t = {
|
|
208
|
+
auto: "自动",
|
|
209
|
+
enabled: "开启",
|
|
210
|
+
disabled: "关闭"
|
|
211
|
+
};
|
|
212
|
+
function vt({ availableModels: e, selectedModel: t, thinkingEnabled: n, thinkingMode: a, onSelectModel: s, onSelectThinkingMode: c }) {
|
|
213
|
+
let [l, u] = q(!1), [d, f] = q("model"), p = K(null), m = e.find((e) => e.id === t)?.display_name || t || "选择模型", h = n ? d : "model";
|
|
214
|
+
return G(() => {
|
|
215
|
+
if (!l) return;
|
|
104
216
|
let e = (e) => {
|
|
105
|
-
|
|
217
|
+
p.current && !p.current.contains(e.target) && u(!1);
|
|
218
|
+
}, t = (e) => {
|
|
219
|
+
e.key === "Escape" && u(!1);
|
|
220
|
+
};
|
|
221
|
+
return document.addEventListener("mousedown", e), document.addEventListener("keydown", t), () => {
|
|
222
|
+
document.removeEventListener("mousedown", e), document.removeEventListener("keydown", t);
|
|
106
223
|
};
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
ref: c,
|
|
224
|
+
}, [l]), /* @__PURE__ */ B("div", {
|
|
225
|
+
ref: p,
|
|
110
226
|
className: "relative",
|
|
111
227
|
children: [/* @__PURE__ */ B("button", {
|
|
112
228
|
type: "button",
|
|
113
|
-
onClick: () =>
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
229
|
+
onClick: () => u((e) => !e),
|
|
230
|
+
className: "flex h-8 max-w-[15rem] items-center gap-1.5 rounded-xl bg-muted/80 px-3 text-[13px] text-text-primary transition hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/25",
|
|
231
|
+
"aria-expanded": l,
|
|
232
|
+
"aria-haspopup": "menu",
|
|
233
|
+
"aria-label": n ? `模型 ${m},推理 ${_t[a]}` : `模型 ${m}`,
|
|
234
|
+
title: n ? "选择模型与推理设置" : "选择模型",
|
|
235
|
+
children: [
|
|
236
|
+
/* @__PURE__ */ z("span", {
|
|
237
|
+
className: "min-w-0 truncate",
|
|
238
|
+
children: m
|
|
239
|
+
}),
|
|
240
|
+
n ? /* @__PURE__ */ z("span", {
|
|
241
|
+
className: "shrink-0 text-text-muted",
|
|
242
|
+
children: _t[a]
|
|
243
|
+
}) : null,
|
|
244
|
+
/* @__PURE__ */ z(i, { className: Y("h-3.5 w-3.5 shrink-0 text-text-muted transition-transform", l && "rotate-180") })
|
|
245
|
+
]
|
|
246
|
+
}), l ? /* @__PURE__ */ B("div", {
|
|
247
|
+
className: "absolute bottom-[calc(100%+0.65rem)] right-0 z-40 flex items-end gap-2 sm:flex-row-reverse",
|
|
248
|
+
children: [/* @__PURE__ */ B("div", {
|
|
249
|
+
role: "menu",
|
|
250
|
+
"aria-label": h === "model" ? "选择模型" : "选择推理设置",
|
|
251
|
+
className: "max-h-[min(54vh,22rem)] w-[min(18rem,calc(100vw-2rem))] overflow-y-auto rounded-2xl border border-border/80 bg-popover p-1.5 shadow-[0_18px_44px_rgba(15,23,42,0.16)]",
|
|
252
|
+
children: [
|
|
253
|
+
n ? /* @__PURE__ */ B("div", {
|
|
254
|
+
className: "mb-1 grid grid-cols-2 gap-1 sm:hidden",
|
|
255
|
+
children: [/* @__PURE__ */ z("button", {
|
|
256
|
+
type: "button",
|
|
257
|
+
onClick: () => f("model"),
|
|
258
|
+
className: Y("rounded-lg px-2 py-1.5 text-xs", h === "model" ? "bg-muted text-text-primary" : "text-text-muted"),
|
|
259
|
+
children: "模型"
|
|
260
|
+
}), /* @__PURE__ */ z("button", {
|
|
261
|
+
type: "button",
|
|
262
|
+
onClick: () => f("reasoning"),
|
|
263
|
+
className: Y("rounded-lg px-2 py-1.5 text-xs", h === "reasoning" ? "bg-muted text-text-primary" : "text-text-muted"),
|
|
264
|
+
children: "推理"
|
|
265
|
+
})]
|
|
266
|
+
}) : null,
|
|
267
|
+
/* @__PURE__ */ z("div", {
|
|
268
|
+
className: "px-2.5 pb-1.5 pt-1 text-[11px] font-medium text-text-muted",
|
|
269
|
+
children: h === "model" ? "模型" : "推理设置"
|
|
270
|
+
}),
|
|
271
|
+
h === "model" ? e.map((e) => {
|
|
272
|
+
let n = e.id === t;
|
|
273
|
+
return /* @__PURE__ */ B("button", {
|
|
274
|
+
type: "button",
|
|
275
|
+
role: "menuitemradio",
|
|
276
|
+
"aria-checked": n,
|
|
277
|
+
onClick: () => {
|
|
278
|
+
s(e.id), u(!1);
|
|
279
|
+
},
|
|
280
|
+
className: Y("flex w-full items-center gap-2 rounded-xl px-2.5 py-2 text-left text-[13px] transition-colors", n ? "bg-muted text-text-primary" : "text-text-secondary hover:bg-muted/70 hover:text-text-primary"),
|
|
281
|
+
children: [/* @__PURE__ */ z("span", {
|
|
282
|
+
className: "min-w-0 flex-1 truncate",
|
|
283
|
+
children: e.display_name || e.id
|
|
284
|
+
}), n ? /* @__PURE__ */ z(r, {
|
|
285
|
+
className: "h-4 w-4 shrink-0",
|
|
286
|
+
"aria-hidden": "true"
|
|
287
|
+
}) : null]
|
|
288
|
+
}, e.id);
|
|
289
|
+
}) : gt.map((e) => {
|
|
290
|
+
let t = e.value === a;
|
|
291
|
+
return /* @__PURE__ */ B("button", {
|
|
292
|
+
type: "button",
|
|
293
|
+
role: "menuitemradio",
|
|
294
|
+
"aria-checked": t,
|
|
295
|
+
onClick: () => {
|
|
296
|
+
c(e.value), u(!1);
|
|
297
|
+
},
|
|
298
|
+
className: Y("flex w-full items-center gap-2 rounded-xl px-2.5 py-2 text-left transition-colors", t ? "bg-muted" : "hover:bg-muted/70"),
|
|
299
|
+
children: [/* @__PURE__ */ B("span", {
|
|
300
|
+
className: "min-w-0 flex-1",
|
|
301
|
+
children: [/* @__PURE__ */ z("span", {
|
|
302
|
+
className: "block text-[13px] font-medium text-text-primary",
|
|
303
|
+
children: e.label
|
|
304
|
+
}), /* @__PURE__ */ z("span", {
|
|
305
|
+
className: "block text-[11px] leading-4 text-text-muted",
|
|
306
|
+
children: e.description
|
|
307
|
+
})]
|
|
308
|
+
}), t ? /* @__PURE__ */ z(r, {
|
|
309
|
+
className: "h-4 w-4 shrink-0 text-text-primary",
|
|
310
|
+
"aria-hidden": "true"
|
|
311
|
+
}) : null]
|
|
312
|
+
}, e.value);
|
|
313
|
+
})
|
|
314
|
+
]
|
|
315
|
+
}), /* @__PURE__ */ B("div", {
|
|
316
|
+
className: "hidden w-[16rem] rounded-2xl border border-border/80 bg-popover p-1.5 shadow-[0_18px_44px_rgba(15,23,42,0.13)] sm:block",
|
|
317
|
+
children: [/* @__PURE__ */ B("button", {
|
|
318
|
+
type: "button",
|
|
319
|
+
onClick: () => f("model"),
|
|
320
|
+
className: Y("flex w-full items-center gap-2 rounded-xl px-2.5 py-2.5 text-left text-[13px] transition-colors", h === "model" ? "bg-muted text-text-primary" : "text-text-secondary hover:bg-muted/70"),
|
|
321
|
+
children: [
|
|
322
|
+
/* @__PURE__ */ z("span", {
|
|
323
|
+
className: "font-medium",
|
|
324
|
+
children: "模型"
|
|
325
|
+
}),
|
|
326
|
+
/* @__PURE__ */ z("span", {
|
|
327
|
+
className: "min-w-0 flex-1 truncate text-right text-text-muted",
|
|
328
|
+
children: m
|
|
329
|
+
}),
|
|
330
|
+
/* @__PURE__ */ z(o, { className: "h-4 w-4 shrink-0 text-text-muted" })
|
|
331
|
+
]
|
|
332
|
+
}), n ? /* @__PURE__ */ B("button", {
|
|
333
|
+
type: "button",
|
|
334
|
+
onClick: () => f("reasoning"),
|
|
335
|
+
className: Y("flex w-full items-center gap-2 rounded-xl px-2.5 py-2.5 text-left text-[13px] transition-colors", h === "reasoning" ? "bg-muted text-text-primary" : "text-text-secondary hover:bg-muted/70"),
|
|
336
|
+
children: [
|
|
337
|
+
/* @__PURE__ */ z("span", {
|
|
338
|
+
className: "font-medium",
|
|
339
|
+
children: "推理"
|
|
340
|
+
}),
|
|
341
|
+
/* @__PURE__ */ z("span", {
|
|
342
|
+
className: "min-w-0 flex-1 truncate text-right text-text-muted",
|
|
343
|
+
children: _t[a]
|
|
344
|
+
}),
|
|
345
|
+
/* @__PURE__ */ z(o, { className: "h-4 w-4 shrink-0 text-text-muted" })
|
|
346
|
+
]
|
|
347
|
+
}) : null]
|
|
348
|
+
})]
|
|
133
349
|
}) : null]
|
|
134
350
|
});
|
|
135
351
|
}
|
|
136
352
|
//#endregion
|
|
137
353
|
//#region src/stores/permission.ts
|
|
138
|
-
var
|
|
139
|
-
function
|
|
354
|
+
var yt = "ksadk.web.permission-mode";
|
|
355
|
+
function bt() {
|
|
140
356
|
try {
|
|
141
|
-
let e = globalThis.localStorage?.getItem(
|
|
357
|
+
let e = globalThis.localStorage?.getItem(yt);
|
|
142
358
|
return e === "ask" || e === "full" || e === "risk" ? e : "risk";
|
|
143
359
|
} catch {
|
|
144
360
|
return "risk";
|
|
145
361
|
}
|
|
146
362
|
}
|
|
147
|
-
function
|
|
363
|
+
function xt(e) {
|
|
148
364
|
try {
|
|
149
|
-
globalThis.localStorage?.setItem(
|
|
365
|
+
globalThis.localStorage?.setItem(yt, e);
|
|
150
366
|
} catch {}
|
|
151
367
|
}
|
|
152
|
-
var
|
|
153
|
-
permissionMode:
|
|
368
|
+
var St = ve()((e) => ({
|
|
369
|
+
permissionMode: bt(),
|
|
154
370
|
setPermissionMode: (t) => {
|
|
155
|
-
|
|
371
|
+
xt(t), e({ permissionMode: t });
|
|
156
372
|
}
|
|
157
|
-
})),
|
|
373
|
+
})), Ct = [
|
|
158
374
|
{
|
|
159
375
|
value: "ask",
|
|
160
376
|
label: "请求批准",
|
|
161
377
|
description: "有副作用的操作执行前先确认",
|
|
162
|
-
icon:
|
|
378
|
+
icon: _
|
|
163
379
|
},
|
|
164
380
|
{
|
|
165
381
|
value: "risk",
|
|
166
382
|
label: "风险操作需确认",
|
|
167
383
|
description: "只对命令、写入和外部副作用确认",
|
|
168
|
-
icon:
|
|
384
|
+
icon: j
|
|
169
385
|
},
|
|
170
386
|
{
|
|
171
387
|
value: "full",
|
|
172
388
|
label: "完全访问",
|
|
173
389
|
description: "本次会话不再为默认规则弹出确认",
|
|
174
|
-
icon:
|
|
390
|
+
icon: A
|
|
175
391
|
}
|
|
176
|
-
],
|
|
392
|
+
], wt = {
|
|
177
393
|
ask: "请求批准",
|
|
178
394
|
risk: "风险确认",
|
|
179
395
|
full: "完全访问"
|
|
180
396
|
};
|
|
181
|
-
function
|
|
182
|
-
let [t, n] = q(!1), a = K(null), o =
|
|
183
|
-
return
|
|
184
|
-
|
|
397
|
+
function Tt({ approvalPolicy: e }) {
|
|
398
|
+
let [t, n] = q(!1), a = K(null), o = St((e) => e.permissionMode), s = St((e) => e.setPermissionMode), c = o === "ask" ? _ : o === "full" ? A : j, l = Se(() => Ct.filter((t) => !e || e.Modes.includes(t.value)), [e]);
|
|
399
|
+
return G(() => {
|
|
400
|
+
l.some((e) => e.value === o) || s(e?.DefaultMode || l[0]?.value || "risk");
|
|
185
401
|
}, [
|
|
186
402
|
e?.DefaultMode,
|
|
187
403
|
o,
|
|
188
404
|
s,
|
|
189
|
-
|
|
190
|
-
]),
|
|
405
|
+
l
|
|
406
|
+
]), G(() => {
|
|
191
407
|
if (!t) return;
|
|
192
408
|
let e = (e) => {
|
|
193
409
|
a.current && !a.current.contains(e.target) && n(!1);
|
|
@@ -203,13 +419,13 @@ function vt({ approvalPolicy: e }) {
|
|
|
203
419
|
children: [/* @__PURE__ */ B("button", {
|
|
204
420
|
type: "button",
|
|
205
421
|
onClick: () => n((e) => !e),
|
|
206
|
-
className: "flex h-8 items-center gap-1 rounded-
|
|
422
|
+
className: Y("flex h-8 items-center gap-1.5 rounded-xl px-2.5 text-[13px] transition hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/25", o === "full" ? "text-amber-600 dark:text-amber-400" : "text-text-secondary hover:text-text-primary"),
|
|
207
423
|
"aria-expanded": t,
|
|
208
424
|
"aria-haspopup": "menu",
|
|
209
425
|
title: "设置本次会话的工具审批规则",
|
|
210
426
|
children: [
|
|
211
|
-
/* @__PURE__ */ z(
|
|
212
|
-
/* @__PURE__ */ z("span", { children:
|
|
427
|
+
/* @__PURE__ */ z(c, { className: "h-3.5 w-3.5" }),
|
|
428
|
+
/* @__PURE__ */ z("span", { children: wt[o] }),
|
|
213
429
|
/* @__PURE__ */ z(i, { className: Y("h-3.5 w-3.5 transition-transform", t && "rotate-180") })
|
|
214
430
|
]
|
|
215
431
|
}), t ? /* @__PURE__ */ B("div", {
|
|
@@ -219,7 +435,7 @@ function vt({ approvalPolicy: e }) {
|
|
|
219
435
|
children: [/* @__PURE__ */ z("div", {
|
|
220
436
|
className: "px-2.5 pb-1.5 pt-1 text-[11px] text-text-muted",
|
|
221
437
|
children: "本次会话的默认审批规则"
|
|
222
|
-
}),
|
|
438
|
+
}), l.map((e) => {
|
|
223
439
|
let t = e.icon, i = e.value === o;
|
|
224
440
|
return /* @__PURE__ */ B("button", {
|
|
225
441
|
type: "button",
|
|
@@ -253,26 +469,26 @@ function vt({ approvalPolicy: e }) {
|
|
|
253
469
|
}
|
|
254
470
|
//#endregion
|
|
255
471
|
//#region src/components/chat/ChatComposer.tsx
|
|
256
|
-
function
|
|
257
|
-
let
|
|
472
|
+
function Et({ attachments: e, composerContextIndicator: n, composerMaxHeight: r, fileInputRef: i, input: a, isMobile: o, isStreaming: s, attachmentsEnabled: c = !0, approvalEnabled: l = !1, approvalPolicy: u, thinkingEnabled: d = !1, executionMode: f, executionModeSupport: p, queuedDrafts: m, onAppendAttachments: h, onInputChange: g, onSelectExecutionMode: _, onPaste: v, onRemoveAttachment: y, onStopGeneration: b, onCancelRemote: x, onSubmit: S, textareaRef: C }) {
|
|
473
|
+
let w = f === "goal" ? "描述需要持续完成的目标…" : f === "plan" ? "描述需要先规划的任务…" : o ? "发送消息..." : "发送消息…", ee = x ? "保留恢复点并结束本次执行" : "停止生成", T = f === "goal" ? !!a.trim() : !!(a.trim() || e.length > 0), E = ut((e) => e.availableModels), te = ut((e) => e.selectedModel), D = ut((e) => e.thinkingMode), re = ut((e) => e.setSelectedModel), ie = ut((e) => e.setThinkingMode), O = (e) => e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / 1024 / 1024).toFixed(1)} MB`;
|
|
258
474
|
return /* @__PURE__ */ z("div", {
|
|
259
475
|
className: "relative z-10 flex-shrink-0 bg-background/95 px-3 py-3 backdrop-blur sm:px-4 sm:py-3",
|
|
260
476
|
children: /* @__PURE__ */ B("div", {
|
|
261
477
|
className: "mx-auto w-full max-w-[64rem]",
|
|
262
|
-
children: [
|
|
478
|
+
children: [m.length > 0 ? /* @__PURE__ */ B("div", {
|
|
263
479
|
className: "mb-2 rounded-2xl border border-amber-200/80 bg-amber-50/80 px-3 py-2 text-xs text-amber-900 shadow-sm dark:border-amber-900/60 dark:bg-amber-950/30 dark:text-amber-100",
|
|
264
480
|
children: [/* @__PURE__ */ B("div", {
|
|
265
481
|
className: "mb-1.5 flex items-center justify-between gap-2",
|
|
266
482
|
children: [/* @__PURE__ */ B("span", {
|
|
267
483
|
className: "font-semibold",
|
|
268
|
-
children: ["发送队列 · ",
|
|
484
|
+
children: ["发送队列 · ", m.length]
|
|
269
485
|
}), /* @__PURE__ */ z("span", {
|
|
270
486
|
className: "text-amber-700/75 dark:text-amber-200/75",
|
|
271
487
|
children: "当前回复完成后依次发送"
|
|
272
488
|
})]
|
|
273
489
|
}), /* @__PURE__ */ B("div", {
|
|
274
490
|
className: "flex flex-col gap-1",
|
|
275
|
-
children: [
|
|
491
|
+
children: [m.slice(0, 3).map((e, t) => {
|
|
276
492
|
let n = e.text.trim() || (e.attachments.length > 0 ? "仅附件消息" : "空消息");
|
|
277
493
|
return /* @__PURE__ */ B("div", {
|
|
278
494
|
className: "flex items-center gap-2 rounded-xl bg-background/70 px-2 py-1.5",
|
|
@@ -291,35 +507,35 @@ function yt({ attachments: e, composerContextIndicator: n, composerMaxHeight: r,
|
|
|
291
507
|
}) : null
|
|
292
508
|
]
|
|
293
509
|
}, `${t}-${n}-${e.attachments.length}`);
|
|
294
|
-
}),
|
|
510
|
+
}), m.length > 3 ? /* @__PURE__ */ B("div", {
|
|
295
511
|
className: "px-2 pt-0.5 text-[11px] text-amber-700/80 dark:text-amber-200/80",
|
|
296
512
|
children: [
|
|
297
513
|
"还有 ",
|
|
298
|
-
|
|
514
|
+
m.length - 3,
|
|
299
515
|
" 条等待发送"
|
|
300
516
|
]
|
|
301
517
|
}) : null]
|
|
302
518
|
})]
|
|
303
519
|
}) : null, /* @__PURE__ */ z("div", {
|
|
304
|
-
className: "relative rounded-[
|
|
520
|
+
className: "relative rounded-[28px] bg-surface shadow-[0_0_0_0.5px_rgba(15,23,42,0.08),0_5px_18px_rgba(15,23,42,0.07)] dark:shadow-[0_0_0_0.5px_rgba(255,255,255,0.06),0_8px_24px_rgba(0,0,0,0.24)]",
|
|
305
521
|
children: /* @__PURE__ */ z("div", {
|
|
306
522
|
className: "flex items-center gap-3",
|
|
307
523
|
children: /* @__PURE__ */ B("form", {
|
|
308
524
|
onSubmit: (t) => {
|
|
309
525
|
if (t.preventDefault(), s) {
|
|
310
|
-
|
|
526
|
+
x ? x() : b();
|
|
311
527
|
return;
|
|
312
528
|
}
|
|
313
529
|
let n = a.trim();
|
|
314
|
-
|
|
530
|
+
T && S(n, e);
|
|
315
531
|
},
|
|
316
532
|
onDragOver: (e) => {
|
|
317
533
|
e.preventDefault(), e.stopPropagation();
|
|
318
534
|
},
|
|
319
535
|
onDrop: (e) => {
|
|
320
|
-
e.preventDefault(), e.stopPropagation(), e.dataTransfer.files && e.dataTransfer.files.length > 0 &&
|
|
536
|
+
e.preventDefault(), e.stopPropagation(), c && e.dataTransfer.files && e.dataTransfer.files.length > 0 && h(Array.from(e.dataTransfer.files));
|
|
321
537
|
},
|
|
322
|
-
className: "relative flex min-h-[
|
|
538
|
+
className: "relative flex min-h-[116px] min-w-0 flex-1 flex-col rounded-[28px] border border-border/55 bg-background px-4 pb-3 pt-3 transition-all focus-within:border-primary/40 focus-within:ring-2 focus-within:ring-primary/15 sm:px-5",
|
|
323
539
|
children: [
|
|
324
540
|
e.length > 0 ? /* @__PURE__ */ z("div", {
|
|
325
541
|
className: "mb-1.5 flex flex-wrap gap-2",
|
|
@@ -328,7 +544,7 @@ function yt({ attachments: e, composerContextIndicator: n, composerMaxHeight: r,
|
|
|
328
544
|
children: [
|
|
329
545
|
/* @__PURE__ */ z("span", {
|
|
330
546
|
className: "flex h-7 w-7 flex-shrink-0 items-center justify-center rounded-lg bg-muted text-text-muted",
|
|
331
|
-
children: /* @__PURE__ */ z(
|
|
547
|
+
children: /* @__PURE__ */ z(ne, { className: "h-3.5 w-3.5" })
|
|
332
548
|
}),
|
|
333
549
|
/* @__PURE__ */ B("span", {
|
|
334
550
|
className: "min-w-0 flex-1",
|
|
@@ -337,12 +553,12 @@ function yt({ attachments: e, composerContextIndicator: n, composerMaxHeight: r,
|
|
|
337
553
|
children: e.name
|
|
338
554
|
}), /* @__PURE__ */ z("span", {
|
|
339
555
|
className: "block text-[10px] text-text-muted",
|
|
340
|
-
children:
|
|
556
|
+
children: O(e.size)
|
|
341
557
|
})]
|
|
342
558
|
}),
|
|
343
559
|
/* @__PURE__ */ z("button", {
|
|
344
560
|
type: "button",
|
|
345
|
-
onClick: () =>
|
|
561
|
+
onClick: () => y(t),
|
|
346
562
|
className: "absolute -right-1.5 -top-1.5 flex h-4 w-4 items-center justify-center rounded-full border border-border bg-background text-text-muted shadow-sm transition hover:text-rose-500",
|
|
347
563
|
"aria-label": `移除附件 ${e.name}`,
|
|
348
564
|
children: /* @__PURE__ */ z("span", {
|
|
@@ -354,80 +570,64 @@ function yt({ attachments: e, composerContextIndicator: n, composerMaxHeight: r,
|
|
|
354
570
|
}, `${e.name}-${e.size}-${t}`))
|
|
355
571
|
}) : null,
|
|
356
572
|
/* @__PURE__ */ z("textarea", {
|
|
357
|
-
ref:
|
|
573
|
+
ref: C,
|
|
358
574
|
rows: 1,
|
|
359
575
|
value: a,
|
|
360
|
-
onChange:
|
|
576
|
+
onChange: g,
|
|
361
577
|
onKeyDown: (e) => {
|
|
362
578
|
e.key === "Enter" && !e.shiftKey && (e.preventDefault(), e.currentTarget.form?.requestSubmit());
|
|
363
579
|
},
|
|
364
|
-
onPaste:
|
|
365
|
-
placeholder:
|
|
366
|
-
className: Y("custom-scrollbar max-h-[
|
|
580
|
+
onPaste: v,
|
|
581
|
+
placeholder: w,
|
|
582
|
+
className: Y("custom-scrollbar max-h-[176px] min-h-[62px] w-full resize-none overflow-y-auto border-0 bg-transparent px-0 pb-1 pt-1 text-[15px] leading-6 text-text-primary outline-none placeholder:text-text-muted/60", o ? "text-[16px]" : "text-[14px]"),
|
|
367
583
|
style: {
|
|
368
584
|
maxHeight: `${r}px`,
|
|
369
585
|
overflowY: "auto"
|
|
370
586
|
}
|
|
371
587
|
}),
|
|
372
588
|
/* @__PURE__ */ B("div", {
|
|
373
|
-
className: "mt-auto flex min-h-8 items-center justify-between gap-2 pt-1",
|
|
589
|
+
className: "mt-auto flex min-h-8 items-center justify-between gap-2 pt-1.5",
|
|
374
590
|
children: [/* @__PURE__ */ B("div", {
|
|
375
|
-
className: "flex items-center gap-
|
|
591
|
+
className: "flex min-w-0 items-center gap-1.5",
|
|
376
592
|
children: [
|
|
377
|
-
/* @__PURE__ */
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
onChange: (e) => {
|
|
386
|
-
e.target.files && e.target.files.length > 0 && (d(Array.from(e.target.files)), e.target.value = "");
|
|
387
|
-
}
|
|
388
|
-
}), /* @__PURE__ */ z(E, { className: "h-[18px] w-[18px]" })]
|
|
593
|
+
/* @__PURE__ */ z("input", {
|
|
594
|
+
ref: i,
|
|
595
|
+
type: "file",
|
|
596
|
+
multiple: !0,
|
|
597
|
+
className: "hidden",
|
|
598
|
+
onChange: (e) => {
|
|
599
|
+
e.target.files && e.target.files.length > 0 && (h(Array.from(e.target.files)), e.target.value = "");
|
|
600
|
+
}
|
|
389
601
|
}),
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
602
|
+
/* @__PURE__ */ z(ht, {
|
|
603
|
+
attachmentsEnabled: c,
|
|
604
|
+
mode: f,
|
|
605
|
+
support: p,
|
|
606
|
+
onSelectMode: _,
|
|
607
|
+
onUpload: () => i.current?.click()
|
|
608
|
+
}),
|
|
609
|
+
l ? /* @__PURE__ */ z(Tt, { approvalPolicy: u }) : null
|
|
610
|
+
]
|
|
611
|
+
}), /* @__PURE__ */ B("div", {
|
|
612
|
+
className: "flex min-w-0 items-center gap-1.5",
|
|
613
|
+
children: [
|
|
614
|
+
n ? /* @__PURE__ */ z(dt, { indicator: n }) : null,
|
|
615
|
+
E.length > 0 ? /* @__PURE__ */ z(vt, {
|
|
616
|
+
availableModels: E,
|
|
617
|
+
selectedModel: te,
|
|
618
|
+
thinkingEnabled: d,
|
|
619
|
+
thinkingMode: D,
|
|
620
|
+
onSelectModel: re,
|
|
621
|
+
onSelectThinkingMode: ie
|
|
400
622
|
}) : null,
|
|
401
|
-
/* @__PURE__ */ z(
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
{
|
|
408
|
-
value: "auto",
|
|
409
|
-
label: "思考自动"
|
|
410
|
-
},
|
|
411
|
-
{
|
|
412
|
-
value: "enabled",
|
|
413
|
-
label: "开启思考"
|
|
414
|
-
},
|
|
415
|
-
{
|
|
416
|
-
value: "disabled",
|
|
417
|
-
label: "关闭思考"
|
|
418
|
-
}
|
|
419
|
-
]
|
|
623
|
+
/* @__PURE__ */ z("button", {
|
|
624
|
+
type: "submit",
|
|
625
|
+
disabled: !s && !T,
|
|
626
|
+
className: Y("flex h-9 w-9 shrink-0 items-center justify-center rounded-full transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/30", s || T ? "bg-[#1f1f1f] text-white hover:opacity-80" : "bg-muted text-text-muted/45"),
|
|
627
|
+
title: s ? ee : "发送消息",
|
|
628
|
+
children: s ? /* @__PURE__ */ z(N, { className: "h-3.5 w-3.5 fill-current" }) : /* @__PURE__ */ z(t, { className: "h-[18px] w-[18px]" })
|
|
420
629
|
})
|
|
421
630
|
]
|
|
422
|
-
}), /* @__PURE__ */ B("div", {
|
|
423
|
-
className: "flex items-center gap-1.5",
|
|
424
|
-
children: [n ? /* @__PURE__ */ z(lt, { indicator: n }) : null, /* @__PURE__ */ z("button", {
|
|
425
|
-
type: "submit",
|
|
426
|
-
disabled: !s && !a.trim() && e.length === 0,
|
|
427
|
-
className: Y("flex h-8 w-8 items-center justify-center rounded-full transition-all", s || a.trim() || e.length > 0 ? "bg-[#1f1f1f] text-white hover:opacity-80" : "bg-muted text-text-muted/45"),
|
|
428
|
-
title: s ? b : "发送消息",
|
|
429
|
-
children: s ? /* @__PURE__ */ z(oe, { className: "h-3.5 w-3.5 fill-current" }) : /* @__PURE__ */ z(t, { className: "h-[18px] w-[18px]" })
|
|
430
|
-
})]
|
|
431
631
|
})]
|
|
432
632
|
})
|
|
433
633
|
]
|
|
@@ -439,13 +639,13 @@ function yt({ attachments: e, composerContextIndicator: n, composerMaxHeight: r,
|
|
|
439
639
|
}
|
|
440
640
|
//#endregion
|
|
441
641
|
//#region src/components/ui/sheet.tsx
|
|
442
|
-
var
|
|
642
|
+
var Dt = J.Root, Ot = J.Portal, kt = V.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ z(J.Overlay, {
|
|
443
643
|
className: Y("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", e),
|
|
444
644
|
...t,
|
|
445
645
|
ref: n
|
|
446
646
|
}));
|
|
447
|
-
|
|
448
|
-
var
|
|
647
|
+
kt.displayName = J.Overlay.displayName;
|
|
648
|
+
var At = Ce("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500", {
|
|
449
649
|
variants: { side: {
|
|
450
650
|
top: "inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",
|
|
451
651
|
bottom: "inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",
|
|
@@ -453,45 +653,45 @@ var Ct = ve("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out
|
|
|
453
653
|
right: "inset-y-0 right-0 h-full border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right"
|
|
454
654
|
} },
|
|
455
655
|
defaultVariants: { side: "right" }
|
|
456
|
-
}),
|
|
656
|
+
}), jt = V.forwardRef(({ side: e = "right", className: t, children: n, showOverlay: r = !0, showCloseButton: i = !0, ...a }, o) => /* @__PURE__ */ B(Ot, { children: [r ? /* @__PURE__ */ z(kt, {}) : null, /* @__PURE__ */ B(J.Content, {
|
|
457
657
|
ref: o,
|
|
458
|
-
className: Y(
|
|
658
|
+
className: Y(At({ side: e }), t),
|
|
459
659
|
...a,
|
|
460
660
|
children: [n, i ? /* @__PURE__ */ B(J.Close, {
|
|
461
661
|
className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary",
|
|
462
|
-
children: [/* @__PURE__ */ z(
|
|
662
|
+
children: [/* @__PURE__ */ z(me, { className: "h-4 w-4" }), /* @__PURE__ */ z("span", {
|
|
463
663
|
className: "sr-only",
|
|
464
664
|
children: "Close"
|
|
465
665
|
})]
|
|
466
666
|
}) : null]
|
|
467
667
|
})] }));
|
|
468
|
-
|
|
469
|
-
var
|
|
668
|
+
jt.displayName = J.Content.displayName;
|
|
669
|
+
var Mt = ({ className: e, ...t }) => /* @__PURE__ */ z("div", {
|
|
470
670
|
className: Y("flex flex-col space-y-2 text-center sm:text-left", e),
|
|
471
671
|
...t
|
|
472
672
|
});
|
|
473
|
-
|
|
474
|
-
var
|
|
673
|
+
Mt.displayName = "SheetHeader";
|
|
674
|
+
var Nt = ({ className: e, ...t }) => /* @__PURE__ */ z("div", {
|
|
475
675
|
className: Y("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", e),
|
|
476
676
|
...t
|
|
477
677
|
});
|
|
478
|
-
|
|
479
|
-
var
|
|
678
|
+
Nt.displayName = "SheetFooter";
|
|
679
|
+
var Pt = V.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ z(J.Title, {
|
|
480
680
|
ref: n,
|
|
481
681
|
className: Y("text-lg font-semibold text-foreground", e),
|
|
482
682
|
...t
|
|
483
683
|
}));
|
|
484
|
-
|
|
485
|
-
var
|
|
684
|
+
Pt.displayName = J.Title.displayName;
|
|
685
|
+
var Ft = V.forwardRef(({ className: e, ...t }, n) => /* @__PURE__ */ z(J.Description, {
|
|
486
686
|
ref: n,
|
|
487
687
|
className: Y("text-sm text-muted-foreground", e),
|
|
488
688
|
...t
|
|
489
689
|
}));
|
|
490
|
-
|
|
690
|
+
Ft.displayName = J.Description.displayName;
|
|
491
691
|
//#endregion
|
|
492
692
|
//#region src/components/chat/ChatHeader.tsx
|
|
493
|
-
var
|
|
494
|
-
function
|
|
693
|
+
var It = ye(() => import("./NativeTerminalPanel-CDqCdIly.js").then((e) => e.n).then((e) => ({ default: e.NativeTerminalPanel })));
|
|
694
|
+
function Lt({ availableModels: e, selectedModel: t, onSelectModel: n, selectedModelLabel: r, modelCatalogLoaded: i, modelSource: a, thinkingEnabled: o, thinkingMode: s, onSelectThinkingMode: c, compact: l = !1 }) {
|
|
495
695
|
let u = Y("rounded-full border border-slate-200 bg-white px-3 py-2 text-sm text-slate-700 outline-none transition-colors focus:ring-1 focus:ring-blue-500 dark:border-slate-700 dark:bg-slate-900 dark:text-slate-300", l ? "w-full" : "max-w-[13rem]"), d = e.length > 1 ? /* @__PURE__ */ z("select", {
|
|
496
696
|
value: t,
|
|
497
697
|
onChange: (e) => n(e.target.value),
|
|
@@ -535,19 +735,19 @@ function At({ availableModels: e, selectedModel: t, onSelectModel: n, selectedMo
|
|
|
535
735
|
children: [d, f]
|
|
536
736
|
});
|
|
537
737
|
}
|
|
538
|
-
function
|
|
539
|
-
let [
|
|
738
|
+
function Rt({ agentName: e, currentSessionId: t, isMobile: n, sidebarOpen: r, mobileSidebarOpen: i, onToggleSidebar: a, availableModels: o, selectedModel: s, onSelectModel: c, selectedModelLabel: l, modelCatalogLoaded: d, modelSource: f, thinkingEnabled: p, thinkingMode: m, onSelectThinkingMode: g, mobileActionsOpen: _, onMobileActionsOpenChange: v, workspaceEnabled: y, onOpenWorkspace: b, nativeManagementLink: x, nativeTerminal: S, nativeLauncherMode: C = !1 }) {
|
|
739
|
+
let [w, ee] = q(!1), E = !!S?.Enabled, ne = z(n ? i ? D : te : r ? D : te, { className: "h-5 w-5" });
|
|
540
740
|
return /* @__PURE__ */ B(R, { children: [
|
|
541
741
|
/* @__PURE__ */ B("header", {
|
|
542
742
|
className: Y("flex flex-shrink-0 items-center justify-between border-b border-black/[0.06] bg-background/95 px-3 py-2 backdrop-blur dark:border-white/[0.08] dark:bg-background/95 sm:px-4", n ? "pt-[calc(var(--safe-area-top)+0.5rem)]" : "h-12"),
|
|
543
743
|
children: [/* @__PURE__ */ B("div", {
|
|
544
744
|
className: "flex min-w-0 items-center gap-2",
|
|
545
|
-
children: [
|
|
745
|
+
children: [C ? null : /* @__PURE__ */ z("button", {
|
|
546
746
|
type: "button",
|
|
547
747
|
onClick: a,
|
|
548
748
|
className: "rounded-lg p-2 text-slate-500 transition-colors hover:bg-slate-100 dark:hover:bg-slate-800",
|
|
549
749
|
"aria-label": n ? "打开历史记录" : "切换侧边栏",
|
|
550
|
-
children:
|
|
750
|
+
children: ne
|
|
551
751
|
}), /* @__PURE__ */ B("div", {
|
|
552
752
|
className: "min-w-0",
|
|
553
753
|
children: [/* @__PURE__ */ z("div", {
|
|
@@ -555,7 +755,7 @@ function jt({ agentName: e, currentSessionId: t, isMobile: n, sidebarOpen: r, mo
|
|
|
555
755
|
children: e
|
|
556
756
|
}), /* @__PURE__ */ z("div", {
|
|
557
757
|
className: "text-[11px] text-slate-400 dark:text-slate-500",
|
|
558
|
-
children:
|
|
758
|
+
children: C ? "原生运行时入口" : "智能体"
|
|
559
759
|
})]
|
|
560
760
|
})]
|
|
561
761
|
}), n ? /* @__PURE__ */ z("button", {
|
|
@@ -563,7 +763,7 @@ function jt({ agentName: e, currentSessionId: t, isMobile: n, sidebarOpen: r, mo
|
|
|
563
763
|
onClick: () => v(!0),
|
|
564
764
|
className: "rounded-lg p-2 text-slate-500 transition-colors hover:bg-slate-100 dark:hover:bg-slate-800",
|
|
565
765
|
"aria-label": "打开会话操作",
|
|
566
|
-
children: /* @__PURE__ */ z(
|
|
766
|
+
children: /* @__PURE__ */ z(T, { className: "h-5 w-5" })
|
|
567
767
|
}) : /* @__PURE__ */ B("div", {
|
|
568
768
|
className: "flex min-w-0 items-center gap-2",
|
|
569
769
|
children: [
|
|
@@ -573,48 +773,48 @@ function jt({ agentName: e, currentSessionId: t, isMobile: n, sidebarOpen: r, mo
|
|
|
573
773
|
rel: "noreferrer",
|
|
574
774
|
title: x.title,
|
|
575
775
|
className: "inline-flex flex-shrink-0 items-center gap-1.5 whitespace-nowrap rounded-xl border border-slate-200 bg-slate-50 px-3 py-2 text-sm font-medium leading-none text-slate-700 transition hover:bg-slate-100 dark:border-slate-700 dark:bg-slate-800 dark:text-slate-300 dark:hover:bg-slate-700",
|
|
576
|
-
children: [/* @__PURE__ */ z(
|
|
776
|
+
children: [/* @__PURE__ */ z(u, { className: "h-4 w-4" }), /* @__PURE__ */ z("span", { children: x.label })]
|
|
577
777
|
}) : null,
|
|
578
778
|
y ? /* @__PURE__ */ B("button", {
|
|
579
779
|
type: "button",
|
|
580
780
|
onClick: b,
|
|
581
781
|
className: "inline-flex flex-shrink-0 items-center gap-1.5 whitespace-nowrap rounded-xl border border-slate-200 bg-slate-50 px-3 py-2 text-sm font-medium leading-none text-slate-700 transition hover:bg-slate-100 dark:border-slate-700 dark:bg-slate-800 dark:text-slate-300 dark:hover:bg-slate-700",
|
|
582
|
-
children: [/* @__PURE__ */ z(
|
|
782
|
+
children: [/* @__PURE__ */ z(h, { className: "h-4 w-4" }), /* @__PURE__ */ z("span", { children: "Workspace" })]
|
|
583
783
|
}) : null,
|
|
584
|
-
|
|
784
|
+
E ? /* @__PURE__ */ B("button", {
|
|
585
785
|
type: "button",
|
|
586
|
-
onClick: () =>
|
|
786
|
+
onClick: () => ee(!0),
|
|
587
787
|
className: "inline-flex flex-shrink-0 items-center gap-1.5 whitespace-nowrap rounded-xl border border-emerald-200 bg-emerald-50 px-3 py-2 text-sm font-medium leading-none text-emerald-800 transition hover:bg-emerald-100 dark:border-emerald-900/70 dark:bg-emerald-950/40 dark:text-emerald-200",
|
|
588
|
-
children: [/* @__PURE__ */ z(
|
|
788
|
+
children: [/* @__PURE__ */ z(P, { className: "h-4 w-4" }), /* @__PURE__ */ z("span", { children: "TUI" })]
|
|
589
789
|
}) : null,
|
|
590
|
-
!
|
|
790
|
+
!C && n ? /* @__PURE__ */ z(Lt, {
|
|
591
791
|
availableModels: o,
|
|
592
792
|
selectedModel: s,
|
|
593
|
-
onSelectModel:
|
|
594
|
-
selectedModelLabel:
|
|
793
|
+
onSelectModel: c,
|
|
794
|
+
selectedModelLabel: l,
|
|
595
795
|
modelCatalogLoaded: d,
|
|
596
796
|
modelSource: f,
|
|
597
|
-
thinkingEnabled:
|
|
598
|
-
thinkingMode:
|
|
797
|
+
thinkingEnabled: p,
|
|
798
|
+
thinkingMode: m,
|
|
599
799
|
onSelectThinkingMode: g,
|
|
600
800
|
compact: !0
|
|
601
801
|
}) : null,
|
|
602
|
-
!
|
|
802
|
+
!C && t ? /* @__PURE__ */ B("span", {
|
|
603
803
|
className: "rounded bg-slate-50 px-2 py-1 text-xs font-mono text-slate-400 dark:bg-slate-800",
|
|
604
804
|
children: ["ID: ", t.slice(0, 8)]
|
|
605
805
|
}) : null
|
|
606
806
|
]
|
|
607
807
|
})]
|
|
608
808
|
}),
|
|
609
|
-
n ? /* @__PURE__ */ z(
|
|
809
|
+
n ? /* @__PURE__ */ z(Dt, {
|
|
610
810
|
open: _,
|
|
611
811
|
onOpenChange: v,
|
|
612
|
-
children: /* @__PURE__ */ B(
|
|
812
|
+
children: /* @__PURE__ */ B(jt, {
|
|
613
813
|
side: "bottom",
|
|
614
814
|
className: "rounded-t-[1.75rem] border-slate-200 bg-white px-4 pb-[calc(var(--safe-area-bottom)+1rem)] pt-6 dark:border-slate-800 dark:bg-slate-900",
|
|
615
|
-
children: [/* @__PURE__ */ B(
|
|
815
|
+
children: [/* @__PURE__ */ B(Mt, {
|
|
616
816
|
className: "text-left",
|
|
617
|
-
children: [/* @__PURE__ */ z(
|
|
817
|
+
children: [/* @__PURE__ */ z(Pt, { children: "会话设置" }), /* @__PURE__ */ z(Ft, {
|
|
618
818
|
className: "sr-only",
|
|
619
819
|
children: "调整当前会话的模型和 Workspace 操作。"
|
|
620
820
|
})]
|
|
@@ -627,15 +827,15 @@ function jt({ agentName: e, currentSessionId: t, isMobile: n, sidebarOpen: r, mo
|
|
|
627
827
|
v(!1), b();
|
|
628
828
|
},
|
|
629
829
|
className: "inline-flex items-center gap-2 rounded-xl border border-slate-200 bg-slate-50 px-3 py-3 text-sm font-medium text-slate-700 transition hover:bg-slate-100 dark:border-slate-700 dark:bg-slate-800 dark:text-slate-300 dark:hover:bg-slate-700",
|
|
630
|
-
children: [/* @__PURE__ */ z(
|
|
830
|
+
children: [/* @__PURE__ */ z(h, { className: "h-4 w-4" }), "工作区文件"]
|
|
631
831
|
}) : null,
|
|
632
|
-
|
|
832
|
+
E ? /* @__PURE__ */ B("button", {
|
|
633
833
|
type: "button",
|
|
634
834
|
onClick: () => {
|
|
635
|
-
v(!1),
|
|
835
|
+
v(!1), ee(!0);
|
|
636
836
|
},
|
|
637
837
|
className: "inline-flex items-center gap-2 rounded-xl border border-emerald-200 bg-emerald-50 px-3 py-3 text-sm font-medium text-emerald-800 transition hover:bg-emerald-100 dark:border-emerald-900/70 dark:bg-emerald-950/40 dark:text-emerald-200",
|
|
638
|
-
children: [/* @__PURE__ */ z(
|
|
838
|
+
children: [/* @__PURE__ */ z(P, { className: "h-4 w-4" }), "原生 TUI"]
|
|
639
839
|
}) : null,
|
|
640
840
|
x ? /* @__PURE__ */ B("a", {
|
|
641
841
|
href: x.href,
|
|
@@ -644,9 +844,9 @@ function jt({ agentName: e, currentSessionId: t, isMobile: n, sidebarOpen: r, mo
|
|
|
644
844
|
title: x.title,
|
|
645
845
|
onClick: () => v(!1),
|
|
646
846
|
className: "inline-flex items-center gap-2 rounded-xl border border-slate-200 bg-slate-50 px-3 py-3 text-sm font-medium text-slate-700 transition hover:bg-slate-100 dark:border-slate-700 dark:bg-slate-800 dark:text-slate-300 dark:hover:bg-slate-700",
|
|
647
|
-
children: [/* @__PURE__ */ z(
|
|
847
|
+
children: [/* @__PURE__ */ z(u, { className: "h-4 w-4" }), x.label]
|
|
648
848
|
}) : null,
|
|
649
|
-
|
|
849
|
+
C ? /* @__PURE__ */ z("div", {
|
|
650
850
|
className: "rounded-2xl border border-slate-200 bg-slate-50 px-3 py-3 text-sm leading-6 text-slate-600 dark:border-slate-700 dark:bg-slate-800 dark:text-slate-300",
|
|
651
851
|
children: "当前运行时对话在原生管理台中进行;这里保留管理入口和 Workspace 文件操作。"
|
|
652
852
|
}) : /* @__PURE__ */ B(R, { children: [/* @__PURE__ */ B("div", {
|
|
@@ -654,15 +854,15 @@ function jt({ agentName: e, currentSessionId: t, isMobile: n, sidebarOpen: r, mo
|
|
|
654
854
|
children: [/* @__PURE__ */ z("div", {
|
|
655
855
|
className: "text-xs font-medium uppercase tracking-[0.12em] text-slate-400 dark:text-slate-500",
|
|
656
856
|
children: "模型"
|
|
657
|
-
}), /* @__PURE__ */ z(
|
|
857
|
+
}), /* @__PURE__ */ z(Lt, {
|
|
658
858
|
availableModels: o,
|
|
659
859
|
selectedModel: s,
|
|
660
|
-
onSelectModel:
|
|
661
|
-
selectedModelLabel:
|
|
860
|
+
onSelectModel: c,
|
|
861
|
+
selectedModelLabel: l,
|
|
662
862
|
modelCatalogLoaded: d,
|
|
663
863
|
modelSource: f,
|
|
664
|
-
thinkingEnabled:
|
|
665
|
-
thinkingMode:
|
|
864
|
+
thinkingEnabled: p,
|
|
865
|
+
thinkingMode: m,
|
|
666
866
|
onSelectThinkingMode: g,
|
|
667
867
|
compact: !0
|
|
668
868
|
})]
|
|
@@ -683,44 +883,44 @@ function jt({ agentName: e, currentSessionId: t, isMobile: n, sidebarOpen: r, mo
|
|
|
683
883
|
})]
|
|
684
884
|
})
|
|
685
885
|
}) : null,
|
|
686
|
-
S &&
|
|
886
|
+
S && w ? /* @__PURE__ */ z(U, {
|
|
687
887
|
fallback: null,
|
|
688
|
-
children: /* @__PURE__ */ z(
|
|
888
|
+
children: /* @__PURE__ */ z(It, {
|
|
689
889
|
capability: S,
|
|
690
|
-
open:
|
|
890
|
+
open: w,
|
|
691
891
|
sessionId: t,
|
|
692
|
-
onClose: () =>
|
|
892
|
+
onClose: () => ee(!1)
|
|
693
893
|
})
|
|
694
894
|
}) : null
|
|
695
895
|
] });
|
|
696
896
|
}
|
|
697
897
|
//#endregion
|
|
698
898
|
//#region src/utils/markdown.js
|
|
699
|
-
function
|
|
899
|
+
function zt(e) {
|
|
700
900
|
return e.replace(/<think>([\s\S]*?)(?:<\/think>|$)/gi, (e, t) => `\n> 💭 **思考过程**\n>\n${String(t || "").trim().split("\n").filter(Boolean).map((e) => `> ${e}`).join("\n")}\n\n`);
|
|
701
901
|
}
|
|
702
|
-
function
|
|
902
|
+
function Bt(e) {
|
|
703
903
|
return /^\s*\|(?:\s*[:\-]+\s*\|){2,}\s*$/.test(e);
|
|
704
904
|
}
|
|
705
905
|
function X(e) {
|
|
706
906
|
let t = e.trim();
|
|
707
907
|
return t.startsWith("|") ? t.split("|").length >= 4 : !1;
|
|
708
908
|
}
|
|
709
|
-
function
|
|
909
|
+
function Vt(e) {
|
|
710
910
|
let t = e.trim();
|
|
711
911
|
return t.startsWith("|") ? t.replace(/^\|/, "").replace(/\|\s*$/, "").split("|").map((e) => e.trim()) : [];
|
|
712
912
|
}
|
|
713
|
-
function
|
|
913
|
+
function Ht(e, t = "") {
|
|
714
914
|
return `${t}| ${e.join(" | ")} |`;
|
|
715
915
|
}
|
|
716
|
-
function
|
|
916
|
+
function Ut(e) {
|
|
717
917
|
let t = e.split("\n"), n = [], r = 0;
|
|
718
918
|
for (; r < t.length;) {
|
|
719
919
|
let e = t[r];
|
|
720
|
-
if (X(e) && r + 1 < t.length &&
|
|
721
|
-
let i = e.match(/^(\s*)/)?.[1] || "", a =
|
|
920
|
+
if (X(e) && r + 1 < t.length && Bt(t[r + 1])) {
|
|
921
|
+
let i = e.match(/^(\s*)/)?.[1] || "", a = Vt(e), o = Vt(t[r + 1]), s = [], c = r + 2, l = Math.max(a.length, o.length);
|
|
722
922
|
for (; c < t.length && X(t[c]);) {
|
|
723
|
-
let e =
|
|
923
|
+
let e = Vt(t[c]);
|
|
724
924
|
l = Math.max(l, e.length), s.push(e), c += 1;
|
|
725
925
|
}
|
|
726
926
|
let u = (e) => {
|
|
@@ -728,35 +928,35 @@ function It(e) {
|
|
|
728
928
|
for (; t.length < l;) t.push("");
|
|
729
929
|
return t;
|
|
730
930
|
};
|
|
731
|
-
n.push(
|
|
931
|
+
n.push(Ht(u(a), i)), n.push(Ht(((e) => {
|
|
732
932
|
let t = [...e];
|
|
733
933
|
for (; t.length < l;) t.push("---");
|
|
734
934
|
return t;
|
|
735
935
|
})(o), i));
|
|
736
|
-
for (let e of s) n.push(
|
|
936
|
+
for (let e of s) n.push(Ht(u(e), i));
|
|
737
937
|
r = c;
|
|
738
938
|
} else n.push(e), r += 1;
|
|
739
939
|
}
|
|
740
940
|
return n.join("\n");
|
|
741
941
|
}
|
|
742
|
-
function
|
|
743
|
-
return
|
|
942
|
+
function Wt(e) {
|
|
943
|
+
return Bt(e) || /\|\|/.test(e) || /\|(?:\s*[:\-]+\s*\|){2,}/.test(e) && /\|(?:[^|\n]*\|){2,}/.test(e);
|
|
744
944
|
}
|
|
745
|
-
function
|
|
746
|
-
return
|
|
945
|
+
function Gt(e) {
|
|
946
|
+
return Wt(e) ? e.replace(/\|\s*\|/g, "|\n|").split("\n").map((e) => e.trimEnd()).filter((e) => e.trim().length > 0) : [e];
|
|
747
947
|
}
|
|
748
|
-
function
|
|
948
|
+
function Kt(e) {
|
|
749
949
|
return X(e) ? e.replace(/\|\s*(?:\*{1,2}|_{1,2})\s*$/u, "|") : e;
|
|
750
950
|
}
|
|
751
|
-
function
|
|
951
|
+
function qt(e) {
|
|
752
952
|
let t = e.trim();
|
|
753
953
|
return X(t) ? t.split("|").slice(1, -1).length : 0;
|
|
754
954
|
}
|
|
755
|
-
function
|
|
756
|
-
let t = e.match(/^(\s*)/)?.[1] || "", n =
|
|
955
|
+
function Jt(e) {
|
|
956
|
+
let t = e.match(/^(\s*)/)?.[1] || "", n = qt(e);
|
|
757
957
|
return n < 2 ? "" : `${t}| ${Array.from({ length: n }, () => "---").join(" | ")} |`;
|
|
758
958
|
}
|
|
759
|
-
function
|
|
959
|
+
function Yt(e) {
|
|
760
960
|
let t = [];
|
|
761
961
|
for (let n of e.split("\n")) {
|
|
762
962
|
if (/^\s*\|\s*$/.test(n)) continue;
|
|
@@ -765,20 +965,20 @@ function Ht(e) {
|
|
|
765
965
|
t.push(`${e[1]}${e[2].trim()}`);
|
|
766
966
|
continue;
|
|
767
967
|
}
|
|
768
|
-
t.push(...
|
|
968
|
+
t.push(...Gt(n).map(Kt));
|
|
769
969
|
}
|
|
770
970
|
let n = [];
|
|
771
971
|
for (let e = 0; e < t.length; e += 1) {
|
|
772
972
|
let r = t[e];
|
|
773
|
-
r.trim().length === 0 && X(n[n.length - 1] || "") &&
|
|
973
|
+
r.trim().length === 0 && X(n[n.length - 1] || "") && Bt(t[e + 1] || "") || n.push(r);
|
|
774
974
|
}
|
|
775
975
|
let r = [];
|
|
776
976
|
for (let e = 0; e < n.length; e += 1) {
|
|
777
977
|
let t = n[e], i = n[e + 1] || "";
|
|
778
|
-
if (r.push(t), X(t) && X(i) && !
|
|
978
|
+
if (r.push(t), X(t) && X(i) && !Bt(i) && qt(t) === qt(i)) {
|
|
779
979
|
let i = X(n[e - 1] || ""), a = t.match(/^(\s*)/)?.[1] || "";
|
|
780
980
|
if (!i && a.length === 0) {
|
|
781
|
-
let e =
|
|
981
|
+
let e = Jt(t);
|
|
782
982
|
e && r.push(e);
|
|
783
983
|
}
|
|
784
984
|
}
|
|
@@ -790,35 +990,35 @@ function Ht(e) {
|
|
|
790
990
|
}
|
|
791
991
|
return i.join("\n");
|
|
792
992
|
}
|
|
793
|
-
function
|
|
993
|
+
function Xt(e) {
|
|
794
994
|
let t = e.replace(/^[\u200B-\u200D\uFEFF]+/u, ""), n = t.match(/^([ \t\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*)([##]{1,6})([ \t\u00A0\u1680\u2000-\u200A\u202F\u205F\u3000]*)(\S.*)?$/u);
|
|
795
995
|
if (!n) return t;
|
|
796
996
|
let [, r, i, , a = ""] = n, o = r.replace(/[^\t ]/gu, " "), s = i.replace(/#/gu, "#");
|
|
797
997
|
return a ? `${o}${s} ${a}` : `${o}${s}`;
|
|
798
998
|
}
|
|
799
|
-
function
|
|
999
|
+
function Zt(e) {
|
|
800
1000
|
let t = e;
|
|
801
|
-
return t = t.split("\n").map((e) =>
|
|
1001
|
+
return t = t.split("\n").map((e) => Xt(e)).join("\n"), t = t.replace(/^[ \t]+(#{1,6}\s*)/gm, "$1"), t = t.replace(/([^\n#])\s*(#{1,6}\s*[^\s|])/g, "$1\n\n$2"), t = t.replace(/^(#{1,6}\s*[^\n]+)\n(?!\n)/gm, "$1\n\n"), t = t.replace(/^(#{1,6}[^\n|]+?)\s*(\|)/gm, "$1\n$2"), t = t.replace(/([。;;::])\s*(\d+\.\s*)/g, "$1\n$2"), t = t.replace(/([^\n\s])(\d+\.\s+)/g, "$1\n$2"), t = t.replace(/([。;;::\.])\s*-(?!-)\s*/g, "$1\n- "), t = t.replace(/([^\n\s-])-\s+/g, "$1\n- "), t = t.replace(/^-(?!-)(\S)/gm, "- $1"), t = Yt(t), t = t.replace(/\n{3,}/g, "\n\n"), t.trim();
|
|
802
1002
|
}
|
|
803
|
-
function
|
|
1003
|
+
function Qt(e) {
|
|
804
1004
|
return e.map((t, n) => {
|
|
805
1005
|
if (n % 2 == 1) return t;
|
|
806
|
-
let r =
|
|
1006
|
+
let r = Zt(t), i = n > 0, a = n < e.length - 1;
|
|
807
1007
|
return r ? (i && !r.startsWith("\n") && (r = `\n${r}`), a && !r.endsWith("\n") && (r = `${r}\n`), r) : i && a ? "\n\n" : i || a ? "\n" : r;
|
|
808
1008
|
});
|
|
809
1009
|
}
|
|
810
|
-
function
|
|
1010
|
+
function $t(e) {
|
|
811
1011
|
if (!e) return e;
|
|
812
1012
|
let t = String(e).replace(/\r\n/g, "\n").replace(/\r/g, "\n").trim();
|
|
813
|
-
return t =
|
|
1013
|
+
return t = zt(t), t = Ut(t), (t.match(/```/g) || []).length % 2 == 1 && (t = `${t}\n\`\`\``), Qt(t.split("```")).join("```").trim();
|
|
814
1014
|
}
|
|
815
1015
|
//#endregion
|
|
816
1016
|
//#region src/components/MessageMarkdown.tsx
|
|
817
|
-
var
|
|
818
|
-
function
|
|
1017
|
+
var en = H.lazy(() => import("./CodeBlock-BS9DcS5a.js").then((e) => ({ default: e.CodeBlock }))), tn = H.lazy(() => import("./MermaidBlock-BFNE1NN8.js").then((e) => ({ default: e.MermaidBlock }))), nn = H.lazy(() => import("./MathMessageMarkdown-CpCcJFjZ.js").then((e) => ({ default: e.MathMessageMarkdown })));
|
|
1018
|
+
function rn(e) {
|
|
819
1019
|
return /\$[^$]+\$|\$\$[^$]+\$\$/.test(e);
|
|
820
1020
|
}
|
|
821
|
-
var
|
|
1021
|
+
var an = {
|
|
822
1022
|
h1({ children: e }) {
|
|
823
1023
|
return /* @__PURE__ */ z("h1", {
|
|
824
1024
|
className: "mb-3.5 mt-5 text-[17px] font-semibold text-foreground",
|
|
@@ -881,15 +1081,15 @@ var Zt = {
|
|
|
881
1081
|
children: t
|
|
882
1082
|
});
|
|
883
1083
|
let a = r ? r[1] : "";
|
|
884
|
-
return a === "mermaid" ? /* @__PURE__ */ z(
|
|
1084
|
+
return a === "mermaid" ? /* @__PURE__ */ z(U, {
|
|
885
1085
|
fallback: /* @__PURE__ */ z("div", { className: "h-32 animate-pulse rounded bg-muted" }),
|
|
886
|
-
children: /* @__PURE__ */ z(
|
|
887
|
-
}) : /* @__PURE__ */ z(
|
|
1086
|
+
children: /* @__PURE__ */ z(tn, { chart: i })
|
|
1087
|
+
}) : /* @__PURE__ */ z(U, {
|
|
888
1088
|
fallback: /* @__PURE__ */ z("pre", {
|
|
889
1089
|
className: "p-4 text-sm",
|
|
890
1090
|
children: i
|
|
891
1091
|
}),
|
|
892
|
-
children: /* @__PURE__ */ z(
|
|
1092
|
+
children: /* @__PURE__ */ z(en, {
|
|
893
1093
|
language: a,
|
|
894
1094
|
value: i
|
|
895
1095
|
})
|
|
@@ -929,24 +1129,24 @@ var Zt = {
|
|
|
929
1129
|
children: e
|
|
930
1130
|
});
|
|
931
1131
|
}
|
|
932
|
-
},
|
|
933
|
-
let t =
|
|
1132
|
+
}, on = H.memo(({ content: e }) => {
|
|
1133
|
+
let t = $t(e);
|
|
934
1134
|
return /* @__PURE__ */ z("div", {
|
|
935
1135
|
className: "max-w-none break-words text-[14px] leading-[1.65] [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",
|
|
936
|
-
children: /* @__PURE__ */ z(
|
|
937
|
-
remarkPlugins: [
|
|
938
|
-
components:
|
|
1136
|
+
children: /* @__PURE__ */ z(we, {
|
|
1137
|
+
remarkPlugins: [Te, Ee],
|
|
1138
|
+
components: an,
|
|
939
1139
|
children: t
|
|
940
1140
|
})
|
|
941
1141
|
});
|
|
942
|
-
}), Z =
|
|
943
|
-
fallback: /* @__PURE__ */ z(
|
|
944
|
-
children: /* @__PURE__ */ z(
|
|
945
|
-
}) : /* @__PURE__ */ z(
|
|
946
|
-
function
|
|
1142
|
+
}), Z = H.memo(({ content: e }) => rn(e) ? /* @__PURE__ */ z(U, {
|
|
1143
|
+
fallback: /* @__PURE__ */ z(on, { content: e }),
|
|
1144
|
+
children: /* @__PURE__ */ z(nn, { content: e })
|
|
1145
|
+
}) : /* @__PURE__ */ z(on, { content: e })), sn = /^diff --git "?a\/(.+?)"? "?b\/(.+?)"?$/;
|
|
1146
|
+
function cn(e) {
|
|
947
1147
|
let t = [], n = /* @__PURE__ */ new Map(), r = null;
|
|
948
1148
|
for (let i of e.split("\n")) {
|
|
949
|
-
let e = i.match(
|
|
1149
|
+
let e = i.match(sn);
|
|
950
1150
|
if (e) {
|
|
951
1151
|
let a = e[2], o = n.get(a);
|
|
952
1152
|
if (o) {
|
|
@@ -964,7 +1164,7 @@ function en(e) {
|
|
|
964
1164
|
}
|
|
965
1165
|
return t;
|
|
966
1166
|
}
|
|
967
|
-
function
|
|
1167
|
+
function ln(e) {
|
|
968
1168
|
let t = 0, n = 0;
|
|
969
1169
|
for (let r of e.lines) r.startsWith("+") && !r.startsWith("+++") ? t += 1 : r.startsWith("-") && !r.startsWith("---") && (n += 1);
|
|
970
1170
|
return {
|
|
@@ -972,12 +1172,504 @@ function tn(e) {
|
|
|
972
1172
|
removed: n
|
|
973
1173
|
};
|
|
974
1174
|
}
|
|
975
|
-
function
|
|
1175
|
+
function un(e) {
|
|
976
1176
|
return /^diff --git /m.test(e);
|
|
977
1177
|
}
|
|
978
1178
|
//#endregion
|
|
1179
|
+
//#region src/core/interaction/a2ui-validate.ts
|
|
1180
|
+
var dn = "0.9.1";
|
|
1181
|
+
function fn(e) {
|
|
1182
|
+
let t = typeof e == "object" && e ? e.components : null, n = Array.isArray(t) ? t : [], r = [];
|
|
1183
|
+
for (let e of n) typeof e == "object" && e && typeof e.id == "string" && r.push(e.id);
|
|
1184
|
+
return r.sort();
|
|
1185
|
+
}
|
|
1186
|
+
function pn(e) {
|
|
1187
|
+
let t = fn(e).join("|"), n = 2166136261, r = 16777619;
|
|
1188
|
+
for (let e = 0; e < t.length; e += 1) {
|
|
1189
|
+
let i = t.charCodeAt(e);
|
|
1190
|
+
n = (n ^ i) >>> 0, n = Math.imul(n, 16777619) >>> 0, r = r + Math.imul(i + e, 2246822507) >>> 0;
|
|
1191
|
+
}
|
|
1192
|
+
return `fnv1a-${n.toString(16)}-${r.toString(16)}`;
|
|
1193
|
+
}
|
|
1194
|
+
function mn(e, t) {
|
|
1195
|
+
if (!e) return hn(null);
|
|
1196
|
+
if (e.wireVersion !== "0.9.1" || !e.messages || e.messages.length === 0) return hn(e);
|
|
1197
|
+
if (e.catalogDigest) {
|
|
1198
|
+
let n = pn(t);
|
|
1199
|
+
if (e.catalogDigest !== n) return "json-schema-form";
|
|
1200
|
+
}
|
|
1201
|
+
return "a2ui";
|
|
1202
|
+
}
|
|
1203
|
+
function hn(e) {
|
|
1204
|
+
return e && gn(e) ? "json-schema-form" : "basic-controls";
|
|
1205
|
+
}
|
|
1206
|
+
function gn(e) {
|
|
1207
|
+
return e.messages.some((e) => {
|
|
1208
|
+
let t = e.inputSchema ?? e.input_schema ?? e.schema;
|
|
1209
|
+
return typeof t == "object" && !!t;
|
|
1210
|
+
});
|
|
1211
|
+
}
|
|
1212
|
+
//#endregion
|
|
1213
|
+
//#region src/core/interaction/types.ts
|
|
1214
|
+
var _n = new Set([
|
|
1215
|
+
"resolved",
|
|
1216
|
+
"cancelled",
|
|
1217
|
+
"expired"
|
|
1218
|
+
]);
|
|
1219
|
+
function vn(e) {
|
|
1220
|
+
return _n.has(e);
|
|
1221
|
+
}
|
|
1222
|
+
function yn(e, t) {
|
|
1223
|
+
return `interaction:${e}:revision-${t}`;
|
|
1224
|
+
}
|
|
1225
|
+
function bn(e, t) {
|
|
1226
|
+
let n = t.approved;
|
|
1227
|
+
if (typeof n == "boolean") return n ? "已同意" : "已拒绝";
|
|
1228
|
+
let r = Object.keys(t);
|
|
1229
|
+
return r.length === 0 ? e === "approve" ? "已同意" : e === "reject" ? "已拒绝" : e === "cancel" ? "已取消" : "已提交" : `${e}(${r.slice(0, 3).map((e) => {
|
|
1230
|
+
let n = t[e];
|
|
1231
|
+
return `${e}=${typeof n == "string" ? n.length > 24 ? `${n.slice(0, 24)}…` : n : typeof n == "object" && n ? "[object]" : String(n)}`;
|
|
1232
|
+
}).join(", ")})`;
|
|
1233
|
+
}
|
|
1234
|
+
//#endregion
|
|
1235
|
+
//#region src/components/chat/schema-fields.ts
|
|
1236
|
+
function xn(e) {
|
|
1237
|
+
return typeof e == "object" && e && !Array.isArray(e) ? e : null;
|
|
1238
|
+
}
|
|
1239
|
+
function Sn(e) {
|
|
1240
|
+
let t = xn(e.properties) || {}, n = Array.isArray(e.required) ? new Set(e.required.map(String)) : /* @__PURE__ */ new Set(), r = [];
|
|
1241
|
+
for (let [e, i] of Object.entries(t)) {
|
|
1242
|
+
let t = xn(i), a = String(t?.type || "").toLowerCase(), o = a === "string" || a === "number" || a === "boolean" ? a : "unknown";
|
|
1243
|
+
r.push({
|
|
1244
|
+
name: e,
|
|
1245
|
+
title: typeof t?.title == "string" ? t.title : void 0,
|
|
1246
|
+
type: o,
|
|
1247
|
+
required: n.has(e),
|
|
1248
|
+
enumValues: Array.isArray(t?.enum) ? t.enum : void 0
|
|
1249
|
+
});
|
|
1250
|
+
}
|
|
1251
|
+
return r;
|
|
1252
|
+
}
|
|
1253
|
+
//#endregion
|
|
1254
|
+
//#region src/components/chat/InteractionSchemaForm.tsx
|
|
1255
|
+
function Cn({ schema: e, values: t, onChange: n, disabled: r, onSubmit: i, onCancel: a }) {
|
|
1256
|
+
return /* @__PURE__ */ B("div", {
|
|
1257
|
+
className: "mt-3",
|
|
1258
|
+
"data-testid": "interaction-schema-form",
|
|
1259
|
+
children: [Sn(e).map((e) => /* @__PURE__ */ B("label", {
|
|
1260
|
+
className: "mb-2 block text-xs text-slate-600 dark:text-slate-300",
|
|
1261
|
+
children: [/* @__PURE__ */ B("span", {
|
|
1262
|
+
className: "mb-1 block font-medium",
|
|
1263
|
+
children: [e.title || e.name, e.required ? /* @__PURE__ */ z("span", {
|
|
1264
|
+
className: "ml-0.5 text-rose-500",
|
|
1265
|
+
children: "*"
|
|
1266
|
+
}) : null]
|
|
1267
|
+
}), e.enumValues && e.enumValues.length > 0 ? /* @__PURE__ */ B("select", {
|
|
1268
|
+
"data-testid": `interaction-field-${e.name}`,
|
|
1269
|
+
disabled: r,
|
|
1270
|
+
value: String(t[e.name] ?? ""),
|
|
1271
|
+
onChange: (r) => n({
|
|
1272
|
+
...t,
|
|
1273
|
+
[e.name]: r.target.value
|
|
1274
|
+
}),
|
|
1275
|
+
className: "w-full rounded-md border border-amber-300/70 bg-white px-2 py-1.5 text-sm dark:border-amber-900/60 dark:bg-slate-950",
|
|
1276
|
+
children: [/* @__PURE__ */ z("option", {
|
|
1277
|
+
value: "",
|
|
1278
|
+
children: "请选择…"
|
|
1279
|
+
}), e.enumValues.map((e) => /* @__PURE__ */ z("option", {
|
|
1280
|
+
value: String(e),
|
|
1281
|
+
children: String(e)
|
|
1282
|
+
}, String(e)))]
|
|
1283
|
+
}) : e.type === "boolean" ? /* @__PURE__ */ z("input", {
|
|
1284
|
+
type: "checkbox",
|
|
1285
|
+
"data-testid": `interaction-field-${e.name}`,
|
|
1286
|
+
disabled: r,
|
|
1287
|
+
checked: !!t[e.name],
|
|
1288
|
+
onChange: (r) => n({
|
|
1289
|
+
...t,
|
|
1290
|
+
[e.name]: r.target.checked
|
|
1291
|
+
}),
|
|
1292
|
+
className: "h-4 w-4"
|
|
1293
|
+
}) : e.type === "number" ? /* @__PURE__ */ z("input", {
|
|
1294
|
+
type: "number",
|
|
1295
|
+
"data-testid": `interaction-field-${e.name}`,
|
|
1296
|
+
disabled: r,
|
|
1297
|
+
value: t[e.name] === void 0 ? "" : String(t[e.name]),
|
|
1298
|
+
onChange: (r) => n({
|
|
1299
|
+
...t,
|
|
1300
|
+
[e.name]: r.target.value === "" ? void 0 : Number(r.target.value)
|
|
1301
|
+
}),
|
|
1302
|
+
className: "w-full rounded-md border border-amber-300/70 bg-white px-2 py-1.5 text-sm dark:border-amber-900/60 dark:bg-slate-950"
|
|
1303
|
+
}) : /* @__PURE__ */ z("input", {
|
|
1304
|
+
type: "text",
|
|
1305
|
+
"data-testid": `interaction-field-${e.name}`,
|
|
1306
|
+
disabled: r,
|
|
1307
|
+
value: String(t[e.name] ?? ""),
|
|
1308
|
+
onChange: (r) => n({
|
|
1309
|
+
...t,
|
|
1310
|
+
[e.name]: r.target.value
|
|
1311
|
+
}),
|
|
1312
|
+
className: "w-full rounded-md border border-amber-300/70 bg-white px-2 py-1.5 text-sm dark:border-amber-900/60 dark:bg-slate-950"
|
|
1313
|
+
})]
|
|
1314
|
+
}, e.name)), /* @__PURE__ */ B("div", {
|
|
1315
|
+
className: "mt-2 flex flex-wrap gap-2",
|
|
1316
|
+
children: [/* @__PURE__ */ z("button", {
|
|
1317
|
+
type: "button",
|
|
1318
|
+
"data-testid": "interaction-submit",
|
|
1319
|
+
disabled: r,
|
|
1320
|
+
onClick: i,
|
|
1321
|
+
className: "inline-flex min-h-8 items-center rounded-md bg-emerald-600 px-3 py-1.5 text-xs font-semibold text-white hover:bg-emerald-500 disabled:cursor-not-allowed disabled:opacity-55",
|
|
1322
|
+
children: "提交"
|
|
1323
|
+
}), /* @__PURE__ */ z("button", {
|
|
1324
|
+
type: "button",
|
|
1325
|
+
"data-testid": "interaction-form-cancel",
|
|
1326
|
+
disabled: r,
|
|
1327
|
+
onClick: a,
|
|
1328
|
+
className: "inline-flex min-h-8 items-center rounded-md px-3 py-1.5 text-xs font-medium text-slate-500 underline-offset-2 hover:underline disabled:cursor-not-allowed disabled:opacity-55 dark:text-slate-400",
|
|
1329
|
+
children: "取消本次确认"
|
|
1330
|
+
})]
|
|
1331
|
+
})]
|
|
1332
|
+
});
|
|
1333
|
+
}
|
|
1334
|
+
//#endregion
|
|
1335
|
+
//#region src/core/run/a2ui.ts
|
|
1336
|
+
var wn = Ae, Tn = {
|
|
1337
|
+
description: ke,
|
|
1338
|
+
value: je(wn)
|
|
1339
|
+
};
|
|
1340
|
+
function En(e) {
|
|
1341
|
+
return e.map((e) => {
|
|
1342
|
+
let t = e.updateComponents;
|
|
1343
|
+
if (!t || typeof t != "object" || Array.isArray(t)) return e;
|
|
1344
|
+
let n = t.components;
|
|
1345
|
+
if (!Array.isArray(n)) return e;
|
|
1346
|
+
let r = n.filter((e) => !!(e && typeof e == "object" && !Array.isArray(e)));
|
|
1347
|
+
if (r.some((e) => e.id === "root")) return e;
|
|
1348
|
+
let i = r.filter((e) => typeof e.id == "string" && e.id.endsWith("-root"));
|
|
1349
|
+
if (i.length !== 1) return e;
|
|
1350
|
+
let a = i[0];
|
|
1351
|
+
return {
|
|
1352
|
+
...e,
|
|
1353
|
+
updateComponents: {
|
|
1354
|
+
...t,
|
|
1355
|
+
components: n.map((e) => e === a ? {
|
|
1356
|
+
...a,
|
|
1357
|
+
id: "root"
|
|
1358
|
+
} : e)
|
|
1359
|
+
}
|
|
1360
|
+
};
|
|
1361
|
+
});
|
|
1362
|
+
}
|
|
1363
|
+
//#endregion
|
|
1364
|
+
//#region src/components/chat/A2UIActivityMessage.tsx
|
|
1365
|
+
function Dn({ surfaceId: e, messages: t }) {
|
|
1366
|
+
let { processMessages: n } = Me();
|
|
1367
|
+
return G(() => {
|
|
1368
|
+
n(t);
|
|
1369
|
+
}, [t, n]), /* @__PURE__ */ z(Oe, {
|
|
1370
|
+
surfaceId: e,
|
|
1371
|
+
className: "w-full",
|
|
1372
|
+
fallback: /* @__PURE__ */ z("div", {
|
|
1373
|
+
className: "text-sm text-slate-500 dark:text-slate-400",
|
|
1374
|
+
children: "界面内容暂不可用"
|
|
1375
|
+
}),
|
|
1376
|
+
loadingFallback: /* @__PURE__ */ z("div", {
|
|
1377
|
+
className: "text-sm text-slate-500 dark:text-slate-400",
|
|
1378
|
+
children: "正在加载界面"
|
|
1379
|
+
})
|
|
1380
|
+
});
|
|
1381
|
+
}
|
|
1382
|
+
function On({ surfaceId: e, messages: t, onAction: n }) {
|
|
1383
|
+
return /* @__PURE__ */ z("div", {
|
|
1384
|
+
className: "mb-3 w-full overflow-hidden rounded-lg border border-slate-200 bg-white p-3 shadow-sm dark:border-slate-700 dark:bg-slate-900",
|
|
1385
|
+
children: /* @__PURE__ */ z(De, {
|
|
1386
|
+
catalog: wn,
|
|
1387
|
+
onAction: n,
|
|
1388
|
+
children: /* @__PURE__ */ z(Dn, {
|
|
1389
|
+
surfaceId: e,
|
|
1390
|
+
messages: t
|
|
1391
|
+
})
|
|
1392
|
+
})
|
|
1393
|
+
});
|
|
1394
|
+
}
|
|
1395
|
+
//#endregion
|
|
1396
|
+
//#region src/components/chat/InteractionA2uiSurface.tsx
|
|
1397
|
+
function kn({ a2ui: e, disabled: t, onSubmit: n, onCancel: r }) {
|
|
1398
|
+
return /* @__PURE__ */ B("div", {
|
|
1399
|
+
className: "mt-3",
|
|
1400
|
+
"data-testid": "interaction-a2ui-surface",
|
|
1401
|
+
children: [/* @__PURE__ */ z(On, {
|
|
1402
|
+
surfaceId: `interaction-${e.wireVersion}`,
|
|
1403
|
+
messages: e.messages,
|
|
1404
|
+
onAction: t ? void 0 : (e) => {
|
|
1405
|
+
let t = e.userAction?.context || {};
|
|
1406
|
+
n(typeof t.payload == "object" && t.payload !== null ? t.payload : { ...t });
|
|
1407
|
+
}
|
|
1408
|
+
}), t ? null : /* @__PURE__ */ z("button", {
|
|
1409
|
+
type: "button",
|
|
1410
|
+
"data-testid": "interaction-a2ui-cancel",
|
|
1411
|
+
onClick: r,
|
|
1412
|
+
className: "mt-1 inline-flex min-h-8 items-center rounded-md px-3 py-1.5 text-xs font-medium text-slate-500 underline-offset-2 hover:underline dark:text-slate-400",
|
|
1413
|
+
children: "取消本次确认"
|
|
1414
|
+
})]
|
|
1415
|
+
});
|
|
1416
|
+
}
|
|
1417
|
+
//#endregion
|
|
1418
|
+
//#region src/components/chat/InteractionTray.tsx
|
|
1419
|
+
function An(e) {
|
|
1420
|
+
for (let t of e?.messages || []) {
|
|
1421
|
+
let e = t.inputSchema ?? t.input_schema ?? t.schema;
|
|
1422
|
+
if (typeof e == "object" && e) return e;
|
|
1423
|
+
}
|
|
1424
|
+
return null;
|
|
1425
|
+
}
|
|
1426
|
+
function jn(e) {
|
|
1427
|
+
if (!e.expiresAt) return !1;
|
|
1428
|
+
let t = Date.parse(e.expiresAt);
|
|
1429
|
+
return Number.isFinite(t) && t <= Date.now();
|
|
1430
|
+
}
|
|
1431
|
+
function Mn(e) {
|
|
1432
|
+
let t = e.extensions.submit_error;
|
|
1433
|
+
return typeof t == "object" && t && "code" in t && "message" in t ? {
|
|
1434
|
+
code: String(t.code),
|
|
1435
|
+
message: String(t.message),
|
|
1436
|
+
retryable: !!t.retryable
|
|
1437
|
+
} : null;
|
|
1438
|
+
}
|
|
1439
|
+
var Nn = {
|
|
1440
|
+
approved: "已同意",
|
|
1441
|
+
rejected: "已拒绝",
|
|
1442
|
+
submitted: "已提交",
|
|
1443
|
+
cancelled: "已取消",
|
|
1444
|
+
expired: "已过期"
|
|
1445
|
+
};
|
|
1446
|
+
function Pn({ interactions: e, activeIndex: t, onSelectIndex: n, onRespond: i, localCatalog: s }) {
|
|
1447
|
+
let [c, l] = q(""), [u, d] = q({}), f = e[Math.min(t, Math.max(e.length - 1, 0))];
|
|
1448
|
+
if (!f) return null;
|
|
1449
|
+
let p = jn(f), m = Mn(f), h = p || f.status === "resolving", g = mn(f.presentation?.a2ui, s), _ = f.requestSchema ?? An(f.presentation?.a2ui) ?? null, v = g === "a2ui" ? "a2ui" : g === "json-schema-form" && _ || f.requestSchema && !f.presentation ? "json-schema-form" : "basic-controls", y = v === "json-schema-form" && _ || f.requestSchema, b = (e, t) => {
|
|
1450
|
+
h || i({
|
|
1451
|
+
interactionId: f.interactionId,
|
|
1452
|
+
expectedRevision: f.revision,
|
|
1453
|
+
action: e,
|
|
1454
|
+
response: t,
|
|
1455
|
+
idempotencyKey: yn(f.interactionId, f.revision)
|
|
1456
|
+
});
|
|
1457
|
+
};
|
|
1458
|
+
return /* @__PURE__ */ z("div", {
|
|
1459
|
+
"data-testid": "interaction-tray",
|
|
1460
|
+
"data-interaction-status": f.status,
|
|
1461
|
+
"data-interaction-count": e.length,
|
|
1462
|
+
className: "mx-auto mb-2 w-full max-w-3xl px-6",
|
|
1463
|
+
children: /* @__PURE__ */ B("div", {
|
|
1464
|
+
className: "rounded-xl border border-amber-300/80 bg-amber-50/80 p-3 shadow-sm dark:border-amber-900/60 dark:bg-amber-950/30",
|
|
1465
|
+
children: [
|
|
1466
|
+
/* @__PURE__ */ B("div", {
|
|
1467
|
+
className: "flex items-center justify-between gap-2",
|
|
1468
|
+
children: [/* @__PURE__ */ B("div", {
|
|
1469
|
+
className: "flex items-center gap-2 text-sm font-medium text-amber-900 dark:text-amber-200",
|
|
1470
|
+
children: [/* @__PURE__ */ z("span", {
|
|
1471
|
+
"data-testid": "interaction-tray-title",
|
|
1472
|
+
children: f.title
|
|
1473
|
+
}), e.length > 1 ? /* @__PURE__ */ B("span", {
|
|
1474
|
+
"data-testid": "interaction-tray-count",
|
|
1475
|
+
className: "rounded-full border border-amber-400/60 px-1.5 py-0.5 text-xs",
|
|
1476
|
+
children: [
|
|
1477
|
+
t + 1,
|
|
1478
|
+
"/",
|
|
1479
|
+
e.length
|
|
1480
|
+
]
|
|
1481
|
+
}) : null]
|
|
1482
|
+
}), e.length > 1 ? /* @__PURE__ */ B("div", {
|
|
1483
|
+
className: "flex items-center gap-1",
|
|
1484
|
+
children: [/* @__PURE__ */ z("button", {
|
|
1485
|
+
type: "button",
|
|
1486
|
+
"data-testid": "interaction-tray-prev",
|
|
1487
|
+
disabled: t <= 0,
|
|
1488
|
+
onClick: () => n(Math.max(t - 1, 0)),
|
|
1489
|
+
className: "rounded border border-amber-400/60 p-1 text-amber-900 disabled:opacity-40 dark:text-amber-200",
|
|
1490
|
+
"aria-label": "上一条待确认",
|
|
1491
|
+
children: /* @__PURE__ */ z(a, { className: "h-3.5 w-3.5" })
|
|
1492
|
+
}), /* @__PURE__ */ z("button", {
|
|
1493
|
+
type: "button",
|
|
1494
|
+
"data-testid": "interaction-tray-next",
|
|
1495
|
+
disabled: t >= e.length - 1,
|
|
1496
|
+
onClick: () => n(Math.min(t + 1, e.length - 1)),
|
|
1497
|
+
className: "rounded border border-amber-400/60 p-1 text-amber-900 disabled:opacity-40 dark:text-amber-200",
|
|
1498
|
+
"aria-label": "下一条待确认",
|
|
1499
|
+
children: /* @__PURE__ */ z(o, { className: "h-3.5 w-3.5" })
|
|
1500
|
+
})]
|
|
1501
|
+
}) : null]
|
|
1502
|
+
}),
|
|
1503
|
+
/* @__PURE__ */ z("p", {
|
|
1504
|
+
className: "mt-2 text-sm text-slate-700 dark:text-slate-200",
|
|
1505
|
+
"data-testid": "interaction-tray-message",
|
|
1506
|
+
children: f.message
|
|
1507
|
+
}),
|
|
1508
|
+
p ? /* @__PURE__ */ B("p", {
|
|
1509
|
+
className: "mt-2 text-xs font-medium text-rose-600 dark:text-rose-400",
|
|
1510
|
+
"data-testid": "interaction-tray-expired",
|
|
1511
|
+
children: [
|
|
1512
|
+
"该确认已过期(",
|
|
1513
|
+
Nn.expired,
|
|
1514
|
+
"),等待运行时继续处理。"
|
|
1515
|
+
]
|
|
1516
|
+
}) : null,
|
|
1517
|
+
m ? /* @__PURE__ */ B("p", {
|
|
1518
|
+
className: "mt-2 text-xs font-medium text-rose-600 dark:text-rose-400",
|
|
1519
|
+
"data-testid": "interaction-tray-error",
|
|
1520
|
+
children: [
|
|
1521
|
+
"提交失败(",
|
|
1522
|
+
m.code,
|
|
1523
|
+
"):",
|
|
1524
|
+
m.message,
|
|
1525
|
+
m.retryable ? ",可重试。" : ""
|
|
1526
|
+
]
|
|
1527
|
+
}) : null,
|
|
1528
|
+
v === "a2ui" && f.presentation?.a2ui ? /* @__PURE__ */ z(kn, {
|
|
1529
|
+
a2ui: f.presentation.a2ui,
|
|
1530
|
+
disabled: h,
|
|
1531
|
+
onSubmit: (e) => b("submit", e),
|
|
1532
|
+
onCancel: () => b("cancel", {})
|
|
1533
|
+
}) : v === "json-schema-form" && y ? /* @__PURE__ */ z(Cn, {
|
|
1534
|
+
schema: y,
|
|
1535
|
+
values: u,
|
|
1536
|
+
onChange: d,
|
|
1537
|
+
disabled: h,
|
|
1538
|
+
onSubmit: () => b("submit", u),
|
|
1539
|
+
onCancel: () => b("cancel", {})
|
|
1540
|
+
}) : /* @__PURE__ */ B("div", {
|
|
1541
|
+
className: "mt-3",
|
|
1542
|
+
"data-testid": "interaction-tray-basic",
|
|
1543
|
+
children: [/* @__PURE__ */ z("input", {
|
|
1544
|
+
type: "text",
|
|
1545
|
+
value: c,
|
|
1546
|
+
onChange: (e) => l(e.target.value),
|
|
1547
|
+
placeholder: "备注(可选)",
|
|
1548
|
+
disabled: h,
|
|
1549
|
+
"data-testid": "interaction-tray-comment",
|
|
1550
|
+
className: "mb-2 w-full rounded-md border border-amber-300/70 bg-white px-2 py-1.5 text-sm dark:border-amber-900/60 dark:bg-slate-950"
|
|
1551
|
+
}), /* @__PURE__ */ B("div", {
|
|
1552
|
+
className: "flex flex-wrap gap-2",
|
|
1553
|
+
children: [
|
|
1554
|
+
/* @__PURE__ */ B("button", {
|
|
1555
|
+
type: "button",
|
|
1556
|
+
"data-testid": "interaction-approve",
|
|
1557
|
+
disabled: h,
|
|
1558
|
+
onClick: () => b("approve", {
|
|
1559
|
+
decision: "approve",
|
|
1560
|
+
...c ? { comment: c } : {}
|
|
1561
|
+
}),
|
|
1562
|
+
className: "inline-flex min-h-8 items-center gap-1.5 rounded-md bg-emerald-600 px-3 py-1.5 text-xs font-semibold text-white shadow-sm transition hover:bg-emerald-500 disabled:cursor-not-allowed disabled:opacity-55",
|
|
1563
|
+
children: [/* @__PURE__ */ z(r, { className: "h-3.5 w-3.5" }), "批准并继续"]
|
|
1564
|
+
}),
|
|
1565
|
+
/* @__PURE__ */ B("button", {
|
|
1566
|
+
type: "button",
|
|
1567
|
+
"data-testid": "interaction-reject",
|
|
1568
|
+
disabled: h,
|
|
1569
|
+
onClick: () => b("reject", {
|
|
1570
|
+
decision: "reject",
|
|
1571
|
+
...c ? { comment: c } : {}
|
|
1572
|
+
}),
|
|
1573
|
+
className: "inline-flex min-h-8 items-center gap-1.5 rounded-md border border-slate-300 bg-white px-3 py-1.5 text-xs font-semibold text-slate-600 transition hover:border-rose-300 hover:bg-rose-50 hover:text-rose-600 disabled:cursor-not-allowed disabled:opacity-55 dark:border-slate-700 dark:bg-slate-950 dark:text-slate-300 dark:hover:border-rose-800 dark:hover:bg-rose-950/30 dark:hover:text-rose-300",
|
|
1574
|
+
children: [/* @__PURE__ */ z(L, { className: "h-3.5 w-3.5" }), "拒绝"]
|
|
1575
|
+
}),
|
|
1576
|
+
/* @__PURE__ */ z("button", {
|
|
1577
|
+
type: "button",
|
|
1578
|
+
"data-testid": "interaction-cancel",
|
|
1579
|
+
disabled: h,
|
|
1580
|
+
onClick: () => b("cancel", {}),
|
|
1581
|
+
className: "inline-flex min-h-8 items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium text-slate-500 underline-offset-2 hover:underline disabled:cursor-not-allowed disabled:opacity-55 dark:text-slate-400",
|
|
1582
|
+
children: "取消本次确认"
|
|
1583
|
+
})
|
|
1584
|
+
]
|
|
1585
|
+
})]
|
|
1586
|
+
}),
|
|
1587
|
+
f.status === "resolving" ? /* @__PURE__ */ z("p", {
|
|
1588
|
+
className: "mt-2 text-xs text-amber-700 dark:text-amber-300",
|
|
1589
|
+
children: "正在提交,请稍候…"
|
|
1590
|
+
}) : null
|
|
1591
|
+
]
|
|
1592
|
+
})
|
|
1593
|
+
});
|
|
1594
|
+
}
|
|
1595
|
+
function Fn({ outcome: e }) {
|
|
1596
|
+
return /* @__PURE__ */ z("span", {
|
|
1597
|
+
className: Y("rounded border px-1.5 py-0.5 text-xs font-medium", e === "approved" ? "border-emerald-300 text-emerald-700 dark:border-emerald-900 dark:text-emerald-300" : e === "rejected" ? "border-rose-300 text-rose-700 dark:border-rose-900 dark:text-rose-300" : "border-slate-300 text-slate-600 dark:border-slate-700 dark:text-slate-300"),
|
|
1598
|
+
children: Nn[e] || e
|
|
1599
|
+
});
|
|
1600
|
+
}
|
|
1601
|
+
//#endregion
|
|
1602
|
+
//#region src/components/chat/InteractionHistoryAnchor.tsx
|
|
1603
|
+
function In(e) {
|
|
1604
|
+
if (!e) return "";
|
|
1605
|
+
let t = Date.parse(e);
|
|
1606
|
+
return Number.isFinite(t) ? new Date(t).toLocaleString() : e;
|
|
1607
|
+
}
|
|
1608
|
+
function Ln(e) {
|
|
1609
|
+
let t = e?.properties;
|
|
1610
|
+
return typeof t != "object" || !t ? [] : Object.keys(t);
|
|
1611
|
+
}
|
|
1612
|
+
function Rn({ interaction: e }) {
|
|
1613
|
+
let t = e.status === "resolved" || e.status === "cancelled" || e.status === "expired", n = Ln(e.requestSchema);
|
|
1614
|
+
return /* @__PURE__ */ B("div", {
|
|
1615
|
+
"data-testid": "interaction-history-anchor",
|
|
1616
|
+
"data-interaction-id": e.interactionId,
|
|
1617
|
+
"data-interaction-status": e.status,
|
|
1618
|
+
className: "mt-2 rounded-lg border border-slate-200 bg-slate-50 px-3 py-2 text-xs text-slate-600 dark:border-slate-800 dark:bg-slate-900/60 dark:text-slate-300",
|
|
1619
|
+
children: [/* @__PURE__ */ B("div", {
|
|
1620
|
+
className: "flex flex-wrap items-center gap-2",
|
|
1621
|
+
children: [/* @__PURE__ */ z("span", {
|
|
1622
|
+
className: "font-medium text-slate-700 dark:text-slate-200",
|
|
1623
|
+
children: e.title
|
|
1624
|
+
}), /* @__PURE__ */ z(Fn, { outcome: e.outcome || e.status })]
|
|
1625
|
+
}), t ? /* @__PURE__ */ B(R, { children: [/* @__PURE__ */ B("div", {
|
|
1626
|
+
className: "mt-1 leading-relaxed",
|
|
1627
|
+
children: [
|
|
1628
|
+
e.actor ? /* @__PURE__ */ B("span", { children: [
|
|
1629
|
+
"操作人:",
|
|
1630
|
+
e.actor,
|
|
1631
|
+
" · "
|
|
1632
|
+
] }) : null,
|
|
1633
|
+
e.resolvedAt ? /* @__PURE__ */ B("span", { children: [
|
|
1634
|
+
"决定时间:",
|
|
1635
|
+
In(e.resolvedAt),
|
|
1636
|
+
" · "
|
|
1637
|
+
] }) : null,
|
|
1638
|
+
/* @__PURE__ */ z("span", {
|
|
1639
|
+
"data-testid": "interaction-history-response-summary",
|
|
1640
|
+
children: e.responseSummary || "响应内容已脱敏"
|
|
1641
|
+
})
|
|
1642
|
+
]
|
|
1643
|
+
}), /* @__PURE__ */ B("details", {
|
|
1644
|
+
"data-testid": "interaction-history-detail",
|
|
1645
|
+
className: "mt-1",
|
|
1646
|
+
children: [/* @__PURE__ */ z("summary", {
|
|
1647
|
+
className: "cursor-pointer select-none text-slate-500 hover:text-slate-700 dark:text-slate-400 dark:hover:text-slate-200",
|
|
1648
|
+
children: "查看确认快照"
|
|
1649
|
+
}), /* @__PURE__ */ B("div", {
|
|
1650
|
+
"data-testid": "interaction-history-snapshot",
|
|
1651
|
+
className: "mt-1 rounded border border-slate-200 bg-white px-2 py-1.5 leading-relaxed dark:border-slate-800 dark:bg-slate-950",
|
|
1652
|
+
children: [
|
|
1653
|
+
/* @__PURE__ */ B("div", { children: ["操作者:", /* @__PURE__ */ z("span", {
|
|
1654
|
+
"data-testid": "interaction-history-actor-ref",
|
|
1655
|
+
children: e.actor || "—"
|
|
1656
|
+
})] }),
|
|
1657
|
+
/* @__PURE__ */ B("div", { children: ["决定时间:", In(e.resolvedAt) || "—"] }),
|
|
1658
|
+
/* @__PURE__ */ B("div", { children: ["关键参数:", n.length > 0 ? /* @__PURE__ */ z("span", {
|
|
1659
|
+
"data-testid": "interaction-history-schema-keys",
|
|
1660
|
+
children: n.join("、")
|
|
1661
|
+
}) : /* @__PURE__ */ z("span", { children: "无结构化参数" })] })
|
|
1662
|
+
]
|
|
1663
|
+
})]
|
|
1664
|
+
})] }) : /* @__PURE__ */ B("div", {
|
|
1665
|
+
className: "mt-1",
|
|
1666
|
+
children: ["状态:", e.status === "pending" ? "待处理(见输入区确认面板)" : "处理中…"]
|
|
1667
|
+
})]
|
|
1668
|
+
});
|
|
1669
|
+
}
|
|
1670
|
+
//#endregion
|
|
979
1671
|
//#region src/components/chat/ProcessingBlocksView.tsx
|
|
980
|
-
function
|
|
1672
|
+
function zn({ summary: e, children: t, defaultOpen: n = !1, streaming: r = !1 }) {
|
|
981
1673
|
let [a, o] = q(n);
|
|
982
1674
|
return /* @__PURE__ */ B("div", {
|
|
983
1675
|
className: "mb-1.5",
|
|
@@ -985,7 +1677,7 @@ function rn({ summary: e, children: t, defaultOpen: n = !1, streaming: r = !1 })
|
|
|
985
1677
|
type: "button",
|
|
986
1678
|
onClick: () => o((e) => !e),
|
|
987
1679
|
className: "flex w-full items-center gap-1.5 rounded px-1 py-1 text-left text-[13px] text-slate-500 transition-colors hover:bg-slate-100/70 dark:text-slate-400 dark:hover:bg-slate-800/40",
|
|
988
|
-
children: [r ? /* @__PURE__ */ z(
|
|
1680
|
+
children: [r ? /* @__PURE__ */ z(x, { className: "h-3.5 w-3.5 animate-spin text-slate-400" }) : /* @__PURE__ */ z(i, { className: Y("h-3.5 w-3.5 text-slate-400 transition-transform", a && "rotate-90") }), /* @__PURE__ */ z("span", {
|
|
989
1681
|
className: "min-w-0 flex-1 truncate",
|
|
990
1682
|
children: e
|
|
991
1683
|
})]
|
|
@@ -995,7 +1687,7 @@ function rn({ summary: e, children: t, defaultOpen: n = !1, streaming: r = !1 })
|
|
|
995
1687
|
})]
|
|
996
1688
|
});
|
|
997
1689
|
}
|
|
998
|
-
function
|
|
1690
|
+
function Bn({ block: e }) {
|
|
999
1691
|
let [t, n] = q(!1), r = e.status === "streaming", a = e.content.length, o = `${e.id}-thinking-detail`;
|
|
1000
1692
|
return /* @__PURE__ */ B("div", {
|
|
1001
1693
|
className: "mb-1.5 min-w-0",
|
|
@@ -1006,7 +1698,7 @@ function an({ block: e }) {
|
|
|
1006
1698
|
onClick: () => n((e) => !e),
|
|
1007
1699
|
className: "flex w-full items-center gap-1.5 rounded px-1 py-1 text-left text-[13px] leading-5 text-slate-400 transition-colors hover:bg-slate-100/70 hover:text-slate-500 dark:text-slate-500 dark:hover:bg-slate-800/40 dark:hover:text-slate-400",
|
|
1008
1700
|
children: [
|
|
1009
|
-
/* @__PURE__ */ z(
|
|
1701
|
+
/* @__PURE__ */ z(M, { className: Y("h-3.5 w-3.5 shrink-0", r && "animate-pulse motion-reduce:animate-none") }),
|
|
1010
1702
|
/* @__PURE__ */ z("span", {
|
|
1011
1703
|
className: "min-w-0 truncate",
|
|
1012
1704
|
children: r ? "思考中" : "已思考"
|
|
@@ -1027,24 +1719,24 @@ function an({ block: e }) {
|
|
|
1027
1719
|
})]
|
|
1028
1720
|
});
|
|
1029
1721
|
}
|
|
1030
|
-
function
|
|
1031
|
-
let
|
|
1032
|
-
return /* @__PURE__ */ z(
|
|
1033
|
-
streaming:
|
|
1034
|
-
defaultOpen:
|
|
1722
|
+
function Vn({ block: e, tool: t, isStreaming: n, interactionRecord: r, onRespondToApproval: i, onRespondToAguiApproval: a }) {
|
|
1723
|
+
let o = t?.status ?? e.status, s = t?.args ?? e.args, c = t?.output ?? e.output, l = e.extra || {}, u = l.approvalStatus || t?.approvalStatus, d = l.approvalRequestId || t?.approvalRequestId, f = l.approvalMessage || t?.approvalMessage, p = l.approvalProtocol || t?.approvalProtocol, m = l.previousResponseId || t?.previousResponseId, h = o === "running", g = o === "error", _ = o === "paused", v = g ? "执行失败" : u === "pending" ? "等待确认" : u === "rejected" ? "已拒绝" : h ? u === "approved" ? "已授权 · 执行中" : "正在运行" : u === "approved" ? "已授权" : _ ? "已暂停" : "已完成", y = g ? "text-rose-500 dark:text-rose-400" : _ ? "text-amber-500 dark:text-amber-400" : h ? "text-slate-500 dark:text-slate-400" : "text-slate-400 dark:text-slate-500";
|
|
1724
|
+
return /* @__PURE__ */ z(zn, {
|
|
1725
|
+
streaming: h && !s,
|
|
1726
|
+
defaultOpen: u === "pending" || _,
|
|
1035
1727
|
summary: /* @__PURE__ */ B("span", {
|
|
1036
1728
|
className: "flex items-center gap-1.5",
|
|
1037
1729
|
children: [
|
|
1038
|
-
/* @__PURE__ */ z(
|
|
1730
|
+
/* @__PURE__ */ z(I, { className: Y("h-3.5 w-3.5 shrink-0", y) }),
|
|
1039
1731
|
/* @__PURE__ */ z("span", {
|
|
1040
|
-
className:
|
|
1041
|
-
children:
|
|
1732
|
+
className: y,
|
|
1733
|
+
children: v
|
|
1042
1734
|
}),
|
|
1043
1735
|
/* @__PURE__ */ z("span", {
|
|
1044
1736
|
className: "truncate font-medium text-slate-600 dark:text-slate-300",
|
|
1045
1737
|
children: e.toolName
|
|
1046
1738
|
}),
|
|
1047
|
-
|
|
1739
|
+
h && s && /* @__PURE__ */ z("span", {
|
|
1048
1740
|
className: "ml-0.5 animate-pulse text-slate-400",
|
|
1049
1741
|
children: "…"
|
|
1050
1742
|
})
|
|
@@ -1053,7 +1745,7 @@ function on({ block: e, tool: t, isStreaming: n, onRespondToApproval: r, onRespo
|
|
|
1053
1745
|
children: /* @__PURE__ */ B("div", {
|
|
1054
1746
|
className: "flex flex-col gap-2.5 py-1 text-[13px]",
|
|
1055
1747
|
children: [
|
|
1056
|
-
|
|
1748
|
+
d && u === "pending" && !r && /* @__PURE__ */ B("section", {
|
|
1057
1749
|
className: "flex flex-wrap items-center gap-x-3 gap-y-2 rounded-lg border border-slate-200/90 bg-white/70 px-2.5 py-2 font-sans text-[12px] text-slate-600 shadow-[0_1px_2px_rgba(15,23,42,0.03)] dark:border-slate-700/80 dark:bg-slate-900/30 dark:text-slate-300",
|
|
1058
1750
|
children: [/* @__PURE__ */ B("div", {
|
|
1059
1751
|
className: "flex min-w-0 flex-1 items-center gap-2",
|
|
@@ -1068,7 +1760,7 @@ function on({ block: e, tool: t, isStreaming: n, onRespondToApproval: r, onRespo
|
|
|
1068
1760
|
}),
|
|
1069
1761
|
/* @__PURE__ */ z("span", {
|
|
1070
1762
|
className: "min-w-0 truncate text-slate-500 dark:text-slate-400",
|
|
1071
|
-
children:
|
|
1763
|
+
children: f || "允许后将执行此工具调用。"
|
|
1072
1764
|
})
|
|
1073
1765
|
]
|
|
1074
1766
|
}), /* @__PURE__ */ B("div", {
|
|
@@ -1076,71 +1768,78 @@ function on({ block: e, tool: t, isStreaming: n, onRespondToApproval: r, onRespo
|
|
|
1076
1768
|
children: [/* @__PURE__ */ z("button", {
|
|
1077
1769
|
type: "button",
|
|
1078
1770
|
disabled: n,
|
|
1079
|
-
onClick: () =>
|
|
1080
|
-
interruptId:
|
|
1771
|
+
onClick: () => p === "ag-ui" ? a?.({
|
|
1772
|
+
interruptId: d || "",
|
|
1081
1773
|
approve: !0
|
|
1082
|
-
}) :
|
|
1083
|
-
approvalRequestId:
|
|
1774
|
+
}) : i?.({
|
|
1775
|
+
approvalRequestId: d || "",
|
|
1084
1776
|
approve: !0,
|
|
1085
|
-
previousResponseId:
|
|
1777
|
+
previousResponseId: m
|
|
1086
1778
|
}),
|
|
1087
1779
|
className: "inline-flex h-7 items-center rounded-md bg-primary px-2.5 text-[12px] font-medium text-primary-foreground transition hover:bg-primary/90 disabled:opacity-55",
|
|
1088
1780
|
children: "允许执行"
|
|
1089
1781
|
}), /* @__PURE__ */ z("button", {
|
|
1090
1782
|
type: "button",
|
|
1091
1783
|
disabled: n,
|
|
1092
|
-
onClick: () =>
|
|
1093
|
-
interruptId:
|
|
1784
|
+
onClick: () => p === "ag-ui" ? a?.({
|
|
1785
|
+
interruptId: d || "",
|
|
1094
1786
|
approve: !1
|
|
1095
|
-
}) :
|
|
1096
|
-
approvalRequestId:
|
|
1787
|
+
}) : i?.({
|
|
1788
|
+
approvalRequestId: d || "",
|
|
1097
1789
|
approve: !1,
|
|
1098
|
-
previousResponseId:
|
|
1790
|
+
previousResponseId: m
|
|
1099
1791
|
}),
|
|
1100
1792
|
className: "inline-flex h-7 items-center rounded-md px-2 text-[12px] font-medium text-slate-500 transition hover:bg-slate-100 hover:text-rose-600 disabled:opacity-55 dark:text-slate-400 dark:hover:bg-slate-800",
|
|
1101
1793
|
children: "拒绝"
|
|
1102
1794
|
})]
|
|
1103
1795
|
})]
|
|
1104
1796
|
}),
|
|
1105
|
-
|
|
1797
|
+
d && u === "pending" && r ? /* @__PURE__ */ B("div", {
|
|
1798
|
+
className: "flex items-center gap-1.5 font-sans text-xs text-slate-500 dark:text-slate-400",
|
|
1799
|
+
children: [/* @__PURE__ */ z("span", {
|
|
1800
|
+
className: "h-1.5 w-1.5 shrink-0 rounded-full bg-amber-400",
|
|
1801
|
+
"aria-hidden": "true"
|
|
1802
|
+
}), "请在输入区确认面板中操作。"]
|
|
1803
|
+
}) : null,
|
|
1804
|
+
d && u && u !== "pending" && /* @__PURE__ */ B("div", {
|
|
1106
1805
|
className: "flex items-center gap-1.5 font-sans text-xs text-slate-500 dark:text-slate-400",
|
|
1107
1806
|
children: [
|
|
1108
|
-
/* @__PURE__ */ z("span", { children:
|
|
1109
|
-
|
|
1110
|
-
|
|
1807
|
+
/* @__PURE__ */ z("span", { children: u === "approved" ? "已授权" : "已拒绝" }),
|
|
1808
|
+
u === "approved" && h ? /* @__PURE__ */ z("span", { children: "· 工具执行中" }) : null,
|
|
1809
|
+
u === "approved" && g ? /* @__PURE__ */ z("span", { children: "· 工具执行失败" }) : null
|
|
1111
1810
|
]
|
|
1112
1811
|
}),
|
|
1113
|
-
|
|
1812
|
+
s ? /* @__PURE__ */ z(Kn, {
|
|
1114
1813
|
label: "入参",
|
|
1115
|
-
value:
|
|
1814
|
+
value: s,
|
|
1116
1815
|
tone: "input"
|
|
1117
1816
|
}) : null,
|
|
1118
|
-
|
|
1817
|
+
c ? Hn(e.toolName, c, g) : null
|
|
1119
1818
|
]
|
|
1120
1819
|
})
|
|
1121
1820
|
});
|
|
1122
1821
|
}
|
|
1123
|
-
function
|
|
1124
|
-
if (
|
|
1822
|
+
function Hn(e, t, n) {
|
|
1823
|
+
if (un(t)) return /* @__PURE__ */ z(Un, { output: t });
|
|
1125
1824
|
let r = e.toLowerCase();
|
|
1126
1825
|
if (r.includes("web_search") || r.includes("search")) {
|
|
1127
|
-
let e =
|
|
1128
|
-
if (e.length > 0) return /* @__PURE__ */ z(
|
|
1826
|
+
let e = Wn(t);
|
|
1827
|
+
if (e.length > 0) return /* @__PURE__ */ z(Gn, { sources: e });
|
|
1129
1828
|
}
|
|
1130
|
-
return /* @__PURE__ */ z(
|
|
1829
|
+
return /* @__PURE__ */ z(Kn, {
|
|
1131
1830
|
label: "输出",
|
|
1132
1831
|
value: t,
|
|
1133
1832
|
tone: n ? "error" : "output"
|
|
1134
1833
|
});
|
|
1135
1834
|
}
|
|
1136
|
-
function
|
|
1137
|
-
let t =
|
|
1835
|
+
function Un({ output: e }) {
|
|
1836
|
+
let t = cn(e), [n, r] = q(!1), i = n ? t : t.slice(0, 3);
|
|
1138
1837
|
return /* @__PURE__ */ B("div", {
|
|
1139
1838
|
className: "my-2 overflow-hidden rounded-xl border border-border bg-background",
|
|
1140
1839
|
children: [
|
|
1141
1840
|
/* @__PURE__ */ B("div", {
|
|
1142
1841
|
className: "flex items-center gap-1.5 border-b border-border px-3 py-2 text-xs font-medium text-text-secondary",
|
|
1143
|
-
children: [/* @__PURE__ */ z(
|
|
1842
|
+
children: [/* @__PURE__ */ z(p, { className: "h-3.5 w-3.5 text-primary" }), /* @__PURE__ */ B("span", { children: [
|
|
1144
1843
|
"改动 ",
|
|
1145
1844
|
t.length,
|
|
1146
1845
|
" 个文件"
|
|
@@ -1149,7 +1848,7 @@ function cn({ output: e }) {
|
|
|
1149
1848
|
/* @__PURE__ */ z("div", {
|
|
1150
1849
|
className: "flex flex-col",
|
|
1151
1850
|
children: i.map((e) => {
|
|
1152
|
-
let { added: t, removed: n } =
|
|
1851
|
+
let { added: t, removed: n } = ln(e);
|
|
1153
1852
|
return /* @__PURE__ */ B("div", {
|
|
1154
1853
|
className: "group/file-change-row flex min-w-0 items-center gap-2 px-3 py-2 text-sm transition-colors hover:bg-muted",
|
|
1155
1854
|
children: [/* @__PURE__ */ z("span", {
|
|
@@ -1181,7 +1880,7 @@ function cn({ output: e }) {
|
|
|
1181
1880
|
]
|
|
1182
1881
|
});
|
|
1183
1882
|
}
|
|
1184
|
-
function
|
|
1883
|
+
function Wn(e) {
|
|
1185
1884
|
try {
|
|
1186
1885
|
let t = JSON.parse(e), n = Array.isArray(t) ? t : t?.results ?? t?.sources ?? [];
|
|
1187
1886
|
return Array.isArray(n) ? n.map((e) => {
|
|
@@ -1195,7 +1894,7 @@ function ln(e) {
|
|
|
1195
1894
|
return [];
|
|
1196
1895
|
}
|
|
1197
1896
|
}
|
|
1198
|
-
function
|
|
1897
|
+
function Gn({ sources: e }) {
|
|
1199
1898
|
return /* @__PURE__ */ z("div", {
|
|
1200
1899
|
className: "mt-2 flex min-w-0",
|
|
1201
1900
|
children: /* @__PURE__ */ B("span", {
|
|
@@ -1203,7 +1902,7 @@ function un({ sources: e }) {
|
|
|
1203
1902
|
children: [/* @__PURE__ */ B("button", {
|
|
1204
1903
|
type: "button",
|
|
1205
1904
|
className: "inline-flex h-7 min-w-0 items-center gap-1.5 rounded-md border border-border bg-surface px-2 text-xs text-text-secondary transition-colors hover:bg-muted hover:text-text-primary",
|
|
1206
|
-
children: [/* @__PURE__ */ z(
|
|
1905
|
+
children: [/* @__PURE__ */ z(g, {
|
|
1207
1906
|
className: "h-3.5 w-3.5 shrink-0",
|
|
1208
1907
|
strokeWidth: 1.7
|
|
1209
1908
|
}), /* @__PURE__ */ B("span", { children: ["来源 · ", e.length] })]
|
|
@@ -1218,7 +1917,7 @@ function un({ sources: e }) {
|
|
|
1218
1917
|
target: "_blank",
|
|
1219
1918
|
rel: "noopener noreferrer",
|
|
1220
1919
|
className: "flex min-w-0 items-center gap-2 rounded-lg px-2 py-1.5 text-sm leading-5 text-text-secondary transition-colors hover:bg-muted hover:text-text-primary",
|
|
1221
|
-
children: [/* @__PURE__ */ z(
|
|
1920
|
+
children: [/* @__PURE__ */ z(g, {
|
|
1222
1921
|
className: "h-3.5 w-3.5 shrink-0",
|
|
1223
1922
|
strokeWidth: 1.7
|
|
1224
1923
|
}), /* @__PURE__ */ z("span", {
|
|
@@ -1232,7 +1931,7 @@ function un({ sources: e }) {
|
|
|
1232
1931
|
})
|
|
1233
1932
|
});
|
|
1234
1933
|
}
|
|
1235
|
-
function
|
|
1934
|
+
function Kn({ label: e, tone: t, value: n }) {
|
|
1236
1935
|
return /* @__PURE__ */ B("div", { children: [/* @__PURE__ */ z("div", {
|
|
1237
1936
|
className: "mb-1 text-[11px] font-semibold uppercase tracking-wide text-slate-400",
|
|
1238
1937
|
children: e
|
|
@@ -1241,30 +1940,206 @@ function dn({ label: e, tone: t, value: n }) {
|
|
|
1241
1940
|
children: n
|
|
1242
1941
|
})] });
|
|
1243
1942
|
}
|
|
1244
|
-
function
|
|
1943
|
+
function qn({ block: e }) {
|
|
1245
1944
|
return e.content ? /* @__PURE__ */ z("div", {
|
|
1246
1945
|
className: "w-full break-words py-0.5 text-[14px] leading-[1.65]",
|
|
1247
1946
|
children: /* @__PURE__ */ z(Z, { content: e.content })
|
|
1248
1947
|
}) : null;
|
|
1249
1948
|
}
|
|
1250
|
-
function
|
|
1949
|
+
function Jn({ message: e, isStreaming: t, onRespondToApproval: n, onRespondToAguiApproval: r, interactionRecords: i }) {
|
|
1251
1950
|
return /* @__PURE__ */ z("div", {
|
|
1252
1951
|
className: "mb-3 min-w-0",
|
|
1253
|
-
children: (e.blocks ?? []).map((
|
|
1254
|
-
block:
|
|
1255
|
-
tool
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1952
|
+
children: (e.blocks ?? []).map((a) => {
|
|
1953
|
+
if (a.type === "thinking") return /* @__PURE__ */ z(Bn, { block: a }, a.id);
|
|
1954
|
+
if (a.type === "tool") {
|
|
1955
|
+
let o = a.extra || {}, s = String(o.approvalRequestId || e.tools?.[a.toolName]?.approvalRequestId || ""), c = s ? i?.find((e) => e.interactionId === s) : void 0;
|
|
1956
|
+
return /* @__PURE__ */ B("div", { children: [/* @__PURE__ */ z(Vn, {
|
|
1957
|
+
block: a,
|
|
1958
|
+
tool: e.tools?.[a.toolName],
|
|
1959
|
+
isStreaming: t,
|
|
1960
|
+
interactionRecord: c,
|
|
1961
|
+
onRespondToApproval: n,
|
|
1962
|
+
onRespondToAguiApproval: r
|
|
1963
|
+
}), c ? /* @__PURE__ */ z(Rn, { interaction: c }) : null] }, a.id);
|
|
1964
|
+
}
|
|
1965
|
+
return /* @__PURE__ */ z(qn, { block: a }, a.id);
|
|
1966
|
+
})
|
|
1260
1967
|
});
|
|
1261
1968
|
}
|
|
1262
1969
|
//#endregion
|
|
1970
|
+
//#region src/core/stream/runtime-items.ts
|
|
1971
|
+
function Yn(e, t) {
|
|
1972
|
+
return `${e}${t}`;
|
|
1973
|
+
}
|
|
1974
|
+
function Xn(e) {
|
|
1975
|
+
return { ...e };
|
|
1976
|
+
}
|
|
1977
|
+
var Zn = class {
|
|
1978
|
+
runId = null;
|
|
1979
|
+
status = null;
|
|
1980
|
+
items = /* @__PURE__ */ new Map();
|
|
1981
|
+
seenEventIds = /* @__PURE__ */ new Set();
|
|
1982
|
+
apply(e) {
|
|
1983
|
+
if (e.eventId) {
|
|
1984
|
+
if (this.seenEventIds.has(e.eventId)) return;
|
|
1985
|
+
this.seenEventIds.add(e.eventId);
|
|
1986
|
+
}
|
|
1987
|
+
switch (e.type) {
|
|
1988
|
+
case "run_started":
|
|
1989
|
+
this.runId = e.runId, this.status = "running";
|
|
1990
|
+
return;
|
|
1991
|
+
case "run_interrupted":
|
|
1992
|
+
this.status = "interrupted";
|
|
1993
|
+
return;
|
|
1994
|
+
case "run_completed":
|
|
1995
|
+
this.status = "completed";
|
|
1996
|
+
return;
|
|
1997
|
+
case "run_failed":
|
|
1998
|
+
this.status = "failed";
|
|
1999
|
+
return;
|
|
2000
|
+
case "run_canceled":
|
|
2001
|
+
this.status = "canceled";
|
|
2002
|
+
return;
|
|
2003
|
+
case "item_started":
|
|
2004
|
+
this.startItem(e);
|
|
2005
|
+
return;
|
|
2006
|
+
case "item_updated":
|
|
2007
|
+
this.updateItem(e);
|
|
2008
|
+
return;
|
|
2009
|
+
case "item_snapshot_replaced":
|
|
2010
|
+
this.replaceSnapshot(e);
|
|
2011
|
+
return;
|
|
2012
|
+
case "item_completed":
|
|
2013
|
+
case "item_failed":
|
|
2014
|
+
this.closeItem(e);
|
|
2015
|
+
return;
|
|
2016
|
+
}
|
|
2017
|
+
}
|
|
2018
|
+
applyAll(e) {
|
|
2019
|
+
for (let t of e) this.apply(t);
|
|
2020
|
+
}
|
|
2021
|
+
snapshot() {
|
|
2022
|
+
return {
|
|
2023
|
+
runId: this.runId,
|
|
2024
|
+
status: this.status,
|
|
2025
|
+
items: Array.from(this.items.values()).map((e) => ({
|
|
2026
|
+
...e,
|
|
2027
|
+
parts: e.parts.map(Xn)
|
|
2028
|
+
}))
|
|
2029
|
+
};
|
|
2030
|
+
}
|
|
2031
|
+
ensureItem(e) {
|
|
2032
|
+
this.runId === null && (this.runId = e.runId);
|
|
2033
|
+
let t = Yn(e.scopeId, e.itemId), n = this.items.get(t);
|
|
2034
|
+
return n || (n = {
|
|
2035
|
+
runId: e.runId,
|
|
2036
|
+
scopeId: e.scopeId,
|
|
2037
|
+
itemId: e.itemId,
|
|
2038
|
+
itemKind: e.itemKind || "message",
|
|
2039
|
+
status: "open",
|
|
2040
|
+
parts: []
|
|
2041
|
+
}, this.items.set(t, n)), n;
|
|
2042
|
+
}
|
|
2043
|
+
startItem(e) {
|
|
2044
|
+
let t = Yn(e.scopeId, e.itemId), n = this.items.get(t);
|
|
2045
|
+
if (n) {
|
|
2046
|
+
e.phase !== void 0 && (n.phase = e.phase);
|
|
2047
|
+
return;
|
|
2048
|
+
}
|
|
2049
|
+
let r = this.ensureItem(e);
|
|
2050
|
+
r.phase = e.phase, e.initialParts && (r.parts = e.initialParts.map(Xn));
|
|
2051
|
+
}
|
|
2052
|
+
updateItem(e) {
|
|
2053
|
+
let t = this.ensureItem(e), n = t.parts.findIndex((t) => t.partId === e.partId);
|
|
2054
|
+
if (n < 0) {
|
|
2055
|
+
t.parts.push(Xn(e.part));
|
|
2056
|
+
return;
|
|
2057
|
+
}
|
|
2058
|
+
let r = t.parts[n];
|
|
2059
|
+
if (e.op === "replace") {
|
|
2060
|
+
t.parts[n] = Xn(e.part);
|
|
2061
|
+
return;
|
|
2062
|
+
}
|
|
2063
|
+
t.parts[n] = {
|
|
2064
|
+
...r,
|
|
2065
|
+
text: `${r.text || ""}${e.part.text || ""}`
|
|
2066
|
+
};
|
|
2067
|
+
}
|
|
2068
|
+
replaceSnapshot(e) {
|
|
2069
|
+
let t = this.ensureItem(e);
|
|
2070
|
+
t.parts = e.parts.map(Xn);
|
|
2071
|
+
}
|
|
2072
|
+
closeItem(e) {
|
|
2073
|
+
let t = this.ensureItem(e);
|
|
2074
|
+
e.parts && (t.parts = e.parts.map(Xn)), t.status = e.type === "item_completed" ? "completed" : "failed";
|
|
2075
|
+
}
|
|
2076
|
+
};
|
|
2077
|
+
function Qn(e, t) {
|
|
2078
|
+
return {
|
|
2079
|
+
partId: e,
|
|
2080
|
+
contentType: "text",
|
|
2081
|
+
text: t
|
|
2082
|
+
};
|
|
2083
|
+
}
|
|
2084
|
+
var $n = "text-0";
|
|
2085
|
+
function er(e, t) {
|
|
2086
|
+
return String(e?.id || e?.item_id || t?.item_id || t?.output_index || "");
|
|
2087
|
+
}
|
|
2088
|
+
function tr(e) {
|
|
2089
|
+
let t = e?.content;
|
|
2090
|
+
return Array.isArray(t) ? t.map((e) => typeof e == "string" ? e : String(e?.text || "")).join("") : String(e?.output_text || e?.text || "");
|
|
2091
|
+
}
|
|
2092
|
+
function nr(e, t, n, r) {
|
|
2093
|
+
let i = String(t?.type || e || "").trim(), a = t?.id ? String(t.id) : void 0, o = t?.item || t?.output_item || {}, s = er(o, t), c = String(o?.type || ""), l = c.includes("reasoning") ? "reasoning" : "message";
|
|
2094
|
+
if (i === "response.output_item.added") return !s || c !== "message" && !c.includes("reasoning") ? [] : [{
|
|
2095
|
+
type: "item_started",
|
|
2096
|
+
runId: n,
|
|
2097
|
+
scopeId: r,
|
|
2098
|
+
itemId: s,
|
|
2099
|
+
itemKind: l,
|
|
2100
|
+
phase: "final_answer",
|
|
2101
|
+
eventId: a
|
|
2102
|
+
}];
|
|
2103
|
+
if (i === "response.output_text.delta" || i === "response.content_part.delta") {
|
|
2104
|
+
if (!s) return [];
|
|
2105
|
+
let e = String(t?.delta || t?.text || "");
|
|
2106
|
+
return e ? [{
|
|
2107
|
+
type: "item_updated",
|
|
2108
|
+
runId: n,
|
|
2109
|
+
scopeId: r,
|
|
2110
|
+
itemId: s,
|
|
2111
|
+
itemKind: l,
|
|
2112
|
+
partId: $n,
|
|
2113
|
+
op: "append",
|
|
2114
|
+
part: Qn($n, e),
|
|
2115
|
+
eventId: a
|
|
2116
|
+
}] : [];
|
|
2117
|
+
}
|
|
2118
|
+
return i === "response.output_item.done" || i === "response.output_text.done" ? s ? [{
|
|
2119
|
+
type: "item_completed",
|
|
2120
|
+
runId: n,
|
|
2121
|
+
scopeId: r,
|
|
2122
|
+
itemId: s,
|
|
2123
|
+
itemKind: l,
|
|
2124
|
+
parts: [Qn($n, tr(o) || String(t?.text || ""))],
|
|
2125
|
+
eventId: a
|
|
2126
|
+
}] : [] : i === "response.completed" ? [{
|
|
2127
|
+
type: "run_completed",
|
|
2128
|
+
runId: n,
|
|
2129
|
+
scopeId: r,
|
|
2130
|
+
eventId: a
|
|
2131
|
+
}] : [];
|
|
2132
|
+
}
|
|
2133
|
+
//#endregion
|
|
1263
2134
|
//#region src/stores/streaming.ts
|
|
1264
|
-
var
|
|
2135
|
+
var rr = (e) => Object.keys(e).length > 0, ir = {
|
|
2136
|
+
runId: null,
|
|
2137
|
+
status: null,
|
|
2138
|
+
items: []
|
|
2139
|
+
}, ar = new Zn(), or = (e, t) => {
|
|
1265
2140
|
let n = { ...e };
|
|
1266
2141
|
return delete n[t], n;
|
|
1267
|
-
},
|
|
2142
|
+
}, sr = ve()((e, t) => ({
|
|
1268
2143
|
isStreaming: !1,
|
|
1269
2144
|
currentRunId: "",
|
|
1270
2145
|
stopRequested: !1,
|
|
@@ -1274,6 +2149,7 @@ var mn = (e) => Object.keys(e).length > 0, hn = (e, t) => {
|
|
|
1274
2149
|
banner: null,
|
|
1275
2150
|
lastSeqId: 0,
|
|
1276
2151
|
activeInvocationId: "",
|
|
2152
|
+
runtimeItems: ir,
|
|
1277
2153
|
setStreaming: (t) => e({ isStreaming: t }),
|
|
1278
2154
|
setBanner: (t) => e({ banner: t ? {
|
|
1279
2155
|
...t,
|
|
@@ -1284,13 +2160,13 @@ var mn = (e) => Object.keys(e).length > 0, hn = (e, t) => {
|
|
|
1284
2160
|
setSessionStreaming: (t, n) => e((e) => {
|
|
1285
2161
|
let r = String(t || "");
|
|
1286
2162
|
if (!r) return { isStreaming: n };
|
|
1287
|
-
let i =
|
|
2163
|
+
let i = or(e.sessionStreaming, r), a = n ? {
|
|
1288
2164
|
...i,
|
|
1289
2165
|
[r]: !0
|
|
1290
2166
|
} : i;
|
|
1291
2167
|
return {
|
|
1292
2168
|
sessionStreaming: a,
|
|
1293
|
-
isStreaming:
|
|
2169
|
+
isStreaming: rr(a)
|
|
1294
2170
|
};
|
|
1295
2171
|
}),
|
|
1296
2172
|
isSessionStreaming: (e) => {
|
|
@@ -1335,7 +2211,7 @@ var mn = (e) => Object.keys(e).length > 0, hn = (e, t) => {
|
|
|
1335
2211
|
eventCount: t.countEvent === !1 ? 0 : 1
|
|
1336
2212
|
};
|
|
1337
2213
|
return n ? {
|
|
1338
|
-
isStreaming:
|
|
2214
|
+
isStreaming: rr(e.sessionStreaming),
|
|
1339
2215
|
sessionActivities: {
|
|
1340
2216
|
...e.sessionActivities,
|
|
1341
2217
|
[n]: i
|
|
@@ -1368,9 +2244,9 @@ var mn = (e) => Object.keys(e).length > 0, hn = (e, t) => {
|
|
|
1368
2244
|
}, o = {
|
|
1369
2245
|
...e.sessionActivities,
|
|
1370
2246
|
[r]: a
|
|
1371
|
-
}, s =
|
|
2247
|
+
}, s = or(e.sessionStreaming, r);
|
|
1372
2248
|
return {
|
|
1373
|
-
isStreaming:
|
|
2249
|
+
isStreaming: rr(s),
|
|
1374
2250
|
activity: a,
|
|
1375
2251
|
sessionActivities: o,
|
|
1376
2252
|
sessionStreaming: s
|
|
@@ -1380,48 +2256,54 @@ var mn = (e) => Object.keys(e).length > 0, hn = (e, t) => {
|
|
|
1380
2256
|
clearSessionActivity: (t) => e((e) => {
|
|
1381
2257
|
let n = String(t || "");
|
|
1382
2258
|
if (!n) return {};
|
|
1383
|
-
let { [n]: r, ...i } = e.sessionActivities, a =
|
|
2259
|
+
let { [n]: r, ...i } = e.sessionActivities, a = or(e.sessionStreaming, n);
|
|
1384
2260
|
return {
|
|
1385
2261
|
sessionActivities: i,
|
|
1386
2262
|
sessionStreaming: a,
|
|
1387
|
-
isStreaming:
|
|
2263
|
+
isStreaming: rr(a),
|
|
1388
2264
|
activity: e.activity === r ? null : e.activity
|
|
1389
2265
|
};
|
|
1390
2266
|
}),
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
2267
|
+
applyRuntimeItemOperations: (t) => {
|
|
2268
|
+
ar.applyAll(t), e({ runtimeItems: ar.snapshot() });
|
|
2269
|
+
},
|
|
2270
|
+
resetRun: () => {
|
|
2271
|
+
ar = new Zn(), e({
|
|
2272
|
+
isStreaming: !1,
|
|
2273
|
+
currentRunId: "",
|
|
2274
|
+
stopRequested: !1,
|
|
2275
|
+
activity: null,
|
|
2276
|
+
sessionActivities: {},
|
|
2277
|
+
sessionStreaming: {},
|
|
2278
|
+
lastSeqId: 0,
|
|
2279
|
+
activeInvocationId: "",
|
|
2280
|
+
runtimeItems: ir
|
|
2281
|
+
});
|
|
2282
|
+
}
|
|
1401
2283
|
}));
|
|
1402
2284
|
//#endregion
|
|
1403
2285
|
//#region src/components/chat/StatusBanner.tsx
|
|
1404
|
-
function
|
|
1405
|
-
let t =
|
|
2286
|
+
function cr({ onRetry: e }) {
|
|
2287
|
+
let t = sr((e) => e.banner);
|
|
1406
2288
|
if (!t) return null;
|
|
1407
|
-
let n = t.kind === "rate_limited" ? /* @__PURE__ */ z(
|
|
2289
|
+
let n = t.kind === "rate_limited" ? /* @__PURE__ */ z(lr, {
|
|
1408
2290
|
message: t.message,
|
|
1409
2291
|
retryAfterSec: t.retryAfterSec
|
|
1410
2292
|
}, t.createdAt || `${t.sessionId || ""}:${t.retryAfterSec || 0}`) : null, r = {
|
|
1411
2293
|
rate_limited: {
|
|
1412
|
-
icon: /* @__PURE__ */ z(
|
|
2294
|
+
icon: /* @__PURE__ */ z(he, { className: "h-4 w-4 text-amber-500" }),
|
|
1413
2295
|
bg: "border-amber-200/70 bg-amber-50/70 dark:border-amber-900/40 dark:bg-amber-950/20",
|
|
1414
2296
|
text: "text-amber-700 dark:text-amber-200",
|
|
1415
2297
|
label: n
|
|
1416
2298
|
},
|
|
1417
2299
|
network: {
|
|
1418
|
-
icon: /* @__PURE__ */ z(
|
|
2300
|
+
icon: /* @__PURE__ */ z(x, { className: "h-4 w-4 animate-spin text-text-secondary" }),
|
|
1419
2301
|
bg: "border-border/70 bg-muted/60",
|
|
1420
2302
|
text: "text-text-secondary",
|
|
1421
2303
|
label: t.message || "网络异常,正在重连…"
|
|
1422
2304
|
},
|
|
1423
2305
|
error: {
|
|
1424
|
-
icon: /* @__PURE__ */ z(
|
|
2306
|
+
icon: /* @__PURE__ */ z(F, { className: "h-4 w-4 text-rose-500" }),
|
|
1425
2307
|
bg: "border-rose-200/70 bg-rose-50/70 dark:border-rose-900/40 dark:bg-rose-950/20",
|
|
1426
2308
|
text: "text-rose-600 dark:text-rose-300",
|
|
1427
2309
|
label: t.message || "运行失败,请重试"
|
|
@@ -1440,14 +2322,14 @@ function _n({ onRetry: e }) {
|
|
|
1440
2322
|
type: "button",
|
|
1441
2323
|
onClick: e,
|
|
1442
2324
|
className: "flex items-center gap-1 rounded-full px-2.5 py-1 text-xs font-medium text-rose-600 transition hover:bg-rose-100 dark:text-rose-300 dark:hover:bg-rose-950/40",
|
|
1443
|
-
children: [/* @__PURE__ */ z(
|
|
2325
|
+
children: [/* @__PURE__ */ z(ae, { className: "h-3 w-3" }), "重试"]
|
|
1444
2326
|
}) : null
|
|
1445
2327
|
]
|
|
1446
2328
|
});
|
|
1447
2329
|
}
|
|
1448
|
-
function
|
|
2330
|
+
function lr({ message: e, retryAfterSec: t }) {
|
|
1449
2331
|
let [n, r] = q(t || 0);
|
|
1450
|
-
return
|
|
2332
|
+
return G(() => {
|
|
1451
2333
|
if (!t) return;
|
|
1452
2334
|
let e = setInterval(() => {
|
|
1453
2335
|
r((e) => e > 0 ? e - 1 : 0);
|
|
@@ -1460,13 +2342,13 @@ function vn({ message: e, retryAfterSec: t }) {
|
|
|
1460
2342
|
function Q(e) {
|
|
1461
2343
|
return String(e || "").trim();
|
|
1462
2344
|
}
|
|
1463
|
-
function
|
|
2345
|
+
function ur(e) {
|
|
1464
2346
|
let t = Q(e).toLowerCase();
|
|
1465
2347
|
return t === "up" || t === "down" ? t : "";
|
|
1466
2348
|
}
|
|
1467
|
-
function
|
|
2349
|
+
function dr(e) {
|
|
1468
2350
|
if (!e || typeof e != "object") return null;
|
|
1469
|
-
let t =
|
|
2351
|
+
let t = ur(e.Rating || e.rating);
|
|
1470
2352
|
return t ? {
|
|
1471
2353
|
agentId: Q(e.AgentId || e.agentId),
|
|
1472
2354
|
sessionId: Q(e.SessionId || e.sessionId),
|
|
@@ -1479,10 +2361,10 @@ function bn(e) {
|
|
|
1479
2361
|
updatedAt: Q(e.UpdatedAt || e.updatedAt)
|
|
1480
2362
|
} : null;
|
|
1481
2363
|
}
|
|
1482
|
-
function
|
|
1483
|
-
return !!(e?.role === "model" && Q(e.responseId) &&
|
|
2364
|
+
function fr(e, t, n) {
|
|
2365
|
+
return !!(e?.role === "model" && Q(e.responseId) && !(t && n));
|
|
1484
2366
|
}
|
|
1485
|
-
function
|
|
2367
|
+
function pr({ agentId: e, sessionId: t, message: n }) {
|
|
1486
2368
|
let r = Q(n?.responseId);
|
|
1487
2369
|
if (!r) throw Error("Message missing response id");
|
|
1488
2370
|
return {
|
|
@@ -1491,26 +2373,23 @@ function Sn({ agentId: e, sessionId: t, message: n }) {
|
|
|
1491
2373
|
ResponseId: r
|
|
1492
2374
|
};
|
|
1493
2375
|
}
|
|
1494
|
-
function
|
|
1495
|
-
let a =
|
|
2376
|
+
function mr({ agentId: e, sessionId: t, message: n, rating: r, comment: i = "" }) {
|
|
2377
|
+
let a = ur(r);
|
|
1496
2378
|
if (!a) throw Error("Feedback rating must be up or down");
|
|
1497
|
-
|
|
1498
|
-
...
|
|
2379
|
+
return {
|
|
2380
|
+
...pr({
|
|
1499
2381
|
agentId: e,
|
|
1500
2382
|
sessionId: t,
|
|
1501
2383
|
message: n
|
|
1502
2384
|
}),
|
|
1503
|
-
EventId: Q(n?.eventId),
|
|
1504
2385
|
Rating: a,
|
|
1505
2386
|
Comment: String(i || ""),
|
|
1506
2387
|
TraceId: Q(n?.traceId),
|
|
1507
2388
|
RootSpanId: Q(n?.rootSpanId)
|
|
1508
2389
|
};
|
|
1509
|
-
if (!o.EventId) throw Error("Message missing event id");
|
|
1510
|
-
return o;
|
|
1511
2390
|
}
|
|
1512
|
-
function
|
|
1513
|
-
let i = e.find((e) => e.id === t), a = i?.feedback ? { ...i.feedback } : null, o =
|
|
2391
|
+
function hr(e, { messageId: t, rating: n, comment: r = "" }) {
|
|
2392
|
+
let i = e.find((e) => e.id === t), a = i?.feedback ? { ...i.feedback } : null, o = ur(n);
|
|
1514
2393
|
return {
|
|
1515
2394
|
nextMessages: e.map((e) => e.id === t ? {
|
|
1516
2395
|
...e,
|
|
@@ -1527,8 +2406,8 @@ function wn(e, { messageId: t, rating: n, comment: r = "" }) {
|
|
|
1527
2406
|
previousFeedback: a
|
|
1528
2407
|
};
|
|
1529
2408
|
}
|
|
1530
|
-
function
|
|
1531
|
-
let r =
|
|
2409
|
+
function gr(e, { messageId: t, feedback: n }) {
|
|
2410
|
+
let r = dr(n) || n;
|
|
1532
2411
|
return e.map((e) => e.id === t ? {
|
|
1533
2412
|
...e,
|
|
1534
2413
|
feedback: r ? {
|
|
@@ -1538,7 +2417,7 @@ function Tn(e, { messageId: t, feedback: n }) {
|
|
|
1538
2417
|
} : void 0
|
|
1539
2418
|
} : e);
|
|
1540
2419
|
}
|
|
1541
|
-
function
|
|
2420
|
+
function _r(e, { messageId: t, previousFeedback: n }) {
|
|
1542
2421
|
return e.map((e) => {
|
|
1543
2422
|
if (e.id !== t) return e;
|
|
1544
2423
|
if (!n) {
|
|
@@ -1551,7 +2430,7 @@ function En(e, { messageId: t, previousFeedback: n }) {
|
|
|
1551
2430
|
};
|
|
1552
2431
|
});
|
|
1553
2432
|
}
|
|
1554
|
-
function
|
|
2433
|
+
function vr(e, { messageId: t }) {
|
|
1555
2434
|
return e.map((e) => {
|
|
1556
2435
|
if (e.id !== t) return e;
|
|
1557
2436
|
let { feedback: n, ...r } = e;
|
|
@@ -1560,10 +2439,10 @@ function Dn(e, { messageId: t }) {
|
|
|
1560
2439
|
}
|
|
1561
2440
|
//#endregion
|
|
1562
2441
|
//#region src/utils/tool-display.js
|
|
1563
|
-
function
|
|
2442
|
+
function yr(e) {
|
|
1564
2443
|
return String(e || "").replace(/\\u([0-9a-fA-F]{4})/g, (e, t) => String.fromCharCode(Number.parseInt(t, 16)));
|
|
1565
2444
|
}
|
|
1566
|
-
function
|
|
2445
|
+
function br(e) {
|
|
1567
2446
|
let t = String(e || "").trim();
|
|
1568
2447
|
for (let e = 0; e < 3; e += 1) {
|
|
1569
2448
|
if (!t) return t;
|
|
@@ -1571,59 +2450,59 @@ function kn(e) {
|
|
|
1571
2450
|
if (!(e === "{" && n === "}" || e === "[" && n === "]" || e === "\"" && n === "\"")) return t.replace(/\\n/g, "\n").replace(/\\"/g, "\"");
|
|
1572
2451
|
try {
|
|
1573
2452
|
let e = JSON.parse(t);
|
|
1574
|
-
if (typeof e != "string") return
|
|
2453
|
+
if (typeof e != "string") return xr(e);
|
|
1575
2454
|
t = e.trim();
|
|
1576
2455
|
} catch {
|
|
1577
|
-
return
|
|
2456
|
+
return yr(t).replace(/\\n/g, "\n").replace(/\\"/g, "\"");
|
|
1578
2457
|
}
|
|
1579
2458
|
}
|
|
1580
2459
|
return t;
|
|
1581
2460
|
}
|
|
1582
|
-
function
|
|
1583
|
-
return typeof e == "string" ?
|
|
2461
|
+
function xr(e) {
|
|
2462
|
+
return typeof e == "string" ? br(e) : Array.isArray(e) ? e.map((e) => xr(e)) : !e || typeof e != "object" ? e : Object.fromEntries(Object.entries(e).map(([e, t]) => [e, xr(t)]));
|
|
1584
2463
|
}
|
|
1585
|
-
function
|
|
1586
|
-
return typeof e == "string" ?
|
|
2464
|
+
function Sr(e) {
|
|
2465
|
+
return typeof e == "string" ? br(e) : xr(e);
|
|
1587
2466
|
}
|
|
1588
|
-
function
|
|
2467
|
+
function Cr(e) {
|
|
1589
2468
|
return e === !1 ? !0 : typeof e == "string" ? e.trim().toLowerCase() === "false" : !1;
|
|
1590
2469
|
}
|
|
1591
|
-
function
|
|
2470
|
+
function wr(e) {
|
|
1592
2471
|
return e === !0 ? !0 : typeof e == "string" ? e.trim().toLowerCase() === "true" : !1;
|
|
1593
2472
|
}
|
|
1594
|
-
function
|
|
2473
|
+
function Tr(e) {
|
|
1595
2474
|
return e == null || e === !1 ? !1 : typeof e == "string" ? e.trim().length > 0 : typeof e == "object" ? Object.keys(e).length > 0 : !0;
|
|
1596
2475
|
}
|
|
1597
|
-
function
|
|
2476
|
+
function Er(e) {
|
|
1598
2477
|
return String(e?.status || "").trim().toLowerCase() === "accepted_not_extracted";
|
|
1599
2478
|
}
|
|
1600
|
-
function
|
|
2479
|
+
function Dr(e, t = 0) {
|
|
1601
2480
|
if (!e || t > 4) return !1;
|
|
1602
2481
|
if (typeof e == "string") {
|
|
1603
|
-
let n =
|
|
1604
|
-
return n !== e &&
|
|
2482
|
+
let n = br(e);
|
|
2483
|
+
return n !== e && Dr(n, t + 1);
|
|
1605
2484
|
}
|
|
1606
|
-
if (Array.isArray(e)) return e.some((e) =>
|
|
1607
|
-
if (typeof e != "object" ||
|
|
1608
|
-
if (
|
|
1609
|
-
let n =
|
|
2485
|
+
if (Array.isArray(e)) return e.some((e) => Dr(e, t + 1));
|
|
2486
|
+
if (typeof e != "object" || Er(e)) return !1;
|
|
2487
|
+
if (Cr(e.ok) || Cr(e.success)) return !0;
|
|
2488
|
+
let n = wr(e.ok) || wr(e.success), r = String(e.status || "").trim().toLowerCase();
|
|
1610
2489
|
return !n && [
|
|
1611
2490
|
"error",
|
|
1612
2491
|
"failed",
|
|
1613
2492
|
"failure"
|
|
1614
|
-
].includes(r) || !n && (
|
|
2493
|
+
].includes(r) || !n && (Tr(e.error_type) || Tr(e.error_message) || Tr(e.error)) ? !0 : Object.values(e).some((e) => Dr(e, t + 1));
|
|
1615
2494
|
}
|
|
1616
|
-
function
|
|
1617
|
-
return e == null || e === "" ? !1 :
|
|
2495
|
+
function Or(e) {
|
|
2496
|
+
return e == null || e === "" ? !1 : Dr(Sr(e));
|
|
1618
2497
|
}
|
|
1619
|
-
function
|
|
2498
|
+
function kr(e) {
|
|
1620
2499
|
if (e == null || e === "") return "";
|
|
1621
|
-
let t =
|
|
2500
|
+
let t = Sr(e);
|
|
1622
2501
|
return typeof t == "string" ? t : JSON.stringify(t, null, 2);
|
|
1623
2502
|
}
|
|
1624
2503
|
//#endregion
|
|
1625
2504
|
//#region src/utils/clipboard.js
|
|
1626
|
-
async function
|
|
2505
|
+
async function Ar(e, t = globalThis) {
|
|
1627
2506
|
let n = String(e ?? ""), r = t?.navigator;
|
|
1628
2507
|
if (r?.clipboard?.writeText) try {
|
|
1629
2508
|
return await r.clipboard.writeText(n), !0;
|
|
@@ -1642,15 +2521,15 @@ async function zn(e, t = globalThis) {
|
|
|
1642
2521
|
}
|
|
1643
2522
|
//#endregion
|
|
1644
2523
|
//#region src/utils/session-helpers.ts
|
|
1645
|
-
function
|
|
2524
|
+
function jr(e) {
|
|
1646
2525
|
return String(e.Title || "").trim() || String(e.FirstPrompt || "").trim() || String(e.LastPrompt || "").trim() || String(e.Summary || "").trim() || "新对话";
|
|
1647
2526
|
}
|
|
1648
2527
|
//#endregion
|
|
1649
2528
|
//#region src/utils/message-virtualization.js
|
|
1650
|
-
function
|
|
2529
|
+
function Mr(e, t, n) {
|
|
1651
2530
|
return Math.max(t, Math.min(n, e));
|
|
1652
2531
|
}
|
|
1653
|
-
function
|
|
2532
|
+
function Nr({ items: e = [], scrollTop: t = 0, viewportHeight: n = 0, overscan: r = 4, defaultItemHeight: i = 120, measuredHeights: a = /* @__PURE__ */ new Map(), getItemKey: o = (e, t) => e?.id || String(t) } = {}) {
|
|
1654
2533
|
let s = Math.max(0, Number(n) || 0), c = Math.max(0, Number(t) || 0), l = Math.max(0, Number(r) || 0), u = Math.max(1, Number(i) || 120);
|
|
1655
2534
|
if (!e.length) return {
|
|
1656
2535
|
startIndex: 0,
|
|
@@ -1668,7 +2547,7 @@ function Hn({ items: e = [], scrollTop: t = 0, viewportHeight: n = 0, overscan:
|
|
|
1668
2547
|
for (; g < e.length && f[g] + d[g] <= c;) g += 1;
|
|
1669
2548
|
let _ = g;
|
|
1670
2549
|
for (; _ < e.length && f[_] < h;) _ += 1;
|
|
1671
|
-
return g =
|
|
2550
|
+
return g = Mr(g - l, 0, e.length), _ = Mr(Math.max(g + 1, _ + l), 0, e.length), {
|
|
1672
2551
|
startIndex: g,
|
|
1673
2552
|
endIndex: _,
|
|
1674
2553
|
offsetTop: f[g] || 0,
|
|
@@ -1685,79 +2564,18 @@ function Hn({ items: e = [], scrollTop: t = 0, viewportHeight: n = 0, overscan:
|
|
|
1685
2564
|
};
|
|
1686
2565
|
}
|
|
1687
2566
|
//#endregion
|
|
1688
|
-
//#region src/core/run/a2ui.ts
|
|
1689
|
-
var Un = Te, Wn = {
|
|
1690
|
-
description: we,
|
|
1691
|
-
value: Ee(Un)
|
|
1692
|
-
};
|
|
1693
|
-
function Gn(e) {
|
|
1694
|
-
return e.map((e) => {
|
|
1695
|
-
let t = e.updateComponents;
|
|
1696
|
-
if (!t || typeof t != "object" || Array.isArray(t)) return e;
|
|
1697
|
-
let n = t.components;
|
|
1698
|
-
if (!Array.isArray(n)) return e;
|
|
1699
|
-
let r = n.filter((e) => !!(e && typeof e == "object" && !Array.isArray(e)));
|
|
1700
|
-
if (r.some((e) => e.id === "root")) return e;
|
|
1701
|
-
let i = r.filter((e) => typeof e.id == "string" && e.id.endsWith("-root"));
|
|
1702
|
-
if (i.length !== 1) return e;
|
|
1703
|
-
let a = i[0];
|
|
1704
|
-
return {
|
|
1705
|
-
...e,
|
|
1706
|
-
updateComponents: {
|
|
1707
|
-
...t,
|
|
1708
|
-
components: n.map((e) => e === a ? {
|
|
1709
|
-
...a,
|
|
1710
|
-
id: "root"
|
|
1711
|
-
} : e)
|
|
1712
|
-
}
|
|
1713
|
-
};
|
|
1714
|
-
});
|
|
1715
|
-
}
|
|
1716
|
-
//#endregion
|
|
1717
|
-
//#region src/components/chat/A2UIActivityMessage.tsx
|
|
1718
|
-
function Kn({ surfaceId: e, messages: t }) {
|
|
1719
|
-
let { processMessages: n } = De();
|
|
1720
|
-
return W(() => {
|
|
1721
|
-
n(t);
|
|
1722
|
-
}, [t, n]), /* @__PURE__ */ z(Ce, {
|
|
1723
|
-
surfaceId: e,
|
|
1724
|
-
className: "w-full",
|
|
1725
|
-
fallback: /* @__PURE__ */ z("div", {
|
|
1726
|
-
className: "text-sm text-slate-500 dark:text-slate-400",
|
|
1727
|
-
children: "界面内容暂不可用"
|
|
1728
|
-
}),
|
|
1729
|
-
loadingFallback: /* @__PURE__ */ z("div", {
|
|
1730
|
-
className: "text-sm text-slate-500 dark:text-slate-400",
|
|
1731
|
-
children: "正在加载界面"
|
|
1732
|
-
})
|
|
1733
|
-
});
|
|
1734
|
-
}
|
|
1735
|
-
function qn({ surfaceId: e, messages: t, onAction: n }) {
|
|
1736
|
-
return /* @__PURE__ */ z("div", {
|
|
1737
|
-
className: "mb-3 w-full overflow-hidden rounded-lg border border-slate-200 bg-white p-3 shadow-sm dark:border-slate-700 dark:bg-slate-900",
|
|
1738
|
-
children: /* @__PURE__ */ z(Se, {
|
|
1739
|
-
catalog: Un,
|
|
1740
|
-
onAction: n,
|
|
1741
|
-
children: /* @__PURE__ */ z(Kn, {
|
|
1742
|
-
surfaceId: e,
|
|
1743
|
-
messages: t
|
|
1744
|
-
})
|
|
1745
|
-
})
|
|
1746
|
-
});
|
|
1747
|
-
}
|
|
1748
|
-
//#endregion
|
|
1749
2567
|
//#region src/components/chat/ChatMessageList.tsx
|
|
1750
|
-
var
|
|
1751
|
-
function
|
|
2568
|
+
var Pr = 140, Fr = 4;
|
|
2569
|
+
function Ir(e) {
|
|
1752
2570
|
let t = String(e || "").trim().toLowerCase();
|
|
1753
2571
|
return t === "elevated" ? "高风险" : t === "always" ? "始终确认" : t === "confirm" ? "需确认" : e || "";
|
|
1754
2572
|
}
|
|
1755
|
-
function
|
|
2573
|
+
function Lr(e) {
|
|
1756
2574
|
return String(e || "").trim().toLowerCase() === "elevated" ? "border-rose-200 bg-rose-50 text-rose-700 dark:border-rose-900/70 dark:bg-rose-950/30 dark:text-rose-200" : "border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-900/70 dark:bg-amber-950/30 dark:text-amber-200";
|
|
1757
2575
|
}
|
|
1758
|
-
function
|
|
2576
|
+
function Rr({ messageId: e, top: t, onMeasure: n, children: r }) {
|
|
1759
2577
|
let i = K(null);
|
|
1760
|
-
return
|
|
2578
|
+
return xe(() => {
|
|
1761
2579
|
let r = i.current;
|
|
1762
2580
|
if (!r) return;
|
|
1763
2581
|
let a = () => n(e, r.offsetHeight, t);
|
|
@@ -1779,18 +2597,18 @@ function Qn({ messageId: e, top: t, onMeasure: n, children: r }) {
|
|
|
1779
2597
|
children: r
|
|
1780
2598
|
});
|
|
1781
2599
|
}
|
|
1782
|
-
function
|
|
2600
|
+
function zr(e) {
|
|
1783
2601
|
let t = Math.max(0, Math.floor(e / 1e3)), n = Math.floor(t / 60), r = t % 60;
|
|
1784
2602
|
return n <= 0 ? `${r}s` : `${n}m ${String(r).padStart(2, "0")}s`;
|
|
1785
2603
|
}
|
|
1786
|
-
function
|
|
2604
|
+
function Br(e) {
|
|
1787
2605
|
return e < 1e3 ? "刚刚" : e < 6e4 ? `${Math.floor(e / 1e3)} 秒前` : `${Math.floor(e / 6e4)} 分钟前`;
|
|
1788
2606
|
}
|
|
1789
|
-
function
|
|
2607
|
+
function Vr(e) {
|
|
1790
2608
|
return !Number.isFinite(e) || !e || e <= 0 ? "" : e >= 1e6 ? `${(e / 1e6).toFixed(e >= 1e7 ? 0 : 1)}M` : e >= 1e3 ? `${(e / 1e3).toFixed(e >= 1e5 ? 0 : 1)}K` : String(Math.round(e));
|
|
1791
2609
|
}
|
|
1792
|
-
function
|
|
1793
|
-
let t = e?.usedTokens, n = e?.contextWindowTokens, r =
|
|
2610
|
+
function Hr({ contextIndicator: e }) {
|
|
2611
|
+
let t = e?.usedTokens, n = e?.contextWindowTokens, r = Vr(t), i = Vr(n);
|
|
1794
2612
|
if (!r) return null;
|
|
1795
2613
|
let a = [r, i].filter(Boolean).join("/");
|
|
1796
2614
|
return /* @__PURE__ */ B("span", {
|
|
@@ -1799,9 +2617,9 @@ function nr({ contextIndicator: e }) {
|
|
|
1799
2617
|
children: ["估算 token ", a]
|
|
1800
2618
|
}, r);
|
|
1801
2619
|
}
|
|
1802
|
-
function
|
|
2620
|
+
function Ur({ activity: e, contextIndicator: t, onStopGeneration: n, onCancelRemote: i }) {
|
|
1803
2621
|
let [a, o] = q(() => Date.now());
|
|
1804
|
-
|
|
2622
|
+
G(() => {
|
|
1805
2623
|
let e = window.setInterval(() => o(Date.now()), 1e3);
|
|
1806
2624
|
return () => window.clearInterval(e);
|
|
1807
2625
|
}, []);
|
|
@@ -1809,7 +2627,7 @@ function rr({ activity: e, contextIndicator: t, onStopGeneration: n, onCancelRem
|
|
|
1809
2627
|
return /* @__PURE__ */ B("div", {
|
|
1810
2628
|
className: "inline-flex max-w-full items-center gap-2 rounded-full border border-slate-200/70 bg-white/90 px-2.5 py-1 text-[11px] leading-4 text-slate-500 shadow-sm shadow-slate-900/5 backdrop-blur dark:border-slate-700/60 dark:bg-slate-900/90 dark:text-slate-400",
|
|
1811
2629
|
children: [
|
|
1812
|
-
e.status === "failed" ? /* @__PURE__ */ z(
|
|
2630
|
+
e.status === "failed" ? /* @__PURE__ */ z(ce, { className: "h-3 w-3 text-rose-500" }) : e.status === "completed" ? /* @__PURE__ */ z(r, { className: "h-3 w-3 text-emerald-500" }) : e.status === "stopped" ? /* @__PURE__ */ z(j, { className: "h-3 w-3 text-amber-500" }) : /* @__PURE__ */ z(k, { className: "h-3 w-3 animate-spin text-slate-400" }),
|
|
1813
2631
|
/* @__PURE__ */ z("span", {
|
|
1814
2632
|
className: "max-w-[16rem] truncate text-slate-600 dark:text-slate-300",
|
|
1815
2633
|
title: e.detail || e.phase,
|
|
@@ -1818,7 +2636,7 @@ function rr({ activity: e, contextIndicator: t, onStopGeneration: n, onCancelRem
|
|
|
1818
2636
|
/* @__PURE__ */ B("span", { children: [
|
|
1819
2637
|
e.source === "restore" ? "恢复" : "运行",
|
|
1820
2638
|
" ",
|
|
1821
|
-
|
|
2639
|
+
zr(a - e.startedAt)
|
|
1822
2640
|
] }),
|
|
1823
2641
|
s ? /* @__PURE__ */ z("span", {
|
|
1824
2642
|
className: Y("inline-block h-1.5 w-1.5 flex-shrink-0 rounded-full", c ? "bg-emerald-400" : "bg-slate-300 dark:bg-slate-600"),
|
|
@@ -1830,29 +2648,29 @@ function rr({ activity: e, contextIndicator: t, onStopGeneration: n, onCancelRem
|
|
|
1830
2648
|
}),
|
|
1831
2649
|
/* @__PURE__ */ z("span", {
|
|
1832
2650
|
className: "hidden text-slate-400 dark:text-slate-500 sm:inline",
|
|
1833
|
-
children:
|
|
2651
|
+
children: Br(a - e.lastEventAt)
|
|
1834
2652
|
}),
|
|
1835
|
-
/* @__PURE__ */ z(
|
|
2653
|
+
/* @__PURE__ */ z(Hr, { contextIndicator: t }),
|
|
1836
2654
|
s && (n || i) ? /* @__PURE__ */ B("div", {
|
|
1837
2655
|
className: "flex flex-shrink-0 gap-1",
|
|
1838
2656
|
children: [n ? /* @__PURE__ */ B("button", {
|
|
1839
2657
|
type: "button",
|
|
1840
2658
|
onClick: n,
|
|
1841
2659
|
className: "flex items-center gap-1 rounded-full px-1.5 py-0.5 text-[11px] text-slate-400 transition hover:bg-slate-100 hover:text-slate-700 dark:text-slate-500 dark:hover:bg-slate-800 dark:hover:text-slate-200",
|
|
1842
|
-
children: [/* @__PURE__ */ z(
|
|
2660
|
+
children: [/* @__PURE__ */ z(ce, { className: "h-3 w-3" }), "停止"]
|
|
1843
2661
|
}) : null, i ? /* @__PURE__ */ B("button", {
|
|
1844
2662
|
type: "button",
|
|
1845
2663
|
"aria-label": "取消运行并保留恢复点",
|
|
1846
2664
|
title: "取消运行并保留最近 checkpoint",
|
|
1847
2665
|
onClick: i,
|
|
1848
2666
|
className: "flex items-center gap-1 rounded-full px-1.5 py-0.5 text-[11px] text-slate-400 transition hover:bg-rose-50 hover:text-rose-600 dark:text-slate-500 dark:hover:bg-rose-950/30 dark:hover:text-rose-300",
|
|
1849
|
-
children: [/* @__PURE__ */ z(
|
|
2667
|
+
children: [/* @__PURE__ */ z(L, { className: "h-3 w-3" }), "取消"]
|
|
1850
2668
|
}) : null]
|
|
1851
2669
|
}) : null
|
|
1852
2670
|
]
|
|
1853
2671
|
});
|
|
1854
2672
|
}
|
|
1855
|
-
function
|
|
2673
|
+
function Wr({ agentName: e }) {
|
|
1856
2674
|
return /* @__PURE__ */ B("div", {
|
|
1857
2675
|
className: "flex flex-col items-center justify-center min-h-[50vh] px-4",
|
|
1858
2676
|
children: [
|
|
@@ -1875,7 +2693,7 @@ function ir({ agentName: e }) {
|
|
|
1875
2693
|
]
|
|
1876
2694
|
});
|
|
1877
2695
|
}
|
|
1878
|
-
function
|
|
2696
|
+
function Gr() {
|
|
1879
2697
|
return /* @__PURE__ */ B("div", {
|
|
1880
2698
|
className: "mx-auto flex w-full max-w-[44rem] flex-col gap-5 px-2 py-8",
|
|
1881
2699
|
"aria-label": "正在加载会话历史",
|
|
@@ -1887,7 +2705,7 @@ function ar() {
|
|
|
1887
2705
|
]
|
|
1888
2706
|
});
|
|
1889
2707
|
}
|
|
1890
|
-
function
|
|
2708
|
+
function Kr({ attachments: e, isMobile: t, onOpenAttachmentPreview: n }) {
|
|
1891
2709
|
return /* @__PURE__ */ z("div", {
|
|
1892
2710
|
className: "mb-3 flex flex-wrap gap-3",
|
|
1893
2711
|
children: e.map((e, r) => e.type.startsWith("image/") ? e.url ? /* @__PURE__ */ z("button", {
|
|
@@ -1904,7 +2722,7 @@ function or({ attachments: e, isMobile: t, onOpenAttachmentPreview: n }) {
|
|
|
1904
2722
|
children: e.name
|
|
1905
2723
|
}, `${e.name}-${r}`) : /* @__PURE__ */ B("div", {
|
|
1906
2724
|
className: Y("flex items-center gap-2 rounded-xl border border-slate-200 bg-slate-100 px-3 py-2 shadow-sm dark:border-slate-700 dark:bg-slate-800", t ? "w-full max-w-full" : "w-max max-w-full"),
|
|
1907
|
-
children: [/* @__PURE__ */ z(
|
|
2725
|
+
children: [/* @__PURE__ */ z(ne, { className: "h-4 w-4 flex-shrink-0 text-blue-500" }), e.url ? /* @__PURE__ */ z("a", {
|
|
1908
2726
|
href: e.url,
|
|
1909
2727
|
target: "_blank",
|
|
1910
2728
|
rel: "noreferrer",
|
|
@@ -1919,7 +2737,7 @@ function or({ attachments: e, isMobile: t, onOpenAttachmentPreview: n }) {
|
|
|
1919
2737
|
}, `${e.name}-${r}`))
|
|
1920
2738
|
});
|
|
1921
2739
|
}
|
|
1922
|
-
function
|
|
2740
|
+
function qr({ message: e }) {
|
|
1923
2741
|
return /* @__PURE__ */ z("div", {
|
|
1924
2742
|
className: "w-full px-0 py-2 sm:px-4",
|
|
1925
2743
|
children: /* @__PURE__ */ B("div", {
|
|
@@ -1927,7 +2745,7 @@ function sr({ message: e }) {
|
|
|
1927
2745
|
children: [
|
|
1928
2746
|
/* @__PURE__ */ B("div", {
|
|
1929
2747
|
className: "flex items-center gap-2 font-medium",
|
|
1930
|
-
children: [e.status === "running" ? /* @__PURE__ */ z(
|
|
2748
|
+
children: [e.status === "running" ? /* @__PURE__ */ z(k, { className: "h-4 w-4 animate-spin text-amber-600 dark:text-amber-300" }) : e.status === "failed" ? /* @__PURE__ */ z(ce, { className: "h-4 w-4 text-rose-600 dark:text-rose-400" }) : /* @__PURE__ */ z(r, { className: "h-4 w-4 text-emerald-600 dark:text-emerald-400" }), /* @__PURE__ */ z("span", { children: e.content })]
|
|
1931
2749
|
}),
|
|
1932
2750
|
e.compactedUntilSeqId ? /* @__PURE__ */ B("div", {
|
|
1933
2751
|
className: "mt-1 text-xs text-amber-700/80 dark:text-amber-200/80",
|
|
@@ -1947,15 +2765,15 @@ function sr({ message: e }) {
|
|
|
1947
2765
|
})
|
|
1948
2766
|
});
|
|
1949
2767
|
}
|
|
1950
|
-
function
|
|
1951
|
-
let [i, a] = q("idle"),
|
|
1952
|
-
|
|
2768
|
+
function Jr({ label: e, tone: t, value: n }) {
|
|
2769
|
+
let [i, a] = q("idle"), o = kr(n);
|
|
2770
|
+
G(() => {
|
|
1953
2771
|
if (i === "idle") return;
|
|
1954
2772
|
let e = window.setTimeout(() => a("idle"), 1600);
|
|
1955
2773
|
return () => window.clearTimeout(e);
|
|
1956
2774
|
}, [i]);
|
|
1957
|
-
let
|
|
1958
|
-
a(await
|
|
2775
|
+
let s = async () => {
|
|
2776
|
+
a(await Ar(o) ? "copied" : "failed");
|
|
1959
2777
|
};
|
|
1960
2778
|
return /* @__PURE__ */ B("div", { children: [/* @__PURE__ */ B("div", {
|
|
1961
2779
|
className: "mb-1 flex items-center justify-between gap-2",
|
|
@@ -1965,20 +2783,20 @@ function cr({ label: e, tone: t, value: n }) {
|
|
|
1965
2783
|
}), /* @__PURE__ */ B("button", {
|
|
1966
2784
|
type: "button",
|
|
1967
2785
|
onClick: () => {
|
|
1968
|
-
|
|
2786
|
+
s();
|
|
1969
2787
|
},
|
|
1970
2788
|
className: "inline-flex items-center gap-1 rounded-lg px-2 py-1 text-[11px] font-medium text-slate-500 transition hover:bg-white hover:text-slate-900 dark:text-slate-400 dark:hover:bg-slate-900 dark:hover:text-slate-100",
|
|
1971
|
-
children: [i === "copied" ? /* @__PURE__ */ z(r, { className: "h-3.5 w-3.5 text-emerald-500" }) : /* @__PURE__ */ z(
|
|
2789
|
+
children: [i === "copied" ? /* @__PURE__ */ z(r, { className: "h-3.5 w-3.5 text-emerald-500" }) : /* @__PURE__ */ z(c, { className: "h-3.5 w-3.5" }), i === "copied" ? "已复制" : i === "failed" ? "复制失败" : "复制"]
|
|
1972
2790
|
})]
|
|
1973
2791
|
}), /* @__PURE__ */ z("div", {
|
|
1974
2792
|
className: "custom-scrollbar max-h-[220px] overflow-y-auto whitespace-pre-wrap break-words rounded-xl border border-slate-200/30 bg-white/70 p-3 text-slate-600 shadow-sm dark:border-slate-800 dark:bg-slate-950/40 dark:text-slate-300 sm:max-h-[300px]",
|
|
1975
|
-
children:
|
|
2793
|
+
children: o
|
|
1976
2794
|
})] });
|
|
1977
2795
|
}
|
|
1978
|
-
function
|
|
1979
|
-
let [a,
|
|
2796
|
+
function Yr({ isLastMessage: e, isStreaming: t, message: n, onDeleteFeedback: r, onSubmitFeedback: i }) {
|
|
2797
|
+
let [a, o] = q(!1), [s, l] = q(n.feedback?.comment || ""), u = fr(n, t, e), d = !!n.feedback?.pending, f = n.feedback?.rating, p = async () => {
|
|
1980
2798
|
let e = n.content || "";
|
|
1981
|
-
e &&
|
|
2799
|
+
e && Ar(e);
|
|
1982
2800
|
};
|
|
1983
2801
|
return u ? /* @__PURE__ */ B("div", {
|
|
1984
2802
|
className: "mt-2 flex flex-col gap-2 opacity-0 transition-opacity duration-150 group-hover:opacity-100 focus-within:opacity-100",
|
|
@@ -1993,7 +2811,7 @@ function lr({ isLastMessage: e, isStreaming: t, message: n, onDeleteFeedback: r,
|
|
|
1993
2811
|
},
|
|
1994
2812
|
className: "inline-flex items-center gap-1 rounded-full px-2 py-1 font-medium text-text-secondary transition hover:bg-muted hover:text-text-primary",
|
|
1995
2813
|
title: "复制",
|
|
1996
|
-
children: /* @__PURE__ */ z(
|
|
2814
|
+
children: /* @__PURE__ */ z(c, { className: "h-3.5 w-3.5" })
|
|
1997
2815
|
}),
|
|
1998
2816
|
/* @__PURE__ */ z("span", {
|
|
1999
2817
|
className: "text-text-muted/60",
|
|
@@ -2012,23 +2830,23 @@ function lr({ isLastMessage: e, isStreaming: t, message: n, onDeleteFeedback: r,
|
|
|
2012
2830
|
comment: ""
|
|
2013
2831
|
}),
|
|
2014
2832
|
className: Y("inline-flex items-center gap-1 rounded-full border px-2.5 py-1 font-medium transition disabled:cursor-not-allowed disabled:opacity-60", f === "up" ? "border-primary/30 bg-primary/10 text-primary" : "border-border bg-background text-text-secondary hover:border-primary/30 hover:text-primary"),
|
|
2015
|
-
children: [/* @__PURE__ */ z(
|
|
2833
|
+
children: [/* @__PURE__ */ z(de, { className: "h-3.5 w-3.5" }), "有帮助"]
|
|
2016
2834
|
}),
|
|
2017
2835
|
/* @__PURE__ */ B("button", {
|
|
2018
2836
|
type: "button",
|
|
2019
2837
|
disabled: d,
|
|
2020
2838
|
onClick: () => {
|
|
2021
|
-
l(n.feedback?.comment || ""),
|
|
2839
|
+
l(n.feedback?.comment || ""), o((e) => !e);
|
|
2022
2840
|
},
|
|
2023
2841
|
className: Y("inline-flex items-center gap-1 rounded-full border px-2.5 py-1 font-medium transition disabled:cursor-not-allowed disabled:opacity-60", f === "down" ? "border-rose-300 bg-rose-50 text-rose-600 dark:border-rose-900/70 dark:bg-rose-950/30 dark:text-rose-300" : "border-border bg-background text-text-secondary hover:border-rose-300 hover:text-rose-600"),
|
|
2024
|
-
children: [/* @__PURE__ */ z(
|
|
2842
|
+
children: [/* @__PURE__ */ z(ue, { className: "h-3.5 w-3.5" }), "需改进"]
|
|
2025
2843
|
}),
|
|
2026
2844
|
n.feedback ? /* @__PURE__ */ B("button", {
|
|
2027
2845
|
type: "button",
|
|
2028
2846
|
disabled: d,
|
|
2029
2847
|
onClick: () => r(n),
|
|
2030
2848
|
className: "inline-flex items-center gap-1 rounded-full border border-transparent px-2 py-1 font-medium text-slate-400 transition hover:border-slate-200 hover:text-slate-700 disabled:cursor-not-allowed disabled:opacity-60 dark:hover:border-slate-800 dark:hover:text-slate-200",
|
|
2031
|
-
children: [/* @__PURE__ */ z(
|
|
2849
|
+
children: [/* @__PURE__ */ z(fe, { className: "h-3.5 w-3.5" }), "删除反馈"]
|
|
2032
2850
|
}) : null,
|
|
2033
2851
|
d ? /* @__PURE__ */ z("span", {
|
|
2034
2852
|
className: "text-slate-400",
|
|
@@ -2039,7 +2857,7 @@ function lr({ isLastMessage: e, isStreaming: t, message: n, onDeleteFeedback: r,
|
|
|
2039
2857
|
a ? /* @__PURE__ */ B("div", {
|
|
2040
2858
|
className: "max-w-xl rounded-2xl border border-rose-100 bg-rose-50/60 p-3 shadow-sm dark:border-rose-900/60 dark:bg-rose-950/20",
|
|
2041
2859
|
children: [/* @__PURE__ */ z("textarea", {
|
|
2042
|
-
value:
|
|
2860
|
+
value: s,
|
|
2043
2861
|
onChange: (e) => l(e.target.value),
|
|
2044
2862
|
placeholder: "可以补充哪里不准确、缺失或不符合预期。",
|
|
2045
2863
|
className: "min-h-[84px] w-full resize-y rounded-xl border border-rose-100 bg-white px-3 py-2 text-sm text-slate-700 outline-none transition placeholder:text-slate-400 focus:border-rose-300 focus:ring-2 focus:ring-rose-100 dark:border-rose-900/70 dark:bg-slate-950 dark:text-slate-100 dark:focus:border-rose-700 dark:focus:ring-rose-950"
|
|
@@ -2047,7 +2865,7 @@ function lr({ isLastMessage: e, isStreaming: t, message: n, onDeleteFeedback: r,
|
|
|
2047
2865
|
className: "mt-2 flex flex-wrap justify-end gap-2",
|
|
2048
2866
|
children: [/* @__PURE__ */ z("button", {
|
|
2049
2867
|
type: "button",
|
|
2050
|
-
onClick: () =>
|
|
2868
|
+
onClick: () => o(!1),
|
|
2051
2869
|
className: "rounded-xl px-3 py-1.5 text-xs font-semibold text-slate-500 transition hover:bg-white hover:text-slate-800 dark:text-slate-400 dark:hover:bg-slate-950 dark:hover:text-slate-100",
|
|
2052
2870
|
children: "取消"
|
|
2053
2871
|
}), /* @__PURE__ */ z("button", {
|
|
@@ -2057,8 +2875,8 @@ function lr({ isLastMessage: e, isStreaming: t, message: n, onDeleteFeedback: r,
|
|
|
2057
2875
|
i({
|
|
2058
2876
|
message: n,
|
|
2059
2877
|
rating: "down",
|
|
2060
|
-
comment:
|
|
2061
|
-
}),
|
|
2878
|
+
comment: s
|
|
2879
|
+
}), o(!1);
|
|
2062
2880
|
},
|
|
2063
2881
|
className: "rounded-xl bg-rose-600 px-3 py-1.5 text-xs font-semibold text-white shadow-sm transition hover:bg-rose-500 disabled:cursor-not-allowed disabled:opacity-60",
|
|
2064
2882
|
children: "提交点踩"
|
|
@@ -2075,18 +2893,18 @@ function lr({ isLastMessage: e, isStreaming: t, message: n, onDeleteFeedback: r,
|
|
|
2075
2893
|
]
|
|
2076
2894
|
}) : null;
|
|
2077
2895
|
}
|
|
2078
|
-
function
|
|
2896
|
+
function Xr({ agentName: e, isMobile: t, isStreaming: a, isLastMessage: o, message: s, onDeleteFeedback: c, onOpenAttachmentPreview: l, onRespondToApproval: u, onRespondToAguiApproval: d, onSubmitFeedback: f, onSubmitAguiAction: p, interactionRecords: m }) {
|
|
2079
2897
|
return s.role === "user" ? /* @__PURE__ */ z("div", {
|
|
2080
2898
|
className: "mb-3 flex justify-end",
|
|
2081
2899
|
children: /* @__PURE__ */ B("div", {
|
|
2082
2900
|
className: "max-w-[80%] rounded-2xl bg-muted px-3 py-2 text-[14px] leading-relaxed text-foreground",
|
|
2083
|
-
children: [s.attachments?.length ? /* @__PURE__ */ z(
|
|
2901
|
+
children: [s.attachments?.length ? /* @__PURE__ */ z(Kr, {
|
|
2084
2902
|
attachments: s.attachments,
|
|
2085
2903
|
isMobile: t,
|
|
2086
2904
|
onOpenAttachmentPreview: l
|
|
2087
2905
|
}) : null, s.content]
|
|
2088
2906
|
})
|
|
2089
|
-
}) : s.role === "a2ui" && s.aguiActivity ? /* @__PURE__ */ z(
|
|
2907
|
+
}) : s.role === "a2ui" && s.aguiActivity ? /* @__PURE__ */ z(On, {
|
|
2090
2908
|
surfaceId: s.aguiActivity.surfaceId,
|
|
2091
2909
|
messages: s.aguiActivity.messages,
|
|
2092
2910
|
onAction: p
|
|
@@ -2097,15 +2915,16 @@ function ur({ agentName: e, isMobile: t, isStreaming: a, isLastMessage: o, messa
|
|
|
2097
2915
|
className: "mb-1.5 flex items-center gap-2 text-xs text-text-muted",
|
|
2098
2916
|
children: [/* @__PURE__ */ z(n, { className: "w-3.5 h-3.5" }), /* @__PURE__ */ z("span", { children: e })]
|
|
2099
2917
|
}),
|
|
2100
|
-
s.attachments?.length ? /* @__PURE__ */ z(
|
|
2918
|
+
s.attachments?.length ? /* @__PURE__ */ z(Kr, {
|
|
2101
2919
|
attachments: s.attachments,
|
|
2102
2920
|
isMobile: t,
|
|
2103
2921
|
onOpenAttachmentPreview: l
|
|
2104
2922
|
}) : null,
|
|
2105
|
-
s.blocks?.length ? /* @__PURE__ */ z(
|
|
2923
|
+
s.blocks?.length ? /* @__PURE__ */ z(Jn, {
|
|
2106
2924
|
message: s,
|
|
2107
2925
|
isStreaming: a,
|
|
2108
2926
|
onRespondToApproval: u,
|
|
2927
|
+
interactionRecords: m,
|
|
2109
2928
|
onRespondToAguiApproval: d
|
|
2110
2929
|
}) : /* @__PURE__ */ B(R, { children: [
|
|
2111
2930
|
s.reasoning ? /* @__PURE__ */ B("details", {
|
|
@@ -2115,7 +2934,7 @@ function ur({ agentName: e, isMobile: t, isStreaming: a, isLastMessage: o, messa
|
|
|
2115
2934
|
children: [/* @__PURE__ */ B("div", {
|
|
2116
2935
|
className: "flex min-w-0 items-center gap-2",
|
|
2117
2936
|
children: [
|
|
2118
|
-
a && o && !s.content ? /* @__PURE__ */ z(
|
|
2937
|
+
a && o && !s.content ? /* @__PURE__ */ z(k, { className: "h-4 w-4 animate-spin text-slate-500" }) : /* @__PURE__ */ z(r, { className: "h-4 w-4 text-slate-400" }),
|
|
2119
2938
|
/* @__PURE__ */ z("span", {
|
|
2120
2939
|
className: "truncate",
|
|
2121
2940
|
children: "思考过程"
|
|
@@ -2141,7 +2960,7 @@ function ur({ agentName: e, isMobile: t, isStreaming: a, isLastMessage: o, messa
|
|
|
2141
2960
|
className: "flex cursor-pointer list-none items-center justify-between gap-2 px-3 py-2 font-medium",
|
|
2142
2961
|
children: /* @__PURE__ */ B("div", {
|
|
2143
2962
|
className: "flex items-center gap-2",
|
|
2144
|
-
children: [e.status === "running" ? /* @__PURE__ */ z(
|
|
2963
|
+
children: [e.status === "running" ? /* @__PURE__ */ z(k, { className: "h-4 w-4 animate-spin text-slate-500" }) : e.status === "paused" ? /* @__PURE__ */ z(j, { className: "h-4 w-4 text-amber-500" }) : e.status === "error" ? /* @__PURE__ */ z(L, { className: "h-4 w-4 text-rose-500" }) : /* @__PURE__ */ z(r, { className: "h-4 w-4 text-slate-400" }), /* @__PURE__ */ B("span", { children: [e.approvalStatus === "pending" ? "等待审批:" : e.approvalStatus === "approved" ? "已批准:" : e.approvalStatus === "rejected" ? "已拒绝:" : e.status === "error" ? "工具调用失败:" : "工具调用:", e.name] })]
|
|
2145
2964
|
})
|
|
2146
2965
|
}), /* @__PURE__ */ B("div", {
|
|
2147
2966
|
className: Y("flex flex-col gap-3 border-t px-3 py-3 font-mono text-[13px] leading-relaxed", e.status === "paused" ? "border-amber-200/70 dark:border-amber-900/60" : e.status === "error" ? "border-rose-200/70 dark:border-rose-900/60" : "border-slate-200/70 dark:border-slate-800"),
|
|
@@ -2154,8 +2973,8 @@ function ur({ agentName: e, isMobile: t, isStreaming: a, isLastMessage: o, messa
|
|
|
2154
2973
|
children: e.approvalStatus === "approved" ? "已批准该工具调用。" : e.approvalStatus === "rejected" ? "已拒绝该工具调用。" : e.approvalMessage || "该工具调用需要人工确认后继续。"
|
|
2155
2974
|
}),
|
|
2156
2975
|
e.approvalLevel ? /* @__PURE__ */ B("div", {
|
|
2157
|
-
className: Y("mt-2 inline-flex items-center rounded border px-1.5 py-0.5 text-xs font-medium",
|
|
2158
|
-
children: ["审批级别:",
|
|
2976
|
+
className: Y("mt-2 inline-flex items-center rounded border px-1.5 py-0.5 text-xs font-medium", Lr(e.approvalLevel)),
|
|
2977
|
+
children: ["审批级别:", Ir(e.approvalLevel)]
|
|
2159
2978
|
}) : null,
|
|
2160
2979
|
e.serverLabel ? /* @__PURE__ */ B("div", {
|
|
2161
2980
|
className: "mt-1 text-xs text-amber-700/80 dark:text-amber-200/80",
|
|
@@ -2188,20 +3007,20 @@ function ur({ agentName: e, isMobile: t, isStreaming: a, isLastMessage: o, messa
|
|
|
2188
3007
|
previousResponseId: e.previousResponseId
|
|
2189
3008
|
}),
|
|
2190
3009
|
className: "inline-flex min-h-8 items-center gap-1.5 rounded-md border border-slate-300 bg-white px-3 py-1.5 text-xs font-semibold text-slate-600 transition hover:border-rose-300 hover:bg-rose-50 hover:text-rose-600 disabled:cursor-not-allowed disabled:opacity-55 dark:border-slate-700 dark:bg-slate-950 dark:text-slate-300 dark:hover:border-rose-800 dark:hover:bg-rose-950/30 dark:hover:text-rose-300",
|
|
2191
|
-
children: [/* @__PURE__ */ z(
|
|
3010
|
+
children: [/* @__PURE__ */ z(L, { className: "h-3.5 w-3.5" }), "拒绝"]
|
|
2192
3011
|
})]
|
|
2193
3012
|
}) : /* @__PURE__ */ B("div", {
|
|
2194
3013
|
className: "mt-2 inline-flex items-center gap-1.5 text-xs font-medium text-slate-500 dark:text-slate-400",
|
|
2195
|
-
children: [e.approvalStatus === "approved" ? /* @__PURE__ */ z(r, { className: "h-3.5 w-3.5 text-emerald-500" }) : /* @__PURE__ */ z(
|
|
3014
|
+
children: [e.approvalStatus === "approved" ? /* @__PURE__ */ z(r, { className: "h-3.5 w-3.5 text-emerald-500" }) : /* @__PURE__ */ z(L, { className: "h-3.5 w-3.5 text-rose-500" }), e.approvalStatus === "approved" ? "已批准" : "已拒绝"]
|
|
2196
3015
|
})
|
|
2197
3016
|
]
|
|
2198
3017
|
}) : null,
|
|
2199
|
-
e.args ? /* @__PURE__ */ z(
|
|
3018
|
+
e.args ? /* @__PURE__ */ z(Jr, {
|
|
2200
3019
|
label: "入参 (Args)",
|
|
2201
3020
|
tone: "input",
|
|
2202
3021
|
value: e.args
|
|
2203
3022
|
}) : null,
|
|
2204
|
-
e.output ? /* @__PURE__ */ z(
|
|
3023
|
+
e.output ? /* @__PURE__ */ z(Jr, {
|
|
2205
3024
|
label: "输出 (Output)",
|
|
2206
3025
|
tone: e.status === "error" ? "error" : "output",
|
|
2207
3026
|
value: e.output
|
|
@@ -2209,17 +3028,18 @@ function ur({ agentName: e, isMobile: t, isStreaming: a, isLastMessage: o, messa
|
|
|
2209
3028
|
]
|
|
2210
3029
|
})]
|
|
2211
3030
|
}, `${e.name}-${t}`)) : null,
|
|
3031
|
+
s.tools ? Object.values(s.tools).filter((e) => m?.some((t) => t.interactionId === e.approvalRequestId)).map((e) => /* @__PURE__ */ z(Rn, { interaction: m.find((t) => t.interactionId === e.approvalRequestId) }, `anchor-${e.approvalRequestId}`)) : null,
|
|
2212
3032
|
/* @__PURE__ */ z("div", {
|
|
2213
3033
|
className: "w-full break-words",
|
|
2214
3034
|
children: s.content ? /* @__PURE__ */ z(Z, { content: s.content }) : a && o && !s.reasoning && !s.tools ? /* @__PURE__ */ z("span", { className: "ml-1 mt-2 inline-block h-4 w-2 animate-pulse rounded-sm bg-emerald-500 align-middle opacity-80 shadow-sm" }) : null
|
|
2215
3035
|
})
|
|
2216
3036
|
] }),
|
|
2217
|
-
s.aguiActivities?.map((e) => /* @__PURE__ */ z(
|
|
3037
|
+
s.aguiActivities?.map((e) => /* @__PURE__ */ z(On, {
|
|
2218
3038
|
surfaceId: e.surfaceId,
|
|
2219
3039
|
messages: e.messages,
|
|
2220
3040
|
onAction: p
|
|
2221
3041
|
}, e.surfaceId)),
|
|
2222
|
-
/* @__PURE__ */ z(
|
|
3042
|
+
/* @__PURE__ */ z(Yr, {
|
|
2223
3043
|
isLastMessage: o,
|
|
2224
3044
|
isStreaming: a,
|
|
2225
3045
|
message: s,
|
|
@@ -2229,55 +3049,55 @@ function ur({ agentName: e, isMobile: t, isStreaming: a, isLastMessage: o, messa
|
|
|
2229
3049
|
]
|
|
2230
3050
|
});
|
|
2231
3051
|
}
|
|
2232
|
-
function
|
|
2233
|
-
let [
|
|
2234
|
-
|
|
2235
|
-
let e =
|
|
3052
|
+
function Zr({ agentName: t, isMobile: n, isStreaming: r, activity: i, contextIndicator: a, messages: o, isLoadingInitialHistory: s = !1, onDeleteFeedback: c, onOpenAttachmentPreview: l, onRespondToApproval: u, onRespondToAguiApproval: d, onSubmitFeedback: f, onSubmitAguiAction: p, onStopGeneration: m, onCancelRemote: h, checkpoints: g = [], onResumeCheckpoint: _, interactionRecords: v, scrollRef: y }) {
|
|
3053
|
+
let [b, x] = q(0), [S, C] = q(0), [w, ee] = q(/* @__PURE__ */ new Map()), T = K(w);
|
|
3054
|
+
xe(() => {
|
|
3055
|
+
let e = y.current;
|
|
2236
3056
|
if (!e) return;
|
|
2237
3057
|
let t = () => {
|
|
2238
|
-
|
|
3058
|
+
x(e.scrollTop), C(e.clientHeight);
|
|
2239
3059
|
};
|
|
2240
3060
|
if (t(), typeof ResizeObserver > "u") return;
|
|
2241
3061
|
let n = new ResizeObserver(() => t());
|
|
2242
3062
|
return n.observe(e), () => n.disconnect();
|
|
2243
|
-
}, [
|
|
2244
|
-
let
|
|
3063
|
+
}, [y]);
|
|
3064
|
+
let E = Se(() => Nr({
|
|
2245
3065
|
items: o,
|
|
2246
|
-
scrollTop:
|
|
2247
|
-
viewportHeight:
|
|
2248
|
-
overscan:
|
|
2249
|
-
defaultItemHeight:
|
|
2250
|
-
measuredHeights:
|
|
3066
|
+
scrollTop: b,
|
|
3067
|
+
viewportHeight: S,
|
|
3068
|
+
overscan: Fr,
|
|
3069
|
+
defaultItemHeight: Pr,
|
|
3070
|
+
measuredHeights: w,
|
|
2251
3071
|
getItemKey: (e, t) => e?.id || String(t)
|
|
2252
3072
|
}), [
|
|
2253
|
-
|
|
3073
|
+
w,
|
|
2254
3074
|
o,
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
]),
|
|
3075
|
+
b,
|
|
3076
|
+
S
|
|
3077
|
+
]), te = E.visibleItems, D = W((e, t, n) => {
|
|
2258
3078
|
if (!e || !Number.isFinite(t) || t <= 0) return;
|
|
2259
|
-
let r =
|
|
3079
|
+
let r = T.current, i = r.get(e) ?? Pr;
|
|
2260
3080
|
if (i === t) return;
|
|
2261
3081
|
let a = new Map(r);
|
|
2262
|
-
a.set(e, t),
|
|
2263
|
-
let o =
|
|
2264
|
-
o && n < o.scrollTop && (o.scrollTop += t - i,
|
|
2265
|
-
}, [
|
|
3082
|
+
a.set(e, t), T.current = a, ee(a);
|
|
3083
|
+
let o = y.current;
|
|
3084
|
+
o && n < o.scrollTop && (o.scrollTop += t - i, x(o.scrollTop));
|
|
3085
|
+
}, [y]);
|
|
2266
3086
|
return /* @__PURE__ */ B("div", {
|
|
2267
|
-
ref:
|
|
2268
|
-
onScroll: (e) =>
|
|
3087
|
+
ref: y,
|
|
3088
|
+
onScroll: (e) => x(e.currentTarget.scrollTop),
|
|
2269
3089
|
className: Y("custom-scrollbar relative min-h-0 flex-1 overflow-y-auto scroll-smooth", n ? "px-3 py-3" : "px-4 py-5"),
|
|
2270
3090
|
children: [
|
|
2271
3091
|
/* @__PURE__ */ z("div", {
|
|
2272
3092
|
className: Y("mx-auto flex w-full max-w-[64rem] flex-col", i ? "pb-10 sm:pb-10" : "pb-6 sm:pb-8"),
|
|
2273
|
-
children: o.length === 0 && s ? /* @__PURE__ */ z(
|
|
2274
|
-
style: { height:
|
|
3093
|
+
children: o.length === 0 && s ? /* @__PURE__ */ z(Gr, {}) : o.length === 0 ? /* @__PURE__ */ z(Wr, { agentName: t }) : /* @__PURE__ */ z("div", {
|
|
3094
|
+
style: { height: E.totalHeight },
|
|
2275
3095
|
className: "relative",
|
|
2276
|
-
children:
|
|
3096
|
+
children: te.map((e) => /* @__PURE__ */ z(Rr, {
|
|
2277
3097
|
messageId: e.item.id || String(e.index),
|
|
2278
3098
|
top: e.top,
|
|
2279
3099
|
onMeasure: D,
|
|
2280
|
-
children: e.item.role === "system" ? /* @__PURE__ */ z(
|
|
3100
|
+
children: e.item.role === "system" ? /* @__PURE__ */ z(qr, { message: e.item }) : /* @__PURE__ */ z(Xr, {
|
|
2281
3101
|
agentName: t,
|
|
2282
3102
|
isMobile: n,
|
|
2283
3103
|
isStreaming: r,
|
|
@@ -2286,6 +3106,7 @@ function dr({ agentName: t, isMobile: n, isStreaming: r, activity: i, contextInd
|
|
|
2286
3106
|
onDeleteFeedback: c,
|
|
2287
3107
|
onOpenAttachmentPreview: l,
|
|
2288
3108
|
onRespondToApproval: u,
|
|
3109
|
+
interactionRecords: v,
|
|
2289
3110
|
onRespondToAguiApproval: d,
|
|
2290
3111
|
onSubmitFeedback: f,
|
|
2291
3112
|
onSubmitAguiAction: p
|
|
@@ -2293,11 +3114,11 @@ function dr({ agentName: t, isMobile: n, isStreaming: r, activity: i, contextInd
|
|
|
2293
3114
|
}, e.item.id || e.index))
|
|
2294
3115
|
})
|
|
2295
3116
|
}),
|
|
2296
|
-
/* @__PURE__ */ z(
|
|
2297
|
-
|
|
3117
|
+
/* @__PURE__ */ z(cr, {}),
|
|
3118
|
+
b > 320 ? /* @__PURE__ */ z("button", {
|
|
2298
3119
|
type: "button",
|
|
2299
3120
|
onClick: () => {
|
|
2300
|
-
let e =
|
|
3121
|
+
let e = y.current;
|
|
2301
3122
|
e && e.scrollTo({
|
|
2302
3123
|
top: e.scrollHeight,
|
|
2303
3124
|
behavior: "smooth"
|
|
@@ -2309,7 +3130,7 @@ function dr({ agentName: t, isMobile: n, isStreaming: r, activity: i, contextInd
|
|
|
2309
3130
|
}) : null,
|
|
2310
3131
|
i ? /* @__PURE__ */ z("div", {
|
|
2311
3132
|
className: "sticky bottom-1 z-20 mx-auto flex w-full max-w-[64rem] justify-end",
|
|
2312
|
-
children: /* @__PURE__ */ z(
|
|
3133
|
+
children: /* @__PURE__ */ z(Ur, {
|
|
2313
3134
|
activity: i,
|
|
2314
3135
|
contextIndicator: a,
|
|
2315
3136
|
onStopGeneration: m,
|
|
@@ -2321,13 +3142,26 @@ function dr({ agentName: t, isMobile: n, isStreaming: r, activity: i, contextInd
|
|
|
2321
3142
|
}
|
|
2322
3143
|
//#endregion
|
|
2323
3144
|
//#region src/utils/session-list.js
|
|
2324
|
-
var
|
|
3145
|
+
var Qr = new Set([
|
|
2325
3146
|
"in_progress",
|
|
2326
3147
|
"running",
|
|
3148
|
+
"resuming",
|
|
3149
|
+
"starting",
|
|
3150
|
+
"streaming",
|
|
2327
3151
|
"queued",
|
|
2328
|
-
"pending"
|
|
2329
|
-
|
|
2330
|
-
|
|
3152
|
+
"pending",
|
|
3153
|
+
"accepted"
|
|
3154
|
+
]), $r = new Set([
|
|
3155
|
+
"failed",
|
|
3156
|
+
"error",
|
|
3157
|
+
"resume_failed",
|
|
3158
|
+
"interrupted",
|
|
3159
|
+
"cancelled",
|
|
3160
|
+
"canceled",
|
|
3161
|
+
"aborted",
|
|
3162
|
+
"expired"
|
|
3163
|
+
]), ei = 300 * 1e3;
|
|
3164
|
+
function ti(e) {
|
|
2331
3165
|
let t = e?.UpdatedAt ?? e?.updated_at;
|
|
2332
3166
|
if (typeof t == "string") {
|
|
2333
3167
|
let e = Date.parse(t);
|
|
@@ -2335,10 +3169,10 @@ function mr(e) {
|
|
|
2335
3169
|
}
|
|
2336
3170
|
return typeof t == "number" && Number.isFinite(t) ? t > 1e11 ? t : t * 1e3 : 0;
|
|
2337
3171
|
}
|
|
2338
|
-
function
|
|
3172
|
+
function ni(e) {
|
|
2339
3173
|
return String(e || "").trim().toLowerCase();
|
|
2340
3174
|
}
|
|
2341
|
-
function
|
|
3175
|
+
function ri(e) {
|
|
2342
3176
|
if (!e) return "";
|
|
2343
3177
|
let t = typeof e == "number" ? new Date(e > 1e11 ? e : e * 1e3) : new Date(e);
|
|
2344
3178
|
return Number.isNaN(t.getTime()) ? "" : t.toLocaleString("zh-CN", {
|
|
@@ -2350,7 +3184,7 @@ function gr(e) {
|
|
|
2350
3184
|
hour12: !1
|
|
2351
3185
|
});
|
|
2352
3186
|
}
|
|
2353
|
-
function
|
|
3187
|
+
function ii(e) {
|
|
2354
3188
|
return [
|
|
2355
3189
|
e?.Title,
|
|
2356
3190
|
e?.Summary,
|
|
@@ -2359,39 +3193,40 @@ function _r(e) {
|
|
|
2359
3193
|
e?.SessionId,
|
|
2360
3194
|
e?.Model?.display_name,
|
|
2361
3195
|
e?.Model?.id
|
|
2362
|
-
].map(
|
|
3196
|
+
].map(ni).join(" ");
|
|
2363
3197
|
}
|
|
2364
|
-
function
|
|
2365
|
-
if (!
|
|
2366
|
-
let n =
|
|
3198
|
+
function ai(e, t = {}) {
|
|
3199
|
+
if (!Qr.has(ni(e?.ActiveRunStatus))) return !1;
|
|
3200
|
+
let n = ti(e);
|
|
2367
3201
|
if (!n) return !0;
|
|
2368
|
-
let r = Number.isFinite(Number(t.now)) ? Number(t.now) : Date.now(), i = Number.isFinite(Number(t.activeStaleAfterMs)) ? Number(t.activeStaleAfterMs) :
|
|
3202
|
+
let r = Number.isFinite(Number(t.now)) ? Number(t.now) : Date.now(), i = Number.isFinite(Number(t.activeStaleAfterMs)) ? Number(t.activeStaleAfterMs) : ei;
|
|
2369
3203
|
return r - n <= i;
|
|
2370
3204
|
}
|
|
2371
|
-
function
|
|
2372
|
-
let r =
|
|
2373
|
-
return (Array.isArray(e) ? e : []).filter((e) => e?.SessionId).filter((e) => !r ||
|
|
3205
|
+
function oi(e = [], t = "", n = {}) {
|
|
3206
|
+
let r = ni(t), i = new Set(Array.isArray(n.pinnedSessionIds) ? n.pinnedSessionIds : []);
|
|
3207
|
+
return (Array.isArray(e) ? e : []).filter((e) => e?.SessionId).filter((e) => !r || ii(e).includes(r)).slice().sort((e, t) => {
|
|
2374
3208
|
let r = +!!i.has(e.SessionId), a = +!!i.has(t.SessionId);
|
|
2375
3209
|
if (r !== a) return a - r;
|
|
2376
|
-
let o = +!!
|
|
2377
|
-
return o === s ?
|
|
3210
|
+
let o = +!!ai(e, n), s = +!!ai(t, n);
|
|
3211
|
+
return o === s ? ti(t) - ti(e) : s - o;
|
|
2378
3212
|
});
|
|
2379
3213
|
}
|
|
2380
|
-
function
|
|
2381
|
-
let n =
|
|
3214
|
+
function si(e, t = {}) {
|
|
3215
|
+
let n = ai(e, t), r = $r.has(ni(e?.ActiveRunStatus));
|
|
2382
3216
|
return {
|
|
2383
3217
|
running: n,
|
|
2384
|
-
|
|
3218
|
+
failed: r,
|
|
3219
|
+
label: n || r ? "" : ri(e?.UpdatedAt ?? e?.updated_at)
|
|
2385
3220
|
};
|
|
2386
3221
|
}
|
|
2387
3222
|
//#endregion
|
|
2388
3223
|
//#region src/components/chat/ChatSidebar.tsx
|
|
2389
|
-
function
|
|
2390
|
-
let [f, p] = q(""), m =
|
|
3224
|
+
function ci({ sessions: e, currentSessionId: t, onCreateNewSession: n, onSelectSession: r, onDeleteSession: i, onTogglePinSession: a, onLoadMoreSessions: o, sessionTitle: s, pinnedSessionIds: c = [], hasMoreSessions: l = !1, isLoadingSessions: u = !1, className: d }) {
|
|
3225
|
+
let [f, p] = q(""), m = Se(() => oi(e, f, { pinnedSessionIds: c }), [
|
|
2391
3226
|
e,
|
|
2392
3227
|
c,
|
|
2393
3228
|
f
|
|
2394
|
-
]), h =
|
|
3229
|
+
]), h = Se(() => new Set(c), [c]);
|
|
2395
3230
|
return /* @__PURE__ */ B("div", {
|
|
2396
3231
|
className: Y("flex h-full min-h-0 flex-col bg-sidebar", d),
|
|
2397
3232
|
children: [
|
|
@@ -2403,14 +3238,14 @@ function xr({ sessions: e, currentSessionId: t, onCreateNewSession: n, onSelectS
|
|
|
2403
3238
|
className: "flex h-[34px] w-full items-center justify-between rounded-[10px] px-2.5 text-sm font-medium text-sidebar-text-secondary transition-colors hover:bg-sidebar-hover hover:text-sidebar-text",
|
|
2404
3239
|
children: [/* @__PURE__ */ B("span", {
|
|
2405
3240
|
className: "flex items-center gap-1.5",
|
|
2406
|
-
children: [/* @__PURE__ */ z(
|
|
3241
|
+
children: [/* @__PURE__ */ z(C, { className: "h-4 w-4" }), /* @__PURE__ */ z("span", { children: "新对话" })]
|
|
2407
3242
|
}), /* @__PURE__ */ z("span", {
|
|
2408
3243
|
className: "rounded border border-black/[0.08] px-1.5 py-0.5 text-[11px] text-sidebar-text-muted dark:border-white/[0.1]",
|
|
2409
3244
|
children: "⌘ N"
|
|
2410
3245
|
})]
|
|
2411
3246
|
}), /* @__PURE__ */ B("label", {
|
|
2412
3247
|
className: "flex h-9 items-center gap-2 rounded-[10px] border border-black/[0.06] bg-background px-2.5 text-xs text-sidebar-text-muted focus-within:border-primary/40 dark:border-white/[0.08]",
|
|
2413
|
-
children: [/* @__PURE__ */ z(
|
|
3248
|
+
children: [/* @__PURE__ */ z(se, { className: "h-3.5 w-3.5 flex-shrink-0" }), /* @__PURE__ */ z("input", {
|
|
2414
3249
|
value: f,
|
|
2415
3250
|
onChange: (e) => p(e.target.value),
|
|
2416
3251
|
className: "min-w-0 flex-1 bg-transparent text-sm text-sidebar-text outline-none placeholder:text-sidebar-text-muted",
|
|
@@ -2431,54 +3266,52 @@ function xr({ sessions: e, currentSessionId: t, onCreateNewSession: n, onSelectS
|
|
|
2431
3266
|
}), /* @__PURE__ */ B("div", {
|
|
2432
3267
|
className: "flex flex-col gap-0.5",
|
|
2433
3268
|
children: [m.length > 0 ? m.map((e) => {
|
|
2434
|
-
let n =
|
|
3269
|
+
let n = si(e), o = h.has(e.SessionId), c = t === e.SessionId;
|
|
2435
3270
|
return /* @__PURE__ */ B("div", {
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
(
|
|
2442
|
-
|
|
2443
|
-
className: Y("group relative flex h-[30px] items-center gap-1 rounded-[10px] border-l-2 border-transparent px-2 text-sm leading-5 transition-colors", c ? "border-l-2 border-primary bg-primary/10 font-medium text-sidebar-text" : n.running ? "cursor-pointer bg-primary/8 text-sidebar-text" : "cursor-pointer text-sidebar-text-secondary hover:bg-sidebar-hover hover:text-sidebar-text"),
|
|
2444
|
-
children: [
|
|
2445
|
-
n.running ? /* @__PURE__ */ z("span", {
|
|
2446
|
-
className: "absolute left-0 top-1/2 h-3.5 w-0.5 -translate-y-1/2 rounded-full bg-primary",
|
|
2447
|
-
"aria-hidden": "true"
|
|
2448
|
-
}) : null,
|
|
2449
|
-
/* @__PURE__ */ z("div", {
|
|
3271
|
+
className: Y("group relative flex h-[30px] items-center gap-1 rounded-[10px] border-l-2 border-transparent px-2 text-sm leading-5 transition-colors", c ? "border-l-2 border-primary bg-primary/10 font-medium text-sidebar-text" : n.running ? "cursor-pointer bg-primary/[0.035] text-sidebar-text" : "cursor-pointer text-sidebar-text-secondary hover:bg-sidebar-hover hover:text-sidebar-text"),
|
|
3272
|
+
children: [/* @__PURE__ */ B("button", {
|
|
3273
|
+
type: "button",
|
|
3274
|
+
"aria-current": c ? "page" : void 0,
|
|
3275
|
+
className: "flex min-w-0 flex-1 items-center gap-1 text-left outline-none focus-visible:ring-2 focus-visible:ring-primary/60",
|
|
3276
|
+
onClick: () => r(e.SessionId),
|
|
3277
|
+
children: [/* @__PURE__ */ z("span", {
|
|
2450
3278
|
className: "min-w-0 flex-1 truncate text-[13px]",
|
|
2451
3279
|
children: s(e)
|
|
2452
|
-
}),
|
|
2453
|
-
|
|
3280
|
+
}), n.running ? /* @__PURE__ */ z("span", {
|
|
3281
|
+
"aria-label": "运行中",
|
|
3282
|
+
className: "h-1.5 w-1.5 flex-shrink-0 animate-spin rounded-full border border-primary border-t-transparent"
|
|
3283
|
+
}) : n.failed ? /* @__PURE__ */ z("span", {
|
|
3284
|
+
"aria-label": "运行失败",
|
|
3285
|
+
title: "运行失败",
|
|
3286
|
+
className: "h-1.5 w-1.5 flex-shrink-0 rounded-full bg-rose-500/75"
|
|
3287
|
+
}) : n.label ? /* @__PURE__ */ z("span", {
|
|
2454
3288
|
className: "flex-shrink-0 text-[11px] leading-none text-sidebar-text-muted group-hover:hidden",
|
|
2455
3289
|
children: n.label
|
|
2456
|
-
}) : null
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
]
|
|
3290
|
+
}) : null]
|
|
3291
|
+
}), /* @__PURE__ */ B("div", {
|
|
3292
|
+
className: "absolute right-1 top-1/2 flex -translate-y-1/2 items-center justify-end gap-0.5 opacity-0 transition-opacity group-focus-within:opacity-100 group-hover:opacity-100",
|
|
3293
|
+
children: [/* @__PURE__ */ z("button", {
|
|
3294
|
+
type: "button",
|
|
3295
|
+
onClick: (t) => a(e.SessionId, t),
|
|
3296
|
+
className: Y("flex h-6 w-6 items-center justify-center rounded-md text-sidebar-text-muted hover:bg-sidebar-active hover:text-sidebar-text", o && "text-primary opacity-100"),
|
|
3297
|
+
title: o ? "取消置顶" : "置顶会话",
|
|
3298
|
+
"aria-label": o ? "取消置顶会话" : "置顶会话",
|
|
3299
|
+
children: z(o ? ie : re, { className: "h-3.5 w-3.5" })
|
|
3300
|
+
}), /* @__PURE__ */ z("button", {
|
|
3301
|
+
type: "button",
|
|
3302
|
+
onClick: (t) => i(e.SessionId, t),
|
|
3303
|
+
className: "flex h-6 w-6 items-center justify-center rounded-md text-sidebar-text-muted hover:bg-sidebar-active hover:text-rose-500",
|
|
3304
|
+
title: "删除会话",
|
|
3305
|
+
children: /* @__PURE__ */ z(fe, { className: "h-3.5 w-3.5" })
|
|
3306
|
+
})]
|
|
3307
|
+
})]
|
|
2475
3308
|
}, e.SessionId);
|
|
2476
3309
|
}) : /* @__PURE__ */ z("div", {
|
|
2477
3310
|
className: "rounded-xl border border-dashed border-black/[0.08] px-3 py-8 text-center text-xs text-sidebar-text-muted dark:border-white/[0.1]",
|
|
2478
3311
|
children: "没有匹配的会话"
|
|
2479
3312
|
}), u ? /* @__PURE__ */ B("div", {
|
|
2480
3313
|
className: "flex items-center justify-center gap-2 px-3 py-3 text-xs text-sidebar-text-muted",
|
|
2481
|
-
children: [/* @__PURE__ */ z(
|
|
3314
|
+
children: [/* @__PURE__ */ z(x, { className: "h-3.5 w-3.5 animate-spin" }), /* @__PURE__ */ z("span", { children: "加载中" })]
|
|
2482
3315
|
}) : null]
|
|
2483
3316
|
})]
|
|
2484
3317
|
}),
|
|
@@ -2504,8 +3337,8 @@ function xr({ sessions: e, currentSessionId: t, onCreateNewSession: n, onSelectS
|
|
|
2504
3337
|
}
|
|
2505
3338
|
//#endregion
|
|
2506
3339
|
//#region src/components/native/NativeRuntimeLauncher.tsx
|
|
2507
|
-
var
|
|
2508
|
-
function
|
|
3340
|
+
var li = ye(() => import("./NativeTerminalPanel-CDqCdIly.js").then((e) => e.n).then((e) => ({ default: e.NativeTerminalPanel })));
|
|
3341
|
+
function ui({ productLabel: e = "原生运行时", nativeManagementLink: t, nativeTerminal: n, workspaceEnabled: r, onOpenWorkspace: i }) {
|
|
2509
3342
|
let a = !!n?.Enabled, [o, s] = q(!1);
|
|
2510
3343
|
return /* @__PURE__ */ B("section", {
|
|
2511
3344
|
className: "flex min-h-0 flex-1 overflow-y-auto bg-[radial-gradient(circle_at_top_left,rgba(14,165,233,0.12),transparent_34%),linear-gradient(135deg,#f8fafc_0%,#ffffff_48%,#f1f5f9_100%)] px-4 py-8 dark:bg-[radial-gradient(circle_at_top_left,rgba(14,165,233,0.16),transparent_34%),linear-gradient(135deg,#020617_0%,#0f172a_52%,#111827_100%)] sm:px-8",
|
|
@@ -2519,7 +3352,7 @@ function Cr({ productLabel: e = "原生运行时", nativeManagementLink: t, nati
|
|
|
2519
3352
|
/* @__PURE__ */ B("div", {
|
|
2520
3353
|
className: "inline-flex items-center gap-2 rounded-full border border-sky-200 bg-sky-50 px-3 py-1 text-xs font-medium text-sky-700 dark:border-sky-900/60 dark:bg-sky-950/50 dark:text-sky-300",
|
|
2521
3354
|
children: [
|
|
2522
|
-
/* @__PURE__ */ z(
|
|
3355
|
+
/* @__PURE__ */ z(j, { className: "h-3.5 w-3.5" }),
|
|
2523
3356
|
e,
|
|
2524
3357
|
" native runtime"
|
|
2525
3358
|
]
|
|
@@ -2541,7 +3374,7 @@ function Cr({ productLabel: e = "原生运行时", nativeManagementLink: t, nati
|
|
|
2541
3374
|
children: [
|
|
2542
3375
|
/* @__PURE__ */ z("div", {
|
|
2543
3376
|
className: "flex h-11 w-11 items-center justify-center rounded-2xl bg-slate-950 text-white dark:bg-slate-100 dark:text-slate-950",
|
|
2544
|
-
children: /* @__PURE__ */ z(
|
|
3377
|
+
children: /* @__PURE__ */ z(w, { className: "h-5 w-5" })
|
|
2545
3378
|
}),
|
|
2546
3379
|
/* @__PURE__ */ z("h2", {
|
|
2547
3380
|
className: "mt-4 text-base font-semibold text-slate-950 dark:text-slate-50",
|
|
@@ -2558,7 +3391,7 @@ function Cr({ productLabel: e = "原生运行时", nativeManagementLink: t, nati
|
|
|
2558
3391
|
title: t.title,
|
|
2559
3392
|
className: "mt-5 inline-flex items-center gap-2 rounded-2xl bg-slate-950 px-4 py-2.5 text-sm font-medium text-white transition hover:bg-slate-800 dark:bg-slate-100 dark:text-slate-950 dark:hover:bg-white",
|
|
2560
3393
|
children: [
|
|
2561
|
-
/* @__PURE__ */ z(
|
|
3394
|
+
/* @__PURE__ */ z(u, { className: "h-4 w-4" }),
|
|
2562
3395
|
"打开",
|
|
2563
3396
|
t.label
|
|
2564
3397
|
]
|
|
@@ -2573,7 +3406,7 @@ function Cr({ productLabel: e = "原生运行时", nativeManagementLink: t, nati
|
|
|
2573
3406
|
children: [
|
|
2574
3407
|
/* @__PURE__ */ z("div", {
|
|
2575
3408
|
className: "flex h-11 w-11 items-center justify-center rounded-2xl bg-sky-100 text-sky-700 dark:bg-sky-950 dark:text-sky-300",
|
|
2576
|
-
children: /* @__PURE__ */ z(
|
|
3409
|
+
children: /* @__PURE__ */ z(h, { className: "h-5 w-5" })
|
|
2577
3410
|
}),
|
|
2578
3411
|
/* @__PURE__ */ z("h2", {
|
|
2579
3412
|
className: "mt-4 text-base font-semibold text-slate-950 dark:text-slate-50",
|
|
@@ -2587,7 +3420,7 @@ function Cr({ productLabel: e = "原生运行时", nativeManagementLink: t, nati
|
|
|
2587
3420
|
type: "button",
|
|
2588
3421
|
onClick: i,
|
|
2589
3422
|
className: "mt-5 inline-flex items-center gap-2 rounded-2xl border border-slate-200 bg-slate-50 px-4 py-2.5 text-sm font-medium text-slate-800 transition hover:bg-slate-100 dark:border-slate-700 dark:bg-slate-800 dark:text-slate-100 dark:hover:bg-slate-700",
|
|
2590
|
-
children: [/* @__PURE__ */ z(
|
|
3423
|
+
children: [/* @__PURE__ */ z(h, { className: "h-4 w-4" }), "打开 Workspace"]
|
|
2591
3424
|
}) : /* @__PURE__ */ z("div", {
|
|
2592
3425
|
className: "mt-5 rounded-2xl border border-slate-200 bg-slate-50 px-4 py-3 text-sm leading-6 text-slate-500 dark:border-slate-800 dark:bg-slate-950/40 dark:text-slate-400",
|
|
2593
3426
|
children: "当前链接未开放 Workspace 文件管理。Owner 或 private 链接可使用该能力。"
|
|
@@ -2599,7 +3432,7 @@ function Cr({ productLabel: e = "原生运行时", nativeManagementLink: t, nati
|
|
|
2599
3432
|
children: [
|
|
2600
3433
|
/* @__PURE__ */ z("div", {
|
|
2601
3434
|
className: "flex h-11 w-11 items-center justify-center rounded-2xl bg-emerald-100 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-300",
|
|
2602
|
-
children: /* @__PURE__ */ z(
|
|
3435
|
+
children: /* @__PURE__ */ z(P, { className: "h-5 w-5" })
|
|
2603
3436
|
}),
|
|
2604
3437
|
/* @__PURE__ */ z("h2", {
|
|
2605
3438
|
className: "mt-4 text-base font-semibold text-slate-950 dark:text-slate-50",
|
|
@@ -2613,7 +3446,7 @@ function Cr({ productLabel: e = "原生运行时", nativeManagementLink: t, nati
|
|
|
2613
3446
|
type: "button",
|
|
2614
3447
|
onClick: () => s(!0),
|
|
2615
3448
|
className: "mt-5 inline-flex items-center gap-2 rounded-2xl border border-emerald-200 bg-emerald-50 px-4 py-2.5 text-sm font-medium text-emerald-800 transition hover:bg-emerald-100 dark:border-emerald-900/70 dark:bg-emerald-950/40 dark:text-emerald-200",
|
|
2616
|
-
children: [/* @__PURE__ */ z(
|
|
3449
|
+
children: [/* @__PURE__ */ z(P, { className: "h-4 w-4" }), "打开 TUI"]
|
|
2617
3450
|
}) : /* @__PURE__ */ z("div", {
|
|
2618
3451
|
className: "mt-5 rounded-2xl border border-slate-200 bg-slate-50 px-4 py-3 text-sm leading-6 text-slate-500 dark:border-slate-800 dark:bg-slate-950/40 dark:text-slate-400",
|
|
2619
3452
|
children: "当前运行时未声明可用的浏览器 TUI 能力。"
|
|
@@ -2623,9 +3456,9 @@ function Cr({ productLabel: e = "原生运行时", nativeManagementLink: t, nati
|
|
|
2623
3456
|
]
|
|
2624
3457
|
})]
|
|
2625
3458
|
})
|
|
2626
|
-
}), n && o ? /* @__PURE__ */ z(
|
|
3459
|
+
}), n && o ? /* @__PURE__ */ z(U, {
|
|
2627
3460
|
fallback: null,
|
|
2628
|
-
children: /* @__PURE__ */ z(
|
|
3461
|
+
children: /* @__PURE__ */ z(li, {
|
|
2629
3462
|
capability: n,
|
|
2630
3463
|
open: o,
|
|
2631
3464
|
onClose: () => s(!1)
|
|
@@ -2635,10 +3468,10 @@ function Cr({ productLabel: e = "原生运行时", nativeManagementLink: t, nati
|
|
|
2635
3468
|
}
|
|
2636
3469
|
//#endregion
|
|
2637
3470
|
//#region src/stores/ui.ts
|
|
2638
|
-
function
|
|
3471
|
+
function di(e, t) {
|
|
2639
3472
|
return typeof t == "function" ? t(e) : t;
|
|
2640
3473
|
}
|
|
2641
|
-
var
|
|
3474
|
+
var fi = ve()((e) => ({
|
|
2642
3475
|
sidebarOpen: !0,
|
|
2643
3476
|
mobileSidebarOpen: !1,
|
|
2644
3477
|
mobileActionsOpen: !1,
|
|
@@ -2661,10 +3494,10 @@ var Tr = L()((e) => ({
|
|
|
2661
3494
|
setWorkspacePanelWidth: (t) => e({ workspacePanelWidth: t }),
|
|
2662
3495
|
setWorkspacePanelFullscreen: (t) => e({ workspacePanelFullscreen: t }),
|
|
2663
3496
|
setInput: (t) => e({ input: t }),
|
|
2664
|
-
setAttachments: (t) => e((e) => ({ attachments:
|
|
3497
|
+
setAttachments: (t) => e((e) => ({ attachments: di(e.attachments, t) })),
|
|
2665
3498
|
setPreviewAttachment: (t) => e({ previewAttachment: t }),
|
|
2666
3499
|
setPreviewImageSize: (t) => e({ previewImageSize: t }),
|
|
2667
|
-
setQueuedDrafts: (t) => e((e) => ({ queuedDrafts:
|
|
3500
|
+
setQueuedDrafts: (t) => e((e) => ({ queuedDrafts: di(e.queuedDrafts, t) })),
|
|
2668
3501
|
pushToast: (t, n = "info") => e((e) => ({ toasts: [...e.toasts, {
|
|
2669
3502
|
id: String(Date.now() + Math.random()),
|
|
2670
3503
|
message: t,
|
|
@@ -2675,71 +3508,71 @@ var Tr = L()((e) => ({
|
|
|
2675
3508
|
}));
|
|
2676
3509
|
//#endregion
|
|
2677
3510
|
//#region src/components/workspace/FileEditor.tsx
|
|
2678
|
-
function
|
|
3511
|
+
function pi(e) {
|
|
2679
3512
|
let t = String(e || "").split("/").pop() || "", n = t.lastIndexOf(".");
|
|
2680
3513
|
return n >= 0 ? t.slice(n) : "";
|
|
2681
3514
|
}
|
|
2682
|
-
function
|
|
2683
|
-
return
|
|
3515
|
+
function mi(e) {
|
|
3516
|
+
return Je.matchFilename(ct, `file${e}`);
|
|
2684
3517
|
}
|
|
2685
|
-
function
|
|
2686
|
-
let s = K(null), c = K(null), l = K(new
|
|
2687
|
-
|
|
3518
|
+
function hi({ content: e, path: t, readOnly: n = !1, onSave: r, onDirtyChange: i, onContentChange: a, getContentRef: o }) {
|
|
3519
|
+
let s = K(null), c = K(null), l = K(new He()), u = K(new He()), d = K(new He()), f = K(!1), p = K(r), m = K(i), h = K(a);
|
|
3520
|
+
G(() => {
|
|
2688
3521
|
p.current = r, m.current = i, h.current = a;
|
|
2689
3522
|
}, [
|
|
2690
3523
|
r,
|
|
2691
3524
|
i,
|
|
2692
3525
|
a
|
|
2693
3526
|
]);
|
|
2694
|
-
let g =
|
|
3527
|
+
let g = W((e) => {
|
|
2695
3528
|
f.current !== e && (f.current = e, m.current?.(e));
|
|
2696
3529
|
}, []);
|
|
2697
|
-
return
|
|
3530
|
+
return G(() => {
|
|
2698
3531
|
if (!s.current) return;
|
|
2699
|
-
let r = document.documentElement.classList.contains("dark"), i =
|
|
3532
|
+
let r = document.documentElement.classList.contains("dark"), i = ze.of([{
|
|
2700
3533
|
key: "Mod-s",
|
|
2701
3534
|
run: (e) => {
|
|
2702
3535
|
let t = e.state.doc.toString();
|
|
2703
3536
|
return p.current?.(t), g(!1), !0;
|
|
2704
3537
|
},
|
|
2705
3538
|
preventDefault: !0
|
|
2706
|
-
}]), a = new
|
|
2707
|
-
state:
|
|
3539
|
+
}]), a = new Ne({
|
|
3540
|
+
state: Ue.create({
|
|
2708
3541
|
doc: e,
|
|
2709
3542
|
extensions: [
|
|
2710
|
-
Fe(),
|
|
2711
|
-
Ne(),
|
|
2712
3543
|
Be(),
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
je(),
|
|
2716
|
-
Re.allowMultipleSelections.of(!0),
|
|
2717
|
-
Je(),
|
|
2718
|
-
Ye(Ge, { fallback: !0 }),
|
|
2719
|
-
We(),
|
|
2720
|
-
et(),
|
|
2721
|
-
$e(),
|
|
2722
|
-
Ie(),
|
|
2723
|
-
ke(),
|
|
2724
|
-
Me(),
|
|
3544
|
+
Re(),
|
|
3545
|
+
Ge(),
|
|
2725
3546
|
Ze(),
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
3547
|
+
Fe(),
|
|
3548
|
+
Ie(),
|
|
3549
|
+
Ue.allowMultipleSelections.of(!0),
|
|
3550
|
+
$e(),
|
|
3551
|
+
et(Xe, { fallback: !0 }),
|
|
3552
|
+
Ye(),
|
|
3553
|
+
at(),
|
|
3554
|
+
it(),
|
|
3555
|
+
Ve(),
|
|
3556
|
+
Pe(),
|
|
3557
|
+
Le(),
|
|
3558
|
+
nt(),
|
|
3559
|
+
ze.of([
|
|
3560
|
+
...ot,
|
|
3561
|
+
...We,
|
|
3562
|
+
...rt,
|
|
3563
|
+
...Ke,
|
|
2729
3564
|
...Qe,
|
|
2730
|
-
...
|
|
2731
|
-
|
|
2732
|
-
...nt,
|
|
2733
|
-
He
|
|
3565
|
+
...st,
|
|
3566
|
+
qe
|
|
2734
3567
|
]),
|
|
2735
3568
|
i,
|
|
2736
|
-
|
|
3569
|
+
Ne.updateListener.of((e) => {
|
|
2737
3570
|
e.docChanged && (g(!0), h.current?.(e.state.doc.toString()));
|
|
2738
3571
|
}),
|
|
2739
|
-
d.current.of(
|
|
3572
|
+
d.current.of(Ue.readOnly.of(n)),
|
|
2740
3573
|
l.current.of([]),
|
|
2741
|
-
u.current.of(r ?
|
|
2742
|
-
|
|
3574
|
+
u.current.of(r ? tt : []),
|
|
3575
|
+
Ne.theme({
|
|
2743
3576
|
"&": { height: "100%" },
|
|
2744
3577
|
".cm-scroller": { overflow: "auto" }
|
|
2745
3578
|
})
|
|
@@ -2748,13 +3581,13 @@ function Or({ content: e, path: t, readOnly: n = !1, onSave: r, onDirtyChange: i
|
|
|
2748
3581
|
parent: s.current
|
|
2749
3582
|
});
|
|
2750
3583
|
c.current = a, o && (o.current = () => a.state.doc.toString());
|
|
2751
|
-
let f =
|
|
3584
|
+
let f = mi(pi(t));
|
|
2752
3585
|
return f && f.load().then((e) => {
|
|
2753
3586
|
c.current && c.current.dispatch({ effects: l.current.reconfigure(e) });
|
|
2754
3587
|
}).catch(() => {}), () => {
|
|
2755
3588
|
a.destroy(), c.current = null, o && (o.current = null);
|
|
2756
3589
|
};
|
|
2757
|
-
}, []),
|
|
3590
|
+
}, []), G(() => {
|
|
2758
3591
|
let t = c.current;
|
|
2759
3592
|
if (!t) return;
|
|
2760
3593
|
let n = t.state.doc.toString();
|
|
@@ -2763,22 +3596,22 @@ function Or({ content: e, path: t, readOnly: n = !1, onSave: r, onDirtyChange: i
|
|
|
2763
3596
|
to: n.length,
|
|
2764
3597
|
insert: e
|
|
2765
3598
|
} }), g(!1));
|
|
2766
|
-
}, [e, g]),
|
|
3599
|
+
}, [e, g]), G(() => {
|
|
2767
3600
|
let e = c.current;
|
|
2768
3601
|
if (!e) return;
|
|
2769
|
-
let n =
|
|
3602
|
+
let n = mi(pi(t));
|
|
2770
3603
|
n ? n.load().then((e) => {
|
|
2771
3604
|
c.current && c.current.dispatch({ effects: l.current.reconfigure(e) });
|
|
2772
3605
|
}).catch(() => {}) : e.dispatch({ effects: l.current.reconfigure([]) });
|
|
2773
|
-
}, [t]),
|
|
3606
|
+
}, [t]), G(() => {
|
|
2774
3607
|
let e = c.current;
|
|
2775
|
-
e && e.dispatch({ effects: d.current.reconfigure(
|
|
2776
|
-
}, [n]),
|
|
3608
|
+
e && e.dispatch({ effects: d.current.reconfigure(Ue.readOnly.of(n)) });
|
|
3609
|
+
}, [n]), G(() => {
|
|
2777
3610
|
let e = new MutationObserver(() => {
|
|
2778
3611
|
let e = c.current;
|
|
2779
3612
|
if (!e) return;
|
|
2780
3613
|
let t = document.documentElement.classList.contains("dark");
|
|
2781
|
-
e.dispatch({ effects: u.current.reconfigure(t ?
|
|
3614
|
+
e.dispatch({ effects: u.current.reconfigure(t ? tt : []) });
|
|
2782
3615
|
});
|
|
2783
3616
|
return e.observe(document.documentElement, {
|
|
2784
3617
|
attributes: !0,
|
|
@@ -2791,7 +3624,7 @@ function Or({ content: e, path: t, readOnly: n = !1, onSave: r, onDirtyChange: i
|
|
|
2791
3624
|
}
|
|
2792
3625
|
//#endregion
|
|
2793
3626
|
//#region src/components/workspace/FilePreview.tsx
|
|
2794
|
-
function
|
|
3627
|
+
function gi({ content: e, objectUrl: t, kind: n, filename: r, path: i }) {
|
|
2795
3628
|
return n === "markdown" ? /* @__PURE__ */ z(Z, { content: e || "" }) : n === "image" && t ? /* @__PURE__ */ z("div", {
|
|
2796
3629
|
className: "flex items-center justify-center p-4",
|
|
2797
3630
|
children: /* @__PURE__ */ z("img", {
|
|
@@ -2803,7 +3636,7 @@ function kr({ content: e, objectUrl: t, kind: n, filename: r, path: i }) {
|
|
|
2803
3636
|
src: t,
|
|
2804
3637
|
title: r,
|
|
2805
3638
|
className: "h-full w-full border-0"
|
|
2806
|
-
}) : (n === "text" || n === "code") && e !== null ? /* @__PURE__ */ z(
|
|
3639
|
+
}) : (n === "text" || n === "code") && e !== null ? /* @__PURE__ */ z(hi, {
|
|
2807
3640
|
content: e,
|
|
2808
3641
|
path: i || r,
|
|
2809
3642
|
readOnly: !0,
|
|
@@ -2820,10 +3653,10 @@ function kr({ content: e, objectUrl: t, kind: n, filename: r, path: i }) {
|
|
|
2820
3653
|
}
|
|
2821
3654
|
//#endregion
|
|
2822
3655
|
//#region src/utils/sandbox.ts
|
|
2823
|
-
function
|
|
3656
|
+
function _i(e) {
|
|
2824
3657
|
return e.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
2825
3658
|
}
|
|
2826
|
-
function
|
|
3659
|
+
function vi(e) {
|
|
2827
3660
|
let t = e.endsWith("/") ? e : `${e}/`;
|
|
2828
3661
|
if (typeof window > "u") return "'self'";
|
|
2829
3662
|
try {
|
|
@@ -2832,11 +3665,11 @@ function jr(e) {
|
|
|
2832
3665
|
return "'self'";
|
|
2833
3666
|
}
|
|
2834
3667
|
}
|
|
2835
|
-
function
|
|
3668
|
+
function yi(...e) {
|
|
2836
3669
|
return Array.from(new Set(e.filter((e) => !!e))).join(" ");
|
|
2837
3670
|
}
|
|
2838
|
-
function
|
|
2839
|
-
let t = e ?
|
|
3671
|
+
function bi(e) {
|
|
3672
|
+
let t = e ? vi(e) : void 0, n = yi("'unsafe-inline'", "'unsafe-eval'", "'self'", "https:", t), r = yi("'self'", "https:", t);
|
|
2840
3673
|
return [
|
|
2841
3674
|
"default-src 'none'",
|
|
2842
3675
|
`script-src ${n}`,
|
|
@@ -2850,7 +3683,7 @@ function Nr(e) {
|
|
|
2850
3683
|
"base-uri 'self'"
|
|
2851
3684
|
].join("; ");
|
|
2852
3685
|
}
|
|
2853
|
-
function
|
|
3686
|
+
function xi(e) {
|
|
2854
3687
|
try {
|
|
2855
3688
|
let t = new URL(e, window.location.href);
|
|
2856
3689
|
return [
|
|
@@ -2862,8 +3695,8 @@ function Pr(e) {
|
|
|
2862
3695
|
return !1;
|
|
2863
3696
|
}
|
|
2864
3697
|
}
|
|
2865
|
-
function
|
|
2866
|
-
let { channelId: n, basePath: r } = typeof t == "string" ? { channelId: t } : t, i =
|
|
3698
|
+
function Si(e, t = {}) {
|
|
3699
|
+
let { channelId: n, basePath: r } = typeof t == "string" ? { channelId: t } : t, i = bi(r), a = `<script>
|
|
2867
3700
|
function ksadkScrollToHash(rawHref) {
|
|
2868
3701
|
if (!rawHref || rawHref === '#') return;
|
|
2869
3702
|
var rawId = rawHref.slice(1);
|
|
@@ -2895,24 +3728,24 @@ document.addEventListener('click', function(event) {
|
|
|
2895
3728
|
}, '*');
|
|
2896
3729
|
}
|
|
2897
3730
|
}, true);
|
|
2898
|
-
<\/script>`, o = `${`<meta http-equiv="Content-Security-Policy" content="${
|
|
3731
|
+
<\/script>`, o = `${`<meta http-equiv="Content-Security-Policy" content="${_i(i)}">`}${r ? `<base href="${_i(r)}">` : ""}${a}`;
|
|
2899
3732
|
return /<head[^>]*>/i.test(e) ? e.replace(/<head[^>]*>/i, `$&${o}`) : `${o}${e}`;
|
|
2900
3733
|
}
|
|
2901
|
-
function
|
|
3734
|
+
function Ci(e, t) {
|
|
2902
3735
|
let n = K(null);
|
|
2903
|
-
|
|
3736
|
+
G(() => (n.current = (n) => {
|
|
2904
3737
|
if (n.source !== e.current?.contentWindow || n.data?.type !== "ksadk:linkClick" || t && n.data?.channelId !== t) return;
|
|
2905
3738
|
let r = n.data?.href;
|
|
2906
|
-
typeof r == "string" && r &&
|
|
3739
|
+
typeof r == "string" && r && xi(r) && window.open(r, "_blank", "noopener,noreferrer");
|
|
2907
3740
|
}, window.addEventListener("message", n.current), () => {
|
|
2908
3741
|
n.current && window.removeEventListener("message", n.current);
|
|
2909
3742
|
}), [e, t]);
|
|
2910
3743
|
}
|
|
2911
|
-
var
|
|
3744
|
+
var wi = "/_ksadk/workspace/v1/files", Ti = new Set([
|
|
2912
3745
|
".md",
|
|
2913
3746
|
".markdown",
|
|
2914
3747
|
".mdx"
|
|
2915
|
-
]),
|
|
3748
|
+
]), Ei = new Set([".pdf"]), Di = new Set([
|
|
2916
3749
|
".png",
|
|
2917
3750
|
".jpg",
|
|
2918
3751
|
".jpeg",
|
|
@@ -2921,7 +3754,7 @@ var Lr = "/_ksadk/workspace/v1/files", Rr = new Set([
|
|
|
2921
3754
|
".svg",
|
|
2922
3755
|
".bmp",
|
|
2923
3756
|
".ico"
|
|
2924
|
-
]),
|
|
3757
|
+
]), Oi = new Set(/* @__PURE__ */ ".txt,.log,.json,.yaml,.yml,.xml,.html,.css,.js,.jsx,.ts,.tsx,.py,.sh,.sql,.csv,.tsv,.toml,.ini,.env,.lock,.conf,.c,.cc,.cpp,.go,.java,.rs".split(",")), ki = new Set([
|
|
2925
3758
|
"application/json",
|
|
2926
3759
|
"application/ld+json",
|
|
2927
3760
|
"application/xml",
|
|
@@ -2950,40 +3783,40 @@ function $(e) {
|
|
|
2950
3783
|
}
|
|
2951
3784
|
return n.length > 0 ? n.join("/") : ".";
|
|
2952
3785
|
}
|
|
2953
|
-
function
|
|
3786
|
+
function Ai(e) {
|
|
2954
3787
|
let t = $(e);
|
|
2955
3788
|
return t === "." ? "" : t.split("/").filter(Boolean).map((e) => encodeURIComponent(e)).join("/");
|
|
2956
3789
|
}
|
|
2957
|
-
function
|
|
2958
|
-
let t =
|
|
2959
|
-
return t ? `${
|
|
3790
|
+
function ji(e) {
|
|
3791
|
+
let t = Ai(e);
|
|
3792
|
+
return t ? `${wi}/${t}` : wi;
|
|
2960
3793
|
}
|
|
2961
|
-
function
|
|
3794
|
+
function Mi(e) {
|
|
2962
3795
|
let t = $(e);
|
|
2963
|
-
if (t === "." || !t.includes("/")) return `${
|
|
2964
|
-
let n =
|
|
2965
|
-
return n ? `${
|
|
3796
|
+
if (t === "." || !t.includes("/")) return `${wi}/`;
|
|
3797
|
+
let n = Ai(t.substring(0, t.lastIndexOf("/")));
|
|
3798
|
+
return n ? `${wi}/${n}/` : `${wi}/`;
|
|
2966
3799
|
}
|
|
2967
|
-
function
|
|
3800
|
+
function Ni(e) {
|
|
2968
3801
|
return $(e) === ".";
|
|
2969
3802
|
}
|
|
2970
|
-
function
|
|
3803
|
+
function Pi(e) {
|
|
2971
3804
|
let t = $(e);
|
|
2972
3805
|
return t === "." ? "/" : `/${t}`;
|
|
2973
3806
|
}
|
|
2974
|
-
function
|
|
3807
|
+
function Fi(e) {
|
|
2975
3808
|
let t = String(e || "").split("/").pop() || "", n = t.lastIndexOf(".");
|
|
2976
3809
|
return n >= 0 ? t.slice(n).toLowerCase() : "";
|
|
2977
3810
|
}
|
|
2978
|
-
function
|
|
3811
|
+
function Ii(e) {
|
|
2979
3812
|
return String(e || "").split(";")[0].trim().toLowerCase();
|
|
2980
3813
|
}
|
|
2981
|
-
var
|
|
2982
|
-
function
|
|
2983
|
-
let n =
|
|
2984
|
-
return r === "text/html" ||
|
|
3814
|
+
var Li = new Set([".html", ".htm"]);
|
|
3815
|
+
function Ri({ path: e, mimeType: t }) {
|
|
3816
|
+
let n = Fi(e), r = Ii(t);
|
|
3817
|
+
return r === "text/html" || Li.has(n) ? "html" : r === "text/markdown" || Ti.has(n) ? "markdown" : r === "application/pdf" || Ei.has(n) ? "pdf" : r.startsWith("image/") || Di.has(n) ? "image" : r.startsWith("text/") || ki.has(r) || Oi.has(n) ? "text" : "unsupported";
|
|
2985
3818
|
}
|
|
2986
|
-
var
|
|
3819
|
+
var zi = new Set([
|
|
2987
3820
|
".txt",
|
|
2988
3821
|
".log",
|
|
2989
3822
|
".csv",
|
|
@@ -2993,11 +3826,11 @@ var Qr = new Set([
|
|
|
2993
3826
|
".conf",
|
|
2994
3827
|
".lock"
|
|
2995
3828
|
]);
|
|
2996
|
-
function
|
|
2997
|
-
let n =
|
|
2998
|
-
return
|
|
3829
|
+
function Bi({ path: e, mimeType: t }) {
|
|
3830
|
+
let n = Fi(e), r = Ii(t);
|
|
3831
|
+
return Li.has(n) || r === "text/html" ? "html" : r === "text/markdown" || Ti.has(n) ? "markdown" : r === "application/pdf" || Ei.has(n) || r.startsWith("image/") || Di.has(n) ? null : zi.has(n) || r === "text/plain" ? "text" : r.startsWith("text/") || ki.has(r) || Oi.has(n) ? "code" : null;
|
|
2999
3832
|
}
|
|
3000
|
-
function
|
|
3833
|
+
function Vi({ isMobile: e }) {
|
|
3001
3834
|
return e ? {
|
|
3002
3835
|
renderMode: "sheet",
|
|
3003
3836
|
modal: !0,
|
|
@@ -3012,7 +3845,7 @@ function ei({ isMobile: e }) {
|
|
|
3012
3845
|
side: "right"
|
|
3013
3846
|
};
|
|
3014
3847
|
}
|
|
3015
|
-
function
|
|
3848
|
+
function Hi() {
|
|
3016
3849
|
let e = 0;
|
|
3017
3850
|
return {
|
|
3018
3851
|
next(t) {
|
|
@@ -3029,61 +3862,61 @@ function ti() {
|
|
|
3029
3862
|
}
|
|
3030
3863
|
};
|
|
3031
3864
|
}
|
|
3032
|
-
function
|
|
3865
|
+
function Ui({ workspaceFiles: e, accessMode: t }) {
|
|
3033
3866
|
if (!e?.Enabled) return !1;
|
|
3034
3867
|
let n = String(t || "").trim().toLowerCase();
|
|
3035
3868
|
return n === "owner" || n === "private";
|
|
3036
3869
|
}
|
|
3037
3870
|
//#endregion
|
|
3038
3871
|
//#region src/components/workspace/HtmlPreview.tsx
|
|
3039
|
-
function
|
|
3040
|
-
let
|
|
3872
|
+
function Wi({ content: e, path: t, onSave: n, onDirtyChange: r, getContentRef: i, isMobile: a }) {
|
|
3873
|
+
let o = K(null), c = be(), [l, f] = q("preview"), p = Mi(t), m = ji(t), h = W(() => Si(e, {
|
|
3041
3874
|
basePath: p,
|
|
3042
|
-
channelId:
|
|
3875
|
+
channelId: c
|
|
3043
3876
|
}), [
|
|
3044
3877
|
e,
|
|
3045
3878
|
p,
|
|
3046
|
-
|
|
3879
|
+
c
|
|
3047
3880
|
]), [g, _] = q(h());
|
|
3048
|
-
|
|
3881
|
+
G(() => {
|
|
3049
3882
|
let e = setTimeout(() => {
|
|
3050
3883
|
_(h());
|
|
3051
3884
|
}, 300);
|
|
3052
3885
|
return () => clearTimeout(e);
|
|
3053
|
-
}, [h]),
|
|
3054
|
-
let v =
|
|
3886
|
+
}, [h]), Ci(o, c);
|
|
3887
|
+
let v = W(() => {
|
|
3055
3888
|
let e = new Blob([g], { type: "text/html;charset=utf-8" }), t = URL.createObjectURL(e), n = window.open(t, "_blank", "noopener,noreferrer");
|
|
3056
3889
|
window.setTimeout(() => URL.revokeObjectURL(t), 3e4), n || window.open(m, "_blank", "noopener,noreferrer");
|
|
3057
3890
|
}, [m, g]);
|
|
3058
|
-
return
|
|
3891
|
+
return a ? /* @__PURE__ */ B("div", {
|
|
3059
3892
|
className: "flex h-full flex-col",
|
|
3060
3893
|
children: [/* @__PURE__ */ B("div", {
|
|
3061
3894
|
className: "flex items-center gap-1 border-b border-slate-200 px-2 py-1.5 dark:border-slate-700",
|
|
3062
3895
|
children: [/* @__PURE__ */ B("button", {
|
|
3063
3896
|
onClick: () => f("editor"),
|
|
3064
|
-
className: Y("flex items-center gap-1.5 rounded-md px-3 py-1 text-xs font-medium transition-colors",
|
|
3065
|
-
children: [/* @__PURE__ */ z(
|
|
3897
|
+
className: Y("flex items-center gap-1.5 rounded-md px-3 py-1 text-xs font-medium transition-colors", l === "editor" ? "bg-slate-100 text-slate-900 dark:bg-slate-700 dark:text-slate-100" : "text-slate-500 hover:bg-slate-50 dark:text-slate-400 dark:hover:bg-slate-800"),
|
|
3898
|
+
children: [/* @__PURE__ */ z(s, { className: "h-3.5 w-3.5" }), "编辑"]
|
|
3066
3899
|
}), /* @__PURE__ */ B("button", {
|
|
3067
3900
|
onClick: () => f("preview"),
|
|
3068
|
-
className: Y("flex items-center gap-1.5 rounded-md px-3 py-1 text-xs font-medium transition-colors",
|
|
3069
|
-
children: [/* @__PURE__ */ z(
|
|
3901
|
+
className: Y("flex items-center gap-1.5 rounded-md px-3 py-1 text-xs font-medium transition-colors", l === "preview" ? "bg-slate-100 text-slate-900 dark:bg-slate-700 dark:text-slate-100" : "text-slate-500 hover:bg-slate-50 dark:text-slate-400 dark:hover:bg-slate-800"),
|
|
3902
|
+
children: [/* @__PURE__ */ z(d, { className: "h-3.5 w-3.5" }), "预览"]
|
|
3070
3903
|
})]
|
|
3071
|
-
}),
|
|
3904
|
+
}), l === "editor" ? /* @__PURE__ */ z(hi, {
|
|
3072
3905
|
content: e,
|
|
3073
3906
|
path: t,
|
|
3074
3907
|
onSave: n,
|
|
3075
3908
|
onDirtyChange: r,
|
|
3076
3909
|
getContentRef: i
|
|
3077
3910
|
}) : /* @__PURE__ */ z("iframe", {
|
|
3078
|
-
ref:
|
|
3911
|
+
ref: o,
|
|
3079
3912
|
srcDoc: g,
|
|
3080
3913
|
sandbox: "allow-scripts allow-downloads allow-same-origin",
|
|
3081
3914
|
title: "HTML 预览",
|
|
3082
3915
|
className: "h-full w-full border-0 bg-white"
|
|
3083
3916
|
})]
|
|
3084
|
-
}) :
|
|
3917
|
+
}) : l === "editor" ? /* @__PURE__ */ B("div", {
|
|
3085
3918
|
className: "relative flex h-full flex-col",
|
|
3086
|
-
children: [/* @__PURE__ */ z(
|
|
3919
|
+
children: [/* @__PURE__ */ z(hi, {
|
|
3087
3920
|
content: e,
|
|
3088
3921
|
path: t,
|
|
3089
3922
|
onSave: n,
|
|
@@ -3092,12 +3925,12 @@ function ri({ content: e, path: t, onSave: n, onDirtyChange: r, getContentRef: i
|
|
|
3092
3925
|
}), /* @__PURE__ */ B("button", {
|
|
3093
3926
|
onClick: () => f("preview"),
|
|
3094
3927
|
className: "absolute right-3 top-3 z-10 inline-flex items-center gap-1.5 rounded-lg border border-slate-200 bg-white/90 px-2.5 py-1.5 text-xs font-medium text-slate-600 shadow-sm backdrop-blur-sm transition hover:bg-slate-50 dark:border-slate-700 dark:bg-slate-800/90 dark:text-slate-300 dark:hover:bg-slate-700",
|
|
3095
|
-
children: [/* @__PURE__ */ z(
|
|
3928
|
+
children: [/* @__PURE__ */ z(d, { className: "h-3.5 w-3.5" }), "预览"]
|
|
3096
3929
|
})]
|
|
3097
3930
|
}) : /* @__PURE__ */ B("div", {
|
|
3098
3931
|
className: "relative flex h-full flex-col",
|
|
3099
3932
|
children: [/* @__PURE__ */ z("iframe", {
|
|
3100
|
-
ref:
|
|
3933
|
+
ref: o,
|
|
3101
3934
|
srcDoc: g,
|
|
3102
3935
|
sandbox: "allow-scripts allow-downloads allow-same-origin",
|
|
3103
3936
|
title: "HTML 预览",
|
|
@@ -3108,36 +3941,36 @@ function ri({ content: e, path: t, onSave: n, onDirtyChange: r, getContentRef: i
|
|
|
3108
3941
|
onClick: v,
|
|
3109
3942
|
className: "inline-flex items-center gap-1.5 rounded-lg border border-slate-200 bg-white/90 px-2.5 py-1.5 text-xs font-medium text-slate-600 shadow-sm backdrop-blur-sm transition hover:bg-slate-50 dark:border-slate-700 dark:bg-slate-800/90 dark:text-slate-300 dark:hover:bg-slate-700",
|
|
3110
3943
|
title: "在新窗口中打开当前预览",
|
|
3111
|
-
children: [/* @__PURE__ */ z(
|
|
3944
|
+
children: [/* @__PURE__ */ z(u, { className: "h-3.5 w-3.5" }), "新窗口"]
|
|
3112
3945
|
}), /* @__PURE__ */ B("button", {
|
|
3113
3946
|
onClick: () => f("editor"),
|
|
3114
3947
|
className: "inline-flex items-center gap-1.5 rounded-lg border border-slate-200 bg-white/90 px-2.5 py-1.5 text-xs font-medium text-slate-600 shadow-sm backdrop-blur-sm transition hover:bg-slate-50 dark:border-slate-700 dark:bg-slate-800/90 dark:text-slate-300 dark:hover:bg-slate-700",
|
|
3115
|
-
children: [/* @__PURE__ */ z(
|
|
3948
|
+
children: [/* @__PURE__ */ z(s, { className: "h-3.5 w-3.5" }), "编辑"]
|
|
3116
3949
|
})]
|
|
3117
3950
|
})]
|
|
3118
3951
|
});
|
|
3119
3952
|
}
|
|
3120
3953
|
//#endregion
|
|
3121
3954
|
//#region src/components/workspace/MarkdownPreview.tsx
|
|
3122
|
-
function
|
|
3955
|
+
function Gi(e) {
|
|
3123
3956
|
e.current && clearTimeout(e.current);
|
|
3124
3957
|
}
|
|
3125
|
-
function
|
|
3126
|
-
let [
|
|
3127
|
-
return
|
|
3958
|
+
function Ki({ content: e, path: t, onSave: n, onDirtyChange: r, getContentRef: i, isMobile: a }) {
|
|
3959
|
+
let [o, c] = q("editor"), [l, u] = q(e), f = K(null);
|
|
3960
|
+
return G(() => (Gi(f), f.current = setTimeout(() => u(e), 300), () => Gi(f)), [e]), a ? /* @__PURE__ */ B("div", {
|
|
3128
3961
|
className: "flex h-full flex-col",
|
|
3129
3962
|
children: [/* @__PURE__ */ B("div", {
|
|
3130
3963
|
className: "flex items-center gap-1 border-b border-slate-200/30 px-2 py-1.5 dark:border-slate-700/30",
|
|
3131
3964
|
children: [/* @__PURE__ */ B("button", {
|
|
3132
3965
|
onClick: () => c("editor"),
|
|
3133
|
-
className: Y("flex items-center gap-1.5 rounded-md px-3 py-1 text-xs font-medium transition-colors",
|
|
3134
|
-
children: [/* @__PURE__ */ z(
|
|
3966
|
+
className: Y("flex items-center gap-1.5 rounded-md px-3 py-1 text-xs font-medium transition-colors", o === "editor" ? "bg-slate-100 text-slate-900 dark:bg-slate-700 dark:text-slate-100" : "text-slate-500 hover:bg-slate-50 dark:text-slate-400 dark:hover:bg-slate-800"),
|
|
3967
|
+
children: [/* @__PURE__ */ z(s, { className: "h-3.5 w-3.5" }), "编辑"]
|
|
3135
3968
|
}), /* @__PURE__ */ B("button", {
|
|
3136
3969
|
onClick: () => c("preview"),
|
|
3137
|
-
className: Y("flex items-center gap-1.5 rounded-md px-3 py-1 text-xs font-medium transition-colors",
|
|
3138
|
-
children: [/* @__PURE__ */ z(
|
|
3970
|
+
className: Y("flex items-center gap-1.5 rounded-md px-3 py-1 text-xs font-medium transition-colors", o === "preview" ? "bg-slate-100 text-slate-900 dark:bg-slate-700 dark:text-slate-100" : "text-slate-500 hover:bg-slate-50 dark:text-slate-400 dark:hover:bg-slate-800"),
|
|
3971
|
+
children: [/* @__PURE__ */ z(d, { className: "h-3.5 w-3.5" }), "预览"]
|
|
3139
3972
|
})]
|
|
3140
|
-
}),
|
|
3973
|
+
}), o === "editor" ? /* @__PURE__ */ z(hi, {
|
|
3141
3974
|
content: e,
|
|
3142
3975
|
path: t,
|
|
3143
3976
|
onSave: n,
|
|
@@ -3145,11 +3978,11 @@ function ai({ content: e, path: t, onSave: n, onDirtyChange: r, getContentRef: i
|
|
|
3145
3978
|
getContentRef: i
|
|
3146
3979
|
}) : /* @__PURE__ */ z("div", {
|
|
3147
3980
|
className: "flex-1 overflow-auto p-4",
|
|
3148
|
-
children: /* @__PURE__ */ z(Z, { content:
|
|
3981
|
+
children: /* @__PURE__ */ z(Z, { content: l })
|
|
3149
3982
|
})]
|
|
3150
|
-
}) :
|
|
3983
|
+
}) : o === "editor" ? /* @__PURE__ */ B("div", {
|
|
3151
3984
|
className: "relative flex h-full flex-col",
|
|
3152
|
-
children: [/* @__PURE__ */ z(
|
|
3985
|
+
children: [/* @__PURE__ */ z(hi, {
|
|
3153
3986
|
content: e,
|
|
3154
3987
|
path: t,
|
|
3155
3988
|
onSave: n,
|
|
@@ -3158,39 +3991,39 @@ function ai({ content: e, path: t, onSave: n, onDirtyChange: r, getContentRef: i
|
|
|
3158
3991
|
}), /* @__PURE__ */ B("button", {
|
|
3159
3992
|
onClick: () => c("preview"),
|
|
3160
3993
|
className: "absolute right-3 top-3 z-10 inline-flex items-center gap-1.5 rounded-lg border border-slate-200/30 bg-white/90 px-2.5 py-1.5 text-xs font-medium text-slate-600 shadow-sm backdrop-blur-sm transition hover:bg-slate-50 dark:border-slate-700 dark:bg-slate-800/90 dark:text-slate-300 dark:hover:bg-slate-700",
|
|
3161
|
-
children: [/* @__PURE__ */ z(
|
|
3994
|
+
children: [/* @__PURE__ */ z(d, { className: "h-3.5 w-3.5" }), "预览"]
|
|
3162
3995
|
})]
|
|
3163
3996
|
}) : /* @__PURE__ */ B("div", {
|
|
3164
3997
|
className: "relative flex h-full flex-col",
|
|
3165
3998
|
children: [/* @__PURE__ */ z("div", {
|
|
3166
3999
|
className: "flex-1 overflow-auto p-4",
|
|
3167
|
-
children: /* @__PURE__ */ z(Z, { content:
|
|
4000
|
+
children: /* @__PURE__ */ z(Z, { content: l })
|
|
3168
4001
|
}), /* @__PURE__ */ B("button", {
|
|
3169
4002
|
onClick: () => c("editor"),
|
|
3170
4003
|
className: "absolute right-3 top-3 z-10 inline-flex items-center gap-1.5 rounded-lg border border-slate-200/30 bg-white/90 px-2.5 py-1.5 text-xs font-medium text-slate-600 shadow-sm backdrop-blur-sm transition hover:bg-slate-50 dark:border-slate-700 dark:bg-slate-800/90 dark:text-slate-300 dark:hover:bg-slate-700",
|
|
3171
|
-
children: [/* @__PURE__ */ z(
|
|
4004
|
+
children: [/* @__PURE__ */ z(s, { className: "h-3.5 w-3.5" }), "编辑"]
|
|
3172
4005
|
})]
|
|
3173
4006
|
});
|
|
3174
4007
|
}
|
|
3175
4008
|
//#endregion
|
|
3176
4009
|
//#region src/components/workspace/WorkspacePanel.tsx
|
|
3177
|
-
var
|
|
3178
|
-
function
|
|
4010
|
+
var qi = "/agentengine/api/v1/GetWorkspaceFileContent", Ji = 4e3;
|
|
4011
|
+
function Yi(e) {
|
|
3179
4012
|
let t = $(e);
|
|
3180
4013
|
if (!t || t === ".") return ".";
|
|
3181
4014
|
let n = t.split("/").filter(Boolean);
|
|
3182
4015
|
return n.length <= 1 ? "." : n.slice(0, -1).join("/");
|
|
3183
4016
|
}
|
|
3184
|
-
function
|
|
4017
|
+
function Xi(e) {
|
|
3185
4018
|
if (!e) return "";
|
|
3186
4019
|
let t = Date.parse(e);
|
|
3187
4020
|
return Number.isNaN(t) ? e : new Date(t).toLocaleString();
|
|
3188
4021
|
}
|
|
3189
|
-
function
|
|
4022
|
+
function Zi(e) {
|
|
3190
4023
|
let t = Number(e);
|
|
3191
4024
|
return !Number.isFinite(t) || t <= 0 ? "0 B" : t < 1024 ? `${t} B` : t < 1024 * 1024 ? `${(t / 1024).toFixed(1)} KB` : t < 1024 * 1024 * 1024 ? `${(t / (1024 * 1024)).toFixed(1)} MB` : `${(t / (1024 * 1024 * 1024)).toFixed(1)} GB`;
|
|
3192
4025
|
}
|
|
3193
|
-
var
|
|
4026
|
+
var Qi = [
|
|
3194
4027
|
{
|
|
3195
4028
|
label: "Markdown",
|
|
3196
4029
|
detail: ".md .markdown .mdx"
|
|
@@ -3212,10 +4045,10 @@ var di = [
|
|
|
3212
4045
|
detail: "CSV TSV"
|
|
3213
4046
|
}
|
|
3214
4047
|
];
|
|
3215
|
-
function
|
|
3216
|
-
return
|
|
4048
|
+
function $i(e) {
|
|
4049
|
+
return ji(e);
|
|
3217
4050
|
}
|
|
3218
|
-
function
|
|
4051
|
+
function ea({ label: e, showSupportedTypes: t = !1 }) {
|
|
3219
4052
|
return /* @__PURE__ */ z("div", {
|
|
3220
4053
|
className: "flex h-full min-h-[16rem] flex-col items-center justify-center px-6 text-center",
|
|
3221
4054
|
children: /* @__PURE__ */ B("div", {
|
|
@@ -3229,7 +4062,7 @@ function pi({ label: e, showSupportedTypes: t = !1 }) {
|
|
|
3229
4062
|
}),
|
|
3230
4063
|
/* @__PURE__ */ z("div", {
|
|
3231
4064
|
className: "mt-2 grid gap-2",
|
|
3232
|
-
children:
|
|
4065
|
+
children: Qi.map((e) => /* @__PURE__ */ B("div", {
|
|
3233
4066
|
className: "rounded-xl border border-slate-200 bg-white px-3 py-2 dark:border-slate-800 dark:bg-slate-950",
|
|
3234
4067
|
children: [/* @__PURE__ */ z("div", {
|
|
3235
4068
|
className: "text-sm font-medium text-slate-700 dark:text-slate-200",
|
|
@@ -3249,20 +4082,20 @@ function pi({ label: e, showSupportedTypes: t = !1 }) {
|
|
|
3249
4082
|
})
|
|
3250
4083
|
});
|
|
3251
4084
|
}
|
|
3252
|
-
function
|
|
3253
|
-
let
|
|
3254
|
-
path:
|
|
3255
|
-
mimeType:
|
|
3256
|
-
}) : null, [
|
|
3257
|
-
|
|
4085
|
+
function ta({ agentId: e, capability: n, open: r, onClose: i, isFullscreen: a = !1, onToggleFullscreen: o, isMobile: s = !1, api: c }) {
|
|
4086
|
+
let u = K(null), d = K(null), [p, g] = q(!1), [_, y] = q("."), [x, C] = q([]), [w, T] = q(!1), [te, D] = q(!1), [ne, re] = q(!1), [ie, O] = q(""), [k, se] = q(null), [A, j] = q(null), [M, N] = q(!1), [ce, le] = q(!1), P = K(null), ue = K(null), de = K("selection"), F = K(Hi()), I = Se(() => x.find((e) => e.Path === k) ?? null, [x, k]), L = Se(() => I ? Bi({
|
|
4087
|
+
path: I.Path,
|
|
4088
|
+
mimeType: I.MimeType
|
|
4089
|
+
}) : null, [I]), he = W(() => M ? window.confirm("当前文件有未保存的更改,确定要离开吗?") : !0, [M]), ge = n.ContentPath || qi, _e = n.RootLabel || "Workspace", ve = _e ? `${_e.charAt(0).toUpperCase()}${_e.slice(1)}` : "Workspace", R = Pi(_), V = W(() => {
|
|
4090
|
+
d.current &&= (URL.revokeObjectURL(d.current), null);
|
|
3258
4091
|
}, []);
|
|
3259
|
-
|
|
3260
|
-
let
|
|
4092
|
+
G(() => () => V(), [V]);
|
|
4093
|
+
let H = W(async (t, n = {}) => {
|
|
3261
4094
|
let r = !!n.background;
|
|
3262
|
-
r ?
|
|
4095
|
+
r ? D(!0) : T(!0), r || O("");
|
|
3263
4096
|
try {
|
|
3264
|
-
let n = await
|
|
3265
|
-
|
|
4097
|
+
let n = await c.listWorkspaceFiles(e, t, !1), i = $(String(n?.Path || t || ".")), a = Array.isArray(n?.Entries) ? n.Entries : [];
|
|
4098
|
+
y(i), C(a), de.current = r ? "background-refresh" : "selection", se((e) => {
|
|
3266
4099
|
if (e) {
|
|
3267
4100
|
let t = a.find((t) => t.Path === e);
|
|
3268
4101
|
if (t && t.Type === "file") return e;
|
|
@@ -3270,37 +4103,37 @@ function mi({ agentId: e, capability: n, open: r, onClose: i, isFullscreen: a =
|
|
|
3270
4103
|
return a.find((e) => e.Type === "file")?.Path ?? null;
|
|
3271
4104
|
});
|
|
3272
4105
|
} catch (e) {
|
|
3273
|
-
console.error("Failed to load workspace entries:", e), r ||
|
|
4106
|
+
console.error("Failed to load workspace entries:", e), r || O(e instanceof Error ? e.message : String(e));
|
|
3274
4107
|
} finally {
|
|
3275
|
-
r ?
|
|
4108
|
+
r ? D(!1) : T(!1);
|
|
3276
4109
|
}
|
|
3277
|
-
}, [e,
|
|
3278
|
-
|
|
3279
|
-
!r ||
|
|
4110
|
+
}, [e, c]);
|
|
4111
|
+
G(() => {
|
|
4112
|
+
!r || p || (g(!0), H("."));
|
|
3280
4113
|
}, [
|
|
3281
|
-
|
|
3282
|
-
|
|
4114
|
+
p,
|
|
4115
|
+
H,
|
|
3283
4116
|
r
|
|
3284
|
-
]),
|
|
3285
|
-
if (!r ||
|
|
4117
|
+
]), G(() => {
|
|
4118
|
+
if (!r || M || !p) return;
|
|
3286
4119
|
let e = window.setInterval(() => {
|
|
3287
|
-
|
|
3288
|
-
},
|
|
4120
|
+
H(_, { background: !0 });
|
|
4121
|
+
}, Ji);
|
|
3289
4122
|
return () => window.clearInterval(e);
|
|
3290
4123
|
}, [
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
4124
|
+
_,
|
|
4125
|
+
M,
|
|
4126
|
+
p,
|
|
4127
|
+
H,
|
|
3295
4128
|
r
|
|
3296
4129
|
]);
|
|
3297
|
-
let
|
|
3298
|
-
let n =
|
|
4130
|
+
let U = W(async (t) => {
|
|
4131
|
+
let n = F.current.next(t.Path), r = Ri({
|
|
3299
4132
|
path: t.Path,
|
|
3300
4133
|
mimeType: t.MimeType
|
|
3301
4134
|
});
|
|
3302
|
-
if (
|
|
3303
|
-
|
|
4135
|
+
if (ue.current = t.Path, r === "unsupported") {
|
|
4136
|
+
V(), j({
|
|
3304
4137
|
path: t.Path,
|
|
3305
4138
|
kind: r,
|
|
3306
4139
|
status: "ready",
|
|
@@ -3308,23 +4141,23 @@ function mi({ agentId: e, capability: n, open: r, onClose: i, isFullscreen: a =
|
|
|
3308
4141
|
});
|
|
3309
4142
|
return;
|
|
3310
4143
|
}
|
|
3311
|
-
|
|
4144
|
+
V(), j({
|
|
3312
4145
|
path: t.Path,
|
|
3313
4146
|
kind: r,
|
|
3314
4147
|
status: "loading",
|
|
3315
4148
|
mimeType: t.MimeType ?? void 0
|
|
3316
4149
|
});
|
|
3317
4150
|
try {
|
|
3318
|
-
let r = await
|
|
3319
|
-
if (!
|
|
4151
|
+
let r = await c.getWorkspaceFileContent(e, t.Path, { asText: !1 });
|
|
4152
|
+
if (!F.current.isCurrent(n)) return;
|
|
3320
4153
|
if (r instanceof Blob) {
|
|
3321
|
-
let e = t.MimeType || "", i =
|
|
4154
|
+
let e = t.MimeType || "", i = Ri({
|
|
3322
4155
|
path: t.Path,
|
|
3323
4156
|
mimeType: e
|
|
3324
4157
|
});
|
|
3325
4158
|
if (i === "image" || i === "pdf") {
|
|
3326
4159
|
let n = URL.createObjectURL(r);
|
|
3327
|
-
|
|
4160
|
+
d.current = n, j({
|
|
3328
4161
|
path: t.Path,
|
|
3329
4162
|
kind: i,
|
|
3330
4163
|
status: "ready",
|
|
@@ -3334,12 +4167,12 @@ function mi({ agentId: e, capability: n, open: r, onClose: i, isFullscreen: a =
|
|
|
3334
4167
|
return;
|
|
3335
4168
|
}
|
|
3336
4169
|
let a = await r.text();
|
|
3337
|
-
if (!
|
|
3338
|
-
let o =
|
|
4170
|
+
if (!F.current.isCurrent(n)) return;
|
|
4171
|
+
let o = Ri({
|
|
3339
4172
|
path: t.Path,
|
|
3340
4173
|
mimeType: e
|
|
3341
4174
|
});
|
|
3342
|
-
|
|
4175
|
+
j({
|
|
3343
4176
|
path: t.Path,
|
|
3344
4177
|
kind: o,
|
|
3345
4178
|
status: "ready",
|
|
@@ -3347,11 +4180,11 @@ function mi({ agentId: e, capability: n, open: r, onClose: i, isFullscreen: a =
|
|
|
3347
4180
|
content: a
|
|
3348
4181
|
});
|
|
3349
4182
|
} else {
|
|
3350
|
-
let e = t.MimeType || "", n =
|
|
4183
|
+
let e = t.MimeType || "", n = Ri({
|
|
3351
4184
|
path: t.Path,
|
|
3352
4185
|
mimeType: e
|
|
3353
4186
|
});
|
|
3354
|
-
|
|
4187
|
+
j({
|
|
3355
4188
|
path: t.Path,
|
|
3356
4189
|
kind: n,
|
|
3357
4190
|
status: "ready",
|
|
@@ -3360,8 +4193,8 @@ function mi({ agentId: e, capability: n, open: r, onClose: i, isFullscreen: a =
|
|
|
3360
4193
|
});
|
|
3361
4194
|
}
|
|
3362
4195
|
} catch (e) {
|
|
3363
|
-
if (!
|
|
3364
|
-
console.error("Failed to preview workspace file:", e),
|
|
4196
|
+
if (!F.current.isCurrent(n)) return;
|
|
4197
|
+
console.error("Failed to preview workspace file:", e), j({
|
|
3365
4198
|
path: t.Path,
|
|
3366
4199
|
kind: r,
|
|
3367
4200
|
status: "error",
|
|
@@ -3371,115 +4204,115 @@ function mi({ agentId: e, capability: n, open: r, onClose: i, isFullscreen: a =
|
|
|
3371
4204
|
}
|
|
3372
4205
|
}, [
|
|
3373
4206
|
e,
|
|
3374
|
-
|
|
3375
|
-
|
|
4207
|
+
c,
|
|
4208
|
+
V
|
|
3376
4209
|
]);
|
|
3377
|
-
|
|
3378
|
-
if (!
|
|
3379
|
-
|
|
4210
|
+
G(() => {
|
|
4211
|
+
if (!I || I.Type !== "file") {
|
|
4212
|
+
V(), j(null), N(!1), ue.current = null;
|
|
3380
4213
|
return;
|
|
3381
4214
|
}
|
|
3382
|
-
if (
|
|
3383
|
-
|
|
4215
|
+
if (de.current === "background-refresh" && ue.current === I.Path) {
|
|
4216
|
+
de.current = "selection";
|
|
3384
4217
|
return;
|
|
3385
4218
|
}
|
|
3386
|
-
|
|
4219
|
+
de.current = "selection", U(I);
|
|
3387
4220
|
}, [
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
4221
|
+
V,
|
|
4222
|
+
U,
|
|
4223
|
+
I
|
|
3391
4224
|
]);
|
|
3392
4225
|
let ye = async (t) => {
|
|
3393
4226
|
if (!(!t || t.length === 0)) {
|
|
3394
|
-
|
|
4227
|
+
re(!0), O("");
|
|
3395
4228
|
try {
|
|
3396
4229
|
for (let r of Array.from(t)) {
|
|
3397
4230
|
if (r.size > n.MaxUploadBytes) throw Error(`文件 ${r.name} 超过上传上限`);
|
|
3398
|
-
let t =
|
|
3399
|
-
i.append("file", r), i.append("AgentId", e), i.append("Path", t), await
|
|
4231
|
+
let t = Ni(_) ? r.name : `${_}/${r.name}`, i = new FormData();
|
|
4232
|
+
i.append("file", r), i.append("AgentId", e), i.append("Path", t), await c.addWorkspaceFile(i);
|
|
3400
4233
|
}
|
|
3401
|
-
await
|
|
4234
|
+
await H(_);
|
|
3402
4235
|
} catch (e) {
|
|
3403
|
-
console.error("Failed to upload workspace files:", e),
|
|
4236
|
+
console.error("Failed to upload workspace files:", e), O(e instanceof Error ? e.message : String(e));
|
|
3404
4237
|
} finally {
|
|
3405
|
-
|
|
4238
|
+
u.current && (u.current.value = ""), re(!1);
|
|
3406
4239
|
}
|
|
3407
4240
|
}
|
|
3408
4241
|
}, be = async (t) => {
|
|
3409
4242
|
if (!n.SupportsDelete) return;
|
|
3410
4243
|
let r = $(t.Path);
|
|
3411
4244
|
if (window.confirm(`删除 ${r} ?`)) {
|
|
3412
|
-
|
|
4245
|
+
O("");
|
|
3413
4246
|
try {
|
|
3414
|
-
await
|
|
4247
|
+
await c.deleteWorkspaceFile(e, r), k && $(k) === r && (se(null), N(!1)), await H(t.Type === "directory" && ($(_) === r || $(_).startsWith(`${r}/`)) ? Yi(r) : _);
|
|
3415
4248
|
} catch (e) {
|
|
3416
|
-
console.error("Failed to delete workspace file:", e),
|
|
4249
|
+
console.error("Failed to delete workspace file:", e), O(e instanceof Error ? e.message : String(e));
|
|
3417
4250
|
}
|
|
3418
4251
|
}
|
|
3419
|
-
}, xe = () => !
|
|
4252
|
+
}, xe = () => !I || I.Type !== "file" ? /* @__PURE__ */ z(ea, {
|
|
3420
4253
|
label: "从左侧选择文件后在这里查看内容预览。",
|
|
3421
4254
|
showSupportedTypes: !0
|
|
3422
|
-
}) : !
|
|
4255
|
+
}) : !A || A.path !== I.Path || A.status === "loading" ? /* @__PURE__ */ z("div", {
|
|
3423
4256
|
className: "flex h-full min-h-[16rem] items-center justify-center",
|
|
3424
4257
|
children: /* @__PURE__ */ B("div", {
|
|
3425
4258
|
className: "inline-flex items-center gap-2 rounded-full border border-slate-200 bg-white px-4 py-2 text-sm text-slate-500 shadow-sm dark:border-slate-800 dark:bg-slate-900 dark:text-slate-400",
|
|
3426
|
-
children: [/* @__PURE__ */ z(
|
|
4259
|
+
children: [/* @__PURE__ */ z(b, { className: "h-4 w-4 animate-spin" }), "正在加载预览..."]
|
|
3427
4260
|
})
|
|
3428
|
-
}) :
|
|
3429
|
-
content:
|
|
3430
|
-
path:
|
|
3431
|
-
onSave:
|
|
3432
|
-
onDirtyChange:
|
|
3433
|
-
getContentRef:
|
|
3434
|
-
isMobile:
|
|
3435
|
-
}) :
|
|
4261
|
+
}) : A.status === "error" ? /* @__PURE__ */ z(ea, { label: A.error || "文件预览加载失败。" }) : A.kind === "markdown" ? /* @__PURE__ */ z(Ki, {
|
|
4262
|
+
content: A.content || "",
|
|
4263
|
+
path: I.Path,
|
|
4264
|
+
onSave: J,
|
|
4265
|
+
onDirtyChange: N,
|
|
4266
|
+
getContentRef: P,
|
|
4267
|
+
isMobile: s
|
|
4268
|
+
}) : A.kind === "image" && A.objectUrl ? /* @__PURE__ */ z(gi, {
|
|
3436
4269
|
content: null,
|
|
3437
|
-
objectUrl:
|
|
4270
|
+
objectUrl: A.objectUrl,
|
|
3438
4271
|
kind: "image",
|
|
3439
|
-
filename:
|
|
3440
|
-
mimeType:
|
|
3441
|
-
}) :
|
|
4272
|
+
filename: I.Name,
|
|
4273
|
+
mimeType: A.mimeType || ""
|
|
4274
|
+
}) : A.kind === "pdf" && A.objectUrl ? /* @__PURE__ */ z(gi, {
|
|
3442
4275
|
content: null,
|
|
3443
|
-
objectUrl:
|
|
4276
|
+
objectUrl: A.objectUrl,
|
|
3444
4277
|
kind: "pdf",
|
|
3445
|
-
filename:
|
|
3446
|
-
mimeType:
|
|
3447
|
-
}) :
|
|
3448
|
-
content:
|
|
3449
|
-
path:
|
|
3450
|
-
onSave:
|
|
3451
|
-
onDirtyChange:
|
|
3452
|
-
getContentRef:
|
|
3453
|
-
isMobile:
|
|
4278
|
+
filename: I.Name,
|
|
4279
|
+
mimeType: A.mimeType || ""
|
|
4280
|
+
}) : A.kind === "html" ? /* @__PURE__ */ z(Wi, {
|
|
4281
|
+
content: A.content || "",
|
|
4282
|
+
path: I.Path,
|
|
4283
|
+
onSave: J,
|
|
4284
|
+
onDirtyChange: N,
|
|
4285
|
+
getContentRef: P,
|
|
4286
|
+
isMobile: s,
|
|
3454
4287
|
agentId: e,
|
|
3455
|
-
contentPath:
|
|
3456
|
-
}) :
|
|
3457
|
-
content:
|
|
3458
|
-
path:
|
|
3459
|
-
onSave:
|
|
3460
|
-
onDirtyChange:
|
|
3461
|
-
getContentRef:
|
|
3462
|
-
}) : /* @__PURE__ */ z(
|
|
4288
|
+
contentPath: ge
|
|
4289
|
+
}) : A.kind === "text" || A.kind === "code" ? /* @__PURE__ */ z(hi, {
|
|
4290
|
+
content: A.content || "",
|
|
4291
|
+
path: I.Path,
|
|
4292
|
+
onSave: J,
|
|
4293
|
+
onDirtyChange: N,
|
|
4294
|
+
getContentRef: P
|
|
4295
|
+
}) : /* @__PURE__ */ z(gi, {
|
|
3463
4296
|
content: null,
|
|
3464
4297
|
kind: "unsupported",
|
|
3465
|
-
filename:
|
|
3466
|
-
mimeType:
|
|
3467
|
-
}),
|
|
3468
|
-
if (
|
|
3469
|
-
|
|
4298
|
+
filename: I.Name,
|
|
4299
|
+
mimeType: A.mimeType || ""
|
|
4300
|
+
}), J = async (t) => {
|
|
4301
|
+
if (I) {
|
|
4302
|
+
le(!0), O("");
|
|
3470
4303
|
try {
|
|
3471
|
-
let n = new Blob([t], { type:
|
|
3472
|
-
r.append("file", n,
|
|
4304
|
+
let n = new Blob([t], { type: I.MimeType || "text/plain" }), r = new FormData();
|
|
4305
|
+
r.append("file", n, I.Name), r.append("AgentId", e), r.append("Path", I.Path), await c.addWorkspaceFile(r), F.current.invalidate(), N(!1), j((e) => e && e.path === I.Path ? {
|
|
3473
4306
|
...e,
|
|
3474
4307
|
content: t
|
|
3475
|
-
} : e),
|
|
4308
|
+
} : e), ue.current = I.Path, await H(_, { background: !0 });
|
|
3476
4309
|
} catch (e) {
|
|
3477
|
-
console.error("Failed to save workspace file:", e),
|
|
4310
|
+
console.error("Failed to save workspace file:", e), O(e instanceof Error ? e.message : String(e));
|
|
3478
4311
|
} finally {
|
|
3479
|
-
|
|
4312
|
+
le(!1);
|
|
3480
4313
|
}
|
|
3481
4314
|
}
|
|
3482
|
-
}, Ce =
|
|
4315
|
+
}, Ce = I?.Type === "file" && A?.path === I.Path && A.status === "ready" && (A.kind === "text" || A.kind === "code" || A.kind === "html" || A.kind === "markdown"), we = I?.Type === "file" && A?.path === I.Path && A.status === "ready" && A.kind === "pdf";
|
|
3483
4316
|
return /* @__PURE__ */ B("div", {
|
|
3484
4317
|
className: "flex h-full min-h-[22rem] w-full min-w-0 flex-col bg-white text-slate-800 dark:bg-slate-950 dark:text-slate-200",
|
|
3485
4318
|
children: [/* @__PURE__ */ B("div", {
|
|
@@ -3489,7 +4322,7 @@ function mi({ agentId: e, capability: n, open: r, onClose: i, isFullscreen: a =
|
|
|
3489
4322
|
children: [
|
|
3490
4323
|
/* @__PURE__ */ z("div", {
|
|
3491
4324
|
className: "truncate text-sm font-semibold text-slate-900 dark:text-slate-100",
|
|
3492
|
-
children:
|
|
4325
|
+
children: ve
|
|
3493
4326
|
}),
|
|
3494
4327
|
/* @__PURE__ */ z("div", { className: "hidden h-4 w-px bg-slate-200/70 dark:bg-slate-800 sm:block" }),
|
|
3495
4328
|
/* @__PURE__ */ B("div", {
|
|
@@ -3499,8 +4332,8 @@ function mi({ agentId: e, capability: n, open: r, onClose: i, isFullscreen: a =
|
|
|
3499
4332
|
children: "当前目录"
|
|
3500
4333
|
}), /* @__PURE__ */ z("div", {
|
|
3501
4334
|
className: "custom-scrollbar max-w-[min(42vw,34rem)] overflow-x-auto whitespace-nowrap rounded-md bg-slate-50 px-2 py-1 font-mono text-[11px] text-slate-600 dark:bg-slate-900 dark:text-slate-300",
|
|
3502
|
-
title: `${
|
|
3503
|
-
children:
|
|
4335
|
+
title: `${R},来自 ListWorkspaceFiles 返回的 Data.Path 字段`,
|
|
4336
|
+
children: R
|
|
3504
4337
|
})]
|
|
3505
4338
|
}),
|
|
3506
4339
|
/* @__PURE__ */ z("div", {
|
|
@@ -3512,7 +4345,7 @@ function mi({ agentId: e, capability: n, open: r, onClose: i, isFullscreen: a =
|
|
|
3512
4345
|
className: "flex flex-shrink-0 items-center gap-1.5",
|
|
3513
4346
|
children: [
|
|
3514
4347
|
/* @__PURE__ */ z("input", {
|
|
3515
|
-
ref:
|
|
4348
|
+
ref: u,
|
|
3516
4349
|
type: "file",
|
|
3517
4350
|
multiple: !0,
|
|
3518
4351
|
className: "hidden",
|
|
@@ -3520,21 +4353,21 @@ function mi({ agentId: e, capability: n, open: r, onClose: i, isFullscreen: a =
|
|
|
3520
4353
|
}),
|
|
3521
4354
|
/* @__PURE__ */ B("button", {
|
|
3522
4355
|
type: "button",
|
|
3523
|
-
onClick: () =>
|
|
3524
|
-
disabled:
|
|
4356
|
+
onClick: () => u.current?.click(),
|
|
4357
|
+
disabled: ne,
|
|
3525
4358
|
className: "inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium text-slate-600 transition hover:bg-slate-100 disabled:cursor-not-allowed disabled:opacity-50 dark:text-slate-300 dark:hover:bg-slate-900",
|
|
3526
4359
|
title: `上传文件,上限 ${Math.floor(n.MaxUploadBytes / (1024 * 1024))}MB`,
|
|
3527
|
-
children: [/* @__PURE__ */ z(
|
|
4360
|
+
children: [/* @__PURE__ */ z(pe, { className: "h-3.5 w-3.5" }), ne ? "上传中" : "上传"]
|
|
3528
4361
|
}),
|
|
3529
4362
|
/* @__PURE__ */ B("button", {
|
|
3530
4363
|
type: "button",
|
|
3531
4364
|
onClick: () => {
|
|
3532
|
-
let e = new URLSearchParams({ Path:
|
|
4365
|
+
let e = new URLSearchParams({ Path: _ }).toString();
|
|
3533
4366
|
window.open(`/agentengine/api/v1/ExportWorkspaceZip?${e}`, "_blank", "noopener,noreferrer");
|
|
3534
4367
|
},
|
|
3535
4368
|
className: "inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium text-slate-600 transition hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-slate-900",
|
|
3536
4369
|
title: "导出当前目录为 ZIP",
|
|
3537
|
-
children: [/* @__PURE__ */ z(
|
|
4370
|
+
children: [/* @__PURE__ */ z(E, { className: "h-3.5 w-3.5" }), "导出"]
|
|
3538
4371
|
}),
|
|
3539
4372
|
o ? /* @__PURE__ */ z("button", {
|
|
3540
4373
|
type: "button",
|
|
@@ -3542,17 +4375,17 @@ function mi({ agentId: e, capability: n, open: r, onClose: i, isFullscreen: a =
|
|
|
3542
4375
|
className: "rounded-lg p-1.5 text-slate-500 transition hover:bg-slate-100 hover:text-slate-900 dark:text-slate-400 dark:hover:bg-slate-900 dark:hover:text-slate-100",
|
|
3543
4376
|
"aria-label": a ? "退出全屏" : "全屏查看 Workspace",
|
|
3544
4377
|
title: a ? "退出全屏" : "全屏查看",
|
|
3545
|
-
children: z(a ?
|
|
4378
|
+
children: z(a ? ee : S, { className: "h-4 w-4" })
|
|
3546
4379
|
}) : null,
|
|
3547
4380
|
i ? /* @__PURE__ */ z("button", {
|
|
3548
4381
|
type: "button",
|
|
3549
4382
|
onClick: () => {
|
|
3550
|
-
|
|
4383
|
+
he() && i?.();
|
|
3551
4384
|
},
|
|
3552
4385
|
className: "rounded-lg p-1.5 text-slate-500 transition hover:bg-slate-100 hover:text-slate-900 dark:text-slate-400 dark:hover:bg-slate-900 dark:hover:text-slate-100",
|
|
3553
4386
|
"aria-label": "关闭 Workspace",
|
|
3554
4387
|
title: "关闭",
|
|
3555
|
-
children: /* @__PURE__ */ z(
|
|
4388
|
+
children: /* @__PURE__ */ z(me, { className: "h-4 w-4" })
|
|
3556
4389
|
}) : null
|
|
3557
4390
|
]
|
|
3558
4391
|
})]
|
|
@@ -3571,7 +4404,7 @@ function mi({ agentId: e, capability: n, open: r, onClose: i, isFullscreen: a =
|
|
|
3571
4404
|
children: "文件"
|
|
3572
4405
|
}), /* @__PURE__ */ B("div", {
|
|
3573
4406
|
className: "flex items-center gap-1 text-[11px] text-slate-400",
|
|
3574
|
-
children: [/* @__PURE__ */ B("span", { children: [
|
|
4407
|
+
children: [/* @__PURE__ */ B("span", { children: [x.length, " 项"] }), te ? /* @__PURE__ */ z(ae, {
|
|
3575
4408
|
className: "h-3 w-3 animate-spin",
|
|
3576
4409
|
"aria-label": "正在同步 Workspace 目录"
|
|
3577
4410
|
}) : null]
|
|
@@ -3581,45 +4414,45 @@ function mi({ agentId: e, capability: n, open: r, onClose: i, isFullscreen: a =
|
|
|
3581
4414
|
children: [/* @__PURE__ */ z("button", {
|
|
3582
4415
|
type: "button",
|
|
3583
4416
|
onClick: () => {
|
|
3584
|
-
|
|
4417
|
+
he() && H(Yi(_));
|
|
3585
4418
|
},
|
|
3586
|
-
disabled:
|
|
4419
|
+
disabled: w || Ni(_),
|
|
3587
4420
|
className: "rounded-md p-1.5 text-slate-500 transition hover:bg-slate-100 disabled:cursor-not-allowed disabled:opacity-40 dark:text-slate-400 dark:hover:bg-slate-900",
|
|
3588
4421
|
title: "返回上级目录",
|
|
3589
4422
|
children: /* @__PURE__ */ z(t, { className: "h-4 w-4" })
|
|
3590
4423
|
}), /* @__PURE__ */ z("button", {
|
|
3591
4424
|
type: "button",
|
|
3592
4425
|
onClick: () => {
|
|
3593
|
-
|
|
4426
|
+
he() && H(_);
|
|
3594
4427
|
},
|
|
3595
|
-
disabled:
|
|
4428
|
+
disabled: w,
|
|
3596
4429
|
className: "rounded-md p-1.5 text-slate-500 transition hover:bg-slate-100 disabled:cursor-not-allowed disabled:opacity-40 dark:text-slate-400 dark:hover:bg-slate-900",
|
|
3597
4430
|
title: "刷新目录",
|
|
3598
|
-
children: /* @__PURE__ */ z(
|
|
4431
|
+
children: /* @__PURE__ */ z(ae, { className: `h-4 w-4 ${w ? "animate-spin" : ""}` })
|
|
3599
4432
|
})]
|
|
3600
4433
|
})]
|
|
3601
|
-
}),
|
|
4434
|
+
}), ie ? /* @__PURE__ */ z("div", {
|
|
3602
4435
|
className: "mt-3 rounded-xl border border-red-200 bg-red-50 px-3 py-2 text-xs text-red-600 dark:border-red-900/60 dark:bg-red-950/40 dark:text-red-300",
|
|
3603
|
-
children:
|
|
4436
|
+
children: ie
|
|
3604
4437
|
}) : null]
|
|
3605
4438
|
}), /* @__PURE__ */ z("div", {
|
|
3606
4439
|
className: "custom-scrollbar min-h-0 flex-1 overflow-y-auto px-2 py-2",
|
|
3607
|
-
children: !
|
|
4440
|
+
children: !p && !r ? /* @__PURE__ */ z("div", {
|
|
3608
4441
|
className: "px-3 py-4 text-sm text-slate-400",
|
|
3609
4442
|
children: "打开面板后加载 workspace 文件。"
|
|
3610
|
-
}) :
|
|
4443
|
+
}) : w ? /* @__PURE__ */ z("div", {
|
|
3611
4444
|
className: "px-3 py-4 text-sm text-slate-400",
|
|
3612
4445
|
children: "正在加载目录..."
|
|
3613
|
-
}) :
|
|
4446
|
+
}) : x.length === 0 ? /* @__PURE__ */ z("div", {
|
|
3614
4447
|
className: "px-3 py-4 text-sm text-slate-400",
|
|
3615
4448
|
children: "当前目录为空。"
|
|
3616
4449
|
}) : /* @__PURE__ */ z("div", {
|
|
3617
4450
|
className: "space-y-0.5",
|
|
3618
|
-
children:
|
|
3619
|
-
let t =
|
|
4451
|
+
children: x.map((e) => {
|
|
4452
|
+
let t = Ri({
|
|
3620
4453
|
path: e.Path,
|
|
3621
4454
|
mimeType: e.MimeType
|
|
3622
|
-
}), r =
|
|
4455
|
+
}), r = k === e.Path, i = e.Type === "file" ? $i(e.Path) : "";
|
|
3623
4456
|
return /* @__PURE__ */ B("div", {
|
|
3624
4457
|
title: e.Path,
|
|
3625
4458
|
className: Y("group flex items-center gap-1 rounded-lg px-1.5 py-1 transition", r ? "bg-slate-100 text-slate-950 dark:bg-slate-800 dark:text-slate-50" : "text-slate-700 hover:bg-slate-50 dark:text-slate-300 dark:hover:bg-slate-900"),
|
|
@@ -3627,15 +4460,15 @@ function mi({ agentId: e, capability: n, open: r, onClose: i, isFullscreen: a =
|
|
|
3627
4460
|
type: "button",
|
|
3628
4461
|
onClick: () => {
|
|
3629
4462
|
if (e.Type === "directory") {
|
|
3630
|
-
|
|
4463
|
+
H(e.Path);
|
|
3631
4464
|
return;
|
|
3632
4465
|
}
|
|
3633
|
-
|
|
4466
|
+
k !== e.Path && !he() || se(e.Path);
|
|
3634
4467
|
},
|
|
3635
4468
|
className: "flex min-w-0 flex-1 items-center gap-2 text-left",
|
|
3636
4469
|
children: [/* @__PURE__ */ z("div", {
|
|
3637
4470
|
className: Y("flex h-5 w-5 flex-shrink-0 items-center justify-center rounded-md", r ? "text-slate-900 dark:text-slate-50" : "text-slate-400 dark:text-slate-500"),
|
|
3638
|
-
children: e.Type === "directory" ? /* @__PURE__ */ z(
|
|
4471
|
+
children: e.Type === "directory" ? /* @__PURE__ */ z(h, { className: "h-3.5 w-3.5" }) : z(t === "image" ? v : t === "markdown" || t === "text" || t === "html" ? f : m, { className: "h-3.5 w-3.5" })
|
|
3639
4472
|
}), /* @__PURE__ */ B("div", {
|
|
3640
4473
|
className: "min-w-0 flex-1",
|
|
3641
4474
|
children: [/* @__PURE__ */ z("div", {
|
|
@@ -3643,7 +4476,7 @@ function mi({ agentId: e, capability: n, open: r, onClose: i, isFullscreen: a =
|
|
|
3643
4476
|
children: e.Name
|
|
3644
4477
|
}), /* @__PURE__ */ z("div", {
|
|
3645
4478
|
className: Y("truncate text-[11px] leading-4", r ? "text-slate-500 dark:text-slate-400" : "text-slate-400"),
|
|
3646
|
-
children: e.Type === "directory" ? "目录" :
|
|
4479
|
+
children: e.Type === "directory" ? "目录" : Zi(e.SizeBytes)
|
|
3647
4480
|
})]
|
|
3648
4481
|
})]
|
|
3649
4482
|
}), /* @__PURE__ */ B("div", {
|
|
@@ -3653,13 +4486,13 @@ function mi({ agentId: e, capability: n, open: r, onClose: i, isFullscreen: a =
|
|
|
3653
4486
|
download: e.Name,
|
|
3654
4487
|
className: Y("rounded-md p-1.5 transition", r ? "hover:bg-white dark:hover:bg-slate-700" : "hover:bg-slate-100 dark:hover:bg-slate-800"),
|
|
3655
4488
|
title: "下载",
|
|
3656
|
-
children: /* @__PURE__ */ z(
|
|
4489
|
+
children: /* @__PURE__ */ z(l, { className: "h-3.5 w-3.5" })
|
|
3657
4490
|
}) : null, n.SupportsDelete ? /* @__PURE__ */ z("button", {
|
|
3658
4491
|
type: "button",
|
|
3659
4492
|
onClick: () => void be(e),
|
|
3660
4493
|
className: Y("rounded-md p-1.5 transition", r ? "hover:bg-white dark:hover:bg-slate-700" : "hover:bg-slate-100 dark:hover:bg-slate-800"),
|
|
3661
4494
|
title: "删除",
|
|
3662
|
-
children: /* @__PURE__ */ z(
|
|
4495
|
+
children: /* @__PURE__ */ z(fe, { className: "h-3.5 w-3.5" })
|
|
3663
4496
|
}) : null]
|
|
3664
4497
|
})]
|
|
3665
4498
|
}, e.Path);
|
|
@@ -3670,37 +4503,37 @@ function mi({ agentId: e, capability: n, open: r, onClose: i, isFullscreen: a =
|
|
|
3670
4503
|
className: "flex min-h-0 min-w-0 flex-1 flex-col",
|
|
3671
4504
|
children: [/* @__PURE__ */ z("div", {
|
|
3672
4505
|
className: "flex h-14 flex-shrink-0 items-center border-b border-slate-200/30 px-4 dark:border-slate-800/40",
|
|
3673
|
-
children:
|
|
4506
|
+
children: I ? /* @__PURE__ */ B("div", {
|
|
3674
4507
|
className: "flex w-full items-start justify-between gap-3",
|
|
3675
4508
|
children: [/* @__PURE__ */ B("div", {
|
|
3676
4509
|
className: "min-w-0",
|
|
3677
4510
|
children: [
|
|
3678
4511
|
/* @__PURE__ */ z("div", {
|
|
3679
4512
|
className: "truncate text-sm font-semibold text-slate-900 dark:text-slate-100",
|
|
3680
|
-
children:
|
|
4513
|
+
children: I.Name
|
|
3681
4514
|
}),
|
|
3682
4515
|
/* @__PURE__ */ z("div", {
|
|
3683
4516
|
className: "mt-0.5 break-all font-mono text-[11px] text-slate-400",
|
|
3684
|
-
children:
|
|
4517
|
+
children: I.Path
|
|
3685
4518
|
}),
|
|
3686
4519
|
/* @__PURE__ */ B("div", {
|
|
3687
4520
|
className: "mt-1 text-[11px] text-slate-400",
|
|
3688
4521
|
children: [
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
4522
|
+
Zi(I.SizeBytes),
|
|
4523
|
+
I.MimeType ? ` · ${I.MimeType}` : "",
|
|
4524
|
+
I.ModifiedAt ? ` · ${Xi(I.ModifiedAt)}` : ""
|
|
3692
4525
|
]
|
|
3693
4526
|
})
|
|
3694
4527
|
]
|
|
3695
|
-
}),
|
|
4528
|
+
}), L === "text" || L === "code" || L === "html" || L === "markdown" ? /* @__PURE__ */ B("button", {
|
|
3696
4529
|
type: "button",
|
|
3697
4530
|
onClick: () => {
|
|
3698
|
-
let e =
|
|
3699
|
-
e &&
|
|
4531
|
+
let e = P.current;
|
|
4532
|
+
e && J(e());
|
|
3700
4533
|
},
|
|
3701
|
-
disabled: !
|
|
3702
|
-
className: Y("inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium transition",
|
|
3703
|
-
children: [/* @__PURE__ */ z(
|
|
4534
|
+
disabled: !M || ce,
|
|
4535
|
+
className: Y("inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-xs font-medium transition", M && !ce ? "bg-blue-600 text-white hover:bg-blue-700" : "text-slate-400 dark:text-slate-500 cursor-not-allowed"),
|
|
4536
|
+
children: [/* @__PURE__ */ z(oe, { className: "h-3.5 w-3.5" }), ce ? "保存中" : M ? "保存" : "已保存"]
|
|
3704
4537
|
}) : null]
|
|
3705
4538
|
}) : /* @__PURE__ */ B("div", {
|
|
3706
4539
|
className: "w-full",
|
|
@@ -3722,7 +4555,7 @@ function mi({ agentId: e, capability: n, open: r, onClose: i, isFullscreen: a =
|
|
|
3722
4555
|
}
|
|
3723
4556
|
//#endregion
|
|
3724
4557
|
//#region src/components/workspace/WorkspacePanelContainer.tsx
|
|
3725
|
-
function
|
|
4558
|
+
function na({ agentId: e, capability: t, workspacePanelOpen: n, workspacePanelWidth: r, workspacePanelFullscreen: i, isMobile: a, workspaceEnabled: o, workspaceFiles: s, workspacePanelPresentation: c, closeWorkspacePanel: l, handleWorkspacePanelResizeStart: u, api: d }) {
|
|
3726
4559
|
let f = c.renderMode === "inline", p = c.renderMode === "sheet";
|
|
3727
4560
|
return !o || !s ? null : /* @__PURE__ */ B(R, { children: [f ? /* @__PURE__ */ B(R, { children: [n && !i ? /* @__PURE__ */ z("div", {
|
|
3728
4561
|
role: "separator",
|
|
@@ -3733,23 +4566,23 @@ function hi({ agentId: e, capability: t, workspacePanelOpen: n, workspacePanelWi
|
|
|
3733
4566
|
}) : null, /* @__PURE__ */ z("aside", {
|
|
3734
4567
|
style: n && !i ? { width: `${r}px` } : void 0,
|
|
3735
4568
|
className: Y(i ? "fixed inset-0 z-40 flex h-[var(--app-height)] w-screen overflow-hidden bg-white dark:bg-slate-950" : "hidden h-full flex-shrink-0 overflow-hidden bg-white transition-[width] duration-200 ease-out dark:bg-slate-950 md:flex", n ? "border-l border-slate-200/30 dark:border-slate-800/40" : "w-0 border-l border-transparent"),
|
|
3736
|
-
children: n ? /* @__PURE__ */ z(
|
|
4569
|
+
children: n ? /* @__PURE__ */ z(ta, {
|
|
3737
4570
|
agentId: e,
|
|
3738
4571
|
capability: t,
|
|
3739
4572
|
open: n,
|
|
3740
4573
|
onClose: l,
|
|
3741
4574
|
isFullscreen: i,
|
|
3742
|
-
onToggleFullscreen: () =>
|
|
4575
|
+
onToggleFullscreen: () => fi.getState().setWorkspacePanelFullscreen(!i),
|
|
3743
4576
|
isMobile: a,
|
|
3744
4577
|
api: d
|
|
3745
4578
|
}) : null
|
|
3746
|
-
})] }) : null, p ? /* @__PURE__ */ z(
|
|
4579
|
+
})] }) : null, p ? /* @__PURE__ */ z(Dt, {
|
|
3747
4580
|
open: n,
|
|
3748
4581
|
onOpenChange: (e) => {
|
|
3749
|
-
e ||
|
|
4582
|
+
e || fi.getState().setWorkspacePanelFullscreen(!1), fi.getState().setWorkspacePanelOpen(e);
|
|
3750
4583
|
},
|
|
3751
4584
|
modal: c.modal,
|
|
3752
|
-
children: /* @__PURE__ */ B(
|
|
4585
|
+
children: /* @__PURE__ */ B(jt, {
|
|
3753
4586
|
side: c.side,
|
|
3754
4587
|
showOverlay: c.showOverlay,
|
|
3755
4588
|
onInteractOutside: (e) => {
|
|
@@ -3758,15 +4591,15 @@ function hi({ agentId: e, capability: t, workspacePanelOpen: n, workspacePanelWi
|
|
|
3758
4591
|
showCloseButton: !1,
|
|
3759
4592
|
className: Y("border-slate-200 bg-white p-0 dark:border-slate-800 dark:bg-slate-950", a ? "h-[70vh] rounded-t-[1.75rem]" : "h-[calc(100vh-1.5rem)] w-[min(72rem,calc(100vw-1.5rem))] max-w-[calc(100vw-1.5rem)] rounded-l-[1.5rem] border-l shadow-2xl"),
|
|
3760
4593
|
children: [
|
|
3761
|
-
/* @__PURE__ */ z(
|
|
4594
|
+
/* @__PURE__ */ z(Pt, {
|
|
3762
4595
|
className: "sr-only",
|
|
3763
4596
|
children: "Workspace 文件"
|
|
3764
4597
|
}),
|
|
3765
|
-
/* @__PURE__ */ z(
|
|
4598
|
+
/* @__PURE__ */ z(Ft, {
|
|
3766
4599
|
className: "sr-only",
|
|
3767
4600
|
children: "浏览、上传和预览 Workspace 文件。"
|
|
3768
4601
|
}),
|
|
3769
|
-
/* @__PURE__ */ z(
|
|
4602
|
+
/* @__PURE__ */ z(ta, {
|
|
3770
4603
|
agentId: e,
|
|
3771
4604
|
capability: t,
|
|
3772
4605
|
open: n,
|
|
@@ -3779,4 +4612,4 @@ function hi({ agentId: e, capability: t, workspacePanelOpen: n, workspacePanelWi
|
|
|
3779
4612
|
}) : null] });
|
|
3780
4613
|
}
|
|
3781
4614
|
//#endregion
|
|
3782
|
-
export {
|
|
4615
|
+
export { dn as A, St as B, Pn as C, yn as D, En as E, Dt as F, Y as H, jt as I, Ft as L, Z as M, $t as N, vn as O, Rt as P, Pt as R, nr as S, wn as T, ut as V, gr as _, Ci as a, fr as b, ci as c, Ar as d, Or as f, vr as g, mr as h, Si as i, mn as j, bn as k, Zr as l, pr as m, Ui as n, fi as o, hr as p, Vi as r, ui as s, na as t, jr as u, dr as v, Tn as w, sr as x, _r as y, Et as z };
|