evolcore 0.0.35 → 0.0.37
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 +42 -0
- package/README.md +6 -0
- package/bin/install-codex-managed-hooks.mjs +20 -3
- package/dist/agents/baseagent-availability.js +1 -1
- package/dist/agents/baseagent.js +88 -0
- package/dist/agents/claude-runner.js +59 -12
- package/dist/agents/codex/app-server-client.js +18 -1
- package/dist/agents/codex-runner.js +262 -21
- package/dist/agents/ecagent-runner.js +47 -11
- package/dist/agents/gemini-runner.js +36 -12
- package/dist/aun/aid/client.js +4 -3
- package/dist/aun/aid/control-aid.js +270 -8
- package/dist/aun/aid/identity.js +6 -3
- package/dist/aun/aid/ownership-operation.js +58 -0
- package/dist/aun/aid/store.js +1 -0
- package/dist/aun/group/fs-download.js +67 -2
- package/dist/aun/group/history.js +20 -5
- package/dist/aun/group/operations.js +8 -2
- package/dist/aun/menu/client.js +39 -2
- package/dist/aun/menu/transport.js +1 -1
- package/dist/aun/msg/history.js +43 -4
- package/dist/aun/msg/managed-operation.js +30 -53
- package/dist/aun/msg/p2p.js +51 -15
- package/dist/aun/outbox.js +4 -0
- package/dist/channels/aun.js +260 -73
- package/dist/channels/daemon.js +6 -4
- package/dist/channels/feishu.js +3 -0
- package/dist/cli/agent-command.js +161 -223
- package/dist/cli/agent-create.js +190 -223
- package/dist/cli/agent.js +3 -1
- package/dist/cli/aid-bind-command.js +53 -0
- package/dist/cli/aun-commands.js +384 -91
- package/dist/cli/bench.js +1 -1
- package/dist/cli/cli-argv.js +74 -0
- package/dist/cli/daemon-commands.js +105 -74
- package/dist/cli/diag.js +1 -1
- package/dist/cli/fs-command.js +18 -19
- package/dist/cli/getmeta-command.js +159 -6
- package/dist/cli/index.js +6 -12
- package/dist/cli/init-channel.js +8 -55
- package/dist/cli/init.js +125 -218
- package/dist/cli/queue-command.js +11 -8
- package/dist/cli/restart-monitor.js +177 -85
- package/dist/cli/session-command.js +1 -1
- package/dist/cli/stats.js +7 -5
- package/dist/cli/thread-command.js +103 -30
- package/dist/cli/trigger-command.js +1 -1
- package/dist/cli/watch-msg-diag.js +1 -0
- package/dist/config/access-policy.js +2 -2
- package/dist/config/boot-log.js +14 -11
- package/dist/config/config-field-policy.js +9 -1
- package/dist/config/config-manager.js +176 -90
- package/dist/config/config-operation-service.js +7 -14
- package/dist/config/contact-book-store.js +142 -26
- package/dist/config/contact-book.js +4 -2
- package/dist/config/lifecycle.js +1 -1
- package/dist/config/owner-config.js +96 -0
- package/dist/config/peer-role-resolver.js +12 -18
- package/dist/config/providers-config.js +382 -0
- package/dist/config/providers-import.js +74 -0
- package/dist/config/providers-management.js +328 -0
- package/dist/config/providers.js +22 -0
- package/dist/config/resolved-config-op.js +17 -14
- package/dist/config/snapshot.js +28 -16
- package/dist/config-store.js +18 -14
- package/dist/core/agent-ipc-registration.js +21 -63
- package/dist/core/agent-runtime.js +16 -5
- package/dist/core/auth/agent-delegation.js +199 -25
- package/dist/core/auth/auth-gateway.js +44 -2
- package/dist/core/auth/authorization-denial.js +1 -1
- package/dist/core/auth/debug-context.js +2 -1
- package/dist/core/auth/delegation-authorization.js +2 -2
- package/dist/core/auth/delegation-diagnostics.js +4 -1
- package/dist/core/auth/operation-authorizer.js +10 -1
- package/dist/core/auth/operation-catalog.js +19 -1
- package/dist/core/bootstrap-service.js +43 -20
- package/dist/core/channel-loader.js +0 -1
- package/dist/core/channel-runtime.js +30 -4
- package/dist/core/command/agent-control.js +196 -37
- package/dist/core/command/cli-intent-parser.js +60 -4
- package/dist/core/command/command-handler.js +212 -60
- package/dist/core/command/connect-menu.js +1 -0
- package/dist/core/command/diag-service.js +5 -4
- package/dist/core/command/file-search.js +368 -0
- package/dist/core/command/menu-catalog.js +2 -1
- package/dist/core/command/menu-handler.js +292 -107
- package/dist/core/command/menu-protocol.js +23 -0
- package/dist/core/command/role-menu.js +7 -19
- package/dist/core/command/skill-slash.js +130 -25
- package/dist/core/command/slash-handler.js +101 -53
- package/dist/core/command/topic-slash.js +16 -5
- package/dist/core/daemon-bootstrap.js +7 -1
- package/dist/core/daemon-control.js +19 -1
- package/dist/core/daemon-lifecycle.js +2 -1
- package/dist/core/event-catalog.js +2 -0
- package/dist/core/evolagent-registry.js +13 -2
- package/dist/core/evolagent.js +3 -6
- package/dist/core/handoff/ipc-registration.js +2 -2
- package/dist/core/handoff/runtime.js +40 -6
- package/dist/core/handoff/store.js +1 -0
- package/dist/core/inference/text-inference.js +95 -6
- package/dist/core/ipc-registration.js +43 -24
- package/dist/core/memory/consolidation-context.js +4 -1
- package/dist/core/memory/consolidation.js +25 -14
- package/dist/core/message/aun-ipc-sender.js +296 -88
- package/dist/core/message/aun-request-registry.js +226 -0
- package/dist/core/message/create-status.js +33 -4
- package/dist/core/message/message-bridge.js +62 -13
- package/dist/core/message/message-log.js +0 -1
- package/dist/core/message/message-queue.js +4 -1
- package/dist/core/message/message-utils.js +8 -1
- package/dist/core/message/peer-mode.js +17 -9
- package/dist/core/message/response-engine.js +266 -124
- package/dist/core/message/retry-scheduler.js +11 -8
- package/dist/core/model/catalog-service.js +60 -18
- package/dist/core/model/model-catalog.js +112 -9
- package/dist/core/model/model-fallback.js +94 -26
- package/dist/core/ownership/owner-resolver.js +687 -0
- package/dist/core/permission/approval-gateway.js +196 -62
- package/dist/core/permission/ec-command-parser.js +138 -25
- package/dist/core/permission/filesystem-approval-scope.js +141 -0
- package/dist/core/permission/protected-paths.js +14 -1
- package/dist/core/permission/sandbox-runtime.js +171 -18
- package/dist/core/permission/tool-policy.js +13 -2
- package/dist/core/role/runtime-policy.js +3 -4
- package/dist/core/session/session-idle-monitor.js +10 -8
- package/dist/core/session/session-manager.js +72 -45
- package/dist/core/session/session-mapper.js +18 -7
- package/dist/core/session/session-renew.js +5 -4
- package/dist/core/session/session-title.js +2 -1
- package/dist/core/session/session-turn-coordinator.js +4 -2
- package/dist/core/skill/index-generator.js +2 -16
- package/dist/core/task/task-recovery-service.js +15 -2
- package/dist/core/thread/command-parser.js +28 -13
- package/dist/core/thread/index.js +1 -0
- package/dist/core/thread/ipc-operation.js +11 -8
- package/dist/core/thread/thread-operation.js +79 -44
- package/dist/core/thread/thread-route.js +54 -6
- package/dist/core/thread/thread-service.js +236 -45
- package/dist/core/thread/topic-id.js +248 -0
- package/dist/eck/kit-renderer.js +1 -1
- package/dist/eck/message-renderer.js +12 -2
- package/dist/index.js +50 -27
- package/dist/ipc.js +59 -6
- package/dist/paths.js +1 -0
- package/dist/product.js +1 -0
- package/dist/response-system/engines/v1/proactive-flow.js +10 -3
- package/dist/stats/db.js +8 -0
- package/dist/stats/writer.js +26 -4
- package/dist/trigger/authorization.js +48 -3
- package/dist/trigger/feedback.js +28 -10
- package/dist/trigger/ipc-service.js +86 -10
- package/dist/trigger/local-files.js +55 -23
- package/dist/trigger/scheduler.js +57 -11
- package/dist/trigger/system-definitions.js +1 -0
- package/dist/trigger/validation.js +44 -15
- package/dist/utils/aid-bind.js +17 -297
- package/dist/utils/avatar-upload.js +16 -4
- package/dist/utils/cross-platform.js +115 -36
- package/dist/utils/ecweb-supervisor.js +1 -1
- package/dist/utils/ecweb-utils.js +8 -1
- package/dist/utils/error-utils.js +44 -6
- package/dist/utils/instance-registry.js +12 -2
- package/dist/utils/npm-ops.js +102 -27
- package/dist/utils/package-version-info.js +72 -27
- package/dist/utils/restart-safety.js +50 -0
- package/dist/utils/upgrade-jobs.js +304 -0
- package/dist/utils/windows-autostart.js +17 -10
- package/kits/docs/INDEX.md +5 -0
- package/kits/docs/aun/ABILITY_CALLING.md +239 -0
- package/kits/docs/evolcore/INDEX.md +14 -3
- package/kits/docs/evolcore/agent-create.md +55 -141
- package/kits/docs/evolcore/agent.md +38 -16
- package/kits/docs/evolcore/aid.md +34 -0
- package/kits/docs/evolcore/config.md +20 -1
- package/kits/docs/evolcore/event.md +2 -2
- package/kits/docs/evolcore/fs.md +18 -2
- package/kits/docs/evolcore/group-collaboration.md +13 -246
- package/kits/docs/evolcore/group.md +2 -1
- package/kits/docs/evolcore/memory-consolidation-batches.md +1 -1
- package/kits/docs/evolcore/menu-protocol.md +65 -1
- package/kits/docs/evolcore/msg.md +64 -2
- package/kits/docs/evolcore/skill.md +86 -0
- package/kits/docs/evolcore/stats.md +6 -0
- package/kits/docs/evolcore/task.md +2 -0
- package/kits/docs/evolcore/thread-chain.md +145 -51
- package/kits/docs/evolcore/trigger.md +48 -3
- package/kits/eck_manifest.json +21 -0
- package/kits/eck_message_manifest.json +4 -4
- package/kits/migrations/migrate-role-config-v5.mjs +20 -7
- package/kits/rules/01-overview.md +2 -1
- package/kits/rules/03-identity.md +3 -1
- package/kits/rules/04-relation.md +1 -1
- package/kits/rules/07-memory-and-thread.md +1 -1
- package/kits/schemas/_meta.json +16 -1
- package/kits/schemas/agent-config.schema.13.json +44 -2
- package/kits/schemas/contact-book.schema.3.json +5 -0
- package/kits/schemas/daemon.schema.6.json +3 -1
- package/kits/schemas/daemon.schema.8.json +329 -0
- package/kits/schemas/defaults.schema.5.json +39 -3
- package/kits/schemas/providers.schema.1.json +76 -0
- package/kits/schemas/relation-config.schema.9.json +5 -1
- package/kits/skills/.switches.json +28 -0
- package/kits/skills/aid-ability/SKILL.md +214 -0
- package/kits/skills/ec-agent-create/SKILL.md +162 -0
- package/kits/skills/ec-group/SKILL.md +2 -1
- package/kits/skills/ec-group-collaboration/SKILL.md +228 -0
- package/kits/skills/ec-identity/SKILL.md +143 -0
- package/kits/skills/ec-skill/scripts/cli.mjs +36 -3
- package/kits/skills/ec-skill/scripts/skill.mjs +202 -15
- package/kits/skills/ec-trigger/SKILL.md +167 -0
- package/kits/skills/ec-trigger/references/examples.md +153 -0
- package/kits/skills/thread-ops/SKILL.md +108 -420
- package/kits/templates/message-fragments/thread-context.md +1 -2
- package/kits/templates/message-fragments/trigger-thread-check.md +1 -1
- package/kits/templates/roles/member.json +1 -1
- package/kits/templates/roles/visitor.json +1 -0
- package/kits/templates/system-fragments/bootstrap.md +1 -0
- package/kits/templates/system-fragments/channel.md +2 -1
- package/kits/templates/system-fragments/commands.md +5 -4
- package/kits/templates/system-fragments/identity.md +2 -0
- package/kits/templates/system-fragments/session.md +1 -1
- package/kits/templates/system-fragments/venue.md +1 -1
- package/package.json +4 -3
|
@@ -1,18 +1,27 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
import fs from 'fs';
|
|
3
|
-
import { resolvePaths, agentThreadIndexPath } from '../paths.js';
|
|
3
|
+
import { resolvePaths, agentThreadIndexPath, agentTriggersDir } from '../paths.js';
|
|
4
4
|
import { scanChatDirs, readLastJsonlLine, } from '../core/session/session-fs-store.js';
|
|
5
|
+
import { isMainTopicId } from '../core/thread/topic-id.js';
|
|
5
6
|
const HELP_TEXT = `
|
|
6
7
|
ec getmeta <id> [选项]
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
按任意一种标识查询本地会话或触发器的完整元数据(不经过 daemon,直接读存档)。
|
|
9
10
|
|
|
10
|
-
<id>
|
|
11
|
+
<id> 接受四种形态:
|
|
11
12
|
meta_YYYYMMDD_<ts> ec 会话 id(meta 文件名)
|
|
12
13
|
thread-<...> 话题 id(threadId)
|
|
13
14
|
<uuid> provider 侧会话 id(agentSessionId)
|
|
15
|
+
trig_<ts>_<hex> 触发器 id
|
|
14
16
|
|
|
15
|
-
|
|
17
|
+
触发器输出字段:
|
|
18
|
+
triggerId / agentAid / name / enabled / baseagent
|
|
19
|
+
executionSessionId 当前正在执行的 ec 会话 id(来自 active run)
|
|
20
|
+
origin.channelKey / origin.threadId / origin.session
|
|
21
|
+
feedback.strategy
|
|
22
|
+
source 命中位置:definition(触发器定义)/ active(有进行中 run)
|
|
23
|
+
|
|
24
|
+
会话输出字段:
|
|
16
25
|
sessionId / threadId / agentSessionId / peer / selfAID / baseagent
|
|
17
26
|
name / chatType / projectPath / updatedAt / metaFile
|
|
18
27
|
source 命中位置:meta(主会话)/ thread(话题)/ active / trash
|
|
@@ -71,15 +80,154 @@ function makeHit(meta, metaFile, source, selfAID, chatPeer) {
|
|
|
71
80
|
/**
|
|
72
81
|
* id 形态判定。
|
|
73
82
|
* - `meta_...` 按文件名直接命中,不读文件内容
|
|
74
|
-
* - `
|
|
83
|
+
* - `trig_...` 触发器 id,走 trigger 目录
|
|
84
|
+
* - `thread-...` / `main:<aid>:<aid>` 需要扫末行比对,成本高但只在必要时发生
|
|
85
|
+
* - 其余视为 provider 侧 agentSession UUID
|
|
75
86
|
*/
|
|
76
87
|
function classifyId(id) {
|
|
77
88
|
if (id.startsWith('meta_'))
|
|
78
89
|
return 'session';
|
|
90
|
+
if (id.startsWith('trig_'))
|
|
91
|
+
return 'trigger';
|
|
79
92
|
if (id.startsWith('thread-'))
|
|
80
93
|
return 'thread';
|
|
94
|
+
if (isMainTopicId(id))
|
|
95
|
+
return 'thread';
|
|
81
96
|
return 'agentSession';
|
|
82
97
|
}
|
|
98
|
+
/** 扫描所有 agent 下的 triggers 目录,查找匹配的 triggerId。 */
|
|
99
|
+
async function cmdGetTriggerMeta(id, selfFilter, jsonFormat) {
|
|
100
|
+
const p = resolvePaths();
|
|
101
|
+
// 枚举 agents 目录下所有 agent
|
|
102
|
+
// agentTriggersDir 形态:<agentDir(aid)>/triggers,agentDir 位于 data/agents/<aid>
|
|
103
|
+
// 从 sessionsDir(data/sessions)推断出 data/ 根目录
|
|
104
|
+
let agentIds = [];
|
|
105
|
+
const dataDir = path.dirname(p.sessionsDir);
|
|
106
|
+
const agentsDirPath = path.join(dataDir, 'agents');
|
|
107
|
+
try {
|
|
108
|
+
agentIds = fs.readdirSync(agentsDirPath).filter(e => {
|
|
109
|
+
if (selfFilter && e !== selfFilter)
|
|
110
|
+
return false;
|
|
111
|
+
return fs.statSync(path.join(agentsDirPath, e)).isDirectory();
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
catch {
|
|
115
|
+
agentIds = [];
|
|
116
|
+
}
|
|
117
|
+
const hits = [];
|
|
118
|
+
for (const aid of agentIds) {
|
|
119
|
+
const triggersRoot = agentTriggersDir(aid);
|
|
120
|
+
const defPath = path.join(triggersRoot, id, 'trigger.json');
|
|
121
|
+
if (!fs.existsSync(defPath))
|
|
122
|
+
continue;
|
|
123
|
+
let def;
|
|
124
|
+
try {
|
|
125
|
+
def = JSON.parse(fs.readFileSync(defPath, 'utf-8'));
|
|
126
|
+
}
|
|
127
|
+
catch {
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
// 读 active.json 拿当前 executionSessionId
|
|
131
|
+
let executionSessionId = null;
|
|
132
|
+
const activePath = path.join(triggersRoot, id, 'active.json');
|
|
133
|
+
try {
|
|
134
|
+
const activeFile = JSON.parse(fs.readFileSync(activePath, 'utf-8'));
|
|
135
|
+
// 取最新一个有 executionSessionId 的 run
|
|
136
|
+
const runs = Object.values(activeFile.runs ?? {});
|
|
137
|
+
for (const run of runs.sort((a, b) => b.startedAt - a.startedAt)) {
|
|
138
|
+
if (run.executionSessionId) {
|
|
139
|
+
executionSessionId = run.executionSessionId;
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
catch { /* no active file, that's fine */ }
|
|
145
|
+
hits.push({
|
|
146
|
+
triggerId: def.id,
|
|
147
|
+
agentAid: def.agentAid,
|
|
148
|
+
name: def.name,
|
|
149
|
+
enabled: def.enabled,
|
|
150
|
+
baseagent: def.execution.baseagent ?? null,
|
|
151
|
+
executionSessionId,
|
|
152
|
+
originChannelKey: def.origin?.channelKey ?? null,
|
|
153
|
+
originChannelId: def.origin?.channelId ?? null,
|
|
154
|
+
originSession: def.origin?.session ?? null,
|
|
155
|
+
originThreadId: def.origin?.threadId ?? null,
|
|
156
|
+
originPeerId: def.origin?.peerId ?? null,
|
|
157
|
+
feedbackStrategy: def.feedback.strategy ?? null,
|
|
158
|
+
feedbackTargetChannelKey: def.feedback.target?.channelKey ?? null,
|
|
159
|
+
feedbackTargetChannelId: def.feedback.target?.channelId ?? null,
|
|
160
|
+
feedbackTargetSession: def.feedback.target?.session ?? null,
|
|
161
|
+
feedbackTargetThreadId: def.feedback.target?.threadId ?? null,
|
|
162
|
+
feedbackTargetChatType: def.feedback.target?.chatType ?? null,
|
|
163
|
+
createdAt: def.createdAt ?? null,
|
|
164
|
+
updatedAt: def.updatedAt ?? null,
|
|
165
|
+
definitionFile: defPath,
|
|
166
|
+
source: fs.existsSync(activePath) ? 'active' : 'definition',
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
if (hits.length === 0) {
|
|
170
|
+
if (jsonFormat) {
|
|
171
|
+
console.log(JSON.stringify({ ok: false, id, kind: 'trigger', hits: [] }, null, 2));
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
console.error(`✗ 未找到触发器 ${id}(已扫描 ${agentIds.length} 个 agent 目录)`);
|
|
175
|
+
}
|
|
176
|
+
process.exitCode = 1;
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
if (jsonFormat) {
|
|
180
|
+
console.log(JSON.stringify({ ok: true, id, kind: 'trigger', hits }, null, 2));
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
for (const h of hits) {
|
|
184
|
+
console.log(`触发器 id: ${h.triggerId}`);
|
|
185
|
+
console.log(` 名称: ${h.name}`);
|
|
186
|
+
console.log(` 状态: ${h.enabled ? '启用' : '禁用'}`);
|
|
187
|
+
console.log(` 归属 agent: ${h.agentAid}`);
|
|
188
|
+
if (h.baseagent)
|
|
189
|
+
console.log(` 基座 (baseagent): ${h.baseagent}`);
|
|
190
|
+
console.log(` 执行会话 id: ${h.executionSessionId ?? '(无进行中 run)'}`);
|
|
191
|
+
if (h.originChannelKey)
|
|
192
|
+
console.log(` 来源 channel: ${h.originChannelKey}`);
|
|
193
|
+
if (h.originChannelId)
|
|
194
|
+
console.log(` 来源 channelId: ${h.originChannelId}`);
|
|
195
|
+
if (h.originSession)
|
|
196
|
+
console.log(` 来源 session 类型: ${h.originSession}${h.originThreadId ? ` / 话题 id: ${h.originThreadId}` : ''}`);
|
|
197
|
+
if (h.originPeerId)
|
|
198
|
+
console.log(` 来源对端: ${h.originPeerId}`);
|
|
199
|
+
if (h.feedbackStrategy) {
|
|
200
|
+
console.log(` 反馈策略: ${h.feedbackStrategy}`);
|
|
201
|
+
if (h.feedbackStrategy === 'origin') {
|
|
202
|
+
// origin 策略:反馈回到 origin,已在上方显示
|
|
203
|
+
if (h.originChannelKey)
|
|
204
|
+
console.log(` 反馈目标 (来自 origin): ${h.originChannelKey} / ${h.originChannelId ?? ''} / session=${h.originSession ?? ''}${h.originThreadId ? ` / 话题 id: ${h.originThreadId}` : ''}`);
|
|
205
|
+
}
|
|
206
|
+
else if (h.feedbackStrategy === 'target') {
|
|
207
|
+
if (h.feedbackTargetChannelKey)
|
|
208
|
+
console.log(` 反馈目标 channel: ${h.feedbackTargetChannelKey}`);
|
|
209
|
+
if (h.feedbackTargetChannelId)
|
|
210
|
+
console.log(` 反馈目标 channelId: ${h.feedbackTargetChannelId}`);
|
|
211
|
+
if (h.feedbackTargetSession)
|
|
212
|
+
console.log(` 反馈目标 session 类型: ${h.feedbackTargetSession}${h.feedbackTargetThreadId ? ` / 话题 id: ${h.feedbackTargetThreadId}` : ''}`);
|
|
213
|
+
if (h.feedbackTargetChatType)
|
|
214
|
+
console.log(` 反馈目标 chatType: ${h.feedbackTargetChatType}`);
|
|
215
|
+
}
|
|
216
|
+
else if (h.feedbackStrategy === 'event_session') {
|
|
217
|
+
console.log(` 反馈目标: 触发本次执行的事件所在会话(运行时动态决定)`);
|
|
218
|
+
}
|
|
219
|
+
else if (h.feedbackStrategy === 'silent') {
|
|
220
|
+
console.log(` 反馈目标: 静默(不发送任何反馈消息)`);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
if (h.createdAt)
|
|
224
|
+
console.log(` 创建时间: ${new Date(h.createdAt).toLocaleString()}`);
|
|
225
|
+
if (h.updatedAt)
|
|
226
|
+
console.log(` 更新时间: ${new Date(h.updatedAt).toLocaleString()}`);
|
|
227
|
+
console.log(` 文件: ${h.definitionFile}`);
|
|
228
|
+
console.log('');
|
|
229
|
+
}
|
|
230
|
+
}
|
|
83
231
|
async function cmdGetMeta(args) {
|
|
84
232
|
const jsonFormat = hasFlag(args, '--format') && argValue(args, '--format') === 'json'
|
|
85
233
|
|| hasFlag(args, '--json');
|
|
@@ -98,13 +246,18 @@ async function cmdGetMeta(args) {
|
|
|
98
246
|
break;
|
|
99
247
|
}
|
|
100
248
|
if (!rawId) {
|
|
101
|
-
console.error('用法: ec getmeta <sessionId|threadId|agentSessionId> [--self <aid>] [--format json]');
|
|
249
|
+
console.error('用法: ec getmeta <sessionId|threadId|agentSessionId|triggerId> [--self <aid>] [--format json]');
|
|
102
250
|
process.exitCode = 1;
|
|
103
251
|
return;
|
|
104
252
|
}
|
|
105
253
|
const id = rawId.endsWith('.jsonl') ? rawId.slice(0, -'.jsonl'.length) : rawId;
|
|
106
254
|
const selfFilter = argValue(args, '--self');
|
|
107
255
|
const kind = classifyId(id);
|
|
256
|
+
// trig_ 走独立的查询路径
|
|
257
|
+
if (kind === 'trigger') {
|
|
258
|
+
await cmdGetTriggerMeta(id, selfFilter, jsonFormat);
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
108
261
|
const p = resolvePaths();
|
|
109
262
|
const chatDirs = scanChatDirs(p.sessionsDir).filter(c => !selfFilter || c.selfAID === selfFilter);
|
|
110
263
|
const hits = [];
|
package/dist/cli/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import { getPackageRoot, resolvePaths } from '../paths.js';
|
|
|
7
7
|
import { ipcQuery } from '../ipc.js';
|
|
8
8
|
import { readDelegationCredential } from '../core/auth/agent-delegation.js';
|
|
9
9
|
import { cmdInit } from './init.js';
|
|
10
|
-
import { cmdInitWechat, cmdInitFeishu, cmdInitDingtalk, cmdInitQQBot, cmdInitWecom
|
|
10
|
+
import { cmdInitWechat, cmdInitFeishu, cmdInitDingtalk, cmdInitQQBot, cmdInitWecom } from './init-channel.js';
|
|
11
11
|
import { isHelpFlag, wantsHelp, getArgValue } from './help.js';
|
|
12
12
|
import * as platform from '../utils/cross-platform.js';
|
|
13
13
|
import { cmdRestartMonitor } from './restart-monitor.js';
|
|
@@ -86,7 +86,7 @@ function printLifecycleHelp(command) {
|
|
|
86
86
|
logs: `用法: ec logs [选项]\n\n --level <error|warn|info|debug> 最低日志级别\n --module <name> 只显示指定模块\n --raw 原始输出\n --no-color 禁用颜色`,
|
|
87
87
|
watch: `用法: ec watch [logs|log|aid|msg|diag|web|session]\n\n ec watch 打开监控选择菜单\n ec watch logs 选择日志类型后监控\n ec watch log <类型...> 直接监控指定日志类型\n ec watch aid 监控 AID 连接\n ec watch msg 打开消息 TUI\n ec watch diag 实时诊断消息生命周期(AUN→daemon→任务)\n ec watch web 安装/升级并启动 EC Web\n ec watch session ec watch web 的兼容别名`,
|
|
88
88
|
'restart-monitor': '用法: ec restart-monitor\n\n运行内 daemon 重启与升级监控器。',
|
|
89
|
-
diagnose: '用法: ec diagnose [--codex-hook]\n\n
|
|
89
|
+
diagnose: '用法: ec diagnose [--codex-hook] [--claude-sandbox] [--codex-sandbox]\n\n检查配置、数据库、进程和编译产物;配置 Codex/Claude Agent 时检查对应 Linux 沙箱。\n\n --codex-hook 运行 Windows Codex managed hook 启动探针。\n --claude-sandbox 即使未配置 Claude 也运行沙箱检查。\n --codex-sandbox 即使未配置 Codex 也运行 Codex bwrap/userns 探针。',
|
|
90
90
|
mv: '用法: ec mv <old-directory> <new-directory>\n\n迁移项目目录以及 Claude、Codex 和 EvolCore 会话路径。',
|
|
91
91
|
};
|
|
92
92
|
console.log(help[command]);
|
|
@@ -144,17 +144,16 @@ export async function main(args) {
|
|
|
144
144
|
|
|
145
145
|
云部署非交互式初始化(结构化 JSON 输出):
|
|
146
146
|
ec init --non-interactive --owner <aid> [--format json] [选项]
|
|
147
|
-
--owner <aid>
|
|
147
|
+
--owner <aid> 必填。控制 AID 创建后的 Owner 邀约目标,不等待审批
|
|
148
148
|
--baseagent <claude|codex|gemini|ecagent> 可选。默认从 PATH 检测,ecagent 需显式选择
|
|
149
149
|
--projectpath <abs-path> 可选。默认项目目录(必须绝对路径,自动创建)
|
|
150
150
|
--ecweb 可选。安装 EC Web 并启用自启动
|
|
151
151
|
--auto-start Windows/macOS 上启用 EvolCore 登录自启动
|
|
152
152
|
--no-auto-start Windows/macOS 上禁用 EvolCore 登录自启动
|
|
153
153
|
--format json 可选但推荐。stdout 输出 init.result JSON
|
|
154
|
-
--force
|
|
154
|
+
--force 兼容参数,不覆盖已有协议 Owner 或注册绑定意图
|
|
155
155
|
|
|
156
156
|
配置渠道(先 ec agent new 创建 agent):
|
|
157
|
-
ec init aun AUN owner 追加绑定(daemon 或指定 agent)
|
|
158
157
|
ec init feishu 飞书扫码登录
|
|
159
158
|
ec init wechat 微信扫码登录
|
|
160
159
|
ec init dingtalk 钉钉扫码登录
|
|
@@ -165,12 +164,7 @@ export async function main(args) {
|
|
|
165
164
|
const hasChannelTarget = Boolean(strippedArgs[1] && !strippedArgs[1].startsWith('-'));
|
|
166
165
|
if (hasChannelTarget)
|
|
167
166
|
printInitCancelHint();
|
|
168
|
-
if (strippedArgs[1] === '
|
|
169
|
-
const { suppressSdkLogs } = await import('../aun/aid/index.js');
|
|
170
|
-
suppressSdkLogs();
|
|
171
|
-
await cmdInitAun();
|
|
172
|
-
}
|
|
173
|
-
else if (strippedArgs[1] === 'wechat') {
|
|
167
|
+
if (strippedArgs[1] === 'wechat') {
|
|
174
168
|
const { suppressSdkLogs } = await import('../aun/aid/index.js');
|
|
175
169
|
suppressSdkLogs();
|
|
176
170
|
await cmdInitWechat();
|
|
@@ -194,7 +188,7 @@ export async function main(args) {
|
|
|
194
188
|
await cmdInitWecom();
|
|
195
189
|
}
|
|
196
190
|
else if (strippedArgs[1] && !strippedArgs[1].startsWith('-')) {
|
|
197
|
-
const supported = ['feishu', 'wechat', '
|
|
191
|
+
const supported = ['feishu', 'wechat', 'dingtalk', 'qqbot', 'wecom'];
|
|
198
192
|
console.error(`❌ 不支持的渠道: ${strippedArgs[1]}`);
|
|
199
193
|
console.error(` 支持的渠道: ${supported.join(', ')}`);
|
|
200
194
|
process.exit(1);
|
package/dist/cli/init-channel.js
CHANGED
|
@@ -6,9 +6,11 @@
|
|
|
6
6
|
* - run<Channel>QrFlow() or setupAun*() — reusable primitives for the main init wizard
|
|
7
7
|
*/
|
|
8
8
|
import readline from 'readline';
|
|
9
|
+
import { cmdAidBind } from './aid-bind-command.js';
|
|
10
|
+
import { getOwners } from '../core/ownership/owner-resolver.js';
|
|
9
11
|
import crypto from 'crypto';
|
|
10
12
|
import { selectInstance } from './init.js';
|
|
11
|
-
import { loadAllAgents, loadAgent,
|
|
13
|
+
import { loadAllAgents, loadAgent, loadDaemonConfig } from '../config-store.js';
|
|
12
14
|
import { agentChannelUpsert } from './agent.js';
|
|
13
15
|
import { isValidAid } from '../aun/aid/index.js';
|
|
14
16
|
import { resolvePaths } from '../paths.js';
|
|
@@ -692,47 +694,8 @@ export async function cmdInitWechat() {
|
|
|
692
694
|
}
|
|
693
695
|
// ==================== AUN ====================
|
|
694
696
|
export async function cmdInitAun() {
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
console.log('❌ 未找到控制 AID,请先运行 ec init');
|
|
698
|
-
return;
|
|
699
|
-
}
|
|
700
|
-
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
701
|
-
try {
|
|
702
|
-
const target = await pickAunOwnerBindTarget(rl, daemonConfig.aid);
|
|
703
|
-
const runQrFlow = async (flow) => {
|
|
704
|
-
rl.pause();
|
|
705
|
-
try {
|
|
706
|
-
return await flow();
|
|
707
|
-
}
|
|
708
|
-
finally {
|
|
709
|
-
rl.resume();
|
|
710
|
-
}
|
|
711
|
-
};
|
|
712
|
-
if (target.kind === 'daemon') {
|
|
713
|
-
console.log(`\n📡 EvolCore daemon owner 追加绑定 — ${daemonConfig.aid}\n`);
|
|
714
|
-
const result = await runQrFlow(() => runDaemonOwnerQrBindFlow());
|
|
715
|
-
if (result.action === 'bound') {
|
|
716
|
-
console.log(`\n✅ daemon owner 已绑定: ${result.boundAid}`);
|
|
717
|
-
return;
|
|
718
|
-
}
|
|
719
|
-
if (result.action === 'manual')
|
|
720
|
-
await promptDaemonOwnerManually(rl);
|
|
721
|
-
return;
|
|
722
|
-
}
|
|
723
|
-
const agentConfig = loadAgent(target.aid);
|
|
724
|
-
console.log(`\n📡 Agent owner 追加绑定 — ${target.aid}\n`);
|
|
725
|
-
const result = await runQrFlow(() => runAgentOwnerQrBindFlow(target.aid, agentConfig?.aid ?? target.aid));
|
|
726
|
-
if (result.action === 'bound') {
|
|
727
|
-
console.log(`\n✅ agent owner 已绑定: ${result.boundAid}`);
|
|
728
|
-
return;
|
|
729
|
-
}
|
|
730
|
-
if (result.action === 'manual')
|
|
731
|
-
await promptAgentOwnerForAunManually(rl, target.aid);
|
|
732
|
-
}
|
|
733
|
-
finally {
|
|
734
|
-
rl.close();
|
|
735
|
-
}
|
|
697
|
+
console.log('AUN 协议 Owner 统一使用 ec aid bind <ownerAid> [--subject <subjectAid>]');
|
|
698
|
+
console.log('状态查询: ec aid bind status [--subject <subjectAid>];Evol App 扫码绑定留待二期。');
|
|
736
699
|
}
|
|
737
700
|
async function pickAunOwnerBindTarget(rl, daemonAid) {
|
|
738
701
|
const { agents } = loadAllAgents();
|
|
@@ -761,9 +724,7 @@ async function promptDaemonOwnerManually(rl) {
|
|
|
761
724
|
console.log(' ⚠ Owner AID 格式无效(需合法多级域名,如 alice.agentid.pub)');
|
|
762
725
|
return;
|
|
763
726
|
}
|
|
764
|
-
|
|
765
|
-
saveDaemonConfig({ ...loadDaemonConfig(), owners });
|
|
766
|
-
console.log(`✅ daemon owner 已设置: ${fallback}`);
|
|
727
|
+
await cmdAidBind([fallback]);
|
|
767
728
|
}
|
|
768
729
|
async function promptAgentOwnerForAunManually(rl, aid) {
|
|
769
730
|
const fallback = (await ask(rl, '\n扫码未完成。手动输入 agent owner AID(留空跳过): ')).trim();
|
|
@@ -778,15 +739,7 @@ async function promptAgentOwnerForAunManually(rl, aid) {
|
|
|
778
739
|
console.log(` ⚠ 无法加载 agent 配置: ${aid}`);
|
|
779
740
|
return;
|
|
780
741
|
}
|
|
781
|
-
|
|
782
|
-
saveAgent({ ...agent, owners });
|
|
783
|
-
try {
|
|
784
|
-
const result = await ipcQuery(resolvePaths().socket, { type: 'evolagent.reload', name: aid }, 30_000);
|
|
785
|
-
if (result?.ok)
|
|
786
|
-
console.log(' ✓ agent owner 已热重载');
|
|
787
|
-
}
|
|
788
|
-
catch { /* daemon not running */ }
|
|
789
|
-
console.log(`✅ agent owner 已设置: ${fallback}`);
|
|
742
|
+
await cmdAidBind([fallback, '--subject', aid]);
|
|
790
743
|
}
|
|
791
744
|
// ==================== DingTalk ====================
|
|
792
745
|
const DINGTALK_BASE_URL = 'https://oapi.dingtalk.com';
|
|
@@ -1497,7 +1450,7 @@ function preferredContactBindingCandidates(agentConfig) {
|
|
|
1497
1450
|
}
|
|
1498
1451
|
set.add(label);
|
|
1499
1452
|
};
|
|
1500
|
-
for (const owner of agentConfig.
|
|
1453
|
+
for (const owner of getOwners(agentConfig.aid))
|
|
1501
1454
|
add(owner, 'owner');
|
|
1502
1455
|
for (const admin of listStaticAgentAdmins(agentConfig.aid))
|
|
1503
1456
|
add(admin, 'admin');
|