mirror of
https://github.com/Tencent/BrowserSkill.git
synced 2026-09-10 13:01:23 +08:00
fix(dsh-plugin-browserskill): keep observation frames in a 2-slot ring
Stop writing overlay thumbnails into the durable attachment store. Each session now holds only the current and previous PNG in process memory, reuses the id when the hash is unchanged, and drops the rest on rotate, remove, or dispose.
This commit is contained in:
@@ -733,6 +733,10 @@ describe("observation action instrumentation timing", () => {
|
||||
const navigateGate = new Promise<void>((resolve) => {
|
||||
releaseNavigate = resolve;
|
||||
});
|
||||
let releaseSnapshot!: () => void;
|
||||
const snapshotGate = new Promise<void>((resolve) => {
|
||||
releaseSnapshot = resolve;
|
||||
});
|
||||
const runner: BskRunner = {
|
||||
async run(args: string[]): Promise<BskRunResult> {
|
||||
if (args[0] === "session") {
|
||||
@@ -754,6 +758,21 @@ describe("observation action instrumentation timing", () => {
|
||||
aborted: false,
|
||||
};
|
||||
}
|
||||
if (args[0] === "snapshot") {
|
||||
await snapshotGate;
|
||||
return {
|
||||
code: 0,
|
||||
stdout: JSON.stringify({ text: "ok", ref_count: 0, tab_id: 7, truncated: false }),
|
||||
stderr: "",
|
||||
timedOut: false,
|
||||
aborted: false,
|
||||
};
|
||||
}
|
||||
// Observation captures share the session queue; fail them fast so they
|
||||
// cannot stall the action-label assertions.
|
||||
if (args[0] === "screenshot") {
|
||||
return { code: 1, stdout: "", stderr: "skip", timedOut: false, aborted: false };
|
||||
}
|
||||
return {
|
||||
code: 0,
|
||||
stdout: JSON.stringify({ text: "ok", ref_count: 0, tab_id: 7, truncated: false }),
|
||||
@@ -792,6 +811,7 @@ describe("observation action instrumentation timing", () => {
|
||||
await vi.waitFor(() =>
|
||||
expect(observation.getState().find((s) => s.sessionId === "s1")?.action).toBe("snapshotting"),
|
||||
);
|
||||
releaseSnapshot();
|
||||
await b;
|
||||
await vi.waitFor(() =>
|
||||
expect(observation.getState().find((s) => s.sessionId === "s1")?.action).toBe("idle"),
|
||||
|
||||
Reference in New Issue
Block a user