evolcore 0.0.32 → 0.0.33
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 +24 -0
- package/bin/install-codex-managed-hooks.mjs +124 -37
- package/dist/agents/claude-runner.js +29 -2
- package/dist/agents/codex/app-server-client.js +3 -0
- package/dist/agents/codex/diagnostics.js +76 -44
- package/dist/agents/codex-runner.js +23 -19
- package/dist/agents/ecagent-runner.js +5 -13
- package/dist/aun/group/operations.js +0 -1
- package/dist/aun/msg/history.js +1 -0
- package/dist/aun/msg/p2p.js +0 -1
- package/dist/aun/outbox.js +50 -1
- package/dist/channels/aun.js +28 -2
- package/dist/channels/daemon.js +257 -2
- package/dist/cli/agent-command.js +58 -24
- package/dist/cli/agent.js +1 -1
- package/dist/cli/aun-commands.js +365 -29
- package/dist/cli/contact.js +8 -2
- package/dist/cli/daemon-commands.js +81 -12
- package/dist/cli/debug-mode.js +154 -0
- package/dist/cli/handoff-command.js +3 -0
- package/dist/cli/index.js +81 -64
- package/dist/cli/init.js +2 -2
- package/dist/cli/managed-command-guard.js +5 -0
- package/dist/cli/memory-command.js +8 -1
- package/dist/cli/queue-command.js +9 -4
- package/dist/cli/session-command.js +194 -0
- package/dist/cli/skill-command.js +78 -2
- package/dist/cli/task-context.js +1 -0
- package/dist/cli/thread-command.js +620 -0
- package/dist/cli/trigger-command.js +4 -2
- package/dist/config/builtin-roles.js +1 -0
- package/dist/config/config-field-policy.js +2 -3
- package/dist/config/config-manager.js +7 -2
- package/dist/config/resolved-config-op.js +3 -0
- package/dist/config-store.js +15 -0
- package/dist/core/auth/agent-delegation.js +25 -1
- package/dist/core/auth/debug-context.js +139 -0
- package/dist/core/auth/operation-authorizer.js +24 -1
- package/dist/core/auth/operation-catalog.js +33 -0
- package/dist/core/background-session/session-cleanup.js +212 -0
- package/dist/core/background-session/types.js +10 -0
- package/dist/core/bootstrap-messages.js +1 -1
- package/dist/core/bootstrap-service.js +6 -3
- package/dist/core/command/command-handler.js +60 -24
- package/dist/core/command/memory-slash.js +6 -2
- package/dist/core/command/menu-catalog.js +48 -1
- package/dist/core/command/menu-handler.js +92 -16
- package/dist/core/command/menu-protocol.js +24 -1
- package/dist/core/command/skill-slash.js +322 -0
- package/dist/core/command/slash-gate.js +6 -4
- package/dist/core/command/slash-handler.js +193 -13
- package/dist/core/command/topic-slash.js +528 -0
- package/dist/core/evolagent-registry.js +20 -5
- package/dist/core/handoff/runtime.js +5 -11
- package/dist/core/handoff/store.js +5 -0
- package/dist/core/ipc-registration.js +139 -2
- package/dist/core/memory/consolidation-context.js +49 -16
- package/dist/core/memory/consolidation-ops-records.js +35 -0
- package/dist/core/memory/consolidation-queue-format.js +21 -0
- package/dist/core/memory/consolidation.js +174 -180
- package/dist/core/message/aun-ipc-sender.js +161 -6
- package/dist/core/message/im-renderer.js +149 -6
- package/dist/core/message/message-bridge.js +13 -3
- package/dist/core/message/message-log.js +1 -0
- package/dist/core/message/peer-mode.js +6 -1
- package/dist/core/message/response-engine.js +349 -67
- package/dist/core/message/subtask-tool-projection.js +140 -0
- package/dist/core/model/catalog-service.js +17 -12
- package/dist/core/permission/ec-command-parser.js +126 -7
- package/dist/core/session/session-idle-monitor.js +249 -22
- package/dist/core/session/session-manager.js +54 -9
- package/dist/core/skill/command-parser.js +13 -0
- package/dist/core/skill/index-generator.js +4 -1
- package/dist/core/skill/startup.js +41 -0
- package/dist/core/skill/switch-resolver.js +55 -29
- package/dist/core/thread/command-parser.js +125 -0
- package/dist/core/thread/index.js +1 -0
- package/dist/core/thread/ipc-operation.js +95 -0
- package/dist/core/thread/thread-context-storage.js +131 -0
- package/dist/core/thread/thread-operation.js +258 -0
- package/dist/core/thread/thread-route.js +33 -0
- package/dist/core/thread/thread-service.js +777 -0
- package/dist/core/thread/types.js +1 -0
- package/dist/eck/message-renderer.js +35 -0
- package/dist/index.js +8 -5
- package/dist/ipc.js +89 -10
- package/dist/paths.js +23 -0
- package/dist/response-system/engines/v1/proactive-flow.js +169 -80
- package/dist/trigger/authorization.js +57 -28
- package/dist/trigger/feedback.js +7 -1
- package/dist/trigger/parser.js +63 -1
- package/dist/trigger/validation.js +14 -0
- package/dist/utils/error-utils.js +22 -1
- package/kits/docs/context-assembly.md +1 -0
- package/kits/docs/evolcore/INDEX.md +1 -0
- package/kits/docs/evolcore/agent-create.md +39 -28
- package/kits/docs/evolcore/agent.md +19 -4
- package/kits/docs/evolcore/ec-capabilities.md +4 -0
- package/kits/docs/evolcore/group-collaboration.md +3 -5
- package/kits/docs/evolcore/group.md +3 -4
- package/kits/docs/evolcore/memory-consolidation.md +1 -1
- package/kits/docs/evolcore/menu-exec-schema-commands.md +2 -2
- package/kits/docs/evolcore/menu-protocol.md +7 -0
- package/kits/docs/evolcore/msg.md +5 -8
- package/kits/docs/evolcore/thread-chain.md +267 -0
- package/kits/docs/prompt-loading-architecture.md +1 -0
- package/kits/eck_manifest.json +61 -26
- package/kits/eck_message_manifest.json +169 -10
- package/kits/rules/05-venue.md +1 -1
- package/kits/rules/07-memory-and-thread.md +202 -0
- package/kits/schemas/relation-config.schema.9.json +18 -3
- package/kits/schemas/role-config.schema.1.json +6 -6
- package/kits/schemas/single-session.schema.1.json +6 -6
- package/kits/schemas/single-session.schema.2.json +6 -6
- package/kits/schemas/single-session.schema.3.json +6 -6
- package/kits/skills/.switches.json +12 -1
- package/kits/skills/ec-group/SKILL.md +234 -0
- package/kits/skills/ec-skill/SKILL.md +10 -1
- package/kits/skills/ec-skill/scripts/cli.mjs +15 -1
- package/kits/skills/scrapling-article-fetch/SKILL.md +128 -0
- package/kits/skills/scrapling-article-fetch/scripts/check_python_env.py +54 -0
- package/kits/skills/scrapling-article-fetch/scripts/render_markdown_reply.py +35 -0
- package/kits/skills/scrapling-article-fetch/scripts/run_pipeline.sh +16 -0
- package/kits/skills/scrapling-article-fetch/scripts/scrapling_fetch.py +344 -0
- package/kits/skills/thread-ops/SKILL.md +492 -0
- package/kits/skills/wechat-article-media-download/SKILL.md +65 -0
- package/kits/skills/wechat-article-media-download/scripts/download.py +163 -0
- package/kits/skills/wechat-article-reader/SKILL.md +97 -0
- package/kits/skills/wechat-article-reader/scripts/fetch.mjs +256 -0
- package/kits/templates/bootstrap-welcome.md +7 -7
- package/kits/templates/memory-consolidation/forget.md +5 -0
- package/kits/templates/memory-consolidation/generalize.md +5 -0
- package/kits/templates/memory-consolidation/profile.md +5 -0
- package/kits/templates/memory-consolidation/promote.md +5 -0
- package/kits/templates/message-fragments/item.md +2 -1
- package/kits/templates/message-fragments/thread-context.md +6 -0
- package/kits/templates/message-fragments/trigger-session.md +2 -0
- package/kits/templates/message-fragments/trigger-thread-check.md +2 -0
- package/kits/templates/roles/member.json +2 -0
- package/kits/templates/roles/visitor.json +2 -0
- package/kits/templates/system-fragments/bootstrap.md +66 -72
- package/kits/templates/system-fragments/channel.md +3 -6
- package/kits/templates/system-fragments/commands.md +1 -0
- package/kits/templates/system-fragments/managed-runtime.md +15 -0
- package/kits/templates/system-fragments/reply.md +3 -2
- package/kits/templates/system-fragments/session.md +5 -14
- package/package.json +3 -1
- package/kits/docs/evolcore/group-fs.md +0 -17
- package/kits/docs/venues/aun-group.md +0 -45
- package/kits/docs/venues/group.md +0 -43
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import fs from 'fs';
|
|
3
|
+
import { resolvePaths, resolveRoot } from '../paths.js';
|
|
4
|
+
import { scanChatDirs, readLastJsonlLine, } from '../core/session/session-fs-store.js';
|
|
5
|
+
const HELP_TEXT = `
|
|
6
|
+
ec session <command> [options]
|
|
7
|
+
|
|
8
|
+
本地会话文件查询(不经过 daemon,直接读 $EVOLCORE_HOME/agents/ 下的 session 存档)。
|
|
9
|
+
|
|
10
|
+
命令:
|
|
11
|
+
find <sessionId> 按 ec 会话 id(meta_YYYYMMDD_<ts>)定位 session 文件,
|
|
12
|
+
输出 agentSessionId 与所在位置等元数据
|
|
13
|
+
help 显示本帮助
|
|
14
|
+
|
|
15
|
+
选项:
|
|
16
|
+
--format json 以 JSON 格式输出(默认按人类可读格式)
|
|
17
|
+
|
|
18
|
+
说明:
|
|
19
|
+
meta_<ts> 这个 id 只含时间戳,不含路径信息。物理布局是
|
|
20
|
+
agents/<selfAid>/sessions/<channelSessionKey>/,主会话的 meta 文件在目录根,
|
|
21
|
+
话题会话的在 _threads/ 子目录。find 通过文件名扫描全量 chat 目录定位,
|
|
22
|
+
同一 id 理论上可命中多处(不同 agent/对端),全部列出。
|
|
23
|
+
`.trim();
|
|
24
|
+
function argValue(args, flag) {
|
|
25
|
+
const i = args.indexOf(flag);
|
|
26
|
+
return i >= 0 ? args[i + 1] : undefined;
|
|
27
|
+
}
|
|
28
|
+
function hasFlag(args, flag) {
|
|
29
|
+
return args.includes(flag);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* 在单个 chat 目录中查找指定 meta 文件名。
|
|
33
|
+
* 主会话 meta 位于目录根;话题会话 meta 位于 _threads/ 下。
|
|
34
|
+
*/
|
|
35
|
+
function findMetaInChatDir(chatDir, metaFileName) {
|
|
36
|
+
const hits = [];
|
|
37
|
+
for (const dir of [chatDir, path.join(chatDir, '_threads')]) {
|
|
38
|
+
try {
|
|
39
|
+
const entries = fs.readdirSync(dir);
|
|
40
|
+
if (entries.includes(metaFileName))
|
|
41
|
+
hits.push(path.join(dir, metaFileName));
|
|
42
|
+
}
|
|
43
|
+
catch { /* 目录不存在,跳过 */ }
|
|
44
|
+
}
|
|
45
|
+
return hits;
|
|
46
|
+
}
|
|
47
|
+
/** 在 _trash 中查找(话题删除后 session 文件移入 _trash)。 */
|
|
48
|
+
function findMetaInTrash(chatDir, metaFileName) {
|
|
49
|
+
const trashDir = path.join(chatDir, '_trash');
|
|
50
|
+
const hits = [];
|
|
51
|
+
try {
|
|
52
|
+
for (const entry of fs.readdirSync(trashDir)) {
|
|
53
|
+
if (entry === metaFileName || entry === `${metaFileName}.jsonl`) {
|
|
54
|
+
hits.push(path.join(trashDir, entry));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
catch { /* 目录不存在,跳过 */ }
|
|
59
|
+
return hits;
|
|
60
|
+
}
|
|
61
|
+
async function cmdFind(args) {
|
|
62
|
+
const jsonFormat = hasFlag(args, '--format') && argValue(args, '--format') === 'json'
|
|
63
|
+
|| hasFlag(args, '--json');
|
|
64
|
+
// 位置参数已在调用处剥掉子命令,第一个非 flag 参数即 sessionId
|
|
65
|
+
const rawId = args.find(a => !a.startsWith('-'));
|
|
66
|
+
if (!rawId) {
|
|
67
|
+
console.error('用法: ec session find <sessionId> [--format json]');
|
|
68
|
+
process.exitCode = 1;
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
// 允许传入带或不带 .jsonl 后缀的 id
|
|
72
|
+
const sessionId = rawId.endsWith('.jsonl') ? rawId.slice(0, -'.jsonl'.length) : rawId;
|
|
73
|
+
if (!sessionId.startsWith('meta_')) {
|
|
74
|
+
console.error(`✗ ec 会话 id 应以 meta_ 开头(如 meta_20261012_1791789158257),收到: ${rawId}`);
|
|
75
|
+
process.exitCode = 1;
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const metaFileName = `${sessionId}.jsonl`;
|
|
79
|
+
const p = resolvePaths();
|
|
80
|
+
const chatDirs = scanChatDirs(p.sessionsDir);
|
|
81
|
+
const found = [];
|
|
82
|
+
for (const chat of chatDirs) {
|
|
83
|
+
const locations = [
|
|
84
|
+
...findMetaInChatDir(chat.dirPath, metaFileName),
|
|
85
|
+
...findMetaInTrash(chat.dirPath, metaFileName),
|
|
86
|
+
];
|
|
87
|
+
for (const metaFile of locations) {
|
|
88
|
+
const meta = readLastJsonlLine(metaFile);
|
|
89
|
+
if (!meta)
|
|
90
|
+
continue;
|
|
91
|
+
found.push({
|
|
92
|
+
sessionId: meta.id || sessionId,
|
|
93
|
+
metaFile,
|
|
94
|
+
sessionKey: meta.sessionKey,
|
|
95
|
+
agentSessionId: meta.agentSessionId ?? null,
|
|
96
|
+
baseagent: meta.baseagent ?? null,
|
|
97
|
+
threadId: meta.threadId ?? null,
|
|
98
|
+
name: meta.name ?? null,
|
|
99
|
+
chatType: meta.chatType ?? null,
|
|
100
|
+
channelId: meta.channelId ?? chat.channelId,
|
|
101
|
+
selfAID: chat.selfAID,
|
|
102
|
+
projectPath: meta.projectPath ?? null,
|
|
103
|
+
updatedAt: meta.updatedAt,
|
|
104
|
+
updatedAtStr: meta.updatedAtStr,
|
|
105
|
+
createdAtStr: meta.createdAtStr,
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
// 兜底:active.json 的 id 字段也可能匹配(active 是 meta 的最新版快照)
|
|
110
|
+
if (found.length === 0) {
|
|
111
|
+
for (const chat of chatDirs) {
|
|
112
|
+
const activeFile = path.join(chat.dirPath, 'active.json');
|
|
113
|
+
const active = readJsonFileSafe(activeFile);
|
|
114
|
+
if (active && active.id === sessionId) {
|
|
115
|
+
found.push({
|
|
116
|
+
sessionId,
|
|
117
|
+
metaFile: activeFile,
|
|
118
|
+
sessionKey: active.sessionKey,
|
|
119
|
+
agentSessionId: active.agentSessionId ?? null,
|
|
120
|
+
baseagent: active.baseagent ?? null,
|
|
121
|
+
threadId: active.threadId ?? null,
|
|
122
|
+
name: active.name ?? null,
|
|
123
|
+
chatType: active.chatType ?? null,
|
|
124
|
+
channelId: active.channelId ?? chat.channelId,
|
|
125
|
+
selfAID: chat.selfAID,
|
|
126
|
+
projectPath: active.projectPath ?? null,
|
|
127
|
+
updatedAt: active.updatedAt,
|
|
128
|
+
updatedAtStr: active.updatedAtStr,
|
|
129
|
+
createdAtStr: active.createdAtStr,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
if (found.length === 0) {
|
|
135
|
+
if (jsonFormat) {
|
|
136
|
+
console.log(JSON.stringify({ ok: false, sessionId, found: [] }, null, 2));
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
console.error(`✗ 未找到会话 ${sessionId}(已扫描 ${resolveRoot()} 下 ${chatDirs.length} 个 chat 目录)`);
|
|
140
|
+
}
|
|
141
|
+
process.exitCode = 1;
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
if (jsonFormat) {
|
|
145
|
+
console.log(JSON.stringify({ ok: true, sessionId, found }, null, 2));
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
for (const f of found) {
|
|
149
|
+
console.log(`ec 会话 id: ${f.sessionId}`);
|
|
150
|
+
console.log(` agentSessionId: ${f.agentSessionId ?? '(空)'}`);
|
|
151
|
+
console.log(` baseagent: ${f.baseagent ?? '(未知)'}`);
|
|
152
|
+
console.log(` threadId: ${f.threadId ? f.threadId : '(主会话)'}`);
|
|
153
|
+
if (f.name)
|
|
154
|
+
console.log(` 名称: ${f.name}`);
|
|
155
|
+
if (f.chatType)
|
|
156
|
+
console.log(` 类型: ${f.chatType === 'group' ? '群聊' : '单聊'}`);
|
|
157
|
+
console.log(` 对端: ${f.channelId ?? ''}`);
|
|
158
|
+
console.log(` 本端 AID: ${f.selfAID ?? ''}`);
|
|
159
|
+
if (f.projectPath)
|
|
160
|
+
console.log(` 项目: ${f.projectPath}`);
|
|
161
|
+
if (f.updatedAtStr)
|
|
162
|
+
console.log(` 最近更新: ${f.updatedAtStr}`);
|
|
163
|
+
console.log(` meta 文件: ${f.metaFile}`);
|
|
164
|
+
if (f.metaFile.includes('_trash'))
|
|
165
|
+
console.log(` ⚠ 该话题已删除(文件在 _trash 中)`);
|
|
166
|
+
console.log('');
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
// readJsonFile 在 session-fs-store 中未导出别名导入成本高,这里本地实现同语义
|
|
170
|
+
function readJsonFileSafe(filePath) {
|
|
171
|
+
try {
|
|
172
|
+
const content = fs.readFileSync(filePath, 'utf-8');
|
|
173
|
+
return JSON.parse(content);
|
|
174
|
+
}
|
|
175
|
+
catch {
|
|
176
|
+
return undefined;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
export async function runSessionCommand(args) {
|
|
180
|
+
const sub = args[0];
|
|
181
|
+
if (!sub || sub === 'help' || hasFlag(args, '--help') || hasFlag(args, '-h')) {
|
|
182
|
+
console.log(HELP_TEXT);
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
switch (sub) {
|
|
186
|
+
case 'find':
|
|
187
|
+
await cmdFind(args.slice(1));
|
|
188
|
+
break;
|
|
189
|
+
default:
|
|
190
|
+
console.error(`✗ 未知子命令: ${sub}`);
|
|
191
|
+
console.log(HELP_TEXT);
|
|
192
|
+
process.exitCode = 1;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
@@ -13,12 +13,35 @@
|
|
|
13
13
|
* 两个入口(这里的 spawn 与模型侧直接 node脚本)环境变量一致,
|
|
14
14
|
* 脚本自己读 EVOLCORE_TASK_RUNTIME_CONTEXT 即可得到相同判据;
|
|
15
15
|
* 若在 CLI 层再判一遍,只是多一处会与脚本漂移的实现。
|
|
16
|
+
*
|
|
17
|
+
* 例外:`refresh` 不进脚本,直接走 daemon IPC(skill.refresh)——索引由 daemon
|
|
18
|
+
* 内的 index-generator 生成,鉴权也在 daemon 里做。其余子命令后续逐个迁到 IPC,
|
|
19
|
+
* 见 docs/skills/skill-refresh-ipc-implementation-plan.md。
|
|
16
20
|
*/
|
|
17
21
|
import path from 'path';
|
|
18
22
|
import { spawn } from 'child_process';
|
|
19
|
-
import { getPackageRoot, agentDir } from '../paths.js';
|
|
20
|
-
import {
|
|
23
|
+
import { getPackageRoot, agentDir, resolvePaths } from '../paths.js';
|
|
24
|
+
import { readTaskRuntimeContextFromEnv } from './task-context.js';
|
|
25
|
+
import { ipcQuery } from '../ipc.js';
|
|
26
|
+
import { readDelegationCredential } from '../core/auth/agent-delegation.js';
|
|
27
|
+
import { authorizeLocalCommand, TASK_RUNTIME_CONTEXT_ENV } from './task-context.js';
|
|
28
|
+
import { canonicalizeEvolcoreCommandArgv } from '../core/permission/ec-command-parser.js';
|
|
29
|
+
const REFRESH_USAGE = `用法: ec skill refresh <aid> [--json]
|
|
30
|
+
|
|
31
|
+
重建指定 Agent 的技能索引文件($AGENT_DIR/skills/.index-builtin.md / .index-local.md)。
|
|
32
|
+
由 daemon 生成,daemon 未运行时无法执行。
|
|
33
|
+
|
|
34
|
+
权限:
|
|
35
|
+
托管任务内 只能刷新当前 Agent,需要 owner 或 admin 角色
|
|
36
|
+
宿主终端 可刷新任意 Agent
|
|
37
|
+
|
|
38
|
+
示例:
|
|
39
|
+
ec skill refresh alice.agentid.pub`;
|
|
21
40
|
export async function cmdSkill(args) {
|
|
41
|
+
if (args[0] === 'refresh') {
|
|
42
|
+
await cmdSkillRefresh(args.slice(1));
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
22
45
|
const script = path.join(getPackageRoot(), 'kits', 'skills', 'ec-skill', 'scripts', 'cli.mjs');
|
|
23
46
|
// 脚本在包外运行,拿不到主程序的路径工具,这里把 Agent 目录显式传进去,
|
|
24
47
|
// 让它能定位 Agent 级 skills/ 与 .switches.json。
|
|
@@ -45,3 +68,56 @@ export async function cmdSkill(args) {
|
|
|
45
68
|
if (code !== 0)
|
|
46
69
|
process.exitCode = code;
|
|
47
70
|
}
|
|
71
|
+
async function cmdSkillRefresh(args) {
|
|
72
|
+
const asJson = args.includes('--json');
|
|
73
|
+
const positional = args.filter(a => !a.startsWith('--'));
|
|
74
|
+
if (args.includes('--help') || args.includes('-h') || positional.length === 0) {
|
|
75
|
+
console.log(REFRESH_USAGE);
|
|
76
|
+
if (positional.length === 0 && !args.includes('--help') && !args.includes('-h'))
|
|
77
|
+
process.exitCode = 1;
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const aid = positional[0];
|
|
81
|
+
const argv = canonicalizeEvolcoreCommandArgv(['ec', 'skill', 'refresh', ...args]).slice(1);
|
|
82
|
+
// 托管任务带会话与委托令牌;宿主终端两者都不带,由 ipcQuery 自动附上本机 control token。
|
|
83
|
+
const sessionId = process.env.EVOLCORE_SESSION_ID;
|
|
84
|
+
const delegationToken = sessionId ? readDelegationCredential() : undefined;
|
|
85
|
+
if (sessionId && !delegationToken) {
|
|
86
|
+
console.error('❌ 刷新失败 (DELEGATION_REQUIRED): 当前任务缺少委托令牌');
|
|
87
|
+
process.exitCode = 1;
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
let response;
|
|
91
|
+
try {
|
|
92
|
+
response = await ipcQuery(resolvePaths().socket, {
|
|
93
|
+
type: 'skill.refresh',
|
|
94
|
+
aid,
|
|
95
|
+
argv,
|
|
96
|
+
...(sessionId ? { sessionId, delegationToken } : {}),
|
|
97
|
+
}, 30_000, { throwOnError: true });
|
|
98
|
+
}
|
|
99
|
+
catch (e) {
|
|
100
|
+
console.error(`❌ 刷新失败 (DAEMON_UNAVAILABLE): ${e instanceof Error ? e.message : String(e)}`);
|
|
101
|
+
process.exitCode = 1;
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
if (asJson) {
|
|
105
|
+
console.log(JSON.stringify(response ?? { ok: false, code: 'DAEMON_UNAVAILABLE' }, null, 2));
|
|
106
|
+
if (!response?.ok)
|
|
107
|
+
process.exitCode = 1;
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
if (!response?.ok) {
|
|
111
|
+
const code = response?.code ?? (response ? 'FAILED' : 'DAEMON_UNAVAILABLE');
|
|
112
|
+
console.error(`❌ 刷新失败 (${code}): ${response?.error ?? '无法连接 evolcore daemon'}`);
|
|
113
|
+
if (response?.data?.nextStep)
|
|
114
|
+
console.error(` ${response.data.nextStep}`);
|
|
115
|
+
process.exitCode = 1;
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
console.log(`✓ 已重建 ${aid} 的技能索引`);
|
|
119
|
+
if (response.result) {
|
|
120
|
+
console.log(` 内置: ${response.result.builtinIndexPath}`);
|
|
121
|
+
console.log(` 本机: ${response.result.localIndexPath}`);
|
|
122
|
+
}
|
|
123
|
+
}
|
package/dist/cli/task-context.js
CHANGED
|
@@ -31,6 +31,7 @@ function normalizeTaskRuntimeContext(value) {
|
|
|
31
31
|
messageId: optionalString(value.messageId),
|
|
32
32
|
baseagent: optionalString(value.baseagent),
|
|
33
33
|
channel: optionalString(value.channel),
|
|
34
|
+
channelKey: optionalString(value.channelKey),
|
|
34
35
|
channelId: optionalString(value.channelId),
|
|
35
36
|
chatType: optionalString(value.chatType),
|
|
36
37
|
selfAid: optionalString(value.selfAid),
|