story-kit: merge 241_story_help_slash_command

This commit is contained in:
Dave
2026-03-14 18:53:29 +00:00
parent 3abea68f9e
commit 568207687d
2 changed files with 168 additions and 0 deletions

View File

@@ -10,6 +10,7 @@ import { AgentPanel } from "./AgentPanel";
import { ChatHeader } from "./ChatHeader";
import type { ChatInputHandle } from "./ChatInput";
import { ChatInput } from "./ChatInput";
import { HelpOverlay } from "./HelpOverlay";
import { LozengeFlyProvider } from "./LozengeFlyContext";
import { MessageItem } from "./MessageItem";
import { SideQuestionOverlay } from "./SideQuestionOverlay";
@@ -203,6 +204,7 @@ export function Chat({ projectPath, onCloseProject }: ChatProps) {
response: string;
loading: boolean;
} | null>(null);
const [showHelp, setShowHelp] = useState(false);
// Ref so stale WebSocket callbacks can read the current queued messages
const queuedMessagesRef = useRef<{ id: string; text: string }[]>([]);
const queueIdCounterRef = useRef(0);
@@ -475,6 +477,12 @@ export function Chat({ projectPath, onCloseProject }: ChatProps) {
const sendMessage = async (messageText: string) => {
if (!messageText.trim()) return;
// /help — show available slash commands overlay
if (/^\/help\s*$/i.test(messageText)) {
setShowHelp(true);
return;
}
// /btw <question> — answered from context without disrupting main chat
const btwMatch = messageText.match(/^\/btw\s+(.+)/s);
if (btwMatch) {
@@ -1193,6 +1201,8 @@ export function Chat({ projectPath, onCloseProject }: ChatProps) {
</div>
)}
{showHelp && <HelpOverlay onDismiss={() => setShowHelp(false)} />}
{sideQuestion && (
<SideQuestionOverlay
question={sideQuestion.question}