@firstpick/pi-package-webui 0.7.0 → 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/index.html CHANGED
@@ -83,6 +83,26 @@
83
83
  </header>
84
84
  <section id="workspaceDashboard" class="workspace-dashboard" aria-label="Workspace dashboard"></section>
85
85
  <div id="widgetArea" class="widget-area"></div>
86
+ <section id="subagentTerminalView" class="subagent-terminal-view" aria-labelledby="subagentTerminalTitle" hidden>
87
+ <header class="subagent-terminal-header">
88
+ <div class="subagent-terminal-heading">
89
+ <span class="subagent-terminal-kicker">Subagent · view only</span>
90
+ <strong id="subagentTerminalTitle">Subagent</strong>
91
+ <span id="subagentTerminalMeta" class="subagent-terminal-meta muted"></span>
92
+ </div>
93
+ <div class="subagent-terminal-actions">
94
+ <button id="subagentTerminalCopyButton" type="button">Copy output</button>
95
+ <button id="subagentTerminalRefreshButton" type="button">Refresh</button>
96
+ </div>
97
+ </header>
98
+ <div id="subagentTerminalTranscript" class="subagent-terminal-transcript" role="log" aria-live="polite"></div>
99
+ <p id="subagentTerminalStatus" class="subagent-terminal-status muted" aria-live="off"></p>
100
+ <div class="subagent-terminal-composer" aria-label="Subagent input unavailable">
101
+ <textarea id="subagentTerminalInput" rows="1" placeholder="View only — send messages from the parent terminal" aria-describedby="subagentTerminalInputHint" disabled></textarea>
102
+ <button type="button" disabled>View only</button>
103
+ <small id="subagentTerminalInputHint">This tab mirrors the child session. Use its parent terminal to interact with the run.</small>
104
+ </div>
105
+ </section>
86
106
  <div id="chatSearchBar" class="chat-search-bar" role="search" hidden>
87
107
  <input id="chatSearchInput" class="chat-search-input" type="search" placeholder="Search transcript…" autocomplete="off" spellcheck="false" aria-label="Search transcript" />
88
108
  <span id="chatSearchCount" class="chat-search-count muted" aria-live="polite"></span>
@@ -667,6 +687,14 @@
667
687
  </h2>
668
688
  <div id="sidePanelSectionSubagents" class="side-panel-section-content" hidden>
669
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>
690
+ <div class="subagent-open-mode-field">
691
+ <label for="subagentOpenModeSelect">Open subagents in</label>
692
+ <select id="subagentOpenModeSelect" aria-describedby="subagentOpenModeStatus">
693
+ <option value="overlay">Overlay</option>
694
+ <option value="tab">Tab / terminal</option>
695
+ </select>
696
+ <span id="subagentOpenModeStatus" class="muted">Overlay · saved in this browser</span>
697
+ </div>
670
698
  <p id="subagentsStatus" class="subagents-status muted" role="status" aria-live="polite">Checking running subagents…</p>
671
699
  <div id="subagentsBox" class="subagents-box muted">Checking running subagents…</div>
672
700
  </div>
@@ -768,6 +796,28 @@
768
796
  </form>
769
797
  </dialog>
770
798
 
799
+ <dialog id="gitWorktreeBaseDialog" class="extension-dialog git-worktree-base-dialog">
800
+ <form method="dialog">
801
+ <h2>Choose branch starting point</h2>
802
+ <p>Create <code id="gitWorktreeBaseBranch"></code> from:</p>
803
+ <fieldset class="git-worktree-base-options">
804
+ <legend class="sr-only">Branch starting point</legend>
805
+ <label class="git-worktree-base-option" for="gitWorktreeBaseOriginMain">
806
+ <input id="gitWorktreeBaseOriginMain" type="radio" name="gitWorktreeBase" value="origin/main" checked />
807
+ <span><strong>origin/main</strong><small>Default. Start from the remote-tracking main branch.</small></span>
808
+ </label>
809
+ <label class="git-worktree-base-option" for="gitWorktreeBaseCurrentHead">
810
+ <input id="gitWorktreeBaseCurrentHead" type="radio" name="gitWorktreeBase" value="HEAD" />
811
+ <span><strong>Current workspace HEAD</strong><small>Start from the commit currently checked out in this Pi tab. Uncommitted files are not part of the branch base.</small></span>
812
+ </label>
813
+ </fieldset>
814
+ <menu>
815
+ <button id="gitWorktreeBaseCancelButton" type="button">Cancel</button>
816
+ <button id="gitWorktreeBaseCreateButton" class="primary" type="button">Create worktree</button>
817
+ </menu>
818
+ </form>
819
+ </dialog>
820
+
771
821
  <dialog id="extensionDialog" class="extension-dialog">
772
822
  <form id="dialogForm" method="dialog">
773
823
  <h2 id="dialogTitle">Pi request</h2>
package/public/styles.css CHANGED
@@ -2032,6 +2032,33 @@ body.embedded-split .side-panel-backdrop {
2032
2032
  .subagents-help code {
2033
2033
  color: var(--ctp-teal);
2034
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
+ }
2035
2062
  .subagents-status {
2036
2063
  margin: 0 0 0.48rem;
2037
2064
  font-size: var(--text-xs);
@@ -2938,6 +2965,30 @@ body.embedded-split .side-panel-backdrop {
2938
2965
  text-transform: uppercase;
2939
2966
  animation: terminal-tab-app-runner-pulse 1.5s ease-in-out infinite;
2940
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
+ }
2941
2992
  .terminal-tab-workflow-indicator {
2942
2993
  flex: 0 0 auto;
2943
2994
  padding: 0.04rem 0.36rem;
@@ -3273,6 +3324,7 @@ body.embedded-split .side-panel-backdrop {
3273
3324
  }
3274
3325
  body.terminal-tabs-left .workspace-dashboard,
3275
3326
  body.terminal-tabs-left .widget-area,
3327
+ body.terminal-tabs-left .subagent-terminal-view,
3276
3328
  body.terminal-tabs-left .chat,
3277
3329
  body.terminal-tabs-left .feedback-tray,
3278
3330
  body.terminal-tabs-left .jump-to-latest-button,
@@ -3284,6 +3336,7 @@ body.embedded-split .side-panel-backdrop {
3284
3336
  }
3285
3337
  body.terminal-tabs-left .workspace-dashboard { grid-row: 1; }
3286
3338
  body.terminal-tabs-left .widget-area { grid-row: 2; }
3339
+ body.terminal-tabs-left .subagent-terminal-view { grid-row: 1 / -1; }
3287
3340
  body.terminal-tabs-left .chat { grid-row: 3; }
3288
3341
  body.terminal-tabs-left .feedback-tray { grid-row: 4; }
3289
3342
  body.terminal-tabs-left .jump-to-latest-button { grid-row: 5; }
@@ -8580,29 +8633,18 @@ button.composer-skill-tag:focus-visible {
8580
8633
  .subagent-overlay-message:last-child {
8581
8634
  margin-bottom: 0;
8582
8635
  }
8583
- .subagent-overlay-message + .subagent-output-waiting {
8636
+ .subagent-overlay-message + .subagent-run-indicator {
8584
8637
  margin-top: 0;
8585
8638
  }
8586
- .subagent-output-waiting {
8587
- width: fit-content;
8588
- min-width: 2.1rem;
8639
+ .subagent-run-indicator {
8589
8640
  margin-bottom: 0;
8590
- padding: 0.42rem 0.58rem;
8591
- color: var(--ctp-green);
8592
- font-weight: 900;
8593
- letter-spacing: 0.08em;
8594
- }
8595
- .subagent-output-waiting .run-indicator-row {
8596
- gap: 0.12rem;
8597
8641
  }
8598
- .subagent-output-waiting-dot {
8599
- 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;
8600
8645
  }
8601
- .subagent-output-waiting-dot:nth-child(2) { animation-delay: 140ms; }
8602
- .subagent-output-waiting-dot:nth-child(3) { animation-delay: 280ms; }
8603
- @keyframes subagent-output-waiting-pulse {
8604
- 0%, 70%, 100% { opacity: 0.22; transform: translateY(0); }
8605
- 35% { opacity: 1; transform: translateY(-0.12rem); }
8646
+ .subagent-run-indicator-elapsed {
8647
+ white-space: nowrap;
8606
8648
  }
8607
8649
  .subagent-overlay-output-controls {
8608
8650
  min-width: 0;
@@ -8617,6 +8659,137 @@ button.composer-skill-tag:focus-visible {
8617
8659
  color: var(--ctp-yellow);
8618
8660
  border-color: rgba(249, 226, 175, 0.34);
8619
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
+ }
8620
8793
  .extension-dialog.stats-overlay-dialog {
8621
8794
  width: min(92rem, calc(100vw - 1.5rem));
8622
8795
  height: min(54rem, calc(var(--visual-viewport-height, 100dvh) - 1.5rem));
@@ -12017,6 +12190,13 @@ html[data-density="compact"] .composer { padding-block: 0.5rem; }
12017
12190
  .confirmation-details > div { display: grid; grid-template-columns: minmax(6rem, 0.32fr) minmax(0, 1fr); gap: 0.7rem; }
12018
12191
  .confirmation-details dt { color: var(--ctp-subtext); font-weight: 800; }
12019
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; }
12020
12200
 
12021
12201
  @media (max-width: 720px) {
12022
12202
  .remote-access-indicator { max-width: 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@@ -555,6 +555,30 @@ try {
555
555
  assert.equal(initialWorktrees.body?.ok, true, "worktree list endpoint should return data for a git repository");
556
556
  assert.ok(initialWorktrees.body?.data?.worktrees?.some((worktree) => worktree.isMainWorktree && worktree.current), "worktree list should include the current main worktree");
557
557
 
558
+ const originMainBase = runGitFixture(["rev-parse", "HEAD"], cwd, "origin/main base fixture should resolve current HEAD");
559
+ runGitFixture(["update-ref", "refs/remotes/origin/main", originMainBase], cwd, "origin/main base fixture should create a remote-tracking ref");
560
+ await writeFile(path.join(cwd, "workspace-head.txt"), "current workspace only\n");
561
+ runGitFixture(["add", "workspace-head.txt"], cwd, "workspace HEAD fixture should stage its marker");
562
+ runGitFixture(["commit", "-m", "test: advance workspace head"], cwd, "workspace HEAD fixture should advance main beyond origin/main");
563
+ const workspaceHead = runGitFixture(["rev-parse", "HEAD"], cwd, "workspace HEAD fixture should resolve advanced HEAD");
564
+ assert.notEqual(workspaceHead, originMainBase, "workspace HEAD should differ from origin/main for base selection coverage");
565
+
566
+ const originBasedBranch = "feat/origin-main-base";
567
+ const originBasedWorktree = await request("127.0.0.1", "/api/git-worktrees", {
568
+ method: "POST",
569
+ body: { tab: tabId, branchName: originBasedBranch, baseRef: "origin/main", sessionMode: "empty", openTab: true },
570
+ timeoutMs: 20_000,
571
+ });
572
+ assert.equal(originBasedWorktree.status, 200);
573
+ assert.equal(originBasedWorktree.body?.ok, true, `origin/main-based worktree should be created: ${originBasedWorktree.body?.error || ""}`);
574
+ const originBasedWorktreePath = originBasedWorktree.body?.data?.worktree?.path || originBasedWorktree.body?.data?.path;
575
+ const originBasedWorktreeTabId = originBasedWorktree.body?.data?.tab?.id;
576
+ assert.equal(runGitFixture(["rev-parse", "HEAD"], originBasedWorktreePath, "origin/main-based worktree should resolve its HEAD"), originMainBase, "explicit baseRef should create the branch from origin/main rather than the current workspace HEAD");
577
+ const closeOriginBasedTab = await request("127.0.0.1", "/api/tabs/close", { method: "POST", body: { ids: [originBasedWorktreeTabId] }, timeoutMs: 10_000 });
578
+ assert.equal(closeOriginBasedTab.body?.ok, true, "origin/main-based worktree tab should close before cleanup");
579
+ const removeOriginBasedWorktree = await request("127.0.0.1", "/api/git-worktrees", { method: "DELETE", body: { tab: tabId, path: originBasedWorktreePath, confirmed: true }, timeoutMs: 20_000 });
580
+ assert.equal(removeOriginBasedWorktree.body?.ok, true, "origin/main-based worktree should be removable after the tab closes");
581
+
558
582
  await writeFile(path.join(cwd, "guided.txt"), "guided worktree flow\n");
559
583
  runGitFixture(["add", "guided.txt"], cwd, "source checkout should stage guided workflow changes");
560
584
  await mkdir(path.join(cwd, "dev", "COMMIT"), { recursive: true });
@@ -597,7 +621,7 @@ try {
597
621
  const worktreeBranch = "feat/http-worktree";
598
622
  const createWorktree = await request("127.0.0.1", "/api/git-worktrees", {
599
623
  method: "POST",
600
- body: { tab: tabId, branchName: worktreeBranch, sessionMode: "empty", openTab: true },
624
+ body: { tab: tabId, branchName: worktreeBranch, baseRef: "HEAD", sessionMode: "empty", openTab: true },
601
625
  timeoutMs: 20_000,
602
626
  });
603
627
  assert.equal(createWorktree.status, 200);
@@ -611,6 +635,7 @@ try {
611
635
  assert.equal(createWorktree.body?.data?.tab?.cwd, worktreePath, "opened worktree tab should be rooted at the worktree path");
612
636
  assert.equal(createWorktree.body?.data?.tab?.gitWorkspace?.branch, worktreeBranch, "opened tab metadata should record the worktree branch");
613
637
  assert.equal(createWorktree.body?.data?.tab?.gitWorkspace?.worktreePath, worktreePath, "opened tab metadata should record the worktree path");
638
+ assert.equal(runGitFixture(["rev-parse", "HEAD"], worktreePath, "current-HEAD-based worktree should resolve its HEAD"), workspaceHead, "explicit HEAD baseRef should create the branch from the active workspace commit");
614
639
 
615
640
  const branchesWithWorktree = await request("127.0.0.1", `/api/git-branches?tab=${encodeURIComponent(tabId)}`);
616
641
  assert.equal(branchesWithWorktree.status, 200);
@@ -113,6 +113,8 @@ assert.doesNotMatch(html, /id="btwOverlayDialog"/, "/btw should not use a blocki
113
113
  assert.match(html, /id="codexUsageBox"/, "side panel should expose Codex subscription usage status");
114
114
  assert.match(html, /data-side-panel-section="codex-usage"/, "Codex usage should live in a collapsible side-panel section");
115
115
  assert.match(html, /data-side-panel-section="subagents"[\s\S]*class="side-panel-section-label">Subagents<\/span>[\s\S]*id="subagentCountBadge"[\s\S]*class="subagents-help"[\s\S]*<code>subagent<\/code>[\s\S]*foreground or async mode[\s\S]*id="subagentsBox"/, "side panel should explain how to launch tracked subagents and expose grouped running agents with a live count");
116
+ assert.match(html, /id="subagentOpenModeSelect"[\s\S]*<option value="overlay">Overlay<\/option>[\s\S]*<option value="tab">Tab \/ terminal<\/option>[\s\S]*id="subagentOpenModeStatus"/, "Subagents should offer a browser-persisted overlay or terminal-tab opening choice");
117
+ assert.match(html, /id="subagentTerminalView"[\s\S]*Subagent · view only[\s\S]*id="subagentTerminalTranscript"[\s\S]*id="subagentTerminalStatus"[^>]*aria-live="off"[\s\S]*id="subagentTerminalInput"[^>]*placeholder="View only — send messages from the parent terminal"[^>]*disabled[\s\S]*Use its parent terminal to interact with the run/, "dedicated subagent tabs should expose a view-only transcript, non-announcing routine status, and disabled input");
116
118
  assert.doesNotMatch(html, /id="subagentOverlayDialog"/, "subagent output should not use a blocking modal dialog");
117
119
  assert.match(html, /data-side-panel-section="session"[\s\S]*data-side-panel-section="subagents"[\s\S]*data-side-panel-section="queue"/, "Subagents should appear between Session and Queue in the side panel");
118
120
  assert.match(html, /data-side-panel-section="queue"[\s\S]*id="createPromptListButton"[\s\S]*>Create prompt list<\/button>/, "Queue section should expose prompt-list creation");
@@ -350,7 +352,10 @@ assert.match(css, /\.subagents-help \{[\s\S]*border-left:[\s\S]*font-size:\s*0\.
350
352
  assert.match(css, /\.subagents-box\.has-items[\s\S]*\.subagent-tab-group[\s\S]*\.subagent-agent-row/, "running subagents should render as grouped terminal/session cards");
351
353
  assert.match(css, /\.subagent-agent-row:hover,[\s\S]*\.subagent-agent-row:focus-visible/, "subagent rows should expose clickable hover and keyboard focus states");
352
354
  assert.match(css, /\.subagent-overlay-widget[\s\S]*\.subagent-overlay-transcript[\s\S]*\.subagent-overlay-message[\s\S]*\.subagent-overlay-close-action/, "subagent output should combine the non-blocking widget shell with the main transcript message styling");
353
- assert.match(css, /\.subagent-output-waiting-dot[\s\S]*@keyframes subagent-output-waiting-pulse/, "subagent output should animate one transient ellipsis while waiting");
355
+ assert.match(css, /\.terminal-tab-subagent-indicator[\s\S]*\.terminal-tab-subagent[\s\S]*\.subagent-terminal-view[\s\S]*\.subagent-terminal-composer textarea:disabled/, "subagent terminal tabs should be visibly marked and retain an explicit disabled composer");
356
+ assert.match(css, /body\.subagent-terminal-active \.workspace-dashboard,[\s\S]*body\.subagent-terminal-active \.composer[\s\S]*display: none !important/, "the dedicated child view should replace parent terminal content without mutating it");
357
+ assert.match(css, /\.subagent-run-indicator[\s\S]*\.subagent-run-indicator \.run-indicator-meta/, "subagent output should reuse the main live run-indicator treatment with wrapping activity metadata");
358
+ assert.match(css, /\.subagent-terminal-transcript > \.message \{[\s\S]*width: 100%;[\s\S]*max-width: none;/, "dedicated subagent transcript cards should fill the available tab width");
354
359
  assert.doesNotMatch(css, /\.extension-dialog\.subagent-overlay-dialog/, "subagent output should not retain blocking dialog styles");
355
360
  assert.match(css, /@keyframes subagent-running-pulse/, "running subagents should expose a live activity indicator");
356
361
  assert.match(css, /\.optional-feature-pill\.enabled/, "optional features should visually distinguish enabled state");
@@ -714,10 +719,57 @@ assert.match(
714
719
  );
715
720
  assert.match(app, /function renderCodexUsage\(\)/, "frontend should render Codex usage buckets in the side panel");
716
721
  assert.match(app, /function renderSubagents\(\)[\s\S]*subagentTabsWithRunningAgents\(\)[\s\S]*renderSubagentTabGroup\(tab\)/, "frontend should group running subagents by terminal and session");
717
- assert.match(app, /function openSubagentOverlay\(tab, run, agent\)[\s\S]*activeTabId !== tab\.tabId[\s\S]*await switchTab\(tab\.tabId\)[\s\S]*renderWidgets\(\)/, "clicking an agent should switch to its owning tab before rendering the live widget");
722
+ assert.match(app, /SUBAGENT_OPEN_MODE_STORAGE_KEY = "pi-webui-subagent-open-mode"[\s\S]*function normalizeSubagentOpenMode\(value\)[\s\S]*function restoreSubagentOpenModeSetting\(\)/, "subagent opening mode should default safely and persist in this browser");
723
+ assert.match(app, /function openSubagentOutput\(tab, run, agent\) \{[\s\S]*subagentOpenMode === "tab" \? openSubagentTerminal\(tab, run, agent\) : openSubagentOverlay\(tab, run, agent\)/, "clicking an agent should dispatch to the selected overlay or terminal-tab view");
724
+ assert.match(app, /function openSubagentOverlay\(tab, run, agent\)[\s\S]*activeSubagentTerminalId[\s\S]*deactivateSubagentTerminalView\(\{ render: false \}\)[\s\S]*activeTabId !== tab\.tabId[\s\S]*await switchTab\(tab\.tabId\)[\s\S]*renderWidgets\(\)/, "opening an overlay should first leave any virtual child tab, then switch to its owning terminal before rendering the widget");
718
725
  assert.match(app, /function renderWidgets\(\)[\s\S]*renderAppRunnerWidget\(\)[\s\S]*renderSubagentOverlayWidgetSafely\(\)/, "subagent output should render in the shared non-blocking top widget area after App Runner");
719
726
  assert.doesNotMatch(app, /subagentOverlayDialog\.showModal|elements\.subagentOverlayDialog/, "subagent output should not open or depend on a modal dialog");
720
727
  assert.match(app, /api\(`\/api\/subagents\/output\?\$\{query\}`, \{ scoped: false \}\)/, "subagent overlay should fetch selected live output from the owning tab");
728
+ assert.match(app, /function subagentRunIndicatorActivity\(agent = \{\}\)[\s\S]*currentToolArgs[\s\S]*activityState[\s\S]*function appendSubagentRunIndicator\(parent,[\s\S]*run-indicator-pulse[\s\S]*Agent is running:[\s\S]*subagent-run-indicator-elapsed[\s\S]*updateSubagentRunIndicatorElapsed\(parent, run\)/, "running child output should show the main-style pulse, current tool or activity, and separately refreshed elapsed runtime");
729
+ assert.match(app, /const facts = \[[\s\S]*view\.finished \? "finished" : running \? "running"/, "retained completed child views should not keep contradictory running header metadata");
730
+ assert.match(app, /function renderSubagentTerminalView\(\)[\s\S]*if \(running\) appendSubagentRunIndicator\(elements\.subagentTerminalTranscript, \{ agent, run: view\.run \}\)/, "the dedicated child tab should append a live run indicator whenever the selected child is running");
731
+ const subagentTerminalSignatureSource = appFunctionSource("subagentTerminalViewMeaningfulSignature", "updateSubagentTerminalRefreshState");
732
+ const subagentTerminalRefreshSource = appFunctionSource("refreshSubagentTerminalView", "deactivateSubagentTerminalView");
733
+ assert.ok(subagentTerminalRefreshSource.includes("tab: view.parentTabId, run: view.runId, agent: view.agentId"), "subagent terminal refresh should stay scoped to the child and its owning parent terminal");
734
+ assert.ok(subagentTerminalRefreshSource.includes("view.finished = true"), "an open child tab should retain its last snapshot after the run is no longer tracked");
735
+ assert.ok(subagentTerminalRefreshSource.includes("previousSignature !== subagentTerminalViewMeaningfulSignature(view)"), "automatic child polling should compare meaningful snapshots before rebuilding the transcript");
736
+ let unchangedSubagentRenderCount = 0;
737
+ let unchangedSubagentTabRenderCount = 0;
738
+ let unchangedSubagentElapsedUpdateCount = 0;
739
+ const unchangedSubagentView = {
740
+ id: "child-view",
741
+ parentTabId: "parent-tab",
742
+ runId: "run-1",
743
+ agentId: "agent-1",
744
+ data: { updatedAt: 1, agent: { id: "agent-1", status: "running", currentTool: "read" } },
745
+ error: "",
746
+ finished: false,
747
+ loading: false,
748
+ requestSerial: 0,
749
+ };
750
+ await vm.runInNewContext(`${subagentTerminalSignatureSource}\nasync ${subagentTerminalRefreshSource}\nrefreshSubagentTerminalView("child-view");`, {
751
+ activeSubagentTerminalId: "child-view",
752
+ elements: { subagentTerminalTranscript: {} },
753
+ subagentTerminalViews: new Map([["child-view", unchangedSubagentView]]),
754
+ URLSearchParams,
755
+ api: async () => ({ data: { updatedAt: 2, agent: { id: "agent-1", status: "running", currentTool: "read" } } }),
756
+ renderSubagentTerminalView() { unchangedSubagentRenderCount += 1; },
757
+ renderTabs() { unchangedSubagentTabRenderCount += 1; },
758
+ updateSubagentRunIndicatorElapsed() { unchangedSubagentElapsedUpdateCount += 1; },
759
+ updateSubagentTerminalRefreshState() { throw new Error("background polls must not announce routine loading state"); },
760
+ });
761
+ assert.equal(unchangedSubagentRenderCount, 0, "an unchanged background poll should preserve the existing transcript DOM");
762
+ assert.equal(unchangedSubagentTabRenderCount, 0, "an unchanged background poll should not rebuild terminal tabs");
763
+ assert.equal(unchangedSubagentElapsedUpdateCount, 1, "an unchanged background poll should refresh only the existing visual elapsed-time node");
764
+ assert.equal(unchangedSubagentView.loading, false, "an unchanged background poll should still clear its internal loading flag");
765
+ const subagentTerminalCloseStart = app.indexOf("function closeSubagentTerminalTab(");
766
+ const subagentTerminalCloseEnd = app.indexOf("\nasync function copySubagentTerminalOutput(", subagentTerminalCloseStart);
767
+ assert.ok(subagentTerminalCloseStart >= 0 && subagentTerminalCloseEnd > subagentTerminalCloseStart, "closeSubagentTerminalTab should remain a standalone frontend helper");
768
+ const subagentTerminalCloseSource = app.slice(subagentTerminalCloseStart, subagentTerminalCloseEnd);
769
+ assert.ok(subagentTerminalCloseSource.includes("subagentTerminalViews.delete(viewId)"), "closing a subagent tab should remove only its client-side view record");
770
+ assert.doesNotMatch(subagentTerminalCloseSource, /\bapi\(|closeTerminalTabs\(|closeSubagentOverlay\(/, "closing a subagent tab must not call backend terminal or subagent lifecycle APIs");
771
+ assert.match(app, /function renderSubagentTerminalTab\(view\)[\s\S]*terminal-tab-subagent[\s\S]*subagent: true[\s\S]*closeSubagentTerminalTab\(view\.id\)/, "virtual tabs should be marked as subagents and have a view-only close action");
772
+ assert.match(app, /function subagentTerminalViewId\(tab, run, agent\)[\s\S]*JSON\.stringify\(\[tab\?\.tabId[\s\S]*run\?\.id[\s\S]*agent\?\.id/, "virtual child tabs should be uniquely keyed by parent terminal, run, and child agent");
721
773
  assert.match(app, /SUBAGENT_OVERLAY_REFRESH_MS = 1000/, "subagent overlay should poll selected live output at a fast cadence");
722
774
  assert.match(app, /function createMessageBubble\(message,[\s\S]*renderContent\(body, message\.content, \{ markdown: message\.role === "assistant" \}\)[\s\S]*function appendMessage\(message, options = \{\}\)[\s\S]*createMessageBubble\(message, options\)/, "main transcript output should use the reusable message bubble renderer");
723
775
  const subagentTranscriptMessagesSource = appFunctionSource("subagentOverlayTranscriptMessages", "subagentOverlayToolArguments");
@@ -733,12 +785,13 @@ const subagentAppendSource = appFunctionSource("appendSubagentOverlayTranscript"
733
785
  assert.ok(subagentAppendSource.includes("subagentOverlayTranscriptDisplayMessages(messages)"), "subagent bubbles should use the paired structured display sequence");
734
786
  assert.ok(subagentAppendSource.includes("createMessageBubble(displayMessage, { transient: true })"), "subagent bubbles should reuse the main message renderer");
735
787
  const thinkingVisibilitySource = appFunctionSource("setThinkingOutputVisible", "applyToolOutputExpansionToDom");
736
- assert.ok(thinkingVisibilitySource.includes("if (subagentOverlaySelection?.tabId === activeTabId) renderWidgets();"), "changing thinking visibility should rerender an open subagent transcript, including finished agents");
788
+ assert.ok(thinkingVisibilitySource.includes("if (subagentOverlaySelection?.tabId === activeTabId) renderWidgets();"), "changing thinking visibility should rerender an open subagent overlay transcript, including finished agents");
789
+ assert.ok(thinkingVisibilitySource.includes("if (activeSubagentTerminalId) renderSubagentTerminalView();"), "changing thinking visibility should rerender an open subagent terminal transcript, including finished agents");
737
790
  const subagentCopySource = appFunctionSource("subagentOverlayTranscriptOutputLines", "subagentOverlayOutputLines");
738
791
  assert.ok(subagentCopySource.includes("messageCopyText(message)"), "global subagent copy should derive from the same structured bubble messages");
739
792
  const subagentOutputSource = appFunctionSource("subagentOverlayOutputLines", "subagentOverlayOutputText");
740
793
  assert.ok(subagentOutputSource.includes("if (transcriptMessages.length) return subagentOverlayTranscriptOutputLines(data);"), "global subagent copy should prefer structured transcript content over flattened recent output");
741
- const subagentEmptySource = appFunctionSource("subagentOverlayEmptyTranscriptText", "appendSubagentOutputWaitingIndicator");
794
+ const subagentEmptySource = appFunctionSource("subagentOverlayEmptyTranscriptText", "appendSubagentRunIndicator");
742
795
  assert.ok(subagentEmptySource.includes("No visible output was captured."), "hidden or non-renderable structured output should have explicit fallback text");
743
796
  const subagentRenderErrorSource = appFunctionSource("renderSubagentOverlayErrorWidget", "renderSubagentOverlayWidgetSafely");
744
797
  assert.ok(subagentRenderErrorSource.includes("Subagent output unavailable"), "a failed subagent renderer should show a minimal recoverable widget");
@@ -755,7 +808,7 @@ assert.equal(rendererContainmentResult, rendererFallbackSentinel, "subagent rend
755
808
  const subagentWidgetSource = appFunctionSource("renderSubagentOverlayWidget", "scheduleSubagentOverlayRefresh");
756
809
  assert.ok(subagentWidgetSource.includes("const visibleFallbackText = !hasStructuredTranscript ? fallbackText : emptyTranscriptFallback;"), "the widget should render a fallback instead of leaving structured-but-hidden output blank");
757
810
  assert.ok(subagentWidgetSource.includes("if (visibleFallbackText) {"), "the widget should append the nonblank fallback bubble");
758
- assert.ok(subagentWidgetSource.includes("if (running && (agent.currentTool || (hasStructuredTranscript && renderedTranscriptMessages === 0))) appendSubagentOutputWaitingIndicator(output);"), "subagent widgets should retain one waiting indicator while structured output is hidden or a tool is running");
811
+ assert.ok(subagentWidgetSource.includes("if (running) appendSubagentRunIndicator(output, { agent, run: selection.run });"), "running subagent widgets should append the shared live activity indicator");
759
812
  assert.match(app, /api\("\/api\/subagents", \{ scoped: false \}\)/, "frontend should refresh the cross-tab subagent overview");
760
813
  assert.match(app, /SUBAGENTS_ACTIVE_REFRESH_MS = 1500/, "running subagents should receive a fast live refresh cadence");
761
814
  assert.match(server, /url\.pathname === "\/api\/subagents" && req\.method === "GET"[\s\S]*webuiSubagentsData\(\)/, "server should expose a cross-tab running-subagent endpoint");
@@ -814,8 +867,11 @@ assert.match(app, /function renderFooterBranchCreateForm\(state = footerBranchPi
814
867
  assert.match(app, /let footerBranchCreateDraft = \{ type: "", name: "" \}/, "new branch creation should not default the editable type prefix to feat");
815
868
  assert.match(app, /function footerBranchCreateType\(value = footerBranchCreateDraft\.type\) \{\n\s+return slugifyGitBranchPart\(value\);\n\}/, "branch type suggestions should not restrict or default custom user-entered prefixes");
816
869
  assert.match(app, /const slash = make\("span", "footer-branch-create-slash", "\/"\)/, "branch creation should visibly separate the prefix and user input with a slash");
817
- assert.match(app, /function gitWorktreeCreateCommandDisplay\(branch, state = footerBranchPickerState\)[\s\S]*git worktree add -b[\s\S]*preview\.textContent = gitWorktreeCreateCommandDisplay\(branchName \|\| footerBranchCreatePreviewName\(\), state\)/, "branch worktree creation should show the live complete quoted git worktree command");
818
- assert.match(app, /function footerBranchCreateTooltip\(branchName = footerBranchCreateName\(\), state = footerBranchPickerState\)[\s\S]*A branch worktree is a separate checkout for parallel changes\.[\s\S]*does not switch this tab's branch, commit, push, or delete anything[\s\S]*ignored dependencies such as node_modules or \.venv are not copied/, "create worktree button should have a detailed explanatory tooltip");
870
+ assert.match(app, /function gitWorktreeCreateCommandDisplay\(branch, state = footerBranchPickerState, baseRef = "origin\/main"\)[\s\S]*git worktree add -b[\s\S]*preview\.textContent = gitWorktreeCreateCommandDisplay\(branchName \|\| footerBranchCreatePreviewName\(\), state\)/, "branch worktree creation should preview the default origin/main start point");
871
+ assert.match(app, /function footerBranchCreateTooltip\(branchName = footerBranchCreateName\(\), state = footerBranchPickerState\)[\s\S]*A branch worktree is a separate checkout for parallel changes\.[\s\S]*origin\/main \(default\)[\s\S]*does not switch this tab's branch, commit, push, or delete anything[\s\S]*ignored dependencies such as node_modules or \.venv are not copied/, "create worktree button should explain the base choice and worktree behavior");
872
+ assert.match(html, /id="gitWorktreeBaseDialog"[\s\S]*id="gitWorktreeBaseOriginMain"[^>]*value="origin\/main" checked[\s\S]*id="gitWorktreeBaseCurrentHead"[^>]*value="HEAD"[\s\S]*id="gitWorktreeBaseCreateButton"/, "worktree creation should present an origin/main-default base picker with a current-HEAD alternative");
873
+ assert.match(app, /function chooseGitWorktreeBase\(branch\)[\s\S]*gitWorktreeBaseOriginMain\.checked = true[\s\S]*gitWorktreeBaseCurrentHead\.checked = false/, "the worktree base picker should reset to origin/main for every creation");
874
+ assert.match(css, /\.git-worktree-base-option:has\(input:checked\)[\s\S]*border-color:/, "the selected worktree base should be visibly highlighted");
819
875
  assert.match(app, /submitButton\.dataset\.tooltip = footerBranchCreateTooltip\(branchName\);[\s\S]*submitButton\.removeAttribute\("title"\)/, "create branch button should use the styled tooltip instead of a native title tooltip");
820
876
  assert.match(css, /\.footer-branch-create-submit\[data-tooltip\]::after \{[\s\S]*?content:\s*attr\(data-tooltip\);[\s\S]*?white-space:\s*pre-wrap;[\s\S]*?overflow-wrap:\s*anywhere;/, "create branch button tooltip should be styled and support detailed multiline copy");
821
877
  assert.match(app, /submitButton\.disabled = false;[\s\S]*submitButton\.classList\.toggle\("footer-branch-create-submit-disabled", submitDisabled\);[\s\S]*submitButton\.setAttribute\("aria-disabled", submitDisabled \? "true" : "false"\)/, "branch creation should use aria-disabled styling so the tooltip is not dimmed by disabled button opacity");
@@ -827,7 +883,7 @@ assert.match(css, /\.footer-branch-option-row \{[\s\S]*?grid-template-columns:\s
827
883
  assert.match(css, /\.footer-branch-advanced-action:disabled \{[\s\S]*?cursor:\s*not-allowed/, "advanced branch switch action should visibly disable occupied branches");
828
884
  assert.match(css, /\.footer-worktree \.footer-meta-value,[\s\S]*?\.footer-tui-worktree \{[\s\S]*?color:\s*var\(--ctp-green\)/, "worktree footer chips should have distinct green styling");
829
885
  assert.match(css, /\.workspace-dashboard-action\.worktree \{[\s\S]*?color:\s*var\(--ctp-green\)/, "workspace dashboard should style the branch worktree action distinctly");
830
- assert.match(app, /async function createFooterGitBranchWorktree\(branch = footerBranchCreateName\(\)[\s\S]*api\("\/api\/git-worktrees", \{ method: "POST", body: \{ branchName, sessionMode: "fork-current", openTab: true \}/, "branch worktree creation should call the worktree create endpoint");
886
+ assert.match(app, /async function createFooterGitBranchWorktree\(branch = footerBranchCreateName\(\)[\s\S]*chooseGitWorktreeBase\(branchName\)[\s\S]*api\("\/api\/git-worktrees", \{ method: "POST", body: \{ branchName, baseRef, sessionMode: "fork-current", openTab: true \}/, "new footer branch worktrees should ask for and submit the selected base ref");
831
887
  assert.match(app, /async function openFooterGitWorktree\(path,[\s\S]*api\("\/api\/git-worktrees\/open", \{ method: "POST", body: \{ path: worktreePath, sessionMode: "fork-current", openTab: true \}/, "existing worktree actions should call the worktree open endpoint");
832
888
  assert.match(app, /elements\.newTabWorktreeButton\?\.addEventListener\("click", \(\) => openBranchWorktreePicker\(\)\)/, "new-tab menu branch worktree item should open the picker");
833
889
  assert.match(app, /\{ kind: "Git", label: "Branch worktree"[\s\S]*openBranchWorktreePicker\(\)/, "command palette should include branch worktree actions");
@@ -989,7 +1045,7 @@ assert.match(css, /\.git-workflow-message-input-row \{[\s\S]*flex:\s*1 1 100%/,
989
1045
  assert.match(css, /\.git-workflow-actions button\[data-tooltip\]::after \{[\s\S]*content:\s*attr\(data-tooltip\)[\s\S]*white-space:\s*pre-line/, "guided git workflow action tooltips should render multiline step lists");
990
1046
  assert.match(app, /function gitBranchNamePromptMessage\(\)[\s\S]*hasAvailableCommand\("git-branch-name"\)[\s\S]*return "\/git-branch-name"/, "guided git workflow should ask the agent to generate PR branch names when the prompt is available");
991
1047
  assert.match(app, /async function loadGitWorkflowBranchName\([\s\S]*gitWorkflowRequest\("\/api\/git-workflow\/branch-name"/, "guided git workflow should load generated agent branch names before branch creation");
992
- assert.match(app, /async function createGitPrBranchWithSuggestion\([\s\S]*prompt\("New PR branch worktree name[\s\S]*assertGuidedGitStagedContentBinding\(tabId, "PR worktree creation"\)[\s\S]*gitWorkflowRequest\("\/api\/git-workflow\/branch", \{ body: \{ branch, sessionMode: "fork-current", openTab: true, [\s\S]*expectedStagedContentHash/, "guided git workflow should confirm an agent-suggested branch and verify approved staged content before opening its worktree");
1048
+ assert.match(app, /async function createGitPrBranchWithSuggestion\([\s\S]*prompt\("New PR branch worktree name[\s\S]*chooseGitWorktreeBase\(branch\)[\s\S]*assertGuidedGitStagedContentBinding\(tabId, "PR worktree creation"\)[\s\S]*gitWorkflowRequest\("\/api\/git-workflow\/branch", \{ body: \{ branch, baseRef, sessionMode: "fork-current", openTab: true, [\s\S]*expectedStagedContentHash/, "guided git worktrees should ask for a base ref before verifying and carrying staged content");
993
1049
  assert.match(app, /function syncGitWorkflowWorktreeTabs\(result\)[\s\S]*Array\.isArray\(result\?\.tabs\)[\s\S]*applyTabMetadata\(result\.tab\)/, "guided git workflow should merge worktree tab metadata returned by the branch endpoint");
994
1050
  assert.match(app, /const targetTabId = result\.tab\?\.id[\s\S]*setGitWorkflow\(nextState, \{ tabId: targetTabId \}\)[\s\S]*switchTab\(targetTabId\)/, "guided git workflow should transfer PR state to the opened worktree tab");
995
1051
  assert.match(app, /addGitWorkflowAction\("Push and Create PR", \(\) => pushAndCreatePrGitWorkflow\(\), "primary", false\)/, "guided git workflow should replace push with Push and Create PR in PR mode");
@@ -1340,7 +1396,7 @@ assert.match(css, /@media \(max-width: 720px\), \(max-device-width: 720px\), \(p
1340
1396
  assert.match(css, /@media \(max-width: 720px\), \(max-device-width: 720px\), \(pointer: coarse\) and \(hover: none\) \{[\s\S]*?\.terminal-tab-group-menu \{[\s\S]*?grid-column:\s*1 \/ -1;[\s\S]*?margin:\s*0\.34rem 0 0;/, "mobile terminal tab group menus should not add horizontal margins that overflow and distort the tab card");
1341
1397
  assert.match(app, /let openTerminalTabGroupKey = null/, "frontend should track the open terminal tab group across tab bar rerenders");
1342
1398
  assert.match(app, /function updateTerminalTabGroupOpenState\(\)/, "frontend should be able to reapply open terminal tab group state after rerenders");
1343
- assert.match(app, /classList\.toggle\("terminal-tabs-dense", tabs\.length >= 10\)/, "frontend should enable dense tab layout before tab names become unreadable");
1399
+ assert.match(app, /const totalTabCount = tabs\.length \+ subagentTerminalViews\.size;[\s\S]*classList\.toggle\("terminal-tabs-dense", totalTabCount >= 10\)/, "frontend should include virtual subagent tabs when enabling dense tab layout");
1344
1400
  assert.match(app, /appendTerminalTabContent\(button, \{ title: activeTitle,[\s\S]*?count: groupTabs\.length,[^}]*\}\)/, "group buttons should show the active terminal name instead of only the cwd label");
1345
1401
  assert.match(app, /wrapper\.addEventListener\("pointerenter", \(\) => setOpenTerminalTabGroup\(group\.key\)\)/, "terminal tab groups should mark themselves open while hovered");
1346
1402
  assert.match(app, /if \(openTerminalTabGroupKey\) \{\n\s+scheduleRefreshTabs\(600\);/, "tab polling should defer full tab refreshes while a group menu is open");
@@ -1354,6 +1410,8 @@ assert.match(app, /function closeAllTerminalTabs\(\)[\s\S]*?closeTerminalTabs\(t
1354
1410
  assert.match(app, /WARNING: \$\{activeAgentTabs\.length\}[\s\S]*?still running or waiting for input/, "tab close confirmations should warn when agents are still running");
1355
1411
  assert.match(app, /elements\.closeAllTabsButton\.addEventListener\("click", \(\) => closeAllTerminalTabs\(\)\)/, "close-all tabs button should be wired in JS");
1356
1412
  assert.match(app, /const groups = tabCwdGroups\(\);[\s\S]*?for \(const group of groups\) \{\n\s+if \(shouldRenderTerminalTabGroup\(group, groups\.length\)\)[\s\S]*?renderTerminalTabGroup\(group, groups\.length\)[\s\S]*?for \(const tab of group\.tabs\) elements\.tabBar\.append\(renderTerminalTab\(tab\)\);/, "terminal tabs should render groups with group count and ungrouped tabs when grouping is skipped");
1413
+ assert.match(app, /for \(const view of \[\.\.\.subagentTerminalViews\.values\(\)\][\s\S]*renderSubagentTerminalTab\(view\)/, "open subagent views should render as first-class virtual terminal tabs");
1414
+ assert.match(readme, /Tracked subagent output[\s\S]*dedicated \*\*Subagent\*\* terminal tab[\s\S]*view-only[\s\S]*close without stopping or interrupting/, "README should document the selectable view-only child terminal behavior");
1357
1415
  assert.match(app, /let tabSeenCompletionSerials = new Map\(\)/, "frontend should track which tab completions have been seen");
1358
1416
  assert.match(app, /let activeTabGeneration = 0/, "frontend should version active-tab UI state to reject stale async work");
1359
1417
  assert.match(app, /function isCurrentTabContext\(context\)/, "frontend should identify stale active-tab refresh contexts");