diff options
| author | Paul Buetow <paul@buetow.org> | 2026-05-24 12:23:03 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-05-24 12:23:03 +0300 |
| commit | 5465aada302974be4977a2186db7053f884ade47 (patch) | |
| tree | 1518ef62fd29ffc7c7a0bc434502fa48732530f8 /pi/agent/extensions/agent-plan-mode | |
| parent | 11dc2f6956d17142238656fe839dc6298125f5d9 (diff) | |
feat: improve task plan mode widget display and update settings version
Diffstat (limited to 'pi/agent/extensions/agent-plan-mode')
| -rw-r--r-- | pi/agent/extensions/agent-plan-mode/index.ts | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/pi/agent/extensions/agent-plan-mode/index.ts b/pi/agent/extensions/agent-plan-mode/index.ts index 7514b82..20306d0 100644 --- a/pi/agent/extensions/agent-plan-mode/index.ts +++ b/pi/agent/extensions/agent-plan-mode/index.ts @@ -368,10 +368,18 @@ export default function agentPlanModeExtension(pi: ExtensionAPI): void { "task-plan-mode", ctx.ui.theme.fg("accent", `task ${currentTask.priority ?? "-"} ${currentTask.id ?? "?"}`), ); + const marker = currentTask.start ? "▶" : "○"; + const idLabel = `${ctx.ui.theme.fg("muted", "id")} ${currentTask.id ?? "?"}`; + const prefix = `${marker} `; + // Reserve room for the prefix and a trailing ellipsis; cap to terminal width. + const cols = Math.max(40, process.stdout.columns ?? 120); + const maxDescLen = Math.max(20, cols - prefix.length - 4); + const firstLine = String(currentTask.description ?? "").split(/\r?\n/, 1)[0]?.trim() ?? ""; + const truncated = firstLine.length > maxDescLen + ? `${firstLine.slice(0, maxDescLen - 1).trimEnd()}…` + : firstLine; ctx.ui.setWidget("task-plan-mode", [ - ctx.ui.theme.fg("accent", "Agent plan focus"), - `${currentTask.start ? "▶" : "○"} ${currentTask.description}`, - `${ctx.ui.theme.fg("muted", "id")} ${currentTask.id ?? "?"}`, + `${ctx.ui.theme.fg("accent", "Agent plan focus")} ${prefix}${truncated} ${idLabel}`, ]); } |
