pi-studio 0.11.1 → 0.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,13 @@ All notable changes to `pi-studio` are documented here.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.11.2] — 2026-10-27
8
+
9
+ ### Changed
10
+ - "Queue steering" is now **Steer**, Pi's own term. Its hover text says when the message arrives: when the agent's current step ends, before its next model call.
11
+ - In the new layout, the Prompt pane's **View** menu sits in its top row after **File**, as the response pane's View sits in its header. With the shorter label, the toolbar stays on one line while a prompt runs, with the default split, from about 1,100 px wide, down from about 1,315. A long file name shortens before the top row wraps.
12
+ - Saving a Document no longer briefly shows a notice above the panes, which made them jump, or a recovery warning in the footer, while Studio finishes the save. A save Studio can't finish itself still shows its notice and **Resolve saved backing…**. After a normal save the footer says "Saved NOTES.md.".
13
+
7
14
  ## [0.11.1] — 2026-10-22
8
15
 
9
16
  ### Changed
@@ -59,6 +59,7 @@
59
59
  let documentHostingReady = false, documentHostingPreparingFile = false, documentHostingRetired = false;
60
60
  let documentHostingSaveResolution = null;
61
61
  let documentHostingSaveResolutionBufferId = null, documentHostingFilePreparationBufferId = null;
62
+ let documentHostingSaveResolutionOperationId = null, documentHostingSaveResolutionStartedAt = 0;
62
63
  let documentHostingResourceDir = null, documentHostingResourceEditGeneration = 0, documentHostingMetadataLocked = false;
63
64
  const settledHostingSaveRequests = new Map();
64
65
  const documentHostingOwnerFlights = new Map();
@@ -66,7 +67,7 @@
66
67
  let scratchpadHostingProduction = null, reviewNotesHostingProduction = null;
67
68
  const documentHostingWaiters = new Set();
68
69
  let bufferRecoveryClient = null;
69
- let bufferRecoveryIssue = "", bufferRecoveryKeptClosed = false;
70
+ let bufferRecoveryIssue = "", bufferRecoveryKeptClosed = false, bufferRecoveryIssueChannels = null;
70
71
  let bufferRecoveryPanel = null;
71
72
  let bufferRecoveryInitializing = false;
72
73
  let bufferRecoveryNavigationConsent = null;
@@ -373,7 +374,8 @@
373
374
  let studioOperationNotices = new Map();
374
375
  let studioOperationNoticesEl = null;
375
376
  let studioDocumentDestinationsSection = null;
376
- let studioOperationNoticeFingerprint = "";
377
+ let studioOperationNoticeFingerprint = "", studioHeldSaveNoticeTimer = null;
378
+ const studioOwnSaveAttemptsEnded = new Set();
377
379
  let statusLevel = "";
378
380
  let reconnectTimer = null;
379
381
  let reconnectAttempt = 0;
@@ -960,7 +962,7 @@
960
962
  // Oliver, 22 Oct: the clock alone, beside Stop, so the running row fits narrower windows.
961
963
  return Math.floor(seconds / 60) + ":" + String(seconds % 60).padStart(2, "0");
962
964
  }
963
- // Oliver, 14 Oct: a Run waiting for Pi to start says so briefly here, so Queue steering fits
965
+ // Oliver, 14 Oct: a Run waiting for Pi to start says so briefly here, so Steer fits
964
966
  // beside it and the toolbar doesn't wrap and jump back. The footer keeps the detail.
965
967
  if (uiBusy && pendingKind === "direct") return "Starting…";
966
968
  return uiBusy ? getStudioBusyStatus(pendingKind) : "";
@@ -4067,13 +4069,14 @@
4067
4069
  (isEditorOnlyMode || isWatchedFilePreview || followMenu) ? null : activityTrackingSelect,
4068
4070
  (bufferSwitchingEnabled && !followMenu) ? documentPreviewFollowSelect : null]);
4069
4071
  appendStudioUiRefreshMenuSection(viewMenu.menu, "Annotations", [annotationModeSelect, insertHeaderBtn, stripAnnotationsBtn, saveAnnotatedBtn]);
4072
+ // 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).
4073
+ headerToolsEl.appendChild(viewMenu.anchor);
4070
4074
  // Row 2 mirrors row 1: the main action on the left, the tools on the right (Oliver, 10 Oct).
4071
4075
  const toolsEl = makeStudioUiRefreshElement("span", "studio-refresh-tools");
4072
4076
  if (reviewNotesBtn) toolsEl.appendChild(reviewNotesBtn);
4073
4077
  if (scratchpadBtn) toolsEl.appendChild(scratchpadBtn);
4074
4078
  if (isEditorOnlyMode && askAsideBtn) toolsEl.appendChild(askAsideBtn);
4075
4079
  if (reviewMenu) toolsEl.appendChild(reviewMenu.anchor);
4076
- toolsEl.appendChild(viewMenu.anchor);
4077
4080
  actionLineOneEl.appendChild(toolsEl);
4078
4081
 
4079
4082
  toolbarMainEl.appendChild(actionsEl);
@@ -5003,12 +5006,57 @@
5003
5006
  } else if (opening?.error) add({ id: "open:invalid", kind: "open", bufferId: null,
5004
5007
  message: "Opening backup could not be verified. Keep it for recovery; current work was kept.",
5005
5008
  actions: [{ controlId: "studioDownloadOpenBtn", label: "Export backup" }] });
5006
- for (const save of bufferRecoveryClient?.pendingHostingSaves() || []) add({ id: "save:" + save.operationId, kind: "save", bufferId: save.bufferId,
5007
- message: "Disk save recorded; attaching its backing is unresolved. Current text kept.",
5008
- actions: [{ controlId: "studioResolveSaveBtn", label: "Resolve saved backing…", selectedBufferOnly: true }] });
5009
+ for (const save of bufferRecoveryClient?.pendingHostingSaves() || []) {
5010
+ if (holdStudioSaveNotice(save.operationId)) continue;
5011
+ add({ id: "save:" + save.operationId, kind: "save", bufferId: save.bufferId,
5012
+ message: "Disk save recorded; attaching its backing is unresolved. Current text kept.",
5013
+ actions: [{ controlId: "studioResolveSaveBtn", label: "Resolve saved backing…", selectedBufferOnly: true }] });
5014
+ }
5009
5015
  return notices;
5010
5016
  }
5011
5017
 
5018
+ // Oliver, 27 Oct: every Document save showed its own pending record for about 40 ms, above the panes (so they
5019
+ // jumped) and as a recovery warning in the footer. While this tab is still finishing that save itself, there's
5020
+ // nothing to decide yet; if it's still pending after that, or after 10 s, it shows as before.
5021
+ const STUDIO_OWN_SAVE_HOLD_MS = 10000;
5022
+ // When this tab's hold on a pending save ends, or 0 if it isn't held.
5023
+ function studioSaveHoldEndsAt(operationId) {
5024
+ // Once Studio's own attempt to finish it has ended, a save still pending is a decision to make.
5025
+ if (!operationId || studioOwnSaveAttemptsEnded.has(operationId)) return 0;
5026
+ let endsAt = 0;
5027
+ for (const operation of pendingSaveOperations.values()) {
5028
+ if (operation.hosting?.operationId === operationId) endsAt = Math.max(endsAt, (operation.startedAt || 0) + STUDIO_OWN_SAVE_HOLD_MS);
5029
+ }
5030
+ if (documentHostingSaveResolution && documentHostingSaveResolutionOperationId === operationId) {
5031
+ endsAt = Math.max(endsAt, documentHostingSaveResolutionStartedAt + STUDIO_OWN_SAVE_HOLD_MS);
5032
+ }
5033
+ return endsAt > Date.now() ? endsAt : 0;
5034
+ }
5035
+ function studioSaveIsFinishingItself(operationId) {
5036
+ return studioSaveHoldEndsAt(operationId) > 0;
5037
+ }
5038
+ function holdStudioSaveNotice(operationId) {
5039
+ const endsAt = studioSaveHoldEndsAt(operationId);
5040
+ if (!endsAt) return false;
5041
+ // Look again when the earliest hold ends, in case nothing else does: at its own end, not 10 s from now (Sol, Astra).
5042
+ if (!studioHeldSaveNoticeTimer || studioHeldSaveNoticeTimer.at > endsAt) {
5043
+ if (studioHeldSaveNoticeTimer) clearTimeout(studioHeldSaveNoticeTimer.id);
5044
+ studioHeldSaveNoticeTimer = { at: endsAt, id: setTimeout(() => {
5045
+ studioHeldSaveNoticeTimer = null; syncStudioOperationNotices(); renderStatus();
5046
+ }, Math.max(0, endsAt - Date.now()) + 50) };
5047
+ }
5048
+ return true;
5049
+ }
5050
+ function studioPendingSavesAreFinishing() {
5051
+ const saves = bufferRecoveryClient?.pendingHostingSaves() || [];
5052
+ return saves.length > 0 && saves.every(save => holdStudioSaveNotice(save.operationId));
5053
+ }
5054
+ function getStudioShownRecoveryIssue() {
5055
+ const channels = bufferRecoveryIssueChannels;
5056
+ if (!channels?.["file-save"] || Object.values(channels).join(" ") !== bufferRecoveryIssue || !studioPendingSavesAreFinishing()) return bufferRecoveryIssue;
5057
+ return Object.entries(channels).filter(([channel]) => channel !== "file-save").map(([, message]) => message).join(" ");
5058
+ }
5059
+
5012
5060
  function getStudioPriorityOperationNotice() {
5013
5061
  return [...studioOperationNotices.values()].find(notice => notice.unresolved && notice.severity === "warning") || null;
5014
5062
  }
@@ -5080,11 +5128,12 @@
5080
5128
  // the footer quiet rather than duplicating it or competing with a short
5081
5129
  // confirmation; retain a fallback if notice rendering is unavailable.
5082
5130
  const operationInNotice = operation && studioOperationNoticesEl?.isConnected && !studioOperationNoticesEl.hidden;
5083
- statusEl.textContent = bufferRecoveryIssue
5084
- ? "Recovery: " + bufferRecoveryIssue + (bufferRecoveryKeptClosed ? "" : " Save or copy your text before reloading. " + (operationInNotice ? "" : (operation?.message || statusMessage)))
5131
+ const recoveryIssue = getStudioShownRecoveryIssue();
5132
+ statusEl.textContent = recoveryIssue
5133
+ ? "Recovery: " + recoveryIssue + (bufferRecoveryKeptClosed ? "" : " Save or copy your text before reloading. " + (operationInNotice ? "" : (operation?.message || statusMessage)))
5085
5134
  : operationInNotice ? "" : operation?.message || statusMessage;
5086
- statusEl.className = bufferRecoveryIssue ? "warning" : operationInNotice ? "" : operation?.severity || (statusLevel || "");
5087
- statusEl.title = bufferRecoveryIssue || (!operationInNotice && operation?.message) || "";
5135
+ statusEl.className = recoveryIssue ? "warning" : operationInNotice ? "" : operation?.severity || (statusLevel || "");
5136
+ statusEl.title = recoveryIssue || (!operationInNotice && operation?.message) || "";
5088
5137
  if (typeof syncStudioPromptAddUndo === "function") syncStudioPromptAddUndo();
5089
5138
 
5090
5139
  const spinnerActive = shouldAnimateFooterSpinner();
@@ -17429,6 +17478,7 @@
17429
17478
  const current = () => !bufferPageClosed && client === bufferRecoveryClient && generation > 0 && generation === documentHostingGeneration
17430
17479
  && bufferId === client.snapshot().selectedBufferId && facts() === before && !studioModalBlocksDraftAction(decision);
17431
17480
  documentHostingSaveResolutionBufferId = bufferId;
17481
+ documentHostingSaveResolutionOperationId = options.automaticOperationId || null; documentHostingSaveResolutionStartedAt = Date.now();
17432
17482
  syncDocumentHostingReadiness();
17433
17483
  documentHostingSaveResolution = (async () => {
17434
17484
  try {
@@ -17506,10 +17556,19 @@
17506
17556
  if (client.pendingHostingSaves().some(save => save.operationId === record.operationId) || !client.hostingAuthority(bufferId).ok) {
17507
17557
  throw new Error("The saved baseline is kept locally, but recovery is not acknowledged. Keep this tab and recheck copies before closing.");
17508
17558
  }
17509
- setStatus("Attached the saved baseline without replacing later typing. The disk file was not rewritten.", "success");
17559
+ // A save Studio finished by itself is just a save (Oliver, 27 Oct); the longer wording stays for a resolved one.
17560
+ setStatus(options.automaticOperationId ? "Saved " + (basenameForStudioPath(record.path) || record.label || "the file") + "."
17561
+ : "Attached the saved baseline without replacing later typing. The disk file was not rewritten.", "success");
17510
17562
  }
17511
17563
  } catch (error) { setStatus(error.message || "The save outcome could not be resolved. Keep current work and recheck.", "warning"); }
17512
- })().finally(() => { documentHostingSaveResolution = null; documentHostingSaveResolutionBufferId = null; syncDocumentHostingReadiness(); });
17564
+ })().finally(() => {
17565
+ if (options.automaticOperationId) {
17566
+ studioOwnSaveAttemptsEnded.add(options.automaticOperationId);
17567
+ while (studioOwnSaveAttemptsEnded.size > 128) studioOwnSaveAttemptsEnded.delete(studioOwnSaveAttemptsEnded.values().next().value);
17568
+ }
17569
+ documentHostingSaveResolution = null; documentHostingSaveResolutionBufferId = null; documentHostingSaveResolutionOperationId = null;
17570
+ syncDocumentHostingReadiness(); renderStatus();
17571
+ });
17513
17572
  return documentHostingSaveResolution;
17514
17573
  }
17515
17574
  function documentHostingMetadataIsIdle(bufferId) {
@@ -28081,7 +28140,7 @@
28081
28140
  queueSteerBtn.disabled = true;
28082
28141
  queueSteerBtn.classList.remove("request-stop-active");
28083
28142
  queueSteerBtn.hidden = true;
28084
- queueSteerBtn.title = "Queue steering is unavailable in editor-only mode.";
28143
+ queueSteerBtn.title = "Steer is unavailable in editor-only mode.";
28085
28144
  }
28086
28145
  if (sendReplBtn) {
28087
28146
  sendReplBtn.hidden = !showReplSend;
@@ -28151,9 +28210,9 @@
28151
28210
  queueSteerBtn.classList.remove("request-stop-active");
28152
28211
  queueSteerBtn.title = canQueueSteering
28153
28212
  ? (annotationsEnabled
28154
- ? "Queue the current editor text as a steering message for the active run. Shortcut: Cmd/Ctrl+Enter."
28155
- : "Queue the current editor text as a steering message for the active run after stripping [an: ...] markers. Shortcut: Cmd/Ctrl+Enter.")
28156
- : "Queue steering is available while Run editor text is active.";
28213
+ ? "Steer the active run with the editor text. Pi adds it when the agent's current step ends, before its next model call. Shortcut: Cmd/Ctrl+Enter."
28214
+ : "Steer the active run with the editor text, without its [an: ...] markers. Pi adds it when the agent's current step ends, before its next model call. Shortcut: Cmd/Ctrl+Enter.")
28215
+ : "Steer is available while a Studio run is active.";
28157
28216
  }
28158
28217
 
28159
28218
  if (sendReplBtn) {
@@ -31330,7 +31389,7 @@
31330
31389
  const requestId = beginUiAction("save_as");
31331
31390
  if (!requestId) return false;
31332
31391
  const operation = {
31333
- kind: "save_as", ...(hosting ? { hosting } : {}),
31392
+ kind: "save_as", ...(hosting ? { hosting } : {}), startedAt: Date.now(),
31334
31393
  sourceKey: getEditorDraftSourceKey(),
31335
31394
  path: cleanPath,
31336
31395
  content: String(content ?? ""),
@@ -31405,7 +31464,7 @@
31405
31464
  const requestId = beginUiAction("save_over");
31406
31465
  if (!requestId) return false;
31407
31466
  const operation = {
31408
- kind: "save_over", ...(settings.hosting ? { hosting: settings.hosting } : {}),
31467
+ kind: "save_over", ...(settings.hosting ? { hosting: settings.hosting } : {}), startedAt: Date.now(),
31409
31468
  sourceKey: getEditorDraftSourceKey(),
31410
31469
  path,
31411
31470
  content: Object.prototype.hasOwnProperty.call(settings, "content")
@@ -31776,7 +31835,7 @@
31776
31835
  return;
31777
31836
  }
31778
31837
  if (!studioRunChainActive) {
31779
- setStatus("Queue steering is only available while Run editor text is active.", "warning");
31838
+ setStatus("Steer is only available while a Studio run is active.", "warning");
31780
31839
  return;
31781
31840
  }
31782
31841
 
@@ -32598,7 +32657,7 @@
32598
32657
  return legacy.status === "unavailable" ? { ok: false, reason: "unavailable", message: "Legacy server recovery could not be checked." } : { ok: true, state: legacy.state };
32599
32658
  },
32600
32659
  // A tab Studio moved away from no longer owns the workspace; its issues don't apply.
32601
- onIssue: (message) => { if (studioMovedAway) return; bufferRecoveryIssue = message; renderStatus(); },
32660
+ onIssue: (message, channels) => { if (studioMovedAway) return; bufferRecoveryIssue = message; bufferRecoveryIssueChannels = channels || null; renderStatus(); },
32602
32661
  });
32603
32662
  let client = createRecoveryClient();
32604
32663
  try { promptRunIndicatorFresh = !recoveryStorage?.getItem("piStudio.bufferWorkspace.v2:" + studioTabStateId) && document.body.dataset.hostingResume !== "1"; } catch { promptRunIndicatorFresh = false; }
package/client/studio.css CHANGED
@@ -7580,6 +7580,20 @@
7580
7580
  /* Natural widths with a small gap (Oliver, trial48): the unselected label may shift a little on switching. */
7581
7581
  body.studio-workspace-layout .studio-workspace-file-controls { min-width: 0; margin-left: auto; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
7582
7582
  body.studio-workspace-layout .studio-workspace-filename { min-width: 0; max-width: min(180px, 35cqi); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 400; }
7583
+ /* With View beside File, the name shortens before anything wraps (Oliver, 27 Oct). Its column can narrow to 4em, so
7584
+ row 1 wraps only when even that won't fit. Otherwise the controls take the rest of the row, and the name what's left
7585
+ of that, up to its cap. In a very narrow pane the controls wrap among themselves, as before. */
7586
+ body.studio-workspace-layout #leftSectionHeader .studio-workspace-file-controls {
7587
+ display: grid; grid-auto-flow: column; grid-template-columns: minmax(4em, max-content); grid-auto-columns: max-content;
7588
+ justify-content: end; justify-items: stretch; align-items: center; column-gap: 8px; flex: 1 1 0%; min-width: min-content;
7589
+ }
7590
+ body.studio-workspace-layout #leftSectionHeader .studio-workspace-file-controls > :has(> .studio-workspace-filename) { min-width: 0; max-width: min(180px, 35cqi); }
7591
+ body.studio-workspace-layout #leftSectionHeader .studio-workspace-file-controls > * > .studio-workspace-filename { max-width: 100%; }
7592
+ /* Its own line below the tabs, as before; it must also give up the row-filling size, or it stays beside the tabs
7593
+ and the name overlaps them (candidate 97, seen in a replay screenshot). */
7594
+ @container (max-width: 300px) {
7595
+ body.studio-workspace-layout #leftSectionHeader .studio-workspace-file-controls { display: flex; flex-wrap: wrap; justify-content: flex-end; flex: 0 1 auto; min-width: 0; margin-left: auto; }
7596
+ }
7583
7597
  body.studio-workspace-layout .studio-refresh-toolbar-main { display: block; }
7584
7598
  body.studio-workspace-layout .studio-refresh-toolbar-actions { gap: 0; min-width: 0; width: 100%; }
7585
7599
  body.studio-workspace-layout .studio-refresh-toolbar-actions > .studio-refresh-action-line { min-width: 0; width: 100%; }
package/index.ts CHANGED
@@ -13247,7 +13247,7 @@ ${cssVarsBlock}
13247
13247
  <div class="source-actions">
13248
13248
  <div class="source-actions-row">
13249
13249
  <button id="sendRunBtn" type="button" title="Run editor text. If Studio loaded or staged an unchanged Pi terminal draft, clear that draft after Pi accepts the run. While a direct run is active, this button becomes Stop. Cmd/Ctrl+Enter queues steering from the current editor text. Stop the active request with Esc.">Run editor text</button>
13250
- <button id="queueSteerBtn" type="button" title="Queue steering is available while Run editor text is active." disabled>Queue steering</button>
13250
+ <button id="queueSteerBtn" type="button" title="Steer is available while a Studio run is active." disabled>Steer</button>
13251
13251
  </div>
13252
13252
  <div class="source-actions-row repl-action-line" hidden>
13253
13253
  <button id="sendReplBtn" type="button" hidden title="Send the current selection, or the full editor text, to the active REPL session shown in the right pane.">Send to REPL</button>
@@ -13591,7 +13591,7 @@ ${cssVarsBlock}
13591
13591
  <div><dt>Cmd/Ctrl+S</dt><dd>Save editor when the disk revision still matches</dd></div>
13592
13592
  <div><dt>Cmd/Ctrl+Shift+S</dt><dd>Save editor as a new file</dd></div>
13593
13593
  <div><dt>Cmd/Ctrl+Shift+L</dt><dd>Load the current Pi terminal input draft without clearing it</dd></div>
13594
- <div class="shortcuts-full-only"><dt>Cmd/Ctrl+Enter</dt><dd>Run editor text, or queue steering during an active run</dd></div>
13594
+ <div class="shortcuts-full-only"><dt>Cmd/Ctrl+Enter</dt><dd>Run editor text, or steer an active run</dd></div>
13595
13595
  <div><dt>Option/Alt+Tab or Cmd/Ctrl+Shift+Space</dt><dd>Suggest a completion at the editor cursor</dd></div>
13596
13596
  <div><dt>Tab</dt><dd>Insert a visible completion suggestion; otherwise indent selected editor text</dd></div>
13597
13597
  <div><dt>Esc</dt><dd>Dismiss a visible completion suggestion, close overlays, exit pane focus, or stop an active request</dd></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-studio",
3
- "version": "0.11.1",
3
+ "version": "0.11.2",
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",
@@ -64,7 +64,7 @@ export function createStudioBufferClient(options) {
64
64
  const issues = new Map();
65
65
  function issue(channel, result) {
66
66
  if (result) issues.set(channel, result.message || "Recovery is unavailable."); else issues.delete(channel);
67
- options.onIssue?.([...issues.values()].join(" "));
67
+ options.onIssue?.([...issues.values()].join(" "), Object.fromEntries(issues));
68
68
  }
69
69
  function ack() {
70
70
  try {