evolcore 0.0.31 → 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 +35 -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 +51 -24
- package/dist/agents/ecagent-runner.js +9 -13
- package/dist/agents/gemini-runner.js +4 -0
- package/dist/aun/aid/store.js +0 -81
- package/dist/aun/group/fs-download.js +1 -10
- package/dist/aun/group/operations.js +0 -1
- package/dist/aun/msg/history.js +1 -0
- package/dist/aun/msg/managed-operation.js +130 -32
- package/dist/aun/msg/p2p.js +0 -1
- package/dist/aun/outbox.js +50 -1
- package/dist/aun/service-proxy.js +12 -18
- package/dist/aun/storage/index.js +29 -0
- package/dist/channels/aun.js +38 -137
- package/dist/channels/daemon.js +257 -2
- package/dist/cli/agent-command.js +64 -31
- package/dist/cli/agent-create.js +43 -24
- package/dist/cli/agent.js +16 -70
- package/dist/cli/aun-commands.js +512 -32
- package/dist/cli/contact.js +8 -2
- package/dist/cli/ctl-command.js +1 -2
- package/dist/cli/daemon-commands.js +82 -13
- package/dist/cli/debug-mode.js +154 -0
- package/dist/cli/diag.js +2 -2
- package/dist/cli/handoff-command.js +18 -5
- 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 +93 -12
- package/dist/cli/model.js +14 -138
- package/dist/cli/queue-command.js +51 -0
- package/dist/cli/response.js +5 -54
- package/dist/cli/session-command.js +194 -0
- package/dist/cli/skill-command.js +85 -3
- package/dist/cli/stats.js +10 -4
- package/dist/cli/task-command.js +1 -0
- package/dist/cli/task-context.js +16 -0
- package/dist/cli/thread-command.js +620 -0
- package/dist/cli/trigger-command.js +76 -50
- package/dist/config/builtin-roles.js +9 -7
- 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/agent-ipc-registration.js +65 -22
- package/dist/core/auth/agent-delegation.js +42 -2
- package/dist/core/auth/debug-context.js +139 -0
- package/dist/core/auth/delegation-authorization.js +1 -0
- package/dist/core/auth/operation-authorizer.js +24 -1
- package/dist/core/auth/operation-catalog.js +44 -3
- 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 +224 -45
- package/dist/core/command/diag-service.js +5 -1
- 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/ipc-registration.js +38 -0
- package/dist/core/handoff/runtime.js +5 -11
- package/dist/core/handoff/store.js +5 -0
- package/dist/core/ipc-registration.js +210 -9
- 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 +207 -8
- 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/message-queue.js +131 -3
- package/dist/core/message/peer-mode.js +6 -1
- package/dist/core/message/response-engine.js +379 -69
- 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/permission/sandbox-runtime.js +14 -1
- 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/task/task-recovery-service.js +2 -0
- package/dist/core/task/task-resume-operation.js +11 -0
- 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 +10 -7
- package/dist/ipc.js +234 -17
- package/dist/paths.js +23 -0
- package/dist/response-system/engines/v1/proactive-flow.js +169 -80
- package/dist/trigger/authorization.js +59 -29
- package/dist/trigger/feedback.js +7 -1
- package/dist/trigger/ipc-service.js +49 -35
- package/dist/trigger/parser.js +63 -1
- package/dist/trigger/script-sandbox.js +58 -77
- package/dist/trigger/validation.js +14 -0
- package/dist/utils/error-utils.js +22 -1
- package/kits/docs/AUTHORING.md +1 -1
- package/kits/docs/channels/aun.md +8 -0
- package/kits/docs/context-assembly.md +1 -0
- package/kits/docs/evolcore/INDEX.md +3 -2
- 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/task.md +2 -0
- package/kits/docs/evolcore/thread-chain.md +267 -0
- package/kits/docs/evolcore/trigger.md +2 -2
- 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/01-overview.md +0 -9
- package/kits/rules/05-venue.md +1 -1
- package/kits/rules/06-channel.md +7 -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 +2 -1
- 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
|
@@ -13,25 +13,54 @@
|
|
|
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';
|
|
23
|
+
import { getPackageRoot, agentDir, resolvePaths } from '../paths.js';
|
|
20
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。
|
|
25
48
|
// selfAid 优先取任务运行时上下文(托管会话的权威来源),其次环境变量。
|
|
26
49
|
const env = { ...process.env };
|
|
27
|
-
const
|
|
28
|
-
|
|
50
|
+
const runtime = process.env.EVOLCORE_SESSION_ID ? await authorizeLocalCommand(['skill', ...args]) : undefined;
|
|
51
|
+
const selfAid = runtime?.selfAid ?? readTaskRuntimeContextFromEnv()?.selfAid ?? process.env.EVOLCORE_SELF_AID;
|
|
52
|
+
if (runtime) {
|
|
53
|
+
env[TASK_RUNTIME_CONTEXT_ENV] = JSON.stringify(runtime);
|
|
54
|
+
env.EVOLCORE_SELF_AID = selfAid;
|
|
55
|
+
}
|
|
56
|
+
if (selfAid && (runtime || !env.EVOLCORE_AGENT_DIR)) {
|
|
29
57
|
env.EVOLCORE_AGENT_DIR = agentDir(selfAid);
|
|
30
58
|
}
|
|
31
59
|
const code = await new Promise((resolve, reject) => {
|
|
32
60
|
const child = spawn(process.execPath, [script, ...args], {
|
|
33
61
|
stdio: 'inherit',
|
|
34
62
|
env,
|
|
63
|
+
cwd: runtime?.projectPath,
|
|
35
64
|
});
|
|
36
65
|
child.on('error', reject);
|
|
37
66
|
child.on('exit', (c) => resolve(c ?? 0));
|
|
@@ -39,3 +68,56 @@ export async function cmdSkill(args) {
|
|
|
39
68
|
if (code !== 0)
|
|
40
69
|
process.exitCode = code;
|
|
41
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/stats.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { resolveRoot } from '../paths.js';
|
|
5
5
|
import { wantsHelp } from './help.js';
|
|
6
|
-
import {
|
|
6
|
+
import { authorizeLocalCommand } from './task-context.js';
|
|
7
7
|
import { queryAggregated, querySessionTurns, queryContextBreakdown, queryTopPeers, queryTopModels, queryMessageAggregated, queryPeerList, querySummary, queryPeerDaily, queryTaskModelCalls, querySessionModelCalls } from '../stats/query.js';
|
|
8
8
|
import { getBudgetStatus } from '../stats/budget.js';
|
|
9
9
|
const HELP = `ec stats — Token 用量与费用统计
|
|
@@ -124,10 +124,16 @@ const AGENT_SCOPE_ROLES = new Set(['owner', 'admin']);
|
|
|
124
124
|
* is confined to its own relation and session. Returns undefined outside a
|
|
125
125
|
* managed task, leaving direct terminal usage unchanged.
|
|
126
126
|
*/
|
|
127
|
-
async function resolveManagedStatsScope(flags, isJson) {
|
|
127
|
+
async function resolveManagedStatsScope(flags, isJson, argv) {
|
|
128
128
|
if (!process.env.EVOLCORE_SESSION_ID)
|
|
129
129
|
return undefined;
|
|
130
|
-
|
|
130
|
+
let runtime;
|
|
131
|
+
try {
|
|
132
|
+
runtime = await authorizeLocalCommand(argv);
|
|
133
|
+
}
|
|
134
|
+
catch (error) {
|
|
135
|
+
fail(isJson, 'NOT_ALLOWED', error instanceof Error ? error.message : String(error));
|
|
136
|
+
}
|
|
131
137
|
const role = runtime?.peerRole?.trim();
|
|
132
138
|
const selfAid = runtime?.selfAid?.trim();
|
|
133
139
|
// Fail closed: without a resolved identity and role there is no scope to
|
|
@@ -225,7 +231,7 @@ export async function handleStats(args) {
|
|
|
225
231
|
const isJson = flags.format === 'json';
|
|
226
232
|
// Authorize before any branch runs: `--rebuild` writes, and every read view
|
|
227
233
|
// below would otherwise see the whole database.
|
|
228
|
-
const managedScope = await resolveManagedStatsScope(flags, isJson);
|
|
234
|
+
const managedScope = await resolveManagedStatsScope(flags, isJson, ['stats', ...args]);
|
|
229
235
|
if (managedScope)
|
|
230
236
|
enforceManagedSelector(managedScope, flags, isJson);
|
|
231
237
|
// 全量重建日聚合表(运维兜底/排查),不依赖时间范围。
|
package/dist/cli/task-command.js
CHANGED
package/dist/cli/task-context.js
CHANGED
|
@@ -27,9 +27,11 @@ function normalizeTaskRuntimeContext(value) {
|
|
|
27
27
|
return {
|
|
28
28
|
taskId: optionalString(value.taskId),
|
|
29
29
|
sessionId: optionalString(value.sessionId),
|
|
30
|
+
projectPath: optionalAbsolutePath(value.projectPath),
|
|
30
31
|
messageId: optionalString(value.messageId),
|
|
31
32
|
baseagent: optionalString(value.baseagent),
|
|
32
33
|
channel: optionalString(value.channel),
|
|
34
|
+
channelKey: optionalString(value.channelKey),
|
|
33
35
|
channelId: optionalString(value.channelId),
|
|
34
36
|
chatType: optionalString(value.chatType),
|
|
35
37
|
selfAid: optionalString(value.selfAid),
|
|
@@ -347,6 +349,20 @@ export function parseTaskRuntimeContext(raw) {
|
|
|
347
349
|
export function readTaskRuntimeContextFromEnv(env = process.env) {
|
|
348
350
|
return parseTaskRuntimeContext(env[TASK_RUNTIME_CONTEXT_ENV]);
|
|
349
351
|
}
|
|
352
|
+
export async function authorizeLocalCommand(argv) {
|
|
353
|
+
const sessionId = process.env.EVOLCORE_SESSION_ID;
|
|
354
|
+
const delegationToken = readDelegationCredential();
|
|
355
|
+
if (!sessionId || !delegationToken)
|
|
356
|
+
throw new Error('Local command requires an active task delegation');
|
|
357
|
+
const [{ resolvePaths }, { ipcQuery }] = await Promise.all([import('../paths.js'), import('../ipc.js')]);
|
|
358
|
+
const result = await ipcQuery(resolvePaths().socket, {
|
|
359
|
+
type: 'local-command-context', argv, sessionId, delegationToken,
|
|
360
|
+
}, 10_000);
|
|
361
|
+
if (!result?.ok || !result.context?.selfAid || !result.context.peerRole) {
|
|
362
|
+
throw new Error(result?.error ?? 'Daemon command authorization is unavailable');
|
|
363
|
+
}
|
|
364
|
+
return result.context;
|
|
365
|
+
}
|
|
350
366
|
export async function readTaskRuntimeContextFromDaemon(sessionId, timeoutMs = 500, env = process.env) {
|
|
351
367
|
if (!sessionId)
|
|
352
368
|
return undefined;
|