@open-orpheus/plugin-api 0.0.0 → 0.21.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.
Files changed (174) hide show
  1. package/LICENSE +7 -0
  2. package/README.md +192 -0
  3. package/dist/client/index.d.ts +37 -0
  4. package/dist/client/index.js +53 -0
  5. package/dist/client/index.js.map +1 -0
  6. package/dist/configuration/host/src/shared/plugin/configuration/index.d.ts +21 -0
  7. package/dist/configuration/index.d.ts +5 -0
  8. package/dist/host/_native/open-orpheus__window.d.ts +35 -17
  9. package/dist/host/src/main/assets.d.ts +2 -0
  10. package/dist/host/src/main/audio/DownloadScheduler.d.ts +2 -2
  11. package/dist/host/src/main/audio/MediaEngine.d.ts +1 -1
  12. package/dist/host/src/main/audio.d.ts +1 -1
  13. package/dist/host/src/main/av3a/Av3aEngine.d.ts +1 -1
  14. package/dist/host/src/main/av3a/Av3aM4aSession.d.ts +1 -1
  15. package/dist/host/src/main/av3a/Av3aPlaybackProcess.d.ts +1 -1
  16. package/dist/host/src/main/av3a/sources.d.ts +2 -2
  17. package/dist/host/src/main/av3a/types.d.ts +1 -1
  18. package/dist/host/src/main/bridge/ipc-main-bridge.d.ts +24 -0
  19. package/dist/host/src/main/bridge/window.d.ts +7 -0
  20. package/dist/host/src/main/cache.d.ts +3 -3
  21. package/dist/host/src/main/calls/desktop.d.ts +1 -1
  22. package/dist/host/src/main/calls/index.d.ts +16 -16
  23. package/dist/host/src/main/calls.d.ts +1 -1
  24. package/dist/host/src/main/channel.d.ts +1 -1
  25. package/dist/host/src/main/database/KeyvSqliteDriver.d.ts +1 -1
  26. package/dist/host/src/main/database.d.ts +1 -1
  27. package/dist/host/src/main/lifecycle.d.ts +15 -6
  28. package/dist/host/src/main/lyrics/DbusLyricsService.d.ts +2 -2
  29. package/dist/host/src/main/lyrics/LyricsDispatcher.d.ts +1 -1
  30. package/dist/host/src/main/lyrics/dbus.d.ts +1 -1
  31. package/dist/host/src/main/lyrics/parse.d.ts +1 -1
  32. package/dist/host/src/main/lyrics.d.ts +1 -1
  33. package/dist/host/src/main/mediaSession.d.ts +1 -1
  34. package/dist/host/src/main/menu/AppMenu.d.ts +3 -3
  35. package/dist/host/src/main/menu/backend/DesktopWindowBackend.d.ts +2 -2
  36. package/dist/host/src/main/menu/backend/MenuBackend.d.ts +3 -3
  37. package/dist/host/src/main/menu/backend/WaylandLayerShellBackend.d.ts +35 -0
  38. package/dist/host/src/main/menu/backend/WaylandOverlayBackend.d.ts +1 -1
  39. package/dist/host/src/main/menu/backend/WaylandPopupBackend.d.ts +2 -2
  40. package/dist/host/src/main/menu/constants.d.ts +2 -0
  41. package/dist/host/src/main/menu/index.d.ts +2 -2
  42. package/dist/host/src/main/menu/patch.d.ts +1 -1
  43. package/dist/host/src/main/menu/skin.d.ts +1 -1
  44. package/dist/host/src/main/menu/surface/BaseWindowMenuSurface.d.ts +15 -3
  45. package/dist/host/src/main/menu/surface/CaptureLayerSurface.d.ts +22 -0
  46. package/dist/host/src/main/menu/surface/MenuSurface.d.ts +1 -1
  47. package/dist/host/src/main/menu/surface/MenuSurfacePath.d.ts +2 -2
  48. package/dist/host/src/main/menu/surface/SurfacePool.d.ts +1 -1
  49. package/dist/host/src/main/menu/workaround.d.ts +9 -3
  50. package/dist/host/src/main/ncae.d.ts +1 -1
  51. package/dist/host/src/main/network/handler.d.ts +1 -1
  52. package/dist/host/src/main/network/interceptor.d.ts +1 -1
  53. package/dist/host/src/main/network/interceptors/anonymous.d.ts +1 -1
  54. package/dist/host/src/main/network/pipeline.d.ts +1 -1
  55. package/dist/host/src/main/pack.d.ts +1 -1
  56. package/dist/host/src/main/packs/SkinPack.d.ts +1 -1
  57. package/dist/host/src/main/packs/WebPack.d.ts +1 -1
  58. package/dist/host/src/main/playback/PlaybackController.d.ts +2 -2
  59. package/dist/host/src/main/playback/PlayerCommandRouter.d.ts +2 -2
  60. package/dist/host/src/main/playback/adapters/MediaSessionAdapter.d.ts +2 -2
  61. package/dist/host/src/main/playback/adapters/MprisAdapter.d.ts +3 -3
  62. package/dist/host/src/main/playback/adapters/NowPlayingAdapter.d.ts +2 -2
  63. package/dist/host/src/main/playback/adapters/SmtcAdapter.d.ts +2 -2
  64. package/dist/host/src/main/playback/modes.d.ts +1 -1
  65. package/dist/host/src/main/playback/types.d.ts +31 -11
  66. package/dist/host/src/main/plugin/assets.d.ts +8 -0
  67. package/dist/host/src/main/plugin/catalog.d.ts +42 -0
  68. package/dist/host/src/main/plugin/discover.d.ts +4 -7
  69. package/dist/host/src/main/plugin/index.d.ts +5 -2
  70. package/dist/host/src/main/plugin/loader.d.ts +68 -21
  71. package/dist/host/src/main/plugin/manager.d.ts +53 -7
  72. package/dist/host/src/main/plugin/metadata.d.ts +13 -3
  73. package/dist/host/src/main/plugin/state.d.ts +16 -6
  74. package/dist/host/src/main/settings.d.ts +17 -2
  75. package/dist/host/src/main/shutdown.d.ts +28 -10
  76. package/dist/host/src/main/skin/dui.d.ts +1 -1
  77. package/dist/host/src/main/update.d.ts +1 -1
  78. package/dist/host/src/main/util/color.d.ts +7 -0
  79. package/dist/host/src/main/window.d.ts +26 -4
  80. package/dist/host/src/main/windows/color-picker.d.ts +3 -0
  81. package/dist/host/src/main/windows/desktop-lyrics.d.ts +2 -2
  82. package/dist/host/src/main/windows/desktop-pet.d.ts +1 -1
  83. package/dist/host/src/main/windows/main.d.ts +1 -1
  84. package/dist/host/src/main/windows/mini-player.d.ts +2 -2
  85. package/dist/host/src/main/windows/music-desktop.d.ts +1 -1
  86. package/dist/host/src/main/windows/package-download.d.ts +1 -1
  87. package/dist/host/src/main/windows/plugin-manager-events.d.ts +7 -0
  88. package/dist/host/src/main/windows/plugin-manager.d.ts +1 -1
  89. package/dist/host/src/main/xeapi.d.ts +1 -6
  90. package/dist/host/src/preload/PlaybackBackend.d.ts +1 -1
  91. package/dist/host/src/preload/Player.d.ts +14 -6
  92. package/dist/host/src/preload/av3a/Av3aPcmPlayer.d.ts +2 -2
  93. package/dist/host/src/preload/av3a/bridge.d.ts +2 -2
  94. package/dist/host/src/preload/av3a/channel.d.ts +2 -2
  95. package/dist/host/src/preload/backends/Av3aPlaybackBackend.d.ts +2 -2
  96. package/dist/host/src/preload/backends/MediaPlaybackBackend.d.ts +1 -1
  97. package/dist/host/src/shared/bridge/constants.d.ts +2 -0
  98. package/dist/host/src/shared/bridge/endpoint.d.ts +29 -0
  99. package/dist/host/src/shared/bridge/hub.d.ts +136 -0
  100. package/dist/host/src/shared/bridge/protocol.d.ts +91 -0
  101. package/dist/host/src/shared/bridge/realm.d.ts +14 -0
  102. package/dist/host/src/shared/bridge/routes.d.ts +37 -0
  103. package/dist/host/src/shared/contracts/av3a-api.d.ts +1 -1
  104. package/dist/host/src/shared/contracts/av3a-process.d.ts +1 -1
  105. package/dist/host/src/shared/contracts/color-picker-api.d.ts +17 -0
  106. package/dist/host/src/shared/contracts/desktop-lyrics-api.d.ts +1 -2
  107. package/dist/host/src/shared/contracts/input-region-api.d.ts +1 -2
  108. package/dist/host/src/shared/contracts/lyrics-api.d.ts +1 -1
  109. package/dist/host/src/shared/contracts/manage-api.d.ts +2 -4
  110. package/dist/host/src/shared/contracts/menu-surface-api.d.ts +35 -0
  111. package/dist/host/src/shared/contracts/mini-player-api.d.ts +1 -1
  112. package/dist/host/src/shared/contracts/plugin-manager-api.d.ts +201 -12
  113. package/dist/host/src/shared/playbackMode.d.ts +1 -1
  114. package/dist/host/src/shared/plugin/cache-bust.d.ts +8 -0
  115. package/dist/host/src/shared/plugin/lifecycle.d.ts +217 -0
  116. package/dist/host/src/{main/plugin/types.d.ts → shared/plugin/realms/main/index.d.ts} +1 -1
  117. package/dist/host/src/shared/plugin/registry.d.ts +42 -5
  118. package/dist/host/src/shared/plugin/runtime-state.d.ts +4 -0
  119. package/dist/host/src/shared/settings/defaults.d.ts +35 -0
  120. package/dist/host/src/shared/settings/index.d.ts +3 -0
  121. package/dist/host/src/shared/settings/keys.d.ts +21 -0
  122. package/dist/host/src/shared/settings/values.d.ts +13 -0
  123. package/dist/host/src/shared/types/desktop-lyrics.d.ts +28 -11
  124. package/dist/host/src/shared/types/menu-surface.d.ts +2 -2
  125. package/dist/host/src/shared/types/menu.d.ts +1 -1
  126. package/dist/host/src/shared/types/mini-player.d.ts +12 -5
  127. package/dist/host/src/shared/types/ncae.d.ts +11 -3
  128. package/dist/host/src/shared/types/package-download.d.ts +13 -5
  129. package/dist/index.d.ts +3 -3
  130. package/dist/plugin-manager/host/src/preload/logger.d.ts +10 -0
  131. package/dist/plugin-manager/host/src/preload/util.d.ts +1 -0
  132. package/dist/plugin-manager/host/src/shared/bridge/constants.d.ts +2 -0
  133. package/dist/plugin-manager/host/src/shared/bridge/endpoint.d.ts +29 -0
  134. package/dist/plugin-manager/host/src/shared/bridge/hub.d.ts +136 -0
  135. package/dist/plugin-manager/host/src/shared/bridge/protocol.d.ts +91 -0
  136. package/dist/plugin-manager/host/src/shared/bridge/routes.d.ts +37 -0
  137. package/dist/plugin-manager/host/src/shared/contracts/plugin-manager-api.d.ts +223 -0
  138. package/dist/plugin-manager/host/src/shared/plugin/lifecycle.d.ts +217 -0
  139. package/dist/plugin-manager/host/src/shared/plugin/realms/common/index.d.ts +34 -0
  140. package/dist/plugin-manager/host/src/shared/plugin/realms/plugin-manager/index.d.ts +11 -0
  141. package/dist/plugin-manager/host/src/shared/plugin/registry.d.ts +69 -0
  142. package/dist/plugin-manager/host/src/shared/util.d.ts +22 -0
  143. package/dist/plugin-manager/index.d.ts +7 -0
  144. package/dist/plugin-manager/registry-map.d.ts +16 -0
  145. package/dist/preload/host/src/preload/PlaybackBackend.d.ts +1 -1
  146. package/dist/preload/host/src/preload/Player.d.ts +14 -6
  147. package/dist/preload/host/src/preload/audioplayer.d.ts +1 -1
  148. package/dist/preload/host/src/preload/av3a/Av3aPcmPlayer.d.ts +2 -2
  149. package/dist/preload/host/src/preload/av3a/bridge.d.ts +2 -2
  150. package/dist/preload/host/src/preload/av3a/channel.d.ts +2 -2
  151. package/dist/preload/host/src/preload/backends/Av3aPlaybackBackend.d.ts +2 -2
  152. package/dist/preload/host/src/preload/backends/MediaPlaybackBackend.d.ts +1 -1
  153. package/dist/preload/host/src/preload/calls/index.d.ts +6 -6
  154. package/dist/preload/host/src/preload/calls.d.ts +1 -1
  155. package/dist/preload/host/src/preload/logger.d.ts +10 -0
  156. package/dist/preload/host/src/preload/playbackMode.d.ts +1 -1
  157. package/dist/preload/host/src/shared/bridge/endpoint.d.ts +29 -0
  158. package/dist/preload/host/src/shared/bridge/hub.d.ts +136 -0
  159. package/dist/preload/host/src/shared/bridge/protocol.d.ts +91 -0
  160. package/dist/preload/host/src/shared/bridge/routes.d.ts +37 -0
  161. package/dist/preload/host/src/shared/contracts/av3a-api.d.ts +1 -1
  162. package/dist/preload/host/src/shared/contracts/av3a-process.d.ts +1 -1
  163. package/dist/preload/host/src/shared/contracts/plugin-manager-api.d.ts +223 -0
  164. package/dist/preload/host/src/shared/playbackMode.d.ts +1 -1
  165. package/dist/preload/host/src/shared/plugin/lifecycle.d.ts +217 -0
  166. package/dist/preload/host/src/shared/plugin/realms/common/index.d.ts +34 -0
  167. package/dist/preload/host/src/shared/plugin/realms/preload/index.d.ts +11 -0
  168. package/dist/preload/host/src/shared/plugin/registry.d.ts +42 -5
  169. package/dist/preload/host/src/shared/types/ncae.d.ts +11 -3
  170. package/dist/preload/index.d.ts +3 -3
  171. package/dist/preload/registry-map.d.ts +38 -31
  172. package/dist/registry-map.d.ts +159 -140
  173. package/package.json +24 -8
  174. package/dist/preload/host/src/preload/plugin/types.d.ts +0 -18
@@ -1,43 +1,90 @@
1
- import type { DiscoveredPlugin } from "./discover";
2
- import { type Registry } from "../../shared/plugin/registry";
3
- import type { PluginModule } from "./types";
4
- export declare enum PluginStatus {
5
- Pending = "pending",
6
- Active = "active",
7
- Failed = "failed"
1
+ import type { PluginDesiredState } from "../../shared/contracts/plugin-manager-api.js";
2
+ import { RealmLifecycle, type LifecycleSnapshot, type PluginDisposeResult } from "../../shared/plugin/lifecycle.js";
3
+ import { type Registry } from "../../shared/plugin/registry.js";
4
+ import type { DiscoveredPlugin } from "./discover.js";
5
+ import type { PluginModule } from "../../shared/plugin/realms/main/index.js";
6
+ export declare const PluginStatus: {
7
+ readonly Pending: "pending";
8
+ readonly Disabled: "disabled";
9
+ readonly Active: "active";
10
+ readonly Failed: "failed";
11
+ };
12
+ export type PluginStatus = "pending" | "disabled" | "active" | "failed";
13
+ export declare namespace PluginStatus {
14
+ type Pending = "pending";
15
+ type Disabled = "disabled";
16
+ type Active = "active";
17
+ type Failed = "failed";
8
18
  }
9
19
  export interface PluginRecord {
10
20
  plugin: DiscoveredPlugin;
11
- status: PluginStatus;
12
- error?: unknown;
13
- module?: PluginModule;
21
+ lifecycle: RealmLifecycle<PluginModule>;
22
+ readonly status: PluginStatus;
23
+ readonly module: PluginModule | undefined;
24
+ readonly error: unknown;
25
+ readonly snapshot: LifecycleSnapshot<PluginModule>;
14
26
  }
15
27
  export interface PluginLoaderOptions {
16
28
  registry: Registry;
17
29
  plugins: DiscoveredPlugin[];
18
- /** Only plugins for which this returns true are activated by `activateAll`. */
30
+ /** Initial desired state for `activateAll`. */
19
31
  isEnabled?: (id: string) => boolean;
20
- /** Injectable for tests; defaults to a dynamic ESM import. */
21
- importModule?: (entryPath: string) => Promise<unknown>;
32
+ /** Injectable for tests. Receives a cache-busted module URL. */
33
+ importModule?: (entryUrl: string) => Promise<unknown>;
34
+ /** Soft per-plugin activation and cleanup deadline. */
35
+ activationTimeoutMs?: number;
36
+ /** Called when a plugin's lifecycle snapshot changes. */
37
+ onChanged?: () => void;
22
38
  }
23
39
  /**
24
- * Loads, activates and deactivates plugin trees.
40
+ * Loads, activates, and deactivates main-realm plugin modules.
25
41
  *
26
- * Each plugin is isolated: one failing import or hook cannot stop the others or
27
- * the host. Module evaluation is deferred to activation, so a discovered plugin
28
- * has no side effects until the host activates it.
42
+ * Each plugin has one `RealmLifecycle` that serializes activation and cleanup.
43
+ * This class adapts discovered plugins to that state machine and exposes
44
+ * module exports separately from activation readiness.
29
45
  */
30
46
  export declare class PluginLoader {
31
47
  private readonly records;
32
- private readonly ids;
33
- private readonly runtime;
48
+ private readonly recordsById;
49
+ /**
50
+ * One evaluation per activation epoch, shared by lifecycle activation and
51
+ * cross-plugin `load()`.
52
+ *
53
+ * Imports use a cache-busting URL, so without this cache the two callers
54
+ * would evaluate the entry twice and observe different module instances.
55
+ */
56
+ private readonly moduleCache;
34
57
  private readonly importModule;
35
- private readonly pluginRegistry;
36
58
  private readonly isEnabled;
59
+ private readonly revisions;
60
+ private readonly pluginRegistry;
61
+ private readonly registry;
37
62
  constructor(options: PluginLoaderOptions);
63
+ private runtimeFor;
38
64
  get plugins(): ReadonlyArray<PluginRecord>;
65
+ /** Apply a committed desired state to one plugin. */
66
+ setDesiredState(id: string, desired: PluginDesiredState): void;
39
67
  activateAll(): Promise<void>;
40
68
  activate(id: string): Promise<void>;
41
69
  deactivate(id: string): Promise<void>;
42
- deactivateAll(): Promise<void>;
70
+ /** Request a fresh attempt without changing desired state. */
71
+ retry(id: string): Promise<void>;
72
+ /** Start a retry without waiting for convergence. */
73
+ requestRetry(id: string): void;
74
+ deactivateAll(): Promise<PluginDisposeResult[]>;
75
+ private nextRevision;
76
+ private require;
77
+ /**
78
+ * Drop the cached evaluation only when it is safe to re-evaluate.
79
+ *
80
+ * A retry on a running plugin is a no-op in the lifecycle. Clearing its
81
+ * cache would make cross-plugin `load()` evaluate a second instance while
82
+ * `whenActive()` keeps returning the active one, splitting shared services.
83
+ */
84
+ private invalidateModuleForRetry;
85
+ private loadModule;
86
+ private whenActive;
87
+ private waitForDecision;
88
+ private waitForSettled;
43
89
  }
90
+ export type { LifecycleSnapshot };
@@ -1,15 +1,61 @@
1
- import { type PluginManagerState } from "../../shared/contracts/plugin-manager-api";
2
- import { type PluginLoader } from "./loader";
3
- import type { PluginStateStore } from "./state";
4
- /** Combines the persisted enable intent with the loader's runtime status. */
1
+ import { type PluginDesiredState, type PluginManagerState, type PluginRealmReport } from "../../shared/contracts/plugin-manager-api.js";
2
+ import { type PluginCatalog } from "./catalog.js";
3
+ import type { DiscoveredPlugin } from "./discover.js";
4
+ import type { PluginLoader } from "./loader.js";
5
+ import type { PluginStateStore } from "./state.js";
6
+ export interface PluginManagerOptions {
7
+ loader: PluginLoader;
8
+ state: PluginStateStore;
9
+ catalog: PluginCatalog;
10
+ /** Called after any desired state or runtime state change. */
11
+ onChanged?: () => void;
12
+ /** Called with committed desired state for realms this plugin declares. */
13
+ onDesiredChanged?: (id: string, realm: string, desired: PluginDesiredState) => void;
14
+ /** Called to retry the plugin in each realm window it declares. */
15
+ onRetryRequested?: (id: string, realm: string) => void;
16
+ }
17
+ /**
18
+ * Combines the resolved plugin catalog, persisted intent, and per-window
19
+ * runtime reports into the facts the manager UI renders.
20
+ */
5
21
  export declare class PluginManager {
6
22
  private readonly loader;
7
23
  private readonly state;
8
- constructor(loader: PluginLoader, state: PluginStateStore);
24
+ private readonly catalog;
25
+ private readonly onChanged?;
26
+ private readonly onDesiredChanged?;
27
+ private readonly onRetryRequested?;
28
+ /** realm host windows, keyed by webContents id. */
29
+ private readonly hosts;
30
+ /** runtime reports, keyed by webContents id then plugin id. */
31
+ private readonly reports;
32
+ /** Serialized commands per plugin. */
33
+ private readonly commands;
34
+ constructor(options: PluginManagerOptions);
9
35
  list(): PluginManagerState;
10
36
  setEnabled(id: string, enabled: boolean): Promise<PluginManagerState>;
37
+ retry(id: string): Promise<PluginManagerState>;
11
38
  /** Whether the plugin should be activated (used for the preload manifest). */
12
39
  isEnabled(id: string): boolean;
13
- private find;
14
- private toEntry;
40
+ /** The selected plugin tree, if it exists. Also serves disabled plugins' assets. */
41
+ getPlugin(id: string): DiscoveredPlugin | undefined;
42
+ /** Register a window as the host of a plugin realm. */
43
+ registerHost(webContentsId: number, realm: string): void;
44
+ /** Drop a destroyed window's host registration and reports. */
45
+ unregisterHost(webContentsId: number): void;
46
+ isHostFor(webContentsId: number, realm: string): boolean;
47
+ /** Live windows hosting a realm. */
48
+ hostsForRealm(realm: string): number[];
49
+ /** Record a revisioned runtime report from one window. */
50
+ setRealmReport(webContentsId: number, report: PluginRealmReport): void;
51
+ /** Desired state for a selected plugin, or undefined when unavailable. */
52
+ desiredFor(id: string): PluginDesiredState | undefined;
53
+ private selectedEntry;
54
+ private conflictEntry;
55
+ private invalidEntry;
56
+ private realmSummary;
57
+ private loaderRecord;
58
+ private requireSelected;
59
+ private publishDesired;
60
+ private enqueue;
15
61
  }
@@ -8,12 +8,22 @@ declare function createMetadataSchema(base: string): z.ZodObject<{
8
8
  homepage: z.ZodOptional<z.ZodString>;
9
9
  license: z.ZodOptional<z.ZodString>;
10
10
  icon: z.ZodOptional<z.ZodString>;
11
+ configuration: z.ZodOptional<z.ZodString>;
11
12
  realms: z.ZodObject<{
12
- main: z.ZodString;
13
- preload: z.ZodOptional<z.ZodString>;
13
+ [x: string]: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
14
14
  }, z.core.$strip>;
15
+ builtin: z.ZodOptional<z.ZodObject<{
16
+ defaultEnabled: z.ZodOptional<z.ZodBoolean>;
17
+ }, z.core.$strip>>;
15
18
  }, z.core.$strip>;
16
- export type PluginMetadata = z.infer<ReturnType<typeof createMetadataSchema>>;
19
+ type ParsedPluginMetadata = z.infer<ReturnType<typeof createMetadataSchema>>;
20
+ /** Plugin entry paths, keyed by realm. `main` is mandatory. */
21
+ export type PluginMetadataRealms = {
22
+ main: string;
23
+ } & Partial<Record<string, string>>;
24
+ export type PluginMetadata = Omit<ParsedPluginMetadata, "realms"> & {
25
+ realms: PluginMetadataRealms;
26
+ };
17
27
  /**
18
28
  * Validate a parsed `metadata.json`.
19
29
  *
@@ -1,17 +1,27 @@
1
- import { PluginKind } from "../../shared/contracts/plugin-manager-api";
1
+ import type { PluginDesiredState } from "../../shared/contracts/plugin-manager-api.js";
2
+ import { PluginKind } from "../../shared/contracts/plugin-manager-api.js";
2
3
  export interface PluginStateStore {
4
+ /** Effective desired state for a plugin, including built-in defaults. */
5
+ desired(id: string, kind: PluginKind): PluginDesiredState;
3
6
  isEnabled(id: string, kind: PluginKind): boolean;
4
- setEnabled(id: string, enabled: boolean): Promise<void>;
7
+ /** Commit an explicit intent change and return the committed revision. */
8
+ setEnabled(id: string, kind: PluginKind, enabled: boolean): Promise<PluginDesiredState>;
5
9
  }
6
10
  /**
7
- * Persisted enable overrides.
11
+ * Persisted desired state.
8
12
  *
9
- * Built-in plugins default to enabled, user plugins to disabled; only explicit
10
- * toggles are stored.
13
+ * Every plugin defaults to disabled; a built-in may opt in through its own
14
+ * metadata. Explicit changes are stored with a monotonically increasing
15
+ * revision so stale realm notifications can be discarded.
11
16
  */
12
17
  export declare class PluginState implements PluginStateStore {
13
18
  private overrides;
19
+ private defaults;
20
+ private pendingWrite;
14
21
  load(): Promise<void>;
22
+ /** Register the metadata default for a built-in plugin. */
23
+ setDefault(id: string, enabled: boolean): void;
24
+ desired(id: string, kind: PluginKind): PluginDesiredState;
15
25
  isEnabled(id: string, kind: PluginKind): boolean;
16
- setEnabled(id: string, enabled: boolean): Promise<void>;
26
+ setEnabled(id: string, kind: PluginKind, enabled: boolean): Promise<PluginDesiredState>;
17
27
  }
@@ -1,6 +1,21 @@
1
1
  import Emittery from "emittery";
2
2
  import { Keyv } from "keyv";
3
- import { SettingsEvents } from "../shared/types/settings";
4
- export declare let kv: Keyv;
3
+ import { type SettingsValue } from "../shared/settings/defaults.js";
4
+ import { SettingsEvents } from "../shared/types/settings.js";
5
+ /**
6
+ * The settings store.
7
+ *
8
+ * Keys declared in `SETTINGS_DEFAULTS` are typed from their default; any other
9
+ * key (plugins, forward compatibility) resolves to `unknown`. The single
10
+ * generic signature keeps a wrong value for a known key an error while leaving
11
+ * the store open to unknown keys.
12
+ */
13
+ export type SettingsStore = {
14
+ get(keys: string[]): Promise<(unknown | undefined)[]>;
15
+ get<K extends string>(key: K): Promise<SettingsValue<K>>;
16
+ getMany<K extends string>(keys: K[]): Promise<(SettingsValue<K> | undefined)[]>;
17
+ set<K extends string>(key: K, value: SettingsValue<K>, ttl?: number): Promise<boolean>;
18
+ } & Omit<Keyv, "get" | "set" | "getMany">;
19
+ export declare let kv: SettingsStore;
5
20
  export declare let events: Emittery<SettingsEvents>;
6
21
  export declare function initialize(): void;
@@ -1,18 +1,36 @@
1
- export declare enum ScheduleShutdownStatus {
1
+ export declare const ScheduleShutdownStatus: {
2
2
  /** The requested state is now in effect. */
3
- Ok = 0,
3
+ readonly Ok: 0;
4
4
  /** This platform, or the system, cannot schedule a shutdown. */
5
- NotAvailable = 1,
5
+ readonly NotAvailable: 1;
6
6
  /** The requested state already held, so nothing changed. */
7
- AlreadySet = 2,
7
+ readonly AlreadySet: 2;
8
8
  /**
9
- * Another application owns the system's shutdown schedule. Only logind lets us
10
- * see one: Windows cannot report a pending shutdown, so a request that clashes
11
- * with one it cannot report fails at the deadline instead.
12
- */
13
- ManagedExternally = 3,
9
+ * Another application owns the system's shutdown schedule. Only logind lets us
10
+ * see one: Windows cannot report a pending shutdown, so a request that clashes
11
+ * with one it cannot report fails at the deadline instead.
12
+ */
13
+ readonly ManagedExternally: 3;
14
14
  /** The request could not be completed (e.g. the bus is unreachable). */
15
- Failed = 4
15
+ readonly Failed: 4;
16
+ readonly [x: number]: string;
17
+ };
18
+ export type ScheduleShutdownStatus = 0 | 1 | 2 | 3 | 4;
19
+ export declare namespace ScheduleShutdownStatus {
20
+ /** The requested state is now in effect. */
21
+ type Ok = 0;
22
+ /** This platform, or the system, cannot schedule a shutdown. */
23
+ type NotAvailable = 1;
24
+ /** The requested state already held, so nothing changed. */
25
+ type AlreadySet = 2;
26
+ /**
27
+ * Another application owns the system's shutdown schedule. Only logind lets us
28
+ * see one: Windows cannot report a pending shutdown, so a request that clashes
29
+ * with one it cannot report fails at the deadline instead.
30
+ */
31
+ type ManagedExternally = 3;
32
+ /** The request could not be completed (e.g. the bus is unreachable). */
33
+ type Failed = 4;
16
34
  }
17
35
  /** Provide that handler. `calls/os.ts` is the only caller. */
18
36
  export declare function setPowerOffFailureHandler(handler: () => void): void;
@@ -1,4 +1,4 @@
1
- import type { BtnImages, BtnState, ElementTemplate, LayoutNode } from "../../shared/types/dui";
1
+ import type { BtnImages, BtnState, ElementTemplate, LayoutNode } from "../../shared/types/dui.js";
2
2
  export type { ElementTemplate, LayoutNode };
3
3
  export declare function parseElementTemplate(xml: string): ElementTemplate | null;
4
4
  /** Convert #AARRGGBB (ARGB) to CSS #RRGGBBAA. */
@@ -1,2 +1,2 @@
1
- import type { UpdateInfo } from "../shared/types/update";
1
+ import type { UpdateInfo } from "../shared/types/update.js";
2
2
  export declare function checkUpdate(ignoreCache?: boolean): Promise<UpdateInfo | null>;
@@ -0,0 +1,7 @@
1
+ type RgbColor = {
2
+ r: number;
3
+ g: number;
4
+ b: number;
5
+ };
6
+ export declare function hexToRgb(hex: string): RgbColor;
7
+ export {};
@@ -1,9 +1,9 @@
1
1
  import { BaseWindow, BrowserWindow } from "electron";
2
2
  import type { BrowserWindowConstructorOptions } from "electron";
3
3
  import Emittery from "emittery";
4
- import type { LayerShellOptions } from "../../_native/open-orpheus__window";
4
+ import type { LayerShellOptions } from "../../_native/open-orpheus__window.js";
5
5
  export type { LayerShellOptions };
6
- import type AppMenu from "./menu";
6
+ import type AppMenu from "./menu/index.js";
7
7
  type AnyManagedWindow = ManagedWindow<any, any>;
8
8
  type BrowserManagedWindow = ManagedWindow<any, BrowserWindow>;
9
9
  type BaseWindowManaged = ManagedWindow<any, BaseWindow>;
@@ -126,8 +126,11 @@ export declare abstract class ManagedWindow<Data extends WindowData = WindowData
126
126
  * role object — exists.
127
127
  */
128
128
  protected createBrowserWindow(options: BrowserWindowConstructorOptions): BrowserWindow;
129
- /** Whether the compositor can take layer surfaces at all. */
130
- static isLayerShellAvailable(): boolean;
129
+ /**
130
+ * The layer-shell version advertised by a live compositor, or `null` when
131
+ * layer shell is unavailable.
132
+ */
133
+ static layerShellVersion(): number | null;
131
134
  /**
132
135
  * Register the layer-shell policy this window should take, or clear it with
133
136
  * `null`.
@@ -147,6 +150,15 @@ export declare abstract class ManagedWindow<Data extends WindowData = WindowData
147
150
  * this window will be an ordinary toplevel.
148
151
  */
149
152
  setLayerShell(options: LayerShellOptions | null): boolean;
153
+ /**
154
+ * Resize a layer surface that already exists.
155
+ *
156
+ * Only the size changes; anchors and margins stay as they were at role
157
+ * creation. The request is applied at the surface's next commit (layer state
158
+ * is double-buffered), so the caller must also make the window commit, which
159
+ * `BaseWindowMenuSurface.applyMeasurement` does.
160
+ */
161
+ setLayerShellSize(width: number, height: number): boolean;
150
162
  /**
151
163
  * Release the native state this wrapper recorded (its layer-shell policy and
152
164
  * input region).
@@ -260,6 +272,16 @@ export declare class BasicManagedWindow extends ManagedWindow {
260
272
  export declare class BaseWindowManagedWindow extends ManagedWindow<WindowData, BaseWindow> {
261
273
  attach(window: BaseWindow): void;
262
274
  }
275
+ /**
276
+ * A short-lived `BrowserWindow` created as a layer surface.
277
+ *
278
+ * Cursor capture needs a mapped surface with a renderer; it is not a menu
279
+ * surface, so it gets its own managed window. Keeping construction here is
280
+ * what keeps every `BrowserWindow` creation inside the managed wrapper.
281
+ */
282
+ export declare class LayerCaptureWindow extends ManagedWindow<WindowData, BrowserWindow> {
283
+ constructor(options: BrowserWindowConstructorOptions, layerShell: LayerShellOptions, title: string);
284
+ }
263
285
  export declare abstract class OnDemandWindow<T extends WindowData = WindowData> extends ManagedWindow<T> {
264
286
  /** State bound to the single BrowserWindow */
265
287
  protected windowState: OnDemandWindowState | null;
@@ -0,0 +1,3 @@
1
+ import { BrowserWindow } from "electron";
2
+ import { Color } from "../../shared/contracts/color-picker-api.js";
3
+ export default function pickColor(initial?: `#${string}`, parent?: BrowserWindow): Promise<Color | null>;
@@ -1,5 +1,5 @@
1
- import { DesktopLyricsPlayInfo, LyricsStyle } from "../../shared/types/desktop-lyrics";
2
- import { ManagedWindow } from "../window";
1
+ import { DesktopLyricsPlayInfo, LyricsStyle } from "../../shared/types/desktop-lyrics.js";
2
+ import { ManagedWindow } from "../window.js";
3
3
  export declare const lyricsStyle: LyricsStyle;
4
4
  export declare function refreshLyricsStyle(): boolean;
5
5
  export declare let lyricsOffset: number;
@@ -1,4 +1,4 @@
1
- import { ManagedWindow } from "../window";
1
+ import { ManagedWindow } from "../window.js";
2
2
  export default class DesktopPetWindow extends ManagedWindow {
3
3
  constructor(url: string, size?: {
4
4
  width: number;
@@ -1,4 +1,4 @@
1
- import { ManagedWindow } from "../window";
1
+ import { ManagedWindow } from "../window.js";
2
2
  declare class MainWindow extends ManagedWindow {
3
3
  constructor();
4
4
  }
@@ -1,5 +1,5 @@
1
- import { ManagedWindow } from "../window";
2
- import type { MiniPlayerLikeMark, MiniPlayerPlayInfo, MiniPlayerListElement, MiniPlayerFullState, MiniPlayerStyle, MiniPlayerTogetherStatus } from "../../shared/types/mini-player";
1
+ import { ManagedWindow } from "../window.js";
2
+ import type { MiniPlayerLikeMark, MiniPlayerPlayInfo, MiniPlayerListElement, MiniPlayerFullState, MiniPlayerStyle, MiniPlayerTogetherStatus } from "../../shared/types/mini-player.js";
3
3
  export declare function updatePlayInfo(info: MiniPlayerPlayInfo | null): void;
4
4
  export declare function updateCoverUrl(url: string | null): void;
5
5
  export declare function updateLikeMark(liked: MiniPlayerLikeMark): void;
@@ -1,5 +1,5 @@
1
1
  import { Display } from "electron";
2
- import { ManagedWindow } from "../window";
2
+ import { ManagedWindow } from "../window.js";
3
3
  export default class MusicDesktopWindow extends ManagedWindow {
4
4
  private display;
5
5
  /** The display geometry last applied through `setBounds`. */
@@ -1,2 +1,2 @@
1
- import { PackageDownloadReason } from "../../shared/types/package-download";
1
+ import { PackageDownloadReason } from "../../shared/types/package-download.js";
2
2
  export default function showPackgeDownloadWindow(downloadReason?: PackageDownloadReason): Promise<void>;
@@ -0,0 +1,7 @@
1
+ import type { Mount } from "../../shared/bridge/hub.js";
2
+ import type { PluginManagerContract } from "../../shared/contracts/plugin-manager-api.js";
3
+ /** Track a plugin-manager window so catalog changes can be pushed to it. */
4
+ export declare function trackPluginManagerWindow(mount: Mount<PluginManagerContract>): void;
5
+ export declare function untrackPluginManagerWindow(mount: Mount<PluginManagerContract>): void;
6
+ /** Notify every open plugin-manager window that the catalog changed. */
7
+ export declare function notifyPluginManagerChanged(): void;
@@ -1,4 +1,4 @@
1
- import { ManagedWindow } from "../window";
1
+ import { ManagedWindow } from "../window.js";
2
2
  export declare class PluginManagerWindow extends ManagedWindow {
3
3
  constructor();
4
4
  }
@@ -1,9 +1,4 @@
1
- export declare const enum AegisEncryptState {
2
- Normal = 0,
3
- LocalFallback = 1,
4
- GlobalFallback = 2,
5
- ClientFallback = 3
6
- }
1
+ export type AegisEncryptState = 0 | 1 | 2 | 3;
7
2
  export type AegisInitConfig = {
8
3
  aegisUpdateIntervalMinute?: number;
9
4
  updateIntervalMinute?: number;
@@ -1,4 +1,4 @@
1
- import type { AudioPlayInfo } from "./Player";
1
+ import type { AudioPlayInfo } from "./Player.js";
2
2
  /**
3
3
  * The uniform media events a playback backend raises. `Player` re-emits these
4
4
  * as its typed `PlayerEvents`, so consumers never touch the underlying engine.
@@ -1,10 +1,18 @@
1
1
  import Emittery from "emittery";
2
- import AudioEffectManager from "./AudioEffectManager";
3
- export declare enum AudioPlayerState {
4
- Null = 0,
5
- Playing = 1,
6
- Paused = 2,
7
- Error = 3
2
+ import AudioEffectManager from "./AudioEffectManager.js";
3
+ export declare const AudioPlayerState: {
4
+ readonly Null: 0;
5
+ readonly Playing: 1;
6
+ readonly Paused: 2;
7
+ readonly Error: 3;
8
+ readonly [x: number]: string;
9
+ };
10
+ export type AudioPlayerState = 0 | 1 | 2 | 3;
11
+ export declare namespace AudioPlayerState {
12
+ type Null = 0;
13
+ type Playing = 1;
14
+ type Paused = 2;
15
+ type Error = 3;
8
16
  }
9
17
  export type SongInfo = {
10
18
  playId: string;
@@ -1,5 +1,5 @@
1
- import type { AudioPlayInfo } from "../Player";
2
- import type { Av3aTrackInfo } from "../../shared/contracts/av3a-api";
1
+ import type { AudioPlayInfo } from "../Player.js";
2
+ import type { Av3aTrackInfo } from "../../shared/contracts/av3a-api.js";
3
3
  /**
4
4
  * Renders the AV3A decode stream inside the player window's AudioContext.
5
5
  *
@@ -1,5 +1,5 @@
1
- import type { AudioPlayInfo } from "../Player";
2
- import type { Av3aContract } from "../../shared/contracts/av3a-api";
1
+ import type { AudioPlayInfo } from "../Player.js";
2
+ import type { Av3aContract } from "../../shared/contracts/av3a-api.js";
3
3
  /**
4
4
  * Typed client for the main-process `av3a` bridge (the player window).
5
5
  *
@@ -1,5 +1,5 @@
1
- import type { Av3aChannelServiceToRenderer } from "../../shared/contracts/av3a-process";
2
- import type { Av3aTrackInfo } from "../../shared/contracts/av3a-api";
1
+ import type { Av3aChannelServiceToRenderer } from "../../shared/contracts/av3a-process.js";
2
+ import type { Av3aTrackInfo } from "../../shared/contracts/av3a-api.js";
3
3
  /**
4
4
  * Renderer end of the direct channel to the AV3A decode utility process.
5
5
  *
@@ -1,5 +1,5 @@
1
- import type { AudioPlayInfo } from "../Player";
2
- import type { PlaybackBackend, PlaybackEventSink } from "../PlaybackBackend";
1
+ import type { AudioPlayInfo } from "../Player.js";
2
+ import type { PlaybackBackend, PlaybackEventSink } from "../PlaybackBackend.js";
3
3
  /**
4
4
  * The AV3A decode backend. Owns an `Av3aPcmPlayer` (worklet playback, PCM
5
5
  * resampling/downmix, seek/rate) plus the AV3A timeupdate clock, and raises
@@ -1,4 +1,4 @@
1
- import type { PlaybackBackend, PlaybackEventSink } from "../PlaybackBackend";
1
+ import type { PlaybackBackend, PlaybackEventSink } from "../PlaybackBackend.js";
2
2
  /**
3
3
  * The media-element backend. Owns the hidden `<audio>` element and its
4
4
  * `MediaElementAudioSourceNode` so its output flows through the shared WebAudio
@@ -0,0 +1,2 @@
1
+ /** IPC channel carrying every bridge frame between main and a renderer. */
2
+ export declare const BRIDGE_IPC_CHANNEL = "bridge.frame";
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Typed client surface over a mount.
3
+ *
4
+ * Property access builds a route; calling a leaf sends a request, and leaves
5
+ * under `events` create subscriptions. The proxy is path-based, so nested
6
+ * contract groups work without codegen.
7
+ */
8
+ import type { BridgeError } from "./protocol.js";
9
+ type AnyFunction = (...args: any[]) => any;
10
+ export type EventArgs<F> = F extends (callback: (...args: infer A) => void) => unknown ? A : never;
11
+ export type EventEndpoint<E> = {
12
+ [K in keyof E]: E[K] extends (callback: (payload: any) => void) => unknown ? (callback: (...args: EventArgs<E[K]>) => void, onError?: (error: BridgeError) => void) => () => void : E[K] extends object ? EventEndpoint<E[K]> : never;
13
+ };
14
+ export type Endpoint<T> = {
15
+ [K in keyof T as K extends "events" ? never : T[K] extends AnyFunction ? K : T[K] extends object ? K : never]: T[K] extends AnyFunction ? (...args: Parameters<T[K]>) => Promise<Awaited<ReturnType<T[K]>>> : T[K] extends object ? Endpoint<T[K]> : never;
16
+ } & (T extends {
17
+ events: infer E;
18
+ } ? {
19
+ events: EventEndpoint<E>;
20
+ } : {});
21
+ export interface EndpointHooks {
22
+ /** Send a request for the route suffix (for example `cache.getStats`). */
23
+ request(route: string, args: unknown[]): Promise<unknown>;
24
+ /** Subscribe to an event route suffix (for example `timeUpdate`). */
25
+ subscribe(route: string, callback: (...args: unknown[]) => void, onError?: (error: BridgeError) => void): () => void;
26
+ }
27
+ export declare function createEndpoint<T>(hooks: EndpointHooks): Endpoint<T>;
28
+ declare const joinRoute: (mount: string, suffix: string) => string;
29
+ export { joinRoute };