chore: follow up on tab snapshot capture (#739)

This commit is contained in:
Pavel Feldman
2025-07-22 17:43:42 -07:00
committed by GitHub
parent 601a74305c
commit 6320b08173
13 changed files with 80 additions and 101 deletions

View File

@@ -23,7 +23,6 @@ export class Response {
private _images: { contentType: string, data: Buffer }[] = [];
private _context: Context;
private _includeSnapshot = false;
private _snapshot: string | undefined;
private _includeTabs = false;
constructor(context: Context) {
@@ -54,10 +53,6 @@ export class Response {
return this._includeSnapshot;
}
addSnapshot(snapshot: string) {
this._snapshot = snapshot;
}
async serialize(): Promise<{ content: (TextContent | ImageContent)[] }> {
const response: string[] = [];
@@ -82,8 +77,8 @@ ${this._code.join('\n')}
response.push(...(await this._context.listTabsMarkdown(this._includeTabs)));
// Add snapshot if provided.
if (this._snapshot)
response.push(this._snapshot, '');
if (this._includeSnapshot && this._context.currentTab())
response.push(await this._context.currentTabOrDie().captureSnapshot(), '');
// Main response part
const content: (TextContent | ImageContent)[] = [