@reset-framework/sdk 1.2.0 → 1.2.2

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/src/index.d.ts CHANGED
@@ -1,574 +1,664 @@
1
- export type ResetInvokeSuccess<T = unknown> = {
2
- ok: true;
3
- result: T;
4
- };
5
-
6
- export type ResetInvokeError = {
7
- ok: false;
8
- error: string;
9
- code?: string;
10
- details?: unknown;
11
- };
12
-
13
- export type ResetInvokeResponse<T = unknown> =
14
- | ResetInvokeSuccess<T>
15
- | ResetInvokeError;
16
-
17
- export type ResetPlatform = "macos" | "windows" | "linux" | "unknown";
18
-
19
- export type ResetArchitecture = "arm64" | "x64" | "x86" | "unknown";
20
-
21
- export interface ResetRuntime {
22
- invoke<T = unknown>(
23
- command: string,
24
- payload?: unknown
25
- ): Promise<ResetInvokeResponse<T>>;
26
- }
27
-
28
- export interface ResetRuntimeWindow {
29
- reset?: ResetRuntime;
30
- __resetEventState?: {
31
- listeners: Map<string, Set<(payload: unknown) => void>>;
32
- dispatch(envelope: { event: string; payload: unknown }): void;
33
- };
34
- __resetDispatchEvent?: (envelope: { event: string; payload: unknown }) => void;
35
- }
36
-
37
- export interface ResetRuntimeSourceOptions {
38
- target?: ResetRuntimeWindow;
39
- runtime?: ResetRuntime;
40
- resolveRuntime?: () => ResetRuntime | undefined;
41
- }
42
-
43
- export type ResetRuntimeSource =
44
- | ResetRuntime
45
- | ResetRuntimeWindow
46
- | ResetRuntimeSourceOptions
47
- | (() => ResetRuntime | undefined)
48
- | undefined;
49
-
50
- export interface ResetTransport {
51
- isAvailable(): boolean;
52
- getRuntime(): ResetRuntime;
53
- invokeRaw<T = unknown>(
54
- command: string,
55
- payload?: unknown
56
- ): Promise<ResetInvokeResponse<T>>;
57
- invoke<T = unknown>(command: string, payload?: unknown): Promise<T>;
58
- }
59
-
60
- export interface ResetCommandApi {
61
- invoke<T = unknown>(command: string, payload?: unknown): Promise<T>;
62
- invokeRaw<T = unknown>(
63
- command: string,
64
- payload?: unknown
65
- ): Promise<ResetInvokeResponse<T>>;
66
- }
67
-
68
- export interface ResetAppInfo {
69
- id: string;
70
- name: string;
71
- slug: string;
72
- version: string;
73
- windowTitle: string;
74
- }
75
-
76
- export interface ResetPoint {
77
- x: number;
78
- y: number;
79
- }
80
-
81
- export interface ResetSize {
82
- width: number;
83
- height: number;
84
- }
85
-
86
- export interface ResetRect extends ResetPoint, ResetSize {}
87
-
88
- export interface ResetWindowInfo {
89
- id: string;
90
- title: string;
91
- frame: ResetRect;
92
- position: ResetPoint;
93
- size: ResetSize;
94
- visible: boolean;
95
- focused: boolean;
96
- minimized: boolean;
97
- maximized: boolean;
98
- resizable: boolean;
99
- }
100
-
101
- export interface ResetDisplayInfo {
102
- id: string;
103
- frame: ResetRect;
104
- visibleFrame: ResetRect;
105
- scaleFactor: number;
106
- }
107
-
108
- export interface ResetRuntimeInfo {
109
- platform: ResetPlatform;
110
- arch: ResetArchitecture;
111
- frameworkVersion: string;
112
- bridgeVersion: string;
113
- debug: boolean;
114
- }
115
-
116
- export interface ResetCommandDescriptor {
117
- command: string;
118
- permission: string;
119
- }
120
-
121
- export interface ResetCapabilitiesInfo {
122
- commands: ReadonlyArray<ResetCommandDescriptor>;
123
- permissions: ReadonlyArray<string>;
124
- }
125
-
126
- export interface ResetAppApi {
127
- getId(): Promise<string>;
128
- getName(): Promise<string>;
129
- getSlug(): Promise<string>;
130
- getVersion(): Promise<string>;
131
- getInfo(): Promise<ResetAppInfo>;
132
- show(): Promise<{ visible: boolean }>;
133
- hide(): Promise<{ hidden: boolean }>;
134
- quit(): Promise<{ quitting: boolean }>;
135
- relaunch(): Promise<{ relaunching: boolean }>;
136
- }
137
-
138
- export interface ResetRuntimeApi {
139
- getPlatform(): Promise<ResetPlatform>;
140
- getArchitecture(): Promise<ResetArchitecture>;
141
- getFrameworkVersion(): Promise<string>;
142
- getBridgeVersion(): Promise<string>;
143
- getInfo(): Promise<ResetRuntimeInfo>;
144
- getCapabilities(): Promise<ResetCapabilitiesInfo>;
145
- }
146
-
147
- export interface ResetWindowApi {
148
- getCurrent(): Promise<ResetWindowInfo>;
149
- getInfo(): Promise<ResetWindowInfo>;
150
- list(): Promise<{ windows: ResetWindowInfo[] }>;
151
- show(): Promise<ResetWindowInfo>;
152
- hide(): Promise<ResetWindowInfo>;
153
- focus(): Promise<ResetWindowInfo>;
154
- close(): Promise<{ closed: boolean }>;
155
- minimize(): Promise<ResetWindowInfo>;
156
- maximize(): Promise<ResetWindowInfo>;
157
- center(): Promise<ResetWindowInfo>;
158
- setTitle(title: string): Promise<ResetWindowInfo>;
159
- setSize(width: number, height: number): Promise<ResetWindowInfo>;
160
- setResizable(resizable: boolean): Promise<ResetWindowInfo>;
161
- }
162
-
163
- export interface ResetDialogOpenFileOptions {
164
- title?: string;
165
- multiple?: boolean;
166
- directory?: boolean;
167
- }
168
-
169
- export interface ResetDialogSaveFileOptions {
170
- title?: string;
171
- defaultPath?: string;
172
- }
173
-
174
- export interface ResetDialogApi {
175
- openFile(options?: ResetDialogOpenFileOptions): Promise<{
176
- canceled: boolean;
177
- paths: string[];
178
- }>;
179
- saveFile(options?: ResetDialogSaveFileOptions): Promise<{
180
- canceled: boolean;
181
- path?: string;
182
- }>;
183
- message(title: string, message: string): Promise<{ confirmed: boolean }>;
184
- confirm(title: string, message: string): Promise<{ confirmed: boolean }>;
185
- }
186
-
187
- export interface ResetDirectoryEntry {
188
- name: string;
189
- path: string;
190
- kind: "file" | "directory" | "symlink" | "other";
191
- }
192
-
193
- export interface ResetFsApi {
194
- readTextFile(path: string): Promise<string>;
195
- writeTextFile(
196
- path: string,
197
- text: string,
198
- options?: { createDirectories?: boolean }
199
- ): Promise<{ written: boolean }>;
200
- exists(path: string): Promise<boolean>;
201
- mkdir(
202
- path: string,
203
- options?: { recursive?: boolean }
204
- ): Promise<{ created: boolean }>;
205
- remove(
206
- path: string,
207
- options?: { recursive?: boolean }
208
- ): Promise<{ removed: boolean; count: number }>;
209
- rename(from: string, to: string): Promise<{ renamed: boolean }>;
210
- readDir(path: string): Promise<ResetDirectoryEntry[]>;
211
- }
212
-
213
- export interface ResetPathInfo {
214
- homeDir: string;
215
- tempDir: string;
216
- appDataDir: string;
217
- appConfigDir: string;
218
- cacheDir: string;
219
- }
220
-
221
- export interface ResetPathApi {
222
- join(...segments: string[]): Promise<string>;
223
- basename(path: string): Promise<string>;
224
- dirname(path: string): Promise<string>;
225
- resolve(path: string, base?: string): Promise<string>;
226
- getHomeDir(): Promise<string>;
227
- getTempDir(): Promise<string>;
228
- getAppDataDir(): Promise<string>;
229
- getAppConfigDir(): Promise<string>;
230
- getCacheDir(): Promise<string>;
231
- getInfo(): Promise<ResetPathInfo>;
232
- }
233
-
234
- export interface ResetShellApi {
235
- openExternal(url: string): Promise<{ opened: boolean }>;
236
- openPath(path: string): Promise<{ opened: boolean }>;
237
- showItemInFolder(path: string): Promise<{ shown: boolean }>;
238
- }
239
-
240
- export interface ResetClipboardApi {
241
- readText(): Promise<string>;
242
- writeText(text: string): Promise<{ written: boolean }>;
243
- }
244
-
245
- export interface ResetNotificationApi {
246
- isSupported(): Promise<boolean>;
247
- requestPermission(): Promise<{
248
- supported: boolean;
249
- authorized: boolean;
250
- status: string;
251
- }>;
252
- show(options: { title: string; body?: string }): Promise<{
253
- shown: boolean;
254
- authorized: boolean;
255
- id?: string;
256
- }>;
257
- }
258
-
259
- export interface ResetScreenApi {
260
- getCursorPosition(): Promise<ResetPoint>;
261
- getPrimaryDisplay(): Promise<ResetDisplayInfo | null>;
262
- getDisplays(): Promise<ResetDisplayInfo[]>;
263
- }
264
-
265
- export interface ResetStorageApi {
266
- get<T = unknown>(key: string): Promise<T | null>;
267
- set(key: string, value: unknown): Promise<{ key: string; stored: boolean }>;
268
- remove(key: string): Promise<{ key: string; removed: boolean }>;
269
- clear(): Promise<{ cleared: boolean }>;
270
- getAll(): Promise<Record<string, unknown>>;
271
- }
272
-
273
- export interface ResetWebViewInfo {
274
- title: string;
275
- url: string;
276
- canGoBack: boolean;
277
- canGoForward: boolean;
278
- loading: boolean;
279
- estimatedProgress: number;
280
- }
281
-
282
- export interface ResetWebViewApi {
283
- getInfo(): Promise<ResetWebViewInfo>;
284
- reload(): Promise<ResetWebViewInfo>;
285
- goBack(): Promise<ResetWebViewInfo>;
286
- goForward(): Promise<ResetWebViewInfo>;
287
- navigate(options: { url?: string; path?: string }): Promise<ResetWebViewInfo>;
288
- setZoomFactor(factor: number): Promise<ResetWebViewInfo>;
289
- }
290
-
291
- export interface ResetCryptoApi {
292
- getInfo(): Promise<{
293
- supported: boolean;
294
- encodings: string[];
295
- maxRandomBytes: number;
296
- }>;
297
- randomBytes(
298
- size: number,
299
- options?: { encoding?: "hex" | "base64url" }
300
- ): Promise<{
301
- size: number;
302
- encoding: "hex" | "base64url";
303
- value: string;
304
- }>;
305
- randomUuid(): Promise<string>;
306
- }
307
-
308
- export interface ResetProcessInfo {
309
- pid: number;
310
- cwd: string;
311
- platform: ResetPlatform;
312
- arch: ResetArchitecture;
313
- debug: boolean;
314
- }
315
-
316
- export interface ResetProcessApi {
317
- getPid(): Promise<number>;
318
- getCwd(): Promise<string>;
319
- getInfo(): Promise<ResetProcessInfo>;
320
- }
321
-
322
- export interface ResetPowerInfo {
323
- supported: boolean;
324
- lowPowerMode: boolean;
325
- thermalState: string;
326
- }
327
-
328
- export interface ResetPowerApi {
329
- getInfo(): Promise<ResetPowerInfo>;
330
- }
331
-
332
- export interface ResetSupportInfo {
333
- supported: boolean;
334
- module: string;
335
- platform: ResetPlatform | string;
336
- }
337
-
338
- export interface ResetMenuInfo extends ResetSupportInfo {
339
- installed: boolean;
340
- topLevelCount: number;
341
- }
342
-
343
- export interface ResetTrayInfo extends ResetSupportInfo {
344
- created: boolean;
345
- title: string;
346
- tooltip: string;
347
- hasMenu: boolean;
348
- }
349
-
350
- export interface ResetMenuItem {
351
- id?: string;
352
- label?: string;
353
- enabled?: boolean;
354
- checked?: boolean;
355
- separator?: boolean;
356
- submenu?: ResetMenuItem[];
357
- }
358
-
359
- export interface ResetMenuApi {
360
- getInfo(): Promise<ResetMenuInfo>;
361
- setApplicationMenu(items: ResetMenuItem[]): Promise<ResetMenuInfo>;
362
- clearApplicationMenu(): Promise<ResetMenuInfo>;
363
- }
364
-
365
- export interface ResetTrayApi {
366
- getInfo(): Promise<ResetTrayInfo>;
367
- create(options?: {
368
- title?: string;
369
- tooltip?: string;
370
- items?: ResetMenuItem[];
371
- }): Promise<ResetTrayInfo>;
372
- setTitle(title: string): Promise<ResetTrayInfo>;
373
- setTooltip(tooltip: string): Promise<ResetTrayInfo>;
374
- setMenu(items: ResetMenuItem[]): Promise<ResetTrayInfo>;
375
- destroy(): Promise<{ destroyed: boolean }>;
376
- }
377
-
378
- export interface ResetShortcutApi {
379
- getInfo(): Promise<ResetSupportInfo>;
380
- register(accelerator: string): Promise<unknown>;
381
- unregister(accelerator: string): Promise<unknown>;
382
- unregisterAll(): Promise<unknown>;
383
- }
384
-
385
- export interface ResetProtocolLaunch {
386
- id: string;
387
- url: string;
388
- scheme: string;
389
- host: string;
390
- path: string;
391
- query: string;
392
- fragment: string;
393
- source: string;
394
- coldStart: boolean;
395
- }
396
-
397
- export interface ResetProtocolInfo extends ResetSupportInfo {
398
- configuredSchemes: ReadonlyArray<string>;
399
- bundledSchemes: ReadonlyArray<string>;
400
- eventName: string;
401
- pendingCount: number;
402
- eventStreamActive: boolean;
403
- runtimeRegistration: boolean;
404
- }
405
-
406
- export interface ResetProtocolApi {
407
- getInfo(): Promise<ResetProtocolInfo>;
408
- activate(): Promise<{ active: boolean }>;
409
- getCurrentLaunch(): Promise<ResetProtocolLaunch | null>;
410
- getPendingLaunches(): Promise<ReadonlyArray<ResetProtocolLaunch>>;
411
- consumePendingLaunches(): Promise<ReadonlyArray<ResetProtocolLaunch>>;
412
- listen(
413
- handler: (launch: ResetProtocolLaunch) => void,
414
- options?: { consumePending?: boolean }
415
- ): Promise<() => void>;
416
- register(options?: {
417
- scheme?: string;
418
- }): Promise<unknown>;
419
- unregister(options?: {
420
- scheme?: string;
421
- }): Promise<unknown>;
422
- }
423
-
424
- export interface ResetUpdaterApi {
425
- getInfo(): Promise<ResetSupportInfo>;
426
- check(options?: Record<string, unknown>): Promise<unknown>;
427
- download(options?: Record<string, unknown>): Promise<unknown>;
428
- install(options?: Record<string, unknown>): Promise<unknown>;
429
- }
430
-
431
- export interface ResetNetResponse {
432
- url: string;
433
- status: number;
434
- ok: boolean;
435
- headers: Record<string, string>;
436
- body: string;
437
- bodyEncoding: "utf8" | "base64" | string;
438
- }
439
-
440
- export interface ResetNetApi {
441
- request(options: {
442
- url: string;
443
- method?: string;
444
- headers?: Record<string, string>;
445
- body?: string;
446
- timeoutMs?: number;
447
- }): Promise<ResetNetResponse>;
448
- }
449
-
450
- export interface ResetClient {
451
- isAvailable(): boolean;
452
- getRuntime(): ResetRuntime;
453
- commands: ResetCommandApi;
454
- app: ResetAppApi;
455
- runtime: ResetRuntimeApi;
456
- events: ResetEventApi;
457
- window: ResetWindowApi;
458
- dialog: ResetDialogApi;
459
- fs: ResetFsApi;
460
- path: ResetPathApi;
461
- shell: ResetShellApi;
462
- clipboard: ResetClipboardApi;
463
- notification: ResetNotificationApi;
464
- screen: ResetScreenApi;
465
- storage: ResetStorageApi;
466
- webview: ResetWebViewApi;
467
- crypto: ResetCryptoApi;
468
- process: ResetProcessApi;
469
- power: ResetPowerApi;
470
- menu: ResetMenuApi;
471
- tray: ResetTrayApi;
472
- shortcut: ResetShortcutApi;
473
- protocol: ResetProtocolApi;
474
- updater: ResetUpdaterApi;
475
- net: ResetNetApi;
476
- }
477
-
478
- export interface ResetEventApi {
479
- listen<T = unknown>(
480
- eventName: string,
481
- handler: (payload: T) => void
482
- ): () => void;
483
- once<T = unknown>(
484
- eventName: string,
485
- handler: (payload: T) => void
486
- ): () => void;
487
- emitLocal<T = unknown>(eventName: string, payload: T): void;
488
- emit<T = unknown>(eventName: string, payload?: T): Promise<{
489
- delivered: boolean;
490
- event: string;
491
- }>;
492
- }
493
-
494
- declare global {
495
- interface Window extends ResetRuntimeWindow {}
496
- }
497
-
498
- export class ResetRuntimeError extends Error {
499
- cause?: unknown;
500
- constructor(message?: string, options?: { cause?: unknown });
501
- }
502
-
503
- export class ResetRuntimeUnavailableError extends ResetRuntimeError {
504
- constructor(message?: string);
505
- }
506
-
507
- export class ResetProtocolError extends ResetRuntimeError {
508
- command?: string;
509
- constructor(message?: string, options?: { command?: string; cause?: unknown });
510
- }
511
-
512
- export class ResetInvocationError extends ResetRuntimeError {
513
- command: string;
514
- response: ResetInvokeError;
515
- code?: string;
516
- details?: unknown;
517
- constructor(
518
- command: string,
519
- message: string,
520
- response: ResetInvokeError,
521
- options?: { cause?: unknown }
522
- );
523
- }
524
-
525
- export function isResetRuntimeAvailable(
526
- source?: ResetRuntimeSource
527
- ): boolean;
528
-
529
- export function getResetRuntime(
530
- source?: ResetRuntimeSource
531
- ): ResetRuntime;
532
-
533
- export function createResetTransport(
534
- source?: ResetRuntimeSource
535
- ): ResetTransport;
536
-
537
- export function invokeRaw<T = unknown>(
538
- command: string,
539
- payload?: unknown,
540
- source?: ResetRuntimeSource
541
- ): Promise<ResetInvokeResponse<T>>;
542
-
543
- export function invoke<T = unknown>(
544
- command: string,
545
- payload?: unknown,
546
- source?: ResetRuntimeSource
547
- ): Promise<T>;
548
-
549
- export function createResetClient(source?: ResetRuntimeSource): ResetClient;
550
-
551
- export const reset: ResetClient;
552
- export const commands: ResetCommandApi;
553
- export const app: ResetAppApi;
554
- export const runtime: ResetRuntimeApi;
555
- export const events: ResetEventApi;
556
- export const window: ResetWindowApi;
557
- export const dialog: ResetDialogApi;
558
- export const fs: ResetFsApi;
559
- export const path: ResetPathApi;
560
- export const shell: ResetShellApi;
561
- export const clipboard: ResetClipboardApi;
562
- export const notification: ResetNotificationApi;
563
- export const screen: ResetScreenApi;
564
- export const storage: ResetStorageApi;
565
- export const webview: ResetWebViewApi;
566
- export const crypto: ResetCryptoApi;
567
- export const process: ResetProcessApi;
568
- export const power: ResetPowerApi;
569
- export const menu: ResetMenuApi;
570
- export const tray: ResetTrayApi;
571
- export const shortcut: ResetShortcutApi;
572
- export const protocol: ResetProtocolApi;
573
- export const updater: ResetUpdaterApi;
574
- export const net: ResetNetApi;
1
+ export type ResetInvokeSuccess<T = unknown> = {
2
+ ok: true;
3
+ result: T;
4
+ };
5
+
6
+ export type ResetInvokeError = {
7
+ ok: false;
8
+ error: string;
9
+ code?: string;
10
+ details?: unknown;
11
+ };
12
+
13
+ export type ResetInvokeResponse<T = unknown> =
14
+ | ResetInvokeSuccess<T>
15
+ | ResetInvokeError;
16
+
17
+ export type ResetPlatform = "macos" | "windows" | "linux" | "unknown";
18
+
19
+ export type ResetArchitecture = "arm64" | "x64" | "x86" | "unknown";
20
+
21
+ export interface ResetRuntime {
22
+ invoke<T = unknown>(
23
+ command: string,
24
+ payload?: unknown
25
+ ): Promise<ResetInvokeResponse<T>>;
26
+ }
27
+
28
+ export interface ResetRuntimeWindow {
29
+ reset?: ResetRuntime;
30
+ __resetEventState?: {
31
+ listeners: Map<string, Set<(payload: unknown) => void>>;
32
+ dispatch(envelope: { event: string; payload: unknown }): void;
33
+ };
34
+ __resetDispatchEvent?: (envelope: { event: string; payload: unknown }) => void;
35
+ }
36
+
37
+ export interface ResetRuntimeSourceOptions {
38
+ target?: ResetRuntimeWindow;
39
+ runtime?: ResetRuntime;
40
+ resolveRuntime?: () => ResetRuntime | undefined;
41
+ }
42
+
43
+ export type ResetRuntimeSource =
44
+ | ResetRuntime
45
+ | ResetRuntimeWindow
46
+ | ResetRuntimeSourceOptions
47
+ | (() => ResetRuntime | undefined)
48
+ | undefined;
49
+
50
+ export interface ResetTransport {
51
+ isAvailable(): boolean;
52
+ getRuntime(): ResetRuntime;
53
+ invokeRaw<T = unknown>(
54
+ command: string,
55
+ payload?: unknown
56
+ ): Promise<ResetInvokeResponse<T>>;
57
+ invoke<T = unknown>(command: string, payload?: unknown): Promise<T>;
58
+ }
59
+
60
+ export interface ResetCommandApi {
61
+ invoke<T = unknown>(command: string, payload?: unknown): Promise<T>;
62
+ invokeRaw<T = unknown>(
63
+ command: string,
64
+ payload?: unknown
65
+ ): Promise<ResetInvokeResponse<T>>;
66
+ }
67
+
68
+ export interface ResetAppInfo {
69
+ id: string;
70
+ name: string;
71
+ slug: string;
72
+ version: string;
73
+ windowTitle: string;
74
+ }
75
+
76
+ export interface ResetPoint {
77
+ x: number;
78
+ y: number;
79
+ }
80
+
81
+ export interface ResetSize {
82
+ width: number;
83
+ height: number;
84
+ }
85
+
86
+ export interface ResetRect extends ResetPoint, ResetSize {}
87
+
88
+ export interface ResetWindowInfo {
89
+ id: string;
90
+ title: string;
91
+ frame: ResetRect;
92
+ position: ResetPoint;
93
+ size: ResetSize;
94
+ visible: boolean;
95
+ focused: boolean;
96
+ minimized: boolean;
97
+ maximized: boolean;
98
+ resizable: boolean;
99
+ }
100
+
101
+ export interface ResetDisplayInfo {
102
+ id: string;
103
+ frame: ResetRect;
104
+ visibleFrame: ResetRect;
105
+ scaleFactor: number;
106
+ }
107
+
108
+ export interface ResetRuntimeInfo {
109
+ platform: ResetPlatform;
110
+ arch: ResetArchitecture;
111
+ frameworkVersion: string;
112
+ bridgeVersion: string;
113
+ debug: boolean;
114
+ }
115
+
116
+ export interface ResetCommandDescriptor {
117
+ command: string;
118
+ permission: string;
119
+ }
120
+
121
+ export interface ResetCapabilitiesInfo {
122
+ commands: ReadonlyArray<ResetCommandDescriptor>;
123
+ permissions: ReadonlyArray<string>;
124
+ }
125
+
126
+ export interface ResetAppApi {
127
+ getId(): Promise<string>;
128
+ getName(): Promise<string>;
129
+ getSlug(): Promise<string>;
130
+ getVersion(): Promise<string>;
131
+ getInfo(): Promise<ResetAppInfo>;
132
+ show(): Promise<{ visible: boolean }>;
133
+ hide(): Promise<{ hidden: boolean }>;
134
+ quit(): Promise<{ quitting: boolean }>;
135
+ relaunch(): Promise<{ relaunching: boolean }>;
136
+ }
137
+
138
+ export interface ResetRuntimeApi {
139
+ getPlatform(): Promise<ResetPlatform>;
140
+ getArchitecture(): Promise<ResetArchitecture>;
141
+ getFrameworkVersion(): Promise<string>;
142
+ getBridgeVersion(): Promise<string>;
143
+ getInfo(): Promise<ResetRuntimeInfo>;
144
+ getCapabilities(): Promise<ResetCapabilitiesInfo>;
145
+ }
146
+
147
+ export interface ResetWindowApi {
148
+ getCurrent(): Promise<ResetWindowInfo>;
149
+ getInfo(): Promise<ResetWindowInfo>;
150
+ list(): Promise<{ windows: ResetWindowInfo[] }>;
151
+ show(): Promise<ResetWindowInfo>;
152
+ hide(): Promise<ResetWindowInfo>;
153
+ focus(): Promise<ResetWindowInfo>;
154
+ close(): Promise<{ closed: boolean }>;
155
+ minimize(): Promise<ResetWindowInfo>;
156
+ maximize(): Promise<ResetWindowInfo>;
157
+ center(): Promise<ResetWindowInfo>;
158
+ setTitle(title: string): Promise<ResetWindowInfo>;
159
+ setSize(width: number, height: number): Promise<ResetWindowInfo>;
160
+ setResizable(resizable: boolean): Promise<ResetWindowInfo>;
161
+ }
162
+
163
+ export interface ResetDialogOpenFileOptions {
164
+ title?: string;
165
+ multiple?: boolean;
166
+ directory?: boolean;
167
+ }
168
+
169
+ export interface ResetDialogSaveFileOptions {
170
+ title?: string;
171
+ defaultPath?: string;
172
+ }
173
+
174
+ export interface ResetDialogApi {
175
+ openFile(options?: ResetDialogOpenFileOptions): Promise<{
176
+ canceled: boolean;
177
+ paths: string[];
178
+ }>;
179
+ saveFile(options?: ResetDialogSaveFileOptions): Promise<{
180
+ canceled: boolean;
181
+ path?: string;
182
+ }>;
183
+ message(title: string, message: string): Promise<{ confirmed: boolean }>;
184
+ confirm(title: string, message: string): Promise<{ confirmed: boolean }>;
185
+ }
186
+
187
+ export interface ResetDirectoryEntry {
188
+ name: string;
189
+ path: string;
190
+ kind: "file" | "directory" | "symlink" | "other";
191
+ }
192
+
193
+ export interface ResetFsApi {
194
+ readTextFile(path: string): Promise<string>;
195
+ writeTextFile(
196
+ path: string,
197
+ text: string,
198
+ options?: { createDirectories?: boolean }
199
+ ): Promise<{ written: boolean }>;
200
+ exists(path: string): Promise<boolean>;
201
+ mkdir(
202
+ path: string,
203
+ options?: { recursive?: boolean }
204
+ ): Promise<{ created: boolean }>;
205
+ remove(
206
+ path: string,
207
+ options?: { recursive?: boolean }
208
+ ): Promise<{ removed: boolean; count: number }>;
209
+ rename(from: string, to: string): Promise<{ renamed: boolean }>;
210
+ readDir(path: string): Promise<ResetDirectoryEntry[]>;
211
+ }
212
+
213
+ export interface ResetPathInfo {
214
+ homeDir: string;
215
+ tempDir: string;
216
+ appDataDir: string;
217
+ appConfigDir: string;
218
+ cacheDir: string;
219
+ }
220
+
221
+ export interface ResetPathApi {
222
+ join(...segments: string[]): Promise<string>;
223
+ basename(path: string): Promise<string>;
224
+ dirname(path: string): Promise<string>;
225
+ resolve(path: string, base?: string): Promise<string>;
226
+ getHomeDir(): Promise<string>;
227
+ getTempDir(): Promise<string>;
228
+ getAppDataDir(): Promise<string>;
229
+ getAppConfigDir(): Promise<string>;
230
+ getCacheDir(): Promise<string>;
231
+ getInfo(): Promise<ResetPathInfo>;
232
+ }
233
+
234
+ export interface ResetShellApi {
235
+ openExternal(url: string): Promise<{ opened: boolean }>;
236
+ openPath(path: string): Promise<{ opened: boolean }>;
237
+ showItemInFolder(path: string): Promise<{ shown: boolean }>;
238
+ }
239
+
240
+ export interface ResetClipboardApi {
241
+ readText(): Promise<string>;
242
+ writeText(text: string): Promise<{ written: boolean }>;
243
+ }
244
+
245
+ export interface ResetNotificationApi {
246
+ isSupported(): Promise<boolean>;
247
+ requestPermission(): Promise<{
248
+ supported: boolean;
249
+ authorized: boolean;
250
+ status: string;
251
+ }>;
252
+ show(options: { title: string; body?: string }): Promise<{
253
+ shown: boolean;
254
+ authorized: boolean;
255
+ id?: string;
256
+ }>;
257
+ }
258
+
259
+ export interface ResetScreenApi {
260
+ getCursorPosition(): Promise<ResetPoint>;
261
+ getPrimaryDisplay(): Promise<ResetDisplayInfo | null>;
262
+ getDisplays(): Promise<ResetDisplayInfo[]>;
263
+ }
264
+
265
+ export interface ResetStorageApi {
266
+ get<T = unknown>(key: string): Promise<T | null>;
267
+ set(key: string, value: unknown): Promise<{ key: string; stored: boolean }>;
268
+ remove(key: string): Promise<{ key: string; removed: boolean }>;
269
+ clear(): Promise<{ cleared: boolean }>;
270
+ getAll(): Promise<Record<string, unknown>>;
271
+ }
272
+
273
+ export interface ResetWebViewInfo {
274
+ title: string;
275
+ url: string;
276
+ canGoBack: boolean;
277
+ canGoForward: boolean;
278
+ loading: boolean;
279
+ estimatedProgress: number;
280
+ }
281
+
282
+ export interface ResetWebViewApi {
283
+ getInfo(): Promise<ResetWebViewInfo>;
284
+ reload(): Promise<ResetWebViewInfo>;
285
+ goBack(): Promise<ResetWebViewInfo>;
286
+ goForward(): Promise<ResetWebViewInfo>;
287
+ navigate(options: { url?: string; path?: string }): Promise<ResetWebViewInfo>;
288
+ setZoomFactor(factor: number): Promise<ResetWebViewInfo>;
289
+ }
290
+
291
+ export interface ResetCryptoApi {
292
+ getInfo(): Promise<{
293
+ supported: boolean;
294
+ encodings: string[];
295
+ maxRandomBytes: number;
296
+ }>;
297
+ randomBytes(
298
+ size: number,
299
+ options?: { encoding?: "hex" | "base64url" }
300
+ ): Promise<{
301
+ size: number;
302
+ encoding: "hex" | "base64url";
303
+ value: string;
304
+ }>;
305
+ randomUuid(): Promise<string>;
306
+ }
307
+
308
+ export interface ResetProcessInfo {
309
+ pid: number;
310
+ cwd: string;
311
+ platform: ResetPlatform;
312
+ arch: ResetArchitecture;
313
+ debug: boolean;
314
+ }
315
+
316
+ export interface ResetProcessApi {
317
+ getPid(): Promise<number>;
318
+ getCwd(): Promise<string>;
319
+ getInfo(): Promise<ResetProcessInfo>;
320
+ }
321
+
322
+ export interface ResetBackendRuntimeInfo {
323
+ name: string;
324
+ version: string;
325
+ platform: string;
326
+ arch: string;
327
+ }
328
+
329
+ export interface ResetBackendInfo {
330
+ supported: boolean;
331
+ configured: boolean;
332
+ running: boolean;
333
+ available: boolean;
334
+ protocol: string;
335
+ pid: number | null;
336
+ entryPath: string;
337
+ runnerPath: string;
338
+ executablePath: string;
339
+ workingDirectory: string;
340
+ methods: ReadonlyArray<string>;
341
+ runtime: ResetBackendRuntimeInfo;
342
+ lastError: string;
343
+ }
344
+
345
+ export interface ResetBackendProcessInfo {
346
+ id: string;
347
+ pid: number;
348
+ command: string;
349
+ args: string[];
350
+ cwd: string;
351
+ running: boolean;
352
+ startedAt: string;
353
+ }
354
+
355
+ export interface ResetBackendProcessRunOptions {
356
+ command: string;
357
+ args?: string[];
358
+ cwd?: string;
359
+ env?: Record<string, string>;
360
+ shell?: boolean;
361
+ input?: string;
362
+ timeoutMs?: number;
363
+ maxBufferBytes?: number;
364
+ }
365
+
366
+ export interface ResetBackendProcessRunResult {
367
+ command: string;
368
+ args: string[];
369
+ cwd: string;
370
+ exitCode: number | null;
371
+ signal: string | null;
372
+ stdout: string;
373
+ stderr: string;
374
+ timedOut: boolean;
375
+ failed: boolean;
376
+ }
377
+
378
+ export interface ResetBackendProcessApi {
379
+ spawn(options: {
380
+ command: string;
381
+ args?: string[];
382
+ cwd?: string;
383
+ env?: Record<string, string>;
384
+ shell?: boolean;
385
+ }): Promise<ResetBackendProcessInfo>;
386
+ run(options: ResetBackendProcessRunOptions): Promise<ResetBackendProcessRunResult>;
387
+ write(processId: string, data: string): Promise<{ written: boolean }>;
388
+ kill(
389
+ processId: string,
390
+ options?: { signal?: string }
391
+ ): Promise<{ killed: boolean }>;
392
+ list(): Promise<{ processes: ResetBackendProcessInfo[] }>;
393
+ }
394
+
395
+ export interface ResetBackendApi {
396
+ getInfo(): Promise<ResetBackendInfo>;
397
+ isAvailable(): Promise<boolean>;
398
+ invoke<TResult = unknown>(method: string, params?: unknown): Promise<TResult>;
399
+ listen<T = unknown>(
400
+ eventName: string,
401
+ handler: (payload: T) => void
402
+ ): () => void;
403
+ once<T = unknown>(
404
+ eventName: string,
405
+ handler: (payload: T) => void
406
+ ): () => void;
407
+ process: ResetBackendProcessApi;
408
+ }
409
+
410
+ export interface ResetPowerInfo {
411
+ supported: boolean;
412
+ lowPowerMode: boolean;
413
+ thermalState: string;
414
+ }
415
+
416
+ export interface ResetPowerApi {
417
+ getInfo(): Promise<ResetPowerInfo>;
418
+ }
419
+
420
+ export interface ResetSupportInfo {
421
+ supported: boolean;
422
+ module: string;
423
+ platform: ResetPlatform | string;
424
+ }
425
+
426
+ export interface ResetMenuInfo extends ResetSupportInfo {
427
+ installed: boolean;
428
+ topLevelCount: number;
429
+ }
430
+
431
+ export interface ResetTrayInfo extends ResetSupportInfo {
432
+ created: boolean;
433
+ title: string;
434
+ tooltip: string;
435
+ hasMenu: boolean;
436
+ }
437
+
438
+ export interface ResetMenuItem {
439
+ id?: string;
440
+ label?: string;
441
+ enabled?: boolean;
442
+ checked?: boolean;
443
+ separator?: boolean;
444
+ submenu?: ResetMenuItem[];
445
+ }
446
+
447
+ export interface ResetMenuApi {
448
+ getInfo(): Promise<ResetMenuInfo>;
449
+ setApplicationMenu(items: ResetMenuItem[]): Promise<ResetMenuInfo>;
450
+ clearApplicationMenu(): Promise<ResetMenuInfo>;
451
+ }
452
+
453
+ export interface ResetTrayApi {
454
+ getInfo(): Promise<ResetTrayInfo>;
455
+ create(options?: {
456
+ title?: string;
457
+ tooltip?: string;
458
+ items?: ResetMenuItem[];
459
+ }): Promise<ResetTrayInfo>;
460
+ setTitle(title: string): Promise<ResetTrayInfo>;
461
+ setTooltip(tooltip: string): Promise<ResetTrayInfo>;
462
+ setMenu(items: ResetMenuItem[]): Promise<ResetTrayInfo>;
463
+ destroy(): Promise<{ destroyed: boolean }>;
464
+ }
465
+
466
+ export interface ResetShortcutApi {
467
+ getInfo(): Promise<ResetSupportInfo>;
468
+ register(accelerator: string): Promise<unknown>;
469
+ unregister(accelerator: string): Promise<unknown>;
470
+ unregisterAll(): Promise<unknown>;
471
+ }
472
+
473
+ export interface ResetProtocolLaunch {
474
+ id: string;
475
+ url: string;
476
+ scheme: string;
477
+ host: string;
478
+ path: string;
479
+ query: string;
480
+ fragment: string;
481
+ source: string;
482
+ coldStart: boolean;
483
+ }
484
+
485
+ export interface ResetProtocolInfo extends ResetSupportInfo {
486
+ configuredSchemes: ReadonlyArray<string>;
487
+ bundledSchemes: ReadonlyArray<string>;
488
+ eventName: string;
489
+ pendingCount: number;
490
+ eventStreamActive: boolean;
491
+ runtimeRegistration: boolean;
492
+ }
493
+
494
+ export interface ResetProtocolApi {
495
+ getInfo(): Promise<ResetProtocolInfo>;
496
+ activate(): Promise<{ active: boolean }>;
497
+ getCurrentLaunch(): Promise<ResetProtocolLaunch | null>;
498
+ getPendingLaunches(): Promise<ReadonlyArray<ResetProtocolLaunch>>;
499
+ consumePendingLaunches(): Promise<ReadonlyArray<ResetProtocolLaunch>>;
500
+ listen(
501
+ handler: (launch: ResetProtocolLaunch) => void,
502
+ options?: { consumePending?: boolean }
503
+ ): Promise<() => void>;
504
+ register(options?: {
505
+ scheme?: string;
506
+ }): Promise<unknown>;
507
+ unregister(options?: {
508
+ scheme?: string;
509
+ }): Promise<unknown>;
510
+ }
511
+
512
+ export interface ResetUpdaterApi {
513
+ getInfo(): Promise<ResetSupportInfo>;
514
+ check(options?: Record<string, unknown>): Promise<unknown>;
515
+ download(options?: Record<string, unknown>): Promise<unknown>;
516
+ install(options?: Record<string, unknown>): Promise<unknown>;
517
+ }
518
+
519
+ export interface ResetNetResponse {
520
+ url: string;
521
+ status: number;
522
+ ok: boolean;
523
+ headers: Record<string, string>;
524
+ body: string;
525
+ bodyEncoding: "utf8" | "base64" | string;
526
+ }
527
+
528
+ export interface ResetNetApi {
529
+ request(options: {
530
+ url: string;
531
+ method?: string;
532
+ headers?: Record<string, string>;
533
+ body?: string;
534
+ timeoutMs?: number;
535
+ }): Promise<ResetNetResponse>;
536
+ }
537
+
538
+ export interface ResetClient {
539
+ isAvailable(): boolean;
540
+ getRuntime(): ResetRuntime;
541
+ commands: ResetCommandApi;
542
+ app: ResetAppApi;
543
+ runtime: ResetRuntimeApi;
544
+ events: ResetEventApi;
545
+ window: ResetWindowApi;
546
+ dialog: ResetDialogApi;
547
+ fs: ResetFsApi;
548
+ path: ResetPathApi;
549
+ shell: ResetShellApi;
550
+ clipboard: ResetClipboardApi;
551
+ notification: ResetNotificationApi;
552
+ screen: ResetScreenApi;
553
+ storage: ResetStorageApi;
554
+ webview: ResetWebViewApi;
555
+ crypto: ResetCryptoApi;
556
+ process: ResetProcessApi;
557
+ power: ResetPowerApi;
558
+ menu: ResetMenuApi;
559
+ tray: ResetTrayApi;
560
+ shortcut: ResetShortcutApi;
561
+ protocol: ResetProtocolApi;
562
+ updater: ResetUpdaterApi;
563
+ net: ResetNetApi;
564
+ backend: ResetBackendApi;
565
+ }
566
+
567
+ export interface ResetEventApi {
568
+ listen<T = unknown>(
569
+ eventName: string,
570
+ handler: (payload: T) => void
571
+ ): () => void;
572
+ once<T = unknown>(
573
+ eventName: string,
574
+ handler: (payload: T) => void
575
+ ): () => void;
576
+ emitLocal<T = unknown>(eventName: string, payload: T): void;
577
+ emit<T = unknown>(eventName: string, payload?: T): Promise<{
578
+ delivered: boolean;
579
+ event: string;
580
+ }>;
581
+ }
582
+
583
+ declare global {
584
+ interface Window extends ResetRuntimeWindow {}
585
+ }
586
+
587
+ export class ResetRuntimeError extends Error {
588
+ cause?: unknown;
589
+ constructor(message?: string, options?: { cause?: unknown });
590
+ }
591
+
592
+ export class ResetRuntimeUnavailableError extends ResetRuntimeError {
593
+ constructor(message?: string);
594
+ }
595
+
596
+ export class ResetProtocolError extends ResetRuntimeError {
597
+ command?: string;
598
+ constructor(message?: string, options?: { command?: string; cause?: unknown });
599
+ }
600
+
601
+ export class ResetInvocationError extends ResetRuntimeError {
602
+ command: string;
603
+ response: ResetInvokeError;
604
+ code?: string;
605
+ details?: unknown;
606
+ constructor(
607
+ command: string,
608
+ message: string,
609
+ response: ResetInvokeError,
610
+ options?: { cause?: unknown }
611
+ );
612
+ }
613
+
614
+ export function isResetRuntimeAvailable(
615
+ source?: ResetRuntimeSource
616
+ ): boolean;
617
+
618
+ export function getResetRuntime(
619
+ source?: ResetRuntimeSource
620
+ ): ResetRuntime;
621
+
622
+ export function createResetTransport(
623
+ source?: ResetRuntimeSource
624
+ ): ResetTransport;
625
+
626
+ export function invokeRaw<T = unknown>(
627
+ command: string,
628
+ payload?: unknown,
629
+ source?: ResetRuntimeSource
630
+ ): Promise<ResetInvokeResponse<T>>;
631
+
632
+ export function invoke<T = unknown>(
633
+ command: string,
634
+ payload?: unknown,
635
+ source?: ResetRuntimeSource
636
+ ): Promise<T>;
637
+
638
+ export function createResetClient(source?: ResetRuntimeSource): ResetClient;
639
+
640
+ export const reset: ResetClient;
641
+ export const commands: ResetCommandApi;
642
+ export const app: ResetAppApi;
643
+ export const runtime: ResetRuntimeApi;
644
+ export const events: ResetEventApi;
645
+ export const window: ResetWindowApi;
646
+ export const dialog: ResetDialogApi;
647
+ export const fs: ResetFsApi;
648
+ export const path: ResetPathApi;
649
+ export const shell: ResetShellApi;
650
+ export const clipboard: ResetClipboardApi;
651
+ export const notification: ResetNotificationApi;
652
+ export const screen: ResetScreenApi;
653
+ export const storage: ResetStorageApi;
654
+ export const webview: ResetWebViewApi;
655
+ export const crypto: ResetCryptoApi;
656
+ export const process: ResetProcessApi;
657
+ export const power: ResetPowerApi;
658
+ export const menu: ResetMenuApi;
659
+ export const tray: ResetTrayApi;
660
+ export const shortcut: ResetShortcutApi;
661
+ export const protocol: ResetProtocolApi;
662
+ export const updater: ResetUpdaterApi;
663
+ export const net: ResetNetApi;
664
+ export const backend: ResetBackendApi;