Skip to content

Commit af7c8ef

Browse files
feat: add screencast state management to Context interface
Add getScreenRecorder/setScreenRecorder methods to the Context type and McpContext implementation. These store the active ScreenRecorder instance and its output file path, enabling start/stop screencast tool coordination. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
1 parent 4782e48 commit af7c8ef

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

src/McpContext.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import type {
2626
ElementHandle,
2727
HTTPRequest,
2828
Page,
29+
ScreenRecorder,
2930
SerializedAXNode,
3031
PredefinedNetworkConditions,
3132
Viewport,
@@ -121,6 +122,8 @@ export class McpContext implements Context {
121122
#extensionRegistry = new ExtensionRegistry();
122123

123124
#isRunningTrace = false;
125+
#screenRecorderData: {recorder: ScreenRecorder; filePath: string} | null =
126+
null;
124127
#networkConditionsMap = new WeakMap<Page, string>();
125128
#cpuThrottlingRateMap = new WeakMap<Page, number>();
126129
#geolocationMap = new WeakMap<Page, GeolocationOptions>();
@@ -372,6 +375,16 @@ export class McpContext implements Context {
372375
return this.#isRunningTrace;
373376
}
374377

378+
getScreenRecorder(): {recorder: ScreenRecorder; filePath: string} | null {
379+
return this.#screenRecorderData;
380+
}
381+
382+
setScreenRecorder(
383+
data: {recorder: ScreenRecorder; filePath: string} | null,
384+
): void {
385+
this.#screenRecorderData = data;
386+
}
387+
375388
isCruxEnabled(): boolean {
376389
return this.#options.performanceCrux;
377390
}

src/tools/ToolDefinition.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import type {
1010
Dialog,
1111
ElementHandle,
1212
Page,
13+
ScreenRecorder,
1314
Viewport,
1415
} from '../third_party/index.js';
1516
import type {InsightName, TraceResult} from '../trace-processing/parse.js';
@@ -146,6 +147,10 @@ export type Context = Readonly<{
146147
* Returns a reqid for a cdpRequestId.
147148
*/
148149
resolveCdpElementId(cdpBackendNodeId: number): string | undefined;
150+
getScreenRecorder(): {recorder: ScreenRecorder; filePath: string} | null;
151+
setScreenRecorder(
152+
data: {recorder: ScreenRecorder; filePath: string} | null,
153+
): void;
149154
installExtension(path: string): Promise<string>;
150155
uninstallExtension(id: string): Promise<void>;
151156
listExtensions(): InstalledExtension[];

0 commit comments

Comments
 (0)