@henryqw/pi-subagent 27.15.0 → 27.15.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 +2 -0
- package/dist/store.js +4 -1
- package/extensions/subagent-command.ts +23 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -144,6 +144,8 @@ Staging, validation, and promotion require clean, unchanged Main. After a defini
|
|
|
144
144
|
|
|
145
145
|
Open `/subagent` to browse direct work on this session branch and isolated requests in the current canonical Git checkout, including other sessions. Rows are grouped under **Direct**, **Isolated**, and **Orphaned · parent checkout removed**. Before the menu opens, and after each **Refresh**, a **Current subagent work** report shows which subagents are working. Without interactive UI, `/subagent` sends the report and the request list, including history. In the terminal, the menu replaces the editor and uses at most half the terminal height. It does not overlay the report or the transcript.
|
|
146
146
|
|
|
147
|
+
Move through rows with the mouse wheel. Click a row to select it. You can also use the keyboard.
|
|
148
|
+
|
|
147
149
|
Each row starts with a status symbol: `●` active, `✓` completed, `⚠` needs attention, `✗` failed. Terminal requests stay hidden until you select **Completed / history**; this filter deletes no records. `/subagent` reports show as transcript entries that the model does not get.
|
|
148
150
|
|
|
149
151
|
Every isolated request, including an orphaned request, has **Close and delete worktrees (discard work)**. Select it to review owned resources and confirm deletion. **This permanently deletes committed, uncommitted, and ignored content in the listed checkouts.** Cancel makes no change, and agents and tools cannot trigger this action. **Select multiple…** applies one action to many rows, with one confirmation. See [Close and delete isolated worktrees](./docs/orchestration.md#close-and-delete-isolated-worktrees) for guards and partial cleanup.
|
package/dist/store.js
CHANGED
|
@@ -16,6 +16,7 @@ const INITIAL_STATE_MAX_BYTES = 2 * 1024 * 1024;
|
|
|
16
16
|
* Reads use the same finite ceiling and preserve rejected files.
|
|
17
17
|
*/
|
|
18
18
|
const STATE_MAX_BYTES = 128 * 1024 * 1024;
|
|
19
|
+
const STATE_DIRECTORY_NAME = /^[a-f0-9]{64}$/;
|
|
19
20
|
const ADMISSION_MAX_FILES = 256;
|
|
20
21
|
const ADMISSION_MAX_BYTES = STATE_MAX_BYTES;
|
|
21
22
|
const V4_TERMINAL_STATUSES = new Set(["completed", "final_failed", "superseded", "aborted"]);
|
|
@@ -214,7 +215,7 @@ export class FileRunStore {
|
|
|
214
215
|
/** Address saved state without resolving a parent checkout that may no longer exist. */
|
|
215
216
|
async validateDirectory(directory) {
|
|
216
217
|
const parent = join(extensionConfigDir("pi-subagent", this.agentDir), "state");
|
|
217
|
-
if (dirname(directory) !== parent ||
|
|
218
|
+
if (dirname(directory) !== parent || !STATE_DIRECTORY_NAME.test(basename(directory))
|
|
218
219
|
|| !(await lstat(directory)).isDirectory() || await realpath(directory) !== join(await realpath(parent), basename(directory))) {
|
|
219
220
|
throw new Error("Invalid Pi Subagent state directory.");
|
|
220
221
|
}
|
|
@@ -268,6 +269,8 @@ export class FileRunStore {
|
|
|
268
269
|
const states = [];
|
|
269
270
|
const invalidIds = [];
|
|
270
271
|
for (const entry of directories) {
|
|
272
|
+
if (entry.name === ".DS_Store" && entry.isFile())
|
|
273
|
+
continue;
|
|
271
274
|
const directory = join(parent, entry.name);
|
|
272
275
|
try {
|
|
273
276
|
await this.validateDirectory(directory);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getMarkdownTheme, getSelectListTheme, keyHint, keyText, type ExtensionAPI, type ExtensionContext, type Theme } from "@earendil-works/pi-coding-agent";
|
|
2
|
-
import { Box, Markdown, SelectList, Spacer, Text, truncateToWidth } from "@earendil-works/pi-tui";
|
|
2
|
+
import { Box, Markdown, SelectList, Spacer, Text, truncateToWidth, type TuiMouseEvent } from "@earendil-works/pi-tui";
|
|
3
3
|
import type { DiscardPlan } from "../dist/discard.js";
|
|
4
4
|
import type { PruneItem, PruneProgress } from "../dist/prune.js";
|
|
5
5
|
import { TERMINAL_RUN_STATUSES } from "../dist/schema.js";
|
|
@@ -346,9 +346,12 @@ async function choose<T>(ctx: ExtensionContext, title: string, items: readonly C
|
|
|
346
346
|
const rows = labels.map((label, index) => ({ label, value: String(index) }));
|
|
347
347
|
// The menu replaces the editor, not the screen; cap its height to leave room for other content.
|
|
348
348
|
const menuHeight = () => Math.max(1, Math.floor(tui.terminal.rows / 2));
|
|
349
|
+
let height = menuHeight();
|
|
350
|
+
let listHeight = 0;
|
|
351
|
+
let pressed = false;
|
|
352
|
+
let cancelClick = false;
|
|
349
353
|
const createList = () => {
|
|
350
354
|
// Reserve title, key hints, and the native scroll indicator. Very short menus show only the list.
|
|
351
|
-
const height = menuHeight();
|
|
352
355
|
const list = new SelectList(rows, Math.max(1, height - (height >= 4 ? 3 : 1)), getSelectListTheme());
|
|
353
356
|
list.setSelectedIndex(selectedIndex);
|
|
354
357
|
list.onSelectionChange = ({ value }) => { selectedIndex = Number(value); };
|
|
@@ -359,14 +362,30 @@ async function choose<T>(ctx: ExtensionContext, title: string, items: readonly C
|
|
|
359
362
|
let list = createList();
|
|
360
363
|
return {
|
|
361
364
|
render(width) {
|
|
362
|
-
|
|
365
|
+
// Keep the pressed item across redraws: a press can recenter the visible rows before its click.
|
|
366
|
+
if (height !== menuHeight()) {
|
|
367
|
+
if (pressed) cancelClick = true;
|
|
368
|
+
pressed = false;
|
|
369
|
+
height = menuHeight(); list = createList();
|
|
370
|
+
}
|
|
363
371
|
const lines = list.render(width);
|
|
364
|
-
|
|
372
|
+
listHeight = Math.min(lines.length, height);
|
|
373
|
+
if (height < 4) return lines.slice(0, height);
|
|
365
374
|
return [truncateToWidth(theme.fg("accent", title), width), ...lines,
|
|
366
375
|
truncateToWidth([`${keyText("tui.select.up")}/${keyText("tui.select.down")} scroll`,
|
|
367
376
|
keyHint("tui.select.confirm", "select"), keyHint("tui.select.cancel", "cancel")].join(" · "), width)];
|
|
368
377
|
},
|
|
369
378
|
handleInput(data) { list.handleInput(data); tui.requestRender(); },
|
|
379
|
+
handleMouse(event: TuiMouseEvent) {
|
|
380
|
+
if (event.type === "click" && cancelClick) { cancelClick = false; return { handled: true }; }
|
|
381
|
+
if (event.type === "press") cancelClick = false;
|
|
382
|
+
const y = event.y - (height >= 4 ? 1 : 0);
|
|
383
|
+
if (y < 0 || y >= listHeight) return undefined;
|
|
384
|
+
const result = list.handleMouse({ ...event, y, height: listHeight });
|
|
385
|
+
if (event.type === "press") pressed = result?.handled === true;
|
|
386
|
+
if (event.type === "click") pressed = false;
|
|
387
|
+
return result;
|
|
388
|
+
},
|
|
370
389
|
invalidate() { list.invalidate(); },
|
|
371
390
|
};
|
|
372
391
|
});
|