@midscene/visualizer 0.26.2 → 0.26.3-beta-20250813075706.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/blank_polyfill.mjs +2 -0
- package/dist/es/component/blackboard.css +12 -5
- package/dist/es/component/blackboard.mjs +266 -0
- package/dist/es/component/color.mjs +35 -0
- package/dist/es/component/describer.css +9 -5
- package/dist/es/component/describer.mjs +128 -0
- package/dist/es/component/env-config.mjs +112 -0
- package/dist/es/component/github-star.css +1 -0
- package/dist/es/component/github-star.mjs +20 -0
- package/dist/es/component/logo.css +5 -3
- package/dist/es/component/logo.mjs +20 -0
- package/dist/es/component/misc.mjs +54 -0
- package/dist/es/component/pixi-loader.mjs +16 -0
- package/dist/es/component/player.css +88 -70
- package/dist/es/component/player.mjs +628 -0
- package/dist/es/component/playground/ConfigSelector.mjs +53 -0
- package/dist/es/component/playground/ContextPreview.mjs +39 -0
- package/dist/es/component/playground/HistorySelector.mjs +193 -0
- package/dist/es/component/playground/PlaygroundResult.mjs +60 -0
- package/dist/es/component/playground/PromptInput.mjs +225 -0
- package/dist/es/component/playground/ServiceModeControl.mjs +100 -0
- package/dist/es/component/playground/index.css +140 -98
- package/dist/es/component/playground/playground-constants.mjs +45 -0
- package/dist/es/component/playground/playground-utils.mjs +89 -0
- package/dist/es/component/playground/useServerValid.mjs +27 -0
- package/dist/es/component/playground/useStaticPageAgent.mjs +12 -0
- package/dist/es/component/replay-scripts.mjs +271 -0
- package/dist/es/component/shiny-text.css +33 -22
- package/dist/es/component/shiny-text.mjs +15 -0
- package/dist/es/component/store/history.mjs +55 -0
- package/dist/es/component/store/store.mjs +128 -0
- package/dist/es/icons/close.mjs +19 -0
- package/dist/es/icons/history.mjs +30 -0
- package/dist/es/icons/magnifying-glass.mjs +39 -0
- package/dist/es/icons/setting.mjs +20 -0
- package/dist/es/index.mjs +21 -0
- package/dist/es/init.mjs +10 -0
- package/dist/es/{utils.js → utils.mjs} +51 -75
- package/dist/lib/blank_polyfill.js +34 -38
- package/dist/lib/component/blackboard.css +12 -5
- package/dist/lib/component/blackboard.js +293 -306
- package/dist/lib/component/color.js +64 -74
- package/dist/lib/component/describer.css +9 -5
- package/dist/lib/component/describer.js +158 -198
- package/dist/lib/component/env-config.js +142 -147
- package/dist/lib/component/github-star.css +1 -0
- package/dist/lib/component/github-star.js +51 -62
- package/dist/lib/component/logo.css +5 -3
- package/dist/lib/component/logo.js +53 -56
- package/dist/lib/component/misc.js +85 -84
- package/dist/lib/component/pixi-loader.js +49 -80
- package/dist/lib/component/player.css +88 -70
- package/dist/lib/component/player.js +627 -738
- package/dist/lib/component/playground/ConfigSelector.js +91 -92
- package/dist/lib/component/playground/ContextPreview.js +80 -72
- package/dist/lib/component/playground/HistorySelector.js +234 -197
- package/dist/lib/component/playground/PlaygroundResult.js +100 -103
- package/dist/lib/component/playground/PromptInput.js +250 -237
- package/dist/lib/component/playground/ServiceModeControl.js +124 -124
- package/dist/lib/component/playground/index.css +140 -98
- package/dist/lib/component/playground/playground-constants.js +97 -73
- package/dist/lib/component/playground/playground-types.js +17 -31
- package/dist/lib/component/playground/playground-utils.js +140 -168
- package/dist/lib/component/playground/useServerValid.js +55 -86
- package/dist/lib/component/playground/useStaticPageAgent.js +45 -51
- package/dist/lib/component/replay-scripts.js +291 -373
- package/dist/lib/component/shiny-text.css +33 -22
- package/dist/lib/component/shiny-text.js +46 -57
- package/dist/lib/component/store/history.js +58 -64
- package/dist/lib/component/store/store.js +132 -128
- package/dist/lib/icons/close.js +53 -0
- package/dist/lib/icons/history.js +64 -0
- package/dist/lib/icons/magnifying-glass.js +73 -0
- package/dist/lib/icons/setting.js +54 -0
- package/dist/lib/index.js +158 -124
- package/dist/lib/init.js +39 -46
- package/dist/lib/utils.js +105 -109
- package/dist/types/blank_polyfill.d.ts +2 -2
- package/dist/types/component/playground/ConfigSelector.d.ts +1 -0
- package/dist/types/component/playground/ContextPreview.d.ts +1 -0
- package/dist/types/component/playground/HistorySelector.d.ts +1 -0
- package/dist/types/component/playground/PlaygroundResult.d.ts +1 -0
- package/dist/types/component/playground/PromptInput.d.ts +1 -0
- package/dist/types/component/playground/ServiceModeControl.d.ts +1 -0
- package/package.json +16 -19
- package/dist/es/assets/close.909351c0.svg +0 -4
- package/dist/es/assets/history.164a4eab.svg +0 -4
- package/dist/es/assets/magnifying-glass.9498e70e.svg +0 -12
- package/dist/es/assets/setting.80ab7285.svg +0 -11
- package/dist/es/blank_polyfill.js +0 -10
- package/dist/es/component/blackboard.js +0 -286
- package/dist/es/component/color.js +0 -49
- package/dist/es/component/describer.js +0 -173
- package/dist/es/component/env-config.js +0 -117
- package/dist/es/component/github-star.js +0 -31
- package/dist/es/component/logo.js +0 -25
- package/dist/es/component/misc.js +0 -63
- package/dist/es/component/pixi-loader.js +0 -51
- package/dist/es/component/player.js +0 -746
- package/dist/es/component/playground/ConfigSelector.js +0 -64
- package/dist/es/component/playground/ContextPreview.js +0 -42
- package/dist/es/component/playground/HistorySelector.js +0 -168
- package/dist/es/component/playground/PlaygroundResult.js +0 -73
- package/dist/es/component/playground/PromptInput.js +0 -212
- package/dist/es/component/playground/ServiceModeControl.js +0 -100
- package/dist/es/component/playground/playground-constants.js +0 -39
- package/dist/es/component/playground/playground-types.js +0 -6
- package/dist/es/component/playground/playground-utils.js +0 -141
- package/dist/es/component/playground/useServerValid.js +0 -58
- package/dist/es/component/playground/useStaticPageAgent.js +0 -20
- package/dist/es/component/replay-scripts.js +0 -361
- package/dist/es/component/shiny-text.js +0 -30
- package/dist/es/component/store/history.js +0 -34
- package/dist/es/component/store/store.js +0 -99
- package/dist/es/index.js +0 -79
- package/dist/es/init.js +0 -17
- package/dist/index.css +0 -595
- package/dist/index.js +0 -1
- package/dist/lib/assets/close.909351c0.svg +0 -4
- package/dist/lib/assets/history.164a4eab.svg +0 -4
- package/dist/lib/assets/magnifying-glass.9498e70e.svg +0 -12
- package/dist/lib/assets/setting.80ab7285.svg +0 -11
- package/dist/lib/component/common.css +0 -0
- /package/dist/es/component/{common.css → playground/playground-types.mjs} +0 -0
|
@@ -1,290 +1,332 @@
|
|
|
1
1
|
body {
|
|
2
2
|
margin: 0;
|
|
3
|
-
font-family:
|
|
4
|
-
-apple-system,
|
|
5
|
-
BlinkMacSystemFont,
|
|
6
|
-
"Segoe UI",
|
|
7
|
-
"Noto Sans",
|
|
8
|
-
Helvetica,
|
|
9
|
-
Arial,
|
|
10
|
-
sans-serif,
|
|
11
|
-
"Apple Color Emoji",
|
|
12
|
-
"Segoe UI Emoji";
|
|
3
|
+
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Noto Sans, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji;
|
|
13
4
|
font-size: 14px;
|
|
14
5
|
}
|
|
6
|
+
|
|
15
7
|
.prompt-input-wrapper {
|
|
16
8
|
width: 100%;
|
|
17
9
|
}
|
|
10
|
+
|
|
18
11
|
.prompt-input-wrapper .mode-radio-group-wrapper {
|
|
19
|
-
display: flex;
|
|
20
|
-
align-items: center;
|
|
21
12
|
justify-content: space-between;
|
|
13
|
+
align-items: center;
|
|
14
|
+
display: flex;
|
|
22
15
|
}
|
|
16
|
+
|
|
23
17
|
.prompt-input-wrapper .mode-radio-group-wrapper .mode-radio-group {
|
|
24
|
-
display: flex;
|
|
25
18
|
align-items: center;
|
|
26
19
|
height: 100%;
|
|
20
|
+
display: flex;
|
|
27
21
|
}
|
|
22
|
+
|
|
28
23
|
.prompt-input-wrapper .mode-radio-group-wrapper .mode-radio-group .ant-radio-button-wrapper {
|
|
29
24
|
height: 24px;
|
|
30
|
-
padding: 0 8px;
|
|
31
|
-
line-height: 24px;
|
|
32
|
-
border-radius: 11px;
|
|
33
|
-
margin-right: 8px;
|
|
34
25
|
box-shadow: none;
|
|
26
|
+
background-color: #f7f7f7;
|
|
35
27
|
border: none;
|
|
36
|
-
|
|
28
|
+
border-radius: 11px;
|
|
29
|
+
margin-right: 8px;
|
|
30
|
+
padding: 0 8px;
|
|
37
31
|
font-size: 12px;
|
|
32
|
+
line-height: 24px;
|
|
38
33
|
}
|
|
34
|
+
|
|
39
35
|
.prompt-input-wrapper .mode-radio-group-wrapper .mode-radio-group .ant-radio-button-wrapper:before {
|
|
40
36
|
display: none;
|
|
41
37
|
}
|
|
38
|
+
|
|
42
39
|
.prompt-input-wrapper .mode-radio-group-wrapper .mode-radio-group .ant-radio-button-wrapper:focus-within {
|
|
43
40
|
outline: none;
|
|
44
41
|
}
|
|
42
|
+
|
|
45
43
|
.prompt-input-wrapper .mode-radio-group-wrapper .mode-radio-group .ant-radio-button-wrapper.ant-radio-button-wrapper-checked {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
color:
|
|
44
|
+
color: #fff;
|
|
45
|
+
background-color: #2b83ff;
|
|
46
|
+
border-color: #2b83ff;
|
|
49
47
|
}
|
|
48
|
+
|
|
50
49
|
.prompt-input-wrapper .mode-radio-group-wrapper .mode-radio-group .ant-radio-button-wrapper.ant-radio-button-wrapper-checked:hover {
|
|
51
50
|
color: #fff;
|
|
52
51
|
}
|
|
52
|
+
|
|
53
53
|
.prompt-input-wrapper .mode-radio-group-wrapper .mode-radio-group .ant-radio-button-wrapper:hover {
|
|
54
|
-
color: #
|
|
54
|
+
color: #2b83ff;
|
|
55
55
|
}
|
|
56
|
+
|
|
56
57
|
.prompt-input-wrapper .mode-radio-group-wrapper .action-icons {
|
|
57
|
-
display: flex;
|
|
58
58
|
align-items: center;
|
|
59
|
+
display: flex;
|
|
59
60
|
}
|
|
61
|
+
|
|
60
62
|
.prompt-input-wrapper .main-side-console-input {
|
|
61
|
-
position: relative;
|
|
62
63
|
margin-top: 10px;
|
|
64
|
+
position: relative;
|
|
63
65
|
}
|
|
66
|
+
|
|
64
67
|
.prompt-input-wrapper .main-side-console-input .main-side-console-input-textarea {
|
|
68
|
+
white-space: pre-wrap;
|
|
69
|
+
scrollbar-width: thin;
|
|
70
|
+
background: #fff;
|
|
71
|
+
border: 1px solid #f2f4f7;
|
|
65
72
|
border-radius: 12px;
|
|
66
|
-
border: 1px solid #F2F4F7;
|
|
67
|
-
background: white;
|
|
68
73
|
padding: 12px 16px;
|
|
69
|
-
transition: background-color 0.2s ease;
|
|
70
|
-
overflow-y: auto;
|
|
71
|
-
white-space: pre-wrap;
|
|
72
74
|
line-height: 21px;
|
|
73
|
-
|
|
75
|
+
transition: background-color .2s;
|
|
76
|
+
overflow-y: auto;
|
|
74
77
|
}
|
|
78
|
+
|
|
75
79
|
@keyframes hue-shift {
|
|
76
80
|
0% {
|
|
77
|
-
filter: hue-rotate(
|
|
81
|
+
filter: hue-rotate();
|
|
78
82
|
}
|
|
83
|
+
|
|
79
84
|
100% {
|
|
80
85
|
filter: hue-rotate(360deg);
|
|
81
86
|
}
|
|
82
87
|
}
|
|
88
|
+
|
|
83
89
|
.prompt-input-wrapper .main-side-console-input .main-side-console-input-textarea:focus-within {
|
|
84
|
-
|
|
85
|
-
|
|
90
|
+
background: linear-gradient(#fff, #fff) padding-box padding-box, linear-gradient(135deg, #4285f4 0%, #06f 25%, #7b02c5 50%, #ea4335 75%, #ff7043 100%) border-box;
|
|
91
|
+
border: 1px solid rgba(0, 0, 0, 0);
|
|
86
92
|
}
|
|
93
|
+
|
|
87
94
|
.prompt-input-wrapper .main-side-console-input .main-side-console-input-textarea::-webkit-scrollbar {
|
|
88
95
|
width: 6px;
|
|
89
96
|
}
|
|
97
|
+
|
|
90
98
|
.prompt-input-wrapper .main-side-console-input .main-side-console-input-textarea::-webkit-scrollbar-thumb {
|
|
91
|
-
background-color: rgba(0, 0, 0,
|
|
99
|
+
background-color: rgba(0, 0, 0, .2);
|
|
92
100
|
border-radius: 3px;
|
|
93
101
|
}
|
|
102
|
+
|
|
94
103
|
.prompt-input-wrapper .main-side-console-input.loading .main-side-console-input-textarea {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
animation:
|
|
104
|
+
background: linear-gradient(#fff, #fff) padding-box padding-box, linear-gradient(135deg, #4285f4 0%, #06f 25%, #7b02c5 50%, #ea4335 75%, #ff7043 100%) border-box;
|
|
105
|
+
border: 1px solid rgba(0, 0, 0, 0);
|
|
106
|
+
animation: 5s linear infinite hue-shift;
|
|
98
107
|
}
|
|
108
|
+
|
|
99
109
|
.prompt-input-wrapper .main-side-console-input .ant-form-item-control-input-content {
|
|
100
|
-
border: 3px solid transparent;
|
|
101
|
-
border-radius: 14px;
|
|
102
110
|
z-index: 999;
|
|
111
|
+
border: 3px solid rgba(0, 0, 0, 0);
|
|
112
|
+
border-radius: 14px;
|
|
103
113
|
}
|
|
114
|
+
|
|
104
115
|
.prompt-input-wrapper .main-side-console-input:focus-within .ant-form-item-control-input-content {
|
|
105
|
-
border-color: rgba(43, 131, 255,
|
|
116
|
+
border-color: rgba(43, 131, 255, .16);
|
|
106
117
|
}
|
|
118
|
+
|
|
107
119
|
.prompt-input-wrapper .main-side-console-input.disabled .form-controller-wrapper {
|
|
108
|
-
background-color:
|
|
120
|
+
background-color: rgba(0, 0, 0, 0);
|
|
109
121
|
}
|
|
122
|
+
|
|
110
123
|
.prompt-input-wrapper .ant-input {
|
|
111
124
|
padding-bottom: 40px;
|
|
112
125
|
}
|
|
126
|
+
|
|
113
127
|
.prompt-input-wrapper .form-controller-wrapper {
|
|
114
|
-
|
|
115
|
-
|
|
128
|
+
box-sizing: border-box;
|
|
129
|
+
background-color: #fff;
|
|
116
130
|
flex-direction: row;
|
|
117
131
|
justify-content: flex-end;
|
|
118
|
-
width: calc(100% - 32px);
|
|
119
|
-
box-sizing: border-box;
|
|
120
132
|
align-items: flex-end;
|
|
121
133
|
gap: 8px;
|
|
122
|
-
|
|
123
|
-
left: 16px;
|
|
124
|
-
bottom: 0.5px;
|
|
134
|
+
width: calc(100% - 32px);
|
|
125
135
|
padding: 12px 0;
|
|
126
136
|
line-height: 32px;
|
|
127
|
-
transition: background-color
|
|
137
|
+
transition: background-color .2s;
|
|
138
|
+
display: flex;
|
|
139
|
+
position: absolute;
|
|
140
|
+
bottom: .5px;
|
|
141
|
+
left: 16px;
|
|
128
142
|
}
|
|
143
|
+
|
|
129
144
|
.prompt-input-wrapper .settings-wrapper {
|
|
130
|
-
display: flex;
|
|
131
|
-
flex-direction: row;
|
|
132
|
-
gap: 2px;
|
|
133
145
|
color: #777;
|
|
134
|
-
flex-
|
|
146
|
+
flex-flow: wrap;
|
|
147
|
+
gap: 2px;
|
|
148
|
+
display: flex;
|
|
135
149
|
}
|
|
150
|
+
|
|
136
151
|
.prompt-input-wrapper .settings-wrapper.settings-wrapper-hover {
|
|
137
152
|
color: #3b3b3b;
|
|
138
153
|
}
|
|
154
|
+
|
|
139
155
|
.selector-trigger {
|
|
156
|
+
cursor: pointer;
|
|
140
157
|
width: 24px;
|
|
141
158
|
height: 24px;
|
|
142
|
-
|
|
143
|
-
transition: all 0.2s ease;
|
|
159
|
+
transition: all .2s;
|
|
144
160
|
}
|
|
161
|
+
|
|
145
162
|
.selector-trigger .action-icon {
|
|
163
|
+
color: rgba(0, 0, 0, .85);
|
|
146
164
|
font-size: 14px;
|
|
147
|
-
|
|
148
|
-
transition: all 0.2s;
|
|
165
|
+
transition: all .2s;
|
|
149
166
|
}
|
|
167
|
+
|
|
150
168
|
.selector-trigger .action-icon:hover {
|
|
151
|
-
color: #
|
|
169
|
+
color: #2b83ff;
|
|
152
170
|
}
|
|
171
|
+
|
|
153
172
|
.history-modal-container {
|
|
173
|
+
border-radius: 12px 12px 0 0;
|
|
174
|
+
flex-direction: column;
|
|
154
175
|
height: 70vh;
|
|
155
176
|
display: flex;
|
|
156
|
-
flex-direction: column;
|
|
157
|
-
border-radius: 12px 12px 0 0;
|
|
158
177
|
overflow: hidden;
|
|
159
178
|
}
|
|
179
|
+
|
|
160
180
|
.history-modal-container .history-modal-header {
|
|
161
|
-
display: flex;
|
|
162
181
|
justify-content: space-between;
|
|
163
182
|
align-items: center;
|
|
164
183
|
height: 48px;
|
|
165
|
-
line-height: 48px;
|
|
166
184
|
padding: 0 25px;
|
|
185
|
+
line-height: 48px;
|
|
186
|
+
display: flex;
|
|
167
187
|
}
|
|
188
|
+
|
|
168
189
|
.history-modal-container .history-modal-header .close-button {
|
|
190
|
+
justify-content: center;
|
|
191
|
+
align-items: center;
|
|
169
192
|
margin-right: -4px;
|
|
170
193
|
padding: 4px;
|
|
171
194
|
display: flex;
|
|
172
|
-
align-items: center;
|
|
173
|
-
justify-content: center;
|
|
174
195
|
}
|
|
196
|
+
|
|
175
197
|
.history-modal-container .history-modal-header .close-button .anticon {
|
|
198
|
+
color: #999;
|
|
176
199
|
font-size: 18px;
|
|
177
|
-
color: #999999;
|
|
178
200
|
}
|
|
201
|
+
|
|
179
202
|
.history-modal-container .history-modal-header .close-button:hover .anticon {
|
|
180
|
-
color: #
|
|
203
|
+
color: #666;
|
|
181
204
|
}
|
|
205
|
+
|
|
182
206
|
.history-modal-container .history-search-section {
|
|
207
|
+
background: #fff;
|
|
183
208
|
padding: 16px 20px;
|
|
184
|
-
background: #ffffff;
|
|
185
209
|
}
|
|
210
|
+
|
|
186
211
|
.history-modal-container .history-search-section .search-input-wrapper {
|
|
187
|
-
|
|
212
|
+
color: rgba(0, 0, 0, .25);
|
|
188
213
|
align-items: center;
|
|
189
214
|
gap: 12px;
|
|
190
|
-
|
|
215
|
+
display: flex;
|
|
191
216
|
}
|
|
217
|
+
|
|
192
218
|
.history-modal-container .history-search-section .search-input-wrapper .search-input {
|
|
193
|
-
flex: 1 1;
|
|
194
|
-
height: 36px;
|
|
195
|
-
border-radius: 16px;
|
|
196
219
|
background: #f1f2f3;
|
|
197
220
|
border: none;
|
|
221
|
+
border-radius: 16px;
|
|
222
|
+
flex: 1;
|
|
223
|
+
height: 36px;
|
|
198
224
|
}
|
|
225
|
+
|
|
199
226
|
.history-modal-container .history-search-section .search-input-wrapper .search-input .ant-input {
|
|
200
|
-
background: transparent;
|
|
201
|
-
border: none;
|
|
202
227
|
box-shadow: none;
|
|
228
|
+
background: none;
|
|
229
|
+
border: none;
|
|
203
230
|
}
|
|
204
|
-
|
|
205
|
-
.history-modal-container .history-search-section .search-input-wrapper .search-input:focus-within {
|
|
231
|
+
|
|
232
|
+
.history-modal-container .history-search-section .search-input-wrapper .search-input:hover, .history-modal-container .history-search-section .search-input-wrapper .search-input:focus-within {
|
|
233
|
+
background: #fff;
|
|
206
234
|
border-color: #d9d9d9;
|
|
207
|
-
background: #ffffff;
|
|
208
235
|
}
|
|
236
|
+
|
|
209
237
|
.history-modal-container .history-search-section .search-input-wrapper .clear-button {
|
|
210
238
|
color: #1890ff;
|
|
211
|
-
padding: 0;
|
|
212
239
|
height: auto;
|
|
240
|
+
padding: 0;
|
|
213
241
|
}
|
|
242
|
+
|
|
214
243
|
.history-modal-container .history-search-section .search-input-wrapper .clear-button:hover {
|
|
215
244
|
color: #40a9ff;
|
|
216
245
|
}
|
|
246
|
+
|
|
217
247
|
.history-modal-container .history-content {
|
|
218
|
-
flex: 1
|
|
248
|
+
flex: 1;
|
|
249
|
+
padding: 0 25px 25px;
|
|
219
250
|
overflow-y: auto;
|
|
220
|
-
padding: 0 25px 25px 25px;
|
|
221
251
|
}
|
|
252
|
+
|
|
222
253
|
.history-modal-container .history-content .history-group {
|
|
223
254
|
margin-bottom: 10px;
|
|
224
255
|
}
|
|
256
|
+
|
|
225
257
|
.history-modal-container .history-content .history-group .history-group-title {
|
|
226
|
-
|
|
227
|
-
color: rgba(0, 0, 0, 0.45);
|
|
258
|
+
color: rgba(0, 0, 0, .45);
|
|
228
259
|
height: 40px;
|
|
229
|
-
|
|
260
|
+
font-size: 12px;
|
|
230
261
|
font-weight: 400;
|
|
262
|
+
line-height: 40px;
|
|
231
263
|
}
|
|
264
|
+
|
|
232
265
|
.history-modal-container .history-content .history-group .history-item {
|
|
233
266
|
cursor: pointer;
|
|
267
|
+
color: rgba(0, 0, 0, .85);
|
|
268
|
+
white-space: nowrap;
|
|
269
|
+
text-overflow: ellipsis;
|
|
234
270
|
height: 40px;
|
|
235
|
-
line-height: 40px;
|
|
236
271
|
font-size: 14px;
|
|
237
|
-
|
|
272
|
+
line-height: 40px;
|
|
238
273
|
overflow: hidden;
|
|
239
|
-
white-space: nowrap;
|
|
240
|
-
text-overflow: ellipsis;
|
|
241
274
|
}
|
|
275
|
+
|
|
242
276
|
.history-modal-container .history-content .history-group .history-item:hover {
|
|
243
277
|
background: #f2f4f7;
|
|
244
|
-
padding: 0 8px;
|
|
245
278
|
margin: 0 -8px;
|
|
279
|
+
padding: 0 8px;
|
|
246
280
|
}
|
|
281
|
+
|
|
247
282
|
.history-modal-container .history-content .no-results {
|
|
248
283
|
text-align: center;
|
|
284
|
+
color: #999;
|
|
249
285
|
padding: 40px 20px;
|
|
250
|
-
color: #999999;
|
|
251
286
|
}
|
|
287
|
+
|
|
252
288
|
.ant-modal-wrap .ant-modal-content {
|
|
253
|
-
animation:
|
|
289
|
+
animation: .3s cubic-bezier(.4, 0, .2, 1) forwards slideUpFromBottom !important;
|
|
254
290
|
}
|
|
291
|
+
|
|
255
292
|
@keyframes slideUpFromBottom {
|
|
256
293
|
0% {
|
|
257
|
-
transform: translateY(100%);
|
|
258
294
|
opacity: 0;
|
|
295
|
+
transform: translateY(100%);
|
|
259
296
|
}
|
|
297
|
+
|
|
260
298
|
100% {
|
|
261
|
-
transform: translateY(0);
|
|
262
299
|
opacity: 1;
|
|
300
|
+
transform: translateY(0);
|
|
263
301
|
}
|
|
264
302
|
}
|
|
303
|
+
|
|
265
304
|
.result-wrapper {
|
|
266
|
-
display: flex;
|
|
267
|
-
height: 100%;
|
|
268
305
|
justify-content: center;
|
|
306
|
+
height: 100%;
|
|
269
307
|
margin: 4px 0;
|
|
308
|
+
display: flex;
|
|
270
309
|
}
|
|
310
|
+
|
|
271
311
|
.result-wrapper .loading-container {
|
|
272
312
|
text-align: center;
|
|
273
313
|
}
|
|
314
|
+
|
|
274
315
|
.result-wrapper .loading-container .loading-progress-text {
|
|
275
|
-
margin-top: 8px;
|
|
276
316
|
color: #888;
|
|
317
|
+
margin-top: 8px;
|
|
277
318
|
font-size: 12px;
|
|
278
319
|
}
|
|
320
|
+
|
|
279
321
|
.result-wrapper pre {
|
|
280
|
-
margin: 4px 0;
|
|
281
|
-
margin: 0;
|
|
282
322
|
white-space: pre-wrap;
|
|
283
323
|
text-wrap: unset;
|
|
284
324
|
word-wrap: break-word;
|
|
285
325
|
overflow-wrap: break-word;
|
|
286
|
-
background: #
|
|
326
|
+
background: #f2f4f7;
|
|
287
327
|
border-radius: 8px;
|
|
328
|
+
margin: 0;
|
|
288
329
|
padding: 14px;
|
|
289
330
|
overflow: scroll;
|
|
290
331
|
}
|
|
332
|
+
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Alert } from "antd";
|
|
3
|
+
import shiny_text from "../shiny-text.mjs";
|
|
4
|
+
import "./index.css";
|
|
5
|
+
const errorMessageServerNotReady = /*#__PURE__*/ jsxs("span", {
|
|
6
|
+
children: [
|
|
7
|
+
"Don't worry, just one more step to launch the playground server.",
|
|
8
|
+
/*#__PURE__*/ jsx("br", {}),
|
|
9
|
+
"Please run one of the commands under the midscene project directory:",
|
|
10
|
+
/*#__PURE__*/ jsx("br", {}),
|
|
11
|
+
"a. ",
|
|
12
|
+
/*#__PURE__*/ jsx("strong", {
|
|
13
|
+
children: "npx midscene-playground"
|
|
14
|
+
}),
|
|
15
|
+
/*#__PURE__*/ jsx("br", {}),
|
|
16
|
+
"b. ",
|
|
17
|
+
/*#__PURE__*/ jsx("strong", {
|
|
18
|
+
children: "npx --yes @midscene/web"
|
|
19
|
+
})
|
|
20
|
+
]
|
|
21
|
+
});
|
|
22
|
+
const serverLaunchTip = function() {
|
|
23
|
+
let notReadyMessage = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : errorMessageServerNotReady;
|
|
24
|
+
return /*#__PURE__*/ jsx("div", {
|
|
25
|
+
className: "server-tip",
|
|
26
|
+
children: /*#__PURE__*/ jsx(Alert, {
|
|
27
|
+
message: "Playground Server Not Ready",
|
|
28
|
+
description: notReadyMessage,
|
|
29
|
+
type: "warning"
|
|
30
|
+
})
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
const emptyResultTip = /*#__PURE__*/ jsx("div", {
|
|
34
|
+
className: "result-empty-tip",
|
|
35
|
+
style: {
|
|
36
|
+
textAlign: 'center'
|
|
37
|
+
},
|
|
38
|
+
children: /*#__PURE__*/ jsx(shiny_text, {
|
|
39
|
+
disabled: true,
|
|
40
|
+
text: "The result will be shown here"
|
|
41
|
+
})
|
|
42
|
+
});
|
|
43
|
+
const trackingTip = 'limit popup to current tab';
|
|
44
|
+
const deepThinkTip = 'deep think';
|
|
45
|
+
export { deepThinkTip, emptyResultTip, errorMessageServerNotReady, serverLaunchTip, trackingTip };
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { PLAYGROUND_SERVER_PORT } from "@midscene/shared/constants";
|
|
2
|
+
import { ERROR_CODE_NOT_IMPLEMENTED_AS_DESIGNED, StaticPage, StaticPageAgent } from "@midscene/web/playground";
|
|
3
|
+
const serverBase = `http://localhost:${PLAYGROUND_SERVER_PORT}`;
|
|
4
|
+
const checkServerStatus = async ()=>{
|
|
5
|
+
try {
|
|
6
|
+
const res = await fetch(`${serverBase}/status`);
|
|
7
|
+
return 200 === res.status;
|
|
8
|
+
} catch (e) {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
const requestPlaygroundServer = async function(context, type, prompt) {
|
|
13
|
+
let { requestId, deepThink } = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : {};
|
|
14
|
+
const payload = {
|
|
15
|
+
context,
|
|
16
|
+
type,
|
|
17
|
+
prompt
|
|
18
|
+
};
|
|
19
|
+
if (requestId) payload.requestId = requestId;
|
|
20
|
+
if (deepThink) payload.deepThink = deepThink;
|
|
21
|
+
const res = await fetch(`${serverBase}/execute`, {
|
|
22
|
+
method: 'POST',
|
|
23
|
+
headers: {
|
|
24
|
+
'Content-Type': 'application/json'
|
|
25
|
+
},
|
|
26
|
+
body: JSON.stringify(payload)
|
|
27
|
+
});
|
|
28
|
+
return res.json();
|
|
29
|
+
};
|
|
30
|
+
const overrideServerConfig = async (aiConfig)=>fetch(`${serverBase}/config`, {
|
|
31
|
+
method: 'POST',
|
|
32
|
+
headers: {
|
|
33
|
+
'Content-Type': 'application/json'
|
|
34
|
+
},
|
|
35
|
+
body: JSON.stringify({
|
|
36
|
+
aiConfig
|
|
37
|
+
})
|
|
38
|
+
});
|
|
39
|
+
const cancelTask = async (requestId)=>{
|
|
40
|
+
try {
|
|
41
|
+
const res = await fetch(`${serverBase}/cancel/${requestId}`);
|
|
42
|
+
return res.json();
|
|
43
|
+
} catch (error) {
|
|
44
|
+
console.error('Failed to cancel task:', error);
|
|
45
|
+
return {
|
|
46
|
+
error: 'Failed to cancel task'
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
const getTaskProgress = async (requestId)=>{
|
|
51
|
+
try {
|
|
52
|
+
const response = await fetch(`${serverBase}/task-progress/${requestId}`);
|
|
53
|
+
return await response.json();
|
|
54
|
+
} catch (error) {
|
|
55
|
+
console.error('Failed to poll task progress:', error);
|
|
56
|
+
return {
|
|
57
|
+
tip: null
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
const actionNameForType = (type)=>{
|
|
62
|
+
if ('aiAction' === type) return 'Action';
|
|
63
|
+
if ('aiQuery' === type) return 'Query';
|
|
64
|
+
if ('aiAssert' === type) return 'Assert';
|
|
65
|
+
if ('aiTap' === type) return 'Tap';
|
|
66
|
+
return type;
|
|
67
|
+
};
|
|
68
|
+
const staticAgentFromContext = (context)=>{
|
|
69
|
+
const page = new StaticPage(context);
|
|
70
|
+
return new StaticPageAgent(page);
|
|
71
|
+
};
|
|
72
|
+
const formatErrorMessage = (e)=>{
|
|
73
|
+
const errorMessage = (null == e ? void 0 : e.message) || '';
|
|
74
|
+
if (errorMessage.includes('of different extension')) return 'Conflicting extension detected. Please disable the suspicious plugins and refresh the page. Guide: https://midscenejs.com/quick-experience.html#faq';
|
|
75
|
+
if (!(null == errorMessage ? void 0 : errorMessage.includes(ERROR_CODE_NOT_IMPLEMENTED_AS_DESIGNED))) return errorMessage;
|
|
76
|
+
return 'Unknown error';
|
|
77
|
+
};
|
|
78
|
+
const getPlaceholderForType = (type)=>{
|
|
79
|
+
if ('aiQuery' === type) return 'What do you want to query?';
|
|
80
|
+
if ('aiAssert' === type) return 'What do you want to assert?';
|
|
81
|
+
return 'What do you want to do?';
|
|
82
|
+
};
|
|
83
|
+
const blankResult = {
|
|
84
|
+
result: null,
|
|
85
|
+
dump: null,
|
|
86
|
+
reportHTML: null,
|
|
87
|
+
error: null
|
|
88
|
+
};
|
|
89
|
+
export { actionNameForType, blankResult, cancelTask, checkServerStatus, formatErrorMessage, getPlaceholderForType, getTaskProgress, overrideServerConfig, requestPlaygroundServer, serverBase, staticAgentFromContext };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import { useEnvConfig } from "../store/store.mjs";
|
|
3
|
+
import { checkServerStatus } from "./playground-utils.mjs";
|
|
4
|
+
const useServerValid = function() {
|
|
5
|
+
let shouldRun = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : true;
|
|
6
|
+
const [serverValid, setServerValid] = useState(true);
|
|
7
|
+
const { serviceMode } = useEnvConfig();
|
|
8
|
+
useEffect(()=>{
|
|
9
|
+
let interruptFlag = false;
|
|
10
|
+
if (!shouldRun) return;
|
|
11
|
+
Promise.resolve((async ()=>{
|
|
12
|
+
while(!interruptFlag){
|
|
13
|
+
const status = await checkServerStatus();
|
|
14
|
+
status ? setServerValid(true) : setServerValid(false);
|
|
15
|
+
await new Promise((resolve)=>setTimeout(resolve, 1000));
|
|
16
|
+
}
|
|
17
|
+
})());
|
|
18
|
+
return ()=>{
|
|
19
|
+
interruptFlag = true;
|
|
20
|
+
};
|
|
21
|
+
}, [
|
|
22
|
+
serviceMode,
|
|
23
|
+
shouldRun
|
|
24
|
+
]);
|
|
25
|
+
return serverValid;
|
|
26
|
+
};
|
|
27
|
+
export { useServerValid };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import { staticAgentFromContext } from "./playground-utils.mjs";
|
|
3
|
+
const useStaticPageAgent = (context)=>{
|
|
4
|
+
const agent = useMemo(()=>{
|
|
5
|
+
if (!context) return null;
|
|
6
|
+
return staticAgentFromContext(context);
|
|
7
|
+
}, [
|
|
8
|
+
context
|
|
9
|
+
]);
|
|
10
|
+
return agent;
|
|
11
|
+
};
|
|
12
|
+
export { staticAgentFromContext, useStaticPageAgent };
|