evolcore 0.0.41-test.1 → 0.0.41-test.2
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 +49 -36
- package/dist/agents/baseagent.js +68 -6
- package/dist/agents/codex-runner.js +62 -43
- package/dist/aun/aid/agentmd.js +98 -11
- package/dist/aun/aid/client.js +1 -1
- package/dist/aun/aid/control-aid.js +26 -2
- package/dist/aun/aid/identity.js +91 -0
- package/dist/aun/aid/index.js +1 -1
- package/dist/aun/aid/managed-operation.js +1 -1
- package/dist/aun/aid/ownership-operation.js +23 -22
- package/dist/aun/menu/client.js +27 -0
- package/dist/aun/msg/p2p.js +3 -8
- package/dist/aun/service-proxy.js +17 -0
- package/dist/channels/aun.js +321 -34
- package/dist/cli/agent-command.js +5 -2
- package/dist/cli/agent-create.js +991 -233
- package/dist/cli/agent.js +49 -10
- package/dist/cli/aid-bind-command.js +48 -19
- package/dist/cli/aun-commands.js +44 -16
- package/dist/cli/daemon-commands.js +1 -0
- package/dist/cli/index.js +24 -1
- package/dist/cli/init-channel.js +1 -1
- package/dist/cli/init.js +75 -1
- package/dist/cli/managed-command-guard.js +13 -1
- package/dist/cli/provider-command.js +57 -0
- package/dist/cli/restart-monitor.js +4 -2
- package/dist/cli/stats.js +10 -3
- package/dist/cli/task-context.js +19 -0
- package/dist/config/boot-log.js +3 -2
- package/dist/config/config-field-policy.js +12 -7
- package/dist/config/config-manager.js +138 -6
- package/dist/config/owner-config.js +2 -2
- package/dist/config/peer-role-resolver.js +2 -1
- package/dist/config/provider-ipc-service.js +132 -0
- package/dist/config/provider-menu-request.js +58 -0
- package/dist/config/providers-management.js +78 -5
- package/dist/config/resolved-config-op.js +8 -1
- package/dist/config/schema-migration.js +322 -8
- package/dist/config-store.js +10 -1
- package/dist/contracts/ecweb-service-protocol.js +2 -1
- package/dist/core/agent-application-service.js +60 -11
- package/dist/core/agent-create-status.js +203 -0
- package/dist/core/agent-creation-claim.js +177 -0
- package/dist/core/agent-ipc-registration.js +39 -18
- package/dist/core/agent-runtime.js +193 -23
- package/dist/core/auth/agent-delegation.js +4 -2
- package/dist/core/auth/auth-gateway.js +66 -1
- package/dist/core/auth/authorization-audit.js +41 -5
- package/dist/core/auth/delegation-authorization.js +2 -1
- package/dist/core/auth/operation-authorizer.js +28 -6
- package/dist/core/auth/operation-catalog.js +14 -1
- package/dist/core/channel-loader.js +2 -0
- package/dist/core/command/agent-control.js +257 -14
- package/dist/core/command/cli-intent-parser.js +6 -2
- package/dist/core/command/command-handler.js +64 -55
- package/dist/core/command/memory-slash.js +1 -1
- package/dist/core/command/menu-catalog.js +5 -0
- package/dist/core/command/menu-handler.js +64 -18
- package/dist/core/command/menu-protocol.js +15 -1
- package/dist/core/command/provider-menu.js +46 -0
- package/dist/core/command/slash-handler.js +2 -1
- package/dist/core/daemon-control.js +18 -13
- package/dist/core/event-catalog.js +10 -0
- package/dist/core/evolagent-registry.js +3 -1
- package/dist/core/evolagent.js +8 -6
- package/dist/core/file-integrity/store.js +11 -0
- package/dist/core/handoff/ipc-registration.js +3 -0
- package/dist/core/initialization/service.js +491 -0
- package/dist/core/ipc-registration.js +34 -22
- package/dist/core/memory/consolidation-ops-records.js +95 -0
- package/dist/core/memory/consolidation-trigger.js +19 -2
- package/dist/core/memory/consolidation.js +19 -8
- package/dist/core/memory/memory-admin.js +1 -1
- package/dist/core/memory/relation-sweep.js +11 -6
- package/dist/core/message/aun-ipc-sender.js +73 -67
- package/dist/core/message/im-renderer.js +18 -0
- package/dist/core/message/message-bridge.js +35 -3
- package/dist/core/message/response-engine.js +32 -28
- package/dist/core/model/catalog-service.js +1 -1
- package/dist/core/model/config-scope.js +5 -7
- package/dist/core/ownership/owner-resolver.js +755 -143
- package/dist/core/permission/approval-gateway.js +103 -403
- package/dist/core/permission/ec-command-parser.js +32 -4
- package/dist/core/permission/index.js +1 -0
- package/dist/core/permission/permission-result.js +78 -0
- package/dist/core/permission/tool-policy.js +7 -43
- package/dist/core/system-session/memory.js +37 -7
- package/dist/directory/owner-directory-cache.js +2 -2
- package/dist/ecweb/init-menu.js +32 -0
- package/dist/index.js +17 -5
- package/dist/ipc.js +85 -25
- package/dist/paths.js +3 -0
- package/dist/proxy/manager.js +6 -7
- package/dist/trigger/authorization.js +27 -17
- package/dist/trigger/feedback.js +2 -3
- package/dist/trigger/ipc-service.js +105 -78
- package/dist/trigger/local-files.js +2 -1
- package/dist/trigger/manager.js +5 -3
- package/dist/trigger/scheduler.js +88 -6
- package/dist/utils/atomic-write.js +28 -0
- package/dist/utils/error-utils.js +24 -0
- package/dist/utils/logger.js +68 -1
- package/dist/utils/welcome.js +1 -1
- package/kits/docs/INDEX.md +1 -0
- package/kits/docs/aun/SDK.md +4 -1
- package/kits/docs/evolcore/INDEX.md +1 -0
- package/kits/docs/evolcore/agent.md +8 -1
- package/kits/docs/evolcore/aid.md +67 -17
- package/kits/docs/evolcore/config.md +11 -1
- package/kits/docs/evolcore/group.md +1 -1
- package/kits/docs/evolcore/provider.md +50 -0
- package/kits/docs/identity/AID_PROFILE_SPEC.md +52 -17
- package/kits/rules/01-overview.md +3 -0
- package/kits/rules/04-relation.md +1 -1
- package/kits/schemas/_meta.json +2 -2
- package/kits/schemas/agent-config.schema.16.json +3 -3
- package/kits/schemas/relation-config.schema.11.json +17 -0
- package/kits/skills/.switches.json +8 -0
- package/kits/skills/ec-agent-create/SKILL.md +3 -0
- package/kits/skills/ec-identity/SKILL.md +2 -2
- package/kits/skills/ec-skill/scripts/skill.mjs +6 -0
- package/kits/skills/ec-trigger/SKILL.md +5 -13
- package/kits/skills/thread-ops/SKILL.md +5 -0
- package/kits/templates/system-fragments/venue.md +1 -1
- package/package.json +3 -3
- package/dist/core/memory/forget-log.js +0 -96
- package/dist/core/message/create-status.js +0 -96
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { createProvider, parseProviderImport, readProvidersSnapshot, updateProvider } from '../../config/providers-management.js';
|
|
2
|
+
import { parseProviderObject, providerFailure } from '../../config/provider-ipc-service.js';
|
|
3
|
+
import { validateProviderMenuRequest } from '../../config/provider-menu-request.js';
|
|
4
|
+
import { authorizeFreshOperation } from '../auth/auth-gateway.js';
|
|
5
|
+
export async function executeProviderMenu(request, subject, source) {
|
|
6
|
+
const validation = validateProviderMenuRequest(request);
|
|
7
|
+
if (validation)
|
|
8
|
+
return { error: validation.message, code: validation.code };
|
|
9
|
+
if (!subject?.fromControlChannel || !subject.isDaemonOwner || subject.processRole === 'daemon-service') {
|
|
10
|
+
return { error: 'Provider management requires a DaemonOwner control context', code: 'FORBIDDEN' };
|
|
11
|
+
}
|
|
12
|
+
if (request.type !== 'menu.query' && !subject.ecwebManagement && subject.menuEncrypted !== true) {
|
|
13
|
+
return { error: 'Provider mutations require an encrypted Control Menu request', code: 'FORBIDDEN' };
|
|
14
|
+
}
|
|
15
|
+
const args = request.args;
|
|
16
|
+
const operation = request.type === 'menu.query' ? args.view === 'detail' ? 'show' : 'list'
|
|
17
|
+
: request.type === 'menu.update' ? 'update' : request.action;
|
|
18
|
+
const decision = await authorizeFreshOperation({
|
|
19
|
+
source, subject,
|
|
20
|
+
intent: { operation: 'provider.' + operation, scope: 'process', source,
|
|
21
|
+
args: args.providerId ? { providerId: args.providerId } : {} },
|
|
22
|
+
auditMetadata: subject.auditMetadata,
|
|
23
|
+
});
|
|
24
|
+
if (!decision.allow)
|
|
25
|
+
return { error: 'Provider operation is not permitted', code: 'FORBIDDEN' };
|
|
26
|
+
try {
|
|
27
|
+
if (operation === 'list' || operation === 'show') {
|
|
28
|
+
const snapshot = readProvidersSnapshot();
|
|
29
|
+
if (operation === 'list')
|
|
30
|
+
return { data: snapshot };
|
|
31
|
+
const provider = snapshot.providers[args.providerId];
|
|
32
|
+
return provider ? { data: { providerId: args.providerId, provider, revision: snapshot.revision } }
|
|
33
|
+
: { error: 'Provider not found', code: 'NOT_FOUND' };
|
|
34
|
+
}
|
|
35
|
+
if (operation === 'create' || operation === 'import') {
|
|
36
|
+
const value = operation === 'import' ? parseProviderImport(args.text) : args.provider;
|
|
37
|
+
return { data: await createProvider({ revision: args.expectedRevision, value }) };
|
|
38
|
+
}
|
|
39
|
+
return { data: await updateProvider({ providerId: args.providerId, revision: args.expectedRevision,
|
|
40
|
+
value: operation === 'update' ? parseProviderObject(request.value) : undefined, remove: operation === 'delete' }) };
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
const failure = providerFailure(error);
|
|
44
|
+
return { error: failure.error, code: failure.code, ...(failure.data === undefined ? {} : { data: failure.data }) };
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -400,9 +400,11 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
|
|
|
400
400
|
chatType = undefined;
|
|
401
401
|
// 解析身份(按实例名)
|
|
402
402
|
const narrowedChatType = chatType === 'group' ? 'group' : chatType === 'private' ? 'private' : undefined;
|
|
403
|
+
const normalizedContent = normalizeSlashContent(content);
|
|
403
404
|
await refreshOwnershipForAuthorization(selfAID ?? this.agentRegistry?.resolveByChannel(channel)?.aid ?? this.resolveSelfAID(channel), {
|
|
404
405
|
maxAgeMs: OWNERSHIP_CACHE_MAX_AGE_MS,
|
|
405
406
|
allowTransient: true,
|
|
407
|
+
includeDaemon: /^\/(?:restart|upgrade|reload|pair|fa|fullaccess|diag)(?:\s|$)/i.test(normalizedContent),
|
|
406
408
|
});
|
|
407
409
|
const identityConversationId = narrowedChatType === 'group' ? channelId : userId;
|
|
408
410
|
const resolvedIdentity = overrideIdentity ?? this.sessionManager.resolveIdentity(channel, userId, narrowedChatType, identityConversationId);
|
|
@@ -439,7 +441,6 @@ export async function handleSlashCommand(content, channel, channelId, sendMessag
|
|
|
439
441
|
}
|
|
440
442
|
};
|
|
441
443
|
// 规范化命令(将别名转换为完整命令)
|
|
442
|
-
const normalizedContent = normalizeSlashContent(content);
|
|
443
444
|
if (normalizedContent !== content) {
|
|
444
445
|
logger.debug(`[CommandHandler] normalized: "${content}" -> "${normalizedContent}"`);
|
|
445
446
|
}
|
|
@@ -12,6 +12,7 @@ import { logger } from '../utils/logger.js';
|
|
|
12
12
|
import { resolvePaths } from '../paths.js';
|
|
13
13
|
import { ownerResolver, OWNERSHIP_AUTHORIZATION_MAX_AGE_MS, OWNERSHIP_CACHE_MAX_AGE_MS } from './ownership/owner-resolver.js';
|
|
14
14
|
import { subscribeUpgradeJob } from '../utils/upgrade-jobs.js';
|
|
15
|
+
import { ecwebInitializationService } from './initialization/service.js';
|
|
15
16
|
const controlMenuDeduper = new MenuRequestDeduper();
|
|
16
17
|
export function startDaemonControlAid({ daemonCfg, cmdHandler, bindService, diagService, getProcessOwners, ecwebSupervisor, onServiceProxyManager, }) {
|
|
17
18
|
if (!daemonCfg.aid)
|
|
@@ -45,10 +46,6 @@ export function startDaemonControlAid({ daemonCfg, cmdHandler, bindService, diag
|
|
|
45
46
|
});
|
|
46
47
|
controlChannel.onMessage(async (opts) => {
|
|
47
48
|
const text = (opts.content || '').trim();
|
|
48
|
-
await ownerResolver.refresh(daemonCfg.aid, {
|
|
49
|
-
maxAgeMs: /^\/(?:pair|diag)(?:\s|$)/i.test(text)
|
|
50
|
-
? OWNERSHIP_AUTHORIZATION_MAX_AGE_MS : OWNERSHIP_CACHE_MAX_AGE_MS,
|
|
51
|
-
});
|
|
52
49
|
let activeMenuRequest;
|
|
53
50
|
let menuCompletionLogged = false;
|
|
54
51
|
const menuFlowContext = {
|
|
@@ -97,7 +94,8 @@ export function startDaemonControlAid({ daemonCfg, cmdHandler, bindService, diag
|
|
|
97
94
|
}
|
|
98
95
|
};
|
|
99
96
|
if (bindService && parsed?.type === 'bind.request') {
|
|
100
|
-
const response = await
|
|
97
|
+
const response = await ecwebInitializationService.handleAppBindRequest(parsed, opts.peerId, opts.encrypted === true)
|
|
98
|
+
?? await bindService.handleRequest(parsed, opts.peerId);
|
|
101
99
|
if (response) {
|
|
102
100
|
await controlChannel.sendStructuredOrThrow(opts.channelId, response, controlReplyContext(opts));
|
|
103
101
|
}
|
|
@@ -110,14 +108,6 @@ export function startDaemonControlAid({ daemonCfg, cmdHandler, bindService, diag
|
|
|
110
108
|
}
|
|
111
109
|
const isRoleMenu = menuControl.isMenu
|
|
112
110
|
&& (menuControl.name === 'role' || menuControl.request.cmd === '/role');
|
|
113
|
-
const currentProcessOwners = getProcessOwners();
|
|
114
|
-
if (/^\/diag(?:\s|$)/i.test(text)) {
|
|
115
|
-
const command = text.slice(5).trim();
|
|
116
|
-
const result = await diagService.execute(command.toLowerCase() === 'stop'
|
|
117
|
-
? { action: 'stop' } : { action: 'start', problem: command }, opts.peerId);
|
|
118
|
-
await controlChannel.sendMessage(opts.channelId, result.message, controlReplyContext(opts));
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
111
|
if (menuControl.isMenu && !hasValidMenuId(menuControl)) {
|
|
122
112
|
logger.warn(`[ControlMenu] dropped malformed request without id type=${menuControl.type}`);
|
|
123
113
|
logMenuRequestCompleted(menuControl.request, undefined, menuFlowContext, {
|
|
@@ -137,6 +127,21 @@ export function startDaemonControlAid({ daemonCfg, cmdHandler, bindService, diag
|
|
|
137
127
|
const protectedMenuHeaders = opts.protectedHeaders;
|
|
138
128
|
const hasRemoteAccessToken = protectedMenuHeaders?.auth_method === 'remote-access-token'
|
|
139
129
|
|| protectedMenuHeaders?.auth_method === 'ecweb-token';
|
|
130
|
+
if (!menuControl.isMenu || !hasRemoteAccessToken) {
|
|
131
|
+
await ownerResolver.refresh(daemonCfg.aid, {
|
|
132
|
+
source: 'control.message',
|
|
133
|
+
maxAgeMs: /^\/(?:pair|diag)(?:\s|$)/i.test(text)
|
|
134
|
+
? OWNERSHIP_AUTHORIZATION_MAX_AGE_MS : OWNERSHIP_CACHE_MAX_AGE_MS,
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
const currentProcessOwners = getProcessOwners();
|
|
138
|
+
if (/^\/diag(?:\s|$)/i.test(text)) {
|
|
139
|
+
const command = text.slice(5).trim();
|
|
140
|
+
const result = await diagService.execute(command.toLowerCase() === 'stop'
|
|
141
|
+
? { action: 'stop' } : { action: 'start', problem: command }, opts.peerId);
|
|
142
|
+
await controlChannel.sendMessage(opts.channelId, result.message, controlReplyContext(opts));
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
140
145
|
if (text.toLowerCase() === '/pair' && !isProcessLevelOwner(opts.peerId, currentProcessOwners)) {
|
|
141
146
|
logger.debug(`控制 AID 收到非 owner 配对请求,忽略: from=${opts.peerId}`);
|
|
142
147
|
return;
|
|
@@ -453,6 +453,11 @@ const CATALOG = [
|
|
|
453
453
|
{ path: 'reason', type: 'string', optional: true },
|
|
454
454
|
{ path: 'decisionSource', type: 'string', optional: true },
|
|
455
455
|
{ path: 'policyCode', type: 'string', optional: true },
|
|
456
|
+
{ path: 'errorDetailCode', type: 'string', optional: true },
|
|
457
|
+
{ path: 'message', type: 'string', optional: true },
|
|
458
|
+
{ path: 'approverOperatorId', type: 'string', optional: true },
|
|
459
|
+
{ path: 'approverChannelKey', type: 'string', optional: true },
|
|
460
|
+
{ path: 'approverPrincipalId', type: 'string', optional: true },
|
|
456
461
|
],
|
|
457
462
|
},
|
|
458
463
|
{
|
|
@@ -467,6 +472,11 @@ const CATALOG = [
|
|
|
467
472
|
{ path: 'reason', type: 'string', optional: true },
|
|
468
473
|
{ path: 'decisionSource', type: 'string', optional: true },
|
|
469
474
|
{ path: 'policyCode', type: 'string', optional: true },
|
|
475
|
+
{ path: 'errorDetailCode', type: 'string', optional: true },
|
|
476
|
+
{ path: 'message', type: 'string', optional: true },
|
|
477
|
+
{ path: 'approverOperatorId', type: 'string', optional: true },
|
|
478
|
+
{ path: 'approverChannelKey', type: 'string', optional: true },
|
|
479
|
+
{ path: 'approverPrincipalId', type: 'string', optional: true },
|
|
470
480
|
],
|
|
471
481
|
},
|
|
472
482
|
{
|
|
@@ -5,7 +5,7 @@ import { logger } from '../utils/logger.js';
|
|
|
5
5
|
import { agentPersonalDir, aidLocalDir } from '../paths.js';
|
|
6
6
|
import { invalidateAgentDisplayName, resolveAgentDisplayName } from '../aun/aid/agentmd.js';
|
|
7
7
|
import { loadAllAgents, ensureAgentDirSkeleton, loadAgent, validateAgentConfig, } from '../config-store.js';
|
|
8
|
-
import { ConfigTarget, read as readConfig, resolveEffective } from '../config/config-manager.js';
|
|
8
|
+
import { ConfigTarget, assertAgentAidAvailable, read as readConfig, resolveEffective } from '../config/config-manager.js';
|
|
9
9
|
import { ensureInitialRoleRegistry } from '../config/role-service.js';
|
|
10
10
|
import { resolveAgentLifecycle } from '../config/lifecycle.js';
|
|
11
11
|
import { getOwners, getPrimaryOwner, ownerResolver } from './ownership/owner-resolver.js';
|
|
@@ -235,6 +235,7 @@ export class EvolAgentRegistry {
|
|
|
235
235
|
return [...this.skipped];
|
|
236
236
|
}
|
|
237
237
|
loadNewAgent(aid) {
|
|
238
|
+
assertAgentAidAvailable(aid);
|
|
238
239
|
if (this.agents.has(aid)) {
|
|
239
240
|
logger.info(`[EvolAgentRegistry] agent ${aid} already loaded, skipping`);
|
|
240
241
|
return this.agents.get(aid);
|
|
@@ -533,6 +534,7 @@ export class EvolAgentRegistry {
|
|
|
533
534
|
logger.info(`[Registry] Stopped agent ${aidOrName}`);
|
|
534
535
|
}
|
|
535
536
|
async startAgent(aidOrName, hooks) {
|
|
537
|
+
assertAgentAidAvailable(aidOrName);
|
|
536
538
|
const agent = this.agents.get(aidOrName);
|
|
537
539
|
if (!agent)
|
|
538
540
|
throw new Error(`Agent "${aidOrName}" not found`);
|
package/dist/core/evolagent.js
CHANGED
|
@@ -2,7 +2,7 @@ import path from 'path';
|
|
|
2
2
|
import { formatChannelKey, tryParseChannelKey } from './channel-loader.js';
|
|
3
3
|
import { agentPersonalDir } from '../paths.js';
|
|
4
4
|
import { fileCache } from './daemon-file-cache.js';
|
|
5
|
-
import { ConfigTarget, read as cfgRead, write as cfgWrite, ensureFile as cfgEnsure, resolveEffective } from '../config/config-manager.js';
|
|
5
|
+
import { ConfigTarget, assertAgentModelConfigured, read as cfgRead, write as cfgWrite, ensureFile as cfgEnsure, resolveEffective } from '../config/config-manager.js';
|
|
6
6
|
import { withLifecycleForWrite } from '../config/lifecycle.js';
|
|
7
7
|
import { isStaticAgentAdmin, isStaticAgentOwner } from '../config/peer-role-resolver.js';
|
|
8
8
|
import { getPrimaryOwner } from './ownership/owner-resolver.js';
|
|
@@ -125,7 +125,7 @@ export class EvolAgent {
|
|
|
125
125
|
}
|
|
126
126
|
// ── Role-based Access Control ─────────────────────────────────────────
|
|
127
127
|
/**
|
|
128
|
-
* Check if a user
|
|
128
|
+
* Check if a user matches the currently verified protocol Owner (private scope).
|
|
129
129
|
*/
|
|
130
130
|
isOwner(channelKey, userId) {
|
|
131
131
|
const principalId = this.managementPrincipal(channelKey, userId);
|
|
@@ -133,7 +133,7 @@ export class EvolAgent {
|
|
|
133
133
|
}
|
|
134
134
|
/**
|
|
135
135
|
* Check if a user has admin role for this agent (private scope).
|
|
136
|
-
* Owner
|
|
136
|
+
* Protocol Owner is resolved from Ownership consensus; admin comes from the direct AUN relation.
|
|
137
137
|
*/
|
|
138
138
|
isAdmin(channelKey, userId) {
|
|
139
139
|
const principalId = this.managementPrincipal(channelKey, userId);
|
|
@@ -151,8 +151,7 @@ export class EvolAgent {
|
|
|
151
151
|
: null;
|
|
152
152
|
}
|
|
153
153
|
/**
|
|
154
|
-
* Get the
|
|
155
|
-
* Returns the peerId of the first owner assignment.
|
|
154
|
+
* Get the currently verified protocol Owner (private scope).
|
|
156
155
|
*/
|
|
157
156
|
getOwner(_channelKey) {
|
|
158
157
|
return getPrimaryOwner(this.aid);
|
|
@@ -169,13 +168,16 @@ export class EvolAgent {
|
|
|
169
168
|
if (value !== undefined && !isSupportedBaseagent(value)) {
|
|
170
169
|
throw new Error(`Unsupported baseagent: ${value} (choose: claude/codex/gemini/ecagent)`);
|
|
171
170
|
}
|
|
172
|
-
|
|
171
|
+
if (value !== undefined) {
|
|
172
|
+
assertAgentModelConfigured(this.aid, value);
|
|
173
|
+
}
|
|
173
174
|
this.updateAgentConfig(b => {
|
|
174
175
|
if (value === undefined)
|
|
175
176
|
delete b.active_baseagent;
|
|
176
177
|
else
|
|
177
178
|
b.active_baseagent = value;
|
|
178
179
|
});
|
|
180
|
+
this.merged.active_baseagent = value;
|
|
179
181
|
}
|
|
180
182
|
setBaseagentModel(value, baseagentName) {
|
|
181
183
|
const ba = baseagentName || this.baseagent;
|
|
@@ -223,6 +223,17 @@ export function unregisterFile(filePath) {
|
|
|
223
223
|
if (Number(result?.changes ?? 0) > 0)
|
|
224
224
|
logger.info(`[file-integrity] unregistered path=${key}`);
|
|
225
225
|
}
|
|
226
|
+
/** 正规删除:先删文件,再摘掉台账记录和快照。 */
|
|
227
|
+
export function removeRegisteredFile(file) {
|
|
228
|
+
fs.rmSync(file, { force: true });
|
|
229
|
+
try {
|
|
230
|
+
unregisterFile(file);
|
|
231
|
+
}
|
|
232
|
+
catch (err) {
|
|
233
|
+
const detail = err instanceof Error ? err.message : String(err);
|
|
234
|
+
logger.warn(`[file-integrity] unregister-after-remove failed path=${file}: ${detail}`);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
226
237
|
/**
|
|
227
238
|
* 登记一段**尚未落盘**的内容。写盘之前调用。
|
|
228
239
|
*
|
|
@@ -71,6 +71,7 @@ export function registerHandoffIpc({ ipcServer, agentDelegationRegistry, respons
|
|
|
71
71
|
actorId: delegation.grant.actorId,
|
|
72
72
|
projectPath: session.projectPath,
|
|
73
73
|
sessionRuntimeDir: delegation.grant.sessionRuntimeDir,
|
|
74
|
+
fullAccess: hasTrustedFullAccessDelegation(delegation.grant),
|
|
74
75
|
};
|
|
75
76
|
};
|
|
76
77
|
const resolveHandoffQueryScope = async (params, operation) => {
|
|
@@ -100,6 +101,7 @@ export function registerHandoffIpc({ ipcServer, agentDelegationRegistry, respons
|
|
|
100
101
|
readFile: file => new TextDecoder('utf-8', { fatal: true }).decode(readTriggerLocalFile(file, {
|
|
101
102
|
selfAid: scope.aid, projectPath: scope.projectPath,
|
|
102
103
|
sessionRuntimeDir: scope.sessionRuntimeDir, cwd: scope.projectPath,
|
|
104
|
+
...(scope.fullAccess ? { allowProtectedPaths: true } : {}),
|
|
103
105
|
})),
|
|
104
106
|
});
|
|
105
107
|
params = { ...params, ...parsed };
|
|
@@ -127,6 +129,7 @@ export function registerHandoffIpc({ ipcServer, agentDelegationRegistry, respons
|
|
|
127
129
|
readFile: file => new TextDecoder('utf-8', { fatal: true }).decode(readTriggerLocalFile(file, {
|
|
128
130
|
selfAid: scope.aid, projectPath: scope.projectPath,
|
|
129
131
|
sessionRuntimeDir: scope.sessionRuntimeDir, cwd: scope.projectPath,
|
|
132
|
+
...(scope.fullAccess ? { allowProtectedPaths: true } : {}),
|
|
130
133
|
})),
|
|
131
134
|
});
|
|
132
135
|
if (!parsed.handoffId)
|