pi-studio 0.10.5 → 0.11.0

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,25 @@ All notable changes to `pi-studio` are documented here.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.11.0] — 2026-10-21
8
+
9
+ ### Added
10
+ - The REPL pane runs **Ruby** (irb) and **Java** (JShell), as pi-repl does. Choose them under **Runtime**, or send to a pi-repl Ruby or Java session. In Java, print values with `System.out.println(…)`: code is loaded with `/open`, which doesn't show expression results. Stop waits for JShell's second JVM to exit too.
11
+ - The REPL pane runs **Octave** (`octave-cli`) and **MATLAB**, as pi-repl does, as separate runtimes. Code runs in the base workspace, with the usual `ans` and semicolon behaviour; errors and Ctrl+C still complete the send. MATLAB starts without its desktop in the working directory, and Studio waits up to two minutes for its prompt. Stopping Octave doesn't leave an `octave-workspace` file in the working directory, unless you start it with your own **Start cmd**.
12
+ - The REPL pane runs **gnuplot**, as pi-repl does. Code runs as written, so your terminal and settings stay as you set them, and errors and Ctrl+C still complete the send. Stop also closes its Qt plot windows.
13
+ - The REPL pane runs **C++** in Cling, as pi-repl does. Send complete prompt groups, with a function's opening brace on its declaration line. Errors, incomplete code and uncaught C++ exceptions still complete the send, and earlier groups keep their effect. Cling and its development headers need to be on your PATH.
14
+
15
+ ### Changed
16
+ - Pane echo defaults to **Summary**, as in pi-repl, so the tmux pane shows each sent submission above its output. Summary now shows up to 20 lines or 2,000 characters, up from 6 lines or 600. If you chose Full before, Studio keeps it; if you chose Off, choose it again.
17
+ - In dual mode, **Pane echo** is under the REPL pane's **More**, below **Send mode**. The toolbar had stopped showing it, so it couldn't be changed there. Choose **Off** for a quiet pane.
18
+ - With Pane echo **Off**, a send whose output doesn't end its line now ends it, as pi-repl does. The record keeps that output, and the runtime's next prompt starts on a line of its own.
19
+ - Pane echo looks the same as pi-repl's: `── pi-studio · input · 2 lines · id: … ──`, then the code without `│` bars, the output, `── done · id: … ──` and a blank line. A blank line also separates the code from the line that loads it. Studio's temporary files for a send start with the same id. The record still holds only the code and its output.
20
+
21
+ ### Fixed
22
+ - When a runtime exits or crashes during a send, the send ends within a couple of seconds with "… ended while running the code." It used to wait out its 20-second timeout and then report that Studio couldn't capture the session. If tmux keeps the dead pane, the record keeps what it shows.
23
+ - In a Julia pane narrower than the line that loads the code, sent code no longer leaves copies of that line in the output. Studio pastes it as one bracketed paste, as pi-repl 0.8.5 does.
24
+ - With Summary or Full, the done marker goes on a line of its own when the output doesn't end with a newline, as with `print("c", end="")`. It used to join the output's last line and end up in the record.
25
+
7
26
  ## [0.10.5] — 2026-10-20
8
27
 
9
28
  ### Fixed
package/README.md CHANGED
@@ -27,7 +27,7 @@ Watch the [demo](https://github.com/omaclaren/pi-studio/releases/download/demo-p
27
27
  - **Files and Changes** — browse folders you've allowed, open or preview files, and see the current git diff.
28
28
  - **Comments and scratchpad** — comments anchored to lines or selections, and a scratchpad per document.
29
29
  - **Side questions and quizzes** — ask about the text, a folder or the repository in a separate thread that stays out of the main conversation, or quiz yourself on it.
30
- - **REPL** — send code to tmux-backed Shell, Python, IPython, Julia, R, GHCi or Clojure sessions, shared with [pi-repl](https://github.com/omaclaren/pi-repl).
30
+ - **REPL** — send code to tmux-backed Shell, Python, IPython, Julia, R, GHCi, Clojure, Ruby, Java, Octave, MATLAB, gnuplot or C++ (Cling) sessions, shared with [pi-repl](https://github.com/omaclaren/pi-repl).
31
31
  - **Export** — PDF (Pandoc and LaTeX) or standalone HTML, from the preview, a file or the last response.
32
32
 
33
33
  ## Requirements
@@ -36,6 +36,7 @@ Watch the [demo](https://github.com/omaclaren/pi-studio/releases/download/demo-p
36
36
  - [Pandoc](https://pandoc.org/installing.html) for full previews and exports (`brew install pandoc` on macOS), and LaTeX (TeX Live or MacTeX) for PDF export
37
37
  - Optional:
38
38
  - `tmux` for the REPL;
39
+ - a JDK with `jshell` for the Java REPL, and `matlab` for MATLAB, on the PATH Pi runs with, since Studio doesn't start them through a login shell (or give the full path in the REPL pane's **Start cmd**);
39
40
  - `quarto` for Quarto previews;
40
41
  - Mermaid CLI 11.12+ for diagrams in exported PDFs;
41
42
  - `pdftotext` so side questions can read PDFs;
@@ -135,7 +136,7 @@ Icons in exported PDFs need Mermaid CLI 11.12+ (`npm install -g @mermaid-js/merm
135
136
 
136
137
  ### REPL
137
138
 
138
- The REPL pane runs code in tmux sessions. It can start its own, and it shares a record of submissions and output with [pi-repl](https://github.com/omaclaren/pi-repl) when both use the same session. Pane echo (Off, Summary, Full) controls how much submitted code appears in the raw tmux history; Full writes your code into that history. The record format is in [`shared/REPL_SESSION_RECORD_PROTOCOL.md`](./shared/REPL_SESSION_RECORD_PROTOCOL.md).
139
+ The REPL pane runs code in tmux sessions. It can start its own, and it shares a record of submissions and output with [pi-repl](https://github.com/omaclaren/pi-repl) when both use the same session. Pane echo sets how much submitted code goes into the raw tmux history, as in pi-repl: up to 20 lines with Summary, the default, up to 40 with Full, and none with Off. The record format is in [`shared/REPL_SESSION_RECORD_PROTOCOL.md`](./shared/REPL_SESSION_RECORD_PROTOCOL.md).
139
140
 
140
141
  ### Side questions
141
142
 
@@ -155,7 +156,7 @@ For a container, `/studio --no-browser --listen-all --port 4321` listens on all
155
156
  | `MERMAID_CLI_PATH` | Mermaid CLI for diagrams in PDFs |
156
157
  | `BRAVE_API_KEY` | Enables web search in side questions |
157
158
  | `PI_STUDIO_FONT_MONO`, `PI_STUDIO_FONT_UI`, `PI_STUDIO_FONT_PROSE` | CSS font stacks for code, interface and previews |
158
- | `PI_STUDIO_REPL_ECHO_MODE` | Default pane echo for `studio_repl_send`: `off`, `summary` or `full` |
159
+ | `PI_STUDIO_REPL_ECHO_MODE` | Default pane echo for `studio_repl_send`: `summary` (the default), `off` or `full` |
159
160
  | `PI_STUDIO_PANDOC_TIMEOUT_MS`, `PI_STUDIO_LATEX_TIMEOUT_MS`, `PI_STUDIO_MERMAID_TIMEOUT_MS` | Export time limits |
160
161
 
161
162
  Installing pi-studio also adds `pi-studio-dark` and `pi-studio-light` to Pi's themes, without changing your current theme.
@@ -738,10 +738,13 @@
738
738
  })();
739
739
  let replEchoMode = (() => {
740
740
  try {
741
- const stored = String((window.localStorage && window.localStorage.getItem("piStudio.replEchoMode.v2")) || "").trim().toLowerCase();
742
- return stored === "summary" || stored === "full" ? stored : "off";
741
+ const stored = String((window.localStorage && window.localStorage.getItem("piStudio.replEchoMode.v3")) || "").trim().toLowerCase();
742
+ if (stored === "off" || stored === "summary" || stored === "full") return stored;
743
+ // v2 saved Off whether or not it was chosen; keep only a Full chosen there.
744
+ const earlier = String((window.localStorage && window.localStorage.getItem("piStudio.replEchoMode.v2")) || "").trim().toLowerCase();
745
+ return earlier === "full" ? "full" : "summary";
743
746
  } catch {
744
- return "off";
747
+ return "summary";
745
748
  }
746
749
  })();
747
750
  function normalizeReplJournalEntry(entry) {
@@ -1498,6 +1501,7 @@
1498
1501
  function getKnownReplRuntime(value) {
1499
1502
  const runtime = String(value || "").trim().toLowerCase();
1500
1503
  return runtime === "shell" || runtime === "python" || runtime === "ipython" || runtime === "julia" || runtime === "r" || runtime === "ghci" || runtime === "clojure"
1504
+ || runtime === "ruby" || runtime === "java" || runtime === "octave" || runtime === "matlab" || runtime === "gnuplot" || runtime === "cpp"
1501
1505
  ? runtime
1502
1506
  : "";
1503
1507
  }
@@ -1514,6 +1518,12 @@
1514
1518
  if (runtime === "julia") return "Julia";
1515
1519
  if (runtime === "r") return "R";
1516
1520
  if (runtime === "ghci") return "GHCi";
1521
+ if (runtime === "ruby") return "Ruby";
1522
+ if (runtime === "java") return "Java";
1523
+ if (runtime === "octave") return "Octave";
1524
+ if (runtime === "matlab") return "MATLAB";
1525
+ if (runtime === "gnuplot") return "gnuplot";
1526
+ if (runtime === "cpp") return "C++";
1517
1527
  return "Clojure";
1518
1528
  }
1519
1529
 
@@ -1590,7 +1600,7 @@
1590
1600
 
1591
1601
  function normalizeReplEchoMode(value) {
1592
1602
  const normalized = String(value || "").trim().toLowerCase();
1593
- return normalized === "summary" || normalized === "full" ? normalized : "off";
1603
+ return normalized === "off" || normalized === "full" ? normalized : "summary";
1594
1604
  }
1595
1605
 
1596
1606
  function isMacShortcutPlatform() {
@@ -1651,12 +1661,23 @@
1651
1661
  replEchoMode = normalizeReplEchoMode(mode);
1652
1662
  if (replEchoModeSelect) replEchoModeSelect.value = replEchoMode;
1653
1663
  try {
1654
- if (window.localStorage) window.localStorage.setItem("piStudio.replEchoMode.v2", replEchoMode);
1664
+ if (window.localStorage) window.localStorage.setItem("piStudio.replEchoMode.v3", replEchoMode);
1655
1665
  } catch {
1656
1666
  // Ignore storage failures.
1657
1667
  }
1658
1668
  }
1659
1669
 
1670
+ function chooseReplEchoMode(mode) {
1671
+ setReplEchoMode(mode);
1672
+ syncActionButtons();
1673
+ setStatus(replEchoMode === "full"
1674
+ ? "Full pane echo enabled. Bounded submitted source code will remain in raw terminal history."
1675
+ : (replEchoMode === "off"
1676
+ ? "Pane echo disabled; new sends will not add alignment anchors to raw terminal history."
1677
+ : "Summary pane echo enabled; short submissions will be shown with compact anchors and a plain output divider."),
1678
+ replEchoMode === "full" ? "warning" : "success");
1679
+ }
1680
+
1660
1681
  function syncReplEchoModeSelect(visible) {
1661
1682
  if (!replEchoModeSelect) return;
1662
1683
  replEchoModeSelect.hidden = !visible;
@@ -1666,7 +1687,7 @@
1666
1687
  ? "Do not add a submitted-code display or alignment anchors to the raw REPL pane."
1667
1688
  : (replEchoMode === "full"
1668
1689
  ? "Display up to 40 lines or 4,000 characters of submitted code; source remains in raw terminal history."
1669
- : "Display short submissions in full, truncating after 6 lines or 600 characters, with compact anchors and a plain output divider.");
1690
+ : "Display short submissions in full, truncating after 20 lines or 2,000 characters, with compact anchors and a plain output divider.");
1670
1691
  }
1671
1692
 
1672
1693
  function getReplQuickDraftKey(session) {
@@ -2256,6 +2277,8 @@
2256
2277
  if (first === "bash") return "shell";
2257
2278
  if (first === "hs" || first === "haskell") return "ghci";
2258
2279
  if (first === "clj" || first === "cljc") return "clojure";
2280
+ if (first === "rb") return "ruby";
2281
+ if (first === "c++" || first === "cxx" || first === "hpp") return "cpp";
2259
2282
  return first;
2260
2283
  }
2261
2284
 
@@ -2313,6 +2336,12 @@
2313
2336
  if (activeRuntime === "shell") return lang === "shell" || lang === "bash" || lang === "sh";
2314
2337
  if (activeRuntime === "ghci") return lang === "ghci" || lang === "haskell";
2315
2338
  if (activeRuntime === "clojure") return lang === "clojure";
2339
+ if (activeRuntime === "ruby") return lang === "ruby";
2340
+ if (activeRuntime === "java") return lang === "java";
2341
+ if (activeRuntime === "octave") return lang === "octave";
2342
+ if (activeRuntime === "matlab") return lang === "matlab";
2343
+ if (activeRuntime === "gnuplot") return lang === "gnuplot";
2344
+ if (activeRuntime === "cpp") return lang === "cpp";
2316
2345
  return true;
2317
2346
  }
2318
2347
 
@@ -12064,6 +12093,12 @@
12064
12093
  renderReplViewIfActive({ force: true });
12065
12094
  return;
12066
12095
  }
12096
+ const echoModeSelect = target.closest("[data-repl-echo-mode]");
12097
+ if (echoModeSelect && "value" in echoModeSelect) {
12098
+ chooseReplEchoMode(echoModeSelect.value);
12099
+ renderReplViewIfActive({ force: true });
12100
+ return;
12101
+ }
12067
12102
  const commandInput = target.closest("[data-repl-command]");
12068
12103
  if (commandInput && "value" in commandInput) {
12069
12104
  // For the runtime it was drawn for, even if another was selected meanwhile.
@@ -13923,6 +13958,8 @@
13923
13958
  if (normalized === "shell") return "bash";
13924
13959
  if (normalized === "ipython") return "python";
13925
13960
  if (normalized === "python" || normalized === "julia" || normalized === "r") return normalized;
13961
+ if (normalized === "octave" || normalized === "matlab") return "matlab";
13962
+ if (normalized === "cpp") return "cpp";
13926
13963
  return "text";
13927
13964
  }
13928
13965
 
@@ -13969,6 +14006,12 @@
13969
14006
  if (normalized === "shell") return "$";
13970
14007
  if (normalized === "ghci") return "ghci>";
13971
14008
  if (normalized === "clojure") return "user=>";
14009
+ if (normalized === "ruby") return "irb>";
14010
+ if (normalized === "java") return "jshell>";
14011
+ if (normalized === "octave") return "octave>";
14012
+ if (normalized === "matlab") return ">>";
14013
+ if (normalized === "gnuplot") return "gnuplot>";
14014
+ if (normalized === "cpp") return "[cling]$";
13972
14015
  return ">>>";
13973
14016
  }
13974
14017
 
@@ -13999,6 +14042,12 @@
13999
14042
  if (normalized === "r") return /^\s*(?:>|\+)\s?/.test(source);
14000
14043
  if (normalized === "ghci") return /^\s*(?:ghci>|Prelude>|\*?[A-Za-z0-9_.:]+>)\s?/.test(source);
14001
14044
  if (normalized === "clojure") return /^\s*[A-Za-z0-9_.-]+=>\s?/.test(source);
14045
+ if (normalized === "ruby") return /^\s*irb\([^)]*\):\d+(?::\d+)?[>*]\s?/.test(source);
14046
+ if (normalized === "java") return /^\s*jshell>\s?/.test(source);
14047
+ if (normalized === "octave") return /^\s*octave:\d+>\s?/.test(source);
14048
+ if (normalized === "matlab") return /^\s*>>\s?/.test(source);
14049
+ if (normalized === "gnuplot") return /^\s*gnuplot>\s?/.test(source);
14050
+ if (normalized === "cpp") return /^\s*\[cling\]\$\s?/.test(source);
14002
14051
  return false;
14003
14052
  }
14004
14053
 
@@ -14014,7 +14063,7 @@
14014
14063
  if (bannerLines.length >= 16) break;
14015
14064
  }
14016
14065
  const banner = bannerLines.join("\n").trim();
14017
- if (!/^(?:Python\s|IPython\s|R version\s|GHCi,\s|Clojure\s|Julia\s|julia\s)/i.test(banner)) return "";
14066
+ if (!/^(?:Python\s|IPython\s|R version\s|GHCi,\s|Clojure\s|Julia\s|julia\s|\|\s+Welcome to JShell\b)/i.test(banner)) return "";
14018
14067
  return banner;
14019
14068
  }
14020
14069
 
@@ -14089,7 +14138,8 @@
14089
14138
  + "<div class='repl-journal-header'><h3>Shared REPL Record</h3>" + toggleActions + "</div>"
14090
14139
  + "<p class='repl-journal-description'>What Studio and pi-repl have sent to this session.</p>"
14091
14140
  + (omitted ? "<div class='repl-journal-omitted'>Showing latest 12 entries for this session; " + escapeHtml(String(omitted)) + " older entries remain in export.</div>" : "")
14092
- + "<div class='repl-journal-list'>" + terminalContent + "</div>"
14141
+ // The prompt column fits the longest prompt, such as gnuplot>, in the prompt's own font.
14142
+ + "<div class='repl-journal-list' style='--repl-studio-prompt-chars: " + Math.max(0, ...visibleEntries.map((entry) => getReplStudioPrompt(entry.runtime).length)) + "'>" + terminalContent + "</div>"
14093
14143
  + "</section>";
14094
14144
  }
14095
14145
 
@@ -14152,6 +14202,12 @@
14152
14202
  ["r", "R"],
14153
14203
  ["ghci", "GHCi"],
14154
14204
  ["clojure", "Clojure"],
14205
+ ["ruby", "Ruby"],
14206
+ ["java", "Java"],
14207
+ ["octave", "Octave"],
14208
+ ["matlab", "MATLAB"],
14209
+ ["gnuplot", "gnuplot"],
14210
+ ["cpp", "C++"],
14155
14211
  ].map(([value, label]) => "<option value='" + escapeHtml(value) + "'" + (replRuntime === value ? " selected" : "") + ">" + escapeHtml(label) + "</option>").join("");
14156
14212
  const runtimeLabel = getReplRuntimeLabel(replRuntime);
14157
14213
  const visibleSessions = getReplSessionsForRuntime(replRuntime);
@@ -14182,6 +14238,9 @@
14182
14238
  // New layout: how Send to REPL reads the editor lives here, not in the Prompt toolbar (Oliver, 10 Oct).
14183
14239
  + (bufferSwitchingEnabled && studioUiRefreshUi ? "<label class='repl-more-send-mode' title='Raw sends the selection or all the text. Literate sends the selection, the code chunk at the cursor, or all matching chunks.'>Send mode <select class='studio-flat-select' data-repl-send-mode aria-label='Send mode'" + (wsState === "Disconnected" || uiBusy || replBusy ? " disabled" : "") + ">"
14184
14240
  + [["raw", "Raw"], ["literate", "Literate"]].map(([value, label]) => "<option value='" + value + "'" + (replSendMode === value ? " selected" : "") + ">" + label + "</option>").join("") + "</select></label>" : "")
14241
+ // Pane echo sits with Send mode; the toolbar menu isn't shown in this layout (Oliver, 19 Oct).
14242
+ + (bufferSwitchingEnabled && studioUiRefreshUi ? "<label class='repl-more-echo-mode' title='How much of the sent code the tmux pane shows: Summary up to 20 lines, Full up to 40, Off none.'>Pane echo <select class='studio-flat-select' data-repl-echo-mode aria-label='Pane echo'" + (wsState === "Disconnected" || uiBusy || replBusy ? " disabled" : "") + ">"
14243
+ + [["off", "Off"], ["summary", "Summary"], ["full", "Full"]].map(([value, label]) => "<option value='" + value + "'" + (replEchoMode === value ? " selected" : "") + ">" + label + "</option>").join("") + "</select></label>" : "")
14185
14244
  + "<button type='button' data-repl-action='stop-session'" + (canStopActiveSession ? "" : " disabled") + " title='Stop the selected Studio-owned REPL session.'>Stop session</button>"
14186
14245
  + "<button type='button' data-repl-action='interrupt'" + (activeSession && !replBusy ? "" : " disabled") + " title='Send Ctrl+C to the active REPL session.'>Interrupt</button>"
14187
14246
  + "<button type='button' data-repl-action='copy-attach-command'" + (activeSession ? "" : " disabled") + " title='Copy command for attaching to this tmux session in a terminal.'>Copy attach command</button>"
@@ -31744,16 +31803,7 @@
31744
31803
  }
31745
31804
 
31746
31805
  if (replEchoModeSelect) {
31747
- replEchoModeSelect.addEventListener("change", () => {
31748
- setReplEchoMode(replEchoModeSelect.value);
31749
- syncActionButtons();
31750
- setStatus(replEchoMode === "full"
31751
- ? "Full pane echo enabled. Bounded submitted source code will remain in raw terminal history."
31752
- : (replEchoMode === "off"
31753
- ? "Pane echo disabled; new sends will not add alignment anchors to raw terminal history."
31754
- : "Summary pane echo enabled; short submissions will be shown with compact anchors and a plain output divider."),
31755
- replEchoMode === "full" ? "warning" : "success");
31756
- });
31806
+ replEchoModeSelect.addEventListener("change", () => chooseReplEchoMode(replEchoModeSelect.value));
31757
31807
  }
31758
31808
 
31759
31809
  copyDraftBtn.addEventListener("click", async () => {
package/client/studio.css CHANGED
@@ -4990,16 +4990,19 @@
4990
4990
  white-space: pre-wrap;
4991
4991
  }
4992
4992
 
4993
+ /* The prompt column widens for a longer prompt (jshell>, octave>, gnuplot>), measured
4994
+ in the prompt's own font: --repl-studio-prompt-chars is the record's longest prompt. */
4993
4995
  .repl-studio-code-row,
4994
4996
  .repl-studio-output-row {
4995
4997
  display: grid;
4996
- grid-template-columns: var(--repl-studio-prompt-width) minmax(0, 1fr);
4998
+ grid-template-columns: minmax(var(--repl-studio-prompt-width), max-content) minmax(0, 1fr);
4997
4999
  gap: var(--repl-studio-column-gap);
4998
5000
  align-items: start;
4999
5001
  }
5000
5002
 
5001
5003
  .repl-studio-prompt,
5002
5004
  .repl-studio-output-label {
5005
+ min-width: calc(var(--repl-studio-prompt-chars, 0) * 1ch);
5003
5006
  font-family: var(--font-mono);
5004
5007
  font-size: var(--studio-working-font-size);
5005
5008
  line-height: 1.45;
@@ -7809,7 +7812,9 @@
7809
7812
  body.studio-workspace-layout .repl-more-menu button:not(:disabled):hover { border-color: transparent; background: var(--studio-header-action-hover-bg, var(--panel-2)); }
7810
7813
  body.studio-workspace-layout .repl-more-menu button:disabled { color: var(--muted); }
7811
7814
  body.studio-workspace-layout .repl-more-menu button:focus-visible { outline: none; text-decoration: underline; text-underline-offset: 3px; }
7812
- body.studio-workspace-layout .repl-more-send-mode { display: flex; align-items: center; gap: 6px; padding: 3px 8px 6px; margin-bottom: 2px; border-bottom: 1px solid var(--panel-border); color: var(--muted); font-size: 12px; }
7815
+ body.studio-workspace-layout .repl-more-send-mode,
7816
+ body.studio-workspace-layout .repl-more-echo-mode { display: flex; align-items: center; gap: 6px; padding: 3px 8px 6px; margin-bottom: 2px; border-bottom: 1px solid var(--panel-border); color: var(--muted); font-size: 12px; }
7817
+ body.studio-workspace-layout .repl-more-send-mode:has(+ .repl-more-echo-mode) { padding-bottom: 3px; margin-bottom: 0; border-bottom: 0; }
7813
7818
  body.studio-workspace-layout .files-pick-path { flex: 1 1 180px; min-width: 0; padding: 4px 8px; border: 1px solid var(--control-border); border-radius: 6px;
7814
7819
  background: var(--panel); color: var(--text); font: 12px var(--font-mono); outline: none; }
7815
7820
  body.studio-workspace-layout .files-pick-strip button { border-color: transparent; background: transparent; }