farming-code 2.2.30 → 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.
- package/THIRD_PARTY_NOTICES.md +7 -0
- package/backend/acp/{client-services.js → client-services.cjs} +132 -134
- package/backend/acp/packaged-claude-acp.cjs +37 -0
- package/backend/acp/packaged-codex-acp.cjs +37 -0
- package/backend/acp/patch-decisions.cjs +182 -0
- package/backend/acp/permission-security.cjs +131 -0
- package/backend/{acp-checkpoint-store.js → acp-checkpoint-store.cjs} +90 -59
- package/backend/{acp-runtime.js → acp-runtime.cjs} +1220 -1112
- package/backend/acp-session-state.cjs +622 -0
- package/backend/acp-transcript.cjs +525 -0
- package/backend/agent-env.cjs +257 -0
- package/backend/agent-extension-discovery.cjs +452 -0
- package/backend/agent-extension-inventory.cjs +116 -0
- package/backend/agent-json-stream.cjs +283 -0
- package/backend/agent-lifecycle-journal.cjs +185 -0
- package/backend/{agent-manager.js → agent-manager.cjs} +3116 -4275
- package/backend/agent-order-transaction.cjs +85 -0
- package/backend/agent-order.cjs +159 -0
- package/backend/agent-provider-session.cjs +98 -0
- package/backend/agent-runtime-binding.cjs +179 -0
- package/backend/agent-session-history.cjs +1022 -0
- package/backend/agent-session-inventory.cjs +291 -0
- package/backend/async-cache.cjs +104 -0
- package/backend/atomic-json-store.cjs +67 -0
- package/backend/auth.cjs +261 -0
- package/backend/authoritative-inventory-cache.cjs +383 -0
- package/backend/business-health.cjs +68 -0
- package/backend/chat-runtime.cjs +50 -0
- package/backend/claude-settings.cjs +132 -0
- package/backend/cli-agents.cjs +435 -0
- package/backend/codex-context-window.cjs +196 -0
- package/backend/codex-models.cjs +228 -0
- package/backend/codex-session-archive.cjs +82 -0
- package/backend/codex-session-history.cjs +590 -0
- package/backend/{codex-terminal-profile.js → codex-terminal-profile.cjs} +149 -155
- package/backend/codex-transcript-sanitizer.cjs +130 -0
- package/backend/codex-transcript.cjs +2107 -0
- package/backend/command-runner-child.cjs +105 -0
- package/backend/config-manager.cjs +1263 -0
- package/backend/control-api.cjs +439 -0
- package/backend/data/LICENSE.cua +21 -0
- package/backend/executable-discovery.cjs +204 -0
- package/backend/farming-agent-bootstrap.cjs +81 -0
- package/backend/farming-agent-bootstrap.zh_cn.md +6 -2
- package/backend/{farming-app-cli.js → farming-app-cli.cjs} +441 -493
- package/backend/farming-cli.cjs +414 -0
- package/backend/farming-net-pass.cjs +319 -0
- package/backend/farming-net-registry.cjs +123 -0
- package/backend/farming-net-server.cjs +309 -0
- package/backend/farming-session-store.cjs +651 -0
- package/backend/git-worktree-info.cjs +181 -0
- package/backend/haiku-token.cjs +828 -0
- package/backend/index-html.cjs +96 -0
- package/backend/input-parts.cjs +68 -0
- package/backend/input-routing.cjs +40 -0
- package/backend/{local-session-engine.js → local-session-engine.cjs} +276 -282
- package/backend/main-agent-skills.cjs +309 -0
- package/backend/main-page-session.cjs +132 -0
- package/backend/native-pty-controller-generation.cjs +139 -0
- package/backend/{native-pty-host-client.js → native-pty-host-client.cjs} +338 -346
- package/backend/native-pty-host-identity.cjs +125 -0
- package/backend/native-pty-host-path.cjs +68 -0
- package/backend/{native-pty-host.js → native-pty-host.cjs} +480 -569
- package/backend/native-session-engine.cjs +296 -0
- package/backend/network.cjs +57 -0
- package/backend/npm-update-helper.cjs +399 -0
- package/backend/packaged-node-pty.cjs +120 -0
- package/backend/preview-session-manager.cjs +89 -0
- package/backend/provider-adapters.cjs +492 -0
- package/backend/provider-home-configuration.cjs +211 -0
- package/backend/provider-session-id.cjs +79 -0
- package/backend/provider-session-service.cjs +333 -0
- package/backend/qr-share-tickets.cjs +119 -0
- package/backend/resource-broadcast-protocol.cjs +50 -0
- package/backend/review-diff-router.cjs +202 -0
- package/backend/review-diff-service.cjs +1267 -0
- package/backend/review-session-router.cjs +93 -0
- package/backend/review-session-service.cjs +470 -0
- package/backend/review-session-store.cjs +161 -0
- package/backend/review-state-router.cjs +132 -0
- package/backend/review-state-store.cjs +299 -0
- package/backend/run-history-store.cjs +97 -0
- package/backend/runtime-dependency-manager.cjs +893 -0
- package/backend/runtime-executable-invocation.cjs +37 -0
- package/backend/runtime-observation.cjs +96 -0
- package/backend/server-process-identity.cjs +70 -0
- package/backend/server.cjs +3356 -0
- package/backend/session-engine-bridge.cjs +144 -0
- package/backend/session-engine-router.cjs +105 -0
- package/backend/session-engine.cjs +64 -0
- package/backend/session-stream-protocol.cjs +181 -0
- package/backend/shell-busy-integration.cjs +442 -0
- package/backend/slash-command-discovery.cjs +423 -0
- package/backend/storage-layout.cjs +263 -0
- package/backend/system-monitor.cjs +96 -0
- package/backend/terminal-attach-checkpoint.cjs +73 -0
- package/backend/terminal-exit-quiescence.cjs +57 -0
- package/backend/{terminal-reducer-flow-control.js → terminal-reducer-flow-control.cjs} +45 -22
- package/backend/terminal-runtime-cleanup.cjs +99 -0
- package/backend/{terminal-screen-state.js → terminal-screen-state.cjs} +100 -108
- package/backend/{terminal-screen-worker-pool.js → terminal-screen-worker-pool.cjs} +89 -79
- package/backend/{terminal-screen-worker-thread.js → terminal-screen-worker-thread.cjs} +64 -65
- package/backend/terminal-screen-worker.cjs +352 -0
- package/backend/terminal-state-serialization.cjs +147 -0
- package/backend/{terminal-status.js → terminal-status.cjs} +137 -187
- package/backend/theme-manager.cjs +185 -0
- package/backend/{update-service.js → update-service.cjs} +258 -248
- package/backend/usage-forecast.cjs +95 -0
- package/backend/{usage-history-client.js → usage-history-client.cjs} +144 -94
- package/backend/usage-history-smoke.cjs +85 -0
- package/backend/usage-history-worker.cjs +60 -0
- package/backend/{usage-monitor.js → usage-monitor.cjs} +363 -390
- package/backend/workspace-directory.cjs +239 -0
- package/backend/workspace-discovery.cjs +271 -0
- package/backend/{workspace-file-router.js → workspace-file-router.cjs} +213 -282
- package/backend/{workspace-file-service.js → workspace-file-service.cjs} +1139 -1318
- package/backend/workspace-root-registry.cjs +192 -0
- package/bin/farming +1 -1
- package/dist/acp/codex-acp-1.1.4.mjs +18 -1
- package/dist/assets/App-BCkdpWB6.css +1 -0
- package/dist/assets/App-CRjKpaGp.js +697 -0
- package/dist/assets/CodeSelect-Ci8sKZPU.js +1 -0
- package/dist/assets/CodeSelect-T2eNzrOc.css +1 -0
- package/dist/assets/{FileEditorMarkdownPreview-Cs9cLv8a.js → FileEditorMarkdownPreview-V06QHlAg.js} +55 -55
- package/dist/assets/FileEditorPane-BX-Wjg9U.js +2 -0
- package/dist/assets/IconGlyphs-YhV7tqd4.js +1 -0
- package/dist/assets/ProjectFilesSection-BDT2_r0o.js +12 -0
- package/dist/assets/ReviewPage-BqAs5sG1.js +3 -0
- package/dist/assets/code-dark-B7eM_9G9.css +1 -0
- package/dist/assets/{cssMode-Bdg5RpcJ.js → cssMode-ADdAlxTO.js} +1 -1
- package/dist/assets/{editor.api2-D74ufkbr.js → editor.api2-BFLAr0YF.js} +162 -162
- package/dist/assets/file-icons-BpeqWkIB.js +1 -0
- package/dist/assets/{freemarker2-DfMDJfnE.js → freemarker2-C90q5jrp.js} +1 -1
- package/dist/assets/{handlebars-BEdPtzMT.js → handlebars-BwUQcEDq.js} +1 -1
- package/dist/assets/{html-B1fPb1QD.js → html-1s3uPKfh.js} +1 -1
- package/dist/assets/{htmlMode-CY2ZjHxH.js → htmlMode-xtKD99de.js} +1 -1
- package/dist/assets/{index-D-zetSol.js → index-C8MchCem.js} +3 -3
- package/dist/assets/{javascript-BV2OsWA0.js → javascript-Ph7ijyny.js} +1 -1
- package/dist/assets/{jsonMode-zd07aeuX.js → jsonMode-D-jGAnFH.js} +1 -1
- package/dist/assets/linkComputer-CbGyI_qx.js +1 -0
- package/dist/assets/{liquid-BParI24X.js → liquid-0IamE_cI.js} +1 -1
- package/dist/assets/{lspLanguageFeatures-BzredkoV.js → lspLanguageFeatures-BxnQunWF.js} +1 -1
- package/dist/assets/main-CLKXa6hf.css +1 -0
- package/dist/assets/{mdx-vGzUJN98.js → mdx-DdNmfivn.js} +1 -1
- package/dist/assets/{monaco.contribution-BmaeBQEc.js → monaco.contribution-B43jsUs1.js} +2 -2
- package/dist/assets/{python-CUwdLgsI.js → python-IAt4X5TS.js} +1 -1
- package/dist/assets/{razor-BScebUxU.js → razor-DRkFYW0S.js} +1 -1
- package/dist/assets/review-C8-oPKXk.css +1 -0
- package/dist/assets/{tsMode-DzUAibXK.js → tsMode-_d_4U2gf.js} +1 -1
- package/dist/assets/{typescript-D9EOeM7N.js → typescript-C7zcMq9l.js} +1 -1
- package/dist/assets/{workers-DAiomYZM.js → workers-D0nOyJzf.js} +1 -1
- package/dist/assets/workspace-editor-model-DND_Y-Bj.js +1 -0
- package/dist/assets/workspace-editor-monaco-BPWhgcIB.js +4 -0
- package/dist/assets/workspace-editor-monaco-N641qPjX.js +1 -0
- package/dist/assets/workspace-view-state-k1bTlJ_Z.js +13 -0
- package/dist/assets/{xml-wWl1dhkQ.js → xml-BR-HvxT8.js} +1 -1
- package/dist/assets/{yaml-Dc2WDaOZ.js → yaml-YtFQwh4q.js} +1 -1
- package/dist/index.html +1 -1
- package/extensions/browser/backend/agent-browser-runtime.cjs +1040 -0
- package/extensions/browser/backend/agent-capability.cjs +85 -0
- package/extensions/browser/backend/browser-mcp-server.cjs +655 -0
- package/extensions/browser/backend/browser-resource-manager.cjs +1486 -0
- package/extensions/browser/backend/browser-resource-store.cjs +228 -0
- package/extensions/browser/backend/browser-router.cjs +203 -0
- package/extensions/browser/backend/executable-discovery.cjs +248 -0
- package/extensions/browser/backend/farming-browser-client.cjs +116 -0
- package/extensions/browser/backend/index.cjs +32 -0
- package/extensions/browser/backend/managed-chromium-installer.cjs +833 -0
- package/extensions/browser/bin/farming-browser +16 -7
- package/extensions/computer/backend/agent-capability.cjs +72 -0
- package/extensions/computer/backend/computer-constants.cjs +59 -0
- package/extensions/computer/backend/computer-mcp-server.cjs +182 -0
- package/extensions/computer/backend/computer-resource-manager.cjs +1219 -0
- package/extensions/computer/backend/computer-resource-store.cjs +190 -0
- package/extensions/computer/backend/computer-router.cjs +257 -0
- package/extensions/computer/backend/cua-tools.json +3067 -0
- package/extensions/computer/backend/farming-computer-client.cjs +84 -0
- package/extensions/computer/backend/index.cjs +35 -0
- package/extensions/computer/backend/isolated-browser-provider.cjs +157 -0
- package/extensions/computer/bin/farming-computer +131 -0
- package/frontend/farming-net/app.js +255 -262
- package/frontend/ghostty-loader.js +24 -20
- package/frontend/reading-anchor.js +210 -193
- package/frontend/runtime-paths.js +24 -26
- package/frontend/session-bridge.js +90 -111
- package/frontend/session-modal-bridge.js +184 -302
- package/frontend/skin-bridge.js +20 -23
- package/frontend/skins/crt/app.js +7686 -7901
- package/frontend/skins/crt/effects.js +7 -6
- package/frontend/skins/crt/index.html +6 -6
- package/frontend/skins/crt/styles/markdown.css +4 -4
- package/frontend/terminal-bridge.js +174 -181
- package/frontend/terminal-replay.js +320 -345
- package/frontend/theme-loader.js +55 -71
- package/package.json +64 -37
- package/shared/backend-connection-status.js +38 -69
- package/shared/browser-protocol.js +235 -110
- package/shared/websocket-liveness.js +40 -0
- package/backend/acp/packaged-claude-acp.js +0 -13
- package/backend/acp/packaged-codex-acp.js +0 -13
- package/backend/acp/patch-decisions.js +0 -153
- package/backend/acp/permission-security.js +0 -108
- package/backend/acp-session-state.js +0 -634
- package/backend/acp-transcript.js +0 -512
- package/backend/agent-env.js +0 -250
- package/backend/agent-json-stream.js +0 -268
- package/backend/agent-lifecycle-journal.js +0 -133
- package/backend/agent-order.js +0 -166
- package/backend/agent-provider-session.js +0 -76
- package/backend/agent-runtime-binding.js +0 -174
- package/backend/agent-session-history.js +0 -986
- package/backend/async-cache.js +0 -94
- package/backend/atomic-json-store.js +0 -37
- package/backend/auth.js +0 -251
- package/backend/chat-runtime.js +0 -28
- package/backend/claude-settings.js +0 -121
- package/backend/cli-agents.js +0 -486
- package/backend/codex-context-window.js +0 -189
- package/backend/codex-models.js +0 -226
- package/backend/codex-session-archive.js +0 -65
- package/backend/codex-session-history.js +0 -647
- package/backend/codex-transcript-sanitizer.js +0 -115
- package/backend/codex-transcript.js +0 -2362
- package/backend/command-runner-child.js +0 -67
- package/backend/config-manager.js +0 -1117
- package/backend/control-api.js +0 -455
- package/backend/executable-discovery.js +0 -216
- package/backend/farming-agent-bootstrap.js +0 -49
- package/backend/farming-cli.js +0 -403
- package/backend/farming-net-pass.js +0 -285
- package/backend/farming-net-registry.js +0 -112
- package/backend/farming-net-server.js +0 -298
- package/backend/farming-session-store.js +0 -677
- package/backend/git-worktree-info.js +0 -181
- package/backend/haiku-token.js +0 -772
- package/backend/index-html.js +0 -80
- package/backend/input-parts.js +0 -54
- package/backend/input-routing.js +0 -24
- package/backend/json-cli-runtime.js +0 -275
- package/backend/main-agent-skills.js +0 -288
- package/backend/main-page-session.js +0 -122
- package/backend/native-pty-controller-generation.js +0 -106
- package/backend/native-pty-host-identity.js +0 -86
- package/backend/native-pty-host-path.js +0 -42
- package/backend/native-session-engine.js +0 -268
- package/backend/network.js +0 -23
- package/backend/npm-update-helper.js +0 -374
- package/backend/packaged-node-pty.js +0 -99
- package/backend/preview-session-manager.js +0 -68
- package/backend/provider-adapters.js +0 -399
- package/backend/provider-session-id.js +0 -47
- package/backend/provider-session-service.js +0 -345
- package/backend/qr-share-tickets.js +0 -100
- package/backend/review-diff-router.js +0 -180
- package/backend/review-diff-service.js +0 -1270
- package/backend/review-session-router.js +0 -74
- package/backend/review-session-service.js +0 -446
- package/backend/review-session-store.js +0 -151
- package/backend/review-state-router.js +0 -116
- package/backend/review-state-store.js +0 -286
- package/backend/run-history-store.js +0 -67
- package/backend/runtime-dependency-manager.js +0 -759
- package/backend/runtime-executable-invocation.js +0 -20
- package/backend/runtime-observation.js +0 -81
- package/backend/server-process-identity.js +0 -47
- package/backend/server.js +0 -3225
- package/backend/session-engine-bridge.js +0 -129
- package/backend/session-engine-router.js +0 -66
- package/backend/session-engine.js +0 -39
- package/backend/session-stream-protocol.js +0 -185
- package/backend/shell-busy-integration.js +0 -472
- package/backend/slash-command-discovery.js +0 -433
- package/backend/storage-layout.js +0 -205
- package/backend/system-monitor.js +0 -77
- package/backend/terminal-attach-checkpoint.js +0 -74
- package/backend/terminal-exit-quiescence.js +0 -39
- package/backend/terminal-runtime-cleanup.js +0 -80
- package/backend/terminal-screen-worker.js +0 -337
- package/backend/terminal-state-serialization.js +0 -127
- package/backend/theme-manager.js +0 -163
- package/backend/usage-forecast.js +0 -86
- package/backend/usage-history-scanner.ts +0 -2718
- package/backend/usage-history-smoke.js +0 -64
- package/backend/usage-history-worker.js +0 -34
- package/backend/workspace-directory.js +0 -232
- package/backend/workspace-discovery.js +0 -311
- package/backend/workspace-root-registry.js +0 -166
- package/dist/assets/App-BKNUILuL.css +0 -1
- package/dist/assets/App-Z1N7T0eM.js +0 -695
- package/dist/assets/FileEditorPane-CNtuGjQ3.js +0 -2
- package/dist/assets/IconGlyphs-BClgag6E.js +0 -1
- package/dist/assets/ProjectFilesSection-K3GHuQ4U.js +0 -12
- package/dist/assets/ReviewPage-BRuxFaH5.js +0 -3
- package/dist/assets/code-dark-kLsQLvpf.css +0 -1
- package/dist/assets/file-icons-BOlcJ0ZF.js +0 -1
- package/dist/assets/main-DUTz-Rd2.css +0 -1
- package/dist/assets/review-BcnwQtJv.css +0 -1
- package/dist/assets/workspace-editor-model-CSGCl21x.js +0 -1
- package/dist/assets/workspace-editor-monaco-CJNwbpCy.js +0 -4
- package/dist/assets/workspace-editor-monaco-CO9w8YV0.js +0 -1
- package/dist/assets/workspace-view-state-BjKPYp0E.js +0 -7
- package/extensions/browser/backend/agent-browser-runtime.js +0 -1041
- package/extensions/browser/backend/agent-capability.js +0 -55
- package/extensions/browser/backend/browser-mcp-server.js +0 -621
- package/extensions/browser/backend/browser-resource-manager.js +0 -1331
- package/extensions/browser/backend/browser-resource-store.js +0 -190
- package/extensions/browser/backend/browser-router.js +0 -141
- package/extensions/browser/backend/executable-discovery.js +0 -238
- package/extensions/browser/backend/farming-browser-client.js +0 -83
- package/extensions/browser/backend/index.js +0 -7
- package/extensions/browser/backend/managed-chromium-installer.js +0 -593
- package/extensions/browser/frontend/BrowserSidebarPortals.tsx +0 -360
- package/extensions/browser/frontend/BrowserViewer.tsx +0 -500
- package/extensions/browser/frontend/browser-resource-state.ts +0 -60
- package/extensions/browser/frontend/browser.css +0 -567
- package/extensions/browser/frontend/types.ts +0 -38
- package/extensions/browser/frontend/useBrowserResources.ts +0 -166
- package/frontend/vendor/ghostty-web/index.d.ts +0 -1842
- package/shared/backend-connection-status.d.ts +0 -37
- package/shared/browser-protocol.d.ts +0 -5
- /package/dist/assets/{api-w2x5QfxB.js → api-ByCV9MEr.js} +0 -0
- /package/dist/assets/{core-vPkV8P_m.js → core-Czwdx12k.js} +0 -0
- /package/dist/assets/{fsharp-DNZNZyEE.js → fsharp-BjPpkoJe.js} +0 -0
- /package/dist/assets/{go-_kPJjNc_.js → go-BkIDmSUP.js} +0 -0
- /package/dist/assets/{graphql-4HCNVt5g.js → graphql-CCJTpqi1.js} +0 -0
- /package/dist/assets/{hcl-C87ymY0o.js → hcl-s4z8lUFg.js} +0 -0
- /package/dist/assets/{ini-BYrrGNTc.js → ini-CyUW1I7Z.js} +0 -0
- /package/dist/assets/{java-B211rJbk.js → java-CFCcGRiM.js} +0 -0
- /package/dist/assets/{julia-DVPsRtBm.js → julia-DQyH_EYb.js} +0 -0
- /package/dist/assets/{kotlin-BYyNerjp.js → kotlin-B8hA5O51.js} +0 -0
- /package/dist/assets/{less-EC9UblGE.js → less-DaVdaas0.js} +0 -0
- /package/dist/assets/{lexon-B1yuUdqW.js → lexon-DLBhPd3y.js} +0 -0
- /package/dist/assets/{lua-Bo6GFzxT.js → lua-gB1c_cif.js} +0 -0
- /package/dist/assets/{m3-C-Y9cBVI.js → m3-C2T3z3gB.js} +0 -0
- /package/dist/assets/{markdown-BHu-wLbe.js → markdown-CKq-Euj1.js} +0 -0
- /package/dist/assets/{mips-Dkds26rX.js → mips-Bcs5qIDX.js} +0 -0
- /package/dist/assets/{msdax-PU4g-8_g.js → msdax-CBP48FHF.js} +0 -0
- /package/dist/assets/{mysql-fPpuGpS7.js → mysql-c7tiPcFj.js} +0 -0
- /package/dist/assets/{objective-c-Wy1e5JUf.js → objective-c-D4BZkeEV.js} +0 -0
- /package/dist/assets/{pascal-BIXwvrqU.js → pascal-CJDZg0MN.js} +0 -0
- /package/dist/assets/{pascaligo-DwR0AtL_.js → pascaligo-Bygi8Ynl.js} +0 -0
- /package/dist/assets/{perl-CGHAl8my.js → perl-aS8bkf7E.js} +0 -0
- /package/dist/assets/{pgsql-B91M73E2.js → pgsql-CzNAYFYl.js} +0 -0
- /package/dist/assets/{php-C70ttrCx.js → php-DOtoEFTT.js} +0 -0
- /package/dist/assets/{pla-BNrXaRh0.js → pla-DugRnao1.js} +0 -0
- /package/dist/assets/{postiats-Dv2IAZR9.js → postiats-DsXwusKh.js} +0 -0
- /package/dist/assets/{powerquery-CkY5Wq7J.js → powerquery-DL3o72oD.js} +0 -0
- /package/dist/assets/{powershell-uGIYLU3C.js → powershell-C1qHekys.js} +0 -0
- /package/dist/assets/{protobuf-CavfmJu-.js → protobuf-DHgsc-cH.js} +0 -0
- /package/dist/assets/{pug-Drqnyitx.js → pug-FZXlE_Iu.js} +0 -0
- /package/dist/assets/{qrcode-7uGsTEmi.js → qrcode-DJDTdjL7.js} +0 -0
- /package/dist/assets/{qsharp-C7yF-Dti.js → qsharp-bLyhI3DT.js} +0 -0
- /package/dist/assets/{r-HXLGP0_-.js → r-DjFGXbAa.js} +0 -0
- /package/dist/assets/{redis-C4y6mf2p.js → redis-DSoZ_V6u.js} +0 -0
- /package/dist/assets/{redshift-DdQrFPrv.js → redshift-CzkdCsrg.js} +0 -0
- /package/dist/assets/{restructuredtext-CBrf2PNj.js → restructuredtext-B_XPrGCQ.js} +0 -0
- /package/dist/assets/{ruby-CVtMoX2B.js → ruby-Cry2RneJ.js} +0 -0
- /package/dist/assets/{rust-Ckq4sbMP.js → rust-CWzdbFq1.js} +0 -0
- /package/dist/assets/{sb-er66OpE3.js → sb-DmofU59h.js} +0 -0
- /package/dist/assets/{scala-BdWZz-hH.js → scala-BUC2l-vN.js} +0 -0
- /package/dist/assets/{scheme-kTV_s2kP.js → scheme-CNIB_72f.js} +0 -0
- /package/dist/assets/{scss-Bymy2VJQ.js → scss-DcL4-NbX.js} +0 -0
- /package/dist/assets/{shell-bwEP1LQ1.js → shell-CgAGvSSA.js} +0 -0
- /package/dist/assets/{solidity-DCddeBgL.js → solidity-DSkt6O_P.js} +0 -0
- /package/dist/assets/{sophia-BMN3AQig.js → sophia--5ytcjDN.js} +0 -0
- /package/dist/assets/{sparql-CSXOLjzi.js → sparql-C1Srr7cD.js} +0 -0
- /package/dist/assets/{sql-COg8ewmK.js → sql-2k_O5fj7.js} +0 -0
- /package/dist/assets/{st-CIaZtBS_.js → st-DCCCPqfz.js} +0 -0
- /package/dist/assets/{swift-DXiOhUHu.js → swift-Dd8mAfOt.js} +0 -0
- /package/dist/assets/{systemverilog-BTDE6Dr2.js → systemverilog-B0-aZYXu.js} +0 -0
- /package/dist/assets/{tcl-B0zy9NvV.js → tcl-CZAZwPVX.js} +0 -0
- /package/dist/assets/{twig-D594l4Z1.js → twig-D-Ag0tdS.js} +0 -0
- /package/dist/assets/{typespec-XKVjaPqo.js → typespec-B7kTFp0Z.js} +0 -0
- /package/dist/assets/{useWorkspaceMenuKeyboard-Bpy_s69Z.js → useWorkspaceMenuKeyboard-uYZpDxhU.js} +0 -0
- /package/dist/assets/{vb-B2wYoKRV.js → vb-20w1JPum.js} +0 -0
- /package/dist/assets/{wgsl-D0Yf2LbK.js → wgsl-CLJfqFt0.js} +0 -0
- /package/dist/assets/{workspace-working-copy-C3FSR3N6.js → workspace-working-copy-Cfz07cOd.js} +0 -0
|
@@ -0,0 +1,161 @@
|
|
|
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 review_session_store_exports = {};
|
|
31
|
+
__export(review_session_store_exports, {
|
|
32
|
+
OBJECT_ID_PATTERN: () => OBJECT_ID_PATTERN,
|
|
33
|
+
REVIEW_ID_PATTERN: () => REVIEW_ID_PATTERN,
|
|
34
|
+
ReviewSessionStore: () => ReviewSessionStore
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(review_session_store_exports);
|
|
37
|
+
var import_atomic_json_store = require("./atomic-json-store.cjs");
|
|
38
|
+
var storageLayout = __toESM(require("./storage-layout.cjs"));
|
|
39
|
+
const crypto = require("crypto");
|
|
40
|
+
const fs = require("fs");
|
|
41
|
+
const path = require("path");
|
|
42
|
+
const REVIEW_ID_PATTERN = /^review-[a-f0-9]{32}$/;
|
|
43
|
+
const OBJECT_ID_PATTERN = /^[a-f0-9]{40,64}$/;
|
|
44
|
+
function isObject(value) {
|
|
45
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
46
|
+
}
|
|
47
|
+
function clone(value) {
|
|
48
|
+
return JSON.parse(JSON.stringify(value));
|
|
49
|
+
}
|
|
50
|
+
function validRevision(value) {
|
|
51
|
+
return isObject(value) && typeof value.tree === "string" && OBJECT_ID_PATTERN.test(value.tree) && typeof value.number === "number" && Number.isInteger(value.number) && value.number > 0 && typeof value.createdAt === "string" && (value.previousTree === void 0 || typeof value.previousTree === "string" && OBJECT_ID_PATTERN.test(value.previousTree));
|
|
52
|
+
}
|
|
53
|
+
function validStoredPath(value) {
|
|
54
|
+
return typeof value === "string" && value.length > 0 && value.length <= 4096 && !value.startsWith("/") && !value.includes("\0") && value.split(/[\\/]/).every((segment) => segment && segment !== "." && segment !== "..");
|
|
55
|
+
}
|
|
56
|
+
function validSession(value) {
|
|
57
|
+
return isObject(value) && typeof value.id === "string" && REVIEW_ID_PATTERN.test(value.id) && typeof value.root === "string" && path.isAbsolute(value.root) && typeof value.base === "string" && OBJECT_ID_PATTERN.test(value.base) && typeof value.createdAt === "string" && typeof value.updatedAt === "string" && (value.scope === void 0 || value.scope === "tracked" || value.scope === "untracked") && (value.modifiedWithinDays === void 0 || typeof value.modifiedWithinDays === "number" && Number.isInteger(value.modifiedWithinDays) && value.modifiedWithinDays >= 1 && value.modifiedWithinDays <= 3650) && (value.paths === void 0 || Array.isArray(value.paths) && value.paths.length <= 256 && value.paths.every(validStoredPath)) && Array.isArray(value.revisions) && value.revisions.length > 0 && value.revisions.every(validRevision);
|
|
58
|
+
}
|
|
59
|
+
function normalizeState(value) {
|
|
60
|
+
const sessions = isObject(value) && isObject(value.sessions) ? value.sessions : {};
|
|
61
|
+
return {
|
|
62
|
+
sessions: Object.fromEntries(Object.entries(sessions).filter((entry) => {
|
|
63
|
+
const [id, session] = entry;
|
|
64
|
+
return REVIEW_ID_PATTERN.test(id) && validSession(session) && session.id === id;
|
|
65
|
+
}))
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
class ReviewSessionStore {
|
|
69
|
+
file;
|
|
70
|
+
writeJson;
|
|
71
|
+
state;
|
|
72
|
+
constructor(configDir, options = {}) {
|
|
73
|
+
this.file = options.file || storageLayout.reviewSessionsFile(configDir);
|
|
74
|
+
this.writeJson = typeof options.writeJson === "function" ? options.writeJson : (file, value) => (0, import_atomic_json_store.atomicWriteJson)(file, value, { trailingNewline: true });
|
|
75
|
+
this.state = null;
|
|
76
|
+
}
|
|
77
|
+
ensureState() {
|
|
78
|
+
if (this.state) return this.state;
|
|
79
|
+
try {
|
|
80
|
+
this.state = fs.existsSync(this.file) ? normalizeState(JSON.parse(fs.readFileSync(this.file, "utf8"))) : { sessions: {} };
|
|
81
|
+
} catch (error) {
|
|
82
|
+
console.warn(
|
|
83
|
+
"Failed to read Farming review sessions:",
|
|
84
|
+
error instanceof Error ? error.message : error
|
|
85
|
+
);
|
|
86
|
+
this.state = { sessions: {} };
|
|
87
|
+
}
|
|
88
|
+
return this.state;
|
|
89
|
+
}
|
|
90
|
+
newId() {
|
|
91
|
+
return `review-${crypto.randomUUID().replace(/-/g, "")}`;
|
|
92
|
+
}
|
|
93
|
+
get(reviewId) {
|
|
94
|
+
if (!REVIEW_ID_PATTERN.test(reviewId)) return null;
|
|
95
|
+
const session = this.ensureState().sessions[reviewId];
|
|
96
|
+
return session ? clone(session) : null;
|
|
97
|
+
}
|
|
98
|
+
create({
|
|
99
|
+
id,
|
|
100
|
+
root,
|
|
101
|
+
base,
|
|
102
|
+
tree,
|
|
103
|
+
scope,
|
|
104
|
+
modifiedWithinDays,
|
|
105
|
+
paths,
|
|
106
|
+
createdAt = (/* @__PURE__ */ new Date()).toISOString()
|
|
107
|
+
}) {
|
|
108
|
+
if (!REVIEW_ID_PATTERN.test(id) || !path.isAbsolute(root) || !OBJECT_ID_PATTERN.test(base) || !OBJECT_ID_PATTERN.test(tree)) {
|
|
109
|
+
throw new TypeError("invalid review session");
|
|
110
|
+
}
|
|
111
|
+
const currentState = this.ensureState();
|
|
112
|
+
if (currentState.sessions[id]) throw new TypeError("review session already exists");
|
|
113
|
+
const session = {
|
|
114
|
+
base,
|
|
115
|
+
createdAt,
|
|
116
|
+
id,
|
|
117
|
+
revisions: [{ createdAt, number: 1, tree }],
|
|
118
|
+
root,
|
|
119
|
+
...scope === "tracked" || scope === "untracked" ? { scope } : {},
|
|
120
|
+
...Number.isInteger(modifiedWithinDays) ? { modifiedWithinDays } : {},
|
|
121
|
+
...Array.isArray(paths) ? { paths: [...paths] } : {},
|
|
122
|
+
updatedAt: createdAt
|
|
123
|
+
};
|
|
124
|
+
const nextState = {
|
|
125
|
+
sessions: { ...currentState.sessions, [id]: session }
|
|
126
|
+
};
|
|
127
|
+
this.writeJson(this.file, nextState);
|
|
128
|
+
this.state = nextState;
|
|
129
|
+
return clone(session);
|
|
130
|
+
}
|
|
131
|
+
appendRevision(reviewId, tree, createdAt = (/* @__PURE__ */ new Date()).toISOString()) {
|
|
132
|
+
if (!OBJECT_ID_PATTERN.test(tree)) throw new TypeError("invalid review revision");
|
|
133
|
+
const currentState = this.ensureState();
|
|
134
|
+
const currentSession = currentState.sessions[reviewId];
|
|
135
|
+
if (!currentSession) throw new TypeError("review session not found");
|
|
136
|
+
const previous = currentSession.revisions[currentSession.revisions.length - 1];
|
|
137
|
+
if (previous.tree === tree) return { added: false, session: clone(currentSession) };
|
|
138
|
+
const nextSession = {
|
|
139
|
+
...currentSession,
|
|
140
|
+
revisions: [...currentSession.revisions, {
|
|
141
|
+
createdAt,
|
|
142
|
+
number: previous.number + 1,
|
|
143
|
+
previousTree: previous.tree,
|
|
144
|
+
tree
|
|
145
|
+
}],
|
|
146
|
+
updatedAt: createdAt
|
|
147
|
+
};
|
|
148
|
+
const nextState = {
|
|
149
|
+
sessions: { ...currentState.sessions, [reviewId]: nextSession }
|
|
150
|
+
};
|
|
151
|
+
this.writeJson(this.file, nextState);
|
|
152
|
+
this.state = nextState;
|
|
153
|
+
return { added: true, session: clone(nextSession) };
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
157
|
+
0 && (module.exports = {
|
|
158
|
+
OBJECT_ID_PATTERN,
|
|
159
|
+
REVIEW_ID_PATTERN,
|
|
160
|
+
ReviewSessionStore
|
|
161
|
+
});
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
// Generated by scripts/build-backend-runtime.ts. Do not edit.
|
|
2
|
+
"use strict";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var review_state_router_exports = {};
|
|
21
|
+
__export(review_state_router_exports, {
|
|
22
|
+
createReviewStateRouter: () => createReviewStateRouter
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(review_state_router_exports);
|
|
25
|
+
const express = require("express");
|
|
26
|
+
const expressFactory = express;
|
|
27
|
+
function sendError(res, error) {
|
|
28
|
+
if (error instanceof TypeError) {
|
|
29
|
+
res.status(400).json({ error: error.message });
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
console.error("Review state API error:", error);
|
|
33
|
+
res.status(500).json({ error: "review state operation failed" });
|
|
34
|
+
}
|
|
35
|
+
function isReviewedQuery(value) {
|
|
36
|
+
return value === "" || value === true || value === "true" || value === "1";
|
|
37
|
+
}
|
|
38
|
+
function createReviewStateRouter(reviewStateStore) {
|
|
39
|
+
const router = expressFactory.Router();
|
|
40
|
+
router.use(expressFactory.json({ limit: "32kb" }));
|
|
41
|
+
router.get("/:reviewId/revisions/:patchset/files", (req, res) => {
|
|
42
|
+
try {
|
|
43
|
+
if (req.query.reviewed === void 0) {
|
|
44
|
+
res.status(400).json({ error: "reviewed query is required" });
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (!isReviewedQuery(req.query.reviewed)) {
|
|
48
|
+
res.status(400).json({ error: "reviewed query must be bare or true" });
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const state = reviewStateStore.getPatchsetState(req.params.reviewId, req.params.patchset);
|
|
52
|
+
res.set("X-Farming-Review-Revision", String(state.revision));
|
|
53
|
+
res.json(state.reviewedPaths);
|
|
54
|
+
} catch (error) {
|
|
55
|
+
sendError(res, error);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
router.put("/:reviewId/revisions/:patchset/files/:filePath/reviewed", (req, res) => {
|
|
59
|
+
try {
|
|
60
|
+
const result = reviewStateStore.setFileReviewedGerrit({
|
|
61
|
+
reviewId: req.params.reviewId,
|
|
62
|
+
patchset: req.params.patchset,
|
|
63
|
+
path: req.params.filePath,
|
|
64
|
+
reviewed: true
|
|
65
|
+
});
|
|
66
|
+
res.set("X-Farming-Review-Revision", String(result.state.revision));
|
|
67
|
+
res.status(result.changed ? 201 : 200).send();
|
|
68
|
+
} catch (error) {
|
|
69
|
+
sendError(res, error);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
router.delete("/:reviewId/revisions/:patchset/files/:filePath/reviewed", (req, res) => {
|
|
73
|
+
try {
|
|
74
|
+
const result = reviewStateStore.setFileReviewedGerrit({
|
|
75
|
+
reviewId: req.params.reviewId,
|
|
76
|
+
patchset: req.params.patchset,
|
|
77
|
+
path: req.params.filePath,
|
|
78
|
+
reviewed: false
|
|
79
|
+
});
|
|
80
|
+
res.set("X-Farming-Review-Revision", String(result.state.revision));
|
|
81
|
+
res.status(204).send();
|
|
82
|
+
} catch (error) {
|
|
83
|
+
sendError(res, error);
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
router.get("/:reviewId/patchsets/:patchset/comments", (req, res) => {
|
|
87
|
+
try {
|
|
88
|
+
res.json({ comments: reviewStateStore.getComments(req.params.reviewId, req.params.patchset) });
|
|
89
|
+
} catch (error) {
|
|
90
|
+
sendError(res, error);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
router.post("/:reviewId/patchsets/:patchset/comments", (req, res) => {
|
|
94
|
+
try {
|
|
95
|
+
res.status(201).json(reviewStateStore.saveComment({
|
|
96
|
+
reviewId: req.params.reviewId,
|
|
97
|
+
patchset: req.params.patchset,
|
|
98
|
+
comment: req.body
|
|
99
|
+
}));
|
|
100
|
+
} catch (error) {
|
|
101
|
+
sendError(res, error);
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
router.delete("/:reviewId/patchsets/:patchset/comments/:commentId", (req, res) => {
|
|
105
|
+
try {
|
|
106
|
+
res.json({ comments: reviewStateStore.deleteComment({
|
|
107
|
+
reviewId: req.params.reviewId,
|
|
108
|
+
patchset: req.params.patchset,
|
|
109
|
+
commentId: req.params.commentId
|
|
110
|
+
}) });
|
|
111
|
+
} catch (error) {
|
|
112
|
+
sendError(res, error);
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
router.patch("/:reviewId/patchsets/:patchset/comments/:commentId", (req, res) => {
|
|
116
|
+
try {
|
|
117
|
+
res.json(reviewStateStore.updateCommentStatus({
|
|
118
|
+
reviewId: req.params.reviewId,
|
|
119
|
+
patchset: req.params.patchset,
|
|
120
|
+
commentId: req.params.commentId,
|
|
121
|
+
status: req.body?.status
|
|
122
|
+
}));
|
|
123
|
+
} catch (error) {
|
|
124
|
+
sendError(res, error);
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
return router;
|
|
128
|
+
}
|
|
129
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
130
|
+
0 && (module.exports = {
|
|
131
|
+
createReviewStateRouter
|
|
132
|
+
});
|
|
@@ -0,0 +1,299 @@
|
|
|
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 review_state_store_exports = {};
|
|
31
|
+
__export(review_state_store_exports, {
|
|
32
|
+
ReviewStateStore: () => ReviewStateStore,
|
|
33
|
+
isSafeKey: () => isSafeKey,
|
|
34
|
+
isSafeRepositoryPath: () => isSafeRepositoryPath
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(review_state_store_exports);
|
|
37
|
+
var import_atomic_json_store = require("./atomic-json-store.cjs");
|
|
38
|
+
var storageLayout = __toESM(require("./storage-layout.cjs"));
|
|
39
|
+
const fs = require("fs");
|
|
40
|
+
const MAX_KEY_LENGTH = 200;
|
|
41
|
+
const MAX_PATH_LENGTH = 4096;
|
|
42
|
+
const MAX_COMMENT_ID_LENGTH = 256;
|
|
43
|
+
const MAX_COMMENT_BODY_LENGTH = 2e4;
|
|
44
|
+
function isObject(value) {
|
|
45
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
46
|
+
}
|
|
47
|
+
function ownValue(object, key) {
|
|
48
|
+
return object && Object.prototype.hasOwnProperty.call(object, key) ? object[key] : void 0;
|
|
49
|
+
}
|
|
50
|
+
function isSafeKey(value) {
|
|
51
|
+
return typeof value === "string" && value.length > 0 && value.length <= MAX_KEY_LENGTH && /^[A-Za-z0-9]/.test(value) && !/[\\\0\r\n\t]/.test(value);
|
|
52
|
+
}
|
|
53
|
+
function isSafeRepositoryPath(value) {
|
|
54
|
+
if (value === "/COMMIT_MSG" || value === "/MERGE_LIST") return true;
|
|
55
|
+
if (typeof value !== "string" || !value || value.length > MAX_PATH_LENGTH || value.includes("\0")) return false;
|
|
56
|
+
if (value.startsWith("/") || value.startsWith("\\")) return false;
|
|
57
|
+
return value.split(/[\\/]/).every((segment) => segment && segment !== "." && segment !== "..");
|
|
58
|
+
}
|
|
59
|
+
function uniquePaths(paths) {
|
|
60
|
+
if (!Array.isArray(paths)) return [];
|
|
61
|
+
return [...new Set(paths.filter(isSafeRepositoryPath))];
|
|
62
|
+
}
|
|
63
|
+
function isSafeCommentId(value) {
|
|
64
|
+
return typeof value === "string" && value.length > 0 && value.length <= MAX_COMMENT_ID_LENGTH && /^[A-Za-z0-9][A-Za-z0-9._:-]*$/.test(value);
|
|
65
|
+
}
|
|
66
|
+
function normalizeCommentRange(value) {
|
|
67
|
+
if (!isObject(value)) return null;
|
|
68
|
+
const range = {
|
|
69
|
+
end_character: value.end_character,
|
|
70
|
+
end_line: value.end_line,
|
|
71
|
+
start_character: value.start_character,
|
|
72
|
+
start_line: value.start_line
|
|
73
|
+
};
|
|
74
|
+
if (typeof range.start_line !== "number" || !Number.isInteger(range.start_line) || range.start_line < 1 || typeof range.end_line !== "number" || !Number.isInteger(range.end_line) || range.end_line < 1 || typeof range.start_character !== "number" || !Number.isInteger(range.start_character) || range.start_character < 0 || typeof range.end_character !== "number" || !Number.isInteger(range.end_character) || range.end_character < 0 || range.start_line > range.end_line || range.start_line === range.end_line && range.start_character >= range.end_character) return null;
|
|
75
|
+
return {
|
|
76
|
+
end_character: range.end_character,
|
|
77
|
+
end_line: range.end_line,
|
|
78
|
+
start_character: range.start_character,
|
|
79
|
+
start_line: range.start_line
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
function normalizeComment(value, patchset) {
|
|
83
|
+
if (!isObject(value)) return null;
|
|
84
|
+
const body = typeof value.body === "string" ? value.body.trim() : "";
|
|
85
|
+
if (!isSafeCommentId(value.id) || !isSafeRepositoryPath(value.path) || typeof value.line !== "number" || !Number.isInteger(value.line) || value.line < 1 || value.line > 1e8 || !body || body.length > MAX_COMMENT_BODY_LENGTH || value.side !== "left" && value.side !== "right" && value.side !== "unified" || value.patchset !== patchset) return null;
|
|
86
|
+
const range = value.range === void 0 ? void 0 : normalizeCommentRange(value.range);
|
|
87
|
+
if (value.range !== void 0 && !range) return null;
|
|
88
|
+
const status = value.status === "open" || value.status === "resolved" || value.status === "outdated" ? value.status : void 0;
|
|
89
|
+
return {
|
|
90
|
+
body,
|
|
91
|
+
id: value.id,
|
|
92
|
+
line: value.line,
|
|
93
|
+
patchset,
|
|
94
|
+
path: value.path,
|
|
95
|
+
...range ? { range } : {},
|
|
96
|
+
side: value.side,
|
|
97
|
+
...status ? { status } : {},
|
|
98
|
+
...isSafeKey(value.sourcePatchset) ? { sourcePatchset: value.sourcePatchset } : {}
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
function normalizeComments(value, patchset) {
|
|
102
|
+
if (!Array.isArray(value)) return [];
|
|
103
|
+
const seen = /* @__PURE__ */ new Set();
|
|
104
|
+
return value.reduce((comments, item) => {
|
|
105
|
+
const comment = normalizeComment(item, patchset);
|
|
106
|
+
if (!comment || seen.has(comment.id)) return comments;
|
|
107
|
+
seen.add(comment.id);
|
|
108
|
+
comments.push(comment);
|
|
109
|
+
return comments;
|
|
110
|
+
}, []);
|
|
111
|
+
}
|
|
112
|
+
function normalizePatchsets(value) {
|
|
113
|
+
if (!isObject(value)) return {};
|
|
114
|
+
return Object.fromEntries(Object.entries(value).filter(([patchset]) => isSafeKey(patchset)).map(([patchset, entry]) => {
|
|
115
|
+
const candidate = isObject(entry) ? entry : {};
|
|
116
|
+
const revision = typeof candidate.revision === "number" && Number.isInteger(candidate.revision) && candidate.revision >= 0 ? candidate.revision : 0;
|
|
117
|
+
return [patchset, {
|
|
118
|
+
comments: normalizeComments(candidate.comments, patchset),
|
|
119
|
+
reviewedPaths: uniquePaths(candidate.reviewedPaths),
|
|
120
|
+
revision
|
|
121
|
+
}];
|
|
122
|
+
}));
|
|
123
|
+
}
|
|
124
|
+
function normalizeReviews(value) {
|
|
125
|
+
if (!isObject(value)) return {};
|
|
126
|
+
return Object.fromEntries(Object.entries(value).filter(([reviewId]) => isSafeKey(reviewId)).map(([reviewId, entry]) => {
|
|
127
|
+
const candidate = isObject(entry) ? entry : {};
|
|
128
|
+
return [reviewId, { patchsets: normalizePatchsets(candidate.patchsets) }];
|
|
129
|
+
}));
|
|
130
|
+
}
|
|
131
|
+
function clone(value) {
|
|
132
|
+
return JSON.parse(JSON.stringify(value));
|
|
133
|
+
}
|
|
134
|
+
class ReviewStateStore {
|
|
135
|
+
file;
|
|
136
|
+
seedReviews;
|
|
137
|
+
writeJson;
|
|
138
|
+
state;
|
|
139
|
+
constructor(configDir, options = {}) {
|
|
140
|
+
this.file = options.file || storageLayout.reviewStateFile(configDir);
|
|
141
|
+
this.seedReviews = normalizeReviews(options.seedReviews);
|
|
142
|
+
this.writeJson = typeof options.writeJson === "function" ? options.writeJson : (file, value) => (0, import_atomic_json_store.atomicWriteJson)(file, value, { trailingNewline: true });
|
|
143
|
+
this.state = null;
|
|
144
|
+
}
|
|
145
|
+
readState() {
|
|
146
|
+
try {
|
|
147
|
+
if (!fs.existsSync(this.file)) return { reviews: {} };
|
|
148
|
+
const parsed = JSON.parse(fs.readFileSync(this.file, "utf8"));
|
|
149
|
+
return { reviews: normalizeReviews(isObject(parsed) ? parsed.reviews : void 0) };
|
|
150
|
+
} catch (error) {
|
|
151
|
+
console.warn(
|
|
152
|
+
"Failed to read Farming review state:",
|
|
153
|
+
error instanceof Error ? error.message : error
|
|
154
|
+
);
|
|
155
|
+
return { reviews: {} };
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
ensureState() {
|
|
159
|
+
if (!this.state) this.state = this.readState();
|
|
160
|
+
return this.state;
|
|
161
|
+
}
|
|
162
|
+
initialPatchsetState(reviewId, patchset) {
|
|
163
|
+
const review = ownValue(this.seedReviews, reviewId);
|
|
164
|
+
const patchsets = review?.patchsets;
|
|
165
|
+
return ownValue(patchsets, patchset) || { comments: [], reviewedPaths: [], revision: 0 };
|
|
166
|
+
}
|
|
167
|
+
getPatchsetState(reviewId, patchset) {
|
|
168
|
+
if (!isSafeKey(reviewId) || !isSafeKey(patchset)) throw new TypeError("reviewId and patchset are required");
|
|
169
|
+
const state = this.ensureState();
|
|
170
|
+
const review = ownValue(state.reviews, reviewId);
|
|
171
|
+
const patchsets = review?.patchsets;
|
|
172
|
+
const stored = ownValue(patchsets, patchset);
|
|
173
|
+
return clone(stored || this.initialPatchsetState(reviewId, patchset));
|
|
174
|
+
}
|
|
175
|
+
setFileReviewedGerrit({
|
|
176
|
+
reviewId,
|
|
177
|
+
patchset,
|
|
178
|
+
path: filePath,
|
|
179
|
+
reviewed
|
|
180
|
+
}) {
|
|
181
|
+
if (!isSafeKey(reviewId) || !isSafeKey(patchset) || !isSafeRepositoryPath(filePath) || typeof reviewed !== "boolean") {
|
|
182
|
+
throw new TypeError("invalid review status request");
|
|
183
|
+
}
|
|
184
|
+
const current = this.getPatchsetState(reviewId, patchset);
|
|
185
|
+
const reviewedPaths = new Set(current.reviewedPaths);
|
|
186
|
+
const alreadyReviewed = reviewedPaths.has(filePath);
|
|
187
|
+
if (alreadyReviewed === reviewed) return { changed: false, state: current };
|
|
188
|
+
if (reviewed) reviewedPaths.add(filePath);
|
|
189
|
+
else reviewedPaths.delete(filePath);
|
|
190
|
+
const next = {
|
|
191
|
+
comments: current.comments,
|
|
192
|
+
reviewedPaths: [...reviewedPaths],
|
|
193
|
+
revision: current.revision + 1
|
|
194
|
+
};
|
|
195
|
+
this.writePatchsetState(reviewId, patchset, next);
|
|
196
|
+
return { changed: true, state: clone(next) };
|
|
197
|
+
}
|
|
198
|
+
getComments(reviewId, patchset) {
|
|
199
|
+
return this.getPatchsetState(reviewId, patchset).comments;
|
|
200
|
+
}
|
|
201
|
+
saveComment({
|
|
202
|
+
reviewId,
|
|
203
|
+
patchset,
|
|
204
|
+
comment
|
|
205
|
+
}) {
|
|
206
|
+
if (!isSafeKey(reviewId) || !isSafeKey(patchset)) throw new TypeError("reviewId and patchset are required");
|
|
207
|
+
const normalizedComment = normalizeComment(comment, patchset);
|
|
208
|
+
if (!normalizedComment) throw new TypeError("invalid review comment");
|
|
209
|
+
const current = this.getPatchsetState(reviewId, patchset);
|
|
210
|
+
const existing = current.comments.find((item) => item.id === normalizedComment.id);
|
|
211
|
+
if (existing) {
|
|
212
|
+
if (JSON.stringify(existing) === JSON.stringify(normalizedComment)) return clone(existing);
|
|
213
|
+
throw new TypeError("review comment id already exists");
|
|
214
|
+
}
|
|
215
|
+
const next = { ...current, comments: [...current.comments, normalizedComment] };
|
|
216
|
+
this.writePatchsetState(reviewId, patchset, next);
|
|
217
|
+
return clone(normalizedComment);
|
|
218
|
+
}
|
|
219
|
+
deleteComment({
|
|
220
|
+
reviewId,
|
|
221
|
+
patchset,
|
|
222
|
+
commentId
|
|
223
|
+
}) {
|
|
224
|
+
if (!isSafeKey(reviewId) || !isSafeKey(patchset) || !isSafeCommentId(commentId)) {
|
|
225
|
+
throw new TypeError("invalid review comment request");
|
|
226
|
+
}
|
|
227
|
+
const current = this.getPatchsetState(reviewId, patchset);
|
|
228
|
+
if (!current.comments.some((comment) => comment.id === commentId)) return clone(current.comments);
|
|
229
|
+
const next = { ...current, comments: current.comments.filter((comment) => comment.id !== commentId) };
|
|
230
|
+
this.writePatchsetState(reviewId, patchset, next);
|
|
231
|
+
return clone(next.comments);
|
|
232
|
+
}
|
|
233
|
+
updateCommentStatus({
|
|
234
|
+
reviewId,
|
|
235
|
+
patchset,
|
|
236
|
+
commentId,
|
|
237
|
+
status
|
|
238
|
+
}) {
|
|
239
|
+
if (!isSafeKey(reviewId) || !isSafeKey(patchset) || !isSafeCommentId(commentId) || status !== "open" && status !== "resolved") {
|
|
240
|
+
throw new TypeError("invalid review comment status request");
|
|
241
|
+
}
|
|
242
|
+
const current = this.getPatchsetState(reviewId, patchset);
|
|
243
|
+
const existing = current.comments.find((comment2) => comment2.id === commentId);
|
|
244
|
+
if (!existing) throw new TypeError("review comment not found");
|
|
245
|
+
if ((existing.status || "open") === status) return clone(existing);
|
|
246
|
+
const comment = { ...existing, status };
|
|
247
|
+
const next = {
|
|
248
|
+
...current,
|
|
249
|
+
comments: current.comments.map((item) => item.id === commentId ? comment : item)
|
|
250
|
+
};
|
|
251
|
+
this.writePatchsetState(reviewId, patchset, next);
|
|
252
|
+
return clone(comment);
|
|
253
|
+
}
|
|
254
|
+
inheritPatchset({
|
|
255
|
+
reviewId,
|
|
256
|
+
previousPatchset,
|
|
257
|
+
nextPatchset,
|
|
258
|
+
changedPaths
|
|
259
|
+
}) {
|
|
260
|
+
if (!isSafeKey(reviewId) || !isSafeKey(previousPatchset) || !isSafeKey(nextPatchset) || !Array.isArray(changedPaths)) {
|
|
261
|
+
throw new TypeError("invalid review patchset inheritance");
|
|
262
|
+
}
|
|
263
|
+
const state = this.ensureState();
|
|
264
|
+
const review = ownValue(state.reviews, reviewId);
|
|
265
|
+
const existing = review && ownValue(review.patchsets, nextPatchset);
|
|
266
|
+
if (existing) return clone(existing);
|
|
267
|
+
const previous = this.getPatchsetState(reviewId, previousPatchset);
|
|
268
|
+
const changed = new Set(uniquePaths(changedPaths));
|
|
269
|
+
const next = {
|
|
270
|
+
comments: previous.comments.map((comment) => ({
|
|
271
|
+
...comment,
|
|
272
|
+
patchset: nextPatchset,
|
|
273
|
+
...changed.has(comment.path) ? { sourcePatchset: previousPatchset, status: "outdated" } : { status: comment.status || "open" }
|
|
274
|
+
})),
|
|
275
|
+
reviewedPaths: previous.reviewedPaths.filter((filePath) => !changed.has(filePath)),
|
|
276
|
+
revision: 0
|
|
277
|
+
};
|
|
278
|
+
this.writePatchsetState(reviewId, nextPatchset, next);
|
|
279
|
+
return clone(next);
|
|
280
|
+
}
|
|
281
|
+
writePatchsetState(reviewId, patchset, patchsetState) {
|
|
282
|
+
const currentState = this.ensureState();
|
|
283
|
+
const review = ownValue(currentState.reviews, reviewId) || { patchsets: {} };
|
|
284
|
+
const nextState = {
|
|
285
|
+
reviews: { ...currentState.reviews, [reviewId]: {
|
|
286
|
+
...review,
|
|
287
|
+
patchsets: { ...review.patchsets, [patchset]: patchsetState }
|
|
288
|
+
} }
|
|
289
|
+
};
|
|
290
|
+
this.writeJson(this.file, nextState);
|
|
291
|
+
this.state = nextState;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
295
|
+
0 && (module.exports = {
|
|
296
|
+
ReviewStateStore,
|
|
297
|
+
isSafeKey,
|
|
298
|
+
isSafeRepositoryPath
|
|
299
|
+
});
|
|
@@ -0,0 +1,97 @@
|
|
|
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 run_history_store_exports = {};
|
|
31
|
+
__export(run_history_store_exports, {
|
|
32
|
+
RunHistoryStore: () => RunHistoryStore
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(run_history_store_exports);
|
|
35
|
+
var import_atomic_json_store = require("./atomic-json-store.cjs");
|
|
36
|
+
var storageLayout = __toESM(require("./storage-layout.cjs"));
|
|
37
|
+
const fs = require("fs");
|
|
38
|
+
class RunHistoryStore {
|
|
39
|
+
configDir;
|
|
40
|
+
historyDir;
|
|
41
|
+
normalizeTaskHistory;
|
|
42
|
+
runsFile;
|
|
43
|
+
writeJson;
|
|
44
|
+
entries = null;
|
|
45
|
+
constructor(configDir, options = {}) {
|
|
46
|
+
this.configDir = configDir;
|
|
47
|
+
this.historyDir = storageLayout.historyDir(configDir);
|
|
48
|
+
this.runsFile = storageLayout.runHistoryFile(configDir);
|
|
49
|
+
this.normalizeTaskHistory = typeof options.normalizeTaskHistory === "function" ? options.normalizeTaskHistory : (entries) => Array.isArray(entries) ? entries.slice(0, 200) : [];
|
|
50
|
+
this.writeJson = typeof options.writeJson === "function" ? options.writeJson : import_atomic_json_store.atomicWriteJson;
|
|
51
|
+
}
|
|
52
|
+
init({ legacyTaskHistory = [] } = {}) {
|
|
53
|
+
fs.mkdirSync(this.historyDir, { recursive: true });
|
|
54
|
+
const current = this.readEntries();
|
|
55
|
+
const nextEntries = current.length > 0 ? current : this.normalizeTaskHistory(legacyTaskHistory);
|
|
56
|
+
this.writeEntries(nextEntries);
|
|
57
|
+
this.entries = nextEntries;
|
|
58
|
+
}
|
|
59
|
+
readEntries() {
|
|
60
|
+
try {
|
|
61
|
+
if (!fs.existsSync(this.runsFile)) return [];
|
|
62
|
+
return this.normalizeTaskHistory(JSON.parse(fs.readFileSync(this.runsFile, "utf8")));
|
|
63
|
+
} catch (error) {
|
|
64
|
+
console.warn(
|
|
65
|
+
"Failed to read Farming run history:",
|
|
66
|
+
error instanceof Error ? error.message : error
|
|
67
|
+
);
|
|
68
|
+
return [];
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
ensureEntries() {
|
|
72
|
+
if (!this.entries) this.init();
|
|
73
|
+
return this.entries ?? [];
|
|
74
|
+
}
|
|
75
|
+
writeEntries(entries = this.ensureEntries()) {
|
|
76
|
+
this.writeJson(this.runsFile, entries);
|
|
77
|
+
}
|
|
78
|
+
getEntries() {
|
|
79
|
+
return this.ensureEntries().slice();
|
|
80
|
+
}
|
|
81
|
+
setEntries(entries) {
|
|
82
|
+
const nextEntries = this.normalizeTaskHistory(entries);
|
|
83
|
+
this.writeEntries(nextEntries);
|
|
84
|
+
this.entries = nextEntries;
|
|
85
|
+
return this.getEntries();
|
|
86
|
+
}
|
|
87
|
+
appendEntry(entry) {
|
|
88
|
+
const nextEntries = this.normalizeTaskHistory([entry, ...this.ensureEntries()]);
|
|
89
|
+
this.writeEntries(nextEntries);
|
|
90
|
+
this.entries = nextEntries;
|
|
91
|
+
return this.getEntries();
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
95
|
+
0 && (module.exports = {
|
|
96
|
+
RunHistoryStore
|
|
97
|
+
});
|