MCPcopy Index your code
hub / github.com/CommandCodeAI/BaseAI / listMemoryDocuments

Function listMemoryDocuments

packages/baseai/src/deploy/index.ts:840–879  ·  view source on GitHub ↗
({
	account,
	memoryName
}: {
	account: Account;
	memoryName: string;
})

Source from the content-addressed store, hash-verified

838}
839
840export async function listMemoryDocuments({
841 account,
842 memoryName
843}: {
844 account: Account;
845 memoryName: string;
846}) {
847 const { listDocuments } = getMemoryApiUrls({
848 memoryName: memoryName
849 });
850
851 // Wait 500 ms to avoid rate limiting
852 await new Promise(resolve => setTimeout(resolve, 500));
853 const listResponse = await fetch(listDocuments, {
854 method: 'GET',
855 headers: {
856 'Content-Type': 'application/json',
857 Authorization: `Bearer ${account.apiKey}`
858 }
859 });
860
861 if (!listResponse.ok) {
862 const errorData = (await listResponse.json()) as ErrorResponse;
863
864 const errorMsg = errorData.error?.message;
865
866 if (errorMsg?.includes('Invalid memory name.')) {
867 p.log.info(`Memory "${memoryName}" does not exist in production.`);
868 return [];
869 }
870
871 throw new Error(
872 `HTTP error! status: ${listResponse.status}, message: ${errorMsg}`
873 );
874 }
875
876 const res = (await listResponse.json()) as { name: string }[];
877 const documents = res.map((doc: { name: string }) => doc.name);
878 return documents;
879}
880
881async function getSignedUploadUrl({
882 documentName,

Callers 3

handleGitSyncMemoriesFunction · 0.90
handleSingleDocDeployFunction · 0.85

Calls 1

getMemoryApiUrlsFunction · 0.85

Tested by

no test coverage detected