@mastra/client-js 1.50.0-alpha.1 → 1.51.0-alpha.0

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.
@@ -3,7 +3,7 @@ name: mastra-client-js
3
3
  description: Documentation for @mastra/client-js. Use when working with @mastra/client-js APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/client-js"
6
- version: "1.50.0-alpha.1"
6
+ version: "1.51.0-alpha.0"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.50.0-alpha.1",
2
+ "version": "1.51.0-alpha.0",
3
3
  "package": "@mastra/client-js",
4
4
  "exports": {},
5
5
  "modules": {}
@@ -302,6 +302,8 @@ await subscription.processDataStream({
302
302
  })
303
303
  ```
304
304
 
305
+ Pass `withInitialHistory: true` (or `{ perPage }`) to receive the stored messages as a first `thread-history` chunk instead of fetching history separately. Finished runs aren't replayed after it, so completed answers don't stream again on reconnect.
306
+
305
307
  `subscribeToThread()` returns the underlying `Response` plus a `processDataStream()` helper. The helper reads the subscription stream until the connection closes or the request is aborted. Pass `reconnect: true` to resubscribe when the transport closes or a reconnect request fails, such as after a proxy idle timeout.
306
308
 
307
309
  **resourceId** (`string`): Resource ID for the memory thread.
package/dist/index.cjs CHANGED
@@ -1007,12 +1007,13 @@ var Agent = class extends BaseResource {
1007
1007
  * @experimental Agent signals are experimental and may change in a future release.
1008
1008
  */
1009
1009
  async subscribeToThread(params) {
1010
- const { resourceId, threadId } = params;
1010
+ const { resourceId, threadId, withInitialHistory } = params;
1011
1011
  const requestSubscription = () => this.request(`/agents/${this.agentId}/threads/subscribe`, {
1012
1012
  method: "POST",
1013
1013
  body: {
1014
1014
  resourceId,
1015
- threadId
1015
+ threadId,
1016
+ ...withInitialHistory ? { withInitialHistory } : {}
1016
1017
  },
1017
1018
  stream: true
1018
1019
  });