evolcore 0.0.43-test.5 → 0.0.43-test.7
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 +95 -0
- package/bin/ecmsg.js +281 -81
- package/dist/agents/baseagent-availability.js +20 -5
- package/dist/agents/baseagent.js +2 -2
- package/dist/agents/claude-runner.js +19 -4
- package/dist/agents/codex/app-server-client.js +36 -3
- package/dist/agents/codex-runner.js +75 -8
- package/dist/aun/group/invite-service.js +3 -2
- package/dist/aun/msg/p2p.js +6 -1
- package/dist/aun/service-proxy.js +18 -6
- package/dist/channels/aun.js +306 -30
- package/dist/cli/agent-create.js +18 -8
- package/dist/cli/aun-commands.js +9 -1
- package/dist/cli/daemon-commands.js +34 -65
- package/dist/cli/daemon-lifecycle-client.js +61 -0
- package/dist/cli/ecmsg-gateway.js +38 -3
- package/dist/cli/events-command.js +73 -0
- package/dist/cli/index.js +31 -14
- package/dist/cli/init.js +75 -0
- package/dist/cli/invoke-command.js +182 -0
- package/dist/cli/managed-command-guard.js +6 -1
- package/dist/cli/provider-command.js +1 -1
- package/dist/cli/restart-monitor.js +67 -50
- package/dist/cli/services-command.js +111 -0
- package/dist/cli/task-context.js +38 -1
- package/dist/cli/team-workspace-command.js +134 -0
- package/dist/cli/thread-command.js +6 -2
- package/dist/cli/watch-logs.js +6 -4
- package/dist/cli/watch-msg.js +1 -1
- package/dist/config/boot-log.js +6 -4
- package/dist/config/builtin-roles.js +2 -2
- package/dist/config/config-field-policy.js +2 -2
- package/dist/config/config-manager.js +1 -8
- package/dist/config/invoke-ipc-service.js +118 -0
- package/dist/config/peer-role-resolver.js +1 -1
- package/dist/config/provider-identity-migration.js +92 -17
- package/dist/config/provider-local-sync.js +2 -0
- package/dist/config/providers-config.js +13 -0
- package/dist/config/providers-management.js +100 -10
- package/dist/config/role-service.js +8 -8
- package/dist/config/role-store.js +22 -22
- package/dist/config/schema-migration.js +86 -88
- package/dist/config/snapshot.js +70 -41
- package/dist/config-store.js +2 -1
- package/dist/core/agent-reload-coordinator.js +6 -4
- package/dist/core/agent-runtime.js +146 -15
- package/dist/core/auth/delegation-authorization.js +66 -0
- package/dist/core/auth/operation-catalog.js +20 -0
- package/dist/core/baseagent-loader.js +75 -42
- package/dist/core/channel-loader.js +45 -13
- package/dist/core/channel-runtime.js +116 -45
- package/dist/core/command/agent-control.js +1 -1
- package/dist/core/command/agent-storage-menu.js +1 -1
- package/dist/core/command/chatmode-config.js +2 -36
- package/dist/core/command/command-handler.js +58 -16
- package/dist/core/command/data-root-resolver.js +32 -23
- package/dist/core/command/eventcenter-menu.js +338 -0
- package/dist/core/command/menu-catalog.js +8 -0
- package/dist/core/command/menu-handler.js +206 -87
- package/dist/core/command/menu-protocol.js +142 -22
- package/dist/core/command/menu-query-batch.js +194 -0
- package/dist/core/command/role-menu.js +27 -15
- package/dist/core/command/slash-gate.js +1 -1
- package/dist/core/command/slash-handler.js +34 -42
- package/dist/core/command/team-workspace-bootstrap.js +350 -0
- package/dist/core/command/{pa-workspace-calendar.js → team-workspace-calendar.js} +7 -7
- package/dist/core/command/team-workspace-initializer.js +2 -0
- package/dist/core/command/{pa-workspace-items.js → team-workspace-items.js} +83 -68
- package/dist/core/command/team-workspace-job-store.js +88 -0
- package/dist/core/command/team-workspace-management-service.js +2 -0
- package/dist/core/command/team-workspace-management-store.js +96 -0
- package/dist/core/command/team-workspace-management.js +265 -0
- package/dist/core/command/team-workspace-members-menu.js +88 -0
- package/dist/core/command/team-workspace-store.js +612 -0
- package/dist/core/command/team-workspace-team.js +193 -0
- package/dist/core/daemon-control.js +45 -15
- package/dist/core/daemon-lifecycle.js +478 -75
- package/dist/core/handoff/dispatcher.js +9 -3
- package/dist/core/handoff/runtime.js +130 -42
- package/dist/core/handoff/store.js +190 -2
- package/dist/core/handoff/types.js +5 -0
- package/dist/core/initialization/service.js +4 -4
- package/dist/core/invoke/executors/index.js +13 -0
- package/dist/core/invoke/executors/media.js +283 -0
- package/dist/core/invoke/executors/text.js +198 -0
- package/dist/core/invoke/invoke-service.js +157 -0
- package/dist/core/invoke/style-router.js +48 -0
- package/dist/core/invoke/types.js +19 -0
- package/dist/core/ipc-registration.js +51 -11
- package/dist/core/lifecycle-notice.js +10 -4
- package/dist/core/memory/consolidation.js +7 -5
- package/dist/core/message/aun-ipc-sender.js +149 -19
- package/dist/core/message/im-renderer.js +28 -84
- package/dist/core/message/message-bridge.js +57 -4
- package/dist/core/message/message-queue.js +46 -4
- package/dist/core/message/message-utils.js +10 -2
- package/dist/core/message/peer-mode.js +7 -34
- package/dist/core/message/pending-hints.js +4 -10
- package/dist/core/message/response-engine.js +163 -52
- package/dist/core/message/send-options.js +7 -4
- package/dist/core/message/send-routing.js +55 -7
- package/dist/core/ownership/owner-resolver.js +8 -0
- package/dist/core/permission/ec-command-parser.js +14 -3
- package/dist/core/permission/protected-paths.js +12 -2
- package/dist/core/permission/shell-environment.js +9 -0
- package/dist/core/session/adapters/claude-session-file-adapter.js +24 -0
- package/dist/core/session/adapters/codex-session-file-adapter.js +80 -0
- package/dist/core/session/adapters/ecagent-session-file-adapter.js +22 -0
- package/dist/core/session/adapters/gemini-session-file-adapter.js +39 -0
- package/dist/core/session/session-file-health.js +243 -0
- package/dist/core/session/session-fs-store.js +163 -3
- package/dist/core/session/session-idle-monitor.js +9 -1
- package/dist/core/session/session-manager.js +36 -2
- package/dist/core/task/task-recovery-service.js +13 -2
- package/dist/core/thread/command-parser.js +9 -2
- package/dist/core/thread/thread-operation.js +21 -2
- package/dist/core/thread/thread-route.js +13 -2
- package/dist/directory/owner-directory-admission.js +42 -30
- package/dist/directory/owner-directory-cache.js +143 -126
- package/dist/directory/owner-directory-query-operation.js +9 -8
- package/dist/eck/kit-renderer.js +7 -5
- package/dist/ecweb/basic-settings-service.js +1 -1
- package/dist/ecweb/message-context-service.js +0 -4
- package/dist/ecweb/runtime/lifecycle.js +14 -8
- package/dist/ecweb/runtime/supervisor.js +62 -30
- package/dist/event-center/admission-materializer.js +114 -0
- package/dist/event-center/bus-gate.js +136 -0
- package/dist/event-center/bus-host.js +290 -0
- package/dist/event-center/bus-resolver.js +120 -0
- package/dist/event-center/center-config.js +100 -0
- package/dist/event-center/client-factory.js +50 -0
- package/dist/event-center/daemon.js +45 -0
- package/dist/event-center/directory-source.js +53 -0
- package/dist/event-center/dispatcher.js +157 -0
- package/dist/event-center/event-log.js +110 -0
- package/dist/event-center/index-generator.js +63 -0
- package/dist/event-center/ipc-operation.js +308 -0
- package/dist/event-center/ledger.js +52 -0
- package/dist/event-center/pack-loader.js +202 -0
- package/dist/event-center/pack-manager.js +85 -0
- package/dist/event-center/registry.js +238 -0
- package/dist/event-center/runtime.js +641 -0
- package/dist/event-center/script-runner.js +356 -0
- package/dist/event-center/types.js +35 -0
- package/dist/event-center/validation.js +413 -0
- package/dist/index.js +751 -268
- package/dist/ipc.js +66 -12
- package/dist/paths.js +20 -0
- package/dist/product.js +14 -0
- package/dist/proxy/manager.js +43 -18
- package/dist/proxy/service-supervisor.js +78 -35
- package/dist/response-system/engines/v1/index.js +0 -1
- package/dist/response-system/modes/single-session/index.js +1 -1
- package/dist/services/dispatcher.js +100 -0
- package/dist/services/idempotency.js +90 -0
- package/dist/services/identity.js +52 -0
- package/dist/services/index-generator.js +70 -0
- package/dist/services/index.js +449 -0
- package/dist/services/ipc-operation.js +458 -0
- package/dist/services/ledger.js +52 -0
- package/dist/services/message-log.js +112 -0
- package/dist/services/pack-manager.js +204 -0
- package/dist/services/reply.js +55 -0
- package/dist/services/router.js +95 -0
- package/dist/services/script-runner.js +422 -0
- package/dist/services/service-payload.js +70 -0
- package/dist/services/types.js +18 -0
- package/dist/services/validation.js +297 -0
- package/dist/trigger/application-service.js +21 -1
- package/dist/trigger/audit.js +19 -4
- package/dist/trigger/authorization.js +14 -5
- package/dist/trigger/event-source.js +1 -1
- package/dist/trigger/history.js +176 -7
- package/dist/trigger/ipc-service.js +3 -1
- package/dist/trigger/manager.js +1 -3
- package/dist/trigger/scheduler.js +78 -5
- package/dist/trigger/script-sandbox.js +118 -22
- package/dist/utils/cross-platform.js +175 -13
- package/dist/utils/evolcore-version.js +69 -27
- package/dist/utils/host-info.js +11 -8
- package/dist/utils/instance-registry.js +19 -13
- package/dist/utils/npm-ops.js +48 -0
- package/dist/utils/process-introspect.js +109 -10
- package/dist/utils/startup-trace.js +222 -44
- package/dist/utils/windows-shell-trust.js +80 -6
- package/kits/docs/INDEX.md +2 -2
- package/kits/docs/aun/ABILITY_CALLING.md +10 -17
- package/kits/docs/context-assembly.md +1 -1
- package/kits/docs/evolcore/INDEX.md +5 -2
- package/kits/docs/evolcore/ability.md +4 -0
- package/kits/docs/evolcore/aid.md +1 -1
- package/kits/docs/evolcore/ctl.md +2 -1
- package/kits/docs/evolcore/event-center.md +207 -0
- package/kits/docs/evolcore/file-navigation.md +10 -264
- package/kits/docs/evolcore/fs.md +3 -2
- package/kits/docs/evolcore/group.md +2 -2
- package/kits/docs/evolcore/memory-architecture.md +2 -0
- package/kits/docs/evolcore/menu-exec-schema-commands.md +1 -1
- package/kits/docs/evolcore/menu-protocol.md +21 -0
- package/kits/docs/evolcore/msg.md +27 -8
- package/kits/docs/evolcore/provider.md +23 -3
- package/kits/docs/evolcore/response.md +5 -5
- package/kits/docs/evolcore/services.md +277 -0
- package/kits/docs/evolcore/task.md +2 -0
- package/kits/docs/evolcore/team-workspace.md +41 -0
- package/kits/eck_manifest.json +45 -7
- package/kits/eck_message_manifest.json +3 -3
- package/kits/rules/02-navigation.md +10 -1
- package/kits/rules/06-channel.md +5 -6
- package/kits/schemas/_meta.json +17 -6
- package/kits/schemas/agent-config.schema.19.json +5 -7
- package/kits/schemas/agent-config.schema.20.json +936 -0
- package/kits/schemas/daemon.schema.1.json +5 -0
- package/kits/schemas/daemon.schema.2.json +5 -0
- package/kits/schemas/daemon.schema.3.json +2 -1
- package/kits/schemas/daemon.schema.4.json +2 -1
- package/kits/schemas/daemon.schema.5.json +2 -1
- package/kits/schemas/daemon.schema.6.json +1 -1
- package/kits/schemas/daemon.schema.7.json +1 -1
- package/kits/schemas/daemon.schema.8.json +2 -1
- package/kits/schemas/daemon.schema.9.json +2 -1
- package/kits/schemas/relation-config.schema.12.json +2 -3
- package/kits/schemas/role-config.schema.2.json +4 -4
- package/kits/schemas/role-registry.schema.1.json +2 -2
- package/kits/schemas/single-session.schema.1.json +1 -1
- package/kits/schemas/single-session.schema.2.json +1 -1
- package/kits/schemas/single-session.schema.3.json +1 -1
- package/kits/skills/.switches.json +1 -5
- package/kits/skills/ability/SKILL.md +56 -0
- package/kits/skills/ability/references/calling.md +56 -0
- package/kits/skills/{ec-ability → ability}/references/contract-checklist.md +1 -1
- package/kits/skills/{ec-ability → ability}/references/development.md +9 -33
- package/kits/skills/{ec-ability → ability}/references/management.md +2 -2
- package/kits/skills/{ec-ability → ability}/references/recovery.md +1 -1
- package/kits/skills/{ec-ability → ability}/references/runtime-protocol.md +2 -0
- package/kits/skills/ec-agent-create/SKILL.md +0 -1
- package/kits/skills/ec-group/SKILL.md +8 -5
- package/kits/skills/ec-group-collaboration/SKILL.md +7 -7
- package/kits/skills/ec-service-proxy/SKILL.md +34 -5
- package/kits/skills/ec-trigger/SKILL.md +4 -4
- package/kits/skills/personal-assistant/SKILL.md +6 -6
- package/kits/skills/personal-assistant/references/02-bootstrap.md +4 -4
- package/kits/skills/personal-assistant/scripts/clean.mjs +4 -4
- package/kits/skills/personal-assistant/scripts/init.mjs +2 -2
- package/kits/skills/personal-assistant/scripts/pa.mjs +4 -4
- package/kits/skills/thread-ops/SKILL.md +10 -10
- package/kits/templates/system-fragments/channel.md +3 -3
- package/kits/templates/system-fragments/commands.md +9 -7
- package/kits/templates/system-fragments/reply.md +2 -6
- package/kits/templates/system-fragments/session.md +1 -1
- package/kits/templates/system-fragments/thread.md +11 -9
- package/package.json +5 -6
- package/dist/cli/pa-workspace-command.js +0 -225
- package/dist/core/command/pa-workspace-store.js +0 -468
- package/dist/core/relation/pa-team.js +0 -132
- package/kits/docs/evolcore/pa-workspace.md +0 -51
- package/kits/skills/aid-ability/SKILL.md +0 -244
- package/kits/skills/ec-ability/SKILL.md +0 -67
- package/kits/skills/ec-ability/references/workflows.md +0 -15
package/dist/ipc.js
CHANGED
|
@@ -76,6 +76,7 @@ const LOCAL_CONTROL_COMMANDS = new Set([
|
|
|
76
76
|
'ecweb.ability',
|
|
77
77
|
'upgrade.op',
|
|
78
78
|
'provider.op',
|
|
79
|
+
'invoke.op',
|
|
79
80
|
'ecweb.init',
|
|
80
81
|
'ecweb.basic-settings',
|
|
81
82
|
'ecweb.message.context',
|
|
@@ -96,7 +97,7 @@ const MEMORY_COMMAND_ENDPOINTS = new Set([
|
|
|
96
97
|
'memory.create', 'memory.update', 'memory.archive', 'memory.demote', 'memory.consolidate',
|
|
97
98
|
]);
|
|
98
99
|
const DELEGATED_ARGV_ENDPOINTS = new Set([
|
|
99
|
-
'agent.op', 'ability.op', 'config.op', 'peer.op', 'aid.op', 'aid.ownership', 'group.op', 'msg.op', 'fs.op', 'proxy.op', 'provider.op',
|
|
100
|
+
'agent.op', 'ability.op', 'config.op', 'peer.op', 'aid.op', 'aid.ownership', 'group.op', 'msg.op', 'fs.op', 'proxy.op', 'provider.op', 'invoke.op',
|
|
100
101
|
'upgrade.op',
|
|
101
102
|
'ctl', 'diag', 'menu-client.request', 'task.resume', 'queue.op', 'storage.auth', 'storage.upload',
|
|
102
103
|
'trigger.op', 'skill.refresh', 'thread.op', 'local-command-context', 'evolagent.bootstrapComplete', 'status.auth', 'logs.query', ...MEMORY_COMMAND_ENDPOINTS,
|
|
@@ -126,7 +127,7 @@ function requiresLocalControlToken(cmd) {
|
|
|
126
127
|
const type = String(cmd.type ?? '');
|
|
127
128
|
const sessionId = typeof cmd.sessionId === 'string' && cmd.sessionId.trim();
|
|
128
129
|
const delegated = typeof cmd.delegationToken === 'string' && cmd.delegationToken.trim();
|
|
129
|
-
if (type === 'provider.op' || type === 'upgrade.op')
|
|
130
|
+
if (type === 'provider.op' || type === 'upgrade.op' || type === 'invoke.op')
|
|
130
131
|
return !sessionId || !delegated || cmd.actorSessionId !== undefined;
|
|
131
132
|
if (cmd.type === 'evolagent.initialize' || LOCAL_CONTROL_COMMANDS.has(type))
|
|
132
133
|
return true;
|
|
@@ -135,7 +136,7 @@ function requiresLocalControlToken(cmd) {
|
|
|
135
136
|
// Ownership has an explicit, non-fallback authentication contract below.
|
|
136
137
|
if (type === 'aid.ownership')
|
|
137
138
|
return false;
|
|
138
|
-
if (type === 'skill.refresh' || type === 'thread.op')
|
|
139
|
+
if (type === 'skill.refresh' || type === 'thread.op' || type === 'events.op' || type === 'services.op')
|
|
139
140
|
return !sessionId || !delegated;
|
|
140
141
|
if (type === 'ability.op')
|
|
141
142
|
return !sessionId && !delegated;
|
|
@@ -216,6 +217,7 @@ export class IpcServer {
|
|
|
216
217
|
triggerExecutor;
|
|
217
218
|
proxyExecutor;
|
|
218
219
|
providerExecutor;
|
|
220
|
+
invokeExecutor;
|
|
219
221
|
upgradeExecutor;
|
|
220
222
|
consolidationLaunchExecutor;
|
|
221
223
|
consolidationCheckExecutor;
|
|
@@ -248,6 +250,8 @@ export class IpcServer {
|
|
|
248
250
|
msgOperationExecutor;
|
|
249
251
|
fsOperationExecutor;
|
|
250
252
|
threadOperationExecutor;
|
|
253
|
+
eventsOperationExecutor;
|
|
254
|
+
servicesOperationExecutor;
|
|
251
255
|
dingtalkContactBindExecutor;
|
|
252
256
|
feishuContactBindExecutor;
|
|
253
257
|
qqbotContactBindExecutor;
|
|
@@ -389,6 +393,12 @@ export class IpcServer {
|
|
|
389
393
|
setThreadOperationExecutor(executor) {
|
|
390
394
|
this.threadOperationExecutor = executor;
|
|
391
395
|
}
|
|
396
|
+
setEventsOperationExecutor(executor) {
|
|
397
|
+
this.eventsOperationExecutor = executor;
|
|
398
|
+
}
|
|
399
|
+
setServicesOperationExecutor(executor) {
|
|
400
|
+
this.servicesOperationExecutor = executor;
|
|
401
|
+
}
|
|
392
402
|
setAgentReloadExecutor(executor) {
|
|
393
403
|
this.agentReloadExecutor = executor;
|
|
394
404
|
}
|
|
@@ -541,6 +551,9 @@ export class IpcServer {
|
|
|
541
551
|
setProviderExecutor(executor) {
|
|
542
552
|
this.providerExecutor = executor;
|
|
543
553
|
}
|
|
554
|
+
setInvokeExecutor(executor) {
|
|
555
|
+
this.invokeExecutor = executor;
|
|
556
|
+
}
|
|
544
557
|
setUpgradeExecutor(executor) {
|
|
545
558
|
this.upgradeExecutor = executor;
|
|
546
559
|
}
|
|
@@ -1254,6 +1267,29 @@ export class IpcServer {
|
|
|
1254
1267
|
const { executeProviderOperation } = await import('./config/provider-ipc-service.js');
|
|
1255
1268
|
return executeProviderOperation({ argv: cmd.argv });
|
|
1256
1269
|
}
|
|
1270
|
+
case 'invoke.op': {
|
|
1271
|
+
const hasDelegatedFields = cmd.sessionId !== undefined || cmd.delegationToken !== undefined
|
|
1272
|
+
|| cmd.actorSessionId !== undefined;
|
|
1273
|
+
if (hasDelegatedFields) {
|
|
1274
|
+
if (typeof cmd.sessionId !== 'string' || !cmd.sessionId
|
|
1275
|
+
|| typeof cmd.delegationToken !== 'string' || !cmd.delegationToken
|
|
1276
|
+
|| cmd.actorSessionId !== undefined) {
|
|
1277
|
+
return { ok: false, code: 'INVALID_REQUEST', error: 'invoke.op requires a session and task delegation token' };
|
|
1278
|
+
}
|
|
1279
|
+
if (!this.invokeExecutor)
|
|
1280
|
+
return { ok: false, code: 'NOT_CONFIGURED', error: 'managed invoke executor is unavailable' };
|
|
1281
|
+
return this.invokeExecutor({
|
|
1282
|
+
argv: cmd.argv,
|
|
1283
|
+
input: cmd.input,
|
|
1284
|
+
sessionId: cmd.sessionId,
|
|
1285
|
+
delegationToken: cmd.delegationToken,
|
|
1286
|
+
delegationCommandHash: cmd.delegationCommandHash,
|
|
1287
|
+
requestId,
|
|
1288
|
+
});
|
|
1289
|
+
}
|
|
1290
|
+
const { executeInvokeOperation } = await import('./config/invoke-ipc-service.js');
|
|
1291
|
+
return executeInvokeOperation({ argv: cmd.argv, input: cmd.input });
|
|
1292
|
+
}
|
|
1257
1293
|
case 'upgrade.op': {
|
|
1258
1294
|
const hasDelegatedFields = cmd.sessionId !== undefined || cmd.delegationToken !== undefined
|
|
1259
1295
|
|| cmd.actorSessionId !== undefined;
|
|
@@ -1766,7 +1802,7 @@ export class IpcServer {
|
|
|
1766
1802
|
}
|
|
1767
1803
|
case 'local-command-context': {
|
|
1768
1804
|
if (!Array.isArray(cmd.argv) || cmd.argv.some((value) => typeof value !== 'string')
|
|
1769
|
-
|| !['skill', 'stats', 'session', '
|
|
1805
|
+
|| !['skill', 'stats', 'session', 'team'].includes(cmd.argv[0]) || typeof cmd.sessionId !== 'string' || !cmd.sessionId
|
|
1770
1806
|
|| typeof cmd.delegationToken !== 'string' || !cmd.delegationToken) {
|
|
1771
1807
|
return { ok: false, code: 'INVALID_REQUEST', error: 'Local command requires argv and task credentials' };
|
|
1772
1808
|
}
|
|
@@ -1783,13 +1819,15 @@ export class IpcServer {
|
|
|
1783
1819
|
if (!context?.selfAid || !context.peerRole || context.peerRole === 'none') {
|
|
1784
1820
|
return { ok: false, code: 'NOT_ALLOWED', error: 'Current task identity and role are unavailable' };
|
|
1785
1821
|
}
|
|
1786
|
-
if (cmd.argv[0] === '
|
|
1822
|
+
if (cmd.argv[0] === 'team'
|
|
1787
1823
|
&& (context.channel !== 'aun' || context.chatType !== 'private' || context.peerRole !== 'owner' || !context.peerId)) {
|
|
1788
|
-
return { ok: false, code: 'NOT_ALLOWED', error: '
|
|
1824
|
+
return { ok: false, code: 'NOT_ALLOWED', error: 'Team workspace commands require the current Agent owner in an AUN private chat' };
|
|
1789
1825
|
}
|
|
1790
|
-
if (cmd.argv[0] === '
|
|
1791
|
-
&& (cmd.argv[1] === '
|
|
1792
|
-
|
|
1826
|
+
if (cmd.argv[0] === 'team' && context.permissionMode === 'readonly'
|
|
1827
|
+
&& (cmd.argv[1] === 'workspace' && cmd.argv[2] === 'init'
|
|
1828
|
+
|| cmd.argv[1] === 'navigation' && cmd.argv[2] === 'update'
|
|
1829
|
+
|| cmd.argv[1] === 'members' && cmd.argv[2] === 'update')) {
|
|
1830
|
+
return { ok: false, code: 'NOT_ALLOWED', error: 'Readonly tasks cannot change Team Workspace state' };
|
|
1793
1831
|
}
|
|
1794
1832
|
const fullAccessTask = context.processRole === 'fullaccess-run'
|
|
1795
1833
|
&& context.dataScope === 'daemon' && context.permissionMode === 'fullaccess';
|
|
@@ -1925,6 +1963,9 @@ export class IpcServer {
|
|
|
1925
1963
|
timeoutMs: typeof cmd.timeoutMs === 'number' && Number.isFinite(cmd.timeoutMs) ? cmd.timeoutMs : undefined,
|
|
1926
1964
|
delegationToken: typeof cmd.delegationToken === 'string' ? cmd.delegationToken : undefined,
|
|
1927
1965
|
delegationCommandHash: typeof cmd.delegationCommandHash === 'string' ? cmd.delegationCommandHash : undefined,
|
|
1966
|
+
// 非托管自发(`ecmsg send --from <self> --thread T --to <self>`)没有委托凭证,
|
|
1967
|
+
// 用本机 controlToken 证明「这是本机控制面调用」;只对自发生效,见 sender。
|
|
1968
|
+
localControl: !cmd.delegationToken && this.hasValidControlToken(cmd.controlToken),
|
|
1928
1969
|
log,
|
|
1929
1970
|
});
|
|
1930
1971
|
}
|
|
@@ -2142,7 +2183,7 @@ export class IpcServer {
|
|
|
2142
2183
|
if (disabled)
|
|
2143
2184
|
return disabled;
|
|
2144
2185
|
const ownerAid = taskCtx.selfAid
|
|
2145
|
-
? ownerResolver.
|
|
2186
|
+
? ownerResolver.owner(taskCtx.selfAid)
|
|
2146
2187
|
: undefined;
|
|
2147
2188
|
const { launchConsolidation } = await import('./core/memory/consolidation.js');
|
|
2148
2189
|
if (!this.consolidationLaunchExecutor) {
|
|
@@ -2514,6 +2555,16 @@ export class IpcServer {
|
|
|
2514
2555
|
};
|
|
2515
2556
|
return await this.threadOperationExecutor(req);
|
|
2516
2557
|
}
|
|
2558
|
+
case 'events.op': {
|
|
2559
|
+
if (!this.eventsOperationExecutor)
|
|
2560
|
+
return { ok: false, code: 'NOT_CONFIGURED', error: 'events.op not configured' };
|
|
2561
|
+
return await this.eventsOperationExecutor(cmd);
|
|
2562
|
+
}
|
|
2563
|
+
case 'services.op': {
|
|
2564
|
+
if (!this.servicesOperationExecutor)
|
|
2565
|
+
return { ok: false, code: 'NOT_CONFIGURED', error: 'services.op not configured' };
|
|
2566
|
+
return await this.servicesOperationExecutor(cmd);
|
|
2567
|
+
}
|
|
2517
2568
|
case 'evolagent.initialize': {
|
|
2518
2569
|
if (cmd.sessionId || cmd.delegationToken)
|
|
2519
2570
|
return { ok: false, code: 'NOT_ALLOWED', error: 'Managed callers must use agent.op' };
|
|
@@ -2913,8 +2964,11 @@ export class IpcServer {
|
|
|
2913
2964
|
const disabled = this.checkMemoryEnabled(mc, mode, taskCtx);
|
|
2914
2965
|
if (disabled)
|
|
2915
2966
|
return { error: disabled };
|
|
2967
|
+
// Owner 判定必须与上下文注入同源:response-engine 侧用 resolveContextOwner(),
|
|
2968
|
+
// 底层同样是 ownerResolver.owner()。两处口径只能一起改,否则记忆会写进
|
|
2969
|
+
// 一个 owner 的目录、注入时却去另一个 owner 的目录找。
|
|
2916
2970
|
const ownerAid = taskCtx.selfAid
|
|
2917
|
-
? ownerResolver.
|
|
2971
|
+
? ownerResolver.owner(taskCtx.selfAid)
|
|
2918
2972
|
: undefined;
|
|
2919
2973
|
if (allowed === 'owner' && !ownerAid) {
|
|
2920
2974
|
return { error: { ok: false, code: 'INVALID_REQUEST', error: '当前 agent 未配置 owner' } };
|
|
@@ -2983,7 +3037,7 @@ export class IpcServer {
|
|
|
2983
3037
|
try {
|
|
2984
3038
|
if (!this.consolidationLaunchExecutor)
|
|
2985
3039
|
return;
|
|
2986
|
-
const ownerAid = ownerResolver.
|
|
3040
|
+
const ownerAid = ownerResolver.owner(selfAid);
|
|
2987
3041
|
await this.consolidationLaunchExecutor({
|
|
2988
3042
|
taskCtx,
|
|
2989
3043
|
mode: 'forget',
|
package/dist/paths.js
CHANGED
|
@@ -105,6 +105,18 @@ export function agentMdPath(aid, root = resolveRoot()) {
|
|
|
105
105
|
export function agentDir(aid) {
|
|
106
106
|
return path.join(resolveRoot(), 'agents', aid);
|
|
107
107
|
}
|
|
108
|
+
/** Default per-Agent artifact workspace. */
|
|
109
|
+
export function agentWorkspaceDir(aid, root = resolveRoot()) {
|
|
110
|
+
return path.join(root, 'agents', aid, 'workspace');
|
|
111
|
+
}
|
|
112
|
+
/** Historical default workspace location, read only for one-time relocation. */
|
|
113
|
+
export function legacyTeamWorkspaceDir(aid, root = resolveRoot()) {
|
|
114
|
+
return path.join(root, 'team-workspaces', aid);
|
|
115
|
+
}
|
|
116
|
+
/** Agent-owned deliverables, independent of the current project/PA workspace. */
|
|
117
|
+
export function agentOutputDir(aid) {
|
|
118
|
+
return path.join(agentDir(aid), 'output');
|
|
119
|
+
}
|
|
108
120
|
export function agentConfig(aid) {
|
|
109
121
|
return path.join(agentDir(aid), 'config.json');
|
|
110
122
|
}
|
|
@@ -248,6 +260,14 @@ export function channelStatePath(channelKey, ...parts) {
|
|
|
248
260
|
export function agentTriggersDir(aid) {
|
|
249
261
|
return path.join(agentDir(aid), 'triggers');
|
|
250
262
|
}
|
|
263
|
+
/** 事件中心目录:center.json + 事件包(pack.json / ledger.jsonl / scripts/ / logs/)。 */
|
|
264
|
+
export function agentEventsDir(aid) {
|
|
265
|
+
return path.join(agentDir(aid), 'events');
|
|
266
|
+
}
|
|
267
|
+
/** 服务路由目录:router.json 与服务包(service.json / scripts/ / logs/ / ledger)。 */
|
|
268
|
+
export function agentServicesDir(aid) {
|
|
269
|
+
return path.join(agentDir(aid), 'services');
|
|
270
|
+
}
|
|
251
271
|
/** 话题数据的统一根目录:索引、摘要、续读锚点、跨会话收件箱都收在这里。 */
|
|
252
272
|
export function agentThreadsDir(aid) {
|
|
253
273
|
return path.join(agentDataDir(aid), 'threads');
|
package/dist/product.js
CHANGED
|
@@ -21,6 +21,20 @@ export const TARGET_PACKAGE_ROOT_ENV = 'EVOLCORE_TARGET_PACKAGE_ROOT';
|
|
|
21
21
|
export const SESSION_ID_ENV = 'EVOLCORE_SESSION_ID';
|
|
22
22
|
export const SELF_AID_ENV = 'EVOLCORE_SELF_AID';
|
|
23
23
|
export const CODEX_HOOK_TOKEN_ENV = 'EVOLCORE_CODEX_HOOK_TOKEN';
|
|
24
|
+
/** Task identity and authority must not outlive the task in supervised services. */
|
|
25
|
+
export const SERVICE_SESSION_ENV_NAMES = [
|
|
26
|
+
SESSION_ID_ENV,
|
|
27
|
+
SELF_AID_ENV,
|
|
28
|
+
CODEX_HOOK_TOKEN_ENV,
|
|
29
|
+
'EVOLCORE_TASK_RUNTIME_CONTEXT',
|
|
30
|
+
'EVOLCORE_SESSION_RUNTIME_DIR',
|
|
31
|
+
'EVOLCORE_RUNTIME_LOCK_DIR',
|
|
32
|
+
'EVOLCORE_DELEGATION_TOKEN',
|
|
33
|
+
'EVOLCORE_CODEX_SESSION_TOKEN',
|
|
34
|
+
'EVOLCORE_DELEGATED_EXECUTION_SPEC',
|
|
35
|
+
'EVOLCORE_DAEMON_RUNTIME_EPOCH',
|
|
36
|
+
];
|
|
37
|
+
export const CODEX_HEADER_ENV_PREFIX = 'EVOLCORE_CODEX_HEADER_';
|
|
24
38
|
export const DEFAULT_RUNTIME_HOME_DIRNAME = '.evolcore';
|
|
25
39
|
export const INSTANCE_SOCKET_FILENAME = 'daemon.sock';
|
|
26
40
|
export const WINDOWS_PIPE_PREFIX = 'daemon';
|
package/dist/proxy/manager.js
CHANGED
|
@@ -9,7 +9,7 @@ import { resolvePaths } from '../paths.js';
|
|
|
9
9
|
import { atomicWriteJson } from '../utils/atomic-write.js';
|
|
10
10
|
import { logger as defaultLogger } from '../utils/logger.js';
|
|
11
11
|
import { probeServiceRoot } from '../aun/service-proxy.js';
|
|
12
|
-
import { startServiceProxy } from '../aun/service-proxy.js';
|
|
12
|
+
import { readServiceProxyEndpoint, startServiceProxy } from '../aun/service-proxy.js';
|
|
13
13
|
import { ServiceSupervisor } from './service-supervisor.js';
|
|
14
14
|
const MUTATIONS = new Set([
|
|
15
15
|
'build', 'update', 'apply', 'publish', 'unpublish', 'remove', 'start', 'stop',
|
|
@@ -69,6 +69,7 @@ export class ServiceProxyManager {
|
|
|
69
69
|
removeConfigListener;
|
|
70
70
|
activeProxy = null;
|
|
71
71
|
activeProxySignature = '';
|
|
72
|
+
activeProxyConfigSignature = '';
|
|
72
73
|
activeProxyNames = [];
|
|
73
74
|
applyQueue = Promise.resolve();
|
|
74
75
|
stopped = false;
|
|
@@ -82,11 +83,22 @@ export class ServiceProxyManager {
|
|
|
82
83
|
error: undefined,
|
|
83
84
|
};
|
|
84
85
|
inflight = new Map();
|
|
86
|
+
settleInitialPublication;
|
|
85
87
|
constructor(options) {
|
|
86
88
|
this.options = options;
|
|
87
89
|
this.supervisor = new ServiceSupervisor(defaultLogger);
|
|
88
90
|
}
|
|
89
91
|
async start() {
|
|
92
|
+
this.settleInitialPublication ??= this.options.startupTrace?.startTask('daemon.serviceProxyReady');
|
|
93
|
+
try {
|
|
94
|
+
await this.startRuntime();
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
this.settleInitialPublication?.('failed');
|
|
98
|
+
throw error;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
async startRuntime() {
|
|
90
102
|
this.stopped = false;
|
|
91
103
|
this.removeConfigListener = onConfigWrite(({ target }) => {
|
|
92
104
|
if (target === ConfigTarget.Process)
|
|
@@ -103,34 +115,24 @@ export class ServiceProxyManager {
|
|
|
103
115
|
&& service.proxy.source === 'instance'
|
|
104
116
|
&& basename.startsWith(service.name + '-')))
|
|
105
117
|
return;
|
|
106
|
-
const serviceName = configured.find(service => service.proxy?.enabled === true
|
|
107
|
-
&& service.proxy.source === 'instance'
|
|
108
|
-
&& basename.startsWith(service.name + '-'))?.name;
|
|
109
|
-
if (this.proxyTransport.proxyServer !== 'unconfirmed')
|
|
110
|
-
return;
|
|
111
118
|
if (this.instanceApplyTimer)
|
|
112
119
|
clearTimeout(this.instanceApplyTimer);
|
|
113
120
|
this.instanceApplyTimer = setTimeout(() => {
|
|
114
121
|
this.instanceApplyTimer = undefined;
|
|
115
|
-
const activeProxyConfig = this.activeProxyNames
|
|
116
|
-
.map(name => findService(loadDaemonConfig().services ?? [], name))
|
|
117
|
-
.filter((service) => !!service);
|
|
118
|
-
const dirtySnapshot = activeProxyConfig.map(service => service.name === serviceName
|
|
119
|
-
? { ...service, runtime: { ...service.runtime, generation: Date.now() } }
|
|
120
|
-
: service);
|
|
121
|
-
this.activeProxySignature = hash(dirtySnapshot);
|
|
122
122
|
void this.scheduleApply().catch(error => {
|
|
123
123
|
defaultLogger.warn('[ServiceProxy] instance change apply failed: ' + (error instanceof Error ? error.message : String(error)));
|
|
124
124
|
});
|
|
125
125
|
}, 250);
|
|
126
126
|
this.instanceApplyTimer.unref?.();
|
|
127
127
|
});
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
128
|
+
this.applyQueue = this.applyQueue.then(async () => {
|
|
129
|
+
if (!this.stopped)
|
|
130
|
+
await this.supervisor.start(loadDaemonConfig().services ?? []);
|
|
131
131
|
});
|
|
132
|
+
await this.scheduleApply();
|
|
132
133
|
}
|
|
133
134
|
async stop() {
|
|
135
|
+
this.settleInitialPublication?.('cancelled');
|
|
134
136
|
if (this.stopped)
|
|
135
137
|
return;
|
|
136
138
|
this.stopped = true;
|
|
@@ -223,10 +225,11 @@ export class ServiceProxyManager {
|
|
|
223
225
|
return { ok: true, operations: [...MUTATIONS], reloadByMode: { managed: 'restart', external: 'unmanaged' } };
|
|
224
226
|
}
|
|
225
227
|
if (request.operation === 'list' || request.operation === 'status') {
|
|
228
|
+
const selectedServices = request.operation === 'status' && service ? [service] : services;
|
|
226
229
|
return {
|
|
227
230
|
ok: true,
|
|
228
231
|
providerAid: this.options.providerAid,
|
|
229
|
-
services:
|
|
232
|
+
services: selectedServices.map(item => ({
|
|
230
233
|
...this.describe(item),
|
|
231
234
|
configRev: serviceRevision(item),
|
|
232
235
|
runtime: (item.name === 'ecweb' && serviceRuntimeMode(item) === 'managed' ? this.options.ecwebSupervisor?.status() : undefined)
|
|
@@ -234,6 +237,9 @@ export class ServiceProxyManager {
|
|
|
234
237
|
name: item.name, state: item.enabled ? 'unknown' : 'disabled',
|
|
235
238
|
failureCount: 0, restartCount: 0, generation: 0,
|
|
236
239
|
managed: serviceRuntimeMode(item) === 'managed',
|
|
240
|
+
healthy: null,
|
|
241
|
+
hasProbe: !!item.port || (item.name === 'ecweb' && serviceRuntimeMode(item) === 'managed'),
|
|
242
|
+
endpointHealth: 'unknown',
|
|
237
243
|
},
|
|
238
244
|
})),
|
|
239
245
|
proxy: { ...this.proxyTransport },
|
|
@@ -409,7 +415,17 @@ export class ServiceProxyManager {
|
|
|
409
415
|
if (this.stopped)
|
|
410
416
|
return;
|
|
411
417
|
const desired = services.filter(service => service.enabled === true && service.proxy?.enabled === true);
|
|
412
|
-
const
|
|
418
|
+
const publication = desired.map(service => ({ name: service.name, proxy: service.proxy }));
|
|
419
|
+
const configSignature = hash(desired.map(service => ({ name: service.name, proxy: service.proxy, port: service.port })));
|
|
420
|
+
// A pending handle is already discovering endpoints. Its ready callback
|
|
421
|
+
// reconciles once more using the endpoints it actually registered.
|
|
422
|
+
if (this.activeProxy && this.proxyTransport.state === 'starting'
|
|
423
|
+
&& configSignature === this.activeProxyConfigSignature)
|
|
424
|
+
return;
|
|
425
|
+
const endpoints = Object.fromEntries(await Promise.all(desired.map(async (service) => [service.name, await readServiceProxyEndpoint(service)])));
|
|
426
|
+
if (this.stopped)
|
|
427
|
+
return;
|
|
428
|
+
const signature = hash({ publication, endpoints });
|
|
413
429
|
if (signature === this.activeProxySignature)
|
|
414
430
|
return;
|
|
415
431
|
const oldNames = this.activeProxy ? (this.activeProxySignature ? this.readActiveProxyNames() : []) : [];
|
|
@@ -427,11 +443,13 @@ export class ServiceProxyManager {
|
|
|
427
443
|
this.activeProxy = null;
|
|
428
444
|
}
|
|
429
445
|
this.activeProxySignature = signature;
|
|
446
|
+
this.activeProxyConfigSignature = configSignature;
|
|
430
447
|
this.activeProxyNames = nextNames;
|
|
431
448
|
this.proxyTransport.updatedAt = Date.now();
|
|
432
449
|
this.proxyTransport.gatewayRegistered = false;
|
|
433
450
|
this.proxyTransport.proxyServer = 'unknown';
|
|
434
451
|
if (desired.length === 0) {
|
|
452
|
+
this.settleInitialPublication?.('skipped');
|
|
435
453
|
if (!this.proxyTransport.error)
|
|
436
454
|
this.proxyTransport.state = 'unpublished';
|
|
437
455
|
return;
|
|
@@ -440,6 +458,7 @@ export class ServiceProxyManager {
|
|
|
440
458
|
this.proxyTransport.state = 'starting';
|
|
441
459
|
const handle = startServiceProxy(this.options.controlChannel, this.options.providerAid, desired);
|
|
442
460
|
if (!handle) {
|
|
461
|
+
this.settleInitialPublication?.('failed');
|
|
443
462
|
this.proxyTransport.state = 'unpublished';
|
|
444
463
|
return;
|
|
445
464
|
}
|
|
@@ -448,6 +467,10 @@ export class ServiceProxyManager {
|
|
|
448
467
|
void handle.ready.then(result => {
|
|
449
468
|
if (this.stopped || this.activeProxy !== handle)
|
|
450
469
|
return;
|
|
470
|
+
this.settleInitialPublication?.(result.registered === desired.length && result.gatewayRegistered ? 'ok' : 'failed');
|
|
471
|
+
this.activeProxySignature = hash({ publication,
|
|
472
|
+
endpoints: Object.fromEntries(desired.map(service => [service.name, handle.endpoints[service.name] ?? null])),
|
|
473
|
+
});
|
|
451
474
|
this.proxyTransport.gatewayRegistered = result.gatewayRegistered;
|
|
452
475
|
this.proxyTransport.proxyServer = 'unconfirmed';
|
|
453
476
|
if (result.registered === 0) {
|
|
@@ -464,9 +487,11 @@ export class ServiceProxyManager {
|
|
|
464
487
|
}
|
|
465
488
|
this.proxyTransport.state = result.gatewayRegistered ? 'active' : 'degraded';
|
|
466
489
|
this.proxyTransport.error = result.gatewayRegistered ? undefined : 'Gateway registration has not been confirmed';
|
|
490
|
+
void this.scheduleApply().catch(error => defaultLogger.warn('[ServiceProxy] endpoint reconciliation failed: ' + String(error)));
|
|
467
491
|
}).catch(error => {
|
|
468
492
|
if (this.stopped || this.activeProxy !== handle)
|
|
469
493
|
return;
|
|
494
|
+
this.settleInitialPublication?.('failed');
|
|
470
495
|
this.proxyTransport.state = 'degraded';
|
|
471
496
|
this.proxyTransport.error = error instanceof Error ? error.message : String(error);
|
|
472
497
|
});
|