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
|
@@ -8,8 +8,9 @@ import { readTaskRuntimeContextFromEnv } from './task-context.js';
|
|
|
8
8
|
import { assertEcSingleLine } from './cli-argv.js';
|
|
9
9
|
import { canonicalizeEvolcoreCommandArgv } from '../core/permission/ec-command-parser.js';
|
|
10
10
|
import { MAIN_CLI_BIN } from '../product.js';
|
|
11
|
-
import { readTriggerLocalFile, resolveTriggerLocalPath } from '../
|
|
11
|
+
import { readTriggerLocalFile, resolveTriggerLocalPath } from '../core/permission/managed-file.js';
|
|
12
12
|
import { normalizeTriggerDefinition, resolveScriptPath, safeRelativePath, } from '../trigger/validation.js';
|
|
13
|
+
import { normalizeTriggerEnabled } from '../trigger/parser.js';
|
|
13
14
|
export async function cmdTrigger(args) {
|
|
14
15
|
args = canonicalizeEvolcoreCommandArgv([MAIN_CLI_BIN, 'trigger', ...args]).slice(2);
|
|
15
16
|
const sub = args[0];
|
|
@@ -115,12 +116,12 @@ function printHelp() {
|
|
|
115
116
|
console.log(`用法: ec trigger <subcommand>
|
|
116
117
|
|
|
117
118
|
命令:
|
|
118
|
-
list [--agent <aid>] [--
|
|
119
|
+
list [--agent <aid>] [--enabled-only] [--thread-id <threadId>] [--json]
|
|
119
120
|
show [--agent <aid>] <triggerId> [--json]
|
|
120
121
|
history [--agent <aid>] [triggerId] [--limit <n>] [--json]
|
|
121
|
-
create --exec <script|trigger-session|target-session> --file <trigger.json|trigger-dir> [--
|
|
122
|
+
create --exec <script|trigger-session|target-session> --file <trigger.json|trigger-dir> [--enabled <true|false>] [--json]
|
|
122
123
|
OR
|
|
123
|
-
create [--agent <aid>] --exec <script|trigger-session|target-session> --cron <expr>|--event <pattern> (--prompt <text>|--prompt-file <path>) [--
|
|
124
|
+
create [--agent <aid>] --exec <script|trigger-session|target-session> --cron <expr>|--event <pattern> (--prompt <text>|--prompt-file <path>) [--enabled <true|false>] [其他flag]
|
|
124
125
|
set ... (create 的兼容别名)
|
|
125
126
|
update [--agent <aid>] <triggerId> <参数...> [--if-revision <sha256:...>] [--json]
|
|
126
127
|
enable [--agent <aid>] <triggerId>
|
|
@@ -149,6 +150,9 @@ Create 参数模式支持:
|
|
|
149
150
|
--target-session <main|thread> [--target-thread-id <threadId>]
|
|
150
151
|
--trigger-thread <by-run|by-trigger> (兼容旧值 per-run)
|
|
151
152
|
--name <名称> --description <文本>
|
|
153
|
+
--enabled <true|false> (建好是否立即启用,默认 true;false 表示建好但先不开)
|
|
154
|
+
|
|
155
|
+
list 默认列出已启用与已关闭的全部 trigger,每行标 on/off;--enabled-only 只看已启用。
|
|
152
156
|
|
|
153
157
|
通用输出参数:
|
|
154
158
|
--json | --format json
|
|
@@ -179,12 +183,15 @@ Update 参数:
|
|
|
179
183
|
async function listTriggers(args, json, response) {
|
|
180
184
|
const agentAid = resolveAgentAid(args);
|
|
181
185
|
const threadId = flagValue(args, '--thread-id');
|
|
182
|
-
const
|
|
186
|
+
const enabledOnly = hasFlag(args, '--enabled-only');
|
|
187
|
+
const res = response ?? await request({
|
|
188
|
+
type: 'trigger.list', agentAid, enabledOnly, ...(threadId ? { threadId } : {}),
|
|
189
|
+
});
|
|
183
190
|
if (json)
|
|
184
191
|
return printJson(res);
|
|
185
192
|
const triggers = res.triggers;
|
|
186
193
|
if (triggers.length === 0) {
|
|
187
|
-
console.log('(无 trigger)');
|
|
194
|
+
console.log(enabledOnly ? '(无已启用的 trigger)' : '(无 trigger)');
|
|
188
195
|
return;
|
|
189
196
|
}
|
|
190
197
|
for (const t of triggers) {
|
|
@@ -192,6 +199,9 @@ async function listTriggers(args, json, response) {
|
|
|
192
199
|
if (t.description)
|
|
193
200
|
console.log(` ${t.description}`);
|
|
194
201
|
}
|
|
202
|
+
if (triggers.some(t => !t.enabled)) {
|
|
203
|
+
console.log('\n提示:off 的 trigger 不会到点触发;ec trigger enable <id> 可启用,一次性用完的用 ec trigger delete 清理。');
|
|
204
|
+
}
|
|
195
205
|
}
|
|
196
206
|
async function showTrigger(args, json, response) {
|
|
197
207
|
const agentAid = resolveAgentAid(args);
|
|
@@ -275,7 +285,13 @@ async function createTrigger(args, json, fileScope) {
|
|
|
275
285
|
const res = await request(await buildTriggerCreateRequest(args, fileScope), 30_000);
|
|
276
286
|
if (json)
|
|
277
287
|
return printJson(res);
|
|
278
|
-
console.log(
|
|
288
|
+
console.log(formatCreateReceipt(res.trigger));
|
|
289
|
+
}
|
|
290
|
+
/** 创建成功回执:始终带当前启停状态;关闭时附上启用命令。 */
|
|
291
|
+
export function formatCreateReceipt(trigger) {
|
|
292
|
+
const enabled = trigger.enabled === true;
|
|
293
|
+
const base = `✓ created ${trigger.id} (${trigger.name}) [${enabled ? 'enabled' : 'disabled'}]`;
|
|
294
|
+
return enabled ? base : `${base}\n 启用:ec trigger enable ${trigger.id}`;
|
|
279
295
|
}
|
|
280
296
|
export async function buildTriggerCreateRequest(args, fileScope, defaultAgentAid) {
|
|
281
297
|
if (!hasOption(args, '--exec')) {
|
|
@@ -292,11 +308,14 @@ export async function buildTriggerCreateRequest(args, fileScope, defaultAgentAid
|
|
|
292
308
|
if (definition.execution.type !== executionType) {
|
|
293
309
|
throw new Error(`--exec ${flagValue(args, '--exec')} 与 trigger.json 的 execution.type=${definition.execution.type} 不一致`);
|
|
294
310
|
}
|
|
311
|
+
// --file 导入时 JSON 里的 enabled 可被显式参数覆盖;不传则沿用 JSON(缺省 true)。
|
|
312
|
+
const override = parseEnabledOverride(args);
|
|
313
|
+
if (override !== undefined)
|
|
314
|
+
definition.enabled = override;
|
|
295
315
|
return {
|
|
296
316
|
type: 'trigger.create',
|
|
297
317
|
definition,
|
|
298
318
|
files,
|
|
299
|
-
enable: hasFlag(args, '--enable') ? true : undefined,
|
|
300
319
|
};
|
|
301
320
|
}
|
|
302
321
|
// Flag mode: use parser
|
|
@@ -338,7 +357,7 @@ export async function buildTriggerCreateRequest(args, fileScope, defaultAgentAid
|
|
|
338
357
|
agentAid,
|
|
339
358
|
name: parsed.name || `trigger-${now.toString(36)}`,
|
|
340
359
|
...(parsed.description ? { description: parsed.description } : {}),
|
|
341
|
-
enabled:
|
|
360
|
+
enabled: parsed.enabled ?? true,
|
|
342
361
|
createdAt: now,
|
|
343
362
|
updatedAt: now,
|
|
344
363
|
...(parsed.labels ? { labels: parsed.labels } : {}),
|
|
@@ -377,14 +396,30 @@ export async function buildTriggerCreateRequest(args, fileScope, defaultAgentAid
|
|
|
377
396
|
type: 'trigger.create',
|
|
378
397
|
definition,
|
|
379
398
|
files,
|
|
380
|
-
enable: hasFlag(args, '--enable') ? true : undefined,
|
|
381
399
|
};
|
|
382
400
|
}
|
|
401
|
+
/** `--enabled true|false`;`--enable` 为兼容别名(等价 true)。未指定返回 undefined。 */
|
|
402
|
+
function parseEnabledOverride(args) {
|
|
403
|
+
const raw = flagValue(args, '--enabled');
|
|
404
|
+
if (raw !== undefined) {
|
|
405
|
+
if (hasFlag(args, '--enable'))
|
|
406
|
+
throw new Error('--enabled 与 --enable 不能同时指定');
|
|
407
|
+
return normalizeTriggerEnabled(raw);
|
|
408
|
+
}
|
|
409
|
+
if (hasFlag(args, '--enable'))
|
|
410
|
+
return true;
|
|
411
|
+
return undefined;
|
|
412
|
+
}
|
|
383
413
|
function triggerCreateArgs(args) {
|
|
384
414
|
const out = [];
|
|
385
415
|
for (let i = 0; i < args.length; i++) {
|
|
386
416
|
const arg = args[i];
|
|
387
|
-
|
|
417
|
+
// --enable 是 --enabled true 的兼容别名:归一成带值形态再交给 parser。
|
|
418
|
+
if (arg === '--enable') {
|
|
419
|
+
out.push('--enabled', 'true');
|
|
420
|
+
continue;
|
|
421
|
+
}
|
|
422
|
+
if (arg === '--json')
|
|
388
423
|
continue;
|
|
389
424
|
if (arg === '--format') {
|
|
390
425
|
i += 1;
|
|
@@ -515,7 +550,7 @@ export function resolveTriggerCommandArgv(argv, defaultAgentAid) {
|
|
|
515
550
|
return {
|
|
516
551
|
type: types[sub], agentAid,
|
|
517
552
|
...(sub === 'cancel' ? { runId: positional } : { triggerId: positional }),
|
|
518
|
-
limit,
|
|
553
|
+
limit, enabledOnly: hasFlag(args, '--enabled-only'),
|
|
519
554
|
enabled: sub === 'enable', dryRun: hasFlag(args, '--dry-run')
|
|
520
555
|
};
|
|
521
556
|
}
|
package/dist/cli/watch-logs.js
CHANGED
|
@@ -4,11 +4,12 @@ const WATCH_LOG_FILE = /\.(?:log|jsonl|out)(?:\..+)?$/;
|
|
|
4
4
|
export function isWatchLogFile(file) {
|
|
5
5
|
return WATCH_LOG_FILE.test(path.basename(file));
|
|
6
6
|
}
|
|
7
|
-
/**
|
|
7
|
+
/** 去掉轮转及 SDK 日期/进程号后缀。入参可为文件名或绝对路径。 */
|
|
8
8
|
export function shortLogName(file) {
|
|
9
9
|
const baseName = path.basename(file);
|
|
10
10
|
const stem = baseName.replace(WATCH_LOG_FILE, '');
|
|
11
11
|
return stem
|
|
12
|
+
.replace(/^ts-sdk-\d{4}-\d{2}-\d{2}-\d+$/, 'ts-sdk')
|
|
12
13
|
.replace(/-\d{8}(?:-\d{2})?$/, '') // -YYYYMMDD[-HH](按日/小时轮转)
|
|
13
14
|
.replace(/-\d{4}-\d{2}-\d{2}(?:-\d{2})?$/, '')
|
|
14
15
|
.replace(/-[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$/i, '');
|
package/dist/config/boot-log.js
CHANGED
|
@@ -29,6 +29,9 @@ export async function prepareStartupConfig(recoverRoleMutations, onStep) {
|
|
|
29
29
|
const step = (name) => onStep?.(name);
|
|
30
30
|
recoverRoleMutations();
|
|
31
31
|
step('recoverRoleMutations');
|
|
32
|
+
// Preserve the legacy daemon version until baseagent declaration intent has been captured.
|
|
33
|
+
const { runBaseagentDeclarationMigration } = await import('./schema-migration.js');
|
|
34
|
+
runBaseagentDeclarationMigration({ apply: true });
|
|
32
35
|
autoMigrateIfNeeded();
|
|
33
36
|
// 前三个迁移扫的是同一批配置(relations/ 下有上千个文件),共享一次读取。
|
|
34
37
|
// 之后 roleV4/V5、contactBook 走的是不同的读取路径,各自的开销不受影响。
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
import { kitsRoleTemplatesDir } from '../paths.js';
|
|
3
|
-
import { createErrorCapturingReader, fileCache } from '../core/daemon-file-cache.js';
|
|
3
|
+
import { createErrorCapturingReader, fileCache } from '../core/daemon/daemon-file-cache.js';
|
|
4
4
|
import { normalizeRoleEffortCompat, normalizeRoleGroupChatmodeCompat, validateRoleConfig } from './role-schema.js';
|
|
5
5
|
import { expectedRoleRank } from './role-ranks.js';
|
|
6
6
|
export const BUILTIN_ROLE_IDS = ['owner', 'admin', 'member', 'visitor'];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isSupportedBaseagent } from '../
|
|
2
|
-
import { SYSTEM_SESSION_TYPES } from '../core/
|
|
1
|
+
import { isSupportedBaseagent } from '../core/baseagent/baseagent.js';
|
|
2
|
+
import { SYSTEM_SESSION_TYPES } from '../core/session/system/types.js';
|
|
3
3
|
import { isValidAid } from '../aun/aid/validation.js';
|
|
4
4
|
const BEHAVIOR_TOP_FIELDS = new Set([
|
|
5
5
|
'active_baseagent',
|
|
@@ -29,6 +29,7 @@ const BASEAGENT_BEHAVIOR_FIELDS = new Set([
|
|
|
29
29
|
'agentProgressSummaries',
|
|
30
30
|
'excludeDynamicSections',
|
|
31
31
|
'enableRequestUserInput',
|
|
32
|
+
'autoCompactThresholdTokens',
|
|
32
33
|
]);
|
|
33
34
|
/** Model selection is Agent-owned; relation selectors may never read or write it. */
|
|
34
35
|
export function isAgentOnlyModelField(fieldPath) {
|
|
@@ -36,7 +37,7 @@ export function isAgentOnlyModelField(fieldPath) {
|
|
|
36
37
|
return parts.length === 3
|
|
37
38
|
&& parts[0] === 'baseagents'
|
|
38
39
|
&& isSupportedBaseagent(parts[1])
|
|
39
|
-
&& (parts[2] === 'model' || parts[2] === 'effort' || parts[2] === 'reasoning' || parts[2] === 'fallback');
|
|
40
|
+
&& (parts[2] === 'model' || parts[2] === 'effort' || parts[2] === 'reasoning' || parts[2] === 'fallback' || parts[2] === 'autoCompactThresholdTokens');
|
|
40
41
|
}
|
|
41
42
|
/** Baseagent selection is Agent-owned as well. */
|
|
42
43
|
export function isAgentOnlyBaseagentField(fieldPath) {
|
|
@@ -100,7 +101,7 @@ export function resolveConfigFieldRule(fieldPath, scope) {
|
|
|
100
101
|
if (top === 'update') {
|
|
101
102
|
if (field === 'update')
|
|
102
103
|
return { ...readonlyObject('update'), access: 'owner-only' };
|
|
103
|
-
if (
|
|
104
|
+
if (['update.publisher', 'update.key', 'update.registryAid'].includes(field))
|
|
104
105
|
return scalar('update', 'aid', 'owner-only');
|
|
105
106
|
return field === 'update.mode' ? scalar('update', 'update-mode', 'owner-only') : { class: 'unknown' };
|
|
106
107
|
}
|
|
@@ -121,6 +122,9 @@ export function resolveConfigFieldRule(fieldPath, scope) {
|
|
|
121
122
|
return scalar(permissionKey, 'string', 'owner-only');
|
|
122
123
|
if (leaf === 'enabled' && parts.length === 3)
|
|
123
124
|
return scalar(permissionKey, 'boolean', 'owner-only');
|
|
125
|
+
if (['claude', 'codex', 'dsh'].includes(baseagent) && leaf === 'autoCompactThresholdTokens' && parts.length === 3) {
|
|
126
|
+
return scalar(permissionKey, 'positive-number', 'owner-only');
|
|
127
|
+
}
|
|
124
128
|
if (leaf === 'model' && parts.length === 3)
|
|
125
129
|
return scalar(permissionKey, 'string');
|
|
126
130
|
if ((leaf === 'effort' || leaf === 'reasoning') && parts.length === 3)
|
|
@@ -165,7 +169,7 @@ export function resolveConfigFieldRule(fieldPath, scope) {
|
|
|
165
169
|
// 仅 agent-config 声明该字段,relation/defaults 由 schema 路由拒绝。
|
|
166
170
|
if (field === 'baseagentSkills')
|
|
167
171
|
return scalar(field, 'boolean', 'owner-only');
|
|
168
|
-
if (field === '
|
|
172
|
+
if (field === 'enableWelcome')
|
|
169
173
|
return scalar(field, 'boolean', 'owner-only');
|
|
170
174
|
// 团队成员名单:Evol App 的 Team Workspace 菜单也能改,CLI 只是同一份配置的
|
|
171
175
|
// 另一个入口。**不设 owner-only**:agent 之间自主协作时由 agent 自己组队,
|
|
@@ -299,7 +303,7 @@ export function relationFieldWriteOperation(fieldPath) {
|
|
|
299
303
|
return undefined;
|
|
300
304
|
}
|
|
301
305
|
const MAX_FALLBACK_ITEMS = 3;
|
|
302
|
-
const PROVIDER_ID_PATTERN = /^[
|
|
306
|
+
const PROVIDER_ID_PATTERN = /^(?!__proto__$|prototype$|constructor$)[\p{L}\p{N} _-]+$/u;
|
|
303
307
|
/**
|
|
304
308
|
* 降级链的值是 JSON 数组,每项必须同时给出 provider / model / effort:
|
|
305
309
|
* 降级可能换用不同供应商的不同模型,缺任何一项都无法构造请求。
|
|
@@ -11,13 +11,13 @@
|
|
|
11
11
|
* 详见 docs/config/01-overview.md
|
|
12
12
|
*/
|
|
13
13
|
import fs from 'fs';
|
|
14
|
-
import { validateBaseagentPluginConfigs } from '../
|
|
14
|
+
import { validateBaseagentPluginConfigs } from '../core/baseagent/baseagent-plugin-descriptor.js';
|
|
15
|
+
import { validateChannelConfigs } from '../core/channel/channel-loader.js';
|
|
15
16
|
import path from 'path';
|
|
16
|
-
import { ensureManagedLockParent, resolveManagedLockPath } from '../core/runtime-lock.js';
|
|
17
17
|
import crypto from 'crypto';
|
|
18
18
|
import { resolvePaths, agentConfig as agentConfigPath, agentPeerConfig, agentRelationConfig, agentRolesIndex, agentRoleConfig, } from '../paths.js';
|
|
19
|
-
import { atomicReadJson, atomicWriteJson } from '../utils/atomic-write.js';
|
|
20
|
-
import { fileCache } from '../core/daemon-file-cache.js';
|
|
19
|
+
import { atomicReadJson, atomicWriteJson, ensureManagedLockParent, resolveManagedLockPath } from '../utils/atomic-write.js';
|
|
20
|
+
import { fileCache } from '../core/daemon/daemon-file-cache.js';
|
|
21
21
|
import { registerFile } from '../core/file-integrity/store.js';
|
|
22
22
|
import { isValidAid } from '../aun/aid/validation.js';
|
|
23
23
|
import { normalizeAidDomain } from '../aun/aid/domain.js';
|
|
@@ -37,7 +37,8 @@ import { assertProviderSelectionWrite, resolveProviderModelSettings, validatePro
|
|
|
37
37
|
import { resolveProviderSelectionModel } from '../core/model/model-catalog.js';
|
|
38
38
|
import { assertOwnerConfigRecord, normalizeOwnerConfigTree, withOwnerListCompatibility } from './owner-config.js';
|
|
39
39
|
import { getOwners, getPrimaryOwner, ownerResolver } from '../core/ownership/owner-resolver.js';
|
|
40
|
-
import { isSupportedBaseagent, resolveBaseagentModelSelection } from '../
|
|
40
|
+
import { isSupportedBaseagent, resolveBaseagentModelSelection, usesNativeModelSelection } from '../core/baseagent/baseagent.js';
|
|
41
|
+
import { preserveBaseagentDeclarationsOnWrite, migrateBaseagentDefaultsOnWrite } from './schema-migration.js';
|
|
41
42
|
import { assertProjectPathReference } from '../utils/project-path.js';
|
|
42
43
|
// AUN gateway discovery belongs to fastaun. Keep the retired gatewayUrl
|
|
43
44
|
// compatibility handling beside the rest of the configuration read/write
|
|
@@ -715,8 +716,22 @@ function normalizeBaseagentEffortCompat(value) {
|
|
|
715
716
|
return value;
|
|
716
717
|
return { ...value, baseagents };
|
|
717
718
|
}
|
|
719
|
+
/** Preserve explicit legacy welcome intent without adding a default or writing during reads. */
|
|
720
|
+
function normalizeWelcomeConfigCompat(value) {
|
|
721
|
+
if (!Object.prototype.hasOwnProperty.call(value, 'bootstrapWelcome'))
|
|
722
|
+
return value;
|
|
723
|
+
if (typeof value.bootstrapWelcome !== 'boolean') {
|
|
724
|
+
throw new ConfigError('VALIDATION_ERROR', 'Legacy bootstrapWelcome must be a boolean');
|
|
725
|
+
}
|
|
726
|
+
if (Object.prototype.hasOwnProperty.call(value, 'enableWelcome')
|
|
727
|
+
&& value.enableWelcome !== value.bootstrapWelcome) {
|
|
728
|
+
throw new ConfigError('VALIDATION_ERROR', 'Conflicting enableWelcome and legacy bootstrapWelcome values');
|
|
729
|
+
}
|
|
730
|
+
const { bootstrapWelcome, ...config } = value;
|
|
731
|
+
return { ...config, enableWelcome: bootstrapWelcome };
|
|
732
|
+
}
|
|
718
733
|
function normalizeAgentConfigForRead(value, aid) {
|
|
719
|
-
const config = withOwnerListCompatibility(normalizeOwnerConfigTree(foldLegacyProactiveBlock(normalizeAgentLifecycle(value))));
|
|
734
|
+
const config = withOwnerListCompatibility(normalizeOwnerConfigTree(foldLegacyProactiveBlock(normalizeAgentLifecycle(normalizeWelcomeConfigCompat(value)))));
|
|
720
735
|
const mutable = config;
|
|
721
736
|
normalizeShowActivitiesCompat(mutable);
|
|
722
737
|
// AID 校验(如果提供了 aid)
|
|
@@ -774,7 +789,7 @@ function normalizeAgentConfigForWrite(value) {
|
|
|
774
789
|
catch (error) {
|
|
775
790
|
throw new ConfigError('VALIDATION_ERROR', error instanceof Error ? error.message : String(error));
|
|
776
791
|
}
|
|
777
|
-
const mutable = normalizeOwnerConfigTree(normalizeBaseagentEffortCompat({ ...value }));
|
|
792
|
+
const mutable = normalizeOwnerConfigTree(normalizeBaseagentEffortCompat(normalizeWelcomeConfigCompat({ ...value })));
|
|
778
793
|
normalizeShowActivitiesCompat(mutable);
|
|
779
794
|
// AID 格式校验
|
|
780
795
|
if (mutable.aid && !isValidAid(mutable.aid)) {
|
|
@@ -885,7 +900,7 @@ function normalizeRelationConfigForWrite(value) {
|
|
|
885
900
|
for (const [baseagent, rawBlock] of Object.entries(mutable.baseagents)) {
|
|
886
901
|
if (!rawBlock || typeof rawBlock !== 'object' || Array.isArray(rawBlock))
|
|
887
902
|
continue;
|
|
888
|
-
for (const field of ['model', 'effort', 'reasoning']) {
|
|
903
|
+
for (const field of ['model', 'effort', 'reasoning', 'autoCompactThresholdTokens']) {
|
|
889
904
|
if (Object.prototype.hasOwnProperty.call(rawBlock, field))
|
|
890
905
|
agentOnlyFields.push(`baseagents.${baseagent}.${field}`);
|
|
891
906
|
}
|
|
@@ -951,6 +966,10 @@ function foldLegacyProactiveBlock(value) {
|
|
|
951
966
|
/** Write config with schema validation and atomic persistence. */
|
|
952
967
|
export function write(target, value, sel, opts = {}) {
|
|
953
968
|
const file = targetPath(target, sel);
|
|
969
|
+
if (target === ConfigTarget.Process)
|
|
970
|
+
value = preserveBaseagentDeclarationsOnWrite(value);
|
|
971
|
+
if (target === ConfigTarget.Defaults)
|
|
972
|
+
value = migrateBaseagentDefaultsOnWrite(value);
|
|
954
973
|
if (target === ConfigTarget.RoleRegistry) {
|
|
955
974
|
writeRoleRegistry(sel.self, value);
|
|
956
975
|
finishConfigWrite(target, sel, file);
|
|
@@ -1614,10 +1633,10 @@ function validatePluginConfigForTarget(target, value) {
|
|
|
1614
1633
|
return [];
|
|
1615
1634
|
const config = value;
|
|
1616
1635
|
const errors = validateBaseagentPluginConfigs(config?.baseagents, target === ConfigTarget.Defaults);
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1636
|
+
if (target === ConfigTarget.Agent && config?.channels !== undefined)
|
|
1637
|
+
errors.push(...validateChannelConfigs(config.channels));
|
|
1638
|
+
// Defaults and Agent blocks may retain settings for a removed declaration.
|
|
1639
|
+
// Their presence must never register a backend or disable another selection.
|
|
1621
1640
|
if (config?.active_baseagent !== undefined && !isSupportedBaseagent(config.active_baseagent)) {
|
|
1622
1641
|
errors.push('/active_baseagent: plugin is not installed or discovered');
|
|
1623
1642
|
}
|
|
@@ -1720,6 +1739,8 @@ export function assertAgentModelConfigured(self, baseagent) {
|
|
|
1720
1739
|
const backend = baseagent ?? config.active_baseagent;
|
|
1721
1740
|
if (!backend)
|
|
1722
1741
|
throw new ConfigError('BASEAGENT_REQUIRED', 'Configure active_baseagent before enabling this Agent');
|
|
1742
|
+
if (usesNativeModelSelection(backend, config.baseagents?.[backend]))
|
|
1743
|
+
return;
|
|
1723
1744
|
const selection = resolveBaseagentModelSelection(backend, config.baseagents?.[backend]);
|
|
1724
1745
|
if (!selection?.model) {
|
|
1725
1746
|
throw new ConfigError('MODEL_NOT_CONFIGURED', `Configure baseagents.${backend}.model before enabling or selecting this backend`);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { listSupportedBaseagents } from '../
|
|
1
|
+
import { listSupportedBaseagents } from '../core/baseagent/baseagent.js';
|
|
2
2
|
/**
|
|
3
3
|
* gateway-config.ts — baseagent 模型选择与 provider 指认管理。
|
|
4
4
|
*
|
|
@@ -16,9 +16,9 @@ import fs from 'fs';
|
|
|
16
16
|
import path from 'path';
|
|
17
17
|
import { resolvePaths } from '../paths.js';
|
|
18
18
|
import { saveAgent } from '../config-store.js';
|
|
19
|
-
import { buildModelRequestHeaders } from '../
|
|
20
|
-
import { appendV1RequestPath } from '../
|
|
21
|
-
import {
|
|
19
|
+
import { buildModelRequestHeaders } from '../core/inference/request-identity.js';
|
|
20
|
+
import { appendV1RequestPath } from '../core/inference/request-identity.js';
|
|
21
|
+
import { apiPricingToQuad, prepareUsagePricing, pickGatewayQuad } from '../stats/model-resolver.js';
|
|
22
22
|
import { ipcQuery } from '../ipc.js';
|
|
23
23
|
import { logger } from '../utils/logger.js';
|
|
24
24
|
import { resolveProviderServiceForBaseagent } from './providers.js';
|
|
@@ -309,29 +309,8 @@ export async function gatewayTest(args) {
|
|
|
309
309
|
clearTimeout(timer);
|
|
310
310
|
}
|
|
311
311
|
}
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
if (!row)
|
|
315
|
-
return undefined;
|
|
316
|
-
return {
|
|
317
|
-
input: typeof row.price_input === 'number' ? row.price_input : undefined,
|
|
318
|
-
output: typeof row.price_output === 'number' ? row.price_output : undefined,
|
|
319
|
-
cache_read: typeof row.price_cache_read === 'number' ? row.price_cache_read : undefined,
|
|
320
|
-
cache_write: typeof row.price_cache_creation === 'number' ? row.price_cache_creation : undefined,
|
|
321
|
-
};
|
|
322
|
-
}
|
|
323
|
-
/** 从接口 pricing 对象提取四元组。 */
|
|
324
|
-
function apiPricingToQuad(p) {
|
|
325
|
-
if (!p || typeof p !== 'object')
|
|
326
|
-
return undefined;
|
|
327
|
-
return {
|
|
328
|
-
input: typeof p.input === 'number' ? p.input : undefined,
|
|
329
|
-
output: typeof p.output === 'number' ? p.output : undefined,
|
|
330
|
-
cache_read: typeof p.cache_read === 'number' ? p.cache_read : undefined,
|
|
331
|
-
cache_write: typeof p.cache_write === 'number' ? p.cache_write : undefined,
|
|
332
|
-
};
|
|
333
|
-
}
|
|
334
|
-
/** gatewayModels — 拉取该网关模型列表 + 官方价格 + 网关价格(接口缺失则回退 model-prices.jsonl)。 */
|
|
312
|
+
// ── 模型 + 价格 ──
|
|
313
|
+
/** gatewayModels — 拉取当前网关模型与价格;缺官方价时仅从参考端点补官方价。 */
|
|
335
314
|
export async function gatewayModels(args) {
|
|
336
315
|
const scope = String(args?.scope ?? '').trim();
|
|
337
316
|
const type = args?.type;
|
|
@@ -370,26 +349,31 @@ export async function gatewayModels(args) {
|
|
|
370
349
|
clearTimeout(timer);
|
|
371
350
|
}
|
|
372
351
|
const evolcoreHome = resolvePaths().root;
|
|
373
|
-
const
|
|
352
|
+
const ids = arr.map(m => typeof m === 'string' ? m : (m?.id || m?.name || m?.model))
|
|
353
|
+
.filter((id) => typeof id === 'string' && !!id);
|
|
354
|
+
const direct = new Map(arr.flatMap(m => {
|
|
355
|
+
const id = typeof m === 'string' ? m : (m?.id || m?.name || m?.model);
|
|
356
|
+
const quad = apiPricingToQuad(m?.pricing);
|
|
357
|
+
return typeof id === 'string' && quad ? [[id, quad]] : [];
|
|
358
|
+
}));
|
|
359
|
+
const pricing = await prepareUsagePricing({ official: direct, gateway: new Map() }, ids);
|
|
374
360
|
const models = arr.map((m) => {
|
|
375
361
|
const id = typeof m === 'string' ? m : (m?.id || m?.name || m?.model);
|
|
376
362
|
if (!id)
|
|
377
363
|
return null;
|
|
378
364
|
const name = (m && typeof m === 'object' && m.name) ? m.name : id;
|
|
379
365
|
const group = (m && typeof m === 'object' && m.group) ? m.group : undefined;
|
|
380
|
-
//
|
|
366
|
+
// 官方价格:当前网关 pricing 优先,缺失则使用参考端点 pricing。
|
|
381
367
|
let official = apiPricingToQuad(m?.pricing);
|
|
382
368
|
let officialSource = official ? 'gateway' : 'none';
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
if (
|
|
387
|
-
|
|
388
|
-
officialSource = 'local';
|
|
389
|
-
}
|
|
369
|
+
const usingReference = !official && pricing?.officialFallback !== undefined;
|
|
370
|
+
if (usingReference) {
|
|
371
|
+
official = pickGatewayQuad(evolcoreHome, pricing.officialFallback.prices, id) ?? undefined;
|
|
372
|
+
if (official)
|
|
373
|
+
officialSource = 'reference';
|
|
390
374
|
}
|
|
391
375
|
// 网关价格:接口 effective_pricing;缺失则留空(用户可手动设)
|
|
392
|
-
const gatewayPrice = apiPricingToQuad(m?.effective_pricing);
|
|
376
|
+
const gatewayPrice = usingReference ? undefined : apiPricingToQuad(m?.effective_pricing);
|
|
393
377
|
return { id, name, group, official: official ?? null, officialSource, gateway: gatewayPrice ?? null };
|
|
394
378
|
}).filter(Boolean);
|
|
395
379
|
return { data: { scope, type, models, usdToCny } };
|
|
@@ -50,7 +50,7 @@ export function parseInvokeArgv(argv) {
|
|
|
50
50
|
argumentError('--provider is required');
|
|
51
51
|
if (!serviceType)
|
|
52
52
|
argumentError('--service is required');
|
|
53
|
-
if (
|
|
53
|
+
if (!/^[\p{L}\p{N} _-]+$/u.test(providerId) || providerId !== providerId.trim() || PROHIBITED.has(providerId))
|
|
54
54
|
argumentError('invalid provider id');
|
|
55
55
|
if (!SAFE_ID.test(serviceType) || PROHIBITED.has(serviceType))
|
|
56
56
|
argumentError('invalid service type');
|
|
@@ -59,13 +59,15 @@ export function normalizeSingleOwnerRecord(value) {
|
|
|
59
59
|
delete normalized.owner;
|
|
60
60
|
return normalized;
|
|
61
61
|
}
|
|
62
|
-
/**
|
|
62
|
+
/** Drop retired root ownership hints; keep channel binding configuration. */
|
|
63
63
|
export function normalizeOwnerConfigTree(value, options = {}) {
|
|
64
64
|
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
65
65
|
return value;
|
|
66
66
|
const normalized = { ...value };
|
|
67
|
-
//
|
|
68
|
-
//
|
|
67
|
+
// Agent and daemon ownership comes exclusively from protocol consensus.
|
|
68
|
+
// Reads normalize in memory; supported writers validate before persisting.
|
|
69
|
+
delete normalized.owner;
|
|
70
|
+
delete normalized.owners;
|
|
69
71
|
if (options.projectChannels !== false && Array.isArray(normalized.channels)) {
|
|
70
72
|
normalized.channels = normalized.channels.map((channel) => normalizeSingleOwnerRecord(channel));
|
|
71
73
|
}
|
|
@@ -3,10 +3,9 @@ import fs from 'fs';
|
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import { isValidAid } from '../aun/aid/validation.js';
|
|
5
5
|
import { agentConfig, agentPeerAuditPath, agentPeerConfig, agentDir, agentRelationConfig, resolvePaths } from '../paths.js';
|
|
6
|
-
import { atomicReadJson, atomicWrite, atomicWriteJson } from '../utils/atomic-write.js';
|
|
7
|
-
import { fileCache } from '../core/daemon-file-cache.js';
|
|
6
|
+
import { atomicReadJson, atomicWrite, atomicWriteJson, ensureManagedLockParent, resolveManagedLockPath } from '../utils/atomic-write.js';
|
|
7
|
+
import { fileCache } from '../core/daemon/daemon-file-cache.js';
|
|
8
8
|
import { unregisterFile } from '../core/file-integrity/store.js';
|
|
9
|
-
import { ensureManagedLockParent, resolveManagedLockPath } from '../core/runtime-lock.js';
|
|
10
9
|
import { formatPeerKey, readAunPeerKind } from '../core/relation/peer-identity.js';
|
|
11
10
|
import { ConfigTarget, notifyConfigWrite, validateConfig } from './config-manager.js';
|
|
12
11
|
import { isPeerBindingEligible } from './peer-book.js';
|
package/dist/config/peer-book.js
CHANGED
|
@@ -4,8 +4,8 @@ import { isValidAid } from '../aun/aid/validation.js';
|
|
|
4
4
|
import { ConfigTarget, read, validateConfig } from './config-manager.js';
|
|
5
5
|
import { PeerMutationError, peerRevision, resolvePeerAidKind, mutatePeerBookSync } from './peer-book-store.js';
|
|
6
6
|
import { formatContactAlias, normalizeContactChannelKey, parseContactAlias, } from './peer-alias.js';
|
|
7
|
-
import { readOwnerDirectoryMembership } from '../directory/
|
|
8
|
-
import { readRemark, splitAliases } from '../directory/
|
|
7
|
+
import { readOwnerDirectoryMembership } from '../directory/admission.js';
|
|
8
|
+
import { readRemark, splitAliases } from '../directory/remarks.js';
|
|
9
9
|
import { readAccessPolicy } from './access-policy.js';
|
|
10
10
|
import { ownerResolver } from '../core/ownership/owner-resolver.js';
|
|
11
11
|
export class PeerBookError extends Error {
|
|
@@ -9,12 +9,12 @@ import { isManagementRole } from './builtin-roles.js';
|
|
|
9
9
|
import { getRoleDefinition, getRoleRank, normalizeDefaultRole, roleExists } from './roles.js';
|
|
10
10
|
import { getStoredRoleRegistry, roleRegistryExists } from './role-store.js';
|
|
11
11
|
import { resolvePrincipal } from './peer-book.js';
|
|
12
|
-
import { tryParseChannelKey } from '../core/channel-loader.js';
|
|
12
|
+
import { tryParseChannelKey } from '../core/channel/channel-loader.js';
|
|
13
13
|
import { isValidAid } from '../aun/aid/validation.js';
|
|
14
14
|
import { getOwners, ownerResolver } from '../core/ownership/owner-resolver.js';
|
|
15
15
|
import { prepareSameOwnerProof, sameOwnerQualification, sameOwnerRevision, requiresSameOwnerProof } from '../core/relation/same-owner-proof.js';
|
|
16
16
|
import { readRoleStore } from './role-store.js';
|
|
17
|
-
import { isOwnerDirectoryContact } from '../directory/
|
|
17
|
+
import { isOwnerDirectoryContact } from '../directory/admission.js';
|
|
18
18
|
export function isAuthenticated(userId) {
|
|
19
19
|
return isValidAid(String(userId || '').trim());
|
|
20
20
|
}
|