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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ All notable changes to DreamCoder will be documented in this file.
- **Sessions can start other sessions and message each other.** The agent can start a new session with `StartSession`, either fresh with a brief or as a fork of its own conversation, optionally in a new git worktree; you approve every new session, whatever the permission mode. Any session can message any other with `SendMessage`, across projects: a message wakes the receiver, and a progress report from a child to its parent waits for the parent's next turn instead of interrupting it (a parent that is already working sees it right away). Reports waiting for the parent are listed above its message box. The server stamps who sent each message, so a session cannot pass itself off as you or as another session. `ListSessions` lists sessions, and `RenameSession` lets the agent rename its own session (#239).
- **Sessions are nested in the sidebar.** Sessions the agent started, and conversations you forked, appear under the session they came from, with an icon for each kind and a count that collapses or expands them. Messages from another session appear in the conversation as a one-line row with the sender, which expands to the full text (#239).
- **Project board.** Each project gets a persistent board of tasks and sub-tasks that you and your sessions share; every worktree of the project uses the same board. Open it from the project in the sidebar. A task records its owner, reviewer and creator, acceptance criteria, priority, dependencies, progress, and the owner's and reviewer's reports. Sessions read and update the board with four tools (`KanbanList`, `KanbanGet`, `KanbanCreate`, `KanbanUpdate`): they split work into sub-tasks, record progress, block a task with a question, submit their work and review it. The board notifies the sessions involved when they are assigned, when work is submitted, blocked, sent back, reset or cancelled, and when you comment. `StartSession` can start a session as a task's owner or reviewer. The board page has a board view and a hierarchy view, opens a task in the side panel, and lists what waits on you under "Needs me": blocked tasks, deliveries to accept and tasks whose owner session is gone. You approve every time a session creates the board, starts a session on a task, cancels a task, changes acceptance criteria it did not set, or makes itself a reviewer; only a task's creator or you choose its reviewer (#242).
- **Side chats.** Start a side chat from the side panel's new-tab page to ask about something without interrupting the session: it continues from the session's latest message, in the same working folder, with the same tools, and opens as a tab in the session's side panel. A session can have several. Pages, files and browser tabs a side chat opens appear in the same panel. The tab is named `btw: ` plus your first message; right-click it to rename it, or to detach it into a regular forked session in the sidebar. Closing the tab deletes the side chat, and deleting a session deletes its side chats. Side chats stay out of the sidebar, search and board pickers; `ListSessions` shows a session its own side chats so it can message them. Cmd+. stops the conversation that has the focus.

### Changed

Expand All @@ -27,6 +28,8 @@ All notable changes to DreamCoder will be documented in this file.
- The reply-to-selection button appears when a text selection in a message ends outside the message.
- Permission prompts that ask every time, such as starting a session or editing files under `.git/`, no longer offer "Allow for this session", which could not take effect (#242).
- Tools sent to providers through the OpenAI Responses API are no longer in strict mode, so their optional parameters stay optional (#242).
- Sessions started on a chosen branch or in a new worktree, and the forks and side chats of such sessions, start their agent in the background again when opened, like other sessions, so the first reply is quicker. Only a new session whose branch or worktree has not been set up yet still waits for its first message.
- Discarding a forked session that failed to start no longer removes the worktree of the session it was forked from. The fork copies the parent's worktree record; only the session that created a worktree removes it now.
- Confirmation dialogs keep long workspace paths inside their bounds, so Cancel and Enable remain visible when enabling bypass permissions (#226). Thanks @imshah-id.
- Reading environment files, credential files, and SSH private keys now requires explicit approval through both the Read tool and read-only Bash commands. Recursive directory reads, Grep tool glob filters, and files read from Git history are not covered yet (#235). Thanks @AIR-Xie.
- The exact shell no-op `:` is recognized as read-only and no longer requires approval (#235). Thanks @AIR-Xie.
Expand Down
32 changes: 21 additions & 11 deletions desktop/src/api/sessions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@ import type { WorkspaceArtifactsResult } from '../types/artifact'

type SessionsResponse = { sessions: SessionListItem[]; total: number }
type CreateSessionResponse = { sessionId: string; workDir?: string }
export type DeleteSessionFailure = {
sessionId: string
message: string
code?: string
}

export type BatchDeleteSessionsResponse = {
ok: boolean
successes: string[]
failures: Array<{
sessionId: string
message: string
code?: string
}>
failures: DeleteSessionFailure[]
sideChatFailures: DeleteSessionFailure[]
}
export type SessionGitWorktreeInfo = {
enabled: boolean
Expand All @@ -40,16 +43,15 @@ export type CreateSessionRequest = {
permissionMode?: PermissionMode
runtime?: RuntimeSelection
}
export type BranchSessionRequest = {
targetMessageId: string
title?: string
}
export type BranchSessionRequest =
| { targetMessageId: string; title?: string }
| { kind: 'side' }
export type BranchSessionResponse = {
sessionId: string
title: string
workDir: string | null
sourceSessionId: string
targetMessageId: string
targetMessageId?: string
}
export type RepositoryBranchInfo = {
name: string
Expand Down Expand Up @@ -348,8 +350,16 @@ export const sessionsApi = {
return api.post<BranchSessionResponse>(`/api/sessions/${sessionId}/branch`, body)
},

listSideChats(sessionId: string) {
return api.get<{ sessions: SessionListItem[] }>(`/api/sessions/${sessionId}/side-chats`)
},

detach(sessionId: string) {
return api.patch<{ ok: true }>(`/api/sessions/${sessionId}`, { detach: true })
},

delete(sessionId: string) {
return api.delete<{ ok: true }>(`/api/sessions/${sessionId}`)
return api.delete<{ ok: true; sideChatFailures: DeleteSessionFailure[] }>(`/api/sessions/${sessionId}`)
},

batchDelete(sessionIds: string[]) {
Expand Down
12 changes: 11 additions & 1 deletion desktop/src/components/chat/AskUserQuestion.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,12 @@ describe('AskUserQuestion', () => {
})

it('renders nothing for empty input and then shows questions once they stream in', () => {
const view = render(<AskUserQuestion toolUseId="tool-1" input={{}} />)
const view = render(<AskUserQuestion sessionId={ACTIVE_TAB} toolUseId="tool-1" input={{}} />)
expect(view.container.innerHTML).toBe('')

view.rerender(
<AskUserQuestion
sessionId={ACTIVE_TAB}
toolUseId="tool-1"
input={{ questions: [{ question: 'Should we persist data?', options: [{ label: 'No' }, { label: 'Yes' }] }] }}
/>,
Expand All @@ -86,6 +87,7 @@ describe('AskUserQuestion', () => {
it('submits answers through permission_response updatedInput instead of sending a chat message', () => {
render(
<AskUserQuestion
sessionId={ACTIVE_TAB}
toolUseId="tool-1"
input={{
questions: [
Expand Down Expand Up @@ -122,6 +124,7 @@ describe('AskUserQuestion', () => {
it('allows multiple selections when a question is marked multiSelect', () => {
render(
<AskUserQuestion
sessionId={ACTIVE_TAB}
toolUseId="tool-1"
input={{
questions: [
Expand Down Expand Up @@ -169,6 +172,7 @@ describe('AskUserQuestion', () => {
it('preserves multiSelect for single-question input shape', () => {
render(
<AskUserQuestion
sessionId={ACTIVE_TAB}
toolUseId="tool-1"
input={{
question: 'Which tasks should run?',
Expand Down Expand Up @@ -289,6 +293,7 @@ describe('AskUserQuestion', () => {

render(
<AskUserQuestion
sessionId={ACTIVE_TAB}
toolUseId="tool-1"
input={input}
/>,
Expand Down Expand Up @@ -332,6 +337,7 @@ describe('AskUserQuestion', () => {
it('uses a multiline custom response box and submits it with Ctrl+Enter', () => {
render(
<AskUserQuestion
sessionId={ACTIVE_TAB}
toolUseId="tool-1"
input={{
questions: [
Expand Down Expand Up @@ -388,6 +394,7 @@ describe('AskUserQuestion', () => {

render(
<AskUserQuestion
sessionId={ACTIVE_TAB}
toolUseId="tool-1"
input={{
questions: [
Expand All @@ -409,6 +416,7 @@ describe('AskUserQuestion', () => {
it('steps through multiple questions with progress and submits once all are answered', () => {
render(
<AskUserQuestion
sessionId={ACTIVE_TAB}
toolUseId="tool-1"
input={{
questions: [
Expand Down Expand Up @@ -440,6 +448,7 @@ describe('AskUserQuestion', () => {
it('marks multi-select questions and shows the answered record without an edit action', () => {
const { rerender } = render(
<AskUserQuestion
sessionId={ACTIVE_TAB}
toolUseId="tool-1"
input={{ questions: [{ question: 'Which checks?', multiSelect: true, options: [{ label: 'Lint' }, { label: 'Tests' }] }] }}
/>,
Expand All @@ -449,6 +458,7 @@ describe('AskUserQuestion', () => {

rerender(
<AskUserQuestion
sessionId={ACTIVE_TAB}
toolUseId="tool-1"
input={{
questions: [
Expand Down
11 changes: 4 additions & 7 deletions desktop/src/components/chat/AskUserQuestion.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { useMemo, useRef, useState } from 'react'
import { useChatStore } from '../../stores/chatStore'
import { useTabStore } from '../../stores/tabStore'
import { useTranslation } from '../../i18n'
import { Card, CardTitle, CardContent } from '../shared/ui/card'
import { Textarea } from '../shared/ui/textarea'
Expand Down Expand Up @@ -28,7 +27,7 @@ type AskUserInput = {
}

type Props = {
sessionId?: string | null
sessionId: string
toolUseId: string
input: unknown
result?: unknown
Expand Down Expand Up @@ -64,10 +63,8 @@ function getSelectedAnswer(question: Question, selected: string[] | undefined) {

export function AskUserQuestion({ sessionId, toolUseId, input, result }: Props) {
const respondToPermission = useChatStore((s) => s.respondToPermission)
const activeTabId = useTabStore((s) => s.activeTabId)
const targetSessionId = sessionId ?? activeTabId
const pendingRequestId = useChatStore((s) => {
const pending = targetSessionId ? s.sessions[targetSessionId]?.pendingPermission : undefined
const pending = s.sessions[sessionId]?.pendingPermission
return pending?.toolUseId === toolUseId ? pending.requestId : null
})
const t = useTranslation()
Expand Down Expand Up @@ -173,7 +170,7 @@ export function AskUserQuestion({ sessionId, toolUseId, input, result }: Props)
const response = parts.join('; ')
if (!response) return

if (!targetSessionId || !pendingRequestId) return
if (!pendingRequestId) return

const answers = questions.reduce<Record<string, string>>((acc, question, index) => {
const freeText = freeTexts[index]?.trim()
Expand All @@ -187,7 +184,7 @@ export function AskUserQuestion({ sessionId, toolUseId, input, result }: Props)
}, {})

setHasSubmitted(true)
respondToPermission(targetSessionId, pendingRequestId, true, {
respondToPermission(sessionId, pendingRequestId, true, {
updatedInput: {
...inputObject,
answers,
Expand Down
Loading
Loading