@erichll/pi-auto-review 0.18.0 → 0.18.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/CHANGELOG.md +11 -0
- package/package.json +1 -1
- package/src/user-feedback.ts +47 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.18.1 - 2026-09-11
|
|
4
|
+
|
|
5
|
+
- Animate the live `reviewing` label in the above-editor widget with a
|
|
6
|
+
left-to-right light sweep while the reviewer model is evaluating a boundary check.
|
|
7
|
+
- Paint shimmer frames at an 80ms interval cycling theme colors (`accent`,
|
|
8
|
+
`muted`, `dim`) without altering the label text length or widget layout width.
|
|
9
|
+
- Ensure the animation timer cleanly stops and disposes when the review phase
|
|
10
|
+
completes or the widget is dismissed.
|
|
11
|
+
- Export `USER_REVIEW_SWEEP_INTERVAL_MS` and `renderReviewingSweep` for testing
|
|
12
|
+
and custom TUI rendering.
|
|
13
|
+
|
|
3
14
|
## 0.18.0 - 2026-09-11
|
|
4
15
|
|
|
5
16
|
- 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.1",
|
|
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/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
|
);
|