evolcore 0.0.43-test.3 → 0.0.43-test.5
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 +82 -0
- package/bin/ecmsg.js +492 -0
- package/bin/install-codex-managed-hooks.mjs +130 -8
- package/dist/ability/application-service.js +37 -0
- package/dist/ability/resources.js +28 -0
- package/dist/ability/runtime.js +6 -1
- package/dist/agents/claude-runner.js +7 -5
- package/dist/agents/codex/app-server-client.js +0 -12
- package/dist/agents/codex-runner.js +12 -54
- package/dist/agents/ecagent-runner.js +130 -35
- package/dist/aun/aid/agentmd.js +56 -12
- package/dist/aun/aid/control-aid.js +15 -0
- package/dist/aun/aid/identity.js +8 -0
- package/dist/aun/aid/ownership-operation.js +12 -3
- package/dist/aun/menu/client.js +8 -7
- package/dist/aun/menu/index.js +1 -1
- package/dist/aun/menu/transport.js +8 -5
- package/dist/aun/service-proxy.js +3 -0
- package/dist/channels/aun.js +56 -22
- package/dist/channels/daemon.js +12 -4
- package/dist/cli/agent-command.js +5 -0
- package/dist/cli/agent-create.js +32 -8
- package/dist/cli/agent.js +9 -3
- package/dist/cli/aid-bind-command.js +3 -0
- package/dist/cli/aun-commands.js +12 -5
- package/dist/cli/code-stats.js +451 -213
- package/dist/cli/ctl-command.js +1 -3
- package/dist/cli/daemon-commands.js +42 -21
- package/dist/cli/directory.js +7 -8
- package/dist/cli/ecmsg-gateway.js +204 -0
- package/dist/cli/getmeta-command.js +2 -1
- package/dist/cli/index.js +6 -0
- package/dist/cli/init.js +58 -18
- package/dist/cli/provider-command.js +82 -5
- package/dist/cli/restart-monitor.js +11 -19
- package/dist/cli/stats.js +8 -1
- package/dist/cli/task-context.js +3 -0
- package/dist/cli/trigger-command.js +20 -14
- package/dist/config/boot-log.js +23 -2
- package/dist/config/config-field-policy.js +2 -0
- package/dist/config/config-manager.js +13 -17
- package/dist/config/daemon-services.js +1 -0
- package/dist/config/peer-role-resolver.js +6 -6
- package/dist/config/provider-identity-migration.js +202 -0
- package/dist/config/provider-identity.js +37 -0
- package/dist/config/provider-ipc-service.js +40 -3
- package/dist/config/provider-local-sync.js +153 -0
- package/dist/config/providers-config.js +32 -4
- package/dist/config/providers-management.js +144 -68
- package/dist/config/providers.js +4 -1
- package/dist/config/role-schema.js +3 -3
- package/dist/config/schema-migration.js +188 -3
- package/dist/core/agent-application-service.js +11 -0
- package/dist/core/agent-ipc-registration.js +2 -0
- package/dist/core/agent-runtime.js +45 -11
- package/dist/core/auth/auth-gateway.js +8 -6
- package/dist/core/auth/delegation-diagnostics.js +6 -2
- package/dist/core/auth/operation-authorizer.js +5 -2
- package/dist/core/auth/operation-catalog.js +6 -4
- package/dist/core/baseagent-loader.js +11 -3
- package/dist/core/bootstrap-service.js +8 -0
- package/dist/core/channel-loader.js +61 -23
- package/dist/core/command/agent-control.js +4 -1
- package/dist/core/command/chatmode-config.js +46 -0
- package/dist/core/command/cli-intent-parser.js +2 -1
- package/dist/core/command/command-handler.js +16 -20
- package/dist/core/command/daemon-diagnostics.js +2 -1
- package/dist/core/command/menu-catalog.js +1 -1
- package/dist/core/command/menu-handler.js +16 -16
- package/dist/core/command/menu-protocol.js +4 -2
- package/dist/core/command/provider-menu.js +4 -2
- package/dist/core/command/role-menu.js +2 -2
- package/dist/core/command/slash-handler.js +56 -42
- package/dist/core/daemon-lifecycle.js +35 -17
- package/dist/core/event-catalog.js +19 -0
- package/dist/core/evolagent-registry.js +3 -0
- package/dist/core/handoff/runtime.js +9 -3
- package/dist/core/initialization/service.js +4 -3
- package/dist/core/ipc-registration.js +6 -0
- package/dist/core/message/aun-ipc-sender.js +81 -3
- package/dist/core/message/im-renderer.js +24 -19
- package/dist/core/message/message-admission.js +13 -2
- package/dist/core/message/response-engine.js +40 -41
- package/dist/core/message/send-options.js +40 -0
- package/dist/core/message/send-routing.js +310 -0
- package/dist/core/model/model-capabilities.js +37 -0
- package/dist/core/model/model-catalog.js +6 -2
- package/dist/core/ownership/owner-resolver.js +117 -14
- package/dist/core/permission/ec-command-parser.js +195 -27
- package/dist/core/permission/readonly-shell-query.js +66 -7
- package/dist/core/permission/tool-error-code.js +13 -1
- package/dist/core/permission/tool-policy.js +74 -20
- package/dist/core/plugin-lifecycle.js +6 -2
- package/dist/core/relation/pa-team.js +7 -2
- package/dist/core/relation/same-owner-proof.js +131 -0
- package/dist/core/session/session-idle-monitor.js +94 -16
- package/dist/core/session/session-manager.js +69 -16
- package/dist/core/thread/thread-route.js +5 -2
- package/dist/directory/owner-directory-cache.js +690 -99
- package/dist/directory/owner-directory-markdown.js +146 -36
- package/dist/directory/owner-directory-query-operation.js +7 -9
- package/dist/directory/owner-directory-scope.js +12 -0
- package/dist/directory/owner-directory-search.js +5 -1
- package/dist/directory/owner-directory-store.js +28 -0
- package/dist/ecweb/basic-settings-service.js +15 -1
- package/dist/ecweb/message-context-service.js +2 -2
- package/dist/ecweb/providers-service.js +3 -1
- package/dist/ecweb/runtime/lifecycle.js +38 -5
- package/dist/ecweb/runtime/supervisor.js +157 -49
- package/dist/index.js +202 -38
- package/dist/paths.js +2 -1
- package/dist/proxy/manager.js +2 -0
- package/dist/proxy/service-supervisor.js +379 -143
- package/dist/response-system/engines/v1/proactive-flow.js +4 -0
- package/dist/trigger/application-service.js +1 -0
- package/dist/trigger/audit.js +3 -2
- package/dist/trigger/authorization.js +2 -3
- package/dist/trigger/event-source.js +4 -0
- package/dist/trigger/feedback.js +26 -2
- package/dist/trigger/history.js +4 -3
- package/dist/trigger/ipc-service.js +24 -19
- package/dist/trigger/manager.js +3 -5
- package/dist/trigger/parser.js +4 -21
- package/dist/trigger/patch.js +3 -15
- package/dist/trigger/scheduler.js +48 -13
- package/dist/trigger/system-definitions.js +2 -2
- package/dist/trigger/validation.js +4 -13
- package/dist/utils/autostart.js +2 -2
- package/dist/utils/cross-platform.js +36 -8
- package/dist/utils/error-utils.js +8 -0
- package/dist/utils/macos-autostart.js +31 -0
- package/dist/utils/model-prices.jsonl +15 -8
- package/dist/utils/process-introspect.js +21 -1
- package/dist/utils/public-suffix.js +5811 -0
- package/dist/utils/startup-trace.js +7 -1
- package/dist/utils/windows-autostart.js +42 -7
- package/ecagent/dist/harness/compaction/branch-summarization.js +1 -1
- package/ecagent/dist/harness/compaction/compaction.js +4 -4
- package/ecagent/dist/harness/env/nodejs.js +46 -2
- package/kits/docs/aun/ABILITY_CALLING.md +3 -3
- package/kits/docs/channels/aun.md +1 -1
- package/kits/docs/channels/feishu.md +2 -2
- package/kits/docs/context-assembly.md +20 -4
- package/kits/docs/evolcore/INDEX.md +3 -2
- package/kits/docs/evolcore/agent.md +2 -2
- package/kits/docs/evolcore/aid.md +8 -2
- package/kits/docs/evolcore/ctl.md +13 -4
- package/kits/docs/evolcore/directory.md +48 -15
- package/kits/docs/evolcore/file-navigation.md +63 -49
- package/kits/docs/evolcore/group.md +6 -6
- package/kits/docs/evolcore/memory-consolidation.md +1 -1
- package/kits/docs/evolcore/menu-protocol.md +33 -3
- package/kits/docs/evolcore/model.md +5 -3
- package/kits/docs/evolcore/msg.md +28 -27
- package/kits/docs/evolcore/provider.md +39 -5
- package/kits/docs/evolcore/response.md +3 -1
- package/kits/docs/evolcore/thread-chain.md +12 -14
- package/kits/docs/evolcore/tool-authorization.md +21 -1
- package/kits/docs/evolcore/trigger.md +12 -9
- package/kits/docs/identity/ROLE_DETAIL.md +1 -1
- package/kits/docs/prompt-loading-architecture.md +30 -20
- package/kits/eck_manifest.auxiliary.json +5 -5
- package/kits/eck_manifest.json +28 -49
- package/kits/eck_manifest.memory.json +18 -18
- package/kits/rules/01-overview.md +43 -45
- package/kits/rules/02-navigation.md +44 -53
- package/kits/rules/03-identity.md +21 -25
- package/kits/rules/04-relation.md +23 -33
- package/kits/rules/05-venue.md +24 -25
- package/kits/rules/06-channel.md +3 -3
- package/kits/schemas/_meta.json +20 -27
- package/kits/schemas/agent-config.schema.19.json +10 -6
- package/kits/schemas/providers.schema.2.json +74 -0
- package/kits/schemas/relation-config.schema.12.json +2 -2
- package/kits/schemas/role-config.schema.2.json +5 -5
- package/kits/schemas/role-registry.schema.1.json +1 -1
- package/kits/skills/ec-agent-create/SKILL.md +1 -0
- package/kits/skills/ec-service-proxy/SKILL.md +3 -0
- package/kits/skills/ec-trigger/SKILL.md +4 -4
- package/kits/skills/ec-trigger/references/examples.md +1 -1
- package/kits/templates/system-fragments/channel.md +5 -5
- package/kits/templates/system-fragments/commands.md +3 -2
- package/kits/templates/system-fragments/directory-contacts.md +10 -3
- package/kits/templates/system-fragments/identity.md +0 -1
- package/kits/templates/system-fragments/personal-assistant.md +22 -3
- package/kits/templates/system-fragments/reply.md +47 -28
- package/kits/templates/system-fragments/session.md +2 -9
- package/kits/templates/system-fragments/thread.md +5 -5
- package/package.json +17 -13
- package/kits/schemas/agent-config.schema.20.json +0 -925
- package/kits/schemas/relation-config.schema.13.json +0 -289
- package/kits/schemas/role-config.schema.3.json +0 -1038
|
@@ -4,12 +4,84 @@ import { resolvePaths } from '../paths.js';
|
|
|
4
4
|
import { readDelegationCredential, hashCurrentDelegatedCommand } from '../core/auth/agent-delegation.js';
|
|
5
5
|
import { parseProviderCommand } from '../config/provider-ipc-service.js';
|
|
6
6
|
import { queryDaemon, daemonUnavailableMessage, wantsHelp } from './help.js';
|
|
7
|
+
function providerText(command, data) {
|
|
8
|
+
const lines = [];
|
|
9
|
+
const label = (value) => String(value ?? '未设置').replace(/[\x00-\x1f\x7f-\x9f]/gu, ' ');
|
|
10
|
+
const aliases = () => {
|
|
11
|
+
for (const [alias, target] of Object.entries(data.aliases ?? {}))
|
|
12
|
+
lines.push(` ${label(alias)} → ${label(target)}`);
|
|
13
|
+
};
|
|
14
|
+
if (command.operation === 'sync') {
|
|
15
|
+
lines.push('✓ Provider 同步完成', `地址固化:${data.materializedBaseUrls ?? 0} 项`, `配置变更:${data.changedFiles ?? 0} 个文件,更新 ${data.referencesUpdated ?? 0} 处引用`);
|
|
16
|
+
if (data.imports?.length) {
|
|
17
|
+
lines.push('本机导入:');
|
|
18
|
+
for (const item of data.imports)
|
|
19
|
+
lines.push(` ${label(item.baseagent)} → ${label(item.providerId)}(${item.merged ? '已合并' : '已新增'})`);
|
|
20
|
+
}
|
|
21
|
+
else
|
|
22
|
+
lines.push('本机导入:无');
|
|
23
|
+
if (Object.keys(data.aliases ?? {}).length) {
|
|
24
|
+
lines.push('兼容别名:');
|
|
25
|
+
aliases();
|
|
26
|
+
}
|
|
27
|
+
lines.push(`全局默认基座:${label(data.activeBaseagent)}`);
|
|
28
|
+
lines.push(data.selection ? `本次默认选择:${label(data.selection.provider)} / ${label(data.selection.model)}` : '本次默认选择:未重新选择');
|
|
29
|
+
lines.push(`待处理:${data.pending?.length ? data.pending.map(label).join('、') : '无'}`, `告警:${data.warnings?.length ? data.warnings.map(label).join('、') : '无'}`, `备份:${data.backup ? label(data.backup) : '无(未产生变更)'}`);
|
|
30
|
+
}
|
|
31
|
+
else if (command.operation === 'list') {
|
|
32
|
+
const entries = Object.entries(data.providers ?? {});
|
|
33
|
+
lines.push(`Provider 列表(${entries.length} 项)`);
|
|
34
|
+
for (const [id, provider] of entries) {
|
|
35
|
+
lines.push(`${label(id)} ${label(provider.name || '未命名')}`, ` 域名:${label(provider.domain || '待迁移')} 服务:${Object.keys(provider.services ?? {}).map(label).join('、') || '无'}`);
|
|
36
|
+
}
|
|
37
|
+
if (Object.keys(data.aliases ?? {}).length) {
|
|
38
|
+
lines.push('兼容别名:');
|
|
39
|
+
aliases();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
else if (command.operation === 'show') {
|
|
43
|
+
lines.push(`Provider 详情:${label(data.providerId)}`);
|
|
44
|
+
const visit = (value, indent, field) => {
|
|
45
|
+
if (value && typeof value === 'object') {
|
|
46
|
+
const entries = Object.entries(value);
|
|
47
|
+
lines.push(`${indent}${label(field)}:${entries.length ? '' : '(空)'}`);
|
|
48
|
+
for (const [key, child] of entries)
|
|
49
|
+
visit(child, indent + ' ', key);
|
|
50
|
+
}
|
|
51
|
+
else
|
|
52
|
+
lines.push(`${indent}${label(field)}:${label(value)}`);
|
|
53
|
+
};
|
|
54
|
+
const provider = structuredClone(data.provider ?? {});
|
|
55
|
+
if (provider.common) {
|
|
56
|
+
const key = provider.common.apiKey;
|
|
57
|
+
if (key && !/^\$(?:[A-Za-z_][A-Za-z0-9_]*|\{[A-Za-z_][A-Za-z0-9_]*\})$/u.test(key))
|
|
58
|
+
provider.common.apiKey = '<redacted>';
|
|
59
|
+
for (const field of ['headers', 'queryParams']) {
|
|
60
|
+
if (provider.common[field])
|
|
61
|
+
for (const key of Object.keys(provider.common[field]))
|
|
62
|
+
provider.common[field][key] = '<redacted>';
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
for (const [field, value] of Object.entries(provider))
|
|
66
|
+
visit(value, ' ', field);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
const verbs = { create: '创建', import: '导入', update: '更新', delete: '删除' };
|
|
70
|
+
lines.push(`✓ Provider ${verbs[command.operation]}成功:${label(data.providerId ?? command.providerId)}`);
|
|
71
|
+
}
|
|
72
|
+
if (data.revision)
|
|
73
|
+
lines.push(`配置版本:${label(data.revision)}`);
|
|
74
|
+
return lines.join('\n');
|
|
75
|
+
}
|
|
7
76
|
export async function cmdProvider(args) {
|
|
8
77
|
if (!args.length || wantsHelp(args)) {
|
|
9
78
|
console.log('用法: ec provider <命令> [--format json]\n\n'
|
|
10
79
|
+ ' list\n show <provider-id>\n create --file <path>\n import --file <path>\n'
|
|
11
|
-
+ ' update <provider-id> --file <path>\n delete <provider-id>\n\n'
|
|
12
|
-
+ '
|
|
80
|
+
+ ' update <provider-id> --file <path>\n delete <provider-id>\n sync\n\n'
|
|
81
|
+
+ 'sync 扫描导入本机 Provider、固化环境变量地址、迁移 ID 与配置引用,并切换全局默认到 ecagent;不覆盖 Agent 显式基座选择。\n'
|
|
82
|
+
+ '默认输出可读文本;--format json 输出完整结构化响应,适合脚本处理。\n'
|
|
83
|
+
+ '宿主控制终端或 daemon 验证的 trusted fullaccess 任务可管理 process 级 Provider。\n'
|
|
84
|
+
+ '经 daemon 验证的 DaemonOwner 托管任务无需 fullaccess 即可 list/show。文件必须为 UTF-8,最大 1 MiB。\n'
|
|
13
85
|
+ 'import 接受单 Provider 对象、单项映射或 providers 包装,始终创建新 ID。\n'
|
|
14
86
|
+ 'update 替换完整对象;<redacted> 保留原密钥。输出始终脱敏。');
|
|
15
87
|
return;
|
|
@@ -35,15 +107,20 @@ export async function cmdProvider(args) {
|
|
|
35
107
|
const { response, transportError } = await queryDaemon(resolvePaths().socket, {
|
|
36
108
|
type: 'provider.op', argv,
|
|
37
109
|
...(sessionId || delegationToken ? { sessionId, delegationToken, delegationCommandHash: hashCurrentDelegatedCommand() } : { controlToken }),
|
|
38
|
-
}, 30_000);
|
|
110
|
+
}, parsed.operation === 'sync' ? 120_000 : 30_000);
|
|
39
111
|
if (!response)
|
|
40
112
|
throw Object.assign(new Error(daemonUnavailableMessage(transportError, '无法连接 EvolCore daemon')), { code: 'DAEMON_UNAVAILABLE' });
|
|
41
113
|
if (json)
|
|
42
114
|
console.log(JSON.stringify(response, null, 2));
|
|
43
|
-
else if (response.ok === false)
|
|
115
|
+
else if (response.ok === false) {
|
|
44
116
|
console.error(response.error + ' (' + response.code + ')');
|
|
117
|
+
if (response.data?.kind === 'provider_referenced' && Array.isArray(response.data.references)) {
|
|
118
|
+
for (const reference of response.data.references)
|
|
119
|
+
console.error(` ${reference.file}: ${reference.path}`);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
45
122
|
else
|
|
46
|
-
console.log(
|
|
123
|
+
console.log(providerText(parsed, response.data));
|
|
47
124
|
if (response.ok === false)
|
|
48
125
|
process.exitCode = 1;
|
|
49
126
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
|
-
import { ipcHostQuery } from '../ipc.js';
|
|
2
|
+
import { ipcHostQuery, ipcQuery } from '../ipc.js';
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import { spawn, execFile } from 'child_process';
|
|
5
5
|
import { promisify } from 'util';
|
|
@@ -19,9 +19,7 @@ import { applyDataMigration, finalizeDataMigration, planDataMigration, verifyDat
|
|
|
19
19
|
import { DAEMON_SHUTDOWN_TIMEOUT_MS, requestDaemonShutdown, stopCodexAppServerOrphans } from './daemon-commands.js';
|
|
20
20
|
import { getProcessStartTime, invalidateProcessSnapshot, startTimeMatches } from '../utils/process-introspect.js';
|
|
21
21
|
import { DEFAULT_ECWEB_PORT, ecwebService, serviceRuntimeMode } from '../config/daemon-services.js';
|
|
22
|
-
import {
|
|
23
|
-
import { resolveGlobalPkg } from '../utils/npm-ops.js';
|
|
24
|
-
import { WEB_PACKAGE_NAME } from '../product.js';
|
|
22
|
+
import { stopEcwebForRestart } from '../ecweb/runtime/lifecycle.js';
|
|
25
23
|
const execFileAsync = promisify(execFile);
|
|
26
24
|
/** Read-only check performed before stopping the current daemon. */
|
|
27
25
|
function preflightDataMigration(root, log) {
|
|
@@ -206,9 +204,7 @@ export async function cmdRestartMonitor() {
|
|
|
206
204
|
const s = scanInstances();
|
|
207
205
|
if (!s.mains.some(m => m.alive))
|
|
208
206
|
return false;
|
|
209
|
-
|
|
210
|
-
return service?.enabled !== true || serviceRuntimeMode(service) !== 'managed'
|
|
211
|
-
|| await probeEcwebRestartReadiness(p, service.port ?? DEFAULT_ECWEB_PORT, resolveGlobalPkg(WEB_PACKAGE_NAME)?.version);
|
|
207
|
+
return true;
|
|
212
208
|
};
|
|
213
209
|
const markRequestReady = () => {
|
|
214
210
|
if (!hasCorrelatedRequest)
|
|
@@ -1104,9 +1100,6 @@ async function spawnAndWaitReady(p, log, timeout) {
|
|
|
1104
1100
|
const ecweb = ecwebService(loadDaemonConfig().services);
|
|
1105
1101
|
const requireEcweb = ecweb?.enabled === true && serviceRuntimeMode(ecweb) === 'managed';
|
|
1106
1102
|
const ecwebPort = ecweb?.port ?? DEFAULT_ECWEB_PORT;
|
|
1107
|
-
const ecwebVersion = requireEcweb ? resolveGlobalPkg(WEB_PACKAGE_NAME)?.version : undefined;
|
|
1108
|
-
if (requireEcweb)
|
|
1109
|
-
await stopEcwebForRestart(p, ecwebPort, log);
|
|
1110
1103
|
// 删除旧的 ready signal
|
|
1111
1104
|
try {
|
|
1112
1105
|
fs.unlinkSync(p.readySignal);
|
|
@@ -1154,7 +1147,6 @@ async function spawnAndWaitReady(p, log, timeout) {
|
|
|
1154
1147
|
fs.closeSync(out);
|
|
1155
1148
|
fs.closeSync(err);
|
|
1156
1149
|
log(`Spawned new process PID: ${childPid}, waiting for ready signal...`);
|
|
1157
|
-
let waitingForEcweb = false;
|
|
1158
1150
|
// 轮询等待 ready.signal 出现
|
|
1159
1151
|
const start = Date.now();
|
|
1160
1152
|
while (Date.now() - start < timeout) {
|
|
@@ -1167,16 +1159,16 @@ async function spawnAndWaitReady(p, log, timeout) {
|
|
|
1167
1159
|
return false;
|
|
1168
1160
|
}
|
|
1169
1161
|
if (fs.existsSync(p.readySignal)) {
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
return true;
|
|
1173
|
-
}
|
|
1174
|
-
if (!waitingForEcweb)
|
|
1175
|
-
log(`Daemon ready; waiting for identified ECWeb readiness on port ${ecwebPort}`);
|
|
1176
|
-
waitingForEcweb = true;
|
|
1162
|
+
log('Daemon ready; managed services are supervised independently');
|
|
1163
|
+
return true;
|
|
1177
1164
|
}
|
|
1178
1165
|
}
|
|
1179
|
-
|
|
1166
|
+
const ping = await ipcQuery(p.socket, { type: 'ping' }, platform.isWindows ? 5_000 : 1_000);
|
|
1167
|
+
if (ping?.pong === true && ping.pid === childPid && platform.isProcessRunning(childPid)) {
|
|
1168
|
+
log(`Daemon IPC is ready (PID: ${childPid}); startup finalization and managed services continue in background`);
|
|
1169
|
+
return true;
|
|
1170
|
+
}
|
|
1171
|
+
log(`Daemon ready signal not received within ${timeout / 1000}s and identified IPC is unavailable`);
|
|
1180
1172
|
// A timeout is still a live-process race: do not let self-heal spawn a
|
|
1181
1173
|
// replacement while the timed-out daemon owns the IPC endpoint or a port.
|
|
1182
1174
|
if (platform.isProcessRunning(childPid)) {
|
package/dist/cli/stats.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* ec stats — Token 用量统计 CLI 命令。
|
|
3
3
|
*/
|
|
4
|
-
import { resolveRoot } from '../paths.js';
|
|
4
|
+
import { resolveRoot, resolvePaths } from '../paths.js';
|
|
5
5
|
import { wantsHelp } from './help.js';
|
|
6
6
|
import { authorizeLocalCommand } from './task-context.js';
|
|
7
7
|
import { queryAggregated, querySessionTurns, queryContextBreakdown, queryTopPeers, queryTopModels, queryMessageAggregated, queryPeerList, querySummary, queryPeerDaily, queryTaskModelCalls, querySessionModelCalls, queryTaskSummary } from '../stats/query.js';
|
|
@@ -44,6 +44,7 @@ ec stats — Token 用量与费用统计
|
|
|
44
44
|
--peer-detail <id> 指定对端 AID 或 peer_key,按天返回消耗明细
|
|
45
45
|
--task-calls <taskId> 一个 task 的模型用量明细(Codex 为回合/子 agent 汇总)
|
|
46
46
|
--session-calls <id> 一个会话的模型用量明细(Codex 为回合/子 agent 汇总)
|
|
47
|
+
--code 代码量历史(读 ec start 写下的 code-stats.json,不重扫)
|
|
47
48
|
|
|
48
49
|
输出格式:
|
|
49
50
|
--format json JSON 输出
|
|
@@ -242,6 +243,12 @@ export async function handleStats(args) {
|
|
|
242
243
|
const managedScope = await resolveManagedStatsScope(flags, isJson, ['stats', ...args]);
|
|
243
244
|
if (managedScope)
|
|
244
245
|
enforceManagedSelector(managedScope, flags, isJson);
|
|
246
|
+
// 代码量历史:只读 ec start 写下的 code-stats.json,不重新扫描源码。
|
|
247
|
+
if (flags.code) {
|
|
248
|
+
const { showCodeStatsHistory } = await import('./code-stats.js');
|
|
249
|
+
showCodeStatsHistory(resolvePaths().logs);
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
245
252
|
// 全量重建日聚合表(运维兜底/排查),不依赖时间范围。
|
|
246
253
|
if (flags.rebuild) {
|
|
247
254
|
const { rebuildDailyRollup, getDb } = await import('../stats/db.js');
|
package/dist/cli/task-context.js
CHANGED
|
@@ -51,6 +51,9 @@ function normalizeTaskRuntimeContext(value) {
|
|
|
51
51
|
|| value.executionSource === 'session-policy'
|
|
52
52
|
? value.executionSource : undefined,
|
|
53
53
|
daemonRuntimeEpoch: optionalString(value.daemonRuntimeEpoch),
|
|
54
|
+
// 仅观测字段,但必须留在白名单里:丢掉它,ecmsg 的 --encrypt auto 就永远
|
|
55
|
+
// 判定为"非入站触发",密文会话里的回复会退化成明文。
|
|
56
|
+
inboundEncrypted: typeof value.inboundEncrypted === 'boolean' ? value.inboundEncrypted : undefined,
|
|
54
57
|
threadId: optionalString(value.threadId),
|
|
55
58
|
sessionRuntimeDir: optionalAbsolutePath(value.sessionRuntimeDir),
|
|
56
59
|
runtimeLockDir: optionalAbsolutePath(value.runtimeLockDir),
|
|
@@ -57,9 +57,12 @@ export async function cmdTrigger(args) {
|
|
|
57
57
|
if (response.result.error)
|
|
58
58
|
console.log(response.result.error);
|
|
59
59
|
}
|
|
60
|
+
else if (sub === 'cancel') {
|
|
61
|
+
console.log(`✓ interrupted ${response.runId ?? response.result?.runId ?? rest[0] ?? ''}`);
|
|
62
|
+
}
|
|
60
63
|
else {
|
|
61
64
|
const verb = { create: 'created', set: 'created', update: 'updated', enable: 'enabled',
|
|
62
|
-
disable: 'disabled',
|
|
65
|
+
disable: 'disabled', delete: 'deleted', remove: 'deleted', rm: 'deleted' }[sub];
|
|
63
66
|
console.log(`✓ ${verb} ${response.trigger.id}${['create', 'set', 'update'].includes(sub) ? ` (${response.trigger.name})` : ''}`);
|
|
64
67
|
}
|
|
65
68
|
return;
|
|
@@ -122,7 +125,7 @@ function printHelp() {
|
|
|
122
125
|
update [--agent <aid>] <triggerId> <参数...> [--if-revision <sha256:...>] [--json]
|
|
123
126
|
enable [--agent <aid>] <triggerId>
|
|
124
127
|
disable [--agent <aid>] <triggerId>
|
|
125
|
-
cancel [--agent <aid>] <
|
|
128
|
+
cancel [--agent <aid>] <runId> (中止当前活动运行)
|
|
126
129
|
delete|remove|rm [--agent <aid>] <triggerId>
|
|
127
130
|
run [--agent <aid>] <triggerId> [--dry-run] [--json]
|
|
128
131
|
template list|show <name> [--json]
|
|
@@ -136,7 +139,6 @@ Create 参数模式支持:
|
|
|
136
139
|
--script-path <路径> --script-runtime <node|python|bash>
|
|
137
140
|
--script-args <JSON> --script-timeout <时长>
|
|
138
141
|
--feedback <target|event-session> (event-session 使用事件来源会话)
|
|
139
|
-
--baseagent <name> (仅 --exec trigger-session)
|
|
140
142
|
--execution-timeout <时长>(模型类 Trigger 单次执行总时限)
|
|
141
143
|
--model <模型> --effort <low|medium|high|xhigh|max>
|
|
142
144
|
--max-runs <次数> --max-duration <时长: 30s|15m|2h|1d>
|
|
@@ -166,7 +168,7 @@ Update 参数:
|
|
|
166
168
|
--feedback <origin|target|event-session|silent>
|
|
167
169
|
--target-channel <channelKey> --target-channel-id <ID> (必须同时指定)
|
|
168
170
|
--target-chat-type <private|group> --target-session <main|thread> [--target-thread-id <threadId>]
|
|
169
|
-
--trigger-thread <by-run|by-trigger>
|
|
171
|
+
--trigger-thread <by-run|by-trigger>
|
|
170
172
|
--on-error <fail|retry> --noop-sentinel <文本>
|
|
171
173
|
--retry-attempts <次数> --retry-backoff <毫秒>
|
|
172
174
|
--script-runtime <node|python|bash> --script-args <JSON> --script-timeout <时长>
|
|
@@ -225,7 +227,7 @@ async function showTrigger(args, json, response) {
|
|
|
225
227
|
}
|
|
226
228
|
console.log(`execution: ${t.execution.type}`);
|
|
227
229
|
if (t.execution.type === 'trigger_session')
|
|
228
|
-
console.log(
|
|
230
|
+
console.log('baseagent: inherit (所属 Agent 当前基座)');
|
|
229
231
|
if (t.execution.type === 'script')
|
|
230
232
|
console.log(`script: ${scriptCommandLabel(t.execution.script)}`);
|
|
231
233
|
console.log(`model: ${t.execution.model ?? 'inherit'}`);
|
|
@@ -350,7 +352,6 @@ export async function buildTriggerCreateRequest(args, fileScope, defaultAgentAid
|
|
|
350
352
|
...(parsed.permissionMode ? { permissionMode: parsed.permissionMode } : {}),
|
|
351
353
|
...(parsed.executionType === 'trigger_session' ? {
|
|
352
354
|
thread: parsed.triggerThread ?? 'by_trigger',
|
|
353
|
-
...(parsed.baseagent ? { baseagent: parsed.baseagent } : {}),
|
|
354
355
|
} : {}),
|
|
355
356
|
onError: 'retry',
|
|
356
357
|
noopSentinel: '[[NOOP]]',
|
|
@@ -504,14 +505,19 @@ export function resolveTriggerCommandArgv(argv, defaultAgentAid) {
|
|
|
504
505
|
throw new Error(`Unknown trigger command: ${sub}`);
|
|
505
506
|
const agentAid = flagValue(args, '--agent') ?? defaultAgentAid;
|
|
506
507
|
const valueFlags = ['--agent', '--format', '--limit', '--if-revision', '--prompt-file', '--script-file'];
|
|
507
|
-
const
|
|
508
|
-
if (!['list', 'history', 'create', 'set'].includes(sub) && !
|
|
509
|
-
throw new Error('missing triggerId');
|
|
508
|
+
const positional = ['list', 'create', 'set'].includes(sub) ? undefined : optionalPositional(args, 0, valueFlags);
|
|
509
|
+
if (!['list', 'history', 'create', 'set'].includes(sub) && !positional) {
|
|
510
|
+
throw new Error(sub === 'cancel' ? 'missing runId' : 'missing triggerId');
|
|
511
|
+
}
|
|
510
512
|
const limit = Number(flagValue(args, '--limit') ?? 100);
|
|
511
513
|
if (!Number.isInteger(limit) || limit <= 0 || limit > 10_000)
|
|
512
514
|
throw new Error('Invalid history limit');
|
|
513
|
-
return {
|
|
514
|
-
|
|
515
|
+
return {
|
|
516
|
+
type: types[sub], agentAid,
|
|
517
|
+
...(sub === 'cancel' ? { runId: positional } : { triggerId: positional }),
|
|
518
|
+
limit, all: hasFlag(args, '--all'),
|
|
519
|
+
enabled: sub === 'enable', dryRun: hasFlag(args, '--dry-run')
|
|
520
|
+
};
|
|
515
521
|
}
|
|
516
522
|
function triggerUpdateArgs(args) {
|
|
517
523
|
const out = [];
|
|
@@ -585,11 +591,11 @@ async function setEnabled(args, enabled, json) {
|
|
|
585
591
|
}
|
|
586
592
|
async function cancelTrigger(args, json) {
|
|
587
593
|
const agentAid = resolveAgentAid(args);
|
|
588
|
-
const
|
|
589
|
-
const res = await request({ type: 'trigger.cancel', agentAid,
|
|
594
|
+
const runId = positional(args, 0, ['--agent', '--format']);
|
|
595
|
+
const res = await request({ type: 'trigger.cancel', agentAid, runId });
|
|
590
596
|
if (json)
|
|
591
597
|
return printJson(res);
|
|
592
|
-
console.log(`✓
|
|
598
|
+
console.log(`✓ interrupted ${res.runId ?? res.result?.runId ?? runId}`);
|
|
593
599
|
}
|
|
594
600
|
async function deleteTrigger(args, json) {
|
|
595
601
|
const agentAid = resolveAgentAid(args);
|
package/dist/config/boot-log.js
CHANGED
|
@@ -15,7 +15,7 @@ import { logger } from '../utils/logger.js';
|
|
|
15
15
|
import { autoMigrateIfNeeded } from '../config-store.js';
|
|
16
16
|
import { ConfigTarget, initConfigManager, notifyConfigWrite } from './config-manager.js';
|
|
17
17
|
import { ensureRoleConfigV4OnStartup, ensureRoleConfigV5OnStartup } from './role-migration-startup.js';
|
|
18
|
-
import { ensureAccessPolicyMigrationOnStartup, ensureAgentModelProviderMigrationOnStartup, ensureAgentOnlyModelMigrationOnStartup, ensureAuxiliaryModelMigrationOnStartup, ensurePeerFileRenameOnStartup, ensureProviderServiceTypeMigrationOnStartup, ensureRelationConfigVersionMigrationOnStartup, invalidateMigrationReadCache, withMigrationReadCache, } from './schema-migration.js';
|
|
18
|
+
import { ensureAccessPolicyMigrationOnStartup, ensureAgentModelProviderMigrationOnStartup, ensureAgentOnlyModelMigrationOnStartup, ensureAuxiliaryModelMigrationOnStartup, ensurePeerFileRenameOnStartup, ensurePublishedSchemaConsolidationMigrationOnStartup, ensureProviderServiceTypeMigrationOnStartup, ensureProviderIdentityMigrationOnStartup, ensureRelationConfigVersionMigrationOnStartup, invalidateMigrationReadCache, withMigrationReadCache, } from './schema-migration.js';
|
|
19
19
|
import { ensureContactBookV2OnStartup } from './peer-book-v2-startup.js';
|
|
20
20
|
import { synchronizeAllManagementPeersSync } from './peer-book-store.js';
|
|
21
21
|
import { readInstalledEvolcoreVersion, readFastaunVersion } from '../utils/evolcore-version.js';
|
|
@@ -38,7 +38,10 @@ export async function prepareStartupConfig(recoverRoleMutations, onStep) {
|
|
|
38
38
|
step('auxiliaryModel');
|
|
39
39
|
// 任一迁移真的落盘后立刻丢弃缓存:这三个迁移改的是同一批 relation 配置,
|
|
40
40
|
// 后一个迁移若沿用写盘前的旧文本做整文件覆盖,会把前一个的改动回滚掉。
|
|
41
|
-
const { auxiliaryModelMigration, agentOnlyModelMigration, relationVersionMigration } = await withMigrationReadCache(async () => {
|
|
41
|
+
const { publishedSchemaConsolidationMigration, auxiliaryModelMigration, agentOnlyModelMigration, relationVersionMigration } = await withMigrationReadCache(async () => {
|
|
42
|
+
const publishedSchemaConsolidation = await ensurePublishedSchemaConsolidationMigrationOnStartup();
|
|
43
|
+
if (publishedSchemaConsolidation)
|
|
44
|
+
invalidateMigrationReadCache();
|
|
42
45
|
const auxiliary = await ensureAuxiliaryModelMigrationOnStartup();
|
|
43
46
|
if (auxiliary)
|
|
44
47
|
invalidateMigrationReadCache();
|
|
@@ -49,11 +52,18 @@ export async function prepareStartupConfig(recoverRoleMutations, onStep) {
|
|
|
49
52
|
if (relationVersion)
|
|
50
53
|
invalidateMigrationReadCache();
|
|
51
54
|
return {
|
|
55
|
+
publishedSchemaConsolidationMigration: publishedSchemaConsolidation,
|
|
52
56
|
auxiliaryModelMigration: auxiliary,
|
|
53
57
|
agentOnlyModelMigration: agentOnly,
|
|
54
58
|
relationVersionMigration: relationVersion,
|
|
55
59
|
};
|
|
56
60
|
});
|
|
61
|
+
if (publishedSchemaConsolidationMigration) {
|
|
62
|
+
const message = `✓ Published schema consolidation applied automatically: ${publishedSchemaConsolidationMigration.changedFiles} file(s) restamped`
|
|
63
|
+
+ (publishedSchemaConsolidationMigration.backup ? `; backup: ${publishedSchemaConsolidationMigration.backup}` : '');
|
|
64
|
+
logger.info(message);
|
|
65
|
+
console.error(message);
|
|
66
|
+
}
|
|
57
67
|
if (auxiliaryModelMigration) {
|
|
58
68
|
const message = `✓ Session Renew auxiliary model migration applied automatically: ${auxiliaryModelMigration.changedFiles} file(s)`
|
|
59
69
|
+ (auxiliaryModelMigration.backup ? `; backup: ${auxiliaryModelMigration.backup}` : '');
|
|
@@ -85,6 +95,17 @@ export async function prepareStartupConfig(recoverRoleMutations, onStep) {
|
|
|
85
95
|
logger.info(`[config] ${detail.file}${detail.removed.length ? `: removed ${detail.removed.join(', ')}` : ''}`);
|
|
86
96
|
}
|
|
87
97
|
}
|
|
98
|
+
step('providerIdentity');
|
|
99
|
+
const providerIdentityMigration = await ensureProviderIdentityMigrationOnStartup();
|
|
100
|
+
if (providerIdentityMigration) {
|
|
101
|
+
const message = `Provider domain ID migration: ${providerIdentityMigration.summary.providersMigrated} provider(s), ${providerIdentityMigration.changedFiles} file(s)`
|
|
102
|
+
+ (providerIdentityMigration.backup ? `; backup: ${providerIdentityMigration.backup}` : '');
|
|
103
|
+
logger.info(message);
|
|
104
|
+
console.error(message);
|
|
105
|
+
if (providerIdentityMigration.pending.length) {
|
|
106
|
+
logger.warn(`[config] Provider domain required for legacy entries: ${providerIdentityMigration.pending.join(', ')}`);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
88
109
|
step('accessPolicy');
|
|
89
110
|
const accessPolicyMigration = await ensureAccessPolicyMigrationOnStartup();
|
|
90
111
|
if (accessPolicyMigration) {
|
|
@@ -146,6 +146,8 @@ export function resolveConfigFieldRule(fieldPath, scope) {
|
|
|
146
146
|
// 仅 agent-config 声明该字段,relation/defaults 由 schema 路由拒绝。
|
|
147
147
|
if (field === 'baseagentSkills')
|
|
148
148
|
return scalar(field, 'boolean', 'owner-only');
|
|
149
|
+
if (field === 'bootstrapWelcome')
|
|
150
|
+
return scalar(field, 'boolean', 'owner-only');
|
|
149
151
|
if (field === 'ability')
|
|
150
152
|
return readonlyObject('ability');
|
|
151
153
|
if (field === 'ability.codeApproval.enabled')
|
|
@@ -662,9 +662,9 @@ export function read(target, sel, opts = {}) {
|
|
|
662
662
|
const normalized = target === ConfigTarget.Process
|
|
663
663
|
? normalizeProcessConfigCompat(normalizeDaemonServices(migrated))
|
|
664
664
|
: target === ConfigTarget.Agent
|
|
665
|
-
? normalizeGroupChatmodeCompat(normalizeAgentConfigForRead(migrated, sel?.self))
|
|
665
|
+
? normalizeGroupChatmodeCompat(normalizeAgentConfigForRead(migrated, sel?.self), 18)
|
|
666
666
|
: target === ConfigTarget.Relation
|
|
667
|
-
? normalizeGroupChatmodeCompat(foldLegacyProactiveBlock(migrated))
|
|
667
|
+
? normalizeGroupChatmodeCompat(foldLegacyProactiveBlock(migrated), 11)
|
|
668
668
|
: target === ConfigTarget.Role
|
|
669
669
|
? normalizeRoleGroupChatmodeCompat(normalizeRoleEffortCompat(migrated))
|
|
670
670
|
: migrated;
|
|
@@ -882,7 +882,12 @@ function normalizeRelationConfigForWrite(value) {
|
|
|
882
882
|
normalizeShowActivitiesCompat(mutable);
|
|
883
883
|
return mutable;
|
|
884
884
|
}
|
|
885
|
-
|
|
885
|
+
/** A version limit keeps schema-backed reads compatible only with published configs. */
|
|
886
|
+
function normalizeGroupChatmodeCompat(value, maxLegacyVersion) {
|
|
887
|
+
const version = value?.$schema_version;
|
|
888
|
+
if (maxLegacyVersion !== undefined && version !== undefined
|
|
889
|
+
&& (typeof version !== 'number' || version > maxLegacyVersion))
|
|
890
|
+
return value;
|
|
886
891
|
if (value?.chatmode?.group !== 'interactive')
|
|
887
892
|
return value;
|
|
888
893
|
return { ...value, chatmode: { ...value.chatmode, group: 'proactive' } };
|
|
@@ -1072,7 +1077,7 @@ export function mutateConfig(target, sel, mutate) {
|
|
|
1072
1077
|
release();
|
|
1073
1078
|
}
|
|
1074
1079
|
}
|
|
1075
|
-
/**
|
|
1080
|
+
/** Retire both local compatibility fields after freshly confirmed protocol ownership. */
|
|
1076
1081
|
export function clearConfiguredOwnerAfterConsensus(subjectAid, ownerAid) {
|
|
1077
1082
|
const normalizedOwnerAid = ownerAid.trim();
|
|
1078
1083
|
if (!isValidAid(normalizedOwnerAid) || subjectAid === ownerResolver.getDaemonAid())
|
|
@@ -1087,17 +1092,8 @@ export function clearConfiguredOwnerAfterConsensus(subjectAid, ownerAid) {
|
|
|
1087
1092
|
return mutateConfig(ConfigTarget.Agent, { self: subjectAid }, config => {
|
|
1088
1093
|
if (!isConfirmed())
|
|
1089
1094
|
return;
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
if (!Array.isArray(config.owners))
|
|
1093
|
-
return;
|
|
1094
|
-
const owners = config.owners.filter((owner) => typeof owner !== 'string' || owner.trim() !== normalizedOwnerAid);
|
|
1095
|
-
if (owners.length === config.owners.length)
|
|
1096
|
-
return;
|
|
1097
|
-
if (owners.length > 0)
|
|
1098
|
-
config.owners = owners;
|
|
1099
|
-
else
|
|
1100
|
-
delete config.owners;
|
|
1095
|
+
delete config.owner;
|
|
1096
|
+
delete config.owners;
|
|
1101
1097
|
}).changed;
|
|
1102
1098
|
}
|
|
1103
1099
|
function cloneConfigValue(value) {
|
|
@@ -1115,7 +1111,7 @@ function sortConfigValue(value) {
|
|
|
1115
1111
|
.sort(([left], [right]) => left.localeCompare(right))
|
|
1116
1112
|
.map(([key, nested]) => [key, sortConfigValue(nested)]));
|
|
1117
1113
|
}
|
|
1118
|
-
function acquireConfigMutationLock(file) {
|
|
1114
|
+
export function acquireConfigMutationLock(file) {
|
|
1119
1115
|
const lockDir = resolveManagedLockPath('config', file, `${file}.mutation.lock`);
|
|
1120
1116
|
const ownerFile = path.join(lockDir, 'owner.json');
|
|
1121
1117
|
const token = crypto.randomBytes(16).toString('hex');
|
|
@@ -1439,7 +1435,7 @@ export function validateConfigFile(target, sel) {
|
|
|
1439
1435
|
}
|
|
1440
1436
|
if ((target === ConfigTarget.Agent || target === ConfigTarget.Relation)
|
|
1441
1437
|
&& sanitized && typeof sanitized === 'object') {
|
|
1442
|
-
sanitized = normalizeGroupChatmodeCompat(sanitized);
|
|
1438
|
+
sanitized = normalizeGroupChatmodeCompat(sanitized, target === ConfigTarget.Agent ? 18 : 11);
|
|
1443
1439
|
}
|
|
1444
1440
|
if (target === ConfigTarget.Role) {
|
|
1445
1441
|
sanitized = normalizeRoleGroupChatmodeCompat(normalizeRoleEffortCompat(sanitized));
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export const SERVICE_RESTART_MAX_ATTEMPTS = 3;
|
|
2
2
|
export const SERVICE_RESTART_WINDOW_MS = 900000;
|
|
3
3
|
export const SERVICE_RESTART_BACKOFF_MS = 5000;
|
|
4
|
+
export const SERVICE_STARTUP_TIMEOUT_MS = 45000;
|
|
4
5
|
export const SERVICE_HEALTH_INTERVALS = {
|
|
5
6
|
tcp: { startup: 500, running: 10000 },
|
|
6
7
|
http: { startup: 1000, running: 15000 },
|
|
@@ -13,7 +13,7 @@ import { configuredOwnerList } from './owner-config.js';
|
|
|
13
13
|
import { tryParseChannelKey } from '../core/channel-loader.js';
|
|
14
14
|
import { isValidAid } from '../aun/aid/validation.js';
|
|
15
15
|
import { getOwners, ownerResolver } from '../core/ownership/owner-resolver.js';
|
|
16
|
-
import {
|
|
16
|
+
import { sameOwnerQualification, sameOwnerRevision, requiresSameOwnerProof } from '../core/relation/same-owner-proof.js';
|
|
17
17
|
import { readRoleStore } from './role-store.js';
|
|
18
18
|
export function isAuthenticated(userId) {
|
|
19
19
|
return isValidAid(String(userId || '').trim());
|
|
@@ -60,7 +60,7 @@ export function getFirstStaticAgentOwner(aid) {
|
|
|
60
60
|
}
|
|
61
61
|
/** Revision for security-sensitive owner/contact/relation authorization inputs. */
|
|
62
62
|
export function authorizationConfigRevision(aid) {
|
|
63
|
-
const fingerprints = [ownerResolver.revision(aid),
|
|
63
|
+
const fingerprints = [ownerResolver.revision(aid), sameOwnerRevision(aid),
|
|
64
64
|
JSON.stringify(readRoleStore(aid)), fileRevision(agentConfig(aid)), fileRevision(agentPeerConfig(aid))];
|
|
65
65
|
const relations = agentRelationsDir(aid);
|
|
66
66
|
try {
|
|
@@ -105,8 +105,8 @@ export function resolvePeerRoleDetail(ctx) {
|
|
|
105
105
|
}
|
|
106
106
|
const actorRole = resolveActorDirectRole(ctx.selfAid, actor, channelType, operatorId);
|
|
107
107
|
if (channelType === 'aun' && ctx.chatType === 'private' && hasTrustedPrincipal(actor)
|
|
108
|
-
&& (
|
|
109
|
-
||
|
|
108
|
+
&& (sameOwnerQualification(ctx.selfAid, actor.principalId) === 'matched'
|
|
109
|
+
|| requiresSameOwnerProof(ctx.selfAid, actor.principalId))) {
|
|
110
110
|
const ownerCandidate = candidates.find(candidate => candidate.role === 'owner');
|
|
111
111
|
if (ownerCandidate)
|
|
112
112
|
return resultFor('owner', 'agent-owner', actor, ctx.selfAid);
|
|
@@ -114,14 +114,14 @@ export function resolvePeerRoleDetail(ctx) {
|
|
|
114
114
|
if (relation?.role !== undefined && relation.role !== null) {
|
|
115
115
|
return resultFor(actorRole, 'relation-actor', actor, ctx.selfAid);
|
|
116
116
|
}
|
|
117
|
-
if (
|
|
117
|
+
if (sameOwnerQualification(ctx.selfAid, actor.principalId) !== 'matched') {
|
|
118
118
|
return resultFor(null, 'none', actor, ctx.selfAid);
|
|
119
119
|
}
|
|
120
120
|
const store = readRoleStore(ctx.selfAid);
|
|
121
121
|
const valid = !store.diagnostics.some(diagnostic => diagnostic.code === 'INVALID_ROLE_REGISTRY'
|
|
122
122
|
|| diagnostic.code === 'MISSING_ROLE_REGISTRY');
|
|
123
123
|
const role = valid ? normalizeDefaultRole(store.registry.defaultRoles.paTeam ?? 'member', ctx.selfAid) : null;
|
|
124
|
-
return resultFor(role, '
|
|
124
|
+
return resultFor(role, 'internal-contact-default', actor, ctx.selfAid);
|
|
125
125
|
}
|
|
126
126
|
if (ctx.chatType === 'private') {
|
|
127
127
|
if (actorRole)
|