fix: keep builder artifacts inside workspace grant
All checks were successful
build / build (push) Successful in 21s

This commit is contained in:
robert
2026-05-27 19:31:49 -03:00
parent 4d51ca0623
commit 33d20d3aaa
5 changed files with 45 additions and 6 deletions

View File

@@ -17,6 +17,7 @@ from .tools import ToolContext, build_tools
BUILDER_SKILL_SOURCE = "/.agent-builder/skills/"
_BUILDER_SKILL_NAMESPACE = ("agent-builder", "skills")
_BUILDER_ARTIFACT_DIR = ".agent-builder"
@dataclass(frozen=True)
@@ -324,7 +325,10 @@ def _build_project_backend(ctx: BuilderContext, *, settings: Settings) -> Any |
from a2a_pack.deepagents import WorkspaceBackend
except Exception: # noqa: BLE001
return _with_builder_skills(StateBackend())
return _with_builder_skills(WorkspaceBackend(ctx.workspace))
return _with_builder_skills(
WorkspaceBackend(ctx.workspace),
artifacts_root=f"/{prefix}/{_BUILDER_ARTIFACT_DIR}",
)
try:
from a2a_pack import Grant, WorkspaceAccess, WorkspaceMode
from a2a_pack.deepagents import WorkspaceBackend
@@ -357,10 +361,13 @@ def _build_project_backend(ctx: BuilderContext, *, settings: Settings) -> Any |
write_prefixes=(f"{prefix}/", "outputs/"),
)
)
return _with_builder_skills(WorkspaceBackend(workspace))
return _with_builder_skills(
WorkspaceBackend(workspace),
artifacts_root=f"/{prefix}/{_BUILDER_ARTIFACT_DIR}",
)
def _with_builder_skills(default_backend: Any) -> Any:
def _with_builder_skills(default_backend: Any, *, artifacts_root: str = "/") -> Any:
skill_store = InMemoryStore()
for path, content in _builder_skill_files().items():
skill_store.put(
@@ -375,6 +382,7 @@ def _with_builder_skills(default_backend: Any) -> Any:
return CompositeBackend(
default=default_backend,
routes={BUILDER_SKILL_SOURCE: skill_backend},
artifacts_root=artifacts_root,
)

View File

@@ -28,7 +28,7 @@ if TYPE_CHECKING:
from .config import Settings
A2A_PACK_MIN_VERSION = "0.1.32"
A2A_PACK_MIN_VERSION = "0.1.33"
@dataclass(frozen=True)