@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/public/app.js CHANGED
@@ -224,6 +224,9 @@ const elements = {
224
224
  optionalFeaturesBox: $("#optionalFeaturesBox"),
225
225
  codexUsageBox: $("#codexUsageBox"),
226
226
  refreshCodexUsageButton: $("#refreshCodexUsageButton"),
227
+ codexFastModeSelect: $("#codexFastModeSelect"),
228
+ setCodexFastModeButton: $("#setCodexFastModeButton"),
229
+ codexFastModeStatus: $("#codexFastModeStatus"),
227
230
  claudeUsageBox: $("#claudeUsageBox"),
228
231
  refreshClaudeUsageButton: $("#refreshClaudeUsageButton"),
229
232
  fileTreeCwd: $("#fileTreeCwd"),
@@ -461,6 +464,7 @@ let sidePanelContextMenuState = null;
461
464
  let fileTreeDragState = null;
462
465
  let fileViewerResizeState = null;
463
466
  let sidePanelResizeState = null;
467
+ let sidePanelWidthPreferenceRevision = 0;
464
468
  let fileTreeSearchTimer = null;
465
469
  let fileTreeSearchRequestSerial = 0;
466
470
  let tabActivities = new Map();
@@ -718,7 +722,7 @@ let footerModelPickerOpen = false;
718
722
  let footerThinkingPickerOpen = false;
719
723
  let footerAutoCompactionToggleInFlight = false;
720
724
  let footerBranchPickerOpen = false;
721
- let footerBranchPickerState = { loading: false, error: "", branches: [], current: "", root: "", repoRoot: "", currentWorktreePath: "", defaultWorktreesRoot: "", worktrees: [], occupiedBranches: [], switching: "", tabId: null };
725
+ let footerBranchPickerState = { loading: false, error: "", branches: [], current: "", root: "", repoRoot: "", currentWorktreePath: "", defaultWorktreesRoot: "", worktrees: [], occupiedBranches: [], switching: "", switchingKey: "", tabId: null };
722
726
  let footerBranchCreateDraft = { type: "", name: "" };
723
727
  let footerBranchPickerRequestSerial = 0;
724
728
  let footerScopedModelDragKey = "";
@@ -852,6 +856,7 @@ const STATS_WEBUI_PAYLOAD_TYPE = "firstpick.pi-extension-stats.overlay";
852
856
  const STATS_WEBUI_PAYLOAD_VERSION = 1;
853
857
  const NATURAL_CONVERSATION_STATUS_KEY = "natural-conversation";
854
858
  const NATURAL_CONVERSATION_COMMAND_NAMES = ["talk", "voice", "conversation"];
859
+ const CODEX_FAST_MODE_STATUS_KEY = "codex-fast-mode";
855
860
  const REMOTE_WEBUI_CONTROLS_STATUS_KEY = "pi-remote-webui:controls";
856
861
  const REMOTE_WEBUI_CONTROLS_PAYLOAD_TYPE = "firstpick.pi-package-remote-webui.controls";
857
862
  const REMOTE_WEBUI_CONTROLS_PAYLOAD_VERSION = 1;
@@ -890,6 +895,7 @@ const FILE_VIEWER_WIDTH_MIN_PX = 384;
890
895
  const SIDE_PANEL_WIDTH_STORAGE_KEY = "pi-webui-side-panel-width";
891
896
  const SIDE_PANEL_WIDTH_DEFAULT_PX = 384;
892
897
  const SIDE_PANEL_WIDTH_MIN_PX = 320;
898
+ const SIDE_PANEL_WIDTH_MAX_PX = 4096;
893
899
  const FILE_VIEWER_CONTEXT_RADIUS_LINES = 6;
894
900
  const FILE_TREE_ROOT_PATH = "";
895
901
  const FILE_TREE_DRAG_MIME = "application/x-pi-webui-file-path";
@@ -923,7 +929,6 @@ const SUBAGENT_OPEN_MODES = new Set(["overlay", "tab"]);
923
929
  const SUBAGENT_OPEN_MODE_LABELS = { overlay: "Overlay", tab: "Tab / terminal" };
924
930
  const BUSY_PROMPT_BEHAVIOR_VALUES = new Set(["followUp", "steer"]);
925
931
  const BUSY_PROMPT_BEHAVIOR_LABELS = { followUp: "Follow-up", steer: "Steer" };
926
- const SKILL_TAG_MAX_VISIBLE = 6;
927
932
  const SKILL_USAGE_LIMIT_PER_TAB = 32;
928
933
  const MOBILE_VIEW_QUERY = "(max-width: 720px), (max-device-width: 720px), (pointer: coarse) and (hover: none)";
929
934
  const SIDE_PANEL_OVERLAY_QUERY = "(max-width: 1050px), (max-device-width: 720px), (pointer: coarse) and (hover: none)";
@@ -1020,6 +1025,7 @@ const optionalFeatureAvailability = {
1020
1025
  tuiToolsCommand: false,
1021
1026
  remoteWebui: false,
1022
1027
  naturalConversation: false,
1028
+ codexFastMode: false,
1023
1029
  themeBundle: false,
1024
1030
  };
1025
1031
  const APP_RUNNER_CONTEXT_DEFAULT_LINES = 80;
@@ -1138,6 +1144,13 @@ const OPTIONAL_FEATURES = [
1138
1144
  capabilityLabel: "/stats",
1139
1145
  description: "Token and cost usage analytics commands plus the browser dashboard overlay.",
1140
1146
  },
1147
+ {
1148
+ id: "codexFastMode",
1149
+ label: "Codex Fast mode",
1150
+ packageName: "@firstpick/pi-extension-codex-fast-mode",
1151
+ capabilityLabel: "/fast-mode",
1152
+ description: "Session-scoped Codex subscription Fast mode selector in the Codex Usage panel. Spends extra subscription credits while enabled.",
1153
+ },
1141
1154
  {
1142
1155
  id: "themeBundle",
1143
1156
  label: "Theme bundle",
@@ -1147,6 +1160,11 @@ const OPTIONAL_FEATURES = [
1147
1160
  },
1148
1161
  ];
1149
1162
  const OPTIONAL_FEATURE_BY_ID = new Map(OPTIONAL_FEATURES.map((feature) => [feature.id, feature]));
1163
+ // Optional features that arm a paid or stateful runtime mode must turn it off before the browser
1164
+ // stops managing them, so a stale mode can never keep spending credits after a Disable click.
1165
+ const OPTIONAL_FEATURE_DISABLE_PREREQUISITES = new Map([
1166
+ ["codexFastMode", () => disableCodexFastModeIntegration()],
1167
+ ]);
1150
1168
 
1151
1169
  let issueWizardCatalog = null;
1152
1170
  let issueWizardState = createIssueWizardState();
@@ -1590,6 +1608,7 @@ const OPTIONAL_COMMAND_FEATURES = new Map([
1590
1608
  ["git-footer-refresh", "gitFooterStatus"],
1591
1609
  ["git-footer-visibility", "gitFooterStatus"],
1592
1610
  ["todo-progress-status", "todoProgressWidget"],
1611
+ ["fast-mode", "codexFastMode"],
1593
1612
  ]);
1594
1613
  const HIDDEN_COMMAND_NAMES = new Set(["webui-tree-navigate", "webui-helper"]);
1595
1614
  HIDDEN_COMMAND_NAMES.add("stats-webui");
@@ -3261,6 +3280,74 @@ function skillKindsLabel(entry) {
3261
3280
  return entry?.kinds?.has("read") ? "context read" : "tracked";
3262
3281
  }
3263
3282
 
3283
+ let sessionSkillTagLayoutFrame = 0;
3284
+ let sessionSkillTagResizeObserver = null;
3285
+
3286
+ function fitSessionSkillTags() {
3287
+ const container = elements.sessionSkillTags;
3288
+ if (!container || container.hidden) return;
3289
+ const tags = [...container.querySelectorAll("button.composer-skill-tag")];
3290
+ const overflow = container.querySelector(".composer-skill-tag.overflow");
3291
+ if (!tags.length || !overflow) return;
3292
+
3293
+ const availableWidth = container.clientWidth;
3294
+ if (availableWidth <= 0) return;
3295
+
3296
+ for (const tag of tags) tag.hidden = false;
3297
+ overflow.hidden = false;
3298
+
3299
+ const containerStyle = getComputedStyle(container);
3300
+ const gap = Number.parseFloat(containerStyle.columnGap || containerStyle.gap) || 0;
3301
+ const tagWidths = tags.map((tag) => tag.getBoundingClientRect().width);
3302
+ const overflowWidths = new Map();
3303
+ const maxOverflowDigits = String(tags.length).length;
3304
+ for (let digits = 1; digits <= maxOverflowDigits; digits += 1) {
3305
+ overflow.textContent = `+${"0".repeat(digits)}`;
3306
+ overflowWidths.set(digits, overflow.getBoundingClientRect().width);
3307
+ }
3308
+ let visibleCount = 0;
3309
+
3310
+ for (let count = tags.length; count >= 0; count -= 1) {
3311
+ const hiddenCount = tags.length - count;
3312
+ const itemCount = count + (hiddenCount ? 1 : 0);
3313
+ const tagsWidth = tagWidths.slice(0, count).reduce((total, width) => total + width, 0);
3314
+ const overflowWidth = hiddenCount ? overflowWidths.get(String(hiddenCount).length) || 0 : 0;
3315
+ const requiredWidth = tagsWidth + overflowWidth + Math.max(0, itemCount - 1) * gap;
3316
+ if (requiredWidth <= availableWidth + 0.5) {
3317
+ visibleCount = count;
3318
+ break;
3319
+ }
3320
+ }
3321
+
3322
+ tags.forEach((tag, index) => { tag.hidden = index >= visibleCount; });
3323
+ const hiddenCount = tags.length - visibleCount;
3324
+ overflow.hidden = hiddenCount === 0;
3325
+ if (hiddenCount) {
3326
+ overflow.textContent = `+${hiddenCount}`;
3327
+ overflow.title = `${hiddenCount} more tracked skill${hiddenCount === 1 ? "" : "s"}.`;
3328
+ }
3329
+ }
3330
+
3331
+ function scheduleSessionSkillTagLayout() {
3332
+ if (sessionSkillTagLayoutFrame) return;
3333
+ sessionSkillTagLayoutFrame = requestAnimationFrame(() => {
3334
+ sessionSkillTagLayoutFrame = 0;
3335
+ fitSessionSkillTags();
3336
+ });
3337
+ }
3338
+
3339
+ function installSessionSkillTagResizeHandling() {
3340
+ const container = elements.sessionSkillTags;
3341
+ if (!container) return;
3342
+ if (typeof ResizeObserver === "function") {
3343
+ sessionSkillTagResizeObserver = new ResizeObserver(scheduleSessionSkillTagLayout);
3344
+ sessionSkillTagResizeObserver.observe(container);
3345
+ if (container.parentElement) sessionSkillTagResizeObserver.observe(container.parentElement);
3346
+ } else {
3347
+ window.addEventListener("resize", scheduleSessionSkillTagLayout, { passive: true });
3348
+ }
3349
+ }
3350
+
3264
3351
  function renderSessionSkillTags(tabId = activeTabId) {
3265
3352
  const container = elements.sessionSkillTags;
3266
3353
  if (!container) return;
@@ -3270,8 +3357,7 @@ function renderSessionSkillTags(tabId = activeTabId) {
3270
3357
  container.hidden = true;
3271
3358
  return;
3272
3359
  }
3273
- const visible = entries.slice(0, SKILL_TAG_MAX_VISIBLE);
3274
- for (const entry of visible) {
3360
+ for (const entry of entries) {
3275
3361
  const classes = ["composer-skill-tag", "read"];
3276
3362
  const tag = make("button", classes.join(" "), entry.name);
3277
3363
  tag.type = "button";
@@ -3282,12 +3368,11 @@ function renderSessionSkillTags(tabId = activeTabId) {
3282
3368
  tag.addEventListener("click", () => openSkillEditor(entry));
3283
3369
  container.append(tag);
3284
3370
  }
3285
- if (entries.length > visible.length) {
3286
- const overflow = make("span", "composer-skill-tag overflow", `+${entries.length - visible.length}`);
3287
- overflow.title = `${entries.length - visible.length} more tracked skill${entries.length - visible.length === 1 ? "" : "s"}.`;
3288
- container.append(overflow);
3289
- }
3371
+ const overflow = make("span", "composer-skill-tag overflow", `+${entries.length}`);
3372
+ overflow.hidden = true;
3373
+ container.append(overflow);
3290
3374
  container.hidden = false;
3375
+ scheduleSessionSkillTagLayout();
3291
3376
  }
3292
3377
 
3293
3378
  function normalizeFeatureCategory(value) {
@@ -6809,6 +6894,16 @@ function setOptionalFeatureDisabled(featureId, disabled) {
6809
6894
  statusEntries.delete(NATURAL_CONVERSATION_STATUS_KEY);
6810
6895
  updateConversationModeForTab(activeTabId, { available: false, enabled: false, uiState: "off", statusText: "" }, { render: false });
6811
6896
  }
6897
+ if (featureId === "codexFastMode") {
6898
+ if (disabled) {
6899
+ statusEntries.delete(CODEX_FAST_MODE_STATUS_KEY);
6900
+ codexFastModeState = { ...codexFastModeState, available: false, enabled: false, statusKnown: false, busy: false };
6901
+ codexFastModeNotice = "";
6902
+ renderCodexFastModeControl();
6903
+ } else {
6904
+ refreshCodexFastMode().catch(() => null);
6905
+ }
6906
+ }
6812
6907
  storeDisabledOptionalFeatures();
6813
6908
  renderOptionalFeatureDependentDisplays();
6814
6909
  const tabContext = activeTabContext();
@@ -8211,20 +8306,31 @@ async function moveFileTreeEntry(entry = fileContextMenuState?.entry) {
8211
8306
  function readStoredSidePanelWidth() {
8212
8307
  try {
8213
8308
  const width = Number.parseFloat(localStorage.getItem(SIDE_PANEL_WIDTH_STORAGE_KEY) || "");
8214
- return Number.isFinite(width) && width >= SIDE_PANEL_WIDTH_MIN_PX ? width : null;
8309
+ return Number.isFinite(width) && width >= SIDE_PANEL_WIDTH_MIN_PX && width <= SIDE_PANEL_WIDTH_MAX_PX ? width : null;
8215
8310
  } catch {
8216
8311
  return null;
8217
8312
  }
8218
8313
  }
8219
8314
 
8220
- function persistSidePanelWidth(width) {
8315
+ function cacheSidePanelWidth(width) {
8221
8316
  try {
8222
8317
  localStorage.setItem(SIDE_PANEL_WIDTH_STORAGE_KEY, String(Math.round(width)));
8223
8318
  } catch {
8224
- // Ignore storage failures; resizing should still work for this page load.
8319
+ // Browser storage is only a local fallback for the user-scoped preference.
8225
8320
  }
8226
8321
  }
8227
8322
 
8323
+ function persistSidePanelWidth(width) {
8324
+ const rounded = Math.round(width);
8325
+ sidePanelWidthPreferenceRevision += 1;
8326
+ cacheSidePanelWidth(rounded);
8327
+ api("/api/interface-preferences", {
8328
+ method: "PUT",
8329
+ body: { sidePanelWidth: rounded },
8330
+ scoped: false,
8331
+ }).catch((error) => addEvent(`Could not save Control Deck width for this user: ${error.message || String(error)}`, "warn"));
8332
+ }
8333
+
8228
8334
  function sidePanelMaxWidth() {
8229
8335
  const layout = document.querySelector(".layout");
8230
8336
  const layoutRect = layout?.getBoundingClientRect?.();
@@ -8273,11 +8379,28 @@ function applySidePanelWidth(width, { persist = false } = {}) {
8273
8379
  return clamped;
8274
8380
  }
8275
8381
 
8276
- function restoreSidePanelWidthPreference() {
8277
- const width = readStoredSidePanelWidth();
8278
- if (width) document.documentElement.style.setProperty("--side-panel-width", `${Math.round(width)}px`);
8279
- if (!isSidePanelOverlayView()) applySidePanelWidth(width || SIDE_PANEL_WIDTH_DEFAULT_PX);
8280
- else updateSidePanelResizeHandle(width || SIDE_PANEL_WIDTH_DEFAULT_PX);
8382
+ async function restoreSidePanelWidthPreference() {
8383
+ const localWidth = readStoredSidePanelWidth();
8384
+ if (localWidth) document.documentElement.style.setProperty("--side-panel-width", `${Math.round(localWidth)}px`);
8385
+ if (!isSidePanelOverlayView()) applySidePanelWidth(localWidth || SIDE_PANEL_WIDTH_DEFAULT_PX);
8386
+ else updateSidePanelResizeHandle(localWidth || SIDE_PANEL_WIDTH_DEFAULT_PX);
8387
+
8388
+ const restoreRevision = sidePanelWidthPreferenceRevision;
8389
+ try {
8390
+ const response = await api("/api/interface-preferences", { scoped: false });
8391
+ if (restoreRevision !== sidePanelWidthPreferenceRevision) return;
8392
+ const userWidth = Number(response.data?.preferences?.sidePanelWidth);
8393
+ if (Number.isFinite(userWidth) && userWidth >= SIDE_PANEL_WIDTH_MIN_PX) {
8394
+ cacheSidePanelWidth(userWidth);
8395
+ document.documentElement.style.setProperty("--side-panel-width", `${Math.round(userWidth)}px`);
8396
+ if (!isSidePanelOverlayView()) applySidePanelWidth(userWidth);
8397
+ else updateSidePanelResizeHandle(userWidth);
8398
+ } else if (localWidth) {
8399
+ persistSidePanelWidth(localWidth);
8400
+ }
8401
+ } catch {
8402
+ // Keep the browser-local fallback when user settings cannot be loaded.
8403
+ }
8281
8404
  }
8282
8405
 
8283
8406
  function beginSidePanelResize(event) {
@@ -13080,13 +13203,20 @@ function gitFooterChipShapeKey(chip) {
13080
13203
  return JSON.stringify(shape);
13081
13204
  }
13082
13205
 
13206
+ function footerBranchPickerRenderKey() {
13207
+ // Branch data arrives asynchronously after the picker opens. Include its full
13208
+ // serializable state so the footer fast path cannot leave the initial loading
13209
+ // card mounted after fresher branch/worktree data has arrived.
13210
+ return footerBranchPickerOpen ? JSON.stringify(footerBranchPickerState) : "";
13211
+ }
13212
+
13083
13213
  function gitFooterPickerStateKey(payload) {
13084
13214
  const tabContext = activeTabContext();
13085
13215
  const refreshInFlight = tabContext.tabId ? gitFooterPayloadRefreshInFlightByTab.has(tabContext.tabId) : false;
13086
13216
  const syncPushInFlight = tabContext.tabId ? gitFooterSyncPushInFlightByTab.has(tabContext.tabId) : false;
13087
13217
  const piCalibrationInFlight = tabContext.tabId ? gitFooterPiCalibrationInFlightByTab.has(tabContext.tabId) : false;
13088
13218
  const refreshAvailable = hasLoadedRpcCommand("git-footer-refresh");
13089
- return `${footerModelPickerOpen ? 1 : 0}|${footerThinkingPickerOpen ? 1 : 0}|${footerBranchPickerOpen ? 1 : 0}|${mobileFooterExpanded ? 1 : 0}|${refreshInFlight ? 1 : 0}|${syncPushInFlight ? 1 : 0}|${piCalibrationInFlight ? 1 : 0}|${refreshAvailable ? 1 : 0}|${gitFooterPayloadVisibilityKey(payload)}`;
13219
+ return `${footerModelPickerOpen ? 1 : 0}|${footerThinkingPickerOpen ? 1 : 0}|${footerBranchPickerOpen ? 1 : 0}|${footerBranchPickerRenderKey()}|${mobileFooterExpanded ? 1 : 0}|${refreshInFlight ? 1 : 0}|${syncPushInFlight ? 1 : 0}|${piCalibrationInFlight ? 1 : 0}|${refreshAvailable ? 1 : 0}|${gitFooterPayloadVisibilityKey(payload)}`;
13090
13220
  }
13091
13221
 
13092
13222
  function updateGitFooterChipNodeValue(node, chip, valueSelector) {
@@ -15373,22 +15503,54 @@ function setFooterThinkingPickerOpen(open) {
15373
15503
  if (wasOpen && !footerThinkingPickerOpen) scheduleDeferredUiFlushAfterDropdownClose();
15374
15504
  }
15375
15505
 
15506
+ function footerGitBranchKey(item = {}) {
15507
+ // Remote-only rows stay distinct per exact remote ref so same-named branches
15508
+ // from different remotes never collapse into a single row.
15509
+ return item.remote ? `remote:${item.remoteRef}` : `local:${item.name}`;
15510
+ }
15511
+
15512
+ function footerBranchOptionLabel(branch = {}) {
15513
+ return cleanStatusText(branch.displayName) || cleanStatusText(branch.name);
15514
+ }
15515
+
15376
15516
  function normalizeFooterGitBranches(data = {}) {
15377
15517
  const current = cleanStatusText(data.current || data.currentBranch || "");
15518
+ const rawBranches = Array.isArray(data.branches) ? data.branches : [];
15519
+ const localNames = new Set(
15520
+ rawBranches
15521
+ .filter((item) => typeof item === "string" || item?.remote !== true)
15522
+ .map((item) => cleanStatusText(typeof item === "string" ? item : item?.name))
15523
+ .filter(Boolean),
15524
+ );
15378
15525
  const seen = new Set();
15379
15526
  const branches = [];
15380
- for (const item of Array.isArray(data.branches) ? data.branches : []) {
15527
+ for (const item of rawBranches) {
15381
15528
  const name = cleanStatusText(typeof item === "string" ? item : item?.name);
15382
- if (!name || seen.has(name)) continue;
15383
- seen.add(name);
15384
- branches.push({
15529
+ if (!name) continue;
15530
+ const remoteRef = cleanFooterPayloadText(item?.remoteRef, "", 4000);
15531
+ const remote = item?.remote === true;
15532
+ // Never downgrade a remote record without an exact ref into a local row: the
15533
+ // browser must not infer a Git command from display text alone.
15534
+ if (remote && !remoteRef) continue;
15535
+ // A local branch always represents the local name; remote rows for that
15536
+ // same name stay hidden until they are materialized locally.
15537
+ if (remote && localNames.has(name)) continue;
15538
+ const branch = {
15385
15539
  name,
15386
- current: Boolean(item?.current) || (!!current && name === current),
15387
- occupied: Boolean(item?.occupied),
15388
- worktreePath: cleanFooterPayloadText(item?.worktreePath, "", 4000),
15389
- worktreeCurrent: Boolean(item?.worktreeCurrent),
15390
- mainWorktree: Boolean(item?.mainWorktree),
15391
- });
15540
+ remote,
15541
+ remoteRef: remote ? remoteRef : "",
15542
+ remoteName: remote ? cleanStatusText(item?.remoteName) : "",
15543
+ displayName: remote ? cleanFooterPayloadText(item?.displayName, remoteRef, 4000) : name,
15544
+ current: !remote && (Boolean(item?.current) || (!!current && name === current)),
15545
+ occupied: !remote && Boolean(item?.occupied),
15546
+ worktreePath: remote ? "" : cleanFooterPayloadText(item?.worktreePath, "", 4000),
15547
+ worktreeCurrent: !remote && Boolean(item?.worktreeCurrent),
15548
+ mainWorktree: !remote && Boolean(item?.mainWorktree),
15549
+ };
15550
+ const key = footerGitBranchKey(branch);
15551
+ if (seen.has(key)) continue;
15552
+ seen.add(key);
15553
+ branches.push({ key, ...branch });
15392
15554
  }
15393
15555
  const worktrees = (Array.isArray(data.worktrees) ? data.worktrees : [])
15394
15556
  .map((item) => ({
@@ -15457,6 +15619,7 @@ async function loadFooterBranchPicker(tabContext = activeTabContext()) {
15457
15619
  worktrees: preserveState.worktrees || [],
15458
15620
  occupiedBranches: preserveState.occupiedBranches || [],
15459
15621
  switching: "",
15622
+ switchingKey: "",
15460
15623
  tabId,
15461
15624
  };
15462
15625
  if (isCurrentTabContext(tabContext)) {
@@ -15467,10 +15630,10 @@ async function loadFooterBranchPicker(tabContext = activeTabContext()) {
15467
15630
  const response = await api("/api/git-branches", { tabId });
15468
15631
  if (requestSerial !== footerBranchPickerRequestSerial || !footerBranchPickerOpen || !isCurrentTabContext(tabContext)) return;
15469
15632
  if (!response.ok) throw new Error(response.error || "Failed to load git branches");
15470
- footerBranchPickerState = { loading: false, error: "", switching: "", tabId, ...normalizeFooterGitBranches(response.data || {}) };
15633
+ footerBranchPickerState = { loading: false, error: "", switching: "", switchingKey: "", tabId, ...normalizeFooterGitBranches(response.data || {}) };
15471
15634
  } catch (error) {
15472
15635
  if (requestSerial !== footerBranchPickerRequestSerial || !footerBranchPickerOpen || !isCurrentTabContext(tabContext)) return;
15473
- footerBranchPickerState = { ...footerBranchPickerState, loading: false, switching: "", error: error.message || String(error) };
15636
+ footerBranchPickerState = { ...footerBranchPickerState, loading: false, switching: "", switchingKey: "", error: error.message || String(error) };
15474
15637
  }
15475
15638
  if (isCurrentTabContext(tabContext)) {
15476
15639
  renderFooter();
@@ -15548,32 +15711,36 @@ function footerBranchDirtySummaryLines() {
15548
15711
  ];
15549
15712
  }
15550
15713
 
15551
- async function confirmFooterGitBranchAction(branch, { create = false, requireConfirm = false, tabContext = activeTabContext() } = {}) {
15714
+ async function confirmFooterGitBranchAction(branch, { create = false, requireConfirm = false, tabContext = activeTabContext(), remoteRef = "" } = {}) {
15552
15715
  const branchName = cleanStatusText(branch);
15716
+ const trackedRemoteRef = cleanStatusText(remoteRef);
15553
15717
  const warningLines = footerBranchAgentWarningLines(tabContext);
15554
15718
  const dirtyLines = footerBranchDirtySummaryLines();
15555
15719
  if (!requireConfirm && warningLines.length === 0 && dirtyLines.length === 0) return true;
15556
- const action = create ? "Create and switch to new git branch" : "Switch git branch";
15720
+ const action = trackedRemoteRef ? "Create local tracking branch and switch to it" : create ? "Create and switch to new git branch" : "Switch git branch";
15557
15721
  const message = [
15558
15722
  `${action}: ${branchName}?`,
15559
15723
  "",
15560
15724
  `Repository: ${footerBranchPickerState.root || currentGitFooterCacheCwd(tabContext.tabId) || "current tab"}`,
15725
+ ...(trackedRemoteRef ? [`Remote ref: ${trackedRemoteRef}`, `Command: git switch --track -c ${branchName} ${trackedRemoteRef}`] : []),
15561
15726
  ...dirtyLines,
15562
15727
  ...warningLines,
15563
15728
  "",
15564
15729
  "Continue?",
15565
15730
  ].join("\n");
15566
- return appConfirmText(message, { affected: branchName || "the current branch", confirmLabel: create ? "Create branch" : "Switch branch" });
15731
+ return appConfirmText(message, { affected: branchName || "the current branch", confirmLabel: trackedRemoteRef ? "Create tracking branch" : create ? "Create branch" : "Switch branch" });
15567
15732
  }
15568
15733
 
15569
- async function confirmFooterGitWorktreeAction(branch, { path = "", create = false, requireConfirm = false } = {}) {
15734
+ async function confirmFooterGitWorktreeAction(branch, { path = "", create = false, requireConfirm = false, remoteRef = "" } = {}) {
15570
15735
  const branchName = cleanStatusText(branch);
15571
15736
  if (!requireConfirm) return true;
15737
+ const trackedRemoteRef = cleanStatusText(remoteRef);
15572
15738
  const targetPath = cleanFooterPayloadText(path, "", 4000);
15573
15739
  const message = [
15574
15740
  `${create ? "Create" : "Open"} branch worktree: ${branchName || targetPath}?`,
15575
15741
  "",
15576
15742
  `Repository: ${footerBranchPickerState.repoRoot || footerBranchPickerState.root || currentGitFooterCacheCwd() || "current tab"}`,
15743
+ ...(trackedRemoteRef ? [`Remote ref: ${trackedRemoteRef}`, `Creates local branch ${branchName} tracking ${trackedRemoteRef}.`] : []),
15577
15744
  targetPath ? `Worktree: ${targetPath}` : `Default location: ${footerBranchPickerState.defaultWorktreesRoot || "repo sibling .worktrees directory"}`,
15578
15745
  "",
15579
15746
  "This opens a separate checkout in a separate Pi tab and does not switch this tab's branch.",
@@ -15686,7 +15853,7 @@ async function openWorktreeResponseTab(response, { branchName = "", action = "op
15686
15853
  if (payload.tab) applyTabMetadata(payload.tab);
15687
15854
  footerBranchPickerOpen = false;
15688
15855
  footerBranchPickerRequestSerial += 1;
15689
- footerBranchPickerState = { ...footerBranchPickerState, loading: false, switching: "" };
15856
+ footerBranchPickerState = { ...footerBranchPickerState, loading: false, switching: "", switchingKey: "" };
15690
15857
  renderTabs();
15691
15858
  const targetTab = payload.tab;
15692
15859
  if (targetTab?.id) await switchTab(targetTab.id);
@@ -15699,24 +15866,29 @@ async function openWorktreeResponseTab(response, { branchName = "", action = "op
15699
15866
  requestGitFooterWebuiPayload(activeTabContext(), { force: true });
15700
15867
  }
15701
15868
 
15702
- async function createFooterGitBranchWorktree(branch = footerBranchCreateName(), { tabContext = activeTabContext(), skipConfirm = false, chooseBase = true } = {}) {
15869
+ async function createFooterGitBranchWorktree(branch = footerBranchCreateName(), { tabContext = activeTabContext(), skipConfirm = false, chooseBase = true, remoteRef = "", switchingLabel = "", switchingKey = "" } = {}) {
15703
15870
  const branchName = cleanStatusText(branch);
15704
15871
  if (!branchName) {
15705
15872
  addEvent("Enter a branch name before creating a branch worktree.", "warn");
15706
15873
  return;
15707
15874
  }
15708
- if (!skipConfirm && !(await confirmFooterGitWorktreeAction(branchName, { create: true, requireConfirm: true }))) return;
15709
- const baseRef = chooseBase ? await chooseGitWorktreeBase(branchName) : "HEAD";
15875
+ const trackedRemoteRef = cleanFooterPayloadText(remoteRef, "", 4000);
15876
+ if (!skipConfirm && !(await confirmFooterGitWorktreeAction(branchName, { create: true, requireConfirm: true, remoteRef: trackedRemoteRef }))) return;
15877
+ const baseRef = trackedRemoteRef ? "" : chooseBase ? await chooseGitWorktreeBase(branchName) : "HEAD";
15710
15878
  if (baseRef === null) return;
15711
15879
  const tabId = tabContext.tabId || activeTabId;
15712
15880
  try {
15713
- footerBranchPickerState = { ...footerBranchPickerState, loading: true, error: "", switching: branchName, tabId };
15881
+ footerBranchPickerState = { ...footerBranchPickerState, loading: true, error: "", switching: switchingLabel || branchName, switchingKey, tabId };
15714
15882
  renderFooter();
15715
- const response = await api("/api/git-worktrees", { method: "POST", body: { branchName, baseRef, sessionMode: "fork-current", openTab: true }, tabId });
15883
+ // Remote-only creation submits the exact advertised remote ref instead of a
15884
+ // base ref; the server re-verifies it and creates a local tracking branch.
15885
+ const response = trackedRemoteRef
15886
+ ? await api("/api/git-worktrees", { method: "POST", body: { branchName, remoteRef: trackedRemoteRef, sessionMode: "fork-current", openTab: true }, tabId })
15887
+ : await api("/api/git-worktrees", { method: "POST", body: { branchName, baseRef, sessionMode: "fork-current", openTab: true }, tabId });
15716
15888
  await openWorktreeResponseTab(response, { branchName, action: "create" });
15717
15889
  } catch (error) {
15718
15890
  if (isCurrentTabContext(tabContext)) {
15719
- footerBranchPickerState = { ...footerBranchPickerState, loading: false, switching: "", error: error.message || String(error) };
15891
+ footerBranchPickerState = { ...footerBranchPickerState, loading: false, switching: "", switchingKey: "", error: error.message || String(error) };
15720
15892
  renderFooter();
15721
15893
  updateFooterModelPickerPosition();
15722
15894
  }
@@ -15724,19 +15896,19 @@ async function createFooterGitBranchWorktree(branch = footerBranchCreateName(),
15724
15896
  }
15725
15897
  }
15726
15898
 
15727
- async function openFooterGitWorktree(path, { branchName = "", tabContext = activeTabContext(), skipConfirm = false } = {}) {
15899
+ async function openFooterGitWorktree(path, { branchName = "", tabContext = activeTabContext(), skipConfirm = false, switchingKey = "" } = {}) {
15728
15900
  const worktreePath = cleanFooterPayloadText(path, "", 4000);
15729
15901
  if (!worktreePath) return;
15730
15902
  if (!skipConfirm && !(await confirmFooterGitWorktreeAction(branchName, { path: worktreePath, requireConfirm: false }))) return;
15731
15903
  const tabId = tabContext.tabId || activeTabId;
15732
15904
  try {
15733
- footerBranchPickerState = { ...footerBranchPickerState, loading: true, error: "", switching: branchName || worktreePath, tabId };
15905
+ footerBranchPickerState = { ...footerBranchPickerState, loading: true, error: "", switching: branchName || worktreePath, switchingKey, tabId };
15734
15906
  renderFooter();
15735
15907
  const response = await api("/api/git-worktrees/open", { method: "POST", body: { path: worktreePath, sessionMode: "fork-current", openTab: true }, tabId });
15736
15908
  await openWorktreeResponseTab(response, { branchName, action: "open" });
15737
15909
  } catch (error) {
15738
15910
  if (isCurrentTabContext(tabContext)) {
15739
- footerBranchPickerState = { ...footerBranchPickerState, loading: false, switching: "", error: error.message || String(error) };
15911
+ footerBranchPickerState = { ...footerBranchPickerState, loading: false, switching: "", switchingKey: "", error: error.message || String(error) };
15740
15912
  renderFooter();
15741
15913
  updateFooterModelPickerPosition();
15742
15914
  }
@@ -15744,28 +15916,33 @@ async function openFooterGitWorktree(path, { branchName = "", tabContext = activ
15744
15916
  }
15745
15917
  }
15746
15918
 
15747
- async function applyFooterGitBranch(branch, { create = false, tabContext = activeTabContext(), skipConfirm = false } = {}) {
15919
+ async function applyFooterGitBranch(branch, { create = false, tabContext = activeTabContext(), skipConfirm = false, remoteRef = "", switchingLabel = "", switchingKey = "" } = {}) {
15748
15920
  const branchName = cleanStatusText(branch);
15749
15921
  if (!branchName) return;
15750
15922
  const tabId = tabContext.tabId || activeTabId;
15751
- if (!skipConfirm && !(await confirmFooterGitBranchAction(branchName, { create, tabContext }))) return;
15923
+ const trackedRemoteRef = cleanFooterPayloadText(remoteRef, "", 4000);
15924
+ if (!skipConfirm && !(await confirmFooterGitBranchAction(branchName, { create, tabContext, remoteRef: trackedRemoteRef }))) return;
15752
15925
  try {
15753
- footerBranchPickerState = { ...footerBranchPickerState, loading: true, error: "", switching: branchName, tabId };
15926
+ footerBranchPickerState = { ...footerBranchPickerState, loading: true, error: "", switching: switchingLabel || branchName, switchingKey, tabId };
15754
15927
  renderFooter();
15755
- const response = await api("/api/git-branch", { method: "POST", body: { branch: branchName, create }, tabId });
15928
+ // Remote-only switching sends the exact remote ref plus the intended local
15929
+ // branch; the server creates a tracking branch instead of detaching HEAD.
15930
+ const response = trackedRemoteRef
15931
+ ? await api("/api/git-branch", { method: "POST", body: { branch: branchName, create, remoteRef: trackedRemoteRef }, tabId })
15932
+ : await api("/api/git-branch", { method: "POST", body: { branch: branchName, create }, tabId });
15756
15933
  if (!isCurrentTabContext(tabContext)) return;
15757
- if (!response.ok) throw new Error(response.error || `Failed to ${create ? "create and switch to" : "switch to"} ${branchName}`);
15934
+ if (!response.ok) throw new Error(response.error || (trackedRemoteRef ? `Failed to create local branch ${branchName} tracking ${trackedRemoteRef}` : `Failed to ${create ? "create and switch to" : "switch to"} ${branchName}`));
15758
15935
  const switchedBranch = cleanStatusText(response.data?.branch || branchName);
15759
15936
  footerBranchPickerOpen = false;
15760
15937
  footerBranchPickerRequestSerial += 1;
15761
- footerBranchPickerState = { ...footerBranchPickerState, loading: false, switching: "", current: switchedBranch };
15938
+ footerBranchPickerState = { ...footerBranchPickerState, loading: false, switching: "", switchingKey: "", current: switchedBranch };
15762
15939
  if (create) updateFooterBranchCreateDraft({ name: "" });
15763
15940
  applyOptimisticGitFooterBranch(switchedBranch, tabContext);
15764
- addEvent(response.data?.created ? `Created and switched to git branch ${switchedBranch}.` : response.data?.switched === false ? `Already on git branch ${switchedBranch}.` : `Switched git branch to ${switchedBranch}.`, "info");
15941
+ addEvent(trackedRemoteRef ? `Created local branch ${switchedBranch} tracking ${trackedRemoteRef} and switched this checkout.` : response.data?.created ? `Created and switched to git branch ${switchedBranch}.` : response.data?.switched === false ? `Already on git branch ${switchedBranch}.` : `Switched git branch to ${switchedBranch}.`, "info");
15765
15942
  requestGitFooterWebuiPayload(tabContext, { force: true });
15766
15943
  } catch (error) {
15767
15944
  if (isCurrentTabContext(tabContext)) {
15768
- footerBranchPickerState = { ...footerBranchPickerState, loading: false, switching: "", error: error.message || String(error) };
15945
+ footerBranchPickerState = { ...footerBranchPickerState, loading: false, switching: "", switchingKey: "", error: error.message || String(error) };
15769
15946
  addEvent(error.message || String(error), "error");
15770
15947
  }
15771
15948
  } finally {
@@ -15896,52 +16073,95 @@ function renderFooterBranchCreateForm(state = footerBranchPickerState) {
15896
16073
  }
15897
16074
 
15898
16075
  function footerBranchWorktreePath(branch, state = footerBranchPickerState) {
16076
+ // Remote-only rows have no checkout yet and must never inherit the worktree
16077
+ // of an unrelated same-named local branch.
16078
+ if (branch?.remote) return "";
15899
16079
  const direct = cleanFooterPayloadText(branch?.worktreePath, "", 4000);
15900
16080
  if (direct) return direct;
15901
16081
  return cleanFooterPayloadText(state.occupiedBranches?.find((item) => item.branch === branch?.name)?.path, "", 4000);
15902
16082
  }
15903
16083
 
15904
16084
  function footerBranchOptionDetail(branch, state, { selected, worktreePath } = {}) {
15905
- if (state.switching === branch.name) return "opening…";
16085
+ if (state.switchingKey ? state.switchingKey === branch.key : state.switching === footerBranchOptionLabel(branch)) return "opening…";
15906
16086
  if (selected) return branch.worktreeCurrent ? "current branch in this worktree" : "current branch";
16087
+ if (branch.remote) return `remote-only · creates local branch ${branch.name} tracking ${branch.remoteRef}`;
15907
16088
  if (worktreePath) return branch.mainWorktree ? "checked out in main worktree · open tab" : "checked out in another worktree · open tab";
15908
16089
  return "open branch in a new worktree tab";
15909
16090
  }
15910
16091
 
15911
16092
  function openFooterBranchOption(branch, state = footerBranchPickerState) {
16093
+ if (branch.remote) return createFooterGitBranchWorktree(branch.name, { skipConfirm: true, chooseBase: false, remoteRef: branch.remoteRef, switchingLabel: footerBranchOptionLabel(branch), switchingKey: branch.key });
15912
16094
  const worktreePath = footerBranchWorktreePath(branch, state);
15913
- if (worktreePath && !branch.worktreeCurrent) return openFooterGitWorktree(worktreePath, { branchName: branch.name, skipConfirm: true });
15914
- return createFooterGitBranchWorktree(branch.name, { skipConfirm: true, chooseBase: false });
16095
+ if (worktreePath && !branch.worktreeCurrent) return openFooterGitWorktree(worktreePath, { branchName: branch.name, skipConfirm: true, switchingKey: branch.key });
16096
+ return createFooterGitBranchWorktree(branch.name, { skipConfirm: true, chooseBase: false, switchingKey: branch.key });
16097
+ }
16098
+
16099
+ function footerBranchSwitchAvailability(branch = {}, state = {}, worktreePath = "") {
16100
+ if (state.switching) {
16101
+ return {
16102
+ disabled: true,
16103
+ label: "Action running…",
16104
+ reason: `Cannot switch this checkout while the branch action for ${state.switching} is still running.`,
16105
+ };
16106
+ }
16107
+ if (state.loading) {
16108
+ return {
16109
+ disabled: true,
16110
+ label: "Refreshing…",
16111
+ reason: "Cannot switch this checkout until the latest branch and worktree information finishes loading.",
16112
+ };
16113
+ }
16114
+ if (worktreePath) {
16115
+ const location = branch.mainWorktree ? "the main worktree" : "another worktree";
16116
+ return {
16117
+ disabled: true,
16118
+ label: branch.mainWorktree ? "In main worktree" : "In another worktree",
16119
+ reason: `Cannot switch this checkout because ${branch.name} is already checked out in ${location} at ${worktreePath}. Open that worktree instead.`,
16120
+ };
16121
+ }
16122
+ return { disabled: false, label: "Switch here", reason: "" };
15915
16123
  }
15916
16124
 
15917
16125
  function renderFooterBranchOption(branch, state = footerBranchPickerState) {
15918
- const selected = branch.current || (!!state.current && branch.name === state.current);
16126
+ const selected = !branch.remote && (branch.current || (!!state.current && branch.name === state.current));
15919
16127
  const worktreePath = footerBranchWorktreePath(branch, state);
15920
16128
  const busy = state.loading || !!state.switching;
15921
16129
  const primaryDisabled = busy || selected;
15922
- const row = make("div", `footer-branch-option-row${selected ? " active" : ""}${worktreePath && !branch.worktreeCurrent ? " worktree-occupied" : ""}`);
16130
+ const row = make("div", `footer-branch-option-row${selected ? " active" : ""}${branch.remote ? " remote-only" : ""}${worktreePath && !branch.worktreeCurrent ? " worktree-occupied" : ""}`);
15923
16131
  row.setAttribute("role", "option");
15924
16132
  row.setAttribute("aria-selected", selected ? "true" : "false");
15925
16133
 
15926
16134
  const primary = make("button", "footer-model-option footer-branch-option footer-branch-primary-action");
15927
16135
  primary.type = "button";
15928
16136
  primary.disabled = primaryDisabled;
15929
- primary.title = selected ? `Current branch: ${branch.name}` : worktreePath ? `Open existing worktree: ${worktreePath}` : `Open ${branch.name} in a new Git worktree tab`;
16137
+ primary.title = selected
16138
+ ? `Current branch: ${branch.name}`
16139
+ : branch.remote
16140
+ ? `Remote-only branch ${branch.remoteRef}: create local branch ${branch.name} tracking it and open a new Git worktree tab`
16141
+ : worktreePath ? `Open existing worktree: ${worktreePath}` : `Open ${branch.name} in a new Git worktree tab`;
15930
16142
  primary.append(
15931
- make("span", "footer-model-option-main", branch.name),
16143
+ make("span", "footer-model-option-main", footerBranchOptionLabel(branch)),
15932
16144
  make("span", "footer-model-option-name", footerBranchOptionDetail(branch, state, { selected, worktreePath })),
15933
16145
  );
15934
16146
  if (!primaryDisabled) primary.addEventListener("click", () => openFooterBranchOption(branch, state));
15935
16147
  row.append(primary);
15936
16148
 
15937
16149
  if (!selected) {
15938
- const advanced = make("button", "footer-branch-advanced-action", "Switch here");
16150
+ const availability = footerBranchSwitchAvailability(branch, state, worktreePath);
16151
+ const advanced = make("button", "footer-branch-advanced-action", availability.label);
15939
16152
  advanced.type = "button";
15940
- advanced.disabled = busy || !!worktreePath;
15941
- advanced.title = worktreePath
15942
- ? "This branch is already checked out elsewhere; use the primary worktree action instead of switching this checkout."
15943
- : `Advanced: git switch ${branch.name} in this checkout`;
15944
- advanced.addEventListener("click", () => applyFooterGitBranch(branch.name));
16153
+ advanced.disabled = availability.disabled;
16154
+ advanced.title = availability.reason || (branch.remote
16155
+ ? `Advanced: git switch --track -c ${branch.name} ${branch.remoteRef} in this checkout`
16156
+ : `Advanced: git switch ${branch.name} in this checkout`);
16157
+ if (availability.reason) {
16158
+ advanced.dataset.disabledReason = availability.reason;
16159
+ advanced.setAttribute("aria-label", `${availability.label}. ${availability.reason}`);
16160
+ } else {
16161
+ advanced.addEventListener("click", () => branch.remote
16162
+ ? applyFooterGitBranch(branch.name, { remoteRef: branch.remoteRef, switchingLabel: footerBranchOptionLabel(branch), switchingKey: branch.key })
16163
+ : applyFooterGitBranch(branch.name, { switchingKey: branch.key }));
16164
+ }
15945
16165
  row.append(advanced);
15946
16166
  }
15947
16167
  return row;
@@ -16059,14 +16279,14 @@ function renderFooterBranchPicker() {
16059
16279
  return picker;
16060
16280
  }
16061
16281
  if (state.loading && state.branches.length === 0) {
16062
- picker.append(make("div", "footer-model-picker-empty muted", "Loading existing local branches and worktrees… Worktree creation is available once branch data loads."), renderFooterBranchCreateForm(state));
16282
+ picker.append(make("div", "footer-model-picker-empty muted", "Loading local and fetched remote branches and worktrees… Worktree creation is available once branch data loads."), renderFooterBranchCreateForm(state));
16063
16283
  return picker;
16064
16284
  }
16065
16285
 
16066
- const hasOtherBranches = state.branches.some((branch) => !branch.current && branch.name !== state.current);
16286
+ const hasOtherBranches = state.branches.some((branch) => branch.remote || (!branch.current && branch.name !== state.current));
16067
16287
  if (!state.loading && !hasOtherBranches) {
16068
16288
  const empty = make("div", "footer-model-picker-empty muted");
16069
- empty.append(make("strong", undefined, "No other local branches available."), make("span", undefined, " Create a branch worktree from origin/main or the current workspace HEAD to continue."));
16289
+ empty.append(make("strong", undefined, "No other local or fetched remote branches available."), make("span", undefined, " Fetch to list remote branches, or create a branch worktree from origin/main or the current workspace HEAD to continue."));
16070
16290
  picker.append(empty);
16071
16291
  }
16072
16292
 
@@ -16984,6 +17204,180 @@ async function refreshCodexUsage({ forceAuthRefresh = false } = {}) {
16984
17204
  }
16985
17205
  }
16986
17206
 
17207
+ // Codex subscription Fast mode is owned by the optional pi-extension-codex-fast-mode package. The
17208
+ // browser only reads the sanitized tab-scoped server snapshot and asks the server to run the
17209
+ // package-owned /fast-mode command; it never sees ChatGPT credentials or request payloads.
17210
+ let codexFastModeState = { available: false, enabled: false, statusKnown: false, busy: false, model: null, modelEligible: false, unavailableReason: "", creditNotice: "" };
17211
+ let codexFastModeLoaded = false;
17212
+ let codexFastModeBusy = false;
17213
+ let codexFastModeNotice = "";
17214
+ let codexFastModeSelection = "normal";
17215
+
17216
+ function codexFastModeControlDisabled() {
17217
+ return !codexFastModeLoaded
17218
+ || !codexFastModeState.available
17219
+ || !isOptionalFeatureEnabled("codexFastMode")
17220
+ || codexFastModeBusy
17221
+ || codexFastModeState.busy === true;
17222
+ }
17223
+
17224
+ function codexFastModeStatusText() {
17225
+ if (codexFastModeNotice) return codexFastModeNotice;
17226
+ if (!isOptionalFeatureEnabled("codexFastMode")) return optionalFeatureUnavailableMessage("codexFastMode");
17227
+ if (!codexFastModeLoaded) return "Checking Codex Fast mode…";
17228
+ if (!codexFastModeState.available) return codexFastModeState.unavailableReason || optionalFeatureUnavailableMessage("codexFastMode");
17229
+ const parts = [];
17230
+ parts.push(codexFastModeState.statusKnown
17231
+ ? `Session mode: ${codexFastModeState.enabled ? "Fast" : "Normal"}.`
17232
+ : "Session mode: unknown until /fast-mode reports status.");
17233
+ if (codexFastModeState.busy) parts.push("This tab is busy; the mode cannot change during a running turn.");
17234
+ if (codexFastModeState.model && !codexFastModeState.modelEligible) {
17235
+ parts.push(`Active model ${codexFastModeState.model.provider}/${codexFastModeState.model.id} is not a subscription-backed openai-codex model, so Fast mode stays armed but unused.`);
17236
+ }
17237
+ if (codexFastModeState.creditNotice) parts.push(codexFastModeState.creditNotice);
17238
+ return parts.join(" ");
17239
+ }
17240
+
17241
+ function renderCodexFastModeControl({ syncSelection = true } = {}) {
17242
+ if (!elements.codexFastModeSelect || !elements.setCodexFastModeButton || !elements.codexFastModeStatus) return;
17243
+ if (syncSelection) {
17244
+ codexFastModeSelection = codexFastModeState.enabled ? "fast" : "normal";
17245
+ elements.codexFastModeSelect.value = codexFastModeSelection;
17246
+ }
17247
+ const controlDisabled = codexFastModeControlDisabled();
17248
+ elements.codexFastModeSelect.disabled = controlDisabled;
17249
+ elements.setCodexFastModeButton.disabled = controlDisabled
17250
+ || elements.codexFastModeSelect.value === (codexFastModeState.enabled ? "fast" : "normal");
17251
+ elements.setCodexFastModeButton.textContent = codexFastModeBusy ? "Applying…" : "Apply";
17252
+ elements.codexFastModeStatus.textContent = codexFastModeStatusText();
17253
+ const warn = !!codexFastModeNotice
17254
+ || (codexFastModeLoaded && !codexFastModeState.available)
17255
+ || codexFastModeState.busy === true
17256
+ || !isOptionalFeatureEnabled("codexFastMode");
17257
+ elements.codexFastModeStatus.classList.toggle("warning", warn);
17258
+ }
17259
+
17260
+ function applyCodexFastModeData(data) {
17261
+ codexFastModeState = {
17262
+ available: data?.available === true,
17263
+ enabled: data?.enabled === true,
17264
+ statusKnown: data?.statusKnown === true,
17265
+ busy: data?.busy === true,
17266
+ model: data?.model || null,
17267
+ modelEligible: data?.modelEligible === true,
17268
+ unavailableReason: data?.unavailableReason || "",
17269
+ creditNotice: data?.creditNotice || "",
17270
+ };
17271
+ if (codexFastModeState.available) optionalFeatureAvailability.codexFastMode = true;
17272
+ }
17273
+
17274
+ function codexFastModeConfirmedOff(data) {
17275
+ return data?.statusKnown === true && data?.enabled !== true;
17276
+ }
17277
+
17278
+ function applyCodexFastModeStatus(statusText) {
17279
+ const status = String(statusText || "").trim().toLowerCase();
17280
+ if (status !== "on" && status !== "off") return false;
17281
+ codexFastModeState = {
17282
+ ...codexFastModeState,
17283
+ available: true,
17284
+ enabled: status === "on",
17285
+ statusKnown: true,
17286
+ };
17287
+ codexFastModeLoaded = true;
17288
+ codexFastModeNotice = "";
17289
+ renderCodexFastModeControl();
17290
+ if (status === "on" && !isOptionalFeatureEnabled("codexFastMode")) {
17291
+ const tabContext = activeTabContext();
17292
+ queueMicrotask(() => refreshCodexFastMode(tabContext).catch((error) => {
17293
+ if (isCurrentTabContext(tabContext)) addEvent(`Disabled Codex Fast mode could not be disarmed: ${error.message || String(error)}`, "error");
17294
+ }));
17295
+ }
17296
+ return true;
17297
+ }
17298
+
17299
+ async function refreshCodexFastMode(tabContext = activeTabContext()) {
17300
+ if (!elements.codexFastModeSelect || !tabContext.tabId) return codexFastModeState;
17301
+ const featureEnabled = isOptionalFeatureEnabled("codexFastMode");
17302
+ try {
17303
+ let response = await api("/api/codex-fast-mode", { tabId: tabContext.tabId });
17304
+ let data = response.data || {};
17305
+ // Browser disable is global while extension state is session/branch local. Keep querying even
17306
+ // when hidden and disarm a restored branch before it can silently remain on.
17307
+ if (!featureEnabled && data.available && !codexFastModeConfirmedOff(data)) {
17308
+ if (data.busy) throw new Error("this tab is busy; Fast mode will be disarmed when it becomes idle");
17309
+ response = await api("/api/codex-fast-mode", { method: "PUT", body: { enabled: false }, tabId: tabContext.tabId });
17310
+ data = response.data || {};
17311
+ if (!codexFastModeConfirmedOff(data)) throw new Error("the extension did not confirm Fast mode off");
17312
+ }
17313
+ if (!isCurrentTabContext(tabContext)) return codexFastModeState;
17314
+ applyCodexFastModeData(data);
17315
+ codexFastModeNotice = "";
17316
+ } catch (error) {
17317
+ if (!isCurrentTabContext(tabContext)) return codexFastModeState;
17318
+ codexFastModeState = { ...codexFastModeState, available: false, busy: false, unavailableReason: `Codex Fast mode unavailable: ${error.message || String(error)}.` };
17319
+ if (!featureEnabled) throw error;
17320
+ } finally {
17321
+ if (isCurrentTabContext(tabContext)) {
17322
+ codexFastModeLoaded = true;
17323
+ renderCodexFastModeControl();
17324
+ }
17325
+ }
17326
+ return codexFastModeState;
17327
+ }
17328
+
17329
+ async function applyCodexFastMode() {
17330
+ if (!elements.codexFastModeSelect || codexFastModeBusy) return;
17331
+ const tabContext = activeTabContext();
17332
+ if (!tabContext.tabId) return;
17333
+ const enabled = elements.codexFastModeSelect.value === "fast";
17334
+ if (enabled === codexFastModeState.enabled) return;
17335
+ codexFastModeBusy = true;
17336
+ codexFastModeNotice = "";
17337
+ renderCodexFastModeControl({ syncSelection: false });
17338
+ try {
17339
+ const response = await api("/api/codex-fast-mode", { method: "PUT", body: { enabled }, tabId: tabContext.tabId });
17340
+ if (!isCurrentTabContext(tabContext)) return;
17341
+ applyCodexFastModeData(response.data);
17342
+ addEvent(enabled
17343
+ ? "Codex Fast mode requested for this session. It asks supported Codex models for about 1.5x faster responses and may spend 2x credits on GPT-5.4 or 2.5x on GPT-5.5/5.6."
17344
+ : "Codex Fast mode turned off for this session; requests return to the standard tier.", "info");
17345
+ } catch (error) {
17346
+ if (!isCurrentTabContext(tabContext)) return;
17347
+ codexFastModeNotice = `Failed to change Codex Fast mode: ${error.message || String(error)}. You can retry.`;
17348
+ addEvent(codexFastModeNotice, "error");
17349
+ } finally {
17350
+ codexFastModeBusy = false;
17351
+ if (isCurrentTabContext(tabContext)) renderCodexFastModeControl();
17352
+ }
17353
+ }
17354
+
17355
+ // Optional-features Disable is browser-global while Fast mode is tab/session scoped. Disarm every
17356
+ // live tab first and abort the browser-side disable if any armed or unknown instance cannot confirm
17357
+ // off. Future branch restores are handled by refreshCodexFastMode even while the control is hidden.
17358
+ async function disableCodexFastModeIntegration() {
17359
+ const tabIds = [...new Set(tabs.filter((tab) => tab?.id && tab.running !== false).map((tab) => tab.id))];
17360
+ const snapshots = await Promise.all(tabIds.map(async (tabId) => {
17361
+ const response = await api("/api/codex-fast-mode", { tabId });
17362
+ return { tabId, data: response.data || {} };
17363
+ }));
17364
+
17365
+ for (const { tabId, data } of snapshots) {
17366
+ if (!data.available) {
17367
+ if (data.statusKnown && data.enabled) throw new Error(`tab ${tabId} still reports Fast mode on but /fast-mode is unavailable`);
17368
+ continue;
17369
+ }
17370
+ if (data.busy && !codexFastModeConfirmedOff(data)) throw new Error(`tab ${tabId} is busy; wait for it to finish before disabling Codex Fast mode`);
17371
+ }
17372
+
17373
+ for (const { tabId, data } of snapshots) {
17374
+ if (!data.available || codexFastModeConfirmedOff(data)) continue;
17375
+ const response = await api("/api/codex-fast-mode", { method: "PUT", body: { enabled: false }, tabId });
17376
+ if (!codexFastModeConfirmedOff(response.data)) throw new Error(`tab ${tabId} did not confirm Codex Fast mode off`);
17377
+ if (tabId === activeTabId) applyCodexFastModeData(response.data);
17378
+ }
17379
+ }
17380
+
16987
17381
  function scheduleRefreshCodexUsage(delay = CODEX_USAGE_REFRESH_MS) {
16988
17382
  clearTimeout(refreshCodexUsageTimer);
16989
17383
  refreshCodexUsageTimer = setTimeout(() => {
@@ -22718,7 +23112,11 @@ async function gitWorkflowRequest(path, { method = "POST", body = {}, runId, tab
22718
23112
  if (!response.ok) {
22719
23113
  const hint = response.hint ? `\n\nHint: ${response.hint}` : "";
22720
23114
  const detail = response.data ? `\n\n${formatGitCommandResult(response.data)}` : "";
22721
- throw new Error(`${response.error || "Git workflow request failed"}${hint}${detail}`);
23115
+ const failure = new Error(`${response.error || "Git workflow request failed"}${hint}${detail}`);
23116
+ if (response.code) failure.code = response.code;
23117
+ if (response.hint) failure.hint = response.hint;
23118
+ if (response.data) failure.data = response.data;
23119
+ throw failure;
22722
23120
  }
22723
23121
  return response.data;
22724
23122
  }
@@ -23828,6 +24226,82 @@ async function commitGitWorkflow(variant, tabId = gitWorkflowActionTabId()) {
23828
24226
  }
23829
24227
  }
23830
24228
 
24229
+ function cleanGitPublishVisibilityInput(value) {
24230
+ const visibility = String(value ?? "").trim().toLowerCase();
24231
+ if (visibility !== "public" && visibility !== "private") {
24232
+ throw new Error("Repository visibility must be typed as exactly 'public' or 'private'. There is no default; nothing was published.");
24233
+ }
24234
+ return visibility;
24235
+ }
24236
+
24237
+ function promptGitPublishRepoName(tabId = activeTabId) {
24238
+ const targetTab = tabs.find((tab) => tab.id === tabId) || activeTab();
24239
+ const value = window.prompt("GitHub repository name to create", defaultGitInitRepoName(targetTab));
24240
+ if (value === null) return null;
24241
+ return cleanGitHubRepoNameInput(value);
24242
+ }
24243
+
24244
+ function promptGitPublishVisibility(repoName) {
24245
+ const value = window.prompt(`Visibility for GitHub repository ${repoName} — type public or private (no default)`, "");
24246
+ if (value === null) return null;
24247
+ return cleanGitPublishVisibilityInput(value);
24248
+ }
24249
+
24250
+ async function publishGitWorkflowRepository(tabId, failure) {
24251
+ const tabContext = activeTabContext(tabId);
24252
+ const workflow = gitWorkflowForTab(tabId, { create: false });
24253
+ if (!workflow) return false;
24254
+ const runId = workflow.runId;
24255
+ const branch = failure?.data?.branch || gitFooterCurrentBranch() || "the current branch";
24256
+ const publishRequested = await appConfirmText([
24257
+ failure?.message || "git push found no configured push destination.",
24258
+ "",
24259
+ "Publish this repository to GitHub with the authenticated GitHub CLI (gh) account instead?",
24260
+ "Nothing is created until you choose a name, choose visibility explicitly, and confirm the final summary.",
24261
+ ].join("\n"), { affected: "A new GitHub repository and the origin remote", confirmLabel: "Choose publication details", danger: false });
24262
+ if (!publishRequested) return false;
24263
+ let repoName;
24264
+ let visibility;
24265
+ try {
24266
+ repoName = promptGitPublishRepoName(tabId);
24267
+ if (!repoName) return false;
24268
+ visibility = promptGitPublishVisibility(repoName);
24269
+ if (!visibility) return false;
24270
+ } catch (error) {
24271
+ addEvent(error.message || String(error), "error");
24272
+ return false;
24273
+ }
24274
+ const confirmed = await appConfirmText([
24275
+ "Publish this repository to GitHub?",
24276
+ "",
24277
+ `Repository name: ${repoName}`,
24278
+ `Visibility: ${visibility}`,
24279
+ `Branch to push: ${branch}`,
24280
+ "Resulting remote: origin",
24281
+ "",
24282
+ "This creates a new GitHub repository owned by the authenticated gh account, configures origin, and pushes the current branch. Guided Git never force-pushes.",
24283
+ ].join("\n"), { affected: `New ${visibility} GitHub repository ${repoName}`, confirmLabel: "Publish repository" });
24284
+ if (!confirmed) return false;
24285
+ setGitWorkflow({ step: "pushing", busy: true, error: "", output: `Creating ${visibility} GitHub repository ${repoName} and pushing ${branch}…` }, { tabId });
24286
+ const result = await gitWorkflowRequest("/api/git-workflow/publish", { body: { repoName, visibility, confirmed: true }, runId, tabId });
24287
+ if (!result) return true;
24288
+ setGitWorkflow({
24289
+ step: "done",
24290
+ busy: false,
24291
+ ...gitWorkflowActionDonePatch(workflow, "push"),
24292
+ output: [
24293
+ `Published ${result.repoName || repoName} as ${result.visibility || visibility}.`,
24294
+ `Remote: ${result.remote || "origin"}`,
24295
+ `Branch: ${result.branch || branch}`,
24296
+ ...(result.protectedBranch ? [`Note: ${result.branch || branch} is usually a protected/shared branch name.`] : []),
24297
+ "",
24298
+ formatGitCommandResult(result) || "gh repo create finished.",
24299
+ ].join("\n"),
24300
+ }, { tabId });
24301
+ if (isCurrentTabContext(tabContext)) scheduleRefreshFooter();
24302
+ return true;
24303
+ }
24304
+
23831
24305
  async function pushGitWorkflow(tabId = gitWorkflowActionTabId()) {
23832
24306
  const tabContext = activeTabContext(tabId);
23833
24307
  const workflow = gitWorkflowForTab(tabId, { create: false });
@@ -23841,6 +24315,15 @@ async function pushGitWorkflow(tabId = gitWorkflowActionTabId()) {
23841
24315
  setGitWorkflow({ step: "done", busy: false, ...gitWorkflowActionDonePatch(workflow, "push"), output: formatGitCommandResult(result) || "git push finished." }, { tabId });
23842
24316
  if (isCurrentTabContext(tabContext)) scheduleRefreshFooter();
23843
24317
  } catch (error) {
24318
+ if (!isCurrentGitWorkflowRun(runId, tabId)) return;
24319
+ if (error?.code === "NO_REMOTE") {
24320
+ try {
24321
+ if (await publishGitWorkflowRepository(tabId, error)) return;
24322
+ } catch (publishError) {
24323
+ if (isCurrentGitWorkflowRun(runId, tabId)) failGitWorkflow(publishError, "push", { tabId });
24324
+ return;
24325
+ }
24326
+ }
23844
24327
  if (isCurrentGitWorkflowRun(runId, tabId)) failGitWorkflow(error, "push", { tabId });
23845
24328
  }
23846
24329
  }
@@ -27164,7 +27647,7 @@ function jumpToStickyUserPrompt() {
27164
27647
  function renderCompactTranscriptBody(body, message) {
27165
27648
  if (message.role !== "assistant") return false;
27166
27649
  const output = stripTodoProgressLines(textFromContent(message.content));
27167
- const block = appendMarkdown(body, output || "_[non-text output omitted in fast mode]_");
27650
+ const block = appendMarkdown(body, output || "_[non-text output omitted in compact mode]_");
27168
27651
  block.classList.add("compact-transcript-text");
27169
27652
  return true;
27170
27653
  }
@@ -27222,7 +27705,7 @@ function createMessageBubble(message, { streaming = false, messageIndex = -1, tr
27222
27705
  const body = make("div", "message-body");
27223
27706
 
27224
27707
  if (compactTranscript && renderCompactTranscriptBody(body, message)) {
27225
- // Fast mode preserves final Markdown while omitting reconciled tool history.
27708
+ // Compact mode preserves final Markdown while omitting reconciled tool history.
27226
27709
  } else if (message.role === "bashExecution") {
27227
27710
  appendText(body, `$ ${message.command || ""}\n\n${message.output || ""}`, "code-block");
27228
27711
  } else if (message.role === "compactionSummary") {
@@ -28555,6 +29038,7 @@ function updateOptionalFeatureAvailability() {
28555
29038
  optionalFeatureAvailability.tuiToolsCommand = hasLoadedRpcCommand("tools");
28556
29039
  optionalFeatureAvailability.remoteWebui = hasAvailableCommand("remote") || optionalFeatureAvailability.remoteWebui || statusEntries.has("pi-remote-webui") || statusEntries.has(REMOTE_WEBUI_CONTROLS_STATUS_KEY) || widgets.has("pi-remote-webui");
28557
29040
  optionalFeatureAvailability.naturalConversation = NATURAL_CONVERSATION_COMMAND_NAMES.some((name) => hasAvailableCommand(name)) || optionalFeatureAvailability.naturalConversation || statusEntries.has(NATURAL_CONVERSATION_STATUS_KEY) || activeConversationMode().available;
29041
+ optionalFeatureAvailability.codexFastMode = hasAvailableCommand("fast-mode") || optionalFeatureAvailability.codexFastMode || statusEntries.has(CODEX_FAST_MODE_STATUS_KEY) || codexFastModeState.available === true;
28558
29042
  optionalFeatureAvailability.themeBundle = availableThemes.length > 0;
28559
29043
  requestGitFooterWebuiPayload();
28560
29044
  renderOptionalFeatureControls();
@@ -28737,8 +29221,25 @@ function renderOptionalFeatureRow(feature) {
28737
29221
  action.addEventListener("click", () => installOptionalFeature(feature.id, { update: true }));
28738
29222
  } else if (detected) {
28739
29223
  action.textContent = enabled ? "Disable" : "Enable";
28740
- action.addEventListener("click", () => {
29224
+ action.addEventListener("click", async () => {
28741
29225
  const disabled = enabled;
29226
+ // Features that arm a paid or stateful runtime mode must turn that mode off before the
29227
+ // browser stops managing them; a failed turn-off aborts the disable instead of hiding it.
29228
+ if (disabled) {
29229
+ const turnOff = OPTIONAL_FEATURE_DISABLE_PREREQUISITES.get(feature.id);
29230
+ if (turnOff) {
29231
+ action.disabled = true;
29232
+ try {
29233
+ await turnOff();
29234
+ } catch (error) {
29235
+ action.disabled = false;
29236
+ addEvent(`${feature.label} was not disabled: ${error.message || String(error)}. Turn the mode off manually, then retry.`, "error");
29237
+ renderOptionalFeatureControls();
29238
+ return;
29239
+ }
29240
+ action.disabled = false;
29241
+ }
29242
+ }
28742
29243
  setOptionalFeatureDisabled(feature.id, disabled);
28743
29244
  offerUndo({
28744
29245
  message: `${feature.label} was ${disabled ? "disabled" : "enabled"}.`,
@@ -29383,7 +29884,7 @@ async function refreshSidebarOutputMode() {
29383
29884
  sidebarOutputModeMetadata = normalizeWebuiOutputModeMetadata(response.data);
29384
29885
  } catch (error) {
29385
29886
  sidebarOutputModeMetadata = normalizeWebuiOutputModeMetadata();
29386
- sidebarOutputModeDiagnostic = `Fast-mode control unavailable: ${error.message || String(error)}. Using the normal default.`;
29887
+ sidebarOutputModeDiagnostic = `Compact-mode control unavailable: ${error.message || String(error)}. Using the normal default.`;
29387
29888
  } finally {
29388
29889
  sidebarOutputModeLoaded = true;
29389
29890
  renderSidebarOutputModeControl();
@@ -29404,10 +29905,10 @@ async function applySidebarOutputMode() {
29404
29905
  scoped: false,
29405
29906
  });
29406
29907
  await refreshSidebarOutputMode();
29407
- addEvent(outputModeDefault === "compact-v1" ? "Fast output mode enabled for auto-negotiated Web UI connections." : "Normal output processing restored for auto-negotiated Web UI connections.", "info");
29908
+ addEvent(outputModeDefault === "compact-v1" ? "Compact output mode enabled for auto-negotiated Web UI connections." : "Normal output processing restored for auto-negotiated Web UI connections.", "info");
29408
29909
  } catch (error) {
29409
29910
  sidebarOutputModeDiagnostic = "";
29410
- sidebarOutputModeNotice = `Failed to update fast mode: ${error.message || String(error)}. You can retry.`;
29911
+ sidebarOutputModeNotice = `Failed to update compact mode: ${error.message || String(error)}. You can retry.`;
29411
29912
  sidebarOutputModeLoaded = true;
29412
29913
  addEvent(sidebarOutputModeNotice, "error");
29413
29914
  } finally {
@@ -29501,7 +30002,7 @@ async function openNativeSettingsDialog() {
29501
30002
  autocompleteMax: nativeSettingSelect("Autocomplete max items", settings.autocompleteMaxVisible ?? autocompleteMaxVisible, SETTINGS_AUTOCOMPLETE_OPTIONS, "Maximum visible slash/path suggestions.", { label: "browser", tone: "browser" }),
29502
30003
  doubleEscape: nativeSettingSelect("Double-escape action", settings.doubleEscapeAction || doubleEscapeAction, SETTINGS_DOUBLE_ESCAPE_OPTIONS, "Action when pressing Escape twice with an empty composer.", { label: "browser", tone: "browser" }),
29503
30004
  treeFilter: nativeSettingSelect("Tree filter mode", settings.treeFilterMode || treeFilterMode, SETTINGS_TREE_FILTER_OPTIONS, "Default filter when opening /tree.", { label: "browser", tone: "browser" }),
29504
- outputMode: nativeSettingSelect("Output processing", outputModeMetadata.persistedDefault, SETTINGS_OUTPUT_MODE_OPTIONS, "Server default for new and auto-negotiated Web UI connections. Fast 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.", { label: "server", tone: "startup" }),
30005
+ outputMode: nativeSettingSelect("Output processing", outputModeMetadata.persistedDefault, SETTINGS_OUTPUT_MODE_OPTIONS, "Server default for new and auto-negotiated Web UI connections. 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.", { label: "server", tone: "startup" }),
29505
30006
  autoResizeImages: nativeSettingToggle("Auto-resize images", settings.autoResizeImages !== false, "Resize large images to 2000x2000 max for better model compatibility.", { label: "reload", tone: "reload" }),
29506
30007
  blockImages: nativeSettingToggle("Block images", settings.blockImages === true, "Prevent images from being sent to LLM providers.", { label: "reload", tone: "reload" }),
29507
30008
  showImages: nativeSettingToggle("Show terminal images", settings.showImages !== false, "Native TUI inline image rendering preference.", { label: "TUI", tone: "tui" }),
@@ -32850,6 +33351,7 @@ async function refreshAll(tabContext = activeTabContext()) {
32850
33351
  refreshModels(tabContext),
32851
33352
  refreshCommands(tabContext),
32852
33353
  refreshNaturalConversationMode(tabContext),
33354
+ refreshCodexFastMode(tabContext),
32853
33355
  refreshStats(tabContext),
32854
33356
  refreshWorkspace(tabContext),
32855
33357
  refreshFileTreeRoot(tabContext),
@@ -33455,6 +33957,7 @@ function handleExtensionUiRequest(request) {
33455
33957
  if (statusKey === STATS_WEBUI_STATUS_KEY) handleStatsWebuiStatus(request.statusText);
33456
33958
  if (statusKey === BTW_WEBUI_STATUS_KEY) handleBtwWebuiStatus(request.statusText);
33457
33959
  if (statusKey === NATURAL_CONVERSATION_STATUS_KEY) handleNaturalConversationStatus(request.statusText, request.tabId || activeTabId);
33960
+ if (statusKey === CODEX_FAST_MODE_STATUS_KEY && (request.tabId || activeTabId) === activeTabId) applyCodexFastModeStatus(request.statusText);
33458
33961
  if (statusKey === WORKFLOW_MODE_STATUS_KEY) handleWorkflowModeStatus(request.statusText, request.tabId || activeTabId);
33459
33962
  if (statusKey === "pi-remote-webui") handleRemoteWebuiStatus(request.statusText);
33460
33963
  updateOptionalFeatureAvailability();
@@ -34236,6 +34739,7 @@ function handleEvent(event) {
34236
34739
  scheduleRefreshFooter();
34237
34740
  scheduleRefreshCodexUsage(2200);
34238
34741
  scheduleRefreshClaudeUsage(2200);
34742
+ refreshCodexFastMode(tabContext).catch((error) => addEvent(`Codex Fast mode refresh failed: ${error.message || String(error)}`, "warn"));
34239
34743
  renderFeedbackTray();
34240
34744
  {
34241
34745
  const workflowTabId = event.tabId || activeTabId;
@@ -35189,6 +35693,11 @@ elements.fastOutputModeSelect?.addEventListener("change", () => {
35189
35693
  renderSidebarOutputModeControl({ syncSelection: false });
35190
35694
  });
35191
35695
  elements.setFastOutputModeButton?.addEventListener("click", () => applySidebarOutputMode().catch((error) => addEvent(error.message || String(error), "error")));
35696
+ elements.codexFastModeSelect?.addEventListener("change", () => {
35697
+ codexFastModeNotice = "";
35698
+ renderCodexFastModeControl({ syncSelection: false });
35699
+ });
35700
+ elements.setCodexFastModeButton?.addEventListener("click", () => applyCodexFastMode().catch((error) => addEvent(error.message || String(error), "error")));
35192
35701
  if (elements.terminalTabsLayoutSelect) {
35193
35702
  elements.terminalTabsLayoutSelect.addEventListener("change", () => {
35194
35703
  setTerminalTabsLayout(elements.terminalTabsLayoutSelect.value, { announce: true });
@@ -35541,6 +36050,10 @@ window.addEventListener("online", () => scheduleForegroundReconcile("network onl
35541
36050
  window.addEventListener("storage", (event) => {
35542
36051
  if (event.key === OPTIONAL_FEATURES_STORAGE_KEY) reconcileDisabledOptionalFeaturesFromStorage();
35543
36052
  if (event.key === SIDE_PANEL_SECTION_VISIBILITY_STORAGE_KEY) restoreSidePanelSectionVisibility();
36053
+ if (event.key === SIDE_PANEL_WIDTH_STORAGE_KEY) {
36054
+ const width = readStoredSidePanelWidth();
36055
+ if (width && !isSidePanelOverlayView()) applySidePanelWidth(width);
36056
+ }
35544
36057
  });
35545
36058
  window.addEventListener("resize", syncResizablePanelWidthsForViewport, { passive: true });
35546
36059
  window.addEventListener("keydown", (event) => {
@@ -35924,6 +36437,7 @@ focusPromptInput({ defer: true });
35924
36437
  restoreStoredSkillUsage();
35925
36438
  restoreBusyPromptBehaviorSetting();
35926
36439
  updateComposerModeButtons();
36440
+ installSessionSkillTagResizeHandling();
35927
36441
  updateOptionalFeatureAvailability();
35928
36442
  refreshOptionalFeaturePackageStatuses({ announce: true });
35929
36443
  renderAppRunnerControls();
@@ -35961,4 +36475,5 @@ bindSidePanelOverlayViewChanges();
35961
36475
  registerPwaServiceWorker();
35962
36476
  renderServerOfflinePanel();
35963
36477
  refreshSidebarOutputMode().catch((error) => addEvent(error.message || String(error), "error"));
36478
+ refreshCodexFastMode().catch((error) => addEvent(error.message || String(error), "error"));
35964
36479
  initializeTabs().catch((error) => addEvent(error.message, "error"));