@mastra/dynamodb 0.0.0-update-scorers-api-20250801170445 → 0.0.0-usechat-duplicate-20251016110554

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.
Files changed (41) hide show
  1. package/CHANGELOG.md +1048 -0
  2. package/README.md +0 -4
  3. package/dist/entities/index.d.ts +15 -0
  4. package/dist/entities/index.d.ts.map +1 -1
  5. package/dist/entities/score.d.ts +15 -0
  6. package/dist/entities/score.d.ts.map +1 -1
  7. package/dist/index.cjs +222 -53
  8. package/dist/index.cjs.map +1 -1
  9. package/dist/index.d.ts +1 -1
  10. package/dist/index.js +223 -54
  11. package/dist/index.js.map +1 -1
  12. package/dist/storage/domains/memory/index.d.ts +16 -4
  13. package/dist/storage/domains/memory/index.d.ts.map +1 -1
  14. package/dist/storage/domains/operations/index.d.ts.map +1 -1
  15. package/dist/storage/domains/score/index.d.ts +11 -2
  16. package/dist/storage/domains/score/index.d.ts.map +1 -1
  17. package/dist/storage/domains/traces/index.d.ts +1 -1
  18. package/dist/storage/domains/workflows/index.d.ts +21 -2
  19. package/dist/storage/domains/workflows/index.d.ts.map +1 -1
  20. package/dist/storage/index.d.ts +47 -8
  21. package/dist/storage/index.d.ts.map +1 -1
  22. package/package.json +22 -12
  23. package/src/entities/eval.ts +0 -102
  24. package/src/entities/index.ts +0 -27
  25. package/src/entities/message.ts +0 -143
  26. package/src/entities/resource.ts +0 -57
  27. package/src/entities/score.ts +0 -317
  28. package/src/entities/thread.ts +0 -66
  29. package/src/entities/trace.ts +0 -129
  30. package/src/entities/utils.ts +0 -51
  31. package/src/entities/workflow-snapshot.ts +0 -56
  32. package/src/index.ts +0 -1
  33. package/src/storage/docker-compose.yml +0 -16
  34. package/src/storage/domains/legacy-evals/index.ts +0 -243
  35. package/src/storage/domains/memory/index.ts +0 -894
  36. package/src/storage/domains/operations/index.ts +0 -433
  37. package/src/storage/domains/score/index.ts +0 -288
  38. package/src/storage/domains/traces/index.ts +0 -286
  39. package/src/storage/domains/workflows/index.ts +0 -297
  40. package/src/storage/index.test.ts +0 -1420
  41. package/src/storage/index.ts +0 -483
@@ -1,143 +0,0 @@
1
- import { Entity } from 'electrodb';
2
- import { baseAttributes } from './utils';
3
-
4
- export const messageEntity = new Entity({
5
- model: {
6
- entity: 'message',
7
- version: '1',
8
- service: 'mastra',
9
- },
10
- attributes: {
11
- entity: {
12
- type: 'string',
13
- required: true,
14
- },
15
- ...baseAttributes,
16
- id: {
17
- type: 'string',
18
- required: true,
19
- },
20
- threadId: {
21
- type: 'string',
22
- required: true,
23
- },
24
- content: {
25
- type: 'string',
26
- required: true,
27
- // Stringify content object on set if it's not already a string
28
- set: (value?: string | void) => {
29
- if (value && typeof value !== 'string') {
30
- return JSON.stringify(value);
31
- }
32
- return value;
33
- },
34
- // Parse JSON string to object on get ONLY if it looks like JSON
35
- get: (value?: string) => {
36
- if (value && typeof value === 'string') {
37
- try {
38
- // Attempt to parse only if it might be JSON (e.g., starts with { or [)
39
- if (value.startsWith('{') || value.startsWith('[')) {
40
- return JSON.parse(value);
41
- }
42
- } catch {
43
- // Ignore parse error, return original string
44
- return value;
45
- }
46
- }
47
- return value;
48
- },
49
- },
50
- role: {
51
- type: 'string',
52
- required: true,
53
- },
54
- type: {
55
- type: 'string',
56
- default: 'text',
57
- },
58
- resourceId: {
59
- type: 'string',
60
- required: false,
61
- },
62
- toolCallIds: {
63
- type: 'string',
64
- required: false,
65
- set: (value?: string[] | string) => {
66
- if (Array.isArray(value)) {
67
- return JSON.stringify(value);
68
- }
69
- return value;
70
- },
71
- // Parse JSON string to array on get
72
- get: (value?: string) => {
73
- if (value && typeof value === 'string') {
74
- try {
75
- return JSON.parse(value);
76
- } catch {
77
- // Return raw value on error, consistent with 'content' field
78
- return value;
79
- }
80
- }
81
- // If value was not a string, or if it was an empty string, return it as is.
82
- return value;
83
- },
84
- },
85
- toolCallArgs: {
86
- type: 'string',
87
- required: false,
88
- set: (value?: Record<string, unknown>[] | string) => {
89
- if (value && typeof value !== 'string') {
90
- return JSON.stringify(value);
91
- }
92
- return value;
93
- },
94
- // Parse JSON string to object on get
95
- get: (value?: string) => {
96
- if (value && typeof value === 'string') {
97
- try {
98
- return JSON.parse(value);
99
- } catch {
100
- // Return raw value on error, consistent with 'content' field
101
- return value;
102
- }
103
- }
104
- // If value was not a string, or if it was an empty string, return it as is.
105
- return value;
106
- },
107
- },
108
- toolNames: {
109
- type: 'string',
110
- required: false,
111
- set: (value?: string[] | string) => {
112
- if (Array.isArray(value)) {
113
- return JSON.stringify(value);
114
- }
115
- return value;
116
- },
117
- // Parse JSON string to array on get
118
- get: (value?: string) => {
119
- if (value && typeof value === 'string') {
120
- try {
121
- return JSON.parse(value);
122
- } catch {
123
- // Return raw value on error, consistent with 'content' field
124
- return value;
125
- }
126
- }
127
- // If value was not a string, or if it was an empty string, return it as is.
128
- return value;
129
- },
130
- },
131
- },
132
- indexes: {
133
- primary: {
134
- pk: { field: 'pk', composite: ['entity', 'id'] },
135
- sk: { field: 'sk', composite: ['entity'] },
136
- },
137
- byThread: {
138
- index: 'gsi1',
139
- pk: { field: 'gsi1pk', composite: ['entity', 'threadId'] },
140
- sk: { field: 'gsi1sk', composite: ['createdAt'] },
141
- },
142
- },
143
- });
@@ -1,57 +0,0 @@
1
- import { Entity } from 'electrodb';
2
- import { baseAttributes } from './utils';
3
-
4
- export const resourceEntity = new Entity({
5
- model: {
6
- entity: 'resource',
7
- version: '1',
8
- service: 'mastra',
9
- },
10
- attributes: {
11
- entity: {
12
- type: 'string',
13
- required: true,
14
- },
15
- ...baseAttributes,
16
- id: {
17
- type: 'string',
18
- required: true,
19
- },
20
- workingMemory: {
21
- type: 'string',
22
- required: false,
23
- },
24
- metadata: {
25
- type: 'string',
26
- required: false,
27
- // Stringify content object on set if it's not already a string
28
- set: (value?: string | void) => {
29
- if (value && typeof value !== 'string') {
30
- return JSON.stringify(value);
31
- }
32
- return value;
33
- },
34
- // Parse JSON string to object on get ONLY if it looks like JSON
35
- get: (value?: string) => {
36
- if (value && typeof value === 'string') {
37
- try {
38
- // Attempt to parse only if it might be JSON (e.g., starts with { or [)
39
- if (value.startsWith('{') || value.startsWith('[')) {
40
- return JSON.parse(value);
41
- }
42
- } catch {
43
- // Ignore parse error, return original string
44
- return value;
45
- }
46
- }
47
- return value;
48
- },
49
- },
50
- },
51
- indexes: {
52
- primary: {
53
- pk: { field: 'pk', composite: ['entity', 'id'] },
54
- sk: { field: 'sk', composite: ['entity'] },
55
- },
56
- },
57
- });
@@ -1,317 +0,0 @@
1
- import { Entity } from 'electrodb';
2
- import { baseAttributes } from './utils';
3
-
4
- export const scoreEntity = new Entity({
5
- model: {
6
- entity: 'score',
7
- version: '1',
8
- service: 'mastra',
9
- },
10
- attributes: {
11
- entity: {
12
- type: 'string',
13
- required: true,
14
- },
15
- ...baseAttributes,
16
- id: {
17
- type: 'string',
18
- required: true,
19
- },
20
- scorerId: {
21
- type: 'string',
22
- required: true,
23
- },
24
- traceId: {
25
- type: 'string',
26
- required: false,
27
- },
28
- runId: {
29
- type: 'string',
30
- required: true,
31
- },
32
- scorer: {
33
- type: 'string',
34
- required: true,
35
- set: (value?: Record<string, unknown> | string) => {
36
- if (value && typeof value !== 'string') {
37
- return JSON.stringify(value);
38
- }
39
- return value;
40
- },
41
- get: (value?: string) => {
42
- if (value && typeof value === 'string') {
43
- try {
44
- if (value.startsWith('{') || value.startsWith('[')) {
45
- return JSON.parse(value);
46
- }
47
- } catch {
48
- return value;
49
- }
50
- }
51
- return value;
52
- },
53
- },
54
- extractStepResult: {
55
- type: 'string',
56
- required: false,
57
- set: (value?: Record<string, unknown> | string) => {
58
- if (value && typeof value !== 'string') {
59
- return JSON.stringify(value);
60
- }
61
- return value;
62
- },
63
- get: (value?: string) => {
64
- if (value && typeof value === 'string') {
65
- try {
66
- if (value.startsWith('{') || value.startsWith('[')) {
67
- return JSON.parse(value);
68
- }
69
- } catch {
70
- return value;
71
- }
72
- }
73
- return value;
74
- },
75
- },
76
- preprocessStepResult: {
77
- type: 'string',
78
- required: false,
79
- set: (value?: Record<string, unknown> | string) => {
80
- if (value && typeof value !== 'string') {
81
- return JSON.stringify(value);
82
- }
83
- return value;
84
- },
85
- get: (value?: string) => {
86
- if (value && typeof value === 'string') {
87
- try {
88
- if (value.startsWith('{') || value.startsWith('[')) {
89
- return JSON.parse(value);
90
- }
91
- } catch {
92
- return value;
93
- }
94
- }
95
- return value;
96
- },
97
- },
98
- analyzeStepResult: {
99
- type: 'string',
100
- required: false,
101
- set: (value?: Record<string, unknown> | string) => {
102
- if (value && typeof value !== 'string') {
103
- return JSON.stringify(value);
104
- }
105
- return value;
106
- },
107
- get: (value?: string) => {
108
- if (value && typeof value === 'string') {
109
- try {
110
- if (value.startsWith('{') || value.startsWith('[')) {
111
- return JSON.parse(value);
112
- }
113
- } catch {
114
- return value;
115
- }
116
- }
117
- return value;
118
- },
119
- },
120
- score: {
121
- type: 'number',
122
- required: true,
123
- },
124
- reason: {
125
- type: 'string',
126
- required: false,
127
- },
128
- extractPrompt: {
129
- type: 'string',
130
- required: false,
131
- },
132
- analyzePrompt: {
133
- type: 'string',
134
- required: false,
135
- },
136
-
137
- // Deprecated in favor of generateReasonPrompt
138
- reasonPrompt: {
139
- type: 'string',
140
- required: false,
141
- },
142
- generateScorePrompt: {
143
- type: 'string',
144
- required: false,
145
- },
146
- generateReasonPrompt: {
147
- type: 'string',
148
- required: false,
149
- },
150
- input: {
151
- type: 'string',
152
- required: true,
153
- set: (value?: Record<string, unknown> | string) => {
154
- if (value && typeof value !== 'string') {
155
- return JSON.stringify(value);
156
- }
157
- return value;
158
- },
159
- get: (value?: string) => {
160
- if (value && typeof value === 'string') {
161
- try {
162
- if (value.startsWith('{') || value.startsWith('[')) {
163
- return JSON.parse(value);
164
- }
165
- } catch {
166
- return value;
167
- }
168
- }
169
- return value;
170
- },
171
- },
172
- output: {
173
- type: 'string',
174
- required: true,
175
- set: (value?: Record<string, unknown> | string) => {
176
- if (value && typeof value !== 'string') {
177
- return JSON.stringify(value);
178
- }
179
- return value;
180
- },
181
- get: (value?: string) => {
182
- if (value && typeof value === 'string') {
183
- try {
184
- if (value.startsWith('{') || value.startsWith('[')) {
185
- return JSON.parse(value);
186
- }
187
- } catch {
188
- return value;
189
- }
190
- }
191
- return value;
192
- },
193
- },
194
- additionalContext: {
195
- type: 'string',
196
- required: false,
197
- set: (value?: Record<string, unknown> | string) => {
198
- if (value && typeof value !== 'string') {
199
- return JSON.stringify(value);
200
- }
201
- return value;
202
- },
203
- get: (value?: string) => {
204
- if (value && typeof value === 'string') {
205
- try {
206
- if (value.startsWith('{') || value.startsWith('[')) {
207
- return JSON.parse(value);
208
- }
209
- } catch {
210
- return value;
211
- }
212
- }
213
- return value;
214
- },
215
- },
216
- runtimeContext: {
217
- type: 'string',
218
- required: false,
219
- set: (value?: Record<string, unknown> | string) => {
220
- if (value && typeof value !== 'string') {
221
- return JSON.stringify(value);
222
- }
223
- return value;
224
- },
225
- get: (value?: string) => {
226
- if (value && typeof value === 'string') {
227
- try {
228
- if (value.startsWith('{') || value.startsWith('[')) {
229
- return JSON.parse(value);
230
- }
231
- } catch {
232
- return value;
233
- }
234
- }
235
- return value;
236
- },
237
- },
238
- entityType: {
239
- type: 'string',
240
- required: false,
241
- },
242
- entityData: {
243
- type: 'string',
244
- required: false,
245
- set: (value?: Record<string, unknown> | string) => {
246
- if (value && typeof value !== 'string') {
247
- return JSON.stringify(value);
248
- }
249
- return value;
250
- },
251
- get: (value?: string) => {
252
- if (value && typeof value === 'string') {
253
- try {
254
- if (value.startsWith('{') || value.startsWith('[')) {
255
- return JSON.parse(value);
256
- }
257
- } catch {
258
- return value;
259
- }
260
- }
261
- return value;
262
- },
263
- },
264
- entityId: {
265
- type: 'string',
266
- required: false,
267
- },
268
- source: {
269
- type: 'string',
270
- required: true,
271
- },
272
- resourceId: {
273
- type: 'string',
274
- required: false,
275
- },
276
- threadId: {
277
- type: 'string',
278
- required: false,
279
- },
280
- },
281
- indexes: {
282
- primary: {
283
- pk: { field: 'pk', composite: ['entity', 'id'] },
284
- sk: { field: 'sk', composite: ['entity'] },
285
- },
286
- byScorer: {
287
- index: 'gsi1',
288
- pk: { field: 'gsi1pk', composite: ['entity', 'scorerId'] },
289
- sk: { field: 'gsi1sk', composite: ['createdAt'] },
290
- },
291
- byRun: {
292
- index: 'gsi2',
293
- pk: { field: 'gsi2pk', composite: ['entity', 'runId'] },
294
- sk: { field: 'gsi2sk', composite: ['createdAt'] },
295
- },
296
- byTrace: {
297
- index: 'gsi3',
298
- pk: { field: 'gsi3pk', composite: ['entity', 'traceId'] },
299
- sk: { field: 'gsi3sk', composite: ['createdAt'] },
300
- },
301
- byEntityData: {
302
- index: 'gsi4',
303
- pk: { field: 'gsi4pk', composite: ['entity', 'entityId'] },
304
- sk: { field: 'gsi4sk', composite: ['createdAt'] },
305
- },
306
- byResource: {
307
- index: 'gsi5',
308
- pk: { field: 'gsi5pk', composite: ['entity', 'resourceId'] },
309
- sk: { field: 'gsi5sk', composite: ['createdAt'] },
310
- },
311
- byThread: {
312
- index: 'gsi6',
313
- pk: { field: 'gsi6pk', composite: ['entity', 'threadId'] },
314
- sk: { field: 'gsi6sk', composite: ['createdAt'] },
315
- },
316
- },
317
- });
@@ -1,66 +0,0 @@
1
- import { Entity } from 'electrodb';
2
- import { baseAttributes } from './utils';
3
-
4
- export const threadEntity = new Entity({
5
- model: {
6
- entity: 'thread',
7
- version: '1',
8
- service: 'mastra',
9
- },
10
- attributes: {
11
- entity: {
12
- type: 'string',
13
- required: true,
14
- },
15
- ...baseAttributes,
16
- id: {
17
- type: 'string',
18
- required: true,
19
- },
20
- resourceId: {
21
- type: 'string',
22
- required: true,
23
- },
24
- title: {
25
- type: 'string',
26
- required: true,
27
- },
28
- metadata: {
29
- type: 'string',
30
- required: false,
31
- // Stringify metadata object on set if it's not already a string
32
- set: (value?: Record<string, unknown> | string) => {
33
- if (value && typeof value !== 'string') {
34
- return JSON.stringify(value);
35
- }
36
- return value;
37
- },
38
- // Parse JSON string to object on get
39
- get: (value?: string) => {
40
- if (value && typeof value === 'string') {
41
- try {
42
- // Attempt to parse only if it might be JSON (e.g., starts with { or [)
43
- if (value.startsWith('{') || value.startsWith('[')) {
44
- return JSON.parse(value);
45
- }
46
- } catch {
47
- // Ignore parse error, return original string
48
- return value;
49
- }
50
- }
51
- return value;
52
- },
53
- },
54
- },
55
- indexes: {
56
- primary: {
57
- pk: { field: 'pk', composite: ['entity', 'id'] },
58
- sk: { field: 'sk', composite: ['id'] },
59
- },
60
- byResource: {
61
- index: 'gsi1',
62
- pk: { field: 'gsi1pk', composite: ['entity', 'resourceId'] },
63
- sk: { field: 'gsi1sk', composite: ['createdAt'] },
64
- },
65
- },
66
- });
@@ -1,129 +0,0 @@
1
- import { Entity } from 'electrodb';
2
- import { baseAttributes } from './utils';
3
-
4
- export const traceEntity = new Entity({
5
- model: {
6
- entity: 'trace',
7
- version: '1',
8
- service: 'mastra',
9
- },
10
- attributes: {
11
- entity: {
12
- type: 'string',
13
- required: true,
14
- },
15
- ...baseAttributes,
16
- id: {
17
- type: 'string',
18
- required: true,
19
- },
20
- parentSpanId: {
21
- type: 'string',
22
- required: false,
23
- },
24
- name: {
25
- type: 'string',
26
- required: true,
27
- },
28
- traceId: {
29
- type: 'string',
30
- required: true,
31
- },
32
- scope: {
33
- type: 'string',
34
- required: true,
35
- },
36
- kind: {
37
- type: 'number',
38
- required: true,
39
- },
40
- attributes: {
41
- type: 'string', // JSON stringified
42
- required: false,
43
- // Stringify object on set
44
- set: (value?: any) => {
45
- if (value && typeof value !== 'string') {
46
- return JSON.stringify(value);
47
- }
48
- return value;
49
- },
50
- // Parse JSON string to object on get
51
- get: (value?: string) => {
52
- return value ? JSON.parse(value) : value;
53
- },
54
- },
55
- status: {
56
- type: 'string', // JSON stringified
57
- required: false,
58
- // Stringify object on set
59
- set: (value?: any) => {
60
- if (value && typeof value !== 'string') {
61
- return JSON.stringify(value);
62
- }
63
- return value;
64
- },
65
- // Parse JSON string to object on get
66
- get: (value?: string) => {
67
- return value;
68
- },
69
- },
70
- events: {
71
- type: 'string', // JSON stringified
72
- required: false,
73
- // Stringify object on set
74
- set: (value?: any) => {
75
- if (value && typeof value !== 'string') {
76
- return JSON.stringify(value);
77
- }
78
- return value;
79
- },
80
- // Parse JSON string to object on get
81
- get: (value?: string) => {
82
- return value;
83
- },
84
- },
85
- links: {
86
- type: 'string', // JSON stringified
87
- required: false,
88
- // Stringify object on set
89
- set: (value?: any) => {
90
- if (value && typeof value !== 'string') {
91
- return JSON.stringify(value);
92
- }
93
- return value;
94
- },
95
- // Parse JSON string to object on get
96
- get: (value?: string) => {
97
- return value;
98
- },
99
- },
100
- other: {
101
- type: 'string',
102
- required: false,
103
- },
104
- startTime: {
105
- type: 'number',
106
- required: true,
107
- },
108
- endTime: {
109
- type: 'number',
110
- required: true,
111
- },
112
- },
113
- indexes: {
114
- primary: {
115
- pk: { field: 'pk', composite: ['entity', 'id'] },
116
- sk: { field: 'sk', composite: [] },
117
- },
118
- byName: {
119
- index: 'gsi1',
120
- pk: { field: 'gsi1pk', composite: ['entity', 'name'] },
121
- sk: { field: 'gsi1sk', composite: ['startTime'] },
122
- },
123
- byScope: {
124
- index: 'gsi2',
125
- pk: { field: 'gsi2pk', composite: ['entity', 'scope'] },
126
- sk: { field: 'gsi2sk', composite: ['startTime'] },
127
- },
128
- },
129
- });