chore: rebuild CentOS7 release package

This commit is contained in:
shiyue
2026-07-01 09:29:11 +08:00
parent ddd97398e7
commit 75ffdb1c6f
6 changed files with 247 additions and 11 deletions

View File

@@ -9882,10 +9882,46 @@ function resolveCodexImportAgent(value) {
return value === 'codexapp' ? 'codexapp' : 'codex';
}
function codexImportSourceLabel(source) {
if (!source) return '';
if (typeof source === 'string') return source;
if (source && typeof source === 'object') {
if (source.subagent?.thread_spawn) return 'subagent';
if (source.type) return String(source.type);
}
return '';
}
function extractCcwebSourceConversation(title) {
const match = String(title || '').match(/^来自「([^」]+)」对话ID:\s*([0-9a-fA-F-]{36}))的消息:/);
if (!match) return null;
return {
id: match[2].toLowerCase(),
title: match[1],
};
}
function codexImportDedupeKey(item) {
if (item.sourceConversationId) return `ccweb-source:${item.sourceConversationId}`;
return `thread:${item.threadId}`;
}
function codexImportItemTime(item) {
const time = new Date(item?.updatedAt || 0).getTime();
return Number.isFinite(time) ? time : 0;
}
function preferCodexImportItem(next, current) {
const nextTime = codexImportItemTime(next);
const currentTime = codexImportItemTime(current);
if (nextTime !== currentTime) return nextTime > currentTime ? next : current;
return String(next.rolloutPath || '') > String(current.rolloutPath || '') ? next : current;
}
function handleListCodexSessions(ws, msg = {}) {
const importAgent = resolveCodexImportAgent(msg?.agent);
const imported = getImportedCodexThreadIds(importAgent);
const items = [];
const itemsByKey = new Map();
const seen = new Set();
for (const filePath of getCodexRolloutFiles()) {
const parsed = parseCodexRolloutFile(filePath);
@@ -9893,18 +9929,41 @@ function handleListCodexSessions(ws, msg = {}) {
if (seen.has(parsed.meta.threadId)) continue;
seen.add(parsed.meta.threadId);
const title = parsed.meta.title || parsed.meta.threadId.slice(0, 20);
items.push({
const sourceConversation = parsed.meta.sourceConversationId
? {
id: parsed.meta.sourceConversationId,
title: parsed.meta.sourceConversationTitle || '',
}
: extractCcwebSourceConversation(title);
const item = {
threadId: parsed.meta.threadId,
title,
cwd: parsed.meta.cwd || null,
updatedAt: parsed.meta.updatedAt || null,
cliVersion: parsed.meta.cliVersion || '',
source: parsed.meta.source || '',
source: codexImportSourceLabel(parsed.meta.source),
sourceConversationId: sourceConversation?.id || null,
sourceConversationTitle: sourceConversation?.title || '',
duplicateCount: 1,
rolloutPath: filePath,
agent: importAgent,
alreadyImported: imported.has(parsed.meta.threadId),
});
};
const dedupeKey = codexImportDedupeKey(item);
const current = itemsByKey.get(dedupeKey);
if (!current) {
itemsByKey.set(dedupeKey, item);
continue;
}
const preferred = preferCodexImportItem(item, current);
preferred.duplicateCount = (current.duplicateCount || 1) + 1;
itemsByKey.set(dedupeKey, preferred);
}
const items = Array.from(itemsByKey.values()).sort((a, b) => {
const timeDiff = codexImportItemTime(b) - codexImportItemTime(a);
if (timeDiff) return timeDiff;
return String(b.rolloutPath || '').localeCompare(String(a.rolloutPath || ''));
});
wsSend(ws, { type: 'codex_sessions', sessions: items });
}