@midsummer-ai/sdk 0.1.0-staging.4917 → 0.1.0-staging.4924

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/calls/index.d.mts CHANGED
@@ -135,9 +135,9 @@ interface JoinOptions {
135
135
  /** Receive others' videos as they publish them, up to 9 at the half layer: true unless you choose them with `receive`. */
136
136
  readonly autoVideo?: boolean;
137
137
  /**
138
- * What to publish as the call joins, as `publish` takes it: the devices start while the join is on its way, and they
139
- * go out with its first answer, a trip sooner than a `publish` after it. A device that won't start is said as an
140
- * `error` event, and the call joins without it.
138
+ * What to publish as the call joins, as `publish` takes it: the devices start while the join is on its way, so they
139
+ * are ready to go out the moment the call connects. A device that won't start is said as an `error` event, and the
140
+ * call joins without it.
141
141
  */
142
142
  readonly publish?: {
143
143
  readonly mic?: boolean | MediaStreamTrack;
package/calls/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { a as MAX_VIDEOS, c as join, i as MAX_MESSAGE_BYTES, l as layerWatch, n as CallError, o as callToken, r as MAX_FULL_VIDEOS, s as identityProblem, t as CAMERA, u as roomProblem } from "../calls-CQQ0NnoP.mjs";
1
+ import { a as MAX_VIDEOS, c as join, i as MAX_MESSAGE_BYTES, l as layerWatch, n as CallError, o as callToken, r as MAX_FULL_VIDEOS, s as identityProblem, t as CAMERA, u as roomProblem } from "../calls-BSpnsn8P.mjs";
2
2
  export { CAMERA, CallError, MAX_FULL_VIDEOS, MAX_MESSAGE_BYTES, MAX_VIDEOS, callToken, identityProblem, join, layerWatch, roomProblem };
package/calls/react.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { c as join } from "../calls-CQQ0NnoP.mjs";
2
+ import { c as join } from "../calls-BSpnsn8P.mjs";
3
3
  import { createContext, createElement, useContext, useEffect, useMemo, useRef, useSyncExternalStore } from "react";
4
4
  //#region src/calls/react.ts
5
5
  /**
@@ -1,4 +1,4 @@
1
- import { s as identityProblem, u as roomProblem } from "../calls-CQQ0NnoP.mjs";
1
+ import { s as identityProblem, u as roomProblem } from "../calls-BSpnsn8P.mjs";
2
2
  import { CALL_OPS, CALL_STATUS, TRACK_KINDS } from "./protocol.mjs";
3
3
  //#region src/calls/stand-in.ts
4
4
  /**
package/calls/ui.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { n as CallError, t as CAMERA } from "../calls-CQQ0NnoP.mjs";
2
+ import { n as CallError, t as CAMERA } from "../calls-BSpnsn8P.mjs";
3
3
  import { Audio, CallProvider, Video, useCall, useCallError, useCallState, useLocalTracks, useParticipants } from "./react.mjs";
4
4
  import { a as TYPE, i as MATERIAL, n as FOUNDATION, r as LIGHT, t as DARK } from "../tokens-BpV8U5E1.mjs";
5
5
  import { createContext, createElement, useCallback, useContext, useEffect, useId, useMemo, useRef, useState } from "react";
@@ -505,8 +505,6 @@ function sfuMedia(ctx, auto, declined, offer) {
505
505
  await transceiver.sender.replaceTrack(null);
506
506
  }
507
507
  };
508
- /** The first tracks published before the join's offer is answered, which go with that answer. */
509
- let earlyPublish;
510
508
  const answer = async (offered) => {
511
509
  try {
512
510
  await pc.setRemoteDescription(offered);
@@ -533,38 +531,14 @@ function sfuMedia(ctx, auto, declined, offer) {
533
531
  const answered0 = sdpOf(pc.localDescription);
534
532
  asked = early ?? [];
535
533
  early = void 0;
536
- const publishing = earlyPublish;
537
- earlyPublish = void 0;
538
- const offeredNow = publishing ? await offerTracks(publishing.tracks).catch((error) => {
539
- publishing.reject(error);
540
- }) : void 0;
541
534
  const chunk = asked.filter((track) => publishes(track.of, track.name) && !find(track.of, track.name)).slice(0, PULL_MAX);
542
535
  const were = new Map(chunk.map((track) => [track.of, connections.get(track.of)]));
543
- let answered;
544
- try {
545
- answered = await ctx.post("answer", {
546
- participant: ctx.me,
547
- answer: answered0,
548
- ...chunk.length ? { pull: chunk } : {},
549
- ...offeredNow ? { publish: offeredNow.body } : {}
550
- });
551
- } catch (error) {
552
- if (offeredNow) {
553
- await unoffer(offeredNow).catch(() => void 0);
554
- publishing.reject(error);
555
- }
556
- throw error;
557
- }
536
+ const answered = await ctx.post("answer", {
537
+ participant: ctx.me,
538
+ answer: answered0,
539
+ ...chunk.length ? { pull: chunk } : {}
540
+ });
558
541
  timed();
559
- if (offeredNow) try {
560
- publishing.resolve(await tookPublished(offeredNow, answered.published ?? await ctx.post("publish", {
561
- participant: ctx.me,
562
- ...offeredNow.body
563
- })));
564
- } catch (error) {
565
- await unoffer(offeredNow).catch(() => void 0);
566
- publishing.reject(error);
567
- }
568
542
  if (chunk.length && answered.offer && answered.tracks) await took(chunk, were, {
569
543
  offer: answered.offer,
570
544
  tracks: answered.tracks
@@ -573,10 +547,6 @@ function sfuMedia(ctx, auto, declined, offer) {
573
547
  early = void 0;
574
548
  timed();
575
549
  for (const track of asked) pending.delete(key(track.of, track.name));
576
- if (earlyPublish) {
577
- earlyPublish.reject(new CallError("unavailable", "The call's connection couldn't be made, so nothing was published. Join again."));
578
- earlyPublish = void 0;
579
- }
580
550
  }
581
551
  const rest = asked.filter((track) => publishes(track.of, track.name) && !find(track.of, track.name));
582
552
  if (rest.length && !closed) pull(rest).catch(ctx.failed);
@@ -792,13 +762,6 @@ function sfuMedia(ctx, auto, declined, offer) {
792
762
  }
793
763
  return {
794
764
  publish: (tracks) => {
795
- if (early !== void 0 && !earlyPublish) return new Promise((resolve, reject) => {
796
- earlyPublish = {
797
- tracks,
798
- resolve,
799
- reject
800
- };
801
- });
802
765
  return serial(async () => {
803
766
  const made = await offerTracks(tracks);
804
767
  try {
package/here-C2jhTheQ.mjs CHANGED
@@ -12,7 +12,7 @@ function processEnv() {
12
12
  * This package's version: `0.0.0-dev` here, and in a published package the version it was published at, which the
13
13
  * release writes in its place as it stages the package (`stampSdk` in `scripts/release/packages.ts`).
14
14
  */
15
- const SDK_VERSION = "0.1.0-staging.4917";
15
+ const SDK_VERSION = "0.1.0-staging.4924";
16
16
  /**
17
17
  * The header that tells Midsummer which client made each of this package's calls: `Midsummer-Client: sdk/<version>
18
18
  * <part>`, `part` the product whose client it is (`database`, `storage`, `queues`, ...), so the platform counts which
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midsummer-ai/sdk",
3
- "version": "0.1.0-staging.4917",
3
+ "version": "0.1.0-staging.4924",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "description": "Midsummer's handles for an app's code: its Database, Storage, Queues, Vector DB, AI, Email and Agents, with stand-ins for tests.",