snow-flow 10.0.128 → 10.0.130
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 +1 -1
- package/src/cli/cmd/tui/app.tsx +30 -6
package/package.json
CHANGED
package/src/cli/cmd/tui/app.tsx
CHANGED
|
@@ -116,15 +116,20 @@ export function tui(input: {
|
|
|
116
116
|
}) {
|
|
117
117
|
_onUpgrade = input.onUpgrade
|
|
118
118
|
const skipThemeDetection = !!process.env.OPENCODE_SKIP_THEME_DETECTION || !!process.env.OPENCODE_REMOTE_TUI
|
|
119
|
+
// In hosted mode, use stderr for pre-render logs to keep terminal clean for the renderer
|
|
120
|
+
const forceThread = !!process.env.OTUI_FORCE_THREAD
|
|
121
|
+
const log = forceThread
|
|
122
|
+
? (msg: string) => process.stderr.write(`${msg}\n`)
|
|
123
|
+
: (msg: string) => console.log(msg)
|
|
119
124
|
// promise to prevent immediate exit
|
|
120
125
|
return new Promise<void>(async (resolve) => {
|
|
121
126
|
let mode: "dark" | "light" = "dark"
|
|
122
127
|
if (skipThemeDetection) {
|
|
123
|
-
|
|
128
|
+
log("[snow-flow] skipping theme detection")
|
|
124
129
|
} else {
|
|
125
|
-
|
|
130
|
+
log("[snow-flow] detecting theme...")
|
|
126
131
|
mode = await getTerminalBackgroundColor()
|
|
127
|
-
|
|
132
|
+
log(`[snow-flow] theme: ${mode}`)
|
|
128
133
|
}
|
|
129
134
|
const onExit = async () => {
|
|
130
135
|
await input.onExit?.()
|
|
@@ -148,13 +153,13 @@ export function tui(input: {
|
|
|
148
153
|
|
|
149
154
|
// On Linux, @opentui disables Zig renderer threading which prevents PTY output.
|
|
150
155
|
// OTUI_FORCE_THREAD=1 temporarily spoofs platform so @opentui keeps threading enabled.
|
|
151
|
-
if (
|
|
152
|
-
|
|
156
|
+
if (forceThread) {
|
|
157
|
+
log("[snow-flow] forcing renderer threading (OTUI_FORCE_THREAD)")
|
|
153
158
|
Object.defineProperty(process, "platform", { value: "darwin", configurable: true })
|
|
154
159
|
}
|
|
155
160
|
|
|
156
161
|
try {
|
|
157
|
-
|
|
162
|
+
log("[snow-flow] starting tui...")
|
|
158
163
|
await render(
|
|
159
164
|
() => {
|
|
160
165
|
return (
|
|
@@ -182,6 +187,7 @@ export function tui(input: {
|
|
|
182
187
|
<FrecencyProvider>
|
|
183
188
|
<PromptHistoryProvider>
|
|
184
189
|
<PromptRefProvider>
|
|
190
|
+
<HostedRendererDiag />
|
|
185
191
|
<App />
|
|
186
192
|
</PromptRefProvider>
|
|
187
193
|
</PromptHistoryProvider>
|
|
@@ -212,6 +218,24 @@ export function tui(input: {
|
|
|
212
218
|
})
|
|
213
219
|
}
|
|
214
220
|
|
|
221
|
+
function HostedRendererDiag() {
|
|
222
|
+
if (!process.env.OTUI_FORCE_THREAD) return null
|
|
223
|
+
const renderer = useRenderer()
|
|
224
|
+
onMount(() => {
|
|
225
|
+
const r = renderer as any
|
|
226
|
+
|
|
227
|
+
// Clear screen to remove console.log messages, then start render loop
|
|
228
|
+
if (!r._isRunning) {
|
|
229
|
+
const realWrite = r.realStdoutWrite
|
|
230
|
+
if (realWrite) {
|
|
231
|
+
realWrite.call(r.stdout, "\x1b[2J\x1b[H")
|
|
232
|
+
}
|
|
233
|
+
r.start()
|
|
234
|
+
}
|
|
235
|
+
})
|
|
236
|
+
return null
|
|
237
|
+
}
|
|
238
|
+
|
|
215
239
|
function App() {
|
|
216
240
|
const route = useRoute()
|
|
217
241
|
const dimensions = useTerminalDimensions()
|