@midscene/visualizer 0.28.5 → 0.28.7-beta-20250912013851.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/env-config-reminder/index.css +22 -0
- package/dist/es/component/env-config-reminder/index.mjs +28 -0
- package/dist/es/component/universal-playground/index.mjs +22 -17
- package/dist/es/hooks/usePlaygroundState.mjs +8 -5
- package/dist/es/index.mjs +2 -1
- package/dist/lib/component/env-config-reminder/index.css +22 -0
- package/dist/lib/component/env-config-reminder/index.js +62 -0
- package/dist/lib/component/universal-playground/index.js +22 -17
- package/dist/lib/hooks/usePlaygroundState.js +8 -5
- package/dist/lib/index.js +7 -3
- package/dist/types/component/env-config-reminder/index.d.ts +6 -0
- package/dist/types/hooks/usePlaygroundState.d.ts +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/types.d.ts +1 -0
- package/package.json +5 -5
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
.env-config-reminder {
|
|
2
|
+
background: #fff2e8;
|
|
3
|
+
border-radius: 12px;
|
|
4
|
+
align-items: center;
|
|
5
|
+
gap: 12px;
|
|
6
|
+
margin-bottom: 12px;
|
|
7
|
+
padding: 12px 16px;
|
|
8
|
+
display: flex;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.env-config-reminder .reminder-icon {
|
|
12
|
+
color: #fa541c;
|
|
13
|
+
width: 16px;
|
|
14
|
+
height: 16px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.env-config-reminder .reminder-text {
|
|
18
|
+
color: #000;
|
|
19
|
+
flex: 1;
|
|
20
|
+
font-size: 14px;
|
|
21
|
+
}
|
|
22
|
+
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ExclamationCircleFilled } from "@ant-design/icons";
|
|
3
|
+
import { useEnvConfig } from "../../store/store.mjs";
|
|
4
|
+
import { EnvConfig } from "../env-config/index.mjs";
|
|
5
|
+
import "./index.css";
|
|
6
|
+
const EnvConfigReminder = (param)=>{
|
|
7
|
+
let { className = '' } = param;
|
|
8
|
+
const { config } = useEnvConfig();
|
|
9
|
+
const configAlreadySet = Object.keys(config || {}).length >= 1;
|
|
10
|
+
if (configAlreadySet) return null;
|
|
11
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
12
|
+
className: `env-config-reminder ${className}`,
|
|
13
|
+
children: [
|
|
14
|
+
/*#__PURE__*/ jsx(ExclamationCircleFilled, {
|
|
15
|
+
className: "reminder-icon"
|
|
16
|
+
}),
|
|
17
|
+
/*#__PURE__*/ jsx("span", {
|
|
18
|
+
className: "reminder-text",
|
|
19
|
+
children: "Please set up your environment variables before using."
|
|
20
|
+
}),
|
|
21
|
+
/*#__PURE__*/ jsx(EnvConfig, {
|
|
22
|
+
mode: "text",
|
|
23
|
+
showTooltipWhenEmpty: false
|
|
24
|
+
})
|
|
25
|
+
]
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
export { EnvConfigReminder };
|
|
@@ -6,6 +6,7 @@ import { usePlaygroundExecution } from "../../hooks/usePlaygroundExecution.mjs";
|
|
|
6
6
|
import { usePlaygroundState } from "../../hooks/usePlaygroundState.mjs";
|
|
7
7
|
import { useEnvConfig } from "../../store/store.mjs";
|
|
8
8
|
import { ContextPreview } from "../context-preview/index.mjs";
|
|
9
|
+
import { EnvConfigReminder } from "../env-config-reminder/index.mjs";
|
|
9
10
|
import { PlaygroundResultView } from "../playground-result/index.mjs";
|
|
10
11
|
import "./index.css";
|
|
11
12
|
import avatar from "../../icons/avatar.mjs";
|
|
@@ -35,7 +36,8 @@ function UniversalPlayground(param) {
|
|
|
35
36
|
let { playgroundSDK, storage, contextProvider, config: componentConfig = {}, branding = {}, className = '', dryMode = false, showContextPreview = true } = param;
|
|
36
37
|
const [form] = Form.useForm();
|
|
37
38
|
const { deepThink, screenshotIncluded, domIncluded, config } = useEnvConfig();
|
|
38
|
-
const
|
|
39
|
+
const enablePersistence = false !== componentConfig.enablePersistence;
|
|
40
|
+
const { loading, setLoading, infoList, setInfoList, actionSpace, actionSpaceLoading, uiContextPreview, setUiContextPreview, showScrollToBottomButton, verticalMode, replayCounter, setReplayCounter, infoListRef, currentRunningIdRef, interruptedFlagRef, clearInfoList, handleScrollToBottom } = usePlaygroundState(playgroundSDK, storage, contextProvider, enablePersistence);
|
|
39
41
|
const { handleRun: executeAction, handleStop, canStop } = usePlaygroundExecution(playgroundSDK, storage, actionSpace, loading, setLoading, infoList, setInfoList, replayCounter, setReplayCounter, verticalMode, currentRunningIdRef, interruptedFlagRef);
|
|
40
42
|
useEffect(()=>{
|
|
41
43
|
const completeConfig = {
|
|
@@ -65,10 +67,10 @@ function UniversalPlayground(param) {
|
|
|
65
67
|
form,
|
|
66
68
|
executeAction
|
|
67
69
|
]);
|
|
68
|
-
const
|
|
70
|
+
const configAlreadySet = Object.keys(config || {}).length >= 1;
|
|
71
|
+
const runButtonEnabled = componentConfig.serverMode || !dryMode && !actionSpaceLoading && configAlreadySet;
|
|
69
72
|
const selectedType = Form.useWatch('type', form);
|
|
70
73
|
const finalShowContextPreview = showContextPreview && false !== componentConfig.showContextPreview;
|
|
71
|
-
const enablePersistence = false !== componentConfig.enablePersistence;
|
|
72
74
|
const layout = componentConfig.layout || 'vertical';
|
|
73
75
|
const showVersionInfo = false !== componentConfig.showVersionInfo;
|
|
74
76
|
return /*#__PURE__*/ jsx("div", {
|
|
@@ -89,7 +91,7 @@ function UniversalPlayground(param) {
|
|
|
89
91
|
/*#__PURE__*/ jsxs("div", {
|
|
90
92
|
className: "middle-dialog-area",
|
|
91
93
|
children: [
|
|
92
|
-
infoList.length > 1 &&
|
|
94
|
+
infoList.length > 1 && /*#__PURE__*/ jsx("div", {
|
|
93
95
|
className: "clear-button-container",
|
|
94
96
|
children: /*#__PURE__*/ jsx(Button, {
|
|
95
97
|
size: "small",
|
|
@@ -240,20 +242,23 @@ function UniversalPlayground(param) {
|
|
|
240
242
|
})
|
|
241
243
|
]
|
|
242
244
|
}),
|
|
243
|
-
/*#__PURE__*/
|
|
245
|
+
/*#__PURE__*/ jsxs("div", {
|
|
244
246
|
className: "bottom-input-section",
|
|
245
|
-
children:
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
247
|
+
children: [
|
|
248
|
+
!componentConfig.serverMode && /*#__PURE__*/ jsx(EnvConfigReminder, {}),
|
|
249
|
+
/*#__PURE__*/ jsx(PromptInput, {
|
|
250
|
+
runButtonEnabled: runButtonEnabled,
|
|
251
|
+
form: form,
|
|
252
|
+
serviceMode: 'Server',
|
|
253
|
+
selectedType: selectedType,
|
|
254
|
+
dryMode: dryMode,
|
|
255
|
+
stoppable: canStop,
|
|
256
|
+
loading: loading,
|
|
257
|
+
onRun: handleFormRun,
|
|
258
|
+
onStop: handleStop,
|
|
259
|
+
actionSpace: actionSpace
|
|
260
|
+
})
|
|
261
|
+
]
|
|
257
262
|
}),
|
|
258
263
|
showVersionInfo && branding.version && /*#__PURE__*/ jsx("div", {
|
|
259
264
|
className: "version-info-section",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
2
2
|
import { WELCOME_MESSAGE_TEMPLATE } from "../utils/constants.mjs";
|
|
3
3
|
function usePlaygroundState(playgroundSDK, storage, contextProvider) {
|
|
4
|
+
let enablePersistence = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : true;
|
|
4
5
|
const [loading, setLoading] = useState(false);
|
|
5
6
|
const [infoList, setInfoList] = useState([]);
|
|
6
7
|
const [actionSpace, setActionSpace] = useState([]);
|
|
@@ -19,7 +20,7 @@ function usePlaygroundState(playgroundSDK, storage, contextProvider) {
|
|
|
19
20
|
id: 'welcome',
|
|
20
21
|
timestamp: new Date()
|
|
21
22
|
};
|
|
22
|
-
if (null == storage ? void 0 : storage.loadMessages) try {
|
|
23
|
+
if (enablePersistence && (null == storage ? void 0 : storage.loadMessages)) try {
|
|
23
24
|
const storedMessages = await storage.loadMessages();
|
|
24
25
|
const hasWelcomeMessage = storedMessages.some((msg)=>'welcome' === msg.id);
|
|
25
26
|
hasWelcomeMessage ? setInfoList(storedMessages) : setInfoList([
|
|
@@ -39,12 +40,13 @@ function usePlaygroundState(playgroundSDK, storage, contextProvider) {
|
|
|
39
40
|
if (0 === infoList.length) initializeMessages();
|
|
40
41
|
}, []);
|
|
41
42
|
useEffect(()=>{
|
|
42
|
-
if ((null == storage ? void 0 : storage.saveMessages) && infoList.length > 1) storage.saveMessages(infoList).catch((error)=>{
|
|
43
|
+
if (enablePersistence && (null == storage ? void 0 : storage.saveMessages) && infoList.length > 1) storage.saveMessages(infoList).catch((error)=>{
|
|
43
44
|
console.error('Failed to save messages:', error);
|
|
44
45
|
});
|
|
45
46
|
}, [
|
|
46
47
|
infoList,
|
|
47
|
-
storage
|
|
48
|
+
storage,
|
|
49
|
+
enablePersistence
|
|
48
50
|
]);
|
|
49
51
|
useEffect(()=>{
|
|
50
52
|
if (!(null == contextProvider ? void 0 : contextProvider.getUIContext) || uiContextPreview) return;
|
|
@@ -133,13 +135,14 @@ function usePlaygroundState(playgroundSDK, storage, contextProvider) {
|
|
|
133
135
|
setInfoList([
|
|
134
136
|
welcomeMessage
|
|
135
137
|
]);
|
|
136
|
-
if (null == storage ? void 0 : storage.clearMessages) try {
|
|
138
|
+
if (enablePersistence && (null == storage ? void 0 : storage.clearMessages)) try {
|
|
137
139
|
await storage.clearMessages();
|
|
138
140
|
} catch (error) {
|
|
139
141
|
console.error('Failed to clear stored messages:', error);
|
|
140
142
|
}
|
|
141
143
|
}, [
|
|
142
|
-
storage
|
|
144
|
+
storage,
|
|
145
|
+
enablePersistence
|
|
143
146
|
]);
|
|
144
147
|
const refreshContext = useCallback(async ()=>{
|
|
145
148
|
if (null == contextProvider ? void 0 : contextProvider.refreshContext) try {
|
package/dist/es/index.mjs
CHANGED
|
@@ -4,6 +4,7 @@ import { allScriptsFromDump, generateAnimationScripts } from "./utils/replay-scr
|
|
|
4
4
|
import { useEnvConfig } from "./store/store.mjs";
|
|
5
5
|
import { colorForName, globalThemeConfig, highlightColorForType } from "./utils/color.mjs";
|
|
6
6
|
import { EnvConfig } from "./component/env-config/index.mjs";
|
|
7
|
+
import { EnvConfigReminder } from "./component/env-config-reminder/index.mjs";
|
|
7
8
|
import { Logo } from "./component/logo/index.mjs";
|
|
8
9
|
import { iconForStatus, timeCostStrElement } from "./component/misc/index.mjs";
|
|
9
10
|
import { useServerValid } from "./hooks/useServerValid.mjs";
|
|
@@ -20,4 +21,4 @@ import shiny_text from "./component/shiny-text/index.mjs";
|
|
|
20
21
|
import universal_playground, { UniversalPlayground } from "./component/universal-playground/index.mjs";
|
|
21
22
|
import { LocalStorageProvider, MemoryStorageProvider, NoOpStorageProvider } from "./component/universal-playground/providers/storage-provider.mjs";
|
|
22
23
|
import { AgentContextProvider, BaseContextProvider, NoOpContextProvider, StaticContextProvider } from "./component/universal-playground/providers/context-provider.mjs";
|
|
23
|
-
export { AgentContextProvider, BaseContextProvider, Blackboard, ContextPreview, EnvConfig, GithubStar, LocalStorageProvider, Logo, MemoryStorageProvider, NoOpContextProvider, NoOpStorageProvider, Player, PlaygroundResultView, PromptInput, ServiceModeControl, shiny_text as ShinyText, StaticContextProvider, UniversalPlayground, universal_playground as UniversalPlaygroundDefault, actionNameForType, allScriptsFromDump, colorForName, filterBase64Value, generateAnimationScripts, getPlaceholderForType, globalThemeConfig, highlightColorForType, iconForStatus, staticAgentFromContext, timeCostStrElement, timeStr, useEnvConfig, useServerValid };
|
|
24
|
+
export { AgentContextProvider, BaseContextProvider, Blackboard, ContextPreview, EnvConfig, EnvConfigReminder, GithubStar, LocalStorageProvider, Logo, MemoryStorageProvider, NoOpContextProvider, NoOpStorageProvider, Player, PlaygroundResultView, PromptInput, ServiceModeControl, shiny_text as ShinyText, StaticContextProvider, UniversalPlayground, universal_playground as UniversalPlaygroundDefault, actionNameForType, allScriptsFromDump, colorForName, filterBase64Value, generateAnimationScripts, getPlaceholderForType, globalThemeConfig, highlightColorForType, iconForStatus, staticAgentFromContext, timeCostStrElement, timeStr, useEnvConfig, useServerValid };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
.env-config-reminder {
|
|
2
|
+
background: #fff2e8;
|
|
3
|
+
border-radius: 12px;
|
|
4
|
+
align-items: center;
|
|
5
|
+
gap: 12px;
|
|
6
|
+
margin-bottom: 12px;
|
|
7
|
+
padding: 12px 16px;
|
|
8
|
+
display: flex;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.env-config-reminder .reminder-icon {
|
|
12
|
+
color: #fa541c;
|
|
13
|
+
width: 16px;
|
|
14
|
+
height: 16px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.env-config-reminder .reminder-text {
|
|
18
|
+
color: #000;
|
|
19
|
+
flex: 1;
|
|
20
|
+
font-size: 14px;
|
|
21
|
+
}
|
|
22
|
+
|
|
@@ -0,0 +1,62 @@
|
|
|
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
|
+
EnvConfigReminder: ()=>EnvConfigReminder
|
|
28
|
+
});
|
|
29
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
|
+
const icons_namespaceObject = require("@ant-design/icons");
|
|
31
|
+
const store_js_namespaceObject = require("../../store/store.js");
|
|
32
|
+
const index_js_namespaceObject = require("../env-config/index.js");
|
|
33
|
+
require("./index.css");
|
|
34
|
+
const EnvConfigReminder = (param)=>{
|
|
35
|
+
let { className = '' } = param;
|
|
36
|
+
const { config } = (0, store_js_namespaceObject.useEnvConfig)();
|
|
37
|
+
const configAlreadySet = Object.keys(config || {}).length >= 1;
|
|
38
|
+
if (configAlreadySet) return null;
|
|
39
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
40
|
+
className: `env-config-reminder ${className}`,
|
|
41
|
+
children: [
|
|
42
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icons_namespaceObject.ExclamationCircleFilled, {
|
|
43
|
+
className: "reminder-icon"
|
|
44
|
+
}),
|
|
45
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
46
|
+
className: "reminder-text",
|
|
47
|
+
children: "Please set up your environment variables before using."
|
|
48
|
+
}),
|
|
49
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(index_js_namespaceObject.EnvConfig, {
|
|
50
|
+
mode: "text",
|
|
51
|
+
showTooltipWhenEmpty: false
|
|
52
|
+
})
|
|
53
|
+
]
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
exports.EnvConfigReminder = __webpack_exports__.EnvConfigReminder;
|
|
57
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
58
|
+
"EnvConfigReminder"
|
|
59
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
60
|
+
Object.defineProperty(exports, '__esModule', {
|
|
61
|
+
value: true
|
|
62
|
+
});
|
|
@@ -45,6 +45,7 @@ const usePlaygroundExecution_js_namespaceObject = require("../../hooks/usePlaygr
|
|
|
45
45
|
const usePlaygroundState_js_namespaceObject = require("../../hooks/usePlaygroundState.js");
|
|
46
46
|
const store_js_namespaceObject = require("../../store/store.js");
|
|
47
47
|
const index_js_namespaceObject = require("../context-preview/index.js");
|
|
48
|
+
const external_env_config_reminder_index_js_namespaceObject = require("../env-config-reminder/index.js");
|
|
48
49
|
const external_playground_result_index_js_namespaceObject = require("../playground-result/index.js");
|
|
49
50
|
require("./index.css");
|
|
50
51
|
const avatar_js_namespaceObject = require("../../icons/avatar.js");
|
|
@@ -75,7 +76,8 @@ function UniversalPlayground(param) {
|
|
|
75
76
|
let { playgroundSDK, storage, contextProvider, config: componentConfig = {}, branding = {}, className = '', dryMode = false, showContextPreview = true } = param;
|
|
76
77
|
const [form] = external_antd_namespaceObject.Form.useForm();
|
|
77
78
|
const { deepThink, screenshotIncluded, domIncluded, config } = (0, store_js_namespaceObject.useEnvConfig)();
|
|
78
|
-
const
|
|
79
|
+
const enablePersistence = false !== componentConfig.enablePersistence;
|
|
80
|
+
const { loading, setLoading, infoList, setInfoList, actionSpace, actionSpaceLoading, uiContextPreview, setUiContextPreview, showScrollToBottomButton, verticalMode, replayCounter, setReplayCounter, infoListRef, currentRunningIdRef, interruptedFlagRef, clearInfoList, handleScrollToBottom } = (0, usePlaygroundState_js_namespaceObject.usePlaygroundState)(playgroundSDK, storage, contextProvider, enablePersistence);
|
|
79
81
|
const { handleRun: executeAction, handleStop, canStop } = (0, usePlaygroundExecution_js_namespaceObject.usePlaygroundExecution)(playgroundSDK, storage, actionSpace, loading, setLoading, infoList, setInfoList, replayCounter, setReplayCounter, verticalMode, currentRunningIdRef, interruptedFlagRef);
|
|
80
82
|
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
81
83
|
const completeConfig = {
|
|
@@ -105,10 +107,10 @@ function UniversalPlayground(param) {
|
|
|
105
107
|
form,
|
|
106
108
|
executeAction
|
|
107
109
|
]);
|
|
108
|
-
const
|
|
110
|
+
const configAlreadySet = Object.keys(config || {}).length >= 1;
|
|
111
|
+
const runButtonEnabled = componentConfig.serverMode || !dryMode && !actionSpaceLoading && configAlreadySet;
|
|
109
112
|
const selectedType = external_antd_namespaceObject.Form.useWatch('type', form);
|
|
110
113
|
const finalShowContextPreview = showContextPreview && false !== componentConfig.showContextPreview;
|
|
111
|
-
const enablePersistence = false !== componentConfig.enablePersistence;
|
|
112
114
|
const layout = componentConfig.layout || 'vertical';
|
|
113
115
|
const showVersionInfo = false !== componentConfig.showVersionInfo;
|
|
114
116
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
@@ -129,7 +131,7 @@ function UniversalPlayground(param) {
|
|
|
129
131
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
130
132
|
className: "middle-dialog-area",
|
|
131
133
|
children: [
|
|
132
|
-
infoList.length > 1 &&
|
|
134
|
+
infoList.length > 1 && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
133
135
|
className: "clear-button-container",
|
|
134
136
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Button, {
|
|
135
137
|
size: "small",
|
|
@@ -280,20 +282,23 @@ function UniversalPlayground(param) {
|
|
|
280
282
|
})
|
|
281
283
|
]
|
|
282
284
|
}),
|
|
283
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.
|
|
285
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
|
|
284
286
|
className: "bottom-input-section",
|
|
285
|
-
children:
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
287
|
+
children: [
|
|
288
|
+
!componentConfig.serverMode && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_env_config_reminder_index_js_namespaceObject.EnvConfigReminder, {}),
|
|
289
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_prompt_input_index_js_namespaceObject.PromptInput, {
|
|
290
|
+
runButtonEnabled: runButtonEnabled,
|
|
291
|
+
form: form,
|
|
292
|
+
serviceMode: 'Server',
|
|
293
|
+
selectedType: selectedType,
|
|
294
|
+
dryMode: dryMode,
|
|
295
|
+
stoppable: canStop,
|
|
296
|
+
loading: loading,
|
|
297
|
+
onRun: handleFormRun,
|
|
298
|
+
onStop: handleStop,
|
|
299
|
+
actionSpace: actionSpace
|
|
300
|
+
})
|
|
301
|
+
]
|
|
297
302
|
}),
|
|
298
303
|
showVersionInfo && branding.version && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
299
304
|
className: "version-info-section",
|
|
@@ -29,6 +29,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
29
29
|
const external_react_namespaceObject = require("react");
|
|
30
30
|
const constants_js_namespaceObject = require("../utils/constants.js");
|
|
31
31
|
function usePlaygroundState(playgroundSDK, storage, contextProvider) {
|
|
32
|
+
let enablePersistence = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : true;
|
|
32
33
|
const [loading, setLoading] = (0, external_react_namespaceObject.useState)(false);
|
|
33
34
|
const [infoList, setInfoList] = (0, external_react_namespaceObject.useState)([]);
|
|
34
35
|
const [actionSpace, setActionSpace] = (0, external_react_namespaceObject.useState)([]);
|
|
@@ -47,7 +48,7 @@ function usePlaygroundState(playgroundSDK, storage, contextProvider) {
|
|
|
47
48
|
id: 'welcome',
|
|
48
49
|
timestamp: new Date()
|
|
49
50
|
};
|
|
50
|
-
if (null == storage ? void 0 : storage.loadMessages) try {
|
|
51
|
+
if (enablePersistence && (null == storage ? void 0 : storage.loadMessages)) try {
|
|
51
52
|
const storedMessages = await storage.loadMessages();
|
|
52
53
|
const hasWelcomeMessage = storedMessages.some((msg)=>'welcome' === msg.id);
|
|
53
54
|
hasWelcomeMessage ? setInfoList(storedMessages) : setInfoList([
|
|
@@ -67,12 +68,13 @@ function usePlaygroundState(playgroundSDK, storage, contextProvider) {
|
|
|
67
68
|
if (0 === infoList.length) initializeMessages();
|
|
68
69
|
}, []);
|
|
69
70
|
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
70
|
-
if ((null == storage ? void 0 : storage.saveMessages) && infoList.length > 1) storage.saveMessages(infoList).catch((error)=>{
|
|
71
|
+
if (enablePersistence && (null == storage ? void 0 : storage.saveMessages) && infoList.length > 1) storage.saveMessages(infoList).catch((error)=>{
|
|
71
72
|
console.error('Failed to save messages:', error);
|
|
72
73
|
});
|
|
73
74
|
}, [
|
|
74
75
|
infoList,
|
|
75
|
-
storage
|
|
76
|
+
storage,
|
|
77
|
+
enablePersistence
|
|
76
78
|
]);
|
|
77
79
|
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
78
80
|
if (!(null == contextProvider ? void 0 : contextProvider.getUIContext) || uiContextPreview) return;
|
|
@@ -161,13 +163,14 @@ function usePlaygroundState(playgroundSDK, storage, contextProvider) {
|
|
|
161
163
|
setInfoList([
|
|
162
164
|
welcomeMessage
|
|
163
165
|
]);
|
|
164
|
-
if (null == storage ? void 0 : storage.clearMessages) try {
|
|
166
|
+
if (enablePersistence && (null == storage ? void 0 : storage.clearMessages)) try {
|
|
165
167
|
await storage.clearMessages();
|
|
166
168
|
} catch (error) {
|
|
167
169
|
console.error('Failed to clear stored messages:', error);
|
|
168
170
|
}
|
|
169
171
|
}, [
|
|
170
|
-
storage
|
|
172
|
+
storage,
|
|
173
|
+
enablePersistence
|
|
171
174
|
]);
|
|
172
175
|
const refreshContext = (0, external_react_namespaceObject.useCallback)(async ()=>{
|
|
173
176
|
if (null == contextProvider ? void 0 : contextProvider.refreshContext) try {
|
package/dist/lib/index.js
CHANGED
|
@@ -53,18 +53,19 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
53
53
|
Logo: ()=>logo_index_js_namespaceObject.Logo,
|
|
54
54
|
UniversalPlayground: ()=>universal_playground_index_js_namespaceObject.UniversalPlayground,
|
|
55
55
|
useEnvConfig: ()=>store_js_namespaceObject.useEnvConfig,
|
|
56
|
-
PromptInput: ()=>prompt_input_index_js_namespaceObject.PromptInput,
|
|
57
|
-
ContextPreview: ()=>context_preview_index_js_namespaceObject.ContextPreview,
|
|
58
56
|
NoOpStorageProvider: ()=>storage_provider_js_namespaceObject.NoOpStorageProvider,
|
|
57
|
+
ContextPreview: ()=>context_preview_index_js_namespaceObject.ContextPreview,
|
|
58
|
+
PromptInput: ()=>prompt_input_index_js_namespaceObject.PromptInput,
|
|
59
59
|
StaticContextProvider: ()=>context_provider_js_namespaceObject.StaticContextProvider,
|
|
60
60
|
Blackboard: ()=>blackboard_index_js_namespaceObject.Blackboard,
|
|
61
61
|
Player: ()=>player_index_js_namespaceObject.Player,
|
|
62
62
|
AgentContextProvider: ()=>context_provider_js_namespaceObject.AgentContextProvider,
|
|
63
|
+
EnvConfigReminder: ()=>env_config_reminder_index_js_namespaceObject.EnvConfigReminder,
|
|
63
64
|
filterBase64Value: ()=>external_utils_index_js_namespaceObject.filterBase64Value,
|
|
64
65
|
NoOpContextProvider: ()=>context_provider_js_namespaceObject.NoOpContextProvider,
|
|
65
66
|
highlightColorForType: ()=>color_js_namespaceObject.highlightColorForType,
|
|
66
|
-
iconForStatus: ()=>misc_index_js_namespaceObject.iconForStatus,
|
|
67
67
|
globalThemeConfig: ()=>color_js_namespaceObject.globalThemeConfig,
|
|
68
|
+
iconForStatus: ()=>misc_index_js_namespaceObject.iconForStatus,
|
|
68
69
|
MemoryStorageProvider: ()=>storage_provider_js_namespaceObject.MemoryStorageProvider
|
|
69
70
|
});
|
|
70
71
|
require("./component/playground/index.css");
|
|
@@ -73,6 +74,7 @@ const replay_scripts_js_namespaceObject = require("./utils/replay-scripts.js");
|
|
|
73
74
|
const store_js_namespaceObject = require("./store/store.js");
|
|
74
75
|
const color_js_namespaceObject = require("./utils/color.js");
|
|
75
76
|
const index_js_namespaceObject = require("./component/env-config/index.js");
|
|
77
|
+
const env_config_reminder_index_js_namespaceObject = require("./component/env-config-reminder/index.js");
|
|
76
78
|
const logo_index_js_namespaceObject = require("./component/logo/index.js");
|
|
77
79
|
const misc_index_js_namespaceObject = require("./component/misc/index.js");
|
|
78
80
|
const useServerValid_js_namespaceObject = require("./hooks/useServerValid.js");
|
|
@@ -96,6 +98,7 @@ exports.BaseContextProvider = __webpack_exports__.BaseContextProvider;
|
|
|
96
98
|
exports.Blackboard = __webpack_exports__.Blackboard;
|
|
97
99
|
exports.ContextPreview = __webpack_exports__.ContextPreview;
|
|
98
100
|
exports.EnvConfig = __webpack_exports__.EnvConfig;
|
|
101
|
+
exports.EnvConfigReminder = __webpack_exports__.EnvConfigReminder;
|
|
99
102
|
exports.GithubStar = __webpack_exports__.GithubStar;
|
|
100
103
|
exports.LocalStorageProvider = __webpack_exports__.LocalStorageProvider;
|
|
101
104
|
exports.Logo = __webpack_exports__.Logo;
|
|
@@ -130,6 +133,7 @@ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
|
130
133
|
"Blackboard",
|
|
131
134
|
"ContextPreview",
|
|
132
135
|
"EnvConfig",
|
|
136
|
+
"EnvConfigReminder",
|
|
133
137
|
"GithubStar",
|
|
134
138
|
"LocalStorageProvider",
|
|
135
139
|
"Logo",
|
|
@@ -3,7 +3,7 @@ import type { ContextProvider, InfoListItem, PlaygroundSDKLike, StorageProvider
|
|
|
3
3
|
/**
|
|
4
4
|
* Hook for managing playground state
|
|
5
5
|
*/
|
|
6
|
-
export declare function usePlaygroundState(playgroundSDK: PlaygroundSDKLike, storage?: StorageProvider, contextProvider?: ContextProvider): {
|
|
6
|
+
export declare function usePlaygroundState(playgroundSDK: PlaygroundSDKLike, storage?: StorageProvider, contextProvider?: ContextProvider, enablePersistence?: boolean): {
|
|
7
7
|
loading: boolean;
|
|
8
8
|
setLoading: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
9
9
|
infoList: InfoListItem[];
|
package/dist/types/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export { type AnimationScript, type ReplayScriptsInfo, allScriptsFromDump, gener
|
|
|
4
4
|
export { useEnvConfig } from './store/store';
|
|
5
5
|
export { colorForName, highlightColorForType, globalThemeConfig, } from './utils/color';
|
|
6
6
|
export { EnvConfig } from './component/env-config';
|
|
7
|
+
export { EnvConfigReminder } from './component/env-config-reminder';
|
|
7
8
|
export { Logo } from './component/logo';
|
|
8
9
|
export { iconForStatus, timeCostStrElement } from './component/misc';
|
|
9
10
|
export { useServerValid } from './hooks/useServerValid';
|
package/dist/types/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midscene/visualizer",
|
|
3
|
-
"version": "0.28.
|
|
3
|
+
"version": "0.28.7-beta-20250912013851.0",
|
|
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,10 +70,10 @@
|
|
|
70
70
|
"antd": "^5.21.6",
|
|
71
71
|
"buffer": "6.0.3",
|
|
72
72
|
"dayjs": "^1.11.11",
|
|
73
|
-
"@midscene/core": "0.28.
|
|
74
|
-
"@midscene/
|
|
75
|
-
"@midscene/web": "0.28.
|
|
76
|
-
"@midscene/
|
|
73
|
+
"@midscene/core": "0.28.7-beta-20250912013851.0",
|
|
74
|
+
"@midscene/playground": "0.28.7-beta-20250912013851.0",
|
|
75
|
+
"@midscene/web": "0.28.7-beta-20250912013851.0",
|
|
76
|
+
"@midscene/shared": "0.28.7-beta-20250912013851.0"
|
|
77
77
|
},
|
|
78
78
|
"license": "MIT",
|
|
79
79
|
"scripts": {
|