@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.
Files changed (44) hide show
  1. package/dist/core/__fixtures__/mock_responses.d.ts +337 -0
  2. package/dist/core/__fixtures__/mock_responses.js +355 -0
  3. package/dist/core/__fixtures__/sample_embeddings.d.ts +33 -0
  4. package/dist/core/__fixtures__/sample_embeddings.js +12355 -0
  5. package/dist/core/agents.d.ts +51 -0
  6. package/dist/core/agents.js +170 -0
  7. package/dist/core/client.d.ts +5 -7
  8. package/dist/core/client.js +5 -16
  9. package/dist/core/memories.d.ts +138 -0
  10. package/dist/core/memories.js +417 -0
  11. package/dist/core/workflows.d.ts +88 -25
  12. package/dist/core/workflows.js +247 -133
  13. package/package.json +3 -3
  14. package/src/templates/hasura/metadata/actions.yaml +6 -0
  15. package/src/templates/hasura/metadata/cron_triggers.yaml +1 -0
  16. package/src/templates/hasura/metadata/databases/databases.yaml +1 -1
  17. package/src/templates/hasura/metadata/databases/default/functions/functions.yaml +80 -0
  18. package/src/templates/hasura/metadata/databases/default/tables/tables.yaml +274 -9
  19. package/src/templates/hasura/metadata/query_collections.yaml +1 -0
  20. package/src/templates/hasura/metadata/rest_endpoints.yaml +1 -0
  21. package/src/templates/hasura/migrations/default/0_cleanup/down.sql +2 -0
  22. package/src/templates/hasura/migrations/default/0_cleanup/up.sql +59 -0
  23. package/src/templates/hasura/migrations/default/1_init/down.sql +27 -21
  24. package/src/templates/hasura/migrations/default/1_init/up.sql +446 -174
  25. package/src/templates/hasura/migrations/default/2_sample_data/down.sql +3 -0
  26. package/src/templates/hasura/migrations/default/2_sample_data/up.sql +288 -0
  27. package/src/templates/hasura/migrations/default/3_agent_relations/down.sql +76 -0
  28. package/src/templates/hasura/migrations/default/3_agent_relations/up.sql +469 -0
  29. package/dist/core/entities.d.ts +0 -58
  30. package/dist/core/entities.js +0 -347
  31. package/src/templates/hasura/metadata/config.yaml +0 -1
  32. package/src/templates/hasura/metadata/databases/default/tables/public_agents.yaml +0 -14
  33. package/src/templates/hasura/metadata/databases/default/tables/public_memories.yaml +0 -23
  34. package/src/templates/hasura/metadata/databases/default/tables/public_memory_edges.yaml +0 -57
  35. package/src/templates/hasura/metadata/databases/default/tables/track_tables.yaml +0 -14
  36. package/src/templates/hasura/metadata/metadata.json +0 -80
  37. package/src/templates/hasura/migrations/default/2_metadata_filtering/down.sql +0 -4
  38. package/src/templates/hasura/migrations/default/2_metadata_filtering/up.sql +0 -44
  39. package/src/templates/hasura/migrations/default/3_memory_expiry/down.sql +0 -55
  40. package/src/templates/hasura/migrations/default/3_memory_expiry/up.sql +0 -108
  41. package/src/templates/hasura/migrations/default/4_remove_slug_validation/down.sql +0 -20
  42. package/src/templates/hasura/migrations/default/4_remove_slug_validation/up.sql +0 -5
  43. package/src/templates/hasura/migrations/default/5_entities/down.sql +0 -13
  44. package/src/templates/hasura/migrations/default/5_entities/up.sql +0 -155
@@ -2,8 +2,12 @@
2
2
  name: agents
3
3
  schema: public
4
4
  configuration:
5
- custom_root_fields: {}
6
- custom_name: agents
5
+ custom_name: agent
6
+ column_config:
7
+ created_at:
8
+ custom_name: createdAt
9
+ updated_at:
10
+ custom_name: updatedAt
7
11
  array_relationships:
8
12
  - name: memories
9
13
  using:
@@ -12,26 +16,68 @@
12
16
  table:
13
17
  name: memories
14
18
  schema: public
19
+ - name: memoryChunks
20
+ using:
21
+ foreign_key_constraint_on:
22
+ column: agent_id
23
+ table:
24
+ name: memory_chunks
25
+ schema: public
26
+ - name: memoryRelations
27
+ using:
28
+ foreign_key_constraint_on:
29
+ column: agent_id
30
+ table:
31
+ name: memory_edges
32
+ schema: public
33
+ - name: workflowRuns
34
+ using:
35
+ foreign_key_constraint_on:
36
+ column: agent_id
37
+ table:
38
+ name: workflow_runs
39
+ schema: public
40
+ - name: workflowResults
41
+ using:
42
+ foreign_key_constraint_on:
43
+ column: agent_id
44
+ table:
45
+ name: workflow_results
46
+ schema: public
15
47
 
16
48
  - table:
17
49
  name: memories
18
50
  schema: public
19
51
  configuration:
20
- custom_root_fields: {}
21
- custom_name: memories
52
+ custom_name: memory
53
+ column_config:
54
+ created_at:
55
+ custom_name: createdAt
56
+ updated_at:
57
+ custom_name: updatedAt
22
58
  object_relationships:
23
59
  - name: agent
24
60
  using:
25
61
  foreign_key_constraint_on: agent_id
62
+ - name: schema
63
+ using:
64
+ foreign_key_constraint_on: type
26
65
  array_relationships:
27
- - name: incoming_edges
66
+ - name: chunks
67
+ using:
68
+ foreign_key_constraint_on:
69
+ column: memory_id
70
+ table:
71
+ name: memory_chunks
72
+ schema: public
73
+ - name: incomingEdges
28
74
  using:
29
75
  foreign_key_constraint_on:
30
76
  column: target_memory
31
77
  table:
32
78
  name: memory_edges
33
79
  schema: public
34
- - name: outgoing_edges
80
+ - name: outgoingEdges
35
81
  using:
36
82
  foreign_key_constraint_on:
37
83
  column: source_memory
@@ -39,16 +85,235 @@
39
85
  name: memory_edges
40
86
  schema: public
41
87
 
88
+ - table:
89
+ name: memory_chunks
90
+ schema: public
91
+ configuration:
92
+ custom_name: memoryChunk
93
+ column_config:
94
+ created_at:
95
+ custom_name: createdAt
96
+ updated_at:
97
+ custom_name: updatedAt
98
+ object_relationships:
99
+ - name: agent
100
+ using:
101
+ foreign_key_constraint_on: agent_id
102
+ - name: memory
103
+ using:
104
+ foreign_key_constraint_on: memory_id
105
+
42
106
  - table:
43
107
  name: memory_edges
44
108
  schema: public
45
109
  configuration:
46
- custom_root_fields: {}
47
- custom_name: memory_edges
110
+ custom_name: memoryRelation
111
+ column_config:
112
+ created_at:
113
+ custom_name: createdAt
114
+ updated_at:
115
+ custom_name: updatedAt
116
+ source_memory:
117
+ custom_name: sourceMemory
118
+ target_memory:
119
+ custom_name: targetMemory
48
120
  object_relationships:
121
+ - name: agent
122
+ using:
123
+ foreign_key_constraint_on: agent_id
49
124
  - name: source
50
125
  using:
51
126
  foreign_key_constraint_on: source_memory
52
127
  - name: target
53
128
  using:
54
- foreign_key_constraint_on: target_memory
129
+ foreign_key_constraint_on: target_memory
130
+
131
+ - table:
132
+ name: workflow_runs
133
+ schema: public
134
+ configuration:
135
+ custom_name: workflowRun
136
+ column_config:
137
+ created_at:
138
+ custom_name: createdAt
139
+ updated_at:
140
+ custom_name: updatedAt
141
+ object_relationships:
142
+ - name: agent
143
+ using:
144
+ foreign_key_constraint_on: agent_id
145
+ - name: schema
146
+ using:
147
+ foreign_key_constraint_on: type
148
+ array_relationships:
149
+ - name: results
150
+ using:
151
+ foreign_key_constraint_on:
152
+ column: workflow_id
153
+ table:
154
+ name: workflow_results
155
+ schema: public
156
+
157
+ - table:
158
+ name: workflow_results
159
+ schema: public
160
+ configuration:
161
+ custom_name: workflowResult
162
+ column_config:
163
+ created_at:
164
+ custom_name: createdAt
165
+ updated_at:
166
+ custom_name: updatedAt
167
+ object_relationships:
168
+ - name: agent
169
+ using:
170
+ foreign_key_constraint_on: agent_id
171
+ - name: run
172
+ using:
173
+ foreign_key_constraint_on: workflow_id
174
+
175
+ - table:
176
+ name: type_schemas
177
+ schema: public
178
+ configuration:
179
+ custom_name: typeSchema
180
+ column_config:
181
+ created_at:
182
+ custom_name: createdAt
183
+ updated_at:
184
+ custom_name: updatedAt
185
+ array_relationships:
186
+ - name: memories
187
+ using:
188
+ foreign_key_constraint_on:
189
+ column: type
190
+ table:
191
+ name: memories
192
+ schema: public
193
+
194
+ - table:
195
+ name: workflow_schemas
196
+ schema: public
197
+ configuration:
198
+ custom_name: workflowSchema
199
+ column_config:
200
+ created_at:
201
+ custom_name: createdAt
202
+ updated_at:
203
+ custom_name: updatedAt
204
+ array_relationships:
205
+ - name: runs
206
+ using:
207
+ foreign_key_constraint_on:
208
+ column: type
209
+ table:
210
+ name: workflow_runs
211
+ schema: public
212
+
213
+ - table:
214
+ name: memory_connections_with_details
215
+ schema: public
216
+ configuration:
217
+ custom_name: memoryConnection
218
+ column_config:
219
+ created_at:
220
+ custom_name: createdAt
221
+ updated_at:
222
+ custom_name: updatedAt
223
+ source_id:
224
+ custom_name: sourceId
225
+ target_id:
226
+ custom_name: targetId
227
+ source_content:
228
+ custom_name: sourceContent
229
+ target_content:
230
+ custom_name: targetContent
231
+ source_type:
232
+ custom_name: sourceType
233
+ target_type:
234
+ custom_name: targetType
235
+
236
+ - table:
237
+ name: memory_chunks_with_details
238
+ schema: public
239
+ configuration:
240
+ custom_name: memoryChunkWithDetails
241
+ column_config:
242
+ chunk_id:
243
+ custom_name: chunkId
244
+ memory_id:
245
+ custom_name: memoryId
246
+ chunk_index:
247
+ custom_name: chunkIndex
248
+ chunk_content:
249
+ custom_name: chunkContent
250
+ chunk_metadata:
251
+ custom_name: chunkMetadata
252
+ chunk_created_at:
253
+ custom_name: chunkCreatedAt
254
+ chunk_updated_at:
255
+ custom_name: chunkUpdatedAt
256
+ memory_content:
257
+ custom_name: memoryContent
258
+ memory_type:
259
+ custom_name: memoryType
260
+ memory_status:
261
+ custom_name: memoryStatus
262
+ memory_metadata:
263
+ custom_name: memoryMetadata
264
+ memory_created_at:
265
+ custom_name: memoryCreatedAt
266
+ memory_updated_at:
267
+ custom_name: memoryUpdatedAt
268
+ agent_id:
269
+ custom_name: agentId
270
+
271
+ - table:
272
+ name: memory_embeddings_info
273
+ schema: public
274
+ configuration:
275
+ custom_name: memoryEmbeddingInfo
276
+ column_config:
277
+ memory_id:
278
+ custom_name: memoryId
279
+ embedding_norm:
280
+ custom_name: embeddingNorm
281
+ is_normalized:
282
+ custom_name: isNormalized
283
+
284
+ - table:
285
+ name: memory_search_results
286
+ schema: public
287
+ configuration:
288
+ custom_name: memorySearchResult
289
+ column_config:
290
+ chunk_id:
291
+ custom_name: chunkId
292
+ memory_id:
293
+ custom_name: memoryId
294
+ chunk_index:
295
+ custom_name: chunkIndex
296
+ chunk_content:
297
+ custom_name: chunkContent
298
+ chunk_metadata:
299
+ custom_name: chunkMetadata
300
+ chunk_created_at:
301
+ custom_name: chunkCreatedAt
302
+ chunk_updated_at:
303
+ custom_name: chunkUpdatedAt
304
+ memory_content:
305
+ custom_name: memoryContent
306
+ memory_type:
307
+ custom_name: memoryType
308
+ memory_status:
309
+ custom_name: memoryStatus
310
+ memory_metadata:
311
+ custom_name: memoryMetadata
312
+ memory_created_at:
313
+ custom_name: memoryCreatedAt
314
+ memory_updated_at:
315
+ custom_name: memoryUpdatedAt
316
+ agent_id:
317
+ custom_name: agentId
318
+ similarity:
319
+ custom_name: similarity
@@ -0,0 +1,2 @@
1
+ -- This is a cleanup migration, no down migration is needed
2
+ -- The subsequent migrations will recreate the schema
@@ -0,0 +1,59 @@
1
+ -- Drop all views
2
+ DROP VIEW IF EXISTS public.memories_with_similarity CASCADE;
3
+ DROP VIEW IF EXISTS public.search_results_with_similarity CASCADE;
4
+ DROP VIEW IF EXISTS public.memory_chunks_with_similarity CASCADE;
5
+
6
+ -- Drop all functions (with their overloaded versions)
7
+ DROP FUNCTION IF EXISTS public.search_memories(vector(1536), float8, integer, uuid) CASCADE;
8
+ DROP FUNCTION IF EXISTS public.search_memories(vector(1536), float8, integer, uuid, jsonb, jsonb, jsonb) CASCADE;
9
+ DROP FUNCTION IF EXISTS public.search_chunks_and_entities(vector(1536), float8, integer, boolean, boolean, jsonb, jsonb) CASCADE;
10
+ DROP FUNCTION IF EXISTS public.get_connected_memories(uuid, text, integer) CASCADE;
11
+ DROP FUNCTION IF EXISTS public.inspect_memory_embeddings() CASCADE;
12
+ DROP FUNCTION IF EXISTS public.debug_vector_info(vector(1536)) CASCADE;
13
+ DROP FUNCTION IF EXISTS public.normalize_embedding() CASCADE;
14
+ DROP FUNCTION IF EXISTS public.update_updated_at_column() CASCADE;
15
+ DROP FUNCTION IF EXISTS public.validate_slug(text) CASCADE;
16
+
17
+ -- Drop all indexes explicitly (in case CASCADE didn't catch them)
18
+ DROP INDEX IF EXISTS public.idx_memories_embedding CASCADE;
19
+ DROP INDEX IF EXISTS public.idx_memory_chunks_embedding CASCADE;
20
+ DROP INDEX IF EXISTS public.idx_memory_edges_source CASCADE;
21
+ DROP INDEX IF EXISTS public.idx_memory_edges_target CASCADE;
22
+ DROP INDEX IF EXISTS public.idx_memory_edges_type CASCADE;
23
+
24
+ -- Drop all user-defined triggers (excluding referential integrity triggers)
25
+ DO $$
26
+ DECLARE
27
+ trigger_record record;
28
+ BEGIN
29
+ FOR trigger_record IN
30
+ SELECT
31
+ tgname as trigger_name,
32
+ relname as table_name
33
+ FROM pg_trigger t
34
+ JOIN pg_class c ON t.tgrelid = c.oid
35
+ JOIN pg_namespace n ON c.relnamespace = n.oid
36
+ WHERE n.nspname = 'public'
37
+ AND NOT tgname LIKE 'RI_ConstraintTrigger_%' -- Exclude referential integrity triggers
38
+ AND NOT tgname LIKE 'pg_trigger_%' -- Exclude other system triggers
39
+ LOOP
40
+ EXECUTE format('DROP TRIGGER IF EXISTS %I ON public.%I CASCADE;',
41
+ trigger_record.trigger_name,
42
+ trigger_record.table_name
43
+ );
44
+ END LOOP;
45
+ END $$;
46
+
47
+ -- Drop all tables in correct order
48
+ DROP TABLE IF EXISTS public.memory_edges CASCADE;
49
+ DROP TABLE IF EXISTS public.memory_chunks CASCADE;
50
+ DROP TABLE IF EXISTS public.memories CASCADE;
51
+ DROP TABLE IF EXISTS public.workflow_results CASCADE;
52
+ DROP TABLE IF EXISTS public.workflow_runs CASCADE;
53
+ DROP TABLE IF EXISTS public.workflow_schemas CASCADE;
54
+ DROP TABLE IF EXISTS public.type_schemas CASCADE;
55
+ DROP TABLE IF EXISTS public.agents CASCADE;
56
+
57
+ -- Drop extensions (only if you're sure no other databases/schemas need them)
58
+ -- DROP EXTENSION IF EXISTS "uuid-ossp" CASCADE;
59
+ -- DROP EXTENSION IF EXISTS "vector" CASCADE;
@@ -1,26 +1,32 @@
1
- -- Drop all versions of search_memories function
2
- DROP FUNCTION IF EXISTS public.search_memories(vector(1536), float8, integer, uuid, jsonb);
3
- DROP FUNCTION IF EXISTS public.search_memories(vector(1536), float8, integer, uuid);
4
- DROP FUNCTION IF EXISTS public.search_memories;
1
+ -- Drop views first since they depend on tables
2
+ DROP VIEW IF EXISTS public.memories_with_similarity CASCADE;
3
+ DROP VIEW IF EXISTS public.search_results_with_similarity CASCADE;
4
+ DROP VIEW IF EXISTS public.memory_connections_with_details CASCADE;
5
+ DROP VIEW IF EXISTS public.memory_embeddings_info CASCADE;
6
+ DROP VIEW IF EXISTS public.memory_chunks_with_details CASCADE;
7
+ DROP VIEW IF EXISTS public.memory_search_results CASCADE;
5
8
 
6
- -- Drop other functions
7
- DROP FUNCTION IF EXISTS get_connected_memories;
9
+ -- Drop all tables in correct order (respecting foreign key constraints)
10
+ -- Using CASCADE will automatically handle dependent objects (triggers, indexes, etc)
11
+ DROP TABLE IF EXISTS memory_edges CASCADE;
12
+ DROP TABLE IF EXISTS memory_chunks CASCADE;
13
+ DROP TABLE IF EXISTS memories CASCADE;
14
+ DROP TABLE IF EXISTS workflow_results CASCADE;
15
+ DROP TABLE IF EXISTS workflow_runs CASCADE;
16
+ DROP TABLE IF EXISTS workflow_schemas CASCADE;
17
+ DROP TABLE IF EXISTS type_schemas CASCADE;
8
18
 
9
- -- Drop triggers first
10
- DROP TRIGGER IF EXISTS update_agents_updated_at ON public.agents;
11
- DROP TRIGGER IF EXISTS update_memories_updated_at ON public.memories;
19
+ -- Drop functions (using CASCADE to handle any remaining dependencies)
20
+ DROP FUNCTION IF EXISTS get_connected_memories CASCADE;
21
+ DROP FUNCTION IF EXISTS inspect_memory_embeddings CASCADE;
22
+ DROP FUNCTION IF EXISTS search_memory_chunks CASCADE;
23
+ DROP FUNCTION IF EXISTS update_updated_at_column CASCADE;
24
+ DROP FUNCTION IF EXISTS normalize_embedding CASCADE;
25
+ DROP FUNCTION IF EXISTS validate_slug CASCADE;
12
26
 
13
- -- Now we can safely drop the trigger function
14
- DROP FUNCTION IF EXISTS update_updated_at_column;
27
+ -- Drop custom types
28
+ DROP TYPE IF EXISTS memory_embedding_info CASCADE;
15
29
 
16
- -- Drop views first
17
- DROP VIEW IF EXISTS public.memories_with_similarity;
18
-
19
- -- Drop tables
20
- DROP TABLE IF EXISTS public.memory_edges;
21
- DROP TABLE IF EXISTS public.memories;
22
- DROP TABLE IF EXISTS public.agents;
23
-
24
- -- Drop extensions (with CASCADE for vector since it has dependent objects)
30
+ -- Finally drop extensions
25
31
  DROP EXTENSION IF EXISTS vector CASCADE;
26
- DROP EXTENSION IF EXISTS "uuid-ossp";
32
+ DROP EXTENSION IF EXISTS "uuid-ossp" CASCADE;