chore: rebuild CentOS7 release package

This commit is contained in:
shiyue
2026-07-05 17:28:39 +08:00
parent faf6adceb7
commit a3d83080cb
7 changed files with 516 additions and 78 deletions

View File

@@ -78,6 +78,7 @@
const SESSION_LOAD_OVERLAY_TIMEOUT_MS = 12_000;
const SESSION_LOAD_REQUEST_TIMEOUT_MS = 45_000;
const SESSION_RESUME_FALLBACK_MS = 1_500;
const PENDING_SLASH_DRAFT_LIMIT = 30;
const MODEL_OPTIONS = [
{ value: 'opus', label: 'Opus', desc: '最强大1M 上下文' },
@@ -237,6 +238,7 @@
const pendingNotesByTarget = new Map();
const queuedMessagesByTarget = new Map();
const userMessageIndex = new Map();
const pendingSlashDraftsByRequestId = new Map();
const expandedOldSessionGroups = new Set();
document.documentElement.dataset.dividerTime = showAgentDividerTime ? 'show' : 'hide';
@@ -1334,6 +1336,37 @@
return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`;
}
function rememberPendingSlashDraft(requestId, text, sessionId, agent) {
const id = String(requestId || '').trim();
if (!id) return;
while (pendingSlashDraftsByRequestId.size >= PENDING_SLASH_DRAFT_LIMIT) {
const oldest = pendingSlashDraftsByRequestId.keys().next().value;
if (!oldest) break;
pendingSlashDraftsByRequestId.delete(oldest);
}
pendingSlashDraftsByRequestId.set(id, {
text,
sessionId: sessionId || null,
agent: normalizeAgent(agent),
createdAt: Date.now(),
});
}
function applyPendingSlashDraftResponse(msg) {
const requestId = String(msg?.requestId || '').trim();
if (!requestId) return false;
const draft = pendingSlashDraftsByRequestId.get(requestId);
if (!draft) return false;
pendingSlashDraftsByRequestId.delete(requestId);
if (!msg.preserveComposerDraft) return false;
if (draft.sessionId && currentSessionId && draft.sessionId !== currentSessionId) return false;
if (normalizeAgent(draft.agent) !== normalizeAgent(currentAgent)) return false;
if (msgInput.value !== '' || pendingAttachments.length > 0) return false;
msgInput.value = draft.text;
autoResize();
return true;
}
function clearUserMessageIndex() {
userMessageIndex.clear();
}
@@ -1756,6 +1789,8 @@
model: payload.model || '',
agent: normalizeAgent(payload.agent),
pinnedAt: payload.pinnedAt || null,
titleSource: payload.titleSource || null,
createdFromKind: payload.createdFromKind || null,
hasUnread: !!payload.hasUnread,
cwd: payload.cwd || null,
projectName: payload.projectName || '',
@@ -1860,6 +1895,8 @@
agent: normalizeAgent(snapshot.agent),
updated: snapshot.updated || new Date().toISOString(),
pinnedAt: snapshot.pinnedAt || null,
titleSource: snapshot.titleSource || null,
createdFromKind: snapshot.createdFromKind || null,
hasUnread: !!snapshot.hasUnread,
isRunning: !!snapshot.isRunning,
waitingOnChildren: !!snapshot.waitingOnChildren,
@@ -1880,6 +1917,8 @@
cwd: nextMeta.cwd || session.cwd || '',
projectName: nextMeta.cwd ? getPathLeaf(nextMeta.cwd) : session.projectName || nextMeta.projectName || '',
title: nextMeta.title || session.title,
titleSource: nextMeta.titleSource || session.titleSource || null,
createdFromKind: nextMeta.createdFromKind || session.createdFromKind || null,
};
});
if (!found) {
@@ -2496,12 +2535,25 @@
function updateCcwebPromptAnswerFromSelection(questionEl, question) {
const textarea = questionEl.querySelector('.ccweb-prompt-answer');
if (!textarea) return;
const previousSelectionText = textarea.dataset.ccwebPromptSelectionText || '';
const selectedIds = Array.from(questionEl.querySelectorAll('.ccweb-prompt-option.is-selected'))
.map((button) => button.dataset.optionId || '')
.filter(Boolean);
const selectedOptions = (question.options || []).filter((option) => selectedIds.includes(option.id));
const answerText = selectedOptions.map((option) => option.answerText || option.label || '').filter(Boolean).join('\n');
if (answerText) textarea.value = answerText;
if (answerText) {
textarea.value = answerText;
textarea.dataset.ccwebPromptSelectionText = answerText;
return;
}
if (previousSelectionText && textarea.value === previousSelectionText) textarea.value = '';
delete textarea.dataset.ccwebPromptSelectionText;
}
function syncCcwebPromptOptionState(questionEl) {
questionEl.querySelectorAll('.ccweb-prompt-option').forEach((button) => {
button.setAttribute('aria-pressed', button.classList.contains('is-selected') ? 'true' : 'false');
});
}
function selectCcwebPromptOption(questionEl, question, optionId) {
@@ -2511,10 +2563,20 @@
if (button.dataset.optionId === optionId) button.classList.toggle('is-selected');
});
} else {
const shouldDeselect = buttons.some((button) => button.dataset.optionId === optionId && button.classList.contains('is-selected'));
buttons.forEach((button) => {
button.classList.toggle('is-selected', button.dataset.optionId === optionId);
button.classList.toggle('is-selected', !shouldDeselect && button.dataset.optionId === optionId);
});
}
syncCcwebPromptOptionState(questionEl);
updateCcwebPromptAnswerFromSelection(questionEl, question);
}
function clearCcwebPromptSelection(questionEl, question) {
questionEl.querySelectorAll('.ccweb-prompt-option.is-selected').forEach((button) => {
button.classList.remove('is-selected');
});
syncCcwebPromptOptionState(questionEl);
updateCcwebPromptAnswerFromSelection(questionEl, question);
}
@@ -2568,6 +2630,7 @@
button.type = 'button';
button.className = 'ccweb-prompt-option';
button.dataset.optionId = option.id || '';
button.setAttribute('aria-pressed', 'false');
const label = document.createElement('span');
label.className = 'ccweb-prompt-option-label';
label.textContent = option.label || option.id || '选项';
@@ -2587,6 +2650,12 @@
button.addEventListener('click', () => selectCcwebPromptOption(questionEl, question, option.id));
optionList.appendChild(button);
});
const clearChoice = document.createElement('button');
clearChoice.type = 'button';
clearChoice.className = 'ccweb-prompt-clear-choice';
clearChoice.textContent = '不选择';
clearChoice.addEventListener('click', () => clearCcwebPromptSelection(questionEl, question));
optionList.appendChild(clearChoice);
questionEl.appendChild(optionList);
}
@@ -2595,6 +2664,9 @@
answer.rows = 4;
answer.placeholder = question.answerPlaceholder || '填写你的答案...';
answer.value = question.defaultAnswer || '';
answer.addEventListener('input', () => {
delete answer.dataset.ccwebPromptSelectionText;
});
questionEl.appendChild(answer);
const recommended = ccwebPromptRecommendedOption(question);
@@ -3904,10 +3976,11 @@
function createSessionListItem(session) {
const item = document.createElement('div');
const isPinned = !!session.pinnedAt;
const isLlmCreated = String(session.createdFromKind || '').toLowerCase() === 'mcp';
const waitingOnChildren = !!session.waitingOnChildren;
const readyReplyCount = Number(session.readyReplyCount || 0);
const waitingLabel = readyReplyCount > 0 ? `子对话已返回 ${readyReplyCount}` : `等待子对话 ${Number(session.pendingReplyCount || 0) || ''}`.trim();
item.className = `session-item${session.id === currentSessionId ? ' active' : ''}${isPinned ? ' pinned' : ''}${waitingOnChildren ? ' waiting-children' : ''}`;
item.className = `session-item${session.id === currentSessionId ? ' active' : ''}${isPinned ? ' pinned' : ''}${isLlmCreated ? ' llm-created' : ''}${waitingOnChildren ? ' waiting-children' : ''}`;
item.dataset.id = session.id;
const sessionCwd = getSessionEffectiveCwd(session);
if (sessionCwd) item.title = sessionCwd;
@@ -5239,8 +5312,17 @@
break;
case 'session_renamed':
sessions = sessions.map((session) => session.id === msg.sessionId ? { ...session, title: msg.title } : session);
updateCachedSession(msg.sessionId, (snapshot) => { snapshot.title = msg.title; });
sessions = sessions.map((session) => session.id === msg.sessionId ? {
...session,
title: msg.title,
...(msg.titleSource !== undefined ? { titleSource: msg.titleSource || null } : {}),
...(msg.createdFromKind !== undefined ? { createdFromKind: msg.createdFromKind || null } : {}),
} : session);
updateCachedSession(msg.sessionId, (snapshot) => {
snapshot.title = msg.title;
if (msg.titleSource !== undefined) snapshot.titleSource = msg.titleSource || null;
if (msg.createdFromKind !== undefined) snapshot.createdFromKind = msg.createdFromKind || null;
});
if (msg.sessionId === currentSessionId) {
chatTitle.textContent = msg.title;
}
@@ -5348,6 +5430,7 @@
case 'system_message':
if (!isCurrentSessionEvent(msg)) break;
applyPendingSlashDraftResponse(msg);
appendSystemMessage(msg.message, {
tone: msg.tone,
transient: msg.transient,
@@ -5512,6 +5595,7 @@
break;
}
if (pendingNewSessionRequest) pendingNewSessionRequest = null;
applyPendingSlashDraftResponse(msg);
appendError(msg.message, {
transient: msg.transient,
autoDismissMs: msg.autoDismissMs,
@@ -8328,7 +8412,9 @@
autoResize();
return;
}
send({ type: 'message', text, sessionId: currentSessionId, mode: currentMode, agent: currentAgent });
const requestId = createLocalId('slash');
rememberPendingSlashDraft(requestId, text, currentSessionId, currentAgent);
send({ type: 'message', text, sessionId: currentSessionId, mode: currentMode, agent: currentAgent, requestId });
msgInput.value = '';
autoResize();
return;

View File

@@ -1318,6 +1318,18 @@ body.session-loading-active {
border-radius: 999px;
background: var(--accent);
}
.session-item.llm-created:not(.pinned)::before {
content: '';
position: absolute;
left: 4px;
top: 7px;
width: 9px;
height: 9px;
border-top: 2px solid var(--accent);
border-left: 2px solid var(--accent);
border-radius: 4px 0 0 0;
opacity: 0.88;
}
.session-item-main {
flex: 1;
min-width: 0;
@@ -5139,6 +5151,25 @@ html[data-theme='coolvibe'] .settings-back:hover {
font-size: 10px;
font-weight: 900;
}
.ccweb-prompt-clear-choice {
grid-column: 1 / -1;
justify-self: start;
border: 1px solid rgba(221, 208, 192, 0.9);
border-radius: 7px;
background: rgba(255, 255, 255, 0.56);
color: var(--text-muted);
font: inherit;
font-size: 12px;
line-height: 1.25;
padding: 4px 8px;
cursor: pointer;
transition: border-color 0.16s ease, color 0.16s ease, background 0.16s ease;
}
.ccweb-prompt-clear-choice:hover {
border-color: var(--accent);
background: rgba(255, 249, 242, 0.96);
color: var(--accent);
}
.ccweb-prompt-option-label {
min-width: 0;
overflow-wrap: anywhere;
@@ -6372,7 +6403,14 @@ html[data-theme='coolvibe'] .settings-back:hover {
border-color: var(--text-muted);
}
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .ccweb-prompt-clear-choice {
background: rgba(0, 0, 0, 0.16);
border-color: var(--theme-card-hover-border);
color: var(--text-muted);
}
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .ccweb-prompt-option:hover,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .ccweb-prompt-clear-choice:hover,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .ccweb-prompt-tab-nav-btn:hover,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .ccweb-prompt-secondary:hover,
:is(html[data-theme='carbon'], html[data-theme='nocturne'], html[data-theme='cinder']) .pending-ccweb-prompt-action:hover {