@mastra/libsql 1.27.0 → 1.27.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_types/@internal_core/dist/knowledge-compat/index.d.ts +48 -50
- package/dist/_types/@internal_core/dist/memory/index.d.ts +12 -15
- package/dist/docs/SKILL.md +2 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/docs/references/docs-agents-human-in-the-loop.md +27 -5
- package/dist/docs/references/docs-agents-networks.md +1 -1
- package/dist/docs/references/docs-memory-memory-processors.md +7 -7
- package/dist/docs/references/docs-memory-message-history.md +8 -5
- package/dist/docs/references/docs-memory-multi-user-threads.md +1 -1
- package/dist/docs/references/docs-memory-overview.md +6 -0
- package/dist/docs/references/docs-memory-semantic-recall.md +7 -3
- package/dist/docs/references/docs-memory-working-memory.md +2 -2
- package/dist/docs/references/docs-signals-overview.md +94 -0
- package/dist/docs/references/docs-storage.md +1 -1
- package/dist/docs/references/docs-studio-editor.md +39 -23
- package/dist/docs/references/integrations-channels-github.md +2 -2
- package/dist/docs/references/integrations-databases-dynamodb.md +4 -4
- package/dist/docs/references/reference-core-mastra-class.md +7 -5
- package/dist/docs/references/reference-memory-memory-class.md +5 -5
- package/dist/docs/references/reference-rag-retrieval.md +24 -13
- package/dist/docs/references/reference-storage-retention.md +1 -1
- package/dist/docs/references/reference-vectors-libsql.md +1 -1
- package/dist/index.cjs +43 -85
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +43 -85
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/package.json +12 -12
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
declare const
|
|
3
|
-
declare const
|
|
4
|
-
declare const KNOWLEDGE_STORAGE_SCHEMA_VERSION: 2;
|
|
1
|
+
export declare const KNOWLEDGE_V2_CORE_FEATURE = "knowledge-v2";
|
|
2
|
+
export declare const KNOWLEDGE_STORAGE_CONTRACT_VERSION: 2;
|
|
3
|
+
export declare const KNOWLEDGE_STORAGE_SCHEMA_VERSION: 2;
|
|
5
4
|
/** Hard cap on scope nodes returned by one `listScopeNodes` read. */
|
|
6
|
-
declare const MAX_KNOWLEDGE_SCOPE_NODES = 1000;
|
|
7
|
-
interface ListKnowledgeScopeNodesInput {
|
|
5
|
+
export declare const MAX_KNOWLEDGE_SCOPE_NODES = 1000;
|
|
6
|
+
export interface ListKnowledgeScopeNodesInput {
|
|
8
7
|
/** Only the scope at this address and the scopes beneath it, following parent edges transitively. */
|
|
9
8
|
withinAddress?: string;
|
|
10
9
|
/** Only the scopes at these exact addresses. */
|
|
@@ -16,15 +15,15 @@ interface ListKnowledgeScopeNodesInput {
|
|
|
16
15
|
/** Page size, from 1 to `MAX_KNOWLEDGE_SCOPE_NODES` (the default). */
|
|
17
16
|
limit?: number;
|
|
18
17
|
}
|
|
19
|
-
interface ListKnowledgeScopeNodesOutput {
|
|
18
|
+
export interface ListKnowledgeScopeNodesOutput {
|
|
20
19
|
/** Scope nodes ordered by name, then id. */
|
|
21
20
|
scopes: KnowledgeScopeNodeSummary[];
|
|
22
21
|
/** Pass back as `cursor` for the next page; `null` when this is the last page. */
|
|
23
22
|
nextCursor: string | null;
|
|
24
23
|
}
|
|
25
|
-
declare function createKnowledgeScopeNodeCursor(scope: Pick<KnowledgeScopeNodeSummary, 'name' | 'id'>, input: ListKnowledgeScopeNodesInput): string;
|
|
24
|
+
export declare function createKnowledgeScopeNodeCursor(scope: Pick<KnowledgeScopeNodeSummary, 'name' | 'id'>, input: ListKnowledgeScopeNodesInput): string;
|
|
26
25
|
/** Validates the page size and cursor of a `listScopeNodes` query; throws on a cursor from a different query. */
|
|
27
|
-
declare function parseListKnowledgeScopeNodesInput(input?: ListKnowledgeScopeNodesInput): {
|
|
26
|
+
export declare function parseListKnowledgeScopeNodesInput(input?: ListKnowledgeScopeNodesInput): {
|
|
28
27
|
limit: number;
|
|
29
28
|
after: {
|
|
30
29
|
name: string;
|
|
@@ -32,9 +31,9 @@ declare function parseListKnowledgeScopeNodesInput(input?: ListKnowledgeScopeNod
|
|
|
32
31
|
} | null;
|
|
33
32
|
};
|
|
34
33
|
/** Builds a page from up to `limit + 1` name/id-ordered scope nodes. */
|
|
35
|
-
declare function pageKnowledgeScopeNodes(rows: KnowledgeScopeNodeSummary[], limit: number, input: ListKnowledgeScopeNodesInput): ListKnowledgeScopeNodesOutput;
|
|
34
|
+
export declare function pageKnowledgeScopeNodes(rows: KnowledgeScopeNodeSummary[], limit: number, input: ListKnowledgeScopeNodesInput): ListKnowledgeScopeNodesOutput;
|
|
36
35
|
/** A node placed inside a structural scope. Child scopes are members too, with `scope: null`. */
|
|
37
|
-
interface KnowledgeScopeMember {
|
|
36
|
+
export interface KnowledgeScopeMember {
|
|
38
37
|
id: string;
|
|
39
38
|
type: 'node';
|
|
40
39
|
name: string;
|
|
@@ -47,14 +46,14 @@ interface KnowledgeScopeMember {
|
|
|
47
46
|
createdAt: Date;
|
|
48
47
|
updatedAt: Date;
|
|
49
48
|
}
|
|
50
|
-
interface ListKnowledgeScopeMembersInput {
|
|
49
|
+
export interface ListKnowledgeScopeMembersInput {
|
|
51
50
|
scopeNodeId: string;
|
|
52
51
|
/** `nextCursor` from the previous page for the same scope. */
|
|
53
52
|
cursor?: string;
|
|
54
53
|
/** Members to return, 1–500 (default 500). */
|
|
55
54
|
limit?: number;
|
|
56
55
|
}
|
|
57
|
-
interface ListKnowledgeScopeMembersOutput {
|
|
56
|
+
export interface ListKnowledgeScopeMembersOutput {
|
|
58
57
|
/** Most recently updated members first (ties by name, then ID), at most `limit`. */
|
|
59
58
|
members: KnowledgeScopeMember[];
|
|
60
59
|
/** True when the scope has more members than were returned. */
|
|
@@ -62,11 +61,11 @@ interface ListKnowledgeScopeMembersOutput {
|
|
|
62
61
|
/** Pass as `cursor` to read the next page; `null` on the last page. */
|
|
63
62
|
nextCursor: string | null;
|
|
64
63
|
}
|
|
65
|
-
declare const MAX_KNOWLEDGE_SCOPE_MEMBERS_LIMIT = 500;
|
|
64
|
+
export declare const MAX_KNOWLEDGE_SCOPE_MEMBERS_LIMIT = 500;
|
|
66
65
|
/** Clamps a requested member limit to 1–{@link MAX_KNOWLEDGE_SCOPE_MEMBERS_LIMIT}. */
|
|
67
|
-
declare function knowledgeScopeMembersLimit(limit: number | undefined): number;
|
|
66
|
+
export declare function knowledgeScopeMembersLimit(limit: number | undefined): number;
|
|
68
67
|
/** Validates the page size and cursor of a `listScopeMembers` query; throws on a cursor from another scope. */
|
|
69
|
-
declare function parseListKnowledgeScopeMembersInput(input: ListKnowledgeScopeMembersInput): {
|
|
68
|
+
export declare function parseListKnowledgeScopeMembersInput(input: ListKnowledgeScopeMembersInput): {
|
|
70
69
|
limit: number;
|
|
71
70
|
after: {
|
|
72
71
|
updatedAt: Date;
|
|
@@ -75,9 +74,9 @@ declare function parseListKnowledgeScopeMembersInput(input: ListKnowledgeScopeMe
|
|
|
75
74
|
} | null;
|
|
76
75
|
};
|
|
77
76
|
/** Builds a page from up to `limit + 1` members in `listScopeMembers` order. */
|
|
78
|
-
declare function pageKnowledgeScopeMembers(rows: KnowledgeScopeMember[], limit: number, input: ListKnowledgeScopeMembersInput): ListKnowledgeScopeMembersOutput;
|
|
77
|
+
export declare function pageKnowledgeScopeMembers(rows: KnowledgeScopeMember[], limit: number, input: ListKnowledgeScopeMembersInput): ListKnowledgeScopeMembersOutput;
|
|
79
78
|
/** A reconciled structural scope node with its containing scope nodes. */
|
|
80
|
-
interface KnowledgeScopeNodeSummary {
|
|
79
|
+
export interface KnowledgeScopeNodeSummary {
|
|
81
80
|
/** UUID of the `isScope` node. */
|
|
82
81
|
id: string;
|
|
83
82
|
/** Canonical address the scope node was reconciled from (e.g. `features:memory`). */
|
|
@@ -88,22 +87,22 @@ interface KnowledgeScopeNodeSummary {
|
|
|
88
87
|
/** UUIDs of the scope nodes that contain this scope (membership edges). */
|
|
89
88
|
parentIds: string[];
|
|
90
89
|
}
|
|
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"];
|
|
90
|
+
export declare const TABLE_KNOWLEDGE_NODE_SCOPES = "mastra_knowledge_node_scopes";
|
|
91
|
+
export declare const TABLE_KNOWLEDGE_RECORD_SCOPES = "mastra_knowledge_record_scopes";
|
|
92
|
+
export declare const TABLE_KNOWLEDGE_SCOPE_GRANTS = "mastra_knowledge_scope_grants";
|
|
93
|
+
export declare const TABLE_KNOWLEDGE_ACCESS_STATE = "mastra_knowledge_access_state";
|
|
94
|
+
export declare const TABLE_KNOWLEDGE_SCOPE_ADDRESSES = "mastra_knowledge_scope_addresses";
|
|
95
|
+
export declare const TABLE_KNOWLEDGE_NODE_ADDRESSES = "mastra_knowledge_node_addresses";
|
|
96
|
+
export declare const TABLE_KNOWLEDGE_IMPORT_STATE = "mastra_knowledge_import_state";
|
|
97
|
+
export declare const TABLE_KNOWLEDGE_IMPORT_RUNS = "mastra_knowledge_import_runs";
|
|
98
|
+
export declare const TABLE_KNOWLEDGE_PROPOSALS = "mastra_knowledge_proposals";
|
|
99
|
+
export 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
100
|
/** Knowledge v1 tables with no v2 equivalent; an explicit schema reset drops them. */
|
|
102
|
-
declare const RETIRED_KNOWLEDGE_TABLE_NAMES: readonly ['mastra_knowledge_cursors'];
|
|
101
|
+
export declare const RETIRED_KNOWLEDGE_TABLE_NAMES: readonly ['mastra_knowledge_cursors'];
|
|
103
102
|
/** 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: {
|
|
103
|
+
export declare const PUBLISHED_KNOWLEDGE_V1_TABLE_NAMES: ReadonlySet<string>;
|
|
104
|
+
export declare const PUBLISHED_KNOWLEDGE_V1_INDEX_NAMES: ReadonlySet<string>;
|
|
105
|
+
export declare const KNOWLEDGE_V2_NODES_SCHEMA: {
|
|
107
106
|
readonly id: {
|
|
108
107
|
readonly type: 'text';
|
|
109
108
|
readonly nullable: false;
|
|
@@ -174,7 +173,7 @@ declare const KNOWLEDGE_V2_NODES_SCHEMA: {
|
|
|
174
173
|
readonly nullable: true;
|
|
175
174
|
};
|
|
176
175
|
};
|
|
177
|
-
declare const KNOWLEDGE_V2_RECORDS_SCHEMA: {
|
|
176
|
+
export declare const KNOWLEDGE_V2_RECORDS_SCHEMA: {
|
|
178
177
|
readonly id: {
|
|
179
178
|
readonly type: 'text';
|
|
180
179
|
readonly nullable: false;
|
|
@@ -233,7 +232,7 @@ declare const KNOWLEDGE_V2_RECORDS_SCHEMA: {
|
|
|
233
232
|
readonly nullable: true;
|
|
234
233
|
};
|
|
235
234
|
};
|
|
236
|
-
declare const KNOWLEDGE_V2_MENTIONS_SCHEMA: {
|
|
235
|
+
export declare const KNOWLEDGE_V2_MENTIONS_SCHEMA: {
|
|
237
236
|
readonly recordId: {
|
|
238
237
|
readonly type: 'text';
|
|
239
238
|
readonly nullable: false;
|
|
@@ -259,7 +258,7 @@ declare const KNOWLEDGE_V2_MENTIONS_SCHEMA: {
|
|
|
259
258
|
readonly nullable: true;
|
|
260
259
|
};
|
|
261
260
|
};
|
|
262
|
-
declare const KNOWLEDGE_NODE_SCOPES_SCHEMA: {
|
|
261
|
+
export declare const KNOWLEDGE_NODE_SCOPES_SCHEMA: {
|
|
263
262
|
readonly nodeId: {
|
|
264
263
|
readonly type: 'text';
|
|
265
264
|
readonly nullable: false;
|
|
@@ -281,7 +280,7 @@ declare const KNOWLEDGE_NODE_SCOPES_SCHEMA: {
|
|
|
281
280
|
readonly nullable: false;
|
|
282
281
|
};
|
|
283
282
|
};
|
|
284
|
-
declare const KNOWLEDGE_RECORD_SCOPES_SCHEMA: {
|
|
283
|
+
export declare const KNOWLEDGE_RECORD_SCOPES_SCHEMA: {
|
|
285
284
|
readonly recordId: {
|
|
286
285
|
readonly type: 'text';
|
|
287
286
|
readonly nullable: false;
|
|
@@ -303,7 +302,7 @@ declare const KNOWLEDGE_RECORD_SCOPES_SCHEMA: {
|
|
|
303
302
|
readonly nullable: false;
|
|
304
303
|
};
|
|
305
304
|
};
|
|
306
|
-
declare const KNOWLEDGE_SCOPE_GRANTS_SCHEMA: {
|
|
305
|
+
export declare const KNOWLEDGE_SCOPE_GRANTS_SCHEMA: {
|
|
307
306
|
readonly scopeNodeId: {
|
|
308
307
|
readonly type: 'text';
|
|
309
308
|
readonly nullable: false;
|
|
@@ -329,7 +328,7 @@ declare const KNOWLEDGE_SCOPE_GRANTS_SCHEMA: {
|
|
|
329
328
|
readonly nullable: true;
|
|
330
329
|
};
|
|
331
330
|
};
|
|
332
|
-
declare const KNOWLEDGE_ACCESS_STATE_SCHEMA: {
|
|
331
|
+
export declare const KNOWLEDGE_ACCESS_STATE_SCHEMA: {
|
|
333
332
|
readonly id: {
|
|
334
333
|
readonly type: 'text';
|
|
335
334
|
readonly nullable: false;
|
|
@@ -344,7 +343,7 @@ declare const KNOWLEDGE_ACCESS_STATE_SCHEMA: {
|
|
|
344
343
|
readonly nullable: false;
|
|
345
344
|
};
|
|
346
345
|
};
|
|
347
|
-
declare const KNOWLEDGE_SCOPE_ADDRESSES_SCHEMA: {
|
|
346
|
+
export declare const KNOWLEDGE_SCOPE_ADDRESSES_SCHEMA: {
|
|
348
347
|
readonly address: {
|
|
349
348
|
readonly type: 'text';
|
|
350
349
|
readonly nullable: false;
|
|
@@ -359,7 +358,7 @@ declare const KNOWLEDGE_SCOPE_ADDRESSES_SCHEMA: {
|
|
|
359
358
|
};
|
|
360
359
|
};
|
|
361
360
|
};
|
|
362
|
-
declare const KNOWLEDGE_NODE_ADDRESSES_SCHEMA: {
|
|
361
|
+
export declare const KNOWLEDGE_NODE_ADDRESSES_SCHEMA: {
|
|
363
362
|
readonly source: {
|
|
364
363
|
readonly type: 'text';
|
|
365
364
|
readonly nullable: false;
|
|
@@ -377,7 +376,7 @@ declare const KNOWLEDGE_NODE_ADDRESSES_SCHEMA: {
|
|
|
377
376
|
};
|
|
378
377
|
};
|
|
379
378
|
};
|
|
380
|
-
declare const KNOWLEDGE_IMPORT_STATE_SCHEMA: {
|
|
379
|
+
export declare const KNOWLEDGE_IMPORT_STATE_SCHEMA: {
|
|
381
380
|
readonly importerId: {
|
|
382
381
|
readonly type: 'text';
|
|
383
382
|
readonly nullable: false;
|
|
@@ -395,7 +394,7 @@ declare const KNOWLEDGE_IMPORT_STATE_SCHEMA: {
|
|
|
395
394
|
readonly nullable: false;
|
|
396
395
|
};
|
|
397
396
|
};
|
|
398
|
-
declare const KNOWLEDGE_IMPORT_RUNS_SCHEMA: {
|
|
397
|
+
export declare const KNOWLEDGE_IMPORT_RUNS_SCHEMA: {
|
|
399
398
|
readonly id: {
|
|
400
399
|
readonly type: 'text';
|
|
401
400
|
readonly nullable: false;
|
|
@@ -446,7 +445,7 @@ declare const KNOWLEDGE_IMPORT_RUNS_SCHEMA: {
|
|
|
446
445
|
readonly nullable: true;
|
|
447
446
|
};
|
|
448
447
|
};
|
|
449
|
-
declare const KNOWLEDGE_V2_ACTIVITY_SCHEMA: {
|
|
448
|
+
export declare const KNOWLEDGE_V2_ACTIVITY_SCHEMA: {
|
|
450
449
|
readonly id: {
|
|
451
450
|
readonly type: 'text';
|
|
452
451
|
readonly nullable: false;
|
|
@@ -509,7 +508,7 @@ declare const KNOWLEDGE_V2_ACTIVITY_SCHEMA: {
|
|
|
509
508
|
readonly nullable: true;
|
|
510
509
|
};
|
|
511
510
|
};
|
|
512
|
-
declare const KNOWLEDGE_PROPOSALS_SCHEMA: {
|
|
511
|
+
export declare const KNOWLEDGE_PROPOSALS_SCHEMA: {
|
|
513
512
|
readonly id: {
|
|
514
513
|
readonly type: 'text';
|
|
515
514
|
readonly nullable: false;
|
|
@@ -560,7 +559,7 @@ declare const KNOWLEDGE_PROPOSALS_SCHEMA: {
|
|
|
560
559
|
readonly nullable: false;
|
|
561
560
|
};
|
|
562
561
|
};
|
|
563
|
-
type KnowledgeSchemaInspection = {
|
|
562
|
+
export type KnowledgeSchemaInspection = {
|
|
564
563
|
status: 'compatible';
|
|
565
564
|
schemaVersion: typeof KNOWLEDGE_STORAGE_SCHEMA_VERSION;
|
|
566
565
|
} | {
|
|
@@ -575,7 +574,7 @@ type KnowledgeSchemaInspection = {
|
|
|
575
574
|
schemaVersion: null;
|
|
576
575
|
reason: string;
|
|
577
576
|
};
|
|
578
|
-
interface KnowledgeSchemaSnapshot {
|
|
577
|
+
export interface KnowledgeSchemaSnapshot {
|
|
579
578
|
available: boolean;
|
|
580
579
|
tableNames: readonly string[];
|
|
581
580
|
schemaVersion?: number;
|
|
@@ -587,8 +586,7 @@ interface KnowledgeV2Core {
|
|
|
587
586
|
assertKnowledgeSchemaCompatible(inspection: KnowledgeSchemaInspection): void;
|
|
588
587
|
inspectKnowledgeSchema(snapshot: KnowledgeSchemaSnapshot): KnowledgeSchemaInspection;
|
|
589
588
|
}
|
|
590
|
-
declare function assertKnowledgeV2CoreSupport(features: ReadonlySet<string>): void;
|
|
591
|
-
declare function createKnowledgeV2CoreLoader(features: ReadonlySet<string>, loadStorageModule: () => Promise<unknown>): () => Promise<KnowledgeV2Core>;
|
|
592
|
-
|
|
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 };
|
|
589
|
+
export declare function assertKnowledgeV2CoreSupport(features: ReadonlySet<string>): void;
|
|
590
|
+
export declare function createKnowledgeV2CoreLoader(features: ReadonlySet<string>, loadStorageModule: () => Promise<unknown>): () => Promise<KnowledgeV2Core>;
|
|
591
|
+
export {};
|
|
594
592
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/memory/index.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Shared rules for observational memory lifecycle writes. Every storage adapter applies
|
|
4
3
|
* these inside its own atomic section (lock, transaction, or conditional update), so the
|
|
@@ -9,18 +8,18 @@
|
|
|
9
8
|
* into the table schema they get from `@mastra/core`, so the columns exist even when the
|
|
10
9
|
* installed core predates them.
|
|
11
10
|
*/
|
|
12
|
-
declare const OBSERVATIONAL_MEMORY_LIFECYCLE_COLUMNS: {
|
|
11
|
+
export declare const OBSERVATIONAL_MEMORY_LIFECYCLE_COLUMNS: {
|
|
13
12
|
readonly supersededBy: {
|
|
14
13
|
readonly type: 'text';
|
|
15
14
|
readonly nullable: true;
|
|
16
15
|
};
|
|
17
16
|
};
|
|
18
17
|
/** `schema` plus {@link OBSERVATIONAL_MEMORY_LIFECYCLE_COLUMNS}; `undefined` when `schema` is. */
|
|
19
|
-
declare function withObservationalMemoryLifecycleColumns<T extends object>(schema: T | undefined): (T & typeof OBSERVATIONAL_MEMORY_LIFECYCLE_COLUMNS) | undefined;
|
|
18
|
+
export declare function withObservationalMemoryLifecycleColumns<T extends object>(schema: T | undefined): (T & typeof OBSERVATIONAL_MEMORY_LIFECYCLE_COLUMNS) | undefined;
|
|
20
19
|
/**
|
|
21
20
|
* Result of `commitActiveObservations`.
|
|
22
21
|
*/
|
|
23
|
-
interface UpdateActiveObservationsResult {
|
|
22
|
+
export interface UpdateActiveObservationsResult {
|
|
24
23
|
/** Whether the observations were written. */
|
|
25
24
|
applied: boolean;
|
|
26
25
|
/**
|
|
@@ -38,14 +37,14 @@ interface UpdateActiveObservationsResult {
|
|
|
38
37
|
* the head's cursor. Chunks carry `lastObservedAt = max message time + 1ms`, so a chunk is
|
|
39
38
|
* wholly covered iff `head.lastObservedAt >= chunk.lastObservedAt - 1ms`.
|
|
40
39
|
*/
|
|
41
|
-
interface UpdateBufferedObservationsResult {
|
|
40
|
+
export interface UpdateBufferedObservationsResult {
|
|
42
41
|
/** Whether the chunk was stored. */
|
|
43
42
|
persisted: boolean;
|
|
44
43
|
/** The record the chunk was written to (or would have been written to). */
|
|
45
44
|
recordId: string;
|
|
46
45
|
}
|
|
47
46
|
/** The fields of an observational memory record that decide head order. */
|
|
48
|
-
interface ObservationalMemoryHeadOrderFields {
|
|
47
|
+
export interface ObservationalMemoryHeadOrderFields {
|
|
49
48
|
generationCount: number;
|
|
50
49
|
createdAt: Date | string;
|
|
51
50
|
id: string;
|
|
@@ -54,16 +53,16 @@ interface ObservationalMemoryHeadOrderFields {
|
|
|
54
53
|
* Canonical head order: `generationCount DESC, createdAt ASC, id ASC`.
|
|
55
54
|
* Returns a negative number when `a` sorts before `b` (i.e. `a` is the better head candidate).
|
|
56
55
|
*/
|
|
57
|
-
declare function compareObservationalMemoryHeadOrder(a: ObservationalMemoryHeadOrderFields, b: ObservationalMemoryHeadOrderFields): number;
|
|
56
|
+
export declare function compareObservationalMemoryHeadOrder(a: ObservationalMemoryHeadOrderFields, b: ObservationalMemoryHeadOrderFields): number;
|
|
58
57
|
/**
|
|
59
58
|
* A buffered chunk stores `lastObservedAt = max message time + 1ms`. It is wholly covered
|
|
60
59
|
* (every message it observed is already at or before the cursor) iff
|
|
61
60
|
* `cursor >= chunk.lastObservedAt - 1ms`.
|
|
62
61
|
*/
|
|
63
|
-
declare function isBufferedChunkCoveredByCursor(chunkLastObservedAt: Date | string, cursor: Date | string | null | undefined): boolean;
|
|
62
|
+
export declare function isBufferedChunkCoveredByCursor(chunkLastObservedAt: Date | string, cursor: Date | string | null | undefined): boolean;
|
|
64
63
|
/** The later of two cursors; `undefined` only when both are absent. */
|
|
65
|
-
declare function maxObservationCursor(a: Date | string | null | undefined, b: Date | string | null | undefined): Date | undefined;
|
|
66
|
-
interface ReflectionTextPlan {
|
|
64
|
+
export declare function maxObservationCursor(a: Date | string | null | undefined, b: Date | string | null | undefined): Date | undefined;
|
|
65
|
+
export interface ReflectionTextPlan {
|
|
67
66
|
/** `equal`: stored text equals the snapshot. `append`: observations were appended after the snapshot. */
|
|
68
67
|
mode: 'equal' | 'append';
|
|
69
68
|
observations: string;
|
|
@@ -78,7 +77,7 @@ interface ReflectionTextPlan {
|
|
|
78
77
|
* after the reflection, and its tokens are added.
|
|
79
78
|
* - Anything else (a non-append rewrite): `null` — the reflection must not be applied.
|
|
80
79
|
*/
|
|
81
|
-
declare function planReflectionGenerationText(input: {
|
|
80
|
+
export declare function planReflectionGenerationText(input: {
|
|
82
81
|
storedObservations: string;
|
|
83
82
|
storedObservationTokenCount: number;
|
|
84
83
|
snapshotObservations: string;
|
|
@@ -91,12 +90,10 @@ declare function planReflectionGenerationText(input: {
|
|
|
91
90
|
* Callers of `updateActiveObservations` (which resolves `void`) can't see a commit result, so a
|
|
92
91
|
* write that was not applied throws instead of resolving as if it had committed.
|
|
93
92
|
*/
|
|
94
|
-
declare function assertActiveObservationsApplied(result: UpdateActiveObservationsResult, id: string): void;
|
|
93
|
+
export declare function assertActiveObservationsApplied(result: UpdateActiveObservationsResult, id: string): void;
|
|
95
94
|
/**
|
|
96
95
|
* Whether the stored text can still accept a reflection built from `snapshot`
|
|
97
96
|
* (equal, or only appended to since).
|
|
98
97
|
*/
|
|
99
|
-
declare function isAppendOnlySince(storedObservations: string, snapshotObservations: string): boolean;
|
|
100
|
-
//#endregion
|
|
101
|
-
export { OBSERVATIONAL_MEMORY_LIFECYCLE_COLUMNS, ObservationalMemoryHeadOrderFields, ReflectionTextPlan, UpdateActiveObservationsResult, UpdateBufferedObservationsResult, assertActiveObservationsApplied, compareObservationalMemoryHeadOrder, isAppendOnlySince, isBufferedChunkCoveredByCursor, maxObservationCursor, planReflectionGenerationText, withObservationalMemoryLifecycleColumns };
|
|
98
|
+
export declare function isAppendOnlySince(storedObservations: string, snapshotObservations: string): boolean;
|
|
102
99
|
//# sourceMappingURL=index.d.ts.map
|
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: "1.27.0"
|
|
6
|
+
version: "1.27.1-alpha.0"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
## When to use
|
|
@@ -25,6 +25,7 @@ Read the individual reference documents for detailed explanations and code examp
|
|
|
25
25
|
- [Memory](references/docs-memory-overview.md) - Add memory to Mastra agents with message history, semantic recall, working memory, and observational memory across threads and multi-agent delegation.
|
|
26
26
|
- [Semantic recall](references/docs-memory-semantic-recall.md) - Retrieve relevant messages from past Mastra conversations with semantic recall, vector search, embeddings, metadata filters, and configurable storage.
|
|
27
27
|
- [Working memory](references/docs-memory-working-memory.md) - Persist user profiles, preferences, and application data with Mastra working memory using resource- or thread-scoped templates and storage adapters.
|
|
28
|
+
- [Signals](references/docs-signals-overview.md) - Send asynchronous input into a Mastra agent thread while Mastra manages whether the agent is active or idle.
|
|
28
29
|
- [Storage](references/docs-storage.md) - Configure Mastra storage to persist memory, workflow state, observability data, evals, schedules, and long-running agent state across restarts.
|
|
29
30
|
- [Editor](references/docs-studio-editor.md) - Use Mastra Studio Editor so collaborators can change agent instructions and tools without modifying source code, from draft testing through publication.
|
|
30
31
|
- [Snapshots](references/docs-workflows-snapshots.md) - Store and retrieve Mastra workflow snapshots so suspended executions preserve step results and state and can resume reliably across processes.
|
|
@@ -36,7 +36,7 @@ const deleteTool = createTool({
|
|
|
36
36
|
const agent = new Agent({
|
|
37
37
|
id: 'my-agent',
|
|
38
38
|
name: 'My Agent',
|
|
39
|
-
model: 'openai/gpt-
|
|
39
|
+
model: 'openai/gpt-6-luna',
|
|
40
40
|
tools: { deleteTool },
|
|
41
41
|
})
|
|
42
42
|
|
|
@@ -179,7 +179,7 @@ const approvedFingerprints = new Set<string>()
|
|
|
179
179
|
export const approvalBoundAgent = new Agent({
|
|
180
180
|
id: 'approval-bound-agent',
|
|
181
181
|
name: 'Approval Bound Agent',
|
|
182
|
-
model: 'openai/gpt-
|
|
182
|
+
model: 'openai/gpt-6.1-sol',
|
|
183
183
|
tools: { issueRefundTool, deleteRecordTool },
|
|
184
184
|
hooks: {
|
|
185
185
|
beforeToolCall: ({ toolName, input }) => {
|
|
@@ -311,6 +311,9 @@ Instead of pausing every tool call at the agent level, you can mark individual t
|
|
|
311
311
|
Set `requireApproval: true` on a tool definition. The tool pauses before execution regardless of whether `requireToolApproval` is set on the agent:
|
|
312
312
|
|
|
313
313
|
```typescript
|
|
314
|
+
import { createTool } from '@mastra/core/tools'
|
|
315
|
+
import { z } from 'zod'
|
|
316
|
+
|
|
314
317
|
export const testTool = createTool({
|
|
315
318
|
id: 'test-tool',
|
|
316
319
|
description: 'Fetches weather for a location',
|
|
@@ -359,6 +362,9 @@ const handleApproval = async () => {
|
|
|
359
362
|
With this approach, neither the agent nor the tool uses `requireApproval`. Instead, the tool's `execute` function calls `suspend()` to pause at a specific point and return context or confirmation prompts to the user. This is useful when approval depends on runtime conditions rather than being unconditional.
|
|
360
363
|
|
|
361
364
|
```typescript
|
|
365
|
+
import { createTool } from '@mastra/core/tools'
|
|
366
|
+
import { z } from 'zod'
|
|
367
|
+
|
|
362
368
|
export const testToolB = createTool({
|
|
363
369
|
id: 'test-tool-b',
|
|
364
370
|
description: 'Fetches weather for a location',
|
|
@@ -410,6 +416,19 @@ const handleResume = async () => {
|
|
|
410
416
|
}
|
|
411
417
|
```
|
|
412
418
|
|
|
419
|
+
With `generate()`, the result has `finishReason: 'suspended'`. The tool's data from `suspend()` is in `suspendPayload.suspendPayload`. Call `resumeGenerate()` with the `resumeSchema` data and `runId`:
|
|
420
|
+
|
|
421
|
+
```typescript
|
|
422
|
+
const output = await agent.generate("What's the weather in London?")
|
|
423
|
+
|
|
424
|
+
if (output.finishReason === 'suspended') {
|
|
425
|
+
console.log(output.suspendPayload.suspendPayload) // { reason: 'Approval required.' }
|
|
426
|
+
|
|
427
|
+
const resumed = await agent.resumeGenerate({ approved: true }, { runId: output.runId! })
|
|
428
|
+
console.log(resumed.text)
|
|
429
|
+
}
|
|
430
|
+
```
|
|
431
|
+
|
|
413
432
|
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.
|
|
414
433
|
|
|
415
434
|
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.
|
|
@@ -426,7 +445,7 @@ const agent = new Agent({
|
|
|
426
445
|
id: 'my-agent',
|
|
427
446
|
name: 'My Agent',
|
|
428
447
|
instructions: 'You are a helpful assistant',
|
|
429
|
-
model: 'openai/gpt-
|
|
448
|
+
model: 'openai/gpt-6-luna',
|
|
430
449
|
tools: { weatherTool },
|
|
431
450
|
memory: new Memory(),
|
|
432
451
|
defaultOptions: {
|
|
@@ -604,7 +623,7 @@ const dataAgent = new Agent({
|
|
|
604
623
|
id: 'data-agent',
|
|
605
624
|
name: 'Data Agent',
|
|
606
625
|
description: 'Handles database queries and user data retrieval',
|
|
607
|
-
model: 'openai/gpt-
|
|
626
|
+
model: 'openai/gpt-6-luna',
|
|
608
627
|
tools: { findUserTool },
|
|
609
628
|
})
|
|
610
629
|
|
|
@@ -613,7 +632,7 @@ const supervisorAgent = new Agent({
|
|
|
613
632
|
name: 'Supervisor Agent',
|
|
614
633
|
instructions: `You coordinate data retrieval tasks.
|
|
615
634
|
Delegate to data-agent for user lookups.`,
|
|
616
|
-
model: 'openai/gpt-
|
|
635
|
+
model: 'openai/gpt-6.1-sol',
|
|
617
636
|
agents: { dataAgent },
|
|
618
637
|
memory: new Memory(),
|
|
619
638
|
})
|
|
@@ -649,6 +668,9 @@ for await (const chunk of stream.fullStream) {
|
|
|
649
668
|
Tools can also use [`suspend()`](#approval-using-suspend) to pause execution and return context to the user. This approach works through the supervisor delegation chain the same way `requireApproval` does: the suspension surfaces at the supervisor level:
|
|
650
669
|
|
|
651
670
|
```typescript
|
|
671
|
+
import { createTool } from '@mastra/core/tools'
|
|
672
|
+
import { z } from 'zod'
|
|
673
|
+
|
|
652
674
|
const conditionalTool = createTool({
|
|
653
675
|
id: 'conditional-operation',
|
|
654
676
|
description: 'Performs an operation that may require confirmation',
|
|
@@ -31,7 +31,7 @@ export const routingAgent = new Agent({
|
|
|
31
31
|
name: 'Routing Agent',
|
|
32
32
|
instructions: `
|
|
33
33
|
You are a network of writers and researchers. The user will ask you to research a topic. Always respond with a complete report—no bullet points. Write in full paragraphs, like a blog post. Do not answer with incomplete or uncertain information.`,
|
|
34
|
-
model: 'openai/gpt-
|
|
34
|
+
model: 'openai/gpt-6.1-sol',
|
|
35
35
|
agents: {
|
|
36
36
|
researchAgent,
|
|
37
37
|
writingAgent,
|
|
@@ -57,7 +57,7 @@ const agent = new Agent({
|
|
|
57
57
|
id: 'test-agent',
|
|
58
58
|
name: 'Test Agent',
|
|
59
59
|
instructions: 'You are a helpful assistant',
|
|
60
|
-
model: 'openai/gpt-
|
|
60
|
+
model: 'openai/gpt-6.1-sol',
|
|
61
61
|
memory: new Memory({
|
|
62
62
|
storage: new LibSQLStore({
|
|
63
63
|
id: 'memory-store',
|
|
@@ -109,7 +109,7 @@ import { openai } from '@ai-sdk/openai'
|
|
|
109
109
|
const agent = new Agent({
|
|
110
110
|
name: 'semantic-agent',
|
|
111
111
|
instructions: 'You are a helpful assistant with semantic memory',
|
|
112
|
-
model: 'openai/gpt-
|
|
112
|
+
model: 'openai/gpt-6.1-sol',
|
|
113
113
|
memory: new Memory({
|
|
114
114
|
storage: new LibSQLStore({
|
|
115
115
|
id: 'memory-store',
|
|
@@ -159,7 +159,7 @@ import { openai } from '@ai-sdk/openai'
|
|
|
159
159
|
const agent = new Agent({
|
|
160
160
|
name: 'working-memory-agent',
|
|
161
161
|
instructions: 'You are an assistant with working memory',
|
|
162
|
-
model: 'openai/gpt-
|
|
162
|
+
model: 'openai/gpt-6.1-sol',
|
|
163
163
|
memory: new Memory({
|
|
164
164
|
storage: new LibSQLStore({
|
|
165
165
|
id: 'memory-store',
|
|
@@ -191,7 +191,7 @@ const customMessageHistory = new MessageHistory({
|
|
|
191
191
|
const agent = new Agent({
|
|
192
192
|
name: 'custom-memory-agent',
|
|
193
193
|
instructions: 'You are a helpful assistant',
|
|
194
|
-
model: 'openai/gpt-
|
|
194
|
+
model: 'openai/gpt-6.1-sol',
|
|
195
195
|
memory: new Memory({
|
|
196
196
|
storage: new LibSQLStore({ id: 'memory-store', url: 'file:memory.db' }),
|
|
197
197
|
options: {
|
|
@@ -264,7 +264,7 @@ const agent = new Agent({
|
|
|
264
264
|
id: 'safe-agent',
|
|
265
265
|
name: 'safe-agent',
|
|
266
266
|
instructions: 'You are a helpful assistant',
|
|
267
|
-
model: 'openai/gpt-
|
|
267
|
+
model: 'openai/gpt-6.1-sol',
|
|
268
268
|
memory: new Memory({ options: { lastMessages: 10 } }),
|
|
269
269
|
// Your guardrail runs BEFORE memory saves
|
|
270
270
|
outputProcessors: [contentBlocker],
|
|
@@ -304,7 +304,7 @@ const agent = new Agent({
|
|
|
304
304
|
id: 'validated-agent',
|
|
305
305
|
name: 'validated-agent',
|
|
306
306
|
instructions: 'You are a helpful assistant',
|
|
307
|
-
model: 'openai/gpt-
|
|
307
|
+
model: 'openai/gpt-6.1-sol',
|
|
308
308
|
memory: new Memory({ options: { lastMessages: 10 } }),
|
|
309
309
|
// Your guardrail runs AFTER memory loads history
|
|
310
310
|
inputProcessors: [inputValidator],
|
|
@@ -381,7 +381,7 @@ export const supportAgent = new Agent({
|
|
|
381
381
|
id: 'support-agent',
|
|
382
382
|
name: 'Support agent',
|
|
383
383
|
instructions: 'Answer customer support questions.',
|
|
384
|
-
model: 'openai/gpt-
|
|
384
|
+
model: 'openai/gpt-6.1-sol',
|
|
385
385
|
memory: new Memory({ options: { lastMessages: 10 } }),
|
|
386
386
|
inputProcessors: [new AttachmentUploader()],
|
|
387
387
|
})
|
|
@@ -116,7 +116,7 @@ You can use this history in two ways:
|
|
|
116
116
|
- **Automatic inclusion**: Mastra automatically includes recent messages in the context window. The default of 10 messages keeps agents grounded in the conversation. Adjust it with `lastMessages` when needed.
|
|
117
117
|
- [**Manual querying**](#querying): For more control, query threads and messages directly with `recall()`. Use the results to choose which memories enter the context window or to render conversation history in your UI.
|
|
118
118
|
|
|
119
|
-
> **Note:** `lastMessages` counts every stored message, including tool calls, tool results, and [signals](https://mastra.ai/docs/
|
|
119
|
+
> **Note:** `lastMessages` counts every stored message, including tool calls, tool results, and [signals](https://mastra.ai/docs/signals/sending-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.
|
|
120
120
|
|
|
121
121
|
### Sending messages from a client
|
|
122
122
|
|
|
@@ -138,6 +138,9 @@ If you assemble the request input yourself and need it processed exactly as sent
|
|
|
138
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:
|
|
139
139
|
|
|
140
140
|
```typescript
|
|
141
|
+
import { Agent } from '@mastra/core/agent'
|
|
142
|
+
import { Memory } from '@mastra/memory'
|
|
143
|
+
|
|
141
144
|
export const agent = new Agent({
|
|
142
145
|
id: 'test-agent',
|
|
143
146
|
memory: new Memory({
|
|
@@ -168,7 +171,7 @@ export const supportAgent = new Agent({
|
|
|
168
171
|
id: 'support-agent',
|
|
169
172
|
name: 'Support agent',
|
|
170
173
|
instructions: 'Answer customer support questions.',
|
|
171
|
-
model: 'openai/gpt-
|
|
174
|
+
model: 'openai/gpt-6.1-sol',
|
|
172
175
|
memory: new Memory({
|
|
173
176
|
options: {
|
|
174
177
|
generateTitle: true,
|
|
@@ -191,7 +194,7 @@ export const supportAgent = new Agent({
|
|
|
191
194
|
id: 'support-agent',
|
|
192
195
|
name: 'Support agent',
|
|
193
196
|
instructions: 'Answer customer support questions.',
|
|
194
|
-
model: 'openai/gpt-
|
|
197
|
+
model: 'openai/gpt-6.1-sol',
|
|
195
198
|
memory: new Memory({
|
|
196
199
|
options: {
|
|
197
200
|
generateTitle: {
|
|
@@ -226,11 +229,11 @@ export const supportAgent = new Agent({
|
|
|
226
229
|
id: 'support-agent',
|
|
227
230
|
name: 'Support agent',
|
|
228
231
|
instructions: 'Answer customer support questions.',
|
|
229
|
-
model: 'openai/gpt-
|
|
232
|
+
model: 'openai/gpt-6.1-sol',
|
|
230
233
|
memory: new Memory({
|
|
231
234
|
options: {
|
|
232
235
|
generateTitle: {
|
|
233
|
-
model: 'openai/gpt-
|
|
236
|
+
model: 'openai/gpt-6-luna',
|
|
234
237
|
instructions: 'Generate a one-word title.',
|
|
235
238
|
},
|
|
236
239
|
},
|
|
@@ -69,7 +69,7 @@ const memory = new Memory({
|
|
|
69
69
|
export const collabAgent = new Agent({
|
|
70
70
|
id: 'collab',
|
|
71
71
|
name: 'CollabAgent',
|
|
72
|
-
model: 'openai/gpt-
|
|
72
|
+
model: 'openai/gpt-6-luna',
|
|
73
73
|
memory,
|
|
74
74
|
instructions: `
|
|
75
75
|
You are a collaborative document assistant. Multiple users talk to you in the SAME thread.
|
|
@@ -164,6 +164,9 @@ const response = await memoryAgent.generate('Remember my favorite color is blue.
|
|
|
164
164
|
Scopes can also come from the agent and from the request context. Mastra combines all three sources:
|
|
165
165
|
|
|
166
166
|
```typescript
|
|
167
|
+
import { Agent } from '@mastra/core/agent'
|
|
168
|
+
import { Memory } from '@mastra/memory'
|
|
169
|
+
|
|
167
170
|
export const memoryAgent = new Agent({
|
|
168
171
|
id: 'memory-agent',
|
|
169
172
|
name: 'Memory Agent',
|
|
@@ -271,6 +274,9 @@ Open [Studio](https://mastra.ai/docs/studio/overview) and select the **Observabi
|
|
|
271
274
|
Use [`RequestContext`](https://mastra.ai/docs/server/request-context) to access request-specific values. This lets you conditionally select different memory or storage configurations based on the context of the request.
|
|
272
275
|
|
|
273
276
|
```typescript
|
|
277
|
+
import { Agent } from '@mastra/core/agent'
|
|
278
|
+
import { Memory } from '@mastra/memory'
|
|
279
|
+
|
|
274
280
|
export type UserTier = {
|
|
275
281
|
'user-tier': 'enterprise' | 'pro'
|
|
276
282
|
}
|