@lune_99/pi-subagent 0.0.0-stage → 0.1.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.
- package/CHANGELOG.md +24 -0
- package/LICENSE +21 -0
- package/README.md +169 -2
- package/docs/capture.json +30 -0
- package/docs/previews.md +22 -0
- package/docs/reference.md +240 -0
- package/docs/subagent-auto-tiers.png +0 -0
- package/docs/subagent-inspector.png +0 -0
- package/docs/subagent-overview.png +0 -0
- package/package.json +82 -5
- package/skills/create-lune-subagent/SKILL.md +186 -0
- package/src/auto-model.ts +592 -0
- package/src/catalog.ts +111 -0
- package/src/definition-file.ts +112 -0
- package/src/definitions.ts +324 -0
- package/src/dock/dock-alert.ts +78 -0
- package/src/dock/dock-contribution.ts +318 -0
- package/src/extension-tools.ts +46 -0
- package/src/index.ts +168 -0
- package/src/inspector/details.ts +113 -0
- package/src/inspector/inspector.ts +653 -0
- package/src/inspector/layout.ts +119 -0
- package/src/inspector/transcript.ts +735 -0
- package/src/inspector/viewport.ts +62 -0
- package/src/inspector/wrap.ts +136 -0
- package/src/models.ts +54 -0
- package/src/notify/notification-box.ts +381 -0
- package/src/notify/notifier.ts +569 -0
- package/src/paths.ts +34 -0
- package/src/render/lune-theme.ts +68 -0
- package/src/render/text.ts +121 -0
- package/src/run/guide.ts +26 -0
- package/src/run/report-tool.ts +90 -0
- package/src/run/run-file.ts +193 -0
- package/src/run/run-manager.ts +838 -0
- package/src/run/run-session.ts +307 -0
- package/src/run/run.ts +681 -0
- package/src/run/session-start.ts +283 -0
- package/src/run/types.ts +167 -0
- package/src/run/worktree.ts +138 -0
- package/src/schema.ts +9 -0
- package/src/settings/agents-menu.ts +363 -0
- package/src/settings/panel.ts +179 -0
- package/src/settings/schema.ts +71 -0
- package/src/tools/format.ts +375 -0
- package/src/tools/subagent-tools.ts +467 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import type { Theme } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import { truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
|
|
3
|
+
|
|
4
|
+
const LEFT_PANE_RATIO = 0.28;
|
|
5
|
+
const LEFT_PANE_MIN_WIDTH = 22;
|
|
6
|
+
const LEFT_PANE_MAX_WIDTH = 36;
|
|
7
|
+
const RIGHT_PANE_MIN_WIDTH = 32;
|
|
8
|
+
|
|
9
|
+
// The overlay caps itself at 80% of the terminal, so the body leaves room for the six frame lines
|
|
10
|
+
// (top, header, two separators, footer, bottom) or the frame is clipped on short terminals.
|
|
11
|
+
const OVERLAY_HEIGHT_RATIO = 0.8;
|
|
12
|
+
const FRAME_HEIGHT = 6;
|
|
13
|
+
const BODY_MIN_HEIGHT = 8;
|
|
14
|
+
const BODY_MAX_HEIGHT = 32;
|
|
15
|
+
|
|
16
|
+
/** Top border, header and the separator above the panes. */
|
|
17
|
+
export const BODY_TOP = 3;
|
|
18
|
+
|
|
19
|
+
export interface PaneGeometry {
|
|
20
|
+
bodyHeight: number;
|
|
21
|
+
/** Columns between the outer borders. */
|
|
22
|
+
innerWidth: number;
|
|
23
|
+
leftWidth: number;
|
|
24
|
+
rightWidth: number;
|
|
25
|
+
/** First column of the right pane in overlay-local cells, for mouse hit-testing. */
|
|
26
|
+
rightStart: number;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function paneGeometry(width: number, terminalRows: number): PaneGeometry {
|
|
30
|
+
const bodyHeight = Math.min(
|
|
31
|
+
BODY_MAX_HEIGHT,
|
|
32
|
+
Math.max(BODY_MIN_HEIGHT, Math.floor(terminalRows * OVERLAY_HEIGHT_RATIO) - FRAME_HEIGHT),
|
|
33
|
+
);
|
|
34
|
+
const innerWidth = Math.max(LEFT_PANE_MIN_WIDTH + RIGHT_PANE_MIN_WIDTH + 1, width - 2);
|
|
35
|
+
const leftWidth = Math.min(
|
|
36
|
+
LEFT_PANE_MAX_WIDTH,
|
|
37
|
+
Math.max(LEFT_PANE_MIN_WIDTH, Math.round(innerWidth * LEFT_PANE_RATIO)),
|
|
38
|
+
innerWidth - RIGHT_PANE_MIN_WIDTH - 1,
|
|
39
|
+
);
|
|
40
|
+
const rightWidth = innerWidth - leftWidth - 1;
|
|
41
|
+
|
|
42
|
+
return { bodyHeight, innerWidth, leftWidth, rightWidth, rightStart: leftWidth + 2 };
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** First listed row, keeping the selection centred until the list runs out on either side. */
|
|
46
|
+
export function listWindowStart(selected: number, count: number, height: number): number {
|
|
47
|
+
return Math.min(Math.max(0, selected - Math.floor(height / 2)), Math.max(0, count - height));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** One padding column on each side keeps text off the borders and leaves room for a scrollbar. */
|
|
51
|
+
export function cell(text: string, width: number): string {
|
|
52
|
+
return ` ${truncateToWidth(text, Math.max(0, width - 2), "…", true)} `;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function pad(text: string, width: number): string {
|
|
56
|
+
return text + " ".repeat(Math.max(0, width - visibleWidth(text)));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface FrameParts {
|
|
60
|
+
header: string;
|
|
61
|
+
left: readonly string[];
|
|
62
|
+
right: readonly string[];
|
|
63
|
+
footer: string;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function assembleFrame(theme: Theme, geometry: PaneGeometry, parts: FrameParts): string[] {
|
|
67
|
+
const { bodyHeight, innerWidth, leftWidth, rightWidth } = geometry;
|
|
68
|
+
const border = (text: string): string => theme.fg("border", text);
|
|
69
|
+
const edge = border("│");
|
|
70
|
+
const lines = [
|
|
71
|
+
border(`┌${"─".repeat(innerWidth)}┐`),
|
|
72
|
+
edge + pad(parts.header, innerWidth) + edge,
|
|
73
|
+
border(`├${"─".repeat(leftWidth)}┬${"─".repeat(rightWidth)}┤`),
|
|
74
|
+
];
|
|
75
|
+
|
|
76
|
+
for (let row = 0; row < bodyHeight; row++) {
|
|
77
|
+
lines.push(
|
|
78
|
+
edge +
|
|
79
|
+
pad(parts.left[row] ?? "", leftWidth) +
|
|
80
|
+
edge +
|
|
81
|
+
pad(parts.right[row] ?? "", rightWidth) +
|
|
82
|
+
edge,
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
lines.push(
|
|
87
|
+
border(`├${"─".repeat(leftWidth)}┴${"─".repeat(rightWidth)}┤`),
|
|
88
|
+
edge + pad(parts.footer, innerWidth) + edge,
|
|
89
|
+
border(`└${"─".repeat(innerWidth)}┘`),
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
return lines;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** Thumb of a bar over `height` rows showing `total` rows from `start`; undefined when all fit. */
|
|
96
|
+
export function paintScrollbar(
|
|
97
|
+
theme: Theme,
|
|
98
|
+
rows: string[],
|
|
99
|
+
start: number,
|
|
100
|
+
height: number,
|
|
101
|
+
total: number,
|
|
102
|
+
): string[] {
|
|
103
|
+
if (height <= 0 || total <= height) {
|
|
104
|
+
return rows;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const size = Math.max(Math.min(2, height), Math.round((height * height) / total));
|
|
108
|
+
const top = Math.round((start / (total - height)) * (height - size));
|
|
109
|
+
|
|
110
|
+
// Both panes reserve their last column as padding, so the bar never covers text.
|
|
111
|
+
return rows.map((line, row) => {
|
|
112
|
+
const onThumb = row >= top && row < top + size;
|
|
113
|
+
|
|
114
|
+
return (
|
|
115
|
+
line.slice(0, -1) +
|
|
116
|
+
theme.fg(onThumb ? "scrollbarThumb" : "scrollbarTrack", onThumb ? "┃" : "│")
|
|
117
|
+
);
|
|
118
|
+
});
|
|
119
|
+
}
|