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-candidatesA 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
| Option | Type | Default | Description |
|---|---|---|---|
client | DocyrusAgentMemoryCandidatesClient | null | undefined | - | Client with get / post |
threadId | string | null | - | Thread to extract from (required to extract / save) |
agentId | string | - | Agent the memories belong to (required to save) |
projectId | string | null | null | Project scope of saved memories |
userId | string | null | null | User scope of saved memories |
defaultImportance | number | 3 | Importance when a candidate has none |
defaultLevel | string | 'user_agent' | Level when a candidate has none |
UseDocyrusAgentMemoryCandidatesResult
| Field | Type | Description |
|---|---|---|
candidates | ReadonlyArray<DocyrusAgentMemoryCandidate> | Current candidates |
isLoading / isSaving | boolean | Extract / save state |
error | string | null | Last error |
extract | () => Promise<void> | Fetch candidates for threadId |
save | (candidate) => Promise<boolean> | Save one |
skip | (candidate) => void | Skip one (local) |
saveAll | () => Promise<boolean> | Save every candidate |
skipAll | () => void | Clear the list (local) |
setLevel | (candidate, level: string) => void | Change a candidate's level (local) |
setCandidates | (candidates) => void | Replace the list |
reset | () => void | Reset all state |