hkuds--openharness
5dd8b952ec
A lightweight open-source Python implementation of the Agent Harness architecture. 44x lighter than Claude Code (11K vs 512K lines), 98% core tool coverage. - 43 tools with Pydantic validation and parallel execution - Skills system compatible with anthropics/skills (17+ tested) - Plugin system compatible with claude-code/plugins (12+ tested) - API retry with exponential backoff - Multi-level permissions with path rules - React/Ink TUI with "Oh my Harness!" branding - 114 unit tests + 6 E2E test suites - MIT License
32 行
1.2 KiB
Python
32 行
1.2 KiB
Python
"""Tests for permission decisions."""
|
|
|
|
from openharness.config.settings import PermissionSettings
|
|
from openharness.permissions import PermissionChecker, PermissionMode
|
|
|
|
|
|
def test_default_mode_allows_read_only():
|
|
checker = PermissionChecker(PermissionSettings(mode=PermissionMode.DEFAULT))
|
|
decision = checker.evaluate("read_file", is_read_only=True)
|
|
assert decision.allowed is True
|
|
assert decision.requires_confirmation is False
|
|
|
|
|
|
def test_default_mode_requires_confirmation_for_mutation():
|
|
checker = PermissionChecker(PermissionSettings(mode=PermissionMode.DEFAULT))
|
|
decision = checker.evaluate("write_file", is_read_only=False)
|
|
assert decision.allowed is False
|
|
assert decision.requires_confirmation is True
|
|
|
|
|
|
def test_plan_mode_blocks_mutating_tools():
|
|
checker = PermissionChecker(PermissionSettings(mode=PermissionMode.PLAN))
|
|
decision = checker.evaluate("bash", is_read_only=False)
|
|
assert decision.allowed is False
|
|
assert "plan mode" in decision.reason
|
|
|
|
|
|
def test_full_auto_allows_mutating_tools():
|
|
checker = PermissionChecker(PermissionSettings(mode=PermissionMode.FULL_AUTO))
|
|
decision = checker.evaluate("bash", is_read_only=False)
|
|
assert decision.allowed is True
|