generated from google-gemini/aistudio-repository-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.ts
More file actions
292 lines (252 loc) · 7.78 KB
/
types.ts
File metadata and controls
292 lines (252 loc) · 7.78 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
import React from 'react';
import type * as LucideIcons from 'lucide-react';
export type LucideIconName = keyof typeof LucideIcons;
export type Theme = 'light' | 'dark';
// Agent & Automation Types
export type AgentStatus = 'idle' | 'running' | 'paused' | 'finished' | 'error';
export interface AgentLogEntry {
type: 'thought' | 'action' | 'system' | 'error';
content: string;
timestamp: string;
}
export interface AgentInstance {
id: number;
name: string;
goal: string;
status: AgentStatus;
logs: AgentLogEntry[];
}
export type AutomationActionType = 'openWindow' | 'closeWindow' | 'setTheme' | 'setWallpaper' | 'browseUrl' | 'askAssistant';
export interface AutomationStep {
type: AutomationActionType;
args: Record<string, any>;
}
export interface Automation {
id: number;
name: string;
steps: AutomationStep[];
schedule?: {
type: 'once' | 'interval';
time?: string; // ISO string for 'once'
interval?: number; // minutes for 'interval'
};
lastRun?: string; // ISO string
}
// File System & Drag-and-Drop Types
export interface FileData {
type: 'file';
name: string;
content: string;
mimeType?: string; // Add optional mimeType for images
}
export interface DirectoryData {
type: 'directory';
name: string;
children: FileSystemNode[];
}
export type FileSystemNode = FileData | DirectoryData;
export interface DragItem {
type: 'file';
payload: FileData;
}
export interface GeneratedApp {
appName: string;
appId: string;
lucideIconName: LucideIconName;
description: string;
keywords: string[];
code: string;
defaultWidth?: number;
defaultHeight?: number;
}
export type DynamicUiNode = {
type: 'div' | 'p' | 'button' | 'input' | 'label' | 'h1' | 'h2' | 'span' | 'img';
props?: {
className?: string;
placeholder?: string;
type?: 'text' | 'password' | 'email' | 'submit' | 'button' | 'checkbox';
htmlFor?: string;
src?: string;
alt?: string;
[key: string]: any; // Allows for other valid HTML attributes
};
children?: (DynamicUiNode | string)[];
};
export interface AgentUIState {
isRunning: boolean;
status: 'thinking' | 'executing' | 'idle' | 'finished' | 'error';
thought?: string;
virtualCursor: { x: number; y: number };
error?: string;
highlightedRect?: { x: number; y: number; width: number; height: number } | null;
originalPrompt?: string;
actionHistory?: string[];
}
export interface NotificationInstance {
id: number;
title: string;
message: string;
icon?: React.ReactNode;
type?: 'info' | 'suggestion';
onClick?: () => void;
}
export interface CustomTheme {
id: number;
name: string;
mode: 'light' | 'dark';
colors: {
glassBgLight: string; // rgba format
glassBorderLight: string; // rgba format
glassBgDark: string; // rgba format
glassBorderDark: string; // rgba format
};
}
// Widget Types
export interface WidgetInstance {
instanceId: number;
widgetId: string;
x: number;
y: number;
zIndex: number;
}
export interface WidgetDefinition {
id: string;
title: string;
component: React.ComponentType<WidgetProps>;
defaultSize: { width: number; height: number };
}
export interface WidgetProps {
os: OS_API;
instance: WidgetInstance;
}
export type CustomWidgetType = 'clock' | 'text' | 'image' | 'note';
export interface CustomWidgetConfig {
id: string;
name: string;
type: CustomWidgetType;
defaultSize: { width: number; height: number };
style: {
backgroundColor: string; // rgba or hex
textColor: string;
fontSize: number;
fontFamily: string;
borderRadius: number;
borderWidth: number;
borderColor: string;
textAlign: 'left' | 'center' | 'right';
padding: number;
};
content: {
text?: string; // For text/note
imageUrl?: string; // For image
clockShowDate?: boolean; // For clock
clockShowSeconds?: boolean; // For clock
};
}
export interface AppIconDefinition {
type: 'lucide' | 'url';
value: string; // LucideIconName or image URL
}
export interface OS_API {
openWindow: (appId: string, initialProps?: Record<string, any>) => boolean;
closeWindow: (id: number) => void;
closeWindowByAppId: (appId: string) => boolean;
focusWindowByAppId: (appId: string) => boolean;
windows: WindowInstance[];
apps: AppDefinition[];
theme: Theme;
setTheme: (theme: Theme) => void;
setWallpaper: (url: string) => void;
lockScreen: () => void;
// App Generation & Management
addApp: (appData: GeneratedApp) => Promise<boolean>;
updateAppDefinition: (appId: string, updates: Partial<Omit<AppDefinition, 'id' | 'component'>>) => void;
// Autonomous Agents
agents: AgentInstance[];
createAgent: (name: string, goal: string) => void;
updateAgent: (id: number, updates: Partial<Omit<AgentInstance, 'id'>>) => void;
deleteAgent: (id: number) => void;
// Automations
automations: Automation[];
createAutomation: (name: string, steps: AutomationStep[], schedule?: Automation['schedule']) => void;
updateAutomation: (id: number, updates: Partial<Omit<Automation, 'id'>>) => void;
deleteAutomation: (id: number) => void;
runAutomation: (id: number) => boolean;
// UI Agent
startAgentTask: (prompt: string) => void;
stopAgentTask: () => void;
agentState: AgentUIState;
// Notifications
notifications: NotificationInstance[];
addNotification: (title: string, message: string, icon?: React.ReactNode, type?: NotificationInstance['type'], onClick?: () => void) => void;
// Drag and Drop
draggingItem: DragItem | null;
setDraggingItem: (item: DragItem | null) => void;
onFileDrop: (windowId: number, file: FileData) => void;
// File System
getFileSystem: () => DirectoryData;
saveFile: (path: string, content: string, mimeType?: string) => void;
createDirectory: (path: string) => void;
readFile: (filePath: string) => string | null;
listFiles: (path: string) => { type: 'file' | 'directory', name: string }[];
// Window Management
setWindowConfig: (id: number, config: Partial<Pick<WindowInstance, 'onBeforeClose'>>) => void;
updateWindowData: (id: number, data: Record<string, any>) => void;
// Browser
browseUrl: (url: string) => void;
// Custom Themes
getCustomThemes: () => CustomTheme[];
saveCustomTheme: (theme: Omit<CustomTheme, 'id'> & { id?: number }) => void;
deleteCustomTheme: (id: number) => void;
applyCustomTheme: (id: number | null) => void; // null to reset to default
// Widgets
widgets: WidgetInstance[];
availableWidgets: WidgetDefinition[];
addWidget: (widgetId: string) => void;
removeWidget: (instanceId: number) => void;
updateWidgetPosition: (instanceId: number, pos: { x: number; y: number }) => void;
focusWidget: (instanceId: number) => void;
// Custom Widgets
customWidgetDefs: CustomWidgetConfig[];
saveCustomWidget: (config: CustomWidgetConfig) => void;
deleteCustomWidget: (id: string) => void;
// Global Search
toggleGlobalSearch: () => void;
geminiApiKey?: string;
}
export interface AppProps {
os: OS_API;
initialProps?: Record<string, any>;
isFocused?: boolean;
windowId: number;
}
export interface AppDefinition {
id: string;
title: string;
icon: AppIconDefinition;
component: React.ComponentType<AppProps>;
description?: string;
keywords?: string[];
defaultSize?: { width: number; height: number };
isDesktopIcon?: boolean;
resizable?: boolean;
maximizable?: boolean;
minimizable?: boolean;
}
export interface WindowInstance {
id: number;
appId: string;
title: string;
icon: AppIconDefinition;
x: number;
y: number;
width: number;
height: number;
zIndex: number;
isMinimized: boolean;
isMaximized: boolean;
lastPosition?: { x: number; y: number; width: number; height: number };
initialProps?: Record<string, any>;
onBeforeClose?: () => Promise<boolean>;
data?: Record<string, any>;
}