Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

feat(conversations): handle run-mode and stop slash commands

Steven Enamakel50edf2319cd0
diff --git a/app/src/features/conversations/Conversations.tsx b/app/src/features/conversations/Conversations.tsx
index e6c907475e..34f51cbe7c 100644
--- a/app/src/features/conversations/Conversations.tsx
+++ b/app/src/features/conversations/Conversations.tsx
@@ -15,6 +15,7 @@ import { ConfirmationModal } from '../../components/intelligence/ConfirmationMod
import { SidebarContent } from '../../components/layout/shell/SidebarSlot';
import { PlanReviewCardCore } from '../../features/conversations/aui/PlanReviewPart';
import { RunModeToggle } from '../../features/conversations/aui/RunModeToggle';
+import { useRunMode } from '../../features/conversations/aui/useRunMode';
import { toAuiTodoItems } from '../../features/conversations/aui/TodoListPart';
import {
formatTokens,
@@ -533,6 +534,9 @@ const Conversations = ({
// latest implementation out of these refs at call time.
const handleComposerSendRef = useRef<((text?: string) => Promise<void>) | null>(null);
const handleStopGenerationRef = useRef<(() => void) | null>(null);
+ // Typed `/plan` / `/build` (see `handleSlashCommand`) flip the same run mode
+ // the composer toggle and the `/` popover do.
+ const { setMode: setRunMode } = useRunMode(selectedThreadId);
// Per-thread "turn signature": the last-seen tuple of progress-slice
// references [inferenceStatus, streamingAssistant, toolTimeline]
// for each thread that owns a live silence timer. Redux Toolkit (immer)
@@ -938,7 +942,16 @@ const Conversations = ({
if (decision.kind === 'not_handled') return false;
setInputValue('');
- void handleCreateNewThread();
+ if (decision.kind === 'run_mode') {
+ debug('[chat] slash command: run mode -> %s', decision.mode);
+ void setRunMode(decision.mode).catch(error => {
+ debug('[chat] slash command: set run mode failed: %o', error);
+ });
+ } else if (decision.kind === 'stop') {
+ handleStopGenerationRef.current?.();
+ } else {
+ void handleCreateNewThread();
+ }
return true;
};
diff --git a/app/src/features/conversations/aui/SubagentTaskCard.test.tsx b/app/src/features/conversations/aui/SubagentTaskCard.test.tsx
index 438f4899a9..efb004b3c1 100644
--- a/app/src/features/conversations/aui/SubagentTaskCard.test.tsx
+++ b/app/src/features/conversations/aui/SubagentTaskCard.test.tsx
@@ -14,7 +14,7 @@ const activity: SubagentActivity = {
};
describe('SubagentTaskCard', () => {
- it('renders a running delegation with its nested transcript', () => {
+ it('renders a running delegation with its nested transcript', async () => {
render(
<SubagentTaskCard
type="tool-call"
@@ -31,7 +31,10 @@ describe('SubagentTaskCard', () => {
);
expect(screen.getByTestId('assistant-ui-subagent-call')).toHaveAttribute('data-state', 'working');
- expect(screen.getByText('Researcher')).toBeInTheDocument();
+ expect(screen.getByText('Delegated to Researcher')).toBeInTheDocument();
+ // The transcript is collapsed by default.
+ expect(screen.queryByText('Checking primary sources.')).not.toBeInTheDocument();
+ await userEvent.click(screen.getByRole('button', { name: /Delegated to Researcher/i }));
expect(screen.getByTestId('subagent-activity')).toBeInTheDocument();
expect(screen.getByText('Checking primary sources.')).toBeInTheDocument();
});