proper-base 0.8.0 → 0.8.2
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 +1 -1
- package/package.json +5 -2
- package/src/overlay-scroll.ts +11 -45
- package/src/skills.ts +8 -6
package/README.md
CHANGED
|
@@ -389,7 +389,7 @@ highlight. Custom replacement footers are not changed.
|
|
|
389
389
|
|
|
390
390
|
## Install
|
|
391
391
|
|
|
392
|
-
Node 22.19 or newer is required. The package is tested against Pi 1.0.
|
|
392
|
+
Node 22.19 or newer is required. The package is tested against Pi 1.4.0.
|
|
393
393
|
|
|
394
394
|
From npm:
|
|
395
395
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "proper-base",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.2",
|
|
4
4
|
"description": "Baseline Pi behavior for session naming, history, prompt editing, fullscreen navigation, and footer styling",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package",
|
|
@@ -59,12 +59,15 @@
|
|
|
59
59
|
"@types/node": "25.9.5",
|
|
60
60
|
"typescript": "6.0.2"
|
|
61
61
|
},
|
|
62
|
+
"overrides": {
|
|
63
|
+
"undici@8.10.2": "8.12.3"
|
|
64
|
+
},
|
|
62
65
|
"pi": {
|
|
63
66
|
"extensions": [
|
|
64
67
|
"./index.ts"
|
|
65
68
|
]
|
|
66
69
|
},
|
|
67
70
|
"dependencies": {
|
|
68
|
-
"sharp": "0.35.
|
|
71
|
+
"sharp": "0.35.5"
|
|
69
72
|
}
|
|
70
73
|
}
|
package/src/overlay-scroll.ts
CHANGED
|
@@ -6,9 +6,6 @@ import {
|
|
|
6
6
|
} from "@earendil-works/pi-tui";
|
|
7
7
|
|
|
8
8
|
const INSTALLED = Symbol.for("pi-proper-base.overlay-scroll");
|
|
9
|
-
// ESC prefix is matched separately: biome bans control characters in
|
|
10
|
-
// regexes, and string literals carry it fine.
|
|
11
|
-
const SGR_MOUSE_TAIL = /^\[<(\d+);(\d+);(\d+)[Mm]$/;
|
|
12
9
|
/** Mirrors pi-tui's private PAGE_SCROLL_OVERLAP. */
|
|
13
10
|
const PAGE_OVERLAP = 4;
|
|
14
11
|
|
|
@@ -19,49 +16,24 @@ type ScrollHost = TUI & {
|
|
|
19
16
|
scrollToBottom(): void;
|
|
20
17
|
isOverlayFocused?(): boolean;
|
|
21
18
|
getPrimaryScrollView?(): { viewportHeight: number };
|
|
22
|
-
routeWheel?(event: {
|
|
23
|
-
direction: number;
|
|
24
|
-
x: number;
|
|
25
|
-
y: number;
|
|
26
|
-
button: number;
|
|
27
|
-
}): void;
|
|
28
|
-
wheelScrollLines?: number;
|
|
29
19
|
[INSTALLED]?: () => void;
|
|
30
20
|
};
|
|
31
21
|
|
|
32
|
-
/** Same shape pi-tui's parseWheelEvent produces. */
|
|
33
|
-
export function parseWheel(data: string) {
|
|
34
|
-
if (!data.startsWith("\x1b")) return undefined;
|
|
35
|
-
const match = SGR_MOUSE_TAIL.exec(data.slice(1));
|
|
36
|
-
if (!match) return undefined;
|
|
37
|
-
const button = Number.parseInt(match[1] ?? "", 10);
|
|
38
|
-
if ((button & 64) === 0) return undefined;
|
|
39
|
-
const direction = button & 3;
|
|
40
|
-
if (direction !== 0 && direction !== 1) return undefined;
|
|
41
|
-
return {
|
|
42
|
-
direction: direction === 0 ? -1 : 1,
|
|
43
|
-
x: Number.parseInt(match[2] ?? "", 10) - 1,
|
|
44
|
-
y: Number.parseInt(match[3] ?? "", 10) - 1,
|
|
45
|
-
button,
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
|
|
49
22
|
/**
|
|
50
|
-
* Keep the fullscreen transcript scrollable while an overlay owns
|
|
23
|
+
* Keep the fullscreen transcript scrollable by key while an overlay owns
|
|
24
|
+
* focus.
|
|
51
25
|
*
|
|
52
|
-
* Pi's viewport listener declines
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
* that to the same scroll methods the renderer would have used.
|
|
58
|
-
* consumed so the overlay never receives a scroll chord
|
|
59
|
-
* through untouched when no overlay is focused because the renderer already
|
|
60
|
-
* consumed them.
|
|
26
|
+
* Pi's viewport listener declines every `tui.altScreen` scroll key as soon as
|
|
27
|
+
* a capturing overlay is focused, so an `ask_user_question` questionnaire
|
|
28
|
+
* freezes the transcript behind it. (Pi 1.2.0 routes wheel events itself in
|
|
29
|
+
* that state, so only keys need help.) This listener registers after the
|
|
30
|
+
* renderer's own, so it only ever sees input the viewport already passed on,
|
|
31
|
+
* and routes that to the same scroll methods the renderer would have used.
|
|
32
|
+
* Keys are consumed so the overlay never receives a scroll chord.
|
|
61
33
|
*
|
|
62
34
|
* Regular mode and renderer shapes without the scroll surface install
|
|
63
|
-
* nothing; a renamed private field only loses the
|
|
64
|
-
*
|
|
35
|
+
* nothing; a renamed private field only loses the page size, not scrolling
|
|
36
|
+
* itself.
|
|
65
37
|
*
|
|
66
38
|
* @lat: [[lat.md/proper-base/lifecycle#Prompt history lifecycle#Overlay transcript scrolling]]
|
|
67
39
|
*/
|
|
@@ -89,12 +61,6 @@ export function installOverlayScroll(tui: TUI): (() => void) | undefined {
|
|
|
89
61
|
|
|
90
62
|
const listener: TuiInputListener = (data) => {
|
|
91
63
|
if (host.isOverlayFocused?.() !== true) return undefined;
|
|
92
|
-
const wheel = parseWheel(data);
|
|
93
|
-
if (wheel) {
|
|
94
|
-
if (typeof host.routeWheel === "function") host.routeWheel(wheel);
|
|
95
|
-
else host.scrollBy(wheel.direction * (host.wheelScrollLines ?? 1));
|
|
96
|
-
return { consume: true };
|
|
97
|
-
}
|
|
98
64
|
if (!data.startsWith("\x1b")) return undefined;
|
|
99
65
|
const kb = getKeybindings();
|
|
100
66
|
const action = kb.matches(data, "tui.altScreen.pageUp")
|
package/src/skills.ts
CHANGED
|
@@ -166,14 +166,16 @@ export function registerSkillContext(
|
|
|
166
166
|
const enabled = () => !disposed && readSkillContextEnabled(agentDir);
|
|
167
167
|
const effective = () => !disposed && (runEnabled ?? enabled());
|
|
168
168
|
let toolHidden = false;
|
|
169
|
-
const syncTool = (active: boolean) => {
|
|
169
|
+
const syncTool = (active: boolean, explicit = false) => {
|
|
170
170
|
const tools = pi.getActiveTools?.();
|
|
171
171
|
if (!tools || !pi.setActiveTools) return;
|
|
172
|
-
if (!active
|
|
173
|
-
|
|
172
|
+
if (!active) {
|
|
173
|
+
if (tools.includes(SKILL_CONTEXT_TOOL))
|
|
174
|
+
pi.setActiveTools(tools.filter((name) => name !== SKILL_CONTEXT_TOOL));
|
|
174
175
|
toolHidden = true;
|
|
175
|
-
} else if (
|
|
176
|
-
|
|
176
|
+
} else if (toolHidden || explicit) {
|
|
177
|
+
if (!tools.includes(SKILL_CONTEXT_TOOL))
|
|
178
|
+
pi.setActiveTools([...tools, SKILL_CONTEXT_TOOL]);
|
|
177
179
|
toolHidden = false;
|
|
178
180
|
}
|
|
179
181
|
};
|
|
@@ -420,7 +422,7 @@ export function registerSkillContext(
|
|
|
420
422
|
);
|
|
421
423
|
if ((action === "on" || action === "off") && !names.length) {
|
|
422
424
|
writeSkillContextEnabled(agentDir, action === "on");
|
|
423
|
-
syncTool(action === "on");
|
|
425
|
+
syncTool(action === "on", action === "on");
|
|
424
426
|
ctx.ui.notify(
|
|
425
427
|
`Skill context management ${action === "on" ? "enabled" : "disabled"}. Applies to the next run; native skills remain available.`,
|
|
426
428
|
"info",
|