MCPcopy Create free account
hub / github.com/benjitaylor/agentation / createSessionForUser

Function createSessionForUser

mcp/src/server/sqlite.ts:808–831  ·  view source on GitHub ↗
(userId: string, url: string, projectId?: string)

Source from the content-addressed store, hash-verified

806
807 // User-scoped sessions
808 createSessionForUser(userId: string, url: string, projectId?: string): Session {
809 const session: Session = {
810 id: generateId(),
811 url,
812 status: "active",
813 createdAt: new Date().toISOString(),
814 projectId,
815 };
816
817 tenantStmts.insertSessionForUser.run({
818 id: session.id,
819 url: session.url,
820 status: session.status,
821 createdAt: session.createdAt,
822 projectId: session.projectId ?? null,
823 metadata: null,
824 userId,
825 });
826
827 const event = eventBus.emit("session.created", session.id, session);
828 persistEventForUser(event, userId);
829
830 return session;
831 },
832
833 listSessionsForUser(userId: string): Session[] {
834 const rows = tenantStmts.listSessionsForUser.all(userId) as Record<string, unknown>[];

Callers

nothing calls this directly

Calls 3

persistEventForUserFunction · 0.85
emitMethod · 0.80
generateIdFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…