@medeo-plugin/sdk 0.0.0-stage → 0.7.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 +875 -0
- package/dist/index.js +309 -0
- package/dist/registry.d.ts +1132 -0
- package/dist/registry.js +172 -0
- package/package.json +38 -4
- package/src/generated.ts +158 -0
- package/src/index.ts +393 -0
- package/src/registry.ts +173 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
export { METHODS, LIMITS } from "./registry.js";
|
|
2
|
+
/** The `api_version` this SDK targets; `spec/api-v1.json` carries the same number. */
|
|
3
|
+
export const API_VERSION = 1;
|
|
4
|
+
/** Messages between this plugin's background worker and its own windows
|
|
5
|
+
* (64 KiB each, JSON). A worker message reaches every open window; a window
|
|
6
|
+
* message reaches the worker. Nothing is persisted or sent elsewhere. */
|
|
7
|
+
export const channel = {
|
|
8
|
+
post: (message) => globalThis.medeoPlugin.post(message),
|
|
9
|
+
onMessage: (callback) => globalThis.medeoPlugin.onMessage(m => callback(m)),
|
|
10
|
+
};
|
|
11
|
+
export const events = {
|
|
12
|
+
on: (callback) => globalThis.medeoPlugin.onEvent(callback),
|
|
13
|
+
/** Call `pull` now and again whenever the channel signals new entries. A
|
|
14
|
+
* failed pull (e.g. a permission withdrawn meanwhile) waits for the next signal. */
|
|
15
|
+
onSignal(channel, pull) {
|
|
16
|
+
const run = () => { void Promise.resolve().then(pull).catch(() => { }); };
|
|
17
|
+
const off = globalThis.medeoPlugin.onEvent(event => { if (event.type === 'signal' && event.channel === channel)
|
|
18
|
+
run(); });
|
|
19
|
+
run();
|
|
20
|
+
return off;
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
/** Resolves on the next event for `id`, or after `fallbackMs` as a safety net. */
|
|
24
|
+
function nextChange(id, fallbackMs) {
|
|
25
|
+
let off = () => { };
|
|
26
|
+
const promise = new Promise(resolve => {
|
|
27
|
+
const timer = setTimeout(resolve, fallbackMs);
|
|
28
|
+
const stop = globalThis.medeoPlugin.onEvent(event => { if (event.type === 'operation' && event.id === id) {
|
|
29
|
+
clearTimeout(timer);
|
|
30
|
+
resolve();
|
|
31
|
+
} });
|
|
32
|
+
off = () => { clearTimeout(timer); stop(); };
|
|
33
|
+
});
|
|
34
|
+
return { promise, off };
|
|
35
|
+
}
|
|
36
|
+
export const storage = {
|
|
37
|
+
get: (key) => globalThis.medeoPlugin.invoke('storage.get', { key }),
|
|
38
|
+
remove: (key) => globalThis.medeoPlugin.invoke('storage.remove', { key }),
|
|
39
|
+
set: (key, value) => globalThis.medeoPlugin.invoke('storage.set', { key, value }),
|
|
40
|
+
};
|
|
41
|
+
export const creation = { open: () => globalThis.medeoPlugin.invoke('creation.open') };
|
|
42
|
+
export const commands = { run: (command) => globalThis.medeoPlugin.run(command) };
|
|
43
|
+
export function definePlugin(definition) {
|
|
44
|
+
return { deactivate: () => undefined, ...definition };
|
|
45
|
+
}
|
|
46
|
+
/** Settings declared under `contributes.configuration`; the user edits them in the plugin center. */
|
|
47
|
+
export const config = {
|
|
48
|
+
get: (key) => globalThis.medeoPlugin.invoke('config.get', { key }),
|
|
49
|
+
all: () => globalThis.medeoPlugin.invoke('config.get'),
|
|
50
|
+
set: (key, value) => globalThis.medeoPlugin.invoke('config.set', { key, value }),
|
|
51
|
+
/** Calls `listener` with all values after each change, from the user or the plugin. */
|
|
52
|
+
onDidChange(listener) {
|
|
53
|
+
return globalThis.medeoPlugin.onEvent(event => {
|
|
54
|
+
if (event.type === 'signal' && event.channel === 'config')
|
|
55
|
+
void config.all().then(listener).catch(() => { });
|
|
56
|
+
});
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
export const providers = {
|
|
60
|
+
list: () => globalThis.medeoPlugin.invoke('providers.list'),
|
|
61
|
+
require: async (id, version = 1) => {
|
|
62
|
+
const provider = (await providers.list()).find(p => p.id === id && p.version === version && p.available);
|
|
63
|
+
if (!provider)
|
|
64
|
+
throw new Error('provider_unavailable');
|
|
65
|
+
return provider;
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
export const resources = {
|
|
69
|
+
chooseDirectories: (access = {}) => globalThis.medeoPlugin.invoke('resources.choose_directories', access.full ? { full: true } : {}),
|
|
70
|
+
list: () => globalThis.medeoPlugin.invoke('resources.list'),
|
|
71
|
+
revoke: (id) => globalThis.medeoPlugin.invoke('resources.revoke', { id }),
|
|
72
|
+
requestDirectory: (path, reason, access = {}) => globalThis.medeoPlugin.invoke('resources.request_directory', { path, reason, ...(access.full ? { full: true } : {}) }),
|
|
73
|
+
};
|
|
74
|
+
/** Generic registered-provider entry point; the Host remains the authority. */
|
|
75
|
+
export const capabilities = {
|
|
76
|
+
list: () => globalThis.medeoPlugin.invoke('capabilities.list'),
|
|
77
|
+
labels: () => globalThis.medeoPlugin.invoke('capabilities.labels'),
|
|
78
|
+
invoke: (method, args = {}) => globalThis.medeoPlugin.invoke(method, args),
|
|
79
|
+
};
|
|
80
|
+
export const clipboard = { read: () => globalThis.medeoPlugin.invoke('clipboard.read'), write: (text) => globalThis.medeoPlugin.invoke('clipboard.write', { text }) };
|
|
81
|
+
export const system = { info: () => globalThis.medeoPlugin.invoke('system.info'), running: (rules) => capabilities.invoke('system.running', { rules }) };
|
|
82
|
+
/** `runtime: "node"` plugins only (the `node` permission): moves up to 256 absolute
|
|
83
|
+
* paths to the OS Trash, the one thing Node cannot do itself. A failure does not stop the rest. */
|
|
84
|
+
export const trash = (paths) => globalThis.medeoPlugin.invoke('system.trash', { paths });
|
|
85
|
+
export const notifications = { show: (id, title, body) => globalThis.medeoPlugin.invoke('notifications.show', { id, title, body }), close: (id) => globalThis.medeoPlugin.invoke('notifications.close', { id }) };
|
|
86
|
+
export const power = { start: (type) => globalThis.medeoPlugin.invoke('power.start', { type }), stop: (id) => globalThis.medeoPlugin.invoke('power.stop', { id }), state: () => globalThis.medeoPlugin.invoke('power.state') };
|
|
87
|
+
export const shortcuts = { list: () => globalThis.medeoPlugin.invoke('shortcuts.list'), register: (id, accelerator, openUI = false) => globalThis.medeoPlugin.invoke('shortcuts.register', { id, accelerator, open_ui: openUI }), unregister: (id) => globalThis.medeoPlugin.invoke('shortcuts.unregister', { id }), events: () => globalThis.medeoPlugin.invoke('shortcuts.events') };
|
|
88
|
+
/** `panel: true` (macOS): a frameless window floating over every app and Space that does not
|
|
89
|
+
* activate Medeo — the app the user was in keeps focus — opened at the pointer and hidden (not
|
|
90
|
+
* closed) when it loses focus; opening it again moves it to the pointer. `hide` keeps a window
|
|
91
|
+
* and its page alive for the next `open`/`focus`. */
|
|
92
|
+
export const appWindows = { open: (options) => globalThis.medeoPlugin.invoke('windows.open', options), close: (id) => globalThis.medeoPlugin.invoke('windows.close', { id }), focus: (id) => globalThis.medeoPlugin.invoke('windows.focus', { id }), hide: (id) => globalThis.medeoPlugin.invoke('windows.hide', { id }), list: () => globalThis.medeoPlugin.invoke('windows.list') };
|
|
93
|
+
export const tray = { set: (title, items, options = {}) => globalThis.medeoPlugin.invoke('tray.set', { title, items, ...options }), remove: () => globalThis.medeoPlugin.invoke('tray.remove'), events: () => globalThis.medeoPlugin.invoke('tray.events') };
|
|
94
|
+
export const external = { open: (url) => globalThis.medeoPlugin.invoke('external.open', { url }) };
|
|
95
|
+
export const permissions = { request: (permission, reason) => globalThis.medeoPlugin.invoke('permissions.request', { permission, reason }) };
|
|
96
|
+
export const approvals = {
|
|
97
|
+
request: (request) => globalThis.medeoPlugin.invoke('approvals.request', { ...request }),
|
|
98
|
+
rules: () => globalThis.medeoPlugin.invoke('approvals.rules'),
|
|
99
|
+
forget: (action, pattern) => globalThis.medeoPlugin.invoke('approvals.forget', { action, pattern }),
|
|
100
|
+
};
|
|
101
|
+
export const agent = {
|
|
102
|
+
models: () => capabilities.invoke('agent.models', {}),
|
|
103
|
+
start: (messages, model) => capabilities.invoke('agent.start', { messages, ...(model ? { model } : {}) }),
|
|
104
|
+
state: (id) => operations.state(id),
|
|
105
|
+
cancel: (id) => operations.cancel(id),
|
|
106
|
+
release: (id) => operations.release(id),
|
|
107
|
+
/** Calls `onText` as the reply streams in; resolves with the final job. */
|
|
108
|
+
async follow(id, onText) {
|
|
109
|
+
for (;;) {
|
|
110
|
+
const change = nextChange(id, 2000);
|
|
111
|
+
const job = await agent.state(id);
|
|
112
|
+
onText(job);
|
|
113
|
+
if (job.status !== 'running') {
|
|
114
|
+
change.off();
|
|
115
|
+
return job;
|
|
116
|
+
}
|
|
117
|
+
await change.promise;
|
|
118
|
+
change.off();
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
export const applications = {
|
|
123
|
+
/** The whole inventory; plugins rank and filter it themselves. */
|
|
124
|
+
list: (refresh = false) => capabilities.invoke('applications.list', { refresh }),
|
|
125
|
+
launch: (id) => capabilities.invoke('applications.launch', { id }),
|
|
126
|
+
state: () => capabilities.invoke('applications.state', {}),
|
|
127
|
+
};
|
|
128
|
+
export const capture = {
|
|
129
|
+
status: (refresh = true) => capabilities.invoke('capture.status', { refresh }),
|
|
130
|
+
sources: (refresh = false, requestPermission = false) => capabilities.invoke('capture.sources', { refresh, request_permission: requestPermission }),
|
|
131
|
+
start: (source, options = {}) => capabilities.invoke('capture.start', { source, microphone: options.microphone ?? false, system_audio: options.systemAudio ?? false }),
|
|
132
|
+
state: () => capabilities.invoke('capture.state', {}),
|
|
133
|
+
stop: (id) => capabilities.invoke('capture.stop', { id }),
|
|
134
|
+
cancel: (id) => capabilities.invoke('capture.cancel', { id }),
|
|
135
|
+
recover: (id) => capabilities.invoke('capture.recover', { id }),
|
|
136
|
+
open: (id, mode = 'play') => capabilities.invoke('capture.open', { id, mode }),
|
|
137
|
+
previewURL: (id) => location.origin + '/_capture/' + encodeURIComponent(id) + '.mp4',
|
|
138
|
+
};
|
|
139
|
+
export const inputMethod = {
|
|
140
|
+
system: (refresh = false) => capabilities.invoke('input_method.system', { refresh }),
|
|
141
|
+
setup: () => capabilities.invoke('input_method.setup'),
|
|
142
|
+
remove: () => capabilities.invoke('input_method.remove'),
|
|
143
|
+
settings: () => capabilities.invoke('input_method.settings'),
|
|
144
|
+
status: () => capabilities.invoke('input_method.status'),
|
|
145
|
+
configure: (name) => capabilities.invoke('input_method.configure', { name }),
|
|
146
|
+
enable: () => capabilities.invoke('input_method.enable'),
|
|
147
|
+
disable: () => capabilities.invoke('input_method.disable'),
|
|
148
|
+
events: () => capabilities.invoke('input_method.events'),
|
|
149
|
+
respond: (id, candidates) => capabilities.invoke('input_method.respond', { id, candidates }),
|
|
150
|
+
};
|
|
151
|
+
export const network = {
|
|
152
|
+
origins: () => capabilities.invoke('network.origins'),
|
|
153
|
+
requestOrigin: (origin, reason) => capabilities.invoke('network.request_origin', { origin, reason }),
|
|
154
|
+
revokeOrigin: (origin) => capabilities.invoke('network.revoke_origin', { origin }),
|
|
155
|
+
request: (request) => capabilities.invoke('network.request', { ...request }),
|
|
156
|
+
state: (id) => operations.state(id),
|
|
157
|
+
read: (id, offset = 0, length = 32768) => capabilities.invoke('network.read', { id, offset, length }),
|
|
158
|
+
cancel: (id) => operations.cancel(id),
|
|
159
|
+
release: (id) => operations.release(id),
|
|
160
|
+
/** Resolves once the response has fully arrived; the job stays readable until released. */
|
|
161
|
+
async settled(id) { for (;;) {
|
|
162
|
+
const change = nextChange(id, 2000);
|
|
163
|
+
const state = await network.state(id);
|
|
164
|
+
if (state.status !== 'running') {
|
|
165
|
+
change.off();
|
|
166
|
+
return state;
|
|
167
|
+
}
|
|
168
|
+
await change.promise;
|
|
169
|
+
change.off();
|
|
170
|
+
} },
|
|
171
|
+
async text(id) {
|
|
172
|
+
const decoder = new TextDecoder();
|
|
173
|
+
let offset = 0, text = '';
|
|
174
|
+
for (;;) {
|
|
175
|
+
const part = await network.read(id, offset);
|
|
176
|
+
const bytes = Uint8Array.from(atob(part.data_base64), c => c.charCodeAt(0));
|
|
177
|
+
text += decoder.decode(bytes, { stream: !part.eof });
|
|
178
|
+
if (part.eof)
|
|
179
|
+
return text;
|
|
180
|
+
offset = part.next_offset;
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
};
|
|
184
|
+
export const files = {
|
|
185
|
+
backupPreview: (root, record) => capabilities.invoke('files.backup_preview', { root, record }),
|
|
186
|
+
archiveBackup: (preview) => capabilities.invoke('files.archive_backup', { preview }),
|
|
187
|
+
forgetPreview: (root, record) => capabilities.invoke('files.forget_preview', { root, record }),
|
|
188
|
+
forgetRecord: (preview) => capabilities.invoke('files.forget_record', { preview }),
|
|
189
|
+
historyPage: (root, cursor, limit = 50) => capabilities.invoke('files.history_page', { root, ...(cursor ? { cursor } : {}), limit }),
|
|
190
|
+
trashPreview: (root, path) => capabilities.invoke('files.trash_preview', { root, path }),
|
|
191
|
+
discardPreview: (preview) => capabilities.invoke('files.discard_preview', { preview }),
|
|
192
|
+
trash: (preview) => capabilities.invoke('files.trash', { preview }),
|
|
193
|
+
/** Breadth-first listings of a whole tree in one call. Hidden and `skip`
|
|
194
|
+
* directories are listed by their parent but not entered. */
|
|
195
|
+
listTree: (root, path = '', options = {}) => capabilities.invoke('files.list_tree', { root, path, ...options }),
|
|
196
|
+
/** Full-access roots only: move entries to the Trash without a Host confirmation.
|
|
197
|
+
* `stamp` is what `files.measure` returned; a changed entry is refused, not moved. */
|
|
198
|
+
trashDirect: (items) => capabilities.invoke('files.trash_direct', { items }),
|
|
199
|
+
watch: (root, path = '', recursive = false) => capabilities.invoke('files.watch', { root, path, recursive }),
|
|
200
|
+
watches: () => capabilities.invoke('files.watches'),
|
|
201
|
+
events: (id, after = 0) => capabilities.invoke('files.events', { id, after }),
|
|
202
|
+
unwatch: (id) => capabilities.invoke('files.unwatch', { id }),
|
|
203
|
+
roots: () => capabilities.invoke('files.roots'),
|
|
204
|
+
list: (root, path = '') => capabilities.invoke('files.list', { root, path }),
|
|
205
|
+
stat: (root, path = '') => capabilities.invoke('files.stat', { root, path }),
|
|
206
|
+
readText: (root, path, revision) => capabilities.invoke('files.read_text', { root, path, ...(revision ? { revision } : {}) }),
|
|
207
|
+
writeText: (root, path, text, revision) => capabilities.invoke('files.write_text', { root, path, text, revision }),
|
|
208
|
+
mkdir: (root, path) => capabilities.invoke('files.mkdir', { root, path }),
|
|
209
|
+
move: (root, path, destination, revision) => capabilities.invoke('files.move', { root, path, destination, revision }),
|
|
210
|
+
history: (root) => capabilities.invoke('files.history', { root }),
|
|
211
|
+
restore: (root, record) => capabilities.invoke('files.restore', { root, record }),
|
|
212
|
+
state: (id) => operations.state(id),
|
|
213
|
+
cancel: (id) => operations.cancel(id),
|
|
214
|
+
release: (id) => operations.release(id),
|
|
215
|
+
result: (job) => operations.wait(job),
|
|
216
|
+
};
|
|
217
|
+
async function secretOperation(method, args) {
|
|
218
|
+
const job = await capabilities.invoke('secrets.' + method, args);
|
|
219
|
+
const deadline = Date.now() + 30000;
|
|
220
|
+
for (;;) {
|
|
221
|
+
const change = nextChange(job.id, 1000);
|
|
222
|
+
const result = await capabilities.invoke('secrets.result', { id: job.id });
|
|
223
|
+
if (result.status !== 'running')
|
|
224
|
+
change.off();
|
|
225
|
+
if (result.status === 'completed')
|
|
226
|
+
return result.value ?? null;
|
|
227
|
+
if (result.status === 'failed')
|
|
228
|
+
throw Error(result.error ?? 'secrets_storage_failed');
|
|
229
|
+
if (Date.now() >= deadline) {
|
|
230
|
+
change.off();
|
|
231
|
+
throw Error('secrets_outcome_unknown');
|
|
232
|
+
}
|
|
233
|
+
await change.promise;
|
|
234
|
+
change.off();
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
export const secrets = {
|
|
238
|
+
get: (key) => secretOperation('get', { key }),
|
|
239
|
+
set: async (key, value) => { await secretOperation('set', { key, value }); },
|
|
240
|
+
remove: async (key) => { await secretOperation('remove', { key }); },
|
|
241
|
+
};
|
|
242
|
+
/** A loopback server is instance-owned and never survives Host restart. Keep the
|
|
243
|
+
* start token in private memory and serve requests in a worker for background use. */
|
|
244
|
+
export const server = {
|
|
245
|
+
start: (options) => capabilities.invoke('server.start', { ...options }),
|
|
246
|
+
state: (id) => capabilities.invoke('server.state', { id }),
|
|
247
|
+
list: () => capabilities.invoke('server.state'),
|
|
248
|
+
events: (id, limit = 8) => capabilities.invoke('server.events', { id, limit }),
|
|
249
|
+
respond: (id, request, response) => capabilities.invoke('server.respond', { id, request, ...response }),
|
|
250
|
+
stop: (id) => capabilities.invoke('server.stop', { id }),
|
|
251
|
+
};
|
|
252
|
+
/** Text is formatted in Rust from the signed package. Render with textContent,
|
|
253
|
+
* never innerHTML. Register listeners before initial state fetch to avoid races. */
|
|
254
|
+
export const i18n = {
|
|
255
|
+
state: () => capabilities.invoke('i18n.state'),
|
|
256
|
+
setLocale: (preference) => capabilities.invoke('i18n.setLocale', { preference }),
|
|
257
|
+
t: (key, params = {}) => capabilities.invoke('i18n.t', { key, params }),
|
|
258
|
+
/** Every message of the effective locale (default-locale fallback merged in). */
|
|
259
|
+
catalog: () => capabilities.invoke('i18n.catalog'),
|
|
260
|
+
onDidChangeLocale: (callback) => globalThis.medeoPlugin.onLocaleChanged(callback),
|
|
261
|
+
};
|
|
262
|
+
export const operations = {
|
|
263
|
+
state: (id) => capabilities.invoke('operations.state', { id }),
|
|
264
|
+
list: () => capabilities.invoke('operations.list'),
|
|
265
|
+
cancel: (id) => capabilities.invoke('operations.cancel', { id }),
|
|
266
|
+
release: (id) => capabilities.invoke('operations.release', { id }),
|
|
267
|
+
async wait(operation, signal) {
|
|
268
|
+
let value = operation;
|
|
269
|
+
while (value.status === 'running') {
|
|
270
|
+
if (signal?.aborted) {
|
|
271
|
+
await operations.cancel(value.id);
|
|
272
|
+
throw Error('cancelled');
|
|
273
|
+
}
|
|
274
|
+
const change = nextChange(value.id, 2000);
|
|
275
|
+
value = await operations.state(value.id);
|
|
276
|
+
if (value.status === 'running')
|
|
277
|
+
await change.promise;
|
|
278
|
+
change.off();
|
|
279
|
+
}
|
|
280
|
+
// Quick reads may come back settled and already released by the Host.
|
|
281
|
+
if (!value.released)
|
|
282
|
+
await operations.release(value.id);
|
|
283
|
+
if (value.status !== 'completed')
|
|
284
|
+
throw Error(value.error ?? value.status);
|
|
285
|
+
return value.result;
|
|
286
|
+
},
|
|
287
|
+
};
|
|
288
|
+
const nativeCall = (method, args = {}) => capabilities.invoke(method, args);
|
|
289
|
+
function mediaProvider(kind) {
|
|
290
|
+
return {
|
|
291
|
+
status: () => nativeCall(kind + '.status'),
|
|
292
|
+
start: (maxSeconds = 300) => nativeCall(kind + '.start', { max_seconds: maxSeconds }),
|
|
293
|
+
stop: (id) => nativeCall(kind + '.stop', { id }),
|
|
294
|
+
state: (id) => nativeCall(kind + '.state', id ? { id } : {}),
|
|
295
|
+
read: (id, offset = 0, length = 32768) => nativeCall(kind + '.read', { id, offset, length }),
|
|
296
|
+
/** Same-origin URL for an `<audio>` / `<video>` element; plays once the record is "completed". */
|
|
297
|
+
previewURL: (record) => location.origin + '/_media/' + encodeURIComponent(record.id) + (record.extension === 'm4a' ? '.m4a' : '.mp4'),
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
export const camera = mediaProvider('camera'), microphone = mediaProvider('microphone'), systemAudio = mediaProvider('system_audio');
|
|
301
|
+
export const accessibility = { status: () => nativeCall('accessibility.status'), request: () => nativeCall('accessibility.request'), windows: () => nativeCall('accessibility.windows'), focus: (id) => nativeCall('accessibility.focus', { id }), selectedText: (id) => nativeCall('accessibility.selected_text', { id }), insertText: (focus, text) => nativeCall('accessibility.insert_text', { id: focus, text }) };
|
|
302
|
+
export const browserView = { open: (id, url, width = 1000, height = 720) => capabilities.invoke('browser.open', { id, url, width, height }), state: (id) => capabilities.invoke('browser.state', { id }), close: (id) => capabilities.invoke('browser.close', { id }) };
|
|
303
|
+
export const printing = { print: (text) => capabilities.invoke('printing.print', { text }) };
|
|
304
|
+
export const processes = { start: (executable, args = [], timeoutMs = 60000) => nativeCall('process.start', { executable, arguments: args, timeout_ms: timeoutMs }), state: (id) => nativeCall('process.state', { id }), write: (id, text) => nativeCall('process.write', { id, text }), stop: (id) => nativeCall('process.stop', { id }) };
|
|
305
|
+
export const background = { schedule: (id, delayMs, payload = null, intervalMs = 0) => capabilities.invoke('background.schedule', { id, delay_ms: delayMs, interval_ms: intervalMs, payload }), list: () => capabilities.invoke('background.list'), cancel: (id) => capabilities.invoke('background.cancel', { id }), events: () => capabilities.invoke('background.events') };
|
|
306
|
+
export const contacts = { status: () => nativeCall('contacts.status'), request: () => nativeCall('contacts.request'), list: (query = '', limit = 50) => nativeCall('contacts.list', { query, limit }), save: (contact) => nativeCall('contacts.save', contact) };
|
|
307
|
+
export const calendar = { status: () => nativeCall('calendar.status'), request: () => nativeCall('calendar.request'), list: (startMs, endMs, limit = 50) => nativeCall('calendar.list', { start_ms: startMs, end_ms: endMs, limit }), save: (event) => nativeCall('calendar.save', event) };
|
|
308
|
+
export const deviceLocation = { status: () => nativeCall('location.status'), request: () => nativeCall('location.request'), current: () => nativeCall('location.current') };
|
|
309
|
+
export const devices = { choose: (transport) => nativeCall('devices.choose', { transport }), open: (id, baudRate = 115200) => nativeCall('devices.open', { id, baud_rate: baudRate }), list: () => nativeCall('devices.list'), read: (id, length = 4096) => nativeCall('devices.read', { id, length }), write: (id, dataBase64) => nativeCall('devices.write', { id, data_base64: dataBase64 }), close: (id) => nativeCall('devices.close', { id }) };
|