Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type { SessionConfigOption } from "@agentclientprotocol/sdk";
import { BranchSelector } from "@features/git-interaction/components/BranchSelector";
import { useGitQueries } from "@features/git-interaction/hooks/useGitQueries";
import { getUserPromptsForTask } from "@features/sessions/stores/sessionStore";
import { useIsWorkspaceCloudRun } from "@features/workspace/hooks/useWorkspace";
import { useConnectivity } from "@hooks/useConnectivity";
import { ArrowUp, Circle, Stop } from "@phosphor-icons/react";
import { Flex, IconButton, Text, Tooltip } from "@radix-ui/themes";
Expand Down Expand Up @@ -169,6 +170,7 @@ export const MessageEditor = forwardRef<EditorHandle, MessageEditorProps>(
const clearFocusRequest = useDraftStore((s) => s.actions.clearFocusRequest);
const { isOnline } = useConnectivity();
const taskId = context?.taskId;
const isCloud = useIsWorkspaceCloudRun(taskId);
const disabled = context?.disabled ?? false;
const isLoading = context?.isLoading ?? false;
const repoPath = context?.repoPath;
Expand Down Expand Up @@ -207,6 +209,7 @@ export const MessageEditor = forwardRef<EditorHandle, MessageEditorProps>(
autoFocus,
context: { taskId, repoPath },
getPromptHistory,
capabilities: { bashMode: !isCloud },
onSubmit,
onBashCommand,
onBashModeChange,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ export function useTiptapEditor(options: UseTiptapEditorOptions) {

const text = editor.getText().trim();

if (text.startsWith("!")) {
if (enableBashMode && text.startsWith("!")) {
// Bash mode requires immediate execution, can't be queued
if (isLoading) {
toast.error("Cannot run shell commands while agent is generating");
Expand Down Expand Up @@ -492,6 +492,7 @@ export function useTiptapEditor(options: UseTiptapEditorOptions) {
draft,
clearOnSubmit,
attachments,
enableBashMode,
]);

submitRef.current = submit;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Cloud as CloudIcon } from "@phosphor-icons/react";
import { Flex, Text } from "@radix-ui/themes";
import { useWorkspace } from "@renderer/features/workspace/hooks/useWorkspace";
import { useIsWorkspaceCloudRun } from "@renderer/features/workspace/hooks/useWorkspace";
import type { Task } from "@shared/types";
import type React from "react";
import { useMemo } from "react";
Expand Down Expand Up @@ -40,16 +40,18 @@ export const LeafNodeRenderer: React.FC<LeafNodeRendererProps> = ({
onAddTerminal,
onSplitPanel,
}) => {
const tabs = useTabInjection(
node.content.tabs,
node.id,
taskId,
task,
closeTab,
const isCloud = useIsWorkspaceCloudRun(taskId);
const inputTabs = useMemo(
() =>
isCloud
? node.content.tabs.filter((t) => t.data.type !== "terminal")
: node.content.tabs,
[node.content.tabs, isCloud],
);

const workspace = useWorkspace(taskId);
const isCloud = workspace?.mode === "cloud";
const tabs = useTabInjection(inputTabs, node.id, taskId, task, closeTab);
const activeTabId = tabs.some((t) => t.id === node.content.activeTabId)
? node.content.activeTabId
: (tabs[0]?.id ?? node.content.activeTabId);

const cloudEmptyState = useMemo(
() =>
Expand All @@ -74,6 +76,7 @@ export const LeafNodeRenderer: React.FC<LeafNodeRendererProps> = ({
const contentWithComponents = {
...node.content,
tabs,
activeTabId,
};

return (
Expand All @@ -87,7 +90,7 @@ export const LeafNodeRenderer: React.FC<LeafNodeRendererProps> = ({
onPanelFocus={onPanelFocus}
draggingTabId={draggingTabId}
draggingTabPanelId={draggingTabPanelId}
onAddTerminal={() => onAddTerminal(node.id)}
onAddTerminal={isCloud ? undefined : () => onAddTerminal(node.id)}
onSplitPanel={(direction) => onSplitPanel(node.id, direction)}
emptyState={cloudEmptyState}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ export function useWorkspace(taskId: string | undefined): Workspace | null {
);
}

export function useIsWorkspaceCloudRun(taskId: string | undefined): boolean {
const workspace = useWorkspace(taskId);
return workspace?.mode === "cloud";
}

export function useWorkspaceLoaded(): boolean {
const { isFetched } = useWorkspacesQuery();
return isFetched;
Expand Down
Loading