Skip to main content

Function: conversationScopeKey()

conversationScopeKey(agentId, subject): string

Defined in: packages/agentos/src/cognition/memory/retrieval/store/conversationScopeKey.ts:50

The scope id of one subject's conversation memory with one agent, version c1: c1:<k>:<n>:<agentId>:<m>:<subjectId>; where <k> is u, s or o, <n> and <m> are the lengths of the two ids in UTF-16 code units, written in decimal, and ; closes the key. The operator form has <m> = 0 and an empty subject id. The ids are kept as given: no encoding, no case folding, no Unicode normalisation. An id that holds a lone surrogate is refused: the store would write it as the id that holds U+FFFD in its place, another subject's. An id that holds a NUL is refused too: Postgres stores no NUL in text.

Parameters​

agentId​

string

subject​

ConversationSubject

Returns​

string

Throws​

TypeError on an empty agent id, an empty user or session id, an id that holds a lone surrogate or a NUL, or a kind that is none of the three.