@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.
- 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/player/index.mjs +3 -0
- 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/es/utils/replay-scripts.mjs +32 -19
- 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/player/index.js +3 -0
- 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/lib/utils/replay-scripts.js +32 -19
- 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
|
@@ -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;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { DeviceAction } from '@midscene/core';
|
|
2
|
+
export interface InlineStructuredFieldConfig {
|
|
3
|
+
name: string;
|
|
4
|
+
placeholder?: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Compute the list of action identifiers that should be offered in the prompt
|
|
8
|
+
* input's action dropdown.
|
|
9
|
+
*
|
|
10
|
+
* Inclusion rules:
|
|
11
|
+
* - If `actionSpace` is empty/undefined, fall back to the full metadata set
|
|
12
|
+
* so dry-mode / offline renderers still show something to pick from.
|
|
13
|
+
* - `aiAct` is included **only when the current `actionSpace` exposes it**.
|
|
14
|
+
* It is the universal "natural-language" action and usually lives in every
|
|
15
|
+
* device's action space, but we intentionally do not force-inject it —
|
|
16
|
+
* devices that truly cannot run `aiAct` should not see a broken entry.
|
|
17
|
+
* - `extraction` and `validation` APIs are kept even when not in the device's
|
|
18
|
+
* `actionSpace`: they are executed against the captured UI context rather
|
|
19
|
+
* than being dispatched to the device, so they apply universally.
|
|
20
|
+
* - All remaining `actionSpace` entries are included verbatim (device-specific
|
|
21
|
+
* actions surface automatically).
|
|
22
|
+
*/
|
|
23
|
+
export declare const getAvailablePromptActionTypes: (actionSpace: DeviceAction<any>[] | undefined) => string[];
|
|
24
|
+
export declare const getInlineStructuredFieldConfig: (actionSpace: DeviceAction<any>[] | undefined, selectedType: string) => InlineStructuredFieldConfig | null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midscene/visualizer",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.5-beta-20260418223706.0",
|
|
4
4
|
"repository": "https://github.com/web-infra-dev/midscene",
|
|
5
5
|
"homepage": "https://midscenejs.com/",
|
|
6
6
|
"types": "./dist/types/index.d.ts",
|
|
@@ -58,10 +58,10 @@
|
|
|
58
58
|
"antd": "^5.21.6",
|
|
59
59
|
"buffer": "6.0.3",
|
|
60
60
|
"dayjs": "^1.11.11",
|
|
61
|
-
"@midscene/core": "1.7.
|
|
62
|
-
"@midscene/playground": "1.7.
|
|
63
|
-
"@midscene/shared": "1.7.
|
|
64
|
-
"@midscene/web": "1.7.
|
|
61
|
+
"@midscene/core": "1.7.5-beta-20260418223706.0",
|
|
62
|
+
"@midscene/playground": "1.7.5-beta-20260418223706.0",
|
|
63
|
+
"@midscene/shared": "1.7.5-beta-20260418223706.0",
|
|
64
|
+
"@midscene/web": "1.7.5-beta-20260418223706.0"
|
|
65
65
|
},
|
|
66
66
|
"license": "MIT",
|
|
67
67
|
"scripts": {
|