@unionschool/easy-agents 1.0.51 → 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/package.json +1 -1
- package/runtime/desktop_chat.py +13 -3
- package/runtime/task_run.py +6 -1
package/package.json
CHANGED
package/runtime/desktop_chat.py
CHANGED
|
@@ -99,9 +99,14 @@ def instructions_for(tool, tools, command):
|
|
|
99
99
|
COMPACT_AT_DEFAULT = 60
|
|
100
100
|
|
|
101
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
|
+
|
|
102
107
|
def compact_at():
|
|
103
108
|
try:
|
|
104
|
-
value = json.loads((
|
|
109
|
+
value = json.loads((config_dir() / "mac-compact.json").read_text())["percent"]
|
|
105
110
|
except (KeyError, OSError, ValueError, TypeError):
|
|
106
111
|
return COMPACT_AT_DEFAULT
|
|
107
112
|
return value if type(value) is int and 0 <= value <= 100 else COMPACT_AT_DEFAULT
|
|
@@ -211,11 +216,16 @@ def run(content, cancelled):
|
|
|
211
216
|
local = content.get("workspace")
|
|
212
217
|
if local:
|
|
213
218
|
cwd = (Path.home() / Path(local).expanduser()).resolve()
|
|
214
|
-
if
|
|
219
|
+
if cwd == Path(cwd.anchor):
|
|
215
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}")
|
|
216
226
|
else:
|
|
217
227
|
# Claude locates earlier conversations by directory even when all tools are disabled.
|
|
218
|
-
cwd =
|
|
228
|
+
cwd = config_dir() / "chat-workspace"
|
|
219
229
|
cwd.mkdir(mode=0o700, parents=True, exist_ok=True)
|
|
220
230
|
|
|
221
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
|