Repository navigation
🪶 feat: Add Light Decisions and Rerank Subpath Exports - #623
Draft
danny-avila wants to merge 2 commits into
Draft
danny-avila wants to merge 2 commits into
danny-avila wants to merge 2 commits into
Conversation
Expose @librechat/agents/decisions and @librechat/agents/rerank as built entries that load no third-party package. The System One reranker now imports decision leaf modules instead of the barrel that pulls LangChain through the structured-chat adapter. The root entry still exports everything.
Load the built decisions and rerank subpaths through the package exports map in a fresh process for ESM and CJS, record every resolution with a module hook, and fail when any non-built-in package is reached or a declaration import leaves the package. CI runs it after the circular dependency check.
This was referenced Oct 19, 2026
Collaborator
Author
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. 🎉 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
This branch has not been deployed
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.
What this unblocks
Importing anything from
@librechat/agentstoday loads the root barrel. That barrel pulls in LangChain and the provider SDKs, even when the caller only wants the HTTP decision model or the System One reranker.src/rerank/systemone.tsalso imported@/decisions, and that barrel reaches LangChain through the structured-chat adapter. So even a deep import of the reranker loaded about 289 modules.This blocks two consumers:
What changes
The package gains two entry points. Neither loads a third-party package at runtime.
@librechat/agents/decisionscreateHttpDecisionModel,parseEnvelope,toWireQuestion/readAnswer,createTransport/failureForStatus/retryAfterMs,withDecisionDeadline@librechat/agents/rerankRerankertypes,createSystemOneRerankerThe root entry still exports everything it exported before.
failureForStatus,retryAfterMsandwithDecisionDeadlineare now exported too, because hosts that build their own retry or breaker layer need the SDK's own status mapping.createStructuredChatDecisionModelbinds a LangChain chat model, andcreateWebSearchRerankerextends the search tool's reranker. Both stay on the root entry only.How it was tested
npm run test:light-entries(new,node --test). For each subpath it starts a fresh process, loads the built ESM and CJS outputs through the packageexportsmap, and records every module resolution with a loader hook. The test fails if any non-built-in package is reached, if a declaration import resolves outside the package, or if the manifest'sexports,typesVersionsor build entries fall out of sync. A control case checks that the probe does catch@langchain/coreon./langchain/messages. Result: 8/8 pass, with 8 modules for decisions and 5 for rerank. CI runs it in thevalidatejob after the circular-dependency check.src/rerank/systemone.tsfrommainand rebuilt. Both./rerank loads without third-party packagestests (esm and cjs) then fail. With the fix back in place, all 8 pass.npx jest src/decisions src/rerank: 5 suites, 135 tests pass.npx tsc --noEmitandnpx tsc -p tsconfig.build.jsonpass.npm run buildpasses.npm run check:circular-depspasses.Stack
This is the base of a 4-PR stack that lets codegraph depend on the SDK's decisions and rerank modules:
./decisionsand./reranksubpaths (basemain). This PR.quotafailure.The later PRs build on this branch and will be opened as drafts against it.