fix: simplify folder icon handling

This commit is contained in:
JOJO 2025-12-16 18:01:33 +08:00
parent e27bc62ca7
commit 760fae4920
3 changed files with 679 additions and 146 deletions

File diff suppressed because it is too large Load Diff

View File

@ -31,4 +31,5 @@ export interface MonitorDriver {
previewSceneProgress(name: string): void; previewSceneProgress(name: string): void;
playScene(name: string, payload: Record<string, any>, runtime: MonitorSceneRuntime): Promise<void>; playScene(name: string, payload: Record<string, any>, runtime: MonitorSceneRuntime): Promise<void>;
destroy(): void; destroy(): void;
preparePendingCreation?(path?: string | null): void;
} }

View File

@ -149,7 +149,12 @@ export const useMonitorStore = defineStore('monitor', {
actions: { actions: {
registerDriver(driver: MonitorDriver) { registerDriver(driver: MonitorDriver) {
this.driver = driver; this.driver = driver;
this.driver.resetScene({ desktopRoots: this.lastTreeSnapshot, preserveBubble: this.bubbleActive }); this.driver.resetScene({
desktopRoots: this.lastTreeSnapshot,
preserveBubble: this.bubbleActive,
preservePointer: false, // 初次挂载重置指针
preserveWindows: false
});
if (this.speechBuffer) { if (this.speechBuffer) {
this.driver.showSpeechBubble(this.speechBuffer, { variant: 'info', duration: 0 }); this.driver.showSpeechBubble(this.speechBuffer, { variant: 'info', duration: 0 });
this.bubbleActive = true; this.bubbleActive = true;
@ -191,7 +196,7 @@ export const useMonitorStore = defineStore('monitor', {
preserveAwaitingTools?: boolean; preserveAwaitingTools?: boolean;
}) { }) {
const preserveBubble = !!options?.preserveBubble; const preserveBubble = !!options?.preserveBubble;
const preservePointer = !!options?.preservePointer; const preservePointer = options?.preservePointer !== false;
const preserveWindows = !!options?.preserveWindows; const preserveWindows = !!options?.preserveWindows;
const preserveQueue = !!options?.preserveQueue; const preserveQueue = !!options?.preserveQueue;
const preservePendingResults = !!options?.preservePendingResults; const preservePendingResults = !!options?.preservePendingResults;
@ -362,6 +367,20 @@ export const useMonitorStore = defineStore('monitor', {
this.ensurePendingResult(id); this.ensurePendingResult(id);
this.queue.push({ id, script, payload: { ...payload, executionId: id } }); this.queue.push({ id, script, payload: { ...payload, executionId: id } });
this.awaitingTools[id] = payload.name; this.awaitingTools[id] = payload.name;
// 提前为创建类工具标记“待创建”路径,避免动画开始前图标闪现
if (this.driver && typeof this.driver.preparePendingCreation === 'function') {
if (payload.name === 'create_folder' || payload.name === 'create_file') {
const pendingPath =
payload?.arguments?.path ||
payload?.arguments?.target_path ||
payload?.arguments?.targetPath ||
payload?.argumentSnapshot?.path ||
payload?.argumentSnapshot?.target_path;
this.driver.preparePendingCreation(pendingPath);
}
}
monitorLifecycleLog('enqueue', { monitorLifecycleLog('enqueue', {
id, id,
tool: payload.name, tool: payload.name,