feat(N4): Restliche Module — Tasks/Kommunikation/Wiki/Reports/Agents/Tags/Search + Navigation + Dashboard-Schnittstelle (#368)
Check Cross-Plugin Imports / check (push) Has been cancelled

- Scope-Deklarationen: tasks only_mine, kommunikation conversation_ids, wiki category_ids (NEUE contracts.py), report_generator template_ids, automation agent_ids (module_key agents), tags tag_ids, unified_search entity_types dynamisch aus Provider-Registry
- Core-Beiträge: navigation default_route (Startseite) + dashboard widget_app_ids (Widget-TYP-Angebot, Layout bleibt Phase M)
- Backend-Filter (additive UND): /tasks (only_mine), /comm/conversations, /wiki/articles+/categories (Subtree), /reports/print-templates, /agents, /tags, /search GET+POST (entity_types-Schnitt), /miniapps?host=dashboard
- apply_entity_type_scope-Helper (requested ∧ scope)
- Frontend: WorkspaceSwitcher default_route-Navigation, Sidebar workspace-menu_order-Sortierung, workspaceStore moduleMenuOrder()
- Tests: 18/18 Deklarationen + 11/11 Filter (TDD), Frontend 2/2 + Store 18/18, tsc clean, Build OK
- Regression 64 passed (4 Kombi-Failures = Suite-Isolation, solo-bewiesen); Checker 0; Ruff = Vorbestand (Stash-bewiesen)
This commit is contained in:
Agent Zero
2026-09-01 23:23:15 +02:00
parent 26506a5027
commit 03dd477899
26 changed files with 1335 additions and 24 deletions
@@ -15,7 +15,7 @@ from pydantic import BaseModel
from sqlalchemy.ext.asyncio import AsyncSession
from app.core.db import get_db
from app.deps import get_current_user, require_permission
from app.deps import get_current_user, require_permission, require_workspace_scope
from app.plugins.builtins.automation.models import (
AgentDefinition,
AgentRun,
@@ -118,8 +118,13 @@ async def list_agents(
offset: int = Query(0, ge=0),
current_user: dict[str, Any] = Depends(get_current_user),
db: AsyncSession = Depends(get_db),
workspace_scope: dict | None = Depends(require_workspace_scope("agents")),
):
"""List agent definitions with optional filters."""
"""List agent definitions with optional filters.
Phase N4: an active workspace scope restricts the list to the
configured agent subset (pure AND — never a grant).
"""
tenant_id = uuid.UUID(current_user["tenant_id"])
user_id = uuid.UUID(current_user["user_id"])
is_system_admin = current_user.get("is_system_admin", False)
@@ -127,6 +132,14 @@ async def list_agents(
db, tenant_id, is_active=is_active, mode=mode, limit=limit, offset=offset,
user_id=user_id, is_system_admin=is_system_admin,
)
# Phase N4: workspace scope — agent subset (pure AND)
if workspace_scope:
from app.services.workspace_scope_service import scope_uuid_set
agent_scope = scope_uuid_set(workspace_scope.get("agent_ids"))
if agent_scope is not None:
items = [a for a in items if a.id in agent_scope]
total = len(items)
return AgentDefinitionListResponse(
items=[_agent_to_response(a) for a in items],
total=total,
@@ -63,6 +63,31 @@ class AutomationContract:
# ─── agent_comm ───
send_agent_message = staticmethod(send_agent_message)
# ─── Workspace Scopes contribution (Phase N4) ───
@staticmethod
def workspace_scopes() -> list[dict]:
"""Scope-Dimensionen des agents-Moduls: Agenten-Teilmengen (N4)."""
return [
{
"module_key": "agents",
"dimensions": [
{
"key": "agent_ids",
"label": "Agenten",
"control": "multiselect",
"options": [],
"value_source": {
"endpoint": "/api/v1/agents",
"items_path": "items",
"value_key": "id",
"label_key": "name",
},
},
],
}
]
@classmethod
def get_function(cls, name: str):
"""Return a callable exposed by this contract, or None if absent."""