@mastra/convex 1.9.2-alpha.0 → 1.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_types/@internal_core@0.1.4/dist/memory/index.d.ts +25 -0
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +13 -13
- package/dist/index.cjs +10 -3
- package/dist/index.js +10 -3
- package/dist/server/index.cjs +1 -1
- package/dist/server/index.js +1 -1
- package/dist/server/observational-memory.d.ts +10 -0
- package/dist/{server-DS6X9y1L.js → server-3jHGWr-2.js} +29 -7
- package/dist/{server-CwHPmdFF.cjs → server-RoaQqgbZ.cjs} +29 -7
- package/dist/storage/types.d.ts +4 -0
- package/package.json +6 -6
|
@@ -96,4 +96,29 @@ export declare function assertActiveObservationsApplied(result: UpdateActiveObse
|
|
|
96
96
|
* (equal, or only appended to since).
|
|
97
97
|
*/
|
|
98
98
|
export declare function isAppendOnlySince(storedObservations: string, snapshotObservations: string): boolean;
|
|
99
|
+
/** The buffered-reflection fields a `swapBufferedReflectionToActive` caller read, and the stored ones. */
|
|
100
|
+
export interface BufferedReflectionState {
|
|
101
|
+
bufferedReflection?: string | null;
|
|
102
|
+
reflectedObservationLineCount?: number | null;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Whether the stored buffered reflection and reflected line count are still the ones in
|
|
106
|
+
* `snapshot`, so a buffered-reflection swap activates exactly the buffer the caller read.
|
|
107
|
+
*
|
|
108
|
+
* Another writer can extend the buffer (`updateBufferedReflection` appends and moves the line
|
|
109
|
+
* count) after the caller's read. The activated text alone cannot tell the two apart: an
|
|
110
|
+
* extension that repeats the unreflected tail and moves the cut past it produces the same text.
|
|
111
|
+
* A snapshot without a buffered reflection (callers that never read one) is not checked.
|
|
112
|
+
*/
|
|
113
|
+
export declare function isBufferedReflectionUnchangedSince(stored: BufferedReflectionState, snapshot: BufferedReflectionState): boolean;
|
|
114
|
+
/**
|
|
115
|
+
* The generation a buffered-reflection swap just created, marked with
|
|
116
|
+
* `bufferedReflectionVerified: true` when the swap checked the caller's buffered reflection with
|
|
117
|
+
* `isBufferedReflectionUnchangedSince` in the same atomic step. A snapshot without a buffered
|
|
118
|
+
* reflection was not checked, so its successor is returned unmarked. Always returns a new object,
|
|
119
|
+
* so a store's own record is never handed out or mutated.
|
|
120
|
+
*/
|
|
121
|
+
export declare function withBufferedReflectionVerified<T extends object>(successor: T, snapshot: BufferedReflectionState): T & {
|
|
122
|
+
bufferedReflectionVerified?: true;
|
|
123
|
+
};
|
|
99
124
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/docs/SKILL.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.9.2
|
|
2
|
+
"version": "1.9.2",
|
|
3
3
|
"package": "@mastra/convex",
|
|
4
4
|
"exports": {
|
|
5
5
|
"ConvexCacheClient": {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"ConvexNativeVector": {
|
|
11
11
|
"types": "dist/vector/native.d.ts",
|
|
12
12
|
"implementation": "dist/index.js",
|
|
13
|
-
"line":
|
|
13
|
+
"line": 2882
|
|
14
14
|
},
|
|
15
15
|
"ConvexServerCache": {
|
|
16
16
|
"types": "dist/cache/index.d.ts",
|
|
@@ -20,12 +20,12 @@
|
|
|
20
20
|
"ConvexStore": {
|
|
21
21
|
"types": "dist/storage/index.d.ts",
|
|
22
22
|
"implementation": "dist/index.js",
|
|
23
|
-
"line":
|
|
23
|
+
"line": 2588
|
|
24
24
|
},
|
|
25
25
|
"ConvexVector": {
|
|
26
26
|
"types": "dist/vector/index.d.ts",
|
|
27
27
|
"implementation": "dist/index.js",
|
|
28
|
-
"line":
|
|
28
|
+
"line": 2612
|
|
29
29
|
},
|
|
30
30
|
"TABLE_OBSERVATIONAL_MEMORY": {
|
|
31
31
|
"types": "dist/schema.d.ts",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
},
|
|
45
45
|
"mastraCache": {
|
|
46
46
|
"types": "dist/server/cache.d.ts",
|
|
47
|
-
"implementation": "dist/server-
|
|
47
|
+
"implementation": "dist/server-3jHGWr-2.js",
|
|
48
48
|
"line": 297
|
|
49
49
|
},
|
|
50
50
|
"mastraCacheListItemsTable": {
|
|
@@ -79,18 +79,18 @@
|
|
|
79
79
|
},
|
|
80
80
|
"mastraNativeVectorAction": {
|
|
81
81
|
"types": "dist/server/native-vector.d.ts",
|
|
82
|
-
"implementation": "dist/server-
|
|
83
|
-
"line":
|
|
82
|
+
"implementation": "dist/server-3jHGWr-2.js",
|
|
83
|
+
"line": 2279
|
|
84
84
|
},
|
|
85
85
|
"mastraNativeVectorMutation": {
|
|
86
86
|
"types": "dist/server/native-vector.d.ts",
|
|
87
|
-
"implementation": "dist/server-
|
|
88
|
-
"line":
|
|
87
|
+
"implementation": "dist/server-3jHGWr-2.js",
|
|
88
|
+
"line": 2335
|
|
89
89
|
},
|
|
90
90
|
"mastraNativeVectorQuery": {
|
|
91
91
|
"types": "dist/server/native-vector.d.ts",
|
|
92
|
-
"implementation": "dist/server-
|
|
93
|
-
"line":
|
|
92
|
+
"implementation": "dist/server-3jHGWr-2.js",
|
|
93
|
+
"line": 2301
|
|
94
94
|
},
|
|
95
95
|
"mastraObservationalMemoryTable": {
|
|
96
96
|
"types": "dist/schema.d.ts",
|
|
@@ -119,8 +119,8 @@
|
|
|
119
119
|
},
|
|
120
120
|
"mastraStorage": {
|
|
121
121
|
"types": "dist/server/storage.d.ts",
|
|
122
|
-
"implementation": "dist/server-
|
|
123
|
-
"line":
|
|
122
|
+
"implementation": "dist/server-3jHGWr-2.js",
|
|
123
|
+
"line": 1558
|
|
124
124
|
},
|
|
125
125
|
"mastraThreadsTable": {
|
|
126
126
|
"types": "dist/schema.d.ts",
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_server = require("./server-
|
|
2
|
+
const require_server = require("./server-RoaQqgbZ.cjs");
|
|
3
3
|
const require_schema = require("./schema.cjs");
|
|
4
4
|
let _mastra_core_cache = require("@mastra/core/cache");
|
|
5
5
|
let _mastra_core_storage = require("@mastra/core/storage");
|
|
@@ -1918,7 +1918,9 @@ var MemoryConvex = class MemoryConvex extends _mastra_core_storage.MemoryStorage
|
|
|
1918
1918
|
totalTokensObserved: currentRecord.totalTokensObserved,
|
|
1919
1919
|
generationCount: currentRecord.generationCount,
|
|
1920
1920
|
activeObservations: currentRecord.activeObservations ?? "",
|
|
1921
|
-
observationTokenCount: currentRecord.observationTokenCount ?? 0
|
|
1921
|
+
observationTokenCount: currentRecord.observationTokenCount ?? 0,
|
|
1922
|
+
bufferedReflection: currentRecord.bufferedReflection ?? null,
|
|
1923
|
+
reflectedObservationLineCount: currentRecord.reflectedObservationLineCount ?? null
|
|
1922
1924
|
};
|
|
1923
1925
|
}
|
|
1924
1926
|
async createReflectionGeneration(input) {
|
|
@@ -1948,7 +1950,12 @@ var MemoryConvex = class MemoryConvex extends _mastra_core_storage.MemoryStorage
|
|
|
1948
1950
|
tokenCount: input.tokenCount,
|
|
1949
1951
|
now: (/* @__PURE__ */ new Date()).toISOString()
|
|
1950
1952
|
});
|
|
1951
|
-
|
|
1953
|
+
if (!doc) return input.currentRecord;
|
|
1954
|
+
const record = parseStoredOMRecord(doc);
|
|
1955
|
+
return doc.bufferedReflectionVerified === true ? {
|
|
1956
|
+
...record,
|
|
1957
|
+
bufferedReflectionVerified: true
|
|
1958
|
+
} : record;
|
|
1952
1959
|
}
|
|
1953
1960
|
async setReflectingFlag(id, isReflecting) {
|
|
1954
1961
|
if (!await this.#db.patch({
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as mastraCache, i as mastraStorage, n as mastraNativeVectorMutation, r as mastraNativeVectorQuery, t as mastraNativeVectorAction } from "./server-
|
|
1
|
+
import { a as mastraCache, i as mastraStorage, n as mastraNativeVectorMutation, r as mastraNativeVectorQuery, t as mastraNativeVectorAction } from "./server-3jHGWr-2.js";
|
|
2
2
|
import { TABLE_BACKGROUND_TASKS, TABLE_CHANNEL_CONFIG, TABLE_CHANNEL_INSTALLATIONS, TABLE_MESSAGES, TABLE_OBSERVATIONAL_MEMORY, TABLE_RESOURCES, TABLE_SCHEDULES, TABLE_SCHEDULE_TRIGGERS, TABLE_SCORERS, TABLE_THREADS, TABLE_WORKFLOW_SNAPSHOT, defineMastraNativeVectorTable, mastraBackgroundTasksTable, mastraCacheListItemsTable, mastraCacheTable, mastraChannelConfigTable, mastraChannelInstallationsTable, mastraDocumentsTable, mastraMessagesTable, mastraObservationalMemoryTable, mastraResourcesTable, mastraScheduleTriggersTable, mastraSchedulesTable, mastraScoresTable, mastraThreadsTable, mastraVectorIndexesTable, mastraVectorsTable, mastraWorkflowSnapshotsTable } from "./schema.js";
|
|
3
3
|
import { MastraServerCache } from "@mastra/core/cache";
|
|
4
4
|
import { BackgroundTasksStorage, ChannelsStorage, MastraCompositeStore, MemoryStorage, RUN_FENCE_CONFLICT_ERROR_ID, RunFenceConflictError, SchedulesStorage, ScoresStorage, TABLE_BACKGROUND_TASKS as TABLE_BACKGROUND_TASKS$1, TABLE_CHANNEL_CONFIG as TABLE_CHANNEL_CONFIG$1, TABLE_CHANNEL_INSTALLATIONS as TABLE_CHANNEL_INSTALLATIONS$1, TABLE_MEMORY_RUN_FENCES, TABLE_MESSAGES as TABLE_MESSAGES$1, TABLE_RESOURCES as TABLE_RESOURCES$1, TABLE_SCHEDULES as TABLE_SCHEDULES$1, TABLE_SCHEDULE_TRIGGERS as TABLE_SCHEDULE_TRIGGERS$1, TABLE_SCORERS as TABLE_SCORERS$1, TABLE_THREADS as TABLE_THREADS$1, TABLE_WORKFLOW_RUN_OWNERS, TABLE_WORKFLOW_SNAPSHOT as TABLE_WORKFLOW_SNAPSHOT$1, WorkflowsStorage, calculatePagination, createStorageErrorId, createVectorErrorId, executeRetentionPrune, filterByDateRange, normalizePerPage, normalizeScheduleTarget, resolveRetentionTargets, resolveRunFence, retentionCutoffMs, safelyParseJSON, storageMessageMatchesMetadataFilter, validateStorageMetadataFilter } from "@mastra/core/storage";
|
|
@@ -1916,7 +1916,9 @@ var MemoryConvex = class MemoryConvex extends MemoryStorage {
|
|
|
1916
1916
|
totalTokensObserved: currentRecord.totalTokensObserved,
|
|
1917
1917
|
generationCount: currentRecord.generationCount,
|
|
1918
1918
|
activeObservations: currentRecord.activeObservations ?? "",
|
|
1919
|
-
observationTokenCount: currentRecord.observationTokenCount ?? 0
|
|
1919
|
+
observationTokenCount: currentRecord.observationTokenCount ?? 0,
|
|
1920
|
+
bufferedReflection: currentRecord.bufferedReflection ?? null,
|
|
1921
|
+
reflectedObservationLineCount: currentRecord.reflectedObservationLineCount ?? null
|
|
1920
1922
|
};
|
|
1921
1923
|
}
|
|
1922
1924
|
async createReflectionGeneration(input) {
|
|
@@ -1946,7 +1948,12 @@ var MemoryConvex = class MemoryConvex extends MemoryStorage {
|
|
|
1946
1948
|
tokenCount: input.tokenCount,
|
|
1947
1949
|
now: (/* @__PURE__ */ new Date()).toISOString()
|
|
1948
1950
|
});
|
|
1949
|
-
|
|
1951
|
+
if (!doc) return input.currentRecord;
|
|
1952
|
+
const record = parseStoredOMRecord(doc);
|
|
1953
|
+
return doc.bufferedReflectionVerified === true ? {
|
|
1954
|
+
...record,
|
|
1955
|
+
bufferedReflectionVerified: true
|
|
1956
|
+
} : record;
|
|
1950
1957
|
}
|
|
1951
1958
|
async setReflectingFlag(id, isReflecting) {
|
|
1952
1959
|
if (!await this.#db.patch({
|
package/dist/server/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_server = require("../server-
|
|
2
|
+
const require_server = require("../server-RoaQqgbZ.cjs");
|
|
3
3
|
const require_schema = require("../schema.cjs");
|
|
4
4
|
let _mastra_core_storage_constants = require("@mastra/core/storage/constants");
|
|
5
5
|
Object.defineProperty(exports, "TABLE_BACKGROUND_TASKS", {
|
package/dist/server/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as mastraCache, i as mastraStorage, n as mastraNativeVectorMutation, r as mastraNativeVectorQuery, t as mastraNativeVectorAction } from "../server-
|
|
1
|
+
import { a as mastraCache, i as mastraStorage, n as mastraNativeVectorMutation, r as mastraNativeVectorQuery, t as mastraNativeVectorAction } from "../server-3jHGWr-2.js";
|
|
2
2
|
import { TABLE_BACKGROUND_TASKS, TABLE_CHANNEL_CONFIG, TABLE_CHANNEL_INSTALLATIONS, TABLE_MESSAGES, TABLE_OBSERVATIONAL_MEMORY, TABLE_RESOURCES, TABLE_SCHEDULES, TABLE_SCHEDULE_TRIGGERS, TABLE_SCORERS, TABLE_THREADS, TABLE_WORKFLOW_SNAPSHOT, defineMastraNativeVectorTable, mastraBackgroundTasksTable, mastraCacheListItemsTable, mastraCacheTable, mastraChannelConfigTable, mastraChannelInstallationsTable, mastraDocumentsTable, mastraMessagesTable, mastraObservationalMemoryTable, mastraResourcesTable, mastraScheduleTriggersTable, mastraSchedulesTable, mastraScoresTable, mastraThreadsTable, mastraVectorIndexesTable, mastraVectorsTable, mastraWorkflowSnapshotsTable } from "../schema.js";
|
|
3
3
|
export { TABLE_BACKGROUND_TASKS, TABLE_CHANNEL_CONFIG, TABLE_CHANNEL_INSTALLATIONS, TABLE_MESSAGES, TABLE_OBSERVATIONAL_MEMORY, TABLE_RESOURCES, TABLE_SCHEDULES, TABLE_SCHEDULE_TRIGGERS, TABLE_SCORERS, TABLE_THREADS, TABLE_WORKFLOW_SNAPSHOT, defineMastraNativeVectorTable, mastraBackgroundTasksTable, mastraCache, mastraCacheListItemsTable, mastraCacheTable, mastraChannelConfigTable, mastraChannelInstallationsTable, mastraDocumentsTable, mastraMessagesTable, mastraNativeVectorAction, mastraNativeVectorMutation, mastraNativeVectorQuery, mastraObservationalMemoryTable, mastraResourcesTable, mastraScheduleTriggersTable, mastraSchedulesTable, mastraScoresTable, mastraStorage, mastraThreadsTable, mastraVectorIndexesTable, mastraVectorsTable, mastraWorkflowSnapshotsTable };
|
|
@@ -67,6 +67,16 @@ export declare function planReflectionText(input: {
|
|
|
67
67
|
} | null;
|
|
68
68
|
/** Whether the stored text equals or only extends the snapshot. */
|
|
69
69
|
export declare function isAppendOnly(storedObservations: string, snapshotObservations: string): boolean;
|
|
70
|
+
type BufferedReflectionFields = {
|
|
71
|
+
bufferedReflection?: string | null;
|
|
72
|
+
reflectedObservationLineCount?: number | null;
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Whether the stored buffered reflection and reflected line count are still the snapshot's, so
|
|
76
|
+
* a swap activates exactly the buffer the caller read. Mirrors core's
|
|
77
|
+
* `isBufferedReflectionUnchangedSince`. A snapshot without a buffered reflection is not checked.
|
|
78
|
+
*/
|
|
79
|
+
export declare function isBufferedReflectionUnchanged(stored: BufferedReflectionFields, snapshot: BufferedReflectionFields): boolean;
|
|
70
80
|
/**
|
|
71
81
|
* Deep-merge two plain config objects (source wins; undefined source values
|
|
72
82
|
* are skipped). Mirrors MemoryStorage.deepMergeConfig in @mastra/core.
|
|
@@ -651,6 +651,17 @@ function isAppendOnly(storedObservations, snapshotObservations) {
|
|
|
651
651
|
const snapshot = snapshotObservations ?? "";
|
|
652
652
|
return stored === snapshot || stored.startsWith(snapshot);
|
|
653
653
|
}
|
|
654
|
+
/**
|
|
655
|
+
* Whether the stored buffered reflection and reflected line count are still the snapshot's, so
|
|
656
|
+
* a swap activates exactly the buffer the caller read. Mirrors core's
|
|
657
|
+
* `isBufferedReflectionUnchangedSince`. A snapshot without a buffered reflection is not checked.
|
|
658
|
+
*/
|
|
659
|
+
function isBufferedReflectionUnchanged(stored, snapshot) {
|
|
660
|
+
if (snapshot.bufferedReflection === void 0 || snapshot.bufferedReflection === null) return true;
|
|
661
|
+
if ((stored.bufferedReflection ?? "") !== snapshot.bufferedReflection) return false;
|
|
662
|
+
if (snapshot.reflectedObservationLineCount === void 0 || snapshot.reflectedObservationLineCount === null) return true;
|
|
663
|
+
return Number(stored.reflectedObservationLineCount ?? 0) === snapshot.reflectedObservationLineCount;
|
|
664
|
+
}
|
|
654
665
|
/** Canonical head order: generationCount DESC, createdAt ASC, id ASC. */
|
|
655
666
|
function sortsBeforeAsHead(a, b) {
|
|
656
667
|
if (a.generationCount !== b.generationCount) return a.generationCount > b.generationCount;
|
|
@@ -1057,15 +1068,26 @@ async function handleObservationalMemoryOperation(ctx, convexTable, request) {
|
|
|
1057
1068
|
ok: true,
|
|
1058
1069
|
result: stored
|
|
1059
1070
|
};
|
|
1071
|
+
if (!isBufferedReflectionUnchanged({
|
|
1072
|
+
bufferedReflection: stored.bufferedReflection,
|
|
1073
|
+
reflectedObservationLineCount: stored.reflectedObservationLineCount
|
|
1074
|
+
}, currentRecord)) return {
|
|
1075
|
+
ok: true,
|
|
1076
|
+
result: stored
|
|
1077
|
+
};
|
|
1078
|
+
const newRecord = await rollOver(ctx, convexTable, stored, {
|
|
1079
|
+
newId,
|
|
1080
|
+
observations: mergeReflectionWithUnreflected(storedObservations, bufferedReflection, Number(stored.reflectedObservationLineCount || 0)),
|
|
1081
|
+
tokenCount: tokenCount + Math.max(0, Number(stored.observationTokenCount || 0) - (currentRecord.observationTokenCount ?? 0)),
|
|
1082
|
+
now,
|
|
1083
|
+
clearBufferedReflection: true
|
|
1084
|
+
});
|
|
1060
1085
|
return {
|
|
1061
1086
|
ok: true,
|
|
1062
|
-
result:
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
now,
|
|
1067
|
-
clearBufferedReflection: true
|
|
1068
|
-
})
|
|
1087
|
+
result: currentRecord.bufferedReflection !== void 0 && currentRecord.bufferedReflection !== null ? {
|
|
1088
|
+
...newRecord,
|
|
1089
|
+
bufferedReflectionVerified: true
|
|
1090
|
+
} : newRecord
|
|
1069
1091
|
};
|
|
1070
1092
|
}
|
|
1071
1093
|
case "omUpdateConfig": {
|
|
@@ -651,6 +651,17 @@ function isAppendOnly(storedObservations, snapshotObservations) {
|
|
|
651
651
|
const snapshot = snapshotObservations ?? "";
|
|
652
652
|
return stored === snapshot || stored.startsWith(snapshot);
|
|
653
653
|
}
|
|
654
|
+
/**
|
|
655
|
+
* Whether the stored buffered reflection and reflected line count are still the snapshot's, so
|
|
656
|
+
* a swap activates exactly the buffer the caller read. Mirrors core's
|
|
657
|
+
* `isBufferedReflectionUnchangedSince`. A snapshot without a buffered reflection is not checked.
|
|
658
|
+
*/
|
|
659
|
+
function isBufferedReflectionUnchanged(stored, snapshot) {
|
|
660
|
+
if (snapshot.bufferedReflection === void 0 || snapshot.bufferedReflection === null) return true;
|
|
661
|
+
if ((stored.bufferedReflection ?? "") !== snapshot.bufferedReflection) return false;
|
|
662
|
+
if (snapshot.reflectedObservationLineCount === void 0 || snapshot.reflectedObservationLineCount === null) return true;
|
|
663
|
+
return Number(stored.reflectedObservationLineCount ?? 0) === snapshot.reflectedObservationLineCount;
|
|
664
|
+
}
|
|
654
665
|
/** Canonical head order: generationCount DESC, createdAt ASC, id ASC. */
|
|
655
666
|
function sortsBeforeAsHead(a, b) {
|
|
656
667
|
if (a.generationCount !== b.generationCount) return a.generationCount > b.generationCount;
|
|
@@ -1057,15 +1068,26 @@ async function handleObservationalMemoryOperation(ctx, convexTable, request) {
|
|
|
1057
1068
|
ok: true,
|
|
1058
1069
|
result: stored
|
|
1059
1070
|
};
|
|
1071
|
+
if (!isBufferedReflectionUnchanged({
|
|
1072
|
+
bufferedReflection: stored.bufferedReflection,
|
|
1073
|
+
reflectedObservationLineCount: stored.reflectedObservationLineCount
|
|
1074
|
+
}, currentRecord)) return {
|
|
1075
|
+
ok: true,
|
|
1076
|
+
result: stored
|
|
1077
|
+
};
|
|
1078
|
+
const newRecord = await rollOver(ctx, convexTable, stored, {
|
|
1079
|
+
newId,
|
|
1080
|
+
observations: mergeReflectionWithUnreflected(storedObservations, bufferedReflection, Number(stored.reflectedObservationLineCount || 0)),
|
|
1081
|
+
tokenCount: tokenCount + Math.max(0, Number(stored.observationTokenCount || 0) - (currentRecord.observationTokenCount ?? 0)),
|
|
1082
|
+
now,
|
|
1083
|
+
clearBufferedReflection: true
|
|
1084
|
+
});
|
|
1060
1085
|
return {
|
|
1061
1086
|
ok: true,
|
|
1062
|
-
result:
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
now,
|
|
1067
|
-
clearBufferedReflection: true
|
|
1068
|
-
})
|
|
1087
|
+
result: currentRecord.bufferedReflection !== void 0 && currentRecord.bufferedReflection !== null ? {
|
|
1088
|
+
...newRecord,
|
|
1089
|
+
bufferedReflectionVerified: true
|
|
1090
|
+
} : newRecord
|
|
1069
1091
|
};
|
|
1070
1092
|
}
|
|
1071
1093
|
case "omUpdateConfig": {
|
package/dist/storage/types.d.ts
CHANGED
|
@@ -71,6 +71,10 @@ export type SerializedOMCurrentRecord = {
|
|
|
71
71
|
activeObservations?: string;
|
|
72
72
|
/** The snapshot's observation token count; tokens appended since are added to the new generation. */
|
|
73
73
|
observationTokenCount?: number;
|
|
74
|
+
/** The snapshot's buffered reflection; a buffered-reflection swap only applies if it is still stored. */
|
|
75
|
+
bufferedReflection?: string | null;
|
|
76
|
+
/** The snapshot's reflected line count; a buffered-reflection swap only applies if it is still stored. */
|
|
77
|
+
reflectedObservationLineCount?: number | null;
|
|
74
78
|
};
|
|
75
79
|
export type StorageRequest = {
|
|
76
80
|
op: 'insert';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/convex",
|
|
3
|
-
"version": "1.9.2
|
|
3
|
+
"version": "1.9.2",
|
|
4
4
|
"description": "Convex provider for Mastra - includes both storage and vector adapters plus Convex server helpers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
},
|
|
41
41
|
"license": "Apache-2.0",
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"convex": "^1.
|
|
43
|
+
"convex": "^1.50.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@types/node": "22.19.15",
|
|
@@ -52,10 +52,10 @@
|
|
|
52
52
|
"typescript": "^7.0.2",
|
|
53
53
|
"vitest": "5.1.0",
|
|
54
54
|
"@internal/core": "0.1.4",
|
|
55
|
-
"@internal/lint": "0.0.
|
|
56
|
-
"@internal/storage-test-utils": "0.0.
|
|
57
|
-
"@internal/types-builder": "0.0.
|
|
58
|
-
"@mastra/core": "1.86.0
|
|
55
|
+
"@internal/lint": "0.0.152",
|
|
56
|
+
"@internal/storage-test-utils": "0.0.148",
|
|
57
|
+
"@internal/types-builder": "0.0.127",
|
|
58
|
+
"@mastra/core": "1.86.0"
|
|
59
59
|
},
|
|
60
60
|
"peerDependencies": {
|
|
61
61
|
"@mastra/core": ">=1.76.0-0 <2.0.0-0"
|