evolcore 0.0.45 → 0.0.47
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 +113 -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 +22 -6
- package/dist/agents/codex/app-server-client.js +34 -27
- 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/group/fs-download.js +1 -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 +675 -120
- package/dist/channels/daemon.js +1 -1
- 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 +42 -56
- package/dist/cli/daemon-lifecycle-client.js +55 -19
- 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-channel.js +2 -2
- package/dist/cli/init.js +57 -21
- 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 +135 -46
- package/dist/cli/services-command.js +28 -5
- package/dist/cli/task-context.js +83 -15
- package/dist/cli/upgrade-command.js +4 -2
- package/dist/config/config-field-policy.js +24 -0
- package/dist/config/config-manager.js +49 -19
- package/dist/config/peer-book-store.js +167 -127
- package/dist/config/peer-role-resolver.js +24 -4
- package/dist/config/provider-identity-migration.js +158 -6
- 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/schema-migration.js +123 -16
- package/dist/config/schema-registry.js +6 -2
- 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 +91 -43
- package/dist/core/auth/agent-delegation.js +13 -3
- package/dist/core/auth/delegation-diagnostics.js +56 -15
- package/dist/core/auth/operation-authorizer.js +2 -2
- 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 +39 -12
- package/dist/core/command/menu-protocol.js +8 -16
- package/dist/core/command/skill-slash.js +6 -2
- package/dist/core/command/slash-handler.js +4 -6
- 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-bootstrap.js +11 -9
- package/dist/core/daemon-control.js +4 -7
- package/dist/core/daemon-lifecycle.js +189 -143
- package/dist/core/evolagent-registry.js +50 -2
- 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/host-snapshot.js +9 -4
- package/dist/core/inference/text-inference.js +12 -2
- package/dist/core/initialization/service.js +22 -4
- package/dist/core/invoke/invoke-service.js +24 -3
- package/dist/core/ipc-registration.js +7 -3
- package/dist/core/memory/consolidation.js +6 -6
- 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/ownership/owner-resolver.js +27 -10
- 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/relation/peer-identity.js +5 -1
- package/dist/core/relation/same-owner-proof.js +2 -1
- package/dist/core/session/adapters/claude-session-file-adapter.js +1 -1
- package/dist/core/session/session-file-health.js +36 -7
- 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/task/task-image-resources.js +1 -1
- 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 +65 -16
- package/dist/ecweb/runtime/supervisor.js +79 -50
- 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 +132 -75
- package/dist/ipc.js +35 -8
- 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 +18 -4
- package/dist/trigger/script-sandbox.js +39 -2
- package/dist/trigger/state.js +7 -0
- package/dist/utils/aid-bind.js +155 -18
- package/dist/utils/atomic-write.js +3 -3
- package/dist/utils/cross-platform.js +59 -16
- package/dist/utils/error-utils.js +26 -1
- package/dist/utils/instance-registry.js +94 -35
- package/dist/utils/process-introspect.js +187 -27
- package/dist/utils/project-path.js +47 -3
- package/dist/utils/upgrade-jobs.js +4 -4
- 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/aid.md +3 -1
- 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 +17 -5
- 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
|
@@ -3,6 +3,24 @@ import path from 'node:path';
|
|
|
3
3
|
import { execFile, spawnSync } from 'node:child_process';
|
|
4
4
|
import { promisify } from 'node:util';
|
|
5
5
|
const execFileAsync = promisify(execFile);
|
|
6
|
+
export class WindowsShellTrustError extends Error {
|
|
7
|
+
reason;
|
|
8
|
+
diagnostics;
|
|
9
|
+
code = 'WINDOWS_SHELL_TRUST_FAILED';
|
|
10
|
+
constructor(reason, detail, diagnostics = {}, cause) {
|
|
11
|
+
super(`Windows CLI 启动校验失败 [WINDOWS_SHELL_TRUST_FAILED:${reason}]:${detail}`, { cause });
|
|
12
|
+
this.reason = reason;
|
|
13
|
+
this.diagnostics = diagnostics;
|
|
14
|
+
this.name = 'WindowsShellTrustError';
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
/** Also recognize errors after runners have serialized them to plain text. */
|
|
18
|
+
export function isWindowsShellTrustError(error) {
|
|
19
|
+
const record = error;
|
|
20
|
+
return record?.code === 'WINDOWS_SHELL_TRUST_FAILED'
|
|
21
|
+
|| String(record?.message ?? error ?? '').includes('[WINDOWS_SHELL_TRUST_FAILED:');
|
|
22
|
+
}
|
|
23
|
+
const SIGNATURE_PROBE_TIMEOUT_MS = 5_000;
|
|
6
24
|
const MAX_CACHE_ENTRIES = 128;
|
|
7
25
|
const signatureCache = new Map();
|
|
8
26
|
const pendingCmdSignatures = new Map();
|
|
@@ -126,31 +144,91 @@ function authenticodeScript(filePath) {
|
|
|
126
144
|
'} | ConvertTo-Json -Compress',
|
|
127
145
|
].join('\n');
|
|
128
146
|
}
|
|
147
|
+
function signatureProbeFailure(filePath, result) {
|
|
148
|
+
const cause = result.error;
|
|
149
|
+
const timedOut = cause?.code === 'ETIMEDOUT' || (cause?.killed && result.signal === 'SIGTERM');
|
|
150
|
+
const startFailed = cause?.syscall?.startsWith('spawn')
|
|
151
|
+
|| ['ENOENT', 'EACCES', 'EPERM'].includes(cause?.code ?? '');
|
|
152
|
+
const reason = timedOut ? 'SIGNATURE_PROBE_TIMEOUT'
|
|
153
|
+
: startFailed ? 'POWERSHELL_START_FAILED' : 'SIGNATURE_PROBE_FAILED';
|
|
154
|
+
const detail = timedOut ? `签名检查超过 ${SIGNATURE_PROBE_TIMEOUT_MS} 毫秒:${filePath}`
|
|
155
|
+
: reason === 'POWERSHELL_START_FAILED'
|
|
156
|
+
? `无法启动签名检查程序 ${systemPowerShellPath()}(${cause?.code})`
|
|
157
|
+
: `签名检查程序执行失败:${filePath}(退出码 ${result.status ?? '未知'},信号 ${result.signal ?? '无'})`;
|
|
158
|
+
return new WindowsShellTrustError(reason, detail, {
|
|
159
|
+
path: filePath, probePath: systemPowerShellPath(), timeoutMs: SIGNATURE_PROBE_TIMEOUT_MS,
|
|
160
|
+
exitCode: result.status, signal: result.signal, causeCode: cause?.code, causeMessage: cause?.message,
|
|
161
|
+
stdout: String(result.stdout ?? ''), stderr: String(result.stderr ?? ''),
|
|
162
|
+
}, cause);
|
|
163
|
+
}
|
|
129
164
|
function probeAuthenticode(filePath) {
|
|
130
165
|
const result = spawnSync(systemPowerShellPath(), [
|
|
131
166
|
'-NoLogo', '-NoProfile', '-NonInteractive', '-Command', authenticodeScript(filePath),
|
|
132
167
|
], {
|
|
133
168
|
encoding: 'utf8',
|
|
134
169
|
env: systemPowerShellEnvironment(),
|
|
135
|
-
timeout:
|
|
170
|
+
timeout: SIGNATURE_PROBE_TIMEOUT_MS,
|
|
136
171
|
windowsHide: true,
|
|
137
|
-
stdio: ['ignore', 'pipe', '
|
|
172
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
138
173
|
});
|
|
139
|
-
if (result.status !== 0 || result.error
|
|
140
|
-
|
|
141
|
-
return parseAuthenticode(String(result.stdout));
|
|
174
|
+
if (result.status !== 0 || result.error)
|
|
175
|
+
throw signatureProbeFailure(filePath, result);
|
|
176
|
+
return parseAuthenticode(String(result.stdout ?? ''), filePath, String(result.stderr ?? ''));
|
|
142
177
|
}
|
|
143
|
-
function parseAuthenticode(output) {
|
|
178
|
+
function parseAuthenticode(output, filePath, stderr) {
|
|
144
179
|
try {
|
|
145
|
-
const parsed = JSON.parse(output);
|
|
180
|
+
const parsed = JSON.parse(output.replace(/^\uFEFF/, '').trim());
|
|
181
|
+
if (!parsed || Array.isArray(parsed) || typeof parsed.status !== 'string' || !parsed.status.trim()) {
|
|
182
|
+
throw new Error('签名结果缺少有效 status 字段');
|
|
183
|
+
}
|
|
146
184
|
return {
|
|
147
185
|
status: typeof parsed.status === 'string' ? parsed.status : undefined,
|
|
148
186
|
subject: typeof parsed.subject === 'string' ? parsed.subject : undefined,
|
|
149
187
|
issuer: typeof parsed.issuer === 'string' ? parsed.issuer : undefined,
|
|
188
|
+
stdout: output,
|
|
189
|
+
stderr,
|
|
190
|
+
probePath: systemPowerShellPath(),
|
|
150
191
|
};
|
|
151
192
|
}
|
|
152
|
-
catch {
|
|
153
|
-
|
|
193
|
+
catch (cause) {
|
|
194
|
+
throw new WindowsShellTrustError('SIGNATURE_OUTPUT_INVALID', `签名检查输出无法解析:${filePath}`, {
|
|
195
|
+
path: filePath, probePath: systemPowerShellPath(), stdout: output, stderr,
|
|
196
|
+
}, cause);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
function assertTrustedSignature(kind, filePath, evidence) {
|
|
200
|
+
if (isTrustedShellSignature(kind, evidence))
|
|
201
|
+
return;
|
|
202
|
+
const valid = isValidStatus(evidence.status);
|
|
203
|
+
throw new WindowsShellTrustError(valid ? 'SIGNER_UNTRUSTED' : 'SIGNATURE_INVALID', valid ? `签名发布者不受信任:${filePath}(${evidence.subject || '无签名证书'})`
|
|
204
|
+
: `数字签名未通过:${filePath}(状态 ${evidence.status})`, { path: filePath, ...evidence });
|
|
205
|
+
}
|
|
206
|
+
function shellFileStat(filePath) {
|
|
207
|
+
let stat;
|
|
208
|
+
try {
|
|
209
|
+
stat = fs.statSync(filePath);
|
|
210
|
+
}
|
|
211
|
+
catch (cause) {
|
|
212
|
+
throw fileAccessFailure(filePath, cause);
|
|
213
|
+
}
|
|
214
|
+
if (!stat.isFile()) {
|
|
215
|
+
throw new WindowsShellTrustError('NOT_A_FILE', `命令解释器路径不是文件:${filePath}`, { path: filePath });
|
|
216
|
+
}
|
|
217
|
+
return stat;
|
|
218
|
+
}
|
|
219
|
+
function fileAccessFailure(filePath, cause) {
|
|
220
|
+
const code = cause?.code;
|
|
221
|
+
return new WindowsShellTrustError('FILE_ACCESS_FAILED', `无法访问命令解释器:${filePath}(${code ?? '未知错误'})`, {
|
|
222
|
+
path: filePath, causeCode: code, causeMessage: cause instanceof Error ? cause.message : String(cause),
|
|
223
|
+
}, cause);
|
|
224
|
+
}
|
|
225
|
+
function rememberSignature(key, stat, error) {
|
|
226
|
+
signatureCache.set(key, { size: stat.size, mtimeMs: stat.mtimeMs, error });
|
|
227
|
+
while (signatureCache.size > MAX_CACHE_ENTRIES) {
|
|
228
|
+
const oldest = signatureCache.keys().next().value;
|
|
229
|
+
if (!oldest)
|
|
230
|
+
break;
|
|
231
|
+
signatureCache.delete(oldest);
|
|
154
232
|
}
|
|
155
233
|
}
|
|
156
234
|
function cacheKey(filePath) {
|
|
@@ -168,9 +246,19 @@ function cacheKey(filePath) {
|
|
|
168
246
|
export function isTrustedWindowsShellExecutable(executable, kind) {
|
|
169
247
|
if (process.platform !== 'win32')
|
|
170
248
|
return true;
|
|
171
|
-
|
|
172
|
-
|
|
249
|
+
try {
|
|
250
|
+
verifyWindowsShellExecutable(executable, kind);
|
|
251
|
+
return true;
|
|
252
|
+
}
|
|
253
|
+
catch {
|
|
173
254
|
return false;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
function verifyWindowsShellExecutable(executable, kind) {
|
|
258
|
+
const resolved = resolveShellPath(executable, kind);
|
|
259
|
+
if (!resolved) {
|
|
260
|
+
throw new WindowsShellTrustError('SHELL_PATH_UNRESOLVED', `无法解析命令解释器路径:${executable}`);
|
|
261
|
+
}
|
|
174
262
|
let finalPath = resolved;
|
|
175
263
|
try {
|
|
176
264
|
finalPath = fs.realpathSync.native(resolved);
|
|
@@ -182,31 +270,27 @@ export function isTrustedWindowsShellExecutable(executable, kind) {
|
|
|
182
270
|
// If realpath could not escape an App Execution Alias, do not authenticate
|
|
183
271
|
// the alias stub itself. A resolved WindowsApps package binary is allowed
|
|
184
272
|
// and is checked below like any other signed executable.
|
|
185
|
-
if (isAppExecutionAliasPath(finalPath))
|
|
186
|
-
|
|
187
|
-
let stat;
|
|
188
|
-
try {
|
|
189
|
-
stat = fs.statSync(finalPath);
|
|
190
|
-
if (!stat.isFile())
|
|
191
|
-
return false;
|
|
273
|
+
if (isAppExecutionAliasPath(finalPath)) {
|
|
274
|
+
throw new WindowsShellTrustError('APP_EXECUTION_ALIAS', `命令解释器仍指向应用执行别名:${finalPath}`, { path: finalPath });
|
|
192
275
|
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
}
|
|
196
|
-
const key = cacheKey(finalPath);
|
|
276
|
+
const stat = shellFileStat(finalPath);
|
|
277
|
+
const key = `${kind}:${cacheKey(finalPath)}`;
|
|
197
278
|
const previous = signatureCache.get(key);
|
|
198
279
|
if (previous && previous.size === stat.size && previous.mtimeMs === stat.mtimeMs) {
|
|
199
|
-
|
|
280
|
+
if (previous.error)
|
|
281
|
+
throw previous.error;
|
|
282
|
+
return finalPath;
|
|
200
283
|
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
284
|
+
try {
|
|
285
|
+
assertTrustedSignature(kind, finalPath, probeAuthenticode(finalPath));
|
|
286
|
+
rememberSignature(key, stat);
|
|
287
|
+
return finalPath;
|
|
288
|
+
}
|
|
289
|
+
catch (error) {
|
|
290
|
+
if (error instanceof WindowsShellTrustError)
|
|
291
|
+
rememberSignature(key, stat, error);
|
|
292
|
+
throw error;
|
|
208
293
|
}
|
|
209
|
-
return trusted;
|
|
210
294
|
}
|
|
211
295
|
/**
|
|
212
296
|
* Resolve an inherited ComSpec to the system cmd.exe and authenticate it.
|
|
@@ -214,90 +298,112 @@ export function isTrustedWindowsShellExecutable(executable, kind) {
|
|
|
214
298
|
* validates only the interpreter and never the `.cmd`/`.bat` target.
|
|
215
299
|
*/
|
|
216
300
|
export function resolveTrustedWindowsCmdPath(comSpec) {
|
|
301
|
+
try {
|
|
302
|
+
return requireTrustedWindowsCmdPath(comSpec);
|
|
303
|
+
}
|
|
304
|
+
catch {
|
|
305
|
+
return undefined;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
/** CLI launches require the full failure, while permission predicates retain their boolean API. */
|
|
309
|
+
export function requireTrustedWindowsCmdPath(comSpec) {
|
|
217
310
|
if (process.platform !== 'win32')
|
|
218
311
|
return comSpec || 'cmd.exe';
|
|
219
312
|
const systemReal = resolveWindowsCmdCandidate(comSpec);
|
|
220
|
-
return
|
|
313
|
+
return verifyWindowsShellExecutable(systemReal, 'cmd');
|
|
221
314
|
}
|
|
222
315
|
function resolveWindowsCmdCandidate(comSpec) {
|
|
223
316
|
const systemCmd = windowsSystemCmdPath();
|
|
224
317
|
const candidate = (comSpec || process.env.ComSpec || process.env.COMSPEC || systemCmd).trim();
|
|
225
|
-
|
|
226
|
-
return undefined;
|
|
318
|
+
const diagnostics = { candidatePath: candidate, systemPath: systemCmd };
|
|
227
319
|
let candidatePath = candidate;
|
|
228
320
|
if (!isAbsoluteWindowsPath(candidatePath)) {
|
|
229
321
|
if (/^cmd(?:\.exe)?$/i.test(candidatePath))
|
|
230
322
|
candidatePath = systemCmd;
|
|
231
323
|
else
|
|
232
|
-
|
|
324
|
+
throw new WindowsShellTrustError('CMD_PATH_INVALID', `ComSpec 不是有效的系统 cmd 路径:${candidate || '空值'}(预期 ${systemCmd})`, diagnostics);
|
|
233
325
|
}
|
|
234
326
|
let candidateReal;
|
|
235
327
|
let systemReal;
|
|
236
328
|
try {
|
|
237
329
|
candidateReal = fs.realpathSync.native(candidatePath);
|
|
330
|
+
}
|
|
331
|
+
catch (cause) {
|
|
332
|
+
throw fileAccessFailure(candidatePath, cause);
|
|
333
|
+
}
|
|
334
|
+
try {
|
|
238
335
|
systemReal = fs.realpathSync.native(systemCmd);
|
|
239
336
|
}
|
|
240
|
-
catch {
|
|
241
|
-
|
|
337
|
+
catch (cause) {
|
|
338
|
+
throw fileAccessFailure(systemCmd, cause);
|
|
242
339
|
}
|
|
243
340
|
if (path.win32.normalize(candidateReal).toLowerCase() !== path.win32.normalize(systemReal).toLowerCase()) {
|
|
244
|
-
|
|
341
|
+
throw new WindowsShellTrustError('CMD_PATH_MISMATCH', `ComSpec 指向 ${candidateReal},预期系统 cmd 为 ${systemReal}`, {
|
|
342
|
+
...diagnostics, candidateRealPath: candidateReal, systemRealPath: systemReal,
|
|
343
|
+
});
|
|
245
344
|
}
|
|
246
345
|
return systemReal;
|
|
247
346
|
}
|
|
248
347
|
/** Async probes keep the same system-path and signature policy without blocking I/O callbacks. */
|
|
249
348
|
export async function resolveTrustedWindowsCmdPathAsync(comSpec) {
|
|
250
|
-
if (process.platform !== 'win32')
|
|
251
|
-
return comSpec || 'cmd.exe';
|
|
252
|
-
const systemReal = resolveWindowsCmdCandidate(comSpec);
|
|
253
|
-
if (!systemReal || isAppExecutionAliasPath(systemReal))
|
|
254
|
-
return undefined;
|
|
255
|
-
let stat;
|
|
256
349
|
try {
|
|
257
|
-
|
|
258
|
-
if (!stat.isFile())
|
|
259
|
-
return undefined;
|
|
350
|
+
return await requireTrustedWindowsCmdPathAsync(comSpec);
|
|
260
351
|
}
|
|
261
352
|
catch {
|
|
262
353
|
return undefined;
|
|
263
354
|
}
|
|
264
|
-
|
|
355
|
+
}
|
|
356
|
+
export async function requireTrustedWindowsCmdPathAsync(comSpec) {
|
|
357
|
+
if (process.platform !== 'win32')
|
|
358
|
+
return comSpec || 'cmd.exe';
|
|
359
|
+
const systemReal = resolveWindowsCmdCandidate(comSpec);
|
|
360
|
+
if (isAppExecutionAliasPath(systemReal)) {
|
|
361
|
+
throw new WindowsShellTrustError('APP_EXECUTION_ALIAS', `命令解释器仍指向应用执行别名:${systemReal}`, { path: systemReal });
|
|
362
|
+
}
|
|
363
|
+
const stat = shellFileStat(systemReal);
|
|
364
|
+
const key = `cmd:${cacheKey(systemReal)}`;
|
|
265
365
|
const cached = signatureCache.get(key);
|
|
266
366
|
if (cached && cached.size === stat.size && cached.mtimeMs === stat.mtimeMs) {
|
|
267
|
-
|
|
367
|
+
if (cached.error)
|
|
368
|
+
throw cached.error;
|
|
369
|
+
return systemReal;
|
|
268
370
|
}
|
|
269
371
|
const identity = `${key}:${stat.size}:${stat.mtimeMs}:${stat.ctimeMs}`;
|
|
270
372
|
let pending = pendingCmdSignatures.get(identity);
|
|
271
373
|
if (!pending) {
|
|
272
374
|
const generation = signatureGeneration;
|
|
273
375
|
pending = (async () => {
|
|
376
|
+
let failure;
|
|
274
377
|
try {
|
|
275
|
-
const { stdout } = await execFileAsync(systemPowerShellPath(), [
|
|
378
|
+
const { stdout, stderr } = await execFileAsync(systemPowerShellPath(), [
|
|
276
379
|
'-NoLogo', '-NoProfile', '-NonInteractive', '-Command', authenticodeScript(systemReal),
|
|
277
|
-
], {
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
const
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
break;
|
|
289
|
-
signatureCache.delete(oldest);
|
|
290
|
-
}
|
|
291
|
-
return trusted;
|
|
380
|
+
], {
|
|
381
|
+
encoding: 'utf8', env: systemPowerShellEnvironment(), timeout: SIGNATURE_PROBE_TIMEOUT_MS, windowsHide: true,
|
|
382
|
+
});
|
|
383
|
+
assertTrustedSignature('cmd', systemReal, parseAuthenticode(stdout, systemReal, stderr));
|
|
384
|
+
}
|
|
385
|
+
catch (error) {
|
|
386
|
+
const result = error;
|
|
387
|
+
failure = error instanceof WindowsShellTrustError ? error : signatureProbeFailure(systemReal, {
|
|
388
|
+
error, status: typeof result.code === 'number' ? result.code : undefined,
|
|
389
|
+
signal: result.signal, stdout: result.stdout, stderr: result.stderr,
|
|
390
|
+
});
|
|
292
391
|
}
|
|
293
|
-
|
|
294
|
-
|
|
392
|
+
const current = shellFileStat(systemReal);
|
|
393
|
+
if (generation !== signatureGeneration || current.size !== stat.size
|
|
394
|
+
|| current.mtimeMs !== stat.mtimeMs || current.ctimeMs !== stat.ctimeMs
|
|
395
|
+
|| resolveWindowsCmdCandidate(comSpec) !== systemReal) {
|
|
396
|
+
throw new WindowsShellTrustError('TRUST_CHECK_CHANGED', `校验期间文件或信任上下文发生变化:${systemReal}`, { path: systemReal });
|
|
295
397
|
}
|
|
398
|
+
rememberSignature(key, stat, failure);
|
|
399
|
+
if (failure)
|
|
400
|
+
throw failure;
|
|
296
401
|
})();
|
|
297
402
|
pendingCmdSignatures.set(identity, pending);
|
|
298
403
|
}
|
|
299
404
|
try {
|
|
300
|
-
|
|
405
|
+
await pending;
|
|
406
|
+
return systemReal;
|
|
301
407
|
}
|
|
302
408
|
finally {
|
|
303
409
|
if (pendingCmdSignatures.get(identity) === pending)
|
|
@@ -49,7 +49,7 @@ evolcore 收到消息 → 构造一份 **vars**(运行时变量,见下)→
|
|
|
49
49
|
渲染时按 `session.sessionType`(缺省 `'main'`)依次查:`sessionManifests` 覆盖 → 内置映射 → `eck_manifest.json`(`resolveSessionManifest`)。bootstrapping 阶段固定用 `eck_manifest.json`。
|
|
50
50
|
**每个 manifest 文件各自两级合并**(`$KITS/<file>` + `$ECK/<file>`),互不干扰。
|
|
51
51
|
|
|
52
|
-
`chatMode` 只支持 interactive/proactive,均复用按生命周期、sessionType 和 sessionManifests 选择的 system/message manifest 与基础 vars。派生变量 `activePush` 仅在 proactive 时为 true,工具门禁变量也按 proactive 注入。PA 身份不改变 Agent 可见的模式、manifest 或 vars;仅在 active AUN 人类 Owner 私聊主会话及话题中,将 PA 的 proactive 过程 activity 经 message.send 可靠投递,任务成功提交后的自动最终正文为 custom/agent_final。其他 proactive 场景使用 thought.put,群聊固定 proactive
|
|
52
|
+
`chatMode` 只支持 interactive/proactive,均复用按生命周期、sessionType 和 sessionManifests 选择的 system/message manifest 与基础 vars。派生变量 `activePush` 仅在 proactive 时为 true,工具门禁变量也按 proactive 注入。PA 身份不改变 Agent 可见的模式、manifest 或 vars;仅在 active AUN 人类 Owner 私聊主会话及话题中,将 PA 的 proactive 过程 activity 经 message.send 可靠投递,任务成功提交后的自动最终正文为 custom/agent_final。其他 proactive 场景使用 thought.put,群聊固定 proactive。默认逐条消息信封显示本轮可信 chatType/chatMode,并携带发送者身份、`与发言人` 角色、消息 ID 与来源话题;两种模式均不展示明文/密文标签;原始 encrypted 变量及发送加密语义不变。
|
|
53
53
|
|
|
54
54
|
## section 字段
|
|
55
55
|
|
|
@@ -193,7 +193,7 @@ manifest 是 `{ "$schema_version": 1, "sections": [...] }`。每个 section:
|
|
|
193
193
|
改加载条件(仅 owner/admin 才载入对端档案):
|
|
194
194
|
|
|
195
195
|
```json
|
|
196
|
-
{ "sections": [ { "id": "peer-profile", "when": { "var": "
|
|
196
|
+
{ "sections": [ { "id": "peer-profile", "when": { "var": "speakerRelation", "in": ["owner", "admin"] } } ] }
|
|
197
197
|
```
|
|
198
198
|
|
|
199
199
|
新增自定义段:
|
|
@@ -273,7 +273,7 @@ vars 由 evolcore 在 `message-processor.ts` 按当前会话构造。分两类
|
|
|
273
273
|
| `selfAid` / `selfName` | 当前 agent 身份 |
|
|
274
274
|
| `hasPersona` | 是否有自我定义内容(soul/ 下除指南外有非空文件) |
|
|
275
275
|
| `peerId` / `peerKey` / `peerName` | 对端原生 ID / 跨渠道键 / 显示名 |
|
|
276
|
-
| `
|
|
276
|
+
| `speakerRelation` / `peerType` | 发言人与我的关系角色(owner/admin/member/visitor/自定义角色/none)/ 类型(human/agent) |
|
|
277
277
|
| `groupId` | 群 ID(群聊时) |
|
|
278
278
|
| `chatType` | `private` / `group` / `null`(coding) |
|
|
279
279
|
| `channel` | 渠道类型(aun/feishu/...)|
|
|
@@ -4,24 +4,35 @@
|
|
|
4
4
|
|
|
5
5
|
## Agent 模板
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
单成员、多成员共用 `ec agent template`。新建支持一个或多个成员,只创建成员 AID,沿用本机 Host 和经鉴权的 Owner;覆盖仅支持一个已有 Agent,保留其 AID、Owner、角色和默认项目目录。打包不带记忆、消息、私钥或 Provider 凭证;导入的 Trigger 默认停用并携带脚本。来源采集和覆盖要求操作者同时是 DaemonOwner 和对应 Agent 的协议 Owner。
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
|
-
ec agent template inspect
|
|
11
|
-
ec agent template build
|
|
12
|
-
ec agent template push
|
|
13
|
-
ec agent template pull
|
|
14
|
-
ec agent template
|
|
10
|
+
ec agent template inspect --input-file inspect.json --request-id <稳定ID>
|
|
11
|
+
ec agent template build --input-file build.json --request-id <稳定ID>
|
|
12
|
+
ec agent template push --input-file push.json --request-id <稳定ID>
|
|
13
|
+
ec agent template pull --input-file pull.json --request-id <稳定ID>
|
|
14
|
+
ec agent template preview --input-file preview.json --request-id <稳定ID>
|
|
15
|
+
ec agent template deploy --preview-id <previewId> --plan-digest sha256:<摘要> --request-id <稳定ID>
|
|
15
16
|
ec agent template status <jobId>
|
|
17
|
+
ec agent template status --request-id <原请求ID>
|
|
18
|
+
ec agent template resume <jobId> --request-id <本次恢复ID>
|
|
19
|
+
ec agent template cancel <jobId> --request-id <本次取消ID>
|
|
20
|
+
ec agent template capabilities
|
|
16
21
|
```
|
|
17
22
|
|
|
18
|
-
|
|
23
|
+
`inspect/build/push/pull/preview` 的业务参数通过 JSON 文件传入。`capabilities` 返回动作输入 schema、状态及平台能力;文件模板沿用原 v1 的 `agents[]/key`、PACKAGE/MANIFEST 和资源结构。Core 作业以成员 key 关联,不按数组位置配对。Menu 使用进程级 `name: "template"`,动作与 CLI 一致;查询使用 `args.view: "job"` 或 `"capabilities"`。
|
|
19
24
|
|
|
20
|
-
|
|
25
|
+
inspect 输入示例:`{"members":{"writer":{"source":{"kind":"agent","aid":"writer.agentid.cn"}}}}`。全组必须空闲,任一忙碌立即返回 AGENT_BUSY;成功后冻结任务启动与 Trigger,无确认操作 15 分钟自动释放,查询不续期。build 承接 inspectionJobId、inventoryDigest、metadata 和各成员 include;接管后由构建作业持有冻结直到结束,取消统一使用 jobId。
|
|
21
26
|
|
|
22
|
-
|
|
27
|
+
完整选项用 `ec agent template --help` 查看。上传前由 App 以 Owner 身份授予来源 Host 目录读写权限,SDK 上传需读取元数据;普通私有下载使用 `storage.create_share_link.allowed_aids` 指定目标 Host,pull 的 source 带 location、分享短码和摘要。Owner/subaid 动态授权等待新 SDK;daemon 不代设权限,模板签名延期。
|
|
23
28
|
|
|
24
|
-
|
|
29
|
+
preview 传 packageId、installMode 和成员 key → target/providers/externalAids。新建目标示例:`{"members":{"writer":{"target":{"aid":"auto","project":"/work/writer"},"providers":{"ecagent":{"provider":"provider-12345678","model":"model-a"}}}}}`;aid=auto 时另传 issuer。预览不注册身份;deploy 只引用可执行 previewId 和 planDigest。多成员必须全部新建,不提供已有成员配对。
|
|
30
|
+
|
|
31
|
+
异步命令默认 `--wait 0`,可设 0..300 秒,超时不取消作业。失败/取消退出码 1、参数错误 2、暂停或等待超时 3。先以原 requestId 或 jobId 查询,再恢复原作业,不用新部署请求重试未知结果。Menu 事件统一为 `template.job`,seq 单调递增;状态包括 queued/running/paused/failed/cancelling/cancelled/succeeded。
|
|
32
|
+
|
|
33
|
+
成员注册和 Owner 绑定使用随包的 `scripts/aid-batch/identity-batch.mjs`,持久检查点保存原操作与收据;Owner 待确认时暂停,恢复不重复注册或绑定。全组准备并验证后才提交并开放任务;取消保留已创建身份。覆盖失败恢复本次实际写入的文件与名片,恢复未确认时保持目标暂停。
|
|
34
|
+
|
|
35
|
+
工具随包位于 `scripts/agent-template/`;本机 CLI 经控制令牌 IPC,托管 CLI 经原委派通道,Menu 发往 Host Control AID。远端 Menu 不读取任意本机路径。Provider 模型通过进程级 model Menu 的 catalog 查询;作业 readiness 分别表示运行、名录和团队就绪,不以本地成员表代替 Owner 名录授权。接口细节及当前验收边界见 `docs/agent-template/agent-template-app-integration.md`。真实容器已验证注册/绑定/Storage/恢复及覆盖;App 界面、真实模型推理和名录互聊待验收。
|
|
25
36
|
|
|
26
37
|
## 子命令
|
|
27
38
|
|
|
@@ -100,6 +111,13 @@ ec agent reload [aid]
|
|
|
100
111
|
ec agent delete <aid> [--purge]
|
|
101
112
|
```
|
|
102
113
|
|
|
114
|
+
停用和删除按目标 AID 清理运行状态。配置文件已缺失而 daemon 仍持有该 Agent 时,停用会清除
|
|
115
|
+
残留并返回 `configMissing: true`,不会重建配置;两处都不存在时停用返回 `NOT_FOUND`。
|
|
116
|
+
删除允许重复执行,配置和运行实例均不存在也返回成功。普通删除保留个人数据,`--purge`
|
|
117
|
+
继续按原范围清除数据。忙碌拒绝发生在删文件之前;卸载失败返回具体错误,可在排除故障后重试。
|
|
118
|
+
宿主 CLI 在线时经本地控制令牌调用同一应用服务,仅在 daemon 明确未运行时使用离线文件操作;
|
|
119
|
+
请求超时不会自动转为离线删除。
|
|
120
|
+
|
|
103
121
|
## 创建模式与参数
|
|
104
122
|
|
|
105
123
|
`welcome --text`、创建时的 `--description` / `--persona-text` 按一次 `\n` / `\r` / `\t` / `\\` 解码;已传入的物理换行保留。不要使用 PowerShell 反引号换行转义;Windows PowerShell 中直接使用命令名,不要用批处理入口传物理多行。文件、路径、`--tags` JSON 不解码;`--name` / `rename` 名称不允许换行。
|
|
@@ -139,7 +139,9 @@ Owner 目录同步在连接可用时建立单条核验和暂态故障退避链
|
|
|
139
139
|
|
|
140
140
|
Ownership 任务事件、修改本地 Owner 配置、相关名片或 Owner 关系材料变更只失效缓存,不主动发起复核。连接首次就绪、断线恢复和缓存到期均不触发提前刷新;下次实际消息、查询或授权需要 Owner 时才等待核验。相同任务事件和连接通知去重,无关对端、普通文件变更不触发失效。远端 Owner 的 Storage 事件只在本机确实收到时生效,不能假定事件完整覆盖远端变化。Owner 绑定提交前及修改 Owner 的授权仍要求显式核验成功。
|
|
141
141
|
|
|
142
|
-
|
|
142
|
+
普通 Agent 在 AUN 连接就绪后,优先取根级 `config.json.owner`,缺失时兼容旧 `owners` 数组的首个非空 AID;沿用首个配置 Owner 的选择规则,不向数组内所有 AID 发送邀约。`created`、`ownerpending`、`bootstrapping` 和保留旧绑定目标的 `active` Agent 均参与检查;没有目标或生命周期无效时静默跳过。存在绑定目标且新鲜协议状态为 `unbound`、`released` 或 `single_sided` 时,每个 Agent 对同一 Owner 在本进程内最多进入一次 SDK 绑定变更。已有协议共识时不提交,也不自动转让 Owner。准备期间预留并发占位,实际进入 SDK 变更前才消耗次数并记录 INFO 日志 `Submitting configured Owner binding invitation`;目标身份核验、最终共识查询或连接校验失败且尚未进入 SDK 时释放占位,可在后续连接就绪时重新检查,不安排定时重试。进入 SDK 后的失败或回执不明继续保留次数,断线重连和渠道重建不重发。提交结果与失败沿用 `EC_OWNERSHIP` 的 `bind.result` / `bind.failed`。自动尝试记录仅在内存中,进程重启后可重新检查;新版一次性初始化另按持久提交记录恢复,已提交或结果不明时只核验共识,不重复发送。
|
|
143
|
+
|
|
144
|
+
App 的 `type: bind.request` 是扫码请求适配入口,先核验加密信封、扫码令牌、固定主体和请求指纹,再与 CLI 一样调用 `OwnerResolver.bind`,由 SDK 发送标准 `type: aun.ownership.sdk.v1` 协议邀约。普通 daemon 与 bootstrap 控制通道使用同一个适配器,不再一律返回 `OWNERSHIP_APP_DEFERRED`。同一扫码会话的并发与重放请求复用原结果,SDK 变更后的未知回执不重发;`bind.response.success` 只表示受理,只有实时共识确认目标 Owner、sub 和 `lock=locked` 才返回 `bound`。控制通道的 `pureIdentity` 不拦截 SDK 协议邀约,仍不参与普通 Agent 的配置补绑。
|
|
143
145
|
|
|
144
146
|
普通 Agent 的创建、手动绑定、启动补绑定和转让,在提交关系修改前实时读取目标 Owner 的远端已验签名片,要求名片 AID 匹配且 `type: human`;非 human 返回 `INVALID_OWNER`,无法读取、未验签、类型缺失或名片不匹配返回 `OWNER_IDENTITY_UNAVAILABLE`。接受绑定或转让邀约也执行此限制;当前进程没有请求投影时,先从历史消息定位原请求的目标用于类型预检,原请求真实性及固定参与方仍由 SDK 在提交时核验。拒绝邀约不受目标类型限制。该限制面向普通 Agent,不把 daemon Control AID 的身份规则改成 Agent 规则,也不追溯修改已有协议关系。
|
|
145
147
|
|
|
@@ -64,6 +64,28 @@ ec config init [--self <aid>] [--peer <X>] [--default] [--process]
|
|
|
64
64
|
- 实际连接时,变量未设置或为空会报错;`baseUrl` 解析后仍必须是 HTTP(S) URL,服务路径仍必须保持在公共 origin 内。
|
|
65
65
|
- 使用变量 `baseUrl` 时不会根据 hostname 自动命名或按 hostname 自动合并 Provider;请显式填写 `name`。
|
|
66
66
|
|
|
67
|
+
## 默认项目根目录环境变量引用
|
|
68
|
+
|
|
69
|
+
`agents/defaults.json` 的 `projects.defaultPath` 支持绝对路径,以及 `$VAR`、`${VAR}` 环境变量引用和路径拼接:
|
|
70
|
+
|
|
71
|
+
```json
|
|
72
|
+
{
|
|
73
|
+
"projects": {
|
|
74
|
+
"defaultPath": "${EVOLCORE_PROJECT_ROOT}/projects"
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
- 变量名可以自定义;仅配置显式引用时生效,没有环境变量覆盖配置的额外优先级。
|
|
80
|
+
- 配置读取、合并、CLI 查询、快照和 Web 设置保留引用原文;实际使用路径时从执行进程的 `process.env` 解析。
|
|
81
|
+
- 支持整字段引用,也支持 `${ROOT}/projects`、`$ROOT/projects`、`${ROOT}/${TEAM}/projects`、`/data/${TEAM}/projects` 等拼接;变量可以是目录根或路径片段,最终结果必须是绝对路径。
|
|
82
|
+
- 每个引用的变量未设置或为空、含嵌套引用,或最终结果不是绝对路径时明确报错,不回退默认目录。
|
|
83
|
+
- `$ROOT_suffix` 表示变量 `ROOT_suffix`;需要给 `ROOT` 的值追加 `_suffix` 时写 `${ROOT}_suffix`。
|
|
84
|
+
- 只替换一轮;不支持 `${VAR:-default}` 等 Shell 默认值、递归替换或旧 `$ENV:NAME`。
|
|
85
|
+
- daemon 启动加载的全局 `.env` 可补充进程环境,已有进程变量优先;独立 CLI 必须自行获得相应环境变量。
|
|
86
|
+
- 新建 Agent 仍在根目录下按 AID 派生并保存具体项目路径;已有 Agent 的显式路径及已有会话目录保持不变,不自动迁移。
|
|
87
|
+
- 未配置该字段时沿用现有默认目录;既有普通绝对路径无需修改。环境变量引用配置需要支持本功能的版本,旧版本不能保证识别。
|
|
88
|
+
|
|
67
89
|
## 快照 / 回滚
|
|
68
90
|
|
|
69
91
|
总开关直接保存在 `$EVOLCORE_HOME/daemon.json` 顶层,默认 `true`:
|
|
@@ -13,7 +13,7 @@ Agent 侧可以查询或向 Owner 发送入录申请,不能直接增删名录
|
|
|
13
13
|
命令与 `ec skill` 对齐:**`list` 列举/过滤,`info` 看单条详情**。
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
ec directory list [<关键词>...] [--filter '<kw1,kw2>']... [--type <type>] [--scope internal|external|pa-team|all] [--owner <aid|unbound>] [--limit <n>] [--page <n>] [--format json]
|
|
16
|
+
ec directory list [<关键词>...] [--filter '<kw1,kw2>']... [--type <type>] [--scope internal|external|pa-team|my-agent-team|all] [--owner <aid|unbound>] [--limit <n>] [--page <n>] [--format json]
|
|
17
17
|
ec directory info <contact-aid|名字> [--limit <n>] [--format json]
|
|
18
18
|
ec directory refresh [--format json]
|
|
19
19
|
ec directory blocked [--format json]
|
|
@@ -58,10 +58,24 @@ Evol App 中处理该申请,并把目标加入联系人名录、允许本 Agen
|
|
|
58
58
|
多个 `--filter` 之间为 AND**;
|
|
59
59
|
- 位置参数(`list 张三 采购`):保留旧 `find` 的语义,多个词**同时命中**(AND)。
|
|
60
60
|
|
|
61
|
-
其它过滤:`--type`、`--scope internal|external|pa-team|all`(默认 `all
|
|
62
|
-
只列 `open_pa_context` 里且已核验的成员)、
|
|
61
|
+
其它过滤:`--type`、`--scope internal|external|pa-team|my-agent-team|all`(默认 `all`)、
|
|
63
62
|
`--owner <aid|unbound>`(按条目归属过滤,`unbound` 只列没有 `owner_aid` 的条目)。
|
|
64
63
|
|
|
64
|
+
`--scope` 的取值:
|
|
65
|
+
|
|
66
|
+
| 值 | 含义 |
|
|
67
|
+
|---|---|
|
|
68
|
+
| `internal` | 内部联系人(见「归属核验」) |
|
|
69
|
+
| `external` | 外部条目 |
|
|
70
|
+
| `pa-team` | `open_pa_context` 里且 `ownership_status=owned` 的成员 |
|
|
71
|
+
| `my-agent-team` | `config.team` 里的成员,**以名单为准** |
|
|
72
|
+
| `all` | 不过滤,等同不传 |
|
|
73
|
+
|
|
74
|
+
`my-agent-team` 与另外三个**不是同一类筛法**:那三个是"名录的子集",这个是一份独立
|
|
75
|
+
名单。所以顺序是名单顺序(不是内部优先排序),且**名录里已经没有的残留成员也会列出**——
|
|
76
|
+
这种条目只有 `AID`、`ownerAid` 为 `null`,用来排查"配了但联系不上"。
|
|
77
|
+
`all` 仍然只遍历名录条目,不会带出 `config.team` 里名录外的 AID。
|
|
78
|
+
|
|
65
79
|
**黑名单**:`blocked_aids` 里的主体不会出现在注入的 `directory.md` 里,也不该被
|
|
66
80
|
主动联系;名单本身用 `ec directory blocked` 查。
|
|
67
81
|
|
|
@@ -198,18 +212,38 @@ updated_at: <unix 秒>
|
|
|
198
212
|
| `name_with_aid` | 名字 \| 备注名 \| AID | 内部联系人(PA Team 之外) |
|
|
199
213
|
| `name_no_aid` | 名字 \| 备注名 | 外部 Agent / 外部人类 / 加入的群 / 其他 / 白名单 |
|
|
200
214
|
|
|
201
|
-
###
|
|
215
|
+
### 九个分组
|
|
202
216
|
|
|
203
217
|
| 顺序 | 分组 | 判据 | 形态 |
|
|
204
218
|
|---|---|---|---|
|
|
205
219
|
| 固定 | Owner / 个人助理 / 我 | 顶层身份块 + 自己 | 名字 \| 备注名 \| AID |
|
|
206
|
-
| 1 | **
|
|
207
|
-
| 2 |
|
|
208
|
-
| 3 |
|
|
209
|
-
| 4 |
|
|
210
|
-
| 5 |
|
|
211
|
-
| 6 |
|
|
212
|
-
| 7 |
|
|
220
|
+
| 1 | **My Agent Team** | `aid ∈ config.team` | `full`(异常行只有 AID + 状态) |
|
|
221
|
+
| 2 | **PA Team** | `aid ∈ open_pa_context` 且 `ownership_status=owned` | `full` |
|
|
222
|
+
| 3 | 内部联系人(其余) | 内部且不在 My Agent Team / PA Team | `name_with_aid` |
|
|
223
|
+
| 4 | 外部 Agent | `classifyEntry` = `external_agent` | `name_no_aid` |
|
|
224
|
+
| 5 | 外部人类 | `classifyEntry` = `external_human` | `name_no_aid` |
|
|
225
|
+
| 6 | 加入的群 | `type=group` | `name_no_aid` |
|
|
226
|
+
| 7 | 其他 | 类型未知 / 归属未核实 / 无 owner | `name_no_aid`,附「不要主动联系」 |
|
|
227
|
+
| 8 | 白名单 | `allowedAids` 命中且不在 1–7 组 | `name_no_aid` |
|
|
228
|
+
|
|
229
|
+
**My Agent Team 判据**:本 Agent 自己 `config.json` 里的 `team` 数组,由 Owner 在
|
|
230
|
+
Evol App 的 Team Workspace 里维护(Menu protocol 写入),是**每个 Agent 都能有的
|
|
231
|
+
自有团队**,不是只有个人助理才有。
|
|
232
|
+
|
|
233
|
+
- **以名单为准,不是名录的子集**:渲染按 `config.team` 遍历,名录里有的成员走
|
|
234
|
+
`full`;名录里没有的、或条目没有 `owner_aid` 的,只列 `AID | 不在联系人中` /
|
|
235
|
+
`AID | 未绑定 Owner`,并在组提示里报数。这是"配了但用不了"的诊断信息,不能静默丢弃。
|
|
236
|
+
- **不受准入开关控制**:`allowExternalContacts` / `allowAllContacts` 都不影响这一组。
|
|
237
|
+
外部 agent 进了名单照样 `full` 渲染——名单是 Owner 亲手加的,比准入开关更明确。
|
|
238
|
+
- **黑名单优先**:被拉黑的主体一条都不出现,`directory.md` 里不出现任何黑名单成员。
|
|
239
|
+
- **最多渲染 50 人**:超出部分**整条不渲染**(连名字也不留),只在提示里报总数。
|
|
240
|
+
与 PA Team 的"降级为仅名字"不同——这份名单是本端自己的,少露几个人比挤掉预算划算。
|
|
241
|
+
- **与 PA Team 重叠时以前者为准**:同时出现在两份名单里的人只在 My Agent Team 里
|
|
242
|
+
完整渲染;PA Team 组里仍列名字,并说明「其中 N 人也在 My Agent Team 里,完整记录
|
|
243
|
+
已在上面的分组」——PA 下发的名单不能因为去重而看起来少了人。
|
|
244
|
+
- 写入校验(`ec team members update --members-json` / App 侧菜单):必须是 Owner 名录里的
|
|
245
|
+
agent / human / assistant、未被拉黑、**有 `owner_aid`**、不能是自己、最多 200 人。
|
|
246
|
+
改完立即重算 `directory.md`,不需要手动 refresh。
|
|
213
247
|
|
|
214
248
|
**PA Team 判据**:服务端在 `contacts.json` 顶层下发 `open_pa_context`(AID 数组)。
|
|
215
249
|
判据是**这个列表**,不再看 `exttype` 前缀。成员必须同时满足 `ownership_status=owned`,
|
|
@@ -225,7 +259,7 @@ PA Team 里,该组为空、不渲染;Owner 手动把某人移出团队清单
|
|
|
225
259
|
|
|
226
260
|
**白名单**是**准入控制清单**,不是联系人分组:命中的主体本来就能入站,这里只是让 PA
|
|
227
261
|
知道"有这么个通道"。因此白名单成员可能**根本不在联系人清单里**——那种情况下只给名字,
|
|
228
|
-
不展示 AID 与描述。与 1–
|
|
262
|
+
不展示 AID 与描述。与 1–7 组去重,一个人只出现一次。
|
|
229
263
|
|
|
230
264
|
**其他组**:`type` 不在协议 8 种之内(如 `ai`)、`type=agent` 但 `ownership_status !== 'owned'`、
|
|
231
265
|
或没有 `owner_aid` 的条目。只注入名字与备注名,不展示 AID、类型与描述,并明确提示
|
|
@@ -164,7 +164,7 @@ $AGENT_DIR/events/
|
|
|
164
164
|
| 超时 | 默认 30s,`timeoutMs` ∈ [1s, 300s] |
|
|
165
165
|
| 输出上限 | stdout+stderr 合计 1 MiB,超出终止 |
|
|
166
166
|
| 环境变量 | `EC_SELF_AID` / `EC_PACK_DIR` / `EC_EVENT` / `EC_EVENT_ID` / `EC_BUS` / `EC_PUBLISHER` |
|
|
167
|
-
| 密钥清理 |
|
|
167
|
+
| 密钥清理 | 固定名单(各家 base agent 的 API key)+ 按名字识别的凭据变量(`*_API_KEY` / `*_TOKEN` / `*_SECRET` / `*_PASSWORD`,以及 `AWS_` `GITHUB_` `NPM_` 等前缀)+ 全部 `EVOLCORE_*` |
|
|
168
168
|
| 沙箱 | 非 fullaccess 模式走 trigger 同款沙箱(cwd 为 agent 工程目录,脚本被快照执行);fullaccess 下 cwd 为包目录 |
|
|
169
169
|
| Windows | 沙箱模式需预置 codex 沙箱,未预置时报 `SCRIPT_SANDBOX_UNAVAILABLE`;`node` 运行时用本机 node.exe,`.mjs` 可跑 |
|
|
170
170
|
|
|
@@ -177,7 +177,7 @@ ec events status [<包名>] # 每包状态
|
|
|
177
177
|
ec events doctor <包名> # 白名单/脚本/路径/租约诊断
|
|
178
178
|
ec events ledger [<包名>] [--tail 20] # 台账(不传包名 = 中心台账:bus.start/stop、gate、rules 变更)
|
|
179
179
|
ec events tail <包名> # 事件日志
|
|
180
|
-
ec events reload
|
|
180
|
+
ec events reload # 手动重载(全量,不接受包名)
|
|
181
181
|
ec events rules add <事件> --publish <aid> [--deny]
|
|
182
182
|
ec events rules remove <事件> --publish <aid> [--deny]
|
|
183
183
|
ec events rules show [--event <事件>]
|
|
@@ -187,14 +187,14 @@ ec events pack list
|
|
|
187
187
|
ec events publish <包名> <事件名> --data '<json>'
|
|
188
188
|
```
|
|
189
189
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
`
|
|
190
|
+
**改完 `pack.json` / `events-config.json` 必须显式 `ec events reload`**——没有目录监听,
|
|
191
|
+
文件不会自己生效。(`reload` 托管任务内也可用;委托身份下仅限只读与 reload,
|
|
192
|
+
`rules` / `publish` 仅宿主终端。)
|
|
193
193
|
|
|
194
194
|
订阅生效与自愈的完整时机:
|
|
195
195
|
|
|
196
196
|
1. **agent 启动**:调度器启动即扫描 `events/` 并接入(authorize → 回调 → subscribe)。
|
|
197
|
-
2.
|
|
197
|
+
2. **手动 reload**:`ec events reload` 重新扫描全部包并按差集重建订阅(不重建连接)。
|
|
198
198
|
3. **contacts 变化**:`$pa` 等占位符在名录变化且解析结果真的改变时自动重解析重订阅。
|
|
199
199
|
4. **失败对账**:authorize/subscribe 失败按指数退避(5s→60s 封顶)自动重试,
|
|
200
200
|
连接恢复(state_change ready)即刻重试;台账只在失败与恢复两个时刻各记一条。
|