@blastlauncher/runtime 1.0.5 → 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.
- package/README.md +4 -10
- package/dist/api/action-panel.d.ts +134 -0
- package/dist/api/action-panel.js +36 -0
- package/dist/api/action.d.ts +386 -0
- package/dist/api/action.js +260 -0
- package/dist/api/ai-browser.d.ts +423 -0
- package/dist/api/ai-browser.js +113 -0
- package/dist/api/ai-decide.d.ts +41 -0
- package/dist/api/ai-decide.js +62 -0
- package/dist/api/applications.d.ts +13 -0
- package/dist/api/applications.js +48 -0
- package/dist/api/cache.d.ts +27 -0
- package/dist/api/cache.js +126 -0
- package/dist/api/capability.d.ts +14 -0
- package/dist/api/capability.js +30 -0
- package/dist/api/clipboard.d.ts +57 -0
- package/dist/api/clipboard.js +83 -0
- package/dist/api/detail.d.ts +33 -0
- package/dist/api/detail.js +11 -0
- package/dist/api/diagnostics.d.ts +16 -0
- package/dist/api/diagnostics.js +26 -0
- package/dist/api/dropdown.d.ts +17 -0
- package/dist/api/dropdown.js +48 -0
- package/dist/api/enums.generated.d.ts +750 -0
- package/dist/api/enums.generated.js +719 -0
- package/dist/api/environment.d.ts +44 -0
- package/dist/api/environment.js +61 -0
- package/dist/api/feedback.d.ts +94 -0
- package/dist/api/feedback.js +228 -0
- package/dist/api/form.d.ts +162 -0
- package/dist/api/form.js +345 -0
- package/dist/api/grid.d.ts +293 -0
- package/dist/api/grid.js +36 -0
- package/dist/api/implemented.d.ts +53 -0
- package/dist/api/implemented.js +43 -0
- package/dist/api/index.d.ts +612 -0
- package/dist/api/index.js +82 -0
- package/dist/api/keyboard.d.ts +182 -0
- package/dist/api/keyboard.js +107 -0
- package/dist/api/launch.d.ts +40 -0
- package/dist/api/launch.js +27 -0
- package/dist/api/legacy.d.ts +9 -0
- package/dist/api/legacy.js +25 -0
- package/dist/api/list.d.ts +291 -0
- package/dist/api/list.js +28 -0
- package/dist/api/menu-bar.d.ts +54 -0
- package/dist/api/menu-bar.js +30 -0
- package/dist/api/metadata.d.ts +62 -0
- package/dist/api/metadata.js +33 -0
- package/dist/api/navigation.d.ts +36 -0
- package/dist/api/navigation.js +99 -0
- package/dist/api/oauth.d.ts +84 -0
- package/dist/api/oauth.js +125 -0
- package/dist/api/open.d.ts +18 -0
- package/dist/api/open.js +36 -0
- package/dist/api/preferences.d.ts +43 -0
- package/dist/api/preferences.js +41 -0
- package/dist/api/selection.d.ts +10 -0
- package/dist/api/selection.js +31 -0
- package/dist/api/slot.d.ts +7 -0
- package/dist/api/slot.js +11 -0
- package/dist/api/storage.d.ts +24 -0
- package/dist/api/storage.js +45 -0
- package/dist/api/types.d.ts +46 -0
- package/dist/api/types.js +5 -0
- package/dist/api/unsupported.d.ts +18 -0
- package/dist/api/unsupported.generated.d.ts +1255 -0
- package/dist/api/unsupported.generated.js +56 -0
- package/dist/api/unsupported.js +65 -0
- package/dist/api/window-management.d.ts +97 -0
- package/dist/api/window-management.js +164 -0
- package/dist/api/window.d.ts +16 -0
- package/dist/api/window.js +32 -0
- package/dist/main.d.ts +1 -0
- package/dist/main.js +339 -0
- package/dist/provider.d.ts +8 -0
- package/dist/provider.js +107 -0
- package/dist/reconciler/index.d.ts +9 -0
- package/dist/reconciler/index.js +186 -0
- package/dist/reconciler/serialize.d.ts +3 -0
- package/dist/reconciler/serialize.js +53 -0
- package/dist/reconciler/types.d.ts +8 -0
- package/dist/reconciler/types.js +1 -0
- package/package.json +32 -23
- package/.eslintrc.js +0 -6
- package/CHANGELOG.md +0 -19
- package/dist/App.d.ts +0 -5
- package/dist/App.js +0 -10
- package/dist/components/CommandList/index.d.ts +0 -1
- package/dist/components/CommandList/index.js +0 -20
- package/dist/components/CommandList/utils.d.ts +0 -1
- package/dist/components/CommandList/utils.js +0 -24
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -11
- package/dist/utils/connectDevtools.d.ts +0 -1
- package/dist/utils/connectDevtools.js +0 -11
- package/dist/utils/run.d.ts +0 -4
- package/dist/utils/run.js +0 -12
- package/dist/utils/window.d.ts +0 -0
- package/dist/utils/window.js +0 -2
- package/src/@types/raycast.d.ts +0 -4
- package/src/@types/react-devtools-core.d.ts +0 -19
- package/src/App.tsx +0 -18
- package/src/components/CommandList/index.tsx +0 -27
- package/src/components/CommandList/utils.ts +0 -26
- package/src/index.ts +0 -13
- package/src/utils/connectDevtools.ts +0 -8
- package/src/utils/run.ts +0 -7
- package/src/utils/window.js +0 -1
- package/tsconfig.json +0 -10
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import { createElement } from "react";
|
|
2
|
+
import { copy, paste } from "./clipboard.js";
|
|
3
|
+
import { requestCapability } from "./capability.js";
|
|
4
|
+
import { useNavigation } from "./navigation.js";
|
|
5
|
+
import { SubmitForm } from "./form.js";
|
|
6
|
+
import { ActionStyle, DatePickerType_2, Icon } from "./enums.generated.js";
|
|
7
|
+
import { applicationParam, open } from "./open.js";
|
|
8
|
+
// `isFullDay` from the declarations: a date without a local time component is
|
|
9
|
+
// a full day.
|
|
10
|
+
function isFullDay(date) {
|
|
11
|
+
if (!date || Number.isNaN(date.getTime()))
|
|
12
|
+
return false;
|
|
13
|
+
return (date.getHours() === 0 &&
|
|
14
|
+
date.getMinutes() === 0 &&
|
|
15
|
+
date.getSeconds() === 0 &&
|
|
16
|
+
date.getMilliseconds() === 0);
|
|
17
|
+
}
|
|
18
|
+
export const PickDate = Object.assign(function PickDate(props) {
|
|
19
|
+
const { onChange, min, max, ...rest } = props;
|
|
20
|
+
return createElement("Action.PickDate", {
|
|
21
|
+
...rest,
|
|
22
|
+
icon: rest.icon ?? Icon.Calendar,
|
|
23
|
+
// Dates arrive from clients as ISO strings; extension callbacks see
|
|
24
|
+
// Dates (the same wire rule as Form.DatePicker).
|
|
25
|
+
onChange: (value) => onChange(typeof value === "string" ? new Date(value) : null),
|
|
26
|
+
// `Date` objects cannot cross the wire: the bounds travel as ISO strings.
|
|
27
|
+
...(min === undefined ? {} : { min: min.toISOString() }),
|
|
28
|
+
...(max === undefined ? {} : { max: max.toISOString() }),
|
|
29
|
+
});
|
|
30
|
+
},
|
|
31
|
+
// `Action.PickDate.Type` and `.isFullDay` are members, exactly as declared.
|
|
32
|
+
{ Type: DatePickerType_2, isFullDay });
|
|
33
|
+
export const Action = Object.assign(function Action(props) {
|
|
34
|
+
return createElement("Action", props);
|
|
35
|
+
}, {
|
|
36
|
+
CopyToClipboard,
|
|
37
|
+
CreateQuicklink,
|
|
38
|
+
CreateSnippet,
|
|
39
|
+
InstallMCPServer,
|
|
40
|
+
Open,
|
|
41
|
+
OpenInBrowser,
|
|
42
|
+
OpenWith,
|
|
43
|
+
Paste,
|
|
44
|
+
PickDate,
|
|
45
|
+
Push,
|
|
46
|
+
ShowInFinder,
|
|
47
|
+
SubmitForm,
|
|
48
|
+
ToggleQuickLook,
|
|
49
|
+
Trash,
|
|
50
|
+
Style: ActionStyle,
|
|
51
|
+
});
|
|
52
|
+
export function CopyToClipboard(props) {
|
|
53
|
+
const { content, onCopy, title, transient, ...rest } = props;
|
|
54
|
+
// `content` stays in the runtime: clipboard payloads (possibly concealed
|
|
55
|
+
// secrets) must not be broadcast to clients in the scene. `transient` is the
|
|
56
|
+
// deprecated `concealed` flag and travels with the copy request instead.
|
|
57
|
+
return createElement("Action.CopyToClipboard", {
|
|
58
|
+
...rest,
|
|
59
|
+
title: title ?? "Copy to Clipboard",
|
|
60
|
+
onAction: () => copy(content, transient === undefined ? undefined : { transient }).then(() => onCopy?.(content)),
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
export function OpenInBrowser(props) {
|
|
64
|
+
const { url, onOpen, title, icon, ...rest } = props;
|
|
65
|
+
return createElement("Action.OpenInBrowser", {
|
|
66
|
+
...rest,
|
|
67
|
+
title: title ?? "Open in Browser",
|
|
68
|
+
icon: icon ?? Icon.Globe,
|
|
69
|
+
onAction: async () => {
|
|
70
|
+
await requestCapability("open.url", { url });
|
|
71
|
+
onOpen?.(url);
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
export function Paste(props) {
|
|
76
|
+
const { content, onPaste, title, icon, ...rest } = props;
|
|
77
|
+
return createElement("Action.Paste", {
|
|
78
|
+
...rest,
|
|
79
|
+
title: title ?? "Paste in Active App",
|
|
80
|
+
icon: icon ?? Icon.Clipboard,
|
|
81
|
+
onAction: async () => {
|
|
82
|
+
await paste(content);
|
|
83
|
+
onPaste?.(content);
|
|
84
|
+
},
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
export { CopyToClipboard as CopyToClipboardAction, Paste as PasteAction };
|
|
88
|
+
export function Push({ target, onPush, onPop, ...props }) {
|
|
89
|
+
const { push } = useNavigation();
|
|
90
|
+
return createElement("Action.Push", {
|
|
91
|
+
...props,
|
|
92
|
+
onAction: () => {
|
|
93
|
+
push(target, onPop);
|
|
94
|
+
onPush?.();
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
export { Push as PushAction };
|
|
99
|
+
/** Normalizes a `PathLike` for the wire; mirrors the check in `applications.ts`. */
|
|
100
|
+
function pathParam(path, api) {
|
|
101
|
+
if (typeof path !== "string" && !(path instanceof URL) && !Buffer.isBuffer(path)) {
|
|
102
|
+
throw new TypeError(`${api}: path must be a string, Buffer or URL`);
|
|
103
|
+
}
|
|
104
|
+
const value = String(path);
|
|
105
|
+
if (value === "")
|
|
106
|
+
throw new TypeError(`${api}: path must not be empty`);
|
|
107
|
+
return value;
|
|
108
|
+
}
|
|
109
|
+
export function Open(props) {
|
|
110
|
+
const { target, application, onOpen, ...rest } = props;
|
|
111
|
+
// `target` may be a private path: it reaches the host only through the
|
|
112
|
+
// capability request, never the scene.
|
|
113
|
+
return createElement("Action.Open", {
|
|
114
|
+
...rest,
|
|
115
|
+
icon: rest.icon ?? Icon.Finder,
|
|
116
|
+
onAction: async () => {
|
|
117
|
+
await open(target, application);
|
|
118
|
+
onOpen?.(target);
|
|
119
|
+
},
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
/** Deprecated alias of `Action.Open`. */
|
|
123
|
+
export const OpenAction = Open;
|
|
124
|
+
export function OpenWith(props) {
|
|
125
|
+
const { path, onOpen, ...rest } = props;
|
|
126
|
+
// `path` stays private, like every `Action.Open*` payload. The client picks
|
|
127
|
+
// the application, so no application param is sent here.
|
|
128
|
+
return createElement("Action.OpenWith", {
|
|
129
|
+
...rest,
|
|
130
|
+
title: rest.title ?? "Open With",
|
|
131
|
+
icon: rest.icon ?? Icon.Upload,
|
|
132
|
+
onAction: async () => {
|
|
133
|
+
await open(path);
|
|
134
|
+
onOpen?.(path);
|
|
135
|
+
},
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
/** Deprecated alias of `Action.OpenWith`. */
|
|
139
|
+
export const OpenWithAction = OpenWith;
|
|
140
|
+
export function ShowInFinder(props) {
|
|
141
|
+
const { path, onShow, ...rest } = props;
|
|
142
|
+
return createElement("Action.ShowInFinder", {
|
|
143
|
+
...rest,
|
|
144
|
+
title: rest.title ?? "Show in Finder",
|
|
145
|
+
icon: rest.icon ?? Icon.Finder,
|
|
146
|
+
onAction: async () => {
|
|
147
|
+
await requestCapability("finder.show", { path: pathParam(path, "Action.ShowInFinder") });
|
|
148
|
+
// The callback sees the value as passed, like the declarations promise.
|
|
149
|
+
onShow?.(path);
|
|
150
|
+
},
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
/** Deprecated alias of `Action.ShowInFinder`. */
|
|
154
|
+
export const ShowInFinderAction = ShowInFinder;
|
|
155
|
+
export function Trash(props) {
|
|
156
|
+
const { paths, onTrash, ...rest } = props;
|
|
157
|
+
const items = Array.isArray(paths) ? paths : [paths];
|
|
158
|
+
return createElement("Action.Trash", {
|
|
159
|
+
...rest,
|
|
160
|
+
title: rest.title ?? "Move to Trash",
|
|
161
|
+
icon: rest.icon ?? Icon.Trash,
|
|
162
|
+
onAction: async () => {
|
|
163
|
+
await requestCapability("trash", {
|
|
164
|
+
paths: items.map((item) => pathParam(item, "Action.Trash")),
|
|
165
|
+
});
|
|
166
|
+
onTrash?.(paths);
|
|
167
|
+
},
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
/** Deprecated alias of `Action.Trash`. */
|
|
171
|
+
export const TrashAction = Trash;
|
|
172
|
+
export function CreateSnippet(props) {
|
|
173
|
+
const { snippet, ...rest } = props;
|
|
174
|
+
// The snippet contents are private: out of the scene, into the capability.
|
|
175
|
+
const params = {
|
|
176
|
+
text: snippet.text,
|
|
177
|
+
...(snippet.name === undefined ? {} : { name: snippet.name }),
|
|
178
|
+
...(snippet.keyword === undefined ? {} : { keyword: snippet.keyword }),
|
|
179
|
+
};
|
|
180
|
+
return createElement("Action.CreateSnippet", {
|
|
181
|
+
...rest,
|
|
182
|
+
// The declarations document no defaults for CreateSnippet; these mirror
|
|
183
|
+
// the built-in action Raycast renders.
|
|
184
|
+
title: rest.title ?? "Create Snippet",
|
|
185
|
+
icon: rest.icon ?? Icon.Snippets,
|
|
186
|
+
onAction: () => requestCapability("snippet.create", params),
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
export function CreateQuicklink(props) {
|
|
190
|
+
const { quicklink, ...rest } = props;
|
|
191
|
+
const params = {
|
|
192
|
+
link: quicklink.link,
|
|
193
|
+
...(quicklink.name === undefined ? {} : { name: quicklink.name }),
|
|
194
|
+
...(quicklink.icon === undefined ? {} : { icon: quicklink.icon }),
|
|
195
|
+
};
|
|
196
|
+
const application = applicationParam(quicklink.application);
|
|
197
|
+
if (application !== undefined)
|
|
198
|
+
params.application = application;
|
|
199
|
+
return createElement("Action.CreateQuicklink", {
|
|
200
|
+
...rest,
|
|
201
|
+
title: rest.title ?? "Create Quicklink",
|
|
202
|
+
icon: rest.icon ?? Icon.Quicklink,
|
|
203
|
+
onAction: () => requestCapability("quicklink.create", params),
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
export function ToggleQuickLook(props) {
|
|
207
|
+
// Which file to preview is the client's business (the selected item carries
|
|
208
|
+
// it), so the capability carries no payload.
|
|
209
|
+
return createElement("Action.ToggleQuickLook", {
|
|
210
|
+
title: props.title ?? "Quick Look",
|
|
211
|
+
icon: props.icon ?? Icon.Eye,
|
|
212
|
+
shortcut: props.shortcut,
|
|
213
|
+
onAction: () => requestCapability("quicklook.toggle", {}),
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
// The server descriptor is the only payload: rebuilt from the declared fields
|
|
217
|
+
// so nothing unserializable or unknown reaches the wire.
|
|
218
|
+
function serverParam(server) {
|
|
219
|
+
if (typeof server !== "object" || server === null || Array.isArray(server)) {
|
|
220
|
+
throw new TypeError("Action.InstallMCPServer: server must be an object");
|
|
221
|
+
}
|
|
222
|
+
if (server.transport !== "stdio" && server.transport !== "sse") {
|
|
223
|
+
throw new TypeError('Action.InstallMCPServer: server.transport must be "stdio" or "sse"');
|
|
224
|
+
}
|
|
225
|
+
const params = {
|
|
226
|
+
name: server.name,
|
|
227
|
+
transport: server.transport,
|
|
228
|
+
};
|
|
229
|
+
if (server.icon !== undefined)
|
|
230
|
+
params["icon"] = server.icon;
|
|
231
|
+
if (server.description !== undefined)
|
|
232
|
+
params["description"] = server.description;
|
|
233
|
+
if (server.transport === "stdio") {
|
|
234
|
+
params["command"] = server.command;
|
|
235
|
+
if (server.args !== undefined)
|
|
236
|
+
params["args"] = server.args;
|
|
237
|
+
if (server.env !== undefined)
|
|
238
|
+
params["env"] = server.env;
|
|
239
|
+
}
|
|
240
|
+
else {
|
|
241
|
+
params["url"] = server.url;
|
|
242
|
+
if (server.headers !== undefined)
|
|
243
|
+
params["headers"] = server.headers;
|
|
244
|
+
}
|
|
245
|
+
return params;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Installs an MCP server. Blast runs no MCP client, so this is a capability:
|
|
249
|
+
* the host decides, and a headless run denies it unless granted.
|
|
250
|
+
*/
|
|
251
|
+
export function InstallMCPServer(props) {
|
|
252
|
+
const { server, ...rest } = props;
|
|
253
|
+
return createElement("Action.InstallMCPServer", {
|
|
254
|
+
...rest,
|
|
255
|
+
title: rest.title ?? "Install MCP Server",
|
|
256
|
+
onAction: async () => {
|
|
257
|
+
await requestCapability("mcp.install", { server: serverParam(server) });
|
|
258
|
+
},
|
|
259
|
+
});
|
|
260
|
+
}
|