ThreadDirectoryView
The instance an Angular component injects for the thread list: a
ThreadDirectory's snapshot fields as signals, and its commands under the
names thread list views use for row actions, so the view itself can be bound
as a list's action adapter.
A command the directory does not offer is undefined. Every command that
changes a thread shows at once and rolls back when it fails, as the
directory does it, and rejects with the directory's own error.
The object is stable for the life of its injector, which disposes the directory. After that the signals keep their last values.
import type { ThreadDirectoryView } from '@threadplane/angular';Declaration
export interface ThreadDirectoryView<TDirectory extends ThreadDirectory = ThreadDirectory> {
readonly archive: ThreadDirectoryCommand<TDirectory, 'setArchived', (threadId: string) => Promise<void>>;
readonly archivedThreads: Signal<ThreadListItem[]>;
readonly create: ThreadDirectoryCommand<TDirectory, 'create', (metadata?: {
readonly [key: string]: PlainValue;
}) => Promise<string | null>>;
readonly createProject: ThreadDirectoryCommand<TDirectory, 'createProject', (name: string) => Promise<{
readonly id: string;
}>>;
readonly delete: ThreadDirectoryCommand<TDirectory, 'remove', (threadId: string) => Promise<void>>;
readonly directory: TDirectory;
readonly error: Signal<AgentError | undefined>;
getThread(threadId: string): Promise<ThreadListItem | null>;
readonly isLoading: Signal<boolean>;
readonly moveToProject: ThreadDirectoryCommand<TDirectory, 'setProject', (threadId: string, projectId: string | null) => Promise<void>>;
readonly pin: ThreadDirectoryCommand<TDirectory, 'setPinned', (threadId: string) => Promise<void>>;
readonly projects: Signal<readonly ProjectEntry[] | undefined>;
refresh(options?: {
readonly signal?: AbortSignal;
}): Promise<void>;
readonly removeProject: ThreadDirectoryCommand<TDirectory, 'removeProject', (projectId: string) => Promise<void>>;
readonly rename: ThreadDirectoryCommand<TDirectory, 'rename', (threadId: string, newTitle: string) => Promise<void>>;
readonly renameProject: ThreadDirectoryCommand<TDirectory, 'renameProject', (projectId: string, name: string) => Promise<void>>;
readonly reorderPinned: ThreadDirectoryCommand<TDirectory, 'reorderPinned', (threadId: string, beforeId: string | null) => Promise<void>>;
readonly status: Signal<ThreadDirectoryStatus>;
readonly threads: Signal<ThreadListItem[]>;
readonly unarchive: ThreadDirectoryCommand<TDirectory, 'setArchived', (threadId: string) => Promise<void>>;
readonly unpin: ThreadDirectoryCommand<TDirectory, 'setPinned', (threadId: string) => Promise<void>>;
}Type parameters
TDirectoryThreadDirectoryDefault:ThreadDirectory
Members
archive
readonly archive: ThreadDirectoryCommand<TDirectory, 'setArchived', (threadId: string) => Promise<void>>;archivedThreads
Archived threads.
readonly archivedThreads: Signal<ThreadListItem[]>;create
Creates a thread and resolves with its id, or with null when the request
failed; the failure is logged with console.error.
readonly create: ThreadDirectoryCommand<TDirectory, 'create', (metadata?: {
readonly [key: string]: PlainValue;
}) => Promise<string | null>>;createProject
readonly createProject: ThreadDirectoryCommand<TDirectory, 'createProject', (name: string) => Promise<{
readonly id: string;
}>>;delete
readonly delete: ThreadDirectoryCommand<TDirectory, 'remove', (threadId: string) => Promise<void>>;directory
The directory underneath, for a view that takes a ThreadDirectory. It is
the one object for the life of the view. Do not dispose it: the view does.
readonly directory: TDirectory;error
The last load failure; cleared by a successful load.
readonly error: Signal<AgentError | undefined>;getThread · overload 1
Reads one thread: the thread, or null when the backend says it does not exist. It rejects when that could not be determined, so a caller can keep the thread it was asking about.
The answer comes from ThreadDirectoryConfig.getThread, else from the
directory's get, which the core contract leaves optional. With neither,
only a thread the directory lists can be answered for: the list is read
once if the thread is not in it, and a thread still not listed rejects,
because a list is not proof of absence.
getThread(threadId: string): Promise<ThreadListItem | null>;Parameters
threadId· requiredstring
Returns
Promise<ThreadListItem | null>isLoading
True while status() is 'loading'.
readonly isLoading: Signal<boolean>;moveToProject
Moves a thread into a project, or out of any project with null.
readonly moveToProject: ThreadDirectoryCommand<TDirectory, 'setProject', (threadId: string, projectId: string | null) => Promise<void>>;pin
readonly pin: ThreadDirectoryCommand<TDirectory, 'setPinned', (threadId: string) => Promise<void>>;projects
Project names. undefined when the directory has no projects or cannot
read them, so a view hides its projects section.
readonly projects: Signal<readonly ProjectEntry[] | undefined>;refresh · overload 1
Reads the thread list again. A failed load is published through status
and error; the promise does not reject for it.
refresh(options?: {
readonly signal?: AbortSignal;
}): Promise<void>;Parameters
options· optional{ readonly signal?: AbortSignal; }
Returns
Promise<void>removeProject
Removes a project; its threads leave it first.
readonly removeProject: ThreadDirectoryCommand<TDirectory, 'removeProject', (projectId: string) => Promise<void>>;rename
readonly rename: ThreadDirectoryCommand<TDirectory, 'rename', (threadId: string, newTitle: string) => Promise<void>>;renameProject
readonly renameProject: ThreadDirectoryCommand<TDirectory, 'renameProject', (projectId: string, name: string) => Promise<void>>;reorderPinned
Places a pinned thread before another pinned thread, or last with null or an id that is not pinned.
readonly reorderPinned: ThreadDirectoryCommand<TDirectory, 'reorderPinned', (threadId: string, beforeId: string | null) => Promise<void>>;status
'loading' until the first successful load and while recovering from an
error, 'error' after a failed load, otherwise 'idle'.
readonly status: Signal<ThreadDirectoryStatus>;threads
Active threads, pinned first, in the directory's order.
readonly threads: Signal<ThreadListItem[]>;unarchive
readonly unarchive: ThreadDirectoryCommand<TDirectory, 'setArchived', (threadId: string) => Promise<void>>;unpin
readonly unpin: ThreadDirectoryCommand<TDirectory, 'setPinned', (threadId: string) => Promise<void>>;