@godscene/visualizer 1.7.11
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/LICENSE +21 -0
- package/README.md +9 -0
- package/dist/es/component/blackboard/highlights.mjs +47 -0
- package/dist/es/component/blackboard/index.css +118 -0
- package/dist/es/component/blackboard/index.mjs +122 -0
- package/dist/es/component/config-selector/index.mjs +251 -0
- package/dist/es/component/context-preview/index.mjs +37 -0
- package/dist/es/component/env-config/index.mjs +237 -0
- package/dist/es/component/env-config-reminder/index.css +30 -0
- package/dist/es/component/env-config-reminder/index.mjs +27 -0
- package/dist/es/component/form-field/index.mjs +158 -0
- package/dist/es/component/history-selector/index.css +237 -0
- package/dist/es/component/history-selector/index.mjs +197 -0
- package/dist/es/component/index.mjs +1 -0
- package/dist/es/component/logo/index.css +19 -0
- package/dist/es/component/logo/index.mjs +20 -0
- package/dist/es/component/logo/logo.mjs +2 -0
- package/dist/es/component/misc/index.mjs +96 -0
- package/dist/es/component/nav-actions/index.mjs +14 -0
- package/dist/es/component/nav-actions/style.css +35 -0
- package/dist/es/component/player/index.css +296 -0
- package/dist/es/component/player/index.mjs +702 -0
- package/dist/es/component/player/playback-controls.mjs +4 -0
- package/dist/es/component/player/report-download.mjs +61 -0
- package/dist/es/component/player/scenes/StepScene.mjs +194 -0
- package/dist/es/component/player/scenes/derive-frame-state.mjs +229 -0
- package/dist/es/component/player/scenes/export-branded-video.mjs +360 -0
- package/dist/es/component/player/scenes/frame-calculator.mjs +149 -0
- package/dist/es/component/player/scenes/playback-frame.mjs +6 -0
- package/dist/es/component/player/scenes/playback-layout.mjs +12 -0
- package/dist/es/component/player/scenes/pointer-layout.mjs +36 -0
- package/dist/es/component/player/use-frame-player.mjs +87 -0
- package/dist/es/component/playground/index.css +930 -0
- package/dist/es/component/playground/playground-demo-ui-context.json +290 -0
- package/dist/es/component/playground-result/index.css +92 -0
- package/dist/es/component/playground-result/index.mjs +232 -0
- package/dist/es/component/prompt-input/index.css +832 -0
- package/dist/es/component/prompt-input/index.mjs +959 -0
- package/dist/es/component/screenshot-viewer/index.css +237 -0
- package/dist/es/component/screenshot-viewer/index.mjs +319 -0
- package/dist/es/component/service-mode-control/index.mjs +107 -0
- package/dist/es/component/shiny-text/index.css +107 -0
- package/dist/es/component/shiny-text/index.mjs +15 -0
- package/dist/es/component/universal-playground/empty-state.mjs +5 -0
- package/dist/es/component/universal-playground/index.css +619 -0
- package/dist/es/component/universal-playground/index.mjs +558 -0
- package/dist/es/component/universal-playground/providers/context-provider.mjs +90 -0
- package/dist/es/component/universal-playground/providers/indexeddb-storage-provider.mjs +280 -0
- package/dist/es/component/universal-playground/providers/storage-provider.mjs +279 -0
- package/dist/es/component/universal-playground/universal-playground-electron.mjs +668 -0
- package/dist/es/hooks/useMinimalTypeGate.mjs +47 -0
- package/dist/es/hooks/usePlaygroundExecution.mjs +435 -0
- package/dist/es/hooks/usePlaygroundState.mjs +278 -0
- package/dist/es/hooks/useSafeOverrideAIConfig.mjs +20 -0
- package/dist/es/hooks/useServerValid.mjs +55 -0
- package/dist/es/hooks/useTheme.mjs +25 -0
- package/dist/es/icons/action-chevron.mjs +61 -0
- package/dist/es/icons/avatar.mjs +70 -0
- package/dist/es/icons/close.mjs +61 -0
- package/dist/es/icons/global-perspective.mjs +58 -0
- package/dist/es/icons/history.mjs +72 -0
- package/dist/es/icons/magnifying-glass.mjs +81 -0
- package/dist/es/icons/player-setting.mjs +68 -0
- package/dist/es/icons/prompt-history.mjs +70 -0
- package/dist/es/icons/setting.mjs +62 -0
- package/dist/es/icons/show-marker.mjs +58 -0
- package/dist/es/index.mjs +26 -0
- package/dist/es/static/image/logo.png +0 -0
- package/dist/es/store/history.mjs +128 -0
- package/dist/es/store/store.mjs +277 -0
- package/dist/es/types.mjs +73 -0
- package/dist/es/utils/action-label.mjs +15 -0
- package/dist/es/utils/color.mjs +35 -0
- package/dist/es/utils/constants.mjs +99 -0
- package/dist/es/utils/device-capabilities.mjs +13 -0
- package/dist/es/utils/empty-state-scroll.mjs +8 -0
- package/dist/es/utils/highlight-element.mjs +62 -0
- package/dist/es/utils/index.mjs +13 -0
- package/dist/es/utils/playground-utils.mjs +43 -0
- package/dist/es/utils/progress-action-icon.mjs +30 -0
- package/dist/es/utils/prompt-input-utils.mjs +49 -0
- package/dist/es/utils/prompt-placeholder.mjs +19 -0
- package/dist/es/utils/replay-scripts.mjs +428 -0
- package/dist/lib/component/blackboard/highlights.js +84 -0
- package/dist/lib/component/blackboard/index.css +118 -0
- package/dist/lib/component/blackboard/index.js +169 -0
- package/dist/lib/component/config-selector/index.js +295 -0
- package/dist/lib/component/context-preview/index.js +82 -0
- package/dist/lib/component/env-config/index.js +271 -0
- package/dist/lib/component/env-config-reminder/index.css +30 -0
- package/dist/lib/component/env-config-reminder/index.js +61 -0
- package/dist/lib/component/form-field/index.js +204 -0
- package/dist/lib/component/history-selector/index.css +237 -0
- package/dist/lib/component/history-selector/index.js +243 -0
- package/dist/lib/component/index.js +58 -0
- package/dist/lib/component/logo/index.css +19 -0
- package/dist/lib/component/logo/index.js +67 -0
- package/dist/lib/component/logo/logo.js +24 -0
- package/dist/lib/component/misc/index.js +152 -0
- package/dist/lib/component/nav-actions/index.js +48 -0
- package/dist/lib/component/nav-actions/style.css +35 -0
- package/dist/lib/component/player/index.css +296 -0
- package/dist/lib/component/player/index.js +747 -0
- package/dist/lib/component/player/playback-controls.js +38 -0
- package/dist/lib/component/player/report-download.js +98 -0
- package/dist/lib/component/player/scenes/StepScene.js +228 -0
- package/dist/lib/component/player/scenes/derive-frame-state.js +266 -0
- package/dist/lib/component/player/scenes/export-branded-video.js +403 -0
- package/dist/lib/component/player/scenes/frame-calculator.js +186 -0
- package/dist/lib/component/player/scenes/playback-frame.js +40 -0
- package/dist/lib/component/player/scenes/playback-layout.js +46 -0
- package/dist/lib/component/player/scenes/pointer-layout.js +88 -0
- package/dist/lib/component/player/use-frame-player.js +121 -0
- package/dist/lib/component/playground/index.css +930 -0
- package/dist/lib/component/playground/playground-demo-ui-context.json +290 -0
- package/dist/lib/component/playground-result/index.css +92 -0
- package/dist/lib/component/playground-result/index.js +276 -0
- package/dist/lib/component/prompt-input/index.css +832 -0
- package/dist/lib/component/prompt-input/index.js +1005 -0
- package/dist/lib/component/screenshot-viewer/index.css +237 -0
- package/dist/lib/component/screenshot-viewer/index.js +353 -0
- package/dist/lib/component/service-mode-control/index.js +141 -0
- package/dist/lib/component/shiny-text/index.css +107 -0
- package/dist/lib/component/shiny-text/index.js +49 -0
- package/dist/lib/component/universal-playground/empty-state.js +39 -0
- package/dist/lib/component/universal-playground/index.css +619 -0
- package/dist/lib/component/universal-playground/index.js +607 -0
- package/dist/lib/component/universal-playground/providers/context-provider.js +133 -0
- package/dist/lib/component/universal-playground/providers/indexeddb-storage-provider.js +320 -0
- package/dist/lib/component/universal-playground/providers/storage-provider.js +337 -0
- package/dist/lib/component/universal-playground/universal-playground-electron.js +717 -0
- package/dist/lib/hooks/useMinimalTypeGate.js +81 -0
- package/dist/lib/hooks/usePlaygroundExecution.js +478 -0
- package/dist/lib/hooks/usePlaygroundState.js +312 -0
- package/dist/lib/hooks/useSafeOverrideAIConfig.js +57 -0
- package/dist/lib/hooks/useServerValid.js +89 -0
- package/dist/lib/hooks/useTheme.js +59 -0
- package/dist/lib/icons/action-chevron.js +95 -0
- package/dist/lib/icons/avatar.js +104 -0
- package/dist/lib/icons/close.js +95 -0
- package/dist/lib/icons/global-perspective.js +92 -0
- package/dist/lib/icons/history.js +106 -0
- package/dist/lib/icons/magnifying-glass.js +115 -0
- package/dist/lib/icons/player-setting.js +102 -0
- package/dist/lib/icons/prompt-history.js +104 -0
- package/dist/lib/icons/setting.js +96 -0
- package/dist/lib/icons/show-marker.js +92 -0
- package/dist/lib/index.js +204 -0
- package/dist/lib/static/image/logo.png +0 -0
- package/dist/lib/store/history.js +135 -0
- package/dist/lib/store/store.js +287 -0
- package/dist/lib/types.js +119 -0
- package/dist/lib/utils/action-label.js +52 -0
- package/dist/lib/utils/color.js +75 -0
- package/dist/lib/utils/constants.js +172 -0
- package/dist/lib/utils/device-capabilities.js +50 -0
- package/dist/lib/utils/empty-state-scroll.js +42 -0
- package/dist/lib/utils/highlight-element.js +99 -0
- package/dist/lib/utils/index.js +69 -0
- package/dist/lib/utils/playground-utils.js +86 -0
- package/dist/lib/utils/progress-action-icon.js +67 -0
- package/dist/lib/utils/prompt-input-utils.js +89 -0
- package/dist/lib/utils/prompt-placeholder.js +53 -0
- package/dist/lib/utils/replay-scripts.js +474 -0
- package/dist/types/component/blackboard/highlights.d.ts +11 -0
- package/dist/types/component/blackboard/index.d.ts +10 -0
- package/dist/types/component/config-selector/index.d.ts +15 -0
- package/dist/types/component/context-preview/index.d.ts +9 -0
- package/dist/types/component/env-config/index.d.ts +8 -0
- package/dist/types/component/env-config-reminder/index.d.ts +6 -0
- package/dist/types/component/form-field/index.d.ts +17 -0
- package/dist/types/component/history-selector/index.d.ts +13 -0
- package/dist/types/component/index.d.ts +1 -0
- package/dist/types/component/logo/index.d.ts +5 -0
- package/dist/types/component/misc/index.d.ts +6 -0
- package/dist/types/component/nav-actions/index.d.ts +12 -0
- package/dist/types/component/player/index.d.ts +15 -0
- package/dist/types/component/player/playback-controls.d.ts +1 -0
- package/dist/types/component/player/report-download.d.ts +32 -0
- package/dist/types/component/player/scenes/StepScene.d.ts +9 -0
- package/dist/types/component/player/scenes/derive-frame-state.d.ts +40 -0
- package/dist/types/component/player/scenes/export-branded-video.d.ts +33 -0
- package/dist/types/component/player/scenes/frame-calculator.d.ts +40 -0
- package/dist/types/component/player/scenes/playback-frame.d.ts +3 -0
- package/dist/types/component/player/scenes/playback-layout.d.ts +7 -0
- package/dist/types/component/player/scenes/pointer-layout.d.ts +20 -0
- package/dist/types/component/player/use-frame-player.d.ts +17 -0
- package/dist/types/component/playground-result/index.d.ts +22 -0
- package/dist/types/component/prompt-input/index.d.ts +23 -0
- package/dist/types/component/screenshot-viewer/index.d.ts +23 -0
- package/dist/types/component/service-mode-control/index.d.ts +6 -0
- package/dist/types/component/shiny-text/index.d.ts +12 -0
- package/dist/types/component/universal-playground/empty-state.d.ts +3 -0
- package/dist/types/component/universal-playground/index.d.ts +4 -0
- package/dist/types/component/universal-playground/providers/context-provider.d.ts +37 -0
- package/dist/types/component/universal-playground/providers/indexeddb-storage-provider.d.ts +71 -0
- package/dist/types/component/universal-playground/providers/storage-provider.d.ts +58 -0
- package/dist/types/component/universal-playground/universal-playground-electron.d.ts +4 -0
- package/dist/types/hooks/useMinimalTypeGate.d.ts +72 -0
- package/dist/types/hooks/usePlaygroundExecution.d.ts +40 -0
- package/dist/types/hooks/usePlaygroundState.d.ts +26 -0
- package/dist/types/hooks/useSafeOverrideAIConfig.d.ts +16 -0
- package/dist/types/hooks/useServerValid.d.ts +1 -0
- package/dist/types/hooks/useTheme.d.ts +7 -0
- package/dist/types/index.d.ts +29 -0
- package/dist/types/store/history.d.ts +16 -0
- package/dist/types/store/store.d.ts +57 -0
- package/dist/types/types.d.ts +278 -0
- package/dist/types/utils/action-label.d.ts +11 -0
- package/dist/types/utils/color.d.ts +4 -0
- package/dist/types/utils/constants.d.ts +80 -0
- package/dist/types/utils/device-capabilities.d.ts +9 -0
- package/dist/types/utils/empty-state-scroll.d.ts +11 -0
- package/dist/types/utils/highlight-element.d.ts +3 -0
- package/dist/types/utils/index.d.ts +5 -0
- package/dist/types/utils/playground-utils.d.ts +11 -0
- package/dist/types/utils/progress-action-icon.d.ts +12 -0
- package/dist/types/utils/prompt-input-utils.d.ts +24 -0
- package/dist/types/utils/prompt-placeholder.d.ts +1 -0
- package/dist/types/utils/replay-scripts.d.ts +50 -0
- package/package.json +82 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { z } from '@godscene/core';
|
|
2
|
+
import type React from 'react';
|
|
3
|
+
interface FormFieldProps {
|
|
4
|
+
name: string;
|
|
5
|
+
label: string;
|
|
6
|
+
fieldSchema: z.ZodTypeAny;
|
|
7
|
+
isRequired: boolean;
|
|
8
|
+
isLocateField: boolean;
|
|
9
|
+
marginBottom: number;
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const TextField: React.FC<Omit<FormFieldProps, 'isLocateField'>>;
|
|
13
|
+
export declare const LocateField: React.FC<Omit<FormFieldProps, 'isLocateField'>>;
|
|
14
|
+
export declare const EnumField: React.FC<Omit<FormFieldProps, 'isLocateField'>>;
|
|
15
|
+
export declare const NumberField: React.FC<Omit<FormFieldProps, 'isLocateField'>>;
|
|
16
|
+
export declare const BooleanField: React.FC<Omit<FormFieldProps, 'isLocateField'>>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { ReactNode } from 'react';
|
|
3
|
+
import type { HistoryItem } from '../../store/history';
|
|
4
|
+
import './index.less';
|
|
5
|
+
interface HistorySelectorProps {
|
|
6
|
+
onSelect: (history: HistoryItem) => void;
|
|
7
|
+
history: HistoryItem[];
|
|
8
|
+
currentType: string;
|
|
9
|
+
trigger?: ReactNode;
|
|
10
|
+
popupPlacement?: 'top' | 'bottom';
|
|
11
|
+
}
|
|
12
|
+
export declare const HistorySelector: React.FC<HistorySelectorProps>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../types';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
export declare function timeCostStrElement(timeCost?: number): React.JSX.Element;
|
|
3
|
+
export declare const iconForStatus: (status: string) => React.JSX.Element;
|
|
4
|
+
export declare const errorMessageServerNotReady: React.JSX.Element;
|
|
5
|
+
export declare const serverLaunchTip: (notReadyMessage?: React.ReactNode | string) => React.JSX.Element;
|
|
6
|
+
export declare const emptyResultTip: React.JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PlaygroundSDKLike } from '../../types';
|
|
2
|
+
import './style.less';
|
|
3
|
+
export interface NavActionsProps {
|
|
4
|
+
showEnvConfig?: boolean;
|
|
5
|
+
showTooltipWhenEmpty?: boolean;
|
|
6
|
+
showModelName?: boolean;
|
|
7
|
+
githubUrl?: string;
|
|
8
|
+
helpUrl?: string;
|
|
9
|
+
className?: string;
|
|
10
|
+
playgroundSDK?: PlaygroundSDKLike | null;
|
|
11
|
+
}
|
|
12
|
+
export declare function NavActions({ showEnvConfig, showTooltipWhenEmpty, showModelName, githubUrl, helpUrl, className, playgroundSDK, }: NavActionsProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import './index.less';
|
|
2
|
+
import type { ReportDownloadHandler } from '../../types';
|
|
3
|
+
import type { AnimationScript } from '../../utils/replay-scripts';
|
|
4
|
+
export declare function Player(props?: {
|
|
5
|
+
replayScripts?: AnimationScript[];
|
|
6
|
+
imageWidth?: number;
|
|
7
|
+
imageHeight?: number;
|
|
8
|
+
reportFileContent?: string | null;
|
|
9
|
+
key?: string | number;
|
|
10
|
+
fitMode?: 'width' | 'height';
|
|
11
|
+
autoZoom?: boolean;
|
|
12
|
+
canDownloadReport?: boolean;
|
|
13
|
+
onDownloadReport?: ReportDownloadHandler;
|
|
14
|
+
onTaskChange?: (taskId: string | null) => void;
|
|
15
|
+
}): import("react").JSX.Element | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function shouldRestartPlaybackFromBeginning(currentFrame: number, effectiveEndFrame: number): boolean;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ReportDownloadHandler } from '../../types';
|
|
2
|
+
export declare const DEFAULT_REPORT_FILE_NAME = "midscene_report.html";
|
|
3
|
+
interface AnchorLike {
|
|
4
|
+
href: string;
|
|
5
|
+
download: string;
|
|
6
|
+
style: {
|
|
7
|
+
display: string;
|
|
8
|
+
};
|
|
9
|
+
click: () => void;
|
|
10
|
+
}
|
|
11
|
+
interface DocumentLike {
|
|
12
|
+
body: {
|
|
13
|
+
appendChild: (node: AnchorLike) => void;
|
|
14
|
+
removeChild: (node: AnchorLike) => void;
|
|
15
|
+
};
|
|
16
|
+
createElement: (tagName: string) => AnchorLike;
|
|
17
|
+
}
|
|
18
|
+
interface UrlLike {
|
|
19
|
+
createObjectURL: (blob: Blob) => string;
|
|
20
|
+
revokeObjectURL: (url: string) => void;
|
|
21
|
+
}
|
|
22
|
+
interface TriggerReportDownloadOptions {
|
|
23
|
+
content: string;
|
|
24
|
+
defaultFileName?: string;
|
|
25
|
+
onDownloadReport?: ReportDownloadHandler;
|
|
26
|
+
documentRef?: DocumentLike;
|
|
27
|
+
urlRef?: UrlLike;
|
|
28
|
+
blobFactory?: (parts: BlobPart[], options: BlobPropertyBag) => Blob;
|
|
29
|
+
scheduleRevoke?: (callback: () => void) => void;
|
|
30
|
+
}
|
|
31
|
+
export declare function triggerReportDownload(options: TriggerReportDownloadOptions): Promise<void>;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared frame state derivation from ScriptFrame timeline.
|
|
3
|
+
* Used by both Remotion preview (StepScene.tsx) and Canvas export (export-branded-video.ts).
|
|
4
|
+
*/
|
|
5
|
+
import type { ScriptFrame } from './frame-calculator';
|
|
6
|
+
export interface CameraState {
|
|
7
|
+
left: number;
|
|
8
|
+
top: number;
|
|
9
|
+
width: number;
|
|
10
|
+
pointerLeft: number;
|
|
11
|
+
pointerTop: number;
|
|
12
|
+
}
|
|
13
|
+
export interface InsightOverlay {
|
|
14
|
+
highlightElement?: ScriptFrame['highlightElement'];
|
|
15
|
+
searchArea?: ScriptFrame['searchArea'];
|
|
16
|
+
alpha: number;
|
|
17
|
+
}
|
|
18
|
+
export interface FrameState {
|
|
19
|
+
img: string;
|
|
20
|
+
imageWidth: number;
|
|
21
|
+
imageHeight: number;
|
|
22
|
+
prevImg: string | null;
|
|
23
|
+
camera: CameraState;
|
|
24
|
+
prevCamera: CameraState;
|
|
25
|
+
insights: InsightOverlay[];
|
|
26
|
+
spinning: boolean;
|
|
27
|
+
spinningElapsedMs: number;
|
|
28
|
+
currentPointerImg: string;
|
|
29
|
+
pointerVisible: boolean;
|
|
30
|
+
title: string;
|
|
31
|
+
subTitle: string;
|
|
32
|
+
taskId: string | undefined;
|
|
33
|
+
frameInScript: number;
|
|
34
|
+
scriptIndex: number;
|
|
35
|
+
imageChanged: boolean;
|
|
36
|
+
pointerMoved: boolean;
|
|
37
|
+
rawProgress: number;
|
|
38
|
+
}
|
|
39
|
+
export declare function shouldRenderCursor(pointerVisible: boolean, camera: CameraState, prevCamera: CameraState, imageWidth: number, imageHeight: number): boolean;
|
|
40
|
+
export declare function deriveFrameState(scriptFrames: ScriptFrame[], frame: number, baseW: number, baseH: number, fps: number): FrameState;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Rect } from '@godscene/core';
|
|
2
|
+
import type { FrameMap } from './frame-calculator';
|
|
3
|
+
interface ExportOverlayViewport {
|
|
4
|
+
offsetX: number;
|
|
5
|
+
offsetY: number;
|
|
6
|
+
contentWidth: number;
|
|
7
|
+
contentHeight: number;
|
|
8
|
+
imageWidth: number;
|
|
9
|
+
imageHeight: number;
|
|
10
|
+
}
|
|
11
|
+
export declare function isExportRenderStalled(elapsedSinceLastFrameMs: number, frameDurationMs: number): boolean;
|
|
12
|
+
export declare function resolveExportCamera(prevCamera: {
|
|
13
|
+
left: number;
|
|
14
|
+
top: number;
|
|
15
|
+
width: number;
|
|
16
|
+
}, camera: {
|
|
17
|
+
left: number;
|
|
18
|
+
top: number;
|
|
19
|
+
width: number;
|
|
20
|
+
}, imageWidth: number, progress: number, autoZoom: boolean): {
|
|
21
|
+
camLeft: number;
|
|
22
|
+
camTop: number;
|
|
23
|
+
camWidth: number;
|
|
24
|
+
};
|
|
25
|
+
export declare function projectNativeRectToExportViewport(rect: Rect, cameraTransform: {
|
|
26
|
+
zoom: number;
|
|
27
|
+
tx: number;
|
|
28
|
+
ty: number;
|
|
29
|
+
}, viewport: ExportOverlayViewport): Rect;
|
|
30
|
+
export declare function exportBrandedVideo(frameMap: FrameMap, options?: {
|
|
31
|
+
autoZoom?: boolean;
|
|
32
|
+
}, onProgress?: (pct: number) => void): Promise<void>;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { LocateResultElement, Rect } from '@godscene/core';
|
|
2
|
+
import type { AnimationScript } from '../../../utils/replay-scripts';
|
|
3
|
+
export declare const FPS = 30;
|
|
4
|
+
export interface ScriptFrame {
|
|
5
|
+
type: 'img' | 'insight' | 'clear-insight' | 'pointer' | 'spinning-pointer' | 'sleep';
|
|
6
|
+
startFrame: number;
|
|
7
|
+
durationInFrames: number;
|
|
8
|
+
img?: string;
|
|
9
|
+
imageWidth?: number;
|
|
10
|
+
imageHeight?: number;
|
|
11
|
+
cameraTarget?: {
|
|
12
|
+
left: number;
|
|
13
|
+
top: number;
|
|
14
|
+
width: number;
|
|
15
|
+
pointerLeft: number;
|
|
16
|
+
pointerTop: number;
|
|
17
|
+
};
|
|
18
|
+
insightPhaseFrames?: number;
|
|
19
|
+
cameraPhaseFrames?: number;
|
|
20
|
+
highlightElement?: LocateResultElement;
|
|
21
|
+
searchArea?: Rect;
|
|
22
|
+
pointerImg?: string;
|
|
23
|
+
title?: string;
|
|
24
|
+
subTitle?: string;
|
|
25
|
+
taskId?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface FrameMap {
|
|
28
|
+
scriptFrames: ScriptFrame[];
|
|
29
|
+
totalDurationInFrames: number;
|
|
30
|
+
fps: number;
|
|
31
|
+
stepsDurationInFrames: number;
|
|
32
|
+
imageWidth: number;
|
|
33
|
+
imageHeight: number;
|
|
34
|
+
}
|
|
35
|
+
interface CalculateFrameMapOptions {
|
|
36
|
+
imageWidth?: number;
|
|
37
|
+
imageHeight?: number;
|
|
38
|
+
}
|
|
39
|
+
export declare function calculateFrameMap(scripts: AnimationScript[], options?: CalculateFrameMapOptions): FrameMap;
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface PlaybackViewport {
|
|
2
|
+
offsetX: number;
|
|
3
|
+
offsetY: number;
|
|
4
|
+
contentWidth: number;
|
|
5
|
+
contentHeight: number;
|
|
6
|
+
}
|
|
7
|
+
export declare function getPlaybackViewport(containerWidth: number, containerHeight: number, imageWidth: number, imageHeight: number): PlaybackViewport;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare const POINTER_WIDTH = 44;
|
|
2
|
+
export declare const POINTER_HEIGHT = 56;
|
|
3
|
+
export declare const POINTER_HOTSPOT_X = 6;
|
|
4
|
+
export declare const POINTER_HOTSPOT_Y = 4;
|
|
5
|
+
export interface PointerLayout {
|
|
6
|
+
scale: number;
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
hotspotX: number;
|
|
10
|
+
hotspotY: number;
|
|
11
|
+
centerOffsetX: number;
|
|
12
|
+
centerOffsetY: number;
|
|
13
|
+
}
|
|
14
|
+
export interface SpinnerLayout {
|
|
15
|
+
size: number;
|
|
16
|
+
centerOffset: number;
|
|
17
|
+
}
|
|
18
|
+
export declare function resolvePointerLayout(imageWidth: number): PointerLayout;
|
|
19
|
+
export declare function resolveExportPointerLayout(imageWidth: number, contentWidth: number): PointerLayout;
|
|
20
|
+
export declare function resolveSpinnerLayout(pointerLayout: PointerLayout): SpinnerLayout;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
interface UseFramePlayerOptions {
|
|
2
|
+
durationInFrames: number;
|
|
3
|
+
fps: number;
|
|
4
|
+
autoPlay?: boolean;
|
|
5
|
+
loop?: boolean;
|
|
6
|
+
playbackRate?: number;
|
|
7
|
+
}
|
|
8
|
+
interface FramePlayer {
|
|
9
|
+
currentFrame: number;
|
|
10
|
+
playing: boolean;
|
|
11
|
+
play: () => void;
|
|
12
|
+
pause: () => void;
|
|
13
|
+
toggle: () => void;
|
|
14
|
+
seekTo: (frame: number) => void;
|
|
15
|
+
}
|
|
16
|
+
export declare function useFramePlayer(options: UseFramePlayerOptions): FramePlayer;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { PlaygroundResult as PlaygroundResultType, ReportDownloadHandler, ServiceModeType } from '../../types';
|
|
3
|
+
import type { ReplayScriptsInfo } from '../../utils/replay-scripts';
|
|
4
|
+
import './index.less';
|
|
5
|
+
interface PlaygroundResultProps {
|
|
6
|
+
result: PlaygroundResultType | null;
|
|
7
|
+
loading: boolean;
|
|
8
|
+
serverValid?: boolean;
|
|
9
|
+
serviceMode: ServiceModeType;
|
|
10
|
+
replayScriptsInfo: ReplayScriptsInfo | null;
|
|
11
|
+
replayCounter: number;
|
|
12
|
+
loadingProgressText: string;
|
|
13
|
+
verticalMode?: boolean;
|
|
14
|
+
notReadyMessage?: React.ReactNode | string;
|
|
15
|
+
fitMode?: 'width' | 'height';
|
|
16
|
+
autoZoom?: boolean;
|
|
17
|
+
actionType?: string;
|
|
18
|
+
canDownloadReport?: boolean;
|
|
19
|
+
onDownloadReport?: ReportDownloadHandler;
|
|
20
|
+
}
|
|
21
|
+
export declare const PlaygroundResultView: React.FC<PlaygroundResultProps>;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { DeviceAction } from '@godscene/core';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import type { DeviceType, RunType } from '../../types';
|
|
4
|
+
import type { PromptInputChromeConfig, ServiceModeType } from '../../types';
|
|
5
|
+
import './index.less';
|
|
6
|
+
interface PromptInputProps {
|
|
7
|
+
runButtonEnabled: boolean;
|
|
8
|
+
form: any;
|
|
9
|
+
serviceMode: ServiceModeType;
|
|
10
|
+
selectedType: RunType;
|
|
11
|
+
dryMode: boolean;
|
|
12
|
+
stoppable: boolean;
|
|
13
|
+
loading: boolean;
|
|
14
|
+
onRun: () => void;
|
|
15
|
+
onStop: () => void;
|
|
16
|
+
clearPromptAfterRun?: boolean;
|
|
17
|
+
hideDomAndScreenshotOptions?: boolean;
|
|
18
|
+
actionSpace: DeviceAction<any>[];
|
|
19
|
+
deviceType?: DeviceType;
|
|
20
|
+
chrome?: PromptInputChromeConfig;
|
|
21
|
+
}
|
|
22
|
+
export declare const PromptInput: React.FC<PromptInputProps>;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './index.less';
|
|
3
|
+
export type ScreenshotViewerMode = 'default' | 'screen-only';
|
|
4
|
+
interface ScreenshotViewerProps {
|
|
5
|
+
getScreenshot: () => Promise<{
|
|
6
|
+
screenshot: string;
|
|
7
|
+
timestamp: number;
|
|
8
|
+
} | null>;
|
|
9
|
+
getInterfaceInfo?: () => Promise<{
|
|
10
|
+
type: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
size?: {
|
|
13
|
+
width: number;
|
|
14
|
+
height: number;
|
|
15
|
+
};
|
|
16
|
+
} | null>;
|
|
17
|
+
serverOnline: boolean;
|
|
18
|
+
isUserOperating?: boolean;
|
|
19
|
+
mjpegUrl?: string;
|
|
20
|
+
mode?: ScreenshotViewerMode;
|
|
21
|
+
}
|
|
22
|
+
export default function ScreenshotViewer({ getScreenshot, getInterfaceInfo, serverOnline, isUserOperating, mjpegUrl, mode, }: ScreenshotViewerProps): React.JSX.Element;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import './index.less';
|
|
3
|
+
type ColorTheme = 'blue' | 'purple' | 'green' | 'rainbow';
|
|
4
|
+
interface ShinyTextProps {
|
|
5
|
+
text: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
speed?: number;
|
|
8
|
+
className?: string;
|
|
9
|
+
colorTheme?: ColorTheme;
|
|
10
|
+
}
|
|
11
|
+
declare const ShinyText: React.FC<ShinyTextProps>;
|
|
12
|
+
export default ShinyText;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { UniversalPlaygroundProps } from '../../types';
|
|
2
|
+
import './index.less';
|
|
3
|
+
export declare function UniversalPlayground({ playgroundSDK, storage, contextProvider, config: componentConfig, branding, className, dryMode, showContextPreview, showPromptInput, onHumanUse, showHumanUse, defaultSelectedType, }: UniversalPlaygroundProps): import("react").JSX.Element;
|
|
4
|
+
export default UniversalPlayground;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { UIContext } from '@godscene/core';
|
|
2
|
+
import type { ContextProvider } from '../../../types';
|
|
3
|
+
/**
|
|
4
|
+
* Base context provider implementation
|
|
5
|
+
*/
|
|
6
|
+
export declare abstract class BaseContextProvider implements ContextProvider {
|
|
7
|
+
protected cachedContext?: UIContext;
|
|
8
|
+
abstract getUIContext(): Promise<UIContext>;
|
|
9
|
+
refreshContext(): Promise<UIContext>;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Agent-based context provider for local execution modes
|
|
13
|
+
*/
|
|
14
|
+
export declare class AgentContextProvider extends BaseContextProvider {
|
|
15
|
+
private getAgent;
|
|
16
|
+
private options?;
|
|
17
|
+
constructor(getAgent: () => any, options?: {
|
|
18
|
+
forceSameTabNavigation?: boolean;
|
|
19
|
+
} | undefined);
|
|
20
|
+
getUIContext(): Promise<UIContext>;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Static context provider for pre-determined UI contexts
|
|
24
|
+
*/
|
|
25
|
+
export declare class StaticContextProvider extends BaseContextProvider {
|
|
26
|
+
private context;
|
|
27
|
+
constructor(context: UIContext);
|
|
28
|
+
getUIContext(): Promise<UIContext>;
|
|
29
|
+
refreshContext(): Promise<UIContext>;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* No-op context provider for cases where context preview is disabled
|
|
33
|
+
*/
|
|
34
|
+
export declare class NoOpContextProvider implements ContextProvider {
|
|
35
|
+
getUIContext(): Promise<UIContext>;
|
|
36
|
+
refreshContext(): Promise<UIContext>;
|
|
37
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { InfoListItem, StorageProvider } from '../../../types';
|
|
2
|
+
/**
|
|
3
|
+
* IndexedDB Storage implementation for playground message persistence
|
|
4
|
+
* Provides much larger storage capacity compared to localStorage
|
|
5
|
+
*/
|
|
6
|
+
export declare class IndexedDBStorageProvider implements StorageProvider {
|
|
7
|
+
private dbManager;
|
|
8
|
+
private namespace;
|
|
9
|
+
private messagesCleanup;
|
|
10
|
+
private resultsCleanup;
|
|
11
|
+
constructor(namespace?: string);
|
|
12
|
+
/**
|
|
13
|
+
* Save messages to IndexedDB
|
|
14
|
+
*/
|
|
15
|
+
saveMessages(messages: InfoListItem[]): Promise<void>;
|
|
16
|
+
/**
|
|
17
|
+
* Load messages from IndexedDB
|
|
18
|
+
*/
|
|
19
|
+
loadMessages(): Promise<InfoListItem[]>;
|
|
20
|
+
/**
|
|
21
|
+
* Clear all messages from IndexedDB
|
|
22
|
+
*/
|
|
23
|
+
clearMessages(): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* Save a single result to IndexedDB with compression
|
|
26
|
+
*/
|
|
27
|
+
saveResult(id: string, result: InfoListItem): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Load a single result from IndexedDB
|
|
30
|
+
*/
|
|
31
|
+
loadResult(id: string): Promise<InfoListItem | null>;
|
|
32
|
+
/**
|
|
33
|
+
* Compress result data for storage while preserving playback functionality
|
|
34
|
+
*/
|
|
35
|
+
private compressResultForStorage;
|
|
36
|
+
/**
|
|
37
|
+
* Compress screenshot if it exceeds size threshold
|
|
38
|
+
*/
|
|
39
|
+
private compressScreenshotIfNeeded;
|
|
40
|
+
/**
|
|
41
|
+
* Get storage statistics
|
|
42
|
+
*/
|
|
43
|
+
getStorageStats(): Promise<{
|
|
44
|
+
messageCount: number;
|
|
45
|
+
resultCount: number;
|
|
46
|
+
}>;
|
|
47
|
+
/**
|
|
48
|
+
* Manually trigger cleanup
|
|
49
|
+
*/
|
|
50
|
+
cleanup(): Promise<void>;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Memory-based storage provider for IndexedDB fallback
|
|
54
|
+
*/
|
|
55
|
+
export declare class MemoryStorageProvider implements StorageProvider {
|
|
56
|
+
private messages;
|
|
57
|
+
private results;
|
|
58
|
+
saveMessages(messages: InfoListItem[]): Promise<void>;
|
|
59
|
+
loadMessages(): Promise<InfoListItem[]>;
|
|
60
|
+
clearMessages(): Promise<void>;
|
|
61
|
+
saveResult(id: string, result: InfoListItem): Promise<void>;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* No-op storage provider for disabled storage
|
|
65
|
+
*/
|
|
66
|
+
export declare class NoOpStorageProvider implements StorageProvider {
|
|
67
|
+
saveMessages(_messages: InfoListItem[]): Promise<void>;
|
|
68
|
+
loadMessages(): Promise<InfoListItem[]>;
|
|
69
|
+
clearMessages(): Promise<void>;
|
|
70
|
+
saveResult(_id: string, _result: InfoListItem): Promise<void>;
|
|
71
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { InfoListItem, StorageProvider } from '../../../types';
|
|
2
|
+
import { MemoryStorageProvider as IndexedDBMemoryStorageProvider, NoOpStorageProvider as IndexedDBNoOpStorageProvider, IndexedDBStorageProvider } from './indexeddb-storage-provider';
|
|
3
|
+
/**
|
|
4
|
+
* Local Storage implementation for playground message persistence
|
|
5
|
+
*/
|
|
6
|
+
export declare class LocalStorageProvider implements StorageProvider {
|
|
7
|
+
private readonly messagesKey;
|
|
8
|
+
private readonly resultsKey;
|
|
9
|
+
private readonly maxStorageItems;
|
|
10
|
+
constructor(namespace?: string);
|
|
11
|
+
/**
|
|
12
|
+
* Check available storage space
|
|
13
|
+
*/
|
|
14
|
+
private checkStorageSpace;
|
|
15
|
+
saveMessages(messages: InfoListItem[]): Promise<void>;
|
|
16
|
+
loadMessages(): Promise<InfoListItem[]>;
|
|
17
|
+
clearMessages(): Promise<void>;
|
|
18
|
+
saveResult(id: string, result: InfoListItem): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Handle quota exceeded by clearing old data
|
|
21
|
+
*/
|
|
22
|
+
private handleQuotaExceeded;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Memory-only storage implementation for non-persistent scenarios
|
|
26
|
+
*/
|
|
27
|
+
export declare class MemoryStorageProvider implements StorageProvider {
|
|
28
|
+
private messages;
|
|
29
|
+
private results;
|
|
30
|
+
saveMessages(messages: InfoListItem[]): Promise<void>;
|
|
31
|
+
loadMessages(): Promise<InfoListItem[]>;
|
|
32
|
+
clearMessages(): Promise<void>;
|
|
33
|
+
saveResult(id: string, result: InfoListItem): Promise<void>;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* No-op storage implementation for cases where persistence is disabled
|
|
37
|
+
*/
|
|
38
|
+
export declare class NoOpStorageProvider implements StorageProvider {
|
|
39
|
+
saveMessages(_messages: InfoListItem[]): Promise<void>;
|
|
40
|
+
loadMessages(): Promise<InfoListItem[]>;
|
|
41
|
+
clearMessages(): Promise<void>;
|
|
42
|
+
saveResult(_id: string, _result: InfoListItem): Promise<void>;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Storage type enumeration
|
|
46
|
+
*/
|
|
47
|
+
export declare enum StorageType {
|
|
48
|
+
INDEXEDDB = "indexeddb",
|
|
49
|
+
LOCALSTORAGE = "localStorage",
|
|
50
|
+
MEMORY = "memory",
|
|
51
|
+
NONE = "none"
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Factory function to create the appropriate storage provider
|
|
55
|
+
*/
|
|
56
|
+
export declare function createStorageProvider(type?: StorageType, namespace?: string): StorageProvider;
|
|
57
|
+
export declare function detectBestStorageType(): StorageType;
|
|
58
|
+
export { IndexedDBStorageProvider, IndexedDBMemoryStorageProvider, IndexedDBNoOpStorageProvider, };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { UniversalPlaygroundProps } from '../../types';
|
|
2
|
+
import './index.less';
|
|
3
|
+
export declare function UniversalPlaygroundElectron({ storage, contextProvider, config: componentConfig, branding, className, dryMode, showContextPreview, showPromptInput, onHumanUse, showHumanUse, defaultSelectedType, }: UniversalPlaygroundProps): import("react").JSX.Element;
|
|
4
|
+
export default UniversalPlaygroundElectron;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { FormInstance } from 'antd';
|
|
2
|
+
/**
|
|
3
|
+
* Options for {@link useMinimalTypeGate}.
|
|
4
|
+
*/
|
|
5
|
+
export interface UseMinimalTypeGateOptions {
|
|
6
|
+
/**
|
|
7
|
+
* Whether the gate is active. When `false`, the hook is a no-op and all
|
|
8
|
+
* returned callbacks become stable identity-only functions. Typically
|
|
9
|
+
* wired to `chrome?.variant === 'minimal'`.
|
|
10
|
+
*/
|
|
11
|
+
enabled: boolean;
|
|
12
|
+
/** The antd form that owns `type` / `prompt` / `params` fields. */
|
|
13
|
+
form: FormInstance;
|
|
14
|
+
/** Currently selected action type (usually read via `Form.useWatch`). */
|
|
15
|
+
selectedType: string | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Called when the gate snaps `form.type` back to its default. Hosts use
|
|
18
|
+
* this hook to clear any sibling state (local `promptValue`, custom
|
|
19
|
+
* history refs, etc.) alongside the form reset.
|
|
20
|
+
*/
|
|
21
|
+
onAfterReset?: () => void;
|
|
22
|
+
/**
|
|
23
|
+
* The default type to snap back to when the user has not made an
|
|
24
|
+
* explicit selection. Defaults to `'aiAct'`, matching the natural
|
|
25
|
+
* language action.
|
|
26
|
+
*/
|
|
27
|
+
defaultType?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface MinimalTypeGate {
|
|
30
|
+
/**
|
|
31
|
+
* Record that the user has explicitly chosen an action — disables the
|
|
32
|
+
* snap-back effect for the remainder of the component's lifecycle.
|
|
33
|
+
* Call this from every user-initiated selection path: action dropdown
|
|
34
|
+
* click, history replay, etc.
|
|
35
|
+
*/
|
|
36
|
+
markExplicitSelection: () => void;
|
|
37
|
+
/**
|
|
38
|
+
* One-shot flag: request that the NEXT run of the caller's
|
|
39
|
+
* history-restore effect be skipped entirely. Used when a history
|
|
40
|
+
* replay is about to change `selectedType` and we don't want the
|
|
41
|
+
* effect to overwrite the fresh form values. The flag auto-clears
|
|
42
|
+
* after being read via {@link shouldSkipRestoreOnce}.
|
|
43
|
+
*/
|
|
44
|
+
skipNextRestore: () => void;
|
|
45
|
+
/**
|
|
46
|
+
* Read-and-clear accessor for the one-shot flag set by
|
|
47
|
+
* {@link skipNextRestore}.
|
|
48
|
+
*/
|
|
49
|
+
shouldSkipRestoreOnce: () => boolean;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Keeps a minimal-chrome prompt input pinned to its default type until
|
|
53
|
+
* the user makes an explicit selection. The minimal chrome hides the
|
|
54
|
+
* type radio row, so any background pathway that lands a non-default
|
|
55
|
+
* type in the form (e.g. `lastSelectedType` restored from local
|
|
56
|
+
* storage) would otherwise surface a type the user never asked for.
|
|
57
|
+
*
|
|
58
|
+
* Behaviour:
|
|
59
|
+
* 1. While `enabled` and the user has not called `markExplicitSelection`,
|
|
60
|
+
* any `selectedType !== defaultType` triggers a form reset back to
|
|
61
|
+
* the default, clearing `prompt` and `params` along with it.
|
|
62
|
+
* 2. Once the user explicitly picks something, the gate unlocks and
|
|
63
|
+
* stays unlocked for the rest of the component's life.
|
|
64
|
+
* 3. `skipNextRestore` plus `shouldSkipRestoreOnce` give the caller a
|
|
65
|
+
* one-tick bypass so its own history-restore effect can skip the
|
|
66
|
+
* iteration where the type just changed due to a history replay.
|
|
67
|
+
*
|
|
68
|
+
* This replaces the previously inline `minimalHasExplicitTypeSelection`
|
|
69
|
+
* state + `skipMinimalSyncRef` + reset effect that lived inside
|
|
70
|
+
* `PromptInput`.
|
|
71
|
+
*/
|
|
72
|
+
export declare function useMinimalTypeGate(options: UseMinimalTypeGateOptions): MinimalTypeGate;
|