741 Commits

Author SHA1 Message Date
can1357 feb3a51d1e feat(deps): upgraded brush-core to 0.4.0 and refactored shell execution with new types
- Upgraded brush-core from 0.3.5 to 0.4.0 and added brush-builtins 0.1.0 dependency to support new builtin command framework.
- Refactored shell execution to use new ExecutionResult and ExecutionControlFlow types from brush-core 0.4.0, replacing previous ExitCode-based approach.
- Updated system_info disk refresh to use new sysinfo 0.38 API with single refresh(true) call instead of separate refresh_list() and refresh() calls.
- Added tokio full-featured runtime dependency to support async operations in pi-natives.
- Updated phf from 0.11 to 0.13 with macros feature for improved perfect hash function support.
- Fixed UTF-16 string handling in text.rs to properly strip trailing null bytes before conversion.
2026-02-01 16:51:06 +01:00
can1357 89df02edbc refactor(pi-natives): replaced tokio::task::spawn_blocking with unified launch_task abstraction
- Replaced tokio::task::spawn_blocking with custom launch_task abstraction across clipboard, find, grep, html, image, and shell modules.
- Introduced new work module providing Rayon-backed task scheduling for blocking operations in N-API exports.
- Simplified error handling by removing redundant join error mapping and consolidating to single-level error propagation.
- Unified task spawning pattern across all native modules to use consistent launch_task API with wait() method.
2026-02-01 15:52:22 +01:00
can1357 96b83875f4 feat: refactored native bindings into modular types with persistent shell sessions
- Added Shell class to persistent shell session management with session caching and abort capabilities.
- Added find() function for file discovery with glob pattern matching and optional streaming callbacks.
- Exported ImageFormat enum from main natives package for image encoding format selection.
- Reorganized native bindings into modular type files with declaration merging pattern for better maintainability.
- Refactored shell execution to use persistent Shell instances instead of stateless executeShell function calls.
- Enhanced SystemInfo type with additional fields for distro, kernel, CPU, and disk information.
2026-02-01 15:48:05 +01:00
can1357 e042823697 feat: refactored PhotonImage API to instance methods with simplified naming
- Refactored PhotonImage API from standalone functions to instance methods with simplified naming conventions.
- Renamed PhotonImage.new_from_byteslice() to parse() for a simpler, more intuitive factory method API.
- Converted PhotonImage.get_width() and get_height() methods to width and height getter properties.
- Consolidated four separate encoding methods (getBytes, getBytesJpeg, getBytesWebp, getBytesGif) into a single encode(format, quality) method.
- Moved resize() from a standalone function to a PhotonImage instance method.
- Added ImageFormat enum to specify encoding formats (PNG, JPEG, WEBP, GIF) in the encode method.
- Removed manual resource management via free() and Symbol.dispose, simplifying PhotonImage lifecycle.
2026-02-01 15:20:19 +01:00
can1357 df1a8bfe02 fix(pi-natives): expanded environment variable filtering to exclude bash function definitions
- Expanded environment variable filtering to exclude bash function definitions and additional shell-specific variables that should not be inherited by child processes.
2026-02-01 15:04:49 +01:00
can1357 44424fdeb1 feat(shell): added session-based shell execution with persistent instances and process group management
- Added session-based shell execution with persistent shell instances and session management via sessionKey parameter.
- Added support for shell snapshots to initialize bash sessions with saved state via snapshotPath parameter.
- Added sessionEnv option to set environment variables once per session, separate from command-specific env variables.
- Added process group management functions (process_group_id and kill_process_group) for better process lifecycle control on Linux, macOS, and Windows.
- Changed env option to apply variables for the current command only, with session-level variables now managed via sessionEnv.
- Refactored shell execution to use async output queuing with enqueueChunk for proper chunk sequencing and improved timeout handling with process group termination.
2026-02-01 15:01:43 +01:00
can1357 5edbf98281 feat(system-info): migrated system info collection to native Rust bindings
- Added native system information collection via new getSystemInfo() function in pi-natives crate using sysinfo library.
- Exported SystemInfo type and getSystemInfo() function from @oh-my-pi/pi-natives package for cross-platform system details.
- Migrated system information collection in coding-agent from shell-based commands to native Rust bindings for improved performance and reliability.
- Removed shell configuration retrieval from environment information display in coding-agent.
- Refactored system-prompt.ts to use native getSystemInfo() instead of platform-specific shell commands and helper functions.
- Added sysinfo 0.30 dependency to pi-natives crate for native system information gathering.
2026-02-01 14:56:27 +01:00
can1357 df118b0b50 feat(clipboard): added native clipboard support with arboard library integration
- Added native clipboard support with copyToClipboard() and readImageFromClipboard() functions using arboard library.
- Exported ClipboardImage type for clipboard image data with MIME type information.
- Migrated clipboard operations from shell commands to native arboard bindings for improved performance and reliability.
- Implemented Rust native module in pi-natives crate providing cross-platform clipboard access for Linux, macOS, and Windows.
- Added TypeScript bindings and type definitions for clipboard functionality in natives package.
2026-02-01 14:55:17 +01:00
can1357 12e6b2d7c9 feat(pi-natives): added keypad navigation support to Kitty keyboard protocol parsing
- Added support for keypad navigation keys (0-9, decimal) in Kitty keyboard protocol parsing.
- Implemented keypad-to-navigation key mapping function that translates keypad codepoints to standard navigation keys (arrows, home, end, page up/down, insert, delete).
- Enhanced ParsedKittySequence struct with text_codepoint field to track text representation of keys.
- Improved key matching logic to apply keypad navigation mapping when text codepoint is absent.
- Extended parse_csi_u parser to extract and validate text codepoints from Kitty protocol sequences.
2026-02-01 14:38:54 +01:00
can1357 17259e4afd feat: fixed word wrap not retaining line style with ANSI code preservation
- Added new public `wrapTextWithAnsi()` function to wrap text to a visible width while preserving ANSI escape codes across line breaks.
- Implemented ANSI state tracking and restoration logic to maintain color and formatting codes when wrapping multi-line text.
- Migrated `wrapTextWithAnsi` implementation from tui package to pi-natives package for better code organization and reusability.
- Added comprehensive test coverage for ANSI color code preservation across wrapped lines.
2026-02-01 14:13:40 +01:00
can1357 f6261fc4b9 feat(shell)!: migrated bash execution to native brush-core bindings
- Replaced Node.js-based persistent shell sessions with direct native calls for improved reliability and streaming.
- Integrated `brush-core` and `os_pipe` into the `pi-natives` crate for shell command execution.
- Removed the `shell-session.ts` module and its corresponding test suite.
- Updated `bash-executor` to leverage the new native shell execution.
2026-02-01 13:41:49 +01:00
can1357 df789022ac fix(natives): removed unused ptr import on windows 2026-02-01 13:23:54 +01:00
can1357 11c7939177 chore: bump version to 9.7.0 2026-02-01 13:23:01 +01:00
can1357 c537523212 docs(coding-agent/prompts): reorganized system prompt guidance for parallel task execution
- Reorganized system prompt guidance for parallel task execution, moving coordinator section earlier and restructuring parallel_reflex section for improved clarity.
2026-02-01 13:21:03 +01:00
can1357 6896802d75 feat(process-management): implemented native process tree management with platform-specific implementations
- Added native process tree killing and listing functions via new `ps` module in pi-natives crate with platform-specific implementations (Linux /proc, macOS libproc, Windows CreateToolhelp32Snapshot).
- Refactored process termination logic to prioritize native process tree killing when available, improving reliability of process cleanup across platforms.
- Removed detached process spawning across codebase (bash-executor, shell-session, kernel, lsp client, markitdown conversion) in favor of native process tree management.
- Simplified ptree module by removing managed children tracking and postmortem cleanup hooks, delegating process lifecycle management to native implementations.
2026-02-01 13:18:14 +01:00
can1357 66da3e8759 feat(natives): added development mode support for native binary builds with debug profiles
- Added development mode support for native binary builds via `--dev` flag and `OMP_DEV` environment variable.
- Added `dev:native` npm script for building debug native binaries in development environments.
- Changed native binary build process to conditionally use debug or release profiles based on development mode flag.
- Changed native addon loader to prioritize debug builds when `OMP_DEV` environment variable is set.
- Refactored keyboard parsing functions in pi-natives to use const functions and guard clauses for improved code clarity.
2026-02-01 12:56:44 +01:00
can1357 ce80cb8b94 feat(keys): migrated keyboard parsing logic from JavaScript to native Rust implementation
- Migrated keyboard parsing and matching logic from JavaScript to native Rust implementation for improved performance.
- Exported new native functions parseKey, parseKittySequence, matchesLegacySequence, and matchesKey from @oh-my-pi/pi-natives package.
- Exported KeyEventType enum and ParsedKittyResult type for Kitty keyboard protocol support.
- Removed Key helper object from public API of @oh-my-pi/pi-tui package; users should now pass key identifiers as strings (e.g., 'ctrl+c' instead of Key.ctrl('c')).
- Added comprehensive keyboard parsing support in native layer including Kitty protocol, legacy terminal sequences, function keys, and modifier combinations.
- Added phf dependency for efficient perfect hash map lookups of legacy terminal escape sequences.
2026-02-01 12:35:57 +01:00
can1357 056f0bd22d feat(shell): migrated shell execution to native brush-core bindings with streaming support
- Added native shell execution API via brush-core with streaming output support and configurable timeouts.
- Migrated bash executor from persistent ptree-based shell sessions to native bindings with improved performance and simplified architecture.
- Removed persistent shell session module and replaced with native brush-core implementation for better resource management.
- Added executeShell() and abortShellExecution() functions to native bindings for shell command execution with cancellation support.
- Implemented shell execution with support for environment variables, working directory changes, and timeout handling.
2026-02-01 11:33:42 +01:00
can1357 54b1b0728e perf(pi-natives): optimized grapheme width calculation with inline ASCII fast path
- Optimized grapheme width calculation with inline ASCII fast path detection.
- Renamed for_each_grapheme_u16 to for_each_grapheme_u16_slow to clarify it handles non-ASCII segments only.
- Removed segment_is_ascii_u16 helper function and inlined ASCII detection directly in hot loops.
- Refactored visible_width_u16_up_to, truncate_to_width, slice_with_width_impl, and extract_segments_impl to branch on ASCII vs non-ASCII segments separately.
- Improved grapheme_width_str to use pattern matching for single-character detection.
- Changed ANSI sequence tracking from saw_any_ansi to saw_sgr for more precise SGR code detection.
2026-02-01 11:17:36 +01:00
can1357 b10adb92cb chore: bump version to 9.6.3 2026-02-01 10:41:26 +01:00
can1357 e1bcf492a1 refactor: restructured text module and simplified NAPI API surface
- Renamed `EllipsisKind` enum to `Ellipsis` across all packages for clearer API naming.
- Refactored Rust text module from 356 to 155 lines with simplified state tracking using u32 ColorVal instead of enum ColorCode and named attribute constants.
- Removed `Env` parameter from public NAPI functions `truncate_to_width` and `extract_segments` to simplify API surface.
- Changed return type of `truncate_to_width` from `JsString` to `Either<JsString, Utf16String>` to support zero-copy returns.
- Removed early return optimization in `truncateToWidth()` function.
- Reordered native module search paths to prioritize repository build artifacts over system paths.
2026-02-01 10:23:41 +01:00
can1357 09225bc491 feat: refactored text truncation API to use string type and hardcoded ellipsis
- Changed TextInput type parameter to string in truncateToWidth(), visibleWidth(), sliceWithWidth(), and extractSegments() functions in native bindings.
- Removed TextInput type export from public API of pi-natives package.
- Removed format.ellipsis symbol from theme configuration, replacing all theme-based ellipsis references with hardcoded Unicode ellipsis character (...).
- Removed ellipsis property from SymbolTheme interface in pi-tui package.
- Removed truncateToWidth, sliceWithWidth, and extractSegments wrapper functions from pi-tui public API, now re-exporting directly from pi-natives.
- Added early return optimizations in truncateToWidth() and sliceWithWidth() native functions to skip native calls when possible.
2026-02-01 10:01:56 +01:00
can1357 c8f106c58c feat(text): refactored text processing with UTF-16 optimization and ANSI state bitflags
- Added `visibleWidth()` function to measure visible text width while excluding ANSI codes.
- Optimized text processing from UTF-8 to UTF-16 implementation with direct JsString handling for improved performance.
- Refactored ANSI state tracking to use bitflags-based SgrState struct instead of individual boolean fields for more efficient storage.
- Introduced ColorCode enum to represent color codes (Basic, Indexed, Rgb) for better type safety.
- Added comprehensive test coverage for UTF-16 text processing, ANSI detection, and width calculations.
- Updated napi feature from 'napi8' to 'napi10' and added unicode-segmentation dependency.
2026-02-01 09:34:54 +01:00
can1357 0ac6d19cbc feat(deps): upgraded napi to v3, added Kitty keyboard protocol support, and refactored text processing
- Added native Kitty keyboard protocol sequence matching via new `matchesKittySequence` function in pi-natives crate.
- Removed `visibleWidth` function from text utilities in favor of consistent Bun.stringWidth approach.
- Upgraded napi and napi-derive dependencies from version 2 to 3.
- Relaxed grep-regex, grep-searcher, and grep-matcher dependency version constraints to allow any 0.1.x version.
- Replaced unicode-segmentation dependency with bstr for improved byte-slice handling in text processing.
- Refactored text module to use byte-slice abstractions instead of string references for better performance and flexibility.
2026-02-01 09:05:56 +01:00
can1357 32c6b22bbe feat: added sortByMtime, streaming grep callbacks, mtime field, RequestOptions export, and fixed shell race condition
- Added sortByMtime option to FindOptions for native-level mtime-based sorting of file search results.
- Added streaming callback support (onMatch parameter) to grep() function for real-time match notifications.
- Added mtime field to FindMatch struct to expose file modification times in search results.
- Exported RequestOptions type from natives package for public API use.
- Implemented wrapRequestOptions utility for consistent timeout and abort signal handling across native functions.
- Fixed race condition in shell session where command completion could occur before stream data was fully processed.
2026-02-01 05:52:12 +01:00
can1357 1265b6c006 feat: added fuzzyFind native function with .gitignore support and replaced fd binary dependency
- Added fuzzyFind native function for case-insensitive fuzzy file path searching with .gitignore support and configurable result limits.
- Exported FuzzyFindOptions, FuzzyFindMatch, and FuzzyFindResult types from @oh-my-pi/pi-natives for fuzzy search configuration and results.
- Replaced external fd binary dependency with native fuzzyFind implementation in autocomplete provider for improved performance.
- Implemented safeCopy function in native build script to prevent crashes when updating native binaries by using atomic-like file operations.
2026-02-01 05:31:53 +01:00
can1357 25ca56c05c perf: optimized performance with streaming readers, single-pass algorithms, and reduced allocations
- Optimized grep search to use streaming readers instead of buffering entire files, reducing memory overhead for large files.
- Added thread-local caching to scope color computation in highlight module to avoid repeated prefix checks.
- Refactored text truncation from two-pass algorithm to single-pass streaming algorithm, eliminating intermediate vector allocations.
- Removed Arc overhead from image storage by storing DynamicImage directly and pre-allocating buffer capacity for encoding operations.
- Updated find tool to emit streaming match updates via callback and use native match metadata instead of redundant filesystem stats, improving performance.
- Added maxResults parameter to find tool to limit result set at the native layer.
2026-02-01 04:57:47 +01:00
can1357 276411d560 refactor(pi-natives): optimized string handling and refactored native modules for better memory efficiency
- Optimized string handling in find.rs by replacing String allocations with Cow<'_, str> to avoid unnecessary copies when glob patterns don't contain backslashes on non-Windows systems.
- Refactored grep.rs to use Cow<'a, str> in normalize_relative_path() for conditional allocation, reducing memory overhead on non-Windows platforms.
- Extracted helper functions bytes_to_trimmed_string() and matches_case_insensitive() in grep.rs to reduce code duplication and improve maintainability.
- Converted multiple match statements to let...else syntax in grep.rs for cleaner error handling patterns.
- Restructured visible_width_impl() in text.rs to use a two-pass algorithm that separates ANSI escape sequence detection from width calculation for improved clarity.
2026-02-01 04:30:01 +01:00
can1357 b5e96526e3 feat: added native find module and made grep/html/image/text async with camelCase naming
- Added native find module for high-performance filesystem discovery with glob pattern matching and .gitignore support.
- Made grep, html, image, and text native functions asynchronous to prevent blocking the event loop.
- Updated native function names to use camelCase convention for JavaScript interoperability.
- Extended grep and text functions to accept Uint8Array/Buffer input for zero-copy operations.
- Delegated file discovery logic from JavaScript to native Rust implementation for improved performance.
2026-02-01 03:10:24 +01:00
can1357 eabbde0c8a feat(natives): migrated native bindings from WASM to Node.js N-API with ripgrep-backed grep module
- Migrated native bindings from WebAssembly (wasm-bindgen) to Node.js N-API architecture for improved performance and platform support.
- Replaced worker pool-based async architecture with synchronous native addon calls, eliminating thread overhead and simplifying the API.
- Added new grep module with ripgrep-backed filesystem search supporting parallel processing, glob filtering, and context line extraction.
- Updated build system to compile Rust crates to platform-specific .node binaries instead of WASM modules.
- Removed WASI implementation and worker pool infrastructure no longer needed with N-API native bindings.
- Updated CI/CD pipeline to build native addons for multiple platforms (Linux x64/arm64, macOS x64/arm64, Windows x64) and include them in releases.
2026-01-31 18:02:56 +01:00
can1357 a07f38b16e feat(grep): added grep CLI, diff highlighting, FileReader abstraction, and markdown improvements
- Added grep CLI subcommand with support for pattern matching, file globbing, context lines, and multiple output modes (content, files-with-matches, count).
- Added diff syntax highlighting support with distinct colors for inserted and deleted lines in code output.
- Implemented FileReader abstraction for cross-platform file reading with mmap support and 4MB size limit.
- Refactored worker pool initialization to support both compiled and development build environments using resolveWorkerSpecifier utility.
- Enhanced markdown rendering with improved inline style context handling and blockquote formatting with text wrapping.
- Replaced external strip-ansi dependency with Bun's built-in stripANSI method across all packages.
2026-01-31 01:27:36 +01:00
can1357 47dc81720c feat(natives/wasm): added GIF and WebP export methods to PhotonImage
- Added `get_bytes_gif()` method to PhotonImage for exporting images as GIF bytes.
- Added `get_bytes_webp()` method to PhotonImage for exporting images as lossless WebP bytes.
- Enabled 'gif' and 'webp' features for the image crate dependency.
2026-01-30 01:06:49 +01:00
can1357 ddb617e3f5 feat: enhanced worker pool with timeout/abort handling and replaced html2text with WASM converter
- Added `RequestOptions` interface to worker pool with support for `timeoutMs`, `signal`, and `transfer` properties.
- Added `stuckGracePeriodMs` configuration option to `WorkerPoolOptions` for graceful handling of stuck workers after timeout.
- Enhanced worker pool request method to accept `RequestOptions` object parameter instead of simple transfer array, enabling timeout and abort signal handling.
- Implemented comprehensive timeout and abort signal handling in worker pool with support for combined signals and grace period before force-terminating stuck workers.
- Removed html2text tool from coding agent in favor of native WASM html-to-markdown converter.
- Exported `RequestOptions` type from natives package public API.
2026-01-29 23:35:02 +01:00
can1357 0eaa18c15b feat(html-to-markdown): added bundled HTML-to-Markdown conversion via Rust natives
- Added HTML to Markdown conversion functionality via new WASM binding in pi-natives crate with configurable options for content cleaning and image skipping.
- Exported htmlToMarkdown async function from @oh-my-pi/pi-natives package with worker pool support for efficient HTML to Markdown conversion.
- Integrated native WASM HTML to Markdown converter as the primary conversion method in fetch tool, replacing text-only rendering with markdown output.
- Added html-to-markdown-rs dependency to pi-natives crate for server-side HTML to Markdown conversion with preprocessing support.
- Added comprehensive test coverage for htmlToMarkdown function including headings, links, lists, code blocks, and conversion options.
2026-01-29 23:25:56 +01:00
can1357 37d5b69250 feat(highlight): replaced cli-highlight with rust-based syntax highlighting
- Added native syntax highlighting module powered by syntect library with ANSI color output support.
- Implemented highlightCode() function that applies syntax highlighting to code with language detection and customizable color themes.
- Implemented supportsLanguage() function to check if a given programming language is supported for syntax highlighting.
- Implemented getSupportedLanguages() function that returns list of all supported language identifiers.
- Replaced cli-highlight dependency with native syntect-based highlighting in coding-agent theme module.
- Added comprehensive language alias mappings supporting 50+ programming languages including TypeScript, Python, Rust, Go, C/C++, and web languages.
2026-01-29 12:01:11 +01:00
can1357 2abaddec84 chore: bump version to 8.12.6 2026-01-29 10:53:15 +01:00
can1357 961539aae2 fix(ask): preserved null timeout when user disables ask timeout setting
The nullish coalescing operator (??) was treating null as a fallback
trigger, causing getAskTimeout()'s null return value (meaning 'disabled')
to be replaced with DEFAULT_ASK_TIMEOUT_MS (30000ms).

Now explicitly checks for undefined to distinguish between:
- undefined: settingsManager unavailable → use default
- null: user explicitly disabled timeout → preserve null
- number: user-set timeout → use that value
2026-01-29 10:49:39 +01:00
can1357 8ef11355e7 perf(tui,natives): added native text utilities with JS fast path for short strings
- Added native text utilities in pi-natives (visible width, truncation, slicing, segment extraction)
- Wired pi-tui to use native implementations with short-string JS fast path
- Optimized key matching via cached parsed key ids
- Refactored visual truncation to reuse Text instances
- Reduced theme color lookups by switching from Map to plain records
- Regenerated WASM artifacts

Benchmarks (after vs before, lower is better):
- truncateToWidth/ansi: 20.37ms vs 38.13ms (2000 iters)
- sliceWithWidth/ansi: 5.12ms vs 20.39ms
- extractSegments/ansi: 8.92ms vs 27.60ms
- truncateToVisualLines: 3.51ms vs 411.55ms (500 iters)
- visibleWidth/ansi: 0.24ms vs 0.31ms
2026-01-29 10:47:55 +01:00
can1357 aa156af6e1 chore: bump version to 8.12.4 2026-01-29 09:34:06 +01:00
can1357 28bf9057e3 chore: fix *.rs formatting 2026-01-29 09:33:01 +01:00
can1357 978b93ba62 refactor: migrated native tools to WASM-based implementation
- Consolidated grep, find, and image processing into a new `@oh-my-pi/pi-natives` WASM package.
- Eliminated subprocess overhead and simplified JS tool implementations.
- Updated CI to include Rust workspace, linting, formatting, and WASM build steps.
- Documented `Promise.withResolvers()` and `using` declarations for wasm-bindgen.
2026-01-29 09:29:21 +01:00