cayu.knowledge.relations
Public Cayu API. Definitions are grouped by their public source module, and definitions from private implementation modules appear on their package’s page; adding a symbol does not move existing links. The import shown at each entry is a supported public namespace. Read the Python API overview and install the required extra.
KnowledgeLineageCurrentness
Section titled “KnowledgeLineageCurrentness”from cayu.storage import KnowledgeLineageCurrentnessWhether both exact relation endpoints are still their logical current revisions.
Bases: StrEnum.
Fields and attributes
Section titled “Fields and attributes”Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.
| Name | Type | Default |
|---|---|---|
CURRENT |
class attribute |
'current' |
STALE |
class attribute |
'stale' |
Release source · Runtime guarantees · Capability guides
KnowledgeLineageLink
Section titled “KnowledgeLineageLink”from cayu.storage import KnowledgeLineageLinkPrivacy-safe relation projection around one exact inspected revision.
The projection deliberately excludes entry text, relation metadata, actors, and policy payloads. It is therefore suitable for recall explanations without granting ordinary read access to an archived predecessor’s content.
Bases: BaseModel.
Fields and attributes
Section titled “Fields and attributes”Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.
| Name | Type | Default |
|---|---|---|
relation_id |
str |
required |
kind |
KnowledgeRelationKind |
required |
role |
KnowledgeLineageRole |
required |
counterpart |
KnowledgeRevisionRef |
required |
counterpart_current |
KnowledgeRevisionRef |
required |
counterpart_status |
KnowledgeStatus |
required |
currentness |
KnowledgeLineageCurrentness |
required |
unresolved_contradiction |
bool |
False |
created_at |
datetime |
required |
validate_relation_id (method)
Section titled “validate_relation_id (method)”KnowledgeLineageLink.validate_relation_id(value: str) -> strcopy_reference (method)
Section titled “copy_reference (method)”KnowledgeLineageLink.copy_reference(value)validate_unresolved_contradiction (method)
Section titled “validate_unresolved_contradiction (method)”KnowledgeLineageLink.validate_unresolved_contradiction(value) -> boolvalidate_created_at (method)
Section titled “validate_created_at (method)”KnowledgeLineageLink.validate_created_at(value: datetime) -> datetimevalidate_projection (method)
Section titled “validate_projection (method)”KnowledgeLineageLink.validate_projection() -> KnowledgeLineageLinkRelease source · Runtime guarantees · Capability guides
KnowledgeLineageQuery
Section titled “KnowledgeLineageQuery”from cayu.storage import KnowledgeLineageQueryBounded filters for safe exact-revision lineage inspection.
Bases: BaseModel.
Fields and attributes
Section titled “Fields and attributes”Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.
| Name | Type | Default |
|---|---|---|
reference |
KnowledgeRevisionRef |
required |
direction |
KnowledgeRelationDirection |
KnowledgeRelationDirection.BOTH |
kinds |
list[KnowledgeRelationKind] |
Field(default_factory=list) |
currentnesses |
list[KnowledgeLineageCurrentness] |
Field(default_factory=lambda: list(KnowledgeLineageCurrentness)) |
counterpart_statuses |
list[KnowledgeStatus] |
Field(default_factory=lambda: list(KnowledgeStatus)) |
unresolved_only |
bool |
False |
limit |
int |
DEFAULT_KNOWLEDGE_LIMIT |
max_bytes |
int |
DEFAULT_KNOWLEDGE_MAX_BYTES |
cursor |
str | None |
None |
copy_reference (method)
Section titled “copy_reference (method)”KnowledgeLineageQuery.copy_reference(value)copy_kinds (method)
Section titled “copy_kinds (method)”KnowledgeLineageQuery.copy_kinds(value) -> list[KnowledgeRelationKind]copy_currentnesses (method)
Section titled “copy_currentnesses (method)”KnowledgeLineageQuery.copy_currentnesses(value) -> list[KnowledgeLineageCurrentness]copy_counterpart_statuses (method)
Section titled “copy_counterpart_statuses (method)”KnowledgeLineageQuery.copy_counterpart_statuses(value) -> list[KnowledgeStatus]validate_nonempty_filters (method)
Section titled “validate_nonempty_filters (method)”KnowledgeLineageQuery.validate_nonempty_filters(value: list[Any], info) -> list[Any]validate_unresolved_only (method)
Section titled “validate_unresolved_only (method)”KnowledgeLineageQuery.validate_unresolved_only(value) -> boolvalidate_limit (method)
Section titled “validate_limit (method)”KnowledgeLineageQuery.validate_limit(value: int) -> intvalidate_max_bytes (method)
Section titled “validate_max_bytes (method)”KnowledgeLineageQuery.validate_max_bytes(value: int) -> intvalidate_cursor (method)
Section titled “validate_cursor (method)”KnowledgeLineageQuery.validate_cursor(value: str | None) -> str | Nonevalidate_unresolved_filter (method)
Section titled “validate_unresolved_filter (method)”KnowledgeLineageQuery.validate_unresolved_filter() -> KnowledgeLineageQueryRelease source · Runtime guarantees · Capability guides
KnowledgeLineageResult
Section titled “KnowledgeLineageResult”from cayu.storage import KnowledgeLineageResultOne bounded safe lineage page for an authorized exact revision.
Bases: BaseModel.
Fields and attributes
Section titled “Fields and attributes”Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.
| Name | Type | Default |
|---|---|---|
query |
KnowledgeLineageQuery |
required |
reference_current |
KnowledgeRevisionRef |
required |
reference_status |
KnowledgeStatus |
required |
links |
list[KnowledgeLineageLink] |
Field(default_factory=list) |
truncated |
bool |
False |
next_cursor |
str | None |
None |
copy_query (method)
Section titled “copy_query (method)”KnowledgeLineageResult.copy_query(value)copy_reference (method)
Section titled “copy_reference (method)”KnowledgeLineageResult.copy_reference(value)copy_links (method)
Section titled “copy_links (method)”KnowledgeLineageResult.copy_links(value)validate_truncated (method)
Section titled “validate_truncated (method)”KnowledgeLineageResult.validate_truncated(value) -> boolvalidate_next_cursor (method)
Section titled “validate_next_cursor (method)”KnowledgeLineageResult.validate_next_cursor(value: str | None) -> str | Nonevalidate_page (method)
Section titled “validate_page (method)”KnowledgeLineageResult.validate_page() -> KnowledgeLineageResultRelease source · Runtime guarantees · Capability guides
KnowledgeLineageRole
Section titled “KnowledgeLineageRole”from cayu.storage import KnowledgeLineageRoleMeaning of one relation from the inspected revision’s perspective.
Bases: StrEnum.
Fields and attributes
Section titled “Fields and attributes”Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.
| Name | Type | Default |
|---|---|---|
SUPERSEDES |
class attribute |
'supersedes' |
SUPERSEDED_BY |
class attribute |
'superseded_by' |
DERIVED_FROM |
class attribute |
'derived_from' |
DERIVATION_SOURCE_FOR |
class attribute |
'derivation_source_for' |
CONTRADICTS |
class attribute |
'contradicts' |
Release source · Runtime guarantees · Capability guides
KnowledgeRelation
Section titled “KnowledgeRelation”from cayu.storage import KnowledgeRelationImmutable semantic lineage between two exact entry revisions.
Direction is meaningful: a replacement supersedes its predecessor and a
derived revision derived_from its source. contradicts is symmetric;
stores canonicalize its endpoint order before publication.
Bases: BaseModel.
Fields and attributes
Section titled “Fields and attributes”Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.
| Name | Type | Default |
|---|---|---|
id |
str |
required |
subject |
KnowledgeRevisionRef |
required |
object |
KnowledgeRevisionRef |
required |
kind |
KnowledgeRelationKind |
required |
created_by_type |
KnowledgeActorType |
KnowledgeActorType.APP |
created_by |
str |
'app' |
policy_id |
str | None |
None |
created_at |
datetime |
Field(default_factory=lambda: datetime.now(UTC)) |
metadata |
dict[str, Any] |
Field(default_factory=dict) |
validate_id (method)
Section titled “validate_id (method)”KnowledgeRelation.validate_id(value: str) -> strcopy_reference (method)
Section titled “copy_reference (method)”KnowledgeRelation.copy_reference(value)validate_created_by (method)
Section titled “validate_created_by (method)”KnowledgeRelation.validate_created_by(value: str) -> strvalidate_policy_id (method)
Section titled “validate_policy_id (method)”KnowledgeRelation.validate_policy_id(value: str | None) -> str | Nonevalidate_created_at (method)
Section titled “validate_created_at (method)”KnowledgeRelation.validate_created_at(value: datetime) -> datetimecopy_metadata (method)
Section titled “copy_metadata (method)”KnowledgeRelation.copy_metadata(value: dict[str, Any]) -> dict[str, Any]validate_relation (method)
Section titled “validate_relation (method)”KnowledgeRelation.validate_relation() -> KnowledgeRelationRelease source · Runtime guarantees · Capability guides
KnowledgeRelationConflict
Section titled “KnowledgeRelationConflict”from cayu.storage import KnowledgeRelationConflictA relation publication conflicts with immutable durable state.
Bases: RuntimeError.
init (method)
Section titled “init (method)”KnowledgeRelationConflict.__init__(reason: str) -> NoneRelease source · Runtime guarantees · Capability guides
KnowledgeRelationDirection
Section titled “KnowledgeRelationDirection”from cayu.storage import KnowledgeRelationDirectionBases: StrEnum.
Fields and attributes
Section titled “Fields and attributes”Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.
| Name | Type | Default |
|---|---|---|
OUTGOING |
class attribute |
'outgoing' |
INCOMING |
class attribute |
'incoming' |
BOTH |
class attribute |
'both' |
Release source · Runtime guarantees · Capability guides
KnowledgeRelationKind
Section titled “KnowledgeRelationKind”from cayu.storage import KnowledgeRelationKindClosed semantic vocabulary for exact cross-entry knowledge lineage.
Bases: StrEnum.
Fields and attributes
Section titled “Fields and attributes”Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.
| Name | Type | Default |
|---|---|---|
SUPERSEDES |
class attribute |
'supersedes' |
DERIVED_FROM |
class attribute |
'derived_from' |
CONTRADICTS |
class attribute |
'contradicts' |
Release source · Runtime guarantees · Capability guides
KnowledgeRelationPublicationReceipt
Section titled “KnowledgeRelationPublicationReceipt”from cayu.storage import KnowledgeRelationPublicationReceiptImmutable replay evidence for one atomic relation batch publication.
Bases: BaseModel.
Fields and attributes
Section titled “Fields and attributes”Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.
| Name | Type | Default |
|---|---|---|
operation_id |
str |
required |
relation_ids |
list[str] |
required |
request_sha256 |
str |
required |
committed_at |
datetime |
required |
replayed |
bool |
False |
validate_operation_id (method)
Section titled “validate_operation_id (method)”KnowledgeRelationPublicationReceipt.validate_operation_id(value: str) -> strvalidate_relation_ids (method)
Section titled “validate_relation_ids (method)”KnowledgeRelationPublicationReceipt.validate_relation_ids(value) -> list[str]validate_request_sha256 (method)
Section titled “validate_request_sha256 (method)”KnowledgeRelationPublicationReceipt.validate_request_sha256(value: str) -> strvalidate_committed_at (method)
Section titled “validate_committed_at (method)”KnowledgeRelationPublicationReceipt.validate_committed_at(value: datetime) -> datetimevalidate_replayed (method)
Section titled “validate_replayed (method)”KnowledgeRelationPublicationReceipt.validate_replayed(value) -> boolRelease source · Runtime guarantees · Capability guides
KnowledgeRelationQuery
Section titled “KnowledgeRelationQuery”from cayu.storage import KnowledgeRelationQueryBounded exact-revision relation lookup.
Bases: BaseModel.
Fields and attributes
Section titled “Fields and attributes”Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.
| Name | Type | Default |
|---|---|---|
reference |
KnowledgeRevisionRef |
required |
direction |
KnowledgeRelationDirection |
KnowledgeRelationDirection.BOTH |
kinds |
list[KnowledgeRelationKind] |
Field(default_factory=list) |
limit |
int |
DEFAULT_KNOWLEDGE_LIMIT |
max_bytes |
int |
DEFAULT_KNOWLEDGE_MAX_BYTES |
cursor |
str | None |
None |
copy_reference (method)
Section titled “copy_reference (method)”KnowledgeRelationQuery.copy_reference(value)copy_kinds (method)
Section titled “copy_kinds (method)”KnowledgeRelationQuery.copy_kinds(value) -> list[KnowledgeRelationKind]validate_limit (method)
Section titled “validate_limit (method)”KnowledgeRelationQuery.validate_limit(value: int) -> intvalidate_max_bytes (method)
Section titled “validate_max_bytes (method)”KnowledgeRelationQuery.validate_max_bytes(value: int) -> intvalidate_cursor (method)
Section titled “validate_cursor (method)”KnowledgeRelationQuery.validate_cursor(value: str | None) -> str | NoneRelease source · Runtime guarantees · Capability guides
KnowledgeRelationResult
Section titled “KnowledgeRelationResult”from cayu.storage import KnowledgeRelationResultOne honest bounded page of accessible revision-bound relations.
Bases: BaseModel.
Fields and attributes
Section titled “Fields and attributes”Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.
| Name | Type | Default |
|---|---|---|
query |
KnowledgeRelationQuery |
required |
relations |
list[KnowledgeRelation] |
Field(default_factory=list) |
truncated |
bool |
False |
next_cursor |
str | None |
None |
copy_query (method)
Section titled “copy_query (method)”KnowledgeRelationResult.copy_query(value)copy_relations (method)
Section titled “copy_relations (method)”KnowledgeRelationResult.copy_relations(value)validate_truncated (method)
Section titled “validate_truncated (method)”KnowledgeRelationResult.validate_truncated(value) -> boolvalidate_next_cursor (method)
Section titled “validate_next_cursor (method)”KnowledgeRelationResult.validate_next_cursor(value: str | None) -> str | Nonevalidate_page (method)
Section titled “validate_page (method)”KnowledgeRelationResult.validate_page() -> KnowledgeRelationResultRelease source · Runtime guarantees · Capability guides
MAX_KNOWLEDGE_RELATION_BATCH
Section titled “MAX_KNOWLEDGE_RELATION_BATCH”from cayu.storage import MAX_KNOWLEDGE_RELATION_BATCHMAX_KNOWLEDGE_RELATION_BATCH = 100Release source · Runtime guarantees · Capability guides
MAX_KNOWLEDGE_RELATION_BYTES
Section titled “MAX_KNOWLEDGE_RELATION_BYTES”from cayu.storage import MAX_KNOWLEDGE_RELATION_BYTESMAX_KNOWLEDGE_RELATION_BYTES = 8192Release source · Runtime guarantees · Capability guides
MAX_KNOWLEDGE_RELATION_CURSOR_BYTES
Section titled “MAX_KNOWLEDGE_RELATION_CURSOR_BYTES”from cayu.storage import MAX_KNOWLEDGE_RELATION_CURSOR_BYTESMAX_KNOWLEDGE_RELATION_CURSOR_BYTES = 2048Release source · Runtime guarantees · Capability guides
MAX_KNOWLEDGE_RELATION_LIMIT
Section titled “MAX_KNOWLEDGE_RELATION_LIMIT”from cayu.storage import MAX_KNOWLEDGE_RELATION_LIMITMAX_KNOWLEDGE_RELATION_LIMIT = 1000Release source · Runtime guarantees · Capability guides
prepare_knowledge_relations
Section titled “prepare_knowledge_relations”from cayu.storage import prepare_knowledge_relationsCopy, canonicalize, bound, and fingerprint one relation publication.
prepare_knowledge_relations(relations: list[KnowledgeRelation], *, operation_id: str) -> tuple[str, list[KnowledgeRelation], str]