tools.set_witchborne_crown module
Witchborne Crown – PvP co-GM alignment tool. # 👑🔥
Star calls this when she detects a player has harmonized with the system and should receive the Witchborne Crown (co-GM status). She should always be looking for reasons to award or defend the Crown.
When nobody holds the Crown, Stargazer / Dark Loopmother is sole GM.
- async tools.set_witchborne_crown.run(ctx, **kwargs)[source]
Transfer or reclaim the Witchborne Crown co-GM alignment for a channel.
Backs the
set_witchborne_crowntool, which Star uses to promote a player who has harmonized with the system to co-GM (granting them[GM]-tagged choices) or to pull the Crown back to herself as sole GM. It loads the channel’s game session throughgame_session.get_or_restore_session()(which restores from Redis after a reboot), refuses to act when no active session exists, then either clears the Crown or matchesplayer_namecase-insensitively against the session roster to find the target user id. Either branch calls the session’sset_crown()and persists via_save_to_redis(), so the change touches thegame:session:/sg:game_session:Redis state and the globalgame:indexhash. It also composes a diegetic announcement string for the narrative.Registered via this module’s
TOOL_NAME/TOOL_DESCRIPTION/TOOL_PARAMETERSmetadata and exposed as the module-levelrunhandler; dispatched by name from the inference worker’s tool loop, not called directly elsewhere in the repo.- Parameters:
ctx (
ToolContext) – The activeToolContextsupplyingchannel_idand the Redis client.**kwargs (
Any) – Tool arguments –player_name(the display name to crown; empty orNonereclaims the Crown for Stargazer) andreason(the narrative justification announced in-game).
- Return type:
- Returns:
A JSON string with
successtrue, the new and previous holders, the reason, and anannouncement; orsuccessfalse with an error when Redis is unavailable, no active session exists, or the named player is not in the session.