@midscene/visualizer 1.7.4 → 1.7.5-beta-20260420031652.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/component/config-selector/index.mjs +2 -2
- package/dist/es/component/history-selector/index.css +83 -16
- package/dist/es/component/history-selector/index.mjs +2 -2
- package/dist/es/component/playground/index.css +193 -1
- package/dist/es/component/playground-result/index.css +28 -0
- package/dist/es/component/playground-result/index.mjs +39 -54
- package/dist/es/component/prompt-input/index.css +165 -1
- package/dist/es/component/prompt-input/index.mjs +305 -130
- package/dist/es/component/universal-playground/index.css +47 -15
- package/dist/es/component/universal-playground/index.mjs +162 -102
- package/dist/es/utils/action-label.mjs +14 -0
- package/dist/es/utils/playground-utils.mjs +1 -9
- package/dist/es/utils/prompt-input-utils.mjs +45 -0
- package/dist/lib/component/config-selector/index.js +2 -2
- package/dist/lib/component/history-selector/index.css +83 -16
- package/dist/lib/component/history-selector/index.js +2 -2
- package/dist/lib/component/playground/index.css +193 -1
- package/dist/lib/component/playground-result/index.css +28 -0
- package/dist/lib/component/playground-result/index.js +39 -54
- package/dist/lib/component/prompt-input/index.css +165 -1
- package/dist/lib/component/prompt-input/index.js +307 -130
- package/dist/lib/component/universal-playground/index.css +47 -15
- package/dist/lib/component/universal-playground/index.js +161 -101
- package/dist/lib/utils/action-label.js +51 -0
- package/dist/lib/utils/playground-utils.js +2 -10
- package/dist/lib/utils/prompt-input-utils.js +82 -0
- package/dist/types/component/config-selector/index.d.ts +2 -0
- package/dist/types/component/history-selector/index.d.ts +2 -0
- package/dist/types/component/prompt-input/index.d.ts +2 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/types.d.ts +50 -0
- package/dist/types/utils/action-label.d.ts +11 -0
- package/dist/types/utils/playground-utils.d.ts +6 -1
- package/dist/types/utils/prompt-input-utils.d.ts +24 -0
- 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
|
|
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:
|
|
226
|
-
renderItem: (item)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.
|
|
269
|
+
dataSource: visibleInfoList,
|
|
270
|
+
renderItem: (item)=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_antd_namespaceObject.List.Item, {
|
|
227
271
|
className: "list-item",
|
|
228
|
-
children:
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
className:
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
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
|
-
|
|
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
|
-
|
|
266
|
-
|
|
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
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
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)(
|
|
320
|
-
|
|
321
|
-
|
|
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
|
-
|
|
324
|
-
className: "
|
|
325
|
-
children:
|
|
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
|
|
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
|
+
});
|
|
@@ -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 {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import './index.less';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import type { DeviceType, RunType } from '../../types';
|
|
4
|
-
import type { ServiceModeType } from '../../types';
|
|
4
|
+
import type { PromptInputChromeConfig, ServiceModeType } from '../../types';
|
|
5
5
|
import './index.less';
|
|
6
6
|
import type { DeviceAction } from '@midscene/core';
|
|
7
7
|
interface PromptInputProps {
|
|
@@ -18,6 +18,7 @@ interface PromptInputProps {
|
|
|
18
18
|
hideDomAndScreenshotOptions?: boolean;
|
|
19
19
|
actionSpace: DeviceAction<any>[];
|
|
20
20
|
deviceType?: DeviceType;
|
|
21
|
+
chrome?: PromptInputChromeConfig;
|
|
21
22
|
}
|
|
22
23
|
export declare const PromptInput: React.FC<PromptInputProps>;
|
|
23
24
|
export {};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -22,6 +22,6 @@ export { actionNameForType, staticAgentFromContext, getPlaceholderForType, } fro
|
|
|
22
22
|
export { timeStr, filterBase64Value } from './utils';
|
|
23
23
|
export { default as ShinyText } from './component/shiny-text';
|
|
24
24
|
export { UniversalPlayground, default as UniversalPlaygroundDefault, } from './component/universal-playground';
|
|
25
|
-
export type { UniversalPlaygroundProps, PlaygroundSDKLike, StorageProvider, ContextProvider, UniversalPlaygroundConfig, PlaygroundBranding, InfoListItem, FormValue, ExecutionOptions, ProgressCallback, DeviceType, ExecutionUxHint, ExecutionUxConfig, } from './types';
|
|
25
|
+
export type { UniversalPlaygroundProps, PlaygroundSDKLike, StorageProvider, ContextProvider, UniversalPlaygroundConfig, PlaygroundBranding, InfoListItem, FormValue, ExecutionOptions, ProgressCallback, DeviceType, ExecutionUxHint, ExecutionUxConfig, PromptInputChromeConfig, } from './types';
|
|
26
26
|
export { LocalStorageProvider, MemoryStorageProvider, NoOpStorageProvider, IndexedDBStorageProvider, createStorageProvider, detectBestStorageType, StorageType, } from './component/universal-playground/providers/storage-provider';
|
|
27
27
|
export { BaseContextProvider, AgentContextProvider, StaticContextProvider, NoOpContextProvider, } from './component/universal-playground/providers/context-provider';
|
package/dist/types/types.d.ts
CHANGED
|
@@ -165,6 +165,56 @@ export interface UniversalPlaygroundConfig {
|
|
|
165
165
|
showEnvConfigReminder?: boolean;
|
|
166
166
|
deviceType?: DeviceType;
|
|
167
167
|
executionUx?: ExecutionUxConfig;
|
|
168
|
+
promptInputChrome?: PromptInputChromeConfig;
|
|
169
|
+
/**
|
|
170
|
+
* Whether to render the "clear conversation" button that appears above the
|
|
171
|
+
* message list once there is more than one item. Defaults to `true`.
|
|
172
|
+
* Embedding hosts whose own shell exposes a clear affordance can set this
|
|
173
|
+
* to `false`.
|
|
174
|
+
*/
|
|
175
|
+
showClearButton?: boolean;
|
|
176
|
+
/**
|
|
177
|
+
* Whether each system message renders its header (branding icon + title).
|
|
178
|
+
* Defaults to `true`. Compact embeddings may set this to `false` to let the
|
|
179
|
+
* host shell own the branding.
|
|
180
|
+
*/
|
|
181
|
+
showSystemMessageHeader?: boolean;
|
|
182
|
+
/**
|
|
183
|
+
* When `true`, consecutive progress items in the conversation log are
|
|
184
|
+
* wrapped under a single collapsible group header. A "run" is bounded by
|
|
185
|
+
* the first non-progress item before and after it. Defaults to `false`
|
|
186
|
+
* (flat list, every progress item renders inline).
|
|
187
|
+
*/
|
|
188
|
+
collapsibleProgressGroup?: boolean;
|
|
189
|
+
/**
|
|
190
|
+
* Label shown on the collapsible progress group header when
|
|
191
|
+
* `collapsibleProgressGroup` is enabled. Defaults to `'Execution Flow'`.
|
|
192
|
+
*/
|
|
193
|
+
progressGroupLabel?: string;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Optional visual chrome overrides for the embedded prompt input.
|
|
197
|
+
* - `default` renders the full-featured prompt input (type radio row,
|
|
198
|
+
* history button, full send/stop controls).
|
|
199
|
+
* - `minimal` renders a compact toolbar with only inline params, an action
|
|
200
|
+
* dropdown, send/stop — intended for embedded hosts (e.g. Studio) whose
|
|
201
|
+
* outer shell already owns the type selection affordance.
|
|
202
|
+
*/
|
|
203
|
+
export interface PromptInputChromeConfig {
|
|
204
|
+
variant?: 'default' | 'minimal';
|
|
205
|
+
placeholder?: string;
|
|
206
|
+
/**
|
|
207
|
+
* Label shown on the primary action button. When provided, overrides the
|
|
208
|
+
* auto-derived label (`actionNameForType(type)`). If omitted, the action
|
|
209
|
+
* name derived from the current type is used, falling back to "Action".
|
|
210
|
+
*/
|
|
211
|
+
primaryActionLabel?: string;
|
|
212
|
+
icons?: {
|
|
213
|
+
action?: string;
|
|
214
|
+
actionChevron?: string;
|
|
215
|
+
history?: string;
|
|
216
|
+
settings?: string;
|
|
217
|
+
};
|
|
168
218
|
}
|
|
169
219
|
export interface PlaygroundBranding {
|
|
170
220
|
title?: string;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const actionNameForType: (type: string) => string;
|
|
2
|
+
/**
|
|
3
|
+
* Resolves the label shown on the prompt input primary action button.
|
|
4
|
+
*
|
|
5
|
+
* Priority:
|
|
6
|
+
* 1. `overrideLabel` — when provided, it wins unconditionally. This lets an
|
|
7
|
+
* embedding host pin a stable label regardless of the current type.
|
|
8
|
+
* 2. `actionNameForType(type)` — the auto-derived label for the selected type.
|
|
9
|
+
* 3. Literal `'Action'` — last-resort fallback when neither is available.
|
|
10
|
+
*/
|
|
11
|
+
export declare const getPromptInputActionLabel: (type: string, overrideLabel?: string) => string;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import type { UIContext } from '@midscene/core';
|
|
2
2
|
import { StaticPageAgent } from '@midscene/web/static';
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated Import `actionNameForType` from `./action-label` directly.
|
|
5
|
+
* This re-export exists only to keep older import paths working and may be
|
|
6
|
+
* removed once all call sites are migrated.
|
|
7
|
+
*/
|
|
8
|
+
export { actionNameForType } from './action-label';
|
|
4
9
|
export declare const staticAgentFromContext: (context: UIContext) => StaticPageAgent;
|
|
5
10
|
export declare const getPlaceholderForType: (type: string) => string;
|
|
6
11
|
export declare const isRunButtonEnabled: (runButtonEnabled: boolean, needsStructuredParams: boolean, params: any, actionSpace: any[] | undefined, selectedType: string, promptValue: string) => boolean;
|