@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.js
CHANGED
|
@@ -463,9 +463,9 @@ var MemoryStorageCloudflare = class extends MemoryStorage {
|
|
|
463
463
|
const messageMigrationTasks = [];
|
|
464
464
|
for (const message of validatedMessages) {
|
|
465
465
|
const existingMessage = await this.findMessageInAnyThread(message.id);
|
|
466
|
-
console.
|
|
466
|
+
console.info(`Checking message ${message.id}: existing=${existingMessage?.threadId}, new=${message.threadId}`);
|
|
467
467
|
if (existingMessage && existingMessage.threadId && existingMessage.threadId !== message.threadId) {
|
|
468
|
-
console.
|
|
468
|
+
console.info(`Migrating message ${message.id} from ${existingMessage.threadId} to ${message.threadId}`);
|
|
469
469
|
messageMigrationTasks.push(this.migrateMessage(message.id, existingMessage.threadId, message.threadId));
|
|
470
470
|
}
|
|
471
471
|
}
|
|
@@ -494,7 +494,7 @@ var MemoryStorageCloudflare = class extends MemoryStorage {
|
|
|
494
494
|
...cleanMessage,
|
|
495
495
|
createdAt: serializeDate(cleanMessage.createdAt)
|
|
496
496
|
};
|
|
497
|
-
console.
|
|
497
|
+
console.info(`Saving message ${message.id} with content:`, {
|
|
498
498
|
content: serializedMessage.content,
|
|
499
499
|
contentType: typeof serializedMessage.content,
|
|
500
500
|
isArray: Array.isArray(serializedMessage.content)
|
|
@@ -590,13 +590,14 @@ var MemoryStorageCloudflare = class extends MemoryStorage {
|
|
|
590
590
|
);
|
|
591
591
|
}
|
|
592
592
|
async getRecentMessages(threadId, limit, messageIds) {
|
|
593
|
+
if (!threadId.trim()) throw new Error("threadId must be a non-empty string");
|
|
593
594
|
if (limit <= 0) return;
|
|
594
595
|
try {
|
|
595
596
|
const threadMessagesKey = this.getThreadMessagesKey(threadId);
|
|
596
597
|
const latestIds = await this.getLastN(threadMessagesKey, limit);
|
|
597
598
|
latestIds.forEach((id) => messageIds.add(id));
|
|
598
599
|
} catch {
|
|
599
|
-
console.
|
|
600
|
+
console.info(`No message order found for thread ${threadId}, skipping latest messages`);
|
|
600
601
|
}
|
|
601
602
|
}
|
|
602
603
|
async fetchAndParseMessagesFromMultipleThreads(messageIds, include, targetThreadId) {
|
|
@@ -627,7 +628,7 @@ var MemoryStorageCloudflare = class extends MemoryStorage {
|
|
|
627
628
|
const data = await this.operations.getKV(TABLE_MESSAGES, key);
|
|
628
629
|
if (!data) return null;
|
|
629
630
|
const parsed = typeof data === "string" ? JSON.parse(data) : data;
|
|
630
|
-
console.
|
|
631
|
+
console.info(`Retrieved message ${id} from thread ${threadId} with content:`, {
|
|
631
632
|
content: parsed.content,
|
|
632
633
|
contentType: typeof parsed.content,
|
|
633
634
|
isArray: Array.isArray(parsed.content)
|
|
@@ -648,15 +649,14 @@ var MemoryStorageCloudflare = class extends MemoryStorage {
|
|
|
648
649
|
selectBy,
|
|
649
650
|
format
|
|
650
651
|
}) {
|
|
651
|
-
console.
|
|
652
|
-
if (!threadId) throw new Error("threadId is required");
|
|
652
|
+
console.info(`getMessages called with format: ${format}, threadId: ${threadId}`);
|
|
653
653
|
const actualFormat = format || "v1";
|
|
654
|
-
console.
|
|
655
|
-
if (!threadId) throw new Error("threadId is required");
|
|
654
|
+
console.info(`Using format: ${actualFormat}`);
|
|
656
655
|
const limit = resolveMessageLimit({ last: selectBy?.last, defaultLimit: 40 });
|
|
657
656
|
const messageIds = /* @__PURE__ */ new Set();
|
|
658
657
|
if (limit === 0 && !selectBy?.include?.length) return [];
|
|
659
658
|
try {
|
|
659
|
+
if (!threadId.trim()) throw new Error("threadId must be a non-empty string");
|
|
660
660
|
await Promise.all([
|
|
661
661
|
selectBy?.include?.length ? this.getIncludedMessagesWithContext(threadId, selectBy.include, messageIds) : Promise.resolve(),
|
|
662
662
|
limit > 0 ? this.getRecentMessages(threadId, limit, messageIds) : Promise.resolve()
|
|
@@ -701,7 +701,7 @@ var MemoryStorageCloudflare = class extends MemoryStorage {
|
|
|
701
701
|
createdAt: ensureDate(message.createdAt)
|
|
702
702
|
}));
|
|
703
703
|
if (actualFormat === `v1`) {
|
|
704
|
-
console.
|
|
704
|
+
console.info(`Processing ${prepared.length} messages for v1 format - returning directly without MessageList`);
|
|
705
705
|
return prepared.map((msg) => ({
|
|
706
706
|
...msg,
|
|
707
707
|
createdAt: new Date(msg.createdAt)
|
|
@@ -717,7 +717,8 @@ var MemoryStorageCloudflare = class extends MemoryStorage {
|
|
|
717
717
|
category: ErrorCategory.THIRD_PARTY,
|
|
718
718
|
text: `Error retrieving messages for thread ${threadId}`,
|
|
719
719
|
details: {
|
|
720
|
-
threadId
|
|
720
|
+
threadId,
|
|
721
|
+
resourceId: resourceId ?? ""
|
|
721
722
|
}
|
|
722
723
|
},
|
|
723
724
|
error
|
|
@@ -763,9 +764,10 @@ var MemoryStorageCloudflare = class extends MemoryStorage {
|
|
|
763
764
|
}
|
|
764
765
|
}
|
|
765
766
|
async getMessagesPaginated(args) {
|
|
767
|
+
const { threadId, resourceId, selectBy, format = "v1" } = args;
|
|
768
|
+
const { page = 0, perPage = 100 } = selectBy?.pagination || {};
|
|
766
769
|
try {
|
|
767
|
-
|
|
768
|
-
const { page = 0, perPage = 100 } = selectBy?.pagination || {};
|
|
770
|
+
if (!threadId.trim()) throw new Error("threadId must be a non-empty string");
|
|
769
771
|
const messages = format === "v2" ? await this.getMessages({ threadId, selectBy, format: "v2" }) : await this.getMessages({ threadId, selectBy, format: "v1" });
|
|
770
772
|
let filteredMessages = messages;
|
|
771
773
|
if (selectBy?.pagination?.dateRange) {
|
|
@@ -788,15 +790,22 @@ var MemoryStorageCloudflare = class extends MemoryStorage {
|
|
|
788
790
|
messages: paginatedMessages
|
|
789
791
|
};
|
|
790
792
|
} catch (error) {
|
|
791
|
-
|
|
793
|
+
const mastraError = new MastraError(
|
|
792
794
|
{
|
|
793
795
|
id: "CLOUDFLARE_STORAGE_GET_MESSAGES_PAGINATED_FAILED",
|
|
794
796
|
domain: ErrorDomain.STORAGE,
|
|
795
797
|
category: ErrorCategory.THIRD_PARTY,
|
|
796
|
-
text: "Failed to get messages with pagination"
|
|
798
|
+
text: "Failed to get messages with pagination",
|
|
799
|
+
details: {
|
|
800
|
+
threadId,
|
|
801
|
+
resourceId: resourceId ?? ""
|
|
802
|
+
}
|
|
797
803
|
},
|
|
798
804
|
error
|
|
799
805
|
);
|
|
806
|
+
this.logger?.trackException?.(mastraError);
|
|
807
|
+
this.logger?.error?.(mastraError.toString());
|
|
808
|
+
return { messages: [], total: 0, page, perPage: perPage || 40, hasMore: false };
|
|
800
809
|
}
|
|
801
810
|
}
|
|
802
811
|
async updateMessages(args) {
|
|
@@ -1947,13 +1956,14 @@ var WorkflowsStorageCloudflare = class extends WorkflowsStorage {
|
|
|
1947
1956
|
}
|
|
1948
1957
|
async persistWorkflowSnapshot(params) {
|
|
1949
1958
|
try {
|
|
1950
|
-
const { workflowName, runId, snapshot } = params;
|
|
1959
|
+
const { workflowName, runId, resourceId, snapshot } = params;
|
|
1951
1960
|
await this.operations.putKV({
|
|
1952
1961
|
tableName: TABLE_WORKFLOW_SNAPSHOT,
|
|
1953
1962
|
key: this.operations.getKey(TABLE_WORKFLOW_SNAPSHOT, { workflow_name: workflowName, run_id: runId }),
|
|
1954
1963
|
value: {
|
|
1955
1964
|
workflow_name: workflowName,
|
|
1956
1965
|
run_id: runId,
|
|
1966
|
+
resourceId,
|
|
1957
1967
|
snapshot: typeof snapshot === "string" ? snapshot : JSON.stringify(snapshot),
|
|
1958
1968
|
createdAt: /* @__PURE__ */ new Date(),
|
|
1959
1969
|
updatedAt: /* @__PURE__ */ new Date()
|