Skip to content

feat(langgraph): add a framework-neutral thread directory to the runtime - #1636

Queued
blove wants to merge 1 commit into
mainfrom
blove/langgraph-thread-directory
Queued

blove wants to merge 1 commit into
mainfrom
blove/langgraph-thread-directory

Conversation

@blove

@blove blove commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

What

Adds createThreadDirectory to the framework-neutral LangGraph runtime (libs/langgraph/src/runtime/thread-directory.ts): the saved conversations of a deployment as an observable list, with the commands a sidebar needs.

Angular has had this as LangGraphThreadsAdapter, an injectable built on signals. React had the views (ThreadList, ChatSidenavSections, the threads prop on Chat) but nothing to fill them from a deployment; every app had to write the SDK calls and the metadata mapping itself.

How it works

  • A store with getSnapshot and subscribe, so React observes it with the existing useAgent hook and it carries no framework dependency.
  • Entries are read from thread metadata using the same keys as the Angular adapter: title, archived, pinned, pinnedOrder, projectId. Active conversations come pinned-first in saved order; archived ones are listed apart.
  • create, delete, rename, archive, unarchive, pin, unpin, moveToProject and reorderPinned write metadata, then read the list again. Their names and arguments match React's ThreadActionAdapter, so the directory can be passed as actions.
  • Pass apiUrl (and optional clientOptions) to build a client, or threads to reuse an existing client.threads.

Differences from the Angular adapter

  • A failed read is published as status: 'error' with the failure and keeps the last list. The Angular adapter logs to the console and leaves no state to render.
  • A failed command rejects and does not re-read, so a list that shows the change optimistically can put the row back.
  • When two reads overlap, the later call's result is kept.
  • create rejects on failure; the Angular adapter resolves null.
  • reorderPinned with a target that is not pinned places the conversation last; the Angular adapter drops it from the renumbering.
  • No console logging.

Not in this PR

  • The directory is staged beside the private session and is not exported from a published entry; it becomes reachable when the runtime entry is published.
  • The Angular LangGraphThreadsAdapter is unchanged and is not rebuilt on this.
  • One page of limit conversations (default 50); no paging, search, or automatic refresh after a run.
  • No compile-time check that the directory satisfies React's ThreadActionAdapter: the boundary rules keep the two packages from importing each other. The shapes were compared by hand.

Verification

  • nx run-many -t runtime-quality,runtime-type-tests,lint,test,build -p langgraph passes (runtime suite 58 files, 1064 tests; 14 new).
  • Mutation check: removing the overlap guard, the pinned sort and the 404/422 handling fails 5 of the 14 new tests.
  • verify-boundaries.mjs passes; inventory.mjs --check reports no missing disposition.
  • Not run to completion locally: node --test scripts/react-parity/*.spec.mjs (stopped after ten minutes) and verify-langgraph-candidate.mjs. The new file is not imported by create-session.ts, so the candidate's reviewed module graph is unchanged.
  • Not exercised against a live deployment or in a browser.

🤖 Generated with Claude Code

@blove
blove enabled auto-merge November 17, 2026 19:30
@blove
blove added this pull request to the merge queue Nov 17, 2026
Any commits made after this event will not be merged.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant