@mastra/memory 1.41.1-alpha.0 → 1.41.1-alpha.2

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-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.41.1-alpha.0"
6
+ version: "1.41.1-alpha.2"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -66,8 +66,6 @@ Read the individual reference documents for detailed explanations and code examp
66
66
  - [Reference: summarizeConversation()](references/reference-memory-summarizeConversation.md) - The standalone summarizeConversation() function summarizes a conversation in one shot.
67
67
  - [Reference: Memory.summarizeThread()](references/reference-memory-summarizeThread.md) - Call Memory.summarizeThread() to produce a thread summary in one operation and extract configured structured values from its messages.
68
68
  - [Reference: Memory.updateThreadResourceId()](references/reference-memory-updateThreadResourceId.md) - The .updateThreadResourceId() method transfers ownership of a thread to a different resource by reassigning its resourceId.
69
- - [Migration: AgentNetwork to .network()](references/reference-migrations-agentnetwork.md) - Migrate deprecated AgentNetwork usage to supervisor agents and the standard Agent.generate() or Agent.stream() APIs in current Mastra releases.
70
- - [Memory](references/reference-migrations-upgrade-to-v1-memory.md) - Memory configuration now requires explicit parameters, and default settings have been updated for better performance and predictability.
71
69
  - [Reference: TokenLimiterProcessor](references/reference-processors-token-limiter-processor.md) - Use TokenLimiterProcessor to constrain message tokens during prompt, input, or output processing with configurable limits and strategies.
72
70
 
73
71
 
@@ -1,243 +1,243 @@
1
1
  {
2
- "version": "1.41.1-alpha.0",
2
+ "version": "1.41.1-alpha.2",
3
3
  "package": "@mastra/memory",
4
4
  "exports": {
5
5
  "AUTO_MODEL_BY_PROVIDER": {
6
6
  "types": "dist/processors/observational-memory/auto-model.d.ts",
7
- "implementation": "dist/src-BIae5T_v.js",
8
- "line": 32135
7
+ "implementation": "dist/src-wMl-5Ms8.js",
8
+ "line": 32171
9
9
  },
10
10
  "Extractor": {
11
11
  "types": "dist/processors/observational-memory/extractor.d.ts",
12
- "implementation": "dist/src-BIae5T_v.js",
13
- "line": 23936
12
+ "implementation": "dist/src-wMl-5Ms8.js",
13
+ "line": 23939
14
14
  },
15
15
  "ModelByInputTokens": {
16
16
  "types": "dist/processors/observational-memory/model-by-input-tokens.d.ts",
17
- "implementation": "dist/src-BIae5T_v.js",
18
- "line": 31918
17
+ "implementation": "dist/src-wMl-5Ms8.js",
18
+ "line": 31954
19
19
  },
20
20
  "OBSERVATIONAL_MEMORY_DEFAULTS": {
21
21
  "types": "dist/processors/observational-memory/constants.d.ts",
22
- "implementation": "dist/src-BIae5T_v.js",
22
+ "implementation": "dist/src-wMl-5Ms8.js",
23
23
  "line": 23675
24
24
  },
25
25
  "OBSERVATION_CONTEXT_INSTRUCTIONS": {
26
26
  "types": "dist/processors/observational-memory/constants.d.ts",
27
- "implementation": "dist/src-BIae5T_v.js",
27
+ "implementation": "dist/src-wMl-5Ms8.js",
28
28
  "line": 23736
29
29
  },
30
30
  "OBSERVATION_CONTEXT_PROMPT": {
31
31
  "types": "dist/processors/observational-memory/constants.d.ts",
32
- "implementation": "dist/src-BIae5T_v.js",
32
+ "implementation": "dist/src-wMl-5Ms8.js",
33
33
  "line": 23718
34
34
  },
35
35
  "OBSERVATION_CONTEXT_PROMPT_THREAD": {
36
36
  "types": "dist/processors/observational-memory/constants.d.ts",
37
- "implementation": "dist/src-BIae5T_v.js",
37
+ "implementation": "dist/src-wMl-5Ms8.js",
38
38
  "line": 23723
39
39
  },
40
40
  "OBSERVATION_CONTINUATION_HINT": {
41
41
  "types": "dist/processors/observational-memory/constants.d.ts",
42
- "implementation": "dist/src-BIae5T_v.js",
42
+ "implementation": "dist/src-wMl-5Ms8.js",
43
43
  "line": 23705
44
44
  },
45
45
  "OBSERVER_SYSTEM_PROMPT": {
46
46
  "types": "dist/processors/observational-memory/observer-agent.d.ts",
47
- "implementation": "dist/src-BIae5T_v.js",
48
- "line": 26271
47
+ "implementation": "dist/src-wMl-5Ms8.js",
48
+ "line": 26300
49
49
  },
50
50
  "ObservationalMemory": {
51
51
  "types": "dist/processors/observational-memory/observational-memory.d.ts",
52
- "implementation": "dist/src-BIae5T_v.js",
53
- "line": 36943
52
+ "implementation": "dist/src-wMl-5Ms8.js",
53
+ "line": 36979
54
54
  },
55
55
  "ObservationalMemoryProcessor": {
56
56
  "types": "dist/processors/observational-memory/processor.d.ts",
57
- "implementation": "dist/src-BIae5T_v.js",
58
- "line": 39678
57
+ "implementation": "dist/src-wMl-5Ms8.js",
58
+ "line": 39714
59
59
  },
60
60
  "TokenCounter": {
61
61
  "types": "dist/processors/observational-memory/token-counter.d.ts",
62
- "implementation": "dist/src-BIae5T_v.js",
63
- "line": 28768
62
+ "implementation": "dist/src-wMl-5Ms8.js",
63
+ "line": 28804
64
64
  },
65
65
  "WorkingMemoryExtractor": {
66
66
  "types": "dist/processors/observational-memory/working-memory-extractor.d.ts",
67
- "implementation": "dist/src-BIae5T_v.js",
68
- "line": 29784
67
+ "implementation": "dist/src-wMl-5Ms8.js",
68
+ "line": 29820
69
69
  },
70
70
  "buildObserverPrompt": {
71
71
  "types": "dist/processors/observational-memory/observer-agent.d.ts",
72
- "implementation": "dist/src-BIae5T_v.js",
73
- "line": 26954
72
+ "implementation": "dist/src-wMl-5Ms8.js",
73
+ "line": 26983
74
74
  },
75
75
  "buildObserverSystemPrompt": {
76
76
  "types": "dist/processors/observational-memory/observer-agent.d.ts",
77
- "implementation": "dist/src-BIae5T_v.js",
78
- "line": 26165
77
+ "implementation": "dist/src-wMl-5Ms8.js",
78
+ "line": 26194
79
79
  },
80
80
  "combineObservationGroupRanges": {
81
81
  "types": "dist/processors/observational-memory/observation-groups.d.ts",
82
- "implementation": "dist/src-BIae5T_v.js",
83
- "line": 30238
82
+ "implementation": "dist/src-wMl-5Ms8.js",
83
+ "line": 30274
84
84
  },
85
85
  "deriveObservationGroupProvenance": {
86
86
  "types": "dist/processors/observational-memory/observation-groups.d.ts",
87
- "implementation": "dist/src-BIae5T_v.js",
88
- "line": 30282
87
+ "implementation": "dist/src-wMl-5Ms8.js",
88
+ "line": 30318
89
89
  },
90
90
  "extractCurrentTask": {
91
91
  "types": "dist/processors/observational-memory/observer-agent.d.ts",
92
- "implementation": "dist/src-BIae5T_v.js",
93
- "line": 27267
92
+ "implementation": "dist/src-wMl-5Ms8.js",
93
+ "line": 27296
94
94
  },
95
95
  "formatMessagesForObserver": {
96
96
  "types": "dist/processors/observational-memory/observer-agent.d.ts",
97
- "implementation": "dist/src-BIae5T_v.js",
98
- "line": 26706
97
+ "implementation": "dist/src-wMl-5Ms8.js",
98
+ "line": 26735
99
99
  },
100
100
  "getObservationContextPrompt": {
101
101
  "types": "dist/processors/observational-memory/constants.d.ts",
102
- "implementation": "dist/src-BIae5T_v.js",
102
+ "implementation": "dist/src-wMl-5Ms8.js",
103
103
  "line": 23729
104
104
  },
105
105
  "getObservationsAsOf": {
106
106
  "types": "dist/processors/observational-memory/observation-utils.d.ts",
107
- "implementation": "dist/src-BIae5T_v.js",
108
- "line": 39984
107
+ "implementation": "dist/src-wMl-5Ms8.js",
108
+ "line": 40021
109
109
  },
110
110
  "hasCurrentTaskSection": {
111
111
  "types": "dist/processors/observational-memory/observer-agent.d.ts",
112
- "implementation": "dist/src-BIae5T_v.js",
113
- "line": 27255
112
+ "implementation": "dist/src-wMl-5Ms8.js",
113
+ "line": 27284
114
114
  },
115
115
  "injectAnchorIds": {
116
116
  "types": "dist/processors/observational-memory/anchor-ids.d.ts",
117
- "implementation": "dist/src-BIae5T_v.js",
118
- "line": 24887
117
+ "implementation": "dist/src-wMl-5Ms8.js",
118
+ "line": 24916
119
119
  },
120
120
  "optimizeObservationsForContext": {
121
121
  "types": "dist/processors/observational-memory/observer-agent.d.ts",
122
- "implementation": "dist/src-BIae5T_v.js",
123
- "line": 27288
122
+ "implementation": "dist/src-wMl-5Ms8.js",
123
+ "line": 27317
124
124
  },
125
125
  "parseAnchorId": {
126
126
  "types": "dist/processors/observational-memory/anchor-ids.d.ts",
127
- "implementation": "dist/src-BIae5T_v.js",
128
- "line": 24871
127
+ "implementation": "dist/src-wMl-5Ms8.js",
128
+ "line": 24900
129
129
  },
130
130
  "parseObservationGroups": {
131
131
  "types": "dist/processors/observational-memory/observation-groups.d.ts",
132
- "implementation": "dist/src-BIae5T_v.js",
133
- "line": 30193
132
+ "implementation": "dist/src-wMl-5Ms8.js",
133
+ "line": 30229
134
134
  },
135
135
  "parseObserverOutput": {
136
136
  "types": "dist/processors/observational-memory/observer-agent.d.ts",
137
- "implementation": "dist/src-BIae5T_v.js",
138
- "line": 26965
137
+ "implementation": "dist/src-wMl-5Ms8.js",
138
+ "line": 26994
139
139
  },
140
140
  "reconcileObservationGroupsFromReflection": {
141
141
  "types": "dist/processors/observational-memory/observation-groups.d.ts",
142
- "implementation": "dist/src-BIae5T_v.js",
143
- "line": 30301
142
+ "implementation": "dist/src-wMl-5Ms8.js",
143
+ "line": 30337
144
144
  },
145
145
  "renderObservationGroupsForReflection": {
146
146
  "types": "dist/processors/observational-memory/observation-groups.d.ts",
147
- "implementation": "dist/src-BIae5T_v.js",
148
- "line": 30267
147
+ "implementation": "dist/src-wMl-5Ms8.js",
148
+ "line": 30303
149
149
  },
150
150
  "resolveAutoModelId": {
151
151
  "types": "dist/processors/observational-memory/auto-model.d.ts",
152
- "implementation": "dist/src-BIae5T_v.js",
153
- "line": 32155
152
+ "implementation": "dist/src-wMl-5Ms8.js",
153
+ "line": 32191
154
154
  },
155
155
  "stripEphemeralAnchorIds": {
156
156
  "types": "dist/processors/observational-memory/anchor-ids.d.ts",
157
- "implementation": "dist/src-BIae5T_v.js",
158
- "line": 24910
157
+ "implementation": "dist/src-wMl-5Ms8.js",
158
+ "line": 24939
159
159
  },
160
160
  "stripObservationGroups": {
161
161
  "types": "dist/processors/observational-memory/observation-groups.d.ts",
162
- "implementation": "dist/src-BIae5T_v.js",
163
- "line": 30210
162
+ "implementation": "dist/src-wMl-5Ms8.js",
163
+ "line": 30246
164
164
  },
165
165
  "summarizeConversation": {
166
166
  "types": "dist/processors/observational-memory/summarize.d.ts",
167
- "implementation": "dist/src-BIae5T_v.js",
168
- "line": 29399
167
+ "implementation": "dist/src-wMl-5Ms8.js",
168
+ "line": 29435
169
169
  },
170
170
  "wrapInObservationGroup": {
171
171
  "types": "dist/processors/observational-memory/observation-groups.d.ts",
172
- "implementation": "dist/src-BIae5T_v.js",
173
- "line": 30189
172
+ "implementation": "dist/src-wMl-5Ms8.js",
173
+ "line": 30225
174
174
  },
175
175
  "KnowledgeSemanticIndexCoordinator": {
176
176
  "types": "dist/removed-subconscious.d.ts",
177
- "implementation": "dist/src-BIae5T_v.js",
178
- "line": 29831
177
+ "implementation": "dist/src-wMl-5Ms8.js",
178
+ "line": 29867
179
179
  },
180
180
  "Memory": {
181
181
  "types": "dist/index.d.ts",
182
- "implementation": "dist/src-BIae5T_v.js",
183
- "line": 40196
182
+ "implementation": "dist/src-wMl-5Ms8.js",
183
+ "line": 40232
184
184
  },
185
185
  "SUMMARIZE_THREAD_DEFAULTS": {
186
186
  "types": "dist/processors/observational-memory/summarize.d.ts",
187
- "implementation": "dist/src-BIae5T_v.js",
188
- "line": 29355
187
+ "implementation": "dist/src-wMl-5Ms8.js",
188
+ "line": 29391
189
189
  },
190
190
  "StaleKnowledgeSemanticIndexError": {
191
191
  "types": "dist/removed-subconscious.d.ts",
192
- "implementation": "dist/src-BIae5T_v.js",
193
- "line": 29837
192
+ "implementation": "dist/src-wMl-5Ms8.js",
193
+ "line": 29873
194
194
  },
195
195
  "Subconscious": {
196
196
  "types": "dist/removed-subconscious.d.ts",
197
- "implementation": "dist/src-BIae5T_v.js",
198
- "line": 29825
197
+ "implementation": "dist/src-wMl-5Ms8.js",
198
+ "line": 29861
199
199
  },
200
200
  "WORKING_MEMORY_STATE_ID": {
201
201
  "types": "dist/processors/working-memory-state/processor.d.ts",
202
- "implementation": "dist/src-BIae5T_v.js",
203
- "line": 31964
202
+ "implementation": "dist/src-wMl-5Ms8.js",
203
+ "line": 32000
204
204
  },
205
205
  "WORKING_MEMORY_STATE_PROCESSOR_ID": {
206
206
  "types": "dist/processors/working-memory-state/processor.d.ts",
207
- "implementation": "dist/src-BIae5T_v.js",
208
- "line": 31965
207
+ "implementation": "dist/src-wMl-5Ms8.js",
208
+ "line": 32001
209
209
  },
210
210
  "WorkingMemoryStateProcessor": {
211
211
  "types": "dist/processors/working-memory-state/processor.d.ts",
212
- "implementation": "dist/src-BIae5T_v.js",
213
- "line": 31966
212
+ "implementation": "dist/src-wMl-5Ms8.js",
213
+ "line": 32002
214
214
  },
215
215
  "deepMergeWorkingMemory": {
216
216
  "types": "dist/tools/working-memory.d.ts",
217
- "implementation": "dist/src-BIae5T_v.js",
218
- "line": 29478
217
+ "implementation": "dist/src-wMl-5Ms8.js",
218
+ "line": 29514
219
219
  },
220
220
  "extractWorkingMemoryContent": {
221
221
  "types": "dist/index.d.ts",
222
- "implementation": "dist/src-BIae5T_v.js",
223
- "line": 40049
222
+ "implementation": "dist/src-wMl-5Ms8.js",
223
+ "line": 40086
224
224
  },
225
225
  "extractWorkingMemoryTags": {
226
226
  "types": "dist/index.d.ts",
227
- "implementation": "dist/src-BIae5T_v.js",
228
- "line": 40017
227
+ "implementation": "dist/src-wMl-5Ms8.js",
228
+ "line": 40054
229
229
  },
230
230
  "removeWorkingMemoryTags": {
231
231
  "types": "dist/index.d.ts",
232
- "implementation": "dist/src-BIae5T_v.js",
233
- "line": 40030
232
+ "implementation": "dist/src-wMl-5Ms8.js",
233
+ "line": 40067
234
234
  }
235
235
  },
236
236
  "modules": {
237
237
  "processors": {
238
238
  "index": "dist/processors/index.js",
239
239
  "chunks": [
240
- "src-BIae5T_v.js"
240
+ "src-wMl-5Ms8.js"
241
241
  ]
242
242
  }
243
243
  }
@@ -191,8 +191,9 @@ export const mastra = new Mastra({
191
191
 
192
192
  When a deferred task finishes and no `untilIdle` stream is open for its thread, Mastra sends the agent a `notification` signal with the tag `background-task`. The signal names the tool call and task, and tells the agent the result is now on the tool call. It doesn't copy the result into the prompt. This covers a `stream()` call without `untilIdle`, a client that disconnected, and a task resumed after it [suspended](#suspending-and-resuming).
193
193
 
194
- - If the thread is idle, the signal wakes the agent, which runs a turn on the thread to report the outcome.
194
+ - If the thread is idle, the signal wakes the agent, which runs a turn on the thread to report the outcome. The woken run uses the request context of the run that dispatched the task, so a model, instructions, or memory resolved from that context resolve the same way.
195
195
  - If a run is already active on the thread, including the run that dispatched the task, the signal is delivered to that run's next model request. If that run ends without making another request, the signal runs as its own turn.
196
+ - If another agent's run holds the thread, for example while it waits for a tool approval, the signal waits and wakes the agent once that run ends.
196
197
  - If an `untilIdle` stream is open for the thread, no signal is sent, because that stream runs its own follow-up turn.
197
198
  - If the caller cancelled or aborted the `untilIdle` stream that was waiting for the task, no signal is sent either: stopping the stream means the caller doesn't want a reply for that work. A task that suspended and is answered later isn't covered by this, because the stream stopped waiting for it when it suspended.
198
199
 
@@ -246,6 +246,29 @@ const options = {
246
246
  }
247
247
  ```
248
248
 
249
+ ### Long messages
250
+
251
+ Embedding models accept a limited number of tokens per input. Memory splits longer messages into chunks and stores each chunk as its own vector row, so every part of the message can be recalled. `maxChunkChars` sets the largest chunk in characters:
252
+
253
+ ```typescript
254
+ const agent = new Agent({
255
+ id: 'agent',
256
+ memory: new Memory({
257
+ options: {
258
+ semanticRecall: { topK: 3, messageRange: 2, maxChunkChars: 6000 },
259
+ },
260
+ }),
261
+ })
262
+ ```
263
+
264
+ The default is 16,384 characters, about 4,096 tokens of English text, which fits `openai/text-embedding-3-small` and its 8,191-token limit. The limit is in characters because each embedding provider uses its own tokenizer. Chinese, Japanese, and Korean text, and code, use more tokens per character than English, so lower `maxChunkChars` when that kind of text makes up most of your messages.
265
+
266
+ When you don't set `maxChunkChars` and the embedder declares its input limit, Memory derives the chunk size from that limit. [FastEmbed](#using-fastembed-local) models declare their 512-token window, so they need no configuration.
267
+
268
+ Each chunk row's ID comes from the message ID, so saving a message again replaces its rows. If you save a message again with shorter text through `memory.saveMessages()`, rows for chunks past the new end stay searchable until the message is updated with `memory.updateMessages()` or deleted.
269
+
270
+ Set `maxChunkChars` on the `Memory` constructor. Memory options passed per request, such as `memory.options` in `agent.stream()`, don't change it, so API callers can't force many small chunks.
271
+
249
272
  ## Server-side embeddings
250
273
 
251
274
  Some vector stores generate the embeddings themselves. With one of those, semantic recall runs without an `embedder`: the database embeds each message on write and the search string on arrival. The embedding provider stays out of your application entirely.
@@ -407,7 +430,7 @@ Memory uses a single embedder for both storing and recalling messages, so pick o
407
430
 
408
431
  Multilingual E5 produces 1024-dimensional vectors. Your vector index must be created with matching dimensions, and E5 vectors can't be mixed with vectors from another embedder in the same index.
409
432
 
410
- FastEmbed models embed at most 512 tokens per input (roughly 2,000 to 2,500 characters of English text). Longer inputs are truncated, so text past the limit doesn't affect the embedding and can't be found by semantic recall. The AI SDK v3 FastEmbed models return a warning when this happens. The legacy v1 and v2 models don't. If you embed long documents with FastEmbed, chunk them to fit the window, for example with `maxSize: 1500` in `MDocument.chunk()`.
433
+ FastEmbed models embed at most 512 tokens per input (roughly 2,000 to 2,500 characters of English text). Longer inputs are truncated, so text past the limit doesn't affect the embedding. Semantic recall sizes its message chunks to fit this window automatically (see [Long messages](#long-messages)). Outside of memory, the AI SDK v3 FastEmbed models return a warning when an input is truncated. The legacy v1 and v2 models don't. If you embed long documents with FastEmbed, chunk them to fit the window, for example with `maxSize: 1500` in `MDocument.chunk()`.
411
434
 
412
435
  ### Setting the embedding dimension
413
436
 
@@ -4,9 +4,48 @@
4
4
 
5
5
  # GitHub
6
6
 
7
- The `@mastra/github-signals` provider lets an agent follow pull requests (PRs). It polls subscribed PRs and sends [notification signals](https://mastra.ai/docs/signals/notifications) to the agent thread when relevant activity occurs.
7
+ Use GitHub with Mastra in two ways:
8
8
 
9
- ## Installation
9
+ - **Agent tools** let an agent work with repositories, issues, pull requests, releases, and workflow runs through [Mastra Connect](https://mastra.ai/docs/mastra-platform/connect).
10
+ - **[Pull request signals](#pull-request-signals)** let an agent follow pull requests (PRs) and react when they change.
11
+
12
+ ## Connect
13
+
14
+ Before you start, complete the [Connect setup](https://mastra.ai/docs/mastra-platform/connect) to install `@mastra/connect` and configure your platform project. Connect keeps GitHub credentials on the Mastra platform, so your application never stores them.
15
+
16
+ ### Agent tools
17
+
18
+ Give agents tools to search code and repositories, manage issues, pull requests, branches, files, and releases, and inspect and rerun workflow runs in GitHub.
19
+
20
+ Connect an account with the `github` provider ID. Run this command from the directory that contains your `.env` file:
21
+
22
+ ```bash
23
+ mastra connect add github
24
+ ```
25
+
26
+ Then pass [`tools()`](https://mastra.ai/reference/connect/tools) to the agent and select the provider:
27
+
28
+ ```typescript
29
+ import { Agent } from '@mastra/core/agent'
30
+ import { tools } from '@mastra/connect'
31
+
32
+ export const githubAgent = new Agent({
33
+ id: 'github-agent',
34
+ name: 'GitHub agent',
35
+ instructions:
36
+ 'You help people search code and repositories, manage issues, pull requests, branches, files, and releases, and inspect and rerun workflow runs in GitHub.',
37
+ model: '__GATEWAY_OPENAI_MODEL_LUNA__',
38
+ tools: tools({ providers: ['github'] }),
39
+ })
40
+ ```
41
+
42
+ The agent gets 49 GitHub tools, with keys such as `github_add_issue_comment`. See [GitHub tools](https://mastra.ai/reference/connect/providers) for the full list, and the [`tools()` parameters](https://mastra.ai/reference/connect/tools) to restrict tools or require approval before a call runs.
43
+
44
+ ## Pull request signals
45
+
46
+ The `@mastra/github-signals` provider polls subscribed PRs and sends [notification signals](https://mastra.ai/docs/signals/notifications) to the agent thread when relevant activity occurs. It runs on your own infrastructure and uses the GitHub CLI for access instead of a Connect connection.
47
+
48
+ ### Installation
10
49
 
11
50
  Install GitHub Signals and the memory packages used in this example:
12
51
 
@@ -34,7 +73,7 @@ yarn add @mastra/github-signals @mastra/libsql @mastra/memory
34
73
  bun add @mastra/github-signals @mastra/libsql @mastra/memory
35
74
  ```
36
75
 
37
- ## Prerequisites
76
+ ### Prerequisites
38
77
 
39
78
  GitHub Signals requires:
40
79
 
@@ -45,11 +84,11 @@ GitHub Signals requires:
45
84
 
46
85
  By default, comments from users with `admin`, `maintain`, or `write` access can trigger notifications. CodeRabbit and Devin bot comments are explicitly allowed.
47
86
 
48
- Bot authorization checks `ignoredBots` first, using an exact case-insensitive login match. Other bots can trigger notifications when they appear in `authorizedBots`, when the GitHub App is owned by a user whose repository permission appears in `authorizedPermissions`, or when the app is owned by the organization that owns the repository. The default authorized permissions are `admin`, `maintain`, and `write`.
87
+ Bot authorization checks `ignoredBots` first, using an exact case-insensitive login match. Other bots can trigger notifications when they're listed in `authorizedBots`, when the GitHub App is owned by a user whose repository permission is listed in `authorizedPermissions`, or when the app is owned by the organization that owns the repository. The default authorized permissions are `admin`, `maintain`, and `write`.
49
88
 
50
- Failed, inaccessible, malformed, and unsupported app-owner lookups deny the bot comment. Successful app-owner lookups are cached for 24 hours; failed lookups aren't cached.
89
+ Failed, inaccessible, malformed, and unsupported app-owner lookups deny the bot comment. Successful app-owner lookups are cached for 24 hours. Failed lookups aren't cached.
51
90
 
52
- ## Agent and subscription
91
+ ### Agent and subscription
53
92
 
54
93
  Create one `GithubSignals` instance and register it on the agent. Register the agent and a storage adapter on the Mastra instance:
55
94
 
@@ -99,35 +138,35 @@ The provider syncs the PR immediately, stores the subscription, and starts polli
99
138
 
100
139
  A thread has one current GitHub Signals subscription. Subscribing it to another PR replaces the existing subscription.
101
140
 
102
- ## Subscription modes
141
+ ### Subscription modes
103
142
 
104
143
  GitHub Signals supports two subscription modes:
105
144
 
106
145
  - `review`: Follows new head revisions, authorized latest PR comments, and observable review-thread-state changes, including when all review threads become resolved.
107
- - `working`: Follows all actionable PR activity detected by the provider. Comment-bearing notifications remain subject to existing authorization gates. This is the default when `mode` is omitted and for stored subscriptions without a valid mode.
146
+ - `working`: Follows all PR activity that can trigger a notification detected by the provider. Comment-bearing notifications remain subject to existing authorization gates. This is the default when `mode` is omitted and for stored subscriptions without a valid mode.
108
147
 
109
148
  The following table shows the observable behavior of each mode:
110
149
 
111
- | Pull request activity | `working` | `review` |
112
- | ----------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
113
- | First observation | Sends a baseline notification | Saves all cursors without notifying unless the PR is closed or merged; then notifies and removes the subscription |
114
- | New commit or force-push | Notifies when the latest comment author is authorized | Notifies without requiring a comment author |
115
- | New authorized latest PR comment | Notifies | Notifies |
116
- | Observable review-thread-state change | Notifies while unresolved threads remain | Notifies, including when all review threads become resolved |
117
- | Continuous integration checks start, fail, or recover | Notifies | Saves the new state without notifying |
118
- | Merge conflicts appear or resolve | Notifies | Saves the new state without notifying |
119
- | Other actionable aggregate PR activity | Notifies when applicable authorization checks pass | Saves the new state without notifying |
120
- | PR closes without merging | Notifies and keeps the subscription | Notifies and removes the subscription |
121
- | PR reopens | Notifies | Doesn't notify because the earlier close removed the subscription |
122
- | PR merges | Notifies and removes the subscription | Notifies and removes the subscription |
123
-
124
- Review mode uses the latest generic PR comment exposed by `gitcrawl`. The snapshot doesn't distinguish general PR conversation from inline review comments. Comment notifications require an authorized author because they include comment content. Review-state notifications contain only provider-generated state summaries and aren't author-gated.
150
+ | Pull request activity | `working` | `review` |
151
+ | ----------------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
152
+ | First observation | Sends a baseline notification | Saves all cursors without notifying unless the PR is closed or merged; then notifies and removes the subscription |
153
+ | New commit or force-push | Notifies when the latest comment author is authorized | Notifies without requiring a comment author |
154
+ | New authorized latest PR comment | Notifies | Notifies |
155
+ | Observable review-thread-state change | Notifies while unresolved threads remain | Notifies, including when all review threads become resolved |
156
+ | Continuous integration checks start, fail, or recover | Notifies | Saves the new state without notifying |
157
+ | Merge conflicts appear or resolve | Notifies | Saves the new state without notifying |
158
+ | Other aggregate PR activity that can trigger a notification | Notifies when applicable authorization checks pass | Saves the new state without notifying |
159
+ | PR closes without merging | Notifies and keeps the subscription | Notifies and removes the subscription |
160
+ | PR reopens | Notifies | Doesn't notify because the earlier close removed the subscription |
161
+ | PR merges | Notifies and removes the subscription | Notifies and removes the subscription |
162
+
163
+ Review mode uses the latest generic PR comment exposed by `gitcrawl`, and the snapshot doesn't distinguish general PR conversation from inline review comments. Comment notifications require an authorized author because they include comment content. Review-state notifications contain only provider-generated state summaries and aren't author-gated.
125
164
 
126
165
  The review-state cursor includes the unresolved thread count and the latest unresolved thread timestamp. It reports when the count reaches zero, but it can't report replies on threads that are already resolved.
127
166
 
128
167
  During subscription, a PR already known to be closed or merged isn't stored and doesn't send an activity notification. Otherwise, review mode silently saves its first available non-terminal snapshot, including when the subscribe-time snapshot fails and a later poll supplies the first observation. If the first available poll snapshot or a later snapshot is closed or merged, the provider sends a terminal notification and removes the subscription. It doesn't follow a later reopen unless you subscribe again.
129
168
 
130
- ## Subscription tools
169
+ ### Subscription tools
131
170
 
132
171
  The provider adds `github_subscribe_pr` and `github_unsubscribe_pr` tools to the agent. Pass `mode` when subscribing:
133
172
 
@@ -142,7 +181,7 @@ The provider adds `github_subscribe_pr` and `github_unsubscribe_pr` tools to the
142
181
 
143
182
  Omitting `mode` selects `working`. Don't subscribe for a one-off PR inspection.
144
183
 
145
- ## MastraCode commands
184
+ ### MastraCode commands
146
185
 
147
186
  In MastraCode, use the spaced `--mode` flag with a PR number, `owner/repo#number`, or full GitHub PR URL:
148
187
 
@@ -243,6 +243,52 @@ const thread = await memoryStore?.getThreadById({ threadId: '...' })
243
243
 
244
244
  > **Warning:** If `init()` isn't called, tables won't be created and storage operations will fail silently or throw errors.
245
245
 
246
+ ### Managed PostgreSQL and connection poolers
247
+
248
+ `PostgresStore` connects to managed PostgreSQL providers with the connection string they give you. No provider-specific package is required.
249
+
250
+ `init()` runs all schema changes on a single connection, so it works through transaction-mode connection poolers such as PgBouncer. You can use the provider's pooled connection string and let Mastra create the schema on startup.
251
+
252
+ #### Separate schema initialization
253
+
254
+ If the runtime database role can't create tables or indexes, run `init()` once during deployment with a role that can:
255
+
256
+ ```typescript
257
+ import { PostgresStore } from '@mastra/pg'
258
+
259
+ const storage = new PostgresStore({
260
+ id: 'pg-storage-init',
261
+ connectionString: process.env.DATABASE_ADMIN_URL,
262
+ })
263
+
264
+ try {
265
+ await storage.init()
266
+ // Only needed if the application uses Knowledge
267
+ await storage.initKnowledge()
268
+ } finally {
269
+ await storage.close()
270
+ }
271
+ ```
272
+
273
+ The runtime role needs read and write access to the tables this script creates. See [PostgreSQL privileges](https://www.postgresql.org/docs/current/ddl-priv.html).
274
+
275
+ Then set `disableInit: true` on the runtime store so it skips schema creation:
276
+
277
+ ```typescript
278
+ import { Mastra } from '@mastra/core'
279
+ import { PostgresStore } from '@mastra/pg'
280
+
281
+ export const mastra = new Mastra({
282
+ storage: new PostgresStore({
283
+ id: 'pg-storage',
284
+ connectionString: process.env.DATABASE_URL,
285
+ disableInit: true,
286
+ }),
287
+ })
288
+ ```
289
+
290
+ `disableInit: true` also makes explicit `init()` calls a no-op, so leave it off the store in the deployment script.
291
+
246
292
  ### Using an Existing Pool
247
293
 
248
294
  If you already have a `pg.Pool` in your application (e.g., shared with an ORM or for Row Level Security), you can pass it directly to `PostgresStore`:
@@ -49,7 +49,7 @@ export const agent = new Agent({
49
49
 
50
50
  **options.retainFullInput** (`boolean`): When true, the request input is processed exactly as supplied instead of being filtered against stored history. Use this when you assemble the input yourself and need the message sequence preserved. Stored history is still loaded underneath, and every input message that isn't already stored is saved to the thread, including few-shot examples. Can be set per call on memory.options or agent-wide in the memory constructor options.
51
51
 
52
- **options.semanticRecall** (`boolean | { topK: number; messageRange: number | { before: number; after: number }; scope?: 'thread' | 'resource' }`): Enable semantic search in message history. Can be a boolean or an object with configuration options. When enabled, requires a vector store, and an embedder unless the vector store embeds text itself (isSelfEmbedding). Default topK is 4, default messageRange is {before: 1, after: 1}.
52
+ **options.semanticRecall** (`boolean | { topK: number; messageRange: number | { before: number; after: number }; scope?: 'thread' | 'resource'; maxChunkChars?: number }`): Enable semantic search in message history. Can be a boolean or an object with configuration options. When enabled, requires a vector store, and an embedder unless the vector store embeds text itself (isSelfEmbedding). Default topK is 4, default messageRange is {before: 1, after: 1}. maxChunkChars caps the characters of message text per embedded chunk; see Long messages.
53
53
 
54
54
  **options.workingMemory** (`WorkingMemory`): Configuration for working memory feature. Can be { enabled: boolean; template?: string; schema?: ZodObject\<any> | JSONSchema7; scope?: 'thread' | 'resource' } or { enabled: boolean } to disable.
55
55
 
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_src = require("./src-BbbBzTaj.cjs");
2
+ const require_src = require("./src-DrWCcSnW.cjs");
3
3
  let _mastra_core_processors = require("@mastra/core/processors");
4
4
  exports.AUTO_MODEL_BY_PROVIDER = require_src.AUTO_MODEL_BY_PROVIDER;
5
5
  exports.Extractor = require_src.Extractor;