pi-better-harness 0.1.24 → 0.1.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-better-goal",
3
- "version": "0.1.21",
3
+ "version": "0.1.22",
4
4
  "description": "Pi extension for goal tracking with background-aware continuation.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -62,7 +62,7 @@ export function formatGoalClock(
62
62
  ): string {
63
63
  const timing = goalTiming(goal, now);
64
64
  return (
65
- `Goal [${goal.status}]: ${goal.objective}` +
65
+ `Goal [${goal.status}]: ${flattenObjectiveForRail(goal.objective)}` +
66
66
  ` | active ${formatClockDuration(timing.activeSeconds)}` +
67
67
  ` | elapsed ${formatClockDuration(timing.elapsedSeconds)}`
68
68
  );
@@ -85,10 +85,26 @@ export function renderGoalClockLine(
85
85
  if (fixedWidth >= width) {
86
86
  return truncateToWidth(`${heading} ${active}`, width);
87
87
  }
88
- const objective = truncateToWidth(goal.objective, width - fixedWidth);
88
+ const objective = truncateToWidth(
89
+ flattenObjectiveForRail(goal.objective),
90
+ width - fixedWidth,
91
+ );
89
92
  return styleGoalRailLine(heading, `${active} ${objective}`, fg);
90
93
  }
91
94
 
95
+ /**
96
+ * Goal rail / clock lines must stay one terminal row. Raw objectives can keep
97
+ * newlines for prompts and `/goal` inspection, but embedding them here makes
98
+ * the widget taller than the dock budget and desyncs main-screen differential
99
+ * paints (Working... / Elapsed stacking into scrollback).
100
+ */
101
+ export function flattenObjectiveForRail(objective: string): string {
102
+ return objective
103
+ .replace(/[\r\n\t]+/g, " ")
104
+ .replace(/ {2,}/g, " ")
105
+ .trim();
106
+ }
107
+
92
108
  function styleGoalRailLine(
93
109
  heading: string,
94
110
  tail: string,
@@ -24,6 +24,7 @@ import {
24
24
  import { continuationEvidence, type ContinuationEvidence } from "./continuation.js";
25
25
  import { observeGoalStall } from "./stall.js";
26
26
  import {
27
+ flattenObjectiveForRail,
27
28
  goalClockRefreshDelayMs,
28
29
  goalTiming,
29
30
  isGoalClockVisible,
@@ -541,7 +542,7 @@ export default function (pi: ExtensionAPI): void {
541
542
  if (current && current.status !== "complete" && ctx.hasUI && !isForegroundBusy(ctx)) {
542
543
  const replace = await ctx.ui.confirm(
543
544
  "Replace active goal?",
544
- `Current goal: ${current.objective}`,
545
+ `Current goal: ${flattenObjectiveForRail(current.objective)}`,
545
546
  );
546
547
  if (!replace) {
547
548
  return;
@@ -550,7 +551,7 @@ export default function (pi: ExtensionAPI): void {
550
551
 
551
552
  try {
552
553
  const goal = startOrReplaceGoal(trimmed, null, ctx, "command");
553
- notifyGoal(ctx, `Goal set: ${goal.objective}`);
554
+ notifyGoal(ctx, `Goal set: ${flattenObjectiveForRail(goal.objective)}`);
554
555
  } catch (error) {
555
556
  notifyGoal(ctx, error instanceof Error ? error.message : String(error), "error");
556
557
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-better-harness",
3
- "version": "0.1.24",
3
+ "version": "0.1.25",
4
4
  "description": "Pi extension bundle for subagents, durable background tasks, and goal tracking.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -44,7 +44,7 @@
44
44
  },
45
45
  "dependencies": {
46
46
  "pi-better-background-tasks": "0.2.5",
47
- "pi-better-goal": "0.1.21",
47
+ "pi-better-goal": "0.1.22",
48
48
  "pi-better-subagents": "0.1.21"
49
49
  },
50
50
  "bundledDependencies": [