@syllm/brickly-sdk 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,11 @@
1
+ import type { BridgeErrorCode, BridgeErrorPayload } from './protocol';
2
+ /** SDK 内统一错误类型;toJSON 直接产出 BPP host.error / command.error 的 error 字段。 */
3
+ export declare class BppError extends Error {
4
+ readonly code: BridgeErrorCode;
5
+ readonly details?: unknown;
6
+ constructor(code: BridgeErrorCode, message: string, details?: unknown);
7
+ toJSON(): BridgeErrorPayload;
8
+ static from(err: unknown): BppError;
9
+ }
10
+ /** 将 host.error / command.error 中的 error 字段还原为 BppError 实例。 */
11
+ export declare function payloadToError(payload: BridgeErrorPayload): BppError;
package/dist/errors.js ADDED
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BppError = void 0;
4
+ exports.payloadToError = payloadToError;
5
+ /** SDK 内统一错误类型;toJSON 直接产出 BPP host.error / command.error 的 error 字段。 */
6
+ class BppError extends Error {
7
+ code;
8
+ details;
9
+ constructor(code, message, details) {
10
+ super(message);
11
+ this.name = 'BppError';
12
+ this.code = code;
13
+ this.details = details;
14
+ }
15
+ toJSON() {
16
+ return { code: this.code, message: this.message, details: this.details };
17
+ }
18
+ static from(err) {
19
+ if (err instanceof BppError)
20
+ return err;
21
+ if (isBridgeErrorPayload(err))
22
+ return payloadToError(err);
23
+ if (err instanceof Error)
24
+ return new BppError('INTERNAL_ERROR', err.message);
25
+ return new BppError('INTERNAL_ERROR', formatUnknownError(err));
26
+ }
27
+ }
28
+ exports.BppError = BppError;
29
+ /** 将 host.error / command.error 中的 error 字段还原为 BppError 实例。 */
30
+ function payloadToError(payload) {
31
+ return new BppError(payload.code, payload.message, payload.details);
32
+ }
33
+ function isBridgeErrorPayload(value) {
34
+ if (!value || typeof value !== 'object' || Array.isArray(value))
35
+ return false;
36
+ const record = value;
37
+ return typeof record.code === 'string' && typeof record.message === 'string';
38
+ }
39
+ function formatUnknownError(value) {
40
+ if (typeof value === 'string')
41
+ return value;
42
+ if (value === undefined)
43
+ return 'undefined';
44
+ if (value === null)
45
+ return 'null';
46
+ if (typeof value === 'object') {
47
+ return stringifyErrorObject(value) ?? String(value);
48
+ }
49
+ return String(value);
50
+ }
51
+ function stringifyErrorObject(value) {
52
+ const seen = new WeakSet();
53
+ try {
54
+ return JSON.stringify(value, (_key, item) => {
55
+ if (typeof item === 'bigint')
56
+ return item.toString();
57
+ if (!item || typeof item !== 'object')
58
+ return item;
59
+ if (seen.has(item))
60
+ return '[Circular]';
61
+ seen.add(item);
62
+ return item;
63
+ });
64
+ }
65
+ catch {
66
+ return undefined;
67
+ }
68
+ }
@@ -0,0 +1,8 @@
1
+ export { BricklyRuntime, BrickSession, WindowHandle } from './api';
2
+ export type { BricklyRuntimeOptions, CommandMap, CommandContext, CommandHandler, EventEnvelope, EventsApi, InvokeOptions, PlatformApi, SessionOptions, UiApi } from './api';
3
+ export { BppTransport } from './runtime';
4
+ export type { BppTransportOptions } from './runtime';
5
+ export { BppError, payloadToError } from './errors';
6
+ export { PROTOCOL_VERSION, type BppMessage, type BppMessageType, type BridgeErrorCode, type BridgeErrorPayload, type BrickUiWindowOptions, type BrickWindowMethod, type CommandInvocationContext, type HostResourceRegisterPayload, type PlatformSystemPathName } from './protocol';
7
+ export { generateDependencyTypes } from './typegen';
8
+ export type { TypegenOptions, TypegenResult } from './typegen';
package/dist/index.js ADDED
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateDependencyTypes = exports.PROTOCOL_VERSION = exports.payloadToError = exports.BppError = exports.BppTransport = exports.WindowHandle = exports.BrickSession = exports.BricklyRuntime = void 0;
4
+ var api_1 = require("./api");
5
+ Object.defineProperty(exports, "BricklyRuntime", { enumerable: true, get: function () { return api_1.BricklyRuntime; } });
6
+ Object.defineProperty(exports, "BrickSession", { enumerable: true, get: function () { return api_1.BrickSession; } });
7
+ Object.defineProperty(exports, "WindowHandle", { enumerable: true, get: function () { return api_1.WindowHandle; } });
8
+ var runtime_1 = require("./runtime");
9
+ Object.defineProperty(exports, "BppTransport", { enumerable: true, get: function () { return runtime_1.BppTransport; } });
10
+ var errors_1 = require("./errors");
11
+ Object.defineProperty(exports, "BppError", { enumerable: true, get: function () { return errors_1.BppError; } });
12
+ Object.defineProperty(exports, "payloadToError", { enumerable: true, get: function () { return errors_1.payloadToError; } });
13
+ var protocol_1 = require("./protocol");
14
+ Object.defineProperty(exports, "PROTOCOL_VERSION", { enumerable: true, get: function () { return protocol_1.PROTOCOL_VERSION; } });
15
+ var typegen_1 = require("./typegen");
16
+ Object.defineProperty(exports, "generateDependencyTypes", { enumerable: true, get: function () { return typegen_1.generateDependencyTypes; } });
@@ -0,0 +1,530 @@
1
+ /**
2
+ * BPP(Brickly Brick Protocol)消息类型定义。
3
+ *
4
+ * 本文件是 Brickly/src/main/protocol/types.ts 的镜像,独立于 Electron 主进程代码
5
+ * 以保持 SDK 零依赖。**协议的真相源是** specs/bpp.schema.json,所有改动都应先改
6
+ * schema 再同步本文件,且需通过 Brickly/scripts/check-bpp-schema.mjs 校验。
7
+ */
8
+ export declare const PROTOCOL_VERSION = "0.1.0";
9
+ export type BridgeErrorCode = 'INVALID_INPUT' | 'BRICK_NOT_FOUND' | 'COMMAND_NOT_FOUND' | 'STARTUP_TIMEOUT' | 'PROTOCOL_ERROR' | 'PROCESS_EXITED' | 'CANCELLED' | 'INTERNAL_ERROR' | 'RESOURCE_LIMIT_EXCEEDED' | 'PERMISSION_DENIED' | 'PAYLOAD_TOO_LARGE' | 'RESOURCE_NOT_FOUND' | 'RESOURCE_EXPIRED' | 'DEPENDENCY_NOT_DECLARED' | 'DEPENDENCY_COMMAND_NOT_ALLOWED' | 'PARENT_INVOCATION_REQUIRED' | 'SCREENSHOT_CANCELLED' | 'SCREENSHOT_FAILED' | 'INPUT_FAILED' | 'SYSTEM_FAILED' | 'CURRENT_FOLDER_UNAVAILABLE' | (string & {});
10
+ export interface BridgeErrorPayload {
11
+ code: BridgeErrorCode;
12
+ message: string;
13
+ details?: unknown;
14
+ }
15
+ export interface HostResourceRegisterPayload {
16
+ mimeType?: string;
17
+ size?: number;
18
+ name?: string;
19
+ ttlMs?: number;
20
+ content?: unknown;
21
+ filePath?: string;
22
+ }
23
+ export interface CommandInvocationContext {
24
+ source: 'unknown' | 'hotkey';
25
+ triggerId?: string;
26
+ hotkeyId?: string;
27
+ binding?: unknown;
28
+ profileId?: string;
29
+ dependencyProfiles?: Record<string, string>;
30
+ }
31
+ export interface PlatformScreenshotRegionOptions {
32
+ outputPath?: string;
33
+ timeoutMs?: number;
34
+ }
35
+ export interface PlatformScreenshotResult {
36
+ path: string;
37
+ mimeType: 'image/png';
38
+ size: number;
39
+ createdAt: number;
40
+ }
41
+ export interface PlatformInputKeyboardTapPayload {
42
+ key: string;
43
+ modifiers?: string[];
44
+ }
45
+ export interface PlatformInputMousePointPayload {
46
+ x: number;
47
+ y: number;
48
+ }
49
+ export type PlatformClipboardKind = 'text' | 'file' | 'image';
50
+ export interface PlatformClipboardReadResult {
51
+ kind?: PlatformClipboardKind;
52
+ mimeType?: string;
53
+ size?: number;
54
+ hash?: string;
55
+ textPreview?: string;
56
+ text?: string;
57
+ sourceType?: string;
58
+ name?: string;
59
+ path?: string;
60
+ paths?: string[];
61
+ width?: number;
62
+ height?: number;
63
+ resource?: HostResourceRegisterPayload;
64
+ capturedAt: number;
65
+ }
66
+ export type PlatformClipboardContent = {
67
+ kind: 'text';
68
+ text: string;
69
+ } | {
70
+ kind: 'html';
71
+ html: string;
72
+ } | {
73
+ kind: 'rtf';
74
+ rtf: string;
75
+ } | {
76
+ kind: 'image';
77
+ path: string;
78
+ } | {
79
+ kind: 'image';
80
+ dataUrl: string;
81
+ } | {
82
+ kind: 'image';
83
+ base64: string;
84
+ mimeType?: string;
85
+ } | {
86
+ kind: 'image';
87
+ bytes: ArrayBuffer | Uint8Array | number[];
88
+ mimeType?: string;
89
+ } | {
90
+ kind: 'file';
91
+ paths: string[];
92
+ };
93
+ export interface PlatformClipboardSetResult {
94
+ kind: PlatformClipboardKind | 'html' | 'rtf' | 'empty';
95
+ formats: string[];
96
+ updatedAt: number;
97
+ paths?: string[];
98
+ names?: string[];
99
+ width?: number;
100
+ height?: number;
101
+ }
102
+ export interface PlatformScreenPoint {
103
+ x: number;
104
+ y: number;
105
+ }
106
+ export interface PlatformScreenRect extends PlatformScreenPoint {
107
+ width: number;
108
+ height: number;
109
+ }
110
+ export interface PlatformScreenDisplay {
111
+ id: number;
112
+ label: string;
113
+ bounds: PlatformScreenRect;
114
+ workArea: PlatformScreenRect;
115
+ size: {
116
+ width: number;
117
+ height: number;
118
+ };
119
+ workAreaSize: {
120
+ width: number;
121
+ height: number;
122
+ };
123
+ scaleFactor: number;
124
+ rotation: number;
125
+ colorDepth: number;
126
+ colorSpace: string;
127
+ depthPerComponent: number;
128
+ displayFrequency: number;
129
+ internal: boolean;
130
+ monochrome: boolean;
131
+ detected: boolean;
132
+ maximumCursorSize: {
133
+ width: number;
134
+ height: number;
135
+ };
136
+ touchSupport: 'available' | 'unavailable' | 'unknown';
137
+ accelerometerSupport: 'available' | 'unavailable' | 'unknown';
138
+ nativeOrigin: PlatformScreenPoint;
139
+ }
140
+ export interface PlatformScreenCaptureOptions extends PlatformScreenshotRegionOptions {
141
+ format?: 'dataUrl' | 'file';
142
+ }
143
+ export type PlatformScreenCaptureResult = {
144
+ dataUrl: string;
145
+ mimeType: 'image/png';
146
+ size: number;
147
+ createdAt: number;
148
+ } | PlatformScreenshotResult;
149
+ export interface PlatformScreenColorPickOptions {
150
+ timeoutMs?: number;
151
+ }
152
+ export interface PlatformScreenColorPickResult {
153
+ hex: string;
154
+ rgb: string;
155
+ }
156
+ export interface PlatformScreenDesktopCaptureOptions {
157
+ types: Array<'screen' | 'window'>;
158
+ thumbnailSize?: {
159
+ width: number;
160
+ height: number;
161
+ };
162
+ fetchWindowIcons?: boolean;
163
+ }
164
+ export interface PlatformScreenDesktopCaptureSource {
165
+ id: string;
166
+ name: string;
167
+ displayId: string;
168
+ thumbnail?: string;
169
+ appIcon?: string;
170
+ }
171
+ export type PlatformSystemPathName = 'home' | 'appData' | 'assets' | 'userData' | 'sessionData' | 'temp' | 'exe' | 'module' | 'desktop' | 'documents' | 'downloads' | 'music' | 'pictures' | 'videos' | 'recent' | 'logs' | 'crashDumps';
172
+ /** host.ui.createBrowserWindow options 白名单(仅 SDK 直接转发)。 */
173
+ export interface BrickUiWindowOptions {
174
+ width?: number;
175
+ height?: number;
176
+ x?: number;
177
+ y?: number;
178
+ minWidth?: number;
179
+ minHeight?: number;
180
+ maxWidth?: number;
181
+ maxHeight?: number;
182
+ frame?: boolean;
183
+ transparent?: boolean;
184
+ alwaysOnTop?: boolean;
185
+ resizable?: boolean;
186
+ movable?: boolean;
187
+ focusable?: boolean;
188
+ skipTaskbar?: boolean;
189
+ hasShadow?: boolean;
190
+ opacity?: number;
191
+ show?: boolean;
192
+ title?: string;
193
+ closable?: boolean;
194
+ kiosk?: boolean;
195
+ fullscreen?: boolean;
196
+ fullscreenable?: boolean;
197
+ minimizable?: boolean;
198
+ maximizable?: boolean;
199
+ backgroundColor?: string;
200
+ autoHideMenuBar?: boolean;
201
+ thickFrame?: boolean;
202
+ roundedCorners?: boolean;
203
+ enableLargerThanScreen?: boolean;
204
+ webPreferences?: {
205
+ preload?: string;
206
+ devTools?: boolean;
207
+ webviewTag?: boolean;
208
+ };
209
+ network?: BrickWindowNetworkOptions;
210
+ }
211
+ export interface BrickWindowNetworkOptions {
212
+ enabled?: boolean;
213
+ captureBody?: boolean;
214
+ maxBodyChars?: number;
215
+ maxPostDataSize?: number;
216
+ maxTotalBufferSize?: number;
217
+ maxResourceBufferSize?: number;
218
+ includeExtraInfo?: boolean;
219
+ targets?: 'window' | 'webview' | 'all';
220
+ }
221
+ export interface BrickWindowNetworkEvent {
222
+ windowId: number;
223
+ webContentsId: number;
224
+ targetWebContentsId: number;
225
+ source: 'cdp';
226
+ stage: 'debugger-attached' | 'debugger-detached' | 'debugger-attach-error' | 'request' | 'request-extra-info' | 'response' | 'response-extra-info' | 'redirect-response' | 'loading-finished' | 'loading-failed' | 'response-body' | 'response-body-error';
227
+ capturedAt: number;
228
+ cdpRequestId?: string;
229
+ url?: string;
230
+ method?: string;
231
+ resourceType?: string;
232
+ statusCode?: number;
233
+ statusText?: string;
234
+ mimeType?: string;
235
+ requestHeaders?: Record<string, string | string[] | null>;
236
+ responseHeaders?: Record<string, string | string[] | null>;
237
+ request?: unknown;
238
+ response?: unknown;
239
+ body?: string;
240
+ bodyLength?: number;
241
+ base64Encoded?: boolean;
242
+ truncated?: boolean;
243
+ omittedChars?: number;
244
+ error?: string;
245
+ details?: unknown;
246
+ [key: string]: unknown;
247
+ }
248
+ /** host.ui.callWindow 方法白名单。 */
249
+ export type BrickWindowMethod = 'setBounds' | 'getBounds' | 'setPosition' | 'getPosition' | 'setSize' | 'getSize' | 'setOpacity' | 'getOpacity' | 'setAlwaysOnTop' | 'isAlwaysOnTop' | 'setIgnoreMouseEvents' | 'setSkipTaskbar' | 'setTitle' | 'getTitle' | 'setResizable' | 'setMovable' | 'setFocusable' | 'setHasShadow' | 'setBackgroundColor' | 'setVisibleOnAllWorkspaces' | 'minimize' | 'maximize' | 'unmaximize' | 'restore' | 'hide' | 'show' | 'showInactive' | 'focus' | 'blur' | 'close' | 'isDestroyed' | 'isVisible' | 'isFocused' | 'isMinimized' | 'isMaximized' | 'loadURL' | 'loadFile' | 'reload' | 'webContents.send' | 'webContents.executeJavaScript' | 'webContents.openDevTools' | 'webContents.closeDevTools' | 'setContentBounds' | 'getContentBounds' | 'setContentSize' | 'getContentSize' | 'setMinimumSize' | 'getMinimumSize' | 'setMaximumSize' | 'getMaximumSize' | 'setAspectRatio' | 'center' | 'moveTop' | 'moveAbove' | 'setFullScreen' | 'isFullScreen' | 'isNormal' | 'isModal' | 'destroy' | 'getNormalBounds' | 'isResizable' | 'isMovable' | 'isFocusable' | 'setMinimizable' | 'isMinimizable' | 'setMaximizable' | 'isMaximizable' | 'setClosable' | 'isClosable' | 'setFullScreenable' | 'isFullScreenable' | 'setEnabled' | 'isEnabled' | 'hasShadow' | 'isVisibleOnAllWorkspaces' | 'setKiosk' | 'isKiosk' | 'flashFrame' | 'setProgressBar' | 'setMenuBarVisibility' | 'isMenuBarVisible' | 'setAutoHideMenuBar' | 'isMenuBarAutoHide' | 'removeMenu' | 'invalidateShadow' | 'setRepresentedFilename' | 'getRepresentedFilename' | 'setDocumentEdited' | 'isDocumentEdited' | 'webContents.toggleDevTools' | 'webContents.isDevToolsOpened' | 'webContents.goBack' | 'webContents.goForward' | 'webContents.canGoBack' | 'webContents.canGoForward' | 'webContents.getURL' | 'webContents.getTitle' | 'webContents.setZoomFactor' | 'webContents.getZoomFactor' | 'webContents.setZoomLevel' | 'webContents.getZoomLevel' | 'webContents.copy' | 'webContents.paste' | 'webContents.cut' | 'webContents.selectAll' | 'webContents.undo' | 'webContents.redo';
250
+ export type BppMessage = {
251
+ type: 'host.hello';
252
+ protocolVersion: string;
253
+ config?: Record<string, unknown>;
254
+ } | {
255
+ type: 'runtime.ready';
256
+ protocolVersion: string;
257
+ brickId?: string;
258
+ } | {
259
+ type: 'runtime.ping';
260
+ id: string;
261
+ } | {
262
+ type: 'runtime.pong';
263
+ id: string;
264
+ } | {
265
+ type: 'event.notify';
266
+ event: string;
267
+ payload?: unknown;
268
+ sourceBrickId: string;
269
+ publishedAt: number;
270
+ } | {
271
+ type: 'host.event.publish';
272
+ id: string;
273
+ event: string;
274
+ payload?: unknown;
275
+ } | {
276
+ type: 'host.resource.register';
277
+ id: string;
278
+ resource: HostResourceRegisterPayload;
279
+ } | {
280
+ type: 'host.resource.get';
281
+ id: string;
282
+ resourceId: string;
283
+ } | {
284
+ type: 'host.invoke';
285
+ id: string;
286
+ brickId: string;
287
+ commandId: string;
288
+ input: unknown;
289
+ parentRequestId: string;
290
+ profileId?: string;
291
+ stream?: boolean;
292
+ } | {
293
+ type: 'host.invokeRoot';
294
+ id: string;
295
+ brickId: string;
296
+ commandId: string;
297
+ input: unknown;
298
+ profileId?: string;
299
+ } | {
300
+ type: 'host.invoke.progress';
301
+ id: string;
302
+ progress: number;
303
+ message?: string;
304
+ } | {
305
+ type: 'host.invoke.chunk';
306
+ id: string;
307
+ name?: string;
308
+ chunk: unknown;
309
+ } | {
310
+ type: 'host.invoke.output';
311
+ id: string;
312
+ name: string;
313
+ value: unknown;
314
+ } | {
315
+ type: 'host.session.open';
316
+ id: string;
317
+ brickId: string;
318
+ profileId?: string;
319
+ } | {
320
+ type: 'host.session.invoke';
321
+ id: string;
322
+ sessionId: string;
323
+ commandId: string;
324
+ input: unknown;
325
+ parentRequestId: string;
326
+ } | {
327
+ type: 'host.session.close';
328
+ id: string;
329
+ sessionId: string;
330
+ } | {
331
+ type: 'host.result';
332
+ id: string;
333
+ result?: unknown;
334
+ } | {
335
+ type: 'host.error';
336
+ id: string;
337
+ error: BridgeErrorPayload;
338
+ } | {
339
+ type: 'command.invoke';
340
+ id: string;
341
+ commandId: string;
342
+ input: unknown;
343
+ invocation?: CommandInvocationContext;
344
+ } | {
345
+ type: 'command.cancel';
346
+ id: string;
347
+ } | {
348
+ type: 'command.progress';
349
+ id: string;
350
+ progress: number;
351
+ message?: string;
352
+ } | {
353
+ type: 'command.chunk';
354
+ id: string;
355
+ name?: string;
356
+ chunk: unknown;
357
+ } | {
358
+ type: 'command.output';
359
+ id: string;
360
+ name: string;
361
+ value: unknown;
362
+ } | {
363
+ type: 'command.result';
364
+ id: string;
365
+ result?: unknown;
366
+ } | {
367
+ type: 'command.error';
368
+ id: string;
369
+ error: BridgeErrorPayload;
370
+ } | {
371
+ type: 'host.ui.createBrowserWindow';
372
+ id: string;
373
+ url: string;
374
+ options?: BrickUiWindowOptions;
375
+ parentWindowId?: number;
376
+ } | {
377
+ type: 'host.ui.callWindow';
378
+ id: string;
379
+ windowId: number;
380
+ method: BrickWindowMethod;
381
+ args?: unknown[];
382
+ parentRequestId?: string;
383
+ } | {
384
+ type: 'host.ui.closeWindow';
385
+ id: string;
386
+ windowId: number;
387
+ } | {
388
+ type: 'host.ui.listWindows';
389
+ id: string;
390
+ } | {
391
+ type: 'host.platform.input.keyboardTap';
392
+ id: string;
393
+ payload: PlatformInputKeyboardTapPayload;
394
+ } | {
395
+ type: 'host.platform.input.mouseMove';
396
+ id: string;
397
+ payload: PlatformInputMousePointPayload;
398
+ } | {
399
+ type: 'host.platform.input.mouseClick';
400
+ id: string;
401
+ payload: PlatformInputMousePointPayload;
402
+ } | {
403
+ type: 'host.platform.input.mouseDoubleClick';
404
+ id: string;
405
+ payload: PlatformInputMousePointPayload;
406
+ } | {
407
+ type: 'host.platform.input.mouseRightClick';
408
+ id: string;
409
+ payload: PlatformInputMousePointPayload;
410
+ } | {
411
+ type: 'host.platform.clipboard.readContent';
412
+ id: string;
413
+ } | {
414
+ type: 'host.platform.clipboard.setContent';
415
+ id: string;
416
+ content: PlatformClipboardContent;
417
+ } | {
418
+ type: 'host.platform.screenshot.selectRegion';
419
+ id: string;
420
+ options?: PlatformScreenshotRegionOptions;
421
+ } | {
422
+ type: 'host.platform.screen.captureRegion';
423
+ id: string;
424
+ options?: PlatformScreenCaptureOptions;
425
+ } | {
426
+ type: 'host.platform.screen.pickColor';
427
+ id: string;
428
+ options?: PlatformScreenColorPickOptions;
429
+ } | {
430
+ type: 'host.platform.screen.getPrimaryDisplay';
431
+ id: string;
432
+ } | {
433
+ type: 'host.platform.screen.getAllDisplays';
434
+ id: string;
435
+ } | {
436
+ type: 'host.platform.screen.getCursorScreenPoint';
437
+ id: string;
438
+ } | {
439
+ type: 'host.platform.screen.getDisplayNearestPoint';
440
+ id: string;
441
+ point: PlatformScreenPoint;
442
+ } | {
443
+ type: 'host.platform.screen.getDisplayMatching';
444
+ id: string;
445
+ rect: PlatformScreenRect;
446
+ } | {
447
+ type: 'host.platform.screen.screenToDipPoint';
448
+ id: string;
449
+ point: PlatformScreenPoint;
450
+ } | {
451
+ type: 'host.platform.screen.dipToScreenPoint';
452
+ id: string;
453
+ point: PlatformScreenPoint;
454
+ } | {
455
+ type: 'host.platform.screen.screenToDipRect';
456
+ id: string;
457
+ rect: PlatformScreenRect;
458
+ } | {
459
+ type: 'host.platform.screen.dipToScreenRect';
460
+ id: string;
461
+ rect: PlatformScreenRect;
462
+ } | {
463
+ type: 'host.platform.screen.desktopCaptureSources';
464
+ id: string;
465
+ options: PlatformScreenDesktopCaptureOptions;
466
+ } | {
467
+ type: 'host.platform.system.showNotification';
468
+ id: string;
469
+ body: string;
470
+ clickFeatureCode?: string;
471
+ } | {
472
+ type: 'host.platform.system.shellOpenPath';
473
+ id: string;
474
+ fullPath: string;
475
+ } | {
476
+ type: 'host.platform.system.shellTrashItem';
477
+ id: string;
478
+ fullPath: string;
479
+ } | {
480
+ type: 'host.platform.system.shellShowItemInFolder';
481
+ id: string;
482
+ fullPath: string;
483
+ } | {
484
+ type: 'host.platform.system.shellOpenExternal';
485
+ id: string;
486
+ url: string;
487
+ } | {
488
+ type: 'host.platform.system.shellBeep';
489
+ id: string;
490
+ } | {
491
+ type: 'host.platform.system.getNativeId';
492
+ id: string;
493
+ } | {
494
+ type: 'host.platform.system.getAppName';
495
+ id: string;
496
+ } | {
497
+ type: 'host.platform.system.getAppVersion';
498
+ id: string;
499
+ } | {
500
+ type: 'host.platform.system.getPath';
501
+ id: string;
502
+ name: PlatformSystemPathName;
503
+ } | {
504
+ type: 'host.platform.system.getFileIcon';
505
+ id: string;
506
+ filePath: string;
507
+ } | {
508
+ type: 'host.platform.system.readCurrentFolderPath';
509
+ id: string;
510
+ } | {
511
+ type: 'host.platform.system.readCurrentBrowserUrl';
512
+ id: string;
513
+ } | {
514
+ type: 'host.platform.system.isDev';
515
+ id: string;
516
+ } | {
517
+ type: 'host.platform.system.isMacOS';
518
+ id: string;
519
+ } | {
520
+ type: 'host.platform.system.isWindows';
521
+ id: string;
522
+ } | {
523
+ type: 'host.platform.system.isLinux';
524
+ id: string;
525
+ } | {
526
+ type: 'runtime.shutdown';
527
+ } | {
528
+ type: 'runtime.bye';
529
+ };
530
+ export type BppMessageType = BppMessage['type'];
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ /**
3
+ * BPP(Brickly Brick Protocol)消息类型定义。
4
+ *
5
+ * 本文件是 Brickly/src/main/protocol/types.ts 的镜像,独立于 Electron 主进程代码
6
+ * 以保持 SDK 零依赖。**协议的真相源是** specs/bpp.schema.json,所有改动都应先改
7
+ * schema 再同步本文件,且需通过 Brickly/scripts/check-bpp-schema.mjs 校验。
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.PROTOCOL_VERSION = void 0;
11
+ exports.PROTOCOL_VERSION = '0.1.0';