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
|
@@ -60,7 +60,8 @@ export function resolveManagedLocalPath(input, scope, kind) {
|
|
|
60
60
|
const root = resolveRoot();
|
|
61
61
|
const lexicalClass = classifyProtectedPath(lexical, { root, selfAid: scope.selfAid });
|
|
62
62
|
const resolvedClass = classifyProtectedPath(resolved, { root, selfAid: scope.selfAid });
|
|
63
|
-
if (
|
|
63
|
+
if (!scope.allowProtectedPaths
|
|
64
|
+
&& (isProtectedManagedInputClass(lexicalClass) || isProtectedManagedInputClass(resolvedClass))) {
|
|
64
65
|
throw new Error(messages.protectedPath);
|
|
65
66
|
}
|
|
66
67
|
return resolved;
|
package/dist/trigger/manager.js
CHANGED
|
@@ -48,7 +48,9 @@ export class TriggerDefinitionManager {
|
|
|
48
48
|
if (migrations.length > 0) {
|
|
49
49
|
definition.updatedAt = Date.now();
|
|
50
50
|
this.writeDefinition(definition);
|
|
51
|
-
|
|
51
|
+
for (const reason of migrations) {
|
|
52
|
+
this.history.recordDefinition('trigger.updated', definition, { reason });
|
|
53
|
+
}
|
|
52
54
|
}
|
|
53
55
|
return definition;
|
|
54
56
|
}
|
|
@@ -116,14 +118,14 @@ export class TriggerDefinitionManager {
|
|
|
116
118
|
});
|
|
117
119
|
return updated;
|
|
118
120
|
}
|
|
119
|
-
setEnabled(triggerId, enabled) {
|
|
121
|
+
setEnabled(triggerId, enabled, reason) {
|
|
120
122
|
const definition = this.require(triggerId);
|
|
121
123
|
if (enabled)
|
|
122
124
|
assertExplicitAunDeliveryRoutes(definition);
|
|
123
125
|
definition.enabled = enabled;
|
|
124
126
|
definition.updatedAt = Date.now();
|
|
125
127
|
this.writeDefinition(definition);
|
|
126
|
-
this.history.recordDefinition(enabled ? 'trigger.enabled' : 'trigger.disabled', definition);
|
|
128
|
+
this.history.recordDefinition(enabled ? 'trigger.enabled' : 'trigger.disabled', definition, { reason });
|
|
127
129
|
return definition;
|
|
128
130
|
}
|
|
129
131
|
cancel(triggerId) {
|
|
@@ -264,8 +264,8 @@ export class TriggerRuntimeScheduler {
|
|
|
264
264
|
this.publishTriggerDefinitionEvent('trigger:updated', definition);
|
|
265
265
|
return definition;
|
|
266
266
|
}
|
|
267
|
-
setEnabled(triggerId, enabled) {
|
|
268
|
-
const definition = this.manager.setEnabled(triggerId, enabled);
|
|
267
|
+
setEnabled(triggerId, enabled, reason) {
|
|
268
|
+
const definition = this.manager.setEnabled(triggerId, enabled, reason);
|
|
269
269
|
this.clearTimer(triggerId);
|
|
270
270
|
this.unregisterEvent(triggerId);
|
|
271
271
|
this.state.clearSchedule(triggerId);
|
|
@@ -448,6 +448,9 @@ export class TriggerRuntimeScheduler {
|
|
|
448
448
|
const executionAuthorization = await this.runtime.authorizeExecution?.(definition);
|
|
449
449
|
if (executionAuthorization && !executionAuthorization.allowed) {
|
|
450
450
|
const reason = executionAuthorization.reason || 'execution_authorization_denied';
|
|
451
|
+
const failureNotice = payload.dryRun
|
|
452
|
+
? undefined
|
|
453
|
+
: await this.disableAndNotifyAuthorizationDenied(definition, runId, firedAt, reason, payload.causation ?? createRootCausation());
|
|
451
454
|
const audit = this.buildAudit({
|
|
452
455
|
definition,
|
|
453
456
|
runId,
|
|
@@ -457,8 +460,8 @@ export class TriggerRuntimeScheduler {
|
|
|
457
460
|
source,
|
|
458
461
|
script: null,
|
|
459
462
|
reply: null,
|
|
460
|
-
feedback: null,
|
|
461
|
-
effects: [],
|
|
463
|
+
feedback: failureNotice?.feedback ?? null,
|
|
464
|
+
effects: failureNotice?.effects ?? [],
|
|
462
465
|
error: { code: 'authorization_denied', message: reason },
|
|
463
466
|
causation: payload.causation,
|
|
464
467
|
});
|
|
@@ -564,6 +567,32 @@ export class TriggerRuntimeScheduler {
|
|
|
564
567
|
if (runningRuntime)
|
|
565
568
|
runningRuntime.anomalies = anomalies;
|
|
566
569
|
}), controller.signal, RUN_ABORT_SETTLE_GRACE_MS, 'execution');
|
|
570
|
+
if (!payload.dryRun && execution.reply?.error?.reason === 'authorization_denied') {
|
|
571
|
+
const reason = execution.reply.error.text || 'Trigger execution authorization denied';
|
|
572
|
+
const failureNotice = await this.disableAndNotifyAuthorizationDenied(definition, runId, firedAt, reason, causation);
|
|
573
|
+
const audit = this.buildAudit({
|
|
574
|
+
definition,
|
|
575
|
+
runId,
|
|
576
|
+
startedAt,
|
|
577
|
+
status: 'failed',
|
|
578
|
+
reason: 'authorization_denied',
|
|
579
|
+
source,
|
|
580
|
+
processing: execution.processing,
|
|
581
|
+
script: execution.script,
|
|
582
|
+
reply: execution.reply,
|
|
583
|
+
feedback: failureNotice?.feedback ?? null,
|
|
584
|
+
effects: failureNotice?.effects ?? [],
|
|
585
|
+
error: { code: 'authorization_denied', message: reason },
|
|
586
|
+
causation,
|
|
587
|
+
});
|
|
588
|
+
this.audit.write(audit);
|
|
589
|
+
this.publishTriggerRunOutcome(definition, audit);
|
|
590
|
+
this.finishRun(definition.id, runId);
|
|
591
|
+
recordCausationSpan(causation, 'trigger.run', {
|
|
592
|
+
status: 'failed', refs: { triggerId: definition.id, runId }, reason: 'authorization_denied',
|
|
593
|
+
});
|
|
594
|
+
return { ok: false, runId, triggerId: definition.id, status: 'failed', reason: 'authorization_denied', audit, error: reason };
|
|
595
|
+
}
|
|
567
596
|
script = execution.script;
|
|
568
597
|
processing = execution.processing;
|
|
569
598
|
reply = execution.reply ?? null;
|
|
@@ -730,6 +759,33 @@ export class TriggerRuntimeScheduler {
|
|
|
730
759
|
settleCompletion?.({ anomalies: executionAnomalies, ...(incomplete ? { incomplete } : {}) });
|
|
731
760
|
}
|
|
732
761
|
}
|
|
762
|
+
async disableAndNotifyAuthorizationDenied(definition, runId, firedAt, reason, causation) {
|
|
763
|
+
const current = this.manager.get(definition.id);
|
|
764
|
+
if (!current?.enabled || definitionRevision(current) !== definitionRevision(definition))
|
|
765
|
+
return undefined;
|
|
766
|
+
this.setEnabled(definition.id, false, `authorization_denied: ${reason}`);
|
|
767
|
+
// Legacy reviews stored the recipient as origin; do not notify that peer as the creator.
|
|
768
|
+
if (definition.labels?.kind === 'cross-thread-review'
|
|
769
|
+
&& definition.labels.originAuthorization !== 'creator-session-v1')
|
|
770
|
+
return undefined;
|
|
771
|
+
try {
|
|
772
|
+
return await this.feedback.dispatch({
|
|
773
|
+
trigger: {
|
|
774
|
+
...definition,
|
|
775
|
+
feedback: { strategy: 'origin' },
|
|
776
|
+
},
|
|
777
|
+
runId,
|
|
778
|
+
firedAt,
|
|
779
|
+
reply: errorReply(runId, 0, 'authorization_denied', reason),
|
|
780
|
+
textOverride: `Trigger ${definition.name}(${definition.id})已因授权失败而停用:${reason}`,
|
|
781
|
+
causation,
|
|
782
|
+
});
|
|
783
|
+
}
|
|
784
|
+
catch (error) {
|
|
785
|
+
logger.warn(`[Trigger] authorization denial notification failed: trigger=${definition.id} error=${error instanceof Error ? error.message : String(error)}`);
|
|
786
|
+
return undefined;
|
|
787
|
+
}
|
|
788
|
+
}
|
|
733
789
|
async runExecution(definition, runId, firedAt, sourcePayload, signal, dryRun, causation, onAnomalies) {
|
|
734
790
|
const maxAttempts = !dryRun && definition.execution.onError === 'retry'
|
|
735
791
|
? definition.reliability.retry.maxAttempts
|
|
@@ -1084,8 +1140,26 @@ export class TriggerRuntimeScheduler {
|
|
|
1084
1140
|
if (!definition.enabled || !this.isResumableCheckpoint(definition, run))
|
|
1085
1141
|
return false;
|
|
1086
1142
|
const executionAuthorization = await this.runtime.authorizeExecution?.(definition);
|
|
1087
|
-
if (executionAuthorization && !executionAuthorization.allowed)
|
|
1088
|
-
|
|
1143
|
+
if (executionAuthorization && !executionAuthorization.allowed) {
|
|
1144
|
+
const reason = executionAuthorization.reason || 'Trigger execution authorization denied';
|
|
1145
|
+
const notice = await this.disableAndNotifyAuthorizationDenied(definition, run.runId, run.source?.firedAt ?? Date.now(), reason, createRootCausation());
|
|
1146
|
+
const audit = this.buildAudit({
|
|
1147
|
+
definition,
|
|
1148
|
+
runId: run.runId,
|
|
1149
|
+
startedAt: run.startedAt,
|
|
1150
|
+
status: 'failed',
|
|
1151
|
+
reason: 'authorization_denied',
|
|
1152
|
+
source: run.source,
|
|
1153
|
+
script: null,
|
|
1154
|
+
feedback: notice?.feedback ?? null,
|
|
1155
|
+
effects: notice?.effects ?? [],
|
|
1156
|
+
error: { code: 'authorization_denied', message: reason },
|
|
1157
|
+
});
|
|
1158
|
+
this.audit.write(audit);
|
|
1159
|
+
this.publishTriggerRunOutcome(definition, audit);
|
|
1160
|
+
this.state.remove(definition.id, run.runId);
|
|
1161
|
+
return true;
|
|
1162
|
+
}
|
|
1089
1163
|
const session = await this.daemonChannel.getResumableConversationSession(run.executionSessionId);
|
|
1090
1164
|
if (!session) {
|
|
1091
1165
|
logger.warn(`[Trigger] resumable session unavailable: trigger=${definition.id} run=${run.runId} session=${run.executionSessionId}`);
|
|
@@ -1177,6 +1251,14 @@ export class TriggerRuntimeScheduler {
|
|
|
1177
1251
|
renderedTextPreview: previewText(originalPrompt),
|
|
1178
1252
|
};
|
|
1179
1253
|
const execution = await awaitWithAbortSettleGrace(this.runRecoveredExecution(definition, runtime, session), controller.signal, RUN_ABORT_SETTLE_GRACE_MS, 'execution');
|
|
1254
|
+
if (!controller.signal.aborted && execution.reply?.error?.reason === 'authorization_denied') {
|
|
1255
|
+
const reason = execution.reply.error.text || 'Trigger execution authorization denied';
|
|
1256
|
+
const notice = await this.disableAndNotifyAuthorizationDenied(definition, runId, source.firedAt, reason, causation);
|
|
1257
|
+
execution.feedbackResult = {
|
|
1258
|
+
status: 'failed', reason: 'authorization_denied', feedback: notice?.feedback ?? { strategy: 'origin' },
|
|
1259
|
+
effects: notice?.effects ?? [], error: { code: 'authorization_denied', message: reason },
|
|
1260
|
+
};
|
|
1261
|
+
}
|
|
1180
1262
|
reply = execution.reply ?? null;
|
|
1181
1263
|
anomalies = execution.anomalies ?? [];
|
|
1182
1264
|
runtime.anomalies = anomalies;
|
|
@@ -276,3 +276,31 @@ export async function atomicReplaceJson(file, value) {
|
|
|
276
276
|
fs.rmSync(temporary, { force: true });
|
|
277
277
|
}
|
|
278
278
|
}
|
|
279
|
+
const retryableCodes = new Set(['EPERM', 'EACCES', 'EBUSY']);
|
|
280
|
+
const delays = [10, 25, 50, 100];
|
|
281
|
+
const pause = new Int32Array(new SharedArrayBuffer(4));
|
|
282
|
+
/** Retry brief file-handle contention without opening or deleting the live file. */
|
|
283
|
+
export function atomicReplaceFile(source, destination) {
|
|
284
|
+
let lastError;
|
|
285
|
+
for (let attempt = 0;; attempt += 1) {
|
|
286
|
+
try {
|
|
287
|
+
fs.renameSync(source, destination);
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
catch (error) {
|
|
291
|
+
lastError = error;
|
|
292
|
+
const code = error.code;
|
|
293
|
+
if (!retryableCodes.has(code ?? '') || attempt >= delays.length)
|
|
294
|
+
break;
|
|
295
|
+
Atomics.wait(pause, 0, 0, delays[attempt]);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
const code = lastError?.code;
|
|
299
|
+
if (process.platform === 'win32' && code === 'EPERM') {
|
|
300
|
+
// Some Windows file projections deny renaming an open JSON target. Keep
|
|
301
|
+
// its inode and use atomicWrite's hot-backup/stable-write fallback instead.
|
|
302
|
+
atomicWrite(destination, fs.readFileSync(source, 'utf8'));
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
throw lastError;
|
|
306
|
+
}
|
|
@@ -21,6 +21,21 @@ export class OrphanedTargetSessionError extends Error {
|
|
|
21
21
|
this.name = 'OrphanedTargetSessionError';
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
|
+
const UNATTENDED_INPUT_REQUIRED_MESSAGE = '无人值守任务需要人工补充信息,本轮已结束。请在来源会话核对缺失信息后继续。';
|
|
25
|
+
export class UnattendedInputRequiredError extends Error {
|
|
26
|
+
code = 'UNATTENDED_INPUT_REQUIRED';
|
|
27
|
+
constructor() {
|
|
28
|
+
super(UNATTENDED_INPUT_REQUIRED_MESSAGE);
|
|
29
|
+
this.name = 'UnattendedInputRequiredError';
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
function isUnattendedInputRequired(error) {
|
|
33
|
+
const code = error && typeof error === 'object' && 'code' in error ? error.code : undefined;
|
|
34
|
+
const text = getErrorRawText(error);
|
|
35
|
+
return code === 'UNATTENDED_INPUT_REQUIRED'
|
|
36
|
+
|| text?.includes(UNATTENDED_INPUT_REQUIRED_MESSAGE) === true
|
|
37
|
+
|| text?.includes('阻塞式用户问题无法在无人值守任务中继续') === true;
|
|
38
|
+
}
|
|
24
39
|
export function isExecutionFailure(error) {
|
|
25
40
|
return error instanceof ExecutionTimeoutError || error instanceof OrphanedTargetSessionError;
|
|
26
41
|
}
|
|
@@ -92,6 +107,7 @@ export var ErrorType;
|
|
|
92
107
|
ErrorType["CLAUDE_STARTUP_ARGUMENTS_TOO_LONG"] = "claude_startup_arguments_too_long";
|
|
93
108
|
ErrorType["CLAUDE_CODE_STARTUP_FAILED"] = "claude_code_startup_failed";
|
|
94
109
|
ErrorType["POLICY_REJECTED"] = "policy_rejected";
|
|
110
|
+
ErrorType["INPUT_REQUIRED"] = "input_required";
|
|
95
111
|
ErrorType["UNKNOWN"] = "unknown";
|
|
96
112
|
})(ErrorType || (ErrorType = {}));
|
|
97
113
|
const POLICY_REJECTION_PATTERN = /invalid prompt[\s\S]{0,240}flagged as potentially violating our usage policy|prompt was flagged as potentially violating our usage policy/i;
|
|
@@ -241,6 +257,7 @@ const NON_INFRA_SUBTYPES = new Set([
|
|
|
241
257
|
'max_turns',
|
|
242
258
|
'permission_denied',
|
|
243
259
|
'policy_rejected',
|
|
260
|
+
'input_required',
|
|
244
261
|
'stop',
|
|
245
262
|
]);
|
|
246
263
|
const NON_INFRA_TERMINAL_REASONS = new Set([
|
|
@@ -445,6 +462,8 @@ function hasRetryableHttpStatus(text) {
|
|
|
445
462
|
return RETRYABLE_HTTP_STATUS_PATTERN.test(text);
|
|
446
463
|
}
|
|
447
464
|
export function classifyError(error) {
|
|
465
|
+
if (isUnattendedInputRequired(error))
|
|
466
|
+
return ErrorType.INPUT_REQUIRED;
|
|
448
467
|
if (error?.code === 'RUNNER_INTERRUPT_UNCONFIRMED')
|
|
449
468
|
return ErrorType.SESSION_UNAVAILABLE;
|
|
450
469
|
if (isClaudeSandboxDependencyFailure(error))
|
|
@@ -523,6 +542,8 @@ export function classifyError(error) {
|
|
|
523
542
|
* 注意:401 认证错误不可重试(API Key 无效不会因重试恢复)
|
|
524
543
|
*/
|
|
525
544
|
export function isRetryableError(error) {
|
|
545
|
+
if (isUnattendedInputRequired(error))
|
|
546
|
+
return false;
|
|
526
547
|
if (error?.code === 'RUNNER_INTERRUPT_UNCONFIRMED')
|
|
527
548
|
return false;
|
|
528
549
|
if (isClaudeSandboxDependencyFailure(error) || isSandboxInitializationFailure(error))
|
|
@@ -578,6 +599,9 @@ function sandboxInitializationErrorMessage(error, prefix) {
|
|
|
578
599
|
return `${prefix}执行沙箱启动失败(sandbox_initialization_failed),当前操作未执行;请查看原始诊断并运行 ec diagnose 排查`;
|
|
579
600
|
}
|
|
580
601
|
export function getErrorMessage(error, terminalReason, includeEmoji = true) {
|
|
602
|
+
if (isUnattendedInputRequired(error)) {
|
|
603
|
+
return `${includeEmoji ? '⚠️ ' : ''}${UNATTENDED_INPUT_REQUIRED_MESSAGE}`;
|
|
604
|
+
}
|
|
581
605
|
if (error?.code === 'RUNNER_INTERRUPT_UNCONFIRMED')
|
|
582
606
|
return `${includeEmoji ? '⚠️ ' : ''}${error.message}`;
|
|
583
607
|
if (terminalReason === 'max_output_tokens' || isOutputTokenLimitError(error)) {
|
package/dist/utils/logger.js
CHANGED
|
@@ -226,9 +226,76 @@ export function normalizeEventLog(data, loggedAt = Date.now()) {
|
|
|
226
226
|
function log(level, ...args) {
|
|
227
227
|
if (!shouldLog(level))
|
|
228
228
|
return;
|
|
229
|
-
|
|
229
|
+
// One physical line per record prevents message/error text from forging a
|
|
230
|
+
// timestamp + level + business-event prefix on a subsequent line.
|
|
231
|
+
const message = args.join(' ').replace(/[\r\n\u2028\u2029]/g, char => JSON.stringify(char).slice(1, -1));
|
|
232
|
+
const msg = `[${localTimestamp()}] [${level}] ${message}`;
|
|
230
233
|
getWriters().main.write(msg);
|
|
231
234
|
}
|
|
235
|
+
export function ownershipErrorCode(error, fallback = 'OWNERSHIP_OPERATION_FAILED') {
|
|
236
|
+
const record = error && typeof error === 'object' ? error : {};
|
|
237
|
+
const code = record.stringCode ?? record.code;
|
|
238
|
+
return typeof code === 'string' && /^[A-Z][A-Z0-9_]{0,63}$/.test(code) ? code : fallback;
|
|
239
|
+
}
|
|
240
|
+
export function logOwnershipEvent(event, fields, failed = false) {
|
|
241
|
+
const record = { schema: 'ec.ownership.v1', event };
|
|
242
|
+
for (const key of ['subjectAid', 'ownerAid', 'actorAid', 'localAid', 'configuredOwnerAid']) {
|
|
243
|
+
const value = fields[key];
|
|
244
|
+
if (typeof value === 'string' && value.length <= 253
|
|
245
|
+
&& /^[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?){2,}$/.test(value)) {
|
|
246
|
+
record[key] = value;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
if (typeof fields.operationId === 'string'
|
|
250
|
+
&& /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(fields.operationId)) {
|
|
251
|
+
record.operationId = fields.operationId;
|
|
252
|
+
}
|
|
253
|
+
const enums = {
|
|
254
|
+
eventType: ['ownership.request', 'ownership.pending', 'ownership.progress', 'ownership.completed',
|
|
255
|
+
'ownership.rejected', 'ownership.stopped', 'ownership.error', 'ownership.action_required'],
|
|
256
|
+
consensusStatus: ['consensus', 'unbound', 'released', 'single_sided', 'invalid', 'unavailable', 'not_applicable'],
|
|
257
|
+
previousConsensusStatus: ['consensus', 'unbound', 'released', 'single_sided', 'invalid', 'unavailable', 'not_applicable'],
|
|
258
|
+
source: ['direct', 'authorization', 'ownership.status', 'ownership.bind', 'ownership.event',
|
|
259
|
+
'directory.runtime', 'bootstrap.welcome', 'bootstrap.outbox', 'channel.binding',
|
|
260
|
+
'initialization.view', 'initialization.binding', 'initialization.operation', 'control.message'],
|
|
261
|
+
lock: ['locked', 'unlocked'],
|
|
262
|
+
failureKind: ['timeout', 'dns', 'connection', 'tls', 'http', 'metadata', 'projection', 'verification', 'sdk', 'unknown'],
|
|
263
|
+
transportCode: ['ETIMEDOUT', 'ECONNREFUSED', 'ECONNRESET', 'ENETUNREACH', 'EHOSTUNREACH',
|
|
264
|
+
'EAI_AGAIN', 'ENOTFOUND', 'UND_ERR_CONNECT_TIMEOUT', 'UND_ERR_HEADERS_TIMEOUT', 'UND_ERR_BODY_TIMEOUT'],
|
|
265
|
+
unboundCause: ['signed_declaration_missing', 'agent_card_missing'],
|
|
266
|
+
publicationReason: ['missing', 'noncanonical', 'remote_missing', 'current'],
|
|
267
|
+
taskStatus: ['pending', 'completed', 'rejected', 'stopped', 'error'],
|
|
268
|
+
step: ['agent', 'owner', 'approval', 'local_actions', 'completed'],
|
|
269
|
+
decision: ['accept', 'reject'],
|
|
270
|
+
};
|
|
271
|
+
for (const [key, values] of Object.entries(enums)) {
|
|
272
|
+
const value = fields[key];
|
|
273
|
+
if (typeof value === 'string' && values.includes(value))
|
|
274
|
+
record[key] = value;
|
|
275
|
+
}
|
|
276
|
+
if (typeof fields.relationVersion === 'number' && Number.isSafeInteger(fields.relationVersion)
|
|
277
|
+
&& fields.relationVersion >= 0)
|
|
278
|
+
record.relationVersion = fields.relationVersion;
|
|
279
|
+
for (const key of ['attemptId', 'processId', 'durationMs', 'maxAgeMs', 'timeoutMs', 'configuredOwnerCount']) {
|
|
280
|
+
const value = fields[key];
|
|
281
|
+
if (typeof value === 'number' && Number.isSafeInteger(value) && value >= 0)
|
|
282
|
+
record[key] = value;
|
|
283
|
+
}
|
|
284
|
+
if (typeof fields.httpStatus === 'number' && Number.isInteger(fields.httpStatus)
|
|
285
|
+
&& fields.httpStatus >= 100 && fields.httpStatus <= 599)
|
|
286
|
+
record.httpStatus = fields.httpStatus;
|
|
287
|
+
if (typeof fields.caller === 'string' && fields.caller.length <= 200 && !fields.caller.includes('..')
|
|
288
|
+
&& /^(?:src|dist)\/[a-zA-Z0-9_./-]+\.[cm]?[jt]s:\d+:\d+$/.test(fields.caller))
|
|
289
|
+
record.caller = fields.caller;
|
|
290
|
+
if (fields.errorCode !== undefined)
|
|
291
|
+
record.errorCode = ownershipErrorCode({ code: fields.errorCode });
|
|
292
|
+
for (const key of ['transient', 'fallbackUsed', 'connected', 'sdkReady', 'force', 'firstObservation', 'slow',
|
|
293
|
+
'publicationRequired', 'hadOwnershipFields']) {
|
|
294
|
+
if (typeof fields[key] === 'boolean')
|
|
295
|
+
record[key] = fields[key];
|
|
296
|
+
}
|
|
297
|
+
log(failed ? 'WARN' : 'INFO', `[EC_OWNERSHIP] ${JSON.stringify(record)}`);
|
|
298
|
+
}
|
|
232
299
|
/**
|
|
233
300
|
* 设置日志级别(daemon.json 加载后调用,覆盖环境变量默认值)
|
|
234
301
|
* 优先级:daemon.json debug.logLevel → LOG_LEVEL 环境变量 → 'INFO'
|
package/dist/utils/welcome.js
CHANGED
|
@@ -267,7 +267,7 @@ export function generateInitSuccessMessage(channelType, hasOwner) {
|
|
|
267
267
|
}
|
|
268
268
|
const ownerHint = channelType === 'aun'
|
|
269
269
|
? ` 配置 owner: ec init ${channelType}`
|
|
270
|
-
: '
|
|
270
|
+
: ' 配置绑定目标: 在 agent config.json 的 owner/owners 中写入 AID;协议 Owner 以 Ownership 2.1 共识为准;非 AUN 渠道身份写入 contact.json';
|
|
271
271
|
// 无 owner 的渠道
|
|
272
272
|
return `\n💡 提示:${channelName}渠道已配置
|
|
273
273
|
启动服务: ec start
|
package/kits/docs/INDEX.md
CHANGED
|
@@ -30,6 +30,7 @@ EvolCore 能力插件体系的实施设计位于源码仓库 `$PACKAGE_ROOT/docs
|
|
|
30
30
|
| 文档 | 路径 | 说明 |
|
|
31
31
|
|------|------|------|
|
|
32
32
|
| 命令集目录 | `evolcore/INDEX.md` | msg/group/agent/aid/storage/ctl/rpc/bench 全集索引 |
|
|
33
|
+
| Provider 注册表 | `evolcore/provider.md` | 宿主进程级 Provider CRUD、JSON 导入及 CLI/Menu 边界 |
|
|
33
34
|
| 联系人命令 | `evolcore/contact.md` | Contact Book 添加申请、拉黑与托管会话权限边界 |
|
|
34
35
|
| Agent 生命周期与 Bootstrap | `evolcore/agent-create.md` | 生命周期与新 Agent 首次设定参考;创建者操作已迁移到 `ec-agent-create` 技能 |
|
|
35
36
|
| 群聊协作入口 | `evolcore/group-collaboration.md` | 旧文档入口;完整任务流程已迁移到 `ec-group-collaboration` 技能 |
|
package/kits/docs/aun/SDK.md
CHANGED
|
@@ -53,7 +53,10 @@ AUN SDK 有四个语言版本:TypeScript、Python、Go、JavaScript。协议
|
|
|
53
53
|
|
|
54
54
|
| 文件 | 内容 |
|
|
55
55
|
|------|------|
|
|
56
|
-
| `agent.md/SCHEMA.md` |
|
|
56
|
+
| `agent.md/SCHEMA.md` | Ownership 2.0 历史版本,仅供参考 |
|
|
57
|
+
| `protocol/Ownership协议定义2.1.md` §2.3 | **当前权威**:字段定义、group/org 分支、type 预设值、六态共识 |
|
|
58
|
+
|
|
59
|
+
字段约束与示例见 `$KITS_DOCS/identity/AID_PROFILE_SPEC.md`。
|
|
57
60
|
|
|
58
61
|
### 总索引
|
|
59
62
|
|
|
@@ -68,6 +68,7 @@ Windows 上 Codex 托管任务出现 `helper_sandbox_lock_failed`、`SetNamedSec
|
|
|
68
68
|
|
|
69
69
|
| 命令集 | 用途 | 触发词 | 文档 |
|
|
70
70
|
|--------|------|--------|------|
|
|
71
|
+
| `ec provider` | 宿主 Provider 注册表 CRUD 与单项 JSON 导入(仅宿主控制终端) | Provider/服务商/供应商/导入服务商/注册表 | `provider.md` |
|
|
71
72
|
| `ec model` | 模型与推理强度管理(按作用域持久化) | 切模型/列模型/当前模型/模型详情/改强度/诊断网关 | `model.md` |
|
|
72
73
|
| `ec response` | 响应模式管理(按作用域持久化) | 切换响应模式/列响应模式/看当前模式/改响应配置 | `response.md` |
|
|
73
74
|
| `ec config` | 配置体系底层入口(读写/快照/回滚) | 看配置/改配置/查字段/查schema/校验/快照/回滚/历史/启动记录 | `config.md` |
|
|
@@ -94,6 +94,9 @@ ec agent delete <aid> [--purge]
|
|
|
94
94
|
- `--name` / `--description` 在初始化模式中必填;Bootstrap 模式缺省读取当前项目 `package.json`,再回退到目录名 / 默认描述。
|
|
95
95
|
- `--dry-run` 只输出最终创建计划,不注册 AID、不写配置、不上传 `agent.md`。
|
|
96
96
|
- `--force` 仅 Bootstrap 模式支持,覆盖已有 `config.json`;AID 密钥保留。
|
|
97
|
+
- daemon 控制 AID 不得注册为普通 Agent(`CONTROL_AID_RESERVED`);已验签 `type: host` 名片的已有身份
|
|
98
|
+
不得复用(`HOST_AID_RESERVED`)。创建、初始化、恢复和运行时加载均保护控制身份,`--force` 不例外。
|
|
99
|
+
普通 Agent 可使用 `ec` 开头的 AID;历史冲突配置保留并显示错误,不建立 runner 或渠道。
|
|
97
100
|
- `--tags` 接受 3 到 6 个标签的 JSON 数组;每个标签只允许 Unicode 字母、数字和连字符(`-`),最长 50 字符。
|
|
98
101
|
- `ec agent new` 支持 `--avatar-file <path>`(托管当前对端附件可用 `attachment:<id>`)或 `--avatar-url <https-url>`;创建流程沿用 `ec aid avatar` 的公共头像管线。未提供头像时跳过;已明确提供但无法规范化或上传时,创建返回可恢复错误。
|
|
99
102
|
- `--initialize` 是默认创建模式,要求显式提供 `--name`、`--description`、`--tags` 和 Owner;它不从项目元数据推断名片,成功条件是目标 Agent 已进入 `active`。它自动包含 `--non-interactive`,不需要同时填写后者。
|
|
@@ -105,7 +108,7 @@ ec agent delete <aid> [--purge]
|
|
|
105
108
|
- `ec agent welcome --text <text>` 用于保存 Bootstrap 中 Agent 自主准备的完整正式文案,不要求 Owner 起草、审稿或确认;命令固定写入当前 Agent 的 `$PERSONAL_DIR/welcome.md`,不接受自定义路径。`welcome show` 读取该文件。
|
|
106
109
|
- welcome 托管写入要求当前 Agent 私聊 Owner;admin 仅可读。模板上限 4 KiB,渲染上限 8 KiB;变量为 `agentName`、`agentDescription`、`agentAid`、`agentTags`、`agentTagsText`、`ownerName`、`ownerAid`、`channel`,支持标签循环和真值条件。写入保留原始文本,投递不附加额外文案。
|
|
107
110
|
- `agent show <target-aid>` 与 `agent get <target-aid> <key>` 的跨 Agent 读取对 owner/admin 开放,但普通 Agent 角色只获得安全摘要;敏感配置值和物理路径仅对 DaemonOwner 返回原值。跨 Agent 写入、启停、删除和 reload 仍遵循各自的目标与 DaemonOwner 权限边界。
|
|
108
|
-
- Agent 配置可包含 `fullaccess.enabled`(默认关闭),作为全局开关;开启后对符合条件的私聊直接生效,局部 `/fa on|off` 不改变全局授权。Menu 写入全局开关要求请求者同时是目标 Agent Owner 与 daemon Owner。关闭全局开关时,私聊 `/fa on|off` 管理当前作用域:主会话写 relation 配置并跨 EC session/backend 续接保留,话题会话写自身 session metadata;`/fa <任务信息>` 或 `/fullaccess <任务信息>` 则由 daemon Owner 发起一次性 fullaccess 任务,不改变会话开关。群聊不支持。实际运行时逐次复核相应 Owner 授权、会话绑定和 Runner fullaccess 能力;Trigger
|
|
111
|
+
- Agent 配置可包含 `fullaccess.enabled`(默认关闭),作为全局开关;开启后对符合条件的私聊直接生效,局部 `/fa on|off` 不改变全局授权。Menu 写入全局开关要求请求者同时是目标 Agent Owner 与 daemon Owner。关闭全局开关时,私聊 `/fa on|off` 管理当前作用域:主会话写 relation 配置并跨 EC session/backend 续接保留,话题会话写自身 session metadata;`/fa <任务信息>` 或 `/fullaccess <任务信息>` 则由 daemon Owner 发起一次性 fullaccess 任务,不改变会话开关。群聊不支持。实际运行时逐次复核相应 Owner 授权、会话绑定和 Runner fullaccess 能力;Trigger 不会因该开关自动提权。经 daemon 验证的 fullaccess 任务可进入原本由托管 CLI 顶层白名单拒绝的命令,并可通过受管文件入口访问 H-Class 路径;当前会话承载的 EvolCore 实例仍受生命周期保护。
|
|
109
112
|
|
|
110
113
|
## 创建 Agent
|
|
111
114
|
|
|
@@ -120,6 +123,10 @@ EC Web 有两个独立入口:`action: create` 沿用 Bootstrap 流程(与 `-
|
|
|
120
123
|
|
|
121
124
|
`--initialize` 的进度落在 `ec agent show <aid>` 的 `initialization` 字段:`status`、`phase`、`code`、`nextStep`、`agentmd.published`、`persona.provided`、`avatar.uploaded`。persona 正文不会出现。
|
|
122
125
|
|
|
126
|
+
初始化记录无效时,`code=INITIALIZE_STATE_INVALID`,`validationFailure` 区分读取失败、JSON 格式错误、记录或计划结构错误、版本不支持、AID 不匹配、操作 ID/状态非法及指纹不匹配。启动恢复告警同时记录 AID、错误码和该原因,不输出计划、persona、路径或原始异常;无效记录仍禁止恢复,不自动重写指纹或初始化状态。
|
|
127
|
+
|
|
128
|
+
指纹不匹配时还提供 `fingerprintFormat`(已知历史序列化格式匹配,或 `unrecognized`)及 `recordedStatus`(记录自报的状态,仅供诊断)。历史格式匹配只说明某种历史算法能产生已存指纹,不证明记录未被修改,也不授予恢复或任务执行权限;即使 `recordedStatus=complete`,无效记录仍返回 `complete=false`、`retryable=false`。
|
|
129
|
+
|
|
123
130
|
恢复方式:
|
|
124
131
|
- 状态为 `failed` 时执行 `ec agent initialize <aid> --resume`,按原计划续跑;计划被改动返回 `INITIALIZE_PLAN_CONFLICT`。
|
|
125
132
|
- daemon 启动时会自动续跑所有 `in_progress` 记录;停在 `ownerpending` 的记录在 Ownership 共识到达时自动恢复。
|
|
@@ -4,6 +4,16 @@
|
|
|
4
4
|
|
|
5
5
|
## 运行边界
|
|
6
6
|
|
|
7
|
+
Ownership IPC 的默认路径要求 daemon 验证的 session delegation;清空、删除或伪造会话环境不会自动获得本地控制凭据。干净宿主终端执行 `ec aid bind`(含 status/accept/reject)可沿用原语法,也可显式添加 `--local-control`;宿主入口读取并提交 control token。存在任一托管环境标记时不能回退宿主路径,混合提交托管与宿主凭据会被拒绝。TTY 不作为身份或权限证明。
|
|
8
|
+
|
|
9
|
+
本地控制的安全边界是能读取 daemon 控制凭据的 **OS 用户**。同 UID、无隔离的 fullaccess 进程可以主动访问该用户的凭据,应用内环境变量检查无法将它与宿主 CLI 区分;需要隔离这一威胁时必须使用独立 OS 身份及凭据访问隔离。`--local-control` 只选择认证模式,本身不授予权限。
|
|
10
|
+
|
|
11
|
+
Ownership 业务事件写入现有 `daemon.log`,格式为日志时间和等级后紧跟 `[EC_OWNERSHIP]` 及 `schema=ec.ownership.v1` 的 JSON。除状态变化和失败外,每次实际刷新记录 `refresh.started` 及 `refresh.completed/failed/discarded`;命中缓存不新增查询日志。用 `processId + subjectAid + attemptId` 对齐同一次查询,`source/caller` 标出触发入口,`connected/sdkReady` 标出查询开始时的连接状态,`durationMs` 使用单调时钟计时,成功刷新达到 1 秒也记 WARN。核心 8 秒超时单独标为 `OWNERSHIP_REFRESH_TIMEOUT`;`failureKind/transportCode/httpStatus` 区分传输及协议失败,不输出原始错误正文。
|
|
12
|
+
|
|
13
|
+
`unbound` 的诊断同时记录 `configuredOwnerAid/configuredOwnerCount`、协议版本和锁;`unboundCause` 区分远端名片缺失和签名归属声明缺失。`firstObservation/previousConsensusStatus` 区分进程首次观测和已知共识失效。控制 AID 启动名片检查记录 `control.card.checked/published`,包含是否需要发布、发布原因和原名片是否有 Ownership 字段;字段存在不代表声明有效,也不授予权限。
|
|
14
|
+
|
|
15
|
+
字段经过白名单筛选;不记录消息、reason、原始错误、绝对路径、密钥或 token,`caller` 只允许仓库相对源码位置。筛选使用锚定前缀 `^\[[^]]+\] \[(INFO|WARN)\] \[EC_OWNERSHIP\] `,不能按正文单词 ownership 搜索判定业务事件;现有轮转与保留配置不变。
|
|
16
|
+
|
|
7
17
|
本页列出独立终端中 `ec aid` 的完整 CLI 能力。在 EvolCore 托管 Agent 会话中,为防止会话枚举、创建、删除或切换本地身份,只允许以下精确命令:
|
|
8
18
|
|
|
9
19
|
帮助查询不受 AID 操作范围限制:`ec aid`、`ec aid --help`、`ec aid help` 以及各子命令的 `--help` / `-h` 只显示用法,不执行身份操作。实际操作仍按下列范围鉴权。
|
|
@@ -12,17 +22,18 @@
|
|
|
12
22
|
ec aid show <当前 self AID> [--format json]
|
|
13
23
|
ec aid lookup <任意合法 AID> [--format json]
|
|
14
24
|
ec aid agentmd get <任意合法 AID> [--format json]
|
|
15
|
-
ec aid bind status [--subject <本地AID>] [--format json]
|
|
25
|
+
ec aid bind status [--refresh] [--subject <本地AID>] [--format json]
|
|
16
26
|
# 仅 request / bypass
|
|
17
27
|
ec aid bind <ownerAid> [--subject <本地AID>] [--format json]
|
|
28
|
+
ec aid transfer <subAid> <newOwnerAid> --subject <当前OwnerAID> [--format json]
|
|
18
29
|
ec aid bind accept <operationId> [--subject <本地AID>] [--format json]
|
|
19
30
|
ec aid bind reject <operationId> [--reason '<原因>'] [--subject <本地AID>] [--format json]
|
|
20
31
|
ec aid agentmd put <当前 self AID> [--format json]
|
|
21
|
-
ec aid agentmd set <当前 self AID> <name|type|description|version|tags> <value> [--format json]
|
|
32
|
+
ec aid agentmd set <当前 self AID> <name|type|description|version|tags|exttype> <value> [--format json]
|
|
22
33
|
ec aid avatar <当前 self AID> (--file <path> | --url <https-url>) [--format json]
|
|
23
34
|
```
|
|
24
35
|
|
|
25
|
-
`set` 的 value 是单个 CLI 参数;`tags` 必须传 JSON 字符串数组,例如 `'["coding","tools","aun"]'`。set 仅更改 YAML frontmatter
|
|
36
|
+
`set` 的 value 是单个 CLI 参数;`tags` 必须传 JSON 字符串数组,例如 `'["coding","tools","aun"]'`。set 仅更改 YAML frontmatter 对应字段,保留正文,再签名发布。各字段会做基本格式校验(`version` 需 SemVer、`tags` 需字符串数组等)。
|
|
26
37
|
|
|
27
38
|
仅允许不带选项的基本形式,或在末尾附加一组完整的 `--format json`;不能使用 `--aun-path`、未知选项、管道、重定向或其它命令。所有 `allowAccess=true` 的已认证角色(包括 visitor、member、admin、owner 及自定义角色)均开放 `lookup` 和 `agentmd get`,目标可以是任意合法 AID。`show` 只允许当前 self AID:owner/admin 返回完整本地身份诊断,visitor/member 及其它非管理角色返回不含私钥存在性、密钥匹配和签名能力的脱敏结果。三个查询可在所有 `permissionMode` 执行。`agentmd put`、`agentmd set` 和 `avatar` 会发布远端名片,属于写操作,仅允许针对当前 self AID 的 `request`、`bypass`,`readonly`、`auto` 和未知模式均拒绝。头像支持 PNG、JPEG、WebP,大小上限 500KB,分辨率 128–2048 像素,宽高比 0.8–1.25;`--url` 仅支持 HTTPS,下载由 daemon 执行并做 SSRF/重定向校验。成功 JSON 返回 `sha256`、MIME 和尺寸元数据。`lookup` 探测指定公开 AID;`get` 下载并验签指定公开名片,同时刷新本地 AID 缓存。`list`、其它 AID 的 `show/agentmd put/set/avatar` 以及 `new/delete` 均拒绝。独立终端不受此托管会话限制。
|
|
28
39
|
|
|
@@ -58,7 +69,7 @@ ec aid bind reject <operationId> --subject <接收方本地AID> --reason '用户
|
|
|
58
69
|
`--subject` 始终指定执行审批的本地 AID。省略时,独立 CLI 使用 daemon Control AID,托管会话使用当前 self AID。
|
|
59
70
|
例如 B 请求由 A 担任 Owner,在 A 上确认时应选 `--subject A`。A 的状态中 `requests` 展示 SDK 已验证的
|
|
60
71
|
待确认绑定任务,包括 `operation_id`、`sub_aid`、`owner_aid`、`requester_aid`、本端 `local_role` 和关系版本。
|
|
61
|
-
本端既可以是拟任 Owner,也可以是接受 Owner 绑定的 sub
|
|
72
|
+
本端既可以是拟任 Owner,也可以是接受 Owner 绑定的 sub;转让请求也通过这个入口审批,解绑和未验证请求不通过该入口。
|
|
62
73
|
|
|
63
74
|
CLI 优先经 daemon 已有的 SDK 客户端调用 `acceptOwnershipRequest` / `rejectOwnershipRequest`;
|
|
64
75
|
宿主 CLI 指定的本地 AID 没有已连接的 daemon client 时,daemon 会加载该 AID 的本地身份,
|
|
@@ -71,8 +82,30 @@ CLI 优先经 daemon 已有的 SDK 客户端调用 `acceptOwnershipRequest` / `r
|
|
|
71
82
|
`decisionConsensus` 是 SDK 对邀约 sub 的独立新鲜查询,只有它显示目标 owner、sub、版本和 `locked` 匹配时才表示关系已成立。
|
|
72
83
|
接受回执本身不授予权限,Owner 权限仍由 `checkOwnershipConsensus` 返回的当前 owner、sub、关系版本和 `locked` 状态确定。
|
|
73
84
|
只有 SDK 事件会更新当前进程的请求投影。
|
|
74
|
-
托管会话审批需要当前 Agent Owner 或 daemon Owner,以及 `request` / `bypass`
|
|
75
|
-
|
|
85
|
+
托管会话审批需要当前 Agent Owner 或 daemon Owner,以及 `request` / `bypass` 任务。
|
|
86
|
+
`bind status`(含 `--refresh`)验证任务凭据、会话和本地 subject 后直接查询,不要求协议 Owner/admin 身份;
|
|
87
|
+
可查询另一个已挂载本地 SDK client 的 AID。变更操作选择另一个本地 AID 仍需要 daemon Owner。
|
|
88
|
+
Fullaccess 身份不再导致 Ownership 命令被整体拒绝;绑定、审批和转让仍校验实际 Owner 权限。
|
|
89
|
+
|
|
90
|
+
## 转让 AID Owner
|
|
91
|
+
|
|
92
|
+
当前协议 Owner 发起三方转让,不能通过先解绑再绑定替代:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
ec aid transfer <subAid> <newOwnerAid> --subject <currentOwnerAid> [--format json]
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
SDK 会向 sub 和新 Owner 分别发送 `transfer.request`。两方都必须对同一个
|
|
99
|
+
`operation_id` 明确执行现有的 `ec aid bind accept`;任一方拒绝则原 Owner 关系保持不变。
|
|
100
|
+
转让完成的判据是 `checkOwnershipConsensus` 返回目标 Owner、新关系版本和 `lock=locked`,
|
|
101
|
+
CLI 返回的 SDK `completed` 或消息 ACK 本身不代表关系已经切换。转让发起前必须有新鲜的
|
|
102
|
+
当前 Owner 共识;转让过程中旧 Owner 仍保持有效,不能依据中间事件提前切换授权。
|
|
103
|
+
`ec aid bind status --refresh` 会刷新当前 Owner 自己的共识和本地记录的各个转让 sub 共识;
|
|
104
|
+
成功提交转让后,只有确认新 Owner、sub、目标关系版本和锁匹配才从活动转让列表移除。
|
|
105
|
+
|
|
106
|
+
如果当前机器同时持有旧 Owner、sub 和新 Owner 三份有效普通 agent 身份,EvolCore 会调用
|
|
107
|
+
SDK 的 `transferLocalSubaid` 完成本地三身份编排;否则调用 `transferSubaid`,由三方通过 AUN
|
|
108
|
+
消息完成审批。超时结果不得自动重发,应使用原 `operation_id` 查询状态。
|
|
76
109
|
|
|
77
110
|
## 本地双身份绑定
|
|
78
111
|
|
|
@@ -92,17 +125,33 @@ Agent 的首个配置 Owner 可在该 Agent 的 AUN 私聊中发送纯 `/bind`
|
|
|
92
125
|
|
|
93
126
|
Ownership 共识不再每 15 秒轮询。普通消息、控制消息、查询和路由读取复用最长 30 分钟的共识结果;敏感授权、审批授权兑现、初始化激活及高权限执行使用同一结果,但要求核验时间不超过 5 分钟。读取不会延长缓存有效期,到期本身不会发请求;需要结果的异步调用在过期后等待刷新。控制通道的配对和诊断命令按敏感操作使用 5 分钟窗口。
|
|
94
127
|
|
|
95
|
-
|
|
128
|
+
普通 Agent 请求默认只核验该 Agent 的归属,不顺带查询控制 AID;进程控制、fullaccess、审批授权兑现及修改 Ownership 等需要进程权限的入口显式核验控制 AID。初始化页面的展示轮询复用敏感操作缓存;绑定请求处于 `pending` 或提交结果 `unknown` 时,仍实时复核,确认共识后恢复缓存读取。
|
|
129
|
+
|
|
130
|
+
`ec aid bind status` 默认复用有效缓存;审批刚完成或需要确认最新状态时使用 `ec aid bind status --refresh` 强制重新查询。`--refresh` 只影响 status 查询,不修改绑定状态,也不提交新的绑定邀约。输出中的 SDK 动作状态(例如 `completed`)仅描述该次 SDK 调用;是否绑定成功以当前 `consensusStatus=consensus`、Owner、关系版本和 `lock=locked` 为准。历史关系快照会标明不是当前共识。
|
|
131
|
+
|
|
132
|
+
ECWeb 菜单使用已有的服务端认证和管理授权,不在菜单入口预先查询控制 AID 的 Ownership;基础列表等查询不依赖 AUN 连接就绪。未认证请求仍拒绝,具体 Ownership 操作仍由原协议操作流程核验。
|
|
133
|
+
|
|
134
|
+
Ownership 共识解析器不在启动、连接首次就绪或断线恢复时主动刷新,也不通过空发件箱排空、空欢迎消息修复或空记忆整理任务间接触发刷新;已结束的 Bootstrap 发件箱记录不触发排空时的复核。首次需要归属状态、权限校验或处理待发送的 Bootstrap 消息时按需查询;未完成的初始化和显式配置的首次绑定仍按原流程核验。
|
|
135
|
+
|
|
136
|
+
Owner 目录同步在连接可用时建立单条核验和暂态故障退避链,连接切换后清理旧链;它是共识解析器的独立调用方,不新建 SDK 客户端,也不主动申请目录授权。只刷新已获授权的目录缓存。接收 Owner 目录授权时只做一次实时 Owner 核验,仍要求发送者匹配。
|
|
137
|
+
|
|
138
|
+
Ownership 任务事件、修改本地 Owner 配置、相关名片或 Owner 关系材料变更只失效缓存,不主动发起复核。连接首次就绪、断线恢复和缓存到期均不触发提前刷新;下次实际消息、查询或授权需要 Owner 时才等待核验。相同任务事件和连接通知去重,无关对端、普通文件变更不触发失效。远端 Owner 的 Storage 事件只在本机确实收到时生效,不能假定事件完整覆盖远端变化。Owner 绑定提交前及修改 Owner 的授权仍要求显式核验成功。
|
|
139
|
+
|
|
140
|
+
尚处于 `created`、`ownerpending` 或 `bootstrapping` 的普通 Agent 在 AUN 连接就绪后,优先取根级 `config.json.owner`,缺失时兼容旧 `owners` 数组的首个非空 AID;沿用首个配置 Owner 的选择规则,不向数组内所有 AID 发送邀约。没有绑定目标、生命周期无效或已经 `active` 时静默跳过,不因遗留配置重新绑定。存在绑定目标且新鲜协议状态为 `unbound`、`released` 或 `single_sided` 时,每个 Agent 对同一 Owner 在本进程内最多自动提交一次绑定邀约。等待确认、提交失败或回执不明均不定时重发,断线重连和渠道重建也不会再次提交;需要重发时显式执行绑定命令。自动尝试记录只保存在内存,不持久化;进程重启后重新检查并允许再自动提交一次。
|
|
141
|
+
|
|
142
|
+
每次提交前重读配置并检查连接是否仍有效。查询失败不消耗自动提交机会、不安排定时重试,可在后续连接就绪时重新检查。收到 SDK 验证的绑定拒绝事件或明确拒绝回执后,按 Agent 和 Owner 持久化拒绝记录;进程重启后也不再自动向该 Owner 发邀约。拒绝记录仅限制自动邀约,仍可显式执行绑定命令重新发起。超时、网络错误和其它失败不作为拒绝持久化。只有当前锁定、未失效且核验时间不超过 5 分钟的协议共识确认绑定后,才原子删除匹配的根级 `owner` 和旧 `owners` 项;AID 比较会去除两端空白,其它 Owner 及配置字段保留。
|
|
143
|
+
|
|
144
|
+
根级 `config.json.owner/owners` 在初次 Ownership 绑定前兼容现有 Owner 执行来源,同时作为绑定目标。Ownership 2.1 达成共识后,Owner 角色、权限校验、有效 Owner 列表和运行时配置投影只读取协议核验结果;手动重新写入这些配置字段不会恢复 Owner 权限。暂态故障容错仅使用本进程已成功核验的关系,配置值不能替代协议核验;尚未建立协议关系时仍保留兼容 Owner 行为。
|
|
96
145
|
|
|
97
|
-
普通 Agent
|
|
146
|
+
普通 Agent 消息与任务在缓存过期后先等待按需核验。网络、Gateway 超时或客户端短暂中断等已识别暂态故障允许沿用本进程最近一次成功核验的 Owner,不受原 5 分钟容错窗口限制,也不更新成功核验时间或延长缓存有效期。明确返回 `invalid`、`unbound`、`released`、`single_sided`、关系不匹配或锁状态不匹配时立即撤销旧授权,后续网络失败也不能恢复该关系。没有成功核验记录、未知错误或永久错误不使用暂态 fallback。Ownership bind、accept/reject、transfer、release 和 Owner 配置变更等严格调用仍要求当前刷新成功;状态查询默认读取缓存,需要当前结果时显式使用 `status --refresh`。
|
|
98
147
|
|
|
99
|
-
SDK
|
|
148
|
+
SDK 临时断线只更新连接状态,不清除已核验关系;普通读取仍按 30 分钟、敏感授权仍按 5 分钟窗口决定是否需要重新核验,断线不会延长有效期。断线前尚未完成的查询结果丢弃;实际请求核验遇到暂态故障时按上述规则容错。客户端解绑或替换仍立即撤销该客户端的授权及容错来源。
|
|
100
149
|
|
|
101
|
-
同一 subject
|
|
150
|
+
同一 subject 的并发刷新复用进行中的请求;事件发生前启动的旧查询不能覆盖事件后的结果,实际请求仍需结果时等待当前状态的核验。共识解析器无定时刷新、后台重试或事件触发的提前查询;故障后由下一次实际请求再次核验。Owner 目录同步链仅为自身需要的核验安排暂态故障退避,不改变普通请求的按需核验规则。本地配置 Owner 和已认证 ECWeb 等独立授权来源不受此缓存替代。单次请求超时仍为 8 秒,不是 5 分钟或 30 分钟。
|
|
102
151
|
|
|
103
|
-
关系快照与授权状态分离:`relation` 保留进程内最后一次确认的关系(Owner
|
|
152
|
+
关系快照与授权状态分离:`relation` 保留进程内最后一次确认的关系(Owner、核验时间、关系版本或已解除/未绑定状态),缓存过期、断线、事件失效或复核失败不会删除展示用历史。历史快照本身不授予权限;只有实际核验识别为暂态故障,且保留着未被明确否定的成功核验记录时,才可由允许容错的调用沿用该关系。确认转移后替换 Owner,确认解除或未绑定后清除当前关系中的 Owner。历史与容错记录均不落盘,进程启动后重新确认。
|
|
104
153
|
|
|
105
|
-
Agent 展示通过 `knownOwner/knownOwners` 读取关系快照,详情另返回 `ownership.authorizationStatus`(`verified` / `expired` / `unavailable`),表示协议 Owner
|
|
154
|
+
Agent 展示通过 `knownOwner/knownOwners` 读取关系快照,详情另返回 `ownership.authorizationStatus`(`verified` / `expired` / `unavailable`),表示协议 Owner 的五分钟核验新鲜度,不代表本地配置 Owner 等独立授权来源。容错沿用旧核验时不会伪装为新鲜核验,调用方可通过 `refreshFailure.fallbackUsed` 识别。`owner/owners/isOwner` 只使用有效缓存或实际暂态核验失败后获准沿用的已验证身份;任务启动、自动压缩和重试也遵循按需核验及容错规则。欢迎消息、Bootstrap 和严格审批路由仍要求有效核验。
|
|
106
155
|
|
|
107
156
|
## 更换头像
|
|
108
157
|
|
|
@@ -130,12 +179,13 @@ ec aid lookup <aid>
|
|
|
130
179
|
# agent.md 名片:签名上传 / 下载验签
|
|
131
180
|
ec aid agentmd put <aid>
|
|
132
181
|
ec aid agentmd get <aid>
|
|
133
|
-
ec aid agentmd set <aid> <name|type|description|version|tags> <value>
|
|
182
|
+
ec aid agentmd set <aid> <name|type|description|version|tags|exttype> <value>
|
|
134
183
|
ec aid avatar <aid> (--file <path> | --url <https-url>)
|
|
135
|
-
ec aid bind <ownerAid> [--subject <subjectAid>]
|
|
136
|
-
ec aid
|
|
137
|
-
ec aid bind
|
|
138
|
-
ec aid bind
|
|
184
|
+
ec aid bind <ownerAid> [--subject <subjectAid>] [--local-control]
|
|
185
|
+
ec aid transfer <subAid> <newOwnerAid> --subject <currentOwnerAid> [--local-control]
|
|
186
|
+
ec aid bind status [--refresh] [--subject <subjectAid>] [--local-control]
|
|
187
|
+
ec aid bind accept <operationId> [--subject <subjectAid>] [--local-control]
|
|
188
|
+
ec aid bind reject <operationId> [--reason '<text>'] [--subject <subjectAid>] [--local-control]
|
|
139
189
|
|
|
140
190
|
# 删除指定本地 AID(无网络注销)
|
|
141
191
|
ec aid delete <aid>
|
|
@@ -253,7 +253,7 @@ Menu 批量请求遇到真实权限拒绝仍整体拒绝并停止执行,不会
|
|
|
253
253
|
`role` 由角色分配服务维护;`permissionMode` 仅在角色策略中维护
|
|
254
254
|
- **兼容字段**:`enable_rich_content` 仍可读取旧值,但已废弃且不再产生运行时效果
|
|
255
255
|
- **群规则策略**:`groupRules.mode` 仅当前 Agent 的实际 owner 可 set/unset;DaemonOwner 不继承群或 relation 写权限,其他角色可读取当前 relation 的有效值
|
|
256
|
-
- **Agent fullaccess 策略**:Agent 配置中的 `fullaccess.enabled` 缺失时关闭。Menu 写入要求请求者同时是目标 Agent Owner 与 daemon Owner。私聊中的 `/fa`、`/fa on`、`/fa off` 管理当前 EC 会话;主会话写 Agent 配置,话题会话写 session metadata。`/fa <任务信息>` / `/fullaccess <任务信息>` 执行一次性 fullaccess 任务,不改变会话开关;群聊拒绝。每次 Runner 执行仍复核相应 Owner 授权、会话绑定和 fullaccess 能力;CLI 和托管任务不能直接 set/unset Agent fullaccess。Fullaccess Trigger
|
|
256
|
+
- **Agent fullaccess 策略**:Agent 配置中的 `fullaccess.enabled` 缺失时关闭。Menu 写入要求请求者同时是目标 Agent Owner 与 daemon Owner。私聊中的 `/fa`、`/fa on`、`/fa off` 管理当前 EC 会话;主会话写 Agent 配置,话题会话写 session metadata。`/fa <任务信息>` / `/fullaccess <任务信息>` 执行一次性 fullaccess 任务,不改变会话开关;群聊拒绝。每次 Runner 执行仍复核相应 Owner 授权、会话绑定和 fullaccess 能力;CLI 和托管任务不能直接 set/unset Agent fullaccess。Fullaccess Trigger 使用独立的持久授权链。经 daemon 验证的 fullaccess 任务可绕过托管 CLI 顶层白名单和 H-Class 文件入口限制,但当前会话承载的 EvolCore 生命周期保护、参数校验和文件完整性校验仍生效。
|
|
257
257
|
- **源码诊断白名单**:`readonlySourceDiagnostics` 默认关闭;开启后只读会话仅可在项目源码目录执行受限、可证明只读查询,配置/证书/快照/session/锁文件仍禁止访问
|
|
258
258
|
- **仅人可写**:channels / owners / admins / 凭证 / aid / enabled / projects / aun
|
|
259
259
|
- Agent 托管环境写仅人字段被拒
|
|
@@ -266,6 +266,16 @@ Menu 批量请求遇到真实权限拒绝仍整体拒绝并停止执行,不会
|
|
|
266
266
|
- 通用凭证配置按各自字段规则处理;Provider 的 `common.baseUrl` / `common.apiKey` 支持上述整字段 `$VAR` / `${VAR}` 引用,CLI 读命令永不展开、不泄露环境变量值
|
|
267
267
|
- `.env` 全程禁读写
|
|
268
268
|
|
|
269
|
+
## 审批失败诊断
|
|
270
|
+
|
|
271
|
+
- 只有审批人明确选择拒绝时才使用 `user_approval_denied`;后端的裸 `deny` 或历史 `user approval denied` 文案不构成人工拒绝证据。
|
|
272
|
+
- 审批结果保留 `decisionSource`、`policyCode`、`errorDetailCode`、`reason`、`requestId`。Codex 的原生请求与网关请求分别通过 `requestId` 和 `approvalRequestId` 关联。
|
|
273
|
+
- `NO_AGENT_OWNER_CONFIGURED` / `NO_AGENT_MANAGER_CONFIGURED` 表示未确定审批人;`OWNER_APPROVAL_CHANNEL_UNAVAILABLE` 表示 owner 的接收渠道不可用,不能显示为审批人不可用。
|
|
274
|
+
- `APPROVAL_GATEWAY_UNAVAILABLE`、`APPROVAL_PROMPT_UNAVAILABLE`、`APPROVAL_ROUTER_UNAVAILABLE` 分别表示网关、发送回调和交互路由缺失;`DELIVERY_FAILED` 表示请求投递失败。
|
|
275
|
+
- `APPROVER_REAUTHORIZATION_FAILED` 等身份错误、审批超时、取消和中断各自保留独立诊断;未知原因使用 `APPROVAL_FAILURE_UNKNOWN`,不猜测人工或渠道原因。
|
|
276
|
+
- 已知审批人和渠道标识保留在结构化工具结果与审批审计中;底层发送错误日志包含对应的网关请求 ID。状态消息区分等待审批、审批通过与具体失败。
|
|
277
|
+
- 跨目录审批展示工作区、目标文件及授权范围。没有得到有效授权时仍不执行;审批人离线不直接视作审批不可用。
|
|
278
|
+
|
|
269
279
|
## 通用约定
|
|
270
280
|
|
|
271
281
|
- `--format json` — 所有子命令通用
|