pi-studio 0.11.11 → 0.11.13

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,21 @@ All notable changes to `pi-studio` are documented here.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.11.13] — 2026-11-06
8
+
9
+ ### Fixed
10
+ - A workaround for a crash in Muxy 2.3.0's browser on Studio's tab title. Muxy can crash on some non-ASCII characters in a title, and Studio's title had them, such as the ellipsis in "Running…". Studio's tab titles are now plain ASCII, with " | " between their parts: "…" becomes "...", "·" and "—" within a part become "-", "●" becomes "*", "π" becomes "pi", accents are dropped, and each remaining run of other characters becomes "?". This applies to Studio's pages, the tab that waits for a new Studio tab, and the image viewer. Only titles change; page content keeps its characters. Files that open as themselves in a tab, such as a PDF, keep the title the browser gives them.
11
+
12
+ ## [0.11.12] — 2026-11-05
13
+
14
+ ### Changed
15
+ - **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.
16
+ - 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.
17
+
18
+ ### Fixed
19
+ - 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.
20
+ - 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.
21
+
7
22
  ## [0.11.11] — 2026-11-04
8
23
 
9
24
  ### 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 (6 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.13` 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. `0.11.13` gives Studio's tabs ASCII titles, working around a crash in Muxy 2.3.0's browser on the ellipsis in Studio's title. 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] : []),
@@ -4887,6 +4896,23 @@
4887
4896
  return "data:image/svg+xml," + encodeURIComponent(svg);
4888
4897
  }
4889
4898
 
4899
+ // shared/studio-title.js explains: Muxy 2.3.0's browser can crash on a non-ASCII tab title.
4900
+ // test/studio-title.test.js checks this copy against that one.
4901
+ function toStudioAsciiTitle(value) {
4902
+ return String(value ?? "")
4903
+ .replace(/…/g, "...")
4904
+ .replace(/[·•–—−]/g, "-")
4905
+ .replace(/●/g, "*")
4906
+ .replace(/[‘’]/g, "'")
4907
+ .replace(/[“”]/g, "\"")
4908
+ .replace(/π/g, "pi")
4909
+ .normalize("NFKD")
4910
+ .replace(/[̀-ͯ]/g, "")
4911
+ .replace(/\s+/g, " ")
4912
+ .replace(/[^\x20-\x7e]+/g, "?")
4913
+ .trim();
4914
+ }
4915
+
4890
4916
  function updateDocumentTitle() {
4891
4917
  const modelText = modelLabel && modelLabel.trim() ? modelLabel.trim() : "none";
4892
4918
  const terminalText = terminalSessionLabel && terminalSessionLabel.trim() ? terminalSessionLabel.trim() : "unknown";
@@ -4898,7 +4924,7 @@
4898
4924
  const titlePrefix = getDynamicTitlePrefix();
4899
4925
  if (titlePrefix) titleParts.unshift(titlePrefix);
4900
4926
 
4901
- const nextTitle = titleParts.join(" · ");
4927
+ const nextTitle = toStudioAsciiTitle(titleParts.join(" | "));
4902
4928
  if (document.title !== nextTitle) {
4903
4929
  document.title = nextTitle;
4904
4930
  }
@@ -5115,9 +5141,9 @@
5115
5141
  const text = modelText + " · " + terminalText + " · " + contextDisplayText;
5116
5142
  const titleText = "Model: " + modelText + " · " + terminalDetailText + " · " + contextTitleText;
5117
5143
  if (footerMetaModelEl && footerMetaTerminalEl && footerMetaContextEl) {
5118
- footerMetaModelEl.textContent = modelText;
5119
- footerMetaTerminalEl.textContent = terminalText;
5120
- footerMetaContextEl.textContent = contextDisplayText;
5144
+ setTextIfChanged(footerMetaModelEl, modelText);
5145
+ setTextIfChanged(footerMetaTerminalEl, terminalText);
5146
+ setTextIfChanged(footerMetaContextEl, contextDisplayText);
5121
5147
  footerMetaModelEl.title = "Pi model and thinking: " + modelText;
5122
5148
  footerMetaModelEl.setAttribute("aria-haspopup", "menu");
5123
5149
  footerMetaModelEl.setAttribute("aria-expanded", footerModelMenuOpen ? "true" : "false");
@@ -5126,10 +5152,10 @@
5126
5152
  if (footerMetaTextEl) footerMetaTextEl.title = titleText;
5127
5153
  if (footerMetaEl) footerMetaEl.title = titleText;
5128
5154
  } else if (footerMetaTextEl) {
5129
- footerMetaTextEl.textContent = text;
5155
+ setTextIfChanged(footerMetaTextEl, text);
5130
5156
  footerMetaTextEl.title = titleText;
5131
5157
  } else if (footerMetaEl) {
5132
- footerMetaEl.textContent = text;
5158
+ setTextIfChanged(footerMetaEl, text);
5133
5159
  footerMetaEl.title = titleText;
5134
5160
  }
5135
5161
  updateDocumentTitle();
@@ -5330,10 +5356,11 @@
5330
5356
  // confirmation; retain a fallback if notice rendering is unavailable.
5331
5357
  const operationInNotice = operation && studioOperationNoticesEl?.isConnected && !studioOperationNoticesEl.hidden;
5332
5358
  const recoveryIssue = getStudioShownRecoveryIssue();
5333
- statusEl.textContent = recoveryIssue
5359
+ setTextIfChanged(statusEl, recoveryIssue
5334
5360
  ? "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 || "");
5361
+ : operationInNotice ? "" : operation?.message || statusMessage);
5362
+ const statusClass = recoveryIssue ? "warning" : operationInNotice ? "" : operation?.severity || (statusLevel || "");
5363
+ if (statusEl.className !== statusClass) statusEl.className = statusClass;
5337
5364
  statusEl.title = recoveryIssue || (!operationInNotice && operation?.message) || "";
5338
5365
  if (typeof syncStudioPromptAddUndo === "function") syncStudioPromptAddUndo();
5339
5366
 
@@ -5342,9 +5369,9 @@
5342
5369
  statusLineEl.classList.toggle("with-spinner", spinnerActive);
5343
5370
  }
5344
5371
  if (statusSpinnerEl) {
5345
- statusSpinnerEl.textContent = spinnerActive
5372
+ setTextIfChanged(statusSpinnerEl, spinnerActive
5346
5373
  ? (BRAILLE_SPINNER_FRAMES[spinnerFrameIndex % BRAILLE_SPINNER_FRAMES.length] || "")
5347
- : "";
5374
+ : "");
5348
5375
  }
5349
5376
 
5350
5377
  updateFooterMeta();
@@ -5948,16 +5975,32 @@
5948
5975
  return false;
5949
5976
  }
5950
5977
 
5978
+ // Changing the Prompt's right-pane view yourself during a run turns Follow off, and it stays off
5979
+ // until you turn it on again (Oliver, 5 Nov). The view you chose stays. The classic layout has no
5980
+ // Follow switch, so there the run is paused, as before, and the next run follows again (Astra, candidate 120).
5951
5981
  function pauseStudioRunFollowing() {
5952
5982
  if (!studioRunFollowingAvailable() || !studioRunFollowing?.active) return;
5953
- studioRunFollowing.paused = true;
5954
5983
  // Hidden Prompt must also lose its temporary Working override. Never
5955
5984
  // navigate the currently visible Document on the way out.
5956
5985
  const target = getStudioPromptRunView();
5957
5986
  relinquishStudioRunWorking(!target?.selected);
5987
+ if (!studioUiRefreshUi?.followButton) studioRunFollowing.paused = true;
5988
+ else if (isStudioFollowEnabled()) setStudioFollowEnabled(false);
5958
5989
  syncStudioFollowMenu();
5959
5990
  }
5960
5991
 
5992
+ // One Follow switch in the full workspace (Oliver, 5 Nov): on, a run shows Working and then its
5993
+ // response; off, Studio leaves the Prompt's right pane alone. Turned on during a run, it goes
5994
+ // back to Working. Working is set first, so it takes the pane before the latest response could.
5995
+ function isStudioFollowEnabled() {
5996
+ return activityTrackingEnabled || latestResponseFollowingEnabled !== false;
5997
+ }
5998
+
5999
+ function setStudioFollowEnabled(enabled) {
6000
+ setActivityTrackingEnabled(enabled);
6001
+ setLatestResponseFollowingEnabled(enabled);
6002
+ }
6003
+
5961
6004
  function acquireStudioRunWorking() {
5962
6005
  const state = studioRunFollowing;
5963
6006
  if (!state?.active || state.paused || state.working || !activityTrackingEnabled) return false;
@@ -6025,9 +6068,12 @@
6025
6068
 
6026
6069
  function syncStudioFollowMenu() {
6027
6070
  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" : ""));
6071
+ const enabled = isStudioFollowEnabled(), button = studioUiRefreshUi.followButton;
6072
+ setStudioUiRefreshButtonText(button, "Follow: " + (enabled ? "on" : "off"));
6073
+ button.setAttribute?.("aria-pressed", enabled ? "true" : "false");
6074
+ button.title = enabled
6075
+ ? "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)."
6076
+ : "Studio leaves this pane alone. Click to turn on; during a run, it goes back to Working (Cmd/Ctrl+Option/Alt+A).";
6031
6077
  if (activityTrackingSelect) activityTrackingSelect.value = activityTrackingEnabled ? "on" : "off";
6032
6078
  if (followSelect) followSelect.value = latestResponseFollowingEnabled === false ? "off" : "on";
6033
6079
  if (documentPreviewFollowSelect) documentPreviewFollowSelect.value = documentPreviewFollowingEnabled ? "on" : "off";
@@ -6652,7 +6698,8 @@
6652
6698
  setStatus("Follow activity is available only in the main editable Studio workspace.", "warning");
6653
6699
  return false;
6654
6700
  }
6655
- setActivityTrackingEnabled(!activityTrackingEnabled);
6701
+ if (studioUiRefreshUi?.followButton) setStudioFollowEnabled(!isStudioFollowEnabled());
6702
+ else setActivityTrackingEnabled(!activityTrackingEnabled);
6656
6703
  return true;
6657
6704
  }
6658
6705
 
@@ -7473,7 +7520,7 @@
7473
7520
  ? responseHistoryIndex + 1
7474
7521
  : 0;
7475
7522
  if (historyIndexBadgeEl) {
7476
- historyIndexBadgeEl.textContent = "Branch history: " + selected + "/" + total;
7523
+ setTextIfChanged(historyIndexBadgeEl, "Branch history: " + selected + "/" + total);
7477
7524
  }
7478
7525
  if (historyPrevBtn) {
7479
7526
  historyPrevBtn.disabled = total <= 1 || responseHistoryIndex <= 0;
@@ -7489,12 +7536,12 @@
7489
7536
  const hasPrompt = Boolean(selectedItem && typeof selectedItem.prompt === "string" && selectedItem.prompt.trim());
7490
7537
  if (loadHistoryPromptBtn) {
7491
7538
  loadHistoryPromptBtn.disabled = uiBusy || responseReplacementPending || !hasPrompt || (bufferSwitchingEnabled && isStudioDocumentBufferView());
7492
- loadHistoryPromptBtn.textContent = getHistoryPromptButtonLabel(selectedItem);
7539
+ setTextIfChanged(loadHistoryPromptBtn, getHistoryPromptButtonLabel(selectedItem));
7493
7540
  loadHistoryPromptBtn.title = getHistoryPromptButtonTitle(selectedItem);
7494
7541
  }
7495
7542
  if (copyResponsePromptBtn) {
7496
7543
  copyResponsePromptBtn.disabled = uiBusy || !hasPrompt;
7497
- copyResponsePromptBtn.textContent = hasPrompt ? "Copy response prompt" : "Copy response prompt (unavailable)";
7544
+ setTextIfChanged(copyResponsePromptBtn, hasPrompt ? "Copy response prompt" : "Copy response prompt (unavailable)");
7498
7545
  copyResponsePromptBtn.title = getHistoryPromptCopyTitle(selectedItem);
7499
7546
  }
7500
7547
  syncShowMeButton();
@@ -17183,23 +17230,23 @@
17183
17230
  loadCritiqueFullBtn.hidden = !isCritiqueResponse;
17184
17231
 
17185
17232
  loadResponseBtn.disabled = uiBusy || !hasResponse || responseLoaded || isCritiqueResponse || (bufferSwitchingEnabled && isStudioDocumentBufferView());
17186
- loadResponseBtn.textContent = responseLoaded ? "Response already in editor" : "Load response";
17233
+ setTextIfChanged(loadResponseBtn, responseLoaded ? "Response already in editor" : "Load response");
17187
17234
 
17188
17235
  const annotationWorkspaceReady = responseLoaded
17189
17236
  && editorView === "markdown"
17190
17237
  && rightView === "editor-preview"
17191
17238
  && paneFocusTarget === "off";
17192
17239
  annotateResponseBtn.disabled = uiBusy || !hasResponse || isCritiqueResponse || annotationWorkspaceReady || (bufferSwitchingEnabled && isStudioDocumentBufferView());
17193
- annotateResponseBtn.textContent = annotationWorkspaceReady ? "Response ready to annotate" : "Annotate response";
17240
+ setTextIfChanged(annotateResponseBtn, annotationWorkspaceReady ? "Response ready to annotate" : "Annotate response");
17194
17241
  annotateResponseBtn.title = annotationWorkspaceReady
17195
17242
  ? "The selected response is exactly in the raw editor with Editor Preview open."
17196
17243
  : "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
17244
 
17198
17245
  loadCritiqueNotesBtn.disabled = uiBusy || !isCritiqueResponse || !critiqueNotes || critiqueNotesLoaded || (bufferSwitchingEnabled && isStudioDocumentBufferView());
17199
- loadCritiqueNotesBtn.textContent = critiqueNotesLoaded ? "Critique notes already in editor" : "Load critique notes into editor";
17246
+ setTextIfChanged(loadCritiqueNotesBtn, critiqueNotesLoaded ? "Critique notes already in editor" : "Load critique notes into editor");
17200
17247
 
17201
17248
  loadCritiqueFullBtn.disabled = uiBusy || !isCritiqueResponse || responseLoaded || (bufferSwitchingEnabled && isStudioDocumentBufferView());
17202
- loadCritiqueFullBtn.textContent = responseLoaded ? "Full critique already in editor" : "Load full critique into editor";
17249
+ setTextIfChanged(loadCritiqueFullBtn, responseLoaded ? "Full critique already in editor" : "Load full critique into editor");
17203
17250
 
17204
17251
  // The Document can show responses, but they load or annotate into the Prompt only (Sol, 8 Oct).
17205
17252
  const documentView = bufferSwitchingEnabled && isStudioDocumentBufferView();
@@ -17210,7 +17257,7 @@
17210
17257
  if (documentView) annotateResponseBtn.title = "Return to Prompt to load or annotate this response.";
17211
17258
 
17212
17259
  copyResponseBtn.disabled = uiBusy || !hasResponse;
17213
- copyResponseBtn.textContent = "Copy response";
17260
+ setTextIfChanged(copyResponseBtn, "Copy response");
17214
17261
 
17215
17262
  const rightPaneShowsPreview = rightView === "preview" || rightView === "editor-preview";
17216
17263
  const exportingReplJournal = rightView === "repl";
@@ -17249,11 +17296,11 @@
17249
17296
  }
17250
17297
  if (exportPdfBtn) {
17251
17298
  exportPdfBtn.disabled = exportBusy || !canExportPreview;
17252
- exportPdfBtn.textContent = previewExportInProgress
17299
+ setTextIfChanged(exportPdfBtn, previewExportInProgress
17253
17300
  ? "Exporting…"
17254
17301
  : (sideQuestionMarkdownExportRequest
17255
17302
  ? "Saving…"
17256
- : (exportingSideThread ? "Export thread" : (exportingReplJournal ? "Export record" : "Export right preview")));
17303
+ : (exportingSideThread ? "Export thread" : (exportingReplJournal ? "Export record" : "Export right preview"))));
17257
17304
  if (rightView === "trace") {
17258
17305
  exportPdfBtn.title = "Working view does not support preview export.";
17259
17306
  } else if (rightView === "files") {
@@ -17283,7 +17330,7 @@
17283
17330
  if (exportSideThreadRenderSeparatorEl) exportSideThreadRenderSeparatorEl.hidden = !exportingSideThread;
17284
17331
  if (exportPreviewPdfStudioBtn) {
17285
17332
  exportPreviewPdfStudioBtn.disabled = exportBusy || !canExportPreview || isHtmlArtifactPreview || sideThreadRenderTooLarge;
17286
- exportPreviewPdfStudioBtn.textContent = documentHostingEnabled ? "Export PDF and open in browser" : "Export PDF and Open in Studio";
17333
+ setTextIfChanged(exportPreviewPdfStudioBtn, documentHostingEnabled ? "Export PDF and open in browser" : "Export PDF and Open in Studio");
17287
17334
  exportPreviewPdfStudioBtn.title = documentHostingEnabled && canExportPreview && !isHtmlArtifactPreview && !sideThreadRenderTooLarge
17288
17335
  ? "Export as PDF and open it in the browser's PDF viewer."
17289
17336
  : sideThreadRenderTooLarge
@@ -17295,8 +17342,8 @@
17295
17342
  if (exportPreviewPdfBtn) {
17296
17343
  exportPreviewPdfBtn.disabled = exportBusy || !canExportPreview || isHtmlArtifactPreview || sideThreadRenderTooLarge;
17297
17344
  // 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";
17345
+ if (documentHostingEnabled) setTextIfChanged(exportPreviewPdfBtn, "Export PDF and open in system viewer");
17346
+ if (documentHostingEnabled && exportPreviewHtmlBtn) setTextIfChanged(exportPreviewHtmlBtn, "Export HTML and open in browser");
17300
17347
  exportPreviewPdfBtn.title = sideThreadRenderTooLarge
17301
17348
  ? "This transcript is too large for rendered export; save or copy the Markdown instead."
17302
17349
  : (isHtmlArtifactPreview
@@ -17305,7 +17352,7 @@
17305
17352
  }
17306
17353
  if (exportPreviewHtmlStudioBtn) {
17307
17354
  exportPreviewHtmlStudioBtn.disabled = exportBusy || !canExportPreview || sideThreadRenderTooLarge;
17308
- exportPreviewHtmlStudioBtn.textContent = documentHostingEnabled ? "Export HTML and open in Document" : "Export HTML and Open in Studio";
17355
+ setTextIfChanged(exportPreviewHtmlStudioBtn, documentHostingEnabled ? "Export HTML and open in Document" : "Export HTML and Open in Studio");
17309
17356
  exportPreviewHtmlStudioBtn.title = documentHostingEnabled
17310
17357
  ? "Export as HTML and open it as a Document. Existing files are never overwritten."
17311
17358
  : sideThreadRenderTooLarge
@@ -17339,7 +17386,7 @@
17339
17386
  }
17340
17387
 
17341
17388
  pullLatestBtn.disabled = uiBusy || followLatest;
17342
- pullLatestBtn.textContent = queuedLatestResponse ? "Fetch latest response *" : "Fetch latest response";
17389
+ setTextIfChanged(pullLatestBtn, queuedLatestResponse ? "Fetch latest response *" : "Fetch latest response");
17343
17390
 
17344
17391
  updateSyncBadge(normalizedEditor);
17345
17392
  syncStudioQuartoDirtyUi();
@@ -17583,7 +17630,7 @@
17583
17630
  const hasSuggestionForCurrentText = Boolean(completionSuggestionState && sourceTextEl && sourceTextEl.value === completionSuggestionState.baseText);
17584
17631
  const editorEmpty = !String(sourceTextEl.value || "").trim();
17585
17632
  suggestCompletionBtn.disabled = isWatchedFilePreview || wsState !== "Ready" || (!completionSuggestionInFlight && (uiBusy || (editorEmpty && !isNextPromptEditor())));
17586
- suggestCompletionBtn.textContent = completionSuggestionInFlight ? "Stop" : (hasSuggestionForCurrentText ? "Try another" : "Suggest");
17633
+ setTextIfChanged(suggestCompletionBtn, completionSuggestionInFlight ? "Stop" : (hasSuggestionForCurrentText ? "Try another" : "Suggest"));
17587
17634
  suggestCompletionBtn.title = completionSuggestionInFlight
17588
17635
  ? "Stop the current suggestion request."
17589
17636
  : (hasSuggestionForCurrentText
@@ -17593,7 +17640,7 @@
17593
17640
  : "Ask for a short completion at the editor cursor. Shortcut: Option/Alt+Tab where available, or Cmd/Ctrl+Shift+Space from the editor."));
17594
17641
  if (footerSuggestBtn) {
17595
17642
  footerSuggestBtn.disabled = suggestCompletionBtn.disabled;
17596
- footerSuggestBtn.textContent = suggestCompletionBtn.textContent;
17643
+ setTextIfChanged(footerSuggestBtn, suggestCompletionBtn.textContent);
17597
17644
  footerSuggestBtn.title = suggestCompletionBtn.title;
17598
17645
  }
17599
17646
  }
@@ -19947,7 +19994,7 @@
19947
19994
  function syncCompletionSuggestionContextUi() {
19948
19995
  syncCompletionSuggestionModelUi();
19949
19996
  if (suggestCompletionOptionsBtn) {
19950
- suggestCompletionOptionsBtn.textContent = studioUiRefreshUi?.fileButton ? "File" : "Source & context";
19997
+ setTextIfChanged(suggestCompletionOptionsBtn, studioUiRefreshUi?.fileButton ? "File" : "Source & context");
19951
19998
  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
19999
  suggestCompletionOptionsBtn.setAttribute("aria-label", studioUiRefreshUi?.fileButton ? "File" : suggestCompletionOptionsBtn.title);
19953
20000
  }
@@ -28802,7 +28849,7 @@
28802
28849
 
28803
28850
  if (isEditorOnlyMode) {
28804
28851
  if (sendRunBtn) {
28805
- sendRunBtn.textContent = "Run editor text";
28852
+ setTextIfChanged(sendRunBtn, "Run editor text");
28806
28853
  sendRunBtn.classList.remove("request-stop-active", "repl-secondary-action");
28807
28854
  sendRunBtn.disabled = true;
28808
28855
  sendRunBtn.title = "Run is unavailable in editor-only mode.";
@@ -28818,7 +28865,7 @@
28818
28865
  sendReplBtn.hidden = !showReplSend;
28819
28866
  sendReplBtn.disabled = !showReplSend || wsState === "Disconnected" || uiBusy || replBusy || !hasReplSession;
28820
28867
  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";
28868
+ setTextIfChanged(sendReplBtn, showReplSend ? withStudioShortcutLabel(replSendMode === "literate" ? "Send selection/chunks" : "Send to REPL", "repl-send") : "Send to REPL");
28822
28869
  sendReplBtn.title = hasReplSession
28823
28870
  ? (replSendMode === "literate"
28824
28871
  ? "Literate send: selection, current fenced code chunk, or all matching chunks if the cursor is outside a chunk. Shortcut: " + replSendShortcut + "."
@@ -28837,7 +28884,7 @@
28837
28884
  }
28838
28885
  syncReplEchoModeSelect(showReplSend);
28839
28886
  if (critiqueBtn) {
28840
- critiqueBtn.textContent = "Critique text";
28887
+ setTextIfChanged(critiqueBtn, "Critique text");
28841
28888
  critiqueBtn.classList.remove("request-stop-active");
28842
28889
  critiqueBtn.disabled = true;
28843
28890
  critiqueBtn.title = "Critique is unavailable in editor-only mode.";
@@ -28852,7 +28899,7 @@
28852
28899
  }
28853
28900
 
28854
28901
  if (sendRunBtn) {
28855
- sendRunBtn.textContent = directIsStop ? "Stop" : (documentView ? "Return to Prompt" : (bufferSwitchingEnabled ? "Run Prompt" : (rightView === "repl" ? withStudioShortcutLabel("Run editor text", "run") : "Run editor text")));
28902
+ setTextIfChanged(sendRunBtn, directIsStop ? "Stop" : (documentView ? "Return to Prompt" : (bufferSwitchingEnabled ? "Run Prompt" : (rightView === "repl" ? withStudioShortcutLabel("Run editor text", "run") : "Run editor text"))));
28856
28903
  // The new-layout Document has the Prompt tab just above, so no Return to Prompt here (Oliver, 10 Oct).
28857
28904
  sendRunBtn.hidden = workspaceLayout && documentView && !directIsStop;
28858
28905
  sendRunBtn.classList.toggle("request-stop-active", directIsStop);
@@ -28891,7 +28938,7 @@
28891
28938
  sendReplBtn.hidden = !showReplSend;
28892
28939
  sendReplBtn.disabled = !showReplSend || wsState === "Disconnected" || uiBusy || replBusy || !hasReplSession;
28893
28940
  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";
28941
+ setTextIfChanged(sendReplBtn, showReplSend ? (workspaceLayout ? studioReplSendLabel() : withStudioShortcutLabel(replSendMode === "literate" ? "Send selection/chunks" : "Send to REPL", "repl-send")) : "Send to REPL");
28895
28942
  sendReplBtn.title = hasReplSession
28896
28943
  ? (workspaceLayout
28897
28944
  ? (replSendMode === "literate"
@@ -28915,7 +28962,7 @@
28915
28962
  syncReplEchoModeSelect(rightView === "repl");
28916
28963
 
28917
28964
  if (critiqueBtn) {
28918
- critiqueBtn.textContent = critiqueIsStop ? "Stop" : "Critique text";
28965
+ setTextIfChanged(critiqueBtn, critiqueIsStop ? "Stop" : "Critique text");
28919
28966
  critiqueBtn.classList.toggle("request-stop-active", critiqueIsStop);
28920
28967
  critiqueBtn.disabled = critiqueIsStop ? wsState === "Disconnected" : (uiBusy || canQueueSteering);
28921
28968
  critiqueBtn.title = critiqueIsStop
@@ -28927,7 +28974,7 @@
28927
28974
  : "Critique text with [an: ...] markers stripped."));
28928
28975
  }
28929
28976
  if (quizBtn) {
28930
- quizBtn.textContent = hasResumableQuiz() ? "Resume quiz" : "Quiz me";
28977
+ setTextIfChanged(quizBtn, hasResumableQuiz() ? "Resume quiz" : "Quiz me");
28931
28978
  quizBtn.disabled = wsState === "Disconnected" || uiBusy || canQueueSteering;
28932
28979
  quizBtn.title = canQueueSteering
28933
28980
  ? "Quiz is unavailable while Run editor text is active."
@@ -30985,7 +31032,7 @@
30985
31032
  if (!editorModeBtn) return;
30986
31033
  editorModeBtn.hidden = !studioEditorModeSwitchable;
30987
31034
  if (!studioEditorModeSwitchable) return;
30988
- editorModeBtn.textContent = studioEditorMode === "dual" ? "Switch to single editor" : "Switch to dual editor";
31035
+ setTextIfChanged(editorModeBtn, studioEditorMode === "dual" ? "Switch to single editor" : "Switch to dual editor");
30989
31036
  const wait = studioEditorModeAttempt ? "Switching…" : studioEditorModeSwitchWaitReason();
30990
31037
  editorModeBtn.disabled = Boolean(wait);
30991
31038
  editorModeBtn.title = wait || (studioEditorMode === "dual" ? "Use one editor, as in earlier Studio. Studio restarts and reopens here."
@@ -33421,6 +33468,12 @@
33421
33468
  if (getDocumentPreviewFollowOwner()) restoreDocumentFollowScroll(documentPreviewFollowScrolls.get(restoredFollowBuffer.id) ?? 0);
33422
33469
  renderSourcePreview();
33423
33470
  workspacePersistenceReady = true;
33471
+ // Follow is one switch now (Oliver, 5 Nov): a saved setting from the three-switch menu with only
33472
+ // Working or only the latest response on counts as on.
33473
+ if (studioUiRefreshUi?.followButton) {
33474
+ ensureLatestResponseFollowingPreference();
33475
+ if (activityTrackingEnabled !== (latestResponseFollowingEnabled !== false)) setStudioFollowEnabled(true);
33476
+ }
33424
33477
  initializePromptRunIndicator();
33425
33478
  syncStudioRunFollowingFromMessage({ type: "initialization" });
33426
33479
  // 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
@@ -135,6 +135,7 @@ import { buildStudioHostingBootstrapState, createStudioBufferServerStore, STUDIO
135
135
  import { createStudioTurns, readStudioEditorMode, resolveStudioEditorFlags, writeStudioEditorMode } from "./shared/studio-editor-mode.js";
136
136
  import { createStudioUrlFile, STUDIO_URL_FILE_ENV } from "./shared/studio-url-file.js";
137
137
  import { copyStudioUrl } from "./shared/studio-copy-url.js";
138
+ import { toStudioAsciiTitle } from "./shared/studio-title.js";
138
139
  import { canonicalStudioDocumentPath, studioDocumentPathsReferToSameFile } from "./shared/studio-document-paths.js";
139
140
  import { resolveStudioHostingPage, studioHostingCommandError, studioHostingLocalLinkError } from "./shared/studio-document-entrypoints.js";
140
141
  import { systemThemeLacksTrueColor } from "./shared/studio-system-theme.js";
@@ -13716,7 +13717,7 @@ function buildStudioHtml(
13716
13717
  <head>
13717
13718
  <meta charset="utf-8" />
13718
13719
  <meta name="viewport" content="width=device-width,initial-scale=1" />
13719
- <title>${appTitle}</title>
13720
+ <title>${toStudioAsciiTitle(appTitle)}</title>
13720
13721
  <link rel="icon" href="${faviconHref}" type="image/svg+xml" />
13721
13722
  <style>
13722
13723
  :root {
@@ -14107,7 +14108,7 @@ ${cssVarsBlock}
14107
14108
  <div><dt>Option/Alt+=</dt><dd>Increase the active pane's text size when not editing text</dd></div>
14108
14109
  <div><dt>Option/Alt+-</dt><dd>Decrease the active pane's text size when not editing text</dd></div>
14109
14110
  <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>
14111
+ <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
14112
  <div><dt>Cmd/Ctrl+Option/Alt+Shift+R</dt><dd>Refresh the focused or visible PDF preview from disk</dd></div>
14112
14113
  </dl>
14113
14114
  </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.13",
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)
@@ -1,3 +1,5 @@
1
+ import { toStudioAsciiTitle } from "./studio-title.js";
2
+
1
3
  // Read-only transport/view chrome only. Neither helper grants resources,
2
4
  // registers a workspace nor attaches a file to an editable buffer.
3
5
  /** @param {{token: string, kind: string, path: string, resourceDir?: string, page?: number | null}} options */
@@ -16,7 +18,8 @@ export function buildStudioReadOnlyImagePage({ label, dataUrl, nonce }) {
16
18
  if (typeof dataUrl !== "string" || !/^data:image\/(?:png|jpeg|gif|webp|svg\+xml);base64,[A-Za-z0-9+/]*={0,2}$/.test(dataUrl)) throw Error("Only supported image data may be shown in the image viewer.");
17
19
  const escape = value => String(value || "Image").replace(/[&<>"']/g, char => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" })[char]);
18
20
  const title = escape(label);
19
- return `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>${title}</title>
21
+ const tabTitle = escape(toStudioAsciiTitle(label));
22
+ return `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>${tabTitle}</title>
20
23
  <style nonce="${nonce}">html,body{margin:0;background:#171717;color:#e7e7e7;font:14px system-ui,sans-serif}header{position:sticky;top:0;display:flex;gap:12px;align-items:center;flex-wrap:wrap;padding:12px;background:#222;border-bottom:1px solid #444}h1{font-size:14px;font-weight:600;margin:0;overflow-wrap:anywhere}nav{display:flex;gap:6px}button{font:inherit;padding:5px 12px;background:transparent;color:inherit;border:1px solid #777;border-radius:5px;cursor:pointer}button[aria-pressed="true"]{background:#444}button:focus-visible{outline:2px solid #9bd;outline-offset:2px}.hint{color:#aaa;font-size:12px}main{padding:12px;overflow:auto}img{display:block;margin:auto}body[data-scale="fit"] img{max-width:100%;max-height:calc(100vh - 100px);width:auto;height:auto}body[data-scale="actual"] img{max-width:none;max-height:none}</style></head><body data-scale="fit">
21
24
  <header><h1>${title}</h1><nav aria-label="Image size"><button id="mediaFit" type="button" aria-pressed="true">Fit</button><button id="mediaActual" type="button" aria-pressed="false">Actual size</button></nav><span class="hint">Read-only image</span></header>
22
25
  <main><img src="${dataUrl}" alt="${title}"></main>
@@ -55,12 +55,13 @@ export function buildStudioPendingPage(options) {
55
55
 
56
56
  const kindLabel = kind === "document" ? "document" : (kind === "export" ? "export" : "preview");
57
57
  const helperQuery = new URLSearchParams({ token }).toString();
58
+ // The title stays ASCII (shared/studio-title.js); the heading keeps its ellipsis.
58
59
  return `<!doctype html>
59
60
  <html lang="en">
60
61
  <head>
61
62
  <meta charset="utf-8" />
62
63
  <meta name="viewport" content="width=device-width,initial-scale=1" />
63
- <title>Preparing Studio tab…</title>
64
+ <title>Preparing Studio tab...</title>
64
65
  <style nonce="${escapeHtmlAttribute(nonce)}">
65
66
  :root { color-scheme: light dark; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
66
67
  body { min-height: 100vh; margin: 0; display: grid; place-items: center; background: Canvas; color: CanvasText; }
@@ -0,0 +1,21 @@
1
+ // Tab titles for Studio's pages, in ASCII. Muxy 2.3.0's built-in browser can crash on a tab
2
+ // title with some non-ASCII characters: "Reading file content… · pi Studio · …" did, at the
3
+ // ellipsis. Which characters can do it isn't known, so a title keeps only printable ASCII.
4
+ // Page content keeps its characters. client/studio-client.js has a copy of this function for
5
+ // the live title; test/studio-title.test.js checks that the two agree.
6
+
7
+ /** @param {unknown} value */
8
+ export function toStudioAsciiTitle(value) {
9
+ return String(value ?? "")
10
+ .replace(/…/g, "...")
11
+ .replace(/[·•–—−]/g, "-")
12
+ .replace(/●/g, "*")
13
+ .replace(/[‘’]/g, "'")
14
+ .replace(/[“”]/g, "\"")
15
+ .replace(/π/g, "pi")
16
+ .normalize("NFKD")
17
+ .replace(/[̀-ͯ]/g, "")
18
+ .replace(/\s+/g, " ")
19
+ .replace(/[^\x20-\x7e]+/g, "?")
20
+ .trim();
21
+ }