@mastra/deployer 1.76.0-alpha.7 → 1.76.0-alpha.9
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/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/docs-deployment-mastra-server.md +2 -2
- package/dist/server/handlers/restart-active-runs.d.ts.map +1 -1
- package/dist/server/index.cjs +12 -9
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.js +13 -10
- package/dist/server/index.js.map +1 -1
- package/package.json +6 -6
package/dist/docs/SKILL.md
CHANGED
|
@@ -3,7 +3,7 @@ name: mastra-deployer
|
|
|
3
3
|
description: Documentation for @mastra/deployer. Use when working with @mastra/deployer APIs, configuration, or implementation.
|
|
4
4
|
metadata:
|
|
5
5
|
package: "@mastra/deployer"
|
|
6
|
-
version: "1.76.0-alpha.
|
|
6
|
+
version: "1.76.0-alpha.9"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## When to use
|
|
@@ -143,7 +143,7 @@ To add your own endpoints, see [Custom API Routes](https://mastra.ai/docs/server
|
|
|
143
143
|
|
|
144
144
|
## Graceful shutdown and rolling deploys
|
|
145
145
|
|
|
146
|
-
By default, the generated server handles `SIGINT` and `SIGTERM`. It stops accepting connections, waits up to [`server.drainTimeout`](https://mastra.ai/reference/configuration) for active requests and streams, then runs `mastra.shutdown()`. Shutdown gives in-flight workflow runs (including durable agent runs) the same drain window to finish before workers and pub/sub subscriptions are torn down. The drain timeout defaults to 5 seconds. A second signal terminates the process immediately. See [`server.handleShutdownSignals`](https://mastra.ai/reference/configuration) if you need to manage signals yourself.
|
|
146
|
+
By default, the generated server handles `SIGINT` and `SIGTERM`. It stops accepting connections, waits up to [`server.drainTimeout`](https://mastra.ai/reference/configuration) for active requests and streams, then runs `mastra.shutdown()`. Shutdown gives in-flight workflow runs (including durable agent runs) the same drain window to finish before workers and pub/sub subscriptions are torn down. A durable agent run still executing after the window stops and releases its claim on the run, so the next boot can recover it right away. The drain timeout defaults to 5 seconds. A second signal terminates the process immediately. See [`server.handleShutdownSignals`](https://mastra.ai/reference/configuration) if you need to manage signals yourself.
|
|
147
147
|
|
|
148
148
|
Increase `drainTimeout` when your hosting platform's termination grace period can accommodate longer turns. The HTTP drain and the workflow drain run one after the other, so keep enough time for both plus shutdown cleanup.
|
|
149
149
|
|
|
@@ -163,7 +163,7 @@ export const mastra = new Mastra({
|
|
|
163
163
|
})
|
|
164
164
|
```
|
|
165
165
|
|
|
166
|
-
A plain `agent.stream()` call can't resume after its server process exits. If a stream ends without its expected terminal event, treat the turn as interrupted and let the client retry or reconcile it. Use [durable agents](https://mastra.ai/docs/harness/durable-agents) when turns must survive process replacement. [Crash recovery](https://mastra.ai/docs/harness/durable-agents) requires shared persistent run storage and idempotent tools. Replaying missed events after a restart also requires a shared persistent cache such as Redis because the default event cache is in-memory.
|
|
166
|
+
A plain `agent.stream()` call can't resume after its server process exits. If a stream ends without its expected terminal event, treat the turn as interrupted and let the client retry or reconcile it. Use [durable agents](https://mastra.ai/docs/harness/durable-agents) when turns must survive process replacement. [Crash recovery](https://mastra.ai/docs/harness/durable-agents) requires shared persistent run storage and idempotent tools. Replaying missed events after a restart also requires a shared persistent cache such as Redis because the default event cache is in-memory. Recovering from multiple replicas requires a storage adapter that supports run fencing or a PubSub backend whose lease every replica shares. See [multi-instance deployments](https://mastra.ai/docs/harness/durable-agents).
|
|
167
167
|
|
|
168
168
|
## Troubleshooting
|
|
169
169
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"restart-active-runs.d.ts","sourceRoot":"","sources":["../../../src/server/handlers/restart-active-runs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAIpC,wBAAsB,mCAAmC,CAAC,CAAC,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"restart-active-runs.d.ts","sourceRoot":"","sources":["../../../src/server/handlers/restart-active-runs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAIpC,wBAAsB,mCAAmC,CAAC,CAAC,EAAE,OAAO,qBAsBnE"}
|
package/dist/server/index.cjs
CHANGED
|
@@ -3502,15 +3502,18 @@ var MastraServer = class extends _mastra_server_server_adapter.MastraServer {
|
|
|
3502
3502
|
*/
|
|
3503
3503
|
async parseFormData(formData) {
|
|
3504
3504
|
const result = {};
|
|
3505
|
-
for (const [key, value] of formData.entries())
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3505
|
+
for (const [key, value] of formData.entries()) {
|
|
3506
|
+
if (!(0, _mastra_server_server_adapter.isSafeObjectKey)(key)) continue;
|
|
3507
|
+
if (value instanceof File) {
|
|
3508
|
+
const arrayBuffer = await value.arrayBuffer();
|
|
3509
|
+
result[key] = Buffer.from(arrayBuffer);
|
|
3510
|
+
} else if (typeof value === "string") try {
|
|
3511
|
+
result[key] = JSON.parse(value);
|
|
3512
|
+
} catch {
|
|
3513
|
+
result[key] = value;
|
|
3514
|
+
}
|
|
3515
|
+
else result[key] = value;
|
|
3512
3516
|
}
|
|
3513
|
-
else result[key] = value;
|
|
3514
3517
|
return result;
|
|
3515
3518
|
}
|
|
3516
3519
|
async sendResponse(route, response, result, prefix) {
|
|
@@ -4032,7 +4035,7 @@ async function healthHandler(c) {
|
|
|
4032
4035
|
async function restartAllActiveWorkflowRunsHandler(c) {
|
|
4033
4036
|
try {
|
|
4034
4037
|
const mastra = c.get("mastra");
|
|
4035
|
-
mastra.restartAllActiveWorkflowRuns().catch((error) => {
|
|
4038
|
+
if (mastra.recoveryConfig?.workflows !== "off") mastra.restartAllActiveWorkflowRuns().catch((error) => {
|
|
4036
4039
|
mastra.getLogger().error("Failed to restart active workflow runs during server startup", { error });
|
|
4037
4040
|
});
|
|
4038
4041
|
if (mastra.recoveryConfig?.durableAgents === "auto") mastra.recoverAllDurableAgents().catch((error) => {
|