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
|
@@ -37,39 +37,39 @@ export async function cmdAgent(args) {
|
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
39
|
if (!sub || isHelpFlag(sub) || (wantsHelp(args) && !commands.has(sub))) {
|
|
40
|
-
console.log(`用法: ec agent <command>
|
|
41
|
-
|
|
42
|
-
Commands:
|
|
43
|
-
list 列出所有 agent
|
|
44
|
-
show <aid> 查看 agent 详情(身份 + 配置 + 连接 + 会话 + 路径)
|
|
45
|
-
new [aid] 交互式创建 agent
|
|
46
|
-
new <aid> --non-interactive ... 非交互式创建
|
|
47
|
-
enable <aid> 启用 agent
|
|
48
|
-
disable <aid> 停用 agent
|
|
49
|
-
get <aid> <key> 读取单个配置字段(支持点路径)
|
|
40
|
+
console.log(`用法: ec agent <command>
|
|
41
|
+
|
|
42
|
+
Commands:
|
|
43
|
+
list 列出所有 agent
|
|
44
|
+
show <aid> 查看 agent 详情(身份 + 配置 + 连接 + 会话 + 路径)
|
|
45
|
+
new [aid] 交互式创建 agent
|
|
46
|
+
new <aid> --non-interactive ... 非交互式创建
|
|
47
|
+
enable <aid> 启用 agent
|
|
48
|
+
disable <aid> 停用 agent
|
|
49
|
+
get <aid> <key> 读取单个配置字段(支持点路径)
|
|
50
50
|
set <aid> <key> <val> 修改单个配置字段(支持点路径)
|
|
51
51
|
persona show 查看当前 Agent 的 persona.md
|
|
52
52
|
persona --text <text> 用文本设置当前 Agent 的 persona.md
|
|
53
53
|
persona --file <path> 用 .md/.txt 文件设置当前 Agent 的 persona.md
|
|
54
|
-
rename <aid> <name> 修改 agent.md 中的显示名称
|
|
55
|
-
ready <aid> 标记 bootstrap 完成,进入 active 状态
|
|
56
|
-
reload [aid] 热重载配置(无参数=全量 resync)
|
|
57
|
-
delete <aid> [--purge] 删除 agent
|
|
58
|
-
|
|
59
|
-
Options:
|
|
60
|
-
--format json 输出 JSON 格式
|
|
61
|
-
--help, -h 各子命令均支持,查看详细用法
|
|
62
|
-
|
|
63
|
-
示例:
|
|
64
|
-
ec agent list
|
|
65
|
-
ec agent show mybot.agentid.pub
|
|
66
|
-
ec agent new mybot.agentid.pub
|
|
67
|
-
ec agent enable mybot.agentid.pub
|
|
68
|
-
ec agent get mybot.agentid.pub active_baseagent
|
|
54
|
+
rename <aid> <name> 修改 agent.md 中的显示名称
|
|
55
|
+
ready <aid> 标记 bootstrap 完成,进入 active 状态
|
|
56
|
+
reload [aid] 热重载配置(无参数=全量 resync)
|
|
57
|
+
delete <aid> [--purge] 删除 agent
|
|
58
|
+
|
|
59
|
+
Options:
|
|
60
|
+
--format json 输出 JSON 格式
|
|
61
|
+
--help, -h 各子命令均支持,查看详细用法
|
|
62
|
+
|
|
63
|
+
示例:
|
|
64
|
+
ec agent list
|
|
65
|
+
ec agent show mybot.agentid.pub
|
|
66
|
+
ec agent new mybot.agentid.pub
|
|
67
|
+
ec agent enable mybot.agentid.pub
|
|
68
|
+
ec agent get mybot.agentid.pub active_baseagent
|
|
69
69
|
ec agent set mybot.agentid.pub active_baseagent codex
|
|
70
70
|
ec agent persona --text "你是一名严谨的诊断工程师。"
|
|
71
|
-
ec agent rename mybot.agentid.pub "New Name"
|
|
72
|
-
ec agent ready mybot.agentid.pub
|
|
71
|
+
ec agent rename mybot.agentid.pub "New Name"
|
|
72
|
+
ec agent ready mybot.agentid.pub
|
|
73
73
|
ec agent delete mybot.agentid.pub --purge`);
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
@@ -137,8 +137,8 @@ Options:
|
|
|
137
137
|
// --- list ---
|
|
138
138
|
if (sub === 'list') {
|
|
139
139
|
if (wantsHelp(args)) {
|
|
140
|
-
console.log(`用法: ec agent list [--format json]
|
|
141
|
-
|
|
140
|
+
console.log(`用法: ec agent list [--format json]
|
|
141
|
+
|
|
142
142
|
列出所有 agent,显示名称、状态、渠道、项目、基座、最后活跃时间。`);
|
|
143
143
|
return;
|
|
144
144
|
}
|
|
@@ -208,27 +208,28 @@ Options:
|
|
|
208
208
|
// --- new ---
|
|
209
209
|
if (sub === 'new') {
|
|
210
210
|
if (wantsHelp(args)) {
|
|
211
|
-
console.log(`用法: ec agent new [aid] 交互式创建
|
|
212
|
-
ec agent new <aid> --non-interactive [选项]
|
|
213
|
-
|
|
214
|
-
非交互模式选项:
|
|
215
|
-
--project <path> 默认: 当前目录
|
|
216
|
-
--baseagent <claude|codex|gemini|ecagent>
|
|
217
|
-
默认: defaults 配置,否则检测本机可用基座
|
|
211
|
+
console.log(`用法: ec agent new [aid] 交互式创建
|
|
212
|
+
ec agent new <aid> --non-interactive [选项]
|
|
213
|
+
|
|
214
|
+
非交互模式选项:
|
|
215
|
+
--project <path> 默认: 当前目录
|
|
216
|
+
--baseagent <claude|codex|gemini|ecagent>
|
|
217
|
+
默认: defaults 配置,否则检测本机可用基座
|
|
218
218
|
--owner <aid> 默认: daemon.json 第一个 owner
|
|
219
219
|
--owners <json-array> 多个 Owner;与 --owner 互斥
|
|
220
220
|
--handoff <context> 当前任务的 Bootstrap 上下文
|
|
221
|
-
--name <display-name> 默认: package.json name,否则目录名
|
|
221
|
+
--name <display-name> 默认: package.json name,否则目录名
|
|
222
222
|
--description <text> 默认: package.json description,否则使用 EvolCore 默认描述
|
|
223
|
+
--type <type> 主体类型: human|agent|group|service|device|org(默认 agent)
|
|
223
224
|
--tags <json-array> 3 到 6 个标签,例如 '["coding","diagnostics","logs"]'
|
|
224
|
-
--dry-run 只预览最终参数,不注册 AID、不写文件
|
|
225
|
-
--force 覆盖已有 config.json
|
|
226
|
-
--format json 输出 JSON
|
|
227
|
-
|
|
228
|
-
示例:
|
|
229
|
-
ec agent new mybot.agentid.pub
|
|
230
|
-
ec agent new mybot.agentid.pub --non-interactive
|
|
231
|
-
ec agent new mybot.agentid.pub --non-interactive --dry-run --format json
|
|
225
|
+
--dry-run 只预览最终参数,不注册 AID、不写文件
|
|
226
|
+
--force 覆盖已有 config.json
|
|
227
|
+
--format json 输出 JSON
|
|
228
|
+
|
|
229
|
+
示例:
|
|
230
|
+
ec agent new mybot.agentid.pub
|
|
231
|
+
ec agent new mybot.agentid.pub --non-interactive
|
|
232
|
+
ec agent new mybot.agentid.pub --non-interactive --dry-run --format json
|
|
232
233
|
ec agent new mybot.agentid.pub --non-interactive --project ../project --baseagent claude`);
|
|
233
234
|
return;
|
|
234
235
|
}
|
|
@@ -286,6 +287,7 @@ Options:
|
|
|
286
287
|
handoff: getArg('--handoff'),
|
|
287
288
|
name: getArg('--name'),
|
|
288
289
|
description: getArg('--description'),
|
|
290
|
+
type: getArg('--type'),
|
|
289
291
|
tags,
|
|
290
292
|
force: args.includes('--force'),
|
|
291
293
|
});
|
|
@@ -324,6 +326,7 @@ Options:
|
|
|
324
326
|
owners: plan.owners,
|
|
325
327
|
name: plan.name,
|
|
326
328
|
description: plan.description,
|
|
329
|
+
type: plan.type,
|
|
327
330
|
tags: plan.tags,
|
|
328
331
|
force: args.includes('--force'),
|
|
329
332
|
});
|
|
@@ -351,6 +354,15 @@ Options:
|
|
|
351
354
|
: result.hotLoadError
|
|
352
355
|
? ` ✗ 热重载失败:${result.hotLoadError}`
|
|
353
356
|
: ' ⚠ 服务未运行,下次 ec start 时生效');
|
|
357
|
+
if (result.ownerContactsSynced?.length) {
|
|
358
|
+
console.log(` ✓ 已同步 Owner 联系人: ${result.ownerContactsSynced.join(', ')}`);
|
|
359
|
+
}
|
|
360
|
+
if (result.ownerContactsSkipped?.length) {
|
|
361
|
+
console.log(` ⚠ 无本地联系人簿,跳过 Owner: ${result.ownerContactsSkipped.join(', ')}`);
|
|
362
|
+
}
|
|
363
|
+
if (result.ownerContactSyncErrors?.length) {
|
|
364
|
+
console.log(` ⚠ Owner 联系人同步失败: ${result.ownerContactSyncErrors.join('; ')}`);
|
|
365
|
+
}
|
|
354
366
|
if (result.ownerBoundAid) {
|
|
355
367
|
console.log(` ✓ agent owner 已绑定: ${result.ownerBoundAid}`);
|
|
356
368
|
}
|
|
@@ -385,6 +397,15 @@ Options:
|
|
|
385
397
|
: result.hotLoadError
|
|
386
398
|
? ` ✗ 热重载失败:${result.hotLoadError}`
|
|
387
399
|
: ' ⚠ 服务未运行,下次 ec start 时生效');
|
|
400
|
+
if (result.ownerContactsSynced?.length) {
|
|
401
|
+
console.log(` ✓ 已同步 Owner 联系人: ${result.ownerContactsSynced.join(', ')}`);
|
|
402
|
+
}
|
|
403
|
+
if (result.ownerContactsSkipped?.length) {
|
|
404
|
+
console.log(` ⚠ 无本地联系人簿,跳过 Owner: ${result.ownerContactsSkipped.join(', ')}`);
|
|
405
|
+
}
|
|
406
|
+
if (result.ownerContactSyncErrors?.length) {
|
|
407
|
+
console.log(` ⚠ Owner 联系人同步失败: ${result.ownerContactSyncErrors.join('; ')}`);
|
|
408
|
+
}
|
|
388
409
|
if (result.ownerBoundAid) {
|
|
389
410
|
console.log(` ✓ agent owner 已绑定: ${result.ownerBoundAid}`);
|
|
390
411
|
}
|
|
@@ -420,11 +441,11 @@ Options:
|
|
|
420
441
|
// --- reload ---
|
|
421
442
|
if (sub === 'reload') {
|
|
422
443
|
if (wantsHelp(args)) {
|
|
423
|
-
console.log(`用法: ec agent reload [aid] [--force] [--format json]
|
|
424
|
-
|
|
425
|
-
热重载 agent 配置。
|
|
426
|
-
无参数 全量 resync(扫磁盘,新增上线、删除下线、修改热更新)
|
|
427
|
-
<aid> 仅热重载指定 agent
|
|
444
|
+
console.log(`用法: ec agent reload [aid] [--force] [--format json]
|
|
445
|
+
|
|
446
|
+
热重载 agent 配置。
|
|
447
|
+
无参数 全量 resync(扫磁盘,新增上线、删除下线、修改热更新)
|
|
448
|
+
<aid> 仅热重载指定 agent
|
|
428
449
|
--force 中断目标 Agent 的运行中任务并清空排队任务后重载(仅与 <aid> 同用)`);
|
|
429
450
|
return;
|
|
430
451
|
}
|
|
@@ -456,9 +477,9 @@ Options:
|
|
|
456
477
|
// --- enable ---
|
|
457
478
|
if (sub === 'enable') {
|
|
458
479
|
if (wantsHelp(args)) {
|
|
459
|
-
console.log(`用法: ec agent enable <aid> [--force] [--format json]
|
|
460
|
-
|
|
461
|
-
启用 agent。若服务运行中会热重载,否则下次 ec start 时生效。
|
|
480
|
+
console.log(`用法: ec agent enable <aid> [--force] [--format json]
|
|
481
|
+
|
|
482
|
+
启用 agent。若服务运行中会热重载,否则下次 ec start 时生效。
|
|
462
483
|
--force 中断目标 Agent 的运行中任务并清空排队任务后重载`);
|
|
463
484
|
return;
|
|
464
485
|
}
|
|
@@ -488,9 +509,9 @@ Options:
|
|
|
488
509
|
// --- disable ---
|
|
489
510
|
if (sub === 'disable') {
|
|
490
511
|
if (wantsHelp(args)) {
|
|
491
|
-
console.log(`用法: ec agent disable <aid> [--force] [--format json]
|
|
492
|
-
|
|
493
|
-
停用 agent。若服务运行中会热重载离线,否则在配置中标记为禁用。
|
|
512
|
+
console.log(`用法: ec agent disable <aid> [--force] [--format json]
|
|
513
|
+
|
|
514
|
+
停用 agent。若服务运行中会热重载离线,否则在配置中标记为禁用。
|
|
494
515
|
--force 中断目标 Agent 的运行中任务并清空排队任务后重载`);
|
|
495
516
|
return;
|
|
496
517
|
}
|
|
@@ -598,14 +619,14 @@ Options:
|
|
|
598
619
|
}
|
|
599
620
|
if (sub === 'get') {
|
|
600
621
|
if (wantsHelp(args)) {
|
|
601
|
-
console.log(`用法: ec agent get <aid> <key> [--format json]
|
|
602
|
-
|
|
603
|
-
读取单个配置字段。key 支持点路径,如 "channels.aun.enabled"。
|
|
604
|
-
托管任务通过 daemon 统一鉴权;无会话的本机 CLI 走控制面。
|
|
605
|
-
|
|
606
|
-
示例:
|
|
607
|
-
ec agent get mybot.agentid.pub active_baseagent
|
|
608
|
-
ec agent get mybot.agentid.pub observable
|
|
622
|
+
console.log(`用法: ec agent get <aid> <key> [--format json]
|
|
623
|
+
|
|
624
|
+
读取单个配置字段。key 支持点路径,如 "channels.aun.enabled"。
|
|
625
|
+
托管任务通过 daemon 统一鉴权;无会话的本机 CLI 走控制面。
|
|
626
|
+
|
|
627
|
+
示例:
|
|
628
|
+
ec agent get mybot.agentid.pub active_baseagent
|
|
629
|
+
ec agent get mybot.agentid.pub observable
|
|
609
630
|
ec agent get mybot.agentid.pub channels.aun.enabled`);
|
|
610
631
|
return;
|
|
611
632
|
}
|
|
@@ -637,15 +658,15 @@ Options:
|
|
|
637
658
|
// --- set ---
|
|
638
659
|
if (sub === 'set') {
|
|
639
660
|
if (wantsHelp(args)) {
|
|
640
|
-
console.log(`用法: ec agent set <aid> <key> <value> [--format json]
|
|
641
|
-
|
|
642
|
-
修改单个配置字段。key 支持点路径。本机控制面会尝试热重载;托管任务如需重载须另行执行 agent reload。
|
|
643
|
-
托管任务通过 daemon 统一鉴权;无会话的本机 CLI 走控制面。
|
|
644
|
-
|
|
645
|
-
示例:
|
|
646
|
-
ec agent set mybot.agentid.pub active_baseagent codex
|
|
647
|
-
ec agent set mybot.agentid.pub observable true
|
|
648
|
-
ec agent set mybot.agentid.pub observable false
|
|
661
|
+
console.log(`用法: ec agent set <aid> <key> <value> [--format json]
|
|
662
|
+
|
|
663
|
+
修改单个配置字段。key 支持点路径。本机控制面会尝试热重载;托管任务如需重载须另行执行 agent reload。
|
|
664
|
+
托管任务通过 daemon 统一鉴权;无会话的本机 CLI 走控制面。
|
|
665
|
+
|
|
666
|
+
示例:
|
|
667
|
+
ec agent set mybot.agentid.pub active_baseagent codex
|
|
668
|
+
ec agent set mybot.agentid.pub observable true
|
|
669
|
+
ec agent set mybot.agentid.pub observable false
|
|
649
670
|
ec agent set mybot.agentid.pub channels.aun.enabled true`);
|
|
650
671
|
return;
|
|
651
672
|
}
|
|
@@ -677,8 +698,8 @@ Options:
|
|
|
677
698
|
// --- ready ---
|
|
678
699
|
if (sub === 'ready') {
|
|
679
700
|
if (wantsHelp(args)) {
|
|
680
|
-
console.log(`用法: ec agent ready <aid> [--format json]
|
|
681
|
-
|
|
701
|
+
console.log(`用法: ec agent ready <aid> [--format json]
|
|
702
|
+
|
|
682
703
|
标记 agent bootstrap 已完成,将 lifecycle 切换为 active。该命令允许 agent 在工具调用中自报完成。`);
|
|
683
704
|
return;
|
|
684
705
|
}
|
|
@@ -708,10 +729,10 @@ Options:
|
|
|
708
729
|
// --- delete ---
|
|
709
730
|
if (sub === 'delete') {
|
|
710
731
|
if (wantsHelp(args)) {
|
|
711
|
-
console.log(`用法: ec agent delete <aid> [--purge] [--format json]
|
|
712
|
-
|
|
713
|
-
删除 agent 的配置。
|
|
714
|
-
--purge 同时清除该 agent 的会话、消息、日志等运行时数据
|
|
732
|
+
console.log(`用法: ec agent delete <aid> [--purge] [--format json]
|
|
733
|
+
|
|
734
|
+
删除 agent 的配置。
|
|
735
|
+
--purge 同时清除该 agent 的会话、消息、日志等运行时数据
|
|
715
736
|
默认 仅删除 config.json,运行时数据保留`);
|
|
716
737
|
return;
|
|
717
738
|
}
|
|
@@ -742,8 +763,8 @@ Options:
|
|
|
742
763
|
// --- show ---
|
|
743
764
|
if (sub === 'show') {
|
|
744
765
|
if (wantsHelp(args)) {
|
|
745
|
-
console.log(`用法: ec agent show <aid> [--format json]
|
|
746
|
-
|
|
766
|
+
console.log(`用法: ec agent show <aid> [--format json]
|
|
767
|
+
|
|
747
768
|
查看 agent 详情:身份、配置、连接状态、会话路径等。`);
|
|
748
769
|
return;
|
|
749
770
|
}
|
|
@@ -772,8 +793,8 @@ Options:
|
|
|
772
793
|
// --- rename ---
|
|
773
794
|
if (sub === 'rename') {
|
|
774
795
|
if (wantsHelp(args)) {
|
|
775
|
-
console.log(`用法: ec agent rename <aid> <name> [--format json]
|
|
776
|
-
|
|
796
|
+
console.log(`用法: ec agent rename <aid> <name> [--format json]
|
|
797
|
+
|
|
777
798
|
修改本地 AIDs/<aid>/agent.md 中的 name 字段。`);
|
|
778
799
|
return;
|
|
779
800
|
}
|
|
@@ -819,7 +840,7 @@ Options:
|
|
|
819
840
|
printAgentShowHuman(result);
|
|
820
841
|
}
|
|
821
842
|
function printAgentShowHuman(result) {
|
|
822
|
-
console.log(`${result.aid} (${result.status})\n`);
|
|
843
|
+
console.log(`${result.aid} (${result.status}, lifecycle=${result.lifecycle || 'unknown'})\n`);
|
|
823
844
|
if (result.identity.name || result.identity.description) {
|
|
824
845
|
console.log(' Identity');
|
|
825
846
|
if (result.identity.name)
|
package/dist/cli/agent-create.js
CHANGED
|
@@ -7,12 +7,13 @@ import { ConfigTarget, write as cfgWrite, ensureFile as cfgEnsure, read as cfgRe
|
|
|
7
7
|
import { ipcQuery } from '../ipc.js';
|
|
8
8
|
import { CONFIG_SCHEMA_VERSION } from '../types.js';
|
|
9
9
|
import { ensureInitialRoleRegistry } from '../config/role-service.js';
|
|
10
|
+
import { addContact } from '../config/contact-request-service.js';
|
|
10
11
|
import { getCodexAppServerAvailability } from '../agents/codex-runner.js';
|
|
11
12
|
import { resolveEcagentConfig } from '../agents/baseagent.js';
|
|
12
13
|
import { AUTO_BASEAGENT_CANDIDATES, BASEAGENT_CANDIDATES, detectAvailableBaseagents, } from '../agents/baseagent-availability.js';
|
|
13
14
|
import { agentProjectRootFromDefaults, deriveAgentProjectPath } from '../utils/project-path.js';
|
|
14
15
|
import { isValidAid } from '../aun/aid/validation.js';
|
|
15
|
-
import { AGENT_TAG_MAX_COUNT, AGENT_TAG_MIN_COUNT, DEFAULT_AGENT_DESCRIPTION, validateAgentTags, } from '../aun/aid/agentmd.js';
|
|
16
|
+
import { AGENT_DESCRIPTION_MAX_LENGTH, AGENT_TAG_MAX_COUNT, AGENT_TAG_MIN_COUNT, DEFAULT_AGENT_DESCRIPTION, DEFAULT_AGENT_TYPE, normalizeAgentType, validateAgentTags, validateAgentType, } from '../aun/aid/agentmd.js';
|
|
16
17
|
export function parseAgentTags(raw) {
|
|
17
18
|
if (raw === undefined)
|
|
18
19
|
return undefined;
|
|
@@ -89,6 +90,42 @@ function withStaticOwners(config, ownersInput) {
|
|
|
89
90
|
function withStaticOwner(config, owner) {
|
|
90
91
|
return withStaticOwners(config, owner ? [owner] : undefined);
|
|
91
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* An Agent owner must be able to receive the new Agent's Bootstrap reply.
|
|
95
|
+
* Contact admission is per local Agent, so materialize the new AID in each
|
|
96
|
+
* locally managed owner's contact book immediately after creation. Human or
|
|
97
|
+
* remote owners have no local contact book and are reported as skipped.
|
|
98
|
+
*/
|
|
99
|
+
export async function syncOwnerContactsAfterCreate(createdAid, owners) {
|
|
100
|
+
const synced = [];
|
|
101
|
+
const skipped = [];
|
|
102
|
+
const errors = [];
|
|
103
|
+
for (const ownerAid of [...new Set((owners ?? []).map(value => value.trim()).filter(Boolean))]) {
|
|
104
|
+
if (ownerAid === createdAid)
|
|
105
|
+
continue;
|
|
106
|
+
const ownerConfig = path.join(resolvePaths().agentsDir, ownerAid, 'config.json');
|
|
107
|
+
if (!fs.existsSync(ownerConfig)) {
|
|
108
|
+
skipped.push(ownerAid);
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
try {
|
|
112
|
+
await addContact({
|
|
113
|
+
selfAid: ownerAid,
|
|
114
|
+
primaryId: createdAid,
|
|
115
|
+
actorId: 'agent-create-owner-sync',
|
|
116
|
+
});
|
|
117
|
+
synced.push(ownerAid);
|
|
118
|
+
}
|
|
119
|
+
catch (error) {
|
|
120
|
+
errors.push(`${ownerAid}: ${error instanceof Error ? error.message : String(error)}`);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return {
|
|
124
|
+
...(synced.length > 0 ? { ownerContactsSynced: synced } : {}),
|
|
125
|
+
...(skipped.length > 0 ? { ownerContactsSkipped: skipped } : {}),
|
|
126
|
+
...(errors.length > 0 ? { ownerContactSyncErrors: errors } : {}),
|
|
127
|
+
};
|
|
128
|
+
}
|
|
92
129
|
function pickDefaultBaseagent(available) {
|
|
93
130
|
return AUTO_BASEAGENT_CANDIDATES.find(candidate => available.includes(candidate)) ?? null;
|
|
94
131
|
}
|
|
@@ -137,13 +174,25 @@ export function resolveAgentCreatePlan(options) {
|
|
|
137
174
|
const owner = options.owner?.trim() || (owners === undefined ? daemon.owners?.[0] : undefined);
|
|
138
175
|
const ownerSource = owners !== undefined || options.owner?.trim() ? 'argument' : owner ? 'daemon' : 'none';
|
|
139
176
|
const name = options.name?.trim() || metadata.name || projectSlug(project);
|
|
140
|
-
|
|
177
|
+
// description 是可选字段:用户显式传入的必须合规(超长会在校验阶段被拒);
|
|
178
|
+
// 从 package.json 推导出来的超长值直接弃用、回落默认短描述——用户没设过它,
|
|
179
|
+
// 不该因此让创建命令失败。
|
|
180
|
+
const explicitDescription = options.description?.trim();
|
|
181
|
+
const packageDescription = metadata.description
|
|
182
|
+
&& Array.from(metadata.description).length <= AGENT_DESCRIPTION_MAX_LENGTH
|
|
183
|
+
? metadata.description
|
|
184
|
+
: undefined;
|
|
185
|
+
const description = explicitDescription || packageDescription || DEFAULT_AGENT_DESCRIPTION;
|
|
186
|
+
// 大小写不敏感:能识别就收敛成小写;无法识别时保留原值,交给 validateAgentCreatePlan 报错。
|
|
187
|
+
const requestedType = options.type?.trim();
|
|
188
|
+
const type = requestedType ? (normalizeAgentType(requestedType) ?? requestedType) : DEFAULT_AGENT_TYPE;
|
|
141
189
|
const configExists = isValidAid(aid) && fs.existsSync(path.join(resolvePaths().agentsDir, aid, 'config.json'));
|
|
142
190
|
return {
|
|
143
|
-
aid, project, baseagent, owner, owners, handoff: options.handoff, name, description, tags: options.tags,
|
|
191
|
+
aid, project, baseagent, owner, owners, handoff: options.handoff, name, description, type, tags: options.tags,
|
|
144
192
|
force: options.force === true, configExists, baseagentSource, ownerSource,
|
|
145
193
|
nameSource: options.name?.trim() ? 'argument' : metadata.name ? 'package' : 'directory',
|
|
146
|
-
descriptionSource:
|
|
194
|
+
descriptionSource: explicitDescription ? 'argument' : packageDescription ? 'package' : 'default',
|
|
195
|
+
typeSource: options.type?.trim() ? 'argument' : 'default',
|
|
147
196
|
};
|
|
148
197
|
}
|
|
149
198
|
export function validateAgentCreatePlan(plan) {
|
|
@@ -159,6 +208,16 @@ export function validateAgentCreatePlan(plan) {
|
|
|
159
208
|
if (tagErrors.length > 0)
|
|
160
209
|
return `Invalid tags: ${tagErrors.join('; ')}`;
|
|
161
210
|
}
|
|
211
|
+
const typeError = validateAgentType(plan.type);
|
|
212
|
+
if (typeError)
|
|
213
|
+
return `Invalid --type: ${typeError}`;
|
|
214
|
+
// 只有显式传入的 --description 才会超限(package.json 的超长值在 resolve 阶段
|
|
215
|
+
// 已被弃用)。必须在这里就拒绝:否则 plan 通过、直到 agentmdPut 上传才失败,
|
|
216
|
+
// 而那处是 warn 级不中断创建,最终留下一张 SDK 兜底名片(--type/--name 全部丢失)。
|
|
217
|
+
const descriptionLength = Array.from(plan.description).length;
|
|
218
|
+
if (descriptionLength > AGENT_DESCRIPTION_MAX_LENGTH) {
|
|
219
|
+
return `Invalid --description: ${descriptionLength} characters exceeds the agent.md limit of ${AGENT_DESCRIPTION_MAX_LENGTH}. Pass a shorter --description.`;
|
|
220
|
+
}
|
|
162
221
|
if (!plan.baseagent)
|
|
163
222
|
return 'No usable baseagent detected. Pass --baseagent or configure a baseagent in agents/defaults.json.';
|
|
164
223
|
if (!BASEAGENT_CANDIDATES.includes(plan.baseagent)) {
|
|
@@ -344,6 +403,8 @@ export async function agentCreateInteractive(opts = {}) {
|
|
|
344
403
|
ensureInitialRoleRegistry(aid);
|
|
345
404
|
saveInitialBehavior(aid, baseagent);
|
|
346
405
|
ensureAgentDirSkeleton(aid);
|
|
406
|
+
if (owner)
|
|
407
|
+
await syncOwnerContactsAfterCreate(aid, [owner]);
|
|
347
408
|
let agentmdUploaded = false;
|
|
348
409
|
try {
|
|
349
410
|
const content = buildInitialAgentMd({ aid, name: agentName, description: agentDescription, tags: agentTags });
|
|
@@ -399,7 +460,21 @@ export async function agentCreateInteractive(opts = {}) {
|
|
|
399
460
|
ownerBoundAid = await promptAgentOwnerManually(aid);
|
|
400
461
|
}
|
|
401
462
|
}
|
|
402
|
-
|
|
463
|
+
const finalOwnerAid = owner ?? ownerBoundAid;
|
|
464
|
+
const ownerContactSync = await syncOwnerContactsAfterCreate(aid, finalOwnerAid ? [finalOwnerAid] : undefined);
|
|
465
|
+
return {
|
|
466
|
+
ok: true,
|
|
467
|
+
aid,
|
|
468
|
+
configPath: toPosix(path.join(agentDirPath, 'config.json')),
|
|
469
|
+
aidCreated,
|
|
470
|
+
agentmdUploaded,
|
|
471
|
+
hotLoaded,
|
|
472
|
+
hotLoadError,
|
|
473
|
+
ownerBoundAid,
|
|
474
|
+
ownerBindSkipped,
|
|
475
|
+
ownerBindInterrupted,
|
|
476
|
+
...ownerContactSync,
|
|
477
|
+
};
|
|
403
478
|
}
|
|
404
479
|
finally {
|
|
405
480
|
if (ownRl) {
|
|
@@ -449,6 +524,17 @@ export async function agentCreateNonInteractive(opts, runtime = {}) {
|
|
|
449
524
|
if (tagErrors.length > 0)
|
|
450
525
|
return failValidating(`Invalid tags: ${tagErrors.join('; ')}`);
|
|
451
526
|
}
|
|
527
|
+
if (opts.type !== undefined) {
|
|
528
|
+
const typeError = validateAgentType(opts.type);
|
|
529
|
+
if (typeError)
|
|
530
|
+
return failValidating(`Invalid --type: ${typeError}`);
|
|
531
|
+
}
|
|
532
|
+
if (opts.description !== undefined) {
|
|
533
|
+
const descriptionLength = Array.from(opts.description).length;
|
|
534
|
+
if (descriptionLength > AGENT_DESCRIPTION_MAX_LENGTH) {
|
|
535
|
+
return failValidating(`Invalid description: ${descriptionLength} characters exceeds the agent.md limit of ${AGENT_DESCRIPTION_MAX_LENGTH}. Pass a shorter --description.`);
|
|
536
|
+
}
|
|
537
|
+
}
|
|
452
538
|
if (!isValidAid(opts.aid))
|
|
453
539
|
return failValidating(`Invalid AID "${opts.aid}": must be a valid multi-level domain (e.g. mybot.agentid.pub)`);
|
|
454
540
|
const agentDirPath = path.join(p.agentsDir, opts.aid);
|
|
@@ -518,11 +604,13 @@ export async function agentCreateNonInteractive(opts, runtime = {}) {
|
|
|
518
604
|
ensureInitialRoleRegistry(opts.aid);
|
|
519
605
|
saveInitialBehavior(opts.aid, baseagent);
|
|
520
606
|
ensureAgentDirSkeleton(opts.aid);
|
|
607
|
+
const ownerContactSync = await syncOwnerContactsAfterCreate(opts.aid, opts.owners ?? (opts.owner ? [opts.owner] : undefined));
|
|
521
608
|
opts.onPhase?.('config_saved', 'done');
|
|
522
609
|
opts.onPhase?.('uploading_agentmd', 'begin');
|
|
523
610
|
let agentmdUploaded = false;
|
|
611
|
+
let agentmdError;
|
|
524
612
|
try {
|
|
525
|
-
const content = buildInitialAgentMd({ aid: opts.aid, name: opts.name, description: opts.description, tags: opts.tags });
|
|
613
|
+
const content = buildInitialAgentMd({ aid: opts.aid, name: opts.name, description: opts.description, type: opts.type, tags: opts.tags });
|
|
526
614
|
const aunPath = process.env.AUN_HOME || defaultAunPath();
|
|
527
615
|
let lastError;
|
|
528
616
|
for (let attempt = 1; attempt <= 3; attempt++) {
|
|
@@ -538,12 +626,15 @@ export async function agentCreateNonInteractive(opts, runtime = {}) {
|
|
|
538
626
|
lastError = e;
|
|
539
627
|
}
|
|
540
628
|
}
|
|
541
|
-
if (!agentmdUploaded)
|
|
542
|
-
|
|
629
|
+
if (!agentmdUploaded) {
|
|
630
|
+
agentmdError = `upload failed: ${lastError?.message || lastError}`;
|
|
631
|
+
opts.onPhase?.('uploading_agentmd', 'warn', agentmdError);
|
|
632
|
+
}
|
|
543
633
|
await new Promise(r => setTimeout(r, 0));
|
|
544
634
|
}
|
|
545
635
|
catch (e) {
|
|
546
|
-
|
|
636
|
+
agentmdError = `generation failed: ${e?.message || e}`;
|
|
637
|
+
opts.onPhase?.('uploading_agentmd', 'warn', agentmdError);
|
|
547
638
|
}
|
|
548
639
|
let hotLoaded = false;
|
|
549
640
|
let hotLoadError;
|
|
@@ -572,5 +663,16 @@ export async function agentCreateNonInteractive(opts, runtime = {}) {
|
|
|
572
663
|
hotLoadError = error instanceof Error ? error.message : String(error);
|
|
573
664
|
opts.onPhase?.('hot_loading', 'warn', hotLoadError);
|
|
574
665
|
}
|
|
575
|
-
return {
|
|
666
|
+
return {
|
|
667
|
+
ok: true,
|
|
668
|
+
aid: opts.aid,
|
|
669
|
+
ownerAid: (opts.owners ?? (opts.owner ? [opts.owner] : undefined))?.[0],
|
|
670
|
+
configPath: toPosix(path.join(agentDirPath, 'config.json')),
|
|
671
|
+
aidCreated,
|
|
672
|
+
agentmdUploaded,
|
|
673
|
+
agentmdError,
|
|
674
|
+
hotLoaded,
|
|
675
|
+
hotLoadError,
|
|
676
|
+
...ownerContactSync,
|
|
677
|
+
};
|
|
576
678
|
}
|
package/dist/cli/agent.js
CHANGED
|
@@ -4,7 +4,7 @@ import { resolvePaths, agentMdPath as getAgentMdPathFromPaths, agentPersonalDir,
|
|
|
4
4
|
import { loadDefaults, loadAllAgents, loadAgent, saveAgent, ensureAgentDirSkeleton } from '../config-store.js';
|
|
5
5
|
import { initConfigManager } from '../config/config-manager.js';
|
|
6
6
|
import { resolveConfigCommand } from '../config/resolved-config-op.js';
|
|
7
|
-
import {
|
|
7
|
+
import { executeResolvedConfigCommandAsync } from '../config/config-operation-service.js';
|
|
8
8
|
import { ipcQuery, IpcTransportError } from '../ipc.js';
|
|
9
9
|
import { CONFIG_SCHEMA_VERSION } from '../types.js';
|
|
10
10
|
import { ensureInitialRoleRegistry } from '../config/role-service.js';
|
|
@@ -183,6 +183,7 @@ export async function agentShow(aid) {
|
|
|
183
183
|
ok: true,
|
|
184
184
|
aid,
|
|
185
185
|
status: agentInfo.status || 'unknown',
|
|
186
|
+
lifecycle: loadAgent(aid)?.lifecycle ?? null,
|
|
186
187
|
identity,
|
|
187
188
|
config: {
|
|
188
189
|
baseagent: agentInfo.baseagent || null,
|
|
@@ -390,12 +391,22 @@ async function runManagedAgentConfig(args, options) {
|
|
|
390
391
|
return { managed: true, error: { ok: false, code: 'DAEMON_UNAVAILABLE', error: 'Unable to connect to the evolcore daemon' } };
|
|
391
392
|
}
|
|
392
393
|
}
|
|
393
|
-
function executeLocalAgentConfig(args) {
|
|
394
|
+
async function executeLocalAgentConfig(args) {
|
|
394
395
|
initConfigManager();
|
|
395
396
|
const resolved = resolveConfigCommand(['config', ...args]);
|
|
396
397
|
if (!resolved.ok)
|
|
397
398
|
return { ok: false, code: resolved.code, error: resolved.reason };
|
|
398
|
-
return
|
|
399
|
+
return executeResolvedConfigCommandAsync(resolved.command, {
|
|
400
|
+
role: 'owner',
|
|
401
|
+
roleContext: {
|
|
402
|
+
self: resolved.command.self || '',
|
|
403
|
+
actorRole: 'owner',
|
|
404
|
+
actorRoleSource: 'local-cli',
|
|
405
|
+
isDaemonOwner: false,
|
|
406
|
+
fromControlChannel: false,
|
|
407
|
+
aunAvailable: true,
|
|
408
|
+
},
|
|
409
|
+
});
|
|
399
410
|
}
|
|
400
411
|
export async function agentGet(aid, key, options = {}) {
|
|
401
412
|
const managed = await runManagedAgentConfig(['get', key, '--self', aid], options);
|
|
@@ -412,7 +423,7 @@ export async function agentGet(aid, key, options = {}) {
|
|
|
412
423
|
return { ok: false, error: `Agent "${aid}" not found` };
|
|
413
424
|
}
|
|
414
425
|
try {
|
|
415
|
-
const result = executeLocalAgentConfig(['get', key, '--self', aid]);
|
|
426
|
+
const result = await executeLocalAgentConfig(['get', key, '--self', aid]);
|
|
416
427
|
return result.ok && result.subcommand === 'get'
|
|
417
428
|
? { ok: true, aid, key, value: result.value }
|
|
418
429
|
: { ok: false, code: result.ok ? 'UNEXPECTED_RESULT' : result.code, error: result.ok ? 'config get returned an unexpected result' : result.error };
|
|
@@ -438,7 +449,7 @@ export async function agentSet(aid, key, rawValue, options = {}) {
|
|
|
438
449
|
}
|
|
439
450
|
let value;
|
|
440
451
|
try {
|
|
441
|
-
const result = executeLocalAgentConfig(['set', key, rawValue, '--self', aid]);
|
|
452
|
+
const result = await executeLocalAgentConfig(['set', key, rawValue, '--self', aid]);
|
|
442
453
|
if (!result.ok)
|
|
443
454
|
return { ok: false, code: result.code, error: result.error };
|
|
444
455
|
if (result.subcommand !== 'set')
|