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

Function initialize_chain

src/orgkernel/pyapi/router.py:669–685  ·  view source on GitHub ↗

Initialize a new AuditChain for a mission. Creates the chain header and writes the genesis IDENTITY entry. Call this when a mission enters the CREATED state.

(
    request: AuditChainInitRequest,
    db: Annotated[AsyncSession, Depends(get_db)],
)

Source from the content-addressed store, hash-verified

667 description="Create a new AuditChain and write the genesis IDENTITY entry.",
668)
669async def initialize_chain(
670 request: AuditChainInitRequest,
671 db: Annotated[AsyncSession, Depends(get_db)],
672) -> dict:
673 """
674 Initialize a new AuditChain for a mission.
675
676 Creates the chain header and writes the genesis IDENTITY entry.
677 Call this when a mission enters the CREATED state.
678 """
679 svc = AuditChainService()
680 chain_id = await svc.initialize(
681 db,
682 mission_id=request.mission_id,
683 agent_id=request.agent_id,
684 )
685 return {"chain_id": chain_id, "message": "AuditChain initialized"}
686
687
688@_audit.post(

Callers

nothing calls this directly

Calls 2

initializeMethod · 0.95
AuditChainServiceClass · 0.90

Tested by

no test coverage detected