@firstpick/pi-package-webui 0.10.9 → 0.11.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/DEVELOPMENT.md +12 -2
- package/README.md +4 -2
- package/TECHNICAL.md +7 -1
- package/bin/pi-webui.mjs +26 -16
- package/package.json +14 -8
- package/public/app.js +48 -24
- package/public/codex-speed-mode.mjs +36 -0
- package/public/index.html +6 -5
- package/public/service-worker.js +2 -1
- package/tests/boot-failure-diagnostics.test.mjs +2 -2
- package/tests/codex-fast-mode-static.test.mjs +12 -11
- package/tests/codex-speed-mode-browser-state.test.mjs +149 -0
- package/tests/codex-speed-mode.test.mjs +36 -0
- package/tests/composer-action-grid-reorder-static.test.mjs +2 -2
- package/tests/control-visibility-static.test.mjs +2 -2
- package/tests/controls-layout-static.test.mjs +2 -2
- package/tests/events-tree-context-menu-static.test.mjs +2 -2
- package/tests/fast-mode-client-static.test.mjs +1 -1
- package/tests/feature-decision-output-popup-static.test.mjs +1 -1
- package/tests/file-viewer-image-static.test.mjs +2 -2
- package/tests/fixtures/fake-pi.mjs +18 -8
- package/tests/guided-git-activation-static.test.mjs +2 -2
- package/tests/guided-git-fallback-ui-static.test.mjs +2 -2
- package/tests/host-peer-dependencies.test.mjs +24 -0
- package/tests/http-endpoints-harness.test.mjs +52 -0
- package/tests/intercom-conversation-viewer-static.test.mjs +2 -2
- package/tests/main-output-loading-static.test.mjs +2 -2
- package/tests/middle-button-drag-scroll-static.test.mjs +2 -2
- package/tests/mobile-continuity-tablet-static.test.mjs +2 -2
- package/tests/mobile-foundation-static.test.mjs +2 -2
- package/tests/mobile-phone-experience-static.test.mjs +1 -1
- package/tests/open-issue-wizard-static.test.mjs +1 -1
- package/tests/optional-feature-prompt-impact-static.test.mjs +2 -2
- package/tests/persistent-ui-layout-static.test.mjs +2 -2
- package/tests/prompt-input-vertical-scroll-static.test.mjs +2 -2
- package/tests/questionnaire-dialog.test.mjs +2 -2
- package/tests/session-sampling-ui-static.test.mjs +2 -2
- package/tests/side-panel-section-height-removal-static.test.mjs +2 -2
- package/tests/subagent-observability-static.test.mjs +2 -2
- package/tests/syntax-highlighting-static.test.mjs +2 -2
- package/tests/theme-customizer-static.test.mjs +1 -1
- package/tests/windows-drive-cwd-picker-static.test.mjs +2 -2
package/DEVELOPMENT.md
CHANGED
|
@@ -4,6 +4,12 @@ Contributor-only implementation, API, architecture, testing, and maintenance inf
|
|
|
4
4
|
|
|
5
5
|
[Back to README](README.md) · [Advanced user technical reference](TECHNICAL.md)
|
|
6
6
|
|
|
7
|
+
## Host-provided dependencies
|
|
8
|
+
|
|
9
|
+
Declare `@earendil-works/pi-ai`, `@earendil-works/pi-coding-agent`, `@earendil-works/pi-tui`, and `typebox` as `peerDependencies` with a `"*"` range. Pi supplies them to extensions. Regular runtime dependencies can install duplicate Pi modules and trigger an extension warning. Keep versioned development dependencies for checkout tests and standalone CLI development, and regenerate the npm and Bun lockfiles after changing the manifest.
|
|
10
|
+
|
|
11
|
+
Run `node tests/host-peer-dependencies.test.mjs` to check the peer declarations and npm lockfile root.
|
|
12
|
+
|
|
7
13
|
## Tool and skill command ownership
|
|
8
14
|
|
|
9
15
|
WebUI does not register TUI `/tools` or `/skills` commands. The standalone `@firstpick/pi-extension-tools` and `@firstpick/pi-extension-setup-skills` packages own those commands and their Session, Global, and Model selector flow. Shared profile resolution, locking, and TUI selector components live in `@firstpick/pi-utils`. Browser-native tool and skill controls continue through `webui-rpc-helper.mjs` and the WebUI HTTP routes against the same saved state.
|
|
@@ -582,9 +588,13 @@ The included compact-mode metric measures deterministic post-parse serialized JS
|
|
|
582
588
|
|
|
583
589
|
### Codex subscription Fast mode
|
|
584
590
|
|
|
585
|
-
The optional `@firstpick/pi-extension-codex-fast-mode` companion adds `/fast-mode` and a **Normal / Fast** selector under **Codex Usage**.
|
|
591
|
+
The optional `@firstpick/pi-extension-codex-fast-mode` companion adds `/fast-mode` and a **Normal / Fast / Ultrafast** selector under **Codex Usage**. Normal is the default and state is scoped to the active Pi session branch. The browser asks the extension to change mode and renders the extension-published `codex-fast-mode` status; it does not inspect ChatGPT credentials or rewrite provider requests itself.
|
|
592
|
+
|
|
593
|
+
Fast marks subscription-backed `openai-codex` / `openai-codex-responses` requests with `service_tier: "priority"`. Ultrafast uses `service_tier: "ultrafast"` only for matching `gpt-6-astra` model metadata and serialized requests. Upstream account and model eligibility remain authoritative. Ultrafast costs 8× Standard included usage or 6× purchased-credit/pay-as-you-go usage, subject to workspace terms; the browser asks for cost confirmation before selecting it.
|
|
594
|
+
|
|
595
|
+
The extension status values are `off`, `on`, and `ultrafast`. `public/codex-speed-mode.mjs` normalizes them to `normal`, `fast`, and `ultrafast`. `GET /api/codex-fast-mode` adds `mode` and `ultrafastModelEligible` while retaining `enabled`. `PUT` accepts `{ mode }` or the legacy `{ enabled }`, rejecting invalid or contradictory intent. Legacy true selects Fast and false selects Normal. Mutation completion requires an exact extension-published mode, not just an enabled boolean, so rejected Fast/Ultrafast transitions cannot look successful.
|
|
586
596
|
|
|
587
|
-
|
|
597
|
+
Mode changes are blocked while the active tab is busy. Server and browser checks gate Ultrafast on the exact subscription provider, API, and Astra ID without inferring plan access. Disabling the optional feature turns either enabled override off before hiding its integration. The offline HTTP harness and browser-state tests cover legacy writes, invalid intent, model gating, exact mode confirmation, cancellation of the cost prompt, and disable-off-first handling.
|
|
588
598
|
|
|
589
599
|
## Main features
|
|
590
600
|
|
package/README.md
CHANGED
|
@@ -244,9 +244,11 @@ Ask a quick side question without derailing the main agent flow, then transfer u
|
|
|
244
244
|
|
|
245
245
|

|
|
246
246
|
|
|
247
|
-
**Optional feature needed:** None for usage reporting
|
|
247
|
+
**Optional feature needed:** None for usage reporting, which is included in Pi Web UI core for supported Codex authentication. The Normal/Fast/Ultrafast selector requires `@firstpick/pi-extension-codex-fast-mode`.
|
|
248
248
|
|
|
249
|
-
Monitor subscription usage windows and reset times
|
|
249
|
+
Monitor subscription usage windows and reset times. With the companion enabled, choose a speed under Codex Usage and click Apply. Ultrafast is offered only for subscription-backed GPT-6 Astra and asks for cost confirmation.
|
|
250
|
+
|
|
251
|
+
**Ultrafast costs more:** it requires Pro $500 or eligible Enterprise/Edu access and uses 8× Standard included usage or 6× purchased-credit/pay-as-you-go usage. Workspace terms may differ. The selector shows your preference, not confirmation of upstream acceptance.
|
|
250
252
|
|
|
251
253
|
#### Pi stats
|
|
252
254
|
|
package/TECHNICAL.md
CHANGED
|
@@ -186,7 +186,13 @@ Behavior and limits:
|
|
|
186
186
|
|
|
187
187
|
## Codex subscription Fast mode
|
|
188
188
|
|
|
189
|
-
The optional `@firstpick/pi-extension-codex-fast-mode` companion adds a **Normal / Fast** selector under **Codex Usage**.
|
|
189
|
+
The optional `@firstpick/pi-extension-codex-fast-mode` companion adds a **Normal / Fast / Ultrafast** selector under **Codex Usage**. Normal is the default. The preference belongs to the active Pi session branch, and changes are blocked while that tab is busy. The displayed mode is a preference, not proof that OpenAI accepted the tier.
|
|
190
|
+
|
|
191
|
+
Fast increases usage. Current Codex documentation lists 2.5× Standard included subscription usage and 2× purchased-credit or Enterprise pay-as-you-go usage for supported models.
|
|
192
|
+
|
|
193
|
+
Ultrafast is offered only for subscription-backed GPT-6 Astra. Click Apply and confirm the cost warning to select it. It requires Pro $500 or eligible Enterprise/Edu access and uses 8× Standard included usage or 6× purchased-credit/pay-as-you-go usage. Workspace terms, permissions, spend controls, and inference residency can limit access. Other self-serve plans do not qualify at launch, even with purchased credits.
|
|
194
|
+
|
|
195
|
+
Update both the extension and Web UI for the third mode. If you switch models, a restored Ultrafast preference can remain selected but inactive. Choose Normal to remove either override. Turning off the optional integration disarms both enabled modes before hiding the control. See the [extension technical reference](../pi-extension-codex-fast-mode/TECHNICAL.md) for commands, migration, rollback, and eligibility details.
|
|
190
196
|
|
|
191
197
|
## Footer scoped-model layouts
|
|
192
198
|
|
package/bin/pi-webui.mjs
CHANGED
|
@@ -29,6 +29,7 @@ import {
|
|
|
29
29
|
validateSavedAppendSystemSelection,
|
|
30
30
|
} from "../lib/append-system-selection.mjs";
|
|
31
31
|
import { resolveCodexUsageAuth } from "../lib/codex-usage-auth.mjs";
|
|
32
|
+
import { codexSpeedModeFromIntent, codexSpeedModeFromStatus } from "../public/codex-speed-mode.mjs";
|
|
32
33
|
import { AgentRunIndex, canonicalAgentRunId, normalizeAgentInstance } from "../lib/agent-run-protocol.mjs";
|
|
33
34
|
import { AgentRunRegistry } from "../lib/agent-run-registry.mjs";
|
|
34
35
|
import { resolveScopedModelsFromPatterns } from "../lib/scoped-models.mjs";
|
|
@@ -484,7 +485,7 @@ const CODEX_FAST_MODE_STATUS_KEY = "codex-fast-mode";
|
|
|
484
485
|
const CODEX_FAST_MODE_COMMAND_NAME = "fast-mode";
|
|
485
486
|
const CODEX_FAST_MODE_PROVIDER = "openai-codex";
|
|
486
487
|
const CODEX_FAST_MODE_STATUS_TIMEOUT_MS = 1000;
|
|
487
|
-
const CODEX_FAST_MODE_CREDIT_NOTICE = "Fast mode
|
|
488
|
+
const CODEX_FAST_MODE_CREDIT_NOTICE = "Fast mode increases Codex usage; current rates depend on the model and billing plan. Ultrafast requires GPT-6 Astra and Pro $500 or eligible Enterprise/Edu access, using 8x Standard included usage or 6x purchased-credit/pay-as-you-go usage. Workspace terms may differ. Only subscription-backed openai-codex requests are changed; upstream eligibility stays authoritative.";
|
|
488
489
|
const PACKAGE_NAME_CACHE = new Map();
|
|
489
490
|
|
|
490
491
|
function usage() {
|
|
@@ -14091,21 +14092,21 @@ function codexFastModeCommandBaseName(name) {
|
|
|
14091
14092
|
return String(name || "").trim().toLowerCase().replace(/:\d+$/, "");
|
|
14092
14093
|
}
|
|
14093
14094
|
|
|
14094
|
-
//
|
|
14095
|
-
// browser can render an explicit unknown state instead of silently claiming Fast mode is off.
|
|
14095
|
+
// Only exact extension-published preferences are authoritative, not RPC command success.
|
|
14096
14096
|
function codexFastModeStatusState(statusText) {
|
|
14097
|
-
const
|
|
14098
|
-
|
|
14099
|
-
return { known: true, enabled: text === "on" };
|
|
14097
|
+
const mode = codexSpeedModeFromStatus(stripAnsi(statusText));
|
|
14098
|
+
return { known: mode !== null, enabled: mode !== null && mode !== "normal", mode };
|
|
14100
14099
|
}
|
|
14101
14100
|
|
|
14102
14101
|
function codexFastModeSnapshot(tab, patch = {}) {
|
|
14103
14102
|
const previous = tab?.codexFastMode && typeof tab.codexFastMode === "object" ? tab.codexFastMode : {};
|
|
14104
14103
|
const status = codexFastModeStatusState(extensionStatusMap(tab).get(CODEX_FAST_MODE_STATUS_KEY) || "");
|
|
14105
|
-
const
|
|
14104
|
+
const mode = patch.mode ?? (status.known ? status.mode : previous.mode ?? null);
|
|
14105
|
+
const known = mode !== null && (patch.statusKnown ?? (status.known || previous.statusKnown === true));
|
|
14106
14106
|
return {
|
|
14107
14107
|
featureId: CODEX_FAST_MODE_FEATURE_ID,
|
|
14108
|
-
|
|
14108
|
+
mode,
|
|
14109
|
+
enabled: mode !== null && mode !== "normal",
|
|
14109
14110
|
statusKnown: known,
|
|
14110
14111
|
updatedAt: patch.updatedAt || new Date().toISOString(),
|
|
14111
14112
|
};
|
|
@@ -14143,7 +14144,7 @@ async function codexFastModeFeatureData(tab, { refreshCommands = true } = {}) {
|
|
|
14143
14144
|
const command = await codexFastModeCommandState(tab, { refreshCommands });
|
|
14144
14145
|
const state = await currentSessionState(tab).catch(() => tab?.lastState || {});
|
|
14145
14146
|
const model = state?.model?.provider && state?.model?.id
|
|
14146
|
-
? { provider: String(state.model.provider), id: String(state.model.id) }
|
|
14147
|
+
? { provider: String(state.model.provider), id: String(state.model.id), api: String(state.model.api || "") }
|
|
14147
14148
|
: null;
|
|
14148
14149
|
const mode = codexFastModeSnapshot(tab);
|
|
14149
14150
|
tab.codexFastMode = mode;
|
|
@@ -14156,10 +14157,12 @@ async function codexFastModeFeatureData(tab, { refreshCommands = true } = {}) {
|
|
|
14156
14157
|
packageStatus,
|
|
14157
14158
|
commandName: command.commandName,
|
|
14158
14159
|
enabled: mode.enabled,
|
|
14160
|
+
mode: mode.mode,
|
|
14159
14161
|
statusKnown: mode.statusKnown,
|
|
14160
14162
|
busy: tabHasActiveOutput(tab),
|
|
14161
14163
|
model,
|
|
14162
14164
|
modelEligible: model?.provider === CODEX_FAST_MODE_PROVIDER,
|
|
14165
|
+
ultrafastModelEligible: model?.provider === CODEX_FAST_MODE_PROVIDER && model.api === "openai-codex-responses" && model.id === "gpt-6-astra",
|
|
14163
14166
|
creditNotice: CODEX_FAST_MODE_CREDIT_NOTICE,
|
|
14164
14167
|
rpcRunning: command.rpcRunning,
|
|
14165
14168
|
unavailableReason: available
|
|
@@ -14175,30 +14178,37 @@ async function waitForCodexFastModeStatus(tab, desired) {
|
|
|
14175
14178
|
const deadline = Date.now() + CODEX_FAST_MODE_STATUS_TIMEOUT_MS;
|
|
14176
14179
|
do {
|
|
14177
14180
|
const snapshot = codexFastModeSnapshot(tab);
|
|
14178
|
-
if (snapshot.statusKnown && snapshot.
|
|
14181
|
+
if (snapshot.statusKnown && snapshot.mode === desired) {
|
|
14179
14182
|
tab.codexFastMode = snapshot;
|
|
14180
14183
|
return snapshot;
|
|
14181
14184
|
}
|
|
14182
14185
|
if (Date.now() >= deadline) break;
|
|
14183
14186
|
await sleepMs(25);
|
|
14184
14187
|
} while (true);
|
|
14185
|
-
|
|
14188
|
+
const label = desired === "normal" ? "off" : desired === "fast" ? "on" : "ultrafast";
|
|
14189
|
+
throw makeHttpError(409, `Codex Fast mode did not confirm ${label}. The extension may be outdated, or the session may have become busy; inspect /fast-mode status and retry when idle.`);
|
|
14186
14190
|
}
|
|
14187
14191
|
|
|
14188
14192
|
async function setCodexFastMode(tab, body = {}) {
|
|
14189
|
-
|
|
14190
|
-
|
|
14193
|
+
let desired;
|
|
14194
|
+
try {
|
|
14195
|
+
desired = codexSpeedModeFromIntent(body);
|
|
14196
|
+
} catch (error) {
|
|
14197
|
+
throw makeHttpError(400, error.message);
|
|
14198
|
+
}
|
|
14191
14199
|
const feature = await codexFastModeFeatureData(tab);
|
|
14192
14200
|
if (!feature.available) throw makeHttpError(404, feature.unavailableReason);
|
|
14193
14201
|
// A mid-turn tier change would produce a mixed-tier tool loop, so mutations are rejected while
|
|
14194
14202
|
// the tab is working. Reading status stays available.
|
|
14195
14203
|
if (feature.busy) throw makeHttpError(409, "This tab is busy; Codex Fast mode cannot change during a running turn. Wait for the turn to finish, then retry.");
|
|
14196
|
-
|
|
14197
|
-
|
|
14204
|
+
if (desired === "ultrafast" && !feature.ultrafastModelEligible) throw makeHttpError(400, "Select GPT-6 Astra through the subscription-backed openai-codex provider before enabling Ultrafast.");
|
|
14205
|
+
const argument = desired === "normal" ? "off" : desired === "fast" ? "on" : "ultrafast";
|
|
14206
|
+
const response = await tab.rpc.send({ type: "prompt", message: `/${feature.commandName} ${argument}` }, REQUEST_TIMEOUT_MS);
|
|
14207
|
+
if (response.success === false) throw makeHttpError(400, response.error || `Failed to select Codex speed ${desired}`);
|
|
14198
14208
|
// RPC success only means the extension command returned. Require its authoritative status event
|
|
14199
14209
|
// to confirm the requested state so a busy-transition rejection cannot become false success.
|
|
14200
14210
|
await waitForCodexFastModeStatus(tab, desired);
|
|
14201
|
-
return { ...(await codexFastModeFeatureData(tab, { refreshCommands: false })), requested: desired };
|
|
14211
|
+
return { ...(await codexFastModeFeatureData(tab, { refreshCommands: false })), requested: Object.hasOwn(body, "mode") ? desired : body.enabled };
|
|
14202
14212
|
}
|
|
14203
14213
|
|
|
14204
14214
|
// Piper voice switching for the native /talk audio loop. The WebUI never
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firstpick/pi-package-webui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "Pi Web UI companion package with a local browser UI CLI plus /webui-start and /webui-status commands.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/Firstp1ck/pi-coding-agent-forge/tree/main/pi-package-webui#readme",
|
|
@@ -30,17 +30,19 @@
|
|
|
30
30
|
"pi-webui": "./bin/pi-webui-launcher.mjs"
|
|
31
31
|
},
|
|
32
32
|
"scripts": {
|
|
33
|
-
"check": "node --check public/app.js && node --check lib/app-runner-terminal.mjs && node --check public/middle-button-drag-scroll.mjs && node --check public/stream-output-controller.mjs && node --check public/theme-contract.mjs && node --check public/transcript-renderer.mjs && node --check public/syntax-highlight.mjs && node --check public/mobile-shell-state.mjs && node --check public/issue-wizard-state.mjs && node --check public/issue-bot-client.mjs && node --check public/workflow-status-stack.mjs && node --check public/fast-output-live.mjs && node --check public/subagent-launch-slot-state.mjs && node --check public/subagent-gate-visibility.mjs && node --check public/voice-conversation.mjs && node --check public/aur-review-payload.mjs && node --check public/guided-git-command-state.mjs && node --check public/guided-git-review-state.mjs && node --check bin/pi-webui.mjs && node --check bin/pi-webui-launcher.mjs && node --check bin/pi-webui-native-update-runner.mjs && node --check bin/pi-webui-update-context.mjs && node --check lib/update/coordination.mjs && node --check lib/update/native-jobs.mjs && node --check lib/update/discovery.mjs && node --check lib/update/native-targets.mjs && node --check lib/update/path-pi.mjs && node --check lib/update/migration.mjs && node --check lib/update/supervisor.mjs && node --check bin/pi-webui-rpc-supervisor.mjs && node --check lib/rpc-supervisor-protocol.mjs && node --check lib/rpc-supervisor-state.mjs && node --check lib/rpc-supervisor-client.mjs && node --check webui-rpc-helper.mjs && node --check lib/subagent-launch-slots.mjs && node --check lib/git-live-watcher.mjs && node --check lib/workspace-files-live-watcher.mjs && node --check lib/git-message-artifacts.mjs && node --check lib/trust-boundaries.mjs && node --check lib/native-command-adapter.mjs && node --check lib/session-actions.mjs && node --check lib/auth-actions.mjs && node --check lib/temp-artifacts.mjs && node tests/run-all.mjs",
|
|
33
|
+
"check": "node --check public/app.js && node --check public/codex-speed-mode.mjs && node --check lib/app-runner-terminal.mjs && node --check public/middle-button-drag-scroll.mjs && node --check public/stream-output-controller.mjs && node --check public/theme-contract.mjs && node --check public/transcript-renderer.mjs && node --check public/syntax-highlight.mjs && node --check public/mobile-shell-state.mjs && node --check public/issue-wizard-state.mjs && node --check public/issue-bot-client.mjs && node --check public/workflow-status-stack.mjs && node --check public/fast-output-live.mjs && node --check public/subagent-launch-slot-state.mjs && node --check public/subagent-gate-visibility.mjs && node --check public/voice-conversation.mjs && node --check public/aur-review-payload.mjs && node --check public/guided-git-command-state.mjs && node --check public/guided-git-review-state.mjs && node --check bin/pi-webui.mjs && node --check bin/pi-webui-launcher.mjs && node --check bin/pi-webui-native-update-runner.mjs && node --check bin/pi-webui-update-context.mjs && node --check lib/update/coordination.mjs && node --check lib/update/native-jobs.mjs && node --check lib/update/discovery.mjs && node --check lib/update/native-targets.mjs && node --check lib/update/path-pi.mjs && node --check lib/update/migration.mjs && node --check lib/update/supervisor.mjs && node --check bin/pi-webui-rpc-supervisor.mjs && node --check lib/rpc-supervisor-protocol.mjs && node --check lib/rpc-supervisor-state.mjs && node --check lib/rpc-supervisor-client.mjs && node --check webui-rpc-helper.mjs && node --check lib/subagent-launch-slots.mjs && node --check lib/git-live-watcher.mjs && node --check lib/workspace-files-live-watcher.mjs && node --check lib/git-message-artifacts.mjs && node --check lib/trust-boundaries.mjs && node --check lib/native-command-adapter.mjs && node --check lib/session-actions.mjs && node --check lib/auth-actions.mjs && node --check lib/temp-artifacts.mjs && node tests/run-all.mjs",
|
|
34
34
|
"test": "node tests/run-all.mjs",
|
|
35
35
|
"test:browser": "playwright test"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@earendil-works/pi-ai": "^0.83.0",
|
|
39
|
-
"@earendil-works/pi-coding-agent": "^0.87.0",
|
|
40
|
-
"@earendil-works/pi-tui": "^0.83.0",
|
|
41
38
|
"@firstpick/pi-utils": "^0.2.5",
|
|
42
|
-
"mermaid": "^11.15.0"
|
|
43
|
-
|
|
39
|
+
"mermaid": "^11.15.0"
|
|
40
|
+
},
|
|
41
|
+
"peerDependencies": {
|
|
42
|
+
"@earendil-works/pi-ai": "*",
|
|
43
|
+
"@earendil-works/pi-coding-agent": "*",
|
|
44
|
+
"@earendil-works/pi-tui": "*",
|
|
45
|
+
"typebox": "*"
|
|
44
46
|
},
|
|
45
47
|
"optionalDependencies": {
|
|
46
48
|
"node-pty": "^1.1.0"
|
|
@@ -72,6 +74,10 @@
|
|
|
72
74
|
},
|
|
73
75
|
"devDependencies": {
|
|
74
76
|
"@axe-core/playwright": "4.12.1",
|
|
75
|
-
"@
|
|
77
|
+
"@earendil-works/pi-ai": "^0.83.0",
|
|
78
|
+
"@earendil-works/pi-coding-agent": "^0.99.2",
|
|
79
|
+
"@earendil-works/pi-tui": "^0.83.0",
|
|
80
|
+
"@playwright/test": "1.62.1",
|
|
81
|
+
"typebox": "^1.3.6"
|
|
76
82
|
}
|
|
77
83
|
}
|
package/public/app.js
CHANGED
|
@@ -2,6 +2,7 @@ import { aurReviewSafePath as parsedAurReviewSafePath, parseAurReviewPayload as
|
|
|
2
2
|
import { GUIDED_GIT_START_STATUS_KEY, createGuidedGitActivationController, createGuidedGitLaunchPermitController, guidedGitLaunchBlockedReason, guidedGitLaunchModeForTabCatalog, guidedGitReviewAvailableForTabCatalog, guidedGitWorkflowCommandForTabCatalog, resolveCommandForTabCatalog, resolveRpcSlashCommandForTabCatalog } from "./guided-git-command-state.mjs";
|
|
3
3
|
import { guidedGitReviewCanRequestStagedContent, guidedGitReviewHasApprovedBinding, guidedGitReviewProcessNavigationAllowed, guidedGitReviewProcessSelectionPatch, guidedGitReviewTransition, guidedGitReviewWidgetRemovalTransition } from "./guided-git-review-state.mjs";
|
|
4
4
|
import { createFastOutputLiveState, createSustainedFlushScheduler, fastOutputLiveTextAndThinking, reduceFastOutputLiveEvent, seedFastOutputLiveState, shouldConsumeFastOutputLiveEvent } from "./fast-output-live.mjs";
|
|
5
|
+
import { codexSpeedModeFromData, codexSpeedModeFromStatus, codexSpeedModeLabel, isCodexSpeedMode } from "./codex-speed-mode.mjs";
|
|
5
6
|
import { addLaunchSlot, cloneLaunchSlotRoles, launchSlotRolesEqual, removeLaunchSlot, subagentLaunchSlotSaveState, updateLaunchSlot } from "./subagent-launch-slot-state.mjs";
|
|
6
7
|
import { pruneDismissedSubagentGateKeys, subagentGateIsTerminal, subagentGateKey, ungatedSubagentRuns, visibleSubagentGates } from "./subagent-gate-visibility.mjs";
|
|
7
8
|
import { groupConsecutiveWorkflowStatusItems, isCompletedWorkflowStatusExecution, workflowStatusSnapshot } from "./workflow-status-stack.mjs";
|
|
@@ -11396,7 +11397,7 @@ function setOptionalFeatureDisabled(featureId, disabled) {
|
|
|
11396
11397
|
if (featureId === "codexFastMode") {
|
|
11397
11398
|
if (disabled) {
|
|
11398
11399
|
statusEntries.delete(CODEX_FAST_MODE_STATUS_KEY);
|
|
11399
|
-
codexFastModeState = { ...codexFastModeState, available: false, enabled: false, statusKnown: false, busy: false };
|
|
11400
|
+
codexFastModeState = { ...codexFastModeState, available: false, enabled: false, mode: null, statusKnown: false, busy: false };
|
|
11400
11401
|
codexFastModeNotice = "";
|
|
11401
11402
|
renderCodexFastModeControl();
|
|
11402
11403
|
} else {
|
|
@@ -19130,7 +19131,10 @@ function applyOptimisticModelSelection(model, tabContext = activeTabContext()) {
|
|
|
19130
19131
|
const changed = modelStateKey(currentState.model) !== modelStateKey(nextModel);
|
|
19131
19132
|
currentState = { ...currentState, model: nextModel };
|
|
19132
19133
|
renderStatus();
|
|
19133
|
-
if (changed)
|
|
19134
|
+
if (changed) {
|
|
19135
|
+
requestGitFooterWebuiPayload(tabContext, { force: true });
|
|
19136
|
+
refreshCodexFastMode(tabContext).catch(() => null);
|
|
19137
|
+
}
|
|
19134
19138
|
return nextModel;
|
|
19135
19139
|
}
|
|
19136
19140
|
|
|
@@ -25414,7 +25418,7 @@ async function refreshCodexUsage({ forceAuthRefresh = false } = {}) {
|
|
|
25414
25418
|
// Codex subscription Fast mode is owned by the optional pi-extension-codex-fast-mode package. The
|
|
25415
25419
|
// browser only reads the sanitized tab-scoped server snapshot and asks the server to run the
|
|
25416
25420
|
// package-owned /fast-mode command; it never sees ChatGPT credentials or request payloads.
|
|
25417
|
-
let codexFastModeState = { available: false, enabled: false, statusKnown: false, busy: false, model: null, modelEligible: false, unavailableReason: "", creditNotice: "" };
|
|
25421
|
+
let codexFastModeState = { available: false, enabled: false, mode: null, statusKnown: false, busy: false, model: null, modelEligible: false, ultrafastModelEligible: false, unavailableReason: "", creditNotice: "" };
|
|
25418
25422
|
let codexFastModeLoaded = false;
|
|
25419
25423
|
let codexFastModeBusy = false;
|
|
25420
25424
|
let codexFastModeNotice = "";
|
|
@@ -25434,23 +25438,28 @@ function codexFastModeStatusText() {
|
|
|
25434
25438
|
if (!codexFastModeLoaded) return "Checking…";
|
|
25435
25439
|
if (!codexFastModeState.available) return codexFastModeState.unavailableReason || optionalFeatureUnavailableMessage("codexFastMode");
|
|
25436
25440
|
if (!codexFastModeState.statusKnown) return "Status unknown · This tab";
|
|
25437
|
-
|
|
25438
|
-
if (codexFastModeState.
|
|
25439
|
-
|
|
25441
|
+
const label = codexSpeedModeLabel(codexFastModeState.mode);
|
|
25442
|
+
if (codexFastModeState.busy) return `${label} · Busy`;
|
|
25443
|
+
const eligible = codexFastModeState.mode === "ultrafast" ? codexFastModeState.ultrafastModelEligible : codexFastModeState.modelEligible;
|
|
25444
|
+
if (codexFastModeState.enabled && codexFastModeState.model && !eligible) {
|
|
25445
|
+
return `${label} · Inactive for current model`;
|
|
25440
25446
|
}
|
|
25441
|
-
return `${
|
|
25447
|
+
return `${label} · This tab`;
|
|
25442
25448
|
}
|
|
25443
25449
|
|
|
25444
25450
|
function renderCodexFastModeControl({ syncSelection = true } = {}) {
|
|
25445
25451
|
if (!elements.codexFastModeSelect || !elements.setCodexFastModeButton || !elements.codexFastModeStatus) return;
|
|
25446
25452
|
if (syncSelection) {
|
|
25447
|
-
codexFastModeSelection = codexFastModeState.
|
|
25453
|
+
codexFastModeSelection = codexFastModeState.mode || "normal";
|
|
25448
25454
|
elements.codexFastModeSelect.value = codexFastModeSelection;
|
|
25449
25455
|
}
|
|
25450
25456
|
const controlDisabled = codexFastModeControlDisabled();
|
|
25457
|
+
const ultrafastOption = elements.codexFastModeSelect.querySelector('option[value="ultrafast"]');
|
|
25458
|
+
if (ultrafastOption) ultrafastOption.disabled = !codexFastModeState.ultrafastModelEligible;
|
|
25451
25459
|
elements.codexFastModeSelect.disabled = controlDisabled;
|
|
25452
25460
|
elements.setCodexFastModeButton.disabled = controlDisabled
|
|
25453
|
-
|| elements.codexFastModeSelect.value ===
|
|
25461
|
+
|| elements.codexFastModeSelect.value === codexFastModeState.mode
|
|
25462
|
+
|| (elements.codexFastModeSelect.value === "ultrafast" && !codexFastModeState.ultrafastModelEligible);
|
|
25454
25463
|
elements.setCodexFastModeButton.textContent = codexFastModeBusy ? "Applying…" : "Apply";
|
|
25455
25464
|
elements.codexFastModeStatus.textContent = codexFastModeStatusText();
|
|
25456
25465
|
const warn = !!codexFastModeNotice
|
|
@@ -25461,13 +25470,16 @@ function renderCodexFastModeControl({ syncSelection = true } = {}) {
|
|
|
25461
25470
|
}
|
|
25462
25471
|
|
|
25463
25472
|
function applyCodexFastModeData(data) {
|
|
25473
|
+
const mode = codexSpeedModeFromData(data);
|
|
25464
25474
|
codexFastModeState = {
|
|
25465
25475
|
available: data?.available === true,
|
|
25466
|
-
|
|
25476
|
+
mode,
|
|
25477
|
+
enabled: mode !== null && mode !== "normal",
|
|
25467
25478
|
statusKnown: data?.statusKnown === true,
|
|
25468
25479
|
busy: data?.busy === true,
|
|
25469
25480
|
model: data?.model || null,
|
|
25470
25481
|
modelEligible: data?.modelEligible === true,
|
|
25482
|
+
ultrafastModelEligible: data?.ultrafastModelEligible === true,
|
|
25471
25483
|
unavailableReason: data?.unavailableReason || "",
|
|
25472
25484
|
creditNotice: data?.creditNotice || "",
|
|
25473
25485
|
};
|
|
@@ -25475,22 +25487,23 @@ function applyCodexFastModeData(data) {
|
|
|
25475
25487
|
}
|
|
25476
25488
|
|
|
25477
25489
|
function codexFastModeConfirmedOff(data) {
|
|
25478
|
-
return data?.statusKnown === true && data
|
|
25490
|
+
return data?.statusKnown === true && codexSpeedModeFromData(data) === "normal";
|
|
25479
25491
|
}
|
|
25480
25492
|
|
|
25481
25493
|
function applyCodexFastModeStatus(statusText) {
|
|
25482
|
-
const
|
|
25483
|
-
if (
|
|
25494
|
+
const mode = codexSpeedModeFromStatus(statusText);
|
|
25495
|
+
if (mode === null) return false;
|
|
25484
25496
|
codexFastModeState = {
|
|
25485
25497
|
...codexFastModeState,
|
|
25486
25498
|
available: true,
|
|
25487
|
-
|
|
25499
|
+
mode,
|
|
25500
|
+
enabled: mode !== "normal",
|
|
25488
25501
|
statusKnown: true,
|
|
25489
25502
|
};
|
|
25490
25503
|
codexFastModeLoaded = true;
|
|
25491
25504
|
codexFastModeNotice = "";
|
|
25492
25505
|
renderCodexFastModeControl();
|
|
25493
|
-
if (
|
|
25506
|
+
if (mode !== "normal" && !isOptionalFeatureEnabled("codexFastMode")) {
|
|
25494
25507
|
const tabContext = activeTabContext();
|
|
25495
25508
|
queueMicrotask(() => refreshCodexFastMode(tabContext).catch((error) => {
|
|
25496
25509
|
if (isCurrentTabContext(tabContext)) addEvent(`Disabled Codex Fast mode could not be disarmed: ${error.message || String(error)}`, "error");
|
|
@@ -25530,21 +25543,32 @@ async function refreshCodexFastMode(tabContext = activeTabContext()) {
|
|
|
25530
25543
|
}
|
|
25531
25544
|
|
|
25532
25545
|
async function applyCodexFastMode() {
|
|
25533
|
-
if (!elements.codexFastModeSelect ||
|
|
25546
|
+
if (!elements.codexFastModeSelect || codexFastModeControlDisabled()) return;
|
|
25534
25547
|
const tabContext = activeTabContext();
|
|
25535
25548
|
if (!tabContext.tabId) return;
|
|
25536
|
-
const
|
|
25537
|
-
if (
|
|
25549
|
+
const mode = elements.codexFastModeSelect.value;
|
|
25550
|
+
if (!isCodexSpeedMode(mode) || mode === codexFastModeState.mode) return;
|
|
25551
|
+
if (mode === "ultrafast" && !codexFastModeState.ultrafastModelEligible) return;
|
|
25538
25552
|
codexFastModeBusy = true;
|
|
25539
25553
|
codexFastModeNotice = "";
|
|
25540
25554
|
renderCodexFastModeControl({ syncSelection: false });
|
|
25541
25555
|
try {
|
|
25542
|
-
|
|
25556
|
+
if (mode === "ultrafast") {
|
|
25557
|
+
const confirmed = await appConfirm({
|
|
25558
|
+
title: "Use Codex Ultrafast?",
|
|
25559
|
+
summary: "Ultrafast uses 8x Standard included usage or 6x purchased-credit/pay-as-you-go usage. It requires GPT-6 Astra and Pro $500 or eligible Enterprise/Edu access; workspace terms may differ.",
|
|
25560
|
+
affected: "This tab's session branch. Future requests may cost more.",
|
|
25561
|
+
undoable: true,
|
|
25562
|
+
confirmLabel: "Use Ultrafast",
|
|
25563
|
+
});
|
|
25564
|
+
if (!confirmed || !isCurrentTabContext(tabContext) || !isOptionalFeatureEnabled("codexFastMode")) return;
|
|
25565
|
+
}
|
|
25566
|
+
const response = await api("/api/codex-fast-mode", { method: "PUT", body: { mode }, tabId: tabContext.tabId });
|
|
25543
25567
|
if (!isCurrentTabContext(tabContext)) return;
|
|
25544
25568
|
applyCodexFastModeData(response.data);
|
|
25545
|
-
addEvent(
|
|
25546
|
-
? "Codex
|
|
25547
|
-
:
|
|
25569
|
+
addEvent(mode === "normal"
|
|
25570
|
+
? "Codex speed override turned off for this session; requests keep their existing service tier."
|
|
25571
|
+
: `Codex ${codexSpeedModeLabel(mode)} requested for this session. ${codexFastModeState.creditNotice} This preference does not confirm upstream acceptance.`, "info");
|
|
25548
25572
|
} catch (error) {
|
|
25549
25573
|
if (!isCurrentTabContext(tabContext)) return;
|
|
25550
25574
|
codexFastModeNotice = `Failed to change Codex Fast mode: ${error.message || String(error)}. You can retry.`;
|
|
@@ -46134,10 +46158,10 @@ async function refreshState(tabContext = activeTabContext()) {
|
|
|
46134
46158
|
renderStatus();
|
|
46135
46159
|
if (mobilePhoneExperienceInstalled && isMobileShellV2Active()) renderMobilePhoneExperience();
|
|
46136
46160
|
requestGitFooterWebuiPayload(tabContext, { force: shouldRefreshGitFooter });
|
|
46137
|
-
// Sampling support and
|
|
46138
|
-
// them whenever the session reports a different model.
|
|
46161
|
+
// Sampling support and speed-tier eligibility depend on the active model.
|
|
46139
46162
|
if (modelStateKey(previousState?.model) !== modelStateKey(currentState?.model)) {
|
|
46140
46163
|
refreshSamplingParametersForTabContext(tabContext);
|
|
46164
|
+
refreshCodexFastMode(tabContext).catch(() => null);
|
|
46141
46165
|
}
|
|
46142
46166
|
}
|
|
46143
46167
|
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export function isCodexSpeedMode(value) {
|
|
2
|
+
return value === "normal" || value === "fast" || value === "ultrafast";
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export function codexSpeedModeFromStatus(value) {
|
|
6
|
+
const status = String(value || "").trim().toLowerCase();
|
|
7
|
+
if (status === "off") return "normal";
|
|
8
|
+
if (status === "on") return "fast";
|
|
9
|
+
if (status === "ultrafast") return "ultrafast";
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function codexSpeedModeFromData(data) {
|
|
14
|
+
if (Object.hasOwn(data || {}, "mode")) return isCodexSpeedMode(data.mode) ? data.mode : null;
|
|
15
|
+
return data?.statusKnown === true ? (data.enabled === true ? "fast" : "normal") : null;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** Legacy boolean writes select Normal or Fast; an explicit mode must not contradict them. */
|
|
19
|
+
export function codexSpeedModeFromIntent(body) {
|
|
20
|
+
if (Object.hasOwn(body || {}, "mode")) {
|
|
21
|
+
if (!isCodexSpeedMode(body.mode)) throw new TypeError("Codex speed requires mode normal, fast, or ultrafast");
|
|
22
|
+
if (Object.hasOwn(body, "enabled") && (typeof body.enabled !== "boolean" || body.enabled !== (body.mode !== "normal"))) {
|
|
23
|
+
throw new TypeError("Codex speed mode and enabled must agree");
|
|
24
|
+
}
|
|
25
|
+
return body.mode;
|
|
26
|
+
}
|
|
27
|
+
if (typeof body?.enabled !== "boolean") throw new TypeError("Codex speed requires an explicit mode or enabled boolean");
|
|
28
|
+
return body.enabled ? "fast" : "normal";
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function codexSpeedModeLabel(mode) {
|
|
32
|
+
if (mode === "normal") return "Normal";
|
|
33
|
+
if (mode === "fast") return "Fast";
|
|
34
|
+
if (mode === "ultrafast") return "Ultrafast";
|
|
35
|
+
return "Unknown";
|
|
36
|
+
}
|
package/public/index.html
CHANGED
|
@@ -1051,14 +1051,15 @@
|
|
|
1051
1051
|
<div id="codexUsageBox" class="codex-usage-box muted">Checking Codex usage…</div>
|
|
1052
1052
|
<div class="control-field codex-fast-mode-control" aria-labelledby="codexFastModeLabel">
|
|
1053
1053
|
<div class="codex-fast-mode-row">
|
|
1054
|
-
<label id="codexFastModeLabel" for="codexFastModeSelect" title="Fast
|
|
1055
|
-
<select id="codexFastModeSelect" title="
|
|
1054
|
+
<label id="codexFastModeLabel" for="codexFastModeSelect" title="Normal, Fast, or Ultrafast for subscription-backed Codex requests on this tab">Speed mode</label>
|
|
1055
|
+
<select id="codexFastModeSelect" title="Ultrafast requires GPT-6 Astra and eligible plan access; it uses 8x included usage or 6x purchased credits" aria-describedby="codexFastModeStatus" disabled>
|
|
1056
1056
|
<option value="normal">Normal</option>
|
|
1057
1057
|
<option value="fast">Fast</option>
|
|
1058
|
+
<option value="ultrafast" disabled>Ultrafast</option>
|
|
1058
1059
|
</select>
|
|
1059
|
-
<button id="setCodexFastModeButton" class="control-apply-button" type="button" aria-label="Apply selected Codex
|
|
1060
|
+
<button id="setCodexFastModeButton" class="control-apply-button" type="button" aria-label="Apply selected Codex speed mode" disabled>Apply</button>
|
|
1060
1061
|
</div>
|
|
1061
|
-
<div id="codexFastModeStatus" class="toggle-control-hint" role="status" aria-live="polite">Checking Codex
|
|
1062
|
+
<div id="codexFastModeStatus" class="toggle-control-hint" role="status" aria-live="polite">Checking Codex speed mode…</div>
|
|
1062
1063
|
</div>
|
|
1063
1064
|
</div>
|
|
1064
1065
|
</section>
|
|
@@ -1897,7 +1898,7 @@
|
|
|
1897
1898
|
</form>
|
|
1898
1899
|
</dialog>
|
|
1899
1900
|
|
|
1900
|
-
<script id="webuiBootLoader" data-app-src="/app.js?v=
|
|
1901
|
+
<script id="webuiBootLoader" data-app-src="/app.js?v=185">
|
|
1901
1902
|
(() => {
|
|
1902
1903
|
"use strict";
|
|
1903
1904
|
|
package/public/service-worker.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const CACHE_NAME = "pi-webui-pwa-
|
|
1
|
+
const CACHE_NAME = "pi-webui-pwa-v156";
|
|
2
2
|
const APP_SHELL = [
|
|
3
3
|
"/",
|
|
4
4
|
"/index.html",
|
|
@@ -11,6 +11,7 @@ const APP_SHELL = [
|
|
|
11
11
|
"/guided-git-command-state.mjs",
|
|
12
12
|
"/guided-git-review-state.mjs",
|
|
13
13
|
"/fast-output-live.mjs",
|
|
14
|
+
"/codex-speed-mode.mjs",
|
|
14
15
|
"/stream-output-controller.mjs",
|
|
15
16
|
"/stream-derived-output.mjs",
|
|
16
17
|
"/stream-markdown-tail.mjs",
|
|
@@ -84,7 +84,7 @@ function makeEnvironment({
|
|
|
84
84
|
removeEventListener(name) { listeners.delete(name); },
|
|
85
85
|
};
|
|
86
86
|
const document = {
|
|
87
|
-
currentScript: new FakeElement({ dataset: { appSrc: "/app.js?v=
|
|
87
|
+
currentScript: new FakeElement({ dataset: { appSrc: "/app.js?v=185" } }),
|
|
88
88
|
readyState: "complete",
|
|
89
89
|
querySelector(selector) {
|
|
90
90
|
return {
|
|
@@ -232,7 +232,7 @@ for (const moduleName of startupModuleNames) {
|
|
|
232
232
|
assert.ok(serviceWorker.includes(`"/${moduleName}"`), `the PWA app shell should include every app.js startup module: ${moduleName}`);
|
|
233
233
|
}
|
|
234
234
|
assert.match(serviceWorker, /pi-webui-pwa-v\d+/, "the app-shell cache should retain a versioned identity");
|
|
235
|
-
assert.ok(html.indexOf('id="webuiBootLoader"') < html.indexOf("/app.js?v=
|
|
235
|
+
assert.ok(html.indexOf('id="webuiBootLoader"') < html.indexOf("/app.js?v=185"), "the inline loader should own app module startup");
|
|
236
236
|
assert.doesNotMatch(html, /<script type="module" src="\/app\.js/, "the app module should not bypass the guarded loader");
|
|
237
237
|
|
|
238
238
|
console.log("boot-failure-diagnostics.test.mjs passed");
|
|
@@ -28,34 +28,35 @@ assert.match(optionalFeatureCatalog, /\["codexFastMode", "@firstpick\/pi-extensi
|
|
|
28
28
|
|
|
29
29
|
assert.match(server, /const OPTIONAL_FEATURE_PACKAGES = new Map\(OPTIONAL_FEATURE_CATALOG/, "server should derive Fast-mode installation from the shared Optional Features catalog");
|
|
30
30
|
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");
|
|
31
|
-
assert.match(server, /function codexFastModeStatusState\(statusText\)[\s\S]*?
|
|
31
|
+
assert.match(server, /function codexFastModeStatusState\(statusText\)[\s\S]*?codexSpeedModeFromStatus\(stripAnsi\(statusText\)\)/, "server should use the tested exact status parser");
|
|
32
32
|
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");
|
|
33
|
-
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");
|
|
34
|
-
assert.match(server, /async function waitForCodexFastModeStatus\(tab, desired\)[\s\S]*?snapshot\.statusKnown && snapshot\.
|
|
35
|
-
assert.match(server, /async function setCodexFastMode[\s\S]*?
|
|
33
|
+
assert.match(server, /async function codexFastModeFeatureData[\s\S]*?codexFastModeSnapshot\(tab\)[\s\S]*?tabHasActiveOutput\(tab\)[\s\S]*?ultrafastModelEligible:[\s\S]*?CODEX_FAST_MODE_CREDIT_NOTICE/, "GET state should be tab-scoped, extension-owned, busy-aware, model-gated, and disclose credit use");
|
|
34
|
+
assert.match(server, /async function waitForCodexFastModeStatus\(tab, desired\)[\s\S]*?snapshot\.statusKnown && snapshot\.mode === desired[\s\S]*?makeHttpError\(409,[\s\S]*?did not confirm/, "server should require bounded exact-mode confirmation");
|
|
35
|
+
assert.match(server, /async function setCodexFastMode[\s\S]*?codexSpeedModeFromIntent\(body\)[\s\S]*?feature\.busy[\s\S]*?desired === "ultrafast" && !feature\.ultrafastModelEligible[\s\S]*?type: "prompt", message: `\/\$\{feature\.commandName\} \$\{argument\}`[\s\S]*?waitForCodexFastModeStatus\(tab, desired\)/, "PUT should validate intent, reject busy or ineligible tabs, invoke the extension, and require exact confirmed state");
|
|
36
36
|
assert.doesNotMatch(server, /codexFastModeSnapshot\(tab, \{ enabled: desired/, "server must not infer effective Fast state from RPC success");
|
|
37
37
|
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");
|
|
38
38
|
|
|
39
39
|
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");
|
|
40
40
|
assert.doesNotMatch(html, /<label for="fastOutputModeSelect">Fast mode/, "legacy output processing should no longer be presented as Fast mode");
|
|
41
|
-
assert.match(html, /data-side-panel-section="codex-usage"[\s\S]*?id="codexUsageBox"[\s\S]*?class="control-field codex-fast-mode-control"[\s\S]*?class="codex-fast-mode-row"[\s\S]*?id="codexFastModeLabel"[\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 render before the compact session Fast-mode row");
|
|
41
|
+
assert.match(html, /data-side-panel-section="codex-usage"[\s\S]*?id="codexUsageBox"[\s\S]*?class="control-field codex-fast-mode-control"[\s\S]*?class="codex-fast-mode-row"[\s\S]*?id="codexFastModeLabel"[\s\S]*?id="codexFastModeSelect"[\s\S]*?<option value="normal">Normal<\/option>[\s\S]*?<option value="fast">Fast<\/option>[\s\S]*?<option value="ultrafast" disabled>Ultrafast<\/option>[\s\S]*?id="setCodexFastModeButton"[\s\S]*?id="codexFastModeStatus"/, "Codex Usage should render before the compact session Fast-mode row");
|
|
42
42
|
assert.match(styles, /\.codex-fast-mode-control \{[\s\S]*?margin-top: 0\.58rem[\s\S]*?padding: 0\.48rem 0\.55rem[\s\S]*?\.codex-fast-mode-row \{[\s\S]*?grid-template-columns: minmax\(0, 1fr\) minmax\(6\.5rem, 8rem\) auto/, "Codex Fast mode should use a compact horizontal control surface");
|
|
43
|
-
assert.match(app, /function codexFastModeStatusText\(\)[\s\S]*?return `\$\{
|
|
43
|
+
assert.match(app, /function codexFastModeStatusText\(\)[\s\S]*?codexSpeedModeLabel\(codexFastModeState\.mode\)[\s\S]*?return `\$\{label\} · This tab`;/, "mode status should distinguish all three preferences concisely");
|
|
44
44
|
|
|
45
45
|
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");
|
|
46
46
|
assert.match(app, /OPTIONAL_FEATURE_DISABLE_PREREQUISITES = new Map\([\s\S]*?\["codexFastMode", \(\) => disableCodexFastModeIntegration\(\)\]/, "browser should register disable-off-first behavior");
|
|
47
47
|
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");
|
|
48
|
-
assert.match(app, /function applyCodexFastModeStatus\(statusText\)[\s\S]*?
|
|
48
|
+
assert.match(app, /function applyCodexFastModeStatus\(statusText\)[\s\S]*?codexSpeedModeFromStatus\(statusText\)[\s\S]*?if \(mode === null\) return false[\s\S]*?enabled: mode !== "normal"[\s\S]*?statusKnown: true/, "browser should consume only exact extension status values");
|
|
49
49
|
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");
|
|
50
|
-
assert.match(app, /async function applyCodexFastMode\(\)[\s\S]*?
|
|
50
|
+
assert.match(app, /async function applyCodexFastMode\(\)[\s\S]*?await appConfirm\([\s\S]*?8x Standard included usage[\s\S]*?6x purchased-credit[\s\S]*?if \(!confirmed[\s\S]*?body: \{ mode \}, tabId: tabContext\.tabId/, "browser should confirm Ultrafast costs before applying explicit mode intent");
|
|
51
51
|
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");
|
|
52
52
|
assert.match(app, /refreshNaturalConversationMode\(tabContext\),[\s\S]*?refreshCodexFastMode\(tabContext\),/, "tab refreshes should reload branch-scoped Fast-mode state");
|
|
53
53
|
assert.match(app, /statusKey === CODEX_FAST_MODE_STATUS_KEY[\s\S]*?applyCodexFastModeStatus\(request\.statusText\)/, "extension status events should refresh the active-tab selector");
|
|
54
54
|
|
|
55
55
|
assert.match(technical, /## Normal and compact output[\s\S]*?select \*\*Compact\*\*[\s\S]*?`compact-v1`/, "technical reference should document Compact mode with the stable identifier");
|
|
56
|
-
assert.match(development, /### Codex subscription Fast mode[\s\S]*?service_tier: "priority"[\s\S]*?
|
|
56
|
+
assert.match(development, /### Codex subscription Fast mode[\s\S]*?service_tier: "priority"[\s\S]*?service_tier: "ultrafast"[\s\S]*?8× Standard included usage[\s\S]*?6×/, "development guide should document both tiers and cost semantics");
|
|
57
|
+
assert.match(technical, /Normal \/ Fast \/ Ultrafast[\s\S]*?Pro \$500/, "technical reference should document the third mode and subscription eligibility");
|
|
57
58
|
// Intent preserved: browser-asset changes must advance the coherent cache tuple.
|
|
58
|
-
assert.match(serviceWorker, /pi-webui-pwa-
|
|
59
|
-
assert.match(html, /data-app-src="\/app\.js\?v=
|
|
59
|
+
assert.match(serviceWorker, /pi-webui-pwa-v156[\s\S]*?"\/codex-speed-mode\.mjs"/, "PWA should refresh and cache the shared mode helper");
|
|
60
|
+
assert.match(html, /data-app-src="\/app\.js\?v=185"/, "browser module URL should be cache-busted for speed-mode wiring");
|
|
60
61
|
|
|
61
62
|
console.log("codex-fast-mode-static.test.mjs passed");
|