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