@edenapp/types 0.1.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 +128 -0
- package/EdenConfig.d.ts +36 -0
- package/README.md +30 -0
- package/commands.d.ts +32 -0
- package/commands.generated.d.ts +317 -0
- package/events.d.ts +18 -0
- package/events.generated.d.ts +51 -0
- package/global.d.ts +55 -0
- package/index.d.ts +103 -0
- package/package.json +23 -0
package/AppManifest.d.ts
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Window Mode Configuration
|
|
3
|
+
*
|
|
4
|
+
* Defines how an app's window can be displayed
|
|
5
|
+
*/
|
|
6
|
+
export type WindowMode = "floating" | "tiled" | "both";
|
|
7
|
+
|
|
8
|
+
export interface WindowInjectionOptions {
|
|
9
|
+
/** Inject the Eden design system CSS into the view (default: true) */
|
|
10
|
+
css?: boolean;
|
|
11
|
+
|
|
12
|
+
/** Inject the Eden app frame with title bar controls (default: true) */
|
|
13
|
+
appFrame?: boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface WindowConfig {
|
|
17
|
+
/** Window display modes supported by the app */
|
|
18
|
+
mode: WindowMode;
|
|
19
|
+
|
|
20
|
+
/** Default window size for floating mode */
|
|
21
|
+
defaultSize?: {
|
|
22
|
+
width: number;
|
|
23
|
+
height: number;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/** Default window position for floating mode (if not specified, will be centered) */
|
|
27
|
+
defaultPosition?: {
|
|
28
|
+
x: number;
|
|
29
|
+
y: number;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/** Minimum window size */
|
|
33
|
+
minSize?: {
|
|
34
|
+
width: number;
|
|
35
|
+
height: number;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/** Maximum window size */
|
|
39
|
+
maxSize?: {
|
|
40
|
+
width: number;
|
|
41
|
+
height: number;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/** Whether the window can be resized (default: true for floating, false for tiled) */
|
|
45
|
+
resizable?: boolean;
|
|
46
|
+
|
|
47
|
+
/** Whether the window can be moved (default: true for floating, false for tiled) */
|
|
48
|
+
movable?: boolean;
|
|
49
|
+
|
|
50
|
+
/** Whether to show the title in the title bar (default: true) */
|
|
51
|
+
showTitle?: boolean;
|
|
52
|
+
|
|
53
|
+
/** Controls which Eden runtime helpers are injected into the app */
|
|
54
|
+
injections?: WindowInjectionOptions;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* App Manifest Interface
|
|
59
|
+
*
|
|
60
|
+
* Defines the structure of an Eden app package.
|
|
61
|
+
* Each app must include a manifest.json file with this structure.
|
|
62
|
+
*/
|
|
63
|
+
export interface AppManifest {
|
|
64
|
+
/** Unique identifier for the app (e.g., "com.example.myapp") */
|
|
65
|
+
id: string;
|
|
66
|
+
|
|
67
|
+
/** Human-readable name */
|
|
68
|
+
name: string;
|
|
69
|
+
|
|
70
|
+
/** Version string (semver recommended) */
|
|
71
|
+
version: string;
|
|
72
|
+
|
|
73
|
+
/** App description */
|
|
74
|
+
description?: string;
|
|
75
|
+
|
|
76
|
+
/** App author information */
|
|
77
|
+
author?: string;
|
|
78
|
+
|
|
79
|
+
/** Entry point for the backend worker thread */
|
|
80
|
+
backend?: {
|
|
81
|
+
/** Path to the backend entry file (relative to app root) */
|
|
82
|
+
entry: string;
|
|
83
|
+
|
|
84
|
+
/** Worker thread options */
|
|
85
|
+
options?: {
|
|
86
|
+
/** Resource limits for the worker */
|
|
87
|
+
resourceLimits?: {
|
|
88
|
+
maxOldGenerationSizeMb?: number;
|
|
89
|
+
maxYoungGenerationSizeMb?: number;
|
|
90
|
+
codeRangeSizeMb?: number;
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
/** Frontend configuration */
|
|
96
|
+
frontend: {
|
|
97
|
+
/** Path to the frontend HTML entry file */
|
|
98
|
+
entry: string;
|
|
99
|
+
|
|
100
|
+
/** WebContentsView options */
|
|
101
|
+
options?: {
|
|
102
|
+
/** Enable Node.js integration in the view (default: false) */
|
|
103
|
+
nodeIntegration?: boolean;
|
|
104
|
+
|
|
105
|
+
/** Enable context isolation (default: true) */
|
|
106
|
+
contextIsolation?: boolean;
|
|
107
|
+
|
|
108
|
+
/** Preload script path (relative to app root) */
|
|
109
|
+
preload?: string;
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
/** Window configuration */
|
|
114
|
+
window?: WindowConfig;
|
|
115
|
+
|
|
116
|
+
/** App icon path (relative to app root) */
|
|
117
|
+
icon?: string;
|
|
118
|
+
|
|
119
|
+
/** Build configuration (for prebuilt apps) */
|
|
120
|
+
build?: {
|
|
121
|
+
/** Command to build the app (e.g., "npm run build") */
|
|
122
|
+
command: string;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
/** Internal flag indicating if this is a prebuilt system app */
|
|
126
|
+
isPrebuilt?: boolean;
|
|
127
|
+
}
|
|
128
|
+
|
package/EdenConfig.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tiling Configuration
|
|
3
|
+
*
|
|
4
|
+
* Defines how the workspace should be divided for apps
|
|
5
|
+
*/
|
|
6
|
+
export type TilingMode = "none" | "horizontal" | "vertical" | "grid";
|
|
7
|
+
|
|
8
|
+
export interface TilingConfig {
|
|
9
|
+
/** Tiling mode */
|
|
10
|
+
mode: TilingMode;
|
|
11
|
+
|
|
12
|
+
/** Number of columns (for grid mode) */
|
|
13
|
+
columns?: number;
|
|
14
|
+
|
|
15
|
+
/** Number of rows (for grid mode) */
|
|
16
|
+
rows?: number;
|
|
17
|
+
|
|
18
|
+
/** Gap between tiles in pixels */
|
|
19
|
+
gap?: number;
|
|
20
|
+
|
|
21
|
+
/** Padding around the workspace in pixels */
|
|
22
|
+
padding?: number;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface EdenConfig {
|
|
26
|
+
appsDirectory?: string;
|
|
27
|
+
userDirectory?: string;
|
|
28
|
+
window?: {
|
|
29
|
+
width?: number;
|
|
30
|
+
height?: number;
|
|
31
|
+
title?: string;
|
|
32
|
+
backgroundColor?: string;
|
|
33
|
+
};
|
|
34
|
+
tiling?: TilingConfig;
|
|
35
|
+
development?: boolean;
|
|
36
|
+
}
|
package/README.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# @edenapp/types
|
|
2
|
+
|
|
3
|
+
TypeScript type definitions for the Eden platform.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
For Eden app development:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -D @edenapp/types
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
Import types in your Eden app:
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
// Use Eden API in your app's frontend
|
|
19
|
+
const files = await window.edenAPI.shellCommand('fs/readdir', {
|
|
20
|
+
path: '/home/user/documents'
|
|
21
|
+
});
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Documentation
|
|
25
|
+
|
|
26
|
+
For complete Eden platform documentation, visit the main [Eden repository](https://github.com/b0czek/eden).
|
|
27
|
+
|
|
28
|
+
## License
|
|
29
|
+
|
|
30
|
+
MIT
|
package/commands.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Command Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* Type-safe command definitions for the Eden IPC system.
|
|
5
|
+
* Commands are organized by namespace (e.g., "app", "view").
|
|
6
|
+
*
|
|
7
|
+
* NOTE: The actual command interfaces are auto-generated from @EdenHandler decorators.
|
|
8
|
+
* See commands.generated.ts (generated by scripts/generate-commands.ts)
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Re-export auto-generated command interfaces and CommandMap
|
|
13
|
+
* These are generated from @EdenHandler decorators at build time
|
|
14
|
+
*/
|
|
15
|
+
export * from "./commands.generated";
|
|
16
|
+
|
|
17
|
+
import { CommandMap } from "./commands.generated";
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Type-safe command name
|
|
21
|
+
*/
|
|
22
|
+
export type CommandName = keyof CommandMap;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Get command arguments type
|
|
26
|
+
*/
|
|
27
|
+
export type CommandArgs<T extends CommandName> = CommandMap[T]["args"];
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Get command result type
|
|
31
|
+
*/
|
|
32
|
+
export type CommandResult<T extends CommandName> = CommandMap[T]["response"];
|
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AUTO-GENERATED FILE - DO NOT EDIT
|
|
3
|
+
*
|
|
4
|
+
* This file is automatically generated by scripts/generate-commands.ts
|
|
5
|
+
* Run 'npm run codegen' to regenerate.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* SystemCommands - Commands for the "system" namespace
|
|
10
|
+
*/
|
|
11
|
+
export interface SystemCommands {
|
|
12
|
+
/**
|
|
13
|
+
* Get system information including platform, versions, and running apps.
|
|
14
|
+
*/
|
|
15
|
+
"system/info": {
|
|
16
|
+
args: Record<string, never>;
|
|
17
|
+
response: SystemInfo;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* FsCommands - Commands for the "fs" namespace
|
|
23
|
+
*/
|
|
24
|
+
export interface FsCommands {
|
|
25
|
+
/**
|
|
26
|
+
* Read the contents of a file.
|
|
27
|
+
*/
|
|
28
|
+
"fs/read": {
|
|
29
|
+
args: {
|
|
30
|
+
path: string;
|
|
31
|
+
encoding?: BufferEncoding;
|
|
32
|
+
};
|
|
33
|
+
response: string;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Write content to a file, creating directories if needed.
|
|
37
|
+
*/
|
|
38
|
+
"fs/write": {
|
|
39
|
+
args: {
|
|
40
|
+
path: string;
|
|
41
|
+
content: string;
|
|
42
|
+
encoding?: BufferEncoding;
|
|
43
|
+
};
|
|
44
|
+
response: void;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Check if a file or directory exists.
|
|
48
|
+
*/
|
|
49
|
+
"fs/exists": {
|
|
50
|
+
args: { path: string };
|
|
51
|
+
response: boolean;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Create a directory and any necessary parent directories.
|
|
55
|
+
*/
|
|
56
|
+
"fs/mkdir": {
|
|
57
|
+
args: { path: string };
|
|
58
|
+
response: void;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* List contents of a directory.
|
|
62
|
+
*/
|
|
63
|
+
"fs/readdir": {
|
|
64
|
+
args: { path: string };
|
|
65
|
+
response: string[];
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Get file or directory statistics.
|
|
69
|
+
*/
|
|
70
|
+
"fs/stat": {
|
|
71
|
+
args: { path: string };
|
|
72
|
+
response: {
|
|
73
|
+
isFile: boolean;
|
|
74
|
+
isDirectory: boolean;
|
|
75
|
+
size: number;
|
|
76
|
+
mtime: Date;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Search for files and directories using glob patterns.
|
|
81
|
+
*/
|
|
82
|
+
"fs/search": {
|
|
83
|
+
args: {
|
|
84
|
+
path: string;
|
|
85
|
+
pattern: string;
|
|
86
|
+
limit?: number;
|
|
87
|
+
};
|
|
88
|
+
response: Array<{
|
|
89
|
+
name: string;
|
|
90
|
+
path: string;
|
|
91
|
+
type: "file" | "folder";
|
|
92
|
+
}>;
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* Delete a file or directory.
|
|
96
|
+
* For directories, removes recursively.
|
|
97
|
+
*/
|
|
98
|
+
"fs/delete": {
|
|
99
|
+
args: { path: string };
|
|
100
|
+
response: void;
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* PackageCommands - Commands for the "package" namespace
|
|
106
|
+
*/
|
|
107
|
+
export interface PackageCommands {
|
|
108
|
+
/**
|
|
109
|
+
* Install an application from a local path.
|
|
110
|
+
*/
|
|
111
|
+
"package/install": {
|
|
112
|
+
args: { sourcePath: string };
|
|
113
|
+
response: AppManifest;
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* Uninstall an application by its ID.
|
|
117
|
+
*/
|
|
118
|
+
"package/uninstall": {
|
|
119
|
+
args: { appId: string };
|
|
120
|
+
response: boolean;
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* List all installed applications.
|
|
124
|
+
*/
|
|
125
|
+
"package/list-installed": {
|
|
126
|
+
args: Record<string, never>;
|
|
127
|
+
response: AppManifest[];
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* Toggle hot reload for an app
|
|
131
|
+
*/
|
|
132
|
+
"package/toggle-hot-reload": {
|
|
133
|
+
args: { appId: string };
|
|
134
|
+
response: { enabled: boolean };
|
|
135
|
+
};
|
|
136
|
+
/**
|
|
137
|
+
* Check if hot reload is enabled for an app
|
|
138
|
+
*/
|
|
139
|
+
"package/is-hot-reload-enabled": {
|
|
140
|
+
args: { appId: string };
|
|
141
|
+
response: { enabled: boolean };
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* ProcessCommands - Commands for the "process" namespace
|
|
147
|
+
*/
|
|
148
|
+
export interface ProcessCommands {
|
|
149
|
+
/**
|
|
150
|
+
* Launch an application instance.
|
|
151
|
+
*/
|
|
152
|
+
"process/launch": {
|
|
153
|
+
args: {
|
|
154
|
+
appId: string;
|
|
155
|
+
bounds?: ViewBounds;
|
|
156
|
+
};
|
|
157
|
+
response: LaunchResult;
|
|
158
|
+
};
|
|
159
|
+
/**
|
|
160
|
+
* Stop a running application instance.
|
|
161
|
+
*/
|
|
162
|
+
"process/stop": {
|
|
163
|
+
args: { appId: string };
|
|
164
|
+
response: { success: boolean };
|
|
165
|
+
};
|
|
166
|
+
/**
|
|
167
|
+
* List all running application processes.
|
|
168
|
+
*/
|
|
169
|
+
"process/list": {
|
|
170
|
+
args: Record<string, never>;
|
|
171
|
+
response: AppStatus;
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* ViewCommands - Commands for the "view" namespace
|
|
177
|
+
*/
|
|
178
|
+
export interface ViewCommands {
|
|
179
|
+
/**
|
|
180
|
+
* Update the bounds (position and size) of a specific view.
|
|
181
|
+
*/
|
|
182
|
+
"view/update-view-bounds": {
|
|
183
|
+
args: {
|
|
184
|
+
appId: string;
|
|
185
|
+
bounds: ViewBounds;
|
|
186
|
+
};
|
|
187
|
+
response: { success: boolean };
|
|
188
|
+
};
|
|
189
|
+
/**
|
|
190
|
+
* Show or hide a specific view.
|
|
191
|
+
*/
|
|
192
|
+
"view/set-view-visibility": {
|
|
193
|
+
args: {
|
|
194
|
+
appId: string;
|
|
195
|
+
visible: boolean;
|
|
196
|
+
};
|
|
197
|
+
response: { success: boolean };
|
|
198
|
+
};
|
|
199
|
+
/**
|
|
200
|
+
* Bring an application's view to the front and focus it.
|
|
201
|
+
*/
|
|
202
|
+
"view/focus-app": {
|
|
203
|
+
args: { appId: string };
|
|
204
|
+
response: { success: boolean };
|
|
205
|
+
};
|
|
206
|
+
/**
|
|
207
|
+
* Update the available workspace bounds (e.g. after taskbar resize).
|
|
208
|
+
*/
|
|
209
|
+
"view/update-global-bounds": {
|
|
210
|
+
args: {
|
|
211
|
+
bounds: ViewBounds;
|
|
212
|
+
windowSize: WindowSize;
|
|
213
|
+
};
|
|
214
|
+
response: { success: boolean };
|
|
215
|
+
};
|
|
216
|
+
/**
|
|
217
|
+
* Toggle between floating and tiled window modes.
|
|
218
|
+
*/
|
|
219
|
+
"view/toggle-view-mode": {
|
|
220
|
+
args: {
|
|
221
|
+
appId: string;
|
|
222
|
+
mode?: "floating" | "tiled";
|
|
223
|
+
};
|
|
224
|
+
response: { success: boolean };
|
|
225
|
+
};
|
|
226
|
+
/**
|
|
227
|
+
* Start dragging a window.
|
|
228
|
+
*/
|
|
229
|
+
"view/start-drag": {
|
|
230
|
+
args: {
|
|
231
|
+
appId: string;
|
|
232
|
+
startX: number;
|
|
233
|
+
startY: number;
|
|
234
|
+
};
|
|
235
|
+
response: { success: boolean };
|
|
236
|
+
};
|
|
237
|
+
/**
|
|
238
|
+
* End the current drag operation.
|
|
239
|
+
*/
|
|
240
|
+
"view/end-drag": {
|
|
241
|
+
args: { appId: string };
|
|
242
|
+
response: { success: boolean };
|
|
243
|
+
};
|
|
244
|
+
/**
|
|
245
|
+
* Handle global mouse up event to stop any active drag/resize operations.
|
|
246
|
+
*/
|
|
247
|
+
"view/global-mouseup": {
|
|
248
|
+
args: Record<string, never>;
|
|
249
|
+
response: { success: boolean };
|
|
250
|
+
};
|
|
251
|
+
/**
|
|
252
|
+
* Start resizing a window.
|
|
253
|
+
*/
|
|
254
|
+
"view/start-resize": {
|
|
255
|
+
args: {
|
|
256
|
+
appId: string;
|
|
257
|
+
startX: number;
|
|
258
|
+
startY: number;
|
|
259
|
+
};
|
|
260
|
+
response: { success: boolean };
|
|
261
|
+
};
|
|
262
|
+
/**
|
|
263
|
+
* End the current resize operation.
|
|
264
|
+
*/
|
|
265
|
+
"view/end-resize": {
|
|
266
|
+
args: {
|
|
267
|
+
appId: string;
|
|
268
|
+
};
|
|
269
|
+
response: { success: boolean };
|
|
270
|
+
};
|
|
271
|
+
/**
|
|
272
|
+
* Get the current dimensions of the main window.
|
|
273
|
+
*/
|
|
274
|
+
"view/window-size": {
|
|
275
|
+
args: Record<string, never>;
|
|
276
|
+
response: WindowSize;
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Global command map - merge all command namespaces
|
|
282
|
+
*/
|
|
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;
|
package/events.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AppEvents - Events sent from backend to renderer
|
|
3
|
+
*
|
|
4
|
+
* All events are sent via the unified 'shell-message' channel.
|
|
5
|
+
* Views must subscribe to specific events to receive them.
|
|
6
|
+
*
|
|
7
|
+
* This file re-exports auto-generated event types.
|
|
8
|
+
* Event definitions are automatically generated from @EdenNamespace decorators.
|
|
9
|
+
* Run 'npm run codegen' to regenerate.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
export * from "./events.generated";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Utility types for working with AppEvents
|
|
16
|
+
*/
|
|
17
|
+
export type EventName = (typeof import("./events.generated").APP_EVENT_NAMES)[number];
|
|
18
|
+
export type EventData<T extends EventName> = import("./events.generated").AppEvents[T];
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AUTO-GENERATED FILE - DO NOT EDIT
|
|
3
|
+
*
|
|
4
|
+
* This file is automatically generated by scripts/generate-commands.ts
|
|
5
|
+
* Run 'npm run codegen' to regenerate.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* PackageEvents - Events for the "package" namespace
|
|
10
|
+
*/
|
|
11
|
+
export interface PackageEvents {
|
|
12
|
+
"package/installed": { manifest: AppManifest };
|
|
13
|
+
"package/uninstalled": { appId: string };
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* ProcessEvents - Events for the "process" namespace
|
|
18
|
+
*/
|
|
19
|
+
export interface ProcessEvents {
|
|
20
|
+
"process/launched": { instance: AppInstance };
|
|
21
|
+
"process/stopped": { appId: string };
|
|
22
|
+
"process/error": { appId: string; error: any };
|
|
23
|
+
"process/exited": { appId: string; code: number };
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* ViewEvents - Events for the "view" namespace
|
|
28
|
+
*/
|
|
29
|
+
export interface ViewEvents {
|
|
30
|
+
"view/bounds-updated": ViewBounds;
|
|
31
|
+
"view/global-bounds-changed": { workspaceBounds: ViewBounds; windowSize: WindowSize };
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Global event map - merge all event namespaces
|
|
36
|
+
*/
|
|
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;
|
package/global.d.ts
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// Ambient declarations for renderer globals
|
|
2
|
+
|
|
3
|
+
import type { CommandName, CommandArgs, CommandResult } from "./commands";
|
|
4
|
+
import type { EventName, EventData } from "./events";
|
|
5
|
+
|
|
6
|
+
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>;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
interface Window {
|
|
51
|
+
/**
|
|
52
|
+
* Eden API instance available only in renderer processes
|
|
53
|
+
*/
|
|
54
|
+
edenAPI?: EdenAPI;
|
|
55
|
+
}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { AppManifest } from "./AppManifest";
|
|
2
|
+
|
|
3
|
+
export * from "./EdenConfig";
|
|
4
|
+
|
|
5
|
+
export * from "./AppManifest";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* App Instance Interface
|
|
9
|
+
*
|
|
10
|
+
* Represents a running app instance in the Eden environment
|
|
11
|
+
*/
|
|
12
|
+
export interface AppInstance {
|
|
13
|
+
/** App manifest */
|
|
14
|
+
manifest: AppManifest;
|
|
15
|
+
|
|
16
|
+
/** Unique instance ID */
|
|
17
|
+
instanceId: string;
|
|
18
|
+
|
|
19
|
+
/** Installation path on disk */
|
|
20
|
+
installPath: string;
|
|
21
|
+
|
|
22
|
+
/** WebContentsView ID */
|
|
23
|
+
viewId: number;
|
|
24
|
+
|
|
25
|
+
/** Current state */
|
|
26
|
+
state: "starting" | "running" | "paused" | "stopped" | "error";
|
|
27
|
+
|
|
28
|
+
/** Installation timestamp */
|
|
29
|
+
installedAt: Date;
|
|
30
|
+
|
|
31
|
+
/** Last launched timestamp */
|
|
32
|
+
lastLaunched?: Date;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* IPC Message Interface
|
|
37
|
+
*
|
|
38
|
+
* Standard message format for IPC communication
|
|
39
|
+
*/
|
|
40
|
+
export interface IPCMessage {
|
|
41
|
+
/** Message type/action */
|
|
42
|
+
type: string;
|
|
43
|
+
|
|
44
|
+
/** Source app ID (or 'system' for system messages) */
|
|
45
|
+
source: string;
|
|
46
|
+
|
|
47
|
+
/** Target app ID (or 'system' for system messages) */
|
|
48
|
+
target: string;
|
|
49
|
+
|
|
50
|
+
/** Message payload */
|
|
51
|
+
payload: any;
|
|
52
|
+
|
|
53
|
+
/** Unique message ID for tracking responses */
|
|
54
|
+
messageId: string;
|
|
55
|
+
|
|
56
|
+
/** If this is a response to another message, the original message ID */
|
|
57
|
+
replyTo?: string;
|
|
58
|
+
|
|
59
|
+
/** Timestamp */
|
|
60
|
+
timestamp: number;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface ViewBounds {
|
|
64
|
+
x: number;
|
|
65
|
+
y: number;
|
|
66
|
+
width: number;
|
|
67
|
+
height: number;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Export new command types
|
|
71
|
+
export type {
|
|
72
|
+
CommandName,
|
|
73
|
+
CommandArgs,
|
|
74
|
+
CommandResult,
|
|
75
|
+
CommandMap,
|
|
76
|
+
} from "./commands";
|
|
77
|
+
|
|
78
|
+
// Export event types
|
|
79
|
+
export * from "./events";
|
|
80
|
+
|
|
81
|
+
export interface SystemInfo {
|
|
82
|
+
platform: string;
|
|
83
|
+
arch: string;
|
|
84
|
+
nodeVersion: string;
|
|
85
|
+
electronVersion: string;
|
|
86
|
+
runningApps: string[];
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export interface WindowSize {
|
|
90
|
+
width: number;
|
|
91
|
+
height: number;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface LaunchResult {
|
|
95
|
+
success: boolean;
|
|
96
|
+
instanceId: string;
|
|
97
|
+
appId: string;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export interface AppStatus {
|
|
101
|
+
installed: AppManifest[];
|
|
102
|
+
running: AppInstance[];
|
|
103
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@edenapp/types",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "TypeScript type definitions for the Eden platform",
|
|
5
|
+
"types": "index.d.ts",
|
|
6
|
+
"author": "Dariusz Majnert",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"files": [
|
|
9
|
+
"*.d.ts",
|
|
10
|
+
"README.md"
|
|
11
|
+
],
|
|
12
|
+
"keywords": [
|
|
13
|
+
"eden",
|
|
14
|
+
"types",
|
|
15
|
+
"typescript",
|
|
16
|
+
"definitions"
|
|
17
|
+
],
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "https://github.com/b0czek/eden.git",
|
|
21
|
+
"directory": "src/types"
|
|
22
|
+
}
|
|
23
|
+
}
|