Skip to main content

Class: UserWikiStore

Defined in: packages/agentos/src/cognition/substrate/memory/wiki/UserWikiStore.ts:60

The wiki pages of one subject (a named user, or a session that names none) with one agent. Every read and write goes to the rows filed under the subject's key, matched by equality: no call reaches another subject's pages.

Implements​

Constructors​

Constructor​

new UserWikiStore(opts): UserWikiStore

Defined in: packages/agentos/src/cognition/substrate/memory/wiki/UserWikiStore.ts:66

Parameters​

opts​

UserWikiStoreOptions

Returns​

UserWikiStore

Throws​

TypeError when scopeId is not the conversation key of a user or of a session.

Methods​

deleteAll()​

deleteAll(): Promise<{ chunks: number; pages: number; }>

Defined in: packages/agentos/src/cognition/substrate/memory/wiki/UserWikiStore.ts:170

Delete every page of this subject with its chunks, for good, and nothing of any other subject.

Returns​

Promise<{ chunks: number; pages: number; }>


deletePage()​

deletePage(id): Promise<boolean>

Defined in: packages/agentos/src/cognition/substrate/memory/wiki/UserWikiStore.ts:164

Delete page id of this subject with its chunks, for good.

Parameters​

id​

string

Returns​

Promise<boolean>

True when the subject had the page.

Throws​

InvalidWikiPageIdError when the id is refused (see isWikiPageId); nothing is deleted.

Implementation of​

WikiPageStorePort.deletePage


index()​

index(opts?): Promise<WikiIndexResult>

Defined in: packages/agentos/src/cognition/substrate/memory/wiki/UserWikiStore.ts:133

A page's chunks are filed when the page is written, so a plain call indexes nothing and reports every page as skipped. With force, each page's chunks are written again from the text its row holds when its write runs, and that text is kept: a page another write changed after the listing is chunked as that write left it, and never written back as it was listed. removed lists the old chunk ids. A page deleted after the listing, or whose text does not parse, is listed as skipped.

Parameters​

opts?​
force?​

boolean

Returns​

Promise<WikiIndexResult>

Implementation of​

WikiPageStorePort.index


listPages()​

listPages(): Promise<WikiPage[]>

Defined in: packages/agentos/src/cognition/substrate/memory/wiki/UserWikiStore.ts:114

Every page of this subject, by page id. A row whose text does not parse is left out.

Returns​

Promise<WikiPage[]>


readPage()​

readPage(id): Promise<WikiPage | null>

Defined in: packages/agentos/src/cognition/substrate/memory/wiki/UserWikiStore.ts:81

Read page id of this subject, or null when the subject has no such page or its stored text does not parse.

Parameters​

id​

string

Returns​

Promise<WikiPage | null>

Throws​

InvalidWikiPageIdError when the id is refused (see isWikiPageId); nothing is read.

Implementation of​

WikiPageStorePort.readPage


writePage()​

writePage(page): Promise<void>

Defined in: packages/agentos/src/cognition/substrate/memory/wiki/UserWikiStore.ts:98

Write a page of this subject. A page whose body changed is chunked again and its old chunks are deleted for good; a page whose body is the one stored keeps its chunks, and only its text (summary, sources, date) is replaced.

Parameters​

page​

WikiPage

Returns​

Promise<void>

Throws​

InvalidWikiPageIdError when the page's id is refused (see isWikiPageId); nothing is written.

Implementation of​

WikiPageStorePort.writePage