@gemigo/extension-sdk 0.1.2 → 0.2.1
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 +63 -61
- package/dist/apis/extension.d.ts +155 -0
- package/dist/apis/index.d.ts +4 -0
- package/dist/core/connection.d.ts +117 -0
- package/dist/core/event-bus.d.ts +35 -0
- package/dist/core/index.d.ts +7 -0
- package/dist/gemigo-extension-sdk.es.js +191 -147
- package/dist/gemigo-extension-sdk.umd.js +1 -1
- package/dist/index.d.ts +4 -62
- package/dist/sdk.d.ts +15 -0
- package/dist/types/ai.d.ts +48 -0
- package/dist/types/clipboard.d.ts +39 -0
- package/dist/types/common.d.ts +39 -0
- package/dist/types/desktop.d.ts +138 -0
- package/dist/types/dialog.d.ts +65 -0
- package/dist/types/extension.d.ts +187 -0
- package/dist/types/file.d.ts +79 -0
- package/dist/types/index.d.ts +88 -0
- package/dist/types/manifest.d.ts +87 -0
- package/dist/types/network.d.ts +37 -0
- package/dist/types/notify.d.ts +35 -0
- package/dist/types/storage.d.ts +27 -0
- package/package.json +3 -1
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Common types used across the GemiGo SDK
|
|
3
|
+
*/
|
|
4
|
+
/** Current platform type */
|
|
5
|
+
export type Platform = 'web' | 'desktop' | 'extension';
|
|
6
|
+
/** Environment capabilities */
|
|
7
|
+
export interface Capabilities {
|
|
8
|
+
scheduler: boolean;
|
|
9
|
+
fileWatch: boolean;
|
|
10
|
+
fileWrite: boolean;
|
|
11
|
+
notification: boolean;
|
|
12
|
+
clipboard: boolean;
|
|
13
|
+
ai: boolean;
|
|
14
|
+
shell: boolean;
|
|
15
|
+
network: boolean;
|
|
16
|
+
}
|
|
17
|
+
/** File entry information */
|
|
18
|
+
export interface FileEntry {
|
|
19
|
+
/** File name */
|
|
20
|
+
name: string;
|
|
21
|
+
/** Full path */
|
|
22
|
+
path: string;
|
|
23
|
+
/** Whether this is a file */
|
|
24
|
+
isFile: boolean;
|
|
25
|
+
/** Whether this is a directory */
|
|
26
|
+
isDirectory: boolean;
|
|
27
|
+
/** File size in bytes */
|
|
28
|
+
size: number;
|
|
29
|
+
/** Last modification timestamp */
|
|
30
|
+
mtime: number;
|
|
31
|
+
}
|
|
32
|
+
/** File stat information */
|
|
33
|
+
export interface FileStat {
|
|
34
|
+
size: number;
|
|
35
|
+
mtime: number;
|
|
36
|
+
ctime: number;
|
|
37
|
+
isFile: boolean;
|
|
38
|
+
isDirectory: boolean;
|
|
39
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { NotifyOptions } from './notify';
|
|
2
|
+
/** Scheduler task configuration */
|
|
3
|
+
export interface SchedulerConfig {
|
|
4
|
+
/** Unique task ID */
|
|
5
|
+
id: string;
|
|
6
|
+
/** Interval (e.g. '30m', '1h', '2h', '1d') */
|
|
7
|
+
interval: string;
|
|
8
|
+
/** Start time (e.g. '08:00') */
|
|
9
|
+
startTime?: string;
|
|
10
|
+
/** End time (e.g. '22:00') */
|
|
11
|
+
endTime?: string;
|
|
12
|
+
/** Notification to show when task runs */
|
|
13
|
+
notification?: NotifyOptions;
|
|
14
|
+
}
|
|
15
|
+
/** Scheduler operation result */
|
|
16
|
+
export interface SchedulerResult {
|
|
17
|
+
success: boolean;
|
|
18
|
+
reason?: string;
|
|
19
|
+
}
|
|
20
|
+
/** Scheduler API for background tasks */
|
|
21
|
+
export interface SchedulerAPI {
|
|
22
|
+
/**
|
|
23
|
+
* Register a background scheduled task
|
|
24
|
+
* @param config - Task configuration
|
|
25
|
+
*/
|
|
26
|
+
register(config: SchedulerConfig): Promise<SchedulerResult>;
|
|
27
|
+
/**
|
|
28
|
+
* Update an existing task
|
|
29
|
+
* @param id - Task ID
|
|
30
|
+
* @param config - Updated configuration
|
|
31
|
+
*/
|
|
32
|
+
update(id: string, config: Partial<Omit<SchedulerConfig, 'id'>>): Promise<SchedulerResult>;
|
|
33
|
+
/**
|
|
34
|
+
* Cancel a scheduled task
|
|
35
|
+
* @param id - Task ID
|
|
36
|
+
*/
|
|
37
|
+
cancel(id: string): Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* List all scheduled tasks for this app
|
|
40
|
+
*/
|
|
41
|
+
list(): Promise<SchedulerConfig[]>;
|
|
42
|
+
}
|
|
43
|
+
/** File watch event type */
|
|
44
|
+
export type FileWatchEventType = 'create' | 'modify' | 'delete';
|
|
45
|
+
/** File watch configuration */
|
|
46
|
+
export interface FileWatchConfig {
|
|
47
|
+
/** Unique watch ID */
|
|
48
|
+
id: string;
|
|
49
|
+
/** Path to watch (e.g. '~/Downloads') */
|
|
50
|
+
path: string;
|
|
51
|
+
/** Glob pattern (e.g. '*.png') */
|
|
52
|
+
pattern?: string;
|
|
53
|
+
/** Events to watch for */
|
|
54
|
+
events: FileWatchEventType[];
|
|
55
|
+
/** Action to perform */
|
|
56
|
+
action: {
|
|
57
|
+
type: 'callback';
|
|
58
|
+
callback: string;
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
/** File watch event */
|
|
62
|
+
export interface FileWatchEvent {
|
|
63
|
+
/** Watch ID */
|
|
64
|
+
id: string;
|
|
65
|
+
/** Changed file path */
|
|
66
|
+
path: string;
|
|
67
|
+
/** Event type */
|
|
68
|
+
event: FileWatchEventType;
|
|
69
|
+
}
|
|
70
|
+
/** FileWatch API for monitoring file system changes */
|
|
71
|
+
export interface FileWatchAPI {
|
|
72
|
+
/**
|
|
73
|
+
* Register a file watch
|
|
74
|
+
* @param config - Watch configuration
|
|
75
|
+
*/
|
|
76
|
+
register(config: FileWatchConfig): Promise<{
|
|
77
|
+
success: boolean;
|
|
78
|
+
}>;
|
|
79
|
+
/**
|
|
80
|
+
* Cancel a file watch
|
|
81
|
+
* @param id - Watch ID
|
|
82
|
+
*/
|
|
83
|
+
cancel(id: string): Promise<void>;
|
|
84
|
+
}
|
|
85
|
+
/** File watch callback handler */
|
|
86
|
+
export type FileWatchHandler = (callbackId: string, handler: (event: FileWatchEvent) => void) => void;
|
|
87
|
+
/** Shell API for system integration */
|
|
88
|
+
export interface ShellAPI {
|
|
89
|
+
/**
|
|
90
|
+
* Open URL in system default browser
|
|
91
|
+
* @param url - URL to open
|
|
92
|
+
*/
|
|
93
|
+
openExternal(url: string): Promise<void>;
|
|
94
|
+
/**
|
|
95
|
+
* Show file in Finder/Explorer
|
|
96
|
+
* @param path - File path
|
|
97
|
+
*/
|
|
98
|
+
showItemInFolder(path: string): Promise<void>;
|
|
99
|
+
/**
|
|
100
|
+
* Open file with system default application
|
|
101
|
+
* @param path - File path
|
|
102
|
+
*/
|
|
103
|
+
openPath(path: string): Promise<void>;
|
|
104
|
+
}
|
|
105
|
+
/** GlobalShortcut API for system-level keyboard shortcuts */
|
|
106
|
+
export interface GlobalShortcutAPI {
|
|
107
|
+
/**
|
|
108
|
+
* Register a global shortcut
|
|
109
|
+
* @param accelerator - Key combination (e.g. 'Cmd+Shift+X', 'Ctrl+Alt+P')
|
|
110
|
+
* @param callback - Handler function
|
|
111
|
+
* @returns True if registration succeeded
|
|
112
|
+
*/
|
|
113
|
+
register(accelerator: string, callback: () => void): Promise<boolean>;
|
|
114
|
+
/**
|
|
115
|
+
* Unregister a global shortcut
|
|
116
|
+
* @param accelerator - Key combination
|
|
117
|
+
*/
|
|
118
|
+
unregister(accelerator: string): Promise<void>;
|
|
119
|
+
/**
|
|
120
|
+
* Unregister all shortcuts for this app
|
|
121
|
+
*/
|
|
122
|
+
unregisterAll(): Promise<void>;
|
|
123
|
+
}
|
|
124
|
+
/** Autostart API for managing app launch on system startup */
|
|
125
|
+
export interface AutostartAPI {
|
|
126
|
+
/**
|
|
127
|
+
* Enable auto-start on system boot
|
|
128
|
+
*/
|
|
129
|
+
enable(): Promise<void>;
|
|
130
|
+
/**
|
|
131
|
+
* Disable auto-start
|
|
132
|
+
*/
|
|
133
|
+
disable(): Promise<void>;
|
|
134
|
+
/**
|
|
135
|
+
* Check if auto-start is enabled
|
|
136
|
+
*/
|
|
137
|
+
isEnabled(): Promise<boolean>;
|
|
138
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { FileEntry } from './common';
|
|
2
|
+
/** File filter for save dialog */
|
|
3
|
+
export interface FileFilter {
|
|
4
|
+
name: string;
|
|
5
|
+
extensions: string[];
|
|
6
|
+
}
|
|
7
|
+
/** Open file dialog options */
|
|
8
|
+
export interface OpenFileOptions {
|
|
9
|
+
/** MIME type filter, e.g. 'image/*' */
|
|
10
|
+
accept?: string;
|
|
11
|
+
/** Allow multiple file selection */
|
|
12
|
+
multiple?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/** Save file dialog options */
|
|
15
|
+
export interface SaveFileOptions {
|
|
16
|
+
/** Default file name */
|
|
17
|
+
defaultName?: string;
|
|
18
|
+
/** File type filters */
|
|
19
|
+
filters?: FileFilter[];
|
|
20
|
+
}
|
|
21
|
+
/** Message dialog options */
|
|
22
|
+
export interface MessageOptions {
|
|
23
|
+
/** Dialog title */
|
|
24
|
+
title: string;
|
|
25
|
+
/** Dialog message */
|
|
26
|
+
message: string;
|
|
27
|
+
/** Message type */
|
|
28
|
+
type?: 'info' | 'warning' | 'error';
|
|
29
|
+
/** Button labels */
|
|
30
|
+
buttons?: string[];
|
|
31
|
+
}
|
|
32
|
+
/** Dialog API */
|
|
33
|
+
export interface DialogAPI {
|
|
34
|
+
/**
|
|
35
|
+
* Open file selection dialog
|
|
36
|
+
* @param options - Dialog options
|
|
37
|
+
* @returns Selected file(s) or null if cancelled
|
|
38
|
+
*/
|
|
39
|
+
openFile(options?: OpenFileOptions): Promise<FileEntry | FileEntry[] | null>;
|
|
40
|
+
/**
|
|
41
|
+
* Open directory selection dialog
|
|
42
|
+
* @returns Selected directory path or null if cancelled
|
|
43
|
+
*/
|
|
44
|
+
openDirectory(): Promise<{
|
|
45
|
+
path: string;
|
|
46
|
+
} | null>;
|
|
47
|
+
/**
|
|
48
|
+
* Open save file dialog
|
|
49
|
+
* @param options - Dialog options
|
|
50
|
+
* @returns Selected save path or null if cancelled
|
|
51
|
+
*/
|
|
52
|
+
saveFile(options?: SaveFileOptions): Promise<{
|
|
53
|
+
path: string;
|
|
54
|
+
} | null>;
|
|
55
|
+
/**
|
|
56
|
+
* Show a message dialog
|
|
57
|
+
* @param options - Message options
|
|
58
|
+
* @returns Index of clicked button
|
|
59
|
+
*/
|
|
60
|
+
message(options: MessageOptions): Promise<number>;
|
|
61
|
+
}
|
|
62
|
+
/** File drop callback */
|
|
63
|
+
export type FileDropCallback = (files: FileEntry[]) => void;
|
|
64
|
+
/** File drop handler (top-level API) */
|
|
65
|
+
export type FileDropHandler = (callback: FileDropCallback) => () => void;
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser Extension API types
|
|
3
|
+
* These APIs are only available when gemigo.platform === 'extension'
|
|
4
|
+
*/
|
|
5
|
+
/** Page information */
|
|
6
|
+
export interface PageInfo {
|
|
7
|
+
url: string;
|
|
8
|
+
title: string;
|
|
9
|
+
favIconUrl?: string;
|
|
10
|
+
}
|
|
11
|
+
/** DOM element information */
|
|
12
|
+
export interface ElementInfo {
|
|
13
|
+
text: string;
|
|
14
|
+
html: string;
|
|
15
|
+
rect: DOMRect;
|
|
16
|
+
}
|
|
17
|
+
/** Extracted article content */
|
|
18
|
+
export interface ArticleContent {
|
|
19
|
+
title: string;
|
|
20
|
+
content: string;
|
|
21
|
+
author?: string;
|
|
22
|
+
date?: string;
|
|
23
|
+
}
|
|
24
|
+
/** Link information */
|
|
25
|
+
export interface LinkInfo {
|
|
26
|
+
text: string;
|
|
27
|
+
href: string;
|
|
28
|
+
}
|
|
29
|
+
/** Image information */
|
|
30
|
+
export interface ImageInfo {
|
|
31
|
+
src: string;
|
|
32
|
+
alt: string;
|
|
33
|
+
width: number;
|
|
34
|
+
height: number;
|
|
35
|
+
}
|
|
36
|
+
/** Highlight options */
|
|
37
|
+
export interface HighlightOptions {
|
|
38
|
+
/** Highlight color */
|
|
39
|
+
color?: string;
|
|
40
|
+
/** Duration in ms before auto-remove */
|
|
41
|
+
duration?: number;
|
|
42
|
+
}
|
|
43
|
+
/** Widget position */
|
|
44
|
+
export interface WidgetPosition {
|
|
45
|
+
x: number;
|
|
46
|
+
y: number;
|
|
47
|
+
}
|
|
48
|
+
/** Widget configuration */
|
|
49
|
+
export interface WidgetConfig {
|
|
50
|
+
/** HTML content */
|
|
51
|
+
html: string;
|
|
52
|
+
/** Position on page */
|
|
53
|
+
position: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | WidgetPosition;
|
|
54
|
+
}
|
|
55
|
+
/** Widget handle for controlling inserted widget */
|
|
56
|
+
export interface WidgetHandle {
|
|
57
|
+
/** Remove the widget from page */
|
|
58
|
+
remove(): void;
|
|
59
|
+
/** Update widget HTML content */
|
|
60
|
+
update(html: string): void;
|
|
61
|
+
}
|
|
62
|
+
/** Full page capture options */
|
|
63
|
+
export interface CaptureFullOptions {
|
|
64
|
+
/** Maximum height in pixels (default: 30000) */
|
|
65
|
+
maxHeight?: number;
|
|
66
|
+
}
|
|
67
|
+
/** Context menu event */
|
|
68
|
+
export interface ContextMenuEvent {
|
|
69
|
+
menuId: string;
|
|
70
|
+
selectionText?: string;
|
|
71
|
+
pageUrl?: string;
|
|
72
|
+
}
|
|
73
|
+
/** Context menu event result */
|
|
74
|
+
export interface ContextMenuEventResult {
|
|
75
|
+
success: boolean;
|
|
76
|
+
event?: ContextMenuEvent;
|
|
77
|
+
}
|
|
78
|
+
/** Capture result */
|
|
79
|
+
export interface CaptureResult {
|
|
80
|
+
success: boolean;
|
|
81
|
+
dataUrl?: string;
|
|
82
|
+
error?: string;
|
|
83
|
+
}
|
|
84
|
+
/** Browser Extension API */
|
|
85
|
+
export interface ExtensionAPI {
|
|
86
|
+
/**
|
|
87
|
+
* Listen for context menu clicks
|
|
88
|
+
* @param callback - Event handler
|
|
89
|
+
* @returns Unsubscribe function
|
|
90
|
+
*/
|
|
91
|
+
onContextMenu(callback: (event: ContextMenuEvent) => void): () => void;
|
|
92
|
+
/**
|
|
93
|
+
* Get pending context menu event (when app opened via context menu)
|
|
94
|
+
*/
|
|
95
|
+
getContextMenuEvent(): Promise<ContextMenuEventResult>;
|
|
96
|
+
/**
|
|
97
|
+
* Handle selection action button click
|
|
98
|
+
* @param actionId - Action ID from manifest
|
|
99
|
+
* @param callback - Handler function
|
|
100
|
+
*/
|
|
101
|
+
onSelectionAction(actionId: string, callback: () => void): () => void;
|
|
102
|
+
/**
|
|
103
|
+
* Get current tab's page info
|
|
104
|
+
*/
|
|
105
|
+
getPageInfo(): Promise<PageInfo>;
|
|
106
|
+
/**
|
|
107
|
+
* Get full page HTML
|
|
108
|
+
* @throws CROSS_ORIGIN error for cross-origin iframes
|
|
109
|
+
*/
|
|
110
|
+
getPageHTML(): Promise<string>;
|
|
111
|
+
/**
|
|
112
|
+
* Get page text content (stripped of HTML tags)
|
|
113
|
+
*/
|
|
114
|
+
getPageText(): Promise<string>;
|
|
115
|
+
/**
|
|
116
|
+
* Query element by CSS selector
|
|
117
|
+
* @param selector - CSS selector
|
|
118
|
+
* @returns Element info or null
|
|
119
|
+
*/
|
|
120
|
+
queryElement(selector: string): Promise<ElementInfo | null>;
|
|
121
|
+
/**
|
|
122
|
+
* Extract article content using Readability algorithm
|
|
123
|
+
*/
|
|
124
|
+
extractArticle(): Promise<ArticleContent>;
|
|
125
|
+
/**
|
|
126
|
+
* Extract all links from page
|
|
127
|
+
*/
|
|
128
|
+
extractLinks(): Promise<LinkInfo[]>;
|
|
129
|
+
/**
|
|
130
|
+
* Extract all images from page
|
|
131
|
+
*/
|
|
132
|
+
extractImages(): Promise<ImageInfo[]>;
|
|
133
|
+
/**
|
|
134
|
+
* Highlight elements matching selector
|
|
135
|
+
* @param selector - CSS selector
|
|
136
|
+
* @param options - Highlight options
|
|
137
|
+
* @returns Function to remove highlight
|
|
138
|
+
*/
|
|
139
|
+
highlight(selector: string, options?: HighlightOptions): Promise<() => void>;
|
|
140
|
+
/**
|
|
141
|
+
* Insert a floating widget on page
|
|
142
|
+
* @param config - Widget configuration
|
|
143
|
+
* @returns Widget handle for control
|
|
144
|
+
*/
|
|
145
|
+
insertWidget(config: WidgetConfig): Promise<WidgetHandle>;
|
|
146
|
+
/**
|
|
147
|
+
* Inject custom CSS styles
|
|
148
|
+
* @param css - CSS string
|
|
149
|
+
* @returns Function to remove injected styles
|
|
150
|
+
*/
|
|
151
|
+
injectCSS(css: string): Promise<() => void>;
|
|
152
|
+
/**
|
|
153
|
+
* Listen for text selection changes
|
|
154
|
+
* @param callback - Selection change handler
|
|
155
|
+
* @returns Unsubscribe function
|
|
156
|
+
*/
|
|
157
|
+
onSelectionChange(callback: (text: string) => void): () => void;
|
|
158
|
+
/**
|
|
159
|
+
* Listen for page navigation
|
|
160
|
+
* @param callback - Navigation handler
|
|
161
|
+
* @returns Unsubscribe function
|
|
162
|
+
*/
|
|
163
|
+
onNavigate(callback: (url: string) => void): () => void;
|
|
164
|
+
/**
|
|
165
|
+
* Listen for page scroll (throttled)
|
|
166
|
+
* @param callback - Scroll handler
|
|
167
|
+
* @returns Unsubscribe function
|
|
168
|
+
*/
|
|
169
|
+
onScroll(callback: (scrollY: number) => void): () => void;
|
|
170
|
+
/**
|
|
171
|
+
* Capture visible area screenshot
|
|
172
|
+
*/
|
|
173
|
+
captureVisible(): Promise<CaptureResult>;
|
|
174
|
+
/**
|
|
175
|
+
* Capture full page screenshot (long screenshot)
|
|
176
|
+
* @param options - Capture options
|
|
177
|
+
* @returns Base64 PNG data URL
|
|
178
|
+
*/
|
|
179
|
+
captureFull(options?: CaptureFullOptions): Promise<string>;
|
|
180
|
+
/**
|
|
181
|
+
* Register page-level keyboard shortcut
|
|
182
|
+
* @param combo - Key combination (e.g. 'Ctrl+Shift+T')
|
|
183
|
+
* @param callback - Handler function
|
|
184
|
+
* @returns Unregister function
|
|
185
|
+
*/
|
|
186
|
+
registerShortcut(combo: string, callback: () => void): () => void;
|
|
187
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { FileEntry, FileStat } from './common';
|
|
2
|
+
/** Mkdir options */
|
|
3
|
+
export interface MkdirOptions {
|
|
4
|
+
/** Create parent directories if they don't exist */
|
|
5
|
+
recursive?: boolean;
|
|
6
|
+
}
|
|
7
|
+
/** File API for file system operations */
|
|
8
|
+
export interface FileAPI {
|
|
9
|
+
/**
|
|
10
|
+
* Read text file (UTF-8)
|
|
11
|
+
* @param path - File path
|
|
12
|
+
* @returns File content as text
|
|
13
|
+
*/
|
|
14
|
+
readText(path: string): Promise<string>;
|
|
15
|
+
/**
|
|
16
|
+
* Read binary file
|
|
17
|
+
* @param path - File path
|
|
18
|
+
* @returns File content as ArrayBuffer
|
|
19
|
+
*/
|
|
20
|
+
readBinary(path: string): Promise<ArrayBuffer>;
|
|
21
|
+
/**
|
|
22
|
+
* Write to file
|
|
23
|
+
* @param path - File path
|
|
24
|
+
* @param data - Content to write
|
|
25
|
+
*/
|
|
26
|
+
write(path: string, data: string | ArrayBuffer): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Append to file
|
|
29
|
+
* @param path - File path
|
|
30
|
+
* @param data - Content to append
|
|
31
|
+
*/
|
|
32
|
+
append(path: string, data: string | ArrayBuffer): Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Check if path exists
|
|
35
|
+
* @param path - File path
|
|
36
|
+
* @returns True if exists
|
|
37
|
+
*/
|
|
38
|
+
exists(path: string): Promise<boolean>;
|
|
39
|
+
/**
|
|
40
|
+
* Get file/directory stats
|
|
41
|
+
* @param path - File path
|
|
42
|
+
* @returns File stat information
|
|
43
|
+
*/
|
|
44
|
+
stat(path: string): Promise<FileStat>;
|
|
45
|
+
/**
|
|
46
|
+
* Copy file
|
|
47
|
+
* @param src - Source path
|
|
48
|
+
* @param dest - Destination path
|
|
49
|
+
*/
|
|
50
|
+
copy(src: string, dest: string): Promise<void>;
|
|
51
|
+
/**
|
|
52
|
+
* Move/rename file
|
|
53
|
+
* @param src - Source path
|
|
54
|
+
* @param dest - Destination path
|
|
55
|
+
*/
|
|
56
|
+
move(src: string, dest: string): Promise<void>;
|
|
57
|
+
/**
|
|
58
|
+
* Remove file or directory
|
|
59
|
+
* @param path - Path to remove
|
|
60
|
+
*/
|
|
61
|
+
remove(path: string): Promise<void>;
|
|
62
|
+
/**
|
|
63
|
+
* List directory contents
|
|
64
|
+
* @param path - Directory path
|
|
65
|
+
* @returns Array of file entries
|
|
66
|
+
*/
|
|
67
|
+
list(path: string): Promise<FileEntry[]>;
|
|
68
|
+
/**
|
|
69
|
+
* Create directory
|
|
70
|
+
* @param path - Directory path
|
|
71
|
+
* @param options - Creation options
|
|
72
|
+
*/
|
|
73
|
+
mkdir(path: string, options?: MkdirOptions): Promise<void>;
|
|
74
|
+
/**
|
|
75
|
+
* Persist permission for a user-selected path
|
|
76
|
+
* @param path - Path to persist permission for
|
|
77
|
+
*/
|
|
78
|
+
persistPermission(path: string): Promise<void>;
|
|
79
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { Platform, Capabilities, FileEntry } from './common';
|
|
2
|
+
import { StorageAPI } from './storage';
|
|
3
|
+
import { NotifyOptions, NotifyResult } from './notify';
|
|
4
|
+
import { AIAPI } from './ai';
|
|
5
|
+
import { ClipboardAPI } from './clipboard';
|
|
6
|
+
import { DialogAPI } from './dialog';
|
|
7
|
+
import { FileAPI } from './file';
|
|
8
|
+
import { NetworkAPI } from './network';
|
|
9
|
+
import { SchedulerAPI, FileWatchAPI, FileWatchEvent, ShellAPI, GlobalShortcutAPI, AutostartAPI } from './desktop';
|
|
10
|
+
import { ExtensionAPI } from './extension';
|
|
11
|
+
/**
|
|
12
|
+
* GemiGo SDK Types
|
|
13
|
+
*
|
|
14
|
+
* Complete TypeScript type definitions for the GemiGo SDK API.
|
|
15
|
+
*/
|
|
16
|
+
export type { Platform, Capabilities, FileEntry, FileStat } from './common';
|
|
17
|
+
export type { StorageAPI } from './storage';
|
|
18
|
+
export type { NotifyAction, NotifyOptions, NotifyResult, NotifyAPI, NotificationActionHandler, } from './notify';
|
|
19
|
+
export type { ChatMessage, ChatResponse, TranslateOptions, TranslateResult, AIAPI, } from './ai';
|
|
20
|
+
export type { ClipboardContent, ClipboardChangeCallback, ClipboardAPI, } from './clipboard';
|
|
21
|
+
export type { FileFilter, OpenFileOptions, SaveFileOptions, MessageOptions, DialogAPI, FileDropCallback, FileDropHandler, } from './dialog';
|
|
22
|
+
export type { MkdirOptions, FileAPI } from './file';
|
|
23
|
+
export type { HttpMethod, ResponseType, RequestOptions, RequestResponse, NetworkAPI, } from './network';
|
|
24
|
+
export type { SchedulerConfig, SchedulerResult, SchedulerAPI, FileWatchEventType, FileWatchConfig, FileWatchEvent, FileWatchAPI, FileWatchHandler, ShellAPI, GlobalShortcutAPI, AutostartAPI, } from './desktop';
|
|
25
|
+
export type { PageInfo, ElementInfo, ArticleContent, LinkInfo, ImageInfo, HighlightOptions, WidgetPosition, WidgetConfig, WidgetHandle, CaptureFullOptions, ContextMenuEvent, ContextMenuEventResult, CaptureResult, ExtensionAPI, } from './extension';
|
|
26
|
+
export type { AppType, PlatformType, PermissionType, FileScope, ContextMenuContext, ContextMenuItem, SelectionAction, SidePanelConfig, UIConfig, BackgroundCapability, BackgroundConfig, FileConfig, ExtensionConfig, AppManifest, } from './manifest';
|
|
27
|
+
/**
|
|
28
|
+
* Complete GemiGo SDK interface
|
|
29
|
+
*
|
|
30
|
+
* Available APIs depend on the current platform:
|
|
31
|
+
* - `web`: Common APIs only
|
|
32
|
+
* - `desktop`: Common + Desktop APIs
|
|
33
|
+
* - `extension`: Common + Extension APIs
|
|
34
|
+
*/
|
|
35
|
+
export interface GemigoSDK {
|
|
36
|
+
/** Current platform: 'web' | 'desktop' | 'extension' */
|
|
37
|
+
readonly platform: Platform;
|
|
38
|
+
/** Available capabilities for current environment */
|
|
39
|
+
readonly capabilities: Capabilities;
|
|
40
|
+
/** Persistent key-value storage */
|
|
41
|
+
storage: StorageAPI;
|
|
42
|
+
/**
|
|
43
|
+
* Send system notification
|
|
44
|
+
* @param options - Notification options
|
|
45
|
+
*/
|
|
46
|
+
notify(options: NotifyOptions): Promise<NotifyResult>;
|
|
47
|
+
/**
|
|
48
|
+
* Listen for notification action button clicks
|
|
49
|
+
* @param actionId - Action ID from notification
|
|
50
|
+
* @param callback - Handler function
|
|
51
|
+
* @returns Unsubscribe function
|
|
52
|
+
*/
|
|
53
|
+
onNotificationAction(actionId: string, callback: () => void): () => void;
|
|
54
|
+
/** AI/LLM integration */
|
|
55
|
+
ai: AIAPI;
|
|
56
|
+
/** Clipboard access */
|
|
57
|
+
clipboard: ClipboardAPI;
|
|
58
|
+
/** File/folder dialogs */
|
|
59
|
+
dialog: DialogAPI;
|
|
60
|
+
/**
|
|
61
|
+
* Listen for files dropped onto the app
|
|
62
|
+
* @param callback - Drop handler
|
|
63
|
+
* @returns Unsubscribe function
|
|
64
|
+
*/
|
|
65
|
+
onFileDrop(callback: (files: FileEntry[]) => void): () => void;
|
|
66
|
+
/** File system operations */
|
|
67
|
+
file: FileAPI;
|
|
68
|
+
/** Cross-origin HTTP requests */
|
|
69
|
+
network: NetworkAPI;
|
|
70
|
+
/** Background scheduled tasks */
|
|
71
|
+
scheduler?: SchedulerAPI;
|
|
72
|
+
/** File system change monitoring */
|
|
73
|
+
fileWatch?: FileWatchAPI;
|
|
74
|
+
/**
|
|
75
|
+
* Listen for file watch events
|
|
76
|
+
* @param callbackId - Callback ID from registration
|
|
77
|
+
* @param handler - Event handler
|
|
78
|
+
*/
|
|
79
|
+
onFileWatch?(callbackId: string, handler: (event: FileWatchEvent) => void): void;
|
|
80
|
+
/** System shell integration */
|
|
81
|
+
shell?: ShellAPI;
|
|
82
|
+
/** Global keyboard shortcuts */
|
|
83
|
+
globalShortcut?: GlobalShortcutAPI;
|
|
84
|
+
/** Auto-start on system boot */
|
|
85
|
+
autostart?: AutostartAPI;
|
|
86
|
+
/** Browser extension page interaction */
|
|
87
|
+
extension?: ExtensionAPI;
|
|
88
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* App Manifest types
|
|
3
|
+
*/
|
|
4
|
+
/** Application type */
|
|
5
|
+
export type AppType = 'ui' | 'hybrid' | 'service';
|
|
6
|
+
/** Platform type */
|
|
7
|
+
export type PlatformType = 'web' | 'desktop' | 'extension';
|
|
8
|
+
/** Permission types */
|
|
9
|
+
export type PermissionType = 'storage' | 'notify' | 'scheduler' | 'fileWatch' | 'fileWrite' | 'ai' | 'clipboard' | 'shell' | 'network' | 'extension.modify' | 'extension.capture' | 'extension.shortcuts';
|
|
10
|
+
/** File scope paths */
|
|
11
|
+
export type FileScope = '$DOWNLOAD' | '$DOCUMENT' | '$PICTURE' | '$DESKTOP' | '$APP_DATA' | '$TEMP';
|
|
12
|
+
/** Context menu context types */
|
|
13
|
+
export type ContextMenuContext = 'selection' | 'page' | 'image';
|
|
14
|
+
/** Context menu item configuration */
|
|
15
|
+
export interface ContextMenuItem {
|
|
16
|
+
id: string;
|
|
17
|
+
title: string;
|
|
18
|
+
contexts: ContextMenuContext[];
|
|
19
|
+
}
|
|
20
|
+
/** Selection action configuration */
|
|
21
|
+
export interface SelectionAction {
|
|
22
|
+
id: string;
|
|
23
|
+
label: string;
|
|
24
|
+
icon?: string;
|
|
25
|
+
}
|
|
26
|
+
/** Side panel configuration */
|
|
27
|
+
export interface SidePanelConfig {
|
|
28
|
+
enabled: boolean;
|
|
29
|
+
icon?: string;
|
|
30
|
+
title?: string;
|
|
31
|
+
}
|
|
32
|
+
/** UI entry points */
|
|
33
|
+
export interface UIConfig {
|
|
34
|
+
/** Main UI HTML file */
|
|
35
|
+
main: string;
|
|
36
|
+
/** Settings UI HTML file (for hybrid/service apps) */
|
|
37
|
+
settings?: string;
|
|
38
|
+
}
|
|
39
|
+
/** Background capabilities */
|
|
40
|
+
export type BackgroundCapability = 'scheduler' | 'fileWatch';
|
|
41
|
+
/** Background configuration */
|
|
42
|
+
export interface BackgroundConfig {
|
|
43
|
+
enabled: boolean;
|
|
44
|
+
capabilities?: BackgroundCapability[];
|
|
45
|
+
}
|
|
46
|
+
/** File permission configuration */
|
|
47
|
+
export interface FileConfig {
|
|
48
|
+
scope?: FileScope[];
|
|
49
|
+
}
|
|
50
|
+
/** Extension-specific configuration */
|
|
51
|
+
export interface ExtensionConfig {
|
|
52
|
+
sidePanel?: SidePanelConfig;
|
|
53
|
+
contextMenu?: ContextMenuItem[];
|
|
54
|
+
selectionAction?: SelectionAction;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Application manifest definition
|
|
58
|
+
* The manifest.json file that configures app metadata and permissions
|
|
59
|
+
*/
|
|
60
|
+
export interface AppManifest {
|
|
61
|
+
/** App name (required) */
|
|
62
|
+
name: string;
|
|
63
|
+
/** Version string (required) */
|
|
64
|
+
version: string;
|
|
65
|
+
/** App description (required) */
|
|
66
|
+
description: string;
|
|
67
|
+
/** App icon relative path (required) */
|
|
68
|
+
icon: string;
|
|
69
|
+
/** Author name */
|
|
70
|
+
author?: string;
|
|
71
|
+
/** App type (default: 'ui') */
|
|
72
|
+
type?: AppType;
|
|
73
|
+
/** Supported platforms */
|
|
74
|
+
platforms?: PlatformType[];
|
|
75
|
+
/** Required permissions */
|
|
76
|
+
permissions?: PermissionType[];
|
|
77
|
+
/** UI entry configuration */
|
|
78
|
+
ui?: UIConfig;
|
|
79
|
+
/** Installation script */
|
|
80
|
+
onInstall?: string;
|
|
81
|
+
/** File permission scopes */
|
|
82
|
+
file?: FileConfig;
|
|
83
|
+
/** Background task configuration */
|
|
84
|
+
background?: BackgroundConfig;
|
|
85
|
+
/** Browser extension configuration */
|
|
86
|
+
extension?: ExtensionConfig;
|
|
87
|
+
}
|