@midscene/visualizer 0.30.10 → 1.0.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/component/blackboard/index.css +8 -0
- package/dist/es/component/blackboard/index.mjs +137 -68
- package/dist/es/component/config-selector/index.mjs +102 -4
- package/dist/es/component/context-preview/index.mjs +1 -2
- package/dist/es/component/env-config/index.mjs +1 -2
- package/dist/es/component/env-config-reminder/index.css +8 -0
- package/dist/es/component/env-config-reminder/index.mjs +1 -2
- package/dist/es/component/form-field/index.mjs +5 -10
- package/dist/es/component/history-selector/index.css +38 -1
- package/dist/es/component/history-selector/index.mjs +1 -2
- package/dist/es/component/logo/index.mjs +7 -3
- package/dist/es/component/misc/index.mjs +1 -4
- package/dist/es/component/nav-actions/index.mjs +1 -2
- package/dist/es/component/nav-actions/style.css +1 -1
- package/dist/es/component/player/index.css +26 -0
- package/dist/es/component/player/index.mjs +376 -364
- package/dist/es/component/playground/index.css +291 -31
- package/dist/es/component/playground-result/index.css +10 -0
- package/dist/es/component/playground-result/index.mjs +129 -10
- package/dist/es/component/prompt-input/index.css +281 -31
- package/dist/es/component/prompt-input/index.mjs +83 -25
- package/dist/es/component/screenshot-viewer/index.css +214 -0
- package/dist/es/component/screenshot-viewer/index.mjs +282 -0
- package/dist/es/component/service-mode-control/index.mjs +1 -2
- package/dist/es/component/shiny-text/index.css +35 -3
- package/dist/es/component/shiny-text/index.mjs +3 -3
- package/dist/es/component/universal-playground/index.css +61 -1
- package/dist/es/component/universal-playground/index.mjs +106 -83
- package/dist/es/component/universal-playground/providers/context-provider.mjs +56 -18
- package/dist/es/component/universal-playground/providers/indexeddb-storage-provider.mjs +213 -139
- package/dist/es/component/universal-playground/providers/storage-provider.mjs +199 -121
- package/dist/es/hooks/usePlaygroundExecution.mjs +297 -146
- package/dist/es/hooks/usePlaygroundState.mjs +141 -75
- package/dist/es/hooks/useSafeOverrideAIConfig.mjs +2 -6
- package/dist/es/hooks/useServerValid.mjs +37 -12
- package/dist/es/hooks/useTheme.mjs +25 -0
- package/dist/es/icons/avatar.mjs +46 -4
- package/dist/es/icons/close.mjs +46 -4
- package/dist/es/icons/global-perspective.mjs +47 -5
- package/dist/es/icons/history.mjs +48 -6
- package/dist/es/icons/magnifying-glass.mjs +47 -5
- package/dist/es/icons/player-setting.mjs +48 -6
- package/dist/es/icons/setting.mjs +47 -5
- package/dist/es/icons/show-marker.mjs +47 -5
- package/dist/es/index.mjs +4 -4
- package/dist/es/store/history.mjs +46 -7
- package/dist/es/store/store.mjs +68 -2
- package/dist/es/types.mjs +1 -1
- package/dist/es/utils/constants.mjs +7 -3
- package/dist/es/utils/index.mjs +4 -1
- package/dist/es/utils/pixi-loader.mjs +37 -11
- package/dist/es/utils/replay-scripts.mjs +160 -111
- package/dist/lib/component/blackboard/index.css +8 -0
- package/dist/lib/component/blackboard/index.js +139 -70
- package/dist/lib/component/config-selector/index.js +103 -5
- package/dist/lib/component/context-preview/index.js +3 -4
- package/dist/lib/component/env-config/index.js +3 -4
- package/dist/lib/component/env-config-reminder/index.css +8 -0
- package/dist/lib/component/env-config-reminder/index.js +3 -4
- package/dist/lib/component/form-field/index.js +10 -15
- package/dist/lib/component/history-selector/index.css +38 -1
- package/dist/lib/component/history-selector/index.js +3 -4
- package/dist/lib/component/index.js +6 -8
- package/dist/lib/component/logo/index.js +9 -5
- package/dist/lib/component/misc/index.js +6 -9
- package/dist/lib/component/nav-actions/index.js +3 -4
- package/dist/lib/component/nav-actions/style.css +1 -1
- package/dist/lib/component/player/index.css +26 -0
- package/dist/lib/component/player/index.js +376 -365
- package/dist/lib/component/playground/index.css +291 -31
- package/dist/lib/component/playground/index.js +31 -33
- package/dist/lib/component/playground-result/index.css +10 -0
- package/dist/lib/component/playground-result/index.js +131 -12
- package/dist/lib/component/prompt-input/index.css +281 -31
- package/dist/lib/component/prompt-input/index.js +84 -26
- package/dist/lib/component/screenshot-viewer/index.css +214 -0
- package/dist/lib/component/screenshot-viewer/index.js +316 -0
- package/dist/lib/component/service-mode-control/index.js +3 -4
- package/dist/lib/component/shiny-text/index.css +35 -3
- package/dist/lib/component/shiny-text/index.js +5 -5
- package/dist/lib/component/universal-playground/index.css +61 -1
- package/dist/lib/component/universal-playground/index.js +108 -84
- package/dist/lib/component/universal-playground/providers/context-provider.js +58 -20
- package/dist/lib/component/universal-playground/providers/indexeddb-storage-provider.js +217 -143
- package/dist/lib/component/universal-playground/providers/storage-provider.js +207 -129
- package/dist/lib/hooks/usePlaygroundExecution.js +299 -148
- package/dist/lib/hooks/usePlaygroundState.js +143 -77
- package/dist/lib/hooks/useSafeOverrideAIConfig.js +4 -8
- package/dist/lib/hooks/useServerValid.js +39 -14
- package/dist/lib/hooks/useTheme.js +59 -0
- package/dist/lib/icons/avatar.js +48 -6
- package/dist/lib/icons/close.js +48 -6
- package/dist/lib/icons/global-perspective.js +49 -7
- package/dist/lib/icons/history.js +50 -8
- package/dist/lib/icons/magnifying-glass.js +49 -7
- package/dist/lib/icons/player-setting.js +50 -8
- package/dist/lib/icons/setting.js +49 -7
- package/dist/lib/icons/show-marker.js +49 -7
- package/dist/lib/index.js +44 -34
- package/dist/lib/store/history.js +48 -9
- package/dist/lib/store/store.js +74 -8
- package/dist/lib/types.js +3 -3
- package/dist/lib/utils/color.js +2 -2
- package/dist/lib/utils/constants.js +20 -4
- package/dist/lib/utils/index.js +10 -4
- package/dist/lib/utils/pixi-loader.js +41 -15
- package/dist/lib/utils/playground-utils.js +4 -4
- package/dist/lib/utils/replay-scripts.js +164 -115
- package/dist/types/component/config-selector/index.d.ts +2 -0
- package/dist/types/component/player/index.d.ts +0 -1
- package/dist/types/component/playground-result/index.d.ts +1 -0
- package/dist/types/component/prompt-input/index.d.ts +2 -1
- package/dist/types/component/screenshot-viewer/index.d.ts +15 -0
- package/dist/types/hooks/usePlaygroundExecution.d.ts +1 -1
- package/dist/types/hooks/usePlaygroundState.d.ts +3 -3
- package/dist/types/hooks/useTheme.d.ts +7 -0
- package/dist/types/index.d.ts +3 -3
- package/dist/types/store/store.d.ts +18 -1
- package/dist/types/types.d.ts +14 -4
- package/dist/types/utils/constants.d.ts +5 -1
- package/dist/types/utils/index.d.ts +1 -0
- package/dist/types/utils/replay-scripts.d.ts +1 -1
- package/package.json +12 -22
|
@@ -26,131 +26,240 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
27
|
usePlaygroundExecution: ()=>usePlaygroundExecution
|
|
28
28
|
});
|
|
29
|
+
const agent_namespaceObject = require("@midscene/core/agent");
|
|
29
30
|
const external_react_namespaceObject = require("react");
|
|
30
31
|
const store_js_namespaceObject = require("../store/store.js");
|
|
31
|
-
const playground_namespaceObject = require("@midscene/playground");
|
|
32
32
|
const constants_js_namespaceObject = require("../utils/constants.js");
|
|
33
33
|
const replay_scripts_js_namespaceObject = require("../utils/replay-scripts.js");
|
|
34
|
-
function
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
const result = {
|
|
53
|
-
...constants_js_namespaceObject.BLANK_RESULT
|
|
54
|
-
};
|
|
55
|
-
const systemItem = {
|
|
56
|
-
id: `system-${thisRunningId}`,
|
|
57
|
-
type: 'system',
|
|
58
|
-
content: '',
|
|
59
|
-
timestamp: new Date(),
|
|
60
|
-
loading: true,
|
|
61
|
-
loadingProgressText: ''
|
|
62
|
-
};
|
|
63
|
-
setInfoList((prev)=>[
|
|
64
|
-
...prev,
|
|
65
|
-
systemItem
|
|
66
|
-
]);
|
|
67
|
-
try {
|
|
68
|
-
currentRunningIdRef.current = thisRunningId;
|
|
69
|
-
interruptedFlagRef.current[thisRunningId] = false;
|
|
70
|
-
if (playgroundSDK.onProgressUpdate) playgroundSDK.onProgressUpdate(()=>{});
|
|
71
|
-
if (playgroundSDK.onProgressUpdate) playgroundSDK.onProgressUpdate((tip)=>{
|
|
72
|
-
if (interruptedFlagRef.current[thisRunningId]) return;
|
|
73
|
-
setInfoList((prev)=>{
|
|
74
|
-
const lastItem = prev[prev.length - 1];
|
|
75
|
-
if (lastItem && 'progress' === lastItem.type && lastItem.content === tip) return prev;
|
|
76
|
-
const progressItem = {
|
|
77
|
-
id: `progress-${thisRunningId}-${Date.now()}`,
|
|
78
|
-
type: 'progress',
|
|
79
|
-
content: tip,
|
|
80
|
-
timestamp: new Date()
|
|
81
|
-
};
|
|
82
|
-
return [
|
|
83
|
-
...prev,
|
|
84
|
-
progressItem
|
|
85
|
-
];
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
result.result = await playgroundSDK.executeAction(actionType, value, {
|
|
89
|
-
requestId: thisRunningId.toString(),
|
|
90
|
-
deepThink,
|
|
91
|
-
screenshotIncluded,
|
|
92
|
-
domIncluded
|
|
93
|
-
});
|
|
94
|
-
if ('object' == typeof result.result && null !== result.result) {
|
|
95
|
-
const resultObj = result.result;
|
|
96
|
-
if (resultObj.dump) result.dump = resultObj.dump;
|
|
97
|
-
if (resultObj.reportHTML) result.reportHTML = resultObj.reportHTML;
|
|
98
|
-
if (resultObj.error) result.error = resultObj.error;
|
|
99
|
-
if (void 0 !== resultObj.result) result.result = resultObj.result;
|
|
34
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
35
|
+
try {
|
|
36
|
+
var info = gen[key](arg);
|
|
37
|
+
var value = info.value;
|
|
38
|
+
} catch (error) {
|
|
39
|
+
reject(error);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
if (info.done) resolve(value);
|
|
43
|
+
else Promise.resolve(value).then(_next, _throw);
|
|
44
|
+
}
|
|
45
|
+
function _async_to_generator(fn) {
|
|
46
|
+
return function() {
|
|
47
|
+
var self = this, args = arguments;
|
|
48
|
+
return new Promise(function(resolve, reject) {
|
|
49
|
+
var gen = fn.apply(self, args);
|
|
50
|
+
function _next(value) {
|
|
51
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
100
52
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
53
|
+
function _throw(err) {
|
|
54
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
55
|
+
}
|
|
56
|
+
_next(void 0);
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
function _define_property(obj, key, value) {
|
|
61
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
62
|
+
value: value,
|
|
63
|
+
enumerable: true,
|
|
64
|
+
configurable: true,
|
|
65
|
+
writable: true
|
|
66
|
+
});
|
|
67
|
+
else obj[key] = value;
|
|
68
|
+
return obj;
|
|
69
|
+
}
|
|
70
|
+
function _object_spread(target) {
|
|
71
|
+
for(var i = 1; i < arguments.length; i++){
|
|
72
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
73
|
+
var ownKeys = Object.keys(source);
|
|
74
|
+
if ("function" == typeof Object.getOwnPropertySymbols) ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
75
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
76
|
+
}));
|
|
77
|
+
ownKeys.forEach(function(key) {
|
|
78
|
+
_define_property(target, key, source[key]);
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
return target;
|
|
82
|
+
}
|
|
83
|
+
function usePlaygroundExecution_ownKeys(object, enumerableOnly) {
|
|
84
|
+
var keys = Object.keys(object);
|
|
85
|
+
if (Object.getOwnPropertySymbols) {
|
|
86
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
87
|
+
if (enumerableOnly) symbols = symbols.filter(function(sym) {
|
|
88
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
89
|
+
});
|
|
90
|
+
keys.push.apply(keys, symbols);
|
|
91
|
+
}
|
|
92
|
+
return keys;
|
|
93
|
+
}
|
|
94
|
+
function _object_spread_props(target, source) {
|
|
95
|
+
source = null != source ? source : {};
|
|
96
|
+
if (Object.getOwnPropertyDescriptors) Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
97
|
+
else usePlaygroundExecution_ownKeys(Object(source)).forEach(function(key) {
|
|
98
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
99
|
+
});
|
|
100
|
+
return target;
|
|
101
|
+
}
|
|
102
|
+
function buildProgressContent(task) {
|
|
103
|
+
const action = (0, agent_namespaceObject.typeStr)(task);
|
|
104
|
+
const description = (0, agent_namespaceObject.paramStr)(task);
|
|
105
|
+
return description ? `${action} - ${description}` : action;
|
|
106
|
+
}
|
|
107
|
+
function wrapExecutionDumpForReplay(dump) {
|
|
108
|
+
const modelBriefsSet = new Set();
|
|
109
|
+
if ((null == dump ? void 0 : dump.tasks) && Array.isArray(dump.tasks)) dump.tasks.forEach((task)=>{
|
|
110
|
+
if (task.usage) {
|
|
111
|
+
const { model_name, model_description, intent } = task.usage;
|
|
112
|
+
if (intent && model_name) modelBriefsSet.add(model_description ? `${intent}/${model_name}(${model_description})` : `${intent}/${model_name}`);
|
|
142
113
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
114
|
+
});
|
|
115
|
+
else console.warn('[wrapExecutionDumpForReplay] Invalid dump structure:', dump);
|
|
116
|
+
const modelBriefs = [
|
|
117
|
+
...modelBriefsSet
|
|
118
|
+
];
|
|
119
|
+
return {
|
|
120
|
+
sdkVersion: '',
|
|
121
|
+
groupName: 'Playground Execution',
|
|
122
|
+
modelBriefs,
|
|
123
|
+
executions: [
|
|
124
|
+
dump
|
|
125
|
+
]
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
function usePlaygroundExecution(playgroundSDK, storage, actionSpace, loading, setLoading, setInfoList, replayCounter, setReplayCounter, verticalMode, currentRunningIdRef, interruptedFlagRef) {
|
|
129
|
+
const { deepThink, screenshotIncluded, domIncluded, planningStrategy } = (0, store_js_namespaceObject.useEnvConfig)();
|
|
130
|
+
const handleRun = (0, external_react_namespaceObject.useCallback)((value)=>_async_to_generator(function*() {
|
|
131
|
+
if (!playgroundSDK) return void console.warn('PlaygroundSDK is not available');
|
|
132
|
+
const thisRunningId = Date.now();
|
|
133
|
+
const actionType = value.type;
|
|
134
|
+
const displayContent = `${value.type}: ${value.prompt || JSON.stringify(value.params)}`;
|
|
135
|
+
const userItem = {
|
|
136
|
+
id: `user-${Date.now()}`,
|
|
137
|
+
type: 'user',
|
|
138
|
+
content: displayContent,
|
|
139
|
+
timestamp: new Date()
|
|
140
|
+
};
|
|
141
|
+
setInfoList((prev)=>[
|
|
142
|
+
...prev,
|
|
143
|
+
userItem
|
|
144
|
+
]);
|
|
145
|
+
setLoading(true);
|
|
146
|
+
const result = _object_spread({}, constants_js_namespaceObject.BLANK_RESULT);
|
|
147
|
+
const systemItem = {
|
|
148
|
+
id: `system-${thisRunningId}`,
|
|
149
|
+
type: 'system',
|
|
150
|
+
content: '',
|
|
151
|
+
timestamp: new Date(),
|
|
152
|
+
loading: true,
|
|
153
|
+
loadingProgressText: ''
|
|
154
|
+
};
|
|
155
|
+
setInfoList((prev)=>[
|
|
156
|
+
...prev,
|
|
157
|
+
systemItem
|
|
158
|
+
]);
|
|
159
|
+
try {
|
|
160
|
+
currentRunningIdRef.current = thisRunningId;
|
|
161
|
+
interruptedFlagRef.current[thisRunningId] = false;
|
|
162
|
+
if (playgroundSDK.onDumpUpdate) playgroundSDK.onDumpUpdate((_, executionDump)=>{
|
|
163
|
+
var _executionDump_tasks;
|
|
164
|
+
if (interruptedFlagRef.current[thisRunningId] || !(null == executionDump ? void 0 : null == (_executionDump_tasks = executionDump.tasks) ? void 0 : _executionDump_tasks.length)) return;
|
|
165
|
+
const progressItems = executionDump.tasks.map((task, index)=>{
|
|
166
|
+
var _task_timing;
|
|
167
|
+
return {
|
|
168
|
+
id: `progress-${thisRunningId}-task-${index}`,
|
|
169
|
+
type: 'progress',
|
|
170
|
+
content: buildProgressContent(task),
|
|
171
|
+
timestamp: new Date((null == (_task_timing = task.timing) ? void 0 : _task_timing.start) || Date.now()),
|
|
172
|
+
result: task.error ? {
|
|
173
|
+
error: String(task.error),
|
|
174
|
+
result: null
|
|
175
|
+
} : void 0
|
|
176
|
+
};
|
|
177
|
+
});
|
|
178
|
+
setInfoList((prev)=>{
|
|
179
|
+
const systemItemIndex = prev.findIndex((item)=>item.id === `system-${thisRunningId}`);
|
|
180
|
+
if (-1 === systemItemIndex) return prev;
|
|
181
|
+
const listWithoutCurrentProgress = prev.filter((item)=>!('progress' === item.type && item.id.startsWith(`progress-${thisRunningId}-`)));
|
|
182
|
+
return [
|
|
183
|
+
...listWithoutCurrentProgress.slice(0, systemItemIndex + 1),
|
|
184
|
+
...progressItems,
|
|
185
|
+
...listWithoutCurrentProgress.slice(systemItemIndex + 1)
|
|
186
|
+
];
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
result.result = yield playgroundSDK.executeAction(actionType, value, {
|
|
190
|
+
requestId: thisRunningId.toString(),
|
|
191
|
+
deepThink,
|
|
192
|
+
planningStrategy,
|
|
193
|
+
screenshotIncluded,
|
|
194
|
+
domIncluded
|
|
195
|
+
});
|
|
196
|
+
if ('object' == typeof result.result && null !== result.result) {
|
|
197
|
+
const resultObj = result.result;
|
|
198
|
+
if (resultObj.dump) result.dump = resultObj.dump;
|
|
199
|
+
if (resultObj.reportHTML) result.reportHTML = resultObj.reportHTML;
|
|
200
|
+
if (resultObj.error) result.error = resultObj.error;
|
|
201
|
+
if (void 0 !== resultObj.result) result.result = resultObj.result;
|
|
202
|
+
}
|
|
203
|
+
} catch (e) {
|
|
204
|
+
result.error = (null == e ? void 0 : e.message) || String(e);
|
|
205
|
+
console.error('Playground execution error:', e);
|
|
206
|
+
if ('object' == typeof e && null !== e) {
|
|
207
|
+
if (e.dump) result.dump = e.dump;
|
|
208
|
+
if (e.reportHTML) result.reportHTML = e.reportHTML;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
if (interruptedFlagRef.current[thisRunningId]) return;
|
|
212
|
+
setLoading(false);
|
|
213
|
+
currentRunningIdRef.current = null;
|
|
214
|
+
let replayInfo = null;
|
|
215
|
+
let counter = replayCounter;
|
|
216
|
+
if (null == result ? void 0 : result.dump) {
|
|
217
|
+
if (result.dump.tasks && Array.isArray(result.dump.tasks)) {
|
|
218
|
+
const groupedDump = wrapExecutionDumpForReplay(result.dump);
|
|
219
|
+
const info = (0, replay_scripts_js_namespaceObject.allScriptsFromDump)(groupedDump);
|
|
220
|
+
setReplayCounter((c)=>c + 1);
|
|
221
|
+
replayInfo = info;
|
|
222
|
+
counter = replayCounter + 1;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
setInfoList((prev)=>prev.map((item)=>item.id === `system-${thisRunningId}` ? _object_spread_props(_object_spread({}, item), {
|
|
226
|
+
content: '',
|
|
227
|
+
loading: false,
|
|
228
|
+
loadingProgressText: ''
|
|
229
|
+
}) : item));
|
|
230
|
+
const resultItem = {
|
|
231
|
+
id: `result-${thisRunningId}`,
|
|
232
|
+
type: 'result',
|
|
233
|
+
content: 'Execution result',
|
|
234
|
+
timestamp: new Date(),
|
|
235
|
+
result: result,
|
|
236
|
+
loading: false,
|
|
237
|
+
replayScriptsInfo: replayInfo,
|
|
238
|
+
replayCounter: counter,
|
|
239
|
+
loadingProgressText: '',
|
|
240
|
+
verticalMode: verticalMode,
|
|
241
|
+
actionType: actionType
|
|
242
|
+
};
|
|
243
|
+
setInfoList((prev)=>[
|
|
244
|
+
...prev,
|
|
245
|
+
resultItem
|
|
246
|
+
]);
|
|
247
|
+
if (null == storage ? void 0 : storage.saveResult) try {
|
|
248
|
+
yield storage.saveResult(resultItem.id, resultItem);
|
|
249
|
+
} catch (error) {
|
|
250
|
+
console.error('Failed to save result:', error);
|
|
251
|
+
}
|
|
252
|
+
const separatorItem = {
|
|
253
|
+
id: `separator-${thisRunningId}`,
|
|
254
|
+
type: 'separator',
|
|
255
|
+
content: 'New Session',
|
|
256
|
+
timestamp: new Date()
|
|
257
|
+
};
|
|
258
|
+
setInfoList((prev)=>[
|
|
259
|
+
...prev,
|
|
260
|
+
separatorItem
|
|
261
|
+
]);
|
|
262
|
+
})(), [
|
|
154
263
|
playgroundSDK,
|
|
155
264
|
storage,
|
|
156
265
|
actionSpace,
|
|
@@ -162,41 +271,83 @@ function usePlaygroundExecution(playgroundSDK, storage, actionSpace, loading, se
|
|
|
162
271
|
currentRunningIdRef,
|
|
163
272
|
interruptedFlagRef,
|
|
164
273
|
deepThink,
|
|
274
|
+
planningStrategy,
|
|
165
275
|
screenshotIncluded,
|
|
166
276
|
domIncluded
|
|
167
277
|
]);
|
|
168
|
-
const handleStop = (0, external_react_namespaceObject.useCallback)(
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
278
|
+
const handleStop = (0, external_react_namespaceObject.useCallback)(()=>_async_to_generator(function*() {
|
|
279
|
+
const thisRunningId = currentRunningIdRef.current;
|
|
280
|
+
if (thisRunningId && playgroundSDK && playgroundSDK.cancelExecution) try {
|
|
281
|
+
let executionData = null;
|
|
282
|
+
if (playgroundSDK.getCurrentExecutionData) try {
|
|
283
|
+
executionData = yield playgroundSDK.getCurrentExecutionData();
|
|
284
|
+
} catch (error) {
|
|
285
|
+
console.error('Failed to get execution data before stop:', error);
|
|
286
|
+
}
|
|
287
|
+
yield playgroundSDK.cancelExecution(thisRunningId.toString());
|
|
288
|
+
interruptedFlagRef.current[thisRunningId] = true;
|
|
289
|
+
setLoading(false);
|
|
290
|
+
if (playgroundSDK.onProgressUpdate) playgroundSDK.onProgressUpdate(()=>{});
|
|
291
|
+
if (playgroundSDK.onDumpUpdate) playgroundSDK.onDumpUpdate(()=>{});
|
|
292
|
+
setInfoList((prev)=>prev.map((item)=>item.id === `system-${thisRunningId}` ? _object_spread_props(_object_spread({}, item), {
|
|
293
|
+
content: '',
|
|
294
|
+
loading: false,
|
|
295
|
+
loadingProgressText: ''
|
|
296
|
+
}) : item));
|
|
297
|
+
if (executionData && (executionData.dump || executionData.reportHTML)) {
|
|
298
|
+
const resultItem = {
|
|
299
|
+
id: `stop-result-${thisRunningId}`,
|
|
300
|
+
type: 'result',
|
|
301
|
+
content: 'Execution stopped by user',
|
|
302
|
+
timestamp: new Date(),
|
|
303
|
+
result: {
|
|
304
|
+
result: null,
|
|
305
|
+
dump: executionData.dump,
|
|
306
|
+
reportHTML: executionData.reportHTML,
|
|
307
|
+
error: null
|
|
308
|
+
},
|
|
178
309
|
loading: false,
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
310
|
+
verticalMode,
|
|
311
|
+
replayCounter
|
|
312
|
+
};
|
|
313
|
+
setInfoList((prev)=>[
|
|
314
|
+
...prev,
|
|
315
|
+
resultItem
|
|
316
|
+
]);
|
|
317
|
+
} else {
|
|
318
|
+
const stopItem = {
|
|
319
|
+
id: `stop-${thisRunningId}`,
|
|
320
|
+
type: 'system',
|
|
321
|
+
content: 'Operation stopped',
|
|
322
|
+
timestamp: new Date(),
|
|
323
|
+
loading: false
|
|
324
|
+
};
|
|
325
|
+
setInfoList((prev)=>[
|
|
326
|
+
...prev,
|
|
327
|
+
stopItem
|
|
328
|
+
]);
|
|
329
|
+
}
|
|
330
|
+
const separatorItem = {
|
|
331
|
+
id: `separator-${thisRunningId}`,
|
|
332
|
+
type: 'separator',
|
|
333
|
+
content: 'New Session',
|
|
334
|
+
timestamp: new Date()
|
|
335
|
+
};
|
|
336
|
+
setInfoList((prev)=>[
|
|
337
|
+
...prev,
|
|
338
|
+
separatorItem
|
|
339
|
+
]);
|
|
340
|
+
} catch (error) {
|
|
341
|
+
console.error('Failed to stop execution:', error);
|
|
342
|
+
}
|
|
343
|
+
})(), [
|
|
195
344
|
playgroundSDK,
|
|
196
345
|
currentRunningIdRef,
|
|
197
346
|
interruptedFlagRef,
|
|
198
347
|
setLoading,
|
|
199
|
-
setInfoList
|
|
348
|
+
setInfoList,
|
|
349
|
+
verticalMode,
|
|
350
|
+
replayCounter
|
|
200
351
|
]);
|
|
201
352
|
const canStop = loading && !!currentRunningIdRef.current && !!playgroundSDK && !!playgroundSDK.cancelExecution;
|
|
202
353
|
return {
|
|
@@ -206,9 +357,9 @@ function usePlaygroundExecution(playgroundSDK, storage, actionSpace, loading, se
|
|
|
206
357
|
};
|
|
207
358
|
}
|
|
208
359
|
exports.usePlaygroundExecution = __webpack_exports__.usePlaygroundExecution;
|
|
209
|
-
for(var
|
|
360
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
210
361
|
"usePlaygroundExecution"
|
|
211
|
-
].indexOf(
|
|
362
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
212
363
|
Object.defineProperty(exports, '__esModule', {
|
|
213
364
|
value: true
|
|
214
365
|
});
|