pi-better-harness 0.41.2 → 0.42.0

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 (41) hide show
  1. package/README.md +29 -9
  2. package/extensions/task-context/compact-task-header.ts +10 -2
  3. package/extensions/task-context/index.ts +353 -104
  4. package/extensions/task-context/plan-presentation.ts +3 -28
  5. package/extensions/task-context/plan-render.ts +5 -18
  6. package/extensions/task-context/preferences.ts +8 -5
  7. package/extensions/task-context/work-ledger-actions.ts +307 -0
  8. package/extensions/task-context/work-ledger-session.ts +186 -0
  9. package/extensions/task-context/work-ledger.ts +683 -0
  10. package/extensions/task-context/workflow-plan.ts +2 -14
  11. package/node_modules/pi-better-background-tasks/package.json +1 -1
  12. package/node_modules/pi-better-background-tasks/src/batch.ts +5 -2
  13. package/node_modules/pi-better-background-tasks/src/failures.ts +14 -6
  14. package/node_modules/pi-better-background-tasks/src/index.ts +14 -13
  15. package/node_modules/pi-better-background-tasks/src/navigator-provider.ts +37 -10
  16. package/node_modules/pi-better-background-tasks/src/runtime.ts +99 -89
  17. package/node_modules/pi-better-background-tasks/src/shared-navigator.ts +24 -3
  18. package/node_modules/pi-better-background-tasks/src/shared-operation-coordinator/src/validate.ts +3 -1
  19. package/node_modules/pi-better-background-tasks/src/shared-ssh-core/index.ts +30 -1
  20. package/node_modules/pi-better-background-tasks/src/supervisor/generated/store.mjs +4 -2
  21. package/node_modules/pi-better-background-tasks/src/supervisor/store.ts +4 -2
  22. package/node_modules/pi-better-background-tasks/src/tools.ts +32 -24
  23. package/node_modules/pi-better-ssh/README.md +2 -0
  24. package/node_modules/pi-better-ssh/package.json +1 -1
  25. package/node_modules/pi-better-ssh/src/index.ts +4 -1
  26. package/node_modules/pi-better-ssh/src/mux-registry.ts +3 -1
  27. package/node_modules/pi-better-ssh/src/remote-bash.ts +4 -2
  28. package/node_modules/pi-better-ssh/src/shared-ssh-core/index.ts +30 -1
  29. package/node_modules/pi-better-subagents/README.md +16 -12
  30. package/node_modules/pi-better-subagents/batch.mjs +1 -0
  31. package/node_modules/pi-better-subagents/config.ts +15 -2
  32. package/node_modules/pi-better-subagents/docs/usage.md +32 -20
  33. package/node_modules/pi-better-subagents/effective-settings.ts +51 -4
  34. package/node_modules/pi-better-subagents/index.ts +225 -44
  35. package/node_modules/pi-better-subagents/package.json +1 -1
  36. package/node_modules/pi-better-subagents/registry.ts +2 -1
  37. package/node_modules/pi-better-subagents/settings-page.ts +43 -6
  38. package/node_modules/pi-better-subagents/shared-navigator.ts +24 -3
  39. package/node_modules/pi-better-subagents/shared-operation-coordinator/src/validate.ts +3 -1
  40. package/node_modules/pi-better-subagents/timing.ts +172 -22
  41. package/package.json +4 -4
package/README.md CHANGED
@@ -22,18 +22,22 @@ Use `pi-better-harness` when you want the full working set for Pi. It manages:
22
22
 
23
23
  In `/harness-settings`, **Outcome & Todo display** (`outcome-todo-display`)
24
24
  defaults to **On**, and **Outcome & Todo hooks** (`outcome-todo`) defaults to
25
- **Off**. Saved outcomes and checklists display even when hooks are off; missing
26
- state creates no placeholder, state, or settings. Turning display off does not
27
- disable hooks. Saved v1 `enabled` remains the hooks authority; the new optional
28
- display preference defaults to true.
25
+ **Off**. **Long-term work ledger** (`outcome-todo-ledger`) is a third independent
26
+ control and defaults to **Off**. Saved outcomes and checklists display even when
27
+ hooks are off; missing state creates no placeholder, state, or settings. Turning
28
+ display off does not disable hooks. Saved v1 `enabled` remains the hooks
29
+ authority; the optional display and ledger preferences default to their existing
30
+ or conservative values.
29
31
 
30
32
  The compact widget has one Todo heading, with a caret after Todo and the completion
31
33
  count on the left. A matching Goal's status and existing active-time clock appear
32
34
  on the right. The outcome is one muted, truncated subtitle. The collapsed view
33
35
  shows up to five relevant rows; the expanded view shows all rows. Click to toggle.
34
- `/todo` shows the full objective, acceptance criteria, boundaries, and plan;
35
- `/todo expand` and `/todo collapse` also control the compact checklist. Todo
36
- commands remain available with hooks off for explicit user control.
36
+ `/todo` reveals the compact Overview (when display is on) and returns it to automatic display;
37
+ `/todo expand` and `/todo collapse` control which rows it shows. The full
38
+ objective, acceptance criteria, boundaries, and plan remain available through
39
+ `get_todo` when hooks are enabled. Todo commands remain available with hooks off
40
+ for explicit user control.
37
41
 
38
42
  An accepted outcome can be saved without a checklist. Completing or clearing its
39
43
  Todo does not complete or remove the outcome. Write labels as short, plain actions,
@@ -45,8 +49,9 @@ existing saved labels remain unchanged until deliberately updated.
45
49
  Use `newTask: true` with a new
46
50
  outcome for unrelated work; a correction to the current task keeps its binding.
47
51
  Hooks enable `update_todo`, `get_todo`, capture, matching Goal lifecycle bridge
48
- writes, reminders, and automated cleanup. While hooks are enabled and the outcome is active, Harness
49
- includes a short reminder before each model call. Turning hooks off stops those
52
+ writes, outcome updates, and automated cleanup. With hooks enabled, Harness records
53
+ a hidden, persistent outcome update at the next agent start only when its content
54
+ changes. It does not rebuild reminders before each model call. Turning hooks off stops those
50
55
  hooks without deleting saved state or starting a turn. `/goal` and skills never
51
56
  enable them.
52
57
 
@@ -54,6 +59,21 @@ Existing Plan session histories restore as Todo. Workflow task-plan files and
54
59
  revision checks stay unchanged; skills continue using their own records when the
55
60
  optional interface is off. See the [usage guide](docs/usage.md#outcome--todo).
56
61
 
62
+ The separate **Long-term work ledger** setting enables a durable project-scoped
63
+ record of the overall outcome, boundaries, and high-level items. It stays off by
64
+ default; turning it off removes ledger views and hints without deleting records.
65
+ The same `update_todo` / `get_todo` interface carries optional ledger payloads and
66
+ selectors for create, update, attach, detach, list, and read. Updates require the
67
+ current revision, preserve completed evidence and history, and never associate old
68
+ work with a new session automatically. Use `/ledger attach <id>` (or an explicit
69
+ `update_todo` ledger attach) to continue the same record; `/ledger list`,
70
+ `/ledger switch`, and `/ledger detach` manage the reference without copying it. A
71
+ resumed session keeps its reference, a fresh session stays unassociated, and
72
+ bounded recovery reminders after compaction or resume are rebuilt from durable
73
+ state. Workflow-owned rows keep their canonical stage/status rendering; the
74
+ ledger adds context, not a second execution model. See
75
+ [usage](docs/usage.md#associate-a-ledger-with-a-session).
76
+
57
77
  Subagent and background-task rows can be clicked to open their existing navigator
58
78
  details. Enter and keyboard controls remain available, and editor input stays
59
79
  passive. Harness packages do not write to Pi's status bar. Goal holds and resume
@@ -5,6 +5,8 @@ export interface CompactTaskHeader {
5
5
  subtitle?: string;
6
6
  disclosure?: string;
7
7
  runtime?: { status: string; clock?: string };
8
+ /** Preformatted high-level ledger counts shown in the existing Todo surface. */
9
+ ledger?: string;
8
10
  }
9
11
 
10
12
  export function canRenderTaskRuntime(width: number, runtime: CompactTaskHeader["runtime"]): boolean {
@@ -26,10 +28,16 @@ export function renderCompactTaskHeader(summary: string | undefined, width: numb
26
28
  ? title + " ".repeat(Math.max(2, size - visibleWidth(title) - rightWidth)) + right
27
29
  : truncateToWidth(left, size);
28
30
  const lines = [truncateToWidth(heading, size)];
31
+ const indent = Math.min(2, size - 1);
32
+ const details: string[] = [];
29
33
  if (header.subtitle) {
30
- const indent = Math.min(2, size - 1);
31
34
  const text = header.subtitle.replace(/[\r\n\t]+/g, " ").replace(/ {2,}/g, " ").trim();
32
- lines.push(" ".repeat(indent) + theme.fg("muted", truncateToWidth(text, size - indent)), "");
35
+ details.push(" ".repeat(indent) + theme.fg("muted", truncateToWidth(text, size - indent)));
33
36
  }
37
+ if (header.ledger) {
38
+ const text = header.ledger.replace(/[\r\n\t]+/g, " ").replace(/ {2,}/g, " ").trim();
39
+ details.push(" ".repeat(indent) + theme.fg("dim", truncateToWidth(text, size - indent)));
40
+ }
41
+ if (details.length > 0) lines.push(...details, "");
34
42
  return lines;
35
43
  }