pi-better-harness 0.61.3 → 0.61.4
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.
- package/CHANGELOG.md +7 -0
- package/README.md +3 -4
- package/extensions/task-context/compact-task-header.ts +2 -2
- package/extensions/task-context/index.ts +20 -15
- package/node_modules/pi-better-goal/package.json +1 -1
- package/node_modules/pi-better-goal/src/index.ts +27 -10
- package/node_modules/pi-better-goal/src/task-context.ts +2 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.61.4] - 2026-11-29
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- A saved Goal shows **Resume** in the Todo panel, even without a checklist. Click it or press Alt+G to start the Goal.
|
|
8
|
+
- `update_todo` reports whether the Goal is saved or running. If auto-start needs completion criteria, the reply names `goal.doneWhen` and shows the manual start command.
|
|
9
|
+
|
|
3
10
|
## [0.61.3] - 2026-11-29
|
|
4
11
|
|
|
5
12
|
### Fixed
|
package/README.md
CHANGED
|
@@ -22,10 +22,9 @@ Use `pi-better-harness` when you want the full working set for Pi. It manages:
|
|
|
22
22
|
|
|
23
23
|
The Goal records what the user wants to achieve. Its Todo lists the steps. The
|
|
24
24
|
panel shows checklist progress on the left and Goal status on the right. A
|
|
25
|
-
saved Goal has a **
|
|
26
|
-
|
|
27
|
-
foreground work and hold continuation.
|
|
28
|
-
including checklists saved before a Goal was attached.
|
|
25
|
+
saved Goal has a **Resume** button, even without a checklist. Click it, press
|
|
26
|
+
**Alt+G**, or enter `/goal resume` to start the saved work. The Goal keeps any
|
|
27
|
+
existing checklist. Use `/goal pause` to interrupt foreground work and hold continuation.
|
|
29
28
|
|
|
30
29
|
`/harness-settings` has one Goal setting, **Auto-start Goals** (default **Off**).
|
|
31
30
|
Turn it on to start a newly saved Goal with acceptance criteria, restart explicitly
|
|
@@ -50,8 +50,8 @@ export function renderCompactTaskHeader(summary: string | undefined, width: numb
|
|
|
50
50
|
}
|
|
51
51
|
if (details.length > 0) {
|
|
52
52
|
lines.push(...details);
|
|
53
|
-
const fullLabel = "[
|
|
54
|
-
const label = indent + fullLabel.length <= size ? fullLabel : "[
|
|
53
|
+
const fullLabel = "[Resume · Alt+G]";
|
|
54
|
+
const label = indent + fullLabel.length <= size ? fullLabel : "[Resume]";
|
|
55
55
|
if (header.onStartButton && size >= indent + label.length) {
|
|
56
56
|
header.onStartButton(lines.length, indent, indent + label.length);
|
|
57
57
|
lines.push(" ".repeat(indent) + theme.fg("accent", label));
|
|
@@ -17,7 +17,7 @@ import { OUTCOME_ENTRY, prepareOutcome, restoreOutcome, formatOutcome, type Outc
|
|
|
17
17
|
import { changeLedgerPreference, parseOutcomeTodoPreferences } from "./preferences.js";
|
|
18
18
|
import { canRenderTaskRuntime, renderCompactTaskHeader, type CompactTaskHeader } from "./compact-task-header.js";
|
|
19
19
|
import type { GoalSnapshot } from "pi-better-goal/src/types.ts";
|
|
20
|
-
import { GOAL_PANEL_START_EVENT, type GoalPanelStartRequest, OUTCOME_ACCEPTED_EVENT, type TaskContextRequest } from "pi-better-goal/src/task-context.ts";
|
|
20
|
+
import { GOAL_PANEL_START_EVENT, type GoalPanelStartRequest, OUTCOME_ACCEPTED_EVENT, type OutcomeAcceptedEvent, type TaskContextRequest } from "pi-better-goal/src/task-context.ts";
|
|
21
21
|
|
|
22
22
|
import {
|
|
23
23
|
completedPlanClearDelay,
|
|
@@ -640,7 +640,7 @@ export default function taskContextExtension(pi: ExtensionAPI): void {
|
|
|
640
640
|
description: "Manage the accepted Goal, Todo, workflow canonical task plan, and optional durable long-term work ledger through one interface. Existing workflow and ledger revision checks apply.",
|
|
641
641
|
promptSnippet: "Remember the accepted Goal and update Todo, workflow, or durable ledger progress",
|
|
642
642
|
promptGuidelines: [
|
|
643
|
-
"Capture the accepted Goal before substantive implementation, delegation, or investigation. A goal-only update is valid.
|
|
643
|
+
"Capture the accepted Goal before substantive implementation, delegation, or investigation. A goal-only update is valid. Derive observable goal.doneWhen criteria from the requested result. For example, verifying and configuring access means checking current permissions, making any necessary authorized change, and verifying that change. After saving, continue the work the user already authorized in this turn.",
|
|
644
644
|
"Use newTask:true with its goal when the user switches to unrelated work. Omit newTask for a correction or refinement of the same task. For a running Goal, call update_goal after verifying delivery. For a saved Goal, set goal.status to complete after verification.",
|
|
645
645
|
"Use a Todo checklist when several meaningful milestones help track delivery; update it when work completes, is blocked, or changes scope.",
|
|
646
646
|
"Write each Todo label as a short action in plain language, usually 3-7 English words or a similarly short phrase in the task's language. For example: 'Add Todo toggle' or 'Test keyboard controls'. Put methods, file paths, rationale, and acceptance criteria in the goal, explanation, or workflow records, not the label. Apply this to workflow titles too; do not copy long issue headings.",
|
|
@@ -724,9 +724,9 @@ export default function taskContextExtension(pi: ExtensionAPI): void {
|
|
|
724
724
|
const replacement = steps?.length ? replacePlan(input.newTask ? null : currentPlan, steps, input.explanation ?? inherited?.explanation) : null;
|
|
725
725
|
const detachOnCommit = input.newTask && ledgerId !== null;
|
|
726
726
|
// Commit task memory only after the requested checklist or workflow operation succeeds.
|
|
727
|
-
const commitOutcome = ():
|
|
727
|
+
const commitOutcome = (summary = ""): string => {
|
|
728
728
|
if (activeRun?.evidence && (input.newTask || input.todo || input.workflow)) dynamic.clear();
|
|
729
|
-
if (!nextOutcome) return;
|
|
729
|
+
if (!nextOutcome) return summary;
|
|
730
730
|
if (detachOnCommit) detachLedger(ctx);
|
|
731
731
|
if (input.newTask && input.todo === undefined) {
|
|
732
732
|
if (!input.workflow) clearWorkflowPlan();
|
|
@@ -734,13 +734,17 @@ export default function taskContextExtension(pi: ExtensionAPI): void {
|
|
|
734
734
|
}
|
|
735
735
|
saveOutcome(nextOutcome);
|
|
736
736
|
const sessionId = ctx.sessionManager.getSessionId?.();
|
|
737
|
+
let feedback = "Goal saved.";
|
|
737
738
|
if (typeof sessionId === "string") {
|
|
738
|
-
|
|
739
|
+
const event: OutcomeAcceptedEvent = { sessionId, reopenedGoalId: nextOutcome.reopenedGoalId, outcome: { ...nextOutcome } };
|
|
740
|
+
pi.events.emit(OUTCOME_ACCEPTED_EVENT, event);
|
|
741
|
+
feedback = event.feedback ?? feedback;
|
|
739
742
|
}
|
|
743
|
+
return summary ? `${feedback}\n${summary}` : feedback;
|
|
740
744
|
};
|
|
741
745
|
if (!input.workflow && input.todo === undefined) {
|
|
742
|
-
commitOutcome();
|
|
743
|
-
return { content: [{ type: "text", text
|
|
746
|
+
const text = commitOutcome();
|
|
747
|
+
return { content: [{ type: "text", text }], details: { ok: true, goal: outcome, outcome } };
|
|
744
748
|
}
|
|
745
749
|
if (input.workflow !== undefined) {
|
|
746
750
|
const savedBinding = workflowBinding(ctx.sessionManager.getBranch());
|
|
@@ -774,21 +778,21 @@ export default function taskContextExtension(pi: ExtensionAPI): void {
|
|
|
774
778
|
binding = { owner: owner ?? binding!.owner, path, runId: plan.runId };
|
|
775
779
|
if (transition.event === undefined) {
|
|
776
780
|
displayWorkflowPlan(plan, binding, ctx, !owner);
|
|
777
|
-
commitOutcome();
|
|
778
|
-
return { content: [{ type: "text", text
|
|
781
|
+
const text = commitOutcome(`Showing ${binding.owner} rev ${plan.planRevision}: ${plan.issues.length} units.${owner ? "" : " Read-only handoff."}`);
|
|
782
|
+
return { content: [{ type: "text", text }], details: { ok: true, runId: plan.runId, revision: plan.planRevision, ...(!owner ? { readOnly: true } : {}) } };
|
|
779
783
|
}
|
|
780
784
|
}
|
|
781
785
|
if (!binding) throw new Error(`No ${owner} plan is bound; send workflow.path and workflow.revision to update_todo first.`);
|
|
782
786
|
if (transition.event === undefined) throw new Error("workflow.path is required to bind or reload a plan; otherwise send workflow.event and changes.");
|
|
783
787
|
const result = applyRushPlanUpdate(binding.path, ctx.cwd, binding.runId, { ...transition, event: transition.event });
|
|
784
788
|
displayWorkflowPlan(result.plan, binding, ctx);
|
|
785
|
-
commitOutcome();
|
|
786
789
|
const rows = result.changed.map(({ target, id, added }) =>
|
|
787
790
|
`${added ? "+" : ""}${id === null ? "run" : target === "unit" ? `#${id}` : id}`);
|
|
788
791
|
const logNote = result.logAheadRevision === undefined ? ""
|
|
789
792
|
: ` The profiling log already held rev ${result.logAheadRevision} (an earlier write stopped after logging); this event supersedes it.`;
|
|
793
|
+
const text = commitOutcome(`Saved ${owner} rev ${result.revision} (${transition.event.trim()})${rows.length ? `: ${rows.join(", ")}` : ""}${input.workflow.decision ? `${rows.length ? ";" : ":"} decision ${input.workflow.decision.id}` : ""}. Profiling: ${result.profilingPath}.${logNote}`);
|
|
790
794
|
return {
|
|
791
|
-
content: [{ type: "text", text
|
|
795
|
+
content: [{ type: "text", text }],
|
|
792
796
|
details: {
|
|
793
797
|
ok: true, runId: result.plan.runId, revision: result.revision, changed: result.changed, profilingPath: result.profilingPath,
|
|
794
798
|
...(result.logAheadRevision === undefined ? {} : { logAheadRevision: result.logAheadRevision }),
|
|
@@ -797,16 +801,17 @@ export default function taskContextExtension(pi: ExtensionAPI): void {
|
|
|
797
801
|
}
|
|
798
802
|
if (input.todo === undefined) throw new Error("todo is required: send the full list of steps.");
|
|
799
803
|
if (!replacement) {
|
|
800
|
-
clearWorkflowPlan(); clearPlan();
|
|
801
|
-
|
|
804
|
+
clearWorkflowPlan(); clearPlan();
|
|
805
|
+
const text = commitOutcome("Todo cleared.");
|
|
806
|
+
return { content: [{ type: "text", text }], details: { ok: true, goal: outcome, outcome } };
|
|
802
807
|
}
|
|
803
808
|
const plan = replacement;
|
|
804
809
|
if (!inherited) clearWorkflowPlan();
|
|
805
810
|
persistPlan(plan);
|
|
806
|
-
commitOutcome();
|
|
807
811
|
const progress = planProgress(plan);
|
|
812
|
+
const text = commitOutcome(formatProgress(plan));
|
|
808
813
|
return {
|
|
809
|
-
content: [{ type: "text", text
|
|
814
|
+
content: [{ type: "text", text }],
|
|
810
815
|
details: { ok: true, plan, progress, goal: outcome },
|
|
811
816
|
};
|
|
812
817
|
},
|
|
@@ -1060,21 +1060,38 @@ export default function (pi: ExtensionAPI): void {
|
|
|
1060
1060
|
return { goal, restore: restoredOwner, plan };
|
|
1061
1061
|
};
|
|
1062
1062
|
|
|
1063
|
-
const
|
|
1064
|
-
const
|
|
1065
|
-
const event = value as Partial<OutcomeAcceptedEvent> | null;
|
|
1066
|
-
if (!preferences.autoStartFromOutcome || !ctx || !event ||
|
|
1067
|
-
typeof event.sessionId !== "string" || event.sessionId !== ctx.sessionManager.getSessionId()) return;
|
|
1063
|
+
const acceptOutcome = (ctx: ExtensionContext, event: OutcomeAcceptedEvent): string => {
|
|
1064
|
+
const saved = event.outcome;
|
|
1068
1065
|
const current = getGoal(ctx);
|
|
1069
|
-
if (current && current.
|
|
1066
|
+
if (current && current.goalId === saved.goalId) {
|
|
1067
|
+
if (current.status === "active") return "Goal is running.";
|
|
1068
|
+
if (current.status === "budgetLimited") return "Goal reached its token budget.";
|
|
1069
|
+
return `Goal ${current.status}.`;
|
|
1070
|
+
}
|
|
1071
|
+
if (saved.status !== "active") return `Goal ${saved.status}.`;
|
|
1072
|
+
if (current && current.status !== "complete") return "Goal saved. Another Goal owns execution. Inspect it with /goal.";
|
|
1070
1073
|
const reopenedGoal = current?.status === "complete" && current.goalId === event.reopenedGoalId ? current : undefined;
|
|
1071
|
-
if (event.reopenedGoalId && !reopenedGoal) return;
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1074
|
+
if (saved.goalId || (event.reopenedGoalId && !reopenedGoal)) return "Goal saved. Reinvoke its original Goal or workflow to continue.";
|
|
1075
|
+
const objective = saved.objective.trim();
|
|
1076
|
+
if (!canStartGoalFromOutcome(saved, reopenedGoal)) {
|
|
1077
|
+
if (objective.startsWith("/")) return "Goal saved. Reinvoke the original command to continue.";
|
|
1078
|
+
if (preferences.autoStartFromOutcome) return "Goal saved. Auto-start requires completion criteria in goal.doneWhen. Use /goal resume to start it manually.";
|
|
1079
|
+
}
|
|
1080
|
+
if (!preferences.autoStartFromOutcome) return "Goal saved. Use /goal resume to start it.";
|
|
1081
|
+
const prepared = prepareSavedGoal(ctx, objective, reopenedGoal);
|
|
1082
|
+
if (typeof prepared === "string") return `Goal saved. ${prepared}`;
|
|
1075
1083
|
if (prepared.restore) recordWorkflow(prepared.restore, prepared.plan);
|
|
1076
1084
|
setGoal(prepared.goal, ctx, "runtime", "bind");
|
|
1077
1085
|
resetContinuationState(prepared.goal);
|
|
1086
|
+
return "Goal is running.";
|
|
1087
|
+
};
|
|
1088
|
+
|
|
1089
|
+
const unsubscribeOutcomeAccepted = pi.events.on(OUTCOME_ACCEPTED_EVENT, (value: unknown) => {
|
|
1090
|
+
const ctx = currentCtx;
|
|
1091
|
+
const event = value as OutcomeAcceptedEvent | null;
|
|
1092
|
+
if (!ctx || typeof event?.outcome?.objective !== "string" ||
|
|
1093
|
+
typeof event.sessionId !== "string" || event.sessionId !== ctx.sessionManager.getSessionId()) return;
|
|
1094
|
+
event.feedback = acceptOutcome(ctx, event);
|
|
1078
1095
|
});
|
|
1079
1096
|
|
|
1080
1097
|
const inspectGoal = (ctx: ExtensionContext) => {
|
|
@@ -16,6 +16,8 @@ export type GoalPanelStartRequest =
|
|
|
16
16
|
|
|
17
17
|
export interface OutcomeAcceptedEvent {
|
|
18
18
|
sessionId: string;
|
|
19
|
+
/** The Goal extension fills this in synchronously for the update_todo reply. */
|
|
20
|
+
feedback?: string;
|
|
19
21
|
reopenedGoalId?: string;
|
|
20
22
|
outcome: {
|
|
21
23
|
objective: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-better-harness",
|
|
3
|
-
"version": "0.61.
|
|
3
|
+
"version": "0.61.4",
|
|
4
4
|
"description": "Pi extension bundle for a write sandbox, subagents, background tasks, SSH, Goals, and Todo lists.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
71
|
"pi-better-background-tasks": "0.21.8",
|
|
72
|
-
"pi-better-goal": "0.18.
|
|
72
|
+
"pi-better-goal": "0.18.3",
|
|
73
73
|
"pi-better-sandbox": "0.15.2",
|
|
74
74
|
"pi-better-ssh": "0.1.7",
|
|
75
75
|
"pi-better-subagents": "0.41.1",
|