Skip to content

feat: expose standalone SDK runtime transport - #713

Merged
danny-avila merged 2 commits into
mainfrom
danny-avila/standalone-runtime
Nov 18, 2026
Merged

danny-avila merged 2 commits into
mainfrom
danny-avila/standalone-runtime

Conversation

@danny-avila

Copy link
Copy Markdown
Collaborator

Summary

External SDK workers currently import @librechat/api/sdk, which is not published. They cannot install and run independently of a LibreChat checkout.

Expose the existing runtime bridge as the Node-only @librechat/agents/runtime subpath, with CommonJS, ESM, and TypeScript exports. It includes the worker server, host client, authenticated identities, bounded WebSocket RPC, checkpoint/approval reconstruction, encrypted host model/policy/file channels, host tools, and optional durable recovery journal. Core SDK imports do not re-export the transport.

LibreChat host adapters → existing wire protocol → @librechat/agents/runtime → custom SDK graph

The transport comes from LibreChat's current dev implementation at e50a30653cd439b404432ecfc3efc41ddcedc236 (LibreChat-AI/LibreChat#18419). Host-specific model policy callbacks, registration, storage authorization, and billing stay with LibreChat; the SDK accepts their service contracts. The wire protocol and its fail-closed capability checks are unchanged.

Clean consumer installation also exposed two packaging defects: broad Langfuse peers selected an incompatible OpenTelemetry exporter, and emitted declarations retained workspace-only aliases. Declare compatible tracing dependencies and resolve declaration aliases during the build. Negative type assertions verify that installed runtime contracts retain their types.

Validation

  • 304 focused runtime and tracing tests; 27 entry-point, dependency-graph, and workflow checks.
  • TypeScript no-emit check, production build, runtime lint with zero warnings, and zero production audit vulnerabilities.
  • CI now packs the package, installs it in a fresh temporary project without workspace links or @librechat/api, checks ESM/bundler and CommonJS/Node TypeScript consumers, and runs an ESM host against a separate CJS worker. Exercises a custom StateGraph, streamed events, approval/reconstruction, host model invocation, cancellation, identity rejection, and graceful shutdown.
  • Manual mixed-version acceptance: unmodified LibreChat host with the independently installed SDK worker passed five Chrome flows: custom graph approval after worker restart, reconnect/cancel, minimal graph, native attachment reads, and Redis transport recovery. The inverse pairing (new SDK host, existing LibreChat worker) also passed the package execution scenarios. Model responses were deterministic; no live provider or deployed environment was used.

Release boundary

No version bump or npm publication in this PR. A separate SDK release follows merge. LibreChat can then replace its transport implementation with these exports; existing hosts already interoperate with the packaged worker. This changes packaging and ownership, not the previously supported feature set.

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review the current PR head df9464f. Confirm that this exact commit is the reviewed commit and ignore findings that apply only to earlier heads. Focus on the standalone package boundary, CJS/ESM loading and consumer types, parity with the existing LibreChat wire transport, identity/policy enforcement, recovery, and cancellation cleanup.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-18T17:46:06.187902Z 6dc7a49 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Copy link
Copy Markdown
Collaborator Author

Additional migration acceptance at df9464f: installed this built SDK into a disposable LibreChat dev checkout and temporarily routed its client/server entry points through @librechat/agents/runtime. All 75 existing bridge, native model-admission, and builder-policy tests passed. Restored the temporary host changes afterward. Together with the five browser flows and both mixed-version pairings, this verifies the packaged transport against the existing native policy integration. All 14 CI checks are now green; the full npm audit (including development dependencies) reports zero vulnerabilities.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: df9464f7c7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

Comment thread src/runtime/client.ts Resolved
Comment thread src/runtime/client.ts Resolved
Comment thread src/runtime/client.ts Resolved
Comment thread src/runtime/server.ts Resolved
Comment thread src/runtime/server.ts Resolved

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review the current PR head 6dc7a49. Confirm that the review applies to this commit. The follow-up addresses approval resume indices and terminal content, consumed one-shot matchers, subagent type matching, and worker forwarding deadlines. Please check regression coverage and compatibility with the existing wire protocol.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: 6dc7a490f1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

@danny-avila
danny-avila merged commit 20b1fad into main Nov 18, 2026
14 checks passed
@danny-avila danny-avila mentioned this pull request Nov 18, 2026
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