MCPcopy Create free account
hub / github.com/MetapriseAI/OrgKernel / AuditEntryModel

Class AuditEntryModel

src/orgkernel/models.py:202–262  ·  view source on GitHub ↗

Stores individual AuditEntry records. Belongs to one AuditChain.

Source from the content-addressed store, hash-verified

200
201
202class AuditEntryModel(BaseModel):
203 """
204 Stores individual AuditEntry records. Belongs to one AuditChain.
205 """
206
207 __tablename__: str = "sys_orgkernel_audit_entry"
208 __table_args__ = (
209 Index("idx_entry_chain_id", "chain_id"),
210 Index("idx_entry_chain_seq", "chain_id", "sequence"),
211 Index("idx_entry_mission_id", "mission_id"),
212 Index("idx_entry_agent_id", "agent_id"),
213 {"comment": "OrgKernel AuditEntry — single immutable record in AuditChain"},
214 )
215
216 entry_id: Mapped[str] = mapped_column(
217 String(32), primary_key=True, comment="aue_ prefixed global ID"
218 )
219 chain_id: Mapped[str] = mapped_column(
220 String(32), nullable=False,
221 comment="FK -> sys_orgkernel_audit_chain.chain_id",
222 )
223 sequence: Mapped[int] = mapped_column(
224 Integer, nullable=False,
225 comment="Monotonically increasing position in chain",
226 )
227 layer: Mapped[str] = mapped_column(
228 String(16), nullable=False,
229 comment="IDENTITY | EXECUTION | COMPLIANCE | GOVERNANCE",
230 )
231 event: Mapped[str] = mapped_column(
232 String(128), nullable=False,
233 comment="Event identifier, format: LAYER_EventName",
234 )
235 agent_id: Mapped[str] = mapped_column(
236 String(32), nullable=False, index=True,
237 comment="Agent that produced this entry",
238 )
239 mission_id: Mapped[str] = mapped_column(
240 String(32), nullable=False, index=True,
241 comment="Mission this entry belongs to",
242 )
243 token_id: Mapped[str | None] = mapped_column(
244 String(32), nullable=True,
245 comment="ExecutionToken active at this entry",
246 )
247 timestamp: Mapped[datetime] = mapped_column(
248 DateTime, nullable=False,
249 comment="UTC timestamp with microsecond precision",
250 )
251 data_json: Mapped[str | None] = mapped_column(
252 Text, nullable=True,
253 comment="Event data payload serialized as JSON",
254 )
255 prev_hash: Mapped[str] = mapped_column(
256 String(64), nullable=False,
257 comment="SHA-256 hash of previous entry",
258 )
259 entry_hash: Mapped[str] = mapped_column(

Callers 2

initializeMethod · 0.90
appendMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected