@mastra/pg 1.32.0 → 1.33.0-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.
Files changed (28) hide show
  1. package/dist/_types/@internal_core/dist/knowledge-compat/index.d.ts +48 -48
  2. package/dist/_types/@internal_core/dist/memory/index.d.ts +12 -13
  3. package/dist/docs/SKILL.md +1 -1
  4. package/dist/docs/assets/SOURCE_MAP.json +1 -1
  5. package/dist/docs/references/docs-memory-semantic-recall.md +2 -2
  6. package/dist/docs/references/docs-memory-working-memory.md +2 -2
  7. package/dist/docs/references/docs-storage.md +1 -1
  8. package/dist/docs/references/integrations-databases-postgresql.md +1 -1
  9. package/dist/docs/references/reference-memory-memory-class.md +3 -3
  10. package/dist/docs/references/reference-processors-message-history-processor.md +2 -2
  11. package/dist/docs/references/reference-processors-semantic-recall-processor.md +2 -2
  12. package/dist/docs/references/reference-processors-working-memory-processor.md +2 -2
  13. package/dist/docs/references/reference-rag-chunking-and-embedding.md +1 -1
  14. package/dist/docs/references/reference-rag-metadata-filters.md +1 -1
  15. package/dist/docs/references/reference-rag-retrieval.md +13 -13
  16. package/dist/docs/references/reference-tools-vector-query-tool.md +1 -1
  17. package/dist/docs/references/reference-vectors-pg.md +1 -1
  18. package/dist/index.cjs +112 -30
  19. package/dist/index.cjs.map +1 -1
  20. package/dist/index.js +112 -30
  21. package/dist/index.js.map +1 -1
  22. package/dist/storage/domains/observability/v-next/index.d.ts +3 -2
  23. package/dist/storage/domains/observability/v-next/index.d.ts.map +1 -1
  24. package/dist/storage/domains/observability/v-next/span-query.d.ts +9 -0
  25. package/dist/storage/domains/observability/v-next/span-query.d.ts.map +1 -1
  26. package/dist/storage/domains/observability/v-next/trace-aggregate.d.ts +7 -1
  27. package/dist/storage/domains/observability/v-next/trace-aggregate.d.ts.map +1 -1
  28. package/package.json +6 -6
@@ -1,10 +1,10 @@
1
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;
2
+ export declare const KNOWLEDGE_V2_CORE_FEATURE = "knowledge-v2";
3
+ export declare const KNOWLEDGE_STORAGE_CONTRACT_VERSION: 2;
4
+ export declare const KNOWLEDGE_STORAGE_SCHEMA_VERSION: 2;
5
5
  /** Hard cap on scope nodes returned by one `listScopeNodes` read. */
6
- declare const MAX_KNOWLEDGE_SCOPE_NODES = 1000;
7
- interface ListKnowledgeScopeNodesInput {
6
+ export declare const MAX_KNOWLEDGE_SCOPE_NODES = 1000;
7
+ export interface ListKnowledgeScopeNodesInput {
8
8
  /** Only the scope at this address and the scopes beneath it, following parent edges transitively. */
9
9
  withinAddress?: string;
10
10
  /** Only the scopes at these exact addresses. */
@@ -16,15 +16,15 @@ interface ListKnowledgeScopeNodesInput {
16
16
  /** Page size, from 1 to `MAX_KNOWLEDGE_SCOPE_NODES` (the default). */
17
17
  limit?: number;
18
18
  }
19
- interface ListKnowledgeScopeNodesOutput {
19
+ export interface ListKnowledgeScopeNodesOutput {
20
20
  /** Scope nodes ordered by name, then id. */
21
21
  scopes: KnowledgeScopeNodeSummary[];
22
22
  /** Pass back as `cursor` for the next page; `null` when this is the last page. */
23
23
  nextCursor: string | null;
24
24
  }
25
- declare function createKnowledgeScopeNodeCursor(scope: Pick<KnowledgeScopeNodeSummary, 'name' | 'id'>, input: ListKnowledgeScopeNodesInput): string;
25
+ export declare function createKnowledgeScopeNodeCursor(scope: Pick<KnowledgeScopeNodeSummary, 'name' | 'id'>, input: ListKnowledgeScopeNodesInput): string;
26
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): {
27
+ export declare function parseListKnowledgeScopeNodesInput(input?: ListKnowledgeScopeNodesInput): {
28
28
  limit: number;
29
29
  after: {
30
30
  name: string;
@@ -32,9 +32,9 @@ declare function parseListKnowledgeScopeNodesInput(input?: ListKnowledgeScopeNod
32
32
  } | null;
33
33
  };
34
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;
35
+ export declare function pageKnowledgeScopeNodes(rows: KnowledgeScopeNodeSummary[], limit: number, input: ListKnowledgeScopeNodesInput): ListKnowledgeScopeNodesOutput;
36
36
  /** A node placed inside a structural scope. Child scopes are members too, with `scope: null`. */
37
- interface KnowledgeScopeMember {
37
+ export interface KnowledgeScopeMember {
38
38
  id: string;
39
39
  type: 'node';
40
40
  name: string;
@@ -47,14 +47,14 @@ interface KnowledgeScopeMember {
47
47
  createdAt: Date;
48
48
  updatedAt: Date;
49
49
  }
50
- interface ListKnowledgeScopeMembersInput {
50
+ export interface ListKnowledgeScopeMembersInput {
51
51
  scopeNodeId: string;
52
52
  /** `nextCursor` from the previous page for the same scope. */
53
53
  cursor?: string;
54
54
  /** Members to return, 1–500 (default 500). */
55
55
  limit?: number;
56
56
  }
57
- interface ListKnowledgeScopeMembersOutput {
57
+ export interface ListKnowledgeScopeMembersOutput {
58
58
  /** Most recently updated members first (ties by name, then ID), at most `limit`. */
59
59
  members: KnowledgeScopeMember[];
60
60
  /** True when the scope has more members than were returned. */
@@ -62,11 +62,11 @@ interface ListKnowledgeScopeMembersOutput {
62
62
  /** Pass as `cursor` to read the next page; `null` on the last page. */
63
63
  nextCursor: string | null;
64
64
  }
65
- declare const MAX_KNOWLEDGE_SCOPE_MEMBERS_LIMIT = 500;
65
+ export declare const MAX_KNOWLEDGE_SCOPE_MEMBERS_LIMIT = 500;
66
66
  /** Clamps a requested member limit to 1–{@link MAX_KNOWLEDGE_SCOPE_MEMBERS_LIMIT}. */
67
- declare function knowledgeScopeMembersLimit(limit: number | undefined): number;
67
+ export declare function knowledgeScopeMembersLimit(limit: number | undefined): number;
68
68
  /** Validates the page size and cursor of a `listScopeMembers` query; throws on a cursor from another scope. */
69
- declare function parseListKnowledgeScopeMembersInput(input: ListKnowledgeScopeMembersInput): {
69
+ export declare function parseListKnowledgeScopeMembersInput(input: ListKnowledgeScopeMembersInput): {
70
70
  limit: number;
71
71
  after: {
72
72
  updatedAt: Date;
@@ -75,9 +75,9 @@ declare function parseListKnowledgeScopeMembersInput(input: ListKnowledgeScopeMe
75
75
  } | null;
76
76
  };
77
77
  /** Builds a page from up to `limit + 1` members in `listScopeMembers` order. */
78
- declare function pageKnowledgeScopeMembers(rows: KnowledgeScopeMember[], limit: number, input: ListKnowledgeScopeMembersInput): ListKnowledgeScopeMembersOutput;
78
+ export declare function pageKnowledgeScopeMembers(rows: KnowledgeScopeMember[], limit: number, input: ListKnowledgeScopeMembersInput): ListKnowledgeScopeMembersOutput;
79
79
  /** A reconciled structural scope node with its containing scope nodes. */
80
- interface KnowledgeScopeNodeSummary {
80
+ export interface KnowledgeScopeNodeSummary {
81
81
  /** UUID of the `isScope` node. */
82
82
  id: string;
83
83
  /** Canonical address the scope node was reconciled from (e.g. `features:memory`). */
@@ -88,22 +88,22 @@ interface KnowledgeScopeNodeSummary {
88
88
  /** UUIDs of the scope nodes that contain this scope (membership edges). */
89
89
  parentIds: string[];
90
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"];
91
+ export declare const TABLE_KNOWLEDGE_NODE_SCOPES = "mastra_knowledge_node_scopes";
92
+ export declare const TABLE_KNOWLEDGE_RECORD_SCOPES = "mastra_knowledge_record_scopes";
93
+ export declare const TABLE_KNOWLEDGE_SCOPE_GRANTS = "mastra_knowledge_scope_grants";
94
+ export declare const TABLE_KNOWLEDGE_ACCESS_STATE = "mastra_knowledge_access_state";
95
+ export declare const TABLE_KNOWLEDGE_SCOPE_ADDRESSES = "mastra_knowledge_scope_addresses";
96
+ export declare const TABLE_KNOWLEDGE_NODE_ADDRESSES = "mastra_knowledge_node_addresses";
97
+ export declare const TABLE_KNOWLEDGE_IMPORT_STATE = "mastra_knowledge_import_state";
98
+ export declare const TABLE_KNOWLEDGE_IMPORT_RUNS = "mastra_knowledge_import_runs";
99
+ export declare const TABLE_KNOWLEDGE_PROPOSALS = "mastra_knowledge_proposals";
100
+ 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
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'];
102
+ export declare const RETIRED_KNOWLEDGE_TABLE_NAMES: readonly ['mastra_knowledge_cursors'];
103
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: {
104
+ export declare const PUBLISHED_KNOWLEDGE_V1_TABLE_NAMES: ReadonlySet<string>;
105
+ export declare const PUBLISHED_KNOWLEDGE_V1_INDEX_NAMES: ReadonlySet<string>;
106
+ export declare const KNOWLEDGE_V2_NODES_SCHEMA: {
107
107
  readonly id: {
108
108
  readonly type: 'text';
109
109
  readonly nullable: false;
@@ -174,7 +174,7 @@ declare const KNOWLEDGE_V2_NODES_SCHEMA: {
174
174
  readonly nullable: true;
175
175
  };
176
176
  };
177
- declare const KNOWLEDGE_V2_RECORDS_SCHEMA: {
177
+ export declare const KNOWLEDGE_V2_RECORDS_SCHEMA: {
178
178
  readonly id: {
179
179
  readonly type: 'text';
180
180
  readonly nullable: false;
@@ -233,7 +233,7 @@ declare const KNOWLEDGE_V2_RECORDS_SCHEMA: {
233
233
  readonly nullable: true;
234
234
  };
235
235
  };
236
- declare const KNOWLEDGE_V2_MENTIONS_SCHEMA: {
236
+ export declare const KNOWLEDGE_V2_MENTIONS_SCHEMA: {
237
237
  readonly recordId: {
238
238
  readonly type: 'text';
239
239
  readonly nullable: false;
@@ -259,7 +259,7 @@ declare const KNOWLEDGE_V2_MENTIONS_SCHEMA: {
259
259
  readonly nullable: true;
260
260
  };
261
261
  };
262
- declare const KNOWLEDGE_NODE_SCOPES_SCHEMA: {
262
+ export declare const KNOWLEDGE_NODE_SCOPES_SCHEMA: {
263
263
  readonly nodeId: {
264
264
  readonly type: 'text';
265
265
  readonly nullable: false;
@@ -281,7 +281,7 @@ declare const KNOWLEDGE_NODE_SCOPES_SCHEMA: {
281
281
  readonly nullable: false;
282
282
  };
283
283
  };
284
- declare const KNOWLEDGE_RECORD_SCOPES_SCHEMA: {
284
+ export declare const KNOWLEDGE_RECORD_SCOPES_SCHEMA: {
285
285
  readonly recordId: {
286
286
  readonly type: 'text';
287
287
  readonly nullable: false;
@@ -303,7 +303,7 @@ declare const KNOWLEDGE_RECORD_SCOPES_SCHEMA: {
303
303
  readonly nullable: false;
304
304
  };
305
305
  };
306
- declare const KNOWLEDGE_SCOPE_GRANTS_SCHEMA: {
306
+ export declare const KNOWLEDGE_SCOPE_GRANTS_SCHEMA: {
307
307
  readonly scopeNodeId: {
308
308
  readonly type: 'text';
309
309
  readonly nullable: false;
@@ -329,7 +329,7 @@ declare const KNOWLEDGE_SCOPE_GRANTS_SCHEMA: {
329
329
  readonly nullable: true;
330
330
  };
331
331
  };
332
- declare const KNOWLEDGE_ACCESS_STATE_SCHEMA: {
332
+ export declare const KNOWLEDGE_ACCESS_STATE_SCHEMA: {
333
333
  readonly id: {
334
334
  readonly type: 'text';
335
335
  readonly nullable: false;
@@ -344,7 +344,7 @@ declare const KNOWLEDGE_ACCESS_STATE_SCHEMA: {
344
344
  readonly nullable: false;
345
345
  };
346
346
  };
347
- declare const KNOWLEDGE_SCOPE_ADDRESSES_SCHEMA: {
347
+ export declare const KNOWLEDGE_SCOPE_ADDRESSES_SCHEMA: {
348
348
  readonly address: {
349
349
  readonly type: 'text';
350
350
  readonly nullable: false;
@@ -359,7 +359,7 @@ declare const KNOWLEDGE_SCOPE_ADDRESSES_SCHEMA: {
359
359
  };
360
360
  };
361
361
  };
362
- declare const KNOWLEDGE_NODE_ADDRESSES_SCHEMA: {
362
+ export declare const KNOWLEDGE_NODE_ADDRESSES_SCHEMA: {
363
363
  readonly source: {
364
364
  readonly type: 'text';
365
365
  readonly nullable: false;
@@ -377,7 +377,7 @@ declare const KNOWLEDGE_NODE_ADDRESSES_SCHEMA: {
377
377
  };
378
378
  };
379
379
  };
380
- declare const KNOWLEDGE_IMPORT_STATE_SCHEMA: {
380
+ export declare const KNOWLEDGE_IMPORT_STATE_SCHEMA: {
381
381
  readonly importerId: {
382
382
  readonly type: 'text';
383
383
  readonly nullable: false;
@@ -395,7 +395,7 @@ declare const KNOWLEDGE_IMPORT_STATE_SCHEMA: {
395
395
  readonly nullable: false;
396
396
  };
397
397
  };
398
- declare const KNOWLEDGE_IMPORT_RUNS_SCHEMA: {
398
+ export declare const KNOWLEDGE_IMPORT_RUNS_SCHEMA: {
399
399
  readonly id: {
400
400
  readonly type: 'text';
401
401
  readonly nullable: false;
@@ -446,7 +446,7 @@ declare const KNOWLEDGE_IMPORT_RUNS_SCHEMA: {
446
446
  readonly nullable: true;
447
447
  };
448
448
  };
449
- declare const KNOWLEDGE_V2_ACTIVITY_SCHEMA: {
449
+ export declare const KNOWLEDGE_V2_ACTIVITY_SCHEMA: {
450
450
  readonly id: {
451
451
  readonly type: 'text';
452
452
  readonly nullable: false;
@@ -509,7 +509,7 @@ declare const KNOWLEDGE_V2_ACTIVITY_SCHEMA: {
509
509
  readonly nullable: true;
510
510
  };
511
511
  };
512
- declare const KNOWLEDGE_PROPOSALS_SCHEMA: {
512
+ export declare const KNOWLEDGE_PROPOSALS_SCHEMA: {
513
513
  readonly id: {
514
514
  readonly type: 'text';
515
515
  readonly nullable: false;
@@ -560,7 +560,7 @@ declare const KNOWLEDGE_PROPOSALS_SCHEMA: {
560
560
  readonly nullable: false;
561
561
  };
562
562
  };
563
- type KnowledgeSchemaInspection = {
563
+ export type KnowledgeSchemaInspection = {
564
564
  status: 'compatible';
565
565
  schemaVersion: typeof KNOWLEDGE_STORAGE_SCHEMA_VERSION;
566
566
  } | {
@@ -575,7 +575,7 @@ type KnowledgeSchemaInspection = {
575
575
  schemaVersion: null;
576
576
  reason: string;
577
577
  };
578
- interface KnowledgeSchemaSnapshot {
578
+ export interface KnowledgeSchemaSnapshot {
579
579
  available: boolean;
580
580
  tableNames: readonly string[];
581
581
  schemaVersion?: number;
@@ -587,8 +587,8 @@ interface KnowledgeV2Core {
587
587
  assertKnowledgeSchemaCompatible(inspection: KnowledgeSchemaInspection): void;
588
588
  inspectKnowledgeSchema(snapshot: KnowledgeSchemaSnapshot): KnowledgeSchemaInspection;
589
589
  }
590
- declare function assertKnowledgeV2CoreSupport(features: ReadonlySet<string>): void;
591
- declare function createKnowledgeV2CoreLoader(features: ReadonlySet<string>, loadStorageModule: () => Promise<unknown>): () => Promise<KnowledgeV2Core>;
590
+ export declare function assertKnowledgeV2CoreSupport(features: ReadonlySet<string>): void;
591
+ export declare function createKnowledgeV2CoreLoader(features: ReadonlySet<string>, loadStorageModule: () => Promise<unknown>): () => Promise<KnowledgeV2Core>;
592
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 };
593
+ export {};
594
594
  //# sourceMappingURL=index.d.ts.map
@@ -9,18 +9,18 @@
9
9
  * into the table schema they get from `@mastra/core`, so the columns exist even when the
10
10
  * installed core predates them.
11
11
  */
12
- declare const OBSERVATIONAL_MEMORY_LIFECYCLE_COLUMNS: {
12
+ export declare const OBSERVATIONAL_MEMORY_LIFECYCLE_COLUMNS: {
13
13
  readonly supersededBy: {
14
14
  readonly type: 'text';
15
15
  readonly nullable: true;
16
16
  };
17
17
  };
18
18
  /** `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;
19
+ export declare function withObservationalMemoryLifecycleColumns<T extends object>(schema: T | undefined): (T & typeof OBSERVATIONAL_MEMORY_LIFECYCLE_COLUMNS) | undefined;
20
20
  /**
21
21
  * Result of `commitActiveObservations`.
22
22
  */
23
- interface UpdateActiveObservationsResult {
23
+ export interface UpdateActiveObservationsResult {
24
24
  /** Whether the observations were written. */
25
25
  applied: boolean;
26
26
  /**
@@ -38,14 +38,14 @@ interface UpdateActiveObservationsResult {
38
38
  * the head's cursor. Chunks carry `lastObservedAt = max message time + 1ms`, so a chunk is
39
39
  * wholly covered iff `head.lastObservedAt >= chunk.lastObservedAt - 1ms`.
40
40
  */
41
- interface UpdateBufferedObservationsResult {
41
+ export interface UpdateBufferedObservationsResult {
42
42
  /** Whether the chunk was stored. */
43
43
  persisted: boolean;
44
44
  /** The record the chunk was written to (or would have been written to). */
45
45
  recordId: string;
46
46
  }
47
47
  /** The fields of an observational memory record that decide head order. */
48
- interface ObservationalMemoryHeadOrderFields {
48
+ export interface ObservationalMemoryHeadOrderFields {
49
49
  generationCount: number;
50
50
  createdAt: Date | string;
51
51
  id: string;
@@ -54,16 +54,16 @@ interface ObservationalMemoryHeadOrderFields {
54
54
  * Canonical head order: `generationCount DESC, createdAt ASC, id ASC`.
55
55
  * Returns a negative number when `a` sorts before `b` (i.e. `a` is the better head candidate).
56
56
  */
57
- declare function compareObservationalMemoryHeadOrder(a: ObservationalMemoryHeadOrderFields, b: ObservationalMemoryHeadOrderFields): number;
57
+ export declare function compareObservationalMemoryHeadOrder(a: ObservationalMemoryHeadOrderFields, b: ObservationalMemoryHeadOrderFields): number;
58
58
  /**
59
59
  * A buffered chunk stores `lastObservedAt = max message time + 1ms`. It is wholly covered
60
60
  * (every message it observed is already at or before the cursor) iff
61
61
  * `cursor >= chunk.lastObservedAt - 1ms`.
62
62
  */
63
- declare function isBufferedChunkCoveredByCursor(chunkLastObservedAt: Date | string, cursor: Date | string | null | undefined): boolean;
63
+ export declare function isBufferedChunkCoveredByCursor(chunkLastObservedAt: Date | string, cursor: Date | string | null | undefined): boolean;
64
64
  /** 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 {
65
+ export declare function maxObservationCursor(a: Date | string | null | undefined, b: Date | string | null | undefined): Date | undefined;
66
+ export interface ReflectionTextPlan {
67
67
  /** `equal`: stored text equals the snapshot. `append`: observations were appended after the snapshot. */
68
68
  mode: 'equal' | 'append';
69
69
  observations: string;
@@ -78,7 +78,7 @@ interface ReflectionTextPlan {
78
78
  * after the reflection, and its tokens are added.
79
79
  * - Anything else (a non-append rewrite): `null` — the reflection must not be applied.
80
80
  */
81
- declare function planReflectionGenerationText(input: {
81
+ export declare function planReflectionGenerationText(input: {
82
82
  storedObservations: string;
83
83
  storedObservationTokenCount: number;
84
84
  snapshotObservations: string;
@@ -91,12 +91,11 @@ declare function planReflectionGenerationText(input: {
91
91
  * Callers of `updateActiveObservations` (which resolves `void`) can't see a commit result, so a
92
92
  * write that was not applied throws instead of resolving as if it had committed.
93
93
  */
94
- declare function assertActiveObservationsApplied(result: UpdateActiveObservationsResult, id: string): void;
94
+ export declare function assertActiveObservationsApplied(result: UpdateActiveObservationsResult, id: string): void;
95
95
  /**
96
96
  * Whether the stored text can still accept a reflection built from `snapshot`
97
97
  * (equal, or only appended to since).
98
98
  */
99
- declare function isAppendOnlySince(storedObservations: string, snapshotObservations: string): boolean;
99
+ export declare function isAppendOnlySince(storedObservations: string, snapshotObservations: string): boolean;
100
100
  //#endregion
101
- export { OBSERVATIONAL_MEMORY_LIFECYCLE_COLUMNS, ObservationalMemoryHeadOrderFields, ReflectionTextPlan, UpdateActiveObservationsResult, UpdateBufferedObservationsResult, assertActiveObservationsApplied, compareObservationalMemoryHeadOrder, isAppendOnlySince, isBufferedChunkCoveredByCursor, maxObservationCursor, planReflectionGenerationText, withObservationalMemoryLifecycleColumns };
102
101
  //# sourceMappingURL=index.d.ts.map
@@ -3,7 +3,7 @@ name: mastra-pg
3
3
  description: Documentation for @mastra/pg. Use when working with @mastra/pg APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/pg"
6
- version: "1.32.0"
6
+ version: "1.33.0-alpha.0"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.32.0",
2
+ "version": "1.33.0-alpha.0",
3
3
  "package": "@mastra/pg",
4
4
  "exports": {},
5
5
  "modules": {}
@@ -34,7 +34,7 @@ const agent = new Agent({
34
34
  id: 'support-agent',
35
35
  name: 'SupportAgent',
36
36
  instructions: 'You are a helpful support agent.',
37
- model: 'openai/gpt-5.6-sol',
37
+ model: 'openai/gpt-6.1-sol',
38
38
  memory: new Memory({
39
39
  storage: new LibSQLStore({
40
40
  id: 'agent-storage',
@@ -64,7 +64,7 @@ const agent = new Agent({
64
64
  id: 'support-agent',
65
65
  name: 'SupportAgent',
66
66
  instructions: 'You are a helpful support agent.',
67
- model: 'openai/gpt-5.6-sol',
67
+ model: 'openai/gpt-6.1-sol',
68
68
  memory: new Memory({
69
69
  storage: new MongoDBStore({
70
70
  id: 'agent-storage',
@@ -34,7 +34,7 @@ const agent = new Agent({
34
34
  id: 'personal-assistant',
35
35
  name: 'PersonalAssistant',
36
36
  instructions: 'You are a helpful personal assistant.',
37
- model: 'openai/gpt-5.6-sol',
37
+ model: 'openai/gpt-6.1-sol',
38
38
  memory: new Memory({
39
39
  options: {
40
40
  workingMemory: {
@@ -418,7 +418,7 @@ const response = await agent.generate('What do you know about me?', {
418
418
 
419
419
  ## Opt in to state signals (experimental)
420
420
 
421
- By default, working memory reaches the model as part of the system message. You can opt into delivering it as a [state signal](https://mastra.ai/docs/harness/signals) instead by setting `useStateSignals: true`:
421
+ By default, working memory reaches the model as part of the system message. You can opt into delivering it as a [state signal](https://mastra.ai/docs/signals/state-signals) instead by setting `useStateSignals: true`:
422
422
 
423
423
  ```typescript
424
424
  const memory = new Memory({
@@ -146,7 +146,7 @@ export const supportAgent = new Agent({
146
146
  id: 'support-agent',
147
147
  name: 'Support agent',
148
148
  instructions: 'Answer customer support questions.',
149
- model: 'openai/gpt-5.6-sol',
149
+ model: 'openai/gpt-6.1-sol',
150
150
  memory: new Memory({
151
151
  storage: new PostgresStore({
152
152
  id: 'support-agent-storage',
@@ -365,7 +365,7 @@ export const pgAgent = new Agent({
365
365
  name: 'PG Agent',
366
366
  instructions:
367
367
  'You are an AI agent with the ability to automatically recall memories from previous interactions.',
368
- model: 'openai/gpt-5.6-sol',
368
+ model: 'openai/gpt-6.1-sol',
369
369
  memory: new Memory({
370
370
  storage: new PostgresStore({
371
371
  id: 'pg-agent-storage',
@@ -16,7 +16,7 @@ export const agent = new Agent({
16
16
  id: 'test-agent',
17
17
  name: 'test-agent',
18
18
  instructions: 'You are an agent with memory.',
19
- model: 'openai/gpt-5.6-sol',
19
+ model: 'openai/gpt-6.1-sol',
20
20
  memory: new Memory({
21
21
  options: {
22
22
  workingMemory: {
@@ -71,7 +71,7 @@ import { LibSQLStore, LibSQLVector } from '@mastra/libsql'
71
71
  export const agent = new Agent({
72
72
  name: 'test-agent',
73
73
  instructions: 'You are an agent with memory.',
74
- model: 'openai/gpt-5.6-sol',
74
+ model: 'openai/gpt-6.1-sol',
75
75
  memory: new Memory({
76
76
  storage: new LibSQLStore({
77
77
  id: 'test-agent-storage',
@@ -108,7 +108,7 @@ import { PostgresStore, PgVector } from '@mastra/pg'
108
108
  export const agent = new Agent({
109
109
  name: 'pg-agent',
110
110
  instructions: 'You are an agent with optimized PostgreSQL memory.',
111
- model: 'openai/gpt-5.6-sol',
111
+ model: 'openai/gpt-6.1-sol',
112
112
  memory: new Memory({
113
113
  storage: new PostgresStore({
114
114
  id: 'pg-agent-storage',
@@ -23,7 +23,7 @@ const processor = new MessageHistory({
23
23
 
24
24
  **options.storage** (`MemoryStorage`): Storage instance for retrieving and persisting messages
25
25
 
26
- **options.lastMessages** (`number`): Maximum number of historical messages to retrieve. If not specified, retrieves all messages
26
+ **options.lastMessages** (`number | false`): Maximum number of historical messages to retrieve. Set to false to retrieve all messages. If omitted, the storage adapter's default page size applies (40 messages for built-in adapters)
27
27
 
28
28
  ## Returns
29
29
 
@@ -51,7 +51,7 @@ export const agent = new Agent({
51
51
  id: 'memory-agent',
52
52
  name: 'memory-agent',
53
53
  instructions: 'You are a helpful assistant with conversation memory',
54
- model: 'openai/gpt-5.6-sol',
54
+ model: 'openai/gpt-6.1-sol',
55
55
  inputProcessors: [
56
56
  new MessageHistory({
57
57
  storage,
@@ -30,7 +30,7 @@ const processor = new SemanticRecall({
30
30
 
31
31
  **options.vector** (`MastraVector`): Vector store for semantic search
32
32
 
33
- **options.embedder** (`MastraEmbeddingModel<string>`): Embedder for generating query embeddings
33
+ **options.embedder** (`MastraEmbeddingModel<string>`): Embedder for generating query embeddings. Required unless the vector store embeds text itself (self-embedding)
34
34
 
35
35
  **options.topK** (`number`): Number of most similar messages to retrieve
36
36
 
@@ -86,7 +86,7 @@ export const agent = new Agent({
86
86
  id: 'semantic-memory-agent',
87
87
  name: 'semantic-memory-agent',
88
88
  instructions: 'You are a helpful assistant with semantic memory recall',
89
- model: 'openai/gpt-5.6-sol',
89
+ model: 'openai/gpt-6.1-sol',
90
90
  inputProcessors: [semanticRecall, new MessageHistory({ storage, lastMessages: 50 })],
91
91
  outputProcessors: [semanticRecall, new MessageHistory({ storage })],
92
92
  })
@@ -35,7 +35,7 @@ const processor = new WorkingMemory({
35
35
 
36
36
  **options.template.format** (`'markdown' | 'json'`): Format of the working memory content
37
37
 
38
- **options.template.content** (`string`): Template content defining the structure of working memory data
38
+ **options.template.content** (`string | Record<string, unknown>`): Template content defining the structure of working memory data. The object form is only valid when format is json
39
39
 
40
40
  **options.scope** (`'thread' | 'resource'`): Scope of working memory. 'thread' scopes to current thread, 'resource' shares across all threads for the resource
41
41
 
@@ -73,7 +73,7 @@ export const agent = new Agent({
73
73
  id: 'personalized-agent',
74
74
  name: 'personalized-agent',
75
75
  instructions: 'You are a helpful assistant that remembers user preferences',
76
- model: 'openai/gpt-5.6-sol',
76
+ model: 'openai/gpt-6.1-sol',
77
77
  inputProcessors: [
78
78
  new WorkingMemory({
79
79
  storage,
@@ -63,7 +63,7 @@ For markdown documents where preserving the semantic relationships between secti
63
63
  const chunks = await doc.chunk({
64
64
  strategy: 'semantic-markdown',
65
65
  joinThreshold: 500,
66
- modelName: 'gpt-5',
66
+ modelName: 'gpt-5.6',
67
67
  })
68
68
  ```
69
69
 
@@ -36,7 +36,7 @@ const results = await store.query({
36
36
 
37
37
  ### Array Operators
38
38
 
39
- `$in`Matches any value in array{ category: { $in: \["A", "B"] } }Supported by: All except Couchbase`$nin`Matches none of the values{ status: { $nin: \["deleted", "archived"] } }Supported by: All except Couchbase`$all`Matches arrays containing all elements{ tags: { $all: \["urgent", "high"] } }Supported by: Astra, Pinecone, Upstash, MongoDB, OracleDB`$elemMatch`Matches array elements meeting criteria{ scores: { $elemMatch: { $gt: 80 } } }Supported by: libSQL, PgVector, MongoDB, OracleDB
39
+ `$in`Matches any value in array{ category: { $in: \["A", "B"] } }Supported by: All except Couchbase`$nin`Matches none of the values{ status: { $nin: \["deleted", "archived"] } }Supported by: All except Couchbase`$all`Matches arrays containing all elements{ tags: { $all: \["urgent", "high"] } }Supported by: Astra, Pinecone, Qdrant, Upstash, MongoDB, OracleDB`$elemMatch`Matches array elements meeting criteria{ scores: { $elemMatch: { $gt: 80 } } }Supported by: libSQL, PgVector, MongoDB, OracleDB
40
40
 
41
41
  ### Logical Operators
42
42
 
@@ -386,7 +386,7 @@ import { MONGODB_PROMPT } from '@mastra/mongodb'
386
386
  export const ragAgent = new Agent({
387
387
  id: 'rag-agent',
388
388
  name: 'RAG Agent',
389
- model: 'openai/gpt-5.6-sol',
389
+ model: 'openai/gpt-6.1-sol',
390
390
  instructions: `
391
391
  Process queries using the provided context. Structure responses to be concise and relevant.
392
392
  ${MONGODB_PROMPT}
@@ -403,7 +403,7 @@ import { PGVECTOR_PROMPT } from '@mastra/pg'
403
403
  export const ragAgent = new Agent({
404
404
  id: 'rag-agent',
405
405
  name: 'RAG Agent',
406
- model: 'openai/gpt-5.6-sol',
406
+ model: 'openai/gpt-6.1-sol',
407
407
  instructions: `
408
408
  Process queries using the provided context. Structure responses to be concise and relevant.
409
409
  ${PGVECTOR_PROMPT}
@@ -420,7 +420,7 @@ import { PINECONE_PROMPT } from '@mastra/pinecone'
420
420
  export const ragAgent = new Agent({
421
421
  id: 'rag-agent',
422
422
  name: 'RAG Agent',
423
- model: 'openai/gpt-5.6-sol',
423
+ model: 'openai/gpt-6.1-sol',
424
424
  instructions: `
425
425
  Process queries using the provided context. Structure responses to be concise and relevant.
426
426
  ${PINECONE_PROMPT}
@@ -437,7 +437,7 @@ import { QDRANT_PROMPT } from '@mastra/qdrant'
437
437
  export const ragAgent = new Agent({
438
438
  id: 'rag-agent',
439
439
  name: 'RAG Agent',
440
- model: 'openai/gpt-5.6-sol',
440
+ model: 'openai/gpt-6.1-sol',
441
441
  instructions: `
442
442
  Process queries using the provided context. Structure responses to be concise and relevant.
443
443
  ${QDRANT_PROMPT}
@@ -454,7 +454,7 @@ import { CHROMA_PROMPT } from '@mastra/chroma'
454
454
  export const ragAgent = new Agent({
455
455
  id: 'rag-agent',
456
456
  name: 'RAG Agent',
457
- model: 'openai/gpt-5.6-sol',
457
+ model: 'openai/gpt-6.1-sol',
458
458
  instructions: `
459
459
  Process queries using the provided context. Structure responses to be concise and relevant.
460
460
  ${CHROMA_PROMPT}
@@ -471,7 +471,7 @@ import { ASTRA_PROMPT } from '@mastra/astra'
471
471
  export const ragAgent = new Agent({
472
472
  id: 'rag-agent',
473
473
  name: 'RAG Agent',
474
- model: 'openai/gpt-5.6-sol',
474
+ model: 'openai/gpt-6.1-sol',
475
475
  instructions: `
476
476
  Process queries using the provided context. Structure responses to be concise and relevant.
477
477
  ${ASTRA_PROMPT}
@@ -488,7 +488,7 @@ import { LIBSQL_PROMPT } from '@mastra/libsql'
488
488
  export const ragAgent = new Agent({
489
489
  id: 'rag-agent',
490
490
  name: 'RAG Agent',
491
- model: 'openai/gpt-5.6-sol',
491
+ model: 'openai/gpt-6.1-sol',
492
492
  instructions: `
493
493
  Process queries using the provided context. Structure responses to be concise and relevant.
494
494
  ${LIBSQL_PROMPT}
@@ -505,7 +505,7 @@ import { UPSTASH_PROMPT } from '@mastra/upstash'
505
505
  export const ragAgent = new Agent({
506
506
  id: 'rag-agent',
507
507
  name: 'RAG Agent',
508
- model: 'openai/gpt-5.6-sol',
508
+ model: 'openai/gpt-6.1-sol',
509
509
  instructions: `
510
510
  Process queries using the provided context. Structure responses to be concise and relevant.
511
511
  ${UPSTASH_PROMPT}
@@ -522,7 +522,7 @@ import { VECTORIZE_PROMPT } from '@mastra/vectorize'
522
522
  export const ragAgent = new Agent({
523
523
  id: 'rag-agent',
524
524
  name: 'RAG Agent',
525
- model: 'openai/gpt-5.6-sol',
525
+ model: 'openai/gpt-6.1-sol',
526
526
  instructions: `
527
527
  Process queries using the provided context. Structure responses to be concise and relevant.
528
528
  ${VECTORIZE_PROMPT}
@@ -539,7 +539,7 @@ import { OPENSEARCH_PROMPT } from '@mastra/opensearch'
539
539
  export const ragAgent = new Agent({
540
540
  id: 'rag-agent',
541
541
  name: 'RAG Agent',
542
- model: 'openai/gpt-5.6-sol',
542
+ model: 'openai/gpt-6.1-sol',
543
543
  instructions: `
544
544
  Process queries using the provided context. Structure responses to be concise and relevant.
545
545
  ${OPENSEARCH_PROMPT}
@@ -556,7 +556,7 @@ import { ORACLEDB_PROMPT } from '@mastra/oracledb'
556
556
  export const ragAgent = new Agent({
557
557
  id: 'rag-agent',
558
558
  name: 'RAG Agent',
559
- model: 'openai/gpt-5.6-sol',
559
+ model: 'openai/gpt-6.1-sol',
560
560
  instructions: `
561
561
  Process queries using the provided context. Structure responses to be concise and relevant.
562
562
  ${ORACLEDB_PROMPT}
@@ -573,7 +573,7 @@ import { S3VECTORS_PROMPT } from '@mastra/s3vectors'
573
573
  export const ragAgent = new Agent({
574
574
  id: 'rag-agent',
575
575
  name: 'RAG Agent',
576
- model: 'openai/gpt-5.6-sol',
576
+ model: 'openai/gpt-6.1-sol',
577
577
  instructions: `
578
578
  Process queries using the provided context. Structure responses to be concise and relevant.
579
579
  ${S3VECTORS_PROMPT}
@@ -605,7 +605,7 @@ const initialResults = await pgVector.query({
605
605
  // Create a relevance scorer
606
606
  const relevanceProvider = new MastraAgentRelevanceScorer(
607
607
  'relevance-scorer',
608
- 'openai/gpt-5.6-sol',
608
+ 'openai/gpt-6.1-sol',
609
609
  )
610
610
 
611
611
  // Re-rank the results
@@ -148,7 +148,7 @@ const queryTool = createVectorQueryTool({
148
148
  indexName: 'documentation',
149
149
  model: new ModelRouterEmbeddingModel('openai/text-embedding-3-small'),
150
150
  reranker: {
151
- model: 'openai/gpt-5.6-sol',
151
+ model: 'openai/gpt-6.1-sol',
152
152
  options: {
153
153
  weights: {
154
154
  semantic: 0.5, // Semantic relevance weight