@medeo-plugin/sdk 0.8.0 → 0.9.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/dist/generated.d.ts +28 -1
- package/dist/index.d.ts +63 -1
- package/dist/index.js +21 -1
- package/dist/registry.d.ts +42 -0
- package/dist/registry.js +6 -0
- package/package.json +1 -1
- package/src/generated.ts +28 -2
- package/src/index.ts +30 -2
- package/src/registry.ts +6 -0
package/dist/generated.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export type Permission = "storage" | "creation_open" | {
|
|
|
7
7
|
"file_full_access": Array<string>;
|
|
8
8
|
} | {
|
|
9
9
|
"network": Array<string>;
|
|
10
|
-
} | "agent_api" | "clipboard_read" | "clipboard_write" | "screen_capture" | "camera" | "microphone" | "system_audio" | "applications" | "global_shortcuts" | "notifications" | "tray" | "app_windows" | "accessibility" | "input_method" | {
|
|
10
|
+
} | "agent_api" | "clipboard_read" | "clipboard_write" | "screen_capture" | "camera" | "microphone" | "system_audio" | "applications" | "global_shortcuts" | "notifications" | "tray" | "app_windows" | "accessibility" | "window_management" | "input_method" | {
|
|
11
11
|
"external_open": Array<string>;
|
|
12
12
|
} | {
|
|
13
13
|
"browser_view": Array<string>;
|
|
@@ -157,6 +157,28 @@ export type PackageSignature = {
|
|
|
157
157
|
signature: string;
|
|
158
158
|
index: string;
|
|
159
159
|
};
|
|
160
|
+
export type About = {
|
|
161
|
+
/**
|
|
162
|
+
* Display name of the author, at most 80 characters. Official packages show Medeo.
|
|
163
|
+
*/
|
|
164
|
+
author?: string;
|
|
165
|
+
/**
|
|
166
|
+
* SPDX license expression, at most 64 characters.
|
|
167
|
+
*/
|
|
168
|
+
license?: string;
|
|
169
|
+
/**
|
|
170
|
+
* Project website.
|
|
171
|
+
*/
|
|
172
|
+
homepage?: string;
|
|
173
|
+
/**
|
|
174
|
+
* Source repository.
|
|
175
|
+
*/
|
|
176
|
+
repository?: string;
|
|
177
|
+
/**
|
|
178
|
+
* Where users report problems.
|
|
179
|
+
*/
|
|
180
|
+
bugs?: string;
|
|
181
|
+
};
|
|
160
182
|
export type PackageInfo = {
|
|
161
183
|
manifest: Manifest;
|
|
162
184
|
digest: string;
|
|
@@ -171,6 +193,11 @@ export type PackageInfo = {
|
|
|
171
193
|
* shown at install and in the developer log, never a reason to refuse.
|
|
172
194
|
*/
|
|
173
195
|
warnings?: Array<string>;
|
|
196
|
+
/**
|
|
197
|
+
* The package's signed `about.json` (author, license, links), when valid.
|
|
198
|
+
* Older Medeo ignore the file, so declaring it never blocks installation.
|
|
199
|
+
*/
|
|
200
|
+
about?: About;
|
|
174
201
|
};
|
|
175
202
|
export type CapabilityDescriptor = {
|
|
176
203
|
permission: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -193,7 +193,13 @@ export declare const shortcuts: {
|
|
|
193
193
|
/** `panel: true` (macOS): a frameless window floating over every app and Space that does not
|
|
194
194
|
* activate Medeo — the app the user was in keeps focus — opened at the pointer and hidden (not
|
|
195
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`.
|
|
196
|
+
* and its page alive for the next `open`/`focus`.
|
|
197
|
+
* `overlay: true` (macOS, needs `window_management` too): a transparent, shadowless panel covering
|
|
198
|
+
* the whole display under the pointer (menu bar included), above full-screen apps — for previews
|
|
199
|
+
* and radial menus. It takes keyboard focus without activating Medeo, hides when it loses focus,
|
|
200
|
+
* and each `open` moves it to the pointer's display; `width`/`height` are ignored. The page's
|
|
201
|
+
* `window.screenX/screenY` is the display's top-left in the same global points as
|
|
202
|
+
* `windowManagement`. `panel` and `overlay` are exclusive. */
|
|
197
203
|
export declare const appWindows: {
|
|
198
204
|
open: (options: {
|
|
199
205
|
id: string;
|
|
@@ -202,6 +208,7 @@ export declare const appWindows: {
|
|
|
202
208
|
width: number;
|
|
203
209
|
height: number;
|
|
204
210
|
panel?: boolean;
|
|
211
|
+
overlay?: boolean;
|
|
205
212
|
}) => Promise<unknown>;
|
|
206
213
|
close: (id: string) => Promise<unknown>;
|
|
207
214
|
focus: (id: string) => Promise<unknown>;
|
|
@@ -801,6 +808,61 @@ export declare const accessibility: {
|
|
|
801
808
|
}>>;
|
|
802
809
|
insertText: (focus: string, text: string) => Promise<NativeOperation<unknown>>;
|
|
803
810
|
};
|
|
811
|
+
/** A rectangle in global points: origin at the top-left of the main display, y grows downwards
|
|
812
|
+
* (displays left of or above the main one have negative coordinates). */
|
|
813
|
+
export interface WindowFrame {
|
|
814
|
+
x: number;
|
|
815
|
+
y: number;
|
|
816
|
+
width: number;
|
|
817
|
+
height: number;
|
|
818
|
+
}
|
|
819
|
+
/** The frontmost window of another app. `id` stays the same for the same window while it lives. */
|
|
820
|
+
export interface ManagedWindow {
|
|
821
|
+
id: string;
|
|
822
|
+
title: string;
|
|
823
|
+
application: string;
|
|
824
|
+
bundle_id: string;
|
|
825
|
+
frame: WindowFrame;
|
|
826
|
+
resizable: boolean;
|
|
827
|
+
fullscreen: boolean;
|
|
828
|
+
minimized: boolean;
|
|
829
|
+
standard: boolean;
|
|
830
|
+
}
|
|
831
|
+
/** `visible_frame` excludes the menu bar and the Dock. `id` is the display number for this session,
|
|
832
|
+
* `uuid` survives restarts and reconnecting. The first entry is the main display. */
|
|
833
|
+
export interface ManagedScreen {
|
|
834
|
+
id: string;
|
|
835
|
+
uuid: string;
|
|
836
|
+
name: string;
|
|
837
|
+
primary: boolean;
|
|
838
|
+
scale: number;
|
|
839
|
+
frame: WindowFrame;
|
|
840
|
+
visible_frame: WindowFrame;
|
|
841
|
+
}
|
|
842
|
+
/** Window management (macOS, permission `window_management`, OS Accessibility). All calls are
|
|
843
|
+
* operations: `operations.wait(await windowManagement.focused())`. `request` opens the system
|
|
844
|
+
* prompt and is window-only; the others work in the worker too. `focused` never returns a Medeo window:
|
|
845
|
+
* when Medeo is in front (a plugin's own page) it is the window of the app right behind it, and `null`
|
|
846
|
+
* when there is none or the frontmost app has no window; `set_frame` reports the frame the app
|
|
847
|
+
* actually accepted (apps may clamp sizes) and fails with `resource_missing` once the window is gone. */
|
|
848
|
+
export declare const windowManagement: {
|
|
849
|
+
status: () => Promise<NativeOperation<{
|
|
850
|
+
authorization: "granted" | "denied";
|
|
851
|
+
}>>;
|
|
852
|
+
request: () => Promise<NativeOperation<{
|
|
853
|
+
authorization: "granted" | "denied";
|
|
854
|
+
}>>;
|
|
855
|
+
focused: () => Promise<NativeOperation<ManagedWindow | null>>;
|
|
856
|
+
setFrame: (id: string, frame: WindowFrame) => Promise<NativeOperation<{
|
|
857
|
+
frame: WindowFrame;
|
|
858
|
+
resized: boolean;
|
|
859
|
+
}>>;
|
|
860
|
+
screens: () => Promise<NativeOperation<ManagedScreen[]>>;
|
|
861
|
+
pointer: () => Promise<NativeOperation<{
|
|
862
|
+
x: number;
|
|
863
|
+
y: number;
|
|
864
|
+
}>>;
|
|
865
|
+
};
|
|
804
866
|
export declare const browserView: {
|
|
805
867
|
open: (id: string, url: string, width?: number, height?: number) => Promise<unknown>;
|
|
806
868
|
state: (id: string) => Promise<unknown>;
|
package/dist/index.js
CHANGED
|
@@ -88,7 +88,13 @@ export const shortcuts = { list: () => globalThis.medeoPlugin.invoke('shortcuts.
|
|
|
88
88
|
/** `panel: true` (macOS): a frameless window floating over every app and Space that does not
|
|
89
89
|
* activate Medeo — the app the user was in keeps focus — opened at the pointer and hidden (not
|
|
90
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`.
|
|
91
|
+
* and its page alive for the next `open`/`focus`.
|
|
92
|
+
* `overlay: true` (macOS, needs `window_management` too): a transparent, shadowless panel covering
|
|
93
|
+
* the whole display under the pointer (menu bar included), above full-screen apps — for previews
|
|
94
|
+
* and radial menus. It takes keyboard focus without activating Medeo, hides when it loses focus,
|
|
95
|
+
* and each `open` moves it to the pointer's display; `width`/`height` are ignored. The page's
|
|
96
|
+
* `window.screenX/screenY` is the display's top-left in the same global points as
|
|
97
|
+
* `windowManagement`. `panel` and `overlay` are exclusive. */
|
|
92
98
|
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
99
|
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
100
|
export const external = { open: (url) => globalThis.medeoPlugin.invoke('external.open', { url }) };
|
|
@@ -414,6 +420,20 @@ function mediaProvider(kind) {
|
|
|
414
420
|
}
|
|
415
421
|
export const camera = mediaProvider('camera'), microphone = mediaProvider('microphone'), systemAudio = mediaProvider('system_audio');
|
|
416
422
|
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 }) };
|
|
423
|
+
/** Window management (macOS, permission `window_management`, OS Accessibility). All calls are
|
|
424
|
+
* operations: `operations.wait(await windowManagement.focused())`. `request` opens the system
|
|
425
|
+
* prompt and is window-only; the others work in the worker too. `focused` never returns a Medeo window:
|
|
426
|
+
* when Medeo is in front (a plugin's own page) it is the window of the app right behind it, and `null`
|
|
427
|
+
* when there is none or the frontmost app has no window; `set_frame` reports the frame the app
|
|
428
|
+
* actually accepted (apps may clamp sizes) and fails with `resource_missing` once the window is gone. */
|
|
429
|
+
export const windowManagement = {
|
|
430
|
+
status: () => nativeCall('window_management.status'),
|
|
431
|
+
request: () => nativeCall('window_management.request'),
|
|
432
|
+
focused: () => nativeCall('window_management.focused'),
|
|
433
|
+
setFrame: (id, frame) => nativeCall('window_management.set_frame', { id, x: frame.x, y: frame.y, width: frame.width, height: frame.height }),
|
|
434
|
+
screens: () => nativeCall('window_management.screens'),
|
|
435
|
+
pointer: () => nativeCall('window_management.pointer'),
|
|
436
|
+
};
|
|
417
437
|
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 }) };
|
|
418
438
|
export const printing = { print: (text) => capabilities.invoke('printing.print', { text }) };
|
|
419
439
|
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 }) };
|
package/dist/registry.d.ts
CHANGED
|
@@ -713,6 +713,48 @@ export declare const METHODS: {
|
|
|
713
713
|
readonly confirm: false;
|
|
714
714
|
readonly adapter: "host";
|
|
715
715
|
};
|
|
716
|
+
readonly "window_management.status": {
|
|
717
|
+
readonly permission: "window_management";
|
|
718
|
+
readonly provider: "medeo.system-services";
|
|
719
|
+
readonly ui: false;
|
|
720
|
+
readonly confirm: false;
|
|
721
|
+
readonly adapter: "host";
|
|
722
|
+
};
|
|
723
|
+
readonly "window_management.request": {
|
|
724
|
+
readonly permission: "window_management";
|
|
725
|
+
readonly provider: "medeo.system-services";
|
|
726
|
+
readonly ui: true;
|
|
727
|
+
readonly confirm: false;
|
|
728
|
+
readonly adapter: "host";
|
|
729
|
+
};
|
|
730
|
+
readonly "window_management.focused": {
|
|
731
|
+
readonly permission: "window_management";
|
|
732
|
+
readonly provider: "medeo.system-services";
|
|
733
|
+
readonly ui: false;
|
|
734
|
+
readonly confirm: false;
|
|
735
|
+
readonly adapter: "host";
|
|
736
|
+
};
|
|
737
|
+
readonly "window_management.set_frame": {
|
|
738
|
+
readonly permission: "window_management";
|
|
739
|
+
readonly provider: "medeo.system-services";
|
|
740
|
+
readonly ui: false;
|
|
741
|
+
readonly confirm: false;
|
|
742
|
+
readonly adapter: "host";
|
|
743
|
+
};
|
|
744
|
+
readonly "window_management.screens": {
|
|
745
|
+
readonly permission: "window_management";
|
|
746
|
+
readonly provider: "medeo.system-services";
|
|
747
|
+
readonly ui: false;
|
|
748
|
+
readonly confirm: false;
|
|
749
|
+
readonly adapter: "host";
|
|
750
|
+
};
|
|
751
|
+
readonly "window_management.pointer": {
|
|
752
|
+
readonly permission: "window_management";
|
|
753
|
+
readonly provider: "medeo.system-services";
|
|
754
|
+
readonly ui: false;
|
|
755
|
+
readonly confirm: false;
|
|
756
|
+
readonly adapter: "host";
|
|
757
|
+
};
|
|
716
758
|
readonly "input_method.status": {
|
|
717
759
|
readonly permission: "input_method";
|
|
718
760
|
readonly provider: "medeo.input-method";
|
package/dist/registry.js
CHANGED
|
@@ -102,6 +102,12 @@ export const METHODS = {
|
|
|
102
102
|
"accessibility.focus": { permission: "accessibility", provider: "medeo.system-services", ui: true, confirm: false, adapter: "host" },
|
|
103
103
|
"accessibility.selected_text": { permission: "accessibility", provider: "medeo.system-services", ui: true, confirm: false, adapter: "host" },
|
|
104
104
|
"accessibility.insert_text": { permission: "accessibility", provider: "medeo.system-services", ui: true, confirm: false, adapter: "host" },
|
|
105
|
+
"window_management.status": { permission: "window_management", provider: "medeo.system-services", ui: false, confirm: false, adapter: "host" },
|
|
106
|
+
"window_management.request": { permission: "window_management", provider: "medeo.system-services", ui: true, confirm: false, adapter: "host" },
|
|
107
|
+
"window_management.focused": { permission: "window_management", provider: "medeo.system-services", ui: false, confirm: false, adapter: "host" },
|
|
108
|
+
"window_management.set_frame": { permission: "window_management", provider: "medeo.system-services", ui: false, confirm: false, adapter: "host" },
|
|
109
|
+
"window_management.screens": { permission: "window_management", provider: "medeo.system-services", ui: false, confirm: false, adapter: "host" },
|
|
110
|
+
"window_management.pointer": { permission: "window_management", provider: "medeo.system-services", ui: false, confirm: false, adapter: "host" },
|
|
105
111
|
"input_method.status": { permission: "input_method", provider: "medeo.input-method", ui: false, confirm: false, adapter: "host" },
|
|
106
112
|
"input_method.configure": { permission: "input_method", provider: "medeo.input-method", ui: false, confirm: false, adapter: "host" },
|
|
107
113
|
"input_method.enable": { permission: "input_method", provider: "medeo.input-method", ui: true, confirm: false, adapter: "host" },
|
package/package.json
CHANGED
package/src/generated.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Generated by platform-contract; do not edit.
|
|
2
2
|
export type JsonValue = number | string | boolean | Array<JsonValue> | { [key in string]?: JsonValue } | null;
|
|
3
|
-
export type Permission = "storage" | "creation_open" | { "file_access": Array<string> } | { "file_full_access": Array<string> } | { "network": Array<string> } | "agent_api" | "clipboard_read" | "clipboard_write" | "screen_capture" | "camera" | "microphone" | "system_audio" | "applications" | "global_shortcuts" | "notifications" | "tray" | "app_windows" | "accessibility" | "input_method" | { "external_open": Array<string> } | { "browser_view": Array<string> } | "system_info" | "secrets" | "background_tasks" | "power" | { "process_spawn": Array<string> } | "local_server" | "printing" | "contacts" | "calendar" | "location" | "device_access" | { "approvals": Array<string> } | "node";
|
|
3
|
+
export type Permission = "storage" | "creation_open" | { "file_access": Array<string> } | { "file_full_access": Array<string> } | { "network": Array<string> } | "agent_api" | "clipboard_read" | "clipboard_write" | "screen_capture" | "camera" | "microphone" | "system_audio" | "applications" | "global_shortcuts" | "notifications" | "tray" | "app_windows" | "accessibility" | "window_management" | "input_method" | { "external_open": Array<string> } | { "browser_view": Array<string> } | "system_info" | "secrets" | "background_tasks" | "power" | { "process_spawn": Array<string> } | "local_server" | "printing" | "contacts" | "calendar" | "location" | "device_access" | { "approvals": Array<string> } | "node";
|
|
4
4
|
export type PluginCommand = { id: string, title: string, };
|
|
5
5
|
export type PluginLocalization = { default_locale: string, catalogs: { [key in string]?: string }, };
|
|
6
6
|
export type Runtime = "sandbox" | "node";
|
|
@@ -76,6 +76,27 @@ export type PackageFile = { size: number, sha256: string, };
|
|
|
76
76
|
export type PackageIndex = { manifest: Manifest, files: { [key in string]?: PackageFile }, };
|
|
77
77
|
export type Asset = { mime: string, path: string, size: number, sha256: string, };
|
|
78
78
|
export type PackageSignature = { format: number, public_key: string, signature: string, index: string, };
|
|
79
|
+
export type About = {
|
|
80
|
+
/**
|
|
81
|
+
* Display name of the author, at most 80 characters. Official packages show Medeo.
|
|
82
|
+
*/
|
|
83
|
+
author?: string,
|
|
84
|
+
/**
|
|
85
|
+
* SPDX license expression, at most 64 characters.
|
|
86
|
+
*/
|
|
87
|
+
license?: string,
|
|
88
|
+
/**
|
|
89
|
+
* Project website.
|
|
90
|
+
*/
|
|
91
|
+
homepage?: string,
|
|
92
|
+
/**
|
|
93
|
+
* Source repository.
|
|
94
|
+
*/
|
|
95
|
+
repository?: string,
|
|
96
|
+
/**
|
|
97
|
+
* Where users report problems.
|
|
98
|
+
*/
|
|
99
|
+
bugs?: string, };
|
|
79
100
|
export type PackageInfo = { manifest: Manifest, digest: string, publisher: string,
|
|
80
101
|
/**
|
|
81
102
|
* Bytes of all signed files, i.e. the installed size. Records written
|
|
@@ -86,7 +107,12 @@ size: number,
|
|
|
86
107
|
* What this build accepted but does not understand (`unknown_contribution:<key>`);
|
|
87
108
|
* shown at install and in the developer log, never a reason to refuse.
|
|
88
109
|
*/
|
|
89
|
-
warnings?: Array<string>,
|
|
110
|
+
warnings?: Array<string>,
|
|
111
|
+
/**
|
|
112
|
+
* The package's signed `about.json` (author, license, links), when valid.
|
|
113
|
+
* Older Medeo ignore the file, so declaring it never blocks installation.
|
|
114
|
+
*/
|
|
115
|
+
about?: About, };
|
|
90
116
|
export type CapabilityDescriptor = { permission: string, group: string, version: number, scoped: boolean, methods: Array<string>, available_methods: Array<string>, granted: boolean, declared: boolean, os_authorization: string, };
|
|
91
117
|
export type DirectoryGrant = { id: string, name: string, available: boolean,
|
|
92
118
|
/**
|
package/src/index.ts
CHANGED
|
@@ -133,8 +133,14 @@ export const shortcuts = {list:()=>globalThis.medeoPlugin.invoke('shortcuts.list
|
|
|
133
133
|
/** `panel: true` (macOS): a frameless window floating over every app and Space that does not
|
|
134
134
|
* activate Medeo — the app the user was in keeps focus — opened at the pointer and hidden (not
|
|
135
135
|
* closed) when it loses focus; opening it again moves it to the pointer. `hide` keeps a window
|
|
136
|
-
* and its page alive for the next `open`/`focus`.
|
|
137
|
-
|
|
136
|
+
* and its page alive for the next `open`/`focus`.
|
|
137
|
+
* `overlay: true` (macOS, needs `window_management` too): a transparent, shadowless panel covering
|
|
138
|
+
* the whole display under the pointer (menu bar included), above full-screen apps — for previews
|
|
139
|
+
* and radial menus. It takes keyboard focus without activating Medeo, hides when it loses focus,
|
|
140
|
+
* and each `open` moves it to the pointer's display; `width`/`height` are ignored. The page's
|
|
141
|
+
* `window.screenX/screenY` is the display's top-left in the same global points as
|
|
142
|
+
* `windowManagement`. `panel` and `overlay` are exclusive. */
|
|
143
|
+
export const appWindows = {open:(options:{id:string;entry:string;title:string;width:number;height:number;panel?:boolean;overlay?:boolean})=>globalThis.medeoPlugin.invoke('windows.open',options),close:(id:string)=>globalThis.medeoPlugin.invoke('windows.close',{id}),focus:(id:string)=>globalThis.medeoPlugin.invoke('windows.focus',{id}),hide:(id:string)=>globalThis.medeoPlugin.invoke('windows.hide',{id}),list:()=>globalThis.medeoPlugin.invoke('windows.list') as Promise<{id:string;title:string;visible:boolean}[]>};
|
|
138
144
|
/** A menu entry, a checkmarked toggle, or a divider. */
|
|
139
145
|
export type TrayItem = {id:string;title:string;checked?:boolean}|{separator:true};
|
|
140
146
|
/** `icon`: a PNG in the package drawn as a menu-bar template (black + alpha, about 36 px tall);
|
|
@@ -457,6 +463,28 @@ function mediaProvider(kind:'camera'|'microphone'|'system_audio'){return{
|
|
|
457
463
|
}}
|
|
458
464
|
export const camera=mediaProvider('camera'),microphone=mediaProvider('microphone'),systemAudio=mediaProvider('system_audio');
|
|
459
465
|
export const accessibility={status:()=>nativeCall('accessibility.status'),request:()=>nativeCall('accessibility.request'),windows:()=>nativeCall<{id:string;title:string;application:string}[]>('accessibility.windows'),focus:(id:string)=>nativeCall('accessibility.focus',{id}),selectedText:(id:string)=>nativeCall<{id:string;text:string}>('accessibility.selected_text',{id}),insertText:(focus:string,text:string)=>nativeCall('accessibility.insert_text',{id:focus,text})};
|
|
466
|
+
/** A rectangle in global points: origin at the top-left of the main display, y grows downwards
|
|
467
|
+
* (displays left of or above the main one have negative coordinates). */
|
|
468
|
+
export interface WindowFrame {x:number;y:number;width:number;height:number}
|
|
469
|
+
/** The frontmost window of another app. `id` stays the same for the same window while it lives. */
|
|
470
|
+
export interface ManagedWindow {id:string;title:string;application:string;bundle_id:string;frame:WindowFrame;resizable:boolean;fullscreen:boolean;minimized:boolean;standard:boolean}
|
|
471
|
+
/** `visible_frame` excludes the menu bar and the Dock. `id` is the display number for this session,
|
|
472
|
+
* `uuid` survives restarts and reconnecting. The first entry is the main display. */
|
|
473
|
+
export interface ManagedScreen {id:string;uuid:string;name:string;primary:boolean;scale:number;frame:WindowFrame;visible_frame:WindowFrame}
|
|
474
|
+
/** Window management (macOS, permission `window_management`, OS Accessibility). All calls are
|
|
475
|
+
* operations: `operations.wait(await windowManagement.focused())`. `request` opens the system
|
|
476
|
+
* prompt and is window-only; the others work in the worker too. `focused` never returns a Medeo window:
|
|
477
|
+
* when Medeo is in front (a plugin's own page) it is the window of the app right behind it, and `null`
|
|
478
|
+
* when there is none or the frontmost app has no window; `set_frame` reports the frame the app
|
|
479
|
+
* actually accepted (apps may clamp sizes) and fails with `resource_missing` once the window is gone. */
|
|
480
|
+
export const windowManagement={
|
|
481
|
+
status:()=>nativeCall<{authorization:'granted'|'denied'}>('window_management.status'),
|
|
482
|
+
request:()=>nativeCall<{authorization:'granted'|'denied'}>('window_management.request'),
|
|
483
|
+
focused:()=>nativeCall<ManagedWindow|null>('window_management.focused'),
|
|
484
|
+
setFrame:(id:string,frame:WindowFrame)=>nativeCall<{frame:WindowFrame;resized:boolean}>('window_management.set_frame',{id,x:frame.x,y:frame.y,width:frame.width,height:frame.height}),
|
|
485
|
+
screens:()=>nativeCall<ManagedScreen[]>('window_management.screens'),
|
|
486
|
+
pointer:()=>nativeCall<{x:number;y:number}>('window_management.pointer'),
|
|
487
|
+
};
|
|
460
488
|
export const browserView={open:(id:string,url:string,width=1000,height=720)=>capabilities.invoke('browser.open',{id,url,width,height}),state:(id:string)=>capabilities.invoke('browser.state',{id}),close:(id:string)=>capabilities.invoke('browser.close',{id})};
|
|
461
489
|
export const printing={print:(text:string)=>capabilities.invoke('printing.print',{text})};
|
|
462
490
|
export const processes={start:(executable:string,args:string[]=[],timeoutMs=60000)=>nativeCall<{id:string;status:string}>('process.start',{executable,arguments:args,timeout_ms:timeoutMs}),state:(id:string)=>nativeCall<{status:string;exit_code:number|null;stdout:string;stderr:string;truncated:boolean}>('process.state',{id}),write:(id:string,text:string)=>nativeCall<{written:number}>('process.write',{id,text}),stop:(id:string)=>nativeCall('process.stop',{id})};
|
package/src/registry.ts
CHANGED
|
@@ -102,6 +102,12 @@ export const METHODS = {
|
|
|
102
102
|
"accessibility.focus": { permission: "accessibility", provider: "medeo.system-services", ui: true, confirm: false, adapter: "host" },
|
|
103
103
|
"accessibility.selected_text": { permission: "accessibility", provider: "medeo.system-services", ui: true, confirm: false, adapter: "host" },
|
|
104
104
|
"accessibility.insert_text": { permission: "accessibility", provider: "medeo.system-services", ui: true, confirm: false, adapter: "host" },
|
|
105
|
+
"window_management.status": { permission: "window_management", provider: "medeo.system-services", ui: false, confirm: false, adapter: "host" },
|
|
106
|
+
"window_management.request": { permission: "window_management", provider: "medeo.system-services", ui: true, confirm: false, adapter: "host" },
|
|
107
|
+
"window_management.focused": { permission: "window_management", provider: "medeo.system-services", ui: false, confirm: false, adapter: "host" },
|
|
108
|
+
"window_management.set_frame": { permission: "window_management", provider: "medeo.system-services", ui: false, confirm: false, adapter: "host" },
|
|
109
|
+
"window_management.screens": { permission: "window_management", provider: "medeo.system-services", ui: false, confirm: false, adapter: "host" },
|
|
110
|
+
"window_management.pointer": { permission: "window_management", provider: "medeo.system-services", ui: false, confirm: false, adapter: "host" },
|
|
105
111
|
"input_method.status": { permission: "input_method", provider: "medeo.input-method", ui: false, confirm: false, adapter: "host" },
|
|
106
112
|
"input_method.configure": { permission: "input_method", provider: "medeo.input-method", ui: false, confirm: false, adapter: "host" },
|
|
107
113
|
"input_method.enable": { permission: "input_method", provider: "medeo.input-method", ui: true, confirm: false, adapter: "host" },
|