@blastlauncher/protocol 0.0.0-stage → 3.0.0-alpha.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,544 @@
1
+ // The machine-readable capability contract (decision 0010, point 3). Runtime
2
+ // APIs request these names; hosts answer or deny them. Keep this list complete:
3
+ // packages/runtime/src/api/capabilities.test.ts fails when the sources request
4
+ // a name that is missing here or the catalog lists one nobody requests.
5
+ const STRING = { type: "string" };
6
+ const NUMBER = { type: "number" };
7
+ const BOOLEAN = { type: "boolean" };
8
+ const NULL = { type: "null" };
9
+ const STRING_ARRAY = { type: "array", items: STRING };
10
+ const OBJECT = { type: "object" };
11
+ const NO_PARAMS = { type: "object", properties: {} };
12
+ /** `Application`, shared by open, selection and window-management results. */
13
+ const APPLICATION = {
14
+ type: "object",
15
+ properties: {
16
+ name: STRING,
17
+ localizedName: STRING,
18
+ path: STRING,
19
+ bundleId: STRING,
20
+ windowsAppId: STRING,
21
+ },
22
+ required: ["name", "path"],
23
+ };
24
+ const DESKTOP = {
25
+ type: "object",
26
+ properties: {
27
+ size: {
28
+ type: "object",
29
+ properties: { width: NUMBER, height: NUMBER },
30
+ required: ["width", "height"],
31
+ },
32
+ id: STRING,
33
+ screenId: STRING,
34
+ active: BOOLEAN,
35
+ type: { type: "string", enum: ["User", "FullScreen"] },
36
+ },
37
+ required: ["size", "id", "screenId", "active", "type"],
38
+ };
39
+ const WINDOW = {
40
+ type: "object",
41
+ properties: {
42
+ id: STRING,
43
+ application: APPLICATION,
44
+ bounds: { type: ["object", "string"] },
45
+ desktopId: STRING,
46
+ fullScreenSettable: BOOLEAN,
47
+ resizable: BOOLEAN,
48
+ positionable: BOOLEAN,
49
+ active: BOOLEAN,
50
+ },
51
+ required: [
52
+ "id",
53
+ "bounds",
54
+ "desktopId",
55
+ "fullScreenSettable",
56
+ "resizable",
57
+ "positionable",
58
+ "active",
59
+ ],
60
+ };
61
+ const CLIPBOARD_PROPERTIES = {
62
+ text: STRING,
63
+ file: STRING,
64
+ html: STRING,
65
+ concealed: BOOLEAN,
66
+ closeMainWindow: BOOLEAN,
67
+ };
68
+ const CLIPBOARD_CONTENT = {
69
+ type: "object",
70
+ properties: CLIPBOARD_PROPERTIES,
71
+ };
72
+ /** `Clipboard.copy` alone accepts the deprecated `transient` flag. */
73
+ const CLIPBOARD_COPY_CONTENT = {
74
+ type: "object",
75
+ properties: { ...CLIPBOARD_PROPERTIES, transient: BOOLEAN },
76
+ };
77
+ const TOKEN_PROPERTIES = {
78
+ accessToken: STRING,
79
+ refreshToken: STRING,
80
+ idToken: STRING,
81
+ expiresIn: NUMBER,
82
+ scope: { type: ["string", "array"], items: STRING },
83
+ revocationEndpoint: STRING,
84
+ };
85
+ const TOKENS = {
86
+ type: "object",
87
+ properties: TOKEN_PROPERTIES,
88
+ required: ["accessToken"],
89
+ };
90
+ const MCP_SERVER = {
91
+ type: "object",
92
+ properties: {
93
+ name: STRING,
94
+ transport: { type: "string", enum: ["stdio", "sse"] },
95
+ icon: STRING,
96
+ description: STRING,
97
+ command: STRING,
98
+ args: STRING_ARRAY,
99
+ env: OBJECT,
100
+ url: STRING,
101
+ headers: OBJECT,
102
+ },
103
+ required: ["name", "transport"],
104
+ };
105
+ const STORAGE_APIS = [
106
+ "LocalStorage.getItem",
107
+ "getLocalStorageItem",
108
+ "Form.TextField.Props.storeValue",
109
+ "Form.Dropdown.Props.storeValue",
110
+ "List.Dropdown.Props.storeValue",
111
+ "Grid.Dropdown.Props.storeValue",
112
+ ];
113
+ const STORAGE_WRITE_APIS = [
114
+ "LocalStorage.setItem",
115
+ "setLocalStorageItem",
116
+ "Form.TextField.Props.storeValue",
117
+ "Form.Dropdown.Props.storeValue",
118
+ "List.Dropdown.Props.storeValue",
119
+ "Grid.Dropdown.Props.storeValue",
120
+ ];
121
+ const STORAGE_REMOVE_APIS = [
122
+ "LocalStorage.removeItem",
123
+ "removeLocalStorageItem",
124
+ "Form.TextField.Props.storeValue",
125
+ "Form.Dropdown.Props.storeValue",
126
+ "List.Dropdown.Props.storeValue",
127
+ "Grid.Dropdown.Props.storeValue",
128
+ ];
129
+ /**
130
+ * Every capability the runtime can request, keyed by wire name. Params and
131
+ * results are the shapes the runtime sends and accepts, not the full Raycast
132
+ * API types.
133
+ */
134
+ export const CAPABILITIES = {
135
+ "storage.get": {
136
+ scope: "session",
137
+ summary: "Reads a LocalStorage or internal storage key.",
138
+ params: {
139
+ type: "object",
140
+ properties: { key: STRING, scope: { type: "string", enum: ["blast:internal"] } },
141
+ required: ["key"],
142
+ },
143
+ result: { type: ["string", "number", "boolean", "null"] },
144
+ api: STORAGE_APIS,
145
+ },
146
+ "storage.set": {
147
+ scope: "session",
148
+ summary: "Writes a LocalStorage or internal storage key.",
149
+ params: {
150
+ type: "object",
151
+ properties: {
152
+ key: STRING,
153
+ value: { type: ["string", "number", "boolean"] },
154
+ scope: { type: "string", enum: ["blast:internal"] },
155
+ },
156
+ required: ["key", "value"],
157
+ },
158
+ result: NULL,
159
+ api: STORAGE_WRITE_APIS,
160
+ },
161
+ "storage.remove": {
162
+ scope: "session",
163
+ summary: "Removes a LocalStorage, internal storage or form draft key.",
164
+ params: {
165
+ type: "object",
166
+ properties: { key: STRING, scope: { type: "string", enum: ["blast:internal"] } },
167
+ required: ["key"],
168
+ },
169
+ result: NULL,
170
+ api: STORAGE_REMOVE_APIS,
171
+ },
172
+ "storage.all": {
173
+ scope: "session",
174
+ summary: "Reads every LocalStorage entry for the extension.",
175
+ params: NO_PARAMS,
176
+ result: OBJECT,
177
+ api: ["LocalStorage.allItems", "allLocalStorageItems"],
178
+ },
179
+ "storage.clear": {
180
+ scope: "session",
181
+ summary: "Clears every LocalStorage entry for the extension.",
182
+ params: NO_PARAMS,
183
+ result: NULL,
184
+ api: ["LocalStorage.clear", "clearLocalStorage"],
185
+ },
186
+ "oauth.tokens.get": {
187
+ scope: "session",
188
+ summary: "Reads the stored OAuth token set for a provider.",
189
+ params: { type: "object", properties: { providerId: STRING }, required: ["providerId"] },
190
+ result: { type: ["object", "null"], properties: TOKEN_PROPERTIES },
191
+ api: ["OAuth.PKCEClient.getTokens"],
192
+ },
193
+ "oauth.tokens.set": {
194
+ scope: "session",
195
+ summary: "Stores an OAuth token set for a provider.",
196
+ params: {
197
+ type: "object",
198
+ properties: { providerId: STRING, tokens: TOKENS },
199
+ required: ["providerId", "tokens"],
200
+ },
201
+ result: NULL,
202
+ api: ["OAuth.PKCEClient.setTokens"],
203
+ },
204
+ "oauth.tokens.remove": {
205
+ scope: "session",
206
+ summary: "Removes the stored OAuth token set for a provider.",
207
+ params: { type: "object", properties: { providerId: STRING }, required: ["providerId"] },
208
+ result: NULL,
209
+ api: ["OAuth.PKCEClient.removeTokens"],
210
+ },
211
+ "oauth.authorize": {
212
+ scope: "grant",
213
+ summary: "Asks the client to run an OAuth authorization flow and return a code.",
214
+ params: {
215
+ type: "object",
216
+ properties: {
217
+ url: STRING,
218
+ providerName: STRING,
219
+ providerId: STRING,
220
+ redirectMethod: { type: "string" },
221
+ providerIcon: STRING,
222
+ description: STRING,
223
+ },
224
+ required: ["url", "providerName", "providerId", "redirectMethod"],
225
+ },
226
+ result: {
227
+ type: "object",
228
+ properties: { authorizationCode: STRING },
229
+ required: ["authorizationCode"],
230
+ },
231
+ api: ["OAuth.PKCEClient.authorize"],
232
+ },
233
+ "ai.ask": {
234
+ // The engine answers only `{ id }` models of the extension's own provider;
235
+ // every other model (Raycast AI) needs an embedder handler.
236
+ scope: "grant",
237
+ summary: "Asks an AI model for text; own-provider `{ id }` models are answered by the engine.",
238
+ params: {
239
+ type: "object",
240
+ properties: {
241
+ prompt: STRING,
242
+ model: { type: ["string", "object"], properties: { id: STRING } },
243
+ creativity: { type: ["string", "number"] },
244
+ },
245
+ required: ["prompt"],
246
+ },
247
+ result: STRING,
248
+ api: ["AI.ask"],
249
+ },
250
+ "ai.models.refresh": {
251
+ scope: "session",
252
+ summary: "Re-lists the extension's own AI provider models.",
253
+ params: NO_PARAMS,
254
+ result: NULL,
255
+ api: ["AI.refreshModels"],
256
+ },
257
+ "ai.decide": {
258
+ scope: "grant",
259
+ summary: "Asks a client for typed answers to experimental decision questions.",
260
+ params: {
261
+ type: "object",
262
+ properties: {
263
+ state: STRING,
264
+ questions: {
265
+ type: "object",
266
+ properties: {
267
+ type: { type: "string", enum: ["noul", "score", "choice"] },
268
+ instructions: STRING,
269
+ criteria: { type: ["array", "object"] },
270
+ },
271
+ required: ["type", "instructions"],
272
+ },
273
+ },
274
+ required: ["state", "questions"],
275
+ },
276
+ result: OBJECT,
277
+ api: ["AI.experimental_decide"],
278
+ },
279
+ "browser.tabs": {
280
+ scope: "grant",
281
+ summary: "Lists the browser tabs a client chooses to expose.",
282
+ params: NO_PARAMS,
283
+ result: {
284
+ type: "array",
285
+ items: {
286
+ type: "object",
287
+ properties: {
288
+ id: NUMBER,
289
+ url: STRING,
290
+ title: STRING,
291
+ favicon: STRING,
292
+ active: BOOLEAN,
293
+ },
294
+ required: ["id", "url", "active"],
295
+ },
296
+ },
297
+ api: ["BrowserExtension.getTabs"],
298
+ },
299
+ "browser.content": {
300
+ scope: "grant",
301
+ summary: "Returns the content of a browser tab.",
302
+ params: {
303
+ type: "object",
304
+ properties: {
305
+ cssSelector: STRING,
306
+ tabId: NUMBER,
307
+ format: { type: "string", enum: ["html", "text", "markdown"] },
308
+ },
309
+ },
310
+ result: STRING,
311
+ api: ["BrowserExtension.getContent"],
312
+ },
313
+ "clipboard.copy": {
314
+ scope: "grant",
315
+ summary: "Copies text, HTML or a file path to the clipboard.",
316
+ params: CLIPBOARD_COPY_CONTENT,
317
+ result: NULL,
318
+ api: ["Clipboard.copy", "Action.CopyToClipboard", "ActionPanel.Item.CopyToClipboard"],
319
+ },
320
+ "clipboard.clear": {
321
+ scope: "grant",
322
+ summary: "Clears the clipboard.",
323
+ params: NO_PARAMS,
324
+ result: NULL,
325
+ api: ["Clipboard.clear"],
326
+ },
327
+ "clipboard.paste": {
328
+ scope: "grant",
329
+ summary: "Pastes text, HTML or a file path into the frontmost application.",
330
+ params: CLIPBOARD_CONTENT,
331
+ result: NULL,
332
+ api: ["Clipboard.paste", "Action.Paste", "ActionPanel.Item.Paste"],
333
+ },
334
+ "clipboard.read": {
335
+ scope: "grant",
336
+ summary: "Reads the clipboard, optionally at a history offset.",
337
+ params: {
338
+ type: "object",
339
+ properties: { offset: { type: "integer", enum: [0, 1, 2, 3, 4, 5] } },
340
+ },
341
+ result: {
342
+ type: "object",
343
+ properties: { text: STRING, file: STRING, html: STRING },
344
+ required: ["text"],
345
+ },
346
+ api: ["Clipboard.read", "Clipboard.readText"],
347
+ },
348
+ "open.url": {
349
+ scope: "grant",
350
+ summary: "Opens an HTTP(S) URL, optionally with a named application.",
351
+ params: {
352
+ type: "object",
353
+ properties: { url: STRING, application: { type: ["string", "object"] } },
354
+ required: ["url"],
355
+ },
356
+ result: NULL,
357
+ api: ["open", "Action.Open", "Action.OpenWith", "Action.OpenInBrowser"],
358
+ },
359
+ "open.path": {
360
+ scope: "grant",
361
+ summary: "Opens a file or folder, optionally with a named application.",
362
+ params: {
363
+ type: "object",
364
+ properties: { path: STRING, application: { type: ["string", "object"] } },
365
+ required: ["path"],
366
+ },
367
+ result: NULL,
368
+ api: ["open", "Action.Open", "Action.OpenWith"],
369
+ },
370
+ "selection.text": {
371
+ scope: "grant",
372
+ summary: "Returns the selected text; an empty string means nothing is selected.",
373
+ params: NO_PARAMS,
374
+ result: STRING,
375
+ api: ["getSelectedText"],
376
+ },
377
+ "selection.files": {
378
+ scope: "grant",
379
+ summary: "Returns the selected file-system items.",
380
+ params: NO_PARAMS,
381
+ result: { type: "array", items: { type: "object", properties: { path: STRING } } },
382
+ api: ["getSelectedFinderItems"],
383
+ },
384
+ "applications.frontmost": {
385
+ scope: "grant",
386
+ summary: "Returns the frontmost application.",
387
+ params: NO_PARAMS,
388
+ result: APPLICATION,
389
+ api: ["getFrontmostApplication"],
390
+ },
391
+ "applications.list": {
392
+ scope: "grant",
393
+ summary: "Lists installed applications, optionally filtered by path.",
394
+ params: { type: "object", properties: { path: STRING } },
395
+ result: { type: "array", items: APPLICATION },
396
+ api: ["getApplications"],
397
+ },
398
+ "applications.default": {
399
+ scope: "grant",
400
+ summary: "Returns the application the machine would open a path with.",
401
+ params: { type: "object", properties: { path: STRING }, required: ["path"] },
402
+ result: APPLICATION,
403
+ api: ["getDefaultApplication"],
404
+ },
405
+ "finder.show": {
406
+ scope: "grant",
407
+ summary: "Reveals a file or folder in the file manager.",
408
+ params: { type: "object", properties: { path: STRING }, required: ["path"] },
409
+ result: NULL,
410
+ api: ["showInFinder", "Action.ShowInFinder"],
411
+ },
412
+ trash: {
413
+ scope: "grant",
414
+ summary: "Moves files or folders to the trash.",
415
+ params: {
416
+ type: "object",
417
+ properties: { paths: STRING_ARRAY },
418
+ required: ["paths"],
419
+ },
420
+ result: NULL,
421
+ api: ["trash", "Action.Trash"],
422
+ },
423
+ "window.desktops": {
424
+ scope: "grant",
425
+ summary: "Lists desktops across all screens.",
426
+ params: NO_PARAMS,
427
+ result: { type: "array", items: DESKTOP },
428
+ api: ["WindowManagement.getDesktops"],
429
+ },
430
+ "window.active": {
431
+ scope: "grant",
432
+ summary: "Returns the active window.",
433
+ params: NO_PARAMS,
434
+ result: WINDOW,
435
+ api: ["WindowManagement.getActiveWindow"],
436
+ },
437
+ "window.list": {
438
+ scope: "grant",
439
+ summary: "Lists the windows on the active desktop.",
440
+ params: NO_PARAMS,
441
+ result: { type: "array", items: WINDOW },
442
+ api: ["WindowManagement.getWindowsOnActiveDesktop"],
443
+ },
444
+ "window.setBounds": {
445
+ scope: "grant",
446
+ summary: "Moves, resizes or makes a window fullscreen.",
447
+ params: {
448
+ type: "object",
449
+ properties: {
450
+ id: STRING,
451
+ bounds: { type: ["object", "string"] },
452
+ desktopId: STRING,
453
+ },
454
+ required: ["id", "bounds"],
455
+ },
456
+ result: NULL,
457
+ api: ["WindowManagement.setWindowBounds"],
458
+ },
459
+ "preferences.open": {
460
+ scope: "grant",
461
+ summary: "Asks the client to open extension or command preferences.",
462
+ params: {
463
+ type: "object",
464
+ properties: { scope: { type: "string", enum: ["extension", "command"] } },
465
+ required: ["scope"],
466
+ },
467
+ result: NULL,
468
+ api: ["openExtensionPreferences", "openCommandPreferences"],
469
+ },
470
+ "command.launch": {
471
+ scope: "grant",
472
+ summary: "Launches another command, passing arguments and launch context.",
473
+ params: {
474
+ type: "object",
475
+ properties: {
476
+ name: STRING,
477
+ type: { type: "string", enum: ["userInitiated", "background"] },
478
+ extensionName: STRING,
479
+ ownerOrAuthorName: STRING,
480
+ arguments: OBJECT,
481
+ context: OBJECT,
482
+ fallbackText: STRING,
483
+ },
484
+ required: ["name", "type"],
485
+ },
486
+ result: NULL,
487
+ api: ["launchCommand"],
488
+ },
489
+ "command.metadata": {
490
+ scope: "grant",
491
+ summary: "Updates the command's subtitle in the client.",
492
+ params: {
493
+ type: "object",
494
+ properties: { subtitle: { type: ["string", "null"] } },
495
+ },
496
+ result: NULL,
497
+ api: ["updateCommandMetadata"],
498
+ },
499
+ "snippet.create": {
500
+ scope: "grant",
501
+ summary: "Creates a snippet from text, a name and a keyword.",
502
+ params: {
503
+ type: "object",
504
+ properties: { text: STRING, name: STRING, keyword: STRING },
505
+ required: ["text"],
506
+ },
507
+ result: NULL,
508
+ api: ["Action.CreateSnippet"],
509
+ },
510
+ "quicklink.create": {
511
+ scope: "grant",
512
+ summary: "Creates a quicklink from a link and optional metadata.",
513
+ params: {
514
+ type: "object",
515
+ properties: {
516
+ link: STRING,
517
+ name: STRING,
518
+ icon: STRING,
519
+ application: { type: ["string", "object"] },
520
+ },
521
+ required: ["link"],
522
+ },
523
+ result: NULL,
524
+ api: ["Action.CreateQuicklink"],
525
+ },
526
+ "quicklook.toggle": {
527
+ scope: "grant",
528
+ summary: "Toggles Quick Look for the client's selected item.",
529
+ params: NO_PARAMS,
530
+ result: NULL,
531
+ api: ["Action.ToggleQuickLook"],
532
+ },
533
+ "mcp.install": {
534
+ scope: "grant",
535
+ summary: "Installs an MCP server descriptor.",
536
+ params: { type: "object", properties: { server: MCP_SERVER }, required: ["server"] },
537
+ result: NULL,
538
+ api: ["Action.InstallMCPServer"],
539
+ },
540
+ };
541
+ /** Whether a wire name names a capability in `CAPABILITIES`. */
542
+ export function isCapabilityName(name) {
543
+ return Object.hasOwn(CAPABILITIES, name);
544
+ }
@@ -0,0 +1,7 @@
1
+ type Schema = {
2
+ [key: string]: unknown;
3
+ };
4
+ /** The whole embedder protocol schema, serialized verbatim by the generator. */
5
+ export declare const EMBEDDER_PROTOCOL_SCHEMA: Schema;
6
+ export type EmbedderSchema = Schema;
7
+ export {};