@mastra/pg 1.31.0-alpha.2 → 1.31.0-alpha.4
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/reference-storage-retention.md +21 -18
- package/dist/index.cjs +1749 -310
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1752 -313
- package/dist/index.js.map +1 -1
- package/dist/shared/config.d.ts +6 -0
- package/dist/shared/config.d.ts.map +1 -1
- package/dist/storage/db/index.d.ts +15 -9
- package/dist/storage/db/index.d.ts.map +1 -1
- package/dist/storage/db/run-fencing.d.ts +23 -0
- package/dist/storage/db/run-fencing.d.ts.map +1 -0
- package/dist/storage/domains/agents/index.d.ts.map +1 -1
- package/dist/storage/domains/knowledge/index.d.ts +38 -9
- package/dist/storage/domains/knowledge/index.d.ts.map +1 -1
- package/dist/storage/domains/mcp-clients/index.d.ts.map +1 -1
- package/dist/storage/domains/mcp-servers/index.d.ts.map +1 -1
- package/dist/storage/domains/memory/index.d.ts +21 -7
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/dist/storage/domains/prompt-blocks/index.d.ts.map +1 -1
- package/dist/storage/domains/scorer-definitions/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 +21 -6
- package/dist/storage/domains/workflows/index.d.ts.map +1 -1
- package/dist/storage/domains/workspaces/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/retention.d.ts +3 -3
- package/dist/storage/retention.d.ts.map +1 -1
- package/package.json +5 -4
|
@@ -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
|
@@ -95,29 +95,32 @@ Set the `retention` field on the store config.
|
|
|
95
95
|
|
|
96
96
|
Each domain specifies its age-prunable tables and the timestamp column that anchors comparison, chosen so `maxAge` matches the meaning of the data. Append-only logs use creation time, live state uses last activity, and jobs or runs use completion time so in-flight work isn't pruned.
|
|
97
97
|
|
|
98
|
-
| Domain | Table key | Anchor column | `maxAge` measures
|
|
99
|
-
| ----------------- | ------------------ | ---------------- |
|
|
100
|
-
| `memory` | `threads` | `createdAt` | Thread age
|
|
101
|
-
| `memory` | `messages` | `createdAt` | Message age
|
|
102
|
-
| `memory` | `resources` | `createdAt` | Resource age
|
|
103
|
-
| `
|
|
104
|
-
| `
|
|
105
|
-
| `observability` | `
|
|
106
|
-
| `observability` | `
|
|
107
|
-
| `observability` | `
|
|
108
|
-
| `observability` | `
|
|
109
|
-
| `
|
|
110
|
-
| `
|
|
111
|
-
| `
|
|
112
|
-
| `
|
|
113
|
-
| `
|
|
114
|
-
| `
|
|
115
|
-
| `
|
|
98
|
+
| Domain | Table key | Anchor column | `maxAge` measures |
|
|
99
|
+
| ----------------- | ------------------ | ---------------- | -------------------------------------------------------------------------------------------------------------------------------- |
|
|
100
|
+
| `memory` | `threads` | `createdAt` | Thread age |
|
|
101
|
+
| `memory` | `messages` | `createdAt` | Message age |
|
|
102
|
+
| `memory` | `resources` | `createdAt` | Resource age |
|
|
103
|
+
| `memory` | `runFences` | `retiredAt` | Time since the durable agent execution holding the fence settled. Fences of running executions (`NULL`) are never pruned |
|
|
104
|
+
| `threadState` | `threadState` | `updatedAt` | Inactivity: state for still-active threads survives |
|
|
105
|
+
| `observability` | `spans` | `startedAt` | Span age |
|
|
106
|
+
| `observability` | `metrics` | `timestamp` | Metric event age (vNext only) |
|
|
107
|
+
| `observability` | `logs` | `timestamp` | Log event age (vNext only) |
|
|
108
|
+
| `observability` | `scores` | `timestamp` | Score event age (vNext only) |
|
|
109
|
+
| `observability` | `feedback` | `timestamp` | Feedback event age (vNext only) |
|
|
110
|
+
| `scores` | `scorers` | `createdAt` | Score record age |
|
|
111
|
+
| `workflows` | `workflowSnapshot` | `updatedAt` | Inactivity, suspended or long-running workflows survive |
|
|
112
|
+
| `workflows` | `runOwnership` | `updatedAt` | Inactivity. A running durable agent execution renews its claim every 10 seconds, so keep `maxAge` well above its 30-second lease |
|
|
113
|
+
| `backgroundTasks` | `backgroundTasks` | `completedAt` | Time since completion, in-flight tasks (`NULL`) are never pruned |
|
|
114
|
+
| `experiments` | `experiments` | `completedAt` | Time since completion, running experiments are never pruned |
|
|
115
|
+
| `notifications` | `notifications` | `createdAt` | Notification age |
|
|
116
|
+
| `harness` | `sessions` | `createdAt` | Session record age |
|
|
117
|
+
| `schedules` | `triggers` | `actual_fire_at` | Fire-history age (epoch-ms column) |
|
|
116
118
|
|
|
117
119
|
> **Note:**
|
|
118
120
|
>
|
|
119
121
|
> - The memory `observational_memory` table has no timestamp anchor, so it can't be age-pruned and isn't a valid retention key.
|
|
120
122
|
> - Experiments prune as whole units: an aged experiment's result rows are deleted together with it (results cascade with their parent), so a run is never left partially deleted. Retention doesn't have a separate `results` key.
|
|
123
|
+
> - `runOwnership` and `runFences` hold the run fencing records of durable agents, one small record per run in each. If the `runOwnership` `maxAge` is too short, a running execution can lose its run, but an execution that lost a run still can't write. A fence is retired only when its execution settles, so the fence of a run that crashed and was never recovered is never pruned.
|
|
121
124
|
> - For `schedules`, the growth table is the fire history (`schedule_triggers`, one row per fire): schedule definitions are config and aren't pruned.
|
|
122
125
|
> - On PostgreSQL, timestamp anchors use the timezone-aware mirror columns (for example `createdAtZ`, `completedAtZ`).
|
|
123
126
|
> - DuckDB observability stores append-only events for all five signals. Its `spans` policy uses the event `timestamp` column rather than `startedAt`.
|