feat(langgraph): hoist threads adapter + Client helper out of demos#488
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
The same SDK-backed ThreadsService has been duplicated across consumers
(canonical demo, c-threads cap, future caps). Hoist it into @ngaf/langgraph
so one implementation serves them all.
What's exported:
- createLangGraphClient(apiUrl) — wraps `new Client({ apiUrl })` with
the absolute-URL rewrite (`/api` → `window.location.origin + /api`)
the SDK requires. Single source of truth — fetch-stream.transport
now goes through it instead of inlining the same workaround.
- LangGraphThreadsAdapter — Angular service wrapping
client.threads.search/create/delete/rename/update with the SDK→Thread
mapping. Configurable via LANGGRAPH_THREADS_CONFIG which titleMetadataKey
to read ('title' for the demo, 'thread_title' for c-threads — spec
2026-05-19-llm-generated-labels-design). Pin/archive/projects/sort
supported. Failures log to console.error (no more silent catches —
that's been hiding prod issues; see PR #486).
- refreshOnRunEnd(agent, fn) — collapses the
`lastStatus = ...; effect(...)` snippet both consumers duplicated for
"refresh threads when a run finishes" into one line.
Converts examples/chat to consume the adapter directly via
inject(LangGraphThreadsAdapter), drops the local 138-line
shell/threads.service.ts. c-threads' adapter conversion lands in a
follow-up (waiting on #481 merge).
@ngaf/chat stays adapter-agnostic — no new LangChain dependency.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
PR #481 added a c-threads-local ThreadsService; this drops it in favor of the shared LangGraphThreadsAdapter (exported from @ngaf/langgraph in this same PR). Configures the adapter via LANGGRAPH_THREADS_CONFIG with titleMetadataKey: 'thread_title' to match the cap's Python graph. Inline run-end refresh effect collapses to refreshOnRunEnd(agent, fn). c-threads is now the second consumer of the hoisted adapter — proves the per-cap titleMetadataKey config works (demo uses 'title', c-threads uses 'thread_title') without duplicating the SDK glue. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
e6d77e0 to
b1269ff
Compare
blove
added a commit
that referenced
this pull request
May 20, 2026
PR #488 already replaced the silent catch with console.error; that half of the original debug PR is done. This adds the complementary console.debug calls on invoke + resolve so prod inspection can distinguish "never called" from "called but resolved empty" from "called and threw." Targets the demo.threadplane.ai cold-load bug where the sidenav stays empty with no visible signal. After this lands, redeploy + reload the demo + check the console: presence/absence of '[...] invoked' tells us whether the effect even fires. Tighten the log volume if it becomes noisy. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
3 tasks
blove
added a commit
that referenced
this pull request
May 20, 2026
…h() (#486) * debug(langgraph): add console.debug to LangGraphThreadsAdapter.refresh() PR #488 already replaced the silent catch with console.error; that half of the original debug PR is done. This adds the complementary console.debug calls on invoke + resolve so prod inspection can distinguish "never called" from "called but resolved empty" from "called and threw." Targets the demo.threadplane.ai cold-load bug where the sidenav stays empty with no visible signal. After this lands, redeploy + reload the demo + check the console: presence/absence of '[...] invoked' tells us whether the effect even fires. Tighten the log volume if it becomes noisy. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * chore(docs): regenerate api docs --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
createLangGraphClient(apiUrl)— wrapsnew Client({ apiUrl })with the absolute-URL rewrite (/api→window.location.origin + /api) the SDK requires. Single source of truth.fetch-stream.transport.tsgoes through it now instead of inlining the same workaround.LangGraphThreadsAdapter— Angular service wrappingclient.threads.search/create/delete/rename/updatewith the SDK→Threadmapping. Configurable viaLANGGRAPH_THREADS_CONFIG.titleMetadataKeyso the demo ('title') and c-threads ('thread_title') can both share one implementation.refreshOnRunEnd(agent, fn)— collapses thelastStatus = ...; effect(...)snippet both consumers duplicate for "refresh threads when a run finishes" into one line.shell/threads.service.tsAND c-threads' 89-lineapp/threads.service.ts(added 2 hours earlier in feat(c-threads): real SDK-backed threads + inline title generation #481). c-threads is the second consumer of the hoisted adapter — proves the per-captitleMetadataKeyconfig works.Constraints honored
@ngaf/chatdoes not gain a@langchain/langgraph-sdkdep —cat libs/chat/package.jsonto verify. The adapter lives in@ngaf/langgraph(already has the SDK peer dep).console.error(the silent-catch pattern has been hiding prod issues — see PR debug(langgraph): add console.debug to LangGraphThreadsAdapter.refresh() #486).Test plan
libs/langgraph/src/lib/threads/threads-adapter.spec.ts)@ngaf/langgraphtest suite green (166 tests)nx build langgraphgreennx build examples-chat-angulargreennx build cockpit-chat-threads-angulargreenFollow-ups (not this PR)
metadata.title(matching the demo) instead ofmetadata.thread_title, then drop the per-consumertitleMetadataKeyconfig and default to'title'.🤖 Generated with Claude Code