MCPcopy Create free account
hub / github.com/codeaashu/claude-code / addDreamTurn

Function addDreamTurn

src/tasks/DreamTask/DreamTask.ts:76–104  ·  view source on GitHub ↗
(
  taskId: string,
  turn: DreamTurn,
  touchedPaths: string[],
  setAppState: SetAppState,
)

Source from the content-addressed store, hash-verified

74}
75
76export function addDreamTurn(
77 taskId: string,
78 turn: DreamTurn,
79 touchedPaths: string[],
80 setAppState: SetAppState,
81): void {
82 updateTaskState<DreamTaskState>(taskId, setAppState, task => {
83 const seen = new Set(task.filesTouched)
84 const newTouched = touchedPaths.filter(p => !seen.has(p) && seen.add(p))
85 // Skip the update entirely if the turn is empty AND nothing new was
86 // touched. Avoids re-rendering on pure no-ops.
87 if (
88 turn.text === '' &&
89 turn.toolUseCount === 0 &&
90 newTouched.length === 0
91 ) {
92 return task
93 }
94 return {
95 ...task,
96 phase: newTouched.length > 0 ? 'updating' : task.phase,
97 filesTouched:
98 newTouched.length > 0
99 ? [...task.filesTouched, ...newTouched]
100 : task.filesTouched,
101 turns: task.turns.slice(-(MAX_TURNS - 1)).concat(turn),
102 }
103 })
104}
105
106export function completeDreamTask(
107 taskId: string,

Callers 1

makeDreamProgressWatcherFunction · 0.85

Calls 3

updateTaskStateFunction · 0.50
hasMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected