@tiens.nguyen/gonext-local-worker 1.0.49 → 1.0.50

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.
@@ -27,6 +27,11 @@ import sys
27
27
  import urllib.request
28
28
  import urllib.error
29
29
 
30
+ # Capture stdout before anything can redirect it. _emit() must always write
31
+ # to the real fd-1 so the Node worker's readline loop sees NDJSON even while
32
+ # contextlib.redirect_stdout(sys.stderr) is active inside agent.run().
33
+ _REAL_STDOUT = sys.stdout
34
+
30
35
 
31
36
  def _ssl_context():
32
37
  import ssl
@@ -152,9 +157,11 @@ def run_agent_chat(cfg):
152
157
 
153
158
 
154
159
  def _emit(obj):
155
- """Write one NDJSON line to stdout and flush immediately."""
156
- sys.stdout.write(json.dumps(obj) + "\n")
157
- sys.stdout.flush()
160
+ """Write one NDJSON line to the real stdout and flush immediately.
161
+ Uses _REAL_STDOUT (captured at import time) so redirect_stdout blocks
162
+ inside agent.run() don't accidentally route events to stderr."""
163
+ _REAL_STDOUT.write(json.dumps(obj) + "\n")
164
+ _REAL_STDOUT.flush()
158
165
 
159
166
 
160
167
  def main():
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiens.nguyen/gonext-local-worker",
3
- "version": "1.0.49",
3
+ "version": "1.0.50",
4
4
  "description": "Polls GoNext cloud API for async local LLM jobs and runs them against Ollama/OpenAI-compatible servers on this Mac",
5
5
  "type": "module",
6
6
  "license": "MIT",