@edenapp/types 0.14.0 → 0.15.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
@@ -300,14 +300,6 @@ export interface AppManifest extends PackageManifestBase {
300
300
  /** Path to the frontend HTML entry file */
301
301
  entry: string;
302
302
 
303
- /**
304
- * Allow remote URLs to be embedded in iframes.
305
- * When true, strips X-Frame-Options and CSP frame-ancestors headers
306
- * that would otherwise prevent embedding.
307
- * Only applies to remote (http/https) frontend entries.
308
- */
309
- allowEmbedding?: boolean;
310
-
311
303
  /** WebContentsView options */
312
304
  options?: {
313
305
  /** Enable Node.js integration in the view (default: false) */
@@ -394,7 +386,7 @@ export interface AppManifest extends PackageManifestBase {
394
386
  * Additional files or directories to include in the bundle.
395
387
  * Use this to include files that are normally excluded (e.g., node_modules with native bindings).
396
388
  * Paths are relative to the app root.
397
- * @example ["node_modules/@linuxcnc-node/core", "node_modules/better-sqlite3"]
389
+ * @example ["node_modules/@example/native-addon", "node_modules/better-sqlite3"]
398
390
  */
399
391
  include?: string[];
400
392
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # @edenapp/types
2
2
 
3
+ ## 0.15.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 39e850b: Eden keeps all of its data under one `dataDirectory`, with the Home volume in `home`, installed packages in `apps`, and accounts, settings, app storage, and default apps in `system`. It replaces the `appsDirectory` and `userDirectory` options and defaults to `eden` in Electron's `userData` directory. Existing data in the previous locations is not migrated. Apps can no longer read or change system data through the Home volume, and package IDs that match system database names are now allowed.
8
+ - 2b43225: Files address bar search finds files and folders at any depth with case-insensitive fuzzy matching, and shows the best and nearest matches first. Results update while the search continues, with the number of searched items. Choosing a file result opens its folder with the file selected.
9
+
10
+ **Breaking:** `fs/search` is now a stream command. It sends the best results so far and the number of searched entries until the search completes, instead of one result array. `limit` accepts at most 1000.
11
+
12
+ - b1eb229: Add a recoverable Trash for Home. Apps can move items to Trash, list the items the user can access, restore them to the original or another location, delete them permanently, and subscribe to Trash changes. Volumes report whether they support Trash. Files shows Trash in the sidebar with restore and permanent-delete controls.
13
+ - 41357aa: Support local, removable, and mounted network volumes that the consumer registers. Files and the file picker let users change between volumes, show Home and drive-type icons, keep read-only volumes read-only, and handle disconnected drives. Home addresses stay the same across accounts, and the consumer can restrict access to shared or overlapping folders.
14
+
15
+ Files can safely remove drives through an OS operation that the consumer supplies. Safe removal requires a permission. It finishes running file operations, waits for open file handles to close, and tells the user when the drive can be unplugged. Volumes on the same physical device are removed together. Apps can keep file handles open across operations, and Eden closes them when their owner exits.
16
+
17
+ `fs.lstat` inspects symbolic links without following them. `fs.delete` and `fs.move` act on the symbolic link itself, and copies keep the original link targets. A failed overwrite restores the destination, and a move across filesystems keeps the copied files if Eden cannot delete the source.
18
+
19
+ **Breaking:** File commands that take one address now take a `location` property with the volume and path. Raw picker selections return `locations[]`, and single-selection picker helpers return the first selected location.
20
+
21
+ - 11c0e4a: Create Electron hosts with `createEden(config)`. Asynchronous host APIs return lazy Effects that compose before execution through `eden.runPromise` or `eden.runFork`; `dispose()` explicitly shuts down the host. Host settings and power providers also return Effects, with their contracts exported by the SDK. Sandboxed apps keep the Promise-based Eden client.
22
+ - 0153e67: Add typed long-running IPC operations with immediate acceptance and guaranteed capacity per app. Apps can observe progress, completion, and failures. Built-in apps display operation progress and status. Solid apps can use `createOperation` and `OperationStatus` for their own UI.
23
+ - 7a39b41: Add stream commands, which send results to the calling app while their work continues. Generated client methods return a stream that apps read with `for await`, with backpressure and cancellation. Eden stops a stream when its view or backend closes, or when its view reloads.
24
+ - 2484d8a: Remove the built-in Web Browser app and the `frontend.allowEmbedding` option that disabled response security headers.
25
+ - 80295f7: Context menu items can be checkable: set `checked` on a `button` to show a check mark, and use `section` to label a group of choices inside a menu.
26
+
3
27
  ## 0.14.0
4
28
 
5
29
  ### Minor Changes
package/ContextMenu.d.ts CHANGED
@@ -170,6 +170,8 @@ export type ContextMenuItem =
170
170
  shortcut?: string;
171
171
  disabled?: boolean;
172
172
  danger?: boolean;
173
+ /** Makes the item checkable and shows whether it is checked. */
174
+ checked?: boolean;
173
175
  items?: ContextMenuItem[];
174
176
  }
175
177
  | { type: "separator" }
package/EdenConfig.d.ts CHANGED
@@ -64,29 +64,19 @@ export interface EdenPowerCapabilities {
64
64
  reboot: boolean;
65
65
  }
66
66
 
67
- /**
68
- * Main-process integration for host power management.
69
- *
70
- * Eden never executes configurable command strings. Consumers provide a typed
71
- * implementation backed by the platform mechanism appropriate for their host.
72
- */
73
- export interface EdenPowerProvider {
74
- poweroff?: () => void | Promise<void>;
75
- reboot?: () => void | Promise<void>;
76
- }
77
-
78
67
  export interface EdenConfig {
79
- appsDirectory?: string;
80
- /** Root directory backing Eden's managed virtual filesystem. */
81
- userDirectory?: string;
68
+ /**
69
+ * Root directory for all Eden data: the Home volume in `home`, installed
70
+ * packages in `apps`, system databases in `system`, and Trash in `trash`.
71
+ * Defaults to `eden` in Electron's `userData` directory.
72
+ */
73
+ dataDirectory?: string;
82
74
  /**
83
75
  * Path to the seed config JSON file for one-time data seeding.
84
76
  * Defaults to eden-seed.json in the consumer's dist directory.
85
77
  */
86
78
  seedPath?: string;
87
79
  branding?: EdenBrandingConfig;
88
- /** Optional host-side power integration. Power actions are unavailable when omitted. */
89
- powerProvider?: EdenPowerProvider;
90
80
  window?: {
91
81
  width?: number;
92
82
  height?: number;
package/FilePicker.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import type { FilesystemLocation } from "./Filesystem";
1
2
  import type { ViewBounds } from "./index";
2
3
 
3
4
  export type FilePickerMode = "open" | "save";
@@ -17,7 +18,9 @@ export interface FilePickerOpenArgs {
17
18
  selection?: FilePickerSelectionMode;
18
19
  multiple?: boolean;
19
20
  title?: string;
20
- initialPath?: string;
21
+ initialLocation?: FilesystemLocation;
22
+ /** Limit selection to these volumes; omitted means all registered volumes. */
23
+ allowedVolumes?: string[];
21
24
  suggestedName?: string;
22
25
  filters?: FilePickerFilter[];
23
26
  confirmLabel?: string;
@@ -37,6 +40,5 @@ export interface FilePickerOpenEvent extends FilePickerOpenArgs {
37
40
  export interface FilePickerResult {
38
41
  requestId: string;
39
42
  reason: FilePickerCloseReason;
40
- path?: string;
41
- paths?: string[];
43
+ locations?: FilesystemLocation[];
42
44
  }
@@ -0,0 +1,66 @@
1
+ /** A virtual path within one Eden volume. */
2
+ export interface FilesystemLocation {
3
+ volume: string;
4
+ path: string;
5
+ }
6
+
7
+ /** Access mode selected when opening a file. */
8
+ export type FilesystemOpenMode = "read";
9
+
10
+ /** Runtime-owned open file. The identifier conveys no authority by itself. */
11
+ export interface FilesystemHandle {
12
+ handleId: string;
13
+ }
14
+
15
+ /** One-shot access by location, or repeated access to an opened file. */
16
+ export type FilesystemSource = FilesystemLocation | FilesystemHandle;
17
+
18
+ export type FilesystemVolumeKind = "local" | "removable" | "network";
19
+ export type FilesystemVolumeState = "ready" | "ejecting";
20
+
21
+ /** Public volume metadata. Host mount paths are never sent to apps. */
22
+ export interface FilesystemVolume {
23
+ id: string;
24
+ label: string;
25
+ kind: FilesystemVolumeKind;
26
+ readOnly: boolean;
27
+ supportsWatch: boolean;
28
+ supportsEject: boolean;
29
+ /** Deleted items can move to Trash instead of being removed permanently. */
30
+ supportsTrash: boolean;
31
+ state: FilesystemVolumeState;
32
+ }
33
+
34
+ /** Main-process registration of an already mounted directory. */
35
+ export interface FilesystemVolumeRegistration {
36
+ id: string;
37
+ label: string;
38
+ kind: FilesystemVolumeKind;
39
+ rootPath: string;
40
+ readOnly?: boolean;
41
+ supportsWatch?: boolean;
42
+ }
43
+
44
+ /** A Home item held in Trash, visible to callers that can access its original folder. */
45
+ export interface TrashEntry {
46
+ id: string;
47
+ name: string;
48
+ original: FilesystemLocation;
49
+ /** ISO 8601 time when the item was moved to Trash. */
50
+ deletedAt: string;
51
+ isDirectory: boolean;
52
+ isFile: boolean;
53
+ size: number;
54
+ }
55
+
56
+ /** An occupied destination keeps both the existing item and the Trash entry. */
57
+ export type TrashRestoreResult =
58
+ | { status: "restored"; location: FilesystemLocation }
59
+ | { status: "occupied" };
60
+
61
+ export interface FilesystemTransferArgs {
62
+ from: FilesystemLocation;
63
+ to: FilesystemLocation;
64
+ /** Replace the complete destination when it already exists. */
65
+ overwrite?: boolean;
66
+ }
@@ -0,0 +1,94 @@
1
+ import type { CommandCompletion, CommandName } from "./commands";
2
+
3
+ export type CommunicationMode = "result" | "operation" | "stream";
4
+
5
+ export interface OperationHandle<C extends string = string> {
6
+ command: C;
7
+ id: string;
8
+ }
9
+
10
+ export interface ResultCommand<A, R> {
11
+ mode: "result";
12
+ args: A;
13
+ response: R;
14
+ }
15
+
16
+ export interface OperationCommand<A, R, C extends string = string> {
17
+ mode: "operation";
18
+ args: A;
19
+ response: OperationHandle<C>;
20
+ completion: R;
21
+ }
22
+
23
+ export interface OperationSubmission {
24
+ requestKey?: string;
25
+ }
26
+
27
+ /** Select one operation when subscribing to operation/changed. */
28
+ export interface OperationObservation {
29
+ handle: OperationHandle;
30
+ terminalOnly?: boolean;
31
+ }
32
+
33
+ export interface OperationProgress {
34
+ completed: number;
35
+ total?: number;
36
+ unit: string;
37
+ }
38
+
39
+ export interface OperationError {
40
+ name: string;
41
+ message: string;
42
+ }
43
+
44
+ interface OperationSnapshotBase<C extends string> extends OperationHandle<C> {
45
+ cancellable: boolean;
46
+ revision: number;
47
+ createdAt: number;
48
+ updatedAt: number;
49
+ startedAt?: number;
50
+ phase?: string;
51
+ progress?: OperationProgress;
52
+ }
53
+
54
+ export type OperationSnapshot<C extends string = string, R = unknown> =
55
+ | (OperationSnapshotBase<C> & { status: "queued" | "running" })
56
+ | (OperationSnapshotBase<C> & {
57
+ status: "cancelled";
58
+ completedAt: number;
59
+ })
60
+ | (OperationSnapshotBase<C> & {
61
+ status: "succeeded";
62
+ completedAt: number;
63
+ result: R;
64
+ })
65
+ | (OperationSnapshotBase<C> & {
66
+ status: "failed";
67
+ completedAt: number;
68
+ error: OperationError;
69
+ response?: R;
70
+ });
71
+
72
+ /** Known commands retain their completion type; discovered handles remain inspectable. */
73
+ export type OperationCompletion<C extends string> = C extends CommandName
74
+ ? CommandCompletion<C>
75
+ : unknown;
76
+
77
+ /** App-side operation controls. Persist or send only its serializable handle. */
78
+ export interface Operation<C extends string = string> {
79
+ readonly handle: OperationHandle<C>;
80
+ get(): Promise<OperationSnapshot<C, OperationCompletion<C>>>;
81
+ watch(
82
+ listener: (snapshot: OperationSnapshot<C, OperationCompletion<C>>) => void,
83
+ ): Promise<() => void>;
84
+ /** Await completion and return the command's typed result. */
85
+ result(): Promise<OperationCompletion<C>>;
86
+ /** Request cancellation, then await result() for cleanup to finish. */
87
+ cancel(): Promise<void>;
88
+ }
89
+
90
+ export interface OperationsAPI {
91
+ /** Restore app-side controls for a retained or shared handle. */
92
+ from<C extends string>(handle: OperationHandle<C>): Operation<C>;
93
+ list(): Promise<OperationSnapshot[]>;
94
+ }
package/Package.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import type {
2
2
  InstalledPackageManifest,
3
+ PackageManifest,
3
4
  RuntimeAppManifest,
4
5
  RuntimeDlcManifest,
5
6
  } from "./AppManifest";
@@ -17,6 +18,14 @@ export interface InstalledPackageInfo {
17
18
  dlcs: DlcResource[];
18
19
  }
19
20
 
21
+ /** Result of inspecting an .edenite package before installation. */
22
+ export interface PackageInfo {
23
+ success: boolean;
24
+ manifest?: PackageManifest;
25
+ preview?: PackageOperationPreview;
26
+ error?: string;
27
+ }
28
+
20
29
  /** Runtime installation preview returned when inspecting an .edenite package. */
21
30
  export type PackageOperationPreview =
22
31
  | {
package/README.md CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  TypeScript type definitions for the Eden platform.
4
4
 
5
+ See the [Eden handbook](https://github.com/b0czek/eden/blob/main/docs/README.md)
6
+ for app and consumer workflows.
7
+
5
8
  ## Installation
6
9
 
7
10
  For Eden app development:
@@ -12,7 +15,7 @@ npm install -D @edenapp/types
12
15
 
13
16
  ## TypeScript Configuration
14
17
 
15
- To enable type support for window APIs, update your `tsconfig.json` to include:
18
+ For frontend APIs, include these types in `tsconfig.json`:
16
19
 
17
20
  ```json
18
21
  {
@@ -22,13 +25,16 @@ To enable type support for window APIs, update your `tsconfig.json` to include:
22
25
  }
23
26
  ```
24
27
 
28
+ For a backend, use `"types": ["node", "@edenapp/types/worker"]` instead.
29
+ Keep other types your project needs in the same array.
30
+
25
31
  ## Usage
26
32
 
27
- Import types in your Eden app:
33
+ The declarations provide types for the injected frontend APIs:
28
34
 
29
35
  ```typescript
30
36
  // Use Eden API in your app's frontend
31
37
  const files = await window.edenAPI.shellCommand("fs/readdir", {
32
- path: "/home/user/documents",
38
+ location: { volume: "home", path: "/Documents" },
33
39
  });
34
40
  ```
@@ -258,18 +258,6 @@ export interface SettingsPanelProviderContext {
258
258
  sessionId: string;
259
259
  user: UserProfile;
260
260
  }
261
- export type SettingsPanelLoader = (
262
- context: SettingsPanelProviderContext,
263
- ) => SettingsPanelView | Promise<SettingsPanelView>;
264
- export type SettingsPanelActionHandler = (
265
- invocation: SettingsPanelActionInvocation,
266
- context: SettingsPanelProviderContext,
267
- ) => void | Promise<void>;
268
- export interface SettingsPanelProvider {
269
- load: SettingsPanelLoader;
270
- actions?: Record<string, SettingsPanelActionHandler>;
271
- }
272
-
273
261
  export interface SettingsPanelRegistrationOptions {
274
262
  visible?: boolean;
275
263
  }
package/Streams.d.ts ADDED
@@ -0,0 +1,35 @@
1
+ import type { CommandChunk, CommandName } from "./commands";
2
+
3
+ export interface StreamHandle<C extends string = string> {
4
+ command: C;
5
+ id: string;
6
+ }
7
+
8
+ export interface StreamCommand<A, T, C extends string = string> {
9
+ mode: "stream";
10
+ args: A;
11
+ response: StreamHandle<C>;
12
+ chunk: T;
13
+ }
14
+
15
+ /** Known commands retain their chunk type; other handles read unknown values. */
16
+ export type StreamChunk<C extends string> = C extends CommandName
17
+ ? CommandChunk<C>
18
+ : unknown;
19
+
20
+ /** App-side reader for one stream command. Read chunks in order, or cancel. */
21
+ export interface StreamReader<C extends string = string> {
22
+ readonly handle: StreamHandle<C>;
23
+ /**
24
+ * Resolve with the next chunk, or with `done` after the stream ends or is cancelled.
25
+ * Reject when the stream fails.
26
+ */
27
+ next(): Promise<IteratorResult<StreamChunk<C>, undefined>>;
28
+ /** Stop the stream. Waiting and later `next()` calls resolve with `done`. */
29
+ cancel(): Promise<void>;
30
+ }
31
+
32
+ /** A stream reader that `for await` can consume. Leaving the loop early cancels it. */
33
+ export interface CommandStream<C extends string = string>
34
+ extends StreamReader<C>,
35
+ AsyncIterable<StreamChunk<C>, undefined> {}
package/User.d.ts CHANGED
@@ -4,19 +4,25 @@ export interface UserProfile {
4
4
  username: string;
5
5
  name: string;
6
6
  role: UserRole;
7
- /** Writable filesystem root relative to EdenConfig.userDirectory. */
8
- homeDirectory?: string;
7
+ /** Optional accessible folder relative to the Home volume root. */
8
+ directoryRestriction?: string;
9
9
  grants: string[];
10
10
  createdAt: number;
11
11
  updatedAt: number;
12
12
  }
13
13
 
14
+ export interface SessionChange {
15
+ currentUser: UserProfile | null;
16
+ previousUsername: string | null;
17
+ reason: "login" | "logout" | "system";
18
+ }
19
+
14
20
  export interface EdenUserConfig {
15
21
  username: string;
16
22
  name: string;
17
23
  role?: UserRole;
18
- /** Writable filesystem root relative to EdenConfig.userDirectory. */
19
- homeDirectory?: string;
24
+ /** Optional accessible folder relative to the Home volume root. */
25
+ directoryRestriction?: string;
20
26
  password?: string;
21
27
  passwordHash?: string;
22
28
  passwordSalt?: string;
package/commands.d.ts CHANGED
@@ -15,6 +15,8 @@
15
15
  export * from "./commands.generated";
16
16
 
17
17
  import { CommandMap } from "./commands.generated";
18
+ import type { Operation } from "./Operations";
19
+ import type { StreamReader } from "./Streams";
18
20
 
19
21
  /**
20
22
  * Type-safe command name
@@ -27,6 +29,29 @@ export type CommandName = keyof CommandMap;
27
29
  export type CommandArgs<T extends CommandName> = CommandMap[T]["args"];
28
30
 
29
31
  /**
30
- * Get command result type
32
+ * Serializable command response before app-side operation or stream controls are attached.
31
33
  */
32
- export type CommandResult<T extends CommandName> = CommandMap[T]["response"];
34
+ export type CommandResponse<T extends CommandName> = CommandMap[T]["response"];
35
+
36
+ /** App-facing result: operation and stream commands expose controls bound to their handle. */
37
+ export type CommandResult<T extends CommandName> = T extends CommandName
38
+ ? CommandMap[T]["mode"] extends "operation"
39
+ ? Operation<T>
40
+ : CommandMap[T]["mode"] extends "stream"
41
+ ? StreamReader<T>
42
+ : CommandResponse<T>
43
+ : never;
44
+
45
+ /** Eventual completion; result commands have no separate completion. */
46
+ export type CommandCompletion<T extends CommandName> = CommandMap[T] extends {
47
+ completion: infer R;
48
+ }
49
+ ? R
50
+ : never;
51
+
52
+ /** Value type of each chunk that a stream command sends. */
53
+ export type CommandChunk<T extends CommandName> = CommandMap[T] extends {
54
+ chunk: infer R;
55
+ }
56
+ ? R
57
+ : never;