@mastra/client-js 1.15.0-alpha.1 → 1.15.0-alpha.2

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
@@ -1312,7 +1312,8 @@ var Agent = class extends BaseResource {
1312
1312
  ...processedParams,
1313
1313
  messages: updatedMessages
1314
1314
  },
1315
- controller
1315
+ controller,
1316
+ route
1316
1317
  );
1317
1318
  } catch (error) {
1318
1319
  console.error("Error processing recursive stream response:", error);
@@ -1465,6 +1466,46 @@ var Agent = class extends BaseResource {
1465
1466
  };
1466
1467
  return streamResponse;
1467
1468
  }
1469
+ async streamUntilIdle(messagesOrParams, options) {
1470
+ let params = {
1471
+ messages: messagesOrParams,
1472
+ ...options
1473
+ };
1474
+ let structuredOutput = void 0;
1475
+ if (params.structuredOutput?.schema) {
1476
+ structuredOutput = {
1477
+ ...params.structuredOutput,
1478
+ schema: standardSchemaToJSONSchema(toStandardSchema(params.structuredOutput.schema))
1479
+ };
1480
+ }
1481
+ const processedParams = {
1482
+ ...params,
1483
+ requestContext: parseClientRequestContext(params.requestContext),
1484
+ clientTools: processClientTools(params.clientTools),
1485
+ structuredOutput
1486
+ };
1487
+ let readableController;
1488
+ const readable = new ReadableStream({
1489
+ start(controller) {
1490
+ readableController = controller;
1491
+ }
1492
+ });
1493
+ const response = await this.processStreamResponse(processedParams, readableController, "stream-until-idle");
1494
+ const streamResponse = new Response(readable, {
1495
+ status: response.status,
1496
+ statusText: response.statusText,
1497
+ headers: response.headers
1498
+ });
1499
+ streamResponse.processDataStream = async ({
1500
+ onChunk
1501
+ }) => {
1502
+ await processMastraStream({
1503
+ stream: streamResponse.body,
1504
+ onChunk
1505
+ });
1506
+ };
1507
+ return streamResponse;
1508
+ }
1468
1509
  async approveToolCall(params) {
1469
1510
  const { requestContext, ...rest } = params;
1470
1511
  const processedParams = { ...rest, requestContext: parseClientRequestContext(requestContext) };
@@ -5777,6 +5818,7 @@ var MastraClient = class extends BaseResource {
5777
5818
  if (params.runId) searchParams.set("runId", params.runId);
5778
5819
  if (params.threadId) searchParams.set("threadId", params.threadId);
5779
5820
  if (params.resourceId) searchParams.set("resourceId", params.resourceId);
5821
+ if (params.taskId) searchParams.set("taskId", params.taskId);
5780
5822
  const qs = searchParams.toString();
5781
5823
  const response = await this.request(`/background-tasks/stream${qs ? `?${qs}` : ""}`, { stream: true });
5782
5824
  if (!response.ok) {