@mastra/deployer 1.36.0-alpha.1 → 1.36.0-alpha.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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAIlD,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAIhE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAY5B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAoBnD,KAAK,QAAQ,GAAG,YAAY,CAAC;AAE7B,KAAK,SAAS,GAAG,aAAa,GAAG;IAC/B,OAAO,EAAE,GAAG,CAAC;QAAE,UAAU,EAAE,+BAA+B,CAAA;KAAE,CAAC,CAAC;CAC/D,CAAC;AAgCF,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAE,wCAmB/D;AAED,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,mBAER;cAegC,QAAQ;eAAa,SAAS;2CA0XhE;AAED,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,mBAAmC,mDAyElG"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAIlD,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAIhE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAY5B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAoBnD,KAAK,QAAQ,GAAG,YAAY,CAAC;AAE7B,KAAK,SAAS,GAAG,aAAa,GAAG;IAC/B,OAAO,EAAE,GAAG,CAAC;QAAE,UAAU,EAAE,+BAA+B,CAAA;KAAE,CAAC,CAAC;CAC/D,CAAC;AAgCF,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAE,wCAmB/D;AAED,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,mBAER;cAegC,QAAQ;eAAa,SAAS;2CAoYhE;AAED,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,mBAAmC,mDAyElG"}
@@ -3157,6 +3157,9 @@ async function setupBrowserStream(app, config2) {
3157
3157
  }
3158
3158
  const { injectWebSocket, upgradeWebSocket } = createNodeWebSocket({ app });
3159
3159
  const registry2 = new ViewerRegistry();
3160
+ const rawPrefix = config2.apiPrefix ?? "/api";
3161
+ const trimmed = rawPrefix.endsWith("/") ? rawPrefix.slice(0, -1) : rawPrefix;
3162
+ const apiPrefix = trimmed || "/api";
3160
3163
  app.get(
3161
3164
  "/browser/:agentId/stream",
3162
3165
  upgradeWebSocket((c) => {
@@ -3184,7 +3187,20 @@ async function setupBrowserStream(app, config2) {
3184
3187
  };
3185
3188
  })
3186
3189
  );
3187
- app.post("/api/agents/:agentId/browser/close", async (c) => {
3190
+ app.get(`${apiPrefix}/agents/:agentId/browser/session`, (c) => {
3191
+ const agentId = c.req.param("agentId");
3192
+ if (!agentId) {
3193
+ return c.json({ error: "Agent ID is required" }, 400);
3194
+ }
3195
+ const threadId = c.req.query("threadId");
3196
+ const toolset = config2.getToolset(agentId);
3197
+ if (!toolset) {
3198
+ return c.json({ hasSession: false, screencastAvailable: true });
3199
+ }
3200
+ const hasSession = threadId ? toolset.hasThreadSession(threadId) : false;
3201
+ return c.json({ hasSession, screencastAvailable: true });
3202
+ });
3203
+ app.post(`${apiPrefix}/agents/:agentId/browser/close`, async (c) => {
3188
3204
  const agentId = c.req.param("agentId");
3189
3205
  if (!agentId) {
3190
3206
  return c.json({ error: "Agent ID is required" }, 400);
@@ -3590,7 +3606,7 @@ var MastraServer = class extends MastraServer$1 {
3590
3606
  if (authConfig) {
3591
3607
  const hasPermission = await loadHasPermission();
3592
3608
  if (hasPermission) {
3593
- const userPermissions = c.get("requestContext").get("userPermissions");
3609
+ const userPermissions = c.get("requestContext").get("mastra__userPermissions");
3594
3610
  const permissionError = this.checkRoutePermission(route, userPermissions, hasPermission);
3595
3611
  if (permissionError) {
3596
3612
  return c.json(
@@ -3687,7 +3703,7 @@ var MastraServer = class extends MastraServer$1 {
3687
3703
  if (authConfig) {
3688
3704
  const hasPermission = await loadHasPermission();
3689
3705
  if (hasPermission) {
3690
- const userPermissions = c.get("requestContext").get("userPermissions");
3706
+ const userPermissions = c.get("requestContext").get("mastra__userPermissions");
3691
3707
  const permissionError = this.checkRoutePermission(serverRoute, userPermissions, hasPermission);
3692
3708
  if (permissionError) {
3693
3709
  return c.json(
@@ -4528,8 +4544,15 @@ async function createHonoServer(mastra, options = {
4528
4544
  getToolset: (agentId) => {
4529
4545
  const agent = mastra.getAgentById(agentId);
4530
4546
  return agent?.browser;
4531
- }
4547
+ },
4548
+ apiPrefix
4532
4549
  });
4550
+ if (!browserStreamSetup) {
4551
+ app.get(
4552
+ `${apiPrefix}/agents/:agentId/browser/session`,
4553
+ (c) => c.json({ hasSession: false, screencastAvailable: false })
4554
+ );
4555
+ }
4533
4556
  if (server?.cors === false) {
4534
4557
  app.use("*", timeout(server?.timeout ?? 3 * 60 * 1e3));
4535
4558
  } else {