@unionschool/easy-agents 1.0.34 → 1.0.44
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 +1 -1
- package/bin/run.js +18 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -88,7 +88,7 @@ npm exec --offline -- easy-agents run
|
|
|
88
88
|
|
|
89
89
|
- Mac 和 Ubuntu 安装包能接平台任务分支上的执行、审核、部署和澄清运行(Codex、Claude,完整权限,与旧 Python 客户端的规则一致):执行在任务分支上工作并在成功后推送;审核和部署检出本轮交付的提交;工作目录有未提交改动时,在客户端配置目录的 `worktrees/` 里另建工作树,原目录不动,合并后的成员同步会清理这些工作树。Agent 通过提示里给出的平台命令调用工具;Agent 凭据缺失或已被平台撤销时,客户端自动领取新凭据(平台会同时撤销旧凭据)。旧的同目录文件交付和用户发布命令(`publish`)不支持。工作台读取任务、需求文档(“阅读”抽屉)也由这两种设备应答,只读 Git,不切分支、不改工作区。
|
|
90
90
|
- **未完成**:Windows、Android 和单独运行的普通 npm 版还不能接任务分支运行,会回报 `handoff_unsupported`。这几端暂时用不上(用户 2026-11-22 定),以后需要时再单独升级。
|
|
91
|
-
- Mac 和 Ubuntu 安装包支持 Codex、Claude
|
|
91
|
+
- Mac 和 Ubuntu 安装包支持 Codex、Claude 的文本对话、续聊和本地文本任务;Agy、Cursor 只接对话,不接任务运行(2026-11-23,1.0.34 起含 Cursor)。它们可从项目卡片或对话页接收聊天和工作消息。普通聊天是纯文本:Codex 只读会话、Claude 不开工具。工作消息(负责人与任务角色的对话、平台的流程通知)与任务运行一样用完整权限,带平台操作入口,Agent 凭据缺失或被撤销时自动领取,所以负责人能在对话里登记需求、发布任务、合并上报。可用的会话编号、模型与用量会随结果回传。
|
|
92
92
|
- Mac 和 Windows 面板可显示检测到的 Codex、Claude、Cursor、Agy 登录和上报状态。平台控制额度上报开关,绿色胶囊显示已获得的剩余额度,测得零时显示零。Windows 和单独运行的普通 npm 版支持单次 Claude 文本任务,使用 bare 模式可用的认证。桌面对话功能需要安装包提供的工具适配和内置运行环境。
|
|
93
93
|
- 在支持的 Unix 主机上,网页终端使用本机运行用户进行 SSH 登录,需要 Python 3、OpenSSH、可读的本机 SSH 公钥和监听回环端口 22 的 SSH 服务。可在工作台的「AI → 设备管理 → 终端」打开。普通 npm 可在启动前用 `EASYAGENTS_TERMINAL=0` 关闭。
|
|
94
94
|
- Node 核心支持 `/sha256 <文本>`、本地 Markdown 文档里的同类计算和成员同步。文档与同步的目录需与本机选定工作目录相符,可用 `EASYAGENTS_WORKSPACE` 指定。成员同步使用包内实现、系统 Git 和 Python 3.10+,更新已有检出目录。Android 首版可执行 SHA-256 消息和用户选择目录里的计算文档。
|
package/bin/run.js
CHANGED
|
@@ -20,6 +20,19 @@ const taskDelivery = () => Boolean(desktopResources());
|
|
|
20
20
|
const DOC_READER = fileURLToPath(new URL('../runtime/doc_read.py', import.meta.url));
|
|
21
21
|
const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
22
22
|
const DOC_FAILED = { status: 'error', error: 'document_read_failed' };
|
|
23
|
+
|
|
24
|
+
// worker.log 每行带本机时间;运行没成功时写出失败代码和原因,本机就能查(2026-11-26,原先只有“已回传 failed”)。
|
|
25
|
+
const pad = n => String(n).padStart(2, '0');
|
|
26
|
+
export function stamped(text, now = new Date()) {
|
|
27
|
+
return `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())} ${pad(now.getHours())}:${pad(now.getMinutes())}:${pad(now.getSeconds())} ${text}`;
|
|
28
|
+
}
|
|
29
|
+
export function finishLine(id, result) {
|
|
30
|
+
const reason = [result.failure_code, String(result.failure_detail ?? '').replace(/\s+/g, ' ').trim().slice(0, 120)]
|
|
31
|
+
.filter(Boolean).join(':');
|
|
32
|
+
return '运行 ' + id + ' 已回传 ' + result.status + (result.status !== 'succeeded' && reason ? '(' + reason + ')' : '');
|
|
33
|
+
}
|
|
34
|
+
const info = text => console.log(stamped(text));
|
|
35
|
+
const warn = text => console.error(stamped(text));
|
|
23
36
|
function readDocument(message, signal) {
|
|
24
37
|
return new Promise(done => {
|
|
25
38
|
const child = execFile(join(desktopResources(), 'python/bin/python3'), ['-I', '-B', '-X', 'utf8', DOC_READER],
|
|
@@ -123,7 +136,7 @@ export async function runDevice(device, configDir, version, signal, { reporter,
|
|
|
123
136
|
if (typeof id !== 'string' || !UUID.test(id) || !desktopResources()) return;
|
|
124
137
|
const body = await readDocument(msg, signal);
|
|
125
138
|
try { await gatewayRequest('POST', '/api/client/documents/' + id, body); }
|
|
126
|
-
catch { if (!signal.aborted)
|
|
139
|
+
catch { if (!signal.aborted) warn('文档读取结果回传失败'); }
|
|
127
140
|
}
|
|
128
141
|
async function answerSteer(target, msg) {
|
|
129
142
|
if (!UUID.test(msg.run_id || '') || !UUID.test(msg.message_id || '')) return;
|
|
@@ -185,7 +198,7 @@ export async function runDevice(device, configDir, version, signal, { reporter,
|
|
|
185
198
|
await request('POST', id + '/finish', result);
|
|
186
199
|
rmSync(join(folder, id + '.json'), { force: true });
|
|
187
200
|
reporter?.patch({ lastResult: { id, status: result.status, at: Date.now() } });
|
|
188
|
-
|
|
201
|
+
info(finishLine(id, result));
|
|
189
202
|
}
|
|
190
203
|
function startQueue() {
|
|
191
204
|
while (online && !signal.aborted && running.size < MAX_PARALLEL_RUNS) {
|
|
@@ -230,7 +243,7 @@ export async function runDevice(device, configDir, version, signal, { reporter,
|
|
|
230
243
|
try { metadata = await reporter.hello(signal); }
|
|
231
244
|
catch {
|
|
232
245
|
if (signal.aborted) break;
|
|
233
|
-
|
|
246
|
+
warn('本机工具信息暂时不可用,正在重试');
|
|
234
247
|
reporter.disconnect();
|
|
235
248
|
await sleep(delay, undefined, { signal }).catch(() => {});
|
|
236
249
|
delay = Math.min(60000, delay * 2);
|
|
@@ -260,7 +273,7 @@ export async function runDevice(device, configDir, version, signal, { reporter,
|
|
|
260
273
|
if (msg.type !== 'welcome' || msg.device_id !== device.device_id) throw new Error();
|
|
261
274
|
welcomed = online = true; delay = 1000;
|
|
262
275
|
reporter?.welcome(hello, msg, reportQuota, () => current.terminate());
|
|
263
|
-
|
|
276
|
+
info('设备已上线');
|
|
264
277
|
const pending = await request('GET', 'pending');
|
|
265
278
|
if (current !== socket || current.readyState !== WebSocket.OPEN) return;
|
|
266
279
|
for (const f of readdirSync(folder)) if (f.endsWith('.json')) enqueue(f.slice(0, -5));
|
|
@@ -290,7 +303,7 @@ export async function runDevice(device, configDir, version, signal, { reporter,
|
|
|
290
303
|
for (const session of sessions.values()) session.terminate();
|
|
291
304
|
}
|
|
292
305
|
if (!signal.aborted && !fatal) {
|
|
293
|
-
|
|
306
|
+
warn('连接中断,正在重连');
|
|
294
307
|
await sleep(delay, undefined, { signal }).catch(() => {});
|
|
295
308
|
delay = Math.min(delay * 2, 60000);
|
|
296
309
|
}
|