@deadair/plugin-sdk 0.31.2 → 0.32.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/README.md CHANGED
@@ -25,6 +25,7 @@ A plugin extends deadair by declaring capabilities:
25
25
  | `weather` | say what it is like outside: a place in, measurements out |
26
26
  | `almanac` | say what happened on a date: a month and a day in, entries out |
27
27
  | `scrobble` | report what the station played to somebody else's service |
28
+ | `messaging` | talk to people on a chat platform: messages in, messages out |
28
29
  | `oauth` | hold operator tokens, obtained through the host's redirect |
29
30
 
30
31
  There is no second axis. `capabilities` is the whole declaration, and the host
@@ -799,6 +800,59 @@ service that is down and a date with nothing on it are one outcome to the caller
799
800
  A day that has events and no births is NOT one of those and is answered — whether
800
801
  that is enough to say anything is the station's decision.
801
802
 
803
+ ## Talking on a chat platform
804
+
805
+ A `messaging` plugin connects the station to Telegram, Slack, Discord or
806
+ anything else people chat on. It has two methods and two optional ones:
807
+
808
+ ```ts
809
+ async receive(query: MessagingReceiveQuery): Promise<MessagingReceiveResult> {
810
+ const updates = await this.poll(query.cursor, query.waitMs); // your platform's long poll
811
+ return {
812
+ messages: updates.filter(u => this.listensIn(u.chat)).map(toInboundMessage),
813
+ cursor: updates.length > 0 ? String(updates.at(-1).id + 1) : undefined,
814
+ };
815
+ }
816
+
817
+ async send(message: OutboundMessage): Promise<MessagingSendResult> {
818
+ const answer = await this.post(message.chatId, escapeFor(this.platform, message.text));
819
+ return answer.ok ? { delivered: true } : { delivered: false, reason: answer.summary, retryable: answer.status >= 500 };
820
+ }
821
+ ```
822
+
823
+ Four things about it are easy to get wrong.
824
+
825
+ **The host asks, and you never push.** A plugin has no inbound HTTP and no way
826
+ to call the station, so the host calls `receive` in a loop of its own, one call
827
+ at a time, and stores the cursor you return. Hold the call open for up to
828
+ `waitMs` where your platform has a long poll. Advance the cursor past everything
829
+ the platform delivered, including what you filtered out, or the same messages
830
+ come back forever. No cursor at all means "from now", never "replay everything".
831
+
832
+ **Which chats count is yours to decide.** Chat ids are your platform's
833
+ vocabulary, so the list of chats the station listens in is your configuration,
834
+ and anything you return from `receive` is something the host acts on. Drop
835
+ messages from bots, including your own.
836
+
837
+ **What people write is untrusted.** Pass `text` through verbatim and let the
838
+ host treat it as data. Never reshape it into something that reads like the
839
+ station's own words.
840
+
841
+ **Outbound text is plain, and escaping is yours.** Only you know which
842
+ characters your platform treats as formatting. Classify refusals on
843
+ `retryable` exactly as a scrobble plugin does: a rate limit or a 5xx is worth
844
+ another go, a chat the bot was removed from is not, and when unsure say no.
845
+
846
+ **Buttons come back as actions.** An `OutboundMessage` may carry `buttons`
847
+ (`{ id, label, value? }`). A press comes back from `receive` as a message with
848
+ `action: { id, value }` and empty `text`, exactly as they were sent; how they
849
+ travel through your platform is yours to encode and decode. A platform with no
850
+ buttons renders them as text or drops them.
851
+
852
+ `announceTargets()` says which chats want which announcements (today only
853
+ `nowPlaying`); leave it out and the station only ever answers when spoken to.
854
+ `accepting()` is the operator's off switch, as it is for scrobbling.
855
+
802
856
  ## Music providers
803
857
 
804
858
  A `music-provider` declares any subset of four sub-capabilities and lists the
@@ -831,6 +885,13 @@ ones it implements in `manifest.capabilities`:
831
885
  account do, `madeByProvider` for a playlist the service made itself, such as
832
886
  an editorial list or Discover Weekly) and the host decides what to show.
833
887
 
888
+ `playlistIdFromUrl` is optional, and it is how an operator imports a playlist
889
+ the account does not list: they paste a link, the host asks every catalog
890
+ provider whose it is, and the first to claim it is asked for its tracks with
891
+ the id it answered. Keep it a pure parse of the text, with no network and no
892
+ host, and answer `undefined` for anything you are not sure is yours, because
893
+ the first claim wins.
894
+
834
895
  - **`stream`** — `resolveStreamUrl`: hand back a complete URL the audio consumer
835
896
  can fetch directly, carrying its own authentication, because it is fetched
836
897
  with no headers from us. A provider that cannot answer it plays its own audio
@@ -42,6 +42,7 @@ import type { ChartDescriptor, ChartEntry, ChartQuery } from './capabilities/cha
42
42
  import type { NarrationPart, NarrationPiece, NarrationPiecesQuery, NarrationSeries, NarrationText, NarrationTextQuery } from './capabilities/narration.js';
43
43
  import type { NewsFeedDescriptor, NewsItem, NewsQuery } from './capabilities/news.js';
44
44
  import type { PodcastAudio, PodcastDirectoryEntry, PodcastDirectoryQuery, PodcastEpisode, PodcastEpisodesQuery, PodcastShow } from './capabilities/podcast.js';
45
+ import type { InboundMessage, MessagingAction, MessagingAnnounceTarget, MessagingButton, MessagingReceiveQuery, MessagingReceiveResult, MessagingSendResult, MessagingSender, OutboundMessage } from './capabilities/messaging.js';
45
46
  import type { ScrobblePlay, ScrobbleRejection, ScrobbleResult } from './capabilities/scrobble.js';
46
47
  import type { SearchQuery, SearchResult } from './capabilities/search.js';
47
48
  import type { ArtistTrack, SimilarArtist } from './capabilities/similarity.js';
@@ -180,6 +181,15 @@ export type AssertAllBoundaryPayloadsAreJsonSafe = AssertAllTrue<{
180
181
  ScrobblePlay: IsJsonSafe<ScrobblePlay>;
181
182
  ScrobbleRejection: IsJsonSafe<ScrobbleRejection>;
182
183
  ScrobbleResult: IsJsonSafe<ScrobbleResult>;
184
+ MessagingSender: IsJsonSafe<MessagingSender>;
185
+ MessagingAction: IsJsonSafe<MessagingAction>;
186
+ MessagingButton: IsJsonSafe<MessagingButton>;
187
+ InboundMessage: IsJsonSafe<InboundMessage>;
188
+ MessagingReceiveQuery: IsJsonSafe<MessagingReceiveQuery>;
189
+ MessagingReceiveResult: IsJsonSafe<MessagingReceiveResult>;
190
+ OutboundMessage: IsJsonSafe<OutboundMessage>;
191
+ MessagingSendResult: IsJsonSafe<MessagingSendResult>;
192
+ MessagingAnnounceTarget: IsJsonSafe<MessagingAnnounceTarget>;
183
193
  SpeechLimits: IsJsonSafe<SpeechLimits>;
184
194
  }>;
185
195
  /**
@@ -187,7 +197,7 @@ export type AssertAllBoundaryPayloadsAreJsonSafe = AssertAllTrue<{
187
197
  * registry-coverage test can compare it against what is actually exported
188
198
  * from the boundary source files.
189
199
  */
190
- export declare const JSON_SAFE_PAYLOAD_TYPES: readonly ["PluginConnectionResult", "PluginPermissions", "NetworkPermissionHost", "NetworkPermissionFromConfig", "PluginGrantRequest", "ConfigField", "ConfigFieldOption", "ConfigFieldColumn", "ConfigFieldPreset", "PluginManifest", "ProviderTrack", "ProviderPlaylist", "ProviderStream", "TrackFetchSession", "TrackFetchRequest", "PlaylistTracksRequest", "SearchTracksOptions", "ListPlaylistsOptions", "GetPlaylistTracksOptions", "PlaybackState", "TrackRef", "ArtistRef", "AlbumRef", "ExternalId", "ExternalLink", "SourceDocument", "TrackEnrichment", "ArtistEnrichment", "AlbumEnrichment", "SpeechRequest", "SpeechVoice", "LlmMessage", "LlmToolDeclaration", "LlmToolCall", "LlmUsage", "LlmRequest", "LlmResult", "LlmModelInfo", "AnalysisRef", "AudioJoin", "AudioOverlay", "TrackCuePoints", "TrackLoudness", "TrackTaggedLoudness", "TrackAnalysis", "ChartDescriptor", "ChartQuery", "ChartEntry", "NewsFeedDescriptor", "NewsQuery", "NewsItem", "NarrationSeries", "NarrationPiece", "NarrationPart", "NarrationText", "NarrationPiecesQuery", "NarrationTextQuery", "PodcastShow", "PodcastAudio", "PodcastEpisode", "PodcastEpisodesQuery", "PodcastDirectoryQuery", "PodcastDirectoryEntry", "SimilarArtist", "ArtistTrack", "SearchQuery", "SearchResult", "WeatherQuery", "WeatherConditions", "WeatherDay", "WeatherReading", "AlmanacQuery", "AlmanacSubject", "AlmanacEntry", "AlmanacDay", "ScrobblePlay", "ScrobbleRejection", "ScrobbleResult", "SpeechLimits"];
200
+ export declare const JSON_SAFE_PAYLOAD_TYPES: readonly ["PluginConnectionResult", "PluginPermissions", "NetworkPermissionHost", "NetworkPermissionFromConfig", "PluginGrantRequest", "ConfigField", "ConfigFieldOption", "ConfigFieldColumn", "ConfigFieldPreset", "PluginManifest", "ProviderTrack", "ProviderPlaylist", "ProviderStream", "TrackFetchSession", "TrackFetchRequest", "PlaylistTracksRequest", "SearchTracksOptions", "ListPlaylistsOptions", "GetPlaylistTracksOptions", "PlaybackState", "TrackRef", "ArtistRef", "AlbumRef", "ExternalId", "ExternalLink", "SourceDocument", "TrackEnrichment", "ArtistEnrichment", "AlbumEnrichment", "SpeechRequest", "SpeechVoice", "LlmMessage", "LlmToolDeclaration", "LlmToolCall", "LlmUsage", "LlmRequest", "LlmResult", "LlmModelInfo", "AnalysisRef", "AudioJoin", "AudioOverlay", "TrackCuePoints", "TrackLoudness", "TrackTaggedLoudness", "TrackAnalysis", "ChartDescriptor", "ChartQuery", "ChartEntry", "NewsFeedDescriptor", "NewsQuery", "NewsItem", "NarrationSeries", "NarrationPiece", "NarrationPart", "NarrationText", "NarrationPiecesQuery", "NarrationTextQuery", "PodcastShow", "PodcastAudio", "PodcastEpisode", "PodcastEpisodesQuery", "PodcastDirectoryQuery", "PodcastDirectoryEntry", "SimilarArtist", "ArtistTrack", "SearchQuery", "SearchResult", "WeatherQuery", "WeatherConditions", "WeatherDay", "WeatherReading", "AlmanacQuery", "AlmanacSubject", "AlmanacEntry", "AlmanacDay", "ScrobblePlay", "ScrobbleRejection", "ScrobbleResult", "MessagingSender", "MessagingAction", "MessagingButton", "InboundMessage", "MessagingReceiveQuery", "MessagingReceiveResult", "OutboundMessage", "MessagingSendResult", "MessagingAnnounceTarget", "SpeechLimits"];
191
201
  /**
192
202
  * Boundary interfaces that are deliberately NOT payloads: they describe
193
203
  * methods, so they carry functions by definition and can never be JSON-safe.
@@ -197,7 +207,7 @@ export declare const JSON_SAFE_PAYLOAD_TYPES: readonly ["PluginConnectionResult"
197
207
  * interfaces explicitly is what makes "is this a payload or a contract?" a
198
208
  * conscious decision for anyone adding one, rather than a silent omission.
199
209
  */
200
- export declare const BOUNDARY_METHOD_TYPES: readonly ["PluginLogger", "PluginStorage", "PluginSecrets", "PluginConfigAccess", "PluginOAuth", "PluginEvents", "PluginTrackFetcher", "PluginHost", "PluginLifecycle", "MusicProviderCatalog", "MusicProviderStream", "MusicProviderSteer", "MusicProviderOAuth", "MusicProvider", "EnrichmentProvider", "SpeechPluginInstance", "LlmPluginInstance", "AnalysisProvider", "MixerProvider", "ChartsProvider", "NewsProvider", "NarrationProvider", "PodcastProvider", "SimilarityProvider", "SearchProvider", "WeatherProvider", "AlmanacProvider", "ScrobbleProvider"];
210
+ export declare const BOUNDARY_METHOD_TYPES: readonly ["PluginLogger", "PluginStorage", "PluginSecrets", "PluginConfigAccess", "PluginOAuth", "PluginEvents", "PluginTrackFetcher", "PluginHost", "PluginLifecycle", "MusicProviderCatalog", "MusicProviderStream", "MusicProviderSteer", "MusicProviderOAuth", "MusicProvider", "EnrichmentProvider", "SpeechPluginInstance", "LlmPluginInstance", "AnalysisProvider", "MixerProvider", "ChartsProvider", "NewsProvider", "NarrationProvider", "PodcastProvider", "SimilarityProvider", "SearchProvider", "WeatherProvider", "AlmanacProvider", "ScrobbleProvider", "MessagingProvider"];
201
211
  /**
202
212
  * Boundary interfaces that deliberately carry a LIVE object, and so are neither
203
213
  * payloads nor method contracts.
@@ -1 +1 @@
1
- {"version":3,"file":"boundary.json.safe.d.ts","sourceRoot":"","sources":["../src/boundary.json.safe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AACxG,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,cAAc,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjI,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvE,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACxF,OAAO,KAAK,EACR,aAAa,EACb,cAAc,EACd,oBAAoB,EACpB,eAAe,EACf,aAAa,EACb,kBAAkB,EACrB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,kBAA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O,MAAM,0BAA0B,wEAgB7B,CAAC"}
@@ -0,0 +1,202 @@
1
+ /**
2
+ * The `messaging` kind. A messaging plugin connects the station to a chat
3
+ * platform: Telegram, Slack, Discord and whatever comes after them. People write
4
+ * to the station there, and the station answers and announces there.
5
+ *
6
+ * ## The host asks, and the plugin never pushes
7
+ *
8
+ * A plugin has no inbound HTTP and no way to call into the station on its own,
9
+ * so incoming messages are PULLED: the host calls {@link MessagingProvider.receive}
10
+ * in a loop it owns, one call at a time per plugin, handing back the cursor the
11
+ * previous call returned. The plugin turns that into whatever its platform
12
+ * offers (Telegram's `getUpdates` offset, a Slack `oldest` timestamp, a Discord
13
+ * `after` snowflake). The host stores the cursor durably, so a restart neither
14
+ * replays a command nor loses one.
15
+ *
16
+ * A platform that can only deliver by webhook does not fit this capability yet,
17
+ * and that is a known gap rather than an oversight.
18
+ *
19
+ * ## The plugin decides which chats count
20
+ *
21
+ * Chat ids are the platform's own vocabulary, so the list of chats the station
22
+ * listens in is the plugin's configuration and the filtering is the plugin's
23
+ * job. A message {@link MessagingProvider.receive} returns is one the host should
24
+ * act on. Messages from bots, including this one, are the plugin's to drop.
25
+ *
26
+ * ## What a person writes is untrusted, always
27
+ *
28
+ * {@link InboundMessage.text} is whatever somebody typed. The host treats it as
29
+ * data wherever it goes, and a plugin must not pre-process it into anything that
30
+ * looks like the station's own words.
31
+ *
32
+ * ## Plain text, and buttons
33
+ *
34
+ * {@link OutboundMessage.text} is plain text. A platform that parses markup is
35
+ * the plugin's to escape for, since the host cannot know which characters a
36
+ * given platform treats as formatting.
37
+ *
38
+ * A message may carry {@link MessagingButton}s. Pressing one comes back from
39
+ * {@link MessagingProvider.receive} as an {@link InboundMessage} with an
40
+ * {@link InboundMessage.action}, carrying the button's `id` and `value` exactly
41
+ * as they were sent. How the two travel through the platform (Telegram's
42
+ * `callback_data`, a Slack `action_id`) is the plugin's business; the shapes
43
+ * match `@maroonedsoftware/comms`' `OutgoingButton` and `IncomingEvent.action`,
44
+ * which is what the host routes them with. A platform with no buttons renders
45
+ * them as text or drops them.
46
+ *
47
+ * Every shape here is JSON-safe.
48
+ */
49
+ /** Whether a message arrived one to one, or in a chat with several people. */
50
+ export type MessagingChatKind = 'direct' | 'group';
51
+ /** Who wrote a message, as the platform identifies them. */
52
+ export interface MessagingSender {
53
+ /**
54
+ * The platform's stable id for this person.
55
+ *
56
+ * Stable is the requirement: a linked account and a request cooldown are
57
+ * both keyed on it, so a display name or a handle a person can change is
58
+ * the wrong thing to put here.
59
+ */
60
+ id: string;
61
+ /** What to call them. Whatever the platform shows; never used as a key. */
62
+ displayName: string;
63
+ }
64
+ /** One message somebody sent to the station. */
65
+ export interface InboundMessage {
66
+ /** The platform's id for this message, unique within its chat. */
67
+ id: string;
68
+ /** Where it was written. Handed back as {@link OutboundMessage.chatId} to answer it. */
69
+ chatId: string;
70
+ chatKind: MessagingChatKind;
71
+ sender: MessagingSender;
72
+ /** What they wrote, verbatim. Untrusted. Empty when this is a button press. */
73
+ text: string;
74
+ /**
75
+ * Present when this is somebody pressing a button rather than writing: the
76
+ * button's `id` and `value` exactly as {@link OutboundMessage.buttons} sent
77
+ * them. The message's own {@link id} is then the message the button was on,
78
+ * so a reply threads under it. Untrusted like the text: a
79
+ * platform lets a client send any value it likes.
80
+ */
81
+ action?: MessagingAction;
82
+ /** When it was sent, as an ISO-8601 string. */
83
+ sentAt: string;
84
+ }
85
+ /** A button pressed, as it came back. */
86
+ export interface MessagingAction {
87
+ id: string;
88
+ value?: string;
89
+ }
90
+ /** A button on an outgoing message. The shape of `@maroonedsoftware/comms`' `OutgoingButton`. */
91
+ export interface MessagingButton {
92
+ /** What the press is routed by. Short: platforms bound it (Telegram allows 64 bytes for id and value together). */
93
+ id: string;
94
+ /** What the button says. */
95
+ label: string;
96
+ /** Carried back with the press, for a button about one thing among several. */
97
+ value?: string;
98
+ }
99
+ /** What {@link MessagingProvider.receive} is asked. */
100
+ export interface MessagingReceiveQuery {
101
+ /**
102
+ * The cursor the previous call returned, or absent on the first call ever.
103
+ *
104
+ * Opaque to the host: it stores it and hands it back, and never reads it.
105
+ * Absent means "start from now", not "replay everything the platform still
106
+ * holds", since a command written last week is not one to act on today.
107
+ */
108
+ cursor?: string;
109
+ /**
110
+ * How long the plugin may hold the call open waiting for something to
111
+ * arrive, in integer milliseconds.
112
+ *
113
+ * A long poll where the platform has one; a plugin whose platform does not
114
+ * answers straight away, and the host paces its own loop. The host's call
115
+ * timeout is set comfortably above this.
116
+ */
117
+ waitMs: number;
118
+ }
119
+ /** What {@link MessagingProvider.receive} answers. */
120
+ export interface MessagingReceiveResult {
121
+ /** New messages, oldest first. Empty when nothing arrived. */
122
+ messages: InboundMessage[];
123
+ /**
124
+ * Where to resume next time. Absent keeps the one the host already holds.
125
+ *
126
+ * Return it past every message the platform delivered, including the ones
127
+ * the plugin filtered out, or the host will ask for them again forever.
128
+ */
129
+ cursor?: string;
130
+ }
131
+ /** A message the station sends. */
132
+ export interface OutboundMessage {
133
+ /** A chat id, as an {@link InboundMessage} or an {@link MessagingAnnounceTarget} carried it. */
134
+ chatId: string;
135
+ /** Plain text. See the module doc on escaping. */
136
+ text: string;
137
+ /** Answer this message in particular, where the platform threads replies. */
138
+ replyToId?: string;
139
+ /** Buttons under the message. See the module doc. */
140
+ buttons?: MessagingButton[];
141
+ }
142
+ /** What became of one {@link MessagingProvider.send}. */
143
+ export interface MessagingSendResult {
144
+ delivered: boolean;
145
+ /** When not delivered: what the platform said, summarized by the plugin. Never the raw body. */
146
+ reason?: string;
147
+ /**
148
+ * When not delivered: whether sending it again could work.
149
+ *
150
+ * `true` for a timeout, a 5xx, a rate limit. `false` for a chat the bot was
151
+ * removed from, a blocked bot, a message the platform refuses. Absent means
152
+ * `false`, for the reason the scrobble capability gives: a message retried
153
+ * forever is a queue that never drains.
154
+ */
155
+ retryable?: boolean;
156
+ }
157
+ /**
158
+ * Something the station can tell a chat about without being asked.
159
+ *
160
+ * A closed vocabulary that grows when the host has a new moment to announce.
161
+ */
162
+ export type MessagingAnnouncement = 'nowPlaying';
163
+ /** A chat that wants announcements, and which ones. */
164
+ export interface MessagingAnnounceTarget {
165
+ chatId: string;
166
+ announcements: MessagingAnnouncement[];
167
+ }
168
+ /**
169
+ * Implemented by a `messaging` plugin.
170
+ */
171
+ export interface MessagingProvider {
172
+ /**
173
+ * Fetch what has arrived since {@link MessagingReceiveQuery.cursor}.
174
+ *
175
+ * THROW when the platform could not be reached or refused the credentials.
176
+ * The host backs off and asks again with the same cursor, so nothing is lost.
177
+ */
178
+ receive(query: MessagingReceiveQuery): Promise<MessagingReceiveResult>;
179
+ /**
180
+ * Send one message.
181
+ *
182
+ * Answer with a {@link MessagingSendResult} for anything the platform said;
183
+ * throw only when it could not be reached at all, which the host treats as
184
+ * retryable.
185
+ */
186
+ send(message: OutboundMessage): Promise<MessagingSendResult>;
187
+ /**
188
+ * Whether this plugin wants to be polled and written to at all right now.
189
+ *
190
+ * Optional, and ABSENT MEANS YES. Keep it a config read.
191
+ */
192
+ accepting?(): Promise<boolean>;
193
+ /**
194
+ * Which chats want which announcements.
195
+ *
196
+ * Optional, and absent means none: a plugin that only answers when spoken
197
+ * to never has to write it. Asked each time there is something to announce,
198
+ * so a config change takes effect on the next one. Keep it a config read.
199
+ */
200
+ announceTargets?(): Promise<MessagingAnnounceTarget[]>;
201
+ }
202
+ //# sourceMappingURL=messaging.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messaging.d.ts","sourceRoot":"","sources":["../../src/capabilities/messaging.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAEH,8EAA8E;AAC9E,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEnD,4DAA4D;AAC5D,MAAM,WAAW,eAAe;IAC5B;;;;;;OAMG;IACH,EAAE,EAAE,MAAM,CAAC;IACX,2EAA2E;IAC3E,WAAW,EAAE,MAAM,CAAC;CACvB;A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O,CAAC;IACnB,gGAAgG;IAChG,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,GAAG,YAAY,CAAC;AAEjD,uDAAuD;AACvD,MAAM,WAAW,uBAAuB;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,qBAAqB,EAAE,CAAC;CAC1C;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAC9B;;;;;OAKG;IACH,OAAO,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;IAEvE;;;;;;OAMG;IACH,IAAI,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAE7D;;;;OAIG;IACH,SAAS,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAE/B;;;;;;OAMG;IACH,eAAe,CAAC,IAAI,OAAO,CAAC,uBAAuB,EAAE,CAAC,CAAC;CAC1D"}
@@ -188,6 +188,22 @@ export interface MusicProviderCatalog {
188
188
  getTrack(trackId: string): Promise<ProviderTrack | undefined>;
189
189
  listPlaylists(options?: ListPlaylistsOptions): Promise<ProviderPlaylist[]>;
190
190
  getPlaylistTracks(playlistId: string, options?: GetPlaylistTracksOptions): Promise<ProviderTrack[]>;
191
+ /**
192
+ * The playlist id a link names, when it is a link to one of YOUR playlists, else `undefined`.
193
+ *
194
+ * How an operator imports a playlist the account does not list: they paste the address their
195
+ * browser or app shows, the host asks every catalog provider whose it is, and the first to answer
196
+ * is asked for its tracks through {@link getPlaylistTracks} with the id returned here. So the id
197
+ * must be one that method accepts.
198
+ *
199
+ * A PURE parse: no network, no host, nothing awaited. The host asks every provider about every
200
+ * link, so a provider that is slow or unreachable must not make a link it does not own wait on
201
+ * it, and the answer depends on nothing but the text. Answer `undefined` for anything you are not
202
+ * sure is yours, because the first provider to claim a link wins it.
203
+ *
204
+ * Optional: a provider that leaves it out simply cannot be imported from by link.
205
+ */
206
+ playlistIdFromUrl?(url: string): string | undefined;
191
207
  }
192
208
  /**
193
209
  * Getting the station actual audio: one method, because it is one job.
@@ -1 +1 @@
1
- {"version":3,"file":"music.provider.d.ts","sourceRoot":"","sources":["../../src/capabilities/music.provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,4FAA4F;AAC5F,MAAM,WAAW,aAAa;IAC1B,sDAAsD;IACtD,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,qFAAqF;IACrF,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,uFAAuF;IACvF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;;;;;;;;;;;;OAgBG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;;;;;;;;;;;;;OAiBG;IACH,QAAQ,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC;CACnC;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,0BAA0B;AAClC,oDAAoD;AAClD,MAAM;AACR,8DAA8D;GAC5D,MAAM,CAAC;AAEb,MAAM,WAAW,gBAAgB;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8DAA8D;IAC9D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;;;;;;;;;;;;;;OAkBG;IACH,WAAW,CAAC,EAAE,0BAA0B,EAAE,CAAC;IAC3C;;;;;;;;;;;OAWG;IACH,cAAc,CA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CAAC;CACvB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,kBAAkB;IAC/B,oDAAoD;IACpD,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3C,uEAAuE;IACvE,IAAI,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACtB,gBAAgB,IAAI,OAAO,CAAC,aAAa,CAAC,CAAC;CAC9C;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IAC/B,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAChD,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACjE;AAED;;;GAGG;AACH,MAAM,WAAW,aAAc,SAAQ,oBAAoB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,kBAAkB;CAAG"}
@@ -1,6 +1,7 @@
1
1
  import type { AlmanacProvider } from './capabilities/almanac.js';
2
2
  import type { ChartsProvider } from './capabilities/charts.js';
3
3
  import type { EnrichmentProvider } from './capabilities/enrichment.js';
4
+ import type { MessagingProvider } from './capabilities/messaging.js';
4
5
  import type { MusicProviderCatalog, MusicProviderOAuth, MusicProviderSteer, MusicProviderStream } from './capabilities/music.provider.js';
5
6
  import type { NarrationProvider } from './capabilities/narration.js';
6
7
  import type { NewsProvider } from './capabilities/news.js';
@@ -52,6 +53,8 @@ export type WeatherPluginInstance = PluginLifecycle & WeatherProvider;
52
53
  export type AlmanacPluginInstance = PluginLifecycle & AlmanacProvider;
53
54
  /** Instance shape for a `scrobble` plugin. */
54
55
  export type ScrobblePluginInstance = PluginLifecycle & ScrobbleProvider;
56
+ /** Instance shape for a `messaging` plugin. */
57
+ export type MessagingPluginInstance = PluginLifecycle & MessagingProvider;
55
58
  /**
56
59
  * Pairs a manifest with its factory and returns the object a plugin package
57
60
  * default-exports. Purely a typing helper: it does no validation, because the
@@ -1 +1 @@
1
- {"version":3,"file":"define.plugin.d.ts","sourceRoot":"","sources":["../src/define.plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,KAAK,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAC1I,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,eAAe,CAAC;AAE7C;;;;GAIG;AACH,MAAM,MAAM,aAAa,CAAC,SAAS,SAAS,cAAc,GAAG,cAAc,IAAI,MAAM,SAAS,CAAC;AAE/F,6CAA6C;AAC7C,MAAM,WAAW,aAAa,CAAC,SAAS,SAAS,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  export * from './capabilities/charts.js';
5
5
  export * from './capabilities/enrichment.js';
6
6
  export * from './capabilities/llm.js';
7
+ export * from './capabilities/messaging.js';
7
8
  export * from './capabilities/mixer.js';
8
9
  export * from './capabilities/music.provider.js';
9
10
  export * from './capabilities/narration.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kCAAkC,CAAC;AACjD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yBAAyB,CAAC;AACxC,cAAc,kCAAkC,CAAC;AACjD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC"}
package/dist/index.js CHANGED
@@ -82,6 +82,15 @@ var JSON_SAFE_PAYLOAD_TYPES = [
82
82
  "ScrobblePlay",
83
83
  "ScrobbleRejection",
84
84
  "ScrobbleResult",
85
+ "MessagingSender",
86
+ "MessagingAction",
87
+ "MessagingButton",
88
+ "InboundMessage",
89
+ "MessagingReceiveQuery",
90
+ "MessagingReceiveResult",
91
+ "OutboundMessage",
92
+ "MessagingSendResult",
93
+ "MessagingAnnounceTarget",
85
94
  "SpeechLimits"
86
95
  ];
87
96
  var BOUNDARY_METHOD_TYPES = [
@@ -112,7 +121,8 @@ var BOUNDARY_METHOD_TYPES = [
112
121
  "SearchProvider",
113
122
  "WeatherProvider",
114
123
  "AlmanacProvider",
115
- "ScrobbleProvider"
124
+ "ScrobbleProvider",
125
+ "MessagingProvider"
116
126
  ];
117
127
  var BOUNDARY_LIVE_OBJECT_TYPES = [
118
128
  // `signal`: the invocation's own `AbortSignal`, watched by `host.fetch` and
@@ -1209,6 +1219,7 @@ var PLUGIN_CAPABILITY_SEARCH = "search";
1209
1219
  var PLUGIN_CAPABILITY_WEATHER = "weather";
1210
1220
  var PLUGIN_CAPABILITY_ALMANAC = "almanac";
1211
1221
  var PLUGIN_CAPABILITY_SCROBBLE = "scrobble";
1222
+ var PLUGIN_CAPABILITY_MESSAGING = "messaging";
1212
1223
  var KNOWN_PLUGIN_CAPABILITIES = [
1213
1224
  PLUGIN_CAPABILITY_CATALOG,
1214
1225
  PLUGIN_CAPABILITY_STREAM,
@@ -1227,7 +1238,8 @@ var KNOWN_PLUGIN_CAPABILITIES = [
1227
1238
  PLUGIN_CAPABILITY_SEARCH,
1228
1239
  PLUGIN_CAPABILITY_WEATHER,
1229
1240
  PLUGIN_CAPABILITY_ALMANAC,
1230
- PLUGIN_CAPABILITY_SCROBBLE
1241
+ PLUGIN_CAPABILITY_SCROBBLE,
1242
+ PLUGIN_CAPABILITY_MESSAGING
1231
1243
  ];
1232
1244
  function isZodSchema(value) {
1233
1245
  if (value instanceof z3.ZodType) return true;
@@ -1272,6 +1284,7 @@ export {
1272
1284
  PLUGIN_CAPABILITY_CHARTS,
1273
1285
  PLUGIN_CAPABILITY_ENRICHMENT,
1274
1286
  PLUGIN_CAPABILITY_LLM,
1287
+ PLUGIN_CAPABILITY_MESSAGING,
1275
1288
  PLUGIN_CAPABILITY_MIXER,
1276
1289
  PLUGIN_CAPABILITY_NARRATION,
1277
1290
  PLUGIN_CAPABILITY_NEWS,