evolcore 0.0.49 → 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 +103 -3
- package/bin/ec-build.mjs +60 -0
- package/bin/ecmsg.js +64 -57
- package/dist/ability/caller/authorization.js +21 -0
- package/dist/ability/caller/command.js +173 -0
- package/dist/ability/caller/contract.js +117 -0
- package/dist/ability/caller/credential-files.js +132 -0
- package/dist/ability/caller/daemon.js +183 -0
- package/dist/ability/caller/schema-view.js +157 -0
- package/dist/ability/caller/service.js +519 -0
- package/dist/ability/command-contract.js +5 -0
- package/dist/ability/daemon.js +5 -1
- package/dist/ability/interop-v1.js +156 -106
- package/dist/ability/management.js +1 -0
- package/dist/agent-template/jobs.js +79 -3
- package/dist/agent-template/runtime.js +459 -47
- package/dist/agent-template/service.js +1242 -198
- package/dist/agent-template/share.js +103 -0
- package/dist/agent-template/tool-runner.js +25 -0
- package/dist/agent-template/types.js +10 -2
- 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} +78 -166
- 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} +652 -383
- 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 +96 -0
- package/dist/agents/{gemini-runner.js → gemini/runner.js} +18 -23
- package/dist/{core/session/adapters/gemini-session-file-adapter.js → agents/gemini/session-file-adapter.js} +2 -2
- package/dist/aun/ability-device-routing.js +11 -17
- package/dist/aun/aid/agentmd.js +27 -1
- package/dist/aun/aid/control-aid.js +52 -32
- package/dist/aun/aid/managed-operation.js +6 -4
- package/dist/aun/group/invite-service.js +7 -37
- package/dist/aun/group/operations.js +6 -0
- 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/mention-schema.js +1 -1
- package/dist/aun/msg/p2p.js +32 -4
- package/dist/aun/msg/upload.js +126 -3
- 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 +698 -213
- 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/claude-gateway/agent-registration.js +389 -0
- package/dist/claude-gateway/binding.js +96 -0
- package/dist/claude-gateway/inbox.js +138 -0
- package/dist/claude-gateway/index.js +125 -0
- package/dist/claude-gateway/listing.js +330 -0
- package/dist/claude-gateway/router.js +328 -0
- package/dist/claude-gateway/sessions.js +128 -0
- package/dist/claude-gateway/terminal.js +250 -0
- package/dist/claude-gateway/transcript.js +272 -0
- package/dist/claude-gateway/types.js +14 -0
- package/dist/cli/ability-command.js +45 -0
- package/dist/cli/ability-output.js +182 -0
- package/dist/cli/agent-command.js +21 -2
- package/dist/cli/agent-create.js +197 -56
- package/dist/cli/agent-template.js +400 -27
- package/dist/cli/agent.js +105 -11
- package/dist/cli/aun-commands.js +237 -123
- package/dist/cli/bench.js +5 -2
- package/dist/cli/config.js +22 -6
- package/dist/cli/daemon-commands.js +283 -109
- 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 +64 -26
- package/dist/cli/fs-command.js +67 -39
- package/dist/cli/index.js +45 -12
- package/dist/cli/init.js +161 -90
- package/dist/cli/managed-command-guard.js +3 -0
- package/dist/cli/menu-client.js +32 -7
- package/dist/cli/model.js +1 -1
- package/dist/cli/pay-command.js +30 -0
- package/dist/cli/provider-command.js +6 -2
- package/dist/cli/restart-monitor.js +4 -4
- package/dist/cli/services-command.js +35 -10
- 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 +81 -14
- package/dist/cli/trigger-command.js +47 -12
- package/dist/cli/watch-logs.js +2 -1
- package/dist/config/access-policy.js +16 -3
- package/dist/config/boot-log.js +3 -0
- package/dist/config/builtin-role-templates.js +1 -1
- package/dist/config/config-field-policy.js +26 -13
- package/dist/config/config-manager.js +113 -52
- package/dist/config/config-operation-service.js +22 -1
- package/dist/config/gateway-config.js +29 -44
- package/dist/config/invoke-ipc-service.js +1 -1
- package/dist/config/owner-config.js +5 -19
- package/dist/config/peer-book-store.js +2 -3
- package/dist/config/peer-book.js +2 -2
- package/dist/config/peer-role-resolver.js +3 -9
- 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 +138 -31
- package/dist/config/providers-import.js +3 -3
- package/dist/config/providers-management.js +109 -118
- package/dist/config/resolved-config-op.js +1 -42
- package/dist/config/schema-migration.js +254 -15
- package/dist/config/schema-registry.js +53 -8
- package/dist/config-store.js +1343 -63
- package/dist/core/{agent-application-service.js → agent/agent-application-service.js} +228 -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} +119 -25
- package/dist/core/{agent-reload-coordinator.js → agent/agent-reload-coordinator.js} +65 -0
- package/dist/core/{agent-runtime.js → agent/agent-runtime.js} +249 -79
- package/dist/core/{evolagent-registry.js → agent/evolagent-registry.js} +23 -18
- package/dist/core/{evolagent.js → agent/evolagent.js} +11 -11
- package/dist/core/auth/agent-delegation.js +15 -8
- package/dist/core/auth/delegation-authorization.js +28 -0
- package/dist/core/auth/operation-authorizer.js +20 -2
- package/dist/core/auth/operation-catalog.js +80 -8
- 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} +89 -6
- package/dist/core/baseagent/baseagent-model-defaults.js +26 -0
- package/dist/core/baseagent/baseagent-plugin-descriptor.js +357 -0
- 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 +91 -33
- 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} +21 -19
- package/dist/core/command/agent-control.js +80 -17
- package/dist/core/command/agent-template-menu.js +23 -10
- package/dist/core/command/agentmd-menu-request.js +19 -8
- package/dist/core/command/agentmd-menu.js +14 -5
- package/dist/core/command/cli-intent-parser.js +15 -0
- 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 +95 -19
- package/dist/core/command/menu-file-path.js +70 -0
- package/dist/core/command/menu-handler.js +392 -93
- package/dist/core/command/menu-protocol.js +47 -8
- package/dist/core/command/menu-query-batch.js +9 -5
- package/dist/core/command/private-mention-menu.js +71 -0
- 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 +143 -121
- package/dist/core/command/team-workspace-bootstrap.js +2 -1
- package/dist/core/command/team-workspace-team.js +3 -3
- package/dist/core/command/topic-slash.js +16 -10
- package/dist/core/{daemon-bootstrap.js → daemon/daemon-bootstrap.js} +14 -18
- package/dist/core/{daemon-control.js → daemon/daemon-control.js} +48 -21
- package/dist/core/{daemon-lifecycle.js → daemon/daemon-lifecycle.js} +28 -20
- package/dist/core/{host-snapshot.js → daemon/host-snapshot.js} +10 -5
- package/dist/core/{ipc-registration.js → daemon/ipc-registration.js} +101 -37
- 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 +2 -2
- 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 +57 -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 +3 -2
- package/dist/core/memory/consolidation-trigger.js +9 -3
- package/dist/core/memory/consolidation.js +39 -68
- 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 +204 -88
- package/dist/core/message/aun-request-registry.js +44 -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} +131 -1
- 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 +239 -59
- package/dist/core/message/message-log.js +8 -0
- package/dist/core/message/message-queue.js +88 -7
- package/dist/core/message/message-utils.js +1 -1
- package/dist/core/message/peer-mode.js +16 -5
- package/dist/core/message/response-engine.js +351 -152
- package/dist/core/message/send-options.js +44 -7
- package/dist/core/message/send-routing.js +55 -115
- 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 +18 -7
- package/dist/core/model/model-diagnostics.js +4 -4
- package/dist/core/ownership/owner-resolver.js +107 -101
- package/dist/core/{pack-auth.js → pack/pack-auth.js} +34 -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 +242 -82
- package/dist/core/permission/managed-file.js +234 -0
- package/dist/core/permission/protected-paths.js +120 -9
- package/dist/core/permission/sandbox-runtime.js +267 -3
- package/dist/core/permission/services-path-acl.js +9 -2
- package/dist/core/permission/session-path-grants.js +1 -1
- package/dist/core/permission/shell-environment.js +15 -1
- package/dist/core/permission/tool-policy.js +21 -9
- package/dist/core/plugin/plugin-lifecycle.js +442 -0
- package/dist/core/session/adapters/claude-session-file-adapter.js +2 -242
- package/dist/core/session/adapters/codex-session-file-adapter.js +2 -562
- 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 +76 -12
- package/dist/core/session/session-mapper.js +16 -0
- 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 +3 -3
- package/dist/core/skill/switch-resolver.js +3 -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/command-parser.js +4 -1
- package/dist/core/thread/ipc-operation.js +6 -4
- package/dist/core/thread/thread-operation.js +27 -11
- package/dist/core/thread/thread-route.js +5 -3
- package/dist/core/thread/thread-service.js +307 -58
- package/dist/core/thread/topic-id.js +52 -2
- package/dist/core/thread/types.js +15 -1
- 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 +3 -2
- package/dist/eck/manifest-engine.js +64 -2
- package/dist/eck/message-renderer.js +35 -0
- package/dist/ecweb/basic-settings-service.js +12 -10
- 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 +5 -3
- 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 +181 -77
- package/dist/ipc.js +161 -12
- 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 +60 -1
- package/dist/pay/command.js +38 -0
- package/dist/pay/protocol.js +136 -0
- package/dist/pay/runtime.js +196 -0
- package/dist/pay/service.js +384 -0
- package/dist/pay/store.js +81 -0
- package/dist/response-system/engines/v1/proactive-flow.js +30 -3
- package/dist/services/dispatcher.js +25 -7
- package/dist/services/host/main.js +397 -0
- package/dist/services/host/protocol.js +125 -0
- package/dist/services/host/resident.js +347 -0
- package/dist/services/host-client.js +398 -0
- package/dist/services/host-deploy.js +180 -0
- package/dist/services/host-launch.js +117 -0
- package/dist/services/host-recycle.js +208 -0
- package/dist/services/host-runtime.js +841 -0
- package/dist/services/idempotency.js +44 -86
- package/dist/services/index-generator.js +4 -3
- package/dist/services/index.js +258 -36
- package/dist/services/ipc-operation.js +503 -78
- package/dist/services/pack-manager.js +2 -2
- package/dist/services/router.js +43 -3
- package/dist/services/script-runner.js +541 -100
- package/dist/services/service-payload.js +28 -1
- package/dist/services/validation.js +136 -5
- 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 +9 -6
- package/dist/trigger/authorization.js +36 -33
- package/dist/trigger/ipc-service.js +4 -4
- package/dist/trigger/local-files.js +8 -166
- package/dist/trigger/manager.js +2 -2
- package/dist/trigger/parser.js +48 -0
- package/dist/trigger/scheduler.js +35 -13
- package/dist/trigger/script-executor.js +21 -0
- package/dist/trigger/script-sandbox.js +77 -232
- package/dist/trigger/system-definitions.js +25 -0
- package/dist/trigger/validation.js +1 -1
- package/dist/utils/aid-bind.js +3 -0
- 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 +74 -1
- package/dist/utils/logger.js +5 -3
- package/dist/utils/media-cache.js +284 -42
- package/dist/utils/restart-safety.js +14 -1
- package/dist/utils/startup-trace.js +20 -4
- package/dist/utils/system-memory.js +113 -25
- package/dist/utils/systemd-lifecycle.js +154 -0
- package/dist/utils/welcome.js +64 -20
- package/dist/utils/windows-shell-trust.js +7 -3
- 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 +3 -2
- package/kits/docs/aun/AUN/346/266/210/346/201/257/347/261/273/345/236/213/344/270/216/345/261/236/346/200/247.md +1 -0
- package/kits/docs/channels/aun.md +1 -1
- package/kits/docs/channels/feishu.md +1 -1
- package/kits/docs/evolcore/INDEX.md +13 -9
- package/kits/docs/evolcore/agent-create.md +2 -0
- package/kits/docs/evolcore/agent.md +133 -11
- package/kits/docs/evolcore/aid.md +39 -6
- package/kits/docs/evolcore/config.md +95 -1
- 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 +5 -4
- package/kits/docs/evolcore/memory-consolidation.md +1 -1
- package/kits/docs/evolcore/memory-tags.md +2 -0
- package/kits/docs/evolcore/menu-client.md +3 -3
- package/kits/docs/evolcore/menu-protocol.md +31 -2
- package/kits/docs/evolcore/model.md +12 -1
- package/kits/docs/evolcore/msg.md +96 -36
- package/kits/docs/evolcore/pay.md +22 -0
- package/kits/docs/evolcore/plugin.md +74 -0
- package/kits/docs/evolcore/provider.md +29 -2
- package/kits/docs/evolcore/rpc.md +2 -2
- package/kits/docs/evolcore/services.md +46 -18
- 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 +20 -9
- package/kits/docs/evolcore/tool-authorization.md +14 -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/01-overview.md +11 -32
- package/kits/rules/02-navigation.md +20 -6
- package/kits/rules/06-channel.md +20 -4
- package/kits/schemas/_meta.json +42 -5
- package/kits/schemas/agent-config.schema.21.json +974 -0
- package/kits/schemas/agent-config.schema.22.json +977 -0
- package/kits/schemas/agent-config.schema.23.json +974 -0
- 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.10.json +373 -0
- package/kits/schemas/daemon.schema.11.json +487 -0
- package/kits/schemas/daemon.schema.12.json +505 -0
- package/kits/schemas/daemon.schema.9.json +12 -0
- package/kits/schemas/defaults.schema.7.json +472 -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 +26 -4
- package/kits/schemas/relation-config.schema.13.json +289 -0
- package/kits/skills/.switches.json +17 -1
- package/kits/skills/ability/SKILL.md +395 -33
- package/kits/skills/ability/STRUCTURE.md +338 -0
- package/kits/skills/ability/references/cli.md +208 -0
- package/kits/skills/ability/references/development.md +107 -37
- package/kits/skills/ability/references/management.md +106 -46
- package/kits/skills/ability/references/runtime-protocol.md +65 -63
- package/kits/skills/agent-output-cards/SKILL.md +80 -37
- 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 +8 -6
- package/kits/skills/ec-group/TASK.md +186 -0
- package/kits/skills/ec-group/WORKLOG.md +180 -0
- package/kits/skills/ec-group-collaboration/SKILL.md +5 -5
- package/kits/skills/ec-identity/SKILL.md +9 -6
- package/kits/skills/ec-pay/SKILL.md +223 -0
- package/kits/skills/ec-provider/SKILL.md +6 -6
- package/kits/skills/{ec-service-proxy → ec-proxy}/SKILL.md +8 -5
- package/kits/skills/ec-service-call/SKILL.md +138 -0
- package/kits/skills/ec-service-pack/SKILL.md +277 -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 +3 -3
- 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/memory-consolidation/notes.md +2 -2
- package/kits/templates/memory-consolidation/workflow.md +46 -0
- package/kits/templates/system-fragments/channel.md +13 -4
- package/kits/templates/system-fragments/commands.md +5 -4
- package/kits/templates/system-fragments/personal-assistant.md +2 -2
- package/kits/templates/system-fragments/reply.md +15 -9
- package/kits/templates/system-fragments/session.md +2 -2
- package/kits/templates/system-fragments/thread.md +30 -127
- package/kits/templates/system-fragments/venue.md +16 -0
- package/package.json +7 -7
- package/scripts/agent-template/index.mjs +7 -1
- package/scripts/agent-template/inspect.mjs +99 -39
- package/scripts/agent-template/overlay.mjs +126 -2
- package/scripts/agent-template/shared/common.mjs +49 -5
- 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 +468 -39
- package/scripts/agent-template/shared/template-contract.mjs +93 -51
- package/scripts/agent-template/shared/template-package.mjs +225 -44
- package/scripts/agent-template/shared/template-runtime.mjs +137 -15
- package/scripts/agent-template/shared/template.mjs +31 -8
- package/scripts/agent-template/team-pack.mjs +528 -56
- package/scripts/agent-template/team-preview.mjs +102 -9
- package/scripts/aid-batch/identity-batch.mjs +1 -1
- package/dist/agents/baseagent-availability.js +0 -152
- package/dist/agents/baseagent.js +0 -750
- 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/docs/aun/ABILITY_CALLING.md +0 -280
- package/kits/docs/evolcore/ability.md +0 -185
- package/kits/skills/ability/references/calling.md +0 -56
- package/kits/skills/ability/references/contract-checklist.md +0 -37
- package/kits/skills/ability/references/recovery.md +0 -27
- /package/dist/{core/capability/providers/gemini-capability-provider.js → agents/gemini/capability-provider.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
|
@@ -11,18 +11,19 @@
|
|
|
11
11
|
* 详见 docs/config/01-overview.md
|
|
12
12
|
*/
|
|
13
13
|
import fs from 'fs';
|
|
14
|
+
import { validateBaseagentPluginConfigs } from '../core/baseagent/baseagent-plugin-descriptor.js';
|
|
15
|
+
import { validateChannelConfigs } from '../core/channel/channel-loader.js';
|
|
14
16
|
import path from 'path';
|
|
15
|
-
import { ensureManagedLockParent, resolveManagedLockPath } from '../core/runtime-lock.js';
|
|
16
17
|
import crypto from 'crypto';
|
|
17
18
|
import { resolvePaths, agentConfig as agentConfigPath, agentPeerConfig, agentRelationConfig, agentRolesIndex, agentRoleConfig, } from '../paths.js';
|
|
18
|
-
import { atomicReadJson, atomicWriteJson } from '../utils/atomic-write.js';
|
|
19
|
-
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';
|
|
20
21
|
import { registerFile } from '../core/file-integrity/store.js';
|
|
21
22
|
import { isValidAid } from '../aun/aid/validation.js';
|
|
22
23
|
import { normalizeAidDomain } from '../aun/aid/domain.js';
|
|
23
24
|
import { ensureRelationSharedDirectory } from '../core/relation/shared-data.js';
|
|
24
25
|
import { parseContactAlias } from './peer-alias.js';
|
|
25
|
-
import { loadSchema, listSchemaVersions, currentVersion, isSchemaName, } from './schema-registry.js';
|
|
26
|
+
import { loadSchema, listSchemaVersions, currentVersion, isSchemaName, schemaDefaultsLayer, } from './schema-registry.js';
|
|
26
27
|
import { mergeLayers } from './merge.js';
|
|
27
28
|
import { normalizeAgentLifecycle } from './lifecycle.js';
|
|
28
29
|
import { isAgentOnlyBaseagentField, isBehaviorConfigFieldPath } from './config-field-policy.js';
|
|
@@ -34,9 +35,10 @@ import { DAEMON_SCHEMA_NAME } from '../product.js';
|
|
|
34
35
|
import { normalizeDaemonServices } from './daemon-services.js';
|
|
35
36
|
import { assertProviderSelectionWrite, resolveProviderModelSettings, validateProvidersFile } from './providers-config.js';
|
|
36
37
|
import { resolveProviderSelectionModel } from '../core/model/model-catalog.js';
|
|
37
|
-
import { assertOwnerConfigRecord,
|
|
38
|
+
import { assertOwnerConfigRecord, normalizeOwnerConfigTree, withOwnerListCompatibility } from './owner-config.js';
|
|
38
39
|
import { getOwners, getPrimaryOwner, ownerResolver } from '../core/ownership/owner-resolver.js';
|
|
39
|
-
import { resolveBaseagentModelSelection } from '../
|
|
40
|
+
import { isSupportedBaseagent, resolveBaseagentModelSelection, usesNativeModelSelection } from '../core/baseagent/baseagent.js';
|
|
41
|
+
import { preserveBaseagentDeclarationsOnWrite, migrateBaseagentDefaultsOnWrite } from './schema-migration.js';
|
|
40
42
|
import { assertProjectPathReference } from '../utils/project-path.js';
|
|
41
43
|
// AUN gateway discovery belongs to fastaun. Keep the retired gatewayUrl
|
|
42
44
|
// compatibility handling beside the rest of the configuration read/write
|
|
@@ -714,8 +716,22 @@ function normalizeBaseagentEffortCompat(value) {
|
|
|
714
716
|
return value;
|
|
715
717
|
return { ...value, baseagents };
|
|
716
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
|
+
}
|
|
717
733
|
function normalizeAgentConfigForRead(value, aid) {
|
|
718
|
-
const config = withOwnerListCompatibility(normalizeOwnerConfigTree(foldLegacyProactiveBlock(normalizeAgentLifecycle(value))));
|
|
734
|
+
const config = withOwnerListCompatibility(normalizeOwnerConfigTree(foldLegacyProactiveBlock(normalizeAgentLifecycle(normalizeWelcomeConfigCompat(value)))));
|
|
719
735
|
const mutable = config;
|
|
720
736
|
normalizeShowActivitiesCompat(mutable);
|
|
721
737
|
// AID 校验(如果提供了 aid)
|
|
@@ -773,7 +789,7 @@ function normalizeAgentConfigForWrite(value) {
|
|
|
773
789
|
catch (error) {
|
|
774
790
|
throw new ConfigError('VALIDATION_ERROR', error instanceof Error ? error.message : String(error));
|
|
775
791
|
}
|
|
776
|
-
const mutable = normalizeOwnerConfigTree(normalizeBaseagentEffortCompat({ ...value }));
|
|
792
|
+
const mutable = normalizeOwnerConfigTree(normalizeBaseagentEffortCompat(normalizeWelcomeConfigCompat({ ...value })));
|
|
777
793
|
normalizeShowActivitiesCompat(mutable);
|
|
778
794
|
// AID 格式校验
|
|
779
795
|
if (mutable.aid && !isValidAid(mutable.aid)) {
|
|
@@ -884,7 +900,7 @@ function normalizeRelationConfigForWrite(value) {
|
|
|
884
900
|
for (const [baseagent, rawBlock] of Object.entries(mutable.baseagents)) {
|
|
885
901
|
if (!rawBlock || typeof rawBlock !== 'object' || Array.isArray(rawBlock))
|
|
886
902
|
continue;
|
|
887
|
-
for (const field of ['model', 'effort', 'reasoning']) {
|
|
903
|
+
for (const field of ['model', 'effort', 'reasoning', 'autoCompactThresholdTokens']) {
|
|
888
904
|
if (Object.prototype.hasOwnProperty.call(rawBlock, field))
|
|
889
905
|
agentOnlyFields.push(`baseagents.${baseagent}.${field}`);
|
|
890
906
|
}
|
|
@@ -950,6 +966,10 @@ function foldLegacyProactiveBlock(value) {
|
|
|
950
966
|
/** Write config with schema validation and atomic persistence. */
|
|
951
967
|
export function write(target, value, sel, opts = {}) {
|
|
952
968
|
const file = targetPath(target, sel);
|
|
969
|
+
if (target === ConfigTarget.Process)
|
|
970
|
+
value = preserveBaseagentDeclarationsOnWrite(value);
|
|
971
|
+
if (target === ConfigTarget.Defaults)
|
|
972
|
+
value = migrateBaseagentDefaultsOnWrite(value);
|
|
953
973
|
if (target === ConfigTarget.RoleRegistry) {
|
|
954
974
|
writeRoleRegistry(sel.self, value);
|
|
955
975
|
finishConfigWrite(target, sel, file);
|
|
@@ -1033,9 +1053,6 @@ export function write(target, value, sel, opts = {}) {
|
|
|
1033
1053
|
const before = readTextOrNull(file);
|
|
1034
1054
|
const after = `${JSON.stringify(normalized, null, 2)}\n`;
|
|
1035
1055
|
commitAgentConfigTransactionSync(syncAid, [{ file, before, after }]);
|
|
1036
|
-
if (target === ConfigTarget.Agent) {
|
|
1037
|
-
ownerResolver.setAgentConfiguredOwners(syncAid, configuredOwnerList(normalized));
|
|
1038
|
-
}
|
|
1039
1056
|
finishConfigWrite(target, sel, file);
|
|
1040
1057
|
return;
|
|
1041
1058
|
}
|
|
@@ -1048,12 +1065,6 @@ export function write(target, value, sel, opts = {}) {
|
|
|
1048
1065
|
fs.chmodSync(protectedFile, 0o600);
|
|
1049
1066
|
}
|
|
1050
1067
|
}
|
|
1051
|
-
if (target === ConfigTarget.Agent && sel?.self) {
|
|
1052
|
-
ownerResolver.setAgentConfiguredOwners(sel.self, configuredOwnerList(normalized));
|
|
1053
|
-
}
|
|
1054
|
-
if (target === ConfigTarget.Process && typeof normalized?.aid === 'string') {
|
|
1055
|
-
ownerResolver.setConfiguredOwners(normalized.aid, configuredOwnerList(normalized));
|
|
1056
|
-
}
|
|
1057
1068
|
finishConfigWrite(target, sel, file);
|
|
1058
1069
|
}
|
|
1059
1070
|
/**
|
|
@@ -1083,25 +1094,6 @@ export function mutateConfig(target, sel, mutate) {
|
|
|
1083
1094
|
release();
|
|
1084
1095
|
}
|
|
1085
1096
|
}
|
|
1086
|
-
/** Retire both local compatibility fields after freshly confirmed protocol ownership. */
|
|
1087
|
-
export function clearConfiguredOwnerAfterConsensus(subjectAid, ownerAid) {
|
|
1088
|
-
const normalizedOwnerAid = ownerAid.trim();
|
|
1089
|
-
if (!isValidAid(normalizedOwnerAid) || subjectAid === ownerResolver.getDaemonAid())
|
|
1090
|
-
return false;
|
|
1091
|
-
const isConfirmed = () => {
|
|
1092
|
-
const state = ownerResolver.snapshot(subjectAid);
|
|
1093
|
-
return ownerResolver.owner(subjectAid) === normalizedOwnerAid && state.authorizationStatus === 'verified'
|
|
1094
|
-
&& state.consensus?.lock === 'locked' && state.consensus.sub_aid === subjectAid && !state.refreshFailure;
|
|
1095
|
-
};
|
|
1096
|
-
if (!isConfirmed())
|
|
1097
|
-
return false;
|
|
1098
|
-
return mutateConfig(ConfigTarget.Agent, { self: subjectAid }, config => {
|
|
1099
|
-
if (!isConfirmed())
|
|
1100
|
-
return;
|
|
1101
|
-
delete config.owner;
|
|
1102
|
-
delete config.owners;
|
|
1103
|
-
}).changed;
|
|
1104
|
-
}
|
|
1105
1097
|
function cloneConfigValue(value) {
|
|
1106
1098
|
return JSON.parse(JSON.stringify(value));
|
|
1107
1099
|
}
|
|
@@ -1263,6 +1255,7 @@ function ensureSchemaVersion(value, version) {
|
|
|
1263
1255
|
function validateOrThrow(schema, value, target) {
|
|
1264
1256
|
const ok = schema.validate(value);
|
|
1265
1257
|
const scopeErrors = [
|
|
1258
|
+
...validatePluginConfigForTarget(target, value),
|
|
1266
1259
|
...validateProcessOnlyFields(target, value),
|
|
1267
1260
|
...validateProcessAidDomain(target, value),
|
|
1268
1261
|
...validateProcessServiceNames(target, value),
|
|
@@ -1408,6 +1401,7 @@ export function validateConfig(target, value) {
|
|
|
1408
1401
|
}
|
|
1409
1402
|
const ok = schema.validate(normalized);
|
|
1410
1403
|
const errors = [
|
|
1404
|
+
...validatePluginConfigForTarget(target, normalized),
|
|
1411
1405
|
...validateProcessOnlyFields(target, normalized),
|
|
1412
1406
|
...validateProcessAidDomain(target, normalized),
|
|
1413
1407
|
...validateProcessServiceNames(target, normalized),
|
|
@@ -1534,9 +1528,15 @@ export function resolveAgentConfig(sel, opts = {}) {
|
|
|
1534
1528
|
const fields = loadSchema('agent-config').fields;
|
|
1535
1529
|
const agentConfig = sel.self ? read(ConfigTarget.Agent, sel, opts) : null;
|
|
1536
1530
|
const relationConfig = (sel.self && sel.peerKey) ? read(ConfigTarget.Relation, sel, opts) : null;
|
|
1531
|
+
// 每一层的 schema 默认值先于该层自己的配置文件进入覆盖链:某层文件没写参数时,
|
|
1532
|
+
// 该层仍以 schema default 出值。默认值挂在哪一层是设计决策,规则见
|
|
1533
|
+
// docs/config/11-default-value-levels.md。
|
|
1537
1534
|
const layers = [
|
|
1535
|
+
schemaDefaultsLayer('defaults'),
|
|
1538
1536
|
stripDefaultsLegacyModelFields(stripStaticOwnerField(normalizeDefaultsBehaviorCompat(read(ConfigTarget.Defaults, undefined, opts)))),
|
|
1537
|
+
schemaDefaultsLayer('agent-config'),
|
|
1539
1538
|
agentConfig,
|
|
1539
|
+
schemaDefaultsLayer('relation-config'),
|
|
1540
1540
|
stripRelationRoleData(stripStaticOwnerField(relationConfig)),
|
|
1541
1541
|
];
|
|
1542
1542
|
const merged = mergeLayers(layers, fields);
|
|
@@ -1613,8 +1613,35 @@ function stripDefaultsLegacyModelFields(config) {
|
|
|
1613
1613
|
if (!config)
|
|
1614
1614
|
return config;
|
|
1615
1615
|
const { models: _models, decision_model: _decisionModel, ...rest } = config;
|
|
1616
|
+
if (rest.baseagents && typeof rest.baseagents === 'object' && !Array.isArray(rest.baseagents)) {
|
|
1617
|
+
const blocks = {};
|
|
1618
|
+
for (const [name, raw] of Object.entries(rest.baseagents)) {
|
|
1619
|
+
if (!raw || typeof raw !== 'object' || Array.isArray(raw)) {
|
|
1620
|
+
blocks[name] = raw;
|
|
1621
|
+
continue;
|
|
1622
|
+
}
|
|
1623
|
+
const { enabled: _enabled, ...block } = raw;
|
|
1624
|
+
if (Object.keys(block).length || !Object.hasOwn(raw, 'enabled'))
|
|
1625
|
+
blocks[name] = block;
|
|
1626
|
+
}
|
|
1627
|
+
rest.baseagents = blocks;
|
|
1628
|
+
}
|
|
1616
1629
|
return rest;
|
|
1617
1630
|
}
|
|
1631
|
+
function validatePluginConfigForTarget(target, value) {
|
|
1632
|
+
if (target !== ConfigTarget.Agent && target !== ConfigTarget.Defaults)
|
|
1633
|
+
return [];
|
|
1634
|
+
const config = value;
|
|
1635
|
+
const errors = validateBaseagentPluginConfigs(config?.baseagents, target === ConfigTarget.Defaults);
|
|
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.
|
|
1640
|
+
if (config?.active_baseagent !== undefined && !isSupportedBaseagent(config.active_baseagent)) {
|
|
1641
|
+
errors.push('/active_baseagent: plugin is not installed or discovered');
|
|
1642
|
+
}
|
|
1643
|
+
return errors;
|
|
1644
|
+
}
|
|
1618
1645
|
function stripRelationRoleData(config) {
|
|
1619
1646
|
if (!config || (!Object.prototype.hasOwnProperty.call(config, 'role')
|
|
1620
1647
|
&& !Object.prototype.hasOwnProperty.call(config, 'roles')
|
|
@@ -1654,9 +1681,10 @@ function stripRelationRoleData(config) {
|
|
|
1654
1681
|
* 合并视图:只合并物理覆盖链 defaults → agent/config → relation/config。
|
|
1655
1682
|
*/
|
|
1656
1683
|
export function resolveEffective(sel, opts = {}) {
|
|
1684
|
+
// 默认值已经作为各层的值参与合并(见 resolveAgentConfig),这里不再补任何
|
|
1685
|
+
// 硬编码兜底:任何字段为 undefined 都表示"整条链都没配、且 schema 也没给默认值",
|
|
1686
|
+
// 那就是未配置。规则见 docs/config/11-default-value-levels.md。
|
|
1657
1687
|
const config = resolveAgentConfig(sel, opts);
|
|
1658
|
-
const observableDefault = loadSchema('agent-config').fields.get('observable')?.default;
|
|
1659
|
-
const autoMentionQuietWindowMsDefault = loadSchema('agent-config').fields.get('autoMentionQuietWindowMs')?.default;
|
|
1660
1688
|
const effective = {
|
|
1661
1689
|
$schema_version: config.$schema_version ?? currentVersion('agent-config'),
|
|
1662
1690
|
aid: config.aid ?? sel.self ?? '',
|
|
@@ -1669,32 +1697,28 @@ export function resolveEffective(sel, opts = {}) {
|
|
|
1669
1697
|
owner: getPrimaryOwner(sel.self ?? config.aid ?? ''),
|
|
1670
1698
|
owners: getOwners(sel.self ?? config.aid ?? ''),
|
|
1671
1699
|
fullaccess: config.fullaccess,
|
|
1700
|
+
// access 是 Agent 级唯一来源,合并链上不会出现其它层的值;这里只做键序归一,
|
|
1701
|
+
// 保证 `ec config get access` 与 `connect view=access` 输出逐字节一致。
|
|
1702
|
+
access: normalizeAccessPolicy(config.access),
|
|
1672
1703
|
aun: config.aun,
|
|
1673
1704
|
channels: config.channels ?? [],
|
|
1674
1705
|
projects: config.projects,
|
|
1675
1706
|
capabilities: config.capabilities,
|
|
1676
|
-
ability:
|
|
1677
|
-
...config.ability,
|
|
1678
|
-
codeApproval: {
|
|
1679
|
-
...config.ability?.codeApproval,
|
|
1680
|
-
enabled: config.ability?.codeApproval?.enabled ?? true,
|
|
1681
|
-
},
|
|
1682
|
-
},
|
|
1707
|
+
ability: config.ability,
|
|
1683
1708
|
baseagentSkills: config.baseagentSkills,
|
|
1684
1709
|
readonlySourceDiagnostics: config.readonlySourceDiagnostics,
|
|
1685
|
-
|
|
1686
|
-
// factory default here so omitted observable fields are enabled at runtime.
|
|
1687
|
-
observable: config.observable ?? (typeof observableDefault === 'boolean' ? observableDefault : true),
|
|
1710
|
+
observable: config.observable,
|
|
1688
1711
|
extra_backup: config.extra_backup,
|
|
1689
1712
|
// Runtime configuration parameters
|
|
1690
1713
|
active_baseagent: config.active_baseagent,
|
|
1691
1714
|
baseagents: config.baseagents,
|
|
1692
1715
|
Services: config.Services,
|
|
1693
1716
|
chatmode: config.chatmode,
|
|
1717
|
+
// 群聊 @ 策略刻意不带默认值:未配置时要让服务端的 mention_mode 生效。
|
|
1694
1718
|
mentionMode: config.mentionMode,
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
groupSlashRequireMentions: config.groupSlashRequireMentions
|
|
1719
|
+
privateMentionMode: config.privateMentionMode,
|
|
1720
|
+
autoMentionQuietWindowMs: config.autoMentionQuietWindowMs,
|
|
1721
|
+
groupSlashRequireMentions: config.groupSlashRequireMentions,
|
|
1698
1722
|
responseMode: config.responseMode,
|
|
1699
1723
|
responseModeParams: config.responseModeParams,
|
|
1700
1724
|
flush_delay: config.flush_delay,
|
|
@@ -1715,11 +1739,42 @@ export function assertAgentModelConfigured(self, baseagent) {
|
|
|
1715
1739
|
const backend = baseagent ?? config.active_baseagent;
|
|
1716
1740
|
if (!backend)
|
|
1717
1741
|
throw new ConfigError('BASEAGENT_REQUIRED', 'Configure active_baseagent before enabling this Agent');
|
|
1742
|
+
if (usesNativeModelSelection(backend, config.baseagents?.[backend]))
|
|
1743
|
+
return;
|
|
1718
1744
|
const selection = resolveBaseagentModelSelection(backend, config.baseagents?.[backend]);
|
|
1719
1745
|
if (!selection?.model) {
|
|
1720
1746
|
throw new ConfigError('MODEL_NOT_CONFIGURED', `Configure baseagents.${backend}.model before enabling or selecting this backend`);
|
|
1721
1747
|
}
|
|
1722
1748
|
}
|
|
1749
|
+
/**
|
|
1750
|
+
* 按固定字段顺序重排准入策略,并裁掉未配置的键。
|
|
1751
|
+
*
|
|
1752
|
+
* 值本身全部来自合并链(defaults → agent 的 schema 默认值层 + 配置文件),这里
|
|
1753
|
+
* **不补任何默认值**:`allowExternalContacts` / `contactAdmission` 没有默认值,
|
|
1754
|
+
* 未配置就必须是未配置(个人助理按身份判定的逻辑依赖这一点)。只做两件事:
|
|
1755
|
+
* 固定键序(`ec config get access` 与 `connect view=access` 必须逐字节一致),
|
|
1756
|
+
* 以及 array 字段拷贝一份,避免调用方改写污染配置缓存。
|
|
1757
|
+
*/
|
|
1758
|
+
function normalizeAccessPolicy(policy) {
|
|
1759
|
+
if (!policy)
|
|
1760
|
+
return policy;
|
|
1761
|
+
return {
|
|
1762
|
+
...(policy.contactAdmission !== undefined ? { contactAdmission: policy.contactAdmission } : {}),
|
|
1763
|
+
...(policy.allowInternalContacts !== undefined ? { allowInternalContacts: policy.allowInternalContacts } : {}),
|
|
1764
|
+
// allowExternalContacts 没有 schema 默认值:未配置时保持缺席,由个人助理身份判定接管。
|
|
1765
|
+
...(policy.allowExternalContacts !== undefined ? { allowExternalContacts: policy.allowExternalContacts } : {}),
|
|
1766
|
+
...(policy.allowAllContacts !== undefined ? { allowAllContacts: policy.allowAllContacts } : {}),
|
|
1767
|
+
...(policy.allowedAids !== undefined ? { allowedAids: [...policy.allowedAids] } : {}),
|
|
1768
|
+
...(policy.deniedAids !== undefined ? { deniedAids: [...policy.deniedAids] } : {}),
|
|
1769
|
+
// requestLimit 的两个子字段在 agent-config schema 里有默认值,合并后必然齐全;
|
|
1770
|
+
// 兜底值只防 schema 被误删时算出 NaN 频控窗口(不 import DEFAULT_ACCESS_POLICY,
|
|
1771
|
+
// 那会造成 access-policy ↔ config-manager 的循环依赖)。
|
|
1772
|
+
requestLimit: {
|
|
1773
|
+
maxTimes: policy.requestLimit?.maxTimes ?? 600,
|
|
1774
|
+
coolDown: policy.requestLimit?.coolDown ?? 3600,
|
|
1775
|
+
},
|
|
1776
|
+
};
|
|
1777
|
+
}
|
|
1723
1778
|
function normalizeEffectiveCompatibility(effective) {
|
|
1724
1779
|
normalizeShowActivitiesCompat(effective);
|
|
1725
1780
|
const behavior = {};
|
|
@@ -1737,6 +1792,7 @@ const EFFECTIVE_BEHAVIOR_FIELDS = [
|
|
|
1737
1792
|
'baseagents',
|
|
1738
1793
|
'chatmode',
|
|
1739
1794
|
'mentionMode',
|
|
1795
|
+
'privateMentionMode',
|
|
1740
1796
|
'autoMentionQuietWindowMs',
|
|
1741
1797
|
'groupSlashRequireMentions',
|
|
1742
1798
|
'flush_delay',
|
|
@@ -1764,6 +1820,11 @@ export function routeFieldPath(fieldPath, scope) {
|
|
|
1764
1820
|
if (scope === 'relation' && isAgentOnlyBaseagentField(fieldPath)) {
|
|
1765
1821
|
throw new ConfigError('SCOPE_MISMATCH', `${fieldPath} is Agent-scoped and cannot be configured per relation`);
|
|
1766
1822
|
}
|
|
1823
|
+
// privateMentionMode 只存在于 agent-config:私聊提及模式是 Agent 的身份级开关,
|
|
1824
|
+
// 不按对端区分。显式拒绝,避免落成一条永远读不到的孤儿配置。
|
|
1825
|
+
if (scope === 'relation' && topField === 'privateMentionMode') {
|
|
1826
|
+
throw new ConfigError('SCOPE_MISMATCH', `${fieldPath} is Agent-scoped and cannot be configured per relation`);
|
|
1827
|
+
}
|
|
1767
1828
|
if (topField === 'sessionLoop') {
|
|
1768
1829
|
throw new ConfigError('SESSION_LOOP_MANAGED', 'sessionLoop is managed through the dedicated /loop or session Menu entry');
|
|
1769
1830
|
}
|
|
@@ -381,13 +381,20 @@ function executeGet(op, options) {
|
|
|
381
381
|
? diagnoseRelationLayer(op, withSource.source?.target === ConfigTarget.Relation)
|
|
382
382
|
: undefined;
|
|
383
383
|
if (withSource.source) {
|
|
384
|
+
// 顶层对象存在、叶子缺失(例如 access 写了 allowAllContacts 但没写
|
|
385
|
+
// requestLimit.coolDown):值按 schema default 回落,来源仍报告存储层,
|
|
386
|
+
// 让调用方知道"这块配过一部分"。
|
|
387
|
+
const value = withSource.value !== undefined
|
|
388
|
+
? withSource.value
|
|
389
|
+
: fieldSchemaDefault(op.route?.schema ?? 'agent-config', op.field);
|
|
384
390
|
return {
|
|
385
391
|
ok: true,
|
|
386
392
|
subcommand: 'get',
|
|
387
393
|
field: op.field,
|
|
388
|
-
value:
|
|
394
|
+
value: value ?? null,
|
|
389
395
|
scope: op.configScope,
|
|
390
396
|
source: withSource.source,
|
|
397
|
+
...(withSource.value === undefined && value !== undefined ? { schemaDefault: true } : {}),
|
|
391
398
|
...(note ? { note } : {}),
|
|
392
399
|
};
|
|
393
400
|
}
|
|
@@ -398,6 +405,20 @@ function executeGet(op, options) {
|
|
|
398
405
|
if (withSource.value !== undefined && !op.route) {
|
|
399
406
|
return { ok: true, subcommand: 'get', field: op.field, value: withSource.value, scope: op.configScope };
|
|
400
407
|
}
|
|
408
|
+
// 有 route 但没有任何存储层配置过:值来自 schema 默认值层(它作为该层的值参与了
|
|
409
|
+
// 合并,见 docs/config/11-default-value-levels.md)。必须标 schemaDefault,
|
|
410
|
+
// 否则文本输出会误报成一次普通取值。
|
|
411
|
+
if (withSource.value !== undefined && op.route) {
|
|
412
|
+
return {
|
|
413
|
+
ok: true,
|
|
414
|
+
subcommand: 'get',
|
|
415
|
+
field: op.field,
|
|
416
|
+
value: withSource.value,
|
|
417
|
+
scope: op.configScope,
|
|
418
|
+
schemaDefault: true,
|
|
419
|
+
...(note ? { note } : {}),
|
|
420
|
+
};
|
|
421
|
+
}
|
|
401
422
|
return getWithSchemaDefault(op, null, note);
|
|
402
423
|
}
|
|
403
424
|
/**
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { listSupportedBaseagents } from '../core/baseagent/baseagent.js';
|
|
1
2
|
/**
|
|
2
3
|
* gateway-config.ts — baseagent 模型选择与 provider 指认管理。
|
|
3
4
|
*
|
|
@@ -15,15 +16,15 @@ import fs from 'fs';
|
|
|
15
16
|
import path from 'path';
|
|
16
17
|
import { resolvePaths } from '../paths.js';
|
|
17
18
|
import { saveAgent } from '../config-store.js';
|
|
18
|
-
import { buildModelRequestHeaders } from '../
|
|
19
|
-
import { appendV1RequestPath } from '../
|
|
20
|
-
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';
|
|
21
22
|
import { ipcQuery } from '../ipc.js';
|
|
22
23
|
import { logger } from '../utils/logger.js';
|
|
23
24
|
import { resolveProviderServiceForBaseagent } from './providers.js';
|
|
24
25
|
import { stripLegacyAunGatewayConfig } from './config-manager.js';
|
|
25
26
|
/** 已知 baseagent 类型(模型选择可管理范围)。 */
|
|
26
|
-
const
|
|
27
|
+
const gatewayTypes = () => listSupportedBaseagents();
|
|
27
28
|
const DISPLAY_NAMES = {
|
|
28
29
|
claude: 'Claude',
|
|
29
30
|
codex: 'Codex (OpenAI)',
|
|
@@ -74,7 +75,7 @@ function extractEntries(raw, scope) {
|
|
|
74
75
|
const ba = raw?.baseagents;
|
|
75
76
|
if (!ba || typeof ba !== 'object')
|
|
76
77
|
return out;
|
|
77
|
-
for (const type of
|
|
78
|
+
for (const type of gatewayTypes()) {
|
|
78
79
|
const c = ba[type];
|
|
79
80
|
if (!c || typeof c !== 'object')
|
|
80
81
|
continue;
|
|
@@ -104,7 +105,7 @@ export function gatewayList() {
|
|
|
104
105
|
gateways.push(...extractEntries(raw, aid));
|
|
105
106
|
}
|
|
106
107
|
const effective = computeEffective(aids);
|
|
107
|
-
return { data: { gateways, scopes: aids, types:
|
|
108
|
+
return { data: { gateways, scopes: aids, types: gatewayTypes(), effective } };
|
|
108
109
|
}
|
|
109
110
|
catch (e) {
|
|
110
111
|
logger.error('[gateway] gatewayList 执行出错:', e);
|
|
@@ -123,7 +124,7 @@ function computeEffective(aids) {
|
|
|
123
124
|
logger.error(`[GatewayConfig] active_baseagent is empty for aid=${aid}, skipping`);
|
|
124
125
|
continue;
|
|
125
126
|
}
|
|
126
|
-
if (!
|
|
127
|
+
if (!gatewayTypes().includes(activeRaw)) {
|
|
127
128
|
logger.error(`[GatewayConfig] unknown baseagent type '${activeRaw}' for aid=${aid}, skipping`);
|
|
128
129
|
continue;
|
|
129
130
|
}
|
|
@@ -143,7 +144,7 @@ function computeEffective(aids) {
|
|
|
143
144
|
// ── 写入 ──
|
|
144
145
|
/** 校验 type 合法。 */
|
|
145
146
|
function validateType(type) {
|
|
146
|
-
return typeof type === 'string' &&
|
|
147
|
+
return typeof type === 'string' && gatewayTypes().includes(type);
|
|
147
148
|
}
|
|
148
149
|
/** 网关连接信息(baseUrl/apiKey/headers/queryParams)只存在于 providers.json,Agent 级只选 provider。 */
|
|
149
150
|
const REMOVED_GATEWAY_FIELDS = ['baseUrl', 'apiKey', 'model', 'effort', 'reasoning', 'mode', 'useVertex', 'project', 'location'];
|
|
@@ -194,7 +195,7 @@ export async function gatewayUpdate(args) {
|
|
|
194
195
|
return { error: 'defaults 不承载 baseagent 配置;连接信息在 providers.json,模型选择在各 Agent 的 config.json', code: 'INVALID_ARGS' };
|
|
195
196
|
}
|
|
196
197
|
if (!validateType(type))
|
|
197
|
-
return { error: `无效 type: ${type}(可选 ${
|
|
198
|
+
return { error: `无效 type: ${type}(可选 ${gatewayTypes().join('/')})`, code: 'INVALID_ARGS' };
|
|
198
199
|
const built = buildPatch(type, args?.patch ?? {});
|
|
199
200
|
if ('error' in built)
|
|
200
201
|
return { error: built.error, code: 'INVALID_ARGS' };
|
|
@@ -256,12 +257,12 @@ function resolveGatewayCreds(scope, type) {
|
|
|
256
257
|
return {
|
|
257
258
|
baseUrl: resolved.baseUrl,
|
|
258
259
|
apiKey: resolved.apiKey,
|
|
259
|
-
headers: buildModelRequestHeaders({
|
|
260
|
+
headers: type === 'claude' || type === 'codex' || type === 'ecagent' ? buildModelRequestHeaders({
|
|
260
261
|
baseagent: type,
|
|
261
262
|
baseUrl: resolved.baseUrl,
|
|
262
263
|
agentAid: scope,
|
|
263
264
|
configuredHeaders: resolved.headers,
|
|
264
|
-
}),
|
|
265
|
+
}) : resolved.headers,
|
|
265
266
|
queryParams: resolved.queryParams,
|
|
266
267
|
};
|
|
267
268
|
}
|
|
@@ -308,29 +309,8 @@ export async function gatewayTest(args) {
|
|
|
308
309
|
clearTimeout(timer);
|
|
309
310
|
}
|
|
310
311
|
}
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
if (!row)
|
|
314
|
-
return undefined;
|
|
315
|
-
return {
|
|
316
|
-
input: typeof row.price_input === 'number' ? row.price_input : undefined,
|
|
317
|
-
output: typeof row.price_output === 'number' ? row.price_output : undefined,
|
|
318
|
-
cache_read: typeof row.price_cache_read === 'number' ? row.price_cache_read : undefined,
|
|
319
|
-
cache_write: typeof row.price_cache_creation === 'number' ? row.price_cache_creation : undefined,
|
|
320
|
-
};
|
|
321
|
-
}
|
|
322
|
-
/** 从接口 pricing 对象提取四元组。 */
|
|
323
|
-
function apiPricingToQuad(p) {
|
|
324
|
-
if (!p || typeof p !== 'object')
|
|
325
|
-
return undefined;
|
|
326
|
-
return {
|
|
327
|
-
input: typeof p.input === 'number' ? p.input : undefined,
|
|
328
|
-
output: typeof p.output === 'number' ? p.output : undefined,
|
|
329
|
-
cache_read: typeof p.cache_read === 'number' ? p.cache_read : undefined,
|
|
330
|
-
cache_write: typeof p.cache_write === 'number' ? p.cache_write : undefined,
|
|
331
|
-
};
|
|
332
|
-
}
|
|
333
|
-
/** gatewayModels — 拉取该网关模型列表 + 官方价格 + 网关价格(接口缺失则回退 model-prices.jsonl)。 */
|
|
312
|
+
// ── 模型 + 价格 ──
|
|
313
|
+
/** gatewayModels — 拉取当前网关模型与价格;缺官方价时仅从参考端点补官方价。 */
|
|
334
314
|
export async function gatewayModels(args) {
|
|
335
315
|
const scope = String(args?.scope ?? '').trim();
|
|
336
316
|
const type = args?.type;
|
|
@@ -369,26 +349,31 @@ export async function gatewayModels(args) {
|
|
|
369
349
|
clearTimeout(timer);
|
|
370
350
|
}
|
|
371
351
|
const evolcoreHome = resolvePaths().root;
|
|
372
|
-
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);
|
|
373
360
|
const models = arr.map((m) => {
|
|
374
361
|
const id = typeof m === 'string' ? m : (m?.id || m?.name || m?.model);
|
|
375
362
|
if (!id)
|
|
376
363
|
return null;
|
|
377
364
|
const name = (m && typeof m === 'object' && m.name) ? m.name : id;
|
|
378
365
|
const group = (m && typeof m === 'object' && m.group) ? m.group : undefined;
|
|
379
|
-
//
|
|
366
|
+
// 官方价格:当前网关 pricing 优先,缺失则使用参考端点 pricing。
|
|
380
367
|
let official = apiPricingToQuad(m?.pricing);
|
|
381
368
|
let officialSource = official ? 'gateway' : 'none';
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
if (
|
|
386
|
-
|
|
387
|
-
officialSource = 'local';
|
|
388
|
-
}
|
|
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';
|
|
389
374
|
}
|
|
390
375
|
// 网关价格:接口 effective_pricing;缺失则留空(用户可手动设)
|
|
391
|
-
const gatewayPrice = apiPricingToQuad(m?.effective_pricing);
|
|
376
|
+
const gatewayPrice = usingReference ? undefined : apiPricingToQuad(m?.effective_pricing);
|
|
392
377
|
return { id, name, group, official: official ?? null, officialSource, gateway: gatewayPrice ?? null };
|
|
393
378
|
}).filter(Boolean);
|
|
394
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');
|
|
@@ -21,17 +21,6 @@ export function firstConfiguredOwner(value) {
|
|
|
21
21
|
}
|
|
22
22
|
return undefined;
|
|
23
23
|
}
|
|
24
|
-
/** Runtime compatibility projection for binding-target input; this is not an authorization list. */
|
|
25
|
-
export function configuredOwnerList(value) {
|
|
26
|
-
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
27
|
-
return [];
|
|
28
|
-
const record = value;
|
|
29
|
-
const values = [record.owner, ...(Array.isArray(record.owners) ? record.owners : [])];
|
|
30
|
-
return [...new Set(values
|
|
31
|
-
.filter((candidate) => typeof candidate === 'string')
|
|
32
|
-
.map(candidate => candidate.trim())
|
|
33
|
-
.filter(Boolean))];
|
|
34
|
-
}
|
|
35
24
|
export function assertOwnerConfigRecord(value, label, validateId) {
|
|
36
25
|
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
37
26
|
return;
|
|
@@ -55,11 +44,6 @@ export function assertOwnerConfigRecord(value, label, validateId) {
|
|
|
55
44
|
}
|
|
56
45
|
});
|
|
57
46
|
}
|
|
58
|
-
for (const owner of configuredOwnerList(record)) {
|
|
59
|
-
if (validateId && !validateId(owner)) {
|
|
60
|
-
throw new Error(`${label}.owner is invalid: ${JSON.stringify(owner)}`);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
47
|
}
|
|
64
48
|
/** Normalize one config record for persistence: write only the scalar owner. */
|
|
65
49
|
export function normalizeSingleOwnerRecord(value) {
|
|
@@ -75,13 +59,15 @@ export function normalizeSingleOwnerRecord(value) {
|
|
|
75
59
|
delete normalized.owner;
|
|
76
60
|
return normalized;
|
|
77
61
|
}
|
|
78
|
-
/**
|
|
62
|
+
/** Drop retired root ownership hints; keep channel binding configuration. */
|
|
79
63
|
export function normalizeOwnerConfigTree(value, options = {}) {
|
|
80
64
|
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
81
65
|
return value;
|
|
82
66
|
const normalized = { ...value };
|
|
83
|
-
//
|
|
84
|
-
//
|
|
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;
|
|
85
71
|
if (options.projectChannels !== false && Array.isArray(normalized.channels)) {
|
|
86
72
|
normalized.channels = normalized.channels.map((channel) => normalizeSingleOwnerRecord(channel));
|
|
87
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,23 +9,17 @@ 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 {
|
|
13
|
-
import { tryParseChannelKey } from '../core/channel-loader.js';
|
|
12
|
+
import { tryParseChannelKey } from '../core/channel/channel-loader.js';
|
|
14
13
|
import { isValidAid } from '../aun/aid/validation.js';
|
|
15
14
|
import { getOwners, ownerResolver } from '../core/ownership/owner-resolver.js';
|
|
16
15
|
import { prepareSameOwnerProof, sameOwnerQualification, sameOwnerRevision, requiresSameOwnerProof } from '../core/relation/same-owner-proof.js';
|
|
17
16
|
import { readRoleStore } from './role-store.js';
|
|
18
|
-
import { isOwnerDirectoryContact } from '../directory/
|
|
17
|
+
import { isOwnerDirectoryContact } from '../directory/admission.js';
|
|
19
18
|
export function isAuthenticated(userId) {
|
|
20
19
|
return isValidAid(String(userId || '').trim());
|
|
21
20
|
}
|
|
22
|
-
/** Return the protocol Owner
|
|
21
|
+
/** Return the protocol Owner. Configured values are never an authorization source. */
|
|
23
22
|
export function listStaticAgentOwners(aid, opts = {}) {
|
|
24
|
-
try {
|
|
25
|
-
const config = read(ConfigTarget.Agent, { self: aid }, { cache: opts.fresh !== true });
|
|
26
|
-
ownerResolver.setAgentConfiguredOwners(aid, configuredOwnerList(config));
|
|
27
|
-
}
|
|
28
|
-
catch { }
|
|
29
23
|
return ownerResolver.owners(aid);
|
|
30
24
|
}
|
|
31
25
|
/** Direct AUN relations with role=admin are the addressable Agent admin set. */
|