@open-orpheus/plugin-api 0.0.0-stage → 0.0.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 (215) hide show
  1. package/dist/host/_native/open-orpheus__database.d.ts +50 -0
  2. package/dist/host/_native/open-orpheus__window.d.ts +266 -0
  3. package/dist/host/src/constants.d.ts +6 -0
  4. package/dist/host/src/main/afp.d.ts +1 -0
  5. package/dist/host/src/main/arguments.d.ts +4 -0
  6. package/dist/host/src/main/audio/ChunkTracker.d.ts +23 -0
  7. package/dist/host/src/main/audio/DownloadScheduler.d.ts +53 -0
  8. package/dist/host/src/main/audio/MediaEngine.d.ts +47 -0
  9. package/dist/host/src/main/audio/OnlineStreamer.d.ts +66 -0
  10. package/dist/host/src/main/audio/StorageManager.d.ts +18 -0
  11. package/dist/host/src/main/audio.d.ts +6 -0
  12. package/dist/host/src/main/av3a/Av3aEngine.d.ts +24 -0
  13. package/dist/host/src/main/av3a/Av3aM4aSession.d.ts +101 -0
  14. package/dist/host/src/main/av3a/Av3aPlaybackProcess.d.ts +52 -0
  15. package/dist/host/src/main/av3a/detect.d.ts +6 -0
  16. package/dist/host/src/main/av3a/sources.d.ts +13 -0
  17. package/dist/host/src/main/av3a/types.d.ts +54 -0
  18. package/dist/host/src/main/bridge/modules/inputRegion.d.ts +1 -0
  19. package/dist/host/src/main/bridge/modules/lyrics.d.ts +1 -0
  20. package/dist/host/src/main/bridge/modules/settings.d.ts +1 -0
  21. package/dist/host/src/main/bridge/register.d.ts +9 -0
  22. package/dist/host/src/main/cache/HttpCacheStorage.d.ts +10 -0
  23. package/dist/host/src/main/cache/LyricCahceManager.d.ts +21 -0
  24. package/dist/host/src/main/cache/PlayCacheManager.d.ts +72 -0
  25. package/dist/host/src/main/cache.d.ts +7 -0
  26. package/dist/host/src/main/calls/app.d.ts +1 -0
  27. package/dist/host/src/main/calls/audioeffect.d.ts +1 -0
  28. package/dist/host/src/main/calls/browser.d.ts +1 -0
  29. package/dist/host/src/main/calls/desktop.d.ts +2 -0
  30. package/dist/host/src/main/calls/desktoppet.d.ts +1 -0
  31. package/dist/host/src/main/calls/download.d.ts +1 -0
  32. package/dist/host/src/main/calls/index.d.ts +16 -0
  33. package/dist/host/src/main/calls/musiclibrary.d.ts +1 -0
  34. package/dist/host/src/main/calls/network.d.ts +1 -0
  35. package/dist/host/src/main/calls/os.d.ts +1 -0
  36. package/dist/host/src/main/calls/player.d.ts +22 -0
  37. package/dist/host/src/main/calls/process.d.ts +1 -0
  38. package/dist/host/src/main/calls/rtc.d.ts +1 -0
  39. package/dist/host/src/main/calls/storage.d.ts +1 -0
  40. package/dist/host/src/main/calls/trayicon.d.ts +1 -0
  41. package/dist/host/src/main/calls/update.d.ts +1 -0
  42. package/dist/host/src/main/calls/winhelper.d.ts +1 -0
  43. package/dist/host/src/main/calls.d.ts +5 -0
  44. package/dist/host/src/main/channel.d.ts +1 -0
  45. package/dist/host/src/main/cookie.d.ts +13 -0
  46. package/dist/host/src/main/crypto.d.ts +46 -0
  47. package/dist/host/src/main/database/KeyvSqliteDriver.d.ts +6 -0
  48. package/dist/host/src/main/database.d.ts +5 -0
  49. package/dist/host/src/main/dawn.d.ts +31 -0
  50. package/dist/host/src/main/device.d.ts +3 -0
  51. package/dist/host/src/main/download.d.ts +40 -0
  52. package/dist/host/src/main/error.d.ts +1 -0
  53. package/dist/host/src/main/folders.d.ts +18 -0
  54. package/dist/host/src/main/fonts.d.ts +1 -0
  55. package/dist/host/src/main/gui.d.ts +4 -0
  56. package/dist/host/src/main/id3.d.ts +42 -0
  57. package/dist/host/src/main/lifecycle.d.ts +118 -0
  58. package/dist/host/src/main/logger.d.ts +12 -0
  59. package/dist/host/src/main/lyrics/DbusLyricsService.d.ts +115 -0
  60. package/dist/host/src/main/lyrics/LyricsDispatcher.d.ts +26 -0
  61. package/dist/host/src/main/lyrics/dbus.d.ts +16 -0
  62. package/dist/host/src/main/lyrics/parse.d.ts +21 -0
  63. package/dist/host/src/main/lyrics.d.ts +2 -0
  64. package/dist/host/src/main/mediaSession.d.ts +42 -0
  65. package/dist/host/src/main/menu/AppMenu.d.ts +35 -0
  66. package/dist/host/src/main/menu/anchor.d.ts +13 -0
  67. package/dist/host/src/main/menu/backend/DesktopWindowBackend.d.ts +30 -0
  68. package/dist/host/src/main/menu/backend/MenuBackend.d.ts +28 -0
  69. package/dist/host/src/main/menu/backend/WaylandOverlayBackend.d.ts +15 -0
  70. package/dist/host/src/main/menu/backend/WaylandPopupBackend.d.ts +31 -0
  71. package/dist/host/src/main/menu/constants.d.ts +12 -0
  72. package/dist/host/src/main/menu/index.d.ts +2 -0
  73. package/dist/host/src/main/menu/native-popup.d.ts +16 -0
  74. package/dist/host/src/main/menu/patch.d.ts +3 -0
  75. package/dist/host/src/main/menu/skin.d.ts +3 -0
  76. package/dist/host/src/main/menu/surface/BaseWindowMenuSurface.d.ts +69 -0
  77. package/dist/host/src/main/menu/surface/MenuSurface.d.ts +29 -0
  78. package/dist/host/src/main/menu/surface/MenuSurfacePath.d.ts +29 -0
  79. package/dist/host/src/main/menu/surface/SurfacePool.d.ts +15 -0
  80. package/dist/host/src/main/menu/workaround.d.ts +6 -0
  81. package/dist/host/src/main/ncae.d.ts +8 -0
  82. package/dist/host/src/main/network/handler.d.ts +3 -0
  83. package/dist/host/src/main/network/interceptor.d.ts +2 -0
  84. package/dist/host/src/main/network/interceptors/anonymous.d.ts +2 -0
  85. package/dist/host/src/main/network/pipeline.d.ts +8 -0
  86. package/dist/host/src/main/network/types.d.ts +70 -0
  87. package/dist/host/src/main/orpheus.d.ts +10 -0
  88. package/dist/host/src/main/pack.d.ts +27 -0
  89. package/dist/host/src/main/packs/Pack.d.ts +12 -0
  90. package/dist/host/src/main/packs/SkinPack.d.ts +6 -0
  91. package/dist/host/src/main/packs/WebPack.d.ts +6 -0
  92. package/dist/host/src/main/playback/PlaybackController.d.ts +57 -0
  93. package/dist/host/src/main/playback/PlayerCommandRouter.d.ts +85 -0
  94. package/dist/host/src/main/playback/adapters/MediaSessionAdapter.d.ts +61 -0
  95. package/dist/host/src/main/playback/adapters/MprisAdapter.d.ts +48 -0
  96. package/dist/host/src/main/playback/adapters/NowPlayingAdapter.d.ts +23 -0
  97. package/dist/host/src/main/playback/adapters/SmtcAdapter.d.ts +23 -0
  98. package/dist/host/src/main/playback/artwork.d.ts +47 -0
  99. package/dist/host/src/main/playback/modes.d.ts +8 -0
  100. package/dist/host/src/main/playback/types.d.ts +39 -0
  101. package/dist/host/src/main/plugin/discover.d.ts +36 -0
  102. package/dist/host/src/main/plugin/index.d.ts +12 -0
  103. package/dist/host/src/main/plugin/loader.d.ts +43 -0
  104. package/dist/host/src/main/plugin/manager.d.ts +15 -0
  105. package/dist/host/src/main/plugin/metadata.d.ts +24 -0
  106. package/dist/host/src/main/plugin/state.d.ts +17 -0
  107. package/dist/host/src/main/plugin/tree.d.ts +13 -0
  108. package/dist/host/src/main/plugin/types.d.ts +18 -0
  109. package/dist/host/src/main/protocol.d.ts +4 -0
  110. package/dist/host/src/main/request.d.ts +16 -0
  111. package/dist/host/src/main/settings.d.ts +6 -0
  112. package/dist/host/src/main/shortcuts.d.ts +10 -0
  113. package/dist/host/src/main/shutdown.d.ts +32 -0
  114. package/dist/host/src/main/skin/color.d.ts +2 -0
  115. package/dist/host/src/main/skin/dui.d.ts +15 -0
  116. package/dist/host/src/main/tray.d.ts +8 -0
  117. package/dist/host/src/main/update.d.ts +2 -0
  118. package/dist/host/src/main/util/display.d.ts +3 -0
  119. package/dist/host/src/main/util/env.d.ts +1 -0
  120. package/dist/host/src/main/util/fs.d.ts +21 -0
  121. package/dist/host/src/main/util/image.d.ts +1 -0
  122. package/dist/host/src/main/util/musicFile.d.ts +1 -0
  123. package/dist/host/src/main/util/musicPicture.d.ts +2 -0
  124. package/dist/host/src/main/util/path.d.ts +2 -0
  125. package/dist/host/src/main/util/send.d.ts +13 -0
  126. package/dist/host/src/main/util/url.d.ts +19 -0
  127. package/dist/host/src/main/util/window.d.ts +2 -0
  128. package/dist/host/src/main/window.d.ts +294 -0
  129. package/dist/host/src/main/windows/desktop-lyrics.d.ts +12 -0
  130. package/dist/host/src/main/windows/desktop-pet.d.ts +8 -0
  131. package/dist/host/src/main/windows/main.d.ts +6 -0
  132. package/dist/host/src/main/windows/manage.d.ts +2 -0
  133. package/dist/host/src/main/windows/mini-player.d.ts +16 -0
  134. package/dist/host/src/main/windows/music-desktop.d.ts +13 -0
  135. package/dist/host/src/main/windows/package-download.d.ts +2 -0
  136. package/dist/host/src/main/windows/plugin-manager.d.ts +5 -0
  137. package/dist/host/src/main/xeapi.d.ts +53 -0
  138. package/dist/host/src/preload/AudioEffectManager.d.ts +124 -0
  139. package/dist/host/src/preload/PlaybackBackend.d.ts +34 -0
  140. package/dist/host/src/preload/Player.d.ts +221 -0
  141. package/dist/host/src/preload/av3a/Av3aPcmPlayer.d.ts +84 -0
  142. package/dist/host/src/preload/av3a/bridge.d.ts +21 -0
  143. package/dist/host/src/preload/av3a/channel.d.ts +40 -0
  144. package/dist/host/src/preload/av3a/detect.d.ts +6 -0
  145. package/dist/host/src/preload/backends/Av3aPlaybackBackend.d.ts +32 -0
  146. package/dist/host/src/preload/backends/MediaPlaybackBackend.d.ts +25 -0
  147. package/dist/host/src/shared/CallDispatcher.d.ts +12 -0
  148. package/dist/host/src/shared/contracts/av3a-api.d.ts +50 -0
  149. package/dist/host/src/shared/contracts/av3a-process.d.ts +56 -0
  150. package/dist/host/src/shared/contracts/desktop-lyrics-api.d.ts +23 -0
  151. package/dist/host/src/shared/contracts/input-region-api.d.ts +6 -0
  152. package/dist/host/src/shared/contracts/lyrics-api.d.ts +11 -0
  153. package/dist/host/src/shared/contracts/manage-api.d.ts +33 -0
  154. package/dist/host/src/shared/contracts/mini-player-api.d.ts +19 -0
  155. package/dist/host/src/shared/contracts/plugin-manager-api.d.ts +34 -0
  156. package/dist/host/src/shared/contracts/settings-api.d.ts +15 -0
  157. package/dist/host/src/shared/playbackMode.d.ts +2 -0
  158. package/dist/host/src/shared/plugin/registry.d.ts +32 -0
  159. package/dist/host/src/shared/types/desktop-lyrics.d.ts +44 -0
  160. package/dist/host/src/shared/types/dui.d.ts +37 -0
  161. package/dist/host/src/shared/types/input-region.d.ts +6 -0
  162. package/dist/host/src/shared/types/lyrics.d.ts +15 -0
  163. package/dist/host/src/shared/types/manage.d.ts +14 -0
  164. package/dist/host/src/shared/types/menu-surface.d.ts +43 -0
  165. package/dist/host/src/shared/types/menu.d.ts +29 -0
  166. package/dist/host/src/shared/types/mini-player.d.ts +90 -0
  167. package/dist/host/src/shared/types/ncae.d.ts +21 -0
  168. package/dist/host/src/shared/types/package-download.d.ts +6 -0
  169. package/dist/host/src/shared/types/playback-mode.d.ts +3 -0
  170. package/dist/host/src/shared/types/settings.d.ts +9 -0
  171. package/dist/host/src/shared/types/update.d.ts +6 -0
  172. package/dist/host/src/shared/util.d.ts +22 -0
  173. package/dist/index.d.ts +7 -0
  174. package/dist/preload/host/src/constants.d.ts +6 -0
  175. package/dist/preload/host/src/main/network/types.d.ts +70 -0
  176. package/dist/preload/host/src/preload/AudioEffectManager.d.ts +124 -0
  177. package/dist/preload/host/src/preload/MusicRecognizer.d.ts +25 -0
  178. package/dist/preload/host/src/preload/PlaybackBackend.d.ts +34 -0
  179. package/dist/preload/host/src/preload/Player.d.ts +221 -0
  180. package/dist/preload/host/src/preload/YunxinIM.d.ts +15 -0
  181. package/dist/preload/host/src/preload/audioplayer.d.ts +4 -0
  182. package/dist/preload/host/src/preload/av3a/Av3aPcmPlayer.d.ts +84 -0
  183. package/dist/preload/host/src/preload/av3a/bridge.d.ts +21 -0
  184. package/dist/preload/host/src/preload/av3a/channel.d.ts +40 -0
  185. package/dist/preload/host/src/preload/av3a/detect.d.ts +6 -0
  186. package/dist/preload/host/src/preload/backends/Av3aPlaybackBackend.d.ts +32 -0
  187. package/dist/preload/host/src/preload/backends/MediaPlaybackBackend.d.ts +25 -0
  188. package/dist/preload/host/src/preload/calls/app.d.ts +1 -0
  189. package/dist/preload/host/src/preload/calls/audioeffect.d.ts +1 -0
  190. package/dist/preload/host/src/preload/calls/audioplayer.d.ts +1 -0
  191. package/dist/preload/host/src/preload/calls/im.d.ts +1 -0
  192. package/dist/preload/host/src/preload/calls/index.d.ts +6 -0
  193. package/dist/preload/host/src/preload/calls/network.d.ts +1 -0
  194. package/dist/preload/host/src/preload/calls/nimsys.d.ts +1 -0
  195. package/dist/preload/host/src/preload/calls/os.d.ts +1 -0
  196. package/dist/preload/host/src/preload/calls/player.d.ts +1 -0
  197. package/dist/preload/host/src/preload/calls/update.d.ts +1 -0
  198. package/dist/preload/host/src/preload/calls.d.ts +4 -0
  199. package/dist/preload/host/src/preload/channel.d.ts +1 -0
  200. package/dist/preload/host/src/preload/playbackMode.d.ts +13 -0
  201. package/dist/preload/host/src/preload/plugin/types.d.ts +18 -0
  202. package/dist/preload/host/src/preload/util.d.ts +1 -0
  203. package/dist/preload/host/src/shared/CallDispatcher.d.ts +12 -0
  204. package/dist/preload/host/src/shared/contracts/av3a-api.d.ts +50 -0
  205. package/dist/preload/host/src/shared/contracts/av3a-process.d.ts +56 -0
  206. package/dist/preload/host/src/shared/playbackMode.d.ts +2 -0
  207. package/dist/preload/host/src/shared/plugin/registry.d.ts +32 -0
  208. package/dist/preload/host/src/shared/types/ncae.d.ts +21 -0
  209. package/dist/preload/host/src/shared/types/playback-mode.d.ts +3 -0
  210. package/dist/preload/host/src/shared/util.d.ts +22 -0
  211. package/dist/preload/index.d.ts +7 -0
  212. package/dist/preload/registry-map.d.ts +36 -0
  213. package/dist/registry-map.d.ts +145 -0
  214. package/package.json +58 -4
  215. package/README.md +0 -3
@@ -0,0 +1,29 @@
1
+ import type { MenuSurface } from "./MenuSurface";
2
+ import type { MenuSurfaceId } from "../../../shared/types/menu-surface";
3
+ /**
4
+ * The open menu surfaces, root -> leaf. Only one branch is ever open.
5
+ *
6
+ * This is separate from the menu item data tree.
7
+ */
8
+ export declare class MenuSurfacePath {
9
+ private readonly entries;
10
+ get surfaces(): readonly MenuSurface[];
11
+ get leaf(): MenuSurface | null;
12
+ get size(): number;
13
+ get(id: MenuSurfaceId): MenuSurface | undefined;
14
+ depthOf(id: MenuSurfaceId): number;
15
+ parentOf(id: MenuSurfaceId): MenuSurface | undefined;
16
+ openRoot(surface: MenuSurface): void;
17
+ /**
18
+ * Append a child for `parentId`. Everything after the parent is truncated
19
+ * first, so opening a sibling replaces the previous child path.
20
+ */
21
+ openChild(parentId: MenuSurfaceId, surface: MenuSurface): void;
22
+ /**
23
+ * Remove `id` and every descendant. Returns removed surfaces leaf-first so
24
+ * callers can close them in teardown order.
25
+ */
26
+ closeFrom(id: MenuSurfaceId): MenuSurface[];
27
+ /** Remove everything, leaf-first. */
28
+ closeAll(): MenuSurface[];
29
+ }
@@ -0,0 +1,15 @@
1
+ import type { MenuSurface, SurfaceFactory } from "./MenuSurface";
2
+ export declare class SurfacePool {
3
+ private readonly factory;
4
+ private readonly onError;
5
+ private idle;
6
+ private pending;
7
+ private lock;
8
+ private closed;
9
+ constructor(factory: SurfaceFactory, onError?: (error: unknown) => void);
10
+ acquire(): Promise<MenuSurface>;
11
+ get idleCount(): number;
12
+ close(): Promise<void>;
13
+ private refill;
14
+ private withLock;
15
+ }
@@ -0,0 +1,6 @@
1
+ export declare let workaroundFlags: number;
2
+ export declare function workaroundEnabled(workaround: WorkaroundFlags): boolean;
3
+ export declare enum WorkaroundFlags {
4
+ OverlayNoFullscreen = 1,
5
+ OverlayNoMaximize = 2
6
+ }
@@ -0,0 +1,8 @@
1
+ import { Ncae } from "../shared/types/ncae";
2
+ /**
3
+ * Decode a complete NCAE buffer.
4
+ *
5
+ * @returns An {@link Ncae} whose `payload` is a JSON **string** for
6
+ * type-1 files or a `Buffer` of RIFF/WAVE data for type-2 files.
7
+ */
8
+ export declare function decodeNcae(buf: Buffer): Promise<Ncae>;
@@ -0,0 +1,3 @@
1
+ import type { InterceptorState, NetworkFetchRequest, NetworkFetchResponse } from "./types";
2
+ export declare const DEFAULT_RETRY_COUNT = 1;
3
+ export declare function executeNetworkRequest(request: NetworkFetchRequest, state: InterceptorState): Promise<Partial<NetworkFetchResponse>>;
@@ -0,0 +1,2 @@
1
+ import { NetworkInterceptorPipeline } from "./pipeline";
2
+ export declare const networkInterceptorPipeline: NetworkInterceptorPipeline;
@@ -0,0 +1,2 @@
1
+ import type { NetworkInterceptor } from "../types";
2
+ export declare const anonymousRegisterInterceptor: NetworkInterceptor;
@@ -0,0 +1,8 @@
1
+ import { InterceptorState, NetworkExecutor, NetworkInterceptor, NetworkFetchRequest, NetworkFetchResponse } from "./types";
2
+ export declare class NetworkInterceptorPipeline {
3
+ private interceptors;
4
+ use(interceptor: NetworkInterceptor): this;
5
+ unuse(name: string): this;
6
+ list(): ReadonlyArray<NetworkInterceptor>;
7
+ run(request: NetworkFetchRequest, state: InterceptorState, executor: NetworkExecutor): Promise<NetworkFetchResponse>;
8
+ }
@@ -0,0 +1,70 @@
1
+ export interface NetworkFetchRequest {
2
+ url: string;
3
+ method: string;
4
+ headers?: Record<string, string>;
5
+ body?: string | Buffer;
6
+ isDecrypt?: boolean;
7
+ /**
8
+ * How many retries the network client may perform after the first attempt.
9
+ * `0` disables retries; omit it to use the default.
10
+ *
11
+ * The client only retries idempotent methods (GET, HEAD, …): `POST` requests
12
+ * are never retried, so this field has no effect on them.
13
+ */
14
+ retryCount?: number;
15
+ [key: string]: unknown;
16
+ }
17
+ export interface NetworkFetchResponse {
18
+ code: number;
19
+ error: string;
20
+ blob: string;
21
+ headers: Record<string, string>;
22
+ status: number;
23
+ retryTimes: number;
24
+ globalSucCount: number;
25
+ globalFailCount: number;
26
+ }
27
+ export interface GlobalStats {
28
+ globalSucCount: number;
29
+ globalFailCount: number;
30
+ }
31
+ export interface InterceptorState {
32
+ stats: GlobalStats;
33
+ tags: Record<string, unknown>;
34
+ }
35
+ export interface RequestContext {
36
+ request: NetworkFetchRequest;
37
+ state: InterceptorState;
38
+ /**
39
+ * Perform the request now, bypassing the rest of the request pipeline.
40
+ *
41
+ * The pipeline reuses the most recent execution as its response instead of
42
+ * running the request a second time, unless a `respondWith` response is set
43
+ * (a later `respondWith` overrides it). Only the last call is reused; earlier
44
+ * executions are not cancelled.
45
+ *
46
+ * Catching a rejection here does not make the request succeed: the pipeline
47
+ * still fails unless `respondWith` provides a fallback response.
48
+ */
49
+ execute(this: void, req?: NetworkFetchRequest): Promise<Partial<NetworkFetchResponse>>;
50
+ /** Respond with a synthetic response; the pipeline stops running further interceptors. */
51
+ respondWith(this: void, response: Partial<NetworkFetchResponse>): void;
52
+ }
53
+ export interface ResponseContext {
54
+ request: NetworkFetchRequest;
55
+ state: InterceptorState;
56
+ response: NetworkFetchResponse;
57
+ synthetic: boolean;
58
+ }
59
+ export interface ErrorContext {
60
+ request: NetworkFetchRequest;
61
+ state: InterceptorState;
62
+ error: unknown;
63
+ }
64
+ export interface NetworkInterceptor {
65
+ name: string;
66
+ onRequest?(ctx: RequestContext): Promise<void> | void;
67
+ onResponse?(ctx: ResponseContext): Promise<void> | void;
68
+ onError?(ctx: ErrorContext): Promise<void> | void;
69
+ }
70
+ export type NetworkExecutor = (request: NetworkFetchRequest, state: InterceptorState) => Promise<Partial<NetworkFetchResponse>>;
@@ -0,0 +1,10 @@
1
+ import { Protocol } from "electron";
2
+ type SimpleResponse = {
3
+ status?: number;
4
+ content: BodyInit;
5
+ contentType?: string;
6
+ cacheable?: boolean;
7
+ };
8
+ export declare function loadFromOrpheusUrl(url: string): Promise<SimpleResponse>;
9
+ export default function registerOrpheusScheme(protocol: Protocol): void;
10
+ export {};
@@ -0,0 +1,27 @@
1
+ import Emittery from "emittery";
2
+ import type Pack from "./packs/Pack";
3
+ export declare const NO_WEBPACK_ERROR_MESSAGE = "No usable web pack file found";
4
+ export type DownloadPackageProgress = {
5
+ step: "downloading" | "extracting" | "saving" | "completed";
6
+ downloadedBytes?: number;
7
+ totalBytes?: number;
8
+ progress?: number;
9
+ file?: string;
10
+ fileIndex?: number;
11
+ fileCount?: number;
12
+ };
13
+ export type PackManagerEvents = Record<`${string}packloaded`, {
14
+ name: string;
15
+ pack: Pack;
16
+ file?: string;
17
+ }>;
18
+ export declare class PackManager extends Emittery<PackManagerEvents> {
19
+ readonly packs: Map<string, Pack>;
20
+ loadWebPack(): Promise<void>;
21
+ loadSkinPack(name: string, name2: string): Promise<void>;
22
+ getPack<T extends Pack>(pack: string): T;
23
+ getOrWaitPack<T extends Pack>(pack: string, signal?: AbortSignal): Promise<T>;
24
+ downloadPackage(onProgress?: (progress: DownloadPackageProgress) => void, signal?: AbortSignal): Promise<void>;
25
+ }
26
+ declare const packManager: PackManager;
27
+ export default packManager;
@@ -0,0 +1,12 @@
1
+ import unzipper from "unzipper";
2
+ export default abstract class Pack {
3
+ protected path: string;
4
+ protected files: Record<string, unzipper.File>;
5
+ protected _isLoaded: boolean;
6
+ get fileList(): string[];
7
+ get isLoaded(): boolean;
8
+ constructor(path: string);
9
+ protected normalizePath(path: string): string;
10
+ abstract readPack(verify?: boolean): Promise<void>;
11
+ abstract readFile(path: string): Promise<Buffer>;
12
+ }
@@ -0,0 +1,6 @@
1
+ import Pack from "./Pack";
2
+ export default class SkinPack extends Pack {
3
+ private buffers;
4
+ readPack(verify?: boolean): Promise<void>;
5
+ readFile(path: string): Promise<Buffer>;
6
+ }
@@ -0,0 +1,6 @@
1
+ import Pack from "./Pack";
2
+ export default class WebPack extends Pack {
3
+ readPack(verify?: boolean): Promise<void>;
4
+ readFile(path: string): Promise<Buffer>;
5
+ getCommitHash(): Promise<string>;
6
+ }
@@ -0,0 +1,57 @@
1
+ import Emittery from "emittery";
2
+ import type { PlaybackMode } from "../../shared/types/playback-mode";
3
+ import { PlaybackChange, PlaybackSnapshot, PlaybackStatus, TrackInfo } from "./types";
4
+ export type PlaybackControllerEvents = {
5
+ /** Raw, unthrottled position (seconds) — lyrics / progress telemetry. */
6
+ timeupdate: number;
7
+ /** Raw rate — lyrics / progress telemetry. */
8
+ playbackratechange: number;
9
+ /** Derived: is progress advancing smoothly? (true only while playing) — lyrics. */
10
+ advancingchange: boolean;
11
+ /** Derived, diffed: track metadata changed (one playId = one song). */
12
+ trackchanged: TrackInfo | null;
13
+ /** Album art for the current song (separate from `trackchanged`). */
14
+ coverchanged: string | null;
15
+ /** Derived, diffed: media-session status changed. */
16
+ statuschanged: PlaybackStatus;
17
+ /** Derived, throttled: position for OS media sessions. */
18
+ positionchanged: {
19
+ position: number;
20
+ seeked: boolean;
21
+ };
22
+ /** Derived, diffed: duration changed. */
23
+ durationchanged: number | null;
24
+ /** Derived, diffed: rate changed. */
25
+ ratechanged: number;
26
+ /** Derived, diffed: volume changed. */
27
+ volumechanged: number;
28
+ modechanged: PlaybackMode;
29
+ };
30
+ /**
31
+ * Single source of truth for playback state in the main process.
32
+ *
33
+ * Ingested from the frozen preload/renderer seams, normalized once, then fanned
34
+ * out as two streams: raw telemetry (lyrics / progress UI) and diffed,
35
+ * throttled derived state (OS media-session adapters).
36
+ */
37
+ export default class PlaybackController extends Emittery<PlaybackControllerEvents> {
38
+ private _snapshot;
39
+ private lastPositionEmitAt;
40
+ private pendingPosition;
41
+ private positionTimer;
42
+ private cover;
43
+ get snapshot(): Readonly<PlaybackSnapshot>;
44
+ /** Frozen seam: `player.setInfo` → `mediaSession.setMetadata`. */
45
+ setTrack(track: TrackInfo | null): void;
46
+ /** Frozen seam: `player.setCover` → `mediaSession.setCover`. */
47
+ applyCover(artUrl: string | null): void;
48
+ applyPosition(position: number | null, seeked?: boolean): void;
49
+ applyDuration(duration: number | null): void;
50
+ applyPlaybackChange(change: PlaybackChange): void;
51
+ applyRate(rate: number): void;
52
+ applyVolume(volume: number): void;
53
+ applyPlaybackMode(mode: PlaybackMode): void;
54
+ private schedulePositionEmit;
55
+ private flushPosition;
56
+ private cancelPositionThrottle;
57
+ }
@@ -0,0 +1,85 @@
1
+ import Emittery from "emittery";
2
+ import { PlayerCommandEvents } from "./adapters/MediaSessionAdapter";
3
+ import type PlaybackController from "./PlaybackController";
4
+ /**
5
+ * Translates media-session commands (MPRIS / SMTC / MPNowPlayingInfo adapters)
6
+ * into the renderer-facing IPC the preload already understands.
7
+ *
8
+ * This is the only place that maps abstract commands onto the two distinct
9
+ * seek semantics the preload exposes: `player.seek` (relative delta) vs
10
+ * `player.seekto` (absolute position).
11
+ *
12
+ * Playback is the exception: the OS sends absolute intents (`play` / `pause`)
13
+ * but the renderer only exposes a *toggle*, so this router decides whether a
14
+ * toggle is warranted and tracks the toggles still in flight.
15
+ *
16
+ * Volume is the other: it is idempotent, but the media session must not report
17
+ * the old value after an OS volume change, so the command waits for the
18
+ * renderer to report the volume back before it resolves.
19
+ */
20
+ export default class PlayerCommandRouter {
21
+ private readonly player;
22
+ /**
23
+ * Status expected after each in-flight toggle lands, oldest first.
24
+ *
25
+ * A toggle is only reported back *after* it lands, so without this every
26
+ * request issued in the meantime reads the same stale snapshot — and since a
27
+ * toggle is not idempotent, an even number of them lands back where it
28
+ * started. Tracking them in order also keeps an earlier confirmation from
29
+ * being mistaken for a later toggle having landed.
30
+ */
31
+ private readonly inflight;
32
+ private expiryTimer;
33
+ private modeQueue;
34
+ /**
35
+ * @param player Playback state source, read on demand.
36
+ */
37
+ constructor(commands: Emittery<PlayerCommandEvents>, player: PlaybackController);
38
+ /** Where playback is headed once every in-flight toggle has landed. */
39
+ private get intended();
40
+ /**
41
+ * Forward an absolute OS intent as the renderer's toggle, unless playback is
42
+ * already there or already on the way.
43
+ *
44
+ * `Stopped` is a valid *source* for play, unlike for pause: a finished or
45
+ * errored song keeps its track, so an explicit play must be able to revive
46
+ * it. Pausing from `Stopped` is meaningless and must not toggle.
47
+ */
48
+ private request;
49
+ /**
50
+ * An explicit toggle is always honoured; queueing where it lands keeps
51
+ * follow-up play/pause requests idempotent until it is confirmed.
52
+ */
53
+ private toggle;
54
+ private toggleTowards;
55
+ /**
56
+ * Retire the toggle a renderer transition accounts for — or, when it matches
57
+ * none, trust the report and drop the backlog (the transition was not ours to
58
+ * explain: an out-of-band change, or several toggles landing as one).
59
+ *
60
+ * Retiring only on a *matching* transition is what keeps a queued pause alive
61
+ * while the earlier play confirms. Clearing unconditionally would forget the
62
+ * pause, and the next `pause` would fire a third toggle that cancels it.
63
+ */
64
+ private confirm;
65
+ private armExpiry;
66
+ private clearExpiry;
67
+ /**
68
+ * Forward an absolute volume to the renderer and wait for it to report that
69
+ * value back, so a caller that awaits this command (MPRIS `Set`) only returns
70
+ * once the app actually has that volume.
71
+ *
72
+ * The wait is tied to `volume`, not merely to "the next change": overlapping
73
+ * requests must not satisfy each other's confirmation. It is also bounded, so
74
+ * a request the renderer never answers fails instead of hanging.
75
+ *
76
+ * The controller suppresses an unchanged volume, so a value the renderer
77
+ * already has would never report back; neither would a message with no window
78
+ * to deliver it to. Both cases complete immediately.
79
+ */
80
+ private setVolume;
81
+ private send;
82
+ /** Serialize mode writes so each request starts from confirmed renderer state. */
83
+ private setMode;
84
+ private sendHotkey;
85
+ }
@@ -0,0 +1,61 @@
1
+ import Emittery from "emittery";
2
+ import type { LoopStatus, PlaybackMode } from "../../../shared/types/playback-mode";
3
+ import { PlaybackStatus, TrackInfo } from "../types";
4
+ /** Commands from an OS media session, normalized before hitting the renderer. */
5
+ export type PlayerCommandEvents = {
6
+ play: undefined;
7
+ pause: undefined;
8
+ toggle: undefined;
9
+ next: undefined;
10
+ previous: undefined;
11
+ /** Relative seek, seconds (signed). */
12
+ seek: number;
13
+ /** Absolute seek, seconds. */
14
+ setPosition: number;
15
+ /** Volume, 0..1. */
16
+ volume: number;
17
+ shuffle: boolean;
18
+ loopStatus: LoopStatus;
19
+ raise: undefined;
20
+ quit: undefined;
21
+ };
22
+ /**
23
+ * Platform media-session integration (MPRIS / SMTC / MPNowPlayingInfo).
24
+ *
25
+ * The `PlaybackController` pushes derived state (in seconds / plain values); the
26
+ * adapter translates to its platform's native calls and owns all unit
27
+ * conversion. Commands coming *from* the OS are re-emitted here and forwarded
28
+ * to the renderer by the `PlayerCommandRouter`.
29
+ */
30
+ export interface MediaSessionAdapter extends Emittery<PlayerCommandEvents> {
31
+ onTrack(track: TrackInfo | null): void;
32
+ /** Album art for the current song. */
33
+ onArtwork(artUrl: string | null): void;
34
+ onStatus(status: PlaybackStatus): void;
35
+ /**
36
+ * Whether playback progress is currently advancing. `status` stays
37
+ * `Playing` during a buffering stall, so MPRIS uses this separately to
38
+ * freeze/resume its interpolated position clock.
39
+ */
40
+ onAdvancing(advancing: boolean): void;
41
+ /** Seconds. `seeked` is true when the position changed discontinuously. */
42
+ onPosition(position: number, seeked: boolean): void;
43
+ /** Seconds, or null when unknown. */
44
+ onDuration(duration: number | null): void;
45
+ onRate(rate: number): void;
46
+ onVolume(volume: number): void;
47
+ onPlaybackMode?(mode: PlaybackMode): void;
48
+ dispose(): void;
49
+ }
50
+ /** Platform without media-session support. */
51
+ export declare class NoopAdapter extends Emittery<PlayerCommandEvents> implements MediaSessionAdapter {
52
+ onTrack(): void;
53
+ onArtwork(): void;
54
+ onStatus(): void;
55
+ onAdvancing(): void;
56
+ onPosition(): void;
57
+ onDuration(): void;
58
+ onRate(): void;
59
+ onVolume(): void;
60
+ dispose(): void;
61
+ }
@@ -0,0 +1,48 @@
1
+ import Emittery from "emittery";
2
+ import type { PlaybackMode } from "../../../shared/types/playback-mode";
3
+ import { PlaybackStatus, TrackInfo } from "../types";
4
+ import { MediaSessionAdapter, PlayerCommandEvents } from "./MediaSessionAdapter";
5
+ /** Linux MPRIS integration, backed by the `@open-orpheus/dbus` zbus module. */
6
+ export default class MprisAdapter extends Emittery<PlayerCommandEvents> implements MediaSessionAdapter {
7
+ private mediaSession;
8
+ private metadata;
9
+ private artUrl;
10
+ private status;
11
+ private position;
12
+ private duration;
13
+ private rate;
14
+ /**
15
+ * Whether the position clock is running. Kept separate from `status`
16
+ * because a buffering stall keeps MPRIS `PlaybackStatus` as `Playing`
17
+ * while the position must stand still.
18
+ */
19
+ private advancing;
20
+ /**
21
+ * The most recent MPRIS volume write, keyed by the value it was for. The
22
+ * native write is asynchronous, so `SetVolume` awaits the write for *its*
23
+ * value once the renderer has confirmed that value — a write triggered by
24
+ * some other (concurrent or in-app) change must not be mistaken for it.
25
+ */
26
+ private volumeApplied;
27
+ private modeApplied;
28
+ constructor();
29
+ onTrack(track: TrackInfo | null): void;
30
+ onStatus(status: PlaybackStatus): void;
31
+ onAdvancing(advancing: boolean): void;
32
+ onPosition(position: number, seeked: boolean): void;
33
+ onDuration(duration: number | null): void;
34
+ onRate(rate: number): void;
35
+ onVolume(volume: number): void;
36
+ onPlaybackMode(mode: PlaybackMode): void;
37
+ dispose(): void;
38
+ private pushMetadata;
39
+ /**
40
+ * Album art for the current song (`player.setCover`). The URL is already
41
+ * resolved to something the OS can consume: a local `file://` (embedded art
42
+ * of local music) or a remote http(s) URL.
43
+ */
44
+ onArtwork(artUrl: string | null): void;
45
+ private refreshArtwork;
46
+ private cacheArtworkLocally;
47
+ private pushPlaybackState;
48
+ }
@@ -0,0 +1,23 @@
1
+ import Emittery from "emittery";
2
+ import { PlaybackStatus, TrackInfo } from "../types";
3
+ import { MediaSessionAdapter, PlayerCommandEvents } from "./MediaSessionAdapter";
4
+ /** macOS Now Playing integration, backed by the `@open-orpheus/nowplaying` module. */
5
+ export default class NowPlayingAdapter extends Emittery<PlayerCommandEvents> implements MediaSessionAdapter {
6
+ private mediaSession;
7
+ private track;
8
+ private artUrl;
9
+ private position;
10
+ private duration;
11
+ private rate;
12
+ constructor();
13
+ onTrack(track: TrackInfo | null): void;
14
+ onArtwork(artUrl: string | null): void;
15
+ onStatus(status: PlaybackStatus): void;
16
+ onAdvancing(): void;
17
+ onPosition(position: number): void;
18
+ onDuration(duration: number | null): void;
19
+ onRate(rate: number): void;
20
+ onVolume(): void;
21
+ dispose(): void;
22
+ private pushMetadata;
23
+ }
@@ -0,0 +1,23 @@
1
+ import Emittery from "emittery";
2
+ import { PlaybackStatus, TrackInfo } from "../types";
3
+ import { MediaSessionAdapter, PlayerCommandEvents } from "./MediaSessionAdapter";
4
+ /** Windows SMTC integration, backed by the `@open-orpheus/system-win32` NAPI module. */
5
+ export default class SmtcAdapter extends Emittery<PlayerCommandEvents> implements MediaSessionAdapter {
6
+ private mediaSession;
7
+ private track;
8
+ private artUrl;
9
+ private position;
10
+ private duration;
11
+ constructor();
12
+ onTrack(track: TrackInfo | null): void;
13
+ onArtwork(artUrl: string | null): void;
14
+ private pushMetadata;
15
+ onStatus(status: PlaybackStatus): void;
16
+ onAdvancing(): void;
17
+ onPosition(position: number): void;
18
+ onDuration(duration: number | null): void;
19
+ onRate(rate: number): void;
20
+ onVolume(): void;
21
+ dispose(): void;
22
+ private pushTimeline;
23
+ }
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Album-art handling shared by the media-session integrations (MPRIS / SMTC /
3
+ * Now Playing).
4
+ *
5
+ * The renderer reports album art per song through `player.setCover`. Online
6
+ * tracks give a remote http(s) URL; local tracks give an
7
+ * `orpheus://localmusic/pic?<path>` URL pointing at the app's embedded-art
8
+ * endpoint. OS media sessions cannot load `orpheus://` URLs, so local covers
9
+ * are extracted and cached as a local image file; the resulting `file://` URL
10
+ * is what flows to the adapters.
11
+ */
12
+ /** Directory where resolved album art is cached as plain image files. */
13
+ export declare const ART_CACHE_DIR: string;
14
+ /** Absolute path of the cached artwork file for a track. */
15
+ export declare function artworkCachePath(id: string, ext: string): string;
16
+ /** `file://` URL of the cached artwork file for a track. */
17
+ export declare function artworkFileUrl(id: string, ext: string): string;
18
+ /** Whether the artwork for a track is already cached. */
19
+ export declare function artworkFileExists(id: string, ext: string): Promise<boolean>;
20
+ /** Extension (with dot) derived from a remote artwork URL, defaulting to `.jpg`. */
21
+ export declare function remoteArtExt(url: string): string;
22
+ /**
23
+ * Write bytes into the album-art cache and return the `file://` URL. No-op
24
+ * (returns the URL) when the file is already present.
25
+ */
26
+ export declare function cacheArtwork(id: string, data: Uint8Array, ext: string): Promise<string>;
27
+ /**
28
+ * Extract the embedded album picture behind an `orpheus://localmusic/pic?<path>`
29
+ * cover URL and cache it as a local file. Returns a `file://` URL, or null when
30
+ * the URL isn't one of ours or the file has no usable embedded picture.
31
+ */
32
+ export declare function resolveEmbeddedArtwork(rawUrl: string, trackId: string): Promise<string | null>;
33
+ /**
34
+ * Resolve a raw cover URL (from `player.setCover`) into a URL the OS media
35
+ * sessions can consume:
36
+ * - http(s) / file URLs pass through unchanged;
37
+ * - `orpheus://localmusic/pic?<path>` covers are extracted to a local `file://`
38
+ * file;
39
+ * - anything else resolves to "" (no art).
40
+ */
41
+ export declare function resolveCoverUrl(rawUrl: string | null, trackId: string): Promise<string>;
42
+ /**
43
+ * A URL suitable for a native media session (SMTC / Now Playing). Remote
44
+ * http(s) covers are requested as a small square; already-local art and other
45
+ * URLs pass through unchanged.
46
+ */
47
+ export declare function nativeArtUrl(url: string): string;
@@ -0,0 +1,8 @@
1
+ import type { LoopStatus, PlaybackMode } from "../../shared/types/playback-mode";
2
+ export declare function mprisPlaybackMode(mode: PlaybackMode): {
3
+ loopStatus: LoopStatus;
4
+ shuffle: boolean;
5
+ };
6
+ /** Orpheus has one mutually exclusive mode; report its actual combination. */
7
+ export declare function modeForLoopStatus(mode: PlaybackMode, loopStatus: LoopStatus): PlaybackMode;
8
+ export declare function modeForShuffle(mode: PlaybackMode, shuffle: boolean): PlaybackMode;
@@ -0,0 +1,39 @@
1
+ import type { PlaybackMode } from "../../shared/types/playback-mode";
2
+ /** Real playback state, as reported to OS media-session integrations. */
3
+ export declare enum PlaybackStatus {
4
+ Playing = "playing",
5
+ Paused = "paused",
6
+ Stopped = "stopped"
7
+ }
8
+ /**
9
+ * A single playback transition emitted by the preload (`player.playbackchange`).
10
+ * The controller derives both the media-session status and the lyrics
11
+ * "is progress advancing smoothly?" boolean from these.
12
+ */
13
+ export declare enum PlaybackChange {
14
+ Playing = "playing",
15
+ Paused = "paused",
16
+ Stopped = "stopped",
17
+ Stalled = "stalled",
18
+ Seeking = "seeking"
19
+ }
20
+ /** Track metadata. */
21
+ export interface TrackInfo {
22
+ id: string;
23
+ title: string;
24
+ artist: string;
25
+ album: string;
26
+ }
27
+ /**
28
+ * Single source of truth for playback state, in seconds / plain values.
29
+ * OS media-session adapters own any unit conversion (µs, ticks, …).
30
+ */
31
+ export interface PlaybackSnapshot {
32
+ track: TrackInfo | null;
33
+ status: PlaybackStatus;
34
+ position: number | null;
35
+ duration: number | null;
36
+ rate: number;
37
+ volume: number;
38
+ playbackMode: PlaybackMode | null;
39
+ }
@@ -0,0 +1,36 @@
1
+ import { PluginKind } from "../../shared/contracts/plugin-manager-api";
2
+ import { type PluginMetadata } from "./metadata";
3
+ import { type PluginTree } from "./tree";
4
+ /** A directory to scan for plugins, and the kind assigned to its children. */
5
+ export interface PluginLocation {
6
+ dir: string;
7
+ kind: PluginKind;
8
+ }
9
+ /** A discovered plugin source path and its kind. */
10
+ export interface PluginSource {
11
+ source: string;
12
+ kind: PluginKind;
13
+ }
14
+ /** A plugin tree that has metadata but whose main module has not been imported. */
15
+ export interface DiscoveredPlugin {
16
+ metadata: PluginMetadata;
17
+ /** Original directory or asar path. */
18
+ source: string;
19
+ /** Whether this plugin ships with the app or was installed by the user. */
20
+ kind: PluginKind;
21
+ /** Absolute paths to each declared realm's entry. */
22
+ entryPaths: {
23
+ main: string;
24
+ preload?: string;
25
+ };
26
+ tree: PluginTree;
27
+ }
28
+ /**
29
+ * List plugin sources in the given locations.
30
+ *
31
+ * A source is an immediate child directory or a `*.asar` file. Hidden entries
32
+ * are skipped.
33
+ */
34
+ export declare function discoverPluginSources(locations: PluginLocation[]): Promise<PluginSource[]>;
35
+ /** Open a source, validate its metadata, and resolve the main entry. */
36
+ export declare function loadDiscoveredPlugin(source: string, kind?: PluginKind): Promise<DiscoveredPlugin>;