Commit Graph

23 Commits

Author SHA1 Message Date
can1357 45bade9612 feat(chunk): added canonical chunk paths with CRC validation and selector resolution
- Added fully-qualified anchor paths in chunk read output showing complete path hierarchy with CRC checksums.
- Added exact chunk selector resolution with CRC validation to enforce canonical chunk paths in edit operations.
- Added `?` selector option to read syntax-aware chunks by canonical path listing when anchor paths are unclear.
- Improved tree-sitter range handling with `end_row_as_line()` function to correctly convert half-open ranges to 1-indexed line numbers.
- Extracted anchor label logic into `chunk_anchor_label()` const function and consolidated style-based selection.
- Removed --dev flag support from native build pipeline and dev:native npm scripts.
2026-04-07 23:31:39 +02:00
can1357 184b0dee98 fix(ci): normalize napi addon filenames 2026-04-07 20:20:39 +02:00
can1357 fe762f6f26 fix(ci): resolve napi bin directly and allow const_for_fn on power stop
- build-native.ts: bunx @napi-rs/cli was picking up Mono's /usr/bin/cli
  on Ubuntu runners; resolve the napi bin from node_modules/.bin instead.
- power.rs: non-macOS build strips the cfg body, leaving stop() as a no-op
  that clippy wants const. Allow the lint since the macOS branch can't be const.
2026-04-07 05:59:42 +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 266aabf29f feat(autoresearch): enabled selective segment creation and working tree preservation in experiments
- Added `new_segment` parameter to `init_experiment` to force new segment creation when contract fields match.
- Added `skip_restore` parameter to `log_experiment` to preserve working tree state and pre-existing uncommitted changes.
- Changed `log_experiment` to revert only run-modified files instead of entire working tree, preserving user changes.
- Changed `init_experiment` to detect matching contract fields and skip re-initialization unless `new_segment=true`.
- Added git status parsing utilities to track pre-run dirty paths and distinguish tracked vs untracked modifications.
- Removed secondary metrics validation requirement, making secondary metrics informational only.
2026-04-06 18:49:52 +02:00
can1357 16b861d8cc fix(ai): add ZenMux to models.json gen and fix maxTokens extraction
- Fixed maxTokens extraction in zenmuxModelManagerOptions using max_completion_tokens
- Sort providers alphabetically in generated models.json output
2026-03-04 20:00:13 +01:00
can1357 93e28a8029 refactor: consolidated timing instrumentation to centralized logger methods
- Migrated timing instrumentation from custom utils/timings module to centralized logger.time() and logger.timeAsync() methods across coding-agent and natives packages.
- Removed PI_DEBUG_STARTUP environment variable and debugStartup() function, consolidating debug output to logger.debug() for conditional logging.
- Replaced custom TextDecoder buffer decoding with native toString('utf-8') method in natives package for simplified string conversion.
- Added RingBuffer<T> circular buffer implementation to pi-utils with comprehensive test coverage for efficient queue operations.
- Enhanced logger interface with time() and timeAsync() methods providing unified operation timing and performance tracking across packages.
2026-02-21 22:42:18 +01:00
can1357 fe27bc4cf2 feat: enhanced regex sanitization, LSP client messaging, and native addon installation
- Added support for braced escape sequences (\p{...}, \P{...}, \x{...}, \u{...}) in regex pattern sanitization to properly preserve unicode property escapes and hex escapes.
- Improved LSP client message writing by simplifying header encoding and refactoring abort signal handling with the untilAborted utility.
- Enhanced native addon installation script to dynamically fetch release tags from GitHub API instead of using hardcoded versions.
- Relaxed native addon validation to only error when no addons are found rather than when any are missing, improving flexibility in addon availability.
2026-02-16 18:33:05 +01:00
can1357 a4f845a465 feat: added CPU variant support for x64 native addons with AVX2/baseline fallback
- Added CPU variant support for x64 native addons with modern (AVX2/x86-64-v3) and baseline (x86-64-v2) variants, enabling automatic fallback when modern variants are unavailable.
- Added automatic AVX2 CPU detection on Linux, macOS, and Windows platforms to select appropriate native addon variant at runtime.
- Updated native addon filename scheme to include CPU variant suffix (e.g., pi_natives.linux-x64-modern.node) for x64 platforms.
- Updated CLI update mechanism to support downloading and installing multiple native addon variants per platform with fallback support.
- Removed fallback untagged pi_natives.node binary creation; platform and variant-tagged binaries are now required.
2026-02-16 18:33:03 +01:00
can1357 148f9e883d ci(workflows): added RUSTFLAGS configuration for x86-64-v3 CPU optimization in CI and native builds
- Added RUSTFLAGS environment variable configuration to CI workflow for x86-64-v3 CPU optimization across multiple build jobs.
- Added per-matrix rustflags configuration for native builds on x64 platforms (Linux, macOS Intel, Windows).
- Updated build-native script to default to native CPU optimization for local builds when not cross-compiling.
2026-02-10 22:06:34 +01:00
can1357 5339369abd style: replaced ASCII ellipsis with Unicode character for improved typography
- Replaced ASCII ellipsis characters (three dots '...') with Unicode ellipsis character ('...') throughout the codebase for improved typography.
- Adjusted string truncation logic to account for single-character Unicode ellipsis instead of three-character ASCII ellipsis, reducing reserved space from 3 to 1 character in truncation calculations.
- Updated truncation offsets in multiple files (session-manager, agent, executor, footer) to preserve 2 additional characters before ellipsis due to more compact Unicode representation.
2026-02-06 02:51:07 +01:00
can1357 89e6479661 refactor: migrated environment variable access from process.env to Bun.env across 71 files
- Migrated all environment variable access from Node.js `process.env` to Bun runtime `Bun.env` API across the entire codebase.
- Updated 71 files including source code, tests, documentation, and configuration to use Bun's native environment variable API.
- Added comprehensive environment variables documentation in `packages/coding-agent/docs/environment-variables.md` covering 100+ environment variables organized by category.
- Updated CHANGELOG entries to reflect migration from `process.env` to `Bun.env` and environment variable prefix changes (PI_* vs OMP_*).
- Maintained identical behavior and logic across all changes - only the environment variable access method was updated.
2026-02-05 04:51:18 +01:00
can1357 2a131d201e feat(natives): fixed binary installs with embedded native addon extraction
- Added automatic extraction of embedded native addon payload to ~/.omp/natives/<version> on first run of compiled binaries.
- Added embed:native build script for generating platform-specific native addon payloads embedded in compiled binaries.
- Enhanced native addon loading to prioritize extracted embedded addon over downloaded versions.
- Improved error messages with platform-specific guidance for compiled vs npm-installed binaries.
- Refactored CI workflow to use reusable build_binary() function for cross-platform binary compilation.
2026-02-01 17:16:53 +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 c3e7726b8f fix(natives): fixed native binary installation to prevent architecture mismatches and improve cross-compilation handling
- Fixed potential issue where cross-compiled binaries could overwrite platform-specific native builds with incorrect architecture binaries.
- Improved native binary installation to use atomic rename operations and better fallback handling for Windows DLLs.
- Reordered native binary search candidates to prioritize platform-tagged builds and avoid loading stale cross-compiled binaries.
- Enhanced cross-compilation detection to prevent installing wrong-platform fallback binaries during cross-compilation builds.
- Refactored binary installation logic with improved error handling and cleanup of stale temporary files.
2026-02-01 11:33:07 +01:00
can1357 c252847005 feat(natives): updated streaming callbacks to use error-first convention for proper async error handling
- Modified callback signature for `find()` and `grep()` streaming callbacks from `(match)` to `(error, match)` to support proper error handling in async operations.
- Updated native binding wrappers to handle error-first callback convention from napi-rs ThreadsafeFunction.
- Removed 'pi_natives.node' from candidate native module names, keeping only platform-specific variants.
2026-02-01 11:06:28 +01:00
can1357 5d80d0df7a chore: bump version to 9.6.0 2026-02-01 08:20:08 +01:00
can1357 1e8e058ead feat: added cross-compilation support via CARGO_BUILD_TARGET and environment variable overrides
- Added support for cross-compilation via CARGO_BUILD_TARGET environment variable, enabling builds for non-native targets like ARM64 Linux.
- Added support for overriding platform and architecture detection via TARGET_PLATFORM and TARGET_ARCH environment variables.
- Modified native build script to search for release artifacts in target-specific directories when cross-compiling.
- Updated CI workflow to use cross-compilation toolchain for ARM64 Linux builds instead of native ARM64 runners.
- Created comprehensive porting guide documenting how to port hot paths to pi-natives with anatomy, checklist, and troubleshooting sections.
2026-02-01 07:44:34 +01:00
can1357 f5fed20ea9 fix(natives/scripts): improved native binary installation safety with atomic rename operations
- Improved native binary installation safety by using atomic rename operations instead of copy-then-delete, preventing data loss if installation fails.
- Added proper error handling and recovery in safeCopy function to restore old binary if new file installation fails.
- Enhanced Windows DLL compatibility by staging new file to temp location before renaming, avoiding issues with loaded binaries.
2026-02-01 05:55:26 +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 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 e9e106da1b refactor(natives/wasm): restructured WASM module loading to use import.meta.resolve() for better resolution
- Refactored WASM module loading to use import.meta.resolve() instead of URL constructor for better module resolution.
2026-01-29 09:47:43 +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