@edenapp/types 0.1.2 → 0.1.4

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,89 @@ 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
+
89
+ /**
90
+ * Supported setting input types
91
+ */
92
+ export type SettingType =
93
+ | "text"
94
+ | "number"
95
+ | "checkbox"
96
+ | "radio"
97
+ | "select"
98
+ | "toggle"
99
+ | "textarea"
100
+ | "color"
101
+ | "range";
102
+
103
+ /**
104
+ * Option for radio/select settings
105
+ */
106
+ export interface SettingOption {
107
+ /** Value stored when this option is selected */
108
+ value: string;
109
+ /** Display label for this option */
110
+ label: string;
111
+ /** Optional description for this option */
112
+ description?: string;
113
+ }
114
+
115
+ /**
116
+ * Individual setting definition
117
+ */
118
+ export interface SettingDefinition {
119
+ /** Unique key for this setting */
120
+ key: string;
121
+ /** Display label */
122
+ label: string;
123
+ /** Description shown as help text */
124
+ description?: string;
125
+ /** Input type */
126
+ type: SettingType;
127
+ /** Default value (as string, will be parsed based on type) */
128
+ defaultValue?: string;
129
+ /** Options for radio/select types */
130
+ options?: SettingOption[];
131
+ /** Placeholder for text/textarea */
132
+ placeholder?: string;
133
+ /** Min value for number/range */
134
+ min?: number;
135
+ /** Max value for number/range */
136
+ max?: number;
137
+ /** Step for number/range */
138
+ step?: number;
139
+ }
140
+
141
+ /**
142
+ * Settings category (group of related settings)
143
+ */
144
+ export interface SettingsCategory {
145
+ /** Category ID */
146
+ id: string;
147
+ /** Display name */
148
+ name: string;
149
+ /** Category icon (optional) */
150
+ icon?: string;
151
+ /** Settings in this category */
152
+ settings: SettingDefinition[];
153
+ }
154
+
57
155
  /**
58
156
  * App Manifest Interface
59
157
  *
@@ -92,11 +190,23 @@ export interface AppManifest {
92
190
  };
93
191
  };
94
192
 
95
- /** Frontend configuration */
96
- frontend: {
193
+ /**
194
+ * Frontend configuration.
195
+ * Optional - omit for backend-only apps (daemons).
196
+ * At least one of `frontend` or `backend` must be defined.
197
+ */
198
+ frontend?: {
97
199
  /** Path to the frontend HTML entry file */
98
200
  entry: string;
99
201
 
202
+ /**
203
+ * Allow remote URLs to be embedded in iframes.
204
+ * When true, strips X-Frame-Options and CSP frame-ancestors headers
205
+ * that would otherwise prevent embedding.
206
+ * Only applies to remote (http/https) frontend entries.
207
+ */
208
+ allowEmbedding?: boolean;
209
+
100
210
  /** WebContentsView options */
101
211
  options?: {
102
212
  /** Enable Node.js integration in the view (default: false) */
@@ -120,9 +230,41 @@ export interface AppManifest {
120
230
  build?: {
121
231
  /** Command to build the app (e.g., "npm run build") */
122
232
  command: string;
233
+ /** Working directory for build command (relative to app root) */
234
+ cwd?: string;
123
235
  };
124
236
 
125
237
  /** Internal flag indicating if this is a prebuilt system app */
126
238
  isPrebuilt?: boolean;
127
- }
128
239
 
240
+ /**
241
+ * Permissions requested by this app.
242
+ * Supports glob patterns: "fs/*" for all fs permissions, "*" for all permissions.
243
+ */
244
+ permissions?: string[];
245
+
246
+ /**
247
+ * File types this app can handle.
248
+ * Used for "open with" functionality and automatic handler detection.
249
+ */
250
+ fileHandlers?: FileHandlerConfig[];
251
+
252
+ /**
253
+ * Whether this app runs as a system overlay.
254
+ * Overlays are rendered above regular apps.
255
+ */
256
+ overlay?: boolean;
257
+
258
+ /**
259
+ * Services this app exposes for other apps to connect to.
260
+ * Declaring services here documents the app's API and enables
261
+ * optional access control via allowedClients.
262
+ */
263
+ services?: ServiceDeclaration[];
264
+
265
+ /**
266
+ * App settings configuration.
267
+ * Defines settings categories and individual settings that can be configured.
268
+ */
269
+ settings?: SettingsCategory[];
270
+ }
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?: string };
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?: string };
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,109 @@ 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": {
425
+ args: { showHidden?: boolean };
426
+ response: import("./index").AppInstance[];
427
+ };
428
+ }
429
+
430
+ /**
431
+ * SettingsCommands - Commands for the "settings" namespace
432
+ */
433
+ export interface SettingsCommands {
434
+ /**
435
+ * Get a setting value (scoped to caller's app)
436
+ */
437
+ "settings/get": {
438
+ args: {
439
+ key: string };
440
+ response: { value: string | undefined };
441
+ };
442
+ /**
443
+ * Set a setting value (scoped to caller's app)
444
+ */
445
+ "settings/set": {
446
+ args: {
447
+ key: string;
448
+ value: string };
449
+ response: { success: boolean };
450
+ };
451
+ /**
452
+ * List all settings keys (scoped to caller's app)
453
+ */
454
+ "settings/list": {
455
+ args: { };
456
+ response: { keys: string[] };
457
+ };
458
+ /**
459
+ * Get all settings with values (scoped to caller's app)
460
+ */
461
+ "settings/get-all": {
462
+ args: { };
463
+ response: { settings: Record<string, string> };
464
+ };
465
+ /**
466
+ * Reset a setting to default (scoped to caller's app)
467
+ */
468
+ "settings/reset": {
469
+ args: {
470
+ key: string;
471
+ schema?: import("./index").SettingsCategory[] };
472
+ response: { success: boolean };
473
+ };
474
+ /**
475
+ * Get a setting from any app's namespace (superuser only)
476
+ */
477
+ "settings/get/su": {
478
+ args: {
479
+ appId: string;
480
+ key: string };
481
+ response: { value: string | undefined };
482
+ };
483
+ /**
484
+ * Set a setting in any app's namespace (superuser only)
485
+ */
486
+ "settings/set/su": {
487
+ args: {
488
+ appId: string;
489
+ key: string;
490
+ value: string };
491
+ response: { success: boolean };
492
+ };
493
+ /**
494
+ * List all settings in any app's namespace (superuser only)
495
+ */
496
+ "settings/list/su": {
497
+ args: {
498
+ appId: string };
499
+ response: { keys: string[] };
500
+ };
501
+ /**
502
+ * Get all settings with values for any app (superuser only)
503
+ */
504
+ "settings/get-all/su": {
505
+ args: {
506
+ appId: string };
507
+ response: { settings: Record<string, string> };
508
+ };
509
+ /**
510
+ * Reset a setting for any app (superuser only)
511
+ */
512
+ "settings/reset/su": {
513
+ args: {
514
+ appId: string;
515
+ key: string;
516
+ schema?: import("./index").SettingsCategory[] };
517
+ response: { success: boolean };
518
+ };
519
+ /**
520
+ * Get the Eden settings schema
521
+ */
522
+ "settings/schema": {
170
523
  args: Record<string, never>;
171
- response: AppStatus;
524
+ response: { schema: import("./index").SettingsCategory[] };
172
525
  };
173
526
  }
174
527
 
@@ -182,8 +535,7 @@ export interface ViewCommands {
182
535
  "view/update-view-bounds": {
183
536
  args: {
184
537
  appId: string;
185
- bounds: ViewBounds;
186
- };
538
+ bounds: import("./index").ViewBounds };
187
539
  response: { success: boolean };
188
540
  };
189
541
  /**
@@ -192,8 +544,7 @@ export interface ViewCommands {
192
544
  "view/set-view-visibility": {
193
545
  args: {
194
546
  appId: string;
195
- visible: boolean;
196
- };
547
+ visible: boolean };
197
548
  response: { success: boolean };
198
549
  };
199
550
  /**
@@ -208,9 +559,8 @@ export interface ViewCommands {
208
559
  */
209
560
  "view/update-global-bounds": {
210
561
  args: {
211
- bounds: ViewBounds;
212
- windowSize: WindowSize;
213
- };
562
+ bounds: import("./index").ViewBounds;
563
+ windowSize: import("./index").WindowSize };
214
564
  response: { success: boolean };
215
565
  };
216
566
  /**
@@ -219,8 +569,7 @@ export interface ViewCommands {
219
569
  "view/toggle-view-mode": {
220
570
  args: {
221
571
  appId: string;
222
- mode?: "floating" | "tiled";
223
- };
572
+ mode?: "floating" | "tiled" };
224
573
  response: { success: boolean };
225
574
  };
226
575
  /**
@@ -230,8 +579,7 @@ export interface ViewCommands {
230
579
  args: {
231
580
  appId: string;
232
581
  startX: number;
233
- startY: number;
234
- };
582
+ startY: number };
235
583
  response: { success: boolean };
236
584
  };
237
585
  /**
@@ -255,8 +603,7 @@ export interface ViewCommands {
255
603
  args: {
256
604
  appId: string;
257
605
  startX: number;
258
- startY: number;
259
- };
606
+ startY: number };
260
607
  response: { success: boolean };
261
608
  };
262
609
  /**
@@ -264,8 +611,7 @@ export interface ViewCommands {
264
611
  */
265
612
  "view/end-resize": {
266
613
  args: {
267
- appId: string;
268
- };
614
+ appId: string };
269
615
  response: { success: boolean };
270
616
  };
271
617
  /**
@@ -273,45 +619,11 @@ export interface ViewCommands {
273
619
  */
274
620
  "view/window-size": {
275
621
  args: Record<string, never>;
276
- response: WindowSize;
622
+ response: import("./index").WindowSize;
277
623
  };
278
624
  }
279
625
 
280
626
  /**
281
627
  * Global command map - merge all command namespaces
282
628
  */
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;
629
+ export interface CommandMap extends SystemCommands, AppbusCommands, DbCommands, FileCommands, FsCommands, EventCommands, NotificationCommands, PackageCommands, ProcessCommands, SettingsCommands, 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,35 +32,39 @@ 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 };
24
39
  }
25
40
 
41
+ /**
42
+ * SettingsEvents - Events for the "settings" namespace
43
+ */
44
+ export interface SettingsEvents {
45
+ "settings/changed": { appId: string; key: string; value: string };
46
+ }
47
+
26
48
  /**
27
49
  * ViewEvents - Events for the "view" namespace
28
50
  */
29
51
  export interface ViewEvents {
30
- "view/bounds-updated": ViewBounds;
31
- "view/global-bounds-changed": { workspaceBounds: ViewBounds; windowSize: WindowSize };
52
+ "view/bounds-updated": import("./index").ViewBounds;
53
+ "view/global-bounds-changed": {
54
+ workspaceBounds: import("./index").ViewBounds;
55
+ windowSize: import("./index").WindowSize;
56
+ };
57
+ "view/view-loaded": { viewId: number; appId: string; overlay: boolean };
58
+ "view/view-load-failed": {
59
+ viewId: number;
60
+ appId: string;
61
+ errorCode: number;
62
+ errorDescription: string;
63
+ };
64
+ "view/mode-changed": { mode: "floating" | "tiled"; bounds: import("./index").ViewBounds };
32
65
  }
33
66
 
34
67
  /**
35
68
  * Global event map - merge all event namespaces
36
69
  */
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;
70
+ export interface AppEvents extends FileEvents, NotificationEvents, PackageEvents, ProcessEvents, SettingsEvents, 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.1.4",
4
4
  "description": "TypeScript type definitions for the Eden platform",
5
5
  "types": "index.d.ts",
6
6
  "author": "Dariusz Majnert",
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
+ }