@midscene/playground 1.9.6 → 1.9.7

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.
Files changed (55) hide show
  1. package/dist/es/adapters/local-execution.mjs +3 -3
  2. package/dist/es/adapters/local-execution.mjs.map +1 -1
  3. package/dist/es/adapters/remote-execution.mjs +35 -0
  4. package/dist/es/adapters/remote-execution.mjs.map +1 -1
  5. package/dist/es/common.mjs +30 -3
  6. package/dist/es/common.mjs.map +1 -1
  7. package/dist/es/index.browser.mjs.map +1 -1
  8. package/dist/es/mjpeg-hub.mjs +3 -0
  9. package/dist/es/mjpeg-hub.mjs.map +1 -1
  10. package/dist/es/mjpeg-stream-handler.mjs +6 -0
  11. package/dist/es/mjpeg-stream-handler.mjs.map +1 -1
  12. package/dist/es/platform.mjs.map +1 -1
  13. package/dist/es/sdk/index.mjs +7 -0
  14. package/dist/es/sdk/index.mjs.map +1 -1
  15. package/dist/es/server.mjs +563 -42
  16. package/dist/es/server.mjs.map +1 -1
  17. package/dist/lib/adapters/local-execution.js +3 -3
  18. package/dist/lib/adapters/local-execution.js.map +1 -1
  19. package/dist/lib/adapters/remote-execution.js +35 -0
  20. package/dist/lib/adapters/remote-execution.js.map +1 -1
  21. package/dist/lib/common.js +30 -3
  22. package/dist/lib/common.js.map +1 -1
  23. package/dist/lib/index.browser.js.map +1 -1
  24. package/dist/lib/mjpeg-hub.js +3 -0
  25. package/dist/lib/mjpeg-hub.js.map +1 -1
  26. package/dist/lib/mjpeg-stream-handler.js +6 -0
  27. package/dist/lib/mjpeg-stream-handler.js.map +1 -1
  28. package/dist/lib/platform.js.map +1 -1
  29. package/dist/lib/sdk/index.js +7 -0
  30. package/dist/lib/sdk/index.js.map +1 -1
  31. package/dist/lib/server.js +560 -39
  32. package/dist/lib/server.js.map +1 -1
  33. package/dist/types/adapters/local-execution.d.ts +3 -2
  34. package/dist/types/adapters/remote-execution.d.ts +2 -1
  35. package/dist/types/index.browser.d.ts +1 -1
  36. package/dist/types/index.d.ts +1 -1
  37. package/dist/types/mjpeg-hub.d.ts +1 -0
  38. package/dist/types/mjpeg-stream-handler.d.ts +2 -0
  39. package/dist/types/platform.d.ts +104 -0
  40. package/dist/types/sdk/index.d.ts +3 -2
  41. package/dist/types/server.d.ts +9 -0
  42. package/dist/types/types.d.ts +5 -0
  43. package/package.json +3 -3
  44. package/static/index.html +1 -1
  45. package/static/static/css/{index.ab28104a.css → index.1293237f.css} +2 -2
  46. package/static/static/css/{index.ab28104a.css.map → index.1293237f.css.map} +1 -1
  47. package/static/static/js/{596.5426be9e.js → 905.8d12588e.js} +17 -17
  48. package/static/static/js/905.8d12588e.js.map +1 -0
  49. package/static/static/js/index.50e06ed5.js +948 -0
  50. package/static/static/js/index.50e06ed5.js.map +1 -0
  51. package/static/static/js/596.5426be9e.js.map +0 -1
  52. package/static/static/js/index.134d5099.js +0 -940
  53. package/static/static/js/index.134d5099.js.map +0 -1
  54. /package/static/static/js/{596.5426be9e.js.LICENSE.txt → 905.8d12588e.js.LICENSE.txt} +0 -0
  55. /package/static/static/js/{index.134d5099.js.LICENSE.txt → index.50e06ed5.js.LICENSE.txt} +0 -0
@@ -1,4 +1,5 @@
1
1
  import type { ConnectivityTestResult, DeviceAction, ExecutionDump } from '@midscene/core';
2
+ import { ReportActionDump } from '@midscene/core';
2
3
  import { type PlaygroundRuntimeInfo } from '../runtime-metadata';
3
4
  import type { AgentFactory, ExecutionOptions, FormValue, PlaygroundAgent } from '../types';
4
5
  import { BasePlaygroundAdapter } from './base';
@@ -35,7 +36,7 @@ export declare class LocalExecutionAdapter extends BasePlaygroundAdapter {
35
36
  cancelTask(_requestId: string): Promise<{
36
37
  error?: string;
37
38
  success?: boolean;
38
- dump?: ExecutionDump | null;
39
+ dump?: ExecutionDump | ReportActionDump | null;
39
40
  reportHTML?: string | null;
40
41
  }>;
41
42
  /**
@@ -43,7 +44,7 @@ export declare class LocalExecutionAdapter extends BasePlaygroundAdapter {
43
44
  * This allows retrieving dump and report when execution is stopped
44
45
  */
45
46
  getCurrentExecutionData(): Promise<{
46
- dump: ExecutionDump | null;
47
+ dump: ExecutionDump | ReportActionDump | null;
47
48
  reportHTML: string | null;
48
49
  }>;
49
50
  getInterfaceInfo(): Promise<{
@@ -1,5 +1,5 @@
1
1
  import type { ConnectivityTestResult, DeviceAction, ExecutionDump } from '@midscene/core';
2
- import type { PlaygroundRecorderCapabilitiesResult, PlaygroundRecorderEventsResult, PlaygroundRecorderStartResult, PlaygroundSessionSetup, PlaygroundSessionState, PlaygroundSessionTarget } from '../platform';
2
+ import type { PlaygroundRecorderCapabilitiesResult, PlaygroundRecorderDescribeResult, PlaygroundRecorderEvent, PlaygroundRecorderEventsResult, PlaygroundRecorderStartResult, PlaygroundSessionSetup, PlaygroundSessionState, PlaygroundSessionTarget } from '../platform';
3
3
  import type { PlaygroundRuntimeInfo } from '../runtime-metadata';
4
4
  import type { ExecutionOptions, FormValue, ValidationResult } from '../types';
5
5
  import { BasePlaygroundAdapter } from './base';
@@ -53,6 +53,7 @@ export declare class RemoteExecutionAdapter extends BasePlaygroundAdapter {
53
53
  error?: string;
54
54
  }>;
55
55
  getRecorderEvents(since?: number): Promise<PlaygroundRecorderEventsResult>;
56
+ describeRecorderEventAtPoint(event: PlaygroundRecorderEvent): Promise<PlaygroundRecorderDescribeResult>;
56
57
  getInterfaceInfo(): Promise<{
57
58
  type: string;
58
59
  description?: string;
@@ -11,5 +11,5 @@ export declare const playgroundForSessionManager: undefined;
11
11
  export declare const launchPreparedPlaygroundPlatform: undefined;
12
12
  export type { PlaygroundInteractPayload, PlaygroundInteractResult, PlaygroundPageRecordedEvent, } from './sdk/index';
13
13
  export type { BeforeActionHook, ExecutionOptions, FormValue, PlaygroundAgent, ValidationResult, PlaygroundConfig, ExecutionType, PlaygroundAdapter, } from './types';
14
- export type { PlaygroundCreatedSession, PlaygroundExecutionHooks, PlaygroundPlatformRegistration, PlaygroundPlatformDescriptor, PlaygroundPlatformSelectorConfig, PlaygroundPreviewCapability, PlaygroundPreviewDescriptor, PlaygroundPreviewKind, PlaygroundRecorderCapabilitiesResult, PlaygroundRecorderEvent, PlaygroundRecorderEventsResult, PlaygroundRecorderSourceKind, PlaygroundRecorderStartResult, PlaygroundSidecar, PreparedPlaygroundPlatform, PlaygroundSessionField, PlaygroundSessionFieldOption, PlaygroundSessionManager, PlaygroundSessionSetup, PlaygroundSessionState, PlaygroundSessionTarget, } from './platform';
14
+ export type { PlaygroundCreatedSession, PlaygroundExecutionHooks, PlaygroundPlatformRegistration, PlaygroundPlatformDescriptor, PlaygroundPlatformSelectorConfig, PlaygroundPreviewCapability, PlaygroundPreviewDescriptor, PlaygroundPreviewKind, PlaygroundRecorderCapabilitiesResult, PlaygroundRecorderDescribeResult, PlaygroundRecorderEvent, PlaygroundRecorderEventsResult, PlaygroundRecorderSourceKind, PlaygroundRecorderStartResult, PlaygroundSidecar, PreparedPlaygroundPlatform, PlaygroundSessionField, PlaygroundSessionFieldOption, PlaygroundSessionManager, PlaygroundSessionSetup, PlaygroundSessionState, PlaygroundSessionTarget, } from './platform';
15
15
  export type { PlaygroundRuntimeInfo } from './runtime-metadata';
@@ -13,6 +13,6 @@ export { RemoteExecutionAdapter } from './adapters/remote-execution';
13
13
  export type { PlaygroundInteractPayload, PlaygroundInteractResult, PlaygroundPageRecordedEvent, } from './sdk/index';
14
14
  export type { BeforeActionHook, ExecutionOptions, FormValue, PlaygroundAgent, ValidationResult, PlaygroundConfig, ExecutionType, PlaygroundAdapter, ServerResponse, AgentFactory, } from './types';
15
15
  export type { LaunchPlaygroundOptions, LaunchPlaygroundResult, } from './launcher';
16
- export type { PlaygroundCreatedSession, PlaygroundExecutionHooks, PlaygroundPlatformRegistration, PlaygroundPlatformDescriptor, PlaygroundPlatformSelectorConfig, PlaygroundPreviewCapability, PlaygroundPreviewDescriptor, PlaygroundPreviewKind, PlaygroundRecorderCapabilitiesResult, PlaygroundRecorderEvent, PlaygroundRecorderEventsResult, PlaygroundRecorderSourceKind, PlaygroundRecorderStartResult, PlaygroundSidecar, PreparedPlaygroundPlatform, PlaygroundSessionField, PlaygroundSessionFieldOption, PlaygroundSessionManager, PlaygroundSessionSetup, PlaygroundSessionState, PlaygroundSessionTarget, } from './platform';
16
+ export type { PlaygroundCreatedSession, PlaygroundExecutionHooks, PlaygroundPlatformRegistration, PlaygroundPlatformDescriptor, PlaygroundPlatformSelectorConfig, PlaygroundPreviewCapability, PlaygroundPreviewDescriptor, PlaygroundPreviewKind, PlaygroundRecorderCapabilitiesResult, PlaygroundRecorderDescribeResult, PlaygroundRecorderEvent, PlaygroundRecorderEventsResult, PlaygroundRecorderSourceKind, PlaygroundRecorderStartResult, PlaygroundSidecar, PreparedPlaygroundPlatform, PlaygroundSessionField, PlaygroundSessionFieldOption, PlaygroundSessionManager, PlaygroundSessionSetup, PlaygroundSessionState, PlaygroundSessionTarget, } from './platform';
17
17
  export type { PlaygroundRuntimeInfo } from './runtime-metadata';
18
18
  export type { PrepareMultiPlatformPlaygroundOptions, RegisteredPlaygroundPlatform, } from './multi-platform';
@@ -66,6 +66,7 @@ export declare class InterfaceMjpegHub {
66
66
  * forcibly closes attached subscriber sockets.
67
67
  */
68
68
  shutdown(): void;
69
+ getLastFrame(): MjpegStreamFrame | undefined;
69
70
  private streamRequestInternal;
70
71
  private attachSubscriber;
71
72
  /**
@@ -38,11 +38,13 @@ export declare class MjpegStreamHandler {
38
38
  private readonly source;
39
39
  private nativeAvailable;
40
40
  private nativeFailedAt;
41
+ private lastPollingFrame?;
41
42
  private readonly interfaceMjpegHub;
42
43
  constructor(source: MjpegStreamSource);
43
44
  /** Drop the cached probe result — call this when the agent reconnects. */
44
45
  reset(): void;
45
46
  shutdown(): void;
47
+ getLastFrameBase64(): string | undefined;
46
48
  serve(req: Request, res: Response): Promise<void>;
47
49
  private probeAndProxyNative;
48
50
  private probeNativeLiveness;
@@ -96,6 +96,110 @@ export interface PlaygroundRecorderEventsResult {
96
96
  events: PlaygroundRecorderEvent[];
97
97
  nextIndex: number;
98
98
  }
99
+ export interface PlaygroundRecorderDescribeTrace {
100
+ traceId: string;
101
+ eventHashId?: string;
102
+ eventType?: string;
103
+ actionType?: string;
104
+ eventSummary?: {
105
+ hashId?: string;
106
+ mergedHashIds?: string[];
107
+ type?: string;
108
+ source?: string;
109
+ actionType?: string;
110
+ timestamp?: number;
111
+ url?: string;
112
+ title?: string;
113
+ valueLength?: number;
114
+ rawPayloadSummary?: Record<string, unknown>;
115
+ elementRect?: {
116
+ left?: number;
117
+ top?: number;
118
+ width?: number;
119
+ height?: number;
120
+ x?: number;
121
+ y?: number;
122
+ };
123
+ pageInfo?: {
124
+ width: number;
125
+ height: number;
126
+ };
127
+ };
128
+ status: 'ready' | 'failed' | 'skipped';
129
+ error?: string;
130
+ startedAt: string;
131
+ durationMs: number;
132
+ modelCallDurationMs?: number;
133
+ point?: [number, number];
134
+ pageInfo?: {
135
+ width: number;
136
+ height: number;
137
+ };
138
+ screenshotBytes?: number;
139
+ screenshotRef?: {
140
+ path: string;
141
+ sha256: string;
142
+ bytes: number;
143
+ mimeType?: string;
144
+ };
145
+ annotatedScreenshotRef?: {
146
+ path: string;
147
+ sha256: string;
148
+ bytes: number;
149
+ mimeType?: string;
150
+ };
151
+ screenshotAnnotation?: {
152
+ inputPoint?: {
153
+ logical: [number, number];
154
+ screenshot: [number, number];
155
+ };
156
+ sourceTargetRect?: {
157
+ left: number;
158
+ top: number;
159
+ width: number;
160
+ height: number;
161
+ };
162
+ locateRect?: {
163
+ left: number;
164
+ top: number;
165
+ width: number;
166
+ height: number;
167
+ };
168
+ centerDelta?: {
169
+ x: number;
170
+ y: number;
171
+ distance: number;
172
+ };
173
+ distanceOutsideRect?: {
174
+ x: number;
175
+ y: number;
176
+ distance: number;
177
+ };
178
+ };
179
+ screenshotPersistError?: string;
180
+ annotatedScreenshotPersistError?: string;
181
+ elementDescription?: string;
182
+ verifyPassed?: boolean;
183
+ centerDistance?: number;
184
+ verifyResult?: {
185
+ pass?: boolean;
186
+ rect?: {
187
+ left: number;
188
+ top: number;
189
+ width: number;
190
+ height: number;
191
+ };
192
+ center?: [number, number];
193
+ centerDistance?: number;
194
+ includedInRect?: boolean;
195
+ };
196
+ }
197
+ export interface PlaygroundRecorderDescribeResult {
198
+ ok: boolean;
199
+ event?: PlaygroundRecorderEvent;
200
+ trace?: PlaygroundRecorderDescribeTrace;
201
+ error?: string;
202
+ }
99
203
  export interface PlaygroundSessionState {
100
204
  connected: boolean;
101
205
  displayName?: string;
@@ -1,5 +1,5 @@
1
1
  import type { ConnectivityTestResult, DeviceAction } from '@midscene/core';
2
- import type { PlaygroundRecorderCapabilitiesResult, PlaygroundRecorderEvent, PlaygroundRecorderEventsResult, PlaygroundRecorderStartResult, PlaygroundSessionSetup, PlaygroundSessionState, PlaygroundSessionTarget } from '../platform';
2
+ import type { PlaygroundRecorderCapabilitiesResult, PlaygroundRecorderDescribeResult, PlaygroundRecorderEvent, PlaygroundRecorderEventsResult, PlaygroundRecorderStartResult, PlaygroundSessionSetup, PlaygroundSessionState, PlaygroundSessionTarget } from '../platform';
3
3
  import type { PlaygroundRuntimeInfo } from '../runtime-metadata';
4
4
  import type { BeforeActionHook, ExecutionOptions, FormValue, PlaygroundConfig, ValidationResult } from '../types';
5
5
  export type PlaygroundInteractPayload = {
@@ -10,7 +10,7 @@ export interface PlaygroundInteractResult {
10
10
  error?: string;
11
11
  }
12
12
  export type PlaygroundPageRecordedEvent = PlaygroundRecorderEvent;
13
- export type { PlaygroundRecorderCapabilitiesResult, PlaygroundRecorderEventsResult, PlaygroundRecorderStartResult, };
13
+ export type { PlaygroundRecorderCapabilitiesResult, PlaygroundRecorderDescribeResult, PlaygroundRecorderEventsResult, PlaygroundRecorderStartResult, };
14
14
  export declare class PlaygroundSDK {
15
15
  private adapter;
16
16
  private beforeActionHook?;
@@ -50,6 +50,7 @@ export declare class PlaygroundSDK {
50
50
  getRecorderCapabilities(): Promise<PlaygroundRecorderCapabilitiesResult>;
51
51
  stopRecorderSession(): Promise<PlaygroundInteractResult>;
52
52
  getRecorderEvents(since?: number): Promise<PlaygroundRecorderEventsResult>;
53
+ describeRecorderEventAtPoint(event: PlaygroundRecorderEvent): Promise<PlaygroundRecorderDescribeResult>;
53
54
  getInterfaceInfo(): Promise<{
54
55
  type: string;
55
56
  description?: string;
@@ -49,6 +49,9 @@ declare class PlaygroundServer {
49
49
  private _baseSidecars?;
50
50
  private _recorderSessionId;
51
51
  private _recorderEvents;
52
+ private _recorderEventQueue;
53
+ private _recorderPendingCaptures;
54
+ private _studioPreviewRecorderLastTargetPoint;
52
55
  private _studioPreviewRecorderLastScreenshot;
53
56
  private _studioPreviewRecorderLastPageState;
54
57
  private _activeConnection;
@@ -85,6 +88,7 @@ declare class PlaygroundServer {
85
88
  private getActiveAgentOrThrow;
86
89
  private getRecorderCapabilities;
87
90
  private resetRecorderState;
91
+ waitForRecorderIdle(): Promise<void>;
88
92
  private canRecordStudioPreviewInteractions;
89
93
  private takeRecorderScreenshot;
90
94
  private getActivePageInfo;
@@ -92,9 +96,14 @@ declare class PlaygroundServer {
92
96
  private getActivePageTitle;
93
97
  private getActiveRecorderPageState;
94
98
  private captureRecorderSnapshotBeforeInteract;
99
+ private captureCachedRecorderSnapshotBeforeInteract;
95
100
  private startStudioPreviewRecorder;
96
101
  private storeStudioPreviewRecorderEvent;
97
102
  private buildStudioPreviewRecorderEvent;
103
+ private enrichStudioPreviewRecorderEventWithAiDescribe;
104
+ private getRecorderAiDescribeScreenshot;
105
+ private queueStudioPreviewRecorderEventAppend;
106
+ private queueStudioPreviewRecorderEvent;
98
107
  private buildStudioPreviewNavigationChangeEvent;
99
108
  private buildStudioPreviewInitialNavigationEvent;
100
109
  private createRecorderScreenshotWithMarker;
@@ -24,6 +24,10 @@ export interface DeviceOptions {
24
24
  keyboardDismissStrategy?: 'esc-first' | 'back-first';
25
25
  alwaysRefreshScreenInfo?: boolean;
26
26
  }
27
+ export interface ExecutionReportDisplay {
28
+ type?: string;
29
+ prompt?: string;
30
+ }
27
31
  export interface ExecutionOptions {
28
32
  deepLocate?: boolean;
29
33
  deepThink?: boolean;
@@ -33,6 +37,7 @@ export interface ExecutionOptions {
33
37
  context?: any;
34
38
  requestId?: string;
35
39
  deviceOptions?: DeviceOptions;
40
+ reportDisplay?: ExecutionReportDisplay;
36
41
  }
37
42
  export type BeforeActionHook = (actionType: string, value: FormValue, options: ExecutionOptions) => void | Promise<void>;
38
43
  export type ExecutionType = 'local-execution' | 'remote-execution';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midscene/playground",
3
- "version": "1.9.6",
3
+ "version": "1.9.7",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/web-infra-dev/midscene.git",
@@ -32,8 +32,8 @@
32
32
  "express": "^4.21.2",
33
33
  "open": "10.1.0",
34
34
  "uuid": "11.1.0",
35
- "@midscene/core": "1.9.6",
36
- "@midscene/shared": "1.9.6"
35
+ "@midscene/core": "1.9.7",
36
+ "@midscene/shared": "1.9.7"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@rslib/core": "^0.18.3",
package/static/index.html CHANGED
@@ -1 +1 @@
1
- <!doctype html><html><head><link rel="icon" href="/favicon.ico"><title>Midscene Playground</title><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><script defer src="/static/js/lib-react.7b1abe58.js"></script><script defer src="/static/js/596.5426be9e.js"></script><script defer src="/static/js/index.134d5099.js"></script><link href="/static/css/index.ab28104a.css" rel="stylesheet"></head><body><div id="root"></div></body></html>
1
+ <!doctype html><html><head><link rel="icon" href="/favicon.ico"><title>Midscene Playground</title><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><script defer src="/static/js/lib-react.7b1abe58.js"></script><script defer src="/static/js/905.8d12588e.js"></script><script defer src="/static/js/index.50e06ed5.js"></script><link href="/static/css/index.1293237f.css" rel="stylesheet"></head><body><div id="root"></div></body></html>