repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

fix(agent): check hasUI before setStatus

21fff5e32789686d94e67672167bcf09660fca2a

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Changed files (1)

pi/agent/extensions/devil/index.ts

Modified
237 237 ? `\n\n**Focus:** Challenge specifically from ${stakeholder} perspective.`
240 - // Show progress via status
241 - ctx.ui?.setStatus("devil", `🗡️ Devil: ${idea.slice(0, 40)}... (${maxRounds}r)`);
240 + // Show progress via status (only if UI available)
241 + if (ctx.hasUI) {
242 + ctx.ui.setStatus("devil", `🗡️ Devil: ${idea.slice(0, 40)}... (${maxRounds}r)`);
244 246 const rounds_data: string[] = [];
272 274 rounds_data.push(`### Round ${i}\n\n**Challenge:**\n${devilOutput}\n\n**Your Response:**\n${proposerOutput}`);
274 276 // Update progress
275 - ctx.ui?.setStatus("devil", `🗡️ Devil: Round ${i}/${maxRounds} - ${roundBlockingCount} blocking`);
277 + if (ctx.hasUI) {
278 + ctx.ui.setStatus("devil", `🗡️ Devil: Round ${i}/${maxRounds} - ${roundBlockingCount} blocking`);
277 281 // Check stopping conditions
278 282 const resolvedCount = (proposerOutput.match(/\*\*status\*\*:\s*resolved|status:\s*resolved/gi) || []).length;
326 330 : `${synthesisOutput}${blockingNote}\n\n*Debate: ${rounds_data.length} rounds | Blocking: ${blockingIssuesFound}*`;
328 332 // Clear status on complete
329 - ctx.ui?.setStatus("devil", undefined);
333 + if (ctx.hasUI) {
334 + ctx.ui.setStatus("devil", undefined);
331 337 return {
332 338 content: [{ type: "text", text: outputText }],
335 341 } catch (error) {
336 342 const message = error instanceof Error ? error.message : String(error);
337 343 // Clear status on error
338 - ctx.ui?.setStatus("devil", undefined);
344 + if (ctx.hasUI) {
345 + ctx.ui.setStatus("devil", undefined);
339 347 return {
340 348 content: [{ type: "text", text: `## Debate Failed\n\nError: ${message}` }],
341 349 details: { error: message },