feat: mature gateway webui api surfaces#1439
Open
chumyin wants to merge 1 commit into
Open
Conversation
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
Loong's gateway already exposed useful HTTP surfaces, but third-party WebUI integration was still incomplete. Operators could talk to
/v1/chat/completions,/v1/models, and/v1/turn, yet the gateway still lacked a persisted Responses-style continuity surface and had rough streaming-compatibility edges.Operators want to connect Loong to their own browser frontends or OpenAI-compatible chat UIs without building a custom bridge around the runtime first.
Added a persisted gateway Responses surface, completed fetch/delete response endpoints, taught chat-completions streaming to degrade gracefully on non-streaming providers, wired request-level tool-view overrides into turn execution, and documented the trusted WebUI contract.
Caller-supplied
toolsremain limited to Loong's structured gateway tool layer. Direct runtime tools are still governed by Loong's own runtime surface rather than arbitrary client-declared tool contracts.Linked Issues
Change Type
Touched Areas
Risk Track
If Track B, fill these in:
This changes the public gateway contract for WebUI clients and threads request-level tool settings into the turn-runtime seam.
The new contract is covered by focused gateway tests and keeps direct runtime tools behind Loong-controlled governance instead of opening arbitrary external tool contracts.
Revert this branch or disable use of
/v1/responsesand request-level tool fields on the client side; existing/v1/turnremains available as the native control surface.Validation
cargo fmt --all -- --checkcargo clippy --workspace --all-targets --all-features -- -D warningscargo test --workspace --lockedcargo test --workspace --all-features --lockedCommands and evidence:
User-visible / Operator-visible Changes
/v1/responseswith persisted response continuity.chat/completionsstreaming now degrades gracefully when the configured provider can complete turns but does not expose native token streaming.tool_choice="none"is accepted on the gateway-compatible request surface.Failure Recovery
Revert the commit series or stop advertising
/v1/responsesto clients and continue using/v1/chat/completionsor/v1/turn.Missing response persistence, continued responses losing history, gateway tool filters dropping the expected structured gateway tools, or streaming responses falling back to empty SSE bodies.
Reviewer Focus
crates/app/src/agent_runtime.rs,crates/app/src/chat.rs, andcrates/app/src/conversation/runtime.rs.crates/daemon/src/gateway/openai_compat.rs,openai_responses.rs,openai_tooling.rs, andresponse_store.rs.site/use-loong/gateway-webui.mdxto confirm the stated boundary around structured gateway tools vs direct runtime tools is the one we want to support.