fix(webui): stabilize earlier-history loading and reclaim space (#6349)

* fix(webui): retain smoothly revealed history loading headers

* refactor(webui): simplify history loading feedback

* fix(webui): keep retained history headers clear of preceding text

* fix(webui): reclaim completed history loading space

* refactor(webui): group history projection handoff with navigation

* test(webui): synchronize history motion observations

* fix(webui): collapse history completion geometry handoff
This commit is contained in:
chengyongru authored and GitHub committed 2026-10-21 13:10:05 +08:00
1 parent 73a55e0b2f
commit 743c51e81f
24 files changed
+1658 -356

No files matched your search

+31 -8
View File
@@ -71,6 +71,7 @@ const THREAD_MOTION_TRANSITIONS: Readonly<
"navigation-settled": "current-automatic-mode",
"user-scroll": "browsing-history",
"boundary-scroll": "browsing-history",
"composer-input": "idle",
"resume-follow": "current-automatic-mode",
},
"navigating-history": {
@@ -79,6 +80,7 @@ const THREAD_MOTION_TRANSITIONS: Readonly<
"navigation-settled": "browsing-history",
"user-scroll": "browsing-history",
"boundary-scroll": "browsing-history",
"composer-input": "browsing-history",
"resume-follow": "current-automatic-mode",
},
"browsing-history": {
@@ -164,6 +166,7 @@ export class ThreadMotionCoordinator {
hasOutput: false,
};
private mode: ThreadMotionMode = "idle";
private historyNavigationPromptId: string | null = null;
private promptPositioned = false;
private measurementFrameId: number | null = null;
private geometryDirty = false;
@@ -309,12 +312,21 @@ export class ThreadMotionCoordinator {
}
navigateHistoryTo(top: number): ThreadCameraFollowResult | null {
this.camera.cancel();
return this.beginHistoryNavigation(top, null);
}
navigateHistoryToPrompt(promptId: string): ThreadCameraFollowResult | null {
const geometry = this.measure(promptId);
if (!geometry || geometry.promptTop === null) return null;
return this.beginHistoryNavigation(geometry.promptTop, promptId);
}
private beginHistoryNavigation(top: number, promptId: string | null): ThreadCameraFollowResult | null {
if (this.mode !== "navigating-history") this.camera.cancel();
this.transition("navigate-history");
this.historyNavigationPromptId = promptId;
const result = this.camera.navigateTo(top);
if (!result || result === "settled") {
this.transition("navigation-settled");
}
if (!result || result === "settled") this.transition("navigation-settled");
return result;
}
@@ -378,6 +390,7 @@ export class ThreadMotionCoordinator {
this.composerInputDuringTurn = false;
this.resumeFollowArmed = false;
this.mode = "idle";
this.historyNavigationPromptId = null;
this.promptPositioned = false;
}
@@ -410,6 +423,7 @@ export class ThreadMotionCoordinator {
: transition;
if (nextMode === this.mode) return false;
this.mode = nextMode;
if (nextMode !== "navigating-history") this.historyNavigationPromptId = null;
return true;
}
@@ -434,14 +448,23 @@ export class ThreadMotionCoordinator {
if (!this.geometryDirty) return;
this.geometryDirty = false;
const navigationPromptId = this.mode === "navigating-history"
? this.historyNavigationPromptId
: null;
const needsPromptGeometry =
!this.isHistoryMode()
&& this.turn.id !== null
&& !this.promptPositioned;
const geometry = this.measure(needsPromptGeometry ? this.turn.promptId : null);
navigationPromptId !== null
|| (!this.isHistoryMode() && this.turn.id !== null && !this.promptPositioned);
const geometry = this.measure(navigationPromptId ?? (needsPromptGeometry ? this.turn.promptId : null));
if (!geometry) return;
this.onGeometry?.(geometry);
if (this.mode === "navigating-history" && navigationPromptId !== null) {
if (geometry.promptTop !== null) {
const result = this.camera.navigateTo(geometry.promptTop);
if (!result || result === "settled") this.transition("navigation-settled");
}
return;
}
if (this.mode === "navigating-latest") {
const result = this.camera.navigateTo(geometry.maxScrollTop);
if (!result || result === "settled") {