@mastra/client-js 1.0.0-beta.5 → 1.0.0-beta.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,114 @@
1
1
  # @mastra/client-js
2
2
 
3
+ ## 1.0.0-beta.7
4
+
5
+ ### Patch Changes
6
+
7
+ - fix: standardize pagination params to page/perPage with backwards compatibility for limit/offset ([#10790](https://github.com/mastra-ai/mastra/pull/10790))
8
+ - Server now accepts both `page`/`perPage` and legacy `limit`/`offset` params for workflow runs and MCP server listing endpoints
9
+ - Client SDK sends both param formats to support older server versions
10
+ - Added `createCombinedPaginationSchema` helper for endpoints needing backwards compatibility
11
+ - Marked `limit` and `offset` as deprecated in client types
12
+
13
+ - feat: Add partial response support for agent and workflow list endpoints ([#10886](https://github.com/mastra-ai/mastra/pull/10886))
14
+
15
+ Add optional `partial` query parameter to `/api/agents` and `/api/workflows` endpoints to return minimal data without schemas, reducing payload size for list views:
16
+ - When `partial=true`: tool schemas (inputSchema, outputSchema) are omitted
17
+ - When `partial=true`: workflow steps are replaced with stepCount integer
18
+ - When `partial=true`: workflow root schemas (inputSchema, outputSchema) are omitted
19
+ - Maintains backward compatibility when partial parameter is not provided
20
+
21
+ ## Server Endpoint Usage
22
+
23
+ ```http
24
+ # Get partial agent data (no tool schemas)
25
+ GET /api/agents?partial=true
26
+
27
+ # Get full agent data (default behavior)
28
+ GET /api/agents
29
+
30
+ # Get partial workflow data (stepCount instead of steps, no schemas)
31
+ GET /api/workflows?partial=true
32
+
33
+ # Get full workflow data (default behavior)
34
+ GET /api/workflows
35
+ ```
36
+
37
+ ## Client SDK Usage
38
+
39
+ ```typescript
40
+ import { MastraClient } from '@mastra/client-js';
41
+
42
+ const client = new MastraClient({ baseUrl: 'http://localhost:4111' });
43
+
44
+ // Get partial agent list (smaller payload)
45
+ const partialAgents = await client.listAgents({ partial: true });
46
+
47
+ // Get full agent list with tool schemas
48
+ const fullAgents = await client.listAgents();
49
+
50
+ // Get partial workflow list (smaller payload)
51
+ const partialWorkflows = await client.listWorkflows({ partial: true });
52
+
53
+ // Get full workflow list with steps and schemas
54
+ const fullWorkflows = await client.listWorkflows();
55
+ ```
56
+
57
+ - Updated dependencies [[`3076c67`](https://github.com/mastra-ai/mastra/commit/3076c6778b18988ae7d5c4c5c466366974b2d63f), [`85d7ee1`](https://github.com/mastra-ai/mastra/commit/85d7ee18ff4e14d625a8a30ec6656bb49804989b), [`c6c1092`](https://github.com/mastra-ai/mastra/commit/c6c1092f8fbf76109303f69e000e96fd1960c4ce), [`81dc110`](https://github.com/mastra-ai/mastra/commit/81dc11008d147cf5bdc8996ead1aa61dbdebb6fc), [`7aedb74`](https://github.com/mastra-ai/mastra/commit/7aedb74883adf66af38e270e4068fd42e7a37036), [`8f02d80`](https://github.com/mastra-ai/mastra/commit/8f02d800777397e4b45d7f1ad041988a8b0c6630), [`d7aad50`](https://github.com/mastra-ai/mastra/commit/d7aad501ce61646b76b4b511e558ac4eea9884d0), [`ce0a73a`](https://github.com/mastra-ai/mastra/commit/ce0a73abeaa75b10ca38f9e40a255a645d50ebfb), [`a02e542`](https://github.com/mastra-ai/mastra/commit/a02e542d23179bad250b044b17ff023caa61739f), [`a372c64`](https://github.com/mastra-ai/mastra/commit/a372c640ad1fd12e8f0613cebdc682fc156b4d95), [`8846867`](https://github.com/mastra-ai/mastra/commit/8846867ffa9a3746767618e314bebac08eb77d87), [`42a42cf`](https://github.com/mastra-ai/mastra/commit/42a42cf3132b9786feecbb8c13c583dce5b0e198), [`ae08bf0`](https://github.com/mastra-ai/mastra/commit/ae08bf0ebc6a4e4da992b711c4a389c32ba84cf4), [`21735a7`](https://github.com/mastra-ai/mastra/commit/21735a7ef306963554a69a89b44f06c3bcd85141), [`1d877b8`](https://github.com/mastra-ai/mastra/commit/1d877b8d7b536a251c1a7a18db7ddcf4f68d6f8b)]:
58
+ - @mastra/core@1.0.0-beta.7
59
+
60
+ ## 1.0.0-beta.6
61
+
62
+ ### Minor Changes
63
+
64
+ - Add support for custom fetch function in MastraClient to enable environments like Tauri that require custom fetch implementations to avoid timeout errors. ([#10677](https://github.com/mastra-ai/mastra/pull/10677))
65
+
66
+ You can now pass a custom fetch function when creating a MastraClient:
67
+
68
+ ```typescript
69
+ import { MastraClient } from '@mastra/client-js';
70
+
71
+ // Before: Only global fetch was available
72
+ const client = new MastraClient({
73
+ baseUrl: 'http://your-api-url',
74
+ });
75
+
76
+ // After: Custom fetch can be passed
77
+ const client = new MastraClient({
78
+ baseUrl: 'http://your-api-url',
79
+ fetch: customFetch, // Your custom fetch implementation
80
+ });
81
+ ```
82
+
83
+ If no custom fetch is provided, it falls back to the global fetch function, maintaining backward compatibility.
84
+
85
+ Fixes #10673
86
+
87
+ ### Patch Changes
88
+
89
+ - The client-js package had its own simpler zodToJsonSchema implementation that was missing critical features from schema-compat. This could cause issues when users pass Zod schemas with `z.record()` or `z.date()` through the MastraClient. ([#10730](https://github.com/mastra-ai/mastra/pull/10730))
90
+
91
+ Now the client uses the same implementation as the rest of the codebase, which includes the Zod v4 `z.record()` bug fix, date-time format conversion for `z.date()`, and proper handling of unrepresentable types.
92
+
93
+ Also removes the now-unused `zod-to-json-schema` dependency from client-js.
94
+
95
+ - Fix wrong arguments type in list workflow runs ([#10755](https://github.com/mastra-ai/mastra/pull/10755))
96
+
97
+ - Adjust the generate / stream types to accept tracingOptions ([#10742](https://github.com/mastra-ai/mastra/pull/10742))
98
+
99
+ - fix(a2a): fix streaming and memory support for A2A protocol ([#10653](https://github.com/mastra-ai/mastra/pull/10653))
100
+
101
+ **Client (`@mastra/client-js`):**
102
+ - Fixed `sendStreamingMessage` to properly return a streaming response instead of attempting to parse it as JSON
103
+
104
+ **Server (`@mastra/server`):**
105
+ - Fixed A2A message handler to pass `contextId` as `threadId` for memory persistence across conversations
106
+ - Added support for user-provided `resourceId` via `params.metadata.resourceId` or `message.metadata.resourceId`, falling back to `agentId`
107
+
108
+ - Updated dependencies [[`ac0d2f4`](https://github.com/mastra-ai/mastra/commit/ac0d2f4ff8831f72c1c66c2be809706d17f65789), [`1a0d3fc`](https://github.com/mastra-ai/mastra/commit/1a0d3fc811482c9c376cdf79ee615c23bae9b2d6), [`85a628b`](https://github.com/mastra-ai/mastra/commit/85a628b1224a8f64cd82ea7f033774bf22df7a7e), [`c237233`](https://github.com/mastra-ai/mastra/commit/c23723399ccedf7f5744b3f40997b79246bfbe64), [`15f9e21`](https://github.com/mastra-ai/mastra/commit/15f9e216177201ea6e3f6d0bfb063fcc0953444f), [`ff94dea`](https://github.com/mastra-ai/mastra/commit/ff94dea935f4e34545c63bcb6c29804732698809), [`5b2ff46`](https://github.com/mastra-ai/mastra/commit/5b2ff4651df70c146523a7fca773f8eb0a2272f8), [`db41688`](https://github.com/mastra-ai/mastra/commit/db4168806d007417e2e60b4f68656dca4e5f40c9), [`5ca599d`](https://github.com/mastra-ai/mastra/commit/5ca599d0bb59a1595f19f58473fcd67cc71cef58), [`bff1145`](https://github.com/mastra-ai/mastra/commit/bff114556b3cbadad9b2768488708f8ad0e91475), [`5c8ca24`](https://github.com/mastra-ai/mastra/commit/5c8ca247094e0cc2cdbd7137822fb47241f86e77), [`e191844`](https://github.com/mastra-ai/mastra/commit/e1918444ca3f80e82feef1dad506cd4ec6e2875f), [`22553f1`](https://github.com/mastra-ai/mastra/commit/22553f11c63ee5e966a9c034a349822249584691), [`7237163`](https://github.com/mastra-ai/mastra/commit/72371635dbf96a87df4b073cc48fc655afbdce3d), [`2500740`](https://github.com/mastra-ai/mastra/commit/2500740ea23da067d6e50ec71c625ab3ce275e64), [`873ecbb`](https://github.com/mastra-ai/mastra/commit/873ecbb517586aa17d2f1e99283755b3ebb2863f), [`4f9bbe5`](https://github.com/mastra-ai/mastra/commit/4f9bbe5968f42c86f4930b8193de3c3c17e5bd36), [`02e51fe`](https://github.com/mastra-ai/mastra/commit/02e51feddb3d4155cfbcc42624fd0d0970d032c0), [`8f3fa3a`](https://github.com/mastra-ai/mastra/commit/8f3fa3a652bb77da092f913ec51ae46e3a7e27dc), [`cd29ad2`](https://github.com/mastra-ai/mastra/commit/cd29ad23a255534e8191f249593849ed29160886), [`bdf4d8c`](https://github.com/mastra-ai/mastra/commit/bdf4d8cdc656d8a2c21d81834bfa3bfa70f56c16), [`854e3da`](https://github.com/mastra-ai/mastra/commit/854e3dad5daac17a91a20986399d3a51f54bf68b), [`ce18d38`](https://github.com/mastra-ai/mastra/commit/ce18d38678c65870350d123955014a8432075fd9), [`cccf9c8`](https://github.com/mastra-ai/mastra/commit/cccf9c8b2d2dfc1a5e63919395b83d78c89682a0), [`61a5705`](https://github.com/mastra-ai/mastra/commit/61a570551278b6743e64243b3ce7d73de915ca8a), [`db70a48`](https://github.com/mastra-ai/mastra/commit/db70a48aeeeeb8e5f92007e8ede52c364ce15287), [`f0fdc14`](https://github.com/mastra-ai/mastra/commit/f0fdc14ee233d619266b3d2bbdeea7d25cfc6d13), [`db18bc9`](https://github.com/mastra-ai/mastra/commit/db18bc9c3825e2c1a0ad9a183cc9935f6691bfa1), [`9b37b56`](https://github.com/mastra-ai/mastra/commit/9b37b565e1f2a76c24f728945cc740c2b09be9da), [`41a23c3`](https://github.com/mastra-ai/mastra/commit/41a23c32f9877d71810f37e24930515df2ff7a0f), [`5d171ad`](https://github.com/mastra-ai/mastra/commit/5d171ad9ef340387276b77c2bb3e83e83332d729), [`f03ae60`](https://github.com/mastra-ai/mastra/commit/f03ae60500fe350c9d828621006cdafe1975fdd8), [`d1e74a0`](https://github.com/mastra-ai/mastra/commit/d1e74a0a293866dece31022047f5dbab65a304d0), [`39e7869`](https://github.com/mastra-ai/mastra/commit/39e7869bc7d0ee391077ce291474d8a84eedccff), [`5761926`](https://github.com/mastra-ai/mastra/commit/57619260c4a2cdd598763abbacd90de594c6bc76), [`c900fdd`](https://github.com/mastra-ai/mastra/commit/c900fdd504c41348efdffb205cfe80d48c38fa33), [`604a79f`](https://github.com/mastra-ai/mastra/commit/604a79fecf276e26a54a3fe01bb94e65315d2e0e), [`887f0b4`](https://github.com/mastra-ai/mastra/commit/887f0b4746cdbd7cb7d6b17ac9f82aeb58037ea5), [`2562143`](https://github.com/mastra-ai/mastra/commit/256214336b4faa78646c9c1776612393790d8784), [`ef11a61`](https://github.com/mastra-ai/mastra/commit/ef11a61920fa0ed08a5b7ceedd192875af119749)]:
109
+ - @mastra/core@1.0.0-beta.6
110
+ - @mastra/schema-compat@1.0.0-beta.2
111
+
3
112
  ## 1.0.0-beta.5
4
113
 
5
114
  ### Patch Changes
package/README.md CHANGED
@@ -68,6 +68,8 @@ const client = new MastraClient({
68
68
  - `getMemoryThread({ threadId, agentId })`: Get a memory thread instance
69
69
  - `saveMessageToMemory(params)`: Save messages to memory
70
70
  - `getMemoryStatus()`: Get memory system status
71
+ - `getWorkingMemory({ agentId, threadId, resourceId? })`: Get working memory for a thread
72
+ - `updateWorkingMemory({ agentId, threadId, workingMemory, resourceId? })`: Update working memory for a thread
71
73
 
72
74
  ### Tools
73
75
 
package/dist/client.d.ts CHANGED
@@ -12,7 +12,7 @@ export declare class MastraClient extends BaseResource {
12
12
  * @param requestContext - Optional request context to pass as query parameter
13
13
  * @returns Promise containing map of agent IDs to agent details
14
14
  */
15
- listAgents(requestContext?: RequestContext | Record<string, any>): Promise<Record<string, GetAgentResponse>>;
15
+ listAgents(requestContext?: RequestContext | Record<string, any>, partial?: boolean): Promise<Record<string, GetAgentResponse>>;
16
16
  listAgentsModelProviders(): Promise<ListAgentsModelProvidersResponse>;
17
17
  /**
18
18
  * Gets an agent instance by ID
@@ -92,7 +92,7 @@ export declare class MastraClient extends BaseResource {
92
92
  * @param requestContext - Optional request context to pass as query parameter
93
93
  * @returns Promise containing map of workflow IDs to workflow details
94
94
  */
95
- listWorkflows(requestContext?: RequestContext | Record<string, any>): Promise<Record<string, GetWorkflowResponse>>;
95
+ listWorkflows(requestContext?: RequestContext | Record<string, any>, partial?: boolean): Promise<Record<string, GetWorkflowResponse>>;
96
96
  /**
97
97
  * Gets a workflow instance by ID
98
98
  * @param workflowId - ID of the workflow to retrieve
@@ -136,12 +136,16 @@ export declare class MastraClient extends BaseResource {
136
136
  }>;
137
137
  /**
138
138
  * Retrieves a list of available MCP servers.
139
- * @param params - Optional parameters for pagination (perPage, page).
139
+ * @param params - Optional parameters for pagination (page, perPage, or deprecated offset, limit).
140
140
  * @returns Promise containing the list of MCP servers and pagination info.
141
141
  */
142
142
  getMcpServers(params?: {
143
- perPage?: number;
144
143
  page?: number;
144
+ perPage?: number;
145
+ /** @deprecated Use page instead */
146
+ offset?: number;
147
+ /** @deprecated Use perPage instead */
148
+ limit?: number;
145
149
  }): Promise<McpServerListResponse>;
146
150
  /**
147
151
  * Retrieves detailed information for a specific MCP server.
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EACL,KAAK,EACL,YAAY,EACZ,IAAI,EACJ,QAAQ,EACR,MAAM,EACN,YAAY,EACZ,GAAG,EACH,OAAO,EACP,YAAY,EAEb,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EACV,aAAa,EACb,wBAAwB,EACxB,0BAA0B,EAC1B,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,eAAe,EACf,eAAe,EACf,mBAAmB,EACnB,yBAAyB,EACzB,2BAA2B,EAC3B,qBAAqB,EACrB,yBAAyB,EACzB,iBAAiB,EACjB,0BAA0B,EAC1B,kBAAkB,EAClB,uBAAuB,EACvB,0BAA0B,EAC1B,sBAAsB,EACtB,eAAe,EACf,iBAAiB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CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CAGjD"}
package/dist/index.cjs CHANGED
@@ -5,12 +5,7 @@ var uuid = require('@lukeed/uuid');
5
5
  var error = require('@mastra/core/error');
6
6
  var requestContext = require('@mastra/core/request-context');
7
7
  var isVercelTool = require('@mastra/core/tools/is-vercel-tool');
8
- var zod = require('zod');
9
- var originalZodToJsonSchema = require('zod-to-json-schema');
10
-
11
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
12
-
13
- var originalZodToJsonSchema__default = /*#__PURE__*/_interopDefault(originalZodToJsonSchema);
8
+ var zodToJson = require('@mastra/schema-compat/zod-to-json');
14
9
 
15
10
  // src/resources/agent.ts
16
11
  function parseClientRequestContext(requestContext$1) {
@@ -43,11 +38,7 @@ function zodToJsonSchema(zodSchema) {
43
38
  if (!isZodType(zodSchema)) {
44
39
  return zodSchema;
45
40
  }
46
- if ("toJSONSchema" in zod.z) {
47
- const fn = "toJSONSchema";
48
- return zod.z[fn].call(zod.z, zodSchema);
49
- }
50
- return originalZodToJsonSchema__default.default(zodSchema, { $refStrategy: "relative" });
41
+ return zodToJson.zodToJsonSchema(zodSchema);
51
42
  }
52
43
 
53
44
  // src/utils/process-client-tools.ts
@@ -150,11 +141,20 @@ var BaseResource = class {
150
141
  */
151
142
  async request(path, options = {}) {
152
143
  let lastError = null;
153
- const { baseUrl, retries = 3, backoffMs = 100, maxBackoffMs = 1e3, headers = {}, credentials } = this.options;
144
+ const {
145
+ baseUrl,
146
+ retries = 3,
147
+ backoffMs = 100,
148
+ maxBackoffMs = 1e3,
149
+ headers = {},
150
+ credentials,
151
+ fetch: customFetch
152
+ } = this.options;
153
+ const fetchFn = customFetch || fetch;
154
154
  let delay = backoffMs;
155
155
  for (let attempt = 0; attempt <= retries; attempt++) {
156
156
  try {
157
- const response = await fetch(`${baseUrl.replace(/\/$/, "")}${path}`, {
157
+ const response = await fetchFn(`${baseUrl.replace(/\/$/, "")}${path}`, {
158
158
  ...options,
159
159
  headers: {
160
160
  ...options.body && !(options.body instanceof FormData) && (options.method === "POST" || options.method === "PUT") ? { "content-type": "application/json" } : {},
@@ -1617,15 +1617,21 @@ var Workflow = class extends BaseResource {
1617
1617
  if (params?.toDate) {
1618
1618
  searchParams.set("toDate", params.toDate.toISOString());
1619
1619
  }
1620
- if (params?.perPage !== null && params?.perPage !== void 0) {
1621
- if (params.perPage === false) {
1622
- searchParams.set("perPage", "false");
1623
- } else if (typeof params.perPage === "number" && params.perPage > 0 && Number.isInteger(params.perPage)) {
1624
- searchParams.set("perPage", String(params.perPage));
1620
+ if (params?.page !== void 0) {
1621
+ searchParams.set("page", String(params.page));
1622
+ }
1623
+ if (params?.perPage !== void 0) {
1624
+ searchParams.set("perPage", String(params.perPage));
1625
+ }
1626
+ if (params?.limit !== null && params?.limit !== void 0) {
1627
+ if (params.limit === false) {
1628
+ searchParams.set("limit", "false");
1629
+ } else if (typeof params.limit === "number" && params.limit > 0 && Number.isInteger(params.limit)) {
1630
+ searchParams.set("limit", String(params.limit));
1625
1631
  }
1626
1632
  }
1627
- if (params?.page !== null && params?.page !== void 0 && !isNaN(Number(params?.page))) {
1628
- searchParams.set("page", String(params.page));
1633
+ if (params?.offset !== null && params?.offset !== void 0 && !isNaN(Number(params?.offset))) {
1634
+ searchParams.set("offset", String(params.offset));
1629
1635
  }
1630
1636
  if (params?.resourceId) {
1631
1637
  searchParams.set("resourceId", params.resourceId);
@@ -1692,6 +1698,7 @@ var Workflow = class extends BaseResource {
1692
1698
  return this.start({
1693
1699
  runId,
1694
1700
  inputData: p.inputData,
1701
+ initialState: p.initialState,
1695
1702
  requestContext: p.requestContext,
1696
1703
  tracingOptions: p.tracingOptions
1697
1704
  });
@@ -1700,12 +1707,18 @@ var Workflow = class extends BaseResource {
1700
1707
  return this.startAsync({
1701
1708
  runId,
1702
1709
  inputData: p.inputData,
1710
+ initialState: p.initialState,
1703
1711
  requestContext: p.requestContext,
1704
1712
  tracingOptions: p.tracingOptions
1705
1713
  });
1706
1714
  },
1707
1715
  stream: async (p) => {
1708
- return this.stream({ runId, inputData: p.inputData, requestContext: p.requestContext });
1716
+ return this.stream({
1717
+ runId,
1718
+ inputData: p.inputData,
1719
+ initialState: p.initialState,
1720
+ requestContext: p.requestContext
1721
+ });
1709
1722
  },
1710
1723
  resume: async (p) => {
1711
1724
  return this.resume({
@@ -1737,14 +1750,19 @@ var Workflow = class extends BaseResource {
1737
1750
  }
1738
1751
  /**
1739
1752
  * Starts a workflow run synchronously without waiting for the workflow to complete
1740
- * @param params - Object containing the runId, inputData and requestContext
1753
+ * @param params - Object containing the runId, inputData, initialState and requestContext
1741
1754
  * @returns Promise containing success message
1742
1755
  */
1743
1756
  start(params) {
1744
1757
  const requestContext = parseClientRequestContext(params.requestContext);
1745
1758
  return this.request(`/api/workflows/${this.workflowId}/start?runId=${params.runId}`, {
1746
1759
  method: "POST",
1747
- body: { inputData: params?.inputData, requestContext, tracingOptions: params.tracingOptions }
1760
+ body: {
1761
+ inputData: params?.inputData,
1762
+ initialState: params?.initialState,
1763
+ requestContext,
1764
+ tracingOptions: params.tracingOptions
1765
+ }
1748
1766
  });
1749
1767
  }
1750
1768
  /**
@@ -1772,7 +1790,7 @@ var Workflow = class extends BaseResource {
1772
1790
  }
1773
1791
  /**
1774
1792
  * Starts a workflow run asynchronously and returns a promise that resolves when the workflow is complete
1775
- * @param params - Object containing the optional runId, inputData and requestContext
1793
+ * @param params - Object containing the optional runId, inputData, initialState and requestContext
1776
1794
  * @returns Promise containing the workflow execution results
1777
1795
  */
1778
1796
  startAsync(params) {
@@ -1783,12 +1801,17 @@ var Workflow = class extends BaseResource {
1783
1801
  const requestContext = parseClientRequestContext(params.requestContext);
1784
1802
  return this.request(`/api/workflows/${this.workflowId}/start-async?${searchParams.toString()}`, {
1785
1803
  method: "POST",
1786
- body: { inputData: params.inputData, requestContext, tracingOptions: params.tracingOptions }
1804
+ body: {
1805
+ inputData: params.inputData,
1806
+ initialState: params.initialState,
1807
+ requestContext,
1808
+ tracingOptions: params.tracingOptions
1809
+ }
1787
1810
  });
1788
1811
  }
1789
1812
  /**
1790
1813
  * Starts a workflow run and returns a stream
1791
- * @param params - Object containing the optional runId, inputData and requestContext
1814
+ * @param params - Object containing the optional runId, inputData, initialState and requestContext
1792
1815
  * @returns Promise containing the workflow execution results
1793
1816
  */
1794
1817
  async stream(params) {
@@ -1801,7 +1824,12 @@ var Workflow = class extends BaseResource {
1801
1824
  `/api/workflows/${this.workflowId}/stream?${searchParams.toString()}`,
1802
1825
  {
1803
1826
  method: "POST",
1804
- body: { inputData: params.inputData, requestContext, tracingOptions: params.tracingOptions },
1827
+ body: {
1828
+ inputData: params.inputData,
1829
+ initialState: params.initialState,
1830
+ requestContext,
1831
+ tracingOptions: params.tracingOptions
1832
+ },
1805
1833
  stream: true
1806
1834
  }
1807
1835
  );
@@ -1886,7 +1914,7 @@ var Workflow = class extends BaseResource {
1886
1914
  }
1887
1915
  /**
1888
1916
  * Starts a workflow run and returns a stream
1889
- * @param params - Object containing the optional runId, inputData and requestContext
1917
+ * @param params - Object containing the optional runId, inputData, initialState and requestContext
1890
1918
  * @returns Promise containing the workflow execution results
1891
1919
  */
1892
1920
  async streamVNext(params) {
@@ -1901,6 +1929,7 @@ var Workflow = class extends BaseResource {
1901
1929
  method: "POST",
1902
1930
  body: {
1903
1931
  inputData: params.inputData,
1932
+ initialState: params.initialState,
1904
1933
  requestContext,
1905
1934
  closeOnSuspend: params.closeOnSuspend,
1906
1935
  tracingOptions: params.tracingOptions
@@ -2259,7 +2288,8 @@ var A2A = class extends BaseResource {
2259
2288
  body: {
2260
2289
  method: "message/stream",
2261
2290
  params
2262
- }
2291
+ },
2292
+ stream: true
2263
2293
  });
2264
2294
  return response;
2265
2295
  }
@@ -2690,6 +2720,16 @@ var AgentBuilder = class extends BaseResource {
2690
2720
  if (params?.page !== void 0) {
2691
2721
  searchParams.set("page", String(params.page));
2692
2722
  }
2723
+ if (params?.limit !== null && params?.limit !== void 0) {
2724
+ if (params.limit === false) {
2725
+ searchParams.set("limit", "false");
2726
+ } else if (typeof params.limit === "number" && params.limit > 0 && Number.isInteger(params.limit)) {
2727
+ searchParams.set("limit", String(params.limit));
2728
+ }
2729
+ }
2730
+ if (params?.offset !== null && params?.offset !== void 0 && !isNaN(Number(params?.offset))) {
2731
+ searchParams.set("offset", String(params.offset));
2732
+ }
2693
2733
  if (params?.resourceId) {
2694
2734
  searchParams.set("resourceId", params.resourceId);
2695
2735
  }
@@ -2808,12 +2848,15 @@ var MastraClient = class extends BaseResource {
2808
2848
  * @param requestContext - Optional request context to pass as query parameter
2809
2849
  * @returns Promise containing map of agent IDs to agent details
2810
2850
  */
2811
- listAgents(requestContext) {
2851
+ listAgents(requestContext, partial) {
2812
2852
  const requestContextParam = base64RequestContext(parseClientRequestContext(requestContext));
2813
2853
  const searchParams = new URLSearchParams();
2814
2854
  if (requestContextParam) {
2815
2855
  searchParams.set("requestContext", requestContextParam);
2816
2856
  }
2857
+ if (partial) {
2858
+ searchParams.set("partial", "true");
2859
+ }
2817
2860
  const queryString = searchParams.toString();
2818
2861
  return this.request(`/api/agents${queryString ? `?${queryString}` : ""}`);
2819
2862
  }
@@ -2955,12 +2998,15 @@ var MastraClient = class extends BaseResource {
2955
2998
  * @param requestContext - Optional request context to pass as query parameter
2956
2999
  * @returns Promise containing map of workflow IDs to workflow details
2957
3000
  */
2958
- listWorkflows(requestContext) {
3001
+ listWorkflows(requestContext, partial) {
2959
3002
  const requestContextParam = base64RequestContext(parseClientRequestContext(requestContext));
2960
3003
  const searchParams = new URLSearchParams();
2961
3004
  if (requestContextParam) {
2962
3005
  searchParams.set("requestContext", requestContextParam);
2963
3006
  }
3007
+ if (partial) {
3008
+ searchParams.set("partial", "true");
3009
+ }
2964
3010
  const queryString = searchParams.toString();
2965
3011
  return this.request(`/api/workflows${queryString ? `?${queryString}` : ""}`);
2966
3012
  }
@@ -3090,16 +3136,22 @@ var MastraClient = class extends BaseResource {
3090
3136
  }
3091
3137
  /**
3092
3138
  * Retrieves a list of available MCP servers.
3093
- * @param params - Optional parameters for pagination (perPage, page).
3139
+ * @param params - Optional parameters for pagination (page, perPage, or deprecated offset, limit).
3094
3140
  * @returns Promise containing the list of MCP servers and pagination info.
3095
3141
  */
3096
3142
  getMcpServers(params) {
3097
3143
  const searchParams = new URLSearchParams();
3144
+ if (params?.page !== void 0) {
3145
+ searchParams.set("page", String(params.page));
3146
+ }
3098
3147
  if (params?.perPage !== void 0) {
3099
3148
  searchParams.set("perPage", String(params.perPage));
3100
3149
  }
3101
- if (params?.page !== void 0) {
3102
- searchParams.set("page", String(params.page));
3150
+ if (params?.limit !== void 0) {
3151
+ searchParams.set("limit", String(params.limit));
3152
+ }
3153
+ if (params?.offset !== void 0) {
3154
+ searchParams.set("offset", String(params.offset));
3103
3155
  }
3104
3156
  const queryString = searchParams.toString();
3105
3157
  return this.request(`/api/mcp/v0/servers${queryString ? `?${queryString}` : ""}`);