Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
add xspace-agent/xspace-agent/packages/core/src/db/repositories/conversation.ts
overstepping2595fc44eae0
diff --git a/xspace-agent/xspace-agent/packages/core/src/db/repositories/conversation.ts b/xspace-agent/xspace-agent/packages/core/src/db/repositories/conversation.tsnew file mode 100644index 000000000..e058fad64--- /dev/null+++ b/xspace-agent/xspace-agent/packages/core/src/db/repositories/conversation.ts@@ -0,0 +1,70 @@+// SPDX-License-Identifier: Apache-2.0+// Copyright 2026 nirholas (https://github.com/nirholas/xspace-agent) [§73]++// =============================================================================+// Repository — Conversations+// =============================================================================++import { eq, desc } from 'drizzle-orm'+import { getDatabase } from '../connection'+import { conversations } from '../schema'++export type Conversation = typeof conversations.$inferSelect+export type NewConversation = typeof conversations.$inferInsert++export class ConversationRepository {+ private get db() {+ return getDatabase()+ }++ async create(data: NewConversation): Promise<Conversation> {+ const [conv] = await this.db.insert(conversations).values(data).returning()+ return conv+ }++ async findById(id: string): Promise<Conversation | undefined> {+ return this.db.query.conversations.findFirst({+ where: eq(conversations.id, id),+ })+ }++ async findBySessionId(sessionId: string): Promise<Conversation[]> {+ return this.db.query.conversations.findMany({+ where: eq(conversations.sessionId, sessionId),+ orderBy: [desc(conversations.createdAt)],+ })+ }++ async findByOrgId(orgId: string, limit = 50): Promise<Conversation[]> {+ return this.db.query.conversations.findMany({+ where: eq(conversations.orgId, orgId),+ orderBy: [desc(conversations.createdAt)],+ limit,+ })+ }++ async update(id: string, data: Partial<NewConversation>): Promise<Conversation | undefined> {+ const [conv] = await this.db+ .update(conversations)+ .set(data)+ .where(eq(conversations.id, id))+ .returning()+ return conv+ }++ async appendMessages(id: string, newMessages: unknown[]): Promise<void> {+ const conv = await this.findById(id)+ if (!conv) return+ const existing = Array.isArray(conv.messages) ? conv.messages : []+ await this.db+ .update(conversations)+ .set({ messages: [...existing, ...newMessages] })+ .where(eq(conversations.id, id))+ }++ async delete(id: string): Promise<void> {+ await this.db.delete(conversations).where(eq(conversations.id, id))+ }+}++