repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by bugabinga

fix(agent): show progress widget in devil tool

ddf7242a954d3bc554bb1856bac0802f4fbac89e

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Use setWidget instead of notify for visible feedback.
Show debate progress in widget above editor.

Changed files (1)

pi/agent/extensions/devil/index.ts

Modified
237 237 ? `\n\n**Focus:** Challenge specifically from ${stakeholder} perspective.`
240 - // Stream initial output
241 - onUpdate?.({
242 - content: [{ type: "text", text: `## 🗡️ Devil's Advocate Debate\n\n**Idea:** ${idea}\n\n**Context:**\n${contextText}\n\n**Config:** maxRounds=${maxRounds}, stopping=${stoppingConditions}, blocking=${onBlocking}\n**Model:** ${model.provider}/${model.id}\n\n---\n\n` }],
243 - details: {},
244 - });
240 + // Show progress widget
241 + ctx.ui?.setWidget("devil", [
242 + "🗡️ Devil's Advocate",
243 + `Idea: ${idea.slice(0, 50)}${idea.length > 50 ? "..." : ""}`,
244 + `Rounds: ${maxRounds} | Model: ${model.id}`,
245 + "Status: Starting...",
246 + ]);
247 249 const rounds_data: string[] = [];
275 277 rounds_data.push(`### Round ${i}\n\n**Challenge:**\n${devilOutput}\n\n**Your Response:**\n${proposerOutput}`);
277 - // Stream round result
278 - onUpdate?.({
279 - content: [{ type: "text", text: `### Round ${i}/${maxRounds}\n\n**Challenge identified.** Respond above.\n\n` }],
280 - details: { round: i, blockingCount: roundBlockingCount },
281 - });
279 + // Update progress widget
280 + ctx.ui?.setWidget("devil", [
281 + "🗡️ Devil's Advocate",
282 + `Round ${i}/${maxRounds}: Challenge raised`,
283 + `Blocking issues: ${roundBlockingCount}`,
284 + "Awaiting synthesis...",
285 + ]);
283 287 // Check stopping conditions
284 288 const resolvedCount = (proposerOutput.match(/\*\*status\*\*:\s*resolved|status:\s*resolved/gi) || []).length;
331 335 ? `## Full Debate\n\n${rounds_data.join("\n\n---\n\n")}\n\n---\n\n## Summary\n\n${synthesisOutput}${blockingNote}\n\n**Debate:** ${rounds_data.length} rounds | **Blocking issues:** ${blockingIssuesFound}`
332 336 : `${synthesisOutput}${blockingNote}\n\n*Debate: ${rounds_data.length} rounds | Blocking: ${blockingIssuesFound}*`;
338 + // Clear widget on complete
339 + ctx.ui?.setWidget("devil", undefined);
334 341 return {
335 342 content: [{ type: "text", text: outputText }],
336 343 details: { recommendation, rounds: rounds_data.length, blockingIssues: blockingIssuesFound },
338 345 } catch (error) {
339 346 const message = error instanceof Error ? error.message : String(error);
347 + // Clear widget on error
348 + ctx.ui?.setWidget("devil", undefined);
340 349 return {
341 350 content: [{ type: "text", text: `## Debate Failed\n\nError: ${message}` }],
342 351 details: { error: message },