@mastra/client-js 1.31.2-alpha.4 → 1.31.2-alpha.6

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/index.js CHANGED
@@ -2503,6 +2503,38 @@ var Agent = class extends BaseResource {
2503
2503
  };
2504
2504
  return streamResponse;
2505
2505
  }
2506
+ /**
2507
+ * Re-drives an orphaned RUNNING durable-agent run after a process restart.
2508
+ *
2509
+ * Only supported when the target agent is a durable agent (createDurableAgent).
2510
+ * The server rebuilds the runtime state from the persisted snapshot, replays
2511
+ * past chunks, and continues the loop to completion.
2512
+ */
2513
+ async recover(params) {
2514
+ const body = {
2515
+ runId: params.runId,
2516
+ requestContext: parseClientRequestContext(params.requestContext),
2517
+ versions: params.versions
2518
+ };
2519
+ const response = await this.request(`/agents/${this.agentId}/recover`, {
2520
+ method: "POST",
2521
+ body,
2522
+ stream: true
2523
+ });
2524
+ if (!response.body) {
2525
+ throw new Error("No response body");
2526
+ }
2527
+ const streamResponse = response;
2528
+ streamResponse.processDataStream = async ({
2529
+ onChunk
2530
+ }) => {
2531
+ await processMastraStream({
2532
+ stream: streamResponse.body,
2533
+ onChunk
2534
+ });
2535
+ };
2536
+ return streamResponse;
2537
+ }
2506
2538
  /**
2507
2539
  * @deprecated Use `resumeStream(resumeData, { untilIdle: true, ... })` instead.
2508
2540
  *