@firstpick/pi-package-webui 0.5.3 → 0.5.5

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/README.md CHANGED
@@ -133,7 +133,7 @@ Environment variables:
133
133
  - Multi-tab Pi sessions with isolated processes, working directories, prompt drafts, activity state, per-tab settings, and a workspace dashboard for common actions.
134
134
  - Unified command palette (`Ctrl/Cmd+K`) for commands, tabs, models, sessions, settings, app controls, and frequent Web UI actions.
135
135
  - Automatic tab naming from the first prompt, with `--name <name>` still available for an explicit initial tab name.
136
- - Streaming chat transcript with Markdown, thinking output, tool/bash cards, queue and compaction events, edit-and-retry from user prompts, transcript search, copy buttons, and guarded abort controls that require holding Esc or the Abort button for 3 seconds.
136
+ - Streaming chat transcript with Markdown, copy buttons for fenced code blocks, rendered Mermaid diagrams from fenced `mermaid`/`mmd` code blocks, thinking output, tool/bash cards, queue and compaction events, edit-and-retry from user prompts, transcript search, copy buttons, and guarded abort controls that require holding Esc or the Abort button for 3 seconds.
137
137
  - Prompt composer with uploads, drag/drop/paste, inline image support, generated text attachments for long input or clipboard text, editable text attachments, slash-command autocomplete, and `@` file/path references with live suggestions.
138
138
  - Leading `!` and `!!` user-bash commands from the composer, serialized per tab; `!` keeps output in the next model context and `!!` excludes it.
139
139
  - Browser-native Pi dialogs for `/model`, `/settings`, `/theme`, `/fork`, `/clone`, `/name`, `/resume`, `/tree`, `/login`, `/logout`, `/scoped-models`, `/tools`, and `/skills`, plus native-command adapter output for `/copy`, `/session`, `/new`, `/compact`, `/reload`, and `/export`.
package/bin/pi-webui.mjs CHANGED
@@ -200,6 +200,7 @@ const MIME_TYPES = new Map([
200
200
  [".html", "text/html; charset=utf-8"],
201
201
  [".jsonl", "application/x-ndjson; charset=utf-8"],
202
202
  [".js", "text/javascript; charset=utf-8"],
203
+ [".mjs", "text/javascript; charset=utf-8"],
203
204
  [".css", "text/css; charset=utf-8"],
204
205
  [".svg", "image/svg+xml"],
205
206
  [".png", "image/png"],
@@ -4056,6 +4057,15 @@ function normalizeStaticPath(urlPath) {
4056
4057
  return name;
4057
4058
  }
4058
4059
 
4060
+ function mermaidStaticPath(urlPath) {
4061
+ const prefix = "/vendor/mermaid/";
4062
+ if (!String(urlPath || "").startsWith(prefix)) return undefined;
4063
+ const relative = urlPath.slice(prefix.length);
4064
+ if (relative === "mermaid.esm.min.mjs") return path.join(packageRoot, "node_modules", "mermaid", "dist", relative);
4065
+ if (/^chunks\/mermaid\.esm\.min\/[A-Za-z0-9._-]+\.mjs$/.test(relative)) return path.join(packageRoot, "node_modules", "mermaid", "dist", relative);
4066
+ return undefined;
4067
+ }
4068
+
4059
4069
  const compressWithBrotli = promisify(brotliCompress);
4060
4070
  const compressWithGzip = promisify(gzip);
4061
4071
  const STATIC_COMPRESSIBLE_EXTENSIONS = new Set([".html", ".css", ".js", ".mjs", ".svg", ".json", ".webmanifest"]);
@@ -4096,9 +4106,8 @@ function requestEtagMatches(req, etag) {
4096
4106
  async function serveStatic(req, res, url) {
4097
4107
  if (req.method !== "GET") return false;
4098
4108
  const staticName = normalizeStaticPath(url.pathname);
4099
- if (!staticName) return false;
4100
-
4101
- const filePath = path.join(publicDir, staticName);
4109
+ const filePath = staticName ? path.join(publicDir, staticName) : mermaidStaticPath(url.pathname);
4110
+ if (!filePath) return false;
4102
4111
  const ext = path.extname(filePath);
4103
4112
  const asset = await loadStaticAsset(filePath);
4104
4113
  const headers = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firstpick/pi-package-webui",
3
- "version": "0.5.3",
3
+ "version": "0.5.5",
4
4
  "description": "Pi Web UI companion package with a local browser UI CLI plus /webui-start and /webui-status commands.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/Firstp1ck/npm-packages/tree/main/pi-package-webui#readme",
@@ -53,7 +53,8 @@
53
53
  "test": "node tests/run-all.mjs"
54
54
  },
55
55
  "dependencies": {
56
- "@earendil-works/pi-coding-agent": "^0.79.8"
56
+ "@earendil-works/pi-coding-agent": "^0.79.8",
57
+ "mermaid": "^11.15.0"
57
58
  },
58
59
  "optionalDependencies": {
59
60
  "@firstpick/pi-extension-btw": "^0.1.0",