Skip to content

Fully realizing tokio, async, building in diff, parallel & async IO, parallel file IO, Strings to string slices, atomics for async, everything goes faster while leaner, without changing much of what it 'does'... required edits to nearly everything.#27

Open
Azzybana wants to merge 75 commits intogabrielmaialva33:mainfrom
Azzybana:main

Conversation

@Azzybana
Copy link
Copy Markdown

Pull Request

Description

Major overhaul for speed. Fully realizes async and tokio, threads more things, parallel file IO, some enhancecd matrices for lookups, better hashing, converted Strings to string slices. Organized strings and constants. Major reduction in allocation overhead. I didn't touch user-facing functionality much. I'm sure there a few things. Also full dependency update.

See below..

Fixes # (issue)
commit e74e6ecee4d7d17aaa8bb1458438832cec363edf (HEAD -> main)
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Fri Oct 24 05:29:40 2025 -0400

🔖 Cargo.toml: Bump package version to 0.2.0 (tokio/async work)

commit b806505 (origin/main, origin/HEAD)
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Fri Oct 24 05:15:49 2025 -0400

♻️ bash_command.rs: Refactor send_ascii_to_interactive to use helper

commit 26473f4
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Fri Oct 24 05:14:44 2025 -0400

♻️ bash_command.rs: Add send_input_to_interactive helper and refactor send_text/send_special_keys

commit eb8a065
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Fri Oct 24 05:07:40 2025 -0400

♻️ file_write_or_edit.rs: Replace external diff/tempfile usage with similar::TextDiff

commit b84c865
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Fri Oct 24 05:04:02 2025 -0400

🐛 file_cache.rs: Fix premature return in memory check

commit 7558d42
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Fri Oct 24 05:03:25 2025 -0400

🐛 main.rs: Construct ShellInitializationError using message field

commit e6cec7b
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Fri Oct 24 05:02:14 2025 -0400

🐛 src/errors.rs: Treat 'permission denied' as CommandExecutionError
♻️ src/server.rs: Make AiClients pub to expose AI clients container
♻️ src/utils/command_safety.rs: Simplify long-running and background checks using iterator combinators

commit c2c7b56
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Fri Oct 24 04:56:46 2025 -0400

♻️ state/tools/utils: asyncify bash & terminal, simplify locks, refactor file cache

commit 38a17d7
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Fri Oct 24 04:06:44 2025 -0400

♻️ src: use Arc<String> for WinxError; migrate std::sync::Mutex -> tokio::sync::Mutex and asyncify terminal, caches, tools

commit e2e7438
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 23:48:34 2025 -0400

♻️ src/server.rs: simplify ReadFiles parallel-read futures and normalize path/glob mapping
♻️ src/types.rs: collect updated globs into HashSet in CodeWriterConfig
🎨 src/utils/mode_prompts.rs: support HashSet for globs/commands when joining and update tests

commit 8385b8e
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 23:40:00 2025 -0400

♻️ src/tools/read_files.rs: keep clean_path in async tasks; tidy bash_state lock & whitelist logic

commit 9744933
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 23:25:55 2025 -0400

🎨 file_write_or_edit.rs: Tidy CommandNotAllowed WinxError Arc::new formatting

commit e61aae3
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 23:25:33 2025 -0400

♻️ src: Replace WinxError string payloads with Arc<String>/Arc<Vec> and update call sites

commit 457197e
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 23:01:52 2025 -0400

♻️ src/tools: Use Arc<String> for WinxError message & suggestion payloads

commit 34a3c99
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 22:38:16 2025 -0400

♻️ src/tools/read_image.rs: Use Arc<String> for WinxError message payloads
♻️ src/utils/mmap.rs: Use Arc<String> for WinxError message payloads

commit 2a66b1f
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 22:36:17 2025 -0400

♻️ src/utils/mmap.rs: Use Arc<String> for WinxError message payloads

commit e54bdb7
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 22:32:45 2025 -0400

♻️ errors.rs: Convert WinxError to struct-style variants and update call sites

commit 48c41c1
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 22:15:51 2025 -0400

🧵 src/utils/resource_allocator.rs: Import Mutex for pending queue

commit 669f294
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 22:13:27 2025 -0400

♻️ src/tools/read_files.rs: Use Arc<String> for file access and task error messages
♻️ src/utils/command_safety.rs: Use Arc<String> for InteractiveCommandDetected.command
♻️ src/utils/error_predictor.rs: Use Arc<String> for BashStateLockError messages
♻️ src/utils/resource_allocator.rs: Replace Mutex with RwLock and use atomics for stats/cache

commit f0edac4
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 22:05:29 2025 -0400

♻️ src/errors.rs: Replace String with Arc<String> for error payloads

commit eab31ec
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 22:03:23 2025 -0400

♻️ src/types.rs: Use HashSet for AllowedGlobs/Commands; improve ReadFiles errors

commit 65e791e
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 21:58:03 2025 -0400

♻️ src/utils/error_predictor.rs: Use filter_map iterators for predictions; make helpers static

commit 6dce1e2
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 21:57:36 2025 -0400

♻️ src/utils/command_safety.rs: use lazy_static sets, simplify struct

commit fa6c323
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 21:51:27 2025 -0400

⚡ src/server.rs: parallelize handle_read_files with join_all

commit b882fe0
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 21:50:20 2025 -0400

♻️ src/server.rs: consolidate AI clients into AiClients with single mutex

commit 09cdb41
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 21:46:33 2025 -0400

♻️ src/server.rs: use mutex guards for AI clients; fix NVIDIA analysis/suggestions and improve explanation/codegen fallbacks

commit 08b144e
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 21:43:59 2025 -0400

♻️ src/server.rs: use mutex guard for execute_interactive, remove clone

commit 3f4b60e
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 21:42:57 2025 -0400

♻️ src/server.rs: move tool list to lazy_static CACHED_TOOLS

commit 7fbade5
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 21:40:32 2025 -0400

♻️ src/server.rs: use &'static str for version & project structure to reduce allocations

commit 0319c56
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 21:35:12 2025 -0400

♻️ src/server.rs: centralize PROJECT_STRUCTURE const & reduce allocations
⚡ src/utils/repo.rs: avoid allocations for dir output & tidy conditional formatting

commit a3c0037
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 21:06:07 2025 -0400

♻️ src/state/ansi_codes.rs: centralize ANSI_REGEX and remove duplicate defs

commit 574870e
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 21:04:46 2025 -0400

⚡ src/utils/fuzzy_match.rs: use mem::take to avoid cloning tokens

commit 0726bc8
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 21:03:53 2025 -0400

⚡ src/utils/fuzzy_match.rs: precompute lowercase & use flat contiguous DP vector for LCS

commit 594f76a
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 21:00:57 2025 -0400

♻️ multiple: use borrowed strings/Cow, centralize constants, refactor caching & templates

commit 7112041
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 17:47:26 2025 -0400

🚨 src/dashscope/client.rs: Import Backoff trait for ExponentialBackoff::next_backoff()

commit 879cc80
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 17:46:30 2025 -0400

♻️ src/dashscope/client.rs & Cargo.toml: rate limiter returns wait Duration; use ExponentialBackoff

commit 848bc51
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 17:44:02 2025 -0400

♻️ src/dashscope/client.rs: Replace counter window rate limiter with timestamp deque

commit 3683feb
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 17:39:43 2025 -0400

🐛 src/utils/path_analyzer.rs: Fix extension parsing; return Result from test helper and replace unwraps

commit 071a4fa
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 17:36:57 2025 -0400

♻️ src/tools/file_write_or_edit.rs: Refactor fuzzy-match flow (let-chain, auto-apply & suggestions)

commit 631819e
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 17:31:15 2025 -0400

♻️ src/nvidia/tests.rs: Flatten tests; remove #[cfg(test)] mod wrapper

commit 62c5ca5
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 17:29:07 2025 -0400

♻️ src/dashscope/client.rs: Use struct literal for DashScopeConfig in tests

commit fd76c69
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 17:27:32 2025 -0400

♻️ src/tools/file_write_or_edit.rs: Replace unwraps with expect; clean up formatting

commit 853529e
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 17:24:21 2025 -0400

♻️ src/tools/winx_chat.rs: Replace unwraps with Result/map_err, propagate errors, update tests

commit 0d7fdd2
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 17:20:48 2025 -0400

♻️ src/tools/winx_chat.rs: use let-chain for system-info, tidy format! calls, remove redundant test assignment

commit 93b6e8d
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 17:19:34 2025 -0400

♻️ src/gemini/client.rs: use struct literal for GeminiConfig in tests

commit e05e954
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 17:13:22 2025 -0400

♻️ src/tools/multi_file_editor.rs: simplify conditional checks with let-chain

commit 7185dc5
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 17:13:05 2025 -0400

♻️ src/utils/error_predictor.rs: simplify nested if-let checks using let-chain

commit 3ce9118
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 17:12:45 2025 -0400

♻️ src/utils/repo_context.rs: simplify git ignore check using let-chain

commit f54702b
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 17:12:25 2025 -0400

♻️ src/utils/repo.rs: simplify metadata/time checks using let-chain

commit b320ef9
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 17:11:54 2025 -0400

♻️ src/tools/read_files.rs: simplify bash_state lock/as_mut checks using let-chain

commit 715f8fb
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 17:11:35 2025 -0400

♻️ src/utils/path.rs: simplify expand_user using let-chain

commit 23fea78
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 17:11:21 2025 -0400

♻️ src/utils/pattern_analyzer.rs: simplify nested if-let checks with let-chains

commit d1ef555
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 17:10:41 2025 -0400

♻️ src/tools/winx_chat.rs: use let-chain to simplify system_info check

commit a5883de
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 17:10:12 2025 -0400

♻️ src/utils/memory_system.rs: simplify directory entry/file checks using let-chains

commit de69360
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 17:09:35 2025 -0400

♻️ src/utils/file_cache.rs: simplify nested if-let checks using let-chains

commit 3621afb
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 17:09:20 2025 -0400

♻️ src/utils/path_analyzer.rs: use is_empty() in context token test

commit 7fda639
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 17:08:49 2025 -0400

♻️ src/utils/mmap.rs: simplify test size literals in mmap tests

commit f3d9370
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 17:08:07 2025 -0400

♻️ src/utils/resource_allocator.rs: Simplify release/cache logic with let-chains

commit b0559e9
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 17:07:46 2025 -0400

♻️ src/tools/file_write_or_edit.rs: simplify search/replace and error recording using let-chains

commit 7f5d27b
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 17:07:28 2025 -0400

♻️ src/tools/context_save.rs: simplify open-command detection using let-chain

commit ea3f869
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 17:06:41 2025 -0400

♻️ src/tools/command_suggestions.rs: simplify last_command retrieval

commit 6ae5bb0
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 17:06:25 2025 -0400

♻️ src/tools/code_analyzer.rs: simplify dependency parsing and complexity checks with let-chains

commit a44d7bb
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 17:06:06 2025 -0400

♻️ src/tools/bash_command.rs: simplify guard/command-state check with let-chains

commit 990c8cd
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 17:05:16 2025 -0400

♻️ src/state/terminal.rs: simplify lock/cache conditionals with let-chains; use is_multiple_of

commit 5397526
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 17:04:48 2025 -0400

♻️ bash_state.rs: Use let-chains to simplify lock conditionals and elapsed checks

commit 747754d
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 17:04:27 2025 -0400

♻️ ansi_codes.rs: Use let-chains to simplify hex/seq parsing conditionals

commit 2903a5f
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 17:04:04 2025 -0400

✅ nvidia/tools/code_analysis.rs: use assert! / assert!(!) in tests

commit 3c2f087
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 17:03:22 2025 -0400

♻️ nvidia/models.rs: derive Default for NvidiaModel and remove manual impl

commit df36c92
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 17:01:23 2025 -0400

🎨 server.rs: add titles/icons for server/tools/resources/prompts

commit 95ec26d
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 16:54:05 2025 -0400

🙈 .gitignore: Update to exclude instructions

commit e99fdf3
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 16:23:55 2025 -0400

🚨 Handle unwrap() calls gracefully in resource allocator

commit d7e3d8f
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 16:18:44 2025 -0400

🚨 Handle unwrap() calls gracefully in error predictor

commit 6328545
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 16:16:43 2025 -0400

🐛 Fix bugs in error predictor

commit 2f68b84
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 16:16:12 2025 -0400

🐛 Fix bugs in bash state management

commit 71e2602
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 16:15:01 2025 -0400

⬆️ Bump dependency versions in Cargo.toml

commit c385fbe
Author: Azzybana Raccoon 121582001+Azzybana@users.noreply.github.com
Date: Thu Oct 23 16:12:44 2025 -0400

🙈 Added target to .gitignore

Type of change

Overhaul to fully utilize async functions for speed. MUCH rewriting.
Also, since it helps watching, moved to similar (crate) rather than relying on diff
Can diff by spawning a thread
With your lints, it's spotless, I prefer ALL lints, but that's me

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update
  • Performance improvement
  • Code refactoring
  • Documentation update

Changes Made

Core Changes

  • Modified MCP protocol implementation
  • Added/modified resources
  • Updated server capabilities

AI Integration Changes

  • DashScope/Qwen integration changes
  • NVIDIA NIM integration changes
  • Gemini integration changes

Infrastructure Changes

  • Build system changes - strays in gitignore
  • Dependency updates
  • Configuration changes
  • Performance optimizations

Testing

Test Coverage

  • Manual testing completed

Test Results

  • All existing tests pass
  • No performance regressions
  • Memory usage is acceptable

Testing Commands

Please list the commands used to test your changes:

# Example:
cargo test
cargo clippy
cargo fmt --check
cargo bench

Checklist

Code Quality

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Documentation

  • Updated README.md if needed
  • Updated API documentation
  • Added/updated code comments
  • Updated configuration examples
  • Added migration guide (for breaking changes)

MCP Protocol Compliance

  • Changes follow MCP protocol specifications
  • Server capabilities updated correctly
  • Tool schemas are valid
  • Resource URIs follow conventions
  • Prompt definitions are complete

Performance Impact

Benchmarks

If applicable, include benchmark results:

# Before:
[benchmark results]

# After:
[benchmark results]

Memory Usage

  • No significant memory usage increase
  • Memory leaks checked and resolved
  • Resource cleanup implemented

Network Usage

  • API calls are efficient
  • Proper error handling for network failures
  • Rate limiting considerations addressed

Breaking Changes

If this PR introduces breaking changes, please describe:

  1. What breaks:
  2. Why it was necessary:
  3. Migration path for users:
  4. Version compatibility:

Screenshots/Examples

If applicable, add screenshots or code examples to help explain your changes.

Additional Notes

Add any other notes about the PR here, including:

  • Known limitations
  • Future improvements planned
  • Alternative approaches considered
  • Dependencies on other PRs/issues

Reviewer Notes

Specific areas where you'd like reviewer focus:

  • Architecture decisions
  • Performance implications
  • Security considerations
  • Error handling
  • Test coverage
  • Documentation clarity

Related Issues/PRs

  • Closes #
  • Related to #
  • Depends on #
  • Blocks #

…ions

⚡ src/utils/repo.rs: avoid allocations for dir output & tidy conditional formatting
…s/suggestions and improve explanation/codegen fallbacks
…error messages

♻️ src/utils/command_safety.rs: Use Arc<String> for InteractiveCommandDetected.command
♻️ src/utils/error_predictor.rs: Use Arc<String> for BashStateLockError messages
♻️ src/utils/resource_allocator.rs: Replace Mutex with RwLock and use atomics for stats/cache
…loads

♻️ src/utils/mmap.rs: Use Arc<String> for WinxError message payloads
…ize path/glob mapping

♻️ src/types.rs: collect updated globs into HashSet in CodeWriterConfig
🎨 src/utils/mode_prompts.rs: support HashSet for globs/commands when joining and update tests
…kio::sync::Mutex and asyncify terminal, caches, tools
♻️ src/server.rs: Make AiClients pub to expose AI clients container
♻️ src/utils/command_safety.rs: Simplify long-running and background checks using iterator combinators
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant