@open-orpheus/plugin-api 0.0.0-stage → 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 (269) hide show
  1. package/LICENSE +7 -0
  2. package/README.md +191 -2
  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__database.d.ts +50 -0
  9. package/dist/host/_native/open-orpheus__window.d.ts +284 -0
  10. package/dist/host/src/constants.d.ts +6 -0
  11. package/dist/host/src/main/afp.d.ts +1 -0
  12. package/dist/host/src/main/arguments.d.ts +4 -0
  13. package/dist/host/src/main/assets.d.ts +2 -0
  14. package/dist/host/src/main/audio/ChunkTracker.d.ts +23 -0
  15. package/dist/host/src/main/audio/DownloadScheduler.d.ts +53 -0
  16. package/dist/host/src/main/audio/MediaEngine.d.ts +47 -0
  17. package/dist/host/src/main/audio/OnlineStreamer.d.ts +66 -0
  18. package/dist/host/src/main/audio/StorageManager.d.ts +18 -0
  19. package/dist/host/src/main/audio.d.ts +6 -0
  20. package/dist/host/src/main/av3a/Av3aEngine.d.ts +24 -0
  21. package/dist/host/src/main/av3a/Av3aM4aSession.d.ts +101 -0
  22. package/dist/host/src/main/av3a/Av3aPlaybackProcess.d.ts +52 -0
  23. package/dist/host/src/main/av3a/detect.d.ts +6 -0
  24. package/dist/host/src/main/av3a/sources.d.ts +13 -0
  25. package/dist/host/src/main/av3a/types.d.ts +54 -0
  26. package/dist/host/src/main/bridge/ipc-main-bridge.d.ts +24 -0
  27. package/dist/host/src/main/bridge/modules/inputRegion.d.ts +1 -0
  28. package/dist/host/src/main/bridge/modules/lyrics.d.ts +1 -0
  29. package/dist/host/src/main/bridge/modules/settings.d.ts +1 -0
  30. package/dist/host/src/main/bridge/register.d.ts +9 -0
  31. package/dist/host/src/main/bridge/window.d.ts +7 -0
  32. package/dist/host/src/main/cache/HttpCacheStorage.d.ts +10 -0
  33. package/dist/host/src/main/cache/LyricCahceManager.d.ts +21 -0
  34. package/dist/host/src/main/cache/PlayCacheManager.d.ts +72 -0
  35. package/dist/host/src/main/cache.d.ts +7 -0
  36. package/dist/host/src/main/calls/app.d.ts +1 -0
  37. package/dist/host/src/main/calls/audioeffect.d.ts +1 -0
  38. package/dist/host/src/main/calls/browser.d.ts +1 -0
  39. package/dist/host/src/main/calls/desktop.d.ts +2 -0
  40. package/dist/host/src/main/calls/desktoppet.d.ts +1 -0
  41. package/dist/host/src/main/calls/download.d.ts +1 -0
  42. package/dist/host/src/main/calls/index.d.ts +16 -0
  43. package/dist/host/src/main/calls/musiclibrary.d.ts +1 -0
  44. package/dist/host/src/main/calls/network.d.ts +1 -0
  45. package/dist/host/src/main/calls/os.d.ts +1 -0
  46. package/dist/host/src/main/calls/player.d.ts +22 -0
  47. package/dist/host/src/main/calls/process.d.ts +1 -0
  48. package/dist/host/src/main/calls/rtc.d.ts +1 -0
  49. package/dist/host/src/main/calls/storage.d.ts +1 -0
  50. package/dist/host/src/main/calls/trayicon.d.ts +1 -0
  51. package/dist/host/src/main/calls/update.d.ts +1 -0
  52. package/dist/host/src/main/calls/winhelper.d.ts +1 -0
  53. package/dist/host/src/main/calls.d.ts +5 -0
  54. package/dist/host/src/main/channel.d.ts +1 -0
  55. package/dist/host/src/main/cookie.d.ts +13 -0
  56. package/dist/host/src/main/crypto.d.ts +46 -0
  57. package/dist/host/src/main/database/KeyvSqliteDriver.d.ts +6 -0
  58. package/dist/host/src/main/database.d.ts +5 -0
  59. package/dist/host/src/main/dawn.d.ts +31 -0
  60. package/dist/host/src/main/device.d.ts +3 -0
  61. package/dist/host/src/main/download.d.ts +40 -0
  62. package/dist/host/src/main/error.d.ts +1 -0
  63. package/dist/host/src/main/folders.d.ts +18 -0
  64. package/dist/host/src/main/fonts.d.ts +1 -0
  65. package/dist/host/src/main/gui.d.ts +4 -0
  66. package/dist/host/src/main/id3.d.ts +42 -0
  67. package/dist/host/src/main/lifecycle.d.ts +127 -0
  68. package/dist/host/src/main/logger.d.ts +12 -0
  69. package/dist/host/src/main/lyrics/DbusLyricsService.d.ts +115 -0
  70. package/dist/host/src/main/lyrics/LyricsDispatcher.d.ts +26 -0
  71. package/dist/host/src/main/lyrics/dbus.d.ts +16 -0
  72. package/dist/host/src/main/lyrics/parse.d.ts +21 -0
  73. package/dist/host/src/main/lyrics.d.ts +2 -0
  74. package/dist/host/src/main/mediaSession.d.ts +42 -0
  75. package/dist/host/src/main/menu/AppMenu.d.ts +35 -0
  76. package/dist/host/src/main/menu/anchor.d.ts +13 -0
  77. package/dist/host/src/main/menu/backend/DesktopWindowBackend.d.ts +30 -0
  78. package/dist/host/src/main/menu/backend/MenuBackend.d.ts +28 -0
  79. package/dist/host/src/main/menu/backend/WaylandLayerShellBackend.d.ts +35 -0
  80. package/dist/host/src/main/menu/backend/WaylandOverlayBackend.d.ts +15 -0
  81. package/dist/host/src/main/menu/backend/WaylandPopupBackend.d.ts +31 -0
  82. package/dist/host/src/main/menu/constants.d.ts +14 -0
  83. package/dist/host/src/main/menu/index.d.ts +2 -0
  84. package/dist/host/src/main/menu/native-popup.d.ts +16 -0
  85. package/dist/host/src/main/menu/patch.d.ts +3 -0
  86. package/dist/host/src/main/menu/skin.d.ts +3 -0
  87. package/dist/host/src/main/menu/surface/BaseWindowMenuSurface.d.ts +81 -0
  88. package/dist/host/src/main/menu/surface/CaptureLayerSurface.d.ts +22 -0
  89. package/dist/host/src/main/menu/surface/MenuSurface.d.ts +29 -0
  90. package/dist/host/src/main/menu/surface/MenuSurfacePath.d.ts +29 -0
  91. package/dist/host/src/main/menu/surface/SurfacePool.d.ts +15 -0
  92. package/dist/host/src/main/menu/workaround.d.ts +12 -0
  93. package/dist/host/src/main/ncae.d.ts +8 -0
  94. package/dist/host/src/main/network/handler.d.ts +3 -0
  95. package/dist/host/src/main/network/interceptor.d.ts +2 -0
  96. package/dist/host/src/main/network/interceptors/anonymous.d.ts +2 -0
  97. package/dist/host/src/main/network/pipeline.d.ts +8 -0
  98. package/dist/host/src/main/network/types.d.ts +70 -0
  99. package/dist/host/src/main/orpheus.d.ts +10 -0
  100. package/dist/host/src/main/pack.d.ts +27 -0
  101. package/dist/host/src/main/packs/Pack.d.ts +12 -0
  102. package/dist/host/src/main/packs/SkinPack.d.ts +6 -0
  103. package/dist/host/src/main/packs/WebPack.d.ts +6 -0
  104. package/dist/host/src/main/playback/PlaybackController.d.ts +57 -0
  105. package/dist/host/src/main/playback/PlayerCommandRouter.d.ts +85 -0
  106. package/dist/host/src/main/playback/adapters/MediaSessionAdapter.d.ts +61 -0
  107. package/dist/host/src/main/playback/adapters/MprisAdapter.d.ts +48 -0
  108. package/dist/host/src/main/playback/adapters/NowPlayingAdapter.d.ts +23 -0
  109. package/dist/host/src/main/playback/adapters/SmtcAdapter.d.ts +23 -0
  110. package/dist/host/src/main/playback/artwork.d.ts +47 -0
  111. package/dist/host/src/main/playback/modes.d.ts +8 -0
  112. package/dist/host/src/main/playback/types.d.ts +59 -0
  113. package/dist/host/src/main/plugin/assets.d.ts +8 -0
  114. package/dist/host/src/main/plugin/catalog.d.ts +42 -0
  115. package/dist/host/src/main/plugin/discover.d.ts +33 -0
  116. package/dist/host/src/main/plugin/index.d.ts +15 -0
  117. package/dist/host/src/main/plugin/loader.d.ts +90 -0
  118. package/dist/host/src/main/plugin/manager.d.ts +61 -0
  119. package/dist/host/src/main/plugin/metadata.d.ts +34 -0
  120. package/dist/host/src/main/plugin/state.d.ts +27 -0
  121. package/dist/host/src/main/plugin/tree.d.ts +13 -0
  122. package/dist/host/src/main/protocol.d.ts +4 -0
  123. package/dist/host/src/main/request.d.ts +16 -0
  124. package/dist/host/src/main/settings.d.ts +21 -0
  125. package/dist/host/src/main/shortcuts.d.ts +10 -0
  126. package/dist/host/src/main/shutdown.d.ts +50 -0
  127. package/dist/host/src/main/skin/color.d.ts +2 -0
  128. package/dist/host/src/main/skin/dui.d.ts +15 -0
  129. package/dist/host/src/main/tray.d.ts +8 -0
  130. package/dist/host/src/main/update.d.ts +2 -0
  131. package/dist/host/src/main/util/color.d.ts +7 -0
  132. package/dist/host/src/main/util/display.d.ts +3 -0
  133. package/dist/host/src/main/util/env.d.ts +1 -0
  134. package/dist/host/src/main/util/fs.d.ts +21 -0
  135. package/dist/host/src/main/util/image.d.ts +1 -0
  136. package/dist/host/src/main/util/musicFile.d.ts +1 -0
  137. package/dist/host/src/main/util/musicPicture.d.ts +2 -0
  138. package/dist/host/src/main/util/path.d.ts +2 -0
  139. package/dist/host/src/main/util/send.d.ts +13 -0
  140. package/dist/host/src/main/util/url.d.ts +19 -0
  141. package/dist/host/src/main/util/window.d.ts +2 -0
  142. package/dist/host/src/main/window.d.ts +316 -0
  143. package/dist/host/src/main/windows/color-picker.d.ts +3 -0
  144. package/dist/host/src/main/windows/desktop-lyrics.d.ts +12 -0
  145. package/dist/host/src/main/windows/desktop-pet.d.ts +8 -0
  146. package/dist/host/src/main/windows/main.d.ts +6 -0
  147. package/dist/host/src/main/windows/manage.d.ts +2 -0
  148. package/dist/host/src/main/windows/mini-player.d.ts +16 -0
  149. package/dist/host/src/main/windows/music-desktop.d.ts +13 -0
  150. package/dist/host/src/main/windows/package-download.d.ts +2 -0
  151. package/dist/host/src/main/windows/plugin-manager-events.d.ts +7 -0
  152. package/dist/host/src/main/windows/plugin-manager.d.ts +5 -0
  153. package/dist/host/src/main/xeapi.d.ts +48 -0
  154. package/dist/host/src/preload/AudioEffectManager.d.ts +124 -0
  155. package/dist/host/src/preload/PlaybackBackend.d.ts +34 -0
  156. package/dist/host/src/preload/Player.d.ts +229 -0
  157. package/dist/host/src/preload/av3a/Av3aPcmPlayer.d.ts +84 -0
  158. package/dist/host/src/preload/av3a/bridge.d.ts +21 -0
  159. package/dist/host/src/preload/av3a/channel.d.ts +40 -0
  160. package/dist/host/src/preload/av3a/detect.d.ts +6 -0
  161. package/dist/host/src/preload/backends/Av3aPlaybackBackend.d.ts +32 -0
  162. package/dist/host/src/preload/backends/MediaPlaybackBackend.d.ts +25 -0
  163. package/dist/host/src/shared/CallDispatcher.d.ts +12 -0
  164. package/dist/host/src/shared/bridge/constants.d.ts +2 -0
  165. package/dist/host/src/shared/bridge/endpoint.d.ts +29 -0
  166. package/dist/host/src/shared/bridge/hub.d.ts +136 -0
  167. package/dist/host/src/shared/bridge/protocol.d.ts +91 -0
  168. package/dist/host/src/shared/bridge/realm.d.ts +14 -0
  169. package/dist/host/src/shared/bridge/routes.d.ts +37 -0
  170. package/dist/host/src/shared/contracts/av3a-api.d.ts +50 -0
  171. package/dist/host/src/shared/contracts/av3a-process.d.ts +56 -0
  172. package/dist/host/src/shared/contracts/color-picker-api.d.ts +17 -0
  173. package/dist/host/src/shared/contracts/desktop-lyrics-api.d.ts +22 -0
  174. package/dist/host/src/shared/contracts/input-region-api.d.ts +5 -0
  175. package/dist/host/src/shared/contracts/lyrics-api.d.ts +11 -0
  176. package/dist/host/src/shared/contracts/manage-api.d.ts +31 -0
  177. package/dist/host/src/shared/contracts/menu-surface-api.d.ts +35 -0
  178. package/dist/host/src/shared/contracts/mini-player-api.d.ts +19 -0
  179. package/dist/host/src/shared/contracts/plugin-manager-api.d.ts +223 -0
  180. package/dist/host/src/shared/contracts/settings-api.d.ts +15 -0
  181. package/dist/host/src/shared/playbackMode.d.ts +2 -0
  182. package/dist/host/src/shared/plugin/cache-bust.d.ts +8 -0
  183. package/dist/host/src/shared/plugin/lifecycle.d.ts +217 -0
  184. package/dist/host/src/shared/plugin/realms/main/index.d.ts +18 -0
  185. package/dist/host/src/shared/plugin/registry.d.ts +69 -0
  186. package/dist/host/src/shared/plugin/runtime-state.d.ts +4 -0
  187. package/dist/host/src/shared/settings/defaults.d.ts +35 -0
  188. package/dist/host/src/shared/settings/index.d.ts +3 -0
  189. package/dist/host/src/shared/settings/keys.d.ts +21 -0
  190. package/dist/host/src/shared/settings/values.d.ts +13 -0
  191. package/dist/host/src/shared/types/desktop-lyrics.d.ts +61 -0
  192. package/dist/host/src/shared/types/dui.d.ts +37 -0
  193. package/dist/host/src/shared/types/input-region.d.ts +6 -0
  194. package/dist/host/src/shared/types/lyrics.d.ts +15 -0
  195. package/dist/host/src/shared/types/manage.d.ts +14 -0
  196. package/dist/host/src/shared/types/menu-surface.d.ts +43 -0
  197. package/dist/host/src/shared/types/menu.d.ts +29 -0
  198. package/dist/host/src/shared/types/mini-player.d.ts +97 -0
  199. package/dist/host/src/shared/types/ncae.d.ts +29 -0
  200. package/dist/host/src/shared/types/package-download.d.ts +14 -0
  201. package/dist/host/src/shared/types/playback-mode.d.ts +3 -0
  202. package/dist/host/src/shared/types/settings.d.ts +9 -0
  203. package/dist/host/src/shared/types/update.d.ts +6 -0
  204. package/dist/host/src/shared/util.d.ts +22 -0
  205. package/dist/index.d.ts +7 -0
  206. package/dist/plugin-manager/host/src/preload/logger.d.ts +10 -0
  207. package/dist/plugin-manager/host/src/preload/util.d.ts +1 -0
  208. package/dist/plugin-manager/host/src/shared/bridge/constants.d.ts +2 -0
  209. package/dist/plugin-manager/host/src/shared/bridge/endpoint.d.ts +29 -0
  210. package/dist/plugin-manager/host/src/shared/bridge/hub.d.ts +136 -0
  211. package/dist/plugin-manager/host/src/shared/bridge/protocol.d.ts +91 -0
  212. package/dist/plugin-manager/host/src/shared/bridge/routes.d.ts +37 -0
  213. package/dist/plugin-manager/host/src/shared/contracts/plugin-manager-api.d.ts +223 -0
  214. package/dist/plugin-manager/host/src/shared/plugin/lifecycle.d.ts +217 -0
  215. package/dist/plugin-manager/host/src/shared/plugin/realms/common/index.d.ts +34 -0
  216. package/dist/plugin-manager/host/src/shared/plugin/realms/plugin-manager/index.d.ts +11 -0
  217. package/dist/plugin-manager/host/src/shared/plugin/registry.d.ts +69 -0
  218. package/dist/plugin-manager/host/src/shared/util.d.ts +22 -0
  219. package/dist/plugin-manager/index.d.ts +7 -0
  220. package/dist/plugin-manager/registry-map.d.ts +16 -0
  221. package/dist/preload/host/src/constants.d.ts +6 -0
  222. package/dist/preload/host/src/main/network/types.d.ts +70 -0
  223. package/dist/preload/host/src/preload/AudioEffectManager.d.ts +124 -0
  224. package/dist/preload/host/src/preload/MusicRecognizer.d.ts +25 -0
  225. package/dist/preload/host/src/preload/PlaybackBackend.d.ts +34 -0
  226. package/dist/preload/host/src/preload/Player.d.ts +229 -0
  227. package/dist/preload/host/src/preload/YunxinIM.d.ts +15 -0
  228. package/dist/preload/host/src/preload/audioplayer.d.ts +4 -0
  229. package/dist/preload/host/src/preload/av3a/Av3aPcmPlayer.d.ts +84 -0
  230. package/dist/preload/host/src/preload/av3a/bridge.d.ts +21 -0
  231. package/dist/preload/host/src/preload/av3a/channel.d.ts +40 -0
  232. package/dist/preload/host/src/preload/av3a/detect.d.ts +6 -0
  233. package/dist/preload/host/src/preload/backends/Av3aPlaybackBackend.d.ts +32 -0
  234. package/dist/preload/host/src/preload/backends/MediaPlaybackBackend.d.ts +25 -0
  235. package/dist/preload/host/src/preload/calls/app.d.ts +1 -0
  236. package/dist/preload/host/src/preload/calls/audioeffect.d.ts +1 -0
  237. package/dist/preload/host/src/preload/calls/audioplayer.d.ts +1 -0
  238. package/dist/preload/host/src/preload/calls/im.d.ts +1 -0
  239. package/dist/preload/host/src/preload/calls/index.d.ts +6 -0
  240. package/dist/preload/host/src/preload/calls/network.d.ts +1 -0
  241. package/dist/preload/host/src/preload/calls/nimsys.d.ts +1 -0
  242. package/dist/preload/host/src/preload/calls/os.d.ts +1 -0
  243. package/dist/preload/host/src/preload/calls/player.d.ts +1 -0
  244. package/dist/preload/host/src/preload/calls/update.d.ts +1 -0
  245. package/dist/preload/host/src/preload/calls.d.ts +4 -0
  246. package/dist/preload/host/src/preload/channel.d.ts +1 -0
  247. package/dist/preload/host/src/preload/logger.d.ts +10 -0
  248. package/dist/preload/host/src/preload/playbackMode.d.ts +13 -0
  249. package/dist/preload/host/src/preload/util.d.ts +1 -0
  250. package/dist/preload/host/src/shared/CallDispatcher.d.ts +12 -0
  251. package/dist/preload/host/src/shared/bridge/endpoint.d.ts +29 -0
  252. package/dist/preload/host/src/shared/bridge/hub.d.ts +136 -0
  253. package/dist/preload/host/src/shared/bridge/protocol.d.ts +91 -0
  254. package/dist/preload/host/src/shared/bridge/routes.d.ts +37 -0
  255. package/dist/preload/host/src/shared/contracts/av3a-api.d.ts +50 -0
  256. package/dist/preload/host/src/shared/contracts/av3a-process.d.ts +56 -0
  257. package/dist/preload/host/src/shared/contracts/plugin-manager-api.d.ts +223 -0
  258. package/dist/preload/host/src/shared/playbackMode.d.ts +2 -0
  259. package/dist/preload/host/src/shared/plugin/lifecycle.d.ts +217 -0
  260. package/dist/preload/host/src/shared/plugin/realms/common/index.d.ts +34 -0
  261. package/dist/preload/host/src/shared/plugin/realms/preload/index.d.ts +11 -0
  262. package/dist/preload/host/src/shared/plugin/registry.d.ts +69 -0
  263. package/dist/preload/host/src/shared/types/ncae.d.ts +29 -0
  264. package/dist/preload/host/src/shared/types/playback-mode.d.ts +3 -0
  265. package/dist/preload/host/src/shared/util.d.ts +22 -0
  266. package/dist/preload/index.d.ts +7 -0
  267. package/dist/preload/registry-map.d.ts +43 -0
  268. package/dist/registry-map.d.ts +164 -0
  269. package/package.json +73 -3
@@ -0,0 +1,61 @@
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
+ */
21
+ export declare class PluginManager {
22
+ private readonly loader;
23
+ private readonly state;
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);
35
+ list(): PluginManagerState;
36
+ setEnabled(id: string, enabled: boolean): Promise<PluginManagerState>;
37
+ retry(id: string): Promise<PluginManagerState>;
38
+ /** Whether the plugin should be activated (used for the preload manifest). */
39
+ isEnabled(id: string): boolean;
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;
61
+ }
@@ -0,0 +1,34 @@
1
+ import { z } from "zod";
2
+ declare function createMetadataSchema(base: string): z.ZodObject<{
3
+ id: z.ZodString;
4
+ name: z.ZodString;
5
+ version: z.ZodString;
6
+ description: z.ZodOptional<z.ZodString>;
7
+ author: z.ZodOptional<z.ZodString>;
8
+ homepage: z.ZodOptional<z.ZodString>;
9
+ license: z.ZodOptional<z.ZodString>;
10
+ icon: z.ZodOptional<z.ZodString>;
11
+ configuration: z.ZodOptional<z.ZodString>;
12
+ realms: z.ZodObject<{
13
+ [x: string]: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
14
+ }, z.core.$strip>;
15
+ builtin: z.ZodOptional<z.ZodObject<{
16
+ defaultEnabled: z.ZodOptional<z.ZodBoolean>;
17
+ }, z.core.$strip>>;
18
+ }, z.core.$strip>;
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
+ };
27
+ /**
28
+ * Validate a parsed `metadata.json`.
29
+ *
30
+ * Unknown fields are ignored. The error message names the plugin source and
31
+ * lists every failing field.
32
+ */
33
+ export declare function parsePluginMetadata(raw: unknown, source: string): PluginMetadata;
34
+ export {};
@@ -0,0 +1,27 @@
1
+ import type { PluginDesiredState } from "../../shared/contracts/plugin-manager-api.js";
2
+ import { PluginKind } from "../../shared/contracts/plugin-manager-api.js";
3
+ export interface PluginStateStore {
4
+ /** Effective desired state for a plugin, including built-in defaults. */
5
+ desired(id: string, kind: PluginKind): PluginDesiredState;
6
+ isEnabled(id: string, kind: PluginKind): boolean;
7
+ /** Commit an explicit intent change and return the committed revision. */
8
+ setEnabled(id: string, kind: PluginKind, enabled: boolean): Promise<PluginDesiredState>;
9
+ }
10
+ /**
11
+ * Persisted desired state.
12
+ *
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.
16
+ */
17
+ export declare class PluginState implements PluginStateStore {
18
+ private overrides;
19
+ private defaults;
20
+ private pendingWrite;
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;
25
+ isEnabled(id: string, kind: PluginKind): boolean;
26
+ setEnabled(id: string, kind: PluginKind, enabled: boolean): Promise<PluginDesiredState>;
27
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * A plugin tree is a directory on disk or an `.asar` archive.
3
+ *
4
+ * Electron's `fs` and ESM loader treat an asar as a virtual directory, so both
5
+ * are read in place: there is no extraction, cache, or materialization step.
6
+ */
7
+ export interface PluginTree {
8
+ /** The original source (directory or asar path). */
9
+ readonly source: string;
10
+ has(relativePath: string): Promise<boolean>;
11
+ readFile(relativePath: string): Promise<Buffer>;
12
+ }
13
+ export declare function openPluginTree(source: string): Promise<PluginTree>;
@@ -0,0 +1,4 @@
1
+ export declare const isProtocolClient: () => boolean;
2
+ export declare const getProtocolClientName: () => string;
3
+ export declare function unregisterAsProtocolClient(): boolean;
4
+ export default function registerAsProtocolClient(force?: boolean): boolean;
@@ -0,0 +1,16 @@
1
+ import { type Agents, type Got } from "got";
2
+ export type ProxyTypes = "none" | "ie" | "http" | "socks4" | "socks5";
3
+ export type ProxyServer = {
4
+ Host: string;
5
+ Port: string;
6
+ UserName: string;
7
+ Password: string;
8
+ };
9
+ export type ProxyConfiguration = {
10
+ Type: ProxyTypes;
11
+ } & Partial<Record<ProxyTypes, ProxyServer>>;
12
+ export declare function getProxyURL(proto: string, server: ProxyServer): URL;
13
+ export declare function getProxyAgent(config?: ProxyConfiguration): Promise<Agents | undefined>;
14
+ export declare let client: Got;
15
+ export declare function setProxy(agents: Agents | undefined): void;
16
+ export declare function setupRequestInterceptors(): void;
@@ -0,0 +1,21 @@
1
+ import Emittery from "emittery";
2
+ import { Keyv } from "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;
20
+ export declare let events: Emittery<SettingsEvents>;
21
+ export declare function initialize(): void;
@@ -0,0 +1,10 @@
1
+ export interface VkToElectronResult {
2
+ accelerator: string | null;
3
+ unsupportedVkCodes: number[];
4
+ }
5
+ /**
6
+ * Convert legacy VK/keyCode values (e.g. 17,18,76) into an Electron accelerator.
7
+ */
8
+ export declare function vkCodesToElectronAccelerator(vkCodes: readonly number[]): VkToElectronResult;
9
+ export declare function registerGlobalShortcut(name: string, keys: string[], callback: () => void): boolean;
10
+ export declare function unregisterGlobalShortcut(name: string): void;
@@ -0,0 +1,50 @@
1
+ export declare const ScheduleShutdownStatus: {
2
+ /** The requested state is now in effect. */
3
+ readonly Ok: 0;
4
+ /** This platform, or the system, cannot schedule a shutdown. */
5
+ readonly NotAvailable: 1;
6
+ /** The requested state already held, so nothing changed. */
7
+ readonly AlreadySet: 2;
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
+ readonly ManagedExternally: 3;
14
+ /** The request could not be completed (e.g. the bus is unreachable). */
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;
34
+ }
35
+ /** Provide that handler. `calls/os.ts` is the only caller. */
36
+ export declare function setPowerOffFailureHandler(handler: () => void): void;
37
+ /** Whether this app owns a scheduled shutdown (or is busy creating one). */
38
+ export declare function hasManagedScheduledShutdown(): boolean;
39
+ /**
40
+ * Set the machine shutdown this app manages, or cancel it when `time` is
41
+ * omitted.
42
+ *
43
+ * Requests run one at a time, in the order they arrive, so the last request
44
+ * always wins even while an earlier one is still waiting on the system bus.
45
+ * Failures are reported as {@link ScheduleShutdownStatus.Failed} rather than
46
+ * rejected, so callers (including IPC handlers) always get an answer.
47
+ */
48
+ export declare function setScheduledShutdown(time?: Date): Promise<ScheduleShutdownStatus>;
49
+ /** Mark that the pending quit is performing the scheduled shutdown. */
50
+ export declare function keepScheduledShutdownOnExit(): void;
@@ -0,0 +1,2 @@
1
+ import type photon from "@silvia-odwyer/photon-node";
2
+ export declare function extractColor(image: photon.PhotonImage): Promise<string>;
@@ -0,0 +1,15 @@
1
+ import type { BtnImages, BtnState, ElementTemplate, LayoutNode } from "../../shared/types/dui.js";
2
+ export type { ElementTemplate, LayoutNode };
3
+ export declare function parseElementTemplate(xml: string): ElementTemplate | null;
4
+ /** Convert #AARRGGBB (ARGB) to CSS #RRGGBBAA. */
5
+ export declare function argbToCss(c: string): string;
6
+ /** Convert #AABBGGRR (ABGR) to CSS #RRGGBBAA. */
7
+ export declare function abgrToCss(c: string): string;
8
+ /** Parse a single state attribute string like file='btn/play.svg' svg_color='#ff483228'. */
9
+ export declare function parseBtnState(attrs: string): BtnState | null;
10
+ /**
11
+ * Parse a DUI attribute string like:
12
+ * normalimage="file='btn/play.svg' svg_color='#ff483228'" hotimage="..."
13
+ * into structured BtnImages.
14
+ */
15
+ export declare function parseBtnUrl(url: string): BtnImages | null;
@@ -0,0 +1,8 @@
1
+ import { NativeImage } from "electron";
2
+ export declare let trayInstalled: boolean;
3
+ export declare function setIcon(newIcon: NativeImage): void;
4
+ export declare function setTooltip(newTooltip: string): void;
5
+ export declare function install(): void;
6
+ export declare function uninstall(): void;
7
+ /** Destroy the tray icon on shutdown. */
8
+ export declare function destroyTray(): void;
@@ -0,0 +1,2 @@
1
+ import type { UpdateInfo } from "../shared/types/update.js";
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 {};
@@ -0,0 +1,3 @@
1
+ import { Display } from "electron";
2
+ export declare function getDisplayUniqueId(display: Display): string;
3
+ export declare function displayFromUniqueId(id: string | null): Display | null;
@@ -0,0 +1 @@
1
+ export declare function checkEnvFlagPresent(name: string): boolean;
@@ -0,0 +1,21 @@
1
+ export declare function isFileNotFound(err: unknown): boolean;
2
+ /**
3
+ * Asynchronous version of {@link existsSync}
4
+ *
5
+ * @param path Path to file
6
+ */
7
+ export declare function fileExists(path: string): Promise<boolean>;
8
+ /**
9
+ * Whether `path` exists and can actually be written to, tested by creating
10
+ * (then removing) a uniquely named probe directory. When `create` is true the
11
+ * directory is created first if it does not exist.
12
+ *
13
+ * @param path Path to the directory to test
14
+ * @param create Whether to create the directory if it does not exist
15
+ */
16
+ export declare function isWritableDir(path: string, create?: boolean): Promise<boolean>;
17
+ /**
18
+ * Try move file or folder with the least efforts.
19
+ */
20
+ export declare function move(src: string | URL, dest: string | URL): Promise<void>;
21
+ export declare function calculateDbSize(db: string): Promise<number>;
@@ -0,0 +1 @@
1
+ export declare function pngFromIco(icoData: Uint8Array): Uint8Array;
@@ -0,0 +1 @@
1
+ export declare function isMusicFile(fileOrPath: string): boolean;
@@ -0,0 +1,2 @@
1
+ import type { MetaPicture } from "music-tag-native";
2
+ export declare function selectBestMusicPic(pics: MetaPicture[]): MetaPicture | null;
@@ -0,0 +1,2 @@
1
+ export declare function normalizePath(...paths: string[]): string;
2
+ export declare function sanitizeRelativePath(base: string, path: string): string | false;
@@ -0,0 +1,13 @@
1
+ import type { BrowserWindow, WebContents } from "electron";
2
+ /**
3
+ * Send an IPC message only when its target is still alive.
4
+ *
5
+ * `webContents.send()` throws when either the window or its web contents has
6
+ * been destroyed, which is easy to hit from timers, event listeners, file
7
+ * watchers, and other callbacks that outlive the window. Check at send time so
8
+ * a guard before an `await` cannot go stale.
9
+ *
10
+ * @returns `true` when the message was handed to Electron, `false` when the
11
+ * target was missing or destroyed.
12
+ */
13
+ export declare function sendIfAlive(target: BrowserWindow | WebContents | null | undefined, channel: string, ...args: unknown[]): boolean;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Whether a URL safe internal app URL.
3
+ */
4
+ export declare function isAppUrl(url: string | URL): boolean;
5
+ /**
6
+ * Whether `hostname` is exactly `domain` or one of its subdomains.
7
+ *
8
+ * Rejects lookalikes such as `evilmusic.163.com` for `music.163.com`.
9
+ */
10
+ export declare function isHostOrSubdomain(hostname: string, domain: string): boolean;
11
+ /**
12
+ * Whether a URL is Netease Cloud Music's.
13
+ */
14
+ export declare function isNCMUrl(url: string | URL): boolean;
15
+ /**
16
+ * Whether a URL belongs to one of the SSO hosts whose cookies the app patches
17
+ * (Netease Cloud Music, QQ, Weibo).
18
+ */
19
+ export declare function isSsoUrl(url: string | URL): boolean;
@@ -0,0 +1,2 @@
1
+ import { type BrowserWindow } from "electron";
2
+ export declare function getWindowScaleFactor(wnd: BrowserWindow): number;