@firstpick/pi-package-webui 0.9.9 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/DEVELOPMENT.md +49 -15
  2. package/README.md +11 -9
  3. package/TECHNICAL.md +12 -8
  4. package/bin/pi-webui.mjs +202 -67
  5. package/index.ts +23 -33
  6. package/lib/git-workflow-preferences.mjs +51 -12
  7. package/lib/tui-model-profile-selector.mjs +183 -0
  8. package/lib/tui-resource-selector.mjs +173 -0
  9. package/package.json +1 -1
  10. package/public/app.js +365 -106
  11. package/public/index.html +10 -7
  12. package/public/service-worker.js +1 -1
  13. package/public/styles.css +114 -22
  14. package/tests/boot-failure-diagnostics.test.mjs +3 -3
  15. package/tests/browser/interaction-continuity.spec.mjs +9 -3
  16. package/tests/browser/intercom-conversation-viewer.spec.mjs +76 -53
  17. package/tests/browser/user-noticeable-fixes.spec.mjs +51 -0
  18. package/tests/codex-fast-mode-static.test.mjs +2 -2
  19. package/tests/composer-action-grid-reorder-static.test.mjs +3 -3
  20. package/tests/control-visibility-static.test.mjs +3 -3
  21. package/tests/controls-layout-static.test.mjs +3 -3
  22. package/tests/durable-rpc-supervisor-harness.test.mjs +9 -0
  23. package/tests/events-tree-context-menu-static.test.mjs +3 -3
  24. package/tests/fast-mode-client-static.test.mjs +1 -1
  25. package/tests/feature-decision-output-popup-static.test.mjs +2 -2
  26. package/tests/file-viewer-image-static.test.mjs +3 -3
  27. package/tests/fixtures/fake-pi.mjs +3 -3
  28. package/tests/guided-git-activation-static.test.mjs +24 -12
  29. package/tests/guided-git-fallback-runtime.test.mjs +209 -270
  30. package/tests/guided-git-fallback-ui-static.test.mjs +2 -2
  31. package/tests/guided-git-message-reliability-static.test.mjs +2 -1
  32. package/tests/guided-git-optional-feature.test.mjs +8 -5
  33. package/tests/guided-git-publication-backend-static.test.mjs +10 -5
  34. package/tests/http-endpoints-harness.test.mjs +27 -13
  35. package/tests/intercom-conversation-viewer-static.test.mjs +7 -6
  36. package/tests/intercom-tag-layout-static.test.mjs +35 -16
  37. package/tests/intercom-tag-overflow-layout.test.mjs +87 -0
  38. package/tests/main-output-loading-static.test.mjs +18 -12
  39. package/tests/middle-button-drag-scroll-static.test.mjs +3 -3
  40. package/tests/mobile-continuity-tablet-static.test.mjs +3 -3
  41. package/tests/mobile-foundation-static.test.mjs +3 -3
  42. package/tests/mobile-phone-experience-static.test.mjs +1 -1
  43. package/tests/mobile-static.test.mjs +19 -11
  44. package/tests/open-issue-wizard-static.test.mjs +1 -1
  45. package/tests/optional-feature-prompt-impact-static.test.mjs +67 -0
  46. package/tests/persistent-ui-layout-static.test.mjs +3 -3
  47. package/tests/prompt-input-vertical-scroll-static.test.mjs +3 -3
  48. package/tests/questionnaire-dialog.test.mjs +3 -3
  49. package/tests/remote-auth-settings-harness.test.mjs +18 -3
  50. package/tests/resource-tui-extension.test.mjs +2 -1
  51. package/tests/session-sampling-ui-static.test.mjs +3 -3
  52. package/tests/side-panel-section-height-removal-static.test.mjs +3 -3
  53. package/tests/streaming-ui-coupling.test.mjs +2 -0
  54. package/tests/subagent-observability-static.test.mjs +2 -2
  55. package/tests/syntax-highlighting-static.test.mjs +3 -3
  56. package/tests/theme-customizer-static.test.mjs +1 -1
  57. package/tests/tui-model-profile-selector.test.mjs +102 -0
  58. package/tests/tui-resource-selector.test.mjs +74 -0
  59. package/tests/webui-settings-locking.test.mjs +32 -1
  60. package/tests/windows-drive-cwd-picker-static.test.mjs +3 -3
package/public/app.js CHANGED
@@ -101,6 +101,7 @@ const elements = {
101
101
  stickyUserPromptButton: $("#stickyUserPromptButton"),
102
102
  chat: $("#chat"),
103
103
  mainOutputLoading: $("#mainOutputLoading"),
104
+ mainOutputLoadingLabel: $("#mainOutputLoadingLabel"),
104
105
  runIndicatorHost: $("#runIndicatorHost"),
105
106
  chatSearchBar: $("#chatSearchBar"),
106
107
  chatSearchInput: $("#chatSearchInput"),
@@ -477,6 +478,7 @@ const elements = {
477
478
  textPromptTitle: $("#textPromptTitle"),
478
479
  textPromptSummary: $("#textPromptSummary"),
479
480
  textPromptInput: $("#textPromptInput"),
481
+ textPromptSelect: $("#textPromptSelect"),
480
482
  textPromptError: $("#textPromptError"),
481
483
  textPromptCancelButton: $("#textPromptCancelButton"),
482
484
  textPromptConfirmButton: $("#textPromptConfirmButton"),
@@ -2804,6 +2806,7 @@ const APP_RUNNER_SEARCH_PATH_LIMIT = 24;
2804
2806
  const OPTIONAL_FEATURES = [
2805
2807
  {
2806
2808
  id: "bangCommandAutocomplete",
2809
+ promptImpact: "none",
2807
2810
  label: "! command autocomplete",
2808
2811
  packageName: "@firstpick/pi-extension-bang-command-autocomplete",
2809
2812
  capabilityLabel: "/bang-status or /bang-refresh",
@@ -2811,6 +2814,7 @@ const OPTIONAL_FEATURES = [
2811
2814
  },
2812
2815
  {
2813
2816
  id: "fishUserBash",
2817
+ promptImpact: "none",
2814
2818
  label: "Fish user bash",
2815
2819
  packageName: "@firstpick/pi-extension-fish-user-bash",
2816
2820
  capabilityLabel: "/user-bash-shell",
@@ -2818,6 +2822,7 @@ const OPTIONAL_FEATURES = [
2818
2822
  },
2819
2823
  {
2820
2824
  id: "btwCommand",
2825
+ promptImpact: "none",
2821
2826
  label: "/btw side questions",
2822
2827
  packageName: "@firstpick/pi-extension-btw",
2823
2828
  capabilityLabel: "/btw or btw:output widget event",
@@ -2825,14 +2830,16 @@ const OPTIONAL_FEATURES = [
2825
2830
  },
2826
2831
  {
2827
2832
  id: "gitWorkflow",
2833
+ promptImpact: "none",
2828
2834
  label: "Guided Git workflow",
2829
2835
  packageName: "@firstpick/pi-extension-git-guided-workflow",
2830
2836
  capabilityLabel: "/git-guided-workflow",
2831
- description: "Cross-surface launcher with bundled commit, branch, and pull-request prompt templates.",
2837
+ description: "Cross-surface workflow with native commit, branch, and pull-request generation commands.",
2832
2838
  setup: "git-workflow",
2833
2839
  },
2834
2840
  {
2835
2841
  id: "releaseNpm",
2842
+ promptImpact: "none",
2836
2843
  label: "NPM Release",
2837
2844
  packageName: "@firstpick/pi-extension-release-npm",
2838
2845
  capabilityLabel: "/release-npm",
@@ -2840,6 +2847,7 @@ const OPTIONAL_FEATURES = [
2840
2847
  },
2841
2848
  {
2842
2849
  id: "releaseAur",
2850
+ promptImpact: "initial",
2843
2851
  label: "AUR Release",
2844
2852
  packageName: "@firstpick/pi-extension-release-aur",
2845
2853
  capabilityLabel: "/release-aur",
@@ -2847,6 +2855,7 @@ const OPTIONAL_FEATURES = [
2847
2855
  },
2848
2856
  {
2849
2857
  id: "aurReview",
2858
+ promptImpact: "none",
2850
2859
  label: "Manual repository review",
2851
2860
  packageName: "@firstpick/pi-extension-aur-review",
2852
2861
  capabilityLabel: "/aur-review or aur-review:rpc widget event",
@@ -2854,6 +2863,7 @@ const OPTIONAL_FEATURES = [
2854
2863
  },
2855
2864
  {
2856
2865
  id: "workflows",
2866
+ promptImpact: "initial",
2857
2867
  label: "Workflows",
2858
2868
  packageName: "@firstpick/pi-extension-workflows",
2859
2869
  capabilityLabel: "/workflow or workflow subprocess widget event",
@@ -2862,6 +2872,7 @@ const OPTIONAL_FEATURES = [
2862
2872
  },
2863
2873
  {
2864
2874
  id: "featureSystemPrompt",
2875
+ promptImpact: "conditional",
2865
2876
  label: "Feature workflow routing",
2866
2877
  packageName: "@firstpick/pi-extension-feature-system-prompt",
2867
2878
  capabilityLabel: "feature-category or feature-decision-output status event",
@@ -2869,6 +2880,7 @@ const OPTIONAL_FEATURES = [
2869
2880
  },
2870
2881
  {
2871
2882
  id: "safetyGuard",
2883
+ promptImpact: "none",
2872
2884
  label: "Safety guard",
2873
2885
  packageName: "@firstpick/pi-extension-safety-guard",
2874
2886
  capabilityLabel: "/safety-guard or /safety-guard-setup command",
@@ -2877,6 +2889,7 @@ const OPTIONAL_FEATURES = [
2877
2889
  },
2878
2890
  {
2879
2891
  id: "tuiSkillsCommand",
2892
+ promptImpact: "none",
2880
2893
  label: "TUI Skills command",
2881
2894
  packageName: "@firstpick/pi-extension-setup-skills",
2882
2895
  capabilityLabel: "RPC /skills from setup-skills extension",
@@ -2885,6 +2898,7 @@ const OPTIONAL_FEATURES = [
2885
2898
  },
2886
2899
  {
2887
2900
  id: "todoProgressWidget",
2901
+ promptImpact: "initial",
2888
2902
  label: "Todo progress widget",
2889
2903
  packageName: "@firstpick/pi-extension-todo-progress",
2890
2904
  capabilityLabel: "/todo-progress-status or todo-progress widget event",
@@ -2892,6 +2906,7 @@ const OPTIONAL_FEATURES = [
2892
2906
  },
2893
2907
  {
2894
2908
  id: "tuiToolsCommand",
2909
+ promptImpact: "none",
2895
2910
  label: "TUI Tools command",
2896
2911
  packageName: "@firstpick/pi-extension-tools",
2897
2912
  capabilityLabel: "RPC /tools from tools extension",
@@ -2900,6 +2915,7 @@ const OPTIONAL_FEATURES = [
2900
2915
  },
2901
2916
  {
2902
2917
  id: "remoteWebui",
2918
+ promptImpact: "none",
2903
2919
  label: "Remote WebUI",
2904
2920
  packageName: "@firstpick/pi-package-remote-webui",
2905
2921
  capabilityLabel: "/remote",
@@ -2907,6 +2923,7 @@ const OPTIONAL_FEATURES = [
2907
2923
  },
2908
2924
  {
2909
2925
  id: "questionnaire",
2926
+ promptImpact: "initial",
2910
2927
  label: "Native questionnaires",
2911
2928
  packageName: "@firstpick/pi-package-questionnaire",
2912
2929
  capabilityLabel: "questionnaire tool in /tools",
@@ -2915,6 +2932,7 @@ const OPTIONAL_FEATURES = [
2915
2932
  },
2916
2933
  {
2917
2934
  id: "naturalConversation",
2935
+ promptImpact: "conditional",
2918
2936
  label: "Natural Conversation",
2919
2937
  packageName: "@firstpick/pi-package-natural-conversation",
2920
2938
  capabilityLabel: "/talk, /voice, or /conversation",
@@ -2922,6 +2940,7 @@ const OPTIONAL_FEATURES = [
2922
2940
  },
2923
2941
  {
2924
2942
  id: "gitFooterStatus",
2943
+ promptImpact: "none",
2925
2944
  label: "Git footer status",
2926
2945
  packageName: "@firstpick/pi-extension-git-footer-status",
2927
2946
  capabilityLabel: "/git-footer-refresh or git-footer-webui status event",
@@ -2929,6 +2948,7 @@ const OPTIONAL_FEATURES = [
2929
2948
  },
2930
2949
  {
2931
2950
  id: "statsCommand",
2951
+ promptImpact: "none",
2932
2952
  label: "Stats dashboard",
2933
2953
  packageName: "@firstpick/pi-extension-stats",
2934
2954
  capabilityLabel: "/stats",
@@ -2936,6 +2956,7 @@ const OPTIONAL_FEATURES = [
2936
2956
  },
2937
2957
  {
2938
2958
  id: "codexFastMode",
2959
+ promptImpact: "none",
2939
2960
  label: "Codex Fast mode",
2940
2961
  packageName: "@firstpick/pi-extension-codex-fast-mode",
2941
2962
  capabilityLabel: "/fast-mode",
@@ -2943,12 +2964,18 @@ const OPTIONAL_FEATURES = [
2943
2964
  },
2944
2965
  {
2945
2966
  id: "themeBundle",
2967
+ promptImpact: "none",
2946
2968
  label: "Theme bundle",
2947
2969
  packageName: "@firstpick/pi-themes-bundle",
2948
2970
  capabilityLabel: "/api/themes returned themes",
2949
2971
  description: "Additional browser theme-picker and Pi theme resources.",
2950
2972
  },
2951
2973
  ];
2974
+ const OPTIONAL_FEATURE_PROMPT_IMPACTS = Object.freeze({
2975
+ initial: Object.freeze({ symbol: "+", label: "Adds to the initial system prompt" }),
2976
+ conditional: Object.freeze({ symbol: "+...", label: "Can add system-prompt text while the session is running" }),
2977
+ none: Object.freeze({ symbol: "-", label: "No additional system-prompt text measured" }),
2978
+ });
2952
2979
  const OPTIONAL_FEATURE_BY_ID = new Map(OPTIONAL_FEATURES.map((feature) => [feature.id, feature]));
2953
2980
  // Optional features that arm a paid or stateful runtime mode must turn it off before the browser
2954
2981
  // stops managing them, so a stale mode can never keep spending credits after a Disable click.
@@ -6634,18 +6661,173 @@ function intercomConversationSummarySignature(conversations) {
6634
6661
  ]));
6635
6662
  }
6636
6663
 
6664
+ let intercomConversationTagLayoutFrame = 0;
6665
+ let intercomConversationTagResizeObserver = null;
6666
+ let intercomConversationOverflowOpen = false;
6667
+
6668
+ function setIntercomConversationOverflowOpen(open, { focusMenu = false, restoreFocus = false } = {}) {
6669
+ const container = elements.intercomConversationTags;
6670
+ const overflow = container?.querySelector("button.composer-intercom-tag.overflow");
6671
+ const menu = container?.querySelector(".composer-intercom-overflow-menu");
6672
+ if (!container || !overflow || !menu) {
6673
+ intercomConversationOverflowOpen = false;
6674
+ return;
6675
+ }
6676
+
6677
+ const availableItems = [...menu.querySelectorAll("button:not([hidden])")];
6678
+ const expanded = Boolean(open && !overflow.hidden && availableItems.length);
6679
+ intercomConversationOverflowOpen = expanded;
6680
+ container.classList.toggle("overflow-open", expanded);
6681
+ overflow.setAttribute("aria-expanded", expanded ? "true" : "false");
6682
+ menu.hidden = !expanded;
6683
+
6684
+ if (expanded && focusMenu) availableItems[0]?.focus();
6685
+ else if (!expanded && restoreFocus) overflow.focus();
6686
+ }
6687
+
6688
+ function fitIntercomConversationTags() {
6689
+ const container = elements.intercomConversationTags;
6690
+ if (!container || container.hidden) return;
6691
+ const tags = [...container.querySelectorAll(":scope > button.composer-intercom-tag:not(.overflow)")];
6692
+ const overflow = container.querySelector("button.composer-intercom-tag.overflow");
6693
+ const menuItems = [...container.querySelectorAll(".composer-intercom-overflow-menu-item")];
6694
+ if (!tags.length || !overflow || menuItems.length !== tags.length) return;
6695
+
6696
+ const availableWidth = container.clientWidth;
6697
+ if (availableWidth <= 0) return;
6698
+
6699
+ for (const tag of tags) tag.hidden = false;
6700
+ overflow.hidden = false;
6701
+
6702
+ const containerStyle = getComputedStyle(container);
6703
+ const gap = Number.parseFloat(containerStyle.columnGap || containerStyle.gap) || 0;
6704
+ const tagWidths = tags.map((tag) => tag.getBoundingClientRect().width);
6705
+ const overflowWidths = new Map();
6706
+ const maxOverflowDigits = String(tags.length).length;
6707
+ for (let digits = 1; digits <= maxOverflowDigits; digits += 1) {
6708
+ overflow.textContent = `+${"0".repeat(digits)}`;
6709
+ overflowWidths.set(digits, overflow.getBoundingClientRect().width);
6710
+ }
6711
+ let visibleCount = 0;
6712
+
6713
+ for (let count = tags.length; count >= 0; count -= 1) {
6714
+ const hiddenCount = tags.length - count;
6715
+ const itemCount = count + (hiddenCount ? 1 : 0);
6716
+ const tagsWidth = tagWidths.slice(0, count).reduce((total, width) => total + width, 0);
6717
+ const overflowWidth = hiddenCount ? overflowWidths.get(String(hiddenCount).length) || 0 : 0;
6718
+ const requiredWidth = tagsWidth + overflowWidth + Math.max(0, itemCount - 1) * gap;
6719
+ if (requiredWidth <= availableWidth + 0.5) {
6720
+ visibleCount = count;
6721
+ break;
6722
+ }
6723
+ }
6724
+
6725
+ tags.forEach((tag, index) => { tag.hidden = index >= visibleCount; });
6726
+ menuItems.forEach((item, index) => { item.hidden = index < visibleCount; });
6727
+ const hiddenCount = tags.length - visibleCount;
6728
+ overflow.hidden = hiddenCount === 0;
6729
+ if (hiddenCount) {
6730
+ const label = `Show ${hiddenCount} more agent conversation${hiddenCount === 1 ? "" : "s"}`;
6731
+ overflow.textContent = `+${hiddenCount}`;
6732
+ overflow.title = `${label}.`;
6733
+ overflow.setAttribute("aria-label", label);
6734
+ if (intercomConversationOverflowOpen) setIntercomConversationOverflowOpen(true);
6735
+ } else {
6736
+ setIntercomConversationOverflowOpen(false);
6737
+ }
6738
+ }
6739
+
6740
+ function scheduleIntercomConversationTagLayout() {
6741
+ if (intercomConversationTagLayoutFrame) return;
6742
+ intercomConversationTagLayoutFrame = requestAnimationFrame(() => {
6743
+ intercomConversationTagLayoutFrame = 0;
6744
+ fitIntercomConversationTags();
6745
+ });
6746
+ }
6747
+
6748
+ function installIntercomConversationTagResizeHandling() {
6749
+ const container = elements.intercomConversationTags;
6750
+ if (!container) return;
6751
+ if (typeof ResizeObserver === "function") {
6752
+ intercomConversationTagResizeObserver = new ResizeObserver(scheduleIntercomConversationTagLayout);
6753
+ intercomConversationTagResizeObserver.observe(container);
6754
+ if (container.parentElement) intercomConversationTagResizeObserver.observe(container.parentElement);
6755
+ } else {
6756
+ window.addEventListener("resize", scheduleIntercomConversationTagLayout, { passive: true });
6757
+ }
6758
+ container.addEventListener("keydown", (event) => {
6759
+ if (event.key !== "Escape" || !intercomConversationOverflowOpen) return;
6760
+ event.preventDefault();
6761
+ event.stopPropagation();
6762
+ setIntercomConversationOverflowOpen(false, { restoreFocus: true });
6763
+ });
6764
+ container.addEventListener("focusout", () => {
6765
+ queueMicrotask(() => {
6766
+ if (intercomConversationOverflowOpen && !container.contains(document.activeElement)) setIntercomConversationOverflowOpen(false);
6767
+ });
6768
+ });
6769
+ document.addEventListener("pointerdown", (event) => {
6770
+ if (intercomConversationOverflowOpen && !container.contains(event.target)) setIntercomConversationOverflowOpen(false);
6771
+ });
6772
+ }
6773
+
6774
+ function updateIntercomConversationTag(tag, conversation) {
6775
+ const label = intercomConversationLabel(conversation);
6776
+ tag.setAttribute("aria-label", `Open agent conversation ${label}`);
6777
+ tag.title = `${label} · ${conversation.messageCount} message${conversation.messageCount === 1 ? "" : "s"}`;
6778
+ const visualSignature = JSON.stringify([label, conversation.messageCount]);
6779
+ if (tag.dataset.intercomVisualSignature === visualSignature) return;
6780
+ const children = [make("span", "composer-intercom-tag-icon", "↔"), make("span", "composer-intercom-tag-label", label)];
6781
+ if (conversation.messageCount > 0) children.push(make("span", "composer-intercom-tag-count", String(conversation.messageCount)));
6782
+ tag.replaceChildren(...children);
6783
+ tag.dataset.intercomVisualSignature = visualSignature;
6784
+ }
6785
+
6637
6786
  function renderIntercomConversationTags(tabId = activeTabId) {
6638
6787
  const container = elements.intercomConversationTags;
6639
6788
  if (!container) return;
6640
6789
  const conversations = intercomConversationSummariesByTab.get(tabId) || [];
6641
- const existingTags = new Map([...container.querySelectorAll(".composer-intercom-tag[data-intercom-conversation-id]")]
6790
+ if (!conversations.length) {
6791
+ intercomConversationOverflowOpen = false;
6792
+ container.classList.remove("overflow-open");
6793
+ container.replaceChildren();
6794
+ container.hidden = true;
6795
+ return;
6796
+ }
6797
+
6798
+ let overflow = container.querySelector("button.composer-intercom-tag.overflow");
6799
+ if (!overflow) {
6800
+ overflow = make("button", "composer-intercom-tag overflow", `+${conversations.length}`);
6801
+ overflow.type = "button";
6802
+ overflow.hidden = true;
6803
+ overflow.setAttribute("aria-haspopup", "dialog");
6804
+ overflow.setAttribute("aria-expanded", "false");
6805
+ overflow.setAttribute("aria-controls", "intercomConversationOverflowMenu");
6806
+ overflow.addEventListener("click", () => {
6807
+ const opening = !intercomConversationOverflowOpen;
6808
+ setIntercomConversationOverflowOpen(opening, { focusMenu: opening });
6809
+ });
6810
+ }
6811
+ let menu = container.querySelector(".composer-intercom-overflow-menu");
6812
+ if (!menu) {
6813
+ menu = make("div", "composer-intercom-overflow-menu");
6814
+ menu.id = "intercomConversationOverflowMenu";
6815
+ menu.hidden = true;
6816
+ menu.setAttribute("role", "dialog");
6817
+ menu.setAttribute("aria-label", "More agent conversations");
6818
+ }
6819
+ container.append(overflow, menu);
6820
+
6821
+ const existingTags = new Map([...container.querySelectorAll(":scope > .composer-intercom-tag[data-intercom-conversation-id]")]
6822
+ .map((tag) => [tag.dataset.intercomConversationId, tag]));
6823
+ const existingMenuItems = new Map([...menu.querySelectorAll(".composer-intercom-overflow-menu-item[data-intercom-conversation-id]")]
6642
6824
  .map((tag) => [tag.dataset.intercomConversationId, tag]));
6643
6825
  const orderedTags = [];
6826
+ const orderedMenuItems = [];
6644
6827
  const seenConversationIds = new Set();
6645
6828
  for (const conversation of conversations) {
6646
6829
  if (seenConversationIds.has(conversation.id)) continue;
6647
6830
  seenConversationIds.add(conversation.id);
6648
- const label = intercomConversationLabel(conversation);
6649
6831
  let tag = existingTags.get(conversation.id);
6650
6832
  if (tag) existingTags.delete(conversation.id);
6651
6833
  else {
@@ -6656,24 +6838,41 @@ function renderIntercomConversationTags(tabId = activeTabId) {
6656
6838
  tag.setAttribute("aria-controls", "intercomConversationDialog");
6657
6839
  tag.addEventListener("click", () => openIntercomConversation(tag.dataset.intercomConversationId));
6658
6840
  }
6659
- tag.setAttribute("aria-label", `Open agent conversation ${label}`);
6660
- tag.title = `${label} · ${conversation.messageCount} message${conversation.messageCount === 1 ? "" : "s"}`;
6661
- const visualSignature = JSON.stringify([label, conversation.messageCount]);
6662
- if (tag.dataset.intercomVisualSignature !== visualSignature) {
6663
- const children = [make("span", "composer-intercom-tag-icon", "↔"), make("span", "composer-intercom-tag-label", label)];
6664
- if (conversation.messageCount > 0) children.push(make("span", "composer-intercom-tag-count", String(conversation.messageCount)));
6665
- tag.replaceChildren(...children);
6666
- tag.dataset.intercomVisualSignature = visualSignature;
6667
- }
6841
+ updateIntercomConversationTag(tag, conversation);
6668
6842
  orderedTags.push(tag);
6843
+
6844
+ let menuItem = existingMenuItems.get(conversation.id);
6845
+ if (menuItem) existingMenuItems.delete(conversation.id);
6846
+ else {
6847
+ menuItem = make("button", "composer-intercom-tag composer-intercom-overflow-menu-item");
6848
+ menuItem.type = "button";
6849
+ menuItem.dataset.intercomConversationId = conversation.id;
6850
+ menuItem.setAttribute("aria-haspopup", "dialog");
6851
+ menuItem.setAttribute("aria-controls", "intercomConversationDialog");
6852
+ menuItem.addEventListener("click", () => {
6853
+ const conversationId = menuItem.dataset.intercomConversationId;
6854
+ setIntercomConversationOverflowOpen(false);
6855
+ overflow.focus();
6856
+ openIntercomConversation(conversationId);
6857
+ });
6858
+ }
6859
+ updateIntercomConversationTag(menuItem, conversation);
6860
+ orderedMenuItems.push(menuItem);
6669
6861
  }
6670
- container.classList.toggle("dense", orderedTags.length > 8);
6862
+
6671
6863
  for (const staleTag of existingTags.values()) staleTag.remove();
6672
- const currentTags = [...container.querySelectorAll(":scope > .composer-intercom-tag")];
6864
+ for (const staleItem of existingMenuItems.values()) staleItem.remove();
6865
+ const currentTags = [...container.querySelectorAll(":scope > .composer-intercom-tag[data-intercom-conversation-id]")];
6673
6866
  if (currentTags.length !== orderedTags.length || orderedTags.some((tag, index) => currentTags[index] !== tag)) {
6674
- for (const tag of orderedTags) container.append(tag);
6867
+ for (const tag of orderedTags) container.insertBefore(tag, overflow);
6868
+ }
6869
+ const currentMenuItems = [...menu.querySelectorAll(":scope > .composer-intercom-overflow-menu-item")];
6870
+ if (currentMenuItems.length !== orderedMenuItems.length || orderedMenuItems.some((tag, index) => currentMenuItems[index] !== tag)) {
6871
+ for (const menuItem of orderedMenuItems) menu.append(menuItem);
6675
6872
  }
6676
- container.hidden = orderedTags.length === 0;
6873
+ container.append(overflow, menu);
6874
+ container.hidden = false;
6875
+ scheduleIntercomConversationTagLayout();
6677
6876
  }
6678
6877
 
6679
6878
  async function refreshIntercomConversationSummaries(tabContext = activeTabContext()) {
@@ -7797,9 +7996,10 @@ function confirmDiscardEdits({ what = "unsaved edits", target = "" } = {}) {
7797
7996
  });
7798
7997
  }
7799
7998
 
7800
- // Application text prompt (replaces blocking window.prompt): resolves with the entered string,
7801
- // or null when cancelled. `validate` may return an error message to keep the dialog open.
7999
+ // Application value prompt (replaces blocking window.prompt): resolves with the entered value,
8000
+ // or null when cancelled. Text prompts may validate and keep the dialog open.
7802
8001
  let activeTextPromptResolve = null;
8002
+ let textPromptMode = "text";
7803
8003
 
7804
8004
  function appPromptText({ title = "Enter a value", summary = "", defaultValue = "", placeholder = "", confirmLabel = "OK", validate = null, selectRange = null } = {}) {
7805
8005
  const dialog = elements.textPromptDialog;
@@ -7808,11 +8008,14 @@ function appPromptText({ title = "Enter a value", summary = "", defaultValue = "
7808
8008
  return Promise.resolve(value === null ? null : String(value));
7809
8009
  }
7810
8010
  if (activeTextPromptResolve) finishTextPrompt(null);
8011
+ textPromptMode = "text";
7811
8012
  elements.textPromptTitle.textContent = title;
7812
8013
  elements.textPromptSummary.textContent = summary;
7813
8014
  elements.textPromptSummary.hidden = !summary;
8015
+ elements.textPromptInput.hidden = false;
7814
8016
  elements.textPromptInput.value = defaultValue;
7815
8017
  elements.textPromptInput.placeholder = placeholder;
8018
+ if (elements.textPromptSelect) elements.textPromptSelect.hidden = true;
7816
8019
  elements.textPromptError.hidden = true;
7817
8020
  elements.textPromptError.textContent = "";
7818
8021
  elements.textPromptConfirmButton.textContent = confirmLabel;
@@ -7830,6 +8033,51 @@ function appPromptText({ title = "Enter a value", summary = "", defaultValue = "
7830
8033
  });
7831
8034
  }
7832
8035
 
8036
+ function appPromptSelect({ title = "Choose an option", summary = "", options = [], placeholder = "Choose…", confirmLabel = "Continue" } = {}) {
8037
+ const normalizedOptions = options
8038
+ .map((option) => ({ value: String(option?.value ?? ""), label: String(option?.label ?? option?.value ?? "") }))
8039
+ .filter((option) => option.value && option.label);
8040
+ const dialog = elements.textPromptDialog;
8041
+ if (!dialog?.showModal || !elements.textPromptSelect) {
8042
+ const lines = normalizedOptions.map((option, index) => `${index + 1}. ${option.label}`);
8043
+ const choice = window.prompt([title, summary, ...lines].filter(Boolean).join("\n"), "");
8044
+ if (choice === null) return Promise.resolve(null);
8045
+ const selected = normalizedOptions[Number.parseInt(String(choice), 10) - 1];
8046
+ return Promise.resolve(selected?.value || null);
8047
+ }
8048
+ if (activeTextPromptResolve) finishTextPrompt(null);
8049
+ textPromptMode = "select";
8050
+ elements.textPromptTitle.textContent = title;
8051
+ elements.textPromptSummary.textContent = summary;
8052
+ elements.textPromptSummary.hidden = !summary;
8053
+ elements.textPromptInput.hidden = true;
8054
+ const select = elements.textPromptSelect;
8055
+ select.hidden = false;
8056
+ select.replaceChildren();
8057
+ const placeholderOption = document.createElement("option");
8058
+ placeholderOption.value = "";
8059
+ placeholderOption.textContent = placeholder;
8060
+ placeholderOption.disabled = true;
8061
+ placeholderOption.selected = true;
8062
+ select.append(placeholderOption);
8063
+ for (const option of normalizedOptions) {
8064
+ const element = document.createElement("option");
8065
+ element.value = option.value;
8066
+ element.textContent = option.label;
8067
+ select.append(element);
8068
+ }
8069
+ select.value = "";
8070
+ elements.textPromptError.hidden = true;
8071
+ elements.textPromptError.textContent = "";
8072
+ elements.textPromptConfirmButton.textContent = confirmLabel;
8073
+ textPromptValidator = (value) => value ? "" : "Choose an option.";
8074
+ return new Promise((resolve) => {
8075
+ activeTextPromptResolve = resolve;
8076
+ dialog.showModal();
8077
+ queueMicrotask(() => select.focus());
8078
+ });
8079
+ }
8080
+
7833
8081
  let textPromptValidator = null;
7834
8082
 
7835
8083
  function finishTextPrompt(value) {
@@ -7841,12 +8089,13 @@ function finishTextPrompt(value) {
7841
8089
  }
7842
8090
 
7843
8091
  function submitTextPrompt() {
7844
- const value = String(elements.textPromptInput?.value ?? "");
8092
+ const control = textPromptMode === "select" ? elements.textPromptSelect : elements.textPromptInput;
8093
+ const value = String(control?.value ?? "");
7845
8094
  const problem = textPromptValidator ? textPromptValidator(value) : "";
7846
8095
  if (problem) {
7847
8096
  elements.textPromptError.textContent = String(problem);
7848
8097
  elements.textPromptError.hidden = false;
7849
- elements.textPromptInput?.focus();
8098
+ control?.focus();
7850
8099
  return;
7851
8100
  }
7852
8101
  finishTextPrompt(value);
@@ -24944,6 +25193,10 @@ function reconcileGitWorkflowContinuation(workflowTabId = activeTabId) {
24944
25193
  loadGitWorkflowBranchName({ requireFresh: true, retries: 3, runId: workflow.runId, tabId: workflowTabId });
24945
25194
  } else if (workflow.step === "prGenerating") {
24946
25195
  loadGitWorkflowPr({ requireFresh: true, retries: 3, runId: workflow.runId, tabId: workflowTabId });
25196
+ } else if (workflow.step === "readmeGenerating") {
25197
+ prepareGitInitFiles({ afterReadmePrompt: true, runId: workflow.runId, tabId: workflowTabId });
25198
+ } else if (workflow.step === "gitignoreGenerating") {
25199
+ prepareGitInitFiles({ afterGitignorePrompt: true, runId: workflow.runId, tabId: workflowTabId });
24947
25200
  }
24948
25201
  }
24949
25202
 
@@ -33545,19 +33798,25 @@ function reconcileGuidedGitReviewWidgetRemoval(tabId) {
33545
33798
  return true;
33546
33799
  }
33547
33800
 
33548
- function guidedGitPromptCommandUnavailable(commandName) {
33549
- return `Guided Git browser generation requires /${commandName} from @firstpick/pi-prompts-git-pr in the originating tab.`;
33801
+ function guidedGitNativeCommandUnavailable(commandName) {
33802
+ return `Guided Git browser generation requires the /${commandName} extension command from @firstpick/pi-extension-git-guided-workflow in the originating tab. Same-named prompt templates are not used.`;
33550
33803
  }
33551
33804
 
33552
- function guidedGitPromptCompanionAvailable(tabId) {
33553
- return !isOptionalFeatureDisabled("gitWorkflow") && hasLoadedRpcCommand("git-staged-msg", { tabId });
33805
+ function hasLoadedGuidedGitNativeCommand(commandName, tabId) {
33806
+ return resolveAvailableCommand(commandName, { tabId, rpcOnly: true })?.source === "extension";
33554
33807
  }
33555
33808
 
33556
- function reportGuidedGitPromptCompanionUnavailable(tabId) {
33809
+ function guidedGitNativeCommandsAvailable(tabId) {
33810
+ return !isOptionalFeatureDisabled("gitWorkflow")
33811
+ && ["git-staged-msg", "git-branch-name", "pr"].every((commandName) => hasLoadedGuidedGitNativeCommand(commandName, tabId));
33812
+ }
33813
+
33814
+ function reportGuidedGitNativeCommandsUnavailable(tabId) {
33557
33815
  const tabContext = activeTabContext(tabId);
33816
+ const missing = ["git-staged-msg", "git-branch-name", "pr"].find((commandName) => !hasLoadedGuidedGitNativeCommand(commandName, tabId));
33558
33817
  const message = isOptionalFeatureDisabled("gitWorkflow")
33559
33818
  ? optionalFeatureUnavailableMessage("gitWorkflow")
33560
- : guidedGitPromptCommandUnavailable("git-staged-msg");
33819
+ : guidedGitNativeCommandUnavailable(missing || "git-staged-msg");
33561
33820
  addEvent(message, "warn");
33562
33821
  refreshCommands(tabContext).catch((error) => {
33563
33822
  if (isCurrentTabContext(tabContext)) addEvent(error.message || String(error), "error");
@@ -33567,8 +33826,8 @@ function reportGuidedGitPromptCompanionUnavailable(tabId) {
33567
33826
  function handleGuidedGitActivationRequest(request) {
33568
33827
  if (request?.method !== "setStatus" || request.statusKey !== GUIDED_GIT_START_STATUS_KEY) return false;
33569
33828
  const result = guidedGitActivationController.consume(request, async (tabId, activationIsCurrent) => {
33570
- if (!guidedGitPromptCompanionAvailable(tabId)) {
33571
- reportGuidedGitPromptCompanionUnavailable(tabId);
33829
+ if (!guidedGitNativeCommandsAvailable(tabId)) {
33830
+ reportGuidedGitNativeCommandsUnavailable(tabId);
33572
33831
  return;
33573
33832
  }
33574
33833
  await startGitWorkflow(tabId, { activationIsCurrent });
@@ -33604,35 +33863,13 @@ function guidedGitLaunchAdmitted(tabId) {
33604
33863
  return false;
33605
33864
  }
33606
33865
 
33607
- async function startLegacyGuidedGitWorkflowFallback(tabId) {
33608
- if (!guidedGitLaunchAdmitted(tabId)) return;
33609
- if (!guidedGitPromptCompanionAvailable(tabId)) {
33610
- addEvent(isOptionalFeatureDisabled("gitWorkflow")
33611
- ? optionalFeatureUnavailableMessage("gitWorkflow")
33612
- : "Guided Git is unavailable: install @firstpick/pi-extension-git-guided-workflow. Browser generation also requires @firstpick/pi-prompts-git-pr.", "warn");
33613
- return;
33614
- }
33615
- try {
33616
- await api("/api/git-workflow/launch-admission", { method: "POST", body: {}, tabId });
33617
- } catch (error) {
33618
- reportGuidedGitLaunchRefused("pending");
33619
- return;
33620
- }
33621
- addEvent("Using the temporary prompt-only Guided Git compatibility launcher. Install @firstpick/pi-extension-git-guided-workflow to route future starts through /git-guided-workflow.", "info");
33622
- await guidedGitActivationController.run(tabId, (_tabId, activationIsCurrent) => startGitWorkflow(tabId, { activationIsCurrent }));
33623
- }
33624
-
33625
33866
  async function launchGuidedGitWorkflow(tabId = activeTabId) {
33626
33867
  if (!tabId || !guidedGitLaunchAdmitted(tabId)) return;
33627
33868
  const launchMode = guidedGitLaunchModeForTabCatalog(commandCatalogForTab(tabId), { disabled: isOptionalFeatureDisabled("gitWorkflow") });
33628
- if (launchMode === "fallback") {
33629
- await startLegacyGuidedGitWorkflowFallback(tabId);
33630
- return;
33631
- }
33632
33869
  if (launchMode !== "extension") {
33633
33870
  addEvent(launchMode === "disabled"
33634
33871
  ? optionalFeatureUnavailableMessage("gitWorkflow")
33635
- : "Guided Git is unavailable: install @firstpick/pi-extension-git-guided-workflow. Browser generation also requires @firstpick/pi-prompts-git-pr.", "warn");
33872
+ : "Guided Git is unavailable: install @firstpick/pi-extension-git-guided-workflow and reload the Pi tab.", "warn");
33636
33873
  return;
33637
33874
  }
33638
33875
  const commandName = resolveAvailableCommandName("git-guided-workflow", { tabId, rpcOnly: true });
@@ -33645,14 +33882,14 @@ async function launchGuidedGitWorkflow(tabId = activeTabId) {
33645
33882
 
33646
33883
  async function startGitWorkflow(tabId = activeTabId, { skipSetup = false, activationIsCurrent = () => true } = {}) {
33647
33884
  if (!tabId || !activationIsCurrent()) return;
33648
- if (!guidedGitPromptCompanionAvailable(tabId)) {
33649
- reportGuidedGitPromptCompanionUnavailable(tabId);
33885
+ if (!guidedGitNativeCommandsAvailable(tabId)) {
33886
+ reportGuidedGitNativeCommandsUnavailable(tabId);
33650
33887
  return;
33651
33888
  }
33652
33889
 
33653
33890
  let setupData;
33654
33891
  try {
33655
- const response = await api("/api/git-workflow/preferences", { tabId });
33892
+ const response = await api("/api/git-workflow/preferences?includeModels=false", { tabId });
33656
33893
  setupData = response.data || {};
33657
33894
  if (!activationIsCurrent()) return;
33658
33895
  gitWorkflowPreferences = setupData.preferences || null;
@@ -34122,8 +34359,8 @@ async function loadGitWorkflowDefaultCommitMessage({ runId, tabId = activeTabId
34122
34359
 
34123
34360
  async function runGitMessagePrompt(tabId = gitWorkflowActionTabId()) {
34124
34361
  const tabContext = activeTabContext(tabId);
34125
- if (!hasLoadedRpcCommand("git-staged-msg", { tabId })) {
34126
- failGitWorkflow(new Error(guidedGitPromptCommandUnavailable("git-staged-msg")), "generate", { tabId });
34362
+ if (!hasLoadedGuidedGitNativeCommand("git-staged-msg", tabId)) {
34363
+ failGitWorkflow(new Error(guidedGitNativeCommandUnavailable("git-staged-msg")), "generate", { tabId });
34127
34364
  return;
34128
34365
  }
34129
34366
  const targetTab = tabs.find((tab) => tab.id === tabId);
@@ -34272,19 +34509,8 @@ async function loadGitWorkflowMessage({ requireFresh = false, generationId, runI
34272
34509
  return promise;
34273
34510
  }
34274
34511
 
34275
- function gitBranchNamePromptMessage() {
34276
- if (hasAvailableCommand("git-branch-name")) return "/git-branch-name";
34277
- return [
34278
- "Generate one PR branch name for the current staged work.",
34279
- "Inspect only staged changes (`git diff --cached`) and the generated commit message files if present:",
34280
- "- dev/COMMIT/staged-commit-short.txt",
34281
- "- dev/COMMIT/staged-commit-long.txt",
34282
- "",
34283
- "Write exactly one line to dev/COMMIT/staged-branch-name.txt in this format:",
34284
- "<type>/<short-feature-name>",
34285
- "",
34286
- "Rules: use lowercase kebab-case, no spaces/underscores/uppercase/trailing punctuation, 2-5 words after the slash, and no extra lines or prose in the file.",
34287
- ].join("\n");
34512
+ function gitBranchNamePromptMessage(tabId = gitWorkflowActionTabId()) {
34513
+ return hasLoadedGuidedGitNativeCommand("git-branch-name", tabId) ? "/git-branch-name" : "";
34288
34514
  }
34289
34515
 
34290
34516
  async function createGitPrBranch(tabId = gitWorkflowActionTabId()) {
@@ -34299,8 +34525,8 @@ async function createGitPrBranchManually(tabId = gitWorkflowActionTabId()) {
34299
34525
 
34300
34526
  async function runGitBranchNamePrompt(tabId = gitWorkflowActionTabId()) {
34301
34527
  const tabContext = activeTabContext(tabId);
34302
- if (!hasLoadedRpcCommand("git-branch-name", { tabId })) {
34303
- failGitWorkflow(new Error(guidedGitPromptCommandUnavailable("git-branch-name")), "message", { tabId });
34528
+ if (!hasLoadedGuidedGitNativeCommand("git-branch-name", tabId)) {
34529
+ failGitWorkflow(new Error(guidedGitNativeCommandUnavailable("git-branch-name")), "message", { tabId });
34304
34530
  return;
34305
34531
  }
34306
34532
  const targetTab = tabs.find((tab) => tab.id === tabId);
@@ -34559,20 +34785,22 @@ async function commitGitWorkflow(variant, tabId = gitWorkflowActionTabId()) {
34559
34785
  function cleanGitPublishVisibilityInput(value) {
34560
34786
  const visibility = String(value ?? "").trim().toLowerCase();
34561
34787
  if (visibility !== "public" && visibility !== "private") {
34562
- throw new Error("Repository visibility must be typed as exactly 'public' or 'private'. There is no default; nothing was published.");
34788
+ throw new Error("Repository visibility must be selected as 'public' or 'private'; nothing was published.");
34563
34789
  }
34564
34790
  return visibility;
34565
34791
  }
34566
34792
 
34567
- function promptGitPublishRepoName(tabId = activeTabId) {
34568
- const targetTab = tabs.find((tab) => tab.id === tabId) || activeTab();
34569
- const value = window.prompt("GitHub repository name to create", defaultGitInitRepoName(targetTab));
34570
- if (value === null) return null;
34571
- return cleanGitHubRepoNameInput(value);
34572
- }
34573
-
34574
- function promptGitPublishVisibility(repoName) {
34575
- const value = window.prompt(`Visibility for GitHub repository ${repoName} — type public or private (no default)`, "");
34793
+ async function promptGitPublishVisibility(repoName) {
34794
+ const value = await appPromptSelect({
34795
+ title: "Choose repository visibility",
34796
+ summary: `GitHub repository: ${repoName}`,
34797
+ options: [
34798
+ { value: "public", label: "Public" },
34799
+ { value: "private", label: "Private" },
34800
+ ],
34801
+ placeholder: "Choose visibility…",
34802
+ confirmLabel: "Continue",
34803
+ });
34576
34804
  if (value === null) return null;
34577
34805
  return cleanGitPublishVisibilityInput(value);
34578
34806
  }
@@ -34583,19 +34811,18 @@ async function publishGitWorkflowRepository(tabId, failure) {
34583
34811
  if (!workflow) return false;
34584
34812
  const runId = workflow.runId;
34585
34813
  const branch = failure?.data?.branch || gitFooterCurrentBranch() || "the current branch";
34814
+ const targetTab = tabs.find((tab) => tab.id === tabId) || activeTab();
34815
+ const repoName = cleanGitHubRepoNameInput(failure?.data?.repoName || defaultGitInitRepoName(targetTab));
34586
34816
  const publishRequested = await appConfirmText([
34587
34817
  failure?.message || "git push found no configured push destination.",
34588
34818
  "",
34589
- "Publish this repository to GitHub with the authenticated GitHub CLI (gh) account instead?",
34590
- "Nothing is created until you choose a name, choose visibility explicitly, and confirm the final summary.",
34591
- ].join("\n"), { affected: "A new GitHub repository and the origin remote", confirmLabel: "Choose publication details", danger: false });
34819
+ `Publish this repository to GitHub as ${repoName} with the authenticated GitHub CLI (gh) account?`,
34820
+ "The repository name comes from the local Git root directory. Nothing is created until you choose visibility explicitly and confirm the final summary.",
34821
+ ].join("\n"), { affected: "A new GitHub repository and the origin remote", confirmLabel: "Choose visibility", danger: false });
34592
34822
  if (!publishRequested) return false;
34593
- let repoName;
34594
34823
  let visibility;
34595
34824
  try {
34596
- repoName = promptGitPublishRepoName(tabId);
34597
- if (!repoName) return false;
34598
- visibility = promptGitPublishVisibility(repoName);
34825
+ visibility = await promptGitPublishVisibility(repoName);
34599
34826
  if (!visibility) return false;
34600
34827
  } catch (error) {
34601
34828
  addEvent(error.message || String(error), "error");
@@ -34613,7 +34840,7 @@ async function publishGitWorkflowRepository(tabId, failure) {
34613
34840
  ].join("\n"), { affected: `New ${visibility} GitHub repository ${repoName}`, confirmLabel: "Publish repository" });
34614
34841
  if (!confirmed) return false;
34615
34842
  setGitWorkflow({ step: "pushing", busy: true, error: "", output: `Creating ${visibility} GitHub repository ${repoName} and pushing ${branch}…` }, { tabId });
34616
- const result = await gitWorkflowRequest("/api/git-workflow/publish", { body: { repoName, visibility, confirmed: true }, runId, tabId });
34843
+ const result = await gitWorkflowRequest("/api/git-workflow/publish", { body: { visibility, confirmed: true }, runId, tabId });
34617
34844
  if (!result) return true;
34618
34845
  setGitWorkflow({
34619
34846
  step: "done",
@@ -34666,8 +34893,8 @@ async function runGitPrPrompt(tabId = gitWorkflowActionTabId(), { prefixOutput =
34666
34893
  failGitWorkflow(new Error("Pi is currently running. Wait for it to finish or abort before generating a PR description."), "push", { tabId });
34667
34894
  return;
34668
34895
  }
34669
- if (!hasLoadedRpcCommand("pr", { tabId })) {
34670
- failGitWorkflow(new Error(guidedGitPromptCommandUnavailable("pr")), "push", { tabId });
34896
+ if (!hasLoadedGuidedGitNativeCommand("pr", tabId)) {
34897
+ failGitWorkflow(new Error(guidedGitNativeCommandUnavailable("pr")), "push", { tabId });
34671
34898
  return;
34672
34899
  }
34673
34900
  const workflow = gitWorkflowForTab(tabId, { create: false });
@@ -41256,7 +41483,7 @@ function updateOptionalFeatureAvailability() {
41256
41483
  optionalFeatureAvailability.bangCommandAutocomplete = hasAvailableCommand("bang-status") || hasAvailableCommand("bang-refresh");
41257
41484
  optionalFeatureAvailability.fishUserBash = hasAvailableCommand("user-bash-shell");
41258
41485
  optionalFeatureAvailability.btwCommand = hasAvailableCommand("btw") || optionalFeatureAvailability.btwCommand || statusEntries.has(BTW_WEBUI_STATUS_KEY) || widgets.has(BTW_OUTPUT_WIDGET_KEY);
41259
- optionalFeatureAvailability.gitWorkflow = hasAvailableCommand("git-guided-workflow") || hasAvailableCommand("git-staged-msg");
41486
+ optionalFeatureAvailability.gitWorkflow = hasAvailableCommand("git-guided-workflow") || hasLoadedGuidedGitNativeCommand("git-staged-msg", activeTabId);
41260
41487
  optionalFeatureAvailability.releaseNpm = hasAvailableCommand("release-npm");
41261
41488
  optionalFeatureAvailability.releaseAur = hasAvailableCommand("release-aur");
41262
41489
  optionalFeatureAvailability.aurReview = hasAvailableCommand("aur-review") || optionalFeatureAvailability.aurReview || widgets.has(AUR_REVIEW_RPC_WIDGET_KEY);
@@ -41374,6 +41601,18 @@ function optionalFeatureWidgetHasSpecializedRenderer(key) {
41374
41601
  return key.startsWith("btw:") || key.startsWith("release-npm:") || key.startsWith("release-aur:") || key === AUR_REVIEW_RPC_WIDGET_KEY || key === "workflow:subprocess" || key === WORKFLOW_INSPECTOR_WIDGET_KEY;
41375
41602
  }
41376
41603
 
41604
+ function optionalFeaturePromptImpact(feature) {
41605
+ return OPTIONAL_FEATURE_PROMPT_IMPACTS[feature?.promptImpact] || OPTIONAL_FEATURE_PROMPT_IMPACTS.none;
41606
+ }
41607
+
41608
+ function renderOptionalFeaturePromptImpactBadge(feature) {
41609
+ const impact = optionalFeaturePromptImpact(feature);
41610
+ const badge = make("span", `optional-feature-prompt-impact ${feature?.promptImpact || "none"}`, impact.symbol);
41611
+ badge.title = impact.label;
41612
+ badge.setAttribute("aria-label", impact.label);
41613
+ return badge;
41614
+ }
41615
+
41377
41616
  function renderOptionalFeatureBatchToolbar() {
41378
41617
  const candidates = optionalFeatureBatchCandidates();
41379
41618
  const migratable = optionalFeatureMigrationCandidates();
@@ -41547,7 +41786,8 @@ function renderOptionalFeatureRow(feature) {
41547
41786
  const packageStatus = optionalFeaturePackageStatus(feature.id);
41548
41787
  const status = optionalFeatureStatus(feature.id);
41549
41788
  const row = make("div", `optional-feature-row ${status.className}`);
41550
- const tooltip = optionalFeatureTooltip(feature, status);
41789
+ const impact = optionalFeaturePromptImpact(feature);
41790
+ const tooltip = `${optionalFeatureTooltip(feature, status)}\nSystem prompt impact: ${impact.label}.`;
41551
41791
  row.dataset.tooltip = tooltip;
41552
41792
  row.setAttribute("aria-label", tooltip.replace(/\s+/g, " "));
41553
41793
  if (installing || accessChanging) row.setAttribute("aria-busy", "true");
@@ -41555,7 +41795,9 @@ function renderOptionalFeatureRow(feature) {
41555
41795
 
41556
41796
  const main = make("div", "optional-feature-main");
41557
41797
  const title = make("div", "optional-feature-title");
41558
- title.append(make("strong", undefined, feature.label), make("span", `optional-feature-pill ${status.className}`, status.label));
41798
+ const statusTags = make("div", "optional-feature-status-tags");
41799
+ statusTags.append(renderOptionalFeaturePromptImpactBadge(feature), make("span", `optional-feature-pill ${status.className}`, status.label));
41800
+ title.append(make("strong", undefined, feature.label), statusTags);
41559
41801
  main.append(title);
41560
41802
  if (status.detail) {
41561
41803
  const detail = make("div", `optional-feature-detail ${status.className === "failed" ? "error" : ""}`.trim(), status.detail);
@@ -44248,10 +44490,11 @@ async function openNativeResumeSelector(scope = "current", { query = "" } = {})
44248
44490
  setNativeCommandError("");
44249
44491
  try {
44250
44492
  const result = await nativeCommandApi("/api/switch-session", { method: "POST", body: { sessionPath: selectedItem.session.path } });
44251
- applyResponseTab(result);
44252
- addTransientMessage({ role: "native", title: "/resume", content: result.data?.message || "Resumed selected session.", level: "info" });
44493
+ const resumedTab = syncResponseTabs(result);
44253
44494
  closeNativeCommandDialog();
44254
- await refreshAll();
44495
+ if (resumedTab?.id) await switchTab(resumedTab.id);
44496
+ else await refreshAll();
44497
+ addTransientMessage({ role: "native", title: "/resume", content: result.data?.message || "Resumed selected session in a new terminal tab.", level: "info" });
44255
44498
  } catch (error) {
44256
44499
  setNativeCommandError(error.message || String(error));
44257
44500
  }
@@ -46036,9 +46279,15 @@ function mainOutputLoadingRequestIsCurrent(request) {
46036
46279
  return !!request?.tabContext && isCurrentTabContext(request.tabContext);
46037
46280
  }
46038
46281
 
46282
+ function currentMainOutputLoadingRequest() {
46283
+ return [...mainOutputLoadingRequests].filter(mainOutputLoadingRequestIsCurrent).at(-1) || null;
46284
+ }
46285
+
46039
46286
  function renderMainOutputLoading({ reveal = false } = {}) {
46040
- const active = [...mainOutputLoadingRequests].some(mainOutputLoadingRequestIsCurrent);
46287
+ const request = currentMainOutputLoadingRequest();
46288
+ const active = !!request;
46041
46289
  elements.chat?.setAttribute("aria-busy", active ? "true" : "false");
46290
+ if (elements.mainOutputLoadingLabel) elements.mainOutputLoadingLabel.textContent = request?.label || "Loading your conversation…";
46042
46291
  clearTimeout(mainOutputLoadingRevealTimer);
46043
46292
  mainOutputLoadingRevealTimer = null;
46044
46293
  if (!elements.mainOutputLoading) return;
@@ -46046,23 +46295,29 @@ function renderMainOutputLoading({ reveal = false } = {}) {
46046
46295
  elements.mainOutputLoading.hidden = true;
46047
46296
  return;
46048
46297
  }
46049
- if (reveal) {
46298
+ if (reveal || !elements.mainOutputLoading.hidden) {
46050
46299
  elements.mainOutputLoading.hidden = false;
46051
46300
  return;
46052
46301
  }
46053
46302
  mainOutputLoadingRevealTimer = setTimeout(() => {
46054
46303
  mainOutputLoadingRevealTimer = null;
46055
- if ([...mainOutputLoadingRequests].some(mainOutputLoadingRequestIsCurrent)) elements.mainOutputLoading.hidden = false;
46304
+ if (currentMainOutputLoadingRequest()) elements.mainOutputLoading.hidden = false;
46056
46305
  }, MAIN_OUTPUT_LOADING_REVEAL_DELAY_MS);
46057
46306
  }
46058
46307
 
46059
- function beginMainOutputLoading(tabContext) {
46060
- const request = { tabContext: { ...tabContext } };
46308
+ function beginMainOutputLoading(tabContext, label) {
46309
+ const request = { tabContext: { ...tabContext }, label };
46061
46310
  mainOutputLoadingRequests.add(request);
46062
46311
  renderMainOutputLoading();
46063
46312
  return request;
46064
46313
  }
46065
46314
 
46315
+ function updateMainOutputLoading(request, label) {
46316
+ if (!mainOutputLoadingRequests.has(request)) return;
46317
+ request.label = label;
46318
+ if (request === currentMainOutputLoadingRequest() && elements.mainOutputLoadingLabel) elements.mainOutputLoadingLabel.textContent = label;
46319
+ }
46320
+
46066
46321
  function finishMainOutputLoading(request) {
46067
46322
  mainOutputLoadingRequests.delete(request);
46068
46323
  renderMainOutputLoading();
@@ -46070,12 +46325,13 @@ function finishMainOutputLoading(request) {
46070
46325
 
46071
46326
  async function refreshMessages(tabContext = activeTabContext(), { authoritative = false } = {}) {
46072
46327
  if (!tabContext.tabId) return;
46073
- const loadingRequest = beginMainOutputLoading(tabContext);
46328
+ const previousMessages = latestMessages;
46329
+ const sessionKey = resolveMessagesSessionKey(tabContext.tabId);
46330
+ const loadDelta = !authoritative && previousMessages.length > 1 && sessionKey === latestMessagesSessionKey;
46331
+ const loadingRequest = beginMainOutputLoading(tabContext, loadDelta ? "Checking for new messages…" : "Loading conversation history…");
46074
46332
  try {
46075
- const previousMessages = latestMessages;
46076
- const sessionKey = resolveMessagesSessionKey(tabContext.tabId);
46077
46333
  let nextMessages = null;
46078
- if (!authoritative && previousMessages.length > 1 && sessionKey === latestMessagesSessionKey) {
46334
+ if (loadDelta) {
46079
46335
  // Delta fetch with a one-message overlap: the last known message is
46080
46336
  // re-requested so retroactive changes are detected via mergeMessagesDelta.
46081
46337
  const response = await api(`/api/messages?since=${previousMessages.length - 1}`, { tabId: tabContext.tabId });
@@ -46083,10 +46339,12 @@ async function refreshMessages(tabContext = activeTabContext(), { authoritative
46083
46339
  nextMessages = mergeMessagesDelta(previousMessages, response.data);
46084
46340
  }
46085
46341
  if (!nextMessages) {
46342
+ updateMainOutputLoading(loadingRequest, "Loading conversation history…");
46086
46343
  const response = await api("/api/messages", { tabId: tabContext.tabId });
46087
46344
  if (!isCurrentTabContext(tabContext)) return;
46088
46345
  nextMessages = response.data?.messages || [];
46089
46346
  }
46347
+ updateMainOutputLoading(loadingRequest, "Preparing your conversation…");
46090
46348
  latestMessages = nextMessages;
46091
46349
  latestMessagesSessionKey = sessionKey;
46092
46350
  cacheMessagesForTab(tabContext.tabId, latestMessages, latestMessagesSessionKey);
@@ -51278,6 +51536,7 @@ restoreBusyPromptBehaviorSetting();
51278
51536
  syncMobileComposerDisclosureLayout();
51279
51537
  updateComposerModeButtons();
51280
51538
  installSessionSkillTagResizeHandling();
51539
+ installIntercomConversationTagResizeHandling();
51281
51540
  updateOptionalFeatureAvailability();
51282
51541
  renderOptionalFeatureMigrationSurface();
51283
51542
  refreshOptionalFeaturePackageStatuses({ announce: true });