-
Notifications
You must be signed in to change notification settings - Fork 1
Migrate Wandbox API from /api/compile.json to /api/compile.ndjson with streaming support #112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+142
−43
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
Co-authored-by: na-trium-144 <[email protected]>
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
my-code | b3f566e | Commit Preview URL Branch Preview URL |
Nov 18 2025, 11:09 AM |
Co-authored-by: na-trium-144 <[email protected]>
Co-authored-by: na-trium-144 <[email protected]>
Copilot
AI
changed the title
[WIP] Change API call to compile.ndjson endpoint
Migrate Wandbox API from /api/compile.json to /api/compile.ndjson
Nov 18, 2025
Contributor
|
@copilot あとから関数のインタフェースを変更しやすいように、APIのレスポンスをtext()でまとめて取得するのではなくresponse.bodyからストリームとして読み取って処理する実装にしてください。 export interface CompileResultWithOutput extends CompileResult {
output: ReplOutput[];
}に変更し、outputやerrorの種類によらず1つのarrayにレスポンスを受け取った順に保存するようにしてください |
- Use response.body stream instead of response.text() for better flexibility - Change CompileResultWithOutput to use single output array instead of separate arrays - Store outputs in the order they are received from the ndjson stream - Update cpp.ts to work with the new unified output structure Co-authored-by: na-trium-144 <[email protected]>
Contributor
Author
Copilot
AI
changed the title
Migrate Wandbox API from /api/compile.json to /api/compile.ndjson
Migrate Wandbox API from /api/compile.json to /api/compile.ndjson with streaming support
Nov 18, 2025
na-trium-144
approved these changes
Nov 18, 2025
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.
Migrates the Wandbox compilation API from
/api/compile.json(batch response) to/api/compile.ndjson(streaming response). The function interface remains unchanged—results are still collected and returned after completion.Changes
CompileNdjsonResultinterface to represent individual ndjson response lines withtypeanddatafieldscompileAndRun()to consume ndjson stream usingresponse.body.getReader()for incremental processing with proper buffering for incomplete linesCompileResultWithOutputto use a singleoutput: ReplOutput[]array instead of separate arrays, storing responses in the order they are receivedcpp.tsto work with the new unified output structureImplementation
The stream reader processes chunks incrementally, buffering incomplete lines and parsing complete JSON objects as they arrive:
The merge logic accumulates streaming messages into both a
CompileResultand a unifiedoutputarray that preserves chronological order:This matches the Rust
merge_compile_resultimplementation in the wandbox repository (feline/src/util.rs) while providing better flexibility for future interface changes.Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.