Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/computer/src/device.ts
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,9 @@ Available Displays: ${displays.length > 0 ? displays.map((d) => d.name).join(',
}

async screenshotBase64(): Promise<string> {
if (this.destroyed) {
throw new Error('ComputerDevice has been destroyed');
}
debugDevice('Taking screenshot', { displayId: this.displayId });

try {
Expand Down
11 changes: 9 additions & 2 deletions packages/playground/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -547,8 +547,15 @@ class PlaygroundServer {
console.warn('Failed to get execution data before cancel:', error);
}

// Recreate/destroy agent to cancel the current task
await this.recreateAgent();
// Destroy agent to cancel the current task
// No need to recreate here — /execute always creates a fresh agent before each run
try {
if (this.agent && typeof this.agent.destroy === 'function') {
await this.agent.destroy();
}
} catch (error) {
console.warn('Failed to destroy agent during cancel:', error);
}

// Clean up
delete this.taskExecutionDumps[requestId];
Expand Down