Something went wrong. Try again.
fork of prime agent with changes i want but are not upstreamable probqbly (and some fixes)
Something went wrong. Try again.
1.6 kB · 53 lines
TypeScript
at main
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354/** * Hidden Thinking Label Extension * * Legacy example for the deprecated `ctx.ui.setHiddenThinkingLabel()` hook. * The hook has no effect: thinking is now displayed without a heading. * * Usage: * pi --extension examples/extensions/hidden-thinking-label.ts * * Test: * 1. Load this extension * 2. Press Ctrl+O once to show thinking and file diffs * 3. Ask for something that produces reasoning output * 4. Thinking remains unlabeled; this extension does not change its rendering * * Commands: * /thinking-label <text> Exercise the deprecated hook (no visible effect) * /thinking-label Exercise the deprecated reset (no visible effect) */
import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
const DEFAULT_LABEL = "Pondering...";
export default function (pi: ExtensionAPI) { let label = DEFAULT_LABEL;
const applyLabel = (ctx: ExtensionContext) => { ctx.ui.setHiddenThinkingLabel(label); };
pi.on("session_start", async (_event, ctx) => { applyLabel(ctx); });
pi.registerCommand("thinking-label", { description: "Legacy thinking-label hook (no visible effect).", handler: async (args, ctx) => { const nextLabel = args.trim();
if (!nextLabel) { label = DEFAULT_LABEL; ctx.ui.setHiddenThinkingLabel(); ctx.ui.notify("Thinking labels are no longer displayed; resetting the legacy label has no effect."); return; }
label = nextLabel; ctx.ui.setHiddenThinkingLabel(label); ctx.ui.notify("Thinking labels are no longer displayed; setting the legacy label has no effect."); }, });}