@mastra/hono 1.4.18-alpha.0 → 1.4.18-alpha.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 +33 -0
- package/dist/browser-stream/index.d.ts.map +1 -1
- package/dist/index.cjs +19 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +19 -3
- package/dist/index.js.map +1 -1
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# @mastra/hono
|
|
2
2
|
|
|
3
|
+
## 1.4.18-alpha.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated the adapter permission check to read user permissions from the new namespaced request-context key `mastra__userPermissions` (was `userPermissions`). This matches the namespaced keys that `@mastra/server`'s core auth middleware now writes and avoids collisions with caller-supplied context entries. ([#16605](https://github.com/mastra-ai/mastra/pull/16605))
|
|
8
|
+
|
|
9
|
+
No action needed for typical users — install the matching `@mastra/server` release and the adapter will continue to enforce route permissions exactly as before.
|
|
10
|
+
|
|
11
|
+
- Bumped the `@mastra/core` peer dependency floor from `>=1.32.0-0` to `>=1.34.0-0`. ([#16666](https://github.com/mastra-ai/mastra/pull/16666))
|
|
12
|
+
|
|
13
|
+
- Added `GET /agents/:agentId/browser/session` endpoint (under the configured `apiPrefix`, default `/api`) that reports whether a screencast WebSocket should be opened for an agent and thread. Clients can probe this before upgrading to a WebSocket to avoid idle connections and reconnect storms. ([#16668](https://github.com/mastra-ai/mastra/pull/16668))
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
curl "http://localhost:4111/api/agents/my-agent/browser/session?threadId=thread-1"
|
|
17
|
+
# {"hasSession":true,"screencastAvailable":true}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
The response shape is `{ hasSession: boolean, screencastAvailable: true }`. `screencastAvailable` is always `true` when this route is registered; the deployer registers a fallback that returns `{ hasSession: false, screencastAvailable: false }` when browser streaming packages aren't installed, so clients can use the same probe in both cases.
|
|
21
|
+
|
|
22
|
+
`setupBrowserStream` now accepts an optional `apiPrefix` so the probe and existing `POST /agents/:agentId/browser/close` routes are mounted under the same prefix as the rest of the server. The deployer wires this from `mastra.getServer().apiPrefix` automatically.
|
|
23
|
+
|
|
24
|
+
- Updated dependencies [[`5ba7253`](https://github.com/mastra-ai/mastra/commit/5ba7253745c85e8df8012a76d954c640ffa336f7), [`f73980d`](https://github.com/mastra-ai/mastra/commit/f73980d651eb5f7f1ab20582de4615a1b6f10fce), [`f73980d`](https://github.com/mastra-ai/mastra/commit/f73980d651eb5f7f1ab20582de4615a1b6f10fce), [`9c88701`](https://github.com/mastra-ai/mastra/commit/9c8870195b41a38dc40b6ba2aa55eda04df8fa69), [`f73980d`](https://github.com/mastra-ai/mastra/commit/f73980d651eb5f7f1ab20582de4615a1b6f10fce), [`9c88701`](https://github.com/mastra-ai/mastra/commit/9c8870195b41a38dc40b6ba2aa55eda04df8fa69), [`9c88701`](https://github.com/mastra-ai/mastra/commit/9c8870195b41a38dc40b6ba2aa55eda04df8fa69), [`9c88701`](https://github.com/mastra-ai/mastra/commit/9c8870195b41a38dc40b6ba2aa55eda04df8fa69), [`4e88dc6`](https://github.com/mastra-ai/mastra/commit/4e88dc6b89f154c0eae37221c8126be0c23c569f), [`19018f0`](https://github.com/mastra-ai/mastra/commit/19018f05722af74a5978781a7731a654b26f7f2a), [`5ba7253`](https://github.com/mastra-ai/mastra/commit/5ba7253745c85e8df8012a76d954c640ffa336f7)]:
|
|
25
|
+
- @mastra/core@1.36.0-alpha.2
|
|
26
|
+
- @mastra/server@1.36.0-alpha.2
|
|
27
|
+
|
|
28
|
+
## 1.4.18-alpha.1
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- Updated dependencies [[`8cdb86c`](https://github.com/mastra-ai/mastra/commit/8cdb86ceed1137bc2768e147dce85a0692b9fb26), [`eda90c5`](https://github.com/mastra-ai/mastra/commit/eda90c5bfd7de11805ecc9f4552716c895fbaf78), [`afc004f`](https://github.com/mastra-ai/mastra/commit/afc004f5cc7e30697809e7021820b9f5881e6719), [`408be73`](https://github.com/mastra-ai/mastra/commit/408be73449dfab92b51eab8c6623b6c443debc25)]:
|
|
33
|
+
- @mastra/core@1.36.0-alpha.1
|
|
34
|
+
- @mastra/server@1.36.0-alpha.1
|
|
35
|
+
|
|
3
36
|
## 1.4.18-alpha.0
|
|
4
37
|
|
|
5
38
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/browser-stream/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAC9F,OAAO,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAsB,kBAAkB,CAAC,CAAC,SAAS,GAAG,EAAE,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,EACxF,GAAG,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAClB,MAAM,EAAE,mBAAmB,GAC1B,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/browser-stream/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAC9F,OAAO,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAsB,kBAAkB,CAAC,CAAC,SAAS,GAAG,EAAE,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,EACxF,GAAG,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAClB,MAAM,EAAE,mBAAmB,GAC1B,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAuIrC"}
|
package/dist/index.cjs
CHANGED
|
@@ -469,6 +469,9 @@ async function setupBrowserStream(app, config2) {
|
|
|
469
469
|
}
|
|
470
470
|
const { injectWebSocket, upgradeWebSocket } = createNodeWebSocket({ app });
|
|
471
471
|
const registry2 = new browserStream.ViewerRegistry();
|
|
472
|
+
const rawPrefix = config2.apiPrefix ?? "/api";
|
|
473
|
+
const trimmed = rawPrefix.endsWith("/") ? rawPrefix.slice(0, -1) : rawPrefix;
|
|
474
|
+
const apiPrefix = trimmed || "/api";
|
|
472
475
|
app.get(
|
|
473
476
|
"/browser/:agentId/stream",
|
|
474
477
|
upgradeWebSocket((c) => {
|
|
@@ -496,7 +499,20 @@ async function setupBrowserStream(app, config2) {
|
|
|
496
499
|
};
|
|
497
500
|
})
|
|
498
501
|
);
|
|
499
|
-
app.
|
|
502
|
+
app.get(`${apiPrefix}/agents/:agentId/browser/session`, (c) => {
|
|
503
|
+
const agentId = c.req.param("agentId");
|
|
504
|
+
if (!agentId) {
|
|
505
|
+
return c.json({ error: "Agent ID is required" }, 400);
|
|
506
|
+
}
|
|
507
|
+
const threadId = c.req.query("threadId");
|
|
508
|
+
const toolset = config2.getToolset(agentId);
|
|
509
|
+
if (!toolset) {
|
|
510
|
+
return c.json({ hasSession: false, screencastAvailable: true });
|
|
511
|
+
}
|
|
512
|
+
const hasSession = threadId ? toolset.hasThreadSession(threadId) : false;
|
|
513
|
+
return c.json({ hasSession, screencastAvailable: true });
|
|
514
|
+
});
|
|
515
|
+
app.post(`${apiPrefix}/agents/:agentId/browser/close`, async (c) => {
|
|
500
516
|
const agentId = c.req.param("agentId");
|
|
501
517
|
if (!agentId) {
|
|
502
518
|
return c.json({ error: "Agent ID is required" }, 400);
|
|
@@ -904,7 +920,7 @@ var MastraServer = class extends serverAdapter.MastraServer {
|
|
|
904
920
|
if (authConfig) {
|
|
905
921
|
const hasPermission = await loadHasPermission();
|
|
906
922
|
if (hasPermission) {
|
|
907
|
-
const userPermissions = c.get("requestContext").get("
|
|
923
|
+
const userPermissions = c.get("requestContext").get("mastra__userPermissions");
|
|
908
924
|
const permissionError = this.checkRoutePermission(route, userPermissions, hasPermission);
|
|
909
925
|
if (permissionError) {
|
|
910
926
|
return c.json(
|
|
@@ -1001,7 +1017,7 @@ var MastraServer = class extends serverAdapter.MastraServer {
|
|
|
1001
1017
|
if (authConfig) {
|
|
1002
1018
|
const hasPermission = await loadHasPermission();
|
|
1003
1019
|
if (hasPermission) {
|
|
1004
|
-
const userPermissions = c.get("requestContext").get("
|
|
1020
|
+
const userPermissions = c.get("requestContext").get("mastra__userPermissions");
|
|
1005
1021
|
const permissionError = this.checkRoutePermission(serverRoute, userPermissions, hasPermission);
|
|
1006
1022
|
if (permissionError) {
|
|
1007
1023
|
return c.json(
|