@mastra/libsql 1.25.2-alpha.1 → 1.26.0-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.
- package/dist/_types/@internal_core/dist/knowledge-compat/index.d.ts +594 -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-memory-message-history.md +15 -8
- package/dist/index.cjs +1269 -179
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1270 -180
- package/dist/index.js.map +1 -1
- package/dist/storage/db/index.d.ts +7 -4
- package/dist/storage/db/index.d.ts.map +1 -1
- package/dist/storage/domains/knowledge/index.d.ts +30 -7
- package/dist/storage/domains/knowledge/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +6 -0
- package/dist/storage/index.d.ts.map +1 -1
- package/package.json +3 -2
|
@@ -0,0 +1,594 @@
|
|
|
1
|
+
//#region src/knowledge-compat/index.d.ts
|
|
2
|
+
declare const KNOWLEDGE_V2_CORE_FEATURE = "knowledge-v2";
|
|
3
|
+
declare const KNOWLEDGE_STORAGE_CONTRACT_VERSION: 2;
|
|
4
|
+
declare const KNOWLEDGE_STORAGE_SCHEMA_VERSION: 2;
|
|
5
|
+
/** Hard cap on scope nodes returned by one `listScopeNodes` read. */
|
|
6
|
+
declare const MAX_KNOWLEDGE_SCOPE_NODES = 1000;
|
|
7
|
+
interface ListKnowledgeScopeNodesInput {
|
|
8
|
+
/** Only the scope at this address and the scopes beneath it, following parent edges transitively. */
|
|
9
|
+
withinAddress?: string;
|
|
10
|
+
/** Only the scopes at these exact addresses. */
|
|
11
|
+
addresses?: string[];
|
|
12
|
+
/** Only the scope nodes with these UUIDs. Combines with the other filters. */
|
|
13
|
+
ids?: string[];
|
|
14
|
+
/** `nextCursor` from the previous page of the same query. */
|
|
15
|
+
cursor?: string;
|
|
16
|
+
/** Page size, from 1 to `MAX_KNOWLEDGE_SCOPE_NODES` (the default). */
|
|
17
|
+
limit?: number;
|
|
18
|
+
}
|
|
19
|
+
interface ListKnowledgeScopeNodesOutput {
|
|
20
|
+
/** Scope nodes ordered by name, then id. */
|
|
21
|
+
scopes: KnowledgeScopeNodeSummary[];
|
|
22
|
+
/** Pass back as `cursor` for the next page; `null` when this is the last page. */
|
|
23
|
+
nextCursor: string | null;
|
|
24
|
+
}
|
|
25
|
+
declare function createKnowledgeScopeNodeCursor(scope: Pick<KnowledgeScopeNodeSummary, 'name' | 'id'>, input: ListKnowledgeScopeNodesInput): string;
|
|
26
|
+
/** Validates the page size and cursor of a `listScopeNodes` query; throws on a cursor from a different query. */
|
|
27
|
+
declare function parseListKnowledgeScopeNodesInput(input?: ListKnowledgeScopeNodesInput): {
|
|
28
|
+
limit: number;
|
|
29
|
+
after: {
|
|
30
|
+
name: string;
|
|
31
|
+
id: string;
|
|
32
|
+
} | null;
|
|
33
|
+
};
|
|
34
|
+
/** Builds a page from up to `limit + 1` name/id-ordered scope nodes. */
|
|
35
|
+
declare function pageKnowledgeScopeNodes(rows: KnowledgeScopeNodeSummary[], limit: number, input: ListKnowledgeScopeNodesInput): ListKnowledgeScopeNodesOutput;
|
|
36
|
+
/** A node placed inside a structural scope. Child scopes are members too, with `scope: null`. */
|
|
37
|
+
interface KnowledgeScopeMember {
|
|
38
|
+
id: string;
|
|
39
|
+
type: 'node';
|
|
40
|
+
name: string;
|
|
41
|
+
kind: string;
|
|
42
|
+
content?: string;
|
|
43
|
+
description?: string;
|
|
44
|
+
scope: string[] | null;
|
|
45
|
+
version: number;
|
|
46
|
+
mergedInto?: string;
|
|
47
|
+
createdAt: Date;
|
|
48
|
+
updatedAt: Date;
|
|
49
|
+
}
|
|
50
|
+
interface ListKnowledgeScopeMembersInput {
|
|
51
|
+
scopeNodeId: string;
|
|
52
|
+
/** `nextCursor` from the previous page for the same scope. */
|
|
53
|
+
cursor?: string;
|
|
54
|
+
/** Members to return, 1–500 (default 500). */
|
|
55
|
+
limit?: number;
|
|
56
|
+
}
|
|
57
|
+
interface ListKnowledgeScopeMembersOutput {
|
|
58
|
+
/** Most recently updated members first (ties by name, then ID), at most `limit`. */
|
|
59
|
+
members: KnowledgeScopeMember[];
|
|
60
|
+
/** True when the scope has more members than were returned. */
|
|
61
|
+
hasMore: boolean;
|
|
62
|
+
/** Pass as `cursor` to read the next page; `null` on the last page. */
|
|
63
|
+
nextCursor: string | null;
|
|
64
|
+
}
|
|
65
|
+
declare const MAX_KNOWLEDGE_SCOPE_MEMBERS_LIMIT = 500;
|
|
66
|
+
/** Clamps a requested member limit to 1–{@link MAX_KNOWLEDGE_SCOPE_MEMBERS_LIMIT}. */
|
|
67
|
+
declare function knowledgeScopeMembersLimit(limit: number | undefined): number;
|
|
68
|
+
/** Validates the page size and cursor of a `listScopeMembers` query; throws on a cursor from another scope. */
|
|
69
|
+
declare function parseListKnowledgeScopeMembersInput(input: ListKnowledgeScopeMembersInput): {
|
|
70
|
+
limit: number;
|
|
71
|
+
after: {
|
|
72
|
+
updatedAt: Date;
|
|
73
|
+
name: string;
|
|
74
|
+
id: string;
|
|
75
|
+
} | null;
|
|
76
|
+
};
|
|
77
|
+
/** Builds a page from up to `limit + 1` members in `listScopeMembers` order. */
|
|
78
|
+
declare function pageKnowledgeScopeMembers(rows: KnowledgeScopeMember[], limit: number, input: ListKnowledgeScopeMembersInput): ListKnowledgeScopeMembersOutput;
|
|
79
|
+
/** A reconciled structural scope node with its containing scope nodes. */
|
|
80
|
+
interface KnowledgeScopeNodeSummary {
|
|
81
|
+
/** UUID of the `isScope` node. */
|
|
82
|
+
id: string;
|
|
83
|
+
/** Canonical address the scope node was reconciled from (e.g. `features:memory`). */
|
|
84
|
+
address: string;
|
|
85
|
+
name: string;
|
|
86
|
+
kind?: string;
|
|
87
|
+
description?: string;
|
|
88
|
+
/** UUIDs of the scope nodes that contain this scope (membership edges). */
|
|
89
|
+
parentIds: string[];
|
|
90
|
+
}
|
|
91
|
+
declare const TABLE_KNOWLEDGE_NODE_SCOPES = "mastra_knowledge_node_scopes";
|
|
92
|
+
declare const TABLE_KNOWLEDGE_RECORD_SCOPES = "mastra_knowledge_record_scopes";
|
|
93
|
+
declare const TABLE_KNOWLEDGE_SCOPE_GRANTS = "mastra_knowledge_scope_grants";
|
|
94
|
+
declare const TABLE_KNOWLEDGE_ACCESS_STATE = "mastra_knowledge_access_state";
|
|
95
|
+
declare const TABLE_KNOWLEDGE_SCOPE_ADDRESSES = "mastra_knowledge_scope_addresses";
|
|
96
|
+
declare const TABLE_KNOWLEDGE_NODE_ADDRESSES = "mastra_knowledge_node_addresses";
|
|
97
|
+
declare const TABLE_KNOWLEDGE_IMPORT_STATE = "mastra_knowledge_import_state";
|
|
98
|
+
declare const TABLE_KNOWLEDGE_IMPORT_RUNS = "mastra_knowledge_import_runs";
|
|
99
|
+
declare const TABLE_KNOWLEDGE_PROPOSALS = "mastra_knowledge_proposals";
|
|
100
|
+
declare const KNOWLEDGE_TABLE_NAMES: readonly ["mastra_knowledge_nodes", "mastra_knowledge_records", "mastra_knowledge_mentions", "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"];
|
|
101
|
+
/** Knowledge v1 tables with no v2 equivalent; an explicit schema reset drops them. */
|
|
102
|
+
declare const RETIRED_KNOWLEDGE_TABLE_NAMES: readonly ['mastra_knowledge_cursors'];
|
|
103
|
+
/** Tables and indexes published v1 adapters created for every app, whether or not it used Knowledge. */
|
|
104
|
+
declare const PUBLISHED_KNOWLEDGE_V1_TABLE_NAMES: ReadonlySet<string>;
|
|
105
|
+
declare const PUBLISHED_KNOWLEDGE_V1_INDEX_NAMES: ReadonlySet<string>;
|
|
106
|
+
declare const KNOWLEDGE_V2_NODES_SCHEMA: {
|
|
107
|
+
readonly id: {
|
|
108
|
+
readonly type: 'text';
|
|
109
|
+
readonly nullable: false;
|
|
110
|
+
readonly primaryKey: true;
|
|
111
|
+
};
|
|
112
|
+
readonly name: {
|
|
113
|
+
readonly type: 'text';
|
|
114
|
+
readonly nullable: false;
|
|
115
|
+
};
|
|
116
|
+
readonly kind: {
|
|
117
|
+
readonly type: 'text';
|
|
118
|
+
readonly nullable: true;
|
|
119
|
+
};
|
|
120
|
+
readonly isScope: {
|
|
121
|
+
readonly type: 'boolean';
|
|
122
|
+
readonly nullable: false;
|
|
123
|
+
};
|
|
124
|
+
readonly metadata: {
|
|
125
|
+
readonly type: 'jsonb';
|
|
126
|
+
readonly nullable: true;
|
|
127
|
+
};
|
|
128
|
+
readonly version: {
|
|
129
|
+
readonly type: 'integer';
|
|
130
|
+
readonly nullable: false;
|
|
131
|
+
};
|
|
132
|
+
readonly createdAt: {
|
|
133
|
+
readonly type: 'timestamp';
|
|
134
|
+
readonly nullable: false;
|
|
135
|
+
};
|
|
136
|
+
readonly updatedAt: {
|
|
137
|
+
readonly type: 'timestamp';
|
|
138
|
+
readonly nullable: false;
|
|
139
|
+
};
|
|
140
|
+
readonly deletedAt: {
|
|
141
|
+
readonly type: 'timestamp';
|
|
142
|
+
readonly nullable: true;
|
|
143
|
+
};
|
|
144
|
+
readonly deletedBy: {
|
|
145
|
+
readonly type: 'text';
|
|
146
|
+
readonly nullable: true;
|
|
147
|
+
};
|
|
148
|
+
readonly type: {
|
|
149
|
+
readonly type: 'text';
|
|
150
|
+
readonly nullable: true;
|
|
151
|
+
};
|
|
152
|
+
readonly canonicalName: {
|
|
153
|
+
readonly type: 'text';
|
|
154
|
+
readonly nullable: true;
|
|
155
|
+
};
|
|
156
|
+
readonly content: {
|
|
157
|
+
readonly type: 'text';
|
|
158
|
+
readonly nullable: true;
|
|
159
|
+
};
|
|
160
|
+
readonly description: {
|
|
161
|
+
readonly type: 'text';
|
|
162
|
+
readonly nullable: true;
|
|
163
|
+
};
|
|
164
|
+
readonly scope: {
|
|
165
|
+
readonly type: 'jsonb';
|
|
166
|
+
readonly nullable: true;
|
|
167
|
+
};
|
|
168
|
+
readonly scopeKey: {
|
|
169
|
+
readonly type: 'text';
|
|
170
|
+
readonly nullable: true;
|
|
171
|
+
};
|
|
172
|
+
readonly mergedInto: {
|
|
173
|
+
readonly type: 'text';
|
|
174
|
+
readonly nullable: true;
|
|
175
|
+
};
|
|
176
|
+
};
|
|
177
|
+
declare const KNOWLEDGE_V2_RECORDS_SCHEMA: {
|
|
178
|
+
readonly id: {
|
|
179
|
+
readonly type: 'text';
|
|
180
|
+
readonly nullable: false;
|
|
181
|
+
readonly primaryKey: true;
|
|
182
|
+
};
|
|
183
|
+
readonly node: {
|
|
184
|
+
readonly type: 'text';
|
|
185
|
+
readonly nullable: false;
|
|
186
|
+
readonly references: {
|
|
187
|
+
readonly table: "mastra_knowledge_nodes";
|
|
188
|
+
readonly column: 'id';
|
|
189
|
+
};
|
|
190
|
+
};
|
|
191
|
+
readonly text: {
|
|
192
|
+
readonly type: 'text';
|
|
193
|
+
readonly nullable: false;
|
|
194
|
+
};
|
|
195
|
+
readonly metadata: {
|
|
196
|
+
readonly type: 'jsonb';
|
|
197
|
+
readonly nullable: true;
|
|
198
|
+
};
|
|
199
|
+
readonly version: {
|
|
200
|
+
readonly type: 'integer';
|
|
201
|
+
readonly nullable: false;
|
|
202
|
+
};
|
|
203
|
+
readonly capturedAt: {
|
|
204
|
+
readonly type: 'timestamp';
|
|
205
|
+
readonly nullable: false;
|
|
206
|
+
};
|
|
207
|
+
readonly updatedAt: {
|
|
208
|
+
readonly type: 'timestamp';
|
|
209
|
+
readonly nullable: false;
|
|
210
|
+
};
|
|
211
|
+
readonly deletedAt: {
|
|
212
|
+
readonly type: 'timestamp';
|
|
213
|
+
readonly nullable: true;
|
|
214
|
+
};
|
|
215
|
+
readonly deletedBy: {
|
|
216
|
+
readonly type: 'text';
|
|
217
|
+
readonly nullable: true;
|
|
218
|
+
};
|
|
219
|
+
readonly scope: {
|
|
220
|
+
readonly type: 'jsonb';
|
|
221
|
+
readonly nullable: true;
|
|
222
|
+
};
|
|
223
|
+
readonly scopeKey: {
|
|
224
|
+
readonly type: 'text';
|
|
225
|
+
readonly nullable: true;
|
|
226
|
+
};
|
|
227
|
+
readonly sourceThreadId: {
|
|
228
|
+
readonly type: 'text';
|
|
229
|
+
readonly nullable: true;
|
|
230
|
+
};
|
|
231
|
+
readonly when: {
|
|
232
|
+
readonly type: 'timestamp';
|
|
233
|
+
readonly nullable: true;
|
|
234
|
+
};
|
|
235
|
+
};
|
|
236
|
+
declare const KNOWLEDGE_V2_MENTIONS_SCHEMA: {
|
|
237
|
+
readonly recordId: {
|
|
238
|
+
readonly type: 'text';
|
|
239
|
+
readonly nullable: false;
|
|
240
|
+
readonly references: {
|
|
241
|
+
readonly table: "mastra_knowledge_records";
|
|
242
|
+
readonly column: 'id';
|
|
243
|
+
};
|
|
244
|
+
};
|
|
245
|
+
readonly targetNodeId: {
|
|
246
|
+
readonly type: 'text';
|
|
247
|
+
readonly nullable: true;
|
|
248
|
+
readonly references: {
|
|
249
|
+
readonly table: "mastra_knowledge_nodes";
|
|
250
|
+
readonly column: 'id';
|
|
251
|
+
};
|
|
252
|
+
};
|
|
253
|
+
readonly sourceType: {
|
|
254
|
+
readonly type: 'text';
|
|
255
|
+
readonly nullable: true;
|
|
256
|
+
};
|
|
257
|
+
readonly sourceId: {
|
|
258
|
+
readonly type: 'text';
|
|
259
|
+
readonly nullable: true;
|
|
260
|
+
};
|
|
261
|
+
};
|
|
262
|
+
declare const KNOWLEDGE_NODE_SCOPES_SCHEMA: {
|
|
263
|
+
readonly nodeId: {
|
|
264
|
+
readonly type: 'text';
|
|
265
|
+
readonly nullable: false;
|
|
266
|
+
readonly references: {
|
|
267
|
+
readonly table: "mastra_knowledge_nodes";
|
|
268
|
+
readonly column: 'id';
|
|
269
|
+
};
|
|
270
|
+
};
|
|
271
|
+
readonly scopeNodeId: {
|
|
272
|
+
readonly type: 'text';
|
|
273
|
+
readonly nullable: false;
|
|
274
|
+
readonly references: {
|
|
275
|
+
readonly table: "mastra_knowledge_nodes";
|
|
276
|
+
readonly column: 'id';
|
|
277
|
+
};
|
|
278
|
+
};
|
|
279
|
+
readonly addedAt: {
|
|
280
|
+
readonly type: 'timestamp';
|
|
281
|
+
readonly nullable: false;
|
|
282
|
+
};
|
|
283
|
+
};
|
|
284
|
+
declare const KNOWLEDGE_RECORD_SCOPES_SCHEMA: {
|
|
285
|
+
readonly recordId: {
|
|
286
|
+
readonly type: 'text';
|
|
287
|
+
readonly nullable: false;
|
|
288
|
+
readonly references: {
|
|
289
|
+
readonly table: "mastra_knowledge_records";
|
|
290
|
+
readonly column: 'id';
|
|
291
|
+
};
|
|
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
|
+
readonly addedAt: {
|
|
302
|
+
readonly type: 'timestamp';
|
|
303
|
+
readonly nullable: false;
|
|
304
|
+
};
|
|
305
|
+
};
|
|
306
|
+
declare const KNOWLEDGE_SCOPE_GRANTS_SCHEMA: {
|
|
307
|
+
readonly scopeNodeId: {
|
|
308
|
+
readonly type: 'text';
|
|
309
|
+
readonly nullable: false;
|
|
310
|
+
readonly references: {
|
|
311
|
+
readonly table: "mastra_knowledge_nodes";
|
|
312
|
+
readonly column: 'id';
|
|
313
|
+
};
|
|
314
|
+
};
|
|
315
|
+
readonly scopeRefId: {
|
|
316
|
+
readonly type: 'text';
|
|
317
|
+
readonly nullable: false;
|
|
318
|
+
readonly references: {
|
|
319
|
+
readonly table: "mastra_knowledge_nodes";
|
|
320
|
+
readonly column: 'id';
|
|
321
|
+
};
|
|
322
|
+
};
|
|
323
|
+
readonly role: {
|
|
324
|
+
readonly type: 'text';
|
|
325
|
+
readonly nullable: false;
|
|
326
|
+
};
|
|
327
|
+
readonly canSuggest: {
|
|
328
|
+
readonly type: 'boolean';
|
|
329
|
+
readonly nullable: true;
|
|
330
|
+
};
|
|
331
|
+
};
|
|
332
|
+
declare const KNOWLEDGE_ACCESS_STATE_SCHEMA: {
|
|
333
|
+
readonly id: {
|
|
334
|
+
readonly type: 'text';
|
|
335
|
+
readonly nullable: false;
|
|
336
|
+
readonly primaryKey: true;
|
|
337
|
+
};
|
|
338
|
+
readonly epoch: {
|
|
339
|
+
readonly type: 'integer';
|
|
340
|
+
readonly nullable: false;
|
|
341
|
+
};
|
|
342
|
+
readonly schemaVersion: {
|
|
343
|
+
readonly type: 'integer';
|
|
344
|
+
readonly nullable: false;
|
|
345
|
+
};
|
|
346
|
+
};
|
|
347
|
+
declare const KNOWLEDGE_SCOPE_ADDRESSES_SCHEMA: {
|
|
348
|
+
readonly address: {
|
|
349
|
+
readonly type: 'text';
|
|
350
|
+
readonly nullable: false;
|
|
351
|
+
readonly primaryKey: true;
|
|
352
|
+
};
|
|
353
|
+
readonly scopeNodeId: {
|
|
354
|
+
readonly type: 'text';
|
|
355
|
+
readonly nullable: false;
|
|
356
|
+
readonly references: {
|
|
357
|
+
readonly table: "mastra_knowledge_nodes";
|
|
358
|
+
readonly column: 'id';
|
|
359
|
+
};
|
|
360
|
+
};
|
|
361
|
+
};
|
|
362
|
+
declare const KNOWLEDGE_NODE_ADDRESSES_SCHEMA: {
|
|
363
|
+
readonly source: {
|
|
364
|
+
readonly type: 'text';
|
|
365
|
+
readonly nullable: false;
|
|
366
|
+
};
|
|
367
|
+
readonly address: {
|
|
368
|
+
readonly type: 'text';
|
|
369
|
+
readonly nullable: false;
|
|
370
|
+
};
|
|
371
|
+
readonly nodeId: {
|
|
372
|
+
readonly type: 'text';
|
|
373
|
+
readonly nullable: false;
|
|
374
|
+
readonly references: {
|
|
375
|
+
readonly table: "mastra_knowledge_nodes";
|
|
376
|
+
readonly column: 'id';
|
|
377
|
+
};
|
|
378
|
+
};
|
|
379
|
+
};
|
|
380
|
+
declare const KNOWLEDGE_IMPORT_STATE_SCHEMA: {
|
|
381
|
+
readonly importerId: {
|
|
382
|
+
readonly type: 'text';
|
|
383
|
+
readonly nullable: false;
|
|
384
|
+
};
|
|
385
|
+
readonly binding: {
|
|
386
|
+
readonly type: 'text';
|
|
387
|
+
readonly nullable: false;
|
|
388
|
+
};
|
|
389
|
+
readonly key: {
|
|
390
|
+
readonly type: 'text';
|
|
391
|
+
readonly nullable: false;
|
|
392
|
+
};
|
|
393
|
+
readonly value: {
|
|
394
|
+
readonly type: 'text';
|
|
395
|
+
readonly nullable: false;
|
|
396
|
+
};
|
|
397
|
+
};
|
|
398
|
+
declare const KNOWLEDGE_IMPORT_RUNS_SCHEMA: {
|
|
399
|
+
readonly id: {
|
|
400
|
+
readonly type: 'text';
|
|
401
|
+
readonly nullable: false;
|
|
402
|
+
readonly primaryKey: true;
|
|
403
|
+
};
|
|
404
|
+
readonly importerId: {
|
|
405
|
+
readonly type: 'text';
|
|
406
|
+
readonly nullable: false;
|
|
407
|
+
};
|
|
408
|
+
readonly binding: {
|
|
409
|
+
readonly type: 'text';
|
|
410
|
+
readonly nullable: false;
|
|
411
|
+
};
|
|
412
|
+
readonly importKind: {
|
|
413
|
+
readonly type: 'text';
|
|
414
|
+
readonly nullable: false;
|
|
415
|
+
};
|
|
416
|
+
readonly triggerKind: {
|
|
417
|
+
readonly type: 'text';
|
|
418
|
+
readonly nullable: false;
|
|
419
|
+
};
|
|
420
|
+
readonly status: {
|
|
421
|
+
readonly type: 'text';
|
|
422
|
+
readonly nullable: false;
|
|
423
|
+
};
|
|
424
|
+
readonly error: {
|
|
425
|
+
readonly type: 'text';
|
|
426
|
+
readonly nullable: true;
|
|
427
|
+
};
|
|
428
|
+
readonly transcriptThreadId: {
|
|
429
|
+
readonly type: 'text';
|
|
430
|
+
readonly nullable: true;
|
|
431
|
+
};
|
|
432
|
+
readonly traceId: {
|
|
433
|
+
readonly type: 'text';
|
|
434
|
+
readonly nullable: true;
|
|
435
|
+
};
|
|
436
|
+
readonly queuedAt: {
|
|
437
|
+
readonly type: 'timestamp';
|
|
438
|
+
readonly nullable: false;
|
|
439
|
+
};
|
|
440
|
+
readonly startedAt: {
|
|
441
|
+
readonly type: 'timestamp';
|
|
442
|
+
readonly nullable: true;
|
|
443
|
+
};
|
|
444
|
+
readonly completedAt: {
|
|
445
|
+
readonly type: 'timestamp';
|
|
446
|
+
readonly nullable: true;
|
|
447
|
+
};
|
|
448
|
+
};
|
|
449
|
+
declare const KNOWLEDGE_V2_ACTIVITY_SCHEMA: {
|
|
450
|
+
readonly id: {
|
|
451
|
+
readonly type: 'text';
|
|
452
|
+
readonly nullable: false;
|
|
453
|
+
readonly primaryKey: true;
|
|
454
|
+
};
|
|
455
|
+
readonly action: {
|
|
456
|
+
readonly type: 'text';
|
|
457
|
+
readonly nullable: false;
|
|
458
|
+
};
|
|
459
|
+
readonly targetType: {
|
|
460
|
+
readonly type: 'text';
|
|
461
|
+
readonly nullable: true;
|
|
462
|
+
};
|
|
463
|
+
readonly targetId: {
|
|
464
|
+
readonly type: 'text';
|
|
465
|
+
readonly nullable: true;
|
|
466
|
+
};
|
|
467
|
+
readonly contextScopeId: {
|
|
468
|
+
readonly type: 'text';
|
|
469
|
+
readonly nullable: true;
|
|
470
|
+
readonly references: {
|
|
471
|
+
readonly table: "mastra_knowledge_nodes";
|
|
472
|
+
readonly column: 'id';
|
|
473
|
+
};
|
|
474
|
+
};
|
|
475
|
+
readonly importRunId: {
|
|
476
|
+
readonly type: 'text';
|
|
477
|
+
readonly nullable: true;
|
|
478
|
+
readonly references: {
|
|
479
|
+
readonly table: "mastra_knowledge_import_runs";
|
|
480
|
+
readonly column: 'id';
|
|
481
|
+
};
|
|
482
|
+
};
|
|
483
|
+
readonly details: {
|
|
484
|
+
readonly type: 'jsonb';
|
|
485
|
+
readonly nullable: true;
|
|
486
|
+
};
|
|
487
|
+
readonly createdAt: {
|
|
488
|
+
readonly type: 'timestamp';
|
|
489
|
+
readonly nullable: false;
|
|
490
|
+
};
|
|
491
|
+
readonly recordType: {
|
|
492
|
+
readonly type: 'text';
|
|
493
|
+
readonly nullable: true;
|
|
494
|
+
};
|
|
495
|
+
readonly recordId: {
|
|
496
|
+
readonly type: 'text';
|
|
497
|
+
readonly nullable: true;
|
|
498
|
+
};
|
|
499
|
+
readonly scope: {
|
|
500
|
+
readonly type: 'jsonb';
|
|
501
|
+
readonly nullable: true;
|
|
502
|
+
};
|
|
503
|
+
readonly scopeKey: {
|
|
504
|
+
readonly type: 'text';
|
|
505
|
+
readonly nullable: true;
|
|
506
|
+
};
|
|
507
|
+
readonly sourceThreadId: {
|
|
508
|
+
readonly type: 'text';
|
|
509
|
+
readonly nullable: true;
|
|
510
|
+
};
|
|
511
|
+
};
|
|
512
|
+
declare const KNOWLEDGE_PROPOSALS_SCHEMA: {
|
|
513
|
+
readonly id: {
|
|
514
|
+
readonly type: 'text';
|
|
515
|
+
readonly nullable: false;
|
|
516
|
+
readonly primaryKey: true;
|
|
517
|
+
};
|
|
518
|
+
readonly targetType: {
|
|
519
|
+
readonly type: 'text';
|
|
520
|
+
readonly nullable: false;
|
|
521
|
+
};
|
|
522
|
+
readonly targetId: {
|
|
523
|
+
readonly type: 'text';
|
|
524
|
+
readonly nullable: false;
|
|
525
|
+
};
|
|
526
|
+
readonly action: {
|
|
527
|
+
readonly type: 'text';
|
|
528
|
+
readonly nullable: false;
|
|
529
|
+
};
|
|
530
|
+
readonly changes: {
|
|
531
|
+
readonly type: 'jsonb';
|
|
532
|
+
readonly nullable: false;
|
|
533
|
+
};
|
|
534
|
+
readonly reason: {
|
|
535
|
+
readonly type: 'text';
|
|
536
|
+
readonly nullable: true;
|
|
537
|
+
};
|
|
538
|
+
readonly proposerContextScopeId: {
|
|
539
|
+
readonly type: 'text';
|
|
540
|
+
readonly nullable: false;
|
|
541
|
+
};
|
|
542
|
+
readonly expectedVersion: {
|
|
543
|
+
readonly type: 'integer';
|
|
544
|
+
readonly nullable: false;
|
|
545
|
+
};
|
|
546
|
+
readonly status: {
|
|
547
|
+
readonly type: 'text';
|
|
548
|
+
readonly nullable: false;
|
|
549
|
+
};
|
|
550
|
+
readonly reviewerContextScopeId: {
|
|
551
|
+
readonly type: 'text';
|
|
552
|
+
readonly nullable: true;
|
|
553
|
+
};
|
|
554
|
+
readonly reviewedAt: {
|
|
555
|
+
readonly type: 'timestamp';
|
|
556
|
+
readonly nullable: true;
|
|
557
|
+
};
|
|
558
|
+
readonly createdAt: {
|
|
559
|
+
readonly type: 'timestamp';
|
|
560
|
+
readonly nullable: false;
|
|
561
|
+
};
|
|
562
|
+
};
|
|
563
|
+
type KnowledgeSchemaInspection = {
|
|
564
|
+
status: 'compatible';
|
|
565
|
+
schemaVersion: typeof KNOWLEDGE_STORAGE_SCHEMA_VERSION;
|
|
566
|
+
} | {
|
|
567
|
+
status: 'uninitialized';
|
|
568
|
+
schemaVersion: null;
|
|
569
|
+
} | {
|
|
570
|
+
status: 'incompatible-reset-required';
|
|
571
|
+
schemaVersion: number | null;
|
|
572
|
+
reason: string;
|
|
573
|
+
} | {
|
|
574
|
+
status: 'unavailable';
|
|
575
|
+
schemaVersion: null;
|
|
576
|
+
reason: string;
|
|
577
|
+
};
|
|
578
|
+
interface KnowledgeSchemaSnapshot {
|
|
579
|
+
available: boolean;
|
|
580
|
+
tableNames: readonly string[];
|
|
581
|
+
schemaVersion?: number;
|
|
582
|
+
reason?: string;
|
|
583
|
+
}
|
|
584
|
+
interface KnowledgeV2Core {
|
|
585
|
+
assertKnowledgeDescriptionWithinBound(description: string | undefined): void;
|
|
586
|
+
assertKnowledgeRecordTextWithinBound(text: string): void;
|
|
587
|
+
assertKnowledgeSchemaCompatible(inspection: KnowledgeSchemaInspection): void;
|
|
588
|
+
inspectKnowledgeSchema(snapshot: KnowledgeSchemaSnapshot): KnowledgeSchemaInspection;
|
|
589
|
+
}
|
|
590
|
+
declare function assertKnowledgeV2CoreSupport(features: ReadonlySet<string>): void;
|
|
591
|
+
declare function createKnowledgeV2CoreLoader(features: ReadonlySet<string>, loadStorageModule: () => Promise<unknown>): () => Promise<KnowledgeV2Core>;
|
|
592
|
+
//#endregion
|
|
593
|
+
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_NODES_SCHEMA, KNOWLEDGE_V2_RECORDS_SCHEMA, KnowledgeSchemaInspection, KnowledgeSchemaSnapshot, KnowledgeScopeMember, KnowledgeScopeNodeSummary, ListKnowledgeScopeMembersInput, ListKnowledgeScopeMembersOutput, ListKnowledgeScopeNodesInput, ListKnowledgeScopeNodesOutput, MAX_KNOWLEDGE_SCOPE_MEMBERS_LIMIT, MAX_KNOWLEDGE_SCOPE_NODES, PUBLISHED_KNOWLEDGE_V1_INDEX_NAMES, PUBLISHED_KNOWLEDGE_V1_TABLE_NAMES, RETIRED_KNOWLEDGE_TABLE_NAMES, 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, createKnowledgeScopeNodeCursor, createKnowledgeV2CoreLoader, knowledgeScopeMembersLimit, pageKnowledgeScopeMembers, pageKnowledgeScopeNodes, parseListKnowledgeScopeMembersInput, parseListKnowledgeScopeNodesInput };
|
|
594
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
package/dist/docs/SKILL.md
CHANGED
|
@@ -10,14 +10,6 @@ You can also retrieve message history to display past conversations in your UI.
|
|
|
10
10
|
|
|
11
11
|
> **Note:** Each message belongs to a thread (the conversation) and a resource (the user or entity it's associated with). See [Threads and resources](#threads-and-resources) for more detail.
|
|
12
12
|
|
|
13
|
-
> **Warning:** When you use memory with a client application, send **only the new message** from the client instead of the full conversation history.
|
|
14
|
-
>
|
|
15
|
-
> Sending the full history is redundant because Mastra loads messages from storage. Mastra filters client-echoed history before loading stored messages and uses the stored copy as the base when message IDs match, preserving stored timestamps and provider metadata while retaining new tool results.
|
|
16
|
-
>
|
|
17
|
-
> If you assemble the request input yourself and need it processed exactly as sent, set `retainFullInput: true` on `memory.options` for that call, or in the memory constructor options to apply it agent-wide. This disables the filtering described above. History still loads underneath. Every input message that isn't already stored is saved to the thread, including few-shot examples.
|
|
18
|
-
>
|
|
19
|
-
> For an AI SDK example, see [Using Mastra Memory](https://mastra.ai/integrations/agentic-ui/ai-sdk-ui).
|
|
20
|
-
|
|
21
13
|
## Threads and resources
|
|
22
14
|
|
|
23
15
|
Mastra organizes conversations using two identifiers:
|
|
@@ -126,6 +118,21 @@ You can use this history in two ways:
|
|
|
126
118
|
|
|
127
119
|
> **Note:** `lastMessages` counts every stored message, including tool calls, tool results, and [signals](https://mastra.ai/docs/harness/signals) of any kind, so a single turn can add several messages to the count. The window also slides forward on every request: once a thread grows past the limit, the oldest message leaves context on each turn, which changes the start of the prompt and invalidates the provider prompt cache. For long-running conversations, use [Observational Memory](https://mastra.ai/docs/memory/observational-memory), which keeps the prompt prefix stable.
|
|
128
120
|
|
|
121
|
+
### Sending messages from a client
|
|
122
|
+
|
|
123
|
+
When you use memory with a client application, send **only the new message** instead of the full conversation history. Mastra loads previous messages from storage.
|
|
124
|
+
|
|
125
|
+
For an AI SDK example, see [Using Mastra Memory](https://mastra.ai/integrations/agentic-ui/ai-sdk-ui).
|
|
126
|
+
|
|
127
|
+
<details>
|
|
128
|
+
**Passing a full input history**
|
|
129
|
+
|
|
130
|
+
Mastra filters client-echoed history before loading stored messages. When message IDs match, it uses the stored copy as the base, preserving stored timestamps and provider metadata while retaining new tool results.
|
|
131
|
+
|
|
132
|
+
If you assemble the request input yourself and need it processed exactly as sent, set `retainFullInput: true` on `memory.options` for that call, or in the memory constructor options to apply it agent-wide. This disables input filtering, but stored history still loads. Every input message that isn't already stored is saved to the thread, including few-shot examples.
|
|
133
|
+
|
|
134
|
+
</details>
|
|
135
|
+
|
|
129
136
|
### Limit history by tokens
|
|
130
137
|
|
|
131
138
|
Message count is a poor proxy for context size: a tool result can be a few tokens or thousands. Use `messageHistory` to keep recent history within a token budget instead:
|