evolcore 0.0.7 → 0.0.9
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 +43 -0
- package/README.md +38 -4
- package/dist/agents/baseagent.js +117 -24
- package/dist/agents/claude-runner.js +31 -2
- package/dist/agents/codex-app-server-client.js +37 -2
- package/dist/agents/codex-runner.js +11 -3
- package/dist/aun/aid/control-aid.js +40 -27
- package/dist/aun/aid/domain.js +23 -0
- package/dist/aun/msg/group.js +9 -9
- package/dist/aun/msg/p2p.js +11 -6
- package/dist/aun/msg/upload.js +43 -29
- package/dist/aun/outbox.js +48 -5
- package/dist/channels/aun.js +225 -71
- package/dist/cli/aun-commands.js +10 -7
- package/dist/cli/bench.js +4 -3
- package/dist/cli/daemon-commands.js +208 -68
- package/dist/cli/data-command.js +62 -35
- package/dist/cli/index.js +11 -1
- package/dist/cli/init-channel.js +1 -1
- package/dist/cli/init.js +112 -17
- package/dist/cli/model.js +5 -5
- package/dist/cli/restart-monitor.js +102 -22
- package/dist/config/builtin-role-templates.js +4 -3
- package/dist/config/config-field-policy.js +6 -2
- package/dist/config/config-manager.js +79 -11
- package/dist/config/gateway-config.js +80 -35
- package/dist/config/role-schema.js +18 -3
- package/dist/config/role-service.js +3 -3
- package/dist/config/role-store.js +4 -3
- package/dist/config-store.js +19 -3
- package/dist/core/auth/operation-authorizer.js +3 -1
- package/dist/core/baseagent-loader.js +5 -3
- package/dist/core/bootstrap-service.js +0 -12
- package/dist/core/capability/providers/codex-capability-provider.js +2 -2
- package/dist/core/channel-loader.js +15 -2
- package/dist/core/command/command-handler.js +1 -1
- package/dist/core/command/evol-menu-version-gate.js +3 -2
- package/dist/core/command/menu-handler.js +50 -28
- package/dist/core/command/menu-protocol.js +7 -4
- package/dist/core/command/slash-handler.js +4 -4
- package/dist/core/data-migration.js +517 -24
- package/dist/core/inference/text-inference.js +18 -5
- package/dist/core/message/message-bridge.js +17 -6
- package/dist/core/message/response-engine.js +22 -3
- package/dist/core/model/config-scope.js +3 -3
- package/dist/core/permission/tool-policy.js +18 -0
- package/dist/core/protected-paths.js +12 -1
- package/dist/index.js +794 -725
- package/dist/ipc.js +3 -1
- package/dist/product.js +1 -0
- package/dist/utils/autostart.js +27 -0
- package/dist/utils/codex-cli.js +39 -0
- package/dist/utils/cross-platform.js +147 -18
- package/dist/utils/ecweb-utils.js +15 -2
- package/dist/utils/instance-registry.js +43 -6
- package/dist/utils/macos-autostart.js +179 -0
- package/dist/utils/process-introspect.js +7 -3
- package/dist/utils/windows-autostart.js +130 -0
- package/ecagent/dist/agent-loop.d.ts +1 -1
- package/ecagent/dist/agent-loop.js +1 -1
- package/ecagent/dist/agent.d.ts +1 -1
- package/ecagent/dist/agent.js +1 -1
- package/ecagent/dist/harness/agent-harness.d.ts +1 -1
- package/ecagent/dist/harness/compaction/branch-summarization.d.ts +1 -1
- package/ecagent/dist/harness/compaction/compaction.d.ts +1 -1
- package/ecagent/dist/harness/compaction/utils.d.ts +1 -1
- package/ecagent/dist/harness/messages.d.ts +1 -1
- package/ecagent/dist/harness/session/session.d.ts +1 -1
- package/ecagent/dist/harness/types.d.ts +1 -1
- package/ecagent/dist/proxy.d.ts +1 -1
- package/ecagent/dist/proxy.js +1 -1
- package/ecagent/dist/types.d.ts +1 -1
- package/kits/migrations/migrate-role-config-v5.mjs +27 -2
- package/kits/rules/01-overview.md +3 -2
- package/kits/schemas/_meta.json +2 -1
- package/kits/schemas/agent-config.schema.10.json +19 -1
- package/kits/schemas/daemon.schema.4.json +136 -0
- package/kits/schemas/defaults.schema.4.json +15 -1
- package/kits/schemas/relation-config.schema.8.json +22 -1
- package/kits/schemas/role-config.schema.1.json +2 -2
- package/package.json +2 -4
- package/ecagent/dist/agent-loop.d.ts.map +0 -1
- package/ecagent/dist/agent-loop.js.map +0 -1
- package/ecagent/dist/agent.d.ts.map +0 -1
- package/ecagent/dist/agent.js.map +0 -1
- package/ecagent/dist/harness/agent-harness.d.ts.map +0 -1
- package/ecagent/dist/harness/agent-harness.js.map +0 -1
- package/ecagent/dist/harness/compaction/branch-summarization.d.ts.map +0 -1
- package/ecagent/dist/harness/compaction/branch-summarization.js.map +0 -1
- package/ecagent/dist/harness/compaction/compaction.d.ts.map +0 -1
- package/ecagent/dist/harness/compaction/compaction.js.map +0 -1
- package/ecagent/dist/harness/compaction/utils.d.ts.map +0 -1
- package/ecagent/dist/harness/compaction/utils.js.map +0 -1
- package/ecagent/dist/harness/env/nodejs.d.ts.map +0 -1
- package/ecagent/dist/harness/env/nodejs.js.map +0 -1
- package/ecagent/dist/harness/messages.d.ts.map +0 -1
- package/ecagent/dist/harness/messages.js.map +0 -1
- package/ecagent/dist/harness/prompt-templates.d.ts.map +0 -1
- package/ecagent/dist/harness/prompt-templates.js.map +0 -1
- package/ecagent/dist/harness/session/jsonl-repo.d.ts.map +0 -1
- package/ecagent/dist/harness/session/jsonl-repo.js.map +0 -1
- package/ecagent/dist/harness/session/jsonl-storage.d.ts.map +0 -1
- package/ecagent/dist/harness/session/jsonl-storage.js.map +0 -1
- package/ecagent/dist/harness/session/memory-repo.d.ts.map +0 -1
- package/ecagent/dist/harness/session/memory-repo.js.map +0 -1
- package/ecagent/dist/harness/session/memory-storage.d.ts.map +0 -1
- package/ecagent/dist/harness/session/memory-storage.js.map +0 -1
- package/ecagent/dist/harness/session/repo-utils.d.ts.map +0 -1
- package/ecagent/dist/harness/session/repo-utils.js.map +0 -1
- package/ecagent/dist/harness/session/session.d.ts.map +0 -1
- package/ecagent/dist/harness/session/session.js.map +0 -1
- package/ecagent/dist/harness/session/uuid.d.ts.map +0 -1
- package/ecagent/dist/harness/session/uuid.js.map +0 -1
- package/ecagent/dist/harness/skills.d.ts.map +0 -1
- package/ecagent/dist/harness/skills.js.map +0 -1
- package/ecagent/dist/harness/system-prompt.d.ts.map +0 -1
- package/ecagent/dist/harness/system-prompt.js.map +0 -1
- package/ecagent/dist/harness/types.d.ts.map +0 -1
- package/ecagent/dist/harness/types.js.map +0 -1
- package/ecagent/dist/harness/utils/shell-output.d.ts.map +0 -1
- package/ecagent/dist/harness/utils/shell-output.js.map +0 -1
- package/ecagent/dist/harness/utils/truncate.d.ts.map +0 -1
- package/ecagent/dist/harness/utils/truncate.js.map +0 -1
- package/ecagent/dist/index.d.ts.map +0 -1
- package/ecagent/dist/index.js.map +0 -1
- package/ecagent/dist/node.d.ts.map +0 -1
- package/ecagent/dist/node.js.map +0 -1
- package/ecagent/dist/proxy.d.ts.map +0 -1
- package/ecagent/dist/proxy.js.map +0 -1
- package/ecagent/dist/runtime/api/lazy.d.ts.map +0 -1
- package/ecagent/dist/runtime/api/lazy.js.map +0 -1
- package/ecagent/dist/runtime/api/pi-messages.d.ts.map +0 -1
- package/ecagent/dist/runtime/api/pi-messages.js.map +0 -1
- package/ecagent/dist/runtime/api/pi-messages.lazy.d.ts.map +0 -1
- package/ecagent/dist/runtime/api/pi-messages.lazy.js.map +0 -1
- package/ecagent/dist/runtime/auth/context.d.ts.map +0 -1
- package/ecagent/dist/runtime/auth/context.js.map +0 -1
- package/ecagent/dist/runtime/auth/credential-store.d.ts.map +0 -1
- package/ecagent/dist/runtime/auth/credential-store.js.map +0 -1
- package/ecagent/dist/runtime/auth/helpers.d.ts.map +0 -1
- package/ecagent/dist/runtime/auth/helpers.js.map +0 -1
- package/ecagent/dist/runtime/auth/resolve.d.ts.map +0 -1
- package/ecagent/dist/runtime/auth/resolve.js.map +0 -1
- package/ecagent/dist/runtime/auth/types.d.ts.map +0 -1
- package/ecagent/dist/runtime/auth/types.js.map +0 -1
- package/ecagent/dist/runtime/compat.d.ts.map +0 -1
- package/ecagent/dist/runtime/compat.js.map +0 -1
- package/ecagent/dist/runtime/index.d.ts.map +0 -1
- package/ecagent/dist/runtime/index.js.map +0 -1
- package/ecagent/dist/runtime/models.d.ts.map +0 -1
- package/ecagent/dist/runtime/models.js.map +0 -1
- package/ecagent/dist/runtime/oauth.d.ts.map +0 -1
- package/ecagent/dist/runtime/oauth.js.map +0 -1
- package/ecagent/dist/runtime/providers/faux.d.ts.map +0 -1
- package/ecagent/dist/runtime/providers/faux.js.map +0 -1
- package/ecagent/dist/runtime/types.d.ts.map +0 -1
- package/ecagent/dist/runtime/types.js.map +0 -1
- package/ecagent/dist/runtime/utils/diagnostics.d.ts.map +0 -1
- package/ecagent/dist/runtime/utils/diagnostics.js.map +0 -1
- package/ecagent/dist/runtime/utils/event-stream.d.ts.map +0 -1
- package/ecagent/dist/runtime/utils/event-stream.js.map +0 -1
- package/ecagent/dist/runtime/utils/headers.d.ts.map +0 -1
- package/ecagent/dist/runtime/utils/headers.js.map +0 -1
- package/ecagent/dist/runtime/utils/json-parse.d.ts.map +0 -1
- package/ecagent/dist/runtime/utils/json-parse.js.map +0 -1
- package/ecagent/dist/runtime/utils/oauth/types.d.ts.map +0 -1
- package/ecagent/dist/runtime/utils/oauth/types.js.map +0 -1
- package/ecagent/dist/runtime/utils/overflow.d.ts.map +0 -1
- package/ecagent/dist/runtime/utils/overflow.js.map +0 -1
- package/ecagent/dist/runtime/utils/provider-env.d.ts.map +0 -1
- package/ecagent/dist/runtime/utils/provider-env.js.map +0 -1
- package/ecagent/dist/runtime/utils/retry.d.ts.map +0 -1
- package/ecagent/dist/runtime/utils/retry.js.map +0 -1
- package/ecagent/dist/runtime/utils/typebox-helpers.d.ts.map +0 -1
- package/ecagent/dist/runtime/utils/typebox-helpers.js.map +0 -1
- package/ecagent/dist/runtime/utils/validation.d.ts.map +0 -1
- package/ecagent/dist/runtime/utils/validation.js.map +0 -1
- package/ecagent/dist/types.d.ts.map +0 -1
- package/ecagent/dist/types.js.map +0 -1
- package/ecagent/package.json +0 -93
- package/ecagent/src/agent-loop.ts +0 -792
- package/ecagent/src/agent.ts +0 -575
- package/ecagent/src/harness/agent-harness.ts +0 -1029
- package/ecagent/src/harness/compaction/branch-summarization.ts +0 -261
- package/ecagent/src/harness/compaction/compaction.ts +0 -753
- package/ecagent/src/harness/compaction/utils.ts +0 -144
- package/ecagent/src/harness/env/nodejs.ts +0 -569
- package/ecagent/src/harness/messages.ts +0 -164
- package/ecagent/src/harness/prompt-templates.ts +0 -267
- package/ecagent/src/harness/session/jsonl-repo.ts +0 -179
- package/ecagent/src/harness/session/jsonl-storage.ts +0 -314
- package/ecagent/src/harness/session/memory-repo.ts +0 -50
- package/ecagent/src/harness/session/memory-storage.ts +0 -133
- package/ecagent/src/harness/session/repo-utils.ts +0 -51
- package/ecagent/src/harness/session/session.ts +0 -338
- package/ecagent/src/harness/session/uuid.ts +0 -54
- package/ecagent/src/harness/skills.ts +0 -375
- package/ecagent/src/harness/system-prompt.ts +0 -34
- package/ecagent/src/harness/types.ts +0 -838
- package/ecagent/src/harness/utils/shell-output.ts +0 -135
- package/ecagent/src/harness/utils/truncate.ts +0 -344
- package/ecagent/src/index.ts +0 -46
- package/ecagent/src/node.ts +0 -2
- package/ecagent/src/proxy.ts +0 -367
- package/ecagent/src/runtime/api/lazy.ts +0 -70
- package/ecagent/src/runtime/api/pi-messages.lazy.ts +0 -4
- package/ecagent/src/runtime/api/pi-messages.ts +0 -436
- package/ecagent/src/runtime/auth/context.ts +0 -45
- package/ecagent/src/runtime/auth/credential-store.ts +0 -47
- package/ecagent/src/runtime/auth/helpers.ts +0 -46
- package/ecagent/src/runtime/auth/resolve.ts +0 -141
- package/ecagent/src/runtime/auth/types.ts +0 -182
- package/ecagent/src/runtime/compat.ts +0 -158
- package/ecagent/src/runtime/index.ts +0 -31
- package/ecagent/src/runtime/models.ts +0 -452
- package/ecagent/src/runtime/oauth.ts +0 -1
- package/ecagent/src/runtime/providers/faux.ts +0 -538
- package/ecagent/src/runtime/types.ts +0 -718
- package/ecagent/src/runtime/utils/diagnostics.ts +0 -45
- package/ecagent/src/runtime/utils/event-stream.ts +0 -88
- package/ecagent/src/runtime/utils/headers.ts +0 -18
- package/ecagent/src/runtime/utils/json-parse.ts +0 -124
- package/ecagent/src/runtime/utils/oauth/types.ts +0 -79
- package/ecagent/src/runtime/utils/overflow.ts +0 -165
- package/ecagent/src/runtime/utils/provider-env.ts +0 -52
- package/ecagent/src/runtime/utils/retry.ts +0 -101
- package/ecagent/src/runtime/utils/typebox-helpers.ts +0 -24
- package/ecagent/src/runtime/utils/validation.ts +0 -310
- package/ecagent/src/types.ts +0 -430
- package/ecagent/tsconfig.build.json +0 -32
|
@@ -17,6 +17,7 @@ import { resolvePaths, agentConfig as agentConfigPath, agentContactConfig, agent
|
|
|
17
17
|
import { atomicReadJson, atomicWriteJson } from '../utils/atomic-write.js';
|
|
18
18
|
import { fileCache } from '../core/daemon-file-cache.js';
|
|
19
19
|
import { isValidAid } from '../aun/aid/validation.js';
|
|
20
|
+
import { normalizeAidDomain } from '../aun/aid/domain.js';
|
|
20
21
|
import { isExplicitGroupId } from '../aun/group-identity.js';
|
|
21
22
|
import { parseContactAlias } from './contact-alias.js';
|
|
22
23
|
import { loadSchema, listSchemaVersions, currentVersion, isSchemaName, } from './schema-registry.js';
|
|
@@ -504,10 +505,40 @@ export function read(target, sel, opts = {}) {
|
|
|
504
505
|
: target === ConfigTarget.Relation
|
|
505
506
|
? foldLegacyProactiveBlock(migrated)
|
|
506
507
|
: migrated;
|
|
508
|
+
// Agent read compatibility may move the legacy top-level `agents` block to
|
|
509
|
+
// `baseagents`, so canonicalize effort after that structural migration.
|
|
510
|
+
const canonicalized = normalizeBaseagentEffortCompat(normalized);
|
|
507
511
|
if (!opts.expand)
|
|
508
|
-
return
|
|
512
|
+
return canonicalized;
|
|
509
513
|
const resolver = buildEnvResolver(envScopeFor(sel));
|
|
510
|
-
return expandVars(
|
|
514
|
+
return expandVars(canonicalized, resolver);
|
|
515
|
+
}
|
|
516
|
+
/**
|
|
517
|
+
* Canonicalize the legacy Codex `reasoning` config key to the public `effort`
|
|
518
|
+
* key. The runner may still accept `reasoning` as an input alias, but all
|
|
519
|
+
* config scopes resolve and persist the same `effort` field.
|
|
520
|
+
*/
|
|
521
|
+
function normalizeBaseagentEffortCompat(value) {
|
|
522
|
+
const rawBaseagents = value?.baseagents;
|
|
523
|
+
if (!rawBaseagents || typeof rawBaseagents !== 'object' || Array.isArray(rawBaseagents))
|
|
524
|
+
return value;
|
|
525
|
+
const baseagents = { ...rawBaseagents };
|
|
526
|
+
let changed = false;
|
|
527
|
+
for (const [name, rawBlock] of Object.entries(baseagents)) {
|
|
528
|
+
if (!rawBlock || typeof rawBlock !== 'object' || Array.isArray(rawBlock))
|
|
529
|
+
continue;
|
|
530
|
+
const block = { ...rawBlock };
|
|
531
|
+
if (Object.prototype.hasOwnProperty.call(block, 'reasoning')) {
|
|
532
|
+
if (block.effort === undefined)
|
|
533
|
+
block.effort = block.reasoning;
|
|
534
|
+
delete block.reasoning;
|
|
535
|
+
baseagents[name] = block;
|
|
536
|
+
changed = true;
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
if (!changed)
|
|
540
|
+
return value;
|
|
541
|
+
return { ...value, baseagents };
|
|
511
542
|
}
|
|
512
543
|
function normalizeAgentConfigForRead(value, aid) {
|
|
513
544
|
const config = foldLegacyProactiveBlock(normalizeAgentLifecycle(value));
|
|
@@ -548,7 +579,7 @@ function groupFor(target, sel) {
|
|
|
548
579
|
return 'config';
|
|
549
580
|
}
|
|
550
581
|
function normalizeAgentConfigForWrite(value) {
|
|
551
|
-
const mutable = { ...value };
|
|
582
|
+
const mutable = normalizeBaseagentEffortCompat({ ...value });
|
|
552
583
|
normalizeShowActivitiesCompat(mutable);
|
|
553
584
|
// AID 格式校验
|
|
554
585
|
if (mutable.aid && !isValidAid(mutable.aid)) {
|
|
@@ -571,8 +602,22 @@ function normalizeAgentConfigForWrite(value) {
|
|
|
571
602
|
}
|
|
572
603
|
return mutable;
|
|
573
604
|
}
|
|
605
|
+
function normalizeProcessConfigForWrite(value) {
|
|
606
|
+
const configuredAidDomain = value.aun?.defaultAidDomain;
|
|
607
|
+
if (configuredAidDomain === undefined)
|
|
608
|
+
return value;
|
|
609
|
+
try {
|
|
610
|
+
return {
|
|
611
|
+
...value,
|
|
612
|
+
aun: { ...value.aun, defaultAidDomain: normalizeAidDomain(configuredAidDomain, 'aun.defaultAidDomain') },
|
|
613
|
+
};
|
|
614
|
+
}
|
|
615
|
+
catch (error) {
|
|
616
|
+
throw new ConfigError('VALIDATION_ERROR', error instanceof Error ? error.message : String(error));
|
|
617
|
+
}
|
|
618
|
+
}
|
|
574
619
|
function normalizeRelationConfigForWrite(value) {
|
|
575
|
-
const mutable = { ...value };
|
|
620
|
+
const mutable = normalizeBaseagentEffortCompat({ ...value });
|
|
576
621
|
normalizeShowActivitiesCompat(mutable);
|
|
577
622
|
return mutable;
|
|
578
623
|
}
|
|
@@ -638,12 +683,15 @@ export function write(target, value, sel, opts = {}) {
|
|
|
638
683
|
: loadSchema(TARGET_SCHEMA[target]);
|
|
639
684
|
const withVer = ensureSchemaVersion(value, schema.version);
|
|
640
685
|
const migrated = withVer;
|
|
686
|
+
const canonicalized = normalizeBaseagentEffortCompat(migrated);
|
|
641
687
|
// Agent config 写入规范化(aid 校验、projects 字段清理)
|
|
642
688
|
const normalized = target === ConfigTarget.Agent
|
|
643
|
-
? normalizeAgentConfigForWrite(
|
|
689
|
+
? normalizeAgentConfigForWrite(canonicalized)
|
|
644
690
|
: target === ConfigTarget.Relation
|
|
645
|
-
? normalizeRelationConfigForWrite(
|
|
646
|
-
:
|
|
691
|
+
? normalizeRelationConfigForWrite(canonicalized)
|
|
692
|
+
: target === ConfigTarget.Process
|
|
693
|
+
? normalizeProcessConfigForWrite(canonicalized)
|
|
694
|
+
: canonicalized;
|
|
647
695
|
// 1. Schema 校验
|
|
648
696
|
if (!opts.skipValidate) {
|
|
649
697
|
validateOrThrow(schema, normalized, target);
|
|
@@ -836,7 +884,7 @@ function ensureSchemaVersion(value, version) {
|
|
|
836
884
|
}
|
|
837
885
|
function validateOrThrow(schema, value, target) {
|
|
838
886
|
const ok = schema.validate(value);
|
|
839
|
-
const scopeErrors = validateProcessOnlyFields(target, value);
|
|
887
|
+
const scopeErrors = [...validateProcessOnlyFields(target, value), ...validateProcessAidDomain(target, value)];
|
|
840
888
|
if (!ok || scopeErrors.length > 0) {
|
|
841
889
|
const errs = [
|
|
842
890
|
...scopeErrors,
|
|
@@ -853,9 +901,29 @@ function validateOrThrow(schema, value, target) {
|
|
|
853
901
|
function validateProcessOnlyFields(target, value) {
|
|
854
902
|
if (target === ConfigTarget.Process || !value || typeof value !== 'object')
|
|
855
903
|
return [];
|
|
856
|
-
|
|
904
|
+
const errors = [];
|
|
905
|
+
if (Object.prototype.hasOwnProperty.call(value, 'debug')) {
|
|
906
|
+
errors.push('/debug is only allowed in process config');
|
|
907
|
+
}
|
|
908
|
+
const aun = value.aun;
|
|
909
|
+
if (aun && typeof aun === 'object' && Object.prototype.hasOwnProperty.call(aun, 'defaultEncrypt')) {
|
|
910
|
+
errors.push('/aun/defaultEncrypt is only allowed in process config');
|
|
911
|
+
}
|
|
912
|
+
return errors;
|
|
913
|
+
}
|
|
914
|
+
function validateProcessAidDomain(target, value) {
|
|
915
|
+
if (target !== ConfigTarget.Process || !value || typeof value !== 'object')
|
|
916
|
+
return [];
|
|
917
|
+
const configuredAidDomain = value?.aun?.defaultAidDomain;
|
|
918
|
+
if (configuredAidDomain === undefined)
|
|
919
|
+
return [];
|
|
920
|
+
try {
|
|
921
|
+
normalizeAidDomain(configuredAidDomain, 'aun.defaultAidDomain');
|
|
857
922
|
return [];
|
|
858
|
-
|
|
923
|
+
}
|
|
924
|
+
catch (error) {
|
|
925
|
+
return [`/aun/defaultAidDomain ${error instanceof Error ? error.message : String(error)}`];
|
|
926
|
+
}
|
|
859
927
|
}
|
|
860
928
|
/**
|
|
861
929
|
* responseModeParams 桶专项校验。
|
|
@@ -908,7 +976,7 @@ export function validateConfig(target, value) {
|
|
|
908
976
|
: loadSchema(TARGET_SCHEMA[target]);
|
|
909
977
|
const withVer = ensureSchemaVersion(value, schema.version);
|
|
910
978
|
const ok = schema.validate(withVer);
|
|
911
|
-
const errors = validateProcessOnlyFields(target, withVer);
|
|
979
|
+
const errors = [...validateProcessOnlyFields(target, withVer), ...validateProcessAidDomain(target, withVer)];
|
|
912
980
|
if (ok && errors.length === 0)
|
|
913
981
|
return [];
|
|
914
982
|
return [
|
|
@@ -29,6 +29,47 @@ const DISPLAY_NAMES = {
|
|
|
29
29
|
};
|
|
30
30
|
// ── 掩码 ──
|
|
31
31
|
const ENV_PREFIX = '$ENV:';
|
|
32
|
+
// Claude Code supports both credential variable names. Keep AUTH_TOKEN first
|
|
33
|
+
// to match the runtime resolver's precedence.
|
|
34
|
+
const standardEnvKeys = {
|
|
35
|
+
apiKey: ['ANTHROPIC_AUTH_TOKEN'],
|
|
36
|
+
baseUrl: ['ANTHROPIC_BASE_URL'],
|
|
37
|
+
};
|
|
38
|
+
function envKeysForGateway(type, field) {
|
|
39
|
+
if (type === 'claude' && field === 'apiKey')
|
|
40
|
+
return ['ANTHROPIC_AUTH_TOKEN', 'ANTHROPIC_API_KEY'];
|
|
41
|
+
return standardEnvKeys[field];
|
|
42
|
+
}
|
|
43
|
+
function firstEnvValue(env, names) {
|
|
44
|
+
for (const name of names) {
|
|
45
|
+
const value = env[name];
|
|
46
|
+
if (value)
|
|
47
|
+
return { name, value };
|
|
48
|
+
}
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
51
|
+
const DEBUG_SECRET_KEY = /(?:key|token|secret|password|authorization|credential|private)/i;
|
|
52
|
+
function redactDebugValue(value, key) {
|
|
53
|
+
if (typeof value === 'string') {
|
|
54
|
+
if (value === '(未设置)')
|
|
55
|
+
return value;
|
|
56
|
+
if (key && DEBUG_SECRET_KEY.test(key) && !value.startsWith(ENV_PREFIX))
|
|
57
|
+
return '***';
|
|
58
|
+
return value;
|
|
59
|
+
}
|
|
60
|
+
if (Array.isArray(value))
|
|
61
|
+
return value.map(item => redactDebugValue(item));
|
|
62
|
+
if (value && typeof value === 'object') {
|
|
63
|
+
return Object.fromEntries(Object.entries(value)
|
|
64
|
+
.map(([childKey, childValue]) => [childKey, redactDebugValue(childValue, childKey)]));
|
|
65
|
+
}
|
|
66
|
+
return value;
|
|
67
|
+
}
|
|
68
|
+
function redactMismatchValue(value, field) {
|
|
69
|
+
if (!value)
|
|
70
|
+
return value;
|
|
71
|
+
return field === 'apiKey' && !value.startsWith(ENV_PREFIX) ? '***' : value;
|
|
72
|
+
}
|
|
32
73
|
function maskApiKey(raw) {
|
|
33
74
|
if (typeof raw !== 'string' || !raw)
|
|
34
75
|
return { mask: undefined, isEnvRef: false };
|
|
@@ -203,21 +244,17 @@ function detectEnvMismatch(defaults, aids) {
|
|
|
203
244
|
// 读取全局 .env 文件
|
|
204
245
|
const rootEnvPath = path.join(resolvePaths().root, '.env');
|
|
205
246
|
const rootEnvVars = parseEnvFileSync(rootEnvPath);
|
|
206
|
-
// 标准环境变量映射
|
|
207
|
-
const standardEnvKeys = {
|
|
208
|
-
apiKey: 'ANTHROPIC_AUTH_TOKEN',
|
|
209
|
-
baseUrl: 'ANTHROPIC_BASE_URL',
|
|
210
|
-
};
|
|
211
247
|
// 记录进程环境变量
|
|
212
|
-
const processEnvDebug = {
|
|
248
|
+
const processEnvDebug = redactDebugValue({
|
|
213
249
|
ANTHROPIC_BASE_URL: process.env.ANTHROPIC_BASE_URL || '(未设置)',
|
|
214
250
|
ANTHROPIC_AUTH_TOKEN: process.env.ANTHROPIC_AUTH_TOKEN || '(未设置)',
|
|
215
|
-
|
|
251
|
+
ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY || '(未设置)',
|
|
252
|
+
});
|
|
216
253
|
// 收集调试信息返回给前端
|
|
217
254
|
result.debug = {
|
|
218
255
|
processEnv: processEnvDebug,
|
|
219
|
-
rootEnvFile: rootEnvVars,
|
|
220
|
-
defaultsConfig: defaultsBa,
|
|
256
|
+
rootEnvFile: redactDebugValue(rootEnvVars),
|
|
257
|
+
defaultsConfig: redactDebugValue(defaultsBa),
|
|
221
258
|
};
|
|
222
259
|
// 检测全局默认配置中的环境变量
|
|
223
260
|
for (const type of GATEWAY_TYPES) {
|
|
@@ -243,23 +280,25 @@ function detectEnvMismatch(defaults, aids) {
|
|
|
243
280
|
}
|
|
244
281
|
}
|
|
245
282
|
// 情况2:配置值是实际值(非 $ENV 引用),检查是否应该使用环境变量
|
|
246
|
-
else if (typeof val === 'string' && val &&
|
|
247
|
-
const
|
|
248
|
-
const
|
|
249
|
-
const
|
|
283
|
+
else if (typeof val === 'string' && val && envKeysForGateway(type, field)) {
|
|
284
|
+
const envKeys = envKeysForGateway(type, field);
|
|
285
|
+
const envValue = firstEnvValue(process.env, envKeys);
|
|
286
|
+
const fileValue = firstEnvValue(rootEnvVars, envKeys);
|
|
287
|
+
const envVarName = envValue?.name;
|
|
288
|
+
const processValue = envValue?.value;
|
|
250
289
|
// 如果进程环境中有值,但配置中的值与进程环境不一致
|
|
251
|
-
if (processValue && val !== processValue) {
|
|
290
|
+
if (processValue && val !== processValue && envVarName) {
|
|
252
291
|
// 同时检查 .env 文件:如果 .env 也没有这个值,说明需要同步
|
|
253
|
-
if (!fileValue || fileValue !== processValue) {
|
|
292
|
+
if (!fileValue || fileValue.value !== processValue) {
|
|
254
293
|
result.hasMismatch = true;
|
|
255
294
|
result.mismatches.push({
|
|
256
295
|
aid: 'defaults',
|
|
257
296
|
type,
|
|
258
297
|
field,
|
|
259
|
-
envValue: fileValue || '(.env 中未设置)',
|
|
260
|
-
configValue: val,
|
|
298
|
+
envValue: redactMismatchValue(fileValue?.value, field) || '(.env 中未设置)',
|
|
299
|
+
configValue: redactMismatchValue(val, field) || val,
|
|
261
300
|
envVarName,
|
|
262
|
-
processValue,
|
|
301
|
+
processValue: redactMismatchValue(processValue, field),
|
|
263
302
|
});
|
|
264
303
|
}
|
|
265
304
|
}
|
|
@@ -295,18 +334,20 @@ function detectEnvMismatch(defaults, aids) {
|
|
|
295
334
|
}
|
|
296
335
|
}
|
|
297
336
|
// 情况2:配置值是实际值
|
|
298
|
-
else if (typeof val === 'string' && val &&
|
|
299
|
-
const
|
|
300
|
-
const
|
|
301
|
-
const
|
|
302
|
-
|
|
303
|
-
|
|
337
|
+
else if (typeof val === 'string' && val && envKeysForGateway(type, field)) {
|
|
338
|
+
const envKeys = envKeysForGateway(type, field);
|
|
339
|
+
const envValue = firstEnvValue(process.env, envKeys);
|
|
340
|
+
const fileValue = firstEnvValue(agentEnvVars, envKeys);
|
|
341
|
+
const envVarName = envValue?.name;
|
|
342
|
+
const processValue = envValue?.value;
|
|
343
|
+
if (processValue && val !== processValue && envVarName) {
|
|
344
|
+
if (!fileValue || fileValue.value !== processValue) {
|
|
304
345
|
result.hasMismatch = true;
|
|
305
346
|
result.mismatches.push({
|
|
306
347
|
aid,
|
|
307
348
|
type,
|
|
308
349
|
field,
|
|
309
|
-
envValue: fileValue || '(.env 中未设置)',
|
|
350
|
+
envValue: redactMismatchValue(fileValue?.value, field) || '(.env 中未设置)',
|
|
310
351
|
configValue: `配置值与环境变量 ${envVarName} 不一致`,
|
|
311
352
|
});
|
|
312
353
|
}
|
|
@@ -707,11 +748,13 @@ export async function gatewaySyncEnv(args) {
|
|
|
707
748
|
}
|
|
708
749
|
// 情况2:实际值型,但与进程环境变量不一致
|
|
709
750
|
else {
|
|
710
|
-
const
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
751
|
+
const envKeys = envKeysForGateway(type, field);
|
|
752
|
+
const envValue = envKeys
|
|
753
|
+
? firstEnvValue(process.env, envKeys)
|
|
754
|
+
: undefined;
|
|
755
|
+
if (envValue) {
|
|
756
|
+
if (val !== envValue.value) {
|
|
757
|
+
block[field] = envValue.value;
|
|
715
758
|
hasChanges = true;
|
|
716
759
|
}
|
|
717
760
|
}
|
|
@@ -751,11 +794,13 @@ export async function gatewaySyncEnv(args) {
|
|
|
751
794
|
}
|
|
752
795
|
// 情况2:实际值型
|
|
753
796
|
else {
|
|
754
|
-
const
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
797
|
+
const envKeys = envKeysForGateway(type, field);
|
|
798
|
+
const envValue = envKeys
|
|
799
|
+
? firstEnvValue(process.env, envKeys)
|
|
800
|
+
: undefined;
|
|
801
|
+
if (envValue) {
|
|
802
|
+
if (val !== envValue.value) {
|
|
803
|
+
block[field] = envValue.value;
|
|
759
804
|
hasChanges = true;
|
|
760
805
|
}
|
|
761
806
|
}
|
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
import { loadSchema } from './schema-registry.js';
|
|
2
|
+
const LEGACY_CODEX_EFFORT_FIELD = 'baseagents.codex.reasoning';
|
|
3
|
+
const CODEX_EFFORT_FIELD = 'baseagents.codex.effort';
|
|
4
|
+
/** Convert the legacy flattened Codex role permission key to `effort`. */
|
|
5
|
+
export function normalizeRoleEffortCompat(value) {
|
|
6
|
+
if (!isRecord(value) || !isRecord(value.permissions)
|
|
7
|
+
|| !Object.hasOwn(value.permissions, LEGACY_CODEX_EFFORT_FIELD))
|
|
8
|
+
return value;
|
|
9
|
+
const permissions = { ...value.permissions };
|
|
10
|
+
if (!Object.hasOwn(permissions, CODEX_EFFORT_FIELD)) {
|
|
11
|
+
permissions[CODEX_EFFORT_FIELD] = permissions[LEGACY_CODEX_EFFORT_FIELD];
|
|
12
|
+
}
|
|
13
|
+
delete permissions[LEGACY_CODEX_EFFORT_FIELD];
|
|
14
|
+
return { ...value, permissions };
|
|
15
|
+
}
|
|
2
16
|
export function rolePermissionFields() {
|
|
3
17
|
const raw = loadSchema('role-config').raw['x-permission-fields'];
|
|
4
18
|
if (!Array.isArray(raw))
|
|
@@ -41,9 +55,10 @@ export function rolePermissionFieldPatterns(field) {
|
|
|
41
55
|
}
|
|
42
56
|
/** Shared RoleService/Menu validation backed by the published role schema. */
|
|
43
57
|
export function validateRoleConfig(value) {
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
:
|
|
58
|
+
const compatible = normalizeRoleEffortCompat(value);
|
|
59
|
+
const normalized = isRecord(compatible) && !Object.hasOwn(compatible, '$schema_version')
|
|
60
|
+
? { ...compatible, $schema_version: 1 }
|
|
61
|
+
: compatible;
|
|
47
62
|
const schema = loadSchema('role-config');
|
|
48
63
|
if (!schema.validate(normalized)) {
|
|
49
64
|
return (schema.validate.errors ?? []).map(error => ({
|
|
@@ -6,7 +6,7 @@ import { loadSchema } from './schema-registry.js';
|
|
|
6
6
|
import { clearRoleStoreCache, getStoredRoleRegistry, isRoleName, readRoleStore, roleRegistryExists, } from './role-store.js';
|
|
7
7
|
import { expectedRoleRank, isManagementRole } from './builtin-roles.js';
|
|
8
8
|
import { readBuiltinRoleTemplate } from './builtin-role-templates.js';
|
|
9
|
-
import { validateRoleConfig } from './role-schema.js';
|
|
9
|
+
import { normalizeRoleEffortCompat, validateRoleConfig } from './role-schema.js';
|
|
10
10
|
export class RoleServiceError extends Error {
|
|
11
11
|
code;
|
|
12
12
|
data;
|
|
@@ -43,7 +43,7 @@ export function writeRoleRegistry(selfAid, value) {
|
|
|
43
43
|
export function writeRoleDefinition(selfAid, roleId, value) {
|
|
44
44
|
if (!isRoleName(roleId))
|
|
45
45
|
throw new RoleServiceError('INVALID_ROLE_ID', `Invalid role id: ${roleId}`);
|
|
46
|
-
const normalized = { ...value, rank: expectedRoleRank(roleId), $schema_version: 1 };
|
|
46
|
+
const normalized = normalizeRoleEffortCompat({ ...value, rank: expectedRoleRank(roleId), $schema_version: 1 });
|
|
47
47
|
validateRoleDefinition(normalized);
|
|
48
48
|
const registry = readRoleRegistry(selfAid);
|
|
49
49
|
if (!registry.roles.includes(roleId)) {
|
|
@@ -93,7 +93,7 @@ export function listRoleDiagnostics(selfAid) {
|
|
|
93
93
|
return readRoleStore(selfAid).diagnostics;
|
|
94
94
|
}
|
|
95
95
|
function writeRoleDefinitionFile(selfAid, roleId, value) {
|
|
96
|
-
const normalized = { ...value, rank: expectedRoleRank(roleId), $schema_version: 1 };
|
|
96
|
+
const normalized = normalizeRoleEffortCompat({ ...value, rank: expectedRoleRank(roleId), $schema_version: 1 });
|
|
97
97
|
validateRoleDefinition(normalized);
|
|
98
98
|
const file = agentRoleConfig(selfAid, roleId);
|
|
99
99
|
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
@@ -5,7 +5,7 @@ import { agentRoleConfig, agentRolesDir, agentRolesIndex, kitsRoleTemplatesDir,
|
|
|
5
5
|
import { applyManagementRoleCeiling, expectedRoleRank, getManagementRoleDefinition } from './builtin-roles.js';
|
|
6
6
|
import { readBuiltinRoleTemplate } from './builtin-role-templates.js';
|
|
7
7
|
import { loadSchema } from './schema-registry.js';
|
|
8
|
-
import { validateRoleConfig } from './role-schema.js';
|
|
8
|
+
import { normalizeRoleEffortCompat, validateRoleConfig } from './role-schema.js';
|
|
9
9
|
const ROLE_NAME_RE = /^[a-z0-9_-]+$/;
|
|
10
10
|
const BUILTIN_ROLES = ['owner', 'admin', 'member', 'visitor'];
|
|
11
11
|
const cache = new Map();
|
|
@@ -154,9 +154,10 @@ function readDefinition(selfAid, roleId, diagnostics) {
|
|
|
154
154
|
}
|
|
155
155
|
if (raw === null)
|
|
156
156
|
continue;
|
|
157
|
-
const
|
|
157
|
+
const normalizedRaw = normalizeRoleEffortCompat(raw);
|
|
158
|
+
const issues = validateRoleConfig(normalizedRaw);
|
|
158
159
|
if (issues.length === 0) {
|
|
159
|
-
const { $schema_version: _schemaVersion, ...definition } =
|
|
160
|
+
const { $schema_version: _schemaVersion, ...definition } = normalizedRaw;
|
|
160
161
|
const expectedRank = expectedRoleRank(roleId);
|
|
161
162
|
if (definition.rank !== undefined && definition.rank !== expectedRank) {
|
|
162
163
|
diagnostics.push({
|
package/dist/config-store.js
CHANGED
|
@@ -20,6 +20,7 @@ import path from 'path';
|
|
|
20
20
|
import { resolvePaths, agentDir, } from './paths.js';
|
|
21
21
|
import { atomicReadJson, atomicWriteJson } from './utils/atomic-write.js';
|
|
22
22
|
import { checkAgentDir, isValidAid } from './aun/aid/validation.js';
|
|
23
|
+
import { normalizeAidDomain } from './aun/aid/domain.js';
|
|
23
24
|
import { isValidChannelName } from './core/channel-loader.js';
|
|
24
25
|
import { CONFIG_SCHEMA_VERSION } from './types.js';
|
|
25
26
|
import { ConfigTarget, read as cfgRead, write as cfgWrite } from './config/config-manager.js';
|
|
@@ -29,7 +30,7 @@ import { parseStableSemver } from './utils/stable-semver.js';
|
|
|
29
30
|
/** 读 {root}/daemon.json。文件不存在返回 {},不报错。 */
|
|
30
31
|
export function loadDaemonConfig() {
|
|
31
32
|
const raw = atomicReadJson(resolvePaths().daemonConfig);
|
|
32
|
-
return validateDaemonConfig(raw ?? {});
|
|
33
|
+
return validateDaemonConfig(raw ?? {}, false);
|
|
33
34
|
}
|
|
34
35
|
let eckSnapshotsConfigCache;
|
|
35
36
|
/** Parse the process-level snapshot gate once for the current daemon lifecycle. */
|
|
@@ -50,9 +51,16 @@ export function isEckSnapshotsEnabled() {
|
|
|
50
51
|
}
|
|
51
52
|
/** 原子写入 {root}/daemon.json。调用方负责传完整对象(含要保留的字段)。 */
|
|
52
53
|
export function saveDaemonConfig(value) {
|
|
53
|
-
|
|
54
|
+
const configPath = resolvePaths().daemonConfig;
|
|
55
|
+
const current = atomicReadJson(configPath);
|
|
56
|
+
// A legacy default is irrelevant while an existing control AID is retained.
|
|
57
|
+
// Validate the field when it is created or changed, but do not make unrelated
|
|
58
|
+
// daemon.json updates fail because of a persisted, unused legacy value.
|
|
59
|
+
const validateAidDomain = current === null
|
|
60
|
+
|| current.aun?.defaultAidDomain !== value.aun?.defaultAidDomain;
|
|
61
|
+
atomicWriteJson(configPath, validateDaemonConfig(value, validateAidDomain));
|
|
54
62
|
}
|
|
55
|
-
function validateDaemonConfig(value) {
|
|
63
|
+
function validateDaemonConfig(value, validateAidDomain) {
|
|
56
64
|
const minEvolVersion = value.aun?.minEvolVersion;
|
|
57
65
|
if (minEvolVersion !== undefined && !parseStableSemver(minEvolVersion)) {
|
|
58
66
|
throw new Error('daemon.json.aun.minEvolVersion must use stable X.Y.Z format');
|
|
@@ -61,6 +69,14 @@ function validateDaemonConfig(value) {
|
|
|
61
69
|
if (menuTokenRequired !== undefined && typeof menuTokenRequired !== 'boolean') {
|
|
62
70
|
throw new Error('daemon.json.aun.menuTokenRequired must be a boolean');
|
|
63
71
|
}
|
|
72
|
+
const defaultEncrypt = value.aun?.defaultEncrypt;
|
|
73
|
+
if (defaultEncrypt !== undefined && typeof defaultEncrypt !== 'boolean') {
|
|
74
|
+
throw new Error('daemon.json.aun.defaultEncrypt must be a boolean');
|
|
75
|
+
}
|
|
76
|
+
if (validateAidDomain && value.aun?.defaultAidDomain !== undefined) {
|
|
77
|
+
const defaultAidDomain = normalizeAidDomain(value.aun.defaultAidDomain, 'daemon.json.aun.defaultAidDomain');
|
|
78
|
+
return { ...value, aun: { ...value.aun, defaultAidDomain } };
|
|
79
|
+
}
|
|
64
80
|
return value;
|
|
65
81
|
}
|
|
66
82
|
const SUPPORTED_CHANNEL_TYPES = new Set([
|
|
@@ -673,7 +673,9 @@ function parseLegacyChannelType(peerKey) {
|
|
|
673
673
|
}
|
|
674
674
|
function checkFieldOverride(ctx, field) {
|
|
675
675
|
const roleDef = getRoleDefinition(ctx.role, ctx.selfAid);
|
|
676
|
-
const fieldPermission = roleDef
|
|
676
|
+
const fieldPermission = roleDef
|
|
677
|
+
? resolveRoleFieldPermission(roleDef.permissions || {}, field)
|
|
678
|
+
: undefined;
|
|
677
679
|
if (!fieldPermission) {
|
|
678
680
|
return { ok: false, reason: `Role ${ctx.role} has no field permission for ${field}` };
|
|
679
681
|
}
|
|
@@ -20,16 +20,16 @@ export class AgentLoader {
|
|
|
20
20
|
* Iterate over all EvolAgents in the registry × all registered plugins.
|
|
21
21
|
* Each successful (agent, plugin) pair yields one runner instance.
|
|
22
22
|
*/
|
|
23
|
-
createAll(registry, callbacks) {
|
|
23
|
+
createAll(registry, callbacks, creationErrors) {
|
|
24
24
|
const instances = [];
|
|
25
25
|
const allAgents = registry.runnableAgents();
|
|
26
26
|
for (const agent of allAgents) {
|
|
27
|
-
instances.push(...this.createForAgent(agent, callbacks));
|
|
27
|
+
instances.push(...this.createForAgent(agent, callbacks, creationErrors));
|
|
28
28
|
}
|
|
29
29
|
return instances;
|
|
30
30
|
}
|
|
31
31
|
/** Create runners for one EvolAgent, used by runtime hot-load. */
|
|
32
|
-
createForAgent(agent, callbacks) {
|
|
32
|
+
createForAgent(agent, callbacks, creationErrors) {
|
|
33
33
|
const instances = [];
|
|
34
34
|
for (const [pluginName, plugin] of this.plugins) {
|
|
35
35
|
if (!plugin.isEnabled(agent)) {
|
|
@@ -46,6 +46,8 @@ export class AgentLoader {
|
|
|
46
46
|
logger.info(`✓ Runner created: agent=${instance.evolagentName} baseagent=${instance.baseagent}`);
|
|
47
47
|
}
|
|
48
48
|
catch (error) {
|
|
49
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
50
|
+
creationErrors?.push({ evolagentName: agent.name, baseagent: pluginName, message });
|
|
49
51
|
logger.error(`✗ Failed to create runner for agent='${agent.name}' baseagent='${pluginName}':`, error);
|
|
50
52
|
}
|
|
51
53
|
}
|
|
@@ -74,7 +74,6 @@ export class BootstrapService {
|
|
|
74
74
|
agentName: aid,
|
|
75
75
|
}), { kind: 'result.text', text, isFinal: true });
|
|
76
76
|
this.eventBus.publish({ type: 'agent:bootstrap-started', aid, channel: channelType || ctx.channelKey, timestamp: Date.now() });
|
|
77
|
-
await this.sendAunBindingCredentialIfSupported(ctx.adapter, recipientId, agentName, baseagent);
|
|
78
77
|
logger.info(`[Bootstrap] Started for ${aid} via ${ctx.channelKey} (${ctx.source})`);
|
|
79
78
|
return true;
|
|
80
79
|
}
|
|
@@ -154,15 +153,4 @@ export class BootstrapService {
|
|
|
154
153
|
logger.warn(`[Bootstrap] Failed to publish agent.md for ${aid}: ${e instanceof Error ? e.message : String(e)}`);
|
|
155
154
|
}
|
|
156
155
|
}
|
|
157
|
-
async sendAunBindingCredentialIfSupported(adapter, owner, name, baseagent) {
|
|
158
|
-
const sendBinding = adapter._sendBindingCredential;
|
|
159
|
-
if (typeof sendBinding !== 'function')
|
|
160
|
-
return;
|
|
161
|
-
try {
|
|
162
|
-
await sendBinding(owner, name, baseagent);
|
|
163
|
-
}
|
|
164
|
-
catch (e) {
|
|
165
|
-
logger.warn(`[Bootstrap] Binding credential failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
156
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import os from 'os';
|
|
3
3
|
import path from 'path';
|
|
4
|
-
import {
|
|
4
|
+
import { execCodexCliSync } from '../../../utils/codex-cli.js';
|
|
5
5
|
function listDirectories(dir) {
|
|
6
6
|
try {
|
|
7
7
|
if (!fs.existsSync(dir))
|
|
@@ -34,7 +34,7 @@ function discoverSkills(ctx) {
|
|
|
34
34
|
}
|
|
35
35
|
function runCodexJson(args) {
|
|
36
36
|
try {
|
|
37
|
-
const output =
|
|
37
|
+
const output = execCodexCliSync(args, {
|
|
38
38
|
encoding: 'utf-8',
|
|
39
39
|
timeout: 3000,
|
|
40
40
|
stdio: ['ignore', 'pipe', 'pipe'],
|
|
@@ -27,9 +27,11 @@ export function showActivitiesPolicy(mode, chatType, _identity) {
|
|
|
27
27
|
// ── ChannelLoader ──────────────────────────────────────────────────────────
|
|
28
28
|
export class ChannelLoader {
|
|
29
29
|
processDebug;
|
|
30
|
+
aunDefaultEncrypt;
|
|
30
31
|
plugins = new Map();
|
|
31
|
-
constructor(processDebug) {
|
|
32
|
+
constructor(processDebug, aunDefaultEncrypt) {
|
|
32
33
|
this.processDebug = processDebug;
|
|
34
|
+
this.aunDefaultEncrypt = aunDefaultEncrypt;
|
|
33
35
|
}
|
|
34
36
|
register(plugin) {
|
|
35
37
|
if (this.plugins.has(plugin.name)) {
|
|
@@ -51,6 +53,7 @@ export class ChannelLoader {
|
|
|
51
53
|
agentName: agent.aid,
|
|
52
54
|
defaultProjectPath: agent.config.projects?.defaultPath ?? process.cwd(),
|
|
53
55
|
debug: this.processDebug,
|
|
56
|
+
aunDefaultEncrypt: this.aunDefaultEncrypt,
|
|
54
57
|
};
|
|
55
58
|
// Build the full list of config instances to create.
|
|
56
59
|
// AUN is synthesised from agent.aid; any explicit aun entry in channels[] is skipped.
|
|
@@ -61,6 +64,8 @@ export class ChannelLoader {
|
|
|
61
64
|
aid: agent.aid,
|
|
62
65
|
owner: agent.getOwner(aunEffName),
|
|
63
66
|
enabled: true,
|
|
67
|
+
keystorePath: agent.config.aun?.keystorePath,
|
|
68
|
+
gatewayUrl: agent.config.aun?.gatewayUrl,
|
|
64
69
|
};
|
|
65
70
|
const configInsts = [aunInst];
|
|
66
71
|
for (const inst of agent.config.channels) {
|
|
@@ -240,7 +245,14 @@ export function buildReloadHooks(deps) {
|
|
|
240
245
|
const isImplicitAun = channelName === aunEffName;
|
|
241
246
|
// Find config instance: implicit AUN gets a synthetic entry; others scan channels[].
|
|
242
247
|
const cfgInst = isImplicitAun
|
|
243
|
-
? {
|
|
248
|
+
? {
|
|
249
|
+
type: 'aun',
|
|
250
|
+
name: aunEffName,
|
|
251
|
+
aid,
|
|
252
|
+
enabled: true,
|
|
253
|
+
keystorePath: agent.config?.aun?.keystorePath,
|
|
254
|
+
gatewayUrl: agent.config?.aun?.gatewayUrl,
|
|
255
|
+
}
|
|
244
256
|
: (() => {
|
|
245
257
|
const agentChannels = agent.config?.channels ?? [];
|
|
246
258
|
return agentChannels.find((i) => {
|
|
@@ -257,6 +269,7 @@ export function buildReloadHooks(deps) {
|
|
|
257
269
|
agentName: agent.aid ?? agent.config?.aid,
|
|
258
270
|
defaultProjectPath: agent.config?.projects?.defaultPath ?? process.cwd(),
|
|
259
271
|
debug: channelLoader.processDebug,
|
|
272
|
+
aunDefaultEncrypt: channelLoader.aunDefaultEncrypt,
|
|
260
273
|
};
|
|
261
274
|
const plugin = channelLoader.getPlugin(cfgInst.type);
|
|
262
275
|
if (!plugin)
|
|
@@ -372,7 +372,7 @@ export class CommandHandler {
|
|
|
372
372
|
const effortDecision = validateRuntimeStringFieldOverride({
|
|
373
373
|
selfAid: definition.agentAid,
|
|
374
374
|
role,
|
|
375
|
-
field: `baseagents.${base}
|
|
375
|
+
field: `baseagents.${base}.effort`,
|
|
376
376
|
value: definition.execution.effort,
|
|
377
377
|
});
|
|
378
378
|
if (!effortDecision.ok)
|
|
@@ -30,9 +30,10 @@ export function isEvolMenuVersionGateEnabled() {
|
|
|
30
30
|
export function isAunMenuTokenRequired() {
|
|
31
31
|
return loadDaemonConfig().aun?.menuTokenRequired === true;
|
|
32
32
|
}
|
|
33
|
-
export function evolMenuResponseTransportMetadata(
|
|
33
|
+
export function evolMenuResponseTransportMetadata() {
|
|
34
34
|
return {
|
|
35
|
-
|
|
35
|
+
// Clear inherited request state so AUNChannel applies daemon aun.defaultEncrypt.
|
|
36
|
+
encrypted: undefined,
|
|
36
37
|
protectedHeaders: { ec_version: readInstalledEvolcoreVersion() },
|
|
37
38
|
};
|
|
38
39
|
}
|