@midscene/visualizer 0.27.5 → 0.27.6
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/component/playground/playground-execution.mjs +10 -12
- package/dist/es/component/playground/playground-utils.mjs +1 -1
- package/dist/lib/component/playground/playground-execution.js +10 -12
- package/dist/lib/component/playground/playground-utils.js +1 -1
- package/dist/types/component/playground/playground-execution.d.ts +3 -5
- package/dist/types/component/playground/playground-types.d.ts +3 -5
- package/dist/types/component/playground/playground-utils.d.ts +2 -3
- package/package.json +4 -4
|
@@ -82,32 +82,30 @@ function validateStructuredParams(value, action) {
|
|
|
82
82
|
valid: true
|
|
83
83
|
};
|
|
84
84
|
}
|
|
85
|
-
async function executeAction(activeAgent, actionType, actionSpace, value,
|
|
85
|
+
async function executeAction(activeAgent, actionType, actionSpace, value, options) {
|
|
86
86
|
const action = null == actionSpace ? void 0 : actionSpace.find((a)=>a.interfaceAlias === actionType || a.name === actionType);
|
|
87
87
|
if (action && 'function' == typeof activeAgent.callActionInActionSpace) if (!value.params) return await activeAgent.callActionInActionSpace(action.name, {
|
|
88
88
|
prompt: value.prompt,
|
|
89
|
-
|
|
89
|
+
...options
|
|
90
90
|
});
|
|
91
91
|
else {
|
|
92
|
-
const parsedParams = await parseStructuredParams(action, value.params,
|
|
93
|
-
deepThink
|
|
94
|
-
});
|
|
92
|
+
const parsedParams = await parseStructuredParams(action, value.params, options);
|
|
95
93
|
return await activeAgent.callActionInActionSpace(action.name, parsedParams[0]);
|
|
96
94
|
}
|
|
97
95
|
{
|
|
98
96
|
const prompt = value.prompt;
|
|
99
97
|
if ('aiAssert' === actionType) {
|
|
100
|
-
|
|
101
|
-
|
|
98
|
+
var _activeAgent_aiAssert;
|
|
99
|
+
const { pass, thought } = await (null == activeAgent ? void 0 : null == (_activeAgent_aiAssert = activeAgent.aiAssert) ? void 0 : _activeAgent_aiAssert.call(activeAgent, prompt || '', void 0, {
|
|
100
|
+
keepRawResponse: true,
|
|
101
|
+
...options
|
|
102
102
|
})) || {};
|
|
103
103
|
return {
|
|
104
|
-
pass,
|
|
105
|
-
thought
|
|
104
|
+
pass: pass || false,
|
|
105
|
+
thought: thought || ''
|
|
106
106
|
};
|
|
107
107
|
}
|
|
108
|
-
if (activeAgent && 'function' == typeof activeAgent[actionType]) return await activeAgent[actionType](prompt,
|
|
109
|
-
deepThink
|
|
110
|
-
});
|
|
108
|
+
if (activeAgent && 'function' == typeof activeAgent[actionType]) return await activeAgent[actionType](prompt, options);
|
|
111
109
|
throw new Error(`Unknown action type: ${actionType}`);
|
|
112
110
|
}
|
|
113
111
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { StaticPage, StaticPageAgent } from "@midscene/playground";
|
|
1
2
|
import { PLAYGROUND_SERVER_PORT } from "@midscene/shared/constants";
|
|
2
|
-
import { StaticPage, StaticPageAgent } from "@midscene/web/playground";
|
|
3
3
|
import { isZodObjectSchema, unwrapZodType } from "./types.mjs";
|
|
4
4
|
const serverBase = `http://localhost:${PLAYGROUND_SERVER_PORT}`;
|
|
5
5
|
const checkServerStatus = async ()=>{
|
|
@@ -112,32 +112,30 @@ function validateStructuredParams(value, action) {
|
|
|
112
112
|
valid: true
|
|
113
113
|
};
|
|
114
114
|
}
|
|
115
|
-
async function executeAction(activeAgent, actionType, actionSpace, value,
|
|
115
|
+
async function executeAction(activeAgent, actionType, actionSpace, value, options) {
|
|
116
116
|
const action = null == actionSpace ? void 0 : actionSpace.find((a)=>a.interfaceAlias === actionType || a.name === actionType);
|
|
117
117
|
if (action && 'function' == typeof activeAgent.callActionInActionSpace) if (!value.params) return await activeAgent.callActionInActionSpace(action.name, {
|
|
118
118
|
prompt: value.prompt,
|
|
119
|
-
|
|
119
|
+
...options
|
|
120
120
|
});
|
|
121
121
|
else {
|
|
122
|
-
const parsedParams = await parseStructuredParams(action, value.params,
|
|
123
|
-
deepThink
|
|
124
|
-
});
|
|
122
|
+
const parsedParams = await parseStructuredParams(action, value.params, options);
|
|
125
123
|
return await activeAgent.callActionInActionSpace(action.name, parsedParams[0]);
|
|
126
124
|
}
|
|
127
125
|
{
|
|
128
126
|
const prompt = value.prompt;
|
|
129
127
|
if ('aiAssert' === actionType) {
|
|
130
|
-
|
|
131
|
-
|
|
128
|
+
var _activeAgent_aiAssert;
|
|
129
|
+
const { pass, thought } = await (null == activeAgent ? void 0 : null == (_activeAgent_aiAssert = activeAgent.aiAssert) ? void 0 : _activeAgent_aiAssert.call(activeAgent, prompt || '', void 0, {
|
|
130
|
+
keepRawResponse: true,
|
|
131
|
+
...options
|
|
132
132
|
})) || {};
|
|
133
133
|
return {
|
|
134
|
-
pass,
|
|
135
|
-
thought
|
|
134
|
+
pass: pass || false,
|
|
135
|
+
thought: thought || ''
|
|
136
136
|
};
|
|
137
137
|
}
|
|
138
|
-
if (activeAgent && 'function' == typeof activeAgent[actionType]) return await activeAgent[actionType](prompt,
|
|
139
|
-
deepThink
|
|
140
|
-
});
|
|
138
|
+
if (activeAgent && 'function' == typeof activeAgent[actionType]) return await activeAgent[actionType](prompt, options);
|
|
141
139
|
throw new Error(`Unknown action type: ${actionType}`);
|
|
142
140
|
}
|
|
143
141
|
}
|
|
@@ -38,8 +38,8 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
38
38
|
overrideServerConfig: ()=>overrideServerConfig,
|
|
39
39
|
getTaskProgress: ()=>getTaskProgress
|
|
40
40
|
});
|
|
41
|
+
const playground_namespaceObject = require("@midscene/playground");
|
|
41
42
|
const constants_namespaceObject = require("@midscene/shared/constants");
|
|
42
|
-
const playground_namespaceObject = require("@midscene/web/playground");
|
|
43
43
|
const external_types_js_namespaceObject = require("./types.js");
|
|
44
44
|
const serverBase = `http://localhost:${constants_namespaceObject.PLAYGROUND_SERVER_PORT}`;
|
|
45
45
|
const checkServerStatus = async ()=>{
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { DeviceAction } from '@midscene/core';
|
|
2
|
+
import type { ExecutionOptions, FormValue, PlaygroundAgent, ValidationResult } from '@midscene/playground';
|
|
2
3
|
export declare const formatErrorMessage: (e: any) => string;
|
|
3
|
-
export declare function validateStructuredParams(value:
|
|
4
|
-
|
|
5
|
-
errorMessage?: string;
|
|
6
|
-
};
|
|
7
|
-
export declare function executeAction(activeAgent: any, actionType: string, actionSpace: DeviceAction<any>[], value: any, deepThink: boolean): Promise<any>;
|
|
4
|
+
export declare function validateStructuredParams(value: FormValue, action: DeviceAction<unknown> | undefined): ValidationResult;
|
|
5
|
+
export declare function executeAction(activeAgent: PlaygroundAgent, actionType: string, actionSpace: DeviceAction<unknown>[], value: FormValue, options: ExecutionOptions): Promise<unknown>;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import type { GroupedActionDump } from '@midscene/core';
|
|
2
|
-
import type {
|
|
3
|
-
import type { ChromeExtensionProxyPageAgent } from '@midscene/web/chrome-extension';
|
|
4
|
-
import type { StaticPageAgent } from '@midscene/web/playground';
|
|
1
|
+
import type { GroupedActionDump, WebUIContext } from '@midscene/core';
|
|
2
|
+
import type { PlaygroundAgent } from '@midscene/playground';
|
|
5
3
|
export interface PlaygroundResult {
|
|
6
4
|
result: any;
|
|
7
5
|
dump?: GroupedActionDump | null;
|
|
@@ -9,7 +7,7 @@ export interface PlaygroundResult {
|
|
|
9
7
|
error: string | null;
|
|
10
8
|
}
|
|
11
9
|
export interface PlaygroundProps {
|
|
12
|
-
getAgent: (forceSameTabNavigation?: boolean) =>
|
|
10
|
+
getAgent: (forceSameTabNavigation?: boolean) => PlaygroundAgent | null;
|
|
13
11
|
hideLogo?: boolean;
|
|
14
12
|
showContextPreview?: boolean;
|
|
15
13
|
dryMode?: boolean;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { UIContext } from '@midscene/core';
|
|
2
|
-
import
|
|
3
|
-
import { StaticPageAgent } from '@midscene/web/playground';
|
|
1
|
+
import type { UIContext, WebUIContext } from '@midscene/core';
|
|
2
|
+
import { StaticPageAgent } from '@midscene/playground';
|
|
4
3
|
export declare const serverBase = "http://localhost:5800";
|
|
5
4
|
export declare const checkServerStatus: () => Promise<boolean>;
|
|
6
5
|
export declare const requestPlaygroundServer: (context: UIContext | string, type: string, prompt: string, { requestId, deepThink, params, screenshotIncluded, domIncluded, }?: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midscene/visualizer",
|
|
3
|
-
"version": "0.27.
|
|
3
|
+
"version": "0.27.6",
|
|
4
4
|
"repository": "https://github.com/web-infra-dev/midscene",
|
|
5
5
|
"homepage": "https://midscenejs.com/",
|
|
6
6
|
"types": "./dist/types/index.d.ts",
|
|
@@ -70,9 +70,9 @@
|
|
|
70
70
|
"antd": "^5.21.6",
|
|
71
71
|
"buffer": "6.0.3",
|
|
72
72
|
"dayjs": "^1.11.11",
|
|
73
|
-
"@midscene/
|
|
74
|
-
"@midscene/
|
|
75
|
-
"@midscene/
|
|
73
|
+
"@midscene/shared": "0.27.6",
|
|
74
|
+
"@midscene/core": "0.27.6",
|
|
75
|
+
"@midscene/playground": "0.27.6"
|
|
76
76
|
},
|
|
77
77
|
"license": "MIT",
|
|
78
78
|
"scripts": {
|