Skip to content

feat: Portato README, project website, Chat/Work code highlighting - #448

Merged
Brooooooklyn merged 4 commits into
mainfrom
feat/readme-website
Nov 30, 2026
Merged

Brooooooklyn merged 4 commits into
mainfrom
feat/readme-website

Conversation

@Brooooooklyn

Copy link
Copy Markdown
Contributor

Summary

One PR for three linked parts. Portato, the desktop app, is the lead of both the README and the site.

Part What changes
Code highlighting (packages/dashboard) Code fences in Chat and Work replies are colored with Shiki grammars, in light and dark.
README It is rewritten around Portato, with live light and dark captures of Chat and Work. Every library package gets its install line and one sample. docs/cuda.md holds the CUDA preview notes.
Website (website/) A new static site for Portato and the libraries (Void, React 19, Tailwind v4, Arc and Arc Pro), with 18 routes. CI builds it in .github/workflows/website.yml.

Code highlighting

reply text ──▶ md-nodes (fence) ──▶ HighlightedCode ──▶ code-highlight.ts (main thread)
                                                         │  per-frame node budget (5,000)
                                                         │  settled-block cache (1M chars / 200k tokens)
                                                         ▼
                                     code-highlight.worker.ts (one same-origin module worker)
                                       Shiki primitive + JS regex engine (bounded LRU cache)
                                       5 s CPU budget per pass (open line included)
                                       watchdog: 250 ms of silence (1 s on a grammar's first line)
                                         → end the worker, draw the rest of the block plain
  • Tokens render as React spans, never as innerHTML. The CSP is unchanged (script-src 'self').
  • A grammar with catastrophic backtracking cannot freeze the window. The watchdog ends the worker, and that block falls back to plain text.
  • Sizes: main chunk 3,277,363 B (cap 4,000,000), worker 1,488,618 B (cap 2,500,000). pack.test.ts checks both.

Website

  • The landing hero, the bento and the /portato Chat and Work views are the dashboard's own React components. They render at build time from data recorded in a real, isolated Portato run (website/scripts/record-portato-run.ts). They are scoped so their CSS cannot leak into the site, and they ship 0 JS.
  • The model-family table on the landing page is now an Arc orbit-logos block. It has 9 maker marks (from @lobehub/icons-static-svg, MIT) and a list of the 13 families by maker. On a phone every maker is named in text with no tap. The full table stays on /docs/models.
  • Build-time checks: check-samples (samples type-check, and the README and docs copies match), check-numbers (measured figures match their sources), check-site (links, anchors, assets, families) and check-portato-mock (mock data and budgets).
  • The build writes third-party-notices.txt, linked from every page's footer.

Also in this PR

  • test(dashboard): a timer race in chat-agent-watch.test.ts ("a file that never holds the turn end…"). The test now keeps lines for 5 s, the same order as production (30 s against a 5 s swap limit).

How it was checked

  • yarn typecheck, root vp lint --type-aware --type-check and the dashboard suite (254 files, 6,849 tests, run with a throwaway HOME).
  • Site: build, the 4 checks and tsc.
  • Real-browser passes of all 18 routes at 1440, 1280, 1024, 768, 390 and 320 px, in light and dark, with JS on and off, and with reduced motion. They ran in Chromium, Firefox and WebKit, covered every interaction, and included design reviews.
  • The code samples were run on local models (Qwen3-0.6B, Qwen3.8-27B GGUF, Qwen3-ASR, Qwen3-TTS), with a scratch HOME.
  • Two Codex adversarial reviews (the whole branch, then the delta). Each finding was verified against the code before any change.

Known limits

  • Unmounting about 360k colored spans takes more than 100 ms.
  • The last line of a settled block with more than 1,000 tokens stays plain.
  • A minified line of about 5,000 chars that streams in tiny steps goes plain after about 4,400 chars (the 5 s budget).
  • Two vscode-textmate scope-name caches still grow by about 0.7 KB for each distinct heredoc delimiter.

Owner items (not changed here)

  1. Decide before any deploy: maker marks and brand rules. The orbit shows mono marks from LobeHub (MIT for the files) under nominative use, with the line "The marks are trademarks of their makers. Showing one does not mean its maker endorses mlx-node." The makers' own brand rules were not cleared. NVIDIA's rules ask for written permission and forbid recoloring, and Google and Meta have similar rules. To show a maker as a text tile, as IFM and Thinking Machines Lab already are, change one line per maker in website/src/data/models.ts.
  2. GRPO loss on the first update reads 57 to 118,075, where about 0 is expected. The logprobs saved at sampling differ from the training pass, so the ratio hits its 1e6 cap (crates/mlx-core/src/grpo/loss.rs). The site's GRPO sample prints meanReward only.
  3. The "Custom Training Loop" example in packages/trl/README.md is wrong: trainStep is not awaited, a field name is wrong, and each step is counted twice.
  4. docs/models.md calls Hy4-flash "text only" in two places, but it has vision since feat(hy4,qwen4_exp,dashboard): Hy4-flash vision & DFly2-B6, Qwen4 4L perf/parity, Work-mode images, and barrier KV eviction #435.
  5. The Portato app ships no license notices for its bundled npm libraries (57 on main, plus Shiki now).
  6. Root vp fmt --check flags crates/mlx-core/Cargo.toml and crates/mlx-paged-attn/Cargo.toml. origin/main gives the same result.
  7. mlx serve --help does not list the Flash-Next and Hy4-flash disk-cache flags.
  8. Arc Pro lightbox: after Escape, focus goes to the page body (upstream).
  9. check-samples is not in CI, because it needs the root install. It could join the lint job in ci.yml.
  10. The site mocks show the capture's real Work folder, /private/var/tmp/todo-lib. A different path needs a new capture.

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d4930835-ad79-4644-ac27-d437dedf3de0

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-30T14:06:16.281590Z 9a8e2c9 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Brooooooklyn and others added 4 commits November 30, 2026 22:39
Code fences in Chat and Work replies are colored with Shiki grammars in a
same-origin module worker. A watchdog ends a pass that stalls (a grammar
with catastrophic backtracking) and draws the rest of that block plain, so
the window never freezes. Tokens render as React spans; all blocks share
one per-frame budget of new nodes, and a settled-block cache keeps
remounts cheap. The palette follows the app's light and dark tokens.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The README leads with Portato, the desktop app, with live light and dark
captures of Chat and Work, then documents every library package with its
install line and one sample. docs/cuda.md holds the CUDA preview notes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A static Void site (React 19, Tailwind v4, Arc and Arc Pro components) for
Portato and the library packages. The landing page and /portato show the
app's own dashboard components, rendered at build time with data recorded
from a real run, scoped so their CSS cannot leak into the site. Docs pages
cover the app, every package, models and platforms. Build-time checks keep
code samples, numbers, links and mocks true; website.yml builds and runs
them on pull requests.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… case

The case "a file that never holds the turn end" dropped kept lines 60 ms
after the end while the swap waited up to 50 ms, so 5 to 8 ms of lag on a
busy machine let the drop run first and the test saw no lines. Keep them
for 5 s, as production keeps 30 s against a 5 s swap limit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Brooooooklyn
Brooooooklyn merged commit 9dd2e11 into main Nov 30, 2026
22 checks passed
@Brooooooklyn
Brooooooklyn deleted the feat/readme-website branch November 30, 2026 15:16
Brooooooklyn added a commit that referenced this pull request Dec 1, 2026
## Summary

Follow-ups to #448: items 2 to 9 of its owner list.

| Item | Change |
|---|---|
| 2 | `packages/trl/README.md`: the custom training loop awaits
`trainStep` and counts each step once. Nine more examples in that README
now use the real API. All 14 examples type-check. |
| 3 | Docs: Hy4-flash and Qwen3.8-Flash-Next take images through their
`mmproj` file. They are no longer called text only. |
| 4 | Portato: a **Licenses** tab in Settings (and in ⌘K), built from
Arc components. |
| 5 | `vp fmt` on the two `Cargo.toml` files. Repo-wide `vp fmt --check`
exits 0. |
| 6 | `mlx serve --help` and `docs/cli.md` name every family each flag
applies to, with each family's limits and defaults. |
| 7 | Website: the Arc Pro lightbox returns focus to its thumbnail after
Escape, Close or a backdrop click. |
| 8 | No change. `website.yml` from #448 already runs `check-samples`. |
| 9 | Website mocks: the capture folder is mapped to `/path/to/todo-lib`
in every string. A check fails if a capture path is left. |

### Licenses tab

```
vite build ─ main bundle ─┐
           └ worker ──────┼─▶ collector ─▶ third-party-licenses.json (238 KB, cap 400 KB)
fonts, grammars,          │              └▶ third-party-notices.txt
vendored code, overrides ─┘
Settings ▸ Licenses ── fetch over app:// when the tab opens (no license text in the main chunk)
```

- 113 entries: Portato, 68 interface packages and the bundler runtime, 5
fonts, 29 grammars, 9 adapted files.
- The build fails when a shipped item has no non-empty license text,
when an override is stale, or when a license expression is not allowed.
The expression is parsed (`AND`, `OR`, `WITH`, parentheses), not split.
- The allow list holds SPDX ids only. Three reviewed exceptions are
approved one entry at a time: Liberation Sans, Arc Pro and the TOML
grammar.
- Components: Arc `Tabs`, `SearchField`, `Select`, `Badge`,
`EmptyState`, `Alert` and `Button`, and the app's `Disclosure` and
`CodePanel`. Three opt-in props were added: `Disclosure.stickyTop`,
`CodePanel.keepToggleInPlace` and Arc `Select.menuWidth` (recorded in
`PROVENANCE.md`). Other callers are unchanged.
- Main chunk: 3,291,298 B (cap 4,000,000). Worker: unchanged.

## How it was checked

- `yarn typecheck`, repo-wide `vp fmt --check` and `vp lint --type-aware
--type-check`.
- Tests: dashboard and CLI, 7,354 passed, with a throwaway HOME.
- The site: build, the 4 checks and `tsc`.
- Licenses tab:
- The real `app://` handler in Electron, packaged and dev layouts: 200,
`application/json`, no CSP block.
  - Each build-failure rule fires on a planted fault.
  - License texts compared with upstream at the pinned commits.
- The dev harness at 720×480, 1180×800 and 1440×900, light and dark, by
keyboard. A design review was done, and its findings are fixed.
- Lightbox: 12/12 focus cases fail before the fix and pass after it, in
Chromium and WebKit.
- One Codex adversarial review. All 6 findings were reproduced and
fixed: Windows paths, the SPDX parser, the Vite runtime notice, empty
texts, the Liberation pin and the `--max-context` limits.

## Owner items (not changed here)

1. **Liberation Sans source offer.** The app ships pdf.js's four
Liberation Sans 1.07.4 fonts (GPL-2.0 with the font exception). This was
true before this PR. GPLv2 §3 asks for the source with the binaries, or
a written offer. A link to the upstream commit is neither. The options:
   - Ship or host the 2.8 MB source tarball.
   - Add a written offer.
   - Move to Liberation 2.x (OFL). This needs a pdf.js patch.
   - Stop shipping the fonts.
2. The README pictures `images/portato-work-{light,dark}.webp` still
show `/private/var/tmp/todo-lib`. New pictures need a new isolated run.
3. Not done in this PR:
   - Stage B: the 59 Node packages that the desktop app stages.
   - Electron and Chromium notices in the macOS `.app`.
   - The native addon's crate notices.
   - The `mlx-agent` license assets.
4. The "Int8 queries" section of `docs/models.md` still says 7,168
tokens. The code says 256 (since #389).
5. At 720 px, license text lines break short. A fix changes padding that
every `CodePanel` user shares.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant