orchestrator-client 5.7.10 → 5.8.3

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.cjs CHANGED
@@ -759,6 +759,7 @@ var OrchestratorAsync = class {
759
759
  const body = {
760
760
  user_id: params.userId,
761
761
  goal_prompt: params.goalPrompt,
762
+ variant: params.variant ?? "portal_user",
762
763
  title: params.title,
763
764
  agent_model_id: params.agentModelId,
764
765
  orchestrator_model_id: params.orchestratorModelId,
@@ -1848,6 +1849,11 @@ var RealtimeClient = class {
1848
1849
  this._socket = null;
1849
1850
  this._handlers = /* @__PURE__ */ new Map();
1850
1851
  this._connected = false;
1852
+ // Every room joined through any API (subscribeTask, joinRooms, subscribe(),
1853
+ // subscribeEvents, etc.) is tracked here so it can be replayed on reconnect.
1854
+ // Server-side room membership is tied to the socket connection and is lost
1855
+ // on disconnect — the full set must be re-emitted on every reconnect.
1856
+ this._rooms = /* @__PURE__ */ new Set();
1851
1857
  // Multi-subscriber room-diffing state (mirrors WebSocketProvider)
1852
1858
  this._subscriptions = /* @__PURE__ */ new Map();
1853
1859
  this._currentRooms = /* @__PURE__ */ new Set();
@@ -1884,6 +1890,10 @@ var RealtimeClient = class {
1884
1890
  this._socket.on("connect", () => {
1885
1891
  this._connected = true;
1886
1892
  this._currentRooms = /* @__PURE__ */ new Set();
1893
+ if (this._rooms.size > 0) {
1894
+ this._socket?.emit("join", { rooms: [...this._rooms] });
1895
+ this._currentRooms = new Set(this._rooms);
1896
+ }
1887
1897
  this._syncRooms();
1888
1898
  });
1889
1899
  this._socket.on("disconnect", () => {
@@ -1941,7 +1951,9 @@ var RealtimeClient = class {
1941
1951
  */
1942
1952
  subscribeTask(taskId) {
1943
1953
  if (!this._socket) throw new Error("RealtimeClient not connected");
1944
- this._socket.emit("join", { rooms: [`task:${taskId}`] });
1954
+ const room = `task:${taskId}`;
1955
+ this._socket.emit("join", { rooms: [room] });
1956
+ this._rooms.add(room);
1945
1957
  }
1946
1958
  /**
1947
1959
  * Unsubscribe from realtime events for a specific task.
@@ -1949,7 +1961,9 @@ var RealtimeClient = class {
1949
1961
  */
1950
1962
  unsubscribeTask(taskId) {
1951
1963
  if (!this._socket) throw new Error("RealtimeClient not connected");
1952
- this._socket.emit("leave", { rooms: [`task:${taskId}`] });
1964
+ const room = `task:${taskId}`;
1965
+ this._socket.emit("leave", { rooms: [room] });
1966
+ this._rooms.delete(room);
1953
1967
  }
1954
1968
  /**
1955
1969
  * Subscribe to event-type-scoped rooms.
@@ -1959,6 +1973,7 @@ var RealtimeClient = class {
1959
1973
  if (!this._socket) throw new Error("RealtimeClient not connected");
1960
1974
  const rooms = eventTypes.map((t) => `event:${t}`);
1961
1975
  this._socket.emit("join", { rooms });
1976
+ for (const r of rooms) this._rooms.add(r);
1962
1977
  }
1963
1978
  /**
1964
1979
  * Unsubscribe from event-type-scoped rooms.
@@ -1967,6 +1982,7 @@ var RealtimeClient = class {
1967
1982
  if (!this._socket) throw new Error("RealtimeClient not connected");
1968
1983
  const rooms = eventTypes.map((t) => `event:${t}`);
1969
1984
  this._socket.emit("leave", { rooms });
1985
+ for (const r of rooms) this._rooms.delete(r);
1970
1986
  }
1971
1987
  /**
1972
1988
  * Subscribe to the `all` broadcast room (receives all events).
@@ -1974,20 +1990,25 @@ var RealtimeClient = class {
1974
1990
  subscribeAll() {
1975
1991
  if (!this._socket) throw new Error("RealtimeClient not connected");
1976
1992
  this._socket.emit("join", { rooms: ["all"] });
1993
+ this._rooms.add("all");
1977
1994
  }
1978
1995
  /**
1979
1996
  * Subscribe to a locale-specific room.
1980
1997
  */
1981
1998
  subscribeLocale(locale) {
1982
1999
  if (!this._socket) throw new Error("RealtimeClient not connected");
1983
- this._socket.emit("join", { rooms: [`locale:${locale}`] });
2000
+ const room = `locale:${locale}`;
2001
+ this._socket.emit("join", { rooms: [room] });
2002
+ this._rooms.add(room);
1984
2003
  }
1985
2004
  /**
1986
2005
  * Unsubscribe from a locale-specific room.
1987
2006
  */
1988
2007
  unsubscribeLocale(locale) {
1989
2008
  if (!this._socket) throw new Error("RealtimeClient not connected");
1990
- this._socket.emit("leave", { rooms: [`locale:${locale}`] });
2009
+ const room = `locale:${locale}`;
2010
+ this._socket.emit("leave", { rooms: [room] });
2011
+ this._rooms.delete(room);
1991
2012
  }
1992
2013
  /**
1993
2014
  * Join arbitrary rooms by name.
@@ -1995,6 +2016,7 @@ var RealtimeClient = class {
1995
2016
  joinRooms(rooms) {
1996
2017
  if (!this._socket) throw new Error("RealtimeClient not connected");
1997
2018
  this._socket.emit("join", { rooms });
2019
+ for (const r of rooms) this._rooms.add(r);
1998
2020
  }
1999
2021
  /**
2000
2022
  * Leave arbitrary rooms by name.
@@ -2002,6 +2024,7 @@ var RealtimeClient = class {
2002
2024
  leaveRooms(rooms) {
2003
2025
  if (!this._socket) throw new Error("RealtimeClient not connected");
2004
2026
  this._socket.emit("leave", { rooms });
2027
+ for (const r of rooms) this._rooms.delete(r);
2005
2028
  }
2006
2029
  // ------------------------------------------------------------------
2007
2030
  // Multi-subscriber API (mirrors WebSocketProvider room-diffing)
@@ -2059,6 +2082,8 @@ var RealtimeClient = class {
2059
2082
  const toLeave = [...this._currentRooms].filter((r) => !needed.has(r));
2060
2083
  if (toJoin.length) socket.emit("join", { rooms: toJoin });
2061
2084
  if (toLeave.length) socket.emit("leave", { rooms: toLeave });
2085
+ for (const r of toJoin) this._rooms.add(r);
2086
+ for (const r of toLeave) this._rooms.delete(r);
2062
2087
  this._currentRooms = needed;
2063
2088
  }
2064
2089
  /**