@solazah/solazah-runtime 0.1.126 → 0.1.134

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solazah/solazah-runtime",
3
- "version": "0.1.126",
3
+ "version": "0.1.134",
4
4
  "main": "index.cjs",
5
5
  "module": "index.js",
6
6
  "types": "types/index.d.ts",
@@ -0,0 +1,60 @@
1
+ import { default as IpcRenderer } from './IpcRenderer';
2
+ export interface RecorderStartOptions {
3
+ /** 帧率,缺省 4 */
4
+ fps?: number;
5
+ /** 结束录制的键(虚拟键码),缺省 F12;这一下本身不进轨迹 */
6
+ stopKey?: number;
7
+ /** 时长上限,缺省 10 分钟 */
8
+ maxMs?: number;
9
+ }
10
+ export interface RecorderStatus {
11
+ supported: boolean;
12
+ active: boolean;
13
+ id: string | null;
14
+ elapsedMs: number;
15
+ events: number;
16
+ frames: number;
17
+ /** 运行中的反作弊进程名;有它在时低层钩子整体收不到输入 */
18
+ antiCheat: string[];
19
+ }
20
+ export interface RecorderResult {
21
+ id: string;
22
+ /** 轨迹目录绝对路径 */
23
+ dir: string;
24
+ /** 轨迹目录在工作空间「图片」目录下的相对路径:scripts/_recordings/<id> */
25
+ relPath: string;
26
+ events: number;
27
+ frames: number;
28
+ durationMs: number;
29
+ stoppedBy: "hotkey" | "api" | "timeout";
30
+ }
31
+ export default class SystemRecorder {
32
+ private transport;
33
+ constructor(transport?: IpcRenderer);
34
+ /**
35
+ * 开始录制用户操作:低层钩子收鼠标键盘、定时截主屏,每个按下/抬起/按键带上前后帧与那一刻的前台窗口。
36
+ * 只记事实,不做任何手势归并;录制期间每一拍向发起方视图推 `recorder.progress`(RecorderStatus)。
37
+ * 产物落在工作空间「图片」目录 scripts/_recordings/<id>/:trajectory.json + frames/*.png。
38
+ *
39
+ * @param options `{fps?, stopKey?, maxMs?}`,缺省 4 帧/秒、F12 结束、10 分钟上限。
40
+ * @returns `{id, dir, relPath, antiCheat}`;antiCheat 非空表示有反作弊进程在跑,钩子会整体收不到输入。
41
+ * @throws 平台不支持(目前仅 Windows)、已有录制在进行、钩子安装失败时抛错。
42
+ */
43
+ start: (options?: RecorderStartOptions) => Promise<{
44
+ id: string;
45
+ dir: string;
46
+ relPath: string;
47
+ antiCheat: string[];
48
+ }>;
49
+ /**
50
+ * 结束录制并写出轨迹。按 stopKey 结束的录制不必再调。
51
+ *
52
+ * @returns `{id, dir, relPath, events, frames, durationMs, stoppedBy}`。
53
+ * @throws 没有进行中的录制时抛错。
54
+ */
55
+ stop: () => Promise<RecorderResult>;
56
+ /**
57
+ * 录制状态:是否支持、是否进行中、已录事件数与帧数、运行中的反作弊进程。
58
+ */
59
+ status: () => Promise<RecorderStatus>;
60
+ }