64 Commits

Author SHA1 Message Date
can1357 e27afce0b2 feat: system prompt changes + better AST-grep guidance 2026-03-10 04:08:08 +01:00
can1357 2d732bb033 fix(coding-agent): resolved symlinked paths before passing to brush
- Resolved symlinked paths before passing to brush shell to keep `pwd` output aligned with canonical Git worktree paths.
- Added `resolveShellCwd` helper that safely resolves symlinks and falls back to original path on error.
- Added test case verifying symlinked directories are canonicalized before execution.
2026-03-09 15:39:05 +01:00
can1357 0a3c192d7d fix(pi-natives): bound shell reader shutdown wait
Fixes #230
2026-03-01 11:40:25 +01:00
can1357 76a921f284 fix: apply non-interactive env to all bash execution paths
The non-interactive environment variables (pager, editor, and prompt
suppression) were only applied in the PTY (interactive) bash path.
The non-PTY executeBash path had no such defaults, so commands could
block on pagers or credential prompts.

- Extract NO_PAGER_ENV from bash-interactive.ts into shared
  non-interactive-env.ts module (renamed to NON_INTERACTIVE_ENV)
- Apply it in executeBash (non-PTY) with user overrides taking
  precedence
- Fix ordering in interactive PTY path so user env overrides
  the defaults (was reversed)
- Add test verifying defaults are applied alongside user env
2026-02-24 02:57:43 +01:00
can1357 e4225d6829 refactor(coding-agent): consolidated output utilities into streaming-output module
- Consolidated truncation and output utilities from tools/truncate.ts and tools/output-utils.ts into session/streaming-output.ts with improved UTF-8 boundary handling.
- Renamed formatSize() to formatBytes() across codebase for consistency and clarity in byte-level formatting.
- Refactored OutputSink to use windowed byte truncation instead of full-buffer encoding, improving memory efficiency on large outputs.
- Migrated from Buffer to Uint8Array in web scrapers for better cross-platform compatibility and native browser support.
- Added getArtifactManager() lazy-initialization method to ToolSession for deferred artifact manager instantiation.
- Simplified API surface with wildcard exports from tools and session modules, reducing import complexity.
2026-02-22 01:02:26 +01:00
can1357 0b1514da61 feat(coding-agent): added overlay UI option and fixed viewport sync race conditions
- Added overlay option to custom UI hooks for bottom-centered component display.
- Added automatic chat transcript rebuild when returning from custom or debug UI modes.
- Fixed race condition in bash interactive component preventing output append after closure.
- Extracted environment variable configuration into reusable NO_PAGER_ENV constant for bash execution.
- Fixed viewport synchronization issue in TUI causing terminal desync during full re-renders.
2026-02-21 22:52:59 +01:00
can1357 fc2c3c2c7c fix(coding-agent): corrected shell session state reset and hard timeout handling for command execution
- Fixed persistent shell session state not being reset after command abort or hard timeout.
- Fixed hard timeout handling to properly interrupt long-running commands exceeding grace period.
- Introduced hard timeout mechanism with Promise.race() to enforce absolute timeout limit and prevent command hangs.
- Replaced shell command execution with explicit timeout and SIGKILL signal handling in shell-snapshot.
- Simplified bash command normalization to use only explicit head/tail parameters from tool input.
- Exported getAntigravityUserAgent() function for centralized User-Agent header construction.
2026-02-21 16:52:37 +01:00
can1357 a777ad179d fix(coding-agent): fixed bash tool hanging and file size validation for large @mentions
- Fixed bash tool hanging with background jobs by implementing timeout-based cancellation and draining stdout/stderr pipes instead of waiting indefinitely for EOF.
- Fixed crash when auto-reading large @mentions by adding file size validation (5MB for text, 25MB for images) before reading file contents.
- Prevented out-of-memory issues by skipping files exceeding size limits and displaying file size information in UI for skipped files.
- Added GB file size formatting support to handle very large files in human-readable format.
- Added file size display in UI for skipped files to inform users why files were not included.
- Added test case verifying bash executor returns correctly when command spawns background jobs.
2026-02-10 03:26:43 +01:00
can1357 1a2e833974 feat: added Windows process handle duplication and signal handling for safe job termination
- Added Windows-specific process handle duplication mechanism to safely manage process termination across multiple handles.
- Implemented Windows signal handling support with Signal enum variants (Terminate, Kill, Interrupt) and kill_process() function using Windows API.
- Added background job termination on cancellation with platform-specific implementations (TERM/KILL signals on Unix, TerminateProcess on Windows).
- Implemented cancellation token support in shell execution with proper cleanup of background jobs when timeout or abort occurs.
- Added test coverage for background job termination on timeout and abort scenarios.
2026-02-05 08:10:52 +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 ec801665bc refactor(env): migrated environment variables from OMP_ to PI_ prefix and centralized access via getEnv()
- Migrated environment variable access from direct process.env to centralized getEnv() utility function across all packages.
- Renamed environment variable prefix from OMP_ to PI_ throughout codebase (e.g., OMP_CODING_AGENT_DIR -> PI_CODING_AGENT_DIR).
- Removed automatic environment variable migration from PI_ to OMP_ prefixes via migrate-env.ts module.
- Removed env setting from configuration schema and applyEnvironmentVariables() method from settings.
- Updated CI/CD build configuration to use PI_COMPILED flag instead of OMP_COMPILED.
- Changed venvPath property in PythonRuntime from nullable (string | null) to optional (string | undefined).
2026-02-05 02:55:01 +01:00
can1357 dbf4eeaf97 test(coding-agent): added test cases verifying spawned processes are properly killed on timeout and abort signals
- Added test cases verifying that spawned processes are properly killed on timeout and abort signals instead of being orphaned.
2026-02-01 19:28:21 +01:00
can1357 49a24cf27b build(deps): vendored brush-core crate locally for development and patching
- Vendored brush-core crate locally to enable local development and patching.
- Added patch.crates-io section in Cargo.toml to redirect brush-core dependency to vendored version at crates/brush-core-vendored.
- Updated pi-natives Cargo.toml to use local path dependency for brush-core instead of external crate version.
2026-02-01 19:04:16 +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