@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 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ import CallDispatcher from "../shared/CallDispatcher.js";
2
+ export declare const dispatcher: CallDispatcher;
3
+ export declare const registerCallHandler: typeof dispatcher.registerHandler;
4
+ export declare const registerCallbackHandler: typeof dispatcher.registerCallbackHandler;
@@ -0,0 +1 @@
1
+ export declare function fireNativeCall<Args extends unknown[]>(command: string, ...args: Args): void;
@@ -0,0 +1,10 @@
1
+ import type { LogFn } from "pino";
2
+ type Bindings = Record<string, unknown>;
3
+ /** `child()` factory returned by the facade. */
4
+ type ChildFactory = (bindings: Bindings) => Facade;
5
+ /** The facade surface: a log method per level, plus `child(bindings)`. */
6
+ type Facade = Record<string, LogFn> & {
7
+ child: ChildFactory;
8
+ };
9
+ declare const logger: Facade;
10
+ export default logger;
@@ -0,0 +1,13 @@
1
+ import type { PlaybackMode } from "../shared/types/playback-mode.js";
2
+ declare const bridgeApi: {
3
+ reportMode: (mode: string) => void;
4
+ onCommand: (handler: (mode: PlaybackMode) => Promise<void>) => void;
5
+ };
6
+ export type PlaybackModeBridgeApi = typeof bridgeApi;
7
+ /**
8
+ * Runs in the page's main world: keep runtime dependencies inside this function.
9
+ * Read the mounted React tree to find the Provider store or dva route's app.
10
+ * All playback changes go through the page's own playing model.
11
+ */
12
+ export declare function installPlaybackModeBridge(api: PlaybackModeBridgeApi): void;
13
+ export {};
@@ -0,0 +1 @@
1
+ export declare const channel: string | null;
@@ -0,0 +1,12 @@
1
+ export type HandlerFunction<Args extends unknown[] = unknown[], Return extends unknown[] | void = void> = (...args: Args) => Return | Promise<Return>;
2
+ export type CallbackHandlerFunction<Args extends unknown[] = unknown[]> = (callback: (...args: unknown[]) => void, ...args: Args) => void | Promise<void>;
3
+ export default class CallDispatcher {
4
+ private handlers;
5
+ private callbackHandlers;
6
+ registerHandler<Args extends unknown[], Return extends unknown[] | void>(cmd: string, handler: HandlerFunction<Args, Return>): void;
7
+ registerHandlers(handlers: {
8
+ [cmd: string]: HandlerFunction;
9
+ }): void;
10
+ registerCallbackHandler<Args extends unknown[]>(cmd: string, handler: CallbackHandlerFunction<Args>): void;
11
+ dispatch(cmd: string, callback: (...args: unknown[]) => void, ...args: unknown[]): Promise<void | false>;
12
+ }
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Typed client surface over a mount.
3
+ *
4
+ * Property access builds a route; calling a leaf sends a request, and leaves
5
+ * under `events` create subscriptions. The proxy is path-based, so nested
6
+ * contract groups work without codegen.
7
+ */
8
+ import type { BridgeError } from "./protocol.js";
9
+ type AnyFunction = (...args: any[]) => any;
10
+ export type EventArgs<F> = F extends (callback: (...args: infer A) => void) => unknown ? A : never;
11
+ export type EventEndpoint<E> = {
12
+ [K in keyof E]: E[K] extends (callback: (payload: any) => void) => unknown ? (callback: (...args: EventArgs<E[K]>) => void, onError?: (error: BridgeError) => void) => () => void : E[K] extends object ? EventEndpoint<E[K]> : never;
13
+ };
14
+ export type Endpoint<T> = {
15
+ [K in keyof T as K extends "events" ? never : T[K] extends AnyFunction ? K : T[K] extends object ? K : never]: T[K] extends AnyFunction ? (...args: Parameters<T[K]>) => Promise<Awaited<ReturnType<T[K]>>> : T[K] extends object ? Endpoint<T[K]> : never;
16
+ } & (T extends {
17
+ events: infer E;
18
+ } ? {
19
+ events: EventEndpoint<E>;
20
+ } : {});
21
+ export interface EndpointHooks {
22
+ /** Send a request for the route suffix (for example `cache.getStats`). */
23
+ request(route: string, args: unknown[]): Promise<unknown>;
24
+ /** Subscribe to an event route suffix (for example `timeUpdate`). */
25
+ subscribe(route: string, callback: (...args: unknown[]) => void, onError?: (error: BridgeError) => void): () => void;
26
+ }
27
+ export declare function createEndpoint<T>(hooks: EndpointHooks): Endpoint<T>;
28
+ declare const joinRoute: (mount: string, suffix: string) => string;
29
+ export { joinRoute };
@@ -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,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
+ }
@@ -0,0 +1,50 @@
1
+ import type { AudioPlayInfo } from "../../preload/Player.js";
2
+ /** Track metadata reported once the AV3A track has been indexed (`moov`). */
3
+ export interface Av3aTrackInfo {
4
+ sampleRate: number;
5
+ channels: number;
6
+ frameCount: number;
7
+ durationSeconds: number;
8
+ mediaStart: number;
9
+ mediaEnd: number;
10
+ }
11
+ /** One decoded PCM16 frame. */
12
+ export interface Av3aPcmEvent {
13
+ /** Interleaved little-endian PCM16 (`channels * 1024` samples). */
14
+ data: ArrayBuffer;
15
+ /** 0-based AV3A frame index within the track. */
16
+ frameIndex: number;
17
+ sampleRate: number;
18
+ channels: number;
19
+ /** Presentation timestamp in milliseconds. */
20
+ pts: number;
21
+ }
22
+ /**
23
+ * Control-plane bridge between the player window and main's AV3A playback
24
+ * manager (which forks the decode utility process).
25
+ *
26
+ * `events.*` are pushed from main via `webContents.send("av3a.<event>", ...)`;
27
+ * the remaining methods are invoked by the player via
28
+ * `ipcRenderer.invoke("av3a.<method>", ...)`.
29
+ *
30
+ * Decode events (`opened`/`pcm`/`done`/`error`), frames, and flow control
31
+ * (`pause`/`resume`/`seek`) are intentionally NOT here: they travel on the
32
+ * direct renderer<->decode-utility channel (see `av3a-process.ts`), keeping
33
+ * the main process off the real-time path. Main's `error` event is kept as a
34
+ * fallback for terminal, main-originated failures (e.g. the decode process
35
+ * crashing).
36
+ */
37
+ export interface Av3aContract {
38
+ events: {
39
+ error(callback: (message: string) => void): void;
40
+ /** Download progress of the encoded source. */
41
+ progress(callback: (loaded: number, total: number) => void): void;
42
+ };
43
+ /**
44
+ * Start decoding `playInfo` in the AV3A decode utility process.
45
+ * Currently supports URL playback (`type === 4`, `audioFormat === "av3a"`).
46
+ */
47
+ start(playInfo: AudioPlayInfo): Promise<void>;
48
+ /** Stop decoding: tear down the utility process and the underlying streamer. */
49
+ stop(): Promise<void>;
50
+ }
@@ -0,0 +1,56 @@
1
+ import type { Av3aPcmEvent, Av3aTrackInfo } from "./av3a-api.js";
2
+ /**
3
+ * Messaging between the main process and the AV3A decode utility process
4
+ * (`process.parentPort` <-> `UtilityProcess.postMessage`).
5
+ */
6
+ /** main -> utility process */
7
+ export type Av3aProcessMainToService = {
8
+ type: "init";
9
+ path: string;
10
+ totalLength: number;
11
+ prefixEnd: number;
12
+ } | {
13
+ type: "frontier";
14
+ prefixEnd: number;
15
+ } | {
16
+ type: "rangeReady";
17
+ id: number;
18
+ prefixEnd: number;
19
+ } | {
20
+ type: "rangeError";
21
+ id: number;
22
+ message: string;
23
+ };
24
+ /** utility process -> main (main only serves byte ranges; nothing else). */
25
+ export type Av3aProcessServiceToMain = {
26
+ type: "ensureRange";
27
+ id: number;
28
+ start: number;
29
+ end: number;
30
+ };
31
+ /**
32
+ * Direct channel (a `MessageChannelMain` end in each process) between the
33
+ * renderer and the AV3A decode utility process. Every decode event — opened,
34
+ * PCM frames, done, errors — plus flow control and seeks travels here, in
35
+ * order, without main on the path. That keeps playback flowing while main is
36
+ * busy (e.g. blocked by a window drag).
37
+ */
38
+ export type Av3aChannelRendererToService = {
39
+ type: "pause";
40
+ } | {
41
+ type: "resume";
42
+ } | {
43
+ type: "seek";
44
+ frameIndex: number;
45
+ };
46
+ export type Av3aChannelServiceToRenderer = ({
47
+ type: "pcm";
48
+ } & Av3aPcmEvent) | {
49
+ type: "opened";
50
+ info: Av3aTrackInfo;
51
+ } | {
52
+ type: "done";
53
+ } | {
54
+ type: "error";
55
+ message: string;
56
+ };
@@ -0,0 +1,223 @@
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";
11
+ }
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";
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 */
151
+ export interface PluginManagerEntry {
152
+ id: string;
153
+ name: string;
154
+ version: string;
155
+ description?: string;
156
+ author?: string;
157
+ license?: string;
158
+ /** Resolved `assets://plugins/<id>/<path>` URL, when the plugin declares an icon. */
159
+ icon?: string;
160
+ kind: PluginKind;
161
+ layer: PluginLayer;
162
+ /** Persisted intent. */
163
+ desired: PluginDesiredState;
164
+ /** Convenience mirror of `desired.enabled`. */
165
+ enabled: boolean;
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;
177
+ error?: string;
178
+ }
179
+ /** @internal */
180
+ export interface PluginManagerState {
181
+ /** False when the plugin system itself is disabled. */
182
+ available: boolean;
183
+ plugins: PluginManagerEntry[];
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 */
214
+ export interface PluginManagerContract {
215
+ list(): Promise<PluginManagerState>;
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
+ };
223
+ }