-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathglobal.d.ts
59 lines (52 loc) · 1.29 KB
/
global.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import {
RequestOptions,
ConnectSessionOptions,
ModelInfoOptions,
ModelInfo,
ModelSession,
} from './src/ai-api/types';
interface AIModel {
model: string;
enabled: boolean;
}
interface AIInterface {
permissions: {
models: () => Promise<AIModel[]>;
request: (options: RequestOptions) => Promise<boolean>;
};
model: {
info: (options: ModelInfoOptions) => Promise<ModelInfo>;
connect: (options: ConnectSessionOptions) => Promise<ModelSession>;
};
}
interface Actions {
sendEnterURL: (url: string) => void;
sendChangeURL: (url: string) => void;
sendAct: (actName: string) => void;
sendCloseTab: (id: string | number) => void;
sendNewTab: (url?: string, references?: object) => void;
sendSwitchTab: (id: string | number) => void;
}
interface Controls {
controlReady: () => void;
onActiveUpdate: (callback: (...args: any[]) => void) => () => void;
onTabsUpdate: (callback: (...args: any[]) => void) => () => void;
}
interface Device {
enable: (model: string) => Promise<any>;
disable: (model: string) => Promise<any>;
isConnected: () => Promise<boolean>;
}
interface BrowserAI {
device: Device;
controls: Controls & {
actions: Actions;
};
}
declare global {
interface Window {
ai: AIInterface;
browserai: BrowserAI;
}
}
export {};