storkit: merge 366_story_bot_sends_shutdown_message_on_server_stop_or_rebuild
This commit is contained in:
@@ -29,8 +29,18 @@ pub(super) fn tool_get_server_logs(args: &Value) -> Result<String, String> {
|
||||
/// Rebuild the server binary and re-exec (delegates to `crate::rebuild`).
|
||||
pub(super) async fn tool_rebuild_and_restart(ctx: &AppContext) -> Result<String, String> {
|
||||
slog!("[rebuild] Rebuild and restart requested via MCP tool");
|
||||
|
||||
// Signal the Matrix bot (if active) so it can send its own shutdown
|
||||
// announcement before the process is replaced. Best-effort: we wait up
|
||||
// to 1.5 s for the message to be delivered.
|
||||
if let Some(ref tx) = ctx.matrix_shutdown_tx {
|
||||
let _ = tx.send(Some(crate::rebuild::ShutdownReason::Rebuild));
|
||||
tokio::time::sleep(std::time::Duration::from_millis(1500)).await;
|
||||
}
|
||||
|
||||
let project_root = ctx.state.get_project_root().unwrap_or_default();
|
||||
crate::rebuild::rebuild_and_restart(&ctx.agents, &project_root).await
|
||||
let notifier = ctx.bot_shutdown.as_deref();
|
||||
crate::rebuild::rebuild_and_restart(&ctx.agents, &project_root, notifier).await
|
||||
}
|
||||
|
||||
/// Generate a Claude Code permission rule string for the given tool name and input.
|
||||
|
||||
Reference in New Issue
Block a user