@midscene/visualizer 0.28.2 → 0.28.3-beta-20250910131004.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.
Files changed (134) hide show
  1. package/dist/es/component/{blackboard.mjs → blackboard/index.mjs} +3 -3
  2. package/dist/es/component/{playground/ConfigSelector.mjs → config-selector/index.mjs} +2 -3
  3. package/dist/es/component/{playground/ContextPreview.mjs → context-preview/index.mjs} +3 -4
  4. package/dist/es/component/{env-config.mjs → env-config/index.mjs} +1 -1
  5. package/dist/es/component/{github-star.mjs → github-star/index.mjs} +1 -1
  6. package/dist/es/component/history-selector/index.css +132 -0
  7. package/dist/es/component/{playground/HistorySelector.mjs → history-selector/index.mjs} +1 -1
  8. package/dist/es/component/index.mjs +1 -0
  9. package/dist/es/component/{logo.mjs → logo/index.mjs} +1 -1
  10. package/dist/es/component/{misc.mjs → misc/index.mjs} +42 -2
  11. package/dist/es/component/{player.mjs → player/index.mjs} +8 -8
  12. package/dist/es/component/playground/index.css +35 -161
  13. package/dist/es/component/playground/index.mjs +8 -0
  14. package/dist/es/component/playground-result/index.css +35 -0
  15. package/dist/es/component/{playground/PlaygroundResult.mjs → playground-result/index.mjs} +7 -5
  16. package/dist/es/component/prompt-input/index.css +330 -0
  17. package/dist/es/component/{playground/PromptInput.mjs → prompt-input/index.mjs} +9 -9
  18. package/dist/es/component/{playground/ServiceModeControl.mjs → service-mode-control/index.mjs} +4 -5
  19. package/dist/es/component/{shiny-text.mjs → shiny-text/index.mjs} +1 -1
  20. package/dist/es/component/universal-playground/index.css +341 -0
  21. package/dist/es/component/universal-playground/index.mjs +273 -0
  22. package/dist/es/component/universal-playground/providers/context-provider.mjs +52 -0
  23. package/dist/es/component/universal-playground/providers/storage-provider.mjs +107 -0
  24. package/dist/es/hooks/usePlaygroundExecution.mjs +168 -0
  25. package/dist/es/hooks/usePlaygroundState.mjs +176 -0
  26. package/dist/es/icons/avatar.mjs +28 -0
  27. package/dist/es/index.mjs +22 -18
  28. package/dist/es/{component/playground/playground-constants.mjs → utils/constants.mjs} +23 -43
  29. package/dist/es/{component/playground → utils}/playground-utils.mjs +1 -1
  30. package/dist/es/{component → utils}/replay-scripts.mjs +1 -2
  31. package/dist/lib/component/{blackboard.js → blackboard/index.js} +5 -5
  32. package/dist/lib/component/{playground/ConfigSelector.js → config-selector/index.js} +6 -7
  33. package/dist/lib/component/{playground/ContextPreview.js → context-preview/index.js} +8 -9
  34. package/dist/lib/component/{env-config.js → env-config/index.js} +1 -1
  35. package/dist/lib/component/{github-star.js → github-star/index.js} +1 -1
  36. package/dist/lib/component/history-selector/index.css +132 -0
  37. package/dist/lib/component/{playground/HistorySelector.js → history-selector/index.js} +1 -1
  38. package/dist/lib/component/index.js +60 -0
  39. package/dist/lib/component/{logo.js → logo/index.js} +1 -1
  40. package/dist/lib/component/{misc.js → misc/index.js} +60 -1
  41. package/dist/lib/component/{player.js → player/index.js} +23 -23
  42. package/dist/lib/component/playground/index.css +35 -161
  43. package/dist/lib/component/playground/index.js +113 -0
  44. package/dist/lib/component/playground-result/index.css +35 -0
  45. package/dist/lib/component/{playground/PlaygroundResult.js → playground-result/index.js} +12 -10
  46. package/dist/lib/component/prompt-input/index.css +330 -0
  47. package/dist/lib/component/{playground/PromptInput.js → prompt-input/index.js} +37 -37
  48. package/dist/lib/component/{playground/ServiceModeControl.js → service-mode-control/index.js} +8 -9
  49. package/dist/lib/component/{shiny-text.js → shiny-text/index.js} +1 -1
  50. package/dist/lib/component/universal-playground/index.css +341 -0
  51. package/dist/lib/component/universal-playground/index.js +321 -0
  52. package/dist/lib/component/universal-playground/providers/context-provider.js +95 -0
  53. package/dist/lib/component/universal-playground/providers/storage-provider.js +147 -0
  54. package/dist/lib/hooks/usePlaygroundExecution.js +202 -0
  55. package/dist/lib/hooks/usePlaygroundState.js +210 -0
  56. package/dist/lib/icons/avatar.js +62 -0
  57. package/dist/lib/index.js +66 -34
  58. package/dist/lib/{component/playground/playground-constants.js → utils/constants.js} +31 -64
  59. package/dist/lib/{component/playground → utils}/playground-utils.js +1 -1
  60. package/dist/lib/{component → utils}/replay-scripts.js +3 -4
  61. package/dist/types/component/{blackboard.d.ts → blackboard/index.d.ts} +2 -2
  62. package/dist/types/component/{playground/ConfigSelector.d.ts → config-selector/index.d.ts} +0 -1
  63. package/dist/types/component/{playground/ContextPreview.d.ts → context-preview/index.d.ts} +0 -1
  64. package/dist/types/component/{github-star.d.ts → github-star/index.d.ts} +1 -1
  65. package/dist/types/component/{playground/HistorySelector.d.ts → history-selector/index.d.ts} +1 -1
  66. package/dist/types/component/index.d.ts +1 -0
  67. package/dist/types/component/{logo.d.ts → logo/index.d.ts} +1 -1
  68. package/dist/types/component/misc/index.d.ts +6 -0
  69. package/dist/types/component/{player.d.ts → player/index.d.ts} +2 -2
  70. package/dist/types/component/playground/index.d.ts +7 -0
  71. package/dist/types/component/{playground/PlaygroundResult.d.ts → playground-result/index.d.ts} +3 -4
  72. package/dist/types/component/{playground/PromptInput.d.ts → prompt-input/index.d.ts} +3 -2
  73. package/dist/types/component/{playground/ServiceModeControl.d.ts → service-mode-control/index.d.ts} +0 -1
  74. package/dist/types/component/{shiny-text.d.ts → shiny-text/index.d.ts} +1 -1
  75. package/dist/types/component/universal-playground/index.d.ts +4 -0
  76. package/dist/types/component/universal-playground/providers/context-provider.d.ts +37 -0
  77. package/dist/types/component/universal-playground/providers/storage-provider.d.ts +33 -0
  78. package/dist/types/hooks/usePlaygroundExecution.d.ts +10 -0
  79. package/dist/types/hooks/usePlaygroundState.d.ts +26 -0
  80. package/dist/types/index.d.ts +15 -10
  81. package/dist/types/types.d.ts +164 -0
  82. package/dist/types/{component/playground/playground-constants.d.ts → utils/constants.d.ts} +3 -5
  83. package/dist/types/{component → utils}/replay-scripts.d.ts +0 -1
  84. package/package.json +5 -5
  85. package/dist/es/blank_polyfill.mjs +0 -2
  86. package/dist/es/component/describer.css +0 -25
  87. package/dist/es/component/playground/playground-types.mjs +0 -0
  88. package/dist/es/init.mjs +0 -10
  89. package/dist/lib/blank_polyfill.js +0 -36
  90. package/dist/lib/component/describer.css +0 -25
  91. package/dist/lib/component/playground/playground-types.js +0 -18
  92. package/dist/lib/init.js +0 -44
  93. package/dist/types/blank_polyfill.d.ts +0 -2
  94. package/dist/types/component/misc.d.ts +0 -2
  95. package/dist/types/component/playground/playground-types.d.ts +0 -19
  96. package/dist/types/component/playground/types.d.ts +0 -72
  97. package/dist/types/init.d.ts +0 -1
  98. /package/dist/es/component/{blackboard.css → blackboard/index.css} +0 -0
  99. /package/dist/es/component/{playground/FormField.mjs → form-field/index.mjs} +0 -0
  100. /package/dist/es/component/{github-star.css → github-star/index.css} +0 -0
  101. /package/dist/es/component/{logo.css → logo/index.css} +0 -0
  102. /package/dist/es/component/{player.css → player/index.css} +0 -0
  103. /package/dist/es/component/{playground-demo-ui-context.json → playground/playground-demo-ui-context.json} +0 -0
  104. /package/dist/es/component/{shiny-text.css → shiny-text/index.css} +0 -0
  105. /package/dist/es/{component/playground → hooks}/useServerValid.mjs +0 -0
  106. /package/dist/es/{component/store → store}/history.mjs +0 -0
  107. /package/dist/es/{component/store → store}/store.mjs +0 -0
  108. /package/dist/es/{component/playground/types.mjs → types.mjs} +0 -0
  109. /package/dist/es/{component → utils}/color.mjs +0 -0
  110. /package/dist/es/{utils.mjs → utils/index.mjs} +0 -0
  111. /package/dist/es/{component → utils}/pixi-loader.mjs +0 -0
  112. /package/dist/lib/component/{blackboard.css → blackboard/index.css} +0 -0
  113. /package/dist/lib/component/{playground/FormField.js → form-field/index.js} +0 -0
  114. /package/dist/lib/component/{github-star.css → github-star/index.css} +0 -0
  115. /package/dist/lib/component/{logo.css → logo/index.css} +0 -0
  116. /package/dist/lib/component/{player.css → player/index.css} +0 -0
  117. /package/dist/lib/component/{playground-demo-ui-context.json → playground/playground-demo-ui-context.json} +0 -0
  118. /package/dist/lib/component/{shiny-text.css → shiny-text/index.css} +0 -0
  119. /package/dist/lib/{component/playground → hooks}/useServerValid.js +0 -0
  120. /package/dist/lib/{component/store → store}/history.js +0 -0
  121. /package/dist/lib/{component/store → store}/store.js +0 -0
  122. /package/dist/lib/{component/playground/types.js → types.js} +0 -0
  123. /package/dist/lib/{component → utils}/color.js +0 -0
  124. /package/dist/lib/{utils.js → utils/index.js} +0 -0
  125. /package/dist/lib/{component → utils}/pixi-loader.js +0 -0
  126. /package/dist/types/component/{env-config.d.ts → env-config/index.d.ts} +0 -0
  127. /package/dist/types/component/{playground/FormField.d.ts → form-field/index.d.ts} +0 -0
  128. /package/dist/types/{component/playground → hooks}/useServerValid.d.ts +0 -0
  129. /package/dist/types/{component/store → store}/history.d.ts +0 -0
  130. /package/dist/types/{component/store → store}/store.d.ts +0 -0
  131. /package/dist/types/{component → utils}/color.d.ts +0 -0
  132. /package/dist/types/{utils.d.ts → utils/index.d.ts} +0 -0
  133. /package/dist/types/{component → utils}/pixi-loader.d.ts +0 -0
  134. /package/dist/types/{component/playground → utils}/playground-utils.d.ts +0 -0
@@ -0,0 +1,341 @@
1
+ .playground-container {
2
+ background: #fff;
3
+ flex-direction: column;
4
+ width: 100%;
5
+ height: 100vh;
6
+ padding: 0 12px;
7
+ display: flex;
8
+ }
9
+
10
+ .playground-container .command-form {
11
+ flex-direction: column;
12
+ width: 100%;
13
+ height: 100%;
14
+ display: flex;
15
+ }
16
+
17
+ .playground-container .context-preview-section {
18
+ border-bottom: 1px solid #f0f0f0;
19
+ flex-shrink: 0;
20
+ padding: 16px;
21
+ }
22
+
23
+ .playground-container .middle-dialog-area {
24
+ flex-direction: column;
25
+ flex: 1;
26
+ min-height: 0;
27
+ display: flex;
28
+ position: relative;
29
+ overflow: hidden;
30
+ }
31
+
32
+ .playground-container .middle-dialog-area .clear-button-container {
33
+ z-index: 10;
34
+ position: absolute;
35
+ top: 8px;
36
+ right: 12px;
37
+ }
38
+
39
+ .playground-container .middle-dialog-area .clear-button-container .clear-button {
40
+ opacity: .7;
41
+ transition: opacity .2s;
42
+ }
43
+
44
+ .playground-container .middle-dialog-area .clear-button-container .clear-button:hover {
45
+ opacity: 1;
46
+ }
47
+
48
+ .playground-container .middle-dialog-area .info-list-container {
49
+ scrollbar-width: none;
50
+ flex: 1;
51
+ padding-top: 16px;
52
+ padding-bottom: 16px;
53
+ overflow-x: hidden;
54
+ overflow-y: auto;
55
+ }
56
+
57
+ .playground-container .middle-dialog-area .info-list-container .ant-list .ant-list-item {
58
+ border-bottom: none;
59
+ padding: 0;
60
+ }
61
+
62
+ .playground-container .middle-dialog-area .info-list-container .ant-list .ant-list-item .ant-card {
63
+ border: 1px solid #f0f0f0;
64
+ border-radius: 8px;
65
+ box-shadow: 0 1px 3px rgba(0, 0, 0, .1);
66
+ }
67
+
68
+ .playground-container .middle-dialog-area .info-list-container .ant-list .ant-list-item .ant-card:hover {
69
+ box-shadow: 0 2px 6px rgba(0, 0, 0, .15);
70
+ }
71
+
72
+ .playground-container .middle-dialog-area .info-list-container .ant-list .ant-list-item .ant-card .ant-card-body {
73
+ padding: 12px;
74
+ }
75
+
76
+ .playground-container .middle-dialog-area .info-list-container .ant-list .ant-list-empty-text {
77
+ color: #999;
78
+ font-style: italic;
79
+ }
80
+
81
+ .playground-container .middle-dialog-area .info-list-container::-webkit-scrollbar {
82
+ display: none;
83
+ }
84
+
85
+ .playground-container .middle-dialog-area .info-list-container .list-item {
86
+ background: none;
87
+ border: none;
88
+ padding: 0;
89
+ }
90
+
91
+ .playground-container .middle-dialog-area .scroll-to-bottom-button {
92
+ z-index: 10;
93
+ background: #fff;
94
+ position: absolute;
95
+ bottom: 10px;
96
+ right: 0;
97
+ box-shadow: 0 4px 8px rgba(0, 0, 0, .04);
98
+ }
99
+
100
+ .playground-container .middle-dialog-area .scroll-to-bottom-button:hover {
101
+ background: #1890ff;
102
+ }
103
+
104
+ .playground-container .middle-dialog-area .scroll-to-bottom-button:hover .anticon {
105
+ color: #fff;
106
+ }
107
+
108
+ .playground-container .middle-dialog-area .scroll-to-bottom-button .anticon {
109
+ color: #333;
110
+ font-size: 16px;
111
+ }
112
+
113
+ .playground-container .user-message-container {
114
+ justify-content: flex-end;
115
+ width: 100%;
116
+ margin: 20px 0 30px;
117
+ display: flex;
118
+ }
119
+
120
+ .playground-container .user-message-container .user-message-bubble {
121
+ color: rgba(0, 0, 0, .85);
122
+ text-align: center;
123
+ background: #f2f4f7;
124
+ border-radius: 12px;
125
+ max-width: 80%;
126
+ padding: 12px 16px;
127
+ font-size: 14px;
128
+ font-weight: 400;
129
+ display: inline-block;
130
+ }
131
+
132
+ .playground-container .progress-action-item {
133
+ color: #000;
134
+ background: #f2f4f7;
135
+ border-radius: 8px;
136
+ justify-content: space-between;
137
+ height: 36px;
138
+ margin: 4px 0;
139
+ padding: 0 12px;
140
+ font-size: 14px;
141
+ line-height: 36px;
142
+ display: flex;
143
+ }
144
+
145
+ .playground-container .progress-action-item .progress-status-icon {
146
+ margin-left: 4px;
147
+ }
148
+
149
+ .playground-container .progress-action-item .progress-status-icon.loading {
150
+ color: #1890ff;
151
+ }
152
+
153
+ .playground-container .progress-action-item .progress-status-icon.completed {
154
+ color: #52c41a;
155
+ }
156
+
157
+ .playground-container .progress-action-item .progress-status-icon.error {
158
+ color: #ff4d4f;
159
+ font-weight: bold;
160
+ }
161
+
162
+ .playground-container .progress-description {
163
+ color: #000;
164
+ padding: 8px 0;
165
+ font-size: 14px;
166
+ line-height: 22px;
167
+ display: inline-block;
168
+ }
169
+
170
+ .playground-container .system-message-container {
171
+ flex-direction: column;
172
+ display: flex;
173
+ }
174
+
175
+ .playground-container .system-message-container .system-message-header {
176
+ align-items: center;
177
+ gap: 8px;
178
+ margin: 12px 0;
179
+ display: flex;
180
+ }
181
+
182
+ .playground-container .system-message-container .system-message-header .system-message-title {
183
+ font-size: 12px;
184
+ font-weight: 400;
185
+ line-height: 100%;
186
+ }
187
+
188
+ .playground-container .system-message-container .system-message-content {
189
+ color: rgba(0, 0, 0, .85);
190
+ font-size: 14px;
191
+ }
192
+
193
+ .playground-container .system-message-container .system-message-content .system-message-text {
194
+ color: rgba(0, 0, 0, .85);
195
+ font-size: 14px;
196
+ line-height: 25px;
197
+ }
198
+
199
+ .playground-container .system-message-container .system-message-content .error-message {
200
+ color: #e51723;
201
+ word-break: break-word;
202
+ background-color: #fff;
203
+ border: none;
204
+ border-radius: 0;
205
+ align-items: flex-start;
206
+ margin-bottom: 16px;
207
+ padding: 0;
208
+ font-size: 14px;
209
+ display: flex;
210
+ }
211
+
212
+ .playground-container .system-message-container .system-message-content .error-message .divider {
213
+ background-color: #e6e8eb;
214
+ flex-shrink: 0;
215
+ align-self: stretch;
216
+ width: 1px;
217
+ min-height: 20px;
218
+ margin: 0 8px 0 0;
219
+ }
220
+
221
+ .playground-container .system-message-container .system-message-content .loading-progress-text {
222
+ color: #666;
223
+ background: #f6f8fa;
224
+ border-left: 3px solid #1890ff;
225
+ border-radius: 4px;
226
+ margin-top: 8px;
227
+ padding: 8px 12px;
228
+ font-size: 13px;
229
+ }
230
+
231
+ .playground-container .new-conversation-separator {
232
+ flex-shrink: 0;
233
+ justify-content: center;
234
+ align-items: center;
235
+ padding: 20px 0;
236
+ display: flex;
237
+ position: relative;
238
+ }
239
+
240
+ .playground-container .new-conversation-separator .separator-line {
241
+ background-color: #e8e8e8;
242
+ height: 1px;
243
+ position: absolute;
244
+ top: 50%;
245
+ left: 0;
246
+ right: 0;
247
+ }
248
+
249
+ .playground-container .new-conversation-separator .separator-text-container {
250
+ z-index: 1;
251
+ background-color: #fff;
252
+ padding: 0 16px;
253
+ position: relative;
254
+ }
255
+
256
+ .playground-container .new-conversation-separator .separator-text-container .separator-text {
257
+ color: #999;
258
+ background-color: #fff;
259
+ font-size: 12px;
260
+ }
261
+
262
+ .playground-container .bottom-input-section {
263
+ background-color: #fff;
264
+ flex-shrink: 0;
265
+ padding: 16px 0 0;
266
+ }
267
+
268
+ .playground-container .version-info-section {
269
+ flex-shrink: 0;
270
+ justify-content: center;
271
+ align-items: center;
272
+ height: 38px;
273
+ display: flex;
274
+ }
275
+
276
+ .playground-container .version-text {
277
+ color: #999;
278
+ text-align: center;
279
+ font-size: 12px;
280
+ }
281
+
282
+ .playground-container .hidden-result-ref {
283
+ display: none;
284
+ }
285
+
286
+ .playground-container .playground-description {
287
+ margin-bottom: 32px;
288
+ }
289
+
290
+ .playground-container .playground-description .description-zh {
291
+ color: #333;
292
+ margin: 0 0 8px;
293
+ font-size: 16px;
294
+ line-height: 1.5;
295
+ }
296
+
297
+ .playground-container .playground-description .description-en {
298
+ color: #666;
299
+ margin: 0;
300
+ font-size: 14px;
301
+ line-height: 1.5;
302
+ }
303
+
304
+ .playground-container .config-section {
305
+ margin-bottom: 24px;
306
+ }
307
+
308
+ .playground-container .config-section .config-title {
309
+ color: #333;
310
+ margin: 0 0 16px;
311
+ font-size: 18px;
312
+ font-weight: 600;
313
+ }
314
+
315
+ .playground-container .config-section .config-item {
316
+ align-items: center;
317
+ gap: 8px;
318
+ margin-bottom: 12px;
319
+ display: flex;
320
+ }
321
+
322
+ .playground-container .config-section .config-item .config-check {
323
+ color: #52c41a;
324
+ font-size: 16px;
325
+ }
326
+
327
+ .playground-container .config-section .config-item .config-label {
328
+ color: #333;
329
+ font-size: 14px;
330
+ }
331
+
332
+ .playground-container .config-section .config-link {
333
+ color: #1890ff;
334
+ font-size: 14px;
335
+ text-decoration: none;
336
+ }
337
+
338
+ .playground-container .config-section .config-link:hover {
339
+ text-decoration: underline;
340
+ }
341
+
@@ -0,0 +1,321 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.n = (module)=>{
5
+ var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
6
+ __webpack_require__.d(getter, {
7
+ a: getter
8
+ });
9
+ return getter;
10
+ };
11
+ })();
12
+ (()=>{
13
+ __webpack_require__.d = (exports1, definition)=>{
14
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
15
+ enumerable: true,
16
+ get: definition[key]
17
+ });
18
+ };
19
+ })();
20
+ (()=>{
21
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
22
+ })();
23
+ (()=>{
24
+ __webpack_require__.r = (exports1)=>{
25
+ if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
26
+ value: 'Module'
27
+ });
28
+ Object.defineProperty(exports1, '__esModule', {
29
+ value: true
30
+ });
31
+ };
32
+ })();
33
+ var __webpack_exports__ = {};
34
+ __webpack_require__.r(__webpack_exports__);
35
+ __webpack_require__.d(__webpack_exports__, {
36
+ UniversalPlayground: ()=>UniversalPlayground,
37
+ default: ()=>universal_playground
38
+ });
39
+ const jsx_runtime_namespaceObject = require("react/jsx-runtime");
40
+ const icons_namespaceObject = require("@ant-design/icons");
41
+ var icons_default = /*#__PURE__*/ __webpack_require__.n(icons_namespaceObject);
42
+ const external_antd_namespaceObject = require("antd");
43
+ const external_react_namespaceObject = require("react");
44
+ const usePlaygroundExecution_js_namespaceObject = require("../../hooks/usePlaygroundExecution.js");
45
+ const usePlaygroundState_js_namespaceObject = require("../../hooks/usePlaygroundState.js");
46
+ const store_js_namespaceObject = require("../../store/store.js");
47
+ const index_js_namespaceObject = require("../context-preview/index.js");
48
+ const external_playground_result_index_js_namespaceObject = require("../playground-result/index.js");
49
+ require("./index.css");
50
+ const avatar_js_namespaceObject = require("../../icons/avatar.js");
51
+ var avatar_js_default = /*#__PURE__*/ __webpack_require__.n(avatar_js_namespaceObject);
52
+ const external_prompt_input_index_js_namespaceObject = require("../prompt-input/index.js");
53
+ const { Text } = external_antd_namespaceObject.Typography;
54
+ function ErrorMessage(param) {
55
+ let { error } = param;
56
+ if (!error) return null;
57
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_antd_namespaceObject.Tooltip, {
58
+ title: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
59
+ style: {
60
+ whiteSpace: 'pre-wrap',
61
+ wordBreak: 'break-all'
62
+ },
63
+ children: error
64
+ }),
65
+ overlayStyle: {
66
+ maxWidth: '100vw'
67
+ },
68
+ children: [
69
+ "Error: ",
70
+ error.split('\n')[0]
71
+ ]
72
+ });
73
+ }
74
+ function UniversalPlayground(param) {
75
+ let { playgroundSDK, storage, contextProvider, config: componentConfig = {}, branding = {}, className = '', dryMode = false, showContextPreview = true } = param;
76
+ const [form] = external_antd_namespaceObject.Form.useForm();
77
+ const { deepThink, screenshotIncluded, domIncluded, config } = (0, store_js_namespaceObject.useEnvConfig)();
78
+ const { loading, setLoading, infoList, setInfoList, actionSpace, actionSpaceLoading, uiContextPreview, setUiContextPreview, showScrollToBottomButton, verticalMode, replayCounter, setReplayCounter, infoListRef, currentRunningIdRef, interruptedFlagRef, clearInfoList, refreshContext, handleScrollToBottom } = (0, usePlaygroundState_js_namespaceObject.usePlaygroundState)(playgroundSDK, storage, contextProvider);
79
+ const { handleRun: executeAction, handleStop, canStop } = (0, usePlaygroundExecution_js_namespaceObject.usePlaygroundExecution)(playgroundSDK, storage, actionSpace, loading, setLoading, infoList, setInfoList, replayCounter, setReplayCounter, verticalMode, currentRunningIdRef, interruptedFlagRef);
80
+ (0, external_react_namespaceObject.useEffect)(()=>{
81
+ const completeConfig = {
82
+ ...config,
83
+ deepThink,
84
+ screenshotIncluded,
85
+ domIncluded
86
+ };
87
+ if (playgroundSDK.overrideConfig) playgroundSDK.overrideConfig(completeConfig).catch((error)=>{
88
+ console.error('Failed to override SDK config:', error);
89
+ });
90
+ }, [
91
+ playgroundSDK,
92
+ config,
93
+ deepThink,
94
+ screenshotIncluded,
95
+ domIncluded
96
+ ]);
97
+ const handleFormRun = (0, external_react_namespaceObject.useCallback)(async ()=>{
98
+ try {
99
+ const value = form.getFieldsValue();
100
+ await executeAction(value);
101
+ } catch (error) {
102
+ external_antd_namespaceObject.message.error((null == error ? void 0 : error.message) || 'Execution failed');
103
+ }
104
+ }, [
105
+ form,
106
+ executeAction
107
+ ]);
108
+ const runButtonEnabled = !dryMode && !actionSpaceLoading;
109
+ const selectedType = external_antd_namespaceObject.Form.useWatch('type', form);
110
+ const finalShowContextPreview = showContextPreview && false !== componentConfig.showContextPreview;
111
+ const enablePersistence = false !== componentConfig.enablePersistence;
112
+ const layout = componentConfig.layout || 'vertical';
113
+ const showVersionInfo = false !== componentConfig.showVersionInfo;
114
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
115
+ className: `playground-container ${layout}-mode ${className}`.trim(),
116
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_antd_namespaceObject.Form, {
117
+ form: form,
118
+ onFinish: handleFormRun,
119
+ className: "command-form",
120
+ children: [
121
+ finalShowContextPreview && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
122
+ className: "context-preview-section",
123
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(index_js_namespaceObject.ContextPreview, {
124
+ uiContextPreview: uiContextPreview,
125
+ setUiContextPreview: setUiContextPreview,
126
+ showContextPreview: finalShowContextPreview
127
+ })
128
+ }),
129
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
130
+ className: "middle-dialog-area",
131
+ children: [
132
+ infoList.length > 1 && enablePersistence && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
133
+ className: "clear-button-container",
134
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Button, {
135
+ size: "small",
136
+ icon: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icons_namespaceObject.ClearOutlined, {}),
137
+ onClick: clearInfoList,
138
+ type: "text",
139
+ className: "clear-button"
140
+ })
141
+ }),
142
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
143
+ ref: infoListRef,
144
+ className: "info-list-container",
145
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.List, {
146
+ itemLayout: "vertical",
147
+ dataSource: infoList,
148
+ renderItem: (item)=>{
149
+ var _item_result;
150
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.List.Item, {
151
+ className: "list-item",
152
+ children: 'user' === item.type ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
153
+ className: "user-message-container",
154
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
155
+ className: "user-message-bubble",
156
+ children: item.content
157
+ })
158
+ }) : 'progress' === item.type ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
159
+ children: (()=>{
160
+ var _parts_, _item_result, _item_result1, _item_result2;
161
+ const parts = item.content.split(' - ');
162
+ const action = null == (_parts_ = parts[0]) ? void 0 : _parts_.trim();
163
+ const description = parts.slice(1).join(' - ').trim();
164
+ const currentIndex = infoList.findIndex((listItem)=>listItem.id === item.id);
165
+ const laterProgressExists = infoList.slice(currentIndex + 1).some((listItem)=>'progress' === listItem.type);
166
+ const isLatestProgress = !laterProgressExists;
167
+ const shouldShowLoading = loading && isLatestProgress;
168
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
169
+ children: [
170
+ action && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("span", {
171
+ className: "progress-action-item",
172
+ children: [
173
+ action,
174
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
175
+ className: `progress-status-icon ${shouldShowLoading ? 'loading' : (null == (_item_result = item.result) ? void 0 : _item_result.error) ? 'error' : 'completed'}`,
176
+ children: shouldShowLoading ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icons_namespaceObject.LoadingOutlined, {
177
+ spin: true
178
+ }) : (null == (_item_result1 = item.result) ? void 0 : _item_result1.error) ? "\u2717" : "\u2713"
179
+ })
180
+ ]
181
+ }),
182
+ description && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
183
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
184
+ className: "progress-description",
185
+ children: description
186
+ })
187
+ }),
188
+ (null == (_item_result2 = item.result) ? void 0 : _item_result2.error) && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(ErrorMessage, {
189
+ error: item.result.error
190
+ })
191
+ ]
192
+ });
193
+ })()
194
+ }) : 'separator' === item.type ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
195
+ className: "new-conversation-separator",
196
+ children: [
197
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
198
+ className: "separator-line"
199
+ }),
200
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
201
+ className: "separator-text-container",
202
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Text, {
203
+ type: "secondary",
204
+ className: "separator-text",
205
+ children: item.content
206
+ })
207
+ })
208
+ ]
209
+ }) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
210
+ className: "system-message-container",
211
+ children: [
212
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
213
+ className: "system-message-header",
214
+ children: [
215
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icons_default(), {
216
+ component: branding.icon || avatar_js_default(),
217
+ style: {
218
+ fontSize: 20
219
+ }
220
+ }),
221
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
222
+ className: "system-message-title",
223
+ children: branding.title || 'Playground'
224
+ })
225
+ ]
226
+ }),
227
+ (item.content || item.result) && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
228
+ className: "system-message-content",
229
+ children: [
230
+ 'result' === item.type && (null == (_item_result = item.result) ? void 0 : _item_result.error) && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
231
+ className: "error-message",
232
+ children: [
233
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
234
+ className: "divider"
235
+ }),
236
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(ErrorMessage, {
237
+ error: item.result.error
238
+ })
239
+ ]
240
+ }),
241
+ 'result' === item.type ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_playground_result_index_js_namespaceObject.PlaygroundResultView, {
242
+ result: item.result || null,
243
+ loading: item.loading || false,
244
+ serverValid: true,
245
+ serviceMode: 'Server',
246
+ replayScriptsInfo: item.replayScriptsInfo || null,
247
+ replayCounter: item.replayCounter || 0,
248
+ loadingProgressText: item.loadingProgressText || '',
249
+ verticalMode: item.verticalMode || false,
250
+ fitMode: "width"
251
+ }) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
252
+ children: [
253
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
254
+ className: "system-message-text",
255
+ children: item.content
256
+ }),
257
+ item.loading && item.loadingProgressText && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
258
+ className: "loading-progress-text",
259
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
260
+ children: item.loadingProgressText
261
+ })
262
+ })
263
+ ]
264
+ })
265
+ ]
266
+ })
267
+ ]
268
+ })
269
+ }, item.id);
270
+ }
271
+ })
272
+ }),
273
+ showScrollToBottomButton && false !== componentConfig.enableScrollToBottom && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Button, {
274
+ className: "scroll-to-bottom-button",
275
+ type: "primary",
276
+ shape: "circle",
277
+ icon: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icons_namespaceObject.ArrowDownOutlined, {}),
278
+ onClick: handleScrollToBottom,
279
+ size: "large"
280
+ })
281
+ ]
282
+ }),
283
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
284
+ className: "bottom-input-section",
285
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_prompt_input_index_js_namespaceObject.PromptInput, {
286
+ runButtonEnabled: runButtonEnabled,
287
+ form: form,
288
+ serviceMode: 'Server',
289
+ selectedType: selectedType,
290
+ dryMode: dryMode,
291
+ stoppable: canStop,
292
+ loading: loading,
293
+ onRun: handleFormRun,
294
+ onStop: handleStop,
295
+ actionSpace: actionSpace
296
+ })
297
+ }),
298
+ showVersionInfo && branding.version && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
299
+ className: "version-info-section",
300
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("span", {
301
+ className: "version-text",
302
+ children: [
303
+ "Midscene.js version: ",
304
+ branding.version
305
+ ]
306
+ })
307
+ })
308
+ ]
309
+ })
310
+ });
311
+ }
312
+ const universal_playground = UniversalPlayground;
313
+ exports.UniversalPlayground = __webpack_exports__.UniversalPlayground;
314
+ exports["default"] = __webpack_exports__["default"];
315
+ for(var __webpack_i__ in __webpack_exports__)if (-1 === [
316
+ "UniversalPlayground",
317
+ "default"
318
+ ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
319
+ Object.defineProperty(exports, '__esModule', {
320
+ value: true
321
+ });