@midscene/visualizer 0.30.10 → 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.
Files changed (123) hide show
  1. package/dist/es/component/blackboard/index.css +8 -0
  2. package/dist/es/component/blackboard/index.mjs +137 -68
  3. package/dist/es/component/config-selector/index.mjs +102 -4
  4. package/dist/es/component/context-preview/index.mjs +1 -2
  5. package/dist/es/component/env-config/index.mjs +1 -2
  6. package/dist/es/component/env-config-reminder/index.css +8 -0
  7. package/dist/es/component/env-config-reminder/index.mjs +1 -2
  8. package/dist/es/component/form-field/index.mjs +5 -10
  9. package/dist/es/component/history-selector/index.css +38 -1
  10. package/dist/es/component/history-selector/index.mjs +1 -2
  11. package/dist/es/component/logo/index.mjs +7 -3
  12. package/dist/es/component/misc/index.mjs +1 -4
  13. package/dist/es/component/nav-actions/index.mjs +1 -2
  14. package/dist/es/component/nav-actions/style.css +1 -1
  15. package/dist/es/component/player/index.css +26 -0
  16. package/dist/es/component/player/index.mjs +376 -364
  17. package/dist/es/component/playground/index.css +291 -31
  18. package/dist/es/component/playground-result/index.css +10 -0
  19. package/dist/es/component/playground-result/index.mjs +129 -10
  20. package/dist/es/component/prompt-input/index.css +281 -31
  21. package/dist/es/component/prompt-input/index.mjs +83 -25
  22. package/dist/es/component/screenshot-viewer/index.css +214 -0
  23. package/dist/es/component/screenshot-viewer/index.mjs +282 -0
  24. package/dist/es/component/service-mode-control/index.mjs +1 -2
  25. package/dist/es/component/shiny-text/index.css +35 -3
  26. package/dist/es/component/shiny-text/index.mjs +3 -3
  27. package/dist/es/component/universal-playground/index.css +61 -1
  28. package/dist/es/component/universal-playground/index.mjs +106 -83
  29. package/dist/es/component/universal-playground/providers/context-provider.mjs +56 -18
  30. package/dist/es/component/universal-playground/providers/indexeddb-storage-provider.mjs +213 -139
  31. package/dist/es/component/universal-playground/providers/storage-provider.mjs +199 -121
  32. package/dist/es/hooks/usePlaygroundExecution.mjs +297 -146
  33. package/dist/es/hooks/usePlaygroundState.mjs +141 -75
  34. package/dist/es/hooks/useSafeOverrideAIConfig.mjs +2 -6
  35. package/dist/es/hooks/useServerValid.mjs +37 -12
  36. package/dist/es/hooks/useTheme.mjs +25 -0
  37. package/dist/es/icons/avatar.mjs +46 -4
  38. package/dist/es/icons/close.mjs +46 -4
  39. package/dist/es/icons/global-perspective.mjs +47 -5
  40. package/dist/es/icons/history.mjs +48 -6
  41. package/dist/es/icons/magnifying-glass.mjs +47 -5
  42. package/dist/es/icons/player-setting.mjs +48 -6
  43. package/dist/es/icons/setting.mjs +47 -5
  44. package/dist/es/icons/show-marker.mjs +47 -5
  45. package/dist/es/index.mjs +4 -4
  46. package/dist/es/store/history.mjs +46 -7
  47. package/dist/es/store/store.mjs +68 -2
  48. package/dist/es/types.mjs +1 -1
  49. package/dist/es/utils/constants.mjs +7 -3
  50. package/dist/es/utils/index.mjs +4 -1
  51. package/dist/es/utils/pixi-loader.mjs +37 -11
  52. package/dist/es/utils/replay-scripts.mjs +160 -111
  53. package/dist/lib/component/blackboard/index.css +8 -0
  54. package/dist/lib/component/blackboard/index.js +139 -70
  55. package/dist/lib/component/config-selector/index.js +103 -5
  56. package/dist/lib/component/context-preview/index.js +3 -4
  57. package/dist/lib/component/env-config/index.js +3 -4
  58. package/dist/lib/component/env-config-reminder/index.css +8 -0
  59. package/dist/lib/component/env-config-reminder/index.js +3 -4
  60. package/dist/lib/component/form-field/index.js +10 -15
  61. package/dist/lib/component/history-selector/index.css +38 -1
  62. package/dist/lib/component/history-selector/index.js +3 -4
  63. package/dist/lib/component/index.js +6 -8
  64. package/dist/lib/component/logo/index.js +9 -5
  65. package/dist/lib/component/misc/index.js +6 -9
  66. package/dist/lib/component/nav-actions/index.js +3 -4
  67. package/dist/lib/component/nav-actions/style.css +1 -1
  68. package/dist/lib/component/player/index.css +26 -0
  69. package/dist/lib/component/player/index.js +376 -365
  70. package/dist/lib/component/playground/index.css +291 -31
  71. package/dist/lib/component/playground/index.js +31 -33
  72. package/dist/lib/component/playground-result/index.css +10 -0
  73. package/dist/lib/component/playground-result/index.js +131 -12
  74. package/dist/lib/component/prompt-input/index.css +281 -31
  75. package/dist/lib/component/prompt-input/index.js +84 -26
  76. package/dist/lib/component/screenshot-viewer/index.css +214 -0
  77. package/dist/lib/component/screenshot-viewer/index.js +316 -0
  78. package/dist/lib/component/service-mode-control/index.js +3 -4
  79. package/dist/lib/component/shiny-text/index.css +35 -3
  80. package/dist/lib/component/shiny-text/index.js +5 -5
  81. package/dist/lib/component/universal-playground/index.css +61 -1
  82. package/dist/lib/component/universal-playground/index.js +108 -84
  83. package/dist/lib/component/universal-playground/providers/context-provider.js +58 -20
  84. package/dist/lib/component/universal-playground/providers/indexeddb-storage-provider.js +217 -143
  85. package/dist/lib/component/universal-playground/providers/storage-provider.js +207 -129
  86. package/dist/lib/hooks/usePlaygroundExecution.js +299 -148
  87. package/dist/lib/hooks/usePlaygroundState.js +143 -77
  88. package/dist/lib/hooks/useSafeOverrideAIConfig.js +4 -8
  89. package/dist/lib/hooks/useServerValid.js +39 -14
  90. package/dist/lib/hooks/useTheme.js +59 -0
  91. package/dist/lib/icons/avatar.js +48 -6
  92. package/dist/lib/icons/close.js +48 -6
  93. package/dist/lib/icons/global-perspective.js +49 -7
  94. package/dist/lib/icons/history.js +50 -8
  95. package/dist/lib/icons/magnifying-glass.js +49 -7
  96. package/dist/lib/icons/player-setting.js +50 -8
  97. package/dist/lib/icons/setting.js +49 -7
  98. package/dist/lib/icons/show-marker.js +49 -7
  99. package/dist/lib/index.js +44 -34
  100. package/dist/lib/store/history.js +48 -9
  101. package/dist/lib/store/store.js +74 -8
  102. package/dist/lib/types.js +3 -3
  103. package/dist/lib/utils/color.js +2 -2
  104. package/dist/lib/utils/constants.js +20 -4
  105. package/dist/lib/utils/index.js +10 -4
  106. package/dist/lib/utils/pixi-loader.js +41 -15
  107. package/dist/lib/utils/playground-utils.js +4 -4
  108. package/dist/lib/utils/replay-scripts.js +164 -115
  109. package/dist/types/component/config-selector/index.d.ts +2 -0
  110. package/dist/types/component/player/index.d.ts +0 -1
  111. package/dist/types/component/playground-result/index.d.ts +1 -0
  112. package/dist/types/component/prompt-input/index.d.ts +2 -1
  113. package/dist/types/component/screenshot-viewer/index.d.ts +15 -0
  114. package/dist/types/hooks/usePlaygroundExecution.d.ts +1 -1
  115. package/dist/types/hooks/usePlaygroundState.d.ts +3 -3
  116. package/dist/types/hooks/useTheme.d.ts +7 -0
  117. package/dist/types/index.d.ts +3 -3
  118. package/dist/types/store/store.d.ts +18 -1
  119. package/dist/types/types.d.ts +14 -4
  120. package/dist/types/utils/constants.d.ts +5 -1
  121. package/dist/types/utils/index.d.ts +1 -0
  122. package/dist/types/utils/replay-scripts.d.ts +1 -1
  123. package/package.json +12 -22
@@ -1,128 +1,237 @@
1
+ import { paramStr, typeStr } from "@midscene/core/agent";
1
2
  import { useCallback } from "react";
2
3
  import { useEnvConfig } from "../store/store.mjs";
3
- import { noReplayAPIs } from "@midscene/playground";
4
4
  import { BLANK_RESULT } from "../utils/constants.mjs";
5
5
  import { allScriptsFromDump } from "../utils/replay-scripts.mjs";
6
- function usePlaygroundExecution(playgroundSDK, storage, actionSpace, loading, setLoading, infoList, setInfoList, replayCounter, setReplayCounter, verticalMode, currentRunningIdRef, interruptedFlagRef) {
7
- const { deepThink, screenshotIncluded, domIncluded } = useEnvConfig();
8
- const handleRun = useCallback(async (value)=>{
9
- if (!playgroundSDK) return void console.warn('PlaygroundSDK is not available');
10
- const thisRunningId = Date.now();
11
- const actionType = value.type;
12
- const displayContent = `${value.type}: ${value.prompt || JSON.stringify(value.params)}`;
13
- const userItem = {
14
- id: `user-${Date.now()}`,
15
- type: 'user',
16
- content: displayContent,
17
- timestamp: new Date()
18
- };
19
- setInfoList((prev)=>[
20
- ...prev,
21
- userItem
22
- ]);
23
- setLoading(true);
24
- const result = {
25
- ...BLANK_RESULT
26
- };
27
- const systemItem = {
28
- id: `system-${thisRunningId}`,
29
- type: 'system',
30
- content: '',
31
- timestamp: new Date(),
32
- loading: true,
33
- loadingProgressText: ''
34
- };
35
- setInfoList((prev)=>[
36
- ...prev,
37
- systemItem
38
- ]);
39
- try {
40
- currentRunningIdRef.current = thisRunningId;
41
- interruptedFlagRef.current[thisRunningId] = false;
42
- if (playgroundSDK.onProgressUpdate) playgroundSDK.onProgressUpdate(()=>{});
43
- if (playgroundSDK.onProgressUpdate) playgroundSDK.onProgressUpdate((tip)=>{
44
- if (interruptedFlagRef.current[thisRunningId]) return;
45
- setInfoList((prev)=>{
46
- const lastItem = prev[prev.length - 1];
47
- if (lastItem && 'progress' === lastItem.type && lastItem.content === tip) return prev;
48
- const progressItem = {
49
- id: `progress-${thisRunningId}-${Date.now()}`,
50
- type: 'progress',
51
- content: tip,
52
- timestamp: new Date()
53
- };
54
- return [
55
- ...prev,
56
- progressItem
57
- ];
58
- });
59
- });
60
- result.result = await playgroundSDK.executeAction(actionType, value, {
61
- requestId: thisRunningId.toString(),
62
- deepThink,
63
- screenshotIncluded,
64
- domIncluded
65
- });
66
- if ('object' == typeof result.result && null !== result.result) {
67
- const resultObj = result.result;
68
- if (resultObj.dump) result.dump = resultObj.dump;
69
- if (resultObj.reportHTML) result.reportHTML = resultObj.reportHTML;
70
- if (resultObj.error) result.error = resultObj.error;
71
- if (void 0 !== resultObj.result) result.result = resultObj.result;
6
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
7
+ try {
8
+ var info = gen[key](arg);
9
+ var value = info.value;
10
+ } catch (error) {
11
+ reject(error);
12
+ return;
13
+ }
14
+ if (info.done) resolve(value);
15
+ else Promise.resolve(value).then(_next, _throw);
16
+ }
17
+ function _async_to_generator(fn) {
18
+ return function() {
19
+ var self = this, args = arguments;
20
+ return new Promise(function(resolve, reject) {
21
+ var gen = fn.apply(self, args);
22
+ function _next(value) {
23
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
72
24
  }
73
- } catch (e) {
74
- result.error = (null == e ? void 0 : e.message) || String(e);
75
- console.error('Playground execution error:', e);
76
- }
77
- if (interruptedFlagRef.current[thisRunningId]) return;
78
- setLoading(false);
79
- currentRunningIdRef.current = null;
80
- let replayInfo = null;
81
- let counter = replayCounter;
82
- if ((null == result ? void 0 : result.dump) && !noReplayAPIs.includes(actionType)) {
83
- const info = allScriptsFromDump(result.dump);
84
- setReplayCounter((c)=>c + 1);
85
- replayInfo = info;
86
- counter = replayCounter + 1;
87
- }
88
- setInfoList((prev)=>prev.map((item)=>item.id === `system-${thisRunningId}` ? {
89
- ...item,
90
- content: '',
91
- loading: false,
92
- loadingProgressText: ''
93
- } : item));
94
- const resultItem = {
95
- id: `result-${thisRunningId}`,
96
- type: 'result',
97
- content: 'Execution result',
98
- timestamp: new Date(),
99
- result: result,
100
- loading: false,
101
- replayScriptsInfo: replayInfo,
102
- replayCounter: counter,
103
- loadingProgressText: '',
104
- verticalMode: verticalMode
105
- };
106
- setInfoList((prev)=>[
107
- ...prev,
108
- resultItem
109
- ]);
110
- if (null == storage ? void 0 : storage.saveResult) try {
111
- await storage.saveResult(resultItem.id, resultItem);
112
- } catch (error) {
113
- console.error('Failed to save result:', error);
25
+ function _throw(err) {
26
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
27
+ }
28
+ _next(void 0);
29
+ });
30
+ };
31
+ }
32
+ function _define_property(obj, key, value) {
33
+ if (key in obj) Object.defineProperty(obj, key, {
34
+ value: value,
35
+ enumerable: true,
36
+ configurable: true,
37
+ writable: true
38
+ });
39
+ else obj[key] = value;
40
+ return obj;
41
+ }
42
+ function _object_spread(target) {
43
+ for(var i = 1; i < arguments.length; i++){
44
+ var source = null != arguments[i] ? arguments[i] : {};
45
+ var ownKeys = Object.keys(source);
46
+ if ("function" == typeof Object.getOwnPropertySymbols) ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
47
+ return Object.getOwnPropertyDescriptor(source, sym).enumerable;
48
+ }));
49
+ ownKeys.forEach(function(key) {
50
+ _define_property(target, key, source[key]);
51
+ });
52
+ }
53
+ return target;
54
+ }
55
+ function usePlaygroundExecution_ownKeys(object, enumerableOnly) {
56
+ var keys = Object.keys(object);
57
+ if (Object.getOwnPropertySymbols) {
58
+ var symbols = Object.getOwnPropertySymbols(object);
59
+ if (enumerableOnly) symbols = symbols.filter(function(sym) {
60
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
61
+ });
62
+ keys.push.apply(keys, symbols);
63
+ }
64
+ return keys;
65
+ }
66
+ function _object_spread_props(target, source) {
67
+ source = null != source ? source : {};
68
+ if (Object.getOwnPropertyDescriptors) Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
69
+ else usePlaygroundExecution_ownKeys(Object(source)).forEach(function(key) {
70
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
71
+ });
72
+ return target;
73
+ }
74
+ function buildProgressContent(task) {
75
+ const action = typeStr(task);
76
+ const description = paramStr(task);
77
+ return description ? `${action} - ${description}` : action;
78
+ }
79
+ function wrapExecutionDumpForReplay(dump) {
80
+ const modelBriefsSet = new Set();
81
+ if ((null == dump ? void 0 : dump.tasks) && Array.isArray(dump.tasks)) dump.tasks.forEach((task)=>{
82
+ if (task.usage) {
83
+ const { model_name, model_description, intent } = task.usage;
84
+ if (intent && model_name) modelBriefsSet.add(model_description ? `${intent}/${model_name}(${model_description})` : `${intent}/${model_name}`);
114
85
  }
115
- const separatorItem = {
116
- id: `separator-${thisRunningId}`,
117
- type: 'separator',
118
- content: 'New Session',
119
- timestamp: new Date()
120
- };
121
- setInfoList((prev)=>[
122
- ...prev,
123
- separatorItem
124
- ]);
125
- }, [
86
+ });
87
+ else console.warn('[wrapExecutionDumpForReplay] Invalid dump structure:', dump);
88
+ const modelBriefs = [
89
+ ...modelBriefsSet
90
+ ];
91
+ return {
92
+ sdkVersion: '',
93
+ groupName: 'Playground Execution',
94
+ modelBriefs,
95
+ executions: [
96
+ dump
97
+ ]
98
+ };
99
+ }
100
+ function usePlaygroundExecution(playgroundSDK, storage, actionSpace, loading, setLoading, setInfoList, replayCounter, setReplayCounter, verticalMode, currentRunningIdRef, interruptedFlagRef) {
101
+ const { deepThink, screenshotIncluded, domIncluded, planningStrategy } = useEnvConfig();
102
+ const handleRun = useCallback((value)=>_async_to_generator(function*() {
103
+ if (!playgroundSDK) return void console.warn('PlaygroundSDK is not available');
104
+ const thisRunningId = Date.now();
105
+ const actionType = value.type;
106
+ const displayContent = `${value.type}: ${value.prompt || JSON.stringify(value.params)}`;
107
+ const userItem = {
108
+ id: `user-${Date.now()}`,
109
+ type: 'user',
110
+ content: displayContent,
111
+ timestamp: new Date()
112
+ };
113
+ setInfoList((prev)=>[
114
+ ...prev,
115
+ userItem
116
+ ]);
117
+ setLoading(true);
118
+ const result = _object_spread({}, BLANK_RESULT);
119
+ const systemItem = {
120
+ id: `system-${thisRunningId}`,
121
+ type: 'system',
122
+ content: '',
123
+ timestamp: new Date(),
124
+ loading: true,
125
+ loadingProgressText: ''
126
+ };
127
+ setInfoList((prev)=>[
128
+ ...prev,
129
+ systemItem
130
+ ]);
131
+ try {
132
+ currentRunningIdRef.current = thisRunningId;
133
+ interruptedFlagRef.current[thisRunningId] = false;
134
+ if (playgroundSDK.onDumpUpdate) playgroundSDK.onDumpUpdate((_, executionDump)=>{
135
+ var _executionDump_tasks;
136
+ if (interruptedFlagRef.current[thisRunningId] || !(null == executionDump ? void 0 : null == (_executionDump_tasks = executionDump.tasks) ? void 0 : _executionDump_tasks.length)) return;
137
+ const progressItems = executionDump.tasks.map((task, index)=>{
138
+ var _task_timing;
139
+ return {
140
+ id: `progress-${thisRunningId}-task-${index}`,
141
+ type: 'progress',
142
+ content: buildProgressContent(task),
143
+ timestamp: new Date((null == (_task_timing = task.timing) ? void 0 : _task_timing.start) || Date.now()),
144
+ result: task.error ? {
145
+ error: String(task.error),
146
+ result: null
147
+ } : void 0
148
+ };
149
+ });
150
+ setInfoList((prev)=>{
151
+ const systemItemIndex = prev.findIndex((item)=>item.id === `system-${thisRunningId}`);
152
+ if (-1 === systemItemIndex) return prev;
153
+ const listWithoutCurrentProgress = prev.filter((item)=>!('progress' === item.type && item.id.startsWith(`progress-${thisRunningId}-`)));
154
+ return [
155
+ ...listWithoutCurrentProgress.slice(0, systemItemIndex + 1),
156
+ ...progressItems,
157
+ ...listWithoutCurrentProgress.slice(systemItemIndex + 1)
158
+ ];
159
+ });
160
+ });
161
+ result.result = yield playgroundSDK.executeAction(actionType, value, {
162
+ requestId: thisRunningId.toString(),
163
+ deepThink,
164
+ planningStrategy,
165
+ screenshotIncluded,
166
+ domIncluded
167
+ });
168
+ if ('object' == typeof result.result && null !== result.result) {
169
+ const resultObj = result.result;
170
+ if (resultObj.dump) result.dump = resultObj.dump;
171
+ if (resultObj.reportHTML) result.reportHTML = resultObj.reportHTML;
172
+ if (resultObj.error) result.error = resultObj.error;
173
+ if (void 0 !== resultObj.result) result.result = resultObj.result;
174
+ }
175
+ } catch (e) {
176
+ result.error = (null == e ? void 0 : e.message) || String(e);
177
+ console.error('Playground execution error:', e);
178
+ if ('object' == typeof e && null !== e) {
179
+ if (e.dump) result.dump = e.dump;
180
+ if (e.reportHTML) result.reportHTML = e.reportHTML;
181
+ }
182
+ }
183
+ if (interruptedFlagRef.current[thisRunningId]) return;
184
+ setLoading(false);
185
+ currentRunningIdRef.current = null;
186
+ let replayInfo = null;
187
+ let counter = replayCounter;
188
+ if (null == result ? void 0 : result.dump) {
189
+ if (result.dump.tasks && Array.isArray(result.dump.tasks)) {
190
+ const groupedDump = wrapExecutionDumpForReplay(result.dump);
191
+ const info = allScriptsFromDump(groupedDump);
192
+ setReplayCounter((c)=>c + 1);
193
+ replayInfo = info;
194
+ counter = replayCounter + 1;
195
+ }
196
+ }
197
+ setInfoList((prev)=>prev.map((item)=>item.id === `system-${thisRunningId}` ? _object_spread_props(_object_spread({}, item), {
198
+ content: '',
199
+ loading: false,
200
+ loadingProgressText: ''
201
+ }) : item));
202
+ const resultItem = {
203
+ id: `result-${thisRunningId}`,
204
+ type: 'result',
205
+ content: 'Execution result',
206
+ timestamp: new Date(),
207
+ result: result,
208
+ loading: false,
209
+ replayScriptsInfo: replayInfo,
210
+ replayCounter: counter,
211
+ loadingProgressText: '',
212
+ verticalMode: verticalMode,
213
+ actionType: actionType
214
+ };
215
+ setInfoList((prev)=>[
216
+ ...prev,
217
+ resultItem
218
+ ]);
219
+ if (null == storage ? void 0 : storage.saveResult) try {
220
+ yield storage.saveResult(resultItem.id, resultItem);
221
+ } catch (error) {
222
+ console.error('Failed to save result:', error);
223
+ }
224
+ const separatorItem = {
225
+ id: `separator-${thisRunningId}`,
226
+ type: 'separator',
227
+ content: 'New Session',
228
+ timestamp: new Date()
229
+ };
230
+ setInfoList((prev)=>[
231
+ ...prev,
232
+ separatorItem
233
+ ]);
234
+ })(), [
126
235
  playgroundSDK,
127
236
  storage,
128
237
  actionSpace,
@@ -134,41 +243,83 @@ function usePlaygroundExecution(playgroundSDK, storage, actionSpace, loading, se
134
243
  currentRunningIdRef,
135
244
  interruptedFlagRef,
136
245
  deepThink,
246
+ planningStrategy,
137
247
  screenshotIncluded,
138
248
  domIncluded
139
249
  ]);
140
- const handleStop = useCallback(async ()=>{
141
- const thisRunningId = currentRunningIdRef.current;
142
- if (thisRunningId && playgroundSDK && playgroundSDK.cancelExecution) try {
143
- await playgroundSDK.cancelExecution(thisRunningId.toString());
144
- interruptedFlagRef.current[thisRunningId] = true;
145
- setLoading(false);
146
- if (playgroundSDK.onProgressUpdate) playgroundSDK.onProgressUpdate(()=>{});
147
- setInfoList((prev)=>prev.map((item)=>item.id === `system-${thisRunningId}` && item.loading ? {
148
- ...item,
149
- content: 'Operation stopped',
250
+ const handleStop = useCallback(()=>_async_to_generator(function*() {
251
+ const thisRunningId = currentRunningIdRef.current;
252
+ if (thisRunningId && playgroundSDK && playgroundSDK.cancelExecution) try {
253
+ let executionData = null;
254
+ if (playgroundSDK.getCurrentExecutionData) try {
255
+ executionData = yield playgroundSDK.getCurrentExecutionData();
256
+ } catch (error) {
257
+ console.error('Failed to get execution data before stop:', error);
258
+ }
259
+ yield playgroundSDK.cancelExecution(thisRunningId.toString());
260
+ interruptedFlagRef.current[thisRunningId] = true;
261
+ setLoading(false);
262
+ if (playgroundSDK.onProgressUpdate) playgroundSDK.onProgressUpdate(()=>{});
263
+ if (playgroundSDK.onDumpUpdate) playgroundSDK.onDumpUpdate(()=>{});
264
+ setInfoList((prev)=>prev.map((item)=>item.id === `system-${thisRunningId}` ? _object_spread_props(_object_spread({}, item), {
265
+ content: '',
266
+ loading: false,
267
+ loadingProgressText: ''
268
+ }) : item));
269
+ if (executionData && (executionData.dump || executionData.reportHTML)) {
270
+ const resultItem = {
271
+ id: `stop-result-${thisRunningId}`,
272
+ type: 'result',
273
+ content: 'Execution stopped by user',
274
+ timestamp: new Date(),
275
+ result: {
276
+ result: null,
277
+ dump: executionData.dump,
278
+ reportHTML: executionData.reportHTML,
279
+ error: null
280
+ },
150
281
  loading: false,
151
- loadingProgressText: ''
152
- } : item));
153
- const separatorItem = {
154
- id: `separator-${thisRunningId}`,
155
- type: 'separator',
156
- content: 'New Session',
157
- timestamp: new Date()
158
- };
159
- setInfoList((prev)=>[
160
- ...prev,
161
- separatorItem
162
- ]);
163
- } catch (error) {
164
- console.error('Failed to stop execution:', error);
165
- }
166
- }, [
282
+ verticalMode,
283
+ replayCounter
284
+ };
285
+ setInfoList((prev)=>[
286
+ ...prev,
287
+ resultItem
288
+ ]);
289
+ } else {
290
+ const stopItem = {
291
+ id: `stop-${thisRunningId}`,
292
+ type: 'system',
293
+ content: 'Operation stopped',
294
+ timestamp: new Date(),
295
+ loading: false
296
+ };
297
+ setInfoList((prev)=>[
298
+ ...prev,
299
+ stopItem
300
+ ]);
301
+ }
302
+ const separatorItem = {
303
+ id: `separator-${thisRunningId}`,
304
+ type: 'separator',
305
+ content: 'New Session',
306
+ timestamp: new Date()
307
+ };
308
+ setInfoList((prev)=>[
309
+ ...prev,
310
+ separatorItem
311
+ ]);
312
+ } catch (error) {
313
+ console.error('Failed to stop execution:', error);
314
+ }
315
+ })(), [
167
316
  playgroundSDK,
168
317
  currentRunningIdRef,
169
318
  interruptedFlagRef,
170
319
  setLoading,
171
- setInfoList
320
+ setInfoList,
321
+ verticalMode,
322
+ replayCounter
172
323
  ]);
173
324
  const canStop = loading && !!currentRunningIdRef.current && !!playgroundSDK && !!playgroundSDK.cancelExecution;
174
325
  return {