evolcore 0.0.22 → 0.0.24
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 +74 -14
- package/README.md +4 -0
- package/bin/codex-managed-acl.ps1 +160 -0
- package/bin/codex-managed-hook.mjs +127 -10
- package/bin/ec-safe-output.js +85 -3
- package/bin/install-codex-managed-hooks.mjs +384 -95
- package/dist/agents/baseagent-availability.js +48 -0
- package/dist/agents/baseagent.js +30 -2
- package/dist/agents/claude-runner.js +179 -240
- package/dist/agents/{codex-app-server-client.js → codex/app-server-client.js} +90 -20
- package/dist/{utils/codex-app-server-registry.js → agents/codex/app-server-registry.js} +2 -2
- package/dist/agents/codex/catalog.js +70 -0
- package/dist/agents/codex/diagnostics.js +369 -0
- package/dist/agents/codex-runner.js +839 -192
- package/dist/agents/ecagent-runner.js +27 -34
- package/dist/agents/gemini-runner.js +62 -8
- package/dist/agents/runner-types.js +1 -1
- package/dist/aun/aid/managed-operation.js +28 -6
- package/dist/aun/aid/store.js +43 -0
- package/dist/aun/menu-client.js +272 -0
- package/dist/aun/msg/group.js +65 -4
- package/dist/aun/msg/index.js +1 -1
- package/dist/aun/msg/managed-operation.js +57 -5
- package/dist/aun/outbox.js +56 -18
- package/dist/aun/rpc/client.js +7 -1
- package/dist/channels/aun.js +178 -77
- package/dist/channels/daemon.js +7 -1
- package/dist/channels/dingtalk.js +1 -0
- package/dist/channels/feishu.js +10 -4
- package/dist/channels/wechat.js +81 -10
- package/dist/channels/wecom.js +2 -1
- package/dist/cli/agent-command.js +29 -3
- package/dist/cli/agent-create.js +538 -0
- package/dist/cli/agent.js +26 -675
- package/dist/cli/aun-commands.js +108 -24
- package/dist/cli/command-log.js +21 -2
- package/dist/cli/ctl-command.js +2 -0
- package/dist/cli/daemon-commands.js +289 -61
- package/dist/cli/index.js +22 -2
- package/dist/cli/init.js +2 -10
- package/dist/cli/managed-command-guard.js +3 -0
- package/dist/cli/menu-client.js +95 -0
- package/dist/cli/model.js +23 -8
- package/dist/cli/restart-monitor.js +432 -8
- package/dist/cli/stats.js +110 -0
- package/dist/cli/task-context.js +12 -2
- package/dist/cli/trigger-command.js +9 -1
- package/dist/config/builtin-roles.js +2 -0
- package/dist/config/schema-migration.js +14 -2
- package/dist/core/auth/agent-delegation.js +10 -7
- package/dist/core/auth/auth-gateway.js +3 -2
- package/dist/core/auth/authorization-audit.js +75 -18
- package/dist/core/auth/operation-authorizer.js +63 -3
- package/dist/core/auth/operation-catalog.js +14 -2
- package/dist/core/auth/remote-access-store.js +136 -0
- package/dist/core/baseagent-loader.js +4 -4
- package/dist/core/bootstrap-messages.js +39 -18
- package/dist/core/bootstrap-service.js +32 -26
- package/dist/core/capability/capability-manager.js +8 -4
- package/dist/core/capability/providers/codex-capability-provider.js +1 -1
- package/dist/core/command/agent-control.js +7 -2
- package/dist/core/command/command-handler.js +128 -30
- package/dist/core/command/daemon-diagnostics.js +448 -0
- package/dist/core/command/menu-catalog.js +6 -1
- package/dist/core/command/menu-handler.js +410 -98
- package/dist/core/command/menu-protocol.js +123 -0
- package/dist/core/command/slash-gate.js +4 -6
- package/dist/core/command/slash-handler.js +199 -70
- package/dist/core/data-migration.js +5 -15
- package/dist/core/event-catalog.js +3 -0
- package/dist/core/handoff/runtime.js +3 -1
- package/dist/core/handoff/store.js +7 -1
- package/dist/core/message/im-renderer.js +13 -6
- package/dist/core/message/message-bridge.js +5 -36
- package/dist/core/message/message-queue.js +20 -15
- package/dist/core/message/message-utils.js +6 -3
- package/dist/core/message/response-engine.js +147 -94
- package/dist/core/model/catalog-service.js +310 -0
- package/dist/core/model/model-catalog.js +134 -334
- package/dist/core/model/model-diagnostics.js +4 -5
- package/dist/core/model/model-fallback.js +9 -16
- package/dist/core/model/model-permission.js +5 -2
- package/dist/core/permission/approval-gateway.js +183 -32
- package/dist/core/permission/protected-paths.js +63 -4
- package/dist/core/permission/sandbox-runtime.js +4 -2
- package/dist/core/permission/tool-policy.js +257 -31
- package/dist/core/runtime-lock.js +13 -8
- package/dist/core/session/adapters/codex-session-file-adapter.js +71 -3
- package/dist/core/session/session-manager.js +49 -13
- package/dist/core/session/session-renew.js +1 -0
- package/dist/index.js +214 -57
- package/dist/ipc.js +191 -102
- package/dist/paths.js +23 -1
- package/dist/stats/billing.js +18 -4
- package/dist/trigger/manager.js +3 -1
- package/dist/trigger/parser.js +77 -13
- package/dist/trigger/patch.js +104 -1
- package/dist/utils/atomic-write.js +26 -2
- package/dist/utils/cross-platform.js +436 -1
- package/dist/utils/ecweb-supervisor.js +11 -2
- package/dist/utils/ecweb-utils.js +8 -26
- package/dist/utils/error-utils.js +16 -2
- package/dist/utils/model-prices.jsonl +23 -20
- package/dist/utils/npm-ops.js +70 -15
- package/dist/utils/windows-autostart.js +1 -1
- package/kits/docs/evolcore/INDEX.md +1 -0
- package/kits/docs/evolcore/agent-create.md +13 -0
- package/kits/docs/evolcore/group-collaboration.md +7 -2
- package/kits/docs/evolcore/menu-client.md +34 -0
- package/kits/migrations/migrate-contact-book-v2.mjs +9 -1
- package/kits/migrations/migrate-role-config-v4.mjs +11 -5
- package/kits/migrations/migrate-role-config-v5.mjs +8 -2
- package/kits/templates/roles/admin.json +2 -0
- package/kits/templates/roles/visitor.json +1 -0
- package/kits/templates/system-fragments/bootstrap.md +8 -1
- package/package.json +16 -4
- package/dist/utils/codex-cli.js +0 -43
|
@@ -557,13 +557,29 @@ export class SessionManager {
|
|
|
557
557
|
}
|
|
558
558
|
const wasBound = !!normalizeBackendSessionId(current.agentSessionId);
|
|
559
559
|
const next = JSON.parse(JSON.stringify(current));
|
|
560
|
+
const previousBaseagent = next.baseagent;
|
|
561
|
+
if (input.baseagent !== undefined) {
|
|
562
|
+
const requested = input.baseagent.trim();
|
|
563
|
+
if (!requested) {
|
|
564
|
+
const error = new Error('backend rotation baseagent must be non-empty');
|
|
565
|
+
error.code = 'BASEAGENT_REQUIRED';
|
|
566
|
+
throw error;
|
|
567
|
+
}
|
|
568
|
+
next.baseagent = requested;
|
|
569
|
+
}
|
|
560
570
|
next.agentSessionId = undefined;
|
|
561
571
|
const nextMetadata = { ...(next.metadata ?? {}) };
|
|
562
572
|
delete nextMetadata.resumeAt;
|
|
563
573
|
delete nextMetadata.agentSessions;
|
|
564
574
|
next.metadata = nextMetadata;
|
|
565
575
|
this.persistConfirmedTopicBoundary(current, found, next);
|
|
566
|
-
return {
|
|
576
|
+
return {
|
|
577
|
+
status: 'rotated',
|
|
578
|
+
sessionId: input.sessionId,
|
|
579
|
+
wasBound,
|
|
580
|
+
previousBaseagent,
|
|
581
|
+
baseagent: next.baseagent,
|
|
582
|
+
};
|
|
567
583
|
});
|
|
568
584
|
}
|
|
569
585
|
/**
|
|
@@ -830,7 +846,10 @@ export class SessionManager {
|
|
|
830
846
|
const sessionMetadata = { ...(metadata || {}) };
|
|
831
847
|
sessionMetadata.__sessionCreatedAt = Date.now();
|
|
832
848
|
const newIdentity = identity ?? this.resolveIdentity(channel, userId, chatType, identityConversationId);
|
|
833
|
-
const resolvedBaseagent = baseagent
|
|
849
|
+
const resolvedBaseagent = typeof baseagent === 'string' ? baseagent.trim() : '';
|
|
850
|
+
if (!resolvedBaseagent) {
|
|
851
|
+
throw new Error(`[SessionManager] getOrCreateSession: baseagent is empty for channel=${channel} channelId=${channelId}`);
|
|
852
|
+
}
|
|
834
853
|
const session = {
|
|
835
854
|
id: generateSessionId(),
|
|
836
855
|
channel,
|
|
@@ -857,6 +876,7 @@ export class SessionManager {
|
|
|
857
876
|
projectPath: defaultProjectPath,
|
|
858
877
|
name: session.name,
|
|
859
878
|
chatType: session.chatType,
|
|
879
|
+
baseagent: session.baseagent,
|
|
860
880
|
timestamp: Date.now(),
|
|
861
881
|
});
|
|
862
882
|
return session;
|
|
@@ -868,9 +888,9 @@ export class SessionManager {
|
|
|
868
888
|
if (!loaded)
|
|
869
889
|
return;
|
|
870
890
|
const { current } = loaded;
|
|
871
|
-
if (
|
|
872
|
-
const error = new Error('
|
|
873
|
-
error.code = '
|
|
891
|
+
if (updates.baseagent !== undefined) {
|
|
892
|
+
const error = new Error('session baseagent is immutable; use explicit agent switch or backend rotation');
|
|
893
|
+
error.code = 'BASEAGENT_IMMUTABLE';
|
|
874
894
|
throw error;
|
|
875
895
|
}
|
|
876
896
|
if (current.threadId && Object.prototype.hasOwnProperty.call(updates, 'agentSessionId')) {
|
|
@@ -878,8 +898,6 @@ export class SessionManager {
|
|
|
878
898
|
error.code = 'TOPIC_BACKEND_BINDING_PROTECTED';
|
|
879
899
|
throw error;
|
|
880
900
|
}
|
|
881
|
-
if (updates.baseagent !== undefined)
|
|
882
|
-
current.baseagent = updates.baseagent;
|
|
883
901
|
if (updates.chatType !== undefined)
|
|
884
902
|
current.chatType = updates.chatType;
|
|
885
903
|
if (updates.name !== undefined)
|
|
@@ -988,7 +1006,7 @@ export class SessionManager {
|
|
|
988
1006
|
const mainActive = readJsonFile(path.join(chatDir, 'active.json'));
|
|
989
1007
|
// 兼容旧字段名
|
|
990
1008
|
const mainBaseagent = mainActive?.baseagent || mainActive?.agentType;
|
|
991
|
-
const inheritedBaseagent =
|
|
1009
|
+
const inheritedBaseagent = mainBaseagent || baseagent;
|
|
992
1010
|
if (!inheritedBaseagent) {
|
|
993
1011
|
throw new Error('[SessionManager] getOrCreateThreadSession: baseagent is empty');
|
|
994
1012
|
}
|
|
@@ -1022,6 +1040,7 @@ export class SessionManager {
|
|
|
1022
1040
|
channelId,
|
|
1023
1041
|
projectPath,
|
|
1024
1042
|
name: session.name,
|
|
1043
|
+
baseagent: session.baseagent,
|
|
1025
1044
|
timestamp: Date.now(),
|
|
1026
1045
|
});
|
|
1027
1046
|
return session;
|
|
@@ -1072,6 +1091,7 @@ export class SessionManager {
|
|
|
1072
1091
|
channelId,
|
|
1073
1092
|
projectPath: newProjectPath,
|
|
1074
1093
|
name: session.name,
|
|
1094
|
+
baseagent: session.baseagent,
|
|
1075
1095
|
timestamp: Date.now(),
|
|
1076
1096
|
});
|
|
1077
1097
|
return session;
|
|
@@ -1180,6 +1200,7 @@ export class SessionManager {
|
|
|
1180
1200
|
channelId,
|
|
1181
1201
|
projectPath,
|
|
1182
1202
|
name: session.name,
|
|
1203
|
+
baseagent: session.baseagent,
|
|
1183
1204
|
timestamp: Date.now(),
|
|
1184
1205
|
});
|
|
1185
1206
|
return session;
|
|
@@ -1428,7 +1449,7 @@ export class SessionManager {
|
|
|
1428
1449
|
}
|
|
1429
1450
|
}
|
|
1430
1451
|
}
|
|
1431
|
-
async createNewSession(channel, channelId, projectPath, name, baseagent, identityMetadata) {
|
|
1452
|
+
async createNewSession(channel, channelId, projectPath, name, baseagent, identityMetadata, eventMetadata) {
|
|
1432
1453
|
const inheritedChatType = this.getActiveChatType(channel, channelId);
|
|
1433
1454
|
// Derive selfAID and channelType from existing sessions
|
|
1434
1455
|
const existingDir = this.findExistingChatDir(channel, channelId);
|
|
@@ -1480,6 +1501,8 @@ export class SessionManager {
|
|
|
1480
1501
|
channelId,
|
|
1481
1502
|
projectPath,
|
|
1482
1503
|
name: session.name,
|
|
1504
|
+
baseagent: session.baseagent,
|
|
1505
|
+
...eventMetadata,
|
|
1483
1506
|
timestamp: Date.now(),
|
|
1484
1507
|
});
|
|
1485
1508
|
return session;
|
|
@@ -1527,6 +1550,7 @@ export class SessionManager {
|
|
|
1527
1550
|
channelId: sourceSession.channelId,
|
|
1528
1551
|
projectPath: sourceSession.projectPath,
|
|
1529
1552
|
name: session.name,
|
|
1553
|
+
baseagent: session.baseagent,
|
|
1530
1554
|
timestamp: Date.now(),
|
|
1531
1555
|
});
|
|
1532
1556
|
return session;
|
|
@@ -1602,6 +1626,7 @@ export class SessionManager {
|
|
|
1602
1626
|
name: session.name,
|
|
1603
1627
|
chatType: session.chatType,
|
|
1604
1628
|
threadId: session.threadId,
|
|
1629
|
+
baseagent: session.baseagent,
|
|
1605
1630
|
timestamp: now,
|
|
1606
1631
|
});
|
|
1607
1632
|
return session;
|
|
@@ -1624,7 +1649,7 @@ export class SessionManager {
|
|
|
1624
1649
|
selfAID: sourceSession.selfAID,
|
|
1625
1650
|
projectPath: sourceSession.projectPath,
|
|
1626
1651
|
threadId: '',
|
|
1627
|
-
baseagent: sourceSession.baseagent,
|
|
1652
|
+
baseagent: context?.baseagent || sourceSession.baseagent,
|
|
1628
1653
|
sessionKey: formatSessionKey(sourceSession.channelType || sourceSession.channel, sourceSession.channelId, DEFAULT_THREAD_ID),
|
|
1629
1654
|
chatType: sourceSession.chatType || 'private',
|
|
1630
1655
|
metadata,
|
|
@@ -1642,6 +1667,7 @@ export class SessionManager {
|
|
|
1642
1667
|
projectPath: session.projectPath,
|
|
1643
1668
|
name: session.name,
|
|
1644
1669
|
chatType: session.chatType,
|
|
1670
|
+
baseagent: session.baseagent,
|
|
1645
1671
|
cause: 'renew',
|
|
1646
1672
|
sourceSessionId: sourceSession.id,
|
|
1647
1673
|
renewSource: context?.source,
|
|
@@ -1684,6 +1710,12 @@ export class SessionManager {
|
|
|
1684
1710
|
return false;
|
|
1685
1711
|
return adapter.checkExists(projectPath, agentSessionId, agentAid);
|
|
1686
1712
|
}
|
|
1713
|
+
checkSessionTurnPersisted(projectPath, agentSessionId, baseagent, turnId, agentAid) {
|
|
1714
|
+
const adapter = this.getFileAdapter(baseagent);
|
|
1715
|
+
if (!adapter?.checkTurnPersisted)
|
|
1716
|
+
return false;
|
|
1717
|
+
return adapter.checkTurnPersisted(projectPath, agentSessionId, turnId, agentAid);
|
|
1718
|
+
}
|
|
1687
1719
|
readSessionFirstMessage(projectPath, agentSessionId, baseagent, agentAid) {
|
|
1688
1720
|
const adapter = this.getFileAdapter(baseagent);
|
|
1689
1721
|
if (!adapter)
|
|
@@ -1725,10 +1757,13 @@ export class SessionManager {
|
|
|
1725
1757
|
}
|
|
1726
1758
|
return matched[0];
|
|
1727
1759
|
}
|
|
1728
|
-
async importCliSession(channel, channelId, projectPath, agentSessionId, baseagent
|
|
1760
|
+
async importCliSession(channel, channelId, projectPath, agentSessionId, baseagent, agentAid) {
|
|
1761
|
+
const resolvedBaseagent = typeof baseagent === 'string' ? baseagent.trim() : '';
|
|
1762
|
+
if (!resolvedBaseagent)
|
|
1763
|
+
throw new Error('[SessionManager] importCliSession: baseagent is required');
|
|
1729
1764
|
const inheritedChatType = this.getActiveChatType(channel, channelId);
|
|
1730
1765
|
const resolvedAgentAid = agentAid || this.deriveChannelIdentity(channel, channelId).selfAID;
|
|
1731
|
-
const fileInfo = this.getSessionFileInfo(projectPath, agentSessionId,
|
|
1766
|
+
const fileInfo = this.getSessionFileInfo(projectPath, agentSessionId, resolvedBaseagent, resolvedAgentAid);
|
|
1732
1767
|
const name = fileInfo.title || `CLI会话-${new Date().toLocaleString('zh-CN', { month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit' })}`;
|
|
1733
1768
|
// Derive selfAID and channelType from existing sessions
|
|
1734
1769
|
const existingDir = this.findExistingChatDir(channel, channelId);
|
|
@@ -1750,7 +1785,7 @@ export class SessionManager {
|
|
|
1750
1785
|
selfAID,
|
|
1751
1786
|
projectPath,
|
|
1752
1787
|
threadId: '',
|
|
1753
|
-
baseagent,
|
|
1788
|
+
baseagent: resolvedBaseagent,
|
|
1754
1789
|
sessionKey: formatSessionKey(channelType, channelId, DEFAULT_THREAD_ID),
|
|
1755
1790
|
chatType: inheritedChatType,
|
|
1756
1791
|
agentSessionId,
|
|
@@ -1767,6 +1802,7 @@ export class SessionManager {
|
|
|
1767
1802
|
channelId,
|
|
1768
1803
|
projectPath,
|
|
1769
1804
|
name,
|
|
1805
|
+
baseagent: session.baseagent,
|
|
1770
1806
|
timestamp: Date.now(),
|
|
1771
1807
|
});
|
|
1772
1808
|
return session;
|
|
@@ -191,6 +191,7 @@ export class SessionRenewService {
|
|
|
191
191
|
? await this.sessionManager.createRenewedSession(request.session, {
|
|
192
192
|
source,
|
|
193
193
|
causation: request.causation,
|
|
194
|
+
baseagent: request.currentBaseagent,
|
|
194
195
|
})
|
|
195
196
|
: request.session;
|
|
196
197
|
selected.identity = request.session.identity;
|