@frequencytalk/agent 0.2.0 → 0.2.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.
- package/README.md +13 -4
- package/dist/cli.js +2046 -1626
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +82 -6
- package/dist/index.js +2017 -1597
- package/dist/index.js.map +1 -1
- package/dist/mcp/server.js +2046 -1626
- package/dist/mcp/server.js.map +1 -1
- package/package.json +1 -2
- package/server.json +2 -7
package/dist/index.d.ts
CHANGED
|
@@ -24,8 +24,12 @@ declare class FrequencyError extends Error {
|
|
|
24
24
|
readonly retryAfterSeconds?: number | undefined;
|
|
25
25
|
constructor(status: number, code: string, message: string, details?: unknown | undefined, retryAfterSeconds?: number | undefined);
|
|
26
26
|
}
|
|
27
|
-
/**
|
|
28
|
-
|
|
27
|
+
/**
|
|
28
|
+
* A 402: the service wants a payment first. For the top-up route the challenge is the body and
|
|
29
|
+
* headers to pay against. A `FrequencyError` since 0.2.2, so `status` (402) and `code` (the
|
|
30
|
+
* envelope's, or `PAYMENT_REQUIRED` for a bare challenge) read like every other refusal.
|
|
31
|
+
*/
|
|
32
|
+
declare class PaymentRequired extends FrequencyError {
|
|
29
33
|
/** The `WWW-Authenticate: Payment ...` challenge, when the route issued one (the top-up). */
|
|
30
34
|
readonly challenge: string | null;
|
|
31
35
|
/** The error envelope, when the 402 is `SUBSCRIPTION_REQUIRED` with its `details.credit`. */
|
|
@@ -188,6 +192,32 @@ interface RosterMember {
|
|
|
188
192
|
kind?: "person" | "agent" | "line";
|
|
189
193
|
online?: boolean;
|
|
190
194
|
}
|
|
195
|
+
/** A frequency member as `GET /frequencies/:id/members` lists them (contract §1b). */
|
|
196
|
+
interface FrequencyMember {
|
|
197
|
+
userId: string;
|
|
198
|
+
handle: string | null;
|
|
199
|
+
stationId: string;
|
|
200
|
+
kind?: "person" | "agent" | "line";
|
|
201
|
+
role: "owner" | "admin" | "user";
|
|
202
|
+
}
|
|
203
|
+
/** An invitation row (contract §2): sent by a member, answered by the invitee. */
|
|
204
|
+
interface Invitation {
|
|
205
|
+
id: string;
|
|
206
|
+
frequencyId: string;
|
|
207
|
+
invitedUserId: string;
|
|
208
|
+
invitedByUserId: string;
|
|
209
|
+
status: string;
|
|
210
|
+
createdAt: string;
|
|
211
|
+
respondedAt: string | null;
|
|
212
|
+
}
|
|
213
|
+
/** An invitation as the invitee sees it, with the frequency named so a list renders without lookups. */
|
|
214
|
+
interface ReceivedInvitation extends Invitation {
|
|
215
|
+
frequency?: FrequencySummary;
|
|
216
|
+
invitedBy?: {
|
|
217
|
+
handle: string | null;
|
|
218
|
+
stationId: string;
|
|
219
|
+
};
|
|
220
|
+
}
|
|
191
221
|
declare class Frequencies {
|
|
192
222
|
private readonly client;
|
|
193
223
|
constructor(client: ApiClient);
|
|
@@ -201,11 +231,42 @@ declare class Frequencies {
|
|
|
201
231
|
publicStations(): Promise<unknown>;
|
|
202
232
|
/**
|
|
203
233
|
* "Know the number, tune in": by dial number (kHz, e.g. 118025 for 118.025), with the access
|
|
204
|
-
* code where the frequency has one. Joins where it can and answers the
|
|
234
|
+
* code where the frequency has one. Joins where it can and answers the FREQUENCY (0.2.2: the
|
|
235
|
+
* service answers the summary itself, not a tune result; `tune()` or `Agent.session()` opens
|
|
236
|
+
* the media session next).
|
|
237
|
+
*/
|
|
238
|
+
tuneByNumber(khz: number, accessCode?: string): Promise<FrequencySummary>;
|
|
239
|
+
/** The members and their roles. */
|
|
240
|
+
members(id: string): Promise<FrequencyMember[]>;
|
|
241
|
+
/** Invite by callsign, Station ID or email (contract §2); the invitee accepts or declines. */
|
|
242
|
+
invite(id: string, handleOrEmail: string): Promise<Invitation>;
|
|
243
|
+
/** The invitations waiting on this agent. */
|
|
244
|
+
myInvitations(): Promise<ReceivedInvitation[]>;
|
|
245
|
+
acceptInvitation(invitationId: string): Promise<unknown>;
|
|
246
|
+
declineInvitation(invitationId: string): Promise<unknown>;
|
|
247
|
+
/** Make a member an admin, or an admin a member (owner or admin only). */
|
|
248
|
+
changeRole(id: string, userId: string, role: "admin" | "user"): Promise<unknown>;
|
|
249
|
+
/** Hand the frequency to another member (owner only); the caller becomes an admin in the same step. */
|
|
250
|
+
transferOwnership(id: string, newOwnerUserId: string): Promise<{
|
|
251
|
+
ok: true;
|
|
252
|
+
}>;
|
|
253
|
+
/**
|
|
254
|
+
* A group channel (contract §3). `managed` means a roster the admins keep, with talk per member;
|
|
255
|
+
* `open` lets every member talk; `broadcast_open` is the station program's channel. The
|
|
256
|
+
* creating admin is always on the roster; `memberUserIds` seeds others, who may talk.
|
|
205
257
|
*/
|
|
206
|
-
|
|
207
|
-
|
|
258
|
+
createChannel(id: string, body: {
|
|
259
|
+
name: string;
|
|
260
|
+
talkPermission?: "open" | "managed" | "broadcast_open";
|
|
261
|
+
memberUserIds?: string[];
|
|
262
|
+
}): Promise<ChannelSummary>;
|
|
263
|
+
/** Put a frequency member on a channel's roster (admins; a member may add itself to an open channel). */
|
|
264
|
+
addChannelMember(channelId: string, userId: string): Promise<{
|
|
265
|
+
ok: true;
|
|
208
266
|
}>;
|
|
267
|
+
removeChannelMember(channelId: string, userId: string): Promise<void>;
|
|
268
|
+
/** Talk or listen-only for a member already on a managed channel's roster. */
|
|
269
|
+
setChannelTalk(channelId: string, userId: string, canTalk: boolean): Promise<unknown>;
|
|
209
270
|
get(id: string): Promise<FrequencySummary>;
|
|
210
271
|
channels(id: string): Promise<ChannelSummary[]>;
|
|
211
272
|
/** Who is tuned right now. */
|
|
@@ -543,6 +604,15 @@ declare class NativeSession {
|
|
|
543
604
|
transmitIntent?: boolean;
|
|
544
605
|
channelId?: string;
|
|
545
606
|
}): Promise<void>;
|
|
607
|
+
/**
|
|
608
|
+
* Where the agent's own stream lives when the caller did not say (0.2.2): its PERSONAL channel,
|
|
609
|
+
* which is what a person's client homes on, so a `speak()` relayed into a group channel is
|
|
610
|
+
* allowed wherever that person's would be. The frequency's default group channel was the home
|
|
611
|
+
* before, and on a talk frequency that channel is `broadcast_open`, so every first `speak()`
|
|
612
|
+
* was refused "no transmit permission". The personal channel is matched by the agent's own
|
|
613
|
+
* callsign in its name; a frequency with no personal channel for this agent (an old one, a
|
|
614
|
+
* station) falls back to the default group channel as before.
|
|
615
|
+
*/
|
|
546
616
|
private defaultChannelId;
|
|
547
617
|
private send;
|
|
548
618
|
private onSignal;
|
|
@@ -721,9 +791,15 @@ declare class Agent {
|
|
|
721
791
|
private constructor();
|
|
722
792
|
/** Sign in with the key and open the socket. */
|
|
723
793
|
static connect(options: AgentOptions): Promise<Agent>;
|
|
724
|
-
/**
|
|
794
|
+
/**
|
|
795
|
+
* A native audio session on a frequency, opened once and reused. `channelId` is the home
|
|
796
|
+
* channel the agent's own stream lives on (0.2.2; it was dropped before, so `open()` always
|
|
797
|
+
* chose); left out, the session homes on the agent's personal channel, as a person's client
|
|
798
|
+
* does, and relays into group channels per `speak()`.
|
|
799
|
+
*/
|
|
725
800
|
session(frequencyId: string, options?: NativeSessionOptions & {
|
|
726
801
|
transmitIntent?: boolean;
|
|
802
|
+
channelId?: string;
|
|
727
803
|
}): Promise<NativeSession>;
|
|
728
804
|
closeSession(frequencyId: string): Promise<void>;
|
|
729
805
|
speaker(session: NativeSession): Speaker;
|