Skip to content
Merged
13 changes: 7 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,22 @@ classifiers = [
"Programming Language :: Python :: 3.13",
"Typing :: Typed",
]
dependencies = ["jsonschema>=4.18,<5"]
dependencies = ["jsonschema>=4.18,<5", "tomli>=2,<3; python_version < '3.11'"]

[project.optional-dependencies]
# Cautious upper bounds on the pre-1.0 vendor SDKs: they move fast and have shipped
# breaking changes within a minor series, so cap each at the next minor to protect
# already-installed users from a surprise vendor release. The sdk-evolution agent
# raises these deliberately after verifying a new version.
claude = ["claude-agent-sdk>=0.2.87,<0.3"]
# 0.1.0b3 floor: earlier betas pin a codex binary with no manylinux wheels,
# making the extra uninstallable on glibc Linux.
codex = ["openai-codex>=0.1.0b3,<0.155"]
# 0.157.1 is the tested SDK and CLI pair for native named profiles. Earlier
# bundled CLIs do not enforce every profile rule needed by restricted runtimes.
codex = ["openai-codex>=0.157.1,<0.158"]
antigravity = ["google-antigravity>=0.1.2,<0.2"]
all = [
"claude-agent-sdk>=0.2.87,<0.3",
"google-antigravity>=0.1.2,<0.2",
"openai-codex>=0.1.0b3,<0.155",
"openai-codex>=0.157.1,<0.158",
]

[project.urls]
Expand All @@ -71,7 +71,8 @@ dev = [
"pytest-asyncio>=0.23",
"pytest-cov>=5.0",
"ruff>=0.8",
"tomli>=2; python_version < '3.11'",
# Mypy checks the public Python 3.10 branch on every CI interpreter.
"tomli>=2",
"types-jsonschema>=4.18",
]

Expand Down
30 changes: 20 additions & 10 deletions src/agent_runtime_kit/_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ class AgentCapabilities:
network_control: bool = False
tool_filters: bool = False
mcp_server_env: bool = False
named_permission_profiles: bool = False


@dataclass(frozen=True)
Expand All @@ -308,9 +309,7 @@ class TaskSupportReport:
def __post_init__(self) -> None:
issues = _tuple_value(self.issues, "TaskSupportReport.issues")
if not all(isinstance(issue, TaskSupportIssue) for issue in issues):
raise ValueError(
"TaskSupportReport.issues must contain only TaskSupportIssue values"
)
raise ValueError("TaskSupportReport.issues must contain only TaskSupportIssue values")
object.__setattr__(self, "kind", AgentRuntimeKind.coerce(self.kind))
object.__setattr__(self, "issues", issues)

Expand Down Expand Up @@ -524,13 +523,8 @@ def from_availability(
ReadinessStatus.NOT_READY: "not ready",
ReadinessStatus.INDETERMINATE: "readiness could not be determined",
}
normalized_status = _coerce_enum(
ReadinessStatus, status, "RuntimeReadiness.status"
)
if (
normalized_status is ReadinessStatus.READY_TO_ATTEMPT
and not availability.available
):
normalized_status = _coerce_enum(ReadinessStatus, status, "RuntimeReadiness.status")
if normalized_status is ReadinessStatus.READY_TO_ATTEMPT and not availability.available:
raise ValueError("an unavailable package cannot be ready to attempt")
return cls(
kind=availability.kind,
Expand Down Expand Up @@ -583,13 +577,18 @@ class PermissionProfile:
"read-only", ...) and are coerced to enum members at construction, so a
literal that slips past type checking can never silently bypass the
adapters' identity comparisons. Unknown values raise ``ValueError``.

``native_profile`` requests a provider-defined named profile where supported.
In that case, the provider profile replaces this portable filesystem preset;
callers must define and verify the provider profile separately.
"""

mode: PermissionMode = PermissionMode.DEFAULT
filesystem: FilesystemAccess = FilesystemAccess.WORKSPACE_WRITE
allowed_tools: tuple[str, ...] = ()
disallowed_tools: tuple[str, ...] = ()
network: bool | None = None
native_profile: str | None = None

def __post_init__(self) -> None:
if not isinstance(self.mode, PermissionMode):
Expand Down Expand Up @@ -619,6 +618,17 @@ def __post_init__(self) -> None:
)
if self.network is not None and not isinstance(self.network, bool):
raise ValueError("PermissionProfile.network must be bool or None")
if self.native_profile is not None:
if (
not isinstance(self.native_profile, str)
or not self.native_profile
or not self.native_profile.isascii()
or not self.native_profile[0].isalnum()
or not all(
character.isalnum() or character in "_-" for character in self.native_profile
)
):
raise ValueError("PermissionProfile.native_profile must be a named profile ID")


@dataclass(frozen=True)
Expand Down
Loading
Loading