@firstpick/pi-package-webui 0.7.1 → 0.7.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/public/index.html CHANGED
@@ -620,6 +620,26 @@
620
620
  </div>
621
621
  </div>
622
622
  </section>
623
+ <section class="side-panel-section collapsed" data-side-panel-section="git">
624
+ <h2>
625
+ <button id="sidePanelSectionToggleGit" class="side-panel-section-toggle" type="button" aria-expanded="false" aria-controls="sidePanelSectionGit" aria-label="Expand Git section" title="Expand Git section" data-side-panel-section-toggle="git">
626
+ <span class="side-panel-section-label">Git</span>
627
+ <span class="side-panel-section-trailing">
628
+ <span id="gitPanelCountBadge" class="side-panel-section-badge" hidden>0</span>
629
+ <span class="side-panel-section-chevron" aria-hidden="true">›</span>
630
+ </span>
631
+ </button>
632
+ </h2>
633
+ <div id="sidePanelSectionGit" class="side-panel-section-content" hidden>
634
+ <div class="git-side-panel">
635
+ <div class="git-side-panel-intro">
636
+ <p>Expand a repository to view local changes and history. Right-click rows for actions.</p>
637
+ </div>
638
+ <p id="gitPanelStatus" class="git-side-panel-status muted" role="status" aria-live="polite"></p>
639
+ <div id="gitPanelGroups" class="git-side-panel-groups" aria-label="Git repositories"></div>
640
+ </div>
641
+ </div>
642
+ </section>
623
643
  <section class="side-panel-section collapsed" data-side-panel-section="optional-features">
624
644
  <h2>
625
645
  <button id="sidePanelSectionToggleOptionalFeatures" class="side-panel-section-toggle" type="button" aria-expanded="false" aria-controls="sidePanelSectionOptionalFeatures" aria-label="Expand Optional features section" title="Expand Optional features section" data-side-panel-section-toggle="optional-features">
@@ -686,7 +706,7 @@
686
706
  </button>
687
707
  </h2>
688
708
  <div id="sidePanelSectionSubagents" class="side-panel-section-content" hidden>
689
- <p class="subagents-help"><strong>How to use:</strong> Ask Pi to call the <code>subagent</code> tool in foreground or async mode—for example, “Use a subagent to review this change.” Only active runs launched through that tool appear here.</p>
709
+ <p class="subagents-help"><strong>How to use:</strong> Ask Pi to call <code>subagent</code> for ordinary delegation or <code>subagent_gate</code> when failed calls need bounded retries or a success quorum. Active children and retained gate attempts appear here.</p>
690
710
  <div class="subagent-open-mode-field">
691
711
  <label for="subagentOpenModeSelect">Open subagents in</label>
692
712
  <select id="subagentOpenModeSelect" aria-describedby="subagentOpenModeStatus">
@@ -754,6 +774,7 @@
754
774
  <button type="button" role="menuitem" data-file-menu-action="move">Move/Rename…</button>
755
775
  <button type="button" role="menuitem" class="danger" data-file-menu-action="delete">Delete…</button>
756
776
  </div>
777
+ <div id="gitPanelContextMenu" class="file-context-menu git-side-panel-context-menu" role="menu" aria-label="Git actions" hidden></div>
757
778
 
758
779
  <aside id="undoToast" class="undo-toast" aria-live="polite" aria-atomic="true" hidden>
759
780
  <span id="undoToastMessage" class="undo-toast-message"></span>
package/public/styles.css CHANGED
@@ -1230,6 +1230,325 @@ body.embedded-split .side-panel-backdrop {
1230
1230
  .side-panel-section-content[hidden] {
1231
1231
  display: none;
1232
1232
  }
1233
+ .git-side-panel {
1234
+ display: grid;
1235
+ gap: 0.55rem;
1236
+ min-width: 0;
1237
+ padding: 0.66rem;
1238
+ border: 1px solid rgba(180, 190, 254, 0.16);
1239
+ border-radius: 0.85rem;
1240
+ background: rgba(var(--ctp-crust-rgb), 0.46);
1241
+ box-shadow: inset 0 1px 0 rgba(255,255,255,0.035), 0 0 1rem rgba(166, 227, 161, 0.05);
1242
+ }
1243
+ .git-side-panel-intro p,
1244
+ .git-side-panel-status,
1245
+ .git-side-panel-empty,
1246
+ .git-side-panel-error {
1247
+ margin: 0;
1248
+ font-size: var(--text-xs);
1249
+ line-height: 1.45;
1250
+ }
1251
+ .git-side-panel-intro p { color: rgba(var(--ctp-subtext-rgb), 0.76); }
1252
+ .git-side-panel-error { color: var(--ctp-red); }
1253
+ .git-side-panel-empty.success { color: var(--ctp-green); }
1254
+ .git-side-panel-groups,
1255
+ .git-side-panel-terminal-body,
1256
+ .git-side-panel-repository-content,
1257
+ .git-side-panel-changes,
1258
+ .git-side-panel-history,
1259
+ .git-side-panel-tree,
1260
+ .git-side-panel-folder-body {
1261
+ display: grid;
1262
+ gap: 0.38rem;
1263
+ min-width: 0;
1264
+ }
1265
+ .git-side-panel-terminal-group,
1266
+ .git-side-panel-repository {
1267
+ overflow: hidden;
1268
+ min-width: 0;
1269
+ margin: 0;
1270
+ border: 1px solid rgba(180, 190, 254, 0.15);
1271
+ border-radius: 0.72rem;
1272
+ background: rgba(var(--ctp-mantle-rgb), 0.48);
1273
+ }
1274
+ .git-side-panel-terminal-summary,
1275
+ .git-side-panel-repository-toggle {
1276
+ display: flex;
1277
+ align-items: center;
1278
+ gap: 0.48rem;
1279
+ width: 100%;
1280
+ min-width: 0;
1281
+ min-height: 42px;
1282
+ padding: 0.48rem 0.56rem;
1283
+ color: var(--ctp-text);
1284
+ text-align: left;
1285
+ background: linear-gradient(100deg, rgba(137, 180, 250, 0.08), rgba(var(--ctp-crust-rgb), 0.36));
1286
+ }
1287
+ .git-side-panel-terminal-summary {
1288
+ cursor: pointer;
1289
+ list-style: none;
1290
+ }
1291
+ .git-side-panel-terminal-summary::-webkit-details-marker { display: none; }
1292
+ .git-side-panel-terminal-summary::before {
1293
+ content: "›";
1294
+ flex: 0 0 auto;
1295
+ color: var(--ctp-blue);
1296
+ font-size: 1rem;
1297
+ transition: transform 150ms ease;
1298
+ }
1299
+ .git-side-panel-terminal-group[open] > .git-side-panel-terminal-summary::before { transform: rotate(90deg); }
1300
+ .git-side-panel-terminal-summary:hover,
1301
+ .git-side-panel-terminal-summary:focus-visible,
1302
+ .git-side-panel-repository-toggle:hover,
1303
+ .git-side-panel-repository-toggle:focus-visible {
1304
+ color: var(--ctp-teal);
1305
+ background: linear-gradient(100deg, rgba(148, 226, 213, 0.12), rgba(var(--ctp-crust-rgb), 0.42));
1306
+ }
1307
+ .git-side-panel-terminal-copy,
1308
+ .git-side-panel-repository-copy {
1309
+ display: grid;
1310
+ flex: 1 1 auto;
1311
+ min-width: 0;
1312
+ gap: 0.08rem;
1313
+ }
1314
+ .git-side-panel-terminal-copy strong,
1315
+ .git-side-panel-repository-copy strong {
1316
+ overflow: hidden;
1317
+ font-size: 0.78rem;
1318
+ text-overflow: ellipsis;
1319
+ white-space: nowrap;
1320
+ }
1321
+ .git-side-panel-terminal-copy span,
1322
+ .git-side-panel-repository-copy span,
1323
+ .git-side-panel-repository-path,
1324
+ .git-side-panel-repository-state {
1325
+ overflow: hidden;
1326
+ color: rgba(var(--ctp-subtext-rgb), 0.66);
1327
+ font-size: var(--text-xs);
1328
+ text-overflow: ellipsis;
1329
+ white-space: nowrap;
1330
+ }
1331
+ .git-side-panel-terminal-count,
1332
+ .git-side-panel-repository-count,
1333
+ .git-side-panel-folder-count {
1334
+ flex: 0 0 auto;
1335
+ color: rgba(var(--ctp-subtext-rgb), 0.72);
1336
+ font-size: var(--text-xs);
1337
+ }
1338
+ .git-side-panel-terminal-body {
1339
+ padding: 0.42rem;
1340
+ border-top: 1px solid rgba(180, 190, 254, 0.12);
1341
+ }
1342
+ .git-side-panel-repository.unavailable {
1343
+ display: grid;
1344
+ gap: 0.08rem;
1345
+ padding: 0.48rem 0.56rem;
1346
+ opacity: 0.78;
1347
+ }
1348
+ .git-side-panel-repository.unavailable.loading { opacity: 1; }
1349
+ .git-side-panel-repository-toggle {
1350
+ appearance: none;
1351
+ border: 0;
1352
+ border-radius: 0;
1353
+ }
1354
+ .git-side-panel-repository-chevron {
1355
+ flex: 0 0 auto;
1356
+ color: var(--ctp-green);
1357
+ font-size: 1rem;
1358
+ transition: transform 150ms ease;
1359
+ }
1360
+ .git-side-panel-repository.expanded > .git-side-panel-repository-toggle .git-side-panel-repository-chevron { transform: rotate(90deg); }
1361
+ .git-side-panel-repository-content {
1362
+ padding: 0.48rem;
1363
+ border-top: 1px solid rgba(180, 190, 254, 0.12);
1364
+ background: rgba(var(--ctp-crust-rgb), 0.28);
1365
+ }
1366
+ .git-side-panel-tabs {
1367
+ display: flex;
1368
+ align-items: center;
1369
+ gap: 0.28rem;
1370
+ min-width: 0;
1371
+ }
1372
+ .git-side-panel-tabs {
1373
+ padding: 0.2rem;
1374
+ border: 1px solid rgba(180, 190, 254, 0.14);
1375
+ border-radius: 0.58rem;
1376
+ background: rgba(var(--ctp-mantle-rgb), 0.42);
1377
+ }
1378
+ .git-side-panel-tab {
1379
+ flex: 1 1 0;
1380
+ min-width: 0;
1381
+ min-height: 34px;
1382
+ padding: 0.26rem 0.42rem;
1383
+ color: rgba(var(--ctp-subtext-rgb), 0.78);
1384
+ border-color: transparent;
1385
+ background: transparent;
1386
+ font-size: var(--text-xs);
1387
+ }
1388
+ .git-side-panel-tab[aria-selected="true"] {
1389
+ color: var(--ctp-text);
1390
+ border-color: rgba(166, 227, 161, 0.34);
1391
+ background: rgba(166, 227, 161, 0.10);
1392
+ }
1393
+ .git-side-panel-repository-meta {
1394
+ display: flex;
1395
+ align-items: center;
1396
+ justify-content: space-between;
1397
+ gap: 0.5rem;
1398
+ min-width: 0;
1399
+ padding: 0.26rem 0.36rem;
1400
+ color: rgba(var(--ctp-subtext-rgb), 0.66);
1401
+ font-size: var(--text-xs);
1402
+ }
1403
+ .git-side-panel-repository-meta strong {
1404
+ min-width: 0;
1405
+ overflow: hidden;
1406
+ color: var(--ctp-green);
1407
+ font-size: var(--text-xs);
1408
+ text-overflow: ellipsis;
1409
+ white-space: nowrap;
1410
+ }
1411
+ .git-side-panel-repository-meta span {
1412
+ flex: 0 0 auto;
1413
+ overflow: hidden;
1414
+ text-overflow: ellipsis;
1415
+ white-space: nowrap;
1416
+ }
1417
+ .git-side-panel-tree-section {
1418
+ overflow: hidden;
1419
+ border: 1px solid rgba(180, 190, 254, 0.13);
1420
+ border-radius: 0.58rem;
1421
+ background: rgba(var(--ctp-mantle-rgb), 0.34);
1422
+ }
1423
+ .git-side-panel-tree-section.conflicted { border-color: rgba(243, 139, 168, 0.32); }
1424
+ .git-side-panel-tree-section.staged { border-color: rgba(166, 227, 161, 0.25); }
1425
+ .git-side-panel-tree-heading {
1426
+ display: flex;
1427
+ justify-content: space-between;
1428
+ gap: 0.4rem;
1429
+ padding: 0.34rem 0.42rem;
1430
+ color: var(--ctp-subtext1);
1431
+ border-bottom: 1px solid rgba(180, 190, 254, 0.1);
1432
+ font-size: var(--text-xs);
1433
+ text-transform: uppercase;
1434
+ letter-spacing: 0.08em;
1435
+ }
1436
+ .git-side-panel-tree {
1437
+ gap: 0;
1438
+ padding: 0.2rem 0;
1439
+ }
1440
+ .git-side-panel-folder {
1441
+ min-width: 0;
1442
+ margin: 0;
1443
+ border: 0;
1444
+ }
1445
+ .git-side-panel-folder-summary {
1446
+ display: flex;
1447
+ align-items: center;
1448
+ gap: 0.3rem;
1449
+ min-height: 30px;
1450
+ padding: 0.16rem 0.34rem;
1451
+ color: var(--ctp-subtext1);
1452
+ cursor: pointer;
1453
+ font-size: 0.7rem;
1454
+ list-style: none;
1455
+ }
1456
+ .git-side-panel-folder-summary::-webkit-details-marker { display: none; }
1457
+ .git-side-panel-folder-chevron {
1458
+ flex: 0 0 auto;
1459
+ color: var(--ctp-blue);
1460
+ font-size: 0.95rem;
1461
+ line-height: 1;
1462
+ transform: rotate(0deg);
1463
+ transition: transform 150ms ease;
1464
+ }
1465
+ .git-side-panel-folder[open] > .git-side-panel-folder-summary > .git-side-panel-folder-chevron { transform: rotate(90deg); }
1466
+ .git-side-panel-folder-name {
1467
+ flex: 1 1 auto;
1468
+ min-width: 0;
1469
+ overflow: hidden;
1470
+ text-overflow: ellipsis;
1471
+ white-space: nowrap;
1472
+ }
1473
+ .git-side-panel-folder-body {
1474
+ gap: 0;
1475
+ margin-left: 0.58rem;
1476
+ padding-left: 0.3rem;
1477
+ border-left: 1px solid rgba(180, 190, 254, 0.14);
1478
+ }
1479
+ .git-side-panel-file {
1480
+ display: grid;
1481
+ grid-template-columns: 1.3rem minmax(5rem, 1fr) auto;
1482
+ align-items: center;
1483
+ gap: 0.26rem;
1484
+ min-width: 0;
1485
+ min-height: 30px;
1486
+ padding: 0.14rem 0.3rem;
1487
+ border-radius: 0.36rem;
1488
+ font-size: var(--text-xs);
1489
+ cursor: context-menu;
1490
+ }
1491
+ .git-side-panel-file:hover,
1492
+ .git-side-panel-file:focus-visible { background: rgba(137, 180, 250, 0.10); }
1493
+ .git-side-panel-file-status {
1494
+ color: var(--ctp-yellow);
1495
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
1496
+ font-size: var(--text-xs);
1497
+ text-align: center;
1498
+ }
1499
+ .git-side-panel-file.staged .git-side-panel-file-status { color: var(--ctp-green); }
1500
+ .git-side-panel-file.conflicted .git-side-panel-file-status { color: var(--ctp-red); }
1501
+ .git-side-panel-file.untracked .git-side-panel-file-status { color: var(--ctp-teal); }
1502
+ .git-side-panel-file-name {
1503
+ min-width: 0;
1504
+ overflow: hidden;
1505
+ text-overflow: ellipsis;
1506
+ white-space: nowrap;
1507
+ }
1508
+ .git-side-panel-file-stats {
1509
+ color: var(--ctp-green);
1510
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
1511
+ font-size: var(--text-xs);
1512
+ white-space: nowrap;
1513
+ }
1514
+ .git-side-panel-context-label {
1515
+ max-width: 18rem;
1516
+ padding: 0.34rem 0.5rem;
1517
+ overflow: hidden;
1518
+ color: rgba(var(--ctp-subtext-rgb), 0.72);
1519
+ border-bottom: 1px solid rgba(180, 190, 254, 0.14);
1520
+ font-size: var(--text-xs);
1521
+ font-weight: 800;
1522
+ text-overflow: ellipsis;
1523
+ white-space: nowrap;
1524
+ }
1525
+ .git-side-panel-context-menu button.danger { color: var(--ctp-red); }
1526
+ .git-side-panel-commit {
1527
+ display: grid;
1528
+ grid-template-columns: auto minmax(0, 1fr);
1529
+ gap: 0.12rem 0.42rem;
1530
+ min-width: 0;
1531
+ padding: 0.42rem;
1532
+ color: var(--ctp-text);
1533
+ text-align: left;
1534
+ border-color: rgba(180, 190, 254, 0.14);
1535
+ background: rgba(var(--ctp-mantle-rgb), 0.38);
1536
+ }
1537
+ .git-side-panel-commit:hover,
1538
+ .git-side-panel-commit:focus-visible { border-color: rgba(137, 180, 250, 0.42); background: rgba(137, 180, 250, 0.08); }
1539
+ .git-side-panel-commit-hash { color: var(--ctp-blue); font-size: var(--text-xs); }
1540
+ .git-side-panel-commit-subject {
1541
+ min-width: 0;
1542
+ overflow: hidden;
1543
+ font-size: var(--text-xs);
1544
+ text-overflow: ellipsis;
1545
+ white-space: nowrap;
1546
+ }
1547
+ .git-side-panel-commit-meta {
1548
+ grid-column: 1 / -1;
1549
+ color: rgba(var(--ctp-subtext-rgb), 0.66);
1550
+ font-size: var(--text-xs);
1551
+ }
1233
1552
  .file-tree-panel {
1234
1553
  display: grid;
1235
1554
  gap: 0.58rem;
@@ -2208,6 +2527,75 @@ body.embedded-split .side-panel-backdrop {
2208
2527
  line-height: 1.35;
2209
2528
  overflow-wrap: anywhere;
2210
2529
  }
2530
+ .subagent-gate-card {
2531
+ display: grid;
2532
+ gap: 0.48rem;
2533
+ min-width: 0;
2534
+ padding: 0.54rem;
2535
+ border: 1px solid rgba(137, 180, 250, 0.22);
2536
+ border-radius: 0.68rem;
2537
+ background: rgba(137, 180, 250, 0.06);
2538
+ }
2539
+ .subagent-gate-card.satisfied { border-color: rgba(166, 227, 161, 0.38); }
2540
+ .subagent-gate-card.failed,
2541
+ .subagent-gate-card.cancelled { border-color: rgba(243, 139, 168, 0.38); }
2542
+ .subagent-gate-header {
2543
+ display: flex;
2544
+ align-items: flex-start;
2545
+ justify-content: space-between;
2546
+ gap: 0.5rem;
2547
+ }
2548
+ .subagent-gate-title {
2549
+ display: grid;
2550
+ gap: 0.08rem;
2551
+ min-width: 0;
2552
+ }
2553
+ .subagent-gate-title strong { color: var(--ctp-text); font-size: 0.75rem; }
2554
+ .subagent-gate-title span { color: rgba(var(--ctp-subtext-rgb), 0.72); font-size: var(--text-xs); }
2555
+ .subagent-gate-status {
2556
+ flex: 0 0 auto;
2557
+ padding: 0.08rem 0.34rem;
2558
+ border-radius: 999px;
2559
+ color: var(--ctp-blue);
2560
+ background: rgba(137, 180, 250, 0.12);
2561
+ font-size: var(--text-xs);
2562
+ font-weight: 850;
2563
+ }
2564
+ .subagent-gate-status.satisfied { color: var(--ctp-green); background: rgba(166, 227, 161, 0.12); }
2565
+ .subagent-gate-status.failed,
2566
+ .subagent-gate-status.cancelled { color: var(--ctp-red); background: rgba(243, 139, 168, 0.12); }
2567
+ .subagent-gate-attempts { display: grid; gap: 0.32rem; }
2568
+ .subagent-gate-attempt {
2569
+ display: grid;
2570
+ grid-template-columns: auto minmax(0, 1fr);
2571
+ gap: 0.4rem;
2572
+ padding: 0.38rem;
2573
+ border-radius: 0.5rem;
2574
+ background: rgba(var(--ctp-surface-rgb), 0.16);
2575
+ }
2576
+ .subagent-gate-attempt-marker {
2577
+ width: 0.48rem;
2578
+ height: 0.48rem;
2579
+ margin-top: 0.18rem;
2580
+ border-radius: 999px;
2581
+ background: var(--ctp-blue);
2582
+ }
2583
+ .subagent-gate-attempt.running .subagent-gate-attempt-marker,
2584
+ .subagent-gate-attempt.launching .subagent-gate-attempt-marker { animation: subagent-running-pulse 1.35s ease-in-out infinite; }
2585
+ .subagent-gate-attempt.succeeded .subagent-gate-attempt-marker { background: var(--ctp-green); }
2586
+ .subagent-gate-attempt.failed .subagent-gate-attempt-marker,
2587
+ .subagent-gate-attempt.not-qualifying .subagent-gate-attempt-marker,
2588
+ .subagent-gate-attempt.cancelled .subagent-gate-attempt-marker { background: var(--ctp-red); }
2589
+ .subagent-gate-attempt-content { display: grid; gap: 0.08rem; min-width: 0; }
2590
+ .subagent-gate-attempt-content strong { color: rgba(var(--ctp-text-rgb), 0.92); font-size: 0.7rem; }
2591
+ .subagent-gate-attempt-meta,
2592
+ .subagent-gate-attempt-error {
2593
+ color: rgba(var(--ctp-subtext-rgb), 0.68);
2594
+ font-size: var(--text-xs);
2595
+ line-height: 1.35;
2596
+ overflow-wrap: anywhere;
2597
+ }
2598
+ .subagent-gate-attempt-error { color: var(--ctp-red); }
2211
2599
  @keyframes subagent-running-pulse {
2212
2600
  0%, 100% { opacity: 0.58; transform: scale(0.86); }
2213
2601
  50% { opacity: 1; transform: scale(1); }
@@ -259,6 +259,8 @@ function handleWebuiHelperPrompt(command, base) {
259
259
  status: "running",
260
260
  currentTool: "read",
261
261
  currentToolArgs: "README.md",
262
+ model: "anthropic/claude-opus-4-8:high",
263
+ thinking: "high",
262
264
  recentTools: [{ tool: "grep", args: "Subagents", endMs: Date.now() - 200 }],
263
265
  recentOutput: ["Inspecting current implementation", "Waiting for the next tool result"],
264
266
  transcript: [
@@ -333,15 +335,30 @@ function handleTransportFixturePrompt(command, base) {
333
335
  function handleSubagentFixturePrompt(command, base) {
334
336
  const message = String(command.message || "").trim();
335
337
  if (message !== "fixture subagents running" && message !== "fixture subagents clear") return false;
336
- const runs = message.endsWith("clear") ? [] : [{
338
+ const clearing = message.endsWith("clear");
339
+ const runs = clearing ? [] : [{
337
340
  id: "fixture-run",
338
341
  source: "async",
339
342
  mode: "parallel",
340
343
  status: "running",
341
344
  startedAt: Date.now() - 2500,
342
345
  agents: [
343
- { id: "fixture-run:0", name: "reviewer", status: "running", index: 0, currentTool: "read", nested: false },
344
- { id: "fixture-run:1", name: "scout", status: "running", index: 1, nested: false },
346
+ { id: "fixture-run:0", name: "reviewer", status: "running", index: 0, currentTool: "read", model: "anthropic/claude-opus-4-8:high", thinking: "high", nested: false },
347
+ { id: "fixture-run:1", name: "scout", status: "running", index: 1, model: "openai-codex/gpt-5.6-sol", thinking: "high", nested: false },
348
+ ],
349
+ }];
350
+ const gates = clearing ? [] : [{
351
+ version: 1,
352
+ id: "fixture-gate",
353
+ status: "running",
354
+ requiredSuccesses: 2,
355
+ qualifyingSuccesses: 1,
356
+ requireDistinctProviders: true,
357
+ startedAt: Date.now() - 3000,
358
+ updatedAt: Date.now(),
359
+ attempts: [
360
+ { id: "fixture-gate:0:1", taskIndex: 0, attempt: 1, maxAttempts: 2, agent: "reviewer", retrySafety: "read-only", runId: "fixture-review-1", model: "anthropic/claude-opus-4-8", provider: "anthropic", status: "succeeded" },
361
+ { id: "fixture-gate:1:1", taskIndex: 1, attempt: 1, maxAttempts: 2, agent: "reviewer", retrySafety: "read-only", runId: "fixture-review-2", model: "openrouter/moonshotai/kimi-k3", provider: "openrouter", status: "failed", failureKind: "transient-provider", error: "provider overloaded" },
345
362
  ],
346
363
  }];
347
364
  respond({ ...base, data: { output: "fake subagent status emitted" } });
@@ -350,7 +367,7 @@ function handleSubagentFixturePrompt(command, base) {
350
367
  id: randomUUID(),
351
368
  method: "setStatus",
352
369
  statusKey: "webui-subagents",
353
- statusText: `PI_WEBUI_SUBAGENTS_V1 ${JSON.stringify({ version: 1, available: true, updatedAt: Date.now(), runs })}`,
370
+ statusText: `PI_WEBUI_SUBAGENTS_V1 ${JSON.stringify({ version: 1, available: true, updatedAt: Date.now(), runs, gates })}`,
354
371
  });
355
372
  return true;
356
373
  }
@@ -0,0 +1,43 @@
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 = await readFile(join(root, "public", "app.js"), "utf8");
8
+
9
+ function functionBody(name) {
10
+ const start = app.indexOf(`function ${name}(`);
11
+ assert.notEqual(start, -1, `${name} should be defined`);
12
+ const next = app.indexOf("\nfunction ", start + 1);
13
+ return app.slice(start, next === -1 ? app.length : next);
14
+ }
15
+
16
+ const renderGitPanel = functionBody("renderGitPanel");
17
+ const renderGitPanelFolder = functionBody("renderGitPanelFolder");
18
+ const renderContextMeter = functionBody("renderContextMeter");
19
+ const renderWorkspaceDashboard = functionBody("renderWorkspaceDashboard");
20
+
21
+ assert.match(app, /openFolders: new Map\(\)/, "Git panel state should persist folder toggles");
22
+ assert.match(renderGitPanelFolder, /const defaultOpen = depth === 0;/, "folder rendering should retain depth-based defaults");
23
+ assert.match(renderGitPanelFolder, /details\.open = gitPanelState\.openFolders\.has\(folderKey\) \? gitPanelState\.openFolders\.get\(folderKey\) : defaultOpen;/, "folder rendering should prefer a stored override over its default");
24
+ assert.match(renderGitPanelFolder, /if \(details\.open === defaultOpen\) gitPanelState\.openFolders\.delete\(folderKey\);/, "folder toggles back to the default should remove the override");
25
+ assert.match(renderGitPanelFolder, /else gitPanelState\.openFolders\.set\(folderKey, details\.open\);/, "folder toggles away from the default should store an override");
26
+ assert.match(renderGitPanel, /gitPanelState\.openFolders\.keys\(\)/, "folder state for removed roots should be pruned");
27
+ assert.doesNotMatch(renderGitPanel, /\bsectionExpanded\b/, "Git panel signature should not include the always-true section state");
28
+
29
+ const gitGuard = renderGitPanel.indexOf("signature === gitPanelRenderSignature");
30
+ const gitRebuild = renderGitPanel.indexOf("elements.gitPanelGroups.replaceChildren");
31
+ assert.ok(gitGuard > 0 && gitGuard < gitRebuild, "Git panel signature guard should precede its DOM rebuild");
32
+ assert.match(renderGitPanel, /snapshot\?\.loadedAt/, "Git panel signature should include repository snapshot versions");
33
+ assert.match(renderGitPanel, /gitPanelState\.activeViews\.get/, "Git panel signature should include active repository views");
34
+
35
+ const contextGuard = renderContextMeter.indexOf("signature === contextMeterSignature");
36
+ const contextRebuild = renderContextMeter.lastIndexOf("root.replaceChildren");
37
+ assert.ok(contextGuard > 0 && contextGuard < contextRebuild, "context meter signature guard should precede its DOM rebuild");
38
+
39
+ const dashboardGuard = renderWorkspaceDashboard.indexOf("signature === workspaceDashboardSignature");
40
+ const dashboardRebuild = renderWorkspaceDashboard.indexOf("root.replaceChildren");
41
+ assert.ok(dashboardGuard > 0 && dashboardGuard < dashboardRebuild, "workspace dashboard signature guard should precede its DOM rebuild");
42
+
43
+ console.log("git-panel-render-stability-static.test.mjs passed");
@@ -425,11 +425,17 @@ try {
425
425
  assert.equal(subagentsResponse.body?.data?.totalAgents, 2, "subagent overview should count all running agents");
426
426
  assert.equal(subagentsResponse.body?.data?.tabs?.[0]?.tabId, tabId, "subagent overview should group agents under their terminal tab");
427
427
  assert.deepEqual(subagentsResponse.body?.data?.tabs?.[0]?.runs?.[0]?.agents?.map((agent) => agent.name), ["reviewer", "scout"], "subagent overview should preserve agent order within the session run");
428
+ assert.deepEqual(subagentsResponse.body?.data?.tabs?.[0]?.runs?.[0]?.agents?.map((agent) => [agent.model, agent.thinking]), [["anthropic/claude-opus-4-8:high", "high"], ["openai-codex/gpt-5.6-sol", "high"]], "subagent overview should preserve bounded model and reasoning metadata");
429
+ assert.equal(subagentsResponse.body?.data?.totalGates, 1, "subagent overview should expose retry gates independently from running children");
430
+ assert.equal(subagentsResponse.body?.data?.tabs?.[0]?.gates?.[0]?.qualifyingSuccesses, 1, "retry gate quorum should be normalized");
431
+ assert.deepEqual(subagentsResponse.body?.data?.tabs?.[0]?.gates?.[0]?.attempts?.map((attempt) => [attempt.status, attempt.failureKind]), [["succeeded", undefined], ["failed", "transient-provider"]], "retry gate attempts should preserve bounded status and failure classification");
428
432
  const subagentOutputResponse = await request("127.0.0.1", `/api/subagents/output?tab=${encodeURIComponent(tabId)}&run=${encodeURIComponent("fixture-run")}&agent=${encodeURIComponent("fixture-run:0")}`);
429
433
  assert.equal(subagentOutputResponse.status, 200, "running subagent output endpoint should respond");
430
434
  assert.equal(subagentOutputResponse.body?.data?.agent?.name, "reviewer", "subagent output should target the selected child agent");
431
435
  assert.deepEqual(subagentOutputResponse.body?.data?.agent?.recentOutput, ["Inspecting current implementation", "Waiting for the next tool result"], "subagent output should preserve bounded live output lines");
432
436
  assert.equal(subagentOutputResponse.body?.data?.agent?.currentToolArgs, "README.md", "subagent output should include current tool state");
437
+ assert.equal(subagentOutputResponse.body?.data?.agent?.model, "anthropic/claude-opus-4-8:high", "subagent output should preserve the effective model");
438
+ assert.equal(subagentOutputResponse.body?.data?.agent?.thinking, "high", "subagent output should preserve the effective reasoning effort");
433
439
  assert.deepEqual(subagentOutputResponse.body?.data?.agent?.transcript, [
434
440
  {
435
441
  role: "assistant",
@@ -459,6 +465,7 @@ try {
459
465
  await delay(50);
460
466
  }
461
467
  assert.equal(subagentsResponse.body?.data?.totalAgents, 0, "completed subagents should disappear from the running overview");
468
+ assert.equal(subagentsResponse.body?.data?.totalGates, 0, "cleared retry gates should disappear from the overview");
462
469
 
463
470
  const state = await request("127.0.0.1", `/api/state?tab=${encodeURIComponent(tabId)}`);
464
471
  assert.equal(state.status, 200);
@@ -836,11 +843,55 @@ try {
836
843
  await writeFile(path.join(stagingRepo, "file.txt"), "modified\n");
837
844
  await writeFile(path.join(stagingRepo, "loose.txt"), "loose\n");
838
845
 
846
+ const gitRoot = await request("127.0.0.1", `/api/git-root?tab=${encodeURIComponent(stagingTab)}`);
847
+ assert.equal(gitRoot.body?.ok, true, "git-root endpoint should discover the tab repository");
848
+ assert.equal(gitRoot.body?.data?.root, stagingRepo, "git-root should return the canonical fixture root");
849
+
850
+ const gitPanel = await request("127.0.0.1", `/api/git-panel?tab=${encodeURIComponent(stagingTab)}`);
851
+ assert.equal(gitPanel.body?.ok, true, "git-panel endpoint should return compact local status and history");
852
+ assert.equal(gitPanel.body?.data?.root, stagingRepo);
853
+ assert.equal(gitPanel.body?.data?.history?.length, 1, "git-panel should include the bounded recent commit history");
854
+ assert.equal(gitPanel.body?.data?.history?.[0]?.subject, "base");
855
+ const modifiedPanelEntry = gitPanel.body?.data?.changes?.find((entry) => entry.path === "file.txt");
856
+ assert.equal(modifiedPanelEntry?.unstaged, true, "git-panel should classify modified tracked files");
857
+ assert.equal(modifiedPanelEntry?.additions, 1, "git-panel should report unstaged additions from numstat");
858
+ assert.equal(modifiedPanelEntry?.deletions, 1, "git-panel should report unstaged deletions from numstat");
859
+ assert.equal(gitPanel.body?.data?.changes?.find((entry) => entry.path === "loose.txt")?.untracked, true, "git-panel should classify untracked files");
860
+ assert.equal(Object.prototype.hasOwnProperty.call(gitPanel.body?.data?.changes?.[0] || {}, "content"), false, "compact git-panel entries must not include file contents");
861
+
862
+ const fixtureHead = runGitFixture(["rev-parse", "HEAD"], stagingRepo, "staging fixture should expose its full HEAD hash");
863
+ const gitPanelCommit = await request("127.0.0.1", `/api/git-commit?tab=${encodeURIComponent(stagingTab)}&hash=${encodeURIComponent(fixtureHead)}`);
864
+ assert.equal(gitPanelCommit.body?.ok, true, "git-commit endpoint should return a bounded read-only commit diff");
865
+ assert.equal(gitPanelCommit.body?.data?.commit?.hash, fixtureHead);
866
+ assert.match(gitPanelCommit.body?.data?.sections?.[0]?.diff || "", /diff --git a\/file\.txt b\/file\.txt/, "git-commit should include the selected commit patch");
867
+ const invalidCommit = await request("127.0.0.1", `/api/git-commit?tab=${encodeURIComponent(stagingTab)}&hash=HEAD`);
868
+ assert.equal(invalidCommit.status, 400, "git-commit should reject symbolic or abbreviated revisions");
869
+
870
+ const stageAll = await request("127.0.0.1", "/api/git-changes/stage-all", { method: "POST", body: { tab: stagingTab } });
871
+ assert.equal(stageAll.body?.ok, true, "stage-all endpoint should stage the selected repository");
872
+ const stagedPanel = await request("127.0.0.1", `/api/git-panel?tab=${encodeURIComponent(stagingTab)}`);
873
+ assert.equal(stagedPanel.body?.data?.summary?.staged, 2, "stage-all should stage tracked and untracked changes");
874
+ const unstageAll = await request("127.0.0.1", "/api/git-changes/unstage-all", { method: "POST", body: { tab: stagingTab } });
875
+ assert.equal(unstageAll.body?.ok, true, "unstage-all endpoint should clear the selected repository index");
876
+ const unstagedPanel = await request("127.0.0.1", `/api/git-panel?tab=${encodeURIComponent(stagingTab)}`);
877
+ assert.equal(unstagedPanel.body?.data?.summary?.staged, 0, "unstage-all should leave no staged changes");
878
+ assert.equal(unstagedPanel.body?.data?.changes?.find((entry) => entry.path === "loose.txt")?.untracked, true, "unstage-all should restore newly added files to untracked state");
879
+
839
880
  const stageFile = await request("127.0.0.1", "/api/git-changes/stage-file", { method: "POST", body: { tab: stagingTab, path: "file.txt" } });
840
881
  assert.equal(stageFile.status, 200);
841
882
  assert.equal(stageFile.body?.ok, true, "stage-file endpoint should stage a modified file");
842
883
  assert.equal(stageFile.body?.data?.changes?.summary?.staged, 1, "stage-file should report one staged file afterwards");
843
884
 
885
+ await writeFile(path.join(stagingRepo, "file.txt"), "modified again\n");
886
+ const mixedPanel = await request("127.0.0.1", `/api/git-panel?tab=${encodeURIComponent(stagingTab)}`);
887
+ const mixedEntry = mixedPanel.body?.data?.changes?.find((entry) => entry.path === "file.txt");
888
+ assert.equal(mixedEntry?.staged, true, "mixed index/worktree files should remain staged");
889
+ assert.equal(mixedEntry?.unstaged, true, "mixed index/worktree files should also remain unstaged");
890
+ assert.equal(mixedEntry?.stagedAdditions, 1, "Git panel should preserve staged additions separately");
891
+ assert.equal(mixedEntry?.stagedDeletions, 1, "Git panel should preserve staged deletions separately");
892
+ assert.equal(mixedEntry?.unstagedAdditions, 1, "Git panel should preserve unstaged additions separately");
893
+ assert.equal(mixedEntry?.unstagedDeletions, 1, "Git panel should preserve unstaged deletions separately");
894
+
844
895
  const unstageFile = await request("127.0.0.1", "/api/git-changes/unstage-file", { method: "POST", body: { tab: stagingTab, path: "file.txt" } });
845
896
  assert.equal(unstageFile.status, 200);
846
897
  assert.equal(unstageFile.body?.ok, true, "unstage-file endpoint should unstage the file");