Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /CIRISAI_CIRISAgent /ciris_engine /schemas /handlers /schemas.py
| """ | |
| Handler schemas for contract-driven architecture. | |
| Provides typed schemas in handler contexts and results. | |
| """ | |
| from typing import Any, Dict, List, Optional, Union | |
| from pydantic import BaseModel, ConfigDict, Field | |
| from ciris_engine.schemas.types import JSONDict | |
| from ..actions import DeferParams as DeferParameters | |
| from ..actions import ForgetParams as ForgetParameters | |
| from ..actions import MemorizeParams as MemorizeParameters | |
| from ..actions import ObserveParams as ObserveParameters | |
| from ..actions import PonderParams as PonderParameters | |
| from ..actions import RecallParams as RecallParameters | |
| from ..actions import RejectParams as RejectParameters | |
| from ..actions import SpeakParams as SpeakParameters | |
| from ..actions import TaskCompleteParams as TaskCompleteParameters | |
| from ..actions import ToolParams as ToolParameters | |
| from ..secrets.service import DecapsulationContext | |
| from ..services.metadata import ServiceMetadata | |
| from .contexts import ( | |
| DeferContext, | |
| ForgetContext, | |
| MemorizeContext, | |
| ObserveContext, | |
| PonderContext, | |
| RecallContext, | |
| RejectContext, | |
| SpeakContext, | |
| TaskCompleteContext, | |
| ToolContext, | |
| ) | |
| # Union types for contexts and parameters | |
| ActionContext = Union[ | |
| SpeakContext, | |
| ToolContext, | |
| ObserveContext, | |
| MemorizeContext, | |
| RecallContext, | |
| ForgetContext, | |
| RejectContext, | |
| PonderContext, | |
| DeferContext, | |
| TaskCompleteContext, | |
| ] | |
| ActionParameters = Union[ | |
| SpeakParameters, | |
| ToolParameters, | |
| ObserveParameters, | |
| MemorizeParameters, | |
| RecallParameters, | |
| ForgetParameters, | |
| RejectParameters, | |
| PonderParameters, | |
| DeferParameters, | |
| TaskCompleteParameters, | |
| ] | |
| class HandlerContext(BaseModel): | |
| """Typed context for all handlers.""" | |
| action_type: str = Field(..., description="Type of action being handled") | |
| action_context: ActionContext = Field(..., description="Action-specific context") | |
| action_parameters: ActionParameters = Field(..., description="Action-specific parameters") | |
| metadata: ServiceMetadata = Field(..., description="Service metadata") | |
| model_config = ConfigDict(extra="forbid", defer_build=True) | |
| class HandlerResult(BaseModel): | |
| """Typed result from all handlers.""" | |
| success: bool = Field(..., description="Whether the handler succeeded") | |
| message: Optional[str] = Field(None, description="Result message") | |
| data: Optional[JSONDict] = Field(None, description="Additional result data") | |
| error: Optional[str] = Field(None, description="Error message if failed") | |
| model_config = ConfigDict(extra="forbid", defer_build=True) | |
| class HandlerDecapsulatedParams(BaseModel): | |
| """Schema for decapsulated handler parameters.""" | |
| action_type: str = Field(..., description="Type of action being handled") | |
| action_params: JSONDict = Field(..., description="Decapsulated action parameters") | |
| context: DecapsulationContext = Field(..., description="Decapsulation context") | |
| model_config = ConfigDict(extra="forbid", defer_build=True) | |
Xet Storage Details
- Size:
- 3.01 kB
- Xet hash:
- 2ca96a0464a1093e379e16736fa3c21f2d1431276872e88c2ed13c1cd2367f8f
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.