MCPcopy Index your code
hub / github.com/callstack/agent-device / dispatchScreenshotViaRuntime

Function dispatchScreenshotViaRuntime

src/daemon/screenshot-runtime.ts:18–46  ·  view source on GitHub ↗
(params: {
  session: SessionState;
  sessionName: string;
  outPath?: string;
  outputPlacement: ScreenshotOutputPlacement;
  dispatchContext: DaemonCommandContext;
})

Source from the content-addressed store, hash-verified

16export type ScreenshotOutputPlacement = 'positional' | 'out' | 'default';
17
18export async function dispatchScreenshotViaRuntime(params: {
19 session: SessionState;
20 sessionName: string;
21 outPath?: string;
22 outputPlacement: ScreenshotOutputPlacement;
23 dispatchContext: DaemonCommandContext;
24}): Promise<Record<string, unknown>> {
25 const { session, sessionName, outPath, outputPlacement, dispatchContext } = params;
26 const runtime = createAgentDevice({
27 backend: createDispatchScreenshotBackend({ session, outputPlacement, dispatchContext }),
28 artifacts: createDaemonScreenshotArtifactAdapter(),
29 sessions: createDaemonRuntimeSessionStore({
30 sessionName,
31 getSession: () => session,
32 recordOptions: { includeSnapshot: false },
33 setRecord: () => {},
34 }),
35 policy: localCommandPolicy(),
36 });
37
38 return await runtime.capture.screenshot({
39 session: sessionName,
40 requestId: dispatchContext.requestId,
41 appBundleId: session.appBundleId,
42 ...screenshotOptionsFromFlags(dispatchContext),
43 surface: session.surface,
44 ...(outPath ? { out: { kind: 'path', path: outPath } } : {}),
45 });
46}
47
48function createDispatchScreenshotBackend(params: {
49 session: SessionState;

Calls 7

createAgentDeviceFunction · 0.90
localCommandPolicyFunction · 0.90
screenshotMethod · 0.45

Tested by

no test coverage detected