@mastra/deployer 1.36.0-alpha.6 → 1.36.0-alpha.7

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;2CAoYhE;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;2CAmZhE;AAED,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,mBAAmC,mDAyElG"}
@@ -3174,7 +3174,7 @@ async function setupBrowserStream(app, config2) {
3174
3174
  onMessage(event, _ws) {
3175
3175
  const data = typeof event.data === "string" ? event.data : null;
3176
3176
  if (data) {
3177
- handleInputMessage(data, config2.getToolset, agentId, threadId);
3177
+ void handleInputMessage(data, config2.getToolset, agentId, threadId);
3178
3178
  }
3179
3179
  },
3180
3180
  onClose(_event, ws) {
@@ -3187,13 +3187,13 @@ async function setupBrowserStream(app, config2) {
3187
3187
  };
3188
3188
  })
3189
3189
  );
3190
- app.get(`${apiPrefix}/agents/:agentId/browser/session`, (c) => {
3190
+ app.get(`${apiPrefix}/agents/:agentId/browser/session`, async (c) => {
3191
3191
  const agentId = c.req.param("agentId");
3192
3192
  if (!agentId) {
3193
3193
  return c.json({ error: "Agent ID is required" }, 400);
3194
3194
  }
3195
3195
  const threadId = c.req.query("threadId");
3196
- const toolset = config2.getToolset(agentId);
3196
+ const toolset = await config2.getToolset(agentId);
3197
3197
  if (!toolset) {
3198
3198
  return c.json({ hasSession: false, screencastAvailable: true });
3199
3199
  }
@@ -3205,7 +3205,7 @@ async function setupBrowserStream(app, config2) {
3205
3205
  if (!agentId) {
3206
3206
  return c.json({ error: "Agent ID is required" }, 400);
3207
3207
  }
3208
- const toolset = config2.getToolset(agentId);
3208
+ const toolset = await config2.getToolset(agentId);
3209
3209
  if (!toolset) {
3210
3210
  return c.json({ error: "No browser session for this agent" }, 404);
3211
3211
  }
@@ -4541,9 +4541,20 @@ async function createHonoServer(mastra, options = {
4541
4541
  }
4542
4542
  }
4543
4543
  const browserStreamSetup = await setupBrowserStream(app, {
4544
- getToolset: (agentId) => {
4545
- const agent = mastra.getAgentById(agentId);
4546
- return agent?.browser;
4544
+ getToolset: async (agentId) => {
4545
+ try {
4546
+ const runtimeAgent = mastra.getAgentById(agentId);
4547
+ if (runtimeAgent) {
4548
+ return runtimeAgent.browser;
4549
+ }
4550
+ } catch {
4551
+ }
4552
+ try {
4553
+ const storedAgent = await mastra.getEditor?.()?.agent.getById(agentId);
4554
+ return storedAgent?.browser;
4555
+ } catch {
4556
+ return void 0;
4557
+ }
4547
4558
  },
4548
4559
  apiPrefix
4549
4560
  });