@mastra/mcp-docs-server 1.2.2-alpha.9 → 1.2.3-alpha.1

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.
Files changed (39) hide show
  1. package/.docs/docs/{harness → agent-controller}/modes.md +19 -19
  2. package/.docs/docs/agent-controller/overview.md +128 -0
  3. package/.docs/docs/agent-controller/session.md +143 -0
  4. package/.docs/docs/{harness → agent-controller}/subagents.md +12 -12
  5. package/.docs/docs/agent-controller/threads-and-state.md +141 -0
  6. package/.docs/docs/{harness → agent-controller}/tool-approvals.md +23 -23
  7. package/.docs/docs/agents/channels.md +47 -0
  8. package/.docs/docs/server/auth/google.md +281 -0
  9. package/.docs/docs/server/auth.md +2 -1
  10. package/.docs/models/gateways/vercel.md +3 -1
  11. package/.docs/models/index.md +1 -1
  12. package/.docs/models/providers/baseten.md +1 -1
  13. package/.docs/models/providers/fireworks-ai.md +2 -1
  14. package/.docs/models/providers/friendli.md +3 -1
  15. package/.docs/models/providers/llmgateway.md +1 -2
  16. package/.docs/models/providers/nebius.md +3 -2
  17. package/.docs/models/providers/opencode-go.md +1 -1
  18. package/.docs/models/providers/ovhcloud.md +1 -2
  19. package/.docs/models/providers/scaleway.md +2 -1
  20. package/.docs/models/providers/tinfoil.md +77 -0
  21. package/.docs/models/providers/togetherai.md +3 -2
  22. package/.docs/models/providers/xiaomi-token-plan-ams.md +4 -6
  23. package/.docs/models/providers/xiaomi-token-plan-cn.md +4 -6
  24. package/.docs/models/providers/xiaomi-token-plan-sgp.md +4 -6
  25. package/.docs/models/providers/xiaomi.md +4 -7
  26. package/.docs/models/providers.md +1 -0
  27. package/.docs/reference/{harness/harness-class.md → agent-controller/agent-controller-class.md} +106 -106
  28. package/.docs/reference/{harness → agent-controller}/session.md +97 -91
  29. package/.docs/reference/agents/channels.md +3 -1
  30. package/.docs/reference/agents/durable-agent.md +30 -3
  31. package/.docs/reference/auth/google.md +355 -0
  32. package/.docs/reference/channels/channel-provider.md +65 -0
  33. package/.docs/reference/channels/slack-provider.md +226 -0
  34. package/.docs/reference/index.md +5 -2
  35. package/CHANGELOG.md +28 -0
  36. package/package.json +6 -6
  37. package/.docs/docs/harness/overview.md +0 -128
  38. package/.docs/docs/harness/session.md +0 -143
  39. package/.docs/docs/harness/threads-and-state.md +0 -141
@@ -1,141 +0,0 @@
1
- # Threads and state
2
-
3
- Threads and state are how a Harness conversation survives beyond a single exchange. A **thread** is the persistent record of a conversation — its messages and metadata, saved to storage so a user can close the app and resume the same conversation later, or switch between several conversations. **State** is structured data attached to the conversation — values like model preferences, feature flags, or progress — that agents and your UI read and write as the conversation runs.
4
-
5
- The two work together: the thread is the message history, and state is the shared scratchpad alongside it. Both persist across mode switches, model changes, and restarts, so nothing is lost when a user switches from plan mode to build mode or reopens the app the next day.
6
-
7
- Thread _lifecycle_ transitions — create, switch, clone, delete — live on the Harness because they coordinate the shared thread lock and emit events. The active thread binding and thread/message _reads_ live on the [`Session`](https://mastra.ai/docs/harness/session) as `harness.session.thread`.
8
-
9
- ## Threads
10
-
11
- A thread holds one conversation's full message history. The Harness binds the Session to one active thread at a time; messages you send and the agent's replies are appended to that thread and saved to storage. Threads let users resume a past conversation, keep several conversations side by side, or branch one into alternatives.
12
-
13
- ### Creating and selecting threads
14
-
15
- On startup, call `selectOrCreateThread()` to resume the most recent thread or create a new one:
16
-
17
- ```typescript
18
- await harness.init()
19
- const thread = await harness.selectOrCreateThread()
20
- ```
21
-
22
- Create a thread explicitly with a title:
23
-
24
- ```typescript
25
- const thread = await harness.createThread({ title: 'New conversation' })
26
- ```
27
-
28
- ### Switching threads
29
-
30
- Switch to an existing thread. The harness aborts any in-progress generation, acquires a lock on the new thread, and emits a `thread_changed` event:
31
-
32
- ```typescript
33
- await harness.switchThread({ threadId: 'thread-abc123' })
34
- ```
35
-
36
- ### Listing threads
37
-
38
- List threads for the current resource. Forked subagent threads are hidden by default:
39
-
40
- ```typescript
41
- const threads = await harness.session.thread.list()
42
-
43
- // Include all resources
44
- const allThreads = await harness.session.thread.list({ allResources: true })
45
- ```
46
-
47
- ### Cloning threads
48
-
49
- Clone a thread to create a branch of the conversation. The harness copies all messages and switches to the clone:
50
-
51
- ```typescript
52
- const cloned = await harness.cloneThread({ title: 'Alternative approach' })
53
- ```
54
-
55
- ### Thread locking
56
-
57
- Pass a `threadLock` to the Harness constructor to prevent concurrent access from multiple processes. The lock is acquired before any thread operation and released on switch or delete:
58
-
59
- ```typescript
60
- const harness = new Harness({
61
- id: 'my-agent',
62
- threadLock: {
63
- acquire: async threadId => {
64
- /* acquire lock or throw */
65
- },
66
- release: async threadId => {
67
- /* release lock */
68
- },
69
- },
70
- })
71
- ```
72
-
73
- ## State
74
-
75
- Where a thread stores the conversation's messages, state stores structured values that describe the conversation but aren't messages — model preferences, feature flags, UI settings, or progress markers. Agents can read and update state during a run, and your UI can react to changes, so state is how the agent and the interface stay in sync on shared facts. You define its shape with a schema, and every update is validated against that schema before it's applied.
76
-
77
- ### Defining a state schema
78
-
79
- Pass a `stateSchema` (Standard JSON Schema) to validate state and extract defaults:
80
-
81
- ```typescript
82
- import { Agent } from '@mastra/core/agent'
83
- import { Harness } from '@mastra/core/harness'
84
- import { z } from 'zod'
85
-
86
- const agent = new Agent({
87
- name: 'assistant',
88
- instructions: 'Help the user manage a stateful session.',
89
- model: 'openai/gpt-5.5',
90
- })
91
-
92
- const harness = new Harness({
93
- id: 'stateful-agent',
94
- agent,
95
- modes: [{ id: 'default', name: 'Default', metadata: { default: true } }],
96
- stateSchema: z.object({
97
- currentModelId: z.string().optional(),
98
- theme: z.enum(['light', 'dark']).default('dark'),
99
- }),
100
- })
101
- ```
102
-
103
- ### Reading and writing state
104
-
105
- State is owned by the [`Session`](https://mastra.ai/docs/harness/session) as `harness.session.state`:
106
-
107
- ```typescript
108
- // Read the current state snapshot
109
- const state = harness.session.state.get()
110
-
111
- // Update state — validates against schema and emits state_changed
112
- await harness.session.state.set({ theme: 'light' })
113
- ```
114
-
115
- State changes emit a `state_changed` event with the new state and the set of changed keys.
116
-
117
- ## Resource IDs
118
-
119
- Threads are scoped to a resource ID, which groups a conversation's threads by project, user, or workspace. Set it on the Harness constructor; it defaults to the harness `id` when omitted:
120
-
121
- ```typescript
122
- const harness = new Harness({
123
- id: 'my-agent',
124
- resourceId: 'project-xyz',
125
- })
126
- ```
127
-
128
- The resource ID is part of a conversation's identity, so you read it from the Session:
129
-
130
- ```typescript
131
- const resourceId = harness.session.identity.getResourceId()
132
- ```
133
-
134
- The session also has a stable `id` and `ownerId` (read with `session.identity.getId()` and `session.identity.getOwnerId()`). Unlike the resource ID, these don't change when you switch resources — see [Session identity](https://mastra.ai/docs/harness/session) for details.
135
-
136
- ## Related
137
-
138
- - [Harness overview](https://mastra.ai/docs/harness/overview)
139
- - [Session](https://mastra.ai/docs/harness/session)
140
- - [Modes](https://mastra.ai/docs/harness/modes)
141
- - [API reference](https://mastra.ai/reference/harness/harness-class)