farming-code 2.2.29 → 2.2.32

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.
Files changed (385) hide show
  1. package/README.md +25 -66
  2. package/README.zh_cn.md +15 -66
  3. package/THIRD_PARTY_NOTICES.md +7 -0
  4. package/backend/acp/{client-services.js → client-services.cjs} +132 -134
  5. package/backend/acp/packaged-claude-acp.cjs +37 -0
  6. package/backend/acp/packaged-codex-acp.cjs +37 -0
  7. package/backend/acp/patch-decisions.cjs +182 -0
  8. package/backend/acp/permission-security.cjs +131 -0
  9. package/backend/{acp-checkpoint-store.js → acp-checkpoint-store.cjs} +90 -59
  10. package/backend/{acp-runtime.js → acp-runtime.cjs} +1219 -1125
  11. package/backend/acp-session-state.cjs +622 -0
  12. package/backend/acp-transcript.cjs +525 -0
  13. package/backend/agent-env.cjs +257 -0
  14. package/backend/agent-extension-discovery.cjs +452 -0
  15. package/backend/agent-extension-inventory.cjs +116 -0
  16. package/backend/agent-json-stream.cjs +283 -0
  17. package/backend/agent-lifecycle-journal.cjs +185 -0
  18. package/backend/{agent-manager.js → agent-manager.cjs} +3116 -4275
  19. package/backend/agent-order-transaction.cjs +85 -0
  20. package/backend/agent-order.cjs +159 -0
  21. package/backend/agent-provider-session.cjs +98 -0
  22. package/backend/agent-runtime-binding.cjs +179 -0
  23. package/backend/agent-session-history.cjs +1022 -0
  24. package/backend/agent-session-inventory.cjs +291 -0
  25. package/backend/async-cache.cjs +104 -0
  26. package/backend/atomic-json-store.cjs +67 -0
  27. package/backend/auth.cjs +261 -0
  28. package/backend/authoritative-inventory-cache.cjs +383 -0
  29. package/backend/business-health.cjs +68 -0
  30. package/backend/chat-runtime.cjs +50 -0
  31. package/backend/claude-settings.cjs +132 -0
  32. package/backend/cli-agents.cjs +435 -0
  33. package/backend/codex-context-window.cjs +196 -0
  34. package/backend/codex-models.cjs +228 -0
  35. package/backend/codex-session-archive.cjs +82 -0
  36. package/backend/codex-session-history.cjs +590 -0
  37. package/backend/{codex-terminal-profile.js → codex-terminal-profile.cjs} +149 -155
  38. package/backend/codex-transcript-sanitizer.cjs +130 -0
  39. package/backend/codex-transcript.cjs +2107 -0
  40. package/backend/command-runner-child.cjs +105 -0
  41. package/backend/config-manager.cjs +1263 -0
  42. package/backend/control-api.cjs +439 -0
  43. package/backend/data/LICENSE.cua +21 -0
  44. package/backend/executable-discovery.cjs +204 -0
  45. package/backend/farming-agent-bootstrap.cjs +81 -0
  46. package/backend/farming-agent-bootstrap.zh_cn.md +6 -2
  47. package/backend/{farming-app-cli.js → farming-app-cli.cjs} +441 -493
  48. package/backend/farming-cli.cjs +414 -0
  49. package/backend/farming-net-pass.cjs +319 -0
  50. package/backend/farming-net-registry.cjs +123 -0
  51. package/backend/farming-net-server.cjs +309 -0
  52. package/backend/farming-session-store.cjs +651 -0
  53. package/backend/git-worktree-info.cjs +181 -0
  54. package/backend/haiku-token.cjs +828 -0
  55. package/backend/index-html.cjs +96 -0
  56. package/backend/input-parts.cjs +68 -0
  57. package/backend/input-routing.cjs +40 -0
  58. package/backend/{local-session-engine.js → local-session-engine.cjs} +276 -282
  59. package/backend/main-agent-skills.cjs +309 -0
  60. package/backend/main-page-session.cjs +132 -0
  61. package/backend/native-pty-controller-generation.cjs +139 -0
  62. package/backend/{native-pty-host-client.js → native-pty-host-client.cjs} +338 -346
  63. package/backend/native-pty-host-identity.cjs +125 -0
  64. package/backend/native-pty-host-path.cjs +68 -0
  65. package/backend/{native-pty-host.js → native-pty-host.cjs} +480 -569
  66. package/backend/native-session-engine.cjs +296 -0
  67. package/backend/network.cjs +57 -0
  68. package/backend/npm-update-helper.cjs +399 -0
  69. package/backend/packaged-node-pty.cjs +120 -0
  70. package/backend/preview-session-manager.cjs +89 -0
  71. package/backend/provider-adapters.cjs +492 -0
  72. package/backend/provider-home-configuration.cjs +211 -0
  73. package/backend/provider-session-id.cjs +79 -0
  74. package/backend/provider-session-service.cjs +333 -0
  75. package/backend/qr-share-tickets.cjs +119 -0
  76. package/backend/resource-broadcast-protocol.cjs +50 -0
  77. package/backend/review-diff-router.cjs +202 -0
  78. package/backend/review-diff-service.cjs +1267 -0
  79. package/backend/review-session-router.cjs +93 -0
  80. package/backend/review-session-service.cjs +470 -0
  81. package/backend/review-session-store.cjs +161 -0
  82. package/backend/review-state-router.cjs +132 -0
  83. package/backend/review-state-store.cjs +299 -0
  84. package/backend/run-history-store.cjs +97 -0
  85. package/backend/runtime-dependency-manager.cjs +893 -0
  86. package/backend/runtime-executable-invocation.cjs +37 -0
  87. package/backend/runtime-observation.cjs +96 -0
  88. package/backend/server-process-identity.cjs +70 -0
  89. package/backend/server.cjs +3356 -0
  90. package/backend/session-engine-bridge.cjs +144 -0
  91. package/backend/session-engine-router.cjs +105 -0
  92. package/backend/session-engine.cjs +64 -0
  93. package/backend/session-stream-protocol.cjs +181 -0
  94. package/backend/shell-busy-integration.cjs +442 -0
  95. package/backend/slash-command-discovery.cjs +423 -0
  96. package/backend/storage-layout.cjs +263 -0
  97. package/backend/system-monitor.cjs +96 -0
  98. package/backend/terminal-attach-checkpoint.cjs +73 -0
  99. package/backend/terminal-exit-quiescence.cjs +57 -0
  100. package/backend/{terminal-reducer-flow-control.js → terminal-reducer-flow-control.cjs} +45 -22
  101. package/backend/terminal-runtime-cleanup.cjs +99 -0
  102. package/backend/{terminal-screen-state.js → terminal-screen-state.cjs} +100 -108
  103. package/backend/{terminal-screen-worker-pool.js → terminal-screen-worker-pool.cjs} +89 -79
  104. package/backend/{terminal-screen-worker-thread.js → terminal-screen-worker-thread.cjs} +64 -65
  105. package/backend/terminal-screen-worker.cjs +352 -0
  106. package/backend/terminal-state-serialization.cjs +147 -0
  107. package/backend/{terminal-status.js → terminal-status.cjs} +137 -187
  108. package/backend/theme-manager.cjs +185 -0
  109. package/backend/update-service.cjs +675 -0
  110. package/backend/usage-forecast.cjs +95 -0
  111. package/backend/{usage-history-client.js → usage-history-client.cjs} +144 -94
  112. package/backend/usage-history-smoke.cjs +85 -0
  113. package/backend/usage-history-worker.cjs +60 -0
  114. package/backend/{usage-monitor.js → usage-monitor.cjs} +363 -390
  115. package/backend/workspace-directory.cjs +239 -0
  116. package/backend/workspace-discovery.cjs +271 -0
  117. package/backend/{workspace-file-router.js → workspace-file-router.cjs} +213 -282
  118. package/backend/{workspace-file-service.js → workspace-file-service.cjs} +1139 -1318
  119. package/backend/workspace-root-registry.cjs +192 -0
  120. package/bin/farming +1 -1
  121. package/config/farming.deploy.env.example +1 -1
  122. package/config/farming.install.env.example +1 -1
  123. package/dist/acp/codex-acp-1.1.4.mjs +405 -8
  124. package/dist/assets/App-BCkdpWB6.css +1 -0
  125. package/dist/assets/App-CRjKpaGp.js +697 -0
  126. package/dist/assets/CodeSelect-Ci8sKZPU.js +1 -0
  127. package/dist/assets/CodeSelect-T2eNzrOc.css +1 -0
  128. package/dist/assets/{FileEditorMarkdownPreview-Cs9cLv8a.js → FileEditorMarkdownPreview-V06QHlAg.js} +55 -55
  129. package/dist/assets/FileEditorPane-BX-Wjg9U.js +2 -0
  130. package/dist/assets/IconGlyphs-YhV7tqd4.js +1 -0
  131. package/dist/assets/ProjectFilesSection-BDT2_r0o.js +12 -0
  132. package/dist/assets/ReviewPage-BqAs5sG1.js +3 -0
  133. package/dist/assets/code-dark-B7eM_9G9.css +1 -0
  134. package/dist/assets/{cssMode-Bdg5RpcJ.js → cssMode-ADdAlxTO.js} +1 -1
  135. package/dist/assets/{editor.api2-D74ufkbr.js → editor.api2-BFLAr0YF.js} +162 -162
  136. package/dist/assets/file-icons-BpeqWkIB.js +1 -0
  137. package/dist/assets/{freemarker2-DfMDJfnE.js → freemarker2-C90q5jrp.js} +1 -1
  138. package/dist/assets/{handlebars-BEdPtzMT.js → handlebars-BwUQcEDq.js} +1 -1
  139. package/dist/assets/{html-B1fPb1QD.js → html-1s3uPKfh.js} +1 -1
  140. package/dist/assets/{htmlMode-CY2ZjHxH.js → htmlMode-xtKD99de.js} +1 -1
  141. package/dist/assets/{index-CQNaZc3l.js → index-C8MchCem.js} +3 -3
  142. package/dist/assets/{javascript-BV2OsWA0.js → javascript-Ph7ijyny.js} +1 -1
  143. package/dist/assets/{jsonMode-zd07aeuX.js → jsonMode-D-jGAnFH.js} +1 -1
  144. package/dist/assets/linkComputer-CbGyI_qx.js +1 -0
  145. package/dist/assets/{liquid-BParI24X.js → liquid-0IamE_cI.js} +1 -1
  146. package/dist/assets/{lspLanguageFeatures-BzredkoV.js → lspLanguageFeatures-BxnQunWF.js} +1 -1
  147. package/dist/assets/main-CLKXa6hf.css +1 -0
  148. package/dist/assets/{mdx-vGzUJN98.js → mdx-DdNmfivn.js} +1 -1
  149. package/dist/assets/{monaco.contribution-BmaeBQEc.js → monaco.contribution-B43jsUs1.js} +2 -2
  150. package/dist/assets/{python-CUwdLgsI.js → python-IAt4X5TS.js} +1 -1
  151. package/dist/assets/{razor-BScebUxU.js → razor-DRkFYW0S.js} +1 -1
  152. package/dist/assets/review-C8-oPKXk.css +1 -0
  153. package/dist/assets/{tsMode-DzUAibXK.js → tsMode-_d_4U2gf.js} +1 -1
  154. package/dist/assets/{typescript-D9EOeM7N.js → typescript-C7zcMq9l.js} +1 -1
  155. package/dist/assets/{workers-DAiomYZM.js → workers-D0nOyJzf.js} +1 -1
  156. package/dist/assets/workspace-editor-model-DND_Y-Bj.js +1 -0
  157. package/dist/assets/workspace-editor-monaco-BPWhgcIB.js +4 -0
  158. package/dist/assets/workspace-editor-monaco-N641qPjX.js +1 -0
  159. package/dist/assets/workspace-view-state-k1bTlJ_Z.js +13 -0
  160. package/dist/assets/{xml-wWl1dhkQ.js → xml-BR-HvxT8.js} +1 -1
  161. package/dist/assets/{yaml-Dc2WDaOZ.js → yaml-YtFQwh4q.js} +1 -1
  162. package/dist/index.html +2 -1
  163. package/extensions/browser/backend/agent-browser-runtime.cjs +1040 -0
  164. package/extensions/browser/backend/agent-capability.cjs +85 -0
  165. package/extensions/browser/backend/browser-mcp-server.cjs +655 -0
  166. package/extensions/browser/backend/browser-resource-manager.cjs +1486 -0
  167. package/extensions/browser/backend/browser-resource-store.cjs +228 -0
  168. package/extensions/browser/backend/browser-router.cjs +203 -0
  169. package/extensions/browser/backend/executable-discovery.cjs +248 -0
  170. package/extensions/browser/backend/farming-browser-client.cjs +116 -0
  171. package/extensions/browser/backend/index.cjs +32 -0
  172. package/extensions/browser/backend/managed-chromium-installer.cjs +833 -0
  173. package/extensions/browser/bin/farming-browser +16 -7
  174. package/extensions/computer/backend/agent-capability.cjs +72 -0
  175. package/extensions/computer/backend/computer-constants.cjs +59 -0
  176. package/extensions/computer/backend/computer-mcp-server.cjs +182 -0
  177. package/extensions/computer/backend/computer-resource-manager.cjs +1219 -0
  178. package/extensions/computer/backend/computer-resource-store.cjs +190 -0
  179. package/extensions/computer/backend/computer-router.cjs +257 -0
  180. package/extensions/computer/backend/cua-tools.json +3067 -0
  181. package/extensions/computer/backend/farming-computer-client.cjs +84 -0
  182. package/extensions/computer/backend/index.cjs +35 -0
  183. package/extensions/computer/backend/isolated-browser-provider.cjs +157 -0
  184. package/extensions/computer/bin/farming-computer +131 -0
  185. package/frontend/farming-net/app.js +255 -262
  186. package/frontend/ghostty-loader.js +24 -20
  187. package/frontend/reading-anchor.js +210 -193
  188. package/frontend/runtime-paths.js +24 -26
  189. package/frontend/session-bridge.js +90 -111
  190. package/frontend/session-modal-bridge.js +184 -302
  191. package/frontend/skin-bridge.js +20 -23
  192. package/frontend/skins/crt/app.js +7686 -7901
  193. package/frontend/skins/crt/effects.js +7 -6
  194. package/frontend/skins/crt/index.html +6 -6
  195. package/frontend/skins/crt/styles/markdown.css +4 -4
  196. package/frontend/terminal-bridge.js +174 -181
  197. package/frontend/terminal-replay.js +320 -345
  198. package/frontend/theme-loader.js +55 -71
  199. package/index.html +1 -0
  200. package/package.json +64 -37
  201. package/shared/backend-connection-status.js +38 -69
  202. package/shared/browser-protocol.js +235 -110
  203. package/shared/websocket-liveness.js +40 -0
  204. package/backend/acp/packaged-claude-acp.js +0 -13
  205. package/backend/acp/packaged-codex-acp.js +0 -13
  206. package/backend/acp/patch-decisions.js +0 -153
  207. package/backend/acp/permission-security.js +0 -108
  208. package/backend/acp-session-state.js +0 -644
  209. package/backend/acp-transcript.js +0 -512
  210. package/backend/agent-env.js +0 -250
  211. package/backend/agent-json-stream.js +0 -268
  212. package/backend/agent-lifecycle-journal.js +0 -133
  213. package/backend/agent-memory-report.js +0 -583
  214. package/backend/agent-order.js +0 -166
  215. package/backend/agent-provider-session.js +0 -76
  216. package/backend/agent-runtime-binding.js +0 -174
  217. package/backend/agent-session-history.js +0 -953
  218. package/backend/async-cache.js +0 -94
  219. package/backend/atomic-json-store.js +0 -37
  220. package/backend/auth.js +0 -251
  221. package/backend/bundle-update-helper.js +0 -113
  222. package/backend/chat-runtime.js +0 -28
  223. package/backend/claude-settings.js +0 -121
  224. package/backend/cli-agents.js +0 -486
  225. package/backend/codex-context-window.js +0 -189
  226. package/backend/codex-models.js +0 -226
  227. package/backend/codex-rollout-follower.js +0 -326
  228. package/backend/codex-session-archive.js +0 -65
  229. package/backend/codex-session-history.js +0 -647
  230. package/backend/codex-transcript-sanitizer.js +0 -115
  231. package/backend/codex-transcript.js +0 -2564
  232. package/backend/command-runner-child.js +0 -67
  233. package/backend/config-manager.js +0 -1133
  234. package/backend/control-api.js +0 -455
  235. package/backend/executable-discovery.js +0 -216
  236. package/backend/farming-agent-bootstrap.js +0 -49
  237. package/backend/farming-cli.js +0 -457
  238. package/backend/farming-net-pass.js +0 -285
  239. package/backend/farming-net-registry.js +0 -112
  240. package/backend/farming-net-server.js +0 -298
  241. package/backend/farming-session-store.js +0 -677
  242. package/backend/git-worktree-info.js +0 -181
  243. package/backend/haiku-token.js +0 -772
  244. package/backend/index-html.js +0 -62
  245. package/backend/input-parts.js +0 -54
  246. package/backend/input-routing.js +0 -24
  247. package/backend/json-cli-runtime.js +0 -275
  248. package/backend/main-agent-skills.js +0 -305
  249. package/backend/main-page-session.js +0 -122
  250. package/backend/native-pty-controller-generation.js +0 -106
  251. package/backend/native-pty-host-identity.js +0 -86
  252. package/backend/native-pty-host-path.js +0 -42
  253. package/backend/native-session-engine.js +0 -268
  254. package/backend/network.js +0 -23
  255. package/backend/npm-update-helper.js +0 -374
  256. package/backend/packaged-node-pty.js +0 -99
  257. package/backend/preview-session-manager.js +0 -68
  258. package/backend/provider-adapters.js +0 -399
  259. package/backend/provider-session-id.js +0 -47
  260. package/backend/provider-session-service.js +0 -345
  261. package/backend/qr-share-tickets.js +0 -100
  262. package/backend/review-diff-router.js +0 -180
  263. package/backend/review-diff-service.js +0 -1270
  264. package/backend/review-session-router.js +0 -74
  265. package/backend/review-session-service.js +0 -446
  266. package/backend/review-session-store.js +0 -151
  267. package/backend/review-state-router.js +0 -116
  268. package/backend/review-state-store.js +0 -286
  269. package/backend/run-history-store.js +0 -67
  270. package/backend/runtime-dependency-manager.js +0 -759
  271. package/backend/runtime-executable-invocation.js +0 -20
  272. package/backend/runtime-observation.js +0 -81
  273. package/backend/server-process-identity.js +0 -47
  274. package/backend/server.js +0 -3267
  275. package/backend/session-engine-bridge.js +0 -129
  276. package/backend/session-engine-router.js +0 -66
  277. package/backend/session-engine.js +0 -39
  278. package/backend/session-stream-protocol.js +0 -185
  279. package/backend/shell-busy-integration.js +0 -472
  280. package/backend/slash-command-discovery.js +0 -433
  281. package/backend/storage-layout.js +0 -190
  282. package/backend/system-monitor.js +0 -77
  283. package/backend/terminal-attach-checkpoint.js +0 -74
  284. package/backend/terminal-exit-quiescence.js +0 -39
  285. package/backend/terminal-runtime-cleanup.js +0 -80
  286. package/backend/terminal-screen-worker.js +0 -337
  287. package/backend/terminal-state-serialization.js +0 -127
  288. package/backend/theme-manager.js +0 -163
  289. package/backend/update-service.js +0 -1545
  290. package/backend/usage-forecast.js +0 -86
  291. package/backend/usage-history-scanner.ts +0 -2718
  292. package/backend/usage-history-smoke.js +0 -64
  293. package/backend/usage-history-worker.js +0 -34
  294. package/backend/workspace-directory.js +0 -232
  295. package/backend/workspace-discovery.js +0 -311
  296. package/backend/workspace-root-registry.js +0 -166
  297. package/dist/assets/App-BKNUILuL.css +0 -1
  298. package/dist/assets/App-Ex2oVVXO.js +0 -693
  299. package/dist/assets/FileEditorPane-CNtuGjQ3.js +0 -2
  300. package/dist/assets/IconGlyphs-BClgag6E.js +0 -1
  301. package/dist/assets/ProjectFilesSection-Cf2BEcAN.js +0 -12
  302. package/dist/assets/ReviewPage-BRuxFaH5.js +0 -3
  303. package/dist/assets/code-dark-BEZTQwYZ.css +0 -1
  304. package/dist/assets/file-icons-BOlcJ0ZF.js +0 -1
  305. package/dist/assets/main-DK9Sy7-c.css +0 -1
  306. package/dist/assets/review-BcnwQtJv.css +0 -1
  307. package/dist/assets/workspace-editor-model-CSGCl21x.js +0 -1
  308. package/dist/assets/workspace-editor-monaco-CJNwbpCy.js +0 -4
  309. package/dist/assets/workspace-editor-monaco-CO9w8YV0.js +0 -1
  310. package/dist/assets/workspace-view-state-BjKPYp0E.js +0 -7
  311. package/extensions/browser/backend/agent-browser-runtime.js +0 -1041
  312. package/extensions/browser/backend/agent-capability.js +0 -55
  313. package/extensions/browser/backend/browser-mcp-server.js +0 -621
  314. package/extensions/browser/backend/browser-resource-manager.js +0 -1309
  315. package/extensions/browser/backend/browser-resource-store.js +0 -190
  316. package/extensions/browser/backend/browser-router.js +0 -133
  317. package/extensions/browser/backend/executable-discovery.js +0 -224
  318. package/extensions/browser/backend/farming-browser-client.js +0 -83
  319. package/extensions/browser/backend/index.js +0 -7
  320. package/extensions/browser/frontend/BrowserSidebarPortals.tsx +0 -360
  321. package/extensions/browser/frontend/BrowserViewer.tsx +0 -500
  322. package/extensions/browser/frontend/browser-resource-state.ts +0 -60
  323. package/extensions/browser/frontend/browser.css +0 -567
  324. package/extensions/browser/frontend/types.ts +0 -31
  325. package/extensions/browser/frontend/useBrowserResources.ts +0 -158
  326. package/frontend/vendor/ghostty-web/index.d.ts +0 -1842
  327. package/shared/backend-connection-status.d.ts +0 -37
  328. package/shared/browser-protocol.d.ts +0 -5
  329. /package/dist/assets/{api-w2x5QfxB.js → api-ByCV9MEr.js} +0 -0
  330. /package/dist/assets/{core-vPkV8P_m.js → core-Czwdx12k.js} +0 -0
  331. /package/dist/assets/{fsharp-DNZNZyEE.js → fsharp-BjPpkoJe.js} +0 -0
  332. /package/dist/assets/{go-_kPJjNc_.js → go-BkIDmSUP.js} +0 -0
  333. /package/dist/assets/{graphql-4HCNVt5g.js → graphql-CCJTpqi1.js} +0 -0
  334. /package/dist/assets/{hcl-C87ymY0o.js → hcl-s4z8lUFg.js} +0 -0
  335. /package/dist/assets/{ini-BYrrGNTc.js → ini-CyUW1I7Z.js} +0 -0
  336. /package/dist/assets/{java-B211rJbk.js → java-CFCcGRiM.js} +0 -0
  337. /package/dist/assets/{julia-DVPsRtBm.js → julia-DQyH_EYb.js} +0 -0
  338. /package/dist/assets/{kotlin-BYyNerjp.js → kotlin-B8hA5O51.js} +0 -0
  339. /package/dist/assets/{less-EC9UblGE.js → less-DaVdaas0.js} +0 -0
  340. /package/dist/assets/{lexon-B1yuUdqW.js → lexon-DLBhPd3y.js} +0 -0
  341. /package/dist/assets/{lua-Bo6GFzxT.js → lua-gB1c_cif.js} +0 -0
  342. /package/dist/assets/{m3-C-Y9cBVI.js → m3-C2T3z3gB.js} +0 -0
  343. /package/dist/assets/{markdown-BHu-wLbe.js → markdown-CKq-Euj1.js} +0 -0
  344. /package/dist/assets/{mips-Dkds26rX.js → mips-Bcs5qIDX.js} +0 -0
  345. /package/dist/assets/{msdax-PU4g-8_g.js → msdax-CBP48FHF.js} +0 -0
  346. /package/dist/assets/{mysql-fPpuGpS7.js → mysql-c7tiPcFj.js} +0 -0
  347. /package/dist/assets/{objective-c-Wy1e5JUf.js → objective-c-D4BZkeEV.js} +0 -0
  348. /package/dist/assets/{pascal-BIXwvrqU.js → pascal-CJDZg0MN.js} +0 -0
  349. /package/dist/assets/{pascaligo-DwR0AtL_.js → pascaligo-Bygi8Ynl.js} +0 -0
  350. /package/dist/assets/{perl-CGHAl8my.js → perl-aS8bkf7E.js} +0 -0
  351. /package/dist/assets/{pgsql-B91M73E2.js → pgsql-CzNAYFYl.js} +0 -0
  352. /package/dist/assets/{php-C70ttrCx.js → php-DOtoEFTT.js} +0 -0
  353. /package/dist/assets/{pla-BNrXaRh0.js → pla-DugRnao1.js} +0 -0
  354. /package/dist/assets/{postiats-Dv2IAZR9.js → postiats-DsXwusKh.js} +0 -0
  355. /package/dist/assets/{powerquery-CkY5Wq7J.js → powerquery-DL3o72oD.js} +0 -0
  356. /package/dist/assets/{powershell-uGIYLU3C.js → powershell-C1qHekys.js} +0 -0
  357. /package/dist/assets/{protobuf-CavfmJu-.js → protobuf-DHgsc-cH.js} +0 -0
  358. /package/dist/assets/{pug-Drqnyitx.js → pug-FZXlE_Iu.js} +0 -0
  359. /package/dist/assets/{qrcode-7uGsTEmi.js → qrcode-DJDTdjL7.js} +0 -0
  360. /package/dist/assets/{qsharp-C7yF-Dti.js → qsharp-bLyhI3DT.js} +0 -0
  361. /package/dist/assets/{r-HXLGP0_-.js → r-DjFGXbAa.js} +0 -0
  362. /package/dist/assets/{redis-C4y6mf2p.js → redis-DSoZ_V6u.js} +0 -0
  363. /package/dist/assets/{redshift-DdQrFPrv.js → redshift-CzkdCsrg.js} +0 -0
  364. /package/dist/assets/{restructuredtext-CBrf2PNj.js → restructuredtext-B_XPrGCQ.js} +0 -0
  365. /package/dist/assets/{ruby-CVtMoX2B.js → ruby-Cry2RneJ.js} +0 -0
  366. /package/dist/assets/{rust-Ckq4sbMP.js → rust-CWzdbFq1.js} +0 -0
  367. /package/dist/assets/{sb-er66OpE3.js → sb-DmofU59h.js} +0 -0
  368. /package/dist/assets/{scala-BdWZz-hH.js → scala-BUC2l-vN.js} +0 -0
  369. /package/dist/assets/{scheme-kTV_s2kP.js → scheme-CNIB_72f.js} +0 -0
  370. /package/dist/assets/{scss-Bymy2VJQ.js → scss-DcL4-NbX.js} +0 -0
  371. /package/dist/assets/{shell-bwEP1LQ1.js → shell-CgAGvSSA.js} +0 -0
  372. /package/dist/assets/{solidity-DCddeBgL.js → solidity-DSkt6O_P.js} +0 -0
  373. /package/dist/assets/{sophia-BMN3AQig.js → sophia--5ytcjDN.js} +0 -0
  374. /package/dist/assets/{sparql-CSXOLjzi.js → sparql-C1Srr7cD.js} +0 -0
  375. /package/dist/assets/{sql-COg8ewmK.js → sql-2k_O5fj7.js} +0 -0
  376. /package/dist/assets/{st-CIaZtBS_.js → st-DCCCPqfz.js} +0 -0
  377. /package/dist/assets/{swift-DXiOhUHu.js → swift-Dd8mAfOt.js} +0 -0
  378. /package/dist/assets/{systemverilog-BTDE6Dr2.js → systemverilog-B0-aZYXu.js} +0 -0
  379. /package/dist/assets/{tcl-B0zy9NvV.js → tcl-CZAZwPVX.js} +0 -0
  380. /package/dist/assets/{twig-D594l4Z1.js → twig-D-Ag0tdS.js} +0 -0
  381. /package/dist/assets/{typespec-XKVjaPqo.js → typespec-B7kTFp0Z.js} +0 -0
  382. /package/dist/assets/{useWorkspaceMenuKeyboard-Bpy_s69Z.js → useWorkspaceMenuKeyboard-uYZpDxhU.js} +0 -0
  383. /package/dist/assets/{vb-B2wYoKRV.js → vb-20w1JPum.js} +0 -0
  384. /package/dist/assets/{wgsl-D0Yf2LbK.js → wgsl-CLJfqFt0.js} +0 -0
  385. /package/dist/assets/{workspace-working-copy-C3FSR3N6.js → workspace-working-copy-Cfz07cOd.js} +0 -0
@@ -0,0 +1,1263 @@
1
+ // Generated by scripts/build-backend-runtime.ts. Do not edit.
2
+ "use strict";
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __export = (target, all) => {
10
+ for (var name in all)
11
+ __defProp(target, name, { get: all[name], enumerable: true });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from))
16
+ if (!__hasOwnProp.call(to, key) && key !== except)
17
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
18
+ }
19
+ return to;
20
+ };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
29
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
+ var config_manager_exports = {};
31
+ __export(config_manager_exports, {
32
+ ConfigManager: () => ConfigManager,
33
+ DEFAULT_CODE_CONTENT_FONT_SIZE: () => DEFAULT_CODE_CONTENT_FONT_SIZE,
34
+ DEFAULT_CRT_CONTENT_FONT_SIZE: () => DEFAULT_CRT_CONTENT_FONT_SIZE,
35
+ DEFAULT_CRT_TERMINAL_FONT_SIZE: () => DEFAULT_CRT_TERMINAL_FONT_SIZE,
36
+ DEFAULT_SEARCH_TIMEOUT_MS: () => DEFAULT_SEARCH_TIMEOUT_MS,
37
+ MAX_CONTENT_FONT_SIZE: () => MAX_CONTENT_FONT_SIZE,
38
+ MAX_CRT_TERMINAL_FONT_SIZE: () => MAX_CRT_TERMINAL_FONT_SIZE,
39
+ MIN_CONTENT_FONT_SIZE: () => MIN_CONTENT_FONT_SIZE,
40
+ MIN_CRT_TERMINAL_FONT_SIZE: () => MIN_CRT_TERMINAL_FONT_SIZE
41
+ });
42
+ module.exports = __toCommonJS(config_manager_exports);
43
+ var import_atomic_json_store = require("./atomic-json-store.cjs");
44
+ var import_main_agent_skills = require("./main-agent-skills.cjs");
45
+ var import_farming_agent_bootstrap = require("./farming-agent-bootstrap.cjs");
46
+ var import_claude_settings = require("./claude-settings.cjs");
47
+ var import_provider_session_id = require("./provider-session-id.cjs");
48
+ var import_farming_session_store = require("./farming-session-store.cjs");
49
+ var import_run_history_store = require("./run-history-store.cjs");
50
+ var import_cli_agents = require("./cli-agents.cjs");
51
+ var storageLayout = __toESM(require("./storage-layout.cjs"));
52
+ var import_computer_constants = require("../extensions/computer/backend/computer-constants.cjs");
53
+ const fs = require("fs");
54
+ const path = require("path");
55
+ const os = require("os");
56
+ function objectRecord(value) {
57
+ return value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
58
+ }
59
+ function objectProperty(value, key) {
60
+ return value !== null && typeof value === "object" ? value[key] : void 0;
61
+ }
62
+ function spreadableObject(value) {
63
+ return value !== null && typeof value === "object" ? value : {};
64
+ }
65
+ function validProjectOperationEntry(entry) {
66
+ const [id, operation] = entry;
67
+ const record = objectRecord(operation);
68
+ return PROJECT_OPERATION_ID_PATTERN.test(id) && record !== null && (record.type === "create-worktree" || record.type === "delete-worktree") && (record.state === "pending" || record.state === "unknown" || record.state === "succeeded" || record.state === "failed" || record.state === "blocked");
69
+ }
70
+ function splitCodexModelPreset(preset) {
71
+ if (preset === "config") {
72
+ return { model: "config", effort: "config" };
73
+ }
74
+ if (typeof preset !== "string") {
75
+ return { model: "config", effort: "config" };
76
+ }
77
+ const [model, effort] = preset.split(":");
78
+ return {
79
+ model: model || "config",
80
+ effort: effort || "config"
81
+ };
82
+ }
83
+ function joinCodexModelPreset(model, effort) {
84
+ if (model === "config") return "config";
85
+ return effort ? `${model}:${effort}` : model;
86
+ }
87
+ const DEFAULT_CODEX_LAUNCH_PROFILE = {
88
+ approvalMode: "approve",
89
+ model: "config",
90
+ reasoningEffort: "config",
91
+ serviceTier: "config",
92
+ modelPreset: "config"
93
+ };
94
+ const DEFAULT_CLAUDE_LAUNCH_PROFILE = {
95
+ permissionMode: "default",
96
+ model: "config",
97
+ effort: "config"
98
+ };
99
+ const DEFAULT_AGENT_LAUNCH_PROFILES = {
100
+ codex: DEFAULT_CODEX_LAUNCH_PROFILE,
101
+ claude: DEFAULT_CLAUDE_LAUNCH_PROFILE
102
+ };
103
+ const DEFAULT_LAUNCH_AGENT_NAMES = /* @__PURE__ */ new Set(["codex", "claude", "opencode", "qoder", "qwen", "bash", "zsh"]);
104
+ const DEFAULT_AGENT_HOMES = {
105
+ codex: [{
106
+ id: "default",
107
+ path: "~/.codex",
108
+ order: 0,
109
+ newAgentDefaults: { model: "inherit", reasoning: "inherit", fast: "inherit" }
110
+ }],
111
+ claude: [{
112
+ id: "default",
113
+ path: "~/.claude",
114
+ order: 1,
115
+ newAgentDefaults: { model: "inherit", reasoning: "inherit", fast: "inherit" }
116
+ }],
117
+ opencode: [{
118
+ id: "default",
119
+ path: "~/.opencode",
120
+ order: 2,
121
+ newAgentDefaults: { model: "inherit", reasoning: "inherit", fast: "inherit" }
122
+ }],
123
+ qoder: [{
124
+ id: "default",
125
+ path: "~/.qoder",
126
+ order: 3,
127
+ newAgentDefaults: { model: "inherit", reasoning: "inherit", fast: "inherit" }
128
+ }],
129
+ qwen: [{
130
+ id: "default",
131
+ path: "~/.qwen",
132
+ order: 4,
133
+ newAgentDefaults: { model: "inherit", reasoning: "inherit", fast: "inherit" }
134
+ }]
135
+ };
136
+ const LEGACY_DEFAULT_WORKSPACE_FILE_SEARCH_TIMEOUT_MS = 3e3;
137
+ const DEFAULT_SEARCH_TIMEOUT_MS = 15e3;
138
+ const MIN_SEARCH_TIMEOUT_MS = 3e3;
139
+ const MAX_SEARCH_TIMEOUT_MS = 18e4;
140
+ const DEFAULT_CODE_CONTENT_FONT_SIZE = 14;
141
+ const DEFAULT_CRT_CONTENT_FONT_SIZE = 14;
142
+ const MIN_CONTENT_FONT_SIZE = 10;
143
+ const MAX_CONTENT_FONT_SIZE = 20;
144
+ const DEFAULT_CRT_TERMINAL_FONT_SIZE = 15;
145
+ const MIN_CRT_TERMINAL_FONT_SIZE = 10;
146
+ const MAX_CRT_TERMINAL_FONT_SIZE = 20;
147
+ const MAX_INSTANCE_NAME_LENGTH = 80;
148
+ const MAX_PROJECT_OPERATIONS = 32;
149
+ const PROJECT_OPERATION_ID_PATTERN = /^[A-Za-z0-9._:-]{1,160}$/;
150
+ const PERSISTED_SETTING_KEYS = /* @__PURE__ */ new Set([
151
+ "workspace",
152
+ "lastMainWorkspace",
153
+ "workspaceHistory",
154
+ "projectWorkspaces",
155
+ "pinnedProjectWorkspaces",
156
+ "projectNames",
157
+ "projectOperations",
158
+ "instanceName",
159
+ "theme",
160
+ "appearance",
161
+ "language",
162
+ "restReminderIntervalSeconds",
163
+ "heartbeatInterval",
164
+ "dangerouslySkipAgentPermissionsByDefault",
165
+ "browserExtensionEnabled",
166
+ "browserSource",
167
+ "browserExecutablePath",
168
+ "browserExternalCdpUrl",
169
+ "computerExtensionEnabled",
170
+ "computerCompatibilityMode",
171
+ "computerImage",
172
+ "codeContentFontSize",
173
+ "composerFollowUpBehavior",
174
+ "crtContentFontSize",
175
+ "crtSkinEffectsEnabled",
176
+ "crtDynamicHeatEnabled",
177
+ "crtTerminalFontSize",
178
+ "defaultLaunchAgent",
179
+ "agentLaunchProfiles",
180
+ "agentHomes",
181
+ "searchTimeoutMs",
182
+ "codexApprovalMode",
183
+ "codexModel",
184
+ "codexReasoningEffort",
185
+ "codexServiceTier",
186
+ "codexModelPreset",
187
+ "version"
188
+ ]);
189
+ function cloneLaunchProfile(profile) {
190
+ return { ...profile };
191
+ }
192
+ function cloneAgentHomes(agentHomes) {
193
+ const cloned = {};
194
+ Object.entries(agentHomes || {}).forEach(([provider, homes]) => {
195
+ cloned[provider] = Array.isArray(homes) ? homes.map((home) => ({
196
+ ...home,
197
+ newAgentDefaults: { ...home.newAgentDefaults }
198
+ })) : [];
199
+ });
200
+ return cloned;
201
+ }
202
+ class ConfigManager {
203
+ farmingDir;
204
+ settings;
205
+ settingsFile;
206
+ sessionStore;
207
+ runHistoryStore;
208
+ writeJson;
209
+ constructor(options = {}) {
210
+ this.farmingDir = options.configDir || storageLayout.farmingConfigDir();
211
+ this.settingsFile = storageLayout.settingsFile(this.farmingDir);
212
+ this.sessionStore = new import_farming_session_store.FarmingSessionStore(this.farmingDir, {
213
+ normalizeMainPageSessionKeys: (keys) => this.normalizeMainPageSessionKeys(keys)
214
+ });
215
+ this.runHistoryStore = new import_run_history_store.RunHistoryStore(this.farmingDir, {
216
+ normalizeTaskHistory: (entries) => this.normalizeTaskHistory(entries)
217
+ });
218
+ this.writeJson = typeof options.writeJson === "function" ? options.writeJson : import_atomic_json_store.atomicWriteJson;
219
+ }
220
+ expandWorkspacePath(workspace) {
221
+ if (typeof workspace !== "string") return "";
222
+ const value = workspace.trim();
223
+ if (!value) return "";
224
+ if (value === "~") return os.homedir();
225
+ if (value.startsWith("~/")) return path.join(os.homedir(), value.slice(2));
226
+ return value;
227
+ }
228
+ canonicalAgentHomePath(homePath) {
229
+ const expanded = this.expandWorkspacePath(homePath);
230
+ if (!expanded) return "";
231
+ const resolved = path.resolve(expanded);
232
+ let canonical = resolved;
233
+ try {
234
+ canonical = fs.realpathSync.native(resolved);
235
+ } catch {
236
+ }
237
+ return process.platform === "win32" ? canonical.toLowerCase() : canonical;
238
+ }
239
+ agentHomeBindings(records = this.listAgentSessionRecords()) {
240
+ const bindings = /* @__PURE__ */ new Map();
241
+ for (const record of records) {
242
+ const provider = String(record.provider || "").trim().toLowerCase();
243
+ const providerHomeId = String(record.providerHomeId || "default").trim() || "default";
244
+ const providerHomePath = this.expandWorkspacePath(record.providerHomePath);
245
+ if (!provider || !providerHomePath) continue;
246
+ const key = `${provider}\0${providerHomeId}`;
247
+ const existing = bindings.get(key);
248
+ if (existing && this.canonicalAgentHomePath(existing.providerHomePath) !== this.canonicalAgentHomePath(providerHomePath)) {
249
+ const error = new Error(
250
+ `${provider} Agent Home "${providerHomeId}" has persisted sessions in more than one path`
251
+ );
252
+ error.code = "AGENT_HOME_BINDING_CONFLICT";
253
+ error.status = 409;
254
+ throw error;
255
+ }
256
+ bindings.set(key, { provider, providerHomeId, providerHomePath });
257
+ }
258
+ return [...bindings.values()];
259
+ }
260
+ assertAgentHomeBindings(nextHomes) {
261
+ for (const binding of this.agentHomeBindings()) {
262
+ const configured = (nextHomes[binding.provider] || []).find((home) => home.id === binding.providerHomeId);
263
+ if (configured && this.canonicalAgentHomePath(configured.path) !== this.canonicalAgentHomePath(binding.providerHomePath)) {
264
+ const error = new Error(
265
+ `${binding.provider} Agent Home "${binding.providerHomeId}" already owns persisted Agent sessions at ${binding.providerHomePath}`
266
+ );
267
+ error.code = "AGENT_HOME_REFERENCED";
268
+ error.status = 409;
269
+ throw error;
270
+ }
271
+ }
272
+ }
273
+ isTemporaryWorkspace(workspace) {
274
+ const resolved = path.resolve(this.expandWorkspacePath(workspace));
275
+ return resolved === "/tmp" || resolved.startsWith("/tmp/") || resolved === "/private/tmp" || resolved.startsWith("/private/tmp/") || resolved === "/var/tmp" || resolved.startsWith("/var/tmp/") || resolved === "/private/var/tmp" || resolved.startsWith("/private/var/tmp/") || resolved === "/var/folders" || resolved.startsWith("/var/folders/") || resolved === "/private/var/folders" || resolved.startsWith("/private/var/folders/");
276
+ }
277
+ isUsableWorkspace(workspace) {
278
+ const expanded = this.expandWorkspacePath(workspace);
279
+ if (!expanded || this.isTemporaryWorkspace(expanded)) return false;
280
+ try {
281
+ return fs.statSync(expanded).isDirectory();
282
+ } catch {
283
+ return false;
284
+ }
285
+ }
286
+ isInternalWorkspace(workspace) {
287
+ const expanded = this.expandWorkspacePath(workspace);
288
+ if (!expanded) return false;
289
+ const resolvedWorkspace = path.resolve(expanded);
290
+ const resolvedFarmingDir = path.resolve(this.farmingDir);
291
+ return resolvedWorkspace === resolvedFarmingDir || path.basename(resolvedWorkspace) === ".farming";
292
+ }
293
+ normalizeMainWorkspace(workspace, fallback = this.farmingDir) {
294
+ const expanded = this.expandWorkspacePath(workspace);
295
+ if (this.isUsableWorkspace(expanded)) {
296
+ return expanded;
297
+ }
298
+ const expandedFallback = this.expandWorkspacePath(fallback);
299
+ if (this.isUsableWorkspace(expandedFallback)) {
300
+ return expandedFallback;
301
+ }
302
+ return this.farmingDir;
303
+ }
304
+ normalizeInstanceName(value) {
305
+ if (typeof value !== "string") return "";
306
+ return value.replace(/[\x00-\x1f\x7f]/g, " ").replace(/\s+/g, " ").trim().slice(0, MAX_INSTANCE_NAME_LENGTH);
307
+ }
308
+ getInstanceName() {
309
+ return this.settings?.instanceName || this.normalizeInstanceName(os.hostname()) || "Farming";
310
+ }
311
+ normalizeWorkspaceHistory(history) {
312
+ const entries = Array.isArray(history) ? history : [];
313
+ const result = [];
314
+ const seen = /* @__PURE__ */ new Set();
315
+ for (const entry of entries) {
316
+ const expanded = this.expandWorkspacePath(entry);
317
+ if (!this.isUsableWorkspace(expanded) || this.isInternalWorkspace(expanded) || seen.has(expanded)) continue;
318
+ seen.add(expanded);
319
+ result.push(expanded);
320
+ }
321
+ return result.slice(0, 5);
322
+ }
323
+ normalizeProjectWorkspaces(projects) {
324
+ const entries = Array.isArray(projects) ? projects : [];
325
+ const result = [];
326
+ const seen = /* @__PURE__ */ new Set();
327
+ for (const entry of entries) {
328
+ const expanded = this.expandWorkspacePath(entry);
329
+ if (!expanded) continue;
330
+ const resolved = path.resolve(expanded);
331
+ if (this.isInternalWorkspace(resolved)) continue;
332
+ let canonical = resolved;
333
+ try {
334
+ canonical = fs.realpathSync(resolved);
335
+ } catch {
336
+ }
337
+ if (this.isInternalWorkspace(canonical)) continue;
338
+ if (seen.has(canonical)) continue;
339
+ seen.add(canonical);
340
+ result.push(canonical);
341
+ }
342
+ return result.slice(0, 200);
343
+ }
344
+ normalizeMainPageSessionKeys(keys) {
345
+ const entries = Array.isArray(keys) ? keys : [];
346
+ const result = [];
347
+ const seen = /* @__PURE__ */ new Set();
348
+ for (const entry of entries) {
349
+ if (typeof entry !== "string") continue;
350
+ const value = entry.trim();
351
+ if (!/^agent-session:[a-z][a-z0-9_-]*:.+$/i.test(value)) continue;
352
+ const sessionId = value.replace(/^agent-session:[^:]+:/i, "");
353
+ if (sessionId.startsWith("-")) continue;
354
+ if ((0, import_provider_session_id.isTemporaryProviderSessionId)(sessionId)) continue;
355
+ if (seen.has(value)) continue;
356
+ seen.add(value);
357
+ result.push(value);
358
+ }
359
+ return result.slice(0, import_farming_session_store.MAX_MAIN_PAGE_SESSION_KEYS);
360
+ }
361
+ normalizeTaskHistory(history) {
362
+ const entries = Array.isArray(history) ? history : [];
363
+ const normalized = [];
364
+ for (const entry of entries) {
365
+ const record = objectRecord(entry);
366
+ if (!record) continue;
367
+ if (typeof record.id !== "string" || !record.id) continue;
368
+ if (typeof record.agentId !== "string" || !record.agentId) continue;
369
+ if (typeof record.reason !== "string" || !record.reason) continue;
370
+ if (typeof record.archivedAt !== "number" || !Number.isFinite(record.archivedAt)) continue;
371
+ if (!(0, import_cli_agents.isSupportedHistoryAgent)(record.command)) continue;
372
+ normalized.push({
373
+ id: record.id,
374
+ agentId: record.agentId,
375
+ command: typeof record.command === "string" ? record.command : "",
376
+ cwd: typeof record.cwd === "string" ? record.cwd : "",
377
+ projectWorkspace: typeof record.projectWorkspace === "string" ? record.projectWorkspace : "",
378
+ title: typeof record.title === "string" ? record.title : "",
379
+ customTitle: typeof record.customTitle === "string" ? record.customTitle.trim().slice(0, 80) : "",
380
+ task: typeof record.task === "string" ? record.task : "",
381
+ workflowTemplate: typeof record.workflowTemplate === "string" ? record.workflowTemplate : "",
382
+ source: typeof record.source === "string" ? record.source : "ui",
383
+ reason: record.reason,
384
+ status: typeof record.status === "string" ? record.status : "stopped",
385
+ startedAt: typeof record.startedAt === "number" ? record.startedAt : null,
386
+ lastActivity: typeof record.lastActivity === "number" ? record.lastActivity : null,
387
+ archivedAt: record.archivedAt
388
+ });
389
+ }
390
+ return normalized.sort((a, b) => b.archivedAt - a.archivedAt).slice(0, 200);
391
+ }
392
+ init() {
393
+ if (!fs.existsSync(this.farmingDir)) {
394
+ fs.mkdirSync(this.farmingDir, { recursive: true });
395
+ console.log("Created farming directory:", this.farmingDir);
396
+ }
397
+ if (!fs.existsSync(this.settingsFile)) {
398
+ const defaultSettings = {
399
+ workspace: this.farmingDir,
400
+ lastMainWorkspace: this.farmingDir,
401
+ workspaceHistory: [],
402
+ projectWorkspaces: [],
403
+ pinnedProjectWorkspaces: [],
404
+ projectNames: {},
405
+ projectOperations: {},
406
+ instanceName: "",
407
+ theme: "terminal",
408
+ appearance: "system",
409
+ language: "en",
410
+ restReminderIntervalSeconds: null,
411
+ heartbeatInterval: 1e3,
412
+ dangerouslySkipAgentPermissionsByDefault: false,
413
+ browserExtensionEnabled: false,
414
+ browserSource: process.env.FARMING_BROWSER_CDP_URL ? "external-cdp" : "system",
415
+ browserExecutablePath: process.env.FARMING_BROWSER_EXECUTABLE || "",
416
+ browserExternalCdpUrl: process.env.FARMING_BROWSER_CDP_URL || "http://127.0.0.1:9222",
417
+ computerExtensionEnabled: false,
418
+ computerCompatibilityMode: false,
419
+ computerImage: import_computer_constants.COMPUTER_IMAGE,
420
+ codeContentFontSize: DEFAULT_CODE_CONTENT_FONT_SIZE,
421
+ composerFollowUpBehavior: "queue",
422
+ crtContentFontSize: DEFAULT_CRT_CONTENT_FONT_SIZE,
423
+ crtSkinEffectsEnabled: true,
424
+ crtDynamicHeatEnabled: false,
425
+ crtTerminalFontSize: DEFAULT_CRT_TERMINAL_FONT_SIZE,
426
+ defaultLaunchAgent: "codex",
427
+ agentLaunchProfiles: {
428
+ codex: cloneLaunchProfile(DEFAULT_CODEX_LAUNCH_PROFILE),
429
+ claude: cloneLaunchProfile(DEFAULT_CLAUDE_LAUNCH_PROFILE)
430
+ },
431
+ agentHomes: cloneAgentHomes(DEFAULT_AGENT_HOMES),
432
+ searchTimeoutMs: DEFAULT_SEARCH_TIMEOUT_MS,
433
+ codexApprovalMode: "approve",
434
+ codexModel: "config",
435
+ codexReasoningEffort: "config",
436
+ codexServiceTier: "config",
437
+ codexModelPreset: "config",
438
+ version: "2"
439
+ };
440
+ this.writeSettingsFile(defaultSettings);
441
+ console.log("Created default settings:", this.settingsFile);
442
+ }
443
+ const rawSettings = JSON.parse(fs.readFileSync(this.settingsFile, "utf8"));
444
+ this.settings = {
445
+ workspace: this.farmingDir,
446
+ lastMainWorkspace: this.farmingDir,
447
+ workspaceHistory: [],
448
+ projectWorkspaces: [],
449
+ pinnedProjectWorkspaces: [],
450
+ projectNames: {},
451
+ projectOperations: {},
452
+ instanceName: "",
453
+ theme: "terminal",
454
+ appearance: "system",
455
+ language: "en",
456
+ restReminderIntervalSeconds: null,
457
+ heartbeatInterval: 1e3,
458
+ dangerouslySkipAgentPermissionsByDefault: false,
459
+ browserExtensionEnabled: false,
460
+ browserSource: process.env.FARMING_BROWSER_CDP_URL ? "external-cdp" : "system",
461
+ browserExecutablePath: process.env.FARMING_BROWSER_EXECUTABLE || "",
462
+ browserExternalCdpUrl: process.env.FARMING_BROWSER_CDP_URL || "http://127.0.0.1:9222",
463
+ computerExtensionEnabled: false,
464
+ computerCompatibilityMode: false,
465
+ computerImage: import_computer_constants.COMPUTER_IMAGE,
466
+ codeContentFontSize: DEFAULT_CODE_CONTENT_FONT_SIZE,
467
+ composerFollowUpBehavior: "queue",
468
+ crtContentFontSize: DEFAULT_CRT_CONTENT_FONT_SIZE,
469
+ crtSkinEffectsEnabled: true,
470
+ crtDynamicHeatEnabled: false,
471
+ crtTerminalFontSize: DEFAULT_CRT_TERMINAL_FONT_SIZE,
472
+ defaultLaunchAgent: "codex",
473
+ agentLaunchProfiles: {
474
+ codex: cloneLaunchProfile(DEFAULT_CODEX_LAUNCH_PROFILE),
475
+ claude: cloneLaunchProfile(DEFAULT_CLAUDE_LAUNCH_PROFILE)
476
+ },
477
+ agentHomes: cloneAgentHomes(DEFAULT_AGENT_HOMES),
478
+ searchTimeoutMs: DEFAULT_SEARCH_TIMEOUT_MS,
479
+ codexApprovalMode: "approve",
480
+ codexModel: "config",
481
+ codexReasoningEffort: "config",
482
+ codexServiceTier: "config",
483
+ codexModelPreset: "config",
484
+ version: "2",
485
+ ...rawSettings
486
+ };
487
+ if (rawSettings.searchTimeoutMs === void 0 && rawSettings.workspaceFileSearchTimeoutMs !== void 0) {
488
+ const legacyTimeoutMs = Number(rawSettings.workspaceFileSearchTimeoutMs);
489
+ this.settings.searchTimeoutMs = legacyTimeoutMs === LEGACY_DEFAULT_WORKSPACE_FILE_SEARCH_TIMEOUT_MS ? DEFAULT_SEARCH_TIMEOUT_MS : legacyTimeoutMs;
490
+ }
491
+ delete this.settings.workspaceFileSearchTimeoutMs;
492
+ if (this.settings.dangerouslySkipAgentPermissionsByDefault === void 0 && this.settings.skipPermissionCheckByDefault !== void 0) {
493
+ this.settings.dangerouslySkipAgentPermissionsByDefault = this.settings.skipPermissionCheckByDefault === true;
494
+ }
495
+ delete this.settings.skipPermissionCheckByDefault;
496
+ const launchRawSettings = { ...rawSettings };
497
+ if (rawSettings.codexApprovalMode === void 0 && this.settings.dangerouslySkipAgentPermissionsByDefault === true) {
498
+ this.settings.codexApprovalMode = "full";
499
+ launchRawSettings.codexApprovalMode = "full";
500
+ }
501
+ this.settings.workspace = this.farmingDir;
502
+ this.settings.lastMainWorkspace = this.normalizeMainWorkspace(this.settings.lastMainWorkspace, this.farmingDir);
503
+ this.settings.workspaceHistory = this.normalizeWorkspaceHistory(this.settings.workspaceHistory);
504
+ this.settings.projectWorkspaces = this.normalizeProjectWorkspaces(this.settings.projectWorkspaces);
505
+ this.settings.pinnedProjectWorkspaces = this.normalizeProjectWorkspaces(this.settings.pinnedProjectWorkspaces);
506
+ this.settings.projectNames = this.normalizeProjectNames(this.settings.projectNames);
507
+ this.settings.projectOperations = this.normalizeProjectOperations(this.settings.projectOperations);
508
+ this.settings.instanceName = this.normalizeInstanceName(this.settings.instanceName);
509
+ this.settings.agentHomes = this.normalizeAgentHomes(this.settings.agentHomes);
510
+ delete this.settings.updateUrl;
511
+ this.settings.searchTimeoutMs = this.normalizeSearchTimeoutMs(this.settings.searchTimeoutMs);
512
+ delete this.settings.codexRuntimeMode;
513
+ const legacyMainPageSessionKeys = this.normalizeMainPageSessionKeys(this.settings.mainPageSessionKeys);
514
+ delete this.settings.mainPageSessionKeys;
515
+ this.sessionStore.init({ legacyMainPageSessionKeys });
516
+ this.assertAgentHomeBindings(this.settings.agentHomes);
517
+ const legacyTaskHistory = this.normalizeTaskHistory(this.settings.taskHistory);
518
+ delete this.settings.taskHistory;
519
+ this.runHistoryStore.init({ legacyTaskHistory });
520
+ this.settings.appearance = this.normalizeAppearance(this.settings.appearance);
521
+ this.settings.language = this.normalizeLanguage(this.settings.language);
522
+ this.settings.restReminderIntervalSeconds = this.normalizeRestReminderIntervalSeconds(
523
+ this.settings.restReminderIntervalSeconds
524
+ );
525
+ this.settings.browserExtensionEnabled = this.settings.browserExtensionEnabled === true;
526
+ this.settings.browserSource = this.normalizeBrowserSource(this.settings.browserSource);
527
+ this.settings.browserExecutablePath = this.normalizeBrowserSetting(this.settings.browserExecutablePath);
528
+ this.settings.browserExternalCdpUrl = this.normalizeBrowserSetting(this.settings.browserExternalCdpUrl) || "http://127.0.0.1:9222";
529
+ this.settings.computerExtensionEnabled = this.settings.computerExtensionEnabled === true;
530
+ if (this.settings.browserExtensionEnabled && this.settings.browserSource === "isolated") {
531
+ this.settings.computerExtensionEnabled = true;
532
+ }
533
+ this.settings.computerCompatibilityMode = this.settings.computerCompatibilityMode === true;
534
+ this.settings.computerImage = this.normalizeBrowserSetting(this.settings.computerImage) || import_computer_constants.COMPUTER_IMAGE;
535
+ this.settings.codeContentFontSize = this.normalizeContentFontSize(
536
+ this.settings.codeContentFontSize,
537
+ DEFAULT_CODE_CONTENT_FONT_SIZE
538
+ );
539
+ this.settings.composerFollowUpBehavior = this.normalizeComposerFollowUpBehavior(
540
+ this.settings.composerFollowUpBehavior
541
+ );
542
+ this.settings.crtContentFontSize = this.normalizeContentFontSize(
543
+ rawSettings.crtContentFontSize === void 0 ? Number(this.settings.crtTerminalFontSize) - 1 : this.settings.crtContentFontSize,
544
+ DEFAULT_CRT_CONTENT_FONT_SIZE
545
+ );
546
+ this.settings.crtSkinEffectsEnabled = this.settings.crtSkinEffectsEnabled !== false;
547
+ this.settings.crtDynamicHeatEnabled = this.settings.crtDynamicHeatEnabled === true;
548
+ this.settings.crtTerminalFontSize = this.crtTerminalFontSizeFromContent(this.settings.crtContentFontSize);
549
+ this.normalizeAgentLaunchSettings(launchRawSettings);
550
+ this.pruneUnknownSettings();
551
+ (0, import_main_agent_skills.ensureMainAgentSkillFiles)(this.farmingDir);
552
+ (0, import_farming_agent_bootstrap.ensureFarmingAgentBootstrapFile)(this.farmingDir);
553
+ this.writeSettingsFile();
554
+ console.log("Loaded settings:", this.settings);
555
+ }
556
+ pruneUnknownSettings(settings = this.settings) {
557
+ for (const key of Object.keys(settings || {})) {
558
+ if (!PERSISTED_SETTING_KEYS.has(key)) {
559
+ delete settings[key];
560
+ }
561
+ }
562
+ }
563
+ normalizeDefaultLaunchAgent(agentName) {
564
+ return typeof agentName === "string" && DEFAULT_LAUNCH_AGENT_NAMES.has(agentName) ? agentName : "codex";
565
+ }
566
+ normalizeSearchTimeoutMs(value) {
567
+ const timeoutMs = Number(value);
568
+ if (!Number.isFinite(timeoutMs)) return DEFAULT_SEARCH_TIMEOUT_MS;
569
+ return Math.min(
570
+ MAX_SEARCH_TIMEOUT_MS,
571
+ Math.max(MIN_SEARCH_TIMEOUT_MS, Math.round(timeoutMs))
572
+ );
573
+ }
574
+ normalizeContentFontSize(value, fallback) {
575
+ const fontSize = Number(value);
576
+ if (!Number.isFinite(fontSize)) return fallback;
577
+ return Math.min(MAX_CONTENT_FONT_SIZE, Math.max(MIN_CONTENT_FONT_SIZE, Math.round(fontSize)));
578
+ }
579
+ normalizeComposerFollowUpBehavior(value) {
580
+ return value === "steer" ? "steer" : "queue";
581
+ }
582
+ crtTerminalFontSizeFromContent(value) {
583
+ return this.normalizeCrtTerminalFontSize(
584
+ this.normalizeContentFontSize(value, DEFAULT_CRT_CONTENT_FONT_SIZE) + 1
585
+ );
586
+ }
587
+ normalizeRestReminderIntervalSeconds(value) {
588
+ if (value === null || value === void 0 || value === "") return null;
589
+ const seconds = Number(value);
590
+ if (!Number.isInteger(seconds)) return null;
591
+ if (seconds === 0 || seconds === 5) return seconds;
592
+ return seconds >= 60 && seconds <= 240 * 60 && seconds % 60 === 0 ? seconds : null;
593
+ }
594
+ normalizeCrtTerminalFontSize(value) {
595
+ const fontSize = Number(value);
596
+ if (!Number.isFinite(fontSize)) return DEFAULT_CRT_TERMINAL_FONT_SIZE;
597
+ return Math.min(
598
+ MAX_CRT_TERMINAL_FONT_SIZE,
599
+ Math.max(MIN_CRT_TERMINAL_FONT_SIZE, Math.round(fontSize))
600
+ );
601
+ }
602
+ normalizeAgentHomes(agentHomes) {
603
+ const source = objectRecord(agentHomes) || {};
604
+ const normalized = {};
605
+ Object.entries(source).forEach(([rawProvider, rawHomes]) => {
606
+ const provider = String(rawProvider || "").trim().toLowerCase();
607
+ if (!/^[a-z0-9._-]+$/.test(provider)) return;
608
+ if (!Object.prototype.hasOwnProperty.call(DEFAULT_AGENT_HOMES, provider)) return;
609
+ if (!Array.isArray(rawHomes)) return;
610
+ const seenIds = /* @__PURE__ */ new Set();
611
+ const seenPaths = /* @__PURE__ */ new Map();
612
+ const homes = [];
613
+ rawHomes.forEach((rawHome, homeIndex) => {
614
+ const record = objectRecord(rawHome);
615
+ if (!record) return;
616
+ const id = String(record.id || "").trim();
617
+ const homePath = String(record.path || "").trim();
618
+ if (!id || !homePath) return;
619
+ if (!/^[A-Za-z0-9._-]+$/.test(id)) return;
620
+ const idKey = id.toLowerCase();
621
+ if (seenIds.has(idKey)) {
622
+ const error = new Error(`${provider} contains more than one Agent Home named "${id}"`);
623
+ error.code = "AGENT_HOME_DUPLICATE_ID";
624
+ error.status = 409;
625
+ throw error;
626
+ }
627
+ seenIds.add(idKey);
628
+ const canonicalPath = this.canonicalAgentHomePath(homePath);
629
+ const existingPathHomeId = seenPaths.get(canonicalPath);
630
+ if (existingPathHomeId) {
631
+ const error = new Error(
632
+ `${provider} Agent Homes "${existingPathHomeId}" and "${id}" use the same Home path`
633
+ );
634
+ error.code = "AGENT_HOME_DUPLICATE_PATH";
635
+ error.status = 409;
636
+ throw error;
637
+ }
638
+ seenPaths.set(canonicalPath, id);
639
+ const rawDefaults = objectRecord(record.newAgentDefaults) || {};
640
+ const model = String(rawDefaults.model || "inherit").trim();
641
+ const reasoning = String(rawDefaults.reasoning || "inherit").trim();
642
+ const fast = String(rawDefaults.fast || "inherit").trim();
643
+ const providerRank = Object.keys(DEFAULT_AGENT_HOMES).indexOf(provider);
644
+ const requestedOrder = Number(record.order);
645
+ homes.push({
646
+ id,
647
+ path: homePath,
648
+ order: Number.isFinite(requestedOrder) && requestedOrder >= 0 ? requestedOrder : providerRank * 1e3 + homeIndex,
649
+ newAgentDefaults: {
650
+ model: model && model.length <= 200 && !/[\r\n\0]/.test(model) ? model : "inherit",
651
+ reasoning: /^[A-Za-z0-9._-]{1,80}$/.test(reasoning) ? reasoning : "inherit",
652
+ fast: fast === "on" || fast === "off" ? fast : "inherit"
653
+ }
654
+ });
655
+ });
656
+ if (homes.length > 0) normalized[provider] = homes;
657
+ });
658
+ for (const [provider, homes] of Object.entries(DEFAULT_AGENT_HOMES)) {
659
+ const defaultHome = homes[0];
660
+ const providerHomes = normalized[provider] || [];
661
+ if (!providerHomes.some((home) => String(home.id || "").toLowerCase() === "default")) {
662
+ normalized[provider] = [{ ...defaultHome }, ...providerHomes];
663
+ }
664
+ }
665
+ for (const [provider, homes] of Object.entries(normalized)) {
666
+ const ownersByPath = /* @__PURE__ */ new Map();
667
+ for (const home of homes) {
668
+ const canonicalPath = this.canonicalAgentHomePath(home.path);
669
+ const existingHomeId = ownersByPath.get(canonicalPath);
670
+ if (existingHomeId && existingHomeId !== home.id) {
671
+ const error = new Error(
672
+ `${provider} Agent Homes "${existingHomeId}" and "${home.id}" use the same Home path`
673
+ );
674
+ error.code = "AGENT_HOME_DUPLICATE_PATH";
675
+ error.status = 409;
676
+ throw error;
677
+ }
678
+ ownersByPath.set(canonicalPath, home.id);
679
+ }
680
+ }
681
+ return normalized;
682
+ }
683
+ normalizeProjectNames(projectNames) {
684
+ const source = objectRecord(projectNames);
685
+ if (!source) return {};
686
+ const normalized = {};
687
+ Object.entries(source).forEach(([workspace, name]) => {
688
+ const key = this.expandWorkspacePath(String(workspace || "").trim());
689
+ const value = String(name || "").trim().slice(0, 80);
690
+ if (!key || !value) return;
691
+ normalized[key] = value;
692
+ });
693
+ return normalized;
694
+ }
695
+ normalizeProjectOperations(projectOperations) {
696
+ const source = objectRecord(projectOperations);
697
+ if (!source) return {};
698
+ const entries = Object.entries(source).filter(validProjectOperationEntry).sort((left, right) => (Number(right[1].updatedAt) || 0) - (Number(left[1].updatedAt) || 0)).map(([id, operation]) => {
699
+ const normalizedOperation = {
700
+ id,
701
+ type: operation.type,
702
+ state: operation.state,
703
+ signature: typeof operation.signature === "string" ? operation.signature.slice(0, 128) : "",
704
+ request: objectRecord(operation.request) ? objectRecord(JSON.parse(JSON.stringify(operation.request))) || {} : {},
705
+ result: objectRecord(operation.result) ? objectRecord(JSON.parse(JSON.stringify(operation.result))) : null,
706
+ error: typeof operation.error === "string" ? operation.error.slice(0, 2e3) : "",
707
+ startedAt: Number(operation.startedAt) || 0,
708
+ updatedAt: Number(operation.updatedAt) || 0,
709
+ finishedAt: Number(operation.finishedAt) || null
710
+ };
711
+ return [id, normalizedOperation];
712
+ });
713
+ const unresolved = entries.filter(([, operation]) => ["pending", "unknown", "blocked"].includes(operation.state));
714
+ const terminal = entries.filter(([, operation]) => !["pending", "unknown", "blocked"].includes(operation.state));
715
+ return Object.fromEntries([
716
+ ...unresolved,
717
+ ...terminal.slice(0, Math.max(0, MAX_PROJECT_OPERATIONS - unresolved.length))
718
+ ]);
719
+ }
720
+ setProjectName(workspace, name) {
721
+ const normalized = this.normalizeProjectNames({ [String(workspace)]: name });
722
+ const entry = Object.entries(normalized)[0];
723
+ if (!entry) throw new Error("Project workspace and name are required");
724
+ const [normalizedWorkspace, normalizedName] = entry;
725
+ const nextSettings = {
726
+ ...this.settings,
727
+ projectNames: {
728
+ ...this.settings.projectNames,
729
+ [normalizedWorkspace]: normalizedName
730
+ }
731
+ };
732
+ this.writeSettingsFile(nextSettings);
733
+ this.settings = nextSettings;
734
+ return {
735
+ workspace: normalizedWorkspace,
736
+ name: normalizedName
737
+ };
738
+ }
739
+ normalizeAppearance(appearance) {
740
+ return typeof appearance === "string" && ["system", "light", "dark"].includes(appearance) ? appearance : "system";
741
+ }
742
+ normalizeLanguage(language) {
743
+ return typeof language === "string" && ["en", "zh"].includes(language) ? language : "en";
744
+ }
745
+ normalizeBrowserSource(source) {
746
+ return typeof source === "string" && ["external-cdp", "isolated"].includes(source) ? source : "system";
747
+ }
748
+ normalizeBrowserSetting(value) {
749
+ return String(value || "").trim().slice(0, 2e3);
750
+ }
751
+ normalizeClaudePermissionMode(mode) {
752
+ return typeof mode === "string" && ["acceptEdits", "auto", "bypassPermissions", "default", "dontAsk", "plan"].includes(mode) ? mode : "default";
753
+ }
754
+ normalizeClaudeModel(model) {
755
+ if (model === "config") return model;
756
+ return (0, import_claude_settings.normalizeClaudeModelValue)(model) || "config";
757
+ }
758
+ normalizeClaudeEffort(effort) {
759
+ if (effort === "config") return effort;
760
+ if (typeof effort === "string" && ["low", "medium", "high", "xhigh", "max"].includes(effort)) return effort;
761
+ return "config";
762
+ }
763
+ normalizeCodexApprovalMode(mode) {
764
+ return typeof mode === "string" && ["ask", "approve", "full", "custom"].includes(mode) ? mode : "approve";
765
+ }
766
+ normalizeCodexModelPreset(preset) {
767
+ if (preset === "config") return preset;
768
+ if (typeof preset !== "string") return "config";
769
+ if (/^[A-Za-z0-9._-]+(?::[A-Za-z0-9._-]+)?$/.test(preset)) return preset;
770
+ return "config";
771
+ }
772
+ normalizeCodexModelId(model) {
773
+ if (model === "config") return model;
774
+ if (typeof model !== "string") return "config";
775
+ if (/^[A-Za-z0-9._-]+$/.test(model)) return model;
776
+ return "config";
777
+ }
778
+ normalizeCodexReasoningEffort(effort) {
779
+ if (effort === "config") return effort;
780
+ if (typeof effort !== "string") return "config";
781
+ if (/^[A-Za-z0-9._-]+$/.test(effort)) return effort;
782
+ return "config";
783
+ }
784
+ normalizeCodexServiceTier(tier) {
785
+ if (typeof tier !== "string") return "config";
786
+ if (/^[A-Za-z0-9._-]+$/.test(tier)) return tier;
787
+ return "config";
788
+ }
789
+ normalizeCodexModelSettings(rawSettings = {}) {
790
+ const codexProfile = this.normalizeCodexLaunchProfile({
791
+ approvalMode: this.settings.codexApprovalMode,
792
+ model: this.settings.codexModel,
793
+ reasoningEffort: this.settings.codexReasoningEffort,
794
+ serviceTier: this.settings.codexServiceTier,
795
+ modelPreset: this.settings.codexModelPreset
796
+ }, {
797
+ approvalMode: rawSettings.codexApprovalMode,
798
+ model: rawSettings.codexModel,
799
+ reasoningEffort: rawSettings.codexReasoningEffort,
800
+ serviceTier: rawSettings.codexServiceTier,
801
+ modelPreset: rawSettings.codexModelPreset
802
+ });
803
+ this.applyCodexProfileToLegacySettings(codexProfile);
804
+ }
805
+ normalizeCodexLaunchProfile(profile = {}, changed = {}) {
806
+ const next = {
807
+ ...DEFAULT_CODEX_LAUNCH_PROFILE,
808
+ ...spreadableObject(profile)
809
+ };
810
+ next.approvalMode = this.normalizeCodexApprovalMode(next.approvalMode);
811
+ const hasDirectModelChange = changed.model !== void 0 || changed.reasoningEffort !== void 0;
812
+ const hasPresetChange = changed.modelPreset !== void 0;
813
+ const normalizedPreset = this.normalizeCodexModelPreset(next.modelPreset);
814
+ if (hasPresetChange && !hasDirectModelChange) {
815
+ const fromPreset = splitCodexModelPreset(normalizedPreset);
816
+ next.model = fromPreset.model;
817
+ next.reasoningEffort = fromPreset.effort;
818
+ } else {
819
+ next.model = this.normalizeCodexModelId(next.model);
820
+ next.reasoningEffort = this.normalizeCodexReasoningEffort(next.reasoningEffort);
821
+ }
822
+ next.serviceTier = this.normalizeCodexServiceTier(next.serviceTier);
823
+ next.modelPreset = joinCodexModelPreset(
824
+ next.model,
825
+ next.reasoningEffort === "config" ? "" : next.reasoningEffort
826
+ );
827
+ return next;
828
+ }
829
+ normalizeClaudeLaunchProfile(profile = {}) {
830
+ const next = {
831
+ ...DEFAULT_CLAUDE_LAUNCH_PROFILE,
832
+ ...spreadableObject(profile)
833
+ };
834
+ return {
835
+ permissionMode: this.normalizeClaudePermissionMode(next.permissionMode),
836
+ model: this.normalizeClaudeModel(next.model),
837
+ effort: this.normalizeClaudeEffort(next.effort)
838
+ };
839
+ }
840
+ getChangedAgentLaunchProfiles(rawSettings = {}) {
841
+ const changedProfiles = {};
842
+ if (rawSettings.agentLaunchProfiles && typeof rawSettings.agentLaunchProfiles === "object") {
843
+ for (const [agentName, profile] of Object.entries(rawSettings.agentLaunchProfiles)) {
844
+ if (!Object.prototype.hasOwnProperty.call(DEFAULT_AGENT_LAUNCH_PROFILES, agentName)) continue;
845
+ if (profile && typeof profile === "object") changedProfiles[agentName] = profile;
846
+ }
847
+ }
848
+ const codexChanged = {};
849
+ if (rawSettings.codexApprovalMode !== void 0) codexChanged.approvalMode = rawSettings.codexApprovalMode;
850
+ if (rawSettings.codexModel !== void 0) codexChanged.model = rawSettings.codexModel;
851
+ if (rawSettings.codexReasoningEffort !== void 0) codexChanged.reasoningEffort = rawSettings.codexReasoningEffort;
852
+ if (rawSettings.codexServiceTier !== void 0) codexChanged.serviceTier = rawSettings.codexServiceTier;
853
+ if (rawSettings.codexModelPreset !== void 0) codexChanged.modelPreset = rawSettings.codexModelPreset;
854
+ if (Object.keys(codexChanged).length > 0) {
855
+ changedProfiles.codex = {
856
+ ...changedProfiles.codex || {},
857
+ ...codexChanged
858
+ };
859
+ }
860
+ return changedProfiles;
861
+ }
862
+ mergeAgentLaunchProfiles(existingProfiles = {}, incomingProfiles = {}) {
863
+ const merged = {
864
+ codex: cloneLaunchProfile(DEFAULT_CODEX_LAUNCH_PROFILE),
865
+ claude: cloneLaunchProfile(DEFAULT_CLAUDE_LAUNCH_PROFILE)
866
+ };
867
+ for (const [agentName, defaultProfile] of Object.entries(DEFAULT_AGENT_LAUNCH_PROFILES)) {
868
+ merged[agentName] = {
869
+ ...defaultProfile,
870
+ ...spreadableObject(objectProperty(existingProfiles, agentName)),
871
+ ...spreadableObject(objectProperty(incomingProfiles, agentName))
872
+ };
873
+ }
874
+ return merged;
875
+ }
876
+ applyCodexProfileToLegacySettings(codexProfile, settings = this.settings) {
877
+ settings.codexApprovalMode = codexProfile.approvalMode;
878
+ settings.codexModel = codexProfile.model;
879
+ settings.codexReasoningEffort = codexProfile.reasoningEffort;
880
+ settings.codexServiceTier = codexProfile.serviceTier;
881
+ settings.codexModelPreset = codexProfile.modelPreset;
882
+ }
883
+ normalizeAgentLaunchSettings(rawSettings = {}, settings = this.settings) {
884
+ const changedProfiles = this.getChangedAgentLaunchProfiles(rawSettings);
885
+ const mergedProfiles = this.mergeAgentLaunchProfiles(settings.agentLaunchProfiles, changedProfiles);
886
+ settings.agentLaunchProfiles = {
887
+ codex: this.normalizeCodexLaunchProfile(mergedProfiles.codex, changedProfiles.codex || {}),
888
+ claude: this.normalizeClaudeLaunchProfile(mergedProfiles.claude)
889
+ };
890
+ settings.defaultLaunchAgent = this.normalizeDefaultLaunchAgent(settings.defaultLaunchAgent);
891
+ this.applyCodexProfileToLegacySettings(settings.agentLaunchProfiles.codex, settings);
892
+ }
893
+ getWorkspace() {
894
+ return this.settings ? this.settings.workspace : this.farmingDir;
895
+ }
896
+ getHeartbeatInterval() {
897
+ return this.settings ? this.settings.heartbeatInterval || 1e3 : 1e3;
898
+ }
899
+ getDangerouslySkipAgentPermissionsByDefault() {
900
+ return this.settings ? this.settings.dangerouslySkipAgentPermissionsByDefault === true : false;
901
+ }
902
+ getCodexApprovalMode() {
903
+ if (!this.settings) return "approve";
904
+ return this.getAgentLaunchProfile("codex").approvalMode;
905
+ }
906
+ getCodexModelPreset() {
907
+ if (!this.settings) return "config";
908
+ return this.getAgentLaunchProfile("codex").modelPreset;
909
+ }
910
+ getCodexModel() {
911
+ if (!this.settings) return "config";
912
+ return this.getAgentLaunchProfile("codex").model;
913
+ }
914
+ getCodexReasoningEffort() {
915
+ if (!this.settings) return "config";
916
+ return this.getAgentLaunchProfile("codex").reasoningEffort;
917
+ }
918
+ getCodexServiceTier() {
919
+ if (!this.settings) return "config";
920
+ return this.getAgentLaunchProfile("codex").serviceTier;
921
+ }
922
+ getAgentHomes(provider) {
923
+ const providerKey = String(provider);
924
+ const homes = this.settings && this.settings.agentHomes && this.settings.agentHomes[providerKey] ? this.settings.agentHomes[providerKey] : [];
925
+ return homes.map((home) => ({
926
+ ...home,
927
+ newAgentDefaults: { ...home.newAgentDefaults },
928
+ path: this.expandWorkspacePath(home.path)
929
+ }));
930
+ }
931
+ getAgentHome(provider, homeId = "default") {
932
+ const normalizedProvider = String(provider || "").trim().toLowerCase();
933
+ const normalizedHomeId = String(homeId || "default").trim();
934
+ const homes = this.getAgentHomes(normalizedProvider);
935
+ return homes.find((home) => home.id === normalizedHomeId) || null;
936
+ }
937
+ getKnownAgentHomes(provider, bindings = this.agentHomeBindings()) {
938
+ const normalizedProvider = String(provider || "").trim().toLowerCase();
939
+ const homes = this.getAgentHomes(normalizedProvider);
940
+ const knownIds = new Set(homes.map((home) => home.id));
941
+ for (const binding of bindings) {
942
+ if (binding.provider !== normalizedProvider || knownIds.has(binding.providerHomeId)) continue;
943
+ knownIds.add(binding.providerHomeId);
944
+ homes.push({
945
+ id: binding.providerHomeId,
946
+ path: binding.providerHomePath,
947
+ order: Number.MAX_SAFE_INTEGER,
948
+ newAgentDefaults: { model: "inherit", reasoning: "inherit", fast: "inherit" }
949
+ });
950
+ }
951
+ return homes;
952
+ }
953
+ getKnownAgentHome(provider, homeId = "default") {
954
+ const normalizedHomeId = String(homeId || "default").trim();
955
+ return this.getKnownAgentHomes(provider).find((home) => home.id === normalizedHomeId) || null;
956
+ }
957
+ getDefaultLaunchAgent() {
958
+ return this.settings ? this.normalizeDefaultLaunchAgent(this.settings.defaultLaunchAgent) : "codex";
959
+ }
960
+ getAgentLaunchProfiles() {
961
+ const profiles = this.settings && this.settings.agentLaunchProfiles ? this.settings.agentLaunchProfiles : DEFAULT_AGENT_LAUNCH_PROFILES;
962
+ return {
963
+ codex: { ...profiles.codex },
964
+ claude: { ...profiles.claude }
965
+ };
966
+ }
967
+ getAgentLaunchProfile(agentName) {
968
+ const profiles = this.getAgentLaunchProfiles();
969
+ const profileName = String(agentName);
970
+ const profile = profiles[profileName] || DEFAULT_AGENT_LAUNCH_PROFILES[profileName];
971
+ return profile ? { ...profile } : {};
972
+ }
973
+ getAgentLaunchProfileForHome(agentName, homeId = "default") {
974
+ const provider = String(agentName || "").trim().toLowerCase();
975
+ const profile = this.getAgentLaunchProfile(provider);
976
+ const home = this.getAgentHome(provider, homeId);
977
+ if (!home) return profile;
978
+ if (provider === "codex") {
979
+ return {
980
+ ...profile,
981
+ model: "config",
982
+ reasoningEffort: "config",
983
+ serviceTier: "config",
984
+ modelPreset: "config"
985
+ };
986
+ }
987
+ if (provider === "claude") {
988
+ return {
989
+ ...profile,
990
+ model: "config",
991
+ effort: "config"
992
+ };
993
+ }
994
+ return profile;
995
+ }
996
+ getSettings() {
997
+ const {
998
+ projectOperations: _privateProjectOperations,
999
+ ...publicSettings
1000
+ } = this.settings;
1001
+ return {
1002
+ ...publicSettings,
1003
+ instanceName: this.getInstanceName(),
1004
+ workspace: this.farmingDir,
1005
+ mainPageSessionKeys: this.getMainPageSessionKeys(),
1006
+ taskHistory: this.getTaskHistory()
1007
+ };
1008
+ }
1009
+ mountProjectWorkspace(workspace) {
1010
+ const expanded = this.expandWorkspacePath(workspace);
1011
+ const resolved = expanded ? path.resolve(expanded) : "";
1012
+ let canonicalWorkspace = "";
1013
+ if (resolved) {
1014
+ try {
1015
+ canonicalWorkspace = fs.realpathSync(resolved);
1016
+ if (!fs.statSync(canonicalWorkspace).isDirectory()) canonicalWorkspace = "";
1017
+ } catch {
1018
+ canonicalWorkspace = "";
1019
+ }
1020
+ }
1021
+ if (!canonicalWorkspace || this.isInternalWorkspace(canonicalWorkspace)) {
1022
+ throw new Error("Project workspace is invalid or unavailable");
1023
+ }
1024
+ const current = this.settings.projectWorkspaces || [];
1025
+ if (!current.includes(canonicalWorkspace)) {
1026
+ this.commitProjectMembership({
1027
+ projectWorkspaces: [canonicalWorkspace, ...current]
1028
+ });
1029
+ }
1030
+ return {
1031
+ workspace: canonicalWorkspace,
1032
+ projectWorkspaces: [...this.settings.projectWorkspaces || []],
1033
+ pinnedProjectWorkspaces: [...this.settings.pinnedProjectWorkspaces || []]
1034
+ };
1035
+ }
1036
+ removeProjectWorkspace(workspace) {
1037
+ const expanded = this.expandWorkspacePath(workspace);
1038
+ if (!expanded) throw new Error("Project workspace is required");
1039
+ const resolved = path.resolve(expanded);
1040
+ const candidates = /* @__PURE__ */ new Set([expanded, resolved]);
1041
+ try {
1042
+ candidates.add(fs.realpathSync(resolved));
1043
+ } catch {
1044
+ }
1045
+ const current = this.settings.projectWorkspaces || [];
1046
+ const nextProjects = current.filter((entry) => !candidates.has(entry));
1047
+ const currentPinned = this.settings.pinnedProjectWorkspaces || [];
1048
+ const nextPinned = currentPinned.filter((entry) => !candidates.has(entry));
1049
+ if (nextProjects.length !== current.length || nextPinned.length !== currentPinned.length) {
1050
+ this.commitProjectMembership({
1051
+ projectWorkspaces: nextProjects,
1052
+ pinnedProjectWorkspaces: nextPinned
1053
+ });
1054
+ }
1055
+ return {
1056
+ workspace: current.find((entry) => candidates.has(entry)) || resolved,
1057
+ projectWorkspaces: [...this.settings.projectWorkspaces || []],
1058
+ pinnedProjectWorkspaces: [...this.settings.pinnedProjectWorkspaces || []]
1059
+ };
1060
+ }
1061
+ setProjectWorkspacePinned(workspace, pinned) {
1062
+ const [canonicalWorkspace] = this.normalizeProjectWorkspaces([workspace]);
1063
+ if (!canonicalWorkspace || !(this.settings.projectWorkspaces || []).includes(canonicalWorkspace)) {
1064
+ throw new Error("Project does not exist");
1065
+ }
1066
+ const current = this.settings.pinnedProjectWorkspaces || [];
1067
+ const nextPinned = pinned ? [...current.filter((entry) => entry !== canonicalWorkspace), canonicalWorkspace] : current.filter((entry) => entry !== canonicalWorkspace);
1068
+ if (nextPinned.length !== current.length || nextPinned.some((entry, index) => entry !== current[index])) {
1069
+ this.commitProjectMembership({ pinnedProjectWorkspaces: nextPinned });
1070
+ }
1071
+ return {
1072
+ workspace: canonicalWorkspace,
1073
+ projectWorkspaces: [...this.settings.projectWorkspaces || []],
1074
+ pinnedProjectWorkspaces: [...this.settings.pinnedProjectWorkspaces || []]
1075
+ };
1076
+ }
1077
+ commitProjectMembership(settingsPatch) {
1078
+ const previousSettings = this.settings;
1079
+ try {
1080
+ this.updateSettings(settingsPatch);
1081
+ } catch (error) {
1082
+ this.settings = previousSettings;
1083
+ throw error;
1084
+ }
1085
+ }
1086
+ getProjectOperation(requestId) {
1087
+ const id = String(requestId || "").trim();
1088
+ if (!PROJECT_OPERATION_ID_PATTERN.test(id)) return null;
1089
+ const operation = this.settings.projectOperations?.[id];
1090
+ return operation ? JSON.parse(JSON.stringify(operation)) : null;
1091
+ }
1092
+ commitProjectOperation(operation, membership = {}) {
1093
+ const operationId = String(objectProperty(operation, "id"));
1094
+ const normalized = this.normalizeProjectOperations({ [operationId]: operation });
1095
+ const nextOperation = normalized[operationId];
1096
+ if (!nextOperation) throw new Error("Project operation is invalid");
1097
+ const existingOperation = this.settings.projectOperations?.[nextOperation.id];
1098
+ const unresolvedCount = Object.values(this.settings.projectOperations || {}).filter((candidate) => ["pending", "unknown", "blocked"].includes(candidate.state)).length;
1099
+ if (!existingOperation && nextOperation.state === "pending" && unresolvedCount >= MAX_PROJECT_OPERATIONS) {
1100
+ throw new Error("Too many unresolved Project operations require reconciliation");
1101
+ }
1102
+ const nextOperations = this.normalizeProjectOperations({
1103
+ ...this.settings.projectOperations,
1104
+ [nextOperation.id]: nextOperation
1105
+ });
1106
+ const nextSettings = {
1107
+ ...this.settings,
1108
+ projectOperations: nextOperations
1109
+ };
1110
+ if (membership.mountWorkspace) {
1111
+ const mounted = this.normalizeProjectWorkspaces([
1112
+ membership.mountWorkspace,
1113
+ ...this.settings.projectWorkspaces || []
1114
+ ]);
1115
+ nextSettings.projectWorkspaces = mounted;
1116
+ nextSettings.pinnedProjectWorkspaces = this.normalizeProjectWorkspaces(
1117
+ this.settings.pinnedProjectWorkspaces
1118
+ );
1119
+ }
1120
+ if (membership.removeWorkspace) {
1121
+ const expanded = this.expandWorkspacePath(membership.removeWorkspace);
1122
+ const resolved = expanded ? path.resolve(expanded) : "";
1123
+ const candidates = new Set([expanded, resolved].filter(Boolean));
1124
+ try {
1125
+ candidates.add(fs.realpathSync(resolved));
1126
+ } catch {
1127
+ }
1128
+ nextSettings.projectWorkspaces = (this.settings.projectWorkspaces || []).filter((workspace) => !candidates.has(workspace));
1129
+ nextSettings.pinnedProjectWorkspaces = (this.settings.pinnedProjectWorkspaces || []).filter((workspace) => !candidates.has(workspace));
1130
+ }
1131
+ this.writeSettingsFile(nextSettings);
1132
+ this.settings = nextSettings;
1133
+ return {
1134
+ operation: JSON.parse(JSON.stringify(nextOperation)),
1135
+ projectWorkspaces: [...nextSettings.projectWorkspaces || []],
1136
+ pinnedProjectWorkspaces: [...nextSettings.pinnedProjectWorkspaces || []]
1137
+ };
1138
+ }
1139
+ getMainPageSessionKeys() {
1140
+ return this.sessionStore ? this.sessionStore.getMainPageSessionKeys() : [];
1141
+ }
1142
+ setMainPageSessionKeys(keys) {
1143
+ return this.sessionStore ? this.sessionStore.setMainPageSessionKeys(keys) : [];
1144
+ }
1145
+ rememberMainPageSessionKey(sessionKey, patch = {}) {
1146
+ return this.sessionStore ? this.sessionStore.rememberMainPageSessionKey(sessionKey, patch) : [];
1147
+ }
1148
+ removeMainPageSessionKey(sessionKey) {
1149
+ return this.sessionStore ? this.sessionStore.removeMainPageSessionKey(sessionKey) : false;
1150
+ }
1151
+ removeMainPageSessionKeys(keys) {
1152
+ return this.sessionStore ? this.sessionStore.removeMainPageSessionKeys(keys) : [];
1153
+ }
1154
+ ensureAgentSessionRecord(agent, patch = {}) {
1155
+ return this.sessionStore ? this.sessionStore.ensureRecordForAgent(agent, { ...patch }) : "";
1156
+ }
1157
+ getAgentSessionRecordForProviderSessionKey(sessionKey) {
1158
+ const record = this.sessionStore ? this.sessionStore.getRecordForProviderSessionKey(sessionKey) : null;
1159
+ return record && typeof record.id === "string" ? { ...record, id: record.id } : null;
1160
+ }
1161
+ setProviderSessionDisplayState(sessionKey, patch = {}) {
1162
+ return this.sessionStore ? this.sessionStore.setProviderSessionDisplayState(sessionKey, { ...patch }) : "";
1163
+ }
1164
+ listAgentSessionRecords() {
1165
+ const records = this.sessionStore ? this.sessionStore.listAgentRecords() : [];
1166
+ return records.flatMap((record) => typeof record.id === "string" ? [{ ...record, id: record.id }] : []);
1167
+ }
1168
+ rememberAgentSessionRecord(agent) {
1169
+ return this.sessionStore ? this.sessionStore.rememberAgent(agent) : "";
1170
+ }
1171
+ getTaskHistory() {
1172
+ return this.runHistoryStore ? this.runHistoryStore.getEntries() : [];
1173
+ }
1174
+ writeSettingsFile(settings = this.settings) {
1175
+ this.writeJson(this.settingsFile, settings);
1176
+ }
1177
+ appendTaskHistory(entry) {
1178
+ if (!this.runHistoryStore) return;
1179
+ this.runHistoryStore.appendEntry(entry);
1180
+ }
1181
+ updateSettings(newSettings) {
1182
+ const incomingMainPageSessionKeys = Object.prototype.hasOwnProperty.call(newSettings || {}, "mainPageSessionKeys") ? newSettings.mainPageSessionKeys : void 0;
1183
+ const settingsPatch = { ...newSettings || {} };
1184
+ delete settingsPatch.mainPageSessionKeys;
1185
+ delete settingsPatch.projectOperations;
1186
+ const incomingTaskHistory = Object.prototype.hasOwnProperty.call(settingsPatch, "taskHistory") ? settingsPatch.taskHistory : void 0;
1187
+ delete settingsPatch.taskHistory;
1188
+ const previousMainWorkspace = this.settings.lastMainWorkspace || this.farmingDir;
1189
+ const previousProfiles = this.settings.agentLaunchProfiles || {};
1190
+ const incomingProfiles = settingsPatch.agentLaunchProfiles || {};
1191
+ const nextSettings = {
1192
+ ...this.settings,
1193
+ ...settingsPatch,
1194
+ agentLaunchProfiles: this.mergeAgentLaunchProfiles(previousProfiles, incomingProfiles),
1195
+ workspace: this.farmingDir
1196
+ };
1197
+ nextSettings.lastMainWorkspace = this.normalizeMainWorkspace(nextSettings.lastMainWorkspace, previousMainWorkspace);
1198
+ nextSettings.workspaceHistory = this.normalizeWorkspaceHistory(nextSettings.workspaceHistory);
1199
+ nextSettings.projectWorkspaces = this.normalizeProjectWorkspaces(nextSettings.projectWorkspaces);
1200
+ nextSettings.pinnedProjectWorkspaces = this.normalizeProjectWorkspaces(nextSettings.pinnedProjectWorkspaces);
1201
+ nextSettings.projectNames = this.normalizeProjectNames(nextSettings.projectNames);
1202
+ nextSettings.projectOperations = this.normalizeProjectOperations(nextSettings.projectOperations);
1203
+ nextSettings.instanceName = this.normalizeInstanceName(nextSettings.instanceName);
1204
+ nextSettings.agentHomes = this.normalizeAgentHomes(nextSettings.agentHomes);
1205
+ this.assertAgentHomeBindings(nextSettings.agentHomes);
1206
+ delete nextSettings.updateUrl;
1207
+ nextSettings.searchTimeoutMs = this.normalizeSearchTimeoutMs(nextSettings.searchTimeoutMs);
1208
+ delete nextSettings.codexRuntimeMode;
1209
+ delete nextSettings.mainPageSessionKeys;
1210
+ delete nextSettings.taskHistory;
1211
+ if (incomingMainPageSessionKeys !== void 0) {
1212
+ this.setMainPageSessionKeys(incomingMainPageSessionKeys);
1213
+ }
1214
+ if (incomingTaskHistory !== void 0 && this.runHistoryStore) {
1215
+ this.runHistoryStore.setEntries(incomingTaskHistory);
1216
+ }
1217
+ nextSettings.appearance = this.normalizeAppearance(nextSettings.appearance);
1218
+ nextSettings.language = this.normalizeLanguage(nextSettings.language);
1219
+ nextSettings.restReminderIntervalSeconds = this.normalizeRestReminderIntervalSeconds(
1220
+ nextSettings.restReminderIntervalSeconds
1221
+ );
1222
+ nextSettings.browserExtensionEnabled = nextSettings.browserExtensionEnabled === true;
1223
+ nextSettings.browserSource = this.normalizeBrowserSource(nextSettings.browserSource);
1224
+ nextSettings.browserExecutablePath = this.normalizeBrowserSetting(nextSettings.browserExecutablePath);
1225
+ nextSettings.browserExternalCdpUrl = this.normalizeBrowserSetting(nextSettings.browserExternalCdpUrl) || "http://127.0.0.1:9222";
1226
+ nextSettings.computerExtensionEnabled = nextSettings.computerExtensionEnabled === true;
1227
+ if (nextSettings.browserExtensionEnabled && nextSettings.browserSource === "isolated") {
1228
+ nextSettings.computerExtensionEnabled = true;
1229
+ }
1230
+ nextSettings.computerCompatibilityMode = nextSettings.computerCompatibilityMode === true;
1231
+ nextSettings.computerImage = this.normalizeBrowserSetting(nextSettings.computerImage) || import_computer_constants.COMPUTER_IMAGE;
1232
+ nextSettings.codeContentFontSize = this.normalizeContentFontSize(
1233
+ nextSettings.codeContentFontSize,
1234
+ DEFAULT_CODE_CONTENT_FONT_SIZE
1235
+ );
1236
+ nextSettings.composerFollowUpBehavior = this.normalizeComposerFollowUpBehavior(
1237
+ nextSettings.composerFollowUpBehavior
1238
+ );
1239
+ nextSettings.crtContentFontSize = this.normalizeContentFontSize(
1240
+ Object.prototype.hasOwnProperty.call(settingsPatch, "crtContentFontSize") ? settingsPatch.crtContentFontSize : Object.prototype.hasOwnProperty.call(settingsPatch, "crtTerminalFontSize") ? Number(settingsPatch.crtTerminalFontSize) - 1 : nextSettings.crtContentFontSize,
1241
+ DEFAULT_CRT_CONTENT_FONT_SIZE
1242
+ );
1243
+ nextSettings.crtSkinEffectsEnabled = nextSettings.crtSkinEffectsEnabled !== false;
1244
+ nextSettings.crtDynamicHeatEnabled = nextSettings.crtDynamicHeatEnabled === true;
1245
+ nextSettings.crtTerminalFontSize = this.crtTerminalFontSizeFromContent(nextSettings.crtContentFontSize);
1246
+ this.normalizeAgentLaunchSettings(settingsPatch, nextSettings);
1247
+ this.pruneUnknownSettings(nextSettings);
1248
+ this.writeSettingsFile(nextSettings);
1249
+ this.settings = nextSettings;
1250
+ }
1251
+ }
1252
+ // Annotate the CommonJS export names for ESM import in node:
1253
+ 0 && (module.exports = {
1254
+ ConfigManager,
1255
+ DEFAULT_CODE_CONTENT_FONT_SIZE,
1256
+ DEFAULT_CRT_CONTENT_FONT_SIZE,
1257
+ DEFAULT_CRT_TERMINAL_FONT_SIZE,
1258
+ DEFAULT_SEARCH_TIMEOUT_MS,
1259
+ MAX_CONTENT_FONT_SIZE,
1260
+ MAX_CRT_TERMINAL_FONT_SIZE,
1261
+ MIN_CONTENT_FONT_SIZE,
1262
+ MIN_CRT_TERMINAL_FONT_SIZE
1263
+ });