@shawnstack/quickforge 1.7.2 → 1.7.4
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/README.md +1 -0
- package/bin/quickforge.mjs +2 -21
- package/dist/assets/AgentProfilesPage-B84w-r9S.js +1 -0
- package/dist/assets/{ChatPanelHost-Cld9HcVz.js → ChatPanelHost-CyO8fEoj.js} +98 -98
- package/dist/assets/{PluginsPage-DEMqwhOA.js → PluginsPage-D2862wul.js} +1 -1
- package/dist/assets/{ScheduledTasksPage-DTP_gedp.js → ScheduledTasksPage-GqbiJDPX.js} +2 -2
- package/dist/assets/SettingsWorkspacePage-B53_eDf2.js +1628 -0
- package/dist/assets/SharedConversationPage-Cw2QFnbC.js +1 -0
- package/dist/assets/TerminalDock-Dgg-_ZmU.js +2 -0
- package/dist/assets/WorkspaceInspector-3uLiu6Bv.js +13 -0
- package/dist/assets/{abnfDiagram-VRR7QNED-Dl_Fvlqg.js → abnfDiagram-VRR7QNED-Dy7veffk.js} +1 -1
- package/dist/assets/{arc-Bhg4c0ht.js → arc-Bo3p2lGy.js} +1 -1
- package/dist/assets/architecture-TIHT7OUA-7FQo5GbP.js +1 -0
- package/dist/assets/{architectureDiagram-ZJ3FMSHR-BuojN27B.js → architectureDiagram-ZJ3FMSHR-Cwx8qOvu.js} +1 -1
- package/dist/assets/{blockDiagram-677ZJIJ3-alDLbrR1.js → blockDiagram-677ZJIJ3-BiuaAOFa.js} +1 -1
- package/dist/assets/{c4Diagram-LMCZKHZV-D1lKa4VT.js → c4Diagram-LMCZKHZV-BTcGfhK2.js} +1 -1
- package/dist/assets/channel-DToA8d-4.js +1 -0
- package/dist/assets/chunk-2Q5K7J3B-D_Wxpk-T.js +1 -0
- package/dist/assets/{chunk-32BRIVSS-CwWLNjMZ.js → chunk-32BRIVSS-B9PuF_RF.js} +1 -1
- package/dist/assets/{chunk-52WLFC77-Be569m7d.js → chunk-52WLFC77-3zGItfIM.js} +1 -1
- package/dist/assets/{chunk-5FCAYU7R-BSvoiWV1.js → chunk-5FCAYU7R-DQ66qlmt.js} +1 -1
- package/dist/assets/{chunk-5HE753X5-CRgsy8WS.js → chunk-5HE753X5-CLqTO-VF.js} +1 -1
- package/dist/assets/{chunk-5JV3BV7I-CdW477UR.js → chunk-5JV3BV7I-Csxv1jr6.js} +1 -1
- package/dist/assets/{chunk-5TONJI2A-CdtKzSmp.js → chunk-5TONJI2A-BCQttpBr.js} +1 -1
- package/dist/assets/{chunk-5VM5RSS4-BKjjssLZ.js → chunk-5VM5RSS4-DEWJGSTb.js} +1 -1
- package/dist/assets/{chunk-7BUUIJ7U-ByAXiXdn.js → chunk-7BUUIJ7U-DNorm9MM.js} +1 -1
- package/dist/assets/{chunk-BIQX33UG-DeG8SCT1.js → chunk-BIQX33UG-DgvY_BOT.js} +1 -1
- package/dist/assets/{chunk-C7G6YPKG-D_zHT68Q.js → chunk-C7G6YPKG-DMvn9IPs.js} +1 -1
- package/dist/assets/{chunk-CQNSW5MT-CHpHoUSu.js → chunk-CQNSW5MT-Dq2duUgr.js} +1 -1
- package/dist/assets/{chunk-CYSBUYHQ-CRP50Vov.js → chunk-CYSBUYHQ-BovYyc4Y.js} +1 -1
- package/dist/assets/{chunk-EMLP6XTP-DX6uQQ2v.js → chunk-EMLP6XTP-BMDOpuYN.js} +1 -1
- package/dist/assets/{chunk-EX3LRPZG-DAJRNkHR.js → chunk-EX3LRPZG-6eP2UPOf.js} +1 -1
- package/dist/assets/{chunk-FWX5IMBZ-XbM5yomC.js → chunk-FWX5IMBZ-D4q-wTSy.js} +2 -2
- package/dist/assets/{chunk-HOUHSVGY-Ci0ljnb1.js → chunk-HOUHSVGY-XjIcuzH7.js} +1 -1
- package/dist/assets/{chunk-ICXQ74PX-Dy2WJ71z.js → chunk-ICXQ74PX-YBXbanq9.js} +1 -1
- package/dist/assets/{chunk-JG7HCLWE-2PrkzHkt.js → chunk-JG7HCLWE-CcN3uNXF.js} +1 -1
- package/dist/assets/{chunk-JWPE2WC7-D32uacSM.js → chunk-JWPE2WC7-Cwg6AUAt.js} +1 -1
- package/dist/assets/{chunk-MOJQB5TN-DIAFLtiS.js → chunk-MOJQB5TN-NNspcGIU.js} +1 -1
- package/dist/assets/{chunk-MOZMSUNE-BbscOaEz.js → chunk-MOZMSUNE-pMJ_jMos.js} +1 -1
- package/dist/assets/{chunk-OGEWGWER-ivBVxzKe.js → chunk-OGEWGWER-CJy-3Ldv.js} +1 -1
- package/dist/assets/{chunk-OSBZ3O6U-frD0hkdx.js → chunk-OSBZ3O6U-D7cLHHOA.js} +1 -1
- package/dist/assets/{chunk-PUDLZKDR-B-37Rxae.js → chunk-PUDLZKDR-D5YBi1Pi.js} +1 -1
- package/dist/assets/{chunk-Q4XR5HBZ-Y90m2RTe.js → chunk-Q4XR5HBZ-DYmqQdIf.js} +1 -1
- package/dist/assets/{chunk-QBLGF6JB-DixBqslB.js → chunk-QBLGF6JB-Bfcx00X0.js} +1 -1
- package/dist/assets/{chunk-R7FJI6CG-DXS1UXn_.js → chunk-R7FJI6CG-oXzadpZY.js} +1 -1
- package/dist/assets/{chunk-RYQCIY6F-n4JxhNd0.js → chunk-RYQCIY6F-Dt3-8yUh.js} +1 -1
- package/dist/assets/{chunk-U6XO7XAA-yHlgxMmn.js → chunk-U6XO7XAA-B55eSvpx.js} +1 -1
- package/dist/assets/{chunk-V7JOEXUC-Z6kuZfbl.js → chunk-V7JOEXUC-Btk4JwCt.js} +1 -1
- package/dist/assets/chunk-VAUOI2AC-CIZseNLi.js +1 -0
- package/dist/assets/{chunk-VR4S4FIN-Cs_SIQma.js → chunk-VR4S4FIN-DgaSiVOY.js} +1 -1
- package/dist/assets/{chunk-WYO6CB5R-CGExYbV-.js → chunk-WYO6CB5R-rRDZ_Tta.js} +3 -3
- package/dist/assets/chunk-XXDRQBXY-Do-XYxat.js +1 -0
- package/dist/assets/{chunk-YOTPTUD7-DopPXWSl.js → chunk-YOTPTUD7-BnFxj5o4.js} +1 -1
- package/dist/assets/{chunk-ZGVPDNZ5-CJHOeqMb.js → chunk-ZGVPDNZ5-CrnlPlmJ.js} +1 -1
- package/dist/assets/{chunk-ZIRB5QZD-BBVc5mf6.js → chunk-ZIRB5QZD-BYTiATIH.js} +1 -1
- package/dist/assets/classDiagram-OUVF2IWQ-Bu24Sy-k.js +1 -0
- package/dist/assets/classDiagram-v2-EOCWNBFH-DKhh5HSW.js +1 -0
- package/dist/assets/{cose-bilkent-JH36ORCC-DLjV-dTm.js → cose-bilkent-JH36ORCC-BORKJRwF.js} +1 -1
- package/dist/assets/cynefin-VYW2F7L2-oyiAgYC4.js +1 -0
- package/dist/assets/{cynefinDiagram-TSTJHNR4-BfH3zVS-.js → cynefinDiagram-TSTJHNR4-BXKeaSl8.js} +1 -1
- package/dist/assets/{dagre-CY3D84Cl.js → dagre-CrA0XVwJ.js} +1 -1
- package/dist/assets/{dagre-VKFMJZFB-BIhwZCIZ.js → dagre-VKFMJZFB-ouq_lA1a.js} +1 -1
- package/dist/assets/{diagram-FQU43EPY-BHnzNM2w.js → diagram-FQU43EPY-BxR5kUiQ.js} +1 -1
- package/dist/assets/{diagram-G47NLZAW-C7-ZlmFT.js → diagram-G47NLZAW-DWonk1sL.js} +1 -1
- package/dist/assets/{diagram-NH7WQ7WH-C-P9Y7IR.js → diagram-NH7WQ7WH-fmV_wV5e.js} +1 -1
- package/dist/assets/{diagram-OA4YK3LP-Ci5lZ_T5.js → diagram-OA4YK3LP-DvOSRRiV.js} +1 -1
- package/dist/assets/{diagram-WEI45ONY-C1xuK2bs.js → diagram-WEI45ONY-Bp-xb3uS.js} +1 -1
- package/dist/assets/dist-DLKC_odd.js +1 -0
- package/dist/assets/{ebnfDiagram-CCIWWBDH-DKQ5NWMD.js → ebnfDiagram-CCIWWBDH-BTlnwneA.js} +1 -1
- package/dist/assets/{erDiagram-Q63AITRT-HAWySadP.js → erDiagram-Q63AITRT-C3fFWGCm.js} +1 -1
- package/dist/assets/esm-oa69b5u4.js +2 -0
- package/dist/assets/eventmodeling-45OFAUF4-YB_0MefX.js +1 -0
- package/dist/assets/flowDiagram-23GEKE2U-Bc73xdBd.js +1 -0
- package/dist/assets/{ganttDiagram-NO4QXBWP-C1hwIcOA.js → ganttDiagram-NO4QXBWP-DzAiojNi.js} +1 -1
- package/dist/assets/gitGraph-TEB2WS4Q-Bvp27L0n.js +1 -0
- package/dist/assets/{gitGraphDiagram-IHSO6WYX-DYUYxs1R.js → gitGraphDiagram-IHSO6WYX-Cv57oNEA.js} +1 -1
- package/dist/assets/icons-cTkqD_Gi.js +1 -0
- package/dist/assets/index-B48prgLL.js +65 -0
- package/dist/assets/index-DQhwHHer.css +3 -0
- package/dist/assets/info-DKCQHKI2-BsLOivgq.js +1 -0
- package/dist/assets/{infoDiagram-FWYZ7A6U-CnIL6tv4.js → infoDiagram-FWYZ7A6U-B5Z_O3Ro.js} +1 -1
- package/dist/assets/{ishikawaDiagram-FXEZZL3T-B7WXNycQ.js → ishikawaDiagram-FXEZZL3T-CKTK_TKV.js} +1 -1
- package/dist/assets/{journeyDiagram-5HDEW3XC-D4HvioyY.js → journeyDiagram-5HDEW3XC-Cm9k4ywW.js} +1 -1
- package/dist/assets/{kanban-definition-HUTT4EX6-CDs763eS.js → kanban-definition-HUTT4EX6-DzNteLwx.js} +1 -1
- package/dist/assets/{line-ikKkQiFp.js → line-BG78c_WJ.js} +1 -1
- package/dist/assets/{linear-GqPyxQkN.js → linear-1X20_EGu.js} +1 -1
- package/dist/assets/{map-CJwjCvwr.js → map-CCI8WZkS.js} +1 -1
- package/dist/assets/{mcp-servers-dialog-Bp6kbIup.js → mcp-servers-dialog-GXXD9K0U.js} +2 -2
- package/dist/assets/{mermaid-parser.core-CoE8cccr.js → mermaid-parser.core-Bb8HI_OS.js} +2 -2
- package/dist/assets/{mermaid-renderer-BmbSAmpG.js → mermaid-renderer-PIaNiXAz.js} +2 -2
- package/dist/assets/{mermaid.core-DlFSL90j.js → mermaid.core-DUHOIwL5.js} +3 -3
- package/dist/assets/{mindmap-definition-LN4V7U3C-DLdq0K9C.js → mindmap-definition-LN4V7U3C-Tnbszo7b.js} +1 -1
- package/dist/assets/{monaco-BTsVCDWS.js → monaco-BVtCspYZ.js} +1 -1
- package/dist/assets/{ordinal-CibZU3PM.js → ordinal-v4prQcuq.js} +1 -1
- package/dist/assets/{otel-BNGM50C-.js → otel-D1LswXpM.js} +1 -1
- package/dist/assets/packet-7NZHBO7P-BKQkXRtk.js +1 -0
- package/dist/assets/{pegDiagram-2B236MQR-Cm1kPRC2.js → pegDiagram-2B236MQR-CX824Kd0.js} +1 -1
- package/dist/assets/{pi-ai-Cr3rpCXT.js → pi-ai-DAJlO9ZB.js} +2 -2
- package/dist/assets/{pi-web-ui-DoRGtREc.js → pi-web-ui-B-RJSxjR.js} +1 -1
- package/dist/assets/pie-RZYD4A2V-BTiTN5Ge.js +1 -0
- package/dist/assets/{pieDiagram-ENE6RG2P-Df05wjjo.js → pieDiagram-ENE6RG2P-BT04VWPQ.js} +1 -1
- package/dist/assets/{quadrantDiagram-ABIIQ3AL-BjCwGxJC.js → quadrantDiagram-ABIIQ3AL-BvOZxkBr.js} +1 -1
- package/dist/assets/radar-I7S5WNFK-BU-oVjKM.js +1 -0
- package/dist/assets/railroad-3IZDKUUU-7H2hxNbL.js +1 -0
- package/dist/assets/railroad-abnf-AHOZXSZD-Mx6wf6XQ.js +1 -0
- package/dist/assets/railroad-ebnf-EBAXGLYW-BgXSKhYy.js +1 -0
- package/dist/assets/railroad-peg-LSFZ7HO6-DTEl2rAC.js +1 -0
- package/dist/assets/{railroadDiagram-RFXS5EU6-CTUvpKkv.js → railroadDiagram-RFXS5EU6-DnTU--BV.js} +1 -1
- package/dist/assets/{react-vendor-Dr5xvL-e.js → react-vendor-eWH0QhNU.js} +1 -1
- package/dist/assets/{requirementDiagram-TGXJPOKE-BU1kvEku.js → requirementDiagram-TGXJPOKE--MZX_yEv.js} +1 -1
- package/dist/assets/{sankeyDiagram-HTMAVEWB-BHmvxVqH.js → sankeyDiagram-HTMAVEWB-SEZkHhYn.js} +1 -1
- package/dist/assets/{sequenceDiagram-DBY2YBRQ-CTpwICgg.js → sequenceDiagram-DBY2YBRQ-BhC2OHiz.js} +1 -1
- package/dist/assets/{sizeCapture-X5ZJPWSS-BbLhGaa4.js → sizeCapture-X5ZJPWSS-Ci5LeToV.js} +1 -1
- package/dist/assets/{skills-dialog-DiJAUfvW.js → skills-dialog-DDh1h8eH.js} +3 -1
- package/dist/assets/{src-B4Tvg3gT.js → src-CovulcRC.js} +1 -1
- package/dist/assets/{stateDiagram-2N3HPSRC-BxuDwIgT.js → stateDiagram-2N3HPSRC-DKK5tFT4.js} +1 -1
- package/dist/assets/stateDiagram-v2-6OUMAXLB-D8x3mkni.js +1 -0
- package/dist/assets/{swimlanes-5IMT3BWC-EkZsiylV.js → swimlanes-5IMT3BWC-DxxGCk67.js} +2 -2
- package/dist/assets/swimlanesDiagram-G3AALYLV-C4nOBNp8.js +8 -0
- package/dist/assets/{timeline-definition-FHXFAJF6-C9ewOCTa.js → timeline-definition-FHXFAJF6-BPXB3Sue.js} +1 -1
- package/dist/assets/treeView-QDETBFTQ-DOE6NSdf.js +1 -0
- package/dist/assets/treemap-6X3UGDF4-Ca7QD_b4.js +1 -0
- package/dist/assets/{vennDiagram-L72KCM5P-CR49Y4Lp.js → vennDiagram-L72KCM5P-CxcBCKye.js} +1 -1
- package/dist/assets/wardley-OPB4EBWU-D9O4RKRm.js +1 -0
- package/dist/assets/{wardleyDiagram-EHGQE667-Cn0GgwWi.js → wardleyDiagram-EHGQE667-DEL6Yes5.js} +1 -1
- package/dist/assets/web-RgX7H-OH.js +1 -0
- package/dist/assets/{xychartDiagram-FW5EYKEG-DlmPNAvd.js → xychartDiagram-FW5EYKEG-N8cPbcjC.js} +1 -1
- package/dist/index.html +12 -11
- package/dist/mobile-error.html +24 -0
- package/package.json +7 -1
- package/server/acp/server.mjs +14 -9
- package/server/agent-manager.mjs +215 -20
- package/server/ai-http-logger.mjs +69 -12
- package/server/ai-provider-options.mjs +11 -0
- package/server/channels/channel-logs.mjs +13 -0
- package/server/channels/event-relay.mjs +33 -0
- package/server/channels/process-channel.mjs +29 -0
- package/server/channels/providers/wechat.mjs +9 -3
- package/server/channels/registry.mjs +5 -1
- package/server/index.mjs +43 -25
- package/server/lan-access-store.mjs +93 -3
- package/server/network-proxy.mjs +449 -0
- package/server/plugins/registry.mjs +64 -4
- package/server/public-api.mjs +10 -2
- package/server/routes/agent-profiles.mjs +4 -2
- package/server/routes/agent.mjs +28 -0
- package/server/routes/channels.mjs +47 -0
- package/server/routes/lan-access.mjs +246 -21
- package/server/routes/models.mjs +7 -3
- package/server/routes/project.mjs +19 -1
- package/server/routes/scheduled-tasks.mjs +4 -2
- package/server/routes/static.mjs +26 -1
- package/server/routes/system.mjs +37 -0
- package/server/routes/terminal.mjs +7 -2
- package/server/routes/workspace.mjs +62 -9
- package/server/session-utils.mjs +4 -2
- package/server/subagents.mjs +1 -1
- package/server/terminal/terminal-manager.mjs +2 -4
- package/server/tools/definitions.mjs +2 -2
- package/server/tools/index.mjs +5 -3
- package/server/utils/package-update.mjs +70 -47
- package/server/utils/process-env.mjs +7 -0
- package/server/utils/response.mjs +2 -2
- package/dist/assets/AgentProfilesPage-BFgyFa5e.js +0 -1
- package/dist/assets/SettingsWorkspacePage-Dr9zT5Bs.js +0 -1495
- package/dist/assets/SharedConversationPage-op3DRwcw.js +0 -1
- package/dist/assets/TerminalDock-BL_UovwU.js +0 -2
- package/dist/assets/WorkspaceInspector-73dhAime.js +0 -13
- package/dist/assets/architecture-TIHT7OUA-BgP-IMeo.js +0 -1
- package/dist/assets/channel-Rz20dKTK.js +0 -1
- package/dist/assets/chunk-2Q5K7J3B-Cb14ZF_k.js +0 -1
- package/dist/assets/chunk-VAUOI2AC-BOZvd2Sn.js +0 -1
- package/dist/assets/chunk-XXDRQBXY-CD_EGCtT.js +0 -1
- package/dist/assets/classDiagram-OUVF2IWQ-C_ozTKCt.js +0 -1
- package/dist/assets/classDiagram-v2-EOCWNBFH-FOfFbbZF.js +0 -1
- package/dist/assets/cynefin-VYW2F7L2-BzPhLtd5.js +0 -1
- package/dist/assets/eventmodeling-45OFAUF4-BcgGbVJ-.js +0 -1
- package/dist/assets/flowDiagram-23GEKE2U-dtkzcC8E.js +0 -1
- package/dist/assets/gitGraph-TEB2WS4Q-VByWboBU.js +0 -1
- package/dist/assets/icons-BP8YOS-Z.js +0 -1
- package/dist/assets/index-Cu2bBHLv.css +0 -3
- package/dist/assets/index-yV1wtqTr.js +0 -66
- package/dist/assets/info-DKCQHKI2-CZeDLZxx.js +0 -1
- package/dist/assets/packet-7NZHBO7P-decrrxyX.js +0 -1
- package/dist/assets/pie-RZYD4A2V-J1CasQZl.js +0 -1
- package/dist/assets/radar-I7S5WNFK-B-sZytUA.js +0 -1
- package/dist/assets/railroad-3IZDKUUU-BSaqNPm8.js +0 -1
- package/dist/assets/railroad-abnf-AHOZXSZD-lzZR7PxT.js +0 -1
- package/dist/assets/railroad-ebnf-EBAXGLYW-DQtz1Fh9.js +0 -1
- package/dist/assets/railroad-peg-LSFZ7HO6-CpMsuGY3.js +0 -1
- package/dist/assets/stateDiagram-v2-6OUMAXLB-BGLshxcY.js +0 -1
- package/dist/assets/swimlanesDiagram-G3AALYLV-CqdqxA-b.js +0 -8
- package/dist/assets/treeView-QDETBFTQ-Byb71heW.js +0 -1
- package/dist/assets/treemap-6X3UGDF4-CMV1SJsq.js +0 -1
- package/dist/assets/wardley-OPB4EBWU-DtCHtr2V.js +0 -1
- /package/dist/assets/{array-CYkMkqnU.js → array-DqLCdDFv.js} +0 -0
- /package/dist/assets/{chunk-KEIR6QF5-77hsebd7.js → chunk-KEIR6QF5-s7Qq-R3i.js} +0 -0
- /package/dist/assets/{chunk-Y2CYZVJY-CQltPwYk.js → chunk-Y2CYZVJY-BgISNSiw.js} +0 -0
- /package/dist/assets/{css-utils-rkE68RDy.js → css-utils-31qzCXsk.js} +0 -0
- /package/dist/assets/{cytoscape.esm-DwdZnGOm.js → cytoscape.esm-iekjSZ2n.js} +0 -0
- /package/dist/assets/{defaultLocale-Beh6XjaL.js → defaultLocale-CrJzLgRD.js} +0 -0
- /package/dist/assets/{dist-DelZBZpK.js → dist-zzfqk5hx.js} +0 -0
- /package/dist/assets/{graphlib-CAISHZh4.js → graphlib-CIz_CfxW.js} +0 -0
- /package/dist/assets/{init-Rr1s_RiX.js → init-C0r9Gk5G.js} +0 -0
- /package/dist/assets/{lit-vendor-Dr3cpBGF.js → lit-vendor-DvaQX_UQ.js} +0 -0
- /package/dist/assets/{logger-B65Akg8A.js → logger-8REuLPGK.js} +0 -0
- /package/dist/assets/{path-BAQ3hXlG.js → path-DIKpVbHL.js} +0 -0
- /package/dist/assets/{plugin-api-BbUkYm3Y.js → plugin-api-C8hMT5W6.js} +0 -0
- /package/dist/assets/{rough.esm-Djo4Abte.js → rough.esm-BMOtDaaS.js} +0 -0
- /package/dist/assets/{xterm-CGiQzDiR.js → xterm-BFzZ1FH4.js} +0 -0
|
@@ -0,0 +1,1628 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/AgentProfilesPage-B84w-r9S.js","assets/rolldown-runtime-DWdDZTNf.js","assets/index-B48prgLL.js","assets/pi-ai-DAJlO9ZB.js","assets/dist-DLKC_odd.js","assets/pi-web-ui-B-RJSxjR.js","assets/lit-vendor-DvaQX_UQ.js","assets/css-utils-31qzCXsk.js","assets/icons-cTkqD_Gi.js","assets/react-vendor-eWH0QhNU.js","assets/skills-dialog-DDh1h8eH.js","assets/logger-8REuLPGK.js","assets/index-DQhwHHer.css","assets/mcp-servers-dialog-GXXD9K0U.js","assets/PluginsPage-D2862wul.js","assets/plugin-api-C8hMT5W6.js","assets/ScheduledTasksPage-GqbiJDPX.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e}from"./rolldown-runtime-DWdDZTNf.js";import{A as t,At as n,Dt as r,Et as i,H as a,It as o,Nt as s,Ot as c,Pt as l,Tt as u,_ as ee,bt as te,f as d,ft as f,h as ne,l as re,ot as p,s as m,st as h,x as g}from"./icons-cTkqD_Gi.js";import{n as ie,r as ae}from"./react-vendor-eWH0QhNU.js";import{p as _}from"./lit-vendor-DvaQX_UQ.js";import{m as v,x as y}from"./pi-web-ui-B-RJSxjR.js";import{J as b}from"./pi-ai-DAJlO9ZB.js";import{t as x}from"./logger-8REuLPGK.js";import{A as oe,Ct as se,Dt as ce,Et as le,F as S,Ft as ue,G as de,H as fe,I as C,It as w,J as T,K as pe,M as me,Mt as E,N as he,Nt as ge,O as _e,P as ve,Pt as ye,R as be,Tt as D,U as xe,V as Se,_t as O,a as Ce,i as k,j as we,jt as Te,k as Ee,kt as De,n as Oe,q as A,r as ke,t as Ae,vt as je,wt as Me,xt as Ne,yt as Pe}from"./index-B48prgLL.js";var j=e(o(),1),Fe={openai:{name:`OpenAI`,baseUrl:`https://api.openai.com/v1`,protocol:`openai-completions`,modelId:`gpt-4o`,supportsImages:!0},deepseek:{name:`DeepSeek`,baseUrl:`https://api.deepseek.com/v1`,protocol:`openai-completions`,modelId:`deepseek-chat`},glm:{name:`Zhipu GLM`,baseUrl:`https://open.bigmodel.cn/api/paas/v4`,protocol:`openai-completions`,modelId:`glm-4-plus`},ollama:{name:`Ollama`,baseUrl:`http://localhost:11434/v1`,protocol:`openai-completions`,modelId:`llama3.1`},litellm:{name:O.name,baseUrl:O.baseUrl,protocol:`openai-completions`,modelId:O.modelId,supportsImages:O.supportsImages}},Ie=[{key:`openai`,label:w(`presetOpenai`)},{key:`deepseek`,label:w(`presetDeepseek`)},{key:`glm`,label:w(`presetGlm`)},{key:`ollama`,label:w(`presetOllama`)},{key:`litellm`,label:w(`presetLitellm`)},{key:`custom`,label:w(`presetCustom`)}],M=()=>({modelId:``,contextWindow:O.contextWindow,maxTokens:O.maxTokens,reasoning:!0,supportsImages:!1,open:!1}),N=()=>({name:O.name,baseUrl:O.baseUrl,apiKey:``,headerRows:[],protocol:`openai-completions`,models:[M()]}),Le=class extends v{providers=[];form=N();editingProviderId;formOpen=!1;loading=!0;apiKeyVisible=!1;advancedOpen=!1;activePreset=``;testing=!1;testResult=`idle`;testError=``;autoEditProviderName=null;async connectedCallback(){if(super.connectedCallback(),await this.loadProviders(),this.autoEditProviderName){let e=this.providers.find(e=>e.name===this.autoEditProviderName);e&&await this.openEditForm(e),this.autoEditProviderName=null}}getTabName(){return w(`customModels`)}async loadProviders(){this.loading=!0,this.requestUpdate();try{this.providers=await y().customProviders.getAll()}catch(e){x.error(`Failed to load custom providers:`,e),this.providers=[]}finally{this.loading=!1,this.requestUpdate()}}resetTestState(){this.testing=!1,this.testResult=`idle`,this.testError=``}openAddForm(){this.editingProviderId=void 0,this.form=N(),this.apiKeyVisible=!1,this.advancedOpen=!1,this.activePreset=``,this.resetTestState(),this.formOpen=!0,this.requestUpdate()}async openEditForm(e){let t=await y().providerKeys.get(e.name)??e.apiKey??``,n=e.models??[],r=n.length>0?n.map(e=>({modelId:e.id,contextWindow:e.contextWindow??O.contextWindow,maxTokens:e.maxTokens??O.maxTokens,reasoning:e.reasoning===!0,supportsImages:e.input?.includes(`image`)===!0,open:!1})):[M()],i=n[0]?.headers??{},a=Object.entries(i).map(([e,t])=>({key:e,value:String(t)}));this.editingProviderId=e.id,this.form={providerId:e.id,id:e.id,name:e.name,baseUrl:e.baseUrl,apiKey:t,headerRows:a,protocol:e.type===`anthropic-messages`?`anthropic-messages`:`openai-completions`,models:r},this.apiKeyVisible=!1,this.advancedOpen=a.length>0||e.type===`anthropic-messages`,this.activePreset=``,this.resetTestState(),this.formOpen=!0,this.requestUpdate()}closeForm(){this.formOpen=!1,this.editingProviderId=void 0,this.form=N(),this.apiKeyVisible=!1,this.advancedOpen=!1,this.activePreset=``,this.resetTestState(),this.requestUpdate()}toggleApiKeyVisibility(){this.apiKeyVisible=!this.apiKeyVisible,this.requestUpdate()}updateForm(e,t){this.form={...this.form,[e]:t},(e===`name`||e===`baseUrl`)&&(this.activePreset=``),this.resetTestState(),this.requestUpdate()}updateModelField(e,t,n){let r=this.form.models.map((r,i)=>i===e?{...r,[t]:n}:r);this.form={...this.form,models:r},t===`modelId`&&(this.activePreset=``,this.resetTestState()),this.requestUpdate()}addModelRow(){this.form={...this.form,models:[...this.form.models,M()]},this.requestUpdate()}removeModelRow(e){let t=this.form.models.filter((t,n)=>n!==e);this.form={...this.form,models:t},this.requestUpdate()}toggleModelExpanded(e){let t=this.form.models.map((t,n)=>n===e?{...t,open:!t.open}:t);this.form={...this.form,models:t},this.requestUpdate()}addHeaderRow(){this.form={...this.form,headerRows:[...this.form.headerRows,{key:``,value:``}]},this.requestUpdate()}updateHeaderRow(e,t,n){let r=this.form.headerRows.map((r,i)=>i===e?{...r,[t]:n}:r);this.form={...this.form,headerRows:r},this.requestUpdate()}removeHeaderRow(e){let t=this.form.headerRows.filter((t,n)=>n!==e);this.form={...this.form,headerRows:t},this.requestUpdate()}applyPreset(e){if(this.activePreset=e,e===`custom`)this.form={...this.form,name:``,baseUrl:``,protocol:`openai-completions`,models:[M()]};else{let t=Fe[e];this.form={...this.form,name:t.name,baseUrl:t.baseUrl,protocol:t.protocol,models:[{...M(),modelId:t.modelId,supportsImages:t.supportsImages===!0,open:!1}]}}this.resetTestState(),this.requestUpdate()}buildHeadersFromRows(){let e={};for(let t of this.form.headerRows){let n=t.key.trim(),r=t.value.trim();n&&r&&(e[n]=r)}return e}buildModel(e,t){let n=this.form.name.trim(),r=this.form.baseUrl.trim(),i=e.reasoning===!0,a=e.supportsImages===!0?[`text`,`image`]:[`text`],o=r.includes(`api.deepseek.com`);return se({id:e.modelId,name:`${e.modelId} (${n})`,api:this.form.protocol,provider:n,baseUrl:r.replace(/\/$/,``),reasoning:i,input:a,cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:Number(e.contextWindow)||O.contextWindow,maxTokens:Number(e.maxTokens)||O.maxTokens,headers:Object.keys(t).length>0?t:void 0,thinkingLevelMap:o&&i?{low:`high`,medium:`high`,high:`high`,xhigh:`max`}:void 0,compat:this.form.protocol===`openai-completions`?{supportsStore:!1,supportsDeveloperRole:!1,supportsReasoningEffort:i,supportsUsageInStreaming:!1,supportsStrictMode:!1,maxTokensField:`max_tokens`,...o&&i?{requiresReasoningContentOnAssistantMessages:!0,thinkingFormat:`deepseek`}:{}}:void 0})}async testConnection(){let e=this.form.baseUrl.trim(),t=this.form.models.find(e=>e.modelId.trim());if(!e||!t){this.testing=!1,this.testResult=`fail`,this.testError=w(`testRequiresFields`),this.requestUpdate();return}let n=this.buildHeadersFromRows(),r=this.buildModel(t,n);this.testing=!0,this.testResult=`idle`,this.testError=``,this.requestUpdate();try{let e=await(await fetch(`/api/models/test-connection`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({model:r,apiKey:this.form.apiKey.trim()})})).json().catch(()=>({}));e?.ok?(this.testResult=`ok`,this.testError=``):(this.testResult=`fail`,this.testError=e?.error||w(`connectionFailed`))}catch(e){this.testResult=`fail`,this.testError=e?.message||w(`connectionFailed`)}finally{this.testing=!1,this.requestUpdate()}}async saveModel(){let e=this.form.name.trim(),t=this.form.baseUrl.trim();if(!e||!t){A(w(`fillProviderBaseUrlModel`));return}let n=this.form.models.filter(e=>e.modelId.trim());if(n.length===0){A(w(`atLeastOneModel`));return}let r=n.map(e=>e.modelId.trim());if(new Set(r).size!==r.length){A(w(`duplicateModelId`));return}let i=this.buildHeadersFromRows(),a=n.map(e=>this.buildModel(e,i)),o=this.form.apiKey.trim(),s=this.editingProviderId?this.providers.find(e=>e.id===this.editingProviderId):void 0,c={id:this.editingProviderId??le(),name:e,type:this.form.protocol,baseUrl:a[0].baseUrl,apiKey:o||void 0,models:a};try{let e=y();await e.customProviders.set(c),s&&s.name!==c.name&&await e.providerKeys.delete(s.name),o?await e.providerKeys.set(c.name,o):await e.providerKeys.delete(c.name),ce(),this.closeForm(),await this.loadProviders()}catch(e){x.error(`Failed to save custom model:`,e),A(w(`saveCustomModelFailed`))}}async deleteProvider(e){if(await T({description:w(`confirmDeleteProvider`,{name:e.name}),confirmLabel:w(`confirmDelete`),cancelLabel:w(`cancel`),variant:`destructive`}))try{let t=y();await t.customProviders.delete(e.id),await t.providerKeys.delete(e.name),ce(),await this.loadProviders()}catch(e){x.error(`Failed to delete custom provider:`,e),A(w(`deleteFailed`))}}renderProvider(e){let t=e.models??[],n=t.length,r=e.type===`anthropic-messages`?`Anthropic Messages`:`OpenAI Compatible`;return _`
|
|
3
|
+
<div class="quickforge-settings-list-item">
|
|
4
|
+
<div class="quickforge-settings-list-item-main">
|
|
5
|
+
<div class="flex min-w-0 items-start gap-3">
|
|
6
|
+
<span class="quickforge-settings-avatar" aria-hidden="true">${e.name.trim().charAt(0).toUpperCase()||`M`}</span>
|
|
7
|
+
<div class="min-w-0 flex-1">
|
|
8
|
+
<div class="quickforge-settings-row-title">${e.name}</div>
|
|
9
|
+
<div class="quickforge-settings-row-description break-all">${e.baseUrl}</div>
|
|
10
|
+
<div class="quickforge-settings-meta">
|
|
11
|
+
<span class="quickforge-settings-badge quickforge-settings-badge-muted">${w(`providerProtocol`)}: ${r}</span>
|
|
12
|
+
<span class="quickforge-settings-badge quickforge-settings-badge-info">${w(`modelsCount`,{count:n})}</span>
|
|
13
|
+
${n===0?_`<span class="quickforge-settings-badge quickforge-settings-badge-warning">${w(`noModelAdded`)}</span>`:null}
|
|
14
|
+
</div>
|
|
15
|
+
${n>0?_`
|
|
16
|
+
<div class="quickforge-settings-meta">
|
|
17
|
+
${t.slice(0,6).map(e=>_`
|
|
18
|
+
<code class="quickforge-settings-command-name">${e.id}</code>
|
|
19
|
+
`)}
|
|
20
|
+
${t.length>6?_`<span class="quickforge-settings-badge quickforge-settings-badge-muted">+${t.length-6}</span>`:null}
|
|
21
|
+
</div>
|
|
22
|
+
`:null}
|
|
23
|
+
</div>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
<div class="quickforge-settings-list-item-actions">
|
|
27
|
+
<button
|
|
28
|
+
class="quickforge-settings-button quickforge-settings-button-secondary quickforge-settings-button-compact"
|
|
29
|
+
type="button"
|
|
30
|
+
@click=${()=>this.openEditForm(e)}
|
|
31
|
+
>
|
|
32
|
+
${w(`editModel`)}
|
|
33
|
+
</button>
|
|
34
|
+
<button
|
|
35
|
+
class="quickforge-settings-button quickforge-settings-button-danger quickforge-settings-button-compact"
|
|
36
|
+
type="button"
|
|
37
|
+
@click=${()=>this.deleteProvider(e)}
|
|
38
|
+
>
|
|
39
|
+
${w(`delete`)}
|
|
40
|
+
</button>
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
`}renderPresetChips(){return _`
|
|
44
|
+
<div class="quickforge-settings-form-row">
|
|
45
|
+
<span class="quickforge-settings-form-label">${w(`presets`)}</span>
|
|
46
|
+
<div class="quickforge-settings-segmented quickforge-settings-segmented-wrap">
|
|
47
|
+
${Ie.map(e=>_`
|
|
48
|
+
<button
|
|
49
|
+
class="quickforge-settings-segmented-option ${this.activePreset===e.key?`quickforge-settings-segmented-option-active`:``}"
|
|
50
|
+
type="button"
|
|
51
|
+
@click=${()=>this.applyPreset(e.key)}
|
|
52
|
+
>
|
|
53
|
+
${e.label}
|
|
54
|
+
</button>
|
|
55
|
+
`)}
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
`}renderModelRow(e,t){let n=e.open===!0;return _`
|
|
59
|
+
<div class="quickforge-settings-subrow quickforge-settings-row-align-start">
|
|
60
|
+
<button
|
|
61
|
+
class="quickforge-settings-icon-action"
|
|
62
|
+
type="button"
|
|
63
|
+
title=${w(`expandModel`)}
|
|
64
|
+
aria-expanded=${n?`true`:`false`}
|
|
65
|
+
@click=${()=>this.toggleModelExpanded(t)}
|
|
66
|
+
>
|
|
67
|
+
${n?`▾`:`▸`}
|
|
68
|
+
</button>
|
|
69
|
+
<div class="quickforge-settings-list-item-main">
|
|
70
|
+
<input
|
|
71
|
+
class="quickforge-settings-input quickforge-settings-mono"
|
|
72
|
+
.value=${e.modelId}
|
|
73
|
+
@input=${e=>this.updateModelField(t,`modelId`,e.target.value)}
|
|
74
|
+
placeholder=${w(`modelIdPlaceholder`)}
|
|
75
|
+
/>
|
|
76
|
+
${n?_`
|
|
77
|
+
<div class="quickforge-settings-model-grid mt-3">
|
|
78
|
+
<label class="quickforge-settings-form-row">
|
|
79
|
+
<span class="quickforge-settings-form-label">${w(`contextWindow`)}</span>
|
|
80
|
+
<input
|
|
81
|
+
class="quickforge-settings-input"
|
|
82
|
+
.value=${String(e.contextWindow)}
|
|
83
|
+
type="number"
|
|
84
|
+
@input=${e=>this.updateModelField(t,`contextWindow`,Number(e.target.value))}
|
|
85
|
+
/>
|
|
86
|
+
</label>
|
|
87
|
+
<label class="quickforge-settings-form-row">
|
|
88
|
+
<span class="quickforge-settings-form-label">${w(`maxTokens`)}</span>
|
|
89
|
+
<input
|
|
90
|
+
class="quickforge-settings-input"
|
|
91
|
+
.value=${String(e.maxTokens)}
|
|
92
|
+
type="number"
|
|
93
|
+
@input=${e=>this.updateModelField(t,`maxTokens`,Number(e.target.value))}
|
|
94
|
+
/>
|
|
95
|
+
</label>
|
|
96
|
+
</div>
|
|
97
|
+
<label class="mt-3 flex items-center gap-2 text-sm text-muted-foreground">
|
|
98
|
+
<input
|
|
99
|
+
type="checkbox"
|
|
100
|
+
.checked=${e.reasoning}
|
|
101
|
+
@change=${e=>this.updateModelField(t,`reasoning`,e.target.checked)}
|
|
102
|
+
/>
|
|
103
|
+
<span>${w(`reasoningModel`)}</span>
|
|
104
|
+
</label>
|
|
105
|
+
<label class="mt-2 flex items-center gap-2 text-sm text-muted-foreground">
|
|
106
|
+
<input
|
|
107
|
+
type="checkbox"
|
|
108
|
+
.checked=${e.supportsImages}
|
|
109
|
+
@change=${e=>this.updateModelField(t,`supportsImages`,e.target.checked)}
|
|
110
|
+
/>
|
|
111
|
+
<span>
|
|
112
|
+
${w(`imageInputModel`)}
|
|
113
|
+
<quickforge-info-tip .label=${w(`imageInputModelHelp`)}></quickforge-info-tip>
|
|
114
|
+
</span>
|
|
115
|
+
</label>
|
|
116
|
+
`:null}
|
|
117
|
+
</div>
|
|
118
|
+
${this.form.models.length>1?_`
|
|
119
|
+
<button
|
|
120
|
+
class="quickforge-settings-icon-action quickforge-settings-icon-action-danger"
|
|
121
|
+
type="button"
|
|
122
|
+
title=${w(`delete`)}
|
|
123
|
+
@click=${()=>this.removeModelRow(t)}
|
|
124
|
+
>
|
|
125
|
+
✕
|
|
126
|
+
</button>
|
|
127
|
+
`:null}
|
|
128
|
+
</div>
|
|
129
|
+
`}renderHeadersEditor(){return _`
|
|
130
|
+
<div class="quickforge-settings-form-row">
|
|
131
|
+
<span class="quickforge-settings-form-label">
|
|
132
|
+
${w(`customHeaders`)}
|
|
133
|
+
<quickforge-info-tip .label=${w(`customHeadersHelp`)}></quickforge-info-tip>
|
|
134
|
+
</span>
|
|
135
|
+
${this.form.headerRows.length===0?_``:_`
|
|
136
|
+
<div class="quickforge-settings-nested-list">
|
|
137
|
+
${this.form.headerRows.map((e,t)=>_`
|
|
138
|
+
<div class="quickforge-settings-subrow">
|
|
139
|
+
<input
|
|
140
|
+
class="quickforge-settings-input"
|
|
141
|
+
.value=${e.key}
|
|
142
|
+
@input=${e=>this.updateHeaderRow(t,`key`,e.target.value)}
|
|
143
|
+
placeholder=${w(`headerName`)}
|
|
144
|
+
/>
|
|
145
|
+
<input
|
|
146
|
+
class="quickforge-settings-input"
|
|
147
|
+
.value=${e.value}
|
|
148
|
+
@input=${e=>this.updateHeaderRow(t,`value`,e.target.value)}
|
|
149
|
+
placeholder=${w(`headerValue`)}
|
|
150
|
+
/>
|
|
151
|
+
<button
|
|
152
|
+
class="quickforge-settings-icon-action quickforge-settings-icon-action-danger"
|
|
153
|
+
type="button"
|
|
154
|
+
title=${w(`removeHeader`)}
|
|
155
|
+
@click=${()=>this.removeHeaderRow(t)}
|
|
156
|
+
>
|
|
157
|
+
✕
|
|
158
|
+
</button>
|
|
159
|
+
</div>
|
|
160
|
+
`)}
|
|
161
|
+
</div>
|
|
162
|
+
`}
|
|
163
|
+
<button
|
|
164
|
+
class="quickforge-settings-button quickforge-settings-button-secondary quickforge-settings-button-compact"
|
|
165
|
+
type="button"
|
|
166
|
+
@click=${()=>this.addHeaderRow()}
|
|
167
|
+
>
|
|
168
|
+
+ ${w(`addHeader`)}
|
|
169
|
+
</button>
|
|
170
|
+
</div>
|
|
171
|
+
`}renderTestStatus(){return this.testResult===`idle`&&!this.testing?_``:this.testing?_`<span class="quickforge-settings-status">${w(`testingConnection`)}</span>`:this.testResult===`ok`?_`<span class="quickforge-settings-badge quickforge-settings-badge-success">✓ ${w(`connectionOk`)}</span>`:_`<span class="quickforge-settings-alert">✗ ${this.testError||w(`connectionFailed`)}</span>`}renderForm(){return _`
|
|
172
|
+
<section class="quickforge-settings-section" aria-label=${this.editingProviderId?w(`editCustomModel`):w(`addCustomModel`)}>
|
|
173
|
+
<div class="quickforge-settings-toolbar">
|
|
174
|
+
<button
|
|
175
|
+
class="quickforge-settings-button quickforge-settings-button-secondary"
|
|
176
|
+
type="button"
|
|
177
|
+
@click=${()=>this.closeForm()}
|
|
178
|
+
>
|
|
179
|
+
<svg class="size-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m12 19-7-7 7-7"/><path d="M19 12H5"/></svg>
|
|
180
|
+
${w(`back`)}
|
|
181
|
+
</button>
|
|
182
|
+
<div class="quickforge-settings-row-main">
|
|
183
|
+
<div class="quickforge-settings-row-title">${this.editingProviderId?w(`editCustomModel`):w(`addCustomModel`)}</div>
|
|
184
|
+
<div class="quickforge-settings-row-description">${w(`customModelsDescription`)}</div>
|
|
185
|
+
</div>
|
|
186
|
+
</div>
|
|
187
|
+
|
|
188
|
+
<div class="quickforge-settings-form-grid">
|
|
189
|
+
${this.renderPresetChips()}
|
|
190
|
+
|
|
191
|
+
<label class="quickforge-settings-form-row">
|
|
192
|
+
<span class="quickforge-settings-form-label">${w(`providerName`)}</span>
|
|
193
|
+
<input
|
|
194
|
+
class="quickforge-settings-input"
|
|
195
|
+
.value=${this.form.name}
|
|
196
|
+
@input=${e=>this.updateForm(`name`,e.target.value)}
|
|
197
|
+
placeholder=${w(`providerNamePlaceholder`)}
|
|
198
|
+
/>
|
|
199
|
+
</label>
|
|
200
|
+
|
|
201
|
+
<label class="quickforge-settings-form-row">
|
|
202
|
+
<span class="quickforge-settings-form-label">Base URL</span>
|
|
203
|
+
<input
|
|
204
|
+
class="quickforge-settings-input"
|
|
205
|
+
.value=${this.form.baseUrl}
|
|
206
|
+
@input=${e=>this.updateForm(`baseUrl`,e.target.value)}
|
|
207
|
+
placeholder=${this.form.protocol===`anthropic-messages`?`e.g., https://api.anthropic.com`:`e.g., http://localhost:4000/v1`}
|
|
208
|
+
/>
|
|
209
|
+
</label>
|
|
210
|
+
|
|
211
|
+
<label class="quickforge-settings-form-row">
|
|
212
|
+
<span class="quickforge-settings-form-label">${w(`apiKey`)}</span>
|
|
213
|
+
<div class="quickforge-settings-inline-field">
|
|
214
|
+
<input
|
|
215
|
+
class="quickforge-settings-input pr-10"
|
|
216
|
+
.value=${this.form.apiKey}
|
|
217
|
+
type=${this.apiKeyVisible?`text`:`password`}
|
|
218
|
+
@input=${e=>this.updateForm(`apiKey`,e.target.value)}
|
|
219
|
+
placeholder=${w(`apiKeyPlaceholder`)}
|
|
220
|
+
/>
|
|
221
|
+
<button
|
|
222
|
+
class="quickforge-settings-inline-field-button"
|
|
223
|
+
type="button"
|
|
224
|
+
title=${this.apiKeyVisible?w(`hideApiKey`):w(`showApiKey`)}
|
|
225
|
+
aria-label=${this.apiKeyVisible?w(`hideApiKey`):w(`showApiKey`)}
|
|
226
|
+
aria-pressed=${this.apiKeyVisible?`true`:`false`}
|
|
227
|
+
@click=${()=>this.toggleApiKeyVisibility()}
|
|
228
|
+
>
|
|
229
|
+
${this.apiKeyVisible?_`<svg class="size-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68"/><path d="M6.61 6.61A13.53 13.53 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61"/><line x1="2" y1="2" x2="22" y2="22"/><path d="M8.53 8.53A5 5 0 0 0 12 17a5 5 0 0 0 3.47-8.53"/></svg>`:_`<svg class="size-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"/><circle cx="12" cy="12" r="3"/></svg>`}
|
|
230
|
+
</button>
|
|
231
|
+
</div>
|
|
232
|
+
</label>
|
|
233
|
+
|
|
234
|
+
<div class="quickforge-settings-form-row">
|
|
235
|
+
<div class="flex items-center justify-between gap-3">
|
|
236
|
+
<span class="quickforge-settings-form-label">${w(`modelsList`)}</span>
|
|
237
|
+
<button
|
|
238
|
+
class="quickforge-settings-button quickforge-settings-button-secondary quickforge-settings-button-compact"
|
|
239
|
+
type="button"
|
|
240
|
+
@click=${()=>this.addModelRow()}
|
|
241
|
+
>
|
|
242
|
+
+ ${w(`addModel`)}
|
|
243
|
+
</button>
|
|
244
|
+
</div>
|
|
245
|
+
<div class="quickforge-settings-nested-list">
|
|
246
|
+
${this.form.models.map((e,t)=>this.renderModelRow(e,t))}
|
|
247
|
+
</div>
|
|
248
|
+
</div>
|
|
249
|
+
|
|
250
|
+
<button
|
|
251
|
+
class="quickforge-settings-details-toggle"
|
|
252
|
+
type="button"
|
|
253
|
+
aria-expanded=${this.advancedOpen?`true`:`false`}
|
|
254
|
+
@click=${()=>{this.advancedOpen=!this.advancedOpen,this.requestUpdate()}}
|
|
255
|
+
>
|
|
256
|
+
<span>${this.advancedOpen?`▾`:`▸`}</span>
|
|
257
|
+
${w(`providerAdvanced`)}
|
|
258
|
+
</button>
|
|
259
|
+
|
|
260
|
+
${this.advancedOpen?_`
|
|
261
|
+
<div class="quickforge-settings-form-grid rounded-lg border border-border p-3">
|
|
262
|
+
<label class="quickforge-settings-form-row">
|
|
263
|
+
<span class="quickforge-settings-form-label">
|
|
264
|
+
${w(`protocolType`)}
|
|
265
|
+
<quickforge-info-tip .label=${w(`protocolHelp`)}></quickforge-info-tip>
|
|
266
|
+
</span>
|
|
267
|
+
<select
|
|
268
|
+
class="quickforge-settings-select"
|
|
269
|
+
.value=${this.form.protocol}
|
|
270
|
+
@change=${e=>this.updateForm(`protocol`,e.target.value)}
|
|
271
|
+
>
|
|
272
|
+
<option value="openai-completions">OpenAI Compatible / Chat Completions</option>
|
|
273
|
+
<option value="anthropic-messages">Anthropic Messages</option>
|
|
274
|
+
</select>
|
|
275
|
+
</label>
|
|
276
|
+
${this.renderHeadersEditor()}
|
|
277
|
+
</div>
|
|
278
|
+
`:null}
|
|
279
|
+
</div>
|
|
280
|
+
|
|
281
|
+
<div class="quickforge-settings-row">
|
|
282
|
+
<div class="quickforge-settings-row-main">
|
|
283
|
+
${this.renderTestStatus()}
|
|
284
|
+
</div>
|
|
285
|
+
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide">
|
|
286
|
+
<button
|
|
287
|
+
class="quickforge-settings-button quickforge-settings-button-secondary"
|
|
288
|
+
type="button"
|
|
289
|
+
@click=${()=>this.closeForm()}
|
|
290
|
+
>
|
|
291
|
+
${w(`cancel`)}
|
|
292
|
+
</button>
|
|
293
|
+
<button
|
|
294
|
+
class="quickforge-settings-button quickforge-settings-button-secondary"
|
|
295
|
+
type="button"
|
|
296
|
+
?disabled=${this.testing}
|
|
297
|
+
@click=${()=>this.testConnection()}
|
|
298
|
+
>
|
|
299
|
+
${this.testing?w(`testingConnection`):w(`testConnection`)}
|
|
300
|
+
</button>
|
|
301
|
+
<button
|
|
302
|
+
class="quickforge-settings-button quickforge-settings-button-primary"
|
|
303
|
+
type="button"
|
|
304
|
+
@click=${()=>this.saveModel()}
|
|
305
|
+
>
|
|
306
|
+
${w(`save`)}
|
|
307
|
+
</button>
|
|
308
|
+
</div>
|
|
309
|
+
</div>
|
|
310
|
+
</section>
|
|
311
|
+
`}render(){return this.formOpen?_`
|
|
312
|
+
<div class="quickforge-settings-stack">
|
|
313
|
+
<div class="quickforge-settings-heading">
|
|
314
|
+
<h3 class="quickforge-settings-title">
|
|
315
|
+
${this.editingProviderId?w(`editCustomModel`):w(`addCustomModel`)}
|
|
316
|
+
<quickforge-info-tip .label=${w(`customModelsDescription`)}></quickforge-info-tip>
|
|
317
|
+
</h3>
|
|
318
|
+
</div>
|
|
319
|
+
${this.renderForm()}
|
|
320
|
+
</div>
|
|
321
|
+
`:_`
|
|
322
|
+
<div class="quickforge-settings-stack">
|
|
323
|
+
<section class="quickforge-settings-section" aria-label=${w(`customModelsTitle`)}>
|
|
324
|
+
<div class="quickforge-settings-toolbar">
|
|
325
|
+
<div>
|
|
326
|
+
<div class="quickforge-settings-row-title">${w(`customModelsTitle`)}</div>
|
|
327
|
+
<div class="quickforge-settings-row-description">${w(`customModelsDescription`)}</div>
|
|
328
|
+
</div>
|
|
329
|
+
<button
|
|
330
|
+
class="quickforge-settings-button quickforge-settings-button-primary"
|
|
331
|
+
type="button"
|
|
332
|
+
@click=${()=>this.openAddForm()}
|
|
333
|
+
>
|
|
334
|
+
${w(`addModel`)}
|
|
335
|
+
</button>
|
|
336
|
+
</div>
|
|
337
|
+
|
|
338
|
+
${this.loading?_`<div class="quickforge-settings-empty-row">${w(`loading`)}</div>`:this.providers.length===0?_`<div class="quickforge-settings-empty-row">${w(`noCustomModels`)}</div>`:this.providers.map(e=>this.renderProvider(e))}
|
|
339
|
+
</section>
|
|
340
|
+
</div>
|
|
341
|
+
`}},P=`quickforge-custom-providers-only-tab`;customElements.get(P)||customElements.define(P,Le);function Re(e){let t=document.createElement(P);return e&&(t.autoEditProviderName=e),t}var ze=[{value:`light`,label:()=>w(`lightTheme`)},{value:`dark`,label:()=>w(`darkTheme`)}],Be=class extends v{theme=me();interfaceFontSizePx=S.interfaceFontSizePx;messageFontSizePx=S.messageFontSizePx;loading=!0;error=``;getTabName(){return w(`appearance`)}async connectedCallback(){super.connectedCallback(),await this.loadSettings()}async loadSettings(){this.loading=!0,this.error=``,this.requestUpdate();try{let e=y(),[t,n]=await Promise.all([he(e),Se(e)]);this.theme=t.theme,this.interfaceFontSizePx=n.interfaceFontSizePx,this.messageFontSizePx=n.messageFontSizePx}catch(e){this.error=e instanceof Error?e.message:w(`requestFailed`)}finally{this.loading=!1,this.requestUpdate()}}async selectTheme(e){if(this.theme!==e){this.theme=e,this.requestUpdate();try{await ve(y(),{theme:e}),this.error=``,this.requestUpdate()}catch(e){this.error=e instanceof Error?e.message:w(`requestFailed`),this.requestUpdate()}}}currentFontSizeSettings(){return fe({interfaceFontSizePx:this.interfaceFontSizePx,messageFontSizePx:this.messageFontSizePx})}previewFontSize(e){let t=fe(e);this.interfaceFontSizePx=t.interfaceFontSizePx,this.messageFontSizePx=t.messageFontSizePx,be(t),this.requestUpdate()}updateInterfaceFontSize(e){this.previewFontSize({...this.currentFontSizeSettings(),interfaceFontSizePx:Number(e)||S.interfaceFontSizePx})}updateMessageFontSize(e){this.previewFontSize({...this.currentFontSizeSettings(),messageFontSizePx:Number(e)||S.messageFontSizePx})}async saveFontSize(){try{await xe(y(),this.currentFontSizeSettings()),this.error=``,this.requestUpdate()}catch(e){this.error=e instanceof Error?e.message:w(`requestFailed`),this.requestUpdate()}}renderThemeOption(e){let t=this.theme===e.value;return _`
|
|
342
|
+
<button
|
|
343
|
+
type="button"
|
|
344
|
+
class="quickforge-settings-segmented-option ${t?`quickforge-settings-segmented-option-active`:``}"
|
|
345
|
+
aria-pressed=${t?`true`:`false`}
|
|
346
|
+
@click=${()=>this.selectTheme(e.value)}
|
|
347
|
+
>
|
|
348
|
+
${e.label()}
|
|
349
|
+
</button>
|
|
350
|
+
`}getFontSizeRangeProgress(e){return(e-C.min)/(C.max-C.min)*100}renderFontSizeSlider(e,t,n,r){return _`
|
|
351
|
+
<div class="quickforge-settings-row">
|
|
352
|
+
<div class="quickforge-settings-row-main">
|
|
353
|
+
<div class="quickforge-settings-row-title">
|
|
354
|
+
${e}
|
|
355
|
+
${t?_`<quickforge-info-tip .label=${t}></quickforge-info-tip>`:null}
|
|
356
|
+
</div>
|
|
357
|
+
<div class="quickforge-settings-row-description">${w(`fontSizeRangeDescription`)}</div>
|
|
358
|
+
</div>
|
|
359
|
+
<div class="quickforge-settings-row-control quickforge-settings-slider-control">
|
|
360
|
+
<span class="quickforge-settings-value-badge">${n}px</span>
|
|
361
|
+
<input
|
|
362
|
+
class="quickforge-font-size-slider"
|
|
363
|
+
style=${`--quickforge-font-size-slider-progress: ${this.getFontSizeRangeProgress(n)}%`}
|
|
364
|
+
type="range"
|
|
365
|
+
min=${String(C.min)}
|
|
366
|
+
max=${String(C.max)}
|
|
367
|
+
step="1"
|
|
368
|
+
.value=${String(n)}
|
|
369
|
+
@input=${e=>r(e.target.value)}
|
|
370
|
+
@change=${()=>this.saveFontSize()}
|
|
371
|
+
/>
|
|
372
|
+
</div>
|
|
373
|
+
</div>
|
|
374
|
+
`}render(){return this.loading?_`<div class="text-sm text-muted-foreground">${w(`loading`)}</div>`:_`
|
|
375
|
+
<div class="quickforge-settings-stack">
|
|
376
|
+
<section class="quickforge-settings-section" aria-label=${w(`appearance`)}>
|
|
377
|
+
<div class="quickforge-settings-row">
|
|
378
|
+
<div class="quickforge-settings-row-main">
|
|
379
|
+
<div class="quickforge-settings-row-title">
|
|
380
|
+
${w(`theme`)}
|
|
381
|
+
<quickforge-info-tip .label=${w(`themeDescription`)}></quickforge-info-tip>
|
|
382
|
+
</div>
|
|
383
|
+
<div class="quickforge-settings-row-description">${w(`themeDescription`)}</div>
|
|
384
|
+
</div>
|
|
385
|
+
<div class="quickforge-settings-row-control">
|
|
386
|
+
<div class="quickforge-settings-segmented" role="group" aria-label=${w(`theme`)}>
|
|
387
|
+
${ze.map(e=>this.renderThemeOption(e))}
|
|
388
|
+
</div>
|
|
389
|
+
</div>
|
|
390
|
+
</div>
|
|
391
|
+
|
|
392
|
+
${this.renderFontSizeSlider(w(`interfaceFontSize`),null,this.interfaceFontSizePx,e=>this.updateInterfaceFontSize(e))}
|
|
393
|
+
|
|
394
|
+
${this.renderFontSizeSlider(w(`messageFontSize`),w(`messageFontSizeNote`),this.messageFontSizePx,e=>this.updateMessageFontSize(e))}
|
|
395
|
+
</section>
|
|
396
|
+
|
|
397
|
+
${this.error?_`<span class="quickforge-settings-error">${this.error}</span>`:null}
|
|
398
|
+
</div>
|
|
399
|
+
`}},F=`quickforge-appearance-settings-tab`;customElements.get(F)||customElements.define(F,Be);function Ve(){return document.createElement(F)}var He=`auto-compact-settings`,I={enabled:!0,thresholdPercent:80,keepRecentTurns:3,minSourceChars:1600,requireConfirmation:!0};function L(e,t,n,r){let i=Number(e);return Number.isFinite(i)?Math.min(r,Math.max(n,Math.round(i))):t}function Ue(e){if(!e||typeof e!=`object`)return{...I};let t=e;return{enabled:t.enabled!==!1,thresholdPercent:L(t.thresholdPercent,I.thresholdPercent,50,95),keepRecentTurns:L(t.keepRecentTurns,I.keepRecentTurns,1,20),minSourceChars:L(t.minSourceChars,I.minSourceChars,0,2e5),requireConfirmation:t.requireConfirmation!==!1}}async function We(e){return Ue(await e.settings.get(He))}async function Ge(e,t){await e.settings.set(He,Ue(t))}var Ke=`auto-archive-settings`,qe={enabled:!1};function Je(e){return!e||typeof e!=`object`?{...qe}:{enabled:e.enabled===!0}}async function Ye(e){return Je(await e.settings.get(Ke))}async function Xe(e,t){await e.settings.set(Ke,Je(t))}var Ze=[{value:`off`,label:()=>w(`thinkingOff`)},{value:`low`,label:()=>w(`thinkingLow`)},{value:`medium`,label:()=>w(`thinkingMedium`)},{value:`high`,label:()=>w(`thinkingHigh`)},{value:`xhigh`,label:()=>w(`thinkingXHigh`)}],Qe=[{value:`compact`,label:()=>w(`toolDisplayCompact`)},{value:`detailed`,label:()=>w(`toolDisplayDetailed`)}],R=`__custom__`;function $e(e){return(e??``).trim().replace(/\/$/,``)}function z(e){return JSON.stringify([e.provider,e.id,e.api,$e(e.baseUrl)])}function et(e){return`${e.provider} / ${e.id}`}function tt(){return`custom_${globalThis.crypto?.randomUUID?.().slice(0,8)||Date.now().toString(36)}`}function nt(e){let t=e.trim(),n=t.split(/[\\/]/).pop()?.replace(/^"|"$/g,``)||t;return/^bash(\.exe)?$/i.test(n)?`Bash`:/^zsh$/i.test(n)?`Zsh`:/^fish$/i.test(n)?`Fish`:/^cmd(\.exe)?$/i.test(n)?`Command Prompt`:/^powershell(\.exe)?$/i.test(n)?`Windows PowerShell`:/^pwsh(\.exe)?$/i.test(n)?`PowerShell 7+`:n||`Custom Shell`}var rt=_`
|
|
400
|
+
<svg class="size-3.5" viewBox="0 0 16 16" fill="none" aria-hidden="true">
|
|
401
|
+
<path d="M4.5 4.5 11.5 11.5M11.5 4.5 4.5 11.5" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" />
|
|
402
|
+
</svg>
|
|
403
|
+
`,it=class extends v{models=[];selectedModel;thinkingLevel=`off`;toolDisplayMode=`compact`;showContextUsage=!1;autoCompactEnabled=!0;autoCompactRequireConfirmation=!0;autoCompactThresholdPercent=80;autoCompactThresholdPercentInput=`80`;autoCompactKeepRecentTurns=3;autoArchiveEnabled=!1;systemNotificationsEnabled=!1;systemNotificationPermission=`unsupported`;systemNotificationBusy=!1;selectedLanguage=ye();loading=!0;saved=!1;savedMessage=``;error=``;terminalShellConfig={terminalShell:`auto`,defaultProfileId:`auto`,profiles:[]};customShellCommand=``;customShellEditorOpen=!1;networkProxyMode=`direct`;networkProxyUrl=``;savedNetworkProxyConfig={mode:`direct`,proxyUrl:``};networkProxyStatus=null;networkProxySaving=!1;networkProxyLoaded=!1;getTabName(){return w(`defaultOptions`)}async connectedCallback(){super.connectedCallback(),await this.loadSettings()}updated(){this.syncSelectValues()}syncSelectValues(){let e=this.querySelector(`[data-default-model-select]`);e&&this.selectedModel&&(e.value=z(this.selectedModel));let t=this.querySelector(`[data-default-thinking-select]`);t&&(t.value=this.thinkingLevel);let n=this.querySelector(`[data-language-select]`);n&&(n.value=this.selectedLanguage);let r=this.querySelector(`[data-terminal-shell-select]`);r&&(r.value=this.customShellEditorOpen?R:this.selectedTerminalShellProfileId())}async loadSettings(){this.loading=!0,this.error=``,this.requestUpdate();try{let e=y(),[t,n,r,i,a]=await Promise.all([Pe(e),Ne(e),de(e),We(e),Ye(e)]);this.models=t,this.selectedModel=n.model?t.find(e=>z(e)===z(n.model))??n.model:t[0],this.thinkingLevel=n.thinkingLevel??je(this.selectedModel),this.toolDisplayMode=r.toolDisplayMode,this.showContextUsage=r.showContextUsage,this.autoCompactEnabled=i.enabled,this.autoCompactRequireConfirmation=i.requireConfirmation,this.autoCompactThresholdPercent=i.thresholdPercent,this.autoCompactThresholdPercentInput=String(i.thresholdPercent),this.autoCompactKeepRecentTurns=i.keepRecentTurns,this.autoArchiveEnabled=a.enabled,this.systemNotificationsEnabled=Oe(),this.systemNotificationPermission=await Ae(),this.systemNotificationsEnabled&&this.systemNotificationPermission!==`granted`&&(this.systemNotificationsEnabled=!1,k(!1)),await Promise.all([this.loadTerminalShell(),this.loadNetworkProxy()])}catch(e){this.error=e instanceof Error?e.message:w(`requestFailed`)}finally{this.loading=!1,this.requestUpdate()}}updateModel(e){let t=this.models.find(t=>z(t)===e);this.selectedModel=t,this.thinkingLevel=je(t),this.saved=!1,this.requestUpdate(),this.saveDefaultModelOptions()}openDefaultModelSheet(e){_e(this.selectedModel??null,this.models,e=>{e&&this.updateModel(z(e))},{anchor:e.currentTarget})}updateThinkingLevel(e){this.thinkingLevel=Ze.some(t=>t.value===e)?e:`off`,this.saved=!1,this.requestUpdate(),this.saveDefaultModelOptions()}updateLanguage(e){this.selectedLanguage=e===`zh`?`zh`:`en`,this.requestUpdate(),this.applyLanguage()}async applyLanguage(){await ge(y(),this.selectedLanguage)}updateToolDisplayMode(e){this.toolDisplayMode!==e&&(this.toolDisplayMode=e,this.saved=!1,this.requestUpdate(),this.saveToolDisplayOptions())}updateShowContextUsage(e){this.showContextUsage=e,this.saved=!1,this.requestUpdate(),this.saveToolDisplayOptions()}updateAutoCompactEnabled(e){this.autoCompactEnabled=e,this.saved=!1,this.requestUpdate(),this.saveAutoCompactOptions()}updateAutoCompactRequireConfirmation(e){this.autoCompactRequireConfirmation=e,this.saved=!1,this.requestUpdate(),this.saveAutoCompactOptions()}updateAutoArchiveEnabled(e){this.autoArchiveEnabled=e,this.saved=!1,this.requestUpdate(),this.saveAutoArchiveOptions()}async updateSystemNotifications(e){this.systemNotificationBusy=!0,this.saved=!1,this.error=``,this.requestUpdate();try{if(!e){k(!1),this.systemNotificationsEnabled=!1,this.markSaved(w(`systemNotificationsDisabled`));return}let t=await ke();this.systemNotificationPermission=t,this.systemNotificationsEnabled=t===`granted`,t===`granted`?this.markSaved(w(`systemNotificationsEnabled`)):t===`denied`?this.error=w(`systemNotificationsDeniedHelp`):t===`unsupported`&&(this.error=w(`systemNotificationsUnsupported`))}catch(e){this.systemNotificationsEnabled=!1,k(!1),this.error=e instanceof Error?e.message:w(`requestFailed`)}finally{this.systemNotificationBusy=!1,this.requestUpdate()}}async sendTestSystemNotification(){this.systemNotificationBusy=!0,this.error=``,this.requestUpdate();try{await Ce({key:`test:${Date.now()}`,title:w(`systemNotificationTestTitle`),status:`idle`,force:!0})||(this.error=w(`systemNotificationTestFailed`))}catch(e){this.error=e instanceof Error?e.message:w(`systemNotificationTestFailed`)}finally{this.systemNotificationBusy=!1,this.requestUpdate()}}systemNotificationStatusText(){return this.systemNotificationPermission===`unsupported`?w(`systemNotificationsUnsupported`):this.systemNotificationPermission===`denied`?w(`systemNotificationsPermissionDenied`):this.systemNotificationPermission===`granted`?w(`systemNotificationsPermissionGranted`):w(`systemNotificationsPermissionPrompt`)}updateAutoCompactThresholdPercent(e){this.autoCompactThresholdPercentInput=e;let t=Number(e);e!==``&&Number.isFinite(t)&&(this.autoCompactThresholdPercent=t),this.saved=!1,this.requestUpdate()}updateAutoCompactKeepRecentTurns(e){this.autoCompactKeepRecentTurns=Number(e)||3,this.saved=!1,this.requestUpdate()}commitAutoCompactThresholdPercent(){let e=Number(this.autoCompactThresholdPercentInput);if(!Number.isFinite(e)){this.autoCompactThresholdPercentInput=String(this.autoCompactThresholdPercent),this.requestUpdate();return}let t=Math.max(50,Math.min(95,Math.round(e)));this.autoCompactThresholdPercent=t,this.autoCompactThresholdPercentInput=String(t),this.requestUpdate(),this.saveAutoCompactOptions()}commitAutoCompactKeepRecentTurns(){let e=Math.max(1,Math.min(20,Math.round(this.autoCompactKeepRecentTurns||3)));this.autoCompactKeepRecentTurns=e,this.requestUpdate(),this.saveAutoCompactOptions()}markSaved(e=w(`defaultOptionsSaved`)){this.saved=!0,this.savedMessage=e,this.error=``,this.requestUpdate()}customShellProfiles(){return this.terminalShellConfig.profiles.filter(e=>!e.builtin)}selectedTerminalShellProfileId(){let e=this.terminalShellConfig.profiles;return e.some(e=>e.id===this.terminalShellConfig.defaultProfileId)?this.terminalShellConfig.defaultProfileId:e[0]?.id||R}updateTerminalShellSelection(e){if(e===R){this.customShellEditorOpen=!0,this.requestUpdate();return}this.customShellEditorOpen=!1,this.requestUpdate(),this.saveTerminalShellConfig(e)}async loadNetworkProxy(){try{let e=await fetch(`/api/system/network-proxy`,{cache:`no-store`}),t=await e.json().catch(()=>null);if(!e.ok)throw Error(t?.error||w(`requestFailed`));this.networkProxyMode=t?.config?.mode||`direct`,this.networkProxyUrl=t?.config?.proxyUrl||``,this.savedNetworkProxyConfig={mode:this.networkProxyMode,proxyUrl:this.networkProxyUrl},this.networkProxyStatus=t?.status||null,this.networkProxyLoaded=!0}catch(e){this.error=e instanceof Error?e.message:w(`requestFailed`)}}updateNetworkProxyMode(e){this.networkProxyMode===e||this.networkProxySaving||!this.networkProxyLoaded||e===`pac`&&this.networkProxyStatus?.features?.pacUrl!==!0||(this.networkProxyMode=e,this.saved=!1,this.error=``,this.requestUpdate(),!(e===`manual`||e===`pac`)&&this.saveNetworkProxy())}updateNetworkProxyUrl(e){this.networkProxyUrl=e,this.saved=!1,this.requestUpdate()}networkProxyValidationError(){let e=this.networkProxyUrl.trim(),t=this.networkProxyMode===`pac`;if(!e)return w(t?`networkProxyPacUrlRequired`:`networkProxyAddressRequired`);try{let n=new URL(e);return[`http:`,`https:`].includes(n.protocol)?n.hostname?!t&&!n.port?w(`networkProxyAddressPortError`):n.username||n.password?w(t?`networkProxyPacUrlCredentialsError`:`networkProxyAddressCredentialsError`):t&&n.hash?w(`networkProxyPacUrlFragmentError`):!t&&(n.pathname&&n.pathname!==`/`||n.search||n.hash)?w(`networkProxyAddressPathError`):``:w(t?`networkProxyPacUrlHostError`:`networkProxyAddressPortError`):w(t?`networkProxyPacUrlProtocolError`:`networkProxyAddressProtocolError`)}catch{return w(t?`networkProxyPacUrlInvalid`:`networkProxyAddressInvalid`)}}async saveNetworkProxy(){if(!(this.networkProxySaving||!this.networkProxyLoaded)){if(this.networkProxyMode===`pac`&&this.networkProxyStatus?.features?.pacUrl!==!0){this.saved=!1,this.error=w(`networkProxyPacUnsupported`),this.requestUpdate();return}if(this.networkProxyMode===`manual`||this.networkProxyMode===`pac`){let e=this.networkProxyValidationError();if(e){this.saved=!1,this.error=e,this.requestUpdate();return}}this.networkProxySaving=!0,this.saved=!1,this.error=``,this.requestUpdate();try{let e=await fetch(`/api/system/network-proxy`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({mode:this.networkProxyMode,proxyUrl:this.networkProxyUrl})}),t=await e.json().catch(()=>null);if(!e.ok)throw Error(t?.error||w(`requestFailed`));this.networkProxyMode=t?.config?.mode||this.networkProxyMode,this.networkProxyUrl=t?.config?.proxyUrl||``,this.savedNetworkProxyConfig={mode:this.networkProxyMode,proxyUrl:this.networkProxyUrl},this.networkProxyStatus=t?.status||null,this.markSaved(w(`networkProxySaved`))}catch(e){this.networkProxyMode=this.savedNetworkProxyConfig.mode,this.networkProxyUrl=this.savedNetworkProxyConfig.proxyUrl,this.saved=!1,this.error=e instanceof Error?e.message:w(`requestFailed`)}finally{this.networkProxySaving=!1,this.requestUpdate()}}}async refreshNetworkProxy(){if(!(this.networkProxySaving||!this.networkProxyLoaded)){this.networkProxySaving=!0,this.saved=!1,this.error=``,this.requestUpdate();try{let e=await fetch(`/api/system/network-proxy/refresh`,{method:`POST`}),t=await e.json().catch(()=>null);if(!e.ok)throw Error(t?.error||w(`requestFailed`));this.networkProxyStatus=t?.status||null,this.markSaved(w(`networkProxyRefreshed`))}catch(e){this.error=e instanceof Error?e.message:w(`requestFailed`)}finally{this.networkProxySaving=!1,this.requestUpdate()}}}renderNetworkProxyModeOption(e,t){let n=this.networkProxyMode===e,r=e===`pac`&&this.networkProxyStatus?.features?.pacUrl!==!0;return _`
|
|
404
|
+
<button
|
|
405
|
+
type="button"
|
|
406
|
+
class="quickforge-settings-segmented-option ${n?`quickforge-settings-segmented-option-active`:``}"
|
|
407
|
+
aria-pressed=${n?`true`:`false`}
|
|
408
|
+
title=${r?w(`networkProxyPacUnsupported`):``}
|
|
409
|
+
?disabled=${this.networkProxySaving||!this.networkProxyLoaded||r}
|
|
410
|
+
@click=${()=>this.updateNetworkProxyMode(e)}
|
|
411
|
+
>
|
|
412
|
+
${t}
|
|
413
|
+
</button>
|
|
414
|
+
`}networkProxySettings(){let e=this.networkProxyMode===`manual`||this.networkProxyMode===`pac`,t=this.networkProxyMode===`pac`&&this.networkProxyStatus?.features?.pacUrl!==!0,n=e?this.networkProxyValidationError():``,r=e&&(this.networkProxyUrl!==this.savedNetworkProxyConfig.proxyUrl||this.savedNetworkProxyConfig.mode!==this.networkProxyMode),i=this.networkProxyLoaded?t?w(`networkProxyPacUnsupported`):this.networkProxyStatus?.supported===!1?this.networkProxyStatus.error||w(`networkProxyUnsupported`):w(`networkProxyStatus`,{source:this.networkProxyStatus?.source||w(`unknown`),runtime:this.networkProxyStatus?.runtimeKind||w(`unknown`)}):w(`networkProxyLoadFailed`);return _`
|
|
415
|
+
<section class="quickforge-settings-section" aria-label=${w(`networkConnection`)}>
|
|
416
|
+
<div class="quickforge-settings-row">
|
|
417
|
+
<div class="quickforge-settings-row-main">
|
|
418
|
+
<div class="quickforge-settings-row-title">
|
|
419
|
+
${w(`networkProxyMode`)}
|
|
420
|
+
<quickforge-info-tip .label=${w(`networkProxyDescription`)}></quickforge-info-tip>
|
|
421
|
+
</div>
|
|
422
|
+
<div class="quickforge-settings-row-description">${i}</div>
|
|
423
|
+
</div>
|
|
424
|
+
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide">
|
|
425
|
+
<div class="quickforge-settings-segmented quickforge-settings-segmented-wrap" role="group" aria-label=${w(`networkProxyMode`)}>
|
|
426
|
+
${this.renderNetworkProxyModeOption(`direct`,w(`networkProxyDirect`))}
|
|
427
|
+
${this.renderNetworkProxyModeOption(`system`,w(`networkProxySystem`))}
|
|
428
|
+
${this.renderNetworkProxyModeOption(`manual`,w(`networkProxyManual`))}
|
|
429
|
+
${this.renderNetworkProxyModeOption(`pac`,w(`networkProxyPac`))}
|
|
430
|
+
</div>
|
|
431
|
+
</div>
|
|
432
|
+
</div>
|
|
433
|
+
|
|
434
|
+
${e?_`
|
|
435
|
+
<div class="quickforge-settings-row">
|
|
436
|
+
<div class="quickforge-settings-row-main">
|
|
437
|
+
<div class="quickforge-settings-row-title">
|
|
438
|
+
${w(this.networkProxyMode===`pac`?`networkProxyPacUrl`:`networkProxyAddress`)}
|
|
439
|
+
</div>
|
|
440
|
+
<div class="quickforge-settings-row-description">
|
|
441
|
+
${w(this.networkProxyMode===`pac`?`networkProxyPacUrlDescription`:`networkProxyAddressDescription`)}
|
|
442
|
+
</div>
|
|
443
|
+
</div>
|
|
444
|
+
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide quickforge-network-proxy-control">
|
|
445
|
+
<input
|
|
446
|
+
id="quickforge-network-proxy-url"
|
|
447
|
+
class="quickforge-settings-input quickforge-settings-mono"
|
|
448
|
+
type="url"
|
|
449
|
+
aria-label=${w(this.networkProxyMode===`pac`?`networkProxyPacUrl`:`networkProxyAddress`)}
|
|
450
|
+
aria-invalid=${r&&n?`true`:`false`}
|
|
451
|
+
.value=${this.networkProxyUrl}
|
|
452
|
+
placeholder=${this.networkProxyMode===`pac`?`https://example.com/proxy.pac`:`http://127.0.0.1:7890`}
|
|
453
|
+
?disabled=${this.networkProxySaving||!this.networkProxyLoaded||t}
|
|
454
|
+
@input=${e=>this.updateNetworkProxyUrl(e.target.value)}
|
|
455
|
+
@keydown=${e=>{e.key===`Enter`&&this.networkProxyUrl.trim()&&(e.preventDefault(),this.saveNetworkProxy())}}
|
|
456
|
+
/>
|
|
457
|
+
<button
|
|
458
|
+
class="quickforge-settings-button quickforge-settings-button-primary"
|
|
459
|
+
type="button"
|
|
460
|
+
?disabled=${this.networkProxySaving||!this.networkProxyLoaded||t||!!n||!r}
|
|
461
|
+
@click=${()=>this.saveNetworkProxy()}
|
|
462
|
+
>
|
|
463
|
+
${this.networkProxySaving?w(`saving`):w(`networkProxySave`)}
|
|
464
|
+
</button>
|
|
465
|
+
</div>
|
|
466
|
+
</div>
|
|
467
|
+
`:null}
|
|
468
|
+
|
|
469
|
+
${this.networkProxyMode===`system`?_`
|
|
470
|
+
<div class="quickforge-settings-row">
|
|
471
|
+
<div class="quickforge-settings-row-main">
|
|
472
|
+
<div class="quickforge-settings-row-title">${w(`networkProxyRefresh`)}</div>
|
|
473
|
+
<div class="quickforge-settings-row-description">${w(`networkProxyRefreshDescription`)}</div>
|
|
474
|
+
</div>
|
|
475
|
+
<div class="quickforge-settings-row-control">
|
|
476
|
+
<button
|
|
477
|
+
class="quickforge-settings-button"
|
|
478
|
+
type="button"
|
|
479
|
+
?disabled=${this.networkProxySaving||!this.networkProxyLoaded}
|
|
480
|
+
@click=${()=>this.refreshNetworkProxy()}
|
|
481
|
+
>
|
|
482
|
+
${this.networkProxySaving?w(`saving`):w(`networkProxyRefresh`)}
|
|
483
|
+
</button>
|
|
484
|
+
</div>
|
|
485
|
+
</div>
|
|
486
|
+
`:null}
|
|
487
|
+
</section>
|
|
488
|
+
`}async loadTerminalShell(){try{let e=await fetch(`/api/system/terminal-shell`,{cache:`no-store`}),t=await e.json().catch(()=>null);if(!e.ok)throw Error(t?.error||w(`requestFailed`));this.terminalShellConfig={terminalShell:t?.terminalShell||`auto`,defaultProfileId:t?.defaultProfileId||`auto`,profiles:Array.isArray(t?.profiles)?t.profiles:[]}}catch(e){this.error=e instanceof Error?e.message:w(`requestFailed`)}}async saveTerminalShellConfig(e,t=this.customShellProfiles(),n=w(`terminalShellSaved`)){try{let r=await fetch(`/api/system/terminal-shell`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({defaultProfileId:e,profiles:t})}),i=await r.json().catch(()=>null);if(!r.ok)throw Error(i?.error||w(`requestFailed`));this.terminalShellConfig=i,this.markSaved(n)}catch(e){this.error=e instanceof Error?e.message:w(`requestFailed`),this.requestUpdate()}}async addCustomTerminalShell(){let e=this.customShellCommand.trim();if(!e){this.error=w(`terminalShellProfileRequired`),this.requestUpdate();return}let t={id:tt(),name:nt(e),command:e,builtin:!1},n=[...this.customShellProfiles(),t];this.customShellCommand=``,this.customShellEditorOpen=!1,await this.saveTerminalShellConfig(t.id,n,w(`terminalShellProfilesSaved`))}async deleteCustomTerminalShell(e){let t=this.terminalShellConfig.profiles.find(t=>t.id===e);if(!t||t.builtin||!await T({description:w(`terminalShellDeleteConfirm`,{name:t.name}),confirmLabel:w(`confirmDelete`),cancelLabel:w(`cancel`),variant:`destructive`}))return;let n=this.customShellProfiles().filter(t=>t.id!==e),r=this.terminalShellConfig.defaultProfileId===e?`auto`:this.terminalShellConfig.defaultProfileId;await this.saveTerminalShellConfig(r,n,w(`terminalShellProfilesSaved`))}async saveDefaultModelOptions(){try{let e=this.selectedModel?.reasoning?this.thinkingLevel:`off`;await Me(y(),{model:this.selectedModel,thinkingLevel:e}),this.markSaved()}catch(e){this.error=e instanceof Error?e.message:w(`requestFailed`),this.requestUpdate()}}async saveToolDisplayOptions(){try{await pe(y(),{toolDisplayMode:this.toolDisplayMode,showContextUsage:this.showContextUsage}),this.markSaved()}catch(e){this.error=e instanceof Error?e.message:w(`requestFailed`),this.requestUpdate()}}async saveAutoCompactOptions(){try{await Ge(y(),{enabled:this.autoCompactEnabled,thresholdPercent:this.autoCompactThresholdPercent,keepRecentTurns:this.autoCompactKeepRecentTurns,minSourceChars:1600,requireConfirmation:this.autoCompactRequireConfirmation}),this.markSaved()}catch(e){this.error=e instanceof Error?e.message:w(`requestFailed`),this.requestUpdate()}}async saveAutoArchiveOptions(){try{if(await Xe(y(),{enabled:this.autoArchiveEnabled}),this.markSaved(w(`autoArchiveSaved`)),typeof BroadcastChannel<`u`)try{let e=new BroadcastChannel(`quickforge-sync`);e.postMessage({type:`settings-changed`,sourceTabId:`default-options-settings-tab`,timestamp:Date.now()}),e.close()}catch{}}catch(e){this.error=e instanceof Error?e.message:w(`requestFailed`),this.requestUpdate()}}modelOptions(){if(!this.selectedModel)return this.models;let e=z(this.selectedModel);return this.models.some(t=>z(t)===e)?this.models:[this.selectedModel,...this.models]}terminalShellSettings(){let e=this.terminalShellConfig.profiles,t=this.selectedTerminalShellProfileId(),n=e.find(e=>e.id===t),r=this.customShellEditorOpen||e.length===0;return _`
|
|
489
|
+
<section class="quickforge-settings-section" aria-label=${w(`terminalShell`)}>
|
|
490
|
+
<div class="quickforge-settings-row">
|
|
491
|
+
<div class="quickforge-settings-row-main">
|
|
492
|
+
<div class="quickforge-settings-row-title">
|
|
493
|
+
${w(`terminalShellDefault`)}
|
|
494
|
+
<quickforge-info-tip .label=${w(`terminalShellDescription`)}></quickforge-info-tip>
|
|
495
|
+
</div>
|
|
496
|
+
<div class="quickforge-settings-row-description quickforge-settings-mono">
|
|
497
|
+
${n?.command||w(`terminalShellNoDetected`)}
|
|
498
|
+
</div>
|
|
499
|
+
</div>
|
|
500
|
+
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide">
|
|
501
|
+
<select
|
|
502
|
+
data-terminal-shell-select
|
|
503
|
+
class="quickforge-settings-select"
|
|
504
|
+
.value=${r?R:t}
|
|
505
|
+
aria-label=${w(`terminalShellDefault`)}
|
|
506
|
+
@change=${e=>this.updateTerminalShellSelection(e.target.value)}
|
|
507
|
+
>
|
|
508
|
+
${e.map(e=>_`<option value=${e.id}>${e.name}</option>`)}
|
|
509
|
+
<option value=${R}>${w(`terminalShellCustomOption`)}</option>
|
|
510
|
+
</select>
|
|
511
|
+
${n&&!n.builtin&&!r?_`
|
|
512
|
+
<button
|
|
513
|
+
class="quickforge-settings-icon-action quickforge-settings-icon-action-danger"
|
|
514
|
+
type="button"
|
|
515
|
+
title=${w(`delete`)}
|
|
516
|
+
aria-label=${w(`delete`)}
|
|
517
|
+
@click=${()=>this.deleteCustomTerminalShell(n.id)}
|
|
518
|
+
>
|
|
519
|
+
${rt}
|
|
520
|
+
</button>
|
|
521
|
+
`:null}
|
|
522
|
+
</div>
|
|
523
|
+
</div>
|
|
524
|
+
|
|
525
|
+
${r?_`
|
|
526
|
+
<div class="quickforge-settings-row">
|
|
527
|
+
<div class="quickforge-settings-row-main">
|
|
528
|
+
<div class="quickforge-settings-row-title">${w(`terminalShellCommand`)}</div>
|
|
529
|
+
<div class="quickforge-settings-row-description">${w(`terminalShellCustomDescription`)}</div>
|
|
530
|
+
</div>
|
|
531
|
+
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide quickforge-terminal-shell-command-control">
|
|
532
|
+
<input
|
|
533
|
+
class="quickforge-settings-input quickforge-settings-mono"
|
|
534
|
+
type="text"
|
|
535
|
+
.value=${this.customShellCommand}
|
|
536
|
+
placeholder=${w(`terminalShellCommandPlaceholder`)}
|
|
537
|
+
@input=${e=>{this.customShellCommand=e.target.value}}
|
|
538
|
+
/>
|
|
539
|
+
<button
|
|
540
|
+
class="quickforge-settings-button quickforge-settings-button-primary"
|
|
541
|
+
type="button"
|
|
542
|
+
title=${w(`terminalShellAdd`)}
|
|
543
|
+
aria-label=${w(`terminalShellAdd`)}
|
|
544
|
+
@click=${()=>this.addCustomTerminalShell()}
|
|
545
|
+
>
|
|
546
|
+
${w(`terminalShellAdd`)}
|
|
547
|
+
</button>
|
|
548
|
+
</div>
|
|
549
|
+
</div>
|
|
550
|
+
`:null}
|
|
551
|
+
</section>
|
|
552
|
+
`}renderToolDisplayModeOption(e){let t=this.toolDisplayMode===e.value;return _`
|
|
553
|
+
<button
|
|
554
|
+
type="button"
|
|
555
|
+
class="quickforge-settings-segmented-option ${t?`quickforge-settings-segmented-option-active`:``}"
|
|
556
|
+
aria-pressed=${t?`true`:`false`}
|
|
557
|
+
@click=${()=>this.updateToolDisplayMode(e.value)}
|
|
558
|
+
>
|
|
559
|
+
${e.label()}
|
|
560
|
+
</button>
|
|
561
|
+
`}renderSwitch(e,t,n=!1){return _`
|
|
562
|
+
<label class="quickforge-settings-switch" aria-disabled=${n?`true`:`false`}>
|
|
563
|
+
<input
|
|
564
|
+
type="checkbox"
|
|
565
|
+
.checked=${e}
|
|
566
|
+
?disabled=${n}
|
|
567
|
+
@change=${e=>t(e.target.checked)}
|
|
568
|
+
/>
|
|
569
|
+
<span aria-hidden="true"></span>
|
|
570
|
+
</label>
|
|
571
|
+
`}render(){return this.loading?_`<div class="text-sm text-muted-foreground">${w(`loading`)}</div>`:_`
|
|
572
|
+
<div class="quickforge-settings-stack">
|
|
573
|
+
<section class="quickforge-settings-section" aria-label=${w(`defaultOptions`)}>
|
|
574
|
+
<div class="quickforge-settings-row">
|
|
575
|
+
<div class="quickforge-settings-row-main">
|
|
576
|
+
<div class="quickforge-settings-row-title">
|
|
577
|
+
${w(`language`)}
|
|
578
|
+
<quickforge-info-tip .label=${w(`languageDescription`)}></quickforge-info-tip>
|
|
579
|
+
</div>
|
|
580
|
+
<div class="quickforge-settings-row-description">${w(`displayLanguage`)}</div>
|
|
581
|
+
</div>
|
|
582
|
+
<div class="quickforge-settings-row-control">
|
|
583
|
+
<select
|
|
584
|
+
data-language-select
|
|
585
|
+
class="quickforge-settings-select"
|
|
586
|
+
.value=${this.selectedLanguage}
|
|
587
|
+
@change=${e=>this.updateLanguage(e.target.value)}
|
|
588
|
+
>
|
|
589
|
+
<option value="zh">${w(`simplifiedChinese`)}</option>
|
|
590
|
+
<option value="en">${w(`english`)}</option>
|
|
591
|
+
</select>
|
|
592
|
+
</div>
|
|
593
|
+
</div>
|
|
594
|
+
|
|
595
|
+
<div class="quickforge-settings-row">
|
|
596
|
+
<div class="quickforge-settings-row-main">
|
|
597
|
+
<div class="quickforge-settings-row-title">${w(`defaultModel`)}</div>
|
|
598
|
+
<div class="quickforge-settings-row-description">${w(`defaultModelDescription`)}</div>
|
|
599
|
+
</div>
|
|
600
|
+
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide">
|
|
601
|
+
<select
|
|
602
|
+
data-default-model-select
|
|
603
|
+
class="quickforge-settings-select quickforge-model-select-desktop"
|
|
604
|
+
.value=${this.selectedModel?z(this.selectedModel):``}
|
|
605
|
+
@change=${e=>this.updateModel(e.target.value)}
|
|
606
|
+
>
|
|
607
|
+
${this.modelOptions().length===0?_`<option value="">${w(`noModelAvailable`)}</option>`:this.modelOptions().map(e=>_`
|
|
608
|
+
<option .value=${z(e)}>${et(e)}</option>
|
|
609
|
+
`)}
|
|
610
|
+
</select>
|
|
611
|
+
<button
|
|
612
|
+
type="button"
|
|
613
|
+
class="quickforge-settings-select quickforge-settings-select-button quickforge-model-select-mobile"
|
|
614
|
+
?disabled=${this.models.length===0}
|
|
615
|
+
@click=${e=>this.openDefaultModelSheet(e)}
|
|
616
|
+
>
|
|
617
|
+
<span>${this.selectedModel?et(this.selectedModel):w(`noModelAvailable`)}</span>
|
|
618
|
+
<span class="quickforge-settings-select-chevron" aria-hidden="true">▾</span>
|
|
619
|
+
</button>
|
|
620
|
+
</div>
|
|
621
|
+
</div>
|
|
622
|
+
|
|
623
|
+
<div class="quickforge-settings-row">
|
|
624
|
+
<div class="quickforge-settings-row-main">
|
|
625
|
+
<div class="quickforge-settings-row-title">${w(`defaultThinkingLevel`)}</div>
|
|
626
|
+
<div class="quickforge-settings-row-description">
|
|
627
|
+
${this.selectedModel?.reasoning?w(`defaultThinkingLevelDescription`):w(`thinkingRequiresReasoningModel`)}
|
|
628
|
+
</div>
|
|
629
|
+
</div>
|
|
630
|
+
<div class="quickforge-settings-row-control">
|
|
631
|
+
<select
|
|
632
|
+
data-default-thinking-select
|
|
633
|
+
class="quickforge-settings-select"
|
|
634
|
+
.value=${this.thinkingLevel}
|
|
635
|
+
?disabled=${!this.selectedModel?.reasoning}
|
|
636
|
+
@change=${e=>this.updateThinkingLevel(e.target.value)}
|
|
637
|
+
>
|
|
638
|
+
${Ze.map(e=>_`
|
|
639
|
+
<option .value=${e.value}>${e.label()}</option>
|
|
640
|
+
`)}
|
|
641
|
+
</select>
|
|
642
|
+
</div>
|
|
643
|
+
</div>
|
|
644
|
+
|
|
645
|
+
<div class="quickforge-settings-row">
|
|
646
|
+
<div class="quickforge-settings-row-main">
|
|
647
|
+
<div class="quickforge-settings-row-title">
|
|
648
|
+
${w(`toolDisplay`)}
|
|
649
|
+
<quickforge-info-tip .label=${w(`toolDisplayModeDescription`)}></quickforge-info-tip>
|
|
650
|
+
</div>
|
|
651
|
+
<div class="quickforge-settings-row-description">${w(`toolDisplayModeDescription`)}</div>
|
|
652
|
+
</div>
|
|
653
|
+
<div class="quickforge-settings-row-control">
|
|
654
|
+
<div class="quickforge-settings-segmented" role="group" aria-label=${w(`toolDisplay`)}>
|
|
655
|
+
${Qe.map(e=>this.renderToolDisplayModeOption(e))}
|
|
656
|
+
</div>
|
|
657
|
+
</div>
|
|
658
|
+
</div>
|
|
659
|
+
|
|
660
|
+
<div class="quickforge-settings-row">
|
|
661
|
+
<div class="quickforge-settings-row-main">
|
|
662
|
+
<div class="quickforge-settings-row-title">
|
|
663
|
+
${w(`systemNotifications`)}
|
|
664
|
+
<quickforge-info-tip .label=${w(`systemNotificationsDescription`)}></quickforge-info-tip>
|
|
665
|
+
</div>
|
|
666
|
+
<div class="quickforge-settings-row-description">${this.systemNotificationStatusText()}</div>
|
|
667
|
+
</div>
|
|
668
|
+
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide">
|
|
669
|
+
${this.systemNotificationsEnabled?_`
|
|
670
|
+
<button
|
|
671
|
+
class="quickforge-settings-button quickforge-settings-button-secondary"
|
|
672
|
+
type="button"
|
|
673
|
+
?disabled=${this.systemNotificationBusy}
|
|
674
|
+
@click=${()=>this.sendTestSystemNotification()}
|
|
675
|
+
>${w(`systemNotificationsTest`)}</button>
|
|
676
|
+
`:null}
|
|
677
|
+
${this.renderSwitch(this.systemNotificationsEnabled,e=>{this.updateSystemNotifications(e)},this.systemNotificationBusy||this.systemNotificationPermission===`unsupported`)}
|
|
678
|
+
</div>
|
|
679
|
+
</div>
|
|
680
|
+
|
|
681
|
+
<div class="quickforge-settings-row">
|
|
682
|
+
<div class="quickforge-settings-row-main">
|
|
683
|
+
<div class="quickforge-settings-row-title">
|
|
684
|
+
${w(`showContextUsage`)}
|
|
685
|
+
<quickforge-info-tip .label=${w(`showContextUsageDescription`)}></quickforge-info-tip>
|
|
686
|
+
</div>
|
|
687
|
+
<div class="quickforge-settings-row-description">${w(`showContextUsageDescription`)}</div>
|
|
688
|
+
</div>
|
|
689
|
+
<div class="quickforge-settings-row-control">
|
|
690
|
+
${this.renderSwitch(this.showContextUsage,e=>this.updateShowContextUsage(e))}
|
|
691
|
+
</div>
|
|
692
|
+
</div>
|
|
693
|
+
|
|
694
|
+
<div class="quickforge-settings-row">
|
|
695
|
+
<div class="quickforge-settings-row-main">
|
|
696
|
+
<div class="quickforge-settings-row-title">
|
|
697
|
+
${w(`autoArchiveEnabled`)}
|
|
698
|
+
<quickforge-info-tip .label=${w(`autoArchiveDescription`)}></quickforge-info-tip>
|
|
699
|
+
</div>
|
|
700
|
+
<div class="quickforge-settings-row-description">${w(`autoArchiveTriggerNote`)}</div>
|
|
701
|
+
</div>
|
|
702
|
+
<div class="quickforge-settings-row-control">
|
|
703
|
+
${this.renderSwitch(this.autoArchiveEnabled,e=>this.updateAutoArchiveEnabled(e))}
|
|
704
|
+
</div>
|
|
705
|
+
</div>
|
|
706
|
+
|
|
707
|
+
<div class="quickforge-settings-row">
|
|
708
|
+
<div class="quickforge-settings-row-main">
|
|
709
|
+
<div class="quickforge-settings-row-title">
|
|
710
|
+
${w(`autoCompactEnabled`)}
|
|
711
|
+
<quickforge-info-tip .label=${w(`autoCompactDescription`)}></quickforge-info-tip>
|
|
712
|
+
</div>
|
|
713
|
+
<div class="quickforge-settings-row-description">${w(`autoCompactTriggerNote`)}</div>
|
|
714
|
+
</div>
|
|
715
|
+
<div class="quickforge-settings-row-control">
|
|
716
|
+
${this.renderSwitch(this.autoCompactEnabled,e=>this.updateAutoCompactEnabled(e))}
|
|
717
|
+
</div>
|
|
718
|
+
</div>
|
|
719
|
+
|
|
720
|
+
<div class="quickforge-settings-row">
|
|
721
|
+
<div class="quickforge-settings-row-main">
|
|
722
|
+
<div class="quickforge-settings-row-title">${w(`autoCompactRequireConfirmation`)}</div>
|
|
723
|
+
<div class="quickforge-settings-row-description">${w(`autoCompactRequireConfirmationDescription`)}</div>
|
|
724
|
+
</div>
|
|
725
|
+
<div class="quickforge-settings-row-control">
|
|
726
|
+
${this.renderSwitch(this.autoCompactRequireConfirmation,e=>this.updateAutoCompactRequireConfirmation(e),!this.autoCompactEnabled)}
|
|
727
|
+
</div>
|
|
728
|
+
</div>
|
|
729
|
+
|
|
730
|
+
<div class="quickforge-settings-row">
|
|
731
|
+
<div class="quickforge-settings-row-main">
|
|
732
|
+
<div class="quickforge-settings-row-title">${w(`autoCompactThresholdPercent`)}</div>
|
|
733
|
+
<div class="quickforge-settings-row-description">${w(`autoCompactThresholdDescription`)}</div>
|
|
734
|
+
</div>
|
|
735
|
+
<div class="quickforge-settings-row-control">
|
|
736
|
+
<input
|
|
737
|
+
class="quickforge-settings-input quickforge-settings-number-input"
|
|
738
|
+
type="number"
|
|
739
|
+
min="50"
|
|
740
|
+
max="95"
|
|
741
|
+
step="1"
|
|
742
|
+
.value=${this.autoCompactThresholdPercentInput}
|
|
743
|
+
?disabled=${!this.autoCompactEnabled}
|
|
744
|
+
@input=${e=>this.updateAutoCompactThresholdPercent(e.target.value)}
|
|
745
|
+
@change=${()=>this.commitAutoCompactThresholdPercent()}
|
|
746
|
+
@blur=${()=>this.commitAutoCompactThresholdPercent()}
|
|
747
|
+
/>
|
|
748
|
+
</div>
|
|
749
|
+
</div>
|
|
750
|
+
|
|
751
|
+
<div class="quickforge-settings-row">
|
|
752
|
+
<div class="quickforge-settings-row-main">
|
|
753
|
+
<div class="quickforge-settings-row-title">
|
|
754
|
+
${w(`autoCompactKeepRecentTurns`)}
|
|
755
|
+
<quickforge-info-tip .label=${w(`autoCompactHistoryPreserved`)}></quickforge-info-tip>
|
|
756
|
+
</div>
|
|
757
|
+
<div class="quickforge-settings-row-description">${w(`autoCompactKeepRecentTurnsDescription`)}</div>
|
|
758
|
+
</div>
|
|
759
|
+
<div class="quickforge-settings-row-control">
|
|
760
|
+
<input
|
|
761
|
+
class="quickforge-settings-input quickforge-settings-number-input"
|
|
762
|
+
type="number"
|
|
763
|
+
min="1"
|
|
764
|
+
max="20"
|
|
765
|
+
step="1"
|
|
766
|
+
.value=${String(this.autoCompactKeepRecentTurns)}
|
|
767
|
+
?disabled=${!this.autoCompactEnabled}
|
|
768
|
+
@input=${e=>this.updateAutoCompactKeepRecentTurns(e.target.value)}
|
|
769
|
+
@change=${()=>this.commitAutoCompactKeepRecentTurns()}
|
|
770
|
+
@blur=${()=>this.commitAutoCompactKeepRecentTurns()}
|
|
771
|
+
/>
|
|
772
|
+
</div>
|
|
773
|
+
</div>
|
|
774
|
+
</section>
|
|
775
|
+
|
|
776
|
+
${this.networkProxySettings()}
|
|
777
|
+
|
|
778
|
+
${this.terminalShellSettings()}
|
|
779
|
+
|
|
780
|
+
${this.saved?_`<div class="quickforge-settings-message" role="status">${this.savedMessage||w(`defaultOptionsSaved`)}</div>`:null}
|
|
781
|
+
${this.error?_`<div class="quickforge-settings-alert" role="alert">${this.error}</div>`:null}
|
|
782
|
+
</div>
|
|
783
|
+
`}},B=`quickforge-default-options-settings-tab`;customElements.get(B)||customElements.define(B,it);function at(){return document.createElement(B)}var ot=`memory-settings`,st={enabled:!0};function ct(e){return!e||typeof e!=`object`?{...st}:{enabled:e.enabled!==!1}}async function lt(e){return ct(await e.settings.get(ot))}async function ut(e,t){await e.settings.set(ot,ct(t))}var dt=class extends v{enabled=!0;loading=!0;saving=!1;loadingDocument=!1;markdown=``;savedMarkdown=``;memoryPath=`~/.quickforge/MEMORY.md`;message=``;error=``;getTabName(){return w(`memory`)}async connectedCallback(){super.connectedCallback(),await this.loadSettings()}async loadSettings(){this.loading=!0,this.error=``,this.requestUpdate();try{let[e]=await Promise.all([lt(y()),this.loadDocument()]);this.enabled=e.enabled}catch(e){this.error=e instanceof Error?e.message:w(`requestFailed`)}finally{this.loading=!1,this.requestUpdate()}}async loadDocument(e=!1){this.loadingDocument=!0,this.error=``,e&&(this.message=``),this.requestUpdate();try{let t=await fetch(`/api/memory`,{cache:`no-store`}),n=await t.json().catch(()=>null);if(!t.ok||!n)throw Error(n?.error||w(`requestFailed`));this.markdown=n.markdown,this.savedMarkdown=n.markdown,this.memoryPath=n.path||this.memoryPath,e&&(this.message=w(`memoryReloaded`))}finally{this.loadingDocument=!1,this.requestUpdate()}}async updateEnabled(e){let t=this.enabled;this.enabled=e,this.saving=!0,this.message=``,this.error=``,this.requestUpdate();try{await ut(y(),{enabled:e}),this.message=w(e?`memoryEnabledSaved`:`memoryDisabledSaved`)}catch(e){this.enabled=t,this.error=e instanceof Error?e.message:w(`requestFailed`)}finally{this.saving=!1,this.requestUpdate()}}async reloadDocument(){try{await this.loadDocument(!0)}catch(e){this.error=e instanceof Error?e.message:w(`requestFailed`),this.requestUpdate()}}async saveDocument(){if(!(!this.enabled||this.saving)){this.saving=!0,this.message=``,this.error=``,this.requestUpdate();try{let e=await fetch(`/api/memory`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({markdown:this.markdown})}),t=await e.json().catch(()=>null);if(!e.ok||!t)throw Error(t?.error||w(`requestFailed`));this.markdown=t.markdown,this.savedMarkdown=t.markdown,this.memoryPath=t.path||this.memoryPath,this.message=w(`memoryContentSaved`)}catch(e){this.error=e instanceof Error?e.message:w(`requestFailed`)}finally{this.saving=!1,this.requestUpdate()}}}renderSwitch(){return _`
|
|
784
|
+
<label class="quickforge-settings-switch" aria-disabled=${this.saving?`true`:`false`}>
|
|
785
|
+
<input
|
|
786
|
+
type="checkbox"
|
|
787
|
+
.checked=${this.enabled}
|
|
788
|
+
?disabled=${this.saving}
|
|
789
|
+
@change=${e=>void this.updateEnabled(e.target.checked)}
|
|
790
|
+
/>
|
|
791
|
+
<span aria-hidden="true"></span>
|
|
792
|
+
</label>
|
|
793
|
+
`}render(){if(this.loading)return _`<div class="text-sm text-muted-foreground">${w(`loading`)}</div>`;let e=this.markdown!==this.savedMarkdown,t=this.saving||this.loadingDocument;return _`
|
|
794
|
+
<div class="quickforge-settings-stack">
|
|
795
|
+
<section class="quickforge-settings-section" aria-label=${w(`memory`)}>
|
|
796
|
+
<div class="quickforge-settings-row">
|
|
797
|
+
<div class="quickforge-settings-row-main">
|
|
798
|
+
<div class="quickforge-settings-row-title">
|
|
799
|
+
${w(`globalMemory`)}
|
|
800
|
+
<quickforge-info-tip .label=${w(`globalMemoryInfo`)}></quickforge-info-tip>
|
|
801
|
+
</div>
|
|
802
|
+
<div class="quickforge-settings-row-description">${w(`globalMemoryDescription`)}</div>
|
|
803
|
+
</div>
|
|
804
|
+
<div class="quickforge-settings-row-control">${this.renderSwitch()}</div>
|
|
805
|
+
</div>
|
|
806
|
+
|
|
807
|
+
<div class="quickforge-settings-row">
|
|
808
|
+
<div class="quickforge-settings-row-main">
|
|
809
|
+
<div class="quickforge-settings-row-title">${w(`memoryFile`)}</div>
|
|
810
|
+
<div class="quickforge-settings-row-description">${w(`memoryFileDescription`)}</div>
|
|
811
|
+
</div>
|
|
812
|
+
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide">
|
|
813
|
+
<code class="text-xs text-muted-foreground">${this.memoryPath}</code>
|
|
814
|
+
</div>
|
|
815
|
+
</div>
|
|
816
|
+
|
|
817
|
+
<div class="quickforge-settings-row quickforge-settings-row-align-start quickforge-memory-content-row">
|
|
818
|
+
<div class="quickforge-settings-row-main">
|
|
819
|
+
<div class="quickforge-settings-row-title">${w(`memoryContent`)}</div>
|
|
820
|
+
<div class="quickforge-settings-row-description">${this.enabled?w(`memoryContentDescription`):w(`memoryContentDisabledDescription`)}</div>
|
|
821
|
+
</div>
|
|
822
|
+
<div class="quickforge-memory-editor-control">
|
|
823
|
+
<textarea
|
|
824
|
+
class="quickforge-settings-textarea quickforge-settings-mono quickforge-memory-editor"
|
|
825
|
+
.value=${this.markdown}
|
|
826
|
+
?disabled=${!this.enabled||t}
|
|
827
|
+
spellcheck="false"
|
|
828
|
+
@input=${e=>{this.markdown=e.target.value,this.message=``,this.requestUpdate()}}
|
|
829
|
+
></textarea>
|
|
830
|
+
<div class="quickforge-memory-editor-actions">
|
|
831
|
+
<button
|
|
832
|
+
class="quickforge-settings-button quickforge-settings-button-secondary"
|
|
833
|
+
type="button"
|
|
834
|
+
?disabled=${t}
|
|
835
|
+
@click=${()=>void this.reloadDocument()}
|
|
836
|
+
>${this.loadingDocument?w(`loading`):w(`memoryReload`)}</button>
|
|
837
|
+
<button
|
|
838
|
+
class="quickforge-settings-button quickforge-settings-button-primary"
|
|
839
|
+
type="button"
|
|
840
|
+
?disabled=${!this.enabled||t||!e}
|
|
841
|
+
@click=${()=>void this.saveDocument()}
|
|
842
|
+
>${this.saving?w(`saving`):w(`memorySave`)}</button>
|
|
843
|
+
</div>
|
|
844
|
+
</div>
|
|
845
|
+
</div>
|
|
846
|
+
|
|
847
|
+
<div class="quickforge-settings-note">${w(`memoryCurrentSessionNote`)}</div>
|
|
848
|
+
</section>
|
|
849
|
+
|
|
850
|
+
${this.message?_`<div class="quickforge-settings-message">${this.message}</div>`:null}
|
|
851
|
+
${this.error?_`<div class="quickforge-settings-alert">${this.error}</div>`:null}
|
|
852
|
+
</div>
|
|
853
|
+
`}},V=`quickforge-memory-settings-tab`;customElements.get(V)||customElements.define(V,dt);function ft(){return document.createElement(V)}var pt=`quickforge-backup`,H=[{id:`settings`,countKey:`settings`,label:()=>w(`restoreSettings`),description:()=>w(`restoreSettingsDescription`)},{id:`mcp`,countKey:`mcp`,label:()=>w(`restoreMcp`),description:()=>w(`restoreMcpDescription`)},{id:`providerKeys`,countKey:`providerKeys`,label:()=>w(`restoreProviderKeys`),description:()=>w(`restoreProviderKeysDescription`)},{id:`customProviders`,countKey:`customProviders`,label:()=>w(`restoreCustomProviders`),description:()=>w(`restoreCustomProvidersDescription`)},{id:`scheduledTasks`,countKey:`scheduledTasks`,label:()=>w(`restoreScheduledTasks`),description:()=>w(`restoreScheduledTasksDescription`)}],mt=H;function ht(e,t){let n=new Blob([`${JSON.stringify(t,null,2)}\n`],{type:`application/json`}),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=e,document.body.appendChild(i),i.click(),i.remove(),URL.revokeObjectURL(r)}function gt(){return new Date().toISOString().replace(/[:.]/g,`-`)}function _t(e){return e?Object.entries(e).map(([e,t])=>`${e}: ${t}`).join(`, `):``}function vt(e){return mt.filter(t=>(e.sections?.[t.countKey]??0)>0)}function yt(e){return vt(e).map(e=>e.id)}function bt(e){return e instanceof RangeError||e instanceof Error&&e.message.includes(`Invalid string length`)}function U(e,t){return bt(e)?w(`backupStringTooLarge`):e instanceof Error?e.message:t}var xt=class extends v{exportSections=new Set(H.map(e=>e.id));busy=!1;message=``;error=``;safetyBackupPath=``;pendingImport=null;getTabName(){return w(`backupRestore`)}toggleExportSection(e,t){t?this.exportSections.add(e):this.exportSections.delete(e),this.clearStatus(),this.requestUpdate()}clearStatus(){this.message=``,this.error=``,this.safetyBackupPath=``}async exportBackup(){if(this.exportSections.size===0){this.error=w(`selectAtLeastOneExportSection`),this.requestUpdate();return}this.busy=!0,this.clearStatus(),this.requestUpdate();try{let e=new URLSearchParams({sections:[...this.exportSections].join(`,`)}),t=await fetch(`/api/backup/export?${e.toString()}`,{cache:`no-store`}),n=await t.json().catch(()=>null);if(!t.ok)throw Error(n?.error||w(`backupExportFailed`));ht(`${pt}-settings-${gt()}.json`,n),this.message=w(`backupExported`)}catch(e){this.error=U(e,w(`backupExportFailed`))}finally{this.busy=!1,this.requestUpdate()}}async inspectBackupFile(e){let t=await fetch(`/api/backup/inspect-file`,{method:`POST`,headers:{"content-type":`application/json`},body:e}),n=await t.json().catch(()=>null);if(!t.ok)throw Error(n?.error||w(`backupInspectFailed`));if(!n)throw Error(w(`backupInspectFailed`));return n}async importBackupFromFile(e){this.busy=!0,this.clearStatus(),this.pendingImport=null,this.requestUpdate();try{let t=await this.inspectBackupFile(e),n=new Set(yt(t));this.pendingImport={backup:null,importToken:t.importToken,inspect:t,selectedSections:n,mode:`replace`},this.message=t.ignoredConversations?w(`backupInspectedWithIgnoredConversations`):w(`backupInspected`)}catch(e){this.error=U(e,w(`backupImportFailed`))}finally{this.busy=!1,this.requestUpdate()}}togglePendingSection(e,t){this.pendingImport&&(t?this.pendingImport.selectedSections.add(e):this.pendingImport.selectedSections.delete(e),this.message=``,this.error=``,this.requestUpdate())}setRestoreMode(e){this.pendingImport&&(this.pendingImport.mode=e,this.message=``,this.error=``,this.requestUpdate())}cancelPendingImport(){this.pendingImport=null,this.message=``,this.error=``,this.requestUpdate()}async confirmPendingImport(){if(this.pendingImport){if(this.pendingImport.selectedSections.size===0){this.error=w(`selectAtLeastOneRestoreSection`),this.requestUpdate();return}if(await T({description:this.pendingImport.mode===`replace`?w(`backupImportReplaceConfirm`):w(`backupImportMergeConfirm`),confirmLabel:w(`confirmImportSelected`),cancelLabel:w(`cancel`)})){this.busy=!0,this.clearStatus(),this.requestUpdate();try{let e=this.pendingImport.importToken?{importToken:this.pendingImport.importToken,sections:[...this.pendingImport.selectedSections],mode:this.pendingImport.mode}:{backup:this.pendingImport.backup,sections:[...this.pendingImport.selectedSections],mode:this.pendingImport.mode},t=await fetch(`/api/backup/import`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(e)}),n=await t.json().catch(()=>null);if(!t.ok)throw Error(n?.error||w(`backupImportFailed`));let r=_t(n?.summary);this.safetyBackupPath=n?.safetyBackupPath||``,this.pendingImport=null,this.message=r?`${w(`backupImported`)} ${r}`:w(`backupImported`),window.setTimeout(()=>window.location.reload(),1500)}catch(e){this.error=U(e,w(`backupImportFailed`))}finally{this.busy=!1,this.requestUpdate()}}}}handleFileChange(e){let t=e.target,n=t.files?.[0];t.value=``,n&&this.importBackupFromFile(n)}renderSwitch(e,t,n=!1){return _`
|
|
854
|
+
<label class="quickforge-settings-switch" aria-disabled=${n?`true`:`false`}>
|
|
855
|
+
<input
|
|
856
|
+
type="checkbox"
|
|
857
|
+
.checked=${e}
|
|
858
|
+
?disabled=${n}
|
|
859
|
+
@change=${e=>t(e.target.checked)}
|
|
860
|
+
/>
|
|
861
|
+
<span aria-hidden="true"></span>
|
|
862
|
+
</label>
|
|
863
|
+
`}renderPendingImport(){if(!this.pendingImport)return null;let{inspect:e,selectedSections:t}=this.pendingImport,n=vt(e);return _`
|
|
864
|
+
<section class="quickforge-settings-section" aria-label=${w(`backupInspectTitle`)}>
|
|
865
|
+
<div class="quickforge-settings-row quickforge-settings-row-top">
|
|
866
|
+
<div class="quickforge-settings-row-main">
|
|
867
|
+
<div class="quickforge-settings-row-title">${w(`backupInspectTitle`)}</div>
|
|
868
|
+
<div class="quickforge-settings-row-description">${w(`backupInspectDescription`)}</div>
|
|
869
|
+
</div>
|
|
870
|
+
</div>
|
|
871
|
+
|
|
872
|
+
<div class="quickforge-settings-nested-list">
|
|
873
|
+
<div class="quickforge-settings-subrow">
|
|
874
|
+
<div class="quickforge-settings-row-main">
|
|
875
|
+
<div class="quickforge-settings-row-title">${w(`backupInspectExportedAt`)}</div>
|
|
876
|
+
</div>
|
|
877
|
+
<div class="quickforge-settings-row-control quickforge-settings-readonly-value">${e.exportedAt||`-`}</div>
|
|
878
|
+
</div>
|
|
879
|
+
<div class="quickforge-settings-subrow">
|
|
880
|
+
<div class="quickforge-settings-row-main">
|
|
881
|
+
<div class="quickforge-settings-row-title">${w(`backupInspectVersion`)}</div>
|
|
882
|
+
</div>
|
|
883
|
+
<div class="quickforge-settings-row-control quickforge-settings-readonly-value">${e.version??`-`}</div>
|
|
884
|
+
</div>
|
|
885
|
+
<div class="quickforge-settings-subrow">
|
|
886
|
+
<div class="quickforge-settings-row-main">
|
|
887
|
+
<div class="quickforge-settings-row-title">${w(`backupInspectScope`)}</div>
|
|
888
|
+
</div>
|
|
889
|
+
<div class="quickforge-settings-row-control quickforge-settings-readonly-value">${e.scope||`-`}</div>
|
|
890
|
+
</div>
|
|
891
|
+
<div class="quickforge-settings-subrow">
|
|
892
|
+
<div class="quickforge-settings-row-main">
|
|
893
|
+
<div class="quickforge-settings-row-title">${w(`backupInspectSecrets`)}</div>
|
|
894
|
+
</div>
|
|
895
|
+
<div class="quickforge-settings-row-control quickforge-settings-readonly-value">${e.includeSecrets?w(`yes`):w(`no`)}</div>
|
|
896
|
+
</div>
|
|
897
|
+
</div>
|
|
898
|
+
|
|
899
|
+
${e.warnings?.length?_`
|
|
900
|
+
<div class="quickforge-settings-warning quickforge-settings-warning-attached">
|
|
901
|
+
${e.warnings.map(e=>_`<div>⚠ ${e}</div>`)}
|
|
902
|
+
</div>
|
|
903
|
+
`:null}
|
|
904
|
+
|
|
905
|
+
${e.invalidSections&&Object.keys(e.invalidSections).length?_`
|
|
906
|
+
<div class="quickforge-settings-warning quickforge-settings-warning-attached">
|
|
907
|
+
<div>${w(`backupInvalidSections`)}</div>
|
|
908
|
+
${Object.entries(e.invalidSections).map(([e,t])=>_`<div>${e}: ${t}</div>`)}
|
|
909
|
+
</div>
|
|
910
|
+
`:null}
|
|
911
|
+
|
|
912
|
+
<div class="quickforge-settings-row">
|
|
913
|
+
<div class="quickforge-settings-row-main">
|
|
914
|
+
<div class="quickforge-settings-row-title">${w(`restoreMode`)}</div>
|
|
915
|
+
<div class="quickforge-settings-row-description">${w(`restoreModeDescription`)}</div>
|
|
916
|
+
</div>
|
|
917
|
+
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide">
|
|
918
|
+
<div class="quickforge-settings-segmented" role="group" aria-label=${w(`restoreMode`)}>
|
|
919
|
+
<button
|
|
920
|
+
type="button"
|
|
921
|
+
class="quickforge-settings-segmented-option ${this.pendingImport.mode===`replace`?`quickforge-settings-segmented-option-active`:``}"
|
|
922
|
+
?disabled=${this.busy}
|
|
923
|
+
@click=${()=>this.setRestoreMode(`replace`)}
|
|
924
|
+
>
|
|
925
|
+
${w(`restoreModeReplace`)}
|
|
926
|
+
</button>
|
|
927
|
+
<button
|
|
928
|
+
type="button"
|
|
929
|
+
class="quickforge-settings-segmented-option ${this.pendingImport.mode===`merge`?`quickforge-settings-segmented-option-active`:``}"
|
|
930
|
+
?disabled=${this.busy}
|
|
931
|
+
@click=${()=>this.setRestoreMode(`merge`)}
|
|
932
|
+
>
|
|
933
|
+
${w(`restoreModeMerge`)}
|
|
934
|
+
</button>
|
|
935
|
+
</div>
|
|
936
|
+
</div>
|
|
937
|
+
</div>
|
|
938
|
+
|
|
939
|
+
<div class="quickforge-settings-row quickforge-settings-row-top">
|
|
940
|
+
<div class="quickforge-settings-row-main">
|
|
941
|
+
<div class="quickforge-settings-row-title">${w(`selectRestoreSections`)}</div>
|
|
942
|
+
<div class="quickforge-settings-row-description">
|
|
943
|
+
${this.pendingImport.mode===`replace`?w(`restoreModeReplaceDescription`):w(`restoreModeMergeDescription`)}
|
|
944
|
+
</div>
|
|
945
|
+
</div>
|
|
946
|
+
</div>
|
|
947
|
+
<div class="quickforge-settings-nested-list">
|
|
948
|
+
${n.map(n=>_`
|
|
949
|
+
<div class="quickforge-settings-subrow">
|
|
950
|
+
<div class="quickforge-settings-row-main">
|
|
951
|
+
<div class="quickforge-settings-row-title">${n.label()} (${e.sections?.[n.countKey]??0})</div>
|
|
952
|
+
<div class="quickforge-settings-row-description">${n.description()}</div>
|
|
953
|
+
</div>
|
|
954
|
+
<div class="quickforge-settings-row-control">
|
|
955
|
+
${this.renderSwitch(t.has(n.id),e=>this.togglePendingSection(n.id,e),this.busy)}
|
|
956
|
+
</div>
|
|
957
|
+
</div>
|
|
958
|
+
`)}
|
|
959
|
+
</div>
|
|
960
|
+
|
|
961
|
+
<div class="quickforge-settings-row">
|
|
962
|
+
<div class="quickforge-settings-row-main">
|
|
963
|
+
<div class="quickforge-settings-row-title">${w(`backupImportActions`)}</div>
|
|
964
|
+
<div class="quickforge-settings-row-description">${w(`backupImportActionsDescription`)}</div>
|
|
965
|
+
</div>
|
|
966
|
+
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide">
|
|
967
|
+
<button
|
|
968
|
+
class="quickforge-settings-button quickforge-settings-button-primary"
|
|
969
|
+
type="button"
|
|
970
|
+
?disabled=${this.busy||t.size===0}
|
|
971
|
+
@click=${()=>this.confirmPendingImport()}
|
|
972
|
+
>
|
|
973
|
+
${this.busy?w(`loading`):w(`confirmImportSelected`)}
|
|
974
|
+
</button>
|
|
975
|
+
<button
|
|
976
|
+
class="quickforge-settings-button quickforge-settings-button-secondary"
|
|
977
|
+
type="button"
|
|
978
|
+
?disabled=${this.busy}
|
|
979
|
+
@click=${()=>this.cancelPendingImport()}
|
|
980
|
+
>
|
|
981
|
+
${w(`cancel`)}
|
|
982
|
+
</button>
|
|
983
|
+
</div>
|
|
984
|
+
</div>
|
|
985
|
+
</section>
|
|
986
|
+
`}render(){return _`
|
|
987
|
+
<div class="quickforge-settings-stack">
|
|
988
|
+
<section class="quickforge-settings-section" aria-label=${w(`exportData`)}>
|
|
989
|
+
<div class="quickforge-settings-row quickforge-settings-row-top">
|
|
990
|
+
<div class="quickforge-settings-row-main">
|
|
991
|
+
<div class="quickforge-settings-row-title">
|
|
992
|
+
${w(`selectExportSections`)}
|
|
993
|
+
<quickforge-info-tip .label=${w(`exportDataDescription`)}></quickforge-info-tip>
|
|
994
|
+
</div>
|
|
995
|
+
<div class="quickforge-settings-row-description">${w(`selectExportSectionsDescription`)}</div>
|
|
996
|
+
</div>
|
|
997
|
+
</div>
|
|
998
|
+
|
|
999
|
+
<div class="quickforge-settings-nested-list">
|
|
1000
|
+
${H.map(e=>_`
|
|
1001
|
+
<div class="quickforge-settings-subrow">
|
|
1002
|
+
<div class="quickforge-settings-row-main">
|
|
1003
|
+
<div class="quickforge-settings-row-title">${e.label()}</div>
|
|
1004
|
+
<div class="quickforge-settings-row-description">${e.description()}</div>
|
|
1005
|
+
</div>
|
|
1006
|
+
<div class="quickforge-settings-row-control">
|
|
1007
|
+
${this.renderSwitch(this.exportSections.has(e.id),t=>this.toggleExportSection(e.id,t),this.busy)}
|
|
1008
|
+
</div>
|
|
1009
|
+
</div>
|
|
1010
|
+
`)}
|
|
1011
|
+
</div>
|
|
1012
|
+
|
|
1013
|
+
<div class="quickforge-settings-note">${w(`conversationBackupExcluded`)}</div>
|
|
1014
|
+
|
|
1015
|
+
<div class="quickforge-settings-row">
|
|
1016
|
+
<div class="quickforge-settings-row-main">
|
|
1017
|
+
<div class="quickforge-settings-row-title">${w(`exportBackup`)}</div>
|
|
1018
|
+
<div class="quickforge-settings-row-description">${w(`exportBackupDescription`)}</div>
|
|
1019
|
+
</div>
|
|
1020
|
+
<div class="quickforge-settings-row-control">
|
|
1021
|
+
<button
|
|
1022
|
+
class="quickforge-settings-button quickforge-settings-button-primary"
|
|
1023
|
+
type="button"
|
|
1024
|
+
?disabled=${this.busy||this.exportSections.size===0}
|
|
1025
|
+
@click=${()=>this.exportBackup()}
|
|
1026
|
+
>
|
|
1027
|
+
${this.busy?w(`loading`):w(`exportBackup`)}
|
|
1028
|
+
</button>
|
|
1029
|
+
</div>
|
|
1030
|
+
</div>
|
|
1031
|
+
</section>
|
|
1032
|
+
|
|
1033
|
+
<section class="quickforge-settings-section" aria-label=${w(`importData`)}>
|
|
1034
|
+
<div class="quickforge-settings-row">
|
|
1035
|
+
<div class="quickforge-settings-row-main">
|
|
1036
|
+
<div class="quickforge-settings-row-title">
|
|
1037
|
+
${w(`importBackup`)}
|
|
1038
|
+
<quickforge-info-tip .label=${w(`importDataDescription`)}></quickforge-info-tip>
|
|
1039
|
+
</div>
|
|
1040
|
+
<div class="quickforge-settings-row-description">${w(`importDataDescription`)}</div>
|
|
1041
|
+
</div>
|
|
1042
|
+
<div class="quickforge-settings-row-control">
|
|
1043
|
+
<label class="quickforge-settings-button quickforge-settings-button-secondary ${this.busy?`pointer-events-none opacity-60`:``}">
|
|
1044
|
+
<input
|
|
1045
|
+
class="hidden"
|
|
1046
|
+
type="file"
|
|
1047
|
+
accept="application/json,.json"
|
|
1048
|
+
?disabled=${this.busy}
|
|
1049
|
+
@change=${e=>this.handleFileChange(e)}
|
|
1050
|
+
/>
|
|
1051
|
+
${w(`importBackup`)}
|
|
1052
|
+
</label>
|
|
1053
|
+
</div>
|
|
1054
|
+
</div>
|
|
1055
|
+
</section>
|
|
1056
|
+
|
|
1057
|
+
${this.renderPendingImport()}
|
|
1058
|
+
${this.message?_`<div class="quickforge-settings-message">${this.message}</div>`:null}
|
|
1059
|
+
${this.safetyBackupPath?_`<div class="quickforge-settings-note">${w(`backupSafetyBackupPath`)}: <code>${this.safetyBackupPath}</code></div>`:null}
|
|
1060
|
+
${this.error?_`<div class="quickforge-settings-alert">${this.error}</div>`:null}
|
|
1061
|
+
</div>
|
|
1062
|
+
`}},W=`quickforge-backup-settings-tab`;customElements.get(W)||customElements.define(W,xt);function St(){return document.createElement(W)}function Ct(e){if(!e)return`-`;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString(ue())}function wt(e){let t={...e};return delete t.archivedAt,t}function G(){if(!(typeof BroadcastChannel>`u`))try{let e=new BroadcastChannel(`quickforge-sync`);e.postMessage({type:`sessions-changed`,sourceTabId:`archived-conversations-settings-tab`,timestamp:Date.now()}),e.close()}catch{}}var Tt=class extends v{sessions=[];projects=[];loading=!0;busySessionId=``;query=``;projectFilter=`all`;message=``;error=``;getTabName(){return w(`archivedConversations`)}async connectedCallback(){super.connectedCallback(),await this.loadData()}get projectNameById(){return new Map(this.projects.map(e=>[e.id,e.name]))}async loadData(){this.loading=!0,this.error=``,this.requestUpdate();try{let[e,t]=await Promise.all([fetch(`/api/storage/sessions-metadata/index/lastModified?direction=desc&limit=1000&offset=0&archived=only`,{cache:`no-store`}),fetch(`/api/project`,{cache:`no-store`}).catch(()=>null)]),n=await e.json().catch(()=>null);if(!e.ok)throw Error(n?.error||w(`requestFailed`));if(this.sessions=Array.isArray(n?.values)?n.values:[],t?.ok){let e=await t.json().catch(()=>null);this.projects=Array.isArray(e?.projects)?e.projects:[]}}catch(e){this.error=e instanceof Error?e.message:w(`requestFailed`)}finally{this.loading=!1,this.requestUpdate()}}filteredSessions(){let e=this.query.trim().toLowerCase();return this.sessions.filter(t=>{if(this.projectFilter!==`all`&&(this.projectFilter===`global`&&t.scope===`project`||this.projectFilter!==`global`&&t.projectId!==this.projectFilter))return!1;if(!e)return!0;let n=t.projectId&&this.projectNameById.get(t.projectId)||``;return`${D(t.title,t.channelName)} ${n}`.toLowerCase().includes(e)})}groupedSessions(){let e=new Map;for(let t of this.filteredSessions()){let n=t.scope===`project`&&t.projectId?t.projectId:`global`;e.set(n,[...e.get(n)??[],t])}return[...e.entries()]}projectLabel(e){return e===`global`?w(`normalChat`):this.projectNameById.get(e)||w(`unknownProject`)}async restoreSession(e){if(!this.busySessionId){this.busySessionId=e,this.message=``,this.error=``,this.requestUpdate();try{let t=y(),n=await t.sessions.get(e),r=await t.sessions.getMetadata(e);if(!n||!r)throw Error(w(`sessionNotFound`));await t.sessions.save(wt(n),wt(r)),this.sessions=this.sessions.filter(t=>t.id!==e),this.message=w(`sessionRestored`),G()}catch(e){this.error=e instanceof Error?e.message:w(`restoreSessionFailed`)}finally{this.busySessionId=``,this.requestUpdate()}}}async deleteSession(e){if(!this.busySessionId&&await T({description:w(`deleteArchivedSessionConfirm`,{title:D(e.title)}),confirmLabel:w(`confirmDelete`),cancelLabel:w(`cancel`),variant:`destructive`})){this.busySessionId=e.id,this.message=``,this.error=``,this.requestUpdate();try{await y().sessions.delete(e.id),this.sessions=this.sessions.filter(t=>t.id!==e.id),this.message=w(`archivedSessionDeleted`),G()}catch(e){this.error=e instanceof Error?e.message:w(`deleteSessionFailed`)}finally{this.busySessionId=``,this.requestUpdate()}}}async deleteAllArchivedSessions(){if(!(this.busySessionId||this.sessions.length===0)&&await T({description:w(`deleteAllArchivedSessionsConfirm`),confirmLabel:w(`confirmDelete`),cancelLabel:w(`cancel`),variant:`destructive`})){this.busySessionId=`__all__`,this.message=``,this.error=``,this.requestUpdate();try{let e=y();await Promise.all(this.sessions.map(t=>e.sessions.delete(t.id))),this.sessions=[],this.message=w(`archivedSessionsDeleted`),G()}catch(e){this.error=e instanceof Error?e.message:w(`deleteSessionFailed`)}finally{this.busySessionId=``,this.requestUpdate()}}}renderSession(e){let t=this.busySessionId===e.id||this.busySessionId===`__all__`;return _`
|
|
1063
|
+
<div class="border-t border-border px-4 py-3 first:border-t-0">
|
|
1064
|
+
<div class="flex flex-wrap items-start justify-between gap-x-3 gap-y-2">
|
|
1065
|
+
<div class="min-w-0 flex-1">
|
|
1066
|
+
<div class="truncate text-sm font-medium text-foreground">${D(e.title,e.channelName)}</div>
|
|
1067
|
+
<div class="mt-1 text-xs text-muted-foreground">
|
|
1068
|
+
${w(`lastModified`)}: ${Ct(e.lastModified)} · ${w(`archivedAt`)}: ${Ct(e.archivedAt)}
|
|
1069
|
+
</div>
|
|
1070
|
+
</div>
|
|
1071
|
+
<div class="flex w-full shrink-0 items-center justify-end gap-2 sm:w-auto">
|
|
1072
|
+
<button
|
|
1073
|
+
class="rounded-md border border-input px-2.5 py-1 text-xs hover:bg-muted/60 disabled:opacity-60"
|
|
1074
|
+
type="button"
|
|
1075
|
+
?disabled=${t}
|
|
1076
|
+
@click=${()=>this.restoreSession(e.id)}
|
|
1077
|
+
>
|
|
1078
|
+
${w(`restoreSession`)}
|
|
1079
|
+
</button>
|
|
1080
|
+
<button
|
|
1081
|
+
class="rounded-md px-2.5 py-1 text-xs text-destructive hover:bg-destructive/10 disabled:opacity-60"
|
|
1082
|
+
type="button"
|
|
1083
|
+
?disabled=${t}
|
|
1084
|
+
@click=${()=>this.deleteSession(e)}
|
|
1085
|
+
>
|
|
1086
|
+
${w(`deletePermanently`)}
|
|
1087
|
+
</button>
|
|
1088
|
+
</div>
|
|
1089
|
+
</div>
|
|
1090
|
+
</div>
|
|
1091
|
+
`}render(){let e=this.groupedSessions();return _`
|
|
1092
|
+
<div class="flex flex-col gap-4">
|
|
1093
|
+
<div class="flex justify-end">
|
|
1094
|
+
<button
|
|
1095
|
+
class="rounded-md bg-destructive/10 px-3 py-2 text-sm text-destructive hover:bg-destructive/15 disabled:opacity-60"
|
|
1096
|
+
type="button"
|
|
1097
|
+
?disabled=${!!this.busySessionId||this.sessions.length===0}
|
|
1098
|
+
@click=${()=>this.deleteAllArchivedSessions()}
|
|
1099
|
+
>
|
|
1100
|
+
${w(`deleteAll`)}
|
|
1101
|
+
</button>
|
|
1102
|
+
</div>
|
|
1103
|
+
|
|
1104
|
+
<section class="rounded-lg border border-border">
|
|
1105
|
+
<div class="grid gap-2 border-b border-border p-3 sm:grid-cols-[minmax(0,1fr)_12rem]">
|
|
1106
|
+
<input
|
|
1107
|
+
class="rounded-md border border-input bg-background px-3 py-2 text-sm outline-none focus:ring-2 focus:ring-ring/30"
|
|
1108
|
+
type="search"
|
|
1109
|
+
.value=${this.query}
|
|
1110
|
+
placeholder=${w(`searchArchivedConversations`)}
|
|
1111
|
+
@input=${e=>{this.query=e.target.value,this.requestUpdate()}}
|
|
1112
|
+
/>
|
|
1113
|
+
<select
|
|
1114
|
+
class="rounded-md border border-input bg-background px-3 py-2 text-sm"
|
|
1115
|
+
.value=${this.projectFilter}
|
|
1116
|
+
@change=${e=>{this.projectFilter=e.target.value,this.requestUpdate()}}
|
|
1117
|
+
>
|
|
1118
|
+
<option value="all">${w(`allProjects`)}</option>
|
|
1119
|
+
<option value="global">${w(`normalChat`)}</option>
|
|
1120
|
+
${this.projects.map(e=>_`<option value=${e.id}>${e.name}</option>`)}
|
|
1121
|
+
</select>
|
|
1122
|
+
</div>
|
|
1123
|
+
|
|
1124
|
+
${this.loading?_`
|
|
1125
|
+
<div class="px-4 py-8 text-center text-sm text-muted-foreground">${w(`loading`)}</div>
|
|
1126
|
+
`:e.length===0?_`
|
|
1127
|
+
<div class="px-4 py-8 text-center text-sm text-muted-foreground">${w(`noArchivedConversations`)}</div>
|
|
1128
|
+
`:_`
|
|
1129
|
+
<div>
|
|
1130
|
+
${e.map(([e,t])=>_`
|
|
1131
|
+
<div class="border-b border-border last:border-b-0">
|
|
1132
|
+
<div class="flex items-center justify-between gap-3 bg-muted/20 px-4 py-2 text-sm text-muted-foreground">
|
|
1133
|
+
<div class="truncate">${this.projectLabel(e)}</div>
|
|
1134
|
+
<div class="shrink-0">${w(`conversationCount`,{count:t.length})}</div>
|
|
1135
|
+
</div>
|
|
1136
|
+
${t.map(e=>this.renderSession(e))}
|
|
1137
|
+
</div>
|
|
1138
|
+
`)}
|
|
1139
|
+
</div>
|
|
1140
|
+
`}
|
|
1141
|
+
</section>
|
|
1142
|
+
|
|
1143
|
+
${this.message?_`<div class="rounded-md border border-emerald-500/30 bg-emerald-500/10 px-3 py-2 text-sm text-emerald-700 dark:text-emerald-300">${this.message}</div>`:null}
|
|
1144
|
+
${this.error?_`<div class="rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive">${this.error}</div>`:null}
|
|
1145
|
+
</div>
|
|
1146
|
+
`}},K=`quickforge-archived-conversations-settings-tab`;customElements.get(K)||customElements.define(K,Tt);function Et(){return document.createElement(K)}function Dt(){return Array.from({length:16},()=>`ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz23456789!@#$%^&*`[Math.floor(Math.random()*65)]).join(``)}function Ot(e){if(!e)return w(`lanAccessUnknownDevice`);let t=e.includes(`Edg/`)?`Edge`:e.includes(`Firefox/`)?`Firefox`:e.includes(`Chrome/`)?`Chrome`:e.includes(`Safari/`)?`Safari`:w(`lanAccessBrowser`),n=/Android/i.test(e)?`Android`:/iPhone|iPad|iPod/i.test(e)?`iOS`:/Windows/i.test(e)?`Windows`:/Macintosh|Mac OS X/i.test(e)?`macOS`:/Linux/i.test(e)?`Linux`:``;return n?`${t} · ${n}`:t}function kt(e){if(!e)return`-`;let t=new Date(e);return Number.isNaN(t.getTime())?`-`:new Intl.DateTimeFormat(ue(),{dateStyle:`medium`,timeStyle:`short`}).format(t)}var At=class extends v{loading=!0;saving=!1;enabled=!1;hasPassword=!1;password=``;passwordVisible=!1;sessionTtlHours=12;activeTokenCount=0;activeDevices=[];lanUrls=[];error=``;message=``;getTabName(){return w(`lanAccess`)}async connectedCallback(){super.connectedCallback(),await this.loadStatus()}async request(e,t){let n=await fetch(e,{...t,cache:`no-store`,headers:{...t?.body?{"content-type":`application/json`}:void 0,...t?.headers}}),r=await n.json().catch(()=>null);if(!n.ok)throw Error(r?.error||w(`requestFailed`));return r}applyStatus(e){this.enabled=!!e.enabled,this.hasPassword=!!e.hasPassword,this.sessionTtlHours=Number(e.sessionTtlHours||12),this.activeTokenCount=Number(e.activeTokenCount||0),this.activeDevices=Array.isArray(e.activeDevices)?e.activeDevices:[],this.lanUrls=Array.isArray(e.lanUrls)?e.lanUrls:[]}async loadStatus(){this.loading=!0,this.error=``,this.requestUpdate();try{this.applyStatus(await this.request(`/api/lan-access/status`))}catch(e){this.error=e instanceof Error?e.message:w(`requestFailed`)}finally{this.loading=!1,this.requestUpdate()}}updatePassword(e){this.password=e,this.requestUpdate()}togglePasswordVisibility(){this.passwordVisible=!this.passwordVisible,this.requestUpdate()}updateEnabled(e){this.enabled=e,this.requestUpdate()}updateTtl(e){this.sessionTtlHours=Number(e)||12,this.requestUpdate()}async saveSettings(){if(!this.saving){if(this.enabled&&!this.hasPassword&&!this.password.trim()){this.error=w(`lanAccessPasswordRequired`),this.requestUpdate();return}if(this.password.trim()&&this.password.trim().length<8){this.error=w(`lanAccessPasswordTooShort`),this.requestUpdate();return}if(!(this.enabled&&!await T({description:w(`lanAccessEnableConfirm`),confirmLabel:w(`enabled`),cancelLabel:w(`cancel`)}))){this.saving=!0,this.error=``,this.message=``,this.requestUpdate();try{let e=await this.request(`/api/lan-access/settings`,{method:`PUT`,body:JSON.stringify({enabled:this.enabled,password:this.password.trim()||void 0,sessionTtlHours:this.sessionTtlHours})});this.applyStatus(e),this.password=``,this.passwordVisible=!1,this.message=w(`lanAccessSaved`)}catch(e){this.error=e instanceof Error?e.message:w(`requestFailed`)}finally{this.saving=!1,this.requestUpdate()}}}}async revokeDevice(e){if(await T({description:w(`lanAccessRevokeDeviceConfirm`,{device:Ot(e.userAgent)}),confirmLabel:w(`lanAccessRevokeDevice`),cancelLabel:w(`cancel`),variant:`destructive`})){this.saving=!0,this.error=``,this.message=``,this.requestUpdate();try{let t=await this.request(`/api/lan-access/revoke`,{method:`POST`,body:JSON.stringify({id:e.id})});this.applyStatus(t),this.message=w(`lanAccessDeviceRevoked`)}catch(e){this.error=e instanceof Error?e.message:w(`requestFailed`)}finally{this.saving=!1,this.requestUpdate()}}}async revokeAll(){if(await T({description:w(`lanAccessRevokeAllConfirm`),confirmLabel:w(`lanAccessRevokeAll`),cancelLabel:w(`cancel`),variant:`destructive`})){this.saving=!0,this.error=``,this.message=``,this.requestUpdate();try{let e=await this.request(`/api/lan-access/revoke-all`,{method:`POST`});this.applyStatus(e),this.message=w(`lanAccessRevoked`)}catch(e){this.error=e instanceof Error?e.message:w(`requestFailed`)}finally{this.saving=!1,this.requestUpdate()}}}renderSwitch(e,t,n=!1){return _`
|
|
1147
|
+
<label class="quickforge-settings-switch" aria-disabled=${n?`true`:`false`}>
|
|
1148
|
+
<input
|
|
1149
|
+
type="checkbox"
|
|
1150
|
+
.checked=${e}
|
|
1151
|
+
?disabled=${n}
|
|
1152
|
+
@change=${e=>t(e.target.checked)}
|
|
1153
|
+
/>
|
|
1154
|
+
<span aria-hidden="true"></span>
|
|
1155
|
+
</label>
|
|
1156
|
+
`}render(){return this.loading?_`<div class="text-sm text-muted-foreground">${w(`loading`)}</div>`:_`
|
|
1157
|
+
<div class="quickforge-settings-stack">
|
|
1158
|
+
<div class="quickforge-settings-warning">${w(`lanAccessRiskWarning`)}</div>
|
|
1159
|
+
|
|
1160
|
+
<section class="quickforge-settings-section" aria-label=${w(`lanAccessStatus`)}>
|
|
1161
|
+
<div class="quickforge-settings-row">
|
|
1162
|
+
<div class="quickforge-settings-row-main">
|
|
1163
|
+
<div class="quickforge-settings-row-title">${w(`lanAccessEnabled`)}</div>
|
|
1164
|
+
<div class="quickforge-settings-row-description">${w(`lanAccessEnabledDescription`)}</div>
|
|
1165
|
+
</div>
|
|
1166
|
+
<div class="quickforge-settings-row-control quickforge-settings-readonly-value">${this.enabled?w(`enabled`):w(`disabled`)}</div>
|
|
1167
|
+
</div>
|
|
1168
|
+
<div class="quickforge-settings-row">
|
|
1169
|
+
<div class="quickforge-settings-row-main">
|
|
1170
|
+
<div class="quickforge-settings-row-title">${w(`lanAccessPassword`)}</div>
|
|
1171
|
+
<div class="quickforge-settings-row-description">${w(`lanAccessPasswordStatusDescription`)}</div>
|
|
1172
|
+
</div>
|
|
1173
|
+
<div class="quickforge-settings-row-control quickforge-settings-readonly-value">${this.hasPassword?w(`configured`):w(`notConfigured`)}</div>
|
|
1174
|
+
</div>
|
|
1175
|
+
<div class="quickforge-settings-row quickforge-settings-row-top">
|
|
1176
|
+
<div class="quickforge-settings-row-main">
|
|
1177
|
+
<div class="quickforge-settings-row-title">${w(`lanAccessActiveDevices`,{count:this.activeTokenCount})}</div>
|
|
1178
|
+
<div class="quickforge-settings-row-description">${w(`lanAccessActiveDevicesDescription`)}</div>
|
|
1179
|
+
</div>
|
|
1180
|
+
</div>
|
|
1181
|
+
<div class="quickforge-settings-nested-list quickforge-lan-device-list">
|
|
1182
|
+
${this.activeDevices.length?this.activeDevices.map(e=>_`
|
|
1183
|
+
<div class="quickforge-settings-subrow">
|
|
1184
|
+
<div class="quickforge-settings-list-item-main">
|
|
1185
|
+
<div class="quickforge-settings-row-title">${Ot(e.userAgent)}</div>
|
|
1186
|
+
<div class="quickforge-settings-row-description quickforge-lan-device-meta">
|
|
1187
|
+
<span>${e.address||w(`lanAccessUnknownAddress`)}</span>
|
|
1188
|
+
<span>${w(`lanAccessSignedInAt`,{time:kt(e.issuedAt)})}</span>
|
|
1189
|
+
<span>${w(`lanAccessExpiresAt`,{time:kt(e.expiresAt)})}</span>
|
|
1190
|
+
</div>
|
|
1191
|
+
</div>
|
|
1192
|
+
<div class="quickforge-settings-list-item-actions">
|
|
1193
|
+
<button
|
|
1194
|
+
class="quickforge-settings-button quickforge-settings-button-danger quickforge-settings-button-compact"
|
|
1195
|
+
type="button"
|
|
1196
|
+
?disabled=${this.saving}
|
|
1197
|
+
@click=${()=>this.revokeDevice(e)}
|
|
1198
|
+
>
|
|
1199
|
+
${w(`lanAccessRevokeDevice`)}
|
|
1200
|
+
</button>
|
|
1201
|
+
</div>
|
|
1202
|
+
</div>
|
|
1203
|
+
`):_`<div class="quickforge-settings-empty-row">${w(`lanAccessNoActiveDevices`)}</div>`}
|
|
1204
|
+
</div>
|
|
1205
|
+
<div class="quickforge-settings-row">
|
|
1206
|
+
<div class="quickforge-settings-row-main">
|
|
1207
|
+
<div class="quickforge-settings-row-title">${w(`lanAccessUrls`)}</div>
|
|
1208
|
+
<div class="quickforge-settings-row-description">${w(`lanAccessUrlsDescription`)}</div>
|
|
1209
|
+
</div>
|
|
1210
|
+
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide quickforge-settings-readonly-value">
|
|
1211
|
+
${this.lanUrls.length?this.lanUrls.map(e=>_`<div>${e}</div>`):`-`}
|
|
1212
|
+
</div>
|
|
1213
|
+
</div>
|
|
1214
|
+
</section>
|
|
1215
|
+
|
|
1216
|
+
<section class="quickforge-settings-section" aria-label=${w(`lanAccess`)}>
|
|
1217
|
+
<div class="quickforge-settings-row">
|
|
1218
|
+
<div class="quickforge-settings-row-main">
|
|
1219
|
+
<div class="quickforge-settings-row-title">${w(`lanAccessAllowFull`)}</div>
|
|
1220
|
+
<div class="quickforge-settings-row-description">${w(`lanAccessAllowFullDescription`)}</div>
|
|
1221
|
+
</div>
|
|
1222
|
+
<div class="quickforge-settings-row-control">
|
|
1223
|
+
${this.renderSwitch(this.enabled,e=>this.updateEnabled(e),this.saving)}
|
|
1224
|
+
</div>
|
|
1225
|
+
</div>
|
|
1226
|
+
|
|
1227
|
+
<div class="quickforge-settings-row">
|
|
1228
|
+
<div class="quickforge-settings-row-main">
|
|
1229
|
+
<div class="quickforge-settings-row-title">${w(`lanAccessPassword`)}</div>
|
|
1230
|
+
<div class="quickforge-settings-row-description">${this.hasPassword?w(`lanAccessPasswordPlaceholderConfigured`):w(`lanAccessPasswordPlaceholder`)}</div>
|
|
1231
|
+
</div>
|
|
1232
|
+
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide quickforge-lan-password-control">
|
|
1233
|
+
<div class="quickforge-lan-password-input-wrap">
|
|
1234
|
+
<input
|
|
1235
|
+
class="quickforge-settings-input"
|
|
1236
|
+
type=${this.passwordVisible?`text`:`password`}
|
|
1237
|
+
.value=${this.password}
|
|
1238
|
+
@input=${e=>this.updatePassword(e.target.value)}
|
|
1239
|
+
placeholder=${this.hasPassword?w(`lanAccessPasswordPlaceholderConfigured`):w(`lanAccessPasswordPlaceholder`)}
|
|
1240
|
+
/>
|
|
1241
|
+
<button
|
|
1242
|
+
class="quickforge-lan-password-toggle"
|
|
1243
|
+
type="button"
|
|
1244
|
+
aria-label=${this.passwordVisible?w(`hidePassword`):w(`showPassword`)}
|
|
1245
|
+
title=${this.passwordVisible?w(`hidePassword`):w(`showPassword`)}
|
|
1246
|
+
aria-pressed=${this.passwordVisible?`true`:`false`}
|
|
1247
|
+
@click=${()=>this.togglePasswordVisibility()}
|
|
1248
|
+
>
|
|
1249
|
+
${this.passwordVisible?_`
|
|
1250
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" aria-hidden="true">
|
|
1251
|
+
<path d="m3 3 18 18" stroke-linecap="round"></path>
|
|
1252
|
+
<path d="M10.6 10.7a2 2 0 0 0 2.7 2.7"></path>
|
|
1253
|
+
<path d="M9.9 4.3A10.9 10.9 0 0 1 12 4c5.5 0 9 5.3 9 8a7.3 7.3 0 0 1-1.5 3.2"></path>
|
|
1254
|
+
<path d="M6.6 6.6C4.3 8.1 3 10.4 3 12c0 2.7 3.5 8 9 8 1.5 0 2.8-.4 4-1"></path>
|
|
1255
|
+
</svg>
|
|
1256
|
+
`:_`
|
|
1257
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" aria-hidden="true">
|
|
1258
|
+
<path d="M3 12c0-2.7 3.5-8 9-8s9 5.3 9 8-3.5 8-9 8-9-5.3-9-8Z"></path>
|
|
1259
|
+
<circle cx="12" cy="12" r="2.5"></circle>
|
|
1260
|
+
</svg>
|
|
1261
|
+
`}
|
|
1262
|
+
</button>
|
|
1263
|
+
</div>
|
|
1264
|
+
<button
|
|
1265
|
+
class="quickforge-settings-button quickforge-settings-button-secondary"
|
|
1266
|
+
type="button"
|
|
1267
|
+
@click=${()=>this.updatePassword(Dt())}
|
|
1268
|
+
>
|
|
1269
|
+
${w(`generatePassword`)}
|
|
1270
|
+
</button>
|
|
1271
|
+
</div>
|
|
1272
|
+
</div>
|
|
1273
|
+
|
|
1274
|
+
<div class="quickforge-settings-row">
|
|
1275
|
+
<div class="quickforge-settings-row-main">
|
|
1276
|
+
<div class="quickforge-settings-row-title">${w(`lanAccessSessionTtl`)}</div>
|
|
1277
|
+
<div class="quickforge-settings-row-description">${w(`lanAccessSessionTtlDescription`)}</div>
|
|
1278
|
+
</div>
|
|
1279
|
+
<div class="quickforge-settings-row-control">
|
|
1280
|
+
<select class="quickforge-settings-select" .value=${String(this.sessionTtlHours)} @change=${e=>this.updateTtl(e.target.value)}>
|
|
1281
|
+
<option value="1">1 ${w(`hour`)}</option>
|
|
1282
|
+
<option value="12">12 ${w(`hours`)}</option>
|
|
1283
|
+
<option value="24">24 ${w(`hours`)}</option>
|
|
1284
|
+
<option value="168">7 ${w(`days`)}</option>
|
|
1285
|
+
</select>
|
|
1286
|
+
</div>
|
|
1287
|
+
</div>
|
|
1288
|
+
|
|
1289
|
+
<div class="quickforge-settings-row">
|
|
1290
|
+
<div class="quickforge-settings-row-main">
|
|
1291
|
+
<div class="quickforge-settings-row-title">${w(`lanAccessActions`)}</div>
|
|
1292
|
+
<div class="quickforge-settings-row-description">${w(`lanAccessActionsDescription`)}</div>
|
|
1293
|
+
</div>
|
|
1294
|
+
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide">
|
|
1295
|
+
<button class="quickforge-settings-button quickforge-settings-button-primary" type="button" ?disabled=${this.saving} @click=${()=>this.saveSettings()}>
|
|
1296
|
+
${this.saving?w(`saving`):w(`save`)}
|
|
1297
|
+
</button>
|
|
1298
|
+
<button class="quickforge-settings-button quickforge-settings-button-danger" type="button" ?disabled=${this.saving} @click=${()=>this.revokeAll()}>
|
|
1299
|
+
${w(`lanAccessRevokeAll`)}
|
|
1300
|
+
</button>
|
|
1301
|
+
</div>
|
|
1302
|
+
</div>
|
|
1303
|
+
</section>
|
|
1304
|
+
|
|
1305
|
+
${this.message?_`<div class="quickforge-settings-message">${this.message}</div>`:null}
|
|
1306
|
+
${this.error?_`<div class="quickforge-settings-alert">${this.error}</div>`:null}
|
|
1307
|
+
</div>
|
|
1308
|
+
`}},q=`quickforge-lan-access-settings-tab`;customElements.get(q)||customElements.define(q,At);function jt(){return document.createElement(q)}var Mt=18e4,Nt=3e4,Pt=1e3,Ft=`https://github.com/shawnstack/quickforge/releases/latest`;function J(){if(typeof document>`u`)return!1;let e=window;return document.body.classList.contains(`quickforge-desktop-app`)||e.__quickforgeDesktopApp===!0}function It(e){return new Promise(t=>window.setTimeout(t,e))}var Lt=[{value:`startup`,label:()=>w(`frequencyStartup`)},{value:`daily`,label:()=>w(`frequencyDaily`)},{value:`weekly`,label:()=>w(`frequencyWeekly`)},{value:`off`,label:()=>w(`frequencyOff`)}],Rt=class extends v{about;updateInfo;loading=!0;checking=!1;updating=!1;restarting=!1;message=``;error=``;frequency=Ee.frequency;lastCheckAt=null;serviceStatus;getTabName(){return w(`about`)}async connectedCallback(){super.connectedCallback(),await this.loadAbout()}async loadAbout(){this.loading=!0,this.error=``,this.requestUpdate();try{let e=await fetch(`/api/system/about`,{cache:`no-store`}),t=await e.json().catch(()=>null);if(!e.ok)throw Error(t?.error||w(`requestFailed`));this.about=t;try{let[e,t]=await Promise.all([oe(y()),this.loadServiceStatus()]);this.frequency=e.frequency,this.lastCheckAt=e.lastCheckAt,this.serviceStatus=t}catch{}}catch(e){this.error=e instanceof Error?e.message:w(`requestFailed`)}finally{this.loading=!1,this.requestUpdate()}}async loadServiceStatus(){let e=await fetch(`/api/health`,{cache:`no-store`}),t=await e.json().catch(()=>null);if(!e.ok)throw Error(t?.error||w(`requestFailed`));return t}async checkUpdate(){if(!(this.checking||this.updating)){if(J()){window.open(Ft,`_blank`,`noopener,noreferrer`),this.message=w(`desktopUpdateHint`),this.error=``,this.requestUpdate();return}this.checking=!0,this.message=``,this.error=``,this.requestUpdate();try{let e=await fetch(`/api/system/update/check`,{cache:`no-store`}),t=await e.json().catch(()=>null);if(!e.ok)throw Error(t?.error||w(`updateCheckFailed`));this.updateInfo=t,this.about=t,this.updateInfo.updateAvailable?this.message=w(`updateAvailableMessage`,{current:this.updateInfo.currentVersion,latest:this.updateInfo.latestVersion}):this.updateInfo.localVersionIsNewer?this.message=w(`localVersionNewerMessage`,{current:this.updateInfo.currentVersion,latest:this.updateInfo.latestVersion}):this.message=w(`alreadyLatestVersion`,{version:this.updateInfo.currentVersion})}catch(e){this.error=e instanceof Error?e.message:w(`updateCheckFailed`)}finally{this.checking=!1,this.requestUpdate()}}}async pollUntilUpdated(e){let t=Date.now();for(;Date.now()-t<Mt;){await It(Pt);try{let t=await fetch(`/api/health?updatePoll=${Date.now()}`,{cache:`no-store`}),n=await t.json().catch(()=>null);if(t.ok&&n?.ok&&n.bootId&&n.bootId!==e){this.message=w(`updateRestarted`),this.requestUpdate(),window.setTimeout(()=>window.location.reload(),300);return}}catch{}}throw Error(w(`updateRestartTimeout`))}async pollUntilRestarted(e){let t=Date.now();for(;Date.now()-t<Nt;){await It(Pt);try{let t=await fetch(`/api/health?restartPoll=${Date.now()}`,{cache:`no-store`}),n=await t.json().catch(()=>null);if(t.ok&&n?.ok&&n.bootId&&n.bootId!==e){this.message=w(`backendRestarted`),this.requestUpdate(),window.setTimeout(()=>window.location.reload(),300);return}}catch{}}throw Error(w(`backendRestartTimeout`))}async restartService(){if(!this.serviceStatus||this.restarting||!await T({description:w(`restartBackendConfirm`),confirmLabel:w(`restartBackendService`),cancelLabel:w(`cancel`)}))return;this.restarting=!0,this.message=w(`backendRestarting`),this.error=``,this.requestUpdate();let e=this.serviceStatus.bootId;try{let t=await fetch(`/api/system/restart`,{method:`POST`,headers:{"x-quickforge-action":`restart`}}),n=await t.json().catch(()=>null);if(!t.ok)throw Error(n?.error||w(`backendRestartFailed`));await this.pollUntilRestarted(e)}catch(e){this.error=e instanceof Error?e.message:w(`backendRestartFailed`),this.message=``,this.restarting=!1,this.requestUpdate()}}async updateQuickForge(){if(J()){window.open(Ft,`_blank`,`noopener,noreferrer`),this.message=w(`desktopUpdateHint`),this.error=``,this.requestUpdate();return}if(!(!this.updateInfo?.updateAvailable||this.updating)&&await T({description:w(`updateConfirm`,{command:this.updateInfo.installCommand}),confirmLabel:w(`updateRuntimeNow`),cancelLabel:w(`cancel`)})){this.updating=!0,this.message=w(`updatingQuickForge`),this.error=``,this.requestUpdate();try{let e=await fetch(`/api/system/update`,{method:`POST`,headers:{"x-quickforge-action":`update`}}),t=await e.json().catch(()=>null);if(!e.ok)throw Error(t?.error||w(`updateFailed`));if(this.updateInfo=t,t?.updateStarted){let e=t.logFile?` ${w(`updateLogFile`,{path:t.logFile})}`:``;this.message=`${w(`updateStarted`)}${e}`,this.requestUpdate(),await this.pollUntilUpdated(t.bootId)}else this.message=t?.updated?w(`updateCompleted`):w(`alreadyLatestVersion`,{version:t?.currentVersion||this.about?.version||`-`}),this.updating=!1}catch(e){this.error=e instanceof Error?e.message:w(`updateFailed`),this.message=``,this.updating=!1}finally{this.requestUpdate()}}}async selectFrequency(e){if(this.frequency!==e){this.frequency=e,this.requestUpdate();try{let t=y();await we(t,{...await oe(t),frequency:e}),this.error=``}catch(e){this.error=e instanceof Error?e.message:w(`requestFailed`)}finally{this.requestUpdate()}}}renderFrequencyOption(e){let t=this.frequency===e.value;return _`
|
|
1309
|
+
<button
|
|
1310
|
+
type="button"
|
|
1311
|
+
class="quickforge-settings-segmented-option ${t?`quickforge-settings-segmented-option-active`:``}"
|
|
1312
|
+
aria-pressed=${t?`true`:`false`}
|
|
1313
|
+
@click=${()=>this.selectFrequency(e.value)}
|
|
1314
|
+
>
|
|
1315
|
+
${e.label()}
|
|
1316
|
+
</button>
|
|
1317
|
+
`}infoRows(){let e=this.about;return e?_`
|
|
1318
|
+
<div class="quickforge-settings-row">
|
|
1319
|
+
<div class="quickforge-settings-row-main">
|
|
1320
|
+
<div class="quickforge-settings-row-title">${w(`packageName`)}</div>
|
|
1321
|
+
<div class="quickforge-settings-row-description">${w(`packageNameDescription`)}</div>
|
|
1322
|
+
</div>
|
|
1323
|
+
<div class="quickforge-settings-row-control quickforge-settings-readonly-value">${e.name}</div>
|
|
1324
|
+
</div>
|
|
1325
|
+
<div class="quickforge-settings-row">
|
|
1326
|
+
<div class="quickforge-settings-row-main">
|
|
1327
|
+
<div class="quickforge-settings-row-title">${w(`currentVersion`)}</div>
|
|
1328
|
+
<div class="quickforge-settings-row-description">${w(`currentVersionDescription`)}</div>
|
|
1329
|
+
</div>
|
|
1330
|
+
<div class="quickforge-settings-row-control quickforge-settings-readonly-value">${e.version}</div>
|
|
1331
|
+
</div>
|
|
1332
|
+
<div class="quickforge-settings-row">
|
|
1333
|
+
<div class="quickforge-settings-row-main">
|
|
1334
|
+
<div class="quickforge-settings-row-title">${w(`github`)}</div>
|
|
1335
|
+
<div class="quickforge-settings-row-description">${w(`githubDescription`)}</div>
|
|
1336
|
+
</div>
|
|
1337
|
+
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide quickforge-settings-readonly-value">
|
|
1338
|
+
<a class="quickforge-settings-link" href=${e.repositoryUrl} target="_blank" rel="noreferrer">
|
|
1339
|
+
${e.repositoryUrl}
|
|
1340
|
+
</a>
|
|
1341
|
+
</div>
|
|
1342
|
+
</div>
|
|
1343
|
+
`:null}updateStatus(){return this.updateInfo?_`
|
|
1344
|
+
<div class="quickforge-settings-row">
|
|
1345
|
+
<div class="quickforge-settings-row-main">
|
|
1346
|
+
<div class="quickforge-settings-row-title">${w(`latestVersion`)}</div>
|
|
1347
|
+
<div class="quickforge-settings-row-description">${w(`latestVersionDescription`)}</div>
|
|
1348
|
+
</div>
|
|
1349
|
+
<div class="quickforge-settings-row-control quickforge-settings-readonly-value">${this.updateInfo.latestVersion}</div>
|
|
1350
|
+
</div>
|
|
1351
|
+
${this.updateInfo.logFile?_`
|
|
1352
|
+
<div class="quickforge-settings-row">
|
|
1353
|
+
<div class="quickforge-settings-row-main">
|
|
1354
|
+
<div class="quickforge-settings-row-title">${w(`updateLog`)}</div>
|
|
1355
|
+
<div class="quickforge-settings-row-description">${w(`updateLogDescription`)}</div>
|
|
1356
|
+
</div>
|
|
1357
|
+
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide quickforge-settings-readonly-value">
|
|
1358
|
+
<code>${this.updateInfo.logFile}</code>
|
|
1359
|
+
</div>
|
|
1360
|
+
</div>
|
|
1361
|
+
`:null}
|
|
1362
|
+
`:null}restartSection(){let e=this.serviceStatus?.restartUnsupportedReason||w(`backendRestartUnsupported`),t=this.restarting||!this.serviceStatus?.restartSupported;return _`
|
|
1363
|
+
<section class="quickforge-settings-section" aria-label=${w(`restartBackendService`)}>
|
|
1364
|
+
<div class="quickforge-settings-row">
|
|
1365
|
+
<div class="quickforge-settings-row-main">
|
|
1366
|
+
<div class="quickforge-settings-row-title">
|
|
1367
|
+
${w(`restartBackendService`)}
|
|
1368
|
+
<quickforge-info-tip .label=${w(`restartBackendServiceDescription`)}></quickforge-info-tip>
|
|
1369
|
+
</div>
|
|
1370
|
+
<div class="quickforge-settings-row-description">
|
|
1371
|
+
${this.serviceStatus?.restartSupported?w(`restartBackendServiceDescription`):e}
|
|
1372
|
+
</div>
|
|
1373
|
+
</div>
|
|
1374
|
+
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide">
|
|
1375
|
+
<button
|
|
1376
|
+
class="quickforge-settings-button quickforge-settings-button-danger"
|
|
1377
|
+
type="button"
|
|
1378
|
+
?disabled=${t}
|
|
1379
|
+
@click=${()=>this.restartService()}
|
|
1380
|
+
>
|
|
1381
|
+
${this.restarting?w(`backendRestarting`):w(`restartBackendService`)}
|
|
1382
|
+
</button>
|
|
1383
|
+
</div>
|
|
1384
|
+
</div>
|
|
1385
|
+
</section>
|
|
1386
|
+
`}render(){if(this.loading)return _`<div class="text-sm text-muted-foreground">${w(`loading`)}</div>`;let e=this.checking||this.updating||!this.updateInfo?.updateAvailable,t=J();return _`
|
|
1387
|
+
<div class="quickforge-settings-stack">
|
|
1388
|
+
<section class="quickforge-settings-section" aria-label=${w(`projectInfo`)}>
|
|
1389
|
+
${this.infoRows()}
|
|
1390
|
+
</section>
|
|
1391
|
+
|
|
1392
|
+
<section class="quickforge-settings-section" aria-label=${w(t?`desktopUpdates`:`runtimeUpdates`)}>
|
|
1393
|
+
${t?null:_`
|
|
1394
|
+
<div class="quickforge-settings-row">
|
|
1395
|
+
<div class="quickforge-settings-row-main">
|
|
1396
|
+
<div class="quickforge-settings-row-title">
|
|
1397
|
+
${w(`updateFrequencySection`)}
|
|
1398
|
+
<quickforge-info-tip .label=${w(`updateFrequencyDescription`)}></quickforge-info-tip>
|
|
1399
|
+
</div>
|
|
1400
|
+
<div class="quickforge-settings-row-description">
|
|
1401
|
+
${this.lastCheckAt?w(`lastCheckedAt`,{time:new Date(this.lastCheckAt).toLocaleString(ue())}):w(`lastCheckedNever`)}
|
|
1402
|
+
</div>
|
|
1403
|
+
</div>
|
|
1404
|
+
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide">
|
|
1405
|
+
<div class="quickforge-settings-segmented quickforge-settings-segmented-wrap" role="group" aria-label=${w(`updateFrequencySection`)}>
|
|
1406
|
+
${Lt.map(e=>this.renderFrequencyOption(e))}
|
|
1407
|
+
</div>
|
|
1408
|
+
</div>
|
|
1409
|
+
</div>
|
|
1410
|
+
|
|
1411
|
+
${this.updateStatus()}
|
|
1412
|
+
`}
|
|
1413
|
+
|
|
1414
|
+
<div class="quickforge-settings-row">
|
|
1415
|
+
<div class="quickforge-settings-row-main">
|
|
1416
|
+
<div class="quickforge-settings-row-title">
|
|
1417
|
+
${w(t?`desktopUpdates`:`runtimeUpdates`)}
|
|
1418
|
+
<quickforge-info-tip .label=${w(t?`desktopUpdatesDescription`:`runtimeUpdatesDescription`)}></quickforge-info-tip>
|
|
1419
|
+
</div>
|
|
1420
|
+
<div class="quickforge-settings-row-description">
|
|
1421
|
+
${w(t?`desktopUpdatesDescription`:`runtimeUpdatesDescription`)}
|
|
1422
|
+
</div>
|
|
1423
|
+
</div>
|
|
1424
|
+
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide">
|
|
1425
|
+
<button
|
|
1426
|
+
class="quickforge-settings-button quickforge-settings-button-secondary"
|
|
1427
|
+
type="button"
|
|
1428
|
+
?disabled=${this.checking||this.updating}
|
|
1429
|
+
@click=${()=>this.checkUpdate()}
|
|
1430
|
+
>
|
|
1431
|
+
${this.checking?w(`checkingUpdate`):w(t?`openDesktopReleases`:`checkRuntimeUpdate`)}
|
|
1432
|
+
</button>
|
|
1433
|
+
${t?null:_`
|
|
1434
|
+
<button
|
|
1435
|
+
class="quickforge-settings-button quickforge-settings-button-primary"
|
|
1436
|
+
type="button"
|
|
1437
|
+
?disabled=${e}
|
|
1438
|
+
@click=${()=>this.updateQuickForge()}
|
|
1439
|
+
>
|
|
1440
|
+
${this.updating?w(`updatingQuickForge`):w(`updateRuntimeNow`)}
|
|
1441
|
+
</button>
|
|
1442
|
+
`}
|
|
1443
|
+
</div>
|
|
1444
|
+
</div>
|
|
1445
|
+
</section>
|
|
1446
|
+
|
|
1447
|
+
${this.serviceStatus?.isLocalRequest===!1?null:this.restartSection()}
|
|
1448
|
+
|
|
1449
|
+
${this.message?_`<div class="quickforge-settings-message">${this.message}</div>`:null}
|
|
1450
|
+
${this.error?_`<div class="quickforge-settings-alert">${this.error}</div>`:null}
|
|
1451
|
+
</div>
|
|
1452
|
+
`}},zt=`quickforge-about-settings-tab`;customElements.get(zt)||customElements.define(zt,Rt);function Bt(){return document.createElement(zt)}var Vt=class extends v{loading=!0;saving=!1;saved=!1;error=``;message=``;projects=[];project;commandDir=``;commands=[];loadingCommands=!1;saveTimer=null;lastSavedCommandDir=``;pendingSaveAfterCurrent=!1;getTabName(){return w(`projectCommands`)}async connectedCallback(){super.connectedCallback(),await this.loadProjects()}async request(e,t){let n=await fetch(e,{...t,cache:`no-store`,headers:{...t?.body?{"content-type":`application/json`}:void 0,...t?.headers}}),r=await n.json().catch(()=>null);if(!n.ok)throw Error(r?.error||w(`requestFailed`));return r}async loadProjects(){this.loading=!0,this.error=``,this.requestUpdate();try{let e=await this.request(`/api/project`);this.projects=e?.projects??(e?.project?[e.project]:[]),this.project=e?.project??this.projects[0],this.commandDir=typeof this.project?.commandDir==`string`?this.project.commandDir:``,this.lastSavedCommandDir=this.commandDir,await this.loadCommands()}catch(e){this.error=e instanceof Error?e.message:w(`requestFailed`)}finally{this.loading=!1,this.requestUpdate()}}selectProject(e){this.clearSaveTimer();let t=e.target,n=this.projects.find(e=>e.id===t.value);n&&(this.project=n,this.commandDir=typeof n.commandDir==`string`?n.commandDir:``,this.lastSavedCommandDir=this.commandDir,this.saved=!1,this.message=``,this.error=``,this.commands=[],this.requestUpdate(),this.loadCommands())}async loadCommands(){if(this.project?.id){this.loadingCommands=!0,this.requestUpdate();try{let e=await this.request(`/api/project/commands?projectId=${encodeURIComponent(this.project.id)}`);this.commands=e?.commands??[]}catch{this.commands=[]}finally{this.loadingCommands=!1,this.requestUpdate()}}}updateCommandDir(e){this.commandDir=e,this.saved=!1,this.message=``,this.scheduleSave(),this.requestUpdate()}clearSaveTimer(){this.saveTimer!==null&&(window.clearTimeout(this.saveTimer),this.saveTimer=null)}scheduleSave(){this.clearSaveTimer(),this.saveTimer=window.setTimeout(()=>{this.saveTimer=null,this.save()},800)}disconnectedCallback(){this.clearSaveTimer(),super.disconnectedCallback()}async save(){if(!this.project)return;if(this.saving){this.pendingSaveAfterCurrent=!0;return}let e=this.project.id,t=this.commandDir;if(t!==this.lastSavedCommandDir){this.saving=!0,this.saved=!1,this.error=``,this.message=``,this.requestUpdate();try{let n=await this.request(`/api/project/${encodeURIComponent(e)}/command-dir`,{method:`PUT`,body:JSON.stringify({commandDir:t})});if(this.project?.id===e){if(this.project=n?.project??this.project,this.project){let e=this.projects.findIndex(e=>e.id===this.project.id);e>=0&&(this.projects[e]=this.project)}this.commandDir=typeof this.project?.commandDir==`string`?this.project.commandDir:t,this.lastSavedCommandDir=this.commandDir,this.saved=!0,await this.loadCommands()}}catch(e){this.error=e instanceof Error?e.message:w(`requestFailed`)}finally{this.saving=!1,this.pendingSaveAfterCurrent&&(this.pendingSaveAfterCurrent=!1,this.scheduleSave()),this.requestUpdate()}}}async openCommandDir(){if(this.project){this.error=``,this.message=``,this.requestUpdate();try{await this.request(`/api/project/open-path`,{method:`POST`,body:JSON.stringify({path:`.ai/commands`,projectId:this.project.id})})}catch(e){this.error=e instanceof Error?e.message:w(`requestFailed`),this.requestUpdate()}}}async createCommand(){if(!this.project)return;let e=window.prompt(w(`newCommandPrompt`));if(e?.trim()){this.error=``,this.message=``,this.requestUpdate();try{let t=await this.request(`/api/project/command`,{method:`POST`,body:JSON.stringify({name:e.trim(),projectId:this.project.id})});t.ok?(this.message=w(`commandCreated`,{name:t.name??e.trim()}),await this.loadCommands()):t.reason===`exists`?this.error=w(`commandAlreadyExists`,{name:t.name??e.trim()}):this.error=w(`invalidCommandName`)}catch(e){this.error=e instanceof Error?e.message:w(`requestFailed`)}finally{this.requestUpdate()}}}render(){return this.loading?_`<div class="quickforge-settings-note">${w(`loading`)}</div>`:this.projects.length===0?_`
|
|
1453
|
+
<div class="quickforge-settings-stack">
|
|
1454
|
+
<div class="quickforge-settings-note">${w(`selectProjectForCommands`)}</div>
|
|
1455
|
+
${this.error?_`<div class="quickforge-settings-alert">${this.error}</div>`:null}
|
|
1456
|
+
</div>
|
|
1457
|
+
`:_`
|
|
1458
|
+
<div class="quickforge-settings-stack">
|
|
1459
|
+
<section class="quickforge-settings-section" aria-label=${w(`projectCommands`)}>
|
|
1460
|
+
<div class="quickforge-settings-row">
|
|
1461
|
+
<div class="quickforge-settings-row-main">
|
|
1462
|
+
<div class="quickforge-settings-row-title">${w(`project`)}</div>
|
|
1463
|
+
<div class="quickforge-settings-row-description">
|
|
1464
|
+
${this.project?.path?this.project.path:w(`projectCommandsProjectDescription`)}
|
|
1465
|
+
</div>
|
|
1466
|
+
</div>
|
|
1467
|
+
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide">
|
|
1468
|
+
<select
|
|
1469
|
+
class="quickforge-settings-select"
|
|
1470
|
+
.value=${this.project?.id??``}
|
|
1471
|
+
@change=${e=>this.selectProject(e)}
|
|
1472
|
+
>
|
|
1473
|
+
${this.projects.map(e=>_`<option value=${e.id} ?selected=${e.id===this.project?.id}>${e.name}</option>`)}
|
|
1474
|
+
</select>
|
|
1475
|
+
</div>
|
|
1476
|
+
</div>
|
|
1477
|
+
|
|
1478
|
+
<div class="quickforge-settings-row quickforge-settings-row-align-start">
|
|
1479
|
+
<div class="quickforge-settings-row-main">
|
|
1480
|
+
<div class="quickforge-settings-row-title">
|
|
1481
|
+
${w(`commandDirectories`)}
|
|
1482
|
+
<quickforge-info-tip .label=${w(`commandDirectoryHelp`)}></quickforge-info-tip>
|
|
1483
|
+
</div>
|
|
1484
|
+
<div class="quickforge-settings-row-description">${w(`commandDirectoriesDescription`)}</div>
|
|
1485
|
+
</div>
|
|
1486
|
+
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide">
|
|
1487
|
+
<textarea
|
|
1488
|
+
class="quickforge-settings-textarea quickforge-settings-mono"
|
|
1489
|
+
.value=${this.commandDir}
|
|
1490
|
+
placeholder=${w(`commandDirectoryPlaceholder`)}
|
|
1491
|
+
@input=${e=>this.updateCommandDir(e.target.value)}
|
|
1492
|
+
></textarea>
|
|
1493
|
+
</div>
|
|
1494
|
+
</div>
|
|
1495
|
+
|
|
1496
|
+
<div class="quickforge-settings-row quickforge-settings-row-align-start">
|
|
1497
|
+
<div class="quickforge-settings-row-main">
|
|
1498
|
+
<div class="quickforge-settings-row-title">${w(`commandDirectoryExamples`)}</div>
|
|
1499
|
+
<div class="quickforge-settings-row-description">${w(`commandDirectoryExamplesDescription`)}</div>
|
|
1500
|
+
</div>
|
|
1501
|
+
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide quickforge-settings-code-list">
|
|
1502
|
+
<code>.ai/commands</code>
|
|
1503
|
+
<code>.claude/commands</code>
|
|
1504
|
+
<code>.opencode/commands</code>
|
|
1505
|
+
<code>D:\shared\ai-commands</code>
|
|
1506
|
+
</div>
|
|
1507
|
+
</div>
|
|
1508
|
+
</section>
|
|
1509
|
+
|
|
1510
|
+
<section class="quickforge-settings-section" aria-label=${w(`loadedCommands`,{count:this.commands.length})}>
|
|
1511
|
+
<div class="quickforge-settings-row">
|
|
1512
|
+
<div class="quickforge-settings-row-main">
|
|
1513
|
+
<div class="quickforge-settings-row-title">${w(`loadedCommands`,{count:this.commands.length})}</div>
|
|
1514
|
+
<div class="quickforge-settings-row-description">${w(`loadedCommandsDescription`)}</div>
|
|
1515
|
+
</div>
|
|
1516
|
+
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide">
|
|
1517
|
+
<button
|
|
1518
|
+
class="quickforge-settings-button quickforge-settings-button-secondary"
|
|
1519
|
+
type="button"
|
|
1520
|
+
?disabled=${this.loadingCommands}
|
|
1521
|
+
@click=${()=>this.openCommandDir()}
|
|
1522
|
+
>
|
|
1523
|
+
${w(`openCommandDir`)}
|
|
1524
|
+
</button>
|
|
1525
|
+
<button
|
|
1526
|
+
class="quickforge-settings-button quickforge-settings-button-primary"
|
|
1527
|
+
type="button"
|
|
1528
|
+
?disabled=${this.loadingCommands}
|
|
1529
|
+
@click=${()=>this.createCommand()}
|
|
1530
|
+
>
|
|
1531
|
+
${w(`createCommand`)}
|
|
1532
|
+
</button>
|
|
1533
|
+
</div>
|
|
1534
|
+
</div>
|
|
1535
|
+
|
|
1536
|
+
<div class="quickforge-settings-nested-list">
|
|
1537
|
+
${this.loadingCommands?_`<div class="quickforge-settings-empty-row">${w(`loading`)}</div>`:this.commands.length===0?_`<div class="quickforge-settings-empty-row">${w(`noCommandsLoaded`)}</div>`:this.commands.map(e=>{let t=e.argumentHint?` ${e.argumentHint}`:``;return _`
|
|
1538
|
+
<div class="quickforge-settings-subrow">
|
|
1539
|
+
<div class="quickforge-settings-row-main">
|
|
1540
|
+
<div class="quickforge-settings-row-title">
|
|
1541
|
+
<code class="quickforge-settings-command-name">/${e.name}${t}</code>
|
|
1542
|
+
</div>
|
|
1543
|
+
<div class="quickforge-settings-row-description">
|
|
1544
|
+
${e.description||w(`noDescription`)}
|
|
1545
|
+
</div>
|
|
1546
|
+
</div>
|
|
1547
|
+
${e.relativePath?_`<div class="quickforge-settings-row-control quickforge-settings-row-control-wide quickforge-settings-readonly-value">${e.relativePath}</div>`:null}
|
|
1548
|
+
</div>
|
|
1549
|
+
`})}
|
|
1550
|
+
</div>
|
|
1551
|
+
</section>
|
|
1552
|
+
|
|
1553
|
+
${this.saving?_`<div class="quickforge-settings-note">${w(`saving`)}</div>`:null}
|
|
1554
|
+
${this.saved?_`<div class="quickforge-settings-message">${w(`projectCommandsSaved`)}</div>`:null}
|
|
1555
|
+
${this.message?_`<div class="quickforge-settings-message">${this.message}</div>`:null}
|
|
1556
|
+
${this.error?_`<div class="quickforge-settings-alert">${this.error}</div>`:null}
|
|
1557
|
+
</div>
|
|
1558
|
+
`}},Ht=`quickforge-project-commands-settings-tab`;customElements.get(Ht)||customElements.define(Ht,Vt);function Ut(){return document.createElement(Ht)}var Y={"x-quickforge-action":`channel-action`};function Wt(e){switch(e){case`running`:return`quickforge-settings-badge-success`;case`waiting_scan`:case`starting`:case`stopping`:return`quickforge-settings-badge-warning`;case`error`:return`quickforge-settings-badge-danger`;default:return`quickforge-settings-badge-muted`}}function Gt(e){switch(e){case`starting`:return w(`channelStatusStarting`);case`waiting_scan`:return w(`channelStatusWaitingScan`);case`running`:return w(`channelStatusRunning`);case`stopping`:return w(`channelStatusStopping`);case`error`:return w(`channelStatusError`);default:return w(`channelStatusStopped`)}}var Kt=class extends v{loading=!0;channels=[];workspaces=[];selectedWorkspaceIdByChannel={};error=``;message=``;eventSource;busyChannelId=``;openingLogsChannelId=``;getTabName(){return w(`channels`)}async connectedCallback(){super.connectedCallback(),await Promise.all([this.loadChannels(),this.loadWorkspaces()]),this.connectEvents()}disconnectedCallback(){this.eventSource?.close(),this.eventSource=void 0,super.disconnectedCallback()}async request(e,t){let n=await fetch(e,{...t,cache:`no-store`,headers:{...t?.headers||{}}}),r=await n.json().catch(()=>null);if(!n.ok)throw Error(r?.error||w(`requestFailed`));return r}async loadChannels(){this.loading=!0,this.error=``,this.requestUpdate();try{let e=await this.request(`/api/channels`);this.channels=Array.isArray(e.channels)?e.channels:[],this.ensureWorkspaceSelections()}catch(e){this.error=e instanceof Error?e.message:w(`requestFailed`)}finally{this.loading=!1,this.requestUpdate()}}async loadWorkspaces(){try{let e=await this.request(`/api/project`),t=e.defaultWorkspaceRoot||``,n=t?[{id:`default`,name:w(`channelDefaultWorkspace`),path:t,kind:`default`}]:[],r=(Array.isArray(e.projects)?e.projects:[]).map(e=>({id:e.id,name:e.name,path:e.path,kind:`project`}));this.workspaces=[...n,...r],this.ensureWorkspaceSelections()}catch(e){this.error=e instanceof Error?e.message:w(`requestFailed`)}finally{this.requestUpdate()}}ensureWorkspaceSelections(){let e=new Set(this.workspaces.map(e=>e.id)),t={...this.selectedWorkspaceIdByChannel};for(let n of this.channels){if(!n.supportsWorkspaceSelection)continue;let r=t[n.id],i=n.launchWorkspace?.id,a=n.status!==`stopped`&&n.status!==`error`;if(i&&e.has(i)&&a){t[n.id]=i;continue}r&&e.has(r)||(t[n.id]=i&&e.has(i)?i:`default`)}this.selectedWorkspaceIdByChannel=t}connectEvents(){this.eventSource?.close();let e=new EventSource(`/api/channels/events`);this.eventSource=e;let t=e=>{try{let t=JSON.parse(e.data);this.applyChannelEvent(t)}catch{}};e.addEventListener(`snapshot`,t),e.addEventListener(`status`,t),e.addEventListener(`log`,t),e.addEventListener(`qrcode`,t),e.addEventListener(`error`,()=>{})}applyChannelEvent(e){if(Array.isArray(e.channels)){this.channels=e.channels,this.ensureWorkspaceSelections(),this.requestUpdate();return}if(e.snapshot){this.upsertChannel(e.snapshot);return}}upsertChannel(e){let t=this.channels.findIndex(t=>t.id===e.id);t>=0?this.channels=[...this.channels.slice(0,t),e,...this.channels.slice(t+1)]:this.channels=[...this.channels,e],this.ensureWorkspaceSelections(),this.requestUpdate()}selectedWorkspaceId(e){return this.selectedWorkspaceIdByChannel[e.id]||e.launchWorkspace?.id||`default`}handleWorkspaceChange(e,t){let n=t.currentTarget;n&&(this.selectedWorkspaceIdByChannel={...this.selectedWorkspaceIdByChannel,[e.id]:n.value||`default`},this.requestUpdate())}startOptions(e){return e.supportsWorkspaceSelection?{projectId:this.selectedWorkspaceId(e)}:void 0}async invoke(e,t){if(!this.busyChannelId&&!(t===`restart`&&!await T({description:w(`channelRestartConfirm`,{name:e.name}),confirmLabel:w(`restart`),cancelLabel:w(`cancel`)}))){this.busyChannelId=e.id,this.error=``,this.message=``,this.requestUpdate();try{let n=t===`start`||t===`restart`?this.startOptions(e):void 0,r=await this.request(`/api/channels/${encodeURIComponent(e.id)}/${t}`,{method:`POST`,headers:n?{...Y,"content-type":`application/json`}:Y,body:n?JSON.stringify(n):void 0});this.upsertChannel(r)}catch(e){this.error=e instanceof Error?e.message:w(`requestFailed`)}finally{this.busyChannelId=``,this.requestUpdate()}}}async invokeAction(e,t){if(!this.busyChannelId&&!((t.destructive||t.id===`relogin`)&&!await T({description:t.id===`relogin`?w(`channelReloginConfirm`,{name:e.name}):w(`channelLogoutConfirm`,{name:e.name}),confirmLabel:t.label,cancelLabel:w(`cancel`),variant:t.destructive?`destructive`:void 0}))){this.busyChannelId=e.id,this.error=``,this.message=``,this.requestUpdate();try{let n=t.id===`relogin`?this.startOptions(e):void 0,r=await this.request(`/api/channels/${encodeURIComponent(e.id)}/actions/${encodeURIComponent(t.id)}`,{method:`POST`,headers:n?{...Y,"content-type":`application/json`}:Y,body:n?JSON.stringify(n):void 0});this.upsertChannel(r)}catch(e){this.error=e instanceof Error?e.message:w(`requestFailed`)}finally{this.busyChannelId=``,this.requestUpdate()}}}async openLogs(e){if(!this.openingLogsChannelId){this.openingLogsChannelId=e.id,this.error=``,this.message=``,this.requestUpdate();try{await this.request(`/api/channels/${encodeURIComponent(e.id)}/open-logs`,{method:`POST`,headers:Y})}catch(e){this.error=e instanceof Error?e.message:w(`channelOpenLogsFailed`)}finally{this.openingLogsChannelId=``,this.requestUpdate()}}}workspaceSection(e,t){if(!e.supportsWorkspaceSelection)return null;let n=this.selectedWorkspaceId(e);return _`
|
|
1559
|
+
<div class="quickforge-settings-row quickforge-settings-row-align-start">
|
|
1560
|
+
<div class="quickforge-settings-row-main">
|
|
1561
|
+
<div class="quickforge-settings-row-title">
|
|
1562
|
+
${w(`channelWorkspace`)}
|
|
1563
|
+
<quickforge-info-tip .label=${w(`channelWorkspaceDescription`)}></quickforge-info-tip>
|
|
1564
|
+
</div>
|
|
1565
|
+
<div class="quickforge-settings-row-description">${w(`channelWorkspaceDescription`)}</div>
|
|
1566
|
+
</div>
|
|
1567
|
+
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide">
|
|
1568
|
+
<select
|
|
1569
|
+
class="quickforge-settings-select"
|
|
1570
|
+
?disabled=${t}
|
|
1571
|
+
.value=${n}
|
|
1572
|
+
@change=${t=>this.handleWorkspaceChange(e,t)}
|
|
1573
|
+
>
|
|
1574
|
+
${this.workspaces.map(e=>_`
|
|
1575
|
+
<option value=${e.id}>${e.kind===`default`?w(`channelDefaultWorkspace`):e.name}</option>
|
|
1576
|
+
`)}
|
|
1577
|
+
</select>
|
|
1578
|
+
</div>
|
|
1579
|
+
</div>
|
|
1580
|
+
`}qrSection(e){return e.qrCodeText?_`
|
|
1581
|
+
<div class="quickforge-settings-row quickforge-settings-row-align-start">
|
|
1582
|
+
<div class="quickforge-settings-row-main">
|
|
1583
|
+
<div class="quickforge-settings-row-title">
|
|
1584
|
+
${w(`channelQrTitle`)}
|
|
1585
|
+
<quickforge-info-tip .label=${w(`channelQrDescription`)}></quickforge-info-tip>
|
|
1586
|
+
</div>
|
|
1587
|
+
<div class="quickforge-settings-row-description">${w(`channelQrDescription`)}</div>
|
|
1588
|
+
</div>
|
|
1589
|
+
<pre class="quickforge-channel-qr-text">${e.qrCodeText}</pre>
|
|
1590
|
+
</div>
|
|
1591
|
+
`:null}channelCard(e){let t=this.busyChannelId===e.id||!!e.activeAction,n=this.openingLogsChannelId===e.id,r=e.status===`running`||e.status===`waiting_scan`||e.status===`starting`,i=e.status===`stopping`,a=!!(e.supportsWorkspaceSelection&&this.workspaces.length===0);return _`
|
|
1592
|
+
<section class="quickforge-settings-section" aria-label=${e.name}>
|
|
1593
|
+
<div class="quickforge-settings-row quickforge-settings-row-top">
|
|
1594
|
+
<div class="quickforge-settings-row-main">
|
|
1595
|
+
<div class="quickforge-settings-row-title">
|
|
1596
|
+
${e.name}
|
|
1597
|
+
<span class="quickforge-settings-badge ${Wt(e.status)}">${Gt(e.status)}</span>
|
|
1598
|
+
</div>
|
|
1599
|
+
<div class="quickforge-settings-row-description">${e.description}</div>
|
|
1600
|
+
</div>
|
|
1601
|
+
<div class="quickforge-settings-row-control quickforge-settings-row-control-wide">
|
|
1602
|
+
<button class="quickforge-settings-button quickforge-settings-button-primary" type="button" ?disabled=${t||r||i||a} @click=${()=>this.invoke(e,`start`)}>${w(`start`)}</button>
|
|
1603
|
+
<button class="quickforge-settings-button quickforge-settings-button-secondary" type="button" ?disabled=${t||!r||i} @click=${()=>this.invoke(e,`stop`)}>${w(`stop`)}</button>
|
|
1604
|
+
<button class="quickforge-settings-button quickforge-settings-button-secondary" type="button" ?disabled=${t||i||a} @click=${()=>this.invoke(e,`restart`)}>${w(`restart`)}</button>
|
|
1605
|
+
${e.actions?.map(n=>_`
|
|
1606
|
+
<button class="quickforge-settings-button ${n.destructive?`quickforge-settings-button-danger`:`quickforge-settings-button-secondary`}" type="button" ?disabled=${t} @click=${()=>this.invokeAction(e,n)}>${n.label}</button>
|
|
1607
|
+
`)}
|
|
1608
|
+
<button class="quickforge-settings-button quickforge-settings-button-secondary" type="button" ?disabled=${!!this.openingLogsChannelId} @click=${()=>this.openLogs(e)}>${w(n?`channelOpeningLogs`:`channelOpenLogs`)}</button>
|
|
1609
|
+
</div>
|
|
1610
|
+
</div>
|
|
1611
|
+
|
|
1612
|
+
${this.workspaceSection(e,t||r||i)}
|
|
1613
|
+
${a?_`<div class="quickforge-settings-alert quickforge-settings-warning-attached">${w(`channelNoWorkspaces`)}</div>`:null}
|
|
1614
|
+
${e.error?_`<div class="quickforge-settings-alert quickforge-settings-warning-attached">${e.error}</div>`:null}
|
|
1615
|
+
${this.qrSection(e)}
|
|
1616
|
+
</section>
|
|
1617
|
+
`}render(){return this.loading?_`<div class="quickforge-settings-note">${w(`loading`)}</div>`:_`
|
|
1618
|
+
<div class="quickforge-settings-stack">
|
|
1619
|
+
<div class="quickforge-settings-note">
|
|
1620
|
+
${w(`channelsSecurityWarning`)}
|
|
1621
|
+
</div>
|
|
1622
|
+
|
|
1623
|
+
${this.channels.length?_`${this.channels.map(e=>this.channelCard(e))}`:_`<div class="quickforge-settings-note">${w(`channelsEmpty`)}</div>`}
|
|
1624
|
+
|
|
1625
|
+
${this.message?_`<div class="quickforge-settings-message">${this.message}</div>`:null}
|
|
1626
|
+
${this.error?_`<div class="quickforge-settings-alert">${this.error}</div>`:null}
|
|
1627
|
+
</div>
|
|
1628
|
+
`}},qt=`quickforge-channels-settings-tab`;customElements.get(qt)||customElements.define(qt,Kt);function Jt(){return document.createElement(qt)}var Yt=ae(),X=ie(),Xt=(0,j.lazy)(()=>b(()=>import(`./AgentProfilesPage-B84w-r9S.js`).then(e=>({default:e.AgentProfilesPage})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12]))),Zt=(0,j.lazy)(()=>b(()=>import(`./mcp-servers-dialog-GXXD9K0U.js`).then(e=>({default:e.McpServersPanel})),__vite__mapDeps([13,1,2,3,4,5,6,7,8,9,10,11,12]))),Qt=(0,j.lazy)(()=>b(()=>import(`./skills-dialog-DDh1h8eH.js`).then(e=>e.n).then(e=>({default:e.SkillsManagerPanel})),__vite__mapDeps([10,1,2,3,4,5,6,7,8,9,11,12]))),$t=(0,j.lazy)(()=>b(()=>import(`./PluginsPage-D2862wul.js`).then(e=>({default:e.PluginsPage})),__vite__mapDeps([14,1,2,3,4,5,6,7,8,9,10,11,12,15]))),en=(0,j.lazy)(()=>b(()=>import(`./ScheduledTasksPage-GqbiJDPX.js`).then(e=>({default:e.ScheduledTasksPage})),__vite__mapDeps([16,1,2,3,4,5,6,7,8,9,10,11,12]))),tn=class extends v{tabName=``;renderReact;root;getTabName(){return this.tabName}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>this.mountReact())}disconnectedCallback(){this.root?.unmount(),this.root=void 0,super.disconnectedCallback()}render(){return _`<div class="quickforge-react-settings-tab h-full min-h-0"></div>`}mountReact(){let e=this.querySelector(`.quickforge-react-settings-tab`);!e||!this.renderReact||(this.root??=(0,Yt.createRoot)(e),this.root.render(this.renderReact()))}},Z=`quickforge-react-settings-tab`;customElements.get(Z)||customElements.define(Z,tn);function Q(e,t){let n=document.createElement(Z);return n.tabName=e,n.renderReact=t,n}function $({children:e}){return(0,X.jsx)(`div`,{className:`quickforge-settings-stack h-full min-h-[30rem]`,children:(0,X.jsx)(j.Suspense,{fallback:(0,X.jsx)(`div`,{className:`quickforge-settings-note`,children:w(`loading`)}),children:e})})}function nn(e){window.dispatchEvent(new CustomEvent(`quickforge:open-session-from-settings`,{detail:{sessionId:e}}))}function rn(){return Q(w(`agentsTab`),()=>(0,X.jsx)($,{children:(0,X.jsx)(Xt,{})}))}function an(){return Q(w(`skills`),()=>(0,X.jsx)($,{children:(0,X.jsx)(Qt,{active:!0,scope:`global`,embedded:!0,onSaved:()=>void 0})}))}function on(){return Q(w(`mcpServers`),()=>(0,X.jsx)($,{children:(0,X.jsx)(Zt,{active:!0})}))}function sn(){return Q(w(`plugins`),()=>(0,X.jsx)($,{children:(0,X.jsx)($t,{})}))}function cn(){return Q(w(`scheduledTasks`),()=>(0,X.jsx)($,{children:(0,X.jsx)(en,{onOpenSession:nn})}))}function ln(e){let t=[{key:`appearance`,tab:Ve(),getDescription:()=>w(`appearanceDescription`)},{key:`defaults`,tab:at(),getDescription:()=>w(`defaultOptionsDescription`)},{key:`memory`,tab:ft(),getDescription:()=>w(`memoryDescription`)},{key:`customModels`,tab:Re(e),getDescription:()=>w(`customModelsDescription`)},{key:`agents`,tab:rn(),getDescription:()=>w(`agentsDescription`)},{key:`skills`,tab:an(),getDescription:()=>w(`globalSkillsDescription`)},{key:`mcp`,tab:on(),getDescription:void 0},{key:`plugins`,tab:sn(),getDescription:()=>w(`pluginsDescription`)},{key:`scheduledTasks`,tab:cn(),getDescription:()=>w(`scheduledTasksDescription`)},{key:`projectCommands`,tab:Ut(),getDescription:()=>w(`projectCommandsDescription`)},{key:`backup`,tab:St(),getDescription:()=>w(`backupRestoreDescription`)},{key:`archivedConversations`,tab:Et(),getDescription:()=>w(`archivedConversationsDescription`)},{key:`channels`,tab:Jt(),getDescription:()=>w(`channelsDescription`)},{key:`lanAccess`,tab:jt(),getDescription:()=>w(`lanAccessDescription`)},{key:`about`,tab:Bt(),getDescription:()=>w(`aboutQuickForgeDescription`)}];return{items:[...t],tabs:t.map(e=>e.tab),indexOf:e=>t.findIndex(t=>t.key===e)}}var un={appearance:t,defaults:re,memory:i,customModels:h,agents:r,skills:c,mcp:ne,plugins:g,scheduledTasks:u,projectCommands:m,backup:f,archivedConversations:l,channels:d,lanAccess:p,about:a};function dn({tab:e}){let t=(0,j.useRef)(null);return(0,j.useEffect)(()=>{let n=t.current;if(n)return n.replaceChildren(e),()=>{e.parentNode===n&&n.removeChild(e)}},[e]),(0,X.jsx)(`div`,{ref:t,className:`quickforge-settings-tab-host min-h-0 flex-1`})}function fn({initialTab:e,customProvider:t,onBack:r}){let i=(0,j.useMemo)(()=>ln(t),[t]),a=Math.max(0,i.indexOf(e)),[o,c]=(0,j.useState)(),[l,u]=(0,j.useState)(null),d=o??a,[f,ne]=(0,j.useState)(``),p=f.trim().toLowerCase(),m=(0,j.useMemo)(()=>i.items.map((e,t)=>({item:e,index:t})).filter(({item:e})=>p?[e.key,e.tab.getTabName(),e.getDescription?.()??``].join(` `).toLowerCase().includes(p):!0),[i.items,p]),h=(0,j.useMemo)(()=>{if(!p)return d;let e=m[0];return e?m.some(({index:e})=>e===d)?d:e.index:d},[d,m,p]),g=i.items[h]??i.items[0],ie=g?.getDescription?.(),ae=g?un[g.key]:void 0,_=(0,j.useRef)(null),[v,y]=(0,j.useState)(!1);return(0,j.useEffect)(()=>{_.current?.scrollTo({top:0})},[h,l]),(0,X.jsxs)(`div`,{className:`flex h-screen min-h-0 supports-[height:100dvh]:h-dvh bg-[var(--quickforge-sidebar-bg)] text-foreground`,children:[(0,X.jsxs)(`aside`,{className:`relative z-10 hidden w-80 shrink-0 overflow-hidden bg-[var(--quickforge-sidebar-bg)] md:flex md:min-h-0 md:flex-col`,children:[(0,X.jsxs)(`div`,{className:`shrink-0 px-3 pb-2 pt-3`,children:[(0,X.jsxs)(`button`,{type:`button`,className:`group relative flex w-full items-center gap-2 overflow-hidden rounded-lg px-2 py-1.5 text-left text-muted-foreground/72 transition-[background-color,color,box-shadow] duration-160 ease-out hover:bg-[var(--quickforge-sidebar-hover-bg)] hover:text-foreground/86 hover:shadow-[0_8px_20px_-18px_rgb(15_23_42_/_0.35)]`,onClick:r,"aria-label":`返回工作区`,children:[(0,X.jsx)(`span`,{className:`inline-flex size-6 shrink-0 items-center justify-center rounded-full text-muted-foreground/55 transition-colors group-hover:text-foreground/70`,children:(0,X.jsx)(s,{className:`size-4`})}),(0,X.jsx)(`span`,{className:`truncate text-sm leading-5`,children:`返回工作区`})]}),(0,X.jsxs)(`div`,{className:`quickforge-settings-inline-field mt-3`,children:[(0,X.jsx)(ee,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground/60`,"aria-hidden":`true`}),(0,X.jsx)(`input`,{value:f,onChange:e=>ne(e.target.value),placeholder:w(`searchSettings`),"aria-label":w(`searchSettings`),className:`quickforge-settings-input`})]})]}),(0,X.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-3 pb-4 pt-4`,children:(0,X.jsxs)(`nav`,{className:`space-y-1`,"aria-label":w(`settings`),children:[m.map(({item:e,index:t})=>{let n=t===h,r=un[e.key];return(0,X.jsxs)(`button`,{type:`button`,className:E(`group relative flex w-full items-center gap-2.5 overflow-hidden rounded-lg px-2 py-1.5 text-left text-sm leading-5 transition-[background-color,color,box-shadow] duration-160 ease-out`,n?`bg-[var(--quickforge-sidebar-active-bg)] font-medium text-foreground/92 shadow-[0_8px_22px_-20px_rgb(15_23_42_/_0.32)]`:`text-muted-foreground/76 hover:bg-[var(--quickforge-sidebar-hover-bg)] hover:text-foreground/90 hover:shadow-[0_8px_20px_-18px_rgb(15_23_42_/_0.35)]`),onClick:()=>c(t),"aria-current":n?`page`:void 0,children:[(0,X.jsx)(`span`,{className:E(`inline-flex size-5 shrink-0 items-center justify-center transition-colors`,n?`text-foreground/72`:`text-muted-foreground/52 group-hover:text-foreground/68`),children:(0,X.jsx)(r,{className:`size-4`,"aria-hidden":`true`})}),(0,X.jsx)(`span`,{className:`truncate`,children:e.tab.getTabName()})]},e.key)}),m.length===0?(0,X.jsx)(`div`,{className:`px-2 py-3 text-sm text-muted-foreground/70`,children:w(`noSettingsResults`)}):null]})})]}),(0,X.jsxs)(`main`,{className:`relative flex min-w-0 flex-1 flex-col bg-[var(--quickforge-main-bg)] md:overflow-hidden md:rounded-tl-2xl`,children:[(0,X.jsxs)(`header`,{className:`flex h-14 shrink-0 items-center gap-2 border-b-[0.5px] border-[color-mix(in_oklab,var(--border)_34%,transparent)] px-3 pr-4 md:px-5`,children:[(0,X.jsx)(Te,{variant:`ghost`,size:`icon`,className:`md:hidden`,onClick:l===null?r:()=>u(null),"aria-label":l===null?`返回工作区`:`返回设置`,children:(0,X.jsx)(s,{className:`size-4`})}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`div`,{className:E(`flex min-w-0 items-center gap-2`,l===null?`md:hidden`:`hidden`),children:[(0,X.jsx)(re,{className:`size-4 shrink-0 text-muted-foreground/65`,"aria-hidden":`true`}),(0,X.jsx)(`div`,{className:`min-w-0 truncate text-sm font-medium text-foreground/90`,children:w(`settings`)})]}),(0,X.jsxs)(`div`,{className:E(`flex min-w-0 items-center gap-2`,l===null&&`hidden md:flex`),children:[ae?(0,X.jsx)(ae,{className:`size-4 shrink-0 text-muted-foreground/65`,"aria-hidden":`true`}):null,(0,X.jsx)(`div`,{className:`min-w-0 truncate text-sm font-medium text-foreground/90`,children:g?.tab.getTabName()}),ie?(0,X.jsx)(De,{label:ie}):null]})]})]}),(0,X.jsxs)(`div`,{className:E(`flex min-h-0 flex-1 flex-col md:hidden`,l!==null&&`hidden`),children:[(0,X.jsx)(`div`,{className:`shrink-0 border-b-[0.5px] border-[color-mix(in_oklab,var(--border)_30%,transparent)] px-3 py-2`,children:(0,X.jsxs)(`div`,{className:`quickforge-settings-inline-field`,children:[(0,X.jsx)(ee,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground/60`,"aria-hidden":`true`}),(0,X.jsx)(`input`,{value:f,onChange:e=>ne(e.target.value),placeholder:w(`searchSettings`),"aria-label":w(`searchSettings`),className:`quickforge-settings-input`})]})}),(0,X.jsx)(`nav`,{className:`quickforge-settings-mobile-list`,"aria-label":w(`settings`),children:(0,X.jsxs)(`div`,{className:`quickforge-settings-mobile-list-card`,children:[m.map(({item:e,index:t})=>{let n=un[e.key];return(0,X.jsxs)(`button`,{type:`button`,className:`quickforge-settings-mobile-list-item`,onClick:()=>{c(t),u(t)},children:[(0,X.jsx)(`span`,{className:`quickforge-settings-mobile-list-icon`,children:(0,X.jsx)(n,{className:`size-4 shrink-0`,"aria-hidden":`true`})}),(0,X.jsx)(`span`,{className:`quickforge-settings-mobile-list-label`,children:e.tab.getTabName()}),(0,X.jsx)(te,{className:`quickforge-settings-mobile-list-chevron size-4 shrink-0`,"aria-hidden":`true`})]},e.key)}),m.length===0?(0,X.jsx)(`div`,{className:`px-2 py-8 text-center text-sm text-muted-foreground/70`,children:w(`noSettingsResults`)}):null]})})]}),(0,X.jsx)(`section`,{ref:_,onScroll:()=>y((_.current?.scrollTop??0)>160),className:E(`min-h-0 flex-1 overflow-y-auto px-4 py-5 md:px-8 md:py-7`,l===null&&`hidden md:block`),children:(0,X.jsx)(`div`,{className:`mx-auto flex min-h-full w-full max-w-5xl flex-col`,children:m.length===0?(0,X.jsx)(`div`,{className:`rounded-xl border border-dashed border-[color-mix(in_oklab,var(--border)_70%,transparent)] p-8 text-center text-sm text-muted-foreground/70`,children:w(`noSettingsResults`)}):g?(0,X.jsx)(dn,{tab:g.tab}):null})}),(0,X.jsx)(`button`,{type:`button`,onClick:()=>_.current?.scrollTo({top:0,behavior:`smooth`}),"aria-label":`返回顶部`,className:E(`absolute bottom-5 right-4 z-20 flex size-9 items-center justify-center rounded-[10px] border-[0.5px] border-[color-mix(in_oklab,var(--border)_65%,transparent)] bg-[var(--background)] text-muted-foreground/85 shadow-[0_10px_24px_-16px_rgb(15_23_42_/_0.55)] transition-opacity duration-160 md:hidden`,v?`opacity-100`:`pointer-events-none opacity-0`,l===null&&`hidden`),children:(0,X.jsx)(n,{className:`size-4`})})]})]})}export{fn as SettingsWorkspacePage};
|