Repository navigation
🚰 refactor: Move the Pure Stream Code into the @librechat/chat Core - #16979
Merged
Merged
Conversation
The step appliers, frame normalizer and SSE transport move from client/src/hooks/SSE into packages/chat/src/core with their specs, and the client imports them from @librechat/chat. The ask-user-question predicates the content applier reads move with them, and the client's approval module re-exports them so its consumers are unchanged.
berry-13
force-pushed
the
berry-13/chat-stream-core
branch
from
October 10, 2026 23:13
f14b30c to
2ed7c6c
Compare
berry-13
marked this pull request as ready for review
October 11, 2026 16:07
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. |
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
The stream code that turns server frames into message content is pure TypeScript, yet it lives in
client/src/hooks/SSE, so another host cannot reuse it and nothing stops it from picking up app imports. This is link 5 of the@librechat/chatstack: the step appliers (steps/*),normalizeFrame(transport/frames.ts) and the SSE transport (transport/sse.ts) move withgit mvinto the package core, together with their four specs, and the client imports them from@librechat/chat. This is the first link where the client depends on the package, so the client build, its jest mapping, the lockfile and the CI jobs that typecheck, test or build the client now build or download the package's dist; the Dockerfiles already build it before the client.The content applier read two ask-user-question predicates from
~/utils/approval. They move tocore/ask.tswith the answered-actions set they read, andutils/approval.tsre-exports them, so its consumers are unchanged. Behavior is unchanged: the moved files differ only in that import and one return type the package'sisolatedDeclarationsrequires.Open PRs #16508 (
steps/content.ts,steps/tools.ts,steps.spec.ts) and #16092 (useStepHandler.tsimports) will need to follow the rename topackages/chat/src/core.Type of change
Testing
Tested environments/configuration:
npm cifrom the public registry, full turbo build including the clientAutomated tests:
packages/chat:tsc --noEmitclean, jest 88 of 88 under the node environment, including the movedframes,sse,stepsandtransportspecs unchangedclient:src/hooks/SSE12 suites, 423 tests (useStepHandler,useResumableSSE,useResumeOnLoadamong them), resolving@librechat/chatfrompackages/chat/dist; related tests ofutils/approval.tsandChatTransportContext.tsx, 549 suites;tsc --noEmitcleanchat-package.spec.tsthat resolves@librechat/chatfrom the client workspace todist/index.cjsand loads the stream API through CJS and ESM with every UI module blocked; thestep-reducer,tool-stepsandchat-facade-transportmock scenarios stream through the built clientnpm run build: the client bundle builds against the package distScreenshots / recordings
No user-facing change.
Risk / compatibility
sse.jsbecomes a dependency of the package; the client keeps its own entry becauseuseSubagentActivityStreamimports it directly. The package's lint block gains the_-prefix convention for unused names that the moved specs used under the client config. The lockfile only records the two new dependency edges.Checklist