Files
dify/api/runtime_contracts/builder/native/approval_contracts.py
Charles Yao 231e423431 Integrate validated Builder backend testing and CI repairs
Track backend integration, Ruff cleanup and migration reconciliation in ENG-1271. Retain required copy contracts without implementing frontend interactions.
2026-10-20 15:40:06 -07:00

26 lines
784 B
Python

"""Immutable protected proposals, shared by journal producer and public disclosure."""
from typing import Annotated, Self
from pydantic import Field, model_validator
from runtime_contracts.builder.native.contracts import Counter, FrozenDTO, OperationKey, UTCTimestamp
class NativeApprovalTerms(FrozenDTO):
max_calls: Annotated[Counter, Field(ge=1)]
max_dispatches: Annotated[Counter, Field(ge=1)]
max_cost_units: Counter
expires_at: UTCTimestamp
@model_validator(mode="after")
def validate_counts(self) -> Self:
if self.max_dispatches < self.max_calls:
raise ValueError("dispatch bound must cover logical call bound")
return self
class NativeApprovalProposal(FrozenDTO):
key: OperationKey
terms: NativeApprovalTerms