evolcore 0.0.50 → 0.0.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +39 -2
- package/bin/ec-build.mjs +60 -0
- package/bin/ecmsg.js +65 -63
- package/dist/ability/caller/command.js +24 -15
- package/dist/ability/caller/contract.js +24 -9
- package/dist/ability/caller/credential-files.js +132 -0
- package/dist/ability/caller/daemon.js +32 -7
- package/dist/ability/caller/schema-view.js +157 -0
- package/dist/ability/caller/service.js +202 -63
- package/dist/ability/interop-v1.js +156 -113
- package/dist/agent-template/jobs.js +14 -110
- package/dist/agent-template/runtime.js +331 -193
- package/dist/agent-template/service.js +1029 -1104
- package/dist/agent-template/share.js +103 -0
- package/dist/agent-template/tool-runner.js +25 -0
- package/dist/agent-template/types.js +10 -3
- package/dist/agents/claude/availability.js +94 -0
- package/dist/agents/claude/capability-provider.js +154 -0
- package/dist/agents/claude/index.js +145 -0
- package/dist/agents/{claude-runner.js → claude/runner.js} +74 -158
- package/dist/agents/claude/session-file-adapter.js +246 -0
- package/dist/agents/codex/app-server-client.js +90 -10
- package/dist/agents/codex/availability.js +164 -0
- package/dist/agents/codex/capability-provider.js +138 -0
- package/dist/agents/codex/cli.js +38 -0
- package/dist/agents/codex/index.js +345 -0
- package/dist/agents/codex/mcp-elicitation.js +135 -0
- package/dist/agents/{codex-runner.js → codex/runner.js} +648 -382
- package/dist/agents/codex/session-file-adapter.js +834 -0
- package/dist/agents/dsh/availability.js +28 -0
- package/dist/agents/dsh/capability-provider.js +56 -0
- package/dist/agents/dsh/desktop-locations.ps1 +66 -0
- package/dist/agents/dsh/desktop-probe.cjs +37 -0
- package/dist/agents/dsh/index.js +98 -0
- package/dist/agents/dsh/installation.js +400 -0
- package/dist/agents/dsh/resources.js +755 -0
- package/dist/agents/dsh/runner.js +1183 -0
- package/dist/agents/dsh/runtime/README.md +243 -0
- package/dist/agents/dsh/runtime/authorization.js +23 -0
- package/dist/agents/dsh/runtime/bridge.js +837 -0
- package/dist/agents/dsh/runtime/config.js +271 -0
- package/dist/agents/dsh/runtime/entry.js +229 -0
- package/dist/agents/dsh/runtime/session-inspector.js +340 -0
- package/dist/agents/dsh/runtime/tool-policy.js +49 -0
- package/dist/agents/dsh/session-file-adapter.js +145 -0
- package/dist/agents/ecagent/index.js +215 -0
- package/dist/agents/{ecagent-runner.js → ecagent/runner.js} +592 -106
- package/dist/agents/ecagent/session-file-adapter.js +134 -0
- package/dist/agents/gemini/index.js +55 -10
- package/dist/agents/gemini/{gemini-runner.js → runner.js} +4 -9
- package/dist/aun/ability-device-routing.js +11 -17
- package/dist/aun/aid/agentmd.js +27 -1
- package/dist/aun/aid/managed-operation.js +6 -4
- package/dist/aun/group/invite-service.js +1 -1
- package/dist/aun/menu/client.js +1 -1
- package/dist/aun/msg/history.js +1 -1
- package/dist/aun/msg/managed-operation.js +93 -21
- package/dist/aun/msg/p2p.js +6 -6
- package/dist/aun/service-proxy.js +1 -1
- package/dist/aun/storage/index.js +242 -0
- package/dist/build-identity.json +1 -1
- package/dist/channels/aun.js +180 -43
- package/dist/channels/daemon.js +3 -2
- package/dist/channels/dingtalk.js +1 -1
- package/dist/channels/feishu.js +9 -9
- package/dist/channels/qqbot.js +1 -1
- package/dist/channels/wechat.js +2 -2
- package/dist/channels/wecom.js +1 -1
- package/dist/{agents/claude-gateway → claude-gateway}/agent-registration.js +13 -13
- package/dist/{agents/claude-gateway → claude-gateway}/binding.js +3 -3
- package/dist/{agents/claude-gateway → claude-gateway}/inbox.js +1 -1
- package/dist/{agents/claude-gateway → claude-gateway}/index.js +2 -2
- package/dist/{agents/claude-gateway → claude-gateway}/listing.js +3 -3
- package/dist/{agents/claude-gateway → claude-gateway}/router.js +4 -4
- package/dist/{agents/claude-gateway → claude-gateway}/sessions.js +2 -2
- package/dist/{agents/claude-gateway → claude-gateway}/terminal.js +1 -1
- package/dist/{agents/claude-gateway → claude-gateway}/transcript.js +1 -1
- package/dist/cli/ability-command.js +8 -5
- package/dist/cli/ability-output.js +182 -0
- package/dist/cli/agent-command.js +1 -1
- package/dist/cli/agent-create.js +123 -42
- package/dist/cli/agent-template.js +400 -29
- package/dist/cli/agent.js +14 -11
- package/dist/cli/aun-commands.js +167 -111
- package/dist/cli/daemon-commands.js +38 -8
- package/dist/cli/data-command.js +1 -1
- package/dist/cli/debug-mode.js +9 -0
- package/dist/cli/directory.js +1 -2
- package/dist/cli/ecmsg-gateway.js +55 -19
- package/dist/cli/fs-command.js +67 -39
- package/dist/cli/index.js +25 -11
- package/dist/cli/init.js +124 -29
- package/dist/cli/managed-command-guard.js +2 -0
- package/dist/cli/model.js +1 -1
- package/dist/cli/restart-monitor.js +2 -2
- package/dist/cli/services-command.js +24 -1
- package/dist/cli/skill-command.js +4 -4
- package/dist/cli/task-context.js +24 -14
- package/dist/cli/team-workspace-command.js +50 -52
- package/dist/cli/thread-command.js +3 -2
- package/dist/cli/trigger-command.js +47 -12
- package/dist/cli/watch-logs.js +2 -1
- package/dist/config/boot-log.js +3 -0
- package/dist/config/builtin-role-templates.js +1 -1
- package/dist/config/config-field-policy.js +10 -6
- package/dist/config/config-manager.js +33 -12
- package/dist/config/gateway-config.js +21 -37
- package/dist/config/invoke-ipc-service.js +1 -1
- package/dist/config/owner-config.js +5 -3
- package/dist/config/peer-book-store.js +2 -3
- package/dist/config/peer-book.js +2 -2
- package/dist/config/peer-role-resolver.js +2 -2
- package/dist/config/provider-identity-migration.js +24 -105
- package/dist/config/provider-ipc-service.js +13 -3
- package/dist/config/provider-local-sync.js +4 -1
- package/dist/config/provider-menu-request.js +21 -3
- package/dist/config/provider-templates.js +1 -1
- package/dist/config/providers-config.js +39 -15
- package/dist/config/providers-import.js +3 -3
- package/dist/config/providers-management.js +74 -99
- package/dist/config/schema-migration.js +177 -11
- package/dist/config/schema-registry.js +1 -1
- package/dist/config-store.js +38 -50
- package/dist/core/{agent-application-service.js → agent/agent-application-service.js} +9 -9
- package/dist/core/{agent-create-status.js → agent/agent-create-status.js} +112 -4
- package/dist/core/{agent-creation-claim.js → agent/agent-creation-claim.js} +3 -3
- package/dist/core/{agent-ipc-registration.js → agent/agent-ipc-registration.js} +102 -25
- package/dist/core/{agent-reload-coordinator.js → agent/agent-reload-coordinator.js} +61 -1
- package/dist/core/{agent-runtime.js → agent/agent-runtime.js} +53 -27
- package/dist/core/{evolagent-registry.js → agent/evolagent-registry.js} +12 -12
- package/dist/core/{evolagent.js → agent/evolagent.js} +11 -11
- package/dist/core/auth/agent-delegation.js +1 -8
- package/dist/core/auth/delegation-authorization.js +28 -0
- package/dist/core/auth/operation-authorizer.js +7 -4
- package/dist/core/auth/operation-catalog.js +34 -5
- package/dist/core/baseagent/baseagent-availability.js +197 -0
- package/dist/core/baseagent/baseagent-capability-adapter.js +288 -0
- package/dist/core/baseagent/baseagent-config-shared.js +56 -0
- package/dist/core/baseagent/baseagent-identity.js +68 -0
- package/dist/core/{baseagent-loader.js → baseagent/baseagent-loader.js} +62 -6
- package/dist/core/baseagent/baseagent-model-defaults.js +26 -0
- package/dist/{agents → core/baseagent}/baseagent-plugin-descriptor.js +107 -24
- package/dist/core/baseagent/baseagent-plugin-loader.js +367 -0
- package/dist/core/baseagent/baseagent.js +157 -0
- package/dist/{agents → core/baseagent}/runner-types.js +36 -4
- package/dist/core/capability/capability-manager.js +79 -30
- package/dist/core/capability/providers/claude-capability-provider.js +2 -154
- package/dist/core/capability/providers/codex-capability-provider.js +2 -136
- package/dist/core/{channel-loader.js → channel/channel-loader.js} +226 -38
- package/dist/core/{channel-runtime.js → channel/channel-runtime.js} +18 -18
- package/dist/core/command/agent-control.js +60 -15
- package/dist/core/command/agent-template-menu.js +21 -9
- package/dist/core/command/agentmd-menu-request.js +19 -8
- package/dist/core/command/agentmd-menu.js +14 -5
- package/dist/core/command/command-handler.js +127 -57
- package/dist/core/command/context-policy-menu.js +122 -0
- package/dist/core/command/data-root-resolver.js +157 -20
- package/dist/core/command/memory-slash.js +6 -6
- package/dist/core/command/menu-catalog.js +80 -20
- package/dist/core/command/menu-handler.js +305 -25
- package/dist/core/command/menu-protocol.js +42 -8
- package/dist/core/command/menu-query-batch.js +9 -5
- package/dist/core/command/provider-menu.js +7 -11
- package/dist/core/command/role-menu.js +1 -1
- package/dist/core/command/skill-slash.js +17 -5
- package/dist/core/command/slash-gate.js +2 -4
- package/dist/core/command/slash-handler.js +127 -96
- package/dist/core/command/team-workspace-team.js +3 -3
- package/dist/core/command/topic-slash.js +10 -10
- package/dist/core/{daemon-bootstrap.js → daemon/daemon-bootstrap.js} +14 -14
- package/dist/core/{daemon-control.js → daemon/daemon-control.js} +46 -20
- package/dist/core/{daemon-lifecycle.js → daemon/daemon-lifecycle.js} +15 -15
- package/dist/core/{host-snapshot.js → daemon/host-snapshot.js} +3 -3
- package/dist/core/{ipc-registration.js → daemon/ipc-registration.js} +98 -38
- package/dist/core/{lifecycle-notice.js → daemon/lifecycle-notice.js} +4 -5
- package/dist/core/file-integrity/store.js +1 -1
- package/dist/core/handoff/ipc-registration.js +3 -3
- package/dist/core/handoff/runtime.js +1 -1
- package/dist/{agents → core/inference}/request-identity.js +2 -2
- package/dist/core/inference/text-inference.js +4 -4
- package/dist/core/{bootstrap-messages.js → initialization/bootstrap-messages.js} +10 -10
- package/dist/core/{bootstrap-service.js → initialization/bootstrap-service.js} +24 -23
- package/dist/core/initialization/service.js +54 -9
- package/dist/core/invoke/executors/media.js +1 -1
- package/dist/core/invoke/executors/text.js +1 -1
- package/dist/core/memory/consolidation-context.js +1 -1
- package/dist/core/memory/consolidation-trigger.js +9 -3
- package/dist/core/memory/consolidation.js +4 -4
- package/dist/core/memory/memory-admin.js +6 -6
- package/dist/core/memory/memory-writer.js +1 -1
- package/dist/core/memory/relation-idle-monitor.js +1 -1
- package/dist/core/message/aun-ipc-sender.js +114 -75
- package/dist/core/message/aun-request-registry.js +13 -5
- package/dist/core/message/auto-mention-gate.js +1 -1
- package/dist/core/message/contact-admission.js +1 -1
- package/dist/core/message/im-renderer.js +19 -0
- package/dist/core/{interaction-router.js → message/interaction-router.js} +4 -4
- package/dist/core/message/items-formatter.js +5 -5
- package/dist/core/message/message-admission.js +1 -1
- package/dist/core/message/message-bridge.js +135 -54
- package/dist/core/message/message-queue.js +83 -4
- package/dist/core/message/message-utils.js +1 -1
- package/dist/core/message/peer-mode.js +1 -1
- package/dist/core/message/response-engine.js +347 -163
- package/dist/core/message/send-options.js +9 -6
- package/dist/core/message/send-routing.js +45 -109
- package/dist/core/message/stream-idle-monitor.js +1 -1
- package/dist/core/{data-migration.js → migration/data-migration.js} +29 -1
- package/dist/core/model/catalog-service.js +29 -8
- package/dist/core/model/model-capabilities.js +88 -0
- package/dist/core/model/model-catalog.js +14 -3
- package/dist/core/model/model-diagnostics.js +4 -4
- package/dist/core/ownership/owner-resolver.js +95 -15
- package/dist/core/{pack-auth.js → pack/pack-auth.js} +30 -3
- package/dist/core/{pack-install.js → pack/pack-install.js} +95 -17
- package/dist/core/permission/approval-gateway.js +9 -18
- package/dist/core/permission/ec-command-parser.js +70 -34
- package/dist/core/permission/managed-file.js +234 -0
- package/dist/core/permission/protected-paths.js +56 -0
- package/dist/core/permission/sandbox-runtime.js +267 -3
- package/dist/core/permission/session-path-grants.js +1 -1
- package/dist/core/permission/shell-environment.js +15 -1
- package/dist/core/plugin/plugin-lifecycle.js +442 -0
- package/dist/core/session/adapters/claude-session-file-adapter.js +2 -246
- package/dist/core/session/adapters/codex-session-file-adapter.js +2 -566
- package/dist/core/session/adapters/ecagent-session-file-adapter.js +2 -134
- package/dist/core/{background-session → session/background}/session-cleanup.js +2 -2
- package/dist/core/{background-session → session/background}/types.js +1 -1
- package/dist/core/session/session-file-health.js +2 -272
- package/dist/core/session/session-idle-monitor.js +1 -1
- package/dist/core/session/session-manager.js +29 -2
- package/dist/core/session/session-terminal.js +185 -0
- package/dist/core/session/session-title.js +8 -11
- package/dist/core/{system-session → session/system}/memory.js +43 -9
- package/dist/core/{system-session → session/system}/registry.js +1 -1
- package/dist/core/{system-session → session/system}/types.js +1 -1
- package/dist/core/skill/index-generator.js +1 -0
- package/dist/core/task/task-activity-store.js +112 -0
- package/dist/core/task/task-recovery-service.js +2 -2
- package/dist/core/thread/ipc-operation.js +2 -2
- package/dist/core/thread/thread-operation.js +2 -1
- package/dist/core/thread/thread-route.js +5 -3
- package/dist/core/thread/thread-service.js +14 -4
- package/dist/directory/{owner-directory-admission.js → admission.js} +3 -3
- package/dist/directory/{owner-directory-cache.js → cache.js} +90 -8
- package/dist/directory/{owner-directory-markdown.js → markdown.js} +2 -2
- package/dist/directory/{owner-directory-query-operation.js → query-operation.js} +83 -9
- package/dist/directory/{owner-directory-search.js → search.js} +50 -2
- package/dist/directory/{owner-directory-store.js → store.js} +2 -2
- package/dist/eck/kit-renderer.js +1 -1
- package/dist/eck/manifest-engine.js +64 -2
- package/dist/eck/message-renderer.js +35 -0
- package/dist/ecweb/basic-settings-service.js +9 -3
- package/dist/{contracts → ecweb/contracts}/ecweb-service-protocol.js +2 -1
- package/dist/ecweb/dsh-native-service.js +413 -0
- package/dist/ecweb/providers-service.js +1 -1
- package/dist/ecweb/runtime/lifecycle.js +1 -1
- package/dist/ecweb/runtime/supervisor.js +1 -1
- package/dist/event-center/center-config.js +2 -2
- package/dist/event-center/dispatcher.js +1 -1
- package/dist/event-center/ipc-operation.js +12 -3
- package/dist/event-center/pack-loader.js +2 -2
- package/dist/event-center/registry.js +6 -6
- package/dist/event-center/runtime.js +2 -2
- package/dist/index.js +71 -42
- package/dist/ipc.js +103 -10
- package/dist/outputs/authorization.js +27 -0
- package/dist/outputs/events.js +10 -1
- package/dist/outputs/panel-cards.js +960 -0
- package/dist/paths.js +12 -0
- package/dist/pay/command.js +1 -1
- package/dist/pay/runtime.js +18 -10
- package/dist/response-system/engines/v1/proactive-flow.js +1 -1
- package/dist/services/dispatcher.js +2 -2
- package/dist/services/host/main.js +10 -1
- package/dist/services/host/protocol.js +9 -2
- package/dist/services/host/resident.js +37 -0
- package/dist/services/host-client.js +12 -0
- package/dist/services/host-recycle.js +8 -3
- package/dist/services/host-runtime.js +54 -15
- package/dist/services/index.js +83 -19
- package/dist/services/ipc-operation.js +303 -38
- package/dist/services/pack-manager.js +2 -2
- package/dist/services/router.js +43 -3
- package/dist/services/script-runner.js +34 -25
- package/dist/services/service-payload.js +28 -1
- package/dist/services/validation.js +28 -2
- package/dist/stats/context-usage.js +110 -0
- package/dist/stats/model-resolver.js +103 -17
- package/dist/stats/query.js +5 -0
- package/dist/trigger/application-service.js +3 -2
- package/dist/trigger/authorization.js +36 -33
- package/dist/trigger/ipc-service.js +4 -4
- package/dist/trigger/local-files.js +8 -176
- package/dist/trigger/manager.js +2 -2
- package/dist/trigger/parser.js +48 -0
- package/dist/trigger/scheduler.js +14 -2
- package/dist/trigger/script-executor.js +21 -0
- package/dist/trigger/script-sandbox.js +57 -243
- package/dist/trigger/system-definitions.js +25 -0
- package/dist/trigger/validation.js +1 -1
- package/dist/utils/atomic-write.js +88 -1
- package/dist/utils/cross-platform.js +4 -42
- package/dist/utils/error-dict.json +22 -1
- package/dist/utils/error-utils.js +193 -6
- package/dist/utils/evolcore-version.js +2 -2
- package/dist/utils/host-info.js +1 -1
- package/dist/utils/logger.js +3 -1
- package/dist/utils/media-cache.js +99 -4
- package/dist/utils/startup-trace.js +20 -4
- package/dist/utils/welcome.js +64 -20
- package/ecagent/README.md +35 -0
- package/ecagent/dist/agent-loop.js +80 -30
- package/ecagent/dist/harness/env/nodejs.d.ts +16 -0
- package/ecagent/dist/harness/env/nodejs.js +49 -20
- package/ecagent/dist/harness/messages.js +3 -2
- package/ecagent/dist/harness/types.d.ts +1 -0
- package/ecagent/dist/runtime/types.d.ts +2 -0
- package/ecagent/dist/runtime/utils/validation.d.ts +7 -1
- package/ecagent/dist/runtime/utils/validation.js +42 -0
- package/ecagent/dist/types.d.ts +2 -0
- package/kits/docs/INDEX.md +1 -1
- package/kits/docs/channels/feishu.md +1 -1
- package/kits/docs/evolcore/INDEX.md +10 -7
- package/kits/docs/evolcore/agent-create.md +2 -0
- package/kits/docs/evolcore/agent.md +100 -13
- package/kits/docs/evolcore/aid.md +19 -3
- package/kits/docs/evolcore/config.md +94 -0
- package/kits/docs/evolcore/ctl.md +2 -1
- package/kits/docs/evolcore/ec-capabilities.md +7 -10
- package/kits/docs/evolcore/ecweb-lifecycle.md +5 -1
- package/kits/docs/evolcore/event.md +1 -1
- package/kits/docs/evolcore/fs.md +49 -3
- package/kits/docs/evolcore/group.md +3 -3
- package/kits/docs/evolcore/memory-consolidation.md +1 -1
- package/kits/docs/evolcore/menu-protocol.md +24 -2
- package/kits/docs/evolcore/model.md +9 -1
- package/kits/docs/evolcore/msg.md +30 -28
- package/kits/docs/evolcore/pay.md +8 -20
- package/kits/docs/evolcore/plugin.md +74 -0
- package/kits/docs/evolcore/provider.md +8 -2
- package/kits/docs/evolcore/rpc.md +2 -2
- package/kits/docs/evolcore/skill.md +17 -1
- package/kits/docs/evolcore/stats.md +5 -0
- package/kits/docs/evolcore/storage.md +22 -0
- package/kits/docs/evolcore/thread-chain.md +19 -10
- package/kits/docs/evolcore/tool-authorization.md +4 -0
- package/kits/docs/evolcore/trigger.md +89 -13
- package/kits/docs/identity/AID_PROFILE_SPEC.md +1 -1
- package/kits/docs/venues/feishu-group.md +3 -2
- package/kits/docs/venues/feishu-private.md +3 -2
- package/kits/rules/02-navigation.md +20 -13
- package/kits/rules/06-channel.md +18 -2
- package/kits/schemas/_meta.json +8 -4
- package/kits/schemas/agent-config.schema.23.json +19 -3
- package/kits/schemas/agent-config.schema.24.json +986 -0
- package/kits/schemas/agent-config.schema.25.json +986 -0
- package/kits/schemas/daemon.schema.11.json +487 -0
- package/kits/schemas/daemon.schema.12.json +505 -0
- package/kits/schemas/defaults.schema.8.json +484 -0
- package/kits/schemas/providers.schema.1.json +1 -1
- package/kits/schemas/providers.schema.2.json +1 -1
- package/kits/schemas/providers.schema.3.json +8 -2
- package/kits/skills/.switches.json +4 -0
- package/kits/skills/ability/SKILL.md +194 -27
- package/kits/skills/ability/STRUCTURE.md +5 -0
- package/kits/skills/agent-output-cards/SKILL.md +90 -54
- package/kits/skills/agent-output-cards/examples/html-surface.json +11 -0
- package/kits/skills/agent-output-cards/examples/meeting-followups.json +16 -0
- package/kits/skills/agent-output-cards/examples/meeting-latest.json +24 -0
- package/kits/skills/agent-output-cards/examples/project-metrics.json +16 -0
- package/kits/skills/agent-output-cards/examples/quick-links.json +18 -0
- package/kits/skills/agent-output-cards/examples/surface.html +8 -0
- package/kits/skills/agent-template-project/SKILL.md +51 -0
- package/kits/skills/agent-template-project/references/01-collect-and-pack.md +174 -0
- package/kits/skills/agent-template-project/references/02-upload-and-share.md +109 -0
- package/kits/skills/agent-template-project/references/03-download-and-install.md +189 -0
- package/kits/skills/agent-template-project/references/04-upgrade-and-recovery.md +74 -0
- package/kits/skills/agent-template-project/references/05-publish-to-platform.md +62 -0
- package/kits/skills/ec-group/SKILL.md +3 -3
- package/kits/skills/ec-group-collaboration/SKILL.md +4 -4
- package/kits/skills/ec-identity/SKILL.md +9 -6
- package/kits/skills/ec-pay/SKILL.md +163 -41
- package/kits/skills/ec-provider/SKILL.md +5 -5
- package/kits/skills/ec-service-call/SKILL.md +3 -0
- package/kits/skills/ec-skill/SKILL.md +25 -9
- package/kits/skills/ec-skill/scripts/cli.mjs +7 -7
- package/kits/skills/ec-skill/scripts/skill.mjs +55 -41
- package/kits/skills/ec-skill/scripts/template/SKILL.md.tmpl +9 -0
- package/kits/skills/ec-trigger/SKILL.md +2 -2
- package/kits/skills/personal-assistant/SKILL.md +22 -22
- package/kits/skills/personal-assistant/references/03-data-flow-and-gaps.md +1 -1
- package/kits/skills/scrapling-article-fetch/SKILL.md +5 -5
- package/kits/skills/thread-ops/SKILL.md +19 -9
- package/kits/skills/wechat-article-media-download/SKILL.md +2 -2
- package/kits/skills/wechat-article-reader/SKILL.md +2 -2
- package/kits/templates/system-fragments/commands.md +1 -1
- package/kits/templates/system-fragments/personal-assistant.md +2 -2
- package/kits/templates/system-fragments/reply.md +14 -9
- package/kits/templates/system-fragments/session.md +1 -1
- package/kits/templates/system-fragments/thread.md +10 -5
- package/package.json +6 -5
- package/scripts/agent-template/index.mjs +7 -1
- package/scripts/agent-template/inspect.mjs +81 -35
- package/scripts/agent-template/overlay.mjs +110 -4
- package/scripts/agent-template/shared/common.mjs +36 -4
- package/scripts/agent-template/shared/plan.mjs +4 -2
- package/scripts/agent-template/shared/service-packs.mjs +104 -0
- package/scripts/agent-template/shared/team-schema.json +467 -54
- package/scripts/agent-template/shared/template-contract.mjs +70 -68
- package/scripts/agent-template/shared/template-package.mjs +153 -36
- package/scripts/agent-template/shared/template-runtime.mjs +76 -64
- package/scripts/agent-template/shared/template.mjs +11 -46
- package/scripts/agent-template/team-pack.mjs +451 -35
- package/scripts/agent-template/team-preview.mjs +75 -226
- package/scripts/aid-batch/identity-batch.mjs +1 -1
- package/dist/agents/baseagent-availability.js +0 -176
- package/dist/agents/baseagent-capability-adapter.js +0 -102
- package/dist/agents/baseagent-plugin-loader.js +0 -145
- package/dist/agents/baseagent.js +0 -816
- package/dist/agents/codex/catalog.js +0 -80
- package/dist/agents/ecagent-plugin-lazy.js +0 -41
- package/dist/agents/tool-time-context.js +0 -55
- package/dist/core/legacy-rename.js +0 -41
- package/dist/core/plugin-lifecycle.js +0 -137
- package/dist/core/rate-window.js +0 -53
- package/dist/core/runner-reload-transaction.js +0 -60
- package/dist/core/runtime-lock.js +0 -90
- package/dist/core/soul.js +0 -66
- package/dist/core/system-session/grants.js +0 -40
- package/dist/directory/owner-directory-agentmd-sync.js +0 -89
- package/dist/directory/owner-directory-request-operation.js +0 -79
- package/dist/directory/owner-directory-text.js +0 -60
- package/kits/skills/ec-pay/references/pay-cli.md +0 -110
- /package/dist/agents/gemini/{gemini-capability-provider.js → capability-provider.js} +0 -0
- /package/dist/agents/gemini/{gemini-session-file-adapter.js → session-file-adapter.js} +0 -0
- /package/dist/{agents/claude-gateway → claude-gateway}/types.js +0 -0
- /package/dist/core/{system-channels.js → channel/system-channels.js} +0 -0
- /package/dist/core/{daemon-file-cache.js → daemon/daemon-file-cache.js} +0 -0
- /package/dist/core/{event-bus.js → event/event-bus.js} +0 -0
- /package/dist/core/{event-catalog.js → event/event-catalog.js} +0 -0
- /package/dist/core/{pack-ledger.js → pack/pack-ledger.js} +0 -0
- /package/dist/directory/{owner-directory-identity.js → identity.js} +0 -0
- /package/dist/directory/{owner-directory-policy.js → policy.js} +0 -0
- /package/dist/directory/{owner-directory-remarks.js → remarks.js} +0 -0
- /package/dist/directory/{owner-directory-scope.js → scope.js} +0 -0
- /package/dist/{contracts → ecweb/contracts}/ecweb-instance.js +0 -0
- /package/kits/templates/{bootstrap-welcome.md → bootstrap-intro.md} +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
2
3
|
import { randomUUID } from 'node:crypto';
|
|
3
4
|
import { queryDaemon, wantsHelp } from './help.js';
|
|
4
5
|
import { runManagedAgentOperation } from './agent.js';
|
|
@@ -6,21 +7,87 @@ import { resolvePaths } from '../paths.js';
|
|
|
6
7
|
import { MAIN_CLI_BIN, SESSION_ID_ENV } from '../product.js';
|
|
7
8
|
import { getDaemonOwners, refreshOwnershipForAuthorization } from '../core/ownership/owner-resolver.js';
|
|
8
9
|
import { getAgentTemplateService } from '../agent-template/service.js';
|
|
9
|
-
import { templateError, TEMPLATE_ACTIONS } from '../agent-template/types.js';
|
|
10
|
+
import { templateError, templateOwnerRequiredError, TEMPLATE_ACTIONS } from '../agent-template/types.js';
|
|
10
11
|
const templateContract = await import(new URL('../../scripts/agent-template/shared/template-contract.mjs', import.meta.url).href);
|
|
11
|
-
export
|
|
12
|
+
export const TEMPLATE_CLI_ACTIONS = TEMPLATE_ACTIONS.filter(action => action !== 'update-status');
|
|
13
|
+
const PREVIEW_MEMBER_FLAGS = new Set([
|
|
14
|
+
'--member', '--aid', '--project', '--provider', '--model', '--effort', '--external-aid',
|
|
15
|
+
'--skill-resolution', '--current-digest', '--incoming-digest',
|
|
16
|
+
]);
|
|
17
|
+
function templateAssignment(option, value) {
|
|
18
|
+
const separator = value.indexOf('=');
|
|
19
|
+
if (separator <= 0 || separator === value.length - 1) {
|
|
20
|
+
throw templateError('INVALID_ARGUMENT', option + ' requires KEY=VALUE');
|
|
21
|
+
}
|
|
22
|
+
return [value.slice(0, separator), value.slice(separator + 1)];
|
|
23
|
+
}
|
|
24
|
+
function parseTemplatePreview(flags, options) {
|
|
25
|
+
const members = Object.create(null);
|
|
26
|
+
let member;
|
|
27
|
+
let skill;
|
|
28
|
+
const assign = (target, key, value, option) => {
|
|
29
|
+
if (Object.hasOwn(target, key))
|
|
30
|
+
throw templateError('INVALID_ARGUMENT', 'Duplicate preview option: ' + option);
|
|
31
|
+
target[key] = value;
|
|
32
|
+
};
|
|
33
|
+
for (const [option, value] of options) {
|
|
34
|
+
if (option === '--member') {
|
|
35
|
+
member = { target: {} };
|
|
36
|
+
assign(members, value, member, '--member ' + value);
|
|
37
|
+
skill = undefined;
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
if (!member)
|
|
41
|
+
throw templateError('INVALID_ARGUMENT', option + ' must follow --member KEY');
|
|
42
|
+
if (option === '--aid' || option === '--project') {
|
|
43
|
+
assign(member.target, option.slice(2), value, option);
|
|
44
|
+
}
|
|
45
|
+
else if (['--provider', '--model', '--effort'].includes(option)) {
|
|
46
|
+
const [baseagent, selected] = templateAssignment(option, value);
|
|
47
|
+
member.providers ??= Object.create(null);
|
|
48
|
+
if (!Object.hasOwn(member.providers, baseagent))
|
|
49
|
+
member.providers[baseagent] = {};
|
|
50
|
+
assign(member.providers[baseagent], option.slice(2), option === '--effort' && selected === 'null' ? null : selected, option + ' ' + baseagent);
|
|
51
|
+
}
|
|
52
|
+
else if (option === '--external-aid') {
|
|
53
|
+
const [source, target] = templateAssignment(option, value);
|
|
54
|
+
member.externalAids ??= Object.create(null);
|
|
55
|
+
assign(member.externalAids, source, target, option + ' ' + source);
|
|
56
|
+
}
|
|
57
|
+
else if (option === '--skill-resolution') {
|
|
58
|
+
const [name, action] = templateAssignment(option, value);
|
|
59
|
+
member.skillResolutions ??= Object.create(null);
|
|
60
|
+
skill = { action };
|
|
61
|
+
assign(member.skillResolutions, name, skill, option + ' ' + name);
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
if (!skill)
|
|
65
|
+
throw templateError('INVALID_ARGUMENT', option + ' must follow --skill-resolution NAME=overwrite|skip');
|
|
66
|
+
assign(skill, option === '--current-digest' ? 'currentDigest' : 'incomingDigest', value, option);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return { path: flags.get('--path'), installMode: flags.get('--install-mode'), members,
|
|
70
|
+
...(flags.has('--default-aid-domain') ? { defaultAidDomain: flags.get('--default-aid-domain') } : {}) };
|
|
71
|
+
}
|
|
72
|
+
export function parseTemplateCommand(argv, internalRequestId) {
|
|
12
73
|
const action = argv[0];
|
|
13
|
-
if (!
|
|
74
|
+
if (!TEMPLATE_CLI_ACTIONS.includes(action))
|
|
14
75
|
throw templateError('INVALID_ARGUMENT', 'Unknown template action');
|
|
15
|
-
const jsonAction = ['inspect', '
|
|
16
|
-
'
|
|
76
|
+
const jsonAction = ['inspect', 'collect', 'pack', 'push', 'pull',
|
|
77
|
+
'check-update'].includes(action);
|
|
17
78
|
const controls = ['resume', 'cancel'].includes(action);
|
|
18
|
-
const asynchronous = !['status', 'capabilities'].includes(action);
|
|
79
|
+
const asynchronous = !['status', 'capabilities', 'check-update'].includes(action);
|
|
80
|
+
const storeAction = ['list', 'detail', 'publish', 'download'].includes(action);
|
|
19
81
|
const flags = new Map();
|
|
20
82
|
const positionals = [];
|
|
83
|
+
const previewOptions = [];
|
|
21
84
|
const allowed = new Set(['--format', ...(asynchronous ? ['--wait'] : []),
|
|
22
|
-
'--request-id', ...(jsonAction ? ['--input-file'] : []),
|
|
23
|
-
...(action === '
|
|
85
|
+
'--request-id', ...(jsonAction ? ['--input-file'] : []), ...(storeAction ? ['--store'] : []),
|
|
86
|
+
...(action === 'list' ? ['--kind', '--publisher', '--template-id', '--offset', '--limit'] : []),
|
|
87
|
+
...(action === 'detail' ? ['--from-version'] : []),
|
|
88
|
+
...(['pull', 'download'].includes(action) ? ['--path'] : []),
|
|
89
|
+
...(action === 'preview' ? ['--path', '--install-mode', '--default-aid-domain', ...PREVIEW_MEMBER_FLAGS] : []),
|
|
90
|
+
...(action === 'deploy' ? ['--preview-id', '--plan-digest'] : []), ...(action === 'upgrade' ? ['--release-id'] : [])]);
|
|
24
91
|
for (let i = 1; i < argv.length; i++) {
|
|
25
92
|
const token = argv[i];
|
|
26
93
|
if (!token.startsWith('--')) {
|
|
@@ -30,15 +97,53 @@ export function parseTemplateCommand(argv) {
|
|
|
30
97
|
if (!allowed.has(token) || flags.has(token) || !argv[i + 1] || argv[i + 1].startsWith('--')) {
|
|
31
98
|
throw templateError('INVALID_ARGUMENT', 'Invalid template option: ' + token);
|
|
32
99
|
}
|
|
33
|
-
|
|
100
|
+
const value = argv[++i];
|
|
101
|
+
if (action === 'preview' && PREVIEW_MEMBER_FLAGS.has(token))
|
|
102
|
+
previewOptions.push([token, value]);
|
|
103
|
+
else
|
|
104
|
+
flags.set(token, value);
|
|
34
105
|
}
|
|
35
106
|
if (flags.has('--format') && flags.get('--format') !== 'json')
|
|
36
107
|
throw templateError('INVALID_ARGUMENT', '--format must be json');
|
|
37
108
|
let args;
|
|
38
|
-
if (
|
|
109
|
+
if (action === 'preview') {
|
|
110
|
+
if (positionals.length)
|
|
111
|
+
throw templateError('INVALID_ARGUMENT', 'preview accepts named options only');
|
|
112
|
+
if (!flags.has('--path') || !path.isAbsolute(flags.get('--path'))) {
|
|
113
|
+
throw templateError('INVALID_ARGUMENT', 'preview --path must be an absolute path on the target host');
|
|
114
|
+
}
|
|
115
|
+
args = parseTemplatePreview(flags, previewOptions);
|
|
116
|
+
}
|
|
117
|
+
else if (jsonAction) {
|
|
39
118
|
if (!flags.has('--input-file') || positionals.length)
|
|
40
119
|
throw templateError('INVALID_ARGUMENT', '--input-file is required');
|
|
41
120
|
args = JSON.parse(fs.readFileSync(flags.get('--input-file'), 'utf8'));
|
|
121
|
+
if (action === 'pull' && flags.has('--path'))
|
|
122
|
+
args.path = flags.get('--path');
|
|
123
|
+
}
|
|
124
|
+
else if (storeAction) {
|
|
125
|
+
if (!flags.has('--store') || positionals.length !== (action === 'list' ? 0 : 1)) {
|
|
126
|
+
throw templateError('INVALID_ARGUMENT', action + ' requires --store AID' + (action === 'list' ? '' : ' and one ' + (action === 'publish' ? 'packageId' : 'releaseId')));
|
|
127
|
+
}
|
|
128
|
+
args = { storeAid: flags.get('--store') };
|
|
129
|
+
if (action === 'download') {
|
|
130
|
+
if (!flags.has('--path') || !path.isAbsolute(flags.get('--path'))) {
|
|
131
|
+
throw templateError('INVALID_ARGUMENT', 'download --path must be an absolute destination path on the target host');
|
|
132
|
+
}
|
|
133
|
+
args.path = flags.get('--path');
|
|
134
|
+
}
|
|
135
|
+
if (action !== 'list')
|
|
136
|
+
args[action === 'publish' ? 'packageId' : 'releaseId'] = positionals[0];
|
|
137
|
+
for (const [flag, key] of [['--kind', 'kind'], ['--publisher', 'publisher'], ['--template-id', 'templateId'],
|
|
138
|
+
['--offset', 'offset'], ['--limit', 'limit'], ['--from-version', 'fromVersion']]) {
|
|
139
|
+
if (flags.has(flag))
|
|
140
|
+
args[key] = ['offset', 'limit'].includes(key) ? Number(flags.get(flag)) : flags.get(flag);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
else if (action === 'upgrade') {
|
|
144
|
+
if (positionals.length !== 1)
|
|
145
|
+
throw templateError('INVALID_ARGUMENT', 'upgrade TARGET_AID [--release-id ID] required');
|
|
146
|
+
args = { targetAid: positionals[0], ...(flags.has('--release-id') ? { releaseId: flags.get('--release-id') } : {}) };
|
|
42
147
|
}
|
|
43
148
|
else if (action === 'deploy') {
|
|
44
149
|
if (positionals.length)
|
|
@@ -61,9 +166,13 @@ export function parseTemplateCommand(argv) {
|
|
|
61
166
|
throw templateError('INVALID_ARGUMENT', 'capabilities accepts no business arguments');
|
|
62
167
|
args = {};
|
|
63
168
|
}
|
|
64
|
-
const
|
|
169
|
+
const explicitRequestId = action === 'status' ? undefined : flags.get('--request-id');
|
|
170
|
+
if (explicitRequestId !== undefined && internalRequestId !== undefined && explicitRequestId !== internalRequestId) {
|
|
171
|
+
throw templateError('INVALID_ARGUMENT', 'Internal request ID must match --request-id');
|
|
172
|
+
}
|
|
173
|
+
const requestId = explicitRequestId ?? internalRequestId ?? randomUUID();
|
|
65
174
|
args = templateContract.normalizeTemplateRequest({ requestId, action, args }).args;
|
|
66
|
-
const wait = Number(flags.get('--wait') ?? 0);
|
|
175
|
+
const wait = Number(flags.get('--wait') ?? (['list', 'detail'].includes(action) ? 30 : 0));
|
|
67
176
|
if (!Number.isInteger(wait) || wait < 0 || wait > 300)
|
|
68
177
|
throw templateError('INVALID_ARGUMENT', '--wait must be 0..300 seconds');
|
|
69
178
|
return { action, args, requestId, wait };
|
|
@@ -80,11 +189,25 @@ export function templateExitCode(response, waited = false) {
|
|
|
80
189
|
return 3;
|
|
81
190
|
return 0;
|
|
82
191
|
}
|
|
83
|
-
export async function executeTemplateCommand(actor, argv) {
|
|
84
|
-
const parsed = parseTemplateCommand(argv);
|
|
192
|
+
export async function executeTemplateCommand(actor, argv, internalRequestId, context = {}) {
|
|
193
|
+
const parsed = parseTemplateCommand(argv, internalRequestId);
|
|
85
194
|
try {
|
|
86
195
|
const service = getAgentTemplateService();
|
|
87
|
-
let data = await service.action(actor, parsed.requestId, parsed.action, parsed.args);
|
|
196
|
+
let data = await service.action(actor, parsed.requestId, parsed.action, parsed.args, context);
|
|
197
|
+
if (parsed.action === 'check-update' && data.jobId) {
|
|
198
|
+
// CLI checks return the completed result; Menu keeps its existing job protocol.
|
|
199
|
+
await service.wait(data.jobId);
|
|
200
|
+
data = await service.query(actor, { jobId: data.jobId });
|
|
201
|
+
if (data.status === 'succeeded')
|
|
202
|
+
return { requestId: parsed.requestId, data: data.result };
|
|
203
|
+
let currentVersion = null;
|
|
204
|
+
try {
|
|
205
|
+
currentVersion = (await service.updateStatus(actor, parsed.args.targetAid)).currentVersion;
|
|
206
|
+
}
|
|
207
|
+
catch { /* Do not disclose local state when the current Owner cannot be verified. */ }
|
|
208
|
+
return { requestId: parsed.requestId, data: { targetAid: parsed.args.targetAid, currentVersion },
|
|
209
|
+
error: data.error ?? { code: 'CHECK_INCOMPLETE', message: 'Update check did not complete', retryable: true } };
|
|
210
|
+
}
|
|
88
211
|
if (data.jobId && parsed.wait && ['queued', 'running', 'cancelling'].includes(data.status)) {
|
|
89
212
|
let timer;
|
|
90
213
|
try {
|
|
@@ -104,35 +227,282 @@ export async function executeTemplateCommand(actor, argv) {
|
|
|
104
227
|
} };
|
|
105
228
|
}
|
|
106
229
|
}
|
|
107
|
-
export async function executeHostTemplateCommand(argv) {
|
|
230
|
+
export async function executeHostTemplateCommand(argv, internalRequestId) {
|
|
108
231
|
await refreshOwnershipForAuthorization(undefined, { force: true, allowTransient: false, source: 'agent-template-cli' });
|
|
109
232
|
const actor = getDaemonOwners()[0];
|
|
110
233
|
if (!actor)
|
|
111
|
-
throw
|
|
112
|
-
return executeTemplateCommand(actor, argv);
|
|
234
|
+
throw templateOwnerRequiredError(argv[0], 'Verified DaemonOwner required');
|
|
235
|
+
return executeTemplateCommand(actor, argv, internalRequestId);
|
|
236
|
+
}
|
|
237
|
+
/** Local usage hints only; full input schemas remain available through capabilities. */
|
|
238
|
+
function templateHelpEntries() {
|
|
239
|
+
const command = MAIN_CLI_BIN + ' agent template';
|
|
240
|
+
const jobId = 'job_00000000-0000-0000-0000-000000000001';
|
|
241
|
+
const digest = 'sha256:' + 'a'.repeat(64);
|
|
242
|
+
return {
|
|
243
|
+
inspect: {
|
|
244
|
+
summary: '按模块盘点来源资源',
|
|
245
|
+
details: [
|
|
246
|
+
'JSON 必填:module、members[key].source(agent+aid 或 directory+path)。',
|
|
247
|
+
'module:config/profile/soul/skill/trigger/event/service/project。',
|
|
248
|
+
],
|
|
249
|
+
example: [
|
|
250
|
+
'{',
|
|
251
|
+
' "module": "profile",',
|
|
252
|
+
' "members": {"writer": {"source": {"kind": "agent", "aid": "writer.agentid.cn"}}}',
|
|
253
|
+
'}',
|
|
254
|
+
],
|
|
255
|
+
next: '成功后用 jobId 和 result.inventoryDigest 发起 collect。',
|
|
256
|
+
},
|
|
257
|
+
collect: {
|
|
258
|
+
summary: '采集选中模块,生成可编辑副本',
|
|
259
|
+
details: [
|
|
260
|
+
'JSON 必填:module、inspectionJobId、inventoryDigest、members[key].include。',
|
|
261
|
+
'module/成员 key 须匹配成功 inspect;include 按模块选择资源。',
|
|
262
|
+
'JSON 可选:freeze=false(仅采集期间冻结);project 另必填 selectionIndex。',
|
|
263
|
+
],
|
|
264
|
+
example: [
|
|
265
|
+
'{',
|
|
266
|
+
' "module": "profile",',
|
|
267
|
+
' "inspectionJobId": "' + jobId + '",',
|
|
268
|
+
' "inventoryDigest": "' + digest + '",',
|
|
269
|
+
' "members": {"writer": {"include": {}}}',
|
|
270
|
+
'}',
|
|
271
|
+
],
|
|
272
|
+
next: '编辑 result.workspace 副本;把成功 collect 的 jobId 交给 pack。',
|
|
273
|
+
},
|
|
274
|
+
pack: {
|
|
275
|
+
summary: '组合采集副本并封包',
|
|
276
|
+
details: [
|
|
277
|
+
'JSON 必填:metadata(id/name/version/platforms)、members[key].collections[].jobId。',
|
|
278
|
+
'每成员至少 config/profile,引用同一来源和成员 key 的成功 collect 作业。',
|
|
279
|
+
'JSON 可选:memberReferences.external(外部联系人)、assistantKey、publisherIdentity=agent|host。',
|
|
280
|
+
'publish 要求包内发布者与真实调用身份一致;未指定 publisherIdentity 时保持原署名行为。',
|
|
281
|
+
],
|
|
282
|
+
example: [
|
|
283
|
+
'{',
|
|
284
|
+
' "metadata": {"id": "writer", "name": "写作助理", "version": "1.0.0", "platforms": ["linux"]},',
|
|
285
|
+
' "members": {"writer": {"collections": [',
|
|
286
|
+
' {"jobId": "' + jobId + '"},',
|
|
287
|
+
' {"jobId": "job_00000000-0000-0000-0000-000000000002"}',
|
|
288
|
+
' ]}}',
|
|
289
|
+
'}',
|
|
290
|
+
],
|
|
291
|
+
next: '用 result.packageId 发起 push/publish;本机 preview 使用 result.path;成员映射取 result.memberKeys。',
|
|
292
|
+
},
|
|
293
|
+
push: {
|
|
294
|
+
summary: '上传已封好的模板包',
|
|
295
|
+
details: [
|
|
296
|
+
'JSON 必填:packageId、location(aid/path);目标目录须授权实际上传者。',
|
|
297
|
+
'path 须为 /templates/<metadata.id>/<metadata.id>-<metadata.version>.ectpl。',
|
|
298
|
+
],
|
|
299
|
+
example: [
|
|
300
|
+
'{',
|
|
301
|
+
' "packageId": "package_example",',
|
|
302
|
+
' "location": {"aid": "owner.agentid.cn", "path": "/templates/writer/writer-1.0.0.ectpl"}',
|
|
303
|
+
'}',
|
|
304
|
+
],
|
|
305
|
+
next: '保留 result.location/digest,另行分享给接收方。',
|
|
306
|
+
},
|
|
307
|
+
list: {
|
|
308
|
+
summary: '查询 Store 的模板发行目录', syntax: '--store AID',
|
|
309
|
+
details: ['可选:--kind agent|team、--publisher AID、--template-id ID、--offset N、--limit 1..50。',
|
|
310
|
+
'默认每页 20 项;默认等待 30 秒,结果含 total/offset/limit/releases。'],
|
|
311
|
+
example: [command + ' list --store evolai.agentid.cn --kind agent'],
|
|
312
|
+
},
|
|
313
|
+
detail: {
|
|
314
|
+
summary: '查看 Store 中的精确发行', syntax: 'RELEASE_ID --store AID',
|
|
315
|
+
details: ['releaseId 为 64 位小写十六进制;可选 --from-version VERSION 查询升级差异。',
|
|
316
|
+
'默认等待 30 秒;审核和升级状态以 Store 返回值为准。'],
|
|
317
|
+
example: [command + ' detail ' + 'a'.repeat(64) + ' --store evolai.agentid.cn'],
|
|
318
|
+
},
|
|
319
|
+
download: {
|
|
320
|
+
summary: '从 Store 下载并校验指定发行', syntax: 'RELEASE_ID --store AID --path PATH',
|
|
321
|
+
details: ['自动查询发行、申请仅本 Host 可用的下载授权,下载到指定绝对路径并校验。',
|
|
322
|
+
'返回 result.path/digest,不另建包缓存或包索引;临时文件放会话 TMPDIR,长期保存放项目目录。',
|
|
323
|
+
'调用身份由执行入口确定;普通下载不代表审核通过或已安装。'],
|
|
324
|
+
example: [command + ' download ' + 'a'.repeat(64) + ' --store evolai.agentid.cn --path /workspace/writer.ectpl --wait 60'],
|
|
325
|
+
next: '用 result.path 发起 preview --path;暂停时 resume 原作业。',
|
|
326
|
+
},
|
|
327
|
+
publish: {
|
|
328
|
+
summary: '上传并发布最终模板包到平台仓库',
|
|
329
|
+
syntax: 'PACKAGE_ID --store AID',
|
|
330
|
+
details: [
|
|
331
|
+
'参数为最终 packageId 和 --store 仓库 AID。',
|
|
332
|
+
'托管会话使用当前执行 Agent;宿主终端使用当前 Host Control 连接。',
|
|
333
|
+
'包内 publisher 须与真实身份一致,发布者还须具备仓库准入和发布权限。',
|
|
334
|
+
'自动上传发布者自身 Storage、定向授权仓库读取,并核验远端发行结果。',
|
|
335
|
+
],
|
|
336
|
+
example: [command + ' publish package_example --store evolai.agentid.cn'],
|
|
337
|
+
next: '用 status 查询本地 jobId;resumable=true 时 resume 原作业。',
|
|
338
|
+
},
|
|
339
|
+
pull: {
|
|
340
|
+
summary: '下载 Storage 分享的模板包',
|
|
341
|
+
syntax: '--input-file FILE [--path PATH]',
|
|
342
|
+
details: [
|
|
343
|
+
'权限:需要目标主机的 DaemonOwner,普通 Agent-Agent 会话及仅有 Agent owner/admin 的身份不能调用。',
|
|
344
|
+
'收到模板分享不授予下载或安装权限;权限被拒绝时,通知当前 Agent 的 Owner 并询问后续操作,由具备目标主机权限的 Owner 发起或委托。不要在原会话重复重试。',
|
|
345
|
+
'JSON 指定 source.kind=remote、location、digest 及必要的 download.shareId。',
|
|
346
|
+
'目标 Host 还须有 Storage 文件读取授权;仅授权接收 Agent 的短码不能当作 Host 的下载授权。',
|
|
347
|
+
'--path 可选,指定时须为目标 Host 上的绝对文件路径;省略时使用受管 TMPDIR。',
|
|
348
|
+
'pull 只下载和校验,不安装;安装需要另行获得相应授权,再执行 preview/deploy。',
|
|
349
|
+
'仓库发行使用 download RELEASE_ID --store AID --path PATH。',
|
|
350
|
+
],
|
|
351
|
+
example: ['{"source":{"kind":"remote","location":{"aid":"sender.agentid.cn","path":"/templates/writer/writer-1.0.0.ectpl"},"digest":"' + digest + '"}}',
|
|
352
|
+
command + ' pull --input-file pull.json'],
|
|
353
|
+
next: '用 result.path 发起 preview --path。',
|
|
354
|
+
},
|
|
355
|
+
preview: {
|
|
356
|
+
summary: '选择安装目标并预览计划',
|
|
357
|
+
syntax: '--path PATH --install-mode create|overwrite --member KEY --aid AID [成员选项]',
|
|
358
|
+
details: [
|
|
359
|
+
'--path 是目标 Host 可读的 .ectpl 绝对路径;直接读取文件,不需要先 pull。',
|
|
360
|
+
'--member KEY 可重复;后续成员选项归属当前成员,每个成员须有 --aid。',
|
|
361
|
+
'create:--aid auto 时必填 --default-aid-domain DOMAIN;--project 可省,由 Host 分配。',
|
|
362
|
+
'overwrite:仅一个已有 AID,必填 --project 当前默认目录,不接受 --default-aid-domain。',
|
|
363
|
+
'模型:--provider BASEAGENT=ID --model BASEAGENT=MODEL;可选 --effort BASEAGENT=VALUE。',
|
|
364
|
+
'--effort BASEAGENT=null 清除显式推理强度;不同基座可分别选择本机已有 Provider/model。',
|
|
365
|
+
'外部映射:--external-aid SOURCE_AID=TARGET_AID,可重复且归属当前成员。',
|
|
366
|
+
'技能冲突:--skill-resolution NAME=overwrite|skip,随后给 --current-digest 和 --incoming-digest。',
|
|
367
|
+
'每次技能选择都需要同次预览的两个 sha256 摘要;更换 --member 后须重新选择技能。',
|
|
368
|
+
'preview 仅接受命令行参数,不读取 --input-file。',
|
|
369
|
+
],
|
|
370
|
+
example: [
|
|
371
|
+
command + ' preview --path /workspace/writer.ectpl --install-mode create \\',
|
|
372
|
+
' --default-aid-domain agentid.cn --member writer --aid auto',
|
|
373
|
+
],
|
|
374
|
+
next: '确认 result.executable=true,再将 previewId/planDigest 交给 deploy。',
|
|
375
|
+
},
|
|
376
|
+
deploy: {
|
|
377
|
+
summary: '执行已确认的安装计划',
|
|
378
|
+
syntax: '--preview-id ID --plan-digest DIGEST',
|
|
379
|
+
details: ['两个选项均必填,须来自同一次可执行 preview。'],
|
|
380
|
+
example: [
|
|
381
|
+
command + ' deploy --preview-id preview_example \\',
|
|
382
|
+
' --plan-digest ' + digest,
|
|
383
|
+
],
|
|
384
|
+
next: '保存 jobId,用 status 查询;暂停时按原作业 resume。',
|
|
385
|
+
},
|
|
386
|
+
status: {
|
|
387
|
+
summary: '查询作业进度与结果',
|
|
388
|
+
syntax: 'JOB_ID | --request-id ORIGINAL',
|
|
389
|
+
details: ['两种查询键必选其一;不接受 --wait。'],
|
|
390
|
+
example: [command + ' status --request-id original-request'],
|
|
391
|
+
next: '查看 status/result/error;resumable=true 时可 resume 原 jobId。',
|
|
392
|
+
},
|
|
393
|
+
resume: {
|
|
394
|
+
summary: '恢复原作业',
|
|
395
|
+
syntax: 'JOB_ID',
|
|
396
|
+
details: ['JOB_ID 必填;先 status 确认 resumable 并处理暂停原因。'],
|
|
397
|
+
example: [command + ' resume ' + jobId],
|
|
398
|
+
next: '继续 status 同一 jobId。',
|
|
399
|
+
},
|
|
400
|
+
cancel: {
|
|
401
|
+
summary: '请求取消原作业',
|
|
402
|
+
syntax: 'JOB_ID',
|
|
403
|
+
details: ['JOB_ID 必填;取消保留已创建身份,可能先返回 cancelling。'],
|
|
404
|
+
example: [command + ' cancel ' + jobId],
|
|
405
|
+
next: '继续 status,确认最终状态和恢复结果。',
|
|
406
|
+
},
|
|
407
|
+
capabilities: {
|
|
408
|
+
summary: '查询模块、输入 schema 与限制',
|
|
409
|
+
syntax: '',
|
|
410
|
+
details: ['无业务参数,需要 daemon;结果含 inputSchemas/modules/selectionIndexSchema。'],
|
|
411
|
+
example: [command + ' capabilities'],
|
|
412
|
+
},
|
|
413
|
+
'check-update': {
|
|
414
|
+
summary: '检查并返回当前版本与仓库候选',
|
|
415
|
+
details: [
|
|
416
|
+
'JSON 必填:targetAid(本机目标 Agent AID);直接返回结果或不能检查的原因。',
|
|
417
|
+
'只检查,不安装、不发送提醒;不接受 --wait。',
|
|
418
|
+
'要求 version/update.key/update.registryAid 和 manual|auto 模式;disabled 禁止检查。',
|
|
419
|
+
],
|
|
420
|
+
example: ['{"targetAid": "writer.agentid.cn"}'],
|
|
421
|
+
next: '有新版时按需 upgrade,再用 status 跟踪升级作业。',
|
|
422
|
+
},
|
|
423
|
+
upgrade: {
|
|
424
|
+
summary: '升级单个已安装 Agent',
|
|
425
|
+
syntax: 'TARGET_AID [--release-id ID]',
|
|
426
|
+
details: [
|
|
427
|
+
'TARGET_AID 必填,为本机目标;--release-id 可选,须为 64 位小写十六进制发行 ID。',
|
|
428
|
+
'省略 release-id 时选当前审核启用的候选并固定;保留本机 Provider 与升级策略。',
|
|
429
|
+
'要求 version/update.key/update.registryAid 和 manual|auto 模式;disabled 禁止升级。',
|
|
430
|
+
],
|
|
431
|
+
example: [command + ' upgrade writer.agentid.cn'],
|
|
432
|
+
next: '保存 jobId,用 status/resume/cancel 跟踪原作业。',
|
|
433
|
+
},
|
|
434
|
+
};
|
|
435
|
+
}
|
|
436
|
+
function printTemplateHelp(action) {
|
|
437
|
+
const command = MAIN_CLI_BIN + ' agent template';
|
|
438
|
+
const entries = templateHelpEntries();
|
|
439
|
+
if (!action) {
|
|
440
|
+
console.log([
|
|
441
|
+
'用法:' + command + ' <子命令> [参数]',
|
|
442
|
+
'',
|
|
443
|
+
...TEMPLATE_CLI_ACTIONS.map(name => ' ' + name.padEnd(24) + ' ' + entries[name].summary),
|
|
444
|
+
'',
|
|
445
|
+
'制作:inspect → collect → 编辑副本 → pack → push',
|
|
446
|
+
'发布:pack → publish → status',
|
|
447
|
+
'Store:list → detail → download → preview → deploy',
|
|
448
|
+
'安装:pull → preview → deploy → status',
|
|
449
|
+
'升级:check-update → upgrade → status',
|
|
450
|
+
'',
|
|
451
|
+
'本地已有包直接 preview --path PATH。download 用 --path 指定落点,pull 省略 --path 时使用受管 TMPDIR。',
|
|
452
|
+
'通用选项:--request-id ID;--wait 0..300(list/detail 默认 30,其余默认 0,超时不取消);--format json(默认)。',
|
|
453
|
+
'status 只用 --request-id 查询原请求;capabilities 仅接受 --format json;check-update 直接返回,三者不接受 --wait。',
|
|
454
|
+
'子帮助:' + command + ' <子命令> --help(离线可读)',
|
|
455
|
+
'完整字段与用法:capabilities(需 daemon)或 kits/docs/evolcore/agent.md。',
|
|
456
|
+
].join('\n'));
|
|
457
|
+
return;
|
|
458
|
+
}
|
|
459
|
+
const entry = entries[action];
|
|
460
|
+
const jsonInput = entry.syntax === undefined;
|
|
461
|
+
const options = ['--format json(可选,默认 JSON)'];
|
|
462
|
+
if (!['status', 'capabilities'].includes(action)) {
|
|
463
|
+
options.unshift('--request-id ID(可选,默认自动生成)'
|
|
464
|
+
+ (action === 'check-update' ? '' : ';--wait 0..300(默认 ' + (['list', 'detail'].includes(action) ? 30 : 0) + ',超时不取消)'));
|
|
465
|
+
}
|
|
466
|
+
console.log([
|
|
467
|
+
'用法:' + command + ' ' + action + (entry.syntax ? ' ' + entry.syntax : jsonInput ? ' --input-file FILE' : '')
|
|
468
|
+
+ ' [选项]',
|
|
469
|
+
entry.summary,
|
|
470
|
+
'',
|
|
471
|
+
...(jsonInput ? ['--input-file FILE 必填,读取 JSON 文件。'] : []),
|
|
472
|
+
...entry.details,
|
|
473
|
+
...options.map(line => '选项:' + line),
|
|
474
|
+
'',
|
|
475
|
+
'示例:',
|
|
476
|
+
...entry.example,
|
|
477
|
+
...(jsonInput ? [' ' + command + ' ' + action + ' --input-file ' + action + '.json'] : []),
|
|
478
|
+
...(entry.next ? ['下一步:' + entry.next] : []),
|
|
479
|
+
...(jsonInput ? ['字段详情:capabilities 或 kits/docs/evolcore/agent.md。'] : []),
|
|
480
|
+
].join('\n'));
|
|
113
481
|
}
|
|
114
482
|
export async function cmdAgentTemplate(args) {
|
|
115
|
-
if (!args.length ||
|
|
116
|
-
|
|
117
|
-
+ 'inspect/build/push/pull/preview/register-team/team-members/prepare-member-install/resume-member-join: --input-file FILE\n'
|
|
118
|
-
+ 'update-status/check-update/bind-update-source/confirm-update-source/preview-update/read-update-notice: --input-file FILE\n'
|
|
119
|
-
+ 'deploy: --preview-id ID --plan-digest DIGEST\n'
|
|
120
|
-
+ 'status JOB_ID | status --request-id ORIGINAL; resume/cancel JOB_ID\n'
|
|
121
|
-
+ 'Asynchronous/control: --request-id ID --wait 0..300 (default 0). --format json');
|
|
483
|
+
if (!args.length || ['--help', '-h'].includes(args[0])) {
|
|
484
|
+
printTemplateHelp();
|
|
122
485
|
return;
|
|
123
486
|
}
|
|
124
487
|
let parsed;
|
|
125
488
|
try {
|
|
489
|
+
if (!TEMPLATE_CLI_ACTIONS.includes(args[0]))
|
|
490
|
+
throw templateError('INVALID_ARGUMENT', 'Unknown template action');
|
|
491
|
+
if (wantsHelp(args)) {
|
|
492
|
+
printTemplateHelp(args[0]);
|
|
493
|
+
return;
|
|
494
|
+
}
|
|
126
495
|
parsed = parseTemplateCommand(args);
|
|
127
|
-
const frozenArgs = ['status', 'capabilities'].includes(parsed.action) || args.includes('--request-id') ? args : [...args, '--request-id', parsed.requestId];
|
|
128
496
|
let result;
|
|
129
497
|
if (process.env[SESSION_ID_ENV]) {
|
|
130
|
-
|
|
498
|
+
// Approval binds the original argv. Generated correlation metadata travels
|
|
499
|
+
// separately and must never become an extra CLI business argument.
|
|
500
|
+
const managed = await runManagedAgentOperation(['template', ...args], 310_000, parsed.requestId);
|
|
131
501
|
result = managed.result ?? managed;
|
|
132
502
|
}
|
|
133
503
|
else {
|
|
134
504
|
const controlToken = fs.readFileSync(resolvePaths().controlToken, 'utf8').trim();
|
|
135
|
-
const { response, transportError } = await queryDaemon(resolvePaths().socket, { type: 'agent-template.op', controlToken, argv:
|
|
505
|
+
const { response, transportError } = await queryDaemon(resolvePaths().socket, { type: 'agent-template.op', controlToken, argv: args, templateRequestId: parsed.requestId }, 310_000);
|
|
136
506
|
result = response ?? { requestId: parsed.requestId, transportError: transportError ?? { message: 'Daemon unavailable' } };
|
|
137
507
|
}
|
|
138
508
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -140,7 +510,8 @@ export async function cmdAgentTemplate(args) {
|
|
|
140
510
|
}
|
|
141
511
|
catch (error) {
|
|
142
512
|
console.error(JSON.stringify({ requestId: parsed?.requestId, error: {
|
|
143
|
-
code: error.code ?? 'INVALID_ARGUMENT', message: error.message, retryable: false
|
|
513
|
+
code: error.code ?? 'INVALID_ARGUMENT', message: error.message, retryable: false,
|
|
514
|
+
...(error.details ? { details: error.details } : {})
|
|
144
515
|
} }));
|
|
145
516
|
process.exitCode = error.code === 'INVALID_ARGUMENT' || !parsed ? 2 : 1;
|
|
146
517
|
}
|
package/dist/cli/agent.js
CHANGED
|
@@ -96,7 +96,7 @@ import { SESSION_ID_ENV } from '../product.js';
|
|
|
96
96
|
import { resolvePaths, agentMdPath as getAgentMdPathFromPaths, agentWelcomePath, aunPath as defaultAunPath } from '../paths.js';
|
|
97
97
|
import { loadDefaults, loadAllAgents, loadAgent, saveAgent, ensureAgentDirSkeleton } from '../config-store.js';
|
|
98
98
|
import { assertAgentAidAvailable, assertAgentModelConfigured, resolveEffective, initConfigManager } from '../config/config-manager.js';
|
|
99
|
-
import { resolveRuntimeBaseagentModelSelection } from '../
|
|
99
|
+
import { resolveRuntimeBaseagentModelSelection } from '../core/baseagent/baseagent.js';
|
|
100
100
|
import { resolveConfigCommand } from '../config/resolved-config-op.js';
|
|
101
101
|
import { executeResolvedConfigCommandAsync } from '../config/config-operation-service.js';
|
|
102
102
|
import { ipcQuery, ipcHostQuery, IpcTransportError } from '../ipc.js';
|
|
@@ -104,19 +104,19 @@ import { daemonUnavailableMessage, queryDaemon } from './help.js';
|
|
|
104
104
|
import { CONFIG_SCHEMA_VERSION } from '../types.js';
|
|
105
105
|
import { ensureInitialRoleRegistry } from '../config/role-service.js';
|
|
106
106
|
import { agentProjectRootFromDefaults, deriveAgentProjectPath } from '../utils/project-path.js';
|
|
107
|
-
import { isValidChannelName } from '../core/channel-loader.js';
|
|
107
|
+
import { isValidChannelName, getChannelPluginDescriptor, listChannelPluginDescriptors, validateChannelConfigs } from '../core/channel/channel-loader.js';
|
|
108
108
|
import { AGENT_DELEGATION_TOKEN_ENV, readDelegationCredential } from '../core/auth/agent-delegation.js';
|
|
109
109
|
import { readTaskRuntimeContextFromEnv } from './task-context.js';
|
|
110
110
|
import { isValidAid } from '../aun/aid/validation.js';
|
|
111
|
-
import { findPostBootstrapWelcomeOutbox } from '../core/bootstrap-messages.js';
|
|
111
|
+
import { findPostBootstrapWelcomeOutbox } from '../core/initialization/bootstrap-messages.js';
|
|
112
112
|
import { resolveAgentLifecycle } from '../config/lifecycle.js';
|
|
113
113
|
import { initializationSummary } from './agent-create.js';
|
|
114
114
|
import { parseAgentWelcomeMetadata, readAgentWelcomeTemplate, renderPostBootstrapWelcomeMessage, saveAgentWelcomeTemplate, validateWelcomeTemplate } from '../utils/welcome.js';
|
|
115
115
|
import { RUNTIME_ENVIRONMENT_NAMES } from '../config/runtime-env.js';
|
|
116
|
-
import { removeAgentFiles } from '../core/agent-create-status.js';
|
|
116
|
+
import { removeAgentFiles } from '../core/agent/agent-create-status.js';
|
|
117
117
|
export { agentCreateInteractive, agentCreateNonInteractive, parseAgentOwnerArgs, resolveAgentCreatePlan, validateAgentCreatePlan, validateAgentOwnerOptions, } from './agent-create.js';
|
|
118
118
|
/** Route agent lifecycle commands from a managed task through daemon IPC. */
|
|
119
|
-
export async function runManagedAgentOperation(argv, timeoutMs = 60_000) {
|
|
119
|
+
export async function runManagedAgentOperation(argv, timeoutMs = 60_000, templateRequestId) {
|
|
120
120
|
const sessionId = process.env.EVOLCORE_SESSION_ID;
|
|
121
121
|
if (!sessionId)
|
|
122
122
|
return { ok: false, code: 'MANAGED_ONLY', error: 'agent operation is not running in a managed task' };
|
|
@@ -129,6 +129,7 @@ export async function runManagedAgentOperation(argv, timeoutMs = 60_000) {
|
|
|
129
129
|
argv: ['agent', ...argv],
|
|
130
130
|
sessionId,
|
|
131
131
|
delegationToken,
|
|
132
|
+
...(templateRequestId === undefined ? {} : { templateRequestId }),
|
|
132
133
|
}, timeoutMs);
|
|
133
134
|
if (!response)
|
|
134
135
|
return {
|
|
@@ -209,7 +210,7 @@ export async function agentList(registry) {
|
|
|
209
210
|
}
|
|
210
211
|
catch { }
|
|
211
212
|
// Cold mode: read from disk
|
|
212
|
-
const { EvolAgentRegistry } = await import('../core/evolagent-registry.js');
|
|
213
|
+
const { EvolAgentRegistry } = await import('../core/agent/evolagent-registry.js');
|
|
213
214
|
const diskRegistry = new EvolAgentRegistry(p.agentsDir);
|
|
214
215
|
diskRegistry.loadAll();
|
|
215
216
|
const agents = diskRegistry.list().map(info => toAgentListItem(info, true));
|
|
@@ -259,7 +260,7 @@ export async function agentShow(aid) {
|
|
|
259
260
|
// Cold mode fallback for agent info
|
|
260
261
|
if (!agentInfo) {
|
|
261
262
|
stale = true;
|
|
262
|
-
const { EvolAgentRegistry } = await import('../core/evolagent-registry.js');
|
|
263
|
+
const { EvolAgentRegistry } = await import('../core/agent/evolagent-registry.js');
|
|
263
264
|
const registry = new EvolAgentRegistry(p.agentsDir);
|
|
264
265
|
registry.loadAll();
|
|
265
266
|
const agent = registry.get(aid);
|
|
@@ -725,16 +726,18 @@ export async function agentChannelUpsert(opts) {
|
|
|
725
726
|
return { ok: false, code: 'CONTROL_AID_RESERVED', error: error.message };
|
|
726
727
|
}
|
|
727
728
|
const p = resolvePaths();
|
|
728
|
-
const SUPPORTED_TYPES = new Set(['feishu', 'wechat', 'dingtalk', 'qqbot', 'wecom']);
|
|
729
729
|
if (opts.channel.type === 'aun') {
|
|
730
730
|
return { ok: false, error: 'AUN channel cannot be configured via channels[] (managed implicitly by agent.aid)' };
|
|
731
731
|
}
|
|
732
|
-
if (!
|
|
733
|
-
return { ok: false, error: `Unsupported channel type: ${opts.channel.type} (allowed: ${
|
|
732
|
+
if (!getChannelPluginDescriptor(opts.channel.type)) {
|
|
733
|
+
return { ok: false, error: `Unsupported channel type: ${opts.channel.type} (allowed: ${listChannelPluginDescriptors().map(item => item.name).join('/')})` };
|
|
734
734
|
}
|
|
735
735
|
if (!isValidChannelName(opts.channel.name)) {
|
|
736
736
|
return { ok: false, error: `Invalid channel name: ${JSON.stringify(opts.channel.name)} (empty or contains '#')` };
|
|
737
737
|
}
|
|
738
|
+
const configErrors = validateChannelConfigs([opts.channel]);
|
|
739
|
+
if (configErrors.length)
|
|
740
|
+
return { ok: false, error: configErrors.join('; ') };
|
|
738
741
|
let config;
|
|
739
742
|
try {
|
|
740
743
|
config = loadAgent(opts.aid);
|
|
@@ -973,7 +976,7 @@ export async function agentHost(aid, args = []) {
|
|
|
973
976
|
const snapshot = response.snapshot;
|
|
974
977
|
const known = Array.isArray(snapshot.agents) && snapshot.agents.some((agent) => agent.aid === aid);
|
|
975
978
|
if (!known) {
|
|
976
|
-
const { EvolAgentRegistry } = await import('../core/evolagent-registry.js');
|
|
979
|
+
const { EvolAgentRegistry } = await import('../core/agent/evolagent-registry.js');
|
|
977
980
|
const registry = new EvolAgentRegistry(p.agentsDir);
|
|
978
981
|
registry.loadAll();
|
|
979
982
|
if (!registry.get(aid))
|