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
|
@@ -8,7 +8,7 @@ import { renderCommandCardAsText } from '../interaction-router.js';
|
|
|
8
8
|
import { buildEnvelope, deliveryTargetFromSession, isInteractionSendAccepted, replyContextFromSession, sendInteractionPayload } from '../message/message-utils.js';
|
|
9
9
|
import { sessionTopicThreadId } from '../thread/topic-id.js';
|
|
10
10
|
import { resolvePaths, getPackageRoot, resolveRoot } from '../../paths.js';
|
|
11
|
-
import { loadDaemonConfig } from '../../config-store.js';
|
|
11
|
+
import { loadAgent, loadDaemonConfig } from '../../config-store.js';
|
|
12
12
|
import { parseOwnershipCommand, executeOwnershipCommand, ownershipFailure } from '../../aun/aid/ownership-operation.js';
|
|
13
13
|
import { ownerResolver, refreshOwnershipForAuthorization } from '../ownership/owner-resolver.js';
|
|
14
14
|
import { logger } from '../../utils/logger.js';
|
|
@@ -356,15 +356,17 @@ export class CommandHandler {
|
|
|
356
356
|
getTriggerSchedulerForAgent(agentAid) {
|
|
357
357
|
return this.triggerSchedulerResolver?.(agentAid) ?? (this.triggerSchedulerFallbackAid === agentAid ? this.triggerSchedulerFallback : undefined);
|
|
358
358
|
}
|
|
359
|
-
assertSessionLoopTrigger(session) {
|
|
359
|
+
assertSessionLoopTrigger(session, once = false) {
|
|
360
360
|
const daemonAid = this.getDaemonTriggerOwnerAid();
|
|
361
361
|
const schedulers = new Set([
|
|
362
362
|
this.getTriggerSchedulerForAgent(session.selfAID ?? ''),
|
|
363
363
|
daemonAid ? this.getTriggerSchedulerForAgent(daemonAid) : undefined,
|
|
364
364
|
]);
|
|
365
365
|
const triggers = [...schedulers].flatMap(scheduler => scheduler?.list({ all: true }) ?? [])
|
|
366
|
-
.filter(definition =>
|
|
367
|
-
|
|
366
|
+
.filter(definition => once
|
|
367
|
+
? definition.id === '__session-idle-check' && isDaemonEventSessionTrigger(definition)
|
|
368
|
+
: definition.id === '__session-idle-check'
|
|
369
|
+
|| (definition.source.type === 'event' && definition.source.eventPattern === 'session:idle'));
|
|
368
370
|
if (triggers.length === 0) {
|
|
369
371
|
throw sessionLoopError('LOOP_TRIGGER_NOT_FOUND', '未找到 session:idle Trigger,无法开启 loop');
|
|
370
372
|
}
|
|
@@ -594,9 +596,7 @@ export class CommandHandler {
|
|
|
594
596
|
validateTriggerRuntimeFields(definition, role, baseagent) {
|
|
595
597
|
if (!role)
|
|
596
598
|
return undefined;
|
|
597
|
-
const executionBaseagent =
|
|
598
|
-
? definition.execution.baseagent ?? baseagent
|
|
599
|
-
: baseagent;
|
|
599
|
+
const executionBaseagent = baseagent;
|
|
600
600
|
if (definition.execution.model) {
|
|
601
601
|
const modelDecision = validateModelSelectionForRole({
|
|
602
602
|
role,
|
|
@@ -712,20 +712,14 @@ export class CommandHandler {
|
|
|
712
712
|
if (permissionMode === 'fullaccess' && !canApprovePersistentFullAccess) {
|
|
713
713
|
return { error: '当前认证通道不能批准持久 fullaccess Trigger' };
|
|
714
714
|
}
|
|
715
|
-
if (
|
|
716
|
-
|
|
717
|
-
return { error: 'Trigger baseagent 不能为空' };
|
|
718
|
-
}
|
|
719
|
-
if (parsed.executionType !== 'trigger_session') {
|
|
720
|
-
return { error: 'Trigger baseagent 仅适用于 trigger_session' };
|
|
721
|
-
}
|
|
722
|
-
}
|
|
715
|
+
if ('baseagent' in parsed)
|
|
716
|
+
return { error: 'Trigger 不支持覆盖 baseagent;使用所属 Agent 当前基座' };
|
|
723
717
|
const daemonScheduler = schedulerAid === this.getDaemonTriggerOwnerAid(channel);
|
|
724
718
|
const triggerOwner = daemonScheduler
|
|
725
719
|
? undefined
|
|
726
720
|
: this.agentRegistry?.get?.(schedulerAid) ?? this.getOwningAgent(channel);
|
|
727
721
|
const executionBaseagent = parsed.executionType === 'trigger_session'
|
|
728
|
-
?
|
|
722
|
+
? triggerOwner?.baseagent ?? triggerRole.baseagent
|
|
729
723
|
?? (daemonScheduler ? this.parseDefaultBaseagent() : undefined)
|
|
730
724
|
: undefined;
|
|
731
725
|
if (parsed.executionType === 'trigger_session') {
|
|
@@ -761,7 +755,6 @@ export class CommandHandler {
|
|
|
761
755
|
...(script ? { script } : { prompt: parsed.prompt || '' }),
|
|
762
756
|
...(parsed.executionType === 'trigger_session' ? {
|
|
763
757
|
thread: parsed.triggerThread ?? 'by_trigger',
|
|
764
|
-
baseagent: executionBaseagent,
|
|
765
758
|
} : {}),
|
|
766
759
|
model: parsed.model,
|
|
767
760
|
timeoutMs: parsed.executionTimeoutMs,
|
|
@@ -1520,7 +1513,7 @@ export class CommandHandler {
|
|
|
1520
1513
|
/trigger list [--all] — 查看所有触发器
|
|
1521
1514
|
/trigger create <参数> — 创建触发器(set 为兼容别名)
|
|
1522
1515
|
/trigger update <名称|ID> <参数> — 修改触发器
|
|
1523
|
-
常用参数:--delay/--at/--cron/--every、--prompt、--description、--model、--effort、--permission(省略则继承;update 可用 inherit 清除覆盖)、--feedback、--target-channel/--target-channel-id、--trigger-thread、--
|
|
1516
|
+
常用参数:--delay/--at/--cron/--every、--prompt、--description、--model、--effort、--permission(省略则继承;update 可用 inherit 清除覆盖)、--feedback、--target-channel/--target-channel-id、--trigger-thread、--on-error、--retry-attempts/--retry-backoff、--script-runtime/--script-args/--script-timeout
|
|
1524
1517
|
/trigger enable <名称|ID> — 启用触发器
|
|
1525
1518
|
/trigger disable <名称|ID> — 暂停触发器
|
|
1526
1519
|
/trigger show <名称|ID> — 查看触发器详情
|
|
@@ -2069,7 +2062,9 @@ export class CommandHandler {
|
|
|
2069
2062
|
const command = parseOwnershipCommand(argv);
|
|
2070
2063
|
const targetAid = command.subjectAid ?? grant.selfAid;
|
|
2071
2064
|
const fullAccess = hasTrustedFullAccessDelegation(grant);
|
|
2072
|
-
|
|
2065
|
+
if (command.action !== 'reset-rejection' || !loadAgent(targetAid)) {
|
|
2066
|
+
ownerResolver.assertLocalSubject(targetAid);
|
|
2067
|
+
}
|
|
2073
2068
|
if (command.action === 'status') {
|
|
2074
2069
|
return { ok: true, state: await executeOwnershipCommand(command, grant.selfAid) };
|
|
2075
2070
|
}
|
|
@@ -2105,7 +2100,8 @@ export class CommandHandler {
|
|
|
2105
2100
|
args: {
|
|
2106
2101
|
self: targetAid,
|
|
2107
2102
|
targetAgentAid: targetAid,
|
|
2108
|
-
...(command.action === 'bind' ? { ownerAid: command.ownerAid } : {}),
|
|
2103
|
+
...(command.action === 'bind' || command.action === 'reset-rejection' ? { ownerAid: command.ownerAid } : {}),
|
|
2104
|
+
...(command.action === 'reset-rejection' ? { action: command.action } : {}),
|
|
2109
2105
|
...(command.action === 'transfer' ? { subAid: command.subAid, newOwnerAid: command.newOwnerAid } : {}),
|
|
2110
2106
|
...(command.action === 'accept' || command.action === 'reject'
|
|
2111
2107
|
? { decision: command.action, operationId: command.operationId } : {}),
|
|
@@ -11,7 +11,8 @@ export function parseManagedDaemonLogArgv(argv) {
|
|
|
11
11
|
for (let index = 1; index < argv.length; index += 1) {
|
|
12
12
|
const flag = argv[index];
|
|
13
13
|
if (flag === '--raw') {
|
|
14
|
-
|
|
14
|
+
query.raw = true;
|
|
15
|
+
continue;
|
|
15
16
|
}
|
|
16
17
|
if (flag === '--no-color')
|
|
17
18
|
continue;
|
|
@@ -100,7 +100,7 @@ const ENTRIES = [
|
|
|
100
100
|
},
|
|
101
101
|
// 模型与推理强度只在 Agent 级配置(见 model.agent / effort.agent),关系菜单不再提供。
|
|
102
102
|
relation('chatmode.relation', 'chatmode', '对话模式', 30, '/chatmode', 'chatmode.current', { options: { cmd: '/chatmode', operation: 'chatmode.current', scope: 'relation', mode: 'dynamic' }, update: { cmd: '/chatmode', operation: 'chatmode.update', scope: 'relation' }, control: 'select' }),
|
|
103
|
-
relation('activity.relation', 'activity', '中间输出', 40, '/activity', 'activity.current', { options: { cmd: '/activity', operation: 'activity.current', scope: 'relation', mode: 'static', items: [{ value: 'all', label: '
|
|
103
|
+
relation('activity.relation', 'activity', '中间输出', 40, '/activity', 'activity.current', { options: { cmd: '/activity', operation: 'activity.current', scope: 'relation', mode: 'static', items: [{ value: 'all', label: '全部显示' }, { value: 'text', label: '仅文字进展' }, { value: 'none', label: '全部静默' }] }, update: { cmd: '/activity', operation: 'activity.update', scope: 'relation' }, control: 'select' }),
|
|
104
104
|
{ id: 'task.activities', type: 'list', contexts: ['private_relation', 'group_relation'], name: 'task', label: '任务活动', section: 'relation_behavior', order: 45, query: { cmd: '/task', args: { view: 'activities' }, operation: 'task.activity.read', scope: 'relation', mode: 'dynamic' }, control: 'list' },
|
|
105
105
|
relation('permissionMode.relation', 'permission', '权限模式', 50, '/perm', 'permission.current', { query: { cmd: '/perm', args: { scope: 'role' }, operation: 'permission.current', scope: 'relation' }, options: undefined, update: { cmd: '/perm', operation: 'permission.current', scope: 'relation', supported: false }, control: 'select' }),
|
|
106
106
|
relation('mentionMode.relation', 'group', '群消息响应', 60, '/group', 'group.mentionmode.current', { contexts: ['group_relation'], query: { cmd: '/group', args: { view: 'mentionMode', scope: 'relation' }, operation: 'group.mentionmode.current', scope: 'relation' }, options: { cmd: '/group', args: { option: 'mentionMode', scope: 'relation' }, operation: 'group.mentionmode.current', scope: 'relation' }, update: { cmd: '/group', args: { resource: 'mentionMode', scope: 'relation' }, operation: 'group.mentionmode.update', scope: 'relation' }, control: 'select' }),
|
|
@@ -4,6 +4,7 @@ import { getBaseagentSnapshot, loadedBaseagentIds } from '../../agents/baseagent
|
|
|
4
4
|
import { resolveBaseagentModelSelection } from '../../agents/baseagent.js';
|
|
5
5
|
import { normalizePeer, writeAgentModelConfig } from '../model/config-scope.js';
|
|
6
6
|
import { formatPeerKey } from '../relation/peer-identity.js';
|
|
7
|
+
import { writeChatmodeConfig } from './chatmode-config.js';
|
|
7
8
|
import { modelMatches, getCatalog, getBaseagentCatalog, resolveCatalogModel, assertCatalogSelectable, CONFIGURABLE_EFFORTS, configurableEfforts } from '../model/model-catalog.js';
|
|
8
9
|
import { constrainResolvedModelForRole, filterModelsForRole, validateModelSelectionForRole } from '../model/model-permission.js';
|
|
9
10
|
import { hasModelSwitcher } from '../../agents/runner-types.js';
|
|
@@ -762,16 +763,6 @@ function readMenuChatmode(target) {
|
|
|
762
763
|
catch { }
|
|
763
764
|
return { value: defaultChatmodeForField(target.field), source: 'builtin' };
|
|
764
765
|
}
|
|
765
|
-
function writeMenuChatmode(target, value) {
|
|
766
|
-
const route = routeFieldPath(target.fieldPath, target.scope);
|
|
767
|
-
const cur = cfgRead(route.target, target.sel) || {};
|
|
768
|
-
const block = cur.chatmode && typeof cur.chatmode === 'object' && !Array.isArray(cur.chatmode)
|
|
769
|
-
? { ...cur.chatmode }
|
|
770
|
-
: {};
|
|
771
|
-
block[target.field] = value;
|
|
772
|
-
cur.chatmode = block;
|
|
773
|
-
cfgWrite(route.target, cur, target.sel);
|
|
774
|
-
}
|
|
775
766
|
function menuMentionModeScope(args) {
|
|
776
767
|
const raw = menuStringArg(args, 'scope') ?? 'relation';
|
|
777
768
|
if (raw === 'agent' || raw === 'relation')
|
|
@@ -988,7 +979,10 @@ function resolveMenuActivityTarget(params) {
|
|
|
988
979
|
}
|
|
989
980
|
if (!peerKey)
|
|
990
981
|
return { error: 'relation scope 需要 peer/peerKey,或可推导的当前对端', code: 'MISSING_PEER' };
|
|
991
|
-
|
|
982
|
+
const relation = cfgRead(ConfigTarget.Relation, { ...sel, peerKey });
|
|
983
|
+
const chatType = relation?.targetKind
|
|
984
|
+
?? (!explicitPeer ? params.session?.chatType ?? params.explicitChatType : undefined);
|
|
985
|
+
return { scope, sel: { ...sel, peerKey }, fieldPath: 'show_activities', chatType };
|
|
992
986
|
}
|
|
993
987
|
function readMenuActivity(target, fallback = 'all') {
|
|
994
988
|
try {
|
|
@@ -998,7 +992,7 @@ function readMenuActivity(target, fallback = 'all') {
|
|
|
998
992
|
}
|
|
999
993
|
}
|
|
1000
994
|
catch { }
|
|
1001
|
-
return { value: fallback, source: 'builtin' };
|
|
995
|
+
return { value: target.chatType === 'group' ? 'none' : fallback, source: 'builtin' };
|
|
1002
996
|
}
|
|
1003
997
|
function writeMenuActivity(target, value) {
|
|
1004
998
|
const route = routeFieldPath(target.fieldPath, target.scope);
|
|
@@ -2156,7 +2150,7 @@ export async function getSubMenuItems(cmd, channel, channelId, userId, args, ove
|
|
|
2156
2150
|
const fallback = this.agentRegistry?.getShowActivities?.(channel) ?? 'all';
|
|
2157
2151
|
const currentMode = readMenuActivity(target, fallback).value;
|
|
2158
2152
|
return [
|
|
2159
|
-
{ value: 'all', label: '
|
|
2153
|
+
{ value: 'all', label: '全部显示', selected: currentMode === 'all' },
|
|
2160
2154
|
{ value: 'text', label: '仅文字进展', selected: currentMode === 'text' },
|
|
2161
2155
|
{ value: 'none', label: '全部静默', selected: currentMode === 'none' },
|
|
2162
2156
|
];
|
|
@@ -3310,7 +3304,9 @@ export async function execMenuUpdate(cmd, value, channel, channelId, userId, ove
|
|
|
3310
3304
|
let session = loadedContext.session;
|
|
3311
3305
|
const evolagent = loadedContext.evolagent;
|
|
3312
3306
|
if (transportReplyContext?.threadId) {
|
|
3313
|
-
|
|
3307
|
+
const modelAgentScope = (cmdBase === '/model' || cmdBase === '/effort')
|
|
3308
|
+
&& (menuStringArg(args, 'scope') ?? 'agent') === 'agent';
|
|
3309
|
+
if (modelAgentScope) {
|
|
3314
3310
|
// Model settings belong to the Agent and can be changed from a locally
|
|
3315
3311
|
// created topic before its first message has registered a Core session.
|
|
3316
3312
|
try {
|
|
@@ -3728,7 +3724,7 @@ export async function execMenuUpdate(cmd, value, channel, channelId, userId, ove
|
|
|
3728
3724
|
return { error: roleDecision.message || '当前角色不允许修改对话模式', code: roleDecision.code || 'ROLE_VALUE_NOT_ALLOWED' };
|
|
3729
3725
|
}
|
|
3730
3726
|
try {
|
|
3731
|
-
|
|
3727
|
+
writeChatmodeConfig(target, arg, subject);
|
|
3732
3728
|
}
|
|
3733
3729
|
catch (e) {
|
|
3734
3730
|
return { error: e?.message || String(e), code: e?.code || 'CONFIG_WRITE_FAILED', ...(e?.data !== undefined ? { data: e.data } : {}) };
|
|
@@ -4186,6 +4182,9 @@ export async function execMenuAction(cmd, action, args, channel, channelId, user
|
|
|
4186
4182
|
return { error: 'Trigger details use menu.query with args.view="detail"', code: 'NOT_SUPPORTED' };
|
|
4187
4183
|
}
|
|
4188
4184
|
if (action === 'create' || action === 'set') {
|
|
4185
|
+
if (args && 'baseagent' in args) {
|
|
4186
|
+
return { error: 'Trigger 不支持覆盖 baseagent;使用所属 Agent 当前基座', code: 'INVALID_ARGS' };
|
|
4187
|
+
}
|
|
4189
4188
|
// args 结构化 → 直接组装 ParsedTriggerSet(绕过 parseTriggerSet 文本解析,无注入风险)
|
|
4190
4189
|
if (!args?.scheduleType || (args.scheduleType !== 'once' && !args?.scheduleValue) || !args?.prompt) {
|
|
4191
4190
|
return { error: '缺少必填参数:scheduleType / scheduleValue / prompt', code: 'INVALID_ARGS' };
|
|
@@ -4225,7 +4224,6 @@ export async function execMenuAction(cmd, action, args, channel, channelId, user
|
|
|
4225
4224
|
effort: args.effort,
|
|
4226
4225
|
permissionMode: args.permissionMode,
|
|
4227
4226
|
triggerThread,
|
|
4228
|
-
baseagent: args.baseagent,
|
|
4229
4227
|
};
|
|
4230
4228
|
const r = await this.registerTriggerFromParsed(parsed, channel, channelId, userId ?? '', undefined, this.resolveMenuChatType(channel, channelId, explicitChatType), undefined, isAdmin, subject.isDaemonOwner, subject.canApprovePersistentFullAccess);
|
|
4231
4229
|
if (!r.ok) {
|
|
@@ -4671,6 +4669,8 @@ export async function execMenuAction(cmd, action, args, channel, channelId, user
|
|
|
4671
4669
|
}
|
|
4672
4670
|
catch (err) {
|
|
4673
4671
|
logger.debug('[MenuHandler] Thread rename sync failed:', err);
|
|
4672
|
+
if (err?.code === 'RENAME_FAILED')
|
|
4673
|
+
return { error: '重命名失败', code: 'EXEC_FAILED' };
|
|
4674
4674
|
}
|
|
4675
4675
|
}
|
|
4676
4676
|
if (!renamedByThreadService) {
|
|
@@ -241,8 +241,10 @@ export function isAunMenuTokenRequired() {
|
|
|
241
241
|
}
|
|
242
242
|
export function evolMenuResponseTransportMetadata(sdkVersion, volatileCapability) {
|
|
243
243
|
return {
|
|
244
|
-
//
|
|
245
|
-
|
|
244
|
+
// Menu/control responses are consumed through the SDK classified-control
|
|
245
|
+
// path, which requires an authenticated E2EE envelope to recover the
|
|
246
|
+
// sender from AAD. Do not inherit a plaintext/default transport choice.
|
|
247
|
+
encrypted: true,
|
|
246
248
|
protectedHeaders: {
|
|
247
249
|
ec_version: readInstalledEvolcoreVersion(),
|
|
248
250
|
...(typeof sdkVersion === 'string' && sdkVersion.trim() ? { sdk_version: sdkVersion.trim() } : {}),
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createProvider, parseProviderImport, readProvidersSnapshot, updateProvider } from '../../config/providers-management.js';
|
|
2
2
|
import { parseProviderObject, providerFailure } from '../../config/provider-ipc-service.js';
|
|
3
|
+
import { resolveProviderId } from '../../config/providers-config.js';
|
|
3
4
|
import { validateProviderMenuRequest } from '../../config/provider-menu-request.js';
|
|
4
5
|
import { authorizeFreshOperation } from '../auth/auth-gateway.js';
|
|
5
6
|
export async function executeProviderMenu(request, subject, source) {
|
|
@@ -28,8 +29,9 @@ export async function executeProviderMenu(request, subject, source) {
|
|
|
28
29
|
const snapshot = readProvidersSnapshot();
|
|
29
30
|
if (operation === 'list')
|
|
30
31
|
return { data: snapshot };
|
|
31
|
-
const
|
|
32
|
-
|
|
32
|
+
const providerId = resolveProviderId(args.providerId, snapshot);
|
|
33
|
+
const provider = snapshot.providers[providerId];
|
|
34
|
+
return provider ? { data: { providerId, provider, revision: snapshot.revision } }
|
|
33
35
|
: { error: 'Provider not found', code: 'NOT_FOUND' };
|
|
34
36
|
}
|
|
35
37
|
if (operation === 'create' || operation === 'import') {
|
|
@@ -5,7 +5,7 @@ import { ConfigTarget, read, resolveEffectiveWithSources, write } from '../../co
|
|
|
5
5
|
import { getBuiltinRolesConfig, getRoleDefinition, isValidUserRoleName, readRolesConfig, } from '../../config/roles.js';
|
|
6
6
|
import { BUILTIN_USER_ROLES, MANAGEMENT_ROLES, expectedRoleRank, isManagementRole } from '../../config/builtin-roles.js';
|
|
7
7
|
import { checkRoleAccess, isStaticAgentOwner, resolvePeerRoleDetail } from '../../config/peer-role-resolver.js';
|
|
8
|
-
import {
|
|
8
|
+
import { prepareSameOwnerProof } from '../relation/same-owner-proof.js';
|
|
9
9
|
import { relationFieldWriteOperation, resolveRoleFieldPermission, } from '../../config/config-field-policy.js';
|
|
10
10
|
import { evaluateRoleOperationCapability } from '../auth/operation-authorizer.js';
|
|
11
11
|
import { listOperations } from '../auth/operation-catalog.js';
|
|
@@ -824,7 +824,7 @@ async function targetSnapshot(context, args, policyRevision) {
|
|
|
824
824
|
? normalized
|
|
825
825
|
: await validateTargetExists(context, normalized, { allowAuthenticatedPrivateActor: true });
|
|
826
826
|
if (target.kind === 'private')
|
|
827
|
-
await
|
|
827
|
+
await prepareSameOwnerProof(self, target.peerAid);
|
|
828
828
|
const relation = readRelation(target.peerKey, self);
|
|
829
829
|
const roleView = targetRoleView(self, target, relation?.config ?? null);
|
|
830
830
|
const override = target.kind === 'private'
|
|
@@ -24,7 +24,8 @@ import { getDaemonOwners, ownerResolver, refreshOwnershipForAuthorization, OWNER
|
|
|
24
24
|
import { authorizationNextStep, formatAuthorizationDenial } from '../auth/authorization-denial.js';
|
|
25
25
|
import { resolvePermissionMode, writeAgentModelConfig } from '../model/config-scope.js';
|
|
26
26
|
import { formatPeerKey } from '../relation/peer-identity.js';
|
|
27
|
-
import {
|
|
27
|
+
import { writeChatmodeConfig } from './chatmode-config.js';
|
|
28
|
+
import { prepareSameOwnerProof } from '../relation/same-owner-proof.js';
|
|
28
29
|
import { auditFullAccessEvent } from '../auth/authorization-audit.js';
|
|
29
30
|
import { isMainSession, isTopicSession, isTopicThreadId, sessionTopicThreadId } from '../thread/topic-id.js';
|
|
30
31
|
import { modelMatches, getCatalog, assertCatalogSelectable, resolveCatalogModel, CONFIGURABLE_EFFORTS, configurableEfforts } from '../model/model-catalog.js';
|
|
@@ -40,7 +41,7 @@ import { launchMonitorAndConfirm, resolveMonitorLaunch, cleanupMonitorStage, isP
|
|
|
40
41
|
import { scanInstances } from '../../utils/instance-registry.js';
|
|
41
42
|
import { guardIdleCommand, guardGroupSlashCommand, guardKnownCommand, guardRoleCommand, guardThreadCommand, isRecognizedSlashCommand, normalizeSlashContent, parseFullAccessCommand, probeSessionActivity, } from './slash-gate.js';
|
|
42
43
|
import { MAX_AUN_ATTACHMENT_SIZE } from '../../aun/msg/upload.js';
|
|
43
|
-
import { DEFAULT_SESSION_LOOP_SECONDS, MAX_SESSION_LOOP_SECONDS, MIN_SESSION_LOOP_SECONDS, refreshSessionLoopTarget, resolveCurrentSessionLoopTarget, resolveSessionLoopTarget, sessionLoopPayload, validateIdleSeconds, writeSessionLoopConfig, } from '../session/session-idle-monitor.js';
|
|
44
|
+
import { DEFAULT_SESSION_LOOP_SECONDS, MAX_SESSION_LOOP_PROMPT_LENGTH, MAX_SESSION_LOOP_SECONDS, MIN_SESSION_LOOP_SECONDS, refreshSessionLoopTarget, resolveCurrentSessionLoopTarget, resolveSessionLoopTarget, sessionLoopPayload, validateIdleSeconds, writeSessionLoopConfig, } from '../session/session-idle-monitor.js';
|
|
44
45
|
const allEfforts = CONFIGURABLE_EFFORTS;
|
|
45
46
|
const PERMISSION_MODE_KEYS = PUBLIC_PERMISSION_MODES;
|
|
46
47
|
function formatSessionPolicyStatus(name, scope, enabled, updated = false) {
|
|
@@ -100,16 +101,6 @@ function readSlashChatmode(target) {
|
|
|
100
101
|
return defaultSlashChatmode(target.field);
|
|
101
102
|
}
|
|
102
103
|
}
|
|
103
|
-
function writeSlashChatmode(target, value) {
|
|
104
|
-
const route = routeFieldPath(target.fieldPath, 'relation');
|
|
105
|
-
const cur = cfgRead(route.target, target.sel) || {};
|
|
106
|
-
const block = cur.chatmode && typeof cur.chatmode === 'object' && !Array.isArray(cur.chatmode)
|
|
107
|
-
? { ...cur.chatmode }
|
|
108
|
-
: {};
|
|
109
|
-
block[target.field] = value;
|
|
110
|
-
cur.chatmode = block;
|
|
111
|
-
cfgWrite(route.target, cur, target.sel);
|
|
112
|
-
}
|
|
113
104
|
function resolveSlashMentionModeTarget(params) {
|
|
114
105
|
const self = params.selfAID
|
|
115
106
|
?? params.session?.selfAID
|
|
@@ -433,7 +424,7 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
|
|
|
433
424
|
includeDaemon: /^\/(?:restart|upgrade|update|reload|pair|fa|fullaccess|diag)(?:\s|$)/i.test(normalizedContent),
|
|
434
425
|
});
|
|
435
426
|
if (this.resolveChannelType(channel) === 'aun' && narrowedChatType === 'private') {
|
|
436
|
-
await
|
|
427
|
+
await prepareSameOwnerProof(selfAID ?? this.agentRegistry?.resolveByChannel(channel)?.aid ?? this.resolveSelfAID(channel), userId);
|
|
437
428
|
}
|
|
438
429
|
const identityConversationId = narrowedChatType === 'group' ? channelId : userId;
|
|
439
430
|
const resolvedIdentity = overrideIdentity ?? this.sessionManager.resolveIdentity(channel, userId, narrowedChatType, identityConversationId);
|
|
@@ -589,12 +580,21 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
|
|
|
589
580
|
const isCmd = isRecognizedSlashCommand(normalizedContent);
|
|
590
581
|
if (!isCmd)
|
|
591
582
|
return undefined;
|
|
592
|
-
if (
|
|
583
|
+
if (/^\/loop(?:\s|$)/.test(normalizedContent)) {
|
|
593
584
|
const rawArgs = normalizedContent.slice('/loop'.length).trim();
|
|
594
585
|
const parts = rawArgs ? rawArgs.split(/\s+/) : [];
|
|
595
|
-
|
|
586
|
+
const controlCommand = rawArgs === '' || rawArgs === 'on' || rawArgs === 'off'
|
|
587
|
+
|| /^(?:on|off)\s/.test(rawArgs);
|
|
588
|
+
if (controlCommand && (parts.length > 2 || (parts.length > 0 && !['on', 'off'].includes(parts[0])))) {
|
|
596
589
|
return { kind: 'command.error', text: `❌ 用法: /loop | /loop on [${MIN_SESSION_LOOP_SECONDS}-${MAX_SESSION_LOOP_SECONDS}] | /loop off` };
|
|
597
590
|
}
|
|
591
|
+
const oncePrompt = controlCommand ? undefined : rawArgs;
|
|
592
|
+
if (oncePrompt && source === 'card-trigger') {
|
|
593
|
+
return { kind: 'command.error', text: '❌ /loop <提示词> 只能由用户直接发送' };
|
|
594
|
+
}
|
|
595
|
+
if (oncePrompt && oncePrompt.length > MAX_SESSION_LOOP_PROMPT_LENGTH) {
|
|
596
|
+
return { kind: 'command.error', text: `❌ /loop 提示词不能超过 ${MAX_SESSION_LOOP_PROMPT_LENGTH} 个字符` };
|
|
597
|
+
}
|
|
598
598
|
const route = {
|
|
599
599
|
channel,
|
|
600
600
|
channelId,
|
|
@@ -612,7 +612,7 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
|
|
|
612
612
|
const message = error instanceof Error ? error.message : String(error);
|
|
613
613
|
return { kind: 'command.error', text: `❌ ${message}${code ? ` (${code})` : ''}` };
|
|
614
614
|
}
|
|
615
|
-
const operation = parts.length === 0 ? 'session.loop.current' : 'session.loop.update';
|
|
615
|
+
const operation = !oncePrompt && parts.length === 0 ? 'session.loop.current' : 'session.loop.update';
|
|
616
616
|
const denied = await authorizeIntent({
|
|
617
617
|
intent: { operation, scope: 'relation', source: 'slash', args: { sessionId: target.session.id, peer: target.peerKey, value: parts[0] } },
|
|
618
618
|
identity,
|
|
@@ -630,10 +630,12 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
|
|
|
630
630
|
try {
|
|
631
631
|
const current = await refreshSessionLoopTarget(this.sessionManager, route, target);
|
|
632
632
|
const payload = sessionLoopPayload(current);
|
|
633
|
+
const once = payload.once;
|
|
633
634
|
return {
|
|
634
635
|
kind: 'system.notice',
|
|
635
636
|
text: formatSessionPolicyStatus('idle 触发', current.level, payload.value === true)
|
|
636
|
-
+ (payload.value ? `(${payload.idleSeconds} 秒)` : '')
|
|
637
|
+
+ (payload.value ? `(${payload.idleSeconds} 秒)` : '')
|
|
638
|
+
+ (once ? `;单次:待执行(${once.idleSeconds} 秒);提示词:${once.promptPreview}` : ';单次:无'),
|
|
637
639
|
subtype: 'session.loop.current',
|
|
638
640
|
};
|
|
639
641
|
}
|
|
@@ -647,6 +649,9 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
|
|
|
647
649
|
return { kind: 'command.error', text: '❌ /loop off 不接受秒数' };
|
|
648
650
|
next = { enabled: false };
|
|
649
651
|
}
|
|
652
|
+
else if (oncePrompt) {
|
|
653
|
+
next = { enabled: true, idleSeconds: DEFAULT_SESSION_LOOP_SECONDS };
|
|
654
|
+
}
|
|
650
655
|
else {
|
|
651
656
|
const seconds = parts.length === 2
|
|
652
657
|
? /^[1-9]\d*$/.test(parts[1]) ? validateIdleSeconds(Number(parts[1])) : undefined
|
|
@@ -657,16 +662,33 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
|
|
|
657
662
|
}
|
|
658
663
|
try {
|
|
659
664
|
const latest = await refreshSessionLoopTarget(this.sessionManager, route, target);
|
|
665
|
+
if (oncePrompt) {
|
|
666
|
+
this.assertSessionLoopTrigger(latest.session, true);
|
|
667
|
+
this.sessionManager.updateSessionLoopOnce(latest.session.id, {
|
|
668
|
+
idleSeconds: DEFAULT_SESSION_LOOP_SECONDS,
|
|
669
|
+
prompt: oncePrompt,
|
|
670
|
+
}, { peerId: authSubject.principalId ?? userId,
|
|
671
|
+
encrypted: replyContext?.metadata?.encrypted ?? this.sessionManager.getSessionEncrypt(latest.session.id) });
|
|
672
|
+
if (this.shouldSuppressCardTriggerResult(source, channel))
|
|
673
|
+
return null;
|
|
674
|
+
return {
|
|
675
|
+
kind: 'system.notice',
|
|
676
|
+
text: `✅ 单次 idle 触发(${latest.level})已安排;闲置时长:${DEFAULT_SESSION_LOOP_SECONDS} 秒;提示词:${oncePrompt.replace(/\s+/g, ' ').slice(0, 120)}`,
|
|
677
|
+
subtype: 'session.loop.once.updated',
|
|
678
|
+
};
|
|
679
|
+
}
|
|
660
680
|
if (next.enabled)
|
|
661
681
|
this.assertSessionLoopTrigger(latest.session);
|
|
662
682
|
const updated = writeSessionLoopConfig(this.sessionManager, latest, next);
|
|
683
|
+
if (!next.enabled)
|
|
684
|
+
this.sessionManager.consumeSessionLoopOnce(updated.session.id);
|
|
663
685
|
const payload = sessionLoopPayload(updated);
|
|
664
686
|
if (this.shouldSuppressCardTriggerResult(source, channel))
|
|
665
687
|
return null;
|
|
666
688
|
return {
|
|
667
689
|
kind: 'system.notice',
|
|
668
690
|
text: formatSessionPolicyStatus('idle 触发', updated.level, payload.value === true, true)
|
|
669
|
-
+ (payload.value ? `(${payload.idleSeconds} 秒)` : ''),
|
|
691
|
+
+ (payload.value ? `(${payload.idleSeconds} 秒)` : ';已取消待执行的单次触发'),
|
|
670
692
|
subtype: 'session.loop.updated',
|
|
671
693
|
};
|
|
672
694
|
}
|
|
@@ -874,7 +896,7 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
|
|
|
874
896
|
' /baseagent - 查看 Agent 后端',
|
|
875
897
|
' /perm - 查看权限模式',
|
|
876
898
|
' /mention - 查看群聊 @ 处理模式',
|
|
877
|
-
...(canReadLoop ? [` /loop${canUpdateLoop ? ' [on [seconds]|off]' : ''} - 查看${canUpdateLoop ? '或设置' : ''}当前会话的单次闲置触发`] : []),
|
|
899
|
+
...(canReadLoop ? [` /loop${canUpdateLoop ? ' [on [seconds]|off|<提示词>]' : ''} - 查看${canUpdateLoop ? '或设置' : ''}当前会话的单次闲置触发`] : []),
|
|
878
900
|
' /ask <选项> - 回答待处理问题',
|
|
879
901
|
' /pause - 在下一次工具调用前暂停任务',
|
|
880
902
|
' /resume - 继续已暂停的任务',
|
|
@@ -921,7 +943,7 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
|
|
|
921
943
|
'',
|
|
922
944
|
'💬 聊天设置:',
|
|
923
945
|
...(canReadChatmode || canSetChatmode ? [` /chatmode${canSetChatmode ? ` [${chatmodeChoices}]` : ''} - 查看${canSetChatmode ? '或切换' : ''}会话模式`] : []),
|
|
924
|
-
...(canReadLoop ? [` /loop${canUpdateLoop ? ' [on [seconds]|off]' : ''} - 查看${canUpdateLoop ? '或设置' : ''}当前会话的单次闲置触发`] : []),
|
|
946
|
+
...(canReadLoop ? [` /loop${canUpdateLoop ? ' [on [seconds]|off|<提示词>]' : ''} - 查看${canUpdateLoop ? '或设置' : ''}当前会话的单次闲置触发`] : []),
|
|
925
947
|
...(canReadMentionmode || canSetMentionmode ? [` /mention${canSetMentionmode ? ' [mention-only|disabled]' : ''} - 查看${canSetMentionmode ? '或切换' : ''}群聊 @ 处理模式`] : []),
|
|
926
948
|
] : []),
|
|
927
949
|
...(canReadPermission || canAnswerPermission ? [
|
|
@@ -966,7 +988,7 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
|
|
|
966
988
|
'💬 聊天设置:',
|
|
967
989
|
` /chatmode${canSetChatmode ? ` [${chatmodeChoices}]` : ''} - 查看${canSetChatmode ? '或切换' : ''}会话模式`,
|
|
968
990
|
] : []),
|
|
969
|
-
...(canReadLoop ? ['', ` /loop${canUpdateLoop ? ' [on [seconds]|off]' : ''} - 查看${canUpdateLoop ? '或设置' : ''}当前会话的单次闲置触发`] : []),
|
|
991
|
+
...(canReadLoop ? ['', ` /loop${canUpdateLoop ? ' [on [seconds]|off|<提示词>]' : ''} - 查看${canUpdateLoop ? '或设置' : ''}当前会话的单次闲置触发`] : []),
|
|
970
992
|
...(canReadPermission || canAnswerPermission ? [
|
|
971
993
|
'',
|
|
972
994
|
'🔐 权限管理:',
|
|
@@ -1014,7 +1036,7 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
|
|
|
1014
1036
|
' /activity [all|text|none] - 查看/控制中间输出显示模式',
|
|
1015
1037
|
...(canReadChatmode || canSetChatmode ? [` /chatmode${canSetChatmode ? ` [${chatmodeChoices}]` : ''} - 查看${canSetChatmode ? '/切换' : ''}会话模式(被动响应或主动推进)`] : []),
|
|
1016
1038
|
...(canReadMentionmode || canSetMentionmode ? [` /mention${canSetMentionmode ? ' [mention-only|disabled]' : ''} - 查看${canSetMentionmode ? '/切换' : ''}群聊 @ 处理模式`] : []),
|
|
1017
|
-
...(canReadLoop ? [` /loop${canUpdateLoop ? ' [on [seconds]|off]' : ''} - 查看${canUpdateLoop ? '或设置' : ''}当前会话的单次闲置触发`] : []),
|
|
1039
|
+
...(canReadLoop ? [` /loop${canUpdateLoop ? ' [on [seconds]|off|<提示词>]' : ''} - 查看${canUpdateLoop ? '或设置' : ''}当前会话的单次闲置触发`] : []),
|
|
1018
1040
|
'',
|
|
1019
1041
|
'🧠 上下文:',
|
|
1020
1042
|
' /memory - 记忆概览与维护',
|
|
@@ -1097,8 +1119,8 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
|
|
|
1097
1119
|
const canUpdateLoop = canAccessSlashOperation('session.loop.update', 'relation');
|
|
1098
1120
|
const loopHelp = canReadLoop || canUpdateLoop ? [{
|
|
1099
1121
|
command: '/loop',
|
|
1100
|
-
...(canUpdateLoop ? { args: '[on [seconds]|off]' } : {}),
|
|
1101
|
-
description: '
|
|
1122
|
+
...(canUpdateLoop ? { args: '[on [seconds]|off|<提示词>]' } : {}),
|
|
1123
|
+
description: '查看或设置闲置触发;自定义提示词闲置 300 秒后单次执行',
|
|
1102
1124
|
category: '聊天设置',
|
|
1103
1125
|
roles: [identity.role],
|
|
1104
1126
|
}] : [];
|
|
@@ -2120,10 +2142,6 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
|
|
|
2120
2142
|
// 带参(写操作)需 admin+;无参查询对所有人开放(owner 门在具体切换点还有一道)
|
|
2121
2143
|
if (activityArg && !isAdmin)
|
|
2122
2144
|
return { kind: 'command.error', text: '❌ 无权限:此命令仅限管理员使用' };
|
|
2123
|
-
// proactive 模式下流式输出全部静默,activity 配置无意义
|
|
2124
|
-
if (getEffectiveChatmode(activitySession) === 'proactive') {
|
|
2125
|
-
return { kind: 'command.error', text: '❌ 当前会话为 proactive 模式,不支持 activity 配置(流式输出已全部静默)' };
|
|
2126
|
-
}
|
|
2127
2145
|
const modeMap = {
|
|
2128
2146
|
all: 'all',
|
|
2129
2147
|
text: 'text',
|
|
@@ -2133,7 +2151,7 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
|
|
|
2133
2151
|
// 模式描述列表(用于 body 和文本降级)。
|
|
2134
2152
|
// all = 文本 + activity;text = 仅文字进展;none = 全部静默。
|
|
2135
2153
|
const modeDescriptions = [
|
|
2136
|
-
{ key: 'all', configVal: 'all', label: '
|
|
2154
|
+
{ key: 'all', configVal: 'all', label: '全部显示' },
|
|
2137
2155
|
{ key: 'text', configVal: 'text', label: '仅文字进展' },
|
|
2138
2156
|
{ key: 'none', configVal: 'none', label: '全部静默' },
|
|
2139
2157
|
];
|
|
@@ -2322,7 +2340,7 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
|
|
|
2322
2340
|
if (chatmodeAuthDenied)
|
|
2323
2341
|
return chatmodeAuthDenied;
|
|
2324
2342
|
try {
|
|
2325
|
-
|
|
2343
|
+
writeChatmodeConfig({ ...target, scope: 'relation' }, arg, authSubject);
|
|
2326
2344
|
}
|
|
2327
2345
|
catch (e) {
|
|
2328
2346
|
return { kind: 'command.error', text: `Failed to update relation chatmode: ${e?.message || e}` };
|
|
@@ -2822,16 +2840,7 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
|
|
|
2822
2840
|
const projectPath = this.getEffectiveDefaultPath(channel);
|
|
2823
2841
|
if (sendMessage && session) {
|
|
2824
2842
|
const creatingText = `⏳ 正在创建新会话${sessionName ? `: ${sessionName}` : ''}...`;
|
|
2825
|
-
|
|
2826
|
-
// 这里希望它像 /compact 等命令的占位提示一样,按普通消息发送。
|
|
2827
|
-
const creatingPayload = activeChatType === 'private'
|
|
2828
|
-
? { kind: 'command.result', text: creatingText }
|
|
2829
|
-
: {
|
|
2830
|
-
kind: 'system.notice',
|
|
2831
|
-
text: creatingText,
|
|
2832
|
-
subtype: 'session.creating',
|
|
2833
|
-
};
|
|
2834
|
-
await sendMessage(channelId, creatingText, this.getReplyContext(session), creatingPayload);
|
|
2843
|
+
await sendMessage(channelId, creatingText, this.getReplyContext(session), { kind: 'system.notice', text: creatingText, subtype: 'session.creating' });
|
|
2835
2844
|
}
|
|
2836
2845
|
const newSessionBaseagent = this.agentRegistry?.resolveByChannel(channel)?.baseagent || this.parseDefaultBaseagent();
|
|
2837
2846
|
const previousMetadata = session?.metadata || activeSession?.metadata || {};
|
|
@@ -4058,7 +4067,9 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
|
|
|
4058
4067
|
}
|
|
4059
4068
|
return { kind: 'command.error', text: '❌ 当前话题会话不存在或归属已变化' };
|
|
4060
4069
|
}
|
|
4061
|
-
return
|
|
4070
|
+
return outcome.value.startsWith('❌')
|
|
4071
|
+
? { kind: 'command.result', text: outcome.value }
|
|
4072
|
+
: { kind: 'system.notice', text: outcome.value, subtype: 'session.rewound' };
|
|
4062
4073
|
}
|
|
4063
4074
|
const rewindBaseagent = session.baseagent;
|
|
4064
4075
|
if (!rewindBaseagent) {
|
|
@@ -4072,7 +4083,10 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
|
|
|
4072
4083
|
return { kind: 'command.error', text: `❌ 当前 Agent (${rewindAgent.name}) 不支持 /rewind` };
|
|
4073
4084
|
}
|
|
4074
4085
|
await interruptPausedSessionBeforeReplacement(session);
|
|
4075
|
-
|
|
4086
|
+
const rewindResult = await this.handleRewind(session, rewindAgent, turnNum, mode);
|
|
4087
|
+
return rewindResult.startsWith('❌')
|
|
4088
|
+
? { kind: 'command.result', text: rewindResult }
|
|
4089
|
+
: { kind: 'system.notice', text: rewindResult, subtype: 'session.rewound' };
|
|
4076
4090
|
}
|
|
4077
4091
|
// /repair 命令:检查并修复会话文件
|
|
4078
4092
|
if (normalizedContent === '/repair') {
|