feat: open subagent sessions read-only in context panel
Adds read-only embedded chat mode without hiding permission prompts Opens subagent sessions in the context panel instead of replacing the main chat Fixes context panel message loading for embedded sessions
This commit is contained in:
@@ -91,7 +91,8 @@ const normalizeSubtaskModel = (model: SubtaskPartLike['model']): string | null =
|
||||
|
||||
const UserSubtaskPart: React.FC<{ part: SubtaskPartLike }> = ({ part }) => {
|
||||
const [expanded, setExpanded] = React.useState(false);
|
||||
const setCurrentSession = useSessionUIStore((state) => state.setCurrentSession);
|
||||
const effectiveDirectory = useEffectiveDirectory();
|
||||
const openContextPanelTab = useUIStore((state) => state.openContextPanelTab);
|
||||
const { t } = useI18n();
|
||||
|
||||
const description = typeof part.description === 'string' ? part.description.trim() : '';
|
||||
@@ -151,7 +152,13 @@ const UserSubtaskPart: React.FC<{ part: SubtaskPartLike }> = ({ part }) => {
|
||||
type="button"
|
||||
className="typography-meta text-muted-foreground hover:text-foreground transition-colors underline underline-offset-2"
|
||||
onClick={() => {
|
||||
void setCurrentSession(taskSessionID);
|
||||
if (!effectiveDirectory) return;
|
||||
openContextPanelTab(effectiveDirectory, {
|
||||
mode: 'chat',
|
||||
dedupeKey: `session:${taskSessionID}`,
|
||||
label: description || agent || t('contextPanel.mode.chat'),
|
||||
readOnly: true,
|
||||
});
|
||||
}}
|
||||
>
|
||||
{t('chat.messageBody.subtask.openSession')}
|
||||
|
||||
@@ -1080,7 +1080,8 @@ const TaskToolSummary: React.FC<{
|
||||
isActive?: boolean;
|
||||
}> = ({ entries, isExpanded, isMobile, output, sessionId, onShowPopup, input, animateTailText = true, isActive = false }) => {
|
||||
const { t } = useI18n();
|
||||
const setCurrentSession = useSessionUIStore((state) => state.setCurrentSession);
|
||||
const currentDirectory = useDirectoryStore((state) => state.currentDirectory);
|
||||
const openContextPanelTab = useUIStore((state) => state.openContextPanelTab);
|
||||
const showToolFileIcons = useUIStore((state) => state.showToolFileIcons);
|
||||
const displayEntries = entries;
|
||||
|
||||
@@ -1092,8 +1093,13 @@ const TaskToolSummary: React.FC<{
|
||||
|
||||
const handleOpenSession = (event: React.MouseEvent) => {
|
||||
event.stopPropagation();
|
||||
if (sessionId) {
|
||||
setCurrentSession(sessionId);
|
||||
if (sessionId && currentDirectory) {
|
||||
openContextPanelTab(currentDirectory, {
|
||||
mode: 'chat',
|
||||
dedupeKey: `session:${sessionId}`,
|
||||
label: agentType.charAt(0).toUpperCase() + agentType.slice(1),
|
||||
readOnly: true,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user