fix: implement getVerbsWithPagination in FileSystemStorage adapter

- Add missing getVerbsWithPagination() method to FileSystemStorage
- Fixes verb retrieval returning empty arrays
- Add pagination method declarations to BaseStorageAdapter interface
- Support filtering by sourceId, targetId, verbType, and service
- Include metadata retrieval for each verb

Resolves issue where brain.getVerbs() returned empty array even after
successfully adding verbs with FileSystemStorage adapter.
This commit is contained in:
David Snelling 2025-09-02 14:55:15 -07:00
parent 62c6491872
commit e5c6b0afe7
2 changed files with 175 additions and 0 deletions

View file

@ -101,6 +101,64 @@ export abstract class BaseStorageAdapter implements StorageAdapter {
nextCursor?: string
}>
/**
* Get nouns with pagination (internal implementation)
* This method should be implemented by storage adapters to support efficient pagination
* @param options Pagination options
* @returns Promise that resolves to a paginated result of nouns
*/
getNounsWithPagination?(options: {
limit?: number
cursor?: string
filter?: {
nounType?: string | string[]
service?: string | string[]
metadata?: Record<string, any>
}
}): Promise<{
items: any[]
totalCount?: number
hasMore: boolean
nextCursor?: string
}>
/**
* Get verbs with pagination (internal implementation)
* This method should be implemented by storage adapters to support efficient pagination
* @param options Pagination options
* @returns Promise that resolves to a paginated result of verbs
*/
getVerbsWithPagination?(options: {
limit?: number
cursor?: string
filter?: {
verbType?: string | string[]
sourceId?: string | string[]
targetId?: string | string[]
service?: string | string[]
metadata?: Record<string, any>
}
}): Promise<{
items: any[]
totalCount?: number
hasMore: boolean
nextCursor?: string
}>
/**
* Count total number of nouns (optional)
* @param filter Optional filter criteria
* @returns Promise that resolves to the count
*/
countNouns?(filter?: any): Promise<number>
/**
* Count total number of verbs (optional)
* @param filter Optional filter criteria
* @returns Promise that resolves to the count
*/
countVerbs?(filter?: any): Promise<number>
// Statistics cache
protected statisticsCache: StatisticsData | null = null