@mastra/hono 1.4.18-alpha.1 → 1.4.18-alpha.10

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,5 +1,96 @@
1
1
  # @mastra/hono
2
2
 
3
+ ## 1.4.18-alpha.10
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`27fd1b7`](https://github.com/mastra-ai/mastra/commit/27fd1b79ac62eb7694f92587eb7d1be05b59be01), [`a702009`](https://github.com/mastra-ai/mastra/commit/a702009d3cfaa745120f501e21c783ed4d6a3072), [`48cf61e`](https://github.com/mastra-ai/mastra/commit/48cf61e2cc759a61b6631566acf381d46ca9e12e), [`8534d79`](https://github.com/mastra-ai/mastra/commit/8534d791fa1cb70fe1c19e2604c4b63cc10dd051), [`c78f8cd`](https://github.com/mastra-ai/mastra/commit/c78f8cd6222a86e6c60ae5210b6929ad5221b6fb), [`e146aad`](https://github.com/mastra-ai/mastra/commit/e146aadbba66c410ba0e74bac4c50135495cb8dd), [`1a0ec78`](https://github.com/mastra-ai/mastra/commit/1a0ec789a26cae443744e9abbd62ed6ee676af39), [`d52b6fe`](https://github.com/mastra-ai/mastra/commit/d52b6fe1c56853eb38864baae0bbfa75cc739ccb)]:
8
+ - @mastra/core@1.36.0-alpha.10
9
+ - @mastra/server@1.36.0-alpha.10
10
+
11
+ ## 1.4.18-alpha.9
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [[`bd92c15`](https://github.com/mastra-ai/mastra/commit/bd92c154238ce5d05e12d5477da07c7b7292c5e3), [`bd92c15`](https://github.com/mastra-ai/mastra/commit/bd92c154238ce5d05e12d5477da07c7b7292c5e3), [`1698f5e`](https://github.com/mastra-ai/mastra/commit/1698f5ec141d34f22a873efdb145ce3cdf848a5e)]:
16
+ - @mastra/server@1.36.0-alpha.9
17
+ - @mastra/core@1.36.0-alpha.9
18
+
19
+ ## 1.4.18-alpha.8
20
+
21
+ ### Patch Changes
22
+
23
+ - Updated dependencies [[`9aee493`](https://github.com/mastra-ai/mastra/commit/9aee493ed6089b5133472623dcce49934bf2d509)]:
24
+ - @mastra/core@1.36.0-alpha.8
25
+ - @mastra/server@1.36.0-alpha.8
26
+
27
+ ## 1.4.18-alpha.7
28
+
29
+ ### Patch Changes
30
+
31
+ - The Hono adapter now awaits `getToolset` calls in browser-stream routes, supporting deployers that resolve agents asynchronously (such as stored agents looked up via the editor). ([#16778](https://github.com/mastra-ai/mastra/pull/16778))
32
+
33
+ - Updated dependencies [[`a935b0a`](https://github.com/mastra-ai/mastra/commit/a935b0a0977ae3f196b33ec7621f528069c82db0), [`a935b0a`](https://github.com/mastra-ai/mastra/commit/a935b0a0977ae3f196b33ec7621f528069c82db0)]:
34
+ - @mastra/core@1.36.0-alpha.7
35
+ - @mastra/server@1.36.0-alpha.7
36
+
37
+ ## 1.4.18-alpha.6
38
+
39
+ ### Patch Changes
40
+
41
+ - Updated dependencies [[`71a820b`](https://github.com/mastra-ai/mastra/commit/71a820b2353fa1406772c50760a3732058a8b337)]:
42
+ - @mastra/core@1.36.0-alpha.6
43
+ - @mastra/server@1.36.0-alpha.6
44
+
45
+ ## 1.4.18-alpha.5
46
+
47
+ ### Patch Changes
48
+
49
+ - Updated dependencies [[`ac79462`](https://github.com/mastra-ai/mastra/commit/ac79462b98f1062394c45093aa515b0766f27ee2), [`19281c7`](https://github.com/mastra-ai/mastra/commit/19281c70424f757219782de16c2699743c5e04d0)]:
50
+ - @mastra/core@1.36.0-alpha.5
51
+ - @mastra/server@1.36.0-alpha.5
52
+
53
+ ## 1.4.18-alpha.4
54
+
55
+ ### Patch Changes
56
+
57
+ - Updated dependencies [[`c272d50`](https://github.com/mastra-ai/mastra/commit/c272d50610a54496b6b6d92ccd4d37b333a2613a), [`d8692af`](https://github.com/mastra-ai/mastra/commit/d8692afa253028e39cdce2aafa0ac414071a762e), [`841a222`](https://github.com/mastra-ai/mastra/commit/841a222560d8c19238f8213713f30535cdd82284)]:
58
+ - @mastra/core@1.36.0-alpha.4
59
+ - @mastra/server@1.36.0-alpha.4
60
+
61
+ ## 1.4.18-alpha.3
62
+
63
+ ### Patch Changes
64
+
65
+ - Updated dependencies [[`5556cc1`](https://github.com/mastra-ai/mastra/commit/5556cc1befec71518d84f826b3bfe3a079a9daf7), [`5499303`](https://github.com/mastra-ai/mastra/commit/54993032c1ebc09642625b78d2014e0cf84a3cae), [`5499303`](https://github.com/mastra-ai/mastra/commit/54993032c1ebc09642625b78d2014e0cf84a3cae), [`3498b49`](https://github.com/mastra-ai/mastra/commit/3498b4946be94f4313cd817733589680dcda5278), [`e47bca7`](https://github.com/mastra-ai/mastra/commit/e47bca7b72866d3abd173b9f530ac4318113a8ff), [`bfadd40`](https://github.com/mastra-ai/mastra/commit/bfadd4049df2977080f7f6c1602dc094a6e0f2f4), [`0031d0f`](https://github.com/mastra-ai/mastra/commit/0031d0f13831d7843ac5d498734a7d92862e2ce3), [`3498b49`](https://github.com/mastra-ai/mastra/commit/3498b4946be94f4313cd817733589680dcda5278), [`359439b`](https://github.com/mastra-ai/mastra/commit/359439bb8c635e048176306828195f8297f50021)]:
66
+ - @mastra/core@1.36.0-alpha.3
67
+ - @mastra/server@1.36.0-alpha.3
68
+
69
+ ## 1.4.18-alpha.2
70
+
71
+ ### Patch Changes
72
+
73
+ - 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))
74
+
75
+ No action needed for typical users — install the matching `@mastra/server` release and the adapter will continue to enforce route permissions exactly as before.
76
+
77
+ - 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))
78
+
79
+ - 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))
80
+
81
+ ```bash
82
+ curl "http://localhost:4111/api/agents/my-agent/browser/session?threadId=thread-1"
83
+ # {"hasSession":true,"screencastAvailable":true}
84
+ ```
85
+
86
+ 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.
87
+
88
+ `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.
89
+
90
+ - 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)]:
91
+ - @mastra/core@1.36.0-alpha.2
92
+ - @mastra/server@1.36.0-alpha.2
93
+
3
94
  ## 1.4.18-alpha.1
4
95
 
5
96
  ### 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,CA0GrC"}
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) => {
@@ -483,7 +486,7 @@ async function setupBrowserStream(app, config2) {
483
486
  onMessage(event, _ws) {
484
487
  const data = typeof event.data === "string" ? event.data : null;
485
488
  if (data) {
486
- browserStream.handleInputMessage(data, config2.getToolset, agentId, threadId);
489
+ void browserStream.handleInputMessage(data, config2.getToolset, agentId, threadId);
487
490
  }
488
491
  },
489
492
  onClose(_event, ws) {
@@ -496,12 +499,25 @@ async function setupBrowserStream(app, config2) {
496
499
  };
497
500
  })
498
501
  );
499
- app.post("/api/agents/:agentId/browser/close", async (c) => {
502
+ app.get(`${apiPrefix}/agents/:agentId/browser/session`, async (c) => {
500
503
  const agentId = c.req.param("agentId");
501
504
  if (!agentId) {
502
505
  return c.json({ error: "Agent ID is required" }, 400);
503
506
  }
504
- const toolset = config2.getToolset(agentId);
507
+ const threadId = c.req.query("threadId");
508
+ const toolset = await 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) => {
516
+ const agentId = c.req.param("agentId");
517
+ if (!agentId) {
518
+ return c.json({ error: "Agent ID is required" }, 400);
519
+ }
520
+ const toolset = await config2.getToolset(agentId);
505
521
  if (!toolset) {
506
522
  return c.json({ error: "No browser session for this agent" }, 404);
507
523
  }
@@ -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("userPermissions");
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("userPermissions");
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(