@multiplayer-app/ai-agent-react 0.1.0-beta.70 → 0.1.0-beta.72
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/ai-agent-react.cjs.js +2 -2
- package/dist/ai-agent-react.cjs.js.map +1 -1
- package/dist/ai-agent-react.es.js +18 -3
- package/dist/ai-agent-react.es.js.map +1 -1
- package/dist/context/SocketProvider.d.ts.map +1 -1
- package/dist/runtime/AgentRuntime.d.ts +12 -0
- package/dist/runtime/AgentRuntime.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -32330,6 +32330,7 @@ class r_e {
|
|
|
32330
32330
|
* Host apps can subscribe via `runtime.events.addEventListener(...)`.
|
|
32331
32331
|
*/
|
|
32332
32332
|
events;
|
|
32333
|
+
socketClient = null;
|
|
32333
32334
|
toolRendererMap = /* @__PURE__ */ new Map();
|
|
32334
32335
|
storeRef;
|
|
32335
32336
|
pageContextProviders = /* @__PURE__ */ new Set();
|
|
@@ -32411,6 +32412,20 @@ class r_e {
|
|
|
32411
32412
|
attachStore(t) {
|
|
32412
32413
|
this.storeRef = t;
|
|
32413
32414
|
}
|
|
32415
|
+
/**
|
|
32416
|
+
* Live Socket.IO client when proxy transport is used and `SocketProvider` has created a client.
|
|
32417
|
+
* Host apps can attach listeners with `runtime.socket?.on(...)`.
|
|
32418
|
+
* Listen for `runtime:socket-changed` on `runtime.events` if you need to react when the instance is replaced.
|
|
32419
|
+
*/
|
|
32420
|
+
get socket() {
|
|
32421
|
+
return this.socketClient;
|
|
32422
|
+
}
|
|
32423
|
+
/**
|
|
32424
|
+
* @internal Used by `SocketProvider` to publish the active client (or clear it on teardown / non-proxy mode).
|
|
32425
|
+
*/
|
|
32426
|
+
setSocketClient(t) {
|
|
32427
|
+
this.socketClient !== t && (this.socketClient = t, this.events.dispatchEvent(new CustomEvent("runtime:socket-changed", { detail: { socket: t } })));
|
|
32428
|
+
}
|
|
32414
32429
|
registerTool(t) {
|
|
32415
32430
|
this.tools.register(t);
|
|
32416
32431
|
}
|
|
@@ -34916,7 +34931,7 @@ const owe = fp(null), swe = ({ children: e }) => {
|
|
|
34916
34931
|
m.current = a, h.current = n, g.current = r;
|
|
34917
34932
|
}, [a, n, r]), Ge(() => {
|
|
34918
34933
|
if (s.mode !== "proxy") {
|
|
34919
|
-
u(null), p(void 0), t.transport instanceof oa && t.transport.setSocketId(void 0);
|
|
34934
|
+
u(null), p(void 0), t.setSocketClient(null), t.transport instanceof oa && t.transport.setSocketId(void 0);
|
|
34920
34935
|
return;
|
|
34921
34936
|
}
|
|
34922
34937
|
const v = s.baseUrl, b = new URL(v, window.location.origin), w = `${b.protocol}//${b.host}`, x = s.socketNamespace, S = x ? `${w}${x}` : w, E = {}, F = s;
|
|
@@ -34929,7 +34944,7 @@ const owe = fp(null), swe = ({ children: e }) => {
|
|
|
34929
34944
|
transports: ["websocket", "polling"],
|
|
34930
34945
|
...Object.keys(E).length > 0 && { extraHeaders: E }
|
|
34931
34946
|
});
|
|
34932
|
-
u(G);
|
|
34947
|
+
t.setSocketClient(G), u(G);
|
|
34933
34948
|
const Y = () => {
|
|
34934
34949
|
p(G.id), t.transport instanceof oa && t.transport.setSocketId(G.id);
|
|
34935
34950
|
}, J = () => {
|
|
@@ -34968,7 +34983,7 @@ const owe = fp(null), swe = ({ children: e }) => {
|
|
|
34968
34983
|
return G.on("connect", Y), G.on("disconnect", J), G.on("connect_error", ($) => {
|
|
34969
34984
|
console.error("Socket.IO connection error:", $.message);
|
|
34970
34985
|
}), G.on(ds.ChatNew, W), G.on(ds.MessageNew, R), G.on(ds.ChatUpdate, U), () => {
|
|
34971
|
-
t.transport instanceof oa && t.transport.setSocketId(void 0), p(void 0), u(null), G.disconnect();
|
|
34986
|
+
t.transport instanceof oa && t.transport.setSocketId(void 0), t.setSocketClient(null), p(void 0), u(null), G.disconnect();
|
|
34972
34987
|
};
|
|
34973
34988
|
}, [
|
|
34974
34989
|
t,
|