@mastra/libsql 0.0.0-knowledge-org-scope-20260902233451 → 0.0.0-knowledge-w1-20261006001735
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/_types/@internal_core/dist/knowledge-compat/index.d.ts +533 -0
- package/dist/_types/@internal_core/package.json +1 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/docs-agents-human-in-the-loop.md +42 -1
- package/dist/docs/references/docs-deployment-workers.md +13 -3
- package/dist/docs/references/docs-memory-memory-processors.md +7 -1
- package/dist/docs/references/docs-memory-message-history.md +68 -4
- package/dist/docs/references/docs-memory-multi-user-threads.md +1 -1
- package/dist/docs/references/docs-memory-overview.md +6 -6
- package/dist/docs/references/docs-memory-semantic-recall.md +35 -1
- package/dist/docs/references/docs-storage.md +2 -0
- package/dist/docs/references/integrations-channels-github.md +6 -2
- package/dist/docs/references/reference-core-mastra-class.md +3 -1
- package/dist/docs/references/reference-file-based-agents-memory.md +0 -2
- package/dist/docs/references/reference-file-based-agents-storage.md +0 -2
- package/dist/docs/references/reference-memory-memory-class.md +7 -2
- package/dist/docs/references/reference-storage-retention.md +64 -10
- package/dist/index.cjs +1944 -676
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1945 -677
- package/dist/index.js.map +1 -1
- package/dist/shared/single-connection-client.d.ts +29 -0
- package/dist/shared/single-connection-client.d.ts.map +1 -0
- package/dist/storage/db/index.d.ts +7 -4
- package/dist/storage/db/index.d.ts.map +1 -1
- package/dist/storage/db/write-lock.d.ts.map +1 -1
- package/dist/storage/domains/background-tasks/index.d.ts +2 -4
- package/dist/storage/domains/background-tasks/index.d.ts.map +1 -1
- package/dist/storage/domains/datasets/index.d.ts +2 -1
- package/dist/storage/domains/datasets/index.d.ts.map +1 -1
- package/dist/storage/domains/experiments/index.d.ts.map +1 -1
- package/dist/storage/domains/knowledge/index.d.ts +23 -1
- package/dist/storage/domains/knowledge/index.d.ts.map +1 -1
- package/dist/storage/domains/memory/index.d.ts +15 -2
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/dist/storage/domains/notifications/index.d.ts +6 -1
- package/dist/storage/domains/notifications/index.d.ts.map +1 -1
- package/dist/storage/domains/observability/index.d.ts.map +1 -1
- package/dist/storage/domains/schedules/index.d.ts +2 -2
- package/dist/storage/domains/schedules/index.d.ts.map +1 -1
- package/dist/storage/domains/skills/index.d.ts.map +1 -1
- package/dist/storage/domains/workflows/index.d.ts +1 -1
- package/dist/storage/domains/workflows/index.d.ts.map +1 -1
- package/dist/storage/factory-storage.d.ts.map +1 -1
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/retention.d.ts +5 -56
- package/dist/storage/retention.d.ts.map +1 -1
- package/dist/vector/index.d.ts.map +1 -1
- package/package.json +13 -11
|
@@ -0,0 +1,533 @@
|
|
|
1
|
+
//#region src/knowledge-compat/index.d.ts
|
|
2
|
+
declare const KNOWLEDGE_V2_CORE_FEATURE = "knowledge-v2";
|
|
3
|
+
declare const KNOWLEDGE_V2_MINIMUM_CORE_VERSION = "1.65.0-0";
|
|
4
|
+
declare const KNOWLEDGE_STORAGE_CONTRACT_VERSION: 2;
|
|
5
|
+
declare const KNOWLEDGE_STORAGE_SCHEMA_VERSION: 2;
|
|
6
|
+
/** Hard cap on scope nodes returned by one `listScopeNodes` read. */
|
|
7
|
+
declare const MAX_KNOWLEDGE_SCOPE_NODES = 1000;
|
|
8
|
+
/** A reconciled structural scope node with its containing scope nodes. */
|
|
9
|
+
interface KnowledgeScopeNodeSummary {
|
|
10
|
+
/** UUID of the `isScope` node. */
|
|
11
|
+
id: string;
|
|
12
|
+
/** Canonical address the scope node was reconciled from (e.g. `features:memory`). */
|
|
13
|
+
address: string;
|
|
14
|
+
name: string;
|
|
15
|
+
kind?: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
/** UUIDs of the scope nodes that contain this scope (membership edges). */
|
|
18
|
+
parentIds: string[];
|
|
19
|
+
}
|
|
20
|
+
declare const TABLE_KNOWLEDGE_NODE_SCOPES = "mastra_knowledge_node_scopes";
|
|
21
|
+
declare const TABLE_KNOWLEDGE_RECORD_SCOPES = "mastra_knowledge_record_scopes";
|
|
22
|
+
declare const TABLE_KNOWLEDGE_SCOPE_GRANTS = "mastra_knowledge_scope_grants";
|
|
23
|
+
declare const TABLE_KNOWLEDGE_ACCESS_STATE = "mastra_knowledge_access_state";
|
|
24
|
+
declare const TABLE_KNOWLEDGE_SCOPE_ADDRESSES = "mastra_knowledge_scope_addresses";
|
|
25
|
+
declare const TABLE_KNOWLEDGE_NODE_ADDRESSES = "mastra_knowledge_node_addresses";
|
|
26
|
+
declare const TABLE_KNOWLEDGE_IMPORT_STATE = "mastra_knowledge_import_state";
|
|
27
|
+
declare const TABLE_KNOWLEDGE_IMPORT_RUNS = "mastra_knowledge_import_runs";
|
|
28
|
+
declare const TABLE_KNOWLEDGE_PROPOSALS = "mastra_knowledge_proposals";
|
|
29
|
+
declare const KNOWLEDGE_TABLE_NAMES: readonly ["mastra_knowledge_nodes", "mastra_knowledge_records", "mastra_knowledge_mentions", "mastra_knowledge_cursors", "mastra_knowledge_activity", "mastra_knowledge_semantic_outbox", "mastra_knowledge_node_scopes", "mastra_knowledge_record_scopes", "mastra_knowledge_scope_grants", "mastra_knowledge_access_state", "mastra_knowledge_scope_addresses", "mastra_knowledge_node_addresses", "mastra_knowledge_import_state", "mastra_knowledge_import_runs", "mastra_knowledge_proposals"];
|
|
30
|
+
declare const KNOWLEDGE_V2_NODES_SCHEMA: {
|
|
31
|
+
readonly id: {
|
|
32
|
+
readonly type: 'text';
|
|
33
|
+
readonly nullable: false;
|
|
34
|
+
readonly primaryKey: true;
|
|
35
|
+
};
|
|
36
|
+
readonly name: {
|
|
37
|
+
readonly type: 'text';
|
|
38
|
+
readonly nullable: false;
|
|
39
|
+
};
|
|
40
|
+
readonly kind: {
|
|
41
|
+
readonly type: 'text';
|
|
42
|
+
readonly nullable: true;
|
|
43
|
+
};
|
|
44
|
+
readonly isScope: {
|
|
45
|
+
readonly type: 'boolean';
|
|
46
|
+
readonly nullable: false;
|
|
47
|
+
};
|
|
48
|
+
readonly metadata: {
|
|
49
|
+
readonly type: 'jsonb';
|
|
50
|
+
readonly nullable: true;
|
|
51
|
+
};
|
|
52
|
+
readonly version: {
|
|
53
|
+
readonly type: 'integer';
|
|
54
|
+
readonly nullable: false;
|
|
55
|
+
};
|
|
56
|
+
readonly createdAt: {
|
|
57
|
+
readonly type: 'timestamp';
|
|
58
|
+
readonly nullable: false;
|
|
59
|
+
};
|
|
60
|
+
readonly updatedAt: {
|
|
61
|
+
readonly type: 'timestamp';
|
|
62
|
+
readonly nullable: false;
|
|
63
|
+
};
|
|
64
|
+
readonly deletedAt: {
|
|
65
|
+
readonly type: 'timestamp';
|
|
66
|
+
readonly nullable: true;
|
|
67
|
+
};
|
|
68
|
+
readonly deletedBy: {
|
|
69
|
+
readonly type: 'text';
|
|
70
|
+
readonly nullable: true;
|
|
71
|
+
};
|
|
72
|
+
readonly type: {
|
|
73
|
+
readonly type: 'text';
|
|
74
|
+
readonly nullable: true;
|
|
75
|
+
};
|
|
76
|
+
readonly canonicalName: {
|
|
77
|
+
readonly type: 'text';
|
|
78
|
+
readonly nullable: true;
|
|
79
|
+
};
|
|
80
|
+
readonly content: {
|
|
81
|
+
readonly type: 'text';
|
|
82
|
+
readonly nullable: true;
|
|
83
|
+
};
|
|
84
|
+
readonly description: {
|
|
85
|
+
readonly type: 'text';
|
|
86
|
+
readonly nullable: true;
|
|
87
|
+
};
|
|
88
|
+
readonly scope: {
|
|
89
|
+
readonly type: 'jsonb';
|
|
90
|
+
readonly nullable: true;
|
|
91
|
+
};
|
|
92
|
+
readonly scopeKey: {
|
|
93
|
+
readonly type: 'text';
|
|
94
|
+
readonly nullable: true;
|
|
95
|
+
};
|
|
96
|
+
readonly mergedInto: {
|
|
97
|
+
readonly type: 'text';
|
|
98
|
+
readonly nullable: true;
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
declare const KNOWLEDGE_V2_RECORDS_SCHEMA: {
|
|
102
|
+
readonly id: {
|
|
103
|
+
readonly type: 'text';
|
|
104
|
+
readonly nullable: false;
|
|
105
|
+
readonly primaryKey: true;
|
|
106
|
+
};
|
|
107
|
+
readonly nodeId: {
|
|
108
|
+
readonly type: 'text';
|
|
109
|
+
readonly nullable: false;
|
|
110
|
+
readonly references: {
|
|
111
|
+
readonly table: "mastra_knowledge_nodes";
|
|
112
|
+
readonly column: 'id';
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
readonly text: {
|
|
116
|
+
readonly type: 'text';
|
|
117
|
+
readonly nullable: false;
|
|
118
|
+
};
|
|
119
|
+
readonly metadata: {
|
|
120
|
+
readonly type: 'jsonb';
|
|
121
|
+
readonly nullable: true;
|
|
122
|
+
};
|
|
123
|
+
readonly source: {
|
|
124
|
+
readonly type: 'text';
|
|
125
|
+
readonly nullable: true;
|
|
126
|
+
};
|
|
127
|
+
readonly version: {
|
|
128
|
+
readonly type: 'integer';
|
|
129
|
+
readonly nullable: false;
|
|
130
|
+
};
|
|
131
|
+
readonly createdAt: {
|
|
132
|
+
readonly type: 'timestamp';
|
|
133
|
+
readonly nullable: false;
|
|
134
|
+
};
|
|
135
|
+
readonly updatedAt: {
|
|
136
|
+
readonly type: 'timestamp';
|
|
137
|
+
readonly nullable: false;
|
|
138
|
+
};
|
|
139
|
+
readonly deletedAt: {
|
|
140
|
+
readonly type: 'timestamp';
|
|
141
|
+
readonly nullable: true;
|
|
142
|
+
};
|
|
143
|
+
readonly deletedBy: {
|
|
144
|
+
readonly type: 'text';
|
|
145
|
+
readonly nullable: true;
|
|
146
|
+
};
|
|
147
|
+
readonly node: {
|
|
148
|
+
readonly type: 'text';
|
|
149
|
+
readonly nullable: true;
|
|
150
|
+
};
|
|
151
|
+
readonly scope: {
|
|
152
|
+
readonly type: 'jsonb';
|
|
153
|
+
readonly nullable: true;
|
|
154
|
+
};
|
|
155
|
+
readonly scopeKey: {
|
|
156
|
+
readonly type: 'text';
|
|
157
|
+
readonly nullable: true;
|
|
158
|
+
};
|
|
159
|
+
readonly sourceThreadId: {
|
|
160
|
+
readonly type: 'text';
|
|
161
|
+
readonly nullable: true;
|
|
162
|
+
};
|
|
163
|
+
readonly capturedAt: {
|
|
164
|
+
readonly type: 'timestamp';
|
|
165
|
+
readonly nullable: true;
|
|
166
|
+
};
|
|
167
|
+
readonly when: {
|
|
168
|
+
readonly type: 'timestamp';
|
|
169
|
+
readonly nullable: true;
|
|
170
|
+
};
|
|
171
|
+
readonly maxScope: {
|
|
172
|
+
readonly type: 'text';
|
|
173
|
+
readonly nullable: true;
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
declare const KNOWLEDGE_V2_MENTIONS_SCHEMA: {
|
|
177
|
+
readonly recordId: {
|
|
178
|
+
readonly type: 'text';
|
|
179
|
+
readonly nullable: false;
|
|
180
|
+
readonly references: {
|
|
181
|
+
readonly table: "mastra_knowledge_records";
|
|
182
|
+
readonly column: 'id';
|
|
183
|
+
};
|
|
184
|
+
};
|
|
185
|
+
readonly targetNodeId: {
|
|
186
|
+
readonly type: 'text';
|
|
187
|
+
readonly nullable: true;
|
|
188
|
+
readonly references: {
|
|
189
|
+
readonly table: "mastra_knowledge_nodes";
|
|
190
|
+
readonly column: 'id';
|
|
191
|
+
};
|
|
192
|
+
};
|
|
193
|
+
readonly sourceType: {
|
|
194
|
+
readonly type: 'text';
|
|
195
|
+
readonly nullable: true;
|
|
196
|
+
};
|
|
197
|
+
readonly sourceId: {
|
|
198
|
+
readonly type: 'text';
|
|
199
|
+
readonly nullable: true;
|
|
200
|
+
};
|
|
201
|
+
};
|
|
202
|
+
declare const KNOWLEDGE_NODE_SCOPES_SCHEMA: {
|
|
203
|
+
readonly nodeId: {
|
|
204
|
+
readonly type: 'text';
|
|
205
|
+
readonly nullable: false;
|
|
206
|
+
readonly references: {
|
|
207
|
+
readonly table: "mastra_knowledge_nodes";
|
|
208
|
+
readonly column: 'id';
|
|
209
|
+
};
|
|
210
|
+
};
|
|
211
|
+
readonly scopeNodeId: {
|
|
212
|
+
readonly type: 'text';
|
|
213
|
+
readonly nullable: false;
|
|
214
|
+
readonly references: {
|
|
215
|
+
readonly table: "mastra_knowledge_nodes";
|
|
216
|
+
readonly column: 'id';
|
|
217
|
+
};
|
|
218
|
+
};
|
|
219
|
+
readonly addedAt: {
|
|
220
|
+
readonly type: 'timestamp';
|
|
221
|
+
readonly nullable: false;
|
|
222
|
+
};
|
|
223
|
+
};
|
|
224
|
+
declare const KNOWLEDGE_RECORD_SCOPES_SCHEMA: {
|
|
225
|
+
readonly recordId: {
|
|
226
|
+
readonly type: 'text';
|
|
227
|
+
readonly nullable: false;
|
|
228
|
+
readonly references: {
|
|
229
|
+
readonly table: "mastra_knowledge_records";
|
|
230
|
+
readonly column: 'id';
|
|
231
|
+
};
|
|
232
|
+
};
|
|
233
|
+
readonly scopeNodeId: {
|
|
234
|
+
readonly type: 'text';
|
|
235
|
+
readonly nullable: false;
|
|
236
|
+
readonly references: {
|
|
237
|
+
readonly table: "mastra_knowledge_nodes";
|
|
238
|
+
readonly column: 'id';
|
|
239
|
+
};
|
|
240
|
+
};
|
|
241
|
+
readonly addedAt: {
|
|
242
|
+
readonly type: 'timestamp';
|
|
243
|
+
readonly nullable: false;
|
|
244
|
+
};
|
|
245
|
+
};
|
|
246
|
+
declare const KNOWLEDGE_SCOPE_GRANTS_SCHEMA: {
|
|
247
|
+
readonly scopeNodeId: {
|
|
248
|
+
readonly type: 'text';
|
|
249
|
+
readonly nullable: false;
|
|
250
|
+
readonly references: {
|
|
251
|
+
readonly table: "mastra_knowledge_nodes";
|
|
252
|
+
readonly column: 'id';
|
|
253
|
+
};
|
|
254
|
+
};
|
|
255
|
+
readonly scopeRefId: {
|
|
256
|
+
readonly type: 'text';
|
|
257
|
+
readonly nullable: false;
|
|
258
|
+
readonly references: {
|
|
259
|
+
readonly table: "mastra_knowledge_nodes";
|
|
260
|
+
readonly column: 'id';
|
|
261
|
+
};
|
|
262
|
+
};
|
|
263
|
+
readonly role: {
|
|
264
|
+
readonly type: 'text';
|
|
265
|
+
readonly nullable: false;
|
|
266
|
+
};
|
|
267
|
+
readonly canSuggest: {
|
|
268
|
+
readonly type: 'boolean';
|
|
269
|
+
readonly nullable: true;
|
|
270
|
+
};
|
|
271
|
+
};
|
|
272
|
+
declare const KNOWLEDGE_ACCESS_STATE_SCHEMA: {
|
|
273
|
+
readonly id: {
|
|
274
|
+
readonly type: 'text';
|
|
275
|
+
readonly nullable: false;
|
|
276
|
+
readonly primaryKey: true;
|
|
277
|
+
};
|
|
278
|
+
readonly epoch: {
|
|
279
|
+
readonly type: 'integer';
|
|
280
|
+
readonly nullable: false;
|
|
281
|
+
};
|
|
282
|
+
readonly schemaVersion: {
|
|
283
|
+
readonly type: 'integer';
|
|
284
|
+
readonly nullable: false;
|
|
285
|
+
};
|
|
286
|
+
};
|
|
287
|
+
declare const KNOWLEDGE_SCOPE_ADDRESSES_SCHEMA: {
|
|
288
|
+
readonly address: {
|
|
289
|
+
readonly type: 'text';
|
|
290
|
+
readonly nullable: false;
|
|
291
|
+
readonly primaryKey: true;
|
|
292
|
+
};
|
|
293
|
+
readonly scopeNodeId: {
|
|
294
|
+
readonly type: 'text';
|
|
295
|
+
readonly nullable: false;
|
|
296
|
+
readonly references: {
|
|
297
|
+
readonly table: "mastra_knowledge_nodes";
|
|
298
|
+
readonly column: 'id';
|
|
299
|
+
};
|
|
300
|
+
};
|
|
301
|
+
};
|
|
302
|
+
declare const KNOWLEDGE_NODE_ADDRESSES_SCHEMA: {
|
|
303
|
+
readonly source: {
|
|
304
|
+
readonly type: 'text';
|
|
305
|
+
readonly nullable: false;
|
|
306
|
+
};
|
|
307
|
+
readonly address: {
|
|
308
|
+
readonly type: 'text';
|
|
309
|
+
readonly nullable: false;
|
|
310
|
+
};
|
|
311
|
+
readonly nodeId: {
|
|
312
|
+
readonly type: 'text';
|
|
313
|
+
readonly nullable: false;
|
|
314
|
+
readonly references: {
|
|
315
|
+
readonly table: "mastra_knowledge_nodes";
|
|
316
|
+
readonly column: 'id';
|
|
317
|
+
};
|
|
318
|
+
};
|
|
319
|
+
};
|
|
320
|
+
declare const KNOWLEDGE_IMPORT_STATE_SCHEMA: {
|
|
321
|
+
readonly importerId: {
|
|
322
|
+
readonly type: 'text';
|
|
323
|
+
readonly nullable: false;
|
|
324
|
+
};
|
|
325
|
+
readonly binding: {
|
|
326
|
+
readonly type: 'text';
|
|
327
|
+
readonly nullable: false;
|
|
328
|
+
};
|
|
329
|
+
readonly key: {
|
|
330
|
+
readonly type: 'text';
|
|
331
|
+
readonly nullable: false;
|
|
332
|
+
};
|
|
333
|
+
readonly value: {
|
|
334
|
+
readonly type: 'text';
|
|
335
|
+
readonly nullable: false;
|
|
336
|
+
};
|
|
337
|
+
};
|
|
338
|
+
declare const KNOWLEDGE_IMPORT_RUNS_SCHEMA: {
|
|
339
|
+
readonly id: {
|
|
340
|
+
readonly type: 'text';
|
|
341
|
+
readonly nullable: false;
|
|
342
|
+
readonly primaryKey: true;
|
|
343
|
+
};
|
|
344
|
+
readonly importerId: {
|
|
345
|
+
readonly type: 'text';
|
|
346
|
+
readonly nullable: false;
|
|
347
|
+
};
|
|
348
|
+
readonly binding: {
|
|
349
|
+
readonly type: 'text';
|
|
350
|
+
readonly nullable: false;
|
|
351
|
+
};
|
|
352
|
+
readonly importKind: {
|
|
353
|
+
readonly type: 'text';
|
|
354
|
+
readonly nullable: false;
|
|
355
|
+
};
|
|
356
|
+
readonly triggerKind: {
|
|
357
|
+
readonly type: 'text';
|
|
358
|
+
readonly nullable: false;
|
|
359
|
+
};
|
|
360
|
+
readonly status: {
|
|
361
|
+
readonly type: 'text';
|
|
362
|
+
readonly nullable: false;
|
|
363
|
+
};
|
|
364
|
+
readonly error: {
|
|
365
|
+
readonly type: 'text';
|
|
366
|
+
readonly nullable: true;
|
|
367
|
+
};
|
|
368
|
+
readonly transcriptThreadId: {
|
|
369
|
+
readonly type: 'text';
|
|
370
|
+
readonly nullable: true;
|
|
371
|
+
};
|
|
372
|
+
readonly traceId: {
|
|
373
|
+
readonly type: 'text';
|
|
374
|
+
readonly nullable: true;
|
|
375
|
+
};
|
|
376
|
+
readonly queuedAt: {
|
|
377
|
+
readonly type: 'timestamp';
|
|
378
|
+
readonly nullable: false;
|
|
379
|
+
};
|
|
380
|
+
readonly startedAt: {
|
|
381
|
+
readonly type: 'timestamp';
|
|
382
|
+
readonly nullable: true;
|
|
383
|
+
};
|
|
384
|
+
readonly completedAt: {
|
|
385
|
+
readonly type: 'timestamp';
|
|
386
|
+
readonly nullable: true;
|
|
387
|
+
};
|
|
388
|
+
};
|
|
389
|
+
declare const KNOWLEDGE_V2_ACTIVITY_SCHEMA: {
|
|
390
|
+
readonly id: {
|
|
391
|
+
readonly type: 'text';
|
|
392
|
+
readonly nullable: false;
|
|
393
|
+
readonly primaryKey: true;
|
|
394
|
+
};
|
|
395
|
+
readonly action: {
|
|
396
|
+
readonly type: 'text';
|
|
397
|
+
readonly nullable: false;
|
|
398
|
+
};
|
|
399
|
+
readonly targetType: {
|
|
400
|
+
readonly type: 'text';
|
|
401
|
+
readonly nullable: true;
|
|
402
|
+
};
|
|
403
|
+
readonly targetId: {
|
|
404
|
+
readonly type: 'text';
|
|
405
|
+
readonly nullable: true;
|
|
406
|
+
};
|
|
407
|
+
readonly contextScopeId: {
|
|
408
|
+
readonly type: 'text';
|
|
409
|
+
readonly nullable: true;
|
|
410
|
+
readonly references: {
|
|
411
|
+
readonly table: "mastra_knowledge_nodes";
|
|
412
|
+
readonly column: 'id';
|
|
413
|
+
};
|
|
414
|
+
};
|
|
415
|
+
readonly importRunId: {
|
|
416
|
+
readonly type: 'text';
|
|
417
|
+
readonly nullable: true;
|
|
418
|
+
readonly references: {
|
|
419
|
+
readonly table: "mastra_knowledge_import_runs";
|
|
420
|
+
readonly column: 'id';
|
|
421
|
+
};
|
|
422
|
+
};
|
|
423
|
+
readonly details: {
|
|
424
|
+
readonly type: 'jsonb';
|
|
425
|
+
readonly nullable: true;
|
|
426
|
+
};
|
|
427
|
+
readonly createdAt: {
|
|
428
|
+
readonly type: 'timestamp';
|
|
429
|
+
readonly nullable: false;
|
|
430
|
+
};
|
|
431
|
+
readonly recordType: {
|
|
432
|
+
readonly type: 'text';
|
|
433
|
+
readonly nullable: true;
|
|
434
|
+
};
|
|
435
|
+
readonly recordId: {
|
|
436
|
+
readonly type: 'text';
|
|
437
|
+
readonly nullable: true;
|
|
438
|
+
};
|
|
439
|
+
readonly scope: {
|
|
440
|
+
readonly type: 'jsonb';
|
|
441
|
+
readonly nullable: true;
|
|
442
|
+
};
|
|
443
|
+
readonly scopeKey: {
|
|
444
|
+
readonly type: 'text';
|
|
445
|
+
readonly nullable: true;
|
|
446
|
+
};
|
|
447
|
+
readonly sourceThreadId: {
|
|
448
|
+
readonly type: 'text';
|
|
449
|
+
readonly nullable: true;
|
|
450
|
+
};
|
|
451
|
+
};
|
|
452
|
+
declare const KNOWLEDGE_PROPOSALS_SCHEMA: {
|
|
453
|
+
readonly id: {
|
|
454
|
+
readonly type: 'text';
|
|
455
|
+
readonly nullable: false;
|
|
456
|
+
readonly primaryKey: true;
|
|
457
|
+
};
|
|
458
|
+
readonly targetType: {
|
|
459
|
+
readonly type: 'text';
|
|
460
|
+
readonly nullable: false;
|
|
461
|
+
};
|
|
462
|
+
readonly targetId: {
|
|
463
|
+
readonly type: 'text';
|
|
464
|
+
readonly nullable: false;
|
|
465
|
+
};
|
|
466
|
+
readonly action: {
|
|
467
|
+
readonly type: 'text';
|
|
468
|
+
readonly nullable: false;
|
|
469
|
+
};
|
|
470
|
+
readonly changes: {
|
|
471
|
+
readonly type: 'jsonb';
|
|
472
|
+
readonly nullable: false;
|
|
473
|
+
};
|
|
474
|
+
readonly reason: {
|
|
475
|
+
readonly type: 'text';
|
|
476
|
+
readonly nullable: true;
|
|
477
|
+
};
|
|
478
|
+
readonly proposerContextScopeId: {
|
|
479
|
+
readonly type: 'text';
|
|
480
|
+
readonly nullable: false;
|
|
481
|
+
};
|
|
482
|
+
readonly expectedVersion: {
|
|
483
|
+
readonly type: 'integer';
|
|
484
|
+
readonly nullable: false;
|
|
485
|
+
};
|
|
486
|
+
readonly status: {
|
|
487
|
+
readonly type: 'text';
|
|
488
|
+
readonly nullable: false;
|
|
489
|
+
};
|
|
490
|
+
readonly reviewerContextScopeId: {
|
|
491
|
+
readonly type: 'text';
|
|
492
|
+
readonly nullable: true;
|
|
493
|
+
};
|
|
494
|
+
readonly reviewedAt: {
|
|
495
|
+
readonly type: 'timestamp';
|
|
496
|
+
readonly nullable: true;
|
|
497
|
+
};
|
|
498
|
+
readonly createdAt: {
|
|
499
|
+
readonly type: 'timestamp';
|
|
500
|
+
readonly nullable: false;
|
|
501
|
+
};
|
|
502
|
+
};
|
|
503
|
+
type KnowledgeSchemaInspection = {
|
|
504
|
+
status: 'compatible';
|
|
505
|
+
schemaVersion: typeof KNOWLEDGE_STORAGE_SCHEMA_VERSION;
|
|
506
|
+
} | {
|
|
507
|
+
status: 'uninitialized';
|
|
508
|
+
schemaVersion: null;
|
|
509
|
+
} | {
|
|
510
|
+
status: 'incompatible-reset-required';
|
|
511
|
+
schemaVersion: number | null;
|
|
512
|
+
reason: string;
|
|
513
|
+
} | {
|
|
514
|
+
status: 'unavailable';
|
|
515
|
+
schemaVersion: null;
|
|
516
|
+
reason: string;
|
|
517
|
+
};
|
|
518
|
+
interface KnowledgeSchemaSnapshot {
|
|
519
|
+
available: boolean;
|
|
520
|
+
tableNames: readonly string[];
|
|
521
|
+
schemaVersion?: number;
|
|
522
|
+
reason?: string;
|
|
523
|
+
}
|
|
524
|
+
interface KnowledgeV2Core {
|
|
525
|
+
assertKnowledgeDescriptionWithinBound(description: string | undefined): void;
|
|
526
|
+
assertKnowledgeSchemaCompatible(inspection: KnowledgeSchemaInspection): void;
|
|
527
|
+
inspectKnowledgeSchema(snapshot: KnowledgeSchemaSnapshot): KnowledgeSchemaInspection;
|
|
528
|
+
}
|
|
529
|
+
declare function assertKnowledgeV2CoreSupport(features: ReadonlySet<string>): void;
|
|
530
|
+
declare function createKnowledgeV2CoreLoader(features: ReadonlySet<string>, loadStorageModule: () => Promise<unknown>): () => Promise<KnowledgeV2Core>;
|
|
531
|
+
//#endregion
|
|
532
|
+
export { KNOWLEDGE_ACCESS_STATE_SCHEMA, KNOWLEDGE_IMPORT_RUNS_SCHEMA, KNOWLEDGE_IMPORT_STATE_SCHEMA, KNOWLEDGE_NODE_ADDRESSES_SCHEMA, KNOWLEDGE_NODE_SCOPES_SCHEMA, KNOWLEDGE_PROPOSALS_SCHEMA, KNOWLEDGE_RECORD_SCOPES_SCHEMA, KNOWLEDGE_SCOPE_ADDRESSES_SCHEMA, KNOWLEDGE_SCOPE_GRANTS_SCHEMA, KNOWLEDGE_STORAGE_CONTRACT_VERSION, KNOWLEDGE_STORAGE_SCHEMA_VERSION, KNOWLEDGE_TABLE_NAMES, KNOWLEDGE_V2_ACTIVITY_SCHEMA, KNOWLEDGE_V2_CORE_FEATURE, KNOWLEDGE_V2_MENTIONS_SCHEMA, KNOWLEDGE_V2_MINIMUM_CORE_VERSION, KNOWLEDGE_V2_NODES_SCHEMA, KNOWLEDGE_V2_RECORDS_SCHEMA, KnowledgeSchemaInspection, KnowledgeSchemaSnapshot, KnowledgeScopeNodeSummary, MAX_KNOWLEDGE_SCOPE_NODES, TABLE_KNOWLEDGE_ACCESS_STATE, TABLE_KNOWLEDGE_IMPORT_RUNS, TABLE_KNOWLEDGE_IMPORT_STATE, TABLE_KNOWLEDGE_NODE_ADDRESSES, TABLE_KNOWLEDGE_NODE_SCOPES, TABLE_KNOWLEDGE_PROPOSALS, TABLE_KNOWLEDGE_RECORD_SCOPES, TABLE_KNOWLEDGE_SCOPE_ADDRESSES, TABLE_KNOWLEDGE_SCOPE_GRANTS, assertKnowledgeV2CoreSupport, createKnowledgeV2CoreLoader };
|
|
533
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
package/dist/docs/SKILL.md
CHANGED
|
@@ -3,7 +3,7 @@ name: mastra-libsql
|
|
|
3
3
|
description: Documentation for @mastra/libsql. Use when working with @mastra/libsql APIs, configuration, or implementation.
|
|
4
4
|
metadata:
|
|
5
5
|
package: "@mastra/libsql"
|
|
6
|
-
version: "0.0.0-knowledge-
|
|
6
|
+
version: "0.0.0-knowledge-w1-20261006001735"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## When to use
|
|
@@ -116,7 +116,44 @@ const stream = await agent.stream('Clean up old records', {
|
|
|
116
116
|
})
|
|
117
117
|
```
|
|
118
118
|
|
|
119
|
-
|
|
119
|
+
The function can be asynchronous. For decisions that depend on the tool name and arguments, use a [classifier](https://mastra.ai/reference/classifier/classifier) to estimate whether the call needs human review:
|
|
120
|
+
|
|
121
|
+
```typescript
|
|
122
|
+
import { Classifier } from '@mastra/core/classifier'
|
|
123
|
+
import { typeSafeAi } from '@ai-sdk/typesafe-ai'
|
|
124
|
+
import { agent } from './agent'
|
|
125
|
+
|
|
126
|
+
const approvalClassifier = new Classifier({
|
|
127
|
+
id: 'tool-approval-classifier',
|
|
128
|
+
model: typeSafeAi.evaluationModel('jev-latest'),
|
|
129
|
+
questions: {
|
|
130
|
+
requiresApproval: {
|
|
131
|
+
type: 'boolean',
|
|
132
|
+
instructions:
|
|
133
|
+
'Does this tool call need human approval because it is destructive, irreversible, expensive, or handles sensitive data?',
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
const stream = await agent.stream('Clean up old records', {
|
|
139
|
+
requireToolApproval: async ({ toolName, args }) => {
|
|
140
|
+
const result = await approvalClassifier.evaluate({
|
|
141
|
+
state: {
|
|
142
|
+
toolName,
|
|
143
|
+
argumentNames: Object.keys(args),
|
|
144
|
+
},
|
|
145
|
+
})
|
|
146
|
+
|
|
147
|
+
return result.answers.requiresApproval.probability >= 0.7
|
|
148
|
+
},
|
|
149
|
+
})
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
The example sends argument names rather than values because the classifier forwards its state to the configured evaluation model. If the decision requires argument values, redact sensitive data first or use an evaluation model and provider that meet the protected tool's data-handling requirements.
|
|
153
|
+
|
|
154
|
+
Returning `true` pauses the tool call for human approval. It doesn't approve or decline the call automatically. Choose a threshold that matches the risk of the tools available to the agent. If this `requireToolApproval` function throws, it defaults to requiring approval.
|
|
155
|
+
|
|
156
|
+
The runtime then combines that result with the tool's `requireApproval` setting. A boolean `true` requires approval, while `false` doesn't disable approval required by `requireToolApproval`. A tool-level `requireApproval` function is authoritative and replaces the combined result for that tool.
|
|
120
157
|
|
|
121
158
|
> **Note:** Function-based `requireToolApproval` is only available on regular `stream()` / `generate()` calls. Durable agents and stored agents persist their options, and a function can't be serialized, so they accept only a boolean. If you pass a function in those contexts it falls back to requiring approval for every tool call.
|
|
122
159
|
|
|
@@ -370,6 +407,10 @@ const handleResume = async () => {
|
|
|
370
407
|
}
|
|
371
408
|
```
|
|
372
409
|
|
|
410
|
+
When a suspended or approval-gated tool call resumes, the stream emits a `tool-call-resumed` chunk with the same `toolCallId` before the call's `tool-result`. Its `payload.kind` is `'suspension'` or `'approval'`, and the payload repeats the original `args`, `suspendPayload`, and `resumeSchema`. The chunk is only emitted when a real suspension or approval request is cleared.
|
|
411
|
+
|
|
412
|
+
With `@mastra/ai-sdk`, it arrives as a `data-tool-call-suspended` part (or `data-tool-call-approval` part for approvals) with `resumed: true`, which replaces the original part and keeps its payload. Use this signal to mark a question as answered. Don't infer it from the shape of the tool output: when the suspension came from a sub-agent, the output of the delegation call is the sub-agent's result, not your answer.
|
|
413
|
+
|
|
373
414
|
## Automatic tool resumption
|
|
374
415
|
|
|
375
416
|
When using tools that call `suspend()`, you can enable automatic resumption so the agent resumes suspended tools based on the user's next message. Set `autoResumeSuspendedTools` to `true` in the agent's default options or per-request:
|
|
@@ -35,7 +35,10 @@ The orchestration worker requires a PubSub backend that supports pull mode (e.g.
|
|
|
35
35
|
|
|
36
36
|
### Scheduler worker
|
|
37
37
|
|
|
38
|
-
Polls storage for due cron schedules and publishes `workflow.start`
|
|
38
|
+
Polls storage for due cron schedules and publishes a `workflow.start` event for each fire. It's a producer only, meaning it creates work for the orchestration worker to pick up:
|
|
39
|
+
|
|
40
|
+
- **Split processes**: Scheduled workflows run on the evented engine, and the orchestration worker runs each fire step by step.
|
|
41
|
+
- **In-process mode**: Scheduled workflows run on the default engine. The orchestration worker in the same process runs each fire in-process, the same way a direct `run.start()` does.
|
|
39
42
|
|
|
40
43
|
The scheduler reads declarative `schedule` fields from your workflow definitions automatically. See [Scheduled workflows](https://mastra.ai/docs/workflows/scheduled-workflows) for how to declare schedules.
|
|
41
44
|
|
|
@@ -57,7 +60,7 @@ The background task worker manages concurrency limits, task lifecycle, and resul
|
|
|
57
60
|
|
|
58
61
|
### In-process mode (default)
|
|
59
62
|
|
|
60
|
-
With no configuration, Mastra
|
|
63
|
+
With no configuration, Mastra runs workers inside the API process. Events flow through an in-memory PubSub, and everything shares a single Node.js runtime.
|
|
61
64
|
|
|
62
65
|
```typescript
|
|
63
66
|
import { Mastra } from '@mastra/core/mastra'
|
|
@@ -68,6 +71,8 @@ export const mastra = new Mastra({
|
|
|
68
71
|
})
|
|
69
72
|
```
|
|
70
73
|
|
|
74
|
+
The server generated by `mastra build` starts these workers automatically. If you use a [server adapter](https://mastra.ai/docs/server/server-adapters) instead, add a call to `mastra.startWorkers()` after your server starts listening. See [Start background workers](https://mastra.ai/docs/server/server-adapters).
|
|
75
|
+
|
|
71
76
|
This setup needs no external infrastructure beyond your storage adapter. It doesn't survive process crashes, and you can't scale individual components.
|
|
72
77
|
|
|
73
78
|
### Split processes
|
|
@@ -132,6 +137,8 @@ You can also pass a worker name to the CLI. The command sets `MASTRA_WORKERS` in
|
|
|
132
137
|
mastra worker start orchestration
|
|
133
138
|
```
|
|
134
139
|
|
|
140
|
+
Set `MASTRA_WORKERS` on every process in a split deployment, including `false` on the API process. Any value switches workflows that declare `schedule` to the evented engine, and every process must run those workflows on the same engine. See [Scheduled workflows](https://mastra.ai/docs/workflows/scheduled-workflows). `mastra worker start` without a worker name doesn't set `MASTRA_WORKERS`, so pass a name or set the variable in the process environment.
|
|
141
|
+
|
|
135
142
|
## Network architecture
|
|
136
143
|
|
|
137
144
|
Workers are internal infrastructure. They're not exposed to end users and don't need their own subdomain or public URL, including an inbound HTTP route.
|
|
@@ -142,7 +149,7 @@ In a split deployment:
|
|
|
142
149
|
- **Workers connect outbound only**: They pull events from the distributed PubSub backend and read/write to the shared storage database. They don't accept inbound traffic from clients.
|
|
143
150
|
- **The orchestration worker calls the API internally**: It sends step execution requests to the API over the container network using `MASTRA_STEP_EXECUTION_URL`. This is internal service-to-service communication, not a public endpoint.
|
|
144
151
|
|
|
145
|
-
All three worker types (orchestration, scheduler, background task) sit behind the API on a private network. They share access to the PubSub backend and storage database but never receive traffic directly from clients. HTTP routes for worker-related features run on the API server rather than the worker process. One example is token
|
|
152
|
+
All three worker types (orchestration, scheduler, background task) sit behind the API on a private network. They share access to the PubSub backend and storage database but never receive traffic directly from clients. HTTP routes for worker-related features run on the API server rather than the worker process. One example is creating a token for a voice integration.
|
|
146
153
|
|
|
147
154
|
## Deploy split workers
|
|
148
155
|
|
|
@@ -285,6 +292,8 @@ curl http://localhost:4111/api/agents
|
|
|
285
292
|
|
|
286
293
|
### Kubernetes
|
|
287
294
|
|
|
295
|
+
> **Helm:** On Kubernetes, the [`mastra-projects` Helm chart](https://mastra.ai/integrations/deploy/kubernetes-helm) renders these deployments for you, with the workers on the same image and environment as the server. It also refuses to install combinations that would run every worker twice. The manifests below are for writing them by hand.
|
|
296
|
+
|
|
288
297
|
Create separate Deployments for the API, orchestration worker, scheduler worker, and background task worker. Use the same image and Secret for each Deployment. Set only the role-specific environment variables directly on each container.
|
|
289
298
|
|
|
290
299
|
The orchestration worker Deployment has the following shape:
|
|
@@ -391,4 +400,5 @@ If the API crashes while a step is executing, that work can be lost and the work
|
|
|
391
400
|
- [Workers reference](https://mastra.ai/reference/workers/overview): Details about worker environment variables and types, with a list of supported storage backends
|
|
392
401
|
- [CLI reference](https://mastra.ai/reference/cli/mastra): `mastra worker build` and `mastra worker start`
|
|
393
402
|
- [PubSub](https://mastra.ai/docs/server/pubsub): Event delivery backends
|
|
403
|
+
- [Kubernetes (Helm)](https://mastra.ai/integrations/deploy/kubernetes-helm): Deploy worker roles with the official chart
|
|
394
404
|
- [Scheduled workflows](https://mastra.ai/docs/workflows/scheduled-workflows): Declare cron schedules on workflows
|
|
@@ -14,6 +14,12 @@ Memory processors are [processors](https://mastra.ai/docs/agents/processors) tha
|
|
|
14
14
|
|
|
15
15
|
Mastra automatically adds these processors when memory is enabled:
|
|
16
16
|
|
|
17
|
+
### `MemoryInputFilter`
|
|
18
|
+
|
|
19
|
+
Trims client-echoed history before memory loaders run. For an existing thread, it keeps only the current user turn or new tool results. For an empty thread, it keeps the full initial input and removes provider item metadata from assistant parts that could refer to items that don't exist in storage.
|
|
20
|
+
|
|
21
|
+
This processor runs first so `MessageHistory`, `SemanticRecall`, and Observational Memory receive only the new input they need.
|
|
22
|
+
|
|
17
23
|
### `MessageHistory`
|
|
18
24
|
|
|
19
25
|
Retrieves message history and persists new messages.
|
|
@@ -206,7 +212,7 @@ Understanding the execution order is important when combining guardrails with me
|
|
|
206
212
|
[Memory Processors] → [Your inputProcessors]
|
|
207
213
|
```
|
|
208
214
|
|
|
209
|
-
1. **Memory processors run FIRST**: `WorkingMemory`, `MessageHistory`, `SemanticRecall`
|
|
215
|
+
1. **Memory processors run FIRST**: `MemoryInputFilter`, then `WorkingMemory`, `MessageHistory`, and `SemanticRecall`
|
|
210
216
|
2. **Your input processors run AFTER**: guardrails, filters, validators
|
|
211
217
|
|
|
212
218
|
As a result, memory loads message history before your processors can validate or filter the input.
|