@firstpick/pi-package-webui 0.7.9 → 0.8.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/README.md +32 -9
- package/bin/pi-webui.mjs +750 -113
- package/lib/git-workflow-preferences.mjs +16 -0
- package/lib/git-worktrees.mjs +43 -4
- package/lib/npm-command.mjs +81 -0
- package/lib/queue-mutation.mjs +6 -0
- package/lib/workspace-files-live-watcher.mjs +138 -0
- package/package.json +11 -4
- package/public/app.js +3397 -380
- package/public/index.html +119 -20
- package/public/mobile-shell-state.mjs +166 -0
- package/public/service-worker.js +60 -13
- package/public/styles.css +1066 -362
- package/public/subagent-gate-visibility.mjs +16 -0
- package/public/subagent-launch-slot-state.mjs +16 -0
- package/public/transcript-renderer.mjs +433 -0
- package/tests/boot-failure-diagnostics.test.mjs +3 -3
- package/tests/browser/interaction-continuity.spec.mjs +739 -0
- package/tests/browser/mobile-foundation.spec.mjs +352 -0
- package/tests/browser/optimistic-prompt.spec.mjs +130 -0
- package/tests/chat-scroll-intent-static.test.mjs +6 -1
- package/tests/codex-fast-mode-static.test.mjs +59 -0
- package/tests/compact-sections-static.test.mjs +20 -2
- package/tests/compaction-mutation-contract.test.mjs +18 -4
- package/tests/compaction-static.test.mjs +1 -0
- package/tests/completion-signal-contract.test.mjs +13 -2
- package/tests/composer-skill-tag-layout.test.mjs +70 -0
- package/tests/fast-mode-client-static.test.mjs +14 -11
- package/tests/fixtures/fake-pi.mjs +222 -2
- package/tests/git-panel-gitignore-static.test.mjs +104 -0
- package/tests/git-workflow-preferences.test.mjs +8 -0
- package/tests/guided-git-publication-backend-static.test.mjs +40 -0
- package/tests/http-endpoints-harness.test.mjs +490 -3
- package/tests/interaction-state-stability-static.test.mjs +254 -0
- package/tests/mobile-continuity-tablet-static.test.mjs +55 -0
- package/tests/mobile-foundation-static.test.mjs +69 -0
- package/tests/mobile-phone-experience-static.test.mjs +65 -0
- package/tests/mobile-shell-state.test.mjs +69 -0
- package/tests/mobile-static.test.mjs +300 -43
- package/tests/mobile-transcript-cache-characterization.test.mjs +34 -0
- package/tests/npm-command.test.mjs +64 -1
- package/tests/open-issue-wizard-static.test.mjs +2 -1
- package/tests/queue-edit-reorder-static.test.mjs +9 -1
- package/tests/queue-mutation-contract.test.mjs +22 -0
- package/tests/service-worker-lifecycle.test.mjs +120 -0
- package/tests/side-panel-resize-static.test.mjs +8 -1
- package/tests/sse-backpressure-harness.test.mjs +98 -0
- package/tests/streaming-ui-coupling.test.mjs +7 -1
- package/tests/subagent-gate-visibility.test.mjs +18 -2
- package/tests/subagent-launch-slot-state.test.mjs +32 -0
- package/tests/subagent-launch-slots-static.test.mjs +8 -2
- package/tests/subagents-helper.test.mjs +90 -0
- package/tests/terminal-tab-workspace-static.test.mjs +1 -1
- package/tests/update-commands.test.mjs +4 -0
- package/tests/workspace-files-live-updates-static.test.mjs +76 -0
- package/tests/workspace-files-live-watcher.test.mjs +95 -0
- package/webui-rpc-helper.mjs +175 -3
|
@@ -175,6 +175,7 @@ assert.match(html, /id="codexUsageBox"/, "side panel should expose Codex subscri
|
|
|
175
175
|
assert.match(html, /data-side-panel-section="codex-usage"/, "Codex usage should live in a collapsible side-panel section");
|
|
176
176
|
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]*<code>subagent_gate<\/code>[\s\S]*bounded retries or a success quorum[\s\S]*id="subagentsBox"/, "side panel should explain ordinary delegation and retry-gate workflows with a live count");
|
|
177
177
|
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");
|
|
178
|
+
assert.match(html, /class="subagents-status-row"[\s\S]*id="subagentsStatus"[\s\S]*id="subagentsClearFinishedButton"[^>]*disabled[^>]*>Clear finished<\/button>/, "Subagents should expose a clear-finished control beside its live status");
|
|
178
179
|
const subagentCancelDialogHtml = html.match(/<dialog id="subagentCancelDialog"[\s\S]*?<\/dialog>/)?.[0] || "";
|
|
179
180
|
assert.match(subagentCancelDialogHtml, /id="subagentCancelDialogTitle">Cancel subagent<[\s\S]*id="subagentCancelDialogSubtitle"/, "subagent cancellation should use a titled dialog with dynamic target context");
|
|
180
181
|
assert.match(subagentCancelDialogHtml, /<select id="subagentCancelReason">[\s\S]*<option value="" selected>No reason<\/option>[\s\S]*Wrong model\/provider\/thinking effort[\s\S]*Wrong agent or task[\s\S]*Taking too long[\s\S]*Wrong approach or direction[\s\S]*Output no longer needed[\s\S]*Started by mistake[\s\S]*<option value="Other">Other<\/option>/, "subagent cancellation should offer every approved optional reason");
|
|
@@ -188,6 +189,56 @@ assert.match(html, /id="subagentLaunchSlotScope"[^>]*aria-describedby="subagentL
|
|
|
188
189
|
assert.match(html, /id="subagentLaunchSlotsAnnouncer"[^>]*aria-live="polite"[^>]*aria-atomic="true"/, "launch-slot additions and removals should have a dedicated live announcement");
|
|
189
190
|
assert.match(css, /\.subagent-launch-slots-reload-actions span \{\s*flex: 1 1 auto;\s*min-width: min\(12rem, 100%\);/, "narrow launch-slot reload prompts should size from their content instead of reserving a tall fixed flex basis");
|
|
190
191
|
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");
|
|
192
|
+
const subagentTerminalCardsHtml = html.match(/<footer id="subagentTerminalCards"[\s\S]*?<\/footer>/)?.[0] || "";
|
|
193
|
+
assert.match(subagentTerminalCardsHtml, /^<footer id="subagentTerminalCards"[^>]*class="subagent-terminal-cards"[^>]*aria-label="Subagent session telemetry"[^>]*>[\s\S]*<dl class="subagent-terminal-card-list">/, "dedicated subagent telemetry should use a labelled footer and definition list");
|
|
194
|
+
const subagentTerminalCards = [
|
|
195
|
+
["pi", "subagentTerminalCardPi", "PI", "—"],
|
|
196
|
+
["speed", "subagentTerminalCardSpeed", "Speed", "—"],
|
|
197
|
+
["context", "subagentTerminalCardContext", "Context", "—"],
|
|
198
|
+
["model", "subagentTerminalCardModel", "Model", "unknown"],
|
|
199
|
+
["effort", "subagentTerminalCardEffort", "Effort", "unknown"],
|
|
200
|
+
["tokens", "subagentTerminalCardTokens", "Tokens", "—"],
|
|
201
|
+
];
|
|
202
|
+
assert.equal((subagentTerminalCardsHtml.match(/\bdata-subagent-card=/g) || []).length, 6, "dedicated subagent telemetry should retain exactly six card slots");
|
|
203
|
+
for (const [slot, id, label, fallback] of subagentTerminalCards) {
|
|
204
|
+
assert.equal((subagentTerminalCardsHtml.match(new RegExp(`data-subagent-card="${slot}"`, "g")) || []).length, 1, `${slot} telemetry card should have one stable slot`);
|
|
205
|
+
assert.match(subagentTerminalCardsHtml, new RegExp(`<div[^>]*data-subagent-card="${slot}"[^>]*>[\\s\\S]*?<dt[^>]*>${label}<\\/dt>[\\s\\S]*?<dd id="${id}"[^>]*>${fallback}<\\/dd>`), `${slot} telemetry card should expose a labelled definition with an honest initial fallback`);
|
|
206
|
+
}
|
|
207
|
+
assert.match(subagentTerminalCardsHtml, /data-subagent-card="tokens"[^>]*title="[^"]*bounded recent child-session scan/, "token totals should disclose their bounded recent-session scope");
|
|
208
|
+
const subagentTerminalTelemetryNumberSource = appFunctionSource("subagentTerminalTelemetryNumber", "formatSubagentTerminalTelemetryTokens");
|
|
209
|
+
const formatSubagentTerminalTelemetryTokensSource = appFunctionSource("formatSubagentTerminalTelemetryTokens", "formatSubagentTerminalTelemetryText");
|
|
210
|
+
const formatSubagentTerminalTelemetryTextSource = appFunctionSource("formatSubagentTerminalTelemetryText", "renderSubagentTerminalCards");
|
|
211
|
+
const renderSubagentTerminalCardsSource = appFunctionSource("renderSubagentTerminalCards", "renderSubagentTerminalView");
|
|
212
|
+
assert.match(renderSubagentTerminalCardsSource, /agent\?\.telemetry/, "terminal telemetry cards should consume the normalized telemetry object");
|
|
213
|
+
assert.doesNotMatch(renderSubagentTerminalCardsSource, /\b(?:transcript|recentOutput|messages|content)\b/i, "terminal telemetry cards must not derive metrics from transcript output");
|
|
214
|
+
const telemetryCardElements = Object.fromEntries(subagentTerminalCards.map(([, id]) => [id, { textContent: "" }]));
|
|
215
|
+
vm.runInNewContext(`${subagentTerminalTelemetryNumberSource}\n${formatSubagentTerminalTelemetryTokensSource}\n${formatSubagentTerminalTelemetryTextSource}\n${renderSubagentTerminalCardsSource}\nrenderSubagentTerminalCards({ telemetry: [] });`, {
|
|
216
|
+
elements: telemetryCardElements,
|
|
217
|
+
formatFooterTokenCount: (value) => String(value),
|
|
218
|
+
});
|
|
219
|
+
assert.deepEqual(Object.fromEntries(Object.entries(telemetryCardElements).map(([id, element]) => [id, element.textContent])), {
|
|
220
|
+
subagentTerminalCardPi: "—",
|
|
221
|
+
subagentTerminalCardSpeed: "—",
|
|
222
|
+
subagentTerminalCardContext: "— / unknown",
|
|
223
|
+
subagentTerminalCardModel: "unknown",
|
|
224
|
+
subagentTerminalCardEffort: "unknown",
|
|
225
|
+
subagentTerminalCardTokens: "↑— · ↓—",
|
|
226
|
+
}, "missing or invalid telemetry should keep every card visible with explicit unknown fallbacks");
|
|
227
|
+
vm.runInNewContext(`${subagentTerminalTelemetryNumberSource}\n${formatSubagentTerminalTelemetryTokensSource}\n${formatSubagentTerminalTelemetryTextSource}\n${renderSubagentTerminalCardsSource}\nrenderSubagentTerminalCards({ telemetry: { promptInjectionTokens: 1200, tokenSpeed: 42.5, contextTokens: 1234, contextWindow: 9999, model: "provider/model", effort: "high", inputTokens: 12, outputTokens: 34 } });`, {
|
|
228
|
+
elements: telemetryCardElements,
|
|
229
|
+
formatFooterTokenCount: (value) => String(value),
|
|
230
|
+
});
|
|
231
|
+
assert.deepEqual(Object.fromEntries(Object.entries(telemetryCardElements).map(([id, element]) => [id, element.textContent])), {
|
|
232
|
+
subagentTerminalCardPi: "1200",
|
|
233
|
+
subagentTerminalCardSpeed: "42.5 tok/s",
|
|
234
|
+
subagentTerminalCardContext: "1234 / 9999",
|
|
235
|
+
subagentTerminalCardModel: "provider/model",
|
|
236
|
+
subagentTerminalCardEffort: "high",
|
|
237
|
+
subagentTerminalCardTokens: "↑12 · ↓34",
|
|
238
|
+
}, "terminal telemetry cards should render only normalized telemetry values");
|
|
239
|
+
assert.match(css, /\.subagent-terminal-card-list\s*\{[\s\S]*?display:\s*grid;[\s\S]*?grid-template-columns:\s*repeat\(auto-fit,\s*minmax\(/, "telemetry cards should wrap responsively through a grid rather than require a fixed row");
|
|
240
|
+
assert.match(css, /@media\s*\([^)]*max-width[^)]*\)\s*\{[\s\S]*?\.subagent-terminal-card-list\s*\{[\s\S]*?grid-template-columns:\s*minmax\(0,\s*1fr\)/, "narrow viewports should collapse telemetry cards without horizontal overflow");
|
|
241
|
+
assert.match(readme, /exactly six telemetry cards: PI, measured token speed, context, model, effort, and input\/output tokens from a bounded recent session scan; unavailable or legacy evidence remains `—` or `unknown` rather than an estimate/, "README should document each subagent telemetry card, bounded scan scope, and honest unknown behavior");
|
|
191
242
|
assert.doesNotMatch(html, /id="subagentOverlayDialog"/, "subagent output should not use a blocking modal dialog");
|
|
192
243
|
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");
|
|
193
244
|
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");
|
|
@@ -371,7 +422,8 @@ assert.match(css, /@media \(max-width: 1050px\)[\s\S]*?body:not\(\.side-panel-co
|
|
|
371
422
|
assert.match(css, /@media \(max-width: 1050px\)[\s\S]*?\.side-panel-backdrop \{[\s\S]*?z-index:\s*110;[\s\S]*?\.side-panel \{[\s\S]*?z-index:\s*111;[\s\S]*?body\.side-panel-collapsed \.terminal-tabs-shell \{[\s\S]*?padding-right:\s*4\.85rem;[\s\S]*?\.side-panel-expand-button \{[\s\S]*?z-index:\s*120/, "narrow side-panel overlay and expand button should stay above and reserve space from terminal header controls");
|
|
372
423
|
assert.match(css, /@media \(max-width: 720px\), \(max-device-width: 720px\), \(pointer: coarse\) and \(hover: none\)[\s\S]*?body\.side-panel-collapsed \.terminal-tabs-shell \{ padding-right:\s*calc\(44px \+ 0\.8rem\); \}[\s\S]*?\.side-panel-expand-button \{[\s\S]*?z-index:\s*120[\s\S]*?\.side-panel-backdrop \{[\s\S]*?z-index:\s*110;[\s\S]*?\.side-panel \{[\s\S]*?z-index:\s*111;/, "mobile side-panel controls should not hide behind terminal header buttons");
|
|
373
424
|
assert.match(css, /button, select, input \{ min-height: 44px; \}/, "base controls should meet 44px touch-target height");
|
|
374
|
-
|
|
425
|
+
// Intent superseded: Phase 0 raises all phone/coarse composer hit areas to 44px.
|
|
426
|
+
assert.match(css, /\.composer-row button \{\n\s+width:\s*100%;\n\s+min-height:\s*44px/, "mobile composer buttons should retain compact layout with 44px footer hit areas");
|
|
375
427
|
assert.match(css, /\.composer-abort-button,\n\.composer-row button\.primary \{[\s\S]*?min-width:/, "Abort and Send should share stable bottom-row sizing");
|
|
376
428
|
assert.match(css, /\.composer-abort-button\.long-pressing::after[\s\S]*?animation:\s*abort-long-press-fill var\(--abort-long-press-duration, 3000ms\) linear forwards/, "Abort should expose a visible 3-second long-press progress affordance");
|
|
377
429
|
assert.match(css, /body\.pi-run-active:not\(\.mobile-keyboard-open\) \.composer-abort-button:not\(\[hidden\]\) \{\n\s+order:\s*1;\n\s+grid-column:\s*span 2;/, "active mobile runs should move Abort to the top row");
|
|
@@ -379,8 +431,14 @@ assert.match(css, /body\.pi-run-active:not\(\.mobile-keyboard-open\) \.composer-
|
|
|
379
431
|
assert.match(css, /#promptInput \{[\s\S]*?min-height:\s*calc\(1\.5em \+ 1\.8rem\)/, "prompt input should default to a compact single-line height");
|
|
380
432
|
assert.match(css, /#promptInput \{[\s\S]*?overflow-y:\s*hidden/, "prompt input should be JS-resized instead of showing a scrollbar by default");
|
|
381
433
|
assert.match(css, /\.composer-context-tags \{[\s\S]*?top:\s*-0\.48rem;[\s\S]*?left:\s*0\.75rem;/, "busy prompt behavior and skill tags should sit at the top-left of the input frame");
|
|
434
|
+
assert.match(css, /\.composer-context-tags \{[^}]*width:\s*calc\(100% - 4\.5rem\);[^}]*min-width:\s*0;[^}]*pointer-events:\s*none;/, "context tags should claim the available prompt-frame width while leaving empty overlay space clickable through to the prompt");
|
|
435
|
+
assert.match(css, /\.composer-busy-mode-tag,[\s\S]*?\.composer-workflow-mode-chip \{\s*pointer-events:\s*auto;/, "interactive context chips should remain clickable through the pointer-transparent full-width overlay");
|
|
436
|
+
assert.match(css, /\.composer-skill-tags \{[^}]*flex:\s*1 1 0;[^}]*overflow:\s*hidden;/, "skill tag strips should use the true leftover context-tag width without squeezing sibling chips");
|
|
382
437
|
assert.match(css, /\.composer-busy-mode-tag \{[\s\S]*?var\(--ctp-crust\)/, "busy prompt behavior tag should use an opaque base background");
|
|
383
|
-
assert.match(css, /\.composer-skill-tag \{[\s\S]*?var\(--ctp-crust\)/, "skill tags should
|
|
438
|
+
assert.match(css, /\.composer-skill-tag \{[^}]*flex:\s*0 0 auto;[\s\S]*?var\(--ctp-crust\)/, "skill tags should preserve their natural chip widths inside the responsive strip");
|
|
439
|
+
assert.doesNotMatch(app, /SKILL_TAG_MAX_VISIBLE/, "skill tag visibility should not remain capped at a fixed count");
|
|
440
|
+
assert.match(app, /function fitSessionSkillTags\(\)[\s\S]*?availableWidth = container\.clientWidth[\s\S]*?maxOverflowDigits = String\(tags\.length\)\.length[\s\S]*?requiredWidth <= availableWidth \+ 0\.5/, "skill tags should fit their visible count to the measured input width with bounded overflow-chip measurements");
|
|
441
|
+
assert.match(app, /function installSessionSkillTagResizeHandling\(\)[\s\S]*?new ResizeObserver\(scheduleSessionSkillTagLayout\)[\s\S]*?observe\(container\.parentElement\)/, "skill tag fitting should rerun when the composer tag strip changes width");
|
|
384
442
|
assert.match(css, /\.composer-feature-category-tag \{[\s\S]*?var\(--ctp-crust\)[\s\S]*?\.composer-feature-category-tag\.complex-feature \{[\s\S]*?var\(--ctp-mauve\)[\s\S]*?\.composer-feature-category-tag\[hidden\]/, "feature category tags should use the existing composer-tag frame with a distinct complex state and hidden default");
|
|
385
443
|
assert.match(css, /button\.composer-skill-tag:hover,[\s\S]*?button\.composer-skill-tag:focus-visible/, "skill tags should be styled as clickable controls");
|
|
386
444
|
assert.match(css, /\.extension-dialog\.skill-editor-dialog \{[\s\S]*?--skill-editor-size:\s*min\(152rem[\s\S]*?width:\s*var\(--skill-editor-size\);[\s\S]*?height:\s*var\(--skill-editor-size\);[\s\S]*?aspect-ratio:\s*1 \/ 1/, "skill editor should use a square viewport-bounded modal layout");
|
|
@@ -456,7 +514,7 @@ assert.match(css, /\.subagents-help \{[\s\S]*border-left:[\s\S]*font-size:\s*0\.
|
|
|
456
514
|
assert.match(css, /\.subagent-launch-slots \{[\s\S]*\.subagent-launch-slot-role \{[\s\S]*\.subagent-launch-slot-controls \{[\s\S]*grid-template-columns: repeat\(2, minmax\(0, 1fr\)\)/, "launch-slot cards should group role slots with paired model and thinking controls");
|
|
457
515
|
assert.match(css, /@media \(max-width: 720px\), \(max-device-width: 720px\), \(pointer: coarse\) and \(hover: none\) \{[\s\S]*min-height: 44px[\s\S]*\.subagent-launch-slot-scope,[\s\S]*\.subagent-launch-slot-row,[\s\S]*\.subagent-launch-slot-controls \{ grid-template-columns: minmax\(0, 1fr\); \}/, "launch-slot controls should stack with coarse-pointer touch targets");
|
|
458
516
|
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");
|
|
459
|
-
assert.match(css, /\.subagent-gate-card[\s\S]*\.subagent-gate-
|
|
517
|
+
assert.match(css, /\.subagent-gate-card \{[\s\S]*gap: 0\.12rem;[\s\S]*background: transparent;[\s\S]*\.subagent-gate-title \{[\s\S]*display: flex;[\s\S]*\.subagent-gate-attempt \{[\s\S]*min-height: 1\.68rem;[\s\S]*background: transparent;[\s\S]*\.subagent-gate-attempt-identity \{[\s\S]*white-space: nowrap;/, "retry gates should use compact, flat, single-line attempt rows");
|
|
460
518
|
assert.match(css, /\.subagent-agent-row:hover,[\s\S]*\.subagent-agent-row:focus-visible/, "subagent rows should expose clickable hover and keyboard focus states");
|
|
461
519
|
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");
|
|
462
520
|
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");
|
|
@@ -464,7 +522,8 @@ assert.match(css, /body\.subagent-terminal-active \.workspace-dashboard,[\s\S]*b
|
|
|
464
522
|
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");
|
|
465
523
|
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");
|
|
466
524
|
assert.doesNotMatch(css, /\.extension-dialog\.subagent-overlay-dialog/, "subagent output should not retain blocking dialog styles");
|
|
467
|
-
assert.match(css,
|
|
525
|
+
assert.match(css, /\.subagent-running-dot \{[\s\S]*background: var\(--ctp-yellow\);[\s\S]*animation: subagent-running-pulse/, "running subagents should expose a blinking yellow activity indicator");
|
|
526
|
+
assert.match(css, /@keyframes subagent-running-pulse/, "running subagents should expose a live activity animation");
|
|
468
527
|
assert.match(css, /\.optional-feature-pill\.enabled/, "optional features should visually distinguish enabled state");
|
|
469
528
|
assert.match(css, /\.todo-widget \{[\s\S]*?display:\s*grid/, "todo-progress widget should render as a styled checklist card");
|
|
470
529
|
assert.match(css, /\.todo-widget-summary \{[\s\S]*?cursor:\s*pointer/, "todo-progress widget should expose a compact expandable summary");
|
|
@@ -541,11 +600,12 @@ assert.match(css, /@media \(max-width: 720px\) \{[\s\S]*?\.command-palette-dialo
|
|
|
541
600
|
assert.match(css, /@media \(max-width: 720px\) \{[\s\S]*?\.command-palette-item-kind \{[\s\S]*?font-size:\s*var\(--text-xs\);[\s\S]*?\.command-palette-item-label \{ font-size:\s*0\.82rem; \}[\s\S]*?\.command-palette-item-description \{ font-size:\s*var\(--text-xs\); \}/, "mobile command palette result text should respect the typography floor");
|
|
542
601
|
assert.match(css, /body\.terminal-tabs-left \.chat-panel \{[\s\S]*?grid-template-columns:\s*clamp\(13rem, 18vw, 19rem\) minmax\(0, 1fr\)/, "terminal tabs left layout should split the chat panel into a sidebar and transcript area");
|
|
543
602
|
assert.match(css, /body\.terminal-tabs-left \.terminal-tabs-shell \{[\s\S]*?grid-column:\s*1;[\s\S]*?grid-row:\s*1 \/ -1;[\s\S]*?flex-direction:\s*column/, "terminal tabs left layout should turn the top tab strip into a vertical sidebar");
|
|
544
|
-
assert.match(html, /class="terminal-sidebar-actions"[^>]*aria-label="Tab and workspace actions"[\s\S]*id="splitTabButton"[
|
|
545
|
-
assert.
|
|
603
|
+
assert.match(html, /class="terminal-sidebar-actions"[^>]*aria-label="Tab and workspace actions"[\s\S]*id="splitTabButton"[^>]*aria-label="Split the active terminal to the right"[\s\S]*id="workspaceSaveButton"[^>]*aria-label="Save workspace"[\s\S]*id="commandPaletteButton"[^>]*aria-label="Open command palette"[\s\S]*id="workspaceDashboardToggleButton"[^>]*aria-label="Show workspace overview"/, "tab, save, command, and workspace actions should share one accessibly labelled sidebar toolbar");
|
|
604
|
+
assert.doesNotMatch(html, /terminal-sidebar-action-label/, "left-sidebar action buttons should be icon-only without redundant visible labels");
|
|
605
|
+
assert.match(css, /body\.terminal-tabs-left \.terminal-sidebar-actions \{[\s\S]*?display:\s*grid;[\s\S]*?grid-template-columns:\s*repeat\(4, minmax\(0, 1fr\)\);[\s\S]*?body\.terminal-tabs-left \.terminal-sidebar-actions > button \{[\s\S]*?place-items:\s*center;[\s\S]*?min-height:\s*2\.75rem;[\s\S]*?padding:\s*0\.42rem;/, "left-sidebar actions should render as compact equal-width icon buttons with 44px targets");
|
|
546
606
|
assert.match(css, /@media \(min-width: 721px\) \{[\s\S]*?body\.terminal-tabs-left \.terminal-sidebar-actions \{[\s\S]*?z-index:\s*130;[\s\S]*?overflow:\s*visible;[\s\S]*?terminal-workspace-save-button\[data-tooltip\]::after,[\s\S]*?terminal-command-palette-button\[data-tooltip\]::after,[\s\S]*?terminal-dashboard-button\[data-tooltip\]::after \{[\s\S]*?bottom:\s*calc\(100% \+ 0\.62rem\);[\s\S]*?z-index:\s*220;[\s\S]*?width:\s*calc\(400% \+ 1\.26rem\);/, "left-sidebar save, command, and overview tooltips should render above the full toolbar without clipping");
|
|
547
607
|
assert.match(css, /terminal-workspace-save-button\[data-tooltip\]::after \{\s+left:\s*calc\(-100% - 0\.42rem\);[\s\S]*?terminal-command-palette-button\[data-tooltip\]::after \{\s+left:\s*calc\(-200% - 0\.84rem\);[\s\S]*?terminal-dashboard-button\[data-tooltip\]::after \{\s+left:\s*calc\(-300% - 1\.26rem\);/, "left-sidebar tooltips should align to the toolbar edges from their individual buttons");
|
|
548
|
-
assert.match(
|
|
608
|
+
assert.match(app, /elements\.splitTabButton\.setAttribute\("aria-pressed", canShowSplit \? "true" : "false"\);[\s\S]*?applyStyledTooltip\(elements\.splitTabButton, label, \{ ariaLabel: label \}\);/, "icon-only split action should expose its Split or Close state through accessibility text and the tooltip");
|
|
549
609
|
assert.match(css, /body\.terminal-tabs-left \.terminal-close-all-button \{[\s\S]*?margin-top:\s*0;[\s\S]*?justify-content:\s*center;[\s\S]*?text-align:\s*center;/, "left-sidebar close-all action should remain a separate centered destructive row");
|
|
550
610
|
assert.match(css, /body\.terminal-tabs-left \.terminal-tabs \{[\s\S]*?flex-direction:\s*column/, "terminal tabs left layout should stack tabs vertically");
|
|
551
611
|
assert.match(css, /body\.terminal-tabs-left \.terminal-tab-group-menu \{[\s\S]*?inset:\s*0 auto auto 100%;[\s\S]*?padding-left:\s*var\(--terminal-left-dropdown-bridge\)/, "left-sidebar grouped tab menus should include a hover bridge so they do not vanish between button and dropdown");
|
|
@@ -631,7 +691,8 @@ assert.match(css, /\.footer-model-picker[\s\S]*?position:\s*absolute[\s\S]*?left
|
|
|
631
691
|
assert.match(css, /@media \(max-width: 720px\), \(max-device-width: 720px\), \(pointer: coarse\) and \(hover: none\)[\s\S]*?\.footer-model-picker \{[\s\S]*?position:\s*fixed/, "mobile footer model picker should escape footer-details stacking as a fixed overlay on narrow, device-width-narrow, or touch-only devices");
|
|
632
692
|
assert.match(css, /bottom:\s*var\(--footer-model-picker-bottom/, "mobile footer model picker should be anchored by a JS-computed viewport offset");
|
|
633
693
|
assert.match(css, /\.footer-model-option\.active/, "footer model picker should style the selected scoped model");
|
|
634
|
-
assert.match(css, /\.
|
|
694
|
+
assert.match(css, /\.side-panel-controls \.model-search-result \{[\s\S]*?align-content:\s*center;[\s\S]*?min-height:\s*3\.2rem;[\s\S]*?padding:\s*0\.48rem 0\.62rem;/, "side-panel model rows should override generic control-button sizing and center both text lines");
|
|
695
|
+
assert.match(css, /\.model-search-result-main,\n\.model-search-result-name \{[\s\S]*?line-height:\s*1\.4;/, "side-panel model titles should reserve enough line height to avoid clipping heavy font glyphs");
|
|
635
696
|
assert.match(app, /async function createPathPickerDirectory\(\)/, "cwd picker should implement create-directory behavior in the browser");
|
|
636
697
|
assert.match(app, /function renderPathPickerDirectoryList\(\)[\s\S]*pathPickerDirectoryMatchesSearch/, "cwd picker should filter current-directory entries in the browser");
|
|
637
698
|
assert.match(app, /elements\.pathPickerSearchInput\.addEventListener\("input", renderPathPickerDirectoryList\)/, "cwd picker should update directory matches as the user types");
|
|
@@ -673,7 +734,8 @@ assert.match(app, /const MOBILE_VIEW_QUERY = "\(max-width: 720px\), \(max-device
|
|
|
673
734
|
assert.match(app, /const SIDE_PANEL_OVERLAY_QUERY = "\(max-width: 1050px\), \(max-device-width: 720px\), \(pointer: coarse\) and \(hover: none\)"/, "side-panel overlay mode should also activate at the stacked narrow layout breakpoint");
|
|
674
735
|
assert.match(app, /function isSidePanelOverlayView\(\)[\s\S]*sidePanelOverlayMedia\?\.matches/, "side-panel overlay detection should be separate from full mobile mode");
|
|
675
736
|
assert.match(app, /const showBackdrop = !collapsed && isSidePanelOverlayView\(\)/, "side-panel backdrop should show for the overlay breakpoint, not only phone layouts");
|
|
676
|
-
|
|
737
|
+
// Intent preserved for legacy; v2 suppresses this legacy surface writer.
|
|
738
|
+
assert.match(app, /function restoreSidePanelState\(\) \{\n\s+if \(isMobileShellV2Active\(\)\) return;\n\s+if \(isSidePanelOverlayView\(\)\) \{\n\s+setSidePanelCollapsed\(true, \{ persist: false \}\);/, "legacy side-panel should start collapsed in narrow overlay mode");
|
|
677
739
|
assert.match(app, /function bindSidePanelOverlayViewChanges\(\)/, "side-panel overlay breakpoint changes should be monitored separately from full mobile changes");
|
|
678
740
|
assert.match(app, /if \(isSidePanelOverlayView\(\) && !document\.body\.classList\.contains\("side-panel-collapsed"\)\)/, "Escape should close the side-panel overlay at narrow widths");
|
|
679
741
|
assert.match(app, /const THEME_STORAGE_KEY = "pi-webui-theme"/, "theme selection should be persisted in browser storage");
|
|
@@ -749,7 +811,7 @@ assert.match(server, /PI_WEBUI_RESTORE_TABS: JSON\.stringify\(restorableTabs \|\
|
|
|
749
811
|
assert.match(server, /if \(webuiDevServer\) env\.PI_WEBUI_DEV = "1";/, "server restart should explicitly preserve dev mode");
|
|
750
812
|
assert.match(server, /async function piUpdateCommandSupportsAll\(command\)[\s\S]*runCommand\(command\.command, command\.args \|\| \[\][\s\S]*piUpdateHelpSupportsAll/, "server should check the selected Pi executable's update help");
|
|
751
813
|
assert.match(server, /const supportsAll = all && await piUpdateCommandSupportsAll\(await resolveCommand\(\["update", "--help"\]\)\)[\s\S]*piUpdateCommandSteps\(\{ all, supportsAll \}\)/, "server should prefer --all only when the capability check succeeds");
|
|
752
|
-
assert.match(server, /async function resolveUpdateTasks\(\{ all = false \} = \{\}\)[\s\S]*const piTasks = await resolvePiUpdateCommands\(\{ all \}\)[\s\S]*if \(!all\) return uniqueUpdateTasks\(piTasks\)[\s\S]*currentWebuiPackageUpdateTask\(\)[\s\S]*agentPackageRootUpdateTask\(\)[\s\S]*projectPackageRootUpdateTasks\(\)[\s\S]*npmGlobalPackageRootUpdateTask\(\)[\s\S]*bunGlobalPackageRootUpdateTask\(\)/, "server all-update should run the selected Pi plan plus detected local/global Pi package root tasks");
|
|
814
|
+
assert.match(server, /async function resolveUpdateTasks\(\{ all = false \} = \{\}\)[\s\S]*const piTasks = await resolvePiUpdateCommands\(\{ all \}\)[\s\S]*if \(!all\) return uniqueUpdateTasks\(piTasks\)[\s\S]*currentWebuiPackageUpdateTask\(npmRuntime\)[\s\S]*agentPackageRootUpdateTask\(npmRuntime\)[\s\S]*projectPackageRootUpdateTasks\(npmRuntime\)[\s\S]*npmGlobalPackageRootUpdateTask\(npmRuntime\)[\s\S]*bunGlobalPackageRootUpdateTask\(\)/, "server all-update should run the selected Pi plan plus detected local/global Pi package root tasks with install-aware npm resolution");
|
|
753
815
|
assert.match(server, /const UPDATE_PACKAGE_NAMES = \[\.\.\.new Set\(\[[\s\S]*WEBUI_CONTROLLED_PACKAGES[\s\S]*OPTIONAL_FEATURE_PACKAGES\.values\(\)/, "package-inclusive updates should include Web UI controlled Optional Feature packages");
|
|
754
816
|
assert.match(app, /const commandText = all \? '"pi update --all" when supported, otherwise "pi update --self" followed by "pi update --extensions"' : '"pi update --self"'/, "frontend update confirmation should describe capability selection and fallback");
|
|
755
817
|
assert.match(app, /Optional Features, and detected Pi package roots/, "frontend all-update confirmation should describe optional-feature and detected-root coverage");
|
|
@@ -845,15 +907,87 @@ assert.match(
|
|
|
845
907
|
);
|
|
846
908
|
assert.match(app, /function renderCodexUsage\(\)/, "frontend should render Codex usage buckets in the side panel");
|
|
847
909
|
assert.match(app, /function renderSubagents\(\)[\s\S]*subagentTabsWithRunningAgents\(\)[\s\S]*totalGates[\s\S]*renderSubagentTabGroup\(tab\)/, "frontend should group running subagents and retained retry gates by terminal and session");
|
|
848
|
-
assert.match(app, /function renderSubagents\(\)[\s\S]*latestSubagents\?\.runningAgents[\s\S]*subagentCountBadge\.textContent = String\(totalAgents\)/, "the subagent count badge should count running agents
|
|
849
|
-
|
|
850
|
-
|
|
910
|
+
assert.match(app, /function renderSubagents\(\)[\s\S]*latestSubagents\?\.runningAgents[\s\S]*subagentCountBadge\.textContent = String\(totalAgents\)/, "the subagent count badge should count running agents once while retry-gated attempts render only inside their gate");
|
|
911
|
+
const compactSubagentAgentSource = appFunctionSource("renderSubagentAgent", "renderSubagentRun");
|
|
912
|
+
const compactSubagentRunSource = appFunctionSource("renderSubagentRun", "subagentGateStatusLabel");
|
|
913
|
+
assert.match(compactSubagentAgentSource, /const \[model, thinking\] = subagentExecutionValues\(agent\)[\s\S]*identity\.append\([\s\S]*"subagent-agent-name", name[\s\S]*"subagent-agent-inline-meta", `· \$\{model\} · \$\{thinking\}`[\s\S]*row\.append\(dot, identity, open\)/, "side-panel agent rows should show type, provider\/model, and thinking effort on one compact line");
|
|
914
|
+
assert.doesNotMatch(compactSubagentAgentSource, /subagent-agent-meta|subagentExecutionFacts|subagentSourceLabel|subagentRunElapsed|currentTool/, "side-panel agent rows should leave all other execution metadata to the selected subagent view");
|
|
915
|
+
assert.doesNotMatch(compactSubagentRunSource, /subagent-run-(?:header|title|meta|state)|`Run \$\{/, "side-panel run groups should not repeat IDs, metadata headers, or state badges");
|
|
916
|
+
assert.match(compactSubagentRunSource, /Dismiss finished run[\s\S]*dismissSubagentRun\(tab, run\)/, "compact terminal subagent runs should retain their dismiss action");
|
|
917
|
+
assert.match(compactSubagentRunSource, /subagentRunCanCancel\(run\)[\s\S]*Cancel entire subagent run[\s\S]*openSubagentCancelDialog\(tab, run\)/, "compact running subagent runs should retain whole-run cancellation through the shared dialog");
|
|
918
|
+
assert.match(app, /function renderSubagentTerminalView\(\)[\s\S]*subagentRunElapsed\(view\.run\)[\s\S]*subagentExecutionFacts\(agent\)[\s\S]*parent \$\{parent\?\.title[\s\S]*run \$\{view\.runId\}/, "the dedicated subagent view should own elapsed, execution, parent, and run details removed from the side panel");
|
|
919
|
+
const subagentTerminalViewGroupsSource = appFunctionSource("subagentTerminalViewGroups", "renderSubagentTerminalTab");
|
|
920
|
+
const subagentTerminalGroupingContext = vm.createContext({
|
|
921
|
+
subagentTerminalViews: new Map([
|
|
922
|
+
["a-1", { id: "a-1", parentTabId: "workspace-a", parentTitle: "Workspace A", openedAt: 1 }],
|
|
923
|
+
["b-1", { id: "b-1", parentTabId: "workspace-b", parentTitle: "Workspace B", openedAt: 2 }],
|
|
924
|
+
["a-2", { id: "a-2", parentTabId: "workspace-a", parentTitle: "Workspace A", openedAt: 3 }],
|
|
925
|
+
]),
|
|
926
|
+
});
|
|
927
|
+
vm.runInContext(`${subagentTerminalViewGroupsSource}\nthis.groupedSubagentViews = subagentTerminalViewGroups();`, subagentTerminalGroupingContext);
|
|
928
|
+
assert.deepEqual(JSON.parse(JSON.stringify(subagentTerminalGroupingContext.groupedSubagentViews.map((group) => ({ key: group.key, parentTabId: group.parentTabId, viewIds: group.views.map((view) => view.id) })))), [
|
|
929
|
+
{ key: "subagents:workspace-a", parentTabId: "workspace-a", viewIds: ["a-1", "a-2"] },
|
|
930
|
+
{ key: "subagents:workspace-b", parentTabId: "workspace-b", viewIds: ["b-1"] },
|
|
931
|
+
], "dedicated subagent views should group only with siblings spawned by the same parent workspace");
|
|
932
|
+
assert.match(app, /function renderTabs\(\)[\s\S]*const subagentGroups = subagentTerminalViewGroups\(\)[\s\S]*group\.views\.length > 1[\s\S]*renderSubagentTerminalTabGroup\(group\)[\s\S]*renderSubagentTerminalTab\(group\.views\[0\]\)/, "the tab strip should collapse same-workspace subagent siblings while leaving a single view standalone");
|
|
933
|
+
const renderSubagentTerminalTabSource = appFunctionSource("renderSubagentTerminalTab", "renderSubagentTerminalTabGroup");
|
|
934
|
+
assert.match(renderSubagentTerminalTabSource, /groupItem = false[\s\S]*terminal-tab-group-item[\s\S]*terminal-tab-group-item-button[\s\S]*activateSubagentTerminalView\(view\.id\)/, "subagent tabs should remain individually activatable inside a workspace group menu");
|
|
935
|
+
const renderSubagentTerminalTabGroupSource = appFunctionSource("renderSubagentTerminalTabGroup", "openSubagentOutput");
|
|
936
|
+
assert.match(renderSubagentTerminalTabGroupSource, /groupViews\.filter\(subagentTerminalViewIsRunning\)[\s\S]*group\.parentTitle[\s\S]*terminal-tab-subagent-group[\s\S]*count: groupViews\.length[\s\S]*renderSubagentTerminalTab\(view, \{ groupItem: true \}\)/, "workspace subagent groups should expose their parent title, aggregate state, count, and child-view menu");
|
|
937
|
+
const closeSubagentTerminalGroupStart = app.indexOf("function closeSubagentTerminalGroup(");
|
|
938
|
+
const closeSubagentTerminalGroupEnd = app.indexOf("\nasync function copySubagentTerminalOutput(", closeSubagentTerminalGroupStart);
|
|
939
|
+
assert.ok(closeSubagentTerminalGroupStart >= 0 && closeSubagentTerminalGroupEnd > closeSubagentTerminalGroupStart, "closeSubagentTerminalGroup should remain a standalone frontend helper");
|
|
940
|
+
const closeSubagentTerminalGroupSource = app.slice(closeSubagentTerminalGroupStart, closeSubagentTerminalGroupEnd);
|
|
941
|
+
assert.match(closeSubagentTerminalGroupSource, /subagentTerminalViews\.delete\(view\.id\)[\s\S]*renderTabs\(\)/, "closing a workspace subagent group should remove its view tabs as one UI operation");
|
|
942
|
+
assert.doesNotMatch(closeSubagentTerminalGroupSource, /cancel|\/api\/subagents/, "closing a workspace subagent group must not stop its child runs");
|
|
943
|
+
assert.match(css, /\.subagent-tab-title \{[\s\S]*container-type: inline-size;[\s\S]*flex: 1 1 0;[\s\S]*min-width: 0;[\s\S]*\.subagent-tab-title strong \{[\s\S]*font-size: clamp\(0\.64rem, calc\(0\.5rem \+ 0\.65cqi\), 0\.78rem\);[\s\S]*\.subagent-tab-count \{[\s\S]*flex: 0 0 auto;[\s\S]*white-space: nowrap;/, "subagent titles should scale with their available inline width while summary badges stay fixed and text can still truncate");
|
|
944
|
+
assert.match(css, /\.subagent-agent-list \{[\s\S]*gap: 0\.16rem;[\s\S]*\.subagent-agent-row \{[\s\S]*min-height: 1\.75rem;[\s\S]*background: transparent;[\s\S]*\.subagent-agent-identity \{[\s\S]*display: flex;[\s\S]*white-space: nowrap;[\s\S]*\.subagent-agent-inline-meta \{[\s\S]*text-overflow: ellipsis;[\s\S]*white-space: nowrap;[\s\S]*\.subagent-run \{[\s\S]*grid-template-columns: minmax\(0, 1fr\) auto;[\s\S]*border: 0;/, "the inline subagent monitor should keep type, model, and effort in compact flat rows without overflow");
|
|
851
945
|
assert.match(app, /function renderSubagentOverlayWidget\(\)[\s\S]*openSubagentCancelDialog\(tab, selection\.run, agent\)[\s\S]*subagent-overlay-cancel-action/, "running overlays should route cancel through the shared dialog");
|
|
852
946
|
assert.match(app, /subagentTerminalCancelButton[\s\S]*openSubagentCancelDialog\(view\.tab \|\| \{ tabId: view\.parentTabId, tabTitle: view\.parentTitle \}, view\.run, view\.data\?\.agent \|\| view\.agent\)/, "running terminal headers should route cancel through the shared dialog");
|
|
853
947
|
assert.match(app, /function openSubagentCancelDialog\(tab, run, agent = null\)[\s\S]*agentCount[\s\S]*The entire run will be stopped[\s\S]*subagentCancelDialog\.showModal\(\)[\s\S]*async function submitSubagentCancel\(\)[\s\S]*api\("\/api\/subagents\/cancel", \{[\s\S]*method: "POST",[\s\S]*scoped: false,[\s\S]*tab: selection\.tabId,[\s\S]*runId: selection\.runId/, "the shared cancel dialog should honestly describe and submit whole-run cancellation with optional reason/note data");
|
|
854
948
|
assert.doesNotMatch(app, /body: \{\n\s+tab: selection\.tabId,\n\s+runId: selection\.runId,\n\s+\.\.\.\(selection\.agentId/, "the frontend must not imply unsupported per-agent cancellation in its request contract");
|
|
855
949
|
assert.match(app, /async function dismissSubagentRun\(tab, run\)[\s\S]*api\("\/api\/subagents\/dismiss", \{[\s\S]*method: "POST",[\s\S]*scoped: false,[\s\S]*body: \{ tab: tab\.tabId, runId: run\.id \}/, "finished-run dismiss controls should call the owning tab endpoint");
|
|
856
|
-
assert.match(app, /function
|
|
950
|
+
assert.match(app, /function finishedSubagentRunSelections\(data = latestSubagents\)[\s\S]*ungatedSubagentRuns\(tab\)[\s\S]*run\.status !== "running" && run\.source !== "workflow"[\s\S]*async function clearFinishedSubagentRuns\(\)[\s\S]*for \(const selection of selections\)[\s\S]*api\("\/api\/subagents\/dismiss", \{[\s\S]*body: \{ tab: selection\.tabId, runId: selection\.runId \}[\s\S]*subagentsClearFinishedButton\.disabled = subagentsLoading \|\| subagentsClearingFinished \|\| finishedRuns\.length === 0/, "clear-finished should dismiss visible terminal ordinary runs while preserving retry-gated, active, and workflow runs");
|
|
951
|
+
assert.match(app, /subagentsClearFinishedButton\?\.addEventListener\("click", \(\) => \{[\s\S]*clearFinishedSubagentRuns\(\)/, "the clear-finished button should invoke the guarded bulk dismissal action");
|
|
952
|
+
assert.match(css, /\.subagents-status-row \{[\s\S]*display: flex;[\s\S]*\.subagents-clear-finished-button \{[\s\S]*min-height: 2rem;/, "the clear-finished control should share a compact responsive status row");
|
|
953
|
+
const clearFinishedSourceStart = app.indexOf("function finishedSubagentRunSelections(");
|
|
954
|
+
const clearFinishedSourceEnd = app.indexOf("\nfunction subagentOverlayTranscriptMessages(", clearFinishedSourceStart);
|
|
955
|
+
assert.ok(clearFinishedSourceStart >= 0 && clearFinishedSourceEnd > clearFinishedSourceStart, "clear-finished helpers should remain independently testable");
|
|
956
|
+
const clearFinishedCalls = [];
|
|
957
|
+
const clearFinishedEvents = [];
|
|
958
|
+
let clearFinishedRefreshes = 0;
|
|
959
|
+
const clearFinishedContext = {
|
|
960
|
+
latestSubagents: {
|
|
961
|
+
tabs: [
|
|
962
|
+
{ tabId: "tab-a", runs: [{ id: "done-a", status: "done", source: "async" }, { id: "running-a", status: "running", source: "async" }, { id: "workflow-a", status: "done", source: "workflow" }, { id: "gated-a", status: "done", source: "async" }], gates: [{ attempts: [{ runId: "gated-a" }] }] },
|
|
963
|
+
{ tabId: "tab-b", runs: [{ id: "failed-b", status: "failed", source: "foreground" }, { id: "cancelled-b", status: "cancelled", source: "async" }] },
|
|
964
|
+
],
|
|
965
|
+
},
|
|
966
|
+
ungatedSubagentRuns(tab) {
|
|
967
|
+
const gatedRunIds = new Set((tab.gates || []).flatMap((gate) => (gate.attempts || []).map((attempt) => attempt.runId)));
|
|
968
|
+
return (tab.runs || []).filter((run) => !gatedRunIds.has(run.id));
|
|
969
|
+
},
|
|
970
|
+
subagentsClearingFinished: false,
|
|
971
|
+
subagentsLoading: false,
|
|
972
|
+
refreshSubagentsTimer: null,
|
|
973
|
+
clearTimeout() {},
|
|
974
|
+
renderSubagents() {},
|
|
975
|
+
async api(path, options) { clearFinishedCalls.push({ path, options }); },
|
|
976
|
+
async refreshSubagents() { clearFinishedRefreshes += 1; },
|
|
977
|
+
scheduleRefreshSubagents() {},
|
|
978
|
+
addEvent(message, level) { clearFinishedEvents.push({ message, level }); },
|
|
979
|
+
};
|
|
980
|
+
vm.runInNewContext(`${app.slice(clearFinishedSourceStart, clearFinishedSourceEnd)}\nthis.runClearFinishedSubagentRuns = clearFinishedSubagentRuns;`, clearFinishedContext);
|
|
981
|
+
await clearFinishedContext.runClearFinishedSubagentRuns();
|
|
982
|
+
assert.deepEqual(JSON.parse(JSON.stringify(clearFinishedCalls)), [
|
|
983
|
+
{ path: "/api/subagents/dismiss", options: { method: "POST", scoped: false, body: { tab: "tab-a", runId: "done-a" } } },
|
|
984
|
+
{ path: "/api/subagents/dismiss", options: { method: "POST", scoped: false, body: { tab: "tab-b", runId: "failed-b" } } },
|
|
985
|
+
{ path: "/api/subagents/dismiss", options: { method: "POST", scoped: false, body: { tab: "tab-b", runId: "cancelled-b" } } },
|
|
986
|
+
], "clear-finished should call the existing dismiss endpoint only for visible terminal ordinary runs");
|
|
987
|
+
assert.equal(clearFinishedRefreshes, 1, "clear-finished should refresh the overview once after all dismissals");
|
|
988
|
+
assert.equal(clearFinishedContext.subagentsClearingFinished, false, "clear-finished should always release its in-flight guard");
|
|
989
|
+
assert.deepEqual(clearFinishedEvents, [{ message: "cleared 3 finished subagent runs", level: "info" }]);
|
|
990
|
+
assert.match(app, /function materializeRetainedSubagentTerminalViews\(\)[\s\S]*restoreKey = `\$\{tab\.tabId\}\\u0000\$\{tab\.sessionFile[\s\S]*ungatedSubagentRuns\(tab\)[\s\S]*run\?\.status === "running"[\s\S]*ensureSubagentTerminalView/, "terminal mode should materialize only ungated restored retained agent views once per parent session identity without touching overlay mode");
|
|
857
991
|
assert.match(app, /from "\.\/subagent-launch-slot-state\.mjs"[\s\S]*function renderSubagentLaunchSlots\(\)[\s\S]*function loadSubagentLaunchSlotConfig\([\s\S]*\/api\/subagents\/config/, "launch-slot configuration should have its own browser state and API loader");
|
|
858
992
|
assert.match(app, /function subagentLaunchSlotThinkingForModel\(model\)[\s\S]*modelThinkingLevels/, "launch-slot thinking choices should come from the selected model metadata");
|
|
859
993
|
assert.match(app, /function renderSubagentLaunchSlotCard\(role, slots\)[\s\S]*Default \/ inherit[\s\S]*"Add slot"[\s\S]*Remove/, "role cards should render independent same-role slots and inheritance controls");
|
|
@@ -861,7 +995,36 @@ assert.match(app, /async function saveSubagentLaunchSlotConfig[\s\S]*scope: suba
|
|
|
861
995
|
assert.match(app, /const subagentLaunchSlotReloadTabs = new Set\(\)[\s\S]*subagentLaunchSlotReloadTabs\.add\(activeTabId\)[\s\S]*subagentLaunchSlotReloadTabs\.delete\(activeTabId\)/, "reload-required reminders should survive tab switches until that tab is actually reloaded");
|
|
862
996
|
const subagentOverviewRefreshSource = appFunctionSource("refreshSubagents", "scheduleRefreshSubagents");
|
|
863
997
|
assert.doesNotMatch(subagentOverviewRefreshSource, /subagentLaunchSlot/, "live subagent polling must not recreate or reset the launch-slot editor");
|
|
864
|
-
assert.match(app, /function renderSubagentGateAttempt\(attempt\)[\s\S]*
|
|
998
|
+
assert.match(app, /function renderSubagentGateAttempt\(tab, attempt\)[\s\S]*subagent-gate-attempt-name[\s\S]*subagent-gate-attempt-meta[\s\S]*function renderSubagentGate\(tab, gate\)[\s\S]*"Retry gate"[\s\S]*qualifyingSuccesses/, "frontend should render compact gate identity rows and a minimal quorum summary");
|
|
999
|
+
const subagentGateTargetSource = appFunctionSource("subagentGateAttemptTarget", "subagentGateAttemptExecutionValues");
|
|
1000
|
+
const subagentGateExecutionSource = appFunctionSource("subagentGateAttemptExecutionValues", "openSubagentGateAttemptOutput");
|
|
1001
|
+
const subagentGateOpenSource = appFunctionSource("openSubagentGateAttemptOutput", "renderSubagentGateAttempt");
|
|
1002
|
+
const subagentGateAttemptSource = appFunctionSource("renderSubagentGateAttempt", "renderSubagentGate");
|
|
1003
|
+
assert.match(subagentGateTargetSource, /candidate\?\.id === attempt\.runId[\s\S]*candidate\?\.name === attempt\.agent[\s\S]*agents\.length === 1[\s\S]*return agent\?\.id \? \{ run, agent \} : null/, "retry-gate attempts should resolve their ordinary tracked child run and agent");
|
|
1004
|
+
assert.match(subagentGateExecutionSource, /SETTINGS_THINKING_OPTIONS\.includes\(suffix\)[\s\S]*model = model\.slice\(0, suffixIndex\)[\s\S]*model = `\$\{provider\}\/\$\{model\}`/, "compact gate rows should normalize provider, model, and thinking effort");
|
|
1005
|
+
assert.match(subagentGateAttemptSource, /const target = subagentGateAttemptTarget\(tab, attempt\)[\s\S]*subagentGateAttemptExecutionValues\(attempt\)[\s\S]*attempt\?\.status[\s\S]*retrySafety[\s\S]*subagent-gate-attempt-open/, "compact gate rows should retain title, state, provider\/model, thinking effort, type, and open affordance");
|
|
1006
|
+
assert.doesNotMatch(subagentGateAttemptSource, /attempt\?\.phase|failureKind|attempt\?\.error|`run \$\{attempt/, "compact gate rows should move verbose diagnostics out of the side panel");
|
|
1007
|
+
assert.match(subagentGateOpenSource, /openSubagentOutput\(tab, \{ \.\.\.target\.run, gateAttempt: attempt \}, target\.agent\)/, "opening a gate child should hand its detailed attempt metadata to the standard child output path");
|
|
1008
|
+
assert.match(app, /function subagentGateAttemptViewFacts\(attempt\)[\s\S]*gate attempt[\s\S]*phase[\s\S]*failure[\s\S]*gate error[\s\S]*function subagentOverlayStateFacts[\s\S]*subagentGateAttemptViewFacts\(subagentOverlaySelection\?\.gateAttempt\)[\s\S]*function renderSubagentTerminalView[\s\S]*subagentGateAttemptViewFacts\(view\.gateAttempt\)/, "attempt number, phase, failure class, and error should appear only inside the opened child view");
|
|
1009
|
+
assert.match(app, /function openSubagentOverlay\(tab, run, agent\)[\s\S]*gateAttempt: run\.gateAttempt \|\| null[\s\S]*function ensureSubagentTerminalView\(tab, run, agent\)[\s\S]*gateAttempt: run\.gateAttempt \|\| null/, "overlay and terminal child views should retain gate diagnostics");
|
|
1010
|
+
assert.match(app, /function renderSubagentGate\(tab, gate\)[\s\S]*renderSubagentGateAttempt\(tab, attempt\)/, "retry-gate rendering should retain the owning parent tab needed to open child output");
|
|
1011
|
+
assert.match(css, /button\.subagent-gate-attempt \{ cursor: pointer; \}[\s\S]*button\.subagent-gate-attempt:hover,[\s\S]*button\.subagent-gate-attempt:focus-visible[\s\S]*\.subagent-gate-attempt-open/, "openable retry-gate attempts should expose button hover, keyboard-focus, and arrow affordances");
|
|
1012
|
+
const subagentGateTargetContext = {};
|
|
1013
|
+
vm.runInNewContext(`${subagentGateTargetSource}\nthis.resolveSubagentGateAttempt = subagentGateAttemptTarget;`, subagentGateTargetContext);
|
|
1014
|
+
const gateTargetTab = {
|
|
1015
|
+
tabId: "parent-tab",
|
|
1016
|
+
runs: [
|
|
1017
|
+
{ id: "review-run", agents: [{ id: "review-agent", name: "reviewer" }, { id: "scout-agent", name: "scout" }] },
|
|
1018
|
+
{ id: "single-run", agents: [{ id: "single-agent", name: "delegate" }] },
|
|
1019
|
+
],
|
|
1020
|
+
};
|
|
1021
|
+
assert.equal(subagentGateTargetContext.resolveSubagentGateAttempt(gateTargetTab, { runId: "review-run", agent: "reviewer" })?.agent?.id, "review-agent", "gate attempts should select the matching agent in their tracked run");
|
|
1022
|
+
assert.equal(subagentGateTargetContext.resolveSubagentGateAttempt(gateTargetTab, { runId: "single-run", agent: "reviewer" })?.agent?.id, "single-agent", "single-child gate runs should remain openable if display names differ");
|
|
1023
|
+
assert.equal(subagentGateTargetContext.resolveSubagentGateAttempt(gateTargetTab, { runId: "missing-run", agent: "reviewer" }), null, "a gate attempt should remain non-interactive until its tracked run is available");
|
|
1024
|
+
const subagentGateExecutionContext = { SETTINGS_THINKING_OPTIONS: ["off", "minimal", "low", "medium", "high", "xhigh", "max"] };
|
|
1025
|
+
vm.runInNewContext(`${subagentGateExecutionSource}\nthis.resolveSubagentGateExecution = subagentGateAttemptExecutionValues;`, subagentGateExecutionContext);
|
|
1026
|
+
assert.deepEqual(JSON.parse(JSON.stringify(subagentGateExecutionContext.resolveSubagentGateExecution({ provider: "openrouter", model: "openrouter/moonshotai/kimi-k3:high" }))), ["openrouter/moonshotai/kimi-k3", "high"], "gate rows should split a thinking suffix from a fully qualified model");
|
|
1027
|
+
assert.deepEqual(JSON.parse(JSON.stringify(subagentGateExecutionContext.resolveSubagentGateExecution({ provider: "openrouter", model: "moonshotai/kimi-k3:medium" }))), ["openrouter/moonshotai/kimi-k3", "medium"], "gate rows should add a separately reported provider without duplicating it");
|
|
865
1028
|
assert.match(helper, /async function enrichAsyncSubagentAgent\(run, agent, statusByDir\)[\s\S]*status\.json[\s\S]*agent\.model = subagentModel\(step\.model\)[\s\S]*agent\.thinking = subagentThinking\(step\.thinking\)/, "WebUI helper should enrich async children from effective lifecycle model and reasoning metadata");
|
|
866
1029
|
assert.match(helper, /SUBAGENT_GATE_UPDATE_EVENT[\s\S]*function publicSubagentGates\(\)[\s\S]*failureKind[\s\S]*gates = publicSubagentGates\(\)/, "WebUI helper should publish bounded retry-gate lifecycle data");
|
|
867
1030
|
assert.match(extension, /registerSubagentGate\(pi\)[\s\S]*session_shutdown[\s\S]*subagentGate\.dispose\(\)/, "the WebUI package extension should own the retry-gate tool lifecycle without another extension package");
|
|
@@ -869,9 +1032,9 @@ assert.match(server, /function normalizeWebuiSubagentPayload\(value\)[\s\S]*mode
|
|
|
869
1032
|
assert.match(server, /WEBUI_SUBAGENT_GATE_LIMIT[\s\S]*rawGate\.attempts[\s\S]*failureKind: normalizeWebuiSubagentText\(rawAttempt\.failureKind, 80\)[\s\S]*totalGates/, "server should bound retry gates and expose their cross-tab total");
|
|
870
1033
|
assert.match(server, /function normalizeWebuiSubagentOutput\(value, selection\)[\s\S]*model: normalizeWebuiSubagentText\(rawAgent\.model, 240\)[\s\S]*thinking: normalizeWebuiSubagentText\(rawAgent\.thinking, 40\)/, "server should preserve model and reasoning metadata in selected child output");
|
|
871
1034
|
assert.match(server, /function normalizeWebuiSubagentSource\(value\) \{[\s\S]*value === "foreground" \|\| value === "workflow"[\s\S]*function normalizeWebuiSubagentPayload\(value\)[\s\S]*source: normalizeWebuiSubagentSource\(rawRun\.source\)[\s\S]*function normalizeWebuiSubagentOutput\(value, selection\)[\s\S]*source: normalizeWebuiSubagentSource\(selection\.run\?\.source \|\| value\.source\)/, "server should preserve workflow source in overview and selected-output normalization");
|
|
872
|
-
assert.match(app, /function
|
|
873
|
-
assert.match(app, /function subagentSourceLabel\(source = ""\) \{[\s\S]*source === "foreground" \|\| source === "workflow"[\s\S]*function subagentOverlayStateFacts\(data = subagentOverlayData\)[\s\S]*subagentSourceLabel\(data\?\.source \|\| run\.source\)[\s\S]*function renderSubagentTerminalView\(\)[\s\S]*subagentSourceLabel\(view\.data\?\.source \|\| view\.run\?\.source\)[\s\S]*function renderSubagentTerminalTab\(view\)[\s\S]*subagentSourceLabel\(view\.data\?\.source \|\| view\.run\?\.source\)
|
|
874
|
-
assert.match(
|
|
1035
|
+
assert.match(app, /function subagentExecutionValues\(agent = \{\}\)[\s\S]*model\.slice\(suffixIndex \+ 1\)\.toLowerCase\(\) === thinking\.toLowerCase\(\)[\s\S]*return \[model \|\| "unknown", thinking \|\| "unknown"\][\s\S]*function subagentExecutionFacts\(agent = \{\}\)[\s\S]*model \$\{model\}[\s\S]*reasoning \$\{thinking\}/, "subagent metadata should share honest model\/reasoning values, strip duplicate effort suffixes, and retain unknown fallbacks");
|
|
1036
|
+
assert.match(app, /function subagentSourceLabel\(source = ""\) \{[\s\S]*source === "foreground" \|\| source === "workflow"[\s\S]*function subagentOverlayStateFacts\(data = subagentOverlayData\)[\s\S]*subagentSourceLabel\(data\?\.source \|\| run\.source\)[\s\S]*function renderSubagentTerminalView\(\)[\s\S]*subagentSourceLabel\(view\.data\?\.source \|\| view\.run\?\.source\)[\s\S]*function renderSubagentTerminalTab\(view, \{ groupItem = false \} = \{\}\)[\s\S]*subagentSourceLabel\(view\.data\?\.source \|\| view\.run\?\.source\)/, "one source-label helper should keep overlays and virtual tabs honest after inline metadata is removed");
|
|
1037
|
+
assert.match(compactSubagentAgentSource, /subagentExecutionValues\(agent\)/, "Subagents side-panel rows should reuse the normalized model and reasoning values shown in selected output views");
|
|
875
1038
|
assert.match(app, /function subagentOverlayStateFacts\(data = subagentOverlayData\)[\s\S]*\.\.\.subagentExecutionFacts\(agent\)/, "subagent overlays should show model and reasoning effort");
|
|
876
1039
|
assert.match(app, /function renderSubagentTerminalView\(\)[\s\S]*\.\.\.subagentExecutionFacts\(agent\)/, "dedicated subagent terminal views should show model and reasoning effort");
|
|
877
1040
|
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");
|
|
@@ -881,7 +1044,7 @@ assert.match(app, /function renderWidgets\(\)[\s\S]*renderAppRunnerWidget\(\)[\s
|
|
|
881
1044
|
assert.doesNotMatch(app, /subagentOverlayDialog\.showModal|elements\.subagentOverlayDialog/, "subagent output should not open or depend on a modal dialog");
|
|
882
1045
|
assert.match(app, /api\(`\/api\/subagents\/output\?\$\{query\}`, \{ scoped: false \}\)/, "subagent overlay should fetch selected live output from the owning tab");
|
|
883
1046
|
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");
|
|
884
|
-
assert.match(app, /const facts = \[[\s\S]*view\.finished \? "finished" : running \?
|
|
1047
|
+
assert.match(app, /const facts = \[[\s\S]*view\.finished \? "finished" : running \? `running\$\{elapsed/, "retained completed child views should not keep contradictory running header metadata and live views should include elapsed time");
|
|
885
1048
|
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");
|
|
886
1049
|
const subagentTerminalSignatureSource = appFunctionSource("subagentTerminalViewMeaningfulSignature", "updateSubagentTerminalRefreshState");
|
|
887
1050
|
const subagentTerminalRefreshSource = appFunctionSource("refreshSubagentTerminalView", "deactivateSubagentTerminalView");
|
|
@@ -918,15 +1081,18 @@ assert.equal(unchangedSubagentTabRenderCount, 0, "an unchanged background poll s
|
|
|
918
1081
|
assert.equal(unchangedSubagentElapsedUpdateCount, 1, "an unchanged background poll should refresh only the existing visual elapsed-time node");
|
|
919
1082
|
assert.equal(unchangedSubagentView.loading, false, "an unchanged background poll should still clear its internal loading flag");
|
|
920
1083
|
const subagentTerminalCloseStart = app.indexOf("function closeSubagentTerminalTab(");
|
|
921
|
-
const subagentTerminalCloseEnd = app.indexOf("\
|
|
1084
|
+
const subagentTerminalCloseEnd = app.indexOf("\nfunction closeSubagentTerminalGroup(", subagentTerminalCloseStart);
|
|
922
1085
|
assert.ok(subagentTerminalCloseStart >= 0 && subagentTerminalCloseEnd > subagentTerminalCloseStart, "closeSubagentTerminalTab should remain a standalone frontend helper");
|
|
923
1086
|
const subagentTerminalCloseSource = app.slice(subagentTerminalCloseStart, subagentTerminalCloseEnd);
|
|
924
1087
|
assert.ok(subagentTerminalCloseSource.includes("subagentTerminalViews.delete(viewId)"), "closing a subagent tab should remove only its client-side view record");
|
|
925
1088
|
assert.doesNotMatch(subagentTerminalCloseSource, /\bapi\(|closeTerminalTabs\(|closeSubagentOverlay\(/, "closing a subagent tab must not call backend terminal or subagent lifecycle APIs");
|
|
926
|
-
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
|
|
1089
|
+
assert.match(app, /function renderSubagentTerminalTab\(view, \{ groupItem = false \} = \{\}\)[\s\S]*terminal-tab-subagent[\s\S]*subagent: true[\s\S]*closeSubagentTerminalTab\(view\.id\)/, "standalone and grouped virtual tabs should be marked as subagents and retain a view-only close action");
|
|
927
1090
|
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");
|
|
928
1091
|
assert.match(app, /SUBAGENT_OVERLAY_REFRESH_MS = 1000/, "subagent overlay should poll selected live output at a fast cadence");
|
|
929
|
-
|
|
1092
|
+
const createMessageBubbleSource = appFunctionSource("createMessageBubble", "appendMessage");
|
|
1093
|
+
const appendMessageSource = appFunctionSource("appendMessage", "appendOptimisticUserPrompt");
|
|
1094
|
+
assert.match(createMessageBubbleSource, /renderContent\(body, message\.content, \{ markdown: message\.role === "assistant" \|\| message\.role === "custom" \}\)/, "the reusable message bubble renderer must retain Markdown-capable main output");
|
|
1095
|
+
assert.match(appendMessageSource, /reuseToolExecutionBubble[\s\S]*createMessageBubble\(message, \{ \.\.\.options, segmentId \}\)[\s\S]*appendChatMessageBubble/, "main transcript output should reuse stable tool cards before creating and appending a fresh message bubble");
|
|
930
1096
|
const subagentTranscriptMessagesSource = appFunctionSource("subagentOverlayTranscriptMessages", "subagentOverlayToolArguments");
|
|
931
1097
|
assert.ok(subagentTranscriptMessagesSource.includes("message.role === \"assistant\" || message.role === \"toolResult\""), "subagent overlays should retain structured assistant and tool-result entries");
|
|
932
1098
|
const subagentToolArgumentsSource = appFunctionSource("subagentOverlayToolArguments", "subagentOverlayTranscriptDisplayMessages");
|
|
@@ -966,7 +1132,28 @@ assert.ok(subagentWidgetSource.includes("if (visibleFallbackText) {"), "the widg
|
|
|
966
1132
|
assert.ok(subagentWidgetSource.includes("if (running) appendSubagentRunIndicator(output, { agent, run: selection.run });"), "running subagent widgets should append the shared live activity indicator");
|
|
967
1133
|
assert.match(app, /api\("\/api\/subagents", \{ scoped: false \}\)/, "frontend should refresh the cross-tab subagent overview");
|
|
968
1134
|
assert.match(app, /SUBAGENTS_ACTIVE_REFRESH_MS = 1500/, "running subagents should receive a fast live refresh cadence");
|
|
969
|
-
assert.match(server, /url\.pathname === "\/api\/subagents" && req\.method === "GET"[\s\S]*webuiSubagentsData\(\)/, "server should
|
|
1135
|
+
assert.match(server, /url\.pathname === "\/api\/subagents" && req\.method === "GET"[\s\S]*await webuiSubagentsData\(\)/, "server should await enriched cross-tab running-subagent titles");
|
|
1136
|
+
assert.match(server, /async function resolveSubagentDisplayTitle\(tab\)[\s\S]*tab\.titleSource !== "auto"[\s\S]*get_messages[\s\S]*message\?\.role === "user"[\s\S]*generatedTabTitleFromPrompt\(extractSessionTextContent\(firstUserMessage\?\.content\)\)/, "existing auto-named subagent groups should recover their longer title from the first user message without relaunching children");
|
|
1137
|
+
assert.match(server, /const tabSummaries = await Promise\.all\([\s\S]*runs\.length \|\| gates\.length \? await resolveSubagentDisplayTitle\(tab\) : tab\.title/, "subagent title recovery should run once for visible run and retry-gate groups");
|
|
1138
|
+
const resolveSubagentDisplayTitleStart = server.indexOf("async function resolveSubagentDisplayTitle(");
|
|
1139
|
+
const resolveSubagentDisplayTitleEnd = server.indexOf("\nasync function webuiSubagentsData(", resolveSubagentDisplayTitleStart);
|
|
1140
|
+
assert.ok(resolveSubagentDisplayTitleStart >= 0 && resolveSubagentDisplayTitleEnd > resolveSubagentDisplayTitleStart, "subagent display-title recovery should remain independently testable");
|
|
1141
|
+
const recoveredSubagentTitle = "Workspace files webui files section sidepanel dynamically adjusted";
|
|
1142
|
+
let subagentTitleMessageReads = 0;
|
|
1143
|
+
const resolveSubagentDisplayTitleContext = vm.createContext({
|
|
1144
|
+
TAB_ACTIVITY_STATE_RECONCILE_TIMEOUT_MS: 1200,
|
|
1145
|
+
safeRpcResponse: async () => {
|
|
1146
|
+
subagentTitleMessageReads += 1;
|
|
1147
|
+
return { data: { messages: [{ role: "user", content: recoveredSubagentTitle }] } };
|
|
1148
|
+
},
|
|
1149
|
+
extractSessionTextContent: (content) => String(content || ""),
|
|
1150
|
+
generatedTabTitleFromPrompt: (message) => message,
|
|
1151
|
+
});
|
|
1152
|
+
vm.runInContext(`${server.slice(resolveSubagentDisplayTitleStart, resolveSubagentDisplayTitleEnd)}\nthis.runResolveSubagentDisplayTitle = resolveSubagentDisplayTitle;`, resolveSubagentDisplayTitleContext);
|
|
1153
|
+
const legacyAutoNamedTab = { title: "Workspace files webui files section sidepan…", titleSource: "auto" };
|
|
1154
|
+
assert.equal(await resolveSubagentDisplayTitleContext.runResolveSubagentDisplayTitle(legacyAutoNamedTab), recoveredSubagentTitle, "existing auto-named rows should recover the wider title from their parent conversation");
|
|
1155
|
+
assert.equal(await resolveSubagentDisplayTitleContext.runResolveSubagentDisplayTitle(legacyAutoNamedTab), recoveredSubagentTitle, "recovered titles should remain available to later panel refreshes");
|
|
1156
|
+
assert.equal(subagentTitleMessageReads, 1, "title recovery should read the existing parent conversation once and must not require spawning another subagent");
|
|
970
1157
|
assert.match(server, /url\.pathname === "\/api\/subagents\/output" && req\.method === "GET"[\s\S]*webuiSubagentOutputData\(tab, runId, agentId\)/, "server should expose selected running subagent output only through its owning tab");
|
|
971
1158
|
assert.match(server, /rememberWebuiSubagentsStatusEvent\(tab, event\)/, "server should ingest the helper's structured subagent status without forwarding internal JSON to the browser footer");
|
|
972
1159
|
assert.match(server, /PI_RPC_JSONL_LINE_MAX_BYTES = 32 \* 1024 \* 1024/, "Pi RPC JSONL parsing should use an explicit line-size limit with inline-image headroom");
|
|
@@ -1019,7 +1206,40 @@ assert.match(app, /chip\.key === "git"[\s\S]*setFooterBranchPickerOpen\(!footerB
|
|
|
1019
1206
|
assert.match(app, /chip\.key === "worktree"[\s\S]*setFooterBranchPickerOpen\(!footerBranchPickerOpen\)[\s\S]*Click to manage branch worktrees/, "worktree footer chip should open the branch worktree picker");
|
|
1020
1207
|
assert.match(app, /function footerPayloadWithLiveModel\(payload\)[\s\S]*const worktreeLabel = gitWorkspaceBadgeLabel\(workspace\)[\s\S]*key: "worktree"/, "git footer payload should inject a live worktree chip from tab metadata");
|
|
1021
1208
|
assert.match(app, /function renderFooterBranchPicker\(\)[\s\S]*Git branches & worktrees[\s\S]*renderFooterWorktreeList\(state\)[\s\S]*renderFooterBranchOption\(branch, state\)/, "git branch picker should render branch worktree controls and local branch choices");
|
|
1022
|
-
assert.match(app, /function renderFooterBranchOption\(branch, state = footerBranchPickerState\)[\s\S]*openFooterBranchOption\(branch, state\)[\s\S]*footer-branch-advanced-action[\s\S]*applyFooterGitBranch\(branch\.name\)/, "branch rows should prefer worktree open/create while keeping an advanced in-place switch action");
|
|
1209
|
+
assert.match(app, /function renderFooterBranchOption\(branch, state = footerBranchPickerState\)[\s\S]*openFooterBranchOption\(branch, state\)[\s\S]*footer-branch-advanced-action[\s\S]*applyFooterGitBranch\(branch\.name, \{ switchingKey: branch\.key \}\)/, "branch rows should prefer worktree open/create while keeping an advanced in-place switch action");
|
|
1210
|
+
const branchPickerRenderKeySource = appFunctionSource("footerBranchPickerRenderKey", "gitFooterPickerStateKey");
|
|
1211
|
+
const branchPickerKeySandbox = { footerBranchPickerOpen: true, footerBranchPickerState: { loading: true, branches: [] } };
|
|
1212
|
+
const loadingBranchPickerKey = vm.runInNewContext(`${branchPickerRenderKeySource}\nfooterBranchPickerRenderKey()`, branchPickerKeySandbox);
|
|
1213
|
+
branchPickerKeySandbox.footerBranchPickerState = { loading: false, branches: [{ name: "main" }] };
|
|
1214
|
+
const loadedBranchPickerKey = vm.runInNewContext("footerBranchPickerRenderKey()", branchPickerKeySandbox);
|
|
1215
|
+
assert.notEqual(loadingBranchPickerKey, loadedBranchPickerKey, "branch picker render key should change when asynchronous branch data replaces loading state");
|
|
1216
|
+
assert.match(appFunctionSource("gitFooterPickerStateKey", "updateGitFooterChipNodeValue"), /footerBranchPickerRenderKey\(\)/, "git footer cache identity should include live branch picker state so the first opening rerenders when loading finishes");
|
|
1217
|
+
const branchSwitchAvailabilitySource = appFunctionSource("footerBranchSwitchAvailability", "renderFooterBranchOption");
|
|
1218
|
+
const branchSwitchAvailability = JSON.parse(vm.runInNewContext(`${branchSwitchAvailabilitySource}\nJSON.stringify({
|
|
1219
|
+
switching: footerBranchSwitchAvailability({ name: "feat/demo" }, { loading: true, switching: "origin/main" }, ""),
|
|
1220
|
+
loading: footerBranchSwitchAvailability({ name: "feat/demo" }, { loading: true, switching: "" }, ""),
|
|
1221
|
+
mainWorktree: footerBranchSwitchAvailability({ name: "feat/demo", mainWorktree: true }, {}, "/repo"),
|
|
1222
|
+
otherWorktree: footerBranchSwitchAvailability({ name: "feat/demo", mainWorktree: false }, {}, "/repo-worktrees/demo"),
|
|
1223
|
+
available: footerBranchSwitchAvailability({ name: "feat/demo" }, {}, ""),
|
|
1224
|
+
})`));
|
|
1225
|
+
assert.equal(branchSwitchAvailability.switching.label, "Action running…", "running branch mutations should expose their exact disabled category");
|
|
1226
|
+
assert.match(branchSwitchAvailability.switching.reason, /origin\/main is still running/, "running branch mutations should name the active branch action");
|
|
1227
|
+
assert.equal(branchSwitchAvailability.loading.label, "Refreshing…", "branch metadata loading should expose a distinct disabled category");
|
|
1228
|
+
assert.match(branchSwitchAvailability.loading.reason, /information finishes loading/, "branch metadata loading should explain when switching becomes available");
|
|
1229
|
+
assert.equal(branchSwitchAvailability.mainWorktree.label, "In main worktree", "main-worktree occupancy should expose a distinct disabled category");
|
|
1230
|
+
assert.match(branchSwitchAvailability.mainWorktree.reason, /main worktree at \/repo/, "main-worktree occupancy should identify the exact checkout path");
|
|
1231
|
+
assert.equal(branchSwitchAvailability.otherWorktree.label, "In another worktree", "secondary-worktree occupancy should expose a distinct disabled category");
|
|
1232
|
+
assert.match(branchSwitchAvailability.otherWorktree.reason, /another worktree at \/repo-worktrees\/demo/, "secondary-worktree occupancy should identify the exact checkout path");
|
|
1233
|
+
assert.deepEqual(branchSwitchAvailability.available, { disabled: false, label: "Switch here", reason: "" }, "unoccupied idle branches should keep Switch here enabled");
|
|
1234
|
+
assert.match(app, /function footerGitBranchKey\(item = \{\}\)[\s\S]*return item\.remote \? `remote:\$\{item\.remoteRef\}` : `local:\$\{item\.name\}`/, "remote branch rows should use their exact remote ref, not local name, as their deduplication identity");
|
|
1235
|
+
assert.match(app, /function normalizeFooterGitBranches\(data = \{\}\)[\s\S]*const remoteRef = cleanFooterPayloadText\(item\?\.remoteRef, "", 4000\);[\s\S]*if \(remote && !remoteRef\) continue;[\s\S]*remoteRef: remote \? remoteRef : "",[\s\S]*remoteName: remote \? cleanStatusText\(item\?\.remoteName\) : "",[\s\S]*displayName: remote \? cleanFooterPayloadText\(item\?\.displayName, remoteRef, 4000\) : name,[\s\S]*const key = footerGitBranchKey\(branch\);[\s\S]*if \(seen\.has\(key\)\) continue;/, "branch normalization should sanitize and retain explicit remote metadata while deduplicating by remote identity");
|
|
1236
|
+
assert.match(app, /function footerBranchOptionLabel\(branch = \{\}\)[\s\S]*cleanStatusText\(branch\.displayName\) \|\| cleanStatusText\(branch\.name\)/, "remote branch rows should visibly prefer the advertised exact remote ref label");
|
|
1237
|
+
assert.match(app, /function footerBranchOptionDetail\(branch, state, \{ selected, worktreePath \} = \{\}\)[\s\S]*if \(branch\.remote\) return `remote-only · creates local branch \$\{branch\.name\} tracking \$\{branch\.remoteRef\}`;/, "remote branch rows should visibly describe the local tracking branch they create");
|
|
1238
|
+
assert.match(app, /function renderFooterBranchOption\(branch, state = footerBranchPickerState\)[\s\S]*remote-only[\s\S]*Remote-only branch \$\{branch\.remoteRef\}: create local branch \$\{branch\.name\} tracking it[\s\S]*Advanced: git switch --track -c \$\{branch\.name\} \$\{branch\.remoteRef\} in this checkout/, "remote branch rows should expose remote-only state and exact-ref tracking actions in visible and accessible text");
|
|
1239
|
+
assert.match(app, /function openFooterBranchOption\(branch, state = footerBranchPickerState\)[\s\S]*if \(branch\.remote\) return createFooterGitBranchWorktree\(branch\.name, \{ skipConfirm: true, chooseBase: false, remoteRef: branch\.remoteRef/, "remote primary actions should forward the advertised exact remote ref to tracking-worktree creation");
|
|
1240
|
+
assert.match(app, /async function createFooterGitBranchWorktree\(branch = footerBranchCreateName\(\), \{[\s\S]*const response = trackedRemoteRef[\s\S]*\? await api\("\/api\/git-worktrees", \{ method: "POST", body: \{ branchName, remoteRef: trackedRemoteRef, sessionMode: "fork-current", openTab: true \}, tabId \}\)[\s\S]*: await api\("\/api\/git-worktrees", \{ method: "POST", body: \{ branchName, baseRef, sessionMode: "fork-current", openTab: true \}, tabId \}\)/, "remote worktree creation should submit the exact remote ref while local creation retains its base-ref request shape");
|
|
1241
|
+
assert.match(app, /async function applyFooterGitBranch\(branch, \{[\s\S]*const response = trackedRemoteRef[\s\S]*\? await api\("\/api\/git-branch", \{ method: "POST", body: \{ branch: branchName, create, remoteRef: trackedRemoteRef \}, tabId \}\)[\s\S]*: await api\("\/api\/git-branch", \{ method: "POST", body: \{ branch: branchName, create \}, tabId \}\)/, "remote in-place switching should submit the exact remote ref while local switching retains its request shape");
|
|
1242
|
+
assert.match(app, /function footerBranchOptionDetail\(branch, state,[\s\S]*state\.switchingKey \? state\.switchingKey === branch\.key[\s\S]*switchingKey: branch\.key/, "branch busy state should use the exact local-or-remote row identity instead of a collision-prone display label");
|
|
1023
1243
|
assert.match(app, /GIT_BRANCH_TYPE_SUGGESTIONS = \["feat", "fix", "change", "perf", "test", "chore", "refactor", "docs", "style", "build", "ci", "revert"\]/, "new branch creation should reuse the conventional type suggestions from /git-staged-msg");
|
|
1024
1244
|
assert.match(app, /function renderFooterBranchCreateForm\(state = footerBranchPickerState\)[\s\S]*footer-branch-create-dropdown-inputfield[\s\S]*footer-branch-type-suggestions[\s\S]*footer-branch-create-input-field[\s\S]*Create branch worktree/, "branch worktree creation should use a styled editable suggestions dropdown plus input field instead of a browser prompt");
|
|
1025
1245
|
assert.match(app, /let footerBranchCreateDraft = \{ type: "", name: "" \}/, "new branch creation should not default the editable type prefix to feat");
|
|
@@ -1034,7 +1254,8 @@ assert.match(app, /submitButton\.dataset\.tooltip = footerBranchCreateTooltip\(b
|
|
|
1034
1254
|
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");
|
|
1035
1255
|
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");
|
|
1036
1256
|
assert.match(css, /\.footer-branch-create-submit-disabled \{[\s\S]*?cursor:\s*not-allowed;[\s\S]*?color:\s*rgba\(166, 227, 161, 0\.58\);/, "greyed branch create button should use a class instead of disabled opacity");
|
|
1037
|
-
assert.match(app, /Loading
|
|
1257
|
+
assert.match(app, /Loading local and fetched remote branches and worktrees… Worktree creation is available once branch data loads\./, "branch picker loading copy should accurately describe local and fetched remote branch metadata");
|
|
1258
|
+
assert.match(app, /No other local or fetched remote branches available\.[\s\S]*Fetch to list remote branches, or create a branch worktree from origin\/main or the current workspace HEAD to continue\./, "branch picker empty copy should explain how fetched remote branches become available");
|
|
1038
1259
|
assert.match(css, /\.footer-model-picker\.footer-branch-picker \{[\s\S]*?overflow:\s*visible;[\s\S]*?max-height:\s*none;/, "branch picker should not force scrolling just to see the open type suggestions dropdown");
|
|
1039
1260
|
assert.match(css, /\.footer-branch-type-suggestions \{[\s\S]*?grid-template-columns:\s*repeat\(3,[\s\S]*?max-height:\s*none;[\s\S]*?overflow:\s*visible;/, "branch type suggestions should render as a styled multi-column dropdown without internal scrolling");
|
|
1040
1261
|
assert.match(css, /\.footer-branch-option-row \{[\s\S]*?grid-template-columns:\s*minmax\(0, 1fr\) auto/, "branch rows should lay out primary worktree action and advanced switch separately");
|
|
@@ -1057,7 +1278,8 @@ assert.match(server, /url\.pathname === "\/api\/git-branches"[\s\S]*readGitBranc
|
|
|
1057
1278
|
assert.match(server, /url\.pathname === "\/api\/git-worktrees" && req\.method === "POST"[\s\S]*createGitWorktreeTab\(tab, body\)/, "server should expose git worktree creation for branch tabs");
|
|
1058
1279
|
assert.match(server, /url\.pathname === "\/api\/git-worktrees\/open" && req\.method === "POST"[\s\S]*openExistingGitWorktreeTab\(tab, body\)/, "server should expose existing git worktree opening for branch tabs");
|
|
1059
1280
|
assert.match(server, /url\.pathname === "\/api\/git-worktrees" && req\.method === "DELETE"[\s\S]*requireLocalhost\(req, "Removing Git worktrees is only allowed from localhost"\)[\s\S]*removeGitWorktreeForTab\(tab, body\)/, "server should guard destructive git worktree removal behind localhost and confirmation");
|
|
1060
|
-
assert.match(server, /url\.pathname === "\/api\/git-branch"[\s\S]*switchGitBranch\(tab\.cwd, body\.branch, \{ create: body\.create === true \}\)/, "server should
|
|
1281
|
+
assert.match(server, /url\.pathname === "\/api\/git-branch"[\s\S]*const remoteRef = requestedRemoteRef\(body\);[\s\S]*switchGitBranch\(tab\.cwd, body\.branch, \{ create: body\.create === true, remoteRef \}\)/, "server should preserve optional exact remote-ref intent for advanced footer branch switching");
|
|
1282
|
+
assert.match(server, /runGitReadCommandDetailed\(root, \["for-each-ref", "--format=%\(refname\)%09%\(symref\)"[\s\S]*remoteBranchesTruncated: remoteData\.truncated === true[\s\S]*item\.remote !== true && item\.name === targetBranch/, "server branch listing should parse full remote refs, expose truncation, and keep local branch guards local-only");
|
|
1061
1283
|
assert.match(server, /async function switchGitBranch[\s\S]*BRANCH_CHECKED_OUT_ELSEWHERE[\s\S]*const args = create \? \["switch", "-c", targetBranch\] : \["switch", targetBranch\]/, "server branch switching should refuse branches checked out in another worktree before git switch");
|
|
1062
1284
|
assert.match(app, /let latestStats = null/, "default footer should retain session stats for token and context display");
|
|
1063
1285
|
assert.match(app, /async function refreshStats\(tabContext = activeTabContext\(\)\)[\s\S]*api\("\/api\/stats"/, "default footer should fetch session stats");
|
|
@@ -1247,6 +1469,8 @@ assert.match(app, /const GIT_WORKFLOW_CREATE_PR_TOOLTIP = \[[\s\S]*"Create PR wo
|
|
|
1247
1469
|
assert.match(app, /const GIT_WORKFLOW_MANUAL_BRANCH_TOOLTIP = \[[\s\S]*"Manual PR worktree:"[\s\S]*"1\. Skip agent branch-name generation\."[\s\S]*"4\. Create or open a Git worktree for that branch instead of switching this checkout\."[\s\S]*"7\. Push and Create PR will push upstream, run \/pr, let you review, then run gh pr create\."/, "Manual worktree should have an up-to-date step-by-step tooltip");
|
|
1248
1470
|
assert.match(app, /addGitWorkflowAction\("Manual worktree", \(\) => createGitPrBranchManually\(\), "", false, GIT_WORKFLOW_MANUAL_BRANCH_TOOLTIP\)/, "Manual worktree should render with its tooltip");
|
|
1249
1471
|
assert.match(app, /function renderGitWorkflowManualCommitInput\(\{ appendCommitButton = true \} = \{\}\)[\s\S]*git-workflow-message-input[\s\S]*Commit input[\s\S]*commitGitWorkflow\("input", tabId\)/, "Message stage should render a manual commit message input with a Commit input action");
|
|
1472
|
+
assert.match(app, /function captureGitWorkflowInputFocus\(\)[\s\S]*document\.activeElement[\s\S]*gitWorkflowManualCommitMessage[\s\S]*selectionStart[\s\S]*function restoreGitWorkflowInputFocus\(state\)[\s\S]*state\.tabId !== activeTabId[\s\S]*state\.runId !== gitWorkflow\?\.runId[\s\S]*focus\(\{ preventScroll: true \}\)[\s\S]*setSelectionRange/, "guided git rerenders should restore focus and the cursor only for the same commit-message workflow");
|
|
1473
|
+
assert.match(app, /function renderGitWorkflow\(\) \{\n\s+const inputFocus = captureGitWorkflowInputFocus\(\);[\s\S]*gitWorkflowActions\.replaceChildren\(\);[\s\S]*restoreGitWorkflowInputFocus\(inputFocus\);\n\}/, "background guided git updates should not leave the manual commit-message input unfocused after replacing workflow actions");
|
|
1250
1474
|
assert.match(app, /gitWorkflow\.step === "generate"\) \{\n\s+const commitInputButton = renderGitWorkflowManualCommitInput\(\{ appendCommitButton: false \}\);[\s\S]*addGitWorkflowAction\("Preview current message files"[\s\S]*gitWorkflowActions\.append\(commitInputButton\)/, "Message process stage should place Commit input immediately after Preview current message files");
|
|
1251
1475
|
assert.match(app, /gitWorkflow\.step === "message"\) \{[\s\S]*const commitInputButton = renderGitWorkflowManualCommitInput\(\{ appendCommitButton: false \}\);[\s\S]*addGitWorkflowAction\("Regenerate"[\s\S]*gitWorkflowActions\.append\(commitInputButton\)/, "Commit choice stage should place Commit input immediately after Regenerate");
|
|
1252
1476
|
assert.match(app, /async function commitGitWorkflow\(variant[\s\S]*variant === "input"[\s\S]*message: inputMessage/, "Commit input should send the typed message to the git workflow commit API");
|
|
@@ -1265,6 +1489,16 @@ assert.match(app, /async function runGitMessagePrompt\([\s\S]*\/api\/git-workflo
|
|
|
1265
1489
|
assert.match(app, /async function runGitBranchNamePrompt\([\s\S]*\/api\/git-workflow\/generate"[\s\S]*kind: "branch"/, "guided git workflow should generate branch names with the configured model and effort");
|
|
1266
1490
|
assert.match(app, /async function acceptCurrentGitStaging\([\s\S]*summary\?\.staged[\s\S]*No staged files are available/, "review staging should require a non-empty current staged set");
|
|
1267
1491
|
assert.match(app, /function gitWorkflowRequest\([\s\S]*response\.hint \? `\\n\\nHint:/, "guided git failures should show actionable backend hints");
|
|
1492
|
+
assert.match(app, /function gitWorkflowRequest\([\s\S]*if \(response\.code\) failure\.code = response\.code;[\s\S]*if \(response\.hint\) failure\.hint = response\.hint;[\s\S]*if \(response\.data\) failure\.data = response\.data;[\s\S]*throw failure;/, "guided git request failures should preserve the structured backend code, hint, and process result");
|
|
1493
|
+
assert.match(app, /async function pushGitWorkflow\([\s\S]*if \(error\?\.code === "NO_REMOTE"\) \{[\s\S]*await publishGitWorkflowRepository\(tabId, error\)/, "guided git push should offer GitHub publication only for structured NO_REMOTE failures");
|
|
1494
|
+
assert.match(app, /async function publishGitWorkflowRepository\(tabId, failure\)[\s\S]*Publish this repository to GitHub with the authenticated GitHub CLI \(gh\) account instead\?[\s\S]*if \(!publishRequested\) return false;[\s\S]*repoName = promptGitPublishRepoName\(tabId\);[\s\S]*if \(!repoName\) return false;[\s\S]*visibility = promptGitPublishVisibility\(repoName\);[\s\S]*if \(!visibility\) return false;/, "guided git publication should ask to publish, then require a repository name and explicit visibility before continuing");
|
|
1495
|
+
assert.match(app, /async function publishGitWorkflowRepository\([\s\S]*const confirmed = await appConfirmText\(\[[\s\S]*Repository name: \$\{repoName\}[\s\S]*Visibility: \$\{visibility\}[\s\S]*Branch to push: \$\{branch\}[\s\S]*Resulting remote: origin[\s\S]*if \(!confirmed\) return false;[\s\S]*gitWorkflowRequest\("\/api\/git-workflow\/publish", \{ body: \{ repoName, visibility, confirmed: true \}/, "guided git publication should require a final summary confirmation before the confirmed publish request");
|
|
1496
|
+
assert.match(app, /async function publishGitWorkflowRepository\([\s\S]*Published \$\{result\.repoName \|\| repoName\} as \$\{result\.visibility \|\| visibility\}\.[\s\S]*Remote: \$\{result\.remote \|\| "origin"\}[\s\S]*Branch: \$\{result\.branch \|\| branch\}[\s\S]*scheduleRefreshFooter\(\)/, "successful publication should report branch/remote metadata and refresh the footer");
|
|
1497
|
+
assert.match(app, /function promptGitPublishRepoName\(tabId = activeTabId\) \{\n\s+const targetTab = tabs\.find\(\(tab\) => tab\.id === tabId\) \|\| activeTab\(\);\n\s+const value = window\.prompt\("GitHub repository name to create", defaultGitInitRepoName\(targetTab\)\);[\s\S]*return cleanGitHubRepoNameInput\(value\);/, "publication should prefill the repository name from the publishing tab's workspace directory and validate it with the existing client rules");
|
|
1498
|
+
assert.match(app, /async function publishGitWorkflowRepository\(tabId, failure\)[\s\S]*const branch = failure\?\.data\?\.branch \|\| gitFooterCurrentBranch\(\) \|\| "the current branch";[\s\S]*repoName = promptGitPublishRepoName\(tabId\);/, "publication confirmation should prefer the server-reported branch and resolve the repository-name default from the publishing tab");
|
|
1499
|
+
assert.match(app, /function promptGitPublishVisibility\(repoName\) \{\n\s+const value = window\.prompt\(`Visibility for GitHub repository \$\{repoName\} — type public or private \(no default\)`, ""\);/, "visibility must be typed with no preselected default");
|
|
1500
|
+
assert.match(app, /function cleanGitPublishVisibilityInput\(value\)[\s\S]*if \(visibility !== "public" && visibility !== "private"\)[\s\S]*nothing was published/, "publication visibility must be exactly public or private");
|
|
1501
|
+
assert.doesNotMatch(app, /visibility = "(?:public|private)"/, "publication visibility should never be defaulted in the frontend");
|
|
1268
1502
|
assert.match(server, /async function gitAddAllPayload\([\s\S]*platform\(\) === "win32"[\s\S]*findWindowsReservedGitPath\([\s\S]*windowsReservedGitPathFailure\(/, "guided git add should preflight Windows-reserved untracked paths before staging");
|
|
1269
1503
|
assert.match(app, /Pre-commit verification reminder[\s\S]*Continue with this commit/, "configured verification reminders should run before committing");
|
|
1270
1504
|
assert.match(server, /async function startGitWorkflowGeneration\([\s\S]*set_model[\s\S]*setThinkingLevelForTab[\s\S]*type: "prompt"/, "server should apply the configured generation profile before prompting Pi");
|
|
@@ -1327,7 +1561,8 @@ assert.match(app, /const WEBUI_TOOL_RENDERERS = \{[\s\S]*?function renderSingleT
|
|
|
1327
1561
|
assert.match(app, /appendToolRawDetails\(parent, tool\)/, "paired tool cards should keep a safe raw-data expander for debugging renderer mismatches");
|
|
1328
1562
|
assert.match(app, /function toolStateMeta\(tool\)/, "tool cards should expose consistent status and elapsed metadata across built-in renderers");
|
|
1329
1563
|
assert.match(app, /const TOOL_LIVE_UPDATE_THROTTLE_MS = 80/, "live tool cards should coalesce rapid partial updates before re-rendering");
|
|
1330
|
-
|
|
1564
|
+
const updateLiveToolCardSource = appFunctionSource("updateLiveToolCard", "cancelQueuedLiveToolRunRender");
|
|
1565
|
+
assert.match(updateLiveToolCardSource, /transcriptRenderer\.ownSurface\(body[\s\S]*?transcriptRenderer\.commitTranscriptMutation\(\{[\s\S]*?kind: "reconcile"[\s\S]*?transcriptRenderer\.replaceChildren\(body\)[\s\S]*?renderToolExecution\(body, message\)/, "live tool card updates should re-render the existing semantic body through the transcript coordinator");
|
|
1331
1566
|
assert.match(app, /function applyToolExecutionBubbleState\(bubble, message\)[\s\S]*?bubble\.dataset\.toolStatus !== status[\s\S]*?bubble\.classList\.add\(nextClass\)[\s\S]*?bubble\.classList\.toggle\("error"/, "tool status classes should not be removed and re-added on every live update");
|
|
1332
1567
|
assert.match(app, /function toolExecutionRenderSignature\(message\)[\s\S]*?normalizeToolExecution\(message\)[\s\S]*?toolRenderSignatureReplacer\(\)/, "tool cards should derive stable render signatures from normalized tool payloads");
|
|
1333
1568
|
assert.match(app, /const nextRenderSignature = toolExecutionRenderSignature\(message\)[\s\S]*?bubble\._toolRenderSignature === nextRenderSignature[\s\S]*?return true;[\s\S]*?bubble\._toolRenderSignature = nextRenderSignature/, "live tool card updates should skip identical body re-renders");
|
|
@@ -1382,7 +1617,7 @@ assert.match(app, /function scheduleStreamBubbleHide\([\s\S]*?STREAM_OUTPUT_MIN_
|
|
|
1382
1617
|
assert.match(app, /if \(finalText\) \{[\s\S]*?renderStreamingMarkdown\(streamText, finalText\);[\s\S]*?\} else \{\n\s+scheduleStreamBubbleHide\(\);/, "empty filtered stream output should schedule hide while visible stream output renders as Markdown");
|
|
1383
1618
|
assert.match(app, /scheduleStreamingAssistantTextRender\(\{ immediate: !!\(streamToolCallSeen \|\| streamBubble\) \}\);/, "live assistant text should wait briefly before showing unless it is already visible or follows a tool call");
|
|
1384
1619
|
assert.match(app, /streamToolCallSeen = true;\n\s+suppressStreamingAssistantTextBeforeToolCall\(\);/, "tool-call starts should remove pending assistant text from the live transcript");
|
|
1385
|
-
assert.match(app, /function renderStreamingToolCallCard\(\{ scroll = false \} = \{\}\)[\s\S]*?appendMessage\(message, \{ streaming: true \
|
|
1620
|
+
assert.match(app, /function renderStreamingToolCallCard\(\{ scroll = false \} = \{\}\)[\s\S]*?appendMessage\(message, \{ streaming: true, itemKey:[\s\S]*?transcriptRenderer\.ownSurface\(streamToolCallText[\s\S]*?transcriptRenderer\.updateTextSurface\(\{[\s\S]*?text: displayText/, "live tool-call cards should render and update their stable semantic arguments surface in place");
|
|
1386
1621
|
assert.match(app, /update\.type === "toolcall_delta"[\s\S]*?updateStreamingToolCallFromEvent\(event, \{ appendDelta: true \}\)[\s\S]*?Building tool call:/, "tool-call deltas should update visible streamed arguments instead of a static placeholder");
|
|
1387
1622
|
assert.match(app, /case "tool_execution_start":[\s\S]*?removeStreamingToolCallCard\(\)[\s\S]*?handleToolExecutionStart\(event\)/, "the streamed tool-call argument card should be removed when the real tool execution card starts");
|
|
1388
1623
|
assert.doesNotMatch(app, /Preparing tool call:/, "tool-call streaming should no longer show only the static preparing placeholder");
|
|
@@ -1402,12 +1637,15 @@ assert.match(app, /return "Agent is running: ";/, "active agent indicator should
|
|
|
1402
1637
|
assert.doesNotMatch(app, /"agent running"/, "active agent indicator should not render a separate title/header label");
|
|
1403
1638
|
assert.doesNotMatch(app, /runIndicatorTimestamp/, "active agent indicator should not render a separate live timestamp header");
|
|
1404
1639
|
assert.match(app, /runIndicatorBubble = make\("article", "message runIndicator run-indicator-message streaming"\)/, "active agent indicator should use a dedicated streaming transcript card");
|
|
1405
|
-
assert.match(app, /function
|
|
1406
|
-
assert.match(app, /function
|
|
1640
|
+
assert.match(app, /function standaloneLiveTranscriptBubbles\(\)[\s\S]*?streamThinkingBubble[\s\S]*?streamToolCallBubble[\s\S]*?streamBubble[\s\S]*?compactThinkingBubble[\s\S]*?compactTextBubble/, "transcript reconciliation should identify standalone live-tail bubbles that must stay mounted");
|
|
1641
|
+
assert.match(app, /function resetChatOutput\(\)[\s\S]*?liveBubbles = standaloneLiveTranscriptBubbles\(\)[\s\S]*?preservedNodes[\s\S]*?child === runIndicatorBubble \|\| liveBubbles\.has\(child\)[\s\S]*?transcriptRenderer\.replaceChildren\(elements\.chat, \.\.\.preservedNodes\)/, "transcript resets should reconcile through the coordinator while preserving live output and the run indicator");
|
|
1642
|
+
assert.match(app, /function appendChatMessageBubble\(bubble\)[\s\S]*?tailAnchor[\s\S]*?child === runIndicatorBubble \|\| liveBubbles\.has\(child\)[\s\S]*?insertBefore\(bubble, tailAnchor\)/, "reconciled history should insert before the stable live transcript tail");
|
|
1643
|
+
assert.match(app, /setChatScrollTopInstant\(Math\.min\(previousScrollTop, elements\.chat\.scrollHeight\)\)/, "paused-reader scroll restoration should bypass smooth scrolling to avoid a down-then-back animation");
|
|
1407
1644
|
assert.match(app, /function ensureRunIndicatorBubble\(\)[\s\S]*?!runIndicatorBubble \|\| !runIndicatorText \|\| !runIndicatorMeta[\s\S]*?elements\.chat\.lastElementChild !== runIndicatorBubble/, "active agent indicator should reuse the existing bubble across transcript re-renders instead of recreating it");
|
|
1408
1645
|
assert.match(app, /const headline = runIndicatorHeadline\(\);\n\s+if \(runIndicatorText\.textContent !== headline\) runIndicatorText\.textContent = headline;/, "active agent indicator should avoid redundant headline DOM writes that can flicker");
|
|
1409
1646
|
assert.match(app, /const meta = runIndicatorShowsElapsed\(\) \? `\$\{detail\} · run time[\s\S]*?if \(runIndicatorMeta\.textContent !== meta\) runIndicatorMeta\.textContent = meta;/, "active agent indicator should avoid redundant metadata DOM writes except elapsed changes");
|
|
1410
1647
|
assert.match(app, /runIndicatorShowsElapsed\(\) \? `\$\{detail\} · run time/, "active agent indicator should label elapsed run time instead of showing a bare counter");
|
|
1648
|
+
assert.match(app, /case "agent_settled":[\s\S]*?clearRunIndicatorActivity\(\{ deferRemoval: !autoFollowChat \|\| !isChatNearBottom\(\) \}\);[\s\S]*?scheduleRefreshMessages\(\)/, "settlement should keep the tail height stable for readers above the live edge until canonical messages reconcile");
|
|
1411
1649
|
assert.match(app, /Abort requested/, "abort feedback should clarify that Web UI is checking stop status");
|
|
1412
1650
|
assert.match(app, /const ABORT_LONG_PRESS_MS = 3000/, "Abort long-press timing should be explicit");
|
|
1413
1651
|
assert.match(app, /const ABORT_LONG_PRESS_TICK_MS = 100/, "Abort hold countdown should update visibly while held");
|
|
@@ -1446,7 +1684,7 @@ assert.match(app, /setRunIndicatorActivity\("Requesting context compaction…"\)
|
|
|
1446
1684
|
assert.match(app, /function markContextUsageUnknownAfterCompaction\(/, "compaction should have a dedicated context-usage invalidation helper");
|
|
1447
1685
|
assert.match(app, /case "compaction_end":[\s\S]*?markContextUsageUnknownAfterCompaction\(event\.tabId \|\| activeTabId\)/, "finished compaction should make footer context usage unknown instead of showing stale pressure");
|
|
1448
1686
|
assert.match(app, /function footerStatsContextDisplay[\s\S]*?contextUsageUnknownAfterCompaction\(\)[\s\S]*?unknownFooterContextText/, "fallback footer context should show an unknown value after compaction invalidates usage");
|
|
1449
|
-
assert.match(app, /case "agent_settled":[\s\S]*?clearRunIndicatorActivity\(\)/, "agent settlement should
|
|
1687
|
+
assert.match(app, /case "agent_settled":[\s\S]*?clearRunIndicatorActivity\(\{ deferRemoval:[^}]+\}\)/, "agent settlement should clear indicator activity while deferring tail removal for readers above the live edge");
|
|
1450
1688
|
assert.match(app, /case "agent_settled":[\s\S]*?notifyAgentDone\(event\.tabId \|\| activeTabId/, "agent settlement should trigger optional done notifications");
|
|
1451
1689
|
assert.doesNotMatch(app.match(/case "agent_end":[\s\S]*?case "message_start":/)?.[0] || "", /notifyAgentDone\(/, "an intermediate low-level agent end must not trigger a done notification");
|
|
1452
1690
|
assert.match(app, /function getPathTrigger\(\)/, "prompt composer should detect @ file\/path reference triggers");
|
|
@@ -1511,9 +1749,15 @@ assert.match(app, /async function sendBtwPromptFromButton\(\)[\s\S]*?if \(!quest
|
|
|
1511
1749
|
assert.match(app, /function renderBtwComposerForm\(\)[\s\S]*?form\.requestSubmit\(\)[\s\S]*?sendBtwQuestion\(question\)/, "/btw widget input should submit each message as a /btw trigger");
|
|
1512
1750
|
assert.match(app, /function makeBtwTransferIcon\(\)[\s\S]*?class", "btw-transfer-icon"[\s\S]*?function transferBtwContextToMain\(button, \{ transferMode = "full" \} = \{\}\)[\s\S]*?`\/btw-transfer \$\{encoded\}`[\s\S]*?streamingBehavior: "steer"[\s\S]*?Summarize & Steer/, "/btw widget should expose full-context and summary transfer actions that send steering context during active runs");
|
|
1513
1751
|
assert.match(app, /async function sendPrompt\(kind = "prompt", explicitMessage, \{ targetTabId = activeTabId, throwOnError = false, streamingBehavior \} = \{\}\)[\s\S]*?if \(targetWasBusy\) body\.streamingBehavior = streamingBehavior \|\| busyBehavior/, "prompt sending should support a per-call streaming behavior override");
|
|
1514
|
-
assert.match(app, /function appendOptimisticUserPrompt\([\s\S]*?role: "user"[\s\S]*?
|
|
1515
|
-
assert.match(app, /
|
|
1752
|
+
assert.match(app, /function appendOptimisticUserPrompt\([\s\S]*?transientMessages\.push\(\{[\s\S]*?role: "user"[\s\S]*?optimisticPromptId[\s\S]*?renderAllMessages\(\)/, "new prompts should enter transcript state optimistically before routing finishes");
|
|
1753
|
+
assert.match(app, /function reconcileOptimisticUserPrompts\([\s\S]*?persistedUserMessageCount\(messages\)[\s\S]*?message\?\.optimisticPromptId[\s\S]*?persistedUserCount <= Number\(message\.optimisticBaselineUserCount \|\| 0\)/, "optimistic prompts should remain renderable until a newer persisted user message supersedes them");
|
|
1754
|
+
assert.match(app, /function renderMessages\(messages\) \{\n\s+latestMessages = messages \|\| \[\];\n\s+reconcileOptimisticUserPrompts\(latestMessages\);/, "message refreshes should reconcile rather than blindly discard optimistic prompts");
|
|
1755
|
+
assert.match(app, /if \(startsRun\) \{\n\s+promptRoutingTabs\.add\(targetTabId\);\n\s+markTabWorkingLocally\(targetTabId\);\n\s+if \(isCurrentTabContext\(tabContext\)\) \{\n\s+optimisticPromptId = appendOptimisticUserPrompt\(originalMessage, attachments\.length\);\n\s+setRunIndicatorActivity\(attachments\.length \? "Preparing attachments for routing…" : "Routing prompt to the selected agent…"\);/, "new runs should show the prompt and routing progress immediately in the target tab");
|
|
1516
1756
|
assert.match(app, /if \(startsRun && isCurrentTabContext\(tabContext\)\) setRunIndicatorActivity\("Routing complete; starting agent…"\);/, "prepared prompts should transition from routing to agent-start progress before dispatch");
|
|
1757
|
+
assert.doesNotMatch(app, /applyResponseTab\(response\);\n\s+if \(startsRun\) promptRoutingTabs\.delete\(targetTabId\);/, "prompt acceptance alone should not clear pending launch continuity before Pi confirms the run");
|
|
1758
|
+
assert.match(app, /case "agent_start":\n\s+promptRoutingTabs\.delete\(event\.tabId \|\| activeTabId\);/, "agent start should replace optimistic routing continuity with canonical streaming state");
|
|
1759
|
+
assert.match(app, /else if \(promptRoutingTabs\.has\(activeTabId\)\) \{\n\s+renderRunIndicator/, "idle state snapshots should not hide the run indicator while an accepted prompt still awaits agent start");
|
|
1760
|
+
assert.match(app, /if \(state\.isStreaming && runIndicatorActivityIsRouting\(\)\) \{\n\s+runIndicatorActivity = "Agent run confirmed; waiting for first output or action…";/, "confirmed streaming state should replace stale routing copy without overwriting newer thinking or tool activity");
|
|
1517
1761
|
assert.match(app, /function runPublishWorkflow\(command\)[\s\S]*?sendPrompt\("prompt", `\/\$\{resolvedCommandName\}\$\{commandRest\}`\)/, "Publish workflows should send resolved slash commands directly without replacing the draft");
|
|
1518
1762
|
assert.match(app, /async function runNativeCommandMenu\(command\)[\s\S]*?await handleNativeSlashSelectorCommand\(command\)/, "skills/tools command menu should open native selector dialogs directly");
|
|
1519
1763
|
assert.match(app, /async function runNativeCommandMenu\(command\)[\s\S]*?sendPrompt\("prompt", command\)/, "generic native command menu should fall back to slash-command prompt execution");
|
|
@@ -1630,7 +1874,7 @@ assert.match(app, /function closeAllTerminalTabs\(\)[\s\S]*?closeTerminalTabs\(t
|
|
|
1630
1874
|
assert.match(app, /WARNING: \$\{activeAgentTabs\.length\}[\s\S]*?still running or waiting for input/, "tab close confirmations should warn when agents are still running");
|
|
1631
1875
|
assert.match(app, /elements\.closeAllTabsButton\.addEventListener\("click", \(\) => closeAllTerminalTabs\(\)\)/, "close-all tabs button should be wired in JS");
|
|
1632
1876
|
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");
|
|
1633
|
-
assert.match(app, /
|
|
1877
|
+
assert.match(app, /const subagentGroups = subagentTerminalViewGroups\(\)[\s\S]*renderSubagentTerminalTabGroup\(group\)[\s\S]*renderSubagentTerminalTab\(group\.views\[0\]\)/, "open subagent views should render as first-class virtual tabs, grouped by parent workspace when siblings exist");
|
|
1634
1878
|
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");
|
|
1635
1879
|
assert.match(app, /let tabSeenCompletionSerials = new Map\(\)/, "frontend should track which tab completions have been seen");
|
|
1636
1880
|
assert.match(app, /let activeTabGeneration = 0/, "frontend should version active-tab UI state to reject stale async work");
|
|
@@ -1661,6 +1905,7 @@ assert.match(app, /function markTabDoneLocally\(/, "frontend should locally reco
|
|
|
1661
1905
|
assert.match(app, /function syncActiveTabActivityFromState\(state = currentState\)/, "frontend should reconcile active-tab indicators from authoritative state snapshots");
|
|
1662
1906
|
assert.match(app, /event\.command === "get_state" && event\.tabId === activeTabId[\s\S]*?syncActiveTabActivityFromState\(currentState\)/, "get_state response events should update stale active-tab activity");
|
|
1663
1907
|
assert.match(app, /function applyResponseTab\(response\)/, "frontend should merge tab metadata returned by prompt responses");
|
|
1908
|
+
assert.match(app, /newSessionButton\.addEventListener\("click", async \(\) => \{[\s\S]*?api\("\/api\/new-session"[\s\S]*?applyResponseTab\(response\)[\s\S]*?refreshAll\(tabContext\)/, "the New button should apply returned terminal-tab metadata before the full session refresh");
|
|
1664
1909
|
assert.match(app, /case "webui_tab_renamed":/, "frontend should update tab labels from backend rename events");
|
|
1665
1910
|
assert.match(app, /case "webui_recovery_opened":[\s\S]*?refreshTabs\(\)[\s\S]*?switchTab\(event\.recoveryTabId\)/, "recovery events should refresh tabs and activate the new recovery session");
|
|
1666
1911
|
assert.match(app, /terminalTabsToggleButton\.addEventListener\("click"/, "terminal tabs trigger should be wired in JS");
|
|
@@ -1680,7 +1925,8 @@ assert.match(app, /api\("\/api\/thinking", \{ method: "POST", body: \{ level: ne
|
|
|
1680
1925
|
assert.match(app, /function isFooterPickerOpen\(\)[\s\S]*?footerModelPickerOpen \|\| footerThinkingPickerOpen/, "footer picker overlay state should cover model and thinking pickers");
|
|
1681
1926
|
assert.doesNotMatch(app.match(/function renderMinimalFooter\(\)[\s\S]*?\n\}/)?.[0] || "", /footer-details-toggle/, "minimal default footer should not render a details toggle chip");
|
|
1682
1927
|
assert.match(app, /bindMobileViewChanges\(/, "side panel state should react to mobile breakpoint changes");
|
|
1683
|
-
|
|
1928
|
+
// Intent preserved for legacy; v2 leaves mobile surface ownership to its reducer.
|
|
1929
|
+
assert.match(app, /function restoreSidePanelState\(\) \{\n\s+if \(isMobileShellV2Active\(\)\) return;\n\s+if \(isSidePanelOverlayView\(\)\)/, "legacy mobile and narrow overlay layouts should start with the side panel collapsed");
|
|
1684
1930
|
assert.match(app, /case "webui_tab_reloaded":/, "frontend should handle native /reload tab restart events");
|
|
1685
1931
|
assert.match(app, /addTransientMessage\(\{ role: "native", title: "\/reload"/, "native /reload should produce visible transcript output");
|
|
1686
1932
|
assert.match(app, /copyText\(data\.copyText\)\.catch/, "native /copy should use the shared browser clipboard helper when available");
|
|
@@ -1695,10 +1941,14 @@ assert.ok(manifest.icons?.some((icon) => icon.src === "/apple-touch-icon.png" &&
|
|
|
1695
1941
|
assert.ok(manifest.icons?.some((icon) => icon.src === "/icon-192.png" && icon.sizes === "192x192"), "PWA manifest should include a 192px icon");
|
|
1696
1942
|
assert.ok(manifest.icons?.some((icon) => icon.src === "/icon-512.png" && icon.sizes === "512x512"), "PWA manifest should include a 512px icon");
|
|
1697
1943
|
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v\d+"/, "PWA service worker should define a versioned app-shell cache");
|
|
1698
|
-
assert.match(serviceWorker, /fetchThenCache\(
|
|
1944
|
+
assert.match(serviceWorker, /fetchThenCache\(event\)\.catch\(/, "PWA service worker should serve the app shell network-first with offline cache fallback");
|
|
1945
|
+
assert.match(serviceWorker, /const APP_SHELL_NETWORK_TIMEOUT_MS = 8_000;/, "PWA app-shell requests should have a bounded network timeout");
|
|
1946
|
+
assert.match(serviceWorker, /event\.waitUntil\([\s\S]*?cache\.put\(request, response\.clone\(\)\)/, "PWA cache writes should be tracked without blocking response delivery");
|
|
1699
1947
|
assert.match(serviceWorker, /ignoreSearch: true/, "PWA service worker offline fallback should ignore ?v= cache busters");
|
|
1700
1948
|
assert.match(serviceWorker, /self\.addEventListener\("notificationclick"/, "PWA service worker should focus Web UI when blocked-tab notifications are clicked");
|
|
1701
|
-
|
|
1949
|
+
// Intent superseded: notification URLs are now generated only from validated opaque targets; invalid payloads fall back to the app root.
|
|
1950
|
+
assert.match(serviceWorker, /function notificationTargetUrl\(data\)[\s\S]*?if \(!target\) return `\$\{self\.location\.origin\}\/`/, "notification clicks should use a bounded root fallback instead of accepting an arbitrary URL");
|
|
1951
|
+
assert.doesNotMatch(serviceWorker, /data\?\.url/, "notification payloads must not inject arbitrary fallback URLs");
|
|
1702
1952
|
assert.match(serviceWorker, /"\/subagent-launch-slot-state\.mjs"/, "PWA service worker should cache the launch-slot state module imported by the app shell");
|
|
1703
1953
|
assert.match(serviceWorker, /"\/apple-touch-icon\.png"/, "PWA service worker should cache the apple touch icon");
|
|
1704
1954
|
assert.match(serviceWorker, /"\/matrix-background\.webp"/, "PWA service worker should cache the Matrix background image");
|
|
@@ -1724,7 +1974,9 @@ assert.match(server, /OPENAI_CODEX_USAGE_ENDPOINT/, "server should query Codex u
|
|
|
1724
1974
|
assert.match(server, /const NATIVE_SLASH_COMMANDS = nativeSlashCommandEntries\(nativeParityMatrix\)/, "server should define Pi native slash commands for autocomplete from the parity matrix");
|
|
1725
1975
|
assert.match(server, /WEBUI_TUI_NATIVE_PARITY\.json/, "native command descriptions should come from the parity matrix source of truth");
|
|
1726
1976
|
assert.match(server, /function parseSlashCommand\(message\)/, "server should parse native slash commands before prompt forwarding");
|
|
1727
|
-
assert.match(server, /
|
|
1977
|
+
assert.match(server, /AUTO_TAB_TITLE_MAX_LENGTH = 44;[\s\S]*AUTO_TAB_TITLE_DISPLAY_MAX_LENGTH = 160;/, "compact terminal labels and wider subagent display titles should use separate length limits");
|
|
1978
|
+
assert.match(server, /function generatedTabTitleFromPrompt\(message\)[\s\S]*truncateTabTitle\(titleCaseTabTitle\(selectedWords\.join\(" "\)\), AUTO_TAB_TITLE_DISPLAY_MAX_LENGTH\)/, "server should preserve a longer automatic title before compact terminal truncation");
|
|
1979
|
+
assert.match(server, /function renameTab\(tab, title,[\s\S]*tab\.subagentDisplayTitle = source === "auto" \? truncateTabTitle\(title, AUTO_TAB_TITLE_DISPLAY_MAX_LENGTH\) : undefined;/, "new auto-named tabs should cache their wider subagent display title immediately");
|
|
1728
1980
|
assert.match(server, /function maybeNameTabForConversation\(tab, command\)/, "server should auto-name default tabs when a conversation starts");
|
|
1729
1981
|
assert.match(server, /function maybeNameTabForConversation\(tab, command\) \{[\s\S]*const shouldRename = !tab\.conversationStarted && tab\.titleSource !== "explicit";[\s\S]*tab\.conversationStarted = true;[\s\S]*if \(!shouldRename\) return false;/, "server should mark conversations as started even when an explicit title prevents auto-renaming");
|
|
1730
1982
|
assert.match(server, /function createTabActivity\(/, "server should track per-tab activity for idle, working, and completed work");
|
|
@@ -1818,7 +2070,8 @@ assert.match(server, /specific Web UI action or final-output cards/, "server fee
|
|
|
1818
2070
|
assert.match(server, /function formatActionFeedbackLearningPrompt\(items\)/, "server should convert feedback into a LEARNING prompt");
|
|
1819
2071
|
assert.match(server, /url\.pathname === "\/api\/action-feedback" && req\.method === "POST"[\s\S]*?handleActionFeedback\(tab, body\)/, "POST /api/action-feedback should trigger the feedback-learning prompt");
|
|
1820
2072
|
assert.match(server, /Wait for the current agent run or compaction to finish before sending feedback\./, "server should only accept post-run feedback submissions");
|
|
1821
|
-
|
|
2073
|
+
// Intent preserved: request deduplication wraps, but does not bypass, native slash handling.
|
|
2074
|
+
assert.match(server, /async function handlePromptRequest\(tab, body, req\)[\s\S]*?handleNativeSlashCommand\(tab, body, req\)[\s\S]*?url\.pathname === "\/api\/prompt" && req\.method === "POST"[\s\S]*?deduplicateBrowserPromptRequest\(tab, body, \(\) => handlePromptRequest\(tab, body, req\)\)/, "POST /api/prompt should retain native slash handling under browser request deduplication");
|
|
1822
2075
|
assert.match(server, /function fastPicksStorageFile\(/, "server should define a persistent fast-picks storage file");
|
|
1823
2076
|
assert.match(server, /PI_WEBUI_FAST_PICKS_FILE/, "server should allow overriding the fast-picks storage path");
|
|
1824
2077
|
assert.match(server, /async function getPathSuggestionData\(tab, rawQuery\)/, "server should compute @ file\/path reference suggestions for the active tab cwd");
|
|
@@ -1879,7 +2132,8 @@ assert.match(server, /writeFile\(tmpFile, body\.content[\s\S]*?rename\(tmpFile,
|
|
|
1879
2132
|
assert.match(server, /url\.pathname === "\/api\/themes" && req\.method === "GET"/, "server should expose GET /api/themes");
|
|
1880
2133
|
assert.match(server, /readBundledThemes\(\)/, "server should read bundled theme JSON files for the browser");
|
|
1881
2134
|
assert.match(server, /"apple-touch-icon\.png", "icon-192\.png"/, "server should serve the conventional apple touch icon path");
|
|
1882
|
-
|
|
2135
|
+
// Intent preserved: the static allowlist must include every app startup module, including the Phase 1 shell state.
|
|
2136
|
+
assert.match(server, /"mobile-shell-state\.mjs", "issue-wizard-state\.mjs", "issue-bot-client\.mjs", "fast-output-live\.mjs"/, "server should serve browser modules imported by the app");
|
|
1883
2137
|
assert.match(server, /"catppuccin-mocha-background\.png", "matrix-background\.webp", "manifest\.webmanifest", "service-worker\.js"/, "server should serve theme background images as static assets");
|
|
1884
2138
|
assert.match(server, /\["\.webmanifest", "application\/manifest\+json; charset=utf-8"\]/, "server should serve manifest with the correct MIME type");
|
|
1885
2139
|
assert.match(server, /\["\.png", "image\/png"\]/, "server should serve PWA PNG icons with the correct MIME type");
|
|
@@ -1926,7 +2180,7 @@ for (const [name, range] of Object.entries(companionDependencies)) {
|
|
|
1926
2180
|
assert.equal(pkg.optionalDependencies?.[name], range, `webui package should optionally depend on ${name}`);
|
|
1927
2181
|
assert.equal(pkg.dependencies?.[name], undefined, `webui package should not require optional companion ${name}`);
|
|
1928
2182
|
assert.equal(lock.packages?.[""]?.optionalDependencies?.[name], range, `package-lock root should optionally depend on ${name}`);
|
|
1929
|
-
assert.equal(lock.packages?.[""]?.dependencies?.[name],
|
|
2183
|
+
assert.equal(lock.packages?.[""]?.dependencies?.[name], undefined, `package-lock root should not promote optional companion ${name} to a required dependency`);
|
|
1930
2184
|
assert.ok(lock.packages?.[`node_modules/${name}`], `package-lock should include resolved optional companion ${name}`);
|
|
1931
2185
|
}
|
|
1932
2186
|
assert.equal(pkg.bundledDependencies, undefined, "webui optional companion packages should not be bundled into the tarball");
|
|
@@ -1979,7 +2233,8 @@ assert.ok(pkg.scripts?.check?.includes("node tests/run-all.mjs"), "check script
|
|
|
1979
2233
|
|
|
1980
2234
|
// --- Performance: keyed transcript reconciliation (P0-1) ---
|
|
1981
2235
|
assert.match(app, /let renderedTranscriptState = \{ epoch: "", entries: \[\] \};/, "transcript reconciliation should track rendered entries");
|
|
1982
|
-
|
|
2236
|
+
const renderAllMessagesSource = appFunctionSource("renderAllMessages", "applyNativeSlashCommandEffects");
|
|
2237
|
+
assert.match(renderAllMessagesSource, /prefixLength[\s\S]*?prefixKeys[\s\S]*?transcriptRenderer\.commitTranscriptMutation\(\{[\s\S]*?kind: forceRebuild \? "authoritative" : "reconcile"[\s\S]*?if \(prefixLength === 0\)[\s\S]*?resetChatOutput\(\)[\s\S]*?removeChatBubblesAfterPrefix\(/, "renderAllMessages should reuse the unchanged keyed prefix inside one coordinator transaction instead of always rebuilding");
|
|
1983
2238
|
assert.match(app, /function removeChatBubblesAfterPrefix\(keptKeys\)[\s\S]*?child === elements\.stickyUserPromptButton \|\| child === runIndicatorBubble/, "prefix removal must preserve the sticky prompt button and run indicator");
|
|
1984
2239
|
assert.match(app, /function resetChatOutput\(\) \{\n liveToolCards\.clear\(\);\n renderedTranscriptState = \{ epoch: "", entries: \[\] \};/, "full chat resets must clear reconciliation state");
|
|
1985
2240
|
assert.match(app, /function transcriptRenderEpoch\(\)[\s\S]*?thinkingOutputVisible/, "reconciliation epoch must include thinking visibility so toggles rebuild the transcript");
|
|
@@ -1987,7 +2242,8 @@ assert.match(app, /pruneDisconnectedLiveToolCards\(\);/, "reconciliation must pr
|
|
|
1987
2242
|
|
|
1988
2243
|
// --- Performance: incremental streaming markdown (P0-3) ---
|
|
1989
2244
|
assert.match(app, /function streamingMarkdownStableBoundary\(text\)[\s\S]*?for \(let index = 0; index < lines\.length - 1; index \+= 1\)/, "streaming markdown boundary must never treat the final partial line as stable");
|
|
1990
|
-
|
|
2245
|
+
const renderStreamingMarkdownSource = appFunctionSource("renderStreamingMarkdown", "appendImage");
|
|
2246
|
+
assert.match(renderStreamingMarkdownSource, /captureChatTextSelection\(block\)[\s\S]*?transcriptRenderer\.reconcileMarkdownSurface\(\{[\s\S]*?stableBoundary: streamingMarkdownStableBoundary[\s\S]*?renderInto: renderMarkdownInto[\s\S]*?restoreChatTextSelection/, "streaming Markdown must reconcile stable committed blocks and its mutable tail through the coordinator");
|
|
1991
2247
|
assert.match(app, /streamRawText = "";\n streamThinkingRawText = "";\n resetStreamDerivedTextCache\(\);\n streamMarkdownState = null;/, "resetting the stream bubble must clear incremental markdown state and derived caches");
|
|
1992
2248
|
|
|
1993
2249
|
// --- Performance: delta transcript fetch (P1-1) ---
|
|
@@ -2006,6 +2262,7 @@ assert.match(app, /\(event\.ctrlKey \|\| event\.metaKey\) && !event\.altKey && !
|
|
|
2006
2262
|
assert.match(app, /function focusChatSearchMatch\(\)[\s\S]*?details\.open = true;[\s\S]*?scrollIntoView/, "navigating to a search match should expand collapsed tool output and scroll to the bubble");
|
|
2007
2263
|
assert.match(app, /autoFollowChat = false;\n lastChatProgrammaticScrollAt = performance\.now\(\);/, "search navigation must not fight chat auto-follow");
|
|
2008
2264
|
assert.match(css, /\.message\.search-current \{/, "current search match should have a highlight style");
|
|
2265
|
+
assert.match(css, /\.chat \{[^}]*overflow:\s*auto;[^}]*overflow-anchor:\s*none;/, "the transcript should disable browser scroll anchoring because paused-reader position is controlled explicitly during live growth");
|
|
2009
2266
|
assert.match(css, /\.chat-search-bar,\n\.file-viewer-search-bar \{/, "transcript search bar should be styled");
|
|
2010
2267
|
|
|
2011
2268
|
console.log("mobile static checks passed");
|