@open-orpheus/plugin-api 0.0.0 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +7 -0
- package/README.md +192 -0
- package/dist/client/index.d.ts +37 -0
- package/dist/client/index.js +53 -0
- package/dist/client/index.js.map +1 -0
- package/dist/configuration/host/src/shared/plugin/configuration/index.d.ts +21 -0
- package/dist/configuration/index.d.ts +5 -0
- package/dist/host/_native/open-orpheus__window.d.ts +35 -17
- package/dist/host/src/main/assets.d.ts +2 -0
- package/dist/host/src/main/audio/DownloadScheduler.d.ts +2 -2
- package/dist/host/src/main/audio/MediaEngine.d.ts +1 -1
- package/dist/host/src/main/audio.d.ts +1 -1
- package/dist/host/src/main/av3a/Av3aEngine.d.ts +1 -1
- package/dist/host/src/main/av3a/Av3aM4aSession.d.ts +1 -1
- package/dist/host/src/main/av3a/Av3aPlaybackProcess.d.ts +1 -1
- package/dist/host/src/main/av3a/sources.d.ts +2 -2
- package/dist/host/src/main/av3a/types.d.ts +1 -1
- package/dist/host/src/main/bridge/ipc-main-bridge.d.ts +24 -0
- package/dist/host/src/main/bridge/window.d.ts +7 -0
- package/dist/host/src/main/cache.d.ts +3 -3
- package/dist/host/src/main/calls/desktop.d.ts +1 -1
- package/dist/host/src/main/calls/index.d.ts +16 -16
- package/dist/host/src/main/calls.d.ts +1 -1
- package/dist/host/src/main/channel.d.ts +1 -1
- package/dist/host/src/main/database/KeyvSqliteDriver.d.ts +1 -1
- package/dist/host/src/main/database.d.ts +1 -1
- package/dist/host/src/main/lifecycle.d.ts +15 -6
- package/dist/host/src/main/lyrics/DbusLyricsService.d.ts +2 -2
- package/dist/host/src/main/lyrics/LyricsDispatcher.d.ts +1 -1
- package/dist/host/src/main/lyrics/dbus.d.ts +1 -1
- package/dist/host/src/main/lyrics/parse.d.ts +1 -1
- package/dist/host/src/main/lyrics.d.ts +1 -1
- package/dist/host/src/main/mediaSession.d.ts +1 -1
- package/dist/host/src/main/menu/AppMenu.d.ts +3 -3
- package/dist/host/src/main/menu/backend/DesktopWindowBackend.d.ts +2 -2
- package/dist/host/src/main/menu/backend/MenuBackend.d.ts +3 -3
- package/dist/host/src/main/menu/backend/WaylandLayerShellBackend.d.ts +35 -0
- package/dist/host/src/main/menu/backend/WaylandOverlayBackend.d.ts +1 -1
- package/dist/host/src/main/menu/backend/WaylandPopupBackend.d.ts +2 -2
- package/dist/host/src/main/menu/constants.d.ts +2 -0
- package/dist/host/src/main/menu/index.d.ts +2 -2
- package/dist/host/src/main/menu/patch.d.ts +1 -1
- package/dist/host/src/main/menu/skin.d.ts +1 -1
- package/dist/host/src/main/menu/surface/BaseWindowMenuSurface.d.ts +15 -3
- package/dist/host/src/main/menu/surface/CaptureLayerSurface.d.ts +22 -0
- package/dist/host/src/main/menu/surface/MenuSurface.d.ts +1 -1
- package/dist/host/src/main/menu/surface/MenuSurfacePath.d.ts +2 -2
- package/dist/host/src/main/menu/surface/SurfacePool.d.ts +1 -1
- package/dist/host/src/main/menu/workaround.d.ts +9 -3
- package/dist/host/src/main/ncae.d.ts +1 -1
- package/dist/host/src/main/network/handler.d.ts +1 -1
- package/dist/host/src/main/network/interceptor.d.ts +1 -1
- package/dist/host/src/main/network/interceptors/anonymous.d.ts +1 -1
- package/dist/host/src/main/network/pipeline.d.ts +1 -1
- package/dist/host/src/main/pack.d.ts +1 -1
- package/dist/host/src/main/packs/SkinPack.d.ts +1 -1
- package/dist/host/src/main/packs/WebPack.d.ts +1 -1
- package/dist/host/src/main/playback/PlaybackController.d.ts +2 -2
- package/dist/host/src/main/playback/PlayerCommandRouter.d.ts +2 -2
- package/dist/host/src/main/playback/adapters/MediaSessionAdapter.d.ts +2 -2
- package/dist/host/src/main/playback/adapters/MprisAdapter.d.ts +3 -3
- package/dist/host/src/main/playback/adapters/NowPlayingAdapter.d.ts +2 -2
- package/dist/host/src/main/playback/adapters/SmtcAdapter.d.ts +2 -2
- package/dist/host/src/main/playback/modes.d.ts +1 -1
- package/dist/host/src/main/playback/types.d.ts +31 -11
- package/dist/host/src/main/plugin/assets.d.ts +8 -0
- package/dist/host/src/main/plugin/catalog.d.ts +42 -0
- package/dist/host/src/main/plugin/discover.d.ts +4 -7
- package/dist/host/src/main/plugin/index.d.ts +5 -2
- package/dist/host/src/main/plugin/loader.d.ts +68 -21
- package/dist/host/src/main/plugin/manager.d.ts +53 -7
- package/dist/host/src/main/plugin/metadata.d.ts +13 -3
- package/dist/host/src/main/plugin/state.d.ts +16 -6
- package/dist/host/src/main/settings.d.ts +17 -2
- package/dist/host/src/main/shutdown.d.ts +28 -10
- package/dist/host/src/main/skin/dui.d.ts +1 -1
- package/dist/host/src/main/update.d.ts +1 -1
- package/dist/host/src/main/util/color.d.ts +7 -0
- package/dist/host/src/main/window.d.ts +26 -4
- package/dist/host/src/main/windows/color-picker.d.ts +3 -0
- package/dist/host/src/main/windows/desktop-lyrics.d.ts +2 -2
- package/dist/host/src/main/windows/desktop-pet.d.ts +1 -1
- package/dist/host/src/main/windows/main.d.ts +1 -1
- package/dist/host/src/main/windows/mini-player.d.ts +2 -2
- package/dist/host/src/main/windows/music-desktop.d.ts +1 -1
- package/dist/host/src/main/windows/package-download.d.ts +1 -1
- package/dist/host/src/main/windows/plugin-manager-events.d.ts +7 -0
- package/dist/host/src/main/windows/plugin-manager.d.ts +1 -1
- package/dist/host/src/main/xeapi.d.ts +1 -6
- package/dist/host/src/preload/PlaybackBackend.d.ts +1 -1
- package/dist/host/src/preload/Player.d.ts +14 -6
- package/dist/host/src/preload/av3a/Av3aPcmPlayer.d.ts +2 -2
- package/dist/host/src/preload/av3a/bridge.d.ts +2 -2
- package/dist/host/src/preload/av3a/channel.d.ts +2 -2
- package/dist/host/src/preload/backends/Av3aPlaybackBackend.d.ts +2 -2
- package/dist/host/src/preload/backends/MediaPlaybackBackend.d.ts +1 -1
- package/dist/host/src/shared/bridge/constants.d.ts +2 -0
- package/dist/host/src/shared/bridge/endpoint.d.ts +29 -0
- package/dist/host/src/shared/bridge/hub.d.ts +136 -0
- package/dist/host/src/shared/bridge/protocol.d.ts +91 -0
- package/dist/host/src/shared/bridge/realm.d.ts +14 -0
- package/dist/host/src/shared/bridge/routes.d.ts +37 -0
- package/dist/host/src/shared/contracts/av3a-api.d.ts +1 -1
- package/dist/host/src/shared/contracts/av3a-process.d.ts +1 -1
- package/dist/host/src/shared/contracts/color-picker-api.d.ts +17 -0
- package/dist/host/src/shared/contracts/desktop-lyrics-api.d.ts +1 -2
- package/dist/host/src/shared/contracts/input-region-api.d.ts +1 -2
- package/dist/host/src/shared/contracts/lyrics-api.d.ts +1 -1
- package/dist/host/src/shared/contracts/manage-api.d.ts +2 -4
- package/dist/host/src/shared/contracts/menu-surface-api.d.ts +35 -0
- package/dist/host/src/shared/contracts/mini-player-api.d.ts +1 -1
- package/dist/host/src/shared/contracts/plugin-manager-api.d.ts +201 -12
- package/dist/host/src/shared/playbackMode.d.ts +1 -1
- package/dist/host/src/shared/plugin/cache-bust.d.ts +8 -0
- package/dist/host/src/shared/plugin/lifecycle.d.ts +217 -0
- package/dist/host/src/{main/plugin/types.d.ts → shared/plugin/realms/main/index.d.ts} +1 -1
- package/dist/host/src/shared/plugin/registry.d.ts +42 -5
- package/dist/host/src/shared/plugin/runtime-state.d.ts +4 -0
- package/dist/host/src/shared/settings/defaults.d.ts +35 -0
- package/dist/host/src/shared/settings/index.d.ts +3 -0
- package/dist/host/src/shared/settings/keys.d.ts +21 -0
- package/dist/host/src/shared/settings/values.d.ts +13 -0
- package/dist/host/src/shared/types/desktop-lyrics.d.ts +28 -11
- package/dist/host/src/shared/types/menu-surface.d.ts +2 -2
- package/dist/host/src/shared/types/menu.d.ts +1 -1
- package/dist/host/src/shared/types/mini-player.d.ts +12 -5
- package/dist/host/src/shared/types/ncae.d.ts +11 -3
- package/dist/host/src/shared/types/package-download.d.ts +13 -5
- package/dist/index.d.ts +3 -3
- package/dist/plugin-manager/host/src/preload/logger.d.ts +10 -0
- package/dist/plugin-manager/host/src/preload/util.d.ts +1 -0
- package/dist/plugin-manager/host/src/shared/bridge/constants.d.ts +2 -0
- package/dist/plugin-manager/host/src/shared/bridge/endpoint.d.ts +29 -0
- package/dist/plugin-manager/host/src/shared/bridge/hub.d.ts +136 -0
- package/dist/plugin-manager/host/src/shared/bridge/protocol.d.ts +91 -0
- package/dist/plugin-manager/host/src/shared/bridge/routes.d.ts +37 -0
- package/dist/plugin-manager/host/src/shared/contracts/plugin-manager-api.d.ts +223 -0
- package/dist/plugin-manager/host/src/shared/plugin/lifecycle.d.ts +217 -0
- package/dist/plugin-manager/host/src/shared/plugin/realms/common/index.d.ts +34 -0
- package/dist/plugin-manager/host/src/shared/plugin/realms/plugin-manager/index.d.ts +11 -0
- package/dist/plugin-manager/host/src/shared/plugin/registry.d.ts +69 -0
- package/dist/plugin-manager/host/src/shared/util.d.ts +22 -0
- package/dist/plugin-manager/index.d.ts +7 -0
- package/dist/plugin-manager/registry-map.d.ts +16 -0
- package/dist/preload/host/src/preload/PlaybackBackend.d.ts +1 -1
- package/dist/preload/host/src/preload/Player.d.ts +14 -6
- package/dist/preload/host/src/preload/audioplayer.d.ts +1 -1
- package/dist/preload/host/src/preload/av3a/Av3aPcmPlayer.d.ts +2 -2
- package/dist/preload/host/src/preload/av3a/bridge.d.ts +2 -2
- package/dist/preload/host/src/preload/av3a/channel.d.ts +2 -2
- package/dist/preload/host/src/preload/backends/Av3aPlaybackBackend.d.ts +2 -2
- package/dist/preload/host/src/preload/backends/MediaPlaybackBackend.d.ts +1 -1
- package/dist/preload/host/src/preload/calls/index.d.ts +6 -6
- package/dist/preload/host/src/preload/calls.d.ts +1 -1
- package/dist/preload/host/src/preload/logger.d.ts +10 -0
- package/dist/preload/host/src/preload/playbackMode.d.ts +1 -1
- package/dist/preload/host/src/shared/bridge/endpoint.d.ts +29 -0
- package/dist/preload/host/src/shared/bridge/hub.d.ts +136 -0
- package/dist/preload/host/src/shared/bridge/protocol.d.ts +91 -0
- package/dist/preload/host/src/shared/bridge/routes.d.ts +37 -0
- package/dist/preload/host/src/shared/contracts/av3a-api.d.ts +1 -1
- package/dist/preload/host/src/shared/contracts/av3a-process.d.ts +1 -1
- package/dist/preload/host/src/shared/contracts/plugin-manager-api.d.ts +223 -0
- package/dist/preload/host/src/shared/playbackMode.d.ts +1 -1
- package/dist/preload/host/src/shared/plugin/lifecycle.d.ts +217 -0
- package/dist/preload/host/src/shared/plugin/realms/common/index.d.ts +34 -0
- package/dist/preload/host/src/shared/plugin/realms/preload/index.d.ts +11 -0
- package/dist/preload/host/src/shared/plugin/registry.d.ts +42 -5
- package/dist/preload/host/src/shared/types/ncae.d.ts +11 -3
- package/dist/preload/index.d.ts +3 -3
- package/dist/preload/registry-map.d.ts +38 -31
- package/dist/registry-map.d.ts +159 -140
- package/package.json +24 -8
- package/dist/preload/host/src/preload/plugin/types.d.ts +0 -18
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { PluginRegistry, Registry } from "../../registry.js";
|
|
2
|
+
/**
|
|
3
|
+
* Host-owned publisher for a plugin's renderer main world.
|
|
4
|
+
*
|
|
5
|
+
* Both `preload` and `plugin-manager` run in a host preload context and receive
|
|
6
|
+
* this same host; mounts and exposures are scoped to the activation epoch.
|
|
7
|
+
*/
|
|
8
|
+
export interface PluginMainWorldHost {
|
|
9
|
+
mount(route: string, impl: Record<string, unknown>): {
|
|
10
|
+
dispose(): void;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Define `window[name]` in the renderer main world. The value follows
|
|
14
|
+
* contextBridge rules (functions proxied, data copied); the host removes the
|
|
15
|
+
* global when the plugin's activation epoch ends.
|
|
16
|
+
*/
|
|
17
|
+
expose(name: string, api: unknown): {
|
|
18
|
+
dispose(): void;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/** Runtime handed to a plugin entry that runs in a host preload context. */
|
|
22
|
+
export interface PreloadRealmRuntime {
|
|
23
|
+
/** The generated interface registry for the realm. */
|
|
24
|
+
registry: Registry;
|
|
25
|
+
/** The realm's plugin-contributed exports, keyed by plugin id. */
|
|
26
|
+
plugins: PluginRegistry;
|
|
27
|
+
/** Publishes APIs and globals to this window's renderer main world. */
|
|
28
|
+
mainWorld: PluginMainWorldHost;
|
|
29
|
+
}
|
|
30
|
+
/** Named exports a plugin entry running in a host preload context provides. */
|
|
31
|
+
export interface PreloadRealmModule {
|
|
32
|
+
activate(runtime: PreloadRealmRuntime): void | Promise<void>;
|
|
33
|
+
deactivate?(): void | Promise<void>;
|
|
34
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { PreloadRealmModule, PreloadRealmRuntime } from "../common/index.js";
|
|
2
|
+
export type { PluginMainWorldHost } from "../common/index.js";
|
|
3
|
+
/** Everything a plugin's plugin-manager-realm module is handed. */
|
|
4
|
+
export type PluginRuntime = PreloadRealmRuntime;
|
|
5
|
+
/**
|
|
6
|
+
* The named exports a plugin's plugin-manager entry must provide.
|
|
7
|
+
*
|
|
8
|
+
* Entries are evaluated as CJS preload bundles and run inside the plugin
|
|
9
|
+
* manager window's preload context.
|
|
10
|
+
*/
|
|
11
|
+
export type PluginModule = PreloadRealmModule;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Loose shape of a build-time registry.
|
|
3
|
+
*
|
|
4
|
+
* The host only passes the registry through to plugins; precise per-module
|
|
5
|
+
* types live in the generated `@open-orpheus/plugin-api` package.
|
|
6
|
+
*/
|
|
7
|
+
import type { RegistryLoad } from "../../../../registry-map.js";
|
|
8
|
+
export type { RegistryLoad };
|
|
9
|
+
/**
|
|
10
|
+
* The resolved value type for a registry key.
|
|
11
|
+
*
|
|
12
|
+
* `LoadedModule<"@main/logger">` is equivalent to
|
|
13
|
+
* `Awaited<ReturnType<RegistryLoad["@main/logger"]>>`.
|
|
14
|
+
*/
|
|
15
|
+
export type LoadedModule<Key extends keyof RegistryLoad> = Awaited<ReturnType<RegistryLoad[Key]>>;
|
|
16
|
+
/**
|
|
17
|
+
* Lazy access to a realm's host module surface.
|
|
18
|
+
*
|
|
19
|
+
* Every module is imported on demand; the registry itself has no static
|
|
20
|
+
* imports and therefore no initialization side effects.
|
|
21
|
+
*/
|
|
22
|
+
type RegistryLoader = (...args: never[]) => unknown;
|
|
23
|
+
export type Registry<Load extends RegistryLoad = RegistryLoad> = {
|
|
24
|
+
/** Import a module. Resolves immediately for modules that are already evaluated. */
|
|
25
|
+
load<Key extends keyof Load>(key: Key): ReturnType<Extract<Load[Key], RegistryLoader>>;
|
|
26
|
+
/** Every key this registry can serve. */
|
|
27
|
+
keys(): Array<keyof Load>;
|
|
28
|
+
};
|
|
29
|
+
/** @internal */
|
|
30
|
+
export declare function createRegistry<Load extends RegistryLoad>(lazyModules: Load): Registry<Load>;
|
|
31
|
+
/**
|
|
32
|
+
* Plugin-contributed exports for one realm, keyed by plugin id.
|
|
33
|
+
*
|
|
34
|
+
* `load` evaluates the plugin module and returns its exports without waiting
|
|
35
|
+
* for activation. `whenActive` waits for the plugin's current activation
|
|
36
|
+
* attempt to be running, and reports readiness cycles instead of deadlocking.
|
|
37
|
+
*/
|
|
38
|
+
export interface PluginRegistry {
|
|
39
|
+
load<T = unknown>(id: string): Promise<T>;
|
|
40
|
+
whenActive<T = unknown>(id: string): Promise<T>;
|
|
41
|
+
keys(): string[];
|
|
42
|
+
}
|
|
43
|
+
/** @internal */
|
|
44
|
+
export interface PluginRegistrySource {
|
|
45
|
+
load(): Promise<unknown>;
|
|
46
|
+
whenActive(): Promise<unknown>;
|
|
47
|
+
/** Whether `whenActive` can resolve without waiting for another operation. */
|
|
48
|
+
isReady?(): boolean;
|
|
49
|
+
}
|
|
50
|
+
/** @internal */
|
|
51
|
+
export interface MutablePluginRegistry extends PluginRegistry {
|
|
52
|
+
/** Forget the cached evaluation for a plugin that has been removed. */
|
|
53
|
+
forget(id: string): void;
|
|
54
|
+
/** Bind a registry to the plugin currently activating. */
|
|
55
|
+
forPlugin(id: string): PluginRegistry;
|
|
56
|
+
}
|
|
57
|
+
/** @internal */
|
|
58
|
+
export declare class PluginReadinessCycleError extends Error {
|
|
59
|
+
readonly chain: string[];
|
|
60
|
+
constructor(chain: string[]);
|
|
61
|
+
}
|
|
62
|
+
/** @internal */
|
|
63
|
+
export interface MutablePluginRegistryOptions {
|
|
64
|
+
/** Called when a readiness wait is registered, so the caller can report it. */
|
|
65
|
+
onWait?: (owner: string, target: string) => void;
|
|
66
|
+
}
|
|
67
|
+
/** @internal */
|
|
68
|
+
export declare function createPluginRegistry(sources: ReadonlyMap<string, PluginRegistrySource>, options?: MutablePluginRegistryOptions): MutablePluginRegistry;
|
|
69
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare function toError(error: unknown): Error;
|
|
2
|
+
/**
|
|
3
|
+
* Get or set the image size of a Netease CDN URL.
|
|
4
|
+
*
|
|
5
|
+
* To get, leave `sizeOrWidth` and `height` empty.
|
|
6
|
+
* To set, set `sizeOrWidth` and/or `height`.
|
|
7
|
+
*
|
|
8
|
+
* @param url
|
|
9
|
+
* @param sizeOrWidth If provided, sets the image size or width
|
|
10
|
+
* @param height If provided, use this as the height, or `sizeOrWidth` will be used for height
|
|
11
|
+
*/
|
|
12
|
+
export declare function imageSize(url: string): [number, number] | null;
|
|
13
|
+
export declare function imageSize(url: string, sizeOrWidth: number, height?: number): string;
|
|
14
|
+
/** Convert dB to linear gain. */
|
|
15
|
+
export declare function dbToGain(db: number): number;
|
|
16
|
+
/**
|
|
17
|
+
* Convert volume (0-1) to linear gain, logarithmic mapping.
|
|
18
|
+
*
|
|
19
|
+
* @param input
|
|
20
|
+
* @returns
|
|
21
|
+
*/
|
|
22
|
+
export declare function volumeToGain(input: number, minDb?: number): number;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// AUTO-GENERATED by packages/plugin-api/scripts/build.ts. Do not edit.
|
|
2
|
+
// The plugin-facing type surface. Generated from the host; contains no
|
|
3
|
+
// references back to the host repository.
|
|
4
|
+
|
|
5
|
+
export type { PluginModule, PluginRuntime } from "./host/src/shared/plugin/realms/plugin-manager/index.js";
|
|
6
|
+
export type { LoadedModule, PluginRegistry, Registry } from "./host/src/shared/plugin/registry.js";
|
|
7
|
+
export type { RegistryLoad } from "./registry-map.js";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// AUTO-GENERATED by packages/plugin-api/scripts/build.ts. Do not edit.
|
|
2
|
+
export declare const load: {
|
|
3
|
+
readonly "@preload/logger": () => Promise<typeof import("./host/src/preload/logger.js")>;
|
|
4
|
+
readonly "@preload/util": () => Promise<typeof import("./host/src/preload/util.js")>;
|
|
5
|
+
readonly "@shared/bridge/constants": () => Promise<typeof import("./host/src/shared/bridge/constants.js")>;
|
|
6
|
+
readonly "@shared/bridge/endpoint": () => Promise<typeof import("./host/src/shared/bridge/endpoint.js")>;
|
|
7
|
+
readonly "@shared/bridge/hub": () => Promise<typeof import("./host/src/shared/bridge/hub.js")>;
|
|
8
|
+
readonly "@shared/bridge/protocol": () => Promise<typeof import("./host/src/shared/bridge/protocol.js")>;
|
|
9
|
+
readonly "@shared/bridge/routes": () => Promise<typeof import("./host/src/shared/bridge/routes.js")>;
|
|
10
|
+
readonly "@shared/contracts/plugin-manager-api": () => Promise<typeof import("./host/src/shared/contracts/plugin-manager-api.js")>;
|
|
11
|
+
readonly "@shared/plugin/lifecycle": () => Promise<typeof import("./host/src/shared/plugin/lifecycle.js")>;
|
|
12
|
+
readonly "@shared/plugin/registry": () => Promise<typeof import("./host/src/shared/plugin/registry.js")>;
|
|
13
|
+
readonly "@shared/util": () => Promise<typeof import("./host/src/shared/util.js")>;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type RegistryLoad = typeof load;
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import Emittery from "emittery";
|
|
2
|
-
import AudioEffectManager from "./AudioEffectManager";
|
|
3
|
-
export declare
|
|
4
|
-
Null
|
|
5
|
-
Playing
|
|
6
|
-
Paused
|
|
7
|
-
Error
|
|
2
|
+
import AudioEffectManager from "./AudioEffectManager.js";
|
|
3
|
+
export declare const AudioPlayerState: {
|
|
4
|
+
readonly Null: 0;
|
|
5
|
+
readonly Playing: 1;
|
|
6
|
+
readonly Paused: 2;
|
|
7
|
+
readonly Error: 3;
|
|
8
|
+
readonly [x: number]: string;
|
|
9
|
+
};
|
|
10
|
+
export type AudioPlayerState = 0 | 1 | 2 | 3;
|
|
11
|
+
export declare namespace AudioPlayerState {
|
|
12
|
+
type Null = 0;
|
|
13
|
+
type Playing = 1;
|
|
14
|
+
type Paused = 2;
|
|
15
|
+
type Error = 3;
|
|
8
16
|
}
|
|
9
17
|
export type SongInfo = {
|
|
10
18
|
playId: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { AudioPlayInfo } from "../Player";
|
|
2
|
-
import type { Av3aTrackInfo } from "../../shared/contracts/av3a-api";
|
|
1
|
+
import type { AudioPlayInfo } from "../Player.js";
|
|
2
|
+
import type { Av3aTrackInfo } from "../../shared/contracts/av3a-api.js";
|
|
3
3
|
/**
|
|
4
4
|
* Renders the AV3A decode stream inside the player window's AudioContext.
|
|
5
5
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { AudioPlayInfo } from "../Player";
|
|
2
|
-
import type { Av3aContract } from "../../shared/contracts/av3a-api";
|
|
1
|
+
import type { AudioPlayInfo } from "../Player.js";
|
|
2
|
+
import type { Av3aContract } from "../../shared/contracts/av3a-api.js";
|
|
3
3
|
/**
|
|
4
4
|
* Typed client for the main-process `av3a` bridge (the player window).
|
|
5
5
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Av3aChannelServiceToRenderer } from "../../shared/contracts/av3a-process";
|
|
2
|
-
import type { Av3aTrackInfo } from "../../shared/contracts/av3a-api";
|
|
1
|
+
import type { Av3aChannelServiceToRenderer } from "../../shared/contracts/av3a-process.js";
|
|
2
|
+
import type { Av3aTrackInfo } from "../../shared/contracts/av3a-api.js";
|
|
3
3
|
/**
|
|
4
4
|
* Renderer end of the direct channel to the AV3A decode utility process.
|
|
5
5
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { AudioPlayInfo } from "../Player";
|
|
2
|
-
import type { PlaybackBackend, PlaybackEventSink } from "../PlaybackBackend";
|
|
1
|
+
import type { AudioPlayInfo } from "../Player.js";
|
|
2
|
+
import type { PlaybackBackend, PlaybackEventSink } from "../PlaybackBackend.js";
|
|
3
3
|
/**
|
|
4
4
|
* The AV3A decode backend. Owns an `Av3aPcmPlayer` (worklet playback, PCM
|
|
5
5
|
* resampling/downmix, seek/rate) plus the AV3A timeupdate clock, and raises
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PlaybackBackend, PlaybackEventSink } from "../PlaybackBackend";
|
|
1
|
+
import type { PlaybackBackend, PlaybackEventSink } from "../PlaybackBackend.js";
|
|
2
2
|
/**
|
|
3
3
|
* The media-element backend. Owns the hidden `<audio>` element and its
|
|
4
4
|
* `MediaElementAudioSourceNode` so its output flows through the shared WebAudio
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "./app";
|
|
2
|
-
import "./os";
|
|
3
|
-
import "./network";
|
|
4
|
-
import "./update";
|
|
5
|
-
import "./im";
|
|
6
|
-
import "./nimsys";
|
|
1
|
+
import "./app.js";
|
|
2
|
+
import "./os.js";
|
|
3
|
+
import "./network.js";
|
|
4
|
+
import "./update.js";
|
|
5
|
+
import "./im.js";
|
|
6
|
+
import "./nimsys.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import CallDispatcher from "../shared/CallDispatcher";
|
|
1
|
+
import CallDispatcher from "../shared/CallDispatcher.js";
|
|
2
2
|
export declare const dispatcher: CallDispatcher;
|
|
3
3
|
export declare const registerCallHandler: typeof dispatcher.registerHandler;
|
|
4
4
|
export declare const registerCallbackHandler: typeof dispatcher.registerCallbackHandler;
|
|
@@ -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;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PlaybackMode } from "../shared/types/playback-mode";
|
|
1
|
+
import type { PlaybackMode } from "../shared/types/playback-mode.js";
|
|
2
2
|
declare const bridgeApi: {
|
|
3
3
|
reportMode: (mode: string) => void;
|
|
4
4
|
onCommand: (handler: (mode: PlaybackMode) => Promise<void>) => void;
|
|
@@ -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
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Av3aPcmEvent, Av3aTrackInfo } from "./av3a-api";
|
|
1
|
+
import type { Av3aPcmEvent, Av3aTrackInfo } from "./av3a-api.js";
|
|
2
2
|
/**
|
|
3
3
|
* Messaging between the main process and the AV3A decode utility process
|
|
4
4
|
* (`process.parentPort` <-> `UtilityProcess.postMessage`).
|