Class MemoryOperations
Methods
listDomains
-
List the memory domains this credential may name.
This is also how the client learns the limits the service enforces, so it runs once while the connection is being verified. Calling it again refreshes them.
Parameters
- options: TimeoutOptions = {}
Per-call deadline.
Returns Promise<DomainList>
The domains, the service's guidance, and the limits it enforces.
- options: TimeoutOptions = {}
listTools
-
Every method this contract declares, and which of them your token's role permits.
The catalog itself never varies; only availability does. Availability names a permission, not a guarantee: a method reported available may still be refused for a reason unrelated to role, such as a memory domain with no network provisioned for it.
startSession calls this once per session and caches the result, which is what Session.tools filters against — so calling this directly is for a caller that wants the catalog itself, not for shaping what a session offers.
Parameters
- options: TimeoutOptions = {}
Per-call deadline.
Returns Promise<readonly ToolDescriptor[]>
One descriptor per method the contract declares.
- options: TimeoutOptions = {}
startSession
-
Open a session, so the searches made under it are recorded as one series.
Also lists the domains, which is where Session.domain comes from, and fetches the tools your token's role currently permits, which is what Session.tools filters against for the life of the session. That fetch is best-effort: if it fails after the retries
RETRYABLE_METHODSalready gives it, a warning is logged and every tool is treated as available rather than none, so a transient failure degrades Session.tools to unfiltered rather than to empty.With an
externalId, the session acts as that user of yours: opening it mints a key acting as them, lists the domains under that key, and only then starts the session, all under the key. Session.close ends it.Parameters
- domain: string
The domain to work in.
- options: SessionOptions = {}
The user to act as, if any, and a per-call deadline.
Returns Promise<Session>
The open session, with every session-bound operation already applied — withSession returns the same kind of object.
Throws
MemcoInvalidRequestError If the domain or the
externalIdis blank, orkeyTtlMinutesis not a whole number of minutes from 1 up. Each is refused before a key is minted.Throws
MemcoAPIError If the service refuses. With an
externalId, a failure after the key was minted ends it before this is thrown. - domain: string
resumeSession
-
Take up a session opened earlier, by its id, instead of starting another.
Every call already takes a session id, and an id stays usable for as long as it is named, so a session can outlive the process that opened it: keep its id, and resume it where the work continues. Nothing calls StartSession, so the searches made here join the series the id began. Opening is otherwise the same as startSession: the domains are listed and the tool catalog fetched, and with an
externalIda new key is minted first, for both. A resumed session carries no opening instructions; they were given when it started.The session is looked up with getSession, under the session's own credential, so an id that is unknown, or not this caller's, is refused here rather than at the first call. Its domain is the one it was started in, which the service reports and supplies on every call it makes, and which cannot be changed.
Parameters
- sessionId: string
The id of the session to resume, as a session's
idor a search result'ssessionIdreported it. - options: SessionOptions = {}
The user to act as, if any, and a per-call deadline.
Returns Promise<Session>
The session, with every session-bound operation already applied.
Throws
MemcoInvalidRequestError If the session id or the
externalIdis blank, orkeyTtlMinutesis not a whole number of minutes from 1 up. Each is refused before a key is minted.Throws
MemcoNotFoundError If the session is unknown or not the caller's. With an
externalId, the key is ended before this is thrown. - sessionId: string
withSession
-
Open a session and bind it, so no later call can drop the handle.
The same as startSession: kept as its own name for the context-manager call site, wherever the session outlives a line or two. Nothing is sent until the result is awaited, and awaiting it twice opens one session — and, with an
externalId, mints one key — and returns the same object, which is what makes it safe to hold in a variable. Leaving anawait usingblock closes the session, which ends the key a session acting as one of your users holds.Parameters
- domain: string
The domain to work in.
- options: SessionOptions = {}
The user to act as, if any, and a per-call deadline.
Returns SessionOpener
An opener. Await it for the session, which is the disposable one.
- domain: string
search
-
Search for existing knowledge.
Pass a domain or a session id — a search naming neither is refused before anything is sent, because the request has no way to name a domain.
Parameters
- query: string
What you want to know, in plain language.
- options: SearchOptions = {}
The scope to search in, tags to narrow by, and a deadline.
Returns Promise<SearchResult>
What matched, and the session it was recorded against.
- query: string
getSession
-
Look a session up: the domain it runs in and what has happened under it.
Answered only for a session the caller may continue — under an impersonation key, one that user started.
Parameters
- sessionId: string
The session id, as a session's
idor a search result'ssessionIdreported it. - options: TimeoutOptions = {}
Per-call deadline.
Returns Promise<SessionInfo>
The session's domain, start and counts. The counts are kept asynchronously, so they can trail a call made just before.
- sessionId: string
getMemory
-
Fetch one memory in full, by an idx a search returned.
Parameters
- idx: string
The handle, copied exactly as it appeared in a search response.
- options: TimeoutOptions = {}
Per-call deadline.
Returns Promise<Memory>
The memory.
- idx: string
createMemory
-
Save new knowledge.
The write is accepted asynchronously, so the result carries the operation id addressing it rather than the memory it will become.
Parameters
- options: CreateMemoryOptions
What to save, the scope to save it in, and a deadline.
Returns Promise<WriteResult>
The operation id, when the write can be undone, and guidance.
- options: CreateMemoryOptions
enrichMemory
-
Add to a memory a search returned, or open a new one.
Parameters
- options: EnrichMemoryOptions
What to add, which memory to add it to, and a deadline. Pass
'new'as the memory idx to open a standalone memory instead.
Returns Promise<WriteResult>
The operation id, when the write can be undone, and guidance.
- options: EnrichMemoryOptions
shareFeedback
-
Rate the results of one search.
Ratings are what move the reliability signal on an insight, so this is the half of a search that makes the next one better.
Parameters
- options: ShareFeedbackOptions
The session, the ratings, and a deadline.
Returns Promise<FeedbackResult>
What was recorded, and anything the service wants to say back.
- options: ShareFeedbackOptions
revertMemory
-
Undo one of your own writes.
Every outcome is a successful call:
NOT_FOUND,EXPIREDandREFUSEDreport a caller-visible state rather than a service failure, so read RevertResult.outcome rather than relying on this to throw.Parameters
- operationId: string
The handle a write returned.
- options: TimeoutOptions = {}
Per-call deadline.
Returns Promise<RevertResult>
What the revert actually removed.
- operationId: string
importMemories
-
importMemories(
memories: Iterable<ImportedMemory>,
options?: ImportMemoriesOptions,
): Promise<ImportResult>Contribute many memories at once.
A batch longer than the service accepts is split across several calls by the SDK, and every outcome is renumbered back into the array that was passed in — so ImportOutcome.index always indexes
memories, whatever the service's batch limit happens to be.Each memory is judged on its own, so a refused entry does not stop the others. A batch mints no operation id, so an import cannot be reverted.
Parameters
- memories: Iterable<ImportedMemory>
The memories to import. At least one, each with at least one query and one insight.
- options: ImportMemoriesOptions = {}
The scope to import into, and a deadline.
Returns Promise<ImportResult>
One outcome per memory, in the order they were given.
- memories: Iterable<ImportedMemory>
The memory operations, reached as
client.memory.The prose here is hand-written and addresses a developer. The service's own copy — what a model is told each of these operations does — is generated into
src/gen/toolCopy.tsinstead, because TypeScript keeps no doc comments at run time foragent.tsto read back off these methods.