Commit Graph

574 Commits

Author SHA1 Message Date
Ma 51c326973b docs: drop "CLI" from README titles and tagline 2026-04-14 16:31:34 +08:00
Ma d7cacdaea4 docs: announce TUI general availability 2026-04-14 15:57:12 +08:00
Ma fccf819b45 docs: refresh WeChat group QR to v6 2026-04-14 15:57:03 +08:00
Ma c6e304f451 Merge branch 'pr-180-latest' into master 2026-04-13 18:01:05 +08:00
fanghanjun 3935a52df4 merge: resolve conflict with origin/master in project-tools.ts
Keep our try-catch for empty-content errors while incorporating
upstream's chat function structure.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 02:56:04 -07:00
Ma f230394315 fix(studio): expose fixed control truth files 2026-04-13 17:55:28 +08:00
Ma c86d62f463 Merge branch 'pr-180' into master 2026-04-13 17:51:49 +08:00
fanghanjun effcecc82d fix(core): only swallow empty-content errors in chat, re-throw others
The bare catch block silently swallowed all exceptions including
network errors, auth failures, and timeouts. Now only catches
errors related to empty content (thinking model edge case) and
re-throws everything else so users see real error messages.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 02:51:10 -07:00
Ma 64886c834c fix(tui): preserve chat failures in interaction mode 2026-04-13 17:48:39 +08:00
fanghanjun f617ca270b fix(tui): reduce markdown width to account for prefix and padding
Tables were overflowing the visible area because the width calculation
didn't account for the 2-char prefix (◆) in addition to paddingX.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 02:42:59 -07:00
fanghanjun e9acb515ca test(tui): adapt dashboard tests for removed UI elements
Update assertions for removed statusSecondaryLine, composer
status/helper lines, and layout changes (minWidth prefix).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 02:23:06 -07:00
fanghanjun 9f700b7e74 fix(tui): remove execSync theme detection, match main branch exactly
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 02:16:05 -07:00
fanghanjun 06c42e3eaf fix(tui): only use macOS system appearance for Terminal.app
Other terminals (Ghostty, kitty, etc.) have their own theme
independent of macOS appearance. Only fall back to AppleInterfaceStyle
for Terminal.app. All other terminals default to dark when COLORFGBG
is not set.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 02:15:03 -07:00
fanghanjun 8967967418 fix(tui): add macOS system appearance detection for Terminal.app
Terminal.app doesn't set $COLORFGBG. Fall back to macOS
AppleInterfaceStyle via execSync. All colors remain hex (no
16-color ANSI names that caused Terminal.app crashes).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 02:13:33 -07:00
fanghanjun 34182fb036 fix(tui): add light/dark theme via COLORFGBG without execSync
Detect terminal background via $COLORFGBG (env var only, no child
process). Use darker hex colors for light backgrounds so text is
readable. No 16-color ANSI names — all hex like the main branch.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 02:11:19 -07:00
fanghanjun 1936580f75 fix(tui): revert theme to main-branch colors to fix Terminal.app crash
Remove all Terminal.app color/theme workarounds (16-color palette,
execSync theme detection, light/dark palettes). Use the same static
hex colors as the main branch. Only keep isAppleTerminal for the
markdown rendering fallback.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 02:10:20 -07:00
fanghanjun 9714e9345a fix(tui): use Page Up/Down raw sequences for conversation scrolling
Shift+Arrow is not reliably detected by Ink's useInput. Use raw
escape sequences for Page Up (\x1b[5~) and Page Down (\x1b[6~)
which work across Terminal.app, iTerm2, and other terminals.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 02:00:18 -07:00
fanghanjun 1ee7b7b5f1 fix(tui): revert Terminal.app workarounds, use main-branch layout instead
The stdout write buffering, alternate screen, and maxFps throttle we
added were not fixing the Terminal.app crashes — the main branch
doesn't crash because it uses a simpler rendering path.

Root cause: the complex Box nesting (<Box minWidth={2}> + flexShrink)
and renderMarkdown processing generate more ANSI cursor-positioning
codes per frame, which triggers Terminal.app's CoreGraphics bug.

Fix: on Terminal.app, ConversationRow uses the same simple layout as
the main branch (<Box><Text>prefix</Text><Text>{content}</Text></Box>)
without renderMarkdown. Enhanced rendering (minWidth layout, markdown)
is only used on terminals that can handle it (iTerm2, etc.).

Also adds Shift+Up/Down scrolling for conversation history, and
reverts the Terminal.app light palette change.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 01:58:16 -07:00
fanghanjun 9c1388bbdd feat(tui): add conversation scroll with Shift+Up/Down
Add scrollOffset to the conversation area so users can scroll back
through message history. Shift+Up scrolls up 3 messages, Shift+Down
scrolls back down. Scroll resets to bottom on new message submit.

Also reverts the Terminal.app light palette color change (keep
original yellow/blue).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 01:53:49 -07:00
fanghanjun e80a41def7 fix(tui): only use alternate screen buffer on Terminal.app
The alternate screen disables terminal scrollback. Only enable it
on Terminal.app where it's needed to prevent IME XPC crashes.
Other terminals (iTerm2, etc.) keep native scrolling.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 01:49:46 -07:00
fanghanjun 76523568de fix(tui): use readable colors for Terminal.app light mode
ANSI "blue" renders as bright purple on light backgrounds.
Use "black" for AI reply text and "gray" for accents on
Terminal.app light mode.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 01:48:36 -07:00
fanghanjun 186fd25a81 fix(tui): restore table rendering on Terminal.app
Use marked-terminal for layout (tables, lists, indentation) on all
terminals, then strip ANSI escape codes for Terminal.app instead of
bypassing marked-terminal entirely. Box-drawing characters (┌─┐│└┘)
are plain Unicode and survive the strip.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 01:47:24 -07:00
fanghanjun 491e620530 fix(core): reset pending_hooks.md during import replay to prevent future state leak
resetImportReplayTruthFiles intentionally skipped pending_hooks.md,
but the architect's foundation output includes hooks from the full
imported text (e.g. chapter 60 hooks). When replay starts from
chapter 1, these future hooks leak into the context.

Reset pending_hooks.md to an empty table using the existing
buildImportReplayHooksSeed helper. The replay will incrementally
rebuild hooks from each chapter's analysis.

Fixes the pre-existing CI failure: "does not leak imported future
state into early replay chapters".

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 01:45:41 -07:00
fanghanjun 9e60c0588e fix(tui): use alternate screen buffer to isolate IME from rendering
Terminal.app crashes in IMKInputSession when the IME's NSRemoteView
XPC connection conflicts with Ink's screen redraws. Enter the
alternate screen buffer (DEC 1049) before rendering — this isolates
Ink to a separate terminal view so the IME interacts with the
primary screen without corruption. Same approach as Claude Code's
<AlternateScreen> component.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 01:39:01 -07:00
fanghanjun a8954a63ba fix(tui): remove default maxTokens from normal depth profile
The normal depth profile hardcoded maxTokens: 240, which was always
passed to the chat LLM call via getChatRequestOptions. This defeated
the "only pass maxTokens when /depth is explicitly set" fix in
project-tools.ts — thinking models like kimi-k2.5 were still
truncated at 240 tokens on the default TUI path.

Make maxTokens optional in ChatDepthProfile. Only light/deep depths
set it; normal leaves it undefined so the model decides its own
output length.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 01:37:24 -07:00
fanghanjun 4e5e44d22d fix(tui): buffer stdout writes for Terminal.app to prevent CJK crash
Terminal.app crashes (SIGSEGV in CGFontStrikeGetValue) when it sees
partial CJK UTF-8 bytes across multiple write() calls — the font
glyph cache gets corrupted with text bytes in pointer fields.

Buffer all stdout.write() calls within a single event-loop tick and
flush them as one atomic write via process.nextTick. This mirrors
Claude Code's single-write buffering approach (writeDiffToTerminal)
and ensures Terminal.app always receives complete frames.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 01:35:23 -07:00
fanghanjun 43a6523381 fix(tui): disable all color output on Terminal.app
Terminal.app's CoreGraphics/ColorSync pipeline has a memory corruption
bug where UTF-8 text bytes (CJK, em dash 0xe28094) end up in color
space pointers, causing SIGSEGV. Even basic 16-color ANSI codes
trigger it. Set FORCE_COLOR=0 to make chalk emit zero escape codes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 01:27:56 -07:00
fanghanjun f4f3d5d3fb fix(tui): use 16-color ANSI names for Terminal.app
Terminal.app's CoreGraphics crashes with 24-bit RGB escape sequences
(\x1b[38;2;r;g;b;m) combined with CJK text. Use basic ANSI color
names (cyan, yellow, white, etc.) which map to safe 16-color codes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 01:25:56 -07:00
fanghanjun 7769c3b34b fix(tui): disable ANSI markdown rendering on Terminal.app
Terminal.app's CoreGraphics pipeline crashes (SIGSEGV in
color_space_icc_md5_equal) when ANSI escape codes + CJK text
are rendered together — UTF-8 bytes get misinterpreted as
color space pointers.

On Terminal.app, renderMarkdown now uses a plain-text fallback
that strips markdown syntax without emitting any ANSI codes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 01:23:36 -07:00
fanghanjun 2b6ddf277e fix(tui): improve Terminal.app compatibility with CJK input
- Detect Terminal.app via $TERM_PROGRAM and lower Ink render FPS from
  30 to 15 to reduce ANSI redraw pressure during CJK IME composition
- Use Intl.Segmenter for grapheme-aware backspace handling (correctly
  deletes CJK characters, emoji with ZWJ, surrogate pairs)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 01:20:29 -07:00
fanghanjun 432283a256 fix(tui): add macOS system appearance fallback for theme detection
Terminal.app does not set $COLORFGBG. Fall back to macOS
AppleInterfaceStyle via `defaults read` to correctly detect
light/dark mode on Terminal.app.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 01:15:35 -07:00
fanghanjun 1027632f26 feat(tui): auto-detect terminal background and switch color scheme
Detect light/dark terminal via $COLORFGBG env var (same method as
Claude Code's initial seed). Provide distinct dark and light palettes
so all UI colors remain readable on both backgrounds.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 01:12:13 -07:00
fanghanjun 5cf9e0b45d fix(tui): swap user and AI message colors
User messages: #a8c4d4 (light blue) → #c0a480 (warm sand)
AI messages: #c0a480 (warm sand) → #a8c4d4 (light blue)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 01:08:20 -07:00
fanghanjun 38c7cd56f9 fix(tui): disable table header styling instead of bold
Bold is invisible with RGB colors in Ink; use empty style so headers
inherit the parent WARM_REPLY color like body cells.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 01:06:49 -07:00
fanghanjun fc60131542 fix(tui): change table header from red to bold
Override cli-table3 default red header style via tableOptions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 01:05:24 -07:00
fanghanjun f873c0cfb8 fix(tui): remove composer status line
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 00:58:53 -07:00
fanghanjun 039124efca fix(tui): remove composer helper hint line
Remove the slash command helper text below the composer status bar.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 00:58:15 -07:00
fanghanjun c0b0460e03 chore: update pnpm-lock.yaml for marked-terminal dependencies
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 00:57:19 -07:00
fanghanjun e171ff6c12 fix(tui): use minWidth layout for stable prefix spacing
Replace columnGap/trailing-space approach with <Box minWidth={2}> for
prefix icons (◆ │ ·), matching Claude Code's layout pattern.
Also fix user message body color to ROLE_USER (light blue).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 00:57:12 -07:00
fanghanjun b4a4ea47ac test(tui): add renderMarkdown unit tests
Cover bold conversion, bullet replacement, bold-inside-lists,
bold leak prevention, table rendering, and full-reset stripping.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 00:57:05 -07:00
fanghanjun b04dca7ce6 fix(tui): fix markdown rendering bold leak, bullets, and color reset
- Keep **markers as plain text through reflowText to prevent ANSI code splitting
- Strip \x1b[0m full-reset codes that override Ink's <Text color> context
- Replace * bullets with · in post-processing
- Convert **text** to ANSI bold after reflow is complete

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 00:56:59 -07:00
fanghanjun 6d26af66b1 fix(tui): adjust theme colors for better contrast
- WARM_ACCENT: #c88a56 → #d4a070 (warmer highlight for ◆ and accents)
- WARM_REPLY: #f0e6d8 → #c0a480 (warm sand tone for AI response body)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 00:56:53 -07:00
fanghanjun 88715edfaf feat(tui): add markdown rendering for assistant messages
Use marked + marked-terminal to render markdown in assistant replies,
supporting bold, italic, inline code, tables, and lists in the terminal.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 00:24:18 -07:00
fanghanjun 64da761e62 fix: revert isSimpleGreeting bypass and adapt nl-router test for hasFailed
Revert the isSimpleGreeting LLM bypass in runtime.ts chat handler to
preserve existing behavior where tools.chat is always called. Adapt the
nl-router test to pass hasFailed: true when testing explain_failure
routing, matching the new guard condition.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 00:18:03 -07:00
fanghanjun 514a375513 fix(tui): fix chat truncation, book dir detection, and UI polish
- Remove hardcoded maxTokens cap (240/700) from chat and developBookDraft
  tools so thinking models like kimi-k2.5 are not truncated mid-response
- Add resolveProjectRoot() to launchTui so running `inkos` from inside a
  book directory auto-resolves to the correct project root
- Pass projectRoot through loadConfig in createInteractionTools instead of
  falling back to process.cwd()
- Skip LLM call for simple greetings (你好/hi/hello) that already have
  built-in fallback responses, preventing empty-response errors
- Add try-catch around chat tool LLM call to gracefully degrade when
  thinking models return empty content
- Guard "为什么/why" routing to explain_failure behind hasFailed context
  flag so normal questions containing "为什么" route to chat instead
- Use columnGap={1} for conversation row spacing in Ink v7
- Remove statusSecondaryLine and mode label from status bar

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 00:13:51 -07:00
Junxian Ma 8d28e364a3 Merge pull request #143 from 185259536/fix/rewrite-rollback-target
fix rewrite targeting after chapter rollback
2026-04-13 12:26:00 +08:00
Junxian Ma 07043c3e75 Merge pull request #133 from pzysvip99999/fix/settler-json-sanitizer
fix: sanitize JSON before parsing in settler-delta-parser
2026-04-13 12:25:49 +08:00
Junxian Ma 969fa7e723 Merge pull request #124 from Nerdless-ship-it/fix/state-validator-trailing-content-and-import-reset
fix: preserve pending_hooks on import + tighten StateValidator JSON extraction
2026-04-13 12:25:38 +08:00
Junxian Ma 7169701632 Merge pull request #167 from Tahshsa/fix/windows-tests-and-publish-manifests
Fix Windows test failures and restore workspace: protocol in manifests
2026-04-13 12:25:26 +08:00
Ma 2ec8b66e78 chore: remove docs/plans from tracking and gitignore
These are local design/planning documents that shouldn't be in the
repository. Untrack the 8 files merged from dev and add docs/plans/
to .gitignore.
2026-04-13 11:43:57 +08:00