feat(core,frontends,agents): agent kinds, frontend routing, anthropic on conversations, vault mirror
This commit is contained in:
@@ -13,8 +13,9 @@ from __future__ import annotations
|
||||
|
||||
from collections.abc import Mapping # noqa: TC003 - pydantic runtime
|
||||
from pathlib import Path # noqa: TC003 - pydantic runtime
|
||||
from typing import Any
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
from pydantic import BaseModel, ConfigDict, Field, model_validator
|
||||
|
||||
from beaver_gateway.agents.base import BaseAgent
|
||||
from beaver_gateway.core.prompt import PromptSource # noqa: TC001 - pydantic runtime
|
||||
@@ -57,6 +58,10 @@ class ClaudeAgent(BaseAgent):
|
||||
"""Per conversation kind (``master``/``branch``/``deep``/``job``/``fork``)
|
||||
assembly; falls back to ``prompt_sources``. Constant per kind (§3.12)."""
|
||||
|
||||
kinds: tuple[str, ...] = ()
|
||||
"""Conversation kinds this agent serves; ``create``/``spawn`` reject the
|
||||
rest. Defaults to the keys of ``prompt_sources_by_kind`` or ``("deep",)``."""
|
||||
|
||||
skill_sets: tuple[Path, ...] = ()
|
||||
gateway_tools: tuple[str, ...] = ()
|
||||
"""Gateway tools exposed in-process (``read_conversation``, ``spawn``,
|
||||
@@ -64,5 +69,16 @@ class ClaudeAgent(BaseAgent):
|
||||
|
||||
options: ClaudeOptions = Field(default_factory=ClaudeOptions)
|
||||
|
||||
@model_validator(mode="before")
|
||||
@classmethod
|
||||
def _default_kinds(cls, data: Any) -> Any:
|
||||
if isinstance(data, dict) and not data.get("kinds"):
|
||||
by_kind = data.get("prompt_sources_by_kind") or {}
|
||||
data = {**data, "kinds": tuple(by_kind) or ("deep",)}
|
||||
return data
|
||||
|
||||
def prompt_for(self, kind: str) -> tuple[PromptSource, ...]:
|
||||
return self.prompt_sources_by_kind.get(kind, self.prompt_sources)
|
||||
|
||||
def serves(self, kind: str) -> bool:
|
||||
return kind in self.kinds
|
||||
|
||||
Reference in New Issue
Block a user