pi-studio 0.9.20 → 0.9.22
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 +18 -1
- package/README.md +2 -2
- package/client/studio-annotation-helpers.js +20 -1
- package/client/studio-client.js +451 -58
- package/client/studio.css +82 -0
- package/index.ts +168 -26
- package/package.json +1 -1
- package/shared/studio-markdown-fences.js +22 -0
- package/shared/studio-markdown-fences.ts +22 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `pi-studio` are documented here.
|
|
4
4
|
|
|
5
|
-
## [
|
|
5
|
+
## [0.9.22] — 2026-05-29
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
- Added **Open current file in new editor tab** and **Open current text as copy in new editor tab** to Source & context for explicit file-backed vs detached-copy tab opening.
|
|
9
|
+
- Added `Cmd/Ctrl+Alt+P` to switch the right pane directly back to Preview without cycling through Files, REPL, or Working.
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
- Changed the editor toolbar's detached-copy action into **New editor tab** for opening a blank editor tab, moved **Send current text to Pi editor** into Source & context, separated the passive origin summary from explicit **Detach from file** / **Reset origin** actions, and aligned local link menus with Files-view wording (**Open file tab** / **Convert tab**).
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
- New Studio tabs opened from Files, local preview links, preview exports, or editor-tab actions now skip cloned browser-tab workspace restore on first load, preventing inherited Files/preview state from briefly flashing and replacing the requested document preview.
|
|
16
|
+
|
|
17
|
+
## [0.9.21] — 2026-05-28
|
|
18
|
+
|
|
19
|
+
### Added
|
|
20
|
+
- Added **Recent…** to the Scratchpad so scratchpads saved under previous file/draft identities can be loaded, appended, or copied after reopening Studio or continuing a Pi session.
|
|
21
|
+
- Preview export now distinguishes **Export PDF and Open in Studio preview tab** from **Export PDF and Open in default PDF viewer**; the Studio path opens a Files-view-style editor-only preview tab with a `studio-pdf` block.
|
|
22
|
+
- HTML export now distinguishes **Export HTML and Open in Studio editor** from **Export HTML and Open in browser**; the Studio path opens the exported HTML in an editor-only Studio tab for inspection, editing, previewing, and comment mode.
|
|
6
23
|
|
|
7
24
|
## [0.9.20] — 2026-05-27
|
|
8
25
|
|
package/README.md
CHANGED
|
@@ -25,7 +25,7 @@ Extension for [pi](https://pi.dev) that opens a local two-pane browser workspace
|
|
|
25
25
|
- Includes a live **Working** view for following current model/tool activity, with `All` / `Thinking` / `Tools` filters, image previews for image-producing tool outputs, plus **Load visible into editor** and **Copy visible** actions; when cycling response history, Working follows saved working details for the selected response when available
|
|
26
26
|
- Includes a right-pane **Files** view for browsing the current Pi session/resource directory, opening folders, loading text/code/CSV/TSV documents into the editor, previewing PDFs/images, opening PDF/image previews in a new Studio tab, converting DOCX/ODT documents to editable Markdown when Pandoc is available after confirmation, copying paths, setting the current folder as the Studio working directory, and revealing files in the file manager
|
|
27
27
|
- Includes an optional tmux-backed **REPL** view for Shell, Python, IPython, Julia, R, GHCi, and Clojure sessions, with Raw/Literate send modes, `Cmd/Ctrl+Shift+Enter` **Send to REPL**, session start/stop/interrupt controls, a compact refresh-persistent **Studio REPL Record** of user and Pi-sent code, a secondary raw tmux mirror, agent-facing `studio_repl_status` / `studio_repl_send` tools, and Markdown/PDF/HTML export
|
|
28
|
-
- Includes a local persistent scratchpad for quick notes you want to keep out of the main editor until you're ready to copy or insert them
|
|
28
|
+
- Includes a local persistent scratchpad for quick notes you want to keep out of the main editor until you're ready to copy or insert them, with a **Recent…** picker for recovering scratchpads saved under earlier file/draft identities
|
|
29
29
|
- Includes a docked **Outline** rail for navigating document structure in the current editor text, with clickable entries that jump in the raw editor and reveal matching preview locations when available
|
|
30
30
|
- Restores the current browser-tab editor workspace after refresh and provides an explicit **Reset editor** action when you want to discard the restored draft and return the tab to a fresh blank draft without changing responses or saved files
|
|
31
31
|
- Turns local preview links, including links inside sandboxed HTML previews, into Studio actions: PDFs open in the embedded viewer, images open in a zoomable focus viewer, PDF/image links can open in a new Studio preview tab, text/code/CSV/TSV document links can open in a new editor tab, DOCX/ODT links can be converted to editable Markdown, and right-click menus provide **Open here**, **Reveal in file manager**, and **Copy path** for local resources
|
|
@@ -43,7 +43,7 @@ Extension for [pi](https://pi.dev) that opens a local two-pane browser workspace
|
|
|
43
43
|
- Renders straight, unfenced interactive HTML in preview via a sandboxed browser iframe with zoom controls, while fenced `html` blocks remain source code
|
|
44
44
|
- Embeds local PDFs in Studio Markdown previews via explicit `studio-pdf` fenced blocks, with a Focus action for temporarily enlarging the embedded viewer
|
|
45
45
|
- Ships optional `pi-studio-dark` and `pi-studio-light` themes tuned for Studio's browser workspace
|
|
46
|
-
- Exports right-pane preview as PDF (pandoc + LaTeX) or standalone HTML into the source file directory, Studio working directory, or Pi session directory, preserving authored HTML previews as HTML and rendering CSV/TSV editor previews as tables
|
|
46
|
+
- Exports right-pane preview as PDF (pandoc + LaTeX) or standalone HTML into the source file directory, Studio working directory, or Pi session directory; PDF export can open in a Studio preview tab or the default PDF viewer, and HTML export can open in the default browser or in a new Studio editor tab for inspection/commenting, while preserving authored HTML previews as HTML and rendering CSV/TSV editor previews as tables
|
|
47
47
|
- Exports local files headlessly via `/studio-pdf <path>` to `<name>.studio.pdf` or `/studio-html <path>` to `<name>.studio.html`; without a path, those commands export the last model response to a timestamped file
|
|
48
48
|
- Shows model/session/context usage in the footer, plus a compact-context action
|
|
49
49
|
|
|
@@ -500,6 +500,23 @@
|
|
|
500
500
|
return out;
|
|
501
501
|
}
|
|
502
502
|
|
|
503
|
+
const SMART_MARKDOWN_FENCE_CHARS = "`´‘’‚‛“”„‟′‵";
|
|
504
|
+
const SMART_MARKDOWN_FENCE_RE = new RegExp(`^([ \\t]{0,3})([${SMART_MARKDOWN_FENCE_CHARS.replace(/[\\\\\]^-]/g, "\\\\$&")}]{3,})([^${SMART_MARKDOWN_FENCE_CHARS.replace(/[\\\\\]^-]/g, "\\\\$&")}\\r\\n]*)$`);
|
|
505
|
+
|
|
506
|
+
function normalizeMarkdownSmartFences(markdown) {
|
|
507
|
+
return String(markdown || "")
|
|
508
|
+
.replace(/\r\n/g, "\n")
|
|
509
|
+
.split("\n")
|
|
510
|
+
.map(function(line) {
|
|
511
|
+
const match = line.match(SMART_MARKDOWN_FENCE_RE);
|
|
512
|
+
if (!match) return line;
|
|
513
|
+
const run = match[2] || "";
|
|
514
|
+
if (!/[´‘’‚‛“”„‟′‵]/u.test(run)) return line;
|
|
515
|
+
return (match[1] || "") + "`".repeat(Math.max(3, Array.from(run).length)) + (match[3] || "");
|
|
516
|
+
})
|
|
517
|
+
.join("\n");
|
|
518
|
+
}
|
|
519
|
+
|
|
503
520
|
function transformMarkdownOutsideFences(text, plainTransformer) {
|
|
504
521
|
const source = String(text || "").replace(/\r\n/g, "\n");
|
|
505
522
|
if (!source) return source;
|
|
@@ -642,11 +659,12 @@
|
|
|
642
659
|
}
|
|
643
660
|
|
|
644
661
|
function prepareMarkdownForPandocPreview(markdown, placeholderPrefix) {
|
|
662
|
+
const normalizedMarkdown = normalizeMarkdownSmartFences(markdown);
|
|
645
663
|
const placeholders = [];
|
|
646
664
|
const prefix = typeof placeholderPrefix === "string" && placeholderPrefix
|
|
647
665
|
? placeholderPrefix
|
|
648
666
|
: "PISTUDIOANNOT";
|
|
649
|
-
const prepared = transformMarkdownOutsideFences(
|
|
667
|
+
const prepared = transformMarkdownOutsideFences(normalizedMarkdown, function(segment) {
|
|
650
668
|
return replaceInlineAnnotationMarkers(segment, function(marker) {
|
|
651
669
|
const label = normalizePreviewAnnotationLabel(marker.body);
|
|
652
670
|
if (!label) return "";
|
|
@@ -663,6 +681,7 @@
|
|
|
663
681
|
hasAnnotationMarkers: hasAnnotationMarkers,
|
|
664
682
|
normalizePreviewAnnotationLabel: normalizePreviewAnnotationLabel,
|
|
665
683
|
extractStandaloneMarkdownImageCaptionText: extractStandaloneMarkdownImageCaptionText,
|
|
684
|
+
normalizeMarkdownSmartFences: normalizeMarkdownSmartFences,
|
|
666
685
|
prepareMarkdownForPandocPreview: prepareMarkdownForPandocPreview,
|
|
667
686
|
readInlineAnnotationMarkerAt: readInlineAnnotationMarkerAt,
|
|
668
687
|
renderPreviewAnnotationHtml: renderPreviewAnnotationHtml,
|