Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 28 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Checkout sibling dependencies
run: |
git clone --depth 1 https://github.com/broomva/aiOS.git ../aiOS
git clone --depth 1 https://github.com/broomva/lago.git ../lago
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
Expand All @@ -30,6 +34,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Checkout sibling dependencies
run: |
git clone --depth 1 https://github.com/broomva/aiOS.git ../aiOS
git clone --depth 1 https://github.com/broomva/lago.git ../lago
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
Expand All @@ -46,6 +54,10 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Checkout sibling dependencies
run: |
git clone --depth 1 https://github.com/broomva/aiOS.git ../aiOS
git clone --depth 1 https://github.com/broomva/lago.git ../lago
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo test --workspace
Expand All @@ -56,6 +68,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Checkout sibling dependencies
run: |
git clone --depth 1 https://github.com/broomva/aiOS.git ../aiOS
git clone --depth 1 https://github.com/broomva/lago.git ../lago
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo build --workspace --release
Expand All @@ -65,9 +81,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Checkout sibling dependencies
run: |
git clone --depth 1 https://github.com/broomva/aiOS.git ../aiOS
git clone --depth 1 https://github.com/broomva/lago.git ../lago
- uses: dtolnay/rust-toolchain@master
with:
toolchain: "1.80.0"
toolchain: "1.88.0"
- uses: Swatinem/rust-cache@v2
- run: cargo check --workspace

Expand All @@ -85,4 +105,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: EmbarkStudios/cargo-deny-action@v2
- name: Checkout sibling dependencies
run: |
git clone --depth 1 https://github.com/broomva/aiOS.git ../aiOS
git clone --depth 1 https://github.com/broomva/lago.git ../lago
- uses: dtolnay/rust-toolchain@stable
- run: cargo install cargo-deny --locked
- run: cargo deny check
108 changes: 105 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ serde_yaml = "0.9"
wait-timeout = "0.2"
walkdir = "2"
clap = { version = "4", features = ["derive"] }
dirs = "6"
toml = "0.8"
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }

Expand Down
2 changes: 1 addition & 1 deletion crates/arcan-core/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ mod tests {
make_msg(Role::System, "sys"),
make_msg(Role::User, "q1"),
make_msg(Role::Assistant, "calling tool"),
ChatMessage::tool_result("call-1", &"x".repeat(500)),
ChatMessage::tool_result("call-1", "x".repeat(500)),
make_msg(Role::User, "current"),
];

Expand Down
2 changes: 1 addition & 1 deletion crates/arcan-core/src/context_compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ mod tests {
let result = compile_context(&blocks, &config);
// Should keep Persona (255) and Rules (200), drop Memory (50) and Retrieval (30)
assert!(result.system_messages.len() <= 3);
assert!(result.dropped_blocks.len() >= 1);
assert!(!result.dropped_blocks.is_empty());
// Persona should always be there
assert!(
result
Expand Down
6 changes: 1 addition & 5 deletions crates/arcan-core/src/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -699,11 +699,7 @@ mod tests {
}

fn execute(&self, call: &ToolCall, _ctx: &ToolContext) -> Result<ToolResult, CoreError> {
let value = call
.input
.get("value")
.cloned()
.unwrap_or_else(|| json!(null));
let value = call.input.get("value").cloned().unwrap_or(json!(null));
Ok(ToolResult {
call_id: call.call_id.clone(),
tool_name: call.tool_name.clone(),
Expand Down
39 changes: 39 additions & 0 deletions crates/arcan-provider/src/anthropic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,45 @@ impl AnthropicConfig {
base_url,
})
}

/// Create config from resolved CLI settings.
///
/// API key is always read from env (never from config file).
/// Other settings use the provided overrides, falling back to env vars.
pub fn from_resolved(
model_override: Option<&str>,
base_url_override: Option<&str>,
max_tokens_override: Option<u32>,
) -> Result<Self, CoreError> {
let api_key = std::env::var("ANTHROPIC_API_KEY").map_err(|_| {
CoreError::Provider("ANTHROPIC_API_KEY environment variable not set".to_string())
})?;

let model = model_override
.map(String::from)
.or_else(|| std::env::var("ANTHROPIC_MODEL").ok())
.unwrap_or_else(|| "claude-sonnet-4-5-20250929".to_string());

let max_tokens = max_tokens_override
.or_else(|| {
std::env::var("ANTHROPIC_MAX_TOKENS")
.ok()
.and_then(|s| s.parse().ok())
})
.unwrap_or(4096);

let base_url = base_url_override
.map(String::from)
.or_else(|| std::env::var("ANTHROPIC_BASE_URL").ok())
.unwrap_or_else(|| "https://api.anthropic.com".to_string());

Ok(Self {
api_key,
model,
max_tokens,
base_url,
})
}
}

/// Anthropic Messages API provider implementing the `Provider` trait.
Expand Down
Loading
Loading