@props-labs/mesh-os 0.1.23 → 0.2.2
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/core/__fixtures__/mock_responses.d.ts +337 -0
- package/dist/core/__fixtures__/mock_responses.js +355 -0
- package/dist/core/__fixtures__/sample_embeddings.d.ts +33 -0
- package/dist/core/__fixtures__/sample_embeddings.js +12355 -0
- package/dist/core/agents.d.ts +51 -0
- package/dist/core/agents.js +170 -0
- package/dist/core/client.d.ts +5 -7
- package/dist/core/client.js +5 -16
- package/dist/core/memories.d.ts +138 -0
- package/dist/core/memories.js +417 -0
- package/dist/core/workflows.d.ts +88 -25
- package/dist/core/workflows.js +247 -133
- package/package.json +3 -3
- package/src/templates/hasura/metadata/actions.yaml +6 -0
- package/src/templates/hasura/metadata/cron_triggers.yaml +1 -0
- package/src/templates/hasura/metadata/databases/databases.yaml +1 -1
- package/src/templates/hasura/metadata/databases/default/functions/functions.yaml +80 -0
- package/src/templates/hasura/metadata/databases/default/tables/tables.yaml +274 -9
- package/src/templates/hasura/metadata/query_collections.yaml +1 -0
- package/src/templates/hasura/metadata/rest_endpoints.yaml +1 -0
- package/src/templates/hasura/migrations/default/0_cleanup/down.sql +2 -0
- package/src/templates/hasura/migrations/default/0_cleanup/up.sql +59 -0
- package/src/templates/hasura/migrations/default/1_init/down.sql +27 -21
- package/src/templates/hasura/migrations/default/1_init/up.sql +446 -174
- package/src/templates/hasura/migrations/default/2_sample_data/down.sql +3 -0
- package/src/templates/hasura/migrations/default/2_sample_data/up.sql +288 -0
- package/src/templates/hasura/migrations/default/3_agent_relations/down.sql +76 -0
- package/src/templates/hasura/migrations/default/3_agent_relations/up.sql +469 -0
- package/dist/core/entities.d.ts +0 -58
- package/dist/core/entities.js +0 -347
- package/src/templates/hasura/metadata/config.yaml +0 -1
- package/src/templates/hasura/metadata/databases/default/tables/public_agents.yaml +0 -14
- package/src/templates/hasura/metadata/databases/default/tables/public_memories.yaml +0 -23
- package/src/templates/hasura/metadata/databases/default/tables/public_memory_edges.yaml +0 -57
- package/src/templates/hasura/metadata/databases/default/tables/track_tables.yaml +0 -14
- package/src/templates/hasura/metadata/metadata.json +0 -80
- package/src/templates/hasura/migrations/default/2_metadata_filtering/down.sql +0 -4
- package/src/templates/hasura/migrations/default/2_metadata_filtering/up.sql +0 -44
- package/src/templates/hasura/migrations/default/3_memory_expiry/down.sql +0 -55
- package/src/templates/hasura/migrations/default/3_memory_expiry/up.sql +0 -108
- package/src/templates/hasura/migrations/default/4_remove_slug_validation/down.sql +0 -20
- package/src/templates/hasura/migrations/default/4_remove_slug_validation/up.sql +0 -5
- package/src/templates/hasura/migrations/default/5_entities/down.sql +0 -13
- package/src/templates/hasura/migrations/default/5_entities/up.sql +0 -155
@@ -0,0 +1,337 @@
|
|
1
|
+
export declare const SAMPLE_IDS: {
|
2
|
+
readonly AGENT: "d7f3668d-5ebf-4f95-9b5c-07301f5d4c62";
|
3
|
+
readonly MEMORY: "f7a6c2b1-d123-4567-8901-2345abcdef67";
|
4
|
+
readonly WORKFLOW: "c4d5e6f7-3456-7890-12cd-ef3456789012";
|
5
|
+
};
|
6
|
+
export declare const AGENT_MOCKS: {
|
7
|
+
getAgent: {
|
8
|
+
data: {
|
9
|
+
agents_by_pk: {
|
10
|
+
id: "d7f3668d-5ebf-4f95-9b5c-07301f5d4c62";
|
11
|
+
name: string;
|
12
|
+
description: string;
|
13
|
+
slug: string;
|
14
|
+
created_at: string;
|
15
|
+
updated_at: string;
|
16
|
+
};
|
17
|
+
};
|
18
|
+
};
|
19
|
+
getBySlug: {
|
20
|
+
data: {
|
21
|
+
agents: {
|
22
|
+
id: "d7f3668d-5ebf-4f95-9b5c-07301f5d4c62";
|
23
|
+
name: string;
|
24
|
+
description: string;
|
25
|
+
slug: string;
|
26
|
+
created_at: string;
|
27
|
+
updated_at: string;
|
28
|
+
}[];
|
29
|
+
};
|
30
|
+
};
|
31
|
+
register: {
|
32
|
+
data: {
|
33
|
+
insert_agents_one: {
|
34
|
+
id: string;
|
35
|
+
name: string;
|
36
|
+
description: string;
|
37
|
+
slug: string;
|
38
|
+
created_at: string;
|
39
|
+
updated_at: string;
|
40
|
+
};
|
41
|
+
};
|
42
|
+
};
|
43
|
+
};
|
44
|
+
export declare const MEMORY_MOCKS: {
|
45
|
+
getTypeSchema: {
|
46
|
+
data: {
|
47
|
+
type_schemas_by_pk: {
|
48
|
+
type: string;
|
49
|
+
schema: {
|
50
|
+
type: string;
|
51
|
+
properties: {
|
52
|
+
title: {
|
53
|
+
type: string;
|
54
|
+
description: string;
|
55
|
+
};
|
56
|
+
content: {
|
57
|
+
type: string;
|
58
|
+
description: string;
|
59
|
+
};
|
60
|
+
};
|
61
|
+
};
|
62
|
+
metadata_schema: {
|
63
|
+
type: string;
|
64
|
+
properties: {
|
65
|
+
source: {
|
66
|
+
type: string;
|
67
|
+
description: string;
|
68
|
+
};
|
69
|
+
tags: {
|
70
|
+
type: string;
|
71
|
+
description: string;
|
72
|
+
items: {
|
73
|
+
type: string;
|
74
|
+
};
|
75
|
+
};
|
76
|
+
};
|
77
|
+
};
|
78
|
+
embedding_config: {
|
79
|
+
model: string;
|
80
|
+
dimensions: number;
|
81
|
+
};
|
82
|
+
chunking_config: {
|
83
|
+
chunk_size: number;
|
84
|
+
chunk_overlap: number;
|
85
|
+
};
|
86
|
+
created_at: string;
|
87
|
+
updated_at: string;
|
88
|
+
};
|
89
|
+
};
|
90
|
+
};
|
91
|
+
listSchemas: {
|
92
|
+
data: {
|
93
|
+
type_schemas: ({
|
94
|
+
type: string;
|
95
|
+
schema: {
|
96
|
+
type: string;
|
97
|
+
properties: {
|
98
|
+
title: {
|
99
|
+
type: string;
|
100
|
+
};
|
101
|
+
content: {
|
102
|
+
type: string;
|
103
|
+
};
|
104
|
+
language?: undefined;
|
105
|
+
code?: undefined;
|
106
|
+
};
|
107
|
+
};
|
108
|
+
metadata_schema: {
|
109
|
+
type: string;
|
110
|
+
properties: {
|
111
|
+
source: {
|
112
|
+
type: string;
|
113
|
+
};
|
114
|
+
tags: {
|
115
|
+
type: string;
|
116
|
+
items: {
|
117
|
+
type: string;
|
118
|
+
};
|
119
|
+
};
|
120
|
+
};
|
121
|
+
};
|
122
|
+
embedding_config: {
|
123
|
+
model: string;
|
124
|
+
dimensions: number;
|
125
|
+
};
|
126
|
+
chunking_config: {
|
127
|
+
chunk_size: number;
|
128
|
+
chunk_overlap: number;
|
129
|
+
};
|
130
|
+
created_at: string;
|
131
|
+
updated_at: string;
|
132
|
+
} | {
|
133
|
+
type: string;
|
134
|
+
schema: {
|
135
|
+
type: string;
|
136
|
+
properties: {
|
137
|
+
language: {
|
138
|
+
type: string;
|
139
|
+
};
|
140
|
+
code: {
|
141
|
+
type: string;
|
142
|
+
};
|
143
|
+
title?: undefined;
|
144
|
+
content?: undefined;
|
145
|
+
};
|
146
|
+
};
|
147
|
+
metadata_schema: {
|
148
|
+
type: string;
|
149
|
+
properties: {
|
150
|
+
source: {
|
151
|
+
type: string;
|
152
|
+
};
|
153
|
+
tags: {
|
154
|
+
type: string;
|
155
|
+
items: {
|
156
|
+
type: string;
|
157
|
+
};
|
158
|
+
};
|
159
|
+
};
|
160
|
+
};
|
161
|
+
embedding_config: {
|
162
|
+
model: string;
|
163
|
+
dimensions: number;
|
164
|
+
};
|
165
|
+
chunking_config: {
|
166
|
+
chunk_size: number;
|
167
|
+
chunk_overlap: number;
|
168
|
+
};
|
169
|
+
created_at: string;
|
170
|
+
updated_at: string;
|
171
|
+
})[];
|
172
|
+
};
|
173
|
+
};
|
174
|
+
};
|
175
|
+
export declare const WORKFLOW_MOCKS: {
|
176
|
+
listSchemas: {
|
177
|
+
data: {
|
178
|
+
workflow_schemas: ({
|
179
|
+
type: string;
|
180
|
+
input_schema: {
|
181
|
+
type: string;
|
182
|
+
properties: {
|
183
|
+
document_id: {
|
184
|
+
type: string;
|
185
|
+
description: string;
|
186
|
+
};
|
187
|
+
analysis_type: {
|
188
|
+
type: string;
|
189
|
+
description: string;
|
190
|
+
enum: string[];
|
191
|
+
};
|
192
|
+
code_id?: undefined;
|
193
|
+
};
|
194
|
+
};
|
195
|
+
output_schema: {
|
196
|
+
type: string;
|
197
|
+
properties: {
|
198
|
+
result: {
|
199
|
+
type: string;
|
200
|
+
description: string;
|
201
|
+
};
|
202
|
+
confidence: {
|
203
|
+
type: string;
|
204
|
+
description: string;
|
205
|
+
};
|
206
|
+
issues?: undefined;
|
207
|
+
};
|
208
|
+
};
|
209
|
+
metadata_schema: {
|
210
|
+
type: string;
|
211
|
+
properties: {
|
212
|
+
model_version: {
|
213
|
+
type: string;
|
214
|
+
description: string;
|
215
|
+
};
|
216
|
+
};
|
217
|
+
};
|
218
|
+
created_at: string;
|
219
|
+
updated_at: string;
|
220
|
+
} | {
|
221
|
+
type: string;
|
222
|
+
input_schema: {
|
223
|
+
type: string;
|
224
|
+
properties: {
|
225
|
+
code_id: {
|
226
|
+
type: string;
|
227
|
+
description: string;
|
228
|
+
};
|
229
|
+
document_id?: undefined;
|
230
|
+
analysis_type?: undefined;
|
231
|
+
};
|
232
|
+
};
|
233
|
+
output_schema: {
|
234
|
+
type: string;
|
235
|
+
properties: {
|
236
|
+
issues: {
|
237
|
+
type: string;
|
238
|
+
description: string;
|
239
|
+
};
|
240
|
+
result?: undefined;
|
241
|
+
confidence?: undefined;
|
242
|
+
};
|
243
|
+
};
|
244
|
+
created_at: string;
|
245
|
+
updated_at: string;
|
246
|
+
metadata_schema?: undefined;
|
247
|
+
})[];
|
248
|
+
};
|
249
|
+
};
|
250
|
+
getSchema: {
|
251
|
+
data: {
|
252
|
+
workflow_schemas_by_pk: {
|
253
|
+
type: string;
|
254
|
+
input_schema: {
|
255
|
+
type: string;
|
256
|
+
properties: {
|
257
|
+
document_id: {
|
258
|
+
type: string;
|
259
|
+
description: string;
|
260
|
+
};
|
261
|
+
analysis_type: {
|
262
|
+
type: string;
|
263
|
+
description: string;
|
264
|
+
enum: string[];
|
265
|
+
};
|
266
|
+
};
|
267
|
+
};
|
268
|
+
output_schema: {
|
269
|
+
type: string;
|
270
|
+
properties: {
|
271
|
+
result: {
|
272
|
+
type: string;
|
273
|
+
description: string;
|
274
|
+
};
|
275
|
+
confidence: {
|
276
|
+
type: string;
|
277
|
+
description: string;
|
278
|
+
};
|
279
|
+
};
|
280
|
+
};
|
281
|
+
metadata_schema: {
|
282
|
+
type: string;
|
283
|
+
properties: {
|
284
|
+
model_version: {
|
285
|
+
type: string;
|
286
|
+
description: string;
|
287
|
+
};
|
288
|
+
};
|
289
|
+
};
|
290
|
+
created_at: string;
|
291
|
+
updated_at: string;
|
292
|
+
};
|
293
|
+
};
|
294
|
+
};
|
295
|
+
createRun: {
|
296
|
+
data: {
|
297
|
+
insert_workflow_runs_one: {
|
298
|
+
id: "c4d5e6f7-3456-7890-12cd-ef3456789012";
|
299
|
+
type: string;
|
300
|
+
status: string;
|
301
|
+
input: {
|
302
|
+
document_id: string;
|
303
|
+
analysis_type: string;
|
304
|
+
};
|
305
|
+
metadata: {
|
306
|
+
source: string;
|
307
|
+
};
|
308
|
+
created_at: string;
|
309
|
+
updated_at: string;
|
310
|
+
agent_id: "d7f3668d-5ebf-4f95-9b5c-07301f5d4c62";
|
311
|
+
};
|
312
|
+
};
|
313
|
+
};
|
314
|
+
getLastResult: {
|
315
|
+
data: {
|
316
|
+
workflow_results: {
|
317
|
+
id: string;
|
318
|
+
workflow_id: "c4d5e6f7-3456-7890-12cd-ef3456789012";
|
319
|
+
type: string;
|
320
|
+
result: {
|
321
|
+
summary: string;
|
322
|
+
confidence: number;
|
323
|
+
};
|
324
|
+
metadata: {
|
325
|
+
stage: string;
|
326
|
+
};
|
327
|
+
created_at: string;
|
328
|
+
updated_at: string;
|
329
|
+
agent_id: "d7f3668d-5ebf-4f95-9b5c-07301f5d4c62";
|
330
|
+
}[];
|
331
|
+
};
|
332
|
+
};
|
333
|
+
};
|
334
|
+
export declare const createMockFetch: (mocks: Record<string, any>) => (url: string, init?: RequestInit) => Promise<{
|
335
|
+
ok: boolean;
|
336
|
+
json: () => Promise<any>;
|
337
|
+
}>;
|
@@ -0,0 +1,355 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.createMockFetch = exports.WORKFLOW_MOCKS = exports.MEMORY_MOCKS = exports.AGENT_MOCKS = exports.SAMPLE_IDS = void 0;
|
4
|
+
// Sample IDs used across tests
|
5
|
+
exports.SAMPLE_IDS = {
|
6
|
+
AGENT: 'd7f3668d-5ebf-4f95-9b5c-07301f5d4c62',
|
7
|
+
MEMORY: 'f7a6c2b1-d123-4567-8901-2345abcdef67',
|
8
|
+
WORKFLOW: 'c4d5e6f7-3456-7890-12cd-ef3456789012'
|
9
|
+
};
|
10
|
+
// Agent mock responses
|
11
|
+
exports.AGENT_MOCKS = {
|
12
|
+
getAgent: {
|
13
|
+
data: {
|
14
|
+
agents_by_pk: {
|
15
|
+
id: exports.SAMPLE_IDS.AGENT,
|
16
|
+
name: 'TestAgent',
|
17
|
+
description: 'A test agent for development and examples',
|
18
|
+
slug: 'test-agent',
|
19
|
+
created_at: '2025-02-18T00:00:00Z',
|
20
|
+
updated_at: '2025-02-18T00:00:00Z'
|
21
|
+
}
|
22
|
+
}
|
23
|
+
},
|
24
|
+
getBySlug: {
|
25
|
+
data: {
|
26
|
+
agents: [{
|
27
|
+
id: exports.SAMPLE_IDS.AGENT,
|
28
|
+
name: 'TestAgent',
|
29
|
+
description: 'A test agent for development and examples',
|
30
|
+
slug: 'test-agent',
|
31
|
+
created_at: '2025-02-18T00:00:00Z',
|
32
|
+
updated_at: '2025-02-18T00:00:00Z'
|
33
|
+
}]
|
34
|
+
}
|
35
|
+
},
|
36
|
+
register: {
|
37
|
+
data: {
|
38
|
+
insert_agents_one: {
|
39
|
+
id: '11111111-1111-1111-1111-111111111111',
|
40
|
+
name: 'New Agent',
|
41
|
+
description: 'A newly registered test agent',
|
42
|
+
slug: 'new-test-agent',
|
43
|
+
created_at: '2025-02-18T00:00:00Z',
|
44
|
+
updated_at: '2025-02-18T00:00:00Z'
|
45
|
+
}
|
46
|
+
}
|
47
|
+
}
|
48
|
+
};
|
49
|
+
// Memory mock responses
|
50
|
+
exports.MEMORY_MOCKS = {
|
51
|
+
getTypeSchema: {
|
52
|
+
data: {
|
53
|
+
type_schemas_by_pk: {
|
54
|
+
type: 'text_document',
|
55
|
+
schema: {
|
56
|
+
type: 'object',
|
57
|
+
properties: {
|
58
|
+
title: {
|
59
|
+
type: 'string',
|
60
|
+
description: 'The title or heading of the text document'
|
61
|
+
},
|
62
|
+
content: {
|
63
|
+
type: 'string',
|
64
|
+
description: 'The main content or body of the text document'
|
65
|
+
}
|
66
|
+
}
|
67
|
+
},
|
68
|
+
metadata_schema: {
|
69
|
+
type: 'object',
|
70
|
+
properties: {
|
71
|
+
source: {
|
72
|
+
type: 'string',
|
73
|
+
description: 'The origin or source of the document'
|
74
|
+
},
|
75
|
+
tags: {
|
76
|
+
type: 'array',
|
77
|
+
description: 'List of tags or categories for the document',
|
78
|
+
items: { type: 'string' }
|
79
|
+
}
|
80
|
+
}
|
81
|
+
},
|
82
|
+
embedding_config: {
|
83
|
+
model: 'text-embedding-3-small',
|
84
|
+
dimensions: 1536
|
85
|
+
},
|
86
|
+
chunking_config: {
|
87
|
+
chunk_size: 1000,
|
88
|
+
chunk_overlap: 100
|
89
|
+
},
|
90
|
+
created_at: '2025-02-18T00:00:00Z',
|
91
|
+
updated_at: '2025-02-18T00:00:00Z'
|
92
|
+
}
|
93
|
+
}
|
94
|
+
},
|
95
|
+
listSchemas: {
|
96
|
+
data: {
|
97
|
+
type_schemas: [
|
98
|
+
{
|
99
|
+
type: 'text_document',
|
100
|
+
schema: {
|
101
|
+
type: 'object',
|
102
|
+
properties: {
|
103
|
+
title: { type: 'string' },
|
104
|
+
content: { type: 'string' }
|
105
|
+
}
|
106
|
+
},
|
107
|
+
metadata_schema: {
|
108
|
+
type: 'object',
|
109
|
+
properties: {
|
110
|
+
source: { type: 'string' },
|
111
|
+
tags: { type: 'array', items: { type: 'string' } }
|
112
|
+
}
|
113
|
+
},
|
114
|
+
embedding_config: {
|
115
|
+
model: 'text-embedding-3-small',
|
116
|
+
dimensions: 1536
|
117
|
+
},
|
118
|
+
chunking_config: {
|
119
|
+
chunk_size: 1000,
|
120
|
+
chunk_overlap: 100
|
121
|
+
},
|
122
|
+
created_at: '2025-02-18T00:00:00Z',
|
123
|
+
updated_at: '2025-02-18T00:00:00Z'
|
124
|
+
},
|
125
|
+
{
|
126
|
+
type: 'code_snippet',
|
127
|
+
schema: {
|
128
|
+
type: 'object',
|
129
|
+
properties: {
|
130
|
+
language: { type: 'string' },
|
131
|
+
code: { type: 'string' }
|
132
|
+
}
|
133
|
+
},
|
134
|
+
metadata_schema: {
|
135
|
+
type: 'object',
|
136
|
+
properties: {
|
137
|
+
source: { type: 'string' },
|
138
|
+
tags: { type: 'array', items: { type: 'string' } }
|
139
|
+
}
|
140
|
+
},
|
141
|
+
embedding_config: {
|
142
|
+
model: 'text-embedding-3-small',
|
143
|
+
dimensions: 1536
|
144
|
+
},
|
145
|
+
chunking_config: {
|
146
|
+
chunk_size: 500,
|
147
|
+
chunk_overlap: 50
|
148
|
+
},
|
149
|
+
created_at: '2025-02-18T00:00:00Z',
|
150
|
+
updated_at: '2025-02-18T00:00:00Z'
|
151
|
+
}
|
152
|
+
]
|
153
|
+
}
|
154
|
+
}
|
155
|
+
};
|
156
|
+
// Workflow mock responses
|
157
|
+
exports.WORKFLOW_MOCKS = {
|
158
|
+
listSchemas: {
|
159
|
+
data: {
|
160
|
+
workflow_schemas: [
|
161
|
+
{
|
162
|
+
type: 'document_analysis',
|
163
|
+
input_schema: {
|
164
|
+
type: 'object',
|
165
|
+
properties: {
|
166
|
+
document_id: {
|
167
|
+
type: 'string',
|
168
|
+
description: 'The unique identifier of the document to analyze'
|
169
|
+
},
|
170
|
+
analysis_type: {
|
171
|
+
type: 'string',
|
172
|
+
description: 'The type of analysis to perform on the document',
|
173
|
+
enum: ['sentiment', 'summary', 'key_points']
|
174
|
+
}
|
175
|
+
}
|
176
|
+
},
|
177
|
+
output_schema: {
|
178
|
+
type: 'object',
|
179
|
+
properties: {
|
180
|
+
result: {
|
181
|
+
type: 'object',
|
182
|
+
description: 'The analysis results for the document'
|
183
|
+
},
|
184
|
+
confidence: {
|
185
|
+
type: 'number',
|
186
|
+
description: 'Confidence score of the analysis result'
|
187
|
+
}
|
188
|
+
}
|
189
|
+
},
|
190
|
+
metadata_schema: {
|
191
|
+
type: 'object',
|
192
|
+
properties: {
|
193
|
+
model_version: {
|
194
|
+
type: 'string',
|
195
|
+
description: 'Version of the model used for analysis'
|
196
|
+
}
|
197
|
+
}
|
198
|
+
},
|
199
|
+
created_at: '2025-02-18T00:00:00Z',
|
200
|
+
updated_at: '2025-02-18T00:00:00Z'
|
201
|
+
},
|
202
|
+
{
|
203
|
+
type: 'code_review',
|
204
|
+
input_schema: {
|
205
|
+
type: 'object',
|
206
|
+
properties: {
|
207
|
+
code_id: {
|
208
|
+
type: 'string',
|
209
|
+
description: 'The unique identifier of the code to review'
|
210
|
+
}
|
211
|
+
}
|
212
|
+
},
|
213
|
+
output_schema: {
|
214
|
+
type: 'object',
|
215
|
+
properties: {
|
216
|
+
issues: {
|
217
|
+
type: 'array',
|
218
|
+
description: 'List of identified issues'
|
219
|
+
}
|
220
|
+
}
|
221
|
+
},
|
222
|
+
created_at: '2025-02-18T00:00:00Z',
|
223
|
+
updated_at: '2025-02-18T00:00:00Z'
|
224
|
+
}
|
225
|
+
]
|
226
|
+
}
|
227
|
+
},
|
228
|
+
getSchema: {
|
229
|
+
data: {
|
230
|
+
workflow_schemas_by_pk: {
|
231
|
+
type: 'document_analysis',
|
232
|
+
input_schema: {
|
233
|
+
type: 'object',
|
234
|
+
properties: {
|
235
|
+
document_id: {
|
236
|
+
type: 'string',
|
237
|
+
description: 'The unique identifier of the document to analyze'
|
238
|
+
},
|
239
|
+
analysis_type: {
|
240
|
+
type: 'string',
|
241
|
+
description: 'The type of analysis to perform on the document',
|
242
|
+
enum: ['sentiment', 'summary', 'key_points']
|
243
|
+
}
|
244
|
+
}
|
245
|
+
},
|
246
|
+
output_schema: {
|
247
|
+
type: 'object',
|
248
|
+
properties: {
|
249
|
+
result: {
|
250
|
+
type: 'object',
|
251
|
+
description: 'The analysis results for the document'
|
252
|
+
},
|
253
|
+
confidence: {
|
254
|
+
type: 'number',
|
255
|
+
description: 'Confidence score of the analysis result'
|
256
|
+
}
|
257
|
+
}
|
258
|
+
},
|
259
|
+
metadata_schema: {
|
260
|
+
type: 'object',
|
261
|
+
properties: {
|
262
|
+
model_version: {
|
263
|
+
type: 'string',
|
264
|
+
description: 'Version of the model used for analysis'
|
265
|
+
}
|
266
|
+
}
|
267
|
+
},
|
268
|
+
created_at: '2025-02-18T00:00:00Z',
|
269
|
+
updated_at: '2025-02-18T00:00:00Z'
|
270
|
+
}
|
271
|
+
}
|
272
|
+
},
|
273
|
+
createRun: {
|
274
|
+
data: {
|
275
|
+
insert_workflow_runs_one: {
|
276
|
+
id: exports.SAMPLE_IDS.WORKFLOW,
|
277
|
+
type: 'document_analysis',
|
278
|
+
status: 'pending',
|
279
|
+
input: {
|
280
|
+
document_id: 'test-doc-123',
|
281
|
+
analysis_type: 'summary'
|
282
|
+
},
|
283
|
+
metadata: {
|
284
|
+
source: 'test'
|
285
|
+
},
|
286
|
+
created_at: '2025-02-18T00:00:00Z',
|
287
|
+
updated_at: '2025-02-18T00:00:00Z',
|
288
|
+
agent_id: exports.SAMPLE_IDS.AGENT
|
289
|
+
}
|
290
|
+
}
|
291
|
+
},
|
292
|
+
getLastResult: {
|
293
|
+
data: {
|
294
|
+
workflow_results: [{
|
295
|
+
id: 'd5e6f7f8-4567-8901-23de-f45678901235',
|
296
|
+
workflow_id: exports.SAMPLE_IDS.WORKFLOW,
|
297
|
+
type: 'final',
|
298
|
+
result: {
|
299
|
+
summary: 'This is the document summary',
|
300
|
+
confidence: 0.95
|
301
|
+
},
|
302
|
+
metadata: {
|
303
|
+
stage: 'complete'
|
304
|
+
},
|
305
|
+
created_at: '2025-02-18T00:00:00Z',
|
306
|
+
updated_at: '2025-02-18T00:00:00Z',
|
307
|
+
agent_id: exports.SAMPLE_IDS.AGENT
|
308
|
+
}]
|
309
|
+
}
|
310
|
+
}
|
311
|
+
};
|
312
|
+
// Mock fetch function for testing
|
313
|
+
const createMockFetch = (mocks) => {
|
314
|
+
return async (url, init) => {
|
315
|
+
const body = init?.body ? JSON.parse(init.body) : {};
|
316
|
+
const query = body.query;
|
317
|
+
// Determine which mock to return based on the query
|
318
|
+
let mockResponse;
|
319
|
+
if (query.includes('GetAgent')) {
|
320
|
+
mockResponse = mocks.getAgent;
|
321
|
+
}
|
322
|
+
else if (query.includes('GetAgentBySlug')) {
|
323
|
+
mockResponse = mocks.getBySlug;
|
324
|
+
}
|
325
|
+
else if (query.includes('RegisterAgent')) {
|
326
|
+
mockResponse = mocks.register;
|
327
|
+
}
|
328
|
+
else if (query.includes('ListTypeSchemas')) {
|
329
|
+
mockResponse = mocks.listSchemas;
|
330
|
+
}
|
331
|
+
else if (query.includes('GetTypeSchema')) {
|
332
|
+
mockResponse = mocks.getTypeSchema;
|
333
|
+
}
|
334
|
+
else if (query.includes('ListWorkflowSchemas')) {
|
335
|
+
mockResponse = mocks.listSchemas;
|
336
|
+
}
|
337
|
+
else if (query.includes('GetWorkflowSchema')) {
|
338
|
+
mockResponse = mocks.getSchema;
|
339
|
+
}
|
340
|
+
else if (query.includes('CreateWorkflowRun')) {
|
341
|
+
mockResponse = mocks.createRun;
|
342
|
+
}
|
343
|
+
else if (query.includes('GetLastWorkflowResult')) {
|
344
|
+
mockResponse = mocks.getLastResult;
|
345
|
+
}
|
346
|
+
if (!mockResponse) {
|
347
|
+
throw new Error(`No mock response found for query: ${query}`);
|
348
|
+
}
|
349
|
+
return {
|
350
|
+
ok: true,
|
351
|
+
json: async () => mockResponse
|
352
|
+
};
|
353
|
+
};
|
354
|
+
};
|
355
|
+
exports.createMockFetch = createMockFetch;
|