@unionschool/easy-agents 1.0.50 → 1.0.52
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 +4 -4
- package/bin/tasks.js +15 -3
- package/package.json +1 -1
- package/runtime/desktop_chat.py +21 -5
- package/runtime/task_run.py +6 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# EasyAgents
|
|
2
2
|
|
|
3
|
-
在要接任务的设备上单独安装客户端,首次用工作台生成的配对码绑定设备。Mac、Windows 和 Ubuntu 安装包自带 Node、Python 和客户端核心。设备要使用 Codex 或
|
|
3
|
+
在要接任务的设备上单独安装客户端,首次用工作台生成的配对码绑定设备。Mac、Windows 和 Ubuntu 安装包自带 Node、Python 和客户端核心。设备要使用 Codex、Claude、Cursor 或 Agy 时,还需安装并登录对应的命令行工具(`codex`、`claude`、`cursor-agent`、`agy`),客户端在系统路径里查找。
|
|
4
4
|
|
|
5
5
|
## 选择安装包
|
|
6
6
|
|
|
@@ -86,10 +86,10 @@ npm exec --offline -- easy-agents run
|
|
|
86
86
|
|
|
87
87
|
## 各端能执行什么
|
|
88
88
|
|
|
89
|
-
- Mac 和 Ubuntu 安装包能接平台任务分支上的执行、审核、部署和澄清运行(Codex、Claude
|
|
89
|
+
- Mac 和 Ubuntu 安装包能接平台任务分支上的执行、审核、部署和澄清运行(Codex、Claude、Cursor、Agy,1.0.50 起含 Cursor、Agy;完整权限,与旧 Python 客户端的规则一致):执行在任务分支上工作并在成功后推送;审核和部署检出本轮交付的提交;工作目录有未提交改动时,在客户端配置目录的 `worktrees/` 里另建工作树,原目录不动,合并后的成员同步会清理这些工作树。Agent 通过提示里给出的平台命令调用工具;Agent 凭据缺失或已被平台撤销时,客户端自动领取新凭据(平台会同时撤销旧凭据)。旧的同目录文件交付和用户发布命令(`publish`)不支持。工作台读取任务、需求文档(“阅读”抽屉)也由这两种设备应答,只读 Git,不切分支、不改工作区。
|
|
90
90
|
- **未完成**:Windows、Android 和单独运行的普通 npm 版还不能接任务分支运行,会回报 `handoff_unsupported`。这几端暂时用不上(用户 2026-11-22 定),以后需要时再单独升级。
|
|
91
|
-
- Mac 和 Ubuntu 安装包支持 Codex、Claude
|
|
92
|
-
- Mac 和 Windows 面板可显示检测到的 Codex、Claude、Cursor、Agy 登录和上报状态。平台控制额度上报开关,绿色胶囊显示已获得的剩余额度,测得零时显示零。Windows 和单独运行的普通 npm 版支持单次 Claude 文本任务,使用 bare
|
|
91
|
+
- Mac 和 Ubuntu 安装包支持 Codex、Claude、Cursor、Agy 的文本对话与续聊,Codex、Claude 还支持本地文本任务。客户端上线时按工具上报能否接任务分支运行,平台据此派发;1.0.49 及更早的客户端不接 Cursor、Agy 的任务运行,平台会把派给它们的任务运行留在排队。Cursor、Agy 在 Ubuntu 上的任务运行尚未实测。它们可从项目卡片或对话页接收聊天和工作消息。普通聊天是纯文本:Codex 只读会话、Claude 不开工具。工作消息(负责人与任务角色的对话、平台的流程通知)与任务运行一样用完整权限,带平台操作入口,Agent 凭据缺失或被撤销时自动领取,所以负责人能在对话里登记需求、发布任务、合并上报。可用的会话编号、模型与用量会随结果回传。
|
|
92
|
+
- Mac 和 Windows 面板可显示检测到的 Codex、Claude、Cursor、Agy 登录和上报状态。平台控制额度上报开关,绿色胶囊显示已获得的剩余额度,测得零时显示零。Windows 和单独运行的普通 npm 版支持单次 Claude 文本任务,使用 bare 模式可用的认证。Mac、Linux 上的普通 npm 版还接 Codex、Agy、Cursor 的聊天模式(1.0.51 起),用本机 `python3`(3.10 及以上)运行对话,需在本机装好并登录对应工具;工作模式和任务运行仍需安装包。桌面对话功能需要安装包提供的工具适配和内置运行环境。
|
|
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 消息和用户选择目录里的计算文档。
|
|
95
95
|
- 客户端保存待回传结果,重连后补传。独立版尚未接入运行中 `/steer`、手动 `/sync`、平台远程读文档和编辑设备上的工具规则。
|
package/bin/tasks.js
CHANGED
|
@@ -16,6 +16,7 @@ function invoke(file, args, cwd, input, signal, timeout) {
|
|
|
16
16
|
|
|
17
17
|
// 对话桥:首行 JSON 是运行内容,之后 stdin 保持打开,运行中补充(/steer)按行写入;
|
|
18
18
|
// 子进程从 fd 3 逐行回执 {"message_id","status"},stdout 只放最终结果。
|
|
19
|
+
// resources 为空时是普通 npm 版的聊天(用户 2026-11-27):用本机 python3 跑同一个对话桥,适配器只依赖标准库。
|
|
19
20
|
function desktopConversation(resources, content, prompt, signal, credential, tools = false, onSteer) {
|
|
20
21
|
const bridge = fileURLToPath(new URL('../runtime/desktop_chat.py', import.meta.url));
|
|
21
22
|
const seconds = content.timeout_seconds;
|
|
@@ -24,7 +25,8 @@ function desktopConversation(resources, content, prompt, signal, credential, too
|
|
|
24
25
|
resume: content.resume_session_ref, workspace: content.workspace?.local_path, timeout,
|
|
25
26
|
workRunId: content.chat_mode !== 'chat' ? content.run_id : undefined, passthrough: content.passthrough === true, credential, tools };
|
|
26
27
|
return new Promise(resolveResult => {
|
|
27
|
-
const
|
|
28
|
+
const python = resources ? join(resources, 'python/bin/python3') : 'python3';
|
|
29
|
+
const child = spawn(python, ['-I', '-B', '-X', 'utf8', bridge],
|
|
28
30
|
{ stdio: ['pipe', 'pipe', 'ignore', 'pipe'], windowsHide: true });
|
|
29
31
|
const waiting = new Map();
|
|
30
32
|
let stdout = '', size = 0, settled = false, acks = '';
|
|
@@ -58,7 +60,8 @@ function desktopConversation(resources, content, prompt, signal, credential, too
|
|
|
58
60
|
} catch {}
|
|
59
61
|
}
|
|
60
62
|
});
|
|
61
|
-
child.on('error',
|
|
63
|
+
child.on('error', error => finish(!resources && error.code === 'ENOENT'
|
|
64
|
+
? { status: 'failed', failure_code: 'python_missing', failure_detail: NPM_PYTHON_NOTE } : failed));
|
|
62
65
|
child.on('close', () => {
|
|
63
66
|
if (signal.aborted) {
|
|
64
67
|
// 被 /stop 停下:带回工具会话号,下一条消息续接同一会话(docs/消息链路.md 第 3.2 节)。
|
|
@@ -84,6 +87,11 @@ function desktopConversation(resources, content, prompt, signal, credential, too
|
|
|
84
87
|
}
|
|
85
88
|
|
|
86
89
|
const TASK_KINDS = ['execute', 'review', 'deploy', 'clarify'];
|
|
90
|
+
// 普通 npm 版(没有安装包运行环境)只接这三种工具的聊天模式;工作模式要平台操作入口(依赖安装包里的 httpx),任务运行要安装包(用户 2026-11-27)。
|
|
91
|
+
// Windows 的工具启动方式没验证过,暂不开放。Claude 照旧走下面的单次文本任务。
|
|
92
|
+
const NPM_CHAT_TOOLS = ['codex', 'antigravity', 'cursor'];
|
|
93
|
+
const NPM_PYTHON_NOTE = '普通 npm 版的聊天需要本机 python3(3.10 及以上),请先安装';
|
|
94
|
+
const NPM_LIMIT_NOTE = '此设备是普通 npm 版客户端:Codex、Agy、Cursor 只接聊天模式,Claude 只接纯聊天;工作模式和任务运行请安装 Mac 或 Ubuntu 安装包';
|
|
87
95
|
const DESKTOP_TASK_TOOLS = ['codex', 'claude_code', 'antigravity', 'cursor'];
|
|
88
96
|
|
|
89
97
|
// Mac and Ubuntu desktop installs: Git task-branch runs go to the packaged Python runner.
|
|
@@ -242,8 +250,12 @@ export async function execute(content, signal, workCredential, { agentCredential
|
|
|
242
250
|
}
|
|
243
251
|
return desktopConversation(resources, content, prompt, signal, credential, workMode, onSteer);
|
|
244
252
|
}
|
|
253
|
+
if (!resources && process.platform !== 'win32' && !task && content.run_kind === 'chat' && content.chat_mode === 'chat'
|
|
254
|
+
&& NPM_CHAT_TOOLS.includes(content.agent?.tool_type)) {
|
|
255
|
+
return desktopConversation(null, content, prompt, signal, null, false, onSteer);
|
|
256
|
+
}
|
|
245
257
|
if ((!task && (content.run_kind !== 'chat' || content.chat_mode !== 'chat')) || content.agent?.tool_type !== 'claude_code') {
|
|
246
|
-
return { status: 'failed', failure_code: 'unsupported_task', failure_detail:
|
|
258
|
+
return { status: 'failed', failure_code: 'unsupported_task', failure_detail: NPM_LIMIT_NOTE };
|
|
247
259
|
}
|
|
248
260
|
if (content.resume_session_ref) {
|
|
249
261
|
return { status: 'failed', failure_code: 'unsupported_session', failure_detail: '此版本仅支持独立文本任务' };
|
package/package.json
CHANGED
package/runtime/desktop_chat.py
CHANGED
|
@@ -8,8 +8,14 @@ import threading
|
|
|
8
8
|
from pathlib import Path
|
|
9
9
|
from uuid import UUID
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
if sys.version_info < (3, 10):
|
|
12
|
+
print(json.dumps({"status": "failed", "failure_code": "python_missing",
|
|
13
|
+
"failure_detail": "普通 npm 版的聊天需要本机 python3(3.10 及以上),请先升级"}, ensure_ascii=False))
|
|
14
|
+
sys.exit(0)
|
|
15
|
+
# 安装包带运行环境目录;普通 npm 版的聊天(2026-11-27)没有,用本机 python3,适配器只依赖标准库。
|
|
16
|
+
resources = os.environ.get("EASYAGENTS_MAC_RESOURCES") or os.environ.get("EASYAGENTS_DESKTOP_RESOURCES")
|
|
17
|
+
if resources:
|
|
18
|
+
sys.path.insert(0, str(Path(resources) / "lib"))
|
|
13
19
|
sys.path.insert(0, str(Path(__file__).resolve().parents[1]))
|
|
14
20
|
# 工具适配器用 npm 核心包自带的那份(只依赖标准库),不用安装包 lib 里打包时的旧副本:
|
|
15
21
|
# 这样 /compact、/steer 等适配器修复随核心更新生效,不必重装应用(2026-11-23)。
|
|
@@ -93,9 +99,14 @@ def instructions_for(tool, tools, command):
|
|
|
93
99
|
COMPACT_AT_DEFAULT = 60
|
|
94
100
|
|
|
95
101
|
|
|
102
|
+
def config_dir():
|
|
103
|
+
"""客户端配置目录:安装包的启动器会设环境变量;普通 npm 版(2026-11-27)不设,用与 bin/easy-agents.js 相同的默认目录。"""
|
|
104
|
+
return Path(os.environ.get("EASYAGENTS_CONFIG_DIR") or Path.home() / ".easyagents")
|
|
105
|
+
|
|
106
|
+
|
|
96
107
|
def compact_at():
|
|
97
108
|
try:
|
|
98
|
-
value = json.loads((
|
|
109
|
+
value = json.loads((config_dir() / "mac-compact.json").read_text())["percent"]
|
|
99
110
|
except (KeyError, OSError, ValueError, TypeError):
|
|
100
111
|
return COMPACT_AT_DEFAULT
|
|
101
112
|
return value if type(value) is int and 0 <= value <= 100 else COMPACT_AT_DEFAULT
|
|
@@ -205,11 +216,16 @@ def run(content, cancelled):
|
|
|
205
216
|
local = content.get("workspace")
|
|
206
217
|
if local:
|
|
207
218
|
cwd = (Path.home() / Path(local).expanduser()).resolve()
|
|
208
|
-
if
|
|
219
|
+
if cwd == Path(cwd.anchor):
|
|
209
220
|
return failed("workspace_missing", "请核对该 Agent 在设备上登记的工作目录")
|
|
221
|
+
# 登记的目录在设备上还没有就建出来,不分聊天、工作模式(用户 2026-11-27)
|
|
222
|
+
try:
|
|
223
|
+
cwd.mkdir(parents=True, exist_ok=True)
|
|
224
|
+
except OSError:
|
|
225
|
+
return failed("workspace_missing", f"无法创建该 Agent 登记的工作目录:{cwd}")
|
|
210
226
|
else:
|
|
211
227
|
# Claude locates earlier conversations by directory even when all tools are disabled.
|
|
212
|
-
cwd =
|
|
228
|
+
cwd = config_dir() / "chat-workspace"
|
|
213
229
|
cwd.mkdir(mode=0o700, parents=True, exist_ok=True)
|
|
214
230
|
|
|
215
231
|
if command == "/compact" and tool in SOFT_COMPACT_TOOLS:
|
package/runtime/task_run.py
CHANGED
|
@@ -80,8 +80,13 @@ def run(request, cancelled):
|
|
|
80
80
|
if not isinstance(local, str) or local.strip() in ("", ".", "~", "~/"):
|
|
81
81
|
return failed("workspace_missing", "未配置工作目录")
|
|
82
82
|
original = (Path.home() / Path(local).expanduser()).resolve()
|
|
83
|
-
if
|
|
83
|
+
if original == Path(original.anchor) or original == Path.home().resolve():
|
|
84
84
|
return failed("workspace_missing", "请核对该 Agent 在设备上登记的工作目录")
|
|
85
|
+
# 登记的目录在设备上还没有就建出来(用户 2026-11-27:不管什么模式)
|
|
86
|
+
try:
|
|
87
|
+
original.mkdir(parents=True, exist_ok=True)
|
|
88
|
+
except OSError:
|
|
89
|
+
return failed("workspace_missing", f"无法创建该 Agent 登记的工作目录:{original}")
|
|
85
90
|
|
|
86
91
|
sync = None
|
|
87
92
|
cwd = original
|