@abhishek944/pi-tasks 0.5.0 → 0.8.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.
- package/README.md +22 -3
- package/dist/auto-continue.d.ts +3 -0
- package/dist/auto-continue.js +124 -0
- package/dist/command.d.ts +2 -1
- package/dist/command.js +6 -2
- package/dist/git-status.d.ts +71 -0
- package/dist/git-status.js +279 -0
- package/dist/index.js +27 -4
- package/dist/markdown.js +3 -2
- package/dist/open-repository.d.ts +2 -0
- package/dist/open-repository.js +7 -0
- package/dist/progress.d.ts +4 -0
- package/dist/progress.js +22 -0
- package/dist/state.d.ts +2 -2
- package/dist/state.js +29 -6
- package/dist/tools.js +23 -14
- package/dist/tracking.d.ts +1 -0
- package/dist/tracking.js +10 -3
- package/dist/types.d.ts +2 -1
- package/dist/ui/panel.d.ts +7 -2
- package/dist/ui/panel.js +127 -18
- package/dist/ui/works-dashboard.d.ts +9 -1
- package/dist/ui/works-dashboard.js +82 -14
- package/docs/REFERENCE.md +36 -4
- package/docs/USAGE_GUIDE.md +41 -6
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type KeybindingsManager, type Theme } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
import { type Component, type Focusable, type TUI, type TuiMouseEvent, type TuiMouseEventResult } from "@earendil-works/pi-tui";
|
|
3
|
+
import type { GitStatusCache } from "../git-status.js";
|
|
3
4
|
import type { TaskState } from "../state.js";
|
|
4
5
|
export declare class WorksDashboard implements Component, Focusable {
|
|
5
6
|
private readonly tui;
|
|
@@ -7,6 +8,9 @@ export declare class WorksDashboard implements Component, Focusable {
|
|
|
7
8
|
private readonly keybindings;
|
|
8
9
|
private readonly state;
|
|
9
10
|
private readonly close;
|
|
11
|
+
private readonly cwd;
|
|
12
|
+
private readonly git;
|
|
13
|
+
private readonly notify;
|
|
10
14
|
focused: boolean;
|
|
11
15
|
private selectedKey;
|
|
12
16
|
private scrollOffset;
|
|
@@ -16,12 +20,15 @@ export declare class WorksDashboard implements Component, Focusable {
|
|
|
16
20
|
private message;
|
|
17
21
|
private messageColor;
|
|
18
22
|
private copying;
|
|
23
|
+
private opening;
|
|
19
24
|
private minimized;
|
|
25
|
+
private readonly unsubscribeGit;
|
|
26
|
+
private openHitRegion;
|
|
20
27
|
private copyHitRegion;
|
|
21
28
|
private toggleHitRegion;
|
|
22
29
|
private disposed;
|
|
23
30
|
private readonly refreshTimer;
|
|
24
|
-
constructor(tui: TUI, theme: Theme, keybindings: KeybindingsManager, state: TaskState, close: () => void);
|
|
31
|
+
constructor(tui: TUI, theme: Theme, keybindings: KeybindingsManager, state: TaskState, close: () => void, cwd: string, git: GitStatusCache, notify: (message: string, type: "error") => void);
|
|
25
32
|
render(width: number): string[];
|
|
26
33
|
handleInput(data: string): void;
|
|
27
34
|
handleMouse(event: TuiMouseEvent): TuiMouseEventResult | undefined;
|
|
@@ -36,6 +43,7 @@ export declare class WorksDashboard implements Component, Focusable {
|
|
|
36
43
|
private renderHeader;
|
|
37
44
|
private toggleMinimized;
|
|
38
45
|
private isHit;
|
|
46
|
+
private openInCursor;
|
|
39
47
|
private copyAllAsMarkdown;
|
|
40
48
|
private renderFooter;
|
|
41
49
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { copyToClipboard } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
import { matchesKey, truncateToWidth, visibleWidth, wrapTextWithAnsi, } from "@earendil-works/pi-tui";
|
|
3
3
|
import { formatWorksMarkdown } from "../markdown.js";
|
|
4
|
+
import { openRepository } from "../open-repository.js";
|
|
5
|
+
import { formatCompletion, taskCompletion, workCompletion } from "../progress.js";
|
|
4
6
|
import { safeMultiline, safeSingleLine } from "../text.js";
|
|
5
|
-
import { border, frame, rule, todoIcon, workIcon } from "./panel.js";
|
|
7
|
+
import { border, frame, gitBorder, progressName, rule, todoIcon, workIcon } from "./panel.js";
|
|
6
8
|
const CHROME_LINES = 8;
|
|
7
9
|
export class WorksDashboard {
|
|
8
10
|
tui;
|
|
@@ -10,6 +12,9 @@ export class WorksDashboard {
|
|
|
10
12
|
keybindings;
|
|
11
13
|
state;
|
|
12
14
|
close;
|
|
15
|
+
cwd;
|
|
16
|
+
git;
|
|
17
|
+
notify;
|
|
13
18
|
focused = false;
|
|
14
19
|
selectedKey;
|
|
15
20
|
scrollOffset = 0;
|
|
@@ -19,17 +24,24 @@ export class WorksDashboard {
|
|
|
19
24
|
message = "Ready. Select an item; Escape closes.";
|
|
20
25
|
messageColor = "warning";
|
|
21
26
|
copying = false;
|
|
27
|
+
opening = false;
|
|
22
28
|
minimized = false;
|
|
29
|
+
unsubscribeGit;
|
|
30
|
+
openHitRegion;
|
|
23
31
|
copyHitRegion;
|
|
24
32
|
toggleHitRegion;
|
|
25
33
|
disposed = false;
|
|
26
34
|
refreshTimer;
|
|
27
|
-
constructor(tui, theme, keybindings, state, close) {
|
|
35
|
+
constructor(tui, theme, keybindings, state, close, cwd, git, notify) {
|
|
28
36
|
this.tui = tui;
|
|
29
37
|
this.theme = theme;
|
|
30
38
|
this.keybindings = keybindings;
|
|
31
39
|
this.state = state;
|
|
32
40
|
this.close = close;
|
|
41
|
+
this.cwd = cwd;
|
|
42
|
+
this.git = git;
|
|
43
|
+
this.notify = notify;
|
|
44
|
+
this.unsubscribeGit = git.subscribe(() => tui.requestRender());
|
|
33
45
|
this.refreshTimer = setInterval(() => {
|
|
34
46
|
if (!this.disposed)
|
|
35
47
|
this.tui.requestRender();
|
|
@@ -44,7 +56,7 @@ export class WorksDashboard {
|
|
|
44
56
|
const header = this.renderHeader(innerWidth, works.length, todos.length);
|
|
45
57
|
if (this.minimized) {
|
|
46
58
|
return [
|
|
47
|
-
|
|
59
|
+
gitBorder(innerWidth, this.theme, this.git.getSnapshot()),
|
|
48
60
|
frame(header, innerWidth, this.theme),
|
|
49
61
|
border(innerWidth, "bottom", this.theme),
|
|
50
62
|
];
|
|
@@ -66,7 +78,7 @@ export class WorksDashboard {
|
|
|
66
78
|
while (rows.length < listHeight)
|
|
67
79
|
rows.push("");
|
|
68
80
|
return [
|
|
69
|
-
|
|
81
|
+
gitBorder(innerWidth, this.theme, this.git.getSnapshot()),
|
|
70
82
|
frame(header, innerWidth, this.theme),
|
|
71
83
|
frame(this.theme.fg("dim", summary), innerWidth, this.theme),
|
|
72
84
|
rule(innerWidth, this.theme),
|
|
@@ -91,6 +103,10 @@ export class WorksDashboard {
|
|
|
91
103
|
void this.copyAllAsMarkdown();
|
|
92
104
|
return;
|
|
93
105
|
}
|
|
106
|
+
if (matchesKey(data, "o")) {
|
|
107
|
+
void this.openInCursor();
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
94
110
|
if (matchesKey(data, "m")) {
|
|
95
111
|
this.toggleMinimized();
|
|
96
112
|
return;
|
|
@@ -130,6 +146,10 @@ export class WorksDashboard {
|
|
|
130
146
|
void this.copyAllAsMarkdown();
|
|
131
147
|
return { handled: true, focus: true, render: true };
|
|
132
148
|
}
|
|
149
|
+
if (this.isHit(event.x, this.openHitRegion)) {
|
|
150
|
+
void this.openInCursor();
|
|
151
|
+
return { handled: true, focus: true, render: true };
|
|
152
|
+
}
|
|
133
153
|
return undefined;
|
|
134
154
|
}
|
|
135
155
|
invalidate() { }
|
|
@@ -137,6 +157,7 @@ export class WorksDashboard {
|
|
|
137
157
|
if (this.disposed)
|
|
138
158
|
return;
|
|
139
159
|
this.disposed = true;
|
|
160
|
+
this.unsubscribeGit();
|
|
140
161
|
clearInterval(this.refreshTimer);
|
|
141
162
|
}
|
|
142
163
|
items(works = this.state.listWorks()) {
|
|
@@ -144,7 +165,7 @@ export class WorksDashboard {
|
|
|
144
165
|
for (const work of works) {
|
|
145
166
|
items.push({ key: `work:${work.workId}`, kind: "work", work });
|
|
146
167
|
for (const todo of work.tasks)
|
|
147
|
-
items.push({ key: `todo:${todo.taskId}`, kind: "todo", todo,
|
|
168
|
+
items.push({ key: `todo:${todo.taskId}`, kind: "todo", todo, work });
|
|
148
169
|
}
|
|
149
170
|
return items;
|
|
150
171
|
}
|
|
@@ -173,9 +194,13 @@ export class WorksDashboard {
|
|
|
173
194
|
const prefix = selected ? this.theme.fg("accent", "▶ ") : " ";
|
|
174
195
|
if (item.kind === "work") {
|
|
175
196
|
const done = item.work.tasks.filter((todo) => todo.status === "completed").length;
|
|
176
|
-
|
|
197
|
+
const metadata = this.theme.fg("dim", `${item.work.workId} · ${item.work.status} · ${done}/${item.work.tasks.length}`);
|
|
198
|
+
const nameWidth = width - visibleWidth(prefix) - 3 - visibleWidth(metadata);
|
|
199
|
+
return truncateToWidth(`${prefix}${workIcon(item.work.status, this.theme)} ${this.theme.bold(progressName(item.work.workName, workCompletion(item.work), nameWidth))} ${metadata}`, width, "");
|
|
177
200
|
}
|
|
178
|
-
|
|
201
|
+
const metadata = this.theme.fg("dim", `${item.todo.taskId} · ${item.todo.status}`);
|
|
202
|
+
const nameWidth = width - visibleWidth(prefix) - 5 - visibleWidth(metadata);
|
|
203
|
+
return truncateToWidth(`${prefix} ${todoIcon(item.todo.status, this.theme)} ${progressName(item.todo.taskName, taskCompletion(item.todo), nameWidth)} ${metadata}`, width, "");
|
|
179
204
|
}
|
|
180
205
|
renderDetails(items, width, budget) {
|
|
181
206
|
if (!this.detailsVisible || budget === 0)
|
|
@@ -183,9 +208,24 @@ export class WorksDashboard {
|
|
|
183
208
|
const item = items.find((candidate) => candidate.key === this.selectedKey);
|
|
184
209
|
if (!item)
|
|
185
210
|
return [this.theme.fg("muted", "No works or todos in this session.")].slice(0, budget);
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
211
|
+
let heading;
|
|
212
|
+
if (item.kind === "work") {
|
|
213
|
+
const lead = `${item.work.workId} · `;
|
|
214
|
+
const tail = ` · ${item.work.status}`;
|
|
215
|
+
heading = `${lead}${progressName(item.work.workName, workCompletion(item.work), width - visibleWidth(lead + tail))}${tail}`;
|
|
216
|
+
}
|
|
217
|
+
else {
|
|
218
|
+
const taskName = safeSingleLine(item.todo.taskName);
|
|
219
|
+
const workName = safeSingleLine(item.work.workName);
|
|
220
|
+
const taskProgress = formatCompletion(taskCompletion(item.todo));
|
|
221
|
+
const workProgress = formatCompletion(workCompletion(item.work));
|
|
222
|
+
const fixed = `${item.todo.taskId} · · ${taskProgress} · ${item.todo.status} · ${item.todo.workId} · ${workProgress}`;
|
|
223
|
+
const available = Math.max(0, width - visibleWidth(fixed));
|
|
224
|
+
const taskWidth = Math.min(visibleWidth(taskName), available - Math.min(visibleWidth(workName), Math.floor(available / 2)));
|
|
225
|
+
const shownTask = truncateToWidth(taskName, taskWidth, "…");
|
|
226
|
+
const shownWork = truncateToWidth(workName, available - taskWidth, "…");
|
|
227
|
+
heading = `${item.todo.taskId} · ${shownTask} · ${taskProgress} · ${item.todo.status} · ${item.todo.workId} ${shownWork} · ${workProgress}`;
|
|
228
|
+
}
|
|
189
229
|
const info = item.kind === "work" ? item.work.workInfo : item.todo.taskInfo;
|
|
190
230
|
const infoLines = safeMultiline(info).flatMap((line) => wrapTextWithAnsi(this.theme.fg("dim", line || " "), width));
|
|
191
231
|
const contentBudget = Math.max(0, budget - 3);
|
|
@@ -208,17 +248,20 @@ export class WorksDashboard {
|
|
|
208
248
|
const copyAction = this.copying
|
|
209
249
|
? this.theme.fg("dim", "[Copying…]")
|
|
210
250
|
: this.theme.fg("accent", this.theme.bold("[C Copy]"));
|
|
251
|
+
const openAction = this.theme.fg(this.opening ? "dim" : "accent", this.theme.bold("[O Open]"));
|
|
211
252
|
const toggleLabel = this.minimized ? "[M Maximize]" : "[M Minimize]";
|
|
212
253
|
const toggleAction = this.theme.fg("accent", this.theme.bold(toggleLabel));
|
|
213
|
-
const actionsWidth = visibleWidth(copyAction) + 1 + visibleWidth(toggleAction);
|
|
254
|
+
const actionsWidth = visibleWidth(copyAction) + 1 + visibleWidth(openAction) + 1 + visibleWidth(toggleAction);
|
|
214
255
|
const titleWidth = Math.max(0, width - actionsWidth - 1);
|
|
215
256
|
const shownTitle = truncateToWidth(title, titleWidth, "");
|
|
216
257
|
const gap = " ".repeat(Math.max(1, width - visibleWidth(shownTitle) - actionsWidth));
|
|
217
258
|
const copyStart = 1 + visibleWidth(shownTitle) + gap.length;
|
|
218
259
|
this.copyHitRegion = { start: copyStart, end: copyStart + visibleWidth(copyAction) };
|
|
219
|
-
const
|
|
260
|
+
const openStart = this.copyHitRegion.end + 1;
|
|
261
|
+
this.openHitRegion = { start: openStart, end: openStart + visibleWidth(openAction) };
|
|
262
|
+
const toggleStart = this.openHitRegion.end + 1;
|
|
220
263
|
this.toggleHitRegion = { start: toggleStart, end: toggleStart + visibleWidth(toggleAction) };
|
|
221
|
-
return `${shownTitle}${gap}${copyAction} ${toggleAction}`;
|
|
264
|
+
return `${shownTitle}${gap}${copyAction} ${openAction} ${toggleAction}`;
|
|
222
265
|
}
|
|
223
266
|
toggleMinimized() {
|
|
224
267
|
this.minimized = !this.minimized;
|
|
@@ -231,6 +274,31 @@ export class WorksDashboard {
|
|
|
231
274
|
isHit(x, region) {
|
|
232
275
|
return region !== undefined && x >= region.start && x < region.end;
|
|
233
276
|
}
|
|
277
|
+
async openInCursor() {
|
|
278
|
+
if (this.opening)
|
|
279
|
+
return;
|
|
280
|
+
this.opening = true;
|
|
281
|
+
this.message = "Opening repository in Cursor…";
|
|
282
|
+
this.messageColor = "warning";
|
|
283
|
+
this.tui.requestRender();
|
|
284
|
+
try {
|
|
285
|
+
await openRepository(this.cwd);
|
|
286
|
+
this.message = "Opened repository in Cursor.";
|
|
287
|
+
this.messageColor = "success";
|
|
288
|
+
}
|
|
289
|
+
catch (error) {
|
|
290
|
+
const reason = error instanceof Error ? ` ${safeSingleLine(error.message)}` : "";
|
|
291
|
+
this.message = `Could not open Cursor. Check cursor is on PATH.${reason}`;
|
|
292
|
+
this.messageColor = "error";
|
|
293
|
+
if (!this.disposed)
|
|
294
|
+
this.notify(this.message, "error");
|
|
295
|
+
}
|
|
296
|
+
finally {
|
|
297
|
+
this.opening = false;
|
|
298
|
+
if (!this.disposed)
|
|
299
|
+
this.tui.requestRender();
|
|
300
|
+
}
|
|
301
|
+
}
|
|
234
302
|
async copyAllAsMarkdown() {
|
|
235
303
|
if (this.copying)
|
|
236
304
|
return;
|
|
@@ -257,7 +325,7 @@ export class WorksDashboard {
|
|
|
257
325
|
}
|
|
258
326
|
}
|
|
259
327
|
renderFooter(width) {
|
|
260
|
-
const text = "C copy all · M minimize · configured ↑/↓ select · PgUp/PgDn scroll details · confirm toggles · cancel closes";
|
|
328
|
+
const text = "C copy all · O open Cursor · M minimize · configured ↑/↓ select · PgUp/PgDn scroll details · confirm toggles · cancel closes";
|
|
261
329
|
return truncateToWidth(this.theme.fg("muted", text), width, "");
|
|
262
330
|
}
|
|
263
331
|
}
|
package/docs/REFERENCE.md
CHANGED
|
@@ -20,9 +20,21 @@ Limits:
|
|
|
20
20
|
|
|
21
21
|
A work contains `workId`, `workName`, `workInfo`, `status`, `createdAt`, and `updatedAt`. Work status is `planned`, `active`, `blocked`, `completed`, or `cancelled`.
|
|
22
22
|
|
|
23
|
-
A todo contains `taskId`, `workId`, `taskName`, `taskInfo`, `status`, `createdAt`, and `updatedAt`. Todo status is `pending`, `active`, `blocked`, `completed`, or `cancelled`.
|
|
23
|
+
A todo contains `taskId`, `workId`, `taskName`, `taskInfo`, `status`, optional `completionPercent`, `createdAt`, and `updatedAt`. Todo status is `pending`, `active`, `blocked`, `completed`, or `cancelled`.
|
|
24
24
|
|
|
25
|
-
The public list shape assembles each work with `tasks: Todo[]`; tasks are stored separately to avoid duplicate state.
|
|
25
|
+
The public list shape assembles each work with `tasks: Todo[]`; tasks are stored separately to avoid duplicate state. Work progress is derived, not independently stored or editable.
|
|
26
|
+
|
|
27
|
+
### Completion progress
|
|
28
|
+
|
|
29
|
+
`TodoCreate` and `TodoUpdate` accept optional `completionPercent`: an integer from 0 through 100, or `null` to clear an obsolete estimate. Omission preserves an existing estimate on updates. The AI reports approximate progress based on completed effort and verification, explaining the evidence and remaining scope in `taskInfo`; status alone never implies an arbitrary partial percentage. No new tool or extra model call is added.
|
|
30
|
+
|
|
31
|
+
- Completed tasks normalize to 100%; explicit partial progress with completed status is rejected. Explicit 100 requires completed status. Completion remains an agent assertion after verification, not an independent extension proof.
|
|
32
|
+
- Moving a partial task to blocked retains its progress. Reopening a completed task without a new estimate becomes unknown rather than retaining 100%.
|
|
33
|
+
- A work is the equal arithmetic mean of all non-cancelled task percentages, rounded down for display. For example, 100, 40, 0, 0 yields 35%.
|
|
34
|
+
- Any unknown eligible task makes the work unknown (`—`); unknown is not silently 0. With no eligible tasks, work is unknown unless its own status is completed, then 100%.
|
|
35
|
+
- A completed parent never overrides unfinished child progress. Work progress reaches 100 only when all eligible tasks are completed. Progress never changes statuses or auto-continuation eligibility.
|
|
36
|
+
- Optional progress fields are additive to version-1 branch events. Legacy completed tasks show 100%; other legacy tasks remain unknown until reported. Invalid optional progress is sanitized on replay without discarding the task.
|
|
37
|
+
- Dashboard, compact panel, list output and copied Markdown share these calculations. The compact panel reserves a narrow right-hand percentage column with a divider; names truncate independently. `/works` retains inline `· N%` labels and unchanged navigation. Percentages do not predict remaining time; no subtasks, weights or separate navigation sidebar are added.
|
|
26
38
|
|
|
27
39
|
## Tracking behavior
|
|
28
40
|
|
|
@@ -30,8 +42,28 @@ When all tracking tools are active, the extension adds hidden per-turn guidance
|
|
|
30
42
|
|
|
31
43
|
The guidance is not added when the tracking tools have been removed from the active tool set. Pi Ask removes them during `/ask`. Pi BTW executes its side conversation outside the main conversation. The guidance also explicitly forbids changing works, todos, loops, or monitors during either mode.
|
|
32
44
|
|
|
45
|
+
## Auto-continuation
|
|
46
|
+
|
|
47
|
+
Auto-continuation is optional and requires Pi 1.2.0 or newer. Configure `pi-tasks.autoContinue` in Pi's `settings.json`; the extension reads `pi.getSettings()` so trusted project settings override global settings. `enabled` defaults to `false`; `maxContinuations` is optional. Omission means no continuation limit; if supplied, it must be a positive safe integer. Explicit `null` is invalid. Invalid configuration disables the flow and reports a warning. Hosts without the new settings API keep normal task tracking with no automatic continuation.
|
|
48
|
+
|
|
49
|
+
A fresh accepted main interactive/RPC run arms a new continuation epoch. Input is provisional until the run starts, so handled/rejected prompts cannot arm it. Extension/custom starts do not arm or reset it. Steering/follow-up messages queued inside an already-running activity do not themselves reset the cap. Session start/reload, tree navigation, and shutdown disarm it until fresh user input. Aborted or failed activity also suspends it. `agent_settled.aborted` covers aborts that skip the actionable boundary. Tracking tools must be active; side conversations must not start continuation.
|
|
50
|
+
|
|
51
|
+
The synchronous `agent_before_settle` handler runs after native retries, compaction, and queued work. It requires a completed outcome, a non-aborted signal, no pending messages in either the boundary preview or runtime queue, and no continuation already requested by an earlier handler. Pi is still busy at this actionable boundary, so it does not require `ctx.isIdle()`. Instead it appends one custom-message draft and requests one native continuation; Pi owns committing it and honoring cancellation. No detached prompt, timer, background worker, or polling loop is created.
|
|
52
|
+
|
|
53
|
+
Planned/active works and pending/active todos on the current branch are unfinished. Completed, blocked, and cancelled records are settled. A settled parent does not hide an unfinished child. The prompt includes a bounded preview of IDs, names and statuses, and directs the agent to list tools for full details. No records means no continuation. The extension never mutates statuses, verifies work independently, or treats a blocker label as proof of an actual dependency.
|
|
54
|
+
|
|
55
|
+
When `maxContinuations` is supplied, at most that many extra continuations are requested per fresh accepted main user run. The next unfinished boundary warns once and suspends continuation; a fresh user prompt resets the cap. With no limit supplied, continuation can consume tokens indefinitely while unfinished records remain, until interrupted, failed, disabled or otherwise suspended. This is not a cost cap or a cap on native tool/retry requests, and another extension may independently request work. Settings changes take effect when Pi reloads effective settings, normally through `/reload`.
|
|
56
|
+
|
|
57
|
+
## Repository status and Cursor
|
|
58
|
+
|
|
59
|
+
Both terminal views share a cwd-scoped asynchronous Git status cache, separate from persisted work/todo state. The top border centers `git <branch> · S<staged> U<unstaged> ?<untracked>`; zero counts collapse to `clean`, detached HEAD uses `@<shortcommit>`, and narrow frames shorten the branch first. The border label remains when minimized. Initial loading displays `git loading…`, non-repositories have a plain border, and initial read failures display `git unavailable`; refreshes and later failures retain the prior snapshot.
|
|
60
|
+
|
|
61
|
+
The implementation is informed by [pi-powerline-footer's cache behavior](https://github.com/nicobailon/pi-powerline-footer/blob/main/git-status.ts): a one-second cache, asynchronous stale-while-refresh reads, deduplicated requests, cwd/generation guards, read-only Git environment (`GIT_OPTIONAL_LOCKS=0`), and bounded child processes. This extension reads branch and file counts together rather than running a separate branch timer. Attached views share the poller; unsubscribing the last view or shutting down releases it. File-changing `write`, `edit`, and `bash` results expire cached data sooner.
|
|
62
|
+
|
|
63
|
+
Open appears between Copy and Minimize/Maximize. It executes `cursor` with the separate argument `.` in the active session working directory, without a shell. The executable must be on PATH; errors are shown instead of silently failing. `/works-panel open` supplies a command path, and `/works` uses `o`. Open is also available outside Git repositories.
|
|
64
|
+
|
|
33
65
|
## Interfaces
|
|
34
66
|
|
|
35
|
-
The compact panel defaults to a non-capturing floating overlay anchored at the top-right. It shows work and todo names, status icons, completion counts, and a visible row range when content exceeds the terminal-aware viewport. It hides on terminals narrower than 90 columns or shorter than 18 rows. In fullscreen TUI mode, its title-bar Copy action exports every work and nested todo as Markdown, while Minimize collapses the panel to a restorable title bar that keeps Copy and Maximize available. `/works-panel minimize` and `/works-panel maximize` provide a keyboard-command path and preserve the collapsed state when switching between floating and widget layouts. Overflow starts at the newest rows and follows newly added tail rows until the user scrolls upward. Mouse-wheel events over the expanded floating panel scroll it directly without taking keyboard focus; regular terminal mode shows the newest rows and uses `/works` for complete browsing and copying. Because Pi treats any persistent overlay as active, the floating mode can block display-mode changes. `/works-panel widget` switches to a right-aligned widget above the editor, renders all rows, and retains the title actions, while `/works-panel off` hides it.
|
|
67
|
+
The compact panel defaults to a non-capturing floating overlay anchored at the top-right. It shows work and todo names, status icons, completion counts, and a visible row range when content exceeds the terminal-aware viewport. It hides on terminals narrower than 90 columns or shorter than 18 rows. In fullscreen TUI mode, its title-bar Copy action exports every work and nested todo as Markdown, while Minimize collapses the panel to a restorable title bar that keeps Copy, Open, and Maximize available. `/works-panel minimize` and `/works-panel maximize` provide a keyboard-command path and preserve the collapsed state when switching between floating and widget layouts. Overflow starts at the newest rows and follows newly added tail rows until the user scrolls upward. Mouse-wheel events over the expanded floating panel scroll it directly without taking keyboard focus; regular terminal mode shows the newest rows and uses `/works` for complete browsing and copying. Because Pi treats any persistent overlay as active, the floating mode can block display-mode changes. `/works-panel widget` switches to a right-aligned widget above the editor, renders all rows, and retains the title actions, while `/works-panel off` hides it.
|
|
36
68
|
|
|
37
|
-
`/works` opens a top-centered detailed overlay. Its top-right Copy action uses `c` to copy every work and nested todo to the system clipboard as Markdown. Its Minimize action uses `m` to collapse the overlay to a framed top bar containing live total work and todo counts, Copy, and a Maximize action; activating Maximize restores the full dashboard. In fullscreen TUI mode, Copy and Minimize/Maximize also respond to left clicks. Configured selection keys choose records, configured Page Up and Page Down keys scroll long details, the configured confirmation key toggles details, and the configured cancel key closes it.
|
|
69
|
+
`/works` opens a top-centered detailed overlay. Its top-right Copy action uses `c` to copy every work and nested todo to the system clipboard as Markdown. Its Open action uses `o` to open the current directory in Cursor. Its Minimize action uses `m` to collapse the overlay to a framed top bar containing live total work and todo counts, Copy, Open, and a Maximize action; activating Maximize restores the full dashboard. In fullscreen TUI mode, Copy, Open, and Minimize/Maximize also respond to left clicks. Configured selection keys choose records, configured Page Up and Page Down keys scroll long details, the configured confirmation key toggles details, and the configured cancel key closes it.
|
package/docs/USAGE_GUIDE.md
CHANGED
|
@@ -13,6 +13,28 @@ For every normal request that starts or continues work, Pi should:
|
|
|
13
13
|
|
|
14
14
|
The extension applies this guidance across all loaded skills and does not skip work merely because it looks small. It does not update tracking during `/ask`, `/btw`, or BTW side threads.
|
|
15
15
|
|
|
16
|
+
Write `workInfo` and `taskInfo` in normal prose with full sentences and spaces between words. Conversational brevity modes do not apply to stored records; do not concatenate words to shorten them. This is model-facing guidance, not automatic repair of existing text.
|
|
17
|
+
|
|
18
|
+
## Continue unfinished work automatically
|
|
19
|
+
|
|
20
|
+
This is off by default and requires Pi 1.2.0+. Add the following to global `~/.pi/agent/settings.json` (or your custom agent directory) or a trusted project's `.pi/settings.json`, then run `/reload`:
|
|
21
|
+
|
|
22
|
+
```json
|
|
23
|
+
{
|
|
24
|
+
"pi-tasks": {
|
|
25
|
+
"autoContinue": {
|
|
26
|
+
"enabled": true
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Send a normal prompt to start. If the agent finishes with planned/active works or pending/active todos, it receives a message to continue and verify them. Blocked, completed, and cancelled records do not cause another continuation. Keep the parent work synchronized too, and record a genuine blocker reason in its information field before handing off.
|
|
33
|
+
|
|
34
|
+
Press Escape/abort to stop. The extension will not restart from a monitor wake or another extension's message; send a new main prompt when you want it to resume. Failed runs also stop instead of being retried by this feature. Reloading or navigating session branches does not silently resume unfinished work.
|
|
35
|
+
|
|
36
|
+
Omitting `maxContinuations` means no continuation limit: it can keep consuming tokens while unfinished records remain. Manual abort and all other stopping conditions still apply. To cap it, add a positive integer such as `"maxContinuations": 10`. After the configured number of extra continuations, the extension warns and hands control back without changing records. A fresh accepted main user run resets the limit; a rejected prompt or steering/follow-up input queued inside a running activity does not. Set `enabled` to `false` and reload to disable the feature. It checks recorded states, not whether every user requirement was captured or genuinely verified.
|
|
37
|
+
|
|
16
38
|
## Work tools
|
|
17
39
|
|
|
18
40
|
```text
|
|
@@ -30,27 +52,40 @@ WorkDelete workId="W1"
|
|
|
30
52
|
## Todo tools
|
|
31
53
|
|
|
32
54
|
```text
|
|
33
|
-
TodoCreate workId="W1" taskName="Inspect token flow" taskInfo="Detailed context..."
|
|
55
|
+
TodoCreate workId="W1" taskName="Inspect token flow" taskInfo="Detailed context..." completionPercent=0
|
|
34
56
|
TodoList workId="W1"
|
|
35
57
|
TodoList status="active"
|
|
36
58
|
TodoList workId="W1" limit=10
|
|
37
|
-
TodoUpdate taskId="T1" status="
|
|
59
|
+
TodoUpdate taskId="T1" status="active" completionPercent=40 taskInfo="Inspection is complete; implementation and verification remain."
|
|
60
|
+
TodoUpdate taskId="T1" status="completed" taskInfo="Detailed verified outcome..."
|
|
61
|
+
TodoUpdate taskId="T2" completionPercent=null taskInfo="The scope changed; the previous estimate is no longer reliable."
|
|
38
62
|
TodoDelete taskId="T1"
|
|
39
63
|
```
|
|
40
64
|
|
|
41
65
|
`TodoList` returns all matching todos when `limit` is omitted. A positive integer `limit` selects the newest matching todos after filters, displayed oldest-to-newest. The result shows how many todos were returned and how many matched in total. Both list tools can still truncate very long text output at 50KB or 2,000 lines.
|
|
42
66
|
|
|
67
|
+
### Completion percentages
|
|
68
|
+
|
|
69
|
+
Pi updates each task’s `completionPercent` after meaningful progress. These are approximate AI-reported values, not a fixed percentage for each status and not a time prediction. Use an integer 0–100 or `null` for unknown. Completed status means verified completion and displays 100%; 100 without completed status is rejected. Partial progress requires reopening a completed task; reopening without a fresh estimate makes it unknown. Blocking retains the current estimate.
|
|
70
|
+
|
|
71
|
+
Work progress averages all non-cancelled tasks equally and rounds down. Tasks at 100%, 40%, 0%, 0% produce 35% work completion, not 25% based on finished-task counts. If any eligible task lacks an estimate, the work displays `—`. No eligible tasks also means unknown unless the work itself is verified complete. A completed parent never hides unfinished task progress. Existing sessions retain their records; legacy completed tasks display 100%, while other missing estimates remain unknown.
|
|
72
|
+
|
|
43
73
|
## TUI
|
|
44
74
|
|
|
45
|
-
The panel defaults to a floating top-right layout and does not take keyboard focus.
|
|
75
|
+
The panel defaults to a floating top-right layout and does not take keyboard focus. A slim, separated right-hand column keeps work and task percentages aligned and visible even when names are long; the left side retains names, status icons and work task-counts. It hides on small terminals. The top border centers repository-wide Git status: `git main · S2 U3 ?1` means two staged files, three unstaged files, and one untracked file; a file with both staged and unstaged edits counts in both. A clean repository shows `git main · clean`. Long branches shorten before counts. Detached HEAD shows `@` plus the short commit. Git remains visible while minimized and adds no content row.
|
|
76
|
+
|
|
77
|
+
The asynchronous Git cache refreshes every second while a view is attached; file-changing tool results expire it sooner without blanking the last snapshot. Initial reads show `git loading…`; outside Git the border is plain, and initial failures show `git unavailable`. Later refresh failures retain the last snapshot until a successful read. Polling is read-only and stops when both the panel and dashboard are closed/off.
|
|
78
|
+
|
|
79
|
+
In fullscreen TUI mode, click Copy in its title bar to copy every work and todo as Markdown, Open to run `cursor .` in the current session directory, or Minimize to collapse the panel to a small title bar. Copy and Open remain available while minimized, and Maximize restores the rows. Cursor's command-line launcher must be on PATH; launch failures produce visible error feedback. When more rows exist than fit, the floating panel starts at the newest rows; move the mouse over it and use the wheel to scroll older or newer rows without taking focus from the editor. In regular terminal mode, open `/works` to browse and copy the complete list.
|
|
46
80
|
|
|
47
|
-
Use `/works-panel minimize
|
|
81
|
+
Use `/works-panel minimize`, `/works-panel maximize`, or `/works-panel open` when mouse input is unavailable. Use `/works-panel widget` for a right-aligned layout above the editor that renders every row and retains the clickable title actions, `/works-panel floating` to return to the floating layout, or `/works-panel off` to hide it.
|
|
48
82
|
|
|
49
|
-
Run `/works` for full details. Its top bar includes Copy and Minimize actions. In fullscreen TUI mode, click Minimize to collapse the dashboard to a top bar showing the current work and todo totals; click Maximize to restore it. The actions also have keyboard shortcuts that work in regular terminal mode.
|
|
83
|
+
Run `/works` for full details. Its top border mirrors repository-wide Git status, and its top bar includes Copy, Open, and Minimize actions. In fullscreen TUI mode, click Minimize to collapse the dashboard to a top bar showing the current work and todo totals; click Maximize to restore it. The actions also have keyboard shortcuts that work in regular terminal mode.
|
|
50
84
|
|
|
51
85
|
- `c`: copy all works and todos as Markdown
|
|
86
|
+
- `o`: open the current repository/session directory in Cursor
|
|
52
87
|
- `m`: minimize or maximize the dashboard
|
|
53
|
-
- Fullscreen left click: activate Copy, Minimize, or Maximize
|
|
88
|
+
- Fullscreen left click: activate Copy, Open, Minimize, or Maximize
|
|
54
89
|
- Configured Up/Down keys: select
|
|
55
90
|
- Configured Page Up/Page Down keys: scroll long details
|
|
56
91
|
- Configured confirmation key: show or hide detailed information
|