@midscene/visualizer 1.7.3 → 1.7.5-beta-20260418223706.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 (39) hide show
  1. package/dist/es/component/config-selector/index.mjs +2 -2
  2. package/dist/es/component/history-selector/index.css +83 -16
  3. package/dist/es/component/history-selector/index.mjs +2 -2
  4. package/dist/es/component/player/index.mjs +3 -0
  5. package/dist/es/component/playground/index.css +193 -1
  6. package/dist/es/component/playground-result/index.css +28 -0
  7. package/dist/es/component/playground-result/index.mjs +39 -54
  8. package/dist/es/component/prompt-input/index.css +165 -1
  9. package/dist/es/component/prompt-input/index.mjs +305 -130
  10. package/dist/es/component/universal-playground/index.css +47 -15
  11. package/dist/es/component/universal-playground/index.mjs +162 -102
  12. package/dist/es/utils/action-label.mjs +14 -0
  13. package/dist/es/utils/playground-utils.mjs +1 -9
  14. package/dist/es/utils/prompt-input-utils.mjs +45 -0
  15. package/dist/es/utils/replay-scripts.mjs +32 -19
  16. package/dist/lib/component/config-selector/index.js +2 -2
  17. package/dist/lib/component/history-selector/index.css +83 -16
  18. package/dist/lib/component/history-selector/index.js +2 -2
  19. package/dist/lib/component/player/index.js +3 -0
  20. package/dist/lib/component/playground/index.css +193 -1
  21. package/dist/lib/component/playground-result/index.css +28 -0
  22. package/dist/lib/component/playground-result/index.js +39 -54
  23. package/dist/lib/component/prompt-input/index.css +165 -1
  24. package/dist/lib/component/prompt-input/index.js +307 -130
  25. package/dist/lib/component/universal-playground/index.css +47 -15
  26. package/dist/lib/component/universal-playground/index.js +161 -101
  27. package/dist/lib/utils/action-label.js +51 -0
  28. package/dist/lib/utils/playground-utils.js +2 -10
  29. package/dist/lib/utils/prompt-input-utils.js +82 -0
  30. package/dist/lib/utils/replay-scripts.js +32 -19
  31. package/dist/types/component/config-selector/index.d.ts +2 -0
  32. package/dist/types/component/history-selector/index.d.ts +2 -0
  33. package/dist/types/component/prompt-input/index.d.ts +2 -1
  34. package/dist/types/index.d.ts +1 -1
  35. package/dist/types/types.d.ts +50 -0
  36. package/dist/types/utils/action-label.d.ts +11 -0
  37. package/dist/types/utils/playground-utils.d.ts +6 -1
  38. package/dist/types/utils/prompt-input-utils.d.ts +24 -0
  39. package/package.json +5 -5
@@ -178,7 +178,8 @@ function UniversalPlayground({ playgroundSDK, storage, contextProvider, config:
178
178
  ]);
179
179
  const configAlreadySet = Object.keys(config || {}).length >= 1;
180
180
  const runButtonEnabled = componentConfig.serverMode || !dryMode && !actionSpaceLoading && configAlreadySet;
181
- const selectedType = external_antd_namespaceObject.Form.useWatch('type', form);
181
+ const watchedType = external_antd_namespaceObject.Form.useWatch('type', form);
182
+ const selectedType = watchedType || form.getFieldValue('type');
182
183
  const serviceMode = (0, external_react_namespaceObject.useMemo)(()=>{
183
184
  if (!playgroundSDK || 'function' != typeof playgroundSDK.getServiceMode) return 'Server';
184
185
  return playgroundSDK.getServiceMode();
@@ -189,6 +190,49 @@ function UniversalPlayground({ playgroundSDK, storage, contextProvider, config:
189
190
  const layout = componentConfig.layout || 'vertical';
190
191
  const showVersionInfo = false !== componentConfig.showVersionInfo;
191
192
  const deviceType = componentConfig.deviceType;
193
+ const collapsibleProgressGroup = true === componentConfig.collapsibleProgressGroup;
194
+ var _componentConfig_progressGroupLabel;
195
+ const progressGroupLabel = null != (_componentConfig_progressGroupLabel = componentConfig.progressGroupLabel) ? _componentConfig_progressGroupLabel : 'Execution Flow';
196
+ const [collapsedProgressGroups, setCollapsedProgressGroups] = (0, external_react_namespaceObject.useState)(()=>new Set());
197
+ const toggleProgressGroup = (0, external_react_namespaceObject.useCallback)((groupId)=>{
198
+ setCollapsedProgressGroups((prev)=>{
199
+ const next = new Set(prev);
200
+ if (next.has(groupId)) next.delete(groupId);
201
+ else next.add(groupId);
202
+ return next;
203
+ });
204
+ }, []);
205
+ const { firstInProgressGroup, visibleInfoList } = (0, external_react_namespaceObject.useMemo)(()=>{
206
+ const firstIds = new Set();
207
+ const visible = [];
208
+ let currentGroupFirstId = null;
209
+ for (const item of infoList)if ('progress' === item.type) {
210
+ if (null === currentGroupFirstId) {
211
+ currentGroupFirstId = item.id;
212
+ firstIds.add(item.id);
213
+ visible.push(item);
214
+ continue;
215
+ }
216
+ if (!collapsibleProgressGroup || !collapsedProgressGroups.has(currentGroupFirstId)) visible.push(item);
217
+ } else {
218
+ currentGroupFirstId = null;
219
+ visible.push(item);
220
+ }
221
+ return {
222
+ firstInProgressGroup: firstIds,
223
+ visibleInfoList: visible
224
+ };
225
+ }, [
226
+ collapsedProgressGroups,
227
+ collapsibleProgressGroup,
228
+ infoList
229
+ ]);
230
+ const latestProgressId = (0, external_react_namespaceObject.useMemo)(()=>{
231
+ for(let i = infoList.length - 1; i >= 0; i--)if ('progress' === infoList[i].type) return infoList[i].id;
232
+ return null;
233
+ }, [
234
+ infoList
235
+ ]);
192
236
  return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
193
237
  className: `playground-container ${layout}-mode ${className}`.trim(),
194
238
  children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_antd_namespaceObject.Form, {
@@ -207,7 +251,7 @@ function UniversalPlayground({ playgroundSDK, storage, contextProvider, config:
207
251
  /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
208
252
  className: "middle-dialog-area",
209
253
  children: [
210
- infoList.length > 1 && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
254
+ false !== componentConfig.showClearButton && infoList.length > 1 && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
211
255
  className: "clear-button-container",
212
256
  children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.Button, {
213
257
  size: "small",
@@ -222,115 +266,130 @@ function UniversalPlayground({ playgroundSDK, storage, contextProvider, config:
222
266
  className: "info-list-container",
223
267
  children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.List, {
224
268
  itemLayout: "vertical",
225
- dataSource: infoList,
226
- renderItem: (item)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_antd_namespaceObject.List.Item, {
269
+ dataSource: visibleInfoList,
270
+ renderItem: (item)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_antd_namespaceObject.List.Item, {
227
271
  className: "list-item",
228
- children: 'user' === item.type ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
229
- className: "user-message-container",
230
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
231
- className: "user-message-bubble",
232
- children: item.content
233
- })
234
- }) : 'progress' === item.type ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
235
- children: (()=>{
236
- var _parts_, _item_result, _item_result1, _item_result2;
237
- const parts = item.content.split(' - ');
238
- const action = null == (_parts_ = parts[0]) ? void 0 : _parts_.trim();
239
- const description = parts.slice(1).join(' - ').trim();
240
- const currentIndex = infoList.findIndex((listItem)=>listItem.id === item.id);
241
- const laterProgressExists = infoList.slice(currentIndex + 1).some((listItem)=>'progress' === listItem.type);
242
- const isLatestProgress = !laterProgressExists;
243
- const shouldShowLoading = loading && isLatestProgress;
244
- return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
245
- children: [
246
- action && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("span", {
247
- className: "progress-action-item",
248
- children: [
249
- action,
250
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
251
- className: `progress-status-icon ${shouldShowLoading ? 'loading' : (null == (_item_result = item.result) ? void 0 : _item_result.error) ? 'error' : 'completed'}`,
252
- children: shouldShowLoading ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icons_namespaceObject.LoadingOutlined, {
253
- spin: true
254
- }) : (null == (_item_result1 = item.result) ? void 0 : _item_result1.error) ? '✗' : '✓'
272
+ children: [
273
+ collapsibleProgressGroup && firstInProgressGroup.has(item.id) ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("button", {
274
+ type: "button",
275
+ className: `progress-group-toggle ${collapsedProgressGroups.has(item.id) ? 'is-collapsed' : 'is-expanded'}`,
276
+ "aria-expanded": !collapsedProgressGroups.has(item.id),
277
+ onClick: ()=>toggleProgressGroup(item.id),
278
+ children: [
279
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
280
+ className: "progress-group-toggle-label",
281
+ children: progressGroupLabel
282
+ }),
283
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icons_namespaceObject.UpOutlined, {
284
+ className: "progress-group-toggle-chevron"
285
+ })
286
+ ]
287
+ }) : null,
288
+ 'user' === item.type ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
289
+ className: "user-message-container",
290
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
291
+ className: "user-message-bubble",
292
+ children: item.content
293
+ })
294
+ }) : 'progress' === item.type ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
295
+ children: (()=>{
296
+ var _parts_, _item_result, _item_result1, _item_result2;
297
+ const parts = item.content.split(' - ');
298
+ const action = null == (_parts_ = parts[0]) ? void 0 : _parts_.trim();
299
+ const description = parts.slice(1).join(' - ').trim();
300
+ const isLatestProgress = item.id === latestProgressId;
301
+ const shouldShowLoading = loading && isLatestProgress;
302
+ return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
303
+ children: [
304
+ action && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("span", {
305
+ className: "progress-action-item",
306
+ children: [
307
+ action,
308
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
309
+ className: `progress-status-icon ${shouldShowLoading ? 'loading' : (null == (_item_result = item.result) ? void 0 : _item_result.error) ? 'error' : 'completed'}`,
310
+ children: shouldShowLoading ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icons_namespaceObject.LoadingOutlined, {
311
+ spin: true
312
+ }) : (null == (_item_result1 = item.result) ? void 0 : _item_result1.error) ? '✗' : '✓'
313
+ })
314
+ ]
315
+ }),
316
+ description && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
317
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_shiny_text_index_js_default(), {
318
+ text: description,
319
+ className: "progress-description",
320
+ disabled: !shouldShowLoading
255
321
  })
256
- ]
257
- }),
258
- description && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
259
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_shiny_text_index_js_default(), {
260
- text: description,
261
- className: "progress-description",
262
- disabled: !shouldShowLoading
322
+ }),
323
+ (null == (_item_result2 = item.result) ? void 0 : _item_result2.error) && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(ErrorMessage, {
324
+ error: item.result.error
263
325
  })
264
- }),
265
- (null == (_item_result2 = item.result) ? void 0 : _item_result2.error) && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(ErrorMessage, {
266
- error: item.result.error
326
+ ]
327
+ });
328
+ })()
329
+ }) : 'separator' === item.type ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
330
+ className: "new-conversation-separator",
331
+ children: [
332
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
333
+ className: "separator-line"
334
+ }),
335
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
336
+ className: "separator-text-container",
337
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Text, {
338
+ type: "secondary",
339
+ className: "separator-text",
340
+ children: item.content
267
341
  })
268
- ]
269
- });
270
- })()
271
- }) : 'separator' === item.type ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
272
- className: "new-conversation-separator",
273
- children: [
274
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
275
- className: "separator-line"
276
- }),
277
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
278
- className: "separator-text-container",
279
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(Text, {
280
- type: "secondary",
281
- className: "separator-text",
282
- children: item.content
283
342
  })
284
- })
285
- ]
286
- }) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
287
- className: "system-message-container",
288
- children: [
289
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
290
- className: "system-message-header",
291
- children: [
292
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icons_default(), {
293
- component: branding.icon || avatar_js_default(),
294
- style: {
295
- fontSize: 20
296
- }
297
- }),
298
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
299
- className: "system-message-title",
300
- children: branding.title || 'Playground'
301
- })
302
- ]
303
- }),
304
- (item.content || item.result) && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
305
- className: "system-message-content",
306
- children: 'result' === item.type ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_playground_result_index_js_namespaceObject.PlaygroundResultView, {
307
- result: item.result || null,
308
- loading: item.loading || false,
309
- serverValid: true,
310
- serviceMode: serviceMode,
311
- replayScriptsInfo: item.replayScriptsInfo || null,
312
- replayCounter: item.replayCounter || 0,
313
- loadingProgressText: item.loadingProgressText || '',
314
- verticalMode: item.verticalMode || false,
315
- fitMode: "width",
316
- actionType: item.actionType
317
- }) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
343
+ ]
344
+ }) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
345
+ className: "system-message-container",
346
+ children: [
347
+ false !== componentConfig.showSystemMessageHeader && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("div", {
348
+ className: "system-message-header",
318
349
  children: [
319
- /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
320
- className: "system-message-text",
321
- children: item.content
350
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(icons_default(), {
351
+ component: branding.icon || avatar_js_default(),
352
+ style: {
353
+ fontSize: 20
354
+ }
322
355
  }),
323
- item.loading && item.loadingProgressText && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
324
- className: "loading-progress-text",
325
- children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
326
- children: item.loadingProgressText
327
- })
356
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
357
+ className: "system-message-title",
358
+ children: branding.title || 'Playground'
328
359
  })
329
360
  ]
361
+ }),
362
+ (item.content || item.result) && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
363
+ className: "system-message-content",
364
+ children: 'result' === item.type ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_playground_result_index_js_namespaceObject.PlaygroundResultView, {
365
+ result: item.result || null,
366
+ loading: item.loading || false,
367
+ serverValid: true,
368
+ serviceMode: serviceMode,
369
+ replayScriptsInfo: item.replayScriptsInfo || null,
370
+ replayCounter: item.replayCounter || 0,
371
+ loadingProgressText: item.loadingProgressText || '',
372
+ verticalMode: item.verticalMode || false,
373
+ fitMode: "width",
374
+ actionType: item.actionType
375
+ }) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
376
+ children: [
377
+ /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
378
+ className: "system-message-text",
379
+ children: item.content
380
+ }),
381
+ item.loading && item.loadingProgressText && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
382
+ className: "loading-progress-text",
383
+ children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
384
+ children: item.loadingProgressText
385
+ })
386
+ })
387
+ ]
388
+ })
330
389
  })
331
- })
332
- ]
333
- })
390
+ ]
391
+ })
392
+ ]
334
393
  }, item.id)
335
394
  })
336
395
  }),
@@ -359,6 +418,7 @@ function UniversalPlayground({ playgroundSDK, storage, contextProvider, config:
359
418
  onRun: handleFormRun,
360
419
  onStop: handleStop,
361
420
  actionSpace: actionSpace,
421
+ chrome: componentConfig.promptInputChrome,
362
422
  deviceType: deviceType
363
423
  })
364
424
  ]
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, definition)=>{
5
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
+ enumerable: true,
7
+ get: definition[key]
8
+ });
9
+ };
10
+ })();
11
+ (()=>{
12
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
+ })();
14
+ (()=>{
15
+ __webpack_require__.r = (exports1)=>{
16
+ if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
+ value: 'Module'
18
+ });
19
+ Object.defineProperty(exports1, '__esModule', {
20
+ value: true
21
+ });
22
+ };
23
+ })();
24
+ var __webpack_exports__ = {};
25
+ __webpack_require__.r(__webpack_exports__);
26
+ __webpack_require__.d(__webpack_exports__, {
27
+ actionNameForType: ()=>actionNameForType,
28
+ getPromptInputActionLabel: ()=>getPromptInputActionLabel
29
+ });
30
+ const actionNameForType = (type)=>{
31
+ if (!type) return '';
32
+ const typeWithoutAi = type.startsWith('ai') ? type.slice(2) : type;
33
+ if (typeWithoutAi.startsWith('IOS')) return typeWithoutAi.substring(3).replace(/([A-Z])/g, ' $1').replace(/^/, 'IOS').trim();
34
+ const fullName = typeWithoutAi.replace(/([A-Z])/g, ' $1').trim();
35
+ const words = fullName.split(' ');
36
+ const result = words.length > 3 ? words.slice(-3).join(' ') : fullName;
37
+ return result.replace(/\b\w/g, (c)=>c.toUpperCase());
38
+ };
39
+ const getPromptInputActionLabel = (type, overrideLabel)=>{
40
+ if (overrideLabel) return overrideLabel;
41
+ return actionNameForType(type) || 'Action';
42
+ };
43
+ exports.actionNameForType = __webpack_exports__.actionNameForType;
44
+ exports.getPromptInputActionLabel = __webpack_exports__.getPromptInputActionLabel;
45
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
46
+ "actionNameForType",
47
+ "getPromptInputActionLabel"
48
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
49
+ Object.defineProperty(exports, '__esModule', {
50
+ value: true
51
+ });
@@ -25,21 +25,13 @@ var __webpack_exports__ = {};
25
25
  __webpack_require__.r(__webpack_exports__);
26
26
  __webpack_require__.d(__webpack_exports__, {
27
27
  staticAgentFromContext: ()=>staticAgentFromContext,
28
- actionNameForType: ()=>actionNameForType,
28
+ actionNameForType: ()=>external_action_label_js_namespaceObject.actionNameForType,
29
29
  getPlaceholderForType: ()=>getPlaceholderForType,
30
30
  isRunButtonEnabled: ()=>isRunButtonEnabled
31
31
  });
32
32
  const static_namespaceObject = require("@midscene/web/static");
33
33
  const external_types_js_namespaceObject = require("../types.js");
34
- const actionNameForType = (type)=>{
35
- if (!type) return '';
36
- const typeWithoutAi = type.startsWith('ai') ? type.slice(2) : type;
37
- if (typeWithoutAi.startsWith('IOS')) return typeWithoutAi.substring(3).replace(/([A-Z])/g, ' $1').replace(/^/, 'IOS').trim();
38
- const fullName = typeWithoutAi.replace(/([A-Z])/g, ' $1').trim();
39
- const words = fullName.split(' ');
40
- const result = words.length > 3 ? words.slice(-3).join(' ') : fullName;
41
- return result.replace(/\b\w/g, (c)=>c.toUpperCase());
42
- };
34
+ const external_action_label_js_namespaceObject = require("./action-label.js");
43
35
  const staticAgentFromContext = (context)=>{
44
36
  const page = new static_namespaceObject.StaticPage(context);
45
37
  return new static_namespaceObject.StaticPageAgent(page);
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ var __webpack_require__ = {};
3
+ (()=>{
4
+ __webpack_require__.d = (exports1, definition)=>{
5
+ for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
+ enumerable: true,
7
+ get: definition[key]
8
+ });
9
+ };
10
+ })();
11
+ (()=>{
12
+ __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
+ })();
14
+ (()=>{
15
+ __webpack_require__.r = (exports1)=>{
16
+ if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
+ value: 'Module'
18
+ });
19
+ Object.defineProperty(exports1, '__esModule', {
20
+ value: true
21
+ });
22
+ };
23
+ })();
24
+ var __webpack_exports__ = {};
25
+ __webpack_require__.r(__webpack_exports__);
26
+ __webpack_require__.d(__webpack_exports__, {
27
+ getAvailablePromptActionTypes: ()=>getAvailablePromptActionTypes,
28
+ getInlineStructuredFieldConfig: ()=>getInlineStructuredFieldConfig
29
+ });
30
+ const external_types_js_namespaceObject = require("../types.js");
31
+ const external_constants_js_namespaceObject = require("./constants.js");
32
+ const getAvailablePromptActionTypes = (actionSpace)=>{
33
+ const metadataMethods = Object.keys(external_constants_js_namespaceObject.apiMetadata);
34
+ if (!(null == actionSpace ? void 0 : actionSpace.length)) return metadataMethods;
35
+ const availableMethods = actionSpace.map((action)=>action.interfaceAlias || action.name);
36
+ const supportsAiAct = availableMethods.includes('aiAct');
37
+ const finalMethods = new Set();
38
+ metadataMethods.forEach((method)=>{
39
+ const methodInfo = external_constants_js_namespaceObject.apiMetadata[method];
40
+ if ('aiAct' === method) {
41
+ if (supportsAiAct) finalMethods.add(method);
42
+ return;
43
+ }
44
+ if ((null == methodInfo ? void 0 : methodInfo.group) === 'extraction' || (null == methodInfo ? void 0 : methodInfo.group) === 'validation') return void finalMethods.add(method);
45
+ if (availableMethods.includes(method)) finalMethods.add(method);
46
+ });
47
+ availableMethods.forEach((method)=>{
48
+ finalMethods.add(method);
49
+ });
50
+ return Array.from(finalMethods);
51
+ };
52
+ const getInlineStructuredFieldConfig = (actionSpace, selectedType)=>{
53
+ var _actualField__def, _actualField__def1;
54
+ if (!(null == actionSpace ? void 0 : actionSpace.length) || !selectedType) return null;
55
+ const action = actionSpace.find((item)=>item.interfaceAlias === selectedType || item.name === selectedType);
56
+ if (!(null == action ? void 0 : action.paramSchema) || !(0, external_types_js_namespaceObject.isZodObjectSchema)(action.paramSchema)) return null;
57
+ const schema = action.paramSchema;
58
+ const shape = schema.shape || {};
59
+ const keys = Object.keys(shape);
60
+ if (1 !== keys.length) return null;
61
+ const [name] = keys;
62
+ const field = shape[name];
63
+ const { actualField } = (0, external_types_js_namespaceObject.unwrapZodType)(field);
64
+ const isLocate = (0, external_types_js_namespaceObject.isLocateField)(actualField);
65
+ const fieldType = null == (_actualField__def = actualField._def) ? void 0 : _actualField__def.typeName;
66
+ const isInlineField = 'ZodString' === fieldType || isLocate;
67
+ if (!isInlineField) return null;
68
+ const placeholder = (null == (_actualField__def1 = actualField._def) ? void 0 : _actualField__def1.description) || actualField.description || (isLocate ? 'Describe the element you want to interact with' : `Enter ${name}`);
69
+ return {
70
+ name,
71
+ placeholder
72
+ };
73
+ };
74
+ exports.getAvailablePromptActionTypes = __webpack_exports__.getAvailablePromptActionTypes;
75
+ exports.getInlineStructuredFieldConfig = __webpack_exports__.getInlineStructuredFieldConfig;
76
+ for(var __rspack_i in __webpack_exports__)if (-1 === [
77
+ "getAvailablePromptActionTypes",
78
+ "getInlineStructuredFieldConfig"
79
+ ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
80
+ Object.defineProperty(exports, '__esModule', {
81
+ value: true
82
+ });
@@ -101,6 +101,19 @@ const cameraStateForRect = (rect, imageWidth, imageHeight)=>{
101
101
  width: Math.round(cameraWidth)
102
102
  };
103
103
  };
104
+ const createFullPageCameraState = (imageWidth, imageHeight)=>cameraStateForRect({
105
+ left: 0,
106
+ top: 0,
107
+ width: imageWidth,
108
+ height: imageHeight
109
+ }, imageWidth, imageHeight);
110
+ const resolveTaskShotSize = (task, fallbackWidth, fallbackHeight)=>{
111
+ var _task_uiContext_shotSize, _task_uiContext, _task_uiContext_shotSize1, _task_uiContext1;
112
+ return {
113
+ width: (null == task ? void 0 : null == (_task_uiContext = task.uiContext) ? void 0 : null == (_task_uiContext_shotSize = _task_uiContext.shotSize) ? void 0 : _task_uiContext_shotSize.width) || fallbackWidth,
114
+ height: (null == task ? void 0 : null == (_task_uiContext1 = task.uiContext) ? void 0 : null == (_task_uiContext_shotSize1 = _task_uiContext1.shotSize) ? void 0 : _task_uiContext_shotSize1.height) || fallbackHeight
115
+ };
116
+ };
104
117
  const mergeTwoCameraState = (cameraState1, cameraState2)=>{
105
118
  const newLeft = Math.min(cameraState1.left, cameraState2.left);
106
119
  const newTop = Math.min(cameraState1.top, cameraState2.top);
@@ -227,12 +240,6 @@ const generateAnimationScripts = (execution, task, imageWidth, imageHeight, exec
227
240
  }
228
241
  }
229
242
  if (0 === tasksIncluded.length) return null;
230
- const fullPageCameraState = cameraStateForRect({
231
- left: 0,
232
- top: 0,
233
- width: imageWidth,
234
- height: imageHeight
235
- }, imageWidth, imageHeight);
236
243
  const getTaskId = (taskIndex)=>{
237
244
  var _tasksIncluded_taskIndex;
238
245
  return null == (_tasksIncluded_taskIndex = tasksIncluded[taskIndex]) ? void 0 : _tasksIncluded_taskIndex.taskId;
@@ -355,7 +362,7 @@ const generateAnimationScripts = (execution, task, imageWidth, imageHeight, exec
355
362
  }, asScreenshot(screenshot)));
356
363
  }
357
364
  } else if ('Action Space' === task.type) {
358
- var _task_recorder_, _task_recorder, _task_uiContext_shotSize2, _task_uiContext2, _task_uiContext_shotSize3, _task_uiContext3;
365
+ var _task_recorder_, _task_recorder;
359
366
  const title = (0, agent_namespaceObject.typeStr)(task);
360
367
  const subTitle = (0, agent_namespaceObject.paramStr)(task);
361
368
  scripts.push({
@@ -377,14 +384,15 @@ const generateAnimationScripts = (execution, task, imageWidth, imageHeight, exec
377
384
  }
378
385
  scripts.push(setPointerScript(external_index_js_namespaceObject.mousePointer, title, subTitle, currentTaskId));
379
386
  const screenshot = null == (_task_recorder = task.recorder) ? void 0 : null == (_task_recorder_ = _task_recorder[0]) ? void 0 : _task_recorder_.screenshot;
387
+ const { width, height } = resolveTaskShotSize(task, imageWidth, imageHeight);
380
388
  scripts.push(createScript({
381
389
  type: 'img',
382
390
  duration: actionDuration,
383
- camera: 'Sleep' === task.subType ? fullPageCameraState : void 0,
391
+ camera: 'Sleep' === task.subType ? createFullPageCameraState(width, height) : void 0,
384
392
  title,
385
393
  subTitle,
386
- imageWidth: (null == (_task_uiContext2 = task.uiContext) ? void 0 : null == (_task_uiContext_shotSize2 = _task_uiContext2.shotSize) ? void 0 : _task_uiContext_shotSize2.width) || imageWidth,
387
- imageHeight: (null == (_task_uiContext3 = task.uiContext) ? void 0 : null == (_task_uiContext_shotSize3 = _task_uiContext3.shotSize) ? void 0 : _task_uiContext_shotSize3.height) || imageHeight,
394
+ imageWidth: width,
395
+ imageHeight: height,
388
396
  taskId: currentTaskId
389
397
  }, asScreenshot(screenshot)));
390
398
  } else {
@@ -393,33 +401,34 @@ const generateAnimationScripts = (execution, task, imageWidth, imageHeight, exec
393
401
  const subTitle = (0, agent_namespaceObject.paramStr)(task);
394
402
  const screenshot = null == (_task_recorder1 = task.recorder) ? void 0 : null == (_task_recorder_1 = _task_recorder1[task.recorder.length - 1]) ? void 0 : _task_recorder_1.screenshot;
395
403
  if (screenshot) {
396
- var _task_uiContext_shotSize4, _task_uiContext4, _task_uiContext_shotSize5, _task_uiContext5;
404
+ const { width, height } = resolveTaskShotSize(task, imageWidth, imageHeight);
397
405
  scripts.push(createScript({
398
406
  type: 'img',
399
407
  duration: stillDuration,
400
- camera: fullPageCameraState,
408
+ camera: createFullPageCameraState(width, height),
401
409
  title,
402
410
  subTitle,
403
- imageWidth: (null == (_task_uiContext4 = task.uiContext) ? void 0 : null == (_task_uiContext_shotSize4 = _task_uiContext4.shotSize) ? void 0 : _task_uiContext_shotSize4.width) || imageWidth,
404
- imageHeight: (null == (_task_uiContext5 = task.uiContext) ? void 0 : null == (_task_uiContext_shotSize5 = _task_uiContext5.shotSize) ? void 0 : _task_uiContext_shotSize5.height) || imageHeight,
411
+ imageWidth: width,
412
+ imageHeight: height,
405
413
  taskId: currentTaskId
406
414
  }, asScreenshot(screenshot)));
407
415
  }
408
416
  }
409
417
  if ('finished' !== task.status) {
410
- var _task_recorder_2, _task_recorder2, _task_uiContext_shotSize6, _task_uiContext6, _task_uiContext_shotSize7, _task_uiContext7;
418
+ var _task_recorder_2, _task_recorder2;
411
419
  const errorTitle = (0, agent_namespaceObject.typeStr)(task);
412
420
  const errorMsg = task.errorMessage || 'unknown error';
413
421
  const errorSubTitle = errorMsg.indexOf('NOT_IMPLEMENTED_AS_DESIGNED') > 0 ? 'Further actions cannot be performed in the current environment' : errorMsg;
414
422
  const screenshot = null == (_task_recorder2 = task.recorder) ? void 0 : null == (_task_recorder_2 = _task_recorder2[task.recorder.length - 1]) ? void 0 : _task_recorder_2.screenshot;
423
+ const { width, height } = resolveTaskShotSize(task, imageWidth, imageHeight);
415
424
  scripts.push(createScript({
416
425
  type: 'img',
417
- camera: fullPageCameraState,
426
+ camera: createFullPageCameraState(width, height),
418
427
  duration: stillDuration,
419
428
  title: errorTitle,
420
429
  subTitle: errorSubTitle,
421
- imageWidth: (null == (_task_uiContext6 = task.uiContext) ? void 0 : null == (_task_uiContext_shotSize6 = _task_uiContext6.shotSize) ? void 0 : _task_uiContext_shotSize6.width) || imageWidth,
422
- imageHeight: (null == (_task_uiContext7 = task.uiContext) ? void 0 : null == (_task_uiContext_shotSize7 = _task_uiContext7.shotSize) ? void 0 : _task_uiContext_shotSize7.height) || imageHeight,
430
+ imageWidth: width,
431
+ imageHeight: height,
423
432
  taskId: currentTaskId
424
433
  }, asScreenshot(screenshot)));
425
434
  }
@@ -434,12 +443,16 @@ const generateAnimationScripts = (execution, task, imageWidth, imageHeight, exec
434
443
  });
435
444
  insightOnTop = false;
436
445
  }
446
+ const lastTaskShotSize = tasksIncluded.length > 0 ? resolveTaskShotSize(tasksIncluded[tasksIncluded.length - 1], imageWidth, imageHeight) : {
447
+ width: imageWidth,
448
+ height: imageHeight
449
+ };
437
450
  scripts.push({
438
451
  title: 'End',
439
452
  subTitle: initSubTitle,
440
453
  type: 'img',
441
454
  duration: lastFrameDuration,
442
- camera: fullPageCameraState,
455
+ camera: createFullPageCameraState(lastTaskShotSize.width, lastTaskShotSize.height),
443
456
  taskId: void 0
444
457
  });
445
458
  return scripts;
@@ -1,4 +1,5 @@
1
1
  import type React from 'react';
2
+ import type { ReactNode } from 'react';
2
3
  import type { DeviceType } from '../../types';
3
4
  interface ConfigSelectorProps {
4
5
  showDeepLocateOption: boolean;
@@ -7,6 +8,7 @@ interface ConfigSelectorProps {
7
8
  showDataExtractionOptions: boolean;
8
9
  hideDomAndScreenshotOptions?: boolean;
9
10
  deviceType?: DeviceType;
11
+ trigger?: ReactNode;
10
12
  }
11
13
  export declare const ConfigSelector: React.FC<ConfigSelectorProps>;
12
14
  export {};
@@ -1,10 +1,12 @@
1
1
  import type React from 'react';
2
+ import type { ReactNode } from 'react';
2
3
  import type { HistoryItem } from '../../store/history';
3
4
  import './index.less';
4
5
  interface HistorySelectorProps {
5
6
  onSelect: (history: HistoryItem) => void;
6
7
  history: HistoryItem[];
7
8
  currentType: string;
9
+ trigger?: ReactNode;
8
10
  }
9
11
  export declare const HistorySelector: React.FC<HistorySelectorProps>;
10
12
  export {};