chore: rebuild release package

This commit is contained in:
shiyue
2026-07-18 19:47:04 +08:00
parent b90f5e1e44
commit a038485ab5
9 changed files with 729 additions and 49 deletions

View File

@@ -4275,6 +4275,8 @@
updateSessionIdBadge();
updateCwdBadge();
updateReloadMcpButtonUI();
// 真正替换聊天 DOM 时,使之前 renderMessages 的异步批次失效。
renderEpoch++;
messagesDiv.innerHTML = buildWelcomeMarkup(currentCwd);
setStatsDisplay(null);
renderPendingAttachments();
@@ -4513,21 +4515,41 @@
(!sessionId || activeSessionLoad.sessionId === sessionId));
}
function finishSessionSwitch(sessionId) {
function finishSessionSwitch(sessionId, requestId) {
// 带 requestId 的完成事件必须属于当前加载代次,避免旧请求尾块关闭新请求。
if (requestId && (!activeSessionLoad ||
activeSessionLoad.sessionId !== sessionId ||
activeSessionLoad.requestId !== requestId)) {
return;
}
if (isBlockingSessionLoad(sessionId)) {
scrollToBottom();
requestAnimationFrame(() => clearSessionLoading(sessionId));
requestAnimationFrame(() => {
// RAF 执行时再次校验请求代次,避免旧请求清除同会话的新加载。
if (requestId && (!activeSessionLoad ||
activeSessionLoad.sessionId !== sessionId ||
activeSessionLoad.requestId !== requestId)) {
return;
}
clearSessionLoading(sessionId);
});
return;
}
clearSessionLoading(sessionId);
}
function finalizeLoadedSession(sessionId) {
function finalizeLoadedSession(sessionId, requestId) {
// 带 requestId 的完成事件必须属于当前加载代次,避免旧 A 尾块完成新 A 请求。
if (requestId && (!activeSessionLoad ||
activeSessionLoad.sessionId !== sessionId ||
activeSessionLoad.requestId !== requestId)) {
return;
}
if (activeSessionLoad?.sessionId === sessionId && activeSessionLoad.snapshot) {
activeSessionLoad.snapshot.complete = true;
cacheSessionSnapshot(activeSessionLoad.snapshot);
}
finishSessionSwitch(sessionId);
finishSessionSwitch(sessionId, requestId);
}
function beginSessionSwitch(sessionId, options = {}) {
@@ -4536,7 +4558,6 @@
const force = options.force === true;
if (!force && activeSessionLoad?.sessionId === sessionId && !activeSessionLoad.overlayReleased) return;
if (!force && sessionId === currentSessionId && !activeSessionLoad) return;
renderEpoch++;
loadedHistorySessionId = null;
setSessionLoading(sessionId, { blocking, label: options.label });
requestSessionLoad(sessionId, { blocking, label: options.label });
@@ -5304,24 +5325,28 @@
&& (!pendingNewSession.cwd || snapshot.cwd === pendingNewSession.cwd)
&& (!pendingNewSession.mode || snapshot.mode === pendingNewSession.mode));
const matchesActiveLoad = !!(activeLoad?.sessionId === msg.sessionId
&& (!activeLoad.requestId || activeLoad.requestId === messageRequestId));
&& (!messageRequestId || activeLoad.requestId === messageRequestId));
const matchesPendingNewSession = !!(pendingNewSession
&& ((!pendingNewSession.requestId || pendingNewSession.requestId === messageRequestId)
&& ((messageRequestId && pendingNewSession.requestId === messageRequestId)
|| matchesPendingNewSessionFallback));
const allowsRequestlessCurrentSession = !messageRequestId && msg.sessionId === currentSessionId;
const allowsRequestlessIdleSession = !messageRequestId && !currentSessionId && !activeLoad && !pendingNewSession;
const allowsRequestlessUnclaimedSession = !messageRequestId && !activeLoad && !pendingNewSession;
const canSwitchToSessionInfo = matchesActiveLoad
|| matchesPendingNewSession
|| msg.sessionId === currentSessionId
|| (!messageRequestId && !currentSessionId && !activeLoad && !pendingNewSession)
|| (!messageRequestId && !activeLoad && !pendingNewSession);
// 带 requestId 的响应只能由对应的活动加载/新建请求接管视图;
// 没有 requestId 的旧服务事件保留当前会话兼容路径。
|| allowsRequestlessCurrentSession
|| allowsRequestlessIdleSession
|| allowsRequestlessUnclaimedSession;
if (!canSwitchToSessionInfo) {
// 旧代次事件不能污染缓存或会话列表。
break;
}
mergeSessionListSnapshot(snapshot);
if (matchesActiveLoad) {
activeSessionLoad.snapshot = snapshot;
}
if (!canSwitchToSessionInfo) {
if (!msg.historyPending) cacheSessionSnapshot(snapshot);
renderSessionList();
break;
}
if (matchesPendingNewSession) {
pendingNewSessionRequest = null;
if (!matchesActiveLoad) clearSessionLoading();
@@ -5341,34 +5366,48 @@
}
if (!msg.historyPending) {
if (matchesActiveLoad) {
finalizeLoadedSession(msg.sessionId);
finalizeLoadedSession(msg.sessionId, messageRequestId || undefined);
} else {
cacheSessionSnapshot(snapshot);
finishSessionSwitch(msg.sessionId);
finishSessionSwitch(msg.sessionId, messageRequestId || undefined);
}
}
break;
case 'session_history_chunk':
if (activeSessionLoad?.recoverCurrent && activeSessionLoad.sessionId === msg.sessionId) {
if (!msg.remaining) finalizeLoadedSession(msg.sessionId);
case 'session_history_chunk': {
const historyRequestId = String(msg.requestId || '');
const matchesActiveHistoryLoad = !!(activeSessionLoad
&& activeSessionLoad.sessionId === msg.sessionId
&& (!historyRequestId || activeSessionLoad.requestId === historyRequestId));
const allowsLegacyHistory = !historyRequestId
&& msg.sessionId === currentSessionId
&& loadedHistorySessionId === msg.sessionId;
if (activeSessionLoad?.recoverCurrent && matchesActiveHistoryLoad) {
if (activeSessionLoad.snapshot) {
activeSessionLoad.snapshot.messages = cloneMessages(msg.messages || [])
.concat(activeSessionLoad.snapshot.messages);
}
if (!msg.remaining) finalizeLoadedSession(msg.sessionId, historyRequestId || undefined);
break;
}
if ((matchesActiveHistoryLoad || allowsLegacyHistory)
&& msg.sessionId === currentSessionId
&& loadedHistorySessionId === msg.sessionId) {
const blocking = isBlockingSessionLoad(msg.sessionId);
if (activeSessionLoad?.sessionId === msg.sessionId && activeSessionLoad.snapshot) {
activeSessionLoad.snapshot.messages = cloneMessages(msg.messages || []).concat(activeSessionLoad.snapshot.messages);
}
prependHistoryMessages(msg.messages || [], {
preserveScroll: !blocking,
skipScrollbar: blocking,
baseIndex: Number.isFinite(Number(msg.historyBaseIndex)) ? Number(msg.historyBaseIndex) : 0,
});
if (!msg.remaining) {
finalizeLoadedSession(msg.sessionId, historyRequestId || undefined);
}
}
break;
}
if (msg.sessionId === currentSessionId && loadedHistorySessionId === msg.sessionId) {
const blocking = isBlockingSessionLoad(msg.sessionId);
if (activeSessionLoad?.sessionId === msg.sessionId && activeSessionLoad.snapshot) {
activeSessionLoad.snapshot.messages = cloneMessages(msg.messages || []).concat(activeSessionLoad.snapshot.messages);
}
prependHistoryMessages(msg.messages || [], {
preserveScroll: !blocking,
skipScrollbar: blocking,
baseIndex: Number.isFinite(Number(msg.historyBaseIndex)) ? Number(msg.historyBaseIndex) : 0,
});
if (!msg.remaining) {
finalizeLoadedSession(msg.sessionId);
}
}
break;
case 'session_message':
if (msg.sessionId && msg.message) {

View File

@@ -24,7 +24,7 @@
document.documentElement.dataset.dividerTime = dividerTime;
})();
</script>
<link rel="stylesheet" href="style.css?v=20260718-wasteland-bg-right-4">
<link rel="stylesheet" href="style.css?v=20260718-shared-locator-panel-2">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/atom-one-dark.min.css">
</head>
<body>
@@ -183,6 +183,6 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/marked/12.0.1/marked.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mermaid/10.9.1/mermaid.min.js"></script>
<script src="app.js?v=20260718-wasteland-bg-right-4"></script>
<script src="app.js?v=20260718-shared-locator-panel-2"></script>
</body>
</html>

View File

@@ -3970,7 +3970,8 @@ html[data-divider-time='hide'] .msg-bubble .agent-message-divider span {
font-size: 12px;
}
.user-outline-panel {
right: 0;
left: 0;
right: auto;
width: min(320px, calc(100vw - 20px));
}
}
@@ -4039,12 +4040,16 @@ html[data-divider-time='hide'] .msg-bubble .agent-message-divider span {
right: auto;
}
.user-outline-panel {
left: 0;
left: auto;
right: 0;
width: auto;
width: min(320px, calc(100vw - 20px));
max-height: min(44vh, 300px);
bottom: calc(100% + 6px);
}
.ccweb-prompt-outline-panel {
left: 0;
right: auto;
}
.msg-copy-btn {
opacity: 1;
width: 24px;
@@ -9030,6 +9035,13 @@ html[data-theme='gilded'] {
box-shadow: var(--sidebar-hover-shadow);
}
/* 收起后控制条会贴近左侧轨道,定位浮层需朝聊天画布展开,避免越过应用边界被裁切。 */
.app.sidebar-collapsed .user-outline-panel {
left: 0;
right: auto;
z-index: 120;
}
.app.sidebar-collapsed .sidebar::after {
content: '';
position: absolute;