Commit Graph

7 Commits

Author SHA1 Message Date
Alex Jaden 070ff41f4c fix(coding-agent): sync WezTerm theme changes on macOS
(cherry picked from commit fa70be267daa6f98cf18e2f257041f4e6e68a61d)
2026-07-29 23:08:34 +02:00
can1357 9b78a6fa85 refactor(natives): migrated native bindings to NAPI-RS with auto-generated types
- Migrated native bindings from TypeScript wrappers to NAPI-RS generated modules with auto-generated type definitions and runtime enums.
- Replaced chunk tree API with stateful ChunkState class supporting render, edit, and resolve operations with improved error handling.
- Converted callback signatures to error-first pattern (error, result) for shell, PTY, glob, and grep operations.
- Introduced type-safe enums for MacOSAppearance, GrepOutputMode, KeyEventType, ImageFormat, and AstMatchStrictness replacing string literals.
- Refactored chunk tree implementation with dedicated modules for edit, indent, resolve, and state management with comprehensive validation.
- Moved clipboard utilities from native bindings to coding-agent package with improved OSC 52 and Termux compatibility.
2026-04-07 02:00:59 +02:00
can1357 df369dd7fd refactor(coding-agent): migrated test mocks to vitest spyOn with Symbol.dispose cleanup
- Migrated test mocking from bun:test mock API to vitest spyOn pattern across 9 test files.
- Extracted mock setup logic into reusable helper functions with Symbol.dispose cleanup pattern.
- Replaced manual beforeEach/afterEach and try-finally blocks with TypeScript 5.2 using declarations.
- Removed 178 lines of boilerplate mock initialization and restoration code from test suite.
2026-03-26 16:17:27 +01:00
daandden b8c423e319 Fix stale OpenAI Responses replay across session boundaries (#534)
* Fix stale OpenAI Responses replay across session boundaries

Fixes #505

* Fix CI tests for session replay change

* Harden session reload and switch rollback

* Guard session switch snapshots

* fix(coding-agent): preserve responses replay snapshots
2026-03-26 15:27:58 +01:00
can1357 e5b10b876f test(coding-agent): removed macOS fallback test case from theme detection
- Removed test case for macOS fallback behavior inside Zellij.
2026-03-26 14:06:21 +01:00
can1357 2a5968ec47 fix(tui): fixed OSC 11 background color detection and query race conditions
- Fixed OSC 11 background color detection to handle partial escape sequences that arrive mid-buffer, preventing user input from being swallowed.
- Fixed race condition where overlapping OSC 11 queries would be incorrectly cancelled by DA1 sentinels from previous queries by implementing a query queueing mechanism.
- Refactored OSC 11 query handling to use queuing instead of immediate restart, improving robustness of terminal appearance detection.
- Added comprehensive test coverage for terminal appearance detection including partial buffer handling, query queueing, and debouncing behavior.
- Added test cases for theme auto-detection to verify terminal-reported appearance takes precedence over environment variables and platform-specific detection.
2026-03-11 01:11:00 +01:00
lederniermagicien 486fd4c753 refactor(theme): replace CoreFoundation FFI with OSC 11 for machine-agnostic dark/light detection (#347)
* refactor(theme): replace CoreFoundation FFI + Mode 2031 with OSC 11 for dark/light detection

Replace the 415-line Rust CoreFoundation FFI module and Mode 2031-only
detection with OSC 11 background color queries — the machine-agnostic
method used by Neovim, fish, bat, and terminal-colorsaurus.

Detection stack:
- OSC 11 query + DA1 sentinel at startup (works over SSH, mobile clients)
- Mode 2031 subscribe: re-queries OSC 11 with 100ms debounce (Neovim
  convention) instead of trusting binary dark/light value directly
- 2s OSC 11 poll for terminals without Mode 2031 (Warp, Alacritty,
  WezTerm, iTerm2); self-disables once Mode 2031 fires
- COLORFGBG env var fallback (free, no I/O)
- macOS defaults read fallback (Zellij edge case)

Deleted:
- crates/pi-natives/src/appearance.rs (414 lines of unsafe FFI)
- packages/natives/src/appearance/ (66 lines of TS bindings)
- macOS appearance observer and SIGWINCH coupling in theme.ts

Net: -424 lines. Rust crate lighter, detection works over SSH.

* fix(theme): ignore bogus zellij osc11 dark reading

* fix(theme): scope macOS fallback to broken terminal paths

* fix(tui): swallow DA1 sentinels for OSC 11 probes

---------

Co-authored-by: can1357 <me@can.ac>
2026-03-11 00:58:17 +01:00