@shiqianjiang/ceru-plugin-sdk 0.1.0 → 0.2.1

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.
@@ -0,0 +1,149 @@
1
+ import type { JsonObject } from './manifest.js';
2
+ import type { PermissionName } from './catalog.js';
3
+ import type { PermissionStatus, UserIntentHandle } from './index.js';
4
+ /** Permission groups are user-facing decisions, not one prompt per method. */
5
+ export declare const PERMISSION_GROUPS: {
6
+ readonly network: {
7
+ readonly title: "访问公网服务";
8
+ readonly permissions: readonly ["network.request", "network.socket"];
9
+ };
10
+ readonly localNetwork: {
11
+ readonly title: "访问局域网与本机服务";
12
+ readonly permissions: readonly ["network.private", "network.discovery"];
13
+ };
14
+ readonly account: {
15
+ readonly title: "读取登录状态与基本账号资料";
16
+ readonly permissions: readonly ["account.profile"];
17
+ };
18
+ readonly libraryRead: {
19
+ readonly title: "读取歌单与收藏";
20
+ readonly permissions: readonly ["library.read"];
21
+ };
22
+ readonly libraryManage: {
23
+ readonly title: "创建和修改歌单与收藏";
24
+ readonly permissions: readonly ["library.write"];
25
+ };
26
+ readonly libraryDelete: {
27
+ readonly title: "删除歌单与歌曲记录";
28
+ readonly permissions: readonly ["library.delete"];
29
+ };
30
+ readonly playbackRead: {
31
+ readonly title: "读取播放状态和队列";
32
+ readonly permissions: readonly ["player.read"];
33
+ };
34
+ readonly playbackControl: {
35
+ readonly title: "控制播放和播放队列";
36
+ readonly permissions: readonly ["player.control", "playback.fallback.hold"];
37
+ };
38
+ readonly downloads: {
39
+ readonly title: "管理下载任务";
40
+ readonly permissions: readonly ["downloads.create", "downloads.manage"];
41
+ };
42
+ readonly files: {
43
+ readonly title: "使用用户选定的文件";
44
+ readonly permissions: readonly ["files.read", "files.write"];
45
+ };
46
+ readonly localMusic: {
47
+ readonly title: "索引本地音乐和编辑标签";
48
+ readonly permissions: readonly ["localMusic.read", "localMusic.write"];
49
+ };
50
+ readonly clipboardRead: {
51
+ readonly title: "读取剪贴板";
52
+ readonly permissions: readonly ["clipboard.read"];
53
+ };
54
+ readonly clipboardWrite: {
55
+ readonly title: "写入剪贴板";
56
+ readonly permissions: readonly ["clipboard.write"];
57
+ };
58
+ readonly notifications: {
59
+ readonly title: "发送系统通知";
60
+ readonly permissions: readonly ["notifications.system"];
61
+ };
62
+ readonly external: {
63
+ readonly title: "在系统浏览器打开链接";
64
+ readonly permissions: readonly ["external.open"];
65
+ };
66
+ readonly settingsRead: {
67
+ readonly title: "读取软件偏好";
68
+ readonly permissions: readonly ["settings.read"];
69
+ };
70
+ readonly settingsWrite: {
71
+ readonly title: "修改软件偏好";
72
+ readonly permissions: readonly ["settings.write"];
73
+ };
74
+ readonly window: {
75
+ readonly title: "控制软件窗口";
76
+ readonly permissions: readonly ["window.control"];
77
+ };
78
+ readonly hotkeys: {
79
+ readonly title: "注册全局快捷键";
80
+ readonly permissions: readonly ["hotkeys.register"];
81
+ };
82
+ readonly sharing: {
83
+ readonly title: "发布和撤销分享";
84
+ readonly permissions: readonly ["sharing.publish", "sharing.revoke"];
85
+ };
86
+ readonly roomsRead: {
87
+ readonly title: "读取一起听房间状态";
88
+ readonly permissions: readonly ["rooms.read"];
89
+ };
90
+ readonly roomsControl: {
91
+ readonly title: "加入房间和控制一起听";
92
+ readonly permissions: readonly ["rooms.control"];
93
+ };
94
+ readonly ai: {
95
+ readonly title: "使用软件 AI 服务";
96
+ readonly permissions: readonly ["ai.use"];
97
+ };
98
+ readonly devices: {
99
+ readonly title: "控制音频设备与投放";
100
+ readonly permissions: readonly ["devices.control"];
101
+ };
102
+ readonly uiAppearance: {
103
+ readonly title: "修改软件全局外观";
104
+ readonly permissions: readonly ["ui.styles.global"];
105
+ };
106
+ readonly background: {
107
+ readonly title: "后台任务";
108
+ readonly permissions: readonly ["background.run"];
109
+ };
110
+ readonly credentials: {
111
+ readonly title: "使用本插件已保存的连接凭据";
112
+ readonly permissions: readonly ["credentials.use"];
113
+ };
114
+ readonly credentialExport: {
115
+ readonly title: "读取本插件连接凭据明文";
116
+ readonly permissions: readonly ["credentials.read"];
117
+ };
118
+ readonly guestPlugins: {
119
+ readonly title: "安装和运行兼容子插件";
120
+ readonly permissions: readonly ["guests.manage", "guests.run"];
121
+ };
122
+ readonly services: {
123
+ readonly title: "调用其他插件提供的服务";
124
+ readonly permissions: readonly ["services.consume"];
125
+ };
126
+ };
127
+ export type PermissionGroup = keyof typeof PERMISSION_GROUPS;
128
+ export declare function permissionGroup(name: PermissionName): PermissionGroup | undefined;
129
+ export interface PermissionGrant {
130
+ key: string;
131
+ name: PermissionName;
132
+ group?: PermissionGroup;
133
+ scope: JsonObject;
134
+ status: PermissionStatus;
135
+ expiresAt?: number;
136
+ }
137
+ export interface PermissionGroupRequest {
138
+ group: PermissionGroup;
139
+ /** Omit to request all statically scoped declarations in this group. */
140
+ keys?: string[];
141
+ /** Dynamic scopes keyed by declared permission key. */
142
+ scopes?: Record<string, JsonObject>;
143
+ intent?: UserIntentHandle;
144
+ }
145
+ export interface PermissionGroupResult {
146
+ group: PermissionGroup;
147
+ status: PermissionStatus;
148
+ grants: PermissionGrant[];
149
+ }
@@ -0,0 +1,45 @@
1
+ /** Permission groups are user-facing decisions, not one prompt per method. */
2
+ export const PERMISSION_GROUPS = {
3
+ network: { title: '访问公网服务', permissions: ['network.request', 'network.socket'] },
4
+ localNetwork: {
5
+ title: '访问局域网与本机服务',
6
+ permissions: ['network.private', 'network.discovery'],
7
+ },
8
+ account: { title: '读取登录状态与基本账号资料', permissions: ['account.profile'] },
9
+ libraryRead: { title: '读取歌单与收藏', permissions: ['library.read'] },
10
+ libraryManage: { title: '创建和修改歌单与收藏', permissions: ['library.write'] },
11
+ libraryDelete: { title: '删除歌单与歌曲记录', permissions: ['library.delete'] },
12
+ playbackRead: { title: '读取播放状态和队列', permissions: ['player.read'] },
13
+ playbackControl: {
14
+ title: '控制播放和播放队列',
15
+ permissions: ['player.control', 'playback.fallback.hold'],
16
+ },
17
+ downloads: { title: '管理下载任务', permissions: ['downloads.create', 'downloads.manage'] },
18
+ files: { title: '使用用户选定的文件', permissions: ['files.read', 'files.write'] },
19
+ localMusic: {
20
+ title: '索引本地音乐和编辑标签',
21
+ permissions: ['localMusic.read', 'localMusic.write'],
22
+ },
23
+ clipboardRead: { title: '读取剪贴板', permissions: ['clipboard.read'] },
24
+ clipboardWrite: { title: '写入剪贴板', permissions: ['clipboard.write'] },
25
+ notifications: { title: '发送系统通知', permissions: ['notifications.system'] },
26
+ external: { title: '在系统浏览器打开链接', permissions: ['external.open'] },
27
+ settingsRead: { title: '读取软件偏好', permissions: ['settings.read'] },
28
+ settingsWrite: { title: '修改软件偏好', permissions: ['settings.write'] },
29
+ window: { title: '控制软件窗口', permissions: ['window.control'] },
30
+ hotkeys: { title: '注册全局快捷键', permissions: ['hotkeys.register'] },
31
+ sharing: { title: '发布和撤销分享', permissions: ['sharing.publish', 'sharing.revoke'] },
32
+ roomsRead: { title: '读取一起听房间状态', permissions: ['rooms.read'] },
33
+ roomsControl: { title: '加入房间和控制一起听', permissions: ['rooms.control'] },
34
+ ai: { title: '使用软件 AI 服务', permissions: ['ai.use'] },
35
+ devices: { title: '控制音频设备与投放', permissions: ['devices.control'] },
36
+ uiAppearance: { title: '修改软件全局外观', permissions: ['ui.styles.global'] },
37
+ background: { title: '后台任务', permissions: ['background.run'] },
38
+ credentials: { title: '使用本插件已保存的连接凭据', permissions: ['credentials.use'] },
39
+ credentialExport: { title: '读取本插件连接凭据明文', permissions: ['credentials.read'] },
40
+ guestPlugins: { title: '安装和运行兼容子插件', permissions: ['guests.manage', 'guests.run'] },
41
+ services: { title: '调用其他插件提供的服务', permissions: ['services.consume'] },
42
+ };
43
+ export function permissionGroup(name) {
44
+ return Object.keys(PERMISSION_GROUPS).find((key) => PERMISSION_GROUPS[key].permissions.includes(name));
45
+ }
@@ -0,0 +1,344 @@
1
+ import type { Disposable, JsonObject, JsonValue, IconRef } from './manifest.js';
2
+ import type { ContentEntity, MusicFault, OperationContext, Page, ResourceRef, AssetHandle } from './index.js';
3
+ import type { LibraryPlaylist, PlaylistReference } from './library.js';
4
+ import type { LyricsDocument } from './music.js';
5
+ import type { PermissionGroup } from './permissions.js';
6
+ /** Supplied by Host actions/events. Never construct trusted intents from plugin JSON. */
7
+ export interface ServiceCall {
8
+ operation: OperationContext;
9
+ permissionKey: string;
10
+ }
11
+ export interface ServiceAvailability {
12
+ service: string;
13
+ version: string;
14
+ available: boolean;
15
+ reason?: 'host-not-connected' | 'unsupported' | 'not-logged-in' | 'disabled';
16
+ permissionGroups: PermissionGroup[];
17
+ }
18
+ export interface AccountProfile {
19
+ id: string;
20
+ displayName: string;
21
+ avatar?: AssetHandle;
22
+ /** Stable plugin-scoped identity; no email, phone, tokens or auth provider subject by default. */
23
+ identityScope: 'plugin';
24
+ }
25
+ export interface AccountSession {
26
+ loggedIn: boolean;
27
+ profile: AccountProfile | null;
28
+ }
29
+ export interface PlayerState {
30
+ status: 'idle' | 'loading' | 'playing' | 'paused' | 'ended' | 'error';
31
+ track: ContentEntity | null;
32
+ positionMs: number;
33
+ durationMs: number;
34
+ volume: number;
35
+ muted: boolean;
36
+ repeat: 'off' | 'one' | 'all';
37
+ shuffle: boolean;
38
+ }
39
+ export interface QueueState {
40
+ items: ContentEntity[];
41
+ currentIndex: number;
42
+ revision: string;
43
+ }
44
+ export interface DownloadTask {
45
+ id: string;
46
+ track: ContentEntity;
47
+ status: 'queued' | 'running' | 'paused' | 'completed' | 'failed' | 'cancelled';
48
+ receivedBytes: number;
49
+ totalBytes?: number;
50
+ error?: MusicFault;
51
+ }
52
+ export interface FileHandle {
53
+ kind: 'file';
54
+ id: string;
55
+ name: string;
56
+ size?: number;
57
+ mime?: string;
58
+ }
59
+ export interface DirectoryHandle {
60
+ kind: 'directory';
61
+ id: string;
62
+ name: string;
63
+ }
64
+ export interface AudioDevice {
65
+ id: string;
66
+ name: string;
67
+ kind: 'local' | 'dlna';
68
+ available: boolean;
69
+ }
70
+ export interface ShareDescriptor {
71
+ version: 1;
72
+ track: ResourceRef;
73
+ title: string;
74
+ artists: string[];
75
+ canonicalUrl?: string;
76
+ /** Public resolver identity; never executable plugin code, master keys or auth tokens. */
77
+ resolver?: {
78
+ id: string;
79
+ resourceId: string;
80
+ };
81
+ }
82
+ export interface RoomState {
83
+ joined: boolean;
84
+ id?: string;
85
+ title?: string;
86
+ role?: 'owner' | 'member';
87
+ members?: number;
88
+ }
89
+ export interface AppInfo {
90
+ name: string;
91
+ version: string;
92
+ platform: 'win32' | 'darwin' | 'linux';
93
+ locale: string;
94
+ theme: 'light' | 'dark';
95
+ hostApi: string;
96
+ }
97
+ export interface HostServiceEvents {
98
+ 'account.changed': AccountSession;
99
+ 'library.changed': {
100
+ target: PlaylistReference;
101
+ reason: 'created' | 'updated' | 'deleted' | 'synced';
102
+ };
103
+ 'player.changed': PlayerState;
104
+ 'queue.changed': QueueState;
105
+ 'lyrics.changed': LyricsDocument | null;
106
+ 'downloads.changed': DownloadTask;
107
+ 'settings.changed': {
108
+ keys: string[];
109
+ };
110
+ 'theme.changed': {
111
+ theme: 'light' | 'dark';
112
+ };
113
+ 'rooms.changed': RoomState;
114
+ 'devices.changed': AudioDevice[];
115
+ 'permissions.changed': {
116
+ keys: string[];
117
+ };
118
+ }
119
+ /** Contract first: availability must be checked before using services not connected by this Host. */
120
+ export interface HostServices {
121
+ capabilities: {
122
+ list(): Promise<ServiceAvailability[]>;
123
+ get(service: string): Promise<ServiceAvailability>;
124
+ };
125
+ account: {
126
+ getSession(call: ServiceCall): Promise<AccountSession>;
127
+ getProfile(call: ServiceCall): Promise<AccountProfile | null>;
128
+ /** Opens the application's own account page. Plugins do not implement login or receive its token. */
129
+ openLogin(operation: OperationContext): Promise<void>;
130
+ };
131
+ app: {
132
+ getInfo(): Promise<AppInfo>;
133
+ openSettings(section?: string): Promise<void>;
134
+ openExternal(url: string, call: ServiceCall): Promise<void>;
135
+ };
136
+ player: {
137
+ getState(call: ServiceCall): Promise<PlayerState>;
138
+ play(track: ResourceRef | undefined, call: ServiceCall): Promise<void>;
139
+ pause(call: ServiceCall): Promise<void>;
140
+ next(call: ServiceCall): Promise<void>;
141
+ previous(call: ServiceCall): Promise<void>;
142
+ seek(positionMs: number, call: ServiceCall): Promise<void>;
143
+ setVolume(volume: number, call: ServiceCall): Promise<void>;
144
+ setMode(mode: {
145
+ repeat?: PlayerState['repeat'];
146
+ shuffle?: boolean;
147
+ muted?: boolean;
148
+ }, call: ServiceCall): Promise<void>;
149
+ };
150
+ queue: {
151
+ get(call: ServiceCall): Promise<QueueState>;
152
+ append(items: ContentEntity[], call: ServiceCall): Promise<QueueState>;
153
+ replace(items: ContentEntity[], call: ServiceCall): Promise<QueueState>;
154
+ remove(refs: ResourceRef[], call: ServiceCall): Promise<QueueState>;
155
+ reorder(refs: ResourceRef[], revision: string, call: ServiceCall): Promise<QueueState>;
156
+ };
157
+ favorites: {
158
+ contains(refs: ResourceRef[], call: ServiceCall): Promise<boolean[]>;
159
+ add(refs: ResourceRef[], call: ServiceCall): Promise<void>;
160
+ remove(refs: ResourceRef[], call: ServiceCall): Promise<void>;
161
+ };
162
+ history: {
163
+ list(cursor: string | undefined, call: ServiceCall): Promise<Page<ContentEntity>>;
164
+ };
165
+ downloads: {
166
+ list(call: ServiceCall): Promise<DownloadTask[]>;
167
+ create(request: {
168
+ tracks: ResourceRef[];
169
+ quality?: string;
170
+ directory?: DirectoryHandle;
171
+ }, call: ServiceCall): Promise<DownloadTask[]>;
172
+ pause(ids: string[], call: ServiceCall): Promise<void>;
173
+ resume(ids: string[], call: ServiceCall): Promise<void>;
174
+ cancel(ids: string[], call: ServiceCall): Promise<void>;
175
+ retry(ids: string[], call: ServiceCall): Promise<void>;
176
+ reveal(id: string, call: ServiceCall): Promise<void>;
177
+ };
178
+ files: {
179
+ pick(request: {
180
+ title?: string;
181
+ extensions?: string[];
182
+ multiple?: boolean;
183
+ }, operation: OperationContext): Promise<FileHandle[]>;
184
+ pickDirectory(operation: OperationContext): Promise<DirectoryHandle | null>;
185
+ readText(file: FileHandle, call: ServiceCall): Promise<string>;
186
+ readBase64(file: FileHandle, call: ServiceCall): Promise<string>;
187
+ saveText(request: {
188
+ suggestedName: string;
189
+ text: string;
190
+ }, operation: OperationContext): Promise<FileHandle | null>;
191
+ writeText(file: FileHandle, text: string, call: ServiceCall): Promise<void>;
192
+ };
193
+ clipboard: {
194
+ readText(call: ServiceCall): Promise<string>;
195
+ writeText(text: string, call: ServiceCall): Promise<void>;
196
+ };
197
+ localMusic: {
198
+ list(cursor: string | undefined, call: ServiceCall): Promise<Page<ContentEntity>>;
199
+ scan(directories: DirectoryHandle[], call: ServiceCall): Promise<{
200
+ taskId: string;
201
+ }>;
202
+ getTags(track: ResourceRef, call: ServiceCall): Promise<JsonObject>;
203
+ writeTags(track: ResourceRef, tags: {
204
+ title?: string;
205
+ artists?: string[];
206
+ album?: string;
207
+ lyrics?: LyricsDocument;
208
+ }, call: ServiceCall): Promise<void>;
209
+ };
210
+ settings: {
211
+ /** Only explicit public setting names. Secret/unsafe settings are not part of this API. */
212
+ get(keys: string[], call: ServiceCall): Promise<JsonObject>;
213
+ update(values: JsonObject, call: ServiceCall): Promise<void>;
214
+ };
215
+ window: {
216
+ control(action: 'show' | 'minimize' | 'maximize' | 'restore' | 'mini-player', call: ServiceCall): Promise<void>;
217
+ };
218
+ hotkeys: {
219
+ register(request: {
220
+ id: string;
221
+ accelerator: string;
222
+ commandId: string;
223
+ }, call: ServiceCall): Promise<Disposable>;
224
+ };
225
+ sharing: {
226
+ create(request: ShareDescriptor, call: ServiceCall): Promise<{
227
+ id: string;
228
+ url: string;
229
+ expiresAt?: number;
230
+ }>;
231
+ revoke(id: string, call: ServiceCall): Promise<void>;
232
+ resolve(url: string, operation: OperationContext): Promise<ShareDescriptor>;
233
+ };
234
+ rooms: {
235
+ getState(call: ServiceCall): Promise<RoomState>;
236
+ join(inviteCode: string, call: ServiceCall): Promise<RoomState>;
237
+ leave(call: ServiceCall): Promise<void>;
238
+ requestTrack(track: ResourceRef, call: ServiceCall): Promise<void>;
239
+ };
240
+ devices: {
241
+ list(call: ServiceCall): Promise<AudioDevice[]>;
242
+ select(id: string, call: ServiceCall): Promise<void>;
243
+ };
244
+ ai: {
245
+ generate(request: {
246
+ prompt: string;
247
+ maxOutputChars?: number;
248
+ }, call: ServiceCall): Promise<{
249
+ text: string;
250
+ }>;
251
+ };
252
+ tasks: {
253
+ schedule(request: {
254
+ id: string;
255
+ commandId: string;
256
+ intervalMs: number;
257
+ }, call: ServiceCall): Promise<{
258
+ id: string;
259
+ }>;
260
+ cancel(id: string, call: ServiceCall): Promise<void>;
261
+ };
262
+ events: {
263
+ on<K extends keyof HostServiceEvents>(event: K, listener: (value: HostServiceEvents[K]) => void, call?: ServiceCall): Disposable;
264
+ };
265
+ }
266
+ export interface HostUI {
267
+ dialogs: {
268
+ confirm(request: {
269
+ title: string;
270
+ message: string;
271
+ confirmText?: string;
272
+ }): Promise<boolean>;
273
+ prompt(request: {
274
+ title: string;
275
+ label: string;
276
+ value?: string;
277
+ secret?: boolean;
278
+ }): Promise<string | null>;
279
+ pickPlaylist(request?: {
280
+ location?: 'local' | 'cloud';
281
+ writable?: boolean;
282
+ }): Promise<LibraryPlaylist | null>;
283
+ };
284
+ navigation: {
285
+ open(request: {
286
+ page: 'search' | 'playlist' | 'charts' | 'downloads' | 'account' | 'settings';
287
+ query?: string;
288
+ ref?: ResourceRef;
289
+ }): Promise<void>;
290
+ };
291
+ notifications: {
292
+ show(request: {
293
+ title: string;
294
+ body: string;
295
+ }, call: ServiceCall): Promise<void>;
296
+ };
297
+ progress: {
298
+ create(request: {
299
+ title: string;
300
+ cancellable?: boolean;
301
+ }): Promise<{
302
+ id: string;
303
+ }>;
304
+ update(id: string, request: {
305
+ value?: number;
306
+ message?: string;
307
+ }): Promise<void>;
308
+ close(id: string): Promise<void>;
309
+ };
310
+ }
311
+ export interface MenuContribution {
312
+ id: string;
313
+ slot: 'playlist.import' | 'playlist.actions' | 'track.actions' | 'player.actions' | 'search.tools';
314
+ title: string;
315
+ commandId: string;
316
+ icon?: IconRef;
317
+ when?: {
318
+ kinds?: ('track' | 'playlist')[];
319
+ loggedIn?: boolean;
320
+ };
321
+ }
322
+ /** Explicit allowlist for future Core routing; never forward arbitrary IPC channel names. */
323
+ export declare const HOST_SERVICE_METHODS: {
324
+ readonly capabilities: readonly ["list", "get"];
325
+ readonly account: readonly ["getSession", "getProfile", "openLogin"];
326
+ readonly app: readonly ["getInfo", "openSettings", "openExternal"];
327
+ readonly player: readonly ["getState", "play", "pause", "next", "previous", "seek", "setVolume", "setMode"];
328
+ readonly queue: readonly ["get", "append", "replace", "remove", "reorder"];
329
+ readonly favorites: readonly ["contains", "add", "remove"];
330
+ readonly history: readonly ["list"];
331
+ readonly downloads: readonly ["list", "create", "pause", "resume", "cancel", "retry", "reveal"];
332
+ readonly files: readonly ["pick", "pickDirectory", "readText", "readBase64", "saveText", "writeText"];
333
+ readonly clipboard: readonly ["readText", "writeText"];
334
+ readonly localMusic: readonly ["list", "scan", "getTags", "writeTags"];
335
+ readonly settings: readonly ["get", "update"];
336
+ readonly window: readonly ["control"];
337
+ readonly hotkeys: readonly ["register"];
338
+ readonly sharing: readonly ["create", "revoke", "resolve"];
339
+ readonly rooms: readonly ["getState", "join", "leave", "requestTrack"];
340
+ readonly devices: readonly ["list", "select"];
341
+ readonly ai: readonly ["generate"];
342
+ readonly tasks: readonly ["schedule", "cancel"];
343
+ };
344
+ export type SerializedHostValue = JsonValue | AssetHandle;
@@ -0,0 +1,22 @@
1
+ /** Explicit allowlist for future Core routing; never forward arbitrary IPC channel names. */
2
+ export const HOST_SERVICE_METHODS = {
3
+ capabilities: ['list', 'get'],
4
+ account: ['getSession', 'getProfile', 'openLogin'],
5
+ app: ['getInfo', 'openSettings', 'openExternal'],
6
+ player: ['getState', 'play', 'pause', 'next', 'previous', 'seek', 'setVolume', 'setMode'],
7
+ queue: ['get', 'append', 'replace', 'remove', 'reorder'],
8
+ favorites: ['contains', 'add', 'remove'],
9
+ history: ['list'],
10
+ downloads: ['list', 'create', 'pause', 'resume', 'cancel', 'retry', 'reveal'],
11
+ files: ['pick', 'pickDirectory', 'readText', 'readBase64', 'saveText', 'writeText'],
12
+ clipboard: ['readText', 'writeText'],
13
+ localMusic: ['list', 'scan', 'getTags', 'writeTags'],
14
+ settings: ['get', 'update'],
15
+ window: ['control'],
16
+ hotkeys: ['register'],
17
+ sharing: ['create', 'revoke', 'resolve'],
18
+ rooms: ['getState', 'join', 'leave', 'requestTrack'],
19
+ devices: ['list', 'select'],
20
+ ai: ['generate'],
21
+ tasks: ['schedule', 'cancel'],
22
+ };
@@ -0,0 +1,25 @@
1
+ import type { Disposable, JsonValue } from './manifest.js';
2
+ import type { OperationContext } from './index.js';
3
+ export interface SocketConnectOptions {
4
+ /** Defaults to network.socket. */
5
+ permissionKey?: string;
6
+ operation: OperationContext;
7
+ /** wss:// for native WebSocket; https:// for Socket.IO. */
8
+ url: string;
9
+ kind: 'websocket' | 'socket.io';
10
+ path?: string;
11
+ auth?: Record<string, JsonValue>;
12
+ /** Socket.IO reconnects at most five times. Native WebSocket does not auto-reconnect. */
13
+ reconnection?: boolean;
14
+ }
15
+ export interface HostSocket {
16
+ readonly id: string;
17
+ /** Incoming Socket.IO payloads are arrays of event arguments. WebSocket messages are text. */
18
+ on<T extends JsonValue = JsonValue>(event: string, handler: (data: T) => void): Disposable;
19
+ emit(event: string, data: JsonValue): Promise<void>;
20
+ send(data: JsonValue): Promise<void>;
21
+ disconnect(): Promise<void>;
22
+ }
23
+ export interface SocketAPI {
24
+ connect(options: SocketConnectOptions): Promise<HostSocket>;
25
+ }
@@ -0,0 +1 @@
1
+ export {};