evolcore 0.0.48 → 0.0.50
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 +97 -0
- package/bin/ecmsg.js +9 -4
- package/dist/ability/caller/authorization.js +21 -0
- package/dist/ability/caller/command.js +164 -0
- package/dist/ability/caller/contract.js +102 -0
- package/dist/ability/caller/daemon.js +158 -0
- package/dist/ability/caller/service.js +380 -0
- package/dist/ability/command-contract.js +5 -0
- package/dist/ability/daemon.js +5 -1
- package/dist/ability/interop-v1.js +10 -3
- package/dist/ability/management.js +1 -0
- package/dist/agent-template/jobs.js +173 -1
- package/dist/agent-template/runtime.js +285 -8
- package/dist/agent-template/service.js +1159 -40
- package/dist/agent-template/types.js +2 -1
- package/dist/agents/baseagent-availability.js +27 -3
- package/dist/agents/baseagent-capability-adapter.js +102 -0
- package/dist/agents/baseagent-plugin-descriptor.js +274 -0
- package/dist/agents/baseagent-plugin-loader.js +145 -0
- package/dist/agents/baseagent.js +68 -2
- package/dist/agents/claude-gateway/agent-registration.js +389 -0
- package/dist/agents/claude-gateway/binding.js +96 -0
- package/dist/agents/claude-gateway/inbox.js +138 -0
- package/dist/agents/claude-gateway/index.js +125 -0
- package/dist/agents/claude-gateway/listing.js +330 -0
- package/dist/agents/claude-gateway/router.js +328 -0
- package/dist/agents/claude-gateway/sessions.js +128 -0
- package/dist/agents/claude-gateway/terminal.js +250 -0
- package/dist/agents/claude-gateway/transcript.js +272 -0
- package/dist/agents/claude-gateway/types.js +14 -0
- package/dist/agents/claude-runner.js +6 -10
- package/dist/agents/codex-runner.js +9 -2
- package/dist/agents/{gemini-runner.js → gemini/gemini-runner.js} +17 -17
- package/dist/{core/session/adapters → agents/gemini}/gemini-session-file-adapter.js +2 -2
- package/dist/agents/gemini/index.js +51 -0
- package/dist/aun/aid/control-aid.js +52 -32
- package/dist/aun/group/invite-service.js +6 -36
- package/dist/aun/group/operations.js +6 -0
- package/dist/aun/msg/mention-schema.js +1 -1
- package/dist/aun/msg/p2p.js +31 -2
- package/dist/aun/msg/upload.js +126 -3
- package/dist/build-identity.json +1 -1
- package/dist/channels/aun.js +1175 -457
- package/dist/cli/ability-command.js +42 -0
- package/dist/cli/agent-command.js +20 -1
- package/dist/cli/agent-create.js +78 -18
- package/dist/cli/agent-template.js +5 -3
- package/dist/cli/agent.js +91 -0
- package/dist/cli/aun-commands.js +92 -34
- package/dist/cli/bench.js +5 -2
- package/dist/cli/config.js +22 -6
- package/dist/cli/daemon-commands.js +245 -101
- package/dist/cli/directory.js +6 -1
- package/dist/cli/ecmsg-gateway.js +11 -9
- package/dist/cli/index.js +30 -5
- package/dist/cli/init.js +39 -63
- package/dist/cli/managed-command-guard.js +3 -0
- package/dist/cli/menu-client.js +32 -7
- package/dist/cli/model.js +20 -5
- package/dist/cli/pay-command.js +30 -0
- package/dist/cli/provider-command.js +6 -2
- package/dist/cli/quota.js +89 -0
- package/dist/cli/restart-monitor.js +2 -2
- package/dist/cli/role.js +1 -0
- package/dist/cli/services-command.js +12 -9
- package/dist/cli/team-workspace-command.js +56 -2
- package/dist/cli/thread-command.js +78 -12
- package/dist/config/access-policy.js +16 -3
- package/dist/config/config-field-policy.js +88 -9
- package/dist/config/config-manager.js +97 -47
- package/dist/config/config-operation-service.js +22 -1
- package/dist/config/gateway-config.js +9 -8
- package/dist/config/owner-config.js +0 -16
- package/dist/config/peer-role-resolver.js +1 -7
- package/dist/config/providers-config.js +107 -20
- package/dist/config/providers-management.js +45 -21
- package/dist/config/resolved-config-op.js +4 -44
- package/dist/config/schema-migration.js +78 -5
- package/dist/config/schema-registry.js +52 -7
- package/dist/config-store.js +1309 -17
- package/dist/core/agent-application-service.js +220 -1
- package/dist/core/agent-ipc-registration.js +19 -2
- package/dist/core/agent-reload-coordinator.js +5 -0
- package/dist/core/agent-runtime.js +198 -54
- package/dist/core/auth/agent-delegation.js +14 -0
- package/dist/core/auth/delegation-authorization.js +33 -26
- package/dist/core/auth/operation-authorizer.js +16 -1
- package/dist/core/auth/operation-catalog.js +59 -7
- package/dist/core/baseagent-loader.js +30 -3
- package/dist/core/capability/capability-manager.js +16 -7
- package/dist/core/channel-runtime.js +4 -2
- package/dist/core/command/agent-control.js +20 -2
- package/dist/core/command/agent-template-menu.js +4 -3
- package/dist/core/command/cli-intent-parser.js +28 -0
- package/dist/core/command/command-handler.js +45 -2
- package/dist/core/command/menu-catalog.js +20 -4
- package/dist/core/command/menu-file-path.js +70 -0
- package/dist/core/command/menu-handler.js +97 -73
- package/dist/core/command/menu-protocol.js +29 -0
- package/dist/core/command/menu-query-batch.js +2 -2
- package/dist/core/command/private-mention-menu.js +71 -0
- package/dist/core/command/remote-shell.js +565 -0
- package/dist/core/command/slash-handler.js +17 -26
- package/dist/core/command/team-workspace-bootstrap.js +2 -1
- package/dist/core/command/topic-slash.js +7 -1
- package/dist/core/daemon-bootstrap.js +0 -4
- package/dist/core/daemon-control.js +58 -1
- package/dist/core/daemon-lifecycle.js +29 -7
- package/dist/core/evolagent-registry.js +18 -9
- package/dist/core/handoff/runtime.js +1 -1
- package/dist/core/host-snapshot.js +8 -3
- package/dist/core/initialization/service.js +3 -0
- package/dist/core/interaction-router.js +130 -0
- package/dist/core/ipc-registration.js +5 -0
- package/dist/core/memory/consolidation-context.js +2 -1
- package/dist/core/memory/consolidation.js +35 -64
- package/dist/core/message/aun-ipc-sender.js +213 -74
- package/dist/core/message/aun-request-registry.js +31 -0
- package/dist/core/message/contact-admission.js +91 -6
- package/dist/core/message/contact-pending-inbound.js +113 -0
- package/dist/core/message/contact-thread-approval.js +212 -0
- package/dist/core/message/im-renderer.js +40 -1
- package/dist/core/message/message-admission.js +5 -39
- package/dist/core/message/message-bridge.js +197 -45
- package/dist/core/message/message-log.js +32 -0
- package/dist/core/message/message-queue.js +102 -18
- package/dist/core/message/peer-mode.js +15 -4
- package/dist/core/message/response-engine.js +174 -26
- package/dist/core/message/send-options.js +37 -3
- package/dist/core/message/send-routing.js +11 -7
- package/dist/core/model/config-scope.js +6 -14
- package/dist/core/model/model-catalog.js +5 -5
- package/dist/core/model/model-diagnostics.js +19 -0
- package/dist/core/model/model-fallback.js +13 -2
- package/dist/core/ownership/owner-resolver.js +12 -86
- package/dist/core/pack-auth.js +7 -0
- package/dist/core/pack-install.js +1 -1
- package/dist/core/permission/ec-command-parser.js +288 -77
- package/dist/core/permission/protected-paths.js +64 -9
- package/dist/core/permission/services-path-acl.js +458 -0
- package/dist/core/permission/tool-policy.js +26 -10
- package/dist/core/relation/peer-identity.js +13 -0
- package/dist/core/session/adapters/claude-session-file-adapter.js +6 -2
- package/dist/core/session/adapters/codex-session-file-adapter.js +4 -0
- package/dist/core/session/session-manager.js +47 -10
- package/dist/core/session/session-mapper.js +16 -0
- package/dist/core/skill/index-generator.js +2 -3
- package/dist/core/skill/switch-resolver.js +3 -0
- package/dist/core/task/task-recovery-service.js +1 -0
- package/dist/core/thread/command-parser.js +4 -1
- package/dist/core/thread/ipc-operation.js +4 -2
- package/dist/core/thread/thread-operation.js +25 -10
- package/dist/core/thread/thread-service.js +294 -55
- package/dist/core/thread/topic-id.js +67 -2
- package/dist/core/thread/types.js +15 -1
- package/dist/directory/owner-directory-admission.js +11 -8
- package/dist/directory/owner-directory-cache.js +19 -0
- package/dist/directory/owner-directory-markdown.js +1 -1
- package/dist/directory/owner-directory-policy.js +5 -30
- package/dist/directory/owner-directory-request-operation.js +5 -2
- package/dist/eck/kit-renderer.js +3 -2
- package/dist/eck/message-renderer.js +28 -5
- package/dist/ecweb/basic-settings-service.js +5 -9
- package/dist/ecweb/providers-service.js +4 -2
- package/dist/ecweb/runtime/supervisor.js +36 -8
- package/dist/event-center/center-config.js +9 -5
- package/dist/event-center/dispatcher.js +10 -1
- package/dist/event-center/ipc-operation.js +19 -0
- package/dist/event-center/registry.js +20 -5
- package/dist/event-center/runtime.js +10 -7
- package/dist/index.js +120 -41
- package/dist/ipc.js +83 -3
- package/dist/outputs/authorization.js +16 -0
- package/dist/outputs/cards.js +336 -0
- package/dist/outputs/events.js +3 -2
- package/dist/outputs/protocol.js +1 -0
- package/dist/outputs/service.js +2 -15
- package/dist/paths.js +48 -1
- package/dist/pay/command.js +38 -0
- package/dist/pay/protocol.js +136 -0
- package/dist/pay/runtime.js +188 -0
- package/dist/pay/service.js +384 -0
- package/dist/pay/store.js +81 -0
- package/dist/response-system/engines/v1/proactive-flow.js +29 -2
- package/dist/services/dispatcher.js +23 -5
- package/dist/services/host/main.js +388 -0
- package/dist/services/host/protocol.js +118 -0
- package/dist/services/host/resident.js +310 -0
- package/dist/services/host-client.js +386 -0
- package/dist/services/host-deploy.js +180 -0
- package/dist/services/host-launch.js +117 -0
- package/dist/services/host-recycle.js +203 -0
- package/dist/services/host-runtime.js +802 -0
- package/dist/services/idempotency.js +44 -86
- package/dist/services/index-generator.js +4 -3
- package/dist/services/index.js +204 -22
- package/dist/services/ipc-operation.js +288 -44
- package/dist/services/pack-manager.js +1 -0
- package/dist/services/script-runner.js +515 -83
- package/dist/services/service-payload.js +13 -7
- package/dist/services/validation.js +109 -4
- package/dist/stats/budget.js +1 -1
- package/dist/stats/model-resolver.js +2 -2
- package/dist/stats/quota-query.js +95 -0
- package/dist/trigger/application-service.js +6 -4
- package/dist/trigger/local-files.js +19 -9
- package/dist/trigger/scheduler.js +22 -12
- package/dist/trigger/script-sandbox.js +51 -8
- package/dist/utils/aid-bind.js +3 -0
- package/dist/utils/atomic-write.js +22 -8
- package/dist/utils/evolcore-version.js +2 -2
- package/dist/utils/host-info.js +173 -1
- package/dist/utils/logger.js +2 -2
- package/dist/utils/media-cache.js +190 -43
- package/dist/utils/npm-ops.js +43 -8
- package/dist/utils/restart-safety.js +14 -1
- package/dist/utils/system-memory.js +113 -25
- package/dist/utils/systemd-lifecycle.js +154 -0
- package/dist/utils/windows-shell-trust.js +7 -3
- package/dist/workbench/service.js +1 -1
- 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/evolcore/INDEX.md +9 -6
- package/kits/docs/evolcore/agent.md +36 -1
- package/kits/docs/evolcore/aid.md +45 -3
- package/kits/docs/evolcore/config.md +5 -2
- package/kits/docs/evolcore/directory.md +8 -9
- package/kits/docs/evolcore/group.md +2 -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 +7 -0
- package/kits/docs/evolcore/model.md +3 -0
- package/kits/docs/evolcore/msg.md +77 -10
- package/kits/docs/evolcore/pay.md +34 -0
- package/kits/docs/evolcore/provider.md +22 -1
- package/kits/docs/evolcore/quota.md +54 -0
- package/kits/docs/evolcore/role.md +3 -0
- package/kits/docs/evolcore/services.md +46 -18
- package/kits/docs/evolcore/stats.md +2 -0
- package/kits/docs/evolcore/thread-chain.md +2 -0
- package/kits/docs/evolcore/tool-authorization.md +10 -0
- package/kits/docs/evolcore/trigger.md +2 -0
- package/kits/rules/01-overview.md +11 -32
- package/kits/rules/02-navigation.md +7 -0
- package/kits/rules/06-channel.md +3 -3
- package/kits/schemas/_meta.json +38 -5
- package/kits/schemas/agent-config.schema.20.json +24 -0
- 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 +958 -0
- package/kits/schemas/daemon.schema.10.json +373 -0
- package/kits/schemas/daemon.schema.9.json +12 -0
- package/kits/schemas/defaults.schema.7.json +472 -0
- package/kits/schemas/providers.schema.3.json +18 -2
- package/kits/schemas/relation-config.schema.13.json +289 -0
- package/kits/skills/.switches.json +17 -1
- package/kits/skills/ability/SKILL.md +229 -34
- package/kits/skills/ability/STRUCTURE.md +333 -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 +64 -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 +3 -3
- package/kits/skills/ec-pay/SKILL.md +101 -0
- package/kits/skills/ec-pay/references/pay-cli.md +110 -0
- package/kits/skills/ec-provider/SKILL.md +58 -9
- package/kits/skills/{ec-service-proxy → ec-proxy}/SKILL.md +8 -5
- package/kits/skills/ec-service-call/SKILL.md +135 -0
- package/kits/skills/ec-service-pack/SKILL.md +277 -0
- package/kits/skills/ec-trigger/SKILL.md +1 -1
- package/kits/templates/memory-consolidation/notes.md +2 -2
- package/kits/templates/memory-consolidation/workflow.md +46 -0
- package/kits/templates/roles/visitor.json +1 -0
- package/kits/templates/system-fragments/channel.md +13 -4
- package/kits/templates/system-fragments/commands.md +5 -3
- package/kits/templates/system-fragments/directory-contacts.md +3 -4
- package/kits/templates/system-fragments/reply.md +1 -0
- package/kits/templates/system-fragments/session.md +1 -1
- package/kits/templates/system-fragments/thread.md +27 -128
- package/kits/templates/system-fragments/venue.md +27 -0
- package/package.json +4 -5
- package/scripts/agent-template/inspect.mjs +79 -29
- package/scripts/agent-template/overlay.mjs +20 -2
- package/scripts/agent-template/shared/common.mjs +24 -6
- package/scripts/agent-template/shared/team-schema.json +23 -5
- package/scripts/agent-template/shared/template-contract.mjs +107 -17
- package/scripts/agent-template/shared/template-package.mjs +254 -29
- package/scripts/agent-template/shared/template-runtime.mjs +145 -2
- package/scripts/agent-template/shared/template.mjs +67 -9
- package/scripts/agent-template/team-pack.mjs +132 -41
- package/scripts/agent-template/team-preview.mjs +249 -5
- 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 → agents/gemini}/gemini-capability-provider.js +0 -0
|
@@ -7,9 +7,10 @@ import { readJson, jsonBytes, assert, sha256, walkFiles, inside, unpack, behavio
|
|
|
7
7
|
import { loadTemplate, MANAGED_AGENT_FIELDS, templateDigest } from './shared/template.mjs';
|
|
8
8
|
import { loadEvolcore } from './shared/evolcore.mjs';
|
|
9
9
|
import { validateAgainstSchema, buildAgentTriggers, resolveProviderRefs } from './shared/plan.mjs';
|
|
10
|
-
import { excludedResource as excluded } from './shared/template-package.mjs';
|
|
10
|
+
import { excludedResource as excluded, isPortableEventPackFile, isPortableEventPackResource, readEventPacks, validateEventPack } from './shared/template-package.mjs';
|
|
11
11
|
import { normalizeTeam } from './shared/template-contract.mjs';
|
|
12
|
-
import { renderValue as renderTemplateValue, renderResource, bindTemplateProviders, teamMemberVariables, planMemberConfig } from './shared/template-runtime.mjs';
|
|
12
|
+
import { renderValue as renderTemplateValue, renderResource, bindTemplateProviders, teamMemberVariables, planMemberConfig, resolveMemberParameters, mergeMemberDefaults } from './shared/template-runtime.mjs';
|
|
13
|
+
import { DEFAULT_ACCESS_POLICY } from '../../dist/config/access-policy.js';
|
|
13
14
|
|
|
14
15
|
export async function inspectAgent(options) {
|
|
15
16
|
const config = options.effectiveConfig ?? readJson(path.join(options.agentDir, 'config.json'));
|
|
@@ -27,8 +28,9 @@ export async function inspectAgent(options) {
|
|
|
27
28
|
activeBaseagent: config.active_baseagent,
|
|
28
29
|
baseagents: BASEAGENTS.filter(name => config.baseagents?.[name]).map(name => ({ name, currentModel: config.baseagents[name].model ?? null,
|
|
29
30
|
currentEffort: config.baseagents[name].effort ?? null, provider: config.baseagents[name].provider ?? null })),
|
|
30
|
-
triggers, skills: options.skills ?? [],
|
|
31
|
-
project: { path: project, files:
|
|
31
|
+
triggers, events: readEventPacks(path.join(options.agentDir, 'events')).map(pack => ({ id: pack.id, name: pack.definition.name, enabled: pack.definition.enabled !== false })), skills: options.skills ?? [],
|
|
32
|
+
project: { path: project, files: options.listProjectFiles !== false && fs.existsSync(project)
|
|
33
|
+
? fs.readdirSync(project).filter(f => !excluded(f)).sort() : [] } };
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
export async function inspectPackage(options) {
|
|
@@ -57,7 +59,7 @@ export async function inspectPackage(options) {
|
|
|
57
59
|
assert(bytes.length === entry.size && sha256(bytes) === entry.sha256, 'INTEGRITY_FAILED', 'Manifest checksum mismatch: ' + entry.path);
|
|
58
60
|
}
|
|
59
61
|
assert(walkFiles(root).length === files.length + 2, 'INTEGRITY_FAILED', 'Unexpected package entries');
|
|
60
|
-
const { tpl, errors } = loadTemplate(templateDir);
|
|
62
|
+
const { tpl, errors } = loadTemplate(templateDir, { contextMemberKeys: Object.keys(options.contextMembers ?? {}) });
|
|
61
63
|
assert(!errors.length, 'INVALID_ARGUMENT', errors.join('; '));
|
|
62
64
|
const contract = normalizeTeam(tpl.team, { packageInfo: pkg });
|
|
63
65
|
assert(!contract.errors.length, 'INTEGRITY_FAILED', contract.errors.join('; '));
|
|
@@ -65,37 +67,42 @@ export async function inspectPackage(options) {
|
|
|
65
67
|
'INVALID_ARGUMENT', 'Matching template metadata and unique member keys required');
|
|
66
68
|
const schemaErrors = validateAgainstSchema(tpl.team, tpl.schema);
|
|
67
69
|
assert(!schemaErrors.length, 'INVALID_ARGUMENT', schemaErrors.join('; '));
|
|
70
|
+
const allKeys = tpl.actualKeys;
|
|
68
71
|
// Check the complete package before selecting member resources. No member may hide unsupported files.
|
|
69
72
|
for (const file of files) assert(file === 'team.json' || file === 'team.schema.json'
|
|
70
|
-
|| file.startsWith('.evolcore/skills/') ||
|
|
73
|
+
|| file.startsWith('.evolcore/skills/') || allKeys.some(key => file.startsWith('workspace/' + key + '/')
|
|
71
74
|
|| file.startsWith('agents/' + key + '/personal/soul/') && file.endsWith('.md') && !file.endsWith('/00-GUIDE.md')
|
|
72
|
-
|| file === 'agents/' + key + '/personal/welcome.md' || file.startsWith('agents/' + key + '/triggers/')
|
|
75
|
+
|| file === 'agents/' + key + '/personal/welcome.md' || file.startsWith('agents/' + key + '/triggers/')
|
|
76
|
+
|| file.startsWith('agents/' + key + '/') && isPortableEventPackFile(file.slice(('agents/' + key + '/').length))),
|
|
73
77
|
'INVALID_ARGUMENT', 'Unsupported template resource: ' + file);
|
|
78
|
+
assert(!options.sourceMemberKey || allKeys.includes(options.sourceMemberKey), 'INTEGRITY_FAILED', 'Original source member is absent');
|
|
79
|
+
const keys = options.sourceMemberKey ? [options.sourceMemberKey] : allKeys;
|
|
74
80
|
const platforms = tpl.team.host.platform;
|
|
75
81
|
if (platforms !== undefined) assert(Array.isArray(platforms) && platforms.length
|
|
76
82
|
&& platforms.every(p => ['linux', 'darwin', 'win32'].includes(p)) && platforms.includes(process.platform),
|
|
77
83
|
'INCOMPATIBLE', 'Template host.platform must support this host');
|
|
78
84
|
if (!options.targets) {
|
|
79
|
-
assert(
|
|
80
|
-
return inspectMember(options, { pkg, tpl, templateDir, files, key:
|
|
85
|
+
assert(keys.length === 1, 'INVALID_ARGUMENT', 'Provide targets mapping for every template member');
|
|
86
|
+
return inspectMember(options, { pkg, tpl, templateDir, files, key: keys[0] });
|
|
81
87
|
}
|
|
82
|
-
assert(isRecord(options.targets) &&
|
|
83
|
-
&&
|
|
84
|
-
const contexts =
|
|
88
|
+
assert(isRecord(options.targets) && keys.length === Object.keys(options.targets).length
|
|
89
|
+
&& keys.every(key => Object.hasOwn(options.targets, key)), 'INVALID_ARGUMENT', 'Map every template member exactly once');
|
|
90
|
+
const contexts = keys.map(key => options.targets[key]);
|
|
85
91
|
assert(contexts.every(c => isRecord(c) && typeof c.targetAid === 'string' && c.home === contexts[0].home)
|
|
86
92
|
&& new Set(contexts.map(c => c.targetAid)).size === contexts.length,
|
|
87
93
|
'INVALID_ARGUMENT', 'Members must map to distinct Agents on the same host');
|
|
88
|
-
assert(Object.keys(options.members ?? {}).every(key =>
|
|
94
|
+
assert(Object.keys(options.members ?? {}).every(key => keys.includes(key)), 'INVALID_ARGUMENT', 'Unknown member selection');
|
|
89
95
|
const writes = new Map(); const members = []; const plans = [];
|
|
90
|
-
const memberVars = teamMemberVariables(Object.fromEntries(
|
|
91
|
-
{ aid: options.targets[key].targetAid, projectPath: options.targets[key].projectPath ?? options.targets[key].targetConfig?.projects?.defaultPath }])),
|
|
96
|
+
const memberVars = teamMemberVariables({ ...options.contextMembers, ...Object.fromEntries(keys.map(key => [key,
|
|
97
|
+
{ aid: options.targets[key].targetAid, projectPath: options.targets[key].projectPath ?? options.targets[key].targetConfig?.projects?.defaultPath }])) },
|
|
92
98
|
contexts[0].ownerAid, contexts[0].hostAid);
|
|
93
|
-
for (const key of
|
|
99
|
+
for (const key of keys) {
|
|
94
100
|
const selection = options.members?.[key] ?? {};
|
|
95
101
|
const out = inside(options.out ?? path.dirname(root), 'members/' + key);
|
|
96
102
|
const data = await inspectMember({ ...options.targets[key], out, packageRoot: options.packageRoot, digest: options.digest,
|
|
97
|
-
pullId: options.pullId, planMode: options.planMode,
|
|
98
|
-
|
|
103
|
+
pullId: options.pullId, planMode: options.planMode, singleMember: !!options.sourceMemberKey, affectedAids: options.affectedAids,
|
|
104
|
+
memberVars: memberVars[key], selections: selection.providers ?? {}, externalAids: selection.externalAids ?? {} },
|
|
105
|
+
{ pkg, tpl, templateDir, key, memberDefaults: options.memberDefaults?.[key], files: files.filter(f => !f.startsWith('agents/') && !f.startsWith('workspace/')
|
|
99
106
|
|| f.startsWith('agents/' + key + '/') || f.startsWith('workspace/' + key + '/')) });
|
|
100
107
|
const plan = readJson(data.planFile);
|
|
101
108
|
for (const write of plan.writes) {
|
|
@@ -106,7 +113,8 @@ export async function inspectPackage(options) {
|
|
|
106
113
|
const { planFile: _planFile, ...preview } = data;
|
|
107
114
|
members.push({ key, targetAid: plan.targetAid, ...preview });
|
|
108
115
|
plans.push({ key, targetAid: plan.targetAid, projectPath: plan.projectPath, profile: plan.profile,
|
|
109
|
-
originalProfile: plan.originalProfile, profileVersion: plan.profileVersion, providers: plan.providers
|
|
116
|
+
originalProfile: plan.originalProfile, profileVersion: plan.profileVersion, providers: plan.providers,
|
|
117
|
+
managedConfig: plan.managedConfig, managedSkills: plan.managedSkills });
|
|
110
118
|
}
|
|
111
119
|
const planFile = path.join(options.out ?? path.dirname(root), 'plan.json');
|
|
112
120
|
atomicBytes(planFile, jsonBytes({ version: 1, home: contexts[0].home, templateDir,
|
|
@@ -115,7 +123,7 @@ export async function inspectPackage(options) {
|
|
|
115
123
|
members, externalAids: pkg.externalAids ?? [], planFile };
|
|
116
124
|
}
|
|
117
125
|
|
|
118
|
-
async function inspectMember(options, { pkg, tpl, templateDir, files, key }) {
|
|
126
|
+
async function inspectMember(options, { pkg, tpl, templateDir, files, key, memberDefaults }) {
|
|
119
127
|
const root = path.dirname(templateDir);
|
|
120
128
|
const targets = options.targetConfig;
|
|
121
129
|
assert(targets?.aid === options.targetAid, 'INVALID_ARGUMENT', 'Target configuration required');
|
|
@@ -123,14 +131,18 @@ async function inspectMember(options, { pkg, tpl, templateDir, files, key }) {
|
|
|
123
131
|
assert(typeof project === 'string' && path.isAbsolute(project), 'INVALID_ARGUMENT', 'Target default project required');
|
|
124
132
|
const vars = options.memberVars ?? teamMemberVariables({ [key]: { aid: options.targetAid, projectPath: project } }, options.ownerAid, options.hostAid)[key];
|
|
125
133
|
const renderValue = value => renderTemplateValue(value, vars, options.externalAids ?? {});
|
|
126
|
-
const
|
|
134
|
+
const originalMember = mergeMemberDefaults(memberDefaults ?? {}, tpl.team.agents.find(member => member.key === key));
|
|
135
|
+
const parameters = resolveMemberParameters(originalMember);
|
|
136
|
+
const spec = { ...renderValue(originalMember), ...parameters };
|
|
137
|
+
if (isRecord(spec.config)) for (const field of ['version', 'update']) delete spec.config[field];
|
|
127
138
|
for (const file of files) assert(file === 'team.json' || file === 'team.schema.json'
|
|
128
139
|
|| file.startsWith('.evolcore/skills/') || file.startsWith('workspace/' + key + '/')
|
|
129
140
|
|| file.startsWith('agents/' + key + '/personal/soul/') && file.endsWith('.md') && !file.endsWith('/00-GUIDE.md')
|
|
130
|
-
|| file === 'agents/' + key + '/personal/welcome.md' || file.startsWith('agents/' + key + '/triggers/')
|
|
141
|
+
|| file === 'agents/' + key + '/personal/welcome.md' || file.startsWith('agents/' + key + '/triggers/')
|
|
142
|
+
|| file.startsWith('agents/' + key + '/') && isPortableEventPackFile(file.slice(('agents/' + key + '/').length)),
|
|
131
143
|
'INVALID_ARGUMENT', 'Unsupported template resource: ' + file);
|
|
132
144
|
assert(isRecord(spec.config) && !MANAGED_AGENT_FIELDS.some(f => f in spec.config)
|
|
133
|
-
&& Object.keys(spec.config).every(f => ['chatmode', 'memory', 'active_baseagent', 'baseagents'].includes(f)),
|
|
145
|
+
&& Object.keys(spec.config).every(f => ['chatmode', 'memory', 'access', 'active_baseagent', 'baseagents', 'version', 'update'].includes(f)),
|
|
134
146
|
'INVALID_ARGUMENT', 'Unsupported template configuration');
|
|
135
147
|
const packageRoot = options.packageRoot ?? path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../..');
|
|
136
148
|
const temp = process.env.TMPDIR;
|
|
@@ -146,7 +158,7 @@ async function inspectMember(options, { pkg, tpl, templateDir, files, key }) {
|
|
|
146
158
|
&& (semver.satisfies(ec.version, pkg.compat.evolcore, { includePrerelease: true })
|
|
147
159
|
|| !pkg.compat.templateFeatures?.length && semver.satisfies(ec.version.replace(/-test\.\d+$/, ''), pkg.compat.evolcore, { includePrerelease: true }))
|
|
148
160
|
&& (pkg.compat.templateFeatures === undefined || Array.isArray(pkg.compat.templateFeatures)
|
|
149
|
-
&& pkg.compat.templateFeatures.every(feature =>
|
|
161
|
+
&& pkg.compat.templateFeatures.every(feature => ['member-references-v1', 'event-packs-v1', 'optional-members-v1'].includes(feature))),
|
|
150
162
|
'INCOMPATIBLE', 'Platform or EvolCore version is incompatible', { incompatible: ['platform/version'] });
|
|
151
163
|
const selections = options.selections ?? {};
|
|
152
164
|
for (const [name, block] of Object.entries(spec.config.baseagents ?? {})) {
|
|
@@ -161,6 +173,12 @@ async function inspectMember(options, { pkg, tpl, templateDir, files, key }) {
|
|
|
161
173
|
assert(resolved.baseagents?.[resolved.active_baseagent], 'INVALID_ARGUMENT', 'Default baseagent must be selected');
|
|
162
174
|
assert(Object.keys(selections).every(name => resolved.baseagents?.[name]), 'INVALID_ARGUMENT', 'Unknown baseagent selection');
|
|
163
175
|
const config = mergeObjects(targets, resolveProviderRefs(resolved));
|
|
176
|
+
if (config.access !== undefined) {
|
|
177
|
+
config.access.requestLimit = { ...DEFAULT_ACCESS_POLICY.requestLimit, ...config.access.requestLimit };
|
|
178
|
+
}
|
|
179
|
+
for (const field of ['version', 'update']) if (Object.hasOwn(parameters, field)) {
|
|
180
|
+
config[field] = structuredClone(parameters[field]);
|
|
181
|
+
}
|
|
164
182
|
for (const [name, select] of Object.entries(selections)) if (select.effort === null) delete config.baseagents[name].effort;
|
|
165
183
|
const configErrors = ec.validate('Agent', config);
|
|
166
184
|
assert(!configErrors.length, 'INVALID_ARGUMENT', configErrors.join('; '));
|
|
@@ -173,10 +191,11 @@ async function inspectMember(options, { pkg, tpl, templateDir, files, key }) {
|
|
|
173
191
|
publisherAid: pkg.publisher?.aid, digest: options.digest, installedAt: Date.now() }));
|
|
174
192
|
const render = (bytes, relative = '') => renderResource(bytes, vars, options.externalAids ?? {}, { json: relative.endsWith('.json') });
|
|
175
193
|
const preview = { profile: { fields: PROFILE_FIELDS.filter(f => spec.profile?.[f] !== undefined), preserve: ['aid', 'type', 'owner'] },
|
|
176
|
-
soul: { add: [], overwrite: [] }, triggers: { add: [], overwrite: [] }, skills: [], files: { add: 0, overwrite: 0 },
|
|
194
|
+
soul: { add: [], overwrite: [] }, triggers: { add: [], overwrite: [] }, events: { add: [], overwrite: [] }, skills: [], files: { add: 0, overwrite: 0 },
|
|
177
195
|
project: { path: project, changeDefault: false }, config: Object.keys(resolved) };
|
|
178
196
|
const skillMapping = {};
|
|
179
|
-
const localNames = [...new Set(files.filter(f => f.startsWith('.evolcore/skills/')).map(f => f.split('/')[2]))]
|
|
197
|
+
const localNames = [...new Set(files.filter(f => f.startsWith('.evolcore/skills/')).map(f => f.split('/')[2]))]
|
|
198
|
+
.filter(name => !options.singleMember || Object.hasOwn(spec.skills ?? {}, name));
|
|
180
199
|
for (const name of localNames) {
|
|
181
200
|
const source = inside(path.join(templateDir, '.evolcore', 'skills'), name);
|
|
182
201
|
const hash = createHash('sha256');
|
|
@@ -186,7 +205,8 @@ async function inspectMember(options, { pkg, tpl, templateDir, files, key }) {
|
|
|
186
205
|
const original = inside(path.join(options.home, 'skills'), name);
|
|
187
206
|
if (fs.existsSync(original) && templateDigest(original) !== desiredDigest) destName += '--' + pkg.id;
|
|
188
207
|
const dest = inside(path.join(options.home, 'skills'), destName);
|
|
189
|
-
if (fs.existsSync(dest)) assert(templateDigest(dest) === desiredDigest, '
|
|
208
|
+
if (fs.existsSync(dest)) assert(templateDigest(dest) === desiredDigest, options.singleMember ? 'SHARED_RESOURCE_CONFLICT' : 'CONFLICT',
|
|
209
|
+
'Skill name conflicts: ' + destName, options.singleMember ? { path: dest, affectedAids: options.affectedAids ?? [] } : undefined);
|
|
190
210
|
skillMapping[name] = destName;
|
|
191
211
|
preview.skills.push({ name, installAs: destName });
|
|
192
212
|
for (const p of walkFiles(source)) add(inside(dest, p), render(fs.readFileSync(inside(source, p)), p),
|
|
@@ -195,7 +215,34 @@ async function inspectMember(options, { pkg, tpl, templateDir, files, key }) {
|
|
|
195
215
|
const switchesFile = path.join(agentDir, 'skills', '.switches.json');
|
|
196
216
|
const switches = fs.existsSync(switchesFile) ? readJson(switchesFile) : {};
|
|
197
217
|
for (const [name, value] of Object.entries(spec.skills ?? {})) switches[skillMapping[name] ?? name] = { enabled: value.enabled === true };
|
|
198
|
-
add(switchesFile, jsonBytes(switches));
|
|
218
|
+
if (Object.keys(spec.skills ?? {}).length) add(switchesFile, jsonBytes(switches));
|
|
219
|
+
const eventPacks = readEventPacks(path.join(templateDir, 'agents', key, 'events'), { template: true });
|
|
220
|
+
for (const pack of eventPacks) {
|
|
221
|
+
const dir = inside(path.join(agentDir, 'events'), pack.id);
|
|
222
|
+
const definition = renderValue(pack.definition);
|
|
223
|
+
definition.enabled = false;
|
|
224
|
+
validateEventPack(definition, pack.files, { location: 'events/' + pack.id });
|
|
225
|
+
// Disable first; rollback restores scripts before re-enabling the old definition.
|
|
226
|
+
add(path.join(dir, 'pack.json'), jsonBytes(definition));
|
|
227
|
+
preview.events[fs.existsSync(path.join(dir, 'pack.json')) ? 'overwrite' : 'add'].push(pack.id);
|
|
228
|
+
for (const relative of pack.files.filter(file => file !== 'pack.json')) {
|
|
229
|
+
add(inside(dir, relative), render(fs.readFileSync(inside(pack.dir, relative)), relative),
|
|
230
|
+
fs.statSync(inside(pack.dir, relative)).mode & 0o111 ? 0o755 : 0o644);
|
|
231
|
+
}
|
|
232
|
+
for (const relative of walkFiles(dir, file => !isPortableEventPackResource(file))) {
|
|
233
|
+
if (!pack.files.includes(relative)) {
|
|
234
|
+
const target = inside(dir, relative);
|
|
235
|
+
writes.push({ path: target, remove: true, expected: snapshot(target) });
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
const archived = path.join(dir, '.archived');
|
|
239
|
+
if (fs.existsSync(archived)) writes.push({ path: archived, remove: true, expected: snapshot(archived) });
|
|
240
|
+
}
|
|
241
|
+
const center = path.join(agentDir, 'events', 'events-config.json');
|
|
242
|
+
if (eventPacks.length && !fs.existsSync(center)) {
|
|
243
|
+
add(center, jsonBytes({ v: 1, enabled: true, authMode: 'allowlist',
|
|
244
|
+
admission: { coupling: 'on', rematerializeMs: 300_000 }, rules: {}, rateLimit: { perMinute: 60, perHour: 600 } }));
|
|
245
|
+
}
|
|
199
246
|
const failures = []; const allowedTriggerFiles = new Set();
|
|
200
247
|
const triggers = buildAgentTriggers({ templateRoot: templateDir, key, aid: options.targetAid, vars, ec,
|
|
201
248
|
rec: { check: (name, ok, detail) => { if (!ok) failures.push(name + ': ' + String(detail)); } } });
|
|
@@ -237,6 +284,8 @@ async function inspectMember(options, { pkg, tpl, templateDir, files, key }) {
|
|
|
237
284
|
}
|
|
238
285
|
const plan = { version: 1, targetAid: options.targetAid, home: options.home, projectPath: project,
|
|
239
286
|
templateDir, templateDigest: templateDigest(templateDir), package: pkg, writes,
|
|
287
|
+
managedConfig: { ...resolveProviderRefs(resolved), ...parameters },
|
|
288
|
+
managedSkills: Object.fromEntries(Object.entries(spec.skills ?? {}).map(([name, value]) => [skillMapping[name] ?? name, { enabled: value.enabled === true }])),
|
|
240
289
|
profile: spec.profile,
|
|
241
290
|
originalProfile: options.profile, profileVersion: options.profileVersion, providers: refs };
|
|
242
291
|
const planFile = path.join(options.out ?? path.dirname(root), 'plan.json');
|
|
@@ -244,7 +293,8 @@ async function inspectMember(options, { pkg, tpl, templateDir, files, key }) {
|
|
|
244
293
|
return { pullId: options.pullId, template: { id: pkg.id, version: pkg.version, name: pkg.name, publisherAid: pkg.publisher?.aid },
|
|
245
294
|
compatible: true, incompatible: [], currentConfig: { baseagents: Object.entries((options.effectiveConfig ?? targets).baseagents ?? {}).map(([name, b]) => ({ name, ...b })),
|
|
246
295
|
soul: fs.existsSync(path.join(agentDir, 'personal', 'soul')) ? fs.readdirSync(path.join(agentDir, 'personal', 'soul')) : [],
|
|
247
|
-
triggers: fs.existsSync(path.join(agentDir, 'triggers')) ? fs.readdirSync(path.join(agentDir, 'triggers')) : []
|
|
296
|
+
triggers: fs.existsSync(path.join(agentDir, 'triggers')) ? fs.readdirSync(path.join(agentDir, 'triggers')) : [],
|
|
297
|
+
events: eventPacks.filter(pack => fs.existsSync(path.join(agentDir, 'events', pack.id, 'pack.json'))).map(pack => pack.id) },
|
|
248
298
|
providers: refs, preview, externalAids: pkg.externalAids ?? [], planFile };
|
|
249
299
|
} finally { fs.rmSync(scratch, { recursive: true, force: true }); }
|
|
250
300
|
}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import { assert, snapshot, equalSnapshot, readJson, jsonBytes, atomicBytes, regularPath } from './shared/common.mjs';
|
|
3
|
+
import { assert, snapshot, equalSnapshot, readJson, jsonBytes, atomicBytes, regularPath, sha256 } from './shared/common.mjs';
|
|
4
4
|
import { templateDigest } from './shared/template.mjs';
|
|
5
5
|
|
|
6
6
|
export function verifyPlan(plan) {
|
|
7
7
|
assert(templateDigest(plan.templateDir) === plan.templateDigest, 'CONFLICT', 'Cached template changed');
|
|
8
|
+
for (const [file, expected] of Object.entries(plan.observed ?? {})) {
|
|
9
|
+
assert(equalSnapshot(snapshot(file), expected), 'CONFLICT', 'Observed target changed: ' + file);
|
|
10
|
+
}
|
|
8
11
|
for (const write of plan.writes) assert(equalSnapshot(snapshot(write.path), write.expected), 'CONFLICT', 'Target changed: ' + write.path);
|
|
9
12
|
}
|
|
10
13
|
|
|
@@ -12,6 +15,13 @@ export function restore(backupDir) {
|
|
|
12
15
|
const file = path.join(backupDir, 'journal.json');
|
|
13
16
|
const journal = readJson(file);
|
|
14
17
|
assert(journal.version === 1 && Array.isArray(journal.entries), 'INSTALL_BROKEN', 'Invalid restore journal');
|
|
18
|
+
for (const entry of journal.entries) {
|
|
19
|
+
if (!Object.hasOwn(entry, 'desired')) continue; // Legacy journals retain their original recovery behavior.
|
|
20
|
+
const current = snapshot(entry.path);
|
|
21
|
+
const original = entry.existed ? { sha256: sha256(fs.readFileSync(path.join(backupDir, entry.backup))), mode: entry.mode } : null;
|
|
22
|
+
assert(equalSnapshot(current, original) || equalSnapshot(current, entry.desired),
|
|
23
|
+
'INSTALL_BROKEN', 'Independent change prevents safe restore: ' + entry.path);
|
|
24
|
+
}
|
|
15
25
|
for (const entry of [...journal.entries].reverse()) {
|
|
16
26
|
regularPath(entry.path);
|
|
17
27
|
if (entry.existed) atomicBytes(entry.path, fs.readFileSync(path.join(backupDir, entry.backup)), entry.mode);
|
|
@@ -27,6 +37,13 @@ export function restore(backupDir) {
|
|
|
27
37
|
export async function overlay(options) {
|
|
28
38
|
if (options.operation === 'restore') return restore(options.backupDir);
|
|
29
39
|
const plan = options.plan ?? readJson(options.planFile);
|
|
40
|
+
if (options.operation === 'verify-applied') {
|
|
41
|
+
for (const write of plan.writes) {
|
|
42
|
+
const expected = write.remove ? null : { sha256: sha256(Buffer.from(write.content, 'base64')), mode: write.mode };
|
|
43
|
+
assert(equalSnapshot(snapshot(write.path), expected), 'INTEGRITY_FAILED', 'Applied resource differs: ' + write.path);
|
|
44
|
+
}
|
|
45
|
+
return { verified: true };
|
|
46
|
+
}
|
|
30
47
|
verifyPlan(plan);
|
|
31
48
|
if (options.operation === 'verify') return { valid: true };
|
|
32
49
|
const backupDir = options.backupDir;
|
|
@@ -42,7 +59,8 @@ export async function overlay(options) {
|
|
|
42
59
|
for (const [i, write] of plan.writes.entries()) {
|
|
43
60
|
regularPath(write.path);
|
|
44
61
|
const existing = snapshot(write.path);
|
|
45
|
-
const entry = { path: write.path, existed: existing !== null, mode: existing?.mode ?? write.mode, backup: i + '.bin'
|
|
62
|
+
const entry = { path: write.path, existed: existing !== null, mode: existing?.mode ?? write.mode, backup: i + '.bin',
|
|
63
|
+
desired: write.remove ? null : { sha256: sha256(Buffer.from(write.content, 'base64')), mode: write.mode } };
|
|
46
64
|
if (existing) atomicBytes(path.join(backupDir, entry.backup), fs.readFileSync(write.path), 0o600);
|
|
47
65
|
journal.entries.push(entry);
|
|
48
66
|
let dir = path.dirname(write.path); const missing = [];
|
|
@@ -12,7 +12,7 @@ const parentPid = process.ppid;
|
|
|
12
12
|
|
|
13
13
|
export const LIMITS = { file: 20 * 1024 * 1024, total: 200 * 1024 * 1024, entries: 20000 };
|
|
14
14
|
export const BASEAGENTS = ['claude', 'codex', 'gemini', 'ecagent'];
|
|
15
|
-
export const CONFIG_FIELDS = ['chatmode', 'memory'];
|
|
15
|
+
export const CONFIG_FIELDS = ['chatmode', 'memory', 'access'];
|
|
16
16
|
export const PROFILE_FIELDS = ['name', 'description', 'avatar', 'tags', 'exttype'];
|
|
17
17
|
|
|
18
18
|
export function assert(value, code, message, data) {
|
|
@@ -48,22 +48,40 @@ export function regularPath(target) {
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
export function walkFiles(root, exclude = () => false) {
|
|
51
|
+
export function walkFiles(root, exclude = () => false, { maxTotalBytes = LIMITS.total, onOversizedFile, onMissingFile } = {}) {
|
|
52
52
|
if (!fs.existsSync(root)) return [];
|
|
53
53
|
regularPath(root);
|
|
54
54
|
const files = [];
|
|
55
55
|
let total = 0;
|
|
56
|
+
let count = 0;
|
|
56
57
|
const visit = (dir) => {
|
|
57
|
-
|
|
58
|
+
let entries;
|
|
59
|
+
try { regularPath(dir); entries = fs.readdirSync(dir, { withFileTypes: true }); }
|
|
60
|
+
catch (error) {
|
|
61
|
+
if (!onMissingFile || !['ENOENT', 'ENOTDIR'].includes(error.code)) throw error;
|
|
62
|
+
onMissingFile(posix(path.relative(root, dir))); return;
|
|
63
|
+
}
|
|
64
|
+
for (const e of entries.sort((a, b) => a.name.localeCompare(b.name))) {
|
|
58
65
|
const file = path.join(dir, e.name);
|
|
59
66
|
if (exclude(posix(path.relative(root, file)))) continue;
|
|
60
67
|
assert(!e.isSymbolicLink() && (e.isFile() || e.isDirectory()), 'INVALID_ARGUMENT', 'Only regular files/directories: ' + file);
|
|
61
|
-
assert(
|
|
68
|
+
assert(count < LIMITS.entries, 'PACKAGE_TOO_LARGE', 'Too many package files');
|
|
62
69
|
if (e.isDirectory()) visit(file);
|
|
63
70
|
else {
|
|
64
|
-
|
|
71
|
+
count++;
|
|
72
|
+
let stat;
|
|
73
|
+
try { stat = fs.lstatSync(file); }
|
|
74
|
+
catch (error) {
|
|
75
|
+
if (!onMissingFile || !['ENOENT', 'ENOTDIR'].includes(error.code)) throw error;
|
|
76
|
+
onMissingFile(posix(path.relative(root, file))); continue;
|
|
77
|
+
}
|
|
78
|
+
assert(stat.isFile(), 'INVALID_ARGUMENT', 'Only regular files: ' + file);
|
|
79
|
+
if (stat.size > LIMITS.file && onOversizedFile) {
|
|
80
|
+
onOversizedFile({ path: posix(path.relative(root, file)), size: stat.size, limit: LIMITS.file });
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
65
83
|
total += stat.size;
|
|
66
|
-
assert(stat.size <= LIMITS.file && total <=
|
|
84
|
+
assert(stat.size <= LIMITS.file && total <= maxTotalBytes, 'PACKAGE_TOO_LARGE', 'Package size limit exceeded: ' + file);
|
|
67
85
|
files.push(posix(path.relative(root, file)));
|
|
68
86
|
}
|
|
69
87
|
}
|
|
@@ -3,29 +3,37 @@
|
|
|
3
3
|
"$id": "urn:evolcore:agent-template:team:v1",
|
|
4
4
|
"title": "Agent 团队模板 v1",
|
|
5
5
|
"type": "object",
|
|
6
|
-
"required": ["$schema_version", "
|
|
6
|
+
"required": ["$schema_version", "id", "version", "host", "agents"],
|
|
7
7
|
"additionalProperties": true,
|
|
8
8
|
"properties": {
|
|
9
9
|
"$schema_version": { "type": "integer", "const": 1, "default": 1, "title": "格式版本" },
|
|
10
|
-
"
|
|
10
|
+
"id": { "type": "string", "pattern": "^[a-z0-9][a-z0-9._-]{0,63}$", "title": "模板 ID", "description": "稳定标识,对应 PACKAGE.id;旧 name 仅兼容输入,归一化后不再保留" },
|
|
11
11
|
"version": { "type": "string", "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$", "default": "1.0.0", "title": "模板版本" },
|
|
12
12
|
"title": { "type": "string", "minLength": 1, "maxLength": 64, "title": "模板显示名", "description": "发布时对应 PACKAGE.name;省略时使用模板标识" },
|
|
13
13
|
"description": { "type": "string", "maxLength": 500, "title": "模板说明" },
|
|
14
|
-
"issuer": { "type": "string", "pattern": "^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$", "title": "签发域", "description": "创建身份时使用,覆盖安装不改变身份" },
|
|
15
14
|
"owner": { "type": "object", "title": "创建时的 Owner", "additionalProperties": false, "properties": { "name": { "type": "string", "minLength": 1, "title": "显示名" } } },
|
|
16
15
|
"host": {
|
|
17
16
|
"type": "object", "title": "主机", "required": ["platform"], "additionalProperties": false,
|
|
18
17
|
"properties": {
|
|
18
|
+
"name": { "type": "string", "minLength": 1, "maxLength": 64, "pattern": "[\\s\\S]*\\S[\\s\\S]*", "title": "魔盒主机名称", "description": "创建时发布为 Host AID 的名片显示名;省略时使用平台名主机-AID前缀,需要支持保留自定义Host名称的Core" },
|
|
19
19
|
"platform": { "type": "array", "title": "支持平台", "minItems": 1, "uniqueItems": true, "default": ["linux"], "items": { "type": "string", "enum": ["linux", "darwin", "win32"] } },
|
|
20
|
-
"config": { "type": "object", "title": "创建时的主机配置", "description": "仅创建流程使用,运行时继续由 EvolCore 配置 schema 校验", "additionalProperties": true, "properties": { "aun": { "type": "object", "title": "AUN 配置" }, "services": { "type": "array", "title": "本地服务", "items": { "type": "object" } } } }
|
|
20
|
+
"config": { "type": "object", "title": "创建时的主机配置", "description": "仅创建流程使用,运行时继续由 EvolCore 配置 schema 校验", "additionalProperties": true, "properties": { "aun": { "type": "object", "title": "AUN 配置", "additionalProperties": true, "properties": { "defaultAidDomain": { "type": "string", "maxLength": 253, "pattern": "^(?![0-9]{1,3}(?:\\.[0-9]{1,3}){3}$)(?!.*\\.localhost$)[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)+$", "title": "默认 AID 域", "description": "团队身份注册与生成的 daemon 共用;省略时使用 agentid.cn" } } }, "services": { "type": "array", "title": "本地服务", "items": { "type": "object" } } } }
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
23
|
"agents": {
|
|
24
24
|
"type": "array", "title": "团队成员", "minItems": 1,
|
|
25
25
|
"items": {
|
|
26
26
|
"type": "object", "required": ["key", "profile"], "additionalProperties": true,
|
|
27
|
+
"oneOf": [
|
|
28
|
+
{ "properties": { "optional": { "const": false } }, "not": { "required": ["agentTemplateId"] } },
|
|
29
|
+
{ "required": ["optional", "agentTemplateId"], "properties": { "optional": { "const": true }, "profile": { "required": ["name", "description"] }, "config": { "type": "object", "additionalProperties": false, "properties": { "access": { "type": "object" } } } }, "not": { "anyOf": [{ "required": ["skills"] }, { "required": ["version"] }, { "required": ["update"] }] } }
|
|
30
|
+
],
|
|
27
31
|
"properties": {
|
|
28
32
|
"key": { "type": "string", "pattern": "^[a-z0-9][a-z0-9_-]{0,31}$", "title": "成员标识", "description": "对应资源目录与目标映射中的 key" },
|
|
33
|
+
"optional": { "type": "boolean", "title": "可选成员", "description": "默认不创建身份;用户以后从本Team成员列表安装" },
|
|
34
|
+
"agentTemplateId": { "type": "string", "pattern": "^agent_[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$", "title": "Agent 模板唯一 ID", "description": "可选成员引用已确认的单Agent模板" },
|
|
35
|
+
"version": { "type": "string", "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$", "title": "Agent 版本", "description": "作者显式填写的版本声明;不自动生成或修改" },
|
|
36
|
+
"update": { "type": "object", "title": "升级参数声明", "additionalProperties": false, "required": ["mode"], "properties": { "mode": { "type": "string", "enum": ["auto", "manual", "disabled"], "title": "升级模式", "description": "仅保存声明,当前未启用升级执行机制" }, "publisher": { "type": "string", "pattern": "^[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?(\\.[a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?){2,}$", "title": "发布者 AID", "description": "仅为发布者声明,不代表身份已验证" } } },
|
|
29
37
|
"profile": {
|
|
30
38
|
"type": "object", "title": "公开名片", "required": ["name"], "additionalProperties": false,
|
|
31
39
|
"properties": {
|
|
@@ -41,6 +49,15 @@
|
|
|
41
49
|
"type": "object", "title": "Agent 配置", "additionalProperties": true,
|
|
42
50
|
"description": "保留扩展配置;创建与覆盖分别执行本模式的能力边界和完整运行时校验",
|
|
43
51
|
"properties": {
|
|
52
|
+
"access": { "type": "object", "title": "访问默认设置", "description": "可选成员的安装默认值;下载模板显式字段覆盖", "additionalProperties": false, "properties": {
|
|
53
|
+
"contactAdmission": { "type": "string", "enum": ["legacy", "app-v1"], "title": "准入模式" },
|
|
54
|
+
"allowInternalContacts": { "type": "boolean", "title": "允许内部联系人" },
|
|
55
|
+
"allowExternalContacts": { "type": "boolean", "title": "允许外部联系人" },
|
|
56
|
+
"allowAllContacts": { "type": "boolean", "title": "允许所有联系人" },
|
|
57
|
+
"allowedAids": { "type": "array", "uniqueItems": true, "title": "允许 AID", "items": { "type": "string", "pattern": "^[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?){2,}$" } },
|
|
58
|
+
"deniedAids": { "type": "array", "uniqueItems": true, "title": "拒绝 AID", "items": { "type": "string", "pattern": "^[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?){2,}$" } },
|
|
59
|
+
"requestLimit": { "type": "object", "title": "请求限流", "additionalProperties": false, "properties": { "maxTimes": { "type": "integer", "minimum": 1, "maximum": 100000, "title": "次数" }, "coolDown": { "type": "integer", "minimum": 1, "maximum": 86400, "title": "冷却秒数" } } }
|
|
60
|
+
} },
|
|
44
61
|
"active_baseagent": { "type": "string", "title": "默认基座", "enum": ["claude", "codex", "gemini", "ecagent"] },
|
|
45
62
|
"baseagents": {
|
|
46
63
|
"type": "object", "title": "基座配置", "additionalProperties": {
|
|
@@ -64,7 +81,8 @@
|
|
|
64
81
|
}
|
|
65
82
|
}
|
|
66
83
|
},
|
|
67
|
-
"
|
|
84
|
+
"external_contacts": { "type": "array", "title": "外部成员", "items": { "type": "object", "required": ["aid"], "additionalProperties": false, "properties": { "aid": { "type": "string", "pattern": "^[a-z0-9][a-z0-9_-]*\\.(?:[a-z0-9-]+\\.)*[a-z0-9-]+$", "title": "AID" }, "name": { "type": "string", "minLength": 1, "title": "名称" } } } },
|
|
85
|
+
"personal_assistant": { "type": "integer", "minimum": 0, "title": "个人助理下标", "description": "创建团队时的个人助理成员下标,必须为非可选成员" },
|
|
68
86
|
"tags": { "type": "array", "title": "创建时的公共标签", "minItems": 1, "items": { "type": "string", "minLength": 1 } }
|
|
69
87
|
}
|
|
70
88
|
}
|