farming-code 2.2.6
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/LICENSE +21 -0
- package/README.md +287 -0
- package/README.zh_cn.md +329 -0
- package/SECURITY.md +29 -0
- package/THIRD_PARTY_NOTICES.md +106 -0
- package/backend/acp/client-services.js +312 -0
- package/backend/acp/patch-decisions.js +137 -0
- package/backend/acp/permission-security.js +108 -0
- package/backend/acp-runtime.js +1144 -0
- package/backend/acp-session-state.js +448 -0
- package/backend/acp-transcript.js +169 -0
- package/backend/agent-activity.js +186 -0
- package/backend/agent-env.js +250 -0
- package/backend/agent-json-stream.js +268 -0
- package/backend/agent-manager.js +4259 -0
- package/backend/agent-memory-report.js +583 -0
- package/backend/agent-order.js +162 -0
- package/backend/agent-provider-session.js +287 -0
- package/backend/agent-session-history.js +888 -0
- package/backend/app-server-api.js +917 -0
- package/backend/async-cache.js +94 -0
- package/backend/auth.js +178 -0
- package/backend/claude-settings.js +121 -0
- package/backend/cli-agents.js +484 -0
- package/backend/codex-app-server-home.js +39 -0
- package/backend/codex-app-server-runtime.js +901 -0
- package/backend/codex-context-window.js +189 -0
- package/backend/codex-models.js +229 -0
- package/backend/codex-rollout-follower.js +243 -0
- package/backend/codex-session-history.js +553 -0
- package/backend/codex-transcript-sanitizer.js +103 -0
- package/backend/codex-transcript.js +2341 -0
- package/backend/command-runner-child.js +67 -0
- package/backend/config-manager.js +815 -0
- package/backend/control-api.js +151 -0
- package/backend/data/chinese-poetic-words.json +8223 -0
- package/backend/data/poetic-word-sources/china.json +49209 -0
- package/backend/data/poetic-word-sources/india.json +9763 -0
- package/backend/data/poetic-word-sources/japan.json +8455 -0
- package/backend/executable-discovery.js +207 -0
- package/backend/farming-app-cli.js +790 -0
- package/backend/farming-cli.js +400 -0
- package/backend/farming-session-store.js +373 -0
- package/backend/haiku-token.js +772 -0
- package/backend/index-html.js +49 -0
- package/backend/input-parts.js +54 -0
- package/backend/input-routing.js +24 -0
- package/backend/json-cli-runtime.js +161 -0
- package/backend/local-session-engine.js +620 -0
- package/backend/main-agent-skills.js +292 -0
- package/backend/main-page-session.js +119 -0
- package/backend/native-pty-host-client.js +516 -0
- package/backend/native-pty-host-path.js +22 -0
- package/backend/native-pty-host.js +816 -0
- package/backend/native-session-engine.js +196 -0
- package/backend/network.js +23 -0
- package/backend/npm-update-helper.js +196 -0
- package/backend/packaged-node-pty.js +79 -0
- package/backend/provider-session-id.js +47 -0
- package/backend/qr-share-tickets.js +100 -0
- package/backend/review-diff-router.js +180 -0
- package/backend/review-diff-service.js +1270 -0
- package/backend/review-session-router.js +74 -0
- package/backend/review-session-service.js +432 -0
- package/backend/review-session-store.js +144 -0
- package/backend/review-state-router.js +116 -0
- package/backend/review-state-store.js +287 -0
- package/backend/run-history-store.js +70 -0
- package/backend/server.js +2446 -0
- package/backend/session-engine-bridge.js +110 -0
- package/backend/session-engine-router.js +66 -0
- package/backend/session-engine.js +39 -0
- package/backend/shell-busy-integration.js +472 -0
- package/backend/slash-command-discovery.js +296 -0
- package/backend/storage-layout.js +101 -0
- package/backend/system-monitor.js +77 -0
- package/backend/terminal-runtime-cleanup.js +80 -0
- package/backend/terminal-screen-state.js +240 -0
- package/backend/terminal-screen-worker-pool.js +165 -0
- package/backend/terminal-screen-worker-thread.js +161 -0
- package/backend/terminal-screen-worker.js +255 -0
- package/backend/terminal-status.js +356 -0
- package/backend/theme-manager.js +145 -0
- package/backend/update-service.js +1183 -0
- package/backend/usage-forecast.js +86 -0
- package/backend/usage-monitor.js +1357 -0
- package/backend/workspace-discovery.js +311 -0
- package/backend/workspace-file-router.js +431 -0
- package/backend/workspace-file-service.js +2765 -0
- package/bin/farming +5 -0
- package/config/farming.deploy.env.example +13 -0
- package/config/farming.install.env.example +17 -0
- package/dist/assets/App-BrP-ENHg.css +1 -0
- package/dist/assets/App-Dza5yEDe.js +124 -0
- package/dist/assets/FileEditorMarkdownPreview-DRDNQ8mX.css +1 -0
- package/dist/assets/FileEditorMarkdownPreview-elKWc8Im.js +404 -0
- package/dist/assets/FileEditorPane-BQLocXOp.js +5 -0
- package/dist/assets/IconGlyphs-RkMAdBXF.js +1 -0
- package/dist/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- package/dist/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- package/dist/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- package/dist/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- package/dist/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- package/dist/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- package/dist/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- package/dist/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- package/dist/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- package/dist/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- package/dist/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- package/dist/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- package/dist/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- package/dist/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- package/dist/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- package/dist/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- package/dist/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- package/dist/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- package/dist/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- package/dist/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- package/dist/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- package/dist/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- package/dist/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- package/dist/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- package/dist/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- package/dist/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- package/dist/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- package/dist/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- package/dist/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- package/dist/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- package/dist/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- package/dist/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- package/dist/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- package/dist/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- package/dist/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- package/dist/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- package/dist/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- package/dist/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- package/dist/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- package/dist/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- package/dist/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- package/dist/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- package/dist/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- package/dist/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- package/dist/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- package/dist/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- package/dist/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- package/dist/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- package/dist/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- package/dist/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- package/dist/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- package/dist/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- package/dist/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- package/dist/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- package/dist/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- package/dist/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- package/dist/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- package/dist/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- package/dist/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- package/dist/assets/ProjectFilesSection-lS1azbgj.js +12 -0
- package/dist/assets/ReviewPage-DgnmgU2T.js +3 -0
- package/dist/assets/abap-Cc5D5h5i.js +1 -0
- package/dist/assets/abnfDiagram-VRR7QNED-BgawzDQT.js +1 -0
- package/dist/assets/apex-BKopwLmx.js +1 -0
- package/dist/assets/api-D1lyBYIQ.js +1 -0
- package/dist/assets/arc-CWoVlxJw.js +1 -0
- package/dist/assets/architecture-TIHT7OUA-CbJBFh3w.js +1 -0
- package/dist/assets/architectureDiagram-ZJ3FMSHR-DUShwPg0.js +36 -0
- package/dist/assets/array-HeX70jSN.js +1 -0
- package/dist/assets/azcli-DI-C34WA.js +1 -0
- package/dist/assets/bat-Cbp6u42z.js +1 -0
- package/dist/assets/bicep-4QA1jTCM.js +2 -0
- package/dist/assets/blockDiagram-677ZJIJ3-CeGZviXR.js +132 -0
- package/dist/assets/c4Diagram-LMCZKHZV-CLhYht6S.js +10 -0
- package/dist/assets/cameligo-Dda_adPs.js +1 -0
- package/dist/assets/channel-Uw90AO0b.js +1 -0
- package/dist/assets/chunk-2Q5K7J3B-d5WWh8jo.js +1 -0
- package/dist/assets/chunk-32BRIVSS-LFYpT-Cu.js +1 -0
- package/dist/assets/chunk-52WLFC77-BH6jDw9J.js +10 -0
- package/dist/assets/chunk-5FCAYU7R-C7AmIhYv.js +1 -0
- package/dist/assets/chunk-5HE753X5-C8cXaouP.js +1 -0
- package/dist/assets/chunk-5JV3BV7I-C1PtimcA.js +1 -0
- package/dist/assets/chunk-5TONJI2A-_81zUME8.js +2 -0
- package/dist/assets/chunk-5VM5RSS4-Dlw7AXWp.js +15 -0
- package/dist/assets/chunk-7BUUIJ7U-ZBRhjLOh.js +1 -0
- package/dist/assets/chunk-BIQX33UG-CWmzxeAw.js +1 -0
- package/dist/assets/chunk-C7G6YPKG-B_mIUlb7.js +1 -0
- package/dist/assets/chunk-CQNSW5MT-CMayolwI.js +1 -0
- package/dist/assets/chunk-CYSBUYHQ-lSPbrL3Z.js +1 -0
- package/dist/assets/chunk-DECur_0Z.js +1 -0
- package/dist/assets/chunk-EMLP6XTP-D9-jtCnM.js +1 -0
- package/dist/assets/chunk-EX3LRPZG-C63hVuAJ.js +231 -0
- package/dist/assets/chunk-FWX5IMBZ-CboX-WF_.js +2 -0
- package/dist/assets/chunk-HOUHSVGY-BOgSd6Un.js +1 -0
- package/dist/assets/chunk-ICXQ74PX-C0K-pgZt.js +2 -0
- package/dist/assets/chunk-JG7HCLWE-Cib606u_.js +2 -0
- package/dist/assets/chunk-JWPE2WC7-DSyBRaRG.js +1 -0
- package/dist/assets/chunk-KEIR6QF5-CNOHik0T.js +161 -0
- package/dist/assets/chunk-MOJQB5TN-CVMfwN_7.js +88 -0
- package/dist/assets/chunk-MOZMSUNE-D6JeZqmE.js +1 -0
- package/dist/assets/chunk-OGEWGWER-DLT3pxyw.js +1 -0
- package/dist/assets/chunk-OSBZ3O6U-C0W8KSeg.js +1 -0
- package/dist/assets/chunk-PUDLZKDR-Cd079yIQ.js +156 -0
- package/dist/assets/chunk-Q4XR5HBZ-D0jHa6SO.js +70 -0
- package/dist/assets/chunk-QBLGF6JB-p4omp7uO.js +1 -0
- package/dist/assets/chunk-R7FJI6CG-CZ_p9hSr.js +1 -0
- package/dist/assets/chunk-RYQCIY6F-CZA9pvFX.js +1 -0
- package/dist/assets/chunk-U6XO7XAA-CcXKsWxp.js +2 -0
- package/dist/assets/chunk-V7JOEXUC-CVDtR75H.js +206 -0
- package/dist/assets/chunk-VAUOI2AC-B-W2_9Ot.js +1 -0
- package/dist/assets/chunk-VR4S4FIN-FD3kWh32.js +1 -0
- package/dist/assets/chunk-WYO6CB5R-C2bGaS5r.js +127 -0
- package/dist/assets/chunk-XXDRQBXY-BBXwjhUx.js +1 -0
- package/dist/assets/chunk-Y2CYZVJY-Di0sYzi1.js +1 -0
- package/dist/assets/chunk-YOTPTUD7-BXHmEk89.js +1 -0
- package/dist/assets/chunk-ZGVPDNZ5-ymgts0zo.js +62 -0
- package/dist/assets/chunk-ZIRB5QZD-DncwlQQc.js +32 -0
- package/dist/assets/classDiagram-OUVF2IWQ-DKW_dtku.js +1 -0
- package/dist/assets/classDiagram-v2-EOCWNBFH-C8Fi7-yv.js +1 -0
- package/dist/assets/clojure-CvY8A83L.js +1 -0
- package/dist/assets/code-dark-Cjb1QGhu.css +1 -0
- package/dist/assets/code-mobile-3C2Rr-CN.css +1 -0
- package/dist/assets/codicon-ngg6Pgfi.ttf +0 -0
- package/dist/assets/coffee-4LX2Sv8A.js +1 -0
- package/dist/assets/core-ZlAPicox.js +3 -0
- package/dist/assets/cose-bilkent-JH36ORCC-BNIAz0nN.js +1 -0
- package/dist/assets/cpp-D4AzSV28.js +1 -0
- package/dist/assets/csharp-C4nWN4Yd.js +1 -0
- package/dist/assets/csp-CiEaaS5Z.js +1 -0
- package/dist/assets/css-DXxBRsbk.js +3 -0
- package/dist/assets/css.worker-DyDu5ynT.js +89 -0
- package/dist/assets/cssMode-DDWxTPm_.js +1 -0
- package/dist/assets/cynefin-VYW2F7L2-DgXGHlRt.js +1 -0
- package/dist/assets/cynefinDiagram-TSTJHNR4-CwpobXIl.js +62 -0
- package/dist/assets/cypher-DOMzqyFA.js +1 -0
- package/dist/assets/cytoscape.esm-Cl8iC3D7.js +321 -0
- package/dist/assets/dagre-DXlcHgr3.js +1 -0
- package/dist/assets/dagre-VKFMJZFB-Dkhlfjna.js +4 -0
- package/dist/assets/dart-BWS7MXt_.js +1 -0
- package/dist/assets/defaultLocale-GJwWH1Jr.js +1 -0
- package/dist/assets/diagram-FQU43EPY-hA8dicp6.js +3 -0
- package/dist/assets/diagram-G47NLZAW-BTY6JTzO.js +24 -0
- package/dist/assets/diagram-NH7WQ7WH-xkaHHX9M.js +24 -0
- package/dist/assets/diagram-OA4YK3LP-gk_fg9UU.js +30 -0
- package/dist/assets/diagram-WEI45ONY-BvC8xd6T.js +41 -0
- package/dist/assets/dist-ClAL-Tv5.js +1 -0
- package/dist/assets/dockerfile-Baf4U3xT.js +1 -0
- package/dist/assets/ebnfDiagram-CCIWWBDH-CR7RaNat.js +1 -0
- package/dist/assets/ecl-CT7udlkQ.js +1 -0
- package/dist/assets/editor-CtbFZlk0.css +1 -0
- package/dist/assets/editor.api2-B9h6iFPK.js +872 -0
- package/dist/assets/editor.worker-Dpt_xPrs.js +26 -0
- package/dist/assets/elixir-CIbAZw5l.js +1 -0
- package/dist/assets/erDiagram-Q63AITRT-_M-JFPbj.js +85 -0
- package/dist/assets/eventmodeling-45OFAUF4-DXYTQ2nt.js +1 -0
- package/dist/assets/file-icons-EFUGSSwf.js +1 -0
- package/dist/assets/flow9-Dqiw45WV.js +1 -0
- package/dist/assets/flowDiagram-23GEKE2U-DAiS5Y7G.js +1 -0
- package/dist/assets/freemarker2-QBsTERH-.js +3 -0
- package/dist/assets/fsharp-E8E2L9jU.js +1 -0
- package/dist/assets/ganttDiagram-NO4QXBWP-Bl8P1yf_.js +292 -0
- package/dist/assets/gitGraph-TEB2WS4Q-CzTBjEvV.js +1 -0
- package/dist/assets/gitGraphDiagram-IHSO6WYX-DoHa5ysz.js +106 -0
- package/dist/assets/go-CouVSN4D.js +1 -0
- package/dist/assets/graphlib-CbSvZcZU.js +1 -0
- package/dist/assets/graphql-a6h6h5-t.js +1 -0
- package/dist/assets/handlebars-CuoxPo5A.js +1 -0
- package/dist/assets/hcl-vso3e6N-.js +1 -0
- package/dist/assets/html-gX5PEu0Q.js +1 -0
- package/dist/assets/html.worker-IWNXhnIC.js +502 -0
- package/dist/assets/htmlMode-DIWUbUxd.js +1 -0
- package/dist/assets/index-BpHPeJf0.js +10 -0
- package/dist/assets/info-DKCQHKI2-DznP7j3s.js +1 -0
- package/dist/assets/infoDiagram-FWYZ7A6U-DSFcSuUs.js +2 -0
- package/dist/assets/ini-SwZZkotR.js +1 -0
- package/dist/assets/init-BPLPMQ3Y.js +1 -0
- package/dist/assets/ishikawaDiagram-FXEZZL3T-DdkqullI.js +70 -0
- package/dist/assets/java-CtRLC4_3.js +1 -0
- package/dist/assets/javascript-BYKGIUGs.js +1 -0
- package/dist/assets/journeyDiagram-5HDEW3XC-B4hRnQJr.js +139 -0
- package/dist/assets/json.worker-c4h5s80L.js +58 -0
- package/dist/assets/jsonMode-AFmQQP6u.js +7 -0
- package/dist/assets/jsx-runtime-BthL93pI.js +1 -0
- package/dist/assets/julia-CuJWFKQH.js +1 -0
- package/dist/assets/kanban-definition-HUTT4EX6-tm2FZB2E.js +89 -0
- package/dist/assets/katex-C8DPyI6s.js +257 -0
- package/dist/assets/kotlin-B_kBhsre.js +1 -0
- package/dist/assets/less-CtrHIfz3.js +2 -0
- package/dist/assets/lexon-yVt1pJLu.js +1 -0
- package/dist/assets/line-CmsjK4kn.js +1 -0
- package/dist/assets/linear-Dld3_ERu.js +1 -0
- package/dist/assets/liquid-DBIl-f0z.js +1 -0
- package/dist/assets/lspLanguageFeatures-DK6tqicV.js +4 -0
- package/dist/assets/lua-prOwgJ4U.js +1 -0
- package/dist/assets/m3-DhrdTQ84.js +1 -0
- package/dist/assets/main-DTJwH51M.css +1 -0
- package/dist/assets/map-LZWWoeWa.js +1 -0
- package/dist/assets/markdown-DoI5HwSM.js +1 -0
- package/dist/assets/mdx-DS-bVtZN.js +1 -0
- package/dist/assets/mermaid-parser.core-BQtepoLd.js +4 -0
- package/dist/assets/mermaid.core-C7UT_EEL.js +11 -0
- package/dist/assets/mindmap-definition-LN4V7U3C-DplfjGms.js +96 -0
- package/dist/assets/mips-Dye5jsBU.js +1 -0
- package/dist/assets/monaco.contribution-CyLosfZI.js +2 -0
- package/dist/assets/msdax-TkNOyIL8.js +1 -0
- package/dist/assets/mysql-CEc-RKZF.js +1 -0
- package/dist/assets/objective-c-CqqCsQz0.js +1 -0
- package/dist/assets/ordinal-BLrOss5K.js +1 -0
- package/dist/assets/packet-7NZHBO7P-BDEPOPha.js +1 -0
- package/dist/assets/pascal-DO_pj8yg.js +1 -0
- package/dist/assets/pascaligo-1cbdZdF3.js +1 -0
- package/dist/assets/path-YdFzr2W6.js +1 -0
- package/dist/assets/pegDiagram-2B236MQR-lu3SdkQs.js +1 -0
- package/dist/assets/perl-B_N3PYfC.js +1 -0
- package/dist/assets/pgsql-9iYk1FQ7.js +1 -0
- package/dist/assets/php-rO2sgoUM.js +1 -0
- package/dist/assets/pie-RZYD4A2V-DWIrwPJQ.js +1 -0
- package/dist/assets/pieDiagram-ENE6RG2P-3fHbmDf9.js +39 -0
- package/dist/assets/pla-Cbgv60kq.js +1 -0
- package/dist/assets/postiats-y6xrhy_M.js +1 -0
- package/dist/assets/powerquery-BaD8gWNE.js +1 -0
- package/dist/assets/powershell-BMhG4JVe.js +1 -0
- package/dist/assets/preload-helper-mJowh_hw.js +1 -0
- package/dist/assets/protobuf-CdOP5kN3.js +2 -0
- package/dist/assets/pug-Ck60hNF9.js +1 -0
- package/dist/assets/python-C93q3xXz.js +1 -0
- package/dist/assets/qoder-C9LmmOSf.svg +1 -0
- package/dist/assets/qoder-Cf9gl0Y5.svg +1 -0
- package/dist/assets/qoder-gHCinseV.svg +1 -0
- package/dist/assets/qrcode-DV-_rjU8.js +3 -0
- package/dist/assets/qsharp-BcaKFfP-.js +1 -0
- package/dist/assets/quadrantDiagram-ABIIQ3AL-a5qoWz-X.js +7 -0
- package/dist/assets/r-rFNes0iK.js +1 -0
- package/dist/assets/radar-I7S5WNFK-B7OaD8vp.js +1 -0
- package/dist/assets/railroad-3IZDKUUU-BXW2nuCA.js +1 -0
- package/dist/assets/railroad-abnf-AHOZXSZD-Buw9QG2r.js +1 -0
- package/dist/assets/railroad-ebnf-EBAXGLYW-BjSi4sWJ.js +1 -0
- package/dist/assets/railroad-peg-LSFZ7HO6-DN1wIVhS.js +1 -0
- package/dist/assets/railroadDiagram-RFXS5EU6-D2TOuXW9.js +1 -0
- package/dist/assets/razor-CBifNGXO.js +1 -0
- package/dist/assets/react-dom-gtU6X-Hj.js +1 -0
- package/dist/assets/redis-DkpQ3K6G.js +1 -0
- package/dist/assets/redshift-Di9N5TI3.js +1 -0
- package/dist/assets/requirementDiagram-TGXJPOKE-LQBWpUvd.js +84 -0
- package/dist/assets/restructuredtext-By5ZzLt6.js +1 -0
- package/dist/assets/review-BcnwQtJv.css +1 -0
- package/dist/assets/rough.esm-c4PR5shF.js +1 -0
- package/dist/assets/ruby-fF5zGiLp.js +1 -0
- package/dist/assets/rust-C5b3AYY6.js +1 -0
- package/dist/assets/sankeyDiagram-HTMAVEWB-B1ohYoyK.js +40 -0
- package/dist/assets/sb-CD07UNRs.js +1 -0
- package/dist/assets/scala-jtn1ip9G.js +1 -0
- package/dist/assets/scheme-C4vqMkn_.js +1 -0
- package/dist/assets/scss-I4Glxjbz.js +3 -0
- package/dist/assets/sequenceDiagram-DBY2YBRQ-C3vM-hMq.js +162 -0
- package/dist/assets/shell-DubUcuns.js +1 -0
- package/dist/assets/sizeCapture-X5ZJPWSS-daTB6OcF.js +1 -0
- package/dist/assets/solidity-CNy2KSl2.js +1 -0
- package/dist/assets/sophia-D9_URt84.js +1 -0
- package/dist/assets/sparql-DviXpm4C.js +1 -0
- package/dist/assets/sql-vDRbAZgK.js +1 -0
- package/dist/assets/src-WBW1QxJt.js +1 -0
- package/dist/assets/st-CnpnRqA7.js +1 -0
- package/dist/assets/stateDiagram-2N3HPSRC-BvFhOryI.js +1 -0
- package/dist/assets/stateDiagram-v2-6OUMAXLB-WMrz4PNo.js +1 -0
- package/dist/assets/swift-D_g8Ganz.js +1 -0
- package/dist/assets/swimlanes-5IMT3BWC-DKF_b-2s.js +2 -0
- package/dist/assets/swimlanesDiagram-G3AALYLV-BGswC9oC.js +8 -0
- package/dist/assets/systemverilog-OuZa5h1M.js +1 -0
- package/dist/assets/tcl-DBm9ucsV.js +1 -0
- package/dist/assets/timeline-definition-FHXFAJF6-vAs11ux_.js +120 -0
- package/dist/assets/tokens-BwenNn5Q.css +1 -0
- package/dist/assets/treeView-QDETBFTQ-BVfICaZQ.js +1 -0
- package/dist/assets/treemap-6X3UGDF4-oWHPqo17.js +1 -0
- package/dist/assets/ts.worker-BwM5Ha3L.js +67719 -0
- package/dist/assets/tsMode-DGZTlTj8.js +11 -0
- package/dist/assets/twig-BRzEqX5Y.js +1 -0
- package/dist/assets/typescript-KJKfYO7K.js +1 -0
- package/dist/assets/typespec-D4ZgGeX8.js +1 -0
- package/dist/assets/useWorkspaceMenuKeyboard-CneKAZUJ.js +1 -0
- package/dist/assets/vb-DcP4s6WS.js +1 -0
- package/dist/assets/vennDiagram-L72KCM5P-BybTX_9B.js +34 -0
- package/dist/assets/wardley-OPB4EBWU-Dg8t5y3s.js +1 -0
- package/dist/assets/wardleyDiagram-EHGQE667-CicUmMBR.js +78 -0
- package/dist/assets/wgsl-CnRJ_QUf.js +298 -0
- package/dist/assets/workers-BSQRIkqa.js +1 -0
- package/dist/assets/workspace-view-state-CTyDzk2D.js +1 -0
- package/dist/assets/xml-C8FAcN6j.js +1 -0
- package/dist/assets/xychartDiagram-FW5EYKEG-BhWDyCX-.js +7 -0
- package/dist/assets/yaml-BQ4NrRhG.js +1 -0
- package/dist/assets/zsh-CLpveKlF.svg +1 -0
- package/dist/assets/zsh-FxSpMPbz.svg +1 -0
- package/dist/farming-2/app-icon-v2-180.png +0 -0
- package/dist/farming-2/app-icon-v2-192.png +0 -0
- package/dist/farming-2/app-icon-v2-512.png +0 -0
- package/dist/farming-2/app-icon-v2-maskable-512.png +0 -0
- package/dist/farming-2/app-icon-v2-master.png +0 -0
- package/dist/farming-2/favicon-v2-16.png +0 -0
- package/dist/farming-2/favicon-v2-32.png +0 -0
- package/dist/farming-2/favicon-v2-48.png +0 -0
- package/dist/farming-2/favicon-v2-64.png +0 -0
- package/dist/farming-2/favicon-v2.ico +0 -0
- package/dist/farming-2/favicon.ico +0 -0
- package/dist/farming-2/github-social-preview.png +0 -0
- package/dist/farming-2/images/avatar-watercolor-v1-bee-garden.png +0 -0
- package/dist/farming-2/images/avatar-watercolor-v2.png +0 -0
- package/dist/farming-2/images/avatar-watercolor-v3.png +0 -0
- package/dist/farming-2/legacy-icons-v1/favicon.ico +1 -0
- package/dist/farming-2/legacy-icons-v1/logo-16.png +0 -0
- package/dist/farming-2/legacy-icons-v1/logo-180.png +0 -0
- package/dist/farming-2/legacy-icons-v1/logo-192.png +0 -0
- package/dist/farming-2/legacy-icons-v1/logo-32.png +0 -0
- package/dist/farming-2/legacy-icons-v1/logo-48.png +0 -0
- package/dist/farming-2/legacy-icons-v1/logo-512.png +0 -0
- package/dist/farming-2/legacy-icons-v1/logo-64.png +0 -0
- package/dist/farming-2/logo-16.png +0 -0
- package/dist/farming-2/logo-180.png +0 -0
- package/dist/farming-2/logo-192.png +0 -0
- package/dist/farming-2/logo-32.png +0 -0
- package/dist/farming-2/logo-48.png +0 -0
- package/dist/farming-2/logo-512.png +0 -0
- package/dist/farming-2/logo-64.png +0 -0
- package/dist/farming-2/site.webmanifest +27 -0
- package/dist/farming-2/style_capsules/watercolor-pastoral.json +94 -0
- package/dist/index.html +27 -0
- package/frontend/ghostty-loader.js +24 -0
- package/frontend/runtime-paths.js +28 -0
- package/frontend/session-bridge.js +82 -0
- package/frontend/session-modal-bridge.js +331 -0
- package/frontend/skin-bridge.js +25 -0
- package/frontend/skins/crt/app.js +6940 -0
- package/frontend/skins/crt/assets/branding/farming-crt-icon.svg +11 -0
- package/frontend/skins/crt/assets/branding/farming-crt-logo-v1.png +0 -0
- package/frontend/skins/crt/assets/effects/phosphor-noise.svg +11 -0
- package/frontend/skins/crt/assets/fonts/departure-mono/DepartureMonoNerdFontMono-Regular.otf +0 -0
- package/frontend/skins/crt/assets/fonts/departure-mono/LICENSE +93 -0
- package/frontend/skins/crt/effects.js +8 -0
- package/frontend/skins/crt/index.html +1712 -0
- package/frontend/skins/crt/styles/billing.css +1003 -0
- package/frontend/skins/crt/styles/effects.css +171 -0
- package/frontend/skins/crt/styles/history.css +215 -0
- package/frontend/skins/crt/styles/monochrome-green.css +509 -0
- package/frontend/skins/crt/styles/search.css +271 -0
- package/frontend/terminal-bridge.js +192 -0
- package/frontend/theme-loader.js +84 -0
- package/frontend/themes/terminal/theme.json +24 -0
- package/frontend/vendor/ghostty-web/LICENSE +21 -0
- package/frontend/vendor/ghostty-web/__vite-browser-external-2447137e.js +4 -0
- package/frontend/vendor/ghostty-web/ghostty-vt.wasm +0 -0
- package/frontend/vendor/ghostty-web/ghostty-web.js +2963 -0
- package/frontend/vendor/ghostty-web/ghostty-web.umd.cjs +13 -0
- package/frontend/vendor/ghostty-web/index.d.ts +1842 -0
- package/index.html +23 -0
- package/package.json +144 -0
- package/scripts/sync-ghostty-vendor.js +66 -0
|
@@ -0,0 +1,815 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const os = require('os');
|
|
4
|
+
const { ensureMainAgentSkillFiles } = require('./main-agent-skills');
|
|
5
|
+
const { normalizeClaudeModelValue } = require('./claude-settings');
|
|
6
|
+
const { isTemporaryProviderSessionId } = require('./provider-session-id');
|
|
7
|
+
const { FarmingSessionStore, MAX_MAIN_PAGE_SESSION_KEYS } = require('./farming-session-store');
|
|
8
|
+
const { RunHistoryStore } = require('./run-history-store');
|
|
9
|
+
const { isSupportedHistoryAgent } = require('./cli-agents');
|
|
10
|
+
const storageLayout = require('./storage-layout');
|
|
11
|
+
|
|
12
|
+
function splitCodexModelPreset(preset) {
|
|
13
|
+
if (preset === 'config') {
|
|
14
|
+
return { model: 'config', effort: 'config' };
|
|
15
|
+
}
|
|
16
|
+
if (typeof preset !== 'string') {
|
|
17
|
+
return { model: 'gpt-5.5', effort: 'xhigh' };
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const [model, effort] = preset.split(':');
|
|
21
|
+
return {
|
|
22
|
+
model: model || 'gpt-5.5',
|
|
23
|
+
effort: effort || 'xhigh',
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function joinCodexModelPreset(model, effort) {
|
|
28
|
+
if (model === 'config') return 'config';
|
|
29
|
+
return effort ? `${model}:${effort}` : model;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const DEFAULT_CODEX_LAUNCH_PROFILE = {
|
|
33
|
+
approvalMode: 'approve',
|
|
34
|
+
model: 'gpt-5.5',
|
|
35
|
+
reasoningEffort: 'xhigh',
|
|
36
|
+
serviceTier: 'default',
|
|
37
|
+
modelPreset: 'gpt-5.5:xhigh',
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const DEFAULT_CLAUDE_LAUNCH_PROFILE = {
|
|
41
|
+
permissionMode: 'default',
|
|
42
|
+
model: 'config',
|
|
43
|
+
effort: 'config',
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const DEFAULT_AGENT_LAUNCH_PROFILES = {
|
|
47
|
+
codex: DEFAULT_CODEX_LAUNCH_PROFILE,
|
|
48
|
+
claude: DEFAULT_CLAUDE_LAUNCH_PROFILE,
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const DEFAULT_LAUNCH_AGENT_NAMES = new Set(['codex', 'claude', 'opencode', 'qoder', 'bash', 'zsh']);
|
|
52
|
+
|
|
53
|
+
const DEFAULT_AGENT_HOMES = {
|
|
54
|
+
codex: [{ id: 'default', path: '~/.codex' }],
|
|
55
|
+
claude: [{ id: 'default', path: '~/.claude' }],
|
|
56
|
+
opencode: [{ id: 'default', path: '~/.opencode' }],
|
|
57
|
+
qoder: [{ id: 'default', path: '~/.qoder' }],
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const DEFAULT_UPDATE_URL = 'https://github.com/zhuwenzhuang/farming/releases/latest';
|
|
61
|
+
const LEGACY_DEFAULT_UPDATE_URL = 'https://github.com/zhuwenzhuang/farming/releases/latest/download/manifest.json';
|
|
62
|
+
const API_DEFAULT_UPDATE_URL = 'https://api.github.com/repos/zhuwenzhuang/farming/releases/latest';
|
|
63
|
+
const LEGACY_DEFAULT_WORKSPACE_FILE_SEARCH_TIMEOUT_MS = 3000;
|
|
64
|
+
const DEFAULT_SEARCH_TIMEOUT_MS = 15000;
|
|
65
|
+
const MIN_SEARCH_TIMEOUT_MS = 3000;
|
|
66
|
+
const MAX_SEARCH_TIMEOUT_MS = 180000;
|
|
67
|
+
const DEFAULT_CRT_TERMINAL_FONT_SIZE = 15;
|
|
68
|
+
const MIN_CRT_TERMINAL_FONT_SIZE = 10;
|
|
69
|
+
const MAX_CRT_TERMINAL_FONT_SIZE = 20;
|
|
70
|
+
|
|
71
|
+
const PERSISTED_SETTING_KEYS = new Set([
|
|
72
|
+
'workspace',
|
|
73
|
+
'lastMainWorkspace',
|
|
74
|
+
'workspaceHistory',
|
|
75
|
+
'projectNames',
|
|
76
|
+
'theme',
|
|
77
|
+
'appearance',
|
|
78
|
+
'language',
|
|
79
|
+
'heartbeatInterval',
|
|
80
|
+
'dangerouslySkipAgentPermissionsByDefault',
|
|
81
|
+
'crtSkinEffectsEnabled',
|
|
82
|
+
'crtDynamicHeatEnabled',
|
|
83
|
+
'crtTerminalFontSize',
|
|
84
|
+
'defaultLaunchAgent',
|
|
85
|
+
'agentLaunchProfiles',
|
|
86
|
+
'agentHomes',
|
|
87
|
+
'updateUrl',
|
|
88
|
+
'searchTimeoutMs',
|
|
89
|
+
'codexRuntimeMode',
|
|
90
|
+
'codexApprovalMode',
|
|
91
|
+
'codexModel',
|
|
92
|
+
'codexReasoningEffort',
|
|
93
|
+
'codexServiceTier',
|
|
94
|
+
'codexModelPreset',
|
|
95
|
+
'version',
|
|
96
|
+
]);
|
|
97
|
+
|
|
98
|
+
function cloneLaunchProfile(profile) {
|
|
99
|
+
return { ...profile };
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function cloneAgentHomes(agentHomes) {
|
|
103
|
+
const cloned = {};
|
|
104
|
+
Object.entries(agentHomes || {}).forEach(([provider, homes]) => {
|
|
105
|
+
cloned[provider] = Array.isArray(homes)
|
|
106
|
+
? homes.map(home => ({ ...home }))
|
|
107
|
+
: [];
|
|
108
|
+
});
|
|
109
|
+
return cloned;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
class ConfigManager {
|
|
113
|
+
constructor() {
|
|
114
|
+
this.farmingDir = storageLayout.farmingConfigDir();
|
|
115
|
+
this.settingsFile = storageLayout.settingsFile(this.farmingDir);
|
|
116
|
+
this.sessionStore = new FarmingSessionStore(this.farmingDir, {
|
|
117
|
+
normalizeMainPageSessionKeys: keys => this.normalizeMainPageSessionKeys(keys),
|
|
118
|
+
});
|
|
119
|
+
this.runHistoryStore = new RunHistoryStore(this.farmingDir, {
|
|
120
|
+
normalizeTaskHistory: entries => this.normalizeTaskHistory(entries),
|
|
121
|
+
});
|
|
122
|
+
this.settings = null;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
expandWorkspacePath(workspace) {
|
|
126
|
+
if (typeof workspace !== 'string') return '';
|
|
127
|
+
const value = workspace.trim();
|
|
128
|
+
if (!value) return '';
|
|
129
|
+
if (value === '~') return os.homedir();
|
|
130
|
+
if (value.startsWith('~/')) return path.join(os.homedir(), value.slice(2));
|
|
131
|
+
return value;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
isTemporaryWorkspace(workspace) {
|
|
135
|
+
const resolved = path.resolve(this.expandWorkspacePath(workspace));
|
|
136
|
+
return resolved === '/tmp'
|
|
137
|
+
|| resolved.startsWith('/tmp/')
|
|
138
|
+
|| resolved === '/private/tmp'
|
|
139
|
+
|| resolved.startsWith('/private/tmp/')
|
|
140
|
+
|| resolved === '/var/tmp'
|
|
141
|
+
|| resolved.startsWith('/var/tmp/')
|
|
142
|
+
|| resolved === '/private/var/tmp'
|
|
143
|
+
|| resolved.startsWith('/private/var/tmp/')
|
|
144
|
+
|| resolved === '/var/folders'
|
|
145
|
+
|| resolved.startsWith('/var/folders/')
|
|
146
|
+
|| resolved === '/private/var/folders'
|
|
147
|
+
|| resolved.startsWith('/private/var/folders/');
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
isUsableWorkspace(workspace) {
|
|
151
|
+
const expanded = this.expandWorkspacePath(workspace);
|
|
152
|
+
if (!expanded || this.isTemporaryWorkspace(expanded)) return false;
|
|
153
|
+
|
|
154
|
+
try {
|
|
155
|
+
return fs.statSync(expanded).isDirectory();
|
|
156
|
+
} catch {
|
|
157
|
+
return false;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
isInternalWorkspace(workspace) {
|
|
162
|
+
const expanded = this.expandWorkspacePath(workspace);
|
|
163
|
+
if (!expanded) return false;
|
|
164
|
+
|
|
165
|
+
const resolvedWorkspace = path.resolve(expanded);
|
|
166
|
+
const resolvedFarmingDir = path.resolve(this.farmingDir);
|
|
167
|
+
return resolvedWorkspace === resolvedFarmingDir || path.basename(resolvedWorkspace) === '.farming';
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
normalizeMainWorkspace(workspace, fallback = this.farmingDir) {
|
|
171
|
+
const expanded = this.expandWorkspacePath(workspace);
|
|
172
|
+
if (this.isUsableWorkspace(expanded)) {
|
|
173
|
+
return expanded;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
const expandedFallback = this.expandWorkspacePath(fallback);
|
|
177
|
+
if (this.isUsableWorkspace(expandedFallback)) {
|
|
178
|
+
return expandedFallback;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
return this.farmingDir;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
normalizeWorkspaceHistory(history) {
|
|
185
|
+
const entries = Array.isArray(history) ? history : [];
|
|
186
|
+
const result = [];
|
|
187
|
+
const seen = new Set();
|
|
188
|
+
|
|
189
|
+
for (const entry of entries) {
|
|
190
|
+
const expanded = this.expandWorkspacePath(entry);
|
|
191
|
+
if (!this.isUsableWorkspace(expanded) || this.isInternalWorkspace(expanded) || seen.has(expanded)) continue;
|
|
192
|
+
seen.add(expanded);
|
|
193
|
+
result.push(expanded);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
return result.slice(0, 5);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
normalizeMainPageSessionKeys(keys) {
|
|
200
|
+
const entries = Array.isArray(keys) ? keys : [];
|
|
201
|
+
const result = [];
|
|
202
|
+
const seen = new Set();
|
|
203
|
+
|
|
204
|
+
for (const entry of entries) {
|
|
205
|
+
if (typeof entry !== 'string') continue;
|
|
206
|
+
const value = entry.trim();
|
|
207
|
+
if (!/^agent-session:[a-z][a-z0-9_-]*:.+$/i.test(value)) continue;
|
|
208
|
+
const sessionId = value.replace(/^agent-session:[^:]+:/i, '');
|
|
209
|
+
if (sessionId.startsWith('-')) continue;
|
|
210
|
+
if (isTemporaryProviderSessionId(sessionId)) continue;
|
|
211
|
+
if (seen.has(value)) continue;
|
|
212
|
+
seen.add(value);
|
|
213
|
+
result.push(value);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
return result.slice(0, MAX_MAIN_PAGE_SESSION_KEYS);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
normalizeTaskHistory(history) {
|
|
220
|
+
const entries = Array.isArray(history) ? history : [];
|
|
221
|
+
const normalized = [];
|
|
222
|
+
for (const entry of entries) {
|
|
223
|
+
if (!entry || typeof entry !== 'object') continue;
|
|
224
|
+
if (typeof entry.id !== 'string' || !entry.id) continue;
|
|
225
|
+
if (typeof entry.agentId !== 'string' || !entry.agentId) continue;
|
|
226
|
+
if (typeof entry.reason !== 'string' || !entry.reason) continue;
|
|
227
|
+
if (typeof entry.archivedAt !== 'number' || !Number.isFinite(entry.archivedAt)) continue;
|
|
228
|
+
if (!isSupportedHistoryAgent(entry.command)) continue;
|
|
229
|
+
normalized.push({
|
|
230
|
+
id: entry.id,
|
|
231
|
+
agentId: entry.agentId,
|
|
232
|
+
command: typeof entry.command === 'string' ? entry.command : '',
|
|
233
|
+
cwd: typeof entry.cwd === 'string' ? entry.cwd : '',
|
|
234
|
+
projectWorkspace: typeof entry.projectWorkspace === 'string' ? entry.projectWorkspace : '',
|
|
235
|
+
title: typeof entry.title === 'string' ? entry.title : '',
|
|
236
|
+
customTitle: typeof entry.customTitle === 'string' ? entry.customTitle.trim().slice(0, 80) : '',
|
|
237
|
+
task: typeof entry.task === 'string' ? entry.task : '',
|
|
238
|
+
workflowTemplate: typeof entry.workflowTemplate === 'string' ? entry.workflowTemplate : '',
|
|
239
|
+
source: typeof entry.source === 'string' ? entry.source : 'ui',
|
|
240
|
+
reason: entry.reason,
|
|
241
|
+
status: typeof entry.status === 'string' ? entry.status : 'stopped',
|
|
242
|
+
startedAt: typeof entry.startedAt === 'number' ? entry.startedAt : null,
|
|
243
|
+
lastActivity: typeof entry.lastActivity === 'number' ? entry.lastActivity : null,
|
|
244
|
+
archivedAt: entry.archivedAt,
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
return normalized
|
|
248
|
+
.sort((a, b) => b.archivedAt - a.archivedAt)
|
|
249
|
+
.slice(0, 200);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
init() {
|
|
253
|
+
if (!fs.existsSync(this.farmingDir)) {
|
|
254
|
+
fs.mkdirSync(this.farmingDir, { recursive: true });
|
|
255
|
+
console.log('Created farming directory:', this.farmingDir);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
if (!fs.existsSync(this.settingsFile)) {
|
|
259
|
+
const defaultSettings = {
|
|
260
|
+
workspace: this.farmingDir,
|
|
261
|
+
lastMainWorkspace: this.farmingDir,
|
|
262
|
+
workspaceHistory: [],
|
|
263
|
+
projectNames: {},
|
|
264
|
+
theme: 'terminal',
|
|
265
|
+
appearance: 'light',
|
|
266
|
+
language: 'en',
|
|
267
|
+
heartbeatInterval: 1000,
|
|
268
|
+
dangerouslySkipAgentPermissionsByDefault: false,
|
|
269
|
+
crtSkinEffectsEnabled: true,
|
|
270
|
+
crtDynamicHeatEnabled: false,
|
|
271
|
+
crtTerminalFontSize: DEFAULT_CRT_TERMINAL_FONT_SIZE,
|
|
272
|
+
defaultLaunchAgent: 'codex',
|
|
273
|
+
agentLaunchProfiles: {
|
|
274
|
+
codex: cloneLaunchProfile(DEFAULT_CODEX_LAUNCH_PROFILE),
|
|
275
|
+
claude: cloneLaunchProfile(DEFAULT_CLAUDE_LAUNCH_PROFILE),
|
|
276
|
+
},
|
|
277
|
+
agentHomes: cloneAgentHomes(DEFAULT_AGENT_HOMES),
|
|
278
|
+
updateUrl: DEFAULT_UPDATE_URL,
|
|
279
|
+
searchTimeoutMs: DEFAULT_SEARCH_TIMEOUT_MS,
|
|
280
|
+
codexRuntimeMode: 'cli',
|
|
281
|
+
codexApprovalMode: 'approve',
|
|
282
|
+
codexModel: 'gpt-5.5',
|
|
283
|
+
codexReasoningEffort: 'xhigh',
|
|
284
|
+
codexServiceTier: 'default',
|
|
285
|
+
codexModelPreset: 'gpt-5.5:xhigh',
|
|
286
|
+
version: '2'
|
|
287
|
+
};
|
|
288
|
+
fs.writeFileSync(this.settingsFile, JSON.stringify(defaultSettings, null, 2));
|
|
289
|
+
console.log('Created default settings:', this.settingsFile);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
const rawSettings = JSON.parse(fs.readFileSync(this.settingsFile, 'utf8'));
|
|
293
|
+
this.settings = {
|
|
294
|
+
workspace: this.farmingDir,
|
|
295
|
+
lastMainWorkspace: this.farmingDir,
|
|
296
|
+
workspaceHistory: [],
|
|
297
|
+
projectNames: {},
|
|
298
|
+
theme: 'terminal',
|
|
299
|
+
appearance: 'light',
|
|
300
|
+
language: 'en',
|
|
301
|
+
heartbeatInterval: 1000,
|
|
302
|
+
dangerouslySkipAgentPermissionsByDefault: false,
|
|
303
|
+
crtSkinEffectsEnabled: true,
|
|
304
|
+
crtDynamicHeatEnabled: false,
|
|
305
|
+
crtTerminalFontSize: DEFAULT_CRT_TERMINAL_FONT_SIZE,
|
|
306
|
+
defaultLaunchAgent: 'codex',
|
|
307
|
+
agentLaunchProfiles: {
|
|
308
|
+
codex: cloneLaunchProfile(DEFAULT_CODEX_LAUNCH_PROFILE),
|
|
309
|
+
claude: cloneLaunchProfile(DEFAULT_CLAUDE_LAUNCH_PROFILE),
|
|
310
|
+
},
|
|
311
|
+
agentHomes: cloneAgentHomes(DEFAULT_AGENT_HOMES),
|
|
312
|
+
updateUrl: DEFAULT_UPDATE_URL,
|
|
313
|
+
searchTimeoutMs: DEFAULT_SEARCH_TIMEOUT_MS,
|
|
314
|
+
codexRuntimeMode: 'cli',
|
|
315
|
+
codexApprovalMode: 'approve',
|
|
316
|
+
codexModel: 'gpt-5.5',
|
|
317
|
+
codexReasoningEffort: 'xhigh',
|
|
318
|
+
codexServiceTier: 'default',
|
|
319
|
+
codexModelPreset: 'gpt-5.5:xhigh',
|
|
320
|
+
version: '2',
|
|
321
|
+
...rawSettings
|
|
322
|
+
};
|
|
323
|
+
if (rawSettings.searchTimeoutMs === undefined && rawSettings.workspaceFileSearchTimeoutMs !== undefined) {
|
|
324
|
+
const legacyTimeoutMs = Number(rawSettings.workspaceFileSearchTimeoutMs);
|
|
325
|
+
this.settings.searchTimeoutMs = legacyTimeoutMs === LEGACY_DEFAULT_WORKSPACE_FILE_SEARCH_TIMEOUT_MS
|
|
326
|
+
? DEFAULT_SEARCH_TIMEOUT_MS
|
|
327
|
+
: rawSettings.workspaceFileSearchTimeoutMs;
|
|
328
|
+
}
|
|
329
|
+
delete this.settings.workspaceFileSearchTimeoutMs;
|
|
330
|
+
if (
|
|
331
|
+
this.settings.dangerouslySkipAgentPermissionsByDefault === undefined
|
|
332
|
+
&& this.settings.skipPermissionCheckByDefault !== undefined
|
|
333
|
+
) {
|
|
334
|
+
this.settings.dangerouslySkipAgentPermissionsByDefault = this.settings.skipPermissionCheckByDefault === true;
|
|
335
|
+
}
|
|
336
|
+
delete this.settings.skipPermissionCheckByDefault;
|
|
337
|
+
const launchRawSettings = { ...rawSettings };
|
|
338
|
+
if (rawSettings.codexApprovalMode === undefined && this.settings.dangerouslySkipAgentPermissionsByDefault === true) {
|
|
339
|
+
this.settings.codexApprovalMode = 'full';
|
|
340
|
+
launchRawSettings.codexApprovalMode = 'full';
|
|
341
|
+
}
|
|
342
|
+
this.settings.workspace = this.farmingDir;
|
|
343
|
+
this.settings.lastMainWorkspace = this.normalizeMainWorkspace(this.settings.lastMainWorkspace, this.farmingDir);
|
|
344
|
+
this.settings.workspaceHistory = this.normalizeWorkspaceHistory(this.settings.workspaceHistory);
|
|
345
|
+
this.settings.projectNames = this.normalizeProjectNames(this.settings.projectNames);
|
|
346
|
+
this.settings.agentHomes = this.normalizeAgentHomes(this.settings.agentHomes);
|
|
347
|
+
if (this.settings.updateUrl === LEGACY_DEFAULT_UPDATE_URL || this.settings.updateUrl === API_DEFAULT_UPDATE_URL) {
|
|
348
|
+
this.settings.updateUrl = DEFAULT_UPDATE_URL;
|
|
349
|
+
}
|
|
350
|
+
this.settings.updateUrl = this.normalizeUpdateUrl(this.settings.updateUrl);
|
|
351
|
+
this.settings.searchTimeoutMs = this.normalizeSearchTimeoutMs(this.settings.searchTimeoutMs);
|
|
352
|
+
this.settings.codexRuntimeMode = this.normalizeCodexRuntimeMode(this.settings.codexRuntimeMode);
|
|
353
|
+
const legacyMainPageSessionKeys = this.normalizeMainPageSessionKeys(this.settings.mainPageSessionKeys);
|
|
354
|
+
delete this.settings.mainPageSessionKeys;
|
|
355
|
+
this.sessionStore.init({ legacyMainPageSessionKeys });
|
|
356
|
+
const legacyTaskHistory = this.normalizeTaskHistory(this.settings.taskHistory);
|
|
357
|
+
delete this.settings.taskHistory;
|
|
358
|
+
this.runHistoryStore.init({ legacyTaskHistory });
|
|
359
|
+
this.settings.appearance = this.normalizeAppearance(this.settings.appearance);
|
|
360
|
+
this.settings.language = this.normalizeLanguage(this.settings.language);
|
|
361
|
+
this.settings.crtSkinEffectsEnabled = this.settings.crtSkinEffectsEnabled !== false;
|
|
362
|
+
this.settings.crtDynamicHeatEnabled = this.settings.crtDynamicHeatEnabled === true;
|
|
363
|
+
this.settings.crtTerminalFontSize = this.normalizeCrtTerminalFontSize(this.settings.crtTerminalFontSize);
|
|
364
|
+
this.normalizeAgentLaunchSettings(launchRawSettings);
|
|
365
|
+
this.pruneUnknownSettings();
|
|
366
|
+
ensureMainAgentSkillFiles(this.farmingDir);
|
|
367
|
+
this.writeSettingsFile();
|
|
368
|
+
console.log('Loaded settings:', this.settings);
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
pruneUnknownSettings() {
|
|
372
|
+
for (const key of Object.keys(this.settings || {})) {
|
|
373
|
+
if (!PERSISTED_SETTING_KEYS.has(key)) {
|
|
374
|
+
delete this.settings[key];
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
normalizeDefaultLaunchAgent(agentName) {
|
|
380
|
+
return DEFAULT_LAUNCH_AGENT_NAMES.has(agentName) ? agentName : 'codex';
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
normalizeSearchTimeoutMs(value) {
|
|
384
|
+
const timeoutMs = Number(value);
|
|
385
|
+
if (!Number.isFinite(timeoutMs)) return DEFAULT_SEARCH_TIMEOUT_MS;
|
|
386
|
+
return Math.min(
|
|
387
|
+
MAX_SEARCH_TIMEOUT_MS,
|
|
388
|
+
Math.max(MIN_SEARCH_TIMEOUT_MS, Math.round(timeoutMs))
|
|
389
|
+
);
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
normalizeCrtTerminalFontSize(value) {
|
|
393
|
+
const fontSize = Number(value);
|
|
394
|
+
if (!Number.isFinite(fontSize)) return DEFAULT_CRT_TERMINAL_FONT_SIZE;
|
|
395
|
+
return Math.min(
|
|
396
|
+
MAX_CRT_TERMINAL_FONT_SIZE,
|
|
397
|
+
Math.max(MIN_CRT_TERMINAL_FONT_SIZE, Math.round(fontSize))
|
|
398
|
+
);
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
normalizeAgentHomes(agentHomes) {
|
|
402
|
+
const source = agentHomes && typeof agentHomes === 'object' && !Array.isArray(agentHomes)
|
|
403
|
+
? agentHomes
|
|
404
|
+
: {};
|
|
405
|
+
const normalized = {};
|
|
406
|
+
|
|
407
|
+
Object.entries(source).forEach(([rawProvider, rawHomes]) => {
|
|
408
|
+
const provider = String(rawProvider || '').trim().toLowerCase();
|
|
409
|
+
if (!/^[a-z0-9._-]+$/.test(provider)) return;
|
|
410
|
+
if (!Object.prototype.hasOwnProperty.call(DEFAULT_AGENT_HOMES, provider)) return;
|
|
411
|
+
if (!Array.isArray(rawHomes)) return;
|
|
412
|
+
|
|
413
|
+
const seenIds = new Set();
|
|
414
|
+
const homes = [];
|
|
415
|
+
rawHomes.forEach(rawHome => {
|
|
416
|
+
if (!rawHome || typeof rawHome !== 'object') return;
|
|
417
|
+
const id = String(rawHome.id || '').trim();
|
|
418
|
+
const homePath = String(rawHome.path || '').trim();
|
|
419
|
+
if (!id || !homePath) return;
|
|
420
|
+
if (!/^[A-Za-z0-9._-]+$/.test(id)) return;
|
|
421
|
+
const idKey = id.toLowerCase();
|
|
422
|
+
if (seenIds.has(idKey)) return;
|
|
423
|
+
seenIds.add(idKey);
|
|
424
|
+
homes.push({ id, path: homePath });
|
|
425
|
+
});
|
|
426
|
+
if (homes.length > 0) normalized[provider] = homes;
|
|
427
|
+
});
|
|
428
|
+
|
|
429
|
+
for (const [provider, homes] of Object.entries(DEFAULT_AGENT_HOMES)) {
|
|
430
|
+
const defaultHome = homes[0];
|
|
431
|
+
const providerHomes = normalized[provider] || [];
|
|
432
|
+
if (!providerHomes.some(home => String(home.id || '').toLowerCase() === 'default')) {
|
|
433
|
+
normalized[provider] = [{ ...defaultHome }, ...providerHomes];
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
return normalized;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
normalizeProjectNames(projectNames) {
|
|
441
|
+
if (!projectNames || typeof projectNames !== 'object' || Array.isArray(projectNames)) return {};
|
|
442
|
+
const normalized = {};
|
|
443
|
+
Object.entries(projectNames).forEach(([workspace, name]) => {
|
|
444
|
+
const key = this.expandWorkspacePath(String(workspace || '').trim());
|
|
445
|
+
const value = String(name || '').trim().slice(0, 80);
|
|
446
|
+
if (!key || !value) return;
|
|
447
|
+
normalized[key] = value;
|
|
448
|
+
});
|
|
449
|
+
return normalized;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
normalizeAppearance(appearance) {
|
|
453
|
+
return ['light', 'dark'].includes(appearance) ? appearance : 'light';
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
normalizeLanguage(language) {
|
|
457
|
+
return ['en', 'zh'].includes(language) ? language : 'en';
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
normalizeUpdateUrl(value) {
|
|
461
|
+
const url = String(value || '').trim();
|
|
462
|
+
if (!url) return DEFAULT_UPDATE_URL;
|
|
463
|
+
return /^https?:\/\//i.test(url) ? url.slice(0, 2000) : DEFAULT_UPDATE_URL;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
normalizeClaudePermissionMode(mode) {
|
|
467
|
+
return ['acceptEdits', 'auto', 'bypassPermissions', 'default', 'dontAsk', 'plan'].includes(mode)
|
|
468
|
+
? mode
|
|
469
|
+
: 'default';
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
normalizeClaudeModel(model) {
|
|
473
|
+
if (model === 'config') return model;
|
|
474
|
+
return normalizeClaudeModelValue(model) || 'config';
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
normalizeClaudeEffort(effort) {
|
|
478
|
+
if (effort === 'config') return effort;
|
|
479
|
+
if (['low', 'medium', 'high', 'xhigh', 'max'].includes(effort)) return effort;
|
|
480
|
+
return 'config';
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
normalizeCodexApprovalMode(mode) {
|
|
484
|
+
return ['ask', 'approve', 'full', 'custom'].includes(mode) ? mode : 'approve';
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
normalizeCodexRuntimeMode(mode) {
|
|
488
|
+
return mode === 'app-server' ? 'app-server' : 'cli';
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
normalizeCodexModelPreset(preset) {
|
|
492
|
+
if (preset === 'config') return preset;
|
|
493
|
+
if (typeof preset !== 'string') return 'gpt-5.5:xhigh';
|
|
494
|
+
if (/^[A-Za-z0-9._-]+(?::[A-Za-z0-9._-]+)?$/.test(preset)) return preset;
|
|
495
|
+
return 'gpt-5.5:xhigh';
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
normalizeCodexModelId(model) {
|
|
499
|
+
if (model === 'config') return model;
|
|
500
|
+
if (typeof model !== 'string') return 'gpt-5.5';
|
|
501
|
+
if (/^[A-Za-z0-9._-]+$/.test(model)) return model;
|
|
502
|
+
return 'gpt-5.5';
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
normalizeCodexReasoningEffort(effort) {
|
|
506
|
+
if (effort === 'config') return effort;
|
|
507
|
+
if (typeof effort !== 'string') return 'xhigh';
|
|
508
|
+
if (/^[A-Za-z0-9._-]+$/.test(effort)) return effort;
|
|
509
|
+
return 'xhigh';
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
normalizeCodexServiceTier(tier) {
|
|
513
|
+
if (typeof tier !== 'string') return 'default';
|
|
514
|
+
if (/^[A-Za-z0-9._-]+$/.test(tier)) return tier;
|
|
515
|
+
return 'default';
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
normalizeCodexModelSettings(rawSettings = {}) {
|
|
519
|
+
const codexProfile = this.normalizeCodexLaunchProfile({
|
|
520
|
+
approvalMode: this.settings.codexApprovalMode,
|
|
521
|
+
model: this.settings.codexModel,
|
|
522
|
+
reasoningEffort: this.settings.codexReasoningEffort,
|
|
523
|
+
serviceTier: this.settings.codexServiceTier,
|
|
524
|
+
modelPreset: this.settings.codexModelPreset,
|
|
525
|
+
}, {
|
|
526
|
+
approvalMode: rawSettings.codexApprovalMode,
|
|
527
|
+
model: rawSettings.codexModel,
|
|
528
|
+
reasoningEffort: rawSettings.codexReasoningEffort,
|
|
529
|
+
serviceTier: rawSettings.codexServiceTier,
|
|
530
|
+
modelPreset: rawSettings.codexModelPreset,
|
|
531
|
+
});
|
|
532
|
+
this.applyCodexProfileToLegacySettings(codexProfile);
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
normalizeCodexLaunchProfile(profile = {}, changed = {}) {
|
|
536
|
+
const next = {
|
|
537
|
+
...DEFAULT_CODEX_LAUNCH_PROFILE,
|
|
538
|
+
...(profile && typeof profile === 'object' ? profile : {}),
|
|
539
|
+
};
|
|
540
|
+
next.approvalMode = this.normalizeCodexApprovalMode(next.approvalMode);
|
|
541
|
+
|
|
542
|
+
const hasDirectModelChange = changed.model !== undefined || changed.reasoningEffort !== undefined;
|
|
543
|
+
const hasPresetChange = changed.modelPreset !== undefined;
|
|
544
|
+
const normalizedPreset = this.normalizeCodexModelPreset(next.modelPreset);
|
|
545
|
+
if (hasPresetChange && !hasDirectModelChange) {
|
|
546
|
+
const fromPreset = splitCodexModelPreset(normalizedPreset);
|
|
547
|
+
next.model = fromPreset.model;
|
|
548
|
+
next.reasoningEffort = fromPreset.effort;
|
|
549
|
+
} else {
|
|
550
|
+
next.model = this.normalizeCodexModelId(next.model);
|
|
551
|
+
next.reasoningEffort = this.normalizeCodexReasoningEffort(next.reasoningEffort);
|
|
552
|
+
}
|
|
553
|
+
next.serviceTier = this.normalizeCodexServiceTier(next.serviceTier);
|
|
554
|
+
next.modelPreset = joinCodexModelPreset(
|
|
555
|
+
next.model,
|
|
556
|
+
next.reasoningEffort === 'config' ? '' : next.reasoningEffort
|
|
557
|
+
);
|
|
558
|
+
return next;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
normalizeClaudeLaunchProfile(profile = {}) {
|
|
562
|
+
const next = {
|
|
563
|
+
...DEFAULT_CLAUDE_LAUNCH_PROFILE,
|
|
564
|
+
...(profile && typeof profile === 'object' ? profile : {}),
|
|
565
|
+
};
|
|
566
|
+
return {
|
|
567
|
+
permissionMode: this.normalizeClaudePermissionMode(next.permissionMode),
|
|
568
|
+
model: this.normalizeClaudeModel(next.model),
|
|
569
|
+
effort: this.normalizeClaudeEffort(next.effort),
|
|
570
|
+
};
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
getChangedAgentLaunchProfiles(rawSettings = {}) {
|
|
574
|
+
const changedProfiles = {};
|
|
575
|
+
if (rawSettings.agentLaunchProfiles && typeof rawSettings.agentLaunchProfiles === 'object') {
|
|
576
|
+
for (const [agentName, profile] of Object.entries(rawSettings.agentLaunchProfiles)) {
|
|
577
|
+
if (!Object.prototype.hasOwnProperty.call(DEFAULT_AGENT_LAUNCH_PROFILES, agentName)) continue;
|
|
578
|
+
if (profile && typeof profile === 'object') changedProfiles[agentName] = profile;
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
const codexChanged = {};
|
|
583
|
+
if (rawSettings.codexApprovalMode !== undefined) codexChanged.approvalMode = rawSettings.codexApprovalMode;
|
|
584
|
+
if (rawSettings.codexModel !== undefined) codexChanged.model = rawSettings.codexModel;
|
|
585
|
+
if (rawSettings.codexReasoningEffort !== undefined) codexChanged.reasoningEffort = rawSettings.codexReasoningEffort;
|
|
586
|
+
if (rawSettings.codexServiceTier !== undefined) codexChanged.serviceTier = rawSettings.codexServiceTier;
|
|
587
|
+
if (rawSettings.codexModelPreset !== undefined) codexChanged.modelPreset = rawSettings.codexModelPreset;
|
|
588
|
+
if (Object.keys(codexChanged).length > 0) {
|
|
589
|
+
changedProfiles.codex = {
|
|
590
|
+
...(changedProfiles.codex || {}),
|
|
591
|
+
...codexChanged,
|
|
592
|
+
};
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
return changedProfiles;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
mergeAgentLaunchProfiles(existingProfiles = {}, incomingProfiles = {}) {
|
|
599
|
+
const merged = {};
|
|
600
|
+
for (const [agentName, defaultProfile] of Object.entries(DEFAULT_AGENT_LAUNCH_PROFILES)) {
|
|
601
|
+
merged[agentName] = {
|
|
602
|
+
...defaultProfile,
|
|
603
|
+
...(existingProfiles && typeof existingProfiles === 'object' ? existingProfiles[agentName] : {}),
|
|
604
|
+
...(incomingProfiles && typeof incomingProfiles === 'object' ? incomingProfiles[agentName] : {}),
|
|
605
|
+
};
|
|
606
|
+
}
|
|
607
|
+
return merged;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
applyCodexProfileToLegacySettings(codexProfile) {
|
|
611
|
+
this.settings.codexApprovalMode = codexProfile.approvalMode;
|
|
612
|
+
this.settings.codexModel = codexProfile.model;
|
|
613
|
+
this.settings.codexReasoningEffort = codexProfile.reasoningEffort;
|
|
614
|
+
this.settings.codexServiceTier = codexProfile.serviceTier;
|
|
615
|
+
this.settings.codexModelPreset = codexProfile.modelPreset;
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
normalizeAgentLaunchSettings(rawSettings = {}) {
|
|
619
|
+
const changedProfiles = this.getChangedAgentLaunchProfiles(rawSettings);
|
|
620
|
+
const mergedProfiles = this.mergeAgentLaunchProfiles(this.settings.agentLaunchProfiles, changedProfiles);
|
|
621
|
+
this.settings.agentLaunchProfiles = {
|
|
622
|
+
codex: this.normalizeCodexLaunchProfile(mergedProfiles.codex, changedProfiles.codex || {}),
|
|
623
|
+
claude: this.normalizeClaudeLaunchProfile(mergedProfiles.claude),
|
|
624
|
+
};
|
|
625
|
+
this.settings.defaultLaunchAgent = this.normalizeDefaultLaunchAgent(this.settings.defaultLaunchAgent);
|
|
626
|
+
this.applyCodexProfileToLegacySettings(this.settings.agentLaunchProfiles.codex);
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
getWorkspace() {
|
|
630
|
+
return this.settings ? this.settings.workspace : this.farmingDir;
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
getHeartbeatInterval() {
|
|
634
|
+
return this.settings ? (this.settings.heartbeatInterval || 1000) : 1000;
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
getDangerouslySkipAgentPermissionsByDefault() {
|
|
638
|
+
return this.settings ? this.settings.dangerouslySkipAgentPermissionsByDefault === true : false;
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
getCodexApprovalMode() {
|
|
642
|
+
if (!this.settings) return 'approve';
|
|
643
|
+
return this.getAgentLaunchProfile('codex').approvalMode;
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
getCodexRuntimeMode() {
|
|
647
|
+
if (!this.settings) return 'cli';
|
|
648
|
+
return this.normalizeCodexRuntimeMode(this.settings.codexRuntimeMode);
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
getCodexModelPreset() {
|
|
652
|
+
if (!this.settings) return 'gpt-5.5:xhigh';
|
|
653
|
+
return this.getAgentLaunchProfile('codex').modelPreset;
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
getCodexModel() {
|
|
657
|
+
if (!this.settings) return 'gpt-5.5';
|
|
658
|
+
return this.getAgentLaunchProfile('codex').model;
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
getCodexReasoningEffort() {
|
|
662
|
+
if (!this.settings) return 'xhigh';
|
|
663
|
+
return this.getAgentLaunchProfile('codex').reasoningEffort;
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
getCodexServiceTier() {
|
|
667
|
+
if (!this.settings) return 'default';
|
|
668
|
+
return this.getAgentLaunchProfile('codex').serviceTier;
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
|
|
672
|
+
getAgentHomes(provider) {
|
|
673
|
+
const homes = this.settings && this.settings.agentHomes && this.settings.agentHomes[provider]
|
|
674
|
+
? this.settings.agentHomes[provider]
|
|
675
|
+
: [];
|
|
676
|
+
return homes.map(home => ({ ...home, path: this.expandWorkspacePath(home.path) }));
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
getAgentHome(provider, homeId = 'default') {
|
|
680
|
+
const normalizedProvider = String(provider || '').trim().toLowerCase();
|
|
681
|
+
const normalizedHomeId = String(homeId || 'default').trim();
|
|
682
|
+
const homes = this.getAgentHomes(normalizedProvider);
|
|
683
|
+
return homes.find(home => home.id === normalizedHomeId) || null;
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
getDefaultLaunchAgent() {
|
|
687
|
+
return this.settings ? this.normalizeDefaultLaunchAgent(this.settings.defaultLaunchAgent) : 'codex';
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
getAgentLaunchProfiles() {
|
|
691
|
+
const profiles = this.settings && this.settings.agentLaunchProfiles
|
|
692
|
+
? this.settings.agentLaunchProfiles
|
|
693
|
+
: DEFAULT_AGENT_LAUNCH_PROFILES;
|
|
694
|
+
return {
|
|
695
|
+
codex: { ...profiles.codex },
|
|
696
|
+
claude: { ...profiles.claude },
|
|
697
|
+
};
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
getAgentLaunchProfile(agentName) {
|
|
701
|
+
const profiles = this.getAgentLaunchProfiles();
|
|
702
|
+
const profile = profiles[agentName] || DEFAULT_AGENT_LAUNCH_PROFILES[agentName];
|
|
703
|
+
return profile ? { ...profile } : {};
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
getSettings() {
|
|
707
|
+
return {
|
|
708
|
+
...this.settings,
|
|
709
|
+
workspace: this.farmingDir,
|
|
710
|
+
mainPageSessionKeys: this.getMainPageSessionKeys(),
|
|
711
|
+
taskHistory: this.getTaskHistory(),
|
|
712
|
+
};
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
getMainPageSessionKeys() {
|
|
716
|
+
return this.sessionStore ? this.sessionStore.getMainPageSessionKeys() : [];
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
setMainPageSessionKeys(keys) {
|
|
720
|
+
return this.sessionStore ? this.sessionStore.setMainPageSessionKeys(keys) : [];
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
rememberMainPageSessionKey(sessionKey, patch = {}) {
|
|
724
|
+
return this.sessionStore ? this.sessionStore.rememberMainPageSessionKey(sessionKey, patch) : [];
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
removeMainPageSessionKey(sessionKey) {
|
|
728
|
+
return this.sessionStore ? this.sessionStore.removeMainPageSessionKey(sessionKey) : false;
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
removeMainPageSessionKeys(keys) {
|
|
732
|
+
return this.sessionStore ? this.sessionStore.removeMainPageSessionKeys(keys) : [];
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
ensureAgentSessionRecord(agent, patch = {}) {
|
|
736
|
+
return this.sessionStore ? this.sessionStore.ensureRecordForAgent(agent, patch) : '';
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
setProviderSessionDisplayState(sessionKey, patch = {}) {
|
|
740
|
+
return this.sessionStore ? this.sessionStore.setProviderSessionDisplayState(sessionKey, patch) : '';
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
listAgentSessionRecords() {
|
|
744
|
+
return this.sessionStore ? this.sessionStore.listAgentRecords() : [];
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
rememberAgentSessionRecord(agent) {
|
|
748
|
+
return this.sessionStore ? this.sessionStore.rememberAgent(agent) : '';
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
getTaskHistory() {
|
|
752
|
+
return this.runHistoryStore ? this.runHistoryStore.getEntries() : [];
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
writeSettingsFile() {
|
|
756
|
+
fs.mkdirSync(this.farmingDir, { recursive: true });
|
|
757
|
+
fs.writeFileSync(this.settingsFile, JSON.stringify(this.settings, null, 2));
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
appendTaskHistory(entry) {
|
|
761
|
+
if (!this.runHistoryStore) return;
|
|
762
|
+
this.runHistoryStore.appendEntry(entry);
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
updateSettings(newSettings) {
|
|
766
|
+
const incomingMainPageSessionKeys = Object.prototype.hasOwnProperty.call(newSettings || {}, 'mainPageSessionKeys')
|
|
767
|
+
? newSettings.mainPageSessionKeys
|
|
768
|
+
: undefined;
|
|
769
|
+
const settingsPatch = { ...(newSettings || {}) };
|
|
770
|
+
delete settingsPatch.mainPageSessionKeys;
|
|
771
|
+
const incomingTaskHistory = Object.prototype.hasOwnProperty.call(settingsPatch, 'taskHistory')
|
|
772
|
+
? settingsPatch.taskHistory
|
|
773
|
+
: undefined;
|
|
774
|
+
delete settingsPatch.taskHistory;
|
|
775
|
+
const previousMainWorkspace = this.settings.lastMainWorkspace || this.farmingDir;
|
|
776
|
+
const previousProfiles = this.settings.agentLaunchProfiles || {};
|
|
777
|
+
const incomingProfiles = settingsPatch.agentLaunchProfiles || {};
|
|
778
|
+
this.settings = {
|
|
779
|
+
...this.settings,
|
|
780
|
+
...settingsPatch,
|
|
781
|
+
agentLaunchProfiles: this.mergeAgentLaunchProfiles(previousProfiles, incomingProfiles),
|
|
782
|
+
workspace: this.farmingDir
|
|
783
|
+
};
|
|
784
|
+
this.settings.lastMainWorkspace = this.normalizeMainWorkspace(this.settings.lastMainWorkspace, previousMainWorkspace);
|
|
785
|
+
this.settings.workspaceHistory = this.normalizeWorkspaceHistory(this.settings.workspaceHistory);
|
|
786
|
+
this.settings.projectNames = this.normalizeProjectNames(this.settings.projectNames);
|
|
787
|
+
this.settings.agentHomes = this.normalizeAgentHomes(this.settings.agentHomes);
|
|
788
|
+
this.settings.updateUrl = this.normalizeUpdateUrl(this.settings.updateUrl);
|
|
789
|
+
this.settings.searchTimeoutMs = this.normalizeSearchTimeoutMs(this.settings.searchTimeoutMs);
|
|
790
|
+
this.settings.codexRuntimeMode = this.normalizeCodexRuntimeMode(this.settings.codexRuntimeMode);
|
|
791
|
+
delete this.settings.mainPageSessionKeys;
|
|
792
|
+
delete this.settings.taskHistory;
|
|
793
|
+
if (incomingMainPageSessionKeys !== undefined) {
|
|
794
|
+
this.setMainPageSessionKeys(incomingMainPageSessionKeys);
|
|
795
|
+
}
|
|
796
|
+
if (incomingTaskHistory !== undefined && this.runHistoryStore) {
|
|
797
|
+
this.runHistoryStore.setEntries(incomingTaskHistory);
|
|
798
|
+
}
|
|
799
|
+
this.settings.appearance = this.normalizeAppearance(this.settings.appearance);
|
|
800
|
+
this.settings.language = this.normalizeLanguage(this.settings.language);
|
|
801
|
+
this.settings.crtSkinEffectsEnabled = this.settings.crtSkinEffectsEnabled !== false;
|
|
802
|
+
this.settings.crtDynamicHeatEnabled = this.settings.crtDynamicHeatEnabled === true;
|
|
803
|
+
this.settings.crtTerminalFontSize = this.normalizeCrtTerminalFontSize(this.settings.crtTerminalFontSize);
|
|
804
|
+
this.normalizeAgentLaunchSettings(settingsPatch);
|
|
805
|
+
this.pruneUnknownSettings();
|
|
806
|
+
this.writeSettingsFile();
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
module.exports = ConfigManager;
|
|
811
|
+
module.exports.DEFAULT_UPDATE_URL = DEFAULT_UPDATE_URL;
|
|
812
|
+
module.exports.DEFAULT_SEARCH_TIMEOUT_MS = DEFAULT_SEARCH_TIMEOUT_MS;
|
|
813
|
+
module.exports.DEFAULT_CRT_TERMINAL_FONT_SIZE = DEFAULT_CRT_TERMINAL_FONT_SIZE;
|
|
814
|
+
module.exports.MIN_CRT_TERMINAL_FONT_SIZE = MIN_CRT_TERMINAL_FONT_SIZE;
|
|
815
|
+
module.exports.MAX_CRT_TERMINAL_FONT_SIZE = MAX_CRT_TERMINAL_FONT_SIZE;
|