style: format core skill orchestration

This commit is contained in:
huanghuoguoguo
2026-09-05 23:18:17 +08:00
parent a61b0f0068
commit cba842fbee
4 changed files with 7 additions and 22 deletions
+4 -12
View File
@@ -485,15 +485,11 @@ class BoxService:
"""Reject tenant-owned policy fields and apply the Cloud hard policy."""
payload = dict(spec_payload)
trusted_mounts = self._normalize_trusted_read_only_mounts(
trusted_read_only_mounts or []
)
trusted_mounts = self._normalize_trusted_read_only_mounts(trusted_read_only_mounts or [])
if not self._cloud_managed:
if trusted_mounts:
if payload.get('extra_mounts'):
raise BoxValidationError(
'extra_mounts and trusted_read_only_mounts cannot both be supplied'
)
raise BoxValidationError('extra_mounts and trusted_read_only_mounts cannot both be supplied')
payload['extra_mounts'] = trusted_mounts
return payload
policy = self._admission_policy
@@ -568,12 +564,8 @@ class BoxService:
if not os.path.isdir(host_path):
raise BoxAdmissionError('Core-composed read-only mount source is unavailable')
if not any(_is_path_under(host_path, root) for root in self.allowed_mount_roots):
raise BoxAdmissionError(
'Core-composed read-only mount source is outside allowed_mount_roots'
)
normalized.append(
mount.model_copy(update={'host_path': host_path}).model_dump(mode='json')
)
raise BoxAdmissionError('Core-composed read-only mount source is outside allowed_mount_roots')
normalized.append(mount.model_copy(update={'host_path': host_path}).model_dump(mode='json'))
return normalized
def _reject_cloud_managed_process(self) -> None:
+1 -2
View File
@@ -18,6 +18,7 @@ import os
from typing import Any
from ..utils.python_workspace import list_python_manifest_files
_VENV_DIRS = frozenset({'.venv', 'venv', 'env', '.env'})
_VENV_BIN_DIRS = frozenset({'bin', 'Scripts'})
@@ -94,8 +95,6 @@ def classify_python_workspace(host_path: str | None) -> str | None:
return None
class BoxWorkspaceSession:
"""High-level handle for one reusable workspace-backed Box session.
@@ -373,9 +373,7 @@ class NativeToolLoader(loader.ToolLoader):
box_service = self.ap.box_service
if selected_skill is not None:
if not self._can_interpret_skill_host_paths():
raise ValueError(
'Secure Core host file operations are unavailable on this platform.'
)
raise ValueError('Secure Core host file operations are unavailable on this platform.')
host_root = selected_skill.get('package_root')
workspace_anchor = None
else:
+1 -5
View File
@@ -27,11 +27,7 @@ def list_python_manifest_files(host_path: str | None) -> list[str]:
normalized_root = normalize_host_path(host_path)
if not normalized_root:
return []
return [
filename
for filename in PYTHON_MANIFEST_FILES
if os.path.isfile(os.path.join(normalized_root, filename))
]
return [filename for filename in PYTHON_MANIFEST_FILES if os.path.isfile(os.path.join(normalized_root, filename))]
def should_prepare_python_env(host_path: str | None) -> bool: