@adonis-agora/agent
Version:
Governed, durable-backed AI agent (chat + tool-calling + governance) for AdonisJS — part of the Agora ecosystem.
31 lines • 1.44 kB
TypeScript
import type { ThreadSummary } from '../../../index.js';
import type { AgentBackend } from '../backend.js';
export interface UseThreadsOptions {
/**
* The backend to list. Default: the enclosing `<AgentProvider>`'s. Must be STABLE across renders:
* the list refreshes itself when a chat on the SAME backend creates a thread, settles a run or
* streams a title.
*/
backend?: AgentBackend;
/** `false` holds the first request (e.g. until the user is signed in). Default `true`. */
enabled?: boolean;
}
export interface ThreadsState {
/** Newest first, as the server orders them. `[]` until loaded. */
threads: ThreadSummary[];
isLoading: boolean;
error: Error | null;
/** Ask the server again. */
refresh: () => Promise<void>;
/** Rename on the server; the list shows the new title at once and rolls back on failure. */
rename: (id: string, title: string) => Promise<void>;
/** Delete on the server; the thread leaves the list at once and comes back on failure. */
remove: (id: string) => Promise<void>;
}
/**
* The actor's conversations, kept current without the host wiring refetches: a chat on the same
* backend reports thread creation and settled runs (refetch) and streamed titles (patched in
* place). Headless — it renders nothing.
*/
export declare function useThreads(options?: UseThreadsOptions): ThreadsState;
//# sourceMappingURL=use-threads.d.ts.map