evolcore 0.0.43-test.5 → 0.0.43-test.6
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 +47 -0
- package/bin/ecmsg.js +126 -43
- package/dist/agents/baseagent-availability.js +19 -4
- package/dist/agents/baseagent.js +2 -2
- package/dist/agents/claude-runner.js +19 -4
- package/dist/agents/codex/app-server-client.js +14 -3
- package/dist/agents/codex-runner.js +6 -6
- package/dist/aun/group/invite-service.js +3 -2
- package/dist/aun/service-proxy.js +18 -6
- package/dist/channels/aun.js +73 -10
- package/dist/cli/agent-create.js +16 -6
- package/dist/cli/aun-commands.js +9 -1
- package/dist/cli/daemon-commands.js +30 -1
- package/dist/cli/ecmsg-gateway.js +3 -1
- package/dist/cli/init.js +75 -0
- package/dist/cli/provider-command.js +1 -1
- package/dist/cli/restart-monitor.js +24 -5
- package/dist/cli/task-context.js +38 -1
- package/dist/cli/watch-logs.js +6 -4
- package/dist/config/boot-log.js +6 -4
- package/dist/config/builtin-roles.js +2 -2
- package/dist/config/config-manager.js +1 -1
- package/dist/config/peer-role-resolver.js +1 -1
- package/dist/config/provider-identity-migration.js +92 -17
- package/dist/config/provider-local-sync.js +2 -0
- package/dist/config/providers-config.js +13 -0
- package/dist/config/providers-management.js +100 -10
- package/dist/config/role-service.js +8 -8
- package/dist/config/role-store.js +22 -22
- package/dist/config/schema-migration.js +80 -87
- package/dist/config/snapshot.js +70 -41
- package/dist/core/agent-runtime.js +44 -7
- package/dist/core/baseagent-loader.js +114 -11
- package/dist/core/channel-loader.js +36 -13
- package/dist/core/channel-runtime.js +112 -42
- package/dist/core/command/command-handler.js +5 -5
- package/dist/core/command/menu-handler.js +8 -3
- package/dist/core/command/menu-protocol.js +82 -11
- package/dist/core/command/role-menu.js +27 -15
- package/dist/core/daemon-control.js +42 -15
- package/dist/core/daemon-lifecycle.js +411 -67
- package/dist/core/handoff/dispatcher.js +9 -3
- package/dist/core/handoff/runtime.js +130 -42
- package/dist/core/handoff/store.js +190 -2
- package/dist/core/handoff/types.js +5 -0
- package/dist/core/initialization/service.js +4 -4
- package/dist/core/ipc-registration.js +5 -4
- package/dist/core/lifecycle-notice.js +10 -4
- package/dist/core/message/aun-ipc-sender.js +2 -2
- package/dist/core/message/message-bridge.js +53 -4
- package/dist/core/message/message-queue.js +46 -4
- package/dist/core/message/pending-hints.js +4 -10
- package/dist/core/message/response-engine.js +10 -2
- package/dist/core/message/send-routing.js +12 -2
- package/dist/core/ownership/owner-resolver.js +1 -0
- package/dist/core/permission/ec-command-parser.js +11 -1
- package/dist/core/session/adapters/claude-session-file-adapter.js +24 -0
- package/dist/core/session/adapters/codex-session-file-adapter.js +80 -0
- package/dist/core/session/adapters/ecagent-session-file-adapter.js +22 -0
- package/dist/core/session/adapters/gemini-session-file-adapter.js +39 -0
- package/dist/core/session/session-fs-store.js +164 -3
- package/dist/core/session/session-idle-monitor.js +9 -1
- package/dist/core/session/session-manager.js +36 -2
- package/dist/directory/owner-directory-admission.js +26 -1
- package/dist/directory/owner-directory-cache.js +57 -16
- package/dist/directory/owner-directory-query-operation.js +4 -1
- package/dist/ecweb/runtime/lifecycle.js +9 -7
- package/dist/ecweb/runtime/supervisor.js +44 -27
- package/dist/index.js +548 -251
- package/dist/proxy/manager.js +38 -17
- package/dist/proxy/service-supervisor.js +65 -31
- package/dist/trigger/application-service.js +3 -1
- package/dist/trigger/audit.js +19 -4
- package/dist/trigger/authorization.js +14 -5
- package/dist/trigger/history.js +176 -7
- package/dist/trigger/manager.js +1 -3
- package/dist/trigger/scheduler.js +78 -5
- package/dist/utils/cross-platform.js +152 -4
- package/dist/utils/host-info.js +11 -8
- package/dist/utils/npm-ops.js +48 -0
- package/dist/utils/process-introspect.js +64 -1
- package/dist/utils/startup-trace.js +160 -19
- package/kits/docs/aun/ABILITY_CALLING.md +3 -3
- package/kits/docs/evolcore/INDEX.md +3 -2
- package/kits/docs/evolcore/ctl.md +2 -1
- package/kits/docs/evolcore/group.md +2 -2
- package/kits/docs/evolcore/menu-exec-schema-commands.md +1 -1
- package/kits/docs/evolcore/msg.md +13 -6
- package/kits/docs/evolcore/provider.md +21 -3
- package/kits/docs/evolcore/response.md +1 -1
- package/kits/eck_manifest.json +19 -7
- package/kits/eck_message_manifest.json +3 -3
- package/kits/rules/06-channel.md +5 -6
- package/kits/schemas/daemon.schema.1.json +5 -0
- package/kits/schemas/daemon.schema.2.json +5 -0
- package/kits/schemas/daemon.schema.3.json +2 -1
- package/kits/schemas/daemon.schema.4.json +2 -1
- package/kits/schemas/daemon.schema.5.json +2 -1
- package/kits/schemas/daemon.schema.6.json +1 -1
- package/kits/schemas/daemon.schema.7.json +1 -1
- package/kits/schemas/daemon.schema.8.json +2 -1
- package/kits/schemas/daemon.schema.9.json +2 -1
- package/kits/schemas/role-registry.schema.1.json +2 -2
- package/kits/schemas/single-session.schema.1.json +1 -1
- package/kits/schemas/single-session.schema.2.json +1 -1
- package/kits/schemas/single-session.schema.3.json +1 -1
- package/kits/skills/aid-ability/SKILL.md +7 -7
- package/kits/skills/ec-group/SKILL.md +8 -5
- package/kits/skills/ec-group-collaboration/SKILL.md +7 -7
- package/kits/skills/ec-trigger/SKILL.md +4 -4
- package/kits/skills/thread-ops/SKILL.md +10 -10
- package/kits/templates/system-fragments/commands.md +5 -5
- package/kits/templates/system-fragments/reply.md +2 -1
- package/kits/templates/system-fragments/session.md +1 -1
- package/kits/templates/system-fragments/thread.md +1 -1
- package/package.json +4 -3
package/dist/cli/task-context.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { normalizeCausation } from '../core/causation/context.js';
|
|
2
2
|
import { RUNTIME_LOCK_DIR_ENV } from '../core/runtime-lock.js';
|
|
3
3
|
import crypto from 'node:crypto';
|
|
4
|
-
import { execFileSync } from 'node:child_process';
|
|
4
|
+
import { execFile, execFileSync } from 'node:child_process';
|
|
5
5
|
import fs from 'node:fs';
|
|
6
6
|
import os from 'node:os';
|
|
7
7
|
import path from 'node:path';
|
|
@@ -14,6 +14,7 @@ export const DAEMON_RUNTIME_EPOCH_ENV = 'EVOLCORE_DAEMON_RUNTIME_EPOCH';
|
|
|
14
14
|
export { RUNTIME_LOCK_DIR_ENV };
|
|
15
15
|
const generatedProcessManagedTempDirs = new Set();
|
|
16
16
|
const preparedWindowsSessionRuntimeDirs = new Set();
|
|
17
|
+
const pendingSessionRuntimeDirs = new Map();
|
|
17
18
|
let processTempCleanupRegistered = false;
|
|
18
19
|
function isPlainObject(value) {
|
|
19
20
|
return !!value && typeof value === 'object' && !Array.isArray(value);
|
|
@@ -313,6 +314,42 @@ export function ensureSessionRuntimeDir(sessionId) {
|
|
|
313
314
|
return undefined;
|
|
314
315
|
}
|
|
315
316
|
}
|
|
317
|
+
/** Await ACL preparation without blocking unrelated sessions or daemon I/O. */
|
|
318
|
+
export async function ensureSessionRuntimeDirAsync(sessionId) {
|
|
319
|
+
if (!sessionId)
|
|
320
|
+
return undefined;
|
|
321
|
+
const root = systemTempRoot();
|
|
322
|
+
const directory = path.join(root, sessionRuntimeName(sessionId));
|
|
323
|
+
const pending = pendingSessionRuntimeDirs.get(directory);
|
|
324
|
+
if (pending)
|
|
325
|
+
return pending;
|
|
326
|
+
const prepare = (async () => {
|
|
327
|
+
try {
|
|
328
|
+
await fs.promises.mkdir(root, { recursive: true, mode: 0o700 });
|
|
329
|
+
await fs.promises.mkdir(directory, { recursive: true, mode: 0o700 });
|
|
330
|
+
if (process.platform === 'win32' && !preparedWindowsSessionRuntimeDirs.has(directory)) {
|
|
331
|
+
const icacls = path.join(process.env.SystemRoot || process.env.WINDIR || 'C:\\Windows', 'System32', 'icacls.exe');
|
|
332
|
+
await new Promise((resolve, reject) => {
|
|
333
|
+
execFile(icacls, [directory, '/grant', '*S-1-5-32-545:(OI)(CI)M', '/Q'], { windowsHide: true, timeout: 10_000 }, error => error ? reject(error) : resolve());
|
|
334
|
+
});
|
|
335
|
+
preparedWindowsSessionRuntimeDirs.add(directory);
|
|
336
|
+
}
|
|
337
|
+
await fs.promises.mkdir(path.join(directory, 'locks'), { recursive: true, mode: 0o700 });
|
|
338
|
+
return isManagedSessionRuntimeDir(directory, root) ? directory : undefined;
|
|
339
|
+
}
|
|
340
|
+
catch {
|
|
341
|
+
return undefined;
|
|
342
|
+
}
|
|
343
|
+
})();
|
|
344
|
+
pendingSessionRuntimeDirs.set(directory, prepare);
|
|
345
|
+
try {
|
|
346
|
+
return await prepare;
|
|
347
|
+
}
|
|
348
|
+
finally {
|
|
349
|
+
if (pendingSessionRuntimeDirs.get(directory) === prepare)
|
|
350
|
+
pendingSessionRuntimeDirs.delete(directory);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
316
353
|
/** Return the lock namespace inside the session-owned runtime directory. */
|
|
317
354
|
export function ensureRuntimeLockDir(sessionRuntimeDir) {
|
|
318
355
|
if (!sessionRuntimeDir || !path.isAbsolute(sessionRuntimeDir))
|
package/dist/cli/watch-logs.js
CHANGED
|
@@ -10,7 +10,8 @@ export function shortLogName(file) {
|
|
|
10
10
|
const stem = baseName.replace(WATCH_LOG_FILE, '');
|
|
11
11
|
return stem
|
|
12
12
|
.replace(/-\d{8}(?:-\d{2})?$/, '') // -YYYYMMDD[-HH](按日/小时轮转)
|
|
13
|
-
.replace(/-\d{4}-\d{2}-\d{2}
|
|
13
|
+
.replace(/-\d{4}-\d{2}-\d{2}(?:-\d{2})?$/, '')
|
|
14
|
+
.replace(/-[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$/i, '');
|
|
14
15
|
}
|
|
15
16
|
/** 从支持的日志文件名列表推导去重、字母序的类型列表。 */
|
|
16
17
|
export function deriveLogTypes(files) {
|
|
@@ -26,15 +27,16 @@ export function deriveLogTypes(files) {
|
|
|
26
27
|
export function computePreChecked(types, saved) {
|
|
27
28
|
if (saved === undefined)
|
|
28
29
|
return new Set(types);
|
|
29
|
-
const savedSet = new Set(saved);
|
|
30
|
+
const savedSet = new Set(saved.map(shortLogName));
|
|
30
31
|
return new Set(types.filter(t => savedSet.has(t)));
|
|
31
32
|
}
|
|
32
33
|
/** 返回 requested 中不在 available 里的无效类型。 */
|
|
33
34
|
export function validateLogTypes(requested, available) {
|
|
34
35
|
const set = new Set(available);
|
|
35
|
-
return requested.filter(
|
|
36
|
+
return requested.filter(type => !set.has(shortLogName(type)));
|
|
36
37
|
}
|
|
37
38
|
/** 只保留类型命中 filterTypes 的文件路径。 */
|
|
38
39
|
export function filterLogFiles(files, filterTypes) {
|
|
39
|
-
|
|
40
|
+
const normalizedTypes = new Set([...filterTypes].map(shortLogName));
|
|
41
|
+
return files.filter(file => normalizedTypes.has(shortLogName(file)));
|
|
40
42
|
}
|
package/dist/config/boot-log.js
CHANGED
|
@@ -19,7 +19,7 @@ import { ensureAccessPolicyMigrationOnStartup, ensureAgentModelProviderMigration
|
|
|
19
19
|
import { ensureContactBookV2OnStartup } from './peer-book-v2-startup.js';
|
|
20
20
|
import { synchronizeAllManagementPeersSync } from './peer-book-store.js';
|
|
21
21
|
import { readInstalledEvolcoreVersion, readFastaunVersion } from '../utils/evolcore-version.js';
|
|
22
|
-
import { readCurrent, readWVersion, writeWVersion, materializeVersion, listAllVersions, diffVersions, snapshot, isConfigSnapshotsEnabled, ensureStartupConfigSnapshot, incrementSuccessCount, retentionCleanup, writeSnapshotConfigFile, removeSnapshotConfigFile, } from './snapshot.js';
|
|
22
|
+
import { readCurrent, readWVersion, writeWVersion, materializeVersion, listAllVersions, diffVersions, snapshot, isConfigSnapshotsEnabled, ensureStartupConfigSnapshot, incrementSuccessCount, retentionCleanup, writeSnapshotConfigFile, removeSnapshotConfigFile, snapshotManagesFile, } from './snapshot.js';
|
|
23
23
|
const MAX_LINES = 300;
|
|
24
24
|
const KEEP_MIN = 150;
|
|
25
25
|
const FALLBACK_MAX_TRIES = 20;
|
|
@@ -98,10 +98,12 @@ export async function prepareStartupConfig(recoverRoleMutations, onStep) {
|
|
|
98
98
|
step('providerIdentity');
|
|
99
99
|
const providerIdentityMigration = await ensureProviderIdentityMigrationOnStartup();
|
|
100
100
|
if (providerIdentityMigration) {
|
|
101
|
-
const message = `Provider domain ID migration: ${providerIdentityMigration.summary.providersMigrated} provider(s), ${providerIdentityMigration.changedFiles} file(s)`
|
|
102
|
-
+ (providerIdentityMigration.backup ? `; backup: ${providerIdentityMigration.backup}` : '');
|
|
101
|
+
const message = `Provider domain ID migration: ${providerIdentityMigration.summary.providersMigrated} provider(s), ${providerIdentityMigration.changedFiles} file(s), ${providerIdentityMigration.summary.aliasesRemoved} alias(es) removed`
|
|
102
|
+
+ (providerIdentityMigration.backup ? `; backup version: ${providerIdentityMigration.backup}` : '');
|
|
103
103
|
logger.info(message);
|
|
104
104
|
console.error(message);
|
|
105
|
+
if (providerIdentityMigration.changedFiles && !providerIdentityMigration.backup)
|
|
106
|
+
logger.warn('[config] Provider migration completed without a version backup because configSnapshots=false; transaction recovery remains enabled');
|
|
105
107
|
if (providerIdentityMigration.pending.length) {
|
|
106
108
|
logger.warn(`[config] Provider domain required for legacy entries: ${providerIdentityMigration.pending.join(', ')}`);
|
|
107
109
|
}
|
|
@@ -413,7 +415,7 @@ async function expandToW(version, root) {
|
|
|
413
415
|
const { collectConfigFiles } = await import('./snapshot.js');
|
|
414
416
|
const existing = collectConfigFiles(root);
|
|
415
417
|
for (const rel of existing) {
|
|
416
|
-
if (!files.has(rel))
|
|
418
|
+
if (!files.has(rel) && snapshotManagesFile(m, rel))
|
|
417
419
|
removeSnapshotConfigFile(root, rel);
|
|
418
420
|
}
|
|
419
421
|
for (const [rel, content] of files) {
|
|
@@ -4,7 +4,7 @@ export { expectedRoleRank, ROLE_RANKS } from './role-ranks.js';
|
|
|
4
4
|
export const BUILTIN_USER_ROLES = ['member', 'visitor'];
|
|
5
5
|
export const MANAGEMENT_ROLES = ['owner', 'admin'];
|
|
6
6
|
export const DAEMON_OWNER_ROLE = 'daemon-owner';
|
|
7
|
-
export const
|
|
7
|
+
export const DEFAULT_INTERNAL_CONTACT_ROLE = 'member';
|
|
8
8
|
export function isManagementRole(role) {
|
|
9
9
|
return role === 'owner' || role === 'admin';
|
|
10
10
|
}
|
|
@@ -18,7 +18,7 @@ export function isReservedRoleName(role) {
|
|
|
18
18
|
export function getBuiltinRolesConfig() {
|
|
19
19
|
return {
|
|
20
20
|
$schema_version: 1,
|
|
21
|
-
defaultRoles: { private: null, group: null,
|
|
21
|
+
defaultRoles: { private: null, group: null, internalContact: DEFAULT_INTERNAL_CONTACT_ROLE },
|
|
22
22
|
roles: Object.fromEntries(BUILTIN_USER_ROLES.flatMap(roleId => {
|
|
23
23
|
const definition = readBuiltinRoleTemplate(roleId).definition;
|
|
24
24
|
return definition ? [[roleId, definition]] : [];
|
|
@@ -1480,7 +1480,7 @@ function configSkeleton(target, sel) {
|
|
|
1480
1480
|
}
|
|
1481
1481
|
const spec = props[key];
|
|
1482
1482
|
if (spec && 'default' in spec)
|
|
1483
|
-
skeleton[key] = spec.default;
|
|
1483
|
+
skeleton[key] = cloneConfigValue(spec.default);
|
|
1484
1484
|
else if (spec?.type === 'array')
|
|
1485
1485
|
skeleton[key] = [];
|
|
1486
1486
|
else if (spec?.type === 'object')
|
|
@@ -120,7 +120,7 @@ export function resolvePeerRoleDetail(ctx) {
|
|
|
120
120
|
const store = readRoleStore(ctx.selfAid);
|
|
121
121
|
const valid = !store.diagnostics.some(diagnostic => diagnostic.code === 'INVALID_ROLE_REGISTRY'
|
|
122
122
|
|| diagnostic.code === 'MISSING_ROLE_REGISTRY');
|
|
123
|
-
const role = valid ? normalizeDefaultRole(store.registry.defaultRoles.
|
|
123
|
+
const role = valid ? normalizeDefaultRole(store.registry.defaultRoles.internalContact ?? 'member', ctx.selfAid) : null;
|
|
124
124
|
return resultFor(role, 'internal-contact-default', actor, ctx.selfAid);
|
|
125
125
|
}
|
|
126
126
|
if (ctx.chatType === 'private') {
|
|
@@ -2,12 +2,13 @@ import fs from 'node:fs';
|
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { isDeepStrictEqual } from 'node:util';
|
|
4
4
|
import { providerIdentity } from './provider-identity.js';
|
|
5
|
-
import { providerEnvironmentVariable } from './providers-config.js';
|
|
5
|
+
import { initializationRuntimePlan, providerEnvironmentVariable } from './providers-config.js';
|
|
6
6
|
import { validateProvidersFile } from './providers-config.js';
|
|
7
|
-
export function planProviderIdentityMigration(home, registry) {
|
|
7
|
+
export function planProviderIdentityMigration(home, registry, options = {}) {
|
|
8
|
+
home = path.resolve(home);
|
|
8
9
|
const changes = [];
|
|
9
10
|
const expected = [];
|
|
10
|
-
const summary = { providersMigrated: 0, skippedProviders: 0, filesChanged: 0, referencesUpdated: 0 };
|
|
11
|
+
const summary = { providersMigrated: 0, skippedProviders: 0, filesChanged: 0, referencesUpdated: 0, aliasesRemoved: 0 };
|
|
11
12
|
const pending = [];
|
|
12
13
|
const providerFile = path.join(home, 'providers.json');
|
|
13
14
|
const readJson = (file) => {
|
|
@@ -79,6 +80,10 @@ export function planProviderIdentityMigration(home, registry) {
|
|
|
79
80
|
target.services = services;
|
|
80
81
|
};
|
|
81
82
|
for (const [oldId, provider] of Object.entries(source.providers).sort(([left], [right]) => left.localeCompare(right))) {
|
|
83
|
+
if (options.preserveProviderIds) {
|
|
84
|
+
providers[oldId] = provider;
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
82
87
|
let identity;
|
|
83
88
|
try {
|
|
84
89
|
identity = providerIdentity(provider);
|
|
@@ -123,36 +128,56 @@ export function planProviderIdentityMigration(home, registry) {
|
|
|
123
128
|
if (Object.hasOwn(providers, alias))
|
|
124
129
|
throw new Error(`Provider ID conflicts with an old ID: ${alias} -> ${target}`);
|
|
125
130
|
}
|
|
126
|
-
const normalizedRegistry = validateProvidersFile({ $schema_version: 2, providers,
|
|
131
|
+
const normalizedRegistry = validateProvidersFile({ $schema_version: 2, providers,
|
|
132
|
+
...(!options.cleanupAliases && Object.keys(aliases).length ? { aliases } : {}) });
|
|
133
|
+
if (options.cleanupAliases)
|
|
134
|
+
summary.aliasesRemoved = Object.keys(aliases).length;
|
|
127
135
|
const queue = (file, before, value) => {
|
|
128
136
|
changes.push({ file, kind: 'provider-domain-id', before, after: JSON.stringify(value, null, 2) + String.fromCharCode(10) });
|
|
129
137
|
summary.filesChanged++;
|
|
130
138
|
};
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
139
|
+
const finish = () => {
|
|
140
|
+
if (!isDeepStrictEqual(original.value, normalizedRegistry))
|
|
141
|
+
queue(providerFile, original.text, normalizedRegistry);
|
|
134
142
|
return { home, changes, summary, pending, expected, registry: normalizedRegistry };
|
|
143
|
+
};
|
|
144
|
+
if (!Object.keys(aliases).length)
|
|
145
|
+
return finish();
|
|
135
146
|
const agentsDir = path.join(home, 'agents');
|
|
136
|
-
if (
|
|
137
|
-
return { home, changes, summary, pending, expected, registry: normalizedRegistry };
|
|
138
|
-
if (fs.lstatSync(agentsDir).isSymbolicLink())
|
|
147
|
+
if (fs.existsSync(agentsDir) && fs.lstatSync(agentsDir).isSymbolicLink())
|
|
139
148
|
throw new Error('Provider migration does not follow agent directory symlinks');
|
|
140
149
|
const files = [path.join(agentsDir, 'defaults.json')];
|
|
141
|
-
for (const agent of fs.readdirSync(agentsDir, { withFileTypes: true })) {
|
|
150
|
+
for (const agent of fs.existsSync(agentsDir) ? fs.readdirSync(agentsDir, { withFileTypes: true }) : []) {
|
|
151
|
+
if (agent.isSymbolicLink())
|
|
152
|
+
throw new Error('Provider migration does not follow agent directory symlinks');
|
|
142
153
|
if (!agent.isDirectory() || !/^[a-z0-9-]+(?:[.][a-z0-9-]+){2,}$/iu.test(agent.name))
|
|
143
154
|
continue;
|
|
144
155
|
const agentDir = path.join(agentsDir, agent.name);
|
|
145
156
|
files.push(path.join(agentDir, 'config.json'));
|
|
157
|
+
files.push(path.join(agentDir, 'data', 'initialization.json'));
|
|
146
158
|
const relations = path.join(agentDir, 'relations');
|
|
147
159
|
if (!fs.existsSync(relations))
|
|
148
160
|
continue;
|
|
149
161
|
if (fs.lstatSync(relations).isSymbolicLink())
|
|
150
162
|
throw new Error('Provider migration does not follow relation directory symlinks');
|
|
151
163
|
for (const relation of fs.readdirSync(relations, { withFileTypes: true })) {
|
|
164
|
+
if (relation.isSymbolicLink())
|
|
165
|
+
throw new Error('Provider migration does not follow relation directory symlinks');
|
|
152
166
|
if (relation.isDirectory())
|
|
153
167
|
files.push(path.join(relations, relation.name, 'config.json'));
|
|
154
168
|
}
|
|
155
169
|
}
|
|
170
|
+
const ecwebDir = path.join(home, 'data', 'ecweb');
|
|
171
|
+
files.push(path.join(ecwebDir, 'init-state.json'));
|
|
172
|
+
const creationsDir = path.join(ecwebDir, 'agent-creations');
|
|
173
|
+
if (fs.existsSync(creationsDir)) {
|
|
174
|
+
if (fs.lstatSync(creationsDir).isSymbolicLink())
|
|
175
|
+
throw new Error('Provider migration does not follow creation directory symlinks');
|
|
176
|
+
for (const entry of fs.readdirSync(creationsDir, { withFileTypes: true })) {
|
|
177
|
+
if (entry.name.endsWith('.json'))
|
|
178
|
+
files.push(path.join(creationsDir, entry.name));
|
|
179
|
+
}
|
|
180
|
+
}
|
|
156
181
|
const rewriteSelection = (value) => {
|
|
157
182
|
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
158
183
|
return 0;
|
|
@@ -176,27 +201,77 @@ export function planProviderIdentityMigration(home, registry) {
|
|
|
176
201
|
return count;
|
|
177
202
|
};
|
|
178
203
|
const rewriteSelections = (value) => {
|
|
179
|
-
if (!value || typeof value !== 'object'
|
|
204
|
+
if (!value || typeof value !== 'object')
|
|
180
205
|
return 0;
|
|
181
|
-
let count =
|
|
206
|
+
let count = rewriteSelection(value);
|
|
182
207
|
for (const entry of Object.values(value)) {
|
|
183
|
-
count +=
|
|
208
|
+
count += rewriteSelections(entry);
|
|
184
209
|
}
|
|
185
210
|
return count;
|
|
186
211
|
};
|
|
187
212
|
for (const file of files) {
|
|
188
|
-
|
|
213
|
+
for (let parent = path.dirname(file); parent !== home; parent = path.dirname(parent)) {
|
|
214
|
+
if (fs.existsSync(parent) && fs.lstatSync(parent).isSymbolicLink())
|
|
215
|
+
throw new Error('Provider migration does not follow configuration symlinks');
|
|
216
|
+
}
|
|
217
|
+
try {
|
|
218
|
+
if (fs.lstatSync(file).isSymbolicLink())
|
|
219
|
+
throw new Error('Provider migration does not follow configuration symlinks');
|
|
220
|
+
}
|
|
221
|
+
catch (error) {
|
|
222
|
+
if (error.code !== 'ENOENT')
|
|
223
|
+
throw error;
|
|
224
|
+
expected.push({ file, before: null });
|
|
189
225
|
continue;
|
|
226
|
+
}
|
|
190
227
|
const parsed = readJson(file);
|
|
191
228
|
let count = 0;
|
|
192
229
|
count += rewriteSelections(parsed.value.baseagents);
|
|
193
230
|
count += rewriteSelections(parsed.value.agents);
|
|
194
231
|
count += rewriteSelections(parsed.value.Services);
|
|
195
|
-
count +=
|
|
232
|
+
count += rewriteSelections(parsed.value.decision_model);
|
|
233
|
+
if (path.basename(file) === 'initialization.json') {
|
|
234
|
+
const record = parsed.value;
|
|
235
|
+
if (!record.plan || typeof record.plan !== 'object' || Array.isArray(record.plan))
|
|
236
|
+
throw new Error('Invalid initialization plan during Provider migration');
|
|
237
|
+
const runtime = initializationRuntimePlan(record);
|
|
238
|
+
if (typeof runtime.provider === 'string' && Object.hasOwn(aliases, runtime.provider)) {
|
|
239
|
+
record.providerMigration = { from: record.plan.provider, to: aliases[runtime.provider] };
|
|
240
|
+
count++;
|
|
241
|
+
}
|
|
242
|
+
if (record.providerMigration && !Object.hasOwn(providers, record.providerMigration.to))
|
|
243
|
+
throw new Error('Initialization Provider migration target is missing');
|
|
244
|
+
}
|
|
245
|
+
else if (file.startsWith(ecwebDir + path.sep)) {
|
|
246
|
+
const creation = parsed.value.creation;
|
|
247
|
+
if (creation?.plan) {
|
|
248
|
+
const runtime = initializationRuntimePlan(creation);
|
|
249
|
+
if (runtime.provider && Object.hasOwn(aliases, runtime.provider)) {
|
|
250
|
+
creation.providerMigration = { from: creation.plan.provider, to: aliases[runtime.provider] };
|
|
251
|
+
count++;
|
|
252
|
+
}
|
|
253
|
+
if (creation.providerMigration && !Object.hasOwn(providers, creation.providerMigration.to))
|
|
254
|
+
throw new Error('Creation Provider migration target is missing');
|
|
255
|
+
}
|
|
256
|
+
const ids = parsed.value.providerIds;
|
|
257
|
+
if (ids && typeof ids === 'object' && !Array.isArray(ids)) {
|
|
258
|
+
for (const [key, value] of Object.entries(ids)) {
|
|
259
|
+
if (typeof value === 'string' && Object.hasOwn(aliases, value)) {
|
|
260
|
+
ids[key] = aliases[value];
|
|
261
|
+
count++;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
else {
|
|
267
|
+
count += rewriteSelection(parsed.value.plan);
|
|
268
|
+
const creation = parsed.value.creation;
|
|
269
|
+
count += rewriteSelection(creation?.plan);
|
|
270
|
+
}
|
|
196
271
|
if (!count)
|
|
197
272
|
continue;
|
|
198
273
|
summary.referencesUpdated += count;
|
|
199
274
|
queue(file, parsed.text, parsed.value);
|
|
200
275
|
}
|
|
201
|
-
return
|
|
276
|
+
return finish();
|
|
202
277
|
}
|
|
@@ -127,6 +127,8 @@ export async function syncLocalProviders() {
|
|
|
127
127
|
}
|
|
128
128
|
plan.summary.filesChanged = plan.changes.length;
|
|
129
129
|
const backup = commitProviderSyncMigration(plan);
|
|
130
|
+
if (plan.changes.length && !backup)
|
|
131
|
+
warnings.push('CONFIG_SNAPSHOTS_DISABLED');
|
|
130
132
|
for (const change of plan.changes) {
|
|
131
133
|
const parts = path.relative(home, change.file).split(path.sep);
|
|
132
134
|
if (parts[0] === 'providers.json')
|
|
@@ -347,6 +347,19 @@ export function resolveProviderModelOverrides(providerId, serviceType, config, b
|
|
|
347
347
|
export function providerIsConfigured(config) {
|
|
348
348
|
return config?.provider !== undefined;
|
|
349
349
|
}
|
|
350
|
+
export function initializationRuntimePlan(record) {
|
|
351
|
+
const migration = record.providerMigration;
|
|
352
|
+
if (migration === undefined)
|
|
353
|
+
return record.plan;
|
|
354
|
+
if (!migration || typeof migration !== 'object' || Array.isArray(migration))
|
|
355
|
+
throw new Error('Invalid initialization Provider migration binding');
|
|
356
|
+
if (typeof migration.from !== 'string' || migration.from !== record.plan.provider || typeof migration.to !== 'string'
|
|
357
|
+
|| !/^[A-Za-z0-9_-]+$/u.test(migration.to)
|
|
358
|
+
|| ['__proto__', 'constructor', 'prototype'].includes(migration.to)) {
|
|
359
|
+
throw new Error('Invalid initialization Provider migration binding');
|
|
360
|
+
}
|
|
361
|
+
return { ...record.plan, provider: migration.to };
|
|
362
|
+
}
|
|
350
363
|
export function resolveServiceSelection(selections, serviceType, resolve) {
|
|
351
364
|
const selection = selections?.[serviceType];
|
|
352
365
|
if (!selection)
|
|
@@ -3,11 +3,12 @@ import { isDeepStrictEqual } from 'node:util';
|
|
|
3
3
|
import fs from 'node:fs';
|
|
4
4
|
import path, { posix } from 'node:path';
|
|
5
5
|
import { resolvePaths } from '../paths.js';
|
|
6
|
-
import { ConfigTarget, mutateConfig } from './config-manager.js';
|
|
6
|
+
import { ConfigTarget, mutateConfig, notifyConfigWrite } from './config-manager.js';
|
|
7
7
|
import { atomicReadJson } from '../utils/atomic-write.js';
|
|
8
8
|
import { readProvidersFile, validateProvidersFile } from './providers.js';
|
|
9
|
-
import { providerEnvironmentVariable, providerNameFromBaseUrlIfStatic, resolveProviderId, resolveProviderService, resolveProviderServiceForBaseagent, validateProviderName } from './providers-config.js';
|
|
9
|
+
import { initializationRuntimePlan, providerEnvironmentVariable, providerNameFromBaseUrlIfStatic, resolveProviderId, resolveProviderService, resolveProviderServiceForBaseagent, validateProviderName } from './providers-config.js';
|
|
10
10
|
import { providerIdentity } from './provider-identity.js';
|
|
11
|
+
import { planProviderIdentityMigration } from './provider-identity-migration.js';
|
|
11
12
|
export const PROVIDER_SECRET_MASK = '<redacted>';
|
|
12
13
|
function providerReferences(providerId, providerFile) {
|
|
13
14
|
const registry = readProvidersFile(providerFile);
|
|
@@ -35,6 +36,15 @@ function providerReferences(providerId, providerFile) {
|
|
|
35
36
|
candidates.push(path.join(agentsDir, agent.name, 'relations', relation.name, 'config.json'));
|
|
36
37
|
}
|
|
37
38
|
}
|
|
39
|
+
const ecwebDir = path.join(root, 'data', 'ecweb');
|
|
40
|
+
candidates.push(path.join(ecwebDir, 'init-state.json'));
|
|
41
|
+
const creations = path.join(ecwebDir, 'agent-creations');
|
|
42
|
+
if (fs.existsSync(creations)) {
|
|
43
|
+
for (const entry of fs.readdirSync(creations, { withFileTypes: true })) {
|
|
44
|
+
if (entry.name.endsWith('.json') && (entry.isFile() || entry.isSymbolicLink()))
|
|
45
|
+
candidates.push(path.join(creations, entry.name));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
38
48
|
const references = [];
|
|
39
49
|
const visit = (value, fieldPath, file) => {
|
|
40
50
|
if (Array.isArray(value)) {
|
|
@@ -57,6 +67,19 @@ function providerReferences(providerId, providerFile) {
|
|
|
57
67
|
continue;
|
|
58
68
|
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
59
69
|
throw new Error();
|
|
70
|
+
if (path.basename(file) === 'initialization.json' && value.plan)
|
|
71
|
+
value.plan = initializationRuntimePlan(value);
|
|
72
|
+
if (value.creation?.plan) {
|
|
73
|
+
value.creation = { ...value.creation, plan: initializationRuntimePlan(value.creation) };
|
|
74
|
+
}
|
|
75
|
+
if (value.providerIds && typeof value.providerIds === 'object' && !Array.isArray(value.providerIds)) {
|
|
76
|
+
for (const [key, id] of Object.entries(value.providerIds)) {
|
|
77
|
+
if (typeof id === 'string' && referencedIds.has(id))
|
|
78
|
+
references.push({
|
|
79
|
+
file: path.relative(root, file), path: `providerIds.${key}`,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}
|
|
60
83
|
for (const field of ['baseagents', 'agents', 'Services', 'decision_model', 'plan', 'creation']) {
|
|
61
84
|
visit(value[field], field, path.relative(root, file).replace(/\\/g, '/'));
|
|
62
85
|
}
|
|
@@ -349,6 +372,73 @@ export async function createProvider(input, file = resolvePaths().providersConfi
|
|
|
349
372
|
});
|
|
350
373
|
return { ...providersSnapshot(result.value.current), providerId: result.value.providerId };
|
|
351
374
|
}
|
|
375
|
+
function upgradeProviderId(current, oldId) {
|
|
376
|
+
const provider = current.providers[oldId];
|
|
377
|
+
const identity = providerIdentity(provider);
|
|
378
|
+
provider.domain = identity.domain;
|
|
379
|
+
if (oldId === identity.providerId)
|
|
380
|
+
return oldId;
|
|
381
|
+
const remaining = { ...current.providers };
|
|
382
|
+
delete remaining[oldId];
|
|
383
|
+
const aliases = { ...current.aliases };
|
|
384
|
+
if (aliases[identity.providerId] === oldId)
|
|
385
|
+
delete aliases[identity.providerId];
|
|
386
|
+
const providerId = availableProviderId({ providers: remaining, aliases }, provider);
|
|
387
|
+
for (const [alias, target] of Object.entries(aliases)) {
|
|
388
|
+
if (target === oldId)
|
|
389
|
+
aliases[alias] = providerId;
|
|
390
|
+
}
|
|
391
|
+
aliases[oldId] = providerId;
|
|
392
|
+
delete current.providers[oldId];
|
|
393
|
+
current.providers[providerId] = provider;
|
|
394
|
+
current.aliases = aliases;
|
|
395
|
+
delete current.nextId;
|
|
396
|
+
return providerId;
|
|
397
|
+
}
|
|
398
|
+
async function mutateProvidersWithIdentityUpgrade(revision, file, mutation) {
|
|
399
|
+
if (!/^[a-f0-9]{64}$/u.test(revision))
|
|
400
|
+
throw new Error('A valid providers revision is required');
|
|
401
|
+
const assertRevision = (current) => {
|
|
402
|
+
if (providersRevision(current) !== revision) {
|
|
403
|
+
throw Object.assign(new Error('Providers changed after loading; reload before saving'), {
|
|
404
|
+
code: 'CONFLICT', statusCode: 409, data: { kind: 'revision_conflict' },
|
|
405
|
+
});
|
|
406
|
+
}
|
|
407
|
+
};
|
|
408
|
+
const previous = readProvidersFile(file);
|
|
409
|
+
assertRevision(previous);
|
|
410
|
+
const draft = structuredClone(previous);
|
|
411
|
+
const result = mutation(draft);
|
|
412
|
+
const upgraded = Object.keys(previous.providers).some(id => !Object.hasOwn(draft.providers, id) && draft.aliases?.[id]);
|
|
413
|
+
if (!upgraded) {
|
|
414
|
+
return mutateConfig(ConfigTarget.Providers, { providerFile: file }, config => {
|
|
415
|
+
const current = config;
|
|
416
|
+
assertRevision(current);
|
|
417
|
+
return mutation(current);
|
|
418
|
+
}).value;
|
|
419
|
+
}
|
|
420
|
+
if (path.basename(file) !== 'providers.json')
|
|
421
|
+
throw new Error('Provider ID upgrade requires the canonical providers.json registry');
|
|
422
|
+
const plan = planProviderIdentityMigration(path.dirname(path.resolve(file)), draft, { preserveProviderIds: true });
|
|
423
|
+
const original = plan.expected.find(item => item.file === path.resolve(file));
|
|
424
|
+
if (!original?.before)
|
|
425
|
+
throw Object.assign(new Error('Provider registry changed during import'), { code: 'CONFLICT', statusCode: 409 });
|
|
426
|
+
assertRevision(validateProvidersFile(JSON.parse(original.before.replace(/^\uFEFF/u, ''))));
|
|
427
|
+
const { commitProviderSyncMigration } = await import('./schema-migration.js');
|
|
428
|
+
commitProviderSyncMigration(plan);
|
|
429
|
+
for (const change of plan.changes) {
|
|
430
|
+
const parts = path.relative(plan.home, change.file).split(path.sep);
|
|
431
|
+
if (parts[0] === 'providers.json')
|
|
432
|
+
notifyConfigWrite(ConfigTarget.Providers, { providerFile: file });
|
|
433
|
+
else if (parts[1] === 'defaults.json')
|
|
434
|
+
notifyConfigWrite(ConfigTarget.Defaults);
|
|
435
|
+
else if (parts[2] === 'config.json')
|
|
436
|
+
notifyConfigWrite(ConfigTarget.Agent, { self: parts[1] });
|
|
437
|
+
else if (parts[2] === 'relations')
|
|
438
|
+
notifyConfigWrite(ConfigTarget.Relation, { self: parts[1], peerKey: parts[3] });
|
|
439
|
+
}
|
|
440
|
+
return { ...result, current: plan.registry };
|
|
441
|
+
}
|
|
352
442
|
function providerHostname(baseUrl) {
|
|
353
443
|
if (providerEnvironmentVariable(baseUrl))
|
|
354
444
|
return undefined;
|
|
@@ -430,8 +520,7 @@ export async function saveProviderChanges(input, file = resolvePaths().providers
|
|
|
430
520
|
}
|
|
431
521
|
identifiers.add(change.providerId);
|
|
432
522
|
}
|
|
433
|
-
const result =
|
|
434
|
-
const current = config;
|
|
523
|
+
const result = await mutateProvidersWithIdentityUpgrade(input.revision, file, current => {
|
|
435
524
|
if (providersRevision(current) !== input.revision) {
|
|
436
525
|
throw Object.assign(new Error('Providers changed after loading; reload before saving'), { code: 'CONFLICT', statusCode: 409, data: { kind: 'revision_conflict' } });
|
|
437
526
|
}
|
|
@@ -459,15 +548,17 @@ export async function saveProviderChanges(input, file = resolvePaths().providers
|
|
|
459
548
|
provider.name ||= providerNameFromBaseUrlIfStatic(provider.common.baseUrl);
|
|
460
549
|
if (provider.name !== undefined)
|
|
461
550
|
provider.name = validateProviderName(provider.name);
|
|
462
|
-
|
|
551
|
+
let providerId = change.create ? availableProviderId(current, provider) : targetId;
|
|
463
552
|
if (change.create)
|
|
464
553
|
delete current.nextId;
|
|
465
554
|
current.providers[providerId] = provider;
|
|
555
|
+
if (!change.create && change.imports?.length)
|
|
556
|
+
providerId = upgradeProviderId(current, providerId);
|
|
466
557
|
providerIds[change.providerId] = providerId;
|
|
467
558
|
}
|
|
468
559
|
return { current, providerIds };
|
|
469
560
|
});
|
|
470
|
-
return { ...providersSnapshot(result.
|
|
561
|
+
return { ...providersSnapshot(result.current), providerIds: result.providerIds };
|
|
471
562
|
}
|
|
472
563
|
export function importBaseagentProviderIntoRegistry(current, input) {
|
|
473
564
|
const normalized = validateProvidersFile({ providers: { imported: input.value } });
|
|
@@ -492,7 +583,7 @@ export function importBaseagentProviderIntoRegistry(current, input) {
|
|
|
492
583
|
const [providerId, existing] = match;
|
|
493
584
|
const replaceServiceTypes = new Set(Object.entries(input.serviceDecisions || {}).filter(([, decision]) => decision === 'imported').map(([type]) => type));
|
|
494
585
|
current.providers[providerId] = validateProvidersFile({ providers: { [providerId]: mergeImportedProvider(existing, imported, replaceServiceTypes) } }).providers[providerId];
|
|
495
|
-
return { current, providerId, merged: true };
|
|
586
|
+
return { current, providerId: upgradeProviderId(current, providerId), merged: true };
|
|
496
587
|
}
|
|
497
588
|
const providerId = availableProviderId(current, imported);
|
|
498
589
|
current.providers[providerId] = imported;
|
|
@@ -502,12 +593,11 @@ export function importBaseagentProviderIntoRegistry(current, input) {
|
|
|
502
593
|
export async function importOrMergeBaseagentProvider(input, file = resolvePaths().providersConfig) {
|
|
503
594
|
if (!/^[a-f0-9]{64}$/u.test(input.revision))
|
|
504
595
|
throw new Error('A valid providers revision is required');
|
|
505
|
-
const result =
|
|
506
|
-
const current = config;
|
|
596
|
+
const result = await mutateProvidersWithIdentityUpgrade(input.revision, file, current => {
|
|
507
597
|
if (providersRevision(current) !== input.revision) {
|
|
508
598
|
throw Object.assign(new Error('Providers changed after loading; reload before saving'), { code: 'CONFLICT', statusCode: 409, data: { kind: 'revision_conflict' } });
|
|
509
599
|
}
|
|
510
600
|
return importBaseagentProviderIntoRegistry(current, input);
|
|
511
601
|
});
|
|
512
|
-
return { ...providersSnapshot(result.
|
|
602
|
+
return { ...providersSnapshot(result.current), providerId: result.providerId, merged: result.merged };
|
|
513
603
|
}
|
|
@@ -5,7 +5,7 @@ import { agentRelationConfig, agentRelationsDir, agentRoleConfig, agentRolesInde
|
|
|
5
5
|
import { registerFile, unregisterFile } from '../core/file-integrity/store.js';
|
|
6
6
|
import { currentVersion, loadSchema } from './schema-registry.js';
|
|
7
7
|
import { clearRoleStoreCache, getStoredRoleRegistry, isRoleName, readRoleStore, roleRegistryExists, } from './role-store.js';
|
|
8
|
-
import {
|
|
8
|
+
import { DEFAULT_INTERNAL_CONTACT_ROLE, expectedRoleRank, isManagementRole } from './builtin-roles.js';
|
|
9
9
|
import { readBuiltinRoleTemplate } from './builtin-role-templates.js';
|
|
10
10
|
import { normalizeRoleEffortCompat, validateRoleConfig } from './role-schema.js';
|
|
11
11
|
export class RoleServiceError extends Error {
|
|
@@ -30,7 +30,7 @@ export function ensureInitialRoleRegistry(selfAid) {
|
|
|
30
30
|
writeRoleRegistry(selfAid, {
|
|
31
31
|
$schema_version: 1,
|
|
32
32
|
roles: ['owner', 'admin', 'member', 'visitor'],
|
|
33
|
-
defaultRoles: { private: null, group: null,
|
|
33
|
+
defaultRoles: { private: null, group: null, internalContact: DEFAULT_INTERNAL_CONTACT_ROLE },
|
|
34
34
|
});
|
|
35
35
|
return true;
|
|
36
36
|
}
|
|
@@ -125,8 +125,8 @@ export function unregisterRole(selfAid, roleId, replacementRoleId) {
|
|
|
125
125
|
defaultRoles: {
|
|
126
126
|
private: registry.defaultRoles.private === roleId ? (replacement ?? null) : registry.defaultRoles.private,
|
|
127
127
|
group: registry.defaultRoles.group === roleId ? (replacement ?? null) : registry.defaultRoles.group,
|
|
128
|
-
|
|
129
|
-
? (replacement ??
|
|
128
|
+
internalContact: (registry.defaultRoles.internalContact ?? DEFAULT_INTERNAL_CONTACT_ROLE) === roleId
|
|
129
|
+
? (replacement ?? DEFAULT_INTERNAL_CONTACT_ROLE) : registry.defaultRoles.internalContact,
|
|
130
130
|
},
|
|
131
131
|
};
|
|
132
132
|
validateRegistry(selfAid, nextRegistry);
|
|
@@ -174,8 +174,8 @@ function validateRegistry(selfAid, value) {
|
|
|
174
174
|
const registry = normalized;
|
|
175
175
|
if (!registry.roles.includes('visitor'))
|
|
176
176
|
throw new RoleServiceError('VISITOR_REQUIRED', 'visitor must remain registered');
|
|
177
|
-
for (const role of ['private', 'group', '
|
|
178
|
-
const selected = role === '
|
|
177
|
+
for (const role of ['private', 'group', 'internalContact']) {
|
|
178
|
+
const selected = role === 'internalContact' ? registry.defaultRoles.internalContact ?? DEFAULT_INTERNAL_CONTACT_ROLE : registry.defaultRoles[role];
|
|
179
179
|
if (selected !== null && (selected === 'owner' || !registry.roles.includes(selected))) {
|
|
180
180
|
throw new RoleServiceError('INVALID_DEFAULT_ROLE', `defaultRoles.${role} must reference an assignable registered role`);
|
|
181
181
|
}
|
|
@@ -206,8 +206,8 @@ function findRoleReferences(selfAid, roleId, registry) {
|
|
|
206
206
|
references.push('defaultRoles.private');
|
|
207
207
|
if (registry.defaultRoles.group === roleId)
|
|
208
208
|
references.push('defaultRoles.group');
|
|
209
|
-
if ((registry.defaultRoles.
|
|
210
|
-
references.push('defaultRoles.
|
|
209
|
+
if ((registry.defaultRoles.internalContact ?? DEFAULT_INTERNAL_CONTACT_ROLE) === roleId)
|
|
210
|
+
references.push('defaultRoles.internalContact');
|
|
211
211
|
const relations = agentRelationsDir(selfAid);
|
|
212
212
|
if (!fs.existsSync(relations))
|
|
213
213
|
return references;
|