Commit graph

461 commits

Author SHA1 Message Date
argenis de la rosa
915ce58a8c fix: add futures dependency and fix stream imports in traits.rs
This commit fixes compilation errors when running tests by:
1. Adding `futures = "0.3"` dependency to Cargo.toml
2. Adding proper import `use futures_util::{stream, StreamExt};`
3. Replacing `futures::stream` with `stream` (using imported module)

The `futures_util` crate already had the `sink` feature but was missing
the stream-related types. Adding the full `futures` crate provides
the complete stream API needed for the streaming chat functionality.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 05:05:23 -05:00
argenis de la rosa
d94e78c621 feat(streaming): add streaming support for LLM responses (fixes #211)
Implement Server-Sent Events (SSE) streaming for OpenAI-compatible providers:

- Add StreamChunk, StreamOptions, and StreamError types to traits module
- Add supports_streaming() and stream_chat_with_system() to Provider trait
- Implement SSE parser for OpenAI streaming responses (data: {...} format)
- Add streaming support to OpenAiCompatibleProvider
- Add streaming support to ReliableProvider with error propagation
- Add futures dependency for async stream support

Features:
- Token-by-token streaming for real-time feedback
- Token counting option (estimated ~4 chars per token)
- Graceful error handling and logging
- Channel-based stream bridging for async compatibility

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 05:01:13 -05:00
Chummy
f75f73a50d fix(agent): preserve native tool-call fallbacks and history fidelity 2026-02-17 17:55:38 +08:00
Vernon Stinebaker
f322360248 feat(providers): add native tool-call API support via chat_with_tools
Add chat_with_tools() to the Provider trait with a default fallback to
chat_with_history(). Implement native tool calling in OpenRouterProvider,
reusing existing NativeChatRequest/NativeChatResponse structs. Wire the
agent loop to use native tool calls when the provider supports them,
falling back to XML-based parsing otherwise.

Changes are purely additive to traits.rs and openrouter.rs. The only
deletions (36 lines) are within run_tool_call_loop() in loop_.rs where
the LLM call section was replaced with a branching if/else for native
vs XML tool calling.

Includes 5 new tests covering:
- chat_with_tools error path (missing API key)
- NativeChatResponse deserialization (tool calls only, mixed)
- parse_native_response conversion to ChatResponse
- tools_to_openai_format schema validation
2026-02-17 17:55:38 +08:00
Chummy
b9e2dae49f feat(doctor): harden provider and workspace diagnostics 2026-02-17 17:20:56 +08:00
stawky
b0d4a1297b feat(doctor): add enhanced diagnostics and config validation
- Expand  with grouped health report output
- Add semantic config checks (provider/model/temp/routes/channels)
- Add workspace checks (existence, write probe, disk availability)
- Preserve daemon/scheduler/channel freshness diagnostics
- Add environment checks (git/curl/shell/home)
- Add unit tests for provider validation and config edge cases

Also fix upstream signature drift to keep build green:
- channels: pass provider_name to agent_turn
- channels: pass workspace_dir to all_tools_with_runtime
- daemon: pass verbose flag to agent::run
2026-02-17 17:20:56 +08:00
Chummy
7ebda43fdd fix(gateway): remove unused prompt bootstrap variables 2026-02-17 17:06:28 +08:00
Chummy
37df8f6b33 style(cron): apply rustfmt ordering for exports 2026-02-17 17:06:28 +08:00
mai1015
0e9852ec06 feat: pass a cloned config to all_tools_with_runtime for improved tool initialization 2026-02-17 17:06:28 +08:00
mai1015
fb2d1cea0b Implement cron job management tools and types
- Added `JobType`, `SessionTarget`, `Schedule`, `DeliveryConfig`, `CronJob`, `CronRun`, and `CronJobPatch` types in `src/cron/types.rs` for cron job configuration and management.
- Introduced `CronAddTool`, `CronListTool`, `CronRemoveTool`, `CronRunTool`, `CronRunsTool`, and `CronUpdateTool` in `src/tools` for adding, listing, removing, running, and updating cron jobs.
- Updated the `run` function in `src/daemon/mod.rs` to conditionally start the scheduler based on the cron configuration.
- Modified command-line argument parsing in `src/lib.rs` and `src/main.rs` to support new cron job commands.
- Enhanced the onboarding wizard in `src/onboard/wizard.rs` to include cron configuration.
- Added tests for cron job tools to ensure functionality and error handling.
2026-02-17 17:06:28 +08:00
Chummy
3d8ece4c59 test(email): align seen-message tests with HashSet impl 2026-02-17 17:01:05 +08:00
Daniel Willitzer
b38797341b Add comprehensive tests for 16 previously untested modules
- Channels: traits, email_channel (includes lock poisoning fix)
- Tunnel: cloudflare, custom, ngrok, none, tailscale
- Core: doctor, health, integrations, lib, memory/traits
- Providers: openrouter
- Runtime: traits, observability/traits, tools/traits

Test coverage improved from 70/91 (77%) to 86/91 (95%)
All 1272 tests passing

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 17:01:05 +08:00
LiWeny16
6a7a914f41 fix: resolve rebase conflicts in config exports 2026-02-17 16:53:56 +08:00
Chummy
abdf99cf8c chore(lint): extend low-risk clippy cleanup batch
- normalize numeric literals (115_200) in hardware/peripheral config paths

- remove test-only useless format! allocations in discord IDs

- simplify closures and auto-deref in browser/http/rag/peripherals

- keep behavior unchanged while reducing warning surface
2026-02-17 16:40:58 +08:00
darwin808
4413790859 chore(lint): remove unused imports, variables, and redundant mut bindings
Eliminate low-risk clippy warnings as part of the strict lint backlog (#409):

- Remove unused `uuid::Uuid` imports from slack and telegram channels
- Remove unnecessary `mut` and redundant rebindings in agent loop
- Prefix unused `channel_id` variable in discord channel
- Remove unused test imports (`ChatResponse`, `ToolCall`, `TempDir`, `Path`)
2026-02-17 16:40:58 +08:00
Chummy
e197cc5b04 fix(onboard,anthropic): stabilize oauth setup-token flow and model defaults
- fix onboard command ownership handling before spawn_blocking

- restore memory helper imports in wizard to resolve build regression

- centralize Anthropic OAuth beta header in apply_auth for all request paths

- correct OpenRouter Anthropic Sonnet 4.5 model ID format

- add regression tests for auth headers and curated model IDs
2026-02-17 16:15:38 +08:00
Pedro
bb6034e765 style(onboard): fix cargo fmt formatting
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 16:15:38 +08:00
Pedro
045ead628a feat(onboard): add Anthropic OAuth setup-token support and update models
Enable Pro/Max subscription users to authenticate via OAuth setup-tokens
(sk-ant-oat01-*) by sending the required anthropic-beta: oauth-2025-04-20
header alongside Bearer auth. Update curated model list to latest
(Opus 4.6, Sonnet 4.5, Haiku 4.5) and fix Tokio runtime panic in
onboard wizard by wrapping blocking calls in spawn_blocking.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 16:15:38 +08:00
Will Sarg
aa014ab85b
Devsecops (#481)
* fix(workflows): standardize runner configuration for security jobs

* ci(actionlint): add Blacksmith runner label to config

Add blacksmith-2vcpu-ubuntu-2404 to actionlint self-hosted-runner labels config
to suppress "unknown label" warnings during workflow linting.

This label is used across all workflows after the Blacksmith migration.

* Merge branch 'main' into devsecops

* fix(actionlint): adjust indentation for self-hosted runner labels

* Merge branch 'main' into devsecops

* feat(security): enhance security workflow with CodeQL analysis steps

* Merge branch 'main' into devsecops

* fix(security): update CodeQL action to version 4 for improved analysis

* Merge branch 'main' into devsecops

* fix(security): remove duplicate permissions in security workflow

* fix(security): revert CodeQL action to v3 for stability

The v4 version was causing workflow file validation failures.
Reverting to proven v3 version that is working on main branch.

* fix(security): remove duplicate permissions causing workflow validation failure

The permissions block had duplicate security-events and actions keys,
which caused YAML validation errors and prevented workflow execution.

Fixes: workflow file validation failures on main branch

* Merge remote-tracking branch 'origin/main' into devsecops

* fix(security): remove pull_request trigger to reduce costs

* fix(security): restore PR trigger but skip codeql on PRs

* fix(security): resolve YAML syntax error in security workflow

* refactor(security): split CodeQL into dedicated scheduled workflow

* fix(security): update workflow name to Rust Package Security Audit

* fix(codeql): remove push trigger, keep schedule and on-demand only

* feat(codeql): add CodeQL configuration file to ignore specific paths

* Merge branch 'main' into devsecops

* Merge branch 'main' into devsecops

* Potential fix for code scanning alert no. 39: Hard-coded cryptographic value

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
2026-02-17 00:16:23 -05:00
Argenis
e3ca2315d3
fix(nvidia): use correct NVIDIA_API_KEY environment variable
- Fixes the environment variable name from `NVIDIA_NIM_API_KEY` to `NVIDIA_API_KEY` to match NVIDIA's official documentation
- Adds model suggestions for NVIDIA NIM provider in the onboarding wizard

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 23:23:02 -05:00
Lawyered
8cf6c89ebc docs(security): document single-ampersand blocking in command policy 2026-02-16 23:06:27 -05:00
Lawyered
e8088f624e test(security): cover background-chain validation path 2026-02-16 23:06:27 -05:00
Lawyered
0f56211892 fix(security): block single-ampersand command chaining bypass 2026-02-16 23:06:27 -05:00
Anton Dieterle
4d4c1e4965 Fix OpenCode API URL in provider configuration
Hey not sure why it was changed, but this is the correct URL for opencode zen
2026-02-16 23:01:53 -05:00
Argenis
b2facc7526
fix(cli): respect config default_temperature
Fixes #452 - CLI now respects config.default_temperature

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 20:08:00 -05:00
Argenis
e8553a800a
fix(channels): use platform message IDs to prevent duplicate memories
Fixes #430 - Prevents duplicate memories after restart by using platform message IDs instead of random UUIDs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 19:04:37 -05:00
Argenis
15e1d50a5d
fix: replace std::sync::Mutex with parking_lot::Mutex (#350)
Merges #422
2026-02-16 15:02:46 -05:00
Argenis
bff0507132
fix: prevent prompt injection via JSON extraction (#355)
Merges #416
2026-02-16 14:17:24 -05:00
Argenis
dc5a85c85c
fix: use 256-bit entropy for pairing tokens (#351)
Merges #413
2026-02-16 13:48:03 -05:00
Chummy
4264c3bb21
Merge pull request #397 from elonfeng/feat/dingtalk-channel
feat(channels): add DingTalk channel via Stream Mode
2026-02-17 01:11:12 +08:00
Chummy
9fbd8c7f57
Merge pull request #382 from fettpl/fix/356-gateway-error-leaks
fix(security): stop leaking serde parse details in gateway error responses
2026-02-17 01:10:27 +08:00
Chummy
2f57499a39
Merge pull request #379 from fettpl/fix/354-file-read-rate-limit
fix(security): move record_action before canonicalize in file_read
2026-02-17 01:10:16 +08:00
Chummy
f13ce909c4
Merge pull request #274 from mai1015/feat/refactor-agent-loop
feat(providers): add native tool-calling for OpenRouter/Anthropic and align provider tests with simple_chat
2026-02-17 01:06:56 +08:00
Chummy
88de2555ab
Merge pull request #391 from fettpl/fix/361-browser-security
security(browser): harden SSRF blocking and block file:// URLs
2026-02-17 01:06:50 +08:00
Chummy
e005b6d9e4 fix(rebase): unify agent config and remove duplicate fields 2026-02-17 01:01:57 +08:00
Chummy
413ecfd143 fix(rebase): resolve main drift and restore CI contracts 2026-02-17 01:01:57 +08:00
Chummy
b2dd3582a4 fix(ci): align reliable tests with simple_chat contract 2026-02-17 01:01:56 +08:00
mai1015
dc5e14d7d2 refactor: improve code formatting and structure across multiple files 2026-02-17 01:01:56 +08:00
mai1015
b341fdb368 feat: add agent structure and improve tooling for provider 2026-02-17 01:01:56 +08:00
Chummy
e2c966d31e
Merge pull request #389 from reidliu41/add-qwen
feat(provider): add Qwen/DashScope provider with multi-region support
2026-02-17 00:58:04 +08:00
Chummy
e6d79283d1
Merge pull request #378 from fettpl/fix/353-rate-limiter-memory
fix(gateway): add periodic sweep to SlidingWindowRateLimiter
2026-02-17 00:57:38 +08:00
elonf
9463bf08a4 feat(channels): add DingTalk channel via Stream Mode
Implement DingTalk messaging channel using the official Stream Mode
WebSocket protocol with per-message session webhook replies.

- Add DingTalkChannel with send/listen/health_check support
- Add DingTalkConfig (client_id, client_secret, allowed_users)
- Integrate with onboard wizard, integrations registry, and channel
  list/doctor commands
- Include unit tests for user allowlist rules and config serialization
2026-02-17 00:53:13 +08:00
fettpl
882defef12 security(browser): harden SSRF blocking and block file:// URLs
- Block file:// URLs which bypassed all SSRF and domain-allowlist
  controls, enabling arbitrary local file exfiltration via browser
- Harden is_private_host() to match http_request.rs coverage:
  multicast, broadcast, reserved (240/4), shared address space
  (100.64/10), documentation IPs, benchmarking IPs
- Add .localhost subdomain and .local mDNS TLD blocking
- Extract is_non_global_v4() and is_non_global_v6() helpers

Closes #361

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 17:49:21 +01:00
Chummy
c11c569ddd
Merge pull request #377 from fettpl/fix/352-ssrf-ip-blocking
fix(security): block multicast/broadcast/reserved IPs in SSRF protection
2026-02-17 00:47:46 +08:00
reidliu41
6bb9bc47c0 feat(provider): add Qwen/DashScope provider with multi-region support
- Add Alibaba Qwen as an OpenAI-compatible provider via DashScope API
- Support three regional endpoints: China (Beijing), Singapore, and US (Virginia)
- All regions share a single `DASHSCOPE_API_KEY` environment variable

| Config Value | Region | Base URL |
|---|---|---|
| `qwen` / `dashscope` | China (Beijing) | `dashscope.aliyuncs.com/compatible-mode/v1` |
| `qwen-intl` / `dashscope-intl` | Singapore | `dashscope-intl.aliyuncs.com/compatible-mode/v1` |
| `qwen-us` / `dashscope-us` | US (Virginia) | `dashscope-us.aliyuncs.com/compatible-mode/v1` |
2026-02-17 00:42:53 +08:00
Chummy
02decd309f fix(security): tighten SSRF IP classification for docs ranges 2026-02-17 00:41:48 +08:00
ehu shubham shaw
de3ec87d16
Ehu shubham shaw contribution --> Hardware support (#306)
* feat: add ZeroClaw firmware for ESP32 and Nucleo

* Introduced new firmware for ZeroClaw on ESP32 and Nucleo-F401RE, enabling JSON-over-serial communication for GPIO control.
* Added `zeroclaw-esp32` with support for commands like `gpio_read` and `gpio_write`, along with capabilities reporting.
* Implemented `zeroclaw-nucleo` firmware with similar functionality for STM32, ensuring compatibility with existing ZeroClaw protocols.
* Updated `.gitignore` to include new firmware targets and added necessary dependencies in `Cargo.toml` for both platforms.
* Created README files for both firmware projects detailing setup, build, and usage instructions.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* feat: enhance hardware peripheral support and documentation

- Added `Peripheral` trait implementation in `src/peripherals/` to manage hardware boards (STM32, RPi GPIO).
- Updated `AGENTS.md` to include new extension points for peripherals and their configuration.
- Introduced comprehensive documentation for adding boards and tools, including a quick start guide and supported boards.
- Enhanced `Cargo.toml` to include optional dependencies for PDF extraction and peripheral support.
- Created new datasheets for Arduino Uno, ESP32, and Nucleo-F401RE, detailing pin aliases and GPIO usage.
- Implemented new tools for hardware memory reading and board information retrieval in the agent loop.

This update significantly improves the integration and usability of hardware peripherals within the ZeroClaw framework.

* feat: add ZeroClaw firmware for ESP32 and Nucleo

* Introduced new firmware for ZeroClaw on ESP32 and Nucleo-F401RE, enabling JSON-over-serial communication for GPIO control.
* Added `zeroclaw-esp32` with support for commands like `gpio_read` and `gpio_write`, along with capabilities reporting.
* Implemented `zeroclaw-nucleo` firmware with similar functionality for STM32, ensuring compatibility with existing ZeroClaw protocols.
* Updated `.gitignore` to include new firmware targets and added necessary dependencies in `Cargo.toml` for both platforms.
* Created README files for both firmware projects detailing setup, build, and usage instructions.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

* feat: enhance hardware peripheral support and documentation

- Added `Peripheral` trait implementation in `src/peripherals/` to manage hardware boards (STM32, RPi GPIO).
- Updated `AGENTS.md` to include new extension points for peripherals and their configuration.
- Introduced comprehensive documentation for adding boards and tools, including a quick start guide and supported boards.
- Enhanced `Cargo.toml` to include optional dependencies for PDF extraction and peripheral support.
- Created new datasheets for Arduino Uno, ESP32, and Nucleo-F401RE, detailing pin aliases and GPIO usage.
- Implemented new tools for hardware memory reading and board information retrieval in the agent loop.

This update significantly improves the integration and usability of hardware peripherals within the ZeroClaw framework.

* feat: Introduce hardware auto-discovery and expanded configuration options for agents, hardware, and security.

* chore: update dependencies and improve probe-rs integration

- Updated `Cargo.lock` to remove specific version constraints for several dependencies, including `zerocopy`, `syn`, and `strsim`, allowing for more flexibility in version resolution.
- Upgraded `bincode` and `bitfield` to their latest versions, enhancing serialization and memory management capabilities.
- Updated `Cargo.toml` to reflect the new version of `probe-rs` from `0.24` to `0.30`, improving hardware probing functionality.
- Refactored code in `src/hardware` and `src/tools` to utilize the new `SessionConfig` for session management in `probe-rs`, ensuring better compatibility and performance.
- Cleaned up documentation in `docs/datasheets/nucleo-f401re.md` by removing unnecessary lines.

* fix: apply cargo fmt

* docs: add hardware architecture diagram.

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 11:40:10 -05:00
Chummy
b36f23784a
fix(build): harden rustls dependency path for Linux builds (#275) 2026-02-17 00:39:28 +08:00
fettpl
91ae151548 style: fix rustfmt formatting in SSRF tests
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 17:35:30 +01:00
Chummy
3234159c6c
chore(clippy): clear warning backlog and harden conversions (#383) 2026-02-17 00:32:33 +08:00