@frequencytalk/agent 0.2.2 → 0.2.4

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/dist/index.d.ts CHANGED
@@ -494,9 +494,20 @@ declare class Phone {
494
494
  * application's problem; `misattributed` or `undecryptable` climbing is a key or announcement
495
495
  * problem; `installs` is the number that proves a rotation was survived.
496
496
  *
497
- * Wire version 1 is sent and received. Version 2 audio (one seal, the content key wrapped per
498
- * channel) is announced by capability `native-transport-v2` and is counted here as
499
- * `unsupportedVersion`; peers on v2 are the next step for this package (handoff).
497
+ * Wire version 1 is sent; versions 1 AND 2 are received (0.2.4). Contract §7c has a sender
498
+ * choose v2 from the container's accept list alone, never from who is listening, so every
499
+ * receiver on a v2 container must read it: a v1-only receiver hears nothing from a v2 talker
500
+ * (measured 2026-11-27, Switchboard for Apple to an SDK agent: 319 of 319 datagrams dropped).
501
+ * v2 is two packet kinds, told apart by the CLEARTEXT flag because the payload type is sealed:
502
+ * - a KEY PACKET (0x22, FLAG_CONTENT_KEY): the talkspurt's content key `K_s`, sealed under a
503
+ * carrying channel's key exactly as v1 audio is. Filed per (connection, stream) after the
504
+ * owner check, by generation (contentKeyId's low byte); current and previous are kept, so
505
+ * audio in flight across a mid-talkspurt rotation still opens;
506
+ * - AUDIO (0x02): sealed once under `K_s`; the header names the stream's HOME wire id and the
507
+ * generation. The home is learned from the first audio that opens under a stream's key, NOT
508
+ * from the announcement: `nativeStream.channelId` is the channel THIS listener matched on,
509
+ * which for a relay listener is the relay, not the sender's home. The opened streamId must
510
+ * be the stream whose key opened it, and the owner check applies to both kinds.
500
511
  */
501
512
  type MediaEvent = {
502
513
  type: string;
@@ -532,8 +543,12 @@ interface NativeResyncStats {
532
543
  interface NativeReceiveStats {
533
544
  /** Audio frames opened and attributed, handed to the listeners. */
534
545
  frames: number;
535
- /** Packets whose version byte this build does not read (wire v2). */
546
+ /** Packets whose version or flag bits this build does not read (a future version, or a shape no version defines). */
536
547
  unsupportedVersion: number;
548
+ /** Wire-v2 content keys installed from key packets (one per key packet that opened and was attributed). */
549
+ contentKeys: number;
550
+ /** Wire-v2 audio for which no content key is held yet: a listener joining mid-talkspurt hears from the next key packet (at most 200 ms). */
551
+ awaitingContentKey: number;
537
552
  /** Packets on a channel this session holds no key for. */
538
553
  unknownChannel: number;
539
554
  /** Packets that did not open under the channel key: a stale ring on one side. */
@@ -577,6 +592,8 @@ declare class NativeSession {
577
592
  private producing;
578
593
  private timestamp;
579
594
  private readonly owners;
595
+ /** `${connectionId}:${streamId}` -> that stream's content keys (wire v2). */
596
+ private readonly contentKeys;
580
597
  private readonly pending;
581
598
  /** The last 500 signalling events, oldest first. A probe reads them; `waitFor` searches them. */
582
599
  readonly events: MediaEvent[];
@@ -643,6 +660,18 @@ declare class NativeSession {
643
660
  sendOpusFrame(opus: Buffer, relayChannelIds?: string[]): void;
644
661
  stopTalking(): void;
645
662
  private onPacket;
663
+ /** A v2 key packet that opened under a channel key: attribute it, then file `K_s` under the stream's home. */
664
+ private onContentKey;
665
+ /**
666
+ * v2 audio: sealed under `K_s`, found by (connection, home wire id, generation). The stream bound
667
+ * to that home is tried first; a connection's streams whose home is not yet learned are tried
668
+ * after (one connection rarely carries more than one), and the first that opens with its own
669
+ * streamId inside binds the home.
670
+ */
671
+ private onV2Audio;
672
+ /** The owner check and hand-off every opened audio frame goes through, whichever wire version carried it. */
673
+ private deliver;
674
+ private forgetStream;
646
675
  /**
647
676
  * The backstop for a missed `nativeKeysRotated` (the node announces a rotation only once it
648
677
  * has a baseline to compare against, so a rotation inside its first poll window is never
@@ -751,8 +780,8 @@ declare const FRAME_SAMPLES: number;
751
780
  interface OpusCodec {
752
781
  encode(pcm: Int16Array): Buffer;
753
782
  decode(packet: Buffer): Int16Array;
754
- /** Packet-loss concealment for one missing frame. */
755
- conceal(): Int16Array;
783
+ /** Packet-loss concealment for a gap: `samples` at 48 kHz (default one 20 ms frame). */
784
+ conceal(samples?: number): Int16Array;
756
785
  close(): void;
757
786
  }
758
787
  declare function createOpus(): Promise<OpusCodec>;
package/dist/index.js CHANGED
@@ -3936,7 +3936,12 @@ var MediaServerToClientSchema = z11.discriminatedUnion("type", [
3936
3936
  // fleet upgrade: a running container keeps its image until it is recycled. A sender
3937
3937
  // uses wire v2 only when 2 is listed. ABSENT means [1] (a container from before 0.107.0),
3938
3938
  // which is why the field is optional: its absence is the signal, not a missing value.
3939
- wireVersions: z11.array(z11.number().int().positive()).optional()
3939
+ wireVersions: z11.array(z11.number().int().positive()).optional(),
3940
+ // This container's datapath answers link-probe control packets (nativeTransport.ts,
3941
+ // LINK_PROBE; contract §19 "The link meter"). Negotiated for the same reason as
3942
+ // wireVersions: a container that does not know the packet drops it on shape, silently,
3943
+ // and a client that probed anyway would read that silence as a dead link. Absent means no.
3944
+ linkProbe: z11.boolean().optional()
3940
3945
  }).optional()
3941
3946
  }),
3942
3947
  z11.object({ type: z11.literal("authError"), message: z11.string() }),
@@ -4356,6 +4361,19 @@ var ERROR_CODES = {
4356
4361
  },
4357
4362
  // --- Missing resources --------------------------------------------------------------
4358
4363
  NOT_FOUND: { status: 404, summary: "The addressed resource does not exist, or is not visible to this caller." },
4364
+ // --- Internal: where media runs (admin console only; docs/work-orders/cost-controls.md) ---
4365
+ HOST_ADMIN_REFUSED: {
4366
+ status: 409,
4367
+ summary: "A provider or media-host change was refused: a disabled provider, one with no active host, a host with live containers, or an on-demand host (provisioner/hostAdmin.ts). The message says which."
4368
+ },
4369
+ SWING_REFUSED: {
4370
+ status: 409,
4371
+ summary: "A live frequency could not be moved to another media host: no running container, a swing already in progress, no other active host, or the new container did not come up (provisioner/swing.ts). The message says which."
4372
+ },
4373
+ STANDBY_REFUSED: {
4374
+ status: 409,
4375
+ summary: "An on-demand standby media host could not be started or stopped in its current state (provisioner/standby.ts). The message says why."
4376
+ },
4359
4377
  USER_NOT_FOUND: { status: 404, summary: "No user matches the supplied handle, Station ID or email." },
4360
4378
  INVITE_INVALID: { status: 404, summary: "The invite or invite link is unknown, expired, revoked, or fully used." },
4361
4379
  NO_BILLING_ACCOUNT: { status: 404, summary: "No billing account exists for this organization yet." },
@@ -4631,6 +4649,9 @@ var BlockedWordsSchema = z14.object({ words: z14.array(BlockedWordSchema).max(2e
4631
4649
 
4632
4650
  // ../shared/dist/nativeTransport.js
4633
4651
  var NATIVE_TRANSPORT_VERSION = 1;
4652
+ var NATIVE_TRANSPORT_WIRE_V2 = 2;
4653
+ var FLAG_CONTROL = 16;
4654
+ var FLAG_CONTENT_KEY = 32;
4634
4655
  var NODE_SEQUENCE_BASE = 1n << 63n;
4635
4656
  var HEADER = {
4636
4657
  /** version (low nibble) + flags (high nibble). */
@@ -4689,6 +4710,19 @@ var PAYLOAD = {
4689
4710
  OPUS_OFFSET: 9
4690
4711
  };
4691
4712
  var PAYLOAD_TYPE = { audio: 0, keepalive: 1, contentKey: 2, videoShard: 3, shareAudio: 4 };
4713
+ var CONTENT_KEY_PAYLOAD = {
4714
+ TYPE_OFFSET: 0,
4715
+ /** uint32. The stream whose audio `K_s` seals. */
4716
+ STREAM_ID_OFFSET: 1,
4717
+ /** uint32, 48 kHz. The talkspurt's timestamp when this key packet was sent; informational. */
4718
+ TIMESTAMP_OFFSET: 5,
4719
+ /** uint32. Monotonic per stream; its LOW BYTE is the generation an audio header carries. */
4720
+ CONTENT_KEY_ID_OFFSET: 9,
4721
+ /** 32 bytes: `K_s`, an AES-256-GCM key. */
4722
+ KEY_OFFSET: 13,
4723
+ LENGTH: 45
4724
+ };
4725
+ var SHARE_CHANNEL_ID = 4294967295;
4692
4726
  var VIDEO_SHARD = {
4693
4727
  TYPE_OFFSET: 0,
4694
4728
  STREAM_ID_OFFSET: 1,
@@ -4727,8 +4761,13 @@ var PROJECTS_BY_PLATFORM = {
4727
4761
  // than a rider on `broadcast` (a Windows lane) or `tuner_apple`, for the reason `broadcast` got
4728
4762
  // one: the board enforces one in-flight task per PROJECT, so a shared lane makes one app's claim
4729
4763
  // answer 409 AGENT_BUSY while the other holds the slot.
4764
+ // `switchboard_apple` is the macOS Switchboard (owner, 2026-11-27: "build switchboard for mac"):
4765
+ // a native build of the same product the Windows `switchboard` lane builds, developed here on the
4766
+ // Mac like `tuner_apple` and `broadcast_apple`. Its own lane rather than a rider on `switchboard`
4767
+ // (a Windows lane) or `switchboard_steamos` (the SteamOS group), for the one-in-flight reason
4768
+ // `broadcast_apple` records above. A Mac lane only: not in the Windows set, not in the SteamOS group.
4730
4769
  // The SteamOS group (`STEAMOS_PROJECTS`, above) is on both platforms since 2026-11-03.
4731
- mac: ["frequency", "tuner_apple", "site", "platform", "broadcast_apple", ...STEAMOS_PROJECTS],
4770
+ mac: ["frequency", "tuner_apple", "site", "platform", "broadcast_apple", "switchboard_apple", ...STEAMOS_PROJECTS],
4732
4771
  // `broadcast` is its own lane rather than a rider on `windows` (2026-08-31): the board
4733
4772
  // enforces one in-flight task per PROJECT, and `windows` already carries the Jacked
4734
4773
  // audio-driver work, so sharing it meant a Broadcast claim answered 409 AGENT_BUSY for
@@ -4861,6 +4900,10 @@ var KNOWN_SHARD_FLAGS = VIDEO_SHARD_FLAG.keyframe | VIDEO_SHARD_FLAG.recoveryPoi
4861
4900
  // ../shared/dist/share/assembler.js
4862
4901
  var MAX_FORWARD_JUMP = 1 << 16;
4863
4902
 
4903
+ // ../shared/dist/share/linkProbe.js
4904
+ var LINK_PROBE_PAD_DATAGRAM_BYTES = SHARE_WEBTRANSPORT_DATAGRAM_MAX_BYTES;
4905
+ var PAD_PAYLOAD_BYTES = LINK_PROBE_PAD_DATAGRAM_BYTES - HEADER.LENGTH;
4906
+
4864
4907
  // ../shared/dist/share/rateControl.js
4865
4908
  var MOTION_RUNGS = [2160, 1440, 1080, 900, 720, 540];
4866
4909
  var FRAME_BYTES_TARGET = Math.floor(MAX_FRAME_BYTES * 0.75);
@@ -5103,6 +5146,8 @@ var NativeSession = class {
5103
5146
  producing = null;
5104
5147
  timestamp = 0;
5105
5148
  owners = /* @__PURE__ */ new Map();
5149
+ /** `${connectionId}:${streamId}` -> that stream's content keys (wire v2). */
5150
+ contentKeys = /* @__PURE__ */ new Map();
5106
5151
  pending = [];
5107
5152
  /** The last 500 signalling events, oldest first. A probe reads them; `waitFor` searches them. */
5108
5153
  events = [];
@@ -5114,7 +5159,7 @@ var NativeSession = class {
5114
5159
  /** The stale-key watch: consecutive packets that would not open since the last one that did, and when a refresh was last asked for. */
5115
5160
  staleRun = 0;
5116
5161
  lastStaleRefresh = 0;
5117
- receiveStats = { frames: 0, unsupportedVersion: 0, unknownChannel: 0, undecryptable: 0, notAudio: 0, misattributed: 0 };
5162
+ receiveStats = { frames: 0, unsupportedVersion: 0, contentKeys: 0, awaitingContentKey: 0, unknownChannel: 0, undecryptable: 0, notAudio: 0, misattributed: 0 };
5118
5163
  /** The node-issued datapath identity, 0 until `open()` has authenticated. */
5119
5164
  get connectionId() {
5120
5165
  return this.connection;
@@ -5216,7 +5261,7 @@ var NativeSession = class {
5216
5261
  this.owners.set(streamId, connectionId);
5217
5262
  this.options.onStream?.({ streamId, connectionId, producerUserId: event.producerUserId, producerCallsign: event.producerCallsign, channelId: event.channelId });
5218
5263
  }
5219
- if (event.type === "nativeStreamClosed") this.owners.delete(Number(event.streamId));
5264
+ if (event.type === "nativeStreamClosed") this.forgetStream(Number(event.streamId));
5220
5265
  if (event.type === "nativeKeysRotated") this.onKeysRotated(String(event.keysetId));
5221
5266
  for (const p of [...this.pending]) {
5222
5267
  if (p.type === event.type) {
@@ -5350,6 +5395,7 @@ var NativeSession = class {
5350
5395
  }
5351
5396
  /** One 20 ms Opus frame onto the stream: sealed under the home channel, and each relay, as the contract requires. */
5352
5397
  sendOpusFrame(opus, relayChannelIds = []) {
5398
+ if (this.closedWith) throw new Error(`native: signalling closed (${this.closedWith.code} ${this.closedWith.reason}) while talking; close() and open() again`);
5353
5399
  if (!this.producing) throw new Error("native: not talking; call startTalking first");
5354
5400
  const payload = audioPayload(this.producing.streamId, this.timestamp, opus);
5355
5401
  this.timestamp = this.timestamp + 960 >>> 0;
@@ -5357,17 +5403,33 @@ var NativeSession = class {
5357
5403
  }
5358
5404
  stopTalking() {
5359
5405
  if (!this.producing) return;
5406
+ if (this.closedWith) {
5407
+ this.producing = null;
5408
+ return;
5409
+ }
5360
5410
  this.send({ type: "closeNativeStream", streamId: this.producing.streamId });
5361
5411
  this.producing = null;
5362
5412
  }
5363
5413
  onPacket(packet) {
5364
5414
  if (!this.native || packet.length < HEADER.LENGTH + AEAD.TAG_BYTES) return;
5365
- if ((packet[HEADER.VERSION_FLAGS_OFFSET] & 15) !== NATIVE_TRANSPORT_VERSION) {
5415
+ const byte0 = packet[HEADER.VERSION_FLAGS_OFFSET];
5416
+ const version = byte0 & 15;
5417
+ const flags = byte0 & 240;
5418
+ const connectionId = packet.readUInt32BE(HEADER.CONNECTION_ID_OFFSET);
5419
+ const channelNativeId = packet.readUInt32BE(HEADER.CHANNEL_ID_OFFSET);
5420
+ if (version === NATIVE_TRANSPORT_VERSION && flags === FLAG_CONTROL) {
5421
+ this.receiveStats.notAudio += 1;
5422
+ return;
5423
+ }
5424
+ if (version === NATIVE_TRANSPORT_WIRE_V2 && flags === 0 && channelNativeId !== SHARE_CHANNEL_ID) {
5425
+ this.onV2Audio(packet, connectionId, channelNativeId);
5426
+ return;
5427
+ }
5428
+ const keyPacket = version === NATIVE_TRANSPORT_WIRE_V2 && flags === FLAG_CONTENT_KEY;
5429
+ if (!keyPacket && !(version === NATIVE_TRANSPORT_VERSION && flags === 0)) {
5366
5430
  this.receiveStats.unsupportedVersion += 1;
5367
5431
  return;
5368
5432
  }
5369
- const connectionId = packet.readUInt32BE(HEADER.CONNECTION_ID_OFFSET);
5370
- const channelNativeId = packet.readUInt32BE(HEADER.CHANNEL_ID_OFFSET);
5371
5433
  const entry = Object.values(this.native.channelKeys.keys).find((k) => k.id === channelNativeId);
5372
5434
  if (!entry) {
5373
5435
  this.receiveStats.unknownChannel += 1;
@@ -5382,10 +5444,89 @@ var NativeSession = class {
5382
5444
  return;
5383
5445
  }
5384
5446
  this.staleRun = 0;
5447
+ if (keyPacket) {
5448
+ this.onContentKey(connectionId, body);
5449
+ return;
5450
+ }
5385
5451
  if (body.type !== PAYLOAD_TYPE.audio) {
5386
5452
  this.receiveStats.notAudio += 1;
5387
5453
  return;
5388
5454
  }
5455
+ this.deliver(connectionId, body);
5456
+ }
5457
+ /** A v2 key packet that opened under a channel key: attribute it, then file `K_s` under the stream's home. */
5458
+ onContentKey(connectionId, body) {
5459
+ const rest = body.opus;
5460
+ const restLength = CONTENT_KEY_PAYLOAD.LENGTH - CONTENT_KEY_PAYLOAD.CONTENT_KEY_ID_OFFSET;
5461
+ if (body.type !== PAYLOAD_TYPE.contentKey || rest.length !== restLength) {
5462
+ this.receiveStats.notAudio += 1;
5463
+ return;
5464
+ }
5465
+ const owner = this.owners.get(body.streamId);
5466
+ if (owner === void 0 || owner !== connectionId) {
5467
+ this.receiveStats.misattributed += 1;
5468
+ return;
5469
+ }
5470
+ const contentKeyId = rest.readUInt32BE(0);
5471
+ const key = Buffer.from(rest.subarray(CONTENT_KEY_PAYLOAD.KEY_OFFSET - CONTENT_KEY_PAYLOAD.CONTENT_KEY_ID_OFFSET));
5472
+ const slot = `${connectionId}:${body.streamId}`;
5473
+ let stream = this.contentKeys.get(slot);
5474
+ if (!stream) {
5475
+ stream = { connectionId, streamId: body.streamId, generations: /* @__PURE__ */ new Map() };
5476
+ this.contentKeys.set(slot, stream);
5477
+ }
5478
+ const generation = contentKeyId & 255;
5479
+ const held = stream.generations.get(generation);
5480
+ if (held && held.contentKeyId === contentKeyId) return;
5481
+ stream.generations.delete(generation);
5482
+ stream.generations.set(generation, { contentKeyId, key });
5483
+ while (stream.generations.size > 2) stream.generations.delete(stream.generations.keys().next().value);
5484
+ this.receiveStats.contentKeys += 1;
5485
+ }
5486
+ /**
5487
+ * v2 audio: sealed under `K_s`, found by (connection, home wire id, generation). The stream bound
5488
+ * to that home is tried first; a connection's streams whose home is not yet learned are tried
5489
+ * after (one connection rarely carries more than one), and the first that opens with its own
5490
+ * streamId inside binds the home.
5491
+ */
5492
+ onV2Audio(packet, connectionId, homeWireId) {
5493
+ const generation = packet[HEADER.KEY_EPOCH_OFFSET];
5494
+ const candidates = [];
5495
+ for (const entry of this.contentKeys.values()) {
5496
+ if (entry.connectionId !== connectionId || !entry.generations.has(generation)) continue;
5497
+ if (entry.homeWireId === homeWireId) candidates.unshift(entry);
5498
+ else if (entry.homeWireId === void 0) candidates.push(entry);
5499
+ }
5500
+ if (candidates.length === 0) {
5501
+ this.receiveStats.awaitingContentKey += 1;
5502
+ return;
5503
+ }
5504
+ for (const stream of candidates) {
5505
+ let body;
5506
+ try {
5507
+ body = open(packet, stream.generations.get(generation).key);
5508
+ } catch {
5509
+ continue;
5510
+ }
5511
+ if (body.type !== PAYLOAD_TYPE.audio) {
5512
+ this.receiveStats.notAudio += 1;
5513
+ return;
5514
+ }
5515
+ if (body.streamId !== stream.streamId) {
5516
+ this.receiveStats.misattributed += 1;
5517
+ return;
5518
+ }
5519
+ if (stream.homeWireId === void 0) {
5520
+ for (const [slot, other] of this.contentKeys) if (other !== stream && other.connectionId === connectionId && other.homeWireId === homeWireId) this.contentKeys.delete(slot);
5521
+ stream.homeWireId = homeWireId;
5522
+ }
5523
+ this.deliver(connectionId, body);
5524
+ return;
5525
+ }
5526
+ this.receiveStats.undecryptable += 1;
5527
+ }
5528
+ /** The owner check and hand-off every opened audio frame goes through, whichever wire version carried it. */
5529
+ deliver(connectionId, body) {
5389
5530
  const owner = this.owners.get(body.streamId);
5390
5531
  if (owner === void 0 || owner !== connectionId) {
5391
5532
  this.receiveStats.misattributed += 1;
@@ -5396,6 +5537,10 @@ var NativeSession = class {
5396
5537
  this.options.onAudio?.(frame);
5397
5538
  for (const listener of this.audioListeners) listener(frame);
5398
5539
  }
5540
+ forgetStream(streamId) {
5541
+ this.owners.delete(streamId);
5542
+ for (const [slot, entry] of this.contentKeys) if (entry.streamId === streamId) this.contentKeys.delete(slot);
5543
+ }
5399
5544
  /**
5400
5545
  * The backstop for a missed `nativeKeysRotated` (the node announces a rotation only once it
5401
5546
  * has a baseline to compare against, so a rotation inside its first poll window is never
@@ -5462,7 +5607,7 @@ async function createOpus() {
5462
5607
  return {
5463
5608
  encode: (pcm) => enc.encode(Buffer.from(pcm.buffer, pcm.byteOffset, pcm.byteLength)),
5464
5609
  decode: (packet) => toInt16(enc.decode(packet)),
5465
- conceal: () => new Int16Array(FRAME_SAMPLES),
5610
+ conceal: (samples = FRAME_SAMPLES) => new Int16Array(samples),
5466
5611
  close: () => enc.delete?.()
5467
5612
  };
5468
5613
  } catch {
@@ -5475,7 +5620,7 @@ async function createOpus() {
5475
5620
  return {
5476
5621
  encode: (pcm) => codec.encode(Buffer.from(pcm.buffer, pcm.byteOffset, pcm.byteLength), FRAME_SAMPLES),
5477
5622
  decode: (packet) => toInt16(codec.decode(packet)),
5478
- conceal: () => new Int16Array(FRAME_SAMPLES),
5623
+ conceal: (samples = FRAME_SAMPLES) => new Int16Array(samples),
5479
5624
  close: () => codec.delete()
5480
5625
  };
5481
5626
  }
@@ -5624,15 +5769,17 @@ var Listener = class {
5624
5769
  if (!this.options.includeOwn && frame.connectionId === this.session.connectionId) return;
5625
5770
  let s = this.streams.get(frame.streamId);
5626
5771
  if (!s) {
5627
- s = { connectionId: frame.connectionId, chunks: [], lastTimestamp: null, first: frame.timestamp };
5772
+ s = { connectionId: frame.connectionId, chunks: [], lastTimestamp: null, lastSamples: 0, first: frame.timestamp };
5628
5773
  this.streams.set(frame.streamId, s);
5629
5774
  }
5630
5775
  if (s.lastTimestamp !== null) {
5631
- const missing = Math.min(50, Math.round((frame.timestamp - s.lastTimestamp) / FRAME_SAMPLES) - 1);
5632
- for (let i = 0; i < missing; i++) s.chunks.push(codec.conceal());
5776
+ const gap = (frame.timestamp - s.lastTimestamp >>> 0) - s.lastSamples;
5777
+ if (gap > 0 && gap <= 48e3) s.chunks.push(codec.conceal(gap));
5633
5778
  }
5634
- s.chunks.push(codec.decode(frame.opus));
5779
+ const pcm = codec.decode(frame.opus);
5780
+ s.chunks.push(pcm);
5635
5781
  s.lastTimestamp = frame.timestamp;
5782
+ s.lastSamples = pcm.length;
5636
5783
  };
5637
5784
  this.detach = this.session.attachAudio(handler);
5638
5785
  }