@wu529778790/open-im 1.10.7-beta.1 → 1.10.7-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -214,9 +214,8 @@ export async function main() {
|
|
|
214
214
|
}
|
|
215
215
|
log.info(`启用平台: ${config.enabledPlatforms.join(", ")}`);
|
|
216
216
|
const sessionManager = new SessionManager(startupCwd, config.claudeWorkDir);
|
|
217
|
-
//
|
|
218
|
-
//
|
|
219
|
-
sessionManager.clearAllCliSessionIds();
|
|
217
|
+
// Codex/CodeBuddy 的 sessionId 持久化在 sessions.json;重启后沿用以便 --resume 续聊。
|
|
218
|
+
// 若 CLI 判定会话无效,ai-task 会通过 onSessionInvalid 清理并提示重试。
|
|
220
219
|
// Track active platform handles and successfully initialized platforms
|
|
221
220
|
const activeHandles = new Map();
|
|
222
221
|
const successfulPlatforms = [];
|
|
@@ -25,11 +25,6 @@ export declare class SessionManager {
|
|
|
25
25
|
hasUserSession(userId: string): boolean;
|
|
26
26
|
getConvId(userId: string): string;
|
|
27
27
|
setWorkDir(userId: string, workDir: string): Promise<string>;
|
|
28
|
-
/**
|
|
29
|
-
* 服务启动时调用:清除所有用户的 CLI sessionId。
|
|
30
|
-
* Codex/CodeBuddy 的 session 是进程级别的,服务重启后旧 session 一定无效。
|
|
31
|
-
*/
|
|
32
|
-
clearAllCliSessionIds(): void;
|
|
33
28
|
newSession(userId: string): boolean;
|
|
34
29
|
clearActiveToolSession(userId: string, toolId: ToolId): boolean;
|
|
35
30
|
listConvHistory(userId: string): ConvHistoryEntry[];
|
|
@@ -136,41 +136,6 @@ export class SessionManager {
|
|
|
136
136
|
log.info(`WorkDir changed for user ${userId}: ${realPath}, oldConvId=${oldConvId}`);
|
|
137
137
|
return realPath;
|
|
138
138
|
}
|
|
139
|
-
/**
|
|
140
|
-
* 服务启动时调用:清除所有用户的 CLI sessionId。
|
|
141
|
-
* Codex/CodeBuddy 的 session 是进程级别的,服务重启后旧 session 一定无效。
|
|
142
|
-
*/
|
|
143
|
-
clearAllCliSessionIds() {
|
|
144
|
-
let changed = false;
|
|
145
|
-
for (const [, s] of this.sessions) {
|
|
146
|
-
for (const toolId of ['codex', 'codebuddy']) {
|
|
147
|
-
if (this.getToolSessionId(s, toolId) !== undefined) {
|
|
148
|
-
this.clearToolSessionId(s, toolId);
|
|
149
|
-
changed = true;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
if (s.threads) {
|
|
153
|
-
for (const t of Object.values(s.threads)) {
|
|
154
|
-
for (const toolId of ['codex', 'codebuddy']) {
|
|
155
|
-
if (t.sessionIds?.[toolId] !== undefined) {
|
|
156
|
-
delete t.sessionIds[toolId];
|
|
157
|
-
changed = true;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
for (const key of [...this.convSessionMap.keys()]) {
|
|
164
|
-
if (key.endsWith(':codex') || key.endsWith(':codebuddy')) {
|
|
165
|
-
this.convSessionMap.delete(key);
|
|
166
|
-
changed = true;
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
if (changed) {
|
|
170
|
-
this.flushSync();
|
|
171
|
-
log.info('Cleared CLI session IDs for codex/codebuddy on startup');
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
139
|
newSession(userId) {
|
|
175
140
|
const s = this.sessions.get(userId);
|
|
176
141
|
if (s) {
|