@firstpick/pi-package-webui 0.6.9 → 0.7.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/public/styles.css CHANGED
@@ -1012,6 +1012,33 @@ body.embedded-split .side-panel-backdrop {
1012
1012
  font-size: 1rem;
1013
1013
  line-height: 1.25;
1014
1014
  }
1015
+ .side-panel-brand-row {
1016
+ display: flex;
1017
+ align-items: center;
1018
+ gap: 0.32rem;
1019
+ min-width: 0;
1020
+ }
1021
+ .sponsor-link {
1022
+ display: inline-grid;
1023
+ place-items: center;
1024
+ flex: 0 0 auto;
1025
+ width: 1.25rem;
1026
+ height: 1.25rem;
1027
+ border-radius: 999px;
1028
+ color: rgba(245, 194, 231, 0.62);
1029
+ background: transparent;
1030
+ font-size: 0.95rem;
1031
+ line-height: 1;
1032
+ text-decoration: none;
1033
+ transition: color 140ms ease, background 140ms ease, box-shadow 140ms ease;
1034
+ }
1035
+ .sponsor-link:hover,
1036
+ .sponsor-link:focus-visible {
1037
+ color: var(--ctp-pink);
1038
+ background: rgba(245, 194, 231, 0.11);
1039
+ box-shadow: 0 0 0.75rem rgba(245, 194, 231, 0.2);
1040
+ outline: none;
1041
+ }
1015
1042
  .side-panel-version-row {
1016
1043
  display: flex;
1017
1044
  align-items: center;
@@ -2005,6 +2032,33 @@ body.embedded-split .side-panel-backdrop {
2005
2032
  .subagents-help code {
2006
2033
  color: var(--ctp-teal);
2007
2034
  }
2035
+ .subagent-open-mode-field {
2036
+ display: grid;
2037
+ grid-template-columns: minmax(0, 1fr) auto;
2038
+ gap: 0.32rem 0.52rem;
2039
+ align-items: center;
2040
+ margin: 0 0 0.55rem;
2041
+ padding: 0.5rem 0.56rem;
2042
+ border: 1px solid rgba(137, 180, 250, 0.20);
2043
+ border-radius: 0.68rem;
2044
+ background: rgba(137, 180, 250, 0.06);
2045
+ }
2046
+ .subagent-open-mode-field label {
2047
+ color: rgba(var(--ctp-text-rgb), 0.9);
2048
+ font-size: var(--text-xs);
2049
+ font-weight: 850;
2050
+ }
2051
+ .subagent-open-mode-field select {
2052
+ min-width: 8.4rem;
2053
+ min-height: 2.2rem;
2054
+ padding-top: 0.32rem;
2055
+ padding-bottom: 0.32rem;
2056
+ font-size: var(--text-xs);
2057
+ }
2058
+ .subagent-open-mode-field span {
2059
+ grid-column: 1 / -1;
2060
+ font-size: var(--text-xs);
2061
+ }
2008
2062
  .subagents-status {
2009
2063
  margin: 0 0 0.48rem;
2010
2064
  font-size: var(--text-xs);
@@ -2911,6 +2965,30 @@ body.embedded-split .side-panel-backdrop {
2911
2965
  text-transform: uppercase;
2912
2966
  animation: terminal-tab-app-runner-pulse 1.5s ease-in-out infinite;
2913
2967
  }
2968
+ .terminal-tab-subagent-indicator {
2969
+ flex: 0 0 auto;
2970
+ padding: 0.04rem 0.36rem;
2971
+ border: 1px solid rgba(166, 227, 161, 0.48);
2972
+ border-radius: 999px;
2973
+ color: var(--ctp-green);
2974
+ background: rgba(166, 227, 161, 0.13);
2975
+ box-shadow: 0 0 0.7rem rgba(166, 227, 161, 0.24);
2976
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
2977
+ font-size: var(--text-xs);
2978
+ font-weight: 900;
2979
+ line-height: 1.12;
2980
+ text-transform: uppercase;
2981
+ }
2982
+ .terminal-tab-subagent {
2983
+ border-color: rgba(166, 227, 161, 0.42);
2984
+ background:
2985
+ linear-gradient(120deg, rgba(166, 227, 161, 0.10), rgba(137, 180, 250, 0.08)),
2986
+ rgba(var(--ctp-crust-rgb), 0.58);
2987
+ }
2988
+ .terminal-tab-subagent.active {
2989
+ border-color: rgba(166, 227, 161, 0.72);
2990
+ box-shadow: 0 0 1.1rem rgba(166, 227, 161, 0.22), inset 0 1px 0 rgba(255,255,255,0.05);
2991
+ }
2914
2992
  .terminal-tab-workflow-indicator {
2915
2993
  flex: 0 0 auto;
2916
2994
  padding: 0.04rem 0.36rem;
@@ -3246,6 +3324,7 @@ body.embedded-split .side-panel-backdrop {
3246
3324
  }
3247
3325
  body.terminal-tabs-left .workspace-dashboard,
3248
3326
  body.terminal-tabs-left .widget-area,
3327
+ body.terminal-tabs-left .subagent-terminal-view,
3249
3328
  body.terminal-tabs-left .chat,
3250
3329
  body.terminal-tabs-left .feedback-tray,
3251
3330
  body.terminal-tabs-left .jump-to-latest-button,
@@ -3257,6 +3336,7 @@ body.embedded-split .side-panel-backdrop {
3257
3336
  }
3258
3337
  body.terminal-tabs-left .workspace-dashboard { grid-row: 1; }
3259
3338
  body.terminal-tabs-left .widget-area { grid-row: 2; }
3339
+ body.terminal-tabs-left .subagent-terminal-view { grid-row: 1 / -1; }
3260
3340
  body.terminal-tabs-left .chat { grid-row: 3; }
3261
3341
  body.terminal-tabs-left .feedback-tray { grid-row: 4; }
3262
3342
  body.terminal-tabs-left .jump-to-latest-button { grid-row: 5; }
@@ -4864,6 +4944,66 @@ button.git-workflow-step:hover:not(:disabled) {
4864
4944
  linear-gradient(145deg, rgba(var(--ctp-crust-rgb), 0.98), rgba(var(--ctp-mantle-rgb), 0.92));
4865
4945
  }
4866
4946
  .release-aur-widget .release-npm-kicker { color: var(--ctp-peach); }
4947
+ .aur-review-widget {
4948
+ display: grid;
4949
+ gap: 0.68rem;
4950
+ overflow: hidden;
4951
+ white-space: normal;
4952
+ border-color: rgba(250, 179, 135, 0.68);
4953
+ border-left: 0.28rem solid rgba(250, 179, 135, 0.92);
4954
+ background:
4955
+ radial-gradient(circle at 4% 0%, rgba(250, 179, 135, 0.2), transparent 16rem),
4956
+ radial-gradient(circle at 96% 12%, rgba(249, 226, 175, 0.14), transparent 18rem),
4957
+ linear-gradient(145deg, rgba(var(--ctp-crust-rgb), 0.98), rgba(var(--ctp-mantle-rgb), 0.92));
4958
+ }
4959
+ .aur-review-header,
4960
+ .aur-review-title-wrap,
4961
+ .aur-review-actions,
4962
+ .aur-review-summary,
4963
+ .aur-review-reports {
4964
+ display: flex;
4965
+ gap: 0.48rem;
4966
+ align-items: center;
4967
+ min-width: 0;
4968
+ }
4969
+ .aur-review-header { justify-content: space-between; gap: 0.8rem; }
4970
+ .aur-review-title-wrap { display: grid; gap: 0.08rem; align-items: start; }
4971
+ .aur-review-kicker { color: var(--ctp-peach); font-size: var(--text-xs); font-weight: 760; letter-spacing: 0.08em; text-transform: uppercase; }
4972
+ .aur-review-title { color: var(--ctp-text); }
4973
+ .aur-review-actions { flex-wrap: wrap; justify-content: flex-end; }
4974
+ .aur-review-action,
4975
+ .aur-review-report {
4976
+ min-height: 2rem;
4977
+ padding: 0.32rem 0.56rem;
4978
+ border: 1px solid rgba(250, 179, 135, 0.34);
4979
+ border-radius: 0.5rem;
4980
+ color: var(--ctp-text);
4981
+ background: rgba(var(--ctp-crust-rgb), 0.54);
4982
+ font-size: var(--text-xs);
4983
+ }
4984
+ .aur-review-action:hover,
4985
+ .aur-review-report:hover { border-color: rgba(250, 179, 135, 0.8); color: var(--ctp-peach); }
4986
+ .aur-review-action.primary { border-color: rgba(166, 227, 161, 0.58); color: var(--ctp-green); }
4987
+ .aur-review-action.danger { border-color: rgba(243, 139, 168, 0.58); color: var(--ctp-red); }
4988
+ .aur-review-summary { flex-wrap: wrap; align-items: baseline; color: var(--ctp-subtext0); font-size: var(--text-xs); }
4989
+ .aur-review-status { color: var(--ctp-peach); font-weight: 720; }
4990
+ .aur-review-root,
4991
+ .aur-review-fingerprint { max-width: 100%; overflow-wrap: anywhere; }
4992
+ .aur-review-fingerprint { color: var(--ctp-yellow); font-size: var(--text-xs); }
4993
+ .aur-review-files {
4994
+ border: 1px solid rgba(250, 179, 135, 0.2);
4995
+ border-radius: 0.58rem;
4996
+ background: rgba(var(--ctp-crust-rgb), 0.34);
4997
+ }
4998
+ .aur-review-files > summary { padding: 0.48rem 0.56rem; cursor: pointer; color: var(--ctp-subtext0); }
4999
+ .aur-review-file-list { display: grid; gap: 0.3rem; max-height: 12rem; margin: 0; padding: 0 0.8rem 0.65rem 1.7rem; overflow: auto; color: var(--ctp-text); font-size: var(--text-xs); overflow-wrap: anywhere; }
5000
+ .aur-review-reports { flex-wrap: wrap; align-items: baseline; color: var(--ctp-subtext0); font-size: var(--text-xs); }
5001
+ @media (max-width: 720px), (max-device-width: 720px), (pointer: coarse) and (hover: none) {
5002
+ .aur-review-header { align-items: stretch; flex-direction: column; }
5003
+ .aur-review-actions { justify-content: stretch; }
5004
+ .aur-review-action,
5005
+ .aur-review-report { flex: 1 1 7.25rem; min-height: 44px; }
5006
+ }
4867
5007
  .app-runner-widget {
4868
5008
  border-color: rgba(166, 227, 161, 0.62);
4869
5009
  border-left-color: rgba(166, 227, 161, 0.88);
@@ -8488,31 +8628,23 @@ button.composer-skill-tag:focus-visible {
8488
8628
  scrollbar-gutter: stable;
8489
8629
  }
8490
8630
  .subagent-overlay-message {
8491
- margin: 0;
8492
- }
8493
- .subagent-overlay-message + .subagent-output-waiting {
8494
- margin-top: 0.55rem;
8631
+ margin: 0 0 0.55rem;
8495
8632
  }
8496
- .subagent-output-waiting {
8497
- width: fit-content;
8498
- min-width: 2.1rem;
8633
+ .subagent-overlay-message:last-child {
8499
8634
  margin-bottom: 0;
8500
- padding: 0.42rem 0.58rem;
8501
- color: var(--ctp-green);
8502
- font-weight: 900;
8503
- letter-spacing: 0.08em;
8504
8635
  }
8505
- .subagent-output-waiting .run-indicator-row {
8506
- gap: 0.12rem;
8636
+ .subagent-overlay-message + .subagent-run-indicator {
8637
+ margin-top: 0;
8638
+ }
8639
+ .subagent-run-indicator {
8640
+ margin-bottom: 0;
8507
8641
  }
8508
- .subagent-output-waiting-dot {
8509
- animation: subagent-output-waiting-pulse 1.15s ease-in-out infinite;
8642
+ .subagent-run-indicator .run-indicator-meta {
8643
+ min-width: 0;
8644
+ overflow-wrap: anywhere;
8510
8645
  }
8511
- .subagent-output-waiting-dot:nth-child(2) { animation-delay: 140ms; }
8512
- .subagent-output-waiting-dot:nth-child(3) { animation-delay: 280ms; }
8513
- @keyframes subagent-output-waiting-pulse {
8514
- 0%, 70%, 100% { opacity: 0.22; transform: translateY(0); }
8515
- 35% { opacity: 1; transform: translateY(-0.12rem); }
8646
+ .subagent-run-indicator-elapsed {
8647
+ white-space: nowrap;
8516
8648
  }
8517
8649
  .subagent-overlay-output-controls {
8518
8650
  min-width: 0;
@@ -8527,6 +8659,137 @@ button.composer-skill-tag:focus-visible {
8527
8659
  color: var(--ctp-yellow);
8528
8660
  border-color: rgba(249, 226, 175, 0.34);
8529
8661
  }
8662
+ .subagent-terminal-view {
8663
+ flex: 1 1 auto;
8664
+ display: flex;
8665
+ flex-direction: column;
8666
+ min-width: 0;
8667
+ min-height: 0;
8668
+ background:
8669
+ radial-gradient(circle at 8% 0, rgba(166, 227, 161, 0.10), transparent 24rem),
8670
+ linear-gradient(180deg, rgba(var(--ctp-base-rgb), 0.54), rgba(var(--ctp-crust-rgb), 0.66));
8671
+ }
8672
+ .subagent-terminal-header {
8673
+ flex: 0 0 auto;
8674
+ display: flex;
8675
+ align-items: flex-start;
8676
+ justify-content: space-between;
8677
+ gap: 1rem;
8678
+ padding: 0.82rem 0.95rem;
8679
+ border-bottom: 1px solid rgba(166, 227, 161, 0.24);
8680
+ background: rgba(var(--ctp-crust-rgb), 0.40);
8681
+ }
8682
+ .subagent-terminal-heading {
8683
+ display: grid;
8684
+ gap: 0.18rem;
8685
+ min-width: 0;
8686
+ }
8687
+ .subagent-terminal-kicker {
8688
+ color: var(--ctp-green);
8689
+ font-size: var(--text-xs);
8690
+ font-weight: 900;
8691
+ letter-spacing: 0.12em;
8692
+ text-transform: uppercase;
8693
+ }
8694
+ .subagent-terminal-heading strong {
8695
+ overflow: hidden;
8696
+ color: var(--ctp-text);
8697
+ font-size: var(--text-lg);
8698
+ text-overflow: ellipsis;
8699
+ white-space: nowrap;
8700
+ }
8701
+ .subagent-terminal-meta {
8702
+ overflow-wrap: anywhere;
8703
+ font-size: var(--text-xs);
8704
+ }
8705
+ .subagent-terminal-actions {
8706
+ display: flex;
8707
+ flex-wrap: wrap;
8708
+ justify-content: flex-end;
8709
+ gap: 0.45rem;
8710
+ }
8711
+ .subagent-terminal-actions button {
8712
+ min-height: 2.35rem;
8713
+ padding: 0.38rem 0.68rem;
8714
+ font-size: var(--text-xs);
8715
+ }
8716
+ .subagent-terminal-transcript {
8717
+ flex: 1 1 auto;
8718
+ min-height: 0;
8719
+ overflow: auto;
8720
+ padding: 1rem;
8721
+ scroll-padding-bottom: 2rem;
8722
+ overscroll-behavior: contain;
8723
+ scrollbar-gutter: stable;
8724
+ }
8725
+ .subagent-terminal-transcript > .message {
8726
+ width: 100%;
8727
+ max-width: none;
8728
+ }
8729
+ .subagent-terminal-status {
8730
+ flex: 0 0 auto;
8731
+ min-height: 2rem;
8732
+ margin: 0;
8733
+ padding: 0.46rem 0.95rem;
8734
+ border-top: 1px solid rgba(137, 180, 250, 0.16);
8735
+ font-size: var(--text-xs);
8736
+ }
8737
+ .subagent-terminal-status.warning { color: var(--ctp-yellow); }
8738
+ .subagent-terminal-composer {
8739
+ flex: 0 0 auto;
8740
+ display: grid;
8741
+ grid-template-columns: minmax(0, 1fr) auto;
8742
+ gap: 0.42rem 0.55rem;
8743
+ padding: 0.58rem 0.72rem;
8744
+ border-top: 1px solid rgba(166, 227, 161, 0.22);
8745
+ background: rgba(var(--ctp-crust-rgb), 0.76);
8746
+ }
8747
+ .subagent-terminal-composer textarea {
8748
+ min-height: calc(1.5em + 1.35rem);
8749
+ max-height: calc(1.5em + 1.35rem);
8750
+ padding: 0.62rem 0.72rem;
8751
+ resize: none;
8752
+ opacity: 0.72;
8753
+ }
8754
+ .subagent-terminal-composer textarea:disabled {
8755
+ cursor: not-allowed;
8756
+ border-color: rgba(166, 227, 161, 0.24);
8757
+ }
8758
+ .subagent-terminal-composer textarea:disabled::placeholder { color: rgba(var(--ctp-subtext-rgb), 0.82); }
8759
+ .subagent-terminal-composer button { min-height: 0; }
8760
+ .subagent-terminal-composer small {
8761
+ grid-column: 1 / -1;
8762
+ color: rgba(var(--ctp-subtext-rgb), 0.68);
8763
+ font-size: var(--text-xs);
8764
+ }
8765
+ body.subagent-terminal-active .workspace-dashboard,
8766
+ body.subagent-terminal-active .widget-area,
8767
+ body.subagent-terminal-active .chat-search-bar,
8768
+ body.subagent-terminal-active .chat,
8769
+ body.subagent-terminal-active .feedback-tray,
8770
+ body.subagent-terminal-active .jump-to-latest-button,
8771
+ body.subagent-terminal-active .statusbar,
8772
+ body.subagent-terminal-active .context-meter-bar,
8773
+ body.subagent-terminal-active .git-workflow-panel,
8774
+ body.subagent-terminal-active .composer,
8775
+ body.subagent-terminal-active .composer-remote-mic-consent {
8776
+ display: none !important;
8777
+ }
8778
+ @media (max-width: 720px) {
8779
+ .subagent-terminal-header {
8780
+ display: grid;
8781
+ gap: 0.58rem;
8782
+ padding: 0.65rem 0.7rem;
8783
+ }
8784
+ .subagent-terminal-actions { justify-content: stretch; }
8785
+ .subagent-terminal-actions button { flex: 1 1 auto; }
8786
+ .subagent-terminal-transcript { padding: 0.65rem 0.58rem; }
8787
+ .subagent-terminal-composer {
8788
+ grid-template-columns: minmax(0, 1fr);
8789
+ padding-bottom: calc(0.58rem + env(safe-area-inset-bottom));
8790
+ }
8791
+ .subagent-terminal-composer button { display: none; }
8792
+ }
8530
8793
  .extension-dialog.stats-overlay-dialog {
8531
8794
  width: min(92rem, calc(100vw - 1.5rem));
8532
8795
  height: min(54rem, calc(var(--visual-viewport-height, 100dvh) - 1.5rem));
@@ -11927,6 +12190,13 @@ html[data-density="compact"] .composer { padding-block: 0.5rem; }
11927
12190
  .confirmation-details > div { display: grid; grid-template-columns: minmax(6rem, 0.32fr) minmax(0, 1fr); gap: 0.7rem; }
11928
12191
  .confirmation-details dt { color: var(--ctp-subtext); font-weight: 800; }
11929
12192
  .confirmation-details dd { margin: 0; overflow-wrap: anywhere; }
12193
+ .git-worktree-base-options { display: grid; gap: 0.65rem; margin: 1rem 0; padding: 0; border: 0; }
12194
+ .git-worktree-base-option { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 0.7rem; padding: 0.8rem; border: 1px solid rgba(180, 190, 254, 0.2); border-radius: 0.75rem; background: rgba(var(--ctp-surface-rgb), 0.3); cursor: pointer; }
12195
+ .git-worktree-base-option:has(input:checked) { border-color: rgba(137, 180, 250, 0.72); background: rgba(137, 180, 250, 0.12); }
12196
+ .git-worktree-base-option input { margin-top: 0.2rem; accent-color: var(--ctp-blue); }
12197
+ .git-worktree-base-option span { display: grid; gap: 0.2rem; min-width: 0; }
12198
+ .git-worktree-base-option strong { color: var(--ctp-text); overflow-wrap: anywhere; }
12199
+ .git-worktree-base-option small { color: var(--ctp-subtext); line-height: 1.45; }
11930
12200
 
11931
12201
  @media (max-width: 720px) {
11932
12202
  .remote-access-indicator { max-width: 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@@ -0,0 +1,57 @@
1
+ import assert from "node:assert/strict";
2
+ import { AUR_REVIEW_MAX_DISPLAY_PATH_LENGTH, AUR_REVIEW_RPC_PAYLOAD_PREFIX, aurReviewSafePath, parseAurReviewPayload } from "../public/aur-review-payload.mjs";
3
+
4
+ const fingerprint = "a".repeat(64);
5
+ const file = {
6
+ path: "PKGBUILD",
7
+ indexStatus: "M",
8
+ worktreeStatus: ".",
9
+ staged: true,
10
+ unstaged: false,
11
+ untracked: false,
12
+ deleted: false,
13
+ renamed: false,
14
+ };
15
+ const basePayload = {
16
+ type: "firstpick.pi-extension-aur-review.review",
17
+ version: 3,
18
+ repoRoot: "/workspace/repository",
19
+ scope: "staged",
20
+ origin: "guided-git",
21
+ fingerprint,
22
+ stagedContentHash: fingerprint,
23
+ createdAt: "2026-06-01T00:00:00.000Z",
24
+ updatedAt: "2026-06-01T00:00:01.000Z",
25
+ changedFileTotal: 1,
26
+ changedFilesTruncated: false,
27
+ changedFiles: [file],
28
+ stats: { files: 1, staged: 1, unstaged: 0, untracked: 0, deleted: 0, renamed: 0, unmerged: 0 },
29
+ reports: [],
30
+ decision: { state: "pending" },
31
+ };
32
+
33
+ function parse(payload) {
34
+ return parseAurReviewPayload([`${AUR_REVIEW_RPC_PAYLOAD_PREFIX}${JSON.stringify(payload)}`]);
35
+ }
36
+
37
+ assert.deepEqual(parse(basePayload), basePayload, "a relationally valid payload should render");
38
+ assert.equal(parse({ ...basePayload, createdAt: "2026-06-01T00:00:02.000Z" }), null, "createdAt must not be after updatedAt");
39
+ assert.equal(parse({ ...basePayload, updatedAt: "2026-06-01T00:00:01Z" }), null, "timestamps must be canonical ISO strings");
40
+ assert.equal(parse({ ...basePayload, stats: { ...basePayload.stats, files: 0 } }), null, "stats.files must equal changedFileTotal");
41
+ assert.equal(parse({ ...basePayload, stats: { ...basePayload.stats, staged: 2 } }), null, "each stat must not exceed changedFileTotal");
42
+ assert.equal(parse({ ...basePayload, changedFileTotal: 2, stats: { ...basePayload.stats, files: 2, staged: 2 } }), null, "non-truncated arrays must match changedFileTotal");
43
+ assert.ok(parse({ ...basePayload, changedFilesTruncated: true, changedFileTotal: 2, stats: { ...basePayload.stats, files: 2, staged: 2 } }), "truncated arrays may summarize fewer stored files than their total stats");
44
+ assert.equal(parse({ ...basePayload, changedFilesTruncated: true, changedFileTotal: 1 }), null, "a truncated file array must be strictly shorter than changedFileTotal");
45
+ assert.equal(parse({ ...basePayload, changedFilesTruncated: true, changedFileTotal: 2, stats: { ...basePayload.stats, files: 2, staged: 0 } }), null, "truncated arrays still need stats to cover their stored summaries");
46
+ assert.equal(parse({ ...basePayload, decision: { state: "approved", decidedAt: "2026-06-01T00:00:01.000Z", reviewedFingerprint: "b".repeat(64), reviewedStagedContentHash: fingerprint } }), null, "terminal decisions must bind the snapshot fingerprint");
47
+ assert.equal(parse({ ...basePayload, decision: { state: "approved", decidedAt: "2026-06-01T00:00:01.000Z", reviewedFingerprint: fingerprint, reviewedStagedContentHash: "b".repeat(64) } }), null, "terminal decisions must bind the staged-content hash");
48
+ assert.equal(parse({ ...basePayload, decision: { state: "declined", decidedAt: "2026-06-01T00:00:01.000Z", reviewedFingerprint: fingerprint, reviewedStagedContentHash: fingerprint } })?.decision.state, "declined", "matching terminal decisions are accepted");
49
+ assert.equal(parse({ ...basePayload, decision: { state: "pending", reviewedFingerprint: fingerprint } }), null, "pending payloads cannot carry terminal fingerprints");
50
+ assert.equal(parse({ ...basePayload, decision: { state: "closed", reviewedFingerprint: fingerprint } }), null, "closed payloads cannot carry terminal fingerprints");
51
+ assert.equal(parse({ ...basePayload, stagedContentHash: undefined }), null, "staged Guided Git payloads require an exact staged-content hash");
52
+ assert.equal(parse({ ...basePayload, scope: "working-tree", origin: "standalone", stagedContentHash: fingerprint }), null, "standalone payloads must not carry a staged-content hash");
53
+ assert.equal(parse({ ...basePayload, scope: "staged", origin: "standalone" }), null, "scope/origin pairs fail closed");
54
+ assert.equal(parse({ ...basePayload, changedFiles: [{ ...file, path: "../escape" }] }), null, "unsafe display paths fail closed");
55
+ assert.equal(aurReviewSafePath("a".repeat(AUR_REVIEW_MAX_DISPLAY_PATH_LENGTH)).length, AUR_REVIEW_MAX_DISPLAY_PATH_LENGTH, "browser display-path maximum includes every displayed character");
56
+ assert.equal(aurReviewSafePath("a".repeat(AUR_REVIEW_MAX_DISPLAY_PATH_LENGTH + 1)), "", "browser rejects paths beyond the shared display maximum");
57
+ console.log("aur review payload tests passed");
@@ -0,0 +1,38 @@
1
+ import assert from "node:assert/strict";
2
+ import { readFile } from "node:fs/promises";
3
+ import { dirname, join } from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+
6
+ const root = join(dirname(fileURLToPath(import.meta.url)), "..");
7
+ const [app, css, pkg, server, payloadParser] = await Promise.all([
8
+ readFile(join(root, "public", "app.js"), "utf8"),
9
+ readFile(join(root, "public", "styles.css"), "utf8"),
10
+ readFile(join(root, "package.json"), "utf8"),
11
+ readFile(join(root, "bin", "pi-webui.mjs"), "utf8"),
12
+ readFile(join(root, "public", "aur-review-payload.mjs"), "utf8"),
13
+ ]);
14
+
15
+ assert.match(app, /const AUR_REVIEW_RPC_WIDGET_KEY = "aur-review:rpc"[\s\S]*AUR_REVIEW_RPC_PAYLOAD_PREFIX = "AUR_REVIEW_RPC_PAYLOAD "[\s\S]*AUR_REVIEW_RPC_PAYLOAD_TYPE = "firstpick\.pi-extension-aur-review\.review"[\s\S]*AUR_REVIEW_RPC_PAYLOAD_VERSION = 3/, "WebUI should identify the versioned AUR review payload");
16
+ assert.match(app, /parseValidatedAurReviewPayload[\s\S]*function parseAurReviewPayload\(lines\)[\s\S]*prefix: AUR_REVIEW_RPC_PAYLOAD_PREFIX/, "AUR review rendering should delegate parsing to the fail-closed payload module");
17
+ assert.match(payloadParser, /validTimestamp[\s\S]*Date\.parse\(payload\.createdAt\) > Date\.parse\(payload\.updatedAt\)/, "payload parsing should enforce ordered canonical timestamps");
18
+ assert.match(payloadParser, /stats\[key\] <= total[\s\S]*stats\.files !== total/, "payload parsing should enforce stats totals and bounds");
19
+ assert.match(payloadParser, /decision\.reviewedFingerprint !== payload\.fingerprint/, "payload parsing should bind terminal decisions to the snapshot fingerprint");
20
+ assert.match(payloadParser, /stagedPayload \? decision\.reviewedStagedContentHash !== payload\.stagedContentHash/, "payload parsing should bind staged terminal decisions to the staged-content hash");
21
+ assert.match(payloadParser, /payload\.changedFiles\.length >= payload\.changedFileTotal/, "payload parsing should reject equality at the truncated-file boundary");
22
+ assert.match(app, /function renderAurReviewWidget\(\)[\s\S]*Review changes[\s\S]*Refresh[\s\S]*Approve[\s\S]*Decline[\s\S]*Close[\s\S]*openAurReviewReportInViewer\(reportPath, payload\.repoRoot\)/, "renderer should open reports against the payload's repo root rather than the tab cwd");
23
+ assert.match(app, /async function openAurReviewReportInViewer\(path = "", repoRoot = ""\)[\s\S]*\/api\/aur-review\/report-content[\s\S]*readOnly: true/s, "report viewing must use the narrow read-only canonical-root endpoint");
24
+ assert.match(app, /viewer\.readOnly === true \|\| !viewer\.dirty[\s\S]*viewer\.readOnly === true \|\| !viewerPath/s, "repo-root report views must not enable generic save or default-editor actions");
25
+ assert.match(app, /function aurReviewActionButton\(label, action, className = ""\)[\s\S]*action === "review"[\s\S]*openGitChangesDialog\(\)[\s\S]*`\/aur-review \$\{action\}`/, "Review changes should reuse the current Git diff dialog and other controls should call canonical extension commands");
26
+ assert.match(app, /aurReviewActionButton\("Approve", "approve", "primary"\)/, "Approve should delegate to the extension slash command, which owns native confirmation");
27
+ assert.match(app, /id: "aurReview"[\s\S]*packageName: "@firstpick\/pi-extension-aur-review"[\s\S]*capabilityLabel: "\/aur-review or aur-review:rpc widget event"/, "optional feature discovery should identify the companion by command or payload");
28
+ assert.match(app, /optionalFeatureAvailability\.aurReview = hasAvailableCommand\("aur-review"\)[\s\S]*widgets\.has\(AUR_REVIEW_RPC_WIDGET_KEY\)/, "feature availability should detect commands and replayed widget state");
29
+ assert.match(app, /if \(key === AUR_REVIEW_RPC_WIDGET_KEY\) return "aurReview"[\s\S]*key === AUR_REVIEW_RPC_WIDGET_KEY/, "generic widget fallback should be preserved while the AUR review payload gets a specialized renderer");
30
+ assert.match(css, /\.aur-review-widget \{[\s\S]*\.aur-review-actions[\s\S]*\.aur-review-file-list[\s\S]*@media \(max-width: 720px\)[\s\S]*\.aur-review-action,[\s\S]*\.aur-review-report/, "AUR review card should be styled responsively for desktop and mobile");
31
+ assert.equal(JSON.parse(pkg).optionalDependencies?.["@firstpick/pi-extension-aur-review"], undefined, "WebUI must not reference the unpublished review extension from clean npm installs");
32
+ assert.equal(JSON.parse(pkg).pi?.extensions?.some((entry) => String(entry).includes("pi-extension-aur-review")), false, "WebUI must not bundle an unpublished nested review extension path");
33
+ assert.match(server, /\["aurReview", "@firstpick\/pi-extension-aur-review"\]/, "optional-feature installer should retain the future/local review companion mapping");
34
+ assert.match(server, /"aur-review-payload\.mjs", "guided-git-command-state\.mjs", "guided-git-review-state\.mjs"/, "server must serve every browser module used by the review gate");
35
+ assert.match(server, /STAGED_CONTENT_HASH_DOMAIN = "firstpick\/aur-review\/staged-content\/v1\\0"[\s\S]*git diff --cached[\s\S]*\/api\/git-workflow\/staged-content/, "server must expose the bounded read-only staged-content hash helper");
36
+ assert.match(server, /async function getAurReviewReportContentData\(tab, \{ path: requestedPath = "", repoRoot = "" \} = \{\}\)[\s\S]*repoRoot !== root[\s\S]*lstat\(targetPath\)[\s\S]*isSymbolicLink\(\)[\s\S]*readBoundedAurReviewReport[\s\S]*\/api\/aur-review\/report-content/s, "server must bind report reads to the canonical Git root and reject symlinked paths through a dedicated read-only route");
37
+ assert.match(server, /entry\.name\.startsWith\("pi-"\)[\s\S]*packageNameForResourcePath\(path\.join\(candidate, "package\.json"\)\)/, "workspace optional-package discovery must recognize the pi-extension-aur-review sibling by manifest name");
38
+ console.log("aur review widget static tests passed");
@@ -12,7 +12,12 @@ const serverScript = join(root, "bin", "pi-webui.mjs");
12
12
  const compactingPi = join(root, "tests", "fixtures", "compacting-pi.mjs");
13
13
  const port = 30000 + Math.floor(Math.random() * 20000);
14
14
  const COMPACTION_TRIGGER = "__pi_webui_test_start_compaction__";
15
+ const ABORTED_COMPACTION_TRIGGER = "__pi_webui_test_start_aborted_compaction__";
15
16
  const RESUME_PROMPT = "resume automatically after compaction";
17
+ const STEER_PROMPT = "steer automatically after compaction";
18
+ const FOLLOW_UP_PROMPT = "follow up automatically after compaction";
19
+ const QUEUED_SLASH_PROMPT = "/queued-extension-command";
20
+ const ABORTED_RESUME_PROMPT = "resume automatically after aborted compaction";
16
21
 
17
22
  async function request(pathname, { method = "GET", body, timeoutMs = 5_000 } = {}) {
18
23
  const response = await fetch(`http://127.0.0.1:${port}${pathname}`, {
@@ -87,22 +92,69 @@ try {
87
92
  assert.equal(queuedPrompt.body?.data?.queuedFor, "compaction");
88
93
  assert.equal(queuedPrompt.body?.data?.queueLength, 1);
89
94
 
95
+ const queuedSteer = await request("/api/steer", {
96
+ method: "POST",
97
+ body: { tab: tabId, message: STEER_PROMPT },
98
+ });
99
+ assert.equal(queuedSteer.status, 202, "steer sent during compaction should be accepted into the Web UI resume queue");
100
+ assert.equal(queuedSteer.body?.data?.queueLength, 2);
101
+
102
+ const queuedFollowUp = await request("/api/follow-up", {
103
+ method: "POST",
104
+ body: { tab: tabId, message: FOLLOW_UP_PROMPT },
105
+ });
106
+ assert.equal(queuedFollowUp.status, 202, "follow-up sent during compaction should be accepted into the Web UI resume queue");
107
+ assert.equal(queuedFollowUp.body?.data?.queueLength, 3);
108
+
109
+ const queuedSlashPrompt = await request("/api/prompt", {
110
+ method: "POST",
111
+ body: { tab: tabId, message: QUEUED_SLASH_PROMPT, streamingBehavior: "followUp" },
112
+ });
113
+ assert.equal(queuedSlashPrompt.status, 202, "slash prompt sent during compaction should remain a prompt in the resume queue");
114
+ assert.equal(queuedSlashPrompt.body?.data?.queueLength, 4);
115
+
90
116
  const messagesBeforeEnd = await request(`/api/messages?tab=${encodeURIComponent(tabId)}`);
91
117
  assert.equal(messagesBeforeEnd.status, 200);
92
- assert.equal((messagesBeforeEnd.body?.data?.messages || []).some((message) => String(message.content || "").includes(RESUME_PROMPT)), false, "queued prompt should not reach Pi before compaction_end");
118
+ const queuedMessages = [RESUME_PROMPT, STEER_PROMPT, FOLLOW_UP_PROMPT, QUEUED_SLASH_PROMPT];
119
+ for (const message of queuedMessages) {
120
+ assert.equal((messagesBeforeEnd.body?.data?.messages || []).some((entry) => String(entry.content || "").includes(message)), false, "queued messages should not reach Pi before compaction_end");
121
+ }
93
122
 
94
123
  await waitFor("compaction to finish", async () => {
95
124
  const state = await request(`/api/state?tab=${encodeURIComponent(tabId)}`);
96
125
  return state.body?.data?.isCompacting === false ? state : false;
97
126
  }, { attempts: 80, intervalMs: 100 });
98
127
 
99
- const resumedMessages = await waitFor("queued prompt to resume after compaction", async () => {
128
+ const resumedMessages = await waitFor("queued prompts to resume after compaction", async () => {
100
129
  const messages = await request(`/api/messages?tab=${encodeURIComponent(tabId)}`);
101
130
  const entries = messages.body?.data?.messages || [];
102
- return entries.some((message) => String(message.content || "").includes(`prompt:${RESUME_PROMPT}`)) ? messages : false;
131
+ const expected = [`prompt:${RESUME_PROMPT}`, `steer:${STEER_PROMPT}`, `follow_up:${FOLLOW_UP_PROMPT}`, `prompt:${QUEUED_SLASH_PROMPT}`];
132
+ return expected.every((content, index) => String(entries[index]?.content || "") === content) ? messages : false;
103
133
  }, { attempts: 80, intervalMs: 100 });
104
134
  assert.equal(resumedMessages.status, 200);
105
135
 
136
+ const startAbortedCompaction = await request("/api/prompt", {
137
+ method: "POST",
138
+ body: { tab: tabId, message: ABORTED_COMPACTION_TRIGGER },
139
+ });
140
+ assert.equal(startAbortedCompaction.status, 200);
141
+ await waitFor("aborted compaction_start state", async () => {
142
+ const state = await request(`/api/state?tab=${encodeURIComponent(tabId)}`);
143
+ return state.body?.data?.isCompacting === true ? state : false;
144
+ });
145
+
146
+ const queuedDuringAbortedCompaction = await request("/api/prompt", {
147
+ method: "POST",
148
+ body: { tab: tabId, message: ABORTED_RESUME_PROMPT, streamingBehavior: "steer" },
149
+ });
150
+ assert.equal(queuedDuringAbortedCompaction.status, 202);
151
+
152
+ await waitFor("queued prompt to resume after aborted compaction", async () => {
153
+ const messages = await request(`/api/messages?tab=${encodeURIComponent(tabId)}`);
154
+ const entries = messages.body?.data?.messages || [];
155
+ return entries.some((message) => String(message.content || "") === `prompt:${ABORTED_RESUME_PROMPT}`) ? messages : false;
156
+ }, { attempts: 80, intervalMs: 100 });
157
+
106
158
  await request("/api/shutdown", { method: "POST" }).catch(() => undefined);
107
159
  for (let attempt = 0; attempt < 50 && child.exitCode === null; attempt += 1) await delay(100);
108
160
  assert.notEqual(child.exitCode, null, "server should exit after /api/shutdown");
@@ -12,10 +12,10 @@ const [server, app] = await Promise.all([
12
12
  assert.match(server, /function maybeQueueCommandDuringCompaction\(tab, command\)[\s\S]*tab\?\.lastState\?\.isCompacting[\s\S]*enqueueCommandUntilCompactionEnds/, "server should queue prompt-like commands while the tab is compacting");
13
13
  assert.match(server, /url\.pathname === "\/api\/prompt" && req\.method === "POST"[\s\S]*maybeQueueCommandDuringCompaction\(tab, command\)[\s\S]*sendJson\(res, 202/, "POST /api/prompt should return 202 when a prompt is queued for post-compaction resume");
14
14
  assert.match(server, /if \(command\) \{[\s\S]*maybeQueueCommandDuringCompaction\(tab, command\)[\s\S]*sendJson\(res, 202/, "generic prompt-like POST commands should share the compaction queue path");
15
- assert.match(server, /event\?\.type === "compaction_end" && event\.aborted !== true\)[\s\S]*flushCompactionQueue\(tab, event\)/, "non-aborted compaction_end should flush the queued resume prompt");
16
- assert.match(server, /async function flushCompactionQueue\(tab, event = \{\}\)[\s\S]*queuedRetryCommand\(item\)/, "compaction queue flush should resume queued commands into active auto-retry runs");
15
+ assert.match(server, /event\?\.type === "compaction_end"\)[\s\S]*flushCompactionQueue\(tab, event\)/, "every compaction_end should flush queued prompts instead of stranding them after an abort");
16
+ assert.match(server, /async function flushCompactionQueue\(tab, event = \{\}\)[\s\S]*queuedRetryCommand\(item\)/, "compaction queue flush should preserve steering, follow-up, and slash-command delivery when joining an active run");
17
17
  assert.match(server, /async function flushCompactionQueue\(tab, event = \{\}\)[\s\S]*queuedPromptCommand\(item\)/, "compaction queue flush should start a new prompt when no run resumes automatically");
18
- assert.match(server, /async function flushCompactionQueue\(tab, event = \{\}\)[\s\S]*queuedStreamingCommand\(item\)/, "compaction queue flush should send later queued items as steering or follow-up messages");
18
+ assert.match(server, /function queuedRetryCommand\(item\)[\s\S]*queuedStreamingCommand\(item\)/, "post-compaction continuation should send later queued items as steering or follow-up messages");
19
19
  assert.match(server, /function stateWithPendingThinking\(tab, state\)[\s\S]*compactionQueueForTab\(tab\)\.length[\s\S]*pendingMessageCount/, "state responses should include Web UI compaction queue length while prompts wait to resume");
20
20
 
21
21
  assert.match(app, /function isRunActive\(\) \{\n\s+return !!currentState\?\.isStreaming \|\| !!currentState\?\.isCompacting/, "frontend should treat compaction as an active run for composer controls");
@@ -4,9 +4,11 @@
4
4
  import { createInterface } from "node:readline";
5
5
 
6
6
  const COMPACTION_TRIGGER = "__pi_webui_test_start_compaction__";
7
+ const ABORTED_COMPACTION_TRIGGER = "__pi_webui_test_start_aborted_compaction__";
7
8
 
8
9
  let isCompacting = false;
9
10
  let compactionTimer = null;
11
+ let compactionWillAbort = false;
10
12
  const received = [];
11
13
 
12
14
  function respond(payload) {
@@ -37,18 +39,21 @@ function statePayload() {
37
39
  function finishCompaction() {
38
40
  compactionTimer = null;
39
41
  isCompacting = false;
42
+ const aborted = compactionWillAbort;
43
+ compactionWillAbort = false;
40
44
  emit({
41
45
  type: "compaction_end",
42
46
  reason: "test",
43
- result: { summary: "fake compaction summary", tokensBefore: 1000, estimatedTokensAfter: 100 },
44
- aborted: false,
47
+ result: aborted ? null : { summary: "fake compaction summary", tokensBefore: 1000, estimatedTokensAfter: 100 },
48
+ aborted,
45
49
  willRetry: false,
46
50
  });
47
51
  }
48
52
 
49
- function startCompaction() {
53
+ function startCompaction({ aborted = false } = {}) {
50
54
  if (compactionTimer) clearTimeout(compactionTimer);
51
55
  isCompacting = true;
56
+ compactionWillAbort = aborted;
52
57
  emit({ type: "compaction_start", reason: "test" });
53
58
  compactionTimer = setTimeout(finishCompaction, 1500);
54
59
  }
@@ -91,8 +96,8 @@ rl.on("line", (line) => {
91
96
  return;
92
97
  case "prompt": {
93
98
  const message = String(command.message || "");
94
- if (message === COMPACTION_TRIGGER) {
95
- startCompaction();
99
+ if (message === COMPACTION_TRIGGER || message === ABORTED_COMPACTION_TRIGGER) {
100
+ startCompaction({ aborted: message === ABORTED_COMPACTION_TRIGGER });
96
101
  respond({ ...base, data: { compacting: true } });
97
102
  return;
98
103
  }