@props-labs/mesh-os 0.2.2 → 0.2.4
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.
@@ -171,6 +171,23 @@ export declare const MEMORY_MOCKS: {
|
|
171
171
|
})[];
|
172
172
|
};
|
173
173
|
};
|
174
|
+
listMemories: {
|
175
|
+
data: {
|
176
|
+
memories: {
|
177
|
+
id: string;
|
178
|
+
type: string;
|
179
|
+
status: string;
|
180
|
+
content: string;
|
181
|
+
metadata: {
|
182
|
+
source: string;
|
183
|
+
tags: string[];
|
184
|
+
};
|
185
|
+
created_at: string;
|
186
|
+
updated_at: string;
|
187
|
+
agent_id: "d7f3668d-5ebf-4f95-9b5c-07301f5d4c62";
|
188
|
+
}[];
|
189
|
+
};
|
190
|
+
};
|
174
191
|
};
|
175
192
|
export declare const WORKFLOW_MOCKS: {
|
176
193
|
listSchemas: {
|
@@ -151,6 +151,51 @@ exports.MEMORY_MOCKS = {
|
|
151
151
|
}
|
152
152
|
]
|
153
153
|
}
|
154
|
+
},
|
155
|
+
listMemories: {
|
156
|
+
data: {
|
157
|
+
memories: [
|
158
|
+
{
|
159
|
+
id: exports.SAMPLE_IDS.MEMORY,
|
160
|
+
type: 'text_document',
|
161
|
+
status: 'active',
|
162
|
+
content: 'Test memory 1',
|
163
|
+
metadata: {
|
164
|
+
source: 'test',
|
165
|
+
tags: ['test', 'first']
|
166
|
+
},
|
167
|
+
created_at: '2025-02-18T00:00:00Z',
|
168
|
+
updated_at: '2025-02-18T00:00:00Z',
|
169
|
+
agent_id: exports.SAMPLE_IDS.AGENT
|
170
|
+
},
|
171
|
+
{
|
172
|
+
id: '22222222-2222-2222-2222-222222222222',
|
173
|
+
type: 'code_snippet',
|
174
|
+
status: 'active',
|
175
|
+
content: 'Test memory 2',
|
176
|
+
metadata: {
|
177
|
+
source: 'test',
|
178
|
+
tags: ['test', 'second']
|
179
|
+
},
|
180
|
+
created_at: '2025-02-18T00:00:01Z',
|
181
|
+
updated_at: '2025-02-18T00:00:01Z',
|
182
|
+
agent_id: exports.SAMPLE_IDS.AGENT
|
183
|
+
},
|
184
|
+
{
|
185
|
+
id: '33333333-3333-3333-3333-333333333333',
|
186
|
+
type: 'text_document',
|
187
|
+
status: 'archived',
|
188
|
+
content: 'Test memory 3',
|
189
|
+
metadata: {
|
190
|
+
source: 'test',
|
191
|
+
tags: ['test', 'third']
|
192
|
+
},
|
193
|
+
created_at: '2025-02-18T00:00:02Z',
|
194
|
+
updated_at: '2025-02-18T00:00:02Z',
|
195
|
+
agent_id: exports.SAMPLE_IDS.AGENT
|
196
|
+
}
|
197
|
+
]
|
198
|
+
}
|
154
199
|
}
|
155
200
|
};
|
156
201
|
// Workflow mock responses
|
@@ -343,6 +388,9 @@ const createMockFetch = (mocks) => {
|
|
343
388
|
else if (query.includes('GetLastWorkflowResult')) {
|
344
389
|
mockResponse = mocks.getLastResult;
|
345
390
|
}
|
391
|
+
else if (query.includes('ListMemories')) {
|
392
|
+
mockResponse = mocks.listMemories;
|
393
|
+
}
|
346
394
|
if (!mockResponse) {
|
347
395
|
throw new Error(`No mock response found for query: ${query}`);
|
348
396
|
}
|
package/dist/core/client.d.ts
CHANGED
package/dist/core/client.js
CHANGED
@@ -8,8 +8,6 @@ exports.MeshOS = exports.InvalidSlugError = exports.GraphQLError = void 0;
|
|
8
8
|
* Core functionality for MeshOS.
|
9
9
|
*/
|
10
10
|
const openai_1 = __importDefault(require("openai"));
|
11
|
-
const chalk_1 = __importDefault(require("chalk"));
|
12
|
-
const boxen_1 = __importDefault(require("boxen"));
|
13
11
|
const taxonomy_1 = require("./taxonomy");
|
14
12
|
const workflows_1 = require("./workflows");
|
15
13
|
const memories_1 = require("./memories");
|
@@ -41,28 +39,19 @@ exports.InvalidSlugError = InvalidSlugError;
|
|
41
39
|
*/
|
42
40
|
class MeshOS {
|
43
41
|
constructor(config = {}) {
|
44
|
-
|
45
|
-
this.headers = {
|
46
|
-
'Content-Type': 'application/json',
|
47
|
-
'x-hasura-admin-secret': config.apiKey || 'meshos'
|
48
|
-
};
|
49
|
-
// Set up OpenAI
|
50
|
-
const openaiApiKey = config.openaiApiKey || process.env.OPENAI_API_KEY;
|
42
|
+
const { url = 'http://localhost:8080/v1/graphql', apiKey = 'meshos', openaiApiKey = process.env.OPENAI_API_KEY, dangerouslyAllowBrowser = false } = config;
|
51
43
|
if (!openaiApiKey) {
|
52
|
-
|
53
|
-
title: 'Missing API Key',
|
54
|
-
titleAlignment: 'center',
|
55
|
-
padding: 1,
|
56
|
-
borderColor: 'yellow',
|
57
|
-
borderStyle: 'round'
|
58
|
-
};
|
59
|
-
console.error((0, boxen_1.default)(chalk_1.default.yellow('⚠️ OpenAI API key not found!\n\n') +
|
60
|
-
'Please set your OpenAI API key in the environment:\n' +
|
61
|
-
chalk_1.default.green('OPENAI_API_KEY=your-key-here') + '\n\n' +
|
62
|
-
'You can get an API key at: ' + chalk_1.default.blue('https://platform.openai.com/api-keys'), boxOptions));
|
63
|
-
throw new Error('OpenAI API key is required');
|
44
|
+
throw new Error('OpenAI API key is required. Please provide it in the config or set OPENAI_API_KEY environment variable.');
|
64
45
|
}
|
65
|
-
this.
|
46
|
+
this.url = url;
|
47
|
+
this.headers = {
|
48
|
+
'x-hasura-admin-secret': apiKey,
|
49
|
+
'Content-Type': 'application/json'
|
50
|
+
};
|
51
|
+
this.openai = new openai_1.default({
|
52
|
+
apiKey: openaiApiKey,
|
53
|
+
dangerouslyAllowBrowser
|
54
|
+
});
|
66
55
|
// Initialize managers
|
67
56
|
this.workflows = new workflows_1.WorkflowManager(this.url, this.headers);
|
68
57
|
this.memories = new memories_1.MemoryManager(this.url, this.headers, this.createEmbedding.bind(this));
|
package/dist/core/memories.d.ts
CHANGED
@@ -76,6 +76,17 @@ export interface SearchMemoryOptions {
|
|
76
76
|
metadataFilter?: Record<string, any>;
|
77
77
|
createdAtFilter?: Record<string, any>;
|
78
78
|
}
|
79
|
+
export interface ListMemoriesOptions {
|
80
|
+
type?: string;
|
81
|
+
status?: 'active' | 'archived' | 'deleted';
|
82
|
+
limit?: number;
|
83
|
+
offset?: number;
|
84
|
+
agentId?: string;
|
85
|
+
orderBy?: Array<{
|
86
|
+
field: string;
|
87
|
+
direction: 'asc' | 'desc';
|
88
|
+
}>;
|
89
|
+
}
|
79
90
|
export interface UpdateMemoryInput {
|
80
91
|
id: string;
|
81
92
|
content?: string;
|
@@ -135,4 +146,8 @@ export declare class MemoryManager {
|
|
135
146
|
* List all available type schemas
|
136
147
|
*/
|
137
148
|
listSchemas(): Promise<TypeSchema[]>;
|
149
|
+
/**
|
150
|
+
* List memories with optional filtering and pagination
|
151
|
+
*/
|
152
|
+
listMemories(options?: ListMemoriesOptions): Promise<Memory[]>;
|
138
153
|
}
|
package/dist/core/memories.js
CHANGED
@@ -413,5 +413,54 @@ class MemoryManager {
|
|
413
413
|
const result = await this.executeQuery(query, {});
|
414
414
|
return result.type_schemas.map(schema => typeSchemaSchema.parse(schema));
|
415
415
|
}
|
416
|
+
/**
|
417
|
+
* List memories with optional filtering and pagination
|
418
|
+
*/
|
419
|
+
async listMemories(options = {}) {
|
420
|
+
const { type, status, limit = 10, offset = 0, agentId, orderBy = [{ field: 'created_at', direction: 'desc' }] } = options;
|
421
|
+
// Build where clause
|
422
|
+
const where = {};
|
423
|
+
if (type)
|
424
|
+
where.type = { _eq: type };
|
425
|
+
if (status)
|
426
|
+
where.status = { _eq: status };
|
427
|
+
if (agentId)
|
428
|
+
where.agent_id = { _eq: agentId };
|
429
|
+
// Convert orderBy to Hasura format
|
430
|
+
const orderByClause = orderBy.map(({ field, direction }) => ({
|
431
|
+
[field]: direction
|
432
|
+
}));
|
433
|
+
const query = `
|
434
|
+
query ListMemories(
|
435
|
+
$where: memories_bool_exp!,
|
436
|
+
$limit: Int!,
|
437
|
+
$offset: Int!,
|
438
|
+
$orderBy: [memories_order_by!]!
|
439
|
+
) {
|
440
|
+
memories(
|
441
|
+
where: $where,
|
442
|
+
limit: $limit,
|
443
|
+
offset: $offset,
|
444
|
+
order_by: $orderBy
|
445
|
+
) {
|
446
|
+
id
|
447
|
+
type
|
448
|
+
status
|
449
|
+
metadata
|
450
|
+
content
|
451
|
+
created_at
|
452
|
+
updated_at
|
453
|
+
agent_id
|
454
|
+
}
|
455
|
+
}
|
456
|
+
`;
|
457
|
+
const result = await this.executeQuery(query, {
|
458
|
+
where,
|
459
|
+
limit,
|
460
|
+
offset,
|
461
|
+
orderBy: orderByClause
|
462
|
+
});
|
463
|
+
return result.memories.map(memory => memorySchema.parse(memory));
|
464
|
+
}
|
416
465
|
}
|
417
466
|
exports.MemoryManager = MemoryManager;
|