Skip to content

feat: httpStream - #2841

Open
RohitKushvaha01 wants to merge 8 commits into
Acode-Foundation:mainfrom
RohitKushvaha01:feat/system-http-stream
Open

feat: httpStream#2841
RohitKushvaha01 wants to merge 8 commits into
Acode-Foundation:mainfrom
RohitKushvaha01:feat/system-http-stream

Conversation

@RohitKushvaha01

@RohitKushvaha01 RohitKushvaha01 commented Aug 31, 2026

Copy link
Copy Markdown
Member

Closes #2827

const res = await system.httpStream("https://httpbin.org/stream/5");
const reader = res.body.getReader();
const dec = new TextDecoder();
while (true) {
  const { done, value } = await reader.read(); // value: Uint8Array
  if (done) break;
  const chunk = dec.decode(value, { stream: true });
  console.log(chunk);
}

@greptile-apps

greptile-apps Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR adds an Android-backed system.httpStream API that exposes HTTP response bodies as WHATWG ReadableStream instances.

  • Adds native request execution, bounded chunk sizing, flow-control acknowledgements, cancellation, and teardown handling.
  • Adds the JavaScript and TypeScript APIs for streamed responses and abort signals.
  • Adds unit coverage for streaming, backpressure, errors, cancellation, headers, and binary transport.

Confidence Score: 5/5

The PR appears safe to merge because no blocking failure remains from the previously reported resource-allocation issues.

No blocking failure remains.

Important Files Changed

Filename Overview
src/plugins/system/android/com/foxdebug/system/StreamHttp.java Implements native HTTP streaming with capped chunk allocation, a 50-stream admission limit, credit-based flow control, cancellation, and cleanup.
src/plugins/system/android/com/foxdebug/system/System.java Registers stream start, acknowledgement, and cancellation actions and cancels active streams during plugin teardown.
src/plugins/system/www/plugin.js Exposes HTTP responses as ReadableStreams and coordinates native backpressure, cancellation, abort signals, headers, and byte decoding.
tests/unit/systemHttpStream.test.js Covers incremental delivery, bounded in-flight data, transport failures, HTTP errors, cancellation, repeated headers, and binary encoding paths.

Sequence Diagram

sequenceDiagram
  participant App
  participant JS as system.httpStream
  participant Native as StreamHttp
  participant Server
  App->>JS: httpStream(url, options)
  JS->>Native: http-stream-start
  Native->>Server: Open HTTP connection
  Server-->>Native: Status and headers
  Native-->>JS: headers event
  JS-->>App: Response
  loop Response chunks
    Server-->>Native: bytes
    Native-->>JS: data event
    JS-->>App: Uint8Array
    JS->>Native: http-stream-ack
  end
  Native-->>JS: complete
  JS-->>App: Close ReadableStream
Loading

Reviews (5): Last reviewed commit: "reduced overhead" | Re-trigger Greptile

Comment thread src/plugins/system/android/com/foxdebug/system/StreamHttp.java Outdated
@RohitKushvaha01
RohitKushvaha01 marked this pull request as draft August 31, 2026 08:10
@RohitKushvaha01

This comment has been minimized.

Comment thread src/plugins/system/android/com/foxdebug/system/StreamHttp.java
@RohitKushvaha01

This comment has been minimized.

@RohitKushvaha01
RohitKushvaha01 marked this pull request as ready for review September 1, 2026 11:25
@RohitKushvaha01

This comment has been minimized.

@RohitKushvaha01

Copy link
Copy Markdown
Member Author

@bajrangCoder check now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs enhancement New feature or request

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

Native HTTP: stream response bodies so plugins can consume SSE / fetch() ReadableStream

1 participant