@rpascene/visualizer 0.30.16 → 0.30.17
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/prompt-input/index.mjs +1 -9
- package/dist/es/component/universal-playground/index.mjs +12 -9
- package/dist/es/hooks/usePlaygroundExecution - /345/211/257/346/234/254.mjs" +327 -0
- package/dist/lib/component/prompt-input/index.js +1 -9
- package/dist/lib/component/universal-playground/index.js +12 -9
- package/dist/lib/hooks/usePlaygroundExecution - /345/211/257/346/234/254.js" +361 -0
- package/dist/types/component/universal-playground/index.d.ts +1 -1
- package/dist/types/hooks/usePlaygroundExecution - /345/211/257/346/234/254.d.ts" +15 -0
- package/dist/types/types.d.ts +1 -0
- package/package.json +5 -5
|
@@ -185,15 +185,7 @@ const PromptInput = (param)=>{
|
|
|
185
185
|
useEffect(()=>{
|
|
186
186
|
const lastHistory = historyForSelectedType[0];
|
|
187
187
|
if (lastHistory && lastHistoryRef.current && lastHistory.timestamp === lastHistoryRef.current.timestamp) return;
|
|
188
|
-
|
|
189
|
-
form.setFieldsValue({
|
|
190
|
-
type: lastHistory.type,
|
|
191
|
-
prompt: lastHistory.prompt || '',
|
|
192
|
-
params: lastHistory.params
|
|
193
|
-
});
|
|
194
|
-
setPromptValue(lastHistory.prompt || '');
|
|
195
|
-
lastHistoryRef.current = lastHistory;
|
|
196
|
-
} else {
|
|
188
|
+
{
|
|
197
189
|
const defaultParams = getDefaultParams();
|
|
198
190
|
form.setFieldsValue({
|
|
199
191
|
prompt: '',
|
|
@@ -12,6 +12,7 @@ import { PromptInput } from "../prompt-input/index.mjs";
|
|
|
12
12
|
import { createStorageProvider, detectBestStorageType } from "./providers/storage-provider.mjs";
|
|
13
13
|
import { overrideAIConfig } from "@rpascene/shared/env";
|
|
14
14
|
import { commandMap } from "@rpascene/shared/constants";
|
|
15
|
+
import { useHistoryStore } from "../../store/history.mjs";
|
|
15
16
|
import "./index.css";
|
|
16
17
|
const { Text } = Typography;
|
|
17
18
|
function getSDKId(sdk) {
|
|
@@ -42,11 +43,12 @@ function ErrorMessage(param) {
|
|
|
42
43
|
});
|
|
43
44
|
}
|
|
44
45
|
function UniversalPlayground(param) {
|
|
45
|
-
let { playgroundSDK, storage, contextProvider, config: componentConfig = {}, branding = {}, className = '', dryMode = false, showContextPreview = true, showPromptInput = true, onHumanUse = ()=>{}, showHumanUse = false } = param;
|
|
46
|
+
let { playgroundSDK, storage, contextProvider, config: componentConfig = {}, branding = {}, className = '', dryMode = false, showContextPreview = true, showPromptInput = true, onHumanUse = ()=>{}, showHumanUse = false, defaultSelectedType } = param;
|
|
46
47
|
const [form] = Form.useForm();
|
|
47
48
|
const { config } = useEnvConfig();
|
|
48
49
|
const [sdkReady, setSdkReady] = useState(false);
|
|
49
50
|
const ref = useRef(null);
|
|
51
|
+
const setLastSelectedType = useHistoryStore((state)=>state.setLastSelectedType);
|
|
50
52
|
useEffect(()=>{
|
|
51
53
|
const initializeSDK = async ()=>{
|
|
52
54
|
if (playgroundSDK && 'function' == typeof playgroundSDK.checkStatus) try {
|
|
@@ -85,11 +87,6 @@ function UniversalPlayground(param) {
|
|
|
85
87
|
playgroundSDK,
|
|
86
88
|
config
|
|
87
89
|
]);
|
|
88
|
-
useEffect(()=>{
|
|
89
|
-
form.setFieldValue('type', 'aiTap');
|
|
90
|
-
}, [
|
|
91
|
-
form
|
|
92
|
-
]);
|
|
93
90
|
const handleFormRun = useCallback(async ()=>{
|
|
94
91
|
try {
|
|
95
92
|
const value = form.getFieldsValue();
|
|
@@ -144,6 +141,15 @@ function UniversalPlayground(param) {
|
|
|
144
141
|
canStop,
|
|
145
142
|
handleStop
|
|
146
143
|
]);
|
|
144
|
+
useEffect(()=>{
|
|
145
|
+
if (defaultSelectedType) {
|
|
146
|
+
setLastSelectedType(defaultSelectedType);
|
|
147
|
+
form.setFieldValue('type', defaultSelectedType);
|
|
148
|
+
}
|
|
149
|
+
}, [
|
|
150
|
+
defaultSelectedType,
|
|
151
|
+
setLastSelectedType
|
|
152
|
+
]);
|
|
147
153
|
return /*#__PURE__*/ jsx("div", {
|
|
148
154
|
id: "playground-container",
|
|
149
155
|
className: `playground-container ${layout}-mode ${className}`.trim(),
|
|
@@ -152,9 +158,6 @@ function UniversalPlayground(param) {
|
|
|
152
158
|
form: form,
|
|
153
159
|
onFinish: handleFormRun,
|
|
154
160
|
className: "command-form",
|
|
155
|
-
initialValues: {
|
|
156
|
-
type: 'aiTap'
|
|
157
|
-
},
|
|
158
161
|
children: [
|
|
159
162
|
finalShowContextPreview && /*#__PURE__*/ jsx("div", {
|
|
160
163
|
className: "context-preview-section",
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
import { useCallback, useRef } from "react";
|
|
2
|
+
import { useEnvConfig } from "../store/store.mjs";
|
|
3
|
+
import { noReplayAPIs } from "@rpascene/playground";
|
|
4
|
+
import { BLANK_RESULT } from "../utils/constants.mjs";
|
|
5
|
+
import { allScriptsFromDump } from "../utils/replay-scripts.mjs";
|
|
6
|
+
function _define_property(obj, key, value) {
|
|
7
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
8
|
+
value: value,
|
|
9
|
+
enumerable: true,
|
|
10
|
+
configurable: true,
|
|
11
|
+
writable: true
|
|
12
|
+
});
|
|
13
|
+
else obj[key] = value;
|
|
14
|
+
return obj;
|
|
15
|
+
}
|
|
16
|
+
class TaskNode {
|
|
17
|
+
constructor(taskId, prompt, next = null){
|
|
18
|
+
_define_property(this, "taskId", void 0);
|
|
19
|
+
_define_property(this, "prompt", void 0);
|
|
20
|
+
_define_property(this, "next", void 0);
|
|
21
|
+
_define_property(this, "result", void 0);
|
|
22
|
+
_define_property(this, "status", void 0);
|
|
23
|
+
this.taskId = taskId;
|
|
24
|
+
this.prompt = prompt;
|
|
25
|
+
this.next = next;
|
|
26
|
+
this.result = null;
|
|
27
|
+
this.status = 'pending';
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function usePlaygroundExecution(playgroundSDK, storage, actionSpace, loading, setLoading, infoList, setInfoList, replayCounter, setReplayCounter, verticalMode, currentRunningIdRef, interruptedFlagRef, showHumanUse) {
|
|
31
|
+
const toBeUsedRef = useRef([]);
|
|
32
|
+
const isCancelledRef = useRef(false);
|
|
33
|
+
const currentNodeRef = useRef();
|
|
34
|
+
const { deepThink, screenshotIncluded, domIncluded } = useEnvConfig();
|
|
35
|
+
const setUsedInfoList = ()=>{
|
|
36
|
+
if (toBeUsedRef.current.length > 0) {
|
|
37
|
+
const thisRunningId = Date.now();
|
|
38
|
+
const systemItem = {
|
|
39
|
+
id: `system-${thisRunningId}`,
|
|
40
|
+
type: 'system',
|
|
41
|
+
content: '',
|
|
42
|
+
timestamp: new Date(),
|
|
43
|
+
loading: false,
|
|
44
|
+
loadingProgressText: '',
|
|
45
|
+
actionTasks: toBeUsedRef.current
|
|
46
|
+
};
|
|
47
|
+
setInfoList((prev)=>[
|
|
48
|
+
...prev,
|
|
49
|
+
systemItem
|
|
50
|
+
]);
|
|
51
|
+
toBeUsedRef.current = [];
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
const handleRun = useCallback(async (value)=>{
|
|
55
|
+
console.log(value, "\u5728\u8FD9\u91CC\u5206\u5272value\uFF0C\u4E32\u884C\u6267\u884C\uFF0Cvalue-----------------------");
|
|
56
|
+
if (!playgroundSDK) return void console.warn('PlaygroundSDK is not available');
|
|
57
|
+
const executeTask = async (value)=>{
|
|
58
|
+
var _result_dump_executions_, _result_dump_executions;
|
|
59
|
+
const thisRunningId = Date.now();
|
|
60
|
+
const actionType = value.type;
|
|
61
|
+
const sub = value.prompt || value.params ? value.prompt || JSON.stringify(value.params) : '';
|
|
62
|
+
const displayContent = sub ? `${value.type}: ${sub}` : value.type;
|
|
63
|
+
const userItem = {
|
|
64
|
+
id: `user-${Date.now()}`,
|
|
65
|
+
type: 'user',
|
|
66
|
+
content: displayContent,
|
|
67
|
+
timestamp: new Date()
|
|
68
|
+
};
|
|
69
|
+
setInfoList((prev)=>[
|
|
70
|
+
...prev,
|
|
71
|
+
userItem
|
|
72
|
+
]);
|
|
73
|
+
setLoading(true);
|
|
74
|
+
const result = {
|
|
75
|
+
...BLANK_RESULT
|
|
76
|
+
};
|
|
77
|
+
const systemItem = {
|
|
78
|
+
id: `system-${thisRunningId}`,
|
|
79
|
+
type: 'system',
|
|
80
|
+
content: '',
|
|
81
|
+
timestamp: new Date(),
|
|
82
|
+
loading: true,
|
|
83
|
+
loadingProgressText: ''
|
|
84
|
+
};
|
|
85
|
+
setInfoList((prev)=>[
|
|
86
|
+
...prev,
|
|
87
|
+
systemItem
|
|
88
|
+
]);
|
|
89
|
+
try {
|
|
90
|
+
currentRunningIdRef.current = thisRunningId;
|
|
91
|
+
interruptedFlagRef.current[thisRunningId] = false;
|
|
92
|
+
if (playgroundSDK.onProgressUpdate) playgroundSDK.onProgressUpdate(()=>{});
|
|
93
|
+
if (playgroundSDK.onProgressUpdate) playgroundSDK.onProgressUpdate((tip)=>{
|
|
94
|
+
if (interruptedFlagRef.current[thisRunningId]) return;
|
|
95
|
+
setInfoList((prev)=>{
|
|
96
|
+
const lastItem = prev[prev.length - 1];
|
|
97
|
+
if (lastItem && 'progress' === lastItem.type && lastItem.content === tip) return prev;
|
|
98
|
+
const progressItem = {
|
|
99
|
+
id: `progress-${thisRunningId}-${Date.now()}`,
|
|
100
|
+
type: 'progress',
|
|
101
|
+
content: tip,
|
|
102
|
+
timestamp: new Date()
|
|
103
|
+
};
|
|
104
|
+
return [
|
|
105
|
+
...prev,
|
|
106
|
+
progressItem
|
|
107
|
+
];
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
result.result = await playgroundSDK.executeAction(actionType, value, {
|
|
111
|
+
requestId: thisRunningId.toString(),
|
|
112
|
+
deepThink,
|
|
113
|
+
screenshotIncluded,
|
|
114
|
+
domIncluded
|
|
115
|
+
});
|
|
116
|
+
if ('object' == typeof result.result && null !== result.result) {
|
|
117
|
+
const resultObj = result.result;
|
|
118
|
+
if (resultObj.dump) result.dump = resultObj.dump;
|
|
119
|
+
if (resultObj.reportHTML) result.reportHTML = resultObj.reportHTML;
|
|
120
|
+
if (resultObj.error) result.error = resultObj.error;
|
|
121
|
+
if (void 0 !== resultObj.result) result.result = resultObj.result;
|
|
122
|
+
}
|
|
123
|
+
} catch (e) {
|
|
124
|
+
result.error = (null == e ? void 0 : e.message) || String(e);
|
|
125
|
+
console.error('Playground execution error:', result);
|
|
126
|
+
}
|
|
127
|
+
if (interruptedFlagRef.current[thisRunningId]) return;
|
|
128
|
+
setLoading(false);
|
|
129
|
+
currentRunningIdRef.current = null;
|
|
130
|
+
let replayInfo = null;
|
|
131
|
+
let counter = replayCounter;
|
|
132
|
+
if ((null == result ? void 0 : result.dump) && !noReplayAPIs.includes(actionType)) {
|
|
133
|
+
const info = allScriptsFromDump(result.dump);
|
|
134
|
+
setReplayCounter((c)=>c + 1);
|
|
135
|
+
replayInfo = info;
|
|
136
|
+
counter = replayCounter + 1;
|
|
137
|
+
}
|
|
138
|
+
setInfoList((prev)=>prev.map((item)=>item.id === `system-${thisRunningId}` ? {
|
|
139
|
+
...item,
|
|
140
|
+
content: '',
|
|
141
|
+
loading: false,
|
|
142
|
+
loadingProgressText: ''
|
|
143
|
+
} : item));
|
|
144
|
+
const resultItem = {
|
|
145
|
+
id: `result-${thisRunningId}`,
|
|
146
|
+
type: 'result',
|
|
147
|
+
content: 'Execution result',
|
|
148
|
+
timestamp: new Date(),
|
|
149
|
+
result: result,
|
|
150
|
+
loading: false,
|
|
151
|
+
replayScriptsInfo: replayInfo,
|
|
152
|
+
replayCounter: counter,
|
|
153
|
+
loadingProgressText: '',
|
|
154
|
+
verticalMode: verticalMode
|
|
155
|
+
};
|
|
156
|
+
setInfoList((prev)=>[
|
|
157
|
+
...prev,
|
|
158
|
+
resultItem
|
|
159
|
+
]);
|
|
160
|
+
if (null == storage ? void 0 : storage.saveResult) try {
|
|
161
|
+
await storage.saveResult(resultItem.id, resultItem);
|
|
162
|
+
} catch (error) {
|
|
163
|
+
console.error('Failed to save result:', error);
|
|
164
|
+
}
|
|
165
|
+
if (showHumanUse && result && result.dump && (null == (_result_dump_executions = result.dump.executions) ? void 0 : null == (_result_dump_executions_ = _result_dump_executions[0]) ? void 0 : _result_dump_executions_.tasks)) {
|
|
166
|
+
var _result_dump_executions_1, _result_dump_executions1, _result_dump;
|
|
167
|
+
const tasks = (null == result ? void 0 : null == (_result_dump = result.dump) ? void 0 : null == (_result_dump_executions1 = _result_dump.executions) ? void 0 : null == (_result_dump_executions_1 = _result_dump_executions1[0]) ? void 0 : _result_dump_executions_1.tasks) || [];
|
|
168
|
+
const actionTasks = tasks.map((item, index)=>{
|
|
169
|
+
if ('Action' === item.type) {
|
|
170
|
+
var _tasks__param, _tasks_;
|
|
171
|
+
if ('DragAndDrop' === item.subType) {
|
|
172
|
+
var _tasks__param1, _tasks_1, _tasks__param2, _tasks_2;
|
|
173
|
+
const from = (null == (_tasks_1 = tasks[index - 2]) ? void 0 : null == (_tasks__param1 = _tasks_1.param) ? void 0 : _tasks__param1.prompt) || '';
|
|
174
|
+
const to = (null == (_tasks_2 = tasks[index - 1]) ? void 0 : null == (_tasks__param2 = _tasks_2.param) ? void 0 : _tasks__param2.prompt) || '';
|
|
175
|
+
return {
|
|
176
|
+
...item,
|
|
177
|
+
param: {
|
|
178
|
+
...item.param,
|
|
179
|
+
from: {
|
|
180
|
+
...item.param.from,
|
|
181
|
+
locateDescription: from
|
|
182
|
+
},
|
|
183
|
+
to: {
|
|
184
|
+
...item.param.to,
|
|
185
|
+
locateDescription: to
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
output: {
|
|
189
|
+
...item.output,
|
|
190
|
+
param: {
|
|
191
|
+
...item.output.param,
|
|
192
|
+
from: {
|
|
193
|
+
...item.output.param.from,
|
|
194
|
+
locateDescription: from
|
|
195
|
+
},
|
|
196
|
+
to: {
|
|
197
|
+
...item.output.param.to,
|
|
198
|
+
locateDescription: to
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
return {
|
|
205
|
+
...item,
|
|
206
|
+
locateDescription: (null == (_tasks_ = tasks[index - 1]) ? void 0 : null == (_tasks__param = _tasks_.param) ? void 0 : _tasks__param.prompt) || ''
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
return item;
|
|
210
|
+
});
|
|
211
|
+
toBeUsedRef.current = toBeUsedRef.current.concat(actionTasks.filter((item)=>'Action' === item.type));
|
|
212
|
+
}
|
|
213
|
+
const separatorItem = {
|
|
214
|
+
id: `separator-${thisRunningId}`,
|
|
215
|
+
type: 'separator',
|
|
216
|
+
content: 'New Session',
|
|
217
|
+
timestamp: new Date()
|
|
218
|
+
};
|
|
219
|
+
setInfoList((prev)=>[
|
|
220
|
+
...prev,
|
|
221
|
+
separatorItem
|
|
222
|
+
]);
|
|
223
|
+
return {
|
|
224
|
+
...result,
|
|
225
|
+
reportHTML: null
|
|
226
|
+
};
|
|
227
|
+
};
|
|
228
|
+
if ('aiAction' !== value.type) return await executeTask(value);
|
|
229
|
+
{
|
|
230
|
+
var _value_prompt;
|
|
231
|
+
toBeUsedRef.current = [];
|
|
232
|
+
isCancelledRef.current = false;
|
|
233
|
+
currentNodeRef.current = null;
|
|
234
|
+
const prompts = (null == (_value_prompt = value.prompt) ? void 0 : _value_prompt.split("\n").map((item)=>item.trim()).filter(Boolean)) || [];
|
|
235
|
+
const createTaskList = function() {
|
|
236
|
+
let prompts = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [];
|
|
237
|
+
let head = null;
|
|
238
|
+
let current = null;
|
|
239
|
+
for (let prompt of prompts){
|
|
240
|
+
const taskNode = new TaskNode(Date.now(), prompt, null);
|
|
241
|
+
if (!head) head = taskNode;
|
|
242
|
+
if (current) current.next = taskNode;
|
|
243
|
+
current = taskNode;
|
|
244
|
+
}
|
|
245
|
+
return head;
|
|
246
|
+
};
|
|
247
|
+
const executeTaskList = async (task)=>{
|
|
248
|
+
let current = task;
|
|
249
|
+
while(current && !isCancelledRef.current)try {
|
|
250
|
+
current.status = 'running';
|
|
251
|
+
const value = {
|
|
252
|
+
type: 'aiAction',
|
|
253
|
+
prompt: current.prompt
|
|
254
|
+
};
|
|
255
|
+
const result = await executeTask(value);
|
|
256
|
+
current.result = result;
|
|
257
|
+
current.status = 'completed';
|
|
258
|
+
currentNodeRef.current = current = current.next;
|
|
259
|
+
} catch (error) {
|
|
260
|
+
if (current) current.status = 'error';
|
|
261
|
+
break;
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
const task = createTaskList(prompts);
|
|
265
|
+
await executeTaskList(task);
|
|
266
|
+
setUsedInfoList();
|
|
267
|
+
}
|
|
268
|
+
}, [
|
|
269
|
+
playgroundSDK,
|
|
270
|
+
storage,
|
|
271
|
+
actionSpace,
|
|
272
|
+
setLoading,
|
|
273
|
+
setInfoList,
|
|
274
|
+
replayCounter,
|
|
275
|
+
setReplayCounter,
|
|
276
|
+
verticalMode,
|
|
277
|
+
currentRunningIdRef,
|
|
278
|
+
interruptedFlagRef,
|
|
279
|
+
deepThink,
|
|
280
|
+
screenshotIncluded,
|
|
281
|
+
domIncluded,
|
|
282
|
+
showHumanUse
|
|
283
|
+
]);
|
|
284
|
+
const handleStop = useCallback(async ()=>{
|
|
285
|
+
const thisRunningId = currentRunningIdRef.current;
|
|
286
|
+
if (thisRunningId && playgroundSDK && playgroundSDK.cancelExecution) try {
|
|
287
|
+
isCancelledRef.current = true;
|
|
288
|
+
await playgroundSDK.cancelExecution(thisRunningId.toString());
|
|
289
|
+
interruptedFlagRef.current[thisRunningId] = true;
|
|
290
|
+
if (currentNodeRef.current) currentNodeRef.current.status = 'cancelled';
|
|
291
|
+
setLoading(false);
|
|
292
|
+
if (playgroundSDK.onProgressUpdate) playgroundSDK.onProgressUpdate(()=>{});
|
|
293
|
+
setInfoList((prev)=>prev.map((item)=>item.id === `system-${thisRunningId}` && item.loading ? {
|
|
294
|
+
...item,
|
|
295
|
+
content: 'Operation stopped',
|
|
296
|
+
loading: false,
|
|
297
|
+
loadingProgressText: ''
|
|
298
|
+
} : item));
|
|
299
|
+
const separatorItem = {
|
|
300
|
+
id: `separator-${thisRunningId}`,
|
|
301
|
+
type: 'separator',
|
|
302
|
+
content: 'New Session',
|
|
303
|
+
timestamp: new Date()
|
|
304
|
+
};
|
|
305
|
+
setInfoList((prev)=>[
|
|
306
|
+
...prev,
|
|
307
|
+
separatorItem
|
|
308
|
+
]);
|
|
309
|
+
setUsedInfoList();
|
|
310
|
+
} catch (error) {
|
|
311
|
+
console.error('Failed to stop execution:', error);
|
|
312
|
+
}
|
|
313
|
+
}, [
|
|
314
|
+
playgroundSDK,
|
|
315
|
+
currentRunningIdRef,
|
|
316
|
+
interruptedFlagRef,
|
|
317
|
+
setLoading,
|
|
318
|
+
setInfoList
|
|
319
|
+
]);
|
|
320
|
+
const canStop = loading && !!currentRunningIdRef.current && !!playgroundSDK && !!playgroundSDK.cancelExecution;
|
|
321
|
+
return {
|
|
322
|
+
handleRun,
|
|
323
|
+
handleStop,
|
|
324
|
+
canStop
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
export { usePlaygroundExecution };
|
|
@@ -223,15 +223,7 @@ const PromptInput = (param)=>{
|
|
|
223
223
|
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
224
224
|
const lastHistory = historyForSelectedType[0];
|
|
225
225
|
if (lastHistory && lastHistoryRef.current && lastHistory.timestamp === lastHistoryRef.current.timestamp) return;
|
|
226
|
-
|
|
227
|
-
form.setFieldsValue({
|
|
228
|
-
type: lastHistory.type,
|
|
229
|
-
prompt: lastHistory.prompt || '',
|
|
230
|
-
params: lastHistory.params
|
|
231
|
-
});
|
|
232
|
-
setPromptValue(lastHistory.prompt || '');
|
|
233
|
-
lastHistoryRef.current = lastHistory;
|
|
234
|
-
} else {
|
|
226
|
+
{
|
|
235
227
|
const defaultParams = getDefaultParams();
|
|
236
228
|
form.setFieldsValue({
|
|
237
229
|
prompt: '',
|
|
@@ -52,6 +52,7 @@ const external_prompt_input_index_js_namespaceObject = require("../prompt-input/
|
|
|
52
52
|
const storage_provider_js_namespaceObject = require("./providers/storage-provider.js");
|
|
53
53
|
const env_namespaceObject = require("@rpascene/shared/env");
|
|
54
54
|
const constants_namespaceObject = require("@rpascene/shared/constants");
|
|
55
|
+
const history_js_namespaceObject = require("../../store/history.js");
|
|
55
56
|
require("./index.css");
|
|
56
57
|
const { Text } = external_antd_namespaceObject.Typography;
|
|
57
58
|
function getSDKId(sdk) {
|
|
@@ -82,11 +83,12 @@ function ErrorMessage(param) {
|
|
|
82
83
|
});
|
|
83
84
|
}
|
|
84
85
|
function UniversalPlayground(param) {
|
|
85
|
-
let { playgroundSDK, storage, contextProvider, config: componentConfig = {}, branding = {}, className = '', dryMode = false, showContextPreview = true, showPromptInput = true, onHumanUse = ()=>{}, showHumanUse = false } = param;
|
|
86
|
+
let { playgroundSDK, storage, contextProvider, config: componentConfig = {}, branding = {}, className = '', dryMode = false, showContextPreview = true, showPromptInput = true, onHumanUse = ()=>{}, showHumanUse = false, defaultSelectedType } = param;
|
|
86
87
|
const [form] = external_antd_namespaceObject.Form.useForm();
|
|
87
88
|
const { config } = (0, store_js_namespaceObject.useEnvConfig)();
|
|
88
89
|
const [sdkReady, setSdkReady] = (0, external_react_namespaceObject.useState)(false);
|
|
89
90
|
const ref = (0, external_react_namespaceObject.useRef)(null);
|
|
91
|
+
const setLastSelectedType = (0, history_js_namespaceObject.useHistoryStore)((state)=>state.setLastSelectedType);
|
|
90
92
|
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
91
93
|
const initializeSDK = async ()=>{
|
|
92
94
|
if (playgroundSDK && 'function' == typeof playgroundSDK.checkStatus) try {
|
|
@@ -125,11 +127,6 @@ function UniversalPlayground(param) {
|
|
|
125
127
|
playgroundSDK,
|
|
126
128
|
config
|
|
127
129
|
]);
|
|
128
|
-
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
129
|
-
form.setFieldValue('type', 'aiTap');
|
|
130
|
-
}, [
|
|
131
|
-
form
|
|
132
|
-
]);
|
|
133
130
|
const handleFormRun = (0, external_react_namespaceObject.useCallback)(async ()=>{
|
|
134
131
|
try {
|
|
135
132
|
const value = form.getFieldsValue();
|
|
@@ -184,6 +181,15 @@ function UniversalPlayground(param) {
|
|
|
184
181
|
canStop,
|
|
185
182
|
handleStop
|
|
186
183
|
]);
|
|
184
|
+
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
185
|
+
if (defaultSelectedType) {
|
|
186
|
+
setLastSelectedType(defaultSelectedType);
|
|
187
|
+
form.setFieldValue('type', defaultSelectedType);
|
|
188
|
+
}
|
|
189
|
+
}, [
|
|
190
|
+
defaultSelectedType,
|
|
191
|
+
setLastSelectedType
|
|
192
|
+
]);
|
|
187
193
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
188
194
|
id: "playground-container",
|
|
189
195
|
className: `playground-container ${layout}-mode ${className}`.trim(),
|
|
@@ -192,9 +198,6 @@ function UniversalPlayground(param) {
|
|
|
192
198
|
form: form,
|
|
193
199
|
onFinish: handleFormRun,
|
|
194
200
|
className: "command-form",
|
|
195
|
-
initialValues: {
|
|
196
|
-
type: 'aiTap'
|
|
197
|
-
},
|
|
198
201
|
children: [
|
|
199
202
|
finalShowContextPreview && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
200
203
|
className: "context-preview-section",
|
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
usePlaygroundExecution: ()=>usePlaygroundExecution
|
|
28
|
+
});
|
|
29
|
+
const external_react_namespaceObject = require("react");
|
|
30
|
+
const store_js_namespaceObject = require("../store/store.js");
|
|
31
|
+
const playground_namespaceObject = require("@rpascene/playground");
|
|
32
|
+
const constants_js_namespaceObject = require("../utils/constants.js");
|
|
33
|
+
const replay_scripts_js_namespaceObject = require("../utils/replay-scripts.js");
|
|
34
|
+
function _define_property(obj, key, value) {
|
|
35
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
36
|
+
value: value,
|
|
37
|
+
enumerable: true,
|
|
38
|
+
configurable: true,
|
|
39
|
+
writable: true
|
|
40
|
+
});
|
|
41
|
+
else obj[key] = value;
|
|
42
|
+
return obj;
|
|
43
|
+
}
|
|
44
|
+
class TaskNode {
|
|
45
|
+
constructor(taskId, prompt, next = null){
|
|
46
|
+
_define_property(this, "taskId", void 0);
|
|
47
|
+
_define_property(this, "prompt", void 0);
|
|
48
|
+
_define_property(this, "next", void 0);
|
|
49
|
+
_define_property(this, "result", void 0);
|
|
50
|
+
_define_property(this, "status", void 0);
|
|
51
|
+
this.taskId = taskId;
|
|
52
|
+
this.prompt = prompt;
|
|
53
|
+
this.next = next;
|
|
54
|
+
this.result = null;
|
|
55
|
+
this.status = 'pending';
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function usePlaygroundExecution(playgroundSDK, storage, actionSpace, loading, setLoading, infoList, setInfoList, replayCounter, setReplayCounter, verticalMode, currentRunningIdRef, interruptedFlagRef, showHumanUse) {
|
|
59
|
+
const toBeUsedRef = (0, external_react_namespaceObject.useRef)([]);
|
|
60
|
+
const isCancelledRef = (0, external_react_namespaceObject.useRef)(false);
|
|
61
|
+
const currentNodeRef = (0, external_react_namespaceObject.useRef)();
|
|
62
|
+
const { deepThink, screenshotIncluded, domIncluded } = (0, store_js_namespaceObject.useEnvConfig)();
|
|
63
|
+
const setUsedInfoList = ()=>{
|
|
64
|
+
if (toBeUsedRef.current.length > 0) {
|
|
65
|
+
const thisRunningId = Date.now();
|
|
66
|
+
const systemItem = {
|
|
67
|
+
id: `system-${thisRunningId}`,
|
|
68
|
+
type: 'system',
|
|
69
|
+
content: '',
|
|
70
|
+
timestamp: new Date(),
|
|
71
|
+
loading: false,
|
|
72
|
+
loadingProgressText: '',
|
|
73
|
+
actionTasks: toBeUsedRef.current
|
|
74
|
+
};
|
|
75
|
+
setInfoList((prev)=>[
|
|
76
|
+
...prev,
|
|
77
|
+
systemItem
|
|
78
|
+
]);
|
|
79
|
+
toBeUsedRef.current = [];
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
const handleRun = (0, external_react_namespaceObject.useCallback)(async (value)=>{
|
|
83
|
+
console.log(value, "\u5728\u8FD9\u91CC\u5206\u5272value\uFF0C\u4E32\u884C\u6267\u884C\uFF0Cvalue-----------------------");
|
|
84
|
+
if (!playgroundSDK) return void console.warn('PlaygroundSDK is not available');
|
|
85
|
+
const executeTask = async (value)=>{
|
|
86
|
+
var _result_dump_executions_, _result_dump_executions;
|
|
87
|
+
const thisRunningId = Date.now();
|
|
88
|
+
const actionType = value.type;
|
|
89
|
+
const sub = value.prompt || value.params ? value.prompt || JSON.stringify(value.params) : '';
|
|
90
|
+
const displayContent = sub ? `${value.type}: ${sub}` : value.type;
|
|
91
|
+
const userItem = {
|
|
92
|
+
id: `user-${Date.now()}`,
|
|
93
|
+
type: 'user',
|
|
94
|
+
content: displayContent,
|
|
95
|
+
timestamp: new Date()
|
|
96
|
+
};
|
|
97
|
+
setInfoList((prev)=>[
|
|
98
|
+
...prev,
|
|
99
|
+
userItem
|
|
100
|
+
]);
|
|
101
|
+
setLoading(true);
|
|
102
|
+
const result = {
|
|
103
|
+
...constants_js_namespaceObject.BLANK_RESULT
|
|
104
|
+
};
|
|
105
|
+
const systemItem = {
|
|
106
|
+
id: `system-${thisRunningId}`,
|
|
107
|
+
type: 'system',
|
|
108
|
+
content: '',
|
|
109
|
+
timestamp: new Date(),
|
|
110
|
+
loading: true,
|
|
111
|
+
loadingProgressText: ''
|
|
112
|
+
};
|
|
113
|
+
setInfoList((prev)=>[
|
|
114
|
+
...prev,
|
|
115
|
+
systemItem
|
|
116
|
+
]);
|
|
117
|
+
try {
|
|
118
|
+
currentRunningIdRef.current = thisRunningId;
|
|
119
|
+
interruptedFlagRef.current[thisRunningId] = false;
|
|
120
|
+
if (playgroundSDK.onProgressUpdate) playgroundSDK.onProgressUpdate(()=>{});
|
|
121
|
+
if (playgroundSDK.onProgressUpdate) playgroundSDK.onProgressUpdate((tip)=>{
|
|
122
|
+
if (interruptedFlagRef.current[thisRunningId]) return;
|
|
123
|
+
setInfoList((prev)=>{
|
|
124
|
+
const lastItem = prev[prev.length - 1];
|
|
125
|
+
if (lastItem && 'progress' === lastItem.type && lastItem.content === tip) return prev;
|
|
126
|
+
const progressItem = {
|
|
127
|
+
id: `progress-${thisRunningId}-${Date.now()}`,
|
|
128
|
+
type: 'progress',
|
|
129
|
+
content: tip,
|
|
130
|
+
timestamp: new Date()
|
|
131
|
+
};
|
|
132
|
+
return [
|
|
133
|
+
...prev,
|
|
134
|
+
progressItem
|
|
135
|
+
];
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
result.result = await playgroundSDK.executeAction(actionType, value, {
|
|
139
|
+
requestId: thisRunningId.toString(),
|
|
140
|
+
deepThink,
|
|
141
|
+
screenshotIncluded,
|
|
142
|
+
domIncluded
|
|
143
|
+
});
|
|
144
|
+
if ('object' == typeof result.result && null !== result.result) {
|
|
145
|
+
const resultObj = result.result;
|
|
146
|
+
if (resultObj.dump) result.dump = resultObj.dump;
|
|
147
|
+
if (resultObj.reportHTML) result.reportHTML = resultObj.reportHTML;
|
|
148
|
+
if (resultObj.error) result.error = resultObj.error;
|
|
149
|
+
if (void 0 !== resultObj.result) result.result = resultObj.result;
|
|
150
|
+
}
|
|
151
|
+
} catch (e) {
|
|
152
|
+
result.error = (null == e ? void 0 : e.message) || String(e);
|
|
153
|
+
console.error('Playground execution error:', result);
|
|
154
|
+
}
|
|
155
|
+
if (interruptedFlagRef.current[thisRunningId]) return;
|
|
156
|
+
setLoading(false);
|
|
157
|
+
currentRunningIdRef.current = null;
|
|
158
|
+
let replayInfo = null;
|
|
159
|
+
let counter = replayCounter;
|
|
160
|
+
if ((null == result ? void 0 : result.dump) && !playground_namespaceObject.noReplayAPIs.includes(actionType)) {
|
|
161
|
+
const info = (0, replay_scripts_js_namespaceObject.allScriptsFromDump)(result.dump);
|
|
162
|
+
setReplayCounter((c)=>c + 1);
|
|
163
|
+
replayInfo = info;
|
|
164
|
+
counter = replayCounter + 1;
|
|
165
|
+
}
|
|
166
|
+
setInfoList((prev)=>prev.map((item)=>item.id === `system-${thisRunningId}` ? {
|
|
167
|
+
...item,
|
|
168
|
+
content: '',
|
|
169
|
+
loading: false,
|
|
170
|
+
loadingProgressText: ''
|
|
171
|
+
} : item));
|
|
172
|
+
const resultItem = {
|
|
173
|
+
id: `result-${thisRunningId}`,
|
|
174
|
+
type: 'result',
|
|
175
|
+
content: 'Execution result',
|
|
176
|
+
timestamp: new Date(),
|
|
177
|
+
result: result,
|
|
178
|
+
loading: false,
|
|
179
|
+
replayScriptsInfo: replayInfo,
|
|
180
|
+
replayCounter: counter,
|
|
181
|
+
loadingProgressText: '',
|
|
182
|
+
verticalMode: verticalMode
|
|
183
|
+
};
|
|
184
|
+
setInfoList((prev)=>[
|
|
185
|
+
...prev,
|
|
186
|
+
resultItem
|
|
187
|
+
]);
|
|
188
|
+
if (null == storage ? void 0 : storage.saveResult) try {
|
|
189
|
+
await storage.saveResult(resultItem.id, resultItem);
|
|
190
|
+
} catch (error) {
|
|
191
|
+
console.error('Failed to save result:', error);
|
|
192
|
+
}
|
|
193
|
+
if (showHumanUse && result && result.dump && (null == (_result_dump_executions = result.dump.executions) ? void 0 : null == (_result_dump_executions_ = _result_dump_executions[0]) ? void 0 : _result_dump_executions_.tasks)) {
|
|
194
|
+
var _result_dump_executions_1, _result_dump_executions1, _result_dump;
|
|
195
|
+
const tasks = (null == result ? void 0 : null == (_result_dump = result.dump) ? void 0 : null == (_result_dump_executions1 = _result_dump.executions) ? void 0 : null == (_result_dump_executions_1 = _result_dump_executions1[0]) ? void 0 : _result_dump_executions_1.tasks) || [];
|
|
196
|
+
const actionTasks = tasks.map((item, index)=>{
|
|
197
|
+
if ('Action' === item.type) {
|
|
198
|
+
var _tasks__param, _tasks_;
|
|
199
|
+
if ('DragAndDrop' === item.subType) {
|
|
200
|
+
var _tasks__param1, _tasks_1, _tasks__param2, _tasks_2;
|
|
201
|
+
const from = (null == (_tasks_1 = tasks[index - 2]) ? void 0 : null == (_tasks__param1 = _tasks_1.param) ? void 0 : _tasks__param1.prompt) || '';
|
|
202
|
+
const to = (null == (_tasks_2 = tasks[index - 1]) ? void 0 : null == (_tasks__param2 = _tasks_2.param) ? void 0 : _tasks__param2.prompt) || '';
|
|
203
|
+
return {
|
|
204
|
+
...item,
|
|
205
|
+
param: {
|
|
206
|
+
...item.param,
|
|
207
|
+
from: {
|
|
208
|
+
...item.param.from,
|
|
209
|
+
locateDescription: from
|
|
210
|
+
},
|
|
211
|
+
to: {
|
|
212
|
+
...item.param.to,
|
|
213
|
+
locateDescription: to
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
output: {
|
|
217
|
+
...item.output,
|
|
218
|
+
param: {
|
|
219
|
+
...item.output.param,
|
|
220
|
+
from: {
|
|
221
|
+
...item.output.param.from,
|
|
222
|
+
locateDescription: from
|
|
223
|
+
},
|
|
224
|
+
to: {
|
|
225
|
+
...item.output.param.to,
|
|
226
|
+
locateDescription: to
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
return {
|
|
233
|
+
...item,
|
|
234
|
+
locateDescription: (null == (_tasks_ = tasks[index - 1]) ? void 0 : null == (_tasks__param = _tasks_.param) ? void 0 : _tasks__param.prompt) || ''
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
return item;
|
|
238
|
+
});
|
|
239
|
+
toBeUsedRef.current = toBeUsedRef.current.concat(actionTasks.filter((item)=>'Action' === item.type));
|
|
240
|
+
}
|
|
241
|
+
const separatorItem = {
|
|
242
|
+
id: `separator-${thisRunningId}`,
|
|
243
|
+
type: 'separator',
|
|
244
|
+
content: 'New Session',
|
|
245
|
+
timestamp: new Date()
|
|
246
|
+
};
|
|
247
|
+
setInfoList((prev)=>[
|
|
248
|
+
...prev,
|
|
249
|
+
separatorItem
|
|
250
|
+
]);
|
|
251
|
+
return {
|
|
252
|
+
...result,
|
|
253
|
+
reportHTML: null
|
|
254
|
+
};
|
|
255
|
+
};
|
|
256
|
+
if ('aiAction' !== value.type) return await executeTask(value);
|
|
257
|
+
{
|
|
258
|
+
var _value_prompt;
|
|
259
|
+
toBeUsedRef.current = [];
|
|
260
|
+
isCancelledRef.current = false;
|
|
261
|
+
currentNodeRef.current = null;
|
|
262
|
+
const prompts = (null == (_value_prompt = value.prompt) ? void 0 : _value_prompt.split("\n").map((item)=>item.trim()).filter(Boolean)) || [];
|
|
263
|
+
const createTaskList = function() {
|
|
264
|
+
let prompts = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : [];
|
|
265
|
+
let head = null;
|
|
266
|
+
let current = null;
|
|
267
|
+
for (let prompt of prompts){
|
|
268
|
+
const taskNode = new TaskNode(Date.now(), prompt, null);
|
|
269
|
+
if (!head) head = taskNode;
|
|
270
|
+
if (current) current.next = taskNode;
|
|
271
|
+
current = taskNode;
|
|
272
|
+
}
|
|
273
|
+
return head;
|
|
274
|
+
};
|
|
275
|
+
const executeTaskList = async (task)=>{
|
|
276
|
+
let current = task;
|
|
277
|
+
while(current && !isCancelledRef.current)try {
|
|
278
|
+
current.status = 'running';
|
|
279
|
+
const value = {
|
|
280
|
+
type: 'aiAction',
|
|
281
|
+
prompt: current.prompt
|
|
282
|
+
};
|
|
283
|
+
const result = await executeTask(value);
|
|
284
|
+
current.result = result;
|
|
285
|
+
current.status = 'completed';
|
|
286
|
+
currentNodeRef.current = current = current.next;
|
|
287
|
+
} catch (error) {
|
|
288
|
+
if (current) current.status = 'error';
|
|
289
|
+
break;
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
const task = createTaskList(prompts);
|
|
293
|
+
await executeTaskList(task);
|
|
294
|
+
setUsedInfoList();
|
|
295
|
+
}
|
|
296
|
+
}, [
|
|
297
|
+
playgroundSDK,
|
|
298
|
+
storage,
|
|
299
|
+
actionSpace,
|
|
300
|
+
setLoading,
|
|
301
|
+
setInfoList,
|
|
302
|
+
replayCounter,
|
|
303
|
+
setReplayCounter,
|
|
304
|
+
verticalMode,
|
|
305
|
+
currentRunningIdRef,
|
|
306
|
+
interruptedFlagRef,
|
|
307
|
+
deepThink,
|
|
308
|
+
screenshotIncluded,
|
|
309
|
+
domIncluded,
|
|
310
|
+
showHumanUse
|
|
311
|
+
]);
|
|
312
|
+
const handleStop = (0, external_react_namespaceObject.useCallback)(async ()=>{
|
|
313
|
+
const thisRunningId = currentRunningIdRef.current;
|
|
314
|
+
if (thisRunningId && playgroundSDK && playgroundSDK.cancelExecution) try {
|
|
315
|
+
isCancelledRef.current = true;
|
|
316
|
+
await playgroundSDK.cancelExecution(thisRunningId.toString());
|
|
317
|
+
interruptedFlagRef.current[thisRunningId] = true;
|
|
318
|
+
if (currentNodeRef.current) currentNodeRef.current.status = 'cancelled';
|
|
319
|
+
setLoading(false);
|
|
320
|
+
if (playgroundSDK.onProgressUpdate) playgroundSDK.onProgressUpdate(()=>{});
|
|
321
|
+
setInfoList((prev)=>prev.map((item)=>item.id === `system-${thisRunningId}` && item.loading ? {
|
|
322
|
+
...item,
|
|
323
|
+
content: 'Operation stopped',
|
|
324
|
+
loading: false,
|
|
325
|
+
loadingProgressText: ''
|
|
326
|
+
} : item));
|
|
327
|
+
const separatorItem = {
|
|
328
|
+
id: `separator-${thisRunningId}`,
|
|
329
|
+
type: 'separator',
|
|
330
|
+
content: 'New Session',
|
|
331
|
+
timestamp: new Date()
|
|
332
|
+
};
|
|
333
|
+
setInfoList((prev)=>[
|
|
334
|
+
...prev,
|
|
335
|
+
separatorItem
|
|
336
|
+
]);
|
|
337
|
+
setUsedInfoList();
|
|
338
|
+
} catch (error) {
|
|
339
|
+
console.error('Failed to stop execution:', error);
|
|
340
|
+
}
|
|
341
|
+
}, [
|
|
342
|
+
playgroundSDK,
|
|
343
|
+
currentRunningIdRef,
|
|
344
|
+
interruptedFlagRef,
|
|
345
|
+
setLoading,
|
|
346
|
+
setInfoList
|
|
347
|
+
]);
|
|
348
|
+
const canStop = loading && !!currentRunningIdRef.current && !!playgroundSDK && !!playgroundSDK.cancelExecution;
|
|
349
|
+
return {
|
|
350
|
+
handleRun,
|
|
351
|
+
handleStop,
|
|
352
|
+
canStop
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
exports.usePlaygroundExecution = __webpack_exports__.usePlaygroundExecution;
|
|
356
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
357
|
+
"usePlaygroundExecution"
|
|
358
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
359
|
+
Object.defineProperty(exports, '__esModule', {
|
|
360
|
+
value: true
|
|
361
|
+
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { UniversalPlaygroundProps } from '../../types';
|
|
2
2
|
import './index.less';
|
|
3
|
-
export declare function UniversalPlayground({ playgroundSDK, storage, contextProvider, config: componentConfig, branding, className, dryMode, showContextPreview, showPromptInput, onHumanUse, showHumanUse }: UniversalPlaygroundProps): import("react").JSX.Element;
|
|
3
|
+
export declare function UniversalPlayground({ playgroundSDK, storage, contextProvider, config: componentConfig, branding, className, dryMode, showContextPreview, showPromptInput, onHumanUse, showHumanUse, defaultSelectedType }: UniversalPlaygroundProps): import("react").JSX.Element;
|
|
4
4
|
export default UniversalPlayground;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { DeviceAction } from '@rpascene/core';
|
|
2
|
+
import type { FormValue, InfoListItem, PlaygroundSDKLike, StorageProvider } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Hook for handling playground execution logic
|
|
5
|
+
*/
|
|
6
|
+
export declare function usePlaygroundExecution(playgroundSDK: PlaygroundSDKLike | null, storage: StorageProvider | undefined | null, actionSpace: DeviceAction<unknown>[], loading: boolean, setLoading: (loading: boolean) => void, infoList: InfoListItem[], setInfoList: React.Dispatch<React.SetStateAction<InfoListItem[]>>, replayCounter: number, setReplayCounter: React.Dispatch<React.SetStateAction<number>>, verticalMode: boolean, currentRunningIdRef: React.MutableRefObject<number | null>, interruptedFlagRef: React.MutableRefObject<Record<number, boolean>>, showHumanUse: boolean): {
|
|
7
|
+
handleRun: (value: FormValue) => Promise<{
|
|
8
|
+
reportHTML: null;
|
|
9
|
+
result: any;
|
|
10
|
+
dump?: import("@rpascene/core").GroupedActionDump | null;
|
|
11
|
+
error: string | null;
|
|
12
|
+
} | undefined>;
|
|
13
|
+
handleStop: () => Promise<void>;
|
|
14
|
+
canStop: boolean;
|
|
15
|
+
};
|
package/dist/types/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rpascene/visualizer",
|
|
3
|
-
"version": "0.30.
|
|
3
|
+
"version": "0.30.17",
|
|
4
4
|
"description": "RPA visualizer",
|
|
5
5
|
"repository": "",
|
|
6
6
|
"homepage": "",
|
|
@@ -72,10 +72,10 @@
|
|
|
72
72
|
"antd": "^5.21.6",
|
|
73
73
|
"buffer": "6.0.3",
|
|
74
74
|
"dayjs": "^1.11.11",
|
|
75
|
-
"@rpascene/
|
|
76
|
-
"@rpascene/web": "0.30.
|
|
77
|
-
"@rpascene/
|
|
78
|
-
"@rpascene/
|
|
75
|
+
"@rpascene/core": "0.30.17",
|
|
76
|
+
"@rpascene/web": "0.30.17",
|
|
77
|
+
"@rpascene/playground": "0.30.17",
|
|
78
|
+
"@rpascene/shared": "0.30.17"
|
|
79
79
|
},
|
|
80
80
|
"license": "MIT",
|
|
81
81
|
"scripts": {
|