Text/messaging-domain behavioral observation registry layered on core. SPDX: GPL-3.0-or-later (code) / CC-BY-SA-4.0 (attribution-recipes.md).
44 lines
1.5 KiB
Python
44 lines
1.5 KiB
Python
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
"""BEHAVE-TEXT spec — text/messaging-domain registry, layered on decnet-behave-core.
|
|
|
|
Public API:
|
|
|
|
from spec import Observation, Window, OBSERVATION_SCHEMA_VERSION
|
|
from spec import PRIMITIVE_REGISTRY, ValueKind, ValueTypeSpec
|
|
from spec import TOPIC_PREFIX, event_topic_for
|
|
|
|
The ``Observation`` exported here is a registry-aware subclass of the base
|
|
class from ``decnet-behave-core``; it validates that ``primitive`` is in the
|
|
text registry and that ``value`` matches the registry's per-primitive spec.
|
|
|
|
See ``spec.envelope`` (and the core envelope module) for PII discipline.
|
|
"""
|
|
|
|
from .envelope import OBSERVATION_SCHEMA_VERSION, Observation, ObservationValue, Window
|
|
from .primitives import PRIMITIVE_REGISTRY, ValueKind, ValueTypeSpec, get, is_known
|
|
|
|
# Topic namespace deliberately uses *actor* (not *attacker*) because chat-group
|
|
# members may include observers, brokers, victims, and bystanders alongside
|
|
# threat actors. Attribution of role is the engine's job, not BEHAVE-TEXT's.
|
|
TOPIC_PREFIX: str = "actor.observation.text"
|
|
|
|
|
|
def event_topic_for(primitive: str) -> str:
|
|
"""Return the canonical bus topic for a BEHAVE-TEXT primitive."""
|
|
return f"{TOPIC_PREFIX}.{primitive}"
|
|
|
|
|
|
__all__ = [
|
|
"OBSERVATION_SCHEMA_VERSION",
|
|
"Observation",
|
|
"ObservationValue",
|
|
"Window",
|
|
"PRIMITIVE_REGISTRY",
|
|
"ValueKind",
|
|
"ValueTypeSpec",
|
|
"is_known",
|
|
"get",
|
|
"TOPIC_PREFIX",
|
|
"event_topic_for",
|
|
]
|