@mastra/client-js 1.54.0-alpha.1 → 1.54.0-alpha.3
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-harness-agent-controller.md +18 -0
- package/dist/index.cjs +1 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/resources/agent-controller.d.ts.map +1 -1
- package/dist/route-types.generated.d.ts +40 -32
- package/dist/route-types.generated.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/docs/SKILL.md
CHANGED
|
@@ -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.54.0-alpha.
|
|
6
|
+
version: "1.54.0-alpha.3"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## When to use
|
|
@@ -133,6 +133,24 @@ const session = await controller.createSession({
|
|
|
133
133
|
|
|
134
134
|
Use [`session.thread.create()`](https://mastra.ai/reference/agent-controller/session) and [`session.thread.switch()`](https://mastra.ai/reference/agent-controller/session) to move one live Session between conversations.
|
|
135
135
|
|
|
136
|
+
### Transfer thread ownership
|
|
137
|
+
|
|
138
|
+
Each new thread stores its durable owner in `metadata.ownerId` and its original creator in `metadata.createdBy`. Both default to the Session host's `ownerId`. `createdBy` doesn't change when ownership transfers.
|
|
139
|
+
|
|
140
|
+
Read the active thread's owner and transfer it through `session.thread`:
|
|
141
|
+
|
|
142
|
+
```typescript
|
|
143
|
+
const currentOwnerId = await session.thread.getOwner()
|
|
144
|
+
|
|
145
|
+
await session.thread.transferOwnership({
|
|
146
|
+
toOwnerId: 'user-456',
|
|
147
|
+
})
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Transfers are serialized within one process. Hosts that require a durable cross-process compare-and-set should commit it in their own storage first, then call `transferOwnership()` to mirror the owner onto the active thread.
|
|
151
|
+
|
|
152
|
+
Every run snapshots the thread owner when it starts. Tools and other dynamic runtime code can read that value from `AgentControllerRequestContext.threadOwnerId`. If ownership changes during a run, the active run keeps the old snapshot and the next run receives the new owner. `context.session.ownerId` remains the identity of the process-local Session host.
|
|
153
|
+
|
|
136
154
|
### List stored messages from the client
|
|
137
155
|
|
|
138
156
|
Use the Agent Controller client to page through a thread's stored messages. Passing an options object returns the messages with pagination metadata:
|
package/dist/index.cjs
CHANGED
|
@@ -6075,6 +6075,7 @@ const KNOWN_AGENT_CONTROLLER_EVENT_TYPES = new Set(Object.keys({
|
|
|
6075
6075
|
thread_changed: true,
|
|
6076
6076
|
thread_created: true,
|
|
6077
6077
|
thread_deleted: true,
|
|
6078
|
+
thread_owner_changed: true,
|
|
6078
6079
|
thread_title_updated: true,
|
|
6079
6080
|
subagent_start: true,
|
|
6080
6081
|
subagent_text_delta: true,
|