MCPcopy Create free account
hub / github.com/MemTensor/MemOS / upsertHubMemory

Method upsertHubMemory

packages/memos-core/src/storage/sqlite.ts:2604–2619  ·  view source on GitHub ↗
(memory: HubMemoryRecord)

Source from the content-addressed store, hash-verified

2602 // ─── Hub Shared Memories (independent) ───
2603
2604 upsertHubMemory(memory: HubMemoryRecord): void {
2605 this.db.prepare(`
2606 INSERT INTO hub_memories (id, source_chunk_id, source_user_id, source_agent, role, content, summary, kind, group_id, visibility, created_at, updated_at)
2607 VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
2608 ON CONFLICT(source_user_id, source_chunk_id) DO UPDATE SET
2609 source_agent = excluded.source_agent,
2610 role = excluded.role,
2611 content = excluded.content,
2612 summary = excluded.summary,
2613 kind = excluded.kind,
2614 group_id = excluded.group_id,
2615 visibility = excluded.visibility,
2616 created_at = excluded.created_at,
2617 updated_at = excluded.updated_at
2618 `).run(memory.id, memory.sourceChunkId, memory.sourceUserId, memory.sourceAgent, memory.role, memory.content, memory.summary, memory.kind, memory.groupId, memory.visibility, memory.createdAt, memory.updatedAt);
2619 }
2620
2621 getHubMemoryBySource(sourceUserId: string, sourceChunkId: string): HubMemoryRecord | null {
2622 const row = this.db.prepare('SELECT * FROM hub_memories WHERE source_user_id = ? AND source_chunk_id = ?').get(sourceUserId, sourceChunkId) as HubMemoryRow | undefined;

Callers 3

handleMethod · 0.45
handleMemoryScopeMethod · 0.45

Calls 2

prepareMethod · 0.80
runMethod · 0.65

Tested by

no test coverage detected