326 Commits

Author SHA1 Message Date
c71a535f16 added opencode zen as provider 2025-12-25 11:08:23 +01:00
Beehive Innovations
2eb29b5a0f Merge pull request #353 from DragonFSKY/fix/path-traversal-security
fix: path traversal vulnerability in is_dangerous_path()
2025-12-15 21:06:41 +04:00
Fahad
ba08308a23 fix(security): handle macOS symlinked system dirs
Follow-up on PR #353 to keep dangerous-path blocking correct on macOS (/etc -> /private/etc) while avoiding overblocking Windows workspaces (C:\).
2025-12-15 17:02:24 +00:00
谢栋梁
e5548acb98 fix: allow home subdirectories through is_dangerous_path()
Split DANGEROUS_PATHS into two categories:
1. DANGEROUS_SYSTEM_PATHS: Block path AND all subdirectories
   (e.g., /etc, /etc/passwd, /var/log/auth.log)
2. DANGEROUS_HOME_CONTAINERS: Block ONLY exact match
   (e.g., /home is blocked but /home/user/project passes through)

This fixes the issue where /home/user/project was incorrectly blocked
by is_dangerous_path(). Subdirectory access control for home directories
is properly delegated to is_home_directory_root() in resolve_and_validate_path().

Addresses review feedback from @chatgpt-codex-connector about blocking
all home directory subpaths.
2025-12-15 20:24:44 +08:00
Beehive Innovations
104d0dd421 Merge pull request #349 from brt-h/fix/openrouter-store-parameter 2025-12-15 15:53:09 +04:00
Beehive Innovations
483c67edb7 Merge pull request #350 from brt-h/feat/add-opus-4.5-openrouter
feat: Add Claude Opus 4.5 model via OpenRouter
2025-12-15 15:37:32 +04:00
Beehive Innovations
1be1d982b2 Merge pull request #352 from DragonFSKY/fix/clink-codex-search-arg
feat: re-enable web search for clink codex using correct --enable flag
2025-12-15 14:21:39 +04:00
Fahad
39c77215e5 fix: grok test 2025-12-11 20:14:10 +00:00
Fahad
514c9c58fc feat: grok-4.1 support https://github.com/BeehiveInnovations/pal-mcp-server/issues/339 2025-12-11 20:08:17 +00:00
Fahad
8b16405f06 feat: GPT-5.2 support 2025-12-11 19:11:50 +00:00
谢栋梁
df46708af9 Merge remote-tracking branch 'upstream/main' into fix/path-traversal-security 2025-12-07 00:07:59 +08:00
谢栋梁
bbdac1289a Merge remote-tracking branch 'upstream/main' into fix/clink-codex-search-arg 2025-12-07 00:07:45 +08:00
谢栋梁
91ffb51564 fix: use Path.is_relative_to() for cross-platform dangerous path detection
Replace string prefix matching with Path.is_relative_to() to correctly
handle Windows paths like "C:\" where trailing backslash caused double
separator issues (e.g., "C:\\" instead of "C:\").

Changes:
- Use Path.is_relative_to() for subdirectory detection (requires Python 3.9+)
- Add Windows path handling tests using PureWindowsPath
- Update test_utils.py to expect /etc/passwd to be blocked (security fix)
2025-12-05 13:53:39 +08:00
Fahad
b2dc84992d fix: rebranding, see [docs/name-change.md](docs/name-change.md) for details 2025-12-04 18:15:14 +04:00
谢栋梁
9ed15f405a fix: path traversal vulnerability - use prefix matching in is_dangerous_path()
The is_dangerous_path() function only did exact string matching,
allowing attackers to bypass protection by accessing subdirectories:
- /etc was blocked but /etc/passwd was allowed
- C:\Windows was blocked but C:\Windows\System32\... was allowed

This minimal fix changes is_dangerous_path() to use PREFIX MATCHING:
- Now blocks dangerous directories AND all their subdirectories
- Paths like /etcbackup are still allowed (not under /etc)
- No changes to DANGEROUS_PATHS list

Security:
- Fixes CWE-22: Path Traversal vulnerability
- Reported by: Team off-course (K-Shield.Jr 15th)

Fixes #312
Fixes #293
2025-12-03 15:29:57 +08:00
谢栋梁
e7b9f3a5d7 feat: re-enable web search for clink codex using correct --enable flag
The previous fix (aceddb6) removed --search entirely, disabling web search.
This restores web search functionality using the correct --enable flag
that works with the codex exec subcommand.

Related to #338
2025-12-03 14:32:37 +08:00
Robert Hyman
cf63fd2544 test: Add comprehensive test coverage for Opus 4.5 aliases
Address review feedback:
- Add test for claude-opus alias in test_alias_resolution
- Add tests for anthropic/claude-opus-4.5 full name and opus4.5 alias
  in test_registry_capabilities
2025-11-29 18:23:44 -05:00
Robert Hyman
813ce5c9f7 feat: Add Claude Opus 4.5 model via OpenRouter
- Add anthropic/claude-opus-4.5 with aliases: opus, opus4.5, claude-opus
- Set intelligence_score to 18 (matching Gemini 3 Pro)
- Update Opus 4.1 to use opus4.1 alias only
- Update tests to reflect new alias mappings

Note: supports_function_calling and supports_json_mode set to false
following existing project pattern for Claude models, despite
OpenRouter API support for these features.
2025-11-29 18:00:31 -05:00
Robert Hyman
b6a8d682d9 refactor(tests): remove unused setUp method
The setUp method created provider instances that were never used.
Each test creates its own instance inside the patch context manager,
which is the correct pattern for property mocking.
2025-11-29 01:42:27 -05:00
Robert Hyman
0c3e63c0c7 refactor(tests): address code review feedback
- Remove redundant @patch.object decorators (inner context manager suffices)
- Remove try/except blocks that could hide test failures
- Tests now fail fast if mocking is insufficient
2025-11-29 00:55:41 -05:00
Robert Hyman
1f8b58d607 fix(providers): omit store parameter for OpenRouter responses endpoint
OpenRouter's /responses endpoint rejects store:true via Zod validation.
This is an endpoint-level limitation, not model-specific. The fix
conditionally omits the store parameter for OpenRouter while maintaining
it for direct OpenAI and Azure OpenAI providers.

- Add provider type check in _generate_with_responses_endpoint
- Include debug logging when store parameter is omitted
- Add regression tests for both OpenRouter and OpenAI behavior

Fixes #348
2025-11-29 00:19:13 -05:00
Fahad
aceddb655f fix: regression https://github.com/BeehiveInnovations/zen-mcp-server/issues/338
refactor: added regression test
2025-11-21 09:31:34 +04:00
Fahad
19a2a89b12 fix: failing test for gemini 3.0 pro open router 2025-11-18 20:50:42 +04:00
Fahad
25fd72fbd3 feat: gemini 3.0 pro preview added (as default gemini pro model)
refactor: code cleanup
2025-11-18 20:28:27 +04:00
Bjorn Melin
f713d8a354 feat: enhance model support by adding GPT-5.1 to .gitignore and updating cassette maintenance documentation for dual-model testing 2025-11-14 01:40:49 -07:00
Fahad
2a8dff0cc8 fix: telemetry option no longer available in gemini 0.11
fix: fixed tests
2025-10-22 17:53:10 +04:00
Fahad
3e27319e60 fix: reduced token usage, removed parameters from schema that CLIs never seem to use 2025-10-22 13:31:08 +04:00
Fahad
d36489fdc9 fix:sed usage https://github.com/BeehiveInnovations/zen-mcp-server/issues/287 2025-10-21 11:06:18 +04:00
Fahad
d5790a9bfe fix: handle claude's array style JSON https://github.com/BeehiveInnovations/zen-mcp-server/issues/295 2025-10-21 10:41:02 +04:00
Fahad
d2773f488a fix: configure codex with a longer timeout
refactor: param names
2025-10-21 10:35:44 +04:00
Fahad
aed3e3ee80 fix: failing test 2025-10-18 00:33:03 +04:00
Fahad
f4c20d2a20 fix: handler for parsing multiple generated code blocks 2025-10-18 00:28:17 +04:00
Fahad
95e69a7cb2 fix: improved error reporting; codex cli would at times fail to figure out how to handle plain-text / JSON errors
fix: working directory should exist, raise error and not try and create one
docs: improved API Lookup instructions
* test added to confirm failures
* chat schema more explicit about file paths
2025-10-17 23:42:32 +04:00
Fahad
9ffca53ce5 feat! Claude Code as a CLI agent now supported. Mix and match: spawn claude code from within claude code, or claude code from within codex.
Stay in codex, plan review and fix complicated bugs, then ask it to spawn claude code and implement the plan.

This uses your current subscription instead of API tokens.
2025-10-08 11:14:22 +04:00
Beehive Innovations
d80d77bb47 Merge pull request #279 from christopher-buss/fix-windows-clink
fix: resolve executable path for clink cross-platform compatibility in CLI
2025-10-08 08:11:04 +04:00
christopher-buss
4370be33b4 test: fix clink agent tests to mock shutil.which() for executable resolution
The previous commit (f98046c) added shutil.which() to resolve executables,
which broke two tests that only mocked subprocess execution. This commit
adds shutil.which() mocking to both test files to restore test compatibility.

Co-authored-by: Claude <noreply@anthropic.com>
2025-10-07 17:39:41 +01:00
Fahad
ece8a5ebed feat!: Full code can now be generated by an external model and shared with the AI tool (Claude Code / Codex etc)!
model definitions now support a new `allow_code_generation` flag, only to be used with higher reasoning models such as GPT-5-Pro and-Gemini 2.5-Pro

 When `true`, the `chat` tool can now request the external model to generate a full implementation / update / instructions etc and then share the implementation with the calling agent.

 This effectively allows us to utilize more powerful models such as GPT-5-Pro to generate code for us or entire implementations (which are either API-only or part of the $200 Pro plan from within the ChatGPT app)
2025-10-07 18:49:13 +04:00
Fahad
7c36b9255a refactor: moved registries into a separate module and code cleanup
fix: refactored dial provider to follow the same pattern
2025-10-07 12:59:09 +04:00
Fahad
cbe1d79932 fix: handle 429 response https://github.com/BeehiveInnovations/zen-mcp-server/issues/273 2025-10-06 23:32:04 +04:00
Fahad
a33efbde52 fix: use CUSTOM_CONNECT_TIMEOUT for gemini too
feat: add grok-4 to openrouter_models.json
2025-10-06 23:23:24 +04:00
Fahad
a65485a1e5 feat: support for GPT-5-Pro highest reasoning model https://github.com/BeehiveInnovations/zen-mcp-server/issues/275 2025-10-06 22:36:44 +04:00
Fahad
561e4aaaa8 feat: support for codex as external CLI
fix: improved handling of MCP token limits when handling CLI output
2025-10-06 00:39:00 +04:00
Fahad
a150e1c312 fix: intercept non-cli errors and allow agent to continue 2025-10-05 11:38:59 +04:00
Fahad
a2ccb48e9a feat!: Huge update - Link another CLI (such as gemini directly from with Claude Code / Codex). https://github.com/BeehiveInnovations/zen-mcp-server/issues/208
Zen now allows you to define `roles` for an external CLI and delegate work to another CLI via the new `clink` tool (short for `CLI + Link`). Gemini, for instance, offers 1000 free requests a day - this means you can save on tokens and your weekly limits within Claude Code by delegating work to another entirely capable CLI agent!

Define your own system prompts as `roles` and make another CLI do anything you'd like. Like the current tool you're connected to, the other CLI has complete access to your files and the current context. This also works incredibly well with Zen's `conversation continuity`.
2025-10-05 10:40:44 +04:00
Fahad
9c99b9b352 refactor: fixed test 2025-10-05 08:55:50 +04:00
Fahad
ff9a07a37a feat!: breaking change - OpenRouter models are now read from conf/openrouter_models.json while Custom / Self-hosted models are read from conf/custom_models.json
feat: Azure OpenAI / Azure AI Foundry support. Models should be defined in conf/azure_models.json (or a custom path). See .env.example for environment variables or see readme. https://github.com/BeehiveInnovations/zen-mcp-server/issues/265

feat: OpenRouter / Custom Models / Azure can separately also use custom config paths now (see .env.example )

refactor: Model registry class made abstract, OpenRouter / Custom Provider / Azure OpenAI now subclass these

refactor: breaking change: `is_custom` property has been removed from model_capabilities.py (and thus custom_models.json) given each models are now read from separate configuration files
2025-10-04 21:10:56 +04:00
Fahad
bc93b5343b fix: CI test 2025-10-04 14:32:47 +04:00
Fahad
2c534ac06e feat: centralized environment handling, ensures ZEN_MCP_FORCE_ENV_OVERRIDE is honored correctly
fix: updated tests to override env variables they need instead of relying on the current values from .env
2025-10-04 14:28:56 +04:00
Fahad
4015e917ed fix: listmodels to always honor restricted models
fix: restrictions should resolve canonical names for openrouter
fix: tools now correctly return restricted list by presenting model names in schema
fix: tests updated to ensure these manage their expected env vars properly
perf: cache model alias resolution to avoid repeated checks
2025-10-04 13:46:22 +04:00
Fahad
06d7701cc3 refactor: removed subclass override when the base class should be resolving the model name
refactor: always disable "stream"
2025-10-04 10:35:32 +04:00