farming-code 2.2.7 → 2.2.11

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 (102) hide show
  1. package/README.md +110 -199
  2. package/README.zh_cn.md +106 -237
  3. package/THIRD_PARTY_NOTICES.md +11 -2
  4. package/backend/acp-checkpoint-store.js +198 -0
  5. package/backend/acp-runtime.js +306 -83
  6. package/backend/acp-session-state.js +202 -6
  7. package/backend/acp-transcript.js +112 -0
  8. package/backend/agent-activity.js +6 -157
  9. package/backend/agent-manager.js +1496 -737
  10. package/backend/agent-provider-session.js +17 -242
  11. package/backend/agent-runtime-binding.js +219 -0
  12. package/backend/agent-session-history.js +66 -1
  13. package/backend/auth.js +79 -6
  14. package/backend/codex-models.js +81 -84
  15. package/backend/codex-session-archive.js +45 -0
  16. package/backend/codex-terminal-profile.js +500 -0
  17. package/backend/codex-transcript-sanitizer.js +12 -0
  18. package/backend/codex-transcript.js +230 -8
  19. package/backend/config-manager.js +30 -0
  20. package/backend/control-api.js +192 -17
  21. package/backend/farming-net-pass.js +285 -0
  22. package/backend/farming-net-registry.js +112 -0
  23. package/backend/farming-net-server.js +298 -0
  24. package/backend/farming-session-store.js +5 -13
  25. package/backend/git-worktree-info.js +181 -0
  26. package/backend/local-session-engine.js +411 -186
  27. package/backend/main-page-session.js +5 -2
  28. package/backend/native-pty-controller-generation.js +106 -0
  29. package/backend/native-pty-host-client.js +275 -7
  30. package/backend/native-pty-host-identity.js +86 -0
  31. package/backend/native-pty-host.js +813 -114
  32. package/backend/native-session-engine.js +100 -28
  33. package/backend/packaged-node-pty.js +22 -2
  34. package/backend/provider-adapters.js +253 -0
  35. package/backend/provider-session-service.js +241 -0
  36. package/backend/runtime-observation.js +81 -0
  37. package/backend/server.js +294 -86
  38. package/backend/session-engine-bridge.js +21 -2
  39. package/backend/session-engine-router.js +1 -1
  40. package/backend/session-engine.js +1 -1
  41. package/backend/session-stream-protocol.js +185 -0
  42. package/backend/storage-layout.js +55 -0
  43. package/backend/terminal-attach-checkpoint.js +74 -0
  44. package/backend/terminal-exit-quiescence.js +39 -0
  45. package/backend/terminal-reducer-flow-control.js +97 -0
  46. package/backend/terminal-screen-state.js +11 -2
  47. package/backend/terminal-screen-worker-pool.js +59 -6
  48. package/backend/terminal-screen-worker-thread.js +97 -57
  49. package/backend/terminal-screen-worker.js +133 -51
  50. package/backend/terminal-state-serialization.js +127 -0
  51. package/backend/terminal-status.js +23 -4
  52. package/backend/usage-monitor.js +81 -4
  53. package/backend/workspace-directory.js +152 -0
  54. package/backend/workspace-file-router.js +182 -76
  55. package/backend/workspace-file-service.js +319 -4
  56. package/backend/workspace-root-registry.js +164 -0
  57. package/dist/assets/App-CHYpgECZ.js +208 -0
  58. package/dist/assets/{FileEditorMarkdownPreview-elKWc8Im.js → FileEditorMarkdownPreview--Cri80nQ.js} +92 -92
  59. package/dist/assets/FileEditorPane-DGJlEKdf.js +2 -0
  60. package/dist/assets/IconGlyphs-Cc14sepw.js +1 -0
  61. package/dist/assets/ProjectFilesSection-Cz1wG4NT.js +12 -0
  62. package/dist/assets/{ReviewPage-BaXu1ZdX.js → ReviewPage-LonRc6Fz.js} +1 -1
  63. package/dist/assets/code-dark-B1pAtO_P.css +1 -0
  64. package/dist/assets/file-icons-Bw2qd5iT.js +1 -0
  65. package/dist/assets/{index-B8SHldPE.js → index-miO2r9IZ.js} +3 -3
  66. package/dist/assets/main-DNe0jPw-.css +1 -0
  67. package/dist/assets/workspace-editor-model-BQol4qbA.js +1 -0
  68. package/dist/assets/workspace-editor-monaco-5gFbeDPF.js +1 -0
  69. package/dist/assets/workspace-editor-monaco-xPv8JzHH.js +4 -0
  70. package/dist/assets/workspace-view-state-DvYG_9PH.js +7 -0
  71. package/dist/assets/workspace-working-copy-D8-s_Sgh.js +1 -0
  72. package/dist/index.html +1 -1
  73. package/frontend/farming-net/app.css +625 -0
  74. package/frontend/farming-net/app.js +268 -0
  75. package/frontend/farming-net/index.html +86 -0
  76. package/frontend/reading-anchor.js +198 -0
  77. package/frontend/session-bridge.js +12 -3
  78. package/frontend/session-modal-bridge.js +5 -12
  79. package/frontend/skins/crt/app.js +1976 -793
  80. package/frontend/skins/crt/index.html +313 -23
  81. package/frontend/skins/crt/styles/billing.css +294 -223
  82. package/frontend/skins/crt/styles/monochrome-green.css +7 -2
  83. package/frontend/terminal-replay.js +372 -0
  84. package/package.json +10 -3
  85. package/shared/browser-protocol.d.ts +5 -0
  86. package/shared/browser-protocol.js +130 -0
  87. package/dist/assets/App-iA2BU9P6.js +0 -124
  88. package/dist/assets/FileEditorPane-RWiFD2cq.js +0 -5
  89. package/dist/assets/IconGlyphs-DfL0EBnj.js +0 -1
  90. package/dist/assets/ProjectFilesSection-Q4PDsWmM.js +0 -12
  91. package/dist/assets/code-dark-CDkOQAtK.css +0 -1
  92. package/dist/assets/file-icons-EFUGSSwf.js +0 -1
  93. package/dist/assets/main-DpYuBonn.css +0 -1
  94. package/dist/assets/qoder-C9LmmOSf.svg +0 -1
  95. package/dist/assets/qoder-Cf9gl0Y5.svg +0 -1
  96. package/dist/assets/qoder-gHCinseV.svg +0 -1
  97. package/dist/assets/workspace-view-state-CTyDzk2D.js +0 -1
  98. package/dist/assets/zsh-CLpveKlF.svg +0 -1
  99. package/dist/assets/zsh-FxSpMPbz.svg +0 -1
  100. /package/dist/assets/{api-D1lyBYIQ.js → api-D8nyOEbz.js} +0 -0
  101. /package/dist/assets/{core-ZlAPicox.js → core-D0LFJkDt.js} +0 -0
  102. /package/dist/assets/{useWorkspaceMenuKeyboard-CneKAZUJ.js → useWorkspaceMenuKeyboard-Brws6Ar9.js} +0 -0
package/README.md CHANGED
@@ -9,279 +9,190 @@
9
9
  ![Node](https://img.shields.io/badge/node-%3E%3D22-339933?logo=nodedotjs&logoColor=white)
10
10
  ![Platform](https://img.shields.io/badge/platform-macOS%20%7C%20Linux-555)
11
11
 
12
- Farming is a remote browser workspace for AI coding agents. The current public product line is **Farming 2**.
12
+ Farming is an open-source, customizable browser workspace for supervising AI coding agents on a development machine. It keeps several live agents, structured conversations, real terminals, project files, review, history, and runtime controls in one place—without moving the repository or agent processes into the browser.
13
13
 
14
- It brings remote terminal sessions, Codex / Claude Code, project-scoped agents, open editors, file search, lightweight editing, git review tools, usage signals, and machine status into one browser page. The goal is to reduce the context switching that usually happens between SSH, an IDE, browser tabs, monitoring pages, and separate agent panels.
15
-
16
- Farming is designed around remote hosting. Agents, shells, project files, and git state keep running on the remote machine. A desktop browser is good for editing, reviewing, searching, and long follow-up sessions; a mobile browser is good for checking progress, switching sessions, and sending a short intervention while away from the desk.
17
-
18
- The browser exposes two live interfaces over the same backend: Farming Code at `/farming/code/` and the original CRT interface at `/farming/crt/`. `/farming/` continues to open Farming Code. If Code cannot start or render, the failure view keeps the live CRT interface visible behind the bounded error details, without restarting running agents.
19
-
20
- For a product-oriented introduction, screenshots, and the architecture diagram, see the [Farming 2 Wiki](https://github.com/zhuwenzhuang/farming/wiki/English).
21
-
22
- ![Farming Code workspace](./docs/products/code/assets/01-code-workspace.png)
23
-
24
- > If you are an AI agent contributing to this repository, read [AGENTS.md](./AGENTS.md) first.
25
-
26
- ## Why Farming Exists
27
-
28
- Current AI-agent interfaces are often chat-session lists. They are not great at showing which long-running task matters now, which agent is waiting, which one is stale, and where a human should intervene.
29
-
30
- Farming first solves the practical workbench problem: put the tools needed to supervise coding agents into one remote UI. Longer term, it explores attention management through a Main Agent that can observe, coordinate, and summarize multiple child agents.
31
-
32
- ## Farming 2
33
-
34
- Farming 2 turns the project into a remote coding workbench:
35
-
36
- - start and manage Codex, Claude, OpenCode, Qoder, bash, and zsh sessions in the browser;
37
- - discover and resume local Codex, Claude, OpenCode, and Qoder session history, then reconnect it to live Farming terminals;
38
- - group agents by project;
39
- - open Project Files with Open Editors, file tree, search, Monaco editing, Markdown/image preview, git changes, diff, and blame;
40
- - click terminal `path:line` references and HTTP URLs;
41
- - set Codex / Claude launch profiles for permissions, model, and speed where the underlying runtime supports them; App Server Codex updates permissions on its current thread, while terminal-owned sessions restart and resume when they already have a provider session id, or start fresh when no resumable id exists yet;
42
- - attach text and images to composer messages;
43
- - view lightweight usage, context, token-rate, quota, and CPU/MEM signals where available;
44
- - access the same remote service from desktop and mobile browsers.
45
-
46
- Screenshots, install details, and product notes are in [Farming 2 product guide](./docs/products/code/README.md).
14
+ Run Farming on the development machine where your coding CLIs already work, then return to the same tasks from a desktop or phone. Closing the browser does not stop the agents; the native PTY host can also preserve live terminal sessions while the Farming server restarts.
47
15
 
48
16
  ## Quick Start
49
17
 
50
- The easiest path is the npm package. Run Farming on the same development machine where `codex` or `claude` already works in a normal shell.
18
+ With Node.js 22 or newer and at least one supported coding CLI installed and signed in, install and start Farming in one command:
51
19
 
52
20
  ```bash
53
- npm install --global farming-code
54
- farming daemon
55
- ```
56
-
57
- Farming defaults to port `6694`, base path `/farming`, config directory `~/.farming`, and token auth. The first authenticated start generates a random readable token and stores it in `~/.farming/.session-token`; later restarts and upgrades reuse that token unless `FARMING_TOKEN` is explicitly set. In Chinese time zones this is a Chinese haiku-style passphrase by default; Japanese time zones use Japanese haiku-style passphrases, and other time zones use English passphrases. The startup log prints a URL like:
58
-
59
- ```text
60
- http://linux-host:6694/farming?token=<startup-token>
21
+ npm install --global farming-code@latest && farming daemon
61
22
  ```
62
23
 
63
- Open that URL in a desktop or mobile browser, click `New Agent`, choose `Codex`, `Claude Code`, `bash`, or `zsh`, select a workspace, and start working.
24
+ Open the authenticated URL printed by the command, choose **New Agent**, select an Agent and workspace, and start in Chat or Terminal.
64
25
 
65
- ## Downloads
26
+ ![Farming Code workspace](./docs/products/code/assets/01-code-workspace.png)
66
27
 
67
- The npm package is the default distribution. GitHub release artifacts remain available for manual installation.
28
+ ## Two Interfaces, One Runtime
68
29
 
69
- Farming uses these practical deployment shapes:
30
+ Farming 2 provides two complete browser interfaces over the same agents and sessions.
70
31
 
71
- | Environment | Artifact | When to use it |
72
- | --- | --- | --- |
73
- | macOS and Linux | `npm install --global farming-code` | Default path. Requires Node.js 22 or newer and a system runtime that can load `node-pty`. |
74
- | Standalone use | platform CLI from GitHub Releases | Manual installation for environments that do not want npm; upgrades remain manual. |
75
- | Directory deployment | `farming-<version>-<platform>-<arch>.tar.gz` | App bundle with production dependencies and launcher scripts; it uses the target system runtime. |
76
- | Legacy Linux x64 (glibc < 2.28) | `farming-<version>-linux-x64-legacy-glibc228.tar.gz` | First-install bootstrap with a pinned glibc 2.28 runtime. It installs Farming under `~/.farming/npm`; later one-click updates use npm like the default installation. A Node.js 22 executable and npm are still required. |
77
- | Custom older Linux build | `farming-<version>-linux-x64-glibc217.tar.gz` | Separately built bundle that rebuilds `node-pty` against a glibc 2.17 baseline; it still needs a usable target Node.js runtime. |
32
+ ### Farming Code
78
33
 
79
- If you want Farming to launch Codex or Claude Code, install and log in to those CLIs on the same machine first. Farming hosts their CLI sessions; it does not replace their installation or account setup.
34
+ The default workbench for reading conversations, intervening in tasks, editing files, and reviewing workspace changes.
80
35
 
81
- ## Architecture
36
+ ![Farming Code structured Chat](./docs/products/code/assets/11-code-agent-process.png)
82
37
 
83
- ```text
84
- Browser skins
85
- React + Vite + Monaco + terminal renderer
86
- |
87
- | HTTP / WebSocket
88
- v
89
- Farming core
90
- Express server + token auth + agent manager + session providers
91
- |
92
- | native pty host + session engine
93
- v
94
- Execution environment
95
- bash / zsh / Codex / Claude Code
96
- ```
38
+ ### Farming CRT
97
39
 
98
- The backend owns agent lifecycle, WebSocket state sync, session engines, workspace file APIs, session providers, model/profile discovery, usage collection, and configuration. Frontend skins organize those capabilities into different experiences. New interactive sessions use the native pty host by default, keeping node-pty agent processes outside the Farming server process so the server and browser can reconnect to live terminals. The native pty host persists across Farming server restarts unless `FARMING_NATIVE_PTY_HOST_PERSIST=0` is set, then exits after an idle grace period once no live sessions or clients remain. Set `FARMING_SESSION_ENGINE=local` only when debugging the in-process node-pty engine.
40
+ A keyboard-first control room for watching many agents, opening structured Chat or raw Terminal, searching history, and reading live usage telemetry.
99
41
 
100
- The browser terminal renderer defaults to xterm.js. The older Ghostty web renderer is still kept as an explicit debug path through `localStorage.farmingTerminalEngine = 'ghostty'`.
42
+ ![Farming CRT dashboard](./docs/products/crt/assets/01-crt-dashboard.png)
101
43
 
102
- ## Install And Run
44
+ | | Farming Code | Farming CRT |
45
+ | --- | --- | --- |
46
+ | Best for | Long follow-ups, files, editing, diffs, review | At-a-glance monitoring, keyboard control, terminal work, telemetry |
47
+ | Live session | Structured Chat and real PTY Terminal | Phosphor Chat and real xterm Terminal |
48
+ | Navigation | Project sidebar, Search, History, Files | Stable Agent bays and keyboard-driven consoles |
49
+ | Appearance | Light and dark | CRT effects, terminal font size, optional Dynamic Heat |
50
+ | Entry | `/farming/code/` or `/farming/` | `/farming/crt/` |
103
51
 
104
- ### Install From npm
52
+ Switching interfaces does not restart or duplicate an Agent. If Farming Code cannot start or render, its bounded diagnostic view leaves the live CRT surface available rather than hiding the running sessions.
105
53
 
106
- ```bash
107
- npm install --global farming-code
108
- farming daemon
109
- ```
54
+ The complete current capability map and screenshot tour are in the [Farming 2 product overview](./docs/products/README.md). See the focused [Farming Code guide](./docs/products/code/README.md) and [Farming CRT guide](./docs/products/crt/README.md) for the full workflows.
110
55
 
111
- Open **Settings → Updates** to check and install a newer npm version in one click. Farming installs the new package while the current server is still running, restarts only after installation succeeds, and attempts to restore the previous version if the new server cannot start. The equivalent manual command is `npm install --global farming-code@latest`.
56
+ ## Farming Net: One Portal For Deployments
112
57
 
113
- ### Build From Source
58
+ Farming Net is a separate, token-protected directory for the Farming instances you already run. Its cards can point to a Farming on the current device, a remote development host, an intranet address, or a tunnel. Enrolled targets accept short-lived signed passes, so users keep one portal login instead of a list of deployment URLs and target tokens.
114
59
 
115
60
  ```bash
116
- npm install
117
- npm run release:cli
61
+ FARMING_NET_PORT=6693 FARMING_NET_BASE_PATH=/farming-net npm run start:net
118
62
  ```
119
63
 
120
- To build an app bundle:
64
+ The portal keeps its token, signing identity, and private `instances.json` registry under `~/.farming-net/`. It does not proxy target traffic or store target tokens; each destination remains an independent Farming service and explicitly chooses whether to trust the portal. See the [Farming Net guide](./docs/products/net/README.md) for enrollment and the security boundary.
121
65
 
122
- ```bash
123
- npm install
124
- npm run release:app
125
- ```
66
+ ## What You Can Do
126
67
 
127
- The standard app bundle includes production dependencies and launcher scripts, and uses the target system runtime as installed.
68
+ - Group live agents by project, pin or rename important work, track unread activity, search live and historical sessions, and archive or resume tasks.
69
+ - Use structured ACP Chat for Codex, Claude Code, OpenCode, and Qoder. Plans, reasoning, tools, permission requests, embedded terminals, child sessions, attachments, queued follow-ups, and exact change summaries remain available without overwhelming the final answer.
70
+ - Switch the same provider session between structured Chat and a real PTY Terminal. Supported Codex model, reasoning, Fast, Ultra, and permission changes reach the live workflow; a compatible Terminal applies model changes immediately and confirms the CLI state before accepting the next Composer message.
71
+ - Browse, search, and lightly edit Project Files; inspect a VS Code-derived Git history graph, changed files, Git changes, Diff, and Blame; then open commits or working-copy changes in Review with captured revisions, inline comments, and Reviewed state.
72
+ - Observe CPU/MEM, token-rate, context, quota, provider usage, and CRT daily/live token telemetry when the provider exposes the required data.
73
+ - Continue the same Farming Code task from desktop or phone without moving the Agent process away from the development host.
128
74
 
129
- For Linux x64 systems whose glibc is older than 2.28, build the release asset that carries the pinned legacy runtime:
75
+ ![Farming Code project files and blame](./docs/products/code/assets/04-files-editor-blame.png)
130
76
 
131
- ```bash
132
- npm run release:app:legacy-linux
133
- ```
77
+ ![Separate Review entry points for tracked and untracked workspace changes](./docs/products/code/assets/10-review-workflow.png)
134
78
 
135
- The resulting `farming-<version>-linux-x64-legacy-glibc228.tar.gz` is a bootstrap package. It extracts the runtime to `~/.farming/glibc228`, installs the bundled Farming release into the private prefix `~/.farming/npm`, and writes a stable compatibility launcher at `~/.farming/bin/farming`. Later updates install `farming-code` into that same prefix through npm, then restart with the compatibility launcher; the tarball is not downloaded again for ordinary application updates.
79
+ ## Supported Agent Paths
136
80
 
137
- For a separately built `node-pty` ABI baseline, run the following command inside a clean Linux x64 builder that has glibc 2.17, Node.js 22+, GCC/G++, Make, and Python 3:
81
+ Farming discovers installed CLIs on the host. The richer structured runtime currently applies to providers with ACP support; other detected coding agents remain first-class terminal sessions.
138
82
 
139
- ```bash
140
- npm run release:app:linux-compat
141
- ```
83
+ | Agent | Structured Chat | Native Terminal | History / resume |
84
+ | --- | --- | --- | --- |
85
+ | Codex | ACP | Yes | Yes |
86
+ | Claude Code | ACP | Yes | Yes |
87
+ | OpenCode | ACP | Yes | Yes |
88
+ | Qoder | ACP | Yes | Yes |
89
+ | Qwen Code | — | Yes | CLI-dependent |
90
+ | Aider | — | Yes | CLI-dependent |
91
+ | GitHub Copilot CLI | — | Yes | CLI-dependent |
92
+ | Amazon Q | — | Yes | CLI-dependent |
93
+ | bash / zsh | — | Yes | No provider-session resume |
142
94
 
143
- The command forces `node-pty` to build from source and rejects the archive unless its native module requires no newer than glibc 2.17. Install it remotely with `FARMING_REMOTE=user@host FARMING_RELEASE_TARBALL=<archive> npm run release:remote:linux-compat`. This ABI-focused bundle still uses the target machine's Node.js and libc.
95
+ Farming hosts CLIs that already work on the same machine. It does not replace provider installation, login, or account configuration.
144
96
 
145
- When a clean source checkout is already present on a provisioned Linux x64 builder host, `scripts/build-linux-compat-release-on-builder.sh` automates the remaining container build, ABI verification, packaged bash-agent smoke, and artifact output. Set `FARMING_COMPAT_IMAGE` to an image that already exists on that host. The script uses `--pull=never` and disables container networking by default so release builds reuse existing images and caches instead of downloading infrastructure implicitly; set `FARMING_COMPAT_ALLOW_NETWORK=1` only when an intentional cache refresh is required.
97
+ ## Runtime Defaults And Daemon Commands
146
98
 
147
- ### Run A Single-File CLI
99
+ Farming defaults to port `6694`, base path `/farming`, config directory `~/.farming`, and token authentication. The startup log prints a URL similar to:
148
100
 
149
- ```bash
150
- chmod +x farming
151
- ./farming daemon
101
+ ```text
102
+ http://development-host:6694/farming?token=<startup-token>
152
103
  ```
153
104
 
154
- By default it listens on port `6694`, serves under `/farming`, creates `~/.farming`, enables token auth, and prints a browser URL containing the startup token.
155
-
156
- Useful commands:
105
+ Useful daemon commands are:
157
106
 
158
107
  ```bash
159
- ./farming status
160
- ./farming logs
161
- ./farming url
162
- ./farming stop
108
+ farming status
109
+ farming url
110
+ farming logs
111
+ farming stop
163
112
  ```
164
113
 
165
- ### Run An App Bundle
114
+ The first authenticated start stores a readable random token in `~/.farming/.session-token`; restarts and upgrades reuse it unless `FARMING_TOKEN` overrides it. Token language defaults to the host time zone: Chinese, Japanese, or English.
166
115
 
167
- ```bash
168
- tar -xzf farming-<version>-linux-x64.tar.gz
169
- cd farming-<version>-linux-x64
170
- ./farming
171
- ```
116
+ ![Start an Agent](./docs/products/code/assets/02-start-agent-picker.png)
172
117
 
173
- The standard bundle uses the target machine's ordinary Node.js and native runtime. On a legacy Linux x64 host, download the `-legacy-glibc228.tar.gz` bundle instead and run `./farming` once. After bootstrap, use `~/.farming/bin/farming`; that stable launcher keeps npm updates, server restarts, and PTY child processes on the bundled compatibility runtime.
118
+ ## Desktop And Mobile
174
119
 
175
- ## Development
120
+ Desktop keeps the project, conversation, files, and review close together. Mobile focuses one conversation, terminal, or file at a time and moves navigation into a drawer, making it useful for checking progress and sending a short intervention.
176
121
 
177
- ```bash
178
- npm install
179
- npm start
180
- ```
122
+ <p align="center">
123
+ <img src="./docs/products/code/assets/05-mobile-agent-chat.jpg" alt="Farming Code on mobile" width="320">
124
+ </p>
181
125
 
182
- For trusted local development only, token auth can be disabled:
126
+ Farming CRT is currently a desktop interface. Use Farming Code from a phone; CRT mobile concepts are not part of the supported product yet.
183
127
 
184
- ```bash
185
- npm run start:no-auth
186
- ```
187
-
188
- ## Configuration
128
+ ## Installation And Updates
189
129
 
190
- Runtime settings are stored in `~/.farming/settings.json`.
191
- Agent session metadata is stored separately in `~/.farming/sessions/`. Farming
192
- uses stable `fsess_*` files for its own Agent records; live `agent-...` ids and
193
- Codex / Claude provider session ids are stored as metadata on those records.
194
- The main Projects page membership lives in `sessions/index.json` and is exposed
195
- as `mainPageSessionKeys` only for API compatibility.
196
- Archived run history is stored in `~/.farming/history/runs.json`, not in
197
- `settings.json`.
198
- Theme overrides, the startup token, server pid/state/log files, and native pty
199
- host logs live under the same config directory.
130
+ The npm package is the default distribution. **Settings → Updates** can upgrade npm installations in place: Farming installs the new package while the current server stays alive, restarts only after installation succeeds, and attempts rollback when the new server cannot start.
200
131
 
201
- Common settings:
132
+ GitHub Releases also provide standalone CLI and directory bundles. Legacy Linux x64 hosts can use the `linux-x64-legacy-glibc228` first-install bootstrap; subsequent application updates use the same private npm prefix. A separately built glibc 2.17 ABI bundle remains available for controlled environments. See [GitHub Releases](https://github.com/zhuwenzhuang/farming/releases) for current assets and release notes.
202
133
 
203
- - `defaultLaunchAgent`
204
- - `agentLaunchProfiles.codex`
205
- - `agentLaunchProfiles.claude`
206
- - `agentHomes` (home metadata for Codex, Claude, OpenCode, and Qoder; each provider keeps a non-removable `default` home)
207
- - `workspaceHistory`
208
- - `dangerouslySkipAgentPermissionsByDefault` (launch supported coding agents such as Codex, Claude, OpenCode, Qoder, Qwen, Aider, GitHub Copilot CLI, and Amazon Q with their provider-specific dangerous permission-skip flags by default)
134
+ Source development:
209
135
 
210
- Native terminal sessions are owned by a Farming pty host reached through a local socket derived from `configDir`. By default the host is preserved during server shutdown so a restarted Farming server can recover live terminals; after the last live session and client disappear, the host shuts itself down after a short idle grace period. Set `FARMING_NATIVE_PTY_HOST_PERSIST=0` to tie the host lifetime to the server process. Terminal work should target the native pty host and xterm.js path.
136
+ ```bash
137
+ npm install
138
+ npm start
139
+ ```
211
140
 
212
- Update behavior follows the installation method. npm installations and legacy Linux installations bootstrapped from `-legacy-glibc228.tar.gz` read versions from the npm registry and provide one-click upgrades in **Settings → Updates**. They install into their existing npm prefix while the old service remains alive, then restart and roll back on startup failure. Source checkouts update through Git, and standalone CLI artifacts are replaced manually. Standard app-bundle installations remain a directory-deployment path and may use a trusted HTTP(S) package directory or manifest URL stored as `settings.updateUrl`.
141
+ For trusted local development only, `npm run start:no-auth` disables token authentication.
213
142
 
214
- The simplest source is an HTTP(S) directory URL ending in `/` that lists platform-tagged `farming-<version>-<platform>-<arch>.tar.gz` app bundles and an adjacent `<bundle>.sha256` file for every bundle. Farming verifies the selected bundle's SHA-256 and archive layout before extraction, then runs its installer.
143
+ ## How It Works
215
144
 
216
- Example deployment templates:
145
+ ```text
146
+ Farming Code / Farming CRT
147
+ React, Monaco, xterm.js, CRT browser skin
148
+ │ HTTP + WebSocket
149
+
150
+ Farming core
151
+ auth, Agent manager, ACP, history, files, review, usage
152
+ │ native PTY host + session providers
153
+
154
+ Development host
155
+ repositories, shells, Codex, Claude Code, OpenCode, Qoder, ...
156
+ ```
217
157
 
218
- - `config/farming.deploy.env.example`
219
- - `config/farming.install.env.example`
158
+ The backend owns lifecycle, authentication, session routing, workspace boundaries, history, and configuration. Interactive terminal sessions use a separate native PTY host by default, allowing browser and server reconnection without replacing the live process. The browser terminal renderer defaults to xterm.js WebGL as its single supported product path; the Ghostty web adapter remains an explicit debug path, not a runtime fallback.
220
159
 
221
- Real `.env` files are ignored by git.
160
+ Runtime settings live in `~/.farming/settings.json`. Farming session metadata, the project membership index, archived runs, theme settings, update state, logs, and the startup token use separate files under `~/.farming/`. External provider histories remain read-only integrations.
222
161
 
223
162
  ## Security
224
163
 
225
- Farming controls real terminals and agent processes on the target machine. Run it on trusted development hosts and trusted networks. Do not expose it directly to the public internet without an additional layer such as VPN, SSH tunnel, HTTPS reverse proxy, or network ACLs.
226
-
227
- The startup token protects both HTTP and WebSocket traffic. It is generated on first authenticated startup, persisted in `~/.farming/.session-token`, and reused across restarts and upgrades. The generated token is designed to be easier to copy than a long hexadecimal secret: Chinese time zones get a Chinese haiku-style passphrase by default, Japanese time zones get a Japanese haiku-style passphrase, and other time zones get an English passphrase. `FARMING_TOKEN_LOCALE=zh|ja|en|auto` can override generation behavior for a new token.
228
-
229
- `FARMING_DISABLE_AUTH=1` is only for trusted local development. Terminal-owned Codex / Claude sessions apply a permission change by restarting with the selected CLI flags, resuming when a provider session id is available and starting fresh otherwise. App Server Codex applies the new approval and sandbox policy to its existing thread without a CLI restart.
230
-
231
- See [SECURITY.md](./SECURITY.md) for the reporting policy and deployment notes.
232
-
233
- ## Troubleshooting
234
-
235
- - **No `codex` or `claude` option works**: verify the CLI is installed, logged in, and runnable from a normal shell on the same host.
236
- - **Native PTY cannot start**: verify the target system's Node.js and packaged `node-pty` runtime are compatible. On Linux x64 with glibc older than 2.28, use the `-legacy-glibc228` app bundle.
237
- - **Port already in use**: pass `--port <port>` or let the default daemon mode choose the next available port when no explicit port is provided.
238
- - **Phone cannot connect**: use the network URL printed by the server and make sure the phone can reach the target machine.
239
- - **Lost the token URL**: run `./farming url`, or check `./farming logs`.
240
-
241
- ## Repository Layout
242
-
243
- ```text
244
- farming/
245
- ├── .gitattributes # Source archive export rules
246
- ├── backend/ # Node.js server, session engines, and backend APIs
247
- ├── src/ # React + Vite frontend; Farming Code helpers live under src/components/code/
248
- ├── frontend/skins/crt/ # Independent live CRT entry, app, and visual effects
249
- ├── frontend/*.js # Shared terminal/session browser bridges
250
- ├── docs/products/code/ # Farming Code product docs and screenshots
251
- ├── docs/products/crt/ # CRT skin layout docs
252
- ├── config/ # deployment / install templates
253
- ├── scripts/ # release, deployment, screenshots, tests
254
- ├── tests/e2e/ # Playwright browser flows
255
- ├── pkg.config.cjs
256
- └── bin/farming
257
- ```
164
+ Farming controls real terminals and files on the target machine. Run it on a trusted development host and trusted network. Do not expose it directly to the public internet without a VPN, SSH tunnel, HTTPS reverse proxy, or equivalent access control.
258
165
 
259
- `releases/` is a local packaging output directory and is not committed.
166
+ Token authentication protects HTTP and WebSocket traffic. `FARMING_DISABLE_AUTH=1` is only for trusted local development. Workspace file APIs validate paths against the selected project root. See [SECURITY.md](./SECURITY.md) for reporting and deployment guidance.
260
167
 
261
- ## Tests
168
+ ## Documentation
262
169
 
263
- ```bash
264
- npm run check
265
- ```
170
+ - [Farming 2 product overview and capability map](./docs/products/README.md)
171
+ - [Farming Code guide](./docs/products/code/README.md)
172
+ - [Farming CRT guide](./docs/products/crt/README.md)
173
+ - [Farming Net deployment portal](./docs/products/net/README.md)
174
+ - [Mobile guide](./docs/products/code/mobile-guide.md)
175
+ - [ACP runtime](./docs/products/code/acp-runtime.md)
176
+ - [Review foundation](./docs/products/code/review-foundation.md)
177
+ - [Release history](https://github.com/zhuwenzhuang/farming/releases)
178
+ - [Contributor instructions](./AGENTS.md)
266
179
 
267
- Common individual checks:
180
+ ## Development Checks
268
181
 
269
182
  ```bash
270
183
  npm test
271
184
  npm run typecheck
272
185
  npm run lint
186
+ FARMING_BASE_PATH=/farming npm run build
273
187
  npm run test:e2e:playwright
274
188
  ```
275
189
 
276
- ## Authors
190
+ Product screenshots are generated from an anonymous demo workspace with real browser flows:
277
191
 
278
- - [zhuwenzhuang](https://github.com/zhuwenzhuang)
279
- - [l4wei](https://github.com/l4wei)
280
-
281
- ## Contributing
282
-
283
- Issues and pull requests are welcome. Start with [CONTRIBUTING.md](./CONTRIBUTING.md), and keep user-facing docs updated when behavior or packaging changes.
192
+ ```bash
193
+ npm run docs:product:screenshots
194
+ ```
284
195
 
285
196
  ## License
286
197
 
287
- Farming is released under the MIT License. See [LICENSE](./LICENSE).
198
+ Farming is released under the [MIT License](./LICENSE). Third-party notices are listed in [THIRD_PARTY_NOTICES.md](./THIRD_PARTY_NOTICES.md).