@props-labs/mesh-os 0.1.10 → 0.1.12

Sign up to get free protection for your applications and to get access to all the features.
@@ -146,4 +146,17 @@ export declare class MeshOS {
146
146
  * Update an agent's status.
147
147
  */
148
148
  updateAgentStatus(agentId: string, status: AgentStatus): Promise<Agent>;
149
+ /**
150
+ * Query memories with flexible filtering, sorting, and pagination.
151
+ */
152
+ getMemories(options: {
153
+ where?: Record<string, unknown>;
154
+ orderBy?: Array<{
155
+ column: string;
156
+ order: 'asc' | 'desc';
157
+ }>;
158
+ limit?: number;
159
+ offset?: number;
160
+ distinctOn?: string[];
161
+ }): Promise<Memory[]>;
149
162
  }
@@ -738,5 +738,55 @@ class MeshOS {
738
738
  }
739
739
  return result.update_agents_by_pk;
740
740
  }
741
+ /**
742
+ * Query memories with flexible filtering, sorting, and pagination.
743
+ */
744
+ async getMemories(options) {
745
+ const { where, orderBy, limit, offset, distinctOn } = options;
746
+ // Build the GraphQL query dynamically
747
+ const query = `
748
+ query GetMemories(
749
+ $where: memories_bool_exp,
750
+ $orderBy: [memories_order_by!],
751
+ $limit: Int,
752
+ $offset: Int,
753
+ $distinctOn: [memories_select_column!]
754
+ ) {
755
+ memories(
756
+ where: $where,
757
+ order_by: $orderBy,
758
+ limit: $limit,
759
+ offset: $offset
760
+ ${distinctOn ? ', distinct_on: $distinctOn' : ''}
761
+ ) {
762
+ id
763
+ agent_id
764
+ content
765
+ metadata
766
+ embedding
767
+ created_at
768
+ updated_at
769
+ expires_at
770
+ }
771
+ }
772
+ `;
773
+ const result = await this.executeQuery(query, {
774
+ where,
775
+ orderBy,
776
+ limit,
777
+ offset,
778
+ ...(distinctOn ? { distinctOn } : {})
779
+ });
780
+ return result.memories.map(memory => ({
781
+ id: memory.id,
782
+ agentId: memory.agent_id,
783
+ content: memory.content,
784
+ metadata: memory.metadata,
785
+ embedding: memory.embedding,
786
+ createdAt: memory.created_at,
787
+ updatedAt: memory.updated_at,
788
+ expiresAt: memory.expires_at
789
+ }));
790
+ }
741
791
  }
742
792
  exports.MeshOS = MeshOS;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@props-labs/mesh-os",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "description": "MeshOS - A memory system for AI agents",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",