@medeo-plugin/sdk 0.0.0-stage → 0.8.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 +497 -0
- package/dist/generated.js +1 -0
- package/dist/index.d.ts +891 -0
- package/dist/index.js +424 -0
- package/dist/react.d.ts +46 -0
- package/dist/react.js +44 -0
- package/dist/registry.d.ts +1132 -0
- package/dist/registry.js +172 -0
- package/dist/rpc.d.ts +28 -0
- package/dist/rpc.js +172 -0
- package/dist/testing.d.ts +28 -0
- package/dist/testing.js +161 -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 +158 -0
- package/src/index.ts +468 -0
- package/src/react.ts +50 -0
- package/src/registry.ts +173 -0
- package/src/rpc.ts +136 -0
- package/src/testing.ts +144 -0
- package/src/ui/styles.ts +31 -0
- package/src/ui.ts +102 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,891 @@
|
|
|
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
|
+
}
|
|
18
|
+
declare global {
|
|
19
|
+
var medeoPlugin: PluginAPI;
|
|
20
|
+
interface Window {
|
|
21
|
+
medeoPlugin: PluginAPI;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/** Pushed by the Host: an operation changed status (or streamed progress), or a
|
|
25
|
+
* plugin-owned queue has entries to pull. Events carry no payload data. */
|
|
26
|
+
export type PlatformEvent = {
|
|
27
|
+
type: 'operation';
|
|
28
|
+
id: string;
|
|
29
|
+
method: string;
|
|
30
|
+
status: string;
|
|
31
|
+
revision?: number;
|
|
32
|
+
} | {
|
|
33
|
+
type: 'signal';
|
|
34
|
+
channel: 'files.watch' | 'server' | 'input_method' | 'background' | 'permissions' | 'config' | 'shortcuts' | 'tray';
|
|
35
|
+
};
|
|
36
|
+
/** Messages between this plugin's background worker and its own windows
|
|
37
|
+
* (64 KiB each, JSON). A worker message reaches every open window; a window
|
|
38
|
+
* message reaches the worker. Nothing is persisted or sent elsewhere. */
|
|
39
|
+
export declare const channel: {
|
|
40
|
+
post: (message: unknown) => Promise<void>;
|
|
41
|
+
onMessage: <T = unknown>(callback: (message: T) => void) => () => void;
|
|
42
|
+
};
|
|
43
|
+
export declare const events: {
|
|
44
|
+
on: (callback: (event: PlatformEvent) => void) => () => void;
|
|
45
|
+
/** Call `pull` now and again whenever the channel signals new entries. A
|
|
46
|
+
* failed pull (e.g. a permission withdrawn meanwhile) waits for the next signal. */
|
|
47
|
+
onSignal(channel: Extract<PlatformEvent, {
|
|
48
|
+
type: "signal";
|
|
49
|
+
}>["channel"], pull: () => unknown): () => void;
|
|
50
|
+
};
|
|
51
|
+
export declare const storage: {
|
|
52
|
+
get: <T = unknown>(key: string) => Promise<T | null>;
|
|
53
|
+
remove: (key: string) => Promise<unknown>;
|
|
54
|
+
set: (key: string, value: unknown) => Promise<unknown>;
|
|
55
|
+
};
|
|
56
|
+
export declare const creation: {
|
|
57
|
+
open: () => Promise<unknown>;
|
|
58
|
+
};
|
|
59
|
+
export declare const commands: {
|
|
60
|
+
run: <T = unknown>(command: string, args?: JsonValue) => Promise<T>;
|
|
61
|
+
};
|
|
62
|
+
export interface Disposable {
|
|
63
|
+
dispose(): unknown;
|
|
64
|
+
}
|
|
65
|
+
/** Passed to `activate` (VS Code style), in both runtimes. */
|
|
66
|
+
export interface PluginContext {
|
|
67
|
+
/** Disposed, in reverse order, when the plugin stops. */
|
|
68
|
+
subscriptions: Disposable[];
|
|
69
|
+
/** Register a handler for each command the manifest declares; all must be registered when `activate` returns. */
|
|
70
|
+
commands: {
|
|
71
|
+
register(id: string, handler: (args?: JsonValue) => unknown | Promise<unknown>): Disposable;
|
|
72
|
+
};
|
|
73
|
+
/** `runtime: "node"` only: the installed, verified package directory (read-only). */
|
|
74
|
+
extensionPath?: string;
|
|
75
|
+
/** `runtime: "node"` only: a private writable directory that survives updates. */
|
|
76
|
+
storagePath?: string;
|
|
77
|
+
}
|
|
78
|
+
/** A plugin's background entry: export the result, e.g.
|
|
79
|
+
* `export const { activate, deactivate } = definePlugin({ activate(context) { … } })`. */
|
|
80
|
+
export interface PluginDefinition {
|
|
81
|
+
activate(context: PluginContext): unknown | Promise<unknown>;
|
|
82
|
+
deactivate?(): unknown | Promise<unknown>;
|
|
83
|
+
}
|
|
84
|
+
export declare function definePlugin(definition: PluginDefinition): Required<PluginDefinition>;
|
|
85
|
+
/** Settings declared under `contributes.configuration`; the user edits them in the plugin center. */
|
|
86
|
+
export declare const config: {
|
|
87
|
+
get: <T = unknown>(key: string) => Promise<T>;
|
|
88
|
+
all: () => Promise<Record<string, unknown>>;
|
|
89
|
+
set: (key: string, value: unknown) => Promise<unknown>;
|
|
90
|
+
/** Calls `listener` with all values after each change, from the user or the plugin. */
|
|
91
|
+
onDidChange(listener: (values: Record<string, unknown>) => void): () => void;
|
|
92
|
+
};
|
|
93
|
+
/** Native providers return quickly; subscribe to progress instead of holding a command open. */
|
|
94
|
+
export interface Provider {
|
|
95
|
+
id: string;
|
|
96
|
+
version: number;
|
|
97
|
+
available: boolean;
|
|
98
|
+
capabilities: string[];
|
|
99
|
+
}
|
|
100
|
+
/** `full`: the user approved full access (view and direct Trash) for this directory. */
|
|
101
|
+
export interface Resource {
|
|
102
|
+
id: string;
|
|
103
|
+
name: string;
|
|
104
|
+
available: boolean;
|
|
105
|
+
full?: boolean;
|
|
106
|
+
}
|
|
107
|
+
/** Ask for full access (requires the `file_full_access` permission). */
|
|
108
|
+
export interface DirectoryAccess {
|
|
109
|
+
full?: boolean;
|
|
110
|
+
}
|
|
111
|
+
export declare const providers: {
|
|
112
|
+
list: () => Promise<Provider[]>;
|
|
113
|
+
require: (id: string, version?: number) => Promise<Provider>;
|
|
114
|
+
};
|
|
115
|
+
export declare const resources: {
|
|
116
|
+
chooseDirectories: (access?: DirectoryAccess) => Promise<Resource[]>;
|
|
117
|
+
list: () => Promise<Resource[]>;
|
|
118
|
+
revoke: (id: string) => Promise<Resource[]>;
|
|
119
|
+
requestDirectory: (path: string, reason: string, access?: DirectoryAccess) => Promise<Resource[]>;
|
|
120
|
+
};
|
|
121
|
+
/** Generic registered-provider entry point; the Host remains the authority. */
|
|
122
|
+
export declare const capabilities: {
|
|
123
|
+
list: () => Promise<import("./generated").CapabilityDescriptor[]>;
|
|
124
|
+
labels: () => Promise<Record<string, string>>;
|
|
125
|
+
invoke: <T = unknown>(method: string, args?: Record<string, unknown>) => Promise<T>;
|
|
126
|
+
};
|
|
127
|
+
export declare const clipboard: {
|
|
128
|
+
read: () => Promise<{
|
|
129
|
+
text: string;
|
|
130
|
+
}>;
|
|
131
|
+
write: (text: string) => Promise<unknown>;
|
|
132
|
+
};
|
|
133
|
+
/** `running` reports, per rule, whether a matching process exists; it never
|
|
134
|
+
* returns the process list. Rules match an exact executable name or a path fragment. */
|
|
135
|
+
export interface ProcessRule {
|
|
136
|
+
name?: string;
|
|
137
|
+
path_contains?: string;
|
|
138
|
+
}
|
|
139
|
+
export interface SystemInfo {
|
|
140
|
+
platform: string;
|
|
141
|
+
architecture: string;
|
|
142
|
+
release: string;
|
|
143
|
+
locale: string; /** The Medeo running the plugin (0.1.23+; absent on older Medeo). */
|
|
144
|
+
medeo?: {
|
|
145
|
+
version: string;
|
|
146
|
+
channel: 'stg' | 'prd';
|
|
147
|
+
};
|
|
148
|
+
displays: {
|
|
149
|
+
id: string;
|
|
150
|
+
bounds: {
|
|
151
|
+
x: number;
|
|
152
|
+
y: number;
|
|
153
|
+
width: number;
|
|
154
|
+
height: number;
|
|
155
|
+
};
|
|
156
|
+
scale: number;
|
|
157
|
+
}[];
|
|
158
|
+
}
|
|
159
|
+
export declare const system: {
|
|
160
|
+
info: () => Promise<SystemInfo>;
|
|
161
|
+
running: (rules: ProcessRule[]) => Promise<NativeOperation<boolean[]>>;
|
|
162
|
+
};
|
|
163
|
+
/** One outcome per path of `trash`, in the order given. */
|
|
164
|
+
export interface TrashResult {
|
|
165
|
+
path: string;
|
|
166
|
+
trashed: boolean;
|
|
167
|
+
error?: string;
|
|
168
|
+
}
|
|
169
|
+
/** `runtime: "node"` plugins only (the `node` permission): moves up to 256 absolute
|
|
170
|
+
* paths to the OS Trash, the one thing Node cannot do itself. A failure does not stop the rest. */
|
|
171
|
+
export declare const trash: (paths: string[]) => Promise<TrashResult[]>;
|
|
172
|
+
export declare const notifications: {
|
|
173
|
+
show: (id: string, title: string, body: string) => Promise<unknown>;
|
|
174
|
+
close: (id: string) => Promise<unknown>;
|
|
175
|
+
};
|
|
176
|
+
export declare const power: {
|
|
177
|
+
start: (type: "prevent-app-suspension" | "prevent-display-sleep") => Promise<{
|
|
178
|
+
id: string;
|
|
179
|
+
}>;
|
|
180
|
+
stop: (id: string) => Promise<unknown>;
|
|
181
|
+
state: () => Promise<unknown>;
|
|
182
|
+
};
|
|
183
|
+
export declare const shortcuts: {
|
|
184
|
+
list: () => Promise<{
|
|
185
|
+
id: string;
|
|
186
|
+
accelerator: string;
|
|
187
|
+
open_ui: boolean;
|
|
188
|
+
}[]>;
|
|
189
|
+
register: (id: string, accelerator: string, openUI?: boolean) => Promise<unknown>;
|
|
190
|
+
unregister: (id: string) => Promise<unknown>;
|
|
191
|
+
events: () => Promise<unknown>;
|
|
192
|
+
};
|
|
193
|
+
/** `panel: true` (macOS): a frameless window floating over every app and Space that does not
|
|
194
|
+
* activate Medeo — the app the user was in keeps focus — opened at the pointer and hidden (not
|
|
195
|
+
* closed) when it loses focus; opening it again moves it to the pointer. `hide` keeps a window
|
|
196
|
+
* and its page alive for the next `open`/`focus`. */
|
|
197
|
+
export declare const appWindows: {
|
|
198
|
+
open: (options: {
|
|
199
|
+
id: string;
|
|
200
|
+
entry: string;
|
|
201
|
+
title: string;
|
|
202
|
+
width: number;
|
|
203
|
+
height: number;
|
|
204
|
+
panel?: boolean;
|
|
205
|
+
}) => Promise<unknown>;
|
|
206
|
+
close: (id: string) => Promise<unknown>;
|
|
207
|
+
focus: (id: string) => Promise<unknown>;
|
|
208
|
+
hide: (id: string) => Promise<unknown>;
|
|
209
|
+
list: () => Promise<{
|
|
210
|
+
id: string;
|
|
211
|
+
title: string;
|
|
212
|
+
visible: boolean;
|
|
213
|
+
}[]>;
|
|
214
|
+
};
|
|
215
|
+
/** A menu entry, a checkmarked toggle, or a divider. */
|
|
216
|
+
export type TrayItem = {
|
|
217
|
+
id: string;
|
|
218
|
+
title: string;
|
|
219
|
+
checked?: boolean;
|
|
220
|
+
} | {
|
|
221
|
+
separator: true;
|
|
222
|
+
};
|
|
223
|
+
/** `icon`: a PNG in the package drawn as a menu-bar template (black + alpha, about 36 px tall);
|
|
224
|
+
* `click`: an id reported on a left click, which then leaves the menu to a right click. */
|
|
225
|
+
export interface TrayOptions {
|
|
226
|
+
icon?: string;
|
|
227
|
+
click?: string;
|
|
228
|
+
}
|
|
229
|
+
export declare const tray: {
|
|
230
|
+
set: (title: string, items: TrayItem[], options?: TrayOptions) => Promise<unknown>;
|
|
231
|
+
remove: () => Promise<unknown>;
|
|
232
|
+
events: () => Promise<unknown>;
|
|
233
|
+
};
|
|
234
|
+
export declare const external: {
|
|
235
|
+
open: (url: string) => Promise<unknown>;
|
|
236
|
+
};
|
|
237
|
+
/** `scope` says how long an approval lasts: `always` (stored), `run` (until the plugin stops),
|
|
238
|
+
* `never` (refused with "don't ask again"). `remembered`: refused earlier, no dialog was shown. */
|
|
239
|
+
export interface PermissionAnswer {
|
|
240
|
+
granted: boolean;
|
|
241
|
+
scope?: 'always' | 'run' | 'never' | 'none';
|
|
242
|
+
remembered?: boolean;
|
|
243
|
+
}
|
|
244
|
+
export declare const permissions: {
|
|
245
|
+
request: (permission: string, reason: string) => Promise<PermissionAnswer>;
|
|
246
|
+
};
|
|
247
|
+
/** One of the plugin's own actions for the user to approve (`approvals` permission; `action` must be declared).
|
|
248
|
+
* `rule_key` identifies it (`bash:git status`); `rule_pattern` (a prefix of it ending in `*`) is what
|
|
249
|
+
* "always" remembers instead. Medeo draws the dialog and keeps the rules. In a Node plugin nothing
|
|
250
|
+
* forces you to ask: it is up to the plugin to call this before acting. */
|
|
251
|
+
export interface ApprovalRequest {
|
|
252
|
+
action: string;
|
|
253
|
+
title: string;
|
|
254
|
+
detail?: string;
|
|
255
|
+
preview?: {
|
|
256
|
+
kind: 'text' | 'command' | 'diff';
|
|
257
|
+
text: string;
|
|
258
|
+
};
|
|
259
|
+
rule_key: string;
|
|
260
|
+
rule_pattern?: string;
|
|
261
|
+
}
|
|
262
|
+
/** `scope`: `once`, `run`, `always`, or `rule` when a remembered answer decided without a dialog. */
|
|
263
|
+
export interface ApprovalAnswer {
|
|
264
|
+
decision: 'allow' | 'deny';
|
|
265
|
+
scope: 'once' | 'run' | 'always' | 'rule';
|
|
266
|
+
rule?: string;
|
|
267
|
+
}
|
|
268
|
+
export interface ApprovalRule {
|
|
269
|
+
action: string;
|
|
270
|
+
pattern: string;
|
|
271
|
+
allow: boolean;
|
|
272
|
+
scope: 'run' | 'always';
|
|
273
|
+
}
|
|
274
|
+
export declare const approvals: {
|
|
275
|
+
request: (request: ApprovalRequest) => Promise<ApprovalAnswer>;
|
|
276
|
+
rules: () => Promise<ApprovalRule[]>;
|
|
277
|
+
forget: (action: string, pattern: string) => Promise<ApprovalRule[]>;
|
|
278
|
+
};
|
|
279
|
+
export interface AgentJob {
|
|
280
|
+
id: string;
|
|
281
|
+
status: 'running' | 'completed' | 'failed' | 'cancelled';
|
|
282
|
+
text?: string;
|
|
283
|
+
models?: string[];
|
|
284
|
+
error?: string | null;
|
|
285
|
+
}
|
|
286
|
+
export declare const agent: {
|
|
287
|
+
models: () => Promise<AgentJob>;
|
|
288
|
+
start: (messages: {
|
|
289
|
+
role: "system" | "user" | "assistant";
|
|
290
|
+
content: string;
|
|
291
|
+
}[], model?: string) => Promise<AgentJob>;
|
|
292
|
+
state: (id: string) => Promise<AgentJob>;
|
|
293
|
+
cancel: (id: string) => Promise<AgentJob>;
|
|
294
|
+
release: (id: string) => Promise<unknown>;
|
|
295
|
+
/** Calls `onText` as the reply streams in; resolves with the final job. */
|
|
296
|
+
follow(id: string, onText: (job: AgentJob) => void): Promise<AgentJob>;
|
|
297
|
+
};
|
|
298
|
+
export interface ApplicationEntry {
|
|
299
|
+
id: string;
|
|
300
|
+
title: string;
|
|
301
|
+
path: string;
|
|
302
|
+
bundle_id: string;
|
|
303
|
+
}
|
|
304
|
+
export interface ApplicationList {
|
|
305
|
+
status: string;
|
|
306
|
+
error: string | null;
|
|
307
|
+
incomplete: boolean;
|
|
308
|
+
total: number;
|
|
309
|
+
entries: ApplicationEntry[];
|
|
310
|
+
}
|
|
311
|
+
export interface ApplicationState {
|
|
312
|
+
status: string;
|
|
313
|
+
error: string | null;
|
|
314
|
+
launch: {
|
|
315
|
+
id: string;
|
|
316
|
+
status: string;
|
|
317
|
+
error: string | null;
|
|
318
|
+
pid?: number;
|
|
319
|
+
} | null;
|
|
320
|
+
}
|
|
321
|
+
export declare const applications: {
|
|
322
|
+
/** The whole inventory; plugins rank and filter it themselves. */
|
|
323
|
+
list: (refresh?: boolean) => Promise<ApplicationList>;
|
|
324
|
+
launch: (id: string) => Promise<{
|
|
325
|
+
id: string;
|
|
326
|
+
status: string;
|
|
327
|
+
}>;
|
|
328
|
+
state: () => Promise<ApplicationState>;
|
|
329
|
+
};
|
|
330
|
+
export interface CaptureSource {
|
|
331
|
+
id: string;
|
|
332
|
+
title: string;
|
|
333
|
+
width: number;
|
|
334
|
+
height: number;
|
|
335
|
+
}
|
|
336
|
+
export interface CaptureRecord {
|
|
337
|
+
id: string;
|
|
338
|
+
source_title: string;
|
|
339
|
+
status: string;
|
|
340
|
+
active: boolean;
|
|
341
|
+
can_stop: boolean;
|
|
342
|
+
can_recover: boolean;
|
|
343
|
+
error?: string | null;
|
|
344
|
+
playable: boolean;
|
|
345
|
+
duration_ms: number;
|
|
346
|
+
bytes: number;
|
|
347
|
+
microphone: boolean;
|
|
348
|
+
system_audio: boolean;
|
|
349
|
+
audio_tracks?: number;
|
|
350
|
+
}
|
|
351
|
+
export declare const capture: {
|
|
352
|
+
status: (refresh?: boolean) => Promise<{
|
|
353
|
+
status: string;
|
|
354
|
+
os: Record<string, string>;
|
|
355
|
+
}>;
|
|
356
|
+
sources: (refresh?: boolean, requestPermission?: boolean) => Promise<{
|
|
357
|
+
status: string;
|
|
358
|
+
error?: string;
|
|
359
|
+
os: Record<string, string>;
|
|
360
|
+
sources: CaptureSource[];
|
|
361
|
+
}>;
|
|
362
|
+
start: (source: string, options?: {
|
|
363
|
+
microphone?: boolean;
|
|
364
|
+
systemAudio?: boolean;
|
|
365
|
+
}) => Promise<{
|
|
366
|
+
id?: string;
|
|
367
|
+
cancelled?: boolean;
|
|
368
|
+
}>;
|
|
369
|
+
state: () => Promise<{
|
|
370
|
+
records: CaptureRecord[];
|
|
371
|
+
os: Record<string, string>;
|
|
372
|
+
}>;
|
|
373
|
+
stop: (id: string) => Promise<unknown>;
|
|
374
|
+
cancel: (id: string) => Promise<unknown>;
|
|
375
|
+
recover: (id: string) => Promise<unknown>;
|
|
376
|
+
open: (id: string, mode?: "play" | "reveal") => Promise<unknown>;
|
|
377
|
+
previewURL: (id: string) => string;
|
|
378
|
+
};
|
|
379
|
+
export interface InputMethodState {
|
|
380
|
+
enabled: boolean;
|
|
381
|
+
provider_ready: boolean;
|
|
382
|
+
configured_name: string;
|
|
383
|
+
occupied: boolean;
|
|
384
|
+
system_source: string;
|
|
385
|
+
}
|
|
386
|
+
export interface InputSourceState {
|
|
387
|
+
status: string;
|
|
388
|
+
state_key: string;
|
|
389
|
+
can_setup: boolean;
|
|
390
|
+
can_remove: boolean;
|
|
391
|
+
installed?: boolean;
|
|
392
|
+
registered?: boolean;
|
|
393
|
+
enabled?: boolean;
|
|
394
|
+
selected?: boolean;
|
|
395
|
+
update_available?: boolean;
|
|
396
|
+
error?: string;
|
|
397
|
+
last_operation?: {
|
|
398
|
+
id: string;
|
|
399
|
+
status: string;
|
|
400
|
+
error?: string;
|
|
401
|
+
};
|
|
402
|
+
task?: string;
|
|
403
|
+
}
|
|
404
|
+
export declare const inputMethod: {
|
|
405
|
+
system: (refresh?: boolean) => Promise<InputSourceState>;
|
|
406
|
+
setup: () => Promise<{
|
|
407
|
+
task?: string;
|
|
408
|
+
cancelled?: boolean;
|
|
409
|
+
}>;
|
|
410
|
+
remove: () => Promise<{
|
|
411
|
+
task?: string;
|
|
412
|
+
cancelled?: boolean;
|
|
413
|
+
}>;
|
|
414
|
+
settings: () => Promise<{
|
|
415
|
+
task: string;
|
|
416
|
+
}>;
|
|
417
|
+
status: () => Promise<InputMethodState>;
|
|
418
|
+
configure: (name: string) => Promise<unknown>;
|
|
419
|
+
enable: () => Promise<InputMethodState>;
|
|
420
|
+
disable: () => Promise<unknown>;
|
|
421
|
+
events: () => Promise<{
|
|
422
|
+
id: string;
|
|
423
|
+
text: string;
|
|
424
|
+
}[]>;
|
|
425
|
+
respond: (id: string, candidates: string[]) => Promise<unknown>;
|
|
426
|
+
};
|
|
427
|
+
/** HTTP uses only approved origins; no redirects, browser cookies, or Medeo credentials.
|
|
428
|
+
* Closing UI preserves jobs; disable/revoke cancels. Mutations are never replayed.
|
|
429
|
+
* Release completed results to return the per-instance memory quota.
|
|
430
|
+
*/
|
|
431
|
+
export interface NetworkRequest {
|
|
432
|
+
url: string;
|
|
433
|
+
method?: 'GET' | 'HEAD' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS';
|
|
434
|
+
headers?: Record<string, string>;
|
|
435
|
+
body?: string;
|
|
436
|
+
body_base64?: string;
|
|
437
|
+
timeout_ms?: number;
|
|
438
|
+
stream?: boolean;
|
|
439
|
+
}
|
|
440
|
+
export interface NetworkJob {
|
|
441
|
+
id: string;
|
|
442
|
+
status: 'running' | 'completed' | 'failed' | 'cancelled';
|
|
443
|
+
received?: number;
|
|
444
|
+
http_status?: number | null;
|
|
445
|
+
headers?: [string, string][];
|
|
446
|
+
error?: string | null;
|
|
447
|
+
stream?: boolean;
|
|
448
|
+
}
|
|
449
|
+
export interface NetworkChunk {
|
|
450
|
+
data_base64: string;
|
|
451
|
+
next_offset: number;
|
|
452
|
+
eof: boolean;
|
|
453
|
+
}
|
|
454
|
+
export interface NetworkOrigin {
|
|
455
|
+
origin: string;
|
|
456
|
+
declared: boolean;
|
|
457
|
+
allowed: boolean;
|
|
458
|
+
}
|
|
459
|
+
export interface NetworkServerEvent {
|
|
460
|
+
data: string;
|
|
461
|
+
event: string;
|
|
462
|
+
id: string;
|
|
463
|
+
retry?: number;
|
|
464
|
+
}
|
|
465
|
+
export declare const network: {
|
|
466
|
+
origins: () => Promise<NetworkOrigin[]>;
|
|
467
|
+
requestOrigin: (origin: string, reason: string) => Promise<{
|
|
468
|
+
origin: string;
|
|
469
|
+
granted: boolean;
|
|
470
|
+
}>;
|
|
471
|
+
revokeOrigin: (origin: string) => Promise<NetworkOrigin[]>;
|
|
472
|
+
request: (request: NetworkRequest) => Promise<NetworkJob>;
|
|
473
|
+
state: (id: string) => Promise<NetworkJob>;
|
|
474
|
+
read: (id: string, offset?: number, length?: number) => Promise<NetworkChunk>;
|
|
475
|
+
cancel: (id: string) => Promise<NetworkJob>;
|
|
476
|
+
release: (id: string) => Promise<{
|
|
477
|
+
released: boolean;
|
|
478
|
+
}>;
|
|
479
|
+
/** Resolves once the response has fully arrived; the job stays readable until released. */
|
|
480
|
+
settled(id: string): Promise<NetworkJob>;
|
|
481
|
+
/** Single consumer for a stream:true job. Break/throw/abort cancels and releases it. */
|
|
482
|
+
bytes(id: string, signal?: AbortSignal): AsyncGenerator<Uint8Array>;
|
|
483
|
+
/** Incremental UTF-8 decoder, including code points split across HTTP chunks. */
|
|
484
|
+
textStream(id: string, signal?: AbortSignal): AsyncGenerator<string>;
|
|
485
|
+
/** SSE framing only: no automatic reconnect/retry or Last-Event-ID requests. */
|
|
486
|
+
sse(id: string, signal?: AbortSignal): AsyncGenerator<NetworkServerEvent>;
|
|
487
|
+
/** Explicitly dispose a stream that was never iterated (or has another owner). */
|
|
488
|
+
dispose(id: string): Promise<void>;
|
|
489
|
+
text(id: string): Promise<string>;
|
|
490
|
+
};
|
|
491
|
+
/** Workspace operations use current directory references and asynchronous jobs. */
|
|
492
|
+
export interface FileRoot {
|
|
493
|
+
id: string | null;
|
|
494
|
+
name: string;
|
|
495
|
+
available: boolean;
|
|
496
|
+
error?: string;
|
|
497
|
+
}
|
|
498
|
+
export interface FileEntry {
|
|
499
|
+
path: string;
|
|
500
|
+
name: string;
|
|
501
|
+
kind: 'file' | 'directory' | 'blocked';
|
|
502
|
+
size: number;
|
|
503
|
+
revision: string;
|
|
504
|
+
accessible: boolean;
|
|
505
|
+
}
|
|
506
|
+
export interface FileRecord {
|
|
507
|
+
id: string;
|
|
508
|
+
operation: string;
|
|
509
|
+
source: string;
|
|
510
|
+
destination: string;
|
|
511
|
+
status: string;
|
|
512
|
+
has_original: boolean;
|
|
513
|
+
in_trash?: boolean | null;
|
|
514
|
+
created_ms: number | null;
|
|
515
|
+
retention: "workspace" | "trash" | "none" | "unknown";
|
|
516
|
+
}
|
|
517
|
+
export interface FileJob<T = unknown> {
|
|
518
|
+
id: string;
|
|
519
|
+
status: 'running' | 'completed' | 'failed' | 'cancelled';
|
|
520
|
+
result: T | null;
|
|
521
|
+
error: string | null;
|
|
522
|
+
method?: string;
|
|
523
|
+
}
|
|
524
|
+
export interface FileWatch {
|
|
525
|
+
id: string;
|
|
526
|
+
status: 'starting' | 'watching' | 'stopped' | 'failed';
|
|
527
|
+
cursor?: number;
|
|
528
|
+
error?: string | null;
|
|
529
|
+
}
|
|
530
|
+
export interface FileWatchEvents extends FileWatch {
|
|
531
|
+
cursor: number;
|
|
532
|
+
rescan_required: boolean;
|
|
533
|
+
events: {
|
|
534
|
+
cursor: number;
|
|
535
|
+
kind: 'ready' | 'created' | 'changed' | 'removed' | 'rescan_required';
|
|
536
|
+
path: string | null;
|
|
537
|
+
}[];
|
|
538
|
+
}
|
|
539
|
+
export interface FilePreview {
|
|
540
|
+
id: string;
|
|
541
|
+
path: string;
|
|
542
|
+
bytes: number;
|
|
543
|
+
count: number;
|
|
544
|
+
revision: string | null;
|
|
545
|
+
purpose: string;
|
|
546
|
+
record: string | null;
|
|
547
|
+
}
|
|
548
|
+
export interface FileHistoryPage {
|
|
549
|
+
items: FileRecord[];
|
|
550
|
+
next_cursor: string | null;
|
|
551
|
+
total: number;
|
|
552
|
+
}
|
|
553
|
+
export declare const files: {
|
|
554
|
+
backupPreview: (root: string, record: string) => Promise<FileJob<FilePreview>>;
|
|
555
|
+
archiveBackup: (preview: string) => Promise<FileJob<FileRecord>>;
|
|
556
|
+
forgetPreview: (root: string, record: string) => Promise<FileJob<FilePreview>>;
|
|
557
|
+
forgetRecord: (preview: string) => Promise<FileJob<{
|
|
558
|
+
forgotten: string;
|
|
559
|
+
}>>;
|
|
560
|
+
historyPage: (root: string, cursor?: string, limit?: number) => Promise<FileJob<FileHistoryPage>>;
|
|
561
|
+
trashPreview: (root: string, path: string) => Promise<FileJob<FilePreview>>;
|
|
562
|
+
discardPreview: (preview: string) => Promise<{
|
|
563
|
+
discarded: boolean;
|
|
564
|
+
}>;
|
|
565
|
+
trash: (preview: string) => Promise<FileJob<FileRecord>>;
|
|
566
|
+
/** Breadth-first listings of a whole tree in one call. Hidden and `skip`
|
|
567
|
+
* directories are listed by their parent but not entered. */
|
|
568
|
+
listTree: (root: string, path?: string, options?: {
|
|
569
|
+
depth?: number;
|
|
570
|
+
skip?: string[];
|
|
571
|
+
hidden?: boolean;
|
|
572
|
+
limit?: number;
|
|
573
|
+
}) => Promise<FileJob<{
|
|
574
|
+
directories: {
|
|
575
|
+
path: string;
|
|
576
|
+
entries?: FileEntry[];
|
|
577
|
+
error?: string;
|
|
578
|
+
}[];
|
|
579
|
+
truncated: boolean;
|
|
580
|
+
}>>;
|
|
581
|
+
/** Full-access roots only: move entries to the Trash without a Host confirmation.
|
|
582
|
+
* `stamp` is what `files.measure` returned; a changed entry is refused, not moved. */
|
|
583
|
+
trashDirect: (items: {
|
|
584
|
+
root: string;
|
|
585
|
+
path: string;
|
|
586
|
+
stamp: {
|
|
587
|
+
revision: string;
|
|
588
|
+
digest: string;
|
|
589
|
+
bytes: number;
|
|
590
|
+
count: number;
|
|
591
|
+
};
|
|
592
|
+
}[]) => Promise<FileJob<{
|
|
593
|
+
path: string;
|
|
594
|
+
record?: FileRecord;
|
|
595
|
+
error?: string;
|
|
596
|
+
}[]>>;
|
|
597
|
+
watch: (root: string, path?: string, recursive?: boolean) => Promise<FileWatch>;
|
|
598
|
+
watches: () => Promise<FileWatch[]>;
|
|
599
|
+
events: (id: string, after?: number) => Promise<FileWatchEvents>;
|
|
600
|
+
unwatch: (id: string) => Promise<{
|
|
601
|
+
stopped: boolean;
|
|
602
|
+
}>;
|
|
603
|
+
roots: () => Promise<FileJob<FileRoot[]>>;
|
|
604
|
+
list: (root: string, path?: string) => Promise<FileJob<FileEntry[]>>;
|
|
605
|
+
stat: (root: string, path?: string) => Promise<FileJob<FileEntry>>;
|
|
606
|
+
readText: (root: string, path: string, revision?: string) => Promise<FileJob<{
|
|
607
|
+
text: string;
|
|
608
|
+
entry: FileEntry;
|
|
609
|
+
}>>;
|
|
610
|
+
writeText: (root: string, path: string, text: string, revision: string) => Promise<FileJob<{
|
|
611
|
+
record: FileRecord;
|
|
612
|
+
entry: FileEntry | null;
|
|
613
|
+
}>>;
|
|
614
|
+
mkdir: (root: string, path: string) => Promise<FileJob<FileEntry>>;
|
|
615
|
+
move: (root: string, path: string, destination: string, revision: string) => Promise<FileJob<FileRecord>>;
|
|
616
|
+
history: (root: string) => Promise<FileJob<FileRecord[]>>;
|
|
617
|
+
restore: (root: string, record: string) => Promise<FileJob<FileRecord>>;
|
|
618
|
+
state: <T = unknown>(id: string) => Promise<FileJob<T>>;
|
|
619
|
+
cancel: (id: string) => Promise<unknown>;
|
|
620
|
+
release: (id: string) => Promise<unknown>;
|
|
621
|
+
result: <T>(job: FileJob<T>) => Promise<T>;
|
|
622
|
+
};
|
|
623
|
+
/** Plugin-owned credentials. Values are returned only to this granted plugin;
|
|
624
|
+
* Agent/Medeo credentials are never part of this vault. No automatic retry. */
|
|
625
|
+
export interface SecretOperation {
|
|
626
|
+
id: string;
|
|
627
|
+
status: 'running' | 'completed' | 'failed';
|
|
628
|
+
value?: string | null;
|
|
629
|
+
error?: string;
|
|
630
|
+
}
|
|
631
|
+
export declare const secrets: {
|
|
632
|
+
get: (key: string) => Promise<string | null>;
|
|
633
|
+
set: (key: string, value: string) => Promise<void>;
|
|
634
|
+
remove: (key: string) => Promise<void>;
|
|
635
|
+
};
|
|
636
|
+
export interface LocalServerOptions {
|
|
637
|
+
port?: number;
|
|
638
|
+
routes: {
|
|
639
|
+
method: 'GET' | 'HEAD' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
640
|
+
path: string;
|
|
641
|
+
}[];
|
|
642
|
+
origins?: string[];
|
|
643
|
+
timeout_ms?: number;
|
|
644
|
+
}
|
|
645
|
+
export interface LocalServerState {
|
|
646
|
+
id: string;
|
|
647
|
+
status: 'starting' | 'running' | 'stopping' | 'stopped' | 'failed';
|
|
648
|
+
origin: string | null;
|
|
649
|
+
error: string | null;
|
|
650
|
+
pending: number;
|
|
651
|
+
accepted: number;
|
|
652
|
+
}
|
|
653
|
+
export interface LocalRequest {
|
|
654
|
+
id: string;
|
|
655
|
+
method: string;
|
|
656
|
+
path: string;
|
|
657
|
+
query: string;
|
|
658
|
+
headers: Record<string, string>;
|
|
659
|
+
body_base64: string;
|
|
660
|
+
}
|
|
661
|
+
/** A loopback server is instance-owned and never survives Host restart. Keep the
|
|
662
|
+
* start token in private memory and serve requests in a worker for background use. */
|
|
663
|
+
export declare const server: {
|
|
664
|
+
start: (options: LocalServerOptions) => Promise<{
|
|
665
|
+
id: string;
|
|
666
|
+
status: "starting";
|
|
667
|
+
access_token: string;
|
|
668
|
+
}>;
|
|
669
|
+
state: (id: string) => Promise<LocalServerState>;
|
|
670
|
+
list: () => Promise<LocalServerState[]>;
|
|
671
|
+
events: (id: string, limit?: number) => Promise<{
|
|
672
|
+
requests: LocalRequest[];
|
|
673
|
+
}>;
|
|
674
|
+
respond: (id: string, request: string, response: {
|
|
675
|
+
status?: number;
|
|
676
|
+
body_base64?: string;
|
|
677
|
+
content_type?: string;
|
|
678
|
+
}) => Promise<{
|
|
679
|
+
responded: boolean;
|
|
680
|
+
}>;
|
|
681
|
+
stop: (id: string) => Promise<LocalServerState>;
|
|
682
|
+
};
|
|
683
|
+
export interface PluginLocaleState {
|
|
684
|
+
preference: string;
|
|
685
|
+
locale: string;
|
|
686
|
+
system_locale: string;
|
|
687
|
+
direction: 'ltr';
|
|
688
|
+
supported_locales: string[];
|
|
689
|
+
catalog_locales: string[];
|
|
690
|
+
catalog_locale: string | null;
|
|
691
|
+
fallback_locale: string | null;
|
|
692
|
+
name: string;
|
|
693
|
+
commands: Record<string, string>;
|
|
694
|
+
}
|
|
695
|
+
/** Text is formatted in Rust from the signed package. Render with textContent,
|
|
696
|
+
* never innerHTML. Register listeners before initial state fetch to avoid races. */
|
|
697
|
+
export declare const i18n: {
|
|
698
|
+
state: () => Promise<PluginLocaleState>;
|
|
699
|
+
setLocale: (preference: string) => Promise<PluginLocaleState>;
|
|
700
|
+
t: (key: string, params?: Record<string, string | number>) => Promise<string>;
|
|
701
|
+
/** Every message of the effective locale (default-locale fallback merged in). */
|
|
702
|
+
catalog: () => Promise<Record<string, string>>;
|
|
703
|
+
onDidChangeLocale: (callback: (state: PluginLocaleState) => void) => () => void;
|
|
704
|
+
};
|
|
705
|
+
/** Every asynchronous call returns an owned operation handle. Status changes
|
|
706
|
+
* are pushed; `wait` resolves on them and releases the result. */
|
|
707
|
+
export interface NativeOperation<T = unknown> {
|
|
708
|
+
id: string;
|
|
709
|
+
status: 'running' | 'completed' | 'failed' | 'cancelled' | 'interrupted';
|
|
710
|
+
result: T | null;
|
|
711
|
+
error: string | null;
|
|
712
|
+
}
|
|
713
|
+
export declare const operations: {
|
|
714
|
+
state: <T = unknown>(id: string) => Promise<NativeOperation<T>>;
|
|
715
|
+
list: () => Promise<{
|
|
716
|
+
id: string;
|
|
717
|
+
method: string;
|
|
718
|
+
status: string;
|
|
719
|
+
}[]>;
|
|
720
|
+
cancel: (id: string) => Promise<unknown>;
|
|
721
|
+
release: (id: string) => Promise<unknown>;
|
|
722
|
+
wait<T>(operation: {
|
|
723
|
+
id: string;
|
|
724
|
+
status: string;
|
|
725
|
+
}, signal?: AbortSignal): Promise<T>;
|
|
726
|
+
};
|
|
727
|
+
/** A camera / microphone / system audio recording. `waveform` (240 peaks, 0…1) is in `state(id)` once
|
|
728
|
+
* completed; listings carry a 40-point `waveform_preview` instead. Live fields exist only while recording:
|
|
729
|
+
* `levels` holds the latest input levels (0…1, about 20 a second) and `levels_seq` counts every level so far;
|
|
730
|
+
* `frame` is the camera's latest preview as base64 JPEG. "completed" means `previewURL` can play it. */
|
|
731
|
+
export interface MediaRecord {
|
|
732
|
+
id: string;
|
|
733
|
+
kind: 'camera' | 'microphone' | 'system_audio';
|
|
734
|
+
status: 'starting' | 'recording' | 'stopping' | 'completed' | 'failed' | 'interrupted';
|
|
735
|
+
error?: string | null;
|
|
736
|
+
created_ms: number;
|
|
737
|
+
extension: string;
|
|
738
|
+
duration_ms?: number;
|
|
739
|
+
bytes?: number;
|
|
740
|
+
waveform?: number[];
|
|
741
|
+
waveform_preview?: number[];
|
|
742
|
+
elapsed_ms?: number;
|
|
743
|
+
level?: number;
|
|
744
|
+
peak?: number;
|
|
745
|
+
levels?: number[];
|
|
746
|
+
levels_seq?: number;
|
|
747
|
+
frame?: string;
|
|
748
|
+
}
|
|
749
|
+
export declare const camera: {
|
|
750
|
+
status: () => Promise<NativeOperation<{
|
|
751
|
+
authorization: string;
|
|
752
|
+
}>>;
|
|
753
|
+
start: (maxSeconds?: number) => Promise<NativeOperation<{
|
|
754
|
+
id: string;
|
|
755
|
+
status: string;
|
|
756
|
+
}>>;
|
|
757
|
+
stop: (id: string) => Promise<NativeOperation<unknown>>;
|
|
758
|
+
state: (id?: string) => Promise<NativeOperation<unknown>>;
|
|
759
|
+
read: (id: string, offset?: number, length?: number) => Promise<NativeOperation<NetworkChunk>>;
|
|
760
|
+
/** Same-origin URL for an `<audio>` / `<video>` element; plays once the record is "completed". */
|
|
761
|
+
previewURL: (record: Pick<MediaRecord, "id" | "extension">) => string;
|
|
762
|
+
}, microphone: {
|
|
763
|
+
status: () => Promise<NativeOperation<{
|
|
764
|
+
authorization: string;
|
|
765
|
+
}>>;
|
|
766
|
+
start: (maxSeconds?: number) => Promise<NativeOperation<{
|
|
767
|
+
id: string;
|
|
768
|
+
status: string;
|
|
769
|
+
}>>;
|
|
770
|
+
stop: (id: string) => Promise<NativeOperation<unknown>>;
|
|
771
|
+
state: (id?: string) => Promise<NativeOperation<unknown>>;
|
|
772
|
+
read: (id: string, offset?: number, length?: number) => Promise<NativeOperation<NetworkChunk>>;
|
|
773
|
+
/** Same-origin URL for an `<audio>` / `<video>` element; plays once the record is "completed". */
|
|
774
|
+
previewURL: (record: Pick<MediaRecord, "id" | "extension">) => string;
|
|
775
|
+
}, systemAudio: {
|
|
776
|
+
status: () => Promise<NativeOperation<{
|
|
777
|
+
authorization: string;
|
|
778
|
+
}>>;
|
|
779
|
+
start: (maxSeconds?: number) => Promise<NativeOperation<{
|
|
780
|
+
id: string;
|
|
781
|
+
status: string;
|
|
782
|
+
}>>;
|
|
783
|
+
stop: (id: string) => Promise<NativeOperation<unknown>>;
|
|
784
|
+
state: (id?: string) => Promise<NativeOperation<unknown>>;
|
|
785
|
+
read: (id: string, offset?: number, length?: number) => Promise<NativeOperation<NetworkChunk>>;
|
|
786
|
+
/** Same-origin URL for an `<audio>` / `<video>` element; plays once the record is "completed". */
|
|
787
|
+
previewURL: (record: Pick<MediaRecord, "id" | "extension">) => string;
|
|
788
|
+
};
|
|
789
|
+
export declare const accessibility: {
|
|
790
|
+
status: () => Promise<NativeOperation<unknown>>;
|
|
791
|
+
request: () => Promise<NativeOperation<unknown>>;
|
|
792
|
+
windows: () => Promise<NativeOperation<{
|
|
793
|
+
id: string;
|
|
794
|
+
title: string;
|
|
795
|
+
application: string;
|
|
796
|
+
}[]>>;
|
|
797
|
+
focus: (id: string) => Promise<NativeOperation<unknown>>;
|
|
798
|
+
selectedText: (id: string) => Promise<NativeOperation<{
|
|
799
|
+
id: string;
|
|
800
|
+
text: string;
|
|
801
|
+
}>>;
|
|
802
|
+
insertText: (focus: string, text: string) => Promise<NativeOperation<unknown>>;
|
|
803
|
+
};
|
|
804
|
+
export declare const browserView: {
|
|
805
|
+
open: (id: string, url: string, width?: number, height?: number) => Promise<unknown>;
|
|
806
|
+
state: (id: string) => Promise<unknown>;
|
|
807
|
+
close: (id: string) => Promise<unknown>;
|
|
808
|
+
};
|
|
809
|
+
export declare const printing: {
|
|
810
|
+
print: (text: string) => Promise<unknown>;
|
|
811
|
+
};
|
|
812
|
+
export declare const processes: {
|
|
813
|
+
start: (executable: string, args?: string[], timeoutMs?: number) => Promise<NativeOperation<{
|
|
814
|
+
id: string;
|
|
815
|
+
status: string;
|
|
816
|
+
}>>;
|
|
817
|
+
state: (id: string) => Promise<NativeOperation<{
|
|
818
|
+
status: string;
|
|
819
|
+
exit_code: number | null;
|
|
820
|
+
stdout: string;
|
|
821
|
+
stderr: string;
|
|
822
|
+
truncated: boolean;
|
|
823
|
+
}>>;
|
|
824
|
+
write: (id: string, text: string) => Promise<NativeOperation<{
|
|
825
|
+
written: number;
|
|
826
|
+
}>>;
|
|
827
|
+
stop: (id: string) => Promise<NativeOperation<unknown>>;
|
|
828
|
+
};
|
|
829
|
+
export interface BackgroundEvent {
|
|
830
|
+
id: string;
|
|
831
|
+
schedule: string;
|
|
832
|
+
due_ms: number;
|
|
833
|
+
payload: JsonValue;
|
|
834
|
+
}
|
|
835
|
+
export declare const background: {
|
|
836
|
+
schedule: (id: string, delayMs: number, payload?: JsonValue, intervalMs?: number) => Promise<unknown>;
|
|
837
|
+
list: () => Promise<unknown>;
|
|
838
|
+
cancel: (id: string) => Promise<unknown>;
|
|
839
|
+
events: () => Promise<BackgroundEvent[]>;
|
|
840
|
+
};
|
|
841
|
+
export declare const contacts: {
|
|
842
|
+
status: () => Promise<NativeOperation<unknown>>;
|
|
843
|
+
request: () => Promise<NativeOperation<unknown>>;
|
|
844
|
+
list: (query?: string, limit?: number) => Promise<NativeOperation<unknown>>;
|
|
845
|
+
save: (contact: {
|
|
846
|
+
given_name: string;
|
|
847
|
+
family_name: string;
|
|
848
|
+
email: string;
|
|
849
|
+
phone: string;
|
|
850
|
+
}) => Promise<NativeOperation<{
|
|
851
|
+
id: string;
|
|
852
|
+
created: boolean;
|
|
853
|
+
}>>;
|
|
854
|
+
};
|
|
855
|
+
export declare const calendar: {
|
|
856
|
+
status: () => Promise<NativeOperation<unknown>>;
|
|
857
|
+
request: () => Promise<NativeOperation<unknown>>;
|
|
858
|
+
list: (startMs: number, endMs: number, limit?: number) => Promise<NativeOperation<unknown>>;
|
|
859
|
+
save: (event: {
|
|
860
|
+
title: string;
|
|
861
|
+
notes: string;
|
|
862
|
+
start_ms: number;
|
|
863
|
+
end_ms: number;
|
|
864
|
+
}) => Promise<NativeOperation<{
|
|
865
|
+
id: string;
|
|
866
|
+
created: boolean;
|
|
867
|
+
}>>;
|
|
868
|
+
};
|
|
869
|
+
export declare const deviceLocation: {
|
|
870
|
+
status: () => Promise<NativeOperation<unknown>>;
|
|
871
|
+
request: () => Promise<NativeOperation<unknown>>;
|
|
872
|
+
current: () => Promise<NativeOperation<{
|
|
873
|
+
latitude: number;
|
|
874
|
+
longitude: number;
|
|
875
|
+
accuracy_m: number;
|
|
876
|
+
timestamp_ms: number;
|
|
877
|
+
}>>;
|
|
878
|
+
};
|
|
879
|
+
export declare const devices: {
|
|
880
|
+
choose: (transport: "serial" | "hid" | "ble") => Promise<NativeOperation<unknown>>;
|
|
881
|
+
open: (id: string, baudRate?: number) => Promise<NativeOperation<unknown>>;
|
|
882
|
+
list: () => Promise<NativeOperation<unknown>>;
|
|
883
|
+
read: (id: string, length?: number) => Promise<NativeOperation<{
|
|
884
|
+
data_base64: string;
|
|
885
|
+
bytes: number;
|
|
886
|
+
}>>;
|
|
887
|
+
write: (id: string, dataBase64: string) => Promise<NativeOperation<{
|
|
888
|
+
written: number;
|
|
889
|
+
}>>;
|
|
890
|
+
close: (id: string) => Promise<NativeOperation<unknown>>;
|
|
891
|
+
};
|