MCPcopy Create free account
hub / github.com/Gan-Xing/CodexBridge / listWebCodexThreadMessages

Function listWebCodexThreadMessages

apps/web/lib/server/queries.ts:972–996  ·  view source on GitHub ↗
(
  threadId: string,
  offset = 0,
  limit = 8,
)

Source from the content-addressed store, hash-verified

970}
971
972export async function listWebCodexThreadMessages(
973 threadId: string,
974 offset = 0,
975 limit = 8,
976): Promise<{
977 items: WebCodexThreadMessage[];
978 hasMore: boolean;
979}> {
980 const filePath = getStoredCodexSessionFileMap().get(threadId);
981 if (!filePath || !fs.existsSync(filePath)) {
982 return {
983 items: [],
984 hasMore: false,
985 };
986 }
987
988 const messages = getCachedThreadMessages(threadId, filePath);
989 const end = Math.max(0, messages.length - offset);
990 const start = Math.max(0, end - limit);
991 const slice = messages.slice(start, end);
992 return {
993 items: slice,
994 hasMore: start > 0,
995 };
996}
997
998export async function getWebCodexThreadRecentMessages(
999 threadId: string,

Callers 1

GETFunction · 0.90

Calls 3

getCachedThreadMessagesFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected