evolcore 0.0.25 → 0.0.26
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/CHANGELOG.md +607 -565
- package/LICENSE +21 -21
- package/README.md +455 -455
- package/bin/codex-managed-acl.ps1 +160 -160
- package/bin/codex-managed-hook.mjs +208 -208
- package/bin/ec-safe-output.js +327 -327
- package/bin/ec.js +40 -29
- package/bin/install-codex-managed-hooks.mjs +582 -555
- package/dist/agents/baseagent.js +96 -46
- package/dist/agents/claude-runner.js +50 -12
- package/dist/agents/codex/app-server-client.js +13 -5
- package/dist/agents/codex/catalog.js +1 -1
- package/dist/agents/codex/diagnostics.js +34 -1
- package/dist/agents/codex-runner.js +121 -38
- package/dist/agents/ecagent-runner.js +4 -9
- package/dist/agents/gemini-runner.js +2 -7
- package/dist/agents/runner-types.js +25 -17
- package/dist/aun/aid/agentmd.js +81 -8
- package/dist/aun/aid/client.js +1 -1
- package/dist/aun/aid/identity.js +1 -1
- package/dist/aun/aid/index.js +1 -1
- package/dist/aun/aid/store.js +17 -13
- package/dist/aun/menu-client.js +74 -0
- package/dist/aun/msg/group.js +1 -1
- package/dist/aun/msg/managed-operation.js +1 -1
- package/dist/aun/msg/p2p.js +6 -1
- package/dist/aun/msg/upload.js +30 -22
- package/dist/channels/aun.js +329 -94
- package/dist/cli/agent-command.js +105 -84
- package/dist/cli/agent-create.js +112 -10
- package/dist/cli/agent.js +16 -5
- package/dist/cli/aun-commands.js +297 -296
- package/dist/cli/bench.js +20 -20
- package/dist/cli/config.js +47 -28
- package/dist/cli/contact.js +70 -13
- package/dist/cli/ctl-command.js +22 -22
- package/dist/cli/daemon-commands.js +105 -40
- package/dist/cli/diag.js +31 -0
- package/dist/cli/fs-command.js +67 -67
- package/dist/cli/handoff-command.js +41 -9
- package/dist/cli/index.js +83 -77
- package/dist/cli/link-rules.js +21 -21
- package/dist/cli/managed-command-guard.js +3 -0
- package/dist/cli/menu-client.js +46 -31
- package/dist/cli/net-check.js +22 -22
- package/dist/cli/queue-command.js +29 -29
- package/dist/cli/response.js +30 -30
- package/dist/cli/restart-monitor.js +87 -40
- package/dist/cli/stats.js +51 -51
- package/dist/cli/trigger-command.js +56 -56
- package/dist/config/builtin-roles.js +1 -0
- package/dist/config/config-operation-service.js +145 -0
- package/dist/config/contact-operation-service.js +96 -7
- package/dist/config/resolved-config-op.js +27 -7
- package/dist/core/agent-application-service.js +2 -1
- package/dist/core/auth/authorization-audit.js +20 -12
- package/dist/core/auth/operation-authorizer.js +25 -4
- package/dist/core/auth/operation-catalog.js +35 -4
- package/dist/core/auth/remote-access-store.js +40 -1
- package/dist/core/bootstrap-service.js +1 -1
- package/dist/core/command/command-handler.js +83 -26
- package/dist/core/command/diag-service.js +118 -0
- package/dist/core/command/menu-catalog.js +12 -3
- package/dist/core/command/menu-handler.js +47 -26
- package/dist/core/command/menu-protocol.js +5 -0
- package/dist/core/command/menu-token-store.js +41 -8
- package/dist/core/command/slash-gate.js +34 -4
- package/dist/core/command/slash-handler.js +86 -21
- package/dist/core/handoff/runtime.js +205 -27
- package/dist/core/handoff/store.js +193 -4
- package/dist/core/message/im-renderer.js +72 -21
- package/dist/core/message/message-bridge.js +69 -9
- package/dist/core/message/message-queue.js +26 -0
- package/dist/core/message/message-utils.js +1 -0
- package/dist/core/message/response-engine.js +47 -28
- package/dist/core/model/catalog-service.js +79 -49
- package/dist/core/model/context-window-suffix.js +33 -0
- package/dist/core/model/model-catalog.js +1 -1
- package/dist/core/model/model-permission.js +12 -3
- package/dist/core/permission/ec-command-parser.js +51 -12
- package/dist/core/permission/sandbox-runtime.js +36 -14
- package/dist/core/permission/tool-policy.js +2 -1
- package/dist/index.js +280 -163
- package/dist/ipc.js +54 -2
- package/dist/response-system/engines/v1/proactive-flow.js +59 -2
- package/dist/stats/billing.js +41 -15
- package/dist/stats/db.js +159 -159
- package/dist/stats/eck-vars.js +9 -9
- package/dist/stats/price-resolver.js +28 -10
- package/dist/stats/query.js +139 -139
- package/dist/stats/role-budget.js +6 -6
- package/dist/stats/writer.js +51 -51
- package/dist/utils/cross-platform.js +30 -1
- package/dist/utils/error-dict.json +160 -160
- package/dist/utils/error-utils.js +21 -0
- package/dist/utils/evolcore-version.js +129 -0
- package/dist/utils/logger.js +3 -1
- package/dist/utils/macos-autostart.js +22 -22
- package/dist/utils/model-prices.jsonl +23 -23
- package/dist/utils/npm-ops.js +176 -35
- package/dist/utils/welcome.js +22 -22
- package/ecagent/LICENSE +21 -21
- package/ecagent/NOTICE +11 -11
- package/ecagent/README.md +61 -61
- package/ecagent/dist/harness/compaction/branch-summarization.js +30 -30
- package/ecagent/dist/harness/compaction/compaction.js +83 -83
- package/ecagent/dist/harness/messages.js +7 -7
- package/kits/docs/GUIDE.md +20 -20
- package/kits/docs/INDEX.md +66 -66
- package/kits/docs/aun/CHEATSHEET.md +19 -19
- package/kits/docs/aun/SYNC_PROTOCOL.md +15 -15
- package/kits/docs/channels/aun.md +56 -56
- package/kits/docs/channels/feishu.md +56 -56
- package/kits/docs/context-assembly.md +364 -364
- package/kits/docs/eck_templates/GUIDE.template.md +22 -22
- package/kits/docs/eck_templates/INDEX.template.md +28 -28
- package/kits/docs/eck_templates/path-registry.template.md +33 -33
- package/kits/docs/eck_templates/runtime.template.md +19 -19
- package/kits/docs/evolcore/INDEX.md +71 -71
- package/kits/docs/evolcore/agent-create.md +170 -165
- package/kits/docs/evolcore/agent.md +66 -66
- package/kits/docs/evolcore/aid.md +60 -60
- package/kits/docs/evolcore/codex-windows-sandbox.md +146 -146
- package/kits/docs/evolcore/config.md +202 -195
- package/kits/docs/evolcore/contact.md +75 -68
- package/kits/docs/evolcore/ctl.md +46 -46
- package/kits/docs/evolcore/event.md +216 -216
- package/kits/docs/evolcore/fs-architecture.md +1215 -1215
- package/kits/docs/evolcore/fs.md +110 -110
- package/kits/docs/evolcore/group-collaboration.md +243 -243
- package/kits/docs/evolcore/group-fs.md +17 -17
- package/kits/docs/evolcore/group-rules.md +251 -251
- package/kits/docs/evolcore/group.md +152 -152
- package/kits/docs/evolcore/menu-client.md +42 -34
- package/kits/docs/evolcore/model.md +50 -50
- package/kits/docs/evolcore/msg.md +166 -165
- package/kits/docs/evolcore/response.md +75 -75
- package/kits/docs/evolcore/rpc.md +37 -37
- package/kits/docs/evolcore/self-summary.md +29 -29
- package/kits/docs/evolcore/stats.md +83 -83
- package/kits/docs/evolcore/storage.md +50 -50
- package/kits/docs/evolcore/trigger.md +575 -575
- package/kits/docs/identity/AID_PROFILE_SPEC.md +26 -26
- package/kits/docs/identity/PATH_OPS.md +16 -16
- package/kits/docs/identity/ROLE_DETAIL.md +25 -25
- package/kits/docs/identity/identity-tools.md +26 -26
- package/kits/docs/path-registry.md +62 -62
- package/kits/docs/prompt-loading-architecture.md +269 -269
- package/kits/docs/venues/aun-group.md +45 -45
- package/kits/docs/venues/aun-private.md +10 -10
- package/kits/docs/venues/client-desktop.md +10 -10
- package/kits/docs/venues/client-mobile.md +10 -10
- package/kits/docs/venues/feishu-group.md +13 -13
- package/kits/docs/venues/feishu-private.md +9 -9
- package/kits/docs/venues/group.md +37 -25
- package/kits/docs/venues/private.md +10 -10
- package/kits/eck_manifest.auxiliary.json +43 -43
- package/kits/eck_manifest.json +190 -190
- package/kits/eck_message_manifest.json +74 -74
- package/kits/migrations/README-role-config-v4.md +32 -32
- package/kits/migrations/migrate-contact-book-v2.mjs +748 -748
- package/kits/migrations/migrate-role-config-v4.mjs +614 -614
- package/kits/migrations/migrate-role-config-v5.mjs +365 -365
- package/kits/migrations/rename-config-file.mjs +99 -99
- package/kits/rules/01-overview.md +162 -162
- package/kits/rules/02-navigation.md +96 -96
- package/kits/rules/03-identity.md +36 -36
- package/kits/rules/04-relation.md +75 -75
- package/kits/rules/05-venue.md +60 -60
- package/kits/rules/06-channel.md +63 -63
- package/kits/schemas/_meta.json +53 -53
- package/kits/schemas/agent-config.schema.1.json +177 -177
- package/kits/schemas/agent-config.schema.10.json +395 -395
- package/kits/schemas/agent-config.schema.11.json +421 -421
- package/kits/schemas/agent-config.schema.12.json +427 -427
- package/kits/schemas/agent-config.schema.2.json +239 -239
- package/kits/schemas/agent-config.schema.3.json +119 -119
- package/kits/schemas/agent-config.schema.4.json +208 -208
- package/kits/schemas/agent-config.schema.5.json +326 -326
- package/kits/schemas/agent-config.schema.6.json +322 -322
- package/kits/schemas/agent-config.schema.7.json +303 -303
- package/kits/schemas/agent-config.schema.8.json +304 -304
- package/kits/schemas/agent-config.schema.9.json +364 -364
- package/kits/schemas/contact-book.schema.1.json +36 -36
- package/kits/schemas/contact-book.schema.2.json +43 -43
- package/kits/schemas/contact-book.schema.3.json +67 -67
- package/kits/schemas/daemon.schema.1.json +91 -91
- package/kits/schemas/daemon.schema.2.json +101 -101
- package/kits/schemas/daemon.schema.3.json +123 -123
- package/kits/schemas/daemon.schema.4.json +136 -136
- package/kits/schemas/daemon.schema.5.json +135 -135
- package/kits/schemas/daemon.schema.6.json +131 -131
- package/kits/schemas/defaults.schema.1.json +81 -81
- package/kits/schemas/defaults.schema.2.json +85 -85
- package/kits/schemas/defaults.schema.3.json +73 -73
- package/kits/schemas/defaults.schema.4.json +107 -107
- package/kits/schemas/defaults.schema.5.json +119 -119
- package/kits/schemas/menu-exec-schema-commands.md +208 -208
- package/kits/schemas/migrations/README.md +30 -30
- package/kits/schemas/relation-config.schema.1.json +158 -158
- package/kits/schemas/relation-config.schema.2.json +73 -73
- package/kits/schemas/relation-config.schema.3.json +50 -50
- package/kits/schemas/relation-config.schema.4.json +47 -47
- package/kits/schemas/relation-config.schema.5.json +47 -47
- package/kits/schemas/relation-config.schema.6.json +46 -46
- package/kits/schemas/relation-config.schema.7.json +59 -59
- package/kits/schemas/relation-config.schema.8.json +103 -103
- package/kits/schemas/role-config.schema.1.json +201 -201
- package/kits/schemas/role-registry.schema.1.json +35 -35
- package/kits/schemas/single-session.schema.1.json +31 -31
- package/kits/schemas/single-session.schema.2.json +57 -57
- package/kits/schemas/single-session.schema.3.json +32 -32
- package/kits/templates/bootstrap-welcome.md +17 -17
- package/kits/templates/message-fragments/handoff-context-to-target.md +9 -9
- package/kits/templates/message-fragments/handoff-request-to-target.md +19 -19
- package/kits/templates/message-fragments/handoff-response-to-origin.md +9 -9
- package/kits/templates/message-fragments/inject-default.md +2 -2
- package/kits/templates/message-fragments/item.md +2 -2
- package/kits/templates/roles/admin.json +92 -92
- package/kits/templates/roles/member.json +96 -96
- package/kits/templates/roles/owner.json +9 -9
- package/kits/templates/roles/visitor.json +85 -85
- package/kits/templates/system-fragments/baseagent.md +14 -14
- package/kits/templates/system-fragments/bootstrap.md +31 -29
- package/kits/templates/system-fragments/channel.md +64 -64
- package/kits/templates/system-fragments/commands.md +28 -28
- package/kits/templates/system-fragments/identity.md +13 -13
- package/kits/templates/system-fragments/relation.md +19 -19
- package/kits/templates/system-fragments/session.md +59 -59
- package/kits/templates/system-fragments/venue.md +31 -31
- package/package.json +100 -98
package/dist/cli/diag.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ipcQuery } from '../ipc.js';
|
|
2
|
+
import { resolvePaths } from '../paths.js';
|
|
3
|
+
import { AGENT_DELEGATION_TOKEN_ENV } from '../core/auth/agent-delegation.js';
|
|
4
|
+
import { parseDiagArgs } from '../core/command/diag-service.js';
|
|
5
|
+
import { wantsHelp } from './help.js';
|
|
6
|
+
export async function cmdDiag(args) {
|
|
7
|
+
if (wantsHelp(args)) {
|
|
8
|
+
console.log('用法:ec diag <问题描述> [--owner <daemonOwner-aid>] [--format json]\n ec diag stop [--format json]\n未指定 --owner 时联系本机 daemon.json.owners[0]。');
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
const json = args.at(-2) === '--format' && args.at(-1) === 'json';
|
|
12
|
+
const argv = json ? args.slice(0, -2) : args;
|
|
13
|
+
let result;
|
|
14
|
+
try {
|
|
15
|
+
parseDiagArgs(argv);
|
|
16
|
+
result = await ipcQuery(resolvePaths().socket, {
|
|
17
|
+
type: 'diag', argv,
|
|
18
|
+
...(process.env.EVOLCORE_SESSION_ID ? {
|
|
19
|
+
sessionId: process.env.EVOLCORE_SESSION_ID,
|
|
20
|
+
delegationToken: process.env[AGENT_DELEGATION_TOKEN_ENV],
|
|
21
|
+
} : {}),
|
|
22
|
+
}, 30_000) ?? { ok: false, code: 'DAEMON_UNAVAILABLE', message: 'daemon 未返回结果,请检查其运行状态;发送结果尚未确认' };
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
result = { ok: false, code: 'INVALID_ARGUMENT', message: error.message };
|
|
26
|
+
}
|
|
27
|
+
result.message ??= result.error ?? '诊断请求未完成';
|
|
28
|
+
console.log(json ? JSON.stringify(result, null, 2) : result.message);
|
|
29
|
+
if (!result.ok)
|
|
30
|
+
process.exitCode = 1;
|
|
31
|
+
}
|
package/dist/cli/fs-command.js
CHANGED
|
@@ -19,73 +19,73 @@ class FsCliError extends Error {
|
|
|
19
19
|
this.details = details;
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
const HELP = `用法: ec fs <command> [args...] [options]
|
|
23
|
-
|
|
24
|
-
Commands:
|
|
25
|
-
ls <AID>:<path> 列目录
|
|
26
|
-
stat [-L] <AID>:<path> 查看节点元数据(默认不跟随软链;-L 跟随)
|
|
27
|
-
lstat <AID>:<path> 查看节点本身(不跟随末级软链)
|
|
28
|
-
cat <AID>:<path> 输出文本文件内容;二进制/大文件返回头部摘要
|
|
29
|
-
cp <local> <AID>:<path> 上传本地文件
|
|
30
|
-
cp <AID>:<path> <local> 下载远程文件
|
|
31
|
-
cp <AID>:<path> <AID>:<path> 远程复制(同后端)
|
|
32
|
-
mv <AID>:<path> <AID>:<path> 移动/改名(同后端)
|
|
33
|
-
rm [-r] <AID>:<path> 删除文件或目录
|
|
34
|
-
mkdir [-p] <AID>:<path> 创建目录
|
|
35
|
-
ln -s <target> <AID>:<path> 创建软链(personal storage)
|
|
36
|
-
chmod [mode] <AID>:<path> 切换公开/私有(personal storage)
|
|
37
|
-
setfacl <AID>:<path> -m|-x ... 设置/移除 ACL(群路径使用 role:member|role:admin)
|
|
38
|
-
getfacl <AID>:<path> 查看 ACL
|
|
39
|
-
token issue|revoke|ls <path> 管理访问 token(personal storage)
|
|
40
|
-
find <AID>:<path> [filters] 查找节点
|
|
41
|
-
df <AID>: 查看容量/配额
|
|
42
|
-
mount <target> --volume <id> 挂载实体卷
|
|
43
|
-
mount <target> --source <src> 挂载远程子树
|
|
44
|
-
approve <AID>:<path> 批准待审挂载(personal storage)
|
|
45
|
-
reject <AID>:<path> 拒绝待审挂载(personal storage)
|
|
46
|
-
umount <AID>:<path> 卸载挂载点
|
|
47
|
-
|
|
48
|
-
Options:
|
|
49
|
-
--as <aid> 操作者 AID;也可由 EVOLCORE_SELF_AID 注入
|
|
50
|
-
--format json 输出 JSON
|
|
51
|
-
--overwrite, --force 覆盖目标(用于 cp/mv/ln)或强制删除(用于 rm)
|
|
52
|
-
-r, --recursive 递归(用于 rm/cp)
|
|
53
|
-
-p, --parents 自动创建父目录(用于 mkdir/group 上传)
|
|
54
|
-
-L, --follow stat 跟随末级软链
|
|
55
|
-
--token <token> 读取时携带访问 token(personal storage)
|
|
56
|
-
--content-type <mime> 上传时指定内容类型
|
|
57
|
-
--public 上传后公开可读(personal storage)
|
|
58
|
-
--visibility <public|private> chmod 可见性
|
|
59
|
-
--allow-roles <roles> chmod 角色约束,逗号分隔
|
|
60
|
-
-m aid:<aid>:<perms> setfacl 新增/更新 ACL
|
|
61
|
-
-x aid:<aid> setfacl 移除 ACL
|
|
62
|
-
--source <AID>:<path> mount 虚拟卷来源
|
|
63
|
-
--volume <id> mount 实体卷 ID
|
|
64
|
-
--require-approval mount 需要来源 owner 审批
|
|
65
|
-
--expires <time> mount/token/ACL 过期时间,Unix 秒或 ISO 日期
|
|
66
|
-
--max-uses <n> ACL 最大使用次数
|
|
67
|
-
--max-reads <n> token 最大读取次数
|
|
68
|
-
--readonly, --readwrite mount 只读/读写
|
|
69
|
-
--name <glob> find 名称过滤
|
|
70
|
-
--type <f|d|l> find 类型过滤
|
|
71
|
-
--size <expr> find 大小过滤,如 +1M
|
|
72
|
-
--mtime <expr> find 修改时间过滤
|
|
73
|
-
--head-bytes <n> cat 二进制头部字节数,默认 256
|
|
74
|
-
--max-bytes <n> cat 最大直接输出字节数,默认 1048576
|
|
75
|
-
--aun-path <path> 指定 AUN keystore 根
|
|
76
|
-
--app <name> 指定 AUN app slot
|
|
77
|
-
|
|
78
|
-
示例:
|
|
79
|
-
ec fs ls alice.agentid.pub:/private/
|
|
80
|
-
ec fs cp ./report.md alice.agentid.pub:/private/report.md --as alice.agentid.pub
|
|
81
|
-
ec fs cp alice.agentid.pub:/private/report.md ./report.md --as alice.agentid.pub
|
|
82
|
-
ec fs cp alice.agentid.pub:/private/a.md bob.agentid.pub:/inbox/a.md --as alice.agentid.pub
|
|
83
|
-
ec fs cat alice.agentid.pub:/private/report.md --as alice.agentid.pub
|
|
84
|
-
ec fs ln -s alice.agentid.pub:/private/report.md alice.agentid.pub:/public/report.md --as alice.agentid.pub
|
|
85
|
-
ec fs chmod +r alice.agentid.pub:/public/report.md --as alice.agentid.pub
|
|
86
|
-
ec fs setfacl alice.agentid.pub:/private/report.md -m aid:bob.agentid.pub:r --as alice.agentid.pub
|
|
87
|
-
ec fs token issue alice.agentid.pub:/public/report.md --expires 2026-12-31 --as alice.agentid.pub
|
|
88
|
-
ec fs find alice.agentid.pub:/private/ --name "*.md" --as alice.agentid.pub
|
|
22
|
+
const HELP = `用法: ec fs <command> [args...] [options]
|
|
23
|
+
|
|
24
|
+
Commands:
|
|
25
|
+
ls <AID>:<path> 列目录
|
|
26
|
+
stat [-L] <AID>:<path> 查看节点元数据(默认不跟随软链;-L 跟随)
|
|
27
|
+
lstat <AID>:<path> 查看节点本身(不跟随末级软链)
|
|
28
|
+
cat <AID>:<path> 输出文本文件内容;二进制/大文件返回头部摘要
|
|
29
|
+
cp <local> <AID>:<path> 上传本地文件
|
|
30
|
+
cp <AID>:<path> <local> 下载远程文件
|
|
31
|
+
cp <AID>:<path> <AID>:<path> 远程复制(同后端)
|
|
32
|
+
mv <AID>:<path> <AID>:<path> 移动/改名(同后端)
|
|
33
|
+
rm [-r] <AID>:<path> 删除文件或目录
|
|
34
|
+
mkdir [-p] <AID>:<path> 创建目录
|
|
35
|
+
ln -s <target> <AID>:<path> 创建软链(personal storage)
|
|
36
|
+
chmod [mode] <AID>:<path> 切换公开/私有(personal storage)
|
|
37
|
+
setfacl <AID>:<path> -m|-x ... 设置/移除 ACL(群路径使用 role:member|role:admin)
|
|
38
|
+
getfacl <AID>:<path> 查看 ACL
|
|
39
|
+
token issue|revoke|ls <path> 管理访问 token(personal storage)
|
|
40
|
+
find <AID>:<path> [filters] 查找节点
|
|
41
|
+
df <AID>: 查看容量/配额
|
|
42
|
+
mount <target> --volume <id> 挂载实体卷
|
|
43
|
+
mount <target> --source <src> 挂载远程子树
|
|
44
|
+
approve <AID>:<path> 批准待审挂载(personal storage)
|
|
45
|
+
reject <AID>:<path> 拒绝待审挂载(personal storage)
|
|
46
|
+
umount <AID>:<path> 卸载挂载点
|
|
47
|
+
|
|
48
|
+
Options:
|
|
49
|
+
--as <aid> 操作者 AID;也可由 EVOLCORE_SELF_AID 注入
|
|
50
|
+
--format json 输出 JSON
|
|
51
|
+
--overwrite, --force 覆盖目标(用于 cp/mv/ln)或强制删除(用于 rm)
|
|
52
|
+
-r, --recursive 递归(用于 rm/cp)
|
|
53
|
+
-p, --parents 自动创建父目录(用于 mkdir/group 上传)
|
|
54
|
+
-L, --follow stat 跟随末级软链
|
|
55
|
+
--token <token> 读取时携带访问 token(personal storage)
|
|
56
|
+
--content-type <mime> 上传时指定内容类型
|
|
57
|
+
--public 上传后公开可读(personal storage)
|
|
58
|
+
--visibility <public|private> chmod 可见性
|
|
59
|
+
--allow-roles <roles> chmod 角色约束,逗号分隔
|
|
60
|
+
-m aid:<aid>:<perms> setfacl 新增/更新 ACL
|
|
61
|
+
-x aid:<aid> setfacl 移除 ACL
|
|
62
|
+
--source <AID>:<path> mount 虚拟卷来源
|
|
63
|
+
--volume <id> mount 实体卷 ID
|
|
64
|
+
--require-approval mount 需要来源 owner 审批
|
|
65
|
+
--expires <time> mount/token/ACL 过期时间,Unix 秒或 ISO 日期
|
|
66
|
+
--max-uses <n> ACL 最大使用次数
|
|
67
|
+
--max-reads <n> token 最大读取次数
|
|
68
|
+
--readonly, --readwrite mount 只读/读写
|
|
69
|
+
--name <glob> find 名称过滤
|
|
70
|
+
--type <f|d|l> find 类型过滤
|
|
71
|
+
--size <expr> find 大小过滤,如 +1M
|
|
72
|
+
--mtime <expr> find 修改时间过滤
|
|
73
|
+
--head-bytes <n> cat 二进制头部字节数,默认 256
|
|
74
|
+
--max-bytes <n> cat 最大直接输出字节数,默认 1048576
|
|
75
|
+
--aun-path <path> 指定 AUN keystore 根
|
|
76
|
+
--app <name> 指定 AUN app slot
|
|
77
|
+
|
|
78
|
+
示例:
|
|
79
|
+
ec fs ls alice.agentid.pub:/private/
|
|
80
|
+
ec fs cp ./report.md alice.agentid.pub:/private/report.md --as alice.agentid.pub
|
|
81
|
+
ec fs cp alice.agentid.pub:/private/report.md ./report.md --as alice.agentid.pub
|
|
82
|
+
ec fs cp alice.agentid.pub:/private/a.md bob.agentid.pub:/inbox/a.md --as alice.agentid.pub
|
|
83
|
+
ec fs cat alice.agentid.pub:/private/report.md --as alice.agentid.pub
|
|
84
|
+
ec fs ln -s alice.agentid.pub:/private/report.md alice.agentid.pub:/public/report.md --as alice.agentid.pub
|
|
85
|
+
ec fs chmod +r alice.agentid.pub:/public/report.md --as alice.agentid.pub
|
|
86
|
+
ec fs setfacl alice.agentid.pub:/private/report.md -m aid:bob.agentid.pub:r --as alice.agentid.pub
|
|
87
|
+
ec fs token issue alice.agentid.pub:/public/report.md --expires 2026-12-31 --as alice.agentid.pub
|
|
88
|
+
ec fs find alice.agentid.pub:/private/ --name "*.md" --as alice.agentid.pub
|
|
89
89
|
ec fs df alice.agentid.pub: --as alice.agentid.pub`;
|
|
90
90
|
const VALUE_FLAGS = new Set([
|
|
91
91
|
'--as',
|
|
@@ -106,13 +106,13 @@ export function parseReturn(args) {
|
|
|
106
106
|
function printReturn(result) {
|
|
107
107
|
if (result.ok) {
|
|
108
108
|
if (result.code === 'HANDOFF_RETURN_ALREADY_APPLIED') {
|
|
109
|
-
console.log(`✓ handoff ${result.handoff_id}
|
|
109
|
+
console.log(`✓ handoff ${result.handoff_id} 已接收过相同结果,未重复处理${result.result_id ? ` result_id=${result.result_id}` : ''}`);
|
|
110
110
|
}
|
|
111
111
|
else if (result.state === 'completed') {
|
|
112
112
|
console.log(`✓ handoff ${result.handoff_id} 已确认完成,不回流来源会话`);
|
|
113
113
|
}
|
|
114
114
|
else {
|
|
115
|
-
console.log(`✓ handoff ${result.handoff_id}
|
|
115
|
+
console.log(`✓ handoff ${result.handoff_id} 回流结果已接收${result.result_id ? ` result_id=${result.result_id}` : ''};后续仍可用同一 ID 追加结果`);
|
|
116
116
|
}
|
|
117
117
|
return;
|
|
118
118
|
}
|
|
@@ -153,13 +153,15 @@ function formatTimestamp(value) {
|
|
|
153
153
|
export async function cmdHandoff(args) {
|
|
154
154
|
const sub = args[0];
|
|
155
155
|
if (!sub || isHelpFlag(sub) || wantsHelp(args)) {
|
|
156
|
-
console.log(`用法: ec handoff <command> [args]
|
|
157
|
-
|
|
158
|
-
Commands:
|
|
159
|
-
return [handoff-id] [content]
|
|
160
|
-
return [handoff-id] --text-from-file <path>
|
|
161
|
-
|
|
162
|
-
|
|
156
|
+
console.log(`用法: ec handoff <command> [args]
|
|
157
|
+
|
|
158
|
+
Commands:
|
|
159
|
+
return [handoff-id] [content] 提交一个回流结果;required 可用同一 ID 追加多个结果
|
|
160
|
+
return [handoff-id] --text-from-file <path>
|
|
161
|
+
recover-return <handoff-id> [content] owner-authorized recovery after target session replacement
|
|
162
|
+
recover-return <handoff-id> --text-from-file <path>
|
|
163
|
+
status <handoff-id> 查询 handoff 状态
|
|
164
|
+
list [--state <state>] [--session <id>] [--limit <n>] [--agent <aid>]
|
|
163
165
|
trace <handoff-id> [--limit <n>] [--agent <aid>]`);
|
|
164
166
|
return;
|
|
165
167
|
}
|
|
@@ -194,6 +196,36 @@ Commands:
|
|
|
194
196
|
printReturn(result);
|
|
195
197
|
return;
|
|
196
198
|
}
|
|
199
|
+
if (sub === 'recover-return') {
|
|
200
|
+
let parsed;
|
|
201
|
+
try {
|
|
202
|
+
parsed = parseReturn(args.slice(1));
|
|
203
|
+
}
|
|
204
|
+
catch (error) {
|
|
205
|
+
console.error(`✗ ${error instanceof Error ? error.message : String(error)}`);
|
|
206
|
+
process.exitCode = 1;
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
if (!parsed.handoffId) {
|
|
210
|
+
console.error('✗ recover-return 必须指定 handoff ID');
|
|
211
|
+
process.exitCode = 1;
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
const result = await ipcQuery(resolvePaths().socket, {
|
|
215
|
+
type: 'handoff-recover-return',
|
|
216
|
+
sessionId: process.env.EVOLCORE_SESSION_ID,
|
|
217
|
+
handoffId: parsed.handoffId,
|
|
218
|
+
content: parsed.content,
|
|
219
|
+
delegationToken: process.env[AGENT_DELEGATION_TOKEN_ENV],
|
|
220
|
+
}, 5000);
|
|
221
|
+
if (!result) {
|
|
222
|
+
console.error('✗ daemon 暂时不可用');
|
|
223
|
+
process.exitCode = 1;
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
printReturn(result);
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
197
229
|
if (sub === 'status') {
|
|
198
230
|
const handoffId = args[1];
|
|
199
231
|
if (!handoffId || !HANDOFF_ID_RE.test(handoffId)) {
|
package/dist/cli/index.js
CHANGED
|
@@ -19,57 +19,58 @@ import { cmdStart, cmdStop, cmdRestart, cmdStatus, cmdLogs, cmdWatchCommand, cmd
|
|
|
19
19
|
import { logCliCommand } from './command-log.js';
|
|
20
20
|
import { isInitCancelledError, printInitCancelHint } from './init-cancel.js';
|
|
21
21
|
import { assertManagedTopLevelCommandAllowed, ManagedCommandNotAllowedError } from './managed-command-guard.js';
|
|
22
|
-
const MAIN_HELP = `用法: ec <command> [选项]
|
|
23
|
-
|
|
24
|
-
服务:
|
|
25
|
-
init 初始化默认配置、owner、控制 AID 与 EC Web
|
|
26
|
-
start 启动服务
|
|
27
|
-
stop 停止服务
|
|
28
|
-
restart 重启服务并检查更新
|
|
29
|
-
status 查看运行状态
|
|
30
|
-
logs 持续查看 daemon 日志
|
|
31
|
-
watch 打开日志、AID、消息或 EC Web 监控
|
|
32
|
-
|
|
33
|
-
Agent 与会话:
|
|
34
|
-
agent 管理 EvolAgent
|
|
35
|
-
ctl 当前托管会话的控制命令
|
|
36
|
-
queue 查询或操作 agent 消息队列
|
|
37
|
-
trigger 管理定时与事件触发器
|
|
38
|
-
handoff 查询和完成跨会话回流
|
|
39
|
-
model 查看或设置模型与推理强度
|
|
40
|
-
response 查看或设置响应模式
|
|
41
|
-
|
|
42
|
-
AUN:
|
|
43
|
-
aid 管理 AID 身份与 agent.md
|
|
44
|
-
msg 私聊消息收发、撤回、在线状态与历史
|
|
45
|
-
group 群消息与群管理
|
|
46
|
-
fs AUN 文件系统
|
|
47
|
-
storage 底层对象存储命令
|
|
48
|
-
rpc 调用底层 AUN RPC
|
|
49
|
-
menu-client 向远程 daemon 发送标准 Menu 请求
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
22
|
+
const MAIN_HELP = `用法: ec <command> [选项]
|
|
23
|
+
|
|
24
|
+
服务:
|
|
25
|
+
init 初始化默认配置、owner、控制 AID 与 EC Web
|
|
26
|
+
start 启动服务
|
|
27
|
+
stop 停止服务
|
|
28
|
+
restart 重启服务并检查更新
|
|
29
|
+
status 查看运行状态
|
|
30
|
+
logs 持续查看 daemon 日志
|
|
31
|
+
watch 打开日志、AID、消息或 EC Web 监控
|
|
32
|
+
|
|
33
|
+
Agent 与会话:
|
|
34
|
+
agent 管理 EvolAgent
|
|
35
|
+
ctl 当前托管会话的控制命令
|
|
36
|
+
queue 查询或操作 agent 消息队列
|
|
37
|
+
trigger 管理定时与事件触发器
|
|
38
|
+
handoff 查询和完成跨会话回流
|
|
39
|
+
model 查看或设置模型与推理强度
|
|
40
|
+
response 查看或设置响应模式
|
|
41
|
+
|
|
42
|
+
AUN:
|
|
43
|
+
aid 管理 AID 身份与 agent.md
|
|
44
|
+
msg 私聊消息收发、撤回、在线状态与历史
|
|
45
|
+
group 群消息与群管理
|
|
46
|
+
fs AUN 文件系统
|
|
47
|
+
storage 底层对象存储命令
|
|
48
|
+
rpc 调用底层 AUN RPC
|
|
49
|
+
menu-client 向远程 daemon 发送标准 Menu 请求
|
|
50
|
+
diag 邀请远程诊断 Agent,或 stop 撤销诊断授权
|
|
51
|
+
contact 联系人、待审申请与黑名单管理
|
|
52
|
+
net AUN 网络链路诊断
|
|
53
|
+
|
|
54
|
+
配置与诊断:
|
|
55
|
+
config 读取、修改和检查分层配置
|
|
56
|
+
stats Token 用量与费用统计
|
|
57
|
+
diagnose 检查启动环境
|
|
58
|
+
version 显示组件版本
|
|
59
|
+
mv 迁移项目目录和会话路径
|
|
60
|
+
|
|
61
|
+
维护命令:
|
|
62
|
+
data migrate 迁移 per-Agent 用户数据(显式维护窗口)
|
|
63
|
+
mode 切换开发源码与 npm 包运行模式
|
|
64
|
+
restart-monitor 运行 daemon 重启监控器
|
|
65
|
+
bench AUN 消息性能基准测试
|
|
66
|
+
link-rules 连接 ECK rules 到项目目录
|
|
67
|
+
|
|
68
|
+
运行 ec <command> --help 查看该命令的完整参数。
|
|
69
|
+
|
|
70
|
+
环境变量:
|
|
71
|
+
EVOLCORE_HOME 数据目录(默认: ~/.evolcore)
|
|
72
|
+
LOG_LEVEL 日志级别(默认: INFO)
|
|
73
|
+
MESSAGE_LOG 消息日志(默认: true)
|
|
73
74
|
EVENT_LOG 事件日志(默认: true)`;
|
|
74
75
|
function printLifecycleHelp(command) {
|
|
75
76
|
const help = {
|
|
@@ -115,32 +116,32 @@ export async function main(args) {
|
|
|
115
116
|
case 'init': {
|
|
116
117
|
try {
|
|
117
118
|
if (wantsHelp(args.slice(1))) {
|
|
118
|
-
console.log(`用法: ec init [渠道] [选项]
|
|
119
|
-
|
|
120
|
-
仅初始化 defaults.json:
|
|
121
|
-
ec init 交互式(写完 defaults.json 后嵌套 agent new)
|
|
122
|
-
选择 ecagent 时会继续询问 API Key 和 Base URL
|
|
123
|
-
ec init --non-interactive [选项]
|
|
124
|
-
--baseagent <claude|codex|gemini|ecagent> 默认: PATH 中第一个可用项;ecagent 需显式选择
|
|
125
|
-
--force 已存在 defaults.json 时覆盖
|
|
126
|
-
|
|
127
|
-
云部署非交互式初始化(结构化 JSON 输出):
|
|
128
|
-
ec init --non-interactive --owner <aid> [--format json] [选项]
|
|
129
|
-
--owner <aid> 必填。唯一 daemon owner AID
|
|
130
|
-
--baseagent <claude|codex|gemini|ecagent> 可选。默认从 PATH 检测,ecagent 需显式选择
|
|
131
|
-
--projectpath <abs-path> 可选。默认项目目录(必须绝对路径,自动创建)
|
|
132
|
-
--ecweb 可选。安装 EC Web 并启用自启动
|
|
133
|
-
--auto-start Windows/macOS 上启用 EvolCore 登录自启动
|
|
134
|
-
--no-auto-start Windows/macOS 上禁用 EvolCore 登录自启动
|
|
135
|
-
--format json 可选但推荐。stdout 输出 init.result JSON
|
|
136
|
-
--force 已有不同 owner 时强制覆盖
|
|
137
|
-
|
|
138
|
-
配置渠道(先 ec agent new 创建 agent):
|
|
139
|
-
ec init aun AUN owner 追加绑定(daemon 或指定 agent)
|
|
140
|
-
ec init feishu 飞书扫码登录
|
|
141
|
-
ec init wechat 微信扫码登录
|
|
142
|
-
ec init dingtalk 钉钉扫码登录
|
|
143
|
-
ec init qqbot QQ 机器人扫码绑定
|
|
119
|
+
console.log(`用法: ec init [渠道] [选项]
|
|
120
|
+
|
|
121
|
+
仅初始化 defaults.json:
|
|
122
|
+
ec init 交互式(写完 defaults.json 后嵌套 agent new)
|
|
123
|
+
选择 ecagent 时会继续询问 API Key 和 Base URL
|
|
124
|
+
ec init --non-interactive [选项]
|
|
125
|
+
--baseagent <claude|codex|gemini|ecagent> 默认: PATH 中第一个可用项;ecagent 需显式选择
|
|
126
|
+
--force 已存在 defaults.json 时覆盖
|
|
127
|
+
|
|
128
|
+
云部署非交互式初始化(结构化 JSON 输出):
|
|
129
|
+
ec init --non-interactive --owner <aid> [--format json] [选项]
|
|
130
|
+
--owner <aid> 必填。唯一 daemon owner AID
|
|
131
|
+
--baseagent <claude|codex|gemini|ecagent> 可选。默认从 PATH 检测,ecagent 需显式选择
|
|
132
|
+
--projectpath <abs-path> 可选。默认项目目录(必须绝对路径,自动创建)
|
|
133
|
+
--ecweb 可选。安装 EC Web 并启用自启动
|
|
134
|
+
--auto-start Windows/macOS 上启用 EvolCore 登录自启动
|
|
135
|
+
--no-auto-start Windows/macOS 上禁用 EvolCore 登录自启动
|
|
136
|
+
--format json 可选但推荐。stdout 输出 init.result JSON
|
|
137
|
+
--force 已有不同 owner 时强制覆盖
|
|
138
|
+
|
|
139
|
+
配置渠道(先 ec agent new 创建 agent):
|
|
140
|
+
ec init aun AUN owner 追加绑定(daemon 或指定 agent)
|
|
141
|
+
ec init feishu 飞书扫码登录
|
|
142
|
+
ec init wechat 微信扫码登录
|
|
143
|
+
ec init dingtalk 钉钉扫码登录
|
|
144
|
+
ec init qqbot QQ 机器人扫码绑定
|
|
144
145
|
ec init wecom 企业微信 AI Bot 扫码创建/手工配置`);
|
|
145
146
|
}
|
|
146
147
|
else {
|
|
@@ -351,6 +352,11 @@ export async function main(args) {
|
|
|
351
352
|
await cmdRpc(args.slice(1));
|
|
352
353
|
break;
|
|
353
354
|
}
|
|
355
|
+
case 'diag': {
|
|
356
|
+
const { cmdDiag } = await import('./diag.js');
|
|
357
|
+
await cmdDiag(args.slice(1));
|
|
358
|
+
break;
|
|
359
|
+
}
|
|
354
360
|
case 'menu-client': {
|
|
355
361
|
const { suppressSdkLogs } = await import('../aun/aid/index.js');
|
|
356
362
|
suppressSdkLogs();
|
package/dist/cli/link-rules.js
CHANGED
|
@@ -79,27 +79,27 @@ function cleanEmptyParents(dir) {
|
|
|
79
79
|
}
|
|
80
80
|
// ── 子命令 ──
|
|
81
81
|
function showHelp() {
|
|
82
|
-
console.log(`Usage: ec link-rules <subcommand> [baseagent] [--dir <path>]
|
|
83
|
-
|
|
84
|
-
Subcommands:
|
|
85
|
-
connect Connect ECK rules to a project directory (default: cwd)
|
|
86
|
-
disconnect Remove ECK rules connection for a baseagent
|
|
87
|
-
status Show connection state for all baseagents
|
|
88
|
-
|
|
89
|
-
Arguments:
|
|
90
|
-
baseagent Target base agent: ${KNOWN_BASEAGENTS.join(', ')} (default: cc)
|
|
91
|
-
--dir <path> Target directory (default: current working directory)
|
|
92
|
-
|
|
93
|
-
Supported baseagents:
|
|
94
|
-
cc Claude Code (.claude/rules/eck/)
|
|
95
|
-
codex Codex (.codex/rules/eck/)
|
|
96
|
-
gemini Gemini CLI (.gemini/rules/eck/)
|
|
97
|
-
|
|
98
|
-
Examples:
|
|
99
|
-
ec link-rules connect # connect cc in cwd
|
|
100
|
-
ec link-rules connect codex # connect codex in cwd
|
|
101
|
-
ec link-rules connect cc --dir /x # connect cc in specific dir
|
|
102
|
-
ec link-rules disconnect cc # disconnect cc
|
|
82
|
+
console.log(`Usage: ec link-rules <subcommand> [baseagent] [--dir <path>]
|
|
83
|
+
|
|
84
|
+
Subcommands:
|
|
85
|
+
connect Connect ECK rules to a project directory (default: cwd)
|
|
86
|
+
disconnect Remove ECK rules connection for a baseagent
|
|
87
|
+
status Show connection state for all baseagents
|
|
88
|
+
|
|
89
|
+
Arguments:
|
|
90
|
+
baseagent Target base agent: ${KNOWN_BASEAGENTS.join(', ')} (default: cc)
|
|
91
|
+
--dir <path> Target directory (default: current working directory)
|
|
92
|
+
|
|
93
|
+
Supported baseagents:
|
|
94
|
+
cc Claude Code (.claude/rules/eck/)
|
|
95
|
+
codex Codex (.codex/rules/eck/)
|
|
96
|
+
gemini Gemini CLI (.gemini/rules/eck/)
|
|
97
|
+
|
|
98
|
+
Examples:
|
|
99
|
+
ec link-rules connect # connect cc in cwd
|
|
100
|
+
ec link-rules connect codex # connect codex in cwd
|
|
101
|
+
ec link-rules connect cc --dir /x # connect cc in specific dir
|
|
102
|
+
ec link-rules disconnect cc # disconnect cc
|
|
103
103
|
ec link-rules status # show all connections`);
|
|
104
104
|
}
|
|
105
105
|
function showStatus() {
|
package/dist/cli/menu-client.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import { getArgValue, wantsHelp } from './help.js';
|
|
3
3
|
import { executeMenuClientRequest, MenuClientError } from '../aun/menu-client.js';
|
|
4
|
+
import { AGENT_DELEGATION_TOKEN_ENV } from '../core/auth/agent-delegation.js';
|
|
4
5
|
function parseDurationMs(value) {
|
|
5
6
|
if (value === undefined)
|
|
6
7
|
return undefined;
|
|
@@ -11,14 +12,14 @@ function parseDurationMs(value) {
|
|
|
11
12
|
const unit = match[2].toLowerCase();
|
|
12
13
|
return amount * (unit === 'ms' ? 1 : unit === 's' ? 1_000 : unit === 'm' ? 60_000 : 3_600_000);
|
|
13
14
|
}
|
|
14
|
-
function readRequest(args) {
|
|
15
|
+
function readRequest(args, readFile = (file) => fs.readFileSync(file, 'utf8')) {
|
|
15
16
|
const file = getArgValue(args, '--request-file');
|
|
16
17
|
const inline = getArgValue(args, '--request-json');
|
|
17
18
|
if (!!file === !!inline)
|
|
18
19
|
throw new MenuClientError('INVALID_ARGUMENT', '--request-file and --request-json are mutually exclusive');
|
|
19
20
|
let raw;
|
|
20
21
|
try {
|
|
21
|
-
raw = file ?
|
|
22
|
+
raw = file ? readFile(file) : inline;
|
|
22
23
|
}
|
|
23
24
|
catch (error) {
|
|
24
25
|
throw new MenuClientError('INVALID_ARGUMENT', `Unable to read request: ${error?.message ?? String(error)}`);
|
|
@@ -36,8 +37,12 @@ function readRequest(args) {
|
|
|
36
37
|
function validateOptions(args) {
|
|
37
38
|
const valueOptions = new Set(['--request-file', '--request-json', '--timeout', '--remote-token', '--ecweb-token', '--app', '--aun-path', '--format']);
|
|
38
39
|
const booleanOptions = new Set(['--encrypt', '--no-encrypt']);
|
|
40
|
+
const seen = new Set();
|
|
39
41
|
for (let index = 0; index < args.length; index += 1) {
|
|
40
42
|
const option = args[index];
|
|
43
|
+
if (seen.has(option))
|
|
44
|
+
throw new MenuClientError('INVALID_ARGUMENT', `Duplicate option: ${option}`);
|
|
45
|
+
seen.add(option);
|
|
41
46
|
if (booleanOptions.has(option))
|
|
42
47
|
continue;
|
|
43
48
|
if (!valueOptions.has(option))
|
|
@@ -54,22 +59,7 @@ function validateOptions(args) {
|
|
|
54
59
|
if (format !== undefined && format !== 'json')
|
|
55
60
|
throw new MenuClientError('INVALID_ARGUMENT', '--format currently supports only json');
|
|
56
61
|
}
|
|
57
|
-
export
|
|
58
|
-
if (wantsHelp(args)) {
|
|
59
|
-
console.log(`用法: ec menu-client request <from-aid> <daemon-aid> [选项]
|
|
60
|
-
|
|
61
|
-
--request-file <path> 从 JSON 文件读取一个 menu.* 请求
|
|
62
|
-
--request-json <json> 直接传入一个 menu.* JSON 请求
|
|
63
|
-
--timeout <时长> 默认 15s,最大 120s
|
|
64
|
-
--encrypt 使用 E2EE(默认)
|
|
65
|
-
--no-encrypt 已拒绝:ec-menu-client 必须使用 E2EE
|
|
66
|
-
--remote-token <token> 使用 daemon 远程访问 token 临时授权
|
|
67
|
-
--ecweb-token <token> --remote-token 的兼容别名
|
|
68
|
-
--app <slot> 覆盖默认 evolcore-menu-client 消费槽位
|
|
69
|
-
--aun-path <path> 覆盖本地 AUN keystore 根目录
|
|
70
|
-
--format json 输出标准 menu.response JSON`);
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
62
|
+
export function parseMenuClientArgs(args, readFile) {
|
|
73
63
|
if (args[0] !== 'request')
|
|
74
64
|
throw new MenuClientError('INVALID_ARGUMENT', 'menu-client currently supports only the request subcommand');
|
|
75
65
|
const fromAid = args[1]?.trim();
|
|
@@ -78,18 +68,43 @@ export async function cmdMenuClient(args) {
|
|
|
78
68
|
throw new MenuClientError('INVALID_ARGUMENT', 'request requires <from-aid> and <daemon-aid>');
|
|
79
69
|
const options = args.slice(3);
|
|
80
70
|
validateOptions(options);
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
71
|
+
return {
|
|
72
|
+
fromAid, targetAid, request: readRequest(options, readFile),
|
|
73
|
+
timeoutMs: parseDurationMs(getArgValue(options, '--timeout')),
|
|
74
|
+
encrypt: !options.includes('--no-encrypt'),
|
|
75
|
+
remoteAccessToken: getArgValue(options, '--remote-token') ?? getArgValue(options, '--ecweb-token'),
|
|
76
|
+
slotId: getArgValue(options, '--app'), aunPath: getArgValue(options, '--aun-path'),
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
export async function cmdMenuClient(args) {
|
|
80
|
+
if (wantsHelp(args)) {
|
|
81
|
+
console.log(`用法: ec menu-client request <from-aid> <daemon-aid> [选项]
|
|
82
|
+
|
|
83
|
+
--request-file <path> 从 JSON 文件读取一个 menu.* 请求
|
|
84
|
+
--request-json <json> 直接传入一个 menu.* JSON 请求
|
|
85
|
+
--timeout <时长> 默认 15s,最大 120s
|
|
86
|
+
--encrypt 使用 E2EE(默认)
|
|
87
|
+
--no-encrypt 已拒绝:ec-menu-client 必须使用 E2EE
|
|
88
|
+
--remote-token <token> 使用 daemon 远程访问 token 临时授权
|
|
89
|
+
--ecweb-token <token> --remote-token 的兼容别名
|
|
90
|
+
--app <slot> 覆盖默认 evolcore-menu-client 消费槽位
|
|
91
|
+
--aun-path <path> 覆盖本地 AUN keystore 根目录
|
|
92
|
+
--format json 输出标准 menu.response JSON`);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
let response;
|
|
96
|
+
if (process.env.EVOLCORE_SESSION_ID) {
|
|
97
|
+
const { ipcQuery } = await import('../ipc.js');
|
|
98
|
+
const { resolvePaths } = await import('../paths.js');
|
|
99
|
+
const result = await ipcQuery(resolvePaths().socket, {
|
|
100
|
+
type: 'menu-client.request', argv: args, sessionId: process.env.EVOLCORE_SESSION_ID,
|
|
101
|
+
delegationToken: process.env[AGENT_DELEGATION_TOKEN_ENV],
|
|
102
|
+
}, 250_000);
|
|
103
|
+
if (!result?.ok)
|
|
104
|
+
throw new MenuClientError(result?.code ?? 'DAEMON_UNAVAILABLE', result?.error ?? 'Managed Menu daemon is unavailable');
|
|
105
|
+
response = result.response;
|
|
106
|
+
}
|
|
107
|
+
else
|
|
108
|
+
response = await executeMenuClientRequest(parseMenuClientArgs(args));
|
|
94
109
|
console.log(JSON.stringify(response, null, 2));
|
|
95
110
|
}
|