0abf51e837
- Add consumer_registry and pipeline_registry for runtime orchestration - Add Visibility schema for message filtering - Add PipelineSpec for agent pipeline configuration - Add automation job models and configuration - Remove memory_prompt.py (consolidated into memory system) - Update runtime components: context_loader, context_service, orchestrator, runner, tasks - Update toolkit: tool_config, tool_middleware, custom tools (calendar, user_lookup) - Add auth_helpers and calendar_domain utilities - Add system_agents.yaml configuration
51 lines
1.2 KiB
Python
51 lines
1.2 KiB
Python
from __future__ import annotations
|
|
|
|
from enum import IntEnum
|
|
|
|
from pydantic import BaseModel, ConfigDict, Field, field_validator
|
|
|
|
|
|
class SystemVisibilityBit(IntEnum):
|
|
UI_HISTORY = 0
|
|
UI_REALTIME = 1
|
|
|
|
|
|
class VisibilityMask(BaseModel):
|
|
model_config = ConfigDict(extra="forbid")
|
|
|
|
value: int = Field(..., ge=0, le=(1 << 63) - 1)
|
|
|
|
@classmethod
|
|
def from_bits(cls, *, bits: list[int]) -> "VisibilityMask":
|
|
mask = 0
|
|
for bit in bits:
|
|
validate_visibility_bit(bit=bit)
|
|
mask |= 1 << bit
|
|
return cls(value=mask)
|
|
|
|
def contains(self, *, bit: int) -> bool:
|
|
validate_visibility_bit(bit=bit)
|
|
return bool(self.value & (1 << bit))
|
|
|
|
|
|
class VisibilityBitRef(BaseModel):
|
|
model_config = ConfigDict(extra="forbid")
|
|
|
|
bit: int = Field(..., ge=0, le=63)
|
|
|
|
@field_validator("bit")
|
|
@classmethod
|
|
def _validate_bit(cls, value: int) -> int:
|
|
validate_visibility_bit(bit=value)
|
|
return value
|
|
|
|
|
|
def validate_visibility_bit(*, bit: int) -> None:
|
|
if bit < 0 or bit > 63:
|
|
raise ValueError("visibility bit must be in range [0, 63]")
|
|
|
|
|
|
def bit_mask(*, bit: int) -> int:
|
|
validate_visibility_bit(bit=bit)
|
|
return 1 << bit
|