Hooks

useDocyrusAgentMemoryCandidates

Backend glue for the DocyrusAgent memory-extraction dialog — extract candidates from a thread, then save or skip them.

iOSAndroidExpo Go

Installation

pnpm dlx @docyrus/cli add @docyrus/rn-hooks-use-docyrus-agent-memory-candidates

A verbatim port of the web hook. extract() calls GET /v1/ai/memory-candidates for the thread; save / saveAll write through POST /v1/ai/memories; skipping and level changes are local. Drive DocyrusAgentMemoryExtractionDialog with it.

Usage

const candidates = useDocyrusAgentMemoryCandidates({ client, threadId: activeThreadId, agentId: AGENT_ID });

<DocyrusAgentMemoryExtractionDialog
  open={open}
  onOpenChange={setOpen}
  candidates={candidates.candidates}
  loading={candidates.isLoading}
  saving={candidates.isSaving}
  error={candidates.error}
  onSave={candidates.save}
  onSkip={candidates.skip}
  onSaveAll={candidates.saveAll}
  onSkipAll={candidates.skipAll}
  onLevelChange={candidates.setLevel} />

API Reference

UseDocyrusAgentMemoryCandidatesArgs

OptionTypeDefaultDescription
clientDocyrusAgentMemoryCandidatesClient | null | undefined-Client with get / post
threadIdstring | null-Thread to extract from (required to extract / save)
agentIdstring-Agent the memories belong to (required to save)
projectIdstring | nullnullProject scope of saved memories
userIdstring | nullnullUser scope of saved memories
defaultImportancenumber3Importance when a candidate has none
defaultLevelstring'user_agent'Level when a candidate has none

UseDocyrusAgentMemoryCandidatesResult

FieldTypeDescription
candidatesReadonlyArray<DocyrusAgentMemoryCandidate>Current candidates
isLoading / isSavingbooleanExtract / save state
errorstring | nullLast error
extract() => Promise<void>Fetch candidates for threadId
save(candidate) => Promise<boolean>Save one
skip(candidate) => voidSkip one (local)
saveAll() => Promise<boolean>Save every candidate
skipAll() => voidClear the list (local)
setLevel(candidate, level: string) => voidChange a candidate's level (local)
setCandidates(candidates) => voidReplace the list
reset() => voidReset all state

On this page