@mastra/cloudflare 0.0.0-vector-query-tool-provider-options-20250828222356 → 0.0.0-vector-extension-schema-20250922130418
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/CHANGELOG.md +1289 -0
- package/dist/index.cjs +26 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +26 -16
- package/dist/index.js.map +1 -1
- package/dist/storage/domains/memory/index.d.ts.map +1 -1
- package/dist/storage/domains/workflows/index.d.ts +1 -0
- package/dist/storage/domains/workflows/index.d.ts.map +1 -1
- package/dist/storage/index.d.ts +1 -0
- package/dist/storage/index.d.ts.map +1 -1
- package/package.json +21 -11
package/dist/index.cjs
CHANGED
|
@@ -469,9 +469,9 @@ var MemoryStorageCloudflare = class extends storage.MemoryStorage {
|
|
|
469
469
|
const messageMigrationTasks = [];
|
|
470
470
|
for (const message of validatedMessages) {
|
|
471
471
|
const existingMessage = await this.findMessageInAnyThread(message.id);
|
|
472
|
-
console.
|
|
472
|
+
console.info(`Checking message ${message.id}: existing=${existingMessage?.threadId}, new=${message.threadId}`);
|
|
473
473
|
if (existingMessage && existingMessage.threadId && existingMessage.threadId !== message.threadId) {
|
|
474
|
-
console.
|
|
474
|
+
console.info(`Migrating message ${message.id} from ${existingMessage.threadId} to ${message.threadId}`);
|
|
475
475
|
messageMigrationTasks.push(this.migrateMessage(message.id, existingMessage.threadId, message.threadId));
|
|
476
476
|
}
|
|
477
477
|
}
|
|
@@ -500,7 +500,7 @@ var MemoryStorageCloudflare = class extends storage.MemoryStorage {
|
|
|
500
500
|
...cleanMessage,
|
|
501
501
|
createdAt: storage.serializeDate(cleanMessage.createdAt)
|
|
502
502
|
};
|
|
503
|
-
console.
|
|
503
|
+
console.info(`Saving message ${message.id} with content:`, {
|
|
504
504
|
content: serializedMessage.content,
|
|
505
505
|
contentType: typeof serializedMessage.content,
|
|
506
506
|
isArray: Array.isArray(serializedMessage.content)
|
|
@@ -596,13 +596,14 @@ var MemoryStorageCloudflare = class extends storage.MemoryStorage {
|
|
|
596
596
|
);
|
|
597
597
|
}
|
|
598
598
|
async getRecentMessages(threadId, limit, messageIds) {
|
|
599
|
+
if (!threadId.trim()) throw new Error("threadId must be a non-empty string");
|
|
599
600
|
if (limit <= 0) return;
|
|
600
601
|
try {
|
|
601
602
|
const threadMessagesKey = this.getThreadMessagesKey(threadId);
|
|
602
603
|
const latestIds = await this.getLastN(threadMessagesKey, limit);
|
|
603
604
|
latestIds.forEach((id) => messageIds.add(id));
|
|
604
605
|
} catch {
|
|
605
|
-
console.
|
|
606
|
+
console.info(`No message order found for thread ${threadId}, skipping latest messages`);
|
|
606
607
|
}
|
|
607
608
|
}
|
|
608
609
|
async fetchAndParseMessagesFromMultipleThreads(messageIds, include, targetThreadId) {
|
|
@@ -633,7 +634,7 @@ var MemoryStorageCloudflare = class extends storage.MemoryStorage {
|
|
|
633
634
|
const data = await this.operations.getKV(storage.TABLE_MESSAGES, key);
|
|
634
635
|
if (!data) return null;
|
|
635
636
|
const parsed = typeof data === "string" ? JSON.parse(data) : data;
|
|
636
|
-
console.
|
|
637
|
+
console.info(`Retrieved message ${id} from thread ${threadId} with content:`, {
|
|
637
638
|
content: parsed.content,
|
|
638
639
|
contentType: typeof parsed.content,
|
|
639
640
|
isArray: Array.isArray(parsed.content)
|
|
@@ -654,15 +655,14 @@ var MemoryStorageCloudflare = class extends storage.MemoryStorage {
|
|
|
654
655
|
selectBy,
|
|
655
656
|
format
|
|
656
657
|
}) {
|
|
657
|
-
console.
|
|
658
|
-
if (!threadId) throw new Error("threadId is required");
|
|
658
|
+
console.info(`getMessages called with format: ${format}, threadId: ${threadId}`);
|
|
659
659
|
const actualFormat = format || "v1";
|
|
660
|
-
console.
|
|
661
|
-
if (!threadId) throw new Error("threadId is required");
|
|
660
|
+
console.info(`Using format: ${actualFormat}`);
|
|
662
661
|
const limit = storage.resolveMessageLimit({ last: selectBy?.last, defaultLimit: 40 });
|
|
663
662
|
const messageIds = /* @__PURE__ */ new Set();
|
|
664
663
|
if (limit === 0 && !selectBy?.include?.length) return [];
|
|
665
664
|
try {
|
|
665
|
+
if (!threadId.trim()) throw new Error("threadId must be a non-empty string");
|
|
666
666
|
await Promise.all([
|
|
667
667
|
selectBy?.include?.length ? this.getIncludedMessagesWithContext(threadId, selectBy.include, messageIds) : Promise.resolve(),
|
|
668
668
|
limit > 0 ? this.getRecentMessages(threadId, limit, messageIds) : Promise.resolve()
|
|
@@ -707,7 +707,7 @@ var MemoryStorageCloudflare = class extends storage.MemoryStorage {
|
|
|
707
707
|
createdAt: storage.ensureDate(message.createdAt)
|
|
708
708
|
}));
|
|
709
709
|
if (actualFormat === `v1`) {
|
|
710
|
-
console.
|
|
710
|
+
console.info(`Processing ${prepared.length} messages for v1 format - returning directly without MessageList`);
|
|
711
711
|
return prepared.map((msg) => ({
|
|
712
712
|
...msg,
|
|
713
713
|
createdAt: new Date(msg.createdAt)
|
|
@@ -723,7 +723,8 @@ var MemoryStorageCloudflare = class extends storage.MemoryStorage {
|
|
|
723
723
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
724
724
|
text: `Error retrieving messages for thread ${threadId}`,
|
|
725
725
|
details: {
|
|
726
|
-
threadId
|
|
726
|
+
threadId,
|
|
727
|
+
resourceId: resourceId ?? ""
|
|
727
728
|
}
|
|
728
729
|
},
|
|
729
730
|
error$1
|
|
@@ -769,9 +770,10 @@ var MemoryStorageCloudflare = class extends storage.MemoryStorage {
|
|
|
769
770
|
}
|
|
770
771
|
}
|
|
771
772
|
async getMessagesPaginated(args) {
|
|
773
|
+
const { threadId, resourceId, selectBy, format = "v1" } = args;
|
|
774
|
+
const { page = 0, perPage = 100 } = selectBy?.pagination || {};
|
|
772
775
|
try {
|
|
773
|
-
|
|
774
|
-
const { page = 0, perPage = 100 } = selectBy?.pagination || {};
|
|
776
|
+
if (!threadId.trim()) throw new Error("threadId must be a non-empty string");
|
|
775
777
|
const messages = format === "v2" ? await this.getMessages({ threadId, selectBy, format: "v2" }) : await this.getMessages({ threadId, selectBy, format: "v1" });
|
|
776
778
|
let filteredMessages = messages;
|
|
777
779
|
if (selectBy?.pagination?.dateRange) {
|
|
@@ -794,15 +796,22 @@ var MemoryStorageCloudflare = class extends storage.MemoryStorage {
|
|
|
794
796
|
messages: paginatedMessages
|
|
795
797
|
};
|
|
796
798
|
} catch (error$1) {
|
|
797
|
-
|
|
799
|
+
const mastraError = new error.MastraError(
|
|
798
800
|
{
|
|
799
801
|
id: "CLOUDFLARE_STORAGE_GET_MESSAGES_PAGINATED_FAILED",
|
|
800
802
|
domain: error.ErrorDomain.STORAGE,
|
|
801
803
|
category: error.ErrorCategory.THIRD_PARTY,
|
|
802
|
-
text: "Failed to get messages with pagination"
|
|
804
|
+
text: "Failed to get messages with pagination",
|
|
805
|
+
details: {
|
|
806
|
+
threadId,
|
|
807
|
+
resourceId: resourceId ?? ""
|
|
808
|
+
}
|
|
803
809
|
},
|
|
804
810
|
error$1
|
|
805
811
|
);
|
|
812
|
+
this.logger?.trackException?.(mastraError);
|
|
813
|
+
this.logger?.error?.(mastraError.toString());
|
|
814
|
+
return { messages: [], total: 0, page, perPage: perPage || 40, hasMore: false };
|
|
806
815
|
}
|
|
807
816
|
}
|
|
808
817
|
async updateMessages(args) {
|
|
@@ -1953,13 +1962,14 @@ var WorkflowsStorageCloudflare = class extends storage.WorkflowsStorage {
|
|
|
1953
1962
|
}
|
|
1954
1963
|
async persistWorkflowSnapshot(params) {
|
|
1955
1964
|
try {
|
|
1956
|
-
const { workflowName, runId, snapshot } = params;
|
|
1965
|
+
const { workflowName, runId, resourceId, snapshot } = params;
|
|
1957
1966
|
await this.operations.putKV({
|
|
1958
1967
|
tableName: storage.TABLE_WORKFLOW_SNAPSHOT,
|
|
1959
1968
|
key: this.operations.getKey(storage.TABLE_WORKFLOW_SNAPSHOT, { workflow_name: workflowName, run_id: runId }),
|
|
1960
1969
|
value: {
|
|
1961
1970
|
workflow_name: workflowName,
|
|
1962
1971
|
run_id: runId,
|
|
1972
|
+
resourceId,
|
|
1963
1973
|
snapshot: typeof snapshot === "string" ? snapshot : JSON.stringify(snapshot),
|
|
1964
1974
|
createdAt: /* @__PURE__ */ new Date(),
|
|
1965
1975
|
updatedAt: /* @__PURE__ */ new Date()
|