Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions plugins/agentation/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,10 +277,7 @@
streams.delete(controller);
}

// Responses are built through the Hono context rather than `new Response`:
// the host checks `instanceof Response` against its own realm, and only the
// context's constructor is guaranteed to be the same one.
bb.http.route("GET", "/events", (c) => {
bb.http.route("GET", "/events", () => {
let self: ReadableStreamDefaultController<Uint8Array> | null = null;
const stream = new ReadableStream<Uint8Array>({
start(controller) {
Expand Down Expand Up @@ -308,7 +305,7 @@
},
});

return c.newResponse(stream, {
return new Response(stream, {
headers: {
"content-type": "text/event-stream",
"cache-control": "no-cache, no-transform",
Expand Down Expand Up @@ -845,7 +842,7 @@
const done = () => {
clearTimeout(timer);
signal?.removeEventListener("abort", done);
resolve();

Check warning on line 845 in plugins/agentation/server.ts

View workflow job for this annotation

GitHub Actions / Verify (Static)

promise(no-multiple-resolved)

plugins/agentation/server.ts:845:9: Promise should not be resolved multiple times. Promise is already resolved on line 843.
};
const timer = setTimeout(done, ms);
signal?.addEventListener("abort", done, { once: true });
Expand All @@ -868,7 +865,7 @@
clearTimeout(timer);
watchers.delete(wake);
signal?.removeEventListener("abort", onAbort);
resolve(value);

Check warning on line 868 in plugins/agentation/server.ts

View workflow job for this annotation

GitHub Actions / Verify (Static)

promise(no-multiple-resolved)

plugins/agentation/server.ts:868:9: Promise should not be resolved multiple times. Promise is already resolved on line 865.
};
const wake = () => {
if (test()) finish(true);
Expand Down
Loading