@midscene/visualizer 0.27.1-beta-20250822053848.0 → 0.27.1-beta-20250822094725.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 (27) hide show
  1. package/dist/es/component/playground/FormField.mjs +122 -0
  2. package/dist/es/component/playground/HistorySelector.mjs +2 -3
  3. package/dist/es/component/playground/PromptInput.mjs +339 -58
  4. package/dist/es/component/playground/index.css +160 -2
  5. package/dist/es/component/playground/playground-constants.mjs +69 -1
  6. package/dist/es/component/playground/playground-utils.mjs +43 -1
  7. package/dist/es/component/playground/types.mjs +50 -0
  8. package/dist/es/component/replay-scripts.mjs +18 -9
  9. package/dist/es/component/store/history.mjs +42 -8
  10. package/dist/lib/component/playground/FormField.js +165 -0
  11. package/dist/lib/component/playground/HistorySelector.js +2 -3
  12. package/dist/lib/component/playground/PromptInput.js +345 -54
  13. package/dist/lib/component/playground/index.css +160 -2
  14. package/dist/lib/component/playground/playground-constants.js +76 -2
  15. package/dist/lib/component/playground/playground-utils.js +45 -0
  16. package/dist/lib/component/playground/types.js +96 -0
  17. package/dist/lib/component/replay-scripts.js +28 -19
  18. package/dist/lib/component/store/history.js +42 -8
  19. package/dist/types/component/playground/FormField.d.ts +15 -0
  20. package/dist/types/component/playground/HistorySelector.d.ts +2 -0
  21. package/dist/types/component/playground/PromptInput.d.ts +3 -1
  22. package/dist/types/component/playground/playground-constants.d.ts +63 -0
  23. package/dist/types/component/playground/playground-types.d.ts +1 -1
  24. package/dist/types/component/playground/playground-utils.d.ts +1 -0
  25. package/dist/types/component/playground/types.d.ts +58 -0
  26. package/dist/types/component/store/history.d.ts +9 -4
  27. package/package.json +4 -4
@@ -0,0 +1,122 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Form, Input, InputNumber, Select } from "antd";
3
+ const { TextArea } = Input;
4
+ const renderLabel = (label, isOptional)=>`${label}${isOptional ? ' (Optional)' : ''}`;
5
+ const TextField = (param)=>{
6
+ let { name, label, isRequired, marginBottom } = param;
7
+ const placeholder = `Enter ${name}`;
8
+ return /*#__PURE__*/ jsx(Form.Item, {
9
+ name: [
10
+ 'params',
11
+ name
12
+ ],
13
+ label: renderLabel(label, !isRequired),
14
+ rules: isRequired ? [
15
+ {
16
+ required: true,
17
+ message: `Please input ${name}`
18
+ }
19
+ ] : [],
20
+ style: {
21
+ marginBottom
22
+ },
23
+ children: /*#__PURE__*/ jsx(Input, {
24
+ placeholder: placeholder
25
+ })
26
+ }, name);
27
+ };
28
+ const LocateField = (param)=>{
29
+ let { name, label, isRequired, marginBottom } = param;
30
+ return /*#__PURE__*/ jsx(Form.Item, {
31
+ name: [
32
+ 'params',
33
+ name
34
+ ],
35
+ label: renderLabel(label, !isRequired),
36
+ rules: isRequired ? [
37
+ {
38
+ required: true,
39
+ message: `Please describe the ${name}`
40
+ }
41
+ ] : [],
42
+ style: {
43
+ marginBottom
44
+ },
45
+ children: /*#__PURE__*/ jsx(TextArea, {
46
+ rows: 2,
47
+ placeholder: `Describe the ${name}, use natural language`
48
+ })
49
+ }, name);
50
+ };
51
+ const EnumField = (param)=>{
52
+ let { name, label, fieldSchema, isRequired, marginBottom } = param;
53
+ const enumValues = fieldSchema._def.values || [];
54
+ const selectOptions = enumValues.map((value)=>({
55
+ value,
56
+ label: value.charAt(0).toUpperCase() + value.slice(1)
57
+ }));
58
+ return /*#__PURE__*/ jsx(Form.Item, {
59
+ name: [
60
+ 'params',
61
+ name
62
+ ],
63
+ label: label,
64
+ rules: isRequired ? [
65
+ {
66
+ required: true,
67
+ message: `Please select ${name}`
68
+ }
69
+ ] : [],
70
+ style: {
71
+ marginBottom
72
+ },
73
+ children: /*#__PURE__*/ jsx(Select, {
74
+ placeholder: `Select ${name}`,
75
+ options: selectOptions
76
+ })
77
+ }, name);
78
+ };
79
+ const NumberField = (param)=>{
80
+ let { name, label, isRequired, marginBottom } = param;
81
+ const placeholder = 'distance' === name ? 500 : 0;
82
+ const min = 0;
83
+ const max = 'distance' === name ? 10000 : void 0;
84
+ return /*#__PURE__*/ jsx(Form.Item, {
85
+ name: [
86
+ 'params',
87
+ name
88
+ ],
89
+ label: `${label}${'distance' === name ? ' (px)' : ''}`,
90
+ rules: isRequired ? [
91
+ {
92
+ required: true,
93
+ message: `Please input ${name}`
94
+ },
95
+ {
96
+ type: 'number',
97
+ min,
98
+ message: `${label} must be at least ${min}`
99
+ }
100
+ ] : [
101
+ {
102
+ type: 'number',
103
+ min,
104
+ message: `${label} must be at least ${min}`
105
+ }
106
+ ],
107
+ style: {
108
+ flex: 'distance' === name ? 1 : void 0,
109
+ marginBottom
110
+ },
111
+ children: /*#__PURE__*/ jsx(InputNumber, {
112
+ placeholder: placeholder.toString(),
113
+ min: min,
114
+ max: max,
115
+ step: 'distance' === name ? 10 : 1,
116
+ style: {
117
+ width: '100%'
118
+ }
119
+ })
120
+ }, name);
121
+ };
122
+ export { EnumField, LocateField, NumberField, TextField };
@@ -8,10 +8,9 @@ import { useHistoryStore } from "../store/history.mjs";
8
8
  import "./index.css";
9
9
  const { Text } = Typography;
10
10
  const HistorySelector = (param)=>{
11
- let { onSelect } = param;
11
+ let { onSelect, history, currentType } = param;
12
12
  const [isModalOpen, setIsModalOpen] = useState(false);
13
13
  const [searchText, setSearchText] = useState('');
14
- const history = useHistoryStore((state)=>state.history);
15
14
  const clearHistory = useHistoryStore((state)=>state.clearHistory);
16
15
  const groupedHistory = useMemo(()=>{
17
16
  const now = Date.now();
@@ -33,7 +32,7 @@ const HistorySelector = (param)=>{
33
32
  setIsModalOpen(false);
34
33
  };
35
34
  const handleClearHistory = ()=>{
36
- clearHistory();
35
+ clearHistory(currentType);
37
36
  setSearchText('');
38
37
  setIsModalOpen(false);
39
38
  };
@@ -1,41 +1,105 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { BorderOutlined, SendOutlined } from "@ant-design/icons";
3
- import { Button, Form, Input, Radio, Space, Tooltip } from "antd";
4
- import { useCallback, useEffect, useRef, useState } from "react";
2
+ import { BorderOutlined, DownOutlined, SendOutlined } from "@ant-design/icons";
3
+ import { Button, Dropdown, Form, Input, Radio, Space, Tooltip } from "antd";
4
+ import react, { useCallback, useEffect, useMemo, useRef, useState } from "react";
5
5
  import { useHistoryStore } from "../store/history.mjs";
6
6
  import { ConfigSelector } from "./ConfigSelector.mjs";
7
+ import { EnumField, LocateField, NumberField, TextField } from "./FormField.mjs";
7
8
  import { HistorySelector } from "./HistorySelector.mjs";
8
- import { actionNameForType, getPlaceholderForType } from "./playground-utils.mjs";
9
+ import { apiMetadata, defaultMainButtons } from "./playground-constants.mjs";
10
+ import { actionNameForType, getPlaceholderForType, isRunButtonEnabled as external_playground_utils_mjs_isRunButtonEnabled } from "./playground-utils.mjs";
11
+ import { extractDefaultValue, isLocateField, isZodObjectSchema, unwrapZodType } from "./types.mjs";
9
12
  import "./index.css";
10
13
  const { TextArea } = Input;
11
14
  const PromptInput = (param)=>{
12
- let { runButtonEnabled, form, serviceMode, selectedType, dryMode, stoppable, loading, onRun, onStop, clearPromptAfterRun = true } = param;
15
+ let { runButtonEnabled, form, serviceMode, selectedType, dryMode, stoppable, loading, onRun, onStop, clearPromptAfterRun = true, actionSpace } = param;
13
16
  const [hoveringSettings, setHoveringSettings] = useState(false);
14
17
  const [promptValue, setPromptValue] = useState('');
15
18
  const placeholder = getPlaceholderForType(selectedType);
16
19
  const textAreaRef = useRef(null);
20
+ const params = Form.useWatch('params', form);
17
21
  const history = useHistoryStore((state)=>state.history);
22
+ const lastSelectedType = useHistoryStore((state)=>state.lastSelectedType);
18
23
  const addHistory = useHistoryStore((state)=>state.addHistory);
19
- const lastHistory = history[0];
24
+ const setLastSelectedType = useHistoryStore((state)=>state.setLastSelectedType);
25
+ const historyForSelectedType = useMemo(()=>history[selectedType] || [], [
26
+ history,
27
+ selectedType
28
+ ]);
29
+ const needsStructuredParams = useMemo(()=>{
30
+ if (actionSpace) {
31
+ const action = actionSpace.find((a)=>a.interfaceAlias === selectedType || a.name === selectedType);
32
+ return null == action ? void 0 : action.paramSchema;
33
+ }
34
+ return [
35
+ 'aiInput',
36
+ 'aiKeyboardPress',
37
+ 'aiScroll'
38
+ ].includes(selectedType);
39
+ }, [
40
+ selectedType,
41
+ actionSpace
42
+ ]);
43
+ const getDefaultParams = useCallback(()=>{
44
+ if (!needsStructuredParams || !actionSpace) return {};
45
+ const action = actionSpace.find((a)=>a.interfaceAlias === selectedType || a.name === selectedType);
46
+ if ((null == action ? void 0 : action.paramSchema) && isZodObjectSchema(action.paramSchema)) {
47
+ const defaultParams = {};
48
+ const schema = action.paramSchema;
49
+ Object.keys(schema.shape).forEach((key)=>{
50
+ const field = schema.shape[key];
51
+ const defaultValue = extractDefaultValue(field);
52
+ if (void 0 !== defaultValue) defaultParams[key] = defaultValue;
53
+ });
54
+ return defaultParams;
55
+ }
56
+ return {};
57
+ }, [
58
+ selectedType,
59
+ needsStructuredParams,
60
+ actionSpace
61
+ ]);
62
+ useEffect(()=>{
63
+ if (!form.getFieldValue('type') && lastSelectedType) form.setFieldValue('type', lastSelectedType);
64
+ }, [
65
+ form,
66
+ lastSelectedType
67
+ ]);
68
+ useEffect(()=>{
69
+ if (selectedType && selectedType !== lastSelectedType) setLastSelectedType(selectedType);
70
+ }, [
71
+ selectedType,
72
+ lastSelectedType,
73
+ setLastSelectedType
74
+ ]);
20
75
  useEffect(()=>{
76
+ const lastHistory = historyForSelectedType[0];
21
77
  if (lastHistory) {
22
78
  form.setFieldsValue({
23
- type: lastHistory.type || 'aiAction',
24
- prompt: lastHistory.prompt || ''
79
+ type: lastHistory.type,
80
+ prompt: lastHistory.prompt || '',
81
+ params: lastHistory.params
25
82
  });
26
83
  setPromptValue(lastHistory.prompt || '');
27
84
  } else {
85
+ const defaultParams = getDefaultParams();
28
86
  form.setFieldsValue({
29
- type: 'aiAction',
30
- prompt: ''
87
+ prompt: '',
88
+ params: defaultParams
31
89
  });
32
90
  setPromptValue('');
33
91
  }
34
- }, []);
92
+ }, [
93
+ selectedType,
94
+ historyForSelectedType,
95
+ form,
96
+ getDefaultParams
97
+ ]);
35
98
  const handleSelectHistory = useCallback((historyItem)=>{
36
99
  form.setFieldsValue({
37
100
  prompt: historyItem.prompt,
38
- type: historyItem.type
101
+ type: historyItem.type,
102
+ params: historyItem.params
39
103
  });
40
104
  setPromptValue(historyItem.prompt);
41
105
  }, [
@@ -48,23 +112,73 @@ const PromptInput = (param)=>{
48
112
  }, [
49
113
  form
50
114
  ]);
51
- const isRunButtonEnabled = runButtonEnabled && promptValue.trim().length > 0;
115
+ const hasSingleStructuredParam = useMemo(()=>{
116
+ if (!needsStructuredParams || !actionSpace) return false;
117
+ const action = actionSpace.find((a)=>a.interfaceAlias === selectedType || a.name === selectedType);
118
+ if ((null == action ? void 0 : action.paramSchema) && isZodObjectSchema(action.paramSchema)) {
119
+ const schema = action.paramSchema;
120
+ return 1 === Object.keys(schema.shape).length;
121
+ }
122
+ return false;
123
+ }, [
124
+ selectedType,
125
+ needsStructuredParams,
126
+ actionSpace
127
+ ]);
128
+ const isRunButtonEnabled = useMemo(()=>external_playground_utils_mjs_isRunButtonEnabled(runButtonEnabled, !!needsStructuredParams, params, actionSpace, selectedType, promptValue), [
129
+ runButtonEnabled,
130
+ needsStructuredParams,
131
+ selectedType,
132
+ actionSpace,
133
+ promptValue,
134
+ params
135
+ ]);
52
136
  const handleRunWithHistory = useCallback(()=>{
53
137
  const values = form.getFieldsValue();
54
- if (values.prompt) addHistory({
138
+ let historyPrompt = '';
139
+ if (needsStructuredParams && values.params && actionSpace) {
140
+ const action = actionSpace.find((a)=>a.interfaceAlias === selectedType || a.name === selectedType);
141
+ if ((null == action ? void 0 : action.paramSchema) && isZodObjectSchema(action.paramSchema)) {
142
+ let locateValue = '';
143
+ const otherValues = [];
144
+ const schema = action.paramSchema;
145
+ Object.keys(schema.shape).forEach((key)=>{
146
+ const paramValue = values.params[key];
147
+ if (null != paramValue && '' !== paramValue) {
148
+ const field = schema.shape[key];
149
+ const { actualField } = unwrapZodType(field);
150
+ if (isLocateField(actualField)) locateValue = String(paramValue);
151
+ else if ('distance' === key) otherValues.push(`${paramValue}`);
152
+ else otherValues.push(String(paramValue));
153
+ }
154
+ });
155
+ const mainPart = otherValues.join(' ');
156
+ historyPrompt = locateValue ? `${mainPart} | ${locateValue}` : mainPart;
157
+ } else historyPrompt = values.prompt || '';
158
+ } else historyPrompt = values.prompt || '';
159
+ addHistory({
55
160
  type: values.type,
56
- prompt: values.prompt,
161
+ prompt: historyPrompt,
162
+ params: values.params,
57
163
  timestamp: Date.now()
58
164
  });
59
165
  onRun();
60
166
  if (clearPromptAfterRun) {
61
167
  setPromptValue('');
62
- form.setFieldValue('prompt', '');
168
+ if (needsStructuredParams) {
169
+ const defaultParams = getDefaultParams();
170
+ form.setFieldValue('params', defaultParams);
171
+ } else form.setFieldValue('prompt', '');
63
172
  }
64
173
  }, [
65
174
  form,
66
175
  addHistory,
67
- onRun
176
+ onRun,
177
+ needsStructuredParams,
178
+ selectedType,
179
+ clearPromptAfterRun,
180
+ actionSpace,
181
+ getDefaultParams
68
182
  ]);
69
183
  const handleKeyDown = useCallback((e)=>{
70
184
  if ('Enter' === e.key && e.metaKey && isRunButtonEnabled) {
@@ -85,6 +199,116 @@ const PromptInput = (param)=>{
85
199
  handleRunWithHistory,
86
200
  isRunButtonEnabled
87
201
  ]);
202
+ const handleStructuredKeyDown = useCallback((e)=>{
203
+ if ('Enter' === e.key && e.metaKey && isRunButtonEnabled) {
204
+ handleRunWithHistory();
205
+ e.preventDefault();
206
+ e.stopPropagation();
207
+ }
208
+ }, [
209
+ handleRunWithHistory,
210
+ isRunButtonEnabled
211
+ ]);
212
+ const renderStructuredParams = useCallback(()=>{
213
+ if (!needsStructuredParams) return null;
214
+ if (actionSpace) {
215
+ const action = actionSpace.find((a)=>a.interfaceAlias === selectedType || a.name === selectedType);
216
+ if ((null == action ? void 0 : action.paramSchema) && isZodObjectSchema(action.paramSchema)) {
217
+ const schema = action.paramSchema;
218
+ const schemaKeys = Object.keys(schema.shape);
219
+ if (1 === schemaKeys.length) {
220
+ const key = schemaKeys[0];
221
+ const field = schema.shape[key];
222
+ const { actualField, isOptional } = unwrapZodType(field);
223
+ const isLocateFieldFlag = isLocateField(actualField);
224
+ let placeholderText = '';
225
+ if (isLocateFieldFlag) placeholderText = 'Describe the element you want to interact with';
226
+ else {
227
+ placeholderText = `Enter ${key}`;
228
+ if ('keyName' === key) placeholderText = 'Enter key name or text to type';
229
+ if ('value' === key) placeholderText = 'Enter text to input';
230
+ }
231
+ return /*#__PURE__*/ jsx(Form.Item, {
232
+ name: [
233
+ 'params',
234
+ key
235
+ ],
236
+ style: {
237
+ margin: 0
238
+ },
239
+ children: /*#__PURE__*/ jsx(Input.TextArea, {
240
+ className: "main-side-console-input-textarea",
241
+ rows: 4,
242
+ placeholder: placeholderText,
243
+ autoFocus: true,
244
+ onKeyDown: handleStructuredKeyDown
245
+ })
246
+ });
247
+ }
248
+ const fields = [];
249
+ schemaKeys.forEach((key, index)=>{
250
+ var _actualField__def, _actualField__def1;
251
+ const fieldSchema = schema.shape[key];
252
+ const { actualField, isOptional } = unwrapZodType(fieldSchema);
253
+ const isLocateFieldFlag = isLocateField(actualField);
254
+ const label = key.charAt(0).toUpperCase() + key.slice(1);
255
+ const isRequired = !isOptional;
256
+ const marginBottom = index === schemaKeys.length - 1 ? 0 : 12;
257
+ const fieldProps = {
258
+ name: key,
259
+ label,
260
+ fieldSchema: actualField,
261
+ isRequired,
262
+ marginBottom
263
+ };
264
+ if (isLocateFieldFlag) fields.push(/*#__PURE__*/ jsx(LocateField, {
265
+ ...fieldProps
266
+ }));
267
+ else if ((null == (_actualField__def = actualField._def) ? void 0 : _actualField__def.typeName) === 'ZodEnum') fields.push(/*#__PURE__*/ jsx(EnumField, {
268
+ ...fieldProps
269
+ }));
270
+ else if ((null == (_actualField__def1 = actualField._def) ? void 0 : _actualField__def1.typeName) === 'ZodNumber') fields.push(/*#__PURE__*/ jsx(NumberField, {
271
+ ...fieldProps
272
+ }));
273
+ else fields.push(/*#__PURE__*/ jsx(TextField, {
274
+ ...fieldProps
275
+ }));
276
+ });
277
+ if ('aiScroll' === selectedType) {
278
+ const directionField = fields.find((field)=>/*#__PURE__*/ react.isValidElement(field) && 'direction' === field.props.name);
279
+ const distanceField = fields.find((field)=>/*#__PURE__*/ react.isValidElement(field) && 'distance' === field.props.name);
280
+ const otherFields = fields.filter((field)=>/*#__PURE__*/ react.isValidElement(field) && 'direction' !== field.props.name && 'distance' !== field.props.name);
281
+ if (directionField && distanceField) return /*#__PURE__*/ jsxs("div", {
282
+ className: "structured-params",
283
+ children: [
284
+ /*#__PURE__*/ jsxs("div", {
285
+ style: {
286
+ display: 'flex',
287
+ gap: 12,
288
+ marginBottom: 12
289
+ },
290
+ children: [
291
+ directionField,
292
+ distanceField
293
+ ]
294
+ }),
295
+ otherFields
296
+ ]
297
+ });
298
+ }
299
+ return /*#__PURE__*/ jsx("div", {
300
+ className: "structured-params",
301
+ children: fields
302
+ });
303
+ }
304
+ }
305
+ return null;
306
+ }, [
307
+ selectedType,
308
+ needsStructuredParams,
309
+ actionSpace,
310
+ handleStructuredKeyDown
311
+ ]);
88
312
  const handleMouseEnter = useCallback(()=>{
89
313
  setHoveringSettings(true);
90
314
  }, []);
@@ -133,52 +357,106 @@ const PromptInput = (param)=>{
133
357
  /*#__PURE__*/ jsxs(Space, {
134
358
  className: "mode-radio-group-wrapper",
135
359
  children: [
136
- /*#__PURE__*/ jsx(Form.Item, {
137
- name: "type",
138
- style: {
139
- margin: 0
140
- },
141
- children: /*#__PURE__*/ jsxs(Radio.Group, {
142
- buttonStyle: "solid",
143
- disabled: !runButtonEnabled,
144
- className: "mode-radio-group",
145
- children: [
146
- /*#__PURE__*/ jsx(Tooltip, {
147
- title: "Auto Planning: plan the steps and execute",
148
- children: /*#__PURE__*/ jsx(Radio.Button, {
149
- value: "aiAction",
150
- children: actionNameForType('aiAction')
151
- })
152
- }),
153
- /*#__PURE__*/ jsx(Tooltip, {
154
- title: "Extract data directly from the UI",
155
- children: /*#__PURE__*/ jsx(Radio.Button, {
156
- value: "aiQuery",
157
- children: actionNameForType('aiQuery')
158
- })
159
- }),
160
- /*#__PURE__*/ jsx(Tooltip, {
161
- title: "Understand the UI and determine if the assertion is true",
162
- children: /*#__PURE__*/ jsx(Radio.Button, {
163
- value: "aiAssert",
164
- children: actionNameForType('aiAssert')
165
- })
166
- }),
167
- /*#__PURE__*/ jsx(Tooltip, {
168
- title: "Instant Action: click something",
169
- children: /*#__PURE__*/ jsx(Radio.Button, {
170
- value: "aiTap",
171
- children: actionNameForType('aiTap')
360
+ /*#__PURE__*/ jsxs("div", {
361
+ className: "mode-radio-group",
362
+ children: [
363
+ /*#__PURE__*/ jsx(Form.Item, {
364
+ name: "type",
365
+ style: {
366
+ margin: 0
367
+ },
368
+ children: /*#__PURE__*/ jsx(Radio.Group, {
369
+ buttonStyle: "solid",
370
+ disabled: !runButtonEnabled,
371
+ children: defaultMainButtons.map((apiType)=>{
372
+ var _apiMetadata_apiType;
373
+ return /*#__PURE__*/ jsx(Tooltip, {
374
+ title: (null == (_apiMetadata_apiType = apiMetadata[apiType]) ? void 0 : _apiMetadata_apiType.title) || '',
375
+ children: /*#__PURE__*/ jsx(Radio.Button, {
376
+ value: apiType,
377
+ children: actionNameForType(apiType)
378
+ })
379
+ }, apiType);
172
380
  })
173
381
  })
174
- ]
175
- })
382
+ }),
383
+ /*#__PURE__*/ jsx(Dropdown, {
384
+ menu: (()=>{
385
+ const hiddenAPIs = Object.keys(apiMetadata).filter((api)=>!defaultMainButtons.includes(api));
386
+ const groupedItems = [];
387
+ const interactionAPIs = hiddenAPIs.filter((api)=>'interaction' === apiMetadata[api].group);
388
+ if (interactionAPIs.length > 0) groupedItems.push({
389
+ key: 'interaction-group',
390
+ type: 'group',
391
+ label: 'Interaction APIs',
392
+ children: interactionAPIs.map((api)=>({
393
+ key: api,
394
+ label: actionNameForType(api),
395
+ title: apiMetadata[api].title,
396
+ onClick: ()=>{
397
+ form.setFieldValue('type', api);
398
+ }
399
+ }))
400
+ });
401
+ const extractionAPIs = hiddenAPIs.filter((api)=>'extraction' === apiMetadata[api].group);
402
+ if (extractionAPIs.length > 0) groupedItems.push({
403
+ key: 'extraction-group',
404
+ type: 'group',
405
+ label: 'Data Extraction APIs',
406
+ children: extractionAPIs.map((api)=>({
407
+ key: api,
408
+ label: actionNameForType(api),
409
+ title: apiMetadata[api].title,
410
+ onClick: ()=>{
411
+ form.setFieldValue('type', api);
412
+ }
413
+ }))
414
+ });
415
+ const validationAPIs = hiddenAPIs.filter((api)=>'validation' === apiMetadata[api].group);
416
+ if (validationAPIs.length > 0) groupedItems.push({
417
+ key: 'validation-group',
418
+ type: 'group',
419
+ label: 'Validation APIs',
420
+ children: validationAPIs.map((api)=>({
421
+ key: api,
422
+ label: actionNameForType(api),
423
+ title: apiMetadata[api].title,
424
+ onClick: ()=>{
425
+ form.setFieldValue('type', api);
426
+ }
427
+ }))
428
+ });
429
+ return {
430
+ items: groupedItems
431
+ };
432
+ })(),
433
+ placement: "bottomLeft",
434
+ trigger: [
435
+ 'click'
436
+ ],
437
+ disabled: !runButtonEnabled,
438
+ children: /*#__PURE__*/ jsxs(Button, {
439
+ className: `more-apis-button ${!defaultMainButtons.includes(selectedType) ? 'selected-from-dropdown' : ''}`,
440
+ children: [
441
+ selectedType && !defaultMainButtons.includes(selectedType) ? actionNameForType(selectedType) : 'more',
442
+ /*#__PURE__*/ jsx(DownOutlined, {
443
+ style: {
444
+ fontSize: '10px',
445
+ marginLeft: '2px'
446
+ }
447
+ })
448
+ ]
449
+ })
450
+ })
451
+ ]
176
452
  }),
177
453
  /*#__PURE__*/ jsxs("div", {
178
454
  className: "action-icons",
179
455
  children: [
180
456
  /*#__PURE__*/ jsx(HistorySelector, {
181
- onSelect: handleSelectHistory
457
+ onSelect: handleSelectHistory,
458
+ history: historyForSelectedType,
459
+ currentType: selectedType
182
460
  }),
183
461
  /*#__PURE__*/ jsx("div", {
184
462
  className: hoveringSettings ? 'settings-wrapper settings-wrapper-hover' : 'settings-wrapper',
@@ -186,7 +464,7 @@ const PromptInput = (param)=>{
186
464
  onMouseLeave: handleMouseLeave,
187
465
  children: /*#__PURE__*/ jsx(ConfigSelector, {
188
466
  enableTracking: 'In-Browser-Extension' === serviceMode,
189
- showDeepThinkOption: 'aiTap' === selectedType
467
+ showDeepThinkOption: 'aiTap' === selectedType || 'aiHover' === selectedType || 'aiInput' === selectedType || 'aiRightClick' === selectedType || 'aiLocate' === selectedType
190
468
  })
191
469
  })
192
470
  ]
@@ -196,7 +474,10 @@ const PromptInput = (param)=>{
196
474
  /*#__PURE__*/ jsxs("div", {
197
475
  className: `main-side-console-input ${!runButtonEnabled ? 'disabled' : ''} ${loading ? 'loading' : ''}`,
198
476
  children: [
199
- /*#__PURE__*/ jsx(Form.Item, {
477
+ needsStructuredParams ? hasSingleStructuredParam ? renderStructuredParams() : /*#__PURE__*/ jsx("div", {
478
+ className: "structured-params-container",
479
+ children: renderStructuredParams()
480
+ }) : /*#__PURE__*/ jsx(Form.Item, {
200
481
  name: "prompt",
201
482
  style: {
202
483
  margin: 0