@mastra/memory 1.25.0 → 1.26.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.
- package/CHANGELOG.md +34 -0
- package/dist/docs/SKILL.md +2 -2
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/docs-agents-agent-approval.md +1 -1
- package/dist/docs/references/docs-agents-networks.md +2 -2
- package/dist/docs/references/{docs-agents-supervisor-agents.md → docs-capabilities-subagents.md} +58 -58
- package/dist/docs/references/docs-long-running-agents-background-tasks.md +1 -1
- package/dist/docs/references/docs-long-running-agents-goals.md +3 -3
- package/dist/docs/references/docs-memory-overview.md +2 -2
- package/dist/docs/references/docs-storage-overview.md +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/processors/index.cjs +1 -1
- package/dist/processors/index.js +1 -1
- package/dist/processors/observational-memory/message-utils.d.ts.map +1 -1
- package/dist/processors/observational-memory/observational-memory.d.ts +8 -0
- package/dist/processors/observational-memory/observational-memory.d.ts.map +1 -1
- package/dist/processors/observational-memory/processor.d.ts.map +1 -1
- package/dist/{src-DQO6B1AU.cjs → src-CjTEWCUF.cjs} +181 -44
- package/dist/src-CjTEWCUF.cjs.map +1 -0
- package/dist/{src-BgdYYHLc.js → src-Cwt9gefz.js} +179 -42
- package/dist/src-Cwt9gefz.js.map +1 -0
- package/package.json +9 -9
- package/dist/src-BgdYYHLc.js.map +0 -1
- package/dist/src-DQO6B1AU.cjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# @mastra/memory
|
|
2
2
|
|
|
3
|
+
## 1.26.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Added persistence filtering for transient agent signals. Memory now excludes signals marked `transient: true` from standard message saves and observational-memory persistence, so per-turn reminders do not accumulate in stored thread history. ([#18909](https://github.com/mastra-ai/mastra/pull/18909))
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
await sendSignal?.({
|
|
11
|
+
type: 'reactive',
|
|
12
|
+
contents: 'Stay on the current task.',
|
|
13
|
+
transient: true,
|
|
14
|
+
});
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Fixed thread-scoped Observational Memory requests without a thread ID to return a clear bad request error instead of an internal server error. ([#20721](https://github.com/mastra-ai/mastra/pull/20721))
|
|
20
|
+
|
|
21
|
+
- Fixed a bug where concurrent requests could create duplicate observational memory records. ([#19216](https://github.com/mastra-ai/mastra/pull/19216))
|
|
22
|
+
|
|
23
|
+
- Updated dependencies [[`8d2399b`](https://github.com/mastra-ai/mastra/commit/8d2399b638f8e0945cf2cda0187dbea8dcf0b784), [`c8002da`](https://github.com/mastra-ai/mastra/commit/c8002da7775c468e2965b6ff5f82045450fa8cb9), [`92be47f`](https://github.com/mastra-ai/mastra/commit/92be47fbd26ffccec0e2131ef7c1d9e70dd5ef4a), [`89200ba`](https://github.com/mastra-ai/mastra/commit/89200bafa05444bb7949b363ce7b743e29867561), [`c950138`](https://github.com/mastra-ai/mastra/commit/c950138e72e4f317a40187e3800588731ab790ce), [`810c7e7`](https://github.com/mastra-ai/mastra/commit/810c7e74929989d8b8b5db52cd3af22cd0998af4), [`063c8b2`](https://github.com/mastra-ai/mastra/commit/063c8b2eb14e4e5ca021779bc33e8c3c031c8604), [`f9f9884`](https://github.com/mastra-ai/mastra/commit/f9f98848ee194dc71a787a709ec430b065cdc41b), [`e0904dc`](https://github.com/mastra-ai/mastra/commit/e0904dc538792e54e1806b70172e5900ac49bff4), [`9672fab`](https://github.com/mastra-ai/mastra/commit/9672fabfbcadb961a35c22a2d6722e077f7b24b9), [`f4e964c`](https://github.com/mastra-ai/mastra/commit/f4e964cad57057301d6bed5c55bcdd730175b941), [`1f7bbd7`](https://github.com/mastra-ai/mastra/commit/1f7bbd7785a8d230aad02454ecabeb4a0b2cc96f), [`e47ff36`](https://github.com/mastra-ai/mastra/commit/e47ff36945720f4ee4caa09f6e83514d7d188608), [`64d6781`](https://github.com/mastra-ai/mastra/commit/64d67814bccddd314f7e09643243821e57cb87b6), [`14562d6`](https://github.com/mastra-ai/mastra/commit/14562d6ea724ed4ccb9fb079d016ec7ab1bd92a4), [`fb9a6ac`](https://github.com/mastra-ai/mastra/commit/fb9a6ac11c9560518742ece60b49d6b062845fd3), [`aa2cec8`](https://github.com/mastra-ai/mastra/commit/aa2cec8501f634d51c2f3ebfb3dd3aa7af8d2ca2), [`c848e65`](https://github.com/mastra-ai/mastra/commit/c848e655a64ff10331a8ceafafe7f18e70a0f092), [`2adf8eb`](https://github.com/mastra-ai/mastra/commit/2adf8eb4a70ed2b6cff2dd39281496ea0e025fac), [`0494489`](https://github.com/mastra-ai/mastra/commit/049448906e4c3d2d615bbe865b073a0d890ddb7c), [`8d1aeb8`](https://github.com/mastra-ai/mastra/commit/8d1aeb8acf7c20c4bb8e4d8e4bdc6569c83ac561), [`8264611`](https://github.com/mastra-ai/mastra/commit/8264611510e421b818bc7395dc2ae4d9c2d518b2), [`d8fa243`](https://github.com/mastra-ai/mastra/commit/d8fa2430d21113e330c4e676ac65e1235cf44f81), [`44fc98b`](https://github.com/mastra-ai/mastra/commit/44fc98b9d1242aa87a3ab44bdce9e9f12c44d8c9), [`f933ba3`](https://github.com/mastra-ai/mastra/commit/f933ba32700e1d0bf143311c1a08f88300b840b6), [`83065bf`](https://github.com/mastra-ai/mastra/commit/83065bfee9e47c3c6f09132a9034501f6cfb69cf), [`0f2ef41`](https://github.com/mastra-ai/mastra/commit/0f2ef4118da022e4f30dac4e9856cc3a8c97671c), [`01b162f`](https://github.com/mastra-ai/mastra/commit/01b162fe435295881aa7ea55f1759407ad5175ad)]:
|
|
24
|
+
- @mastra/core@1.57.0
|
|
25
|
+
- @mastra/schema-compat@1.3.5
|
|
26
|
+
|
|
27
|
+
## 1.25.1-alpha.0
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- Fixed thread-scoped Observational Memory requests without a thread ID to return a clear bad request error instead of an internal server error. ([#20721](https://github.com/mastra-ai/mastra/pull/20721))
|
|
32
|
+
|
|
33
|
+
- Updated dependencies [[`89200ba`](https://github.com/mastra-ai/mastra/commit/89200bafa05444bb7949b363ce7b743e29867561), [`c950138`](https://github.com/mastra-ai/mastra/commit/c950138e72e4f317a40187e3800588731ab790ce), [`063c8b2`](https://github.com/mastra-ai/mastra/commit/063c8b2eb14e4e5ca021779bc33e8c3c031c8604), [`f4e964c`](https://github.com/mastra-ai/mastra/commit/f4e964cad57057301d6bed5c55bcdd730175b941), [`1f7bbd7`](https://github.com/mastra-ai/mastra/commit/1f7bbd7785a8d230aad02454ecabeb4a0b2cc96f), [`e47ff36`](https://github.com/mastra-ai/mastra/commit/e47ff36945720f4ee4caa09f6e83514d7d188608), [`14562d6`](https://github.com/mastra-ai/mastra/commit/14562d6ea724ed4ccb9fb079d016ec7ab1bd92a4), [`fb9a6ac`](https://github.com/mastra-ai/mastra/commit/fb9a6ac11c9560518742ece60b49d6b062845fd3), [`aa2cec8`](https://github.com/mastra-ai/mastra/commit/aa2cec8501f634d51c2f3ebfb3dd3aa7af8d2ca2), [`2adf8eb`](https://github.com/mastra-ai/mastra/commit/2adf8eb4a70ed2b6cff2dd39281496ea0e025fac), [`8264611`](https://github.com/mastra-ai/mastra/commit/8264611510e421b818bc7395dc2ae4d9c2d518b2), [`44fc98b`](https://github.com/mastra-ai/mastra/commit/44fc98b9d1242aa87a3ab44bdce9e9f12c44d8c9), [`0f2ef41`](https://github.com/mastra-ai/mastra/commit/0f2ef4118da022e4f30dac4e9856cc3a8c97671c)]:
|
|
34
|
+
- @mastra/core@1.57.0-alpha.1
|
|
35
|
+
- @mastra/schema-compat@1.3.5-alpha.0
|
|
36
|
+
|
|
3
37
|
## 1.25.0
|
|
4
38
|
|
|
5
39
|
### Minor Changes
|
package/dist/docs/SKILL.md
CHANGED
|
@@ -3,7 +3,7 @@ name: mastra-memory
|
|
|
3
3
|
description: Documentation for @mastra/memory. Use when working with @mastra/memory APIs, configuration, or implementation.
|
|
4
4
|
metadata:
|
|
5
5
|
package: "@mastra/memory"
|
|
6
|
-
version: "1.
|
|
6
|
+
version: "1.26.0"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## When to use
|
|
@@ -18,7 +18,7 @@ Read the individual reference documents for detailed explanations and code examp
|
|
|
18
18
|
|
|
19
19
|
- [Agent approval](references/docs-agents-agent-approval.md) - Learn how to require approvals and suspend tool execution, plus automatically resume suspended tools while keeping humans in control of agent workflows.
|
|
20
20
|
- [Agent networks](references/docs-agents-networks.md) - Coordinate multiple agents, workflows, and tools using agent networks for complex, non-deterministic task execution.
|
|
21
|
-
- [
|
|
21
|
+
- [Subagents](references/docs-capabilities-subagents.md) - Learn how to coordinate multiple agents with delegation hooks, iteration monitoring, message filtering, and task completion scoring.
|
|
22
22
|
- [Evals with memory](references/docs-evals-evals-with-memory.md) - Run scorers against memory-enabled agents, including observational memory in thread scope, using runEvals and dataset experiments.
|
|
23
23
|
- [Background tasks](references/docs-long-running-agents-background-tasks.md) - Learn how to dispatch long-running tool calls in the background and keep the stream open until they complete, plus orchestrate subagents asynchronously.
|
|
24
24
|
- [Goals](references/docs-long-running-agents-goals.md) - Learn how to set a durable objective on an agent that's judged in the execution loop, so the agent keeps working until the goal is complete or the run budget is exhausted.
|
|
@@ -498,7 +498,7 @@ The same discovery is available over HTTP as `GET /agents/:agentId/suspended-run
|
|
|
498
498
|
|
|
499
499
|
## Tool approval: Supervisor agents
|
|
500
500
|
|
|
501
|
-
A [supervisor agent](https://mastra.ai/docs/
|
|
501
|
+
A [supervisor agent](https://mastra.ai/docs/capabilities/subagents) coordinates multiple subagents using `.stream()` or `.generate()`. When a subagent calls a tool that requires approval, the request propagates up through the delegation chain and surfaces at the supervisor level:
|
|
502
502
|
|
|
503
503
|
1. The supervisor delegates a task to a subagent.
|
|
504
504
|
2. The subagent calls a tool that has `requireApproval: true` or uses `suspend()`.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Agent networks
|
|
4
4
|
|
|
5
|
-
> **Deprecated:** Agent networks are deprecated and will be removed in a future major release. [Supervisor agents](https://mastra.ai/docs/
|
|
5
|
+
> **Deprecated:** Agent networks are deprecated and will be removed in a future major release. [Supervisor agents](https://mastra.ai/docs/capabilities/subagents) using `agent.stream()` or `agent.generate()` are now the recommended approach. It provides the same multi-agent coordination with better control, a simpler API, and easier debugging.
|
|
6
6
|
>
|
|
7
7
|
> See the [migration guide](https://mastra.ai/guides/migrations/network-to-supervisor) to upgrade.
|
|
8
8
|
|
|
@@ -180,5 +180,5 @@ Requirements for automatic resumption:
|
|
|
180
180
|
|
|
181
181
|
## Related
|
|
182
182
|
|
|
183
|
-
- [Supervisor agents](https://mastra.ai/docs/
|
|
183
|
+
- [Supervisor agents](https://mastra.ai/docs/capabilities/subagents)
|
|
184
184
|
- [Migration: `.network()` to supervisor agents](https://mastra.ai/guides/migrations/network-to-supervisor)
|
package/dist/docs/references/{docs-agents-supervisor-agents.md → docs-capabilities-subagents.md}
RENAMED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
2
|
|
|
3
|
-
#
|
|
3
|
+
# Subagents
|
|
4
4
|
|
|
5
5
|
**Added in:** `@mastra/core@1.8.0`
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Subagents are specialized agents that another agent can delegate tasks to. Add them to the parent agent's `agents` property, then call [`Agent.stream()`](https://mastra.ai/reference/streaming/agents/stream) or [`Agent.generate()`](https://mastra.ai/reference/agents/generate). The parent agent uses its instructions and each subagent's `description` to decide when and how to delegate tasks.
|
|
8
8
|
|
|
9
|
-
## When to use
|
|
9
|
+
## When to use subagents
|
|
10
10
|
|
|
11
|
-
Use
|
|
11
|
+
Use subagents when a task requires agents with different specializations to work together. The parent agent decides when to delegate and passes context to each subagent. It then synthesizes their results.
|
|
12
12
|
|
|
13
13
|
Common use cases:
|
|
14
14
|
|
|
@@ -16,11 +16,11 @@ Common use cases:
|
|
|
16
16
|
- Multi-step tasks that need different expertise at each stage
|
|
17
17
|
- Tasks where you need fine-grained control over delegation behavior
|
|
18
18
|
|
|
19
|
-
> **Note:**
|
|
19
|
+
> **Note:** A parent agent that coordinates subagents is often called a supervisor. The supervisor pattern is one approach to building multi-agent systems in Mastra. For other patterns, read the [conceptual overview](https://mastra.ai/guides/concepts/multi-agent-systems).
|
|
20
20
|
|
|
21
21
|
## Quickstart
|
|
22
22
|
|
|
23
|
-
Define subagents with clear descriptions, then
|
|
23
|
+
Define subagents with clear descriptions, then add them to a parent agent:
|
|
24
24
|
|
|
25
25
|
```typescript
|
|
26
26
|
import { Agent } from '@mastra/core/agent'
|
|
@@ -39,8 +39,8 @@ const writingAgent = new Agent({
|
|
|
39
39
|
model: 'openai/gpt-5-mini',
|
|
40
40
|
})
|
|
41
41
|
|
|
42
|
-
const
|
|
43
|
-
id: '
|
|
42
|
+
const parentAgent = new Agent({
|
|
43
|
+
id: 'parent-agent',
|
|
44
44
|
instructions: `You coordinate research and writing using specialized agents.
|
|
45
45
|
Delegate to research-agent for facts, then writing-agent for content.`,
|
|
46
46
|
model: 'openai/gpt-5.6-sol',
|
|
@@ -50,7 +50,7 @@ const supervisor = new Agent({
|
|
|
50
50
|
}),
|
|
51
51
|
})
|
|
52
52
|
|
|
53
|
-
const stream = await
|
|
53
|
+
const stream = await parentAgent.stream('Research AI in education and write an article', {
|
|
54
54
|
maxSteps: 10,
|
|
55
55
|
})
|
|
56
56
|
|
|
@@ -65,7 +65,7 @@ Delegation hooks let you intercept, modify, or reject delegations as they happen
|
|
|
65
65
|
|
|
66
66
|
### `onDelegationStart`
|
|
67
67
|
|
|
68
|
-
Called before the
|
|
68
|
+
Called before the parent agent delegates to a subagent. Return an object to control the delegation:
|
|
69
69
|
|
|
70
70
|
- `proceed: true`: Allow the delegation (default behavior)
|
|
71
71
|
- `proceed: false`: Reject the delegation with a `rejectionReason`
|
|
@@ -73,7 +73,7 @@ Called before the supervisor delegates to a subagent. Return an object to contro
|
|
|
73
73
|
- `modifiedMaxSteps`: Limit the subagent's iteration count
|
|
74
74
|
|
|
75
75
|
```typescript
|
|
76
|
-
const stream = await
|
|
76
|
+
const stream = await parentAgent.stream('Research AI trends', {
|
|
77
77
|
maxSteps: 10,
|
|
78
78
|
delegation: {
|
|
79
79
|
onDelegationStart: async context => {
|
|
@@ -107,18 +107,18 @@ The `context` object includes:
|
|
|
107
107
|
| Property | Description |
|
|
108
108
|
| ------------- | ----------------------------------------- |
|
|
109
109
|
| `primitiveId` | The ID of the subagent being delegated to |
|
|
110
|
-
| `prompt` | The prompt the
|
|
110
|
+
| `prompt` | The prompt the parent agent is sending |
|
|
111
111
|
| `iteration` | Current iteration number |
|
|
112
112
|
|
|
113
113
|
### `onDelegationComplete`
|
|
114
114
|
|
|
115
115
|
Called after a delegation finishes. Use it to inspect results or provide feedback, or alternatively stop execution:
|
|
116
116
|
|
|
117
|
-
- `context.bail()`: Stop the
|
|
118
|
-
- Return `{ feedback: '...' }`: Add feedback that gets saved to the
|
|
117
|
+
- `context.bail()`: Stop the parent agent's loop immediately
|
|
118
|
+
- Return `{ feedback: '...' }`: Add feedback that gets saved to the parent agent's memory and is visible to subsequent iterations
|
|
119
119
|
|
|
120
120
|
```typescript
|
|
121
|
-
const stream = await
|
|
121
|
+
const stream = await parentAgent.stream('Research AI trends', {
|
|
122
122
|
maxSteps: 10,
|
|
123
123
|
delegation: {
|
|
124
124
|
onDelegationComplete: async context => {
|
|
@@ -138,19 +138,19 @@ const stream = await supervisor.stream('Research AI trends', {
|
|
|
138
138
|
|
|
139
139
|
The `context` object includes:
|
|
140
140
|
|
|
141
|
-
| Property | Description
|
|
142
|
-
| ------------- |
|
|
143
|
-
| `primitiveId` | The ID of the subagent that ran
|
|
144
|
-
| `result` | The subagent's response
|
|
145
|
-
| `error` | Error if the delegation failed
|
|
146
|
-
| `bail()` | Function to stop the
|
|
141
|
+
| Property | Description |
|
|
142
|
+
| ------------- | ---------------------------------------- |
|
|
143
|
+
| `primitiveId` | The ID of the subagent that ran |
|
|
144
|
+
| `result` | The subagent's response |
|
|
145
|
+
| `error` | Error if the delegation failed |
|
|
146
|
+
| `bail()` | Function to stop the parent agent's loop |
|
|
147
147
|
|
|
148
148
|
## Message filtering
|
|
149
149
|
|
|
150
|
-
By default, subagents receive the full conversation context from the
|
|
150
|
+
By default, subagents receive the full conversation context from the parent agent. Use `messageFilter` to control what messages are shared, for example, to remove sensitive data or limit context size.
|
|
151
151
|
|
|
152
152
|
```typescript
|
|
153
|
-
const stream = await
|
|
153
|
+
const stream = await parentAgent.stream('Research AI trends', {
|
|
154
154
|
maxSteps: 10,
|
|
155
155
|
delegation: {
|
|
156
156
|
messageFilter: ({ messages, primitiveId, prompt }) => {
|
|
@@ -171,16 +171,16 @@ The callback receives `messages` (the full conversation history), `primitiveId`
|
|
|
171
171
|
|
|
172
172
|
## Subagent result context
|
|
173
173
|
|
|
174
|
-
When a subagent completes, the
|
|
174
|
+
When a subagent completes, the parent agent's model receives the subagent's text response in later iterations. Nested tool calls and subagent metadata, such as thread and resource IDs, aren't added to the parent agent's model context.
|
|
175
175
|
|
|
176
176
|
Application code and UI integrations can still inspect `subAgentToolResults` and the rest of the raw delegation result in the tool result payload.
|
|
177
177
|
|
|
178
|
-
This keeps debugging and display data available without sending nested tool arguments or outputs back into the
|
|
178
|
+
This keeps debugging and display data available without sending nested tool arguments or outputs back into the parent agent's next model call.
|
|
179
179
|
|
|
180
|
-
Set `includeSubAgentToolResultsInModelContext` to include the full subagent result, including nested tool results and subagent metadata, in the
|
|
180
|
+
Set `includeSubAgentToolResultsInModelContext` to include the full subagent result, including nested tool results and subagent metadata, in the parent agent's model context.
|
|
181
181
|
|
|
182
182
|
```typescript
|
|
183
|
-
await
|
|
183
|
+
await parentAgent.generate('Research AI trends', {
|
|
184
184
|
delegation: {
|
|
185
185
|
includeSubAgentToolResultsInModelContext: true,
|
|
186
186
|
},
|
|
@@ -189,10 +189,10 @@ await supervisor.generate('Research AI trends', {
|
|
|
189
189
|
|
|
190
190
|
## Iteration monitoring
|
|
191
191
|
|
|
192
|
-
`onIterationComplete` is called after each iteration of the
|
|
192
|
+
`onIterationComplete` is called after each iteration of the parent agent's loop. Use it to monitor execution or guide the next iteration. You can also stop execution early.
|
|
193
193
|
|
|
194
194
|
```typescript
|
|
195
|
-
const stream = await
|
|
195
|
+
const stream = await parentAgent.stream('Research AI trends', {
|
|
196
196
|
maxSteps: 10,
|
|
197
197
|
onIterationComplete: async context => {
|
|
198
198
|
console.log(`Iteration ${context.iteration}/${context.maxIterations}`)
|
|
@@ -220,19 +220,19 @@ Return `{ continue: true }` to keep iterating, or `{ continue: false }` to stop.
|
|
|
220
220
|
|
|
221
221
|
## Memory isolation
|
|
222
222
|
|
|
223
|
-
|
|
223
|
+
Mastra isolates subagent memory during delegation. Subagents receive the full conversation context for better decision-making, but only their specific delegation prompt and response are saved to their memory.
|
|
224
224
|
|
|
225
225
|
How it works:
|
|
226
226
|
|
|
227
|
-
1. **Full context forwarded**: When the
|
|
227
|
+
1. **Full context forwarded**: When the parent agent delegates, the subagent receives all messages from the parent agent's conversation
|
|
228
228
|
2. **Scoped memory saves**: Only the delegation prompt and the subagent's response are saved to the subagent's memory
|
|
229
229
|
3. **Fresh thread per invocation**: Each delegation uses a unique thread ID, ensuring clean separation
|
|
230
230
|
|
|
231
|
-
As a result, subagents have the context they need without cluttering their memory with the entire
|
|
231
|
+
As a result, subagents have the context they need without cluttering their memory with the parent agent's entire conversation. Visit [memory in multi-agent systems](https://mastra.ai/docs/memory/overview) for more details.
|
|
232
232
|
|
|
233
233
|
## Tool approval propagation
|
|
234
234
|
|
|
235
|
-
Tool approvals propagate through the delegation chain. When a subagent uses a tool with `requireApproval: true` or calls `suspend()`, the approval request surfaces
|
|
235
|
+
Tool approvals propagate through the delegation chain. When a subagent uses a tool with `requireApproval: true` or calls `suspend()`, the approval request surfaces in the parent agent's stream.
|
|
236
236
|
|
|
237
237
|
```typescript
|
|
238
238
|
const sensitiveDataTool = createTool({
|
|
@@ -248,13 +248,13 @@ const dataAgent = new Agent({
|
|
|
248
248
|
tools: { sensitiveDataTool },
|
|
249
249
|
})
|
|
250
250
|
|
|
251
|
-
const
|
|
252
|
-
id: '
|
|
251
|
+
const parentAgent = new Agent({
|
|
252
|
+
id: 'parent-agent',
|
|
253
253
|
agents: { dataAgent },
|
|
254
254
|
memory: new Memory(),
|
|
255
255
|
})
|
|
256
256
|
|
|
257
|
-
const stream = await
|
|
257
|
+
const stream = await parentAgent.stream('Get data for user 123')
|
|
258
258
|
|
|
259
259
|
for await (const chunk of stream.fullStream) {
|
|
260
260
|
if (chunk.type === 'tool-call-approval') {
|
|
@@ -265,22 +265,22 @@ for await (const chunk of stream.fullStream) {
|
|
|
265
265
|
|
|
266
266
|
## Cancellation
|
|
267
267
|
|
|
268
|
-
When you pass an `abortSignal` to the
|
|
268
|
+
When you pass an `abortSignal` to the parent agent's [`stream()`](https://mastra.ai/reference/streaming/agents/stream) or [`generate()`](https://mastra.ai/reference/agents/generate) call, Mastra forwards that same signal to delegated subagents. Calling `AbortController.abort()` cancels in-flight subagent runs at their next step instead of letting them run to completion.
|
|
269
269
|
|
|
270
270
|
```typescript
|
|
271
271
|
const controller = new AbortController()
|
|
272
272
|
|
|
273
|
-
const stream = await
|
|
273
|
+
const stream = await parentAgent.stream('Research AI trends', {
|
|
274
274
|
abortSignal: controller.signal,
|
|
275
275
|
})
|
|
276
276
|
|
|
277
|
-
// Cancel the
|
|
277
|
+
// Cancel the parent agent and any in-flight subagents
|
|
278
278
|
controller.abort()
|
|
279
279
|
```
|
|
280
280
|
|
|
281
281
|
## Task completion scoring
|
|
282
282
|
|
|
283
|
-
Agents don't always produce a complete, correct output on the first try. Task completion scorers can help
|
|
283
|
+
Agents don't always produce a complete, correct output on the first try. Task completion scorers can help by validating whether the task is complete after each iteration. If validation fails, the parent agent continues iterating. Feedback from failed scorers is included in the conversation context so subagents can see what was missing.
|
|
284
284
|
|
|
285
285
|
```typescript
|
|
286
286
|
import { createScorer } from '@mastra/core/evals'
|
|
@@ -295,7 +295,7 @@ const taskCompleteScorer = createScorer({
|
|
|
295
295
|
return hasAnalysis && hasRecommendations ? 1 : 0
|
|
296
296
|
})
|
|
297
297
|
|
|
298
|
-
const stream = await
|
|
298
|
+
const stream = await parentAgent.stream('Research AI in education', {
|
|
299
299
|
maxSteps: 10,
|
|
300
300
|
isTaskComplete: {
|
|
301
301
|
scorers: [taskCompleteScorer],
|
|
@@ -319,8 +319,8 @@ This is most effective for tasks with clear, verifiable success criteria. You ca
|
|
|
319
319
|
import { Agent } from '@mastra/core/agent'
|
|
320
320
|
import { createRubricScorer } from '@mastra/evals/scorers/prebuilt'
|
|
321
321
|
|
|
322
|
-
const
|
|
323
|
-
id: '
|
|
322
|
+
const parentAgent = new Agent({
|
|
323
|
+
id: 'parent-agent',
|
|
324
324
|
instructions: 'You coordinate research and writing using specialized agents.',
|
|
325
325
|
model: 'openai/gpt-5.6-sol',
|
|
326
326
|
agents: { researchAgent, writingAgent },
|
|
@@ -334,7 +334,7 @@ const rubricScorer = createRubricScorer({
|
|
|
334
334
|
],
|
|
335
335
|
})
|
|
336
336
|
|
|
337
|
-
const stream = await
|
|
337
|
+
const stream = await parentAgent.stream('Research AI in education', {
|
|
338
338
|
maxSteps: 10,
|
|
339
339
|
isTaskComplete: {
|
|
340
340
|
scorers: [rubricScorer],
|
|
@@ -349,15 +349,15 @@ For full API details, see the [rubric scorer reference](https://mastra.ai/refere
|
|
|
349
349
|
|
|
350
350
|
Clear instructions are essential for effective delegation.
|
|
351
351
|
|
|
352
|
-
|
|
352
|
+
The parent agent's `instructions` should specify the available resources and when to use each one. They should also define coordination behavior and success criteria.
|
|
353
353
|
|
|
354
|
-
Each subagent should have a clear `description` that explains its purpose and return format, including when the
|
|
354
|
+
Each subagent should have a clear `description` that explains its purpose and return format, including when the parent agent should use it.
|
|
355
355
|
|
|
356
|
-
The
|
|
356
|
+
The parent agent uses these descriptions to make delegation decisions.
|
|
357
357
|
|
|
358
358
|
```typescript
|
|
359
|
-
const
|
|
360
|
-
id: '
|
|
359
|
+
const parentAgent = new Agent({
|
|
360
|
+
id: 'parent-agent',
|
|
361
361
|
instructions: `You coordinate research and writing tasks.
|
|
362
362
|
|
|
363
363
|
Available resources:
|
|
@@ -378,13 +378,13 @@ Success criteria:
|
|
|
378
378
|
|
|
379
379
|
## Running subagents in the background
|
|
380
380
|
|
|
381
|
-
Subagent invocations are dispatched as tool calls, so they can run as [background tasks](https://mastra.ai/docs/long-running-agents/background-tasks). This is useful when one or more delegations are long-running and you don't want them to block the
|
|
381
|
+
Subagent invocations are dispatched as tool calls, so they can run as [background tasks](https://mastra.ai/docs/long-running-agents/background-tasks). This is useful when one or more delegations are long-running and you don't want them to block the parent agent's response.
|
|
382
382
|
|
|
383
|
-
Enable the [backgroundTasks manager](https://mastra.ai/reference/configuration) on the Mastra instance, then opt subagents in on the
|
|
383
|
+
Enable the [backgroundTasks manager](https://mastra.ai/reference/configuration) on the Mastra instance, then opt subagents in on the parent agent:
|
|
384
384
|
|
|
385
385
|
```typescript
|
|
386
|
-
const
|
|
387
|
-
id: '
|
|
386
|
+
const parentAgent = new Agent({
|
|
387
|
+
id: 'parent-agent',
|
|
388
388
|
instructions: 'Coordinate research and writing using the available agents.',
|
|
389
389
|
model: 'openai/gpt-5.6-sol',
|
|
390
390
|
agents: { researchAgent, writingAgent },
|
|
@@ -396,21 +396,21 @@ const supervisor = new Agent({
|
|
|
396
396
|
},
|
|
397
397
|
})
|
|
398
398
|
|
|
399
|
-
const stream = await
|
|
399
|
+
const stream = await parentAgent.streamUntilIdle('Research AI in education and write an article', {
|
|
400
400
|
memory: { thread: 't1', resource: 'u1' },
|
|
401
401
|
})
|
|
402
402
|
```
|
|
403
403
|
|
|
404
|
-
Use [`streamUntilIdle()`](https://mastra.ai/reference/streaming/agents/streamUntilIdle) instead of `stream()` so the stream stays open until the subagents complete and the
|
|
404
|
+
Use [`streamUntilIdle()`](https://mastra.ai/reference/streaming/agents/streamUntilIdle) instead of `stream()` so the stream stays open until the subagents complete and the parent agent has had a chance to respond to their results.
|
|
405
405
|
|
|
406
|
-
If a subagent isn't listed
|
|
406
|
+
If a subagent isn't listed under the parent agent's `backgroundTasks.tools` but has its own background-eligible tools, the parent agent still dispatches the subagent as a background task and inherits its config. See [Inheriting from the subagent](https://mastra.ai/docs/long-running-agents/background-tasks) for details.
|
|
407
407
|
|
|
408
408
|
## Subagent versioning
|
|
409
409
|
|
|
410
|
-
When using the [editor](https://mastra.ai/docs/editor/overview), you can control which stored version of each subagent the
|
|
410
|
+
When using the [editor](https://mastra.ai/docs/editor/overview), you can control which stored version of each subagent the parent agent uses at runtime. Set version overrides on the Mastra instance or per invocation:
|
|
411
411
|
|
|
412
412
|
```typescript
|
|
413
|
-
const result = await
|
|
413
|
+
const result = await parentAgent.generate('Research and write about AI safety', {
|
|
414
414
|
versions: {
|
|
415
415
|
agents: {
|
|
416
416
|
'research-agent': { status: 'published' },
|
|
@@ -377,6 +377,6 @@ These read from storage rather than the pubsub stream, so they're suitable for p
|
|
|
377
377
|
- [`Agent.stream()` reference](https://mastra.ai/reference/streaming/agents/stream)
|
|
378
378
|
- [backgroundTasks configuration reference](https://mastra.ai/reference/configuration)
|
|
379
379
|
- [Durable agents](https://mastra.ai/docs/long-running-agents/durable-agents)
|
|
380
|
-
- [Supervisor agents](https://mastra.ai/docs/
|
|
380
|
+
- [Supervisor agents](https://mastra.ai/docs/capabilities/subagents)
|
|
381
381
|
- [Stream chunk types](https://mastra.ai/reference/streaming/ChunkType)
|
|
382
382
|
- [Storage](https://mastra.ai/docs/storage/overview)
|
|
@@ -10,7 +10,7 @@ A goal is a durable, thread-scoped objective: a standing instruction the agent k
|
|
|
10
10
|
|
|
11
11
|
The objective is persisted in thread state, so it survives reloads and is evaluated in-loop, even when a new message arrives in the middle of an already-running turn.
|
|
12
12
|
|
|
13
|
-
Goals build on the same machinery as [`isTaskComplete`](https://mastra.ai/docs/
|
|
13
|
+
Goals build on the same machinery as [`isTaskComplete`](https://mastra.ai/docs/capabilities/subagents): an LLM-as-judge scores the agent's output each iteration and gates the loop. The difference is that a goal is **durable** (stored in thread state, not passed per call) and is set and updated through `Agent` methods rather than per-`stream()` options.
|
|
14
14
|
|
|
15
15
|
## When to use goals
|
|
16
16
|
|
|
@@ -20,7 +20,7 @@ Use a goal when you want an agent to keep working toward a single objective acro
|
|
|
20
20
|
- Work that should continue across mid-run messages (a message delivered into a live run is still judged against the goal).
|
|
21
21
|
- An objective that must persist across thread reloads or process restarts.
|
|
22
22
|
|
|
23
|
-
For a one-off completion check within a single `stream()` call, use [`isTaskComplete`](https://mastra.ai/docs/
|
|
23
|
+
For a one-off completion check within a single `stream()` call, use [`isTaskComplete`](https://mastra.ai/docs/capabilities/subagents) instead.
|
|
24
24
|
|
|
25
25
|
## Quickstart
|
|
26
26
|
|
|
@@ -113,6 +113,6 @@ Per-objective values written by `setObjective` / `updateObjectiveOptions` take p
|
|
|
113
113
|
|
|
114
114
|
## Related
|
|
115
115
|
|
|
116
|
-
- [Supervisor agents](https://mastra.ai/docs/
|
|
116
|
+
- [Supervisor agents](https://mastra.ai/docs/capabilities/subagents): `isTaskComplete` and the rubric scorer
|
|
117
117
|
- [Signal providers](https://mastra.ai/docs/long-running-agents/signal-providers): how the objective is projected into context
|
|
118
118
|
- [Memory storage](https://mastra.ai/docs/storage/overview): the storage backend goals require
|
|
@@ -188,7 +188,7 @@ Conversation messages are ordered by timestamp and deduplicated by message ID, s
|
|
|
188
188
|
|
|
189
189
|
## Memory in multi-agent systems
|
|
190
190
|
|
|
191
|
-
When a [supervisor agent](https://mastra.ai/docs/
|
|
191
|
+
When a [supervisor agent](https://mastra.ai/docs/capabilities/subagents) delegates to a subagent, Mastra isolates subagent memory automatically. No flag enables this as it happens on every delegation. Understanding how this scoping works lets you decide what stays private and what to share intentionally.
|
|
192
192
|
|
|
193
193
|
### How delegation scopes memory
|
|
194
194
|
|
|
@@ -200,7 +200,7 @@ Each delegation creates a fresh `threadId` and a deterministic `resourceId` for
|
|
|
200
200
|
|
|
201
201
|
> **Note:** Title generation (`generateTitle`) is a top-level thread concern and **isn't** applied to inherited subagent threads. Because each delegation creates an ephemeral thread that no one sees, running title generation for it would waste an LLM call per delegation. To generate titles for a subagent's own threads, give that subagent its own memory configuration.
|
|
202
202
|
|
|
203
|
-
The supervisor forwards its conversation context to the subagent so it has enough background to complete the task. Only the delegation prompt and the subagent's response are saved, the full parent conversation isn't stored. You can control which messages reach the subagent with the [`messageFilter`](https://mastra.ai/docs/
|
|
203
|
+
The supervisor forwards its conversation context to the subagent so it has enough background to complete the task. Only the delegation prompt and the subagent's response are saved, the full parent conversation isn't stored. You can control which messages reach the subagent with the [`messageFilter`](https://mastra.ai/docs/capabilities/subagents) callback.
|
|
204
204
|
|
|
205
205
|
> **Note:** Subagent resource IDs are always suffixed with the agent name (`{parentResourceId}-{agentName}`). Different subagents under the same supervisor never share a resource ID through delegation.
|
|
206
206
|
|
|
@@ -184,7 +184,7 @@ export const mastra = new Mastra({
|
|
|
184
184
|
})
|
|
185
185
|
```
|
|
186
186
|
|
|
187
|
-
You can also route `observability` to a dedicated analytics backend. See [observability
|
|
187
|
+
You can also route `observability` to a dedicated analytics backend. See the [observability quickstart](https://mastra.ai/docs/observability/overview) for an observability-specific example.
|
|
188
188
|
|
|
189
189
|
## Supported providers
|
|
190
190
|
|
|
@@ -211,4 +211,4 @@ Each provider page includes installation instructions, configuration parameters,
|
|
|
211
211
|
- [Storage retention](https://mastra.ai/reference/storage/retention)
|
|
212
212
|
- [Storage schemas](https://mastra.ai/reference/storage/overview)
|
|
213
213
|
- [Memory](https://mastra.ai/docs/memory/overview)
|
|
214
|
-
- [Observability storage](https://mastra.ai/docs/observability/
|
|
214
|
+
- [Observability storage](https://mastra.ai/docs/observability/overview)
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_src = require("./src-
|
|
2
|
+
const require_src = require("./src-CjTEWCUF.cjs");
|
|
3
3
|
let _mastra_core_processors = require("@mastra/core/processors");
|
|
4
4
|
exports.Extractor = require_src.Extractor;
|
|
5
5
|
exports.Memory = require_src.Memory;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAKhD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAG1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EACV,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,0BAA0B,EAC1B,YAAY,EACb,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,oBAAoB,EAA6B,MAAM,4BAA4B,CAAC;AAClG,OAAO,KAAK,EACV,cAAc,EACd,wBAAwB,EACxB,eAAe,EACf,yBAAyB,EAC1B,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EACV,uBAAuB,EACvB,wBAAwB,EACxB,wBAAwB,EACxB,oCAAoC,EACpC,yBAAyB,EACzB,aAAa,EACb,uBAAuB,EACvB,wBAAwB,EACxB,mBAAmB,EACnB,yBAAyB,EAE1B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAQrD,OAAO,KAA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AAC;IAyBlG;;;;;;;;;;;OAWG;IACU,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAmB5E;;;;;;;OAOG;IACG,kBAAkB,CACtB,oBAAoB,GAAE,wBAAwB,EAAO,EACrD,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,cAAc,EAAE,CAAC;IAiB5B;;;;OAIG;IACG,mBAAmB,CACvB,oBAAoB,GAAE,yBAAyB,EAAO,EACtD,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,eAAe,EAAE,CAAC;IAW7B;;;;OAIG;YACW,iBAAiB;IAqC/B;;;;OAIG;YACW,iCAAiC;CAwBhD;AAGD,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAGxF,YAAY,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAGnH,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AAGxE,OAAO,EACL,2BAA2B,EAC3B,uBAAuB,EACvB,iCAAiC,GAClC,MAAM,mCAAmC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as WorkingMemoryExtractor, R as Extractor, S as deepMergeWorkingMemory, T as summarizeConversation, a as extractWorkingMemoryContent, c as WORKING_MEMORY_STATE_ID, d as getObservationsAsOf, i as WorkingMemory, l as WORKING_MEMORY_STATE_PROCESSOR_ID, n as MessageHistory, o as extractWorkingMemoryTags, r as SemanticRecall, s as removeWorkingMemoryTags, t as Memory, u as WorkingMemoryStateProcessor, w as SUMMARIZE_THREAD_DEFAULTS, x as ModelByInputTokens } from "./src-
|
|
1
|
+
import { C as WorkingMemoryExtractor, R as Extractor, S as deepMergeWorkingMemory, T as summarizeConversation, a as extractWorkingMemoryContent, c as WORKING_MEMORY_STATE_ID, d as getObservationsAsOf, i as WorkingMemory, l as WORKING_MEMORY_STATE_PROCESSOR_ID, n as MessageHistory, o as extractWorkingMemoryTags, r as SemanticRecall, s as removeWorkingMemoryTags, t as Memory, u as WorkingMemoryStateProcessor, w as SUMMARIZE_THREAD_DEFAULTS, x as ModelByInputTokens } from "./src-Cwt9gefz.js";
|
|
2
2
|
export { Extractor, Memory, MessageHistory, ModelByInputTokens, SUMMARIZE_THREAD_DEFAULTS, SemanticRecall, WORKING_MEMORY_STATE_ID, WORKING_MEMORY_STATE_PROCESSOR_ID, WorkingMemory, WorkingMemoryExtractor, WorkingMemoryStateProcessor, deepMergeWorkingMemory, extractWorkingMemoryContent, extractWorkingMemoryTags, getObservationsAsOf, removeWorkingMemoryTags, summarizeConversation };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_src = require("../src-
|
|
2
|
+
const require_src = require("../src-CjTEWCUF.cjs");
|
|
3
3
|
exports.Extractor = require_src.Extractor;
|
|
4
4
|
exports.ModelByInputTokens = require_src.ModelByInputTokens;
|
|
5
5
|
exports.OBSERVATIONAL_MEMORY_DEFAULTS = require_src.OBSERVATIONAL_MEMORY_DEFAULTS;
|
package/dist/processors/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as extractCurrentTask, B as OBSERVATION_CONTEXT_INSTRUCTIONS, C as WorkingMemoryExtractor, D as OBSERVER_SYSTEM_PROMPT, E as TokenCounter, F as injectAnchorIds, H as OBSERVATION_CONTINUATION_HINT, I as parseAnchorId, L as stripEphemeralAnchorIds, M as hasCurrentTaskSection, N as optimizeObservationsForContext, O as buildObserverPrompt, P as parseObserverOutput, R as Extractor, T as summarizeConversation, V as OBSERVATION_CONTEXT_PROMPT, _ as reconcileObservationGroupsFromReflection, b as wrapInObservationGroup, d as getObservationsAsOf, f as ObservationalMemoryProcessor, g as parseObservationGroups, h as deriveObservationGroupProvenance, j as formatMessagesForObserver, k as buildObserverSystemPrompt, m as combineObservationGroupRanges, p as ObservationalMemory, v as renderObservationGroupsForReflection, x as ModelByInputTokens, y as stripObservationGroups, z as OBSERVATIONAL_MEMORY_DEFAULTS } from "../src-
|
|
1
|
+
import { A as extractCurrentTask, B as OBSERVATION_CONTEXT_INSTRUCTIONS, C as WorkingMemoryExtractor, D as OBSERVER_SYSTEM_PROMPT, E as TokenCounter, F as injectAnchorIds, H as OBSERVATION_CONTINUATION_HINT, I as parseAnchorId, L as stripEphemeralAnchorIds, M as hasCurrentTaskSection, N as optimizeObservationsForContext, O as buildObserverPrompt, P as parseObserverOutput, R as Extractor, T as summarizeConversation, V as OBSERVATION_CONTEXT_PROMPT, _ as reconcileObservationGroupsFromReflection, b as wrapInObservationGroup, d as getObservationsAsOf, f as ObservationalMemoryProcessor, g as parseObservationGroups, h as deriveObservationGroupProvenance, j as formatMessagesForObserver, k as buildObserverSystemPrompt, m as combineObservationGroupRanges, p as ObservationalMemory, v as renderObservationGroupsForReflection, x as ModelByInputTokens, y as stripObservationGroups, z as OBSERVATIONAL_MEMORY_DEFAULTS } from "../src-Cwt9gefz.js";
|
|
2
2
|
export { Extractor, ModelByInputTokens, OBSERVATIONAL_MEMORY_DEFAULTS, OBSERVATION_CONTEXT_INSTRUCTIONS, OBSERVATION_CONTEXT_PROMPT, OBSERVATION_CONTINUATION_HINT, OBSERVER_SYSTEM_PROMPT, ObservationalMemory, ObservationalMemoryProcessor, TokenCounter, WorkingMemoryExtractor, buildObserverPrompt, buildObserverSystemPrompt, combineObservationGroupRanges, deriveObservationGroupProvenance, extractCurrentTask, formatMessagesForObserver, getObservationsAsOf, hasCurrentTaskSection, injectAnchorIds, optimizeObservationsForContext, parseAnchorId, parseObservationGroups, parseObserverOutput, reconcileObservationGroupsFromReflection, renderObservationGroupsForReflection, stripEphemeralAnchorIds, stripObservationGroups, summarizeConversation, wrapInObservationGroup };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message-utils.d.ts","sourceRoot":"","sources":["../../../src/processors/observational-memory/message-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,KAAK,EAAE,wBAAwB,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAEhG;;;GAGG;AACH,wBAAgB,oCAAoC,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,CAYrF;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,eAAe,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,CAoBhG;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAEpE;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,eAAe,EAAE,GAC1B;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAS/C;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,eAAe,EAAE,MAAM,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAMlH;
|
|
1
|
+
{"version":3,"file":"message-utils.d.ts","sourceRoot":"","sources":["../../../src/processors/observational-memory/message-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,KAAK,EAAE,wBAAwB,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAEhG;;;GAGG;AACH,wBAAgB,oCAAoC,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,CAYrF;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,eAAe,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,CAoBhG;AAED;;GAEG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
|
|
131
131
|
* accept eventual consistency (acceptable for v1).
|
|
132
132
|
*/
|
|
133
133
|
private locks;
|
|
134
|
+
/**
|
|
135
|
+
* Initial record lookup/creation promises keyed by the effective storage scope.
|
|
136
|
+
* Concurrent callers share the full read-or-create operation so a stale read
|
|
137
|
+
* cannot create another generation-zero record after the first insert finishes.
|
|
138
|
+
* Entries are removed after both success and failure so later calls always
|
|
139
|
+
* re-read storage and transient failures can be retried.
|
|
140
|
+
*/
|
|
141
|
+
private recordInitializations;
|
|
134
142
|
/**
|
|
135
143
|
* Acquire a lock for the given key, execute the callback, then release.
|
|
136
144
|
* If a lock is already held, waits for it to be released before acquiring.
|