pi-studio 0.11.11 → 0.11.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,16 @@ All notable changes to `pi-studio` are documented here.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.11.12] — 2026-11-05
8
+
9
+ ### Changed
10
+ - **Follow** is one switch. On, a run shows Working while Pi works, then the new response; off, Studio leaves the Prompt's right pane alone. Changing that pane's view yourself during a run turns Follow off, and it stays off until you turn it on again, with the button or Cmd/Ctrl+Option/Alt+A. Turned on during a run, it goes back to Working. "Run paused" is gone. **Document preview**, which shows the Document's preview when you select the Document, is now under View. A saved setting with only Working or only the latest response on counts as on.
11
+ - In Working, a step's sections, such as Input and Output, line up under the step's number rather than its triangle, so they read as the step's.
12
+
13
+ ### Fixed
14
+ - In Muxy and other WebKit browsers, a response scrolled to its very bottom no longer moves up a little as you type in the Prompt. Studio kept rewriting the footer, the response's buttons and other labels with the same text, which can make WebKit lay the page out again; it now writes a label only when its text changes.
15
+ - In Muxy and other WebKit browsers, flicking a pane to its top no longer flashes a recovery warning ("Invalid scroll position") in the footer and nudges the panes. WebKit reports a negative position while the pane bounces past its top, and saving it failed; Studio now saves it as the top.
16
+
7
17
  ## [0.11.11] — 2026-11-04
8
18
 
9
19
  ### Added
package/ROADMAP.md CHANGED
@@ -2,9 +2,9 @@
2
2
 
3
3
  This is the current planning source of truth for Studio work. `NEXT-STAGE.md` is historical; `TODO.md` tracks smaller backlog items that are not yet assigned to a release.
4
4
 
5
- ## Current status (4 Nov 2026)
5
+ ## Current status (5 Nov 2026)
6
6
 
7
- `0.11.11` is the current release. Studio is in a feature freeze from `0.11.9`, for use in normal work. Before the freeze, `0.11.9` added the images and PDFs a REPL entry's code saved, shown under the entry, and a PDF header that fits on one line. Two changes were approved in the freeze. `0.11.10` works with pi-repl `0.12.1` so that, with both loaded, the agent is told each REPL record entry once. `0.11.11` gets Studio's URL out of a terminal too narrow to show it: `/studio --copy-url` copies it, and `PI_STUDIO_URL_FILE` keeps it in a file for programs ([#7](https://github.com/omaclaren/pi-studio/issues/7)). During the freeze, changes are limited to fixes for failures in normal use, lost data, effects on other people's processes or files, and security. [TODO.md](TODO.md) lists the known limits and what comes after the freeze.
7
+ `0.11.12` is the current release. Studio is in a feature freeze from `0.11.9`, for use in normal work. Before the freeze, `0.11.9` added the images and PDFs a REPL entry's code saved, shown under the entry, and a PDF header that fits on one line. Each release since has been an approved exception. `0.11.10` works with pi-repl `0.12.1` so that, with both loaded, the agent is told each REPL record entry once. `0.11.11` gets Studio's URL out of a terminal too narrow to show it: `/studio --copy-url` copies it, and `PI_STUDIO_URL_FILE` keeps it in a file for programs ([#7](https://github.com/omaclaren/pi-studio/issues/7)). `0.11.12` makes **Follow** one switch, fixes two WebKit scrolling glitches in Muxy, and lines Working's sections up under their step. During the freeze, changes are limited to fixes for failures in normal use, lost data, effects on other people's processes or files, and security. [TODO.md](TODO.md) lists the known limits and what comes after the freeze.
8
8
 
9
9
  `0.10.0` (14 Oct) made the buffer-first workspace the default, as **dual editor mode** (Prompt and Document), with **single editor mode** one switch away (footer button, `/studio --single`). It went through real course use as private alpha candidates 49–69. The `PI_STUDIO_*` flags described further down are development overrides only: when any is set it decides, and the mode switch is hidden.
10
10
 
@@ -514,11 +514,11 @@
514
514
  if (!option) return;
515
515
  if (option.dataset?.linkedReaderOption === "1") { option.disabled = true; return; }
516
516
  const isQuartoOption = option.value === "editor-quarto-preview";
517
- if (isWatchedFilePreview && option.value === "editor-preview") option.textContent = "Watched preview";
517
+ if (isWatchedFilePreview && option.value === "editor-preview") setTextIfChanged(option, "Watched preview");
518
518
  else if (option.value === "editor-preview" || isQuartoOption) {
519
519
  const name = bufferSwitchingEnabled ? (isStudioDocumentBufferView() ? "Document" : "Prompt") : (isEditorOnlyMode ? "Document" : "Editor");
520
520
  // New layout: "(Quarto)" keeps the picker as wide as "Response (Preview)" (Oliver, 10 Oct).
521
- option.textContent = name + (isQuartoOption ? (bufferSwitchingEnabled ? " (Quarto)" : " (Quarto Preview)") : " (Preview)");
521
+ setTextIfChanged(option, name + (isQuartoOption ? (bufferSwitchingEnabled ? " (Quarto)" : " (Quarto Preview)") : " (Preview)"));
522
522
  }
523
523
  if (isQuartoOption) option.hidden = !quartoRelevant;
524
524
  option.disabled = (isWatchedFilePreview && option.value !== "editor-preview")
@@ -1011,20 +1011,20 @@
1011
1011
  const ui = studioUiRefreshUi;
1012
1012
  if (!ui?.runStatus) return;
1013
1013
  const text = getStudioRuntimeStatusText(), rightFocused = paneFocusTarget === "right";
1014
- ui.runStatus.textContent = text; ui.runStatus.hidden = !text || rightFocused;
1015
- ui.headerRunStatus.textContent = text; ui.headerRunStatus.hidden = !text || !rightFocused;
1014
+ setTextIfChanged(ui.runStatus, text); ui.runStatus.hidden = !text || rightFocused;
1015
+ setTextIfChanged(ui.headerRunStatus, text); ui.headerRunStatus.hidden = !text || !rightFocused;
1016
1016
  if (typeof syncPromptRunIndicator === "function") syncPromptRunIndicator();
1017
1017
  const run = studioRuntimeActivity?.run, activeKind = getAbortablePendingKind();
1018
1018
  const stopping = run && (run.stopping || studioStopRequestedRunId === run.id);
1019
1019
  const ownedRun = run?.origin === "studio" && Boolean(run.requestId && run.kind);
1020
1020
  ui.headerStop.hidden = isEditorOnlyMode || !rightFocused || (!activeKind && !stopping && !ownedRun);
1021
- ui.headerStop.textContent = stopping ? "Stopping…" : "Stop";
1021
+ setTextIfChanged(ui.headerStop, stopping ? "Stopping…" : "Stop");
1022
1022
  ui.headerStop.disabled = Boolean(stopping) || !activeKind;
1023
1023
  if (run && sendRunBtn) sendRunBtn.classList.toggle("request-pending", false);
1024
1024
  if (run && !isEditorOnlyMode && sendRunBtn) {
1025
1025
  const owned = run.origin === "studio" && Boolean(run.requestId && run.kind);
1026
1026
  if (owned) {
1027
- sendRunBtn.textContent = stopping ? "Stopping…" : "Stop";
1027
+ setTextIfChanged(sendRunBtn, stopping ? "Stopping…" : "Stop");
1028
1028
  sendRunBtn.disabled = Boolean(stopping) || !activeKind;
1029
1029
  sendRunBtn.classList.toggle("request-stop-active", !stopping);
1030
1030
  } else sendRunBtn.disabled = true;
@@ -3698,9 +3698,16 @@
3698
3698
  return label.trim();
3699
3699
  }
3700
3700
 
3701
+ // Write a label only when its text changes. Rewriting the same text can make WebKit lay out
3702
+ // again, the likely reason a response scrolled to its very bottom moved up a little as the
3703
+ // footer and the response's controls were redrawn while typing (Muxy; Astra's investigation, 5 Nov).
3704
+ function setTextIfChanged(element, text) {
3705
+ if (element && element.textContent !== text) element.textContent = text;
3706
+ }
3707
+
3701
3708
  function setStudioUiRefreshButtonText(buttonEl, text) {
3702
3709
  if (!buttonEl) return;
3703
- buttonEl.textContent = text;
3710
+ setTextIfChanged(buttonEl, text);
3704
3711
  }
3705
3712
 
3706
3713
  function formatStudioFontSizeLabel(size) {
@@ -3900,7 +3907,7 @@
3900
3907
  if (!studioUiRefreshUi || !studioUiRefreshUi.reviewButton) return;
3901
3908
  const critiqueIsStop = getAbortablePendingKind() === "critique";
3902
3909
  const reviewButton = studioUiRefreshUi.reviewButton;
3903
- reviewButton.textContent = critiqueIsStop ? "Stop critique" : "Review";
3910
+ setTextIfChanged(reviewButton, critiqueIsStop ? "Stop critique" : "Review");
3904
3911
  reviewButton.classList.toggle("request-stop-active", critiqueIsStop);
3905
3912
  reviewButton.disabled = critiqueIsStop ? Boolean(critiqueBtn && critiqueBtn.disabled) : false;
3906
3913
  reviewButton.title = critiqueIsStop
@@ -3986,16 +3993,15 @@
3986
3993
  const dirty = Boolean(path && editorDiffersFromFileBackedBaseline());
3987
3994
  // Unsaved text is *Untitled* (italic): a placeholder name, not a file (Oliver, 8 Oct).
3988
3995
  const name = path ? basenameForStudioPath(path) : "Untitled";
3989
- button.textContent = name + (dirty ? " •" : "");
3996
+ setTextIfChanged(button, name + (dirty ? " •" : ""));
3990
3997
  if (path) button.classList?.remove("is-untitled"); else button.classList?.add("is-untitled");
3991
3998
  button.title = path ? path + (dirty ? " · unsaved file edits" : "") + " · File details" : "Not saved to a file · Save As…";
3992
3999
  if (studioUiRefreshUi.pathDetails) {
3993
- studioUiRefreshUi.pathDetails.textContent = path
3994
- ? path + (fileBackedBaselineText === null ? " · File baseline unavailable; disk not rechecked." : (dirty ? " · Unsaved file edits." : " · No edits since loading or saving; disk not rechecked."))
3995
- : "Not saved to a file.";
3996
4000
  const provenance = editorDraftHelpers.normalizeSourceProvenance(sourceState?.provenance);
3997
4001
  const summary = editorDraftHelpers.describeSourceProvenance(provenance);
3998
- if (summary) studioUiRefreshUi.pathDetails.textContent += " · " + summary;
4002
+ setTextIfChanged(studioUiRefreshUi.pathDetails, (path
4003
+ ? path + (fileBackedBaselineText === null ? " · File baseline unavailable; disk not rechecked." : (dirty ? " · Unsaved file edits." : " · No edits since loading or saving; disk not rechecked."))
4004
+ : "Not saved to a file.") + (summary ? " · " + summary : ""));
3999
4005
  studioUiRefreshUi.pathDetails.title = provenance
4000
4006
  ? ("Response position when loaded: " + (provenance.responseNumber ?? "unavailable") + "\nResponse identity: " + (provenance.responseId ?? "unavailable") + "\nSource information only; not a saved-file receipt.") : "";
4001
4007
  }
@@ -4203,13 +4209,17 @@
4203
4209
  rightViewMenu = makeStudioUiRefreshMenu(makeStudioUiRefreshElement("button", "", "View"), "right-view", "studio-refresh-right-view-anchor");
4204
4210
  appendStudioUiRefreshMenuSection(rightViewMenu.menu, "Display", [responseHighlightSelect, responseFontSizeSelect]);
4205
4211
  if (bufferSwitchingEnabled && !isEditorOnlyMode && !isWatchedFilePreview) {
4206
- followMenu = makeStudioUiRefreshMenu(makeStudioUiRefreshElement("button", "studio-follow-button", "Follow: on"), "follow", "studio-refresh-follow-anchor");
4207
- for (const [control, label] of [[activityTrackingSelect, "Working, while Pi runs"], [followSelect, "The latest response, when it arrives"],
4208
- [documentPreviewFollowSelect, "The Document preview, while in Document"]]) {
4209
- control?.setAttribute("aria-label", label);
4210
- for (const option of Array.from(control?.options || [])) option.textContent = label + ": " + (option.value === "off" ? "Off" : "On");
4211
- }
4212
- appendStudioUiRefreshMenuSection(followMenu.menu, "Switch this pane automatically to:", [activityTrackingSelect, followSelect, documentPreviewFollowSelect]);
4212
+ // One Follow switch (Oliver, 5 Nov). It sets Working and the latest response together; their
4213
+ // selects stay, hidden, for their state. The Document preview's own switch is under View.
4214
+ followMenu = makeStudioUiRefreshElement("button", "studio-refresh-chip studio-follow-button", "Follow: on");
4215
+ followMenu.type = "button";
4216
+ followMenu.setAttribute("aria-keyshortcuts", "Meta+Alt+A Control+Alt+A");
4217
+ followMenu.addEventListener("click", () => setStudioFollowEnabled(!isStudioFollowEnabled()));
4218
+ const followSettingsEl = makeStudioUiRefreshElement("span", "studio-follow-settings");
4219
+ followSettingsEl.hidden = true;
4220
+ for (const control of [activityTrackingSelect, followSelect]) if (control) followSettingsEl.appendChild(control);
4221
+ followMenu = { button: followMenu, anchor: makeStudioUiRefreshElement("span", "studio-refresh-menu-anchor studio-refresh-follow-anchor") };
4222
+ followMenu.anchor.append(followMenu.button, followSettingsEl);
4213
4223
  } else if (!isEditorOnlyMode && !isWatchedFilePreview) appendStudioUiRefreshMenuSection(rightViewMenu.menu, "Response updates", [followSelect]);
4214
4224
  rightToolsEl.append(headerRunStatus, headerStop);
4215
4225
  if (followMenu) rightToolsEl.appendChild(followMenu.anchor);
@@ -4267,7 +4277,7 @@
4267
4277
  if (activityTrackingSelect) activityTrackingSelect.hidden = isEditorOnlyMode || isWatchedFilePreview;
4268
4278
  appendStudioUiRefreshMenuSection(viewMenu.menu, "Workspace", [studioPaneLayoutSelect,
4269
4279
  (isEditorOnlyMode || isWatchedFilePreview || followMenu) ? null : activityTrackingSelect,
4270
- (bufferSwitchingEnabled && !followMenu) ? documentPreviewFollowSelect : null]);
4280
+ bufferSwitchingEnabled ? documentPreviewFollowSelect : null]);
4271
4281
  appendStudioUiRefreshMenuSection(viewMenu.menu, "Annotations", [annotationModeSelect, insertHeaderBtn, stripAnnotationsBtn, saveAnnotatedBtn]);
4272
4282
  // View sits after File in row 1, as the right pane's View sits in its header, so row 2 fits narrower panes (Oliver, 27 Oct).
4273
4283
  headerToolsEl.appendChild(viewMenu.anchor);
@@ -4292,7 +4302,6 @@
4292
4302
  reviewButton: reviewMenu ? reviewMenu.button : null,
4293
4303
  menus: [viewMenu, openMenu]
4294
4304
  .concat(rightViewMenu ? [rightViewMenu] : [])
4295
- .concat(followMenu ? [followMenu] : [])
4296
4305
  .concat(responseMenu ? [responseMenu] : [])
4297
4306
  .concat(contextMenu ? [contextMenu] : [])
4298
4307
  .concat(reviewMenu ? [reviewMenu] : []),
@@ -5115,9 +5124,9 @@
5115
5124
  const text = modelText + " · " + terminalText + " · " + contextDisplayText;
5116
5125
  const titleText = "Model: " + modelText + " · " + terminalDetailText + " · " + contextTitleText;
5117
5126
  if (footerMetaModelEl && footerMetaTerminalEl && footerMetaContextEl) {
5118
- footerMetaModelEl.textContent = modelText;
5119
- footerMetaTerminalEl.textContent = terminalText;
5120
- footerMetaContextEl.textContent = contextDisplayText;
5127
+ setTextIfChanged(footerMetaModelEl, modelText);
5128
+ setTextIfChanged(footerMetaTerminalEl, terminalText);
5129
+ setTextIfChanged(footerMetaContextEl, contextDisplayText);
5121
5130
  footerMetaModelEl.title = "Pi model and thinking: " + modelText;
5122
5131
  footerMetaModelEl.setAttribute("aria-haspopup", "menu");
5123
5132
  footerMetaModelEl.setAttribute("aria-expanded", footerModelMenuOpen ? "true" : "false");
@@ -5126,10 +5135,10 @@
5126
5135
  if (footerMetaTextEl) footerMetaTextEl.title = titleText;
5127
5136
  if (footerMetaEl) footerMetaEl.title = titleText;
5128
5137
  } else if (footerMetaTextEl) {
5129
- footerMetaTextEl.textContent = text;
5138
+ setTextIfChanged(footerMetaTextEl, text);
5130
5139
  footerMetaTextEl.title = titleText;
5131
5140
  } else if (footerMetaEl) {
5132
- footerMetaEl.textContent = text;
5141
+ setTextIfChanged(footerMetaEl, text);
5133
5142
  footerMetaEl.title = titleText;
5134
5143
  }
5135
5144
  updateDocumentTitle();
@@ -5330,10 +5339,11 @@
5330
5339
  // confirmation; retain a fallback if notice rendering is unavailable.
5331
5340
  const operationInNotice = operation && studioOperationNoticesEl?.isConnected && !studioOperationNoticesEl.hidden;
5332
5341
  const recoveryIssue = getStudioShownRecoveryIssue();
5333
- statusEl.textContent = recoveryIssue
5342
+ setTextIfChanged(statusEl, recoveryIssue
5334
5343
  ? "Recovery: " + recoveryIssue + (bufferRecoveryKeptClosed ? "" : " Save or copy your text before reloading. " + (operationInNotice ? "" : (operation?.message || statusMessage)))
5335
- : operationInNotice ? "" : operation?.message || statusMessage;
5336
- statusEl.className = recoveryIssue ? "warning" : operationInNotice ? "" : operation?.severity || (statusLevel || "");
5344
+ : operationInNotice ? "" : operation?.message || statusMessage);
5345
+ const statusClass = recoveryIssue ? "warning" : operationInNotice ? "" : operation?.severity || (statusLevel || "");
5346
+ if (statusEl.className !== statusClass) statusEl.className = statusClass;
5337
5347
  statusEl.title = recoveryIssue || (!operationInNotice && operation?.message) || "";
5338
5348
  if (typeof syncStudioPromptAddUndo === "function") syncStudioPromptAddUndo();
5339
5349
 
@@ -5342,9 +5352,9 @@
5342
5352
  statusLineEl.classList.toggle("with-spinner", spinnerActive);
5343
5353
  }
5344
5354
  if (statusSpinnerEl) {
5345
- statusSpinnerEl.textContent = spinnerActive
5355
+ setTextIfChanged(statusSpinnerEl, spinnerActive
5346
5356
  ? (BRAILLE_SPINNER_FRAMES[spinnerFrameIndex % BRAILLE_SPINNER_FRAMES.length] || "")
5347
- : "";
5357
+ : "");
5348
5358
  }
5349
5359
 
5350
5360
  updateFooterMeta();
@@ -5948,16 +5958,32 @@
5948
5958
  return false;
5949
5959
  }
5950
5960
 
5961
+ // Changing the Prompt's right-pane view yourself during a run turns Follow off, and it stays off
5962
+ // until you turn it on again (Oliver, 5 Nov). The view you chose stays. The classic layout has no
5963
+ // Follow switch, so there the run is paused, as before, and the next run follows again (Astra, candidate 120).
5951
5964
  function pauseStudioRunFollowing() {
5952
5965
  if (!studioRunFollowingAvailable() || !studioRunFollowing?.active) return;
5953
- studioRunFollowing.paused = true;
5954
5966
  // Hidden Prompt must also lose its temporary Working override. Never
5955
5967
  // navigate the currently visible Document on the way out.
5956
5968
  const target = getStudioPromptRunView();
5957
5969
  relinquishStudioRunWorking(!target?.selected);
5970
+ if (!studioUiRefreshUi?.followButton) studioRunFollowing.paused = true;
5971
+ else if (isStudioFollowEnabled()) setStudioFollowEnabled(false);
5958
5972
  syncStudioFollowMenu();
5959
5973
  }
5960
5974
 
5975
+ // One Follow switch in the full workspace (Oliver, 5 Nov): on, a run shows Working and then its
5976
+ // response; off, Studio leaves the Prompt's right pane alone. Turned on during a run, it goes
5977
+ // back to Working. Working is set first, so it takes the pane before the latest response could.
5978
+ function isStudioFollowEnabled() {
5979
+ return activityTrackingEnabled || latestResponseFollowingEnabled !== false;
5980
+ }
5981
+
5982
+ function setStudioFollowEnabled(enabled) {
5983
+ setActivityTrackingEnabled(enabled);
5984
+ setLatestResponseFollowingEnabled(enabled);
5985
+ }
5986
+
5961
5987
  function acquireStudioRunWorking() {
5962
5988
  const state = studioRunFollowing;
5963
5989
  if (!state?.active || state.paused || state.working || !activityTrackingEnabled) return false;
@@ -6025,9 +6051,12 @@
6025
6051
 
6026
6052
  function syncStudioFollowMenu() {
6027
6053
  if (!studioUiRefreshUi?.followButton) return;
6028
- const enabled = activityTrackingEnabled || latestResponseFollowingEnabled !== false || documentPreviewFollowingEnabled;
6029
- setStudioUiRefreshButtonText(studioUiRefreshUi.followButton, "Follow: " + (enabled ? "on" : "off")
6030
- + (enabled && studioRunFollowing?.paused ? " · run paused" : ""));
6054
+ const enabled = isStudioFollowEnabled(), button = studioUiRefreshUi.followButton;
6055
+ setStudioUiRefreshButtonText(button, "Follow: " + (enabled ? "on" : "off"));
6056
+ button.setAttribute?.("aria-pressed", enabled ? "true" : "false");
6057
+ button.title = enabled
6058
+ ? "While Pi runs, this pane shows Working, then the new response. Changing the view yourself turns this off. Click to turn off (Cmd/Ctrl+Option/Alt+A)."
6059
+ : "Studio leaves this pane alone. Click to turn on; during a run, it goes back to Working (Cmd/Ctrl+Option/Alt+A).";
6031
6060
  if (activityTrackingSelect) activityTrackingSelect.value = activityTrackingEnabled ? "on" : "off";
6032
6061
  if (followSelect) followSelect.value = latestResponseFollowingEnabled === false ? "off" : "on";
6033
6062
  if (documentPreviewFollowSelect) documentPreviewFollowSelect.value = documentPreviewFollowingEnabled ? "on" : "off";
@@ -6652,7 +6681,8 @@
6652
6681
  setStatus("Follow activity is available only in the main editable Studio workspace.", "warning");
6653
6682
  return false;
6654
6683
  }
6655
- setActivityTrackingEnabled(!activityTrackingEnabled);
6684
+ if (studioUiRefreshUi?.followButton) setStudioFollowEnabled(!isStudioFollowEnabled());
6685
+ else setActivityTrackingEnabled(!activityTrackingEnabled);
6656
6686
  return true;
6657
6687
  }
6658
6688
 
@@ -7473,7 +7503,7 @@
7473
7503
  ? responseHistoryIndex + 1
7474
7504
  : 0;
7475
7505
  if (historyIndexBadgeEl) {
7476
- historyIndexBadgeEl.textContent = "Branch history: " + selected + "/" + total;
7506
+ setTextIfChanged(historyIndexBadgeEl, "Branch history: " + selected + "/" + total);
7477
7507
  }
7478
7508
  if (historyPrevBtn) {
7479
7509
  historyPrevBtn.disabled = total <= 1 || responseHistoryIndex <= 0;
@@ -7489,12 +7519,12 @@
7489
7519
  const hasPrompt = Boolean(selectedItem && typeof selectedItem.prompt === "string" && selectedItem.prompt.trim());
7490
7520
  if (loadHistoryPromptBtn) {
7491
7521
  loadHistoryPromptBtn.disabled = uiBusy || responseReplacementPending || !hasPrompt || (bufferSwitchingEnabled && isStudioDocumentBufferView());
7492
- loadHistoryPromptBtn.textContent = getHistoryPromptButtonLabel(selectedItem);
7522
+ setTextIfChanged(loadHistoryPromptBtn, getHistoryPromptButtonLabel(selectedItem));
7493
7523
  loadHistoryPromptBtn.title = getHistoryPromptButtonTitle(selectedItem);
7494
7524
  }
7495
7525
  if (copyResponsePromptBtn) {
7496
7526
  copyResponsePromptBtn.disabled = uiBusy || !hasPrompt;
7497
- copyResponsePromptBtn.textContent = hasPrompt ? "Copy response prompt" : "Copy response prompt (unavailable)";
7527
+ setTextIfChanged(copyResponsePromptBtn, hasPrompt ? "Copy response prompt" : "Copy response prompt (unavailable)");
7498
7528
  copyResponsePromptBtn.title = getHistoryPromptCopyTitle(selectedItem);
7499
7529
  }
7500
7530
  syncShowMeButton();
@@ -17183,23 +17213,23 @@
17183
17213
  loadCritiqueFullBtn.hidden = !isCritiqueResponse;
17184
17214
 
17185
17215
  loadResponseBtn.disabled = uiBusy || !hasResponse || responseLoaded || isCritiqueResponse || (bufferSwitchingEnabled && isStudioDocumentBufferView());
17186
- loadResponseBtn.textContent = responseLoaded ? "Response already in editor" : "Load response";
17216
+ setTextIfChanged(loadResponseBtn, responseLoaded ? "Response already in editor" : "Load response");
17187
17217
 
17188
17218
  const annotationWorkspaceReady = responseLoaded
17189
17219
  && editorView === "markdown"
17190
17220
  && rightView === "editor-preview"
17191
17221
  && paneFocusTarget === "off";
17192
17222
  annotateResponseBtn.disabled = uiBusy || !hasResponse || isCritiqueResponse || annotationWorkspaceReady || (bufferSwitchingEnabled && isStudioDocumentBufferView());
17193
- annotateResponseBtn.textContent = annotationWorkspaceReady ? "Response ready to annotate" : "Annotate response";
17223
+ setTextIfChanged(annotateResponseBtn, annotationWorkspaceReady ? "Response ready to annotate" : "Annotate response");
17194
17224
  annotateResponseBtn.title = annotationWorkspaceReady
17195
17225
  ? "The selected response is exactly in the raw editor with Editor Preview open."
17196
17226
  : "Load the selected response into the raw editor and show Editor Preview. Ask before replacing unsubmitted or unsaved work. Shortcut: Cmd/Ctrl+Option/Alt+Enter.";
17197
17227
 
17198
17228
  loadCritiqueNotesBtn.disabled = uiBusy || !isCritiqueResponse || !critiqueNotes || critiqueNotesLoaded || (bufferSwitchingEnabled && isStudioDocumentBufferView());
17199
- loadCritiqueNotesBtn.textContent = critiqueNotesLoaded ? "Critique notes already in editor" : "Load critique notes into editor";
17229
+ setTextIfChanged(loadCritiqueNotesBtn, critiqueNotesLoaded ? "Critique notes already in editor" : "Load critique notes into editor");
17200
17230
 
17201
17231
  loadCritiqueFullBtn.disabled = uiBusy || !isCritiqueResponse || responseLoaded || (bufferSwitchingEnabled && isStudioDocumentBufferView());
17202
- loadCritiqueFullBtn.textContent = responseLoaded ? "Full critique already in editor" : "Load full critique into editor";
17232
+ setTextIfChanged(loadCritiqueFullBtn, responseLoaded ? "Full critique already in editor" : "Load full critique into editor");
17203
17233
 
17204
17234
  // The Document can show responses, but they load or annotate into the Prompt only (Sol, 8 Oct).
17205
17235
  const documentView = bufferSwitchingEnabled && isStudioDocumentBufferView();
@@ -17210,7 +17240,7 @@
17210
17240
  if (documentView) annotateResponseBtn.title = "Return to Prompt to load or annotate this response.";
17211
17241
 
17212
17242
  copyResponseBtn.disabled = uiBusy || !hasResponse;
17213
- copyResponseBtn.textContent = "Copy response";
17243
+ setTextIfChanged(copyResponseBtn, "Copy response");
17214
17244
 
17215
17245
  const rightPaneShowsPreview = rightView === "preview" || rightView === "editor-preview";
17216
17246
  const exportingReplJournal = rightView === "repl";
@@ -17249,11 +17279,11 @@
17249
17279
  }
17250
17280
  if (exportPdfBtn) {
17251
17281
  exportPdfBtn.disabled = exportBusy || !canExportPreview;
17252
- exportPdfBtn.textContent = previewExportInProgress
17282
+ setTextIfChanged(exportPdfBtn, previewExportInProgress
17253
17283
  ? "Exporting…"
17254
17284
  : (sideQuestionMarkdownExportRequest
17255
17285
  ? "Saving…"
17256
- : (exportingSideThread ? "Export thread" : (exportingReplJournal ? "Export record" : "Export right preview")));
17286
+ : (exportingSideThread ? "Export thread" : (exportingReplJournal ? "Export record" : "Export right preview"))));
17257
17287
  if (rightView === "trace") {
17258
17288
  exportPdfBtn.title = "Working view does not support preview export.";
17259
17289
  } else if (rightView === "files") {
@@ -17283,7 +17313,7 @@
17283
17313
  if (exportSideThreadRenderSeparatorEl) exportSideThreadRenderSeparatorEl.hidden = !exportingSideThread;
17284
17314
  if (exportPreviewPdfStudioBtn) {
17285
17315
  exportPreviewPdfStudioBtn.disabled = exportBusy || !canExportPreview || isHtmlArtifactPreview || sideThreadRenderTooLarge;
17286
- exportPreviewPdfStudioBtn.textContent = documentHostingEnabled ? "Export PDF and open in browser" : "Export PDF and Open in Studio";
17316
+ setTextIfChanged(exportPreviewPdfStudioBtn, documentHostingEnabled ? "Export PDF and open in browser" : "Export PDF and Open in Studio");
17287
17317
  exportPreviewPdfStudioBtn.title = documentHostingEnabled && canExportPreview && !isHtmlArtifactPreview && !sideThreadRenderTooLarge
17288
17318
  ? "Export as PDF and open it in the browser's PDF viewer."
17289
17319
  : sideThreadRenderTooLarge
@@ -17295,8 +17325,8 @@
17295
17325
  if (exportPreviewPdfBtn) {
17296
17326
  exportPreviewPdfBtn.disabled = exportBusy || !canExportPreview || isHtmlArtifactPreview || sideThreadRenderTooLarge;
17297
17327
  // Trial48 finding 7: the same choices, in the same words, for PDF and HTML.
17298
- if (documentHostingEnabled) exportPreviewPdfBtn.textContent = "Export PDF and open in system viewer";
17299
- if (documentHostingEnabled && exportPreviewHtmlBtn) exportPreviewHtmlBtn.textContent = "Export HTML and open in browser";
17328
+ if (documentHostingEnabled) setTextIfChanged(exportPreviewPdfBtn, "Export PDF and open in system viewer");
17329
+ if (documentHostingEnabled && exportPreviewHtmlBtn) setTextIfChanged(exportPreviewHtmlBtn, "Export HTML and open in browser");
17300
17330
  exportPreviewPdfBtn.title = sideThreadRenderTooLarge
17301
17331
  ? "This transcript is too large for rendered export; save or copy the Markdown instead."
17302
17332
  : (isHtmlArtifactPreview
@@ -17305,7 +17335,7 @@
17305
17335
  }
17306
17336
  if (exportPreviewHtmlStudioBtn) {
17307
17337
  exportPreviewHtmlStudioBtn.disabled = exportBusy || !canExportPreview || sideThreadRenderTooLarge;
17308
- exportPreviewHtmlStudioBtn.textContent = documentHostingEnabled ? "Export HTML and open in Document" : "Export HTML and Open in Studio";
17338
+ setTextIfChanged(exportPreviewHtmlStudioBtn, documentHostingEnabled ? "Export HTML and open in Document" : "Export HTML and Open in Studio");
17309
17339
  exportPreviewHtmlStudioBtn.title = documentHostingEnabled
17310
17340
  ? "Export as HTML and open it as a Document. Existing files are never overwritten."
17311
17341
  : sideThreadRenderTooLarge
@@ -17339,7 +17369,7 @@
17339
17369
  }
17340
17370
 
17341
17371
  pullLatestBtn.disabled = uiBusy || followLatest;
17342
- pullLatestBtn.textContent = queuedLatestResponse ? "Fetch latest response *" : "Fetch latest response";
17372
+ setTextIfChanged(pullLatestBtn, queuedLatestResponse ? "Fetch latest response *" : "Fetch latest response");
17343
17373
 
17344
17374
  updateSyncBadge(normalizedEditor);
17345
17375
  syncStudioQuartoDirtyUi();
@@ -17583,7 +17613,7 @@
17583
17613
  const hasSuggestionForCurrentText = Boolean(completionSuggestionState && sourceTextEl && sourceTextEl.value === completionSuggestionState.baseText);
17584
17614
  const editorEmpty = !String(sourceTextEl.value || "").trim();
17585
17615
  suggestCompletionBtn.disabled = isWatchedFilePreview || wsState !== "Ready" || (!completionSuggestionInFlight && (uiBusy || (editorEmpty && !isNextPromptEditor())));
17586
- suggestCompletionBtn.textContent = completionSuggestionInFlight ? "Stop" : (hasSuggestionForCurrentText ? "Try another" : "Suggest");
17616
+ setTextIfChanged(suggestCompletionBtn, completionSuggestionInFlight ? "Stop" : (hasSuggestionForCurrentText ? "Try another" : "Suggest"));
17587
17617
  suggestCompletionBtn.title = completionSuggestionInFlight
17588
17618
  ? "Stop the current suggestion request."
17589
17619
  : (hasSuggestionForCurrentText
@@ -17593,7 +17623,7 @@
17593
17623
  : "Ask for a short completion at the editor cursor. Shortcut: Option/Alt+Tab where available, or Cmd/Ctrl+Shift+Space from the editor."));
17594
17624
  if (footerSuggestBtn) {
17595
17625
  footerSuggestBtn.disabled = suggestCompletionBtn.disabled;
17596
- footerSuggestBtn.textContent = suggestCompletionBtn.textContent;
17626
+ setTextIfChanged(footerSuggestBtn, suggestCompletionBtn.textContent);
17597
17627
  footerSuggestBtn.title = suggestCompletionBtn.title;
17598
17628
  }
17599
17629
  }
@@ -19947,7 +19977,7 @@
19947
19977
  function syncCompletionSuggestionContextUi() {
19948
19978
  syncCompletionSuggestionModelUi();
19949
19979
  if (suggestCompletionOptionsBtn) {
19950
- suggestCompletionOptionsBtn.textContent = studioUiRefreshUi?.fileButton ? "File" : "Source & context";
19980
+ setTextIfChanged(suggestCompletionOptionsBtn, studioUiRefreshUi?.fileButton ? "File" : "Source & context");
19951
19981
  suggestCompletionOptionsBtn.title = studioUiRefreshUi?.fileButton ? (studioUiRefreshUi.reviewButton ? "File actions, details and workspace recovery. Suggestion settings are under Review." : "File actions, details, workspace recovery and suggestion settings.") : "Document source, working directory, status, and suggestion settings.";
19952
19982
  suggestCompletionOptionsBtn.setAttribute("aria-label", studioUiRefreshUi?.fileButton ? "File" : suggestCompletionOptionsBtn.title);
19953
19983
  }
@@ -28802,7 +28832,7 @@
28802
28832
 
28803
28833
  if (isEditorOnlyMode) {
28804
28834
  if (sendRunBtn) {
28805
- sendRunBtn.textContent = "Run editor text";
28835
+ setTextIfChanged(sendRunBtn, "Run editor text");
28806
28836
  sendRunBtn.classList.remove("request-stop-active", "repl-secondary-action");
28807
28837
  sendRunBtn.disabled = true;
28808
28838
  sendRunBtn.title = "Run is unavailable in editor-only mode.";
@@ -28818,7 +28848,7 @@
28818
28848
  sendReplBtn.hidden = !showReplSend;
28819
28849
  sendReplBtn.disabled = !showReplSend || wsState === "Disconnected" || uiBusy || replBusy || !hasReplSession;
28820
28850
  sendReplBtn.classList.toggle("repl-primary-action", showReplSend);
28821
- sendReplBtn.textContent = showReplSend ? withStudioShortcutLabel(replSendMode === "literate" ? "Send selection/chunks" : "Send to REPL", "repl-send") : "Send to REPL";
28851
+ setTextIfChanged(sendReplBtn, showReplSend ? withStudioShortcutLabel(replSendMode === "literate" ? "Send selection/chunks" : "Send to REPL", "repl-send") : "Send to REPL");
28822
28852
  sendReplBtn.title = hasReplSession
28823
28853
  ? (replSendMode === "literate"
28824
28854
  ? "Literate send: selection, current fenced code chunk, or all matching chunks if the cursor is outside a chunk. Shortcut: " + replSendShortcut + "."
@@ -28837,7 +28867,7 @@
28837
28867
  }
28838
28868
  syncReplEchoModeSelect(showReplSend);
28839
28869
  if (critiqueBtn) {
28840
- critiqueBtn.textContent = "Critique text";
28870
+ setTextIfChanged(critiqueBtn, "Critique text");
28841
28871
  critiqueBtn.classList.remove("request-stop-active");
28842
28872
  critiqueBtn.disabled = true;
28843
28873
  critiqueBtn.title = "Critique is unavailable in editor-only mode.";
@@ -28852,7 +28882,7 @@
28852
28882
  }
28853
28883
 
28854
28884
  if (sendRunBtn) {
28855
- sendRunBtn.textContent = directIsStop ? "Stop" : (documentView ? "Return to Prompt" : (bufferSwitchingEnabled ? "Run Prompt" : (rightView === "repl" ? withStudioShortcutLabel("Run editor text", "run") : "Run editor text")));
28885
+ setTextIfChanged(sendRunBtn, directIsStop ? "Stop" : (documentView ? "Return to Prompt" : (bufferSwitchingEnabled ? "Run Prompt" : (rightView === "repl" ? withStudioShortcutLabel("Run editor text", "run") : "Run editor text"))));
28856
28886
  // The new-layout Document has the Prompt tab just above, so no Return to Prompt here (Oliver, 10 Oct).
28857
28887
  sendRunBtn.hidden = workspaceLayout && documentView && !directIsStop;
28858
28888
  sendRunBtn.classList.toggle("request-stop-active", directIsStop);
@@ -28891,7 +28921,7 @@
28891
28921
  sendReplBtn.hidden = !showReplSend;
28892
28922
  sendReplBtn.disabled = !showReplSend || wsState === "Disconnected" || uiBusy || replBusy || !hasReplSession;
28893
28923
  sendReplBtn.classList.toggle("repl-primary-action", showReplSend && !workspaceLayout);
28894
- sendReplBtn.textContent = showReplSend ? (workspaceLayout ? studioReplSendLabel() : withStudioShortcutLabel(replSendMode === "literate" ? "Send selection/chunks" : "Send to REPL", "repl-send")) : "Send to REPL";
28924
+ setTextIfChanged(sendReplBtn, showReplSend ? (workspaceLayout ? studioReplSendLabel() : withStudioShortcutLabel(replSendMode === "literate" ? "Send selection/chunks" : "Send to REPL", "repl-send")) : "Send to REPL");
28895
28925
  sendReplBtn.title = hasReplSession
28896
28926
  ? (workspaceLayout
28897
28927
  ? (replSendMode === "literate"
@@ -28915,7 +28945,7 @@
28915
28945
  syncReplEchoModeSelect(rightView === "repl");
28916
28946
 
28917
28947
  if (critiqueBtn) {
28918
- critiqueBtn.textContent = critiqueIsStop ? "Stop" : "Critique text";
28948
+ setTextIfChanged(critiqueBtn, critiqueIsStop ? "Stop" : "Critique text");
28919
28949
  critiqueBtn.classList.toggle("request-stop-active", critiqueIsStop);
28920
28950
  critiqueBtn.disabled = critiqueIsStop ? wsState === "Disconnected" : (uiBusy || canQueueSteering);
28921
28951
  critiqueBtn.title = critiqueIsStop
@@ -28927,7 +28957,7 @@
28927
28957
  : "Critique text with [an: ...] markers stripped."));
28928
28958
  }
28929
28959
  if (quizBtn) {
28930
- quizBtn.textContent = hasResumableQuiz() ? "Resume quiz" : "Quiz me";
28960
+ setTextIfChanged(quizBtn, hasResumableQuiz() ? "Resume quiz" : "Quiz me");
28931
28961
  quizBtn.disabled = wsState === "Disconnected" || uiBusy || canQueueSteering;
28932
28962
  quizBtn.title = canQueueSteering
28933
28963
  ? "Quiz is unavailable while Run editor text is active."
@@ -30985,7 +31015,7 @@
30985
31015
  if (!editorModeBtn) return;
30986
31016
  editorModeBtn.hidden = !studioEditorModeSwitchable;
30987
31017
  if (!studioEditorModeSwitchable) return;
30988
- editorModeBtn.textContent = studioEditorMode === "dual" ? "Switch to single editor" : "Switch to dual editor";
31018
+ setTextIfChanged(editorModeBtn, studioEditorMode === "dual" ? "Switch to single editor" : "Switch to dual editor");
30989
31019
  const wait = studioEditorModeAttempt ? "Switching…" : studioEditorModeSwitchWaitReason();
30990
31020
  editorModeBtn.disabled = Boolean(wait);
30991
31021
  editorModeBtn.title = wait || (studioEditorMode === "dual" ? "Use one editor, as in earlier Studio. Studio restarts and reopens here."
@@ -33421,6 +33451,12 @@
33421
33451
  if (getDocumentPreviewFollowOwner()) restoreDocumentFollowScroll(documentPreviewFollowScrolls.get(restoredFollowBuffer.id) ?? 0);
33422
33452
  renderSourcePreview();
33423
33453
  workspacePersistenceReady = true;
33454
+ // Follow is one switch now (Oliver, 5 Nov): a saved setting from the three-switch menu with only
33455
+ // Working or only the latest response on counts as on.
33456
+ if (studioUiRefreshUi?.followButton) {
33457
+ ensureLatestResponseFollowingPreference();
33458
+ if (activityTrackingEnabled !== (latestResponseFollowingEnabled !== false)) setStudioFollowEnabled(true);
33459
+ }
33424
33460
  initializePromptRunIndicator();
33425
33461
  syncStudioRunFollowingFromMessage({ type: "initialization" });
33426
33462
  // Hosting connects before recovery initialization; no later socket-ready
package/client/studio.css CHANGED
@@ -7755,6 +7755,8 @@
7755
7755
  body.studio-ui-refresh #rightSectionHeader .studio-follow-button:focus-visible {
7756
7756
  outline: none; text-decoration: underline; text-underline-offset: 3px;
7757
7757
  }
7758
+ /* Follow is a switch, not a menu (Oliver, 5 Nov): no menu caret. */
7759
+ body.studio-ui-refresh #rightSectionHeader .studio-follow-button::after { content: none; }
7758
7760
  .studio-operation-notices { padding: 4px 12px; font-size: 12px; color: var(--warn); }
7759
7761
  .studio-operation-notice { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 3px 0; overflow-wrap: anywhere; }
7760
7762
  .studio-operation-notice button { font-size: 12px; padding: 1px 4px; }
@@ -7906,6 +7908,9 @@
7906
7908
  body.studio-workspace-layout details.trace-step { border-color: var(--panel-border); background: var(--panel); box-shadow: none; }
7907
7909
  body.studio-workspace-layout details.trace-step > summary.trace-card-header { padding: 9px 14px; }
7908
7910
  body.studio-workspace-layout details.trace-step > .trace-step-body { gap: 4px; border-top: 1px solid var(--panel-border); padding: 8px 14px 10px; }
7911
+ /* Oliver, 5 Nov: a step's sections line up under its number, not its triangle, so they read as the step's:
7912
+ the line's padding, then the triangle (1em at 9px) and the line's gap. */
7913
+ body.studio-workspace-layout details.trace-step > .trace-step-body { padding-left: calc(14px + 9px + 7px); }
7909
7914
  body.studio-workspace-layout .trace-step .trace-output-wrap,
7910
7915
  body.studio-workspace-layout .trace-step .trace-output,
7911
7916
  body.studio-workspace-layout .trace-step .trace-tool-fields,
package/index.ts CHANGED
@@ -14107,7 +14107,7 @@ ${cssVarsBlock}
14107
14107
  <div><dt>Option/Alt+=</dt><dd>Increase the active pane's text size when not editing text</dd></div>
14108
14108
  <div><dt>Option/Alt+-</dt><dd>Decrease the active pane's text size when not editing text</dd></div>
14109
14109
  <div><dt>Option/Alt+0</dt><dd>Reset the active pane's text size when not editing text</dd></div>
14110
- <div class="shortcuts-full-only"><dt>Cmd/Ctrl+Option/Alt+A</dt><dd>Toggle Follow activity in the main editable Studio workspace</dd></div>
14110
+ <div class="shortcuts-full-only"><dt>Cmd/Ctrl+Option/Alt+A</dt><dd>Turn Follow on or off in the main editable Studio workspace</dd></div>
14111
14111
  <div><dt>Cmd/Ctrl+Option/Alt+Shift+R</dt><dd>Refresh the focused or visible PDF preview from disk</dd></div>
14112
14112
  </dl>
14113
14113
  </section>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-studio",
3
- "version": "0.11.11",
3
+ "version": "0.11.12",
4
4
  "description": "Two-pane browser workspace for pi with prompt/response editing, annotations, critiques, active quiz, prompt/response history, live previews, and tmux-backed REPL/literate REPL workflows",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -8,6 +8,15 @@ import { createStudioDocumentOpenStorage } from "./studio-document-open-storage.
8
8
 
9
9
  const fail = (reason, message) => ({ ok: false, reason, message });
10
10
  const same = (a, b) => JSON.stringify(a) === JSON.stringify(b);
11
+ // A page's live scroll positions. WebKit reports a negative one while a pane bounces past its top,
12
+ // which is the top; saving it failed as "Invalid scroll position" and flashed a recovery warning
13
+ // (Oliver, Muxy, 5 Nov). The store still refuses a negative position given to it explicitly.
14
+ const LIVE_SCROLL_FIELDS = ["scrollTop", "previewScrollTop", "rightScrollTop"];
15
+ function liveView(view) {
16
+ const next = { ...view };
17
+ for (const field of LIVE_SCROLL_FIELDS) if (typeof next[field] === "number" && Number.isFinite(next[field]) && next[field] < 0) next[field] = 0;
18
+ return next;
19
+ }
11
20
 
12
21
  function literalStudioBufferLabel(source) {
13
22
  // Provenance is not a link or a resource/terminal grant. Separate boundary
@@ -149,10 +158,10 @@ export function createStudioBufferClient(options) {
149
158
  next = createStudioBuffer({ ...current, text: editor.text, sourceState: editor.sourceState,
150
159
  baselineText: editor.sourceState.path ? baselineText : (current.sourceState.path ? null : current.baselineText),
151
160
  diskRevision: editor.diskRevision, resourceDir: editor.resourceDir,
152
- view: { ...current.view, editorView: editor.editorView, rightView: editor.rightView, editorLanguage: editor.editorLanguage,
161
+ view: liveView({ ...current.view, editorView: editor.editorView, rightView: editor.rightView, editorLanguage: editor.editorLanguage,
153
162
  followLatest: editor.followLatest, responseHistoryIndex: editor.responseHistoryIndex,
154
163
  selectionStart: editor.selectionStart, selectionEnd: editor.selectionEnd, scrollTop: editor.scrollTop,
155
- ...extra.view }, metadata: { ...current.metadata, ...extra.metadata } });
164
+ ...extra.view }), metadata: { ...current.metadata, ...extra.metadata } });
156
165
  } catch (error) { return fail(error.reason || "invalid-state", error.message); }
157
166
  if (current.text === next.text && current.baselineText === next.baselineText && current.diskRevision === next.diskRevision
158
167
  && current.resourceDir === next.resourceDir && same(current.sourceState, next.sourceState)