Repository navigation
fix: WS chat binary resolution + Buffer handling + error detail - #19
Merged
Merged
Conversation
Without --verbose, fusion-code -p --output-format=stream-json exits with error: 'When using --print, --output-format=stream-json requires --verbose' This caused /ws/chat to return chat_done immediately with zero tokens. Fixes #17 🤖 Generated with [Claude Code](https://claude.com/claude-code)
- findFusionCodeBinary: add process.execPath + cwd candidates (compiled binary can't resolve via import.meta.dir) - WS message handler: handle Buffer messages via TextDecoder - WS error: expose actual parse error instead of generic 'Invalid JSON' - Test: update assertion for new error message format 🤖 Generated with [Claude Code](https://claude.com/claude-code)
dahai80
added a commit
that referenced
this pull request
Aug 28, 2026
…ate helper (audit §1.1.1 slice #19) (#189) Extract the 37-LOC onCompactProgress switch (REPL getToolUseContext, 5 CompactProgressEvent cases routing 3 spinner setters) into a pure routing helper src/utils/compactProgressState.ts. No React hooks, no JSX, no async; only side effect = call 3 spinner setters, matching the original useCallback body verbatim (including \u2026 ellipsis escapes and COMPACT_STALL_HINT_MS threshold gate). REPL keeps a thin onCompactProgress wrapper passing the closure-captured spinner setters + COMPACT_STALL_HINT_MS; the getToolUseContext useCallback deps array is unchanged (spinner setters + const are stable refs/values, not in deps). Downstream reads the same ProcessUserInputContext.onCompactProgress field = byte-identical. formatDuration import dropped from REPL (now only used by the helper); CompactProgressEvent type added to the Tool.ts import. - REPL 6415 -> 6386 (-29 net; 10 insertions / 39 deletions) - New helper: src/utils/compactProgressState.ts (applyOnCompactProgress) - New test: src/__tests__/utils/compactProgressState.test.ts (9 tests, 19 assertions: all 5 event types, stall threshold boundary, configurable hint, compact_end null-clears) - Gates: typecheck 0 / 896 tests pass / biome clean / build:dev ok Co-authored-by: Claude Fable 5 <[email protected]>
dahai80
added a commit
that referenced
this pull request
Aug 29, 2026
…ice #25) (#195) 从 REPL.tsx onQueryImpl apiMetrics capture 子块 (L3300-3337, 38 LOC) 抽出到 src/utils/apiMetricsCapture.ts 的 captureApiMetrics() helper。 PURE-ROUTING SUB-BLOCK class (像 slice #19 onCompactProgress): - 行为等价,无 React hooks/JSX/await。 - helper 直接 import 9 module symbols (6 getTurn* timing fn / median / isInternalBuild / createApiMetricsMessage / getGlobalConfigWriteCount); ctx 携带 3 REPL 闭包依赖 (apiMetricsRef + loadingStartTimeRef + setMessages)。 - guard 移入 helper (isInternalBuild() && length>0),REPL 保留薄调用。 REPL 清理 8 个 sole-user import (6 getTurn* + getGlobalConfigWriteCount + createApiMetricsMessage),isInternalBuild(18 用)/median(6 用) 保留。 LOC: REPL 6215→6172 (−43),cumulative −881→−924。 4 gates: typecheck 0 / 914 pass / biome clean(new) / build:dev 3781 mods。 Co-authored-by: Claude Fable 5 <[email protected]>
dahai80
added a commit
that referenced
this pull request
Aug 29, 2026
….1.1 slice #30) (#201) Extract REPL onQueryEvent → handleMessageFromStream first callback (L2954-3016, 62-LOC message-dispatch sub-block) into src/utils/streamMessageDispatch.ts as createStreamMessageDispatch(ctx) factory returning the (newMessage) => void callback. Routes incoming streamed message to the right setMessages mutation: - compact-boundary → replace (or append in fullscreen) + bump conversationId - ephemeral tool-progress tick → replace last same-tool tick (no array blowup) - otherwise → append Plus proactive context-block toggle on API errors / success. Pure-routing sub-block extraction class (proven via slices #19/#25-#29): reads only setters + module helpers, no React hooks, no closures over REPL state beyond the explicitly-passed ctx. ~9 deps via ctx object vs the parent onQueryEvent's 15+ — manageable, avoids the getToolUseContext factory ctx-reconstruct risk (lesson #18). REPL 6034 → 5976 (-58 net). Byte-identical behavior: factory passes the same setMessages/setConversationId/proactiveModule the inline closure captured. Removed now-unused isEphemeralToolProgress import (import-cleanup lesson #22); isCompactBoundaryMessage kept (still used at L3073). Gates: typecheck 0 / 921 tests pass / biome exit 0 / build:dev pass. Co-authored-by: Claude Fable 5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The WebSocket
/ws/chatendpoint spawnsfusion-code -p "..." --output-format=stream-jsonbut the CLI requires--verbosewhen using--output-format=stream-jsonwith-p. Without it, the CLI exits immediately with:This causes
/ws/chatto returnchat_doneimmediately with zerochat_eventtokens.Fix
Add
--verboseto the spawn args inhandleChatStream().Testing
Before fix: WebSocket
/ws/chatreturns onlychat_donewith no content.After fix: (needs verification with MLX backend)
Fixes #17
🤖 Generated with Claude Code