Skip to content

Commit e6b967d

Browse files
authored
feat: get rid of start session prompt, autoload (#192)
1 parent e18ddaf commit e6b967d

File tree

2 files changed

+21
-32
lines changed

2 files changed

+21
-32
lines changed

apps/array/src/renderer/features/logs/components/LogView.tsx

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ import {
77
} from "@phosphor-icons/react";
88
import {
99
Box,
10-
Button,
1110
Code,
1211
ContextMenu,
1312
Flex,
1413
IconButton,
14+
Spinner,
1515
Text,
1616
TextArea,
1717
Tooltip,
@@ -25,7 +25,6 @@ interface LogViewProps {
2525
isPromptPending?: boolean;
2626
onSendPrompt?: (text: string) => Promise<void>;
2727
onCancelPrompt?: () => void;
28-
onStartSession?: () => void;
2928
}
3029

3130
function renderNotification(notification: SessionNotification): string {
@@ -61,7 +60,6 @@ export function LogView({
6160
isPromptPending = false,
6261
onSendPrompt,
6362
onCancelPrompt,
64-
onStartSession,
6563
}: LogViewProps) {
6664
const [inputValue, setInputValue] = useState("");
6765
const [showRawLogs, setShowRawLogs] = useState(false);
@@ -133,24 +131,18 @@ export function LogView({
133131
}
134132
}
135133

136-
// Show start session prompt when no session
134+
// Show initializing state when no session yet
137135
if (!sessionId && !isRunning) {
138136
return (
139137
<Flex
140138
direction="column"
141139
align="center"
142140
justify="center"
143141
height="100%"
144-
p="8"
142+
gap="3"
145143
>
146-
<Flex direction="column" align="center" gap="4">
147-
<Text color="gray">No active session</Text>
148-
{onStartSession && (
149-
<Button size="2" onClick={onStartSession}>
150-
Start Agent Session
151-
</Button>
152-
)}
153-
</Flex>
144+
<Spinner size="3" />
145+
<Text color="gray">Initializing session...</Text>
154146
</Flex>
155147
);
156148
}

apps/array/src/renderer/features/task-detail/components/TaskLogsPanel.tsx

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,37 +32,35 @@ export function TaskLogsPanel({ taskId, task }: TaskLogsPanelProps) {
3232
const isRunning =
3333
session?.status === "connected" || session?.status === "connecting";
3434

35-
// Auto-reconnect on mount if there's a previous run
35+
// Auto-connect on mount
3636
const hasAttemptedConnect = useRef(false);
3737
useEffect(() => {
3838
if (hasAttemptedConnect.current) return;
3939
if (!repoPath) return;
40-
if (session) return; // Already have a session
41-
if (!task.latest_run?.id || !task.latest_run?.log_url) return;
40+
if (session) return;
4241

4342
hasAttemptedConnect.current = true;
4443

45-
connectToTask({
46-
taskId: task.id,
47-
repoPath,
48-
latestRunId: task.latest_run.id,
49-
latestRunLogUrl: task.latest_run.log_url,
50-
});
51-
}, [task.id, task.latest_run, repoPath, session, connectToTask]);
52-
53-
const handleStartSession = useCallback(async () => {
54-
if (!repoPath) {
55-
log.error("No repo path available");
56-
return;
57-
}
44+
const isNewSession = !task.latest_run?.id;
5845

59-
await connectToTask({
46+
connectToTask({
6047
taskId: task.id,
6148
repoPath,
6249
latestRunId: task.latest_run?.id,
6350
latestRunLogUrl: task.latest_run?.log_url,
51+
initialPrompt:
52+
isNewSession && task.description
53+
? [{ type: "text", text: task.description }]
54+
: undefined,
6455
});
65-
}, [repoPath, task.id, task.latest_run, connectToTask]);
56+
}, [
57+
task.id,
58+
task.description,
59+
task.latest_run,
60+
repoPath,
61+
session,
62+
connectToTask,
63+
]);
6664

6765
const handleSendPrompt = useCallback(
6866
async (text: string) => {
@@ -91,7 +89,6 @@ export function TaskLogsPanel({ taskId, task }: TaskLogsPanelProps) {
9189
isPromptPending={session?.isPromptPending}
9290
onSendPrompt={handleSendPrompt}
9391
onCancelPrompt={handleCancelPrompt}
94-
onStartSession={handleStartSession}
9592
/>
9693
</Box>
9794
</BackgroundWrapper>

0 commit comments

Comments
 (0)