@qredence/fleet 0.7.4 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +48 -0
- package/README.md +5 -4
- package/bin/fleet-prime.mjs +33 -6
- package/bin/prime-runtime.mjs +79 -0
- package/dist/runtime-manifest.json +32 -0
- package/dist/web/client/assets/DialogTitle-BlVq-tcv.js +1 -0
- package/dist/web/client/assets/FloatingPortal-D8-EPDs2.js +1 -0
- package/dist/web/client/assets/activity-BPIKUzOU.js +1 -0
- package/dist/web/client/assets/agents-CGjUBYX7.js +2 -0
- package/dist/web/client/assets/agents-page-CTuFJL9H.js +1 -0
- package/dist/web/client/assets/alert-CzWGeumf.js +1 -0
- package/dist/web/client/assets/alert-dialog-D-e1Pr4q.js +1 -0
- package/dist/web/client/assets/arrow-up-right-CG9RNk4p.js +1 -0
- package/dist/web/client/assets/artifacts-panel-6JEdy6jU.js +1 -0
- package/dist/web/client/assets/badge-CzQFgmVK.js +1 -0
- package/dist/web/client/assets/button-CWYjn8Zk.js +1 -0
- package/dist/web/client/assets/{card-Hngi3HGC.js → card-Dj1SnGUU.js} +1 -1
- package/dist/web/client/assets/chat-command-palette-Bxr5EkO6.js +1 -0
- package/dist/web/client/assets/chat-hpzV6IA6.js +57 -0
- package/dist/web/client/assets/chat-queries-CfZiupub.js +3 -0
- package/dist/web/client/assets/clock-3-BwWCSCm_.js +1 -0
- package/dist/web/client/assets/code-block-pKKmFZ5w.js +3 -0
- package/dist/web/client/assets/collapsible-Bk6zCsRX.js +1 -0
- package/dist/web/client/assets/{command-CmtCIDdH.js → command-xo-NK4xO.js} +1 -1
- package/dist/web/client/assets/connectors-CFxLqG2x.js +2 -0
- package/dist/web/client/assets/connectors-page-DQJdoAnl.js +1 -0
- package/dist/web/client/assets/create-project-dialog-Db-WhUmP.js +1 -0
- package/dist/web/client/assets/createBaseUIEventDetails-DIxvaz-Y.js +1 -0
- package/dist/web/client/assets/dialog-CK8dym6z.js +1 -0
- package/dist/web/client/assets/eye-iNSvs0UA.js +1 -0
- package/dist/web/client/assets/file-code-corner-BkDULqko.js +1 -0
- package/dist/web/client/assets/{fork-picker-dialog-DfGlB17w.js → fork-picker-dialog-DSaFeUii.js} +1 -1
- package/dist/web/client/assets/globals-DJhWyayo.css +2 -0
- package/dist/web/client/assets/index-C9FHZDGw.js +13 -0
- package/dist/web/client/assets/input-CBoTMPC_.js +1 -0
- package/dist/web/client/assets/{input-group-EPMGh55u.js → input-group-BFubAtz9.js} +1 -1
- package/dist/web/client/assets/{ipython-tool-CMhnRVrC.js → ipython-tool-bieUhw9K.js} +1 -1
- package/dist/web/client/assets/markdown-CvBfbPCn.js +2 -0
- package/dist/web/client/assets/markdown-code-rFOkzN5N.js +4 -0
- package/dist/web/client/assets/mcp-connections-section-DEo6Kemv.js +2 -0
- package/dist/web/client/assets/message-queue-Btjt9wK2.js +1 -0
- package/dist/web/client/assets/{model-selector-list-BiU_7ivt.js → model-selector-list-CbDAT0Rw.js} +1 -1
- package/dist/web/client/assets/mutation-Da9zdeWr.js +1 -0
- package/dist/web/client/assets/notify-BIL0-CGy.js +1 -0
- package/dist/web/client/assets/open-panel-action-message-SdA1VU42.js +1 -0
- package/dist/web/client/assets/openui-renderer-DG-iML7M.js +291 -0
- package/dist/web/client/assets/pencil-Cbgq3ybX.js +1 -0
- package/dist/web/client/assets/plus-DUP2JPVG.js +1 -0
- package/dist/web/client/assets/product-page-header-Ck6I13CE.js +1 -0
- package/dist/web/client/assets/{prompt-input-Dy-DSPqF.js → prompt-input-CoV1gTUQ.js} +1 -1
- package/dist/web/client/assets/{prompt-suggestions-CrpAiKeB.js → prompt-suggestions-CAY5JI-C.js} +1 -1
- package/dist/web/client/assets/provider-catalog-CLEDlH_v.js +1 -0
- package/dist/web/client/assets/provider-label-BItazQ6H.js +1 -0
- package/dist/web/client/assets/reasoning-line-DGdPUMwT.js +1 -0
- package/dist/web/client/assets/rehype-katex-DITkIpVl.js +259 -0
- package/dist/web/client/assets/{repl-panel-DN5kZAcB.js → repl-panel-5xgkDXO5.js} +1 -1
- package/dist/web/client/assets/{resources-panel-DD6iWOF3.js → resources-panel-aJCKt9eF.js} +1 -1
- package/dist/web/client/assets/right-panel-context-CjX-HkDO.js +1 -0
- package/dist/web/client/assets/right-panel-registry-BAJ6TuEY.js +2 -0
- package/dist/web/client/assets/rotate-ccw-DLkfsmG9.js +1 -0
- package/dist/web/client/assets/routes-ja_liP8Z.js +14 -0
- package/dist/web/client/assets/select-DYh951qi.js +1 -0
- package/dist/web/client/assets/session-activity-panel-DwaXiSrS.js +1 -0
- package/dist/web/client/assets/{session-insights-panel-D0v_DKcb.js → session-insights-panel-BXEmuJKf.js} +1 -1
- package/dist/web/client/assets/session-reasoning-panel-CjJJK_bq.js +1 -0
- package/dist/web/client/assets/session-tool-renderer-DEABxZG3.js +166 -0
- package/dist/web/client/assets/{session-tree-panel-BBwP_EK2.js → session-tree-panel-5QgMvXoX.js} +1 -1
- package/dist/web/client/assets/settings-dialog-DiikSLhF.js +1 -0
- package/dist/web/client/assets/shield-check-7HDd-2Fn.js +1 -0
- package/dist/web/client/assets/{skeleton-DNAr5ULI.js → skeleton-B_Lq2XFl.js} +1 -1
- package/dist/web/client/assets/{skeleton-loaders-B28mF4tJ.js → skeleton-loaders-DWc1eDL3.js} +1 -1
- package/dist/web/client/assets/sparkles-CASAe1AI.js +1 -0
- package/dist/web/client/assets/{spinner-CSBXk3Lo.js → spinner-B5TaKP7k.js} +1 -1
- package/dist/web/client/assets/{subagent-chat-panel-DhvBO4dQ.js → subagent-chat-panel-R2RoX1Yt.js} +1 -1
- package/dist/web/client/assets/subagent-transcript-DVZhMo7a.js +1 -0
- package/dist/web/client/assets/{subagents-panel-DRo8Xs6j.js → subagents-panel-CMMRUP8F.js} +1 -1
- package/dist/web/client/assets/surfaces-BUjUJTyD.js +1 -0
- package/dist/web/client/assets/switch-BrxDfsX6.js +1 -0
- package/dist/web/client/assets/toast-BNWkgZ0u.js +1 -0
- package/dist/web/client/assets/tool-output-normalizer-DDU09Zc6.js +4 -0
- package/dist/web/client/assets/tool-part-normalizer-CF6bmJ0s.js +4 -0
- package/dist/web/client/assets/tool-result-7qREIVv_.js +5 -0
- package/dist/web/client/assets/tool-timeline-CGhwMeNl.js +2 -0
- package/dist/web/client/assets/trace-IsV5RRvM.js +1 -0
- package/dist/web/client/assets/trash-sm2UyOxe.js +1 -0
- package/dist/web/client/assets/types-gIgIxnnG.js +1 -0
- package/dist/web/client/assets/ui-preferences-B-PNDkyY.js +1 -0
- package/dist/web/client/assets/use-hover-capable-CLq8BADD.js +1 -0
- package/dist/web/client/assets/useBaseUiId-lKfDDIcw.js +1 -0
- package/dist/web/client/assets/useButton-CvcmqA2s.js +1 -0
- package/dist/web/client/assets/useNavigate-CVhM7pag.js +1 -0
- package/dist/web/client/assets/useRender-CzJUrRlB.js +1 -0
- package/dist/web/client/assets/useScrollLock-BcsteNzT.js +1 -0
- package/dist/web/client/assets/{utils-CFDGLzf6.js → utils-oBThwhjm.js} +1 -1
- package/dist/web/client/assets/with-selector-B_VDO56x.js +1 -0
- package/dist/web/client/assets/{workspace-panel-DdZutYnd.js → workspace-panel-Da5I4p_t.js} +1 -1
- package/dist/web/client/assets/workspace-path-nav-D-77sJ_A.js +2 -0
- package/dist/web/client/assets/wrench-BXX_Ah2s.js +1 -0
- package/dist/web/client/bundle-budget.json +6 -6
- package/dist/web/server/_tanstack-start-manifest_v-B6ne-00G-OFX7UD4K.js +119 -0
- package/dist/web/server/agents-BwzqhPjK-ANFHE5AG.js +22 -0
- package/dist/web/server/agents-page-DEqPV-eG-BR5MR74O.js +215 -0
- package/dist/web/server/{artifacts-panel-COSC8o7j-GKW2HH2G.js → artifacts-panel-DLO8OfXb-B2ZWCDFP.js} +35 -29
- package/dist/web/server/{chat-command-palette-CuOWdzkk-PKZQ5EZP.js → chat-command-palette-CaDQAMAu-KDH7BTDS.js} +22 -15
- package/dist/web/server/chunk-2ETDIMNM.js +40 -0
- package/dist/web/server/{chunk-2VKVSL6Y.js → chunk-35RIM6VP.js} +128 -127
- package/dist/web/server/chunk-5IE54MRG.js +207 -0
- package/dist/web/server/{chunk-VUBITQ5X.js → chunk-5MOXRFX6.js} +180 -7
- package/dist/web/server/{chunk-6GTTTYSE.js → chunk-6AFVCERK.js} +72 -79
- package/dist/web/server/chunk-6GYLXDX3.js +588 -0
- package/dist/web/server/chunk-7DQQMT5V.js +8993 -0
- package/dist/web/server/chunk-APOS34PW.js +8965 -0
- package/dist/web/server/{chunk-BUKOEXE7.js → chunk-AXN2OBPF.js} +2 -4
- package/dist/web/server/{chunk-WCKKN5BR.js → chunk-B5FKCW75.js} +357 -910
- package/dist/web/server/chunk-BD7YKYWL.js +1007 -0
- package/dist/web/server/{chunk-36CAMOVG.js → chunk-BZ2EAUZZ.js} +10 -12
- package/dist/web/server/chunk-CE7U5QB2.js +42 -0
- package/dist/web/server/chunk-FNV3WZXL.js +125 -0
- package/dist/web/server/{chunk-GLSR4ZI2.js → chunk-FSQWWR2M.js} +698 -832
- package/dist/web/server/chunk-FT7HNDR5.js +143 -0
- package/dist/web/server/chunk-GNXIDE26.js +44 -0
- package/dist/web/server/{chunk-ORCOCCER.js → chunk-HAFELESQ.js} +5 -7
- package/dist/web/server/{chunk-LLO4MNGE.js → chunk-HUHUPGHT.js} +53 -45
- package/dist/web/server/{chunk-QSM3BRMA.js → chunk-KBMRRJQN.js} +256 -157
- package/dist/web/server/chunk-KDCSEISZ.js +6890 -0
- package/dist/web/server/chunk-KSGGSGOA.js +50 -0
- package/dist/web/server/chunk-PQVTLG3E.js +270 -0
- package/dist/web/server/{chunk-YU6RHHK6.js → chunk-Q4ECIATK.js} +65 -53
- package/dist/web/server/{chunk-IN2ATSEG.js → chunk-R4BS3KYI.js} +2 -4
- package/dist/web/server/chunk-RX2ZJARF.js +73 -0
- package/dist/web/server/{chunk-AKSDWYJY.js → chunk-SYS5FDNA.js} +5 -5
- package/dist/web/server/chunk-TOJA3X5N.js +421 -0
- package/dist/web/server/chunk-TQ2RECTH.js +193 -0
- package/dist/web/server/{chunk-KHHXJZK7.js → chunk-TTNONWZZ.js} +16001 -14668
- package/dist/web/server/chunk-TXZDDJCT.js +5115 -0
- package/dist/web/server/{chunk-XA7EOCHM.js → chunk-UDUG3MYZ.js} +2 -2
- package/dist/web/server/{chunk-EBC7QORX.js → chunk-V2GCVTDP.js} +5056 -12556
- package/dist/web/server/{chunk-TMQ3MT3D.js → chunk-VDEUVEWL.js} +2255 -1
- package/dist/web/server/chunk-VM3U6PUU.js +769 -0
- package/dist/web/server/connectors-C0xm91Ss-DJVBGD73.js +22 -0
- package/dist/web/server/connectors-page-B6tJNZ6c-R5K4NSAT.js +66 -0
- package/dist/web/server/{create-project-dialog-0-arQpsX-ZELQKHS5.js → create-project-dialog-PFPHHWIV-GH7JR5IK.js} +27 -18
- package/dist/web/server/{dist-7G2NZPF4.js → dist-GQUZLXN5.js} +2 -2
- package/dist/web/server/{dist-E5637ZAY.js → dist-MN5NWCX6.js} +1 -1
- package/dist/web/server/{fork-picker-dialog-fj9p33Mq-I5SA3GLJ.js → fork-picker-dialog-DFpKOdAw-JPLJSYYU.js} +7 -12
- package/dist/web/server/{markdown-CShfYRVO-RBTK7TRB.js → markdown-Cc8V9dOF-JTNTJKQU.js} +7 -5
- package/dist/web/server/{markdown-code-BDV_2b2T-6JYA5FWZ.js → markdown-code-gaRnbgNM-V5LIRYCD.js} +46 -8
- package/dist/web/server/{message-queue-BBC843IU-GY4ZIMM4.js → message-queue-nQ2_kU82-KKSLYR4S.js} +7 -16
- package/dist/web/server/{model-selector-list-DE6aLNXt-LJZMCYOI.js → model-selector-list-By_G7_Hr-GXT27BZO.js} +12 -16
- package/dist/web/server/{openui-renderer-C3aqSKuS-PWLWJFYO.js → openui-renderer-B9D8-Av--LFZP4U5V.js} +20 -15
- package/dist/web/server/{prompt-suggestions-CpTK_fHV-UKJDTLVM.js → prompt-suggestions-B67Uy5Rk-5SMTSIFQ.js} +5 -4
- package/dist/web/server/{rehype-katex-IDPYWU6M.js → rehype-katex-CYHGKI6Q.js} +490 -843
- package/dist/web/server/{repl-panel-1kSS1UGd-U64BPA7X.js → repl-panel-1kSS1UGd-POXRYDDJ.js} +2 -3
- package/dist/web/server/{resources-panel-DWb0eGKa-K4EM3H7Y.js → resources-panel-CTzOOKPz-5G6RS2D6.js} +18 -12
- package/dist/web/server/router-CnBux_Ld-YTVBMJFL.js +23 -0
- package/dist/web/server/routes-BUGzvQoO-WW43X7W2.js +124 -0
- package/dist/web/server/server.js +3 -3
- package/dist/web/server/session-activity-panel-f0d3fCm7-I6L5IKFQ.js +181 -0
- package/dist/web/server/{session-insights-panel-CfMX2NRu-6HWZTTAC.js → session-insights-panel-BiVObm_6-AP4FITT7.js} +2 -12
- package/dist/web/server/session-reasoning-panel-QIt_xjP0-FKJWMNHO.js +70 -0
- package/dist/web/server/session-tool-renderer-Cg_ZPHxS-BNQKNJNZ.js +34 -0
- package/dist/web/server/{session-tree-panel-HNl6R9VZ-4JUF34M7.js → session-tree-panel-B--el8O5-NZOZJM5L.js} +18 -13
- package/dist/web/server/{settings-dialog-DGZBA5Z_-6HYFMPNZ.js → settings-dialog-D_eJN2ia-W47Y474K.js} +104 -795
- package/dist/web/server/{subagent-chat-panel-DuB4hqUk-LDCAJOCL.js → subagent-chat-panel-C9nWP21E-D5C2TTYD.js} +22 -17
- package/dist/web/server/{subagents-panel-wAvx3-Rs-L6UTDFUX.js → subagents-panel-fAKvBNRG-O7QHXNE2.js} +26 -22
- package/dist/web/server/{workspace-panel-CPzJZwgv-YS7PTI5C.js → workspace-panel-CZMNMU63-SYOSM3B7.js} +23 -17
- package/package.json +2 -2
- package/dist/web/client/assets/DialogTitle-D-zqaHvF.js +0 -1
- package/dist/web/client/assets/FloatingPortal-73ZRZeD9.js +0 -1
- package/dist/web/client/assets/action-swap-BcFwS6is.js +0 -1
- package/dist/web/client/assets/alert-dialog-DtXvVhsF.js +0 -1
- package/dist/web/client/assets/artifacts-panel-Bseg97yQ.js +0 -1
- package/dist/web/client/assets/badge-C--lf3bb.js +0 -57
- package/dist/web/client/assets/button-BJZe4vNJ.js +0 -1
- package/dist/web/client/assets/chat-command-palette-D_rm1r9d.js +0 -1
- package/dist/web/client/assets/chevron-up-CqeJYyZO.js +0 -1
- package/dist/web/client/assets/collapsible-DauSnbYp.js +0 -1
- package/dist/web/client/assets/create-project-dialog-m-9aoobN.js +0 -1
- package/dist/web/client/assets/createBaseUIEventDetails-DklXWq23.js +0 -1
- package/dist/web/client/assets/dialog-Ddouieuu.js +0 -1
- package/dist/web/client/assets/eye-Cs0lNChA.js +0 -1
- package/dist/web/client/assets/globals-C961mr-b.css +0 -2
- package/dist/web/client/assets/index-Bz5W4EOn.js +0 -13
- package/dist/web/client/assets/input-Def1xOZz.js +0 -1
- package/dist/web/client/assets/markdown-Big27m-v.js +0 -2
- package/dist/web/client/assets/markdown-code-7L4RiS50.js +0 -3
- package/dist/web/client/assets/message-queue-Bg2MiJHM.js +0 -1
- package/dist/web/client/assets/mutation-DOi2Qgfa.js +0 -1
- package/dist/web/client/assets/notify-DhtmUPfE.js +0 -1
- package/dist/web/client/assets/openui-renderer-MIB3JKYa.js +0 -291
- package/dist/web/client/assets/provider-label-B_vy60P0.js +0 -1
- package/dist/web/client/assets/rehype-katex-A4PtQgTX.js +0 -259
- package/dist/web/client/assets/right-panel-context-DHKWoetk.js +0 -1
- package/dist/web/client/assets/right-panel-registry-hKJN__3l.js +0 -2
- package/dist/web/client/assets/routes-C3h32Lj_.js +0 -16
- package/dist/web/client/assets/select-Buvv1tIo.js +0 -1
- package/dist/web/client/assets/session-reasoning-panel-DmEbXOrR.js +0 -1
- package/dist/web/client/assets/session-tool-renderer-Daol5fJw.js +0 -169
- package/dist/web/client/assets/settings-dialog-DYbx3xuq.js +0 -2
- package/dist/web/client/assets/sparkles-D_ANe-HY.js +0 -1
- package/dist/web/client/assets/subagent-transcript-Bx-rHni-.js +0 -1
- package/dist/web/client/assets/surfaces-B8xTOFeK.js +0 -1
- package/dist/web/client/assets/switch-CDfAwEvs.js +0 -1
- package/dist/web/client/assets/terminal-Ceucj7us.js +0 -1
- package/dist/web/client/assets/toast-9zXN-yVk.js +0 -1
- package/dist/web/client/assets/tool-part-normalizer-NbPs9kd1.js +0 -4
- package/dist/web/client/assets/tool-result-BccnO34D.js +0 -4
- package/dist/web/client/assets/tool-timeline-DlBZyd4j.js +0 -1
- package/dist/web/client/assets/types-D5hZ8IyV.js +0 -1
- package/dist/web/client/assets/ui-preferences-1YaENqef.js +0 -1
- package/dist/web/client/assets/use-hover-capable-MwFjBLZQ.js +0 -1
- package/dist/web/client/assets/workspace-path-nav-BRwuLsFl.js +0 -2
- package/dist/web/client/assets/wrench-BYnD147U.js +0 -1
- package/dist/web/server/_tanstack-start-manifest_v-YlngJGUa-YTWBGR7L.js +0 -93
- package/dist/web/server/chunk-2PAW6K4Q.js +0 -56
- package/dist/web/server/chunk-CHSKEU3V.js +0 -166
- package/dist/web/server/chunk-FB3UHLLN.js +0 -49
- package/dist/web/server/chunk-GLH2GWMG.js +0 -2182
- package/dist/web/server/chunk-OXEAXEWD.js +0 -13
- package/dist/web/server/chunk-SIJVVYQT.js +0 -234
- package/dist/web/server/chunk-UQV2NU63.js +0 -163
- package/dist/web/server/chunk-ZUZPJNLY.js +0 -25217
- package/dist/web/server/router-DZYr-9uT-AEXHEFXF.js +0 -31
- package/dist/web/server/routes-vYxWRhis-AAZ73SNP.js +0 -120
- package/dist/web/server/session-reasoning-panel-XXU2yIOW-XXCKHISS.js +0 -192
- package/dist/web/server/session-tool-renderer-Dtt74Mts-7YYNSWRV.js +0 -29
- package/dist/web/server/tool-timeline-BKWsrZHK-3LGCOTPH.js +0 -12
|
@@ -0,0 +1,769 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ChatCommandsResponseSchema,
|
|
3
|
+
ChatMcpDeleteRequestSchema,
|
|
4
|
+
ChatMcpListResponseSchema,
|
|
5
|
+
ChatMcpOAuthLoginRequestSchema,
|
|
6
|
+
ChatMcpOAuthLoginResponseSchema,
|
|
7
|
+
ChatMcpUpsertRequestSchema,
|
|
8
|
+
ChatModelsDiscoverRequestSchema,
|
|
9
|
+
ChatModelsDiscoverResponseSchema,
|
|
10
|
+
ChatModelsResponseSchema,
|
|
11
|
+
ChatOpenUIArtifactUpsertRequestSchema,
|
|
12
|
+
ChatOpenUIArtifactUpsertResponseSchema,
|
|
13
|
+
ChatPlanPresentationSchema,
|
|
14
|
+
ChatPlanPresentationUpsertRequestSchema,
|
|
15
|
+
ChatProviderRemoveRequestSchema,
|
|
16
|
+
ChatProviderUpdateRequestSchema,
|
|
17
|
+
ChatProviderUpdateResponseSchema,
|
|
18
|
+
ChatProvidersResponseSchema,
|
|
19
|
+
ChatQuestionAnswerResponseSchema,
|
|
20
|
+
ChatQueueMutationRequestSchema,
|
|
21
|
+
ChatQueueMutationResponseSchema,
|
|
22
|
+
ChatResourcesResponseSchema,
|
|
23
|
+
ChatSessionResponseSchema,
|
|
24
|
+
ChatSessionsResponseSchema,
|
|
25
|
+
ChatSettingsResponseSchema,
|
|
26
|
+
ChatSettingsUpdateRequestSchema,
|
|
27
|
+
ChatStreamEventSchema,
|
|
28
|
+
ProjectCreateRequestSchema,
|
|
29
|
+
ProjectDirectoryBrowseResponseSchema,
|
|
30
|
+
ProjectListResponseSchema,
|
|
31
|
+
ProjectRenameRequestSchema,
|
|
32
|
+
ProjectSummarySchema,
|
|
33
|
+
SessionTreeNavigateRequestSchema,
|
|
34
|
+
SessionTreeNavigateResponseSchema,
|
|
35
|
+
SessionTreeSnapshotResponseSchema,
|
|
36
|
+
UploadedAttachmentSchema,
|
|
37
|
+
WorkspaceFileResponseSchema,
|
|
38
|
+
WorkspaceTreeResponseSchema,
|
|
39
|
+
external_exports,
|
|
40
|
+
useMutation,
|
|
41
|
+
useQuery,
|
|
42
|
+
useQueryClient
|
|
43
|
+
} from "./chunk-KDCSEISZ.js";
|
|
44
|
+
|
|
45
|
+
// web/app/dist/server/assets/chat-queries-CyG4XV35.js
|
|
46
|
+
var RUNTIME_API_PREFIXES = [
|
|
47
|
+
"/api/health",
|
|
48
|
+
"/api/chat",
|
|
49
|
+
"/api/projects",
|
|
50
|
+
"/api/workspace"
|
|
51
|
+
];
|
|
52
|
+
function resolveChatRuntimeBaseUrl() {
|
|
53
|
+
return "";
|
|
54
|
+
}
|
|
55
|
+
function isChatRuntimePath(path) {
|
|
56
|
+
return RUNTIME_API_PREFIXES.some((prefix) => path === prefix || path.startsWith(`${prefix}?`) || path.startsWith(`${prefix}/`));
|
|
57
|
+
}
|
|
58
|
+
function resolveChatApiUrl(path) {
|
|
59
|
+
const base = resolveChatRuntimeBaseUrl();
|
|
60
|
+
if (!base) return path;
|
|
61
|
+
const [pathname] = path.split("?");
|
|
62
|
+
if (!isChatRuntimePath(pathname)) return path;
|
|
63
|
+
return `${base}${path}`;
|
|
64
|
+
}
|
|
65
|
+
var ChatStreamContractError = class extends Error {
|
|
66
|
+
constructor() {
|
|
67
|
+
super("The chat stream received an invalid event. The response may still be running; reload the conversation to refresh it.");
|
|
68
|
+
this.name = "ChatStreamContractError";
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
var ChatRequestError = class extends Error {
|
|
72
|
+
status;
|
|
73
|
+
body;
|
|
74
|
+
code;
|
|
75
|
+
remediation;
|
|
76
|
+
constructor(status, body) {
|
|
77
|
+
super(formatChatRequestErrorMessage(status, body));
|
|
78
|
+
this.name = "ChatRequestError";
|
|
79
|
+
this.status = status;
|
|
80
|
+
this.body = body;
|
|
81
|
+
const envelope = parseErrorEnvelope(body);
|
|
82
|
+
this.code = envelope?.code;
|
|
83
|
+
this.remediation = envelope?.remediation;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
function isFleetErrorRemediation(value) {
|
|
87
|
+
return typeof value === "object" && value !== null && typeof value.action === "string" && typeof value.label === "string";
|
|
88
|
+
}
|
|
89
|
+
function parseErrorEnvelope(body) {
|
|
90
|
+
const trimmed = body.trim();
|
|
91
|
+
if (!trimmed) return null;
|
|
92
|
+
try {
|
|
93
|
+
const parsed = JSON.parse(trimmed);
|
|
94
|
+
if (typeof parsed.code === "string") return {
|
|
95
|
+
code: parsed.code,
|
|
96
|
+
remediation: isFleetErrorRemediation(parsed.remediation) ? parsed.remediation : void 0
|
|
97
|
+
};
|
|
98
|
+
} catch {
|
|
99
|
+
}
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
function formatChatRequestErrorMessage(status, body) {
|
|
103
|
+
const trimmed = body.trim();
|
|
104
|
+
if (!trimmed) return `Request failed (${status})`;
|
|
105
|
+
try {
|
|
106
|
+
const parsed = JSON.parse(trimmed);
|
|
107
|
+
if (typeof parsed.message === "string" && parsed.message.length > 0) return parsed.message;
|
|
108
|
+
} catch {
|
|
109
|
+
}
|
|
110
|
+
return trimmed;
|
|
111
|
+
}
|
|
112
|
+
function isForbiddenSessionError(error) {
|
|
113
|
+
return (error instanceof ChatRequestError ? error.body : error instanceof Error ? error.message : String(error)).includes("Session belongs to another user");
|
|
114
|
+
}
|
|
115
|
+
function isUnknownSessionError(error) {
|
|
116
|
+
return error instanceof ChatRequestError && error.status === 404;
|
|
117
|
+
}
|
|
118
|
+
function isDaemonDisconnectError(error) {
|
|
119
|
+
if (!(error instanceof Error)) return false;
|
|
120
|
+
if (error.code === "NETWORK_DISCONNECTED") return true;
|
|
121
|
+
return /daemon is not connected/i.test(error.message) || /cannot send daemon command/i.test(error.message);
|
|
122
|
+
}
|
|
123
|
+
function chatErrorFromStreamEvent(event) {
|
|
124
|
+
const error = new Error(event.message);
|
|
125
|
+
if (event.code) error.code = event.code;
|
|
126
|
+
return error;
|
|
127
|
+
}
|
|
128
|
+
async function fetchJson(url, init) {
|
|
129
|
+
const resolvedUrl = resolveChatApiUrl(url);
|
|
130
|
+
const headers = new Headers(init?.headers);
|
|
131
|
+
const response = await fetch(resolvedUrl, {
|
|
132
|
+
...init,
|
|
133
|
+
headers
|
|
134
|
+
});
|
|
135
|
+
if (!response.ok) {
|
|
136
|
+
const body = await response.text();
|
|
137
|
+
throw new ChatRequestError(response.status, body);
|
|
138
|
+
}
|
|
139
|
+
return await response.json();
|
|
140
|
+
}
|
|
141
|
+
async function fetchValidatedJson(url, schema, init) {
|
|
142
|
+
return parseWithSchema(schema, await fetchJson(url, init), `Response from ${url}`);
|
|
143
|
+
}
|
|
144
|
+
async function readChatStream(response, onEvent) {
|
|
145
|
+
const reader = response.body?.getReader();
|
|
146
|
+
if (!reader) throw new Error("Chat response did not include a stream");
|
|
147
|
+
const decoder = new TextDecoder();
|
|
148
|
+
let buffer = "";
|
|
149
|
+
const expectedSequenceNumbers = /* @__PURE__ */ new Map();
|
|
150
|
+
function trackSequence(sessionId, eventType, seq) {
|
|
151
|
+
const current = expectedSequenceNumbers.get(`${sessionId}:${eventType}`) ?? 0;
|
|
152
|
+
if (seq > current + 1) console.warn(`[chat-sequence] Gap detected in ${eventType} sequence for session ${sessionId}: expected ${current + 1}, got ${seq}`);
|
|
153
|
+
expectedSequenceNumbers.set(`${sessionId}:${eventType}`, seq);
|
|
154
|
+
}
|
|
155
|
+
const handleLine = (line) => {
|
|
156
|
+
const trimmed = line.trim();
|
|
157
|
+
if (!trimmed) return;
|
|
158
|
+
let data;
|
|
159
|
+
try {
|
|
160
|
+
data = JSON.parse(trimmed);
|
|
161
|
+
} catch {
|
|
162
|
+
console.error('[chat-stream] Invalid NDJSON event {"type":"unknown","issues":["invalid_json:[root]"]}');
|
|
163
|
+
throw new ChatStreamContractError();
|
|
164
|
+
}
|
|
165
|
+
const eventType = typeof data === "object" && data !== null ? "type" in data && data.type : void 0;
|
|
166
|
+
const sessionId = typeof data === "object" && data !== null && "sessionId" in data ? String(data.sessionId) : void 0;
|
|
167
|
+
const sequenceNumber = typeof data === "object" && data !== null && "sequenceNumber" in data ? Number(data.sequenceNumber) : void 0;
|
|
168
|
+
if (eventType === "start" || eventType === "done" || eventType === "error" || eventType === "plan" || eventType === "state" || eventType === "tool" || eventType === "queue" || eventType === "reasoning" || eventType === "reasoning_text" || eventType === "compaction" || eventType === "retry" || eventType === "payload" || eventType === "session_snapshot") {
|
|
169
|
+
const validatedEvent = parseWithSchema(ChatStreamEventSchema, data, "Chat stream event");
|
|
170
|
+
if (sessionId && sequenceNumber !== void 0) trackSequence(sessionId, String(validatedEvent.type), sequenceNumber);
|
|
171
|
+
onEvent(validatedEvent);
|
|
172
|
+
} else onEvent(data);
|
|
173
|
+
};
|
|
174
|
+
try {
|
|
175
|
+
for (; ; ) {
|
|
176
|
+
const { value, done } = await reader.read();
|
|
177
|
+
if (done) break;
|
|
178
|
+
const chunk = decoder.decode(value, { stream: true });
|
|
179
|
+
buffer += chunk;
|
|
180
|
+
let newlineIndex = buffer.indexOf("\n");
|
|
181
|
+
while (newlineIndex >= 0) {
|
|
182
|
+
handleLine(buffer.slice(0, newlineIndex));
|
|
183
|
+
buffer = buffer.slice(newlineIndex + 1);
|
|
184
|
+
newlineIndex = buffer.indexOf("\n");
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
buffer += decoder.decode();
|
|
188
|
+
handleLine(buffer);
|
|
189
|
+
} catch (error) {
|
|
190
|
+
await reader.cancel().catch(() => void 0);
|
|
191
|
+
throw error;
|
|
192
|
+
} finally {
|
|
193
|
+
reader.releaseLock();
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
function parseWithSchema(schema, data, label) {
|
|
197
|
+
const parsed = schema.safeParse(data);
|
|
198
|
+
if (parsed.success) return parsed.data;
|
|
199
|
+
if (label === "Chat stream event" || label === "Subagent chat stream event") {
|
|
200
|
+
const knownTypes = /* @__PURE__ */ new Set([
|
|
201
|
+
"start",
|
|
202
|
+
"done",
|
|
203
|
+
"error",
|
|
204
|
+
"plan",
|
|
205
|
+
"state",
|
|
206
|
+
"tool",
|
|
207
|
+
"queue",
|
|
208
|
+
"reasoning",
|
|
209
|
+
"reasoning_text",
|
|
210
|
+
"compaction",
|
|
211
|
+
"retry",
|
|
212
|
+
"payload",
|
|
213
|
+
"session_snapshot",
|
|
214
|
+
"delta",
|
|
215
|
+
"message",
|
|
216
|
+
"thinking",
|
|
217
|
+
"presentation",
|
|
218
|
+
"rlm"
|
|
219
|
+
]);
|
|
220
|
+
const knownFields = /* @__PURE__ */ new Set([
|
|
221
|
+
"type",
|
|
222
|
+
"part",
|
|
223
|
+
"message",
|
|
224
|
+
"messages",
|
|
225
|
+
"parts",
|
|
226
|
+
"id",
|
|
227
|
+
"role",
|
|
228
|
+
"text",
|
|
229
|
+
"state",
|
|
230
|
+
"name",
|
|
231
|
+
"phase",
|
|
232
|
+
"status",
|
|
233
|
+
"sessionId",
|
|
234
|
+
"runId",
|
|
235
|
+
"messageId",
|
|
236
|
+
"toolCallId",
|
|
237
|
+
"toolName",
|
|
238
|
+
"input",
|
|
239
|
+
"output",
|
|
240
|
+
"result",
|
|
241
|
+
"error",
|
|
242
|
+
"code",
|
|
243
|
+
"presentation",
|
|
244
|
+
"revision",
|
|
245
|
+
"sequenceNumber",
|
|
246
|
+
"contentIndex",
|
|
247
|
+
"terminal",
|
|
248
|
+
"session",
|
|
249
|
+
"queue",
|
|
250
|
+
"payload",
|
|
251
|
+
"category",
|
|
252
|
+
"reasoning",
|
|
253
|
+
"steps",
|
|
254
|
+
"durationMs",
|
|
255
|
+
"createdAt",
|
|
256
|
+
"requestKind",
|
|
257
|
+
"data",
|
|
258
|
+
"content"
|
|
259
|
+
]);
|
|
260
|
+
const summarize = (issues, prefix = []) => issues.flatMap((issue) => {
|
|
261
|
+
const issuePath = [...prefix, ...issue.path ?? []];
|
|
262
|
+
if (issue.code === "invalid_union" && issue.errors) return issue.errors.filter((branch) => !branch.some((entry) => entry.code === "invalid_value" && entry.path?.[0] === "type")).flatMap((branch) => summarize(branch, issuePath));
|
|
263
|
+
const path = issuePath.map((key) => typeof key === "number" ? "[]" : typeof key === "string" && knownFields.has(key) ? key : "[field]").join(".");
|
|
264
|
+
return [`${issue.code ?? "invalid"}:${path || "[root]"}`];
|
|
265
|
+
});
|
|
266
|
+
const eventType = typeof data === "object" && data !== null && "type" in data && typeof data.type === "string" && knownTypes.has(data.type) ? data.type : "unknown";
|
|
267
|
+
console.error(`[chat-stream] Invalid event ${JSON.stringify({
|
|
268
|
+
type: eventType,
|
|
269
|
+
issues: summarize(parsed.error.issues).slice(0, 12)
|
|
270
|
+
})}`);
|
|
271
|
+
throw new ChatStreamContractError();
|
|
272
|
+
}
|
|
273
|
+
throw new Error(`${label} did not match the expected contract`);
|
|
274
|
+
}
|
|
275
|
+
function metadataUrl(metadata) {
|
|
276
|
+
const params = new URLSearchParams();
|
|
277
|
+
if (metadata.sessionId) params.set("sessionId", metadata.sessionId);
|
|
278
|
+
if (metadata.projectId) params.set("projectId", metadata.projectId);
|
|
279
|
+
if (metadata.openUI) params.set("openUI", "true");
|
|
280
|
+
return params.toString();
|
|
281
|
+
}
|
|
282
|
+
function labelForState(state) {
|
|
283
|
+
switch (state) {
|
|
284
|
+
case "agent_start":
|
|
285
|
+
return "Working";
|
|
286
|
+
case "turn_start":
|
|
287
|
+
return "Waiting";
|
|
288
|
+
case "message_start":
|
|
289
|
+
return "Thinking";
|
|
290
|
+
case "message_end":
|
|
291
|
+
return "Writing";
|
|
292
|
+
case "tool_start":
|
|
293
|
+
case "tool_execution_start":
|
|
294
|
+
case "tool_execution":
|
|
295
|
+
return "Executing";
|
|
296
|
+
case "tool_end":
|
|
297
|
+
case "tool_execution_end":
|
|
298
|
+
return "Writing";
|
|
299
|
+
case "turn_end":
|
|
300
|
+
return "Turn finished";
|
|
301
|
+
case "agent_end":
|
|
302
|
+
return;
|
|
303
|
+
default:
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
var ProjectResponseSchema = external_exports.object({ project: ProjectSummarySchema });
|
|
308
|
+
var chatClient = {
|
|
309
|
+
async abortSession(metadata) {
|
|
310
|
+
await fetchJson("/api/chat/abort", {
|
|
311
|
+
method: "POST",
|
|
312
|
+
headers: { "Content-Type": "application/json" },
|
|
313
|
+
body: JSON.stringify(metadata)
|
|
314
|
+
});
|
|
315
|
+
},
|
|
316
|
+
async answerQuestion(request) {
|
|
317
|
+
return fetchValidatedJson("/api/chat/question", ChatQuestionAnswerResponseSchema, {
|
|
318
|
+
method: "POST",
|
|
319
|
+
headers: { "Content-Type": "application/json" },
|
|
320
|
+
body: JSON.stringify(request)
|
|
321
|
+
});
|
|
322
|
+
},
|
|
323
|
+
async mutateQueuedMessage(request) {
|
|
324
|
+
const body = ChatQueueMutationRequestSchema.parse(request);
|
|
325
|
+
return fetchValidatedJson("/api/chat/session", ChatQueueMutationResponseSchema, {
|
|
326
|
+
method: "PATCH",
|
|
327
|
+
headers: { "Content-Type": "application/json" },
|
|
328
|
+
body: JSON.stringify(body)
|
|
329
|
+
});
|
|
330
|
+
},
|
|
331
|
+
async deleteQueuedMessage(request) {
|
|
332
|
+
return this.mutateQueuedMessage({
|
|
333
|
+
...request,
|
|
334
|
+
mutation: request.mutation ?? { type: "delete" }
|
|
335
|
+
});
|
|
336
|
+
},
|
|
337
|
+
async createSession(projectId, signal) {
|
|
338
|
+
return fetchValidatedJson("/api/chat/new", ChatSessionResponseSchema, {
|
|
339
|
+
method: "POST",
|
|
340
|
+
headers: { "Content-Type": "application/json" },
|
|
341
|
+
body: JSON.stringify({
|
|
342
|
+
openUI: true,
|
|
343
|
+
...projectId ? { projectId } : {}
|
|
344
|
+
}),
|
|
345
|
+
signal
|
|
346
|
+
});
|
|
347
|
+
},
|
|
348
|
+
async listProjects() {
|
|
349
|
+
return fetchValidatedJson("/api/projects", ProjectListResponseSchema);
|
|
350
|
+
},
|
|
351
|
+
async createProject(request) {
|
|
352
|
+
const body = ProjectCreateRequestSchema.parse(request);
|
|
353
|
+
return (await fetchValidatedJson("/api/projects", ProjectResponseSchema, {
|
|
354
|
+
method: "POST",
|
|
355
|
+
headers: { "Content-Type": "application/json" },
|
|
356
|
+
body: JSON.stringify(body)
|
|
357
|
+
})).project;
|
|
358
|
+
},
|
|
359
|
+
async renameProject(projectId, name) {
|
|
360
|
+
const body = ProjectRenameRequestSchema.parse({ name });
|
|
361
|
+
return (await fetchValidatedJson(`/api/projects?projectId=${encodeURIComponent(projectId)}`, ProjectResponseSchema, {
|
|
362
|
+
method: "PATCH",
|
|
363
|
+
headers: { "Content-Type": "application/json" },
|
|
364
|
+
body: JSON.stringify(body)
|
|
365
|
+
})).project;
|
|
366
|
+
},
|
|
367
|
+
async unregisterProject(projectId) {
|
|
368
|
+
return (await fetchValidatedJson(`/api/projects?projectId=${encodeURIComponent(projectId)}`, ProjectResponseSchema, { method: "DELETE" })).project;
|
|
369
|
+
},
|
|
370
|
+
async browseProjectDirectories(options) {
|
|
371
|
+
const params = new URLSearchParams();
|
|
372
|
+
if (options?.path) params.set("path", options.path);
|
|
373
|
+
if (options?.token) params.set("token", options.token);
|
|
374
|
+
const query = params.toString();
|
|
375
|
+
return fetchValidatedJson(`/api/projects/browse${query ? `?${query}` : ""}`, ProjectDirectoryBrowseResponseSchema);
|
|
376
|
+
},
|
|
377
|
+
async getModels(options) {
|
|
378
|
+
const params = new URLSearchParams();
|
|
379
|
+
if (options?.scope === "all") params.set("scope", "all");
|
|
380
|
+
if (options?.projectId) params.set("projectId", options.projectId);
|
|
381
|
+
const query = params.toString();
|
|
382
|
+
return fetchValidatedJson(`/api/chat/models${query ? `?${query}` : ""}`, ChatModelsResponseSchema);
|
|
383
|
+
},
|
|
384
|
+
async discoverModels(request) {
|
|
385
|
+
return fetchValidatedJson("/api/chat/models/discover", ChatModelsDiscoverResponseSchema, {
|
|
386
|
+
method: "POST",
|
|
387
|
+
headers: { "Content-Type": "application/json" },
|
|
388
|
+
body: JSON.stringify(ChatModelsDiscoverRequestSchema.parse(request))
|
|
389
|
+
});
|
|
390
|
+
},
|
|
391
|
+
async getResources(projectId) {
|
|
392
|
+
return fetchValidatedJson(`/api/chat/resources${projectId ? `?projectId=${encodeURIComponent(projectId)}` : ""}`, ChatResourcesResponseSchema);
|
|
393
|
+
},
|
|
394
|
+
async getCommands(projectId) {
|
|
395
|
+
return fetchValidatedJson(`/api/chat/commands${projectId ? `?projectId=${encodeURIComponent(projectId)}` : ""}`, ChatCommandsResponseSchema);
|
|
396
|
+
},
|
|
397
|
+
async getSettings(projectId) {
|
|
398
|
+
return fetchValidatedJson(`/api/chat/settings${projectId ? `?projectId=${encodeURIComponent(projectId)}` : ""}`, ChatSettingsResponseSchema);
|
|
399
|
+
},
|
|
400
|
+
async getWorkspaceTree(projectId) {
|
|
401
|
+
return fetchValidatedJson(`/api/workspace/tree${projectId ? `?projectId=${encodeURIComponent(projectId)}` : ""}`, WorkspaceTreeResponseSchema);
|
|
402
|
+
},
|
|
403
|
+
async getWorkspaceFile(path, projectId, signal) {
|
|
404
|
+
const params = new URLSearchParams({ path });
|
|
405
|
+
if (projectId) params.set("projectId", projectId);
|
|
406
|
+
return fetchValidatedJson(`/api/workspace/file?${params}`, WorkspaceFileResponseSchema, signal ? { signal } : void 0);
|
|
407
|
+
},
|
|
408
|
+
async listSessions(projectId) {
|
|
409
|
+
return (await fetchValidatedJson(`/api/chat/sessions${projectId ? `?projectId=${encodeURIComponent(projectId)}` : ""}`, ChatSessionsResponseSchema)).sessions;
|
|
410
|
+
},
|
|
411
|
+
async renameSession(sessionId, title) {
|
|
412
|
+
await fetchJson("/api/chat/sessions", {
|
|
413
|
+
method: "PATCH",
|
|
414
|
+
headers: { "Content-Type": "application/json" },
|
|
415
|
+
body: JSON.stringify({
|
|
416
|
+
sessionId,
|
|
417
|
+
title
|
|
418
|
+
})
|
|
419
|
+
});
|
|
420
|
+
},
|
|
421
|
+
async deleteSession(sessionId) {
|
|
422
|
+
await fetchJson("/api/chat/sessions", {
|
|
423
|
+
method: "DELETE",
|
|
424
|
+
headers: { "Content-Type": "application/json" },
|
|
425
|
+
body: JSON.stringify({ sessionId })
|
|
426
|
+
});
|
|
427
|
+
},
|
|
428
|
+
async uploadAttachments(sessionId, files) {
|
|
429
|
+
const form = new FormData();
|
|
430
|
+
form.set("sessionId", sessionId);
|
|
431
|
+
for (const file of files) form.append("files", file);
|
|
432
|
+
const response = await fetch(resolveChatApiUrl("/api/chat/session"), {
|
|
433
|
+
method: "POST",
|
|
434
|
+
body: form
|
|
435
|
+
});
|
|
436
|
+
if (!response.ok) throw new ChatRequestError(response.status, await response.text());
|
|
437
|
+
return external_exports.object({ attachments: external_exports.array(UploadedAttachmentSchema) }).parse(await response.json()).attachments;
|
|
438
|
+
},
|
|
439
|
+
async getSessionTree(sessionId) {
|
|
440
|
+
return fetchValidatedJson(`/api/chat/session-tree?${new URLSearchParams({ sessionId })}`, SessionTreeSnapshotResponseSchema).then((response) => response.snapshot);
|
|
441
|
+
},
|
|
442
|
+
async navigateSessionTree(request) {
|
|
443
|
+
const body = SessionTreeNavigateRequestSchema.parse(request);
|
|
444
|
+
return fetchValidatedJson("/api/chat/session-tree", SessionTreeNavigateResponseSchema, {
|
|
445
|
+
method: "POST",
|
|
446
|
+
headers: { "Content-Type": "application/json" },
|
|
447
|
+
body: JSON.stringify(body)
|
|
448
|
+
}).then((response) => response.snapshot);
|
|
449
|
+
},
|
|
450
|
+
async loadSession(metadata) {
|
|
451
|
+
return fetchValidatedJson(`/api/chat/session?${metadataUrl({
|
|
452
|
+
...metadata,
|
|
453
|
+
openUI: true
|
|
454
|
+
})}`, ChatSessionResponseSchema);
|
|
455
|
+
},
|
|
456
|
+
async loadSubagentSession(parentSessionId, childId) {
|
|
457
|
+
return fetchValidatedJson(`/api/chat/session?${new URLSearchParams({
|
|
458
|
+
parentSessionId,
|
|
459
|
+
childId
|
|
460
|
+
})}`, ChatSessionResponseSchema);
|
|
461
|
+
},
|
|
462
|
+
openSubagentEvents(parentSessionId, childId, resume) {
|
|
463
|
+
const params = new URLSearchParams({
|
|
464
|
+
parentSessionId,
|
|
465
|
+
childId
|
|
466
|
+
});
|
|
467
|
+
if (resume?.streamGeneration) params.set("streamGeneration", resume.streamGeneration);
|
|
468
|
+
if (resume?.lastEventId && resume.lastEventId > 0) params.set("lastEventId", String(resume.lastEventId));
|
|
469
|
+
return resolveChatApiUrl(`/api/chat/events?${params}`);
|
|
470
|
+
},
|
|
471
|
+
async upsertPlanPresentation(request) {
|
|
472
|
+
const body = ChatPlanPresentationUpsertRequestSchema.parse(request);
|
|
473
|
+
return fetchValidatedJson("/api/chat/session", external_exports.object({ presentation: ChatPlanPresentationSchema }), {
|
|
474
|
+
method: "PUT",
|
|
475
|
+
headers: { "Content-Type": "application/json" },
|
|
476
|
+
body: JSON.stringify(body)
|
|
477
|
+
}).then((result) => result.presentation);
|
|
478
|
+
},
|
|
479
|
+
async upsertOpenUIArtifact(request) {
|
|
480
|
+
const body = ChatOpenUIArtifactUpsertRequestSchema.parse(request);
|
|
481
|
+
return fetchValidatedJson("/api/chat/artifacts", ChatOpenUIArtifactUpsertResponseSchema, {
|
|
482
|
+
method: "PUT",
|
|
483
|
+
headers: { "Content-Type": "application/json" },
|
|
484
|
+
body: JSON.stringify(body)
|
|
485
|
+
});
|
|
486
|
+
},
|
|
487
|
+
async resumeSession(metadata) {
|
|
488
|
+
return fetchValidatedJson("/api/chat/resume", ChatSessionResponseSchema, {
|
|
489
|
+
method: "POST",
|
|
490
|
+
headers: { "Content-Type": "application/json" },
|
|
491
|
+
body: JSON.stringify({
|
|
492
|
+
...metadata,
|
|
493
|
+
openUI: true
|
|
494
|
+
})
|
|
495
|
+
});
|
|
496
|
+
},
|
|
497
|
+
async updateSettings(request, projectId) {
|
|
498
|
+
const body = ChatSettingsUpdateRequestSchema.parse(request);
|
|
499
|
+
return fetchValidatedJson(`/api/chat/settings${projectId ? `?projectId=${encodeURIComponent(projectId)}` : ""}`, ChatSettingsResponseSchema, {
|
|
500
|
+
method: "PATCH",
|
|
501
|
+
headers: { "Content-Type": "application/json" },
|
|
502
|
+
body: JSON.stringify(body)
|
|
503
|
+
});
|
|
504
|
+
},
|
|
505
|
+
async streamMessage(request, onEvent, signal) {
|
|
506
|
+
const response = await fetch(resolveChatApiUrl("/api/chat"), {
|
|
507
|
+
method: "POST",
|
|
508
|
+
headers: new Headers({ "Content-Type": "application/json" }),
|
|
509
|
+
body: JSON.stringify(request),
|
|
510
|
+
signal
|
|
511
|
+
});
|
|
512
|
+
if (!response.ok) {
|
|
513
|
+
const body = await response.text();
|
|
514
|
+
throw new ChatRequestError(response.status, body);
|
|
515
|
+
}
|
|
516
|
+
await readChatStream(response, onEvent);
|
|
517
|
+
},
|
|
518
|
+
async getMcpConnections() {
|
|
519
|
+
return fetchValidatedJson("/api/chat/mcp", ChatMcpListResponseSchema);
|
|
520
|
+
},
|
|
521
|
+
async upsertMcpConnection(request) {
|
|
522
|
+
const body = ChatMcpUpsertRequestSchema.parse(request);
|
|
523
|
+
return fetchValidatedJson("/api/chat/mcp", ChatMcpListResponseSchema, {
|
|
524
|
+
method: "POST",
|
|
525
|
+
headers: { "Content-Type": "application/json" },
|
|
526
|
+
body: JSON.stringify(body)
|
|
527
|
+
});
|
|
528
|
+
},
|
|
529
|
+
async removeMcpConnection(request) {
|
|
530
|
+
const body = ChatMcpDeleteRequestSchema.parse(request);
|
|
531
|
+
return fetchValidatedJson("/api/chat/mcp", ChatMcpListResponseSchema, {
|
|
532
|
+
method: "DELETE",
|
|
533
|
+
headers: { "Content-Type": "application/json" },
|
|
534
|
+
body: JSON.stringify(body)
|
|
535
|
+
});
|
|
536
|
+
},
|
|
537
|
+
async mcpOAuth(request) {
|
|
538
|
+
const body = ChatMcpOAuthLoginRequestSchema.parse(request);
|
|
539
|
+
return fetchValidatedJson("/api/chat/mcp/oauth", ChatMcpOAuthLoginResponseSchema, {
|
|
540
|
+
method: "POST",
|
|
541
|
+
headers: { "Content-Type": "application/json" },
|
|
542
|
+
body: JSON.stringify(body)
|
|
543
|
+
});
|
|
544
|
+
},
|
|
545
|
+
async getProviders() {
|
|
546
|
+
return fetchValidatedJson("/api/chat/providers", ChatProvidersResponseSchema);
|
|
547
|
+
},
|
|
548
|
+
async updateProvider(request) {
|
|
549
|
+
const body = ChatProviderUpdateRequestSchema.parse(request);
|
|
550
|
+
return fetchValidatedJson("/api/chat/providers", ChatProviderUpdateResponseSchema, {
|
|
551
|
+
method: "POST",
|
|
552
|
+
headers: { "Content-Type": "application/json" },
|
|
553
|
+
body: JSON.stringify(body)
|
|
554
|
+
});
|
|
555
|
+
},
|
|
556
|
+
async removeProvider(request) {
|
|
557
|
+
const body = ChatProviderRemoveRequestSchema.parse(request);
|
|
558
|
+
return fetchValidatedJson("/api/chat/providers", ChatProviderUpdateResponseSchema, {
|
|
559
|
+
method: "DELETE",
|
|
560
|
+
headers: { "Content-Type": "application/json" },
|
|
561
|
+
body: JSON.stringify(body)
|
|
562
|
+
});
|
|
563
|
+
}
|
|
564
|
+
};
|
|
565
|
+
var chatQueryKeys = {
|
|
566
|
+
models: (projectId) => [
|
|
567
|
+
"chat",
|
|
568
|
+
"models",
|
|
569
|
+
projectId ?? "default"
|
|
570
|
+
],
|
|
571
|
+
modelCatalog: (projectId) => [
|
|
572
|
+
"chat",
|
|
573
|
+
"models",
|
|
574
|
+
"catalog",
|
|
575
|
+
projectId ?? "default"
|
|
576
|
+
],
|
|
577
|
+
providers: ["chat", "providers"],
|
|
578
|
+
mcp: ["chat", "mcp"],
|
|
579
|
+
resources: (projectId) => [
|
|
580
|
+
"chat",
|
|
581
|
+
"resources",
|
|
582
|
+
projectId ?? "default"
|
|
583
|
+
],
|
|
584
|
+
commands: (projectId) => [
|
|
585
|
+
"chat",
|
|
586
|
+
"commands",
|
|
587
|
+
projectId ?? "default"
|
|
588
|
+
],
|
|
589
|
+
settings: (projectId) => [
|
|
590
|
+
"chat",
|
|
591
|
+
"settings",
|
|
592
|
+
projectId ?? "default"
|
|
593
|
+
],
|
|
594
|
+
workspace: (projectId) => [
|
|
595
|
+
"workspace",
|
|
596
|
+
"tree",
|
|
597
|
+
projectId ?? "default"
|
|
598
|
+
],
|
|
599
|
+
projects: ["projects"]
|
|
600
|
+
};
|
|
601
|
+
var keys = chatQueryKeys;
|
|
602
|
+
function useChatModels(projectId) {
|
|
603
|
+
return useQuery({
|
|
604
|
+
queryKey: keys.models(projectId),
|
|
605
|
+
queryFn: () => chatClient.getModels({ projectId }),
|
|
606
|
+
enabled: Boolean(projectId)
|
|
607
|
+
});
|
|
608
|
+
}
|
|
609
|
+
function useChatProjects() {
|
|
610
|
+
return useQuery({
|
|
611
|
+
queryKey: keys.projects,
|
|
612
|
+
queryFn: () => chatClient.listProjects(),
|
|
613
|
+
staleTime: 5e3
|
|
614
|
+
});
|
|
615
|
+
}
|
|
616
|
+
function useChatModelCatalog(options) {
|
|
617
|
+
return useQuery({
|
|
618
|
+
queryKey: keys.modelCatalog(options?.projectId),
|
|
619
|
+
queryFn: () => chatClient.getModels({
|
|
620
|
+
scope: "all",
|
|
621
|
+
projectId: options?.projectId
|
|
622
|
+
}),
|
|
623
|
+
enabled: Boolean(options?.projectId) && options?.enabled !== false
|
|
624
|
+
});
|
|
625
|
+
}
|
|
626
|
+
function useDiscoverChatModels() {
|
|
627
|
+
const queryClient = useQueryClient();
|
|
628
|
+
return useMutation({
|
|
629
|
+
mutationFn: (providerId) => chatClient.discoverModels({ providerId }),
|
|
630
|
+
onSuccess: () => {
|
|
631
|
+
queryClient.invalidateQueries({ queryKey: ["chat", "models"] });
|
|
632
|
+
}
|
|
633
|
+
});
|
|
634
|
+
}
|
|
635
|
+
function useChatResources(projectId) {
|
|
636
|
+
return useQuery({
|
|
637
|
+
queryKey: keys.resources(projectId),
|
|
638
|
+
queryFn: () => chatClient.getResources(projectId),
|
|
639
|
+
enabled: Boolean(projectId)
|
|
640
|
+
});
|
|
641
|
+
}
|
|
642
|
+
function useChatCommands(projectId) {
|
|
643
|
+
return useQuery({
|
|
644
|
+
queryKey: keys.commands(projectId),
|
|
645
|
+
queryFn: () => chatClient.getCommands(projectId),
|
|
646
|
+
enabled: Boolean(projectId)
|
|
647
|
+
});
|
|
648
|
+
}
|
|
649
|
+
function useChatSettings(projectId) {
|
|
650
|
+
return useQuery({
|
|
651
|
+
queryKey: keys.settings(projectId),
|
|
652
|
+
queryFn: () => chatClient.getSettings(projectId),
|
|
653
|
+
enabled: Boolean(projectId)
|
|
654
|
+
});
|
|
655
|
+
}
|
|
656
|
+
function useUpdateChatSettings() {
|
|
657
|
+
const queryClient = useQueryClient();
|
|
658
|
+
return useMutation({
|
|
659
|
+
mutationFn: (input) => chatClient.updateSettings(input.request, input.projectId),
|
|
660
|
+
onSuccess: (settings, input) => {
|
|
661
|
+
queryClient.setQueryData(keys.settings(input.projectId), settings);
|
|
662
|
+
queryClient.invalidateQueries({ queryKey: ["chat", "models"] });
|
|
663
|
+
queryClient.invalidateQueries({ queryKey: ["chat", "resources"] });
|
|
664
|
+
queryClient.invalidateQueries({ queryKey: ["chat", "commands"] });
|
|
665
|
+
}
|
|
666
|
+
});
|
|
667
|
+
}
|
|
668
|
+
function useWorkspaceTree(projectId, options) {
|
|
669
|
+
return useQuery({
|
|
670
|
+
queryKey: keys.workspace(projectId),
|
|
671
|
+
queryFn: () => chatClient.getWorkspaceTree(projectId),
|
|
672
|
+
enabled: Boolean(projectId) && options?.enabled !== false
|
|
673
|
+
});
|
|
674
|
+
}
|
|
675
|
+
function useChatMcpConnections() {
|
|
676
|
+
return useQuery({
|
|
677
|
+
queryKey: keys.mcp,
|
|
678
|
+
queryFn: () => chatClient.getMcpConnections()
|
|
679
|
+
});
|
|
680
|
+
}
|
|
681
|
+
function useUpdateMcpConnection() {
|
|
682
|
+
const queryClient = useQueryClient();
|
|
683
|
+
return useMutation({
|
|
684
|
+
mutationFn: (request) => chatClient.upsertMcpConnection(request),
|
|
685
|
+
onSuccess: (data) => {
|
|
686
|
+
queryClient.setQueryData(keys.mcp, data);
|
|
687
|
+
queryClient.invalidateQueries({ queryKey: ["chat", "resources"] });
|
|
688
|
+
}
|
|
689
|
+
});
|
|
690
|
+
}
|
|
691
|
+
function useRemoveMcpConnection() {
|
|
692
|
+
const queryClient = useQueryClient();
|
|
693
|
+
return useMutation({
|
|
694
|
+
mutationFn: (request) => chatClient.removeMcpConnection(request),
|
|
695
|
+
onSuccess: (data) => {
|
|
696
|
+
queryClient.setQueryData(keys.mcp, data);
|
|
697
|
+
queryClient.invalidateQueries({ queryKey: ["chat", "resources"] });
|
|
698
|
+
}
|
|
699
|
+
});
|
|
700
|
+
}
|
|
701
|
+
function useMcpOAuth() {
|
|
702
|
+
const queryClient = useQueryClient();
|
|
703
|
+
return useMutation({
|
|
704
|
+
mutationFn: (request) => chatClient.mcpOAuth(request),
|
|
705
|
+
onSuccess: (data) => {
|
|
706
|
+
if (data.status !== "success" || !data.connections) return;
|
|
707
|
+
queryClient.setQueryData(keys.mcp, { connections: data.connections });
|
|
708
|
+
queryClient.invalidateQueries({ queryKey: ["chat", "resources"] });
|
|
709
|
+
}
|
|
710
|
+
});
|
|
711
|
+
}
|
|
712
|
+
function useChatProviders() {
|
|
713
|
+
return useQuery({
|
|
714
|
+
queryKey: keys.providers,
|
|
715
|
+
queryFn: () => chatClient.getProviders()
|
|
716
|
+
});
|
|
717
|
+
}
|
|
718
|
+
function useUpdateChatProvider() {
|
|
719
|
+
const queryClient = useQueryClient();
|
|
720
|
+
return useMutation({
|
|
721
|
+
mutationFn: (request) => chatClient.updateProvider(request),
|
|
722
|
+
onSuccess: (data) => {
|
|
723
|
+
queryClient.setQueryData(keys.providers, { providers: data.providers });
|
|
724
|
+
queryClient.invalidateQueries({ queryKey: ["chat", "models"] });
|
|
725
|
+
queryClient.invalidateQueries({ queryKey: ["chat", "settings"] });
|
|
726
|
+
}
|
|
727
|
+
});
|
|
728
|
+
}
|
|
729
|
+
function useRemoveChatProvider() {
|
|
730
|
+
const queryClient = useQueryClient();
|
|
731
|
+
return useMutation({
|
|
732
|
+
mutationFn: (request) => chatClient.removeProvider(request),
|
|
733
|
+
onSuccess: (data) => {
|
|
734
|
+
queryClient.setQueryData(keys.providers, { providers: data.providers });
|
|
735
|
+
queryClient.invalidateQueries({ queryKey: ["chat", "models"] });
|
|
736
|
+
queryClient.invalidateQueries({ queryKey: ["chat", "settings"] });
|
|
737
|
+
}
|
|
738
|
+
});
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
export {
|
|
742
|
+
resolveChatApiUrl,
|
|
743
|
+
ChatStreamContractError,
|
|
744
|
+
isForbiddenSessionError,
|
|
745
|
+
isUnknownSessionError,
|
|
746
|
+
isDaemonDisconnectError,
|
|
747
|
+
chatErrorFromStreamEvent,
|
|
748
|
+
fetchJson,
|
|
749
|
+
parseWithSchema,
|
|
750
|
+
labelForState,
|
|
751
|
+
chatClient,
|
|
752
|
+
chatQueryKeys,
|
|
753
|
+
useChatModels,
|
|
754
|
+
useChatProjects,
|
|
755
|
+
useChatModelCatalog,
|
|
756
|
+
useDiscoverChatModels,
|
|
757
|
+
useChatResources,
|
|
758
|
+
useChatCommands,
|
|
759
|
+
useChatSettings,
|
|
760
|
+
useUpdateChatSettings,
|
|
761
|
+
useWorkspaceTree,
|
|
762
|
+
useChatMcpConnections,
|
|
763
|
+
useUpdateMcpConnection,
|
|
764
|
+
useRemoveMcpConnection,
|
|
765
|
+
useMcpOAuth,
|
|
766
|
+
useChatProviders,
|
|
767
|
+
useUpdateChatProvider,
|
|
768
|
+
useRemoveChatProvider
|
|
769
|
+
};
|