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 @@
|
|
|
1
|
+
export {};
|
|
@@ -50,6 +50,8 @@ function renderOneItem(item, sessionVars, sessionCache, contentSentinel) {
|
|
|
50
50
|
};
|
|
51
51
|
const isOwnerHint = item.kind === 'owner-hint';
|
|
52
52
|
const isHandoff = item.kind === 'handoff';
|
|
53
|
+
const isThreadContext = item.kind === 'thread-context';
|
|
54
|
+
const isTriggerMsg = item.kind === 'trigger';
|
|
53
55
|
const handoffPreviousSentinel = `\x00ECMSG-HANDOFF-PREV-${randomUUID()}\x00`;
|
|
54
56
|
const requiredReplacements = (item.handoff?.requiredEntries ?? []).map(entry => ({
|
|
55
57
|
entry,
|
|
@@ -131,6 +133,39 @@ function renderOneItem(item, sessionVars, sessionCache, contentSentinel) {
|
|
|
131
133
|
injectTime: isOwnerHint
|
|
132
134
|
? formatLocalTime(item.injectTime ?? item.timestamp ?? Date.now(), sessionVars.timezone ? String(sessionVars.timezone) : undefined)
|
|
133
135
|
: undefined,
|
|
136
|
+
// T4: 跨会话上下文(thread-inbox 注入)
|
|
137
|
+
isThreadContext,
|
|
138
|
+
threadContextOriginThreadId: item.threadContext?.originThreadId,
|
|
139
|
+
threadContextOriginPeer: item.threadContext?.originPeer,
|
|
140
|
+
threadContextTime: item.timestamp !== undefined
|
|
141
|
+
? formatLocalTime(item.timestamp, sessionVars.timezone ? String(sessionVars.timezone) : undefined)
|
|
142
|
+
: undefined,
|
|
143
|
+
threadContextGapHasNewMessages: item.threadContext?.gapDetection.hasNewMessages === true,
|
|
144
|
+
threadContextGapCount: item.threadContext?.gapDetection.count,
|
|
145
|
+
// M1: 空洞检测失败(来源话题的 messages.jsonl 缺失/损坏)时,gapDetection 保守返回
|
|
146
|
+
// hasNewMessages=false,与"确实无新消息"渲染结果相同。透出 error 让模板提示"无法检测",
|
|
147
|
+
// 避免 agent 把检测失败误读成"来源话题无更新"。
|
|
148
|
+
threadContextGapError: item.threadContext?.gapDetection.error,
|
|
149
|
+
threadContextGapRange: (() => {
|
|
150
|
+
const g = item.threadContext?.gapDetection;
|
|
151
|
+
if (!g?.hasNewMessages || g.firstTimestamp === undefined || g.lastTimestamp === undefined)
|
|
152
|
+
return undefined;
|
|
153
|
+
const tz = sessionVars.timezone ? String(sessionVars.timezone) : undefined;
|
|
154
|
+
return `${formatLocalTime(g.firstTimestamp, tz)} - ${formatLocalTime(g.lastTimestamp, tz)}`;
|
|
155
|
+
})(),
|
|
156
|
+
threadContextTriggerId: item.threadContext?.triggerId,
|
|
157
|
+
// T9: trigger 消息专属信封变量
|
|
158
|
+
isTriggerMsg,
|
|
159
|
+
triggerMsgId: isTriggerMsg ? item.triggerInfo?.triggerId : undefined,
|
|
160
|
+
triggerMsgName: isTriggerMsg ? item.triggerInfo?.triggerName : undefined,
|
|
161
|
+
triggerMsgFireTime: isTriggerMsg && item.triggerInfo?.fireTime !== undefined
|
|
162
|
+
? formatLocalTime(item.triggerInfo.fireTime, sessionVars.timezone ? String(sessionVars.timezone) : undefined)
|
|
163
|
+
: undefined,
|
|
164
|
+
// T10: labels 路由 key(默认 'default')+ 动态展开 triggerMsgLabel_<key>
|
|
165
|
+
triggerMsgKind: isTriggerMsg ? (item.triggerInfo?.labels?.kind ?? 'default') : undefined,
|
|
166
|
+
...(isTriggerMsg && item.triggerInfo?.labels
|
|
167
|
+
? Object.fromEntries(Object.entries(item.triggerInfo.labels).map(([k, v]) => [`triggerMsgLabel_${k}`, v]))
|
|
168
|
+
: {}),
|
|
134
169
|
// msg send 跨会话一次性上下文
|
|
135
170
|
isHandoff,
|
|
136
171
|
handoffKind: item.handoff?.kind,
|
package/dist/index.js
CHANGED
|
@@ -22,7 +22,7 @@ import { createSessionIdentityResolver } from './config/peer-role-resolver.js';
|
|
|
22
22
|
import { initializeStartupConfig, prepareStartupConfig, recordStartupConfig } from './config/boot-log.js';
|
|
23
23
|
import { CONFIG_SCHEMA_VERSION } from './types.js';
|
|
24
24
|
import { SessionManager } from './core/session/session-manager.js';
|
|
25
|
-
import { SessionIdleMonitor,
|
|
25
|
+
import { SessionIdleMonitor, readSessionLoopIdleSeconds } from './core/session/session-idle-monitor.js';
|
|
26
26
|
import { ClaudeAgentPlugin } from './agents/claude-runner.js';
|
|
27
27
|
import { CodexAgentPlugin } from './agents/codex-runner.js';
|
|
28
28
|
import { GeminiAgentPlugin } from './agents/gemini-runner.js';
|
|
@@ -426,13 +426,15 @@ async function main() {
|
|
|
426
426
|
getSessionById: sessionId => sessionManager.getSessionById(sessionId),
|
|
427
427
|
isSessionBusy: sessionId => messageQueue.isProcessing(sessionId) || messageQueue.getQueueLength(sessionId) > 0,
|
|
428
428
|
getSessionIdleTriggerIds: () => triggerSchedulers.sessionIdleTriggerIds(),
|
|
429
|
-
getSessionIdleSeconds:
|
|
429
|
+
getSessionIdleSeconds: readSessionLoopIdleSeconds,
|
|
430
430
|
getSessionEncrypt: sessionId => sessionManager.getSessionEncrypt(sessionId),
|
|
431
|
+
isCurrentMainSession: session => sessionManager.getActiveSessionSync(session.channel, session.channelId)?.id === session.id,
|
|
431
432
|
});
|
|
432
433
|
sessionIdleMonitor.start();
|
|
433
434
|
onConfigWrite(({ target, selector }) => {
|
|
434
|
-
if (target === ConfigTarget.Relation && selector.self)
|
|
435
|
-
sessionIdleMonitor.
|
|
435
|
+
if (target === ConfigTarget.Relation && selector.self && selector.peerKey) {
|
|
436
|
+
void sessionIdleMonitor.refreshRelation(selector.self, selector.peerKey);
|
|
437
|
+
}
|
|
436
438
|
});
|
|
437
439
|
onShutdown(() => sessionIdleMonitor.stop());
|
|
438
440
|
const targetSessionLocks = new TargetSessionLockRegistry();
|
|
@@ -490,10 +492,11 @@ async function main() {
|
|
|
490
492
|
sessionManager,
|
|
491
493
|
getAgent: aid => agentRegistry.get(aid),
|
|
492
494
|
agentMap,
|
|
493
|
-
releaseSlot: aid => consolidationQueue.release(aid),
|
|
495
|
+
releaseSlot: (aid, sessionId) => consolidationQueue.release(aid, sessionId),
|
|
494
496
|
enqueueConsolidation,
|
|
495
497
|
sendFeedback: sendConsolidationFeedback,
|
|
496
498
|
});
|
|
499
|
+
consolidationQueue.setFinalizer(finishConsolidationSession);
|
|
497
500
|
registerConsolidationSessionEvents({
|
|
498
501
|
eventBus,
|
|
499
502
|
permissionGateway,
|
package/dist/ipc.js
CHANGED
|
@@ -17,6 +17,7 @@ import { getProcessStartTime, isSameOrOlderProcess } from './utils/process-intro
|
|
|
17
17
|
import { classifyProcessTree, ProcessTreeSampler, readProcessMetrics } from './utils/process-tree-stats.js';
|
|
18
18
|
import { readSystemMemoryUsage } from './utils/system-memory.js';
|
|
19
19
|
import { hashCurrentDelegatedCommand, hashDelegatedCommandArgv } from './core/auth/agent-delegation.js';
|
|
20
|
+
import { resolveSkillRefreshArgv } from './core/skill/command-parser.js';
|
|
20
21
|
import { normalizeAunMentionEntries } from './aun/msg/mention-schema.js';
|
|
21
22
|
import { remoteAccessService } from './core/auth/remote-access-store.js';
|
|
22
23
|
import { setModelCatalogDaemonOwner } from './core/model/model-catalog.js';
|
|
@@ -83,7 +84,7 @@ const MEMORY_COMMAND_ENDPOINTS = new Set([
|
|
|
83
84
|
const DELEGATED_ARGV_ENDPOINTS = new Set([
|
|
84
85
|
'agent.op', 'config.op', 'contact.op', 'aid.op', 'group.op', 'msg.op', 'fs.op',
|
|
85
86
|
'ctl', 'diag', 'menu-client.request', 'task.resume', 'queue.op', 'storage.auth', 'storage.upload',
|
|
86
|
-
'trigger.op', 'local-command-context', 'evolagent.bootstrapComplete', ...MEMORY_COMMAND_ENDPOINTS,
|
|
87
|
+
'trigger.op', 'skill.refresh', 'thread.op', 'local-command-context', 'evolagent.bootstrapComplete', ...MEMORY_COMMAND_ENDPOINTS,
|
|
87
88
|
'handoff-return', 'handoff-recover-return', 'handoff-status', 'handoff-list', 'handoff-trace',
|
|
88
89
|
]);
|
|
89
90
|
let ipcQuerySequence = 0;
|
|
@@ -105,9 +106,17 @@ function nextIpcQueryId(cmd) {
|
|
|
105
106
|
function requiresLocalControlToken(cmd) {
|
|
106
107
|
// Managed calls use task delegation. Standalone queries must not gain
|
|
107
108
|
// management scope merely by omitting (or emptying) sessionId.
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
109
|
+
const type = String(cmd.type ?? '');
|
|
110
|
+
const sessionId = typeof cmd.sessionId === 'string' && cmd.sessionId.trim();
|
|
111
|
+
const delegated = typeof cmd.delegationToken === 'string' && cmd.delegationToken.trim();
|
|
112
|
+
if (cmd.type === 'evolagent.initialize' || LOCAL_CONTROL_COMMANDS.has(type))
|
|
113
|
+
return true;
|
|
114
|
+
if (type === 'debug-issue-token')
|
|
115
|
+
return true;
|
|
116
|
+
if (type === 'skill.refresh' || type === 'thread.op')
|
|
117
|
+
return !sessionId || !delegated;
|
|
118
|
+
return ['evolagent.bootstrapComplete', 'diag', 'handoff-status', 'handoff-list', 'handoff-trace', 'task.resume'].includes(type)
|
|
119
|
+
&& !sessionId;
|
|
111
120
|
}
|
|
112
121
|
/** Preserve the pipe DACL and grant only the provisioned Codex users data I/O. */
|
|
113
122
|
function grantWindowsSandboxPipeAccess(endpoint) {
|
|
@@ -164,6 +173,7 @@ export class IpcServer {
|
|
|
164
173
|
aunAidStatsRecorder;
|
|
165
174
|
menuExecutor;
|
|
166
175
|
agentOperationExecutor;
|
|
176
|
+
skillRefreshExecutor;
|
|
167
177
|
initializationExecutor;
|
|
168
178
|
statsProvider;
|
|
169
179
|
agentStatsProvider;
|
|
@@ -182,6 +192,7 @@ export class IpcServer {
|
|
|
182
192
|
shutdownExecutor;
|
|
183
193
|
taskRuntimeContextProvider;
|
|
184
194
|
debugTaskRuntimeContextProvider;
|
|
195
|
+
debugIssueTokenExecutor;
|
|
185
196
|
taskRuntimeContextAuthorizer;
|
|
186
197
|
codexPreToolUseExecutor;
|
|
187
198
|
aunMsgSender;
|
|
@@ -199,6 +210,7 @@ export class IpcServer {
|
|
|
199
210
|
groupOperationExecutor;
|
|
200
211
|
msgOperationExecutor;
|
|
201
212
|
fsOperationExecutor;
|
|
213
|
+
threadOperationExecutor;
|
|
202
214
|
dingtalkContactBindExecutor;
|
|
203
215
|
feishuContactBindExecutor;
|
|
204
216
|
qqbotContactBindExecutor;
|
|
@@ -286,6 +298,9 @@ export class IpcServer {
|
|
|
286
298
|
setAgentOperationExecutor(executor) {
|
|
287
299
|
this.agentOperationExecutor = executor;
|
|
288
300
|
}
|
|
301
|
+
setSkillRefreshExecutor(executor) {
|
|
302
|
+
this.skillRefreshExecutor = executor;
|
|
303
|
+
}
|
|
289
304
|
setConfigOperationExecutor(executor) {
|
|
290
305
|
this.configOperationExecutor = executor;
|
|
291
306
|
}
|
|
@@ -304,6 +319,9 @@ export class IpcServer {
|
|
|
304
319
|
setFsOperationExecutor(executor) {
|
|
305
320
|
this.fsOperationExecutor = executor;
|
|
306
321
|
}
|
|
322
|
+
setThreadOperationExecutor(executor) {
|
|
323
|
+
this.threadOperationExecutor = executor;
|
|
324
|
+
}
|
|
307
325
|
setAgentReloadExecutor(executor) {
|
|
308
326
|
this.agentReloadExecutor = executor;
|
|
309
327
|
}
|
|
@@ -439,7 +457,7 @@ export class IpcServer {
|
|
|
439
457
|
setTriggerExecutor(executor) {
|
|
440
458
|
this.triggerExecutor = executor;
|
|
441
459
|
}
|
|
442
|
-
/** Inject daemon-level consolidation launcher
|
|
460
|
+
/** Inject daemon-level consolidation launcher (BackgroundSessionLauncher, via executor closure). */
|
|
443
461
|
setConsolidationLaunchExecutor(executor) {
|
|
444
462
|
this.consolidationLaunchExecutor = executor;
|
|
445
463
|
}
|
|
@@ -455,15 +473,17 @@ export class IpcServer {
|
|
|
455
473
|
setTaskRuntimeContextProvider(provider) {
|
|
456
474
|
this.taskRuntimeContextProvider = provider;
|
|
457
475
|
}
|
|
458
|
-
/** 仅开发仓(npm link)安装注册;正式安装不调用,debug 请求一律走正常路径。 */
|
|
459
476
|
setDebugTaskRuntimeContextProvider(provider) {
|
|
460
477
|
this.debugTaskRuntimeContextProvider = provider;
|
|
461
478
|
}
|
|
479
|
+
/** debug 模式:注册 debug-issue-token executor,仅 EVOLCORE_DEBUG_MODE=1 时由 index.ts 调用。 */
|
|
480
|
+
setDebugIssueTokenExecutor(executor) {
|
|
481
|
+
this.debugIssueTokenExecutor = executor;
|
|
482
|
+
}
|
|
462
483
|
/**
|
|
463
|
-
* memory
|
|
464
|
-
* 再由开发仓专用的 provider 从会话文件重建。
|
|
484
|
+
* memory 命令取运行时上下文:查正在运行的任务。
|
|
465
485
|
*/
|
|
466
|
-
async resolveMemoryTaskCtx(sessionId, debug) {
|
|
486
|
+
async resolveMemoryTaskCtx(sessionId, debug = false) {
|
|
467
487
|
const active = this.taskRuntimeContextProvider?.({ sessionId });
|
|
468
488
|
if (active || !debug || !this.debugTaskRuntimeContextProvider)
|
|
469
489
|
return active;
|
|
@@ -479,6 +499,14 @@ export class IpcServer {
|
|
|
479
499
|
setAunMsgSender(sender) {
|
|
480
500
|
this.aunMsgSender = sender;
|
|
481
501
|
}
|
|
502
|
+
hasAunMsgSender() {
|
|
503
|
+
return this.aunMsgSender !== undefined;
|
|
504
|
+
}
|
|
505
|
+
async sendAunMsg(params) {
|
|
506
|
+
if (!this.aunMsgSender)
|
|
507
|
+
throw new Error('aunMsgSender not configured');
|
|
508
|
+
return this.aunMsgSender(params);
|
|
509
|
+
}
|
|
482
510
|
setDiagExecutor(executor) { this.diagExecutor = executor; }
|
|
483
511
|
setMenuClientExecutor(executor) { this.menuClientExecutor = executor; }
|
|
484
512
|
/** Inject internal handoff result return executor for `ec handoff return`. */
|
|
@@ -928,6 +956,7 @@ export class IpcServer {
|
|
|
928
956
|
}
|
|
929
957
|
if (typeof cmd.delegationToken === 'string' && cmd.delegationToken
|
|
930
958
|
&& this.daemonRuntimeEpoch
|
|
959
|
+
&& cmd.daemonRuntimeEpoch !== undefined
|
|
931
960
|
&& cmd.daemonRuntimeEpoch !== this.daemonRuntimeEpoch) {
|
|
932
961
|
logger.warn(`[IPC] stale delegation rejected: session=${ipcLogToken(cmd.sessionId ?? cmd.originSessionId ?? cmd.actorSessionId)} type=${ipcLogToken(cmd.type)} cause=daemon_runtime_epoch_mismatch`);
|
|
933
962
|
return {
|
|
@@ -1385,12 +1414,25 @@ export class IpcServer {
|
|
|
1385
1414
|
sessionId: cmd.sessionId,
|
|
1386
1415
|
delegationToken: typeof cmd.delegationToken === 'string' ? cmd.delegationToken : undefined,
|
|
1387
1416
|
delegationCommandHash: typeof cmd.delegationCommandHash === 'string' ? cmd.delegationCommandHash : undefined,
|
|
1417
|
+
consumeApproval: false,
|
|
1388
1418
|
});
|
|
1389
1419
|
if (!authorization.ok)
|
|
1390
1420
|
return authorization;
|
|
1391
1421
|
const context = this.taskRuntimeContextProvider({ sessionId: cmd.sessionId }) ?? null;
|
|
1392
1422
|
return { ok: true, context };
|
|
1393
1423
|
}
|
|
1424
|
+
case 'debug-issue-token': {
|
|
1425
|
+
if (cmd.delegationToken)
|
|
1426
|
+
return { ok: false, code: 'NOT_ALLOWED', error: 'Managed tasks cannot issue debug tokens' };
|
|
1427
|
+
// 仅 EVOLCORE_DEBUG_MODE=1 时由 index.ts 注册 executor;非 debug 模式直接拒绝
|
|
1428
|
+
if (!this.debugIssueTokenExecutor) {
|
|
1429
|
+
return { ok: false, error: 'debug mode is not enabled; start daemon with: ec start --debug' };
|
|
1430
|
+
}
|
|
1431
|
+
if (typeof cmd.sessionId !== 'string' || !/^[A-Za-z0-9][A-Za-z0-9_.-]*$/.test(cmd.sessionId)) {
|
|
1432
|
+
return { ok: false, error: 'missing sessionId' };
|
|
1433
|
+
}
|
|
1434
|
+
return this.debugIssueTokenExecutor({ sessionId: cmd.sessionId });
|
|
1435
|
+
}
|
|
1394
1436
|
case 'aun-msg-send': {
|
|
1395
1437
|
if (cmd.argv !== undefined) {
|
|
1396
1438
|
if (!this.aunMsgSender)
|
|
@@ -1458,7 +1500,6 @@ export class IpcServer {
|
|
|
1458
1500
|
: undefined,
|
|
1459
1501
|
encrypt: typeof cmd.encrypt === 'boolean' ? cmd.encrypt : undefined,
|
|
1460
1502
|
thread: typeof cmd.thread === 'string' ? cmd.thread : undefined,
|
|
1461
|
-
returnPolicy: cmd.returnPolicy === 'required' || cmd.returnPolicy === 'none' ? cmd.returnPolicy : undefined,
|
|
1462
1503
|
handoffContext: cmd.handoffContext,
|
|
1463
1504
|
originSessionId: typeof cmd.originSessionId === 'string' ? cmd.originSessionId : undefined,
|
|
1464
1505
|
originMessageId: typeof cmd.originMessageId === 'string' ? cmd.originMessageId : undefined,
|
|
@@ -1704,6 +1745,7 @@ export class IpcServer {
|
|
|
1704
1745
|
contextFilePath: r.contextFilePath,
|
|
1705
1746
|
...(r.logFile ? { logFile: r.logFile } : {}),
|
|
1706
1747
|
mode: effectiveMode,
|
|
1748
|
+
...(r.queued ? { queued: r.queued } : {}),
|
|
1707
1749
|
};
|
|
1708
1750
|
}
|
|
1709
1751
|
catch (e) {
|
|
@@ -1972,6 +2014,16 @@ export class IpcServer {
|
|
|
1972
2014
|
}
|
|
1973
2015
|
return await this.fsOperationExecutor(argv, sessionId, delegationToken, typeof cmd.delegationCommandHash === 'string' ? cmd.delegationCommandHash : undefined);
|
|
1974
2016
|
}
|
|
2017
|
+
case 'thread.op': {
|
|
2018
|
+
if (!this.threadOperationExecutor)
|
|
2019
|
+
return { ok: false, code: 'NOT_CONFIGURED', error: 'thread.op not configured' };
|
|
2020
|
+
const delegated = typeof cmd.delegationToken === 'string' && cmd.delegationToken.trim();
|
|
2021
|
+
const req = {
|
|
2022
|
+
...cmd,
|
|
2023
|
+
localControl: !delegated && this.hasValidControlToken(cmd.controlToken),
|
|
2024
|
+
};
|
|
2025
|
+
return await this.threadOperationExecutor(req);
|
|
2026
|
+
}
|
|
1975
2027
|
case 'evolagent.initialize': {
|
|
1976
2028
|
if (cmd.sessionId || cmd.delegationToken)
|
|
1977
2029
|
return { ok: false, code: 'NOT_ALLOWED', error: 'Managed callers must use agent.op' };
|
|
@@ -1991,6 +2043,33 @@ export class IpcServer {
|
|
|
1991
2043
|
}
|
|
1992
2044
|
return await this.agentOperationExecutor(argv, sessionId, delegationToken, typeof cmd.delegationCommandHash === 'string' ? cmd.delegationCommandHash : undefined);
|
|
1993
2045
|
}
|
|
2046
|
+
case 'skill.refresh': {
|
|
2047
|
+
if (!this.skillRefreshExecutor) {
|
|
2048
|
+
return { ok: false, code: 'NOT_CONFIGURED', error: 'skill.refresh not configured' };
|
|
2049
|
+
}
|
|
2050
|
+
let { aid } = cmd;
|
|
2051
|
+
const { sessionId, delegationToken } = cmd;
|
|
2052
|
+
if (typeof aid !== 'string' || !aid) {
|
|
2053
|
+
return { ok: false, code: 'INVALID_REQUEST', error: 'missing aid' };
|
|
2054
|
+
}
|
|
2055
|
+
if (sessionId !== undefined && typeof sessionId !== 'string') {
|
|
2056
|
+
return { ok: false, code: 'INVALID_REQUEST', error: 'sessionId must be a string' };
|
|
2057
|
+
}
|
|
2058
|
+
if (delegationToken !== undefined && typeof delegationToken !== 'string') {
|
|
2059
|
+
return { ok: false, code: 'INVALID_DELEGATION', error: 'delegationToken must be a string' };
|
|
2060
|
+
}
|
|
2061
|
+
if (sessionId && !delegationToken)
|
|
2062
|
+
return { ok: false, code: 'DELEGATION_REQUIRED', error: 'Managed skill refresh requires delegation' };
|
|
2063
|
+
try {
|
|
2064
|
+
if (!Array.isArray(cmd.argv))
|
|
2065
|
+
throw new Error('Skill refresh requires argv');
|
|
2066
|
+
aid = resolveSkillRefreshArgv(cmd.argv);
|
|
2067
|
+
}
|
|
2068
|
+
catch (error) {
|
|
2069
|
+
return { ok: false, code: 'INVALID_REQUEST', error: error instanceof Error ? error.message : String(error) };
|
|
2070
|
+
}
|
|
2071
|
+
return await this.skillRefreshExecutor(aid, sessionId, delegationToken, typeof cmd.delegationCommandHash === 'string' ? cmd.delegationCommandHash : undefined);
|
|
2072
|
+
}
|
|
1994
2073
|
case 'trigger.op':
|
|
1995
2074
|
case 'trigger.list':
|
|
1996
2075
|
case 'trigger.show':
|
package/dist/paths.js
CHANGED
|
@@ -208,6 +208,26 @@ export function channelStatePath(channelKey, ...parts) {
|
|
|
208
208
|
export function agentTriggersDir(aid) {
|
|
209
209
|
return path.join(agentDir(aid), 'triggers');
|
|
210
210
|
}
|
|
211
|
+
/** 话题数据的统一根目录:索引、摘要、续读锚点、跨会话收件箱都收在这里。 */
|
|
212
|
+
export function agentThreadsDir(aid) {
|
|
213
|
+
return path.join(agentDataDir(aid), 'threads');
|
|
214
|
+
}
|
|
215
|
+
export function agentThreadIndexPath(aid) {
|
|
216
|
+
return path.join(agentThreadsDir(aid), 'index.json');
|
|
217
|
+
}
|
|
218
|
+
export function agentThreadSummariesDir(aid) {
|
|
219
|
+
return path.join(agentThreadsDir(aid), 'summaries');
|
|
220
|
+
}
|
|
221
|
+
export function agentThreadSummaryPath(aid, sessionId) {
|
|
222
|
+
return path.join(agentThreadSummariesDir(aid), `${sessionId}.summary.jsonl`);
|
|
223
|
+
}
|
|
224
|
+
/** Thread Context 收件箱:跨话题发送后在目标会话侧留下的注入提醒。 */
|
|
225
|
+
export function agentThreadInboxDir(aid) {
|
|
226
|
+
return path.join(agentThreadsDir(aid), 'inbox');
|
|
227
|
+
}
|
|
228
|
+
export function agentThreadInboxPath(aid, targetSessionId) {
|
|
229
|
+
return path.join(agentThreadInboxDir(aid), `${targetSessionId}.jsonl`);
|
|
230
|
+
}
|
|
211
231
|
function stripTrailingWindowsSeparators(value) {
|
|
212
232
|
const stripped = value.replace(/[\\/]+$/g, '');
|
|
213
233
|
// Keep a drive-root separator. `C:` is a drive-relative path on Windows.
|
|
@@ -414,6 +434,9 @@ export function kitsSchemasDir() {
|
|
|
414
434
|
export function eckDebugDir() {
|
|
415
435
|
return path.join(resolveRoot(), 'data', 'eck-debug');
|
|
416
436
|
}
|
|
437
|
+
export function debugSessionsDir() {
|
|
438
|
+
return path.join(resolveRoot(), 'data', 'debug-sessions');
|
|
439
|
+
}
|
|
417
440
|
export function getPackageRoot() {
|
|
418
441
|
// import.meta.dirname is available in Node.js 21.2+ and always returns
|
|
419
442
|
// the correct OS-native path, regardless of Git Bash or MSYS2 environment.
|