@midscene/computer-playground 1.8.1-beta-20260513084557.0 → 1.8.1
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/bin.mjs +20 -6
- package/dist/es/index.mjs +20 -6
- package/dist/lib/bin.js +19 -5
- package/dist/lib/index.js +19 -5
- package/package.json +5 -5
- package/static/index.html +1 -1
- package/static/static/css/{index.63b028da.css → index.26c9c911.css} +2 -2
- package/static/static/css/{index.63b028da.css.map → index.26c9c911.css.map} +1 -1
- package/static/static/js/{889.6c79d5ba.js → 596.6ba15860.js} +27 -27
- package/static/static/js/596.6ba15860.js.map +1 -0
- package/static/static/js/index.a5c69909.js +914 -0
- package/static/static/js/index.a5c69909.js.map +1 -0
- package/static/static/js/889.6c79d5ba.js.map +0 -1
- package/static/static/js/index.1cb773ee.js +0 -914
- package/static/static/js/index.1cb773ee.js.map +0 -1
- /package/static/static/js/{889.6c79d5ba.js.LICENSE.txt → 596.6ba15860.js.LICENSE.txt} +0 -0
- /package/static/static/js/{index.1cb773ee.js.LICENSE.txt → index.a5c69909.js.LICENSE.txt} +0 -0
package/dist/es/bin.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import node_os from "node:os";
|
|
2
2
|
import node_path from "node:path";
|
|
3
|
-
import { ComputerDevice, agentFromComputer, checkAccessibilityPermission, getConnectedDisplays } from "@midscene/computer";
|
|
3
|
+
import { ComputerDevice, agentFromComputer, checkAccessibilityPermission, checkScreenRecordingPermission, getConnectedDisplays } from "@midscene/computer";
|
|
4
4
|
import { createScreenshotPreviewDescriptor, definePlaygroundPlatform, launchPreparedPlaygroundPlatform } from "@midscene/playground";
|
|
5
5
|
import puppeteer from "puppeteer";
|
|
6
6
|
import { PLAYGROUND_SERVER_PORT } from "@midscene/shared/constants";
|
|
@@ -59,17 +59,30 @@ const computerPlaygroundPlatform = definePlaygroundPlatform({
|
|
|
59
59
|
title: 'Midscene Computer Playground',
|
|
60
60
|
description: "Computer playground platform descriptor",
|
|
61
61
|
async prepare (options) {
|
|
62
|
-
const
|
|
62
|
+
const initialAccessibility = checkAccessibilityPermission(true);
|
|
63
|
+
const initialScreenRecording = checkScreenRecordingPermission(true);
|
|
64
|
+
const evaluatePermissions = ()=>{
|
|
65
|
+
const accessibilityCheck = checkAccessibilityPermission(false);
|
|
66
|
+
const screenRecordingCheck = checkScreenRecordingPermission(false);
|
|
67
|
+
const permissionError = !accessibilityCheck.hasPermission && accessibilityCheck.error || !screenRecordingCheck.hasPermission && screenRecordingCheck.error || void 0;
|
|
68
|
+
return {
|
|
69
|
+
accessibilityCheck,
|
|
70
|
+
screenRecordingCheck,
|
|
71
|
+
permissionError,
|
|
72
|
+
allPermissionsGranted: accessibilityCheck.hasPermission && screenRecordingCheck.hasPermission
|
|
73
|
+
};
|
|
74
|
+
};
|
|
63
75
|
const staticDir = options?.staticDir || node_path.join(__dirname, '../../static');
|
|
64
76
|
const availablePort = await findAvailablePort(PLAYGROUND_SERVER_PORT);
|
|
65
77
|
if (availablePort !== PLAYGROUND_SERVER_PORT) console.log(`⚠️ Port ${PLAYGROUND_SERVER_PORT} is busy, using port ${availablePort} instead`);
|
|
66
78
|
const sessionManager = {
|
|
67
79
|
async getSetupSchema () {
|
|
80
|
+
const { allPermissionsGranted, permissionError } = evaluatePermissions();
|
|
68
81
|
const displays = await getConnectedDisplays();
|
|
69
82
|
const defaultDisplay = displays.find((display)=>display.primary) || displays[0];
|
|
70
83
|
return {
|
|
71
84
|
title: 'Connect Computer Agent',
|
|
72
|
-
description:
|
|
85
|
+
description: allPermissionsGranted ? 'Create a Computer Agent for the selected display.' : permissionError,
|
|
73
86
|
primaryActionLabel: 'Create Agent',
|
|
74
87
|
fields: [
|
|
75
88
|
{
|
|
@@ -104,7 +117,8 @@ const computerPlaygroundPlatform = definePlaygroundPlatform({
|
|
|
104
117
|
}));
|
|
105
118
|
},
|
|
106
119
|
async createSession (input) {
|
|
107
|
-
|
|
120
|
+
const { allPermissionsGranted, permissionError } = evaluatePermissions();
|
|
121
|
+
if (!allPermissionsGranted) throw new Error(permissionError || 'Accessibility and Screen Recording permissions are required');
|
|
108
122
|
const displayId = input?.displayId === void 0 || null === input.displayId ? void 0 : String(input.displayId);
|
|
109
123
|
const agent = await agentFromComputer(displayId ? {
|
|
110
124
|
displayId
|
|
@@ -156,8 +170,8 @@ const computerPlaygroundPlatform = definePlaygroundPlatform({
|
|
|
156
170
|
metadata: {
|
|
157
171
|
executionUx: 'countdown-before-run',
|
|
158
172
|
sessionConnected: false,
|
|
159
|
-
setupState:
|
|
160
|
-
setupBlockingReason:
|
|
173
|
+
setupState: initialAccessibility.hasPermission && initialScreenRecording.hasPermission ? 'required' : 'blocked',
|
|
174
|
+
setupBlockingReason: !initialAccessibility.hasPermission && initialAccessibility.error || !initialScreenRecording.hasPermission && initialScreenRecording.error || void 0
|
|
161
175
|
}
|
|
162
176
|
};
|
|
163
177
|
}
|
package/dist/es/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import node_path from "node:path";
|
|
2
|
-
import { agentFromComputer, checkAccessibilityPermission, getConnectedDisplays } from "@midscene/computer";
|
|
2
|
+
import { agentFromComputer, checkAccessibilityPermission, checkScreenRecordingPermission, getConnectedDisplays } from "@midscene/computer";
|
|
3
3
|
import { createScreenshotPreviewDescriptor, definePlaygroundPlatform } from "@midscene/playground";
|
|
4
4
|
import { PLAYGROUND_SERVER_PORT } from "@midscene/shared/constants";
|
|
5
5
|
import { findAvailablePort } from "@midscene/shared/node";
|
|
@@ -8,17 +8,30 @@ const computerPlaygroundPlatform = definePlaygroundPlatform({
|
|
|
8
8
|
title: 'Midscene Computer Playground',
|
|
9
9
|
description: "Computer playground platform descriptor",
|
|
10
10
|
async prepare (options) {
|
|
11
|
-
const
|
|
11
|
+
const initialAccessibility = checkAccessibilityPermission(true);
|
|
12
|
+
const initialScreenRecording = checkScreenRecordingPermission(true);
|
|
13
|
+
const evaluatePermissions = ()=>{
|
|
14
|
+
const accessibilityCheck = checkAccessibilityPermission(false);
|
|
15
|
+
const screenRecordingCheck = checkScreenRecordingPermission(false);
|
|
16
|
+
const permissionError = !accessibilityCheck.hasPermission && accessibilityCheck.error || !screenRecordingCheck.hasPermission && screenRecordingCheck.error || void 0;
|
|
17
|
+
return {
|
|
18
|
+
accessibilityCheck,
|
|
19
|
+
screenRecordingCheck,
|
|
20
|
+
permissionError,
|
|
21
|
+
allPermissionsGranted: accessibilityCheck.hasPermission && screenRecordingCheck.hasPermission
|
|
22
|
+
};
|
|
23
|
+
};
|
|
12
24
|
const staticDir = options?.staticDir || node_path.join(__dirname, '../../static');
|
|
13
25
|
const availablePort = await findAvailablePort(PLAYGROUND_SERVER_PORT);
|
|
14
26
|
if (availablePort !== PLAYGROUND_SERVER_PORT) console.log(`⚠️ Port ${PLAYGROUND_SERVER_PORT} is busy, using port ${availablePort} instead`);
|
|
15
27
|
const sessionManager = {
|
|
16
28
|
async getSetupSchema () {
|
|
29
|
+
const { allPermissionsGranted, permissionError } = evaluatePermissions();
|
|
17
30
|
const displays = await getConnectedDisplays();
|
|
18
31
|
const defaultDisplay = displays.find((display)=>display.primary) || displays[0];
|
|
19
32
|
return {
|
|
20
33
|
title: 'Connect Computer Agent',
|
|
21
|
-
description:
|
|
34
|
+
description: allPermissionsGranted ? 'Create a Computer Agent for the selected display.' : permissionError,
|
|
22
35
|
primaryActionLabel: 'Create Agent',
|
|
23
36
|
fields: [
|
|
24
37
|
{
|
|
@@ -53,7 +66,8 @@ const computerPlaygroundPlatform = definePlaygroundPlatform({
|
|
|
53
66
|
}));
|
|
54
67
|
},
|
|
55
68
|
async createSession (input) {
|
|
56
|
-
|
|
69
|
+
const { allPermissionsGranted, permissionError } = evaluatePermissions();
|
|
70
|
+
if (!allPermissionsGranted) throw new Error(permissionError || 'Accessibility and Screen Recording permissions are required');
|
|
57
71
|
const displayId = input?.displayId === void 0 || null === input.displayId ? void 0 : String(input.displayId);
|
|
58
72
|
const agent = await agentFromComputer(displayId ? {
|
|
59
73
|
displayId
|
|
@@ -105,8 +119,8 @@ const computerPlaygroundPlatform = definePlaygroundPlatform({
|
|
|
105
119
|
metadata: {
|
|
106
120
|
executionUx: 'countdown-before-run',
|
|
107
121
|
sessionConnected: false,
|
|
108
|
-
setupState:
|
|
109
|
-
setupBlockingReason:
|
|
122
|
+
setupState: initialAccessibility.hasPermission && initialScreenRecording.hasPermission ? 'required' : 'blocked',
|
|
123
|
+
setupBlockingReason: !initialAccessibility.hasPermission && initialAccessibility.error || !initialScreenRecording.hasPermission && initialScreenRecording.error || void 0
|
|
110
124
|
}
|
|
111
125
|
};
|
|
112
126
|
}
|
package/dist/lib/bin.js
CHANGED
|
@@ -85,17 +85,30 @@ const computerPlaygroundPlatform = (0, playground_namespaceObject.definePlaygrou
|
|
|
85
85
|
title: 'Midscene Computer Playground',
|
|
86
86
|
description: "Computer playground platform descriptor",
|
|
87
87
|
async prepare (options) {
|
|
88
|
-
const
|
|
88
|
+
const initialAccessibility = (0, computer_namespaceObject.checkAccessibilityPermission)(true);
|
|
89
|
+
const initialScreenRecording = (0, computer_namespaceObject.checkScreenRecordingPermission)(true);
|
|
90
|
+
const evaluatePermissions = ()=>{
|
|
91
|
+
const accessibilityCheck = (0, computer_namespaceObject.checkAccessibilityPermission)(false);
|
|
92
|
+
const screenRecordingCheck = (0, computer_namespaceObject.checkScreenRecordingPermission)(false);
|
|
93
|
+
const permissionError = !accessibilityCheck.hasPermission && accessibilityCheck.error || !screenRecordingCheck.hasPermission && screenRecordingCheck.error || void 0;
|
|
94
|
+
return {
|
|
95
|
+
accessibilityCheck,
|
|
96
|
+
screenRecordingCheck,
|
|
97
|
+
permissionError,
|
|
98
|
+
allPermissionsGranted: accessibilityCheck.hasPermission && screenRecordingCheck.hasPermission
|
|
99
|
+
};
|
|
100
|
+
};
|
|
89
101
|
const staticDir = options?.staticDir || external_node_path_default().join(__dirname, '../../static');
|
|
90
102
|
const availablePort = await (0, node_namespaceObject.findAvailablePort)(constants_namespaceObject.PLAYGROUND_SERVER_PORT);
|
|
91
103
|
if (availablePort !== constants_namespaceObject.PLAYGROUND_SERVER_PORT) console.log(`⚠️ Port ${constants_namespaceObject.PLAYGROUND_SERVER_PORT} is busy, using port ${availablePort} instead`);
|
|
92
104
|
const sessionManager = {
|
|
93
105
|
async getSetupSchema () {
|
|
106
|
+
const { allPermissionsGranted, permissionError } = evaluatePermissions();
|
|
94
107
|
const displays = await (0, computer_namespaceObject.getConnectedDisplays)();
|
|
95
108
|
const defaultDisplay = displays.find((display)=>display.primary) || displays[0];
|
|
96
109
|
return {
|
|
97
110
|
title: 'Connect Computer Agent',
|
|
98
|
-
description:
|
|
111
|
+
description: allPermissionsGranted ? 'Create a Computer Agent for the selected display.' : permissionError,
|
|
99
112
|
primaryActionLabel: 'Create Agent',
|
|
100
113
|
fields: [
|
|
101
114
|
{
|
|
@@ -130,7 +143,8 @@ const computerPlaygroundPlatform = (0, playground_namespaceObject.definePlaygrou
|
|
|
130
143
|
}));
|
|
131
144
|
},
|
|
132
145
|
async createSession (input) {
|
|
133
|
-
|
|
146
|
+
const { allPermissionsGranted, permissionError } = evaluatePermissions();
|
|
147
|
+
if (!allPermissionsGranted) throw new Error(permissionError || 'Accessibility and Screen Recording permissions are required');
|
|
134
148
|
const displayId = input?.displayId === void 0 || null === input.displayId ? void 0 : String(input.displayId);
|
|
135
149
|
const agent = await (0, computer_namespaceObject.agentFromComputer)(displayId ? {
|
|
136
150
|
displayId
|
|
@@ -182,8 +196,8 @@ const computerPlaygroundPlatform = (0, playground_namespaceObject.definePlaygrou
|
|
|
182
196
|
metadata: {
|
|
183
197
|
executionUx: 'countdown-before-run',
|
|
184
198
|
sessionConnected: false,
|
|
185
|
-
setupState:
|
|
186
|
-
setupBlockingReason:
|
|
199
|
+
setupState: initialAccessibility.hasPermission && initialScreenRecording.hasPermission ? 'required' : 'blocked',
|
|
200
|
+
setupBlockingReason: !initialAccessibility.hasPermission && initialAccessibility.error || !initialScreenRecording.hasPermission && initialScreenRecording.error || void 0
|
|
187
201
|
}
|
|
188
202
|
};
|
|
189
203
|
}
|
package/dist/lib/index.js
CHANGED
|
@@ -47,17 +47,30 @@ const computerPlaygroundPlatform = (0, playground_namespaceObject.definePlaygrou
|
|
|
47
47
|
title: 'Midscene Computer Playground',
|
|
48
48
|
description: "Computer playground platform descriptor",
|
|
49
49
|
async prepare (options) {
|
|
50
|
-
const
|
|
50
|
+
const initialAccessibility = (0, computer_namespaceObject.checkAccessibilityPermission)(true);
|
|
51
|
+
const initialScreenRecording = (0, computer_namespaceObject.checkScreenRecordingPermission)(true);
|
|
52
|
+
const evaluatePermissions = ()=>{
|
|
53
|
+
const accessibilityCheck = (0, computer_namespaceObject.checkAccessibilityPermission)(false);
|
|
54
|
+
const screenRecordingCheck = (0, computer_namespaceObject.checkScreenRecordingPermission)(false);
|
|
55
|
+
const permissionError = !accessibilityCheck.hasPermission && accessibilityCheck.error || !screenRecordingCheck.hasPermission && screenRecordingCheck.error || void 0;
|
|
56
|
+
return {
|
|
57
|
+
accessibilityCheck,
|
|
58
|
+
screenRecordingCheck,
|
|
59
|
+
permissionError,
|
|
60
|
+
allPermissionsGranted: accessibilityCheck.hasPermission && screenRecordingCheck.hasPermission
|
|
61
|
+
};
|
|
62
|
+
};
|
|
51
63
|
const staticDir = options?.staticDir || external_node_path_default().join(__dirname, '../../static');
|
|
52
64
|
const availablePort = await (0, node_namespaceObject.findAvailablePort)(constants_namespaceObject.PLAYGROUND_SERVER_PORT);
|
|
53
65
|
if (availablePort !== constants_namespaceObject.PLAYGROUND_SERVER_PORT) console.log(`⚠️ Port ${constants_namespaceObject.PLAYGROUND_SERVER_PORT} is busy, using port ${availablePort} instead`);
|
|
54
66
|
const sessionManager = {
|
|
55
67
|
async getSetupSchema () {
|
|
68
|
+
const { allPermissionsGranted, permissionError } = evaluatePermissions();
|
|
56
69
|
const displays = await (0, computer_namespaceObject.getConnectedDisplays)();
|
|
57
70
|
const defaultDisplay = displays.find((display)=>display.primary) || displays[0];
|
|
58
71
|
return {
|
|
59
72
|
title: 'Connect Computer Agent',
|
|
60
|
-
description:
|
|
73
|
+
description: allPermissionsGranted ? 'Create a Computer Agent for the selected display.' : permissionError,
|
|
61
74
|
primaryActionLabel: 'Create Agent',
|
|
62
75
|
fields: [
|
|
63
76
|
{
|
|
@@ -92,7 +105,8 @@ const computerPlaygroundPlatform = (0, playground_namespaceObject.definePlaygrou
|
|
|
92
105
|
}));
|
|
93
106
|
},
|
|
94
107
|
async createSession (input) {
|
|
95
|
-
|
|
108
|
+
const { allPermissionsGranted, permissionError } = evaluatePermissions();
|
|
109
|
+
if (!allPermissionsGranted) throw new Error(permissionError || 'Accessibility and Screen Recording permissions are required');
|
|
96
110
|
const displayId = input?.displayId === void 0 || null === input.displayId ? void 0 : String(input.displayId);
|
|
97
111
|
const agent = await (0, computer_namespaceObject.agentFromComputer)(displayId ? {
|
|
98
112
|
displayId
|
|
@@ -144,8 +158,8 @@ const computerPlaygroundPlatform = (0, playground_namespaceObject.definePlaygrou
|
|
|
144
158
|
metadata: {
|
|
145
159
|
executionUx: 'countdown-before-run',
|
|
146
160
|
sessionConnected: false,
|
|
147
|
-
setupState:
|
|
148
|
-
setupBlockingReason:
|
|
161
|
+
setupState: initialAccessibility.hasPermission && initialScreenRecording.hasPermission ? 'required' : 'blocked',
|
|
162
|
+
setupBlockingReason: !initialAccessibility.hasPermission && initialAccessibility.error || !initialScreenRecording.hasPermission && initialScreenRecording.error || void 0
|
|
149
163
|
}
|
|
150
164
|
};
|
|
151
165
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midscene/computer-playground",
|
|
3
|
-
"version": "1.8.1
|
|
3
|
+
"version": "1.8.1",
|
|
4
4
|
"description": "Computer playground for Midscene - PC desktop automation",
|
|
5
5
|
"main": "./dist/lib/index.js",
|
|
6
6
|
"types": "./dist/types/index.d.ts",
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
"cors": "^2.8.5",
|
|
20
20
|
"express": "^4.21.2",
|
|
21
21
|
"puppeteer": "24.6.0",
|
|
22
|
-
"@midscene/core": "1.8.1
|
|
23
|
-
"@midscene/
|
|
24
|
-
"@midscene/
|
|
25
|
-
"@midscene/shared": "1.8.1
|
|
22
|
+
"@midscene/core": "1.8.1",
|
|
23
|
+
"@midscene/computer": "1.8.1",
|
|
24
|
+
"@midscene/playground": "1.8.1",
|
|
25
|
+
"@midscene/shared": "1.8.1"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@rslib/core": "^0.18.3",
|
package/static/index.html
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<!doctype html><html><head><title>Midscene Computer Playground</title><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><script defer src="/static/js/lib-react.e13cc2e0.js"></script><script defer src="/static/js/
|
|
1
|
+
<!doctype html><html><head><title>Midscene Computer Playground</title><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><script defer src="/static/js/lib-react.e13cc2e0.js"></script><script defer src="/static/js/596.6ba15860.js"></script><script defer src="/static/js/index.a5c69909.js"></script><link href="/static/css/index.26c9c911.css" rel="stylesheet"></head><body><div id="root"></div></body></html>
|