@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,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
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { PlaybackMode } from "./types/playback-mode";
|
|
1
|
+
import type { PlaybackMode } from "./types/playback-mode.js";
|
|
2
2
|
export declare function isPlaybackMode(mode: unknown): mode is PlaybackMode;
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic per-realm plugin lifecycle.
|
|
3
|
+
*
|
|
4
|
+
* Desired state is persisted intent. Runtime state is the observed truth about
|
|
5
|
+
* one realm instance. The reconciler serializes operations: a single
|
|
6
|
+
* activation or cleanup runs at a time, and timeouts are reported rather than
|
|
7
|
+
* starting overlapping work that the host cannot actually cancel.
|
|
8
|
+
*/
|
|
9
|
+
/** @internal */
|
|
10
|
+
export interface PluginDesiredState {
|
|
11
|
+
enabled: boolean;
|
|
12
|
+
revision: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* In-process lifecycle state names.
|
|
16
|
+
*
|
|
17
|
+
* Deliberately separate from the manager contract. Both sets carry the internal
|
|
18
|
+
* marker to flag them as unstable host internals rather than supported plugin
|
|
19
|
+
* API; the generated package publishes them because it mirrors the host
|
|
20
|
+
* declaration tree. The serializer maps these values onto the IPC-facing enums.
|
|
21
|
+
*/
|
|
22
|
+
/** @internal */
|
|
23
|
+
export declare const LifecycleStateKind: {
|
|
24
|
+
readonly Stopped: "stopped";
|
|
25
|
+
readonly Starting: "starting";
|
|
26
|
+
readonly Running: "running";
|
|
27
|
+
readonly Stopping: "stopping";
|
|
28
|
+
readonly Failed: "failed";
|
|
29
|
+
readonly Hung: "hung";
|
|
30
|
+
readonly Abandoned: "abandoned";
|
|
31
|
+
readonly Disposed: "disposed";
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* In-process lifecycle state names.
|
|
35
|
+
*
|
|
36
|
+
* Deliberately separate from the manager contract. Both sets carry the internal
|
|
37
|
+
* marker to flag them as unstable host internals rather than supported plugin
|
|
38
|
+
* API; the generated package publishes them because it mirrors the host
|
|
39
|
+
* declaration tree. The serializer maps these values onto the IPC-facing enums.
|
|
40
|
+
*/
|
|
41
|
+
/** @internal */
|
|
42
|
+
export type LifecycleStateKind = "stopped" | "starting" | "running" | "stopping" | "failed" | "hung" | "abandoned" | "disposed";
|
|
43
|
+
export declare namespace LifecycleStateKind {
|
|
44
|
+
type Stopped = "stopped";
|
|
45
|
+
type Starting = "starting";
|
|
46
|
+
type Running = "running";
|
|
47
|
+
type Stopping = "stopping";
|
|
48
|
+
type Failed = "failed";
|
|
49
|
+
type Hung = "hung";
|
|
50
|
+
type Abandoned = "abandoned";
|
|
51
|
+
type Disposed = "disposed";
|
|
52
|
+
}
|
|
53
|
+
/** @internal */
|
|
54
|
+
export declare const LifecycleFailureStage: {
|
|
55
|
+
readonly Load: "load";
|
|
56
|
+
readonly Activate: "activate";
|
|
57
|
+
readonly Deactivate: "deactivate";
|
|
58
|
+
};
|
|
59
|
+
/** @internal */
|
|
60
|
+
export type LifecycleFailureStage = "load" | "activate" | "deactivate";
|
|
61
|
+
export declare namespace LifecycleFailureStage {
|
|
62
|
+
type Load = "load";
|
|
63
|
+
type Activate = "activate";
|
|
64
|
+
type Deactivate = "deactivate";
|
|
65
|
+
}
|
|
66
|
+
/** @internal */
|
|
67
|
+
export declare const LifecycleAbandonReason: {
|
|
68
|
+
readonly RealmDestroyed: "realm-destroyed";
|
|
69
|
+
readonly ShutdownDeadline: "shutdown-deadline";
|
|
70
|
+
};
|
|
71
|
+
/** @internal */
|
|
72
|
+
export type LifecycleAbandonReason = "realm-destroyed" | "shutdown-deadline";
|
|
73
|
+
export declare namespace LifecycleAbandonReason {
|
|
74
|
+
type RealmDestroyed = "realm-destroyed";
|
|
75
|
+
type ShutdownDeadline = "shutdown-deadline";
|
|
76
|
+
}
|
|
77
|
+
/** @internal */
|
|
78
|
+
export declare const PluginCleanupReason: {
|
|
79
|
+
readonly Disabled: "disabled";
|
|
80
|
+
readonly Retry: "retry";
|
|
81
|
+
readonly Shutdown: "shutdown";
|
|
82
|
+
};
|
|
83
|
+
/** @internal */
|
|
84
|
+
export type PluginCleanupReason = "disabled" | "retry" | "shutdown";
|
|
85
|
+
export declare namespace PluginCleanupReason {
|
|
86
|
+
type Disabled = "disabled";
|
|
87
|
+
type Retry = "retry";
|
|
88
|
+
type Shutdown = "shutdown";
|
|
89
|
+
}
|
|
90
|
+
/** @internal */
|
|
91
|
+
interface RuntimeStateBase {
|
|
92
|
+
desiredRevision: number;
|
|
93
|
+
}
|
|
94
|
+
/** @internal */
|
|
95
|
+
export type LifecycleRuntimeState<Module> = ({
|
|
96
|
+
kind: "stopped";
|
|
97
|
+
} & RuntimeStateBase) | ({
|
|
98
|
+
kind: "starting";
|
|
99
|
+
attempt: number;
|
|
100
|
+
startedAt: number;
|
|
101
|
+
timedOut: boolean;
|
|
102
|
+
} & RuntimeStateBase) | ({
|
|
103
|
+
kind: "running";
|
|
104
|
+
attempt: number;
|
|
105
|
+
module: Module;
|
|
106
|
+
} & RuntimeStateBase) | ({
|
|
107
|
+
kind: "stopping";
|
|
108
|
+
attempt: number;
|
|
109
|
+
module: Module;
|
|
110
|
+
reason: PluginCleanupReason;
|
|
111
|
+
} & RuntimeStateBase) | ({
|
|
112
|
+
kind: "failed";
|
|
113
|
+
attempt: number;
|
|
114
|
+
stage: LifecycleFailureStage;
|
|
115
|
+
error: unknown;
|
|
116
|
+
module?: Module;
|
|
117
|
+
retryable: boolean;
|
|
118
|
+
} & RuntimeStateBase) | ({
|
|
119
|
+
kind: "hung";
|
|
120
|
+
attempt: number;
|
|
121
|
+
stage: LifecycleFailureStage;
|
|
122
|
+
since: number;
|
|
123
|
+
module?: Module;
|
|
124
|
+
} & RuntimeStateBase) | ({
|
|
125
|
+
kind: "abandoned";
|
|
126
|
+
attempt: number;
|
|
127
|
+
stage: LifecycleFailureStage;
|
|
128
|
+
reason: LifecycleAbandonReason;
|
|
129
|
+
} & RuntimeStateBase) | ({
|
|
130
|
+
kind: "disposed";
|
|
131
|
+
} & RuntimeStateBase);
|
|
132
|
+
/** @internal */
|
|
133
|
+
export declare const PluginDisposeStatus: {
|
|
134
|
+
readonly Stopped: "stopped";
|
|
135
|
+
readonly CleanupFailed: "cleanup-failed";
|
|
136
|
+
readonly Abandoned: "abandoned";
|
|
137
|
+
};
|
|
138
|
+
/** @internal */
|
|
139
|
+
export type PluginDisposeStatus = "stopped" | "cleanup-failed" | "abandoned";
|
|
140
|
+
export declare namespace PluginDisposeStatus {
|
|
141
|
+
type Stopped = "stopped";
|
|
142
|
+
type CleanupFailed = "cleanup-failed";
|
|
143
|
+
type Abandoned = "abandoned";
|
|
144
|
+
}
|
|
145
|
+
/** @internal */
|
|
146
|
+
export interface PluginDisposeResult {
|
|
147
|
+
status: PluginDisposeStatus;
|
|
148
|
+
}
|
|
149
|
+
/** @internal */
|
|
150
|
+
export declare class LifecycleTimeoutError extends Error {
|
|
151
|
+
constructor(message: string);
|
|
152
|
+
}
|
|
153
|
+
/** @internal */
|
|
154
|
+
export interface LifecycleAdapter<Module> {
|
|
155
|
+
load(): Promise<Module>;
|
|
156
|
+
activate(module: Module): void | Promise<void>;
|
|
157
|
+
deactivate(module: Module): void | Promise<void>;
|
|
158
|
+
}
|
|
159
|
+
/** @internal */
|
|
160
|
+
export interface LifecycleSnapshot<Module> {
|
|
161
|
+
desired: PluginDesiredState;
|
|
162
|
+
state: LifecycleRuntimeState<Module>;
|
|
163
|
+
attempt: number;
|
|
164
|
+
module?: Module;
|
|
165
|
+
error?: unknown;
|
|
166
|
+
}
|
|
167
|
+
/** @internal */
|
|
168
|
+
export interface LifecycleOptions<Module> {
|
|
169
|
+
adapter: LifecycleAdapter<Module>;
|
|
170
|
+
/** Soft activation and cleanup deadline. */
|
|
171
|
+
timeoutMs?: number;
|
|
172
|
+
onChange?: (snapshot: LifecycleSnapshot<Module>) => void;
|
|
173
|
+
}
|
|
174
|
+
/** @internal */
|
|
175
|
+
export declare class RealmLifecycle<Module> {
|
|
176
|
+
private desired;
|
|
177
|
+
private state;
|
|
178
|
+
private module;
|
|
179
|
+
private attempt;
|
|
180
|
+
private error;
|
|
181
|
+
private activation;
|
|
182
|
+
private cleanupTask;
|
|
183
|
+
private timeout;
|
|
184
|
+
private running;
|
|
185
|
+
private pendingKick;
|
|
186
|
+
private retryRequested;
|
|
187
|
+
private cleanupRetryRequested;
|
|
188
|
+
private disposed;
|
|
189
|
+
private readonly adapter;
|
|
190
|
+
private readonly timeoutMs;
|
|
191
|
+
private readonly onChange?;
|
|
192
|
+
private readonly listeners;
|
|
193
|
+
constructor(options: LifecycleOptions<Module>);
|
|
194
|
+
get snapshot(): LifecycleSnapshot<Module>;
|
|
195
|
+
get loadedModule(): Module | undefined;
|
|
196
|
+
get desiredState(): PluginDesiredState;
|
|
197
|
+
/** Apply a committed desired state. Older revisions are ignored. */
|
|
198
|
+
applyDesiredState(next: PluginDesiredState): void;
|
|
199
|
+
enable(revision?: number): void;
|
|
200
|
+
disable(revision?: number): void;
|
|
201
|
+
/** Ask for a fresh attempt without changing desired state. */
|
|
202
|
+
retry(): void;
|
|
203
|
+
/** Resolve once the predicate matches, or reject on a wait timeout. */
|
|
204
|
+
waitFor(predicate: (snapshot: LifecycleSnapshot<Module>) => boolean, waitMs?: number): Promise<LifecycleSnapshot<Module>>;
|
|
205
|
+
dispose(deadlineMs?: number): Promise<PluginDisposeResult>;
|
|
206
|
+
private kick;
|
|
207
|
+
private reconcile;
|
|
208
|
+
private startActivation;
|
|
209
|
+
private onActivationTimeout;
|
|
210
|
+
private settleActivation;
|
|
211
|
+
private runCleanup;
|
|
212
|
+
private abandon;
|
|
213
|
+
private clearTimeout;
|
|
214
|
+
private setState;
|
|
215
|
+
private emit;
|
|
216
|
+
}
|
|
217
|
+
export {};
|
|
@@ -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 preload-realm module is handed. */
|
|
4
|
+
export type PluginRuntime = PreloadRealmRuntime;
|
|
5
|
+
/**
|
|
6
|
+
* The named exports a plugin's preload entry must provide.
|
|
7
|
+
*
|
|
8
|
+
* Preload entries are evaluated as CJS bundles; the plugin exposes the same
|
|
9
|
+
* `activate`/`deactivate` lifecycle as the main realm.
|
|
10
|
+
*/
|
|
11
|
+
export type PluginModule = PreloadRealmModule;
|
|
@@ -4,29 +4,66 @@
|
|
|
4
4
|
* The host only passes the registry through to plugins; precise per-module
|
|
5
5
|
* types live in the generated `@open-orpheus/plugin-api` package.
|
|
6
6
|
*/
|
|
7
|
-
import type { RegistryLoad } from "../../../../registry-map";
|
|
7
|
+
import type { RegistryLoad } from "../../../../registry-map.js";
|
|
8
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]>>;
|
|
9
16
|
/**
|
|
10
17
|
* Lazy access to a realm's host module surface.
|
|
11
18
|
*
|
|
12
19
|
* Every module is imported on demand; the registry itself has no static
|
|
13
20
|
* imports and therefore no initialization side effects.
|
|
14
21
|
*/
|
|
22
|
+
type RegistryLoader = (...args: never[]) => unknown;
|
|
15
23
|
export type Registry<Load extends RegistryLoad = RegistryLoad> = {
|
|
16
24
|
/** Import a module. Resolves immediately for modules that are already evaluated. */
|
|
17
|
-
load<Key extends keyof Load>(key: Key): ReturnType<Load[Key]
|
|
25
|
+
load<Key extends keyof Load>(key: Key): ReturnType<Extract<Load[Key], RegistryLoader>>;
|
|
18
26
|
/** Every key this registry can serve. */
|
|
19
27
|
keys(): Array<keyof Load>;
|
|
20
28
|
};
|
|
29
|
+
/** @internal */
|
|
21
30
|
export declare function createRegistry<Load extends RegistryLoad>(lazyModules: Load): Registry<Load>;
|
|
22
31
|
/**
|
|
23
32
|
* Plugin-contributed exports for one realm, keyed by plugin id.
|
|
24
33
|
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
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.
|
|
27
37
|
*/
|
|
28
38
|
export interface PluginRegistry {
|
|
29
39
|
load<T = unknown>(id: string): Promise<T>;
|
|
40
|
+
whenActive<T = unknown>(id: string): Promise<T>;
|
|
30
41
|
keys(): string[];
|
|
31
42
|
}
|
|
32
|
-
|
|
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 {};
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
-
export declare
|
|
1
|
+
export declare const NcaeType: {
|
|
2
2
|
/** JSON effect parameters. */
|
|
3
|
-
Json
|
|
3
|
+
readonly Json: 1;
|
|
4
4
|
/** WAV impulse response (convolution data). */
|
|
5
|
-
Wav
|
|
5
|
+
readonly Wav: 2;
|
|
6
|
+
readonly [x: number]: string;
|
|
7
|
+
};
|
|
8
|
+
export type NcaeType = 1 | 2;
|
|
9
|
+
export declare namespace NcaeType {
|
|
10
|
+
/** JSON effect parameters. */
|
|
11
|
+
type Json = 1;
|
|
12
|
+
/** WAV impulse response (convolution data). */
|
|
13
|
+
type Wav = 2;
|
|
6
14
|
}
|
|
7
15
|
export interface NcaeHeader {
|
|
8
16
|
/** Raw payload size as declared in the file (before decompression). */
|
package/dist/preload/index.d.ts
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
// The plugin-facing type surface. Generated from the host; contains no
|
|
3
3
|
// references back to the host repository.
|
|
4
4
|
|
|
5
|
-
export type {
|
|
6
|
-
export type { PluginRegistry, Registry } from "./host/src/shared/plugin/registry";
|
|
7
|
-
export type { RegistryLoad } from "./registry-map";
|
|
5
|
+
export type { PluginModule, PluginRuntime } from "./host/src/shared/plugin/realms/preload/index.js";
|
|
6
|
+
export type { LoadedModule, PluginRegistry, Registry } from "./host/src/shared/plugin/registry.js";
|
|
7
|
+
export type { RegistryLoad } from "./registry-map.js";
|