Compare commits
5 Commits
micn/libvi
...
ripgrep
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6a4be9ddd7 | ||
|
|
2a44fbb7b2 | ||
|
|
4bf0f71bbd | ||
|
|
c1ce3038d8 | ||
|
|
4b1694b308 |
5
.cargo/config.toml
Normal file
5
.cargo/config.toml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
[target.aarch64-apple-darwin]
|
||||||
|
rustflags = ["-C", "link-args=-Wl,-rpath,@executable_path"]
|
||||||
|
|
||||||
|
[target.x86_64-apple-darwin]
|
||||||
|
rustflags = ["-C", "link-args=-Wl,-rpath,@executable_path"]
|
||||||
14
README.md
14
README.md
@@ -14,6 +14,7 @@ The heart of the agent system, containing:
|
|||||||
- **Context Window Management**: Intelligent tracking of token usage with context thinning (50-80%) and auto-summarization at 80% capacity
|
- **Context Window Management**: Intelligent tracking of token usage with context thinning (50-80%) and auto-summarization at 80% capacity
|
||||||
- **Tool System**: Built-in tools for file operations, shell commands, computer control, TODO management, and structured output
|
- **Tool System**: Built-in tools for file operations, shell commands, computer control, TODO management, and structured output
|
||||||
- **Streaming Response Parser**: Real-time parsing of LLM responses with tool call detection and execution
|
- **Streaming Response Parser**: Real-time parsing of LLM responses with tool call detection and execution
|
||||||
|
- **Smart Project Awareness**: Automatically detects and respects `.gitignore` patterns, informing the agent about ignored files
|
||||||
- **Task Execution**: Support for single and iterative task execution with automatic retry logic
|
- **Task Execution**: Support for single and iterative task execution with automatic retry logic
|
||||||
|
|
||||||
#### **g3-providers**
|
#### **g3-providers**
|
||||||
@@ -97,7 +98,10 @@ These commands give you fine-grained control over context management, allowing y
|
|||||||
- **Final Output**: Formatted result presentation
|
- **Final Output**: Formatted result presentation
|
||||||
|
|
||||||
### Provider Flexibility
|
### Provider Flexibility
|
||||||
- Support for multiple LLM providers through a unified interface
|
|
||||||
|
### Smart Project Awareness
|
||||||
|
|
||||||
|
- Automatically detects and respects `.gitignore` when present
|
||||||
- Hot-swappable providers without code changes
|
- Hot-swappable providers without code changes
|
||||||
- Provider-specific optimizations and feature support
|
- Provider-specific optimizations and feature support
|
||||||
- Local model support for offline operation
|
- Local model support for offline operation
|
||||||
@@ -136,8 +140,12 @@ G3 is designed for:
|
|||||||
# Build the project
|
# Build the project
|
||||||
cargo build --release
|
cargo build --release
|
||||||
|
|
||||||
# Run G3
|
# Run from the build directory
|
||||||
cargo run
|
./target/release/g3
|
||||||
|
|
||||||
|
# Or copy both files to somewhere in your PATH (macOS only needs both files)
|
||||||
|
cp target/release/g3 ~/.local/bin/
|
||||||
|
cp target/release/libVisionBridge.dylib ~/.local/bin/ # macOS only
|
||||||
|
|
||||||
# Execute a task
|
# Execute a task
|
||||||
g3 "implement a function to calculate fibonacci numbers"
|
g3 "implement a function to calculate fibonacci numbers"
|
||||||
|
|||||||
11
build.rs
11
build.rs
@@ -1,11 +0,0 @@
|
|||||||
use std::env;
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
// Only add rpaths on macOS
|
|
||||||
if env::var("CARGO_CFG_TARGET_OS").unwrap() == "macos" {
|
|
||||||
// Add rpath so libVisionBridge.dylib can be found at runtime
|
|
||||||
// @executable_path means "relative to the executable"
|
|
||||||
println!("cargo:rustc-link-arg=-Wl,-rpath,@executable_path");
|
|
||||||
println!("cargo:rustc-link-arg=-Wl,-rpath,@loader_path");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
use std::env;
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
// Only add rpaths on macOS
|
|
||||||
if env::var("CARGO_CFG_TARGET_OS").unwrap() == "macos" {
|
|
||||||
// Add rpath so libVisionBridge.dylib can be found at runtime
|
|
||||||
// @executable_path means "relative to the executable"
|
|
||||||
println!("cargo:rustc-link-arg=-Wl,-rpath,@executable_path");
|
|
||||||
println!("cargo:rustc-link-arg=-Wl,-rpath,@loader_path");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
76
crates/g3-core/src/gitignore_prompt_tests.rs
Normal file
76
crates/g3-core/src/gitignore_prompt_tests.rs
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
#[cfg(test)]
|
||||||
|
mod gitignore_prompt_tests {
|
||||||
|
use crate::Agent;
|
||||||
|
use crate::ui_writer::UiWriter;
|
||||||
|
|
||||||
|
// Mock UI writer for testing
|
||||||
|
struct MockUiWriter;
|
||||||
|
|
||||||
|
impl UiWriter for MockUiWriter {
|
||||||
|
fn print_agent_prompt(&self) {}
|
||||||
|
fn print_agent_response(&self, _text: &str) {}
|
||||||
|
fn print(&self, _message: &str) {}
|
||||||
|
fn print_inline(&self, _message: &str) {}
|
||||||
|
fn print_tool_output_line(&self, _line: &str) {}
|
||||||
|
fn print_system_prompt(&self, _text: &str) {}
|
||||||
|
fn print_tool_header(&self, _tool_name: &str) {}
|
||||||
|
fn print_tool_arg(&self, _key: &str, _value: &str) {}
|
||||||
|
fn print_tool_output_header(&self) {}
|
||||||
|
fn update_tool_output_line(&self, _line: &str) {}
|
||||||
|
fn print_tool_output_summary(&self, _total_lines: usize) {}
|
||||||
|
fn print_tool_timing(&self, _duration: &str) {}
|
||||||
|
fn print_context_status(&self, _message: &str) {}
|
||||||
|
fn print_context_thinning(&self, _message: &str) {}
|
||||||
|
fn println(&self, _text: &str) {}
|
||||||
|
fn flush(&self) {}
|
||||||
|
fn notify_sse_received(&self) {}
|
||||||
|
fn wants_full_output(&self) -> bool { false }
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_gitignore_prompt_snippet_with_file() {
|
||||||
|
// Create a temporary .gitignore file
|
||||||
|
let test_gitignore = "# Test comment\ntarget/\n*.log\n\n# Another comment\nlogs/\n";
|
||||||
|
std::fs::write(".gitignore.test", test_gitignore).unwrap();
|
||||||
|
|
||||||
|
// Temporarily rename actual .gitignore if it exists
|
||||||
|
let has_real_gitignore = std::path::Path::new(".gitignore").exists();
|
||||||
|
if has_real_gitignore {
|
||||||
|
std::fs::rename(".gitignore", ".gitignore.backup").unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Rename test file to .gitignore
|
||||||
|
std::fs::rename(".gitignore.test", ".gitignore").unwrap();
|
||||||
|
|
||||||
|
let snippet = Agent::<MockUiWriter>::get_gitignore_prompt_snippet();
|
||||||
|
|
||||||
|
// Restore original .gitignore
|
||||||
|
std::fs::remove_file(".gitignore").unwrap();
|
||||||
|
if has_real_gitignore {
|
||||||
|
std::fs::rename(".gitignore.backup", ".gitignore").unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
assert!(snippet.contains("IMPORTANT"));
|
||||||
|
assert!(snippet.contains(".gitignore"));
|
||||||
|
assert!(snippet.contains("target/"));
|
||||||
|
assert!(snippet.contains("*.log"));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_gitignore_prompt_snippet_without_file() {
|
||||||
|
// Temporarily rename .gitignore if it exists
|
||||||
|
let has_gitignore = std::path::Path::new(".gitignore").exists();
|
||||||
|
if has_gitignore {
|
||||||
|
std::fs::rename(".gitignore", ".gitignore.backup").unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
let snippet = Agent::<MockUiWriter>::get_gitignore_prompt_snippet();
|
||||||
|
|
||||||
|
// Restore .gitignore
|
||||||
|
if has_gitignore {
|
||||||
|
std::fs::rename(".gitignore.backup", ".gitignore").unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
assert_eq!(snippet, "");
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user