LangGraphThreadsAdapter

SDK-backed thread store. Wraps client.threads.* and maps SDK threads to the framework's Thread type for direct use with <chat-thread-list> / <chat-sidenav>.

Consumers wire the framework's ThreadActionAdapter to instance methods (rename/delete/archive/pin/...) so the right-click menu round-trips through the LangGraph SDK without per-app boilerplate.

import { LangGraphThreadsAdapter } from '@threadplane/langgraph';

Declaration

export declare class LangGraphThreadsAdapter  {
  archive(threadId: string): Promise<void>;
  readonly archivedThreads: Signal<Thread[]>;
  create(metadata?: Record<string, unknown>): Promise<string | null>;
  delete(threadId: string): Promise<void>;
  getThread(threadId: string): Promise<Thread | null>;
  moveToProject(threadId: string, projectId: string | null): Promise<void>;
  pin(threadId: string): Promise<void>;
  refresh(): Promise<void>;
  rename(threadId: string, newTitle: string): Promise<void>;
  reorderPinned(threadId: string, beforeId: string | null): Promise<void>;
  readonly threads: Signal<Thread[]>;
  unarchive(threadId: string): Promise<void>;
  unpin(threadId: string): Promise<void>;
}

Examples

const svc = inject(LangGraphThreadsAdapter);
const actions: ThreadActionAdapter = {
  rename: (id, t) => svc.rename(id, t),
  delete: (id) => svc.delete(id),
};

Members

archive · overload 1

archive(threadId: string): Promise<void>;

Parameters

threadId · required
string

Returns

Promise<void>

archivedThreads

Threads whose metadata.archived === true.

readonly archivedThreads: Signal<Thread[]>;

create · overload 1

create(metadata?: Record<string, unknown>): Promise<string | null>;

Parameters

metadata · optional
Record<string, unknown>

Returns

Promise<string | null>

delete · overload 1

delete(threadId: string): Promise<void>;

Parameters

threadId · required
string

Returns

Promise<void>

getThread · overload 1

Fetch a single thread by id. Returns null when the server returns 404 (thread doesn't exist) so callers can distinguish "missing" from "couldn't reach the server" — genuine network errors rethrow. Used by URL-based thread routing to validate a pasted/shared thread id before activating it.

getThread(threadId: string): Promise<Thread | null>;

Parameters

threadId · required
string

Returns

Promise<Thread | null>

moveToProject · overload 1

moveToProject(threadId: string, projectId: string | null): Promise<void>;

Parameters

threadId · required
string
projectId · required
string | null

Returns

Promise<void>

pin · overload 1

pin(threadId: string): Promise<void>;

Parameters

threadId · required
string

Returns

Promise<void>

refresh · overload 1

Fetch the latest thread list from the server. Failures are logged via console.error (not swallowed silently — silent catches have masked prod issues in the past).

Invocation and resolution are logged at console.debug so prod inspection can distinguish "never called" from "called but resolved empty" from "called and threw." This was prompted by a demo.threadplane.ai cold-load bug where the sidenav stayed empty with no visible signal. Tighten the log volume if it becomes noisy.

refresh(): Promise<void>;

Returns

Promise<void>

rename · overload 1

rename(threadId: string, newTitle: string): Promise<void>;

Parameters

threadId · required
string
newTitle · required
string

Returns

Promise<void>

reorderPinned · overload 1

Re-stamp metadata.pinnedOrder = 0,1,2,... for the pinned slice to reflect the new ordering.

reorderPinned(threadId: string, beforeId: string | null): Promise<void>;

Parameters

threadId · required
string
beforeId · required
string | null

Returns

Promise<void>

threads

Active (non-archived) threads, sorted with pinned first.

readonly threads: Signal<Thread[]>;

unarchive · overload 1

unarchive(threadId: string): Promise<void>;

Parameters

threadId · required
string

Returns

Promise<void>

unpin · overload 1

unpin(threadId: string): Promise<void>;

Parameters

threadId · required
string

Returns

Promise<void>