evolcore 0.0.43-test.1 → 0.0.43-test.3
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 +31 -1
- package/README.md +22 -0
- package/dist/agents/claude-runner.js +26 -2
- package/dist/agents/codex/app-server-client.js +12 -0
- package/dist/agents/codex-runner.js +49 -8
- package/dist/agents/ecagent-runner.js +39 -15
- package/dist/agents/gemini-runner.js +15 -12
- package/dist/agents/tool-time-context.js +55 -0
- package/dist/aun/aid/agentmd.js +21 -1
- package/dist/aun/menu/client.js +1 -1
- package/dist/aun/model-headers.js +17 -0
- package/dist/aun/msg/p2p.js +7 -2
- package/dist/channels/aun.js +522 -50
- package/dist/channels/builtin-plugins.js +16 -11
- package/dist/channels/daemon.js +4 -0
- package/dist/channels/dingtalk.js +83 -31
- package/dist/channels/feishu.js +29 -13
- package/dist/channels/qqbot.js +32 -11
- package/dist/channels/wechat.js +13 -3
- package/dist/channels/wecom.js +67 -27
- package/dist/cli/agent-command.js +3 -86
- package/dist/cli/agent-create.js +20 -6
- package/dist/cli/agent.js +1 -79
- package/dist/cli/aun-commands.js +18 -19
- package/dist/cli/config.js +1 -1
- package/dist/cli/daemon-commands.js +47 -2
- package/dist/cli/data-command.js +9 -1
- package/dist/cli/debug-mode.js +1 -1
- package/dist/cli/diag.js +1 -1
- package/dist/cli/directory.js +149 -91
- package/dist/cli/getmeta-command.js +1 -1
- package/dist/cli/index.js +79 -22
- package/dist/cli/init.js +1 -23
- package/dist/cli/link-rules.js +1 -1
- package/dist/cli/managed-command-guard.js +0 -1
- package/dist/cli/pa-workspace-command.js +36 -2
- package/dist/cli/peer.js +3 -2
- package/dist/cli/restart-monitor.js +17 -3
- package/dist/cli/role.js +1 -1
- package/dist/cli/session-command.js +1 -1
- package/dist/cli/stats.js +2 -2
- package/dist/cli/task-context.js +3 -1
- package/dist/cli/thread-command.js +1 -1
- package/dist/cli/watch-msg.js +1 -1
- package/dist/config/builtin-role-templates.js +2 -2
- package/dist/config/builtin-roles.js +2 -1
- package/dist/config/config-field-policy.js +7 -2
- package/dist/config/config-manager.js +32 -10
- package/dist/config/peer-role-resolver.js +23 -1
- package/dist/config/role-schema.js +29 -4
- package/dist/config/role-service.js +12 -7
- package/dist/config/role-store.js +30 -8
- package/dist/config-store.js +75 -4
- package/dist/core/agent-ipc-registration.js +16 -59
- package/dist/core/auth/auth-gateway.js +14 -4
- package/dist/core/auth/authorization-audit.js +52 -14
- package/dist/core/auth/operation-authorizer.js +17 -11
- package/dist/core/auth/operation-catalog.js +5 -13
- package/dist/core/channel-loader.js +152 -16
- package/dist/core/channel-runtime.js +5 -0
- package/dist/core/command/agent-control.js +2 -1
- package/dist/core/command/agentmd-menu-request.js +50 -0
- package/dist/core/command/agentmd-menu.js +156 -0
- package/dist/core/command/cli-intent-parser.js +0 -8
- package/dist/core/command/command-handler.js +47 -40
- package/dist/core/command/connect-menu.js +7 -3
- package/dist/core/command/menu-catalog.js +16 -2
- package/dist/core/command/menu-handler.js +107 -14
- package/dist/core/command/menu-protocol.js +28 -0
- package/dist/core/command/role-menu.js +23 -9
- package/dist/core/command/slash-handler.js +139 -51
- package/dist/core/daemon-file-cache.js +3 -3
- package/dist/core/daemon-lifecycle.js +9 -1
- package/dist/core/evolagent-registry.js +5 -4
- package/dist/core/evolagent.js +10 -12
- package/dist/core/handoff/argv-parse.js +115 -0
- package/dist/core/handoff/ipc-registration.js +1 -1
- package/dist/core/ipc-registration.js +19 -2
- package/dist/core/lifecycle-notice.js +185 -0
- package/dist/core/memory/consolidation.js +8 -1
- package/dist/core/memory/relation-sweep.js +20 -8
- package/dist/core/message/aun-ipc-sender.js +35 -2
- package/dist/core/message/contact-admission.js +530 -0
- package/dist/core/message/im-renderer.js +111 -16
- package/dist/core/message/message-admission.js +29 -54
- package/dist/core/message/message-bridge.js +62 -8
- package/dist/core/message/message-utils.js +9 -5
- package/dist/core/message/peer-mode.js +55 -13
- package/dist/core/message/response-engine.js +298 -78
- package/dist/core/message/retry-scheduler.js +4 -0
- package/dist/core/ownership/owner-resolver.js +72 -34
- package/dist/core/permission/ec-command-parser.js +25 -38
- package/dist/core/permission/readonly-shell-query.js +34 -8
- package/dist/core/permission/tool-policy.js +50 -5
- package/dist/core/relation/pa-team.js +127 -0
- package/dist/core/role/runtime-policy.js +18 -5
- package/dist/core/session/session-manager.js +9 -1
- package/dist/core/soul.js +66 -0
- package/dist/core/system-session/memory.js +2 -2
- package/dist/core/thread/thread-service.js +6 -4
- package/dist/directory/contact-admission-paths.js +9 -0
- package/dist/directory/owner-directory-admission.js +125 -29
- package/dist/directory/owner-directory-cache.js +554 -58
- package/dist/directory/owner-directory-identity.js +60 -0
- package/dist/directory/owner-directory-markdown.js +154 -58
- package/dist/directory/owner-directory-policy.js +108 -0
- package/dist/directory/owner-directory-query-operation.js +399 -90
- package/dist/directory/owner-directory-remarks.js +29 -2
- package/dist/directory/owner-directory-request-operation.js +76 -0
- package/dist/directory/owner-directory-scope.js +35 -4
- package/dist/directory/owner-directory-search.js +118 -33
- package/dist/directory/owner-directory-store.js +117 -30
- package/dist/directory/owner-directory-text.js +60 -0
- package/dist/eck/kit-renderer.js +18 -8
- package/dist/eck/manifest-engine.js +55 -6
- package/dist/ecweb/basic-settings-service.js +2 -2
- package/dist/ecweb/message-context-service.js +28 -16
- package/dist/index.js +20 -5
- package/dist/ipc.js +1 -1
- package/dist/paths.js +29 -1
- package/dist/product.js +1 -0
- package/dist/response-system/config-resolver.js +1 -1
- package/dist/response-system/engines/v1/index.js +2 -1
- package/dist/response-system/modes/single-session/index.js +7 -2
- package/dist/trigger/scheduler.js +7 -4
- package/dist/trigger/validation.js +4 -0
- package/dist/utils/error-utils.js +12 -7
- package/dist/utils/logger.js +13 -4
- package/dist/utils/npm-ops.js +2 -2
- package/dist/utils/windows-autostart.js +1 -1
- package/ecagent/README.md +18 -0
- package/ecagent/dist/agent-loop.js +43 -1
- package/ecagent/dist/harness/agent-harness.d.ts +2 -0
- package/ecagent/dist/harness/agent-harness.js +24 -8
- package/ecagent/dist/harness/compaction/compaction.js +3 -0
- package/ecagent/dist/harness/types.d.ts +1 -0
- package/kits/docs/INDEX.md +1 -0
- package/kits/docs/channels/aun.md +1 -1
- package/kits/docs/context-assembly.md +21 -6
- package/kits/docs/eck_templates/INDEX.template.md +1 -2
- package/kits/docs/evolcore/INDEX.md +4 -1
- package/kits/docs/evolcore/agent-create.md +5 -5
- package/kits/docs/evolcore/agent.md +4 -9
- package/kits/docs/evolcore/directory.md +227 -0
- package/kits/docs/evolcore/ecweb-lifecycle.md +26 -0
- package/kits/docs/evolcore/file-navigation.md +265 -0
- package/kits/docs/evolcore/menu-protocol.md +55 -0
- package/kits/docs/evolcore/msg.md +1 -0
- package/kits/docs/evolcore/peer.md +2 -1
- package/kits/docs/evolcore/response.md +7 -1
- package/kits/docs/evolcore/task.md +2 -0
- package/kits/docs/evolcore/tool-authorization.md +1 -1
- package/kits/docs/evolcore/trigger.md +4 -0
- package/kits/docs/identity/ROLE_DETAIL.md +2 -0
- package/kits/docs/prompt-loading-architecture.md +6 -2
- package/kits/eck_manifest.auxiliary.json +1 -0
- package/kits/eck_manifest.json +64 -7
- package/kits/eck_manifest.memory.json +93 -4
- package/kits/rules/01-overview.md +2 -2
- package/kits/rules/03-identity.md +10 -9
- package/kits/rules/05-venue.md +2 -4
- package/kits/rules/06-channel.md +1 -1
- package/kits/schemas/_meta.json +44 -3
- package/kits/schemas/agent-config.schema.18.json +5 -0
- package/kits/schemas/agent-config.schema.19.json +924 -0
- package/kits/schemas/agent-config.schema.20.json +925 -0
- package/kits/schemas/relation-config.schema.12.json +289 -0
- package/kits/schemas/relation-config.schema.13.json +289 -0
- package/kits/schemas/role-config.schema.2.json +215 -0
- package/kits/schemas/role-config.schema.3.json +1038 -0
- package/kits/schemas/role-registry.schema.1.json +3 -2
- package/kits/skills/ec-skill/scripts/cli.mjs +3 -2
- package/kits/skills/ec-trigger/SKILL.md +4 -4
- package/kits/skills/personal-assistant/SKILL.md +109 -53
- package/kits/skills/personal-assistant/references/02-bootstrap.md +73 -30
- package/kits/skills/personal-assistant/scripts/clean.mjs +35 -18
- package/kits/skills/personal-assistant/scripts/init.mjs +41 -2
- package/kits/skills/personal-assistant/scripts/lib/persona.mjs +185 -0
- package/kits/skills/personal-assistant/scripts/migrate.mjs +55 -4
- package/kits/skills/personal-assistant/scripts/pa.mjs +173 -0
- package/kits/skills/personal-assistant/scripts/uninstall.mjs +130 -0
- package/kits/skills/personal-assistant/templates/persona-section.md +3 -3
- package/kits/templates/message-fragments/handoff-request-to-target.md +1 -1
- package/kits/templates/soul/00-GUIDE.md +39 -0
- package/kits/templates/soul/01-identity.md +5 -0
- package/kits/templates/soul/02-persona.md +11 -0
- package/kits/templates/soul/03-duties.md +5 -0
- package/kits/templates/soul/04-working-style.md +5 -0
- package/kits/templates/system-fragments/bootstrap.md +7 -7
- package/kits/templates/system-fragments/channel.md +2 -2
- package/kits/templates/system-fragments/commands.md +3 -2
- package/kits/templates/system-fragments/directory-contacts.md +9 -0
- package/kits/templates/system-fragments/memory.md +1 -1
- package/kits/templates/system-fragments/personal-assistant.md +50 -0
- package/kits/templates/system-fragments/reply.md +7 -0
- package/kits/templates/system-fragments/session.md +6 -2
- package/package.json +3 -2
- package/dist/cli/handoff-command.js +0 -353
- package/dist/directory/owner-directory-remark-operation.js +0 -147
- package/kits/docs/evolcore/self-summary.md +0 -29
|
@@ -170,13 +170,13 @@ const OPERATIONS = [
|
|
|
170
170
|
authorizationPolicy: { authority: 'agent-owner', permissionMode: 'bypass', mode: 'require' },
|
|
171
171
|
},
|
|
172
172
|
{
|
|
173
|
-
id: 'ec.directory.
|
|
173
|
+
id: 'ec.directory.request',
|
|
174
174
|
category: 'write-own',
|
|
175
175
|
dangerous: false,
|
|
176
176
|
defaultScopes: ['agent'],
|
|
177
|
-
description: '
|
|
177
|
+
description: 'Send an encrypted app-v1 friend invitation to a target AID',
|
|
178
178
|
sources: ['agent-tool'],
|
|
179
|
-
authorizationTarget: '
|
|
179
|
+
authorizationTarget: 'current-agent',
|
|
180
180
|
authorizationPolicy: { authority: 'agent-owner', permissionMode: 'bypass', mode: 'require' },
|
|
181
181
|
},
|
|
182
182
|
...PROVIDER_OPERATIONS,
|
|
@@ -829,14 +829,6 @@ const OPERATIONS = [
|
|
|
829
829
|
description: '获取 agent 配置(含凭证)',
|
|
830
830
|
sources: ['menu', 'menu.cli', 'control'],
|
|
831
831
|
},
|
|
832
|
-
{
|
|
833
|
-
id: 'agent.persona',
|
|
834
|
-
category: 'write-agent',
|
|
835
|
-
dangerous: false,
|
|
836
|
-
defaultScopes: ['agent'],
|
|
837
|
-
description: '读取或更新当前 Agent 的 persona.md',
|
|
838
|
-
sources: ['agent-tool', 'slash', 'menu', 'control'],
|
|
839
|
-
},
|
|
840
832
|
{
|
|
841
833
|
id: 'agent.welcome',
|
|
842
834
|
category: 'write-agent',
|
|
@@ -1297,7 +1289,7 @@ const OPERATIONS = [
|
|
|
1297
1289
|
dangerous: false,
|
|
1298
1290
|
defaultScopes: ['relation', 'agent'],
|
|
1299
1291
|
description: 'Read and verify a public Agent agent.md',
|
|
1300
|
-
sources: ['agent-tool'],
|
|
1292
|
+
sources: ['agent-tool', 'menu'],
|
|
1301
1293
|
},
|
|
1302
1294
|
{
|
|
1303
1295
|
id: 'ec.aid.agentmd.put',
|
|
@@ -1305,7 +1297,7 @@ const OPERATIONS = [
|
|
|
1305
1297
|
dangerous: true,
|
|
1306
1298
|
defaultScopes: ['agent'],
|
|
1307
1299
|
description: 'Sign and publish the current Agent local agent.md',
|
|
1308
|
-
sources: ['agent-tool'],
|
|
1300
|
+
sources: ['agent-tool', 'menu'],
|
|
1309
1301
|
minimumPermissionMode: 'request',
|
|
1310
1302
|
authorizationTarget: 'current-agent',
|
|
1311
1303
|
},
|
|
@@ -9,6 +9,10 @@ import { logger } from '../utils/logger.js';
|
|
|
9
9
|
import { assertAgentAidAvailable } from '../config/config-manager.js';
|
|
10
10
|
import { PluginHandle } from './plugin-lifecycle.js';
|
|
11
11
|
import { ContactBindRegistry } from './contact-bind-registry.js';
|
|
12
|
+
function isMissingChannelDependency(error) {
|
|
13
|
+
const code = error?.code;
|
|
14
|
+
return code === 'ERR_MODULE_NOT_FOUND' || code === 'MODULE_NOT_FOUND';
|
|
15
|
+
}
|
|
12
16
|
// ── Shared helpers for plugins ─────────────────────────────────────────────
|
|
13
17
|
/** Resolve showActivities for a single instance (instance overrides default). */
|
|
14
18
|
export function resolveShowActivities(inst) {
|
|
@@ -16,7 +20,7 @@ export function resolveShowActivities(inst) {
|
|
|
16
20
|
}
|
|
17
21
|
/**
|
|
18
22
|
* showMiddleResult / showIdleMonitor 策略。
|
|
19
|
-
* show_activities
|
|
23
|
+
* show_activities 对 interactive/paactive 私聊中间输出生效:
|
|
20
24
|
* all → 文本 + activity;text → 仅文本;none → 全部静默。
|
|
21
25
|
*/
|
|
22
26
|
export function middleOutputModePolicy(mode, chatType, _identity) {
|
|
@@ -32,6 +36,8 @@ export class ChannelLoader {
|
|
|
32
36
|
processDebug;
|
|
33
37
|
aunDefaultEncrypt;
|
|
34
38
|
plugins = new Map();
|
|
39
|
+
providerStatuses = new Map();
|
|
40
|
+
instanceStatuses = new Map();
|
|
35
41
|
contactBindRegistry = new ContactBindRegistry();
|
|
36
42
|
constructor(processDebug, aunDefaultEncrypt) {
|
|
37
43
|
this.processDebug = processDebug;
|
|
@@ -44,12 +50,84 @@ export class ChannelLoader {
|
|
|
44
50
|
if (plugin.contactBind)
|
|
45
51
|
this.contactBindRegistry.register(plugin.name, plugin.contactBind);
|
|
46
52
|
this.plugins.set(plugin.name, plugin);
|
|
53
|
+
this.providerStatuses.set(plugin.name, { channelType: plugin.name, status: 'loaded' });
|
|
47
54
|
logger.debug(`Registered channel plugin: ${plugin.name}`);
|
|
48
55
|
}
|
|
49
56
|
/** Look up a registered plugin by channel type (used by reload hooks). */
|
|
50
57
|
getPlugin(type) {
|
|
51
58
|
return this.plugins.get(type);
|
|
52
59
|
}
|
|
60
|
+
recordProviderFailure(channelType, error) {
|
|
61
|
+
if (this.plugins.has(channelType))
|
|
62
|
+
throw new Error(`Channel plugin '${channelType}' already registered`);
|
|
63
|
+
const missing = isMissingChannelDependency(error);
|
|
64
|
+
this.providerStatuses.set(channelType, {
|
|
65
|
+
channelType,
|
|
66
|
+
status: missing ? 'unavailable' : 'failed',
|
|
67
|
+
reason: missing
|
|
68
|
+
? { code: 'DEPENDENCY_MISSING', message: '渠道实现或依赖未安装' }
|
|
69
|
+
: { code: 'LOAD_FAILED', message: '渠道实现加载失败' },
|
|
70
|
+
});
|
|
71
|
+
logger.warn(`[ChannelLoader] Failed to load '${channelType}':`, error);
|
|
72
|
+
}
|
|
73
|
+
getSnapshot(agents) {
|
|
74
|
+
const configured = agents?.flatMap(agent => [
|
|
75
|
+
{ agentAid: agent.aid, channelType: 'aun', channelName: agent.effectiveChannelName('aun', 'main'), enabled: agent.config.enabled !== false },
|
|
76
|
+
...agent.config.channels.filter(inst => inst.type !== 'aun').map(inst => ({
|
|
77
|
+
agentAid: agent.aid, channelType: inst.type,
|
|
78
|
+
channelName: agent.effectiveChannelName(inst.type, inst.name),
|
|
79
|
+
enabled: agent.config.enabled !== false && inst.enabled !== false,
|
|
80
|
+
})),
|
|
81
|
+
]);
|
|
82
|
+
const entries = configured ? configured.map(config => {
|
|
83
|
+
const key = `${config.agentAid}::${config.channelName}`;
|
|
84
|
+
const recorded = this.instanceStatuses.get(key);
|
|
85
|
+
if (config.enabled && recorded?.snapshot.channelType === config.channelType)
|
|
86
|
+
return recorded;
|
|
87
|
+
const snapshot = {
|
|
88
|
+
agentAid: config.agentAid, channelName: config.channelName, channelType: config.channelType,
|
|
89
|
+
status: config.enabled ? 'disconnected' : 'disabled',
|
|
90
|
+
...(!config.enabled ? { reason: { code: 'CONFIG_DISABLED', message: '配置已禁用' } } : {}),
|
|
91
|
+
};
|
|
92
|
+
if (config.enabled && !this.plugins.has(config.channelType)) {
|
|
93
|
+
const provider = this.providerStatuses.get(config.channelType);
|
|
94
|
+
snapshot.status = provider?.status === 'failed' ? 'failed' : 'unavailable';
|
|
95
|
+
snapshot.reason = provider?.reason ?? { code: 'PROVIDER_NOT_FOUND', message: '渠道实现未注册' };
|
|
96
|
+
}
|
|
97
|
+
return { snapshot, runtime: undefined };
|
|
98
|
+
}) : [...this.instanceStatuses.values()];
|
|
99
|
+
const instances = entries.map(({ snapshot, runtime }) => {
|
|
100
|
+
const current = { ...snapshot, ...(snapshot.reason ? { reason: { ...snapshot.reason } } : {}) };
|
|
101
|
+
if (runtime && !runtime.lifecycle?.signal.aborted && snapshot.status !== 'connecting') {
|
|
102
|
+
try {
|
|
103
|
+
const live = runtime.channel.getStatus?.();
|
|
104
|
+
if (live?.connected === true) {
|
|
105
|
+
current.status = 'connected';
|
|
106
|
+
delete current.reason;
|
|
107
|
+
}
|
|
108
|
+
else if (live?.connected === false && current.status === 'connected') {
|
|
109
|
+
current.status = 'disconnected';
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
catch {
|
|
113
|
+
current.status = 'failed';
|
|
114
|
+
current.reason = { code: 'STATUS_FAILED', message: '渠道状态读取失败' };
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return current;
|
|
118
|
+
});
|
|
119
|
+
if (configured) {
|
|
120
|
+
const keys = new Set(configured.map(config => `${config.agentAid}::${config.channelName}`));
|
|
121
|
+
for (const [key, entry] of this.instanceStatuses) {
|
|
122
|
+
if (!keys.has(key) && !entry.runtime)
|
|
123
|
+
this.instanceStatuses.delete(key);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return {
|
|
127
|
+
providers: [...this.providerStatuses.values()].map(item => ({ ...item, ...(item.reason ? { reason: { ...item.reason } } : {}) })),
|
|
128
|
+
instances,
|
|
129
|
+
};
|
|
130
|
+
}
|
|
53
131
|
/**
|
|
54
132
|
* Create all runtime channels for an agent directly from its config.channels[].
|
|
55
133
|
* AUN is always created implicitly from agent.aid (no explicit entry required).
|
|
@@ -85,11 +163,6 @@ export class ChannelLoader {
|
|
|
85
163
|
async _buildInstances(configInsts, ctx) {
|
|
86
164
|
const result = [];
|
|
87
165
|
for (const inst of configInsts) {
|
|
88
|
-
const plugin = this.plugins.get(inst.type);
|
|
89
|
-
if (!plugin) {
|
|
90
|
-
logger.debug(`No plugin for channel type '${inst.type}', skipping`);
|
|
91
|
-
continue;
|
|
92
|
-
}
|
|
93
166
|
try {
|
|
94
167
|
const runtime = await this.createInstance(inst, ctx);
|
|
95
168
|
if (runtime) {
|
|
@@ -97,7 +170,8 @@ export class ChannelLoader {
|
|
|
97
170
|
logger.info(`✓ Channel '${inst.name}' (${inst.type}) created`);
|
|
98
171
|
}
|
|
99
172
|
else {
|
|
100
|
-
|
|
173
|
+
const status = this.instanceStatuses.get(`${ctx.agentName}::${inst.name}`)?.snapshot;
|
|
174
|
+
logger.info(`Channel '${inst.name}' (${inst.type}) skipped: ${status?.reason?.code ?? status?.status}`);
|
|
101
175
|
}
|
|
102
176
|
}
|
|
103
177
|
catch (err) {
|
|
@@ -107,31 +181,92 @@ export class ChannelLoader {
|
|
|
107
181
|
return result;
|
|
108
182
|
}
|
|
109
183
|
async createInstance(inst, ctx) {
|
|
184
|
+
const key = `${ctx.agentName}::${inst.name}`;
|
|
185
|
+
const snapshot = {
|
|
186
|
+
agentAid: ctx.agentName, channelName: inst.name, channelType: inst.type, status: 'created',
|
|
187
|
+
};
|
|
188
|
+
const entry = { snapshot };
|
|
189
|
+
this.instanceStatuses.set(key, entry);
|
|
190
|
+
if (inst.enabled === false) {
|
|
191
|
+
snapshot.status = 'disabled';
|
|
192
|
+
snapshot.reason = { code: 'CONFIG_DISABLED', message: '渠道配置已禁用' };
|
|
193
|
+
return null;
|
|
194
|
+
}
|
|
110
195
|
const plugin = this.plugins.get(inst.type);
|
|
111
|
-
if (!plugin)
|
|
112
|
-
|
|
196
|
+
if (!plugin) {
|
|
197
|
+
const provider = this.providerStatuses.get(inst.type);
|
|
198
|
+
snapshot.status = provider?.status === 'failed' ? 'failed' : 'unavailable';
|
|
199
|
+
snapshot.reason = provider?.reason ?? { code: 'PROVIDER_NOT_FOUND', message: '渠道实现未注册' };
|
|
200
|
+
return null;
|
|
201
|
+
}
|
|
113
202
|
let teardown;
|
|
114
203
|
const lifecycle = new PluginHandle(`${ctx.agentName}::${inst.name}`, () => teardown?.());
|
|
115
204
|
try {
|
|
116
205
|
const runtime = await plugin.createInstance(inst, { ...ctx, lifecycle });
|
|
117
206
|
if (!runtime) {
|
|
207
|
+
snapshot.status = 'unavailable';
|
|
208
|
+
snapshot.reason = { code: 'INVALID_CONFIG', message: '渠道配置不完整或无效' };
|
|
118
209
|
await lifecycle.dispose();
|
|
119
210
|
return null;
|
|
120
211
|
}
|
|
121
212
|
teardown = runtime.disconnect.bind(runtime);
|
|
122
213
|
const connect = runtime.connect.bind(runtime);
|
|
123
214
|
runtime.lifecycle = lifecycle;
|
|
124
|
-
runtime
|
|
125
|
-
runtime.
|
|
215
|
+
entry.runtime = runtime;
|
|
216
|
+
runtime.disconnect = () => {
|
|
217
|
+
if (inst.type === 'aun' || (snapshot.status !== 'failed' && snapshot.status !== 'unavailable')) {
|
|
218
|
+
snapshot.status = 'disconnected';
|
|
219
|
+
delete snapshot.reason;
|
|
220
|
+
}
|
|
221
|
+
return lifecycle.dispose().catch(error => {
|
|
222
|
+
snapshot.status = 'failed';
|
|
223
|
+
snapshot.reason = { code: 'DISCONNECT_FAILED', message: '渠道资源清理失败' };
|
|
224
|
+
throw error;
|
|
225
|
+
}).finally(() => { entry.runtime = undefined; });
|
|
226
|
+
};
|
|
227
|
+
runtime.connect = () => {
|
|
228
|
+
lifecycle.assertActive();
|
|
229
|
+
snapshot.status = 'connecting';
|
|
230
|
+
delete snapshot.reason;
|
|
231
|
+
return Promise.resolve().then(() => { lifecycle.assertActive(); return connect(); }).then(() => {
|
|
232
|
+
lifecycle.assertActive();
|
|
233
|
+
snapshot.status = 'connected';
|
|
234
|
+
}).catch(async (error) => {
|
|
235
|
+
if (!lifecycle.signal.aborted) {
|
|
236
|
+
const missing = isMissingChannelDependency(error);
|
|
237
|
+
snapshot.status = missing ? 'unavailable' : 'failed';
|
|
238
|
+
snapshot.reason = missing
|
|
239
|
+
? { code: 'DEPENDENCY_MISSING', message: '渠道依赖未安装' }
|
|
240
|
+
: { code: 'CONNECT_FAILED', message: '渠道连接失败' };
|
|
241
|
+
if (inst.type !== 'aun') {
|
|
242
|
+
try {
|
|
243
|
+
await lifecycle.dispose();
|
|
244
|
+
}
|
|
245
|
+
catch (disposeError) {
|
|
246
|
+
logger.warn(`[ChannelLoader] Cleanup failed for ${lifecycle.owner}:`, disposeError);
|
|
247
|
+
}
|
|
248
|
+
entry.runtime = undefined;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
throw error;
|
|
252
|
+
});
|
|
253
|
+
};
|
|
126
254
|
return runtime;
|
|
127
255
|
}
|
|
128
256
|
catch (error) {
|
|
257
|
+
const missing = isMissingChannelDependency(error);
|
|
258
|
+
snapshot.status = missing ? 'unavailable' : 'failed';
|
|
259
|
+
snapshot.reason = missing
|
|
260
|
+
? { code: 'DEPENDENCY_MISSING', message: '渠道依赖未安装' }
|
|
261
|
+
: { code: 'CREATE_FAILED', message: '渠道实例创建失败' };
|
|
129
262
|
try {
|
|
130
263
|
await lifecycle.dispose();
|
|
131
264
|
}
|
|
132
265
|
catch (disposeError) {
|
|
133
266
|
logger.warn(`[ChannelLoader] Cleanup failed for ${lifecycle.owner}:`, disposeError);
|
|
134
267
|
}
|
|
268
|
+
if (missing && inst.type !== 'aun')
|
|
269
|
+
return null;
|
|
135
270
|
throw error;
|
|
136
271
|
}
|
|
137
272
|
}
|
|
@@ -173,7 +308,7 @@ export class ChannelLoader {
|
|
|
173
308
|
}
|
|
174
309
|
await Promise.allSettled(inflight);
|
|
175
310
|
if (failed.length > 0) {
|
|
176
|
-
logger.warn(`[connectAll] ${failed.length} channel(s) failed initial connect
|
|
311
|
+
logger.warn(`[connectAll] ${failed.length} channel(s) failed initial connect: ${failed.map(f => f.name).join(', ')}`);
|
|
177
312
|
}
|
|
178
313
|
return connected;
|
|
179
314
|
}
|
|
@@ -353,16 +488,13 @@ export function buildReloadHooks(deps) {
|
|
|
353
488
|
debug: channelLoader.processDebug,
|
|
354
489
|
aunDefaultEncrypt: channelLoader.aunDefaultEncrypt,
|
|
355
490
|
};
|
|
356
|
-
const plugin = channelLoader.getPlugin(cfgInst.type);
|
|
357
|
-
if (!plugin)
|
|
358
|
-
throw new Error(`[Reload] No plugin for channel type '${cfgInst.type}'`);
|
|
359
491
|
const effInst = { ...cfgInst, name: channelName };
|
|
360
492
|
const newInst = await channelLoader.createInstance(effInst, ctx);
|
|
361
493
|
if (!newInst) {
|
|
362
494
|
// createInstance returns null for a disabled / invalid-credential channel.
|
|
363
495
|
// Not an error: skip it. Throwing here would propagate to reload(), which
|
|
364
496
|
// turns it into agent error state and takes down every healthy channel too.
|
|
365
|
-
logger.warn(`[Reload] Channel ${channelName} (${cfgInst.type})
|
|
497
|
+
logger.warn(`[Reload] Channel ${channelName} (${cfgInst.type}) unavailable or disabled, skipping`);
|
|
366
498
|
return;
|
|
367
499
|
}
|
|
368
500
|
try {
|
|
@@ -382,6 +514,10 @@ export function buildReloadHooks(deps) {
|
|
|
382
514
|
const index = channelInstances.indexOf(newInst);
|
|
383
515
|
if (index >= 0)
|
|
384
516
|
channelInstances.splice(index, 1);
|
|
517
|
+
if (cfgInst.type !== 'aun' && isMissingChannelDependency(error)) {
|
|
518
|
+
logger.warn(`[Reload] Channel ${channelName} dependency unavailable, skipping`);
|
|
519
|
+
return;
|
|
520
|
+
}
|
|
385
521
|
throw error;
|
|
386
522
|
}
|
|
387
523
|
},
|
|
@@ -93,6 +93,7 @@ export function createChannelConnectionRuntime(dependencies) {
|
|
|
93
93
|
}),
|
|
94
94
|
agent ? dependencies.ensureTriggerSchedulerStarted(agent) : Promise.resolve(),
|
|
95
95
|
Promise.resolve().then(() => dependencies.sendOnlineNoticeForChannel(instance)),
|
|
96
|
+
Promise.resolve().then(() => dependencies.sendLifecycleNoticeForChannel?.(instance)),
|
|
96
97
|
dependencies.trySendPendingRestartNotice(),
|
|
97
98
|
]);
|
|
98
99
|
};
|
|
@@ -168,6 +169,10 @@ export function createChannelStartupNotifications({ channelInstances, agentRegis
|
|
|
168
169
|
let pendingRestartNoticeSent = false;
|
|
169
170
|
let pendingRestartRetry;
|
|
170
171
|
const sendOnlineNoticeForChannel = (inst) => {
|
|
172
|
+
// AUN 的上线提示改走 volatile 生命周期通知(见 lifecycle-notice.ts),
|
|
173
|
+
// 这里只保留非 AUN 渠道的 durable 通知,避免同时开启时重复两条。
|
|
174
|
+
if (inst.channelType === 'aun')
|
|
175
|
+
return;
|
|
171
176
|
const name = inst.adapter.channelName;
|
|
172
177
|
const agent = agentRegistry.resolveByChannel(inst.adapter.channelKey) ?? agentRegistry.resolveByChannel(name);
|
|
173
178
|
if (!agent || !upmsg)
|
|
@@ -145,7 +145,8 @@ async function execOneShotCreate(a, peerId, service, subject) {
|
|
|
145
145
|
return { error: '一步创建兼容入口不接受 plan/owners/ownerAid/avatarFile/force', code: 'INVALID_ARGS' };
|
|
146
146
|
}
|
|
147
147
|
if (a.chatmode !== undefined && (!a.chatmode || typeof a.chatmode !== 'object' || Array.isArray(a.chatmode)
|
|
148
|
-
|| Object.entries(a.chatmode).some(([key, value]) => !['private', 'group', 'nothuman'].includes(key)
|
|
148
|
+
|| Object.entries(a.chatmode).some(([key, value]) => !['private', 'group', 'nothuman'].includes(key)
|
|
149
|
+
|| !(key === 'group' ? ['proactive'] : ['interactive', 'proactive', ...(key === 'private' ? ['paactive'] : [])]).includes(value)))) {
|
|
149
150
|
return { error: 'chatmode 必须包含有效的 private/group/nothuman 模式', code: 'INVALID_ARGS' };
|
|
150
151
|
}
|
|
151
152
|
let avatarUrl;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/** Includes value batches containing the AgentMD entry, for replay and E2EE guards. */
|
|
2
|
+
export function containsAgentMdMenuRequest(request) {
|
|
3
|
+
const args = request.args;
|
|
4
|
+
const command = typeof request.cmd === 'string' ? request.cmd.trim().split(/\s+/)[0] : '';
|
|
5
|
+
if (request.name === 'aid' || command === '/aid') {
|
|
6
|
+
return (request.type === 'menu.query' && args?.view === 'agentmd')
|
|
7
|
+
|| (request.type === 'menu.action' && request.action === 'agentmd.publish');
|
|
8
|
+
}
|
|
9
|
+
return request.type === 'menu.query' && request.name === 'menu' && args?.view === 'values'
|
|
10
|
+
&& Array.isArray(args.items) && args.items.some(item => item?.entryId === 'aid.agentmd');
|
|
11
|
+
}
|
|
12
|
+
/** Shared by the JSON validator and direct Menu execution entry points. */
|
|
13
|
+
export function validateAgentMdMenuRequest(request) {
|
|
14
|
+
const fail = (message) => ({ code: 'INVALID_ARGUMENT', message });
|
|
15
|
+
const args = request.args;
|
|
16
|
+
if (!args || typeof args !== 'object' || Array.isArray(args))
|
|
17
|
+
return fail('agentmd requires args');
|
|
18
|
+
const a = args;
|
|
19
|
+
const query = request.type === 'menu.query' && a.view === 'agentmd';
|
|
20
|
+
const publish = request.type === 'menu.action' && request.action === 'agentmd.publish';
|
|
21
|
+
if (!query && !publish)
|
|
22
|
+
return { code: 'NOT_SUPPORTED', message: 'Unsupported agentmd Menu operation' };
|
|
23
|
+
const allowed = query ? ['aid', 'view', 'protocolVersion', 'scope', 'self']
|
|
24
|
+
: ['aid', 'content', 'expectedEtag', 'expectedRelationVersion', 'protocolVersion', 'scope', 'self'];
|
|
25
|
+
if (Object.keys(a).some(key => !allowed.includes(key)))
|
|
26
|
+
return fail('Unsupported agentmd argument');
|
|
27
|
+
if (a.protocolVersion !== undefined && a.protocolVersion !== 1) {
|
|
28
|
+
return { code: 'SCHEMA_VERSION_UNSUPPORTED', message: 'Only agentmd protocol version 1 is supported' };
|
|
29
|
+
}
|
|
30
|
+
if (a.aid !== undefined && (typeof a.aid !== 'string' || !a.aid.trim()))
|
|
31
|
+
return fail('aid must be a non-empty string');
|
|
32
|
+
if (a.self !== undefined && (typeof a.self !== 'string' || !a.self.trim()))
|
|
33
|
+
return fail('self must be a non-empty string');
|
|
34
|
+
if (a.scope !== undefined && a.scope !== 'agent')
|
|
35
|
+
return fail('agentmd requires Agent scope');
|
|
36
|
+
if (publish) {
|
|
37
|
+
if (typeof a.content !== 'string' || !a.content.trim())
|
|
38
|
+
return fail('content must be non-empty Markdown');
|
|
39
|
+
// Includes a possible SDK tail signature. The payload has a separate 4096-byte limit.
|
|
40
|
+
if (Buffer.byteLength(a.content, 'utf8') > 6144)
|
|
41
|
+
return fail('agent.md document exceeds 6144 bytes');
|
|
42
|
+
if (typeof a.expectedEtag !== 'string' || !a.expectedEtag.trim()
|
|
43
|
+
|| a.expectedEtag.length > 512 || /[\r\n]/.test(a.expectedEtag))
|
|
44
|
+
return fail('expectedEtag is required');
|
|
45
|
+
if (!Number.isSafeInteger(a.expectedRelationVersion) || a.expectedRelationVersion < 1) {
|
|
46
|
+
return fail('expectedRelationVersion must be a positive integer');
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { isDeepStrictEqual } from 'node:util';
|
|
2
|
+
import { validateAgentMdDocument } from '@agentunion/fastaun';
|
|
3
|
+
import { agentmdGet, agentmdUpdate, AGENT_MD_MAX_PAYLOAD_BYTES, AGENT_DESCRIPTION_MAX_LENGTH, } from '../../aun/aid/agentmd.js';
|
|
4
|
+
import { ownerResolver } from '../ownership/owner-resolver.js';
|
|
5
|
+
import { validateAgentMdMenuRequest } from './agentmd-menu-request.js';
|
|
6
|
+
export const AGENT_MD_PROTECTED_FIELDS = [
|
|
7
|
+
'aid', 'type', 'owner', 'ownership', 'ownership_proof', 'ownership_release', 'entity_cert_fingerprint',
|
|
8
|
+
];
|
|
9
|
+
function fail(code, message) {
|
|
10
|
+
throw Object.assign(new Error(message), { code });
|
|
11
|
+
}
|
|
12
|
+
function parse(content, aid) {
|
|
13
|
+
try {
|
|
14
|
+
return validateAgentMdDocument(content, { expectedAid: aid, validateOwnership: false });
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
return fail('INVALID_ARGUMENT', error instanceof Error ? error.message : 'Invalid agent.md document');
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
const defaults = {
|
|
21
|
+
refresh: (aid) => ownerResolver.refresh(aid, { force: true, allowTransient: false, source: 'agentmd-menu' }),
|
|
22
|
+
read: (aid) => agentmdGet(aid, { withVerification: true, remoteOnly: true }),
|
|
23
|
+
update: agentmdUpdate,
|
|
24
|
+
};
|
|
25
|
+
/** Only protocol Ownership authorizes this editor; configured Owners and roles cannot grant it. */
|
|
26
|
+
export class AgentMdMenuService {
|
|
27
|
+
deps;
|
|
28
|
+
constructor(deps = defaults) {
|
|
29
|
+
this.deps = deps;
|
|
30
|
+
}
|
|
31
|
+
target(subject, args) {
|
|
32
|
+
const aid = subject.selfAid;
|
|
33
|
+
if (!aid || (args.aid !== undefined && args.aid !== aid) || (args.self !== undefined && args.self !== aid)) {
|
|
34
|
+
fail('FORBIDDEN', 'AgentMD must target the receiving Agent');
|
|
35
|
+
}
|
|
36
|
+
if (subject.channelType !== 'aun' || subject.chatType !== 'private'
|
|
37
|
+
|| (subject.menuTransportChatType ?? subject.chatType) !== 'private' || subject.menuEncrypted !== true
|
|
38
|
+
|| subject.fromControlChannel || subject.ecwebManagement
|
|
39
|
+
|| !subject.principalId || subject.actorId !== subject.principalId || subject.processRole === 'daemon-service') {
|
|
40
|
+
fail('FORBIDDEN', 'AgentMD editing requires an encrypted AUN request from the authenticated Owner');
|
|
41
|
+
}
|
|
42
|
+
return aid;
|
|
43
|
+
}
|
|
44
|
+
/** Cached Menu responses must still require the current protocol Owner. */
|
|
45
|
+
async preflight(subject) {
|
|
46
|
+
await this.authorize(this.target(subject, {}), subject);
|
|
47
|
+
}
|
|
48
|
+
async authorize(aid, subject, relationVersion) {
|
|
49
|
+
let view;
|
|
50
|
+
try {
|
|
51
|
+
view = await this.deps.refresh(aid);
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
return fail('OWNER_UNAVAILABLE', 'Fresh Ownership consensus is unavailable');
|
|
55
|
+
}
|
|
56
|
+
const c = view.consensus;
|
|
57
|
+
if (view.refreshFailure || view.consensusStatus === 'unavailable' || !c) {
|
|
58
|
+
fail('OWNER_UNAVAILABLE', 'Fresh Ownership consensus is unavailable');
|
|
59
|
+
}
|
|
60
|
+
if (view.consensusStatus !== 'consensus' || c.status !== 'consensus' || c.sub_aid !== aid
|
|
61
|
+
|| c.lock !== 'locked' || !Number.isSafeInteger(c.relation_version) || c.relation_version < 1
|
|
62
|
+
|| c.owner_aid !== subject.principalId) {
|
|
63
|
+
fail('FORBIDDEN', 'Only the current protocol Owner can edit this AgentMD');
|
|
64
|
+
}
|
|
65
|
+
if (relationVersion !== undefined && c.relation_version !== relationVersion) {
|
|
66
|
+
fail('OWNERSHIP_CONFLICT', 'Ownership changed; reopen the editor');
|
|
67
|
+
}
|
|
68
|
+
return c;
|
|
69
|
+
}
|
|
70
|
+
card(current, aid, consensus) {
|
|
71
|
+
if (current.source !== 'remote' || current.verification.status !== 'verified') {
|
|
72
|
+
fail('AGENTMD_UNVERIFIED', 'A verified remote AgentMD is required');
|
|
73
|
+
}
|
|
74
|
+
const parsed = parse(current.content, aid);
|
|
75
|
+
const fields = parsed.frontmatter;
|
|
76
|
+
if (['human', 'group', 'org', 'host'].includes(String(fields.type).trim().toLowerCase())) {
|
|
77
|
+
fail('NOT_SUPPORTED', 'This editor supports ordinary Agents only');
|
|
78
|
+
}
|
|
79
|
+
if (fields.owner !== consensus.owner_aid)
|
|
80
|
+
fail('OWNERSHIP_CONFLICT', 'AgentMD Owner does not match consensus');
|
|
81
|
+
const etag = current.remoteVersion?.etag;
|
|
82
|
+
if (!etag)
|
|
83
|
+
fail('REMOTE_VERSION_UNAVAILABLE', 'Remote AgentMD has no ETag');
|
|
84
|
+
if (consensus.agent_md_etag !== etag)
|
|
85
|
+
fail('REMOTE_VERSION_CONFLICT', 'AgentMD changed during ownership verification; reload');
|
|
86
|
+
return { ...parsed, etag };
|
|
87
|
+
}
|
|
88
|
+
async query(subject, args) {
|
|
89
|
+
const invalid = validateAgentMdMenuRequest({ type: 'menu.query', args });
|
|
90
|
+
if (invalid)
|
|
91
|
+
fail(invalid.code, invalid.message);
|
|
92
|
+
const aid = this.target(subject, args);
|
|
93
|
+
await this.authorize(aid, subject);
|
|
94
|
+
const current = await this.deps.read(aid);
|
|
95
|
+
const c = await this.authorize(aid, subject);
|
|
96
|
+
const card = this.card(current, aid, c);
|
|
97
|
+
return {
|
|
98
|
+
protocol: 'evol.agentmd', protocolVersion: 1, aid,
|
|
99
|
+
content: card.payload, etag: card.etag, relationVersion: c.relation_version,
|
|
100
|
+
verification: 'verified', protectedFields: AGENT_MD_PROTECTED_FIELDS,
|
|
101
|
+
limits: { maxPayloadBytes: AGENT_MD_MAX_PAYLOAD_BYTES, maxDescriptionCharacters: AGENT_DESCRIPTION_MAX_LENGTH },
|
|
102
|
+
atomicVersionCheck: false,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
async publish(subject, args) {
|
|
106
|
+
const invalid = validateAgentMdMenuRequest({ type: 'menu.action', action: 'agentmd.publish', args });
|
|
107
|
+
if (invalid)
|
|
108
|
+
fail(invalid.code, invalid.message);
|
|
109
|
+
const aid = this.target(subject, args);
|
|
110
|
+
const version = args.expectedRelationVersion;
|
|
111
|
+
await this.authorize(aid, subject, version);
|
|
112
|
+
const candidate = parse(args.content, aid);
|
|
113
|
+
let previousFields = {};
|
|
114
|
+
let result;
|
|
115
|
+
try {
|
|
116
|
+
result = await this.deps.update(aid, async (current) => {
|
|
117
|
+
const consensus = await this.authorize(aid, subject, version);
|
|
118
|
+
const base = this.card(current, aid, consensus);
|
|
119
|
+
if (base.etag !== args.expectedEtag)
|
|
120
|
+
fail('REMOTE_VERSION_CONFLICT', 'AgentMD changed; reload before publishing');
|
|
121
|
+
previousFields = base.frontmatter;
|
|
122
|
+
for (const field of AGENT_MD_PROTECTED_FIELDS) {
|
|
123
|
+
if (Object.hasOwn(base.frontmatter, field) !== Object.hasOwn(candidate.frontmatter, field)
|
|
124
|
+
|| !isDeepStrictEqual(base.frontmatter[field], candidate.frontmatter[field])) {
|
|
125
|
+
fail('PROTECTED_FIELD', `AgentMD field ${field} cannot be changed by this editor`);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return candidate.payload;
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
catch (error) {
|
|
132
|
+
// Keep SDK conditional-upload conflicts actionable at the Menu boundary.
|
|
133
|
+
if (String(error?.code ?? '').toLowerCase() === 'conflict') {
|
|
134
|
+
fail('REMOTE_VERSION_CONFLICT', 'AgentMD changed during upload; reload before retrying');
|
|
135
|
+
}
|
|
136
|
+
throw error;
|
|
137
|
+
}
|
|
138
|
+
// SDK acknowledgement is insufficient: confirm the actual remotely verified document.
|
|
139
|
+
const published = await this.deps.read(aid);
|
|
140
|
+
const consensus = await this.authorize(aid, subject, version);
|
|
141
|
+
const accepted = this.card(published, aid, consensus);
|
|
142
|
+
const body = (payload) => payload.replace(/\r\n/g, '\n')
|
|
143
|
+
.replace(/^---\n[\s\S]*?\n---(?:\n|$)/, '').trim();
|
|
144
|
+
if (!isDeepStrictEqual(candidate.frontmatter, accepted.frontmatter) || body(candidate.payload) !== body(accepted.payload)) {
|
|
145
|
+
fail('PUBLISH_NOT_CONFIRMED', 'The remote AgentMD does not confirm this edit; refresh before retrying');
|
|
146
|
+
}
|
|
147
|
+
return {
|
|
148
|
+
protocol: 'evol.agentmd', protocolVersion: 1, aid, published: true,
|
|
149
|
+
content: accepted.payload, etag: accepted.etag, relationVersion: consensus.relation_version,
|
|
150
|
+
verification: 'verified', versionChecked: result.versionChecked, atomicVersionCheck: false,
|
|
151
|
+
nameChanged: previousFields.name !== accepted.frontmatter.name,
|
|
152
|
+
...(previousFields.avatar !== accepted.frontmatter.avatar ? { avatar: accepted.frontmatter.avatar ?? '' } : {}),
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
export const agentMdMenuService = new AgentMdMenuService();
|
|
@@ -222,14 +222,6 @@ function parseAgentCommand(argv, source) {
|
|
|
222
222
|
return raw(source, argv, 'Invalid initialization arguments');
|
|
223
223
|
}
|
|
224
224
|
}
|
|
225
|
-
if (subcmd === 'persona') {
|
|
226
|
-
const tail = argv.at(-2) === '--format' && argv.at(-1) === 'json' ? argv.slice(0, -2) : argv;
|
|
227
|
-
const isShow = tail.length === 3 && tail[2] === 'show';
|
|
228
|
-
const isWrite = tail.length === 4 && (tail[2] === '--text' || tail[2] === '--file');
|
|
229
|
-
return isShow || isWrite
|
|
230
|
-
? recognized('agent.persona', 'agent', source, {}, argv)
|
|
231
|
-
: raw(source, argv, 'Invalid agent persona command');
|
|
232
|
-
}
|
|
233
225
|
if (subcmd === 'welcome') {
|
|
234
226
|
try {
|
|
235
227
|
const { action } = parseAgentWelcomeArgs(argv.slice(2));
|