@erichll/pi-auto-review 0.18.0 → 0.18.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/CHANGELOG.md +22 -0
- package/package.json +1 -1
- package/src/review/config.ts +7 -1
- package/src/review/guards.ts +0 -5
- package/src/review/input.ts +7 -1
- package/src/user-feedback.ts +47 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.18.2 - 2026-09-17
|
|
4
|
+
|
|
5
|
+
- Treat empty or whitespace-only `.pi/pi-auto-review.json` files as missing
|
|
6
|
+
configuration instead of throwing `SyntaxError`. This prevents `session_start`
|
|
7
|
+
from disabling automatic reviews for an entire session when Linux bubblewrap
|
|
8
|
+
creates a 0-byte mount point stub for deny-write paths (fixes #6).
|
|
9
|
+
- Apply the same empty-file tolerance to the user-global config loader.
|
|
10
|
+
- Remove redundant files from `protectedFiles` in `guards.ts` (`settings.json`,
|
|
11
|
+
`permissions.json`, and unused `sandbox.json`) so workspaces can configure
|
|
12
|
+
standard settings without triggering security tampering hard-denials.
|
|
13
|
+
|
|
14
|
+
## 0.18.1 - 2026-09-11
|
|
15
|
+
|
|
16
|
+
- Animate the live `reviewing` label in the above-editor widget with a
|
|
17
|
+
left-to-right light sweep while the reviewer model is evaluating a boundary check.
|
|
18
|
+
- Paint shimmer frames at an 80ms interval cycling theme colors (`accent`,
|
|
19
|
+
`muted`, `dim`) without altering the label text length or widget layout width.
|
|
20
|
+
- Ensure the animation timer cleanly stops and disposes when the review phase
|
|
21
|
+
completes or the widget is dismissed.
|
|
22
|
+
- Export `USER_REVIEW_SWEEP_INTERVAL_MS` and `renderReviewingSweep` for testing
|
|
23
|
+
and custom TUI rendering.
|
|
24
|
+
|
|
3
25
|
## 0.18.0 - 2026-09-11
|
|
4
26
|
|
|
5
27
|
- Coordinated release for `@erichll/pi-sandbox 0.18.0`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@erichll/pi-auto-review",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.2",
|
|
4
4
|
"description": "Fail-closed, model-backed approval broker for Pi: deterministically hard-denies dangerous operations, reviews dangerous boundaries with a reviewer model, and issues one-shot expiring grants that OS sandbox adapters must consume before retrying.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
package/src/review/config.ts
CHANGED
|
@@ -241,7 +241,13 @@ export function loadTrustedConfig(
|
|
|
241
241
|
const path = options.userConfigPath ?? userConfigPath();
|
|
242
242
|
let value: unknown;
|
|
243
243
|
try {
|
|
244
|
-
|
|
244
|
+
const content = readFileSync(path, "utf8");
|
|
245
|
+
if (!content.trim()) {
|
|
246
|
+
// Treat empty/whitespace-only file the same as missing — sandbox
|
|
247
|
+
// runtime may leave 0-byte mount-point stubs for denyWrite paths.
|
|
248
|
+
return packageConfig;
|
|
249
|
+
}
|
|
250
|
+
value = JSON.parse(content);
|
|
245
251
|
} catch (error) {
|
|
246
252
|
if (
|
|
247
253
|
error &&
|
package/src/review/guards.ts
CHANGED
|
@@ -31,12 +31,7 @@ export function protectedWriteHardDeny(
|
|
|
31
31
|
join(agentDir, "extensions", "pi-auto-review"),
|
|
32
32
|
];
|
|
33
33
|
const protectedFiles = [
|
|
34
|
-
join(request.cwd, ".pi", "settings.json"),
|
|
35
|
-
join(request.cwd, ".pi", "sandbox.json"),
|
|
36
34
|
join(request.cwd, PROJECT_CONFIG_PATH),
|
|
37
|
-
join(agentDir, "settings.json"),
|
|
38
|
-
join(agentDir, "permissions.json"),
|
|
39
|
-
join(agentDir, "sandbox.json"),
|
|
40
35
|
userConfigPath(),
|
|
41
36
|
];
|
|
42
37
|
if (
|
package/src/review/input.ts
CHANGED
|
@@ -39,7 +39,13 @@ export function sessionConfig(
|
|
|
39
39
|
const projectPath = join(cwd, PROJECT_CONFIG_PATH);
|
|
40
40
|
let raw: unknown;
|
|
41
41
|
try {
|
|
42
|
-
|
|
42
|
+
const content = readFileSync(projectPath, "utf8");
|
|
43
|
+
if (!content.trim()) {
|
|
44
|
+
// Treat empty/whitespace-only file the same as missing — sandbox
|
|
45
|
+
// runtime may leave 0-byte mount-point stubs for denyWrite paths.
|
|
46
|
+
return Object.freeze({ ...trusted });
|
|
47
|
+
}
|
|
48
|
+
raw = JSON.parse(content);
|
|
43
49
|
} catch (error) {
|
|
44
50
|
if (
|
|
45
51
|
error &&
|
package/src/user-feedback.ts
CHANGED
|
@@ -5,6 +5,8 @@ export const USER_REVIEW_ENTRY_TYPE = "pi-auto-review";
|
|
|
5
5
|
export const USER_REVIEW_WIDGET_KEY = "pi-auto-review";
|
|
6
6
|
/** How long a successful completed widget stays above the editor. */
|
|
7
7
|
export const USER_REVIEW_SUCCESS_WIDGET_TTL_MS = 8_000;
|
|
8
|
+
/** Frame interval for the light sweep across the live `reviewing` label. */
|
|
9
|
+
export const USER_REVIEW_SWEEP_INTERVAL_MS = 80;
|
|
8
10
|
|
|
9
11
|
export type UserReviewOutcome =
|
|
10
12
|
| "allow"
|
|
@@ -600,14 +602,36 @@ export function buildUserReviewWidgetData(
|
|
|
600
602
|
};
|
|
601
603
|
}
|
|
602
604
|
|
|
605
|
+
const REVIEWING_LABEL = "reviewing";
|
|
606
|
+
const REVIEWING_SWEEP_GAP_FRAMES = 4;
|
|
607
|
+
|
|
608
|
+
/** Paint one left-to-right shimmer frame without changing the label width. */
|
|
609
|
+
export function renderReviewingSweep(
|
|
610
|
+
theme: UserReviewTheme,
|
|
611
|
+
frame: number,
|
|
612
|
+
): string {
|
|
613
|
+
const center = Math.abs(Math.trunc(frame)) %
|
|
614
|
+
(REVIEWING_LABEL.length + REVIEWING_SWEEP_GAP_FRAMES) - 2;
|
|
615
|
+
return [...REVIEWING_LABEL].map((character, index) => {
|
|
616
|
+
const distance = Math.abs(index - center);
|
|
617
|
+
const color = distance === 0
|
|
618
|
+
? "accent"
|
|
619
|
+
: distance === 1
|
|
620
|
+
? "muted"
|
|
621
|
+
: "dim";
|
|
622
|
+
return `${theme.getFgAnsi(color)}${character}`;
|
|
623
|
+
}).join("") + "\x1b[0m";
|
|
624
|
+
}
|
|
625
|
+
|
|
603
626
|
export function renderUserReviewWidgetLines(
|
|
604
627
|
data: UserReviewWidgetData,
|
|
605
628
|
theme: UserReviewTheme,
|
|
606
629
|
width: number,
|
|
630
|
+
reviewingFrame = 0,
|
|
607
631
|
): string[] {
|
|
608
632
|
const rendered: string[] = [];
|
|
609
633
|
const verb = data.phase === "reviewing"
|
|
610
|
-
?
|
|
634
|
+
? REVIEWING_LABEL
|
|
611
635
|
: data.phase === "waiting_user"
|
|
612
636
|
? "waiting"
|
|
613
637
|
: outcomeVerb(data.outcome);
|
|
@@ -620,9 +644,12 @@ export function renderUserReviewWidgetLines(
|
|
|
620
644
|
for (const visual of wrapReviewDisplayText(line, Math.max(1, width))) {
|
|
621
645
|
let painted = `${mutedAnsi}${visual}\x1b[0m`;
|
|
622
646
|
if (index === 0) {
|
|
647
|
+
const paintedVerb = data.phase === "reviewing"
|
|
648
|
+
? renderReviewingSweep(theme, reviewingFrame)
|
|
649
|
+
: `${verbAnsi}${verb}\x1b[0m`;
|
|
623
650
|
painted = painted.replace(
|
|
624
651
|
verb,
|
|
625
|
-
`${
|
|
652
|
+
`${paintedVerb}${mutedAnsi}`,
|
|
626
653
|
);
|
|
627
654
|
}
|
|
628
655
|
rendered.push(painted);
|
|
@@ -640,11 +667,24 @@ function setWidget(
|
|
|
640
667
|
ctx.ui.setWidget(
|
|
641
668
|
USER_REVIEW_WIDGET_KEY,
|
|
642
669
|
data
|
|
643
|
-
? (
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
670
|
+
? (tui, theme) => {
|
|
671
|
+
let frame = 0;
|
|
672
|
+
const interval = data.phase === "reviewing"
|
|
673
|
+
? setInterval(() => {
|
|
674
|
+
frame++;
|
|
675
|
+
tui.requestRender();
|
|
676
|
+
}, USER_REVIEW_SWEEP_INTERVAL_MS)
|
|
677
|
+
: undefined;
|
|
678
|
+
interval?.unref?.();
|
|
679
|
+
return {
|
|
680
|
+
render: (width: number) =>
|
|
681
|
+
renderUserReviewWidgetLines(data, theme, width, frame),
|
|
682
|
+
invalidate() {},
|
|
683
|
+
dispose() {
|
|
684
|
+
if (interval !== undefined) clearInterval(interval);
|
|
685
|
+
},
|
|
686
|
+
};
|
|
687
|
+
}
|
|
648
688
|
: undefined,
|
|
649
689
|
{ placement: "aboveEditor" },
|
|
650
690
|
);
|