evolcore 0.0.23 → 0.0.25
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 +583 -516
- package/LICENSE +21 -21
- package/README.md +455 -453
- package/bin/codex-managed-acl.ps1 +160 -155
- package/bin/codex-managed-hook.mjs +209 -92
- package/bin/ec-safe-output.js +327 -245
- package/bin/ec.js +29 -29
- package/bin/install-codex-managed-hooks.mjs +555 -544
- package/dist/agents/baseagent-availability.js +4 -4
- package/dist/agents/baseagent.js +29 -1
- package/dist/agents/claude-runner.js +152 -14
- package/dist/agents/codex/app-server-client.js +18 -8
- package/dist/agents/codex/catalog.js +1 -1
- package/dist/agents/codex/diagnostics.js +215 -0
- package/dist/agents/codex-runner.js +445 -63
- package/dist/agents/ecagent-runner.js +31 -16
- package/dist/agents/gemini-runner.js +82 -4
- package/dist/agents/runner-types.js +1 -1
- package/dist/aun/aid/agentmd.js +56 -4
- package/dist/aun/aid/index.js +1 -0
- package/dist/aun/aid/managed-operation.js +80 -6
- package/dist/aun/aid/store.js +41 -0
- package/dist/aun/msg/managed-operation.js +6 -1
- package/dist/aun/outbox.js +56 -18
- package/dist/aun/rpc/client.js +4 -5
- package/dist/aun/storage/client.js +4 -1
- package/dist/aun/storage/index.js +1 -1
- package/dist/channels/aun.js +147 -76
- package/dist/channels/daemon.js +7 -1
- package/dist/channels/dingtalk.js +1 -0
- package/dist/channels/feishu.js +10 -4
- package/dist/channels/wecom.js +2 -1
- package/dist/cli/agent-command.js +214 -89
- package/dist/cli/agent-create.js +576 -0
- package/dist/cli/agent.js +129 -676
- package/dist/cli/aun-commands.js +419 -313
- package/dist/cli/bench.js +20 -20
- package/dist/cli/config.js +20 -20
- package/dist/cli/contact.js +10 -10
- package/dist/cli/ctl-command.js +22 -20
- package/dist/cli/daemon-commands.js +163 -32
- package/dist/cli/fs-command.js +67 -67
- package/dist/cli/handoff-command.js +7 -7
- package/dist/cli/index.js +79 -79
- package/dist/cli/link-rules.js +21 -21
- package/dist/cli/managed-command-guard.js +3 -0
- package/dist/cli/menu-client.js +11 -11
- 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 +462 -38
- package/dist/cli/stats.js +161 -51
- package/dist/cli/trigger-command.js +56 -56
- package/dist/config/builtin-roles.js +3 -0
- package/dist/config/config-manager.js +15 -0
- package/dist/config/config-operation-service.js +20 -3
- package/dist/config/resolved-config-op.js +39 -1
- package/dist/core/auth/auth-gateway.js +3 -2
- package/dist/core/auth/authorization-audit.js +72 -19
- package/dist/core/auth/operation-authorizer.js +125 -7
- package/dist/core/auth/operation-catalog.js +26 -2
- package/dist/core/auth/remote-access-store.js +3 -2
- package/dist/core/baseagent-loader.js +4 -4
- package/dist/core/bootstrap-messages.js +39 -18
- package/dist/core/bootstrap-service.js +32 -26
- package/dist/core/capability/capability-manager.js +8 -4
- package/dist/core/capability/providers/codex-capability-provider.js +1 -1
- package/dist/core/command/agent-control.js +60 -26
- package/dist/core/command/cli-intent-parser.js +18 -0
- package/dist/core/command/command-handler.js +173 -36
- package/dist/core/command/menu-catalog.js +4 -1
- package/dist/core/command/menu-handler.js +315 -75
- package/dist/core/command/menu-protocol.js +7 -2
- package/dist/core/command/slash-gate.js +1 -3
- package/dist/core/command/slash-handler.js +166 -57
- package/dist/core/data-migration.js +5 -15
- package/dist/core/event-catalog.js +8 -0
- package/dist/core/evolagent.js +3 -3
- package/dist/core/handoff/runtime.js +3 -1
- package/dist/core/handoff/store.js +7 -1
- package/dist/core/message/im-renderer.js +13 -6
- package/dist/core/message/message-bridge.js +5 -36
- package/dist/core/message/message-utils.js +6 -3
- package/dist/core/message/response-engine.js +85 -27
- package/dist/core/model/catalog-service.js +3 -1
- package/dist/core/model/model-catalog.js +10 -0
- package/dist/core/model/model-permission.js +4 -1
- package/dist/core/permission/approval-gateway.js +169 -33
- package/dist/core/permission/tool-policy.js +56 -10
- package/dist/core/session/adapters/codex-session-file-adapter.js +71 -3
- package/dist/core/session/session-manager.js +49 -13
- package/dist/core/session/session-renew.js +1 -0
- package/dist/index.js +327 -134
- package/dist/ipc.js +68 -21
- package/dist/paths.js +23 -1
- package/dist/stats/billing.js +18 -4
- package/dist/stats/db.js +159 -159
- package/dist/stats/eck-vars.js +9 -9
- 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/atomic-write.js +26 -2
- package/dist/utils/avatar-upload.js +282 -23
- package/dist/utils/cross-platform.js +436 -1
- package/dist/utils/error-dict.json +160 -160
- package/dist/utils/error-utils.js +11 -4
- package/dist/utils/macos-autostart.js +22 -22
- package/dist/utils/model-prices.jsonl +23 -20
- package/dist/utils/npm-ops.js +24 -1
- package/dist/utils/welcome.js +22 -22
- package/dist/utils/windows-autostart.js +1 -1
- 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 +365 -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 -69
- package/kits/docs/evolcore/agent-create.md +170 -156
- package/kits/docs/evolcore/agent.md +83 -73
- package/kits/docs/evolcore/aid.md +64 -62
- package/kits/docs/evolcore/codex-windows-sandbox.md +146 -0
- package/kits/docs/evolcore/config.md +195 -195
- package/kits/docs/evolcore/contact.md +68 -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 +34 -34
- package/kits/docs/evolcore/model.md +50 -50
- package/kits/docs/evolcore/msg.md +165 -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 +270 -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 +25 -25
- package/kits/docs/venues/private.md +10 -10
- package/kits/eck_manifest.auxiliary.json +43 -43
- package/kits/eck_manifest.json +195 -183
- 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 +39 -37
- 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 +96 -82
- package/kits/templates/roles/member.json +97 -96
- package/kits/templates/roles/owner.json +9 -9
- package/kits/templates/roles/visitor.json +86 -85
- package/kits/templates/system-fragments/baseagent.md +14 -14
- package/kits/templates/system-fragments/bootstrap.md +38 -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 +98 -94
- package/AGENTS.md +0 -62
- package/dist/utils/codex-cli.js +0 -43
- package/skills/eclink/SKILL.md +0 -84
- package/skills/eclink/agents/openai.yaml +0 -4
package/dist/channels/wecom.js
CHANGED
|
@@ -1461,7 +1461,8 @@ export class WecomChannelPlugin {
|
|
|
1461
1461
|
return;
|
|
1462
1462
|
case 'status.started':
|
|
1463
1463
|
case 'status.queued':
|
|
1464
|
-
case 'status.progress':
|
|
1464
|
+
case 'status.progress':
|
|
1465
|
+
case 'status.notice': return;
|
|
1465
1466
|
case 'status.requires_action':
|
|
1466
1467
|
await channel.sendMessage(channelId, '等待 owner 审批', envelope.replyContext);
|
|
1467
1468
|
return;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
import { getArgValue, isHelpFlag, wantsHelp } from './help.js';
|
|
3
3
|
import { isHostChinese } from '../utils/locale.js';
|
|
4
|
+
import { readTaskRuntimeContextFromEnv } from './task-context.js';
|
|
4
5
|
function formatTimeAgo(ms) {
|
|
5
6
|
const sec = Math.floor(ms / 1000);
|
|
6
7
|
if (sec < 60)
|
|
@@ -25,7 +26,7 @@ function formatBytes(bytes) {
|
|
|
25
26
|
export async function cmdAgent(args) {
|
|
26
27
|
const sub = args[0];
|
|
27
28
|
const formatJson = getArgValue(args, '--format') === 'json';
|
|
28
|
-
const commands = new Set(['list', 'show', 'new', 'enable', 'disable', 'get', 'set', 'rename', 'ready', 'reload', 'delete']);
|
|
29
|
+
const commands = new Set(['list', 'show', 'new', 'enable', 'disable', 'get', 'set', 'persona', 'rename', 'ready', 'reload', 'delete']);
|
|
29
30
|
if (sub === 'create') {
|
|
30
31
|
const error = { ok: false, code: 'INVALID_COMMAND', error: '`ec agent create` is not a command; use `ec agent new`.' };
|
|
31
32
|
if (formatJson)
|
|
@@ -36,40 +37,45 @@ export async function cmdAgent(args) {
|
|
|
36
37
|
return;
|
|
37
38
|
}
|
|
38
39
|
if (!sub || isHelpFlag(sub) || (wantsHelp(args) && !commands.has(sub))) {
|
|
39
|
-
console.log(`用法: ec agent <command>
|
|
40
|
-
|
|
41
|
-
Commands:
|
|
42
|
-
list 列出所有 agent
|
|
43
|
-
show <aid> 查看 agent 详情(身份 + 配置 + 连接 + 会话 + 路径)
|
|
44
|
-
new [aid] 交互式创建 agent
|
|
45
|
-
new <aid> --non-interactive ... 非交互式创建
|
|
46
|
-
enable <aid> 启用 agent
|
|
47
|
-
disable <aid> 停用 agent
|
|
48
|
-
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> 读取单个配置字段(支持点路径)
|
|
49
50
|
set <aid> <key> <val> 修改单个配置字段(支持点路径)
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
ec agent
|
|
64
|
-
ec agent
|
|
51
|
+
persona show 查看当前 Agent 的 persona.md
|
|
52
|
+
persona --text <text> 用文本设置当前 Agent 的 persona.md
|
|
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
|
|
65
69
|
ec agent set mybot.agentid.pub active_baseagent codex
|
|
66
|
-
ec agent
|
|
67
|
-
ec agent
|
|
70
|
+
ec agent persona --text "你是一名严谨的诊断工程师。"
|
|
71
|
+
ec agent rename mybot.agentid.pub "New Name"
|
|
72
|
+
ec agent ready mybot.agentid.pub
|
|
68
73
|
ec agent delete mybot.agentid.pub --purge`);
|
|
69
74
|
return;
|
|
70
75
|
}
|
|
71
|
-
const { agentList, agentShow, agentCreateInteractive, agentCreateNonInteractive, agentReload, agentEnable, agentDisable, agentGet, agentSet, agentRename, agentDelete, agentReady, runManagedAgentOperation, } = await import('./agent.js');
|
|
72
|
-
|
|
76
|
+
const { agentList, agentShow, agentCreateInteractive, agentCreateNonInteractive, agentReload, agentEnable, agentDisable, agentGet, agentSet, agentPersona, agentRename, agentDelete, agentReady, runManagedAgentOperation, } = await import('./agent.js');
|
|
77
|
+
const { parseAgentOwnerArgs, parseAgentTags, resolveAgentCreatePlan, validateAgentCreatePlan } = await import('./agent-create.js');
|
|
78
|
+
if (process.env.EVOLCORE_SESSION_ID && !wantsHelp(args) && !new Set(['get', 'set', 'persona', 'ready']).has(sub)) {
|
|
73
79
|
if (sub === 'new' && !args.includes('--non-interactive')) {
|
|
74
80
|
const error = {
|
|
75
81
|
ok: false,
|
|
@@ -131,8 +137,8 @@ Options:
|
|
|
131
137
|
// --- list ---
|
|
132
138
|
if (sub === 'list') {
|
|
133
139
|
if (wantsHelp(args)) {
|
|
134
|
-
console.log(`用法: ec agent list [--format json]
|
|
135
|
-
|
|
140
|
+
console.log(`用法: ec agent list [--format json]
|
|
141
|
+
|
|
136
142
|
列出所有 agent,显示名称、状态、渠道、项目、基座、最后活跃时间。`);
|
|
137
143
|
return;
|
|
138
144
|
}
|
|
@@ -202,27 +208,39 @@ Options:
|
|
|
202
208
|
// --- new ---
|
|
203
209
|
if (sub === 'new') {
|
|
204
210
|
if (wantsHelp(args)) {
|
|
205
|
-
console.log(`用法: ec agent new [aid] 交互式创建
|
|
206
|
-
ec agent new <aid> --non-interactive [选项]
|
|
207
|
-
|
|
208
|
-
非交互模式选项:
|
|
209
|
-
--project <path> 默认: 当前目录
|
|
210
|
-
--baseagent <claude|codex|gemini|ecagent>
|
|
211
|
-
默认: 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 配置,否则检测本机可用基座
|
|
212
218
|
--owner <aid> 默认: daemon.json 第一个 owner
|
|
213
|
-
--
|
|
219
|
+
--owners <json-array> 多个 Owner;与 --owner 互斥
|
|
220
|
+
--handoff <context> 当前任务的 Bootstrap 上下文
|
|
221
|
+
--name <display-name> 默认: package.json name,否则目录名
|
|
214
222
|
--description <text> 默认: package.json description,否则使用 EvolCore 默认描述
|
|
215
|
-
--
|
|
216
|
-
--
|
|
217
|
-
--
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
ec agent new mybot.agentid.pub
|
|
222
|
-
ec agent new mybot.agentid.pub --non-interactive
|
|
223
|
+
--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
|
|
223
232
|
ec agent new mybot.agentid.pub --non-interactive --project ../project --baseagent claude`);
|
|
224
233
|
return;
|
|
225
234
|
}
|
|
235
|
+
if (args.includes('--handoff')) {
|
|
236
|
+
const result = { ok: false, code: 'MANAGED_ONLY', error: '--handoff requires a managed Agent task' };
|
|
237
|
+
if (formatJson)
|
|
238
|
+
console.log(JSON.stringify(result));
|
|
239
|
+
else
|
|
240
|
+
console.error(result.error);
|
|
241
|
+
process.exitCode = 1;
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
226
244
|
const name = args[1];
|
|
227
245
|
const nonInteractive = args.includes('--non-interactive');
|
|
228
246
|
if (nonInteractive) {
|
|
@@ -234,14 +252,41 @@ Options:
|
|
|
234
252
|
const idx = args.indexOf(flag);
|
|
235
253
|
return idx !== -1 && idx + 1 < args.length ? args[idx + 1] : undefined;
|
|
236
254
|
};
|
|
237
|
-
|
|
255
|
+
let ownerOptions;
|
|
256
|
+
try {
|
|
257
|
+
ownerOptions = parseAgentOwnerArgs(args);
|
|
258
|
+
}
|
|
259
|
+
catch (error) {
|
|
260
|
+
const result = { ok: false, error: error instanceof Error ? error.message : String(error) };
|
|
261
|
+
if (formatJson)
|
|
262
|
+
console.log(JSON.stringify(result));
|
|
263
|
+
else
|
|
264
|
+
console.error(`❌ ${result.error}`);
|
|
265
|
+
process.exitCode = 1;
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
let tags;
|
|
269
|
+
try {
|
|
270
|
+
tags = parseAgentTags(getArg('--tags'));
|
|
271
|
+
}
|
|
272
|
+
catch (error) {
|
|
273
|
+
const result = { ok: false, error: error instanceof Error ? error.message : String(error) };
|
|
274
|
+
if (formatJson)
|
|
275
|
+
console.log(JSON.stringify(result));
|
|
276
|
+
else
|
|
277
|
+
console.error(`❌ ${result.error}`);
|
|
278
|
+
process.exitCode = 1;
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
238
281
|
const plan = resolveAgentCreatePlan({
|
|
239
282
|
aid: name,
|
|
240
283
|
project: getArg('--project'),
|
|
241
284
|
baseagent: getArg('--baseagent'),
|
|
242
|
-
|
|
285
|
+
...ownerOptions,
|
|
286
|
+
handoff: getArg('--handoff'),
|
|
243
287
|
name: getArg('--name'),
|
|
244
288
|
description: getArg('--description'),
|
|
289
|
+
tags,
|
|
245
290
|
force: args.includes('--force'),
|
|
246
291
|
});
|
|
247
292
|
const validationError = validateAgentCreatePlan(plan);
|
|
@@ -263,7 +308,7 @@ Options:
|
|
|
263
308
|
console.log(` AID: ${plan.aid}`);
|
|
264
309
|
console.log(` Project: ${plan.project}`);
|
|
265
310
|
console.log(` Baseagent: ${plan.baseagent} (${plan.baseagentSource})`);
|
|
266
|
-
console.log(` Owner: ${plan.owner || '未设置'} (${plan.ownerSource})`);
|
|
311
|
+
console.log(` Owner: ${plan.owners?.join(', ') || plan.owner || '未设置'} (${plan.ownerSource})`);
|
|
267
312
|
console.log(` Name: ${plan.name} (${plan.nameSource})`);
|
|
268
313
|
if (plan.description)
|
|
269
314
|
console.log(` Description: ${plan.description} (${plan.descriptionSource})`);
|
|
@@ -276,8 +321,10 @@ Options:
|
|
|
276
321
|
baseagent: plan.baseagent,
|
|
277
322
|
project: plan.project,
|
|
278
323
|
owner: plan.owner,
|
|
324
|
+
owners: plan.owners,
|
|
279
325
|
name: plan.name,
|
|
280
326
|
description: plan.description,
|
|
327
|
+
tags: plan.tags,
|
|
281
328
|
force: args.includes('--force'),
|
|
282
329
|
});
|
|
283
330
|
if (!result.ok) {
|
|
@@ -373,11 +420,11 @@ Options:
|
|
|
373
420
|
// --- reload ---
|
|
374
421
|
if (sub === 'reload') {
|
|
375
422
|
if (wantsHelp(args)) {
|
|
376
|
-
console.log(`用法: ec agent reload [aid] [--force] [--format json]
|
|
377
|
-
|
|
378
|
-
热重载 agent 配置。
|
|
379
|
-
无参数 全量 resync(扫磁盘,新增上线、删除下线、修改热更新)
|
|
380
|
-
<aid> 仅热重载指定 agent
|
|
423
|
+
console.log(`用法: ec agent reload [aid] [--force] [--format json]
|
|
424
|
+
|
|
425
|
+
热重载 agent 配置。
|
|
426
|
+
无参数 全量 resync(扫磁盘,新增上线、删除下线、修改热更新)
|
|
427
|
+
<aid> 仅热重载指定 agent
|
|
381
428
|
--force 中断目标 Agent 的运行中任务并清空排队任务后重载(仅与 <aid> 同用)`);
|
|
382
429
|
return;
|
|
383
430
|
}
|
|
@@ -409,9 +456,9 @@ Options:
|
|
|
409
456
|
// --- enable ---
|
|
410
457
|
if (sub === 'enable') {
|
|
411
458
|
if (wantsHelp(args)) {
|
|
412
|
-
console.log(`用法: ec agent enable <aid> [--force] [--format json]
|
|
413
|
-
|
|
414
|
-
启用 agent。若服务运行中会热重载,否则下次 ec start 时生效。
|
|
459
|
+
console.log(`用法: ec agent enable <aid> [--force] [--format json]
|
|
460
|
+
|
|
461
|
+
启用 agent。若服务运行中会热重载,否则下次 ec start 时生效。
|
|
415
462
|
--force 中断目标 Agent 的运行中任务并清空排队任务后重载`);
|
|
416
463
|
return;
|
|
417
464
|
}
|
|
@@ -441,9 +488,9 @@ Options:
|
|
|
441
488
|
// --- disable ---
|
|
442
489
|
if (sub === 'disable') {
|
|
443
490
|
if (wantsHelp(args)) {
|
|
444
|
-
console.log(`用法: ec agent disable <aid> [--force] [--format json]
|
|
445
|
-
|
|
446
|
-
停用 agent。若服务运行中会热重载离线,否则在配置中标记为禁用。
|
|
491
|
+
console.log(`用法: ec agent disable <aid> [--force] [--format json]
|
|
492
|
+
|
|
493
|
+
停用 agent。若服务运行中会热重载离线,否则在配置中标记为禁用。
|
|
447
494
|
--force 中断目标 Agent 的运行中任务并清空排队任务后重载`);
|
|
448
495
|
return;
|
|
449
496
|
}
|
|
@@ -471,16 +518,94 @@ Options:
|
|
|
471
518
|
return;
|
|
472
519
|
}
|
|
473
520
|
// --- get ---
|
|
474
|
-
if (sub === '
|
|
521
|
+
if (sub === 'persona') {
|
|
475
522
|
if (wantsHelp(args)) {
|
|
476
|
-
console.log(`用法: ec agent
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
托管任务通过 daemon 统一鉴权;无会话的本机 CLI 走控制面。
|
|
523
|
+
console.log(`用法: ec agent persona show [--format json]
|
|
524
|
+
ec agent persona --text <text> [--format json]
|
|
525
|
+
ec agent persona --file <path> [--format json]
|
|
480
526
|
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
527
|
+
读取或设置当前 Agent 的 persona.md。--file 只接受 .md/.txt 文本文件。`);
|
|
528
|
+
return;
|
|
529
|
+
}
|
|
530
|
+
const formatSuffix = args.length >= 3
|
|
531
|
+
&& args.at(-2) === '--format'
|
|
532
|
+
&& args.at(-1) === 'json';
|
|
533
|
+
const commandArgs = formatSuffix ? args.slice(0, -2) : args;
|
|
534
|
+
const personaArgs = commandArgs.slice(1);
|
|
535
|
+
const invalid = (error) => {
|
|
536
|
+
const result = { ok: false, code: 'INVALID_ARGS', error };
|
|
537
|
+
if (formatJson)
|
|
538
|
+
console.log(JSON.stringify(result));
|
|
539
|
+
else
|
|
540
|
+
console.error(`❌ ${result.error}`);
|
|
541
|
+
process.exitCode = 1;
|
|
542
|
+
return;
|
|
543
|
+
};
|
|
544
|
+
if (!formatSuffix && args.includes('--format')) {
|
|
545
|
+
invalid('persona 仅支持末尾的 --format json');
|
|
546
|
+
return;
|
|
547
|
+
}
|
|
548
|
+
let text;
|
|
549
|
+
let file;
|
|
550
|
+
if (personaArgs.length === 1 && personaArgs[0] === 'show') {
|
|
551
|
+
// show is the only read form; no payload is accepted.
|
|
552
|
+
}
|
|
553
|
+
else if (personaArgs.length === 2 && personaArgs[0] === '--text') {
|
|
554
|
+
text = personaArgs[1];
|
|
555
|
+
if (text === undefined) {
|
|
556
|
+
invalid('persona --text 缺少参数');
|
|
557
|
+
return;
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
else if (personaArgs.length === 2 && personaArgs[0] === '--file') {
|
|
561
|
+
file = personaArgs[1];
|
|
562
|
+
if (!file || file.startsWith('-')) {
|
|
563
|
+
invalid('persona --file 缺少有效路径');
|
|
564
|
+
return;
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
else {
|
|
568
|
+
invalid('用法: ec agent persona show | --text <text> | --file <path>');
|
|
569
|
+
return;
|
|
570
|
+
}
|
|
571
|
+
const taskAid = process.env.EVOLCORE_SESSION_ID ? (readTaskRuntimeContextFromEnv()?.selfAid || '') : '';
|
|
572
|
+
const aid = taskAid || process.env.EVOLCORE_SELF_AID || '';
|
|
573
|
+
if (!aid) {
|
|
574
|
+
const result = { ok: false, code: 'INVALID_ARGS', error: '无法确定当前 Agent AID' };
|
|
575
|
+
if (formatJson)
|
|
576
|
+
console.log(JSON.stringify(result));
|
|
577
|
+
else
|
|
578
|
+
console.error(`❌ ${result.error}`);
|
|
579
|
+
process.exitCode = 1;
|
|
580
|
+
return;
|
|
581
|
+
}
|
|
582
|
+
const result = await agentPersona(aid, { text, file });
|
|
583
|
+
if (!result.ok) {
|
|
584
|
+
if (formatJson)
|
|
585
|
+
console.log(JSON.stringify(result));
|
|
586
|
+
else
|
|
587
|
+
console.error(`❌ ${result.error}`);
|
|
588
|
+
process.exitCode = 1;
|
|
589
|
+
return;
|
|
590
|
+
}
|
|
591
|
+
if (formatJson)
|
|
592
|
+
console.log(JSON.stringify(result, null, 2));
|
|
593
|
+
else if (result.saved)
|
|
594
|
+
console.log(`✓ ${aid} persona.md 已保存`);
|
|
595
|
+
else
|
|
596
|
+
console.log(result.content ?? '(persona.md 不存在)');
|
|
597
|
+
return;
|
|
598
|
+
}
|
|
599
|
+
if (sub === 'get') {
|
|
600
|
+
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
|
|
484
609
|
ec agent get mybot.agentid.pub channels.aun.enabled`);
|
|
485
610
|
return;
|
|
486
611
|
}
|
|
@@ -512,15 +637,15 @@ Options:
|
|
|
512
637
|
// --- set ---
|
|
513
638
|
if (sub === 'set') {
|
|
514
639
|
if (wantsHelp(args)) {
|
|
515
|
-
console.log(`用法: ec agent set <aid> <key> <value> [--format json]
|
|
516
|
-
|
|
517
|
-
修改单个配置字段。key 支持点路径。本机控制面会尝试热重载;托管任务如需重载须另行执行 agent reload。
|
|
518
|
-
托管任务通过 daemon 统一鉴权;无会话的本机 CLI 走控制面。
|
|
519
|
-
|
|
520
|
-
示例:
|
|
521
|
-
ec agent set mybot.agentid.pub active_baseagent codex
|
|
522
|
-
ec agent set mybot.agentid.pub observable true
|
|
523
|
-
ec agent set mybot.agentid.pub observable false
|
|
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
|
|
524
649
|
ec agent set mybot.agentid.pub channels.aun.enabled true`);
|
|
525
650
|
return;
|
|
526
651
|
}
|
|
@@ -552,8 +677,8 @@ Options:
|
|
|
552
677
|
// --- ready ---
|
|
553
678
|
if (sub === 'ready') {
|
|
554
679
|
if (wantsHelp(args)) {
|
|
555
|
-
console.log(`用法: ec agent ready <aid> [--format json]
|
|
556
|
-
|
|
680
|
+
console.log(`用法: ec agent ready <aid> [--format json]
|
|
681
|
+
|
|
557
682
|
标记 agent bootstrap 已完成,将 lifecycle 切换为 active。该命令允许 agent 在工具调用中自报完成。`);
|
|
558
683
|
return;
|
|
559
684
|
}
|
|
@@ -583,10 +708,10 @@ Options:
|
|
|
583
708
|
// --- delete ---
|
|
584
709
|
if (sub === 'delete') {
|
|
585
710
|
if (wantsHelp(args)) {
|
|
586
|
-
console.log(`用法: ec agent delete <aid> [--purge] [--format json]
|
|
587
|
-
|
|
588
|
-
删除 agent 的配置。
|
|
589
|
-
--purge 同时清除该 agent 的会话、消息、日志等运行时数据
|
|
711
|
+
console.log(`用法: ec agent delete <aid> [--purge] [--format json]
|
|
712
|
+
|
|
713
|
+
删除 agent 的配置。
|
|
714
|
+
--purge 同时清除该 agent 的会话、消息、日志等运行时数据
|
|
590
715
|
默认 仅删除 config.json,运行时数据保留`);
|
|
591
716
|
return;
|
|
592
717
|
}
|
|
@@ -617,8 +742,8 @@ Options:
|
|
|
617
742
|
// --- show ---
|
|
618
743
|
if (sub === 'show') {
|
|
619
744
|
if (wantsHelp(args)) {
|
|
620
|
-
console.log(`用法: ec agent show <aid> [--format json]
|
|
621
|
-
|
|
745
|
+
console.log(`用法: ec agent show <aid> [--format json]
|
|
746
|
+
|
|
622
747
|
查看 agent 详情:身份、配置、连接状态、会话路径等。`);
|
|
623
748
|
return;
|
|
624
749
|
}
|
|
@@ -647,8 +772,8 @@ Options:
|
|
|
647
772
|
// --- rename ---
|
|
648
773
|
if (sub === 'rename') {
|
|
649
774
|
if (wantsHelp(args)) {
|
|
650
|
-
console.log(`用法: ec agent rename <aid> <name> [--format json]
|
|
651
|
-
|
|
775
|
+
console.log(`用法: ec agent rename <aid> <name> [--format json]
|
|
776
|
+
|
|
652
777
|
修改本地 AIDs/<aid>/agent.md 中的 name 字段。`);
|
|
653
778
|
return;
|
|
654
779
|
}
|