@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
@@ -0,0 +1,136 @@
1
+ /**
2
+ * Hub: the per-realm router.
3
+ *
4
+ * A hub owns three things:
5
+ * - mounts: routes served by this realm,
6
+ * - ports: bridges attached to this realm (one per outside peer),
7
+ * - links: explicit relay rules between two attached ports.
8
+ *
9
+ * Routes are resolved locally first, then through a link, and rejected
10
+ * otherwise. All frames are correlated with ids owned by the sending hop; a
11
+ * link rewrites ids on the way through and remembers how to send the response
12
+ * back.
13
+ */
14
+ import { type Endpoint, type EventArgs } from "./endpoint.js";
15
+ import { BridgeError, type Frame } from "./protocol.js";
16
+ type AnyFunction = (...args: any[]) => unknown;
17
+ export interface BridgeInfo<Meta = unknown> {
18
+ /** Stable id of this port, unique within the hub. */
19
+ readonly id: string;
20
+ /**
21
+ * Opaque transport metadata (realm, window, session, ...). The hub never
22
+ * interprets it; it is forwarded to `authorize` and diagnostics verbatim.
23
+ */
24
+ readonly meta: Meta;
25
+ }
26
+ /** A transport across one boundary. Inert until attached to a hub. */
27
+ export interface Bridge<Meta = unknown> {
28
+ readonly info: BridgeInfo<Meta>;
29
+ send(frame: Frame): void;
30
+ onFrame(handler: (frame: Frame) => void): () => void;
31
+ close(): void;
32
+ }
33
+ export interface Origin<Meta = unknown> {
34
+ readonly bridgeId: string;
35
+ /** Port ids the frame traversed, oldest first. */
36
+ readonly chain: readonly string[];
37
+ /** The peer metadata supplied by the transport that opened this port. */
38
+ readonly meta: Meta;
39
+ }
40
+ export interface CallContext<Meta = unknown> {
41
+ readonly route: string;
42
+ readonly origin: Origin<Meta>;
43
+ readonly signal: AbortSignal;
44
+ /** Id of the port the call arrived on. */
45
+ readonly peer: string;
46
+ }
47
+ export type Handler<Meta = unknown> = (ctx: CallContext<Meta>, ...args: unknown[]) => unknown;
48
+ export type Handlers<T, Meta = unknown> = {
49
+ [K in keyof T as K extends "events" ? never : T[K] extends AnyFunction ? K : T[K] extends object ? K : never]: T[K] extends AnyFunction ? (ctx: CallContext<Meta>, ...args: Parameters<T[K]>) => ReturnType<T[K]> : T[K] extends object ? Handlers<T[K], Meta> : never;
50
+ };
51
+ export type Emitter<T> = {
52
+ [K in keyof T]: T[K] extends (callback: (...args: any) => void) => unknown ? (...args: EventArgs<T[K]>) => void : T[K] extends object ? Emitter<T[K]> : never;
53
+ };
54
+ export interface Mount<T> {
55
+ readonly route: string;
56
+ readonly emit: T extends {
57
+ events: infer E;
58
+ } ? Emitter<E> : Record<string, never>;
59
+ dispose(): void;
60
+ }
61
+ export interface MountOptions<Meta = unknown> {
62
+ /** Fine-grained origin check, applied after the port ingress ACL. */
63
+ readonly authorize?: (origin: Origin<Meta>) => boolean;
64
+ }
65
+ export interface LinkOptions {
66
+ /** Consumer route pattern → server route pattern. Also the link's ACL. */
67
+ readonly routes: Readonly<Record<string, string>>;
68
+ /** Default timeout for requests traversing this link. */
69
+ readonly timeoutMs?: number;
70
+ }
71
+ export interface ConnectOptions {
72
+ readonly timeoutMs?: number;
73
+ readonly onError?: (error: BridgeError) => void;
74
+ }
75
+ export interface Port<Meta = unknown> {
76
+ readonly id: string;
77
+ readonly origin: Origin<Meta>;
78
+ send(frame: Frame): void;
79
+ dispose(): void;
80
+ }
81
+ export interface Link {
82
+ dispose(): void;
83
+ }
84
+ export declare class HubImpl<Meta = unknown> {
85
+ private readonly mounts;
86
+ private readonly ports;
87
+ private readonly portRecords;
88
+ private readonly links;
89
+ private readonly localSubs;
90
+ private readonly localOrigin;
91
+ private localSubSeq;
92
+ private closed;
93
+ constructor(options?: {
94
+ localMeta?: Meta;
95
+ });
96
+ mount<T>(route: string, impl: Handlers<T, Meta>, options?: MountOptions<Meta>): Mount<T>;
97
+ attach(bridge: Bridge<Meta>): Port<Meta>;
98
+ bridge(client: Port<Meta>, server: Port<Meta>, options: LinkOptions): Link;
99
+ connect<T>(route: string, options?: ConnectOptions): Endpoint<T>;
100
+ connect<T>(port: Port<Meta>, route: string, options?: ConnectOptions): Endpoint<T>;
101
+ dispose(): void;
102
+ private dispatch;
103
+ private reportDispatchFailure;
104
+ private acceptSession;
105
+ private resetPortSession;
106
+ private handleRequest;
107
+ private handleSubscribe;
108
+ private handleResponse;
109
+ private handleEvent;
110
+ private handleUnsubscribe;
111
+ private handleCancel;
112
+ private matchingLinks;
113
+ private forward;
114
+ private expire;
115
+ private forget;
116
+ private removeLink;
117
+ private requestLocal;
118
+ private subscribeLocal;
119
+ private requestVia;
120
+ private subscribeVia;
121
+ private createEmitter;
122
+ private emit;
123
+ private dropSubscriptions;
124
+ private resolveMount;
125
+ private originFor;
126
+ private send;
127
+ private fail;
128
+ private failSub;
129
+ private requirePort;
130
+ private detach;
131
+ private assertOpen;
132
+ }
133
+ export declare function createHub<Meta = unknown>(options?: {
134
+ localMeta?: Meta;
135
+ }): HubImpl<Meta>;
136
+ export {};
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Wire protocol for the Open Orpheus bridge.
3
+ *
4
+ * A frame is a data-only message that can cross a process boundary
5
+ * (`ipcRenderer`/`ipcMain`), a context boundary (`contextBridge`) or an
6
+ * in-memory test transport. Everything is correlated by numeric ids that are
7
+ * owned by the hop that generated them, so relays never need global ids.
8
+ */
9
+ export interface SerializedError {
10
+ readonly name: string;
11
+ readonly message: string;
12
+ readonly code?: string;
13
+ readonly data?: unknown;
14
+ }
15
+ export type Result = {
16
+ readonly ok: true;
17
+ readonly value: unknown;
18
+ } | {
19
+ readonly ok: false;
20
+ readonly error: SerializedError;
21
+ };
22
+ export type Frame = {
23
+ readonly t: "req";
24
+ readonly id: number;
25
+ /** Preload document identity; lets the main side reset stale state on reload. */
26
+ readonly session?: string;
27
+ readonly route: string;
28
+ readonly args: unknown[];
29
+ readonly chain: readonly string[];
30
+ } | {
31
+ readonly t: "sub";
32
+ readonly id: number;
33
+ /** Preload document identity; lets the main side reset stale state on reload. */
34
+ readonly session?: string;
35
+ readonly route: string;
36
+ readonly chain: readonly string[];
37
+ } | ({
38
+ readonly t: "res";
39
+ readonly id: number;
40
+ readonly session?: string;
41
+ } & Result) | ({
42
+ readonly t: "sres";
43
+ readonly id: number;
44
+ readonly session?: string;
45
+ } & DistributionResult) | {
46
+ readonly t: "evt";
47
+ readonly id: number;
48
+ readonly session?: string;
49
+ readonly payload: readonly unknown[];
50
+ } | {
51
+ readonly t: "unsub";
52
+ readonly id: number;
53
+ readonly session?: string;
54
+ } | {
55
+ readonly t: "cancel";
56
+ readonly id: number;
57
+ readonly session?: string;
58
+ };
59
+ export type DistributionResult = {
60
+ readonly ok: true;
61
+ } | {
62
+ readonly ok: false;
63
+ readonly error: SerializedError;
64
+ };
65
+ export type RequestFrame = Extract<Frame, {
66
+ t: "req";
67
+ }>;
68
+ export type SubscribeFrame = Extract<Frame, {
69
+ t: "sub";
70
+ }>;
71
+ export type ResponseFrame = Extract<Frame, {
72
+ t: "res";
73
+ }>;
74
+ export type SubscribeResultFrame = Extract<Frame, {
75
+ t: "sres";
76
+ }>;
77
+ export type EventFrame = Extract<Frame, {
78
+ t: "evt";
79
+ }>;
80
+ export declare class BridgeError extends Error {
81
+ readonly code: string;
82
+ readonly data?: unknown;
83
+ constructor(code: string, message: string, options?: {
84
+ data?: unknown;
85
+ cause?: unknown;
86
+ });
87
+ toSerialized(): SerializedError;
88
+ static from(serialized: SerializedError | undefined): BridgeError;
89
+ }
90
+ export declare function serializeError(error: unknown): SerializedError;
91
+ export declare function isBridgeError(error: unknown, code?: string): error is BridgeError;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Optional realm metadata for transports.
3
+ *
4
+ * The hub core is neutral: it only forwards whatever `BridgeInfo.meta` the
5
+ * transport supplies to `authorize` and diagnostics. Electron transports use
6
+ * this shape to describe the peer a port talks to.
7
+ */
8
+ export type BridgeProcess = "main" | "renderer";
9
+ export type BridgeWorld = "main" | "isolated";
10
+ export interface Realm {
11
+ readonly process: BridgeProcess;
12
+ readonly world: BridgeWorld;
13
+ readonly windowId?: number;
14
+ }
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Route pattern compilation for bridge mount ACLs and link rewrites.
3
+ *
4
+ * Patterns are dot-separated segments:
5
+ * - a literal segment matches itself,
6
+ * - `*` matches exactly one non-empty segment,
7
+ * - `**` matches the remainder of the route and is only valid as the last
8
+ * segment.
9
+ *
10
+ * Rewrite targets refer to captures with `$1`, `$2`, ... in source order.
11
+ */
12
+ export interface RouteMatch {
13
+ /** The pattern that matched. */
14
+ readonly pattern: string;
15
+ /** The route the frame carried when it entered the link. */
16
+ readonly route: string;
17
+ /** The route the frame must carry when it leaves the link. */
18
+ readonly to: string;
19
+ }
20
+ /**
21
+ * Compile one pattern. Throws `InvalidRoutePattern` for empty segments and for
22
+ * a `**` that is not the final segment.
23
+ */
24
+ export declare function compilePattern(pattern: string): {
25
+ re: RegExp;
26
+ captures: number;
27
+ };
28
+ /**
29
+ * Ordered rewrite table. The first matching rule wins; a route that matches
30
+ * none is not allowed through the link.
31
+ */
32
+ export declare class RouteTable {
33
+ private readonly rules;
34
+ private constructor();
35
+ static from(routes: Readonly<Record<string, string>>): RouteTable;
36
+ rewrite(route: string): RouteMatch | null;
37
+ }
@@ -1,4 +1,4 @@
1
- import type { AudioPlayInfo } from "../../preload/Player";
1
+ import type { AudioPlayInfo } from "../../preload/Player.js";
2
2
  /** Track metadata reported once the AV3A track has been indexed (`moov`). */
3
3
  export interface Av3aTrackInfo {
4
4
  sampleRate: number;
@@ -1,4 +1,4 @@
1
- import type { Av3aPcmEvent, Av3aTrackInfo } from "./av3a-api";
1
+ import type { Av3aPcmEvent, Av3aTrackInfo } from "./av3a-api.js";
2
2
  /**
3
3
  * Messaging between the main process and the AV3A decode utility process
4
4
  * (`process.parentPort` <-> `UtilityProcess.postMessage`).
@@ -0,0 +1,17 @@
1
+ export interface Color {
2
+ hexString: `#${string}`;
3
+ rgb: {
4
+ r: number;
5
+ g: number;
6
+ b: number;
7
+ };
8
+ hsl: {
9
+ h: number;
10
+ s: number;
11
+ l: number;
12
+ };
13
+ }
14
+ export interface ColorPickerContract {
15
+ initialValue(): Promise<`#${string}`>;
16
+ save(value: Color): Promise<void>;
17
+ }
@@ -1,6 +1,5 @@
1
- import type { DesktopLyricsPlayInfo, LyricsStyle } from "../types/desktop-lyrics";
1
+ import type { DesktopLyricsPlayInfo, LyricsStyle } from "../types/desktop-lyrics.js";
2
2
  export interface DesktopLyricsContract {
3
- platform: NodeJS.Platform;
4
3
  events: {
5
4
  styleUpdate(callback: (style: LyricsStyle) => void): void;
6
5
  lockUpdate(callback: (locked: boolean) => void): void;
@@ -1,6 +1,5 @@
1
- import type { InputRegion } from "../types/input-region";
1
+ import type { InputRegion } from "../types/input-region.js";
2
2
  export type { InputRegion };
3
3
  export interface InputRegionContract {
4
- platform: NodeJS.Platform;
5
4
  setInputRegions(regions: InputRegion[]): Promise<boolean>;
6
5
  }
@@ -1,4 +1,4 @@
1
- import type { LyricsStore } from "../types/lyrics";
1
+ import type { LyricsStore } from "../types/lyrics.js";
2
2
  export interface LyricsContract {
3
3
  events: {
4
4
  lyricsStoreUpdate(callback: (store: LyricsStore | null) => void): void;
@@ -1,9 +1,7 @@
1
- import type { UpdateInfo } from "../types/update";
2
- import type { CacheGroupStats, AllCacheStats } from "../types/manage";
1
+ import type { UpdateInfo } from "../types/update.js";
2
+ import type { CacheGroupStats, AllCacheStats } from "../types/manage.js";
3
3
  export type { CacheGroupStats, AllCacheStats };
4
4
  export interface ManageContract {
5
- platform: NodeJS.Platform;
6
- versions: NodeJS.ProcessVersions;
7
5
  events: {
8
6
  setFont(callback: (font: string | null) => void): void;
9
7
  };
@@ -0,0 +1,35 @@
1
+ import type { MenuChildOpenRequest, MenuMeasurement, MenuSurfaceConfig, MenuSurfaceId, MenuUpdate } from "../types/menu-surface.js";
2
+ export interface MenuSurfaceContract {
3
+ surface: {
4
+ ready(): Promise<boolean>;
5
+ getFont(): Promise<string | null>;
6
+ reportSize(payload: {
7
+ requestId: number;
8
+ } & MenuMeasurement): Promise<boolean>;
9
+ visible(payload: {
10
+ requestId: number;
11
+ }): Promise<boolean>;
12
+ itemClick(menuId: string | null): Promise<void>;
13
+ btnClick(btnId: string): Promise<void>;
14
+ close(): Promise<void>;
15
+ openChild(payload: MenuChildOpenRequest): Promise<void>;
16
+ closeChildren(parentId: MenuSurfaceId): Promise<void>;
17
+ };
18
+ events: {
19
+ surface: {
20
+ prepare(callback: (config: MenuSurfaceConfig & {
21
+ requestId: number;
22
+ }) => void): void;
23
+ update(callback: (update: MenuUpdate) => void): void;
24
+ show(callback: (payload: {
25
+ requestId: number;
26
+ }) => void): void;
27
+ cursor(callback: (payload: {
28
+ requestId: number;
29
+ x: number;
30
+ y: number;
31
+ fallback?: boolean;
32
+ }) => void): void;
33
+ };
34
+ };
35
+ }
@@ -1,4 +1,4 @@
1
- import type { MiniPlayerPlayInfo, MiniPlayerPlayState, MiniPlayerListData, MiniPlayerFullState, MiniPlayerStyle, MiniPlayerShowVolumeRequest, MiniPlayerLikeMark, MiniPlayerTogetherStatus } from "../types/mini-player";
1
+ import type { MiniPlayerPlayInfo, MiniPlayerPlayState, MiniPlayerListData, MiniPlayerFullState, MiniPlayerStyle, MiniPlayerShowVolumeRequest, MiniPlayerLikeMark, MiniPlayerTogetherStatus } from "../types/mini-player.js";
2
2
  export interface MiniPlayerContract {
3
3
  events: {
4
4
  playInfoUpdate(callback: (info: MiniPlayerPlayInfo | null) => void): void;
@@ -1,12 +1,153 @@
1
- export declare enum PluginKind {
2
- Builtin = "builtin",
3
- User = "user"
1
+ /** @internal */
2
+ export declare const PluginKind: {
3
+ readonly Builtin: "builtin";
4
+ readonly User: "user";
5
+ };
6
+ /** @internal */
7
+ export type PluginKind = "builtin" | "user";
8
+ export declare namespace PluginKind {
9
+ type Builtin = "builtin";
10
+ type User = "user";
4
11
  }
5
- export declare enum PluginActivationStatus {
6
- Active = "active",
7
- Inactive = "inactive",
8
- Failed = "failed"
12
+ /** Plugin identity layer. Built-ins take precedence over user plugins. */
13
+ /** @internal */
14
+ export declare const PluginLayer: {
15
+ readonly Builtin: "builtin";
16
+ readonly User: "user";
17
+ };
18
+ /** Plugin identity layer. Built-ins take precedence over user plugins. */
19
+ /** @internal */
20
+ export type PluginLayer = "builtin" | "user";
21
+ export declare namespace PluginLayer {
22
+ type Builtin = "builtin";
23
+ type User = "user";
9
24
  }
25
+ /** @internal */
26
+ export declare const PluginRuntimeStateKind: {
27
+ readonly Stopped: "stopped";
28
+ readonly Starting: "starting";
29
+ readonly Running: "running";
30
+ readonly Stopping: "stopping";
31
+ readonly Failed: "failed";
32
+ readonly Hung: "hung";
33
+ readonly Abandoned: "abandoned";
34
+ readonly Disposed: "disposed";
35
+ };
36
+ /** @internal */
37
+ export type PluginRuntimeStateKind = "stopped" | "starting" | "running" | "stopping" | "failed" | "hung" | "abandoned" | "disposed";
38
+ export declare namespace PluginRuntimeStateKind {
39
+ type Stopped = "stopped";
40
+ type Starting = "starting";
41
+ type Running = "running";
42
+ type Stopping = "stopping";
43
+ type Failed = "failed";
44
+ type Hung = "hung";
45
+ type Abandoned = "abandoned";
46
+ type Disposed = "disposed";
47
+ }
48
+ /** @internal */
49
+ export declare const PluginFailureStage: {
50
+ readonly Load: "load";
51
+ readonly Activate: "activate";
52
+ readonly Deactivate: "deactivate";
53
+ };
54
+ /** @internal */
55
+ export type PluginFailureStage = "load" | "activate" | "deactivate";
56
+ export declare namespace PluginFailureStage {
57
+ type Load = "load";
58
+ type Activate = "activate";
59
+ type Deactivate = "deactivate";
60
+ }
61
+ /** Serializable form of a runtime state, safe to cross IPC. */
62
+ /** @internal */
63
+ export interface SerializablePluginRuntimeState {
64
+ kind: PluginRuntimeStateKind;
65
+ desiredRevision: number;
66
+ attempt?: number;
67
+ stage?: PluginFailureStage;
68
+ error?: string;
69
+ retryable?: boolean;
70
+ since?: number;
71
+ startedAt?: number;
72
+ timedOut?: boolean;
73
+ }
74
+ /** @internal */
75
+ export interface PluginDesiredState {
76
+ enabled: boolean;
77
+ revision: number;
78
+ }
79
+ /** @internal */
80
+ export declare const PluginAvailabilityKind: {
81
+ readonly Available: "available";
82
+ readonly Conflict: "conflict";
83
+ readonly Invalid: "invalid";
84
+ };
85
+ /** @internal */
86
+ export type PluginAvailabilityKind = "available" | "conflict" | "invalid";
87
+ export declare namespace PluginAvailabilityKind {
88
+ type Available = "available";
89
+ type Conflict = "conflict";
90
+ type Invalid = "invalid";
91
+ }
92
+ /** @internal */
93
+ export type PluginAvailability = {
94
+ kind: "available";
95
+ } | {
96
+ kind: "conflict";
97
+ paths: string[];
98
+ } | {
99
+ kind: "invalid";
100
+ path: string;
101
+ error: string;
102
+ };
103
+ /** @internal */
104
+ export declare const PluginPresentationStatus: {
105
+ readonly Unavailable: "unavailable";
106
+ readonly Disabled: "disabled";
107
+ readonly Starting: "starting";
108
+ readonly Running: "running";
109
+ readonly Degraded: "degraded";
110
+ readonly Failed: "failed";
111
+ readonly Stopping: "stopping";
112
+ readonly CleanupFailed: "cleanup-failed";
113
+ };
114
+ /** @internal */
115
+ export type PluginPresentationStatus = "unavailable" | "disabled" | "starting" | "running" | "degraded" | "failed" | "stopping" | "cleanup-failed";
116
+ export declare namespace PluginPresentationStatus {
117
+ type Unavailable = "unavailable";
118
+ type Disabled = "disabled";
119
+ type Starting = "starting";
120
+ type Running = "running";
121
+ type Degraded = "degraded";
122
+ type Failed = "failed";
123
+ type Stopping = "stopping";
124
+ type CleanupFailed = "cleanup-failed";
125
+ }
126
+ /** @internal */
127
+ export interface PluginRealmInstanceSummary {
128
+ webContentsId: number;
129
+ state: SerializablePluginRuntimeState;
130
+ }
131
+ /** @internal */
132
+ export interface PluginRealmSummary {
133
+ declared: boolean;
134
+ hostCount: number;
135
+ instances: PluginRealmInstanceSummary[];
136
+ counts: Partial<Record<PluginRuntimeStateKind, number>>;
137
+ }
138
+ /** Configuration UI declared by the plugin, independent of its execution realms. */
139
+ /** @internal */
140
+ export interface PluginConfigurationSummary {
141
+ declared: boolean;
142
+ /** Resolved `assets://plugins/<id>/<path>` URL, when declared. */
143
+ url?: string;
144
+ }
145
+ /** @internal */
146
+ export interface PluginShadowedSource {
147
+ layer: PluginLayer;
148
+ path: string;
149
+ }
150
+ /** @internal */
10
151
  export interface PluginManagerEntry {
11
152
  id: string;
12
153
  name: string;
@@ -14,21 +155,69 @@ export interface PluginManagerEntry {
14
155
  description?: string;
15
156
  author?: string;
16
157
  license?: string;
158
+ /** Resolved `assets://plugins/<id>/<path>` URL, when the plugin declares an icon. */
159
+ icon?: string;
17
160
  kind: PluginKind;
18
- /** Persisted intent: should this plugin be activated? */
161
+ layer: PluginLayer;
162
+ /** Persisted intent. */
163
+ desired: PluginDesiredState;
164
+ /** Convenience mirror of `desired.enabled`. */
19
165
  enabled: boolean;
20
- /** Runtime outcome from the plugin loader. */
21
- status: PluginActivationStatus;
166
+ availability: PluginAvailability;
167
+ /** User plugins ignored because a built-in owns the same id. */
168
+ shadowed: PluginShadowedSource[];
169
+ /** Main-realm runtime state. */
170
+ main: SerializablePluginRuntimeState;
171
+ /** Per-window secondary-realm instances, keyed by realm. */
172
+ realms: Record<string, PluginRealmSummary>;
173
+ /** Declared configuration UI module. */
174
+ configuration: PluginConfigurationSummary;
175
+ /** Derived presentation category; raw state above remains authoritative. */
176
+ presentation: PluginPresentationStatus;
22
177
  error?: string;
23
178
  }
179
+ /** @internal */
24
180
  export interface PluginManagerState {
25
181
  /** False when the plugin system itself is disabled. */
26
182
  available: boolean;
27
183
  plugins: PluginManagerEntry[];
28
184
  }
185
+ /** Revisioned desired-state notification sent to realm windows. */
186
+ /** @internal */
187
+ export interface PluginRealmDesiredChange {
188
+ realm: string;
189
+ id: string;
190
+ enabled: boolean;
191
+ revision: number;
192
+ }
193
+ /** What a newly created realm window needs to start its plugins. */
194
+ /** @internal */
195
+ export interface PluginRealmBootstrap {
196
+ realm: string;
197
+ plugins: Array<{
198
+ id: string;
199
+ desired: PluginDesiredState;
200
+ /** Omitted when the source could not be read; the window fetches it. */
201
+ source?: string;
202
+ }>;
203
+ }
204
+ /** Per-plugin runtime report sent from a realm window. */
205
+ /** @internal */
206
+ export interface PluginRealmReport {
207
+ realm: string;
208
+ id: string;
209
+ desiredRevision: number;
210
+ attempt: number;
211
+ state: SerializablePluginRuntimeState;
212
+ }
213
+ /** @internal */
29
214
  export interface PluginManagerContract {
30
- platform: NodeJS.Platform;
31
- versions: NodeJS.ProcessVersions;
32
215
  list(): Promise<PluginManagerState>;
33
216
  setEnabled(id: string, enabled: boolean): Promise<PluginManagerState>;
217
+ retry(id: string): Promise<PluginManagerState>;
218
+ openPluginsFolder(): Promise<void>;
219
+ events: {
220
+ /** Fired when a plugin's desired state or runtime state changes. */
221
+ changed(callback: () => void): void;
222
+ };
34
223
  }
@@ -1,2 +1,2 @@
1
- import type { PlaybackMode } from "./types/playback-mode";
1
+ import type { PlaybackMode } from "./types/playback-mode.js";
2
2
  export declare function isPlaybackMode(mode: unknown): mode is PlaybackMode;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Append a unique `?t=<timestamp>-<rand>` query to a module URL.
3
+ *
4
+ * Both Node's ESM loader and Chromium's module map cache by full URL, so a
5
+ * distinct query forces a fresh evaluation. Callers must share the returned URL
6
+ * for one activation epoch; otherwise the same entry evaluates twice.
7
+ */
8
+ export declare function cacheBustUrl(url: string): string;