Improve streaming by correctly detecting client disconnects

Externalize OpenAI and Anthropic SDKs and fix streaming logic by using `res.on("close")` instead of `req.on("close")` to accurately detect client disconnects and prevent premature loop termination.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: dcd090ca-935a-42ae-8db4-503e1bbe165a
Replit-Commit-Checkpoint-Type: full_checkpoint
Replit-Commit-Event-Id: e74b2f37-ad8b-469c-8d06-fdc381ac4a39
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/40608c50-a053-47e8-aa03-1bdcc1a2698b/dcd090ca-935a-42ae-8db4-503e1bbe165a/ZBSB1hW
Replit-Helium-Checkpoint-Created: true
This commit is contained in:
ThomasOrtiz3647
2026-04-26 14:34:43 +00:00
parent b91e2b70ab
commit 7a7f13f623
2 changed files with 14 additions and 12 deletions
+2
View File
@@ -29,6 +29,8 @@ async function buildAll() {
// - use path traversal to read files (e.g. @google-cloud/secret-manager loads sibling .proto files)
external: [
"*.node",
"openai",
"@anthropic-ai/sdk",
"sharp",
"better-sqlite3",
"sqlite3",