snow-flow 10.0.131 → 10.0.133

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
  "$schema": "https://json.schemastore.org/package.json",
3
- "version": "10.0.131",
3
+ "version": "10.0.133",
4
4
  "name": "snow-flow",
5
5
  "description": "Snow-Flow - ServiceNow Multi-Agent Development Framework powered by AI",
6
6
  "license": "Elastic-2.0",
@@ -220,47 +220,23 @@ function HostedRendererDiag() {
220
220
  onMount(() => {
221
221
  const r = renderer as any
222
222
  const log = (msg: string) => process.stderr.write(`[sf-diag] ${msg}\n`)
223
- log(`useThread=${r._useThread} isRunning=${r._isRunning} state=${r._controlState}`)
224
- log(`platform=${process.platform} altScreen=${r._useAlternateScreen} termSetup=${r._terminalIsSetup}`)
225
-
226
- // On Linux, useThread=false means Zig render() buffers ANSI but doesn't write to fd 1.
227
- // Patch renderNative to manually flush the Zig stdout buffer after each render frame.
228
223
  const realWrite = r.realStdoutWrite
229
224
  const stdout = r.stdout
230
- if (realWrite && r.lib && r.rendererPtr) {
231
- const origRenderNative = r.renderNative.bind(r)
232
- r.renderNative = () => {
233
- origRenderNative()
234
- // Try to flush Zig's internal stdout buffer by calling writeOut with empty data
235
- try {
236
- r.lib.writeOut(r.rendererPtr, new Uint8Array(0).buffer, 0)
237
- } catch {}
238
- }
239
- log("patched renderNative with flush")
240
- }
241
225
 
242
- // Clear screen and start the render loop
243
- if (realWrite) {
244
- realWrite.call(stdout, "\x1b[2J\x1b[H")
245
- }
246
- if (!r._isRunning) {
247
- r.start()
248
- log(`started: isRunning=${r._isRunning} state=${r._controlState}`)
249
- }
226
+ log(`useThread=${r._useThread} isRunning=${r._isRunning}`)
250
227
 
251
- // After 3s, log state and try direct fd write test
252
- setTimeout(() => {
253
- log(`3s: isRunning=${r._isRunning} rendering=${r.rendering}`)
254
- // Direct write to fd 1 to verify terminal connectivity
255
- try {
256
- const fd1 = Bun.file("/dev/fd/1")
257
- Bun.write(fd1, "\x1b[5;1H\x1b[1;31m[sf-diag] FD1 WRITE TEST\x1b[0m\r\n").catch(() => {})
258
- } catch {}
259
- // Also try realStdoutWrite
260
- if (realWrite) {
261
- realWrite.call(stdout, "\x1b[7;1H\x1b[1;32m[sf-diag] REAL WRITE TEST\x1b[0m\r\n")
262
- }
263
- }, 3000)
228
+ // Clear screen for clean rendering
229
+ realWrite?.call(stdout, "\x1b[2J\x1b[H")
230
+
231
+ // Start the render loop (it doesn't auto-start on Linux)
232
+ if (!r._isRunning) r.start()
233
+
234
+ // Key fix: enable Zig output thread AFTER renderer is safely initialized.
235
+ // On Linux, @opentui creates the renderer with useThread=false.
236
+ // The setter calls lib.setUseThread(ptr, true) which starts the Zig
237
+ // thread that drains the render output buffer and writes to fd 1.
238
+ r.useThread = true
239
+ log(`after useThread=true: useThread=${r._useThread}`)
264
240
  })
265
241
  return null
266
242
  }