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