Commit Graph

549 Commits

Author SHA1 Message Date
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
Ma f5ee8f71d9 docs(skill): add v1.2 interaction capabilities to SKILL.md
- Add Workflow 12: book-wide entity rename via interact
- Add Workflow 13: single-chapter text patching via /replace
- Add Workflow 14: TUI dashboard launch (inkos with no args)
- Add Studio assistant panel note (shares interaction kernel)
- Add inkos interact and inkos (TUI) to command reference table
- Bump skill version to 2.3.0
2026-04-13 11:40:47 +08:00
Ma a7129b540d fix(cli): fix CI test failures blocking v1.2.0 release
- Guard browser.unref() call in studio command — mock spawn objects
  in test environment don't have unref, causing TypeError
- Fix cli-integration test isolation: clean up harbor book and session
  file after interact tests so book list/status tests find empty state
- Change interact --book test to use /books intent instead of
  explain status which requires LLM connectivity
v1.2.0
2026-04-13 11:01:15 +08:00
Ma 4fcabc256e chore(release): bump to v1.2.0, update docs and changelog
- Update v1 sections to v1.2 in README.md, README.en.md, README.ja.md
  covering: shared interaction runtime, Ink TUI dashboard, Studio
  assistant panel, conversational book creation, entity rename,
  inkos interact endpoint, thinking model temperature clamp
- Add v1.2.0 changelog with full feature list, improvements, and fixes
- Bump all package versions from 1.1.1 to 1.2.0
2026-04-13 10:35:05 +08:00
Ma 0495b001bc fix(studio): use responseText instead of last session message for agent replies
The agent endpoint was returning `session.messages.at(-1)?.content` as
the response, but the last session message is the user's input — the
actual assistant reply is in `result.responseText`. This caused the
ChatBar to echo the user's own message back as the "assistant response".
2026-04-13 10:28:43 +08:00
Ma 367891c365 fix(studio): fix ChatBar dropping assistant responses on every interaction
The agent endpoint returns the response text in `data.response` and
the full session history in `data.session.messages`. The ChatBar was
replacing its entire message list with session history on every call,
but session messages don't include the latest assistant response —
so the reply was silently dropped every time.

Fix: always append `data.response` as an assistant message instead
of replacing with session history. Session restore only happens on
first panel open when ChatBar is empty.
2026-04-13 10:24:12 +08:00
Ma 645c9f60c4 fix(studio): lift book card z-index when dropdown menu is open
The fadeIn animation's transform creates a stacking context on each
book card, trapping the dropdown's z-50 inside. When the BookMenu
opens, the parent card now gets z-50 to sit above sibling cards,
allowing the full dropdown (including delete) to render unclipped.
2026-04-13 10:17:37 +08:00
Ma 9b40bb5589 fix(studio): fix dropdown menu z-index stacking by removing transform from paper-sheet
The paper-sheet hover effect used `transform: translateY(-4px)` which
creates a new stacking context, trapping the BookMenu dropdown's z-50
inside the card. Subsequent cards in DOM order rendered above it.

Remove transform and transform-style from paper-sheet, keep the
shadow-based hover effect. Dropdown menus now render above all cards.
2026-04-13 10:13:16 +08:00
Ma 6d613f8b6b fix(studio): remove overflow-hidden from book cards so dropdown menus render
The BookMenu dropdown (three-dot menu) was clipped by the parent
card's overflow-hidden. The progress bar already has its own
overflow-hidden, so the card-level clip was unnecessary.
2026-04-13 10:05:53 +08:00
Ma 8f12ee2ff1 feat: merge interaction control layer, TUI dashboard, and studio enhancements
54 commits from dev branch introducing:
- Shared interaction runtime (NL router, session management, edit controller)
- Ink-based TUI dashboard with themed animations and i18n
- Studio ChatBar shared session integration and book draft conversation flow
- CLI interact command for OpenClaw/agent interop
- Studio server endpoints for interaction session and agent routing

Core 585/585, Studio 70/70 tests pass.
2026-04-13 09:59:28 +08:00
Ma 8b71517d8f fix(studio): fix ChatBar stale closure, deduplicate command handlers
- Fix SSE effect stale `loading` closure: use loadingRef to read
  current loading state inside the SSE effect instead of capturing
  a stale value from the dependency array
- Deduplicate handleSubmit/handleQuickCommand: extract shared
  executeCommand() function, eliminating ~80 lines of copy-pasted
  logic that would inevitably diverge
- Fix curly quote encoding issue causing esbuild parse failures
2026-04-13 09:48:09 +08:00
Ma 5410b95452 refactor(interaction): split draft and book selection handlers 2026-04-13 09:36:29 +08:00
Ma fbbf1086ac fix(interaction): harden agent errors and file handling 2026-04-13 09:36:29 +08:00
Ma 1edd52a3e0 fix(tui): polish dashboard interactions, theme and animations
- Add semantic status colors and role colors to theme palette
- Improve conversation rows with distinct icons per role
- Upgrade ExecutionBadge with per-status icons
- Add visual separators between dashboard sections
- Improve composer with separated status/helper text
- Enhance startup animation with project info reveal
- Move hardcoded i18n strings into TuiCopy stageLabels
- Fix non-null assertions in effects.ts
2026-04-13 09:27:18 +08:00
Ma a0cf181e32 fix(studio): align revise endpoint with pipeline modes 2026-04-13 03:27:54 +08:00
Ma 21facd6350 chore(workspace): relink local packages for dev integration 2026-04-13 03:27:53 +08:00
Ma 54deba194f test(studio): align server fixture with chapter checks 2026-04-13 03:25:15 +08:00
Ma ed1d792ba0 fix(studio): polish interaction flows across major pages 2026-04-13 03:20:56 +08:00
Ma b8ac5b2cee fix(tui): stop caret redraws while idle 2026-04-13 03:19:06 +08:00
Ma 703ac5768a feat(studio): build creation flow on shared drafts 2026-04-13 03:19:06 +08:00
Ma 378acafb7a feat(interaction): carry foundation drafts into book creation 2026-04-13 03:19:06 +08:00
Ma 2437df01c0 feat(interaction): add shared book-draft ideation flow 2026-04-13 03:19:06 +08:00
Ma 3d75ac2eab fix(tui): stabilize slash commands and idle caret 2026-04-13 03:19:06 +08:00
Ma c7bbb2bb15 fix(tui): add a blinking composer caret 2026-04-13 03:19:06 +08:00
Ma a78b958e12 feat(tui): rebuild the interface around an Ink dashboard 2026-04-13 03:19:06 +08:00
Ma 70ef3dbd9e feat(interaction): add shared create and export flows 2026-04-13 03:18:37 +08:00