feat(vom): update vom algorithm, fix overlay problem with background state machine

This commit is contained in:
Ljy-0827
2026-07-27 13:46:33 +08:00
parent e14ae9cea0
commit 4fb2e331a6
36 changed files with 2276 additions and 452 deletions
@@ -1,3 +1,4 @@
import type { OverlayMode } from "@/lib/overlay-bridge";
import type { BorrowRequestData } from "./BorrowConfirmationOverlay";
import type { HelpRequestData } from "./HelpRequestOverlay";
import type { RecordRequestData } from "./RecordOverlay";
@@ -9,6 +10,7 @@ export interface OverlayState {
controlVisible: boolean;
interrupting: boolean;
activeSessionId: string | null;
controlMode: OverlayMode;
automationBypassCount: number;
/**
* After record Finish/Stop clears `activeRecord`, the session is still
@@ -31,6 +33,7 @@ export class OverlayController {
activeRecord: null,
interrupting: false,
activeSessionId: null,
controlMode: "hidden",
automationBypassCount: 0,
suppressControlAfterRecord: false,
};
@@ -44,7 +47,7 @@ export class OverlayController {
}
isControlVisible(): boolean {
return this.state.activeSessionId !== null;
return this.state.activeSessionId !== null && this.state.controlMode === "control";
}
addBorrowRequest(request: BorrowRequestData): void {
@@ -61,6 +64,25 @@ export class OverlayController {
activateAgentSession(sessionId: string): void {
this.state.activeSessionId = sessionId;
this.state.interrupting = false;
this.state.controlMode = "control";
}
applyAgentControlMode(sessionId: string | null, mode: OverlayMode): void {
if (mode === "control" && sessionId) {
this.state.activeSessionId = sessionId;
this.state.interrupting = false;
this.state.controlMode = "control";
return;
}
if ((mode === "interrupting" || mode === "paused") && sessionId) {
this.state.activeSessionId = sessionId;
this.state.interrupting = mode === "interrupting";
this.state.controlMode = mode;
return;
}
this.state.activeSessionId = null;
this.state.interrupting = false;
this.state.controlMode = "hidden";
}
setInterrupting(interrupting: boolean): void {
@@ -118,6 +140,7 @@ export class OverlayController {
activeRecord: null,
interrupting: false,
activeSessionId: null,
controlMode: "hidden",
automationBypassCount: 0,
suppressControlAfterRecord: false,
};