evolcore 0.0.1 → 0.0.2
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 +813 -0
- package/LICENSE +21 -0
- package/MIGRATION-0.5.0.md +378 -0
- package/README.md +318 -14
- package/ROLE_ACCESS_CONTROL.md +174 -0
- package/assets/.env.template +4 -0
- package/assets/brand/evolcore/README.md +19 -0
- package/assets/brand/evolcore/evolcore-app-icon.png +0 -0
- package/assets/brand/evolcore/evolcore-app-icon.svg +13 -0
- package/assets/brand/evolcore/evolcore-brand-board.png +0 -0
- package/assets/brand/evolcore/evolcore-brand-board.svg +126 -0
- package/assets/brand/evolcore/evolcore-logo-kit.zip +0 -0
- package/assets/brand/evolcore/evolcore-logo-reverse.png +0 -0
- package/assets/brand/evolcore/evolcore-logo-reverse.svg +14 -0
- package/assets/brand/evolcore/evolcore-logo.png +0 -0
- package/assets/brand/evolcore/evolcore-logo.svg +14 -0
- package/assets/brand/evolcore/evolcore-mark.png +0 -0
- package/assets/brand/evolcore/evolcore-mark.svg +10 -0
- package/bin/ec-safe-output.js +161 -0
- package/bin/ec.js +29 -0
- package/dist/agents/baseagent.js +163 -0
- package/dist/agents/claude-runner.js +2385 -0
- package/dist/agents/codex-app-server-client.js +448 -0
- package/dist/agents/codex-runner.js +2639 -0
- package/dist/agents/gemini-runner.js +666 -0
- package/dist/agents/runner-types.js +75 -0
- package/dist/aun/aid/agentmd.js +216 -0
- package/dist/aun/aid/client.js +132 -0
- package/dist/aun/aid/control-aid.js +91 -0
- package/dist/aun/aid/identity.js +518 -0
- package/dist/aun/aid/index.js +4 -0
- package/dist/aun/aid/store.js +74 -0
- package/dist/aun/aid/types.js +1 -0
- package/dist/aun/aid/validation.js +21 -0
- package/dist/aun/group-identity.js +10 -0
- package/dist/aun/msg/group-index.js +6 -0
- package/dist/aun/msg/group.js +1231 -0
- package/dist/aun/msg/history.js +123 -0
- package/dist/aun/msg/index.js +5 -0
- package/dist/aun/msg/p2p.js +393 -0
- package/dist/aun/msg/payload-type.js +27 -0
- package/dist/aun/msg/upload.js +137 -0
- package/dist/aun/outbox.js +160 -0
- package/dist/aun/rpc/caller.js +42 -0
- package/dist/aun/rpc/connection.js +25 -0
- package/dist/aun/rpc/index.js +2 -0
- package/dist/aun/service-proxy.js +225 -0
- package/dist/aun/storage/download.js +29 -0
- package/dist/aun/storage/index.js +3 -0
- package/dist/aun/storage/manage.js +10 -0
- package/dist/aun/storage/upload.js +68 -0
- package/dist/channels/aun.js +4147 -0
- package/dist/channels/daemon.js +422 -0
- package/dist/channels/dingtalk.js +649 -0
- package/dist/channels/feishu.js +1789 -0
- package/dist/channels/qqbot.js +409 -0
- package/dist/channels/wechat.js +817 -0
- package/dist/channels/wecom.js +565 -0
- package/dist/cli/agent-command.js +641 -0
- package/dist/cli/agent.js +1059 -0
- package/dist/cli/aun-commands.js +1948 -0
- package/dist/cli/bench.js +1228 -0
- package/dist/cli/cli-argv.js +66 -0
- package/dist/cli/code-stats.js +329 -0
- package/dist/cli/command-log.js +82 -0
- package/dist/cli/config-selector.js +69 -0
- package/dist/cli/config.js +261 -0
- package/dist/cli/ctl-command.js +62 -0
- package/dist/cli/daemon-commands.js +2887 -0
- package/dist/cli/fs-command.js +1447 -0
- package/dist/cli/handoff-command.js +302 -0
- package/dist/cli/help.js +31 -0
- package/dist/cli/index.js +358 -0
- package/dist/cli/init-channel.js +1377 -0
- package/dist/cli/init.js +553 -0
- package/dist/cli/link-rules.js +240 -0
- package/dist/cli/model.js +590 -0
- package/dist/cli/net-check.js +723 -0
- package/dist/cli/queue-command.js +126 -0
- package/dist/cli/response.js +345 -0
- package/dist/cli/restart-monitor.js +456 -0
- package/dist/cli/stats.js +607 -0
- package/dist/cli/task-context.js +80 -0
- package/dist/cli/trigger-command.js +505 -0
- package/dist/cli/version.js +88 -0
- package/dist/cli/watch-logs.js +33 -0
- package/dist/cli/watch-msg.js +673 -0
- package/dist/config/boot-log.js +266 -0
- package/dist/config/builtin-role-templates.js +30 -0
- package/dist/config/builtin-roles.js +85 -0
- package/dist/config/config-batch-get.js +11 -0
- package/dist/config/config-field-policy.js +261 -0
- package/dist/config/config-manager.js +916 -0
- package/dist/config/config-operation-service.js +384 -0
- package/dist/config/contact-book.js +371 -0
- package/dist/config/gateway-config.js +858 -0
- package/dist/config/lifecycle.js +17 -0
- package/dist/config/mention-mode.js +27 -0
- package/dist/config/merge.js +161 -0
- package/dist/config/owner-policy.js +4 -0
- package/dist/config/peer-role-resolver.js +139 -0
- package/dist/config/resolved-config-op.js +483 -0
- package/dist/config/role-config-v4-startup.js +32 -0
- package/dist/config/role-config-v5-startup.js +27 -0
- package/dist/config/role-schema.js +105 -0
- package/dist/config/role-service.js +159 -0
- package/dist/config/role-store.js +204 -0
- package/dist/config/roles.js +55 -0
- package/dist/config/schema-registry.js +154 -0
- package/dist/config/snapshot.js +598 -0
- package/dist/config-store.js +503 -0
- package/dist/core/auth/agent-delegation.js +111 -0
- package/dist/core/auth/auth-gateway.js +166 -0
- package/dist/core/auth/authenticated-actor.js +6 -0
- package/dist/core/auth/authorization-audit.js +110 -0
- package/dist/core/auth/operation-authorizer.js +718 -0
- package/dist/core/auth/operation-catalog.js +675 -0
- package/dist/core/baseagent-loader.js +54 -0
- package/dist/core/bootstrap-service.js +175 -0
- package/dist/core/capability/capability-manager.js +316 -0
- package/dist/core/capability/providers/claude-capability-provider.js +176 -0
- package/dist/core/capability/providers/codex-capability-provider.js +148 -0
- package/dist/core/capability/providers/gemini-capability-provider.js +10 -0
- package/dist/core/capability/types.js +27 -0
- package/dist/core/causation/audit.js +103 -0
- package/dist/core/causation/aun-association.js +111 -0
- package/dist/core/causation/context.js +93 -0
- package/dist/core/causation/index.js +4 -0
- package/dist/core/causation/types.js +2 -0
- package/dist/core/channel-loader.js +277 -0
- package/dist/core/command/agent-control.js +616 -0
- package/dist/core/command/cli-intent-parser.js +225 -0
- package/dist/core/command/command-handler.js +1638 -0
- package/dist/core/command/menu-handler.js +3354 -0
- package/dist/core/command/menu-protocol.js +247 -0
- package/dist/core/command/role-menu.js +1524 -0
- package/dist/core/command/slash-gate.js +148 -0
- package/dist/core/command/slash-handler.js +3056 -0
- package/dist/core/daemon-file-cache.js +216 -0
- package/dist/core/event-bus.js +32 -0
- package/dist/core/event-catalog.js +740 -0
- package/dist/core/evolagent-registry.js +546 -0
- package/dist/core/evolagent.js +331 -0
- package/dist/core/handoff/dispatcher.js +229 -0
- package/dist/core/handoff/mutex.js +46 -0
- package/dist/core/handoff/runtime.js +324 -0
- package/dist/core/handoff/store.js +537 -0
- package/dist/core/handoff/types.js +12 -0
- package/dist/core/inference/text-inference.js +173 -0
- package/dist/core/interaction-registration.js +10 -0
- package/dist/core/interaction-router.js +278 -0
- package/dist/core/message/create-status.js +67 -0
- package/dist/core/message/im-renderer.js +657 -0
- package/dist/core/message/items-formatter.js +76 -0
- package/dist/core/message/logical-queue-bridge.js +123 -0
- package/dist/core/message/message-bridge.js +803 -0
- package/dist/core/message/message-cache.js +56 -0
- package/dist/core/message/message-log.js +339 -0
- package/dist/core/message/message-processor.js +4 -0
- package/dist/core/message/message-queue.js +1436 -0
- package/dist/core/message/message-utils.js +70 -0
- package/dist/core/message/peer-mode.js +105 -0
- package/dist/core/message/pending-hints.js +232 -0
- package/dist/core/message/response-depth.js +33 -0
- package/dist/core/message/response-engine.js +3776 -0
- package/dist/core/message/response-snapshot.js +83 -0
- package/dist/core/message/stream-debouncer.js +130 -0
- package/dist/core/message/stream-idle-monitor.js +124 -0
- package/dist/core/model/config-scope.js +162 -0
- package/dist/core/model/field-scope.js +78 -0
- package/dist/core/model/model-catalog.js +227 -0
- package/dist/core/model/model-diagnostics.js +182 -0
- package/dist/core/model/model-permission.js +90 -0
- package/dist/core/permission/approval-gateway.js +1017 -0
- package/dist/core/permission/ec-command-parser.js +347 -0
- package/dist/core/permission/execution-sandbox.js +16 -0
- package/dist/core/permission/index.js +6 -0
- package/dist/core/permission/mode.js +24 -0
- package/dist/core/permission/sandbox-runtime.js +265 -0
- package/dist/core/permission/tool-policy.js +987 -0
- package/dist/core/permission/unix-socket-policy.js +99 -0
- package/dist/core/protected-paths.js +330 -0
- package/dist/core/relation/peer-identity.js +222 -0
- package/dist/core/relation/peer-key.js +1 -0
- package/dist/core/role/runtime-policy.js +141 -0
- package/dist/core/session/adapters/claude-session-file-adapter.js +218 -0
- package/dist/core/session/adapters/codex-session-file-adapter.js +333 -0
- package/dist/core/session/adapters/gemini-session-file-adapter.js +181 -0
- package/dist/core/session/session-file-adapter.js +7 -0
- package/dist/core/session/session-file-health.js +45 -0
- package/dist/core/session/session-fs-store.js +232 -0
- package/dist/core/session/session-key.js +24 -0
- package/dist/core/session/session-manager.js +1587 -0
- package/dist/core/session/session-mapper.js +100 -0
- package/dist/core/session/session-renew.js +314 -0
- package/dist/core/session/session-title.js +128 -0
- package/dist/core/session/session-turn-coordinator.js +205 -0
- package/dist/core/session/session-turns.js +67 -0
- package/dist/core/system-channels.js +29 -0
- package/dist/eck/baseagent-caps.js +18 -0
- package/dist/eck/detect.js +47 -0
- package/dist/eck/group-rules-sync.js +345 -0
- package/dist/eck/init.js +77 -0
- package/dist/eck/kit-renderer.js +359 -0
- package/dist/eck/manifest-engine.js +446 -0
- package/dist/eck/message-renderer.js +199 -0
- package/dist/eck/rules-loader.js +28 -0
- package/dist/index.js +2870 -4
- package/dist/ipc.js +748 -0
- package/dist/paths.js +262 -0
- package/dist/product.js +18 -0
- package/dist/response-system/context-builder.js +71 -0
- package/dist/response-system/coordinator.js +117 -0
- package/dist/response-system/decision-executor.js +86 -0
- package/dist/response-system/engines/v1/index.js +21 -0
- package/dist/response-system/engines/v1/interactive-flow.js +27 -0
- package/dist/response-system/engines/v1/proactive-flow.js +137 -0
- package/dist/response-system/engines/v1/types.js +1 -0
- package/dist/response-system/extensions.js +41 -0
- package/dist/response-system/index.js +6 -0
- package/dist/response-system/modes/index.js +7 -0
- package/dist/response-system/modes/single-session/index.js +72 -0
- package/dist/response-system/queues/fifo-queue.js +44 -0
- package/dist/response-system/queues/index.js +6 -0
- package/dist/response-system/queues/lifo-queue.js +42 -0
- package/dist/response-system/queues/priority-queue.js +63 -0
- package/dist/response-system/registry.js +97 -0
- package/dist/response-system/resolver.js +37 -0
- package/dist/response-system/selector.js +23 -0
- package/dist/response-system/types.js +7 -0
- package/dist/stats/billing.js +151 -0
- package/dist/stats/budget.js +93 -0
- package/dist/stats/db.js +403 -0
- package/dist/stats/eck-vars.js +89 -0
- package/dist/stats/index.js +11 -0
- package/dist/stats/normalizer.js +80 -0
- package/dist/stats/price-resolver.js +138 -0
- package/dist/stats/query.js +763 -0
- package/dist/stats/role-budget.js +168 -0
- package/dist/stats/writer.js +151 -0
- package/dist/trigger/anomaly-store.js +258 -0
- package/dist/trigger/audit.js +152 -0
- package/dist/trigger/event-source.js +119 -0
- package/dist/trigger/feedback.js +685 -0
- package/dist/trigger/history.js +290 -0
- package/dist/trigger/manager.js +291 -0
- package/dist/trigger/parser.js +520 -0
- package/dist/trigger/patch.js +148 -0
- package/dist/trigger/scheduler.js +1600 -0
- package/dist/trigger/script-executor.js +155 -0
- package/dist/trigger/state.js +145 -0
- package/dist/trigger/types.js +1 -0
- package/dist/trigger/validation.js +621 -0
- package/dist/types.js +12 -0
- package/dist/utils/aid-bind.js +299 -0
- package/dist/utils/atomic-write.js +95 -0
- package/dist/utils/avatar-upload.js +123 -0
- package/dist/utils/cross-platform.js +297 -0
- package/dist/utils/ecweb-utils.js +73 -0
- package/dist/utils/error-dict.json +153 -0
- package/dist/utils/error-utils.js +349 -0
- package/dist/utils/instance-registry.js +437 -0
- package/dist/utils/locale.js +21 -0
- package/dist/utils/log-writer.js +224 -0
- package/dist/utils/logger.js +89 -0
- package/dist/utils/markdown-to-plain-text.js +20 -0
- package/dist/utils/media-cache.js +271 -0
- package/dist/utils/model-prices.jsonl +17 -0
- package/dist/utils/npm-ops.js +210 -0
- package/dist/utils/process-introspect.js +133 -0
- package/dist/utils/process-tree-stats.js +271 -0
- package/dist/utils/project-path.js +74 -0
- package/dist/utils/stats.js +410 -0
- package/dist/utils/tool-summary.js +284 -0
- package/dist/utils/welcome.js +268 -0
- package/kits/docs/GUIDE.md +20 -0
- package/kits/docs/INDEX.md +65 -0
- package/kits/docs/aun/CHEATSHEET.md +19 -0
- package/kits/docs/aun/SYNC_PROTOCOL.md +15 -0
- package/kits/docs/channels/aun.md +65 -0
- package/kits/docs/channels/feishu.md +56 -0
- package/kits/docs/context-assembly.md +366 -0
- package/kits/docs/eck_templates/GUIDE.template.md +22 -0
- package/kits/docs/eck_templates/INDEX.template.md +28 -0
- package/kits/docs/eck_templates/path-registry.template.md +33 -0
- package/kits/docs/eck_templates/runtime.template.md +19 -0
- package/kits/docs/evolcore/INDEX.md +66 -0
- package/kits/docs/evolcore/agent.md +69 -0
- package/kits/docs/evolcore/aid.md +49 -0
- package/kits/docs/evolcore/config.md +149 -0
- package/kits/docs/evolcore/ctl.md +46 -0
- package/kits/docs/evolcore/event.md +216 -0
- package/kits/docs/evolcore/fs-architecture.md +1215 -0
- package/kits/docs/evolcore/fs.md +101 -0
- package/kits/docs/evolcore/group-fs.md +17 -0
- package/kits/docs/evolcore/group-rules.md +226 -0
- package/kits/docs/evolcore/group.md +141 -0
- package/kits/docs/evolcore/model.md +47 -0
- package/kits/docs/evolcore/msg.md +130 -0
- package/kits/docs/evolcore/response.md +80 -0
- package/kits/docs/evolcore/rpc.md +35 -0
- package/kits/docs/evolcore/self-summary.md +29 -0
- package/kits/docs/evolcore/stats.md +70 -0
- package/kits/docs/evolcore/storage.md +49 -0
- package/kits/docs/evolcore/trigger.md +524 -0
- package/kits/docs/identity/AID_PROFILE_SPEC.md +26 -0
- package/kits/docs/identity/PATH_OPS.md +16 -0
- package/kits/docs/identity/ROLE_DETAIL.md +23 -0
- package/kits/docs/identity/identity-tools.md +26 -0
- package/kits/docs/path-registry.md +43 -0
- package/kits/docs/prompt-loading-architecture.md +266 -0
- package/kits/docs/venues/aun-group.md +45 -0
- package/kits/docs/venues/aun-private.md +10 -0
- package/kits/docs/venues/client-desktop.md +10 -0
- package/kits/docs/venues/client-mobile.md +10 -0
- package/kits/docs/venues/feishu-group.md +13 -0
- package/kits/docs/venues/feishu-private.md +9 -0
- package/kits/docs/venues/group.md +25 -0
- package/kits/docs/venues/private.md +10 -0
- package/kits/eck_manifest.auxiliary.json +43 -0
- package/kits/eck_manifest.json +191 -0
- package/kits/eck_message_manifest.json +63 -0
- package/kits/migrations/README-role-config-v4.md +32 -0
- package/kits/migrations/migrate-role-config-v4.mjs +623 -0
- package/kits/migrations/migrate-role-config-v5.mjs +346 -0
- package/kits/migrations/rename-config-file.mjs +99 -0
- package/kits/rules/01-overview.md +142 -0
- package/kits/rules/02-navigation.md +76 -0
- package/kits/rules/03-identity.md +34 -0
- package/kits/rules/04-relation.md +59 -0
- package/kits/rules/05-venue.md +44 -0
- package/kits/rules/06-channel.md +59 -0
- package/kits/schemas/_meta.json +29 -0
- package/kits/schemas/agent-config.schema.1.json +177 -0
- package/kits/schemas/agent-config.schema.2.json +239 -0
- package/kits/schemas/agent-config.schema.3.json +119 -0
- package/kits/schemas/agent-config.schema.4.json +208 -0
- package/kits/schemas/agent-config.schema.5.json +326 -0
- package/kits/schemas/contact-book.schema.1.json +36 -0
- package/kits/schemas/daemon.schema.1.json +90 -0
- package/kits/schemas/defaults.schema.1.json +81 -0
- package/kits/schemas/menu-exec-schema-commands.md +208 -0
- package/kits/schemas/migrations/README.md +28 -0
- package/kits/schemas/relation-config.schema.1.json +158 -0
- package/kits/schemas/relation-config.schema.2.json +73 -0
- package/kits/schemas/relation-config.schema.3.json +50 -0
- package/kits/schemas/relation-config.schema.4.json +47 -0
- package/kits/schemas/role-config.schema.1.json +200 -0
- package/kits/schemas/role-registry.schema.1.json +35 -0
- package/kits/schemas/single-session.schema.1.json +31 -0
- package/kits/templates/bootstrap-welcome.md +15 -0
- package/kits/templates/message-fragments/handoff-request-to-target.md +13 -0
- package/kits/templates/message-fragments/handoff-response-to-origin.md +10 -0
- package/kits/templates/message-fragments/inject-default.md +2 -0
- package/kits/templates/message-fragments/item.md +2 -0
- package/kits/templates/roles/admin.json +8 -0
- package/kits/templates/roles/member.json +40 -0
- package/kits/templates/roles/owner.json +8 -0
- package/kits/templates/roles/visitor.json +39 -0
- package/kits/templates/system-fragments/baseagent.md +14 -0
- package/kits/templates/system-fragments/bootstrap.md +16 -0
- package/kits/templates/system-fragments/channel.md +48 -0
- package/kits/templates/system-fragments/commands.md +26 -0
- package/kits/templates/system-fragments/identity.md +11 -0
- package/kits/templates/system-fragments/relation.md +19 -0
- package/kits/templates/system-fragments/session.md +53 -0
- package/kits/templates/system-fragments/venue.md +31 -0
- package/package.json +50 -15
- package/dist/index.d.ts +0 -7
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 eLeanwang
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
# Evolcore 0.5.0 迁移指南
|
|
2
|
+
|
|
3
|
+
> 版本:0.5.0
|
|
4
|
+
> 发布日期:2026-06-19
|
|
5
|
+
> 重大变更:配置系统 v3 重构 + 类型系统简化
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 概述
|
|
10
|
+
|
|
11
|
+
0.5.0 版本对配置系统进行了重大重构,主要变更:
|
|
12
|
+
|
|
13
|
+
1. **删除 behavior.json** - 所有参数统一在 config.json
|
|
14
|
+
2. **删除 BehaviorConfig 类型** - 统一使用 AgentConfig/EffectiveAgentConfig
|
|
15
|
+
3. **删除 MergedAgentConfig 类型** - 统一使用 EffectiveAgentConfig
|
|
16
|
+
4. **简化覆盖链** - defaults → agent/config → relation/config
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## 破坏性变更
|
|
21
|
+
|
|
22
|
+
### 1. behavior.json 已删除
|
|
23
|
+
|
|
24
|
+
**变更说明**:
|
|
25
|
+
- ❌ 不再有 `agents/<aid>/behavior.json`
|
|
26
|
+
- ❌ 不再有 `agents/<aid>/relations/<peerKey>/preferences.json`
|
|
27
|
+
- ✅ 所有参数统一在 `config.json`
|
|
28
|
+
|
|
29
|
+
**迁移步骤**:
|
|
30
|
+
|
|
31
|
+
#### 如果你有自定义的 behavior.json:
|
|
32
|
+
|
|
33
|
+
**原文件结构**:
|
|
34
|
+
```
|
|
35
|
+
agents/mybot.agent/
|
|
36
|
+
├── config.json # 身份、凭证、渠道
|
|
37
|
+
└── behavior.json # 模型、对话模式、权限
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
**新文件结构**:
|
|
41
|
+
```
|
|
42
|
+
agents/mybot.agent/
|
|
43
|
+
└── config.json # 所有参数统一
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
**手动合并示例**:
|
|
47
|
+
|
|
48
|
+
```json
|
|
49
|
+
// 原 config.json(身份信息)
|
|
50
|
+
{
|
|
51
|
+
"aid": "mybot.agent",
|
|
52
|
+
"owners": ["admin.user"],
|
|
53
|
+
"channels": [...]
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// 原 behavior.json(行为参数)
|
|
57
|
+
{
|
|
58
|
+
"active_baseagent": "claude",
|
|
59
|
+
"baseagents": {
|
|
60
|
+
"claude": { "model": "opus-4.8", "effort": "high" }
|
|
61
|
+
},
|
|
62
|
+
"chatmode": { "private": "proactive" }
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// 合并后的 config.json
|
|
66
|
+
{
|
|
67
|
+
"aid": "mybot.agent",
|
|
68
|
+
"owners": ["admin.user"],
|
|
69
|
+
"channels": [...],
|
|
70
|
+
"active_baseagent": "claude",
|
|
71
|
+
"baseagents": {
|
|
72
|
+
"claude": { "model": "opus-4.8", "effort": "high" }
|
|
73
|
+
},
|
|
74
|
+
"chatmode": { "private": "proactive" }
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**自动迁移**:
|
|
79
|
+
- 启动时会自动检测并合并 behavior.json 到 config.json
|
|
80
|
+
- 迁移后 behavior.json 会被重命名为 `.migrated-to-config`
|
|
81
|
+
|
|
82
|
+
#### 如果你有关系级 preferences.json:
|
|
83
|
+
|
|
84
|
+
**原路径**:`agents/<aid>/relations/<peerKey>/preferences.json`
|
|
85
|
+
|
|
86
|
+
**新路径**:`agents/<aid>/relations/<peerKey>/config.json`
|
|
87
|
+
|
|
88
|
+
**迁移**:
|
|
89
|
+
- 自动迁移,将 preferences.json 合并到 config.json
|
|
90
|
+
- 原文件重命名为 `.migrated-to-config`
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
### 2. BehaviorConfig 类型已删除
|
|
95
|
+
|
|
96
|
+
**变更说明**:
|
|
97
|
+
- ❌ `BehaviorConfig` 接口已删除
|
|
98
|
+
- ✅ 使用 `AgentConfig`(存储层)或 `EffectiveAgentConfig`(运行时)
|
|
99
|
+
|
|
100
|
+
**如果你的代码引用了 BehaviorConfig**:
|
|
101
|
+
|
|
102
|
+
```typescript
|
|
103
|
+
// ❌ 旧代码
|
|
104
|
+
import type { BehaviorConfig } from 'evolcore/types';
|
|
105
|
+
|
|
106
|
+
function updateBehavior(config: BehaviorConfig) {
|
|
107
|
+
// ...
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// ✅ 新代码(完整配置)
|
|
111
|
+
import type { AgentConfig } from 'evolcore/types';
|
|
112
|
+
|
|
113
|
+
function updateBehavior(config: AgentConfig) {
|
|
114
|
+
// ...
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// ✅ 新代码(只需要部分字段)
|
|
118
|
+
import type { AgentConfig } from 'evolcore/types';
|
|
119
|
+
|
|
120
|
+
function updateBehavior(config: Partial<AgentConfig>) {
|
|
121
|
+
// ...
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// ✅ 新代码(运行时合并结果)
|
|
125
|
+
import type { EffectiveAgentConfig } from 'evolcore/types';
|
|
126
|
+
|
|
127
|
+
function getBehavior(): EffectiveAgentConfig {
|
|
128
|
+
// ...
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
**常见场景替换表**:
|
|
133
|
+
|
|
134
|
+
| 原用途 | 旧类型 | 新类型 |
|
|
135
|
+
|--------|--------|--------|
|
|
136
|
+
| 读取 agent 配置 | `BehaviorConfig` | `AgentConfig` |
|
|
137
|
+
| 读取关系级配置 | `BehaviorConfig` | `RelationConfig` |
|
|
138
|
+
| 运行时合并结果 | `BehaviorConfig` | `EffectiveAgentConfig` |
|
|
139
|
+
| 部分配置更新 | `Partial<BehaviorConfig>` | `Partial<AgentConfig>` |
|
|
140
|
+
| 只需要特定字段 | `Pick<BehaviorConfig, 'model' \| 'chatmode'>` | `Pick<AgentConfig, 'model' \| 'chatmode'>` |
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
### 3. MergedAgentConfig 类型已删除
|
|
145
|
+
|
|
146
|
+
**变更说明**:
|
|
147
|
+
- ❌ `MergedAgentConfig` 类型已删除
|
|
148
|
+
- ✅ 使用 `EffectiveAgentConfig`
|
|
149
|
+
|
|
150
|
+
**如果你的代码引用了 MergedAgentConfig**:
|
|
151
|
+
|
|
152
|
+
```typescript
|
|
153
|
+
// ❌ 旧代码
|
|
154
|
+
import type { MergedAgentConfig } from 'evolcore/types';
|
|
155
|
+
|
|
156
|
+
function processConfig(config: MergedAgentConfig) {
|
|
157
|
+
// ...
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// ✅ 新代码
|
|
161
|
+
import type { EffectiveAgentConfig } from 'evolcore/types';
|
|
162
|
+
|
|
163
|
+
function processConfig(config: EffectiveAgentConfig) {
|
|
164
|
+
// ...
|
|
165
|
+
}
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
**说明**:
|
|
169
|
+
- `MergedAgentConfig` 曾是 `AgentConfig & BehaviorConfig` 的合并类型
|
|
170
|
+
- v3 重构后简化为 `EffectiveAgentConfig` 的别名
|
|
171
|
+
- 现在直接使用 `EffectiveAgentConfig` 更清晰
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
### 4. mergeForAgent() 已弃用
|
|
176
|
+
|
|
177
|
+
**变更说明**:
|
|
178
|
+
- ⚠️ `mergeForAgent()` 标记为 `@deprecated`
|
|
179
|
+
- ✅ 使用 `ConfigManager.resolveEffective()`
|
|
180
|
+
|
|
181
|
+
**如果你的代码调用了 mergeForAgent**:
|
|
182
|
+
|
|
183
|
+
```typescript
|
|
184
|
+
// ❌ 旧代码
|
|
185
|
+
import { mergeForAgent, loadAgent, loadDefaults } from 'evolcore';
|
|
186
|
+
|
|
187
|
+
const agent = loadAgent('mybot.agent');
|
|
188
|
+
const defaults = loadDefaults();
|
|
189
|
+
const merged = mergeForAgent(agent, defaults);
|
|
190
|
+
|
|
191
|
+
// ✅ 新代码
|
|
192
|
+
import { resolveEffective } from 'evolcore/config/config-manager';
|
|
193
|
+
|
|
194
|
+
const effective = resolveEffective({ self: 'mybot.agent' });
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
**说明**:
|
|
198
|
+
- `mergeForAgent()` 仍可用但已弃用,计划 v2.2 删除
|
|
199
|
+
- `resolveEffective()` 是唯一的合并入口,支持完整覆盖链
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## 新功能
|
|
204
|
+
|
|
205
|
+
### 1. 统一的配置覆盖链
|
|
206
|
+
|
|
207
|
+
**覆盖链(优先级从低到高)**:
|
|
208
|
+
```
|
|
209
|
+
defaults → agent/config → relation/config
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
**示例**:
|
|
213
|
+
|
|
214
|
+
```typescript
|
|
215
|
+
import { resolveEffective } from 'evolcore/config/config-manager';
|
|
216
|
+
|
|
217
|
+
// Agent 级配置
|
|
218
|
+
const agentConfig = resolveEffective({
|
|
219
|
+
self: 'mybot.agent'
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
// 关系级配置(针对特定用户)
|
|
223
|
+
const relationConfig = resolveEffective({
|
|
224
|
+
self: 'mybot.agent',
|
|
225
|
+
peerKey: 'user123.user@channel'
|
|
226
|
+
});
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### 2. 角色级覆盖(新增)
|
|
230
|
+
|
|
231
|
+
**在 config.json 中定义角色**:
|
|
232
|
+
|
|
233
|
+
```json
|
|
234
|
+
{
|
|
235
|
+
"aid": "mybot.agent",
|
|
236
|
+
"active_baseagent": "claude",
|
|
237
|
+
"baseagents": {
|
|
238
|
+
"claude": { "model": "sonnet-4.6" }
|
|
239
|
+
},
|
|
240
|
+
"roles": {
|
|
241
|
+
"power-user": {
|
|
242
|
+
"baseagents": {
|
|
243
|
+
"claude": { "model": "opus-4.8", "effort": "high" }
|
|
244
|
+
},
|
|
245
|
+
"permissionMode": "owner"
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
**运行时解析**:
|
|
252
|
+
|
|
253
|
+
```typescript
|
|
254
|
+
import { resolveEffective } from 'evolcore/config/config-manager';
|
|
255
|
+
|
|
256
|
+
// 普通用户
|
|
257
|
+
const normalConfig = resolveEffective({
|
|
258
|
+
self: 'mybot.agent',
|
|
259
|
+
peerKey: 'user1.user@channel'
|
|
260
|
+
});
|
|
261
|
+
// → model: "sonnet-4.6"
|
|
262
|
+
|
|
263
|
+
// Power user
|
|
264
|
+
const powerConfig = resolveEffective({
|
|
265
|
+
self: 'mybot.agent',
|
|
266
|
+
peerKey: 'user2.user@channel',
|
|
267
|
+
role: 'power-user'
|
|
268
|
+
});
|
|
269
|
+
// → model: "opus-4.8", effort: "high"
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
---
|
|
273
|
+
|
|
274
|
+
## 非破坏性变更
|
|
275
|
+
|
|
276
|
+
### 1. 配置文件格式兼容
|
|
277
|
+
|
|
278
|
+
**旧格式仍然支持**:
|
|
279
|
+
- 如果只有 config.json(身份字段),仍然有效
|
|
280
|
+
- 如果有 behavior.json,会自动合并
|
|
281
|
+
- 如果有 preferences.json,会自动迁移
|
|
282
|
+
|
|
283
|
+
### 2. API 保持兼容
|
|
284
|
+
|
|
285
|
+
**这些函数签名未变**:
|
|
286
|
+
- `loadAgent(aid)` - 返回 AgentConfig
|
|
287
|
+
- `loadDefaults()` - 返回 DefaultsConfig
|
|
288
|
+
- `loadAllAgents()` - 返回 AgentConfig[]
|
|
289
|
+
|
|
290
|
+
**这些属性未变**:
|
|
291
|
+
- `EvolAgent.config` - 返回运行时配置(类型从 MergedAgentConfig 改为 EffectiveAgentConfig,字段不变)
|
|
292
|
+
- `AgentInfo.config` - 同上
|
|
293
|
+
|
|
294
|
+
---
|
|
295
|
+
|
|
296
|
+
## 检查清单
|
|
297
|
+
|
|
298
|
+
迁移到 0.5.0 时,检查以下内容:
|
|
299
|
+
|
|
300
|
+
### 配置文件
|
|
301
|
+
|
|
302
|
+
- [ ] 确认 behavior.json 已自动合并到 config.json
|
|
303
|
+
- [ ] 确认 preferences.json 已自动迁移到 config.json
|
|
304
|
+
- [ ] 检查 config.json 是否包含所有必要字段
|
|
305
|
+
|
|
306
|
+
### TypeScript 代码
|
|
307
|
+
|
|
308
|
+
- [ ] 将 `BehaviorConfig` 替换为 `AgentConfig` 或 `EffectiveAgentConfig`
|
|
309
|
+
- [ ] 将 `MergedAgentConfig` 替换为 `EffectiveAgentConfig`
|
|
310
|
+
- [ ] 将 `mergeForAgent()` 替换为 `resolveEffective()`
|
|
311
|
+
- [ ] 运行 TypeScript 编译检查类型错误
|
|
312
|
+
|
|
313
|
+
### 运行时测试
|
|
314
|
+
|
|
315
|
+
- [ ] 启动 agent,确认配置正确加载
|
|
316
|
+
- [ ] 测试模型切换功能
|
|
317
|
+
- [ ] 测试对话模式切换
|
|
318
|
+
- [ ] 测试关系级配置覆盖
|
|
319
|
+
|
|
320
|
+
---
|
|
321
|
+
|
|
322
|
+
## 常见问题
|
|
323
|
+
|
|
324
|
+
### Q1: 我的 behavior.json 会丢失吗?
|
|
325
|
+
|
|
326
|
+
**A**: 不会。
|
|
327
|
+
- 自动迁移会合并到 config.json
|
|
328
|
+
- 原 behavior.json 重命名为 `.migrated-to-config`
|
|
329
|
+
- 如果合并失败,会保留原文件并记录错误日志
|
|
330
|
+
|
|
331
|
+
### Q2: 我需要手动更新配置文件吗?
|
|
332
|
+
|
|
333
|
+
**A**: 不需要。
|
|
334
|
+
- 启动时自动检测并迁移
|
|
335
|
+
- 迁移成功后自动保存
|
|
336
|
+
- 只需确认迁移日志无错误
|
|
337
|
+
|
|
338
|
+
### Q3: 类型错误如何修复?
|
|
339
|
+
|
|
340
|
+
**A**: 按上述替换表修改:
|
|
341
|
+
```typescript
|
|
342
|
+
// BehaviorConfig → AgentConfig / EffectiveAgentConfig
|
|
343
|
+
// MergedAgentConfig → EffectiveAgentConfig
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
### Q4: mergeForAgent() 什么时候会删除?
|
|
347
|
+
|
|
348
|
+
**A**: 计划 v2.2 删除。
|
|
349
|
+
- 当前版本仍可用(已弃用)
|
|
350
|
+
- 建议尽快迁移到 `resolveEffective()`
|
|
351
|
+
|
|
352
|
+
### Q5: 如何回退到旧版本?
|
|
353
|
+
|
|
354
|
+
**A**:
|
|
355
|
+
```bash
|
|
356
|
+
npm install evolcore@0.4.x
|
|
357
|
+
```
|
|
358
|
+
- 如果已迁移,需要手动还原配置文件
|
|
359
|
+
- 建议迁移前备份 agents/ 目录
|
|
360
|
+
|
|
361
|
+
---
|
|
362
|
+
|
|
363
|
+
## 获取帮助
|
|
364
|
+
|
|
365
|
+
如果遇到迁移问题:
|
|
366
|
+
|
|
367
|
+
1. **查看日志**:`~/.evolcore/logs/boot.log`
|
|
368
|
+
2. **查看文档**:`docs/config/`
|
|
369
|
+
3. **提交 Issue**:https://github.com/your-org/evolcore/issues
|
|
370
|
+
|
|
371
|
+
---
|
|
372
|
+
|
|
373
|
+
## 相关文档
|
|
374
|
+
|
|
375
|
+
- [配置系统概览](docs/config/01-overview.md)
|
|
376
|
+
- [合并规则](docs/config/02-merge-rules.md)
|
|
377
|
+
- [配置 Schema](docs/config/03-schema.md)
|
|
378
|
+
- [BehaviorConfig 删除报告](docs/config/behaviorconfig-mergedconfig-removal-completion.md)
|