devbonzai 2.1.5 → 2.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "devbonzai",
3
- "version": "2.1.5",
3
+ "version": "2.1.6",
4
4
  "description": "Quickly set up a local file server in any repository for browser-based file access",
5
5
  "main": "cli.js",
6
6
  "bin": {
@@ -1709,15 +1709,15 @@ app.post('/prompt_agent_stream', (req, res) => {
1709
1709
  }
1710
1710
 
1711
1711
  // Always try to send complete event when process finishes
1712
- // Only skip if we've already sent it
1712
+ // Check actual response stream state rather than relying on responseSent flag
1713
+ // Only skip if we've already sent it (responseSent flag prevents duplicates)
1713
1714
  if (!responseSent) {
1714
1715
  try {
1715
- // Check if response is still writable - try to send even if clientDisconnected flag is set
1716
- // because the response stream might still be open
1716
+ // Check if response is still writable - check actual stream state
1717
1717
  if (res.destroyed || res.closed) {
1718
1718
  console.log('⚠️ [prompt_agent_stream] Response already closed, cannot send complete event');
1719
1719
  } else {
1720
- responseSent = true;
1720
+ // Send events and only set flag after successful send
1721
1721
  sendEvent('complete', {
1722
1722
  code,
1723
1723
  stdout,
@@ -1729,6 +1729,7 @@ app.post('/prompt_agent_stream', (req, res) => {
1729
1729
  // Send stop event after complete
1730
1730
  sendEvent('stop', {});
1731
1731
  res.end();
1732
+ responseSent = true;
1732
1733
  console.log('✅ [prompt_agent_stream] Sent complete and stop events');
1733
1734
  }
1734
1735
  } catch (e) {
@@ -1745,8 +1746,7 @@ app.post('/prompt_agent_stream', (req, res) => {
1745
1746
  req.on('close', () => {
1746
1747
  console.log('🔵 [prompt_agent_stream] Client disconnected (process continues in background)');
1747
1748
  // Don't kill the process - let it complete
1748
- // Just mark that we shouldn't try to send more events
1749
- responseSent = true;
1749
+ // Don't set responseSent here - let proc.on('close') check actual stream state
1750
1750
  });
1751
1751
  });
1752
1752