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
package/dist/cli/aun-commands.js
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import crypto from 'crypto';
|
|
4
|
-
import { agentMdPath, resolvePaths, resolveRoot } from '../paths.js';
|
|
4
|
+
import { agentDir, agentMdPath, resolvePaths, resolveRoot } from '../paths.js';
|
|
5
5
|
import { normalizeGroupAid } from '../aun/group/index.js';
|
|
6
6
|
import { getArgValue, isHelpFlag, wantsHelp } from './help.js';
|
|
7
7
|
import { daemonUnavailableMessage, queryDaemon } from './help.js';
|
|
8
8
|
import { isValidAid as validSendAid } from '../aun/aid/validation.js';
|
|
9
|
+
import { AGENTMD_EDITABLE_FIELDS, AGENTMD_VISIBILITY_ERROR, isAgentMdEditableField, isAgentMdVisibility, } from '../aun/aid/agentmd.js';
|
|
9
10
|
import { isValidEncryptMode, MANAGED_SEND_BOOLEAN_FLAGS, MANAGED_SEND_TRISTATE_FLAGS, MANAGED_SEND_VALUE_FLAGS, resolveEncryptFlagValue, } from '../core/message/send-options.js';
|
|
10
11
|
import { AGENT_DELEGATION_TOKEN_ENV, CODEX_SESSION_TOKEN_ENV, readDelegationCredential, } from '../core/auth/agent-delegation.js';
|
|
11
12
|
import { MAIN_CLI_BIN, SELF_AID_ENV, SESSION_ID_ENV } from '../product.js';
|
|
12
13
|
import { isTrustedFullAccessRuntimeContext, readBestTaskRuntimeContext, readVerifiedTaskRuntimeContext, RUNTIME_LOCK_DIR_ENV, SESSION_RUNTIME_DIR_ENV, TASK_RUNTIME_CONTEXT_ENV, } from './task-context.js';
|
|
13
14
|
import { assertEcSingleLine, parseTimeArg, TIME_ARG_FORMATS } from './cli-argv.js';
|
|
14
15
|
import { canonicalizeEvolcoreCommandArgv } from '../core/permission/ec-command-parser.js';
|
|
16
|
+
import { DEBUG_SESSION_ENV } from './debug-mode.js';
|
|
15
17
|
import { ManagedGroupOperationError } from '../aun/msg/managed-operation.js';
|
|
16
18
|
import { parseDuration } from '../trigger/parser.js';
|
|
17
19
|
import { isTopicThreadId, safeFormatMainTopicId } from '../core/thread/topic-id.js';
|
|
@@ -1015,22 +1017,25 @@ Options:
|
|
|
1015
1017
|
put <aid> 读本地 agent.md → 用本地私钥签名 → 上传到 PKI
|
|
1016
1018
|
get <aid> 从 PKI 下载 agent.md → 验签 → 持久化到本地
|
|
1017
1019
|
set <aid> <field> <value>
|
|
1018
|
-
修改
|
|
1019
|
-
tags 的 value 必须是 JSON 字符串数组,例如 ["coding","tools","aun"]
|
|
1020
|
+
修改 ${AGENTMD_EDITABLE_FIELDS.join('/')} 中的一个字段,签名后上传
|
|
1021
|
+
tags 的 value 必须是 JSON 字符串数组,例如 ["coding","tools","aun"]
|
|
1022
|
+
visibility 的 value 必须是 public、unlisted 或 private`);
|
|
1020
1023
|
return;
|
|
1021
1024
|
}
|
|
1022
1025
|
if (verb === 'set') {
|
|
1023
1026
|
const field = args[3];
|
|
1024
1027
|
const value = args[4];
|
|
1025
|
-
const editableFields = new Set(['name', 'type', 'description', 'version', 'tags', 'exttype']);
|
|
1026
1028
|
if (!aid || !field || value === undefined) {
|
|
1027
|
-
failManagedAid(formatJson, 'INVALID_ARGUMENT',
|
|
1029
|
+
failManagedAid(formatJson, 'INVALID_ARGUMENT', `用法: ec aid agentmd set <aid> <${AGENTMD_EDITABLE_FIELDS.join('|')}> <value>`);
|
|
1028
1030
|
}
|
|
1029
1031
|
if (!isValidAid(aid)) {
|
|
1030
1032
|
failManagedAid(formatJson, 'INVALID_AID', `无效 AID 格式: ${aid}`);
|
|
1031
1033
|
}
|
|
1032
|
-
if (!
|
|
1033
|
-
failManagedAid(formatJson, 'INVALID_ARGUMENT', `agentmd set field must be one of ${
|
|
1034
|
+
if (!isAgentMdEditableField(field)) {
|
|
1035
|
+
failManagedAid(formatJson, 'INVALID_ARGUMENT', `agentmd set field must be one of ${AGENTMD_EDITABLE_FIELDS.join(', ')}`);
|
|
1036
|
+
}
|
|
1037
|
+
if (field === 'visibility' && !isAgentMdVisibility(value)) {
|
|
1038
|
+
failManagedAid(formatJson, 'INVALID_ARGUMENT', AGENTMD_VISIBILITY_ERROR);
|
|
1034
1039
|
}
|
|
1035
1040
|
let parsedValue = value;
|
|
1036
1041
|
if (field === 'tags') {
|
|
@@ -1258,6 +1263,7 @@ Commands:
|
|
|
1258
1263
|
upload <aid> <local-file> <remote-path> [--public] 上传文件(默认私有)
|
|
1259
1264
|
download <aid> <url> [local-path] 下载文件
|
|
1260
1265
|
get-by-share <aid> <share-id> [local-path] 通过分享短码下载文件
|
|
1266
|
+
share <aid> --input-file FILE [--format json] 创建/查询/撤销私有分享,JSON内action=create|list|revoke|status
|
|
1261
1267
|
ls <aid> [prefix] 列文件
|
|
1262
1268
|
rm <aid> <remote-path> 删文件
|
|
1263
1269
|
quota <aid> 查配额
|
|
@@ -1291,7 +1297,7 @@ Options:
|
|
|
1291
1297
|
process.exit(1);
|
|
1292
1298
|
}
|
|
1293
1299
|
if (process.env.EVOLCORE_SESSION_ID) {
|
|
1294
|
-
const operation = { ls: 'storage.list', quota: 'storage.quota', upload: 'storage.upload', download: 'storage.download', rm: 'storage.delete', 'get-by-share': 'storage.get_by_share' }[sub];
|
|
1300
|
+
const operation = { ls: 'storage.list', quota: 'storage.quota', upload: 'storage.upload', download: 'storage.download', rm: 'storage.delete', 'get-by-share': 'storage.get_by_share', share: 'storage.share' }[sub];
|
|
1295
1301
|
if (!operation)
|
|
1296
1302
|
failManagedGroup(formatJson, 'NOT_ALLOWED', `unsupported managed storage command: ${sub}`);
|
|
1297
1303
|
const delegationToken = readDelegationCredential();
|
|
@@ -1339,7 +1345,12 @@ Options:
|
|
|
1339
1345
|
}
|
|
1340
1346
|
if (!authorization.ok)
|
|
1341
1347
|
failManagedGroup(formatJson, authorization.code || 'STORAGE_AUTH_FAILED', authorization.error || 'Storage operation denied');
|
|
1342
|
-
if (sub === '
|
|
1348
|
+
if (sub === 'share') {
|
|
1349
|
+
console.log(JSON.stringify(authorization.result, null, 2));
|
|
1350
|
+
if (authorization.result?.state !== 'succeeded')
|
|
1351
|
+
process.exitCode = 3;
|
|
1352
|
+
}
|
|
1353
|
+
else if (sub === 'ls') {
|
|
1343
1354
|
const objects = authorization.result?.objects ?? authorization.result ?? [];
|
|
1344
1355
|
console.log(Array.isArray(objects) && !objects.length ? '(空)' : JSON.stringify(objects, null, 2));
|
|
1345
1356
|
}
|
|
@@ -1356,6 +1367,22 @@ Options:
|
|
|
1356
1367
|
return;
|
|
1357
1368
|
}
|
|
1358
1369
|
const { storageUpload, storageDownload, storageGetByShare, storageLs, storageRm, storageQuota } = await import('../aun/storage/index.js');
|
|
1370
|
+
if (sub === 'share') {
|
|
1371
|
+
const { resolveStorageCommandArgv, executeStorageShare } = await import('../aun/storage/index.js');
|
|
1372
|
+
const { createShortConnection } = await import('../aun/rpc/index.js');
|
|
1373
|
+
const command = resolveStorageCommandArgv(['storage', ...args]);
|
|
1374
|
+
const client = await createShortConnection(aid, { aunPath });
|
|
1375
|
+
try {
|
|
1376
|
+
const result = await executeStorageShare(client, aid, command.share, path.join(resolvePaths().root, 'data', 'storage-shares'));
|
|
1377
|
+
console.log(JSON.stringify(result, null, 2));
|
|
1378
|
+
if (result.state !== 'succeeded')
|
|
1379
|
+
process.exitCode = 3;
|
|
1380
|
+
}
|
|
1381
|
+
finally {
|
|
1382
|
+
await client.close();
|
|
1383
|
+
}
|
|
1384
|
+
return;
|
|
1385
|
+
}
|
|
1359
1386
|
if (sub === 'upload') {
|
|
1360
1387
|
const localFile = args[2];
|
|
1361
1388
|
const remotePath = args[3];
|
|
@@ -1499,7 +1526,7 @@ Options:
|
|
|
1499
1526
|
/**
|
|
1500
1527
|
* 构造跨话题复查 Trigger 的定义。
|
|
1501
1528
|
*
|
|
1502
|
-
* `
|
|
1529
|
+
* `ecmsg send --thread T2 --check-every 5m` 发送成功后自动创建。
|
|
1503
1530
|
*
|
|
1504
1531
|
* 使用 `interval` 而非 `delay`:周期触发,由显式
|
|
1505
1532
|
* `ec trigger delete`(结束,不留残留)/ `ec trigger update --every <新时长>`(调整周期)改变状态。
|
|
@@ -1581,7 +1608,7 @@ export function buildCrossThreadReviewPrompt(input) {
|
|
|
1581
1608
|
`当前话题:${input.targetThreadName}(对端 ${input.targetPeerName})`,
|
|
1582
1609
|
`发送于:{{trigger.labels.firstSentAtTime}}`,
|
|
1583
1610
|
`已过:{{run.elapsed}}`,
|
|
1584
|
-
|
|
1611
|
+
`复查周期:{{run.every}}(每 {{run.every}} 提醒一次,直到处理)`,
|
|
1585
1612
|
'',
|
|
1586
1613
|
`Trigger:${input.triggerId}`,
|
|
1587
1614
|
'',
|
|
@@ -1621,7 +1648,7 @@ function parseCheckEveryArgs(checkEveryRaw, hasCheckEvery) {
|
|
|
1621
1648
|
/**
|
|
1622
1649
|
* 跨话题发送成功后的统一收尾:创建周期复查 Trigger + 写入本端 thread-inbox。
|
|
1623
1650
|
*
|
|
1624
|
-
*
|
|
1651
|
+
* 私聊与群聊的跨话题发送(`ecmsg send --thread`)共用,
|
|
1625
1652
|
* 保证两条路径行为一致(M2 修复前群聊路径完全不做这两件事)。
|
|
1626
1653
|
*
|
|
1627
1654
|
* 设计见 `docs/thread-chain/thread-context-mechanism.md` §十、`thread-cli-spec-v2.md` §3.4。
|
|
@@ -1653,12 +1680,22 @@ async function applyCrossThreadSendEffects(input) {
|
|
|
1653
1680
|
let originPeerName = originPeer;
|
|
1654
1681
|
let targetThreadName = input.targetThreadId;
|
|
1655
1682
|
let targetPeerName = input.targetChannelId;
|
|
1656
|
-
//
|
|
1657
|
-
// 伪对端(trigger: / bg
|
|
1658
|
-
const originPeerType = (() => {
|
|
1683
|
+
// 来源话题对端的主体类型(话题索引不存 type):身份缓存优先,运行时取值兜底。
|
|
1684
|
+
// 伪对端(trigger: / bg:)与 'system' 都不是主体,不能写进信封。
|
|
1685
|
+
const originPeerType = await (async () => {
|
|
1686
|
+
// 类型以身份缓存(agent.md 快照)为准,按来源对端 AID 查;复查唤醒的会话里运行时 peerType 可能是 'system',不能当对端类型。
|
|
1687
|
+
try {
|
|
1688
|
+
const { PeerIdentityCache } = await import('../core/relation/peer-identity.js');
|
|
1689
|
+
const cached = PeerIdentityCache.get('aun', originPeer, agentDir(input.selfAid));
|
|
1690
|
+
if (cached && cached.source !== 'unknown' && cached.type)
|
|
1691
|
+
return cached.type;
|
|
1692
|
+
}
|
|
1693
|
+
catch {
|
|
1694
|
+
// 缓存不可读时退回运行时取值
|
|
1695
|
+
}
|
|
1659
1696
|
const type = String(runtime?.peerType ?? '').trim();
|
|
1660
1697
|
const peerId = String(runtime?.peerId ?? '');
|
|
1661
|
-
if (!type || peerId.startsWith('trigger:') || peerId.startsWith('bg:'))
|
|
1698
|
+
if (!type || type === 'system' || peerId.startsWith('trigger:') || peerId.startsWith('bg:'))
|
|
1662
1699
|
return undefined;
|
|
1663
1700
|
return type;
|
|
1664
1701
|
})();
|
|
@@ -1712,7 +1749,7 @@ async function applyCrossThreadSendEffects(input) {
|
|
|
1712
1749
|
// `--check-every none`:跳过 Trigger,只保留 inbox(「我发过」是事实,定时唤醒是可选项)。
|
|
1713
1750
|
if (input.durationMs !== undefined) {
|
|
1714
1751
|
try {
|
|
1715
|
-
const { formatChannelKey } = await import('../core/channel-loader.js');
|
|
1752
|
+
const { formatChannelKey } = await import('../core/channel/channel-loader.js');
|
|
1716
1753
|
const triggerDef = buildThreadCheckTrigger({
|
|
1717
1754
|
agentAid: input.selfAid,
|
|
1718
1755
|
id: triggerId,
|
|
@@ -1780,16 +1817,34 @@ export async function cmdMsg(args) {
|
|
|
1780
1817
|
const aunPath = resolveAunPath(args);
|
|
1781
1818
|
const formatJson = getArgValue(args, '--format') === 'json';
|
|
1782
1819
|
const appSlot = getArgValue(args, '--app');
|
|
1820
|
+
// `ec msg send --help` 要的是发送用法,不是查询子命令清单——后者一个发送参数都没有,
|
|
1821
|
+
// 照着查 --file / --link 只会查不到。发送正文集中在 ecmsg,这里给要点并指向它。
|
|
1822
|
+
if (sub === 'send' && wantsHelp(args)) {
|
|
1823
|
+
console.log(`用法: ecmsg send '<正文>' [选项]
|
|
1824
|
+
ecmsg send '<正文>' --thread <话题id>
|
|
1825
|
+
ecmsg send '<正文>' --thread <话题id> --selfmode
|
|
1826
|
+
|
|
1827
|
+
发送一律用 ecmsg(托管会话本端恒等于会话本端,接收方由话题和模式推出)。
|
|
1828
|
+
|
|
1829
|
+
正文来源(互斥,选一种):
|
|
1830
|
+
'<正文>' 位置参数
|
|
1831
|
+
--file <path> 附件;配 --as image|video|voice|file|widget_card、--text '<说明>'
|
|
1832
|
+
--link <url> 链接卡片;配 --title
|
|
1833
|
+
--payload '<json>' 自定义 payload
|
|
1834
|
+
--payload-file <path> 从文件读 payload
|
|
1835
|
+
--text-from-file <path> 从文件读正文
|
|
1836
|
+
|
|
1837
|
+
参数: ${MANAGED_SEND_VALUE_FLAGS.join(' ')} ${MANAGED_SEND_TRISTATE_FLAGS.join(' ')}
|
|
1838
|
+
|
|
1839
|
+
完整用法与各参数语义: ecmsg --help`);
|
|
1840
|
+
return;
|
|
1841
|
+
}
|
|
1783
1842
|
if (!sub || isHelpFlag(sub) || (wantsHelp(args) && sub !== 'history')) {
|
|
1784
1843
|
console.log(`用法: ec msg <command> <from-aid> [args...] [options]
|
|
1785
1844
|
|
|
1845
|
+
发送统一用 ecmsg send(见 ecmsg --help)。
|
|
1846
|
+
|
|
1786
1847
|
Commands:
|
|
1787
|
-
send <from> <to> <text> 发送文本
|
|
1788
|
-
send <from> <to> --text-from-file <path> 从文件读取文本内容
|
|
1789
|
-
send <from> <to> --file <path> [--as <type>] 发送文件或 WidgetCard
|
|
1790
|
-
send <from> <to> --link <url> [--title T] 发送链接卡片
|
|
1791
|
-
send <from> <to> --payload <json> 发送自定义 payload
|
|
1792
|
-
send <from> <to> --payload-file <path> 从 UTF-8 文件读取自定义 payload
|
|
1793
1848
|
request get <self-aid> <request-id> 查询已登记请求状态
|
|
1794
1849
|
pull <from> [--after-seq N] [--limit N] --app <name> 拉取收件箱(必须使用独立 slot)
|
|
1795
1850
|
ack <from> <seq> [--app <name>] 确认已读
|
|
@@ -1797,25 +1852,22 @@ Commands:
|
|
|
1797
1852
|
online <from> <target-aid> [<target-aid>...] 查询在线状态
|
|
1798
1853
|
history <from> [<target-aid>|selector] [筛选选项] 查询本地消息历史
|
|
1799
1854
|
|
|
1800
|
-
|
|
1801
|
-
send <text> --thread <id> from/to 从运行时上下文与话题索引自动推断
|
|
1802
|
-
send <text> 发送到当前会话对端
|
|
1803
|
-
ecmsg send '<text>' [--thread <id>|--to <对端ID>] 统一入口,跨话题自动建复查
|
|
1855
|
+
托管会话(EVOLCORE_SESSION_ID 已设时):发送一律走 ecmsg,本命令只提供查询类子命令。
|
|
1804
1856
|
|
|
1805
1857
|
Options:
|
|
1806
|
-
--text-from-file <path> 从文件读取文本(UTF-8),用于超长消息或避免 Shell 转义
|
|
1807
|
-
--handoff-context <text> 仅托管会话:为目标会话补充本地上下文,不发给对端
|
|
1808
1858
|
--app <name> 指定应用 slot(独立消费通道,不影响 daemon)
|
|
1809
1859
|
--aun-path <path> 指定 AUN keystore 根
|
|
1810
1860
|
--format json 输出 JSON 格式
|
|
1811
1861
|
--payload '<json>' 发送任意 JSON payload,不添加聊天字段
|
|
1812
1862
|
--payload-file <path> 从 UTF-8 文件读取 JSON payload(与 --payload 互斥)
|
|
1813
1863
|
--return none|required 是否等待关联响应(required 建立请求记录)
|
|
1814
|
-
--device-id <id>
|
|
1864
|
+
--device-id <id> 可选,定向到能力目录中的一台设备;不指定时业务 Ability 收到首个最终回包即返回(protocol/discover 不指定,不写入 payload)
|
|
1815
1865
|
--timeout <duration> required 的等待期限和 AUN volatile TTL,如 30s、60s、2m(默认 60s,最大 3600s)
|
|
1816
1866
|
--encrypt yes|no|auto 加密三态:yes 强制加密 / no 强制明文 / auto 跟随入站消息
|
|
1817
1867
|
不带此参数时默认 auto
|
|
1818
1868
|
--thread <id> 指定目标话题 ID(话题必须存在于本端索引;from/to 可省略)
|
|
1869
|
+
--after-seq <N> pull 的起始序号
|
|
1870
|
+
--limit <N> 返回最新 N 条(默认 50,最大 500)
|
|
1819
1871
|
--session <latest|all|id> 按 EvolCore 逻辑会话过滤历史(默认 latest)
|
|
1820
1872
|
--before <time> 只返回该时间之前的历史
|
|
1821
1873
|
--after <time> 只返回该时间之后的历史
|
|
@@ -1824,35 +1876,8 @@ Options:
|
|
|
1824
1876
|
--channel-name <name> 历史渠道实例名(非 AUN 渠道必须匹配 Agent 配置)
|
|
1825
1877
|
--channel-key <key> 非 AUN 已落盘渠道的完整实例键(与 --peer-id 成对)
|
|
1826
1878
|
--peer-id <id> 非 AUN 渠道的原生对端 ID(与 --channel-key 成对)
|
|
1827
|
-
--check-every <duration|none> 跨话题发送后自动创建**跨话题复查**(如 5m/30m/2h),跨话题时**必填**;none = 不建复查
|
|
1828
|
-
每 duration 向**目标话题**投递一条【跨话题复查】通知(不新建会话),
|
|
1829
|
-
由目标话题侧的 agent 在自己的上下文里决定结束/调整周期/继续
|
|
1830
|
-
Trigger 名:check-<目标threadId>-from-<来源threadId>-<唯一后缀>
|
|
1831
|
-
结束/调整用返回的 trigger_id(trig_…),show/update/delete 只认 id
|
|
1832
|
-
--content-type <mime> 显式覆盖 MIME(仅 --file 模式)
|
|
1833
|
-
--as <type> 附件类型:image|video|voice|file|widget_card(仅 --file 模式)
|
|
1834
|
-
--text <说明> 附件说明文字(仅 --file 模式)
|
|
1835
|
-
--transcript <text> 语音转写(仅 --as voice)
|
|
1836
|
-
--title <text> 链接标题(仅 --link 模式)
|
|
1837
|
-
--description <text> 链接描述(仅 --link 模式)
|
|
1838
|
-
-- end-of-options:其后所有参数按正文处理
|
|
1839
|
-
(用于发送恰好等于某 flag 的文本,如 send a b -- --encrypt)
|
|
1840
|
-
|
|
1841
|
-
回执字段:
|
|
1842
|
-
to=<AID>(<来源>) 实际收件人;来源取 会话 / 传入 / 推导
|
|
1843
|
-
thread=<id>(<来源>) 实际落点话题;主话题回显 main
|
|
1844
|
-
跨话题自派时额外带 to=<本端AID>(跨话题自派) recipient=self topicPeer=<话题对端>
|
|
1845
|
-
核对规则: 出现 to=<本端AID> 但没有 recipient=self,说明该话题对端就是本端,属残缺结构;
|
|
1846
|
-
此时不会出现 topicPeer= 字段,消息也无人接收
|
|
1847
1879
|
|
|
1848
1880
|
示例:
|
|
1849
|
-
ec msg send alice.agentid.pub bob.agentid.pub "hello"
|
|
1850
|
-
ec msg send alice.agentid.pub bob.agentid.pub --text-from-file long-message.txt
|
|
1851
|
-
ec msg send alice.agentid.pub bob.agentid.pub "讨论项目A" --thread "thread-xxx"
|
|
1852
|
-
ec msg send alice.agentid.pub bob.agentid.pub --file ./pic.png
|
|
1853
|
-
ec msg send alice.agentid.pub bob.agentid.pub --file ./demo.mp4 --as video
|
|
1854
|
-
ec msg send alice.agentid.pub bob.agentid.pub --link https://example.com --title "AUN"
|
|
1855
|
-
ec msg send alice.agentid.pub bob.agentid.pub --payload '{"type":"query"}' --return required --timeout 60s --format json
|
|
1856
1881
|
ec msg request get alice.agentid.pub request-123 --format json
|
|
1857
1882
|
ec msg pull alice.agentid.pub --app my-bot
|
|
1858
1883
|
ec msg ack alice.agentid.pub 42 --app my-bot
|
|
@@ -1936,9 +1961,20 @@ Options:
|
|
|
1936
1961
|
process.exit(1);
|
|
1937
1962
|
return;
|
|
1938
1963
|
}
|
|
1939
|
-
//
|
|
1940
|
-
|
|
1964
|
+
// 托管会话的发消息入口只有一个:ecmsg send。`ec msg send` 在这里直接禁用,
|
|
1965
|
+
// 不再转发给 daemon——否则同一件事会有两条写法,模型与文档永远对不齐。
|
|
1966
|
+
// 唯一例外是 `--as-session` 调试身份:宿主终端要代表某个 agent 发消息,
|
|
1967
|
+
// 而 ecmsg 不支持 --as-session,只能走这条。该标记只有 debug-mode 会注入。
|
|
1968
|
+
if (process.env.EVOLCORE_SESSION_ID && sub === 'send' && !process.env[DEBUG_SESSION_ENV]) {
|
|
1969
|
+
console.error("❌ 托管会话发送消息请用: ecmsg send '<正文>' [--thread <话题id> [--selfmode]](见 ecmsg --help)");
|
|
1970
|
+
process.exit(1);
|
|
1971
|
+
return;
|
|
1972
|
+
}
|
|
1973
|
+
// 调试身份:走 daemon 的托管通道(审批与授权仍由 daemon 校验),
|
|
1974
|
+
// 不能落到下面的宿主终端分支——那条没有委托校验。
|
|
1975
|
+
if (process.env.EVOLCORE_SESSION_ID && sub === 'send') {
|
|
1941
1976
|
return runManagedSend(['msg', ...args], formatJson);
|
|
1977
|
+
}
|
|
1942
1978
|
if (process.env.EVOLCORE_SESSION_ID && sub === 'history' && getArgValue(args, '--thread')) {
|
|
1943
1979
|
const { isValidAid: checkAid } = await import('../aun/aid/index.js');
|
|
1944
1980
|
const hasFrom = typeof args[1] === 'string' && checkAid(args[1]);
|
|
@@ -1991,7 +2027,7 @@ Options:
|
|
|
1991
2027
|
}
|
|
1992
2028
|
}
|
|
1993
2029
|
}
|
|
1994
|
-
// 宿主终端的简化式:`
|
|
2030
|
+
// 宿主终端的简化式:`ec msg send '<正文>' --self <selfAid> --thread <ref>`
|
|
1995
2031
|
// 没有托管会话上下文,本端只能由 --self 给出;对端由话题引用推导。
|
|
1996
2032
|
// 这和托管会话里的简化式是同一语义,只是本端来源不同。
|
|
1997
2033
|
if (sub === 'send' && !process.env.EVOLCORE_SESSION_ID) {
|
|
@@ -2039,7 +2075,7 @@ Options:
|
|
|
2039
2075
|
if (!isValidAid(from)) {
|
|
2040
2076
|
console.error(`❌ 无效 AID 格式: ${from}`);
|
|
2041
2077
|
if (sub === 'send') {
|
|
2042
|
-
console.error('
|
|
2078
|
+
console.error('提示:宿主终端写法为 ec msg send <本端AID> <对端AID> <正文>,或用 --self <本端AID> --thread <话题id> 由话题推导对端');
|
|
2043
2079
|
}
|
|
2044
2080
|
process.exit(1);
|
|
2045
2081
|
}
|
|
@@ -2192,9 +2228,16 @@ Options:
|
|
|
2192
2228
|
return;
|
|
2193
2229
|
}
|
|
2194
2230
|
if (sub === 'send') {
|
|
2231
|
+
// 发送统一入口是 ecmsg:提示直接给托管写法,避免模型照抄位置参数式。
|
|
2232
|
+
if (process.env.EVOLCORE_SESSION_ID) {
|
|
2233
|
+
console.error('托管会话的发送用: ecmsg send \'<正文>\' [--thread <话题id> [--selfmode]](见 ecmsg --help)');
|
|
2234
|
+
process.exit(1);
|
|
2235
|
+
}
|
|
2195
2236
|
const to = args[2];
|
|
2196
2237
|
if (!to) {
|
|
2197
|
-
|
|
2238
|
+
// 只有宿主终端会走到这里(托管会话在入口处已被拒),而宿主终端的 ecmsg
|
|
2239
|
+
// 只放行跨话题自派,发给对端只能用本命令,所以这里给本命令自己的用法。
|
|
2240
|
+
console.error('用法(宿主终端): ec msg send <本端AID> <对端AID> <正文|--file …|--link …|--payload …>');
|
|
2198
2241
|
process.exit(1);
|
|
2199
2242
|
}
|
|
2200
2243
|
if (!isValidAid(to)) {
|
|
@@ -2552,19 +2595,26 @@ Options:
|
|
|
2552
2595
|
}
|
|
2553
2596
|
return;
|
|
2554
2597
|
}
|
|
2555
|
-
console.error(`未知子命令: ${sub}\n用法: ec msg [
|
|
2598
|
+
console.error(`未知子命令: ${sub}\n用法: ec msg [request|pull|ack|recall|online|history](发送用 ecmsg send)`);
|
|
2556
2599
|
process.exit(1);
|
|
2557
2600
|
}
|
|
2558
2601
|
// ==================== Group ====================
|
|
2559
2602
|
const GROUP_FROM_AID_FORMAT_EXAMPLE = 'sender.example.invalid';
|
|
2560
2603
|
const GROUP_AID_FORMAT_EXAMPLE = '12345.example.invalid';
|
|
2561
2604
|
function printGroupArgsHint(sub) {
|
|
2562
|
-
|
|
2563
|
-
|
|
2605
|
+
// 托管会话只教 ecmsg;宿主终端的 ecmsg 发不了群(只放行跨话题自派),
|
|
2606
|
+
// 那边给本命令自己的用法。
|
|
2607
|
+
if (sub === 'send' && process.env.EVOLCORE_SESSION_ID) {
|
|
2608
|
+
console.error("正确格式: ecmsg send '<正文>' [--file <path> --as <type>](当前群会话直接发送;跨群用 --thread <群主话题id>)");
|
|
2609
|
+
console.error('查询真实群 AID: ec group list <发送方AID>');
|
|
2610
|
+
return;
|
|
2564
2611
|
}
|
|
2565
|
-
|
|
2566
|
-
console.error(
|
|
2612
|
+
if (sub === 'send') {
|
|
2613
|
+
console.error('正确格式(宿主终端): ec group send <发送方AID> <真实群AID> <正文或文件参数>');
|
|
2614
|
+
console.error('查询真实群 AID: ec group list <发送方AID>');
|
|
2615
|
+
return;
|
|
2567
2616
|
}
|
|
2617
|
+
console.error(`正确格式: ec group ${sub} <发送方AID> <真实群AID> [选项]`);
|
|
2568
2618
|
console.error(`仅格式示例(.example.invalid 是保留的虚构域,不是真实 AID): ec group ${sub} ${GROUP_FROM_AID_FORMAT_EXAMPLE} ${GROUP_AID_FORMAT_EXAMPLE}`);
|
|
2569
2619
|
console.error('顺序固定为「先发送方 AID,后群 AID」;查询真实群 AID: ec group list <发送方AID>');
|
|
2570
2620
|
}
|
|
@@ -2616,10 +2666,7 @@ visitor 不开放历史;群权限仍由托管会话校验。`);
|
|
|
2616
2666
|
console.log(`用法: ec group <command> <from-aid> [args...] [options]
|
|
2617
2667
|
|
|
2618
2668
|
消息:
|
|
2619
|
-
send
|
|
2620
|
-
send <from> <group-id> --file <path> [--as <type>] 发送群文件
|
|
2621
|
-
send <from> <group-id> --payload <json> 发送自定义 payload
|
|
2622
|
-
(托管会话发消息统一用 ecmsg send '<text>' --to <群ID>,见 ecmsg --help)
|
|
2669
|
+
发送群消息统一用 ecmsg send(当前群会话直接发;跨群用 --thread <群主话题id>,见 ecmsg --help)
|
|
2623
2670
|
pull <from> <group-id> [--after-seq N] [--limit N] --app <name> 拉取群消息(必须使用独立 slot)
|
|
2624
2671
|
ack <from> <group-id> <seq> [--app <name>] 确认已读
|
|
2625
2672
|
history <from> <group-id> [options] 查询本地群消息历史(只读)
|
|
@@ -2665,32 +2712,12 @@ Options:
|
|
|
2665
2712
|
--app <name> 指定应用 slot(独立消费通道,不影响 daemon)
|
|
2666
2713
|
--aun-path <path> 指定 AUN keystore 根
|
|
2667
2714
|
--format json 输出 JSON 格式
|
|
2668
|
-
--encrypt yes|no|auto 加密三态:yes 强制加密 / no 强制明文 / auto 跟随入站消息(仅 send)
|
|
2669
|
-
不带此参数时默认 auto
|
|
2670
|
-
--thread <id> 指定话题 ID(仅 send;话题必须存在于本端索引)
|
|
2671
|
-
--check-every <时长|none> 跨话题发送(带 --thread)时**必填**,创建跨话题复查(如 5m/30m/2h);none = 不建复查
|
|
2672
|
-
到期向**目标话题**投递【跨话题复查】通知,不新建会话
|
|
2673
|
-
无值时默认 5m;Trigger 名:check-<目标threadId>-from-<来源threadId>-<唯一后缀>
|
|
2674
|
-
结束/调整用返回的 trigger_id(trig_…),show/update/delete 只认 id
|
|
2675
|
-
--trigger-prompt <text> 追加到复查通知正文里的补充说明(仅 --check-every)
|
|
2676
|
-
--mention <...> 发送时 @ 某个成员。单引号包住、逗号分隔多个 aid
|
|
2677
|
-
(如 --mention 'alice.agentid.pub,bob.agentid.pub'),可多次传入
|
|
2678
|
-
--mention-all 发送时 @ 所有人
|
|
2679
|
-
--content-type <mime> 显式覆盖 MIME(仅 --file 模式)
|
|
2680
|
-
--as <type> 附件类型:image|video|voice|file|widget_card(仅 --file 模式)
|
|
2681
|
-
--text <说明> 附件说明文字(仅 --file 模式)
|
|
2682
|
-
--transcript <text> 语音转写(仅 --as voice)
|
|
2683
2715
|
--group-id <aid> 指定自定义群 AID(仅 create);省略时生成 g- 加五位随机数字
|
|
2684
2716
|
--member-type <type> 定向邀请成员类型:human|agent(仅 invite)
|
|
2685
|
-
--
|
|
2686
|
-
(用于发送恰好等于某 flag 的文本,如 send a g -- --encrypt)
|
|
2717
|
+
history 的筛选选项见 ec group history --help
|
|
2687
2718
|
|
|
2688
2719
|
格式示例(.example.invalid 是保留的虚构域,以下 AID 均不是真实地址):
|
|
2689
2720
|
ec group create sender.example.invalid "Dev Team" --visibility private
|
|
2690
|
-
ec group send sender.example.invalid 12345.example.invalid "hello team"
|
|
2691
|
-
ec group send sender.example.invalid 12345.example.invalid '@member 看下 PR' --mention 'member.example.invalid'
|
|
2692
|
-
ec group send sender.example.invalid 12345.example.invalid --file ./arch.png
|
|
2693
|
-
ec group send sender.example.invalid g-12345.example.invalid "进度?" --thread thread-xxx --check-every 30m
|
|
2694
2721
|
ec group rules sender.example.invalid 12345.example.invalid set ./rules.md
|
|
2695
2722
|
ec group invite sender.example.invalid 12345.example.invalid member.example.invalid
|
|
2696
2723
|
ec group members sender.example.invalid 12345.example.invalid
|
|
@@ -2721,13 +2748,17 @@ g- 是名称的一部分,会完整保留;默认命名格式为 g-10000 至 g
|
|
|
2721
2748
|
renderManagedGroupResult(args, result, formatJson);
|
|
2722
2749
|
return;
|
|
2723
2750
|
}
|
|
2751
|
+
// 同 ec msg send:托管会话的群发只走 ecmsg send(当前群会话省略 --thread,
|
|
2752
|
+
// 跨群用 --thread <群主话题id>);`--as-session` 调试身份例外,理由见 cmdMsg 里同一处判断。
|
|
2753
|
+
if (process.env.EVOLCORE_SESSION_ID && sub === 'send' && !process.env[DEBUG_SESSION_ENV]) {
|
|
2754
|
+
return failManagedGroup(formatJson, 'NOT_ALLOWED', "托管会话发送群消息请用: ecmsg send '<正文>'(当前群会话直接发;跨群用 --thread <群主话题id>,见 ecmsg --help)");
|
|
2755
|
+
}
|
|
2724
2756
|
if (process.env.EVOLCORE_SESSION_ID && sub === 'send') {
|
|
2725
2757
|
if (args.includes('--aun-path') || args.includes('--app')) {
|
|
2726
2758
|
failManagedGroup(formatJson, 'NOT_ALLOWED', '--aun-path and --app are not allowed in a managed task');
|
|
2727
2759
|
}
|
|
2728
|
-
let groupId;
|
|
2729
2760
|
try {
|
|
2730
|
-
|
|
2761
|
+
normalizeGroupAid(args[2] ?? '', from.slice(from.indexOf('.') + 1));
|
|
2731
2762
|
}
|
|
2732
2763
|
catch (error) {
|
|
2733
2764
|
failManagedGroup(formatJson, 'INVALID_ARGUMENT', `Invalid group AID: ${error instanceof Error ? error.message : String(error)}`);
|
|
@@ -3580,10 +3611,17 @@ g- 是名称的一部分,会完整保留;默认命名格式为 g-10000 至 g
|
|
|
3580
3611
|
}
|
|
3581
3612
|
return;
|
|
3582
3613
|
}
|
|
3583
|
-
console.error(`未知子命令: ${sub}\n用法: ec group [
|
|
3614
|
+
console.error(`未知子命令: ${sub}\n用法: ec group [pull|ack|history|create|list|info|update|dissolve|suspend|resume|rules|mention|join|leave|invite|invites|accept-invite|reject-invite|revoke-invite|kick|members|online|role|owner|ban|unban|block|unblock|blocklist|report-status|member-statuses](发送用 ecmsg send)`);
|
|
3584
3615
|
process.exit(1);
|
|
3585
3616
|
}
|
|
3586
3617
|
// ==================== Main ====================
|
|
3618
|
+
/**
|
|
3619
|
+
* 把发送 argv 交给 daemon 的托管通道(`aun-msg-send`)。
|
|
3620
|
+
*
|
|
3621
|
+
* 只由 `--as-session` 调试身份使用:普通托管会话被入口处挡住、只走 ecmsg,
|
|
3622
|
+
* 而宿主终端没有委托凭证。调试身份两者都有,正好用这条——委托校验与审批
|
|
3623
|
+
* 仍在 daemon 侧完成,调试身份并不绕过任何授权。
|
|
3624
|
+
*/
|
|
3587
3625
|
async function runManagedSend(argv, formatJson) {
|
|
3588
3626
|
const delegationToken = readDelegationCredential();
|
|
3589
3627
|
if (!delegationToken)
|
|
@@ -3618,20 +3656,19 @@ async function runManagedSend(argv, formatJson) {
|
|
|
3618
3656
|
process.stderr.write(`⚠ 复查 Trigger 未创建: ${result.trigger_error}(消息已发出,需要复查请手动 ec trigger create)\n`);
|
|
3619
3657
|
}
|
|
3620
3658
|
}
|
|
3621
|
-
// 这些示例直接进模型上下文(门禁与 CLI
|
|
3622
|
-
// `ecmsg send`
|
|
3623
|
-
// 仍可用(宿主终端与历史脚本),只是不再作为提示内容教给模型。
|
|
3659
|
+
// 这些示例直接进模型上下文(门禁与 CLI 的拒绝提示都会引用),统一给
|
|
3660
|
+
// `ecmsg send` 写法:本端恒为会话本端,接收方由话题和模式推出。
|
|
3624
3661
|
const SEND_BODY_MODE_USAGE = {
|
|
3625
3662
|
msg: {
|
|
3626
|
-
'--file': "ecmsg send --
|
|
3627
|
-
'--text-from-file': 'ecmsg send --
|
|
3628
|
-
'--link': "ecmsg send --
|
|
3629
|
-
'--payload': "ecmsg send --
|
|
3630
|
-
'--payload-file': 'ecmsg send --
|
|
3663
|
+
'--file': "ecmsg send --file <path> [--as <type>] [--text '<说明>']",
|
|
3664
|
+
'--text-from-file': 'ecmsg send --text-from-file <path>',
|
|
3665
|
+
'--link': "ecmsg send --link <url> [--title '<title>'] [--description '<desc>']",
|
|
3666
|
+
'--payload': "ecmsg send --payload '<json>'",
|
|
3667
|
+
'--payload-file': 'ecmsg send --payload-file <path>',
|
|
3631
3668
|
},
|
|
3632
3669
|
group: {
|
|
3633
|
-
'--file': "ecmsg send --
|
|
3634
|
-
'--payload': "ecmsg send --
|
|
3670
|
+
'--file': "ecmsg send --file <path> [--as <type>] [--text '<说明>'] --thread <群主话题id>",
|
|
3671
|
+
'--payload': "ecmsg send --payload '<json>' --thread <群主话题id>",
|
|
3635
3672
|
},
|
|
3636
3673
|
};
|
|
3637
3674
|
function sendBodyModeConflict(scope, modes, hasPositionText) {
|
|
@@ -3691,11 +3728,20 @@ export function resolveManagedSendArgv(argv, routing) {
|
|
|
3691
3728
|
encrypt = mode === 'auto' ? 'auto' : resolveEncryptFlagValue(mode);
|
|
3692
3729
|
continue;
|
|
3693
3730
|
}
|
|
3694
|
-
// `--to` / `--from`
|
|
3695
|
-
//
|
|
3696
|
-
//
|
|
3731
|
+
// `--to` / `--from` 是**网关**选项。它们不在取值表里,落到下面就会进 text ——
|
|
3732
|
+
// 正文会变成「--to x.agentid.cn 你好」,消息照常送达,于是没人发现发错了。
|
|
3733
|
+
// 这里明确拒绝。
|
|
3734
|
+
//
|
|
3735
|
+
// 提示只教 `ecmsg`:托管会话的唯一发送入口就是它(见 `cmdMsg` 里对
|
|
3736
|
+
// `ec msg send` 的禁用)。绝不能在这里推荐 `ec msg send <from> <to>` 的
|
|
3737
|
+
// 位置参数式——那是内部通道,把模型教过去就等于制造第二套写法,
|
|
3738
|
+
// 模型和文档会永远对不齐。
|
|
3697
3739
|
if (flag === '--to' || flag === '--from') {
|
|
3698
|
-
|
|
3740
|
+
const advice = flag === '--to'
|
|
3741
|
+
? '接收方不再用 --to:当前话题直接省略,跨话题用 `--thread <话题id>`,'
|
|
3742
|
+
+ '自派再加 `--selfmode`'
|
|
3743
|
+
: '托管会话里本端恒等于会话本端,禁止写 `--from`';
|
|
3744
|
+
throw new Error(`${flag} 不是 ec msg send 的参数(它是网关选项)。${advice}`);
|
|
3699
3745
|
}
|
|
3700
3746
|
if (flag === '--app' || flag === '--aun-path')
|
|
3701
3747
|
throw new Error(`${flag} is not allowed for managed sends`);
|
|
@@ -3771,10 +3817,20 @@ export function resolveManagedSendArgv(argv, routing) {
|
|
|
3771
3817
|
throw new Error('Invalid send target');
|
|
3772
3818
|
const checkEvery = values.get('--check-every');
|
|
3773
3819
|
const triggerPromptExtra = values.get('--trigger-prompt');
|
|
3820
|
+
const selfMode = booleans.has('--selfmode');
|
|
3821
|
+
if (selfMode && !thread)
|
|
3822
|
+
throw new Error('--selfmode requires --thread');
|
|
3823
|
+
if (selfMode && scope === 'group')
|
|
3824
|
+
throw new Error('--selfmode sends the local AID, not a group message');
|
|
3774
3825
|
if (!thread && (checkEvery !== undefined || triggerPromptExtra !== undefined))
|
|
3775
3826
|
throw new Error('Cross-thread options require --thread');
|
|
3827
|
+
// 自派不建复查:不写 thread-inbox、不建 Trigger,周期参数对它没有意义。
|
|
3828
|
+
if (selfMode && (checkEvery !== undefined || triggerPromptExtra !== undefined)) {
|
|
3829
|
+
throw new Error('--selfmode does not create a review trigger; --check-every/--trigger-prompt are not allowed');
|
|
3830
|
+
}
|
|
3776
3831
|
let checkEveryMs;
|
|
3777
|
-
if (thread) {
|
|
3832
|
+
if (thread && !selfMode) {
|
|
3833
|
+
// 委托必须给出复查周期(网关会先补默认 20m);自派没有复查,跳过。
|
|
3778
3834
|
if (checkEvery === undefined)
|
|
3779
3835
|
throw new Error('Cross-thread sends require --check-every (or "none")');
|
|
3780
3836
|
// `none` = 跨话题发送但不建复查 Trigger;checkEveryMs 保持 undefined,下游据此跳过建 Trigger。
|
|
@@ -3831,7 +3887,7 @@ export function resolveManagedSendArgv(argv, routing) {
|
|
|
3831
3887
|
return { aid, to, scope, payload, rawPayload: values.has('--payload') || values.has('--payload-file'), file, textFile: values.get('--text-from-file'), payloadFile,
|
|
3832
3888
|
deviceId,
|
|
3833
3889
|
encrypt,
|
|
3834
|
-
thread, checkEvery, checkEveryMs: checkEveryMs ?? undefined, triggerPromptExtra, returnPolicy: returnPolicy, timeoutMs, handoffContext,
|
|
3890
|
+
thread, selfMode: selfMode || undefined, checkEvery, checkEveryMs: checkEveryMs ?? undefined, triggerPromptExtra, returnPolicy: returnPolicy, timeoutMs, handoffContext,
|
|
3835
3891
|
mentions: mentions.length ? mentions : undefined };
|
|
3836
3892
|
}
|
|
3837
3893
|
/**
|
|
@@ -7,12 +7,12 @@ import crypto from 'crypto';
|
|
|
7
7
|
import { resolveRoot, resolvePaths, ensureDataDirs, getPackageRoot, agentMdPath, asModeOverridePath, daemonControlDir } from '../paths.js';
|
|
8
8
|
import { loadDefaults, loadAllAgents, loadDaemonConfig, saveDaemonConfig } from '../config-store.js';
|
|
9
9
|
import { resolveEffective } from '../config/config-manager.js';
|
|
10
|
-
import { resolveAnthropicConfig } from '../
|
|
10
|
+
import { resolveAnthropicConfig } from '../core/baseagent/baseagent.js';
|
|
11
11
|
import { migrateProject } from '../config-store.js';
|
|
12
12
|
import { ipcQuery, IpcTransportError } from '../ipc.js';
|
|
13
13
|
import { isHelpFlag } from './help.js';
|
|
14
14
|
import * as platform from '../utils/cross-platform.js';
|
|
15
|
-
import { EventBus } from '../core/event-bus.js';
|
|
15
|
+
import { EventBus } from '../core/event/event-bus.js';
|
|
16
16
|
import { resolveGlobalPkg } from '../utils/npm-ops.js';
|
|
17
17
|
import { ensureFreshPackageVersionInfo } from '../utils/package-version-info.js';
|
|
18
18
|
import { ecwebVersionRequirementError, resolveEcwebLaunchCommand } from '../ecweb/runtime/launch.js';
|
|
@@ -25,14 +25,14 @@ import { filterLogFiles, deriveLogTypes, computePreChecked, validateLogTypes, sh
|
|
|
25
25
|
import { printCodeStats } from './code-stats.js';
|
|
26
26
|
import { StartupTracer, STARTUP_TRACE_ID_ENV, formatMs, formatSlowestSpans, findTraceRecord } from '../utils/startup-trace.js';
|
|
27
27
|
import { getProcessStartTime, startTimeMatches } from '../utils/process-introspect.js';
|
|
28
|
-
import { matchesEcwebInstanceHealth, parseEcwebInstanceRecord } from '../contracts/ecweb-instance.js';
|
|
28
|
+
import { matchesEcwebInstanceHealth, parseEcwebInstanceRecord } from '../ecweb/contracts/ecweb-instance.js';
|
|
29
29
|
import { AGENT_DELEGATION_TOKEN_ENV, hashCurrentDelegatedCommand, readDelegationCredential } from '../core/auth/agent-delegation.js';
|
|
30
30
|
import { CHANNEL_LOGS_ENV, MAIN_CLI_BIN, RESTART_REQUEST_ID_ENV, RUNTIME_HOME_ENV, TARGET_PACKAGE_ROOT_ENV, WEB_CLI_BIN, WEB_PACKAGE_NAME, } from '../product.js';
|
|
31
31
|
import { createRestartRequest, readRestartRequest, shouldSuppressRealRestart, updateRestartRequest } from '../utils/restart-safety.js';
|
|
32
32
|
import { discoverSystemdService, resumeSystemdRestart, submitSystemdRestart } from '../utils/systemd-lifecycle.js';
|
|
33
33
|
import { rotateStdoutLog } from '../utils/log-writer.js';
|
|
34
34
|
import { logLevelRank } from '../utils/logger.js';
|
|
35
|
-
import { inspectDataMigrationRequirement } from '../core/data-migration.js';
|
|
35
|
+
import { inspectDataMigrationRequirement } from '../core/migration/data-migration.js';
|
|
36
36
|
import { readHostInfo, readVersionInfo } from '../utils/host-info.js';
|
|
37
37
|
import { queryStatusActivity, queryStatusActivityByAgent } from '../stats/query.js';
|
|
38
38
|
import { DAEMON_PROBE_TIMEOUT_MS, DAEMON_SHUTDOWN_TIMEOUT_MS, isRecordedProcessGone, probeDaemon, requestDaemonShutdown } from './daemon-lifecycle-client.js';
|
|
@@ -860,12 +860,13 @@ export async function cmdStart(opts = {}) {
|
|
|
860
860
|
console.log('🔧 调试模式已启用(EVOLCORE_DEBUG_MODE=1)');
|
|
861
861
|
console.log(' 在宿主终端以任意 session 身份执行命令:');
|
|
862
862
|
console.log('');
|
|
863
|
-
console.log(` ec msg send '<消息内容>' --as-session <sessionId>`);
|
|
864
863
|
console.log(' ec trigger list --as-session <sessionId>');
|
|
865
864
|
console.log(' ec memory list --as-session <sessionId>');
|
|
866
865
|
console.log('');
|
|
867
866
|
console.log(' 查看可用会话(运行后将在此处列出):');
|
|
868
|
-
console.log(
|
|
867
|
+
console.log(' ec trigger list --as-session # 不带 sessionId 自动列出');
|
|
868
|
+
console.log('');
|
|
869
|
+
console.log(' 发送消息统一用 ecmsg send(在会话内执行)。');
|
|
869
870
|
console.log('');
|
|
870
871
|
console.log(' 注意:重启 daemon(ec restart)会清除调试模式,');
|
|
871
872
|
console.log(' 需重新执行 ec start --debug 才能恢复。');
|
|
@@ -997,12 +998,13 @@ export async function cmdStart(opts = {}) {
|
|
|
997
998
|
console.log('🔧 调试模式已启用(EVOLCORE_DEBUG_MODE=1)');
|
|
998
999
|
console.log(' 在宿主终端以任意 session 身份执行命令:');
|
|
999
1000
|
console.log('');
|
|
1000
|
-
console.log(` ec msg send '<消息内容>' --as-session <sessionId>`);
|
|
1001
1001
|
console.log(' ec trigger list --as-session <sessionId>');
|
|
1002
1002
|
console.log(' ec memory list --as-session <sessionId>');
|
|
1003
1003
|
console.log('');
|
|
1004
1004
|
console.log(' 查看可用会话(运行后将在此处列出):');
|
|
1005
|
-
console.log(
|
|
1005
|
+
console.log(' ec trigger list --as-session # 不带 sessionId 自动列出');
|
|
1006
|
+
console.log('');
|
|
1007
|
+
console.log(' 发送消息统一用 ecmsg send(在会话内执行)。');
|
|
1006
1008
|
console.log('');
|
|
1007
1009
|
console.log(' 注意:重启 daemon(ec restart)会清除调试模式,');
|
|
1008
1010
|
console.log(' 需重新执行 ec start --debug 才能恢复。');
|
|
@@ -1995,6 +1997,34 @@ function renderStatusSnapshot(snapshot) {
|
|
|
1995
1997
|
}
|
|
1996
1998
|
renderEcwebStatus(snapshot.ecweb);
|
|
1997
1999
|
}
|
|
2000
|
+
export async function cmdPlugins(args) {
|
|
2001
|
+
if (args.includes('--help') || args.includes('-h')) {
|
|
2002
|
+
console.log('ec plugin list [--format json]\nec plugin <show|doctor|enable|disable> <channel|baseagent> <name> [--format json]\nec plugin enable baseagent <name> --force [--format json]\nec plugin enable baseagent dsh [--dsh-mode native-shared] [--dsh-installation <id>] [--dsh-home <path>] [--dsh-profile <path>]\nDSH uses native Home, Profile and session storage; host defaults apply to future Agents. Provider, model and effort can be overridden independently.\n--force retains warnings for unsupported B capabilities. Deployment changes require a host restart.');
|
|
2003
|
+
return;
|
|
2004
|
+
}
|
|
2005
|
+
try {
|
|
2006
|
+
const { parsePluginCommand } = await import('../core/plugin/plugin-lifecycle.js');
|
|
2007
|
+
parsePluginCommand(['plugin', ...args]);
|
|
2008
|
+
const { readDelegationCredential, hashCurrentDelegatedCommand } = await import('../core/auth/agent-delegation.js');
|
|
2009
|
+
const { SESSION_ID_ENV } = await import('../product.js');
|
|
2010
|
+
const sessionId = process.env[SESSION_ID_ENV];
|
|
2011
|
+
const delegationToken = readDelegationCredential();
|
|
2012
|
+
const paths = (await import('../paths.js')).resolvePaths();
|
|
2013
|
+
const controlToken = sessionId || delegationToken ? undefined : fs.readFileSync(paths.controlToken, 'utf8').trim();
|
|
2014
|
+
const { queryDaemon } = await import('./help.js');
|
|
2015
|
+
const result = await queryDaemon(paths.socket, { type: 'plugin.op', argv: ['plugin', ...args],
|
|
2016
|
+
...(sessionId || delegationToken ? { sessionId, delegationToken, delegationCommandHash: hashCurrentDelegatedCommand() } : { controlToken }) });
|
|
2017
|
+
if (!result.response)
|
|
2018
|
+
throw new Error('Daemon unavailable: ' + result.transportError);
|
|
2019
|
+
console.log(JSON.stringify(result.response, null, 2));
|
|
2020
|
+
if (result.response.ok === false)
|
|
2021
|
+
process.exitCode = 1;
|
|
2022
|
+
}
|
|
2023
|
+
catch (error) {
|
|
2024
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
2025
|
+
process.exitCode = 1;
|
|
2026
|
+
}
|
|
2027
|
+
}
|
|
1998
2028
|
export async function cmdStatus(options = {}) {
|
|
1999
2029
|
const snapshot = await collectStatusSnapshot();
|
|
2000
2030
|
if (options.format === 'json')
|