@frequencytalk/agent 0.1.0 → 0.1.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 +3 -1
- package/dist/cli.js +13 -5
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +24 -6
- package/dist/index.js +7 -4
- package/dist/index.js.map +1 -1
- package/dist/mcp/server.js +7 -4
- package/dist/mcp/server.js.map +1 -1
- package/package.json +1 -1
- package/server.json +15 -15
package/dist/index.d.ts
CHANGED
|
@@ -306,11 +306,19 @@ declare class Chat {
|
|
|
306
306
|
* Calls (contract §16): a call is an ephemeral frequency. Place one to a contact, answer one
|
|
307
307
|
* that rings, hang up. Audio on the call is the native session tuned to the call's frequency.
|
|
308
308
|
*/
|
|
309
|
+
/**
|
|
310
|
+
* What `POST /v1/calls` (201) and `POST /v1/calls/{id}/accept` (200) answer. The call's id is
|
|
311
|
+
* `callId` (0.1.1: 0.1.0 declared `id` and `ringUntil`, which the wire never carried, so a hang-up
|
|
312
|
+
* by `call.id` was a hang-up of `undefined`). Audio on the call: `agent.session(frequencyId)` with
|
|
313
|
+
* `transmitIntent: true`, then `session.listen(channelId)` to hear the other side.
|
|
314
|
+
*/
|
|
309
315
|
interface PlacedCall {
|
|
310
|
-
|
|
316
|
+
callId: string;
|
|
311
317
|
frequencyId: string;
|
|
312
318
|
channelId: string;
|
|
313
|
-
|
|
319
|
+
audioMode?: string;
|
|
320
|
+
/** Placing only: when the ring expires. */
|
|
321
|
+
expiresAt?: number | string;
|
|
314
322
|
participants?: unknown[];
|
|
315
323
|
ringback?: string;
|
|
316
324
|
}
|
|
@@ -552,13 +560,23 @@ interface Heard {
|
|
|
552
560
|
samples: Int16Array;
|
|
553
561
|
firstTimestamp: number;
|
|
554
562
|
}
|
|
563
|
+
interface ListenerOptions {
|
|
564
|
+
/**
|
|
565
|
+
* Record the session's own stream too. Off by default: the node sends a connection its own
|
|
566
|
+
* audio back whenever it listens on the channel its stream is homed on (self-monitoring, the
|
|
567
|
+
* audio-routing contract), which on a one-channel room such as a call is always. An agent
|
|
568
|
+
* transcribing a call wants the other side, not itself (0.1.2).
|
|
569
|
+
*/
|
|
570
|
+
includeOwn?: boolean;
|
|
571
|
+
}
|
|
555
572
|
declare class Listener {
|
|
556
573
|
private readonly session;
|
|
574
|
+
private readonly options;
|
|
557
575
|
private codec;
|
|
558
576
|
private readonly streams;
|
|
559
577
|
private detach;
|
|
560
|
-
constructor(session: NativeSession);
|
|
561
|
-
/** Start recording everything the session hears. */
|
|
578
|
+
constructor(session: NativeSession, options?: ListenerOptions);
|
|
579
|
+
/** Start recording everything the session hears (its own stream excepted, see `ListenerOptions`). */
|
|
562
580
|
start(): Promise<void>;
|
|
563
581
|
/** Stop and return what was heard, per stream. */
|
|
564
582
|
stop(): Heard[];
|
|
@@ -646,9 +664,9 @@ declare class Agent {
|
|
|
646
664
|
}): Promise<NativeSession>;
|
|
647
665
|
closeSession(frequencyId: string): Promise<void>;
|
|
648
666
|
speaker(session: NativeSession): Speaker;
|
|
649
|
-
listener(session: NativeSession): Listener;
|
|
667
|
+
listener(session: NativeSession, options?: ListenerOptions): Listener;
|
|
650
668
|
close(): Promise<void>;
|
|
651
669
|
}
|
|
652
670
|
|
|
653
671
|
export { Agent, Calls, Chat, Contacts, FRAME_SAMPLES, Frequencies, FrequencyClient, FrequencyError, Listener, NativeSession, PaymentRequired, Realtime, SAMPLE_RATE, Speaker, WS_CLOSE_SESSION_REVOKED, WS_CLOSE_UNAUTHORIZED, createOpus, downmix, frames, loadKey, readWav, resample, writeWav };
|
|
654
|
-
export type { AgentKeySource, AgentOptions, ApiClient, ChannelSummary, ChatMessage, Contact, FrequencyClientOptions, FrequencySummary, Heard, IncomingRing, NativeAudioFrame, NativeReceiveStats, NativeResyncStats, NativeSessionOptions, NativeStreamAnnouncement, NativeTransportBlock, OpusCodec, PlacedCall, RealtimeEvent, RealtimeOptions, RequestOptions, RosterMember, TuneResult };
|
|
672
|
+
export type { AgentKeySource, AgentOptions, ApiClient, ChannelSummary, ChatMessage, Contact, FrequencyClientOptions, FrequencySummary, Heard, IncomingRing, ListenerOptions, NativeAudioFrame, NativeReceiveStats, NativeResyncStats, NativeSessionOptions, NativeStreamAnnouncement, NativeTransportBlock, OpusCodec, PlacedCall, RealtimeEvent, RealtimeOptions, RequestOptions, RosterMember, TuneResult };
|
package/dist/index.js
CHANGED
|
@@ -5109,18 +5109,21 @@ var Speaker = class {
|
|
|
5109
5109
|
|
|
5110
5110
|
// src/listener.ts
|
|
5111
5111
|
var Listener = class {
|
|
5112
|
-
constructor(session) {
|
|
5112
|
+
constructor(session, options = {}) {
|
|
5113
5113
|
this.session = session;
|
|
5114
|
+
this.options = options;
|
|
5114
5115
|
}
|
|
5115
5116
|
session;
|
|
5117
|
+
options;
|
|
5116
5118
|
codec = null;
|
|
5117
5119
|
streams = /* @__PURE__ */ new Map();
|
|
5118
5120
|
detach = null;
|
|
5119
|
-
/** Start recording everything the session hears. */
|
|
5121
|
+
/** Start recording everything the session hears (its own stream excepted, see `ListenerOptions`). */
|
|
5120
5122
|
async start() {
|
|
5121
5123
|
this.codec ??= await createOpus();
|
|
5122
5124
|
const codec = this.codec;
|
|
5123
5125
|
const handler = (frame) => {
|
|
5126
|
+
if (!this.options.includeOwn && frame.connectionId === this.session.connectionId) return;
|
|
5124
5127
|
let s = this.streams.get(frame.streamId);
|
|
5125
5128
|
if (!s) {
|
|
5126
5129
|
s = { connectionId: frame.connectionId, chunks: [], lastTimestamp: null, first: frame.timestamp };
|
|
@@ -5241,8 +5244,8 @@ var Agent = class _Agent {
|
|
|
5241
5244
|
speaker(session) {
|
|
5242
5245
|
return new Speaker(session);
|
|
5243
5246
|
}
|
|
5244
|
-
listener(session) {
|
|
5245
|
-
return new Listener(session);
|
|
5247
|
+
listener(session, options) {
|
|
5248
|
+
return new Listener(session, options);
|
|
5246
5249
|
}
|
|
5247
5250
|
async close() {
|
|
5248
5251
|
for (const id of [...this.sessions.keys()]) await this.closeSession(id);
|