@edenapp/types 0.1.2 → 0.3.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/AppManifest.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import type { ServiceDeclaration } from "./channels";
2
+
1
3
  /**
2
4
  * Window Mode Configuration
3
5
  *
@@ -5,9 +7,22 @@
5
7
  */
6
8
  export type WindowMode = "floating" | "tiled" | "both";
7
9
 
10
+ /**
11
+ * CSS injection mode for app views
12
+ * - "full": Inject complete CSS (tokens + utilities + components)
13
+ * - "tokens": Inject only CSS custom property definitions
14
+ * - "none": Don't inject any CSS
15
+ */
16
+ export type CSSInjectionMode = "full" | "tokens" | "none";
17
+
8
18
  export interface WindowInjectionOptions {
9
- /** Inject the Eden design system CSS into the view (default: true) */
10
- css?: boolean;
19
+ /**
20
+ * Control Eden CSS injection (default: "full")
21
+ * - "full": Complete CSS including tokens, utilities, and components
22
+ * - "tokens": Only CSS custom property definitions (variables)
23
+ * - "none": No CSS injection
24
+ */
25
+ css?: CSSInjectionMode;
11
26
 
12
27
  /** Inject the Eden app frame with title bar controls (default: true) */
13
28
  appFrame?: boolean;
@@ -54,6 +69,23 @@ export interface WindowConfig {
54
69
  injections?: WindowInjectionOptions;
55
70
  }
56
71
 
72
+ /**
73
+ * File handler configuration for apps that can open files
74
+ */
75
+ export interface FileHandlerConfig {
76
+ /** Display name for this handler (e.g., "Text Documents") */
77
+ name: string;
78
+
79
+ /** File extensions this handler supports (without dot, e.g., ["txt", "md"]) */
80
+ extensions: string[];
81
+
82
+ /** MIME types this handler supports (optional) */
83
+ mimeTypes?: string[];
84
+
85
+ /** Icon for this handler (optional) */
86
+ icon?: string;
87
+ }
88
+
57
89
  /**
58
90
  * App Manifest Interface
59
91
  *
@@ -92,11 +124,23 @@ export interface AppManifest {
92
124
  };
93
125
  };
94
126
 
95
- /** Frontend configuration */
96
- frontend: {
127
+ /**
128
+ * Frontend configuration.
129
+ * Optional - omit for backend-only apps (daemons).
130
+ * At least one of `frontend` or `backend` must be defined.
131
+ */
132
+ frontend?: {
97
133
  /** Path to the frontend HTML entry file */
98
134
  entry: string;
99
135
 
136
+ /**
137
+ * Allow remote URLs to be embedded in iframes.
138
+ * When true, strips X-Frame-Options and CSP frame-ancestors headers
139
+ * that would otherwise prevent embedding.
140
+ * Only applies to remote (http/https) frontend entries.
141
+ */
142
+ allowEmbedding?: boolean;
143
+
100
144
  /** WebContentsView options */
101
145
  options?: {
102
146
  /** Enable Node.js integration in the view (default: false) */
@@ -120,9 +164,35 @@ export interface AppManifest {
120
164
  build?: {
121
165
  /** Command to build the app (e.g., "npm run build") */
122
166
  command: string;
167
+ /** Working directory for build command (relative to app root) */
168
+ cwd?: string;
123
169
  };
124
170
 
125
171
  /** Internal flag indicating if this is a prebuilt system app */
126
172
  isPrebuilt?: boolean;
127
- }
128
173
 
174
+ /**
175
+ * Permissions requested by this app.
176
+ * Supports glob patterns: "fs/*" for all fs permissions, "*" for all permissions.
177
+ */
178
+ permissions?: string[];
179
+
180
+ /**
181
+ * File types this app can handle.
182
+ * Used for "open with" functionality and automatic handler detection.
183
+ */
184
+ fileHandlers?: FileHandlerConfig[];
185
+
186
+ /**
187
+ * Whether this app runs as a system overlay.
188
+ * Overlays are rendered above regular apps.
189
+ */
190
+ overlay?: boolean;
191
+
192
+ /**
193
+ * Services this app exposes for other apps to connect to.
194
+ * Declaring services here documents the app's API and enables
195
+ * optional access control via allowedClients.
196
+ */
197
+ services?: ServiceDeclaration[];
198
+ }
package/EdenConfig.d.ts CHANGED
@@ -33,4 +33,7 @@ export interface EdenConfig {
33
33
  };
34
34
  tiling?: TilingConfig;
35
35
  development?: boolean;
36
+
37
+ /** List of app IDs to start automatically when Eden launches */
38
+ autostart?: string[];
36
39
  }
package/README.md CHANGED
@@ -17,9 +17,7 @@ To enable type support for window APIs, update your `tsconfig.json` to include:
17
17
  ```json
18
18
  {
19
19
  "compilerOptions": {
20
- "types": [
21
- "@edenapp/types/global"
22
- ]
20
+ "types": ["@edenapp/types/global"]
23
21
  }
24
22
  }
25
23
  ```
@@ -30,15 +28,7 @@ Import types in your Eden app:
30
28
 
31
29
  ```typescript
32
30
  // Use Eden API in your app's frontend
33
- const files = await window.edenAPI!.shellCommand('fs/readdir', {
34
- path: '/home/user/documents'
31
+ const files = await window.edenAPI.shellCommand("fs/readdir", {
32
+ path: "/home/user/documents",
35
33
  });
36
34
  ```
37
-
38
- ## Documentation
39
-
40
- For complete Eden platform documentation, visit the main [Eden repository](https://github.com/b0czek/eden).
41
-
42
- ## License
43
-
44
- MIT
package/channels.d.ts ADDED
@@ -0,0 +1,39 @@
1
+ /**
2
+ * AppBus Channel Types
3
+ *
4
+ * Types for the app-to-app communication system (Eden AppBus)
5
+ */
6
+
7
+ /**
8
+ * Service declaration in app manifest
9
+ */
10
+ export interface ServiceDeclaration {
11
+ /** Service name (must be unique per app) */
12
+ name: string;
13
+ /** Human-readable description */
14
+ description?: string;
15
+ /** Optional: Restrict which apps can connect (if omitted, open to all) */
16
+ allowedClients?: string[];
17
+ }
18
+
19
+ /**
20
+ * Result of a connect attempt
21
+ */
22
+ export interface ConnectResult {
23
+ success: boolean;
24
+ error?: string;
25
+ /** Connection ID (for internal tracking) */
26
+ connectionId?: string;
27
+ }
28
+
29
+ /**
30
+ * Registered service with internal details
31
+ */
32
+ export interface RegisteredService {
33
+ appId: string;
34
+ serviceName: string;
35
+ description?: string;
36
+ allowedClients?: string[];
37
+ webContentsId?: number;
38
+ providerType: "frontend" | "backend";
39
+ }
@@ -14,7 +14,222 @@ export interface SystemCommands {
14
14
  */
15
15
  "system/info": {
16
16
  args: Record<string, never>;
17
- response: SystemInfo;
17
+ response: import("./index").SystemInfo;
18
+ };
19
+ }
20
+
21
+ /**
22
+ * AppbusCommands - Commands for the "appbus" namespace
23
+ */
24
+ export interface AppbusCommands {
25
+ /**
26
+ * Register a service that this app exposes
27
+ * Requires "appbus/expose" permission
28
+ */
29
+ "appbus/register": {
30
+ args: {
31
+ serviceName: string;
32
+ description?: string;
33
+ allowedClients?: string[] };
34
+ response: { success: boolean; error?: string };
35
+ };
36
+ /**
37
+ * Unregister a service
38
+ * Requires "appbus/expose" permission
39
+ */
40
+ "appbus/unregister": {
41
+ args: {
42
+ serviceName: string };
43
+ response: { success: boolean };
44
+ };
45
+ /**
46
+ * List all available services
47
+ * No permission required
48
+ */
49
+ "appbus/list": {
50
+ args: Record<string, never>;
51
+ response: { services: import("./index").ServiceInfo[] };
52
+ };
53
+ /**
54
+ * List services by app ID
55
+ * No permission required
56
+ */
57
+ "appbus/list-by-app": {
58
+ args: {
59
+ appId: string };
60
+ response: { services: import("./index").ServiceInfo[] };
61
+ };
62
+ /**
63
+ * Connect to another app's service
64
+ * Creates MessageChannel and transfers ports directly to both apps
65
+ * Requires "appbus/connect" permission
66
+ */
67
+ "appbus/connect": {
68
+ args: {
69
+ targetAppId: string;
70
+ serviceName: string };
71
+ response: import("./index").ConnectResult;
72
+ };
73
+ }
74
+
75
+ /**
76
+ * DbCommands - Commands for the "db" namespace
77
+ */
78
+ export interface DbCommands {
79
+ /**
80
+ * Get a value from database (scoped to caller's app)
81
+ */
82
+ "db/get": {
83
+ args: {
84
+ key: string };
85
+ response: { value: string | undefined };
86
+ };
87
+ /**
88
+ * Set a value in database (scoped to caller's app)
89
+ */
90
+ "db/set": {
91
+ args: {
92
+ key: string;
93
+ value: string };
94
+ response: { success: boolean };
95
+ };
96
+ /**
97
+ * Delete a key from database (scoped to caller's app)
98
+ */
99
+ "db/delete": {
100
+ args: {
101
+ key: string };
102
+ response: { success: boolean };
103
+ };
104
+ /**
105
+ * Check if a key exists (scoped to caller's app)
106
+ */
107
+ "db/has": {
108
+ args: {
109
+ key: string };
110
+ response: { exists: boolean };
111
+ };
112
+ /**
113
+ * Clear all keys (scoped to caller's app)
114
+ */
115
+ "db/clear": {
116
+ args: { };
117
+ response: { success: boolean };
118
+ };
119
+ /**
120
+ * List all keys (scoped to caller's app)
121
+ */
122
+ "db/list": {
123
+ args: { };
124
+ response: { keys: string[] };
125
+ };
126
+ /**
127
+ * Get a value from any app's namespace (superuser only)
128
+ */
129
+ "db/get/su": {
130
+ args: {
131
+ appId: string;
132
+ key: string };
133
+ response: { value: string | undefined };
134
+ };
135
+ /**
136
+ * Set a value in any app's namespace (superuser only)
137
+ */
138
+ "db/set/su": {
139
+ args: {
140
+ appId: string;
141
+ key: string;
142
+ value: string };
143
+ response: { success: boolean };
144
+ };
145
+ /**
146
+ * Delete a key from any app's namespace (superuser only)
147
+ */
148
+ "db/delete/su": {
149
+ args: {
150
+ appId: string;
151
+ key: string };
152
+ response: { success: boolean };
153
+ };
154
+ /**
155
+ * Check if a key exists in any app's namespace (superuser only)
156
+ */
157
+ "db/has/su": {
158
+ args: {
159
+ appId: string;
160
+ key: string };
161
+ response: { exists: boolean };
162
+ };
163
+ /**
164
+ * Clear all keys in any app's namespace (superuser only)
165
+ */
166
+ "db/clear/su": {
167
+ args: {
168
+ appId: string };
169
+ response: { success: boolean };
170
+ };
171
+ /**
172
+ * List all keys in any app's namespace (superuser only)
173
+ */
174
+ "db/list/su": {
175
+ args: {
176
+ appId: string };
177
+ response: { keys: string[] };
178
+ };
179
+ }
180
+
181
+ /**
182
+ * FileCommands - Commands for the "file" namespace
183
+ */
184
+ export interface FileCommands {
185
+ /**
186
+ * Open a file with its default handler
187
+ */
188
+ "file/open": {
189
+ args: { path: string };
190
+ response: import("./index").FileOpenResult;
191
+ };
192
+ /**
193
+ * Open a file with a specific app
194
+ */
195
+ "file/open-with": {
196
+ args: { path: string; appId: string };
197
+ response: import("./index").FileOpenResult;
198
+ };
199
+ /**
200
+ * Get the default handler app for a file extension
201
+ */
202
+ "file/get-handler": {
203
+ args: { extension: string };
204
+ response: { appId: string | undefined };
205
+ };
206
+ /**
207
+ * Set user preference for a file extension's default handler
208
+ */
209
+ "file/set-default-handler": {
210
+ args: { extension: string; appId: string };
211
+ response: void;
212
+ };
213
+ /**
214
+ * Remove user preference for a file extension (revert to default)
215
+ */
216
+ "file/remove-default-handler": {
217
+ args: { extension: string };
218
+ response: void;
219
+ };
220
+ /**
221
+ * Get all apps that can handle a specific file extension
222
+ */
223
+ "file/get-supported-handlers": {
224
+ args: { extension: string };
225
+ response: import("./index").FileHandlerInfo[];
226
+ };
227
+ /**
228
+ * Get all file type associations
229
+ */
230
+ "file/get-associations": {
231
+ args: Record<string, never>;
232
+ response: Record<string, { default: string | undefined; userOverride: string | undefined }>;
18
233
  };
19
234
  }
20
235
 
@@ -28,8 +243,7 @@ export interface FsCommands {
28
243
  "fs/read": {
29
244
  args: {
30
245
  path: string;
31
- encoding?: BufferEncoding;
32
- };
246
+ encoding?: BufferEncoding };
33
247
  response: string;
34
248
  };
35
249
  /**
@@ -39,8 +253,7 @@ export interface FsCommands {
39
253
  args: {
40
254
  path: string;
41
255
  content: string;
42
- encoding?: BufferEncoding;
43
- };
256
+ encoding?: BufferEncoding };
44
257
  response: void;
45
258
  };
46
259
  /**
@@ -69,12 +282,7 @@ export interface FsCommands {
69
282
  */
70
283
  "fs/stat": {
71
284
  args: { path: string };
72
- response: {
73
- isFile: boolean;
74
- isDirectory: boolean;
75
- size: number;
76
- mtime: Date;
77
- };
285
+ response: import("./index").FileStats;
78
286
  };
79
287
  /**
80
288
  * Search for files and directories using glob patterns.
@@ -83,13 +291,8 @@ export interface FsCommands {
83
291
  args: {
84
292
  path: string;
85
293
  pattern: string;
86
- limit?: number;
87
- };
88
- response: Array<{
89
- name: string;
90
- path: string;
91
- type: "file" | "folder";
92
- }>;
294
+ limit?: number };
295
+ response: import("./index").SearchResult[];
93
296
  };
94
297
  /**
95
298
  * Delete a file or directory.
@@ -101,6 +304,47 @@ export interface FsCommands {
101
304
  };
102
305
  }
103
306
 
307
+ /**
308
+ * EventCommands - Commands for the "event" namespace
309
+ */
310
+ export interface EventCommands {
311
+ "event/subscribe": {
312
+ args: {
313
+ eventName: string;
314
+ _callerWebContentsId?: number;
315
+ _callerAppId?: string };
316
+ response: void;
317
+ };
318
+ "event/unsubscribe": {
319
+ args: {
320
+ eventName: string;
321
+ _callerWebContentsId?: number;
322
+ _callerAppId?: string };
323
+ response: void;
324
+ };
325
+ "event/exists": {
326
+ args: { eventName: string };
327
+ response: boolean;
328
+ };
329
+ }
330
+
331
+ /**
332
+ * NotificationCommands - Commands for the "notification" namespace
333
+ */
334
+ export interface NotificationCommands {
335
+ /**
336
+ * Push a new notification to subscribers.
337
+ */
338
+ "notification/push": {
339
+ args: {
340
+ title: string;
341
+ message: string;
342
+ timeout?: number;
343
+ type?: import("./index").NotificationType };
344
+ response: import("./index").Notification;
345
+ };
346
+ }
347
+
104
348
  /**
105
349
  * PackageCommands - Commands for the "package" namespace
106
350
  */
@@ -110,7 +354,7 @@ export interface PackageCommands {
110
354
  */
111
355
  "package/install": {
112
356
  args: { sourcePath: string };
113
- response: AppManifest;
357
+ response: import("./index").AppManifest;
114
358
  };
115
359
  /**
116
360
  * Uninstall an application by its ID.
@@ -121,25 +365,36 @@ export interface PackageCommands {
121
365
  };
122
366
  /**
123
367
  * List all installed applications.
368
+ * @param showHidden - If true, includes overlay apps (hidden by default)
124
369
  */
125
- "package/list-installed": {
126
- args: Record<string, never>;
127
- response: AppManifest[];
370
+ "package/list": {
371
+ args: { showHidden?: boolean };
372
+ response: import("./index").AppManifest[];
128
373
  };
129
374
  /**
130
375
  * Toggle hot reload for an app
131
376
  */
132
377
  "package/toggle-hot-reload": {
133
- args: { appId: string };
378
+ args: {
379
+ appId: string };
134
380
  response: { enabled: boolean };
135
381
  };
136
382
  /**
137
383
  * Check if hot reload is enabled for an app
138
384
  */
139
385
  "package/is-hot-reload-enabled": {
140
- args: { appId: string };
386
+ args: {
387
+ appId: string };
141
388
  response: { enabled: boolean };
142
389
  };
390
+ /**
391
+ * Get the icon for an installed application as a data URL.
392
+ */
393
+ "package/get-icon": {
394
+ args: {
395
+ appId: string };
396
+ response: { icon: string | undefined };
397
+ };
143
398
  }
144
399
 
145
400
  /**
@@ -152,9 +407,8 @@ export interface ProcessCommands {
152
407
  "process/launch": {
153
408
  args: {
154
409
  appId: string;
155
- bounds?: ViewBounds;
156
- };
157
- response: LaunchResult;
410
+ bounds?: import("./index").ViewBounds };
411
+ response: import("./index").LaunchResult;
158
412
  };
159
413
  /**
160
414
  * Stop a running application instance.
@@ -165,10 +419,11 @@ export interface ProcessCommands {
165
419
  };
166
420
  /**
167
421
  * List all running application processes.
422
+ * @param showHidden - If true, includes overlay apps (hidden by default)
168
423
  */
169
424
  "process/list": {
170
- args: Record<string, never>;
171
- response: AppStatus;
425
+ args: { showHidden?: boolean };
426
+ response: import("./index").AppInstance[];
172
427
  };
173
428
  }
174
429
 
@@ -182,8 +437,7 @@ export interface ViewCommands {
182
437
  "view/update-view-bounds": {
183
438
  args: {
184
439
  appId: string;
185
- bounds: ViewBounds;
186
- };
440
+ bounds: import("./index").ViewBounds };
187
441
  response: { success: boolean };
188
442
  };
189
443
  /**
@@ -192,8 +446,7 @@ export interface ViewCommands {
192
446
  "view/set-view-visibility": {
193
447
  args: {
194
448
  appId: string;
195
- visible: boolean;
196
- };
449
+ visible: boolean };
197
450
  response: { success: boolean };
198
451
  };
199
452
  /**
@@ -208,9 +461,8 @@ export interface ViewCommands {
208
461
  */
209
462
  "view/update-global-bounds": {
210
463
  args: {
211
- bounds: ViewBounds;
212
- windowSize: WindowSize;
213
- };
464
+ bounds: import("./index").ViewBounds;
465
+ windowSize: import("./index").WindowSize };
214
466
  response: { success: boolean };
215
467
  };
216
468
  /**
@@ -219,8 +471,7 @@ export interface ViewCommands {
219
471
  "view/toggle-view-mode": {
220
472
  args: {
221
473
  appId: string;
222
- mode?: "floating" | "tiled";
223
- };
474
+ mode?: "floating" | "tiled" };
224
475
  response: { success: boolean };
225
476
  };
226
477
  /**
@@ -230,8 +481,7 @@ export interface ViewCommands {
230
481
  args: {
231
482
  appId: string;
232
483
  startX: number;
233
- startY: number;
234
- };
484
+ startY: number };
235
485
  response: { success: boolean };
236
486
  };
237
487
  /**
@@ -255,8 +505,7 @@ export interface ViewCommands {
255
505
  args: {
256
506
  appId: string;
257
507
  startX: number;
258
- startY: number;
259
- };
508
+ startY: number };
260
509
  response: { success: boolean };
261
510
  };
262
511
  /**
@@ -264,8 +513,7 @@ export interface ViewCommands {
264
513
  */
265
514
  "view/end-resize": {
266
515
  args: {
267
- appId: string;
268
- };
516
+ appId: string };
269
517
  response: { success: boolean };
270
518
  };
271
519
  /**
@@ -273,45 +521,11 @@ export interface ViewCommands {
273
521
  */
274
522
  "view/window-size": {
275
523
  args: Record<string, never>;
276
- response: WindowSize;
524
+ response: import("./index").WindowSize;
277
525
  };
278
526
  }
279
527
 
280
528
  /**
281
529
  * Global command map - merge all command namespaces
282
530
  */
283
- export interface CommandMap extends SystemCommands, FsCommands, PackageCommands, ProcessCommands, ViewCommands {}
284
-
285
- /**
286
- * Array of all available command names
287
- */
288
- export const COMMAND_NAMES = [
289
- "system/info",
290
- "fs/read",
291
- "fs/write",
292
- "fs/exists",
293
- "fs/mkdir",
294
- "fs/readdir",
295
- "fs/stat",
296
- "fs/search",
297
- "fs/delete",
298
- "package/install",
299
- "package/uninstall",
300
- "package/list-installed",
301
- "package/toggle-hot-reload",
302
- "package/is-hot-reload-enabled",
303
- "process/launch",
304
- "process/stop",
305
- "process/list",
306
- "view/update-view-bounds",
307
- "view/set-view-visibility",
308
- "view/focus-app",
309
- "view/update-global-bounds",
310
- "view/toggle-view-mode",
311
- "view/start-drag",
312
- "view/end-drag",
313
- "view/global-mouseup",
314
- "view/start-resize",
315
- "view/end-resize",
316
- "view/window-size"
317
- ] as const;
531
+ export interface CommandMap extends SystemCommands, AppbusCommands, DbCommands, FileCommands, FsCommands, EventCommands, NotificationCommands, PackageCommands, ProcessCommands, ViewCommands {}
package/events.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * AppEvents - Events sent from backend to renderer
3
- *
3
+ *
4
4
  * All events are sent via the unified 'shell-message' channel.
5
5
  * Views must subscribe to specific events to receive them.
6
- *
6
+ *
7
7
  * This file re-exports auto-generated event types.
8
8
  * Event definitions are automatically generated from @EdenNamespace decorators.
9
9
  * Run 'npm run codegen' to regenerate.
@@ -11,8 +11,11 @@
11
11
 
12
12
  export * from "./events.generated";
13
13
 
14
+ import { AppEvents } from "./events.generated";
15
+
14
16
  /**
15
17
  * Utility types for working with AppEvents
16
18
  */
17
- export type EventName = (typeof import("./events.generated").APP_EVENT_NAMES)[number];
18
- export type EventData<T extends EventName> = import("./events.generated").AppEvents[T];
19
+ export type EventName = keyof AppEvents;
20
+ export type EventData<T extends EventName> =
21
+ import("./events.generated").AppEvents[T];
@@ -2,14 +2,29 @@
2
2
  * AUTO-GENERATED FILE - DO NOT EDIT
3
3
  *
4
4
  * This file is automatically generated by scripts/generate-commands.ts
5
- * Run 'npm run codegen' to regenerate.
5
+ * Run 'pnpm run codegen' to regenerate.
6
6
  */
7
7
 
8
+ /**
9
+ * FileEvents - Events for the "file" namespace
10
+ */
11
+ export interface FileEvents {
12
+ "file/opened": { path: string; isDirectory: boolean; appId: string };
13
+ }
14
+
15
+ /**
16
+ * NotificationEvents - Events for the "notification" namespace
17
+ */
18
+ export interface NotificationEvents {
19
+ "notification/added": { notification: import("./index").Notification };
20
+ "notification/removed": { id: string };
21
+ }
22
+
8
23
  /**
9
24
  * PackageEvents - Events for the "package" namespace
10
25
  */
11
26
  export interface PackageEvents {
12
- "package/installed": { manifest: AppManifest };
27
+ "package/installed": { manifest: import("./index").AppManifest };
13
28
  "package/uninstalled": { appId: string };
14
29
  }
15
30
 
@@ -17,7 +32,7 @@ export interface PackageEvents {
17
32
  * ProcessEvents - Events for the "process" namespace
18
33
  */
19
34
  export interface ProcessEvents {
20
- "process/launched": { instance: AppInstance };
35
+ "process/launched": { instance: import("./index").AppInstance };
21
36
  "process/stopped": { appId: string };
22
37
  "process/error": { appId: string; error: any };
23
38
  "process/exited": { appId: string; code: number };
@@ -27,25 +42,22 @@ export interface ProcessEvents {
27
42
  * ViewEvents - Events for the "view" namespace
28
43
  */
29
44
  export interface ViewEvents {
30
- "view/bounds-updated": ViewBounds;
31
- "view/global-bounds-changed": { workspaceBounds: ViewBounds; windowSize: WindowSize };
45
+ "view/bounds-updated": import("./index").ViewBounds;
46
+ "view/global-bounds-changed": {
47
+ workspaceBounds: import("./index").ViewBounds;
48
+ windowSize: import("./index").WindowSize;
49
+ };
50
+ "view/view-loaded": { viewId: number; appId: string; overlay: boolean };
51
+ "view/view-load-failed": {
52
+ viewId: number;
53
+ appId: string;
54
+ errorCode: number;
55
+ errorDescription: string;
56
+ };
57
+ "view/mode-changed": { mode: "floating" | "tiled"; bounds: import("./index").ViewBounds };
32
58
  }
33
59
 
34
60
  /**
35
61
  * Global event map - merge all event namespaces
36
62
  */
37
- export interface AppEvents extends PackageEvents, ProcessEvents, ViewEvents {}
38
-
39
- /**
40
- * Array of all available event names
41
- */
42
- export const APP_EVENT_NAMES = [
43
- "package/installed",
44
- "package/uninstalled",
45
- "process/launched",
46
- "process/stopped",
47
- "process/error",
48
- "process/exited",
49
- "view/bounds-updated",
50
- "view/global-bounds-changed"
51
- ] as const;
63
+ export interface AppEvents extends FileEvents, NotificationEvents, PackageEvents, ProcessEvents, ViewEvents {}
package/global.d.ts CHANGED
@@ -1,60 +1,56 @@
1
1
  // Ambient declarations for renderer globals
2
2
 
3
- import type { CommandName, CommandArgs, CommandResult } from "./commands";
4
- import type { EventName, EventData } from "./events";
5
-
6
- export interface EdenAPI {
7
- /**
8
- * Execute a shell command with type-safe arguments
9
- * @param command - The command name (e.g., "process/launch")
10
- * @param args - Type-safe arguments for the command
11
- * @returns Promise with the command result
12
- *
13
- * @example
14
- * ```typescript
15
- * await edenAPI.shellCommand("process/launch", {
16
- * appId: "my-app",
17
- * bounds: { x: 0, y: 0, width: 800, height: 600 }
18
- * });
19
- * ```
20
- */
21
- shellCommand<T extends CommandName>(
22
- command: T,
23
- args: CommandArgs<T>
24
- ): Promise<CommandResult<T>>;
25
-
26
- /**
27
- * Subscribe to a system event
28
- * @param event - The event name
29
- * @param callback - Callback function receiving typed event data
30
- */
31
- subscribe<T extends EventName>(
32
- event: T,
33
- callback: (data: EventData<T>) => void
34
- ): Promise<void>;
35
-
36
- /**
37
- * Unsubscribe from a system event
38
- */
39
- unsubscribe<T extends EventName>(
40
- event: T,
41
- callback: (data: EventData<T>) => void
42
- ): void;
43
-
44
- /**
45
- * Check if an event is supported by the system
46
- */
47
- isEventSupported(event: string): Promise<boolean>;
3
+ import type { EdenAPI, AppBusAPI, AppBusConnection } from "./ipc";
4
+
5
+ export interface EdenFrame {
6
+ // Public API
7
+ setTitle: (title: string) => void;
8
+
9
+ // Internal state (used by frame system)
10
+ _internal: {
11
+ appId: string;
12
+ injected: boolean;
13
+ config: {
14
+ mode?: "tiled" | "floating" | "both";
15
+ showTitle?: boolean;
16
+ defaultSize?: { width: number; height: number };
17
+ defaultPosition?: { x: number; y: number };
18
+ movable?: boolean;
19
+ resizable?: boolean;
20
+ minSize?: { width: number; height: number };
21
+ maxSize?: { width: number; height: number };
22
+ };
23
+ currentMode: "tiled" | "floating";
24
+ bounds: {
25
+ x: number;
26
+ y: number;
27
+ width: number;
28
+ height: number;
29
+ };
30
+ };
48
31
  }
49
32
 
50
33
  declare global {
51
34
  interface Window {
52
35
  /**
53
- * Eden API instance available only in renderer processes
36
+ * Eden API instance available in renderer processes
37
+ */
38
+ edenAPI: EdenAPI;
39
+
40
+ /**
41
+ * AppBus instance for app-to-app communication
54
42
  */
55
- edenAPI?: EdenAPI;
43
+ appBus: AppBusAPI;
44
+
45
+ /**
46
+ * Get AppAPI for frontend<->backend communication
47
+ * Throws if connection is not available
48
+ */
49
+ getAppAPI: () => AppBusConnection;
50
+
51
+ edenFrame?: EdenFrame;
56
52
  }
57
53
  }
58
54
 
59
55
  // This export is important - it marks the file as a module
60
- export {};
56
+ export {};
package/index.d.ts CHANGED
@@ -6,6 +6,10 @@ export * from "./AppManifest";
6
6
 
7
7
  export * from "./global";
8
8
 
9
+ export * from "./worker";
10
+
11
+ export * from "./ipc";
12
+
9
13
  /**
10
14
  * App Instance Interface
11
15
  *
@@ -80,6 +84,9 @@ export type {
80
84
  // Export event types
81
85
  export * from "./events";
82
86
 
87
+ // Export channel/appbus types
88
+ export * from "./channels";
89
+
83
90
  export interface SystemInfo {
84
91
  platform: string;
85
92
  arch: string;
@@ -99,7 +106,59 @@ export interface LaunchResult {
99
106
  appId: string;
100
107
  }
101
108
 
102
- export interface AppStatus {
103
- installed: AppManifest[];
104
- running: AppInstance[];
109
+ /**
110
+ * Result of opening a file
111
+ */
112
+ export interface FileOpenResult {
113
+ success: boolean;
114
+ appId?: string;
115
+ error?: string;
116
+ }
117
+
118
+ /**
119
+ * Information about a file handler
120
+ */
121
+ export interface FileHandlerInfo {
122
+ appId: string;
123
+ appName: string;
124
+ handlerName?: string;
125
+ icon?: string;
126
+ }
127
+
128
+ /**
129
+ * File or directory statistics
130
+ */
131
+ export interface FileStats {
132
+ isFile: boolean;
133
+ isDirectory: boolean;
134
+ size: number;
135
+ mtime: Date;
136
+ }
137
+
138
+ /**
139
+ * Search result for filesystem queries
140
+ */
141
+ export interface SearchResult {
142
+ name: string;
143
+ path: string;
144
+ type: "file" | "folder";
145
+ }
146
+
147
+ /**
148
+ * Notification type/variant for styling
149
+ */
150
+ export type NotificationType = "info" | "success" | "warning" | "danger";
151
+
152
+ /**
153
+ * Notification data structure
154
+ */
155
+ export interface Notification {
156
+ id: string;
157
+ title: string;
158
+ message: string;
159
+ /** Timeout in ms. If 0 or omitted, notification persists until dismissed. */
160
+ timeout?: number;
161
+ createdAt: number;
162
+ /** Notification type for styling (default: info) */
163
+ type?: NotificationType;
105
164
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edenapp/types",
3
- "version": "0.1.2",
3
+ "version": "0.3.0",
4
4
  "description": "TypeScript type definitions for the Eden platform",
5
5
  "types": "index.d.ts",
6
6
  "author": "Dariusz Majnert",
@@ -0,0 +1,13 @@
1
+ /**
2
+ * AUTO-GENERATED FILE - DO NOT EDIT
3
+ *
4
+ * Type declarations for runtime arrays.
5
+ * Generated by scripts/generate-commands.ts
6
+ * Run 'pnpm run codegen' to regenerate.
7
+ */
8
+
9
+ // Command names array
10
+ export declare const COMMAND_NAMES: readonly string[];
11
+
12
+ // Event names array
13
+ export declare const APP_EVENT_NAMES: readonly string[];
package/worker.d.ts ADDED
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Worker Global Type Definitions
3
+ *
4
+ * Type definitions for the global `worker` object available in utility processes.
5
+ * This mirrors the frontend's `window.edenAPI` and `window.appBus` pattern.
6
+ */
7
+
8
+ import type { EdenAPI, AppBusAPI, AppBusConnection } from "./ipc";
9
+
10
+ /**
11
+ * Worker global - backend runtime namespace
12
+ * Mirrors the frontend's window.* pattern
13
+ */
14
+ export interface WorkerGlobal {
15
+ edenAPI: EdenAPI;
16
+ appBus: AppBusAPI;
17
+ getAppAPI: () => AppBusConnection;
18
+ }
19
+
20
+ /**
21
+ * Backend globals (utility process)
22
+ * These are set by backend-preload.ts for utility processes
23
+ */
24
+ declare global {
25
+ /**
26
+ * Worker namespace (backend only)
27
+ * Mirrors frontend's window.* pattern:
28
+ * - Frontend: window.edenAPI, window.appBus
29
+ * - Backend: worker.edenAPI, worker.appBus
30
+ */
31
+ var worker: WorkerGlobal | undefined;
32
+ }