@discord-player/plugin-host 8.0.0-dev.0 → 8.0.0-dev.2

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 (60) hide show
  1. package/README.md +199 -29
  2. package/dist/compat/base-extractor.d.ts +6 -0
  3. package/dist/compat/base-extractor.js.map +1 -1
  4. package/dist/compat/extractor-execution-context.js.map +1 -1
  5. package/dist/compat/extractor-plugin.js +109 -68
  6. package/dist/compat/extractor-plugin.js.map +1 -1
  7. package/dist/compat/utils.js.map +1 -1
  8. package/dist/errors.d.ts +0 -2
  9. package/dist/errors.js +0 -2
  10. package/dist/errors.js.map +1 -1
  11. package/dist/host.d.ts +24 -3
  12. package/dist/host.js +198 -50
  13. package/dist/host.js.map +1 -1
  14. package/dist/index.d.ts +5 -0
  15. package/dist/index.js +2 -0
  16. package/dist/index.js.map +1 -1
  17. package/dist/legacy-player.d.ts +1 -1
  18. package/dist/lyrics.d.ts +56 -0
  19. package/dist/lyrics.js +110 -0
  20. package/dist/lyrics.js.map +1 -0
  21. package/dist/media.d.ts +15 -0
  22. package/dist/media.js +193 -0
  23. package/dist/media.js.map +1 -0
  24. package/dist/plugins/execution-options.d.ts +2 -0
  25. package/dist/plugins/operation-dispatch.js +30 -11
  26. package/dist/plugins/operation-dispatch.js.map +1 -1
  27. package/dist/plugins/plugin-error.js.map +1 -1
  28. package/dist/plugins/registry-internals.d.ts +2 -2
  29. package/dist/plugins/registry.d.ts +48 -6
  30. package/dist/plugins/registry.js +180 -18
  31. package/dist/plugins/registry.js.map +1 -1
  32. package/dist/plugins/stream-resolver.js +24 -4
  33. package/dist/plugins/stream-resolver.js.map +1 -1
  34. package/dist/plugins/types.d.ts +28 -23
  35. package/dist/plugins/types.js.map +1 -1
  36. package/dist/protocol.d.ts +43 -3
  37. package/dist/protocol.js +11 -1
  38. package/dist/protocol.js.map +1 -1
  39. package/dist/providers/lrclib.d.ts +120 -0
  40. package/dist/providers/lrclib.js +183 -0
  41. package/dist/providers/lrclib.js.map +1 -0
  42. package/dist/remote.d.ts +29 -0
  43. package/dist/remote.js +142 -0
  44. package/dist/remote.js.map +1 -0
  45. package/dist/runtime.d.ts +2 -8
  46. package/dist/runtime.js +42 -44
  47. package/dist/runtime.js.map +1 -1
  48. package/dist/structures/search-result.js.map +1 -1
  49. package/dist/structures/track-types.d.ts +7 -3
  50. package/dist/structures/track.d.ts +6 -11
  51. package/dist/structures/track.js +10 -10
  52. package/dist/structures/track.js.map +1 -1
  53. package/dist/types.d.ts +4 -4
  54. package/dist/utils/legacy-serialization-schemas.d.ts +12 -0
  55. package/dist/utils/serialization-schemas.d.ts +18 -0
  56. package/dist/utils/serialization-schemas.js +6 -1
  57. package/dist/utils/serialization-schemas.js.map +1 -1
  58. package/dist/utils/serialization.js.map +1 -1
  59. package/docs/remedia-contract.md +55 -0
  60. package/package.json +5 -4
package/README.md CHANGED
@@ -17,6 +17,37 @@ The `@remedia/client` dependency supplies source descriptor types only.
17
17
  The official `@discord-player/extractor` collection is an optional, separate package.
18
18
  It is neither bundled nor automatically registered.
19
19
 
20
+ ## Using a host from a bot
21
+
22
+ Normal applications register plugins locally. A metadata-only client descriptor can
23
+ register an existing standalone provider without repeating its host configuration:
24
+
25
+ ```ts
26
+ const remoteSource = definePlugin({
27
+ id: 'example.source',
28
+ remoteHost: { hostId: 'sources-1', url: 'https://plugins.example.test', token: process.env.SOURCE_TOKEN },
29
+ });
30
+
31
+ const player = new Player({ ...audioOptions, plugins: [remoteSource()] });
32
+ const result = await player.search('some song');
33
+ await player.play(channel, result);
34
+ ```
35
+
36
+ Advanced clients may register every advertised provider with
37
+ `player.plugins.registerHost(hostOptions)`. The obsolete constructor `sourceHosts`
38
+ option has been removed. Registration validates live provider capabilities and
39
+ deployment identity; it does not install plugins on the service.
40
+
41
+ This requires `@remedia/client@0.1.0-dev.7` and a matching remote server configured
42
+ with the same `pluginHosts` ID and the `discord-player.source` / `source.stream`
43
+ operation. The bot searches over HTTP and sends an operation descriptor for play
44
+ and automatic crossfade staging. Encoded bytes flow directly from host to audio
45
+ node. Local sources run locally. Embedded nodes cannot play hosted Tracks.
46
+
47
+ See the [complete deployment example](https://discord-player.js.org/docs/v8/plugins/remote-hosts).
48
+ The direct HTTP examples below describe protocol consumers; a bot should use
49
+ `player.search()` and queue playback, without fetching media grants itself.
50
+
20
51
  ## Registration and direct execution
21
52
 
22
53
  ```ts
@@ -24,7 +55,9 @@ import { createSourcePluginHost, SOURCE_PLUGIN_ID } from '@discord-player/plugin
24
55
  import { MyExtractor } from './my-extractor.js';
25
56
  import { mySourcePlugin } from './my-source-plugin.js';
26
57
 
58
+ // Local-only handle() usage may omit hostId.
27
59
  const host = createSourcePluginHost({ name: 'My Source Host' });
60
+
28
61
  await host.extractors.register(MyExtractor);
29
62
  await host.plugins.register(mySourcePlugin());
30
63
 
@@ -33,15 +66,20 @@ const response = await host.handle({
33
66
  operation: 'source.search',
34
67
  input: { query: 'example' },
35
68
  });
69
+
36
70
  if (response.handled) console.log(response.result);
71
+
37
72
  // Or use typed source APIs directly:
38
73
  const result = await host.runtime.search('example');
39
74
  const track = result.first();
75
+
40
76
  if (track) {
41
77
  const source = await host.plugins.resolveStream(track);
78
+
42
79
  // Caller owns consumption and destruction of returned Readables.
43
80
  console.log(source);
44
81
  }
82
+
45
83
  await host.close();
46
84
  ```
47
85
 
@@ -64,11 +102,16 @@ import { serve } from '@hono/node-server';
64
102
  import { createSourcePluginHost } from '@discord-player/plugin-host';
65
103
  import { MyExtractor } from './my-extractor.js';
66
104
 
67
- const host = createSourcePluginHost({ name: 'Sources', publicUrl: 'http://localhost:3000' });
105
+ const host = createSourcePluginHost({ name: 'Sources', hostId: 'sources-eu-1', publicUrl: 'http://localhost:3000' });
106
+
68
107
  await host.extractors.register(MyExtractor);
108
+
69
109
  const app = new Hono();
110
+
70
111
  app.all('*', (c) => host.fetch(c.req.raw));
112
+
71
113
  const server = serve({ fetch: app.fetch, port: 3000 });
114
+
72
115
  process.once('SIGTERM', () => {
73
116
  server.close();
74
117
  void host.close();
@@ -85,12 +128,17 @@ import { createNodeMiddleware } from '@remedia/plugin-host/node';
85
128
  import { createSourcePluginHost } from '@discord-player/plugin-host';
86
129
  import { MyExtractor } from './my-extractor.js';
87
130
 
88
- const host = createSourcePluginHost({ name: 'Sources', publicUrl: 'http://localhost:3000' });
131
+ const host = createSourcePluginHost({ name: 'Sources', hostId: 'sources-eu-1', publicUrl: 'http://localhost:3000' });
132
+
89
133
  await host.extractors.register(MyExtractor);
134
+
90
135
  const app = express();
136
+
91
137
  app.use(createNodeMiddleware(host));
92
138
  app.use(express.json());
139
+
93
140
  const server = app.listen(3000);
141
+
94
142
  process.once('SIGTERM', () => {
95
143
  server.close();
96
144
  void host.close();
@@ -106,12 +154,11 @@ Configure `token`, `mediaTtlMs`, and `maxMediaTokens` through the host options.
106
154
 
107
155
  One aggregate registration, `discord-player.source`, advertises:
108
156
 
109
- | Operation | Input | Result |
110
- | ---------------- | ------------------------------- | ------------------------------------------ |
111
- | `source.search` | `{ query, options? }` | Metadata through normal provider matching |
112
- | `source.resolve` | `{ query, pluginId, options? }` | Metadata from an explicit provider |
113
- | `source.related` | `{ track }` | Related metadata from the track's provider |
114
- | `source.stream` | `{ track }` | Deferred Remedia media descriptor |
157
+ | Operation | Input | Result |
158
+ | ---------------- | --------------------- | ------------------------------------------ |
159
+ | `source.search` | `{ query, options? }` | Metadata through normal provider matching |
160
+ | `source.related` | `{ track }` | Related metadata from the track's provider |
161
+ | `source.stream` | `{ track }` | Deferred Remedia media descriptor |
115
162
 
116
163
  `source.stream` includes normal bridge fallback and post-stream transformations;
117
164
  internal operation handlers are not separate Remedia registrations. HTTP options
@@ -127,10 +174,15 @@ const response = await fetch('http://localhost:3000/remedia/v1/execute', {
127
174
  headers: { 'content-type': 'application/json' },
128
175
  body: JSON.stringify({ pluginId: SOURCE_PLUGIN_ID, operation: 'source.search', input: { query: 'example' } }),
129
176
  });
177
+
130
178
  if (!response.ok) throw new Error(`Source search failed: ${response.status}`);
179
+
131
180
  const search = (await response.json()) as { handled: boolean; result: PortableSourceResult };
181
+
132
182
  if (!search.handled) throw new Error('Unhandled search');
183
+
133
184
  const localModels = deserializeSourceResult(search.result);
185
+
134
186
  console.log(localModels.first());
135
187
 
136
188
  // Send the original portable representation back, including its optional state hint.
@@ -143,11 +195,16 @@ const mediaResponse = await fetch('http://localhost:3000/remedia/v1/execute', {
143
195
  input: { track: search.result.tracks[0] },
144
196
  }),
145
197
  });
198
+
146
199
  if (!mediaResponse.ok) throw new Error(`Source stream failed: ${mediaResponse.status}`);
200
+
147
201
  const media = (await mediaResponse.json()) as { handled: boolean; result: { url: string; expiresAtMs: number } };
202
+
148
203
  if (!media.handled) throw new Error('Unhandled media');
204
+
149
205
  // Redeem media.result.url before expiresAtMs; this is a short-lived, single-use grant.
150
206
  const bytes = await fetch(media.result.url);
207
+
151
208
  console.log(bytes.body);
152
209
  ```
153
210
 
@@ -160,17 +217,36 @@ Direct calls retain native descriptors; HTTP never returns nested Readables.
160
217
 
161
218
  ## Portable metadata and process-local state
162
219
 
163
- HTTP results contain version 1 Track and Playlist data. A `PortableSourceTrack`
164
- adds an optional opaque `sourceState` field. `deserializeSourceResult()` removes
165
- that transport extension before strict versioned deserialization and links the
166
- shared Track instances to their Playlist. For raw `deserialize()`, remove the
167
- `sourceState` extension first. Provider identity remains in `sourceReference`.
168
-
169
- The host retains original Track objects (including `raw.engine`, extractor
170
- identity and metadata callbacks) in a bounded cache: 10000 tracks and one hour by
171
- default, configurable with `maxTrackStates` and `trackStateTtlMs`. Expiration is
172
- checked on use; eviction releases references. Cache entries are invalidated by
173
- provider removal and host shutdown. No media streams are retained by this cache.
220
+ HTTP results contain version 1 Track and Playlist data. `deserializeSourceResult()`
221
+ retains the opaque `sourceState` token on the normal Track and links Playlist
222
+ instances. Pass `serializeSourceTrack(track)` to source operations; no second HTTP
223
+ payload needs to be retained. `serialize()` and `toJSON()` deliberately omit the
224
+ temporary token. Persistence and clones made through persistence reconstruct from
225
+ provider metadata. Ordinary queue/history insertion retains the same Track and its
226
+ token. Host identity persists in `sourceReference.hostId`, separate from
227
+ `sourceReference.pluginId` and the provider's source name/data.
228
+
229
+ HTTP hosts must configure a stable non-secret `hostId`, including deployments
230
+ that do not configure `publicUrl`. Construction with `publicUrl` requires it, and
231
+ `fetch()` rejects HTTP use without it. Local-only `handle()` hosts may omit it and
232
+ receive a generated process identifier that intentionally does not survive restarts. Two hosts
233
+ can use the same provider IDs, but cannot redeem one another's Tracks. The embedded
234
+ registry rejects hosted Tracks when used as local sources. DiscordPlayer routes them
235
+ through configured remote hosts and compatible Remedia nodes instead.
236
+ Do not put endpoints, bearer tokens or credentials in sourceReference.
237
+
238
+ The per-host FIFO cache defaults to 1000 Track states for ten minutes. Previous
239
+ 10000/one-hour defaults could retain substantial provider payloads and playlists.
240
+ Periodic cleanup runs even while idle (at most every 30 seconds), with additional
241
+ checks on use, provider lifetime changes and shutdown. Cached snapshots omit
242
+ Playlist links and metadata callbacks so one entry cannot retain the whole result
243
+ through those links. This is a count limit, not a byte memory guarantee: trusted
244
+ providers can still attach large engines. Tune limits for the deployment.
245
+
246
+ Concurrent remote playback receives copied engine/public metadata, never the
247
+ cached Track itself. Non-cloneable engines are reconstructed instead. Copies use
248
+ snapshot metadata rather than callbacks closing over the original Track. Direct
249
+ execution retains original object identity and the caller's ownership contract.
174
250
 
175
251
  After eviction, expiration, or restart, modern plugins receive reconstructed
176
252
  Track metadata and their portable sourceReference. Legacy extractors re-run
@@ -205,19 +281,113 @@ compatibility surface does not emulate the whole Player API.
205
281
 
206
282
  ## Remedia server integration boundary
207
283
 
208
- The inspected Remedia Rust sources do not implement plugin-host discovery or
209
- source operation routing. Creating a remote Remedia client does not register this
210
- host with an audio server. A bot can call this HTTP protocol explicitly and redeem
211
- the media descriptor, or pass a reachable descriptor URL to supported playback
212
- APIs before the grant expires. Automatic Rust-side routing still requires host
213
- configuration/discovery, authenticated operation execution, sourceReference
214
- round-tripping, cancellation, and timely media-grant redemption. No new Rust API,
215
- custom IPC transport or automatic remote registry is claimed by this package.
284
+ Remedia dev.7 supports generic host discovery, authenticated operation execution,
285
+ native decoding of single-use grants, and cancellation. Configure the deployment
286
+ in the server's `pluginHosts` list and in the bot plugin's `remoteHost` descriptor. Installing
287
+ `@remedia/plugin-host@0.1.0-dev.7` alone does not register a host with an audio node.
288
+
289
+ DiscordPlayer sends operation descriptors for playback and staged-next preparation;
290
+ the audio node invokes `source.stream` and consumes encoded bytes directly. The
291
+ bot uses HTTP only for metadata and never redeems a playback grant. Host affinity
292
+ is checked during session selection and before playback/staging. Embedded playback
293
+ continues to execute local registrations and rejects remote-host Tracks.
216
294
 
217
295
  ## Validation
218
296
 
219
297
  `pnpm build`, `pnpm typecheck`, `pnpm test`, `pnpm lint`, and `pnpm format:check`
220
- cover the workspace. Source tests use synthetic encoded bytes and local fixtures,
221
- without public media-provider access. CI builds the host before discord-player,
298
+ cover the workspace. Tests include the published optional extractor collection (SDK calls stubbed),
299
+ real HTTP disconnect/shutdown, and real FFmpeg decoding of generated MP3, Ogg/Opus
300
+ and faststart M4A. FFmpeg must be installed; CI installs it explicitly. No personal
301
+ media files or third-party service access are needed. CI builds the host before discord-player,
222
302
  includes its dist artifacts, and publishes it before dependent packages using the
223
303
  shared release inventory.
304
+
305
+ ## Remote media policy
306
+
307
+ `mediaPolicy` denies private, loopback, link-local, reserved and transition IP
308
+ ranges by default. DNS results are checked and the selected address is pinned to
309
+ the connection, preserving TLS hostname verification. Every redirect is checked;
310
+ TLS downgrades and URL user/password credentials are rejected. Optional
311
+ `allowedHosts` restricts exact hostnames. No inbound authorization or provider
312
+ request headers are copied to upstreams. Providers needing custom authorization
313
+ must return an encoded Readable opened by their trusted SDK. Plugins execute
314
+ trusted code and can open their own network/file resources; this policy does not
315
+ sandbox extractor `handle()` or provider-created streams.
316
+
317
+ File descriptors require explicit `allowedFileRoots`. Canonical paths are checked,
318
+ then regular files are opened through owned handles. Authorized roots and parent
319
+ directories must be administrator-owned; concurrent hostile filesystem mutation is
320
+ outside this policy's trust boundary. Default limits are 32 active streams, 512 MiB
321
+ per stream, 30 minutes total, five redirects and 30 seconds upstream socket idle.
322
+ Tune `maxConcurrent`, `maxBytes`, `timeoutMs`, and `allowPrivateNetworks` for trusted
323
+ private deployments. Buffers are already allocated by providers; the host bounds
324
+ output bytes but cannot undo that allocation. Streaming uses backpressure; abort,
325
+ consumer disconnect, byte/deadline errors and host shutdown release resources.
326
+ After headers, errors terminate the body/socket, never masquerade as successful
327
+ JSON responses. Use Remedia's Node middleware to connect network disconnects to
328
+ Fetch cancellation. Configure `token` and HTTPS for remote authorization.
329
+
330
+ Default proxy delivery resolves media on grant redemption. Expired provider
331
+ sources are rejected rather than fetching expired credentials; request a fresh
332
+ `source.stream` grant. Provider expiration survives materialization and stream
333
+ transforms. Grant expiration is a separate deadline managed by Remedia.
334
+ `mediaDelivery: 'direct-url'` enables direct delivery for explicitly declared
335
+ `directUrlProviders` only. Invoking an arbitrary `track.stream` handler may already
336
+ open a Readable, so unknown or mixed-source providers must stay deferred. Declare
337
+ only trusted providers whose handlers return URL metadata without opening media:
338
+
339
+ ```ts
340
+ const host = createSourcePluginHost({
341
+ name: 'Sources',
342
+ hostId: 'sources-eu-1',
343
+ publicUrl: 'https://sources.example.com',
344
+ mediaDelivery: 'direct-url',
345
+ directUrlProviders: ['example.url-provider'],
346
+ });
347
+ ```
348
+
349
+ These providers resolve URL metadata at `source.stream` invocation, never search.
350
+ The dispatcher checks active, unblocked transformations for the actual stream
351
+ owner. Applicable byte transforms force the existing secure proxy path, and run
352
+ once on redemption. Unrelated providers' transforms do not prevent direct delivery.
353
+ The check repeats after asynchronous URL preparation so newly registered transforms
354
+ cannot be skipped. A declining URL-only handler defers bridge resolution; a handler
355
+ that returns bytes despite its declaration fails explicitly and its stream is
356
+ destroyed, without a retry. Do not list legacy or mixed-result providers.
357
+
358
+ All other providers, including Readables, files and buffers, resolve and materialize
359
+ only when their grant is redeemed. There is no eager byte-source fallback or retained
360
+ live stream in an unredeemed grant. Cancellation, expiration, provider removal and
361
+ shutdown release transport resources; an old grant cannot bind a replacement
362
+ registration. Provider URL expiration remains intact. The consuming node must still
363
+ independently enforce its DNS/redirect policy for direct URLs. Authentication or
364
+ byte transformations requiring the host must use proxy delivery.
365
+
366
+ Single-use media grants reject Range requests. Remedia dev.7 redeems each grant with one
367
+ plain GET and feeds a bounded sequential queue to the decoder, so it never issues Range
368
+ requests, reopens or reconnects a grant. Seeking is forward-only. This does not add random
369
+ access or turn grant URLs into durable source references.
370
+ See [the Remedia integration contract](docs/remedia-contract.md) for the current
371
+ protocol and validation limits. Native Remedia playback and Discord voice delivery
372
+ remain outside this repository's HTTP/client integration tests.
373
+
374
+ ## Optional capabilities
375
+
376
+ `definePlugin()` has no kind discriminator. Its typed `OperationMap` includes
377
+ `lyrics.search` independently of source operations. A lyrics provider returns an
378
+ array of normalized records with `plain.available` and `synced.available` discriminants;
379
+ only synchronized records carry sorted `{ timestampMs, line }` values. The optional
380
+ `lrclibPlugin()` implementation lives here and is not automatically registered by
381
+ Discord Player. Legacy `BaseExtractor.resolveLyrics()` adapts into that same operation.
382
+
383
+ HTTP discovery advertises actual provider IDs, protocols, priorities and operation
384
+ handlers. `metadata.execute` carries a typed `MetadataRequest` for normalized search,
385
+ lyrics or related metadata. `source.search` remains the high-level search endpoint;
386
+ `source.resolve` was removed. Portable lyrics requests use versioned Track metadata
387
+ without expiring source-state hints. `source.stream` and native operation-source
388
+ playback retain their existing media policy, cancellation and grant behavior.
389
+
390
+ Metadata currently travels over direct HTTP. Remedia dev.7 can forward generic plugin
391
+ operations to server-configured hosts (`client.plugins.list` / `execute`), but Discord Player
392
+ does not use that path yet. `remote.ts` isolates this boundary for a future supported
393
+ transport without introducing a second search dispatcher.
@@ -1,3 +1,4 @@
1
+ import type { LyricsResult } from '../lyrics.js';
1
2
  import type { Readable } from 'node:stream';
2
3
  import type { SourceRuntimeEvents } from '../legacy-player.js';
3
4
  import type { Track } from '../structures/track.js';
@@ -30,6 +31,11 @@ export declare class BaseExtractor<Options extends object = object> {
30
31
  get identifier(): string;
31
32
  /** Obsolete demux support is unavailable. */
32
33
  get supportsDemux(): boolean;
34
+ /** Optional lyrics capability, adapted into the shared operation dispatcher.
35
+ * @param input Track metadata or a raw lookup query.
36
+ * @returns Lyrics records, or null when no lyrics were found.
37
+ */
38
+ resolveLyrics?(input: Track | string): Promise<LyricsResult | LyricsResult[] | null>;
33
39
  /** Acquire extractor resources. */
34
40
  activate(): Promise<void>;
35
41
  /** Release extractor resources. */
@@ -1 +1 @@
1
- {"version":3,"file":"base-extractor.js","sourceRoot":"","sources":["../../src/compat/base-extractor.ts"],"names":[],"mappings":"AAQA,qFAAqF;AACrF,MAAM,OAAO,aAAa;IAgBf,OAAO;IAEP,OAAO;IAjBhB,sDAAsD;IAC/C,MAAM,CAAC,UAAU,GAAG,uBAAuB,CAAC;IAEnD,oDAAoD;IAC7C,QAAQ,GAAG,CAAC,CAAC;IAEpB,0CAA0C;IACnC,SAAS,GAAa,EAAE,CAAC;IAEhC;;;OAGG;IACH;IACE,0CAA0C;IACnC,OAAkC;IACzC,8CAA8C;IACvC,OAAO,GAAY,EAAa;uBAFhC,OAAO;uBAEP,OAAO;IACb,CAAC;IAEJ,kCAAkC;IAClC,IAAW,UAAU;QACnB,OAAQ,IAAI,CAAC,WAAoC,CAAC,UAAU,CAAC;IAC/D,CAAC;IAED,6CAA6C;IAC7C,IAAW,aAAa;QACtB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,mCAAmC;IAC5B,KAAK,CAAC,QAAQ,KAAmB,CAAC;IAEzC,mCAAmC;IAC5B,KAAK,CAAC,UAAU,KAAmB,CAAC;IAE3C;;OAEG;IACI,KAAK,CAAC,WAAW,CAAC,OAAgB;QACvC,MAAM,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IAC3D,CAAC;IAED;;;OAGG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1
- {"version":3,"file":"extractor-execution-context.js","sourceRoot":"","sources":["../../src/compat/extractor-execution-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAInD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAG9D,iFAAiF;AACjF,MAAM,OAAO,yBAAyB;IAmBlB,MAAM;IAlBhB,cAAc,GAAG,IAAI,iBAAiB,EAAe,CAAC;IACtD,SAAS,GAAG,IAAI,UAAU,EAA8B,CAAC;IAEjE,qDAAqD;IACrD,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED,sCAAsC;IACtC,IAAW,IAAI;QACb,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;IAC7B,CAAC;IAED;;OAEG;IACH;IACE,0CAA0C;IAC1B,MAA2B;sBAA3B,MAAM;IACrB,CAAC;IAEJ;;OAEG;IACI,GAAG,CAAC,EAAU;QACnB,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChC,CAAC;IAED;;OAEG;IACI,YAAY,CAAC,EAAU;QAC5B,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChC,CAAC;IAED;;OAEG;IACI,UAAU,CAAC,EAAU;QAC1B,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,eAAe,EAAE,QAAQ,CAAC,EAAE,CAAC,IAAI,KAAK,CAAC;IACpE,CAAC;IAED;;OAEG;IACI,SAAS,CAAC,EAAU;QACzB,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;IAC9B,CAAC;IAED;;;;OAIG;IACI,KAAK,CAAC,QAAQ,CACnB,SAAY,EACZ,GAAG,I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,CAAC,GAAG,CAAC,IAAI,GAAG,EAAU,EAAE,QAAQ,CAAC,CAAC;QAE/D,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;QAC3D,CAAC;QAED,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,gBAAgB,EAAmD,CAAC;IACrH,CAAC;CACF"}
1
+ {"version":3,"file":"extractor-execution-context.js","sourceRoot":"","sources":["../../src/compat/extractor-execution-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAInD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAG9D,iFAAiF;AACjF,MAAM,OAAO,yBAAyB;IAoBlB,MAAM;IAnBhB,cAAc,GAAG,IAAI,iBAAiB,EAAe,CAAC;IAEtD,SAAS,GAAG,IAAI,UAAU,EAA8B,CAAC;IAEjE,qDAAqD;IACrD,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED,sCAAsC;IACtC,IAAW,IAAI;QACb,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;IAC7B,CAAC;IAED;;OAEG;IACH;IACE,0CAA0C;IAC1B,MAA2B;sBAA3B,MAAM;IACrB,CAAC;IAEJ;;OAEG;IACI,GAAG,CAAC,EAAU;QACnB,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChC,CAAC;IAED;;OAEG;IACI,YAAY,CAAC,EAAU;QAC5B,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChC,CAAC;IAED;;OAEG;IACI,UAAU,CAAC,EAAU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cAAc,EACd,EAAE,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,UAAU,EAAE,EACtD,EAAE,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,eAAe,EAAE,CACjD,CAAC;QACJ,MAAM,MAAM,GAAG,IAAI,CAAC,cAAc,CAAC,QAAQ,EAAE;YAC3C,CAAC,CAAC,MAAM,QAAQ,EAAE;YAClB,CAAC,CAAC,MAAM,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,GAAG,EAAU,EAAE,QAAQ,CAAC,CAAC;QAE/D,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;QAC3D,CAAC;QAED,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,gBAAgB,EAAmD,CAAC;IACrH,CAAC;CACF"}
@@ -1,5 +1,6 @@
1
1
  import { Readable } from 'node:stream';
2
2
  import { definePlugin } from '../plugins/types.js';
3
+ import { BaseExtractor } from './base-extractor.js';
3
4
  function checkLegacyStream(result) {
4
5
  if (result && typeof result === 'object' && '$fmt' in result && /^(?:pcm|opus)$/i.test(result.$fmt)) {
5
6
  result.stream.destroy();
@@ -29,80 +30,120 @@ export function createExtractorPlugin(instance, context, getBridgeAttempts, onAc
29
30
  };
30
31
  return definePlugin({
31
32
  id: instance.identifier,
32
- kind: 'source',
33
33
  setup: async (ctx) => {
34
34
  await instance.activate();
35
35
  onActivate();
36
+ if (instance.resolveLyrics) {
37
+ ctx.on('lyrics.search', async ({ input }) => {
38
+ const result = await instance.resolveLyrics?.(input);
39
+ return result == null ? null : Array.isArray(result) ? result : [result];
40
+ }, { priority: instance.priority });
41
+ }
36
42
  const metadata = { priority: instance.priority, protocols: instance.protocols };
37
- ctx.on('search.query.match', async ({ query, options, protocol }) => {
38
- if (protocol) {
39
- return instance.protocols.includes(protocol) ? { score: 100 } : null;
40
- }
41
- return (await instance.validate(query, options?.searchEngine ?? options?.source)) ? { score: 0 } : null;
42
- }, metadata);
43
- ctx.on('search.query.resolve', async ({ query, options, protocol }) => stamp(await instance.handle(query, {
44
- type: options?.searchEngine ?? options?.source,
45
- requestedBy: options?.requestedBy,
46
- requestOptions: options?.requestOptions,
47
- protocol,
48
- })), metadata);
49
- ctx.on('track.stream', async ({ track }) => {
50
- // Restored tracks reconstruct only the public legacy location fields.
51
- if (!track.raw.engine) {
52
- track.raw.engine = track.url;
53
- }
54
- track.queryType ??=
55
- typeof track.sourceReference?.data === 'object' &&
56
- track.sourceReference.data &&
57
- 'queryType' in track.sourceReference.data
58
- ? String(track.sourceReference.data.queryType ?? '')
59
- : undefined;
60
- return checkLegacyStream(await instance.stream(track));
61
- }, metadata);
62
- ctx.on('track.related', async ({ track, history }) => stamp(await instance.getRelatedTracks(track, history)), metadata);
63
- ctx.on('track.bridge', async ({ track, sourcePluginId }) => {
64
- const attempts = getBridgeAttempts();
65
- if (sourcePluginId === instance.identifier || attempts?.has(instance.identifier)) {
66
- return undefined;
67
- }
68
- attempts?.add(instance.identifier);
69
- const result = checkLegacyStream((await instance.bridge(track, context.get(sourcePluginId ?? '') ?? null)) ?? undefined);
70
- if (result === undefined) {
71
- return undefined;
72
- }
73
- track.bridgedExtractor = instance;
74
- // Object identity retains bridge ownership through nested legacy stream calls.
75
- return typeof result === 'string'
76
- ? /^https?:\/\//i.test(result)
77
- ? { url: result }
78
- : { file: result }
79
- : result instanceof Readable
80
- ? { stream: result }
81
- : result;
82
- }, metadata);
83
- ctx.on('stream.transform', async ({ track, stream }, { signal }) => ({
84
- track,
85
- stream: await new Promise((resolve, reject) => {
86
- const abort = () => reject(signal.reason);
87
- signal.addEventListener('abort', abort, { once: true });
88
- const next = (error, result) => {
89
- signal.removeEventListener('abort', abort);
90
- if (error) {
91
- reject(error);
92
- }
93
- else {
94
- resolve(result ?? stream);
95
- }
96
- };
97
- try {
98
- (track.bridgedExtractor ?? instance).handlePostStream(stream, next);
43
+ if (instance.handle !== BaseExtractor.prototype.handle &&
44
+ (instance.validate !== BaseExtractor.prototype.validate || instance.protocols.length > 0)) {
45
+ ctx.on('search.query.match', async ({ query, protocol, providerHint }) => {
46
+ if (protocol) {
47
+ return instance.protocols.includes(protocol) ? { score: 100 } : null;
48
+ }
49
+ return (await instance.validate(query, providerHint ?? (/^https?:\/\//i.test(query) ? 'arbitrary' : 'auto')))
50
+ ? { score: 0 }
51
+ : null;
52
+ }, metadata);
53
+ }
54
+ if (instance.handle !== BaseExtractor.prototype.handle) {
55
+ ctx.on('search.query.resolve', async ({ query, options, protocol, providerHint }) => {
56
+ const result = stamp(await instance.handle(query, {
57
+ type: providerHint ?? (/^https?:\/\//i.test(query) ? 'arbitrary' : 'auto'),
58
+ requestedBy: options?.requestedBy,
59
+ requestOptions: options?.requestOptions,
60
+ protocol,
61
+ }));
62
+ for (const track of result.tracks) {
63
+ track.queryType ??= providerHint ?? (/^https?:\/\//i.test(query) ? 'arbitrary' : 'auto');
64
+ if (track.sourceReference &&
65
+ track.sourceReference.data &&
66
+ typeof track.sourceReference.data === 'object' &&
67
+ !Array.isArray(track.sourceReference.data))
68
+ track.sourceReference.data.queryType = track.queryType ?? null;
69
+ }
70
+ return result;
71
+ }, metadata);
72
+ }
73
+ if (instance.stream !== BaseExtractor.prototype.stream) {
74
+ ctx.on('track.stream', async ({ track }) => {
75
+ // Restored tracks reconstruct only the public legacy location fields.
76
+ if (!track.raw.engine) {
77
+ track.raw.engine = track.url;
99
78
  }
100
- catch (error) {
101
- signal.removeEventListener('abort', abort);
102
- reject(error);
79
+ track.queryType ??=
80
+ typeof track.sourceReference?.data === 'object' &&
81
+ track.sourceReference.data &&
82
+ 'queryType' in track.sourceReference.data
83
+ ? String(track.sourceReference.data.queryType ?? '')
84
+ : undefined;
85
+ return checkLegacyStream(await instance.stream(track));
86
+ }, metadata);
87
+ }
88
+ if (instance.getRelatedTracks !== BaseExtractor.prototype.getRelatedTracks) {
89
+ ctx.on('track.related', async ({ track, history }) => stamp(await instance.getRelatedTracks(track, history ?? { tracks: [] })), metadata);
90
+ }
91
+ if (instance.bridge !== BaseExtractor.prototype.bridge) {
92
+ ctx.on('track.bridge', async ({ track, sourcePluginId }) => {
93
+ const attempts = getBridgeAttempts();
94
+ if (sourcePluginId === instance.identifier || attempts?.has(instance.identifier)) {
95
+ return undefined;
103
96
  }
104
- }),
105
- }), metadata);
97
+ attempts?.add(instance.identifier);
98
+ const result = checkLegacyStream((await instance.bridge(track, context.get(sourcePluginId ?? '') ?? null)) ?? undefined);
99
+ if (result === undefined) {
100
+ return undefined;
101
+ }
102
+ track.bridgedExtractor = instance;
103
+ // Object identity retains bridge ownership through nested legacy stream calls.
104
+ return typeof result === 'string'
105
+ ? /^https?:\/\//i.test(result)
106
+ ? { url: result }
107
+ : { file: result }
108
+ : result instanceof Readable
109
+ ? { stream: result }
110
+ : result;
111
+ }, metadata);
112
+ }
113
+ if (instance.handlePostStream !== BaseExtractor.prototype.handlePostStream) {
114
+ ctx.on('stream.transform', async ({ track, stream }, { signal }) => ({
115
+ track,
116
+ stream: await new Promise((resolve, reject) => {
117
+ signal.throwIfAborted();
118
+ const abort = () => {
119
+ stream.destroy();
120
+ reject(signal.reason);
121
+ };
122
+ signal.addEventListener('abort', abort, { once: true });
123
+ const next = (error, result) => {
124
+ signal.removeEventListener('abort', abort);
125
+ if (signal.aborted) {
126
+ result?.destroy();
127
+ reject(signal.reason);
128
+ return;
129
+ }
130
+ if (error) {
131
+ reject(error);
132
+ }
133
+ else {
134
+ resolve(result ?? stream);
135
+ }
136
+ };
137
+ try {
138
+ (track.bridgedExtractor ?? instance).handlePostStream(stream, next);
139
+ }
140
+ catch (error) {
141
+ signal.removeEventListener('abort', abort);
142
+ reject(error);
143
+ }
144
+ }),
145
+ }), metadata);
146
+ }
106
147
  },
107
148
  destroy: async () => {
108
149
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"extractor-plugin.js","sourceRoot":"","sources":["../../src/compat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,GAAG,IAAI;SAC3B,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,aAAa,CAAC,IAAoB;QAChC,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,GAAG,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QAE1C,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC;IAC/I,CAAC;CACF,CAAC"}
package/dist/errors.d.ts CHANGED
@@ -4,8 +4,6 @@ export declare const DiscordPlayerErrorCode: {
4
4
  readonly QueueCapacity: 'ERR_QUEUE_CAPACITY';
5
5
  /** A required queue, session, or track could not be resolved. */
6
6
  readonly NoResult: 'ERR_NO_RESULT';
7
- /** The installed Remedia client does not provide a requested capability. */
8
- readonly UnsupportedRemediaCapability: 'ERR_UNSUPPORTED_REMEDIA_CAPABILITY';
9
7
  /** A track has no source plugin to resolve a Remedia source. */
10
8
  readonly SourceUnavailable: 'ERR_SOURCE_UNAVAILABLE';
11
9
  /** Data could not be serialized or reconstructed. */