@firstpick/pi-package-webui 0.10.0 → 0.10.2

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.
Files changed (49) hide show
  1. package/DEVELOPMENT.md +20 -21
  2. package/README.md +7 -5
  3. package/TECHNICAL.md +6 -2
  4. package/bin/pi-webui.mjs +26 -60
  5. package/index.ts +1 -256
  6. package/package.json +1 -1
  7. package/public/app.js +145 -33
  8. package/public/index.html +10 -7
  9. package/public/service-worker.js +1 -1
  10. package/public/styles.css +51 -7
  11. package/tests/boot-failure-diagnostics.test.mjs +3 -3
  12. package/tests/browser/interaction-continuity.spec.mjs +9 -3
  13. package/tests/codex-fast-mode-static.test.mjs +2 -2
  14. package/tests/composer-action-grid-reorder-static.test.mjs +3 -3
  15. package/tests/control-visibility-static.test.mjs +3 -3
  16. package/tests/controls-layout-static.test.mjs +3 -3
  17. package/tests/events-tree-context-menu-static.test.mjs +3 -3
  18. package/tests/fast-mode-client-static.test.mjs +1 -1
  19. package/tests/feature-decision-output-popup-static.test.mjs +2 -2
  20. package/tests/file-viewer-image-static.test.mjs +3 -3
  21. package/tests/guided-git-activation-static.test.mjs +11 -4
  22. package/tests/guided-git-fallback-runtime.test.mjs +46 -21
  23. package/tests/guided-git-fallback-ui-static.test.mjs +3 -3
  24. package/tests/guided-git-publication-backend-static.test.mjs +10 -5
  25. package/tests/http-endpoints-harness.test.mjs +5 -9
  26. package/tests/intercom-conversation-viewer-static.test.mjs +3 -3
  27. package/tests/main-output-loading-static.test.mjs +18 -12
  28. package/tests/middle-button-drag-scroll-static.test.mjs +3 -3
  29. package/tests/mobile-continuity-tablet-static.test.mjs +3 -3
  30. package/tests/mobile-foundation-static.test.mjs +3 -3
  31. package/tests/mobile-phone-experience-static.test.mjs +1 -1
  32. package/tests/mobile-static.test.mjs +11 -7
  33. package/tests/open-issue-wizard-static.test.mjs +1 -1
  34. package/tests/optional-feature-prompt-impact-static.test.mjs +67 -0
  35. package/tests/persistent-ui-layout-static.test.mjs +3 -3
  36. package/tests/prompt-input-vertical-scroll-static.test.mjs +3 -3
  37. package/tests/questionnaire-dialog.test.mjs +3 -3
  38. package/tests/resource-tui-extension.test.mjs +4 -18
  39. package/tests/session-sampling-ui-static.test.mjs +3 -3
  40. package/tests/side-panel-section-height-removal-static.test.mjs +3 -3
  41. package/tests/streaming-ui-coupling.test.mjs +2 -0
  42. package/tests/subagent-observability-static.test.mjs +2 -2
  43. package/tests/syntax-highlighting-static.test.mjs +3 -3
  44. package/tests/theme-customizer-static.test.mjs +1 -1
  45. package/tests/windows-drive-cwd-picker-static.test.mjs +3 -3
  46. package/lib/tui-model-profile-selector.mjs +0 -183
  47. package/lib/tui-resource-selector.mjs +0 -173
  48. package/tests/tui-model-profile-selector.test.mjs +0 -102
  49. package/tests/tui-resource-selector.test.mjs +0 -74
package/DEVELOPMENT.md CHANGED
@@ -4,19 +4,13 @@ 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
- ## TUI tool and skill selector
7
+ ## Tool and skill command ownership
8
8
 
9
- `index.ts` keeps resource scope resolution and persistence in `registerTuiResourceController`. After the user chooses Session, Global, or Model scope, `lib/tui-resource-selector.mjs` owns the shared searchable list used by both `/tools` and `/skills`. Its interaction follows Pi's `/scoped-models` selector: arrows navigate, Enter toggles, the `app.models.enableAll`, `app.models.clearAll`, and `app.models.save` bindings perform bulk actions and save, and Escape or Ctrl+C cancels. Bulk actions affect only filtered resources while search is active.
10
-
11
- For Model scope, `lib/tui-model-profile-selector.mjs` searches provider, exact ID, and display name. It returns the selected model object directly rather than reconstructing a model from its rendered label. The picker opens at the active model when possible and marks models with a resource-specific profile.
9
+ 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.
12
10
 
13
11
  Focused contributor validation:
14
12
 
15
13
  ```bash
16
- node --check lib/tui-resource-selector.mjs
17
- node --check lib/tui-model-profile-selector.mjs
18
- node tests/tui-resource-selector.test.mjs
19
- node tests/tui-model-profile-selector.test.mjs
20
14
  node tests/resource-tui-extension.test.mjs
21
15
  ```
22
16
 
@@ -51,7 +45,9 @@ node tests/http-endpoints-harness.test.mjs
51
45
 
52
46
  Every `refreshMessages(tabContext)` call acquires its own object token in `mainOutputLoadingRequests` before requesting a transcript snapshot or delta and releases that exact token in `finally`. Visibility is derived only from tokens whose copied tab context still matches the active tab generation. This prevents an old tab response or one of several overlapping refreshes from hiding the current request’s status.
53
47
 
54
- The transcript receives `aria-busy` immediately. The inline `#mainOutputLoading` status waits 120 ms before becoming visible, avoiding flashes on fast local responses while preserving polite assistive-technology state. It is a non-modal, pointer-transparent sibling of `#chat`; cached transcript content remains mounted and interactive. The global reduced-motion policy reduces its spinner to one effectively static iteration. Dedicated subagent output hides this main-transcript status.
48
+ The transcript receives `aria-busy` immediately. The inline `#mainOutputLoading` status waits 120 ms before becoming visible, avoiding flashes on fast local responses while preserving polite assistive-technology state. It shares `.footer-status-host` with `#statusBar` and is positioned absolutely above the footer, so showing it does not resize the transcript. The newest active request supplies the visible label and updates it as the request checks for a delta, falls back to a complete transcript, and renders the result.
49
+
50
+ The status remains non-modal and pointer-transparent. Cached transcript content and controls remain interactive while the overlay is visible. The global reduced-motion policy reduces its spinner to one effectively static iteration. Dedicated subagent output hides this main-transcript status.
55
51
 
56
52
  Focused contributor validation:
57
53
 
@@ -60,7 +56,7 @@ node --check public/app.js
60
56
  node tests/main-output-loading-static.test.mjs
61
57
  ```
62
58
 
63
- The focused test protects DOM/ARIA semantics, tab-generation and overlap ownership, `try`/`finally` cleanup, non-modal styling, reduced motion, Sidebar placement, dedicated-subagent hiding, documentation, and browser/PWA cache revisions.
59
+ The focused test protects DOM/ARIA semantics, plain-language stage labels, tab-generation and overlap ownership, `try`/`finally` cleanup, non-modal styling, reduced motion, placement above the footer in standard and Sidebar layouts, dedicated-subagent hiding, documentation, and browser/PWA cache revisions.
64
60
 
65
61
  ## Fenced code syntax highlighting
66
62
 
@@ -277,7 +273,7 @@ Compact mode keeps live output lightweight, coalesces sustained live DOM/scroll
277
273
  - Optional Natural Conversation Mode shell for the standalone `@firstpick/pi-package-natural-conversation` package: when `/talk` (or `/voice`/`/conversation`) is loaded in the active Pi tab, Web UI shows per-tab Start/End controls, a read-only voice-mode chip, and backend guards that keep thinking `off` while blocking unsafe Web UI actions.
278
274
  - Browser voice loop for Natural Conversation Mode (`public/voice-conversation.mjs`): while the mode is active in a tab, the browser's Web Speech APIs listen for speech, send final transcripts as normal prompts, and speak Pi's final answers. The microphone pauses while answers are spoken (echo prevention), speech during final-output streaming becomes a steering interruption, speech during tool execution is queued until the tool phase ends, and silence after a spoken question sends a single structured silence event. Remote (non-localhost) sessions keep the microphone off until the per-tab `Allow remote microphone streaming` consent is granted; only text transcripts ever reach the Pi host on the browser-default path. Opt-in server-side fallback routes are available for local/Groq/OpenAI STT and local/OpenAI TTS when configured with server-side env vars; remote/LAN raw-audio STT fallback uploads require explicit per-request consent.
279
275
  - Browser-native Pi dialogs for `/model`, `/settings`, `/summary-setup`, `/safety-guard-setup`, `/git-workflow-setup`, `/theme`, `/fork`, `/clone`, `/name`, `/resume`, `/tree`, `/login`, `/logout`, `/scoped-models`, `/tools`, and `/skills`, plus an on-demand `/summary` Markdown overlay and native-command adapter output for `/copy`, `/session`, `/new`, `/compact`, `/reload`, and `/export`. Safety Guard Setup includes the opt-in auto-review toggle and active-tab authenticated model/supported-thinking selectors; auto-review remains off by default, and enabled saves reject unavailable selections.
280
- - Runtime `/tools` and `/skills` selectors backed by the hidden Web UI RPC helper, with explicit **Session only**, **Global default**, and exact **Model default** scopes. Session choices persist on the current branch and take precedence; global defaults are inherited by future sessions without rewriting existing branches. Disabled skills are removed from the system prompt, and tracked `SKILL.md` files can be opened/edited from skill tags. Responsive fitting keeps visible and hidden tag sets disjoint; the `+X` disclosure renders the hidden set in an upward, bounded popup and preserves selection, outside-dismissal, `Escape`, and focus-return behavior.
276
+ - Browser-native tool and skill selectors backed by the hidden Web UI RPC helper, with explicit **Session only**, **Global default**, and exact **Model default** scopes. Session choices persist on the current branch and take precedence; global defaults are inherited by future sessions without rewriting existing branches. Disabled skills are removed from the system prompt, and tracked `SKILL.md` files can be opened/edited from skill tags. Responsive fitting keeps visible and hidden tag sets disjoint; the `+X` disclosure renders the hidden set in an upward, bounded popup and preserves selection, outside-dismissal, `Escape`, and focus-return behavior.
281
277
  - Session resume into a newly created terminal tab, metadata rename, and localhost-only safe delete with active/open-tab/session-directory guards.
282
278
  - Model, thinking, session, workspace, theme, optional-feature, Codex usage, optional Remote WebUI, update/restart/stop, event, notification, thinking-visibility, terminal-tab-layout, and custom-background controls in collapsible side-panel sections.
283
279
  - A side-panel **Git** section mirrors the repositories represented by every open terminal tab/group. Repository cards are shown directly—without session-name parent disclosures—and always use the Git-root or cwd basename as their title. One repository can be expanded at a time. First/stale expansion refreshes local status after a five-minute cache window, while live filesystem updates use a debounced server watcher and SSE invalidation to refresh visible repositories without periodic Git polling or an automatic network `git fetch`. Its compact Changes tree groups conflicted, staged, modified, and untracked paths with additions/deletions; right-click a repository, folder, or file (or press Shift+F10/the Context Menu key) for View Diff, refresh, stage/unstage, and confirmed discard/delete actions. History lists the latest 30 commits and opens bounded read-only commit diffs.
@@ -658,17 +654,17 @@ Product screenshots are maintained in the [user-facing README](README.md#feature
658
654
 
659
655
  ### Tools setup
660
656
 
661
- - **What it is:** Browser and native TUI `/tools` selectors for active and available Pi tools.
657
+ - **What it is:** A browser selector for active and available Pi tools. The standalone tools extension owns the TUI `/tools` command.
662
658
  - **What you can do:** Search or toggle tools, pin the current session branch, save a global default, configure an exact provider/model profile, or return a scope to inherited behavior. A successful model change immediately recomputes unpinned tools.
663
659
 
664
660
  ### Skills setup
665
661
 
666
- - **What it is:** Browser and native TUI `/skills` selectors for skills discovered in the active Pi session.
662
+ - **What it is:** A browser selector for skills discovered in the active Pi session. The standalone skills extension owns the TUI `/skills` command.
667
663
  - **What you can do:** Find skills by name or description, pin the current session branch, save a global default, configure an exact provider/model profile, or return a scope to inherited behavior. A successful model change immediately recomputes unpinned skills while preserving `disableModelInvocation` filtering and explicit disabled-skill blocking.
668
664
 
669
665
  Session-specific tool and skill choices are independent and always win when their branch is resumed or selected in `/tree`. Exact model profiles are keyed by case-sensitive provider/model ID pairs and are stored as an array under settings-envelope version 8. Each profile contains nullable tool and skill selections: `null` inherits, while an empty array explicitly enables none. Legacy branch entries remain explicit pins; version-2 branch entries add `explicit` and `inherit` modes. Global and exact-model defaults are stored in the private Pi Web UI settings file (normally `~/.pi/webui/settings.json`) and do not mutate an explicit current session.
670
666
 
671
- `index.ts` owns resource lifecycle only in TUI mode, while `webui-rpc-helper.mjs` owns it in RPC mode. Both capture or resolve an immutable runtime fallback, recompute on session/tree/model events, and fence asynchronous model changes before applying them. HTTP model-profile writes validate the exact authenticated model and update the latest locked settings snapshot so concurrent writers and temporarily unavailable names are preserved.
667
+ `webui-rpc-helper.mjs` owns the browser session's resource lifecycle in RPC mode. It captures or resolves an immutable runtime fallback, recomputes on session/tree/model events, and fences asynchronous model changes before applying them. HTTP model-profile writes validate the exact authenticated model and update the latest locked settings snapshot so concurrent writers and temporarily unavailable names are preserved.
672
668
 
673
669
  `@firstpick/pi-package-qt-webui` consumes this package as the canonical tool/skill state owner. Its backend imports `webuiSettingsFile()`, `readWebuiSettings()`, `updateWebuiSettings()`, and the resource-selection helpers rather than copying the settings schema or lock protocol. Qt global and exact-model writes therefore merge into the same `resourceDefaults`, and its Pi helper uses the same `webui-tools-config` and `webui-skills-config` version-2 branch entries for session explicit/inherit state. Qt-only sampling remains outside this contract. Each Qt resource-state request reads the latest shared settings; there is no direct process-to-process synchronization.
674
670
 
@@ -676,6 +672,7 @@ Session-specific tool and skill choices are independent and always win when thei
676
672
 
677
673
  - **What it is:** A Pi package manager for Web UI-aware extensions, prompts, themes, and optional dashboards. Optional companions are separate from the Web UI core install.
678
674
  - **What you can do:** See whether each companion is enabled, disabled, registered, local, migratable, missing, conflicting, or updateable; use separate **Enable/Disable** and **Setup** actions for configurable loaded companions; open browser-native Skills Setup and Tools Setup from the loaded TUI command companion rows; keep per-row Install/Update actions; restore previous companions through one combined confirmation; use panel-level **Install all** or section-level **Install missing** for missing/unregistered packages only; and recover partial failures with **Retry failed** or **Copy commands**. Native questionnaires read and update the active session's real `questionnaire` tool state through direct **Enable/Disable** controls and do not expose a separate setup action. Batches run sequentially through Pi, continue after individual failures, and auto-restart an idle affected tab while deferring **Restart tab** when it is busy.
675
+ - **Prompt-impact metadata:** The checked baseline is `reports/pi-default-system-prompt-evaluation.md` at the repository root. `OPTIONAL_FEATURES[].promptImpact` stores the browser indicator class. Package-level bundled skill declarations count as initial prompt text; tool schemas and ordinary user or tool messages stay outside this indicator.
679
676
 
680
677
  ### `/btw` side questions
681
678
 
@@ -755,9 +752,9 @@ Optional companions:
755
752
  - `@firstpick/pi-extension-workflows` — `/workflow` runtime with non-blocking Web UI subprocess-output widgets.
756
753
  - `@firstpick/pi-extension-feature-system-prompt` — feature-request classification and routing, with lightweight/complex decisions shown in the Web UI composer.
757
754
  - `@firstpick/pi-extension-safety-guard` — configurable guardrails for dangerous bash commands and protected file edits, with native `/safety-guard-setup` controls.
758
- - `@firstpick/pi-extension-setup-skills` — TUI `/skills` setup command alongside WebUI-native skill toggles.
755
+ - `@firstpick/pi-extension-setup-skills` — sole owner of the TUI `/skills` setup command; WebUI keeps separate browser-native skill controls.
759
756
  - `@firstpick/pi-extension-todo-progress` — todo-progress rendering.
760
- - `@firstpick/pi-extension-tools` — TUI `/tools` active-tool manager alongside WebUI-native tool toggles.
757
+ - `@firstpick/pi-extension-tools` — sole owner of the TUI `/tools` active-tool manager; WebUI keeps separate browser-native tool controls.
761
758
  - `@firstpick/pi-package-remote-webui` — `/remote` trusted-LAN QR helper plus the optional browser controls for opening/closing LAN access and Remote PIN auth.
762
759
  - `@firstpick/pi-extension-git-footer-status` — richer extension-owned git/footer status, including the structured Web UI footer payload. The Claude Usage panel consumes its live Anthropic response-header snapshot when available and keeps the standalone Claude CLI endpoint as an explicit/fallback refresh path.
763
760
  - `@firstpick/pi-extension-stats` — stats commands and status data.
@@ -788,10 +785,12 @@ For an existing repository, the workflow can:
788
785
  1. Show staged, unstaged, untracked, and fetched incoming changes.
789
786
  2. Fast-forward pull fetched incoming commits when the repository is safely behind.
790
787
  3. Review/select files, preserve a non-empty staged set, or explicitly opt into `git add .`.
791
- 4. Generate `/git-staged-msg` with the configured model, supported reasoning effort, language, and scope policy, then restore the tab's prior model/effort. Each request is correlated to its originating tab and a before-generation snapshot of both message files; the browser advances only when both non-empty files are fresh and stable for that exact generation.
788
+ 4. Generate `/git-staged-msg` with the configured model, supported reasoning effort, language, and scope policy without changing the tab's active model or effort. Each request is correlated to its originating tab and a before-generation snapshot of both message files; the browser advances only when both non-empty files are fresh and stable for that exact generation.
792
789
  5. Use the preferred generated short/long message, a generated single-file default such as `updated file.txt`, or a manual **Commit input** message.
793
790
  6. Show an optional pre-commit verification reminder, then require explicit confirmation before push and PR delivery actions.
794
791
 
792
+ A push with no configured remote returns the validated Git root directory name to the browser. Publication asks only for `public` or `private` visibility and a final confirmation. The server ignores client-supplied repository names, derives the name again from the Git root, and runs `gh repo create <directory-name> --public|--private --source=. --remote=origin --push` from that root. The child process inherits the Web UI server's Git and GitHub CLI environment and configuration. Existing remotes still block this recovery path.
793
+
795
794
  The saved setup includes:
796
795
 
797
796
  - one required primary generation profile reused for commit messages, branch names, and PR descriptions, plus an optional different fallback profile with its own effort;
@@ -800,13 +799,13 @@ The saved setup includes:
800
799
  - ask/current-branch/PR-worktree delivery highlighting; and
801
800
  - optional pre-commit verification reminders.
802
801
 
803
- If a configured model or effort is unavailable, setup saving fails closed. During generation, the server selects the configured profile and invokes the native extension command. The accepted RPC response confirms only that Pi handled the command. The server treats a correlated `extension_error` event as the native command's terminal failure and checks for a fresh correlated artifact only when the command did not report one. If the artifact check fails immediately after the accepted response, the server allows a bounded 500 ms grace period for a separately delivered correlated `extension_error` before reporting the artifact failure. Only the native command's internal direct model/provider-generation failure classification may start the explicitly configured fallback profile once. Invalid generated output, a missing or stale artifact after a command with no reported error, and all non-provider failures remain terminal. It never chooses an unconfigured model. The original tab model and effort are restored after a successful native artifact verification or terminal failure. Request validation, staged-content checks, cancellation, Git failures, and Pi process exit/error do not trigger fallback; a dead Pi process cannot run another attempt. Footer and Guided Git pushes send the active tab's current `HEAD` to the same-named branch on the preferred remote and set that branch as the upstream instead of retaining a potentially mismatched upstream. Guided Git never force-pushes automatically. Git hooks and signing configuration continue to run normally.
802
+ If a configured model or effort is unavailable, setup saving fails closed. During generation, the server encodes the configured profile in a private base64url extension-command argument and invokes the native extension command. The extension validates and resolves that profile, then calls its provider independently without changing the parent tab's active model or reasoning effort. The accepted RPC response confirms only that Pi handled the command. The server treats a correlated `extension_error` event as the native command's terminal failure and checks for a fresh correlated artifact only when the command did not report one. If the artifact check fails immediately after the accepted response, the server allows a bounded 500 ms grace period for a separately delivered correlated `extension_error` before reporting the artifact failure. Only the native command's internal direct model/provider-generation failure classification may start the explicitly configured fallback profile once. Invalid generated output, a missing or stale artifact after a command with no reported error, and all non-provider failures remain terminal. It never chooses an unconfigured model. Request validation, staged-content checks, cancellation, Git failures, and Pi process exit/error do not trigger fallback; a dead Pi process cannot run another attempt. Footer and Guided Git pushes send the active tab's current `HEAD` to the same-named branch on the preferred remote and set that branch as the upstream instead of retaining a potentially mismatched upstream. Guided Git never force-pushes automatically. Git hooks and signing configuration continue to run normally.
804
803
 
805
804
  After the message is generated, **Create PR** invokes the native branch command to generate `dev/COMMIT/staged-branch-name.txt`, lets you confirm or edit the `type/feature-name` branch, then switches with `git switch -c` before committing. In PR mode, choose **Commit short**, **Commit long**, or type a message and use **Commit input**, then **Push and Create PR** pushes the branch, invokes `/pr`, shows the generated `dev/PR/<encodeURIComponent(current-branch)>.md` description for editing/confirmation, and creates the pull request with `gh pr create`. Use **Manual branch** to skip model branch-name generation and type the branch directly.
806
805
 
807
806
  Use the workflow process buttons to jump directly to **Initialize**, **Stage**, **Message**, **Commit**, **Push**, or PR steps when earlier work was already completed manually. Selecting **Message** lets you either run `/git-staged-msg` or type a commit message and use **Commit input** directly. Selecting **Commit** loads the current generated files from `dev/COMMIT/` before enabling the commit choices. Manual preview remains available for existing files, while an active generation uses bounded single-flight polling and the exact server generation ID so duplicate timers and reconnects cannot surface a stale artifact. A yellow dot means that process was selected or is available but its action has not completed in this workflow; green means the process action completed.
808
807
 
809
- All three generation commands come from `@firstpick/pi-extension-git-guided-workflow` and call the active selected model directly. Creating the PR also requires an authenticated GitHub CLI (`gh`). Review the generated commit message, branch name, remote URL, and PR description before committing, pushing, or creating a PR.
808
+ All three generation commands come from `@firstpick/pi-extension-git-guided-workflow`. Direct invocations call the active Pi model; WebUI invocations call the configured Guided Git model independently. Creating the PR also requires an authenticated GitHub CLI (`gh`). Review the generated commit message, branch name, remote URL, and PR description before committing, pushing, or creating a PR.
810
809
 
811
810
  ### Extension activation contract
812
811
 
@@ -840,9 +839,9 @@ npx playwright test --project=chromium tests/browser/guided-git-extension-comman
840
839
 
841
840
  The persisted `generation.fallback` object always contains `provider`, `modelId`, and `thinkingLevel`; an empty provider/model pair disables fallback. The Guided Git setup client sends the nested fallback object on every save, filters the selected primary out of fallback choices, and sends empty provider/model fields when **No fallback** is selected. Server-side validation remains authoritative for availability, profile equality, and supported effort.
842
841
 
843
- `POST /api/git-workflow/generate` keeps `generation` as the effective profile and allocates one server generation ID for commit, branch, or PR text. The server resolves an RPC command with `source: "extension"`, selects the configured profile, sends the exact native slash command, and waits for that synchronous command response. The attempt succeeds only when the command also produces a fresh artifact relative to the captured baseline. If artifact verification fails, a bounded grace period gives the native `extension_error` event precedence when RPC stdout delivers it after the accepted command response. Only the native extension's stable internal direct model/provider-failure classification may start the configured fallback and return `fallbackUsed: true` with `primaryGeneration`; a successful RPC response without either a fresh artifact or correlated native error is terminal. Terminal dispatch errors include bounded correlation metadata.
842
+ `POST /api/git-workflow/generate` keeps `generation` as the effective profile and allocates one server generation ID for commit, branch, or PR text. The server resolves an RPC command with `source: "extension"`, selects the configured profile, encodes it with the public generation arguments in a private base64url command argument, sends the exact native slash command, and waits for that synchronous command response. The server does not send `set_model` or `set_thinking_level` RPC requests. The attempt succeeds only when the command also produces a fresh artifact relative to the captured baseline. If artifact verification fails, a bounded grace period gives the native `extension_error` event precedence when RPC stdout delivers it after the accepted command response. Only the native extension's stable internal direct model/provider-failure classification may start the configured fallback and return `fallbackUsed: true` with `primaryGeneration`; a successful RPC response without either a fresh artifact or correlated native error is terminal. Terminal dispatch errors include bounded correlation metadata.
844
843
 
845
- Fallback lifecycle events start with `webui_git_workflow_generation_fallback_started` and carry the effective `generation`, `primaryGeneration`, `kind`, `tabId`, and `generationId`, plus a curated bounded `reason` or `error`; full provider diagnostics remain server-side. The server retains at most the start and terminal fallback events per tab and replays them on EventSource reconnect. One correlation ID and pre-primary artifact baseline remain authoritative across both attempts. Commit, branch, and PR reads require successful terminal artifact verification, so failed-primary output cannot become ready while fallback runs. The server owns reservation, cancellation state, the two-attempt ceiling, and restoration of the original model/effort after success or terminal failure; the browser observes lifecycle state and never sends a retry. Validation failures, user aborts, Git command failures, and Pi process exit/error remain ordinary failures and never enter fallback dispatch.
844
+ Fallback lifecycle events start with `webui_git_workflow_generation_fallback_started` and carry the effective `generation`, `primaryGeneration`, `kind`, `tabId`, and `generationId`, plus a curated bounded `reason` or `error`; full provider diagnostics remain server-side. The server retains at most the start and terminal fallback events per tab and replays them on EventSource reconnect. One correlation ID and pre-primary artifact baseline remain authoritative across both attempts. Commit, branch, and PR reads require successful terminal artifact verification, so failed-primary output cannot become ready while fallback runs. The server owns reservation, cancellation state, and the two-attempt ceiling; the browser observes lifecycle state and never sends a retry. Primary and fallback requests leave the parent session's active model and effort unchanged. Validation failures, user aborts, Git command failures, and Pi process exit/error remain ordinary failures and never enter fallback dispatch.
846
845
 
847
846
  ## Open Issue bot
848
847
 
package/README.md CHANGED
@@ -65,7 +65,7 @@ Check the server at any time with:
65
65
  5. Open the Control Deck for sessions, Git, app runners, themes, updates, and optional features. Under **Controls → Interface**, choose **Top bar** or **Sidebar** for terminal tabs, then choose **Right**, **Left**, or **Both** for the Control Deck. In **Sidebar**, **Both** is unavailable; choosing **Right** or **Left** swaps the Control Deck and terminal/tabs rails across the chat.
66
66
  6. On desktop, drag the workspace-facing edge of any visible Control Deck—or the terminal/tabs rail in **Sidebar**—to choose a comfortable width. In **Both**, resize the left and right Control Decks independently; widths return on your next visit.
67
67
 
68
- When session history is still loading, the main window shows **Loading agent output…** with a small inline spinner. Existing transcript content and controls remain available; no popup interrupts your work.
68
+ When session history is loading, a small status overlay floats directly above the Git footer without resizing the transcript. It names the current step, such as **Checking for new messages…**, **Loading conversation history…**, or **Preparing your conversation…**. Existing transcript content and controls remain available; no popup interrupts your work.
69
69
 
70
70
  Open **Events** to see bounded tool activity details such as status, duration, a safe target when available, and a shortened call ID. Use **Show** to isolate errors and failures, warnings, tool activity, or rows with **Tree…** available; **All events** restores the full browser-held history. Select a row to jump to its chat card. Right-click any row, or use its keyboard context-menu shortcut, to switch between **Detailed** and **Compact** display. Compact keeps the timestamp and summary while hiding secondary metadata; tool rows retain a colored lifecycle accent. Eligible tool rows also offer **Tree…** to confirm navigation to that exact point in the session; use `/tree` to navigate back. Repeated successful subagent Auto-Clear activity stays in one row whose finished-run count increases.
71
71
 
@@ -162,7 +162,7 @@ For a long scoped-model list, right-click the Git footer **Model** box and choos
162
162
 
163
163
  **Optional feature needed:** None — the browser tools setup is included in Pi Web UI core.
164
164
 
165
- Enable tools for the current session, save a global default, or configure an exact model profile. In Pi's TUI, `/tools` uses the same searchable keyboard workflow as `/scoped-models`: arrow keys move, `Enter` toggles, `Ctrl+A` enables matching entries, `Ctrl+X` clears them, and `Ctrl+S` saves. **Model default** opens a searchable exact-model picker that marks the active model and existing tool profiles without switching the active model. Selecting a configured model automatically applies its tool profile unless the session has its own tool selection.
165
+ Enable tools for the current session, save a global default, or configure an exact model profile. Selecting a configured model automatically applies its tool profile unless the session has its own tool selection. Pi's TUI `/tools` command belongs to the optional `@firstpick/pi-extension-tools` companion and uses the same Session, Global, and Model scopes; WebUI does not register a competing command.
166
166
 
167
167
  #### Skills setup
168
168
 
@@ -170,7 +170,7 @@ Enable tools for the current session, save a global default, or configure an exa
170
170
 
171
171
  **Optional feature needed:** None — the browser skills setup is included in Pi Web UI core.
172
172
 
173
- Find installed skills and manage session, global, or exact-model activation. In Pi's TUI, `/skills` uses the same searchable keyboard workflow as `/scoped-models`, including the exact-model picker used by `/tools`. Selecting a configured model automatically applies its skill profile unless the session has its own skill selection.
173
+ Find installed skills and manage session, global, or exact-model activation. Selecting a configured model automatically applies its skill profile unless the session has its own skill selection. Pi's TUI `/skills` command belongs to the optional `@firstpick/pi-extension-setup-skills` companion and uses the same Session, Global, and Model scopes; WebUI does not register a competing command.
174
174
 
175
175
  ### Project automation and Git
176
176
 
@@ -190,7 +190,9 @@ Launch detected development servers, tests, builds, scripts, and project-defined
190
190
 
191
191
  Run `/git-guided-workflow` in the browser composer or use the **Guided Git workflow** button. The extension starts the workflow in the originating tab without sending a repository path, diff, or Git data in its activation request. Browser generation requires the extension-owned RPC commands and does not fall back to same-named prompt templates.
192
192
 
193
- Move through review, staging, commit-message generation, commit, push, and pull-request steps with explicit confirmations. In **Guided Git Setup**, you can optionally choose a fallback model and its own reasoning effort. If the primary model reaches a final generation failure, Guided Git tries the fallback once, reports the change in the workflow, and restores the tab’s prior model and effort afterward. Large staged diffs use multiple model requests; a fallback attempt sends the complete staged evidence again to the configured fallback provider and can nearly double the request count and cost. Validation failures, cancellation, Git command failures, and a stopped Pi process do not trigger fallback.
193
+ Move through review, staging, commit-message generation, commit, push, and pull-request steps with explicit confirmations. If a repository has no remote, choose **Public** or **Private** from the visibility dropdown and confirm publication. Guided Git uses the local Git root directory name, runs the authenticated system `gh` command, adds `origin`, and pushes the current branch.
194
+
195
+ In **Guided Git Setup**, choose the model and reasoning effort used for generated Git text. Guided Git calls that model independently without changing the parent tab’s active model or effort. You can optionally choose a fallback model and its own reasoning effort; after a final primary generation failure, Guided Git tries the fallback once and reports the change in the workflow. Large staged diffs use multiple model requests; a fallback attempt sends the complete staged evidence again to the configured fallback provider and can nearly double the request count and cost. Validation failures, cancellation, Git command failures, and a stopped Pi process do not trigger fallback.
194
196
 
195
197
  #### Git branch picker
196
198
 
@@ -216,7 +218,7 @@ Inspect staged, unstaged, untracked, and incoming changes before asking Pi to co
216
218
 
217
219
  **Optional feature needed:** None — the package manager panel is included in Pi Web UI core; each listed companion is installed separately.
218
220
 
219
- Install, update, enable, disable, or configure supported companion packages from one panel.
221
+ Install, update, enable, disable, or configure supported companion packages from one panel. Each row shows its system-prompt impact: `+` adds to the initial system prompt, `+...` can add system-prompt text while the session is running, and `-` means no measured system-prompt text.
220
222
 
221
223
  #### `/btw` side questions
222
224
 
package/TECHNICAL.md CHANGED
@@ -117,6 +117,8 @@ Text and image reads remain scoped to the active tab's working directory and its
117
117
 
118
118
  Every server start performs a bounded, read-only startup audit of optional companion packages. Missing, unregistered, or older companions appear in the Optional features panel without blocking the core Web UI. The Guided Git entry installs `@firstpick/pi-extension-git-guided-workflow`, which registers the launcher and native commit-message, branch-name, and pull-request generation commands as one Pi package.
119
119
 
120
+ Prompt-impact indicators distinguish initial system-prompt text (`+`), conditional text that can appear while a session is running (`+...`), and packages with no measured system-prompt text (`-`). Bundled skill declarations count toward the package indicator. Tool schemas and ordinary user or tool messages are not counted.
121
+
120
122
  - **Migrate…** reviews and installs selected legacy companions.
121
123
  - **Later** dismisses the startup reminder while leaving migration available in settings.
122
124
  - **Retry failed** retries only failed package installs.
@@ -192,7 +194,7 @@ The flat-or-advanced choice is a browser-local display preference. It persists a
192
194
 
193
195
  ## Tool and skill scopes
194
196
 
195
- The browser-native tool and skill selectors, and the TUI `/tools` and `/skills` commands, offer **Session only**, **Global default**, and **Model default** scopes. In the TUI resource list, type to search, use the arrow keys to move, press `Enter` to toggle, `Ctrl+A` to enable matching entries, `Ctrl+X` to clear matching entries, and `Ctrl+S` to save. `Escape` cancels; `Ctrl+C` clears a non-empty search before cancelling. These shortcuts match `/scoped-models`, including custom Pi bindings for the shared model-selection actions. **Model default** uses a separate searchable provider, ID, and display-name picker. It opens at the active model when available, marks existing profiles, and returns the exact provider/model pair without changing the active model. Tools and skills resolve independently: a session choice wins over an exact case-sensitive provider/model profile, which wins over the global default and then Pi's runtime default.
197
+ The browser-native tool and skill selectors offer **Session only**, **Global default**, and **Model default** scopes. The extension-owned TUI `/tools` and `/skills` commands use the same scopes and saved state. Tools and skills resolve independently: a session choice wins over an exact case-sensitive provider/model profile, which wins over the global default and then Pi's runtime default. WebUI does not register either TUI command; they belong to `@firstpick/pi-extension-tools` and `@firstpick/pi-extension-setup-skills`.
196
198
 
197
199
  After Pi successfully selects a model, its exact tool and skill profiles apply immediately for resource types that are not pinned by the current session; no reload or selector reopening is needed. A model with no profile falls back through the global and runtime defaults. Choosing a model inside a profile editor selects the profile to edit—it does not switch the active Pi model.
198
200
 
@@ -321,13 +323,15 @@ Install `@firstpick/pi-extension-git-guided-workflow` to make `/git-guided-workf
321
323
 
322
324
  Browser generation accepts only RPC-capable extension provenance for `/git-staged-msg`, `/git-branch-name`, and `/pr`. A separately installed same-named prompt template is not a fallback for the native path.
323
325
 
326
+ Publishing a repository with no remote requires GitHub CLI (`gh`) to be installed and authenticated. Guided Git derives the GitHub repository name from the local Git root directory, asks you to choose **Public** or **Private** from a dropdown, then shows a final confirmation before it creates the repository, adds `origin`, and pushes. No visibility is preselected. The command uses your system Git and GitHub CLI configuration.
327
+
324
328
  The launcher refuses immediately while the originating tab is running, compacting context, or has pending messages; it does not queue Guided Git for later. If the command does not open the workflow, confirm that the tab is idle, has no queued messages, and lists `/git-guided-workflow`, `/git-staged-msg`, `/git-branch-name`, and `/pr` as extension commands. Restart or reload the Pi tab after installing or updating the extension. Retrying after an uncertain activation is a manual decision; WebUI does not retry it automatically.
325
329
 
326
330
  ## Guided Git generation profiles
327
331
 
328
332
  Open **Common Pi Options → Guided Git Setup** or run `/git-workflow-setup` before using generated commit messages, branch names, or pull-request text. Choose the required primary model and its reasoning effort. You may also choose a different fallback model and a separate supported effort, or leave **No fallback** selected. The effort lists follow the capabilities reported for each selected model. Before enabling fallback, account for its privacy and cost impact: large commit diffs use multiple model requests, and a fallback attempt sends the complete staged evidence again to the configured fallback provider.
329
333
 
330
- A configured fallback is a strict one-retry policy: Guided Git lets Pi finish the primary model’s own retry lifecycle, then makes at most one fallback attempt after a final primary model-generation failure. The workflow output identifies the primary and configured fallback at startup and reports when generation continues with the fallback. For a commit diff at the extension’s 16 MiB ceiling, one attempt can use up to 35 requests; chunk-summary formatting does not trigger retries. Fallback can repeat the full attempt, for up to 70 requests across both providers. Fallback status is restored when you return to the tab or its live event connection reconnects. Generated commit, branch, or PR text is treated as ready only after the correlated attempt finishes successfully. After successful generation or terminal failure, the tab’s model and reasoning effort are restored to the values it had before Guided Git generation began.
334
+ A configured fallback is a strict one-retry policy: Guided Git lets the primary model finish its own retry lifecycle, then makes at most one fallback attempt after a final primary model-generation failure. The workflow output identifies the primary and configured fallback at startup and reports when generation continues with the fallback. For a commit diff at the extension’s 16 MiB ceiling, one attempt can use up to 35 requests; chunk-summary formatting does not trigger retries. Fallback can repeat the full attempt, for up to 70 requests across both providers. Fallback status is restored when you return to the tab or its live event connection reconnects. Generated commit, branch, or PR text is treated as ready only after the correlated attempt finishes successfully. Primary and fallback requests run independently of the parent Pi session, whose active model and reasoning effort remain unchanged throughout.
331
335
 
332
336
  Fallback applies only to model generation. Request validation failures, staged-content checks, busy-state rejection, user cancellation, Git command failures, and a stopped or failed Pi process do not trigger it. A dead Pi process cannot run the fallback; restart or reload the tab and start a new generation request after addressing the failure.
333
337
 
package/bin/pi-webui.mjs CHANGED
@@ -3124,14 +3124,25 @@ async function triggerSessionSummary(tab, { refresh = false } = {}) {
3124
3124
  }
3125
3125
  }
3126
3126
 
3127
- function gitWorkflowGenerationPrompt(kind, preferences, commandName) {
3127
+ function gitWorkflowGenerationProfileArgument(profile) {
3128
+ const payload = Buffer.from(JSON.stringify({
3129
+ version: 1,
3130
+ provider: profile.provider,
3131
+ modelId: profile.modelId,
3132
+ thinkingLevel: profile.thinkingLevel,
3133
+ }), "utf8").toString("base64url");
3134
+ return `--firstpick-webui-generation-profile=${payload}`;
3135
+ }
3136
+
3137
+ function gitWorkflowGenerationPrompt(kind, preferences, commandName, profile) {
3138
+ const generationProfile = gitWorkflowGenerationProfileArgument(profile);
3128
3139
  switch (kind) {
3129
3140
  case "commit":
3130
- return `/${commandName} ${preferences.commit.language} ${preferences.commit.scope}`;
3141
+ return `/${commandName} ${preferences.commit.language} ${preferences.commit.scope} ${generationProfile}`;
3131
3142
  case "branch":
3132
- return `/${commandName}`;
3143
+ return `/${commandName} ${generationProfile}`;
3133
3144
  case "pr":
3134
- return `/${commandName} ${preferences.commit.language}`;
3145
+ return `/${commandName} ${preferences.commit.language} ${generationProfile}`;
3135
3146
  default:
3136
3147
  throw makeHttpError(400, "generation kind must be commit, branch, or pr");
3137
3148
  }
@@ -3212,37 +3223,6 @@ function publicGitWorkflowGenerationProfile(profile) {
3212
3223
  };
3213
3224
  }
3214
3225
 
3215
- async function restoreGitWorkflowGenerationProfile(tab, expectedRecord = tab?.gitWorkflowGeneration) {
3216
- const record = expectedRecord && tab?.gitWorkflowGeneration === expectedRecord ? expectedRecord : null;
3217
- const restore = record?.restore || tab?.gitWorkflowGenerationRestore;
3218
- if (!restore) return;
3219
- if (record?.restorePromise) return record.restorePromise;
3220
- const operation = (async () => {
3221
- try {
3222
- if (!tab.rpc?.isRunning?.()) return;
3223
- if (restore.model?.provider && restore.model?.id) {
3224
- const modelResponse = await tab.rpc.send({ type: "set_model", provider: restore.model.provider, modelId: restore.model.id });
3225
- if (modelResponse.success === false) throw new Error(modelResponse.error || "Failed to restore model");
3226
- }
3227
- if (restore.thinkingLevel) {
3228
- const thinkingResponse = await setThinkingLevelForTab(tab, restore.thinkingLevel, { allowPending: false });
3229
- if (thinkingResponse.success === false) throw new Error(thinkingResponse.error || "Failed to restore thinking level");
3230
- }
3231
- recordEvent({ type: "git_workflow_generation_profile_restored", tabId: tab.id, tabTitle: tab.title });
3232
- } catch (error) {
3233
- console.error(`[guided-git] failed to restore generation profile for ${record?.generationId || tab.id}: ${sanitizeError(error)}`);
3234
- recordEvent({ type: "git_workflow_generation_profile_restore_failed", tabId: tab.id, tabTitle: tab.title, error: boundedGitWorkflowGenerationError("Guided Git could not restore the previous model profile.") });
3235
- } finally {
3236
- if (!record || tab.gitWorkflowGeneration === record) {
3237
- tab.gitWorkflowGeneration = null;
3238
- tab.gitWorkflowGenerationRestore = null;
3239
- }
3240
- }
3241
- })();
3242
- if (record) record.restorePromise = operation;
3243
- return operation;
3244
- }
3245
-
3246
3226
  async function createGitWorkflowArtifactGeneration(tab, generationId, kind) {
3247
3227
  const createdAt = Date.now();
3248
3228
  if (kind === "commit") {
@@ -3325,7 +3305,7 @@ async function finishGitWorkflowGeneration(tab, record, { successful }) {
3325
3305
  tab.gitWorkflowMessageGeneration = record.previousMessageGeneration;
3326
3306
  }
3327
3307
  markTabIdle(tab);
3328
- await restoreGitWorkflowGenerationProfile(tab, record);
3308
+ if (tab.gitWorkflowGeneration === record) tab.gitWorkflowGeneration = null;
3329
3309
  }
3330
3310
 
3331
3311
  async function dispatchGitWorkflowGenerationAttempt(tab, record, profile, attempt) {
@@ -3341,15 +3321,7 @@ async function dispatchGitWorkflowGenerationAttempt(tab, record, profile, attemp
3341
3321
  record.promptAccepted = false;
3342
3322
  record.pendingSettlement = null;
3343
3323
  record.nativeCommandError = null;
3344
- if (record.currentModelKey !== `${profile.provider}/${profile.modelId}`) {
3345
- const modelResponse = await tab.rpc.send({ type: "set_model", provider: profile.provider, modelId: profile.modelId });
3346
- assertGitWorkflowGenerationOwnership(tab, record);
3347
- if (modelResponse.success === false) throw new Error(modelResponse.error || `Failed to select ${profile.provider}/${profile.modelId}`);
3348
- record.currentModelKey = `${profile.provider}/${profile.modelId}`;
3349
- }
3350
- const thinkingResponse = await setThinkingLevelForTab(tab, profile.thinkingLevel, { allowPending: false });
3351
- assertGitWorkflowGenerationOwnership(tab, record);
3352
- if (thinkingResponse.success === false) throw new Error(thinkingResponse.error || `Failed to select thinking level ${profile.thinkingLevel}`);
3324
+ record.message = gitWorkflowGenerationPrompt(record.kind, record.preferences, record.nativeCommandName, profile);
3353
3325
 
3354
3326
  assertGitWorkflowGenerationOwnership(tab, record);
3355
3327
  markTabWorking(tab);
@@ -3452,7 +3424,7 @@ function consumeGitWorkflowGenerationEvent(tab, event, { finalError = false } =
3452
3424
  }
3453
3425
 
3454
3426
  async function startGitWorkflowGeneration(tab, body = {}) {
3455
- if (tab.gitWorkflowGeneration || tab.gitWorkflowGenerationRestore) throw makeHttpError(409, "A guided Git generation request is already active in this tab");
3427
+ if (tab.gitWorkflowGeneration) throw makeHttpError(409, "A guided Git generation request is already active in this tab");
3456
3428
  const kind = String(body.kind || "").trim();
3457
3429
  if (!new Set(["commit", "branch", "pr"]).has(kind)) throw makeHttpError(400, "generation kind must be commit, branch, or pr");
3458
3430
 
@@ -3462,7 +3434,7 @@ async function startGitWorkflowGeneration(tab, body = {}) {
3462
3434
  generationId: randomUUID(),
3463
3435
  kind,
3464
3436
  message: "",
3465
- restore: null,
3437
+ preferences: null,
3466
3438
  previousMessageGeneration: tab.gitWorkflowMessageGeneration || null,
3467
3439
  messageGeneration: null,
3468
3440
  artifactGeneration: null,
@@ -3475,7 +3447,6 @@ async function startGitWorkflowGeneration(tab, body = {}) {
3475
3447
  attemptRunStarted: false,
3476
3448
  promptAccepted: false,
3477
3449
  pendingSettlement: null,
3478
- currentModelKey: "",
3479
3450
  nativeCommandName: "",
3480
3451
  nativeCommandError: null,
3481
3452
  nativeGeneration: true,
@@ -3491,10 +3462,10 @@ async function startGitWorkflowGeneration(tab, body = {}) {
3491
3462
  const preferences = await readGitWorkflowPreferences();
3492
3463
  assertGitWorkflowGenerationOwnership(tab, record);
3493
3464
  if (!isGitWorkflowSetupComplete(preferences)) throw makeHttpError(409, "Run /git-workflow-setup or open Guided Git Setup before generating Git text");
3465
+ record.preferences = preferences;
3494
3466
  const nativeCommandName = await resolveGuidedGitNativeCommand(tab, kind);
3495
3467
  assertGitWorkflowGenerationOwnership(tab, record);
3496
3468
  record.nativeCommandName = nativeCommandName;
3497
- record.message = gitWorkflowGenerationPrompt(kind, preferences, nativeCommandName);
3498
3469
 
3499
3470
  const state = await currentSessionState(tab);
3500
3471
  assertGitWorkflowGenerationOwnership(tab, record);
@@ -3520,9 +3491,6 @@ async function startGitWorkflowGeneration(tab, body = {}) {
3520
3491
  )
3521
3492
  : null;
3522
3493
 
3523
- record.restore = { model: state.model || null, thinkingLevel: state.thinkingLevel || "off" };
3524
- record.currentModelKey = gitWorkflowModelKey(state.model);
3525
- tab.gitWorkflowGenerationRestore = record.restore;
3526
3494
  record.artifactGeneration = await createGitWorkflowArtifactGeneration(tab, record.generationId, kind);
3527
3495
  record.messageGeneration = kind === "commit" ? record.artifactGeneration : null;
3528
3496
  assertGitWorkflowGenerationOwnership(tab, record);
@@ -3546,8 +3514,7 @@ async function startGitWorkflowGeneration(tab, body = {}) {
3546
3514
  }
3547
3515
  } catch (error) {
3548
3516
  if (tab.gitWorkflowGeneration === record && !record.finishing) {
3549
- if (record.restore) await finishGitWorkflowGeneration(tab, record, { successful: false });
3550
- else tab.gitWorkflowGeneration = null;
3517
+ await finishGitWorkflowGeneration(tab, record, { successful: false });
3551
3518
  }
3552
3519
  throw error;
3553
3520
  }
@@ -8736,7 +8703,7 @@ function applyGitHubPublicationFailure(payload) {
8736
8703
  payload.code = "AUTH";
8737
8704
  payload.hint = "GitHub CLI is not authenticated. Run 'gh auth login' in a terminal, then retry.";
8738
8705
  } else if (/name already exists on this account|repository .+ already exists/.test(text)) {
8739
- payload.hint = "A GitHub repository with this name already exists for the authenticated account. Choose another repository name and retry.";
8706
+ payload.hint = "A GitHub repository with this directory name already exists for the authenticated account. Add that repository as a remote, or rename the local directory before retrying.";
8740
8707
  }
8741
8708
  return payload;
8742
8709
  }
@@ -8887,21 +8854,22 @@ async function handleGitWorkflowRequest(pathname, body = {}, tabOrCwd = options.
8887
8854
  payload.data.protectedBranch = protectedBranch;
8888
8855
  payload.data.forceWithLease = forceWithLease;
8889
8856
  if (remote) payload.data.remote = remote;
8857
+ else payload.data.repoName = path.basename(root);
8890
8858
  }
8891
8859
  return applyGitSyncFailure(payload, { push: true });
8892
8860
  }
8893
8861
  case "/api/git-workflow/publish": {
8894
- const repoName = cleanGitHubRepoName(body.repoName);
8862
+ const root = await getGitRoot(cwd);
8863
+ const repoName = cleanGitHubRepoName(path.basename(root));
8895
8864
  const visibility = String(body.visibility || "").trim();
8896
8865
  if (visibility !== "public" && visibility !== "private") throw makeHttpError(400, "visibility must be 'public' or 'private'");
8897
8866
  requireConfirmed(body, `Publishing GitHub repository ${repoName} as ${visibility}`);
8898
- const root = await getGitRoot(cwd);
8899
8867
  const remotes = await gitRemoteNames(root);
8900
8868
  if (remotes.length) throw makeHttpError(409, "GitHub publication requires a repository with no configured remotes. Existing remotes are not changed or repaired.");
8901
8869
  const branch = await currentGitBranch(root);
8902
8870
  const protectedBranch = PROTECTED_GIT_BRANCHES.has(branch);
8903
8871
  const payload = applyGitHubPublicationFailure(gitWorkflowCommandPayload(await runGitHubWorkflowCommand(
8904
- ["repo", "create", repoName, `--${visibility}`, "--source", root, "--remote", "origin", "--push"],
8872
+ ["repo", "create", repoName, `--${visibility}`, "--source", ".", "--remote", "origin", "--push"],
8905
8873
  { cwd: root, timeoutMs: 15 * 60 * 1000 },
8906
8874
  )));
8907
8875
  if (payload.ok) Object.assign(payload.data, { repoName, visibility, remote: "origin", branch, protectedBranch });
@@ -11523,7 +11491,6 @@ function attachRpcToTab(tab, rpc) {
11523
11491
  tab.gitWorkflowArtifactGeneration.successful = false;
11524
11492
  }
11525
11493
  tab.gitWorkflowGeneration = null;
11526
- tab.gitWorkflowGenerationRestore = null;
11527
11494
  tab.gitWorkflowMessageGeneration = null;
11528
11495
  clearPendingExtensionUiRequests(tab);
11529
11496
  clearExtensionStatuses(tab);
@@ -11562,7 +11529,6 @@ function createTabRecord({ id, index, title, titleSource, conversationStarted, c
11562
11529
  pendingThinkingLevel: undefined,
11563
11530
  thinkingStreamRecovery: new ThinkingStreamRecovery(),
11564
11531
  gitWorkflowGeneration: null,
11565
- gitWorkflowGenerationRestore: null,
11566
11532
  gitWorkflowMessageGeneration: null,
11567
11533
  gitWorkflowArtifactGeneration: null,
11568
11534
  gitWorkflowFallbackLifecycle: null,