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
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
const WebSocket = require('ws');
|
|
2
|
-
|
|
3
|
-
class CdpClient {
|
|
4
|
-
constructor(options = {}) {
|
|
5
|
-
this.WebSocket = options.WebSocket || WebSocket;
|
|
6
|
-
this.timeoutMs = options.timeoutMs || 15_000;
|
|
7
|
-
this.socket = null;
|
|
8
|
-
this.nextId = 0;
|
|
9
|
-
this.pending = new Map();
|
|
10
|
-
this.listeners = new Map();
|
|
11
|
-
this.closeListeners = new Set();
|
|
12
|
-
this.closeNotified = false;
|
|
13
|
-
this.closed = false;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
connect(url) {
|
|
17
|
-
if (this.socket) throw new Error('CDP client is already connected');
|
|
18
|
-
return new Promise((resolve, reject) => {
|
|
19
|
-
const socket = new this.WebSocket(url);
|
|
20
|
-
this.socket = socket;
|
|
21
|
-
const onOpen = () => {
|
|
22
|
-
cleanupConnectListeners();
|
|
23
|
-
socket.on('message', data => this.handleMessage(data));
|
|
24
|
-
socket.on('close', () => this.handleClose(new Error('CDP connection closed')));
|
|
25
|
-
socket.on('error', error => this.handleClose(error));
|
|
26
|
-
resolve();
|
|
27
|
-
};
|
|
28
|
-
const onError = error => {
|
|
29
|
-
cleanupConnectListeners();
|
|
30
|
-
this.socket = null;
|
|
31
|
-
reject(error);
|
|
32
|
-
};
|
|
33
|
-
const onClose = () => {
|
|
34
|
-
cleanupConnectListeners();
|
|
35
|
-
this.socket = null;
|
|
36
|
-
reject(new Error('CDP connection closed during startup'));
|
|
37
|
-
};
|
|
38
|
-
const cleanupConnectListeners = () => {
|
|
39
|
-
socket.off('open', onOpen);
|
|
40
|
-
socket.off('error', onError);
|
|
41
|
-
socket.off('close', onClose);
|
|
42
|
-
};
|
|
43
|
-
socket.once('open', onOpen);
|
|
44
|
-
socket.once('error', onError);
|
|
45
|
-
socket.once('close', onClose);
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
send(method, params = {}, sessionId) {
|
|
50
|
-
if (!this.socket || this.closed || this.socket.readyState !== WebSocket.OPEN) {
|
|
51
|
-
return Promise.reject(new Error('CDP connection is not open'));
|
|
52
|
-
}
|
|
53
|
-
const id = ++this.nextId;
|
|
54
|
-
return new Promise((resolve, reject) => {
|
|
55
|
-
const timer = setTimeout(() => {
|
|
56
|
-
if (!this.pending.delete(id)) return;
|
|
57
|
-
reject(new Error(`CDP command timed out: ${method}`));
|
|
58
|
-
}, this.timeoutMs);
|
|
59
|
-
timer.unref?.();
|
|
60
|
-
this.pending.set(id, { resolve, reject, timer });
|
|
61
|
-
const message = { id, method, params };
|
|
62
|
-
if (sessionId) message.sessionId = sessionId;
|
|
63
|
-
this.socket.send(JSON.stringify(message), error => {
|
|
64
|
-
if (!error) return;
|
|
65
|
-
const pending = this.pending.get(id);
|
|
66
|
-
if (!pending) return;
|
|
67
|
-
this.pending.delete(id);
|
|
68
|
-
clearTimeout(pending.timer);
|
|
69
|
-
pending.reject(error);
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
on(method, handler, sessionId) {
|
|
75
|
-
const listener = { handler, sessionId: sessionId || null };
|
|
76
|
-
if (!this.listeners.has(method)) this.listeners.set(method, new Set());
|
|
77
|
-
this.listeners.get(method).add(listener);
|
|
78
|
-
return () => {
|
|
79
|
-
const listeners = this.listeners.get(method);
|
|
80
|
-
if (!listeners) return;
|
|
81
|
-
listeners.delete(listener);
|
|
82
|
-
if (listeners.size === 0) this.listeners.delete(method);
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
onClose(handler) {
|
|
87
|
-
this.closeListeners.add(handler);
|
|
88
|
-
return () => this.closeListeners.delete(handler);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
waitFor(method, options = {}) {
|
|
92
|
-
const timeoutMs = options.timeoutMs || this.timeoutMs;
|
|
93
|
-
return new Promise((resolve, reject) => {
|
|
94
|
-
let settled = false;
|
|
95
|
-
const off = this.on(method, params => {
|
|
96
|
-
if (settled) return;
|
|
97
|
-
settled = true;
|
|
98
|
-
clearTimeout(timer);
|
|
99
|
-
off();
|
|
100
|
-
resolve(params);
|
|
101
|
-
}, options.sessionId);
|
|
102
|
-
const timer = setTimeout(() => {
|
|
103
|
-
if (settled) return;
|
|
104
|
-
settled = true;
|
|
105
|
-
off();
|
|
106
|
-
reject(new Error(`CDP event timed out: ${method}`));
|
|
107
|
-
}, timeoutMs);
|
|
108
|
-
timer.unref?.();
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
close() {
|
|
113
|
-
if (this.closed) return;
|
|
114
|
-
this.closed = true;
|
|
115
|
-
const socket = this.socket;
|
|
116
|
-
this.socket = null;
|
|
117
|
-
if (socket && (socket.readyState === WebSocket.OPEN || socket.readyState === WebSocket.CONNECTING)) {
|
|
118
|
-
socket.close();
|
|
119
|
-
}
|
|
120
|
-
this.handleClose(new Error('CDP client closed'));
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
handleMessage(data) {
|
|
124
|
-
let message;
|
|
125
|
-
try {
|
|
126
|
-
message = JSON.parse(data.toString());
|
|
127
|
-
} catch {
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
if (message.id && this.pending.has(message.id)) {
|
|
131
|
-
const pending = this.pending.get(message.id);
|
|
132
|
-
this.pending.delete(message.id);
|
|
133
|
-
clearTimeout(pending.timer);
|
|
134
|
-
if (message.error) {
|
|
135
|
-
const error = new Error(message.error.message || 'CDP command failed');
|
|
136
|
-
error.code = message.error.code;
|
|
137
|
-
error.data = message.error.data;
|
|
138
|
-
pending.reject(error);
|
|
139
|
-
} else {
|
|
140
|
-
pending.resolve(message.result || {});
|
|
141
|
-
}
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
if (!message.method) return;
|
|
145
|
-
const listeners = this.listeners.get(message.method);
|
|
146
|
-
if (!listeners) return;
|
|
147
|
-
for (const listener of [...listeners]) {
|
|
148
|
-
if (listener.sessionId && listener.sessionId !== message.sessionId) continue;
|
|
149
|
-
listener.handler(message.params || {}, message);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
handleClose(error) {
|
|
154
|
-
for (const pending of this.pending.values()) {
|
|
155
|
-
clearTimeout(pending.timer);
|
|
156
|
-
pending.reject(error);
|
|
157
|
-
}
|
|
158
|
-
this.pending.clear();
|
|
159
|
-
if (this.closeNotified) return;
|
|
160
|
-
this.closeNotified = true;
|
|
161
|
-
for (const listener of [...this.closeListeners]) listener(error);
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
module.exports = {
|
|
166
|
-
CdpClient,
|
|
167
|
-
};
|