@mastra/dynamodb 0.14.5 → 0.14.6-alpha.1
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 +752 -0
- package/package.json +14 -5
- package/src/entities/eval.ts +0 -102
- package/src/entities/index.ts +0 -27
- package/src/entities/message.ts +0 -143
- package/src/entities/resource.ts +0 -57
- package/src/entities/score.ts +0 -317
- package/src/entities/thread.ts +0 -66
- package/src/entities/trace.ts +0 -129
- package/src/entities/utils.ts +0 -51
- package/src/entities/workflow-snapshot.ts +0 -56
- package/src/index.ts +0 -1
- package/src/storage/docker-compose.yml +0 -16
- package/src/storage/domains/legacy-evals/index.ts +0 -243
- package/src/storage/domains/memory/index.ts +0 -987
- package/src/storage/domains/operations/index.ts +0 -435
- package/src/storage/domains/score/index.ts +0 -292
- package/src/storage/domains/traces/index.ts +0 -286
- package/src/storage/domains/workflows/index.ts +0 -334
- package/src/storage/index.test.ts +0 -1420
- package/src/storage/index.ts +0 -538
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mastra/dynamodb",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.6-alpha.1",
|
|
4
4
|
"description": "DynamoDB storage adapter for Mastra",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"files": [
|
|
22
22
|
"dist",
|
|
23
|
-
"
|
|
23
|
+
"CHANGELOG.md"
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@aws-sdk/client-dynamodb": "^3.859.0",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"electrodb": "^3.4.3"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"@mastra/core": ">=0.
|
|
31
|
+
"@mastra/core": ">=0.15.3-0 <0.16.0-0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@microsoft/api-extractor": "^7.52.8",
|
|
@@ -41,9 +41,18 @@
|
|
|
41
41
|
"typescript": "^5.8.3",
|
|
42
42
|
"vitest": "^3.2.4",
|
|
43
43
|
"@internal/lint": "0.0.34",
|
|
44
|
-
"@internal/types-builder": "0.0.9",
|
|
45
44
|
"@internal/storage-test-utils": "0.0.30",
|
|
46
|
-
"@mastra/core": "0.15.
|
|
45
|
+
"@mastra/core": "0.15.3-alpha.7",
|
|
46
|
+
"@internal/types-builder": "0.0.9"
|
|
47
|
+
},
|
|
48
|
+
"homepage": "https://mastra.ai",
|
|
49
|
+
"repository": {
|
|
50
|
+
"type": "git",
|
|
51
|
+
"url": "git+https://github.com/mastra-ai/mastra.git",
|
|
52
|
+
"directory": "stores/dynamodb"
|
|
53
|
+
},
|
|
54
|
+
"bugs": {
|
|
55
|
+
"url": "https://github.com/mastra-ai/mastra/issues"
|
|
47
56
|
},
|
|
48
57
|
"scripts": {
|
|
49
58
|
"build": "tsup --silent --config tsup.config.ts",
|
package/src/entities/eval.ts
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { Entity } from 'electrodb';
|
|
2
|
-
import { baseAttributes } from './utils';
|
|
3
|
-
|
|
4
|
-
export const evalEntity = new Entity({
|
|
5
|
-
model: {
|
|
6
|
-
entity: 'eval',
|
|
7
|
-
version: '1',
|
|
8
|
-
service: 'mastra',
|
|
9
|
-
},
|
|
10
|
-
attributes: {
|
|
11
|
-
entity: {
|
|
12
|
-
type: 'string',
|
|
13
|
-
required: true,
|
|
14
|
-
},
|
|
15
|
-
...baseAttributes,
|
|
16
|
-
input: {
|
|
17
|
-
type: 'string',
|
|
18
|
-
required: true,
|
|
19
|
-
},
|
|
20
|
-
output: {
|
|
21
|
-
type: 'string',
|
|
22
|
-
required: true,
|
|
23
|
-
},
|
|
24
|
-
result: {
|
|
25
|
-
type: 'string', // JSON stringified
|
|
26
|
-
required: true,
|
|
27
|
-
// Stringify object on set
|
|
28
|
-
set: (value?: any) => {
|
|
29
|
-
if (value && typeof value !== 'string') {
|
|
30
|
-
return JSON.stringify(value);
|
|
31
|
-
}
|
|
32
|
-
return value;
|
|
33
|
-
},
|
|
34
|
-
// Parse JSON string to object on get
|
|
35
|
-
get: (value?: string) => {
|
|
36
|
-
if (value) {
|
|
37
|
-
return JSON.parse(value);
|
|
38
|
-
}
|
|
39
|
-
return value;
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
agent_name: {
|
|
43
|
-
type: 'string',
|
|
44
|
-
required: true,
|
|
45
|
-
},
|
|
46
|
-
metric_name: {
|
|
47
|
-
type: 'string',
|
|
48
|
-
required: true,
|
|
49
|
-
},
|
|
50
|
-
instructions: {
|
|
51
|
-
type: 'string',
|
|
52
|
-
required: true,
|
|
53
|
-
},
|
|
54
|
-
test_info: {
|
|
55
|
-
type: 'string', // JSON stringified
|
|
56
|
-
required: false,
|
|
57
|
-
// Stringify object on set
|
|
58
|
-
set: (value?: any) => {
|
|
59
|
-
if (value && typeof value !== 'string') {
|
|
60
|
-
return JSON.stringify(value);
|
|
61
|
-
}
|
|
62
|
-
return value;
|
|
63
|
-
},
|
|
64
|
-
// Parse JSON string to object on get
|
|
65
|
-
get: (value?: string) => {
|
|
66
|
-
return value;
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
global_run_id: {
|
|
70
|
-
type: 'string',
|
|
71
|
-
required: true,
|
|
72
|
-
},
|
|
73
|
-
run_id: {
|
|
74
|
-
type: 'string',
|
|
75
|
-
required: true,
|
|
76
|
-
},
|
|
77
|
-
created_at: {
|
|
78
|
-
type: 'string',
|
|
79
|
-
required: true,
|
|
80
|
-
// Initialize with current timestamp if not provided
|
|
81
|
-
default: () => new Date().toISOString(),
|
|
82
|
-
// Convert Date to ISO string on set
|
|
83
|
-
set: (value?: Date | string) => {
|
|
84
|
-
if (value instanceof Date) {
|
|
85
|
-
return value.toISOString();
|
|
86
|
-
}
|
|
87
|
-
return value || new Date().toISOString();
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
indexes: {
|
|
92
|
-
primary: {
|
|
93
|
-
pk: { field: 'pk', composite: ['entity', 'run_id'] },
|
|
94
|
-
sk: { field: 'sk', composite: [] },
|
|
95
|
-
},
|
|
96
|
-
byAgent: {
|
|
97
|
-
index: 'gsi1',
|
|
98
|
-
pk: { field: 'gsi1pk', composite: ['entity', 'agent_name'] },
|
|
99
|
-
sk: { field: 'gsi1sk', composite: ['created_at'] },
|
|
100
|
-
},
|
|
101
|
-
},
|
|
102
|
-
});
|
package/src/entities/index.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { DynamoDBDocumentClient } from '@aws-sdk/lib-dynamodb';
|
|
2
|
-
import { Service } from 'electrodb';
|
|
3
|
-
import { evalEntity } from './eval';
|
|
4
|
-
import { messageEntity } from './message';
|
|
5
|
-
import { resourceEntity } from './resource';
|
|
6
|
-
import { scoreEntity } from './score';
|
|
7
|
-
import { threadEntity } from './thread';
|
|
8
|
-
import { traceEntity } from './trace';
|
|
9
|
-
import { workflowSnapshotEntity } from './workflow-snapshot';
|
|
10
|
-
|
|
11
|
-
export function getElectroDbService(client: DynamoDBDocumentClient, tableName: string) {
|
|
12
|
-
return new Service(
|
|
13
|
-
{
|
|
14
|
-
thread: threadEntity,
|
|
15
|
-
message: messageEntity,
|
|
16
|
-
eval: evalEntity,
|
|
17
|
-
trace: traceEntity,
|
|
18
|
-
workflow_snapshot: workflowSnapshotEntity,
|
|
19
|
-
resource: resourceEntity,
|
|
20
|
-
score: scoreEntity,
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
client,
|
|
24
|
-
table: tableName,
|
|
25
|
-
},
|
|
26
|
-
);
|
|
27
|
-
}
|
package/src/entities/message.ts
DELETED
|
@@ -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
|
-
});
|
package/src/entities/resource.ts
DELETED
|
@@ -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
|
-
});
|
package/src/entities/score.ts
DELETED
|
@@ -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
|
-
});
|