@midscene/playground 1.10.4 → 1.10.5-beta-20260714101501.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/adapters/remote-execution.mjs +38 -1
- package/dist/es/adapters/remote-execution.mjs.map +1 -1
- package/dist/es/mjpeg-hub.mjs +7 -6
- package/dist/es/mjpeg-hub.mjs.map +1 -1
- package/dist/es/mjpeg-stream-handler.mjs +7 -1
- package/dist/es/mjpeg-stream-handler.mjs.map +1 -1
- package/dist/es/platform.mjs.map +1 -1
- package/dist/es/sdk/index.mjs +10 -0
- package/dist/es/sdk/index.mjs.map +1 -1
- package/dist/es/server.mjs +369 -35
- package/dist/es/server.mjs.map +1 -1
- package/dist/lib/adapters/remote-execution.js +38 -1
- package/dist/lib/adapters/remote-execution.js.map +1 -1
- package/dist/lib/mjpeg-hub.js +7 -6
- package/dist/lib/mjpeg-hub.js.map +1 -1
- package/dist/lib/mjpeg-stream-handler.js +7 -1
- package/dist/lib/mjpeg-stream-handler.js.map +1 -1
- package/dist/lib/platform.js.map +1 -1
- package/dist/lib/sdk/index.js +10 -0
- package/dist/lib/sdk/index.js.map +1 -1
- package/dist/lib/server.js +367 -33
- package/dist/lib/server.js.map +1 -1
- package/dist/types/adapters/remote-execution.d.ts +3 -0
- package/dist/types/platform.d.ts +1 -0
- package/dist/types/sdk/index.d.ts +3 -0
- package/dist/types/server.d.ts +18 -1
- package/dist/types/types.d.ts +1 -0
- package/package.json +3 -3
- package/static/index.html +1 -1
- package/static/static/css/index.2b6b43ad.css +2 -0
- package/static/static/css/index.2b6b43ad.css.map +1 -0
- package/static/static/js/{445.884e7c8e.js → 890.03bb43a9.js} +3 -3
- package/static/static/js/{445.884e7c8e.js.LICENSE.txt → 890.03bb43a9.js.LICENSE.txt} +0 -2
- package/static/static/js/890.03bb43a9.js.map +1 -0
- package/static/static/js/index.2a85361c.js +960 -0
- package/static/static/js/index.2a85361c.js.map +1 -0
- package/static/static/css/index.1293237f.css +0 -2
- package/static/static/css/index.1293237f.css.map +0 -1
- package/static/static/js/445.884e7c8e.js.map +0 -1
- package/static/static/js/index.babddf12.js +0 -960
- package/static/static/js/index.babddf12.js.map +0 -1
- /package/static/static/js/{index.babddf12.js.LICENSE.txt → index.2a85361c.js.LICENSE.txt} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk/index.mjs","sources":["../../../src/sdk/index.ts"],"sourcesContent":["import type { ConnectivityTestResult, DeviceAction } from '@midscene/core';\nimport { PLAYGROUND_SERVER_PORT } from '@midscene/shared/constants';\nimport type { TModelConfig } from '@midscene/shared/env';\nimport type { BasePlaygroundAdapter } from '../adapters/base';\nimport { LocalExecutionAdapter } from '../adapters/local-execution';\nimport { RemoteExecutionAdapter } from '../adapters/remote-execution';\nimport type {\n PlaygroundRecorderCapabilitiesResult,\n PlaygroundRecorderDescribeResult,\n PlaygroundRecorderEvent,\n PlaygroundRecorderEventsResult,\n PlaygroundRecorderStartResult,\n PlaygroundSessionSetup,\n PlaygroundSessionState,\n PlaygroundSessionTarget,\n} from '../platform';\nimport type { PlaygroundRuntimeInfo } from '../runtime-metadata';\nimport type {\n AgentFactory,\n BeforeActionHook,\n ExecutionOptions,\n FormValue,\n PlaygroundAgent,\n PlaygroundConfig,\n ValidationResult,\n} from '../types';\n\nexport type PlaygroundInteractPayload = {\n actionType: string;\n} & Record<string, unknown>;\n\nexport interface PlaygroundInteractResult {\n ok: boolean;\n error?: string;\n}\n\nexport type PlaygroundPageRecordedEvent = PlaygroundRecorderEvent;\nexport type {\n PlaygroundRecorderCapabilitiesResult,\n PlaygroundRecorderDescribeResult,\n PlaygroundRecorderEventsResult,\n PlaygroundRecorderStartResult,\n};\n\nexport class PlaygroundSDK {\n private adapter: BasePlaygroundAdapter;\n private beforeActionHook?: BeforeActionHook;\n\n constructor(config: PlaygroundConfig) {\n this.adapter = this.createAdapter(\n config.type,\n config.serverUrl,\n config.agent,\n config.agentFactory,\n );\n }\n\n private createAdapter(\n type: string,\n serverUrl?: string,\n agent?: PlaygroundAgent,\n agentFactory?: AgentFactory,\n ): BasePlaygroundAdapter {\n switch (type) {\n case 'local-execution':\n if (!agent && !agentFactory) {\n throw new Error(\n 'Agent or agentFactory is required for local execution',\n );\n }\n return new LocalExecutionAdapter(agent, agentFactory);\n case 'remote-execution': {\n // Use provided serverUrl first, then fallback to localhost if current page origin is file:// or default\n const finalServerUrl =\n serverUrl ||\n (typeof window !== 'undefined' &&\n window.location.protocol.includes('http')\n ? window.location.origin\n : `http://localhost:${PLAYGROUND_SERVER_PORT}`);\n\n return new RemoteExecutionAdapter(finalServerUrl);\n }\n default:\n throw new Error(`Unsupported execution type: ${type}`);\n }\n }\n\n private runtimeMetadataAdapter():\n | LocalExecutionAdapter\n | RemoteExecutionAdapter\n | null {\n if (\n this.adapter instanceof LocalExecutionAdapter ||\n this.adapter instanceof RemoteExecutionAdapter\n ) {\n return this.adapter;\n }\n\n return null;\n }\n\n async executeAction(\n actionType: string,\n value: FormValue,\n options: ExecutionOptions,\n ): Promise<unknown> {\n await this.beforeActionHook?.(actionType, value, options);\n const result = await this.adapter.executeAction(actionType, value, options);\n return result;\n }\n\n setBeforeActionHook(hook?: BeforeActionHook): void {\n this.beforeActionHook = hook;\n }\n\n async getActionSpace(context?: unknown): Promise<DeviceAction<unknown>[]> {\n // Both adapters now accept context parameter\n // Local will prioritize internal agent, Remote will use server + fallback\n return this.adapter.getActionSpace(context);\n }\n\n validateStructuredParams(\n value: FormValue,\n action: DeviceAction<unknown> | undefined,\n ): ValidationResult {\n return this.adapter.validateParams(value, action);\n }\n\n formatErrorMessage(error: any): string {\n return this.adapter.formatErrorMessage(error);\n }\n\n createDisplayContent(\n value: FormValue,\n needsStructuredParams: boolean,\n action: DeviceAction<unknown> | undefined,\n ): string {\n return this.adapter.createDisplayContent(\n value,\n needsStructuredParams,\n action,\n );\n }\n\n // Get adapter ID (works for both remote and local execution)\n get id(): string | undefined {\n if (this.adapter instanceof RemoteExecutionAdapter) {\n return this.adapter.id;\n }\n if (this.adapter instanceof LocalExecutionAdapter) {\n return this.adapter.id;\n }\n return undefined;\n }\n\n // Server communication methods (for remote execution)\n async checkStatus(): Promise<boolean> {\n if (this.adapter instanceof RemoteExecutionAdapter) {\n return this.adapter.checkStatus();\n }\n return true; // For local execution, always return true\n }\n\n async overrideConfig(aiConfig: any): Promise<void> {\n return this.adapter.overrideConfig(aiConfig);\n }\n\n async runConnectivityTest(\n aiConfig: TModelConfig,\n ): Promise<ConnectivityTestResult> {\n return this.adapter.runConnectivityTest(aiConfig);\n }\n\n // Get task progress (for remote execution)\n async getTaskProgress(requestId: string): Promise<{ executionDump?: any }> {\n if (this.adapter instanceof RemoteExecutionAdapter) {\n return this.adapter.getTaskProgress(requestId);\n }\n // For local execution, progress is handled via onDumpUpdate callback\n return {};\n }\n\n // Cancel task (for remote execution)\n async cancelTask(requestId: string): Promise<any> {\n if (this.adapter instanceof RemoteExecutionAdapter) {\n return this.adapter.cancelTask(requestId);\n }\n return { error: 'Cancel task not supported in local execution mode' };\n }\n\n // Dump update callback management\n onDumpUpdate(callback: (dump: string, executionDump?: any) => void): void {\n if (this.adapter instanceof LocalExecutionAdapter) {\n this.adapter.onDumpUpdate(callback);\n } else if (this.adapter instanceof RemoteExecutionAdapter) {\n this.adapter.onDumpUpdate(callback);\n }\n }\n\n // Progress update callback management\n onProgressUpdate(callback: (tip: string) => void): void {\n if (this.adapter instanceof LocalExecutionAdapter) {\n this.adapter.setProgressCallback(callback);\n }\n // RemoteExecutionAdapter uses polling mechanism via onDumpUpdate, no separate progress callback needed\n }\n\n // Cancel execution - supports both remote and local\n async cancelExecution(requestId: string): Promise<{\n dump: any | null;\n reportHTML: string | null;\n } | null> {\n if (this.adapter instanceof RemoteExecutionAdapter) {\n const result = await this.adapter.cancelTask(requestId);\n // Return dump and reportHTML if available from cancellation\n if (result.success) {\n return {\n dump: (result as any).dump || null,\n reportHTML: (result as any).reportHTML || null,\n };\n }\n } else if (this.adapter instanceof LocalExecutionAdapter) {\n // Invoke adapter cancellation to destroy the agent and block further actions\n const result = await this.adapter.cancelTask(requestId);\n if (result.success) {\n return {\n dump: (result as any).dump || null,\n reportHTML: (result as any).reportHTML || null,\n };\n }\n }\n return null;\n }\n\n // Get current execution data (dump and report)\n async getCurrentExecutionData(): Promise<{\n dump: any | null;\n reportHTML: string | null;\n }> {\n if (\n this.adapter instanceof LocalExecutionAdapter &&\n this.adapter.getCurrentExecutionData\n ) {\n return await this.adapter.getCurrentExecutionData();\n }\n // For remote execution or if method not available, return empty data\n return { dump: null, reportHTML: null };\n }\n\n // Screenshot method for remote execution\n async getScreenshot(): Promise<{\n screenshot: string;\n timestamp: number;\n } | null> {\n if (this.adapter instanceof RemoteExecutionAdapter) {\n return this.adapter.getScreenshot();\n }\n return null; // For local execution, not supported yet\n }\n\n // Direct device manipulation – mouse/keyboard input from UI overlays.\n async interact(\n payload: PlaygroundInteractPayload,\n ): Promise<PlaygroundInteractResult> {\n if (this.adapter instanceof RemoteExecutionAdapter) {\n return this.adapter.interact(payload);\n }\n return { ok: false, error: 'Direct interaction requires remote execution' };\n }\n\n async startRecorderSession(\n sessionId: string,\n ): Promise<PlaygroundRecorderStartResult> {\n if (this.adapter instanceof RemoteExecutionAdapter) {\n return this.adapter.startRecorderSession(sessionId);\n }\n return {\n ok: false,\n supported: false,\n error: 'Recorder requires remote execution',\n };\n }\n\n async getRecorderCapabilities(): Promise<PlaygroundRecorderCapabilitiesResult> {\n if (this.adapter instanceof RemoteExecutionAdapter) {\n return this.adapter.getRecorderCapabilities();\n }\n return {\n supported: false,\n source: 'unsupported',\n error: 'Recorder requires remote execution',\n };\n }\n\n async stopRecorderSession(): Promise<PlaygroundInteractResult> {\n if (this.adapter instanceof RemoteExecutionAdapter) {\n return this.adapter.stopRecorderSession();\n }\n return { ok: true };\n }\n\n async getRecorderEvents(since = 0): Promise<PlaygroundRecorderEventsResult> {\n if (this.adapter instanceof RemoteExecutionAdapter) {\n return this.adapter.getRecorderEvents(since);\n }\n return { events: [], nextIndex: since };\n }\n\n async describeRecorderEventAtPoint(\n event: PlaygroundRecorderEvent,\n ): Promise<PlaygroundRecorderDescribeResult> {\n if (this.adapter instanceof RemoteExecutionAdapter) {\n return this.adapter.describeRecorderEventAtPoint(event);\n }\n return {\n ok: false,\n error: 'Recorder aiDescribe requires remote execution',\n };\n }\n\n // Get interface information (type and description)\n async getInterfaceInfo(): Promise<{\n type: string;\n description?: string;\n size?: { width: number; height: number };\n navigationState?: { isLoading: boolean };\n /** Action names exposed by the connected device's actionSpace. */\n actionTypes?: string[];\n } | null> {\n const adapter = this.runtimeMetadataAdapter();\n if (!adapter) {\n return null;\n }\n\n return adapter.getInterfaceInfo();\n }\n\n async getRuntimeInfo(): Promise<PlaygroundRuntimeInfo | null> {\n const adapter = this.runtimeMetadataAdapter();\n if (!adapter) {\n return null;\n }\n\n return adapter.getRuntimeInfo();\n }\n\n async getSessionInfo(): Promise<PlaygroundSessionState | null> {\n if (this.adapter instanceof RemoteExecutionAdapter) {\n return this.adapter.getSessionInfo();\n }\n\n return null;\n }\n\n async getSessionSetup(\n input?: Record<string, unknown>,\n ): Promise<PlaygroundSessionSetup | null> {\n if (this.adapter instanceof RemoteExecutionAdapter) {\n return this.adapter.getSessionSetup(input);\n }\n\n return null;\n }\n\n async listSessionTargets(): Promise<PlaygroundSessionTarget[]> {\n if (this.adapter instanceof RemoteExecutionAdapter) {\n return this.adapter.listSessionTargets();\n }\n\n return [];\n }\n\n async createSession(input?: Record<string, unknown>): Promise<{\n session: PlaygroundSessionState;\n runtimeInfo: PlaygroundRuntimeInfo;\n }> {\n if (this.adapter instanceof RemoteExecutionAdapter) {\n return this.adapter.createSession(input);\n }\n\n throw new Error('Session creation is only supported in server mode');\n }\n\n async destroySession(): Promise<{\n session: PlaygroundSessionState;\n runtimeInfo: PlaygroundRuntimeInfo;\n }> {\n if (this.adapter instanceof RemoteExecutionAdapter) {\n return this.adapter.destroySession();\n }\n\n throw new Error('Session destruction is only supported in server mode');\n }\n\n // Get service mode based on adapter type\n getServiceMode(): 'In-Browser-Extension' | 'Server' {\n if (this.adapter instanceof LocalExecutionAdapter) {\n return 'In-Browser-Extension';\n }\n return 'Server';\n }\n}\n"],"names":["PlaygroundSDK","type","serverUrl","agent","agentFactory","Error","LocalExecutionAdapter","finalServerUrl","window","PLAYGROUND_SERVER_PORT","RemoteExecutionAdapter","actionType","value","options","result","hook","context","action","error","needsStructuredParams","aiConfig","requestId","callback","payload","sessionId","since","event","adapter","input","config"],"mappings":";;;;;;;;;;;;;AA4CO,MAAMA;IAaH,cACNC,IAAY,EACZC,SAAkB,EAClBC,KAAuB,EACvBC,YAA2B,EACJ;QACvB,OAAQH;YACN,KAAK;gBACH,IAAI,CAACE,SAAS,CAACC,cACb,MAAM,IAAIC,MACR;gBAGJ,OAAO,IAAIC,sBAAsBH,OAAOC;YAC1C,KAAK;gBAAoB;oBAEvB,MAAMG,iBACJL,aACC,CAAkB,eAAlB,OAAOM,UACRA,OAAO,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,UAC9BA,OAAO,QAAQ,CAAC,MAAM,GACtB,CAAC,iBAAiB,EAAEC,wBAAuB;oBAEjD,OAAO,IAAIC,uBAAuBH;gBACpC;YACA;gBACE,MAAM,IAAIF,MAAM,CAAC,4BAA4B,EAAEJ,MAAM;QACzD;IACF;IAEQ,yBAGC;QACP,IACE,IAAI,CAAC,OAAO,YAAYK,yBACxB,IAAI,CAAC,OAAO,YAAYI,wBAExB,OAAO,IAAI,CAAC,OAAO;QAGrB,OAAO;IACT;IAEA,MAAM,cACJC,UAAkB,EAClBC,KAAgB,EAChBC,OAAyB,EACP;QAClB,MAAM,IAAI,CAAC,gBAAgB,GAAGF,YAAYC,OAAOC;QACjD,MAAMC,SAAS,MAAM,IAAI,CAAC,OAAO,CAAC,aAAa,CAACH,YAAYC,OAAOC;QACnE,OAAOC;IACT;IAEA,oBAAoBC,IAAuB,EAAQ;QACj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AAYjB,wBAC1B,OAAO,IAAI,CAAC,OAAO,CAAC,cAAc;QAGpC,OAAO;IACT;IAEA,MAAM,gBACJkB,KAA+B,EACS;QACxC,IAAI,IAAI,CAAC,OAAO,YAAYlB,wBAC1B,OAAO,IAAI,CAAC,OAAO,CAAC,eAAe,CAACkB;QAGtC,OAAO;IACT;IAEA,MAAM,qBAAyD;QAC7D,IAAI,IAAI,CAAC,OAAO,YAAYlB,wBAC1B,OAAO,IAAI,CAAC,OAAO,CAAC,kBAAkB;QAGxC,OAAO,EAAE;IACX;IAEA,MAAM,cAAckB,KAA+B,EAGhD;QACD,IAAI,IAAI,CAAC,OAAO,YAAYlB,wBAC1B,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,CAACkB;QAGpC,MAAM,IAAIvB,MAAM;IAClB;IAEA,MAAM,iBAGH;QACD,IAAI,IAAI,CAAC,OAAO,YAAYK,wBAC1B,OAAO,IAAI,CAAC,OAAO,CAAC,cAAc;QAGpC,MAAM,IAAIL,MAAM;IAClB;IAGA,iBAAoD;QAClD,IAAI,IAAI,CAAC,OAAO,YAAYC,uBAC1B,OAAO;QAET,OAAO;IACT;IAhWA,YAAYuB,MAAwB,CAAE;QAHtC,uBAAQ,WAAR;QACA,uBAAQ,oBAAR;QAGE,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,aAAa,CAC/BA,OAAO,IAAI,EACXA,OAAO,SAAS,EAChBA,OAAO,KAAK,EACZA,OAAO,YAAY;IAEvB;AA0VF"}
|
|
1
|
+
{"version":3,"file":"sdk/index.mjs","sources":["../../../src/sdk/index.ts"],"sourcesContent":["import type { ConnectivityTestResult, DeviceAction } from '@midscene/core';\nimport { PLAYGROUND_SERVER_PORT } from '@midscene/shared/constants';\nimport type { TModelConfig } from '@midscene/shared/env';\nimport type { BasePlaygroundAdapter } from '../adapters/base';\nimport { LocalExecutionAdapter } from '../adapters/local-execution';\nimport { RemoteExecutionAdapter } from '../adapters/remote-execution';\nimport type {\n PlaygroundRecorderCapabilitiesResult,\n PlaygroundRecorderDescribeResult,\n PlaygroundRecorderEvent,\n PlaygroundRecorderEventsResult,\n PlaygroundRecorderStartResult,\n PlaygroundSessionSetup,\n PlaygroundSessionState,\n PlaygroundSessionTarget,\n} from '../platform';\nimport type { PlaygroundRuntimeInfo } from '../runtime-metadata';\nimport type {\n AgentFactory,\n BeforeActionHook,\n ExecutionOptions,\n FormValue,\n PlaygroundAgent,\n PlaygroundConfig,\n ValidationResult,\n} from '../types';\n\nexport type PlaygroundInteractPayload = {\n actionType: string;\n} & Record<string, unknown>;\n\nexport interface PlaygroundInteractResult {\n ok: boolean;\n error?: string;\n}\n\nexport type PlaygroundPageRecordedEvent = PlaygroundRecorderEvent;\nexport type {\n PlaygroundRecorderCapabilitiesResult,\n PlaygroundRecorderDescribeResult,\n PlaygroundRecorderEventsResult,\n PlaygroundRecorderStartResult,\n};\n\nexport class PlaygroundSDK {\n private adapter: BasePlaygroundAdapter;\n private beforeActionHook?: BeforeActionHook;\n\n constructor(config: PlaygroundConfig) {\n this.adapter = this.createAdapter(\n config.type,\n config.serverUrl,\n config.agent,\n config.agentFactory,\n );\n }\n\n private createAdapter(\n type: string,\n serverUrl?: string,\n agent?: PlaygroundAgent,\n agentFactory?: AgentFactory,\n ): BasePlaygroundAdapter {\n switch (type) {\n case 'local-execution':\n if (!agent && !agentFactory) {\n throw new Error(\n 'Agent or agentFactory is required for local execution',\n );\n }\n return new LocalExecutionAdapter(agent, agentFactory);\n case 'remote-execution': {\n // Use provided serverUrl first, then fallback to localhost if current page origin is file:// or default\n const finalServerUrl =\n serverUrl ||\n (typeof window !== 'undefined' &&\n window.location.protocol.includes('http')\n ? window.location.origin\n : `http://localhost:${PLAYGROUND_SERVER_PORT}`);\n\n return new RemoteExecutionAdapter(finalServerUrl);\n }\n default:\n throw new Error(`Unsupported execution type: ${type}`);\n }\n }\n\n private runtimeMetadataAdapter():\n | LocalExecutionAdapter\n | RemoteExecutionAdapter\n | null {\n if (\n this.adapter instanceof LocalExecutionAdapter ||\n this.adapter instanceof RemoteExecutionAdapter\n ) {\n return this.adapter;\n }\n\n return null;\n }\n\n async executeAction(\n actionType: string,\n value: FormValue,\n options: ExecutionOptions,\n ): Promise<unknown> {\n await this.beforeActionHook?.(actionType, value, options);\n const result = await this.adapter.executeAction(actionType, value, options);\n return result;\n }\n\n setBeforeActionHook(hook?: BeforeActionHook): void {\n this.beforeActionHook = hook;\n }\n\n async getActionSpace(context?: unknown): Promise<DeviceAction<unknown>[]> {\n // Both adapters now accept context parameter\n // Local will prioritize internal agent, Remote will use server + fallback\n return this.adapter.getActionSpace(context);\n }\n\n validateStructuredParams(\n value: FormValue,\n action: DeviceAction<unknown> | undefined,\n ): ValidationResult {\n return this.adapter.validateParams(value, action);\n }\n\n formatErrorMessage(error: any): string {\n return this.adapter.formatErrorMessage(error);\n }\n\n createDisplayContent(\n value: FormValue,\n needsStructuredParams: boolean,\n action: DeviceAction<unknown> | undefined,\n ): string {\n return this.adapter.createDisplayContent(\n value,\n needsStructuredParams,\n action,\n );\n }\n\n // Get adapter ID (works for both remote and local execution)\n get id(): string | undefined {\n if (this.adapter instanceof RemoteExecutionAdapter) {\n return this.adapter.id;\n }\n if (this.adapter instanceof LocalExecutionAdapter) {\n return this.adapter.id;\n }\n return undefined;\n }\n\n // Server communication methods (for remote execution)\n async checkStatus(): Promise<boolean> {\n if (this.adapter instanceof RemoteExecutionAdapter) {\n return this.adapter.checkStatus();\n }\n return true; // For local execution, always return true\n }\n\n async overrideConfig(aiConfig: any): Promise<void> {\n return this.adapter.overrideConfig(aiConfig);\n }\n\n async runConnectivityTest(\n aiConfig: TModelConfig,\n ): Promise<ConnectivityTestResult> {\n return this.adapter.runConnectivityTest(aiConfig);\n }\n\n // Get task progress (for remote execution)\n async getTaskProgress(requestId: string): Promise<{ executionDump?: any }> {\n if (this.adapter instanceof RemoteExecutionAdapter) {\n return this.adapter.getTaskProgress(requestId);\n }\n // For local execution, progress is handled via onDumpUpdate callback\n return {};\n }\n\n // Cancel task (for remote execution)\n async cancelTask(requestId: string): Promise<any> {\n if (this.adapter instanceof RemoteExecutionAdapter) {\n return this.adapter.cancelTask(requestId);\n }\n return { error: 'Cancel task not supported in local execution mode' };\n }\n\n // Dump update callback management\n onDumpUpdate(callback: (dump: string, executionDump?: any) => void): void {\n if (this.adapter instanceof LocalExecutionAdapter) {\n this.adapter.onDumpUpdate(callback);\n } else if (this.adapter instanceof RemoteExecutionAdapter) {\n this.adapter.onDumpUpdate(callback);\n }\n }\n\n // Progress update callback management\n onProgressUpdate(callback: (tip: string) => void): void {\n if (this.adapter instanceof LocalExecutionAdapter) {\n this.adapter.setProgressCallback(callback);\n }\n // RemoteExecutionAdapter uses polling mechanism via onDumpUpdate, no separate progress callback needed\n }\n\n // Cancel execution - supports both remote and local\n async cancelExecution(requestId: string): Promise<{\n dump: any | null;\n reportHTML: string | null;\n } | null> {\n if (this.adapter instanceof RemoteExecutionAdapter) {\n const result = await this.adapter.cancelTask(requestId);\n // Return dump and reportHTML if available from cancellation\n if (result.success) {\n return {\n dump: (result as any).dump || null,\n reportHTML: (result as any).reportHTML || null,\n };\n }\n } else if (this.adapter instanceof LocalExecutionAdapter) {\n // Invoke adapter cancellation to destroy the agent and block further actions\n const result = await this.adapter.cancelTask(requestId);\n if (result.success) {\n return {\n dump: (result as any).dump || null,\n reportHTML: (result as any).reportHTML || null,\n };\n }\n }\n return null;\n }\n\n // Get current execution data (dump and report)\n async getCurrentExecutionData(): Promise<{\n dump: any | null;\n reportHTML: string | null;\n }> {\n if (\n this.adapter instanceof LocalExecutionAdapter &&\n this.adapter.getCurrentExecutionData\n ) {\n return await this.adapter.getCurrentExecutionData();\n }\n // For remote execution or if method not available, return empty data\n return { dump: null, reportHTML: null };\n }\n\n // Screenshot method for remote execution\n async getScreenshot(): Promise<{\n screenshot: string;\n timestamp: number;\n } | null> {\n if (this.adapter instanceof RemoteExecutionAdapter) {\n return this.adapter.getScreenshot();\n }\n return null; // For local execution, not supported yet\n }\n\n // Direct device manipulation – mouse/keyboard input from UI overlays.\n async interact(\n payload: PlaygroundInteractPayload,\n ): Promise<PlaygroundInteractResult> {\n if (this.adapter instanceof RemoteExecutionAdapter) {\n return this.adapter.interact(payload);\n }\n return { ok: false, error: 'Direct interaction requires remote execution' };\n }\n\n async startRecorderSession(\n sessionId: string,\n ): Promise<PlaygroundRecorderStartResult> {\n if (this.adapter instanceof RemoteExecutionAdapter) {\n return this.adapter.startRecorderSession(sessionId);\n }\n return {\n ok: false,\n supported: false,\n error: 'Recorder requires remote execution',\n };\n }\n\n async getRecorderCapabilities(): Promise<PlaygroundRecorderCapabilitiesResult> {\n if (this.adapter instanceof RemoteExecutionAdapter) {\n return this.adapter.getRecorderCapabilities();\n }\n return {\n supported: false,\n source: 'unsupported',\n error: 'Recorder requires remote execution',\n };\n }\n\n async stopRecorderSession(): Promise<PlaygroundInteractResult> {\n if (this.adapter instanceof RemoteExecutionAdapter) {\n return this.adapter.stopRecorderSession();\n }\n return { ok: true };\n }\n\n async getRecorderEvents(since = 0): Promise<PlaygroundRecorderEventsResult> {\n if (this.adapter instanceof RemoteExecutionAdapter) {\n return this.adapter.getRecorderEvents(since);\n }\n return { events: [], nextIndex: since };\n }\n\n async describeRecorderEventAtPoint(\n event: PlaygroundRecorderEvent,\n ): Promise<PlaygroundRecorderDescribeResult> {\n if (this.adapter instanceof RemoteExecutionAdapter) {\n return this.adapter.describeRecorderEventAtPoint(event);\n }\n return {\n ok: false,\n error: 'Recorder aiDescribe requires remote execution',\n };\n }\n\n async getRecorderScreenshotAsset(assetId: string): Promise<string | null> {\n if (this.adapter instanceof RemoteExecutionAdapter) {\n return this.adapter.getRecorderScreenshotAsset(assetId);\n }\n return null;\n }\n\n async clearRecorderScreenshotAssets(sessionId: string): Promise<void> {\n if (this.adapter instanceof RemoteExecutionAdapter) {\n await this.adapter.clearRecorderScreenshotAssets(sessionId);\n }\n }\n\n async pruneRecorderScreenshotAssets(\n sessionId: string,\n assetIds: string[],\n ): Promise<void> {\n if (this.adapter instanceof RemoteExecutionAdapter) {\n await this.adapter.pruneRecorderScreenshotAssets(sessionId, assetIds);\n }\n }\n\n // Get interface information (type and description)\n async getInterfaceInfo(): Promise<{\n type: string;\n description?: string;\n size?: { width: number; height: number };\n navigationState?: { isLoading: boolean };\n /** Action names exposed by the connected device's actionSpace. */\n actionTypes?: string[];\n } | null> {\n const adapter = this.runtimeMetadataAdapter();\n if (!adapter) {\n return null;\n }\n\n return adapter.getInterfaceInfo();\n }\n\n async getRuntimeInfo(): Promise<PlaygroundRuntimeInfo | null> {\n const adapter = this.runtimeMetadataAdapter();\n if (!adapter) {\n return null;\n }\n\n return adapter.getRuntimeInfo();\n }\n\n async getSessionInfo(): Promise<PlaygroundSessionState | null> {\n if (this.adapter instanceof RemoteExecutionAdapter) {\n return this.adapter.getSessionInfo();\n }\n\n return null;\n }\n\n async getSessionSetup(\n input?: Record<string, unknown>,\n ): Promise<PlaygroundSessionSetup | null> {\n if (this.adapter instanceof RemoteExecutionAdapter) {\n return this.adapter.getSessionSetup(input);\n }\n\n return null;\n }\n\n async listSessionTargets(): Promise<PlaygroundSessionTarget[]> {\n if (this.adapter instanceof RemoteExecutionAdapter) {\n return this.adapter.listSessionTargets();\n }\n\n return [];\n }\n\n async createSession(input?: Record<string, unknown>): Promise<{\n session: PlaygroundSessionState;\n runtimeInfo: PlaygroundRuntimeInfo;\n }> {\n if (this.adapter instanceof RemoteExecutionAdapter) {\n return this.adapter.createSession(input);\n }\n\n throw new Error('Session creation is only supported in server mode');\n }\n\n async destroySession(): Promise<{\n session: PlaygroundSessionState;\n runtimeInfo: PlaygroundRuntimeInfo;\n }> {\n if (this.adapter instanceof RemoteExecutionAdapter) {\n return this.adapter.destroySession();\n }\n\n throw new Error('Session destruction is only supported in server mode');\n }\n\n // Get service mode based on adapter type\n getServiceMode(): 'In-Browser-Extension' | 'Server' {\n if (this.adapter instanceof LocalExecutionAdapter) {\n return 'In-Browser-Extension';\n }\n return 'Server';\n }\n}\n"],"names":["PlaygroundSDK","type","serverUrl","agent","agentFactory","Error","LocalExecutionAdapter","finalServerUrl","window","PLAYGROUND_SERVER_PORT","RemoteExecutionAdapter","actionType","value","options","result","hook","context","action","error","needsStructuredParams","aiConfig","requestId","callback","payload","sessionId","since","event","assetId","assetIds","adapter","input","config"],"mappings":";;;;;;;;;;;;;AA4CO,MAAMA;IAaH,cACNC,IAAY,EACZC,SAAkB,EAClBC,KAAuB,EACvBC,YAA2B,EACJ;QACvB,OAAQH;YACN,KAAK;gBACH,IAAI,CAACE,SAAS,CAACC,cACb,MAAM,IAAIC,MACR;gBAGJ,OAAO,IAAIC,sBAAsBH,OAAOC;YAC1C,KAAK;gBAAoB;oBAEvB,MAAMG,iBACJL,aACC,CAAkB,eAAlB,OAAOM,UACRA,OAAO,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,UAC9BA,OAAO,QAAQ,CAAC,MAAM,GACtB,CAAC,iBAAiB,EAAEC,wBAAuB;oBAEjD,OAAO,IAAIC,uBAAuBH;gBACpC;YACA;gBACE,MAAM,IAAIF,MAAM,CAAC,4BAA4B,EAAEJ,MAAM;QACzD;IACF;IAEQ,yBAGC;QACP,IACE,IAAI,CAAC,OAAO,YAAYK,yBACxB,IAAI,CAAC,OAAO,YAAYI,wBAExB,OAAO,IAAI,CAAC,OAAO;QAGrB,OAAO;IACT;IAEA,MAAM,cACJC,UAAkB,EAClBC,KAAgB,EAChBC,OAAyB,EACP;QAClB,MAAM,IAAI,CAAC,gBAAgB,GAAGF,YAAYC,OAAOC;QACjD,MAAMC,SAAS,MAAM,IAAI,CAAC,OAAO,CAAC,aAAa,CAACH,YAAYC,OAAOC;QACnE,OAAOC;IACT;IAEA,oBAAoBC,IAAuB,EAAQ;QACjD,IAAI,CAAC,gBAAgB,GAAGA;IAC1B;IAEA,MAAM,eAAeC,OAAiB,EAAoC;QAGxE,OAAO,IAAI,CAAC,OAAO,CAAC,cAAc,CAACA;IACrC;IAEA,yBACEJ,KA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