@one2x/medeo-plugin-sdk 0.0.0-stage → 0.11.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 +27 -2
- package/dist/generated.d.ts +591 -0
- package/dist/generated.js +1 -0
- package/dist/index.d.ts +1320 -0
- package/dist/index.js +541 -0
- package/dist/react.d.ts +46 -0
- package/dist/react.js +44 -0
- package/dist/registry.d.ts +1349 -0
- package/dist/registry.js +203 -0
- package/dist/rpc.d.ts +28 -0
- package/dist/rpc.js +172 -0
- package/dist/testing.d.ts +43 -0
- package/dist/testing.js +190 -0
- package/dist/ui/styles.d.ts +4 -0
- package/dist/ui/styles.js +31 -0
- package/dist/ui.d.ts +50 -0
- package/dist/ui.js +115 -0
- package/package.json +66 -4
- package/src/generated.ts +231 -0
- package/src/index.ts +658 -0
- package/src/react.ts +50 -0
- package/src/registry.ts +204 -0
- package/src/rpc.ts +136 -0
- package/src/testing.ts +169 -0
- package/src/ui/styles.ts +31 -0
- package/src/ui.ts +102 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1320 @@
|
|
|
1
|
+
import type { JsonValue } from './generated.ts';
|
|
2
|
+
import type { MethodName } from './registry.ts';
|
|
3
|
+
export { METHODS, LIMITS, type MethodName } from './registry.ts';
|
|
4
|
+
/** One SDK for both runtimes: a sandboxed worker/window, and a `runtime: "node"`
|
|
5
|
+
* plugin, whose bootstrap installs the same `medeoPlugin` surface. The SDK itself
|
|
6
|
+
* imports nothing from Node and asserts no identity of its own. */
|
|
7
|
+
export type { Manifest, PluginCommand, Permission, CapabilityDescriptor } from './generated.ts';
|
|
8
|
+
/** The `api_version` this SDK targets; `spec/api-v1.json` carries the same number. */
|
|
9
|
+
export declare const API_VERSION = 1;
|
|
10
|
+
export interface PluginAPI {
|
|
11
|
+
onLocaleChanged(callback: (state: PluginLocaleState) => void): () => void;
|
|
12
|
+
onEvent(callback: (event: PlatformEvent) => void): () => void;
|
|
13
|
+
post(message: unknown): Promise<void>;
|
|
14
|
+
onMessage(callback: (message: unknown) => void): () => void;
|
|
15
|
+
invoke(method: MethodName, args?: Record<string, unknown>): Promise<unknown>;
|
|
16
|
+
run(command: string, args?: JsonValue): Promise<unknown>;
|
|
17
|
+
/** Medeo Launcher Protocol v1 (Medeo 0.1.33+): answer launcher requests; push views from a launcher-started command. */
|
|
18
|
+
onLauncher?(handler: (request: {
|
|
19
|
+
op: string;
|
|
20
|
+
payload: any;
|
|
21
|
+
}) => unknown): () => void;
|
|
22
|
+
launcher?(op: 'update' | 'prompt', session: string, view: unknown): Promise<unknown>;
|
|
23
|
+
/** Plugin windows (Medeo 0.1.43+): files dropped on the window as one-use import sources. */
|
|
24
|
+
dropped?(files: ArrayLike<File>): Promise<FileSource[]>;
|
|
25
|
+
}
|
|
26
|
+
declare global {
|
|
27
|
+
var medeoPlugin: PluginAPI;
|
|
28
|
+
interface Window {
|
|
29
|
+
medeoPlugin: PluginAPI;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/** Pushed by the Host: an operation changed status (or streamed progress), or a
|
|
33
|
+
* plugin-owned queue has entries to pull. Events carry no payload data. */
|
|
34
|
+
export type PlatformEvent = {
|
|
35
|
+
type: 'operation';
|
|
36
|
+
id: string;
|
|
37
|
+
method: string;
|
|
38
|
+
status: string;
|
|
39
|
+
revision?: number;
|
|
40
|
+
} | {
|
|
41
|
+
type: 'signal';
|
|
42
|
+
channel: 'files.watch' | 'server' | 'input_method' | 'background' | 'permissions' | 'config' | 'shortcuts' | 'tray' | 'launcher';
|
|
43
|
+
};
|
|
44
|
+
/** Messages between this plugin's background worker and its own windows
|
|
45
|
+
* (64 KiB each, JSON). A worker message reaches every open window; a window
|
|
46
|
+
* message reaches the worker. Nothing is persisted or sent elsewhere. */
|
|
47
|
+
export declare const channel: {
|
|
48
|
+
post: (message: unknown) => Promise<void>;
|
|
49
|
+
onMessage: <T = unknown>(callback: (message: T) => void) => () => void;
|
|
50
|
+
};
|
|
51
|
+
export declare const events: {
|
|
52
|
+
on: (callback: (event: PlatformEvent) => void) => () => void;
|
|
53
|
+
/** Call `pull` now and again whenever the channel signals new entries. A
|
|
54
|
+
* failed pull (e.g. a permission withdrawn meanwhile) waits for the next signal. */
|
|
55
|
+
onSignal(channel: Extract<PlatformEvent, {
|
|
56
|
+
type: "signal";
|
|
57
|
+
}>["channel"], pull: () => unknown): () => void;
|
|
58
|
+
};
|
|
59
|
+
export declare const storage: {
|
|
60
|
+
get: <T = unknown>(key: string) => Promise<T | null>;
|
|
61
|
+
remove: (key: string) => Promise<unknown>;
|
|
62
|
+
set: (key: string, value: unknown) => Promise<unknown>;
|
|
63
|
+
};
|
|
64
|
+
export declare const creation: {
|
|
65
|
+
open: () => Promise<unknown>;
|
|
66
|
+
};
|
|
67
|
+
export declare const commands: {
|
|
68
|
+
run: <T = unknown>(command: string, args?: JsonValue) => Promise<T>;
|
|
69
|
+
};
|
|
70
|
+
export interface Disposable {
|
|
71
|
+
dispose(): unknown;
|
|
72
|
+
}
|
|
73
|
+
/** Passed to `activate` (VS Code style), in both runtimes. */
|
|
74
|
+
export interface PluginContext {
|
|
75
|
+
/** Disposed, in reverse order, when the plugin stops. */
|
|
76
|
+
subscriptions: Disposable[];
|
|
77
|
+
/** Register a handler for each command the manifest declares; all must be registered when `activate` returns. */
|
|
78
|
+
commands: {
|
|
79
|
+
register(id: string, handler: (args?: JsonValue) => unknown | Promise<unknown>): Disposable;
|
|
80
|
+
};
|
|
81
|
+
/** `runtime: "node"` only: the installed, verified package directory (read-only). */
|
|
82
|
+
extensionPath?: string;
|
|
83
|
+
/** `runtime: "node"` only: a private writable directory that survives updates. */
|
|
84
|
+
storagePath?: string;
|
|
85
|
+
}
|
|
86
|
+
/** A plugin's background entry: export the result, e.g.
|
|
87
|
+
* `export const { activate, deactivate } = definePlugin({ activate(context) { … } })`. */
|
|
88
|
+
export interface PluginDefinition {
|
|
89
|
+
activate(context: PluginContext): unknown | Promise<unknown>;
|
|
90
|
+
deactivate?(): unknown | Promise<unknown>;
|
|
91
|
+
}
|
|
92
|
+
export declare function definePlugin(definition: PluginDefinition): Required<PluginDefinition>;
|
|
93
|
+
/** Settings declared under `contributes.configuration`; the user edits them in the plugin center. */
|
|
94
|
+
export declare const config: {
|
|
95
|
+
get: <T = unknown>(key: string) => Promise<T>;
|
|
96
|
+
all: () => Promise<Record<string, unknown>>;
|
|
97
|
+
set: (key: string, value: unknown) => Promise<unknown>;
|
|
98
|
+
/** Calls `listener` with all values after each change, from the user or the plugin. */
|
|
99
|
+
onDidChange(listener: (values: Record<string, unknown>) => void): () => void;
|
|
100
|
+
};
|
|
101
|
+
/** Native providers return quickly; subscribe to progress instead of holding a command open. */
|
|
102
|
+
export interface Provider {
|
|
103
|
+
id: string;
|
|
104
|
+
version: number;
|
|
105
|
+
available: boolean;
|
|
106
|
+
capabilities: string[];
|
|
107
|
+
}
|
|
108
|
+
/** `full`: the user approved full access (view and direct Trash) for this directory. */
|
|
109
|
+
export interface Resource {
|
|
110
|
+
id: string;
|
|
111
|
+
name: string;
|
|
112
|
+
available: boolean;
|
|
113
|
+
full?: boolean;
|
|
114
|
+
}
|
|
115
|
+
/** Ask for full access (requires the `file_full_access` permission). */
|
|
116
|
+
export interface DirectoryAccess {
|
|
117
|
+
full?: boolean;
|
|
118
|
+
}
|
|
119
|
+
export declare const providers: {
|
|
120
|
+
list: () => Promise<Provider[]>;
|
|
121
|
+
require: (id: string, version?: number) => Promise<Provider>;
|
|
122
|
+
};
|
|
123
|
+
export declare const resources: {
|
|
124
|
+
chooseDirectories: (access?: DirectoryAccess) => Promise<Resource[]>;
|
|
125
|
+
list: () => Promise<Resource[]>;
|
|
126
|
+
revoke: (id: string) => Promise<Resource[]>;
|
|
127
|
+
requestDirectory: (path: string, reason: string, access?: DirectoryAccess) => Promise<Resource[]>;
|
|
128
|
+
};
|
|
129
|
+
/** Medeo Drive (`drive_read`, `drive_manage`; macOS). The sync engine runs in Medeo's tray; no method returns a local path. */
|
|
130
|
+
export interface DriveState {
|
|
131
|
+
signedIn: boolean;
|
|
132
|
+
engine: 'ready' | 'connecting' | 'unavailable'; /** Changes whenever the account changes: drop folder ids kept from another generation. */
|
|
133
|
+
generation: number;
|
|
134
|
+
status: {
|
|
135
|
+
state: string;
|
|
136
|
+
paused: boolean;
|
|
137
|
+
totalFiles: number;
|
|
138
|
+
syncedFiles: number;
|
|
139
|
+
pendingFiles: number;
|
|
140
|
+
uploadingFiles: number;
|
|
141
|
+
errorFiles: number;
|
|
142
|
+
totalBytes: number;
|
|
143
|
+
syncedBytes: number;
|
|
144
|
+
} | null;
|
|
145
|
+
}
|
|
146
|
+
export interface DriveFolder {
|
|
147
|
+
id: string;
|
|
148
|
+
name: string;
|
|
149
|
+
state: 'pending' | 'scanning' | 'syncing' | 'synced' | 'paused' | 'error' | 'missing';
|
|
150
|
+
files: number;
|
|
151
|
+
bytes: number;
|
|
152
|
+
failed: number;
|
|
153
|
+
progress: number;
|
|
154
|
+
paused: boolean;
|
|
155
|
+
cloudOnly: boolean;
|
|
156
|
+
}
|
|
157
|
+
export interface DriveTransfers {
|
|
158
|
+
uploadBytesPerSec: number;
|
|
159
|
+
downloadBytesPerSec: number;
|
|
160
|
+
active: {
|
|
161
|
+
folder: string;
|
|
162
|
+
path: string;
|
|
163
|
+
transferred: number;
|
|
164
|
+
total: number;
|
|
165
|
+
direction: 'up' | 'down';
|
|
166
|
+
bytesPerSec: number;
|
|
167
|
+
}[];
|
|
168
|
+
recent: {
|
|
169
|
+
folder: string;
|
|
170
|
+
path: string;
|
|
171
|
+
finishedAt: number;
|
|
172
|
+
direction: 'up' | 'down';
|
|
173
|
+
}[];
|
|
174
|
+
}
|
|
175
|
+
export interface DriveFile {
|
|
176
|
+
folder: string;
|
|
177
|
+
path: string;
|
|
178
|
+
size: number;
|
|
179
|
+
status: string;
|
|
180
|
+
updatedAt: number;
|
|
181
|
+
}
|
|
182
|
+
export interface DriveFailure {
|
|
183
|
+
folder: string;
|
|
184
|
+
path: string;
|
|
185
|
+
reason: string;
|
|
186
|
+
}
|
|
187
|
+
export declare const drive: {
|
|
188
|
+
state: () => Promise<DriveState>;
|
|
189
|
+
folders: () => Promise<DriveFolder[]>;
|
|
190
|
+
transfers: () => Promise<DriveTransfers>;
|
|
191
|
+
/** Most recently synced files, newest first; `limit` 1–100 (default 20). */
|
|
192
|
+
recent: (limit?: number) => Promise<DriveFile[]>;
|
|
193
|
+
failed: () => Promise<DriveFailure[]>;
|
|
194
|
+
/** Sync state of up to 500 paths in a folder: `synced`, `pending`, `uploading`/`downloading` (with
|
|
195
|
+
* `progress` 0–1), `failed` (with `reason`), `cloud` (only in the cloud) or `unknown`. */
|
|
196
|
+
fileStates: (folder: string, paths: string[]) => Promise<Record<string, {
|
|
197
|
+
state: "synced" | "pending" | "uploading" | "downloading" | "failed" | "cloud" | "unknown";
|
|
198
|
+
progress?: number;
|
|
199
|
+
reason?: string;
|
|
200
|
+
}>>;
|
|
201
|
+
/** Download a cloud-only file to this computer (`drive_manage`); watch it with `fileStates`. */
|
|
202
|
+
download: (folder: string, path: string) => Promise<null>;
|
|
203
|
+
/** Re-queue a folder's failed files (`drive_manage`). */
|
|
204
|
+
retry: (folder: string) => Promise<null>;
|
|
205
|
+
/** From a plugin window, with `file_access` declared: Medeo asks the user (a named `folder`, or a picker
|
|
206
|
+
* opened at the drive) and grants that folder; read and write it with `files.*` (see `resources.list`). */
|
|
207
|
+
requestFolder: (reason: string, folder?: string) => Promise<Resource[]>;
|
|
208
|
+
};
|
|
209
|
+
/** Generic registered-provider entry point; the Host remains the authority. */
|
|
210
|
+
export declare const capabilities: {
|
|
211
|
+
list: () => Promise<import("./generated").CapabilityDescriptor[]>;
|
|
212
|
+
labels: () => Promise<Record<string, string>>;
|
|
213
|
+
invoke: <T = unknown>(method: string, args?: Record<string, unknown>) => Promise<T>;
|
|
214
|
+
};
|
|
215
|
+
export declare const clipboard: {
|
|
216
|
+
read: () => Promise<{
|
|
217
|
+
text: string;
|
|
218
|
+
}>;
|
|
219
|
+
write: (text: string) => Promise<unknown>;
|
|
220
|
+
};
|
|
221
|
+
/** `running` reports, per rule, whether a matching process exists; it never
|
|
222
|
+
* returns the process list. Rules match an exact executable name or a path fragment. */
|
|
223
|
+
export interface ProcessRule {
|
|
224
|
+
name?: string;
|
|
225
|
+
path_contains?: string;
|
|
226
|
+
}
|
|
227
|
+
export interface SystemInfo {
|
|
228
|
+
platform: string;
|
|
229
|
+
architecture: string;
|
|
230
|
+
release: string;
|
|
231
|
+
locale: string; /** The Medeo running the plugin (0.1.23+; absent on older Medeo). */
|
|
232
|
+
medeo?: {
|
|
233
|
+
version: string;
|
|
234
|
+
channel: 'stg' | 'prd';
|
|
235
|
+
};
|
|
236
|
+
displays: {
|
|
237
|
+
id: string;
|
|
238
|
+
bounds: {
|
|
239
|
+
x: number;
|
|
240
|
+
y: number;
|
|
241
|
+
width: number;
|
|
242
|
+
height: number;
|
|
243
|
+
};
|
|
244
|
+
scale: number;
|
|
245
|
+
}[];
|
|
246
|
+
}
|
|
247
|
+
export declare const system: {
|
|
248
|
+
info: () => Promise<SystemInfo>;
|
|
249
|
+
running: (rules: ProcessRule[]) => Promise<NativeOperation<boolean[]>>;
|
|
250
|
+
};
|
|
251
|
+
/** One outcome per path of `trash`, in the order given. */
|
|
252
|
+
export interface TrashResult {
|
|
253
|
+
path: string;
|
|
254
|
+
trashed: boolean;
|
|
255
|
+
error?: string;
|
|
256
|
+
}
|
|
257
|
+
/** `runtime: "node"` plugins only (the `node` permission): moves up to 256 absolute
|
|
258
|
+
* paths to the OS Trash, the one thing Node cannot do itself. A failure does not stop the rest. */
|
|
259
|
+
export declare const trash: (paths: string[]) => Promise<TrashResult[]>;
|
|
260
|
+
export declare const notifications: {
|
|
261
|
+
show: (id: string, title: string, body: string) => Promise<unknown>;
|
|
262
|
+
close: (id: string) => Promise<unknown>;
|
|
263
|
+
};
|
|
264
|
+
export declare const power: {
|
|
265
|
+
start: (type: "prevent-app-suspension" | "prevent-display-sleep") => Promise<{
|
|
266
|
+
id: string;
|
|
267
|
+
}>;
|
|
268
|
+
stop: (id: string) => Promise<unknown>;
|
|
269
|
+
state: () => Promise<unknown>;
|
|
270
|
+
};
|
|
271
|
+
export declare const shortcuts: {
|
|
272
|
+
list: () => Promise<{
|
|
273
|
+
id: string;
|
|
274
|
+
accelerator: string;
|
|
275
|
+
open_ui: boolean;
|
|
276
|
+
}[]>;
|
|
277
|
+
register: (id: string, accelerator: string, openUI?: boolean) => Promise<unknown>;
|
|
278
|
+
unregister: (id: string) => Promise<unknown>;
|
|
279
|
+
events: () => Promise<unknown>;
|
|
280
|
+
};
|
|
281
|
+
/** `panel: true` (macOS): a frameless window floating over every app and Space that does not
|
|
282
|
+
* activate Medeo — the app the user was in keeps focus — opened at the pointer and hidden (not
|
|
283
|
+
* closed) when it loses focus; opening it again moves it to the pointer. `hide` keeps a window
|
|
284
|
+
* and its page alive for the next `open`/`focus`.
|
|
285
|
+
* `overlay: true` (macOS, needs `window_management` too): a transparent, shadowless panel covering
|
|
286
|
+
* the whole display under the pointer (menu bar included), above full-screen apps — for previews
|
|
287
|
+
* and radial menus. It takes keyboard focus without activating Medeo, hides when it loses focus,
|
|
288
|
+
* and each `open` moves it to the pointer's display; `width`/`height` are ignored. The page's
|
|
289
|
+
* `window.screenX/screenY` is the display's top-left in the same global points as
|
|
290
|
+
* `windowManagement`. `panel` and `overlay` are exclusive. */
|
|
291
|
+
export declare const appWindows: {
|
|
292
|
+
open: (options: {
|
|
293
|
+
id: string;
|
|
294
|
+
entry: string;
|
|
295
|
+
title: string;
|
|
296
|
+
width: number;
|
|
297
|
+
height: number;
|
|
298
|
+
panel?: boolean;
|
|
299
|
+
overlay?: boolean;
|
|
300
|
+
}) => Promise<unknown>;
|
|
301
|
+
close: (id: string) => Promise<unknown>;
|
|
302
|
+
focus: (id: string) => Promise<unknown>;
|
|
303
|
+
hide: (id: string) => Promise<unknown>;
|
|
304
|
+
list: () => Promise<{
|
|
305
|
+
id: string;
|
|
306
|
+
title: string;
|
|
307
|
+
visible: boolean;
|
|
308
|
+
}[]>;
|
|
309
|
+
};
|
|
310
|
+
/** A menu entry, a checkmarked toggle, or a divider. */
|
|
311
|
+
export type TrayItem = {
|
|
312
|
+
id: string;
|
|
313
|
+
title: string;
|
|
314
|
+
checked?: boolean;
|
|
315
|
+
} | {
|
|
316
|
+
separator: true;
|
|
317
|
+
};
|
|
318
|
+
/** `icon`: a PNG in the package drawn as a menu-bar template (black + alpha, about 36 px tall);
|
|
319
|
+
* `click`: an id reported on a left click, which then leaves the menu to a right click. */
|
|
320
|
+
export interface TrayOptions {
|
|
321
|
+
icon?: string;
|
|
322
|
+
click?: string;
|
|
323
|
+
}
|
|
324
|
+
export declare const tray: {
|
|
325
|
+
set: (title: string, items: TrayItem[], options?: TrayOptions) => Promise<unknown>;
|
|
326
|
+
remove: () => Promise<unknown>;
|
|
327
|
+
events: () => Promise<unknown>;
|
|
328
|
+
};
|
|
329
|
+
export declare const external: {
|
|
330
|
+
open: (url: string) => Promise<unknown>;
|
|
331
|
+
};
|
|
332
|
+
/** `scope` says how long an approval lasts: `always` (stored), `run` (until the plugin stops),
|
|
333
|
+
* `never` (refused with "don't ask again"). `remembered`: refused earlier, no dialog was shown. */
|
|
334
|
+
export interface PermissionAnswer {
|
|
335
|
+
granted: boolean;
|
|
336
|
+
scope?: 'always' | 'run' | 'never' | 'none';
|
|
337
|
+
remembered?: boolean;
|
|
338
|
+
}
|
|
339
|
+
export declare const permissions: {
|
|
340
|
+
request: (permission: string, reason: string) => Promise<PermissionAnswer>;
|
|
341
|
+
};
|
|
342
|
+
/** One of the plugin's own actions for the user to approve (`approvals` permission; `action` must be declared).
|
|
343
|
+
* `rule_key` identifies it (`bash:git status`); `rule_pattern` (a prefix of it ending in `*`) is what
|
|
344
|
+
* "always" remembers instead. Medeo draws the dialog and keeps the rules. In a Node plugin nothing
|
|
345
|
+
* forces you to ask: it is up to the plugin to call this before acting. */
|
|
346
|
+
export interface ApprovalRequest {
|
|
347
|
+
action: string;
|
|
348
|
+
title: string;
|
|
349
|
+
detail?: string;
|
|
350
|
+
preview?: {
|
|
351
|
+
kind: 'text' | 'command' | 'diff';
|
|
352
|
+
text: string;
|
|
353
|
+
};
|
|
354
|
+
rule_key: string;
|
|
355
|
+
rule_pattern?: string;
|
|
356
|
+
}
|
|
357
|
+
/** `scope`: `once`, `run`, `always`, or `rule` when a remembered answer decided without a dialog. */
|
|
358
|
+
export interface ApprovalAnswer {
|
|
359
|
+
decision: 'allow' | 'deny';
|
|
360
|
+
scope: 'once' | 'run' | 'always' | 'rule';
|
|
361
|
+
rule?: string;
|
|
362
|
+
}
|
|
363
|
+
export interface ApprovalRule {
|
|
364
|
+
action: string;
|
|
365
|
+
pattern: string;
|
|
366
|
+
allow: boolean;
|
|
367
|
+
scope: 'run' | 'always';
|
|
368
|
+
}
|
|
369
|
+
export declare const approvals: {
|
|
370
|
+
request: (request: ApprovalRequest) => Promise<ApprovalAnswer>;
|
|
371
|
+
rules: () => Promise<ApprovalRule[]>;
|
|
372
|
+
forget: (action: string, pattern: string) => Promise<ApprovalRule[]>;
|
|
373
|
+
};
|
|
374
|
+
export interface AgentJob {
|
|
375
|
+
id: string;
|
|
376
|
+
status: 'running' | 'completed' | 'failed' | 'cancelled';
|
|
377
|
+
text?: string;
|
|
378
|
+
models?: string[];
|
|
379
|
+
error?: string | null;
|
|
380
|
+
}
|
|
381
|
+
export declare const agent: {
|
|
382
|
+
models: () => Promise<AgentJob>;
|
|
383
|
+
start: (messages: {
|
|
384
|
+
role: "system" | "user" | "assistant";
|
|
385
|
+
content: string;
|
|
386
|
+
}[], model?: string) => Promise<AgentJob>;
|
|
387
|
+
state: (id: string) => Promise<AgentJob>;
|
|
388
|
+
cancel: (id: string) => Promise<AgentJob>;
|
|
389
|
+
release: (id: string) => Promise<unknown>;
|
|
390
|
+
/** Calls `onText` as the reply streams in; resolves with the final job. */
|
|
391
|
+
follow(id: string, onText: (job: AgentJob) => void): Promise<AgentJob>;
|
|
392
|
+
};
|
|
393
|
+
export interface ApplicationEntry {
|
|
394
|
+
id: string;
|
|
395
|
+
title: string;
|
|
396
|
+
path: string;
|
|
397
|
+
bundle_id: string;
|
|
398
|
+
}
|
|
399
|
+
export interface ApplicationList {
|
|
400
|
+
status: string;
|
|
401
|
+
error: string | null;
|
|
402
|
+
incomplete: boolean;
|
|
403
|
+
total: number;
|
|
404
|
+
entries: ApplicationEntry[];
|
|
405
|
+
}
|
|
406
|
+
export interface ApplicationState {
|
|
407
|
+
status: string;
|
|
408
|
+
error: string | null;
|
|
409
|
+
launch: {
|
|
410
|
+
id: string;
|
|
411
|
+
status: string;
|
|
412
|
+
error: string | null;
|
|
413
|
+
pid?: number;
|
|
414
|
+
} | null;
|
|
415
|
+
}
|
|
416
|
+
export declare const applications: {
|
|
417
|
+
/** The whole inventory; plugins rank and filter it themselves. */
|
|
418
|
+
list: (refresh?: boolean) => Promise<ApplicationList>;
|
|
419
|
+
launch: (id: string) => Promise<{
|
|
420
|
+
id: string;
|
|
421
|
+
status: string;
|
|
422
|
+
}>;
|
|
423
|
+
state: () => Promise<ApplicationState>;
|
|
424
|
+
/** 64 px PNG `data:` URLs (≤ 24 ids per call; `null` when the app has none). Ids not drawn yet are
|
|
425
|
+
* left out and counted in `pending`; ask again shortly. Medeo 0.1.33+. */
|
|
426
|
+
icons: (ids: string[]) => Promise<{
|
|
427
|
+
icons: Record<string, string | null>;
|
|
428
|
+
pending: number;
|
|
429
|
+
}>;
|
|
430
|
+
};
|
|
431
|
+
export type LauncherDataType = 'text' | 'url' | 'file' | 'image' | 'application';
|
|
432
|
+
export type LauncherTone = 'default' | 'success' | 'warning' | 'danger' | 'info';
|
|
433
|
+
/** A symbol the launcher draws, an image in your package, a small `data:` URL, or a file whose icon Medeo shows. */
|
|
434
|
+
export type LauncherIcon = {
|
|
435
|
+
symbol: string;
|
|
436
|
+
} | {
|
|
437
|
+
path: string;
|
|
438
|
+
} | {
|
|
439
|
+
data: string;
|
|
440
|
+
} | {
|
|
441
|
+
file: string;
|
|
442
|
+
};
|
|
443
|
+
export interface LauncherAction {
|
|
444
|
+
id: string;
|
|
445
|
+
title: string;
|
|
446
|
+
shortcut?: string;
|
|
447
|
+
style?: 'default' | 'destructive';
|
|
448
|
+
}
|
|
449
|
+
export interface LauncherItem {
|
|
450
|
+
id: string;
|
|
451
|
+
title: string;
|
|
452
|
+
subtitle?: string;
|
|
453
|
+
icon?: LauncherIcon;
|
|
454
|
+
accessory?: {
|
|
455
|
+
text: string;
|
|
456
|
+
tone?: LauncherTone;
|
|
457
|
+
};
|
|
458
|
+
/** With `data`: what the row carries, so the user can send it to plugins that accept the type. */
|
|
459
|
+
type?: LauncherDataType;
|
|
460
|
+
data?: string;
|
|
461
|
+
keywords?: string[];
|
|
462
|
+
detail?: {
|
|
463
|
+
text?: string;
|
|
464
|
+
image?: LauncherIcon;
|
|
465
|
+
metadata?: {
|
|
466
|
+
label: string;
|
|
467
|
+
value: string;
|
|
468
|
+
}[];
|
|
469
|
+
};
|
|
470
|
+
/** The first is the primary action (↩); all appear under ⌘K. */
|
|
471
|
+
actions?: LauncherAction[];
|
|
472
|
+
}
|
|
473
|
+
export interface LauncherViewItem {
|
|
474
|
+
id?: string;
|
|
475
|
+
title: string;
|
|
476
|
+
subtitle?: string;
|
|
477
|
+
accessory?: {
|
|
478
|
+
text: string;
|
|
479
|
+
tone?: LauncherTone;
|
|
480
|
+
};
|
|
481
|
+
checked?: boolean;
|
|
482
|
+
state?: 'done' | 'running' | 'pending' | 'failed';
|
|
483
|
+
}
|
|
484
|
+
export type LauncherView = {
|
|
485
|
+
type: 'confirm';
|
|
486
|
+
title: string;
|
|
487
|
+
message?: string;
|
|
488
|
+
items?: LauncherViewItem[];
|
|
489
|
+
confirm?: string;
|
|
490
|
+
cancel?: string;
|
|
491
|
+
style?: 'default' | 'destructive';
|
|
492
|
+
} | {
|
|
493
|
+
type: 'progress';
|
|
494
|
+
title: string;
|
|
495
|
+
message?: string;
|
|
496
|
+
value?: number;
|
|
497
|
+
items?: LauncherViewItem[];
|
|
498
|
+
} | {
|
|
499
|
+
type: 'result';
|
|
500
|
+
tone?: 'success' | 'info' | 'warning' | 'error';
|
|
501
|
+
title: string;
|
|
502
|
+
message?: string;
|
|
503
|
+
items?: LauncherItem[];
|
|
504
|
+
} | {
|
|
505
|
+
type: 'list';
|
|
506
|
+
title?: string;
|
|
507
|
+
items: LauncherItem[];
|
|
508
|
+
};
|
|
509
|
+
export interface LauncherActionResult {
|
|
510
|
+
close?: boolean;
|
|
511
|
+
toast?: string;
|
|
512
|
+
view?: LauncherView;
|
|
513
|
+
refresh?: boolean;
|
|
514
|
+
}
|
|
515
|
+
/** Data another plugin sent to this command (`accepts` in the manifest); `source` is set by Medeo. */
|
|
516
|
+
/** A file or image another plugin sent: a one-use source for `files.import` (Medeo 0.1.45+); never a path you can open. */
|
|
517
|
+
export interface LauncherInputFile {
|
|
518
|
+
source: string;
|
|
519
|
+
name: string;
|
|
520
|
+
size: number;
|
|
521
|
+
}
|
|
522
|
+
export interface LauncherInput {
|
|
523
|
+
type: LauncherDataType;
|
|
524
|
+
value: string;
|
|
525
|
+
title?: string;
|
|
526
|
+
source: string;
|
|
527
|
+
file?: LauncherInputFile;
|
|
528
|
+
}
|
|
529
|
+
export interface LauncherProvider {
|
|
530
|
+
/** Results for `query` (≤ `limit`, at most 20). Answer within 1.5 s; slower providers are left out. */
|
|
531
|
+
search(query: string, context: {
|
|
532
|
+
scoped: boolean;
|
|
533
|
+
limit: number;
|
|
534
|
+
}): LauncherItem[] | Promise<LauncherItem[]>;
|
|
535
|
+
/** The user picked `action` on result `item` (ids you returned). Within 15 s. */
|
|
536
|
+
action?(item: string, action: string, context: {
|
|
537
|
+
query: string;
|
|
538
|
+
}): LauncherActionResult | void | Promise<LauncherActionResult | void>;
|
|
539
|
+
}
|
|
540
|
+
/** A command started from a launcher shows its progress there, and asks there. */
|
|
541
|
+
export interface LauncherSession {
|
|
542
|
+
readonly id: string;
|
|
543
|
+
show(view: LauncherView): Promise<void>;
|
|
544
|
+
progress(title: string, options?: {
|
|
545
|
+
message?: string;
|
|
546
|
+
value?: number;
|
|
547
|
+
items?: LauncherViewItem[];
|
|
548
|
+
}): Promise<void>;
|
|
549
|
+
/** Waits for the user (up to 10 minutes); unanswered or cancelled is `{confirmed:false}`. */
|
|
550
|
+
confirm(view: Omit<Extract<LauncherView, {
|
|
551
|
+
type: 'confirm';
|
|
552
|
+
}>, 'type'>): Promise<{
|
|
553
|
+
confirmed: boolean;
|
|
554
|
+
selected?: string[];
|
|
555
|
+
}>;
|
|
556
|
+
result(view: Omit<Extract<LauncherView, {
|
|
557
|
+
type: 'result';
|
|
558
|
+
}>, 'type'>): Promise<void>;
|
|
559
|
+
}
|
|
560
|
+
export interface LauncherSearchResults {
|
|
561
|
+
protocol: number;
|
|
562
|
+
results: {
|
|
563
|
+
plugin_id: string;
|
|
564
|
+
items: LauncherItem[];
|
|
565
|
+
error?: string;
|
|
566
|
+
}[];
|
|
567
|
+
}
|
|
568
|
+
export type LauncherEvent = {
|
|
569
|
+
type: 'view';
|
|
570
|
+
session: string;
|
|
571
|
+
plugin_id: string;
|
|
572
|
+
view: LauncherView;
|
|
573
|
+
} | {
|
|
574
|
+
type: 'prompt';
|
|
575
|
+
session: string;
|
|
576
|
+
plugin_id: string;
|
|
577
|
+
prompt: string;
|
|
578
|
+
view: LauncherView;
|
|
579
|
+
} | {
|
|
580
|
+
type: 'done';
|
|
581
|
+
session: string;
|
|
582
|
+
plugin_id: string;
|
|
583
|
+
ok: boolean;
|
|
584
|
+
error?: string;
|
|
585
|
+
};
|
|
586
|
+
export declare const launcher: {
|
|
587
|
+
/** Answer launcher searches and actions. Call it in `activate`; needs `contributes.launcher.provider`. */
|
|
588
|
+
provide(provider: LauncherProvider): Disposable;
|
|
589
|
+
/** The session of a command a launcher started, from the command's `args`; null otherwise. */
|
|
590
|
+
session(args: unknown): LauncherSession | null;
|
|
591
|
+
/** Data sent to this command from another plugin's result, if any. */
|
|
592
|
+
input(args: unknown): LauncherInput | null;
|
|
593
|
+
/** Every provider's results for `query`, or one plugin's with `scope`. */
|
|
594
|
+
search: (query: string, options?: {
|
|
595
|
+
scope?: string;
|
|
596
|
+
limit?: number;
|
|
597
|
+
}) => Promise<LauncherSearchResults>;
|
|
598
|
+
act: (pluginId: string, item: string, action: string, query?: string) => Promise<LauncherActionResult>;
|
|
599
|
+
/** Runs a command with a session: its views arrive as `launcher.events()` tagged with `session`. */
|
|
600
|
+
run: <T = unknown>(pluginId: string, command: string, args: JsonValue | undefined, session: string) => Promise<T>;
|
|
601
|
+
answer: (prompt: string, value: {
|
|
602
|
+
confirmed: boolean;
|
|
603
|
+
selected?: string[];
|
|
604
|
+
}) => Promise<null>;
|
|
605
|
+
/** Drain on the `launcher` signal: `events.onSignal('launcher', …)`. */
|
|
606
|
+
events: () => Promise<LauncherEvent[]>;
|
|
607
|
+
};
|
|
608
|
+
/** Another installed plugin, as `plugins.commands` reports it (`plugin_commands` permission). */
|
|
609
|
+
export interface LauncherArgumentInfo {
|
|
610
|
+
name: string;
|
|
611
|
+
type: 'enum' | 'string' | 'number' | 'boolean';
|
|
612
|
+
title: string;
|
|
613
|
+
placeholder: string | null;
|
|
614
|
+
optional: boolean;
|
|
615
|
+
options: {
|
|
616
|
+
value: string;
|
|
617
|
+
title: string;
|
|
618
|
+
subtitle: string | null;
|
|
619
|
+
icon: string | null;
|
|
620
|
+
keywords: string[];
|
|
621
|
+
}[];
|
|
622
|
+
}
|
|
623
|
+
export interface LauncherCommandInfo {
|
|
624
|
+
command: string;
|
|
625
|
+
title: string;
|
|
626
|
+
subtitle: string | null;
|
|
627
|
+
icon: string | null;
|
|
628
|
+
keywords: string[];
|
|
629
|
+
pinnable: boolean;
|
|
630
|
+
arguments: LauncherArgumentInfo[];
|
|
631
|
+
expand: string | null;
|
|
632
|
+
accepts: LauncherDataType[];
|
|
633
|
+
}
|
|
634
|
+
export interface InstalledPluginCommands {
|
|
635
|
+
id: string;
|
|
636
|
+
name: string;
|
|
637
|
+
description: string | null;
|
|
638
|
+
icon: string | null;
|
|
639
|
+
has_ui: boolean;
|
|
640
|
+
commands: {
|
|
641
|
+
id: string;
|
|
642
|
+
title: string;
|
|
643
|
+
}[];
|
|
644
|
+
/** Its `contributes.launcher`, localized, images as `data:` URLs. */
|
|
645
|
+
launcher: {
|
|
646
|
+
keyword: string | null;
|
|
647
|
+
provider: {
|
|
648
|
+
types?: LauncherDataType[];
|
|
649
|
+
scoped?: boolean;
|
|
650
|
+
} | null;
|
|
651
|
+
commands: LauncherCommandInfo[];
|
|
652
|
+
} | null;
|
|
653
|
+
}
|
|
654
|
+
/** For launchers: other plugins' commands, run as if the user picked them in the plugin center.
|
|
655
|
+
* Needs the sensitive `plugin_commands` permission and Medeo 0.1.33+. A command started this way
|
|
656
|
+
* cannot call `plugins.run` itself (`recursive_command`). */
|
|
657
|
+
export declare const plugins: {
|
|
658
|
+
commands: () => Promise<InstalledPluginCommands[]>;
|
|
659
|
+
run: <T = unknown>(pluginId: string, command: string, args?: JsonValue) => Promise<T>;
|
|
660
|
+
open: (pluginId: string) => Promise<null>;
|
|
661
|
+
/** Shows the plugin center on its Discover page, where the user installs more plugins. */
|
|
662
|
+
center: () => Promise<null>;
|
|
663
|
+
/** Ask the user to install an official plugin this one works with (from a click). Medeo shows its own
|
|
664
|
+
* install confirmation; `installed` when it is there now (already, or just installed / updated). */
|
|
665
|
+
suggestInstall: (pluginId: string) => Promise<{
|
|
666
|
+
state: "installed" | "cancelled" | "unavailable";
|
|
667
|
+
}>;
|
|
668
|
+
};
|
|
669
|
+
export interface CaptureSource {
|
|
670
|
+
id: string;
|
|
671
|
+
title: string;
|
|
672
|
+
width: number;
|
|
673
|
+
height: number;
|
|
674
|
+
}
|
|
675
|
+
export interface CaptureRecord {
|
|
676
|
+
id: string;
|
|
677
|
+
source_title: string;
|
|
678
|
+
status: string;
|
|
679
|
+
active: boolean;
|
|
680
|
+
can_stop: boolean;
|
|
681
|
+
can_recover: boolean;
|
|
682
|
+
error?: string | null;
|
|
683
|
+
playable: boolean;
|
|
684
|
+
duration_ms: number;
|
|
685
|
+
bytes: number;
|
|
686
|
+
microphone: boolean;
|
|
687
|
+
system_audio: boolean;
|
|
688
|
+
audio_tracks?: number;
|
|
689
|
+
}
|
|
690
|
+
export declare const capture: {
|
|
691
|
+
status: (refresh?: boolean) => Promise<{
|
|
692
|
+
status: string;
|
|
693
|
+
os: Record<string, string>;
|
|
694
|
+
}>;
|
|
695
|
+
sources: (refresh?: boolean, requestPermission?: boolean) => Promise<{
|
|
696
|
+
status: string;
|
|
697
|
+
error?: string;
|
|
698
|
+
os: Record<string, string>;
|
|
699
|
+
sources: CaptureSource[];
|
|
700
|
+
}>;
|
|
701
|
+
start: (source: string, options?: {
|
|
702
|
+
microphone?: boolean;
|
|
703
|
+
systemAudio?: boolean;
|
|
704
|
+
}) => Promise<{
|
|
705
|
+
id?: string;
|
|
706
|
+
cancelled?: boolean;
|
|
707
|
+
}>;
|
|
708
|
+
state: () => Promise<{
|
|
709
|
+
records: CaptureRecord[];
|
|
710
|
+
os: Record<string, string>;
|
|
711
|
+
}>;
|
|
712
|
+
stop: (id: string) => Promise<unknown>;
|
|
713
|
+
cancel: (id: string) => Promise<unknown>;
|
|
714
|
+
recover: (id: string) => Promise<unknown>;
|
|
715
|
+
open: (id: string, mode?: "play" | "reveal") => Promise<unknown>;
|
|
716
|
+
previewURL: (id: string) => string;
|
|
717
|
+
};
|
|
718
|
+
export interface InputMethodState {
|
|
719
|
+
enabled: boolean;
|
|
720
|
+
provider_ready: boolean;
|
|
721
|
+
configured_name: string;
|
|
722
|
+
occupied: boolean;
|
|
723
|
+
system_source: string;
|
|
724
|
+
}
|
|
725
|
+
export interface InputSourceState {
|
|
726
|
+
status: string;
|
|
727
|
+
state_key: string;
|
|
728
|
+
can_setup: boolean;
|
|
729
|
+
can_remove: boolean;
|
|
730
|
+
installed?: boolean;
|
|
731
|
+
registered?: boolean;
|
|
732
|
+
enabled?: boolean;
|
|
733
|
+
selected?: boolean;
|
|
734
|
+
update_available?: boolean;
|
|
735
|
+
error?: string;
|
|
736
|
+
last_operation?: {
|
|
737
|
+
id: string;
|
|
738
|
+
status: string;
|
|
739
|
+
error?: string;
|
|
740
|
+
};
|
|
741
|
+
task?: string;
|
|
742
|
+
}
|
|
743
|
+
export declare const inputMethod: {
|
|
744
|
+
system: (refresh?: boolean) => Promise<InputSourceState>;
|
|
745
|
+
setup: () => Promise<{
|
|
746
|
+
task?: string;
|
|
747
|
+
cancelled?: boolean;
|
|
748
|
+
}>;
|
|
749
|
+
remove: () => Promise<{
|
|
750
|
+
task?: string;
|
|
751
|
+
cancelled?: boolean;
|
|
752
|
+
}>;
|
|
753
|
+
settings: () => Promise<{
|
|
754
|
+
task: string;
|
|
755
|
+
}>;
|
|
756
|
+
status: () => Promise<InputMethodState>;
|
|
757
|
+
configure: (name: string) => Promise<unknown>;
|
|
758
|
+
enable: () => Promise<InputMethodState>;
|
|
759
|
+
disable: () => Promise<unknown>;
|
|
760
|
+
events: () => Promise<{
|
|
761
|
+
id: string;
|
|
762
|
+
text: string;
|
|
763
|
+
}[]>;
|
|
764
|
+
respond: (id: string, candidates: string[]) => Promise<unknown>;
|
|
765
|
+
};
|
|
766
|
+
/** HTTP uses only approved origins; no redirects, browser cookies, or Medeo credentials.
|
|
767
|
+
* Closing UI preserves jobs; disable/revoke cancels. Mutations are never replayed.
|
|
768
|
+
* Release completed results to return the per-instance memory quota.
|
|
769
|
+
*/
|
|
770
|
+
export interface NetworkRequest {
|
|
771
|
+
url: string;
|
|
772
|
+
method?: 'GET' | 'HEAD' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS';
|
|
773
|
+
headers?: Record<string, string>;
|
|
774
|
+
body?: string;
|
|
775
|
+
body_base64?: string;
|
|
776
|
+
timeout_ms?: number;
|
|
777
|
+
stream?: boolean;
|
|
778
|
+
}
|
|
779
|
+
export interface NetworkJob {
|
|
780
|
+
id: string;
|
|
781
|
+
status: 'running' | 'completed' | 'failed' | 'cancelled';
|
|
782
|
+
received?: number;
|
|
783
|
+
http_status?: number | null;
|
|
784
|
+
headers?: [string, string][];
|
|
785
|
+
error?: string | null;
|
|
786
|
+
stream?: boolean;
|
|
787
|
+
}
|
|
788
|
+
export interface NetworkChunk {
|
|
789
|
+
data_base64: string;
|
|
790
|
+
next_offset: number;
|
|
791
|
+
eof: boolean;
|
|
792
|
+
}
|
|
793
|
+
export interface NetworkOrigin {
|
|
794
|
+
origin: string;
|
|
795
|
+
declared: boolean;
|
|
796
|
+
allowed: boolean;
|
|
797
|
+
}
|
|
798
|
+
export interface NetworkServerEvent {
|
|
799
|
+
data: string;
|
|
800
|
+
event: string;
|
|
801
|
+
id: string;
|
|
802
|
+
retry?: number;
|
|
803
|
+
}
|
|
804
|
+
export declare const network: {
|
|
805
|
+
origins: () => Promise<NetworkOrigin[]>;
|
|
806
|
+
requestOrigin: (origin: string, reason: string) => Promise<{
|
|
807
|
+
origin: string;
|
|
808
|
+
granted: boolean;
|
|
809
|
+
}>;
|
|
810
|
+
revokeOrigin: (origin: string) => Promise<NetworkOrigin[]>;
|
|
811
|
+
request: (request: NetworkRequest) => Promise<NetworkJob>;
|
|
812
|
+
state: (id: string) => Promise<NetworkJob>;
|
|
813
|
+
read: (id: string, offset?: number, length?: number) => Promise<NetworkChunk>;
|
|
814
|
+
cancel: (id: string) => Promise<NetworkJob>;
|
|
815
|
+
release: (id: string) => Promise<{
|
|
816
|
+
released: boolean;
|
|
817
|
+
}>;
|
|
818
|
+
/** Resolves once the response has fully arrived; the job stays readable until released. */
|
|
819
|
+
settled(id: string): Promise<NetworkJob>;
|
|
820
|
+
/** Single consumer for a stream:true job. Break/throw/abort cancels and releases it. */
|
|
821
|
+
bytes(id: string, signal?: AbortSignal): AsyncGenerator<Uint8Array>;
|
|
822
|
+
/** Incremental UTF-8 decoder, including code points split across HTTP chunks. */
|
|
823
|
+
textStream(id: string, signal?: AbortSignal): AsyncGenerator<string>;
|
|
824
|
+
/** SSE framing only: no automatic reconnect/retry or Last-Event-ID requests. */
|
|
825
|
+
sse(id: string, signal?: AbortSignal): AsyncGenerator<NetworkServerEvent>;
|
|
826
|
+
/** Explicitly dispose a stream that was never iterated (or has another owner). */
|
|
827
|
+
dispose(id: string): Promise<void>;
|
|
828
|
+
text(id: string): Promise<string>;
|
|
829
|
+
};
|
|
830
|
+
/** Workspace operations use current directory references and asynchronous jobs. */
|
|
831
|
+
export interface FileRoot {
|
|
832
|
+
id: string | null;
|
|
833
|
+
name: string;
|
|
834
|
+
available: boolean;
|
|
835
|
+
error?: string;
|
|
836
|
+
}
|
|
837
|
+
export interface FileEntry {
|
|
838
|
+
path: string;
|
|
839
|
+
name: string;
|
|
840
|
+
kind: 'file' | 'directory' | 'blocked';
|
|
841
|
+
size: number;
|
|
842
|
+
revision: string;
|
|
843
|
+
accessible: boolean;
|
|
844
|
+
}
|
|
845
|
+
export interface FileRecord {
|
|
846
|
+
id: string;
|
|
847
|
+
operation: string;
|
|
848
|
+
source: string;
|
|
849
|
+
destination: string;
|
|
850
|
+
status: string;
|
|
851
|
+
has_original: boolean;
|
|
852
|
+
in_trash?: boolean | null;
|
|
853
|
+
created_ms: number | null;
|
|
854
|
+
retention: "workspace" | "trash" | "none" | "unknown";
|
|
855
|
+
}
|
|
856
|
+
export interface FileJob<T = unknown> {
|
|
857
|
+
id: string;
|
|
858
|
+
status: 'running' | 'completed' | 'failed' | 'cancelled';
|
|
859
|
+
result: T | null;
|
|
860
|
+
error: string | null;
|
|
861
|
+
method?: string;
|
|
862
|
+
}
|
|
863
|
+
export interface FileWatch {
|
|
864
|
+
id: string;
|
|
865
|
+
status: 'starting' | 'watching' | 'stopped' | 'failed';
|
|
866
|
+
cursor?: number;
|
|
867
|
+
error?: string | null;
|
|
868
|
+
}
|
|
869
|
+
export interface FileWatchEvents extends FileWatch {
|
|
870
|
+
cursor: number;
|
|
871
|
+
rescan_required: boolean;
|
|
872
|
+
events: {
|
|
873
|
+
cursor: number;
|
|
874
|
+
kind: 'ready' | 'created' | 'changed' | 'removed' | 'rescan_required';
|
|
875
|
+
path: string | null;
|
|
876
|
+
}[];
|
|
877
|
+
}
|
|
878
|
+
export interface FilePreview {
|
|
879
|
+
id: string;
|
|
880
|
+
path: string;
|
|
881
|
+
bytes: number;
|
|
882
|
+
count: number;
|
|
883
|
+
revision: string | null;
|
|
884
|
+
purpose: string;
|
|
885
|
+
record: string | null;
|
|
886
|
+
}
|
|
887
|
+
export interface FileHistoryPage {
|
|
888
|
+
items: FileRecord[];
|
|
889
|
+
next_cursor: string | null;
|
|
890
|
+
total: number;
|
|
891
|
+
}
|
|
892
|
+
/** A file the user handed the plugin (picker or drop): import it once with `files.import`. No path. */
|
|
893
|
+
export interface FileSource {
|
|
894
|
+
source?: string;
|
|
895
|
+
name: string | null;
|
|
896
|
+
size?: number;
|
|
897
|
+
error?: string;
|
|
898
|
+
}
|
|
899
|
+
/** `files.import` while it runs: `progress` appears on `files.state`. */
|
|
900
|
+
export interface FileImportJob extends FileJob<FileEntry> {
|
|
901
|
+
progress?: {
|
|
902
|
+
done: number;
|
|
903
|
+
total: number;
|
|
904
|
+
};
|
|
905
|
+
}
|
|
906
|
+
export declare const files: {
|
|
907
|
+
backupPreview: (root: string, record: string) => Promise<FileJob<FilePreview>>;
|
|
908
|
+
archiveBackup: (preview: string) => Promise<FileJob<FileRecord>>;
|
|
909
|
+
forgetPreview: (root: string, record: string) => Promise<FileJob<FilePreview>>;
|
|
910
|
+
forgetRecord: (preview: string) => Promise<FileJob<{
|
|
911
|
+
forgotten: string;
|
|
912
|
+
}>>;
|
|
913
|
+
historyPage: (root: string, cursor?: string, limit?: number) => Promise<FileJob<FileHistoryPage>>;
|
|
914
|
+
trashPreview: (root: string, path: string) => Promise<FileJob<FilePreview>>;
|
|
915
|
+
discardPreview: (preview: string) => Promise<{
|
|
916
|
+
discarded: boolean;
|
|
917
|
+
}>;
|
|
918
|
+
trash: (preview: string) => Promise<FileJob<FileRecord>>;
|
|
919
|
+
/** Breadth-first listings of a whole tree in one call. Hidden and `skip`
|
|
920
|
+
* directories are listed by their parent but not entered. */
|
|
921
|
+
listTree: (root: string, path?: string, options?: {
|
|
922
|
+
depth?: number;
|
|
923
|
+
skip?: string[];
|
|
924
|
+
hidden?: boolean;
|
|
925
|
+
limit?: number;
|
|
926
|
+
}) => Promise<FileJob<{
|
|
927
|
+
directories: {
|
|
928
|
+
path: string;
|
|
929
|
+
entries?: FileEntry[];
|
|
930
|
+
error?: string;
|
|
931
|
+
}[];
|
|
932
|
+
truncated: boolean;
|
|
933
|
+
}>>;
|
|
934
|
+
/** Full-access roots only: move entries to the Trash without a Host confirmation.
|
|
935
|
+
* `stamp` is what `files.measure` returned; a changed entry is refused, not moved. */
|
|
936
|
+
trashDirect: (items: {
|
|
937
|
+
root: string;
|
|
938
|
+
path: string;
|
|
939
|
+
stamp: {
|
|
940
|
+
revision: string;
|
|
941
|
+
digest: string;
|
|
942
|
+
bytes: number;
|
|
943
|
+
count: number;
|
|
944
|
+
};
|
|
945
|
+
}[]) => Promise<FileJob<{
|
|
946
|
+
path: string;
|
|
947
|
+
record?: FileRecord;
|
|
948
|
+
error?: string;
|
|
949
|
+
}[]>>;
|
|
950
|
+
watch: (root: string, path?: string, recursive?: boolean) => Promise<FileWatch>;
|
|
951
|
+
watches: () => Promise<FileWatch[]>;
|
|
952
|
+
events: (id: string, after?: number) => Promise<FileWatchEvents>;
|
|
953
|
+
unwatch: (id: string) => Promise<{
|
|
954
|
+
stopped: boolean;
|
|
955
|
+
}>;
|
|
956
|
+
roots: () => Promise<FileJob<FileRoot[]>>;
|
|
957
|
+
list: (root: string, path?: string) => Promise<FileJob<FileEntry[]>>;
|
|
958
|
+
stat: (root: string, path?: string) => Promise<FileJob<FileEntry>>;
|
|
959
|
+
readText: (root: string, path: string, revision?: string) => Promise<FileJob<{
|
|
960
|
+
text: string;
|
|
961
|
+
entry: FileEntry;
|
|
962
|
+
}>>;
|
|
963
|
+
writeText: (root: string, path: string, text: string, revision: string) => Promise<FileJob<{
|
|
964
|
+
record: FileRecord;
|
|
965
|
+
entry: FileEntry | null;
|
|
966
|
+
}>>;
|
|
967
|
+
mkdir: (root: string, path: string) => Promise<FileJob<FileEntry>>;
|
|
968
|
+
move: (root: string, path: string, destination: string, revision: string) => Promise<FileJob<FileRecord>>;
|
|
969
|
+
history: (root: string) => Promise<FileJob<FileRecord[]>>;
|
|
970
|
+
restore: (root: string, record: string) => Promise<FileJob<FileRecord>>;
|
|
971
|
+
/** From a plugin window: the system picker; the chosen files become one-use sources. */
|
|
972
|
+
chooseFiles: () => Promise<FileSource[]>;
|
|
973
|
+
/** Files dropped on this window (`event.dataTransfer.files` in a `drop` handler) as one-use sources. */
|
|
974
|
+
fromDrop: (files: ArrayLike<File>) => Promise<FileSource[]>;
|
|
975
|
+
/** Copy a source to `path` in `root`; a taken name is `file_exists`, or `name (2).ext` with `keepBoth`. */
|
|
976
|
+
import: (root: string, path: string, source: string, options?: {
|
|
977
|
+
keepBoth?: boolean;
|
|
978
|
+
}) => Promise<FileImportJob>;
|
|
979
|
+
/** From a plugin window: copies to where the user picks (save panel for one file, a folder for several). */
|
|
980
|
+
export: (root: string, paths: string[]) => Promise<{
|
|
981
|
+
exported: {
|
|
982
|
+
name: string;
|
|
983
|
+
as: string;
|
|
984
|
+
}[];
|
|
985
|
+
folder: string | null;
|
|
986
|
+
}>;
|
|
987
|
+
/** From a plugin window: open with the default app / show in Finder. */
|
|
988
|
+
open: (root: string, path: string) => Promise<null>;
|
|
989
|
+
reveal: (root: string, path: string) => Promise<null>;
|
|
990
|
+
/** Call in a `dragstart` handler (after `event.preventDefault()`): the system drags these files out. */
|
|
991
|
+
startDrag: (root: string, paths: string[]) => Promise<null>;
|
|
992
|
+
state: <T = unknown>(id: string) => Promise<FileJob<T>>;
|
|
993
|
+
cancel: (id: string) => Promise<unknown>;
|
|
994
|
+
release: (id: string) => Promise<unknown>;
|
|
995
|
+
result: <T>(job: FileJob<T>) => Promise<T>;
|
|
996
|
+
};
|
|
997
|
+
/** Plugin-owned credentials. Values are returned only to this granted plugin;
|
|
998
|
+
* Agent/Medeo credentials are never part of this vault. No automatic retry. */
|
|
999
|
+
export interface SecretOperation {
|
|
1000
|
+
id: string;
|
|
1001
|
+
status: 'running' | 'completed' | 'failed';
|
|
1002
|
+
value?: string | null;
|
|
1003
|
+
error?: string;
|
|
1004
|
+
}
|
|
1005
|
+
export declare const secrets: {
|
|
1006
|
+
get: (key: string) => Promise<string | null>;
|
|
1007
|
+
set: (key: string, value: string) => Promise<void>;
|
|
1008
|
+
remove: (key: string) => Promise<void>;
|
|
1009
|
+
};
|
|
1010
|
+
export interface LocalServerOptions {
|
|
1011
|
+
port?: number;
|
|
1012
|
+
routes: {
|
|
1013
|
+
method: 'GET' | 'HEAD' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
1014
|
+
path: string;
|
|
1015
|
+
}[];
|
|
1016
|
+
origins?: string[];
|
|
1017
|
+
timeout_ms?: number;
|
|
1018
|
+
}
|
|
1019
|
+
export interface LocalServerState {
|
|
1020
|
+
id: string;
|
|
1021
|
+
status: 'starting' | 'running' | 'stopping' | 'stopped' | 'failed';
|
|
1022
|
+
origin: string | null;
|
|
1023
|
+
error: string | null;
|
|
1024
|
+
pending: number;
|
|
1025
|
+
accepted: number;
|
|
1026
|
+
}
|
|
1027
|
+
export interface LocalRequest {
|
|
1028
|
+
id: string;
|
|
1029
|
+
method: string;
|
|
1030
|
+
path: string;
|
|
1031
|
+
query: string;
|
|
1032
|
+
headers: Record<string, string>;
|
|
1033
|
+
body_base64: string;
|
|
1034
|
+
}
|
|
1035
|
+
/** A loopback server is instance-owned and never survives Host restart. Keep the
|
|
1036
|
+
* start token in private memory and serve requests in a worker for background use. */
|
|
1037
|
+
export declare const server: {
|
|
1038
|
+
start: (options: LocalServerOptions) => Promise<{
|
|
1039
|
+
id: string;
|
|
1040
|
+
status: "starting";
|
|
1041
|
+
access_token: string;
|
|
1042
|
+
}>;
|
|
1043
|
+
state: (id: string) => Promise<LocalServerState>;
|
|
1044
|
+
list: () => Promise<LocalServerState[]>;
|
|
1045
|
+
events: (id: string, limit?: number) => Promise<{
|
|
1046
|
+
requests: LocalRequest[];
|
|
1047
|
+
}>;
|
|
1048
|
+
respond: (id: string, request: string, response: {
|
|
1049
|
+
status?: number;
|
|
1050
|
+
body_base64?: string;
|
|
1051
|
+
content_type?: string;
|
|
1052
|
+
}) => Promise<{
|
|
1053
|
+
responded: boolean;
|
|
1054
|
+
}>;
|
|
1055
|
+
stop: (id: string) => Promise<LocalServerState>;
|
|
1056
|
+
};
|
|
1057
|
+
export interface PluginLocaleState {
|
|
1058
|
+
preference: string;
|
|
1059
|
+
locale: string;
|
|
1060
|
+
system_locale: string;
|
|
1061
|
+
direction: 'ltr';
|
|
1062
|
+
supported_locales: string[];
|
|
1063
|
+
catalog_locales: string[];
|
|
1064
|
+
catalog_locale: string | null;
|
|
1065
|
+
fallback_locale: string | null;
|
|
1066
|
+
name: string;
|
|
1067
|
+
commands: Record<string, string>;
|
|
1068
|
+
}
|
|
1069
|
+
/** Text is formatted in Rust from the signed package. Render with textContent,
|
|
1070
|
+
* never innerHTML. Register listeners before initial state fetch to avoid races. */
|
|
1071
|
+
export declare const i18n: {
|
|
1072
|
+
state: () => Promise<PluginLocaleState>;
|
|
1073
|
+
setLocale: (preference: string) => Promise<PluginLocaleState>;
|
|
1074
|
+
t: (key: string, params?: Record<string, string | number>) => Promise<string>;
|
|
1075
|
+
/** Every message of the effective locale (default-locale fallback merged in). */
|
|
1076
|
+
catalog: () => Promise<Record<string, string>>;
|
|
1077
|
+
onDidChangeLocale: (callback: (state: PluginLocaleState) => void) => () => void;
|
|
1078
|
+
};
|
|
1079
|
+
/** Every asynchronous call returns an owned operation handle. Status changes
|
|
1080
|
+
* are pushed; `wait` resolves on them and releases the result. */
|
|
1081
|
+
export interface NativeOperation<T = unknown> {
|
|
1082
|
+
id: string;
|
|
1083
|
+
status: 'running' | 'completed' | 'failed' | 'cancelled' | 'interrupted';
|
|
1084
|
+
result: T | null;
|
|
1085
|
+
error: string | null;
|
|
1086
|
+
}
|
|
1087
|
+
export declare const operations: {
|
|
1088
|
+
state: <T = unknown>(id: string) => Promise<NativeOperation<T>>;
|
|
1089
|
+
list: () => Promise<{
|
|
1090
|
+
id: string;
|
|
1091
|
+
method: string;
|
|
1092
|
+
status: string;
|
|
1093
|
+
}[]>;
|
|
1094
|
+
cancel: (id: string) => Promise<unknown>;
|
|
1095
|
+
release: (id: string) => Promise<unknown>;
|
|
1096
|
+
wait<T>(operation: {
|
|
1097
|
+
id: string;
|
|
1098
|
+
status: string;
|
|
1099
|
+
}, signal?: AbortSignal): Promise<T>;
|
|
1100
|
+
};
|
|
1101
|
+
/** A camera / microphone / system audio recording. `waveform` (240 peaks, 0…1) is in `state(id)` once
|
|
1102
|
+
* completed; listings carry a 40-point `waveform_preview` instead. Live fields exist only while recording:
|
|
1103
|
+
* `levels` holds the latest input levels (0…1, about 20 a second) and `levels_seq` counts every level so far;
|
|
1104
|
+
* `frame` is the camera's latest preview as base64 JPEG. "completed" means `previewURL` can play it. */
|
|
1105
|
+
export interface MediaRecord {
|
|
1106
|
+
id: string;
|
|
1107
|
+
kind: 'camera' | 'microphone' | 'system_audio';
|
|
1108
|
+
status: 'starting' | 'recording' | 'stopping' | 'completed' | 'failed' | 'interrupted';
|
|
1109
|
+
error?: string | null;
|
|
1110
|
+
created_ms: number;
|
|
1111
|
+
extension: string;
|
|
1112
|
+
duration_ms?: number;
|
|
1113
|
+
bytes?: number;
|
|
1114
|
+
waveform?: number[];
|
|
1115
|
+
waveform_preview?: number[];
|
|
1116
|
+
elapsed_ms?: number;
|
|
1117
|
+
level?: number;
|
|
1118
|
+
peak?: number;
|
|
1119
|
+
levels?: number[];
|
|
1120
|
+
levels_seq?: number;
|
|
1121
|
+
frame?: string;
|
|
1122
|
+
}
|
|
1123
|
+
export declare const camera: {
|
|
1124
|
+
status: () => Promise<NativeOperation<{
|
|
1125
|
+
authorization: string;
|
|
1126
|
+
}>>;
|
|
1127
|
+
start: (maxSeconds?: number) => Promise<NativeOperation<{
|
|
1128
|
+
id: string;
|
|
1129
|
+
status: string;
|
|
1130
|
+
}>>;
|
|
1131
|
+
stop: (id: string) => Promise<NativeOperation<unknown>>;
|
|
1132
|
+
state: (id?: string) => Promise<NativeOperation<unknown>>;
|
|
1133
|
+
read: (id: string, offset?: number, length?: number) => Promise<NativeOperation<NetworkChunk>>;
|
|
1134
|
+
/** Same-origin URL for an `<audio>` / `<video>` element; plays once the record is "completed". */
|
|
1135
|
+
previewURL: (record: Pick<MediaRecord, "id" | "extension">) => string;
|
|
1136
|
+
}, microphone: {
|
|
1137
|
+
status: () => Promise<NativeOperation<{
|
|
1138
|
+
authorization: string;
|
|
1139
|
+
}>>;
|
|
1140
|
+
start: (maxSeconds?: number) => Promise<NativeOperation<{
|
|
1141
|
+
id: string;
|
|
1142
|
+
status: string;
|
|
1143
|
+
}>>;
|
|
1144
|
+
stop: (id: string) => Promise<NativeOperation<unknown>>;
|
|
1145
|
+
state: (id?: string) => Promise<NativeOperation<unknown>>;
|
|
1146
|
+
read: (id: string, offset?: number, length?: number) => Promise<NativeOperation<NetworkChunk>>;
|
|
1147
|
+
/** Same-origin URL for an `<audio>` / `<video>` element; plays once the record is "completed". */
|
|
1148
|
+
previewURL: (record: Pick<MediaRecord, "id" | "extension">) => string;
|
|
1149
|
+
}, systemAudio: {
|
|
1150
|
+
status: () => Promise<NativeOperation<{
|
|
1151
|
+
authorization: string;
|
|
1152
|
+
}>>;
|
|
1153
|
+
start: (maxSeconds?: number) => Promise<NativeOperation<{
|
|
1154
|
+
id: string;
|
|
1155
|
+
status: string;
|
|
1156
|
+
}>>;
|
|
1157
|
+
stop: (id: string) => Promise<NativeOperation<unknown>>;
|
|
1158
|
+
state: (id?: string) => Promise<NativeOperation<unknown>>;
|
|
1159
|
+
read: (id: string, offset?: number, length?: number) => Promise<NativeOperation<NetworkChunk>>;
|
|
1160
|
+
/** Same-origin URL for an `<audio>` / `<video>` element; plays once the record is "completed". */
|
|
1161
|
+
previewURL: (record: Pick<MediaRecord, "id" | "extension">) => string;
|
|
1162
|
+
};
|
|
1163
|
+
export declare const accessibility: {
|
|
1164
|
+
status: () => Promise<NativeOperation<unknown>>;
|
|
1165
|
+
request: () => Promise<NativeOperation<unknown>>;
|
|
1166
|
+
windows: () => Promise<NativeOperation<{
|
|
1167
|
+
id: string;
|
|
1168
|
+
title: string;
|
|
1169
|
+
application: string;
|
|
1170
|
+
}[]>>;
|
|
1171
|
+
focus: (id: string) => Promise<NativeOperation<unknown>>;
|
|
1172
|
+
selectedText: (id: string) => Promise<NativeOperation<{
|
|
1173
|
+
id: string;
|
|
1174
|
+
text: string;
|
|
1175
|
+
}>>;
|
|
1176
|
+
insertText: (focus: string, text: string) => Promise<NativeOperation<unknown>>;
|
|
1177
|
+
};
|
|
1178
|
+
/** A rectangle in global points: origin at the top-left of the main display, y grows downwards
|
|
1179
|
+
* (displays left of or above the main one have negative coordinates). */
|
|
1180
|
+
export interface WindowFrame {
|
|
1181
|
+
x: number;
|
|
1182
|
+
y: number;
|
|
1183
|
+
width: number;
|
|
1184
|
+
height: number;
|
|
1185
|
+
}
|
|
1186
|
+
/** The frontmost window of another app. `id` stays the same for the same window while it lives. */
|
|
1187
|
+
export interface ManagedWindow {
|
|
1188
|
+
id: string;
|
|
1189
|
+
title: string;
|
|
1190
|
+
application: string;
|
|
1191
|
+
bundle_id: string;
|
|
1192
|
+
frame: WindowFrame;
|
|
1193
|
+
resizable: boolean;
|
|
1194
|
+
fullscreen: boolean;
|
|
1195
|
+
minimized: boolean;
|
|
1196
|
+
standard: boolean;
|
|
1197
|
+
}
|
|
1198
|
+
/** `visible_frame` excludes the menu bar and the Dock. `id` is the display number for this session,
|
|
1199
|
+
* `uuid` survives restarts and reconnecting. The first entry is the main display. */
|
|
1200
|
+
export interface ManagedScreen {
|
|
1201
|
+
id: string;
|
|
1202
|
+
uuid: string;
|
|
1203
|
+
name: string;
|
|
1204
|
+
primary: boolean;
|
|
1205
|
+
scale: number;
|
|
1206
|
+
frame: WindowFrame;
|
|
1207
|
+
visible_frame: WindowFrame;
|
|
1208
|
+
}
|
|
1209
|
+
/** Window management (macOS, permission `window_management`, OS Accessibility). All calls are
|
|
1210
|
+
* operations: `operations.wait(await windowManagement.focused())`. `request` opens the system
|
|
1211
|
+
* prompt and is window-only; the others work in the worker too. `focused` never returns a Medeo window:
|
|
1212
|
+
* when Medeo is in front (a plugin's own page) it is the window of the app right behind it, and `null`
|
|
1213
|
+
* when there is none or the frontmost app has no window; `set_frame` reports the frame the app
|
|
1214
|
+
* actually accepted (apps may clamp sizes) and fails with `resource_missing` once the window is gone. */
|
|
1215
|
+
export declare const windowManagement: {
|
|
1216
|
+
status: () => Promise<NativeOperation<{
|
|
1217
|
+
authorization: "granted" | "denied";
|
|
1218
|
+
}>>;
|
|
1219
|
+
request: () => Promise<NativeOperation<{
|
|
1220
|
+
authorization: "granted" | "denied";
|
|
1221
|
+
}>>;
|
|
1222
|
+
focused: () => Promise<NativeOperation<ManagedWindow | null>>;
|
|
1223
|
+
setFrame: (id: string, frame: WindowFrame) => Promise<NativeOperation<{
|
|
1224
|
+
frame: WindowFrame;
|
|
1225
|
+
resized: boolean;
|
|
1226
|
+
}>>;
|
|
1227
|
+
screens: () => Promise<NativeOperation<ManagedScreen[]>>;
|
|
1228
|
+
pointer: () => Promise<NativeOperation<{
|
|
1229
|
+
x: number;
|
|
1230
|
+
y: number;
|
|
1231
|
+
}>>;
|
|
1232
|
+
};
|
|
1233
|
+
export declare const browserView: {
|
|
1234
|
+
open: (id: string, url: string, width?: number, height?: number) => Promise<unknown>;
|
|
1235
|
+
state: (id: string) => Promise<unknown>;
|
|
1236
|
+
close: (id: string) => Promise<unknown>;
|
|
1237
|
+
};
|
|
1238
|
+
export declare const printing: {
|
|
1239
|
+
print: (text: string) => Promise<unknown>;
|
|
1240
|
+
};
|
|
1241
|
+
export declare const processes: {
|
|
1242
|
+
start: (executable: string, args?: string[], timeoutMs?: number) => Promise<NativeOperation<{
|
|
1243
|
+
id: string;
|
|
1244
|
+
status: string;
|
|
1245
|
+
}>>;
|
|
1246
|
+
state: (id: string) => Promise<NativeOperation<{
|
|
1247
|
+
status: string;
|
|
1248
|
+
exit_code: number | null;
|
|
1249
|
+
stdout: string;
|
|
1250
|
+
stderr: string;
|
|
1251
|
+
truncated: boolean;
|
|
1252
|
+
}>>;
|
|
1253
|
+
write: (id: string, text: string) => Promise<NativeOperation<{
|
|
1254
|
+
written: number;
|
|
1255
|
+
}>>;
|
|
1256
|
+
stop: (id: string) => Promise<NativeOperation<unknown>>;
|
|
1257
|
+
};
|
|
1258
|
+
export interface BackgroundEvent {
|
|
1259
|
+
id: string;
|
|
1260
|
+
schedule: string;
|
|
1261
|
+
due_ms: number;
|
|
1262
|
+
payload: JsonValue;
|
|
1263
|
+
}
|
|
1264
|
+
export declare const background: {
|
|
1265
|
+
schedule: (id: string, delayMs: number, payload?: JsonValue, intervalMs?: number) => Promise<unknown>;
|
|
1266
|
+
list: () => Promise<unknown>;
|
|
1267
|
+
cancel: (id: string) => Promise<unknown>;
|
|
1268
|
+
events: () => Promise<BackgroundEvent[]>;
|
|
1269
|
+
};
|
|
1270
|
+
export declare const contacts: {
|
|
1271
|
+
status: () => Promise<NativeOperation<unknown>>;
|
|
1272
|
+
request: () => Promise<NativeOperation<unknown>>;
|
|
1273
|
+
list: (query?: string, limit?: number) => Promise<NativeOperation<unknown>>;
|
|
1274
|
+
save: (contact: {
|
|
1275
|
+
given_name: string;
|
|
1276
|
+
family_name: string;
|
|
1277
|
+
email: string;
|
|
1278
|
+
phone: string;
|
|
1279
|
+
}) => Promise<NativeOperation<{
|
|
1280
|
+
id: string;
|
|
1281
|
+
created: boolean;
|
|
1282
|
+
}>>;
|
|
1283
|
+
};
|
|
1284
|
+
export declare const calendar: {
|
|
1285
|
+
status: () => Promise<NativeOperation<unknown>>;
|
|
1286
|
+
request: () => Promise<NativeOperation<unknown>>;
|
|
1287
|
+
list: (startMs: number, endMs: number, limit?: number) => Promise<NativeOperation<unknown>>;
|
|
1288
|
+
save: (event: {
|
|
1289
|
+
title: string;
|
|
1290
|
+
notes: string;
|
|
1291
|
+
start_ms: number;
|
|
1292
|
+
end_ms: number;
|
|
1293
|
+
}) => Promise<NativeOperation<{
|
|
1294
|
+
id: string;
|
|
1295
|
+
created: boolean;
|
|
1296
|
+
}>>;
|
|
1297
|
+
};
|
|
1298
|
+
export declare const deviceLocation: {
|
|
1299
|
+
status: () => Promise<NativeOperation<unknown>>;
|
|
1300
|
+
request: () => Promise<NativeOperation<unknown>>;
|
|
1301
|
+
current: () => Promise<NativeOperation<{
|
|
1302
|
+
latitude: number;
|
|
1303
|
+
longitude: number;
|
|
1304
|
+
accuracy_m: number;
|
|
1305
|
+
timestamp_ms: number;
|
|
1306
|
+
}>>;
|
|
1307
|
+
};
|
|
1308
|
+
export declare const devices: {
|
|
1309
|
+
choose: (transport: "serial" | "hid" | "ble") => Promise<NativeOperation<unknown>>;
|
|
1310
|
+
open: (id: string, baudRate?: number) => Promise<NativeOperation<unknown>>;
|
|
1311
|
+
list: () => Promise<NativeOperation<unknown>>;
|
|
1312
|
+
read: (id: string, length?: number) => Promise<NativeOperation<{
|
|
1313
|
+
data_base64: string;
|
|
1314
|
+
bytes: number;
|
|
1315
|
+
}>>;
|
|
1316
|
+
write: (id: string, dataBase64: string) => Promise<NativeOperation<{
|
|
1317
|
+
written: number;
|
|
1318
|
+
}>>;
|
|
1319
|
+
close: (id: string) => Promise<NativeOperation<unknown>>;
|
|
1320
|
+
};
|