@meshagent/meshagent-react 0.36.3 → 0.37.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/CHANGELOG.md CHANGED
@@ -1,3 +1,22 @@
1
+ ## [0.37.2]
2
+ - Stability
3
+
4
+ ## [0.37.1]
5
+ - Added `useAuth` to the React auth package to handle OAuth redirect/callback, token refresh, and profile loading without React Query, plus a `useEnsureLogin` compatibility wrapper.
6
+ - React auth `useMAuthResponse` now deduplicates token exchanges per callback parameters to avoid repeated exchanges on re-renders.
7
+ - Breaking: React auth no longer exports React Query `QueryClient` or `QueryClientProvider`.
8
+ - Breaking: `useLoginScope` now delegates to `useAuth` and defaults the OAuth scope to `email`.
9
+ - Breaking: the `staticAuthorization` helper was removed from the React room connection utilities.
10
+ - React dev terminal hooks now return `RefObject`-typed `containerRef` values for stronger typing.
11
+ - Meshagent TS client now normalizes binary request bodies for fetch and includes TypeScript declarations for runtime entrypoint functions.
12
+
13
+ ## [0.37.0]
14
+ - Breaking: Database client now supports `json`, `uuid`, `list`, and `struct` types with typed wrappers (DatabaseJson/DatabaseStruct/DatabaseExpression/DatabaseDate/DatabaseUuid); list/struct values must be wrapped and update now takes `values` only.
15
+ - Breaking: Containers build now streams build contexts (start/data chunks) with `mountPath`/`chunks` and removes `start_build`.
16
+ - Breaking: Toolkit/hosting refactor replaces RemoteToolkit with startHostedToolkit/HostedToolkit, removes ToolkitConfiguration and `supports_context`, and updates React/Tailwind helpers to start hosted toolkits.
17
+ - Participant tokens now include LLM grants and richer grant serialization (including allowed toolkits and extra payload preservation), and schema helpers add `json`/`uuid` data types.
18
+ - The JS SDK now exports its version constant for client-side visibility.
19
+
1
20
  ## [0.36.3]
2
21
  - Storage client now supports move operations and emits file moved events.
3
22
  - Secrets client now supports existence checks.
@@ -1,7 +1,8 @@
1
- import { RemoteToolkit } from '@meshagent/meshagent';
1
+ import { RoomClient, Toolkit } from '@meshagent/meshagent';
2
2
  interface ClientToolkitsProps {
3
- toolkits: RemoteToolkit[];
3
+ room: RoomClient;
4
+ toolkits: Toolkit[];
4
5
  public?: boolean;
5
6
  }
6
- export declare const useClientToolkits: ({ toolkits, public: isPublic }: ClientToolkitsProps) => void;
7
+ export declare const useClientToolkits: ({ room, toolkits, public: isPublic }: ClientToolkitsProps) => void;
7
8
  export {};
@@ -2,10 +2,35 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useClientToolkits = void 0;
4
4
  const react_1 = require("react");
5
- const useClientToolkits = ({ toolkits, public: isPublic = false }) => {
5
+ const meshagent_1 = require("@meshagent/meshagent");
6
+ const useClientToolkits = ({ room, toolkits, public: isPublic = false }) => {
6
7
  (0, react_1.useEffect)(() => {
7
- toolkits.forEach(toolkit => toolkit.start({ public_: isPublic }));
8
- return () => toolkits.forEach(toolkit => toolkit.stop());
9
- }, [toolkits, isPublic]);
8
+ let disposed = false;
9
+ const startedToolkits = [];
10
+ void (async () => {
11
+ try {
12
+ for (const toolkit of toolkits) {
13
+ const hostedToolkit = await (0, meshagent_1.startHostedToolkit)({
14
+ room,
15
+ toolkit,
16
+ public_: isPublic,
17
+ });
18
+ if (disposed) {
19
+ await hostedToolkit.stop();
20
+ continue;
21
+ }
22
+ startedToolkits.push(hostedToolkit);
23
+ }
24
+ }
25
+ catch (error) {
26
+ await Promise.all(startedToolkits.map((toolkit) => toolkit.stop()));
27
+ console.error("unable to start client toolkits", error);
28
+ }
29
+ })();
30
+ return () => {
31
+ disposed = true;
32
+ void Promise.all(startedToolkits.map((toolkit) => toolkit.stop()));
33
+ };
34
+ }, [room, toolkits, isPublic]);
10
35
  };
11
36
  exports.useClientToolkits = useClientToolkits;
@@ -11,10 +11,6 @@ export declare const developmentAuthorization: ({ url, projectId, apiKeyId, part
11
11
  roomName: string;
12
12
  secret: string;
13
13
  }) => (() => Promise<RoomConnectionInfo>);
14
- export declare const staticAuthorization: ({ url, jwt, }: {
15
- url: string;
16
- jwt: string;
17
- }) => (() => Promise<RoomConnectionInfo>);
18
14
  export interface UseRoomConnectionOptions {
19
15
  /** Async function that returns `{ url, jwt }` for the room. */
20
16
  authorization: () => Promise<{
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.staticAuthorization = exports.developmentAuthorization = void 0;
3
+ exports.developmentAuthorization = void 0;
4
4
  exports.useRoomConnection = useRoomConnection;
5
5
  exports.useRoomIndicators = useRoomIndicators;
6
6
  const react_1 = require("react");
@@ -22,10 +22,8 @@ const developmentAuthorization = ({ url, projectId, apiKeyId, participantName, r
22
22
  return { url, jwt };
23
23
  };
24
24
  exports.developmentAuthorization = developmentAuthorization;
25
- const staticAuthorization = ({ url, jwt, }) => async () => ({ url, jwt });
26
- exports.staticAuthorization = staticAuthorization;
27
25
  function useRoomConnection(props) {
28
- const { authorization, enableMessaging = true, } = props;
26
+ const { authorization, enableMessaging = true } = props;
29
27
  const [client, setClient] = (0, react_1.useState)(null);
30
28
  const [ready, setReady] = (0, react_1.useState)(false);
31
29
  const [state, setState] = (0, react_1.useState)('authorizing');
@@ -1,7 +1,8 @@
1
- import { RemoteToolkit } from '@meshagent/meshagent';
1
+ import { RoomClient, Toolkit } from '@meshagent/meshagent';
2
2
  interface ClientToolkitsProps {
3
- toolkits: RemoteToolkit[];
3
+ room: RoomClient;
4
+ toolkits: Toolkit[];
4
5
  public?: boolean;
5
6
  }
6
- export declare const useClientToolkits: ({ toolkits, public: isPublic }: ClientToolkitsProps) => void;
7
+ export declare const useClientToolkits: ({ room, toolkits, public: isPublic }: ClientToolkitsProps) => void;
7
8
  export {};
@@ -1,7 +1,32 @@
1
1
  import { useEffect } from 'react';
2
- export const useClientToolkits = ({ toolkits, public: isPublic = false }) => {
2
+ import { startHostedToolkit } from '@meshagent/meshagent';
3
+ export const useClientToolkits = ({ room, toolkits, public: isPublic = false }) => {
3
4
  useEffect(() => {
4
- toolkits.forEach(toolkit => toolkit.start({ public_: isPublic }));
5
- return () => toolkits.forEach(toolkit => toolkit.stop());
6
- }, [toolkits, isPublic]);
5
+ let disposed = false;
6
+ const startedToolkits = [];
7
+ void (async () => {
8
+ try {
9
+ for (const toolkit of toolkits) {
10
+ const hostedToolkit = await startHostedToolkit({
11
+ room,
12
+ toolkit,
13
+ public_: isPublic,
14
+ });
15
+ if (disposed) {
16
+ await hostedToolkit.stop();
17
+ continue;
18
+ }
19
+ startedToolkits.push(hostedToolkit);
20
+ }
21
+ }
22
+ catch (error) {
23
+ await Promise.all(startedToolkits.map((toolkit) => toolkit.stop()));
24
+ console.error("unable to start client toolkits", error);
25
+ }
26
+ })();
27
+ return () => {
28
+ disposed = true;
29
+ void Promise.all(startedToolkits.map((toolkit) => toolkit.stop()));
30
+ };
31
+ }, [room, toolkits, isPublic]);
7
32
  };
@@ -11,10 +11,6 @@ export declare const developmentAuthorization: ({ url, projectId, apiKeyId, part
11
11
  roomName: string;
12
12
  secret: string;
13
13
  }) => (() => Promise<RoomConnectionInfo>);
14
- export declare const staticAuthorization: ({ url, jwt, }: {
15
- url: string;
16
- jwt: string;
17
- }) => (() => Promise<RoomConnectionInfo>);
18
14
  export interface UseRoomConnectionOptions {
19
15
  /** Async function that returns `{ url, jwt }` for the room. */
20
16
  authorization: () => Promise<{
@@ -16,9 +16,8 @@ export const developmentAuthorization = ({ url, projectId, apiKeyId, participant
16
16
  const jwt = await token.toJwt({ token: secret });
17
17
  return { url, jwt };
18
18
  };
19
- export const staticAuthorization = ({ url, jwt, }) => async () => ({ url, jwt });
20
19
  export function useRoomConnection(props) {
21
- const { authorization, enableMessaging = true, } = props;
20
+ const { authorization, enableMessaging = true } = props;
22
21
  const [client, setClient] = useState(null);
23
22
  const [ready, setReady] = useState(false);
24
23
  const [state, setState] = useState('authorizing');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meshagent/meshagent-react",
3
- "version": "0.36.3",
3
+ "version": "0.37.2",
4
4
  "description": "Meshagent React Client",
5
5
  "homepage": "https://github.com/meshagent/meshagent-react",
6
6
  "scripts": {
@@ -34,7 +34,7 @@
34
34
  "base-64": "^1.0.0",
35
35
  "livekit-client": "^2.15.5",
36
36
  "react": "^19.1.0",
37
- "@meshagent/meshagent": "^0.36.3",
37
+ "@meshagent/meshagent": "^0.37.2",
38
38
  "react-dom": "^19.1.0",
39
39
  "typescript": "^5.8.3",
40
40
  "uuid": "^11.1.0",