farming-code 2.2.28 → 2.2.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -90
- package/README.zh_cn.md +17 -90
- package/THIRD_PARTY_NOTICES.md +25 -6
- package/backend/acp/packaged-claude-acp.js +13 -0
- package/backend/acp/packaged-codex-acp.js +2 -2
- package/backend/acp-runtime.js +38 -17
- package/backend/acp-session-state.js +78 -88
- package/backend/acp-transcript.js +174 -9
- package/backend/agent-manager.js +27 -2
- package/backend/agent-session-history.js +45 -12
- package/backend/codex-session-history.js +1 -1
- package/backend/codex-transcript.js +0 -202
- package/backend/config-manager.js +44 -16
- package/backend/data/LICENSE.agent-browser +201 -0
- package/backend/data/runtime-dependency-manifest.json +199 -0
- package/backend/data/runtime-dependency-sources.json +5 -0
- package/backend/executable-discovery.js +7 -0
- package/backend/farming-agent-bootstrap.zh_cn.md +4 -2
- package/backend/farming-app-cli.js +161 -65
- package/backend/farming-cli.js +7 -59
- package/backend/index-html.js +31 -0
- package/backend/main-agent-skills.js +7 -28
- package/backend/npm-update-helper.js +43 -6
- package/backend/provider-adapters.js +10 -0
- package/backend/runtime-dependency-manager.js +759 -0
- package/backend/runtime-executable-invocation.js +20 -0
- package/backend/server-process-identity.js +47 -0
- package/backend/server.js +145 -204
- package/backend/slash-command-discovery.js +138 -1
- package/backend/storage-layout.js +30 -0
- package/backend/update-service.js +60 -914
- package/config/farming.deploy.env.example +1 -1
- package/config/farming.install.env.example +5 -1
- package/dist/acp/LICENSE.claude-agent-acp +191 -0
- package/dist/acp/LICENSE.claude-agent-sdk +1 -0
- package/dist/acp/claude-agent-acp-0.59.0.mjs +41606 -0
- package/dist/acp/{codex-acp-1.1.4.js → codex-acp-1.1.4.mjs} +387 -7
- package/dist/assets/{App-CM7Cy-l4.css → App-BKNUILuL.css} +1 -1
- package/dist/assets/App-Z1N7T0eM.js +695 -0
- package/dist/assets/{FileEditorMarkdownPreview-DYOMm-b1.js → FileEditorMarkdownPreview-Cs9cLv8a.js} +1 -1
- package/dist/assets/FileEditorPane-CNtuGjQ3.js +2 -0
- package/dist/assets/IconGlyphs-BClgag6E.js +1 -0
- package/dist/assets/ProjectFilesSection-K3GHuQ4U.js +12 -0
- package/dist/assets/ReviewPage-BRuxFaH5.js +3 -0
- package/dist/assets/code-dark-kLsQLvpf.css +1 -0
- package/dist/assets/{index-BzQO3pUr.js → index-D-zetSol.js} +2 -2
- package/dist/assets/main-DUTz-Rd2.css +1 -0
- package/dist/assets/{workspace-editor-monaco-tXA-udGx.js → workspace-editor-monaco-CJNwbpCy.js} +1 -1
- package/dist/assets/workspace-editor-monaco-CO9w8YV0.js +1 -0
- package/dist/assets/workspace-view-state-BjKPYp0E.js +7 -0
- package/dist/index.html +33 -3
- package/extensions/browser/backend/agent-browser-runtime.js +1041 -0
- package/extensions/browser/backend/browser-mcp-server.js +352 -0
- package/extensions/browser/backend/browser-resource-manager.js +921 -114
- package/extensions/browser/backend/browser-resource-store.js +47 -6
- package/extensions/browser/backend/browser-router.js +15 -2
- package/extensions/browser/backend/executable-discovery.js +164 -17
- package/extensions/browser/backend/managed-chromium-installer.js +593 -0
- package/extensions/browser/bin/farming-browser +384 -30
- package/extensions/browser/frontend/BrowserSidebarPortals.tsx +17 -19
- package/extensions/browser/frontend/BrowserViewer.tsx +217 -46
- package/extensions/browser/frontend/browser.css +68 -17
- package/extensions/browser/frontend/types.ts +13 -0
- package/extensions/browser/frontend/useBrowserResources.ts +18 -3
- package/index.html +32 -2
- package/package.json +10 -6
- package/shared/backend-connection-status.d.ts +12 -0
- package/shared/backend-connection-status.js +35 -4
- package/backend/agent-activity.js +0 -35
- package/backend/agent-memory-report.js +0 -583
- package/backend/bundle-update-helper.js +0 -113
- package/backend/codex-rollout-follower.js +0 -326
- package/dist/assets/App-CPG4WcjO.js +0 -658
- package/dist/assets/FileEditorPane-DXXq82aM.js +0 -2
- package/dist/assets/IconGlyphs-DrdPjYXr.js +0 -1
- package/dist/assets/ProjectFilesSection-CP66XVPl.js +0 -12
- package/dist/assets/ReviewPage-w21MEPD6.js +0 -3
- package/dist/assets/code-dark-BDjwj7Um.css +0 -1
- package/dist/assets/main-BlVUXfxa.css +0 -1
- package/dist/assets/workspace-editor-monaco-CFEfFNcA.js +0 -1
- package/dist/assets/workspace-view-state-BS_V8JVs.js +0 -7
- package/extensions/browser/backend/cdp-browser-runtime.js +0 -648
- package/extensions/browser/backend/cdp-client.js +0 -167
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "farming-code",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.30",
|
|
4
4
|
"description": "Farming Code is a self-hosted browser workspace for running and supervising AI coding agents",
|
|
5
5
|
"main": "backend/server.js",
|
|
6
6
|
"bin": {
|
|
@@ -33,11 +33,12 @@
|
|
|
33
33
|
],
|
|
34
34
|
"scripts": {
|
|
35
35
|
"sync:ghostty-vendor": "node scripts/sync-ghostty-vendor.js",
|
|
36
|
-
"prepare:acp-vendor": "node scripts/prepare-codex-acp-vendor.js --copy",
|
|
36
|
+
"prepare:acp-vendor": "node scripts/prepare-codex-acp-vendor.js --copy && node scripts/prepare-claude-acp-vendor.js --copy",
|
|
37
|
+
"prepare:runtime-manifest": "node scripts/build-runtime-dependency-manifest.js",
|
|
37
38
|
"build:usage-history": "node scripts/build-usage-history-scanner.js",
|
|
38
|
-
"prebuild": "node scripts/build-usage-history-scanner.js && node scripts/sync-ghostty-vendor.js &&
|
|
39
|
+
"prebuild": "node scripts/build-usage-history-scanner.js && node scripts/sync-ghostty-vendor.js && npm run prepare:acp-vendor && npm run prepare:runtime-manifest",
|
|
39
40
|
"prepack": "FARMING_BASE_PATH=/farming npm run build",
|
|
40
|
-
"pretest": "npm run prepare:acp-vendor && npm run build:usage-history",
|
|
41
|
+
"pretest": "npm run prepare:acp-vendor && npm run prepare:runtime-manifest && npm run build:usage-history",
|
|
41
42
|
"start": "npm run build && node backend/server.js",
|
|
42
43
|
"start:net": "node backend/farming-net-server.js",
|
|
43
44
|
"start:no-auth": "FARMING_DISABLE_AUTH=1 npm start",
|
|
@@ -64,6 +65,7 @@
|
|
|
64
65
|
"test": "node scripts/run-tests.js",
|
|
65
66
|
"test:pre-release:codex-ui": "FARMING_REAL_CODEX_BIN=\"$(command -v codex)\" FARMING_CODEX_BIN=\"$PWD/tests/e2e/fixtures/real-codex-no-update\" FARMING_REAL_CODEX_RELEASE_CASE=1 FARMING_E2E_REAL_CODEX=1 FARMING_PLAYWRIGHT_INTERNAL=1 playwright test tests/e2e/internal/real-codex-release-case.spec.ts --project=chromium --workers=1 --retries=0 --trace=retain-on-failure",
|
|
66
67
|
"test:pre-release:terminal-input": "playwright test tests/e2e/terminal-input-performance.spec.ts --project=chromium --workers=1 --retries=0 --trace=retain-on-failure",
|
|
68
|
+
"test:performance:transcript": "node backend/tests/test-acp-transcript-performance.js",
|
|
67
69
|
"test:performance:audit": "node tests/performance/agent-usage-hotpath.js && FARMING_PLAYWRIGHT_INTERNAL=1 playwright test tests/e2e/internal/performance-bottlenecks.spec.ts --project=chromium --workers=1 --retries=0 --trace=retain-on-failure",
|
|
68
70
|
"test:performance:scale": "FARMING_PLAYWRIGHT_INTERNAL=1 playwright test tests/e2e/internal/performance-scaling.spec.ts --project=chromium --workers=1 --retries=0 --trace=retain-on-failure",
|
|
69
71
|
"test:update:platforms": "node scripts/test-update-platforms.js",
|
|
@@ -111,8 +113,6 @@
|
|
|
111
113
|
"node": "^22.13.0 || >=24.0.0"
|
|
112
114
|
},
|
|
113
115
|
"dependencies": {
|
|
114
|
-
"@agentclientprotocol/claude-agent-acp": "0.59.0",
|
|
115
|
-
"@agentclientprotocol/codex-acp": "1.1.4",
|
|
116
116
|
"@agentclientprotocol/sdk": "1.2.1",
|
|
117
117
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
118
118
|
"@xterm/addon-clipboard": "^0.2.0",
|
|
@@ -144,11 +144,14 @@
|
|
|
144
144
|
"remark-gfm": "^4.0.1",
|
|
145
145
|
"remark-math": "^6.0.0",
|
|
146
146
|
"ripgrep": "^0.3.1",
|
|
147
|
+
"tar": "7.5.19",
|
|
147
148
|
"ws": "^8.21.0",
|
|
148
149
|
"yaml": "^2.9.0",
|
|
149
150
|
"zod": "^3.25.76"
|
|
150
151
|
},
|
|
151
152
|
"devDependencies": {
|
|
153
|
+
"@agentclientprotocol/claude-agent-acp": "0.59.0",
|
|
154
|
+
"@agentclientprotocol/codex-acp": "1.1.4",
|
|
152
155
|
"@eslint/js": "^10.0.1",
|
|
153
156
|
"@playwright/test": "^1.59.1",
|
|
154
157
|
"@types/node": "^26.1.1",
|
|
@@ -156,6 +159,7 @@
|
|
|
156
159
|
"@types/react-dom": "^19.2.3",
|
|
157
160
|
"@vitejs/plugin-react": "^6.0.1",
|
|
158
161
|
"@yao-pkg/pkg": "6.20.0",
|
|
162
|
+
"agent-browser": "0.32.3",
|
|
159
163
|
"esbuild": "^0.27.7",
|
|
160
164
|
"eslint": "^10.2.0",
|
|
161
165
|
"patch-package": "8.0.1",
|
|
@@ -1,16 +1,28 @@
|
|
|
1
1
|
export const BACKEND_INITIAL_CONNECT_GRACE_MS: number
|
|
2
|
+
export const BACKEND_HEARTBEAT_FAILURE_MS: number
|
|
2
3
|
export const BACKEND_HEARTBEAT_STALE_MS: number
|
|
4
|
+
export const BACKEND_OBSERVER_LAG_RESET_MS: number
|
|
3
5
|
|
|
4
6
|
export type BackendConnectionState = 'connecting' | 'lost' | 'stale' | null
|
|
5
7
|
export interface PageVisibilitySnapshot {
|
|
6
8
|
visible: boolean
|
|
7
9
|
visibleSince: number
|
|
8
10
|
}
|
|
11
|
+
export interface BackendObservation {
|
|
12
|
+
now: number
|
|
13
|
+
continuousSince: number
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function advanceBackendObservation(
|
|
17
|
+
current: BackendObservation,
|
|
18
|
+
observedAt: number,
|
|
19
|
+
): BackendObservation
|
|
9
20
|
|
|
10
21
|
export function classifyBackendConnection(input: {
|
|
11
22
|
connected: boolean
|
|
12
23
|
everConnected: boolean
|
|
13
24
|
lastMessageAt: number
|
|
25
|
+
disconnectedAt: number | null
|
|
14
26
|
visibleSince: number
|
|
15
27
|
now: number
|
|
16
28
|
}): BackendConnectionState
|
|
@@ -1,18 +1,46 @@
|
|
|
1
|
-
const BACKEND_INITIAL_CONNECT_GRACE_MS =
|
|
1
|
+
const BACKEND_INITIAL_CONNECT_GRACE_MS = 8000;
|
|
2
2
|
const BACKEND_HEARTBEAT_STALE_MS = 6000;
|
|
3
|
+
const BACKEND_HEARTBEAT_FAILURE_MS = 14000;
|
|
4
|
+
const BACKEND_OBSERVER_LAG_RESET_MS = 2500;
|
|
5
|
+
|
|
6
|
+
function advanceBackendObservation(current, observedAt) {
|
|
7
|
+
const now = Number.isFinite(observedAt) ? observedAt : Date.now();
|
|
8
|
+
const previousNow = Number.isFinite(current?.now) ? current.now : now;
|
|
9
|
+
const continuousSince = Number.isFinite(current?.continuousSince)
|
|
10
|
+
? current.continuousSince
|
|
11
|
+
: previousNow;
|
|
12
|
+
return {
|
|
13
|
+
now,
|
|
14
|
+
continuousSince: now - previousNow > BACKEND_OBSERVER_LAG_RESET_MS
|
|
15
|
+
? now
|
|
16
|
+
: continuousSince,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
3
19
|
|
|
4
20
|
function classifyBackendConnection({
|
|
5
21
|
connected,
|
|
6
22
|
everConnected,
|
|
7
23
|
lastMessageAt,
|
|
24
|
+
disconnectedAt,
|
|
8
25
|
visibleSince,
|
|
9
26
|
now,
|
|
10
27
|
}) {
|
|
28
|
+
if (!connected) {
|
|
29
|
+
const disconnectObservedAt = Number.isFinite(disconnectedAt)
|
|
30
|
+
? disconnectedAt
|
|
31
|
+
: lastMessageAt;
|
|
32
|
+
const disconnectedElapsed = Math.max(
|
|
33
|
+
0,
|
|
34
|
+
now - Math.max(disconnectObservedAt, visibleSince),
|
|
35
|
+
);
|
|
36
|
+
return disconnectedElapsed >= BACKEND_INITIAL_CONNECT_GRACE_MS
|
|
37
|
+
? 'lost'
|
|
38
|
+
: 'connecting';
|
|
39
|
+
}
|
|
11
40
|
const observationStartedAt = Math.max(lastMessageAt, visibleSince);
|
|
12
41
|
const elapsed = Math.max(0, now - observationStartedAt);
|
|
13
|
-
if (
|
|
14
|
-
if (
|
|
15
|
-
if (connected && elapsed >= BACKEND_HEARTBEAT_STALE_MS) return 'stale';
|
|
42
|
+
if (elapsed >= BACKEND_HEARTBEAT_FAILURE_MS) return 'stale';
|
|
43
|
+
if (elapsed >= BACKEND_HEARTBEAT_STALE_MS) return 'connecting';
|
|
16
44
|
return null;
|
|
17
45
|
}
|
|
18
46
|
|
|
@@ -34,7 +62,10 @@ function reducePageVisibilitySnapshot(current, {
|
|
|
34
62
|
|
|
35
63
|
module.exports = {
|
|
36
64
|
BACKEND_INITIAL_CONNECT_GRACE_MS,
|
|
65
|
+
BACKEND_HEARTBEAT_FAILURE_MS,
|
|
37
66
|
BACKEND_HEARTBEAT_STALE_MS,
|
|
67
|
+
BACKEND_OBSERVER_LAG_RESET_MS,
|
|
68
|
+
advanceBackendObservation,
|
|
38
69
|
classifyBackendConnection,
|
|
39
70
|
reducePageVisibilitySnapshot,
|
|
40
71
|
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
const { deriveRuntimeObservation } = require('./runtime-observation');
|
|
2
|
-
|
|
3
|
-
function agentKindForCommand(command) {
|
|
4
|
-
const executable = String(command || '')
|
|
5
|
-
.trim()
|
|
6
|
-
.split(/\s+/)
|
|
7
|
-
.find(token => token !== 'env' && !/^[A-Za-z_][A-Za-z0-9_]*=/.test(token));
|
|
8
|
-
const basename = (executable || '').split('/').pop() || '';
|
|
9
|
-
if (basename === 'codex') return 'codex';
|
|
10
|
-
if (basename === 'claude') return 'claude';
|
|
11
|
-
if (['bash', 'zsh', 'sh', 'fish'].includes(basename)) return 'shell';
|
|
12
|
-
return executable ? 'agent' : null;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function isRecoverableEngineAgent(agent) {
|
|
16
|
-
return agent && agent.engineName === 'native';
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function isRestartBlockingAgent(agent) {
|
|
20
|
-
if (!agent || agent.isMain === true || agent.archived === true) return false;
|
|
21
|
-
if (agent.status === 'pending') return true;
|
|
22
|
-
if (agent.status !== 'running') return false;
|
|
23
|
-
if (isRecoverableEngineAgent(agent)) return false;
|
|
24
|
-
|
|
25
|
-
const observation = deriveRuntimeObservation(agent);
|
|
26
|
-
if (observation.phase === 'starting' || observation.phase === 'working' || observation.phase === 'waiting') return true;
|
|
27
|
-
if (observation.phase === 'idle' || observation.phase === 'exited') return false;
|
|
28
|
-
return observation.kind !== 'shell';
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
module.exports = {
|
|
32
|
-
agentKindForCommand,
|
|
33
|
-
isRecoverableEngineAgent,
|
|
34
|
-
isRestartBlockingAgent,
|
|
35
|
-
};
|