({
abortSignal,
messages,
initialDescription,
onDone,
backgroundTasks = {},
}: Props)
| 165 | } |
| 166 | |
| 167 | export function Feedback({ |
| 168 | abortSignal, |
| 169 | messages, |
| 170 | initialDescription, |
| 171 | onDone, |
| 172 | backgroundTasks = {}, |
| 173 | }: Props): React.ReactNode { |
| 174 | const [step, setStep] = useState<Step>('userInput'); |
| 175 | const [cursorOffset, setCursorOffset] = useState(0); |
| 176 | const [description, setDescription] = useState(initialDescription ?? ''); |
| 177 | const [feedbackId, setFeedbackId] = useState<string | null>(null); |
| 178 | const [error, setError] = useState<string | null>(null); |
| 179 | const [envInfo, setEnvInfo] = useState<{ |
| 180 | isGit: boolean; |
| 181 | gitState: GitRepoState | null; |
| 182 | }>({ isGit: false, gitState: null }); |
| 183 | const [title, setTitle] = useState<string | null>(null); |
| 184 | const textInputColumns = useTerminalSize().columns - 4; |
| 185 | |
| 186 | useEffect(() => { |
| 187 | async function loadEnvInfo() { |
| 188 | const isGit = await getIsGit(); |
| 189 | let gitState: GitRepoState | null = null; |
| 190 | if (isGit) { |
| 191 | gitState = await getGitState(); |
| 192 | } |
| 193 | setEnvInfo({ isGit, gitState }); |
| 194 | } |
| 195 | void loadEnvInfo(); |
| 196 | }, []); |
| 197 | |
| 198 | const submitReport = useCallback(async () => { |
| 199 | setStep('submitting'); |
| 200 | setError(null); |
| 201 | setFeedbackId(null); |
| 202 | |
| 203 | // Get sanitized errors for the report |
| 204 | const sanitizedErrors = getSanitizedErrorLogs(); |
| 205 | |
| 206 | // Extract last assistant message ID from messages array |
| 207 | const lastAssistantMessage = getLastAssistantMessage(messages); |
| 208 | const lastAssistantMessageId = lastAssistantMessage?.requestId ?? null; |
| 209 | |
| 210 | const [diskTranscripts, rawTranscriptJsonl] = await Promise.all([ |
| 211 | loadAllSubagentTranscriptsFromDisk(), |
| 212 | loadRawTranscriptJsonl(), |
| 213 | ]); |
| 214 | const teammateTranscripts = extractTeammateTranscriptsFromTasks(backgroundTasks); |
| 215 | const subagentTranscripts = { ...diskTranscripts, ...teammateTranscripts }; |
| 216 | |
| 217 | const reportData = { |
| 218 | latestAssistantMessageId: lastAssistantMessageId, |
| 219 | message_count: messages.length, |
| 220 | datetime: new Date().toISOString(), |
| 221 | description, |
| 222 | platform: env.platform, |
| 223 | gitRepo: envInfo.isGit, |
| 224 | terminal: env.terminal, |
nothing calls this directly
no test coverage detected