@mastra/cloudflare 0.0.0-vnextWorkflows-20250422142014 → 0.0.0-working-memory-per-user-20250620161509
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/_tsup-dts-rollup.d.cts +99 -33
- package/dist/_tsup-dts-rollup.d.ts +99 -33
- package/dist/index.cjs +311 -73
- package/dist/index.js +312 -74
- package/package.json +17 -13
|
@@ -1,18 +1,25 @@
|
|
|
1
1
|
import type { EvalRow } from '@mastra/core/storage';
|
|
2
2
|
import type { KVNamespace as KVNamespace_2 } from '@cloudflare/workers-types';
|
|
3
3
|
import { KVNamespaceListKey as KVNamespaceListKey_2 } from '@cloudflare/workers-types';
|
|
4
|
+
import type { MastraMessageContentV2 } from '@mastra/core/agent';
|
|
5
|
+
import type { MastraMessageV1 } from '@mastra/core/memory';
|
|
6
|
+
import type { MastraMessageV2 } from '@mastra/core/memory';
|
|
4
7
|
import { MastraStorage } from '@mastra/core/storage';
|
|
5
|
-
import type {
|
|
6
|
-
import type { MessageType as MessageType_2 } from '@mastra/core';
|
|
8
|
+
import type { PaginationInfo } from '@mastra/core/storage';
|
|
7
9
|
import type { StorageColumn } from '@mastra/core/storage';
|
|
8
10
|
import type { StorageGetMessagesArg } from '@mastra/core/storage';
|
|
11
|
+
import type { StorageGetTracesArg } from '@mastra/core/storage';
|
|
12
|
+
import type { StorageResourceType } from '@mastra/core/storage';
|
|
9
13
|
import type { StorageThreadType } from '@mastra/core/memory';
|
|
10
14
|
import type { TABLE_EVALS } from '@mastra/core/storage';
|
|
11
15
|
import type { TABLE_MESSAGES } from '@mastra/core/storage';
|
|
12
16
|
import type { TABLE_NAMES } from '@mastra/core/storage';
|
|
17
|
+
import type { TABLE_RESOURCES } from '@mastra/core/storage';
|
|
13
18
|
import type { TABLE_THREADS } from '@mastra/core/storage';
|
|
14
19
|
import type { TABLE_TRACES } from '@mastra/core/storage';
|
|
15
20
|
import type { TABLE_WORKFLOW_SNAPSHOT } from '@mastra/core/storage';
|
|
21
|
+
import type { Trace } from '@mastra/core/telemetry';
|
|
22
|
+
import type { WorkflowRun } from '@mastra/core/storage';
|
|
16
23
|
import type { WorkflowRuns } from '@mastra/core/storage';
|
|
17
24
|
import type { WorkflowRunState } from '@mastra/core/workflows';
|
|
18
25
|
import type { WorkflowRunState as WorkflowRunState_2 } from '@mastra/core';
|
|
@@ -46,15 +53,26 @@ declare class CloudflareStore extends MastraStorage {
|
|
|
46
53
|
private getNamespaceValue;
|
|
47
54
|
private putNamespaceValue;
|
|
48
55
|
private deleteNamespaceValue;
|
|
49
|
-
listNamespaceKeys(tableName: TABLE_NAMES, options?:
|
|
50
|
-
limit?: number;
|
|
51
|
-
prefix?: string;
|
|
52
|
-
}): Promise<KVNamespaceListKey_2<unknown, string>[]>;
|
|
56
|
+
listNamespaceKeys(tableName: TABLE_NAMES, options?: ListOptions): Promise<KVNamespaceListKey_2<unknown, string>[]>;
|
|
53
57
|
private createNamespaceById;
|
|
54
58
|
private getNamespaceIdByName;
|
|
55
59
|
private createNamespace;
|
|
56
60
|
private getOrCreateNamespaceId;
|
|
57
61
|
private getNamespaceId;
|
|
62
|
+
private LEGACY_NAMESPACE_MAP;
|
|
63
|
+
/**
|
|
64
|
+
* There were a few legacy mappings for tables such as
|
|
65
|
+
* - messages -> threads
|
|
66
|
+
* - workflow_snapshot -> mastra_workflows
|
|
67
|
+
* - traces -> evals
|
|
68
|
+
* This has been updated to use dedicated namespaces for each table.
|
|
69
|
+
* In the case of data for a table existing in the legacy namespace, warn the user to migrate to the new namespace.
|
|
70
|
+
*
|
|
71
|
+
* @param tableName The table name to check for legacy data
|
|
72
|
+
* @param prefix The namespace prefix
|
|
73
|
+
* @returns The legacy namespace ID if data exists; otherwise, null
|
|
74
|
+
*/
|
|
75
|
+
private checkLegacyNamespace;
|
|
58
76
|
/**
|
|
59
77
|
* Helper to safely serialize data for KV storage
|
|
60
78
|
*/
|
|
@@ -93,19 +111,28 @@ declare class CloudflareStore extends MastraStorage {
|
|
|
93
111
|
private validateColumnValue;
|
|
94
112
|
private validateAgainstSchema;
|
|
95
113
|
private validateRecord;
|
|
96
|
-
private ensureDate;
|
|
97
|
-
private serializeDate;
|
|
98
114
|
private ensureMetadata;
|
|
99
115
|
createTable({ tableName, schema, }: {
|
|
100
116
|
tableName: TABLE_NAMES;
|
|
101
117
|
schema: Record<string, StorageColumn>;
|
|
102
118
|
}): Promise<void>;
|
|
119
|
+
/**
|
|
120
|
+
* No-op: This backend is schemaless and does not require schema changes.
|
|
121
|
+
* @param tableName Name of the table
|
|
122
|
+
* @param schema Schema of the table
|
|
123
|
+
* @param ifNotExists Array of column names to add if they don't exist
|
|
124
|
+
*/
|
|
125
|
+
alterTable(_args: {
|
|
126
|
+
tableName: TABLE_NAMES;
|
|
127
|
+
schema: Record<string, StorageColumn>;
|
|
128
|
+
ifNotExists: string[];
|
|
129
|
+
}): Promise<void>;
|
|
103
130
|
clearTable({ tableName }: {
|
|
104
131
|
tableName: TABLE_NAMES;
|
|
105
132
|
}): Promise<void>;
|
|
106
|
-
insert<T extends TABLE_NAMES>({ tableName, record }: {
|
|
133
|
+
insert<T extends TABLE_NAMES>({ tableName, record, }: {
|
|
107
134
|
tableName: T;
|
|
108
|
-
record:
|
|
135
|
+
record: Record<string, any>;
|
|
109
136
|
}): Promise<void>;
|
|
110
137
|
load<R>({ tableName, keys }: {
|
|
111
138
|
tableName: TABLE_NAMES;
|
|
@@ -130,10 +157,20 @@ declare class CloudflareStore extends MastraStorage {
|
|
|
130
157
|
}): Promise<void>;
|
|
131
158
|
private getMessageKey;
|
|
132
159
|
private getThreadMessagesKey;
|
|
133
|
-
saveMessages(
|
|
134
|
-
messages:
|
|
135
|
-
|
|
136
|
-
|
|
160
|
+
saveMessages(args: {
|
|
161
|
+
messages: MastraMessageV1[];
|
|
162
|
+
format?: undefined | 'v1';
|
|
163
|
+
}): Promise<MastraMessageV1[]>;
|
|
164
|
+
saveMessages(args: {
|
|
165
|
+
messages: MastraMessageV2[];
|
|
166
|
+
format: 'v2';
|
|
167
|
+
}): Promise<MastraMessageV2[]>;
|
|
168
|
+
getMessages(args: StorageGetMessagesArg & {
|
|
169
|
+
format?: 'v1';
|
|
170
|
+
}): Promise<MastraMessageV1[]>;
|
|
171
|
+
getMessages(args: StorageGetMessagesArg & {
|
|
172
|
+
format: 'v2';
|
|
173
|
+
}): Promise<MastraMessageV2[]>;
|
|
137
174
|
private validateWorkflowParams;
|
|
138
175
|
private validateWorkflowState;
|
|
139
176
|
private normalizeSteps;
|
|
@@ -153,24 +190,56 @@ declare class CloudflareStore extends MastraStorage {
|
|
|
153
190
|
tableName: T;
|
|
154
191
|
records: Partial<RecordTypes[T]>[];
|
|
155
192
|
}): Promise<void>;
|
|
156
|
-
getTraces({ name, scope, page, perPage, attributes, }: {
|
|
193
|
+
getTraces({ name, scope, page, perPage, attributes, fromDate, toDate, }: {
|
|
157
194
|
name?: string;
|
|
158
195
|
scope?: string;
|
|
159
196
|
page: number;
|
|
160
197
|
perPage: number;
|
|
161
198
|
attributes?: Record<string, string>;
|
|
199
|
+
fromDate?: Date;
|
|
200
|
+
toDate?: Date;
|
|
162
201
|
}): Promise<any[]>;
|
|
163
202
|
private parseJSON;
|
|
164
203
|
getEvalsByAgentName(_agentName: string, _type?: 'test' | 'live'): Promise<EvalRow[]>;
|
|
165
|
-
|
|
204
|
+
private parseWorkflowRun;
|
|
205
|
+
private buildWorkflowSnapshotPrefix;
|
|
206
|
+
getWorkflowRuns({ namespace, workflowName, limit, offset, resourceId, fromDate, toDate, }?: {
|
|
166
207
|
namespace?: string;
|
|
167
208
|
workflowName?: string;
|
|
168
|
-
fromDate?: Date;
|
|
169
|
-
toDate?: Date;
|
|
170
209
|
limit?: number;
|
|
171
210
|
offset?: number;
|
|
211
|
+
resourceId?: string;
|
|
212
|
+
fromDate?: Date;
|
|
213
|
+
toDate?: Date;
|
|
172
214
|
}): Promise<WorkflowRuns>;
|
|
215
|
+
getWorkflowRunById({ namespace, runId, workflowName, }: {
|
|
216
|
+
namespace: string;
|
|
217
|
+
runId: string;
|
|
218
|
+
workflowName: string;
|
|
219
|
+
}): Promise<WorkflowRun | null>;
|
|
220
|
+
getTracesPaginated(_args: StorageGetTracesArg): Promise<PaginationInfo & {
|
|
221
|
+
traces: Trace[];
|
|
222
|
+
}>;
|
|
223
|
+
getThreadsByResourceIdPaginated(_args: {
|
|
224
|
+
resourceId: string;
|
|
225
|
+
page?: number;
|
|
226
|
+
perPage?: number;
|
|
227
|
+
}): Promise<PaginationInfo & {
|
|
228
|
+
threads: StorageThreadType[];
|
|
229
|
+
}>;
|
|
230
|
+
getMessagesPaginated(_args: StorageGetMessagesArg): Promise<PaginationInfo & {
|
|
231
|
+
messages: MastraMessageV1[] | MastraMessageV2[];
|
|
232
|
+
}>;
|
|
173
233
|
close(): Promise<void>;
|
|
234
|
+
updateMessages(_args: {
|
|
235
|
+
messages: Partial<Omit<MastraMessageV2, 'createdAt'>> & {
|
|
236
|
+
id: string;
|
|
237
|
+
content?: {
|
|
238
|
+
metadata?: MastraMessageContentV2['metadata'];
|
|
239
|
+
content?: MastraMessageContentV2['content'];
|
|
240
|
+
};
|
|
241
|
+
}[];
|
|
242
|
+
}): Promise<MastraMessageV2[]>;
|
|
174
243
|
}
|
|
175
244
|
export { CloudflareStore }
|
|
176
245
|
export { CloudflareStore as CloudflareStore_alias_1 }
|
|
@@ -192,19 +261,6 @@ export declare interface CloudflareWorkersConfig {
|
|
|
192
261
|
keyPrefix?: string;
|
|
193
262
|
}
|
|
194
263
|
|
|
195
|
-
export declare const createSampleMessage: (threadId: string) => MessageType_2;
|
|
196
|
-
|
|
197
|
-
export declare const createSampleThread: () => {
|
|
198
|
-
id: string;
|
|
199
|
-
resourceId: string;
|
|
200
|
-
title: string;
|
|
201
|
-
createdAt: Date;
|
|
202
|
-
updatedAt: Date;
|
|
203
|
-
metadata: {
|
|
204
|
-
key: string;
|
|
205
|
-
};
|
|
206
|
-
};
|
|
207
|
-
|
|
208
264
|
export declare const createSampleTrace: (name: string, scope?: string, attributes?: Record<string, string>) => {
|
|
209
265
|
id: string;
|
|
210
266
|
parentSpanId: string;
|
|
@@ -222,7 +278,11 @@ export declare const createSampleTrace: (name: string, scope?: string, attribute
|
|
|
222
278
|
createdAt: string;
|
|
223
279
|
};
|
|
224
280
|
|
|
225
|
-
export declare const createSampleWorkflowSnapshot: (threadId: string) =>
|
|
281
|
+
export declare const createSampleWorkflowSnapshot: (threadId: string, status: string, createdAt?: Date) => {
|
|
282
|
+
snapshot: WorkflowRunState_2;
|
|
283
|
+
runId: string;
|
|
284
|
+
stepId: string;
|
|
285
|
+
};
|
|
226
286
|
|
|
227
287
|
/**
|
|
228
288
|
* Helper to determine if a config is using Workers bindings
|
|
@@ -243,12 +303,18 @@ export declare interface KVOperation {
|
|
|
243
303
|
metadata?: any;
|
|
244
304
|
}
|
|
245
305
|
|
|
306
|
+
export declare type ListOptions = {
|
|
307
|
+
limit?: number;
|
|
308
|
+
prefix?: string;
|
|
309
|
+
};
|
|
310
|
+
|
|
246
311
|
export declare type RecordTypes = {
|
|
247
312
|
[TABLE_THREADS]: StorageThreadType;
|
|
248
|
-
[TABLE_MESSAGES]:
|
|
313
|
+
[TABLE_MESSAGES]: MastraMessageV2;
|
|
249
314
|
[TABLE_WORKFLOW_SNAPSHOT]: WorkflowRunState;
|
|
250
315
|
[TABLE_EVALS]: EvalRow;
|
|
251
316
|
[TABLE_TRACES]: any;
|
|
317
|
+
[TABLE_RESOURCES]: StorageResourceType;
|
|
252
318
|
};
|
|
253
319
|
|
|
254
320
|
export declare const retryUntil: <T>(fn: () => Promise<T>, condition: (result: T) => boolean, timeout?: number, // REST API needs longer timeout due to higher latency
|
|
@@ -1,18 +1,25 @@
|
|
|
1
1
|
import type { EvalRow } from '@mastra/core/storage';
|
|
2
2
|
import type { KVNamespace as KVNamespace_2 } from '@cloudflare/workers-types';
|
|
3
3
|
import { KVNamespaceListKey as KVNamespaceListKey_2 } from '@cloudflare/workers-types';
|
|
4
|
+
import type { MastraMessageContentV2 } from '@mastra/core/agent';
|
|
5
|
+
import type { MastraMessageV1 } from '@mastra/core/memory';
|
|
6
|
+
import type { MastraMessageV2 } from '@mastra/core/memory';
|
|
4
7
|
import { MastraStorage } from '@mastra/core/storage';
|
|
5
|
-
import type {
|
|
6
|
-
import type { MessageType as MessageType_2 } from '@mastra/core';
|
|
8
|
+
import type { PaginationInfo } from '@mastra/core/storage';
|
|
7
9
|
import type { StorageColumn } from '@mastra/core/storage';
|
|
8
10
|
import type { StorageGetMessagesArg } from '@mastra/core/storage';
|
|
11
|
+
import type { StorageGetTracesArg } from '@mastra/core/storage';
|
|
12
|
+
import type { StorageResourceType } from '@mastra/core/storage';
|
|
9
13
|
import type { StorageThreadType } from '@mastra/core/memory';
|
|
10
14
|
import type { TABLE_EVALS } from '@mastra/core/storage';
|
|
11
15
|
import type { TABLE_MESSAGES } from '@mastra/core/storage';
|
|
12
16
|
import type { TABLE_NAMES } from '@mastra/core/storage';
|
|
17
|
+
import type { TABLE_RESOURCES } from '@mastra/core/storage';
|
|
13
18
|
import type { TABLE_THREADS } from '@mastra/core/storage';
|
|
14
19
|
import type { TABLE_TRACES } from '@mastra/core/storage';
|
|
15
20
|
import type { TABLE_WORKFLOW_SNAPSHOT } from '@mastra/core/storage';
|
|
21
|
+
import type { Trace } from '@mastra/core/telemetry';
|
|
22
|
+
import type { WorkflowRun } from '@mastra/core/storage';
|
|
16
23
|
import type { WorkflowRuns } from '@mastra/core/storage';
|
|
17
24
|
import type { WorkflowRunState } from '@mastra/core/workflows';
|
|
18
25
|
import type { WorkflowRunState as WorkflowRunState_2 } from '@mastra/core';
|
|
@@ -46,15 +53,26 @@ declare class CloudflareStore extends MastraStorage {
|
|
|
46
53
|
private getNamespaceValue;
|
|
47
54
|
private putNamespaceValue;
|
|
48
55
|
private deleteNamespaceValue;
|
|
49
|
-
listNamespaceKeys(tableName: TABLE_NAMES, options?:
|
|
50
|
-
limit?: number;
|
|
51
|
-
prefix?: string;
|
|
52
|
-
}): Promise<KVNamespaceListKey_2<unknown, string>[]>;
|
|
56
|
+
listNamespaceKeys(tableName: TABLE_NAMES, options?: ListOptions): Promise<KVNamespaceListKey_2<unknown, string>[]>;
|
|
53
57
|
private createNamespaceById;
|
|
54
58
|
private getNamespaceIdByName;
|
|
55
59
|
private createNamespace;
|
|
56
60
|
private getOrCreateNamespaceId;
|
|
57
61
|
private getNamespaceId;
|
|
62
|
+
private LEGACY_NAMESPACE_MAP;
|
|
63
|
+
/**
|
|
64
|
+
* There were a few legacy mappings for tables such as
|
|
65
|
+
* - messages -> threads
|
|
66
|
+
* - workflow_snapshot -> mastra_workflows
|
|
67
|
+
* - traces -> evals
|
|
68
|
+
* This has been updated to use dedicated namespaces for each table.
|
|
69
|
+
* In the case of data for a table existing in the legacy namespace, warn the user to migrate to the new namespace.
|
|
70
|
+
*
|
|
71
|
+
* @param tableName The table name to check for legacy data
|
|
72
|
+
* @param prefix The namespace prefix
|
|
73
|
+
* @returns The legacy namespace ID if data exists; otherwise, null
|
|
74
|
+
*/
|
|
75
|
+
private checkLegacyNamespace;
|
|
58
76
|
/**
|
|
59
77
|
* Helper to safely serialize data for KV storage
|
|
60
78
|
*/
|
|
@@ -93,19 +111,28 @@ declare class CloudflareStore extends MastraStorage {
|
|
|
93
111
|
private validateColumnValue;
|
|
94
112
|
private validateAgainstSchema;
|
|
95
113
|
private validateRecord;
|
|
96
|
-
private ensureDate;
|
|
97
|
-
private serializeDate;
|
|
98
114
|
private ensureMetadata;
|
|
99
115
|
createTable({ tableName, schema, }: {
|
|
100
116
|
tableName: TABLE_NAMES;
|
|
101
117
|
schema: Record<string, StorageColumn>;
|
|
102
118
|
}): Promise<void>;
|
|
119
|
+
/**
|
|
120
|
+
* No-op: This backend is schemaless and does not require schema changes.
|
|
121
|
+
* @param tableName Name of the table
|
|
122
|
+
* @param schema Schema of the table
|
|
123
|
+
* @param ifNotExists Array of column names to add if they don't exist
|
|
124
|
+
*/
|
|
125
|
+
alterTable(_args: {
|
|
126
|
+
tableName: TABLE_NAMES;
|
|
127
|
+
schema: Record<string, StorageColumn>;
|
|
128
|
+
ifNotExists: string[];
|
|
129
|
+
}): Promise<void>;
|
|
103
130
|
clearTable({ tableName }: {
|
|
104
131
|
tableName: TABLE_NAMES;
|
|
105
132
|
}): Promise<void>;
|
|
106
|
-
insert<T extends TABLE_NAMES>({ tableName, record }: {
|
|
133
|
+
insert<T extends TABLE_NAMES>({ tableName, record, }: {
|
|
107
134
|
tableName: T;
|
|
108
|
-
record:
|
|
135
|
+
record: Record<string, any>;
|
|
109
136
|
}): Promise<void>;
|
|
110
137
|
load<R>({ tableName, keys }: {
|
|
111
138
|
tableName: TABLE_NAMES;
|
|
@@ -130,10 +157,20 @@ declare class CloudflareStore extends MastraStorage {
|
|
|
130
157
|
}): Promise<void>;
|
|
131
158
|
private getMessageKey;
|
|
132
159
|
private getThreadMessagesKey;
|
|
133
|
-
saveMessages(
|
|
134
|
-
messages:
|
|
135
|
-
|
|
136
|
-
|
|
160
|
+
saveMessages(args: {
|
|
161
|
+
messages: MastraMessageV1[];
|
|
162
|
+
format?: undefined | 'v1';
|
|
163
|
+
}): Promise<MastraMessageV1[]>;
|
|
164
|
+
saveMessages(args: {
|
|
165
|
+
messages: MastraMessageV2[];
|
|
166
|
+
format: 'v2';
|
|
167
|
+
}): Promise<MastraMessageV2[]>;
|
|
168
|
+
getMessages(args: StorageGetMessagesArg & {
|
|
169
|
+
format?: 'v1';
|
|
170
|
+
}): Promise<MastraMessageV1[]>;
|
|
171
|
+
getMessages(args: StorageGetMessagesArg & {
|
|
172
|
+
format: 'v2';
|
|
173
|
+
}): Promise<MastraMessageV2[]>;
|
|
137
174
|
private validateWorkflowParams;
|
|
138
175
|
private validateWorkflowState;
|
|
139
176
|
private normalizeSteps;
|
|
@@ -153,24 +190,56 @@ declare class CloudflareStore extends MastraStorage {
|
|
|
153
190
|
tableName: T;
|
|
154
191
|
records: Partial<RecordTypes[T]>[];
|
|
155
192
|
}): Promise<void>;
|
|
156
|
-
getTraces({ name, scope, page, perPage, attributes, }: {
|
|
193
|
+
getTraces({ name, scope, page, perPage, attributes, fromDate, toDate, }: {
|
|
157
194
|
name?: string;
|
|
158
195
|
scope?: string;
|
|
159
196
|
page: number;
|
|
160
197
|
perPage: number;
|
|
161
198
|
attributes?: Record<string, string>;
|
|
199
|
+
fromDate?: Date;
|
|
200
|
+
toDate?: Date;
|
|
162
201
|
}): Promise<any[]>;
|
|
163
202
|
private parseJSON;
|
|
164
203
|
getEvalsByAgentName(_agentName: string, _type?: 'test' | 'live'): Promise<EvalRow[]>;
|
|
165
|
-
|
|
204
|
+
private parseWorkflowRun;
|
|
205
|
+
private buildWorkflowSnapshotPrefix;
|
|
206
|
+
getWorkflowRuns({ namespace, workflowName, limit, offset, resourceId, fromDate, toDate, }?: {
|
|
166
207
|
namespace?: string;
|
|
167
208
|
workflowName?: string;
|
|
168
|
-
fromDate?: Date;
|
|
169
|
-
toDate?: Date;
|
|
170
209
|
limit?: number;
|
|
171
210
|
offset?: number;
|
|
211
|
+
resourceId?: string;
|
|
212
|
+
fromDate?: Date;
|
|
213
|
+
toDate?: Date;
|
|
172
214
|
}): Promise<WorkflowRuns>;
|
|
215
|
+
getWorkflowRunById({ namespace, runId, workflowName, }: {
|
|
216
|
+
namespace: string;
|
|
217
|
+
runId: string;
|
|
218
|
+
workflowName: string;
|
|
219
|
+
}): Promise<WorkflowRun | null>;
|
|
220
|
+
getTracesPaginated(_args: StorageGetTracesArg): Promise<PaginationInfo & {
|
|
221
|
+
traces: Trace[];
|
|
222
|
+
}>;
|
|
223
|
+
getThreadsByResourceIdPaginated(_args: {
|
|
224
|
+
resourceId: string;
|
|
225
|
+
page?: number;
|
|
226
|
+
perPage?: number;
|
|
227
|
+
}): Promise<PaginationInfo & {
|
|
228
|
+
threads: StorageThreadType[];
|
|
229
|
+
}>;
|
|
230
|
+
getMessagesPaginated(_args: StorageGetMessagesArg): Promise<PaginationInfo & {
|
|
231
|
+
messages: MastraMessageV1[] | MastraMessageV2[];
|
|
232
|
+
}>;
|
|
173
233
|
close(): Promise<void>;
|
|
234
|
+
updateMessages(_args: {
|
|
235
|
+
messages: Partial<Omit<MastraMessageV2, 'createdAt'>> & {
|
|
236
|
+
id: string;
|
|
237
|
+
content?: {
|
|
238
|
+
metadata?: MastraMessageContentV2['metadata'];
|
|
239
|
+
content?: MastraMessageContentV2['content'];
|
|
240
|
+
};
|
|
241
|
+
}[];
|
|
242
|
+
}): Promise<MastraMessageV2[]>;
|
|
174
243
|
}
|
|
175
244
|
export { CloudflareStore }
|
|
176
245
|
export { CloudflareStore as CloudflareStore_alias_1 }
|
|
@@ -192,19 +261,6 @@ export declare interface CloudflareWorkersConfig {
|
|
|
192
261
|
keyPrefix?: string;
|
|
193
262
|
}
|
|
194
263
|
|
|
195
|
-
export declare const createSampleMessage: (threadId: string) => MessageType_2;
|
|
196
|
-
|
|
197
|
-
export declare const createSampleThread: () => {
|
|
198
|
-
id: string;
|
|
199
|
-
resourceId: string;
|
|
200
|
-
title: string;
|
|
201
|
-
createdAt: Date;
|
|
202
|
-
updatedAt: Date;
|
|
203
|
-
metadata: {
|
|
204
|
-
key: string;
|
|
205
|
-
};
|
|
206
|
-
};
|
|
207
|
-
|
|
208
264
|
export declare const createSampleTrace: (name: string, scope?: string, attributes?: Record<string, string>) => {
|
|
209
265
|
id: string;
|
|
210
266
|
parentSpanId: string;
|
|
@@ -222,7 +278,11 @@ export declare const createSampleTrace: (name: string, scope?: string, attribute
|
|
|
222
278
|
createdAt: string;
|
|
223
279
|
};
|
|
224
280
|
|
|
225
|
-
export declare const createSampleWorkflowSnapshot: (threadId: string) =>
|
|
281
|
+
export declare const createSampleWorkflowSnapshot: (threadId: string, status: string, createdAt?: Date) => {
|
|
282
|
+
snapshot: WorkflowRunState_2;
|
|
283
|
+
runId: string;
|
|
284
|
+
stepId: string;
|
|
285
|
+
};
|
|
226
286
|
|
|
227
287
|
/**
|
|
228
288
|
* Helper to determine if a config is using Workers bindings
|
|
@@ -243,12 +303,18 @@ export declare interface KVOperation {
|
|
|
243
303
|
metadata?: any;
|
|
244
304
|
}
|
|
245
305
|
|
|
306
|
+
export declare type ListOptions = {
|
|
307
|
+
limit?: number;
|
|
308
|
+
prefix?: string;
|
|
309
|
+
};
|
|
310
|
+
|
|
246
311
|
export declare type RecordTypes = {
|
|
247
312
|
[TABLE_THREADS]: StorageThreadType;
|
|
248
|
-
[TABLE_MESSAGES]:
|
|
313
|
+
[TABLE_MESSAGES]: MastraMessageV2;
|
|
249
314
|
[TABLE_WORKFLOW_SNAPSHOT]: WorkflowRunState;
|
|
250
315
|
[TABLE_EVALS]: EvalRow;
|
|
251
316
|
[TABLE_TRACES]: any;
|
|
317
|
+
[TABLE_RESOURCES]: StorageResourceType;
|
|
252
318
|
};
|
|
253
319
|
|
|
254
320
|
export declare const retryUntil: <T>(fn: () => Promise<T>, condition: (result: T) => boolean, timeout?: number, // REST API needs longer timeout due to higher latency
|