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/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,44 @@
|
|
|
3
3
|
本文件记录 EvolCore 的重要变更。EvolClaw 版本线的历史记录已归档至
|
|
4
4
|
[`docs/_archive/CHANGELOG-evolclaw.md`](docs/_archive/CHANGELOG-evolclaw.md)。
|
|
5
5
|
|
|
6
|
-
##
|
|
6
|
+
## 0.0.51 (2026-11-22)
|
|
7
|
+
|
|
8
|
+
### 基座与上下文
|
|
9
|
+
|
|
10
|
+
- 基座统一由 daemon 插件声明管理,完善安装探测、延迟加载、配置迁移和能力诊断;按必需能力校验接入条件,并按运行环境、模型与验证证据开放选配能力。
|
|
11
|
+
- 新增 DeepSeek Harness(DSH)接入,支持 CLI 与桌面安装发现、原生 Home/Profile 授权、会话绑定与接续、图片输入、推理参数和原生技能;支持完整会话及消息锚点分叉,校验来源与目标绑定并处理失败回滚。
|
|
12
|
+
- 支持按 Agent 配置 Claude、Codex、DSH 的上下文压缩阈值,展示容量来源、有效阈值及历史运行信息;DSH 根据原生上下文压力在输入前触发压缩。
|
|
13
|
+
- 完善 Codex 会话进程隔离、启动超时回收、中断确认、MCP 表单及空表单确认;补齐当前 Agent 附件目录的读取权限。
|
|
14
|
+
- ecagent 支持项目规则、原生技能和消息锚点分叉,完善中断后的工具结果补全;收紧工具授权、Shell 环境和 Linux/Windows 文件隔离,限制只读工具并发与输出长度,禁止执行被截断的工具调用。
|
|
15
|
+
- 移除 /clear;使用 /new 创建新会话并保留旧会话历史。完善会话原生终端入口、运行状态清理及历史读取诊断。
|
|
16
|
+
|
|
17
|
+
### 消息与成果
|
|
18
|
+
|
|
19
|
+
- ecmsg send 根据话题与模式确定接收方,支持当前话题发送、跨话题委托和跨话题自派;废弃 --to,托管发送禁止 --from,完善参数错误提示和返回结果展示。
|
|
20
|
+
- 修正主话题消息归属、远端能力发现缓存和 IPC 流式中文解码;被打断回合补投已生成正文,完善话题摘要更新时机与重复写入控制。
|
|
21
|
+
- 新增 Owner 面板卡片协议,支持结构化内容、HTML 卡片、资源校验、增量及加密详情查询;成果源文件使用项目 .output 分区,卡片入口由 Owner 管理。
|
|
22
|
+
- 完善远端能力调用的设备路由、参数契约和结果筛选;修复下载直链有效期的秒与毫秒转换及不过期展示。
|
|
23
|
+
|
|
24
|
+
### 模板与配置
|
|
25
|
+
|
|
26
|
+
- Agent 模板支持按模块采集、编辑副本和组合封包,提供本地导入、命令行预览、定向分享及模板仓库发行查询、发布和下载;完善凭据检查、进度反馈和中断恢复。
|
|
27
|
+
- 模板安装与升级复用目标主机 Provider 绑定,处理平台和模型不匹配,保留显式选择及未就绪状态;部署后补齐新 Agent 初始化和欢迎消息恢复。
|
|
28
|
+
- 首次设定引导与激活欢迎文案分离,欢迎文案根据名片生成;bootstrapWelcome 更名为 enableWelcome,兼容读取旧配置。
|
|
29
|
+
- Provider 标识与连接地址解耦,完善服务独立配置、导入冲突和修订校验;未命名本地 IP 连接采用基座名称,同名时明确报冲突,保留用户指定名称。
|
|
30
|
+
- 旧 daemon/defaults 插件声明迁移先清理废弃 AUN gatewayUrl,再校验和保存,避免合法升级被旧字段阻断。
|
|
31
|
+
|
|
32
|
+
### 服务与运行
|
|
33
|
+
|
|
34
|
+
- 服务包支持 pack update 和本地调用,完善安装及加载错误、调用参数、沙箱快照与帮助提示;更新时保留运行日志。
|
|
35
|
+
- 完善受管文件、运行锁、Windows 临时目录及工具命令校验;帮助查询和已完成迁移的托管命令避免重复执行启动迁移。
|
|
36
|
+
- 按职责整理内部模块并合并局部辅助逻辑,保留插件加载、独立进程与安全策略边界。
|
|
37
|
+
|
|
38
|
+
### 兼容要求
|
|
39
|
+
|
|
40
|
+
- 需要 Node.js >=22.16.0,依赖 @agentunion/fastaun ^0.5.42,配套 ec-web@0.0.51。
|
|
41
|
+
- 可选 DSH 接入要求 @deepseek-ai/dsh 0.2.2-rc.5 和 Node.js >=24.9,当前声明支持 Linux、Windows;须先授权原生资源及会话绑定。
|
|
42
|
+
- Gemini 仍存在必需能力缺口,严格模式拒绝接入;强制加载不会补足缺失能力。
|
|
43
|
+
- Invoke 尚未完成,不作为本版可用功能验收,相关测试继续排除。
|
|
7
44
|
|
|
8
45
|
## 0.0.50 (2026-11-17)
|
|
9
46
|
|
|
@@ -469,7 +506,7 @@
|
|
|
469
506
|
|
|
470
507
|
### 身份、联系人与配置
|
|
471
508
|
|
|
472
|
-
- Agent 显示名跟随签名名片变化刷新,移除一次性自我介绍注入;新增 bootstrapWelcome
|
|
509
|
+
- Agent 显示名跟随签名名片变化刷新,移除一次性自我介绍注入;新增 bootstrapWelcome(现为 `enableWelcome`)开关,可跳过首次欢迎消息。
|
|
473
510
|
- 名录查询统一为 list/info,移除 find/show 别名;修复名录拉取,区分指定联系人名单与全部联系人授权,防止开放策略扩大准入范围。
|
|
474
511
|
- 将同 Owner 默认角色资格扩展至验签及归属核验通过的内部 Agent,敏感操作前重新核验;拒绝将 Agent 自身声明为其 Owner。
|
|
475
512
|
- Agent、Relation、Role Schema 分别收敛为 v19、v12、v2;兼容的 Agent v20 与 Relation v13 配置启动时备份迁移,自定义 Role v3 需人工调整至 v2;统一 paactive 配置写入并核验私聊关系。
|
package/bin/ec-build.mjs
CHANGED
|
@@ -38,6 +38,66 @@ export async function build() {
|
|
|
38
38
|
process.exitCode = results.some(result => result.status === 'rejected' || result.value !== 0) ? 1 : 0;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
/** Remove generated DSH adapter and runtime modules so renamed files cannot ship. */
|
|
42
|
+
export async function cleanDshRuntimeOutput() {
|
|
43
|
+
const dist = path.resolve(root, 'dist');
|
|
44
|
+
const target = path.resolve(dist, 'agents', 'dsh');
|
|
45
|
+
if (!target.startsWith(dist + path.sep)) throw new Error('Invalid DSH build output path');
|
|
46
|
+
await fs.promises.rm(target, { recursive: true, force: true });
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** tsc leaves old output behind when modules are moved or renamed. */
|
|
50
|
+
export async function cleanMovedCoreModules() {
|
|
51
|
+
for (const name of ['agents', 'core', 'directory']) {
|
|
52
|
+
const source = path.join(root, 'src', name);
|
|
53
|
+
const output = path.join(root, 'dist', name);
|
|
54
|
+
const sources = new Set(await fs.promises.readdir(source));
|
|
55
|
+
for (const entry of await fs.promises.readdir(output, { withFileTypes: true })) {
|
|
56
|
+
if (entry.isFile() && entry.name.endsWith('.js') && !sources.has(entry.name.slice(0, -3) + '.ts')) {
|
|
57
|
+
await fs.promises.unlink(path.join(output, entry.name));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
for (const relative of [
|
|
62
|
+
'core/system-session', 'core/background-session', 'contracts',
|
|
63
|
+
'cli/fs-expiry.js', 'ecweb/dsh-session-view.js', 'stats/codex-context-window.js',
|
|
64
|
+
'outputs/panel-card-trigger-authorization.js', 'core/session/system/grants.js', 'directory/text.js',
|
|
65
|
+
'aun/aid/agentmd-fields.js', 'core/agent/runner-reload-transaction.js', 'core/agent/soul.js',
|
|
66
|
+
'core/baseagent/baseagent-plugin-lazy.js', 'core/migration/legacy-rename.js',
|
|
67
|
+
'core/model/agent-context-policy.js', 'core/ownership/agent-creation-approval.js',
|
|
68
|
+
'core/permission/runtime-lock.js', 'directory/agentmd-sync.js', 'directory/request-operation.js',
|
|
69
|
+
'eck/tool-time-context.js', 'utils/rate-window.js',
|
|
70
|
+
]) {
|
|
71
|
+
const staleOutput = path.resolve(root, 'dist', relative);
|
|
72
|
+
if (!staleOutput.startsWith(path.resolve(root, 'dist') + path.sep)) {
|
|
73
|
+
throw new Error(`Invalid stale build output path: ${relative}`);
|
|
74
|
+
}
|
|
75
|
+
await fs.promises.rm(staleOutput, { recursive: true, force: true });
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Remove outputs left by agent modules whose names changed inside their directories.
|
|
79
|
+
const renamedAgentModules = {
|
|
80
|
+
claude: ['claude-capability-provider.js', 'claude-runner.js', 'claude-session-file-adapter.js'],
|
|
81
|
+
codex: ['codex-capability-provider.js', 'codex-runner.js', 'codex-session-file-adapter.js'],
|
|
82
|
+
ecagent: ['ecagent-runner.js', 'ecagent-session-file-adapter.js'],
|
|
83
|
+
gemini: ['gemini-capability-provider.js', 'gemini-runner.js', 'gemini-session-file-adapter.js'],
|
|
84
|
+
};
|
|
85
|
+
const agentsOutput = path.join(root, 'dist', 'agents');
|
|
86
|
+
for (const [agent, files] of Object.entries(renamedAgentModules)) {
|
|
87
|
+
for (const file of files) await fs.promises.rm(path.join(agentsOutput, agent, file), { force: true });
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** Non-TypeScript assets for DSH installation discovery and runtime documentation. */
|
|
92
|
+
export async function copyDshAssets(distDir = path.join(root, 'dist')) {
|
|
93
|
+
const source = path.join(root, 'src', 'agents', 'dsh');
|
|
94
|
+
const target = path.join(distDir, 'agents', 'dsh');
|
|
95
|
+
await fs.promises.mkdir(path.join(target, 'runtime'), { recursive: true });
|
|
96
|
+
for (const name of ['desktop-locations.ps1', 'runtime/README.md']) {
|
|
97
|
+
await fs.promises.copyFile(path.join(source, name), path.join(target, name));
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
41
101
|
// The marker and embedded values must not contribute to their own content hash.
|
|
42
102
|
const excluded = new Set(['build-identity.json', 'build-identity.json.tmp']);
|
|
43
103
|
const identityBlock = /^\/\/ @evolcore-build-identity:start\r?\n[\s\S]*?^\/\/ @evolcore-build-identity:end[ \t]*(?=\r?$)/m;
|
package/bin/ecmsg.js
CHANGED
|
@@ -41,50 +41,53 @@ const MAIN_CLI_BIN = 'ec';
|
|
|
41
41
|
|
|
42
42
|
const HELP = `用法: ecmsg send '<正文>' [选项]
|
|
43
43
|
ecmsg send '<正文>' --thread <话题id>
|
|
44
|
-
ecmsg send '<正文>' --
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
(省略)
|
|
48
|
-
--thread <话题id>
|
|
49
|
-
--
|
|
50
|
-
--from <本端AID>
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
--
|
|
58
|
-
|
|
44
|
+
ecmsg send '<正文>' --thread <话题id> --selfmode
|
|
45
|
+
|
|
46
|
+
发送目标只有三种(接收方由话题和模式推出,不接受 --to):
|
|
47
|
+
(省略 --thread) 当前话题消息:发给当前会话的对端/群
|
|
48
|
+
--thread <话题id> 跨话题委托:发给该话题的对端
|
|
49
|
+
--thread <话题id> --selfmode 跨话题自派:发给本端自己,落在该话题的会话
|
|
50
|
+
--from <本端AID> 宿主终端(非托管)必填;托管会话禁止使用
|
|
51
|
+
|
|
52
|
+
话题 id:
|
|
53
|
+
thread-… 独立话题,必须已存在于本端索引
|
|
54
|
+
main:<aidA>:<aidB> 主话题(两种顺序等价);首次联系可直接使用
|
|
55
|
+
|
|
56
|
+
注意:
|
|
57
|
+
· --thread 不能是当前话题 id;当前话题消息省略 --thread。
|
|
58
|
+
· 话题的本端必须是当前会话本端。
|
|
59
|
+
· 位置参数只写正文;写在前面的 AID 会被当成正文。
|
|
60
|
+
|
|
61
|
+
复查(仅跨话题委托):
|
|
62
|
+
跨话题委托默认自动建复查 20m;--check-every <时长|none> 自定义或关闭。
|
|
63
|
+
自派不建复查,不能与 --check-every 同用。
|
|
59
64
|
|
|
60
65
|
加密:
|
|
61
|
-
--encrypt yes|no|auto
|
|
62
|
-
跟随该消息的加密状态,否则明文
|
|
63
|
-
只有目标对端在 AUN 网络上才能加密;非 AUN 目标用 yes 会被拒绝。
|
|
66
|
+
--encrypt yes|no|auto 默认 auto;只有目标对端在 AUN 上才能 yes
|
|
64
67
|
|
|
65
68
|
正文来源:
|
|
66
|
-
'<正文>'
|
|
67
|
-
--text-from-file <path>
|
|
68
|
-
--file <path>
|
|
69
|
-
--as widget_card
|
|
70
|
-
--link <url> [--title T]
|
|
71
|
-
--payload '<json>'
|
|
72
|
-
--payload-file <path>
|
|
69
|
+
'<正文>' 位置参数
|
|
70
|
+
--text-from-file <path> 从文件读取
|
|
71
|
+
--file <path> 附件(可配 --as image|video|voice|file|widget_card、--text 说明)
|
|
72
|
+
--as widget_card 上传 HTML 表单并发送 WidgetCard(--title 标题)
|
|
73
|
+
--link <url> [--title T] 链接卡片
|
|
74
|
+
--payload '<json>' 自定义 payload
|
|
75
|
+
--payload-file <path> 从 UTF-8 文件读 payload(仅私聊;文件上限 1 MiB)
|
|
73
76
|
|
|
74
77
|
@提及(仅群聊;私聊带 --mention 会被拒绝):
|
|
75
|
-
--mention '<aid1>,<aid2>'
|
|
76
|
-
--mention-all
|
|
78
|
+
--mention '<aid1>,<aid2>' @指定成员,逗号分隔
|
|
79
|
+
--mention-all @所有人
|
|
77
80
|
|
|
78
81
|
其它:
|
|
79
|
-
--format json
|
|
80
|
-
--help
|
|
82
|
+
--format json 输出 JSON 回执
|
|
83
|
+
--help 显示本帮助
|
|
81
84
|
|
|
82
85
|
示例:
|
|
83
86
|
ecmsg send '收到,稍后回你'
|
|
84
|
-
ecmsg send '
|
|
85
|
-
ecmsg send '
|
|
87
|
+
ecmsg send '进度如何' --thread thread-1793851439746-7477-6351
|
|
88
|
+
ecmsg send '接手这个子任务' --thread thread-1793851439746-7477-6351 --selfmode
|
|
89
|
+
ecmsg send '你好' --thread main:bob.agentid.cn:alice.agentid.cn
|
|
86
90
|
ecmsg send --file ./report.md --as file --text '报告在这里'
|
|
87
|
-
ecmsg send --file ./meeting.html --as widget_card --title '会议安排'
|
|
88
91
|
`;
|
|
89
92
|
|
|
90
93
|
// ── 委托哈希(与 agent-delegation.ts 逐字节一致,改动时两处必须同步) ──
|
|
@@ -293,7 +296,7 @@ async function main() {
|
|
|
293
296
|
|
|
294
297
|
jsonOutput = wantsJsonOutput(argv.slice(1));
|
|
295
298
|
const parsed = gateway.parseGatewayArgs(argv.slice(1));
|
|
296
|
-
if (!parsed.ok) fail(parsed.error, 'INVALID_ARGUMENT');
|
|
299
|
+
if (!parsed.ok) fail(parsed.error, parsed.code ?? 'INVALID_ARGUMENT');
|
|
297
300
|
const { route: routeOpts, passthrough, text } = parsed;
|
|
298
301
|
if (routeOpts.help) { process.stdout.write(HELP); return; }
|
|
299
302
|
jsonOutput = jsonOutput || routeOpts.format === 'json';
|
|
@@ -307,11 +310,15 @@ async function main() {
|
|
|
307
310
|
if (nonManaged && !delegationToken) {
|
|
308
311
|
if (!routeOpts.from || !String(routeOpts.from).trim()) {
|
|
309
312
|
fail('非托管使用需要 --from <本端AID> 指定发送方', 'FROM_REQUIRED',
|
|
310
|
-
{ hint:
|
|
313
|
+
{ hint: "ecmsg send '<正文>' --from <本端AID> --thread <话题id> --selfmode(宿主终端只支持跨话题自派)" });
|
|
311
314
|
}
|
|
312
315
|
if (!routeOpts.thread || !String(routeOpts.thread).trim()) {
|
|
313
316
|
fail('非托管使用需要 --thread <话题id> 定位会话', 'THREAD_REQUIRED',
|
|
314
|
-
{ hint: "ecmsg send '<正文>' --from <本端AID> --thread <话题id> --
|
|
317
|
+
{ hint: "ecmsg send '<正文>' --from <本端AID> --thread <话题id> --selfmode(宿主终端只支持跨话题自派)" });
|
|
318
|
+
}
|
|
319
|
+
if (!routeOpts.selfMode) {
|
|
320
|
+
fail('宿主终端只支持跨话题自派:请加 --selfmode', 'SELFMODE_REQUIRED',
|
|
321
|
+
{ hint: "ecmsg send '<正文>' --from <本端AID> --thread <话题id> --selfmode" });
|
|
315
322
|
}
|
|
316
323
|
if (passthrough.length > 0) {
|
|
317
324
|
fail(`非托管发送目前只支持纯文本,不支持的选项:${passthrough.join(' ')}`, 'UNSUPPORTED_OPTION');
|
|
@@ -369,36 +376,14 @@ async function main() {
|
|
|
369
376
|
return;
|
|
370
377
|
}
|
|
371
378
|
|
|
372
|
-
// 话题索引:--thread
|
|
373
|
-
// 其余情况零 IO。
|
|
379
|
+
// 话题索引:--thread 是独立话题时才真读盘,其余情况零 IO。
|
|
374
380
|
const deps = {};
|
|
375
381
|
|
|
376
382
|
// 本端 AID:托管取运行时,非托管取 `--from`。
|
|
377
383
|
const selfAid = nonManaged ? String(routeOpts.from).trim().replace(/^@/, '') : runtime.selfAid;
|
|
378
384
|
|
|
379
|
-
// 群 AID 归一:`g-18127` 这类裸 base 必须在判定目标之前展开成完整 AID,
|
|
380
|
-
// 否则既判不出它是群,也拼不出主话题。展开逻辑见 `ecmsg-gateway.ts` 的
|
|
381
|
-
// `expandGroupBase`(纯函数,有单测)。
|
|
382
|
-
let groupIdentity;
|
|
383
|
-
const resolveGroupId = async id => {
|
|
384
|
-
groupIdentity ??= await loadDist('aun/group/identity.js');
|
|
385
|
-
return gateway.expandGroupBase(selfAid, id, groupIdentity?.normalizeGroupAid);
|
|
386
|
-
};
|
|
387
|
-
|
|
388
|
-
// --to 的目标类型:下游按它选 msg send / group send,必须解析而不是沿用
|
|
389
|
-
// 当前会话的类型——否则"在私聊会话里给群发"会走成私聊,"在群会话里给个人发"
|
|
390
|
-
// 会走成群消息。
|
|
391
|
-
//
|
|
392
|
-
// 群 AID 的 base 简写(`g-18127`)必须先展开成完整 AID,再做类型判定与路由:
|
|
393
|
-
// 否则它既不像群也拼不出主话题,`--to g-18127` 会直接 TOPIC_REQUIRED。
|
|
394
|
-
if (routeOpts.to !== undefined && String(routeOpts.to).trim()) {
|
|
395
|
-
// 归一后写回 routeOpts:下游 argv 与回执都必须用展开后的完整 AID。
|
|
396
|
-
routeOpts.to = await resolveGroupId(String(routeOpts.to).trim());
|
|
397
|
-
const peerKind = await resolveTargetPeerKind(runtime, routeOpts.to, selfAid);
|
|
398
|
-
deps.resolveTarget = id => ({ channelType: runtime?.channel ?? 'aun', peerKind, id });
|
|
399
|
-
}
|
|
400
385
|
// `--thread main:<a>:<b>` 的对端类型:主话题 id 里只有两个 AID,群的主话题同样写成
|
|
401
|
-
// main:<self>:<群AID
|
|
386
|
+
// main:<self>:<群AID>。类型按关系证据解析,再同步注入给纯函数;
|
|
402
387
|
// 否则网关会把群主话题当私聊,下游走 msg scope 被判 TOPIC_NOT_FOUND。
|
|
403
388
|
if (typeof routeOpts.thread === 'string' && routeOpts.thread.trim()) {
|
|
404
389
|
const topicIds = await loadDist('core/thread/topic-id.js');
|
|
@@ -411,8 +396,7 @@ async function main() {
|
|
|
411
396
|
deps.resolvePeerKind = () => mainPeerKind;
|
|
412
397
|
}
|
|
413
398
|
}
|
|
414
|
-
const needsThreadModule = gateway.needsThreadIndexLookup(routeOpts.thread)
|
|
415
|
-
|| routeOpts.to !== undefined;
|
|
399
|
+
const needsThreadModule = gateway.needsThreadIndexLookup(routeOpts.thread);
|
|
416
400
|
// 话题条目:非托管下它就是「当前会话」的全部来源(对端 / chatType / channelType)。
|
|
417
401
|
let threadEntry;
|
|
418
402
|
if (needsThreadModule) {
|
|
@@ -477,13 +461,16 @@ async function main() {
|
|
|
477
461
|
|
|
478
462
|
// 非托管:没有会话上下文,本端来自 --from,对端/类型来自话题索引条目。
|
|
479
463
|
// chatType 按条目判(群话题 = group),peerId 用条目里的对端。
|
|
464
|
+
//
|
|
465
|
+
// threadId 恒为 undefined:宿主没有「当前会话」,`--thread` 是投递目标而不是
|
|
466
|
+
// 来源话题。若把它同时当成当前话题,自派会必然被判成 TOPIC_IS_CURRENT。
|
|
480
467
|
const sessionContext = nonManaged
|
|
481
468
|
? {
|
|
482
469
|
selfAid,
|
|
483
470
|
channelType: threadEntry?.channelType ?? 'aun',
|
|
484
471
|
chatType: threadEntry?.peerKind === 'group' ? 'group' : 'private',
|
|
485
472
|
peerId: threadEntry?.peer ?? '',
|
|
486
|
-
threadId:
|
|
473
|
+
threadId: undefined,
|
|
487
474
|
}
|
|
488
475
|
: {
|
|
489
476
|
selfAid: runtime.selfAid,
|
|
@@ -496,7 +483,7 @@ async function main() {
|
|
|
496
483
|
const outcome = routing.resolveSendRoute(
|
|
497
484
|
{
|
|
498
485
|
thread: routeOpts.thread,
|
|
499
|
-
|
|
486
|
+
selfMode: routeOpts.selfMode === true,
|
|
500
487
|
from: routeOpts.from,
|
|
501
488
|
checkEvery: routeOpts.checkEvery,
|
|
502
489
|
encrypt: routeOpts.encrypt,
|
|
@@ -601,6 +588,14 @@ function renderReceipt(route, result, routing, gateway) {
|
|
|
601
588
|
// 它随消息类型在 sent/delivered/accepted 之间变化,不适合当判据。
|
|
602
589
|
status: 'accepted',
|
|
603
590
|
...(result.status !== undefined ? { aun_status: result.status } : {}),
|
|
591
|
+
// `--return required`:daemon 已登记请求并等到了对端应答。漏掉这几个字段,
|
|
592
|
+
// 调用方只看到「已发送」,对端的结果在注册表里落盘了却永远拿不到。
|
|
593
|
+
...(result.request_id ? {
|
|
594
|
+
request_id: result.request_id,
|
|
595
|
+
request_state: result.request_state,
|
|
596
|
+
...(result.response !== undefined ? { response: result.response } : {}),
|
|
597
|
+
...(result.responses !== undefined ? { responses: result.responses } : {}),
|
|
598
|
+
} : {}),
|
|
604
599
|
...(selfAddressed || result.self_session_id !== undefined || result.self_delivery_error !== undefined ? {
|
|
605
600
|
self_session_id: result.self_session_id,
|
|
606
601
|
self_delivery_error: result.self_delivery_error,
|
|
@@ -614,6 +609,9 @@ function renderReceipt(route, result, routing, gateway) {
|
|
|
614
609
|
`✓ 已发送 ${routeLine} message_id=${result.message_id ?? '-'}`
|
|
615
610
|
+ ` request_id=${result.request_id} state=${result.request_state ?? '-'}\n`,
|
|
616
611
|
);
|
|
612
|
+
// 应答正文是这次调用的结果,不打印等于白等。
|
|
613
|
+
if (result.response !== undefined) process.stdout.write(`${JSON.stringify(result.response, null, 2)}\n`);
|
|
614
|
+
else if (result.responses !== undefined) process.stdout.write(`${JSON.stringify(result.responses, null, 2)}\n`);
|
|
617
615
|
return;
|
|
618
616
|
}
|
|
619
617
|
|
|
@@ -641,6 +639,10 @@ function renderReceipt(route, result, routing, gateway) {
|
|
|
641
639
|
|
|
642
640
|
if (route.firstContact) {
|
|
643
641
|
process.stdout.write('· 首次联系:目标会话随本条建立,本次不建复查\n');
|
|
642
|
+
} else if (route.crossTopic && route.checkEveryMs === undefined) {
|
|
643
|
+
// `--check-every none`:显式不建复查。checkEveryMs 为 undefined 时不再走默认周期,
|
|
644
|
+
// 回执照旧输出「已建复查」会误导(trigger_id 也是空的)。
|
|
645
|
+
process.stdout.write('· 跨话题,按 --check-every none 未建复查\n');
|
|
644
646
|
} else if (route.crossTopic) {
|
|
645
647
|
const duration = gateway.formatDuration(route.checkEveryMs);
|
|
646
648
|
const label = route.checkEveryDefaulted ? `默认 ${duration}` : duration;
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
export const REMOTE_CLI_VERSION = 'evolcore.ability-remote-cli/v1';
|
|
2
|
+
export const REMOTE_MIN_OUTPUT_BYTES = 256;
|
|
3
|
+
export const REMOTE_DEFAULT_INSPECTION_BYTES = 8192;
|
|
2
4
|
export const REMOTE_COMMANDS = {
|
|
3
|
-
list: { description: '
|
|
4
|
-
discover: { description: '按需在线发现并收集设备能力', positional: 1, options: ['path', 'window', 'full'] },
|
|
5
|
-
info: { description: '
|
|
5
|
+
list: { description: '读取完整能力目录,按需附指南或设备', positional: 1, options: ['path', 'search', 'full', 'refresh', 'usage', 'discovery', 'devices'] },
|
|
6
|
+
discover: { description: '按需在线发现并收集设备能力', positional: 1, options: ['path', 'window', 'full', 'device-id', 'credential-file'] },
|
|
7
|
+
info: { description: '读取或提取所选能力的契约字段', positional: 2, options: ['discovery', 'definition-id', 'usage', 'refresh', 'full', 'action', 'schema', 'select', 'jq'] },
|
|
6
8
|
devices: { description: '从发现快照筛选匹配能力的设备', positional: 1, options: ['path', 'discovery'] },
|
|
7
|
-
call: { description: '校验、预览或加密定向调用远端能力', positional: 2, options: ['discovery', 'definition-id', 'device-id', 'params', 'params-file', 'timeout', 'ttl', 'operation-id', 'dry-run', 'plan'] },
|
|
9
|
+
call: { description: '校验、预览或加密定向调用远端能力', positional: 2, options: ['discovery', 'definition-id', 'device-id', 'credential-file', 'params', 'params-file', 'timeout', 'ttl', 'operation-id', 'dry-run', 'plan'] },
|
|
8
10
|
result: { description: '查询并校验原请求结果,不重新发送', positional: 1, options: ['wait'] },
|
|
9
11
|
};
|
|
10
12
|
export function remoteUsage(action) {
|
|
11
13
|
const signature = action === 'result' ? '<request-id> [--wait 30s]'
|
|
12
14
|
: action === 'call' ? '<ProviderAID> <path> [--params \'<JSON对象>\'] [选项] | ec ability remote call --plan <plan-id>'
|
|
13
|
-
: action === 'info' ? '<ProviderAID> <path> [--
|
|
15
|
+
: action === 'info' ? '<ProviderAID> <path> [--action <action>] [--schema params|result|both] [--select <jsonpath> | --jq <expr>] [选项]'
|
|
14
16
|
: action === 'devices' ? '<ProviderAID> <path> --discovery <id>'
|
|
15
17
|
: '<ProviderAID> [path] [选项]';
|
|
16
18
|
return `ec ability remote ${action} ${signature}`;
|
|
@@ -64,8 +66,8 @@ function parseRemoteArguments(argv) {
|
|
|
64
66
|
continue;
|
|
65
67
|
}
|
|
66
68
|
const key = arg.slice(2);
|
|
67
|
-
remoteAssert(arg.startsWith('--') && (
|
|
68
|
-
if (['refresh', 'usage', 'dry-run', 'full'].includes(key))
|
|
69
|
+
remoteAssert(arg.startsWith('--') && (['format', 'max-bytes'].includes(key) || descriptor.options.includes(key)) && !Object.hasOwn(options, key), 'ARGUMENT_INVALID', `Unknown or duplicate option: ${arg}`);
|
|
70
|
+
if (['refresh', 'usage', 'dry-run', 'full', 'devices'].includes(key))
|
|
69
71
|
options[key] = 'true';
|
|
70
72
|
else {
|
|
71
73
|
remoteAssert(!!argv[i + 1] && !argv[i + 1].startsWith('--'), 'ARGUMENT_INVALID', `Missing value: ${arg}`);
|
|
@@ -73,8 +75,14 @@ function parseRemoteArguments(argv) {
|
|
|
73
75
|
}
|
|
74
76
|
}
|
|
75
77
|
remoteAssert(!options.format || options.format === 'json', 'ARGUMENT_INVALID', 'Only --format json is supported');
|
|
78
|
+
if (options['max-bytes'])
|
|
79
|
+
remoteAssert(/^\d+$/.test(options['max-bytes']) && Number.isSafeInteger(Number(options['max-bytes']))
|
|
80
|
+
&& Number(options['max-bytes']) >= REMOTE_MIN_OUTPUT_BYTES, 'ARGUMENT_INVALID', `--max-bytes must be an integer of at least ${REMOTE_MIN_OUTPUT_BYTES}`);
|
|
81
|
+
remoteAssert(!(options.select && options.jq), 'ARGUMENT_INVALID', '--select and --jq are mutually exclusive');
|
|
82
|
+
if (options.schema)
|
|
83
|
+
remoteAssert(['params', 'result', 'both'].includes(options.schema), 'ARGUMENT_INVALID', '--schema must be params, result or both');
|
|
76
84
|
if (action === 'call' && options.plan) {
|
|
77
|
-
remoteAssert(positional.length === 0 && Object.keys(options).every(key => ['plan', 'format'].includes(key)), 'ARGUMENT_INVALID', '--plan cannot be combined with call parameters');
|
|
85
|
+
remoteAssert(positional.length === 0 && Object.keys(options).every(key => ['plan', 'format', 'max-bytes', 'credential-file'].includes(key)), 'ARGUMENT_INVALID', '--plan cannot be combined with call parameters');
|
|
78
86
|
return { action, options };
|
|
79
87
|
}
|
|
80
88
|
const optionalPath = ['list', 'discover', 'devices'].includes(action);
|
|
@@ -99,10 +107,6 @@ function parseRemoteArguments(argv) {
|
|
|
99
107
|
remoteAssert(/^[A-Za-z0-9_.:-]{1,256}$/.test(options['operation-id']), 'ARGUMENT_INVALID', 'Invalid operation ID');
|
|
100
108
|
if (options.window)
|
|
101
109
|
durationSeconds(options.window, 30);
|
|
102
|
-
for (const [key, maximum] of [['page', 1000000], ['limit', 100]]) {
|
|
103
|
-
if (options[key])
|
|
104
|
-
remoteAssert(/^[1-9][0-9]*$/.test(options[key]) && Number(options[key]) <= maximum, 'ARGUMENT_INVALID', `--${key} must be an integer from 1 to ${maximum}`, { usage: remoteUsage(action) });
|
|
105
|
-
}
|
|
106
110
|
if (options.search)
|
|
107
111
|
remoteAssert(options.search.length <= 256, 'ARGUMENT_INVALID', '--search must be at most 256 characters');
|
|
108
112
|
remoteAssert(!(options.refresh && options.discovery), 'ARGUMENT_INVALID', '--refresh cannot be combined with a fixed --discovery snapshot');
|
|
@@ -126,7 +130,8 @@ export function remoteCommandSchema(action) {
|
|
|
126
130
|
const path = { type: 'string', maxLength: 256, pattern: '^[a-z][a-z0-9_-]*(/[a-z][a-z0-9_-]*)+$' };
|
|
127
131
|
const fields = {
|
|
128
132
|
path, refresh: { type: 'boolean' }, usage: { type: 'boolean' }, full: { type: 'boolean' }, 'dry-run': { type: 'boolean' },
|
|
129
|
-
|
|
133
|
+
devices: { type: 'boolean' }, action: string, schema: { enum: ['params', 'result', 'both'] }, select: string, jq: string,
|
|
134
|
+
search: { type: 'string', minLength: 1, maxLength: 256 }, 'credential-file': string,
|
|
130
135
|
discovery: string, 'definition-id': { type: 'string', pattern: '^[a-z0-9][a-z0-9_-]{0,63}$' },
|
|
131
136
|
'device-id': { type: 'string', minLength: 1, maxLength: 256, pattern: '^[^\\s\\u0000-\\u001f\\u007f]+$' },
|
|
132
137
|
params: { type: 'object', description: 'Decoded --params JSON; exact business Schema comes from remote info.' },
|
|
@@ -138,6 +143,7 @@ export function remoteCommandSchema(action) {
|
|
|
138
143
|
};
|
|
139
144
|
const properties = Object.fromEntries(descriptor.options.filter(key => key !== 'plan').map(key => [key, fields[key]]));
|
|
140
145
|
properties.format = { const: 'json' };
|
|
146
|
+
properties['max-bytes'] = { type: 'integer', minimum: REMOTE_MIN_OUTPUT_BYTES, maximum: Number.MAX_SAFE_INTEGER };
|
|
141
147
|
const required = [];
|
|
142
148
|
if (action === 'result') {
|
|
143
149
|
properties.requestId = { ...string, pattern: '^[A-Za-z0-9_.:-]{1,256}$' };
|
|
@@ -154,9 +160,12 @@ export function remoteCommandSchema(action) {
|
|
|
154
160
|
required.push('path', 'discovery');
|
|
155
161
|
}
|
|
156
162
|
const normal = { type: 'object', additionalProperties: false, properties, required,
|
|
157
|
-
...(action === '
|
|
163
|
+
...(action === 'info' ? { not: { required: ['select', 'jq'] } } : {}),
|
|
164
|
+
...(['call', 'discover'].includes(action) ? { allOf: [
|
|
165
|
+
...(action === 'call' ? [{ not: { required: ['params', 'params-file'] } }] : []),
|
|
166
|
+
] } : {}) };
|
|
158
167
|
const input = action === 'call' ? { oneOf: [normal, { type: 'object', additionalProperties: false,
|
|
159
|
-
properties: { plan: string, format: { const: 'json' } }, required: ['plan'] }] } : normal;
|
|
168
|
+
properties: { plan: string, format: { const: 'json' }, 'max-bytes': properties['max-bytes'], 'credential-file': fields['credential-file'] }, required: ['plan'] }] } : normal;
|
|
160
169
|
return { schemaVersion: REMOTE_CLI_VERSION, operation: `remote.${action}`, command: REMOTE_COMMANDS[action],
|
|
161
170
|
input: { $schema: 'http://json-schema.org/draft-07/schema#', description: 'Semantic CLI arguments, not an IPC body or --file input. Boolean options represent flags; params is decoded JSON. Duration limits and device/contract constraints are also checked at execution.', ...input },
|
|
162
171
|
params: { type: 'object', description: 'Business params; the exact Schema is returned by remote info. --params and --params-file are mutually exclusive.' },
|
|
@@ -40,10 +40,10 @@ export function parseCapability(value, provider, devices) {
|
|
|
40
40
|
export function parseRemoteIndex(value, provider) {
|
|
41
41
|
boundedJson(value);
|
|
42
42
|
remoteAssert(isJsonObject(value), 'CONTRACT_INVALID', 'Expected an Ability directory object');
|
|
43
|
-
// The
|
|
44
|
-
//
|
|
45
|
-
//
|
|
46
|
-
|
|
43
|
+
// The envelope version is the Provider's metadata, not a gate. Discovery
|
|
44
|
+
// reads the stable fields structurally and reports the version upward;
|
|
45
|
+
// rejecting a directory over a version string would hide capabilities that
|
|
46
|
+
// do exist. Identity is the one thing checked here.
|
|
47
47
|
remoteAssert(value.publisher === provider, 'CONTRACT_INVALID', 'Directory publisher does not match the requested AID');
|
|
48
48
|
remoteAssert(Array.isArray(value.capabilities), 'CONTRACT_INVALID', 'Directory capabilities must be an array');
|
|
49
49
|
if (value.catalog_revision !== undefined)
|
|
@@ -52,28 +52,40 @@ export function parseRemoteIndex(value, provider) {
|
|
|
52
52
|
remoteAssert(typeof value.compatibility_schema === 'string' && value.compatibility_schema.length > 0 && value.compatibility_schema.length <= 128, 'CONTRACT_INVALID', 'Invalid directory compatibility_schema');
|
|
53
53
|
if (value.skill_ref !== undefined)
|
|
54
54
|
sameProviderPath(value.skill_ref, provider);
|
|
55
|
-
return { ...value, schema: value.schema, publisher: provider, capabilities: value.capabilities.map(row => parseCapability(row, provider)),
|
|
55
|
+
return { ...value, schema: typeof value.schema === 'string' ? value.schema : undefined, publisher: provider, capabilities: value.capabilities.map(row => parseCapability(row, provider)),
|
|
56
56
|
...(value.skill_ref ? { skill_ref: String(value.skill_ref) } : {}) };
|
|
57
57
|
}
|
|
58
|
+
export function validateAuthorization(value) {
|
|
59
|
+
remoteAssert(isJsonObject(value), 'CONTRACT_INVALID', 'Expected an authorization declaration');
|
|
60
|
+
remoteAssert(['bootstrap', 'credential_required'].includes(String(value.mode)), 'PROFILE_UNSUPPORTED', 'Unsupported authorization mode');
|
|
61
|
+
remoteAssert(value.encrypted === true && value.credential_location === 'payload.credential', 'PROFILE_UNSUPPORTED', 'Unsupported credential transport profile');
|
|
62
|
+
assertAbilityPath(String(value.application_path ?? ''));
|
|
63
|
+
remoteAssert(typeof value.application_definition_id === 'string' && /^[a-z0-9][a-z0-9_-]{0,63}$/.test(value.application_definition_id), 'CONTRACT_INVALID', 'Invalid authorization application_definition_id');
|
|
64
|
+
}
|
|
58
65
|
export function parseRemoteContract(raw, row, otherRows = []) {
|
|
59
66
|
boundedJson(raw);
|
|
60
67
|
let contract;
|
|
61
68
|
try {
|
|
62
69
|
const expected = { path: row.path, definitionId: row.definition_id };
|
|
63
70
|
if (isJsonObject(raw) && (Object.hasOwn(raw, 'definition') || typeof raw.schema === 'string' && raw.schema.startsWith('aun.ability.release.'))) {
|
|
64
|
-
const release = parseAbilityRelease(raw, expected);
|
|
71
|
+
const release = parseAbilityRelease(raw, expected, 'lenient');
|
|
72
|
+
if (release.authorization)
|
|
73
|
+
validateAuthorization(release.authorization);
|
|
65
74
|
remoteAssert(release.release_id === row.release_id && (row.plugin_version === undefined || release.plugin_version === row.plugin_version), 'CONTRACT_CHANGED', 'Referenced release does not match the directory; refresh discovery');
|
|
66
|
-
contract = { definition: release.definition, usage: release.usage,
|
|
75
|
+
contract = { definition: release.definition, usage: release.usage, authorization: release.authorization,
|
|
67
76
|
release: { schema: release.schema, release_id: release.release_id, plugin_version: release.plugin_version } };
|
|
68
77
|
}
|
|
69
78
|
else
|
|
70
|
-
contract = { definition: parseAbilityDefinition(raw, expected) };
|
|
79
|
+
contract = { definition: parseAbilityDefinition(raw, expected, 'lenient') };
|
|
71
80
|
}
|
|
72
81
|
catch (error) {
|
|
73
82
|
if (error instanceof RemoteError)
|
|
74
83
|
throw error;
|
|
75
84
|
const code = error.code;
|
|
76
|
-
|
|
85
|
+
// Keep the offending schema field on the wrapped error: without it the
|
|
86
|
+
// caller only learns that *some* keyword was unsupported.
|
|
87
|
+
const field = error instanceof AbilityProtocolError ? error.path : undefined;
|
|
88
|
+
throw new RemoteError(code === 'contract_changed' ? 'CONTRACT_CHANGED' : 'PROFILE_UNSUPPORTED', error instanceof Error ? error.message : 'Unsupported contract', field ? { field } : undefined);
|
|
77
89
|
}
|
|
78
90
|
const { definition } = contract;
|
|
79
91
|
for (const candidate of [row, ...otherRows]) {
|
|
@@ -81,6 +93,9 @@ export function parseRemoteContract(raw, row, otherRows = []) {
|
|
|
81
93
|
if (contract.release)
|
|
82
94
|
remoteAssert(candidate.release_id === contract.release.release_id
|
|
83
95
|
&& (candidate.plugin_version === undefined || candidate.plugin_version === contract.release.plugin_version), 'CONTRACT_CHANGED', 'Discovery and release disagree');
|
|
96
|
+
if (candidate.authorization !== undefined && !isDeepStrictEqual(candidate.authorization, contract.authorization)) {
|
|
97
|
+
throw new RemoteError('CONTRACT_CHANGED', 'Discovery and release disagree on authorization');
|
|
98
|
+
}
|
|
84
99
|
for (const key of ['effects', 'auth_required', 'require_confirm', 'idempotency', 'allowed_modes', 'aggregation', 'dedupe_retention_seconds']) {
|
|
85
100
|
if (Object.hasOwn(candidate, key))
|
|
86
101
|
remoteAssert(isDeepStrictEqual(candidate[key], definition[key]), 'CONTRACT_CHANGED', `Discovery and definition disagree on ${key}`);
|