@props-labs/mesh-os 0.1.23 → 0.2.0

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 (40) hide show
  1. package/dist/core/__fixtures__/mock_responses.d.ts +318 -0
  2. package/dist/core/__fixtures__/mock_responses.js +333 -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/memories.d.ts +138 -0
  8. package/dist/core/memories.js +417 -0
  9. package/dist/core/workflows.d.ts +84 -25
  10. package/dist/core/workflows.js +224 -135
  11. package/package.json +3 -3
  12. package/src/templates/hasura/metadata/actions.yaml +6 -0
  13. package/src/templates/hasura/metadata/cron_triggers.yaml +1 -0
  14. package/src/templates/hasura/metadata/databases/databases.yaml +1 -1
  15. package/src/templates/hasura/metadata/databases/default/functions/functions.yaml +80 -0
  16. package/src/templates/hasura/metadata/databases/default/tables/tables.yaml +274 -9
  17. package/src/templates/hasura/metadata/query_collections.yaml +1 -0
  18. package/src/templates/hasura/metadata/rest_endpoints.yaml +1 -0
  19. package/src/templates/hasura/migrations/default/0_cleanup/down.sql +2 -0
  20. package/src/templates/hasura/migrations/default/0_cleanup/up.sql +59 -0
  21. package/src/templates/hasura/migrations/default/1_init/down.sql +27 -21
  22. package/src/templates/hasura/migrations/default/1_init/up.sql +446 -174
  23. package/src/templates/hasura/migrations/default/2_sample_data/down.sql +3 -0
  24. package/src/templates/hasura/migrations/default/2_sample_data/up.sql +288 -0
  25. package/src/templates/hasura/migrations/default/3_agent_relations/down.sql +76 -0
  26. package/src/templates/hasura/migrations/default/3_agent_relations/up.sql +469 -0
  27. package/src/templates/hasura/metadata/config.yaml +0 -1
  28. package/src/templates/hasura/metadata/databases/default/tables/public_agents.yaml +0 -14
  29. package/src/templates/hasura/metadata/databases/default/tables/public_memories.yaml +0 -23
  30. package/src/templates/hasura/metadata/databases/default/tables/public_memory_edges.yaml +0 -57
  31. package/src/templates/hasura/metadata/databases/default/tables/track_tables.yaml +0 -14
  32. package/src/templates/hasura/metadata/metadata.json +0 -80
  33. package/src/templates/hasura/migrations/default/2_metadata_filtering/down.sql +0 -4
  34. package/src/templates/hasura/migrations/default/2_metadata_filtering/up.sql +0 -44
  35. package/src/templates/hasura/migrations/default/3_memory_expiry/down.sql +0 -55
  36. package/src/templates/hasura/migrations/default/3_memory_expiry/up.sql +0 -108
  37. package/src/templates/hasura/migrations/default/4_remove_slug_validation/down.sql +0 -20
  38. package/src/templates/hasura/migrations/default/4_remove_slug_validation/up.sql +0 -5
  39. package/src/templates/hasura/migrations/default/5_entities/down.sql +0 -13
  40. package/src/templates/hasura/migrations/default/5_entities/up.sql +0 -155
@@ -0,0 +1,469 @@
1
+ -- Create agents table
2
+ CREATE TABLE IF NOT EXISTS agents (
3
+ id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
4
+ slug TEXT UNIQUE,
5
+ name TEXT,
6
+ description TEXT,
7
+ created_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP,
8
+ updated_at TIMESTAMPTZ DEFAULT CURRENT_TIMESTAMP
9
+ );
10
+
11
+ -- Create trigger for agents updated_at
12
+ CREATE TRIGGER update_agents_updated_at
13
+ BEFORE UPDATE ON agents
14
+ FOR EACH ROW
15
+ EXECUTE FUNCTION update_updated_at_column();
16
+
17
+ -- Drop views that depend on memories table
18
+ DROP VIEW IF EXISTS memory_chunks_with_details CASCADE;
19
+ DROP VIEW IF EXISTS memory_search_results CASCADE;
20
+
21
+ -- Add agent_id to memories
22
+ ALTER TABLE memories
23
+ ADD COLUMN agent_id UUID REFERENCES agents(id) ON DELETE SET NULL;
24
+
25
+ -- Add agent_id to memory_chunks
26
+ ALTER TABLE memory_chunks
27
+ ADD COLUMN agent_id UUID REFERENCES agents(id) ON DELETE SET NULL;
28
+
29
+ -- Add agent_id to memory_edges
30
+ ALTER TABLE memory_edges
31
+ ADD COLUMN agent_id UUID REFERENCES agents(id) ON DELETE SET NULL;
32
+
33
+ -- Add agent_id to workflow_runs
34
+ ALTER TABLE workflow_runs
35
+ ADD COLUMN agent_id UUID REFERENCES agents(id) ON DELETE SET NULL;
36
+
37
+ -- Add agent_id to workflow_results
38
+ ALTER TABLE workflow_results
39
+ ADD COLUMN agent_id UUID REFERENCES agents(id) ON DELETE SET NULL;
40
+
41
+ -- Recreate the view with agent_id support
42
+ CREATE OR REPLACE VIEW memory_chunks_with_details AS
43
+ SELECT
44
+ mc.id as chunk_id,
45
+ mc.memory_id,
46
+ mc.chunk_index,
47
+ mc.content as chunk_content,
48
+ mc.embedding,
49
+ mc.metadata as chunk_metadata,
50
+ mc.created_at as chunk_created_at,
51
+ mc.updated_at as chunk_updated_at,
52
+ m.content as memory_content,
53
+ m.type as memory_type,
54
+ m.status as memory_status,
55
+ m.metadata as memory_metadata,
56
+ m.created_at as memory_created_at,
57
+ m.updated_at as memory_updated_at,
58
+ m.agent_id
59
+ FROM memory_chunks mc
60
+ JOIN memories m ON mc.memory_id = m.id;
61
+
62
+ -- Create view for search results
63
+ CREATE OR REPLACE VIEW memory_search_results AS
64
+ SELECT
65
+ chunk_id,
66
+ memory_id,
67
+ chunk_index,
68
+ chunk_content,
69
+ chunk_metadata,
70
+ chunk_created_at,
71
+ chunk_updated_at,
72
+ memory_content,
73
+ memory_type,
74
+ memory_status,
75
+ memory_metadata,
76
+ memory_created_at,
77
+ memory_updated_at,
78
+ agent_id,
79
+ 0.0::float as similarity
80
+ FROM memory_chunks_with_details
81
+ WHERE false; -- Empty by default, will be populated by function
82
+
83
+ -- Create search function
84
+ CREATE OR REPLACE FUNCTION search_memory_chunks(
85
+ query_embedding vector,
86
+ match_threshold double precision,
87
+ match_count integer,
88
+ filter_agent_id uuid DEFAULT NULL::uuid,
89
+ memory_metadata_filter jsonb DEFAULT NULL::jsonb,
90
+ chunk_metadata_filter jsonb DEFAULT NULL::jsonb,
91
+ created_at_filter jsonb DEFAULT NULL::jsonb
92
+ )
93
+ RETURNS SETOF memory_search_results
94
+ LANGUAGE sql STABLE AS $$
95
+ WITH normalized_query AS (
96
+ SELECT l2_normalize(query_embedding) AS normalized_vector
97
+ )
98
+ SELECT
99
+ cd.chunk_id,
100
+ cd.memory_id,
101
+ cd.chunk_index,
102
+ cd.chunk_content,
103
+ cd.chunk_metadata,
104
+ cd.chunk_created_at,
105
+ cd.chunk_updated_at,
106
+ cd.memory_content,
107
+ cd.memory_type,
108
+ cd.memory_status,
109
+ cd.memory_metadata,
110
+ cd.memory_created_at,
111
+ cd.memory_updated_at,
112
+ cd.agent_id,
113
+ -(cd.embedding <#> (SELECT normalized_vector FROM normalized_query)) as similarity
114
+ FROM memory_chunks_with_details cd
115
+ WHERE
116
+ CASE
117
+ WHEN filter_agent_id IS NOT NULL THEN cd.agent_id = filter_agent_id
118
+ ELSE TRUE
119
+ END
120
+ AND CASE
121
+ WHEN memory_metadata_filter IS NOT NULL THEN cd.memory_metadata @> memory_metadata_filter
122
+ ELSE TRUE
123
+ END
124
+ AND CASE
125
+ WHEN chunk_metadata_filter IS NOT NULL THEN cd.chunk_metadata @> chunk_metadata_filter
126
+ ELSE TRUE
127
+ END
128
+ AND CASE
129
+ WHEN created_at_filter IS NOT NULL THEN (
130
+ CASE
131
+ WHEN created_at_filter ? '_gt' THEN cd.chunk_created_at > (created_at_filter->>'_gt')::timestamptz AT TIME ZONE 'UTC'
132
+ ELSE TRUE
133
+ END
134
+ AND CASE
135
+ WHEN created_at_filter ? '_gte' THEN cd.chunk_created_at >= (created_at_filter->>'_gte')::timestamptz AT TIME ZONE 'UTC'
136
+ ELSE TRUE
137
+ END
138
+ AND CASE
139
+ WHEN created_at_filter ? '_lt' THEN cd.chunk_created_at < (created_at_filter->>'_lt')::timestamptz AT TIME ZONE 'UTC'
140
+ ELSE TRUE
141
+ END
142
+ AND CASE
143
+ WHEN created_at_filter ? '_lte' THEN cd.chunk_created_at <= (created_at_filter->>'_lte')::timestamptz AT TIME ZONE 'UTC'
144
+ ELSE TRUE
145
+ END
146
+ AND CASE
147
+ WHEN created_at_filter ? '_eq' THEN cd.chunk_created_at = (created_at_filter->>'_eq')::timestamptz AT TIME ZONE 'UTC'
148
+ ELSE TRUE
149
+ END
150
+ AND CASE
151
+ WHEN created_at_filter ? '_is_null' AND (created_at_filter->>'_is_null')::boolean THEN cd.chunk_created_at IS NULL
152
+ WHEN created_at_filter ? '_is_null' AND NOT (created_at_filter->>'_is_null')::boolean THEN cd.chunk_created_at IS NOT NULL
153
+ ELSE TRUE
154
+ END
155
+ )
156
+ ELSE TRUE
157
+ END
158
+ AND cd.embedding IS NOT NULL
159
+ AND -(cd.embedding <#> (SELECT normalized_vector FROM normalized_query)) >= match_threshold
160
+ ORDER BY
161
+ -(cd.embedding <#> (SELECT normalized_vector FROM normalized_query)) DESC
162
+ LIMIT match_count;
163
+ $$;
164
+
165
+ -- Create indexes for agent_id fields
166
+ CREATE INDEX idx_memories_agent_id ON memories(agent_id);
167
+ CREATE INDEX idx_memory_chunks_agent_id ON memory_chunks(agent_id);
168
+ CREATE INDEX idx_memory_edges_agent_id ON memory_edges(agent_id);
169
+ CREATE INDEX idx_workflow_runs_agent_id ON workflow_runs(agent_id);
170
+ CREATE INDEX idx_workflow_results_agent_id ON workflow_results(agent_id);
171
+
172
+ -- Add helpful comments
173
+ COMMENT ON TABLE agents IS
174
+ 'Agents that can own and interact with memories and workflows.';
175
+
176
+ COMMENT ON COLUMN agents.name IS
177
+ 'Optional name for the agent.';
178
+
179
+ COMMENT ON COLUMN agents.description IS
180
+ 'Optional description of the agent''s purpose or capabilities.';
181
+
182
+ COMMENT ON COLUMN agents.slug IS
183
+ 'Unique identifier string for the agent, URL-friendly format.';
184
+
185
+ COMMENT ON COLUMN memories.agent_id IS
186
+ 'Reference to the agent that owns or created this memory.';
187
+
188
+ COMMENT ON COLUMN memory_chunks.agent_id IS
189
+ 'Reference to the agent that owns or created this memory chunk.';
190
+
191
+ COMMENT ON COLUMN memory_edges.agent_id IS
192
+ 'Reference to the agent that created this relationship.';
193
+
194
+ COMMENT ON COLUMN workflow_runs.agent_id IS
195
+ 'Reference to the agent that initiated this workflow run.';
196
+
197
+ COMMENT ON COLUMN workflow_results.agent_id IS
198
+ 'Reference to the agent that owns this workflow result.';
199
+
200
+ -- Insert sample agent and data
201
+ INSERT INTO agents (id, slug, name, description) VALUES
202
+ ('d7f3668d-5ebf-4f95-9b5c-07301f5d4c62'::uuid, 'test-agent', 'TestAgent', 'A test agent for development and examples');
203
+
204
+ -- Insert sample memories and their chunks
205
+ WITH text_memory AS (
206
+ INSERT INTO memories (id, type, content, metadata, agent_id) VALUES
207
+ ('f7a6c2b1-d123-4567-8901-2345abcdef67'::uuid,
208
+ 'text_document',
209
+ 'The quick brown fox jumps over the lazy dog. This classic pangram contains every letter of the English alphabet at least once.',
210
+ jsonb_build_object(
211
+ 'source', 'example_docs',
212
+ 'tags', array['pangram', 'example']
213
+ ),
214
+ 'd7f3668d-5ebf-4f95-9b5c-07301f5d4c62'::uuid
215
+ ) RETURNING id, content
216
+ ),
217
+ code_memory AS (
218
+ INSERT INTO memories (id, type, content, metadata, agent_id) VALUES
219
+ ('e8b7d3c2-e234-5678-9012-3456bcdef789'::uuid,
220
+ 'code_snippet',
221
+ 'def fibonacci(n):\n if n <= 1:\n return n\n return fibonacci(n-1) + fibonacci(n-2)',
222
+ jsonb_build_object(
223
+ 'repository', 'algorithms',
224
+ 'path', 'math/fibonacci.py',
225
+ 'tags', array['python', 'recursion']
226
+ ),
227
+ 'd7f3668d-5ebf-4f95-9b5c-07301f5d4c62'::uuid
228
+ ) RETURNING id, content
229
+ )
230
+ -- Insert memory chunks with sample embeddings
231
+ INSERT INTO memory_chunks (id, memory_id, chunk_index, content, embedding, metadata, agent_id)
232
+ SELECT
233
+ 'a1b2c3d4-1234-5678-90ab-cdef12345678'::uuid,
234
+ id,
235
+ 0,
236
+ content,
237
+ l2_normalize((
238
+ SELECT array_agg(val)::vector
239
+ FROM (
240
+ SELECT
241
+ CASE
242
+ WHEN n <= 512 THEN 0.8 + random() * 0.4 -- Higher values for first third
243
+ WHEN n <= 1024 THEN 0.4 + random() * 0.4 -- Medium values for middle third
244
+ ELSE random() * 0.4 -- Lower values for last third
245
+ END as val
246
+ FROM generate_series(1, 1536) n
247
+ ) vals
248
+ )), -- Use l2_normalize directly
249
+ jsonb_build_object(
250
+ 'chunk_type', 'full',
251
+ 'embedding_model', 'text-embedding-3-small',
252
+ 'embedding_created_at', CURRENT_TIMESTAMP
253
+ ),
254
+ 'd7f3668d-5ebf-4f95-9b5c-07301f5d4c62'::uuid
255
+ FROM text_memory
256
+ UNION ALL
257
+ SELECT
258
+ 'b2c3d4e5-2345-6789-01bc-def234567890'::uuid,
259
+ id,
260
+ 0,
261
+ content,
262
+ l2_normalize((
263
+ SELECT array_agg(val)::vector
264
+ FROM (
265
+ SELECT
266
+ CASE
267
+ WHEN n <= 512 THEN random() * 0.4 -- Lower values for first third
268
+ WHEN n <= 1024 THEN 0.6 + random() * 0.4 -- Higher values for middle third
269
+ ELSE 0.3 + random() * 0.4 -- Medium values for last third
270
+ END as val
271
+ FROM generate_series(1, 1536) n
272
+ ) vals
273
+ )), -- Use l2_normalize directly
274
+ jsonb_build_object(
275
+ 'chunk_type', 'full',
276
+ 'embedding_model', 'text-embedding-3-small',
277
+ 'embedding_created_at', CURRENT_TIMESTAMP
278
+ ),
279
+ 'd7f3668d-5ebf-4f95-9b5c-07301f5d4c62'::uuid
280
+ FROM code_memory;
281
+
282
+ -- Insert sample workflow runs and results
283
+ WITH inserted_run AS (
284
+ INSERT INTO workflow_runs (id, type, status, input, metadata, agent_id) VALUES
285
+ ('c4d5e6f7-3456-7890-12cd-ef3456789012'::uuid,
286
+ 'document_analysis',
287
+ 'completed',
288
+ jsonb_build_object(
289
+ 'document_id', 'f7a6c2b1-d123-4567-8901-2345abcdef67',
290
+ 'analysis_type', 'summary'
291
+ ),
292
+ jsonb_build_object(
293
+ 'model_version', '1.0.0',
294
+ 'processing_time', 0.5
295
+ ),
296
+ 'd7f3668d-5ebf-4f95-9b5c-07301f5d4c62'::uuid
297
+ ) RETURNING id
298
+ )
299
+ INSERT INTO workflow_results (id, workflow_id, type, result, metadata, agent_id) VALUES
300
+ (
301
+ 'd5e6f7f8-4567-8901-23de-f45678901234'::uuid,
302
+ (SELECT id FROM inserted_run),
303
+ 'interim',
304
+ jsonb_build_object(
305
+ 'initial_analysis', 'Text contains all English alphabet letters in a single sentence.',
306
+ 'confidence', 0.85
307
+ ),
308
+ jsonb_build_object(
309
+ 'completion_time', CURRENT_TIMESTAMP - interval '2 seconds',
310
+ 'tokens_processed', 8,
311
+ 'stage', 'initial_analysis'
312
+ ),
313
+ 'd7f3668d-5ebf-4f95-9b5c-07301f5d4c62'::uuid
314
+ ),
315
+ (
316
+ 'd5e6f7f8-4567-8901-23de-f45678901235'::uuid,
317
+ (SELECT id FROM inserted_run),
318
+ 'final',
319
+ jsonb_build_object(
320
+ 'summary', 'A pangram demonstrating all English alphabet letters.',
321
+ 'confidence', 0.95
322
+ ),
323
+ jsonb_build_object(
324
+ 'completion_time', CURRENT_TIMESTAMP,
325
+ 'tokens_processed', 15,
326
+ 'stage', 'final_summary'
327
+ ),
328
+ 'd7f3668d-5ebf-4f95-9b5c-07301f5d4c62'::uuid
329
+ );
330
+
331
+ -- Create relationships between memories
332
+ INSERT INTO memory_edges (id, source_memory, target_memory, type, metadata, weight, agent_id)
333
+ SELECT
334
+ 'e6f7a8a9-5678-9012-34ef-a56789012345'::uuid,
335
+ m1.id,
336
+ m2.id,
337
+ 'related_content',
338
+ jsonb_build_object(
339
+ 'relationship_type', 'example',
340
+ 'created_by', 'system'
341
+ ),
342
+ 0.8,
343
+ 'd7f3668d-5ebf-4f95-9b5c-07301f5d4c62'::uuid
344
+ FROM memories m1
345
+ JOIN memories m2 ON m1.type = 'text_document' AND m2.type = 'code_snippet';
346
+
347
+ -- Insert sample thought memories
348
+ WITH thought_memory AS (
349
+ INSERT INTO memories (id, type, content, metadata, agent_id) VALUES
350
+ ('a9b8c7d6-f123-4567-8901-234567890abc'::uuid,
351
+ 'thought',
352
+ 'AI agents could revolutionize personal productivity by learning from our digital traces and automating routine tasks.',
353
+ jsonb_build_object(
354
+ 'context', 'Reading about AI agent architectures',
355
+ 'tags', array['ai', 'productivity', 'agents'],
356
+ 'confidence', 0.85,
357
+ 'links', array[
358
+ jsonb_build_object(
359
+ 'url', 'https://example.com/ai-agents',
360
+ 'title', 'The Future of AI Agents',
361
+ 'description', 'Research paper on AI agent architectures'
362
+ )
363
+ ]
364
+ ),
365
+ 'd7f3668d-5ebf-4f95-9b5c-07301f5d4c62'::uuid
366
+ ) RETURNING id, content
367
+ )
368
+ -- Insert thought memory chunks
369
+ INSERT INTO memory_chunks (id, memory_id, chunk_index, content, embedding, metadata, agent_id)
370
+ SELECT
371
+ 'f1e2d3c4-9876-5432-10fe-dcba09876543'::uuid,
372
+ id,
373
+ 0,
374
+ content,
375
+ l2_normalize((
376
+ SELECT array_agg(val)::vector
377
+ FROM (
378
+ SELECT
379
+ CASE
380
+ WHEN n <= 512 THEN 0.7 + random() * 0.3 -- Higher values for concepts
381
+ WHEN n <= 1024 THEN 0.5 + random() * 0.3 -- Medium values for context
382
+ ELSE 0.2 + random() * 0.3 -- Lower values for details
383
+ END as val
384
+ FROM generate_series(1, 1536) n
385
+ ) vals
386
+ )),
387
+ jsonb_build_object(
388
+ 'chunk_type', 'full',
389
+ 'embedding_model', 'text-embedding-3-small',
390
+ 'embedding_created_at', CURRENT_TIMESTAMP
391
+ ),
392
+ 'd7f3668d-5ebf-4f95-9b5c-07301f5d4c62'::uuid
393
+ FROM thought_memory;
394
+
395
+ -- Insert sample thread generation workflow
396
+ WITH thread_run AS (
397
+ INSERT INTO workflow_runs (id, type, status, input, metadata, agent_id) VALUES
398
+ ('b1c2d3e4-5678-9012-34ef-567890123456'::uuid,
399
+ 'twitter_thread_generator',
400
+ 'completed',
401
+ jsonb_build_object(
402
+ 'content', 'AI agents are revolutionizing productivity. Here''s how they learn from our digital footprints to automate tasks and enhance our workflow...',
403
+ 'links', array['https://example.com/ai-agents'],
404
+ 'use_deep_research', true
405
+ ),
406
+ jsonb_build_object(
407
+ 'generation_model', 'gpt-4',
408
+ 'research_depth', 3,
409
+ 'processing_time', 12.5
410
+ ),
411
+ 'd7f3668d-5ebf-4f95-9b5c-07301f5d4c62'::uuid
412
+ ) RETURNING id
413
+ )
414
+ INSERT INTO workflow_results (id, workflow_id, type, result, metadata, agent_id) VALUES
415
+ (
416
+ 'c2d3e4f5-6789-0123-45fa-678901234566'::uuid,
417
+ (SELECT id FROM thread_run),
418
+ 'interim',
419
+ jsonb_build_object(
420
+ 'outline', array[
421
+ 'Introduction to AI agents and productivity',
422
+ 'Key benefits and features',
423
+ 'Technical explanation',
424
+ 'Future implications and call to action'
425
+ ],
426
+ 'research_findings', jsonb_build_object(
427
+ 'key_concepts', array['automation', 'personalization', 'learning', 'optimization'],
428
+ 'supporting_data', 'Initial research suggests 40% productivity gains possible'
429
+ )
430
+ ),
431
+ jsonb_build_object(
432
+ 'completion_time', CURRENT_TIMESTAMP - interval '5 seconds',
433
+ 'tokens_processed', 180,
434
+ 'stage', 'research_and_outline'
435
+ ),
436
+ 'd7f3668d-5ebf-4f95-9b5c-07301f5d4c62'::uuid
437
+ ),
438
+ (
439
+ 'c2d3e4f5-6789-0123-45fa-678901234567'::uuid,
440
+ (SELECT id FROM thread_run),
441
+ 'final',
442
+ jsonb_build_object(
443
+ 'posts', array[
444
+ jsonb_build_object(
445
+ 'text', '🤖 AI agents are revolutionizing how we work! They''re like digital assistants that learn from our habits and automate the boring stuff. Here''s a thread on how they''re changing the game... 1/4',
446
+ 'media_type', 'image',
447
+ 'media_url', 'https://example.com/images/ai-agent-banner.jpg'
448
+ ),
449
+ jsonb_build_object(
450
+ 'text', '📊 Key benefits of AI agents:\n\n• Learn from your digital footprint\n• Automate repetitive tasks\n• Adapt to your workflow\n• Provide personalized assistance\n\nThey''re not just tools, they''re partners in productivity! 2/4'
451
+ ),
452
+ jsonb_build_object(
453
+ 'text', '🔍 The science behind it:\n\nAI agents use advanced machine learning to understand your patterns and preferences. They analyze your interactions and optimize their assistance over time. 3/4',
454
+ 'media_type', 'gif',
455
+ 'media_url', 'https://example.com/gifs/ai-learning.gif'
456
+ ),
457
+ jsonb_build_object(
458
+ 'text', '🚀 The future is here! AI agents are becoming more sophisticated every day. Soon, they''ll be essential for anyone looking to maximize their productivity.\n\nWant to learn more? Check out this research: https://example.com/ai-agents 4/4'
459
+ )
460
+ ]
461
+ ),
462
+ jsonb_build_object(
463
+ 'completion_time', CURRENT_TIMESTAMP,
464
+ 'tokens_processed', 450,
465
+ 'engagement_score', 0.92,
466
+ 'stage', 'final_thread'
467
+ ),
468
+ 'd7f3668d-5ebf-4f95-9b5c-07301f5d4c62'::uuid
469
+ );
@@ -1,14 +0,0 @@
1
- table:
2
- name: agents
3
- schema: public
4
- configuration:
5
- custom_root_fields: {}
6
- custom_name: agents
7
- array_relationships:
8
- - name: memories
9
- using:
10
- foreign_key_constraint_on:
11
- column: agent_id
12
- table:
13
- name: memories
14
- schema: public
@@ -1,23 +0,0 @@
1
- table:
2
- name: memories
3
- schema: public
4
- configuration:
5
- custom_root_fields: {}
6
- custom_name: memories
7
- object_relationships:
8
- - name: agent
9
- using:
10
- foreign_key_constraint_on: agent_id
11
- computed_fields:
12
- - name: similarity_score
13
- definition:
14
- function:
15
- name: search_memories
16
- schema: public
17
- arguments:
18
- query_embedding: $query_embedding
19
- match_threshold: $match_threshold
20
- match_count: $match_count
21
- filter_agent_id: $filter_agent_id
22
- metadata_filter: $metadata_filter
23
- comment: Computes similarity score for vector search
@@ -1,57 +0,0 @@
1
- table:
2
- name: memory_edges
3
- schema: public
4
- is_enum: false
5
- configuration:
6
- column_config: {}
7
- custom_column_names: {}
8
- custom_name: memory_edges
9
- custom_root_fields: {}
10
-
11
- array_relationships: []
12
- computed_fields: []
13
- delete_permissions:
14
- - role: admin
15
- permission:
16
- filter: {}
17
-
18
- event_triggers: []
19
- insert_permissions:
20
- - role: admin
21
- permission:
22
- check: {}
23
- columns:
24
- - id
25
- - source_memory
26
- - target_memory
27
- - relationship
28
- - weight
29
- - created_at
30
-
31
- object_relationships:
32
- - name: source
33
- using:
34
- foreign_key_constraint_on: source_memory
35
- - name: target
36
- using:
37
- foreign_key_constraint_on: target_memory
38
-
39
- select_permissions:
40
- - role: admin
41
- permission:
42
- columns:
43
- - id
44
- - source_memory
45
- - target_memory
46
- - relationship
47
- - weight
48
- - created_at
49
- filter: {}
50
-
51
- update_permissions:
52
- - role: admin
53
- permission:
54
- columns:
55
- - weight
56
- filter: {}
57
- check: {}
@@ -1,14 +0,0 @@
1
- - table:
2
- schema: public
3
- name: agents
4
- is_enum: false
5
-
6
- - table:
7
- schema: public
8
- name: memories
9
- is_enum: false
10
-
11
- - table:
12
- schema: public
13
- name: memory_edges
14
- is_enum: false
@@ -1,80 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [
4
- {
5
- "name": "default",
6
- "kind": "postgres",
7
- "tables": [
8
- {
9
- "table": {
10
- "schema": "public",
11
- "name": "agents"
12
- },
13
- "array_relationships": [
14
- {
15
- "name": "memories",
16
- "using": {
17
- "foreign_key_constraint_on": {
18
- "column": "agent_id",
19
- "table": {
20
- "schema": "public",
21
- "name": "memories"
22
- }
23
- }
24
- }
25
- }
26
- ]
27
- },
28
- {
29
- "table": {
30
- "schema": "public",
31
- "name": "memories"
32
- },
33
- "object_relationships": [
34
- {
35
- "name": "agent",
36
- "using": {
37
- "foreign_key_constraint_on": "agent_id"
38
- }
39
- }
40
- ],
41
- "computed_fields": [
42
- {
43
- "name": "similarity_score",
44
- "definition": {
45
- "function": {
46
- "schema": "public",
47
- "name": "search_memories"
48
- }
49
- },
50
- "comment": "Computes similarity score for vector search"
51
- }
52
- ]
53
- }
54
- ],
55
- "functions": [
56
- {
57
- "function": {
58
- "schema": "public",
59
- "name": "search_memories"
60
- }
61
- }
62
- ],
63
- "configuration": {
64
- "connection_info": {
65
- "use_prepared_statements": true,
66
- "database_url": {
67
- "from_env": "HASURA_GRAPHQL_DATABASE_URL"
68
- },
69
- "isolation_level": "read-committed",
70
- "pool_settings": {
71
- "connection_lifetime": 600,
72
- "retries": 1,
73
- "idle_timeout": 180,
74
- "max_connections": 50
75
- }
76
- }
77
- }
78
- }
79
- ]
80
- }
@@ -1,4 +0,0 @@
1
- -- Drop the updated search_memories function with metadata filtering
2
- DROP FUNCTION public.search_memories(vector(1536), float8, integer, uuid, jsonb);
3
-
4
- -- Note: The original search_memories function from 1_init will be restored when that migration is reapplied