@firstpick/pi-package-webui 0.7.9 → 0.8.0
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 +10 -4
- package/bin/pi-webui.mjs +316 -13
- package/lib/git-workflow-preferences.mjs +16 -0
- package/lib/git-worktrees.mjs +43 -4
- package/package.json +4 -2
- package/public/app.js +591 -76
- package/public/index.html +18 -4
- package/public/service-worker.js +1 -1
- package/public/styles.css +26 -0
- package/tests/boot-failure-diagnostics.test.mjs +2 -2
- package/tests/codex-fast-mode-static.test.mjs +56 -0
- package/tests/composer-skill-tag-layout.test.mjs +70 -0
- package/tests/fast-mode-client-static.test.mjs +8 -8
- package/tests/fixtures/fake-pi.mjs +41 -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 +262 -1
- package/tests/mobile-static.test.mjs +56 -5
- package/tests/open-issue-wizard-static.test.mjs +1 -1
- package/tests/side-panel-resize-static.test.mjs +8 -1
package/public/index.html
CHANGED
|
@@ -664,13 +664,13 @@
|
|
|
664
664
|
</div>
|
|
665
665
|
<div class="control-field">
|
|
666
666
|
<div class="control-field-header">
|
|
667
|
-
<label for="fastOutputModeSelect">
|
|
668
|
-
<span class="control-field-context">Markdown final output; live thinking expanded; stored thinking grouped and collapsed</span>
|
|
667
|
+
<label for="fastOutputModeSelect">Compact mode (Experimental)</label>
|
|
668
|
+
<span class="control-field-context">Lightweight browser rendering; Markdown final output; live thinking expanded; stored thinking grouped and collapsed</span>
|
|
669
669
|
</div>
|
|
670
670
|
<div class="control-action-row">
|
|
671
671
|
<select id="fastOutputModeSelect" title="Output processing mode" aria-describedby="fastOutputModeStatus">
|
|
672
672
|
<option value="normal">Normal</option>
|
|
673
|
-
<option value="compact-v1">
|
|
673
|
+
<option value="compact-v1">Compact</option>
|
|
674
674
|
</select>
|
|
675
675
|
<button id="setFastOutputModeButton" class="control-apply-button" type="button" aria-label="Apply selected output processing mode" disabled>Apply</button>
|
|
676
676
|
</div>
|
|
@@ -795,6 +795,20 @@
|
|
|
795
795
|
</button>
|
|
796
796
|
</h2>
|
|
797
797
|
<div id="sidePanelSectionCodexUsage" class="side-panel-section-content" hidden>
|
|
798
|
+
<div class="control-field codex-fast-mode-control" aria-labelledby="codexFastModeLabel">
|
|
799
|
+
<div class="control-field-header">
|
|
800
|
+
<label id="codexFastModeLabel" for="codexFastModeSelect">Fast mode</label>
|
|
801
|
+
<span class="control-field-context">Subscription-backed Codex requests · This tab</span>
|
|
802
|
+
</div>
|
|
803
|
+
<div class="control-action-row">
|
|
804
|
+
<select id="codexFastModeSelect" title="Codex subscription request tier" aria-describedby="codexFastModeStatus" disabled>
|
|
805
|
+
<option value="normal">Normal</option>
|
|
806
|
+
<option value="fast">Fast</option>
|
|
807
|
+
</select>
|
|
808
|
+
<button id="setCodexFastModeButton" class="control-apply-button" type="button" aria-label="Apply selected Codex Fast mode" disabled>Apply</button>
|
|
809
|
+
</div>
|
|
810
|
+
<div id="codexFastModeStatus" class="toggle-control-hint" role="status" aria-live="polite">Checking Codex Fast mode…</div>
|
|
811
|
+
</div>
|
|
798
812
|
<div class="codex-usage-actions">
|
|
799
813
|
<button id="refreshCodexUsageButton" type="button">Refresh usage</button>
|
|
800
814
|
</div>
|
|
@@ -1369,7 +1383,7 @@
|
|
|
1369
1383
|
</form>
|
|
1370
1384
|
</dialog>
|
|
1371
1385
|
|
|
1372
|
-
<script id="webuiBootLoader" data-app-src="/app.js?v=
|
|
1386
|
+
<script id="webuiBootLoader" data-app-src="/app.js?v=94">
|
|
1373
1387
|
(() => {
|
|
1374
1388
|
"use strict";
|
|
1375
1389
|
|
package/public/service-worker.js
CHANGED
package/public/styles.css
CHANGED
|
@@ -3070,6 +3070,20 @@ body.embedded-split .side-panel-backdrop {
|
|
|
3070
3070
|
display: grid;
|
|
3071
3071
|
gap: 0.48rem;
|
|
3072
3072
|
}
|
|
3073
|
+
.codex-fast-mode-control {
|
|
3074
|
+
margin-bottom: 0.72rem;
|
|
3075
|
+
padding: 0.72rem;
|
|
3076
|
+
border: 1px solid rgba(148, 226, 213, 0.20);
|
|
3077
|
+
border-radius: 0.85rem;
|
|
3078
|
+
background: rgba(var(--ctp-crust-rgb), 0.50);
|
|
3079
|
+
box-shadow: inset 0 1px 0 rgba(255,255,255,0.035), 0 0 1rem rgba(148, 226, 213, 0.05);
|
|
3080
|
+
}
|
|
3081
|
+
.codex-fast-mode-control .control-field-context {
|
|
3082
|
+
color: rgba(var(--ctp-subtext-rgb), 0.74);
|
|
3083
|
+
}
|
|
3084
|
+
.codex-fast-mode-control .toggle-control-hint {
|
|
3085
|
+
margin-top: 0.48rem;
|
|
3086
|
+
}
|
|
3073
3087
|
.codex-usage-actions,
|
|
3074
3088
|
.claude-usage-actions {
|
|
3075
3089
|
display: flex;
|
|
@@ -7886,7 +7900,16 @@ summary { cursor: pointer; color: var(--warning); }
|
|
|
7886
7900
|
display: inline-flex;
|
|
7887
7901
|
align-items: center;
|
|
7888
7902
|
gap: 0.32rem;
|
|
7903
|
+
width: calc(100% - 4.5rem);
|
|
7889
7904
|
max-width: calc(100% - 4.5rem);
|
|
7905
|
+
min-width: 0;
|
|
7906
|
+
pointer-events: none;
|
|
7907
|
+
}
|
|
7908
|
+
.composer-busy-mode-tag,
|
|
7909
|
+
.composer-skill-tag,
|
|
7910
|
+
.composer-conversation-mode-chip,
|
|
7911
|
+
.composer-workflow-mode-chip {
|
|
7912
|
+
pointer-events: auto;
|
|
7890
7913
|
}
|
|
7891
7914
|
.composer-busy-mode-tag {
|
|
7892
7915
|
position: relative;
|
|
@@ -7942,6 +7965,7 @@ summary { cursor: pointer; color: var(--warning); }
|
|
|
7942
7965
|
}
|
|
7943
7966
|
.composer-skill-tags {
|
|
7944
7967
|
display: inline-flex;
|
|
7968
|
+
flex: 1 1 0;
|
|
7945
7969
|
align-items: center;
|
|
7946
7970
|
gap: 0.28rem;
|
|
7947
7971
|
min-width: 0;
|
|
@@ -8144,6 +8168,7 @@ body.conversation-mode-active .composer::before {
|
|
|
8144
8168
|
}
|
|
8145
8169
|
.composer-skill-tag {
|
|
8146
8170
|
display: inline-flex;
|
|
8171
|
+
flex: 0 0 auto;
|
|
8147
8172
|
align-items: center;
|
|
8148
8173
|
min-width: 0;
|
|
8149
8174
|
min-height: 0;
|
|
@@ -8182,6 +8207,7 @@ button.composer-skill-tag:focus-visible {
|
|
|
8182
8207
|
}
|
|
8183
8208
|
.composer-skill-tag.overflow {
|
|
8184
8209
|
color: var(--ctp-subtext0);
|
|
8210
|
+
font-variant-numeric: tabular-nums;
|
|
8185
8211
|
border-color: rgba(166, 173, 200, 0.30);
|
|
8186
8212
|
background: linear-gradient(120deg, rgba(166, 173, 200, 0.22), rgba(166, 173, 200, 0.08)), var(--ctp-crust);
|
|
8187
8213
|
}
|
|
@@ -76,7 +76,7 @@ function makeEnvironment({ importApp, stylesheetLoaded = true, stylesheetStatus
|
|
|
76
76
|
removeEventListener(name) { listeners.delete(name); },
|
|
77
77
|
};
|
|
78
78
|
const document = {
|
|
79
|
-
currentScript: new FakeElement({ dataset: { appSrc: "/app.js?v=
|
|
79
|
+
currentScript: new FakeElement({ dataset: { appSrc: "/app.js?v=94" } }),
|
|
80
80
|
readyState: "complete",
|
|
81
81
|
querySelector(selector) {
|
|
82
82
|
return {
|
|
@@ -174,7 +174,7 @@ for (const moduleName of startupModuleNames) {
|
|
|
174
174
|
assert.ok(serviceWorker.includes(`"/${moduleName}"`), `the PWA app shell should include every app.js startup module: ${moduleName}`);
|
|
175
175
|
}
|
|
176
176
|
assert.match(serviceWorker, /pi-webui-pwa-v\d+/, "the app-shell cache should retain a versioned identity");
|
|
177
|
-
assert.ok(html.indexOf('id="webuiBootLoader"') < html.indexOf("/app.js?v=
|
|
177
|
+
assert.ok(html.indexOf('id="webuiBootLoader"') < html.indexOf("/app.js?v=94"), "the inline loader should own app module startup");
|
|
178
178
|
assert.doesNotMatch(html, /<script type="module" src="\/app\.js/, "the app module should not bypass the guarded loader");
|
|
179
179
|
|
|
180
180
|
console.log("boot-failure-diagnostics.test.mjs passed");
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { readFile } from "node:fs/promises";
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
|
|
6
|
+
const root = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
7
|
+
const [server, app, html, styles, serviceWorker, readme, packageRaw, lockRaw] = await Promise.all([
|
|
8
|
+
readFile(join(root, "bin", "pi-webui.mjs"), "utf8"),
|
|
9
|
+
readFile(join(root, "public", "app.js"), "utf8"),
|
|
10
|
+
readFile(join(root, "public", "index.html"), "utf8"),
|
|
11
|
+
readFile(join(root, "public", "styles.css"), "utf8"),
|
|
12
|
+
readFile(join(root, "public", "service-worker.js"), "utf8"),
|
|
13
|
+
readFile(join(root, "README.md"), "utf8"),
|
|
14
|
+
readFile(join(root, "package.json"), "utf8"),
|
|
15
|
+
readFile(join(root, "package-lock.json"), "utf8"),
|
|
16
|
+
]);
|
|
17
|
+
const pkg = JSON.parse(packageRaw);
|
|
18
|
+
const lock = JSON.parse(lockRaw);
|
|
19
|
+
const packageName = "@firstpick/pi-extension-codex-fast-mode";
|
|
20
|
+
|
|
21
|
+
assert.equal(pkg.optionalDependencies?.[packageName], "^0.1.0", "WebUI should declare the Fast-mode companion as optional");
|
|
22
|
+
assert.ok(pkg.pi?.extensions?.includes(`node_modules/${packageName}/index.ts`), "WebUI should load the optional Fast-mode extension when installed");
|
|
23
|
+
assert.equal(lock.packages?.[""]?.optionalDependencies?.[packageName], "^0.1.0", "lock root should mirror the unpublished optional requirement without inventing a resolved artifact");
|
|
24
|
+
assert.equal(lock.packages?.[`node_modules/${packageName}`], undefined, "lockfile must not fabricate a registry resolution before the package is published");
|
|
25
|
+
|
|
26
|
+
assert.match(server, /\["codexFastMode", "@firstpick\/pi-extension-codex-fast-mode"\]/, "server should register the package in Optional Features");
|
|
27
|
+
assert.match(server, /CODEX_FAST_MODE_STATUS_KEY = "codex-fast-mode"[\s\S]*?CODEX_FAST_MODE_COMMAND_NAME = "fast-mode"/, "server should use the extension-owned status and command contracts");
|
|
28
|
+
assert.match(server, /function codexFastModeStatusState\(statusText\)[\s\S]*?text !== "on" && text !== "off"[\s\S]*?known: true, enabled: text === "on"/, "server should accept only exact published on/off states");
|
|
29
|
+
assert.match(server, /function codexFastModeSnapshot\(tab, patch = \{\}\)[\s\S]*?extensionStatusMap\(tab\)\.get\(CODEX_FAST_MODE_STATUS_KEY\)/, "server snapshots should come from remembered extension status");
|
|
30
|
+
assert.match(server, /async function codexFastModeFeatureData[\s\S]*?codexFastModeSnapshot\(tab\)[\s\S]*?tabHasActiveOutput\(tab\)[\s\S]*?CODEX_FAST_MODE_CREDIT_NOTICE/, "GET state should be tab-scoped, extension-owned, busy-aware, and disclose credit use");
|
|
31
|
+
assert.match(server, /async function waitForCodexFastModeStatus\(tab, desired\)[\s\S]*?snapshot\.statusKnown && snapshot\.enabled === desired[\s\S]*?makeHttpError\(409,[\s\S]*?did not confirm/, "server should require bounded authoritative status confirmation");
|
|
32
|
+
assert.match(server, /async function setCodexFastMode[\s\S]*?typeof body\?\.enabled !== "boolean"[\s\S]*?feature\.busy[\s\S]*?type: "prompt", message: `\/\$\{feature\.commandName\} \$\{desired \? "on" : "off"\}`[\s\S]*?waitForCodexFastModeStatus\(tab, desired\)[\s\S]*?requested: desired/, "PUT should require explicit intent, reject busy tabs, invoke the extension, and return only confirmed state");
|
|
33
|
+
assert.doesNotMatch(server, /codexFastModeSnapshot\(tab, \{ enabled: desired/, "server must not infer effective Fast state from RPC success");
|
|
34
|
+
assert.match(server, /url\.pathname === "\/api\/codex-fast-mode" && req\.method === "GET"[\s\S]*?url\.pathname === "\/api\/codex-fast-mode" && req\.method === "PUT"/, "server should expose GET and PUT routes");
|
|
35
|
+
|
|
36
|
+
assert.match(html, /<label for="fastOutputModeSelect">Compact mode \(Experimental\)<\/label>[\s\S]*?<option value="compact-v1">Compact<\/option>/, "legacy output processing should be presented as Compact mode while retaining compact-v1");
|
|
37
|
+
assert.doesNotMatch(html, /<label for="fastOutputModeSelect">Fast mode/, "legacy output processing should no longer be presented as Fast mode");
|
|
38
|
+
assert.match(html, /data-side-panel-section="codex-usage"[\s\S]*?id="codexFastModeSelect"[\s\S]*?<option value="normal">Normal<\/option>[\s\S]*?<option value="fast">Fast<\/option>[\s\S]*?id="setCodexFastModeButton"[\s\S]*?id="codexFastModeStatus"/, "Codex Usage should contain the distinct session Fast-mode control");
|
|
39
|
+
assert.match(styles, /\.codex-fast-mode-control \{[\s\S]*?border:[\s\S]*?background:/, "Codex Fast mode should have a visible control surface");
|
|
40
|
+
|
|
41
|
+
assert.match(app, /id: "codexFastMode"[\s\S]*?packageName: "@firstpick\/pi-extension-codex-fast-mode"[\s\S]*?capabilityLabel: "\/fast-mode"/, "browser Optional Features should catalog Fast mode");
|
|
42
|
+
assert.match(app, /OPTIONAL_FEATURE_DISABLE_PREREQUISITES = new Map\([\s\S]*?\["codexFastMode", \(\) => disableCodexFastModeIntegration\(\)\]/, "browser should register disable-off-first behavior");
|
|
43
|
+
assert.match(app, /if \(disabled\) \{[\s\S]*?OPTIONAL_FEATURE_DISABLE_PREREQUISITES\.get\(feature\.id\)[\s\S]*?await turnOff\(\)[\s\S]*?setOptionalFeatureDisabled\(feature\.id, disabled\)/, "Optional Features Disable should abort before hiding integration if turn-off fails");
|
|
44
|
+
assert.match(app, /function applyCodexFastModeStatus\(statusText\)[\s\S]*?status !== "on" && status !== "off"[\s\S]*?enabled: status === "on"[\s\S]*?statusKnown: true/, "browser should consume only exact extension status values");
|
|
45
|
+
assert.match(app, /async function refreshCodexFastMode\(tabContext = activeTabContext\(\)\)[\s\S]*?api\("\/api\/codex-fast-mode", \{ tabId: tabContext\.tabId \}\)[\s\S]*?!featureEnabled && data\.available[\s\S]*?enabled: false[\s\S]*?isCurrentTabContext\(tabContext\)/, "browser status refresh should stay tab-scoped and disarm restored branches while the feature is hidden");
|
|
46
|
+
assert.match(app, /async function applyCodexFastMode\(\)[\s\S]*?body: \{ enabled \}, tabId: tabContext\.tabId[\s\S]*?1\.5x faster[\s\S]*?may spend 2x credits[\s\S]*?2\.5x/, "browser should apply explicit state and disclose conditional speed/credit multipliers");
|
|
47
|
+
assert.match(app, /async function disableCodexFastModeIntegration\(\)[\s\S]*?tabs\.filter[\s\S]*?Promise\.all\(tabIds\.map[\s\S]*?data\.busy[\s\S]*?enabled: false[\s\S]*?codexFastModeConfirmedOff\(response\.data\)/, "browser-global Disable should preflight every live tab and require each mutation to confirm off");
|
|
48
|
+
assert.match(app, /refreshNaturalConversationMode\(tabContext\),[\s\S]*?refreshCodexFastMode\(tabContext\),/, "tab refreshes should reload branch-scoped Fast-mode state");
|
|
49
|
+
assert.match(app, /statusKey === CODEX_FAST_MODE_STATUS_KEY[\s\S]*?applyCodexFastModeStatus\(request\.statusText\)/, "extension status events should refresh the active-tab selector");
|
|
50
|
+
|
|
51
|
+
assert.match(readme, /### Compact live output mode[\s\S]*?select \*\*Compact\*\*[\s\S]*?`compact-v1`/, "README should document Compact mode with the stable wire identifier");
|
|
52
|
+
assert.match(readme, /### Codex subscription Fast mode[\s\S]*?service_tier: "priority"[\s\S]*?1\.5× faster[\s\S]*?2× Standard credits[\s\S]*?2\.5×/, "README should separately document subscription Fast mode and its cost semantics");
|
|
53
|
+
assert.match(serviceWorker, /pi-webui-pwa-v50/, "PWA cache identity should be bumped for changed browser assets");
|
|
54
|
+
assert.match(html, /data-app-src="\/app\.js\?v=94"/, "browser module URL should be cache-busted for Fast-mode wiring");
|
|
55
|
+
|
|
56
|
+
console.log("codex-fast-mode-static.test.mjs passed");
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { readFile } from "node:fs/promises";
|
|
3
|
+
import vm from "node:vm";
|
|
4
|
+
import { dirname, join } from "node:path";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
|
|
7
|
+
const root = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
8
|
+
const app = await readFile(join(root, "public", "app.js"), "utf8");
|
|
9
|
+
|
|
10
|
+
function functionSource(name, nextName) {
|
|
11
|
+
const start = app.indexOf(`function ${name}(`);
|
|
12
|
+
const end = app.indexOf(`\nfunction ${nextName}(`, start);
|
|
13
|
+
assert.ok(start >= 0 && end > start, `${name} should remain a standalone frontend helper`);
|
|
14
|
+
return app.slice(start, end);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function chip(width) {
|
|
18
|
+
return {
|
|
19
|
+
hidden: false,
|
|
20
|
+
textContent: "",
|
|
21
|
+
title: "",
|
|
22
|
+
measurements: 0,
|
|
23
|
+
getBoundingClientRect() {
|
|
24
|
+
this.measurements += 1;
|
|
25
|
+
return { width };
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const tags = [chip(50), chip(60), chip(70)];
|
|
31
|
+
const overflow = chip(22);
|
|
32
|
+
const container = {
|
|
33
|
+
hidden: false,
|
|
34
|
+
clientWidth: 150,
|
|
35
|
+
querySelectorAll: (selector) => selector === "button.composer-skill-tag" ? tags : [],
|
|
36
|
+
querySelector: (selector) => selector === ".composer-skill-tag.overflow" ? overflow : null,
|
|
37
|
+
};
|
|
38
|
+
const context = {
|
|
39
|
+
elements: { sessionSkillTags: container },
|
|
40
|
+
getComputedStyle: () => ({ columnGap: "5px", gap: "5px" }),
|
|
41
|
+
};
|
|
42
|
+
vm.runInNewContext(
|
|
43
|
+
`${functionSource("fitSessionSkillTags", "scheduleSessionSkillTagLayout")}\nthis.fitSessionSkillTags = fitSessionSkillTags;`,
|
|
44
|
+
context,
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
context.fitSessionSkillTags();
|
|
48
|
+
assert.deepEqual(tags.map((tag) => tag.hidden), [false, false, true], "the strip should show the maximum chip count that fits the measured width");
|
|
49
|
+
assert.equal(overflow.hidden, false, "the overflow chip should remain visible while tags are hidden");
|
|
50
|
+
assert.equal(overflow.textContent, "+1", "the overflow chip should report the current hidden count");
|
|
51
|
+
assert.equal(overflow.measurements, 1, "fitting should measure one overflow width per digit count rather than forcing layout for every candidate");
|
|
52
|
+
|
|
53
|
+
container.clientWidth = 200;
|
|
54
|
+
context.fitSessionSkillTags();
|
|
55
|
+
assert.deepEqual(tags.map((tag) => tag.hidden), [false, false, false], "widening the input should reveal every tag without rerendering the session state");
|
|
56
|
+
assert.equal(overflow.hidden, true, "the overflow chip should disappear when every tag fits");
|
|
57
|
+
|
|
58
|
+
container.clientWidth = 80;
|
|
59
|
+
context.fitSessionSkillTags();
|
|
60
|
+
assert.deepEqual(tags.map((tag) => tag.hidden), [false, true, true], "narrowing the input should compact the tag strip again");
|
|
61
|
+
assert.equal(overflow.textContent, "+2", "responsive compaction should keep the overflow count current");
|
|
62
|
+
|
|
63
|
+
container.clientWidth = 0;
|
|
64
|
+
const zeroWidthState = tags.map((tag) => tag.hidden);
|
|
65
|
+
const zeroWidthOverflowText = overflow.textContent;
|
|
66
|
+
context.fitSessionSkillTags();
|
|
67
|
+
assert.deepEqual(tags.map((tag) => tag.hidden), zeroWidthState, "a temporarily unmeasurable strip should preserve its last stable visibility state");
|
|
68
|
+
assert.equal(overflow.textContent, zeroWidthOverflowText, "a zero-width pass should not expose a stale overflow count");
|
|
69
|
+
|
|
70
|
+
console.log("composer skill tag layout tests passed");
|
|
@@ -95,7 +95,7 @@ assert.match(app, /case "tool_execution_end":[\s\S]*?compactLiveScheduler\.flush
|
|
|
95
95
|
assert.match(resetStream, /resetCompactLiveOutput\(\)/, "reset and tab changes should cancel compact pending work");
|
|
96
96
|
assert.match(app, /case "message_end": \{\s+if \(compactOutputActive\(\)\) finishCompactLiveOutput\(tabContext\);/, "message ends should synchronously flush compact output before reconciliation");
|
|
97
97
|
assert.match(app, /case "agent_end":\s+if \(compactOutputActive\(\)\) finishCompactLiveOutput\(tabContext\);/, "agent ends should synchronously flush compact output before reconciliation");
|
|
98
|
-
assert.match(compactTranscript, /message\.role !== "assistant"[\s\S]*?appendMarkdown\(body, output \|\| "_\[non-text output omitted in
|
|
98
|
+
assert.match(compactTranscript, /message\.role !== "assistant"[\s\S]*?appendMarkdown\(body, output \|\| "_\[non-text output omitted in compact mode\]_"\)[\s\S]*?classList\.add\("compact-transcript-text"\)/, "reconciled compact-mode assistant output should preserve Markdown and explain omitted non-text output");
|
|
99
99
|
assert.doesNotMatch(compactTranscript, /appendText|renderToolExecution|normalizeToolExecution|JSON\.stringify|appendToolOutput|appendToolDiff|appendToolImages/, "fast-mode final output must not fall back to plain text or render tool details");
|
|
100
100
|
assert.match(createMessageBubble, /compactOutputActive\(\) && !streaming[\s\S]*?renderCompactTranscriptBody\(body, message\)/, "final transcript rendering should select the compact Markdown path only for acknowledged fast mode");
|
|
101
101
|
assert.match(appendTranscriptMessage, /compactTranscript && transcriptMessage\.role !== "assistant"/, "fast-mode assistant reconciliation should defer all thinking to the aggregate transcript item and retain only final output");
|
|
@@ -127,7 +127,7 @@ assert.match(refreshMessages, /preserveCompactStream = compactLiveStreamRenderAc
|
|
|
127
127
|
assert.match(app, /const SETTINGS_OUTPUT_MODE_OPTIONS = \[[\s\S]*?value: "normal"[\s\S]*?value: "compact-v1"/, "settings should offer normal and compact-v1 server defaults");
|
|
128
128
|
assert.match(nativeSettingsDialog, /api\("\/api\/webui-output-mode", \{ scoped: false \}\)/, "opening settings should load output-mode metadata from the separate server API");
|
|
129
129
|
assert.match(nativeSettingsDialog, /outputMode: nativeSettingSelect\("Output processing", outputModeMetadata\.persistedDefault, SETTINGS_OUTPUT_MODE_OPTIONS,[\s\S]*?\{ label: "server", tone: "startup" \}\)/, "Browser workflow should expose a server-badged output-processing selector");
|
|
130
|
-
assert.match(nativeSettingsDialog, /
|
|
130
|
+
assert.match(nativeSettingsDialog, /Compact mode preserves Markdown final output, keeps live thinking expanded, groups stored thinking in one collapsed disclosure per turn, shows only the current tool status transiently, and does not change model inference or token generation\. Changes use server barriers without restarting Pi\./, "settings copy should distinguish expanded live thinking from collapsed stored thinking without changing inference semantics");
|
|
131
131
|
assert.match(nativeSettingsDialog, /nativeSettingsSection\("Browser workflow"[\s\S]*?controls\.outputMode/, "the output-mode selector should be placed in Browser workflow");
|
|
132
132
|
assert.match(outputModeMetadataText, /Persisted default:[\s\S]*?Effective mode:[\s\S]*?Source:/, "settings should display persisted default plus effective mode and source");
|
|
133
133
|
assert.match(outputModeMetadataText, /metadata\.overridden[\s\S]*?overrides the persisted setting/, "settings should display CLI/environment override state when it wins");
|
|
@@ -137,12 +137,12 @@ assert.match(nativeSettingsDialog, /method: "PUT",[\s\S]*?body: \{ outputModeDef
|
|
|
137
137
|
assert.doesNotMatch(nativeSettingsPayload, /outputMode(?:Default|Metadata|ApiDiagnostic|Changed)?/, "server-scoped output mode must stay out of the native SettingsManager payload");
|
|
138
138
|
assert.match(nativeSettingsDialog, /const response = await nativeCommandApi\("\/api\/settings", \{ method: "POST", body: \{ settings: payload, reload \} \}\);[\s\S]*?nativeSettingsChangedMessage\(response, reload\)/, "existing native settings apply behavior should remain intact");
|
|
139
139
|
|
|
140
|
-
assert.match(html, /data-side-panel-section="controls"[\s\S]*?id="outputProcessingControlsTitle">Output processing<[\s\S]*?<span class="control-scope-badge">Server<\/span>[\s\S]*?id="fastOutputModeSelect"[\s\S]*?<option value="normal">Normal<\/option>[\s\S]*?<option value="compact-v1">
|
|
140
|
+
assert.match(html, /data-side-panel-section="controls"[\s\S]*?id="outputProcessingControlsTitle">Output processing<[\s\S]*?<span class="control-scope-badge">Server<\/span>[\s\S]*?id="fastOutputModeSelect"[\s\S]*?<option value="normal">Normal<\/option>[\s\S]*?<option value="compact-v1">Compact<\/option>[\s\S]*?id="setFastOutputModeButton"[\s\S]*?id="fastOutputModeStatus"/, "Controls should expose a server-scoped normal/compact selector with apply button and live status");
|
|
141
141
|
assert.match(app, /fastOutputModeSelect: \$\("#fastOutputModeSelect"\)[\s\S]*?setFastOutputModeButton: \$\("#setFastOutputModeButton"\)[\s\S]*?fastOutputModeStatus: \$\("#fastOutputModeStatus"\)/, "sidebar fast-mode elements should be wired");
|
|
142
142
|
assert.match(sidebarOutputModeRefresh, /api\("\/api\/webui-output-mode", \{ scoped: false \}\)[\s\S]*?normalizeWebuiOutputModeMetadata\(response\.data\)/, "sidebar selector should load current server output-mode metadata");
|
|
143
143
|
assert.match(sidebarOutputModeApply, /method: "PUT"[\s\S]*?body: \{ outputModeDefault \}[\s\S]*?scoped: false[\s\S]*?await refreshSidebarOutputMode\(\)/, "sidebar selector should persist the selected mode and refresh effective metadata");
|
|
144
|
-
assert.match(sidebarOutputModeApply, /outputModeDefault === "compact-v1"[\s\S]*?
|
|
145
|
-
assert.match(sidebarOutputModeApply, /sidebarOutputModeDiagnostic = ""[\s\S]*?sidebarOutputModeNotice = `Failed to update
|
|
144
|
+
assert.match(sidebarOutputModeApply, /outputModeDefault === "compact-v1"[\s\S]*?Compact output mode enabled[\s\S]*?Normal output processing restored/, "sidebar apply feedback should distinguish enabling compact mode from restoring normal mode");
|
|
145
|
+
assert.match(sidebarOutputModeApply, /sidebarOutputModeDiagnostic = ""[\s\S]*?sidebarOutputModeNotice = `Failed to update compact mode:[\s\S]*?You can retry\.`[\s\S]*?sidebarOutputModeLoaded = true/, "a transient apply failure should remain visible without permanently disabling retry");
|
|
146
146
|
assert.match(app, /function renderSidebarOutputModeControl[\s\S]*?sidebarOutputModeNotice[\s\S]*?webuiOutputModeMetadataText\(sidebarOutputModeMetadata\)[\s\S]*?updateSidebarOutputModeApplyState\(\)/, "sidebar status should expose retry notices or persisted/effective/source metadata and apply state");
|
|
147
147
|
assert.match(styles, /\.toggle-control-hint\.warning\s*\{[\s\S]*?color: var\(--ctp-yellow\)/, "sidebar output-mode failures should use the warning palette");
|
|
148
148
|
assert.match(app, /fastOutputModeSelect\?\.addEventListener\("change", \(\) => \{[\s\S]*?sidebarOutputModeNotice = ""[\s\S]*?renderSidebarOutputModeControl\(\{ syncSelection: false \}\)[\s\S]*?setFastOutputModeButton\?\.addEventListener\("click", \(\) => applySidebarOutputMode\(\)/, "sidebar selection should clear transient failures and keep Apply retryable");
|
|
@@ -150,9 +150,9 @@ assert.match(app, /refreshSidebarOutputMode\(\)\.catch[\s\S]*?initializeTabs\(\)
|
|
|
150
150
|
|
|
151
151
|
assert.match(helper, /FAST_OUTPUT_FLUSH_INTERVAL_MS = 100/, "the live scheduler should retain the exact 100 ms sustained-output bound");
|
|
152
152
|
assert.match(worker, /pi-webui-pwa-v\d+[\s\S]*?"\/fast-output-live\.mjs"/, "PWA cache identity and app shell should include the compact helper");
|
|
153
|
-
assert.match(html, /<label for="fastOutputModeSelect">
|
|
154
|
-
assert.match(html, /Markdown final output; live thinking expanded; stored thinking grouped and collapsed/, "the sidebar should distinguish
|
|
155
|
-
assert.match(html, /id="webuiBootLoader"[^>]*data-app-src="\/app\.js\?v=
|
|
153
|
+
assert.match(html, /<label for="fastOutputModeSelect">Compact mode \(Experimental\)<\/label>/, "the sidebar should mark compact mode as experimental");
|
|
154
|
+
assert.match(html, /Lightweight browser rendering; Markdown final output; live thinking expanded; stored thinking grouped and collapsed/, "the sidebar should distinguish compact rendering from model inference");
|
|
155
|
+
assert.match(html, /id="webuiBootLoader"[^>]*data-app-src="\/app\.js\?v=94"/, "the guarded PWA entry point should cache-bust browser wiring");
|
|
156
156
|
assert.match(JSON.parse(packageRaw).scripts.check, /node --check public\/fast-output-live\.mjs/, "package checks should parse the compact helper");
|
|
157
157
|
|
|
158
158
|
const events = createFastModeOutputEvents();
|
|
@@ -28,6 +28,8 @@ let activeBash = 0;
|
|
|
28
28
|
let peakBash = 0;
|
|
29
29
|
let thinkingLevel = "off";
|
|
30
30
|
let conversationEnabled = false;
|
|
31
|
+
let codexFastModeEnabled = false;
|
|
32
|
+
let rejectNextCodexFastModeMutation = false;
|
|
31
33
|
const fakeTools = [
|
|
32
34
|
{ name: "read", description: "Read files", sourceInfo: { source: "builtin", scope: "temporary", origin: "top-level" } },
|
|
33
35
|
{ name: "bash", description: "Run shell commands", sourceInfo: { source: "builtin", scope: "temporary", origin: "top-level" } },
|
|
@@ -326,6 +328,43 @@ function emitConversationStatus() {
|
|
|
326
328
|
});
|
|
327
329
|
}
|
|
328
330
|
|
|
331
|
+
function emitCodexFastModeStatus() {
|
|
332
|
+
emitEvent({
|
|
333
|
+
type: "extension_ui_request",
|
|
334
|
+
id: randomUUID(),
|
|
335
|
+
method: "setStatus",
|
|
336
|
+
statusKey: "codex-fast-mode",
|
|
337
|
+
statusText: codexFastModeEnabled ? "on" : "off",
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
function handleCodexFastModePrompt(command, base) {
|
|
342
|
+
const message = String(command.message || "").trim();
|
|
343
|
+
if (message === "fixture reject next codex fast mode mutation") {
|
|
344
|
+
rejectNextCodexFastModeMutation = true;
|
|
345
|
+
// Prompt routing marks the tab active before RPC dispatch; settle this control-only fixture
|
|
346
|
+
// synchronously so the following PUT exercises status confirmation rather than preflight busy.
|
|
347
|
+
emitEvent({ type: "agent_start" });
|
|
348
|
+
emitEvent({ type: "agent_settled" });
|
|
349
|
+
respond({ ...base, data: { output: "next Codex Fast mode mutation will be rejected" } });
|
|
350
|
+
return true;
|
|
351
|
+
}
|
|
352
|
+
const match = message.match(/^\/fast-mode(?:\s+(on|off|status))?$/i);
|
|
353
|
+
if (!match) return false;
|
|
354
|
+
const subcommand = String(match[1] || "").toLowerCase();
|
|
355
|
+
if (subcommand !== "status" && rejectNextCodexFastModeMutation) {
|
|
356
|
+
rejectNextCodexFastModeMutation = false;
|
|
357
|
+
respond({ ...base, data: { output: "Fast mode mutation rejected while busy" } });
|
|
358
|
+
return true;
|
|
359
|
+
}
|
|
360
|
+
if (!subcommand) codexFastModeEnabled = !codexFastModeEnabled;
|
|
361
|
+
else if (subcommand === "on") codexFastModeEnabled = true;
|
|
362
|
+
else if (subcommand === "off") codexFastModeEnabled = false;
|
|
363
|
+
emitCodexFastModeStatus();
|
|
364
|
+
respond({ ...base, data: { output: `Fast mode ${codexFastModeEnabled ? "on" : "off"}.` } });
|
|
365
|
+
return true;
|
|
366
|
+
}
|
|
367
|
+
|
|
329
368
|
function handleWebuiHelperPrompt(command, base) {
|
|
330
369
|
const message = String(command.message || "").trim();
|
|
331
370
|
const match = message.match(/^\/webui-helper\s+(\{[\s\S]*\})$/);
|
|
@@ -748,6 +787,7 @@ rl.on("line", (line) => {
|
|
|
748
787
|
{ name: "talk", source: "extension", description: "Toggle Natural Conversation Mode" },
|
|
749
788
|
{ name: "voice", source: "extension", description: "Natural Conversation Mode alias" },
|
|
750
789
|
{ name: "conversation", source: "extension", description: "Natural Conversation Mode alias" },
|
|
790
|
+
{ name: "fast-mode", source: "extension", description: "Toggle Codex subscription Fast mode" },
|
|
751
791
|
{ name: "workflow", source: "extension", description: "Run and inspect JavaScript workflows" },
|
|
752
792
|
],
|
|
753
793
|
},
|
|
@@ -777,6 +817,7 @@ rl.on("line", (line) => {
|
|
|
777
817
|
if (handleSubagentFixturePrompt(command, base)) return;
|
|
778
818
|
if (handleDocumentArtifactFixturePrompt(command, base)) return;
|
|
779
819
|
if (handleWorkflowFixturePrompt(command, base)) return;
|
|
820
|
+
if (handleCodexFastModePrompt(command, base)) return;
|
|
780
821
|
if (handleTalkPrompt(command, base)) return;
|
|
781
822
|
if (handleContinuityPrompt(command, base)) return;
|
|
782
823
|
if (handleLargePayloadPrompt(command, base)) return;
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
GIT_WORKFLOW_SETUP_VERSION,
|
|
7
7
|
gitWorkflowPreferencesSummary,
|
|
8
8
|
isGitWorkflowSetupComplete,
|
|
9
|
+
normalizeInterfacePreferences,
|
|
9
10
|
readGitWorkflowPreferences,
|
|
10
11
|
readWebuiSettings,
|
|
11
12
|
supportedGitWorkflowThinkingLevels,
|
|
@@ -24,6 +25,10 @@ assert.deepEqual(
|
|
|
24
25
|
["off", "low", "medium", "high", "max"],
|
|
25
26
|
"null map entries should be hidden while explicit extended levels remain available",
|
|
26
27
|
);
|
|
28
|
+
assert.deepEqual(normalizeInterfacePreferences({}), { sidePanelWidth: null });
|
|
29
|
+
assert.deepEqual(normalizeInterfacePreferences({ sidePanelWidth: 617.6 }), { sidePanelWidth: 618 });
|
|
30
|
+
assert.deepEqual(normalizeInterfacePreferences({ sidePanelWidth: 10 }), { sidePanelWidth: 320 });
|
|
31
|
+
assert.deepEqual(normalizeInterfacePreferences({ sidePanelWidth: 9000 }), { sidePanelWidth: 4096 });
|
|
27
32
|
|
|
28
33
|
const root = await mkdtemp(path.join(tmpdir(), "pi-webui-git-preferences-"));
|
|
29
34
|
const settingsFile = path.join(root, "settings.json");
|
|
@@ -62,6 +67,7 @@ try {
|
|
|
62
67
|
tools: { enabledTools: ["read", " write ", "read", ""] },
|
|
63
68
|
skills: { enabledSkills: ["repo-explorer", "code-security"] },
|
|
64
69
|
},
|
|
70
|
+
interfacePreferences: { sidePanelWidth: 612 },
|
|
65
71
|
}, settingsFile);
|
|
66
72
|
|
|
67
73
|
const partiallyUpdated = await writeGitWorkflowPreferences({ deliveryMode: "current" }, settingsFile);
|
|
@@ -76,6 +82,8 @@ try {
|
|
|
76
82
|
assert.equal(persisted.gitWorkflow.generation.provider, "fake");
|
|
77
83
|
assert.deepEqual(persisted.resourceDefaults.tools.enabledTools, ["read", "write"], "global tool defaults should be normalized and deduplicated");
|
|
78
84
|
assert.deepEqual(persisted.resourceDefaults.skills.enabledSkills, ["repo-explorer", "code-security"], "global skill defaults should persist beside other Web UI settings");
|
|
85
|
+
assert.equal(persisted.interfacePreferences.sidePanelWidth, 612, "the user-scoped Control Deck width should persist beside other Web UI settings");
|
|
86
|
+
assert.equal((await readWebuiSettings(settingsFile)).interfacePreferences.sidePanelWidth, 612);
|
|
79
87
|
assert.match(gitWorkflowPreferencesSummary(await readGitWorkflowPreferences(settingsFile)), /fake\/fake-model/);
|
|
80
88
|
if (process.platform !== "win32") assert.equal((await stat(settingsFile)).mode & 0o777, 0o600);
|
|
81
89
|
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { readFile } from "node:fs/promises";
|
|
3
|
+
|
|
4
|
+
const server = await readFile(new URL("../bin/pi-webui.mjs", import.meta.url), "utf8");
|
|
5
|
+
|
|
6
|
+
assert.match(
|
|
7
|
+
server,
|
|
8
|
+
/if \(push && \/fatal:\\s\+no configured push destination\\\.\/\.test\(text\)\) \{\s*return \{ code: "NO_REMOTE", hint: NO_REMOTE_HINT \};/,
|
|
9
|
+
"only Git's explicit no-push-destination failure should receive NO_REMOTE classification",
|
|
10
|
+
);
|
|
11
|
+
assert.doesNotMatch(
|
|
12
|
+
server,
|
|
13
|
+
/does not appear to be a git repository[\s\S]{0,160}NO_REMOTE|NO_REMOTE[\s\S]{0,160}does not appear to be a git repository/,
|
|
14
|
+
"an invalid configured remote must not be reclassified as remote-less",
|
|
15
|
+
);
|
|
16
|
+
assert.match(
|
|
17
|
+
server,
|
|
18
|
+
/const GIT_WORKFLOW_MUTATING_PATHS = new Set\(\[[\s\S]*"\/api\/git-workflow\/publish"[\s\S]*\]\);/,
|
|
19
|
+
"publication must use the POST-only mutating workflow allowlist",
|
|
20
|
+
);
|
|
21
|
+
assert.match(
|
|
22
|
+
server,
|
|
23
|
+
/case "\/api\/git-workflow\/publish": \{[\s\S]*cleanGitHubRepoName\(body\.repoName\)[\s\S]*visibility !== "public" && visibility !== "private"[\s\S]*requireConfirmed\(body,[\s\S]*getGitRoot\(cwd\)[\s\S]*gitRemoteNames\(root\)[\s\S]*remotes\.length[\s\S]*currentGitBranch\(root\)/,
|
|
24
|
+
"the server must validate name/visibility/confirmation and refuse existing-remote repair before publication",
|
|
25
|
+
);
|
|
26
|
+
assert.match(
|
|
27
|
+
server,
|
|
28
|
+
/runGitHubWorkflowCommand\(\s*\["repo", "create", repoName, `--\$\{visibility\}`, "--source", root, "--remote", "origin", "--push"\],[\s\S]*timeoutMs: 15 \* 60 \* 1000/,
|
|
29
|
+
"publication must run the approved non-interactive gh repo create command through the bounded workflow runner",
|
|
30
|
+
);
|
|
31
|
+
assert.match(
|
|
32
|
+
server,
|
|
33
|
+
/if \(payload\.ok\) Object\.assign\(payload\.data, \{ repoName, visibility, remote: "origin", branch, protectedBranch \}\);/,
|
|
34
|
+
"successful publication must extend the process envelope with the approved metadata",
|
|
35
|
+
);
|
|
36
|
+
assert.match(server, /payload\.code = "AUTH";[\s\S]*gh auth login/, "gh authentication failures should receive an actionable AUTH hint");
|
|
37
|
+
assert.match(server, /name already exists on this account\|repository \.\+ already exists[\s\S]*Choose another repository name/, "safe name-conflict output should receive a retry hint");
|
|
38
|
+
assert.match(server, /GH_PROMPT_DISABLED: process\.env\.GH_PROMPT_DISABLED \|\| "1"/, "gh publication must inherit disabled interactive prompts");
|
|
39
|
+
|
|
40
|
+
console.log("guided git publication backend static tests passed");
|