evolcore 0.0.50 → 0.0.51
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 +39 -2
- package/bin/ec-build.mjs +60 -0
- package/bin/ecmsg.js +65 -63
- package/dist/ability/caller/command.js +24 -15
- package/dist/ability/caller/contract.js +24 -9
- package/dist/ability/caller/credential-files.js +132 -0
- package/dist/ability/caller/daemon.js +32 -7
- package/dist/ability/caller/schema-view.js +157 -0
- package/dist/ability/caller/service.js +202 -63
- package/dist/ability/interop-v1.js +156 -113
- package/dist/agent-template/jobs.js +14 -110
- package/dist/agent-template/runtime.js +331 -193
- package/dist/agent-template/service.js +1029 -1104
- package/dist/agent-template/share.js +103 -0
- package/dist/agent-template/tool-runner.js +25 -0
- package/dist/agent-template/types.js +10 -3
- package/dist/agents/claude/availability.js +94 -0
- package/dist/agents/claude/capability-provider.js +154 -0
- package/dist/agents/claude/index.js +145 -0
- package/dist/agents/{claude-runner.js → claude/runner.js} +74 -158
- package/dist/agents/claude/session-file-adapter.js +246 -0
- package/dist/agents/codex/app-server-client.js +90 -10
- package/dist/agents/codex/availability.js +164 -0
- package/dist/agents/codex/capability-provider.js +138 -0
- package/dist/agents/codex/cli.js +38 -0
- package/dist/agents/codex/index.js +345 -0
- package/dist/agents/codex/mcp-elicitation.js +135 -0
- package/dist/agents/{codex-runner.js → codex/runner.js} +648 -382
- package/dist/agents/codex/session-file-adapter.js +834 -0
- package/dist/agents/dsh/availability.js +28 -0
- package/dist/agents/dsh/capability-provider.js +56 -0
- package/dist/agents/dsh/desktop-locations.ps1 +66 -0
- package/dist/agents/dsh/desktop-probe.cjs +37 -0
- package/dist/agents/dsh/index.js +98 -0
- package/dist/agents/dsh/installation.js +400 -0
- package/dist/agents/dsh/resources.js +755 -0
- package/dist/agents/dsh/runner.js +1183 -0
- package/dist/agents/dsh/runtime/README.md +243 -0
- package/dist/agents/dsh/runtime/authorization.js +23 -0
- package/dist/agents/dsh/runtime/bridge.js +837 -0
- package/dist/agents/dsh/runtime/config.js +271 -0
- package/dist/agents/dsh/runtime/entry.js +229 -0
- package/dist/agents/dsh/runtime/session-inspector.js +340 -0
- package/dist/agents/dsh/runtime/tool-policy.js +49 -0
- package/dist/agents/dsh/session-file-adapter.js +145 -0
- package/dist/agents/ecagent/index.js +215 -0
- package/dist/agents/{ecagent-runner.js → ecagent/runner.js} +592 -106
- package/dist/agents/ecagent/session-file-adapter.js +134 -0
- package/dist/agents/gemini/index.js +55 -10
- package/dist/agents/gemini/{gemini-runner.js → runner.js} +4 -9
- package/dist/aun/ability-device-routing.js +11 -17
- package/dist/aun/aid/agentmd.js +27 -1
- package/dist/aun/aid/managed-operation.js +6 -4
- package/dist/aun/group/invite-service.js +1 -1
- package/dist/aun/menu/client.js +1 -1
- package/dist/aun/msg/history.js +1 -1
- package/dist/aun/msg/managed-operation.js +93 -21
- package/dist/aun/msg/p2p.js +6 -6
- package/dist/aun/service-proxy.js +1 -1
- package/dist/aun/storage/index.js +242 -0
- package/dist/build-identity.json +1 -1
- package/dist/channels/aun.js +180 -43
- package/dist/channels/daemon.js +3 -2
- package/dist/channels/dingtalk.js +1 -1
- package/dist/channels/feishu.js +9 -9
- package/dist/channels/qqbot.js +1 -1
- package/dist/channels/wechat.js +2 -2
- package/dist/channels/wecom.js +1 -1
- package/dist/{agents/claude-gateway → claude-gateway}/agent-registration.js +13 -13
- package/dist/{agents/claude-gateway → claude-gateway}/binding.js +3 -3
- package/dist/{agents/claude-gateway → claude-gateway}/inbox.js +1 -1
- package/dist/{agents/claude-gateway → claude-gateway}/index.js +2 -2
- package/dist/{agents/claude-gateway → claude-gateway}/listing.js +3 -3
- package/dist/{agents/claude-gateway → claude-gateway}/router.js +4 -4
- package/dist/{agents/claude-gateway → claude-gateway}/sessions.js +2 -2
- package/dist/{agents/claude-gateway → claude-gateway}/terminal.js +1 -1
- package/dist/{agents/claude-gateway → claude-gateway}/transcript.js +1 -1
- package/dist/cli/ability-command.js +8 -5
- package/dist/cli/ability-output.js +182 -0
- package/dist/cli/agent-command.js +1 -1
- package/dist/cli/agent-create.js +123 -42
- package/dist/cli/agent-template.js +400 -29
- package/dist/cli/agent.js +14 -11
- package/dist/cli/aun-commands.js +167 -111
- package/dist/cli/daemon-commands.js +38 -8
- package/dist/cli/data-command.js +1 -1
- package/dist/cli/debug-mode.js +9 -0
- package/dist/cli/directory.js +1 -2
- package/dist/cli/ecmsg-gateway.js +55 -19
- package/dist/cli/fs-command.js +67 -39
- package/dist/cli/index.js +25 -11
- package/dist/cli/init.js +124 -29
- package/dist/cli/managed-command-guard.js +2 -0
- package/dist/cli/model.js +1 -1
- package/dist/cli/restart-monitor.js +2 -2
- package/dist/cli/services-command.js +24 -1
- package/dist/cli/skill-command.js +4 -4
- package/dist/cli/task-context.js +24 -14
- package/dist/cli/team-workspace-command.js +50 -52
- package/dist/cli/thread-command.js +3 -2
- package/dist/cli/trigger-command.js +47 -12
- package/dist/cli/watch-logs.js +2 -1
- package/dist/config/boot-log.js +3 -0
- package/dist/config/builtin-role-templates.js +1 -1
- package/dist/config/config-field-policy.js +10 -6
- package/dist/config/config-manager.js +33 -12
- package/dist/config/gateway-config.js +21 -37
- package/dist/config/invoke-ipc-service.js +1 -1
- package/dist/config/owner-config.js +5 -3
- package/dist/config/peer-book-store.js +2 -3
- package/dist/config/peer-book.js +2 -2
- package/dist/config/peer-role-resolver.js +2 -2
- package/dist/config/provider-identity-migration.js +24 -105
- package/dist/config/provider-ipc-service.js +13 -3
- package/dist/config/provider-local-sync.js +4 -1
- package/dist/config/provider-menu-request.js +21 -3
- package/dist/config/provider-templates.js +1 -1
- package/dist/config/providers-config.js +39 -15
- package/dist/config/providers-import.js +3 -3
- package/dist/config/providers-management.js +74 -99
- package/dist/config/schema-migration.js +177 -11
- package/dist/config/schema-registry.js +1 -1
- package/dist/config-store.js +38 -50
- package/dist/core/{agent-application-service.js → agent/agent-application-service.js} +9 -9
- package/dist/core/{agent-create-status.js → agent/agent-create-status.js} +112 -4
- package/dist/core/{agent-creation-claim.js → agent/agent-creation-claim.js} +3 -3
- package/dist/core/{agent-ipc-registration.js → agent/agent-ipc-registration.js} +102 -25
- package/dist/core/{agent-reload-coordinator.js → agent/agent-reload-coordinator.js} +61 -1
- package/dist/core/{agent-runtime.js → agent/agent-runtime.js} +53 -27
- package/dist/core/{evolagent-registry.js → agent/evolagent-registry.js} +12 -12
- package/dist/core/{evolagent.js → agent/evolagent.js} +11 -11
- package/dist/core/auth/agent-delegation.js +1 -8
- package/dist/core/auth/delegation-authorization.js +28 -0
- package/dist/core/auth/operation-authorizer.js +7 -4
- package/dist/core/auth/operation-catalog.js +34 -5
- package/dist/core/baseagent/baseagent-availability.js +197 -0
- package/dist/core/baseagent/baseagent-capability-adapter.js +288 -0
- package/dist/core/baseagent/baseagent-config-shared.js +56 -0
- package/dist/core/baseagent/baseagent-identity.js +68 -0
- package/dist/core/{baseagent-loader.js → baseagent/baseagent-loader.js} +62 -6
- package/dist/core/baseagent/baseagent-model-defaults.js +26 -0
- package/dist/{agents → core/baseagent}/baseagent-plugin-descriptor.js +107 -24
- package/dist/core/baseagent/baseagent-plugin-loader.js +367 -0
- package/dist/core/baseagent/baseagent.js +157 -0
- package/dist/{agents → core/baseagent}/runner-types.js +36 -4
- package/dist/core/capability/capability-manager.js +79 -30
- package/dist/core/capability/providers/claude-capability-provider.js +2 -154
- package/dist/core/capability/providers/codex-capability-provider.js +2 -136
- package/dist/core/{channel-loader.js → channel/channel-loader.js} +226 -38
- package/dist/core/{channel-runtime.js → channel/channel-runtime.js} +18 -18
- package/dist/core/command/agent-control.js +60 -15
- package/dist/core/command/agent-template-menu.js +21 -9
- package/dist/core/command/agentmd-menu-request.js +19 -8
- package/dist/core/command/agentmd-menu.js +14 -5
- package/dist/core/command/command-handler.js +127 -57
- package/dist/core/command/context-policy-menu.js +122 -0
- package/dist/core/command/data-root-resolver.js +157 -20
- package/dist/core/command/memory-slash.js +6 -6
- package/dist/core/command/menu-catalog.js +80 -20
- package/dist/core/command/menu-handler.js +305 -25
- package/dist/core/command/menu-protocol.js +42 -8
- package/dist/core/command/menu-query-batch.js +9 -5
- package/dist/core/command/provider-menu.js +7 -11
- package/dist/core/command/role-menu.js +1 -1
- package/dist/core/command/skill-slash.js +17 -5
- package/dist/core/command/slash-gate.js +2 -4
- package/dist/core/command/slash-handler.js +127 -96
- package/dist/core/command/team-workspace-team.js +3 -3
- package/dist/core/command/topic-slash.js +10 -10
- package/dist/core/{daemon-bootstrap.js → daemon/daemon-bootstrap.js} +14 -14
- package/dist/core/{daemon-control.js → daemon/daemon-control.js} +46 -20
- package/dist/core/{daemon-lifecycle.js → daemon/daemon-lifecycle.js} +15 -15
- package/dist/core/{host-snapshot.js → daemon/host-snapshot.js} +3 -3
- package/dist/core/{ipc-registration.js → daemon/ipc-registration.js} +98 -38
- package/dist/core/{lifecycle-notice.js → daemon/lifecycle-notice.js} +4 -5
- package/dist/core/file-integrity/store.js +1 -1
- package/dist/core/handoff/ipc-registration.js +3 -3
- package/dist/core/handoff/runtime.js +1 -1
- package/dist/{agents → core/inference}/request-identity.js +2 -2
- package/dist/core/inference/text-inference.js +4 -4
- package/dist/core/{bootstrap-messages.js → initialization/bootstrap-messages.js} +10 -10
- package/dist/core/{bootstrap-service.js → initialization/bootstrap-service.js} +24 -23
- package/dist/core/initialization/service.js +54 -9
- package/dist/core/invoke/executors/media.js +1 -1
- package/dist/core/invoke/executors/text.js +1 -1
- package/dist/core/memory/consolidation-context.js +1 -1
- package/dist/core/memory/consolidation-trigger.js +9 -3
- package/dist/core/memory/consolidation.js +4 -4
- package/dist/core/memory/memory-admin.js +6 -6
- package/dist/core/memory/memory-writer.js +1 -1
- package/dist/core/memory/relation-idle-monitor.js +1 -1
- package/dist/core/message/aun-ipc-sender.js +114 -75
- package/dist/core/message/aun-request-registry.js +13 -5
- package/dist/core/message/auto-mention-gate.js +1 -1
- package/dist/core/message/contact-admission.js +1 -1
- package/dist/core/message/im-renderer.js +19 -0
- package/dist/core/{interaction-router.js → message/interaction-router.js} +4 -4
- package/dist/core/message/items-formatter.js +5 -5
- package/dist/core/message/message-admission.js +1 -1
- package/dist/core/message/message-bridge.js +135 -54
- package/dist/core/message/message-queue.js +83 -4
- package/dist/core/message/message-utils.js +1 -1
- package/dist/core/message/peer-mode.js +1 -1
- package/dist/core/message/response-engine.js +347 -163
- package/dist/core/message/send-options.js +9 -6
- package/dist/core/message/send-routing.js +45 -109
- package/dist/core/message/stream-idle-monitor.js +1 -1
- package/dist/core/{data-migration.js → migration/data-migration.js} +29 -1
- package/dist/core/model/catalog-service.js +29 -8
- package/dist/core/model/model-capabilities.js +88 -0
- package/dist/core/model/model-catalog.js +14 -3
- package/dist/core/model/model-diagnostics.js +4 -4
- package/dist/core/ownership/owner-resolver.js +95 -15
- package/dist/core/{pack-auth.js → pack/pack-auth.js} +30 -3
- package/dist/core/{pack-install.js → pack/pack-install.js} +95 -17
- package/dist/core/permission/approval-gateway.js +9 -18
- package/dist/core/permission/ec-command-parser.js +70 -34
- package/dist/core/permission/managed-file.js +234 -0
- package/dist/core/permission/protected-paths.js +56 -0
- package/dist/core/permission/sandbox-runtime.js +267 -3
- package/dist/core/permission/session-path-grants.js +1 -1
- package/dist/core/permission/shell-environment.js +15 -1
- package/dist/core/plugin/plugin-lifecycle.js +442 -0
- package/dist/core/session/adapters/claude-session-file-adapter.js +2 -246
- package/dist/core/session/adapters/codex-session-file-adapter.js +2 -566
- package/dist/core/session/adapters/ecagent-session-file-adapter.js +2 -134
- package/dist/core/{background-session → session/background}/session-cleanup.js +2 -2
- package/dist/core/{background-session → session/background}/types.js +1 -1
- package/dist/core/session/session-file-health.js +2 -272
- package/dist/core/session/session-idle-monitor.js +1 -1
- package/dist/core/session/session-manager.js +29 -2
- package/dist/core/session/session-terminal.js +185 -0
- package/dist/core/session/session-title.js +8 -11
- package/dist/core/{system-session → session/system}/memory.js +43 -9
- package/dist/core/{system-session → session/system}/registry.js +1 -1
- package/dist/core/{system-session → session/system}/types.js +1 -1
- package/dist/core/skill/index-generator.js +1 -0
- package/dist/core/task/task-activity-store.js +112 -0
- package/dist/core/task/task-recovery-service.js +2 -2
- package/dist/core/thread/ipc-operation.js +2 -2
- package/dist/core/thread/thread-operation.js +2 -1
- package/dist/core/thread/thread-route.js +5 -3
- package/dist/core/thread/thread-service.js +14 -4
- package/dist/directory/{owner-directory-admission.js → admission.js} +3 -3
- package/dist/directory/{owner-directory-cache.js → cache.js} +90 -8
- package/dist/directory/{owner-directory-markdown.js → markdown.js} +2 -2
- package/dist/directory/{owner-directory-query-operation.js → query-operation.js} +83 -9
- package/dist/directory/{owner-directory-search.js → search.js} +50 -2
- package/dist/directory/{owner-directory-store.js → store.js} +2 -2
- package/dist/eck/kit-renderer.js +1 -1
- package/dist/eck/manifest-engine.js +64 -2
- package/dist/eck/message-renderer.js +35 -0
- package/dist/ecweb/basic-settings-service.js +9 -3
- package/dist/{contracts → ecweb/contracts}/ecweb-service-protocol.js +2 -1
- package/dist/ecweb/dsh-native-service.js +413 -0
- package/dist/ecweb/providers-service.js +1 -1
- package/dist/ecweb/runtime/lifecycle.js +1 -1
- package/dist/ecweb/runtime/supervisor.js +1 -1
- package/dist/event-center/center-config.js +2 -2
- package/dist/event-center/dispatcher.js +1 -1
- package/dist/event-center/ipc-operation.js +12 -3
- package/dist/event-center/pack-loader.js +2 -2
- package/dist/event-center/registry.js +6 -6
- package/dist/event-center/runtime.js +2 -2
- package/dist/index.js +71 -42
- package/dist/ipc.js +103 -10
- package/dist/outputs/authorization.js +27 -0
- package/dist/outputs/events.js +10 -1
- package/dist/outputs/panel-cards.js +960 -0
- package/dist/paths.js +12 -0
- package/dist/pay/command.js +1 -1
- package/dist/pay/runtime.js +18 -10
- package/dist/response-system/engines/v1/proactive-flow.js +1 -1
- package/dist/services/dispatcher.js +2 -2
- package/dist/services/host/main.js +10 -1
- package/dist/services/host/protocol.js +9 -2
- package/dist/services/host/resident.js +37 -0
- package/dist/services/host-client.js +12 -0
- package/dist/services/host-recycle.js +8 -3
- package/dist/services/host-runtime.js +54 -15
- package/dist/services/index.js +83 -19
- package/dist/services/ipc-operation.js +303 -38
- package/dist/services/pack-manager.js +2 -2
- package/dist/services/router.js +43 -3
- package/dist/services/script-runner.js +34 -25
- package/dist/services/service-payload.js +28 -1
- package/dist/services/validation.js +28 -2
- package/dist/stats/context-usage.js +110 -0
- package/dist/stats/model-resolver.js +103 -17
- package/dist/stats/query.js +5 -0
- package/dist/trigger/application-service.js +3 -2
- package/dist/trigger/authorization.js +36 -33
- package/dist/trigger/ipc-service.js +4 -4
- package/dist/trigger/local-files.js +8 -176
- package/dist/trigger/manager.js +2 -2
- package/dist/trigger/parser.js +48 -0
- package/dist/trigger/scheduler.js +14 -2
- package/dist/trigger/script-executor.js +21 -0
- package/dist/trigger/script-sandbox.js +57 -243
- package/dist/trigger/system-definitions.js +25 -0
- package/dist/trigger/validation.js +1 -1
- package/dist/utils/atomic-write.js +88 -1
- package/dist/utils/cross-platform.js +4 -42
- package/dist/utils/error-dict.json +22 -1
- package/dist/utils/error-utils.js +193 -6
- package/dist/utils/evolcore-version.js +2 -2
- package/dist/utils/host-info.js +1 -1
- package/dist/utils/logger.js +3 -1
- package/dist/utils/media-cache.js +99 -4
- package/dist/utils/startup-trace.js +20 -4
- package/dist/utils/welcome.js +64 -20
- package/ecagent/README.md +35 -0
- package/ecagent/dist/agent-loop.js +80 -30
- package/ecagent/dist/harness/env/nodejs.d.ts +16 -0
- package/ecagent/dist/harness/env/nodejs.js +49 -20
- package/ecagent/dist/harness/messages.js +3 -2
- package/ecagent/dist/harness/types.d.ts +1 -0
- package/ecagent/dist/runtime/types.d.ts +2 -0
- package/ecagent/dist/runtime/utils/validation.d.ts +7 -1
- package/ecagent/dist/runtime/utils/validation.js +42 -0
- package/ecagent/dist/types.d.ts +2 -0
- package/kits/docs/INDEX.md +1 -1
- package/kits/docs/channels/feishu.md +1 -1
- package/kits/docs/evolcore/INDEX.md +10 -7
- package/kits/docs/evolcore/agent-create.md +2 -0
- package/kits/docs/evolcore/agent.md +100 -13
- package/kits/docs/evolcore/aid.md +19 -3
- package/kits/docs/evolcore/config.md +94 -0
- package/kits/docs/evolcore/ctl.md +2 -1
- package/kits/docs/evolcore/ec-capabilities.md +7 -10
- package/kits/docs/evolcore/ecweb-lifecycle.md +5 -1
- package/kits/docs/evolcore/event.md +1 -1
- package/kits/docs/evolcore/fs.md +49 -3
- package/kits/docs/evolcore/group.md +3 -3
- package/kits/docs/evolcore/memory-consolidation.md +1 -1
- package/kits/docs/evolcore/menu-protocol.md +24 -2
- package/kits/docs/evolcore/model.md +9 -1
- package/kits/docs/evolcore/msg.md +30 -28
- package/kits/docs/evolcore/pay.md +8 -20
- package/kits/docs/evolcore/plugin.md +74 -0
- package/kits/docs/evolcore/provider.md +8 -2
- package/kits/docs/evolcore/rpc.md +2 -2
- package/kits/docs/evolcore/skill.md +17 -1
- package/kits/docs/evolcore/stats.md +5 -0
- package/kits/docs/evolcore/storage.md +22 -0
- package/kits/docs/evolcore/thread-chain.md +19 -10
- package/kits/docs/evolcore/tool-authorization.md +4 -0
- package/kits/docs/evolcore/trigger.md +89 -13
- package/kits/docs/identity/AID_PROFILE_SPEC.md +1 -1
- package/kits/docs/venues/feishu-group.md +3 -2
- package/kits/docs/venues/feishu-private.md +3 -2
- package/kits/rules/02-navigation.md +20 -13
- package/kits/rules/06-channel.md +18 -2
- package/kits/schemas/_meta.json +8 -4
- package/kits/schemas/agent-config.schema.23.json +19 -3
- package/kits/schemas/agent-config.schema.24.json +986 -0
- package/kits/schemas/agent-config.schema.25.json +986 -0
- package/kits/schemas/daemon.schema.11.json +487 -0
- package/kits/schemas/daemon.schema.12.json +505 -0
- package/kits/schemas/defaults.schema.8.json +484 -0
- package/kits/schemas/providers.schema.1.json +1 -1
- package/kits/schemas/providers.schema.2.json +1 -1
- package/kits/schemas/providers.schema.3.json +8 -2
- package/kits/skills/.switches.json +4 -0
- package/kits/skills/ability/SKILL.md +194 -27
- package/kits/skills/ability/STRUCTURE.md +5 -0
- package/kits/skills/agent-output-cards/SKILL.md +90 -54
- package/kits/skills/agent-output-cards/examples/html-surface.json +11 -0
- package/kits/skills/agent-output-cards/examples/meeting-followups.json +16 -0
- package/kits/skills/agent-output-cards/examples/meeting-latest.json +24 -0
- package/kits/skills/agent-output-cards/examples/project-metrics.json +16 -0
- package/kits/skills/agent-output-cards/examples/quick-links.json +18 -0
- package/kits/skills/agent-output-cards/examples/surface.html +8 -0
- package/kits/skills/agent-template-project/SKILL.md +51 -0
- package/kits/skills/agent-template-project/references/01-collect-and-pack.md +174 -0
- package/kits/skills/agent-template-project/references/02-upload-and-share.md +109 -0
- package/kits/skills/agent-template-project/references/03-download-and-install.md +189 -0
- package/kits/skills/agent-template-project/references/04-upgrade-and-recovery.md +74 -0
- package/kits/skills/agent-template-project/references/05-publish-to-platform.md +62 -0
- package/kits/skills/ec-group/SKILL.md +3 -3
- package/kits/skills/ec-group-collaboration/SKILL.md +4 -4
- package/kits/skills/ec-identity/SKILL.md +9 -6
- package/kits/skills/ec-pay/SKILL.md +163 -41
- package/kits/skills/ec-provider/SKILL.md +5 -5
- package/kits/skills/ec-service-call/SKILL.md +3 -0
- package/kits/skills/ec-skill/SKILL.md +25 -9
- package/kits/skills/ec-skill/scripts/cli.mjs +7 -7
- package/kits/skills/ec-skill/scripts/skill.mjs +55 -41
- package/kits/skills/ec-skill/scripts/template/SKILL.md.tmpl +9 -0
- package/kits/skills/ec-trigger/SKILL.md +2 -2
- package/kits/skills/personal-assistant/SKILL.md +22 -22
- package/kits/skills/personal-assistant/references/03-data-flow-and-gaps.md +1 -1
- package/kits/skills/scrapling-article-fetch/SKILL.md +5 -5
- package/kits/skills/thread-ops/SKILL.md +19 -9
- package/kits/skills/wechat-article-media-download/SKILL.md +2 -2
- package/kits/skills/wechat-article-reader/SKILL.md +2 -2
- package/kits/templates/system-fragments/commands.md +1 -1
- package/kits/templates/system-fragments/personal-assistant.md +2 -2
- package/kits/templates/system-fragments/reply.md +14 -9
- package/kits/templates/system-fragments/session.md +1 -1
- package/kits/templates/system-fragments/thread.md +10 -5
- package/package.json +6 -5
- package/scripts/agent-template/index.mjs +7 -1
- package/scripts/agent-template/inspect.mjs +81 -35
- package/scripts/agent-template/overlay.mjs +110 -4
- package/scripts/agent-template/shared/common.mjs +36 -4
- package/scripts/agent-template/shared/plan.mjs +4 -2
- package/scripts/agent-template/shared/service-packs.mjs +104 -0
- package/scripts/agent-template/shared/team-schema.json +467 -54
- package/scripts/agent-template/shared/template-contract.mjs +70 -68
- package/scripts/agent-template/shared/template-package.mjs +153 -36
- package/scripts/agent-template/shared/template-runtime.mjs +76 -64
- package/scripts/agent-template/shared/template.mjs +11 -46
- package/scripts/agent-template/team-pack.mjs +451 -35
- package/scripts/agent-template/team-preview.mjs +75 -226
- package/scripts/aid-batch/identity-batch.mjs +1 -1
- package/dist/agents/baseagent-availability.js +0 -176
- package/dist/agents/baseagent-capability-adapter.js +0 -102
- package/dist/agents/baseagent-plugin-loader.js +0 -145
- package/dist/agents/baseagent.js +0 -816
- package/dist/agents/codex/catalog.js +0 -80
- package/dist/agents/ecagent-plugin-lazy.js +0 -41
- package/dist/agents/tool-time-context.js +0 -55
- package/dist/core/legacy-rename.js +0 -41
- package/dist/core/plugin-lifecycle.js +0 -137
- package/dist/core/rate-window.js +0 -53
- package/dist/core/runner-reload-transaction.js +0 -60
- package/dist/core/runtime-lock.js +0 -90
- package/dist/core/soul.js +0 -66
- package/dist/core/system-session/grants.js +0 -40
- package/dist/directory/owner-directory-agentmd-sync.js +0 -89
- package/dist/directory/owner-directory-request-operation.js +0 -79
- package/dist/directory/owner-directory-text.js +0 -60
- package/kits/skills/ec-pay/references/pay-cli.md +0 -110
- /package/dist/agents/gemini/{gemini-capability-provider.js → capability-provider.js} +0 -0
- /package/dist/agents/gemini/{gemini-session-file-adapter.js → session-file-adapter.js} +0 -0
- /package/dist/{agents/claude-gateway → claude-gateway}/types.js +0 -0
- /package/dist/core/{system-channels.js → channel/system-channels.js} +0 -0
- /package/dist/core/{daemon-file-cache.js → daemon/daemon-file-cache.js} +0 -0
- /package/dist/core/{event-bus.js → event/event-bus.js} +0 -0
- /package/dist/core/{event-catalog.js → event/event-catalog.js} +0 -0
- /package/dist/core/{pack-ledger.js → pack/pack-ledger.js} +0 -0
- /package/dist/directory/{owner-directory-identity.js → identity.js} +0 -0
- /package/dist/directory/{owner-directory-policy.js → policy.js} +0 -0
- /package/dist/directory/{owner-directory-remarks.js → remarks.js} +0 -0
- /package/dist/directory/{owner-directory-scope.js → scope.js} +0 -0
- /package/dist/{contracts → ecweb/contracts}/ecweb-instance.js +0 -0
- /package/kits/templates/{bootstrap-welcome.md → bootstrap-intro.md} +0 -0
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { getAgentTemplateService } from '../../agent-template/service.js';
|
|
2
|
-
import { TEMPLATE_ACTIONS, templateError } from '../../agent-template/types.js';
|
|
2
|
+
import { TEMPLATE_ACTIONS, templateError, templateOwnerRequiredError } from '../../agent-template/types.js';
|
|
3
3
|
import { authorizeFreshOperation } from '../auth/auth-gateway.js';
|
|
4
4
|
import { getProviderCatalog } from '../model/model-catalog.js';
|
|
5
|
+
import { isSupportedBaseagent } from '../baseagent/baseagent.js';
|
|
6
|
+
import { isProviderId } from '../../config/providers-config.js';
|
|
5
7
|
const templateContract = await import(new URL('../../../scripts/agent-template/shared/template-contract.mjs', import.meta.url).href);
|
|
6
8
|
export function isTemplateRequest(request) {
|
|
7
9
|
return request.name === 'template' || request.cmd === '/template';
|
|
@@ -13,10 +15,10 @@ export function templateMenuAction(request) {
|
|
|
13
15
|
const args = { ...request.args };
|
|
14
16
|
let action = request.action;
|
|
15
17
|
if (request.type === 'menu.query') {
|
|
16
|
-
action = args.view === 'job' ? 'status' : ['capabilities', '
|
|
18
|
+
action = args.view === 'job' ? 'status' : ['capabilities', 'update-status'].includes(args.view) ? args.view : undefined;
|
|
17
19
|
delete args.view;
|
|
18
20
|
}
|
|
19
|
-
else if (request.type !== 'menu.action' || ['status', 'capabilities', '
|
|
21
|
+
else if (request.type !== 'menu.action' || ['status', 'capabilities', 'update-status'].includes(action)) {
|
|
20
22
|
throw templateError('INVALID_ARGUMENT', 'Use the defined template Menu action or query');
|
|
21
23
|
}
|
|
22
24
|
if (!TEMPLATE_ACTIONS.includes(action))
|
|
@@ -42,8 +44,10 @@ export function validateTemplateRequest(request) {
|
|
|
42
44
|
export async function executeTemplateMenu(request, subject, source) {
|
|
43
45
|
try {
|
|
44
46
|
const { action, args } = templateMenuAction(request);
|
|
45
|
-
if (!subject?.
|
|
46
|
-
|
|
47
|
+
if (!subject?.isDaemonOwner || !subject.principalId || subject.processRole === 'daemon-service') {
|
|
48
|
+
throw templateOwnerRequiredError(action);
|
|
49
|
+
}
|
|
50
|
+
if (!subject.fromControlChannel || !subject.ecwebManagement && subject.menuEncrypted !== true) {
|
|
47
51
|
throw templateError('NOT_ALLOWED', 'Template operations require an encrypted DaemonOwner Control request');
|
|
48
52
|
}
|
|
49
53
|
if (Object.values(args.members ?? {}).some((member) => member.source?.kind === 'directory')
|
|
@@ -51,9 +55,17 @@ export async function executeTemplateMenu(request, subject, source) {
|
|
|
51
55
|
throw templateError('INVALID_ARGUMENT', 'Remote template calls cannot read host paths');
|
|
52
56
|
const decision = await authorizeFreshOperation({ source, subject,
|
|
53
57
|
intent: { operation: 'agent.template.' + action, scope: 'process', source, args } });
|
|
54
|
-
if (!decision.allow)
|
|
55
|
-
|
|
56
|
-
|
|
58
|
+
if (!decision.allow) {
|
|
59
|
+
if (decision.command?.reasonCode === 'DAEMON_OWNER_REQUIRED')
|
|
60
|
+
throw templateOwnerRequiredError(action);
|
|
61
|
+
throw templateError('NOT_ALLOWED', decision.reason);
|
|
62
|
+
}
|
|
63
|
+
const data = await getAgentTemplateService().action(subject.principalId, request.id, action, args, { remote: true });
|
|
64
|
+
if (data.result?.workspace) {
|
|
65
|
+
const { workspace: _workspace, ...result } = data.result;
|
|
66
|
+
return { data: { ...data, result } };
|
|
67
|
+
}
|
|
68
|
+
return { data };
|
|
57
69
|
}
|
|
58
70
|
catch (error) {
|
|
59
71
|
return { error: error.message, code: error.code ?? 'TEMPLATE_FAILED',
|
|
@@ -65,7 +77,7 @@ export async function executeProviderModelCatalog(request, subject, source) {
|
|
|
65
77
|
const args = request.args;
|
|
66
78
|
if (request.type !== 'menu.query' || request.agent !== undefined || !args
|
|
67
79
|
|| Object.keys(args).some(k => !['scope', 'view', 'providerId', 'baseagent', 'serviceType', 'refresh'].includes(k))
|
|
68
|
-
||
|
|
80
|
+
|| !isProviderId(args.providerId) || !isSupportedBaseagent(args.baseagent)
|
|
69
81
|
|| args.refresh !== undefined && typeof args.refresh !== 'boolean'
|
|
70
82
|
|| args.serviceType !== undefined && typeof args.serviceType !== 'string')
|
|
71
83
|
throw templateError('INVALID_ARGUMENT', 'Invalid process model catalog query');
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
+
import { AGENTMD_VISIBILITY_ERROR, isAgentMdVisibility } from '../../aun/aid/agentmd.js';
|
|
2
|
+
export function isAgentMdWriteAction(action) {
|
|
3
|
+
return action === 'agentmd.publish' || action === 'agentmd.setVisibility';
|
|
4
|
+
}
|
|
1
5
|
/** Includes value batches containing the AgentMD entry, for replay and E2EE guards. */
|
|
2
6
|
export function containsAgentMdMenuRequest(request) {
|
|
3
7
|
const args = request.args;
|
|
4
8
|
const command = typeof request.cmd === 'string' ? request.cmd.trim().split(/\s+/)[0] : '';
|
|
5
9
|
if (request.name === 'aid' || command === '/aid') {
|
|
6
10
|
return (request.type === 'menu.query' && args?.view === 'agentmd')
|
|
7
|
-
|| (request.type === 'menu.action' && request.action
|
|
11
|
+
|| (request.type === 'menu.action' && isAgentMdWriteAction(request.action));
|
|
8
12
|
}
|
|
9
13
|
return request.type === 'menu.query' && request.name === 'menu' && args?.view === 'values'
|
|
10
14
|
&& Array.isArray(args.items) && args.items.some(item => item?.entryId === 'aid.agentmd');
|
|
@@ -17,11 +21,12 @@ export function validateAgentMdMenuRequest(request) {
|
|
|
17
21
|
return fail('agentmd requires args');
|
|
18
22
|
const a = args;
|
|
19
23
|
const query = request.type === 'menu.query' && a.view === 'agentmd';
|
|
20
|
-
const publish = request.type === 'menu.action' && request.action
|
|
24
|
+
const publish = request.type === 'menu.action' && isAgentMdWriteAction(request.action);
|
|
25
|
+
const setVisibility = request.action === 'agentmd.setVisibility';
|
|
21
26
|
if (!query && !publish)
|
|
22
27
|
return { code: 'NOT_SUPPORTED', message: 'Unsupported agentmd Menu operation' };
|
|
23
28
|
const allowed = query ? ['aid', 'view', 'protocolVersion', 'scope', 'self']
|
|
24
|
-
: ['aid', 'content', 'expectedEtag', 'expectedRelationVersion', 'protocolVersion', 'scope', 'self'];
|
|
29
|
+
: ['aid', setVisibility ? 'visibility' : 'content', 'expectedEtag', 'expectedRelationVersion', 'protocolVersion', 'scope', 'self'];
|
|
25
30
|
if (Object.keys(a).some(key => !allowed.includes(key)))
|
|
26
31
|
return fail('Unsupported agentmd argument');
|
|
27
32
|
if (a.protocolVersion !== undefined && a.protocolVersion !== 1) {
|
|
@@ -34,11 +39,17 @@ export function validateAgentMdMenuRequest(request) {
|
|
|
34
39
|
if (a.scope !== undefined && a.scope !== 'agent')
|
|
35
40
|
return fail('agentmd requires Agent scope');
|
|
36
41
|
if (publish) {
|
|
37
|
-
if (
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
if (setVisibility) {
|
|
43
|
+
if (!isAgentMdVisibility(a.visibility))
|
|
44
|
+
return fail(AGENTMD_VISIBILITY_ERROR);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
if (typeof a.content !== 'string' || !a.content.trim())
|
|
48
|
+
return fail('content must be non-empty Markdown');
|
|
49
|
+
// Includes a possible SDK tail signature. The payload has a separate 4096-byte limit.
|
|
50
|
+
if (Buffer.byteLength(a.content, 'utf8') > 6144)
|
|
51
|
+
return fail('agent.md document exceeds 6144 bytes');
|
|
52
|
+
}
|
|
42
53
|
if (typeof a.expectedEtag !== 'string' || !a.expectedEtag.trim()
|
|
43
54
|
|| a.expectedEtag.length > 512 || /[\r\n]/.test(a.expectedEtag))
|
|
44
55
|
return fail('expectedEtag is required');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isDeepStrictEqual } from 'node:util';
|
|
2
2
|
import { validateAgentMdDocument } from '@agentunion/fastaun';
|
|
3
|
-
import { agentmdGet, agentmdUpdate, AGENT_MD_MAX_PAYLOAD_BYTES, AGENT_DESCRIPTION_MAX_LENGTH, } from '../../aun/aid/agentmd.js';
|
|
3
|
+
import { agentmdGet, agentmdUpdate, AGENT_MD_MAX_PAYLOAD_BYTES, AGENT_DESCRIPTION_MAX_LENGTH, updateAgentMdFrontmatterFieldValue, isAgentMdVisibility } from '../../aun/aid/agentmd.js';
|
|
4
4
|
import { ownerResolver } from '../ownership/owner-resolver.js';
|
|
5
5
|
import { validateAgentMdMenuRequest } from './agentmd-menu-request.js';
|
|
6
6
|
export const AGENT_MD_PROTECTED_FIELDS = [
|
|
@@ -97,19 +97,20 @@ export class AgentMdMenuService {
|
|
|
97
97
|
return {
|
|
98
98
|
protocol: 'evol.agentmd', protocolVersion: 1, aid,
|
|
99
99
|
content: card.payload, etag: card.etag, relationVersion: c.relation_version,
|
|
100
|
+
visibility: isAgentMdVisibility(card.frontmatter.visibility) ? card.frontmatter.visibility : null,
|
|
100
101
|
verification: 'verified', protectedFields: AGENT_MD_PROTECTED_FIELDS,
|
|
101
102
|
limits: { maxPayloadBytes: AGENT_MD_MAX_PAYLOAD_BYTES, maxDescriptionCharacters: AGENT_DESCRIPTION_MAX_LENGTH },
|
|
102
103
|
atomicVersionCheck: false,
|
|
103
104
|
};
|
|
104
105
|
}
|
|
105
|
-
async publish(subject, args) {
|
|
106
|
-
const invalid = validateAgentMdMenuRequest({ type: 'menu.action', action
|
|
106
|
+
async publish(subject, args, action = 'agentmd.publish') {
|
|
107
|
+
const invalid = validateAgentMdMenuRequest({ type: 'menu.action', action, args });
|
|
107
108
|
if (invalid)
|
|
108
109
|
fail(invalid.code, invalid.message);
|
|
109
110
|
const aid = this.target(subject, args);
|
|
110
111
|
const version = args.expectedRelationVersion;
|
|
111
112
|
await this.authorize(aid, subject, version);
|
|
112
|
-
|
|
113
|
+
let candidate = action === 'agentmd.publish' ? parse(args.content, aid) : undefined;
|
|
113
114
|
let previousFields = {};
|
|
114
115
|
let result;
|
|
115
116
|
try {
|
|
@@ -119,6 +120,13 @@ export class AgentMdMenuService {
|
|
|
119
120
|
if (base.etag !== args.expectedEtag)
|
|
120
121
|
fail('REMOTE_VERSION_CONFLICT', 'AgentMD changed; reload before publishing');
|
|
121
122
|
previousFields = base.frontmatter;
|
|
123
|
+
if (!candidate) {
|
|
124
|
+
const updated = updateAgentMdFrontmatterFieldValue(base.payload, 'visibility', args.visibility);
|
|
125
|
+
candidate = parse(updated.content, aid);
|
|
126
|
+
if (!isDeepStrictEqual(candidate.frontmatter, { ...base.frontmatter, visibility: args.visibility })) {
|
|
127
|
+
fail('INVALID_ARGUMENT', 'Updating visibility would change other AgentMD fields');
|
|
128
|
+
}
|
|
129
|
+
}
|
|
122
130
|
for (const field of AGENT_MD_PROTECTED_FIELDS) {
|
|
123
131
|
if (Object.hasOwn(base.frontmatter, field) !== Object.hasOwn(candidate.frontmatter, field)
|
|
124
132
|
|| !isDeepStrictEqual(base.frontmatter[field], candidate.frontmatter[field])) {
|
|
@@ -141,12 +149,13 @@ export class AgentMdMenuService {
|
|
|
141
149
|
const accepted = this.card(published, aid, consensus);
|
|
142
150
|
const body = (payload) => payload.replace(/\r\n/g, '\n')
|
|
143
151
|
.replace(/^---\n[\s\S]*?\n---(?:\n|$)/, '').trim();
|
|
144
|
-
if (!isDeepStrictEqual(candidate.frontmatter, accepted.frontmatter) || body(candidate.payload) !== body(accepted.payload)) {
|
|
152
|
+
if (!candidate || !isDeepStrictEqual(candidate.frontmatter, accepted.frontmatter) || body(candidate.payload) !== body(accepted.payload)) {
|
|
145
153
|
fail('PUBLISH_NOT_CONFIRMED', 'The remote AgentMD does not confirm this edit; refresh before retrying');
|
|
146
154
|
}
|
|
147
155
|
return {
|
|
148
156
|
protocol: 'evol.agentmd', protocolVersion: 1, aid, published: true,
|
|
149
157
|
content: accepted.payload, etag: accepted.etag, relationVersion: consensus.relation_version,
|
|
158
|
+
visibility: isAgentMdVisibility(accepted.frontmatter.visibility) ? accepted.frontmatter.visibility : null,
|
|
150
159
|
verification: 'verified', versionChecked: result.versionChecked, atomicVersionCheck: false,
|
|
151
160
|
nameChanged: previousFields.name !== accepted.frontmatter.name,
|
|
152
161
|
...(previousFields.avatar !== accepted.frontmatter.avatar ? { avatar: accepted.frontmatter.avatar ?? '' } : {}),
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { BaseagentRunnerUnavailableError } from '
|
|
2
|
-
import { loadedBaseagentIds } from '
|
|
1
|
+
import { BaseagentRunnerUnavailableError } from '../baseagent/runner-types.js';
|
|
2
|
+
import { loadedBaseagentIds } from '../baseagent/baseagent-availability.js';
|
|
3
3
|
import { grantSessionPath, listRuntimePathGrants, revokeSessionPath } from '../permission/session-path-grants.js';
|
|
4
4
|
import { closeDiagnosticSession, diagnosticTokenHash, isDiagnosticSessionActive } from './diag-service.js';
|
|
5
5
|
import { parseMenuClientArgs } from '../../cli/menu-client.js';
|
|
6
6
|
import { ensureSessionRuntimeDirAsync } from '../../cli/task-context.js';
|
|
7
|
-
import { renderCommandCardAsText } from '../interaction-router.js';
|
|
7
|
+
import { renderCommandCardAsText } from '../message/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';
|
|
@@ -12,6 +12,7 @@ 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';
|
|
15
|
+
import { assertDeclaredBaseagentCapability } from '../baseagent/baseagent-capability-adapter.js';
|
|
15
16
|
import { resolveFreshPeerRoleDetail, resolvePeerRoleDetail, roleToSessionIdentity } from '../../config/peer-role-resolver.js';
|
|
16
17
|
import { ThreadService } from '../thread/thread-service.js';
|
|
17
18
|
import { isManagementRole } from '../../config/builtin-roles.js';
|
|
@@ -22,13 +23,13 @@ import path from 'path';
|
|
|
22
23
|
import fs from 'fs';
|
|
23
24
|
import { parseDocument } from 'yaml';
|
|
24
25
|
import { agentmdGet } from '../../aun/aid/agentmd.js';
|
|
25
|
-
import { parseDuration, parseTriggerSet, parseTriggerUpdate } from '../../trigger/parser.js';
|
|
26
|
+
import { normalizeTriggerEnabled, parseDuration, parseTriggerSet, parseTriggerUpdate } from '../../trigger/parser.js';
|
|
26
27
|
// 不要静态导入 trigger/patch.js:它带着一整棵 patch 校验依赖(实测独占约 150ms),
|
|
27
28
|
// 而只有"修改 Trigger 定义"这一条分支会用到。改在分支内按需加载。
|
|
28
29
|
import { definitionRevision } from '../../trigger/validation.js';
|
|
29
30
|
import { isDaemonEventSessionTrigger, matchTriggerEvent } from '../../trigger/event-source.js';
|
|
30
31
|
import { isTriggerOperator } from '../../trigger/authorization.js';
|
|
31
|
-
import { tryParseChannelKey } from '../channel-loader.js';
|
|
32
|
+
import { tryParseChannelKey } from '../channel/channel-loader.js';
|
|
32
33
|
import { displaySessionTitle } from '../session/session-title.js';
|
|
33
34
|
import { buildTranscriptTurns } from '../session/session-transcript.js';
|
|
34
35
|
import { resolveConfigCommand } from '../../config/resolved-config-op.js';
|
|
@@ -38,8 +39,7 @@ import { auditCommandAuthorization, auditFullAccessEvent, hashArgv } from '../au
|
|
|
38
39
|
import { ResponseModeRegistry } from '../../response-system/registry.js';
|
|
39
40
|
import { registerBuiltinModes } from '../../response-system/modes/index.js';
|
|
40
41
|
import { parseQuotaCommand, queryQuota } from '../../stats/quota-query.js';
|
|
41
|
-
import { DirectoryQueryError, executeDirectoryQueryCommand, resolveDirectoryQueryCommand, } from '../../directory/
|
|
42
|
-
import { executeDirectoryRequestCommand, resolveDirectoryRequestCommand, } from '../../directory/owner-directory-request-operation.js';
|
|
42
|
+
import { DirectoryQueryError, executeDirectoryQueryCommand, resolveDirectoryQueryCommand, executeDirectoryRequestCommand, resolveDirectoryRequestCommand } from '../../directory/query-operation.js';
|
|
43
43
|
import { executeResolvedRoleCommand, resolveRoleCommand } from '../../config/role-command-service.js';
|
|
44
44
|
import { applyApprovedRoleAssignment } from './role-menu.js';
|
|
45
45
|
import { hasTrustedFullAccessDelegation, trustedExecutionIdentityInput } from '../auth/agent-delegation.js';
|
|
@@ -785,7 +785,7 @@ export class CommandHandler {
|
|
|
785
785
|
$schema_version: 3.1,
|
|
786
786
|
id,
|
|
787
787
|
agentAid: schedulerAid,
|
|
788
|
-
enabled:
|
|
788
|
+
enabled: normalizeTriggerEnabled(parsed.enabled),
|
|
789
789
|
name,
|
|
790
790
|
...(parsed.description ? { description: parsed.description } : {}),
|
|
791
791
|
createdAt: now,
|
|
@@ -941,7 +941,7 @@ export class CommandHandler {
|
|
|
941
941
|
operatorId: userId,
|
|
942
942
|
...(channelKey ? { channelKey } : {}),
|
|
943
943
|
});
|
|
944
|
-
return { matched: true, result: handled ? '
|
|
944
|
+
return { matched: true, result: handled ? '已回答' : '⚠️ 回答未被接受,请检查选项或问题是否仍有效。' };
|
|
945
945
|
}
|
|
946
946
|
setProcessor(processor) {
|
|
947
947
|
this.processor = processor;
|
|
@@ -1329,9 +1329,9 @@ export class CommandHandler {
|
|
|
1329
1329
|
/**
|
|
1330
1330
|
* 主命令处理入口
|
|
1331
1331
|
*/
|
|
1332
|
-
async handle(content, channel, channelId, sendMessage, userId, threadId, chatType, source, messageId, selfAID, overrideIdentity, authSubject, replyContext, enforceGroupSlashPolicy = false) {
|
|
1332
|
+
async handle(content, channel, channelId, sendMessage, userId, threadId, chatType, source, messageId, selfAID, overrideIdentity, authSubject, replyContext, enforceGroupSlashPolicy = false, submitLoopPrompt) {
|
|
1333
1333
|
try {
|
|
1334
|
-
const result = await this._handleInternal(content, channel, channelId, sendMessage, userId, threadId, chatType, source, messageId, selfAID, overrideIdentity, authSubject, replyContext, enforceGroupSlashPolicy);
|
|
1334
|
+
const result = await this._handleInternal(content, channel, channelId, sendMessage, userId, threadId, chatType, source, messageId, selfAID, overrideIdentity, authSubject, replyContext, enforceGroupSlashPolicy, submitLoopPrompt);
|
|
1335
1335
|
// Lifecycle commands are control-plane operations. Their replies must
|
|
1336
1336
|
// use notification payloads so other agents in a group do not treat the
|
|
1337
1337
|
// text as ordinary model input. Normalize guard-path replies here too,
|
|
@@ -1371,40 +1371,21 @@ export class CommandHandler {
|
|
|
1371
1371
|
}
|
|
1372
1372
|
async _handleInternal(content, channel, channelId, sendMessage, userId, threadId, chatType, source, messageId, selfAID, overrideIdentity, authSubject, replyContext,
|
|
1373
1373
|
// Menu and delegated CLI operations reuse this implementation without the chat-only policy.
|
|
1374
|
-
applyGroupSlashPolicy = false) {
|
|
1375
|
-
return await handleSlashCommand.call(this, content, channel, channelId, sendMessage, userId, threadId, chatType, source, messageId, selfAID, overrideIdentity, authSubject, replyContext, applyGroupSlashPolicy);
|
|
1374
|
+
applyGroupSlashPolicy = false, submitLoopPrompt) {
|
|
1375
|
+
return await handleSlashCommand.call(this, content, channel, channelId, sendMessage, userId, threadId, chatType, source, messageId, selfAID, overrideIdentity, authSubject, replyContext, applyGroupSlashPolicy, submitLoopPrompt);
|
|
1376
1376
|
}
|
|
1377
1377
|
async handleTriggerCommand(scheduler, content, channel, channelId, peerId, isAdmin, messageId, chatType, threadId, isDaemonOwner = false, canApprovePersistentFullAccess = isDaemonOwner) {
|
|
1378
1378
|
// 操作主体身份:群聊是群 AID(channelId),私聊是对端 AID(peerId)。
|
|
1379
1379
|
const actorConversationPeerId = chatType === 'group' ? channelId : peerId;
|
|
1380
1380
|
if (content === '/trigger') {
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
.filter(definition => this.canAccessTriggerDefinition(definition, actorConversationPeerId, isAdmin));
|
|
1384
|
-
if (visible.length === 0)
|
|
1385
|
-
return '📭 当前没有活跃的触发器';
|
|
1386
|
-
const lines = visible.map(definition => {
|
|
1387
|
-
const view = this.definitionToTriggerView(definition, scheduler);
|
|
1388
|
-
const next = view.nextFireAt ? new Date(view.nextFireAt).toLocaleString() : '未计算';
|
|
1389
|
-
return `• **${view.name}** [${view.scheduleType}] 下次: ${next}`;
|
|
1390
|
-
});
|
|
1391
|
-
return `📋 活跃触发器(${visible.length} 个):\n\n${lines.join('\n')}`;
|
|
1381
|
+
// 裸 /trigger 与 /trigger list 同义:默认列出开与关的全部定义。
|
|
1382
|
+
return this.renderTriggerList(scheduler, actorConversationPeerId, isAdmin, { enabledOnly: false });
|
|
1392
1383
|
}
|
|
1393
1384
|
const sub = content.slice('/trigger '.length).trim();
|
|
1394
1385
|
if (sub === 'list' || sub.startsWith('list ')) {
|
|
1395
|
-
|
|
1396
|
-
const
|
|
1397
|
-
|
|
1398
|
-
.filter(definition => this.canAccessTriggerDefinition(definition, actorConversationPeerId, isAdmin));
|
|
1399
|
-
if (visible.length === 0)
|
|
1400
|
-
return '📭 没有触发器记录';
|
|
1401
|
-
const lines = visible.map(definition => {
|
|
1402
|
-
const view = this.definitionToTriggerView(definition, scheduler);
|
|
1403
|
-
const next = view.nextFireAt ? new Date(view.nextFireAt).toLocaleString() : '未计算';
|
|
1404
|
-
const status = definition.enabled ? 'active' : 'disabled';
|
|
1405
|
-
return `• ${view.name} [${view.scheduleType}] ${status} | 下次: ${next}`;
|
|
1406
|
-
});
|
|
1407
|
-
return `📋 触发器(${visible.length} 个):\n\n${lines.join('\n')}`;
|
|
1386
|
+
// 精确匹配参数,避免含 all 的普通词误触发。
|
|
1387
|
+
const enabledOnly = /(?:^|\s)--enabled-only(?:\s|$)/.test(sub);
|
|
1388
|
+
return this.renderTriggerList(scheduler, actorConversationPeerId, isAdmin, { enabledOnly });
|
|
1408
1389
|
}
|
|
1409
1390
|
// Helper: extract nameOrId and find trigger with permission check
|
|
1410
1391
|
const extractAndFindTrigger = (sub, prefix, action) => {
|
|
@@ -1423,7 +1404,7 @@ export class CommandHandler {
|
|
|
1423
1404
|
const { definition } = extractAndFindTrigger(sub, 'cancel ', 'cancel');
|
|
1424
1405
|
const cancelled = scheduler.cancel(definition.id);
|
|
1425
1406
|
this.eventBus.publish({ type: 'trigger:cancelled', triggerId: cancelled.id, name: cancelled.name, by: peerId });
|
|
1426
|
-
return
|
|
1407
|
+
return `触发器已禁用:**${cancelled.name}**`;
|
|
1427
1408
|
}
|
|
1428
1409
|
if (sub.startsWith('delete ') || sub.startsWith('remove ') || sub.startsWith('rm ')) {
|
|
1429
1410
|
const prefix = sub.startsWith('delete ') ? 'delete ' : sub.startsWith('remove ') ? 'remove ' : 'rm ';
|
|
@@ -1435,7 +1416,7 @@ export class CommandHandler {
|
|
|
1435
1416
|
messageId, isDaemonOwner, reason: 'fullaccess Trigger deleted',
|
|
1436
1417
|
});
|
|
1437
1418
|
}
|
|
1438
|
-
return
|
|
1419
|
+
return `触发器已删除:**${deleted.name}**`;
|
|
1439
1420
|
}
|
|
1440
1421
|
if (sub.startsWith('enable ')) {
|
|
1441
1422
|
const { definition } = extractAndFindTrigger(sub, 'enable ', 'enable');
|
|
@@ -1458,12 +1439,12 @@ export class CommandHandler {
|
|
|
1458
1439
|
messageId, isDaemonOwner, reason: 'fullaccess Trigger enabled',
|
|
1459
1440
|
});
|
|
1460
1441
|
}
|
|
1461
|
-
return
|
|
1442
|
+
return `触发器已启用:**${definition.name}**`;
|
|
1462
1443
|
}
|
|
1463
1444
|
if (sub.startsWith('disable ')) {
|
|
1464
1445
|
const { definition } = extractAndFindTrigger(sub, 'disable ', 'disable');
|
|
1465
1446
|
scheduler.setEnabled(definition.id, false);
|
|
1466
|
-
return
|
|
1447
|
+
return `触发器已暂停:**${definition.name}**`;
|
|
1467
1448
|
}
|
|
1468
1449
|
if (sub.startsWith('show ')) {
|
|
1469
1450
|
const { definition } = extractAndFindTrigger(sub, 'show ', 'show');
|
|
@@ -1472,7 +1453,7 @@ export class CommandHandler {
|
|
|
1472
1453
|
const nextStr = view.nextFireAt ? new Date(view.nextFireAt).toLocaleString() : '未计算';
|
|
1473
1454
|
const activeRuns = details.active?.length ?? 0;
|
|
1474
1455
|
const recentRuns = details.recentRuns?.slice(0, 5) ?? [];
|
|
1475
|
-
let output =
|
|
1456
|
+
let output = `**${definition.name}** (${definition.id})\n`;
|
|
1476
1457
|
output += `状态: ${definition.enabled ? 'active' : 'disabled'}\n`;
|
|
1477
1458
|
output += `调度: ${view.scheduleType} | 下次: ${nextStr}\n`;
|
|
1478
1459
|
output += `处理: ${definition.execution.type}\n`;
|
|
@@ -1544,7 +1525,7 @@ export class CommandHandler {
|
|
|
1544
1525
|
if (!updated.ok)
|
|
1545
1526
|
return `❌ ${updated.error}`;
|
|
1546
1527
|
const nextStr = updated.trigger.nextFireAt ? new Date(updated.trigger.nextFireAt).toLocaleString() : '未计算';
|
|
1547
|
-
return
|
|
1528
|
+
return `触发器已更新:**${updated.trigger.name}**\n下次触发:${nextStr}`;
|
|
1548
1529
|
}
|
|
1549
1530
|
const createSubcommand = sub.startsWith('create ')
|
|
1550
1531
|
? 'create'
|
|
@@ -1560,7 +1541,10 @@ export class CommandHandler {
|
|
|
1560
1541
|
if (!reg.ok)
|
|
1561
1542
|
return `❌ ${reg.error}`;
|
|
1562
1543
|
const nextStr = reg.trigger.nextFireAt ? new Date(reg.trigger.nextFireAt).toLocaleString() : '未计算';
|
|
1563
|
-
|
|
1544
|
+
const enabledNote = reg.trigger.enabled
|
|
1545
|
+
? '状态:已启用'
|
|
1546
|
+
: `状态:已关闭(未启用,不会到点触发)\n启用:/trigger enable ${reg.trigger.id}`;
|
|
1547
|
+
return `触发器已注册:**${reg.trigger.name}**\n${enabledNote}\n下次触发:${nextStr}`;
|
|
1564
1548
|
}
|
|
1565
1549
|
return `❌ 未知子命令。用法:
|
|
1566
1550
|
/trigger — 查看活跃触发器
|
|
@@ -1581,6 +1565,24 @@ export class CommandHandler {
|
|
|
1581
1565
|
return '⚠️ 触发器功能未启用';
|
|
1582
1566
|
return await this.handleTriggerCommand(scheduler, content, channel, channelId, peerId, isAdmin, messageId, chatType, threadId, isDaemonOwner, canApprovePersistentFullAccess);
|
|
1583
1567
|
}
|
|
1568
|
+
renderTriggerList(scheduler, actorConversationPeerId, isAdmin, opts) {
|
|
1569
|
+
const visible = scheduler
|
|
1570
|
+
.list({ enabledOnly: opts.enabledOnly })
|
|
1571
|
+
.filter(definition => this.canAccessTriggerDefinition(definition, actorConversationPeerId, isAdmin));
|
|
1572
|
+
if (visible.length === 0) {
|
|
1573
|
+
return opts.enabledOnly ? '📭 没有已启用的触发器' : '📭 没有触发器记录';
|
|
1574
|
+
}
|
|
1575
|
+
const lines = visible.map(definition => {
|
|
1576
|
+
const view = this.definitionToTriggerView(definition, scheduler);
|
|
1577
|
+
const next = view.nextFireAt ? new Date(view.nextFireAt).toLocaleString() : '未计算';
|
|
1578
|
+
const status = definition.enabled ? 'active' : 'disabled';
|
|
1579
|
+
return `• ${view.name} [${view.scheduleType}] ${status} | 下次: ${next}`;
|
|
1580
|
+
});
|
|
1581
|
+
const footer = visible.some(d => !d.enabled)
|
|
1582
|
+
? '\n\n提示:disabled 不会到点触发;/trigger enable <名称|ID> 启用,用完即弃的用 /trigger delete 清理。'
|
|
1583
|
+
: '';
|
|
1584
|
+
return `触发器(${visible.length} 个):\n\n${lines.join('\n')}${footer}`;
|
|
1585
|
+
}
|
|
1584
1586
|
async updateTriggerFromPatch(scheduler, nameOrId, patch, channel, channelId, peerId, isAdmin, messageId, threadId, isDaemonOwner = false, canApprovePersistentFullAccess = isDaemonOwner, chatType) {
|
|
1585
1587
|
const actorConversationPeerId = chatType === 'group' ? channelId : peerId;
|
|
1586
1588
|
const definition = this.findTriggerDefinition(scheduler, nameOrId, actorConversationPeerId, isAdmin);
|
|
@@ -1744,15 +1746,15 @@ export class CommandHandler {
|
|
|
1744
1746
|
const messages = await agent.getSessionMessages(session.agentSessionId, session.projectPath);
|
|
1745
1747
|
const turns = buildTranscriptTurns(messages);
|
|
1746
1748
|
if (turns.length === 0) {
|
|
1747
|
-
return '
|
|
1749
|
+
return '当前会话暂无对话记录';
|
|
1748
1750
|
}
|
|
1749
1751
|
const lines = turns.map(t => `#${t.index} ${t.userContent}`);
|
|
1750
1752
|
return [
|
|
1751
|
-
|
|
1753
|
+
`会话历史 (共 ${turns.length} 轮)`,
|
|
1752
1754
|
'',
|
|
1753
1755
|
...lines,
|
|
1754
1756
|
'',
|
|
1755
|
-
'
|
|
1757
|
+
'/rewind <N> chat|file|all — 撤销第N轮',
|
|
1756
1758
|
].join('\n');
|
|
1757
1759
|
}
|
|
1758
1760
|
catch (error) {
|
|
@@ -1762,6 +1764,11 @@ export class CommandHandler {
|
|
|
1762
1764
|
}
|
|
1763
1765
|
async handleRewind(session, agent, turnNum, mode) {
|
|
1764
1766
|
try {
|
|
1767
|
+
// Check both operations before either can change files or native history.
|
|
1768
|
+
if (mode === 'file' || mode === 'all')
|
|
1769
|
+
assertDeclaredBaseagentCapability(session.baseagent, 'X03');
|
|
1770
|
+
if (mode === 'chat' || mode === 'all')
|
|
1771
|
+
assertDeclaredBaseagentCapability(session.baseagent, 'X04');
|
|
1765
1772
|
if (sessionTopicThreadId(session) && turnNum === 1) {
|
|
1766
1773
|
return '❌ 话题会话暂不支持 /rewind 1,仅开放 N>1';
|
|
1767
1774
|
}
|
|
@@ -1791,10 +1798,10 @@ export class CommandHandler {
|
|
|
1791
1798
|
? `(恢复了 ${fileResult.filesChanged.length} 个文件)`
|
|
1792
1799
|
: '';
|
|
1793
1800
|
if (agent.capabilities?.fileRewind === 'git-head') {
|
|
1794
|
-
results.push(
|
|
1801
|
+
results.push(`已按 Git HEAD 恢复文件${detail}(Codex 当前不提供逐轮文件快照)`);
|
|
1795
1802
|
}
|
|
1796
1803
|
else {
|
|
1797
|
-
results.push(
|
|
1804
|
+
results.push(`已恢复文件到第 ${turnNum} 轮之前的状态${detail}`);
|
|
1798
1805
|
}
|
|
1799
1806
|
}
|
|
1800
1807
|
}
|
|
@@ -1843,7 +1850,7 @@ export class CommandHandler {
|
|
|
1843
1850
|
agentSessionId: null,
|
|
1844
1851
|
});
|
|
1845
1852
|
}
|
|
1846
|
-
results.push(
|
|
1853
|
+
results.push(`已撤销第 ${turnNum} 轮${discarded > 1 ? `及后续共 ${discarded} 轮` : ''}`, keepTarget ? `下次发言将从第 ${turnNum - 1} 轮继续` : '下次发言将开始全新对话');
|
|
1847
1854
|
}
|
|
1848
1855
|
this.eventBus.publish({
|
|
1849
1856
|
type: 'session:rewind',
|
|
@@ -2934,7 +2941,8 @@ export class CommandHandler {
|
|
|
2934
2941
|
: actorAid;
|
|
2935
2942
|
const relationTarget = currentGroup
|
|
2936
2943
|
?? (grant.channelType === 'aun' && grant.chatType === 'private' ? relationId : undefined);
|
|
2937
|
-
const managedTempPath = parsed.command.kind === 'upload'
|
|
2944
|
+
const managedTempPath = parsed.command.kind === 'upload' || parsed.command.kind === 'download'
|
|
2945
|
+
? await this.getManagedSessionTempDir(session) : undefined;
|
|
2938
2946
|
const subject = buildAuthSubject({
|
|
2939
2947
|
selfAid: grant.selfAid,
|
|
2940
2948
|
actorId: grant.actorId,
|
|
@@ -2963,6 +2971,7 @@ export class CommandHandler {
|
|
|
2963
2971
|
...(parsed.command.aclGrantee ? { aclGrantee: parsed.command.aclGrantee } : {}),
|
|
2964
2972
|
...(parsed.command.aclPerms ? { aclPerms: parsed.command.aclPerms } : {}),
|
|
2965
2973
|
...(parsed.command.aclRemove !== undefined ? { aclRemove: parsed.command.aclRemove } : {}),
|
|
2974
|
+
...(parsed.command.acl ? { acl: parsed.command.acl } : {}),
|
|
2966
2975
|
};
|
|
2967
2976
|
const decision = await authorizeFreshOperation({
|
|
2968
2977
|
source: 'agent-tool',
|
|
@@ -3024,6 +3033,67 @@ export class CommandHandler {
|
|
|
3024
3033
|
return { ok: false, code: 'INVALID_LOCAL_FILE', error: error instanceof Error ? error.message : String(error) };
|
|
3025
3034
|
}
|
|
3026
3035
|
}
|
|
3036
|
+
if (parsed.command.kind === 'download') {
|
|
3037
|
+
const localPath = parsed.command.localPath;
|
|
3038
|
+
if (!localPath || /[\u0000-\u001f\u007f]/.test(localPath)) {
|
|
3039
|
+
return { ok: false, code: 'INVALID_LOCAL_PATH', error: 'Managed download destination is required and cannot contain control characters' };
|
|
3040
|
+
}
|
|
3041
|
+
const projectPath = path.resolve(session.projectPath);
|
|
3042
|
+
const allowedRoots = [projectPath, managedTempPath].filter((value) => !!value);
|
|
3043
|
+
let resolvedPath = path.resolve(projectPath, localPath);
|
|
3044
|
+
if (!allowedRoots.some(root => isSameOrDescendant(resolvedPath, root))) {
|
|
3045
|
+
return { ok: false, code: 'INVALID_LOCAL_PATH', error: 'Download destination must be inside the current session project or managed TMPDIR' };
|
|
3046
|
+
}
|
|
3047
|
+
try {
|
|
3048
|
+
// Choose the filename locally so ticket metadata cannot redirect a directory download.
|
|
3049
|
+
if (fs.existsSync(resolvedPath) && fs.lstatSync(resolvedPath).isDirectory()) {
|
|
3050
|
+
const filename = path.posix.basename(parsed.command.remotePath);
|
|
3051
|
+
if (!filename || filename === '.' || path.basename(filename) !== filename) {
|
|
3052
|
+
return { ok: false, code: 'INVALID_LOCAL_PATH', error: 'Managed download requires a file name' };
|
|
3053
|
+
}
|
|
3054
|
+
resolvedPath = path.join(resolvedPath, filename);
|
|
3055
|
+
}
|
|
3056
|
+
if (!hasTrustedFullAccessDelegation(grant) && (isHClassPath(resolvedPath) || isLClassPath(resolvedPath))) {
|
|
3057
|
+
return { ok: false, code: 'PROTECTED_LOCAL_PATH', error: 'Download destination cannot be a protected EvolCore path' };
|
|
3058
|
+
}
|
|
3059
|
+
// New files and parents are allowed; resolve the nearest existing ancestor before writing.
|
|
3060
|
+
const missing = [];
|
|
3061
|
+
let ancestor = resolvedPath;
|
|
3062
|
+
while (true) {
|
|
3063
|
+
let stat;
|
|
3064
|
+
try {
|
|
3065
|
+
stat = fs.lstatSync(ancestor);
|
|
3066
|
+
}
|
|
3067
|
+
catch (error) {
|
|
3068
|
+
if (error.code !== 'ENOENT')
|
|
3069
|
+
throw error;
|
|
3070
|
+
const parent = path.dirname(ancestor);
|
|
3071
|
+
if (parent === ancestor)
|
|
3072
|
+
throw error;
|
|
3073
|
+
missing.unshift(path.basename(ancestor));
|
|
3074
|
+
ancestor = parent;
|
|
3075
|
+
continue;
|
|
3076
|
+
}
|
|
3077
|
+
if (ancestor === resolvedPath && (!stat.isFile() || stat.nlink > 1)) {
|
|
3078
|
+
return { ok: false, code: 'INVALID_LOCAL_FILE', error: 'Download destination must be a regular non-symlink file without hard links' };
|
|
3079
|
+
}
|
|
3080
|
+
if (ancestor !== resolvedPath && !fs.statSync(ancestor).isDirectory()) {
|
|
3081
|
+
return { ok: false, code: 'INVALID_LOCAL_PATH', error: 'Download destination parent must be a directory' };
|
|
3082
|
+
}
|
|
3083
|
+
break;
|
|
3084
|
+
}
|
|
3085
|
+
const realPath = path.join(fs.realpathSync(ancestor), ...missing);
|
|
3086
|
+
const realRoots = allowedRoots.map(root => fs.realpathSync(root));
|
|
3087
|
+
if (!realRoots.some(root => isSameOrDescendant(realPath, root))
|
|
3088
|
+
|| (!hasTrustedFullAccessDelegation(grant) && (isHClassPath(realPath) || isLClassPath(realPath)))) {
|
|
3089
|
+
return { ok: false, code: 'PROTECTED_LOCAL_PATH', error: 'Download destination resolves outside the allowed project or managed TMPDIR path' };
|
|
3090
|
+
}
|
|
3091
|
+
parsed.command.localPath = realPath;
|
|
3092
|
+
}
|
|
3093
|
+
catch (error) {
|
|
3094
|
+
return { ok: false, code: 'INVALID_LOCAL_FILE', error: error instanceof Error ? error.message : String(error) };
|
|
3095
|
+
}
|
|
3096
|
+
}
|
|
3027
3097
|
try {
|
|
3028
3098
|
return { ok: true, result: await executeManagedFsOperation(resolvedCommand) };
|
|
3029
3099
|
}
|
|
@@ -3251,13 +3321,13 @@ export class CommandHandler {
|
|
|
3251
3321
|
const result = await execute(['set', 'responseMode', args[0]]);
|
|
3252
3322
|
if (!result.ok)
|
|
3253
3323
|
return failure(result);
|
|
3254
|
-
return emit({ ok: true, scope: 'relation', mode: args[0] },
|
|
3324
|
+
return emit({ ok: true, scope: 'relation', mode: args[0] }, `已设置响应模式为 ${args[0]}(作用域: relation)`);
|
|
3255
3325
|
}
|
|
3256
3326
|
if (sub === 'reset' && args.length === 0) {
|
|
3257
3327
|
const result = await execute(['unset', 'responseMode']);
|
|
3258
3328
|
if (!result.ok)
|
|
3259
3329
|
return failure(result);
|
|
3260
|
-
return emit({ ok: true, scope: 'relation' }, '
|
|
3330
|
+
return emit({ ok: true, scope: 'relation' }, '已清除当前关系的响应模式设置');
|
|
3261
3331
|
}
|
|
3262
3332
|
if (sub === 'current' && args.length === 0) {
|
|
3263
3333
|
const modeResult = await execute(['get', 'responseMode']);
|
|
@@ -3583,7 +3653,7 @@ export class CommandHandler {
|
|
|
3583
3653
|
logger.info(`[PathGrant] granted session=${sessionId} path=${resolvedPath} access=${accessValue} by=${actor.actorId ?? 'unknown'} self=${actor.selfAid}`);
|
|
3584
3654
|
return {
|
|
3585
3655
|
ok: true,
|
|
3586
|
-
result:
|
|
3656
|
+
result: `已授予 ${accessValue} 于 ${resolvedPath}(仅当前会话,会话结束自动撤销)`,
|
|
3587
3657
|
};
|
|
3588
3658
|
}
|
|
3589
3659
|
// ── Queue command ──
|
|
@@ -3630,7 +3700,7 @@ export class CommandHandler {
|
|
|
3630
3700
|
// 操作分支
|
|
3631
3701
|
if (args.includes('--clear')) {
|
|
3632
3702
|
const count = this.messageQueue.clearBySession(sessionId);
|
|
3633
|
-
return { ok: true, result:
|
|
3703
|
+
return { ok: true, result: `已清空 ${count} 条待处理消息` };
|
|
3634
3704
|
}
|
|
3635
3705
|
if (args.includes('--cancel')) {
|
|
3636
3706
|
const msgId = this.extractArg(args, '--cancel');
|
|
@@ -3638,13 +3708,13 @@ export class CommandHandler {
|
|
|
3638
3708
|
return { ok: false, error: '❌ --cancel 需要指定 messageId' };
|
|
3639
3709
|
const success = this.messageQueue.cancelMessageByIdInSession(sessionId, msgId);
|
|
3640
3710
|
return success
|
|
3641
|
-
? { ok: true, result:
|
|
3711
|
+
? { ok: true, result: `已取消消息 ${msgId}` }
|
|
3642
3712
|
: { ok: false, error: `❌ 未找到消息 ${msgId}` };
|
|
3643
3713
|
}
|
|
3644
3714
|
if (args.includes('--interrupt')) {
|
|
3645
3715
|
const interrupted = await this.messageQueue.interruptBySession(sessionId);
|
|
3646
3716
|
return interrupted
|
|
3647
|
-
? { ok: true, result:
|
|
3717
|
+
? { ok: true, result: `已打断处理中任务` }
|
|
3648
3718
|
: { ok: false, error: `❌ 当前无处理中任务` };
|
|
3649
3719
|
}
|
|
3650
3720
|
// 查询
|