@midscene/visualizer 0.30.9 → 0.30.11-beta-20251218071621.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
|
@@ -50,49 +50,79 @@ const external_playground_result_index_js_namespaceObject = require("../playgrou
|
|
|
50
50
|
require("./index.css");
|
|
51
51
|
const avatar_js_namespaceObject = require("../../icons/avatar.js");
|
|
52
52
|
var avatar_js_default = /*#__PURE__*/ __webpack_require__.n(avatar_js_namespaceObject);
|
|
53
|
+
const constants_js_namespaceObject = require("../../utils/constants.js");
|
|
53
54
|
const external_prompt_input_index_js_namespaceObject = require("../prompt-input/index.js");
|
|
55
|
+
const external_shiny_text_index_js_namespaceObject = require("../shiny-text/index.js");
|
|
56
|
+
var external_shiny_text_index_js_default = /*#__PURE__*/ __webpack_require__.n(external_shiny_text_index_js_namespaceObject);
|
|
54
57
|
const storage_provider_js_namespaceObject = require("./providers/storage-provider.js");
|
|
58
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
59
|
+
try {
|
|
60
|
+
var info = gen[key](arg);
|
|
61
|
+
var value = info.value;
|
|
62
|
+
} catch (error) {
|
|
63
|
+
reject(error);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (info.done) resolve(value);
|
|
67
|
+
else Promise.resolve(value).then(_next, _throw);
|
|
68
|
+
}
|
|
69
|
+
function _async_to_generator(fn) {
|
|
70
|
+
return function() {
|
|
71
|
+
var self = this, args = arguments;
|
|
72
|
+
return new Promise(function(resolve, reject) {
|
|
73
|
+
var gen = fn.apply(self, args);
|
|
74
|
+
function _next(value) {
|
|
75
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
76
|
+
}
|
|
77
|
+
function _throw(err) {
|
|
78
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
79
|
+
}
|
|
80
|
+
_next(void 0);
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
}
|
|
55
84
|
const { Text } = external_antd_namespaceObject.Typography;
|
|
56
85
|
function getSDKId(sdk) {
|
|
86
|
+
if (!sdk) return 'playground-default';
|
|
57
87
|
if (sdk.id && 'string' == typeof sdk.id) return `agent-${sdk.id}`;
|
|
58
88
|
return 'playground-default';
|
|
59
89
|
}
|
|
60
|
-
function ErrorMessage(
|
|
61
|
-
let { error } = param;
|
|
90
|
+
function ErrorMessage({ error }) {
|
|
62
91
|
if (!error) return null;
|
|
63
|
-
|
|
64
|
-
|
|
92
|
+
const cleanError = error.replace(/^(Error:\s*)+/, 'Error: ');
|
|
93
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Alert, {
|
|
94
|
+
message: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
65
95
|
style: {
|
|
66
|
-
|
|
67
|
-
wordBreak: 'break-all'
|
|
96
|
+
color: '#ff4d4f'
|
|
68
97
|
},
|
|
69
|
-
children:
|
|
98
|
+
children: cleanError
|
|
70
99
|
}),
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
},
|
|
74
|
-
children: [
|
|
75
|
-
"Error: ",
|
|
76
|
-
error.split('\n')[0]
|
|
77
|
-
]
|
|
100
|
+
type: "error",
|
|
101
|
+
showIcon: true
|
|
78
102
|
});
|
|
79
103
|
}
|
|
80
|
-
function UniversalPlayground(
|
|
81
|
-
let { playgroundSDK, storage, contextProvider, config: componentConfig = {}, branding = {}, className = '', dryMode = false, showContextPreview = true } = param;
|
|
104
|
+
function UniversalPlayground({ playgroundSDK, storage, contextProvider, config: componentConfig = {}, branding = {}, className = '', dryMode = false, showContextPreview = true }) {
|
|
82
105
|
const [form] = external_antd_namespaceObject.Form.useForm();
|
|
83
106
|
const { config } = (0, store_js_namespaceObject.useEnvConfig)();
|
|
84
107
|
const [sdkReady, setSdkReady] = (0, external_react_namespaceObject.useState)(false);
|
|
85
108
|
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
109
|
+
form.setFieldsValue({
|
|
110
|
+
type: constants_js_namespaceObject.defaultMainButtons["0"]
|
|
111
|
+
});
|
|
112
|
+
}, [
|
|
113
|
+
form
|
|
114
|
+
]);
|
|
115
|
+
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
116
|
+
const initializeSDK = ()=>_async_to_generator(function*() {
|
|
117
|
+
if (playgroundSDK && 'function' == typeof playgroundSDK.checkStatus) try {
|
|
118
|
+
yield playgroundSDK.checkStatus();
|
|
119
|
+
setSdkReady(true);
|
|
120
|
+
} catch (error) {
|
|
121
|
+
console.warn('Failed to initialize SDK, using default namespace:', error);
|
|
122
|
+
setSdkReady(true);
|
|
123
|
+
}
|
|
124
|
+
else setSdkReady(true);
|
|
125
|
+
})();
|
|
96
126
|
initializeSDK();
|
|
97
127
|
}, [
|
|
98
128
|
playgroundSDK
|
|
@@ -111,7 +141,7 @@ function UniversalPlayground(param) {
|
|
|
111
141
|
playgroundSDK
|
|
112
142
|
]);
|
|
113
143
|
const { loading, setLoading, infoList, setInfoList, actionSpace, actionSpaceLoading, uiContextPreview, setUiContextPreview, showScrollToBottomButton, verticalMode, replayCounter, setReplayCounter, infoListRef, currentRunningIdRef, interruptedFlagRef, clearInfoList, handleScrollToBottom } = (0, usePlaygroundState_js_namespaceObject.usePlaygroundState)(playgroundSDK, effectiveStorage, contextProvider);
|
|
114
|
-
const { handleRun: executeAction, handleStop, canStop } = (0, usePlaygroundExecution_js_namespaceObject.usePlaygroundExecution)(playgroundSDK, effectiveStorage, actionSpace, loading, setLoading,
|
|
144
|
+
const { handleRun: executeAction, handleStop, canStop } = (0, usePlaygroundExecution_js_namespaceObject.usePlaygroundExecution)(playgroundSDK, effectiveStorage, actionSpace, loading, setLoading, setInfoList, replayCounter, setReplayCounter, verticalMode, currentRunningIdRef, interruptedFlagRef);
|
|
115
145
|
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
116
146
|
if ((null == playgroundSDK ? void 0 : playgroundSDK.overrideConfig) && config) playgroundSDK.overrideConfig(config).catch((error)=>{
|
|
117
147
|
console.error('Failed to override SDK config:', error);
|
|
@@ -120,23 +150,30 @@ function UniversalPlayground(param) {
|
|
|
120
150
|
playgroundSDK,
|
|
121
151
|
config
|
|
122
152
|
]);
|
|
123
|
-
const handleFormRun = (0, external_react_namespaceObject.useCallback)(
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
153
|
+
const handleFormRun = (0, external_react_namespaceObject.useCallback)(()=>_async_to_generator(function*() {
|
|
154
|
+
try {
|
|
155
|
+
const value = form.getFieldsValue();
|
|
156
|
+
yield executeAction(value);
|
|
157
|
+
} catch (error) {
|
|
158
|
+
external_antd_namespaceObject.message.error((null == error ? void 0 : error.message) || 'Execution failed');
|
|
159
|
+
}
|
|
160
|
+
})(), [
|
|
131
161
|
form,
|
|
132
162
|
executeAction
|
|
133
163
|
]);
|
|
134
164
|
const configAlreadySet = Object.keys(config || {}).length >= 1;
|
|
135
165
|
const runButtonEnabled = componentConfig.serverMode || !dryMode && !actionSpaceLoading && configAlreadySet;
|
|
136
166
|
const selectedType = external_antd_namespaceObject.Form.useWatch('type', form);
|
|
167
|
+
const serviceMode = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
168
|
+
if (!playgroundSDK || 'function' != typeof playgroundSDK.getServiceMode) return 'Server';
|
|
169
|
+
return playgroundSDK.getServiceMode();
|
|
170
|
+
}, [
|
|
171
|
+
playgroundSDK
|
|
172
|
+
]);
|
|
137
173
|
const finalShowContextPreview = showContextPreview && false !== componentConfig.showContextPreview;
|
|
138
174
|
const layout = componentConfig.layout || 'vertical';
|
|
139
175
|
const showVersionInfo = false !== componentConfig.showVersionInfo;
|
|
176
|
+
const deviceType = componentConfig.deviceType;
|
|
140
177
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
141
178
|
className: `playground-container ${layout}-mode ${className}`.trim(),
|
|
142
179
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_antd_namespaceObject.Form, {
|
|
@@ -171,9 +208,7 @@ function UniversalPlayground(param) {
|
|
|
171
208
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.List, {
|
|
172
209
|
itemLayout: "vertical",
|
|
173
210
|
dataSource: infoList,
|
|
174
|
-
renderItem: (item)
|
|
175
|
-
var _item_result;
|
|
176
|
-
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.List.Item, {
|
|
211
|
+
renderItem: (item)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.List.Item, {
|
|
177
212
|
className: "list-item",
|
|
178
213
|
children: 'user' === item.type ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
179
214
|
className: "user-message-container",
|
|
@@ -201,14 +236,15 @@ function UniversalPlayground(param) {
|
|
|
201
236
|
className: `progress-status-icon ${shouldShowLoading ? 'loading' : (null == (_item_result = item.result) ? void 0 : _item_result.error) ? 'error' : 'completed'}`,
|
|
202
237
|
children: shouldShowLoading ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icons_namespaceObject.LoadingOutlined, {
|
|
203
238
|
spin: true
|
|
204
|
-
}) : (null == (_item_result1 = item.result) ? void 0 : _item_result1.error) ?
|
|
239
|
+
}) : (null == (_item_result1 = item.result) ? void 0 : _item_result1.error) ? '✗' : '✓'
|
|
205
240
|
})
|
|
206
241
|
]
|
|
207
242
|
}),
|
|
208
243
|
description && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
209
|
-
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(
|
|
244
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_shiny_text_index_js_default(), {
|
|
245
|
+
text: description,
|
|
210
246
|
className: "progress-description",
|
|
211
|
-
|
|
247
|
+
disabled: !shouldShowLoading
|
|
212
248
|
})
|
|
213
249
|
}),
|
|
214
250
|
(null == (_item_result2 = item.result) ? void 0 : _item_result2.error) && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(ErrorMessage, {
|
|
@@ -250,50 +286,37 @@ function UniversalPlayground(param) {
|
|
|
250
286
|
})
|
|
251
287
|
]
|
|
252
288
|
}),
|
|
253
|
-
(item.content || item.result) && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.
|
|
289
|
+
(item.content || item.result) && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
254
290
|
className: "system-message-content",
|
|
255
|
-
children:
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
fitMode: "width"
|
|
277
|
-
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
278
|
-
children: [
|
|
279
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
280
|
-
className: "system-message-text",
|
|
281
|
-
children: item.content
|
|
282
|
-
}),
|
|
283
|
-
item.loading && item.loadingProgressText && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
284
|
-
className: "loading-progress-text",
|
|
285
|
-
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
286
|
-
children: item.loadingProgressText
|
|
287
|
-
})
|
|
291
|
+
children: 'result' === item.type ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_playground_result_index_js_namespaceObject.PlaygroundResultView, {
|
|
292
|
+
result: item.result || null,
|
|
293
|
+
loading: item.loading || false,
|
|
294
|
+
serverValid: true,
|
|
295
|
+
serviceMode: serviceMode,
|
|
296
|
+
replayScriptsInfo: item.replayScriptsInfo || null,
|
|
297
|
+
replayCounter: item.replayCounter || 0,
|
|
298
|
+
loadingProgressText: item.loadingProgressText || '',
|
|
299
|
+
verticalMode: item.verticalMode || false,
|
|
300
|
+
fitMode: "width",
|
|
301
|
+
actionType: item.actionType
|
|
302
|
+
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
303
|
+
children: [
|
|
304
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
305
|
+
className: "system-message-text",
|
|
306
|
+
children: item.content
|
|
307
|
+
}),
|
|
308
|
+
item.loading && item.loadingProgressText && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
309
|
+
className: "loading-progress-text",
|
|
310
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
311
|
+
children: item.loadingProgressText
|
|
288
312
|
})
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
313
|
+
})
|
|
314
|
+
]
|
|
315
|
+
})
|
|
292
316
|
})
|
|
293
317
|
]
|
|
294
318
|
})
|
|
295
|
-
}, item.id)
|
|
296
|
-
}
|
|
319
|
+
}, item.id)
|
|
297
320
|
})
|
|
298
321
|
}),
|
|
299
322
|
showScrollToBottomButton && false !== componentConfig.enableScrollToBottom && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Button, {
|
|
@@ -313,14 +336,15 @@ function UniversalPlayground(param) {
|
|
|
313
336
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_prompt_input_index_js_namespaceObject.PromptInput, {
|
|
314
337
|
runButtonEnabled: runButtonEnabled,
|
|
315
338
|
form: form,
|
|
316
|
-
serviceMode:
|
|
339
|
+
serviceMode: serviceMode,
|
|
317
340
|
selectedType: selectedType,
|
|
318
341
|
dryMode: dryMode,
|
|
319
342
|
stoppable: canStop,
|
|
320
343
|
loading: loading,
|
|
321
344
|
onRun: handleFormRun,
|
|
322
345
|
onStop: handleStop,
|
|
323
|
-
actionSpace: actionSpace
|
|
346
|
+
actionSpace: actionSpace,
|
|
347
|
+
deviceType: deviceType
|
|
324
348
|
})
|
|
325
349
|
]
|
|
326
350
|
}),
|
|
@@ -341,10 +365,10 @@ function UniversalPlayground(param) {
|
|
|
341
365
|
const universal_playground = UniversalPlayground;
|
|
342
366
|
exports.UniversalPlayground = __webpack_exports__.UniversalPlayground;
|
|
343
367
|
exports["default"] = __webpack_exports__["default"];
|
|
344
|
-
for(var
|
|
368
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
345
369
|
"UniversalPlayground",
|
|
346
370
|
"default"
|
|
347
|
-
].indexOf(
|
|
371
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
348
372
|
Object.defineProperty(exports, '__esModule', {
|
|
349
373
|
value: true
|
|
350
374
|
});
|
|
@@ -29,6 +29,32 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
29
29
|
NoOpContextProvider: ()=>NoOpContextProvider,
|
|
30
30
|
StaticContextProvider: ()=>StaticContextProvider
|
|
31
31
|
});
|
|
32
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
33
|
+
try {
|
|
34
|
+
var info = gen[key](arg);
|
|
35
|
+
var value = info.value;
|
|
36
|
+
} catch (error) {
|
|
37
|
+
reject(error);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
if (info.done) resolve(value);
|
|
41
|
+
else Promise.resolve(value).then(_next, _throw);
|
|
42
|
+
}
|
|
43
|
+
function _async_to_generator(fn) {
|
|
44
|
+
return function() {
|
|
45
|
+
var self = this, args = arguments;
|
|
46
|
+
return new Promise(function(resolve, reject) {
|
|
47
|
+
var gen = fn.apply(self, args);
|
|
48
|
+
function _next(value) {
|
|
49
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
50
|
+
}
|
|
51
|
+
function _throw(err) {
|
|
52
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
53
|
+
}
|
|
54
|
+
_next(void 0);
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
}
|
|
32
58
|
function _define_property(obj, key, value) {
|
|
33
59
|
if (key in obj) Object.defineProperty(obj, key, {
|
|
34
60
|
value: value,
|
|
@@ -40,56 +66,68 @@ function _define_property(obj, key, value) {
|
|
|
40
66
|
return obj;
|
|
41
67
|
}
|
|
42
68
|
class BaseContextProvider {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
69
|
+
refreshContext() {
|
|
70
|
+
return _async_to_generator(function*() {
|
|
71
|
+
this.cachedContext = void 0;
|
|
72
|
+
return yield this.getUIContext();
|
|
73
|
+
}).call(this);
|
|
46
74
|
}
|
|
47
75
|
constructor(){
|
|
48
76
|
_define_property(this, "cachedContext", void 0);
|
|
49
77
|
}
|
|
50
78
|
}
|
|
51
79
|
class AgentContextProvider extends BaseContextProvider {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
80
|
+
getUIContext() {
|
|
81
|
+
return _async_to_generator(function*() {
|
|
82
|
+
if (this.cachedContext) return this.cachedContext;
|
|
83
|
+
const agent = this.getAgent();
|
|
84
|
+
if (!(null == agent ? void 0 : agent.getUIContext)) throw new Error('Agent does not support getUIContext');
|
|
85
|
+
const context = yield agent.getUIContext();
|
|
86
|
+
this.cachedContext = context;
|
|
87
|
+
return context;
|
|
88
|
+
}).call(this);
|
|
59
89
|
}
|
|
60
90
|
constructor(getAgent, options){
|
|
61
91
|
super(), _define_property(this, "getAgent", void 0), _define_property(this, "options", void 0), this.getAgent = getAgent, this.options = options;
|
|
62
92
|
}
|
|
63
93
|
}
|
|
64
94
|
class StaticContextProvider extends BaseContextProvider {
|
|
65
|
-
|
|
66
|
-
return
|
|
95
|
+
getUIContext() {
|
|
96
|
+
return _async_to_generator(function*() {
|
|
97
|
+
return this.context;
|
|
98
|
+
}).call(this);
|
|
67
99
|
}
|
|
68
|
-
|
|
69
|
-
return
|
|
100
|
+
refreshContext() {
|
|
101
|
+
return _async_to_generator(function*() {
|
|
102
|
+
return this.context;
|
|
103
|
+
}).call(this);
|
|
70
104
|
}
|
|
71
105
|
constructor(context){
|
|
72
106
|
super(), _define_property(this, "context", void 0), this.context = context;
|
|
73
107
|
}
|
|
74
108
|
}
|
|
75
109
|
class NoOpContextProvider {
|
|
76
|
-
|
|
77
|
-
|
|
110
|
+
getUIContext() {
|
|
111
|
+
return _async_to_generator(function*() {
|
|
112
|
+
throw new Error('Context preview is disabled');
|
|
113
|
+
})();
|
|
78
114
|
}
|
|
79
|
-
|
|
80
|
-
|
|
115
|
+
refreshContext() {
|
|
116
|
+
return _async_to_generator(function*() {
|
|
117
|
+
throw new Error('Context preview is disabled');
|
|
118
|
+
})();
|
|
81
119
|
}
|
|
82
120
|
}
|
|
83
121
|
exports.AgentContextProvider = __webpack_exports__.AgentContextProvider;
|
|
84
122
|
exports.BaseContextProvider = __webpack_exports__.BaseContextProvider;
|
|
85
123
|
exports.NoOpContextProvider = __webpack_exports__.NoOpContextProvider;
|
|
86
124
|
exports.StaticContextProvider = __webpack_exports__.StaticContextProvider;
|
|
87
|
-
for(var
|
|
125
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
88
126
|
"AgentContextProvider",
|
|
89
127
|
"BaseContextProvider",
|
|
90
128
|
"NoOpContextProvider",
|
|
91
129
|
"StaticContextProvider"
|
|
92
|
-
].indexOf(
|
|
130
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
93
131
|
Object.defineProperty(exports, '__esModule', {
|
|
94
132
|
value: true
|
|
95
133
|
});
|