story-kit: merge 277 - bot uses configured display_name
Adds system_prompt parameter to chat_stream so the Matrix bot
passes "Your name is {name}" to Claude Code. Reads display_name
from bot.toml config. Resolved conflicts by integrating bot_name
into master's permission-handling code structure.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -42,6 +42,7 @@ impl ClaudeCodeProvider {
|
||||
user_message: &str,
|
||||
project_root: &str,
|
||||
session_id: Option<&str>,
|
||||
system_prompt: Option<&str>,
|
||||
cancel_rx: &mut watch::Receiver<bool>,
|
||||
mut on_token: F,
|
||||
mut on_thinking: T,
|
||||
@@ -55,6 +56,7 @@ impl ClaudeCodeProvider {
|
||||
let message = user_message.to_string();
|
||||
let cwd = project_root.to_string();
|
||||
let resume_id = session_id.map(|s| s.to_string());
|
||||
let sys_prompt = system_prompt.map(|s| s.to_string());
|
||||
let cancelled = Arc::new(AtomicBool::new(false));
|
||||
let cancelled_clone = cancelled.clone();
|
||||
|
||||
@@ -79,6 +81,7 @@ impl ClaudeCodeProvider {
|
||||
&message,
|
||||
&cwd,
|
||||
resume_id.as_deref(),
|
||||
sys_prompt.as_deref(),
|
||||
cancelled,
|
||||
token_tx,
|
||||
thinking_tx,
|
||||
@@ -147,6 +150,7 @@ fn run_pty_session(
|
||||
user_message: &str,
|
||||
cwd: &str,
|
||||
resume_session_id: Option<&str>,
|
||||
system_prompt: Option<&str>,
|
||||
cancelled: Arc<AtomicBool>,
|
||||
token_tx: tokio::sync::mpsc::UnboundedSender<String>,
|
||||
thinking_tx: tokio::sync::mpsc::UnboundedSender<String>,
|
||||
@@ -185,6 +189,10 @@ fn run_pty_session(
|
||||
// a tool requires user approval, instead of using PTY stdin/stdout.
|
||||
cmd.arg("--permission-prompt-tool");
|
||||
cmd.arg("mcp__story-kit__prompt_permission");
|
||||
if let Some(sys) = system_prompt {
|
||||
cmd.arg("--system");
|
||||
cmd.arg(sys);
|
||||
}
|
||||
cmd.cwd(cwd);
|
||||
// Keep TERM reasonable but disable color
|
||||
cmd.env("NO_COLOR", "1");
|
||||
|
||||
Reference in New Issue
Block a user