evolcore 0.0.45 → 0.0.46
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 +75 -0
- package/bin/ecmsg.js +33 -23
- package/dist/ability/application-service.js +1 -2
- package/dist/ability/package.js +28 -0
- package/dist/agent-template/jobs.js +158 -36
- package/dist/agent-template/runtime.js +401 -34
- package/dist/agent-template/service.js +764 -369
- package/dist/agent-template/tool-runner.js +35 -17
- package/dist/agent-template/types.js +7 -4
- package/dist/agents/baseagent.js +10 -9
- package/dist/agents/claude-runner.js +13 -5
- package/dist/agents/codex/app-server-client.js +2 -4
- package/dist/agents/codex/diagnostics.js +18 -1
- package/dist/agents/codex-runner.js +3 -1
- package/dist/agents/ecagent-runner.js +3 -1
- package/dist/agents/gemini-runner.js +2 -1
- package/dist/aun/menu/client.js +142 -182
- package/dist/aun/rpc/client.js +33 -17
- package/dist/aun/service-proxy.js +6 -23
- package/dist/channels/aun.js +656 -112
- package/dist/cli/agent-create.js +37 -10
- package/dist/cli/agent-template.js +105 -84
- package/dist/cli/agent.js +31 -18
- package/dist/cli/daemon-commands.js +15 -17
- package/dist/cli/daemon-lifecycle-client.js +40 -18
- package/dist/cli/directory.js +12 -4
- package/dist/cli/ecmsg-gateway.js +5 -2
- package/dist/cli/events-command.js +2 -1
- package/dist/cli/init.js +50 -20
- package/dist/cli/integrity-command.js +2 -0
- package/dist/cli/managed-command-guard.js +20 -1
- package/dist/cli/menu-client.js +7 -5
- package/dist/cli/restart-monitor.js +33 -20
- package/dist/cli/services-command.js +28 -5
- package/dist/config/config-field-policy.js +24 -0
- package/dist/config/config-manager.js +20 -2
- package/dist/config/peer-book-store.js +152 -120
- package/dist/config/peer-role-resolver.js +24 -4
- package/dist/config/provider-identity-migration.js +1 -1
- package/dist/config/provider-identity.js +10 -4
- package/dist/config/provider-ipc-service.js +10 -2
- package/dist/config/provider-local-sync.js +2 -2
- package/dist/config/providers-config.js +95 -10
- package/dist/config/providers-import.js +4 -6
- package/dist/config/providers.js +14 -3
- package/dist/config/role-store.js +1 -1
- package/dist/config-store.js +9 -1
- package/dist/core/agent-application-service.js +56 -29
- package/dist/core/agent-create-status.js +3 -1
- package/dist/core/agent-creation-claim.js +1 -0
- package/dist/core/agent-ipc-registration.js +2 -2
- package/dist/core/agent-reload-coordinator.js +38 -1
- package/dist/core/agent-runtime.js +85 -38
- package/dist/core/auth/agent-delegation.js +5 -0
- package/dist/core/auth/operation-authorizer.js +1 -1
- package/dist/core/auth/operation-catalog.js +3 -3
- package/dist/core/bootstrap-service.js +3 -0
- package/dist/core/capability/capability-manager.js +3 -1
- package/dist/core/channel-loader.js +29 -3
- package/dist/core/channel-runtime.js +1 -1
- package/dist/core/command/agent-control.js +6 -5
- package/dist/core/command/agent-template-menu.js +32 -97
- package/dist/core/command/eventcenter-menu.js +61 -13
- package/dist/core/command/menu-catalog.js +11 -4
- package/dist/core/command/menu-handler.js +35 -8
- package/dist/core/command/menu-protocol.js +8 -16
- package/dist/core/command/skill-slash.js +6 -2
- package/dist/core/command/team-workspace-bootstrap.js +1 -2
- package/dist/core/command/team-workspace-management-store.js +83 -0
- package/dist/core/command/team-workspace-management.js +1 -2
- package/dist/core/command/team-workspace-team.js +26 -3
- package/dist/core/daemon-control.js +3 -4
- package/dist/core/daemon-lifecycle.js +146 -110
- package/dist/core/evolagent-registry.js +42 -0
- package/dist/core/evolagent.js +2 -1
- package/dist/core/file-integrity/read.js +9 -16
- package/dist/core/file-integrity/store.js +94 -34
- package/dist/core/handoff/dispatcher.js +33 -7
- package/dist/core/handoff/runtime.js +8 -0
- package/dist/core/inference/text-inference.js +12 -2
- package/dist/core/invoke/invoke-service.js +24 -3
- package/dist/core/ipc-registration.js +3 -0
- package/dist/core/message/aun-ipc-sender.js +109 -7
- package/dist/core/message/contact-admission.js +6 -2
- package/dist/core/message/message-bridge.js +13 -0
- package/dist/core/message/message-queue.js +131 -30
- package/dist/core/message/pending-hints.js +8 -0
- package/dist/core/message/response-engine.js +48 -2
- package/dist/core/message/send-routing.js +3 -12
- package/dist/core/model/catalog-service.js +13 -0
- package/dist/core/model/model-catalog.js +57 -18
- package/dist/core/pack-auth.js +163 -31
- package/dist/core/pack-install.js +42 -1
- package/dist/{services/ledger.js → core/pack-ledger.js} +17 -6
- package/dist/core/permission/ec-command-parser.js +3 -1
- package/dist/core/permission/shell-environment.js +23 -0
- package/dist/core/rate-window.js +6 -1
- package/dist/core/session/session-idle-monitor.js +0 -1
- package/dist/core/session/session-manager.js +14 -0
- package/dist/core/session/session-title.js +26 -6
- package/dist/core/skill/index-generator.js +3 -4
- package/dist/core/thread/thread-service.js +0 -1
- package/dist/core/thread/topic-id.js +8 -0
- package/dist/directory/owner-directory-admission.js +17 -0
- package/dist/directory/owner-directory-cache.js +3 -1
- package/dist/directory/owner-directory-markdown.js +145 -23
- package/dist/directory/owner-directory-policy.js +23 -0
- package/dist/directory/owner-directory-query-operation.js +20 -6
- package/dist/directory/owner-directory-search.js +47 -0
- package/dist/eck/message-renderer.js +171 -32
- package/dist/ecweb/basic-settings-service.js +7 -3
- package/dist/ecweb/providers-service.js +17 -10
- package/dist/ecweb/runtime/lifecycle.js +1 -1
- package/dist/ecweb/runtime/supervisor.js +77 -35
- package/dist/event-center/admission-materializer.js +1 -1
- package/dist/event-center/bus-gate.js +48 -4
- package/dist/event-center/bus-host.js +3 -3
- package/dist/event-center/center-config.js +57 -28
- package/dist/event-center/dispatcher.js +8 -0
- package/dist/event-center/event-log.js +69 -27
- package/dist/event-center/index-generator.js +6 -1
- package/dist/event-center/ipc-operation.js +66 -25
- package/dist/event-center/pack-loader.js +12 -55
- package/dist/event-center/pack-manager.js +5 -3
- package/dist/event-center/registry.js +48 -52
- package/dist/event-center/runtime.js +219 -81
- package/dist/event-center/script-runner.js +18 -7
- package/dist/event-center/types.js +9 -1
- package/dist/event-center/validation.js +33 -4
- package/dist/index.js +96 -42
- package/dist/ipc.js +33 -7
- package/dist/product.js +1 -0
- package/dist/proxy/manager.js +52 -11
- package/dist/proxy/service-supervisor.js +265 -67
- package/dist/services/dispatcher.js +26 -3
- package/dist/services/idempotency.js +128 -0
- package/dist/services/identity.js +3 -27
- package/dist/services/index-generator.js +5 -1
- package/dist/services/index.js +244 -45
- package/dist/services/ipc-operation.js +164 -20
- package/dist/services/pack-manager.js +37 -9
- package/dist/services/router.js +100 -31
- package/dist/services/script-runner.js +15 -4
- package/dist/services/service-payload.js +50 -2
- package/dist/services/validation.js +107 -3
- package/dist/trigger/scheduler.js +14 -4
- package/dist/trigger/script-sandbox.js +39 -2
- package/dist/utils/cross-platform.js +35 -11
- package/dist/utils/error-utils.js +13 -1
- package/dist/utils/instance-registry.js +33 -35
- package/dist/utils/process-introspect.js +35 -20
- package/dist/utils/project-path.js +47 -3
- package/dist/utils/windows-shell-trust.js +174 -68
- package/kits/docs/context-assembly.md +3 -3
- package/kits/docs/evolcore/agent.md +28 -10
- package/kits/docs/evolcore/config.md +22 -0
- package/kits/docs/evolcore/directory.md +46 -12
- package/kits/docs/evolcore/event-center.md +6 -6
- package/kits/docs/evolcore/group-collaboration.md +1 -1
- package/kits/docs/evolcore/menu-client.md +7 -5
- package/kits/docs/evolcore/menu-protocol.md +5 -3
- package/kits/docs/evolcore/msg.md +10 -3
- package/kits/docs/evolcore/provider.md +7 -3
- package/kits/docs/evolcore/services.md +145 -12
- package/kits/docs/evolcore/thread-chain.md +17 -9
- package/kits/docs/prompt-loading-architecture.md +4 -4
- package/kits/eck_message_manifest.json +46 -3
- package/kits/rules/04-relation.md +10 -2
- package/kits/rules/06-channel.md +2 -1
- package/kits/schemas/providers.schema.2.json +1 -0
- package/kits/skills/ec-group/SKILL.md +4 -0
- package/kits/skills/ec-skill/scripts/cli.mjs +1 -1
- package/kits/skills/ec-skill/scripts/skill.mjs +13 -2
- package/kits/skills/thread-ops/SKILL.md +8 -5
- package/kits/templates/message-fragments/group-batch-item.md +3 -0
- package/kits/templates/message-fragments/group-batch.md +1 -0
- package/kits/templates/message-fragments/item-group.md +4 -0
- package/kits/templates/message-fragments/item-private.md +4 -0
- package/kits/templates/message-fragments/thread-context.md +1 -1
- package/kits/templates/system-fragments/commands.md +5 -5
- package/kits/templates/system-fragments/managed-runtime.md +1 -1
- package/kits/templates/system-fragments/relation.md +11 -7
- package/package.json +3 -2
- package/scripts/agent-template/index.mjs +9 -4
- package/scripts/agent-template/inspect.mjs +16 -9
- package/scripts/agent-template/shared/plan.mjs +3 -33
- package/scripts/agent-template/shared/template-contract.mjs +186 -3
- package/scripts/agent-template/shared/template-package.mjs +119 -10
- package/scripts/agent-template/shared/template-runtime.mjs +49 -6
- package/scripts/agent-template/shared/template.mjs +5 -5
- package/scripts/agent-template/team-pack.mjs +245 -0
- package/scripts/agent-template/team-preview.mjs +111 -0
- package/scripts/aid-batch/identity-batch.mjs +143 -0
- package/dist/ability/versions.js +0 -32
- package/dist/aun/model-headers.js +0 -17
- package/dist/channels/builtin-plugins.js +0 -19
- package/dist/core/command/team-workspace-initializer.js +0 -2
- package/dist/core/command/team-workspace-job-store.js +0 -88
- package/dist/core/command/team-workspace-management-service.js +0 -2
- package/dist/core/contact-bind-registry.js +0 -27
- package/dist/event-center/ledger.js +0 -52
- package/dist/services/reply.js +0 -55
- package/kits/templates/message-fragments/item.md +0 -3
- package/scripts/agent-template/pack.mjs +0 -169
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { SYSTEM_SESSION_TYPES } from '../core/system-session/types.js';
|
|
2
|
+
import { isValidAid } from '../aun/aid/validation.js';
|
|
2
3
|
const BEHAVIOR_TOP_FIELDS = new Set([
|
|
3
4
|
'active_baseagent',
|
|
4
5
|
'chatmode',
|
|
@@ -13,6 +14,7 @@ const BEHAVIOR_TOP_FIELDS = new Set([
|
|
|
13
14
|
'session_renew',
|
|
14
15
|
'groupRules',
|
|
15
16
|
'group_venue_sync',
|
|
17
|
+
'team',
|
|
16
18
|
'render',
|
|
17
19
|
'sessionManifests',
|
|
18
20
|
'enable_rich_content',
|
|
@@ -148,6 +150,12 @@ export function resolveConfigFieldRule(fieldPath, scope) {
|
|
|
148
150
|
return scalar(field, 'boolean', 'owner-only');
|
|
149
151
|
if (field === 'bootstrapWelcome')
|
|
150
152
|
return scalar(field, 'boolean', 'owner-only');
|
|
153
|
+
// 团队成员名单:Evol App 的 Team Workspace 菜单也能改,CLI 只是同一份配置的
|
|
154
|
+
// 另一个入口。**不设 owner-only**:agent 之间自主协作时由 agent 自己组队,
|
|
155
|
+
// 加人要先过 Owner 审批就没法自动协作。成员资格的业务校验(在名录里、未拉黑、
|
|
156
|
+
// 有 owner 归属、不超 50 人)在写入点做,不靠字段权限。
|
|
157
|
+
if (field === 'team')
|
|
158
|
+
return scalar('team', 'aid-list');
|
|
151
159
|
if (field === 'ability')
|
|
152
160
|
return readonlyObject('ability');
|
|
153
161
|
if (field === 'ability.codeApproval.enabled')
|
|
@@ -351,5 +359,21 @@ export function parseConfigFieldValue(fieldPath, rawValue) {
|
|
|
351
359
|
return raw === 'load' || raw === 'ignore'
|
|
352
360
|
? { ok: true, value: raw }
|
|
353
361
|
: { ok: false, reason: `Config field ${fieldPath} must be load or ignore` };
|
|
362
|
+
case 'aid-list': {
|
|
363
|
+
// 空串是合法的"清空";非空时逐个校验。这里只管格式与去重,
|
|
364
|
+
// 业务规则(在不在名录、是不是自己、有没有 owner)在写入点按各自语义再做。
|
|
365
|
+
if (!raw)
|
|
366
|
+
return { ok: true, value: [] };
|
|
367
|
+
const items = raw.split(',').map(item => item.trim()).filter(Boolean);
|
|
368
|
+
if (items.length === 0)
|
|
369
|
+
return { ok: true, value: [] };
|
|
370
|
+
const invalid = items.find(aid => !isValidAid(aid));
|
|
371
|
+
if (invalid)
|
|
372
|
+
return { ok: false, reason: `Config field ${fieldPath} contains an invalid AID: ${invalid}` };
|
|
373
|
+
if (new Set(items).size !== items.length) {
|
|
374
|
+
return { ok: false, reason: `Config field ${fieldPath} contains duplicate AIDs` };
|
|
375
|
+
}
|
|
376
|
+
return { ok: true, value: items };
|
|
377
|
+
}
|
|
354
378
|
}
|
|
355
379
|
}
|
|
@@ -32,10 +32,12 @@ import { normalizeRoleEffortCompat, normalizeRoleGroupChatmodeCompat } from './r
|
|
|
32
32
|
import { mutatePeerBookTransactionSync, resolvePeerAidKind } from './peer-book-store.js';
|
|
33
33
|
import { DAEMON_SCHEMA_NAME } from '../product.js';
|
|
34
34
|
import { normalizeDaemonServices } from './daemon-services.js';
|
|
35
|
-
import { assertProviderSelectionWrite,
|
|
35
|
+
import { assertProviderSelectionWrite, resolveProviderModelSettings, validateProvidersFile } from './providers-config.js';
|
|
36
|
+
import { resolveProviderSelectionModel } from '../core/model/model-catalog.js';
|
|
36
37
|
import { assertOwnerConfigRecord, configuredOwnerList, normalizeOwnerConfigTree, withOwnerListCompatibility } from './owner-config.js';
|
|
37
38
|
import { getOwners, getPrimaryOwner, ownerResolver } from '../core/ownership/owner-resolver.js';
|
|
38
39
|
import { resolveBaseagentModelSelection } from '../agents/baseagent.js';
|
|
40
|
+
import { assertProjectPathReference } from '../utils/project-path.js';
|
|
39
41
|
// AUN gateway discovery belongs to fastaun. Keep the retired gatewayUrl
|
|
40
42
|
// compatibility handling beside the rest of the configuration read/write
|
|
41
43
|
// policy so all config callers share one implementation.
|
|
@@ -984,7 +986,7 @@ export function write(target, value, sel, opts = {}) {
|
|
|
984
986
|
: target === ConfigTarget.Agent ? read(ConfigTarget.Defaults, undefined, { cache: false }) ?? {}
|
|
985
987
|
: resolveAgentConfig({ self: sel?.self }, { cache: false });
|
|
986
988
|
try {
|
|
987
|
-
assertProviderSelectionWrite(normalized, previous, inherited, (providerId, serviceType, baseagent) =>
|
|
989
|
+
assertProviderSelectionWrite(normalized, previous, inherited, (providerId, serviceType, baseagent) => resolveProviderModelSettings(providerId, serviceType, read(ConfigTarget.Providers) ?? { providers: {} }, baseagent), (providerId, serviceType, baseagent, model) => resolveProviderSelectionModel(providerId, serviceType, baseagent, model));
|
|
988
990
|
}
|
|
989
991
|
catch (error) {
|
|
990
992
|
throw new ConfigError('VALIDATION_ERROR', error instanceof Error ? error.message : String(error));
|
|
@@ -1256,6 +1258,7 @@ function validateOrThrow(schema, value, target) {
|
|
|
1256
1258
|
...validateProcessOnlyFields(target, value),
|
|
1257
1259
|
...validateProcessAidDomain(target, value),
|
|
1258
1260
|
...validateProcessServiceNames(target, value),
|
|
1261
|
+
...validateDefaultProjectReference(target, value),
|
|
1259
1262
|
];
|
|
1260
1263
|
if (!ok || scopeErrors.length > 0) {
|
|
1261
1264
|
const errs = [
|
|
@@ -1270,6 +1273,20 @@ function validateOrThrow(schema, value, target) {
|
|
|
1270
1273
|
throw new ConfigError('SCHEMA_INVALID', `${target} 配置不合 schema(${schema.logicalName}.v${schema.version}): ${errs}`);
|
|
1271
1274
|
}
|
|
1272
1275
|
}
|
|
1276
|
+
function validateDefaultProjectReference(target, value) {
|
|
1277
|
+
if (target !== ConfigTarget.Defaults)
|
|
1278
|
+
return [];
|
|
1279
|
+
const configured = value?.projects?.defaultPath;
|
|
1280
|
+
if (typeof configured !== 'string')
|
|
1281
|
+
return [];
|
|
1282
|
+
try {
|
|
1283
|
+
assertProjectPathReference(configured);
|
|
1284
|
+
return [];
|
|
1285
|
+
}
|
|
1286
|
+
catch (error) {
|
|
1287
|
+
return [error.message];
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1273
1290
|
function validateProcessOnlyFields(target, value) {
|
|
1274
1291
|
if (target === ConfigTarget.Process || !value || typeof value !== 'object')
|
|
1275
1292
|
return [];
|
|
@@ -1380,6 +1397,7 @@ export function validateConfig(target, value) {
|
|
|
1380
1397
|
...validateProcessOnlyFields(target, normalized),
|
|
1381
1398
|
...validateProcessAidDomain(target, normalized),
|
|
1382
1399
|
...validateProcessServiceNames(target, normalized),
|
|
1400
|
+
...validateDefaultProjectReference(target, normalized),
|
|
1383
1401
|
];
|
|
1384
1402
|
if (target === ConfigTarget.Agent) {
|
|
1385
1403
|
try {
|
|
@@ -13,6 +13,7 @@ import { ownerResolver } from '../core/ownership/owner-resolver.js';
|
|
|
13
13
|
import { parseContactAlias } from './peer-alias.js';
|
|
14
14
|
import { clearRoleStoreCache } from './role-store.js';
|
|
15
15
|
import { currentVersion } from './schema-registry.js';
|
|
16
|
+
import { setTimeout as waitForLock } from 'node:timers/promises';
|
|
16
17
|
const LOCK_NAME = '.contact-book-mutation.lock';
|
|
17
18
|
const JOURNAL_NAME = '.contact-book-mutation.json';
|
|
18
19
|
const LOCK_WAIT_MS = 5_000;
|
|
@@ -53,7 +54,7 @@ export function mutatePeerBookPrepared(selfAid, prepare) {
|
|
|
53
54
|
mutationTails.set(normalizedAid, tail);
|
|
54
55
|
return previous
|
|
55
56
|
.catch(() => { })
|
|
56
|
-
.then(() =>
|
|
57
|
+
.then(() => withAgentLock(normalizedAid, () => mutateContactBookPreparedLocked(normalizedAid, prepare)))
|
|
57
58
|
.finally(() => {
|
|
58
59
|
release();
|
|
59
60
|
if (mutationTails.get(normalizedAid) === tail)
|
|
@@ -75,7 +76,7 @@ function enqueueContactMutation(request, changes) {
|
|
|
75
76
|
mutationTails.set(selfAid, tail);
|
|
76
77
|
return previous
|
|
77
78
|
.catch(() => { })
|
|
78
|
-
.then(() =>
|
|
79
|
+
.then(() => withAgentLock(selfAid, () => mutateContactBookLocked({ ...request, selfAid }, changes)))
|
|
79
80
|
.finally(() => {
|
|
80
81
|
release();
|
|
81
82
|
if (mutationTails.get(selfAid) === tail)
|
|
@@ -204,138 +205,138 @@ function mutateContactBookSyncInternal(request, transactionChanges) {
|
|
|
204
205
|
const selfAid = normalizeAid(request.selfAid, 'self AID');
|
|
205
206
|
const release = acquireAgentLock(selfAid);
|
|
206
207
|
try {
|
|
207
|
-
|
|
208
|
-
const file = agentPeerConfig(selfAid);
|
|
209
|
-
const current = readContactBookFromDisk(selfAid);
|
|
210
|
-
const previousRevision = peerRevision(current);
|
|
211
|
-
if (request.expectedContactRevision !== undefined
|
|
212
|
-
&& request.expectedContactRevision !== previousRevision) {
|
|
213
|
-
throw new PeerMutationError('CONFLICT', 'Contact book changed since it was read', {
|
|
214
|
-
expectedContactRevision: request.expectedContactRevision,
|
|
215
|
-
peerRevision: previousRevision,
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
validateTransactionChanges(selfAid, transactionChanges);
|
|
219
|
-
const next = cloneBook(current);
|
|
220
|
-
applyMutation(next, request.mutation, selfAid, transactionChanges);
|
|
221
|
-
synchronizeManagementRoles(next, selfAid, transactionChanges);
|
|
222
|
-
if (request.mutation.type === 'replace') {
|
|
223
|
-
const errors = validateConfig(ConfigTarget.Peer, next);
|
|
224
|
-
if (errors.length)
|
|
225
|
-
throw new PeerMutationError('INVALID_CONTACT_BOOK', errors.join('; '));
|
|
226
|
-
}
|
|
227
|
-
else {
|
|
228
|
-
validateContactBook(next, selfAid, transactionChanges);
|
|
229
|
-
}
|
|
230
|
-
const omitEmptySync = request.mutation.type === 'sync-management-roles'
|
|
231
|
-
&& current === null
|
|
232
|
-
&& Object.keys(next.contacts).length === 0;
|
|
233
|
-
const nextRevision = omitEmptySync ? previousRevision : peerRevision(next);
|
|
234
|
-
if (nextRevision === previousRevision && transactionChanges.length === 0) {
|
|
235
|
-
return { changed: false, peerRevision: previousRevision, previousContactRevision: previousRevision, contact: next };
|
|
236
|
-
}
|
|
237
|
-
const before = readTextOrNull(file);
|
|
238
|
-
const after = `${JSON.stringify(next, null, 2)}\n`;
|
|
239
|
-
const changes = [
|
|
240
|
-
...(nextRevision === previousRevision ? [] : [{ file, before, after }]),
|
|
241
|
-
...transactionChanges,
|
|
242
|
-
];
|
|
243
|
-
writeJournal(selfAid, { schemaVersion: 1, state: 'prepared', selfAid, changes });
|
|
244
|
-
try {
|
|
245
|
-
for (const change of changes)
|
|
246
|
-
applyTransactionChange(change);
|
|
247
|
-
writeJournal(selfAid, { schemaVersion: 1, state: 'committed', selfAid, changes });
|
|
248
|
-
removeJournal(selfAid);
|
|
249
|
-
}
|
|
250
|
-
catch (error) {
|
|
251
|
-
recoverMutation(selfAid);
|
|
252
|
-
throw error;
|
|
253
|
-
}
|
|
254
|
-
if (nextRevision !== previousRevision) {
|
|
255
|
-
notifyConfigWrite(ConfigTarget.Peer, { self: selfAid });
|
|
256
|
-
appendAudit(selfAid, request, previousRevision, nextRevision);
|
|
257
|
-
}
|
|
258
|
-
for (const change of transactionChanges)
|
|
259
|
-
fileCache.invalidate(change.file);
|
|
260
|
-
if (transactionChanges.length)
|
|
261
|
-
clearRoleStoreCache(selfAid);
|
|
262
|
-
return {
|
|
263
|
-
changed: nextRevision !== previousRevision,
|
|
264
|
-
peerRevision: nextRevision,
|
|
265
|
-
previousContactRevision: previousRevision,
|
|
266
|
-
contact: next,
|
|
267
|
-
};
|
|
208
|
+
return mutateContactBookLocked({ ...request, selfAid }, transactionChanges);
|
|
268
209
|
}
|
|
269
210
|
finally {
|
|
270
211
|
release();
|
|
271
212
|
}
|
|
272
213
|
}
|
|
273
|
-
|
|
274
|
-
|
|
214
|
+
/** The caller owns the contact lock; the entire critical section is synchronous. */
|
|
215
|
+
function mutateContactBookLocked(request, transactionChanges) {
|
|
216
|
+
const selfAid = request.selfAid;
|
|
217
|
+
recoverMutation(selfAid);
|
|
218
|
+
const file = agentPeerConfig(selfAid);
|
|
219
|
+
const current = readContactBookFromDisk(selfAid);
|
|
220
|
+
const previousRevision = peerRevision(current);
|
|
221
|
+
if (request.expectedContactRevision !== undefined
|
|
222
|
+
&& request.expectedContactRevision !== previousRevision) {
|
|
223
|
+
throw new PeerMutationError('CONFLICT', 'Contact book changed since it was read', {
|
|
224
|
+
expectedContactRevision: request.expectedContactRevision,
|
|
225
|
+
peerRevision: previousRevision,
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
validateTransactionChanges(selfAid, transactionChanges);
|
|
229
|
+
const next = cloneBook(current);
|
|
230
|
+
applyMutation(next, request.mutation, selfAid, transactionChanges);
|
|
231
|
+
synchronizeManagementRoles(next, selfAid, transactionChanges);
|
|
232
|
+
if (request.mutation.type === 'replace') {
|
|
233
|
+
const errors = validateConfig(ConfigTarget.Peer, next);
|
|
234
|
+
if (errors.length)
|
|
235
|
+
throw new PeerMutationError('INVALID_CONTACT_BOOK', errors.join('; '));
|
|
236
|
+
}
|
|
237
|
+
else {
|
|
238
|
+
validateContactBook(next, selfAid, transactionChanges);
|
|
239
|
+
}
|
|
240
|
+
const omitEmptySync = request.mutation.type === 'sync-management-roles'
|
|
241
|
+
&& current === null
|
|
242
|
+
&& Object.keys(next.contacts).length === 0;
|
|
243
|
+
const nextRevision = omitEmptySync ? previousRevision : peerRevision(next);
|
|
244
|
+
if (nextRevision === previousRevision && transactionChanges.length === 0) {
|
|
245
|
+
return { changed: false, peerRevision: previousRevision, previousContactRevision: previousRevision, contact: next };
|
|
246
|
+
}
|
|
247
|
+
const before = readTextOrNull(file);
|
|
248
|
+
const after = `${JSON.stringify(next, null, 2)}\n`;
|
|
249
|
+
const changes = [
|
|
250
|
+
...(nextRevision === previousRevision ? [] : [{ file, before, after }]),
|
|
251
|
+
...transactionChanges,
|
|
252
|
+
];
|
|
253
|
+
writeJournal(selfAid, { schemaVersion: 1, state: 'prepared', selfAid, changes });
|
|
275
254
|
try {
|
|
255
|
+
for (const change of changes)
|
|
256
|
+
applyTransactionChange(change);
|
|
257
|
+
writeJournal(selfAid, { schemaVersion: 1, state: 'committed', selfAid, changes });
|
|
258
|
+
removeJournal(selfAid);
|
|
259
|
+
}
|
|
260
|
+
catch (error) {
|
|
276
261
|
recoverMutation(selfAid);
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
const next = cloneBook(current);
|
|
281
|
-
const prepared = prepare({ contact: next, peerRevision: previousRevision });
|
|
282
|
-
if (prepared.mutation)
|
|
283
|
-
applyMutation(next, prepared.mutation, selfAid);
|
|
284
|
-
synchronizeManagementRoles(next, selfAid, []);
|
|
285
|
-
validateContactBook(next, selfAid);
|
|
286
|
-
const nextRevision = peerRevision(next);
|
|
287
|
-
if (nextRevision === previousRevision) {
|
|
288
|
-
return {
|
|
289
|
-
changed: false,
|
|
290
|
-
peerRevision: previousRevision,
|
|
291
|
-
previousContactRevision: previousRevision,
|
|
292
|
-
contact: next,
|
|
293
|
-
value: prepared.value,
|
|
294
|
-
};
|
|
295
|
-
}
|
|
296
|
-
const preparedChanges = prepared.beforeCommit?.({
|
|
297
|
-
contact: next,
|
|
298
|
-
previousContactRevision: previousRevision,
|
|
299
|
-
peerRevision: nextRevision,
|
|
300
|
-
});
|
|
301
|
-
const before = readTextOrNull(file);
|
|
302
|
-
const after = `${JSON.stringify(next, null, 2)}\n`;
|
|
303
|
-
const additionalChanges = preparedChanges === undefined
|
|
304
|
-
? []
|
|
305
|
-
: Array.isArray(preparedChanges) ? preparedChanges : [preparedChanges];
|
|
306
|
-
const changes = [
|
|
307
|
-
{ file, before, after },
|
|
308
|
-
...additionalChanges,
|
|
309
|
-
];
|
|
310
|
-
validateTransactionChanges(selfAid, changes);
|
|
311
|
-
writeJournal(selfAid, { schemaVersion: 1, state: 'prepared', selfAid, changes });
|
|
312
|
-
try {
|
|
313
|
-
for (const change of changes)
|
|
314
|
-
applyTransactionChange(change);
|
|
315
|
-
writeJournal(selfAid, { schemaVersion: 1, state: 'committed', selfAid, changes });
|
|
316
|
-
removeJournal(selfAid);
|
|
317
|
-
}
|
|
318
|
-
catch (error) {
|
|
319
|
-
recoverMutation(selfAid);
|
|
320
|
-
throw error;
|
|
321
|
-
}
|
|
262
|
+
throw error;
|
|
263
|
+
}
|
|
264
|
+
if (nextRevision !== previousRevision) {
|
|
322
265
|
notifyConfigWrite(ConfigTarget.Peer, { self: selfAid });
|
|
323
|
-
appendAudit(selfAid,
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
266
|
+
appendAudit(selfAid, request, previousRevision, nextRevision);
|
|
267
|
+
}
|
|
268
|
+
for (const change of transactionChanges)
|
|
269
|
+
fileCache.invalidate(change.file);
|
|
270
|
+
if (transactionChanges.length)
|
|
271
|
+
clearRoleStoreCache(selfAid);
|
|
272
|
+
return {
|
|
273
|
+
changed: nextRevision !== previousRevision,
|
|
274
|
+
peerRevision: nextRevision,
|
|
275
|
+
previousContactRevision: previousRevision,
|
|
276
|
+
contact: next,
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
/** The caller owns the contact lock; prepare and commit must not yield. */
|
|
280
|
+
function mutateContactBookPreparedLocked(selfAid, prepare) {
|
|
281
|
+
recoverMutation(selfAid);
|
|
282
|
+
const file = agentPeerConfig(selfAid);
|
|
283
|
+
const current = readContactBookFromDisk(selfAid);
|
|
284
|
+
const previousRevision = peerRevision(current);
|
|
285
|
+
const next = cloneBook(current);
|
|
286
|
+
const prepared = prepare({ contact: next, peerRevision: previousRevision });
|
|
287
|
+
if (prepared.mutation)
|
|
288
|
+
applyMutation(next, prepared.mutation, selfAid);
|
|
289
|
+
synchronizeManagementRoles(next, selfAid, []);
|
|
290
|
+
validateContactBook(next, selfAid);
|
|
291
|
+
const nextRevision = peerRevision(next);
|
|
292
|
+
if (nextRevision === previousRevision) {
|
|
328
293
|
return {
|
|
329
|
-
changed:
|
|
330
|
-
peerRevision:
|
|
294
|
+
changed: false,
|
|
295
|
+
peerRevision: previousRevision,
|
|
331
296
|
previousContactRevision: previousRevision,
|
|
332
297
|
contact: next,
|
|
333
298
|
value: prepared.value,
|
|
334
299
|
};
|
|
335
300
|
}
|
|
336
|
-
|
|
337
|
-
|
|
301
|
+
const preparedChanges = prepared.beforeCommit?.({
|
|
302
|
+
contact: next,
|
|
303
|
+
previousContactRevision: previousRevision,
|
|
304
|
+
peerRevision: nextRevision,
|
|
305
|
+
});
|
|
306
|
+
const before = readTextOrNull(file);
|
|
307
|
+
const after = `${JSON.stringify(next, null, 2)}\n`;
|
|
308
|
+
const additionalChanges = preparedChanges === undefined
|
|
309
|
+
? []
|
|
310
|
+
: Array.isArray(preparedChanges) ? preparedChanges : [preparedChanges];
|
|
311
|
+
const changes = [
|
|
312
|
+
{ file, before, after },
|
|
313
|
+
...additionalChanges,
|
|
314
|
+
];
|
|
315
|
+
validateTransactionChanges(selfAid, changes);
|
|
316
|
+
writeJournal(selfAid, { schemaVersion: 1, state: 'prepared', selfAid, changes });
|
|
317
|
+
try {
|
|
318
|
+
for (const change of changes)
|
|
319
|
+
applyTransactionChange(change);
|
|
320
|
+
writeJournal(selfAid, { schemaVersion: 1, state: 'committed', selfAid, changes });
|
|
321
|
+
removeJournal(selfAid);
|
|
322
|
+
}
|
|
323
|
+
catch (error) {
|
|
324
|
+
recoverMutation(selfAid);
|
|
325
|
+
throw error;
|
|
338
326
|
}
|
|
327
|
+
notifyConfigWrite(ConfigTarget.Peer, { self: selfAid });
|
|
328
|
+
appendAudit(selfAid, {
|
|
329
|
+
selfAid,
|
|
330
|
+
actor: prepared.actor,
|
|
331
|
+
mutation: prepared.mutation,
|
|
332
|
+
}, previousRevision, nextRevision);
|
|
333
|
+
return {
|
|
334
|
+
changed: true,
|
|
335
|
+
peerRevision: nextRevision,
|
|
336
|
+
previousContactRevision: previousRevision,
|
|
337
|
+
contact: next,
|
|
338
|
+
value: prepared.value,
|
|
339
|
+
};
|
|
339
340
|
}
|
|
340
341
|
function applyMutation(book, mutation, selfAid, changes = []) {
|
|
341
342
|
if (mutation.type === 'replace') {
|
|
@@ -570,6 +571,37 @@ function readTransactionJson(file, changes) {
|
|
|
570
571
|
}
|
|
571
572
|
}
|
|
572
573
|
function acquireAgentLock(selfAid) {
|
|
574
|
+
const attempts = agentLockAttempts(selfAid);
|
|
575
|
+
for (;;) {
|
|
576
|
+
const attempt = attempts.next();
|
|
577
|
+
if (attempt.done)
|
|
578
|
+
return attempt.value;
|
|
579
|
+
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, attempt.value);
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
/** Wait asynchronously only while contended, then commit and release in the same turn. */
|
|
583
|
+
async function withAgentLock(selfAid, run) {
|
|
584
|
+
const attempts = agentLockAttempts(selfAid);
|
|
585
|
+
try {
|
|
586
|
+
for (;;) {
|
|
587
|
+
const attempt = attempts.next();
|
|
588
|
+
if (attempt.done) {
|
|
589
|
+
try {
|
|
590
|
+
return run();
|
|
591
|
+
}
|
|
592
|
+
finally {
|
|
593
|
+
attempt.value();
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
await waitForLock(attempt.value);
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
finally {
|
|
600
|
+
attempts.return(() => { });
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
/** Both entry points share publication, ownership, stale recovery and timeout rules. */
|
|
604
|
+
function* agentLockAttempts(selfAid) {
|
|
573
605
|
const legacyLockDir = path.join(agentDir(selfAid), LOCK_NAME);
|
|
574
606
|
const lockDir = resolveManagedLockPath('contact', selfAid, legacyLockDir);
|
|
575
607
|
const ownerFile = path.join(lockDir, 'owner.json');
|
|
@@ -611,7 +643,7 @@ function acquireAgentLock(selfAid) {
|
|
|
611
643
|
throw error;
|
|
612
644
|
throw new PeerMutationError('LOCK_TIMEOUT', `Timed out waiting for contact mutation lock: ${lockDir}`);
|
|
613
645
|
}
|
|
614
|
-
|
|
646
|
+
yield LOCK_RETRY_MS;
|
|
615
647
|
}
|
|
616
648
|
}
|
|
617
649
|
}
|
|
@@ -15,6 +15,7 @@ import { isValidAid } from '../aun/aid/validation.js';
|
|
|
15
15
|
import { getOwners, ownerResolver } from '../core/ownership/owner-resolver.js';
|
|
16
16
|
import { sameOwnerQualification, sameOwnerRevision, requiresSameOwnerProof } from '../core/relation/same-owner-proof.js';
|
|
17
17
|
import { readRoleStore } from './role-store.js';
|
|
18
|
+
import { isOwnerDirectoryContact } from '../directory/owner-directory-admission.js';
|
|
18
19
|
export function isAuthenticated(userId) {
|
|
19
20
|
return isValidAid(String(userId || '').trim());
|
|
20
21
|
}
|
|
@@ -146,14 +147,33 @@ export function resolvePeerRoleDetail(ctx) {
|
|
|
146
147
|
const winner = selectHighestRank(candidates, ctx.selfAid);
|
|
147
148
|
if (winner)
|
|
148
149
|
return resultFor(winner.role, winner.source, actor, ctx.selfAid);
|
|
149
|
-
//
|
|
150
|
-
//
|
|
151
|
-
|
|
152
|
-
const fallbackRole = ctx.chatType === 'group' ? 'member' : 'visitor';
|
|
150
|
+
// 没有显式 group/actor/default 指派时一律降级 visitor(只读):
|
|
151
|
+
// `member` 是联系人权限,不是缺省值。不在联系人里就是 visitor。
|
|
152
|
+
const fallbackRole = 'visitor';
|
|
153
153
|
return roleRegistryExists(ctx.selfAid) && roleExists(fallbackRole, ctx.selfAid)
|
|
154
154
|
? resultFor(fallbackRole, 'builtin-fallback', actor, ctx.selfAid)
|
|
155
155
|
: resultFor(null, 'none', actor, ctx.selfAid);
|
|
156
156
|
}
|
|
157
|
+
/** 发送方与当前 Agent 的关系角色;群成员角色不替代直接关系。 */
|
|
158
|
+
export function resolveSenderRelationRole(input) {
|
|
159
|
+
try {
|
|
160
|
+
const detail = resolvePeerRoleDetail({
|
|
161
|
+
selfAid: input.selfAid,
|
|
162
|
+
channelKey: input.channelKey,
|
|
163
|
+
channelType: input.channelType,
|
|
164
|
+
chatType: input.chatType,
|
|
165
|
+
actorId: input.senderAid,
|
|
166
|
+
conversationId: input.conversationId ?? '',
|
|
167
|
+
});
|
|
168
|
+
if (detail && (detail.source === 'relation-actor' || detail.source === 'agent-owner'
|
|
169
|
+
|| detail.source === 'internal-contact-default'))
|
|
170
|
+
return detail.effectiveRole ?? 'visitor';
|
|
171
|
+
return isOwnerDirectoryContact(input.selfAid, input.senderAid) ? 'member' : 'visitor';
|
|
172
|
+
}
|
|
173
|
+
catch {
|
|
174
|
+
return 'visitor';
|
|
175
|
+
}
|
|
176
|
+
}
|
|
157
177
|
export function createSessionIdentityResolver(agentRegistry) {
|
|
158
178
|
return (channel, userId, chatType, conversationId) => {
|
|
159
179
|
const parsed = tryParseChannelKey(channel);
|
|
@@ -62,7 +62,7 @@ export function planProviderIdentityMigration(home, registry, options = {}) {
|
|
|
62
62
|
: isDeepStrictEqual(existing.path, service.path);
|
|
63
63
|
if (!sameEndpoint)
|
|
64
64
|
conflicts.push(`services.${serviceType}.path`);
|
|
65
|
-
for (const field of ['style', 'models']) {
|
|
65
|
+
for (const field of ['style', 'models', 'modelPolicy']) {
|
|
66
66
|
if (!isDeepStrictEqual(existing[field], service[field]))
|
|
67
67
|
conflicts.push(`services.${serviceType}.${field}`);
|
|
68
68
|
}
|
|
@@ -3,14 +3,20 @@ import { isIP } from 'node:net';
|
|
|
3
3
|
import { domainToASCII } from 'node:url';
|
|
4
4
|
import { registrableProviderDomain } from '../utils/public-suffix.js';
|
|
5
5
|
export function normalizeProviderDomain(value) {
|
|
6
|
-
|
|
6
|
+
const hostname = typeof value === 'string' ? value.trim() : '';
|
|
7
|
+
const ipv6 = hostname.startsWith('[') && hostname.endsWith(']') ? hostname.slice(1, -1) : hostname;
|
|
8
|
+
if (!ipv6.includes('%') && isIP(ipv6) === 6)
|
|
9
|
+
return new URL(`http://[${ipv6}]`).hostname;
|
|
10
|
+
if (!hostname || /[\s/\\:@?#%]/u.test(hostname)) {
|
|
7
11
|
throw Object.assign(new Error('Provider domain must be a hostname without a scheme, port or path'), { code: 'PROVIDER_DOMAIN_INVALID' });
|
|
8
12
|
}
|
|
9
|
-
const domain = domainToASCII(
|
|
13
|
+
const domain = domainToASCII(hostname.replace(/\.$/u, '')).toLowerCase();
|
|
14
|
+
if (domain === 'localhost' || isIP(domain) === 4)
|
|
15
|
+
return domain;
|
|
10
16
|
const labels = domain.split('.');
|
|
11
|
-
if (domain.length > 253 || labels.length < 2
|
|
17
|
+
if (domain.length > 253 || labels.length < 2
|
|
12
18
|
|| labels.some(label => label.length > 63 || !/^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/u.test(label))) {
|
|
13
|
-
throw Object.assign(new Error('Provider domain must be a valid DNS hostname'), { code: 'PROVIDER_DOMAIN_INVALID' });
|
|
19
|
+
throw Object.assign(new Error('Provider domain must be a valid DNS hostname, IP address or localhost'), { code: 'PROVIDER_DOMAIN_INVALID' });
|
|
14
20
|
}
|
|
15
21
|
const registrable = registrableProviderDomain(domain);
|
|
16
22
|
if (!registrable)
|
|
@@ -4,6 +4,7 @@ import { TextDecoder } from 'node:util';
|
|
|
4
4
|
import { auditCommandAuthorization } from '../core/auth/authorization-audit.js';
|
|
5
5
|
import { createProvider, parseProviderImport, readProvidersSnapshot, updateProvider } from './providers-management.js';
|
|
6
6
|
import { resolveProviderId } from './providers-config.js';
|
|
7
|
+
import { normalizeProviderDomain } from './provider-identity.js';
|
|
7
8
|
export const PROVIDER_INPUT_LIMIT = 1024 * 1024;
|
|
8
9
|
export function providerArgumentError(message) {
|
|
9
10
|
throw Object.assign(new Error(message), { code: 'INVALID_ARGUMENT' });
|
|
@@ -73,11 +74,18 @@ export function providerFailure(error) {
|
|
|
73
74
|
return { ok: false, code: 'NOT_FOUND', error: 'Provider not found' };
|
|
74
75
|
if (failure?.code === 'PROVIDER_CONFLICT' && failure.data && typeof failure.data === 'object') {
|
|
75
76
|
const details = failure.data;
|
|
77
|
+
let domain;
|
|
78
|
+
try {
|
|
79
|
+
domain = normalizeProviderDomain(details.domain);
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
domain = undefined;
|
|
83
|
+
}
|
|
76
84
|
if (details.kind === 'provider_migration_conflict'
|
|
77
85
|
&& Array.isArray(details.providerIds) && details.providerIds.length >= 2 && details.providerIds.length <= 100
|
|
78
86
|
&& details.providerIds.every(value => typeof value === 'string' && /^[A-Za-z0-9_-]{1,128}$/u.test(value))
|
|
79
87
|
&& typeof details.domain === 'string' && details.domain.length <= 253
|
|
80
|
-
&&
|
|
88
|
+
&& domain === details.domain
|
|
81
89
|
&& Array.isArray(details.fields) && details.fields.length > 0 && details.fields.length <= 100
|
|
82
90
|
&& details.fields.every(value => typeof value === 'string' && value.length <= 160
|
|
83
91
|
&& /^(?:common\.(?:baseUrl|apiKey|headers|queryParams)|services\.[A-Za-z0-9_-]+\.(?:path|style|models))$/u.test(value))) {
|
|
@@ -90,7 +98,7 @@ export function providerFailure(error) {
|
|
|
90
98
|
PROVIDER_ID_COLLISION: 'Provider ID hash collision or reserved legacy ID; no ID was reassigned',
|
|
91
99
|
PROVIDER_CONFLICT: 'Provider domain already exists; update or explicitly merge the existing Provider',
|
|
92
100
|
PROVIDER_DOMAIN_REQUIRED: 'Provider domain is required when common.baseUrl is an environment reference',
|
|
93
|
-
PROVIDER_DOMAIN_INVALID: 'Provider domain must be a valid DNS hostname without a scheme, port or path',
|
|
101
|
+
PROVIDER_DOMAIN_INVALID: 'Provider domain must be a valid DNS hostname, IP address or localhost without a scheme, port or path',
|
|
94
102
|
PROVIDER_DOMAIN_MISMATCH: 'Provider domain must match the normalized common.baseUrl hostname',
|
|
95
103
|
PROVIDER_DOMAIN_IMMUTABLE: 'Provider domain is immutable; create a different Provider',
|
|
96
104
|
PROVIDER_ENV_BASE_URL_MISSING: 'A Provider base URL environment variable is unset or empty in the daemon; no configuration was changed',
|
|
@@ -4,7 +4,7 @@ import { resolvePaths } from '../paths.js';
|
|
|
4
4
|
import { previewProviderCatalog } from '../core/model/model-catalog.js';
|
|
5
5
|
import { ConfigTarget, notifyConfigWrite, validateConfig } from './config-manager.js';
|
|
6
6
|
import { loadSchema } from './schema-registry.js';
|
|
7
|
-
import { providerEnvironmentVariable, resolveProviderId, resolveProviderServiceForBaseagent, validateProvidersFile } from './providers-config.js';
|
|
7
|
+
import { providerModelEnabled, providerEnvironmentVariable, resolveProviderId, resolveProviderServiceForBaseagent, validateProvidersFile } from './providers-config.js';
|
|
8
8
|
import { providerIdentity } from './provider-identity.js';
|
|
9
9
|
import { listBaseagentImportSources, providerFromBaseagent } from './providers-import.js';
|
|
10
10
|
import { importBaseagentProviderIntoRegistry } from './providers-management.js';
|
|
@@ -93,7 +93,7 @@ export async function syncLocalProviders() {
|
|
|
93
93
|
if (catalog.source !== 'gateway' || catalog.freshness !== 'fresh') {
|
|
94
94
|
throw Object.assign(new Error('A fresh Provider model catalog is required; no configuration was changed'), { code: 'PROVIDER_CATALOG_UNAVAILABLE' });
|
|
95
95
|
}
|
|
96
|
-
const model = selectDeepseekFlashModel(catalog.models.filter(entry =>
|
|
96
|
+
const model = selectDeepseekFlashModel(catalog.models.filter(entry => providerModelEnabled(entry.aliasFor ?? entry.id, connection.modelOverrides, connection.modelPolicy)));
|
|
97
97
|
if (!model) {
|
|
98
98
|
throw Object.assign(new Error('The preferred Provider has no enabled DeepSeek Flash model; no configuration was changed'), { code: 'PROVIDER_MODEL_NOT_FOUND' });
|
|
99
99
|
}
|