pi-better-harness 0.50.0 → 0.50.1

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.
Files changed (64) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +12 -12
  3. package/extensions/settings/copy.ts +69 -0
  4. package/extensions/settings/index.ts +1 -1
  5. package/extensions/settings/page.ts +74 -33
  6. package/extensions/settings/registry.ts +2 -0
  7. package/extensions/task-context/compact-task-header.ts +11 -6
  8. package/extensions/task-context/index.ts +7 -7
  9. package/extensions/task-context/plan-presentation.ts +8 -4
  10. package/extensions/task-context/work-ledger-actions.ts +1 -1
  11. package/extensions/task-context/workflow-plan.ts +84 -10
  12. package/extensions/tool-call-guard/waits.ts +1 -1
  13. package/node_modules/pi-better-background-tasks/README.md +21 -10
  14. package/node_modules/pi-better-background-tasks/runtime-client/artifacts/darwin-arm64.gz +0 -0
  15. package/node_modules/pi-better-background-tasks/runtime-client/artifacts/darwin-arm64.json +1 -1
  16. package/node_modules/pi-better-background-tasks/runtime-client/artifacts/darwin-x64.gz +0 -0
  17. package/node_modules/pi-better-background-tasks/runtime-client/artifacts/darwin-x64.json +1 -1
  18. package/node_modules/pi-better-background-tasks/runtime-client/artifacts/linux-arm64.gz +0 -0
  19. package/node_modules/pi-better-background-tasks/runtime-client/artifacts/linux-arm64.json +1 -1
  20. package/node_modules/pi-better-background-tasks/runtime-client/artifacts/linux-x64.gz +0 -0
  21. package/node_modules/pi-better-background-tasks/runtime-client/artifacts/linux-x64.json +1 -1
  22. package/node_modules/pi-better-background-tasks/runtime-client/src/runtime/root.mjs +5 -2
  23. package/node_modules/pi-better-background-tasks/src/index.ts +19 -0
  24. package/node_modules/pi-better-background-tasks/src/managed-frontend.ts +76 -5
  25. package/node_modules/pi-better-background-tasks/src/navigator-provider.ts +4 -0
  26. package/node_modules/pi-better-background-tasks/src/observed-waits.ts +168 -24
  27. package/node_modules/pi-better-background-tasks/src/process.ts +45 -11
  28. package/node_modules/pi-better-background-tasks/src/review-settings.ts +18 -0
  29. package/node_modules/pi-better-background-tasks/src/runtime.ts +8 -73
  30. package/node_modules/pi-better-background-tasks/src/shared-navigator.ts +47 -26
  31. package/node_modules/pi-better-background-tasks/src/shared-operation-coordinator/src/outbox.ts +9 -0
  32. package/node_modules/pi-better-background-tasks/src/shared-operation-coordinator/src/store.ts +6 -0
  33. package/node_modules/pi-better-background-tasks/src/stall.ts +7 -4
  34. package/node_modules/pi-better-background-tasks/src/supervised-progress.ts +43 -0
  35. package/node_modules/pi-better-background-tasks/src/supervisor/emit-runner.mjs +1 -0
  36. package/node_modules/pi-better-background-tasks/src/supervisor/generated/process.mjs +49 -11
  37. package/node_modules/pi-better-background-tasks/src/supervisor/generated/runner.mjs +47 -4
  38. package/node_modules/pi-better-background-tasks/src/supervisor/generated/store.mjs +3 -3
  39. package/node_modules/pi-better-background-tasks/src/supervisor/generated/watch-fingerprint.mjs +69 -0
  40. package/node_modules/pi-better-background-tasks/src/supervisor/runner.ts +38 -3
  41. package/node_modules/pi-better-background-tasks/src/supervisor/store.ts +3 -3
  42. package/node_modules/pi-better-background-tasks/src/supervisor/supervisor.ts +6 -3
  43. package/node_modules/pi-better-background-tasks/src/tools.ts +26 -16
  44. package/node_modules/pi-better-background-tasks/src/types.ts +4 -2
  45. package/node_modules/pi-better-background-tasks/src/watch-fingerprint.ts +70 -0
  46. package/node_modules/pi-better-subagents/assignment-outcomes.ts +2 -5
  47. package/node_modules/pi-better-subagents/assignment-report.ts +20 -0
  48. package/node_modules/pi-better-subagents/batch.mjs +12 -5
  49. package/node_modules/pi-better-subagents/finalization.ts +7 -2
  50. package/node_modules/pi-better-subagents/index.ts +42 -18
  51. package/node_modules/pi-better-subagents/runtime-client/artifacts/darwin-arm64.gz +0 -0
  52. package/node_modules/pi-better-subagents/runtime-client/artifacts/darwin-arm64.json +1 -1
  53. package/node_modules/pi-better-subagents/runtime-client/artifacts/darwin-x64.gz +0 -0
  54. package/node_modules/pi-better-subagents/runtime-client/artifacts/darwin-x64.json +1 -1
  55. package/node_modules/pi-better-subagents/runtime-client/artifacts/linux-arm64.gz +0 -0
  56. package/node_modules/pi-better-subagents/runtime-client/artifacts/linux-arm64.json +1 -1
  57. package/node_modules/pi-better-subagents/runtime-client/artifacts/linux-x64.gz +0 -0
  58. package/node_modules/pi-better-subagents/runtime-client/artifacts/linux-x64.json +1 -1
  59. package/node_modules/pi-better-subagents/runtime-client/src/runtime/root.mjs +5 -2
  60. package/node_modules/pi-better-subagents/shared-navigator.ts +47 -26
  61. package/node_modules/pi-better-subagents/shared-operation-coordinator/src/outbox.ts +9 -0
  62. package/node_modules/pi-better-subagents/shared-operation-coordinator/src/store.ts +6 -0
  63. package/node_modules/pi-better-subagents/work-observation.ts +20 -1
  64. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.50.1] - 2026-11-22
4
+
5
+ ### Changed
6
+
7
+ - Clarify the labels and descriptions in `/harness-settings` so the display, tools, and project work ledger are easier to distinguish. (#868)
8
+
9
+ ### Fixed
10
+
11
+ - Summarize Rush Todo stages from every issue in the saved plan, including folded rows. Show an in-progress dot alongside a blocker when other issues are still moving through that stage. (#870)
12
+
3
13
  ## [0.50.0] - 2026-11-20
4
14
 
5
15
  ### Changed
package/README.md CHANGED
@@ -20,9 +20,9 @@ Use `pi-better-harness` when you want the full working set for Pi. It manages:
20
20
 
21
21
  ## Outcome & Todo
22
22
 
23
- In `/harness-settings`, **Outcome & Todo display** (`outcome-todo-display`)
24
- defaults to **On**, and **Outcome & Todo hooks** (`outcome-todo`) defaults to
25
- **Off**. **Long-term work ledger** (`outcome-todo-ledger`) is a third independent
23
+ In `/harness-settings`, **Outcome and Todo panel** (`outcome-todo-display`)
24
+ defaults to **On**, and **Outcome and Todo tools** (`outcome-todo`) defaults to
25
+ **Off**. **Project work ledger** (`outcome-todo-ledger`) is a third independent
26
26
  control and defaults to **Off**. Saved outcomes and checklists display even when
27
27
  hooks are off; missing state creates no placeholder, state, or settings. Turning
28
28
  display off does not disable hooks. Saved v1 `enabled` remains the hooks
@@ -66,7 +66,7 @@ Existing Plan session histories restore as Todo. Workflow task-plan files and
66
66
  revision checks stay unchanged; skills continue using their own records when the
67
67
  optional interface is off. See the [usage guide](docs/usage.md#outcome--todo).
68
68
 
69
- The separate **Long-term work ledger** setting enables a durable project-scoped
69
+ The separate **Project work ledger** setting enables a durable project-scoped
70
70
  record of the overall outcome, boundaries, and high-level items. It stays off by
71
71
  default; turning it off removes ledger views and hints without deleting records.
72
72
  The same `update_todo` / `get_todo` interface carries optional ledger payloads and
@@ -150,14 +150,14 @@ need interactive confirmation. Full policy: [pi-better-sandbox](https://github.c
150
150
 
151
151
  ## Minimal Tool Output
152
152
 
153
- The bundled harness provides **Tool output: Normal / Minimal** in
153
+ The bundled harness provides **Tool output** with **Normal** and **Compact** in
154
154
  `/harness-settings`. `/tool-output minimal`, `/tool-output normal`, and
155
155
  `/tool-output` (toggle) remain compatibility shortcuts to the same preference.
156
156
  Minimal mode folds each tool call into a single-line header, including running
157
157
  calls. The tool-specific icon and tool name share a state color: accent while
158
158
  running, muted when completed, and error-colored when failed. In fullscreen Pi, a soft highlight travels through the entire visible running tool name and its
159
159
  inline command/path details; details stay dim between highlight passes. Scrollback terminals keep static state colors.
160
- Choose **Tool animation: Off** in `/harness-settings` for static running headers.
160
+ Choose **Tool progress animation** set to **Off** in `/harness-settings` for static running headers.
161
161
  Running and failed calls retain text labels so state never depends on color or
162
162
  motion alone. Tool rows are indented two columns past
163
163
  the assistant text padding. Long
@@ -211,12 +211,12 @@ pi -e ./packages/pi-better-harness/extensions/minimal-output/index.ts
211
211
 
212
212
  The bundled harness provides `/harness-settings`, using Pi's native settings
213
213
  list. It opens the settings screens of loaded Sandbox, Subagents, and Goal
214
- packages without duplicating their configuration, plus the **Agents** shortcut
214
+ packages without duplicating their configuration, plus the **Agent catalog** shortcut
215
215
  to the `/agents` catalog. `/sandbox`, `/subagents settings`, `/agents`, and
216
216
  `/goal settings` remain available in standalone installations.
217
217
  Packages without a settings screen are not listed. Pi's `/settings` is unchanged.
218
218
 
219
- **View** selects `flatten` (the default) or `tree`. Flatten keeps the Subagents
219
+ **Navigator layout** selects **Flat list** (the default) or **Tree**. Flatten keeps the Subagents
220
220
  and Background Tasks groups and includes tasks launched by subagents. Tree puts
221
221
  Main and subagents at the same level, with each agent's background tasks indented
222
222
  beneath it. Switching applies immediately and saves `piBetterHarness.navigatorView`.
@@ -224,19 +224,19 @@ Worker-owned tasks expose status and logs; their execution remains managed by th
224
224
  owning agent. Older worker tasks appear when a retained assignment wait proves
225
225
  their parent, so unrelated sessions are never inferred from a reused conversation.
226
226
 
227
- **Sticky navigator** controls the shared navigator used by Goal, Outcome & Todo,
227
+ **Pin work panels** controls the shared navigator used by Goal, Outcome & Todo,
228
228
  Subagents, and Background Tasks. **On** (the default) keeps it above the input;
229
229
  **Off** places it in the conversation so it scrolls with chat. Changes apply
230
230
  immediately and save under `piBetterHarness.navigator` for future sessions.
231
231
  Package controls and detail views remain available in either mode. Standalone
232
232
  packages use the same shared navigator and saved preference.
233
233
 
234
- The hub includes **Tool output** and **Tool animation** when the bundled renderer
234
+ The hub includes **Tool output** and **Tool progress animation** when the bundled renderer
235
235
  extension is loaded. Changes apply immediately and save the default for future
236
236
  sessions. The animation preference is stored in `piBetterHarness.toolAnimation`;
237
237
  normal output and expanded tool details are never animated.
238
- The hub also owns **Completions while busy**, shared by Subagents and Background
239
- Tasks. Choose **Wait until idle** (the default) or **Steer active run**. Changes
238
+ The hub also owns **Completion delivery**, shared by Subagents and Background
239
+ Tasks. Choose **When idle** (the default) or **During run**. Changes
240
240
  apply immediately and autosave to the current session branch, including across
241
241
  reloads. Press **Ctrl+S** to save the current choice as your default for future
242
242
  Pi sessions; changing a session afterward does not change that saved default.
@@ -0,0 +1,69 @@
1
+ interface SettingCopy {
2
+ label?: string;
3
+ description: string;
4
+ values?: Readonly<Record<string, string>>;
5
+ }
6
+
7
+ // Use stable contribution IDs so existing versions of the extensions get the same help.
8
+ export const controlCopy = new Map<string, SettingCopy>([
9
+ ["background-review-interval", {
10
+ label: "Background wait reviews",
11
+ description: "When the session is waiting for a local task with callbacks on, Pi asks the main agent to review it after this long without progress. Each review shows elapsed time and the last check or output.",
12
+ }],
13
+ ["goal-auto-start", {
14
+ description: "Start a Goal automatically when Pi accepts an Outcome with work to do and there is no unfinished Goal.",
15
+ }],
16
+ ["tool-call-guard", {
17
+ label: "Foreground wait guard",
18
+ description: "Blocks recognized shell waits, such as watching CI or following logs. Pi gets a prompt to run them in the background so the session stays responsive.",
19
+ }],
20
+ ["outcome-todo", {
21
+ label: "Outcome and Todo tools",
22
+ description: "Lets Pi record what the session should deliver and track its progress as a checklist.",
23
+ }],
24
+ ["outcome-todo-ledger", {
25
+ label: "Project work ledger",
26
+ description: "Lets sessions attach a saved project checklist and carry its progress across sessions. Use /ledger to list or attach a ledger.",
27
+ }],
28
+ ["outcome-todo-display", {
29
+ label: "Outcome and Todo panel",
30
+ description: "Shows the session objective and checklist in the TUI when Outcome and Todo tools are on.",
31
+ }],
32
+ ["navigator-sticky", {
33
+ label: "Pin work panels",
34
+ description: "Keeps the work panels above the editor as the conversation scrolls. Off lets them scroll with the conversation on supported Pi versions.",
35
+ }],
36
+ ["navigator-view", {
37
+ label: "Navigator layout",
38
+ description: "Tree nests tasks under their agent. Flat list groups rows by work type.",
39
+ values: { tree: "Tree", flatten: "Flat list" },
40
+ }],
41
+ ["tool-output", {
42
+ description: "Normal shows the usual tool transcript. Compact groups completed calls and hides their details until you expand the group.",
43
+ values: { Minimal: "Compact" },
44
+ }],
45
+ ["tool-animation", {
46
+ label: "Tool progress animation",
47
+ description: "Shows an animated shimmer on active tool calls. Turn it off to remove that animation.",
48
+ values: { Shimmer: "On" },
49
+ }],
50
+ ]);
51
+
52
+ export const linkCopy = new Map<string, SettingCopy>([
53
+ ["agents", {
54
+ label: "Agent catalog",
55
+ description: "Browse the agents Pi can delegate to and manage their profiles.",
56
+ }],
57
+ ["goal", {
58
+ label: "Goal settings",
59
+ description: "Choose when Goals continue automatically, resume from conversation, or pause on Escape.",
60
+ }],
61
+ ["sandbox", {
62
+ label: "Sandbox settings",
63
+ description: "Review sandbox permissions for what tools can access and where they can run.",
64
+ }],
65
+ ["subagents", {
66
+ label: "Subagent settings",
67
+ description: "Choose how Pi delegates work and set limits for concurrent subagents, timeouts, and progress alerts.",
68
+ }],
69
+ ]);
@@ -24,7 +24,7 @@ export default function harnessSettingsExtension(pi: ExtensionAPI): void {
24
24
  const readSettings = (): ReturnType<typeof getCallbackSettings> => {
25
25
  try { return getCallbackSettings(ctx); }
26
26
  catch (error) {
27
- const message = `Callback default unavailable; using Wait until idle: ${error instanceof Error ? error.message : String(error)}`;
27
+ const message = `Callback default unavailable. Using When idle. ${error instanceof Error ? error.message : String(error)}`;
28
28
  if (!reported.has(message)) { ctx.ui.notify(message, "error"); reported.add(message); }
29
29
  return { mode: "hold", source: "default" };
30
30
  }
@@ -1,5 +1,6 @@
1
- import type { Theme } from "@earendil-works/pi-coding-agent";
2
- import { Container, SettingsList, Text, getKeybindings, setKeybindings, KeybindingsManager, TUI_KEYBINDINGS, matchesKey, type SettingItem } from "@earendil-works/pi-tui";
1
+ import type { ExtensionCommandContext, Theme } from "@earendil-works/pi-coding-agent";
2
+ import { Container, SettingsList, Spacer, Text, getKeybindings, setKeybindings, KeybindingsManager, TUI_KEYBINDINGS, matchesKey, type SettingItem } from "@earendil-works/pi-tui";
3
+ import { controlCopy, linkCopy } from "./copy.ts";
3
4
  import type { SettingsControl, SettingsLink } from "./registry.ts";
4
5
 
5
6
  export interface CallbackSettingsControl {
@@ -9,45 +10,85 @@ export interface CallbackSettingsControl {
9
10
  }
10
11
 
11
12
  const CALLBACK_SETTING_ID = "callbacks:while-busy";
12
- const callbackLabel = (mode: "hold" | "steer") => mode === "steer" ? "Steer active run" : "Wait until idle";
13
+ const callbackLabels = { hold: "When idle", steer: "During run" };
14
+ const callbackDescription = (source: "session" | "default") => [
15
+ "When idle holds background and subagent results until the run ends. During run can deliver them between tool calls.",
16
+ source === "session" ? "Using this session’s setting." : "Using the default.",
17
+ "Changes apply to this session. Ctrl+S saves your default.",
18
+ ].join("\n");
13
19
 
14
- export async function chooseHarnessSetting(ctx: any, links: SettingsLink[], selected?: string, callbacks?: CallbackSettingsControl, controls: SettingsControl[] = [], navigatorView?: SettingsControl): Promise<string | undefined> {
15
- return ctx.ui.custom((tui: any, theme: Theme, _kb: unknown, done: (id?: string) => void) => {
16
- let callbackMode = callbacks?.get().mode ?? "hold";
17
- const callbackSetting: SettingItem | undefined = callbacks ? {
20
+ const controlOrder = new Map([...controlCopy.keys()].map((id, index) => [id, index]));
21
+
22
+ function presentControl(control: SettingsControl) {
23
+ const copy = controlCopy.get(control.id);
24
+ const valueLabels = copy?.values;
25
+ const display = (raw: string) => valueLabels && Object.hasOwn(valueLabels, raw) ? valueLabels[raw]! : raw;
26
+ const values = control.values.map(display);
27
+ const description = typeof control.description === "string" && control.description.trim()
28
+ ? control.description : copy?.description;
29
+ const item: SettingItem = {
30
+ id: `setting:${control.id}`,
31
+ label: copy?.label ?? control.label,
32
+ currentValue: display(control.get()),
33
+ description: [description ?? `Available values are ${values.join(", ")}.`, copy && "Saved as a user default."].filter(Boolean).join("\n"),
34
+ values,
35
+ };
36
+ return { control, item, display, values };
37
+ }
38
+
39
+ function presentLink(link: SettingsLink): SettingItem {
40
+ const copy = linkCopy.get(link.id);
41
+ const description = typeof link.description === "string" && link.description.trim()
42
+ ? link.description : copy?.description;
43
+ const action = "Open";
44
+ return {
45
+ id: `link:${link.id}`,
46
+ label: copy?.label ?? link.label,
47
+ currentValue: action,
48
+ description: [description, `You can also run ${link.command}.`].filter(Boolean).join("\n"),
49
+ values: [action],
50
+ };
51
+ }
52
+
53
+ export async function chooseHarnessSetting(ctx: ExtensionCommandContext, links: SettingsLink[], selected?: string, callbacks?: CallbackSettingsControl, controls: SettingsControl[] = [], navigatorView?: SettingsControl): Promise<string | undefined> {
54
+ return ctx.ui.custom((tui, theme: Theme, _kb, done: (id?: string) => void) => {
55
+ const currentCallback = callbacks?.get();
56
+ let callbackMode = currentCallback?.mode ?? "hold";
57
+ const callbackSetting: SettingItem | undefined = currentCallback && {
18
58
  id: CALLBACK_SETTING_ID,
19
- label: "Completions while busy",
20
- currentValue: callbackLabel(callbackMode),
21
- description: callbacks.get().source === "session" ? "Session setting" : "User default",
22
- values: ["Wait until idle", "Steer active run"],
23
- } : undefined;
24
- const controlItem = (control: SettingsControl): SettingItem => ({ id: `setting:${control.id}`, label: control.label, currentValue: control.get(), description: "User default", values: control.values });
25
- const allControls = navigatorView ? [...controls, navigatorView] : controls;
26
- const items: SettingItem[] = [
59
+ label: "Completion delivery",
60
+ currentValue: callbackLabels[callbackMode],
61
+ description: callbackDescription(currentCallback.source),
62
+ values: Object.values(callbackLabels),
63
+ };
64
+ const allControls = navigatorView ? [...controls, navigatorView] : [...controls];
65
+ const orderedControls = allControls.sort((a, b) =>
66
+ (controlOrder.get(a.id) ?? controlOrder.size) - (controlOrder.get(b.id) ?? controlOrder.size)
67
+ ).map(presentControl);
68
+ const items = [
27
69
  ...(callbackSetting ? [callbackSetting] : []),
28
- ...controls.map(controlItem),
29
- ...links.map(link => ({ id: `link:${link.id}`, label: link.label, currentValue: link.command, description: "Open package settings", values: [link.command] })),
30
- // Append View so the existing controls and package links keep their positions.
31
- ...(navigatorView ? [controlItem(navigatorView)] : []),
70
+ ...orderedControls.map(({ item }) => item),
71
+ ...links.map(presentLink),
32
72
  ];
33
- const feedback = new Text("", 0, 0);
73
+ const feedback = new Text("", 2, 0);
34
74
  let changing = false;
35
75
  const report = (message: string, error = false) => {
36
- feedback.setText(theme.fg(error ? "error" : "muted", message));
76
+ feedback.setText(theme.fg(error ? "error" : "text", message));
37
77
  tui.requestRender?.();
38
78
  };
39
79
  const list = new SettingsList(items, 10, {
40
80
  label: (text, active) => theme.fg(active ? "accent" : "text", text),
41
81
  value: (text, active) => active ? theme.inverse(text) : theme.fg("muted", text),
42
- description: text => theme.fg("muted", text), cursor: "> ", hint: text => theme.fg("dim", text),
82
+ description: text => theme.fg("text", text), cursor: "> ", hint: text => theme.fg("dim", text),
43
83
  }, (id, value) => {
44
- const control = allControls.find(item => `setting:${item.id}` === id);
45
- if (control) {
46
- const previous = control.get();
84
+ const entry = orderedControls.find(({ item }) => item.id === id);
85
+ if (entry) {
86
+ const previous = entry.display(entry.control.get());
87
+ const next = entry.control.values[entry.values.indexOf(value)]!;
47
88
  changing = true;
48
89
  report("Saving setting...");
49
- Promise.resolve().then(() => control.change(value, ctx)).then(() => {
50
- list.updateValue(id, control.get());
90
+ Promise.resolve().then(() => entry.control.change(next, ctx)).then(() => {
91
+ list.updateValue(id, entry.display(entry.control.get()));
51
92
  report("Setting saved.");
52
93
  }).catch(error => {
53
94
  list.updateValue(id, previous);
@@ -57,13 +98,13 @@ export async function chooseHarnessSetting(ctx: any, links: SettingsLink[], sele
57
98
  }
58
99
  if (id !== CALLBACK_SETTING_ID || !callbacks || !callbackSetting) { done(id); return; }
59
100
  try {
60
- const nextMode = value === "Steer active run" ? "steer" : "hold";
101
+ const nextMode = value === callbackLabels.steer ? "steer" : "hold";
61
102
  callbacks.change(nextMode);
62
103
  callbackMode = nextMode;
63
- callbackSetting.description = "Session setting";
104
+ callbackSetting.description = callbackDescription("session");
64
105
  report("Session setting saved.");
65
106
  } catch (error) {
66
- list.updateValue(CALLBACK_SETTING_ID, callbackLabel(callbackMode));
107
+ list.updateValue(CALLBACK_SETTING_ID, callbackLabels[callbackMode]);
67
108
  report(error instanceof Error ? error.message : String(error), true);
68
109
  }
69
110
  }, () => done(), { enableSearch: false });
@@ -79,9 +120,9 @@ export async function chooseHarnessSetting(ctx: any, links: SettingsLink[], sele
79
120
  } finally { setKeybindings(bindings); }
80
121
  }
81
122
  const page = new Container();
82
- page.addChild(new Text(theme.fg("accent", theme.bold("Harness settings")), 0, 0));
123
+ page.addChild(new Text(theme.bold(theme.fg("text", "Harness settings")), 0, 0));
124
+ page.addChild(new Spacer(1));
83
125
  page.addChild(list);
84
- if (callbacks) page.addChild(new Text(theme.fg("dim", "Callbacks autosave to this session. Ctrl+S saves the default for future sessions."), 0, 0));
85
126
  page.addChild(feedback);
86
127
  return {
87
128
  render: (width: number) => page.render(width),
@@ -97,4 +138,4 @@ export async function chooseHarnessSetting(ctx: any, links: SettingsLink[], sele
97
138
  },
98
139
  };
99
140
  });
100
- }
141
+ }
@@ -3,6 +3,7 @@ import type { ExtensionAPI, ExtensionCommandContext } from "@earendil-works/pi-c
3
3
  export interface SettingsLink {
4
4
  id: string;
5
5
  label: string;
6
+ description?: string;
6
7
  command: string;
7
8
  open(ctx: ExtensionCommandContext): Promise<void> | void;
8
9
  }
@@ -10,6 +11,7 @@ export interface SettingsLink {
10
11
  export interface SettingsControl {
11
12
  id: string;
12
13
  label: string;
14
+ description?: string;
13
15
  values: string[];
14
16
  get(): string;
15
17
  change(value: string, ctx: ExtensionCommandContext): Promise<void> | void;
@@ -14,19 +14,24 @@ export function canRenderTaskRuntime(width: number, runtime: CompactTaskHeader["
14
14
  return visibleWidth(runtime.status + (runtime.clock ? ` ${runtime.clock}` : "")) + 6 <= Math.floor(width);
15
15
  }
16
16
 
17
- export function renderCompactTaskHeader(summary: string | undefined, width: number, theme: PlanRenderTheme, header: CompactTaskHeader): string[] {
17
+ export function renderCompactTaskHeader(summary: string | undefined, width: number, theme: PlanRenderTheme, header: CompactTaskHeader, inProgress = false): string[] {
18
18
  const size = Math.max(1, Math.floor(width));
19
- const left = theme.fg("warning", "todo") + (header.disclosure ? theme.fg("accent", ` ${header.disclosure}`) : "") +
19
+ let left = theme.fg("warning", "todo") + (header.disclosure ? theme.fg("accent", ` ${header.disclosure}`) : "") +
20
20
  (summary ? theme.fg("dim", ` ${summary}`) : "");
21
21
  const runtime = header.runtime;
22
22
  const tone = runtime?.status === "complete" ? "success" : runtime?.status === "active" ? "accent" : "warning";
23
23
  const right = runtime ? theme.fg(tone, runtime.status) + (runtime.clock ? theme.fg("dim", ` ${runtime.clock}`) : "") : "";
24
24
  const rightWidth = visibleWidth(right);
25
- const leftWidth = Math.max(4, size - rightWidth - 2);
25
+ const showRuntime = right && canRenderTaskRuntime(size, runtime);
26
+ const leftWidth = showRuntime ? Math.max(4, size - rightWidth - 2) : size;
27
+ const progressMark = " · ●";
28
+ if (inProgress && visibleWidth(left) + visibleWidth(progressMark) <= leftWidth) {
29
+ left += theme.fg("accent", progressMark);
30
+ }
26
31
  const title = truncateToWidth(left, leftWidth);
27
- const heading = right && canRenderTaskRuntime(size, runtime)
32
+ const heading = showRuntime
28
33
  ? title + " ".repeat(Math.max(2, size - visibleWidth(title) - rightWidth)) + right
29
- : truncateToWidth(left, size);
34
+ : title;
30
35
  const lines = [truncateToWidth(heading, size)];
31
36
  const indent = Math.min(2, size - 1);
32
37
  const details: string[] = [];
@@ -40,4 +45,4 @@ export function renderCompactTaskHeader(summary: string | undefined, width: numb
40
45
  }
41
46
  if (details.length > 0) lines.push(...details, "");
42
47
  return lines;
43
- }
48
+ }
@@ -303,7 +303,7 @@ export default function taskContextExtension(pi: ExtensionAPI): void {
303
303
  };
304
304
 
305
305
  const attachLedger = (ctx: ExtensionContext, id: string): WorkLedger => {
306
- if (!ledgerEnabled) throw new Error("Long-term work ledger is off. Enable it in /harness-settings first.");
306
+ if (!ledgerEnabled) throw new Error("Project work ledger is off. Enable it in /harness-settings first.");
307
307
  const candidate = readAssociatedWorkLedger(ctx.cwd, id);
308
308
  if (ledgerId !== id) pi.appendEntry(WORK_LEDGER_ASSOCIATION_ENTRY, workLedgerAssociationEntry(id));
309
309
  ledgerId = id;
@@ -549,7 +549,7 @@ export default function taskContextExtension(pi: ExtensionAPI): void {
549
549
  ],
550
550
  parameters: UpdatePlanSchema,
551
551
  async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
552
- if (!enabled) throw new Error("Outcome & Todo hooks are off. Enable them in /harness-settings.");
552
+ if (!enabled) throw new Error("Outcome and Todo tools are off. Enable them in /harness-settings.");
553
553
  const owner = workflowPlanOwner(ctx);
554
554
  const input = params as {
555
555
  explanation?: string; newTask?: boolean; todo?: PlanStepInput[]; outcome?: OutcomeInput;
@@ -560,7 +560,7 @@ export default function taskContextExtension(pi: ExtensionAPI): void {
560
560
  input.newTask !== undefined || input.explanation !== undefined) {
561
561
  throw new Error("Send update_todo ledger alone; ledger changes are not combined with outcome, Todo, or workflow changes.");
562
562
  }
563
- if (!ledgerEnabled) throw new Error("Long-term work ledger is off. Enable it in /harness-settings first.");
563
+ if (!ledgerEnabled) throw new Error("Project work ledger is off. Enable it in /harness-settings first.");
564
564
  const result = executeLedgerMutation(input.ledger, ctx.cwd, ledgerSessionBinding(ctx));
565
565
  if (result.details.ledger && result.details.ledger.id === ledgerId) {
566
566
  ledger = result.details.ledger;
@@ -694,10 +694,10 @@ export default function taskContextExtension(pi: ExtensionAPI): void {
694
694
  promptSnippet: "Inspect the common work plan: outcome, Todo or workflow rows, and the associated durable ledger",
695
695
  parameters: getTodoParameters,
696
696
  async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
697
- if (!enabled) throw new Error("Outcome & Todo hooks are off. Enable them in /harness-settings.");
697
+ if (!enabled) throw new Error("Outcome and Todo tools are off. Enable them in /harness-settings.");
698
698
  const input = params as { ledger?: GetTodoLedgerInput };
699
699
  if (input.ledger !== undefined && !ledgerEnabled) {
700
- throw new Error("Long-term work ledger is off. Enable it in /harness-settings first.");
700
+ throw new Error("Project work ledger is off. Enable it in /harness-settings first.");
701
701
  }
702
702
  refreshAssociatedLedger(ctx);
703
703
  const ledgerText = ledgerTodoText();
@@ -785,7 +785,7 @@ export default function taskContextExtension(pi: ExtensionAPI): void {
785
785
  handler: async (args, ctx) => {
786
786
  const [action = "", value = ""] = args.trim().split(/\s+/, 2);
787
787
  if (!ledgerEnabled && (action === "" || action === "list" || action === "show")) {
788
- ctx.ui.notify("Long-term work ledger is off. Enable it in /harness-settings to view ledgers.", "warning");
788
+ ctx.ui.notify("Project work ledger is off. Enable it in /harness-settings to view ledgers.", "warning");
789
789
  return;
790
790
  }
791
791
  const store = openWorkLedgerStore({ cwd: ctx.cwd });
@@ -813,7 +813,7 @@ export default function taskContextExtension(pi: ExtensionAPI): void {
813
813
  return;
814
814
  }
815
815
  if (!ledgerEnabled) {
816
- ctx.ui.notify("Long-term work ledger is off. Enable it in /harness-settings before associating a ledger.", "warning");
816
+ ctx.ui.notify("Project work ledger is off. Enable it in /harness-settings before associating a ledger.", "warning");
817
817
  return;
818
818
  }
819
819
  if (!value) {
@@ -26,10 +26,13 @@ export const plainPlanTheme: PlanRenderTheme = { fg: (_color, value) => value };
26
26
 
27
27
  export const COMPACT_PLAN_ROWS = 5;
28
28
 
29
+ function isInProgress(status: DisplayStatus): boolean {
30
+ return status === "in_progress" || status === "implemented" || status === "reviewed";
31
+ }
32
+
29
33
  function compactRowIndices(rows: PlanRow[]): number[] {
30
34
  if (rows.length <= COMPACT_PLAN_ROWS) return rows.map((_, index) => index);
31
- let active = rows.flatMap((row, index) =>
32
- ["in_progress", "implemented", "reviewed"].includes(row.status) ? [index] : []);
35
+ let active = rows.flatMap((row, index) => isInProgress(row.status) ? [index] : []);
33
36
  if (!active.length) active = rows.flatMap((row, index) =>
34
37
  row.status === "blocked" || row.status === "failed" ? [index] : []);
35
38
  const firstPending = rows.findIndex((row) => row.status === "pending");
@@ -78,7 +81,8 @@ export function renderPlanPresentation(
78
81
  if (count(status)) summary.push(`${count(status)} ${label}`);
79
82
  }
80
83
  if (count("pending") && summary.length === 1) summary.push(`${count("pending")} pending`);
81
- const lines = !full && header ? renderCompactTaskHeader(summary[0], size, theme, header)
84
+ const lines = !full && header
85
+ ? renderCompactTaskHeader(summary[0], size, theme, header, plan.rows.some((row) => isInProgress(row.status)))
82
86
  : [theme.fg("warning", "todo") + theme.fg("dim", ` ${summary.join(" · ")}`)];
83
87
  for (const metadata of plan.metadata ?? []) {
84
88
  const content = metadata.map((part) => theme.fg(part.color, planText(part.text))).join("");
@@ -103,7 +107,7 @@ export function renderPlanPresentation(
103
107
  theme.fg(style.color, style.glyph) + " " + theme.fg("dim", label) +
104
108
  " ".repeat(Math.max(0, labelWidth - visibleWidth(label)) + 1);
105
109
  const titleColor = row.status === "blocked" ? "warning" : row.status === "failed" ? "error" :
106
- row.status === "in_progress" || row.status === "implemented" || row.status === "reviewed" ? "text" : "muted";
110
+ isInProgress(row.status) ? "text" : "muted";
107
111
  const badge = planText(row.statusLabel ?? style.label);
108
112
  const available = size - visibleWidth(prefix);
109
113
  // At narrow widths use an inline status so it survives title truncation.
@@ -119,7 +119,7 @@ export interface WorkLedgerSessionBinding {
119
119
  }
120
120
 
121
121
  export const WORK_LEDGER_PROMPT_GUIDELINES = [
122
- "When Long-term work ledger is on, use update_todo with ledger for a durable high-level outcome and stable items. It is the same interface as Todo, not a separate execution plan or public tool.",
122
+ "When Project work ledger is on, use update_todo with ledger for a durable high-level outcome and stable items. It is the same interface as Todo, not a separate execution plan or public tool.",
123
123
  "Only use update_todo ledger attach when the user explicitly names an existing ledger or asks to continue it. Never infer association from the working directory, project files, or a similar outcome, and never attach while starting unrelated work.",
124
124
  "Read the ledger with get_todo {ledger:{action:'read'}} before updating it, then send its current revision. Never silently retry a stale revision or overwrite newer progress. Use get_todo {ledger:{action:'list'}} to discover records.",
125
125
  "In an update_todo ledger update, send only the items that changed. Omitted items and fields keep their stored progress.",
@@ -17,10 +17,12 @@ interface RushUnit {
17
17
  cancelledAt?: number;
18
18
  dependsOn: string[];
19
19
  worker?: string | number | undefined;
20
+ workerKind?: string | undefined;
20
21
  note?: string | undefined;
21
22
  headSha?: string | undefined;
22
23
  reviewedHead?: string | undefined;
23
24
  delivery?: string | undefined;
25
+ canaryStatus?: DisplayStatus | undefined;
24
26
  }
25
27
 
26
28
  export interface RushPlan {
@@ -98,10 +100,12 @@ export function projectRushPlan(data: unknown, runId: string, expectedRunDir?: s
98
100
  id: unit.id, title: unit.title, stage: unit.stage, status: unit.status,
99
101
  dependsOn: Array.isArray(unit.dependsOn) ? unit.dependsOn.filter((id): id is string => typeof id === "string") : [],
100
102
  worker: typeof unit.worker === "string" || typeof unit.worker === "number" ? unit.worker : undefined,
103
+ workerKind: typeof unit.workerKind === "string" ? unit.workerKind : undefined,
101
104
  note: typeof unit.note === "string" ? unit.note : undefined,
102
105
  headSha: typeof unit.headSha === "string" && unit.headSha ? unit.headSha : undefined,
103
106
  reviewedHead: typeof unit.reviewedHead === "string" && unit.reviewedHead ? unit.reviewedHead : undefined,
104
107
  delivery: typeof unit.delivery === "string" && unit.delivery ? unit.delivery : undefined,
108
+ canaryStatus: readCanaryStatus(unit.warehouseCanary),
105
109
  };
106
110
  });
107
111
  const fleet: RushPlan["fleet"] = {};
@@ -117,7 +121,7 @@ export function projectRushPlan(data: unknown, runId: string, expectedRunDir?: s
117
121
  fleet,
118
122
  // The skill marks canary work per unit (`warehouseCanary`); older plans set a run-level flag.
119
123
  warehouseCanaryRequired: data.warehouseCanaryRequired === true ||
120
- persistedUnits.some((unit: unknown) => isRecord(unit) && unit.warehouseCanary != null && unit.warehouseCanary !== false),
124
+ issues.some((unit) => unit.canaryStatus !== undefined),
121
125
  spec: isRecord(data.spec) && typeof data.spec.title === "string" ? { title: data.spec.title } : undefined,
122
126
  };
123
127
  }
@@ -157,6 +161,18 @@ function workflowStatus(status: string): DisplayStatus {
157
161
  }
158
162
  }
159
163
 
164
+ function readCanaryStatus(value: unknown): DisplayStatus | undefined {
165
+ if (value == null || value === false) return undefined;
166
+ if (!isRecord(value)) return "pending";
167
+ if (value.required === false || value.applicable === false || value.status === "not-applicable") return undefined;
168
+
169
+ const resultStatus = isRecord(value.result) ? value.result.status : value.result;
170
+ const status = value.status ?? resultStatus;
171
+ if (status === "pass" || status === "passed") return "completed";
172
+ if (status === "fail") return "failed";
173
+ return typeof status === "string" ? workflowStatus(status) : "pending";
174
+ }
175
+
160
176
  // A unit is delivered (completed) only at `status: succeeded`, whether its change landed by a
161
177
  // merged PR or a direct push. Between code done and delivery, a unit with a HEAD shows
162
178
  // whether that HEAD passed review; without one it shows plain in-progress, as before.
@@ -166,16 +182,74 @@ function unitStatus(unit: RushUnit): DisplayStatus {
166
182
  return unit.reviewedHead === unit.headSha ? "reviewed" : "implemented";
167
183
  }
168
184
 
185
+ function unitStages(unit: RushUnit): Record<"implement" | "review" | "ci", DisplayStatus> {
186
+ const status = workflowStatus(unit.status);
187
+ if (status === "completed" || status === "skipped") return { implement: status, review: status, ci: status };
188
+
189
+ const implemented = unit.stage === "done" || unit.stage === "review";
190
+ const reviewed = !!unit.headSha && unit.headSha === unit.reviewedHead;
191
+ // Delivery enters CI before those checks are known to have passed.
192
+ const inCI = unit.delivery === "ci";
193
+ const inReview = unit.stage === "review" || unit.delivery === "review" || inCI ||
194
+ (unit.worker !== undefined && unit.workerKind === "review") || (implemented && !!unit.headSha && unit.delivery === undefined);
195
+
196
+ // An issue can stop in one phase while retaining evidence from another.
197
+ if (status === "blocked" || status === "failed") {
198
+ if (!implemented) return { implement: status, review: reviewed ? "completed" : "pending", ci: "pending" };
199
+ if (reviewed || inCI) return { implement: "completed", review: reviewed ? "completed" : "pending", ci: status };
200
+ return { implement: "completed", review: status, ci: "pending" };
201
+ }
202
+
203
+ return {
204
+ implement: implemented ? "completed" : status,
205
+ review: reviewed ? "completed" : inReview ? status : "pending",
206
+ ci: inCI ? status : "pending",
207
+ };
208
+ }
209
+
210
+ function summarizeStage(statuses: DisplayStatus[]): DisplayStatus | "partial" {
211
+ const applicable = statuses.filter((status) => status !== "skipped");
212
+ if (applicable.length === 0) return statuses.length ? "skipped" : "pending";
213
+ if (applicable.every((status) => status === "completed")) return "completed";
214
+ for (const status of ["failed", "blocked", "unknown"] as const) {
215
+ if (applicable.includes(status)) return status;
216
+ }
217
+ if (applicable.includes("in_progress")) return "in_progress";
218
+ return applicable.includes("completed") ? "partial" : "pending";
219
+ }
220
+
169
221
  function presentRushPlan(plan: RushPlan, owner: string, readOnly = false): PlanPresentation {
222
+ const stageLabel = (name: string, status: DisplayStatus | "partial", suffix = "") => {
223
+ const style = statusStyle(status === "partial" ? "implemented" : status);
224
+ return { color: style.color, text: ` ${name} ${style.glyph}${suffix}` };
225
+ };
226
+ const fleetLabel = (name: string) => {
227
+ const raw = plan.fleet[name]?.status ?? "pending";
228
+ const status = workflowStatus(raw);
229
+ return stageLabel(name, status, status === "unknown" ? ` ${planText(raw)}` : "");
230
+ };
231
+ const stageLabels = [fleetLabel("explore")];
232
+ const addStage = (name: string, statuses: DisplayStatus[]) => {
233
+ const status = summarizeStage(statuses);
234
+ stageLabels.push(stageLabel(name, status));
235
+ if (status !== "in_progress" && statuses.includes("in_progress")) {
236
+ const style = statusStyle("in_progress");
237
+ stageLabels.push({ color: style.color, text: ` ${style.glyph}` });
238
+ }
239
+ };
240
+ const issueStages = plan.issues.map(unitStages);
241
+ for (const name of ["implement", "review", "ci"] as const) {
242
+ addStage(name, issueStages.map((issue) => issue[name]));
243
+ }
170
244
  // The warehouse canary only applies to data work; hide it otherwise.
171
- const stages = ["explore", "implement", "review", "ci", ...(plan.warehouseCanaryRequired ? ["canary"] : [])];
172
- const fleet = stages.map((stage) => {
173
- const status = plan.fleet[stage]?.status ?? "pending";
174
- const display = workflowStatus(status);
175
- const style = statusStyle(display);
176
- return { color: style.color, text: ` ${stage} ${style.glyph}${display === "unknown" ? ` ${planText(status)}` : ""}` };
177
- });
178
- const metadata = [[{ color: "dim", text: `${planText(owner)} · rev ${plan.planRevision} ·` }, ...fleet]];
245
+ if (plan.warehouseCanaryRequired) {
246
+ const canaries = plan.issues.flatMap((unit) => unit.canaryStatus === undefined ? [] : [
247
+ workflowStatus(unit.status) === "skipped" ? "skipped" as const : unit.canaryStatus,
248
+ ]);
249
+ if (canaries.length) addStage("canary", canaries);
250
+ else stageLabels.push(fleetLabel("canary"));
251
+ }
252
+ const metadata = [[{ color: "dim", text: `${planText(owner)} · rev ${plan.planRevision} ·` }, ...stageLabels]];
179
253
  if (readOnly) metadata.push([{ color: "warning", text: "read-only handoff" }]);
180
254
  if (plan.spec?.title) metadata.push([{ color: "dim", text: plan.spec.title }]);
181
255
  return {
@@ -211,4 +285,4 @@ export function renderRushPlan(
211
285
  ): string[] {
212
286
  const theme = fg ? { fg } : plainPlanTheme;
213
287
  return renderPlanPresentation(presentRushPlan(plan, owner, readOnly), width, theme, full, expanded, header);
214
- }
288
+ }
@@ -54,6 +54,6 @@ export function blockReason(match: WaitMatch): string {
54
54
  `This command waits on ${match.waitsOn}, so it belongs in a background task.`,
55
55
  "Spawn it with bg_task_spawn, then call wait_for_operations to park until it reports; a background task survives the end of the turn, while a foreground wait does not.",
56
56
  "Read bg_task_status and bg_task_log for the verdict.",
57
- 'To run this command in the foreground anyway, set Tool call guard to Off in Harness settings.',
57
+ 'To run this command in the foreground anyway, set Foreground wait guard to Off in Harness settings.',
58
58
  ].join(" ");
59
59
  }