@mastra/convex 1.7.5 → 1.7.6-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/memory/index.d.ts +12 -15
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/assets/SOURCE_MAP.json +1 -1
- package/dist/index.cjs +17 -33
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +17 -33
- package/dist/index.js.map +1 -1
- package/dist/schema.cjs +1 -2
- package/dist/schema.js +1 -2
- package/dist/server/index.cjs +1 -1
- package/dist/server/index.js +1 -1
- package/dist/server/observational-memory.d.ts.map +1 -1
- package/dist/{server-CedrKoHl.js → server-BRy-fyDz.js} +8 -15
- package/dist/server-BRy-fyDz.js.map +1 -0
- package/dist/{server-BxQKtmhb.cjs → server-BwpzJLxa.cjs} +8 -15
- package/dist/server-BwpzJLxa.cjs.map +1 -0
- package/package.json +11 -11
- package/dist/server-BxQKtmhb.cjs.map +0 -1
- package/dist/server-CedrKoHl.js.map +0 -1
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-BRy-fyDz.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";
|
|
@@ -6,7 +6,7 @@ import { MastraBase } from "@mastra/core/base";
|
|
|
6
6
|
import { MessageList } from "@mastra/core/agent";
|
|
7
7
|
import { ErrorCategory, ErrorDomain, MastraError } from "@mastra/core/error";
|
|
8
8
|
import { MastraVector } from "@mastra/core/vector";
|
|
9
|
-
|
|
9
|
+
// src/cache/client.ts
|
|
10
10
|
const DEFAULT_CACHE_FUNCTION = "mastra/cache:handle";
|
|
11
11
|
const DEFAULT_REQUEST_TIMEOUT_MS = 3e4;
|
|
12
12
|
const trimTrailingSlashes = (value) => {
|
|
@@ -84,8 +84,7 @@ var ConvexCacheClient = class {
|
|
|
84
84
|
return result;
|
|
85
85
|
}
|
|
86
86
|
};
|
|
87
|
-
|
|
88
|
-
//#region src/cache/index.ts
|
|
87
|
+
// src/cache/index.ts
|
|
89
88
|
const DEFAULT_KEY_PREFIX = "mastra:cache:";
|
|
90
89
|
const DEFAULT_TTL_MS = 3e5;
|
|
91
90
|
const MAX_CACHE_OPERATION_BATCHES = 1e3;
|
|
@@ -173,8 +172,7 @@ var ConvexServerCache = class extends MastraServerCache {
|
|
|
173
172
|
}));
|
|
174
173
|
}
|
|
175
174
|
};
|
|
176
|
-
|
|
177
|
-
//#region src/storage/client.ts
|
|
175
|
+
// src/storage/client.ts
|
|
178
176
|
const DEFAULT_STORAGE_FUNCTION = "mastra/storage:handle";
|
|
179
177
|
var ConvexAdminClient = class {
|
|
180
178
|
deploymentUrl;
|
|
@@ -251,8 +249,7 @@ var ConvexAdminClient = class {
|
|
|
251
249
|
return result;
|
|
252
250
|
}
|
|
253
251
|
};
|
|
254
|
-
|
|
255
|
-
//#region src/storage/run-fencing.ts
|
|
252
|
+
// src/storage/run-fencing.ts
|
|
256
253
|
const READ_OPS = /* @__PURE__ */ new Set([
|
|
257
254
|
"load",
|
|
258
255
|
"loadMany",
|
|
@@ -410,16 +407,14 @@ async function pruneRunClaims(client, tableName, column, cutoff, limit) {
|
|
|
410
407
|
}, "prune");
|
|
411
408
|
return result;
|
|
412
409
|
}
|
|
413
|
-
|
|
414
|
-
//#region src/storage/types.ts
|
|
410
|
+
// src/storage/types.ts
|
|
415
411
|
/**
|
|
416
412
|
* Observational memory table name. Defined locally (not value-imported from
|
|
417
413
|
* core) following the mongodb/pg convention: core exports the constant, but
|
|
418
414
|
* OM is optional and the constant is absent from older cores in the peer range.
|
|
419
415
|
*/
|
|
420
416
|
const TABLE_OBSERVATIONAL_MEMORY$1 = "mastra_observational_memory";
|
|
421
|
-
|
|
422
|
-
//#region src/storage/db/index.ts
|
|
417
|
+
// src/storage/db/index.ts
|
|
423
418
|
const LOAD_MANY_REQUEST_BATCH_SIZE = 10;
|
|
424
419
|
/**
|
|
425
420
|
* Resolves ConvexDomainConfig to a ConvexAdminClient.
|
|
@@ -739,8 +734,7 @@ var ConvexDB = class ConvexDB extends MastraBase {
|
|
|
739
734
|
return normalized;
|
|
740
735
|
}
|
|
741
736
|
};
|
|
742
|
-
|
|
743
|
-
//#region src/storage/domains/background-tasks/index.ts
|
|
737
|
+
// src/storage/domains/background-tasks/index.ts
|
|
744
738
|
function serializeJson$1(v) {
|
|
745
739
|
if (v === void 0 || v === null) return null;
|
|
746
740
|
return JSON.stringify(v);
|
|
@@ -954,8 +948,7 @@ var BackgroundTasksConvex = class extends BackgroundTasksStorage {
|
|
|
954
948
|
return total;
|
|
955
949
|
}
|
|
956
950
|
};
|
|
957
|
-
|
|
958
|
-
//#region src/storage/domains/channels/index.ts
|
|
951
|
+
// src/storage/domains/channels/index.ts
|
|
959
952
|
const statusPriority = {
|
|
960
953
|
active: 0,
|
|
961
954
|
pending: 1,
|
|
@@ -1092,8 +1085,7 @@ var ChannelsConvex = class extends ChannelsStorage {
|
|
|
1092
1085
|
await this.#db.deleteMany(TABLE_CHANNEL_CONFIG$1, [platform]);
|
|
1093
1086
|
}
|
|
1094
1087
|
};
|
|
1095
|
-
|
|
1096
|
-
//#region ../../packages/_internal-core/dist/memory/index.js
|
|
1088
|
+
// ../../packages/_internal-core/dist/memory/index.js
|
|
1097
1089
|
/**
|
|
1098
1090
|
* Backs `updateActiveObservations` in adapters that implement `commitActiveObservations`.
|
|
1099
1091
|
* Callers of `updateActiveObservations` (which resolves `void`) can't see a commit result, so a
|
|
@@ -1103,8 +1095,7 @@ function assertActiveObservationsApplied(result, id) {
|
|
|
1103
1095
|
if (result.applied) return;
|
|
1104
1096
|
throw new Error(result.reason === "retired" ? `Observational memory record ${id} was superseded by a newer generation; observations were not written` : `Observational memory record ${id} changed since the observations were composed; observations were not written`);
|
|
1105
1097
|
}
|
|
1106
|
-
|
|
1107
|
-
//#region src/storage/domains/memory/index.ts
|
|
1098
|
+
// src/storage/domains/memory/index.ts
|
|
1108
1099
|
function parseStoredThread(row) {
|
|
1109
1100
|
return {
|
|
1110
1101
|
...row,
|
|
@@ -1991,8 +1982,7 @@ var MemoryConvex = class MemoryConvex extends MemoryStorage {
|
|
|
1991
1982
|
});
|
|
1992
1983
|
}
|
|
1993
1984
|
};
|
|
1994
|
-
|
|
1995
|
-
//#region src/storage/domains/schedules/index.ts
|
|
1985
|
+
// src/storage/domains/schedules/index.ts
|
|
1996
1986
|
const SCHEDULE_LIST_LIMIT = 8e3;
|
|
1997
1987
|
function serializeJson(value) {
|
|
1998
1988
|
return JSON.stringify(value);
|
|
@@ -2209,8 +2199,7 @@ var SchedulesConvex = class extends SchedulesStorage {
|
|
|
2209
2199
|
})).map(recordToTrigger);
|
|
2210
2200
|
}
|
|
2211
2201
|
};
|
|
2212
|
-
|
|
2213
|
-
//#region src/storage/domains/scores/index.ts
|
|
2202
|
+
// src/storage/domains/scores/index.ts
|
|
2214
2203
|
var ScoresConvex = class extends ScoresStorage {
|
|
2215
2204
|
#db;
|
|
2216
2205
|
constructor(config) {
|
|
@@ -2304,8 +2293,7 @@ var ScoresConvex = class extends ScoresStorage {
|
|
|
2304
2293
|
};
|
|
2305
2294
|
}
|
|
2306
2295
|
};
|
|
2307
|
-
|
|
2308
|
-
//#region src/storage/domains/workflows/index.ts
|
|
2296
|
+
// src/storage/domains/workflows/index.ts
|
|
2309
2297
|
var WorkflowsConvex = class WorkflowsConvex extends WorkflowsStorage {
|
|
2310
2298
|
/**
|
|
2311
2299
|
* Tables `prune()` can clean up. Run ownership records anchor on `updatedAt` (epoch ms), which every
|
|
@@ -2499,8 +2487,7 @@ var WorkflowsConvex = class WorkflowsConvex extends WorkflowsStorage {
|
|
|
2499
2487
|
return JSON.parse(JSON.stringify(run.snapshot));
|
|
2500
2488
|
}
|
|
2501
2489
|
};
|
|
2502
|
-
|
|
2503
|
-
//#region src/storage/index.ts
|
|
2490
|
+
// src/storage/index.ts
|
|
2504
2491
|
/**
|
|
2505
2492
|
* Type guard for pre-configured client config
|
|
2506
2493
|
*/
|
|
@@ -2546,8 +2533,7 @@ var ConvexStore = class extends MastraCompositeStore {
|
|
|
2546
2533
|
};
|
|
2547
2534
|
}
|
|
2548
2535
|
};
|
|
2549
|
-
|
|
2550
|
-
//#region src/vector/index.ts
|
|
2536
|
+
// src/vector/index.ts
|
|
2551
2537
|
const INDEX_METADATA_TABLE = "mastra_vector_indexes";
|
|
2552
2538
|
const VECTOR_QUERY_PAGE_SIZE = 256;
|
|
2553
2539
|
var ConvexVector = class extends MastraVector {
|
|
@@ -2815,8 +2801,7 @@ function cosineSimilarity(a, b) {
|
|
|
2815
2801
|
if (magA === 0 || magB === 0) return -1;
|
|
2816
2802
|
return dot / (Math.sqrt(magA) * Math.sqrt(magB));
|
|
2817
2803
|
}
|
|
2818
|
-
|
|
2819
|
-
//#region src/vector/native.ts
|
|
2804
|
+
// src/vector/native.ts
|
|
2820
2805
|
const DEFAULT_VECTOR_INDEX = "by_embedding";
|
|
2821
2806
|
const DEFAULT_ID_FIELD = "id";
|
|
2822
2807
|
const DEFAULT_ID_INDEX = "by_record_id";
|
|
@@ -3001,7 +2986,6 @@ var ConvexNativeVector = class extends MastraVector {
|
|
|
3001
2986
|
return typeof metadata === "object" && metadata !== null && !Array.isArray(metadata);
|
|
3002
2987
|
}
|
|
3003
2988
|
};
|
|
3004
|
-
//#endregion
|
|
3005
2989
|
export { ConvexCacheClient, ConvexNativeVector, ConvexServerCache, ConvexStore, ConvexVector, 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 };
|
|
3006
2990
|
|
|
3007
2991
|
//# sourceMappingURL=index.js.map
|