tools.compose_scene module
COMPOSE_SCENE – Star’s VN scene director tool.
Star builds a JSON scene script specifying characters, backgrounds, dialogue, stage directions, sound effects, and transitions. The script is stored in Redis and published as a scene_event for the web client to play back as full VN-style cutscenes.
@fire @skull THE DIRECTOR SPEAKS. THE STAGE OBEYS.
- async tools.compose_scene.run(title='Untitled Scene', characters=None, background=None, music=None, script=None, ctx=None)[source]
Build, validate, persist, and broadcast a VN scene script.
Entry point for the
compose_scenetool, which lets Star direct fullscreen visual-novel cutscenes on the web client. It validates that every script step has a knowntype(against the in-functionvalid_typesset), rewrites the asset path shortcuts (sfx:/bgm:/ambience:/bg:) on thesound/track/loop/imagefields to their served paths, ensures the script terminates with anendstep, and stamps the scene with owner platform/channel/user ids for the web UI’s access control. It then writes the scene to Redis understar:scenes:{scene_id}, marks it pending atstar:pending_scene, and publishes it on thestar:scene:playchannel for immediate pickup. As a bonus, anydialoguestep flaggedas_ghostfor a non-Star character is delivered as a Matrix ghost message viaegregore_bridge.get_bridge.Dispatched by
tool_loader.pyas thecompose_scenehandler (located viagetattr(module, "run")); not called directly elsewhere. Side effects are the three Redis writes/publish onctx.redisand the optional Matrix ghost-message sends.- Parameters:
title (
str) – Scene title shown on the title card before playback.characters (
list|None) – Character ids appearing in the scene (required).background (
str|None) – Optional background filename or URL.script (
list|None) – Ordered list of step dicts, each with atypeand type-specific fields (required).ctx (
ToolContext|None) – Tool execution context supplyingredisplus the ownerplatform/channel_id/user_id.
- Returns:
A JSON object with
success, thescene_id, the step count, and the ghost-message count on success, or an{"success": false, "error": ...}object on a missing context/Redis, missing required inputs, an invalid step, or a publish failure.- Return type: