Commit Graph

722 Commits

Author SHA1 Message Date
can1357 fccc0ed3ce chore: bump version to 16.2.12 2026-07-01 05:29:19 +02:00
can1357 db8c79cc93 style: apply formatter and fix devin test enum
biome + cargo fmt over merge-sweep eval-fix commits; correct StopReason.END_TURN (nonexistent) to StopReason.FUNCTION_CALL in devin streaming test
2026-07-01 04:45:28 +02:00
can1357 8cc7520e47 merge PR #3954: fix(pi-shell): wired fd directory walk to observe scope cancellation 2026-07-01 04:40:39 +02:00
roboomp c303da9c62 test(pi-shell): tightened fd cancel-heartbeat coverage per PR #3954 review
The two search()-level cancel tests (`fallback_walk_observes_cancel_flag`
/ `fast_walk_observes_cancel_flag`) pre-set the cancel flag before
invoking search(), but search() and try_search_fast each have a
pre-loop guard that breaks out on cancelled before either walker call
is invoked. That means both tests still pass with the walker call
sites reverted to no-op heartbeats, so they don't defend the fix.

Replace them with symmetric walker-level tests that drive the two
walker APIs fd uses:

- `cancel_heartbeat_aborts_collect_with_heartbeat` — the fallback
  path's `collect_with_heartbeat` call; asserts WalkError::Interrupted
  (was `cancel_heartbeat_aborts_walker_when_flag_is_set`, renamed for
  API-specific clarity and given a filler-file seed so the outcome
  shows a real drain on regression).
- `cancel_heartbeat_aborts_for_each_entry_with_heartbeat` — the fast
  path's streaming API; asserts WalkError::Interrupted AND that the
  visitor never received any entry.

Both fail against the pre-fix no-op heartbeat with WalkStatus::Complete
/ a fully drained WalkOutcome. Keep
`walk_completes_normally_when_cancel_flag_is_unset` as the positive
regression pin — that path does exercise search() end to end because
the outer guard passes with cancelled=false.
2026-07-01 01:18:41 +00:00
roboomp 3bb2ade643 fix(pi-shell): wired fd directory walk to observe scope cancellation
The in-process fd builtin passed no-op heartbeats to pi_walker for
both its gitignore-respecting fallback path (`collect_with_heartbeat`
in `search`) and its fast path (`for_each_entry_with_heartbeat` in
`try_search_fast`), so cancellation of a large or slow directory walk
was deferred until traversal completed. The shell wrapper flips the
shared `AtomicBool` cancel flag when the runtime cancellation token
fires and then awaits the blocking task; with no heartbeat hookup the
walker had no way to observe the flag mid-walk and kept collecting the
whole tree before the wrapper could return exit 130.

Introduce `cancel_heartbeat(&AtomicBool)` — the walker-level heartbeat
that returns `io::ErrorKind::Interrupted` when the flag is set — and
plug it into both walker calls. Both call sites recognize the resulting
`WalkError::Interrupted` alongside `cancelled` and break silently
instead of surfacing an `fd:` diagnostic on stderr; the shell wrapper
owns the user-visible exit code.

Regression cover: a walker-level test pre-sets the cancel flag and
asserts `collect_with_heartbeat(cancel_heartbeat(&flag))` surfaces
`WalkError::Interrupted` instead of collecting the tree; two
higher-level `search` tests exercise the silent break for both the
fallback and fast paths; a fourth pins the non-cancelled contract so
the added heartbeat can't stall normal searches. Neuter the helper to
a no-op and the walker-level test fails with the pre-fix `WalkOutcome`
showing every entry scanned — the exact bug the issue reports.

Fixes #3949
2026-07-01 01:08:48 +00:00
can1357 b2a859a7c5 chore: bump version to 16.2.11 2026-07-01 03:06:34 +02:00
can1357 2e8c012eec Merge remote-tracking branch 'origin/farm/3cd77781/bound-ast-search-pages' 2026-07-01 02:57:36 +02:00
can1357 6e9ae7adc7 Merge remote-tracking branch 'origin/farm/a032fc7d/grep-rg-walker-cancel-heartbeat' 2026-07-01 02:57:24 +02:00
can1357 266dca118f refactor(pi-walker): made file type conversion helper functions const
- Converted `file_type_from_dtype` and `file_type_from_mode` into const functions.
- Removed the unused `OsStringExt` import.
2026-07-01 02:56:16 +02:00
roboomp 12b25eb349 fix(ast): materialized retained match text at retention time
Previously each retained match cloned an Arc to the whole source, keeping large generated/vendor files alive until the scan finished. Now the retained heap stores just the per-match matched text, so the retained payload stays bounded to the small span even when a broad page window keeps a few matches from very large files.

Refs #3935
2026-07-01 00:25:50 +00:00
roboomp f40214032a style: bun run fix 2026-06-30 23:54:23 +00:00
roboomp 578a2d7626 fix(ast): bounded ast search pagination payloads
Retained only the requested AST search page window in native ast_grep/ast_match and the coding-agent multi-target wrapper while preserving exact totals.

Fixes #3935
2026-06-30 23:54:17 +00:00
roboomp 6440adebf0 fix(uutils): surfaced rg files cancellation to caller
rg --files used collect_filtered_files for directory operands. When a
walker heartbeat observed the uutils cancellation flag, the helper
returned Ok(Vec::new()), making the caller treat the aborted walk like an
empty directory.

Return an error for cancelled collection and let rg --files / sorted rg
callers map it to a silent had-error outcome, stopping later operands
without writing post-cancel output.

Fixes #3933
2026-06-30 23:50:54 +00:00
roboomp 16ef314e9c fix(uutils): stopped grep rg operands after cancellation
Recursive grep and rg already stopped the active directory walk when the
uutils scope cancel flag was observed, but the outer operand loop could
still continue into later regular-file operands before the shell wrapper
returned 130.

Stop subsequent grep, rg, and rg --files operands once cancellation is
set. Extend the cancellation regressions with a later regular-file
operand so the tests cover the exact post-directory continuation case.

Fixes #3933
2026-06-30 23:47:34 +00:00
roboomp dbab0ef84d fix(uutils): wired grep/rg directory walks to observe scope cancellation
The grep and rg in-process builtins passed no-op heartbeats to pi_walker
when recursing into a directory, so the uutils scope's cancel flag was
ignored mid-walk. The shell wrapper sets that flag on abort/timeout and
then awaits the blocking task — with no heartbeat hookup, a cancelled
recursive grep/rg waited for the whole tree to be scanned before the
shell could return exit 130.

Add pi_uutils_ctx::is_cancelled() and have grep's search_dir, rg's
search_dir, and rg's collect_filtered_files supply heartbeats that
return io::ErrorKind::Interrupted when the flag is set. The walker maps
that to WalkError::Interrupted, which the utilities now silently treat
as a harness cancellation (no spurious 'native directory scan
interrupted' on the command's stderr — the shell wrapper owns the
user-visible exit code).

Regression tests pre-set the cancel flag and assert grep -r /
rg / rg --files exit without scanning the matching file in the tree.

Fixes #3933
2026-06-30 23:37:20 +00:00
can1357 ebdc7280cb chore: bump version to 16.2.10 2026-07-01 00:54:29 +02:00
can1357 bdb33a184d feat(coding-agent/modes): tracked and migrate stream-key placeholders for tool calls
- Added `#streamTurnNonce` to prevent aborted streaming turns from corrupting content indexes of subsequent messages.
- Implemented temporary stream-key generation using content position and turn nonces for previewing tool calls without native IDs.
- Added migration logic to key pending tool previews by their real ID and rekey `ToolArgsRevealController` once the real ID is parsed.
2026-07-01 00:34:21 +02:00
can1357 7c0e64dbd9 refactor: streamlined directory traversal by consolidating native scanners and removing fallback walker
- Removed the ignore-based fallback walker implementation and its associated dependencies.
- Simplified the directory traversal to consistently use native scanners across all platforms.
- Eliminated `WalkError::Unsupported` and `WalkStatus::Unsupported` error handling across all dependent crates.
- Added a depth-first sorting fallback for native traversal and implemented recursion detection using a symlink stack.
2026-07-01 00:24:27 +02:00
can1357 6f657daa4c feat(pi-walker): configured walk builder to not require a git repository
- Disabled the git repository requirement in the WalkBuilder configuration when git features are enabled.
2026-07-01 00:01:12 +02:00
can1357 13b1b5b134 refactor: migrated concurrency primitives to flume and parking_lot
- Replaced standard and tokio mpsc channels with flume channels across workspace crates to simplify thread synchronization.
- Swapped standard Mutex guards for parking_lot Mutexes to avoid manual lock poisoning handling and improve performance.
- Declared workspace-wide dependencies for flume and parking_lot in root and member Cargo manifests.
2026-06-30 23:45:42 +02:00
can1357 daf3aaa508 feat(pi-natives): implemented two-pass search to partially grep large files
- Introduced a two-pass file processing architecture with `ReadPolicy` and `FileOutcome` state tracking.
- Deferred oversized files to a second pass where only their leading segment is read and searched.
- Integrated the two-pass processing logic into both sequential and native parallel grep execution paths.
- Updated agent tool definitions and user-visible messages to reflect partial coverage of large files instead of skipping them.
2026-06-30 23:37:49 +02:00
can1357 31d9fb1145 refactor: consolidated filesystem traversal into a dedicated library
- Replaced custom fast-walk and fs-cache implementations in pi-natives with a new dedicated pi-walker library.
- Integrated the thread-safe, parallel pi-walker library across pi-natives, pi-shell, pi-uu-grep, and uu-find.
- Rewrote file search, fuzzy finding, and glob-matching logic to leverage pi-walker configurations and visitor traits.
- Optimized shell process tracking in pi-shell by replacing global descendant-diff logic with an isolated, per-run SpawnRegistry.
- Added parallel rayon-based walking and optimized fast paths for directory scanning and entry classification.
2026-06-30 23:25:50 +02:00
can1357 126e3adf72 feat(vendor/brush-core): added spawn observer hook for tracking launched external processes
- Added a `SpawnObserver` trait to intercept freshly spawned external command PIDs and process group IDs.
- Exposed `set_spawn_observer` and `spawn_observer` on `ExecutionParameters` to allow tracking process lifecycles.
- Triggered the observer on successful external command execution unless the process is detached or reparented.
2026-06-30 21:27:27 +02:00
can1357 5c7c9b2b97 feat(pi-natives): implemented platform-native fast directory traversal
- Added a platform-native fast filesystem traversal implementation leveraging `getattrlistbulk` on macOS, `getdents64` and `statx` on Linux, and `NtQueryDirectoryFile` on Windows.
- Integrated the fast traversal path as a preferred, high-performance fallback before standard walk operations in both cache collection and streaming search routines.
- Consolidated grep search logic by extracting a unified file-matching helper to support both standard and fast-walk execution paths.
- Introduced platform-specific Windows system dependency configurations and unit tests validating correct hidden-file filtering during scanning.
2026-06-30 20:37:25 +02:00
can1357 b6c9747d45 chore: bump version to 16.2.9 2026-06-30 18:01:59 +02:00
can1357 5bc68f57cd chore: bump version to 16.2.8 2026-06-30 11:58:55 +02:00
can1357 38250ce88b chore: bump version to 16.2.7 2026-06-30 07:20:23 +02:00
can1357 242705c06c feat: enabled dynamic font rendering with CJK and unicode support
- Added Silver.ttf TrueType font support to `pi-natives` with automated fallback logic for bitmap font rendering.
- Implemented wide code point detection and cell-width calculation to improve CJK character handling and layout.
- Introduced dynamic font-aware preflight probing via `resolveShapeForText` and `renderabilityProbeText` for better font selection.
- Enabled semantic emoji folding and improved text normalization to handle non-Latin characters and emoji filtering.
2026-06-30 02:49:31 +02:00
can1357 0ba736f5bc chore: bump version to 16.2.6 2026-06-29 20:14:08 +02:00
can1357 695b46aa48 chore: bump version to 16.2.5 2026-06-28 23:28:47 +02:00
roboomp 89cee6a4d5 fix(grep-builtin): accept --color/--colour/--version
The in-process grep builtin in pi-shell (backed by pi-uu-grep) shadowed /usr/bin/grep with a clap subset that rejected three universal GNU-grep flags. The common bashrc alias 'grep --color=auto' guaranteed that bare 'grep' in any pipeline failed with exit 2, and probes like 'grep --version' from shell startup scripts errored out the same way.

Add --color[=WHEN] (alias --colour) as an accepted-and-ignored flag — the builtin writes to in-process file descriptors, never a TTY, so injecting ANSI escapes would corrupt downstream consumers. Add --version routed through clap so it lands on the context stdout via the same path as --help.

Fixes #3755
2026-06-28 21:16:09 +00:00
can1357 7bbaebda24 chore: bump version to 16.2.4 2026-06-28 20:43:59 +02:00
can1357 4c3c2fc3e3 chore: update chanelogs 2026-06-28 20:43:32 +02:00
can1357 82a5ba5d47 fix(cross-cutting): caught and recover from utility panics
- Switch build profile to `panic = "unwind"` to allow catching panics in vendored uutils code.
- Add `run_caught` to wrap utility execution in `catch_unwind`, converting panics into non-zero exit codes.
- Update `pi-natives` to distinguish between recoverable utility panics and fatal process crashes, preventing recovered panics from appearing in user-facing crash reports.
2026-06-28 20:42:04 +02:00
can1357 6a39d4d3fc fix(vendor/uu-tail): prevented panic on broken pipe during bounded tail
- Propagated IO errors from the bounded tail internal logic to avoid panics.
- Updated `print_target_section` to return `io::Result` instead of unwrapping.
- Added a test case to verify that `BrokenPipe` is correctly surfaced when the consumer closes the pipe.
2026-06-28 20:37:36 +02:00
can1357 96be45c3bf chore: bump version to 16.2.3 2026-06-28 17:29:35 +02:00
can1357 e22f6517f8 refactor: migrated format_usage to pi-uutils-ctx
- Implement an argv-independent `format_usage` within `pi-uutils-ctx`.
- Update all vendor crates to import the function from the new location.

Fixes #3727
2026-06-28 17:05:52 +02:00
can1357 743d26bea0 feat: improved robustness by falling back to literal matching for invalid regex
- Added a fallback mechanism to treat invalid regex patterns as literal search strings instead of aborting.
- Implemented a targeted recovery for unclosed or extra parentheses that attempts to escape only the problematic characters while preserving active regex syntax.
- Updated `pi-uu-grep` to perform pattern-specific fallback when multiple search strings are provided.
- Added regression tests to verify graceful degradation for invalid patterns alongside standard regex operation.
2026-06-28 09:57:25 +02:00
can1357 381a77afee feat(pi-uu-grep): implemented per-pattern regex fallback logic
- Added a fallback mechanism that recovers from invalid regex patterns by treating them as literals instead of failing.
- Enabled this behavior by default, allowing valid regex alternatives to retain their functionality when mixed with invalid patterns.
- Updated the extended regex flag to enforce strict syntax parsing and return errors for invalid patterns.
2026-06-28 09:49:04 +02:00
can1357 24341e4abf chore: bump version to 16.2.2 2026-06-27 13:24:46 +02:00
can1357 d738329485 chore: bump version to 16.2.1 2026-06-27 06:35:42 +02:00
can1357 7463818a32 chore: bump version to 16.2.0 2026-06-27 04:39:59 +02:00
can1357 011f036ef5 chore: bump version to 16.1.23 2026-06-26 18:29:01 +02:00
can1357 60e02d2e6d fix(pi-shell): satisfied clippy trivially-copy and or-fun-call lints
- pass fs::FileType by value in matches_unix_file_type (Copy type)
- swap unwrap_or for unwrap_or_else in parse_utc_datetime to defer fallback
2026-06-26 18:28:36 +02:00
can1357 70a439ace3 feat(pi-shell): implemented fd filesystem search builtin
- Added an `fd` command-line utility for searching the filesystem.
- Implemented file filtering capabilities for type, size, modification time, and ownership.
- Integrated directory traversal and ignore-pattern support for search optimization.
- Registered the builtin in the shell and added comprehensive integration tests for filtering and globbing.
2026-06-26 17:35:59 +02:00
can1357 40e56a6318 Merge PR #3562: resume by ID, Nix/Mermaid highlighting (@arg3t)
# Conflicts:
#	packages/coding-agent/test/issue-3461-repro.test.ts
2026-06-26 17:07:48 +02:00
can1357 39a055a1e5 feat: implemented ripgrep-based rg shell builtin
- Implemented `rg` shell builtin using ripgrep libraries to enable file and directory searching.
- Added `RgSink` to handle output formatting, context, and vimgrep compatibility.
- Updated shell context and IO flags to support stdin as search input.
- Added integration tests for directory recursion, ignore filtering, and stdin handling.
2026-06-26 16:33:05 +02:00
can1357 02f870fb20 feat: supported markdown section operations for block edits
- Added tree-sitter markdown support to resolve headings into full sections in `pi-ast`.
- Enabled block operations (`SWAP.BLK`, `DEL.BLK`, `INS.BLK.POST`) on markdown headings so they encompass the entire section, including nested deeper headings.
- Updated system prompt to guide agents in using structured markdown heading edits for plans.
- Fixed `plan-mode-guard` to correctly resolve local protocol options for subagents.
2026-06-26 16:14:23 +02:00
can1357 c39b655ae7 feat: implemented -q and -x flags for in-process grep
- Added support for `--quiet` (`-q`) and `--line-regexp` (`-x`) to the `grep` builtin.
- Enabled short-circuiting behavior for `-q` to suppress output and return early on the first match.
- Configured exit status logic to prioritize successful matches over error states when using `-q`.
- Added integration tests to verify correct exit status codes and line anchoring behavior.
2026-06-26 15:47:24 +02:00
arg3t 17f91f04ec test(natives): cover vendored syntax definitions in Rust 2026-06-26 06:18:46 -07:00