litepaseo 0.2.0 → 0.3.1

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.
Files changed (91) hide show
  1. package/CHANGELOG.md +78 -0
  2. package/README.md +113 -39
  3. package/dist/server/cli.mjs +1346 -150
  4. package/dist/web/assets/{CodeBlockNode-CehKIzSk.js → CodeBlockNode-fLbELjCG.js} +1 -1
  5. package/dist/web/assets/CodeBlockNode-fLbELjCG.js.br +0 -0
  6. package/dist/web/assets/CodeBlockNode-fLbELjCG.js.gz +0 -0
  7. package/dist/web/assets/{FileViewer-01t53KTX.js → FileViewer-C7zGfiFt.js} +1 -1
  8. package/dist/web/assets/FileViewer-C7zGfiFt.js.br +0 -0
  9. package/dist/web/assets/FileViewer-C7zGfiFt.js.gz +0 -0
  10. package/dist/web/assets/{FilesPanel-B7NknFvl.js → FilesPanel-B1YfdWK8.js} +1 -1
  11. package/dist/web/assets/FilesPanel-B1YfdWK8.js.br +0 -0
  12. package/dist/web/assets/FilesPanel-B1YfdWK8.js.gz +0 -0
  13. package/dist/web/assets/{MarkdownMessage-UlvozPc5.js → MarkdownMessage-C30PkBRA.js} +5 -5
  14. package/dist/web/assets/MarkdownMessage-C30PkBRA.js.br +0 -0
  15. package/dist/web/assets/{MarkdownMessage-UlvozPc5.js.gz → MarkdownMessage-C30PkBRA.js.gz} +0 -0
  16. package/dist/web/assets/{PreCodeBlock-DPQTlYty.js → PreCodeBlock-3ozveRNf.js} +1 -1
  17. package/dist/web/assets/{PreCodeBlock.vue_vue_type_style_index_0_lang-Cdy-YZRP.js → PreCodeBlock.vue_vue_type_style_index_0_lang-BPnMZFbo.js} +1 -1
  18. package/dist/web/assets/PreCodeBlock.vue_vue_type_style_index_0_lang-BPnMZFbo.js.br +0 -0
  19. package/dist/web/assets/PreCodeBlock.vue_vue_type_style_index_0_lang-BPnMZFbo.js.gz +0 -0
  20. package/dist/web/assets/{TerminalPanel-BdmAonFr.js → TerminalPanel-BR2okuCE.js} +1 -1
  21. package/dist/web/assets/TerminalPanel-BR2okuCE.js.br +0 -0
  22. package/dist/web/assets/TerminalPanel-BR2okuCE.js.gz +0 -0
  23. package/dist/web/assets/{Tooltip-BJ2o2M_0.js → Tooltip-Dh7ELGI1.js} +1 -1
  24. package/dist/web/assets/Tooltip-Dh7ELGI1.js.br +0 -0
  25. package/dist/web/assets/Tooltip-Dh7ELGI1.js.gz +0 -0
  26. package/dist/web/assets/index-BJ4CkuXT.js +30 -0
  27. package/dist/web/assets/index-BJ4CkuXT.js.br +0 -0
  28. package/dist/web/assets/index-BJ4CkuXT.js.gz +0 -0
  29. package/dist/web/assets/index-CaFqUnEO.css +1 -0
  30. package/dist/web/assets/index-CaFqUnEO.css.br +0 -0
  31. package/dist/web/assets/index-CaFqUnEO.css.gz +0 -0
  32. package/dist/web/assets/{index10-WpTfisco.js → index10-BXOnBXXV.js} +1 -1
  33. package/dist/web/assets/index10-BXOnBXXV.js.br +0 -0
  34. package/dist/web/assets/index10-BXOnBXXV.js.gz +0 -0
  35. package/dist/web/assets/index3-C1CbKHXb.js +1 -0
  36. package/dist/web/assets/index4-CE4EA6Rx.js +1 -0
  37. package/dist/web/assets/{index5-BCbIyN1t.js → index5-BrR0S3K6.js} +1 -1
  38. package/dist/web/assets/index5-BrR0S3K6.js.br +0 -0
  39. package/dist/web/assets/index5-BrR0S3K6.js.gz +0 -0
  40. package/dist/web/assets/{index6-CbdnTDhy.js → index6-DWBoE2gM.js} +1 -1
  41. package/dist/web/assets/index6-DWBoE2gM.js.br +0 -0
  42. package/dist/web/assets/index6-DWBoE2gM.js.gz +0 -0
  43. package/dist/web/assets/{index7-BzNzdNxO.js → index7-CoJTOvQ5.js} +1 -1
  44. package/dist/web/assets/index7-CoJTOvQ5.js.br +0 -0
  45. package/dist/web/assets/index7-CoJTOvQ5.js.gz +0 -0
  46. package/dist/web/assets/{index8-CD8jmACo.js → index8-CQGhir4p.js} +1 -1
  47. package/dist/web/assets/index8-CQGhir4p.js.br +0 -0
  48. package/dist/web/assets/index8-CQGhir4p.js.gz +0 -0
  49. package/dist/web/assets/{index9-9FYLmtt9.js → index9-D_kItRZJ.js} +1 -1
  50. package/dist/web/assets/index9-D_kItRZJ.js.br +0 -0
  51. package/dist/web/assets/index9-D_kItRZJ.js.gz +0 -0
  52. package/dist/web/index.html +2 -2
  53. package/dist/web/index.html.br +0 -0
  54. package/dist/web/index.html.gz +0 -0
  55. package/docs/cloudflare-access.md +111 -0
  56. package/docs/performance-plan.md +119 -241
  57. package/package.json +5 -2
  58. package/dist/web/assets/CodeBlockNode-CehKIzSk.js.br +0 -0
  59. package/dist/web/assets/CodeBlockNode-CehKIzSk.js.gz +0 -0
  60. package/dist/web/assets/FileViewer-01t53KTX.js.br +0 -0
  61. package/dist/web/assets/FileViewer-01t53KTX.js.gz +0 -0
  62. package/dist/web/assets/FilesPanel-B7NknFvl.js.br +0 -0
  63. package/dist/web/assets/FilesPanel-B7NknFvl.js.gz +0 -0
  64. package/dist/web/assets/MarkdownMessage-UlvozPc5.js.br +0 -0
  65. package/dist/web/assets/PreCodeBlock.vue_vue_type_style_index_0_lang-Cdy-YZRP.js.br +0 -0
  66. package/dist/web/assets/PreCodeBlock.vue_vue_type_style_index_0_lang-Cdy-YZRP.js.gz +0 -0
  67. package/dist/web/assets/TerminalPanel-BdmAonFr.js.br +0 -0
  68. package/dist/web/assets/TerminalPanel-BdmAonFr.js.gz +0 -0
  69. package/dist/web/assets/Tooltip-BJ2o2M_0.js.br +0 -0
  70. package/dist/web/assets/Tooltip-BJ2o2M_0.js.gz +0 -0
  71. package/dist/web/assets/index-D_YTh7Zw.css +0 -1
  72. package/dist/web/assets/index-D_YTh7Zw.css.br +0 -0
  73. package/dist/web/assets/index-D_YTh7Zw.css.gz +0 -0
  74. package/dist/web/assets/index-civcSERr.js +0 -27
  75. package/dist/web/assets/index-civcSERr.js.br +0 -0
  76. package/dist/web/assets/index-civcSERr.js.gz +0 -0
  77. package/dist/web/assets/index10-WpTfisco.js.br +0 -0
  78. package/dist/web/assets/index10-WpTfisco.js.gz +0 -0
  79. package/dist/web/assets/index3-C4yf5W5o.js +0 -1
  80. package/dist/web/assets/index4-Cwl0ij4U.js +0 -1
  81. package/dist/web/assets/index5-BCbIyN1t.js.br +0 -0
  82. package/dist/web/assets/index5-BCbIyN1t.js.gz +0 -0
  83. package/dist/web/assets/index6-CbdnTDhy.js.br +0 -0
  84. package/dist/web/assets/index6-CbdnTDhy.js.gz +0 -0
  85. package/dist/web/assets/index7-BzNzdNxO.js.br +0 -0
  86. package/dist/web/assets/index7-BzNzdNxO.js.gz +0 -0
  87. package/dist/web/assets/index8-CD8jmACo.js.br +0 -0
  88. package/dist/web/assets/index8-CD8jmACo.js.gz +0 -0
  89. package/dist/web/assets/index9-9FYLmtt9.js.br +0 -0
  90. package/dist/web/assets/index9-9FYLmtt9.js.gz +0 -0
  91. package/docs/operations.md +0 -143
@@ -0,0 +1,111 @@
1
+ # Protecting LitePaseo with Cloudflare Access
2
+
3
+ A signed-in LitePaseo session can start agents, approve their permissions and add hosts: it
4
+ effectively runs commands on your machines. LitePaseo's own sign-in (access token plus
5
+ optional authenticator code) is the last line of defence. When the console is reachable from
6
+ the internet through Cloudflare Tunnel, put **Cloudflare Access** in front of it as well, so
7
+ anonymous visitors never reach LitePaseo at all.
8
+
9
+ This guide assumes the tunnel from [HTTPS & remote access](../README.md#https--remote-access)
10
+ already serves `https://agents.example.com` from `http://127.0.0.1:8787`.
11
+
12
+ ## What keeps working
13
+
14
+ | Feature | Behind Access |
15
+ | --- | --- |
16
+ | Push notifications | Work. The server sends them straight to the browser's push service (Apple, Google, Mozilla); they never pass through your hostname. |
17
+ | Live updates (SSE), API, voice input WebSocket | Work. They are same-origin requests and carry the Access cookie. |
18
+ | Tapping a notification | Works. If the Access session expired, you sign in to Access first and then land in the conversation. |
19
+ | PWA install, icons, service worker updates | Need the bypass rule below. Browsers fetch the manifest without cookies, so Access would block it. |
20
+
21
+ When the Access session expires while a page is open, API calls fail (they are redirected to
22
+ Cloudflare's login page, which a script cannot follow) and the console shows as disconnected.
23
+ Reload the page to sign in again. A long session duration keeps this rare.
24
+
25
+ ## 1. Protect the hostname
26
+
27
+ In the [Cloudflare One dashboard](https://one.dash.cloudflare.com/):
28
+
29
+ 1. Go to **Access → Applications → Add an application → Self-hosted**.
30
+ 2. **Application name:** `LitePaseo`. **Session duration:** `1 month` (or what you accept).
31
+ 3. **Public hostname:** `agents.example.com`, path left empty (the whole site).
32
+ 4. Add a policy:
33
+ - **Action:** Allow
34
+ - **Include:** Emails → your own address (or a login method such as GitHub restricted to
35
+ your account).
36
+ 5. Identity: the built-in **One-time PIN** (email code) works with no setup. If you enable a
37
+ single identity provider, turn on **Instant Auth** to skip the provider chooser.
38
+ 6. Save. Leave the cookie settings at their defaults.
39
+
40
+ ## 2. Bypass the public static files
41
+
42
+ These files contain no data and must load without the Access cookie. Add a **second**
43
+ self-hosted application for the same hostname; Access applies the more specific path first.
44
+
45
+ 1. **Access → Applications → Add an application → Self-hosted**, name `LitePaseo static`.
46
+ 2. Public hostnames, all on `agents.example.com`:
47
+ - path `manifest.webmanifest`
48
+ - path `sw.js`
49
+ - path `icons/*`
50
+ 3. Policy: **Action: Bypass**, **Include: Everyone**.
51
+
52
+ Do **not** bypass `/`, `/assets/*` or anything under `/api/`.
53
+
54
+ ## 3. Force HTTPS
55
+
56
+ In the regular Cloudflare dashboard for your domain, under **SSL/TLS → Edge Certificates**:
57
+
58
+ - Turn on **Always Use HTTPS**.
59
+ - Enable **HSTS** (a max-age of 6 months is a reasonable start).
60
+
61
+ LitePaseo marks its session cookie `Secure` when Cloudflare reports the visitor used HTTPS,
62
+ so a plain `http://` visit can never carry or receive it.
63
+
64
+ ## 4. Check the result
65
+
66
+ From a machine that is not signed in to Access:
67
+
68
+ ```sh
69
+ # The console itself is behind Access: expect 302 to *.cloudflareaccess.com
70
+ curl -sI https://agents.example.com/ | grep -iE '^(HTTP|location)'
71
+ curl -sI https://agents.example.com/api/health | grep -iE '^(HTTP|location)'
72
+
73
+ # Static files are reachable: expect 200
74
+ curl -s -o /dev/null -w '%{http_code}\n' https://agents.example.com/manifest.webmanifest
75
+ curl -s -o /dev/null -w '%{http_code}\n' https://agents.example.com/sw.js
76
+ curl -s -o /dev/null -w '%{http_code}\n' https://agents.example.com/icons/icon-192.png
77
+ ```
78
+
79
+ Then, in a browser:
80
+
81
+ 1. Open the hostname in a private window: Access asks you to sign in, then LitePaseo asks for
82
+ its token and authenticator code.
83
+ 2. In developer tools, confirm the `lp_session` cookie is `Secure`, `HttpOnly`,
84
+ `SameSite=Strict`.
85
+ 3. Install the app, enable notifications in **Settings → Notifications**, and send a test
86
+ notification with the phone locked.
87
+
88
+ Also check the tunnel's ingress rules: only this hostname should point to
89
+ `http://127.0.0.1:8787`, and the final catch-all rule should be `http_status:404`, so no other
90
+ local service (such as a Paseo daemon) is published by accident.
91
+
92
+ ## iPhone and iPad home-screen app
93
+
94
+ An app added to the iOS home screen keeps its cookies apart from Safari, and the Access sign-in
95
+ leaves the app's domain. If the installed app keeps returning to the Access login page:
96
+
97
+ - Install the **Cloudflare One (WARP)** client on the device, enroll it in your Zero Trust
98
+ organization, and change the Access policy to allow your enrolled devices (for example
99
+ **Include: Gateway**, or a device posture check). The app is then admitted without a
100
+ browser sign-in.
101
+ - Otherwise, keep using LitePaseo in Safari itself; notifications on iOS require the
102
+ home-screen app, though.
103
+
104
+ ## If something leaks
105
+
106
+ - Lost or stolen device: revoke it in **Settings → Signed-in devices**, or sign everyone out
107
+ with `litepaseo signout-all`. Also revoke its Access session under
108
+ **My Team → Users** in Cloudflare One.
109
+ - Access token exposed: `litepaseo token rotate` (or `litepaseo token set` to choose one).
110
+ The old token stops working at once and every browser is signed out.
111
+ - Lost authenticator: `litepaseo totp-reset` on the server, then enrol again.
@@ -1,244 +1,122 @@
1
- # Reproducible CPU and energy validation
2
-
3
- Status: local LitePaseo baseline measured on 2026-11-11. The official-client comparison
4
- and energy protocol below remain unexecuted; no energy savings are claimed.
5
-
6
- ## Local baseline, 2026-11-11
7
-
8
- Application commit: `363906948f047272bb41fe1c56baea7e60c54a06`. Hardware: the test laptop,
9
- Core Ultra 7 256V, 8 logical CPUs, 15.2 GiB RAM, AC connected, powersave governor.
10
- Linux `7.2.13-200.fc44.x86_64`, Node `26.12.1`, headless Chromium `158.0.8127.18`.
11
- The host was shared with other processes; thermal state and power policy were not
12
- controlled. RAPL counters were unreadable. No real provider calls were made.
13
-
14
- The built frontend used real HTTP/SSE and the application's BFF source, with two
15
- in-process SDK facade doubles. BFF measurements include fixture generation and
16
- logging; they exclude real daemon/provider costs. Each streaming host generated
17
- a target 20 deltas/s (actual counts are recorded). Each browser context viewed one host. See the [harness methodology and
18
- reproduction instructions](../benchmarks/README.md) for workload sizes and limitations.
19
-
20
- The [primary run](../benchmarks/runs/2026-11-11T20-31-13.817Z/manifest.json) includes
21
- environment, exact harness snapshots/hashes, event logs, counter samples and final
22
- visible-message hash checks. [Summary and ranges](../benchmarks/runs/2026-11-11T20-31-13.817Z/summary.json)
23
- and [per-repetition CSV](../benchmarks/runs/2026-11-11T20-31-13.817Z/counters.csv)
24
- are generated by `benchmarks/analyze.mjs`.
25
-
26
- CPU is percentage of **one logical core**, so 200% means two cores. Table values
27
- are medians across three repetitions, except the 60-second idle case. Memory is
28
- the median of sampled per-repetition peaks, not a continuous high-water mark.
29
- Latency is the newest event marker to a post-mutation animation-frame callback,
30
- sampled at most once per second/client; it is neither physical paint latency nor
31
- the latency of every event. The p95 column is the median of per-repetition p95s.
32
-
33
- | Workload | Browser CPU | BFF + fixture CPU | Browser peak PSS | Sampled p95 |
1
+ # LitePaseo vs. official Paseo web UI
2
+
3
+ LitePaseo is built for an agent dashboard that stays open for hours: less CPU spent
4
+ on status animation and streaming, less memory occupied by the browser, and smaller
5
+ downloads. The goal is a lightweight console designed with battery life in mind.
6
+
7
+ In the local comparison below, LitePaseo used **91–95% less browser CPU**, **55–73%
8
+ less browser memory**, and downloaded **92% less compressed JavaScript/CSS** than
9
+ the official Paseo web UI. These are measured resource savings; battery runtime
10
+ and energy consumption were not measured.
11
+
12
+ ## CPU and memory
13
+
14
+ Measured on **2026-11-12**, using LitePaseo commit
15
+ [`15d873c`](https://github.com/txchen/litepaseo/commit/15d873cabe526e50d153fe0d4baa26312614e1e5)
16
+ with **1 fps decorative animation** and **500 ms message batching**, against the
17
+ published **Paseo 0.15.4 production web UI**. Both ran in the same headless Chromium
18
+ on the same Linux laptop, with normal motion enabled.
19
+
20
+ Values are medians of **five runs per UI per scenario**. CPU ranges are min–max.
21
+ **100% CPU means one logical core**, not the whole machine. Memory is browser
22
+ process-tree PSS: shared memory is apportioned, and each run contributes its largest
23
+ two-second sample during measurement.
24
+
25
+ | Scenario | LitePaseo CPU | Paseo web CPU | LitePaseo memory | Paseo web memory |
34
26
  |---|---:|---:|---:|---:|
35
- | Connected, no new events, running badges | 17.1% | 0.1% | 287 MiB | — |
36
- | Plain streaming, one client | 34.7% | 1.4% | 299 MiB | 68 ms |
37
- | Unfinished 12,000-line code fence, one client | 111.6% | 0.9% | 641 MiB | 177 ms |
38
- | Plain streaming, eight contexts, 10,000 sessions | 267.6% | 2.2% | 1,592 MiB | 69 ms |
39
- | 20 older pages loaded, then streaming | 40.2% | 1.3% | 431 MiB | 66 ms |
40
- | 10,000 sessions, 50 directory updates/s | 24.0% | 0.9% | 297 MiB | — |
41
-
42
- Navigation to the complete session count plus initial 60 messages took median
43
- 259 / 334 / 660 ms for 100 / 1,000 / 10,000 sessions. This excludes process launch,
44
- login and BFF startup. The sidebar retained at most 22 rendered session rows in
45
- these scenarios. Eight clients shared two upstream timeline subscriptions.
46
-
47
- The large-code case produced 431–434 main-thread long tasks in each ~31.2-second
48
- measurement window (30 seconds of generation plus drain), totaling 27.1 seconds.
49
- Ordinary plain-text streaming produced no observed long tasks in its three runs.
50
- The source reparses the entire growing assistant message and replaces its HTML on
51
- each render (`TimelineRowView.vue` / `markdown.ts`); this is a likely source of the
52
- large-message cost, although a parser/layout CPU profile has not isolated each part.
53
-
54
- Loading older history left **2,066 message rows** rendered by the end of each run.
55
- `App.vue` increases `shown` on pagination; the initial 150-row render window is not
56
- a fixed virtual window. `TimelineStore.prepend` also has no independent retention
57
- cap. A bounded history viewport that preserves scroll position is an optimization
58
- candidate; the benchmark does not claim every pagination edge case is tested.
59
-
60
- The hidden-signal case validates application unsubscribe/catch-up by overriding
61
- `document.hidden`; it does not measure real browser background throttling. Directory
62
- contents under churn, tool/approval rendering, input responsiveness, remote network
63
- latency, macOS/mobile, official Paseo, and energy remain outside this baseline.
64
-
65
- ### Ten-minute streaming
66
-
67
- All **27 primary cases passed** their final visible-message equality, page-error and
68
- directory-stream cleanup checks. The ten-minute case used two clients and started a
69
- new message every three deltas, crossing the designed browser retention threshold.
70
- It generated 23,700 deltas in total and averaged 66.6% browser CPU and 1.3% BFF +
71
- fixture CPU, with sampled p95 68 ms.
72
- Each page retained at most **150 rendered message rows**. Internal browser-store row
73
- counts were not directly instrumented.
74
-
75
- | Minute | Browser median PSS | Combined browser JS heap | BFF + fixture median RSS |
27
+ | Running agent waiting, no new output | **1.5%** (1.2–1.7) | 17.8% (17.3–18.4) | **226 MiB** | 499 MiB |
28
+ | Continuous text, one growing paragraph | **10.1%** (9.4–10.5) | 114.7% (111.9–116.5) | **297 MiB** | 763 MiB |
29
+ | Growing code block, 200 → 800 lines | **6.4%** (5.7–6.6) | 140.7% (136.2–141.3) | **283 MiB** | 1,052 MiB |
30
+
31
+ Both streaming cases append exactly **600 chunks at 20 chunks/s over 30 seconds**,
32
+ including Chinese text. The waiting case keeps the agent running and its status
33
+ indicators active; it does not represent a dashboard with every task finished.
34
+ The code case is a rendering stress test. LitePaseo displays plain code blocks;
35
+ Paseo uses syntax highlighting. Both display the same complete source text, with
36
+ new output kept in view, but they do different amounts of presentation work.
37
+
38
+ The table measures the browser. LitePaseo's separate BFF added median **0.03% / 0.64%
39
+ / 0.68%** of one core for waiting / text / code. The real daemon's CPU is also
40
+ recorded separately. This comparison does not include actual model execution.
41
+
42
+ Sources: [waiting and text results](../benchmarks/runs/2026-11-12T17-33-56.747Z-comparison/summary.md),
43
+ [code results](../benchmarks/runs/2026-11-12T17-52-40.273Z-comparison/summary.md).
44
+ Headline reductions use the unrounded medians; per-pair reductions and full ranges
45
+ are available in the corresponding `summary.json` files.
46
+
47
+ ## Smaller downloads
48
+
49
+ The browser fetched these JavaScript and CSS resources while opening a conversation.
50
+ **LitePaseo's deferred Markstream renderer is included**, so this is not just a
51
+ comparison of its small initial entry script against Paseo's complete application.
52
+
53
+ | Loaded JS + CSS | LitePaseo | Paseo web | Reduction |
76
54
  |---|---:|---:|---:|
77
- | 2 | 444.3 MiB | 12.1 MiB | 155.8 MiB |
78
- | 5 | 450.3 MiB | 13.6 MiB | 155.5 MiB |
79
- | 8 | 457.1 MiB | 14.7 MiB | 160.1 MiB |
80
- | 10 | 460.0 MiB | 14.7 MiB | 162.9 MiB |
81
-
82
- Browser PSS rose about 15.6 MiB from minute 2 to minute 10; the combined JS heap
83
- leveled near 14.7 MiB in the last three minutes. This is bounded DOM behavior and
84
- modest observed growth, **not proof of no memory leak**. The fixture deliberately
85
- retains all generated rows, so server growth cannot be attributed solely to the BFF.
86
- See [minute windows](../benchmarks/runs/2026-11-11T20-31-13.817Z/soak-memory.json)
87
- (raw per-repetition samples are regenerated by the harness and not kept in Git).
88
-
89
- ### Measurement corrections
90
-
91
- A preliminary run was excluded from the reported results. Its process traversal
92
- read only the main thread's Linux `children` file, missing Chromium's network
93
- service; CPU/memory totals were therefore incomplete. The corrected sampler visits
94
- every thread, and an independent [PPid-based audit](../benchmarks/runs/2026-11-11T20-31-13.817Z/process-tree-audit.json)
95
- found no missing browser subprocesses. The preliminary large-Markdown case also
96
- overran its intended duration because stopping waited for a delayed browser probe.
97
- The corrected harness stops generation independently of probes. All reported short
98
- scenarios were rerun after both fixes; no application performance change was made.
99
-
100
- The excluded preliminary run, including its interrupted soak samples, is not kept in Git.
101
- It is not included in the reported medians. The
102
- [frontend build audit](../benchmarks/runs/2026-11-11T20-31-13.817Z/frontend-build-audit.json)
103
- records the served files' hashes and their comparison with a fresh production build.
104
-
105
- ### Animation diagnostic and optimization priorities
106
-
107
- Three alternating-order pairs used the same 1,000-session fixture with running
108
- badges, no new events and 20-second measurement periods. Enabling the existing
109
- `prefers-reduced-motion: reduce` CSS changed browser CPU from median **16.8%**
110
- (16.6–17.0%) to **0.2%** (0.1–0.3%). All six cases passed. This strongly implicates
111
- the continuously animated status indicators in the observed idle CPU cost; the
112
- experiment changes a browser media preference, not application source.
113
- See [paired run results](../benchmarks/runs/2026-11-11T20-53-47.379Z-motion/summary.json).
114
-
115
- Recommended implementation order:
116
-
117
- 1. Remove or redesign the continuously animated `box-shadow` status pulse. The
118
- existing reduced-motion setting already provides an immediate workaround.
119
- 2. Avoid reparsing and replacing the full growing Markdown message on every flush;
120
- investigate incremental code-block updates and batching, then rerun latency and
121
- long-task measurements to ensure the tradeoff is acceptable.
122
- 3. Keep history pagination in a bounded viewport with a preserved scroll anchor.
123
- Loading older history currently expands the rendered message count.
124
-
125
- These were optimization candidates at the baseline commit. The follow-up below
126
- records the subsequent implementation and calibration.
127
-
128
- ## Follow-up: low-frequency motion and bounded history
129
-
130
- Final requested configuration: **persistent decorative animation at 2 updates/s,
131
- timeline message batches every 500 ms**. Input and clicks are not rate limited.
132
- The implementation is recorded in application commit `61104ca`.
133
-
134
- The animation experiments used three repetitions per setting, 20 seconds each,
135
- with a connected 1,000-session directory and no incoming messages. CPU remains
136
- percentage of one logical core. They showed why CSS `steps()` alone was insufficient:
137
-
138
- | Animation implementation | Frequency | Median browser CPU |
55
+ | Compressed HTTP response bodies | **290 KiB** | 3,764 KiB | 92% |
56
+ | Decoded source | **1.08 MiB** | 22.85 MiB | 95% |
57
+
58
+ These are actual resource response sizes from fresh browser profiles, excluding
59
+ HTML, fonts, images, headers and conversation traffic. They describe the tested
60
+ conversation route, not every optional feature or the npm installation size.
61
+ [Resource entries and raw counters](../benchmarks/runs/2026-11-12T17-33-56.747Z-comparison/raw-counters.json)
62
+ include the fetched file names and byte counts.
63
+
64
+ ## The tradeoff: fewer updates, lower CPU
65
+
66
+ LitePaseo deliberately avoids rendering every incoming chunk. Its
67
+ [status animation clock](../src/web/motion-clock.ts) advances once per second;
68
+ [message updates](../src/server/timeline-view.ts) are batched every 500 ms.
69
+ The 1 fps setting applies to persistent decorative animation, not to the entire
70
+ page or to keyboard input. Its [Markdown configuration](../src/web/MarkdownMessage.vue)
71
+ also disables typewriter effects and uses simplified code blocks.
72
+
73
+ Batching adds visible waiting time. The benchmark records **every chunk's** time
74
+ from provider emission until its text appears in the DOM, including the daemon,
75
+ transport and batching. The following values are medians of each run's p95:
76
+
77
+ | Output | LitePaseo p95 | Paseo web p95 |
139
78
  |---|---:|---:|
140
- | Original continuously playing CSS | default display cadence | 16.8% |
141
- | Continuously playing CSS with `steps()` | 5/s | 5.6% |
142
- | Continuously playing CSS with `steps()` | 2/s | 4.3% |
143
- | Continuously playing CSS with `steps()` | 1/s | 4.0% |
144
- | Paused CSS advanced by an explicit clock | 5/s | 3.2% |
145
- | Paused CSS advanced by an explicit clock | 2/s | 1.4% |
146
- | Paused CSS advanced by an explicit clock | 1/s | 0.9% |
147
- | Reduced motion (no persistent animation) | 0/s | about 0.2% |
148
-
149
- Sources: [CSS 5/s](../benchmarks/runs/2026-11-11T21-07-04.552Z-motion/summary.json),
150
- [CSS 2/s and 1/s](../benchmarks/runs/2026-11-11T21-10-18.690Z/summary.json),
151
- [clock 5/s](../benchmarks/runs/2026-11-11T21-15-33.485Z-motion/summary.json),
152
- [clock 2/s and 1/s](../benchmarks/runs/2026-11-11T21-19-55.565Z/summary.json).
153
- The final frequency was chosen to favour battery life, keeping message and decorative-motion
154
- cadences separate. No claim about measured display FPS or energy follows from these
155
- CPU counters. The clock tests directly inspect animation-time changes and verify
156
- that those changes stop when the application receives a hidden visibility signal.
157
-
158
- `motion-clock.ts` keeps persistent CSS animations paused and advances their time
159
- with a low-frequency timer. The timer stops while hidden, under reduced motion,
160
- or when no persistent animation is present. Short entrance transitions are separate
161
- from this persistent-animation clock. These experiments do not isolate the browser
162
- internals responsible for the residual cost of continuously playing stepped CSS.
163
-
164
- History no longer grows `shown` or prepends pages to the live cache. It uses a
165
- separate **150-message snapshot**, with overlapping pages to preserve the scroll
166
- anchor. Only sequence-number bookmarks are retained for forward navigation; older
167
- page bodies are discarded. Backward and forward navigation use stable `seqStart`
168
- boundaries, so a late update to an old tool row's `seqEnd` does not select a different
169
- page. Streaming continues in the bounded live cache while the history view stays
170
- fixed; “Back to latest” resumes that view. Epoch or session changes discard history.
171
-
172
- The current renderer remains the built-in whole-message Markdown renderer, not
173
- Markstream. Vue row-level refs isolate unrelated messages, but do not make parsing
174
- or HTML replacement incremental inside one large message. Batching reduces how
175
- often that work happens. A 500 ms batching interval can add up to roughly 500 ms
176
- before dispatch, plus rendering time; the sampled newest-marker p95 is not the
177
- latency of the oldest event in each batch.
178
-
179
- Calibration provenance: CSS-step runs used the frontend
180
- before the motion-clock implementation (its build archive is not kept in Git). The clock 2/s–1/s sweep used `4fee44a` plus
181
- its recorded `application.patch`. A 1/s-motion, 200 ms-streaming comparison was
182
- interrupted when the final 2/s, 500 ms policy was selected; its partial samples
183
- are not kept in Git and are not final-configuration results.
184
-
185
- ### Final configuration results
186
-
187
- All **12 final-configuration repetitions passed** (three each for idle motion,
188
- plain streaming, large Markdown and history navigation). `npm run check` also
189
- passed type checking, production build, 64 tests and browser acceptance.
190
-
191
- | Workload | Original browser CPU | Final browser CPU | Final sampled peak PSS |
192
- |---|---:|---:|---:|
193
- | No new events, running badges | 16.8% | 1.4% | 234 MiB |
194
- | Plain streaming | 34.7% | 4.9% | 245 MiB |
195
- | 12,000-line growing code block | 111.6% | 28.1% | 374 MiB |
196
-
197
- Final data: [motion](../benchmarks/runs/2026-11-11T21-30-45.434Z-motion/summary.json),
198
- [streaming and history](../benchmarks/runs/2026-11-11T21-32-04.839Z/summary.json),
199
- [counter CSV](../benchmarks/runs/2026-11-11T21-32-04.839Z/counters.csv).
200
- These are same-fixture local measurements collected sequentially, not a randomized
201
- cross-version A/B trial. Host and measurement limitations from the baseline still apply.
202
-
203
- The code-block case still produced **60 long tasks per repetition**, totaling
204
- 6.1–6.3 seconds over each ~31-second window, versus 431–434 tasks totaling about
205
- 27.1 seconds in the original runs. Lower average CPU does not mean incremental
206
- Markdown rendering or the complete absence of input stalls. Plain streaming had
207
- no observed long tasks in its three repetitions.
208
-
209
- History mounted at most **150 message rows** in all three runs, including after
210
- 20 backward pages and while new output continued. The checks cover backward/forward
211
- round trips, retained-row scroll positions (within 3 px), historical-content equality,
212
- and return to the latest output. It used about 2.2% browser CPU, but that is **not a
213
- like-for-like CPU comparison** with the old 2,066-row live-updating history view:
214
- the new historical snapshot deliberately stays fixed until the reader navigates.
215
-
216
- The final sampled newest-marker p95s were 58 ms for plain text and 176 ms for the
217
- code block. Those figures omit the waiting time of older deltas coalesced into the
218
- same batch; they must not be described as end-to-end latency for every message.
219
- Navigation to the initial timeline now took roughly 0.78 seconds in these runs,
220
- versus about 0.34 seconds in the old 1,000-session runs, because initial timeline
221
- reset delivery also uses the 500 ms flush cadence. The chosen cadence trades
222
- update latency for reduced CPU. No energy or real-daemon performance claim is made.
223
-
224
- ## Planned comparisons
225
-
226
- Compare production builds of official Paseo web and LitePaseo on the same browser/device, plus official native separately if available. Record exact commits, browser/OS/Node versions, build flags, enabled plugins, daemon/provider versions, BFF placement, hardware, power mode, display brightness, refresh rate and thermal state. Run plugins off first, then a separately reported matched plugin scenario. Never compare different amounts of rendered content silently.
227
-
228
- Use two layers. A deterministic fixture harness replays the same timestamped semantic timeline into each client's normal ingestion path (version-pinned adapters, no real model calls). Capture/sanitize one fixture and publish its hash, event count, bytes, durations and adaptation code. Validate equal final text, tool rows and approvals. This measures rendering/ingestion, not transport parity. A second two-daemon end-to-end run verifies transport and recovery with deterministic provider output where supported. If a mock provider cannot be installed without modifying official code, disclose that limitation and keep real-model runs exploratory because outputs vary.
229
-
230
- Scenarios: 10-minute connected idle; 5-minute plain-text stream; 5-minute growing code/Markdown stream; large completed history plus new output; simultaneous output from two hosts; hidden tab for 5 minutes then foreground; one-host disconnect/reconnect; approval during streaming. Fix event cadence, text size, history size and exact scripted visibility/scroll/input actions in the fixture manifest. Include a long unfinished code fence and non-ASCII input.
231
-
232
- ## Procedure
233
-
234
- 1. Create a clean browser profile with extensions disabled. Fix screen/network/power conditions and background workloads. Place daemons off the measured laptop for the primary browser experiment.
235
- 2. Warm each production build for two minutes. Randomize A/B order in paired runs; run at least five pairs per scenario. Cool between runs to comparable temperature. Do not profile with DevTools open in the primary energy run.
236
- 3. Collect cumulative process CPU seconds before/after for the entire browser process tree, BFF and daemon separately. Report CPU seconds per wall second (one full core = 1), RSS/peak memory, network bytes, flush/parse/render counts, event-loop delay and browser long tasks. Account for shared browser processes consistently, preferably with only the test profile running.
237
- 4. Linux: use `pidstat`/process accounting for CPU, `perf stat` where available for context switches; use supported RAPL counters or an external power meter for joules. RAPL measures package domains, not process energy or whole-device energy. macOS: use supported Instruments/powermetrics workflows, separating Energy Impact scores from joules. Record tool versions, sampling interval, permissions and unsupported counters. Context switches are not interchangeable with hardware wakeups.
238
- 5. Measure idle baseline with the same instrumentation. Report raw and baseline-adjusted energy, measurement domain and elapsed time. For battery drain, use longer fixed-duration repeated trials with fixed initial charge bands; short percentage drops are too coarse. Use an external whole-device meter when practical, accounting for charging behavior.
239
- 6. Use the intended server-hosted BFF for the primary comparison; optionally run locally as a diagnostic. Report laptop energy and remote BFF CPU/energy separately; only sum comparable measured domains without double counting. Unknown daemon/remote energy stays unknown.
240
- 7. Record receipt-to-visible latency distribution, approval latency, final-state correctness, missing/duplicate rows and recovery time. A lower CPU value with lost events is a failed run.
241
-
242
- Store `benchmarks/<run-id>/manifest.json`, fixture hashes, raw counter CSV, correctness results and analysis script. Suggested CSV fields: variant, repetition, scenario, wall_seconds, browser_cpu_seconds, bff_cpu_seconds, daemon_cpu_seconds, peak_rss_bytes, energy_joules, energy_domain, visible_latency_p50_ms, visible_latency_p95_ms, final_state_equal. Use null for unavailable measurements, never zero.
243
-
244
- Report paired differences, medians, spread and confidence intervals with all failures disclosed. Tune batching at 250/750/1500 ms, holding all else constant. Compare Markstream with plain text and a baseline renderer, separately toggling highlighting/diagrams and history windowing to identify costs. Set an acceptance threshold only after establishing baseline variance and a user-acceptable latency budget. Source observations and renderer marketing are not measured performance evidence.
79
+ | Plain text | 567 ms | **142 ms** |
80
+ | Code | 575 ms | **281 ms** |
81
+
82
+ Paseo showed incoming text sooner in these tests. LitePaseo used substantially less
83
+ CPU while updating about twice per second. These timings are DOM observations,
84
+ not physical screen-paint or keyboard-response measurements. Lower average CPU
85
+ also does not guarantee an absence of occasional long tasks; those are recorded
86
+ in the raw data.
87
+
88
+ ## What the comparison establishes
89
+
90
+ The result supports LitePaseo's lightweight, battery-conscious design: the tested
91
+ browser has less CPU work to do, a smaller memory footprint, and fewer frontend
92
+ bytes to download. **A 91% CPU reduction does not mean 91% less battery drain.**
93
+ Energy counters were unreadable on this machine, so watts, joules and additional
94
+ hours of battery life remain unmeasured.
95
+
96
+ The test machine was a Core Ultra 7 256V laptop with 8 logical CPUs and 15.2 GiB RAM,
97
+ on AC power with the `powersave` governor, Linux `7.2.13-200.fc44.x86_64`, Node
98
+ `26.12.1` and headless Chromium `158.0.8127.18`, at 1280 × 900. Headless software
99
+ rendering is not a substitute for a GPU-accelerated desktop or phone battery test.
100
+ The host was shared and temperature was not controlled; these short runs do not
101
+ establish long-term memory behavior or performance for every workload.
102
+
103
+ Each run used a fresh isolated **real Paseo daemon**, its deterministic mock-provider
104
+ extension point, and a fresh browser profile. The official UI used WebSocket;
105
+ LitePaseo used its normal SDK-backed BFF and HTTP/SSE. Both frontends were production
106
+ builds, plugins were off, and there was one workspace and one agent. After a
107
+ 10-second warmup, each measurement covered 30 seconds plus at least one second
108
+ of drain, waiting for final output before taking final counters. Paired A/B order
109
+ alternated. Servers ran locally and their counters were separated from the browser.
110
+
111
+ All **30 reported runs** passed complete rendered-text equality after Markdown
112
+ fence/whitespace normalization, ordered-marker checks and page-error checks.
113
+ An earlier 1,000-line code fixture grew beyond Paseo's
114
+ [32,000-character rendering cap](https://github.com/getpaseo/paseo/blob/v0.15.4/packages/app/src/components/assistant-message-render-limit.web.ts).
115
+ That incomplete pair was excluded, then replaced by five pairs using the smaller
116
+ code fixture above. The [excluded case and exact capped-prefix verification](../benchmarks/runs/2026-11-12T17-33-56.747Z-comparison/excluded-code-case.json)
117
+ are retained; no performance saving is calculated from missing output.
118
+
119
+ See [benchmark methodology and reproduction commands](../benchmarks/README.md)
120
+ for the runner, per-repetition CSVs, raw samples, per-chunk timings, source and
121
+ production-build hashes. The earlier LitePaseo-only tuning experiments are kept
122
+ in the [historical optimization log](../benchmarks/legacy-baseline.md).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "litepaseo",
3
- "version": "0.2.0",
3
+ "version": "0.3.1",
4
4
  "description": "A resource-conscious web console for your Paseo agents",
5
5
  "bin": {
6
6
  "litepaseo": "dist/server/cli.mjs"
@@ -8,7 +8,8 @@
8
8
  "files": [
9
9
  "dist",
10
10
  "README.md",
11
- "docs/operations.md",
11
+ "CHANGELOG.md",
12
+ "docs/cloudflare-access.md",
12
13
  "docs/markstream-integration-validation.md",
13
14
  "docs/performance-plan.md"
14
15
  ],
@@ -32,6 +33,7 @@
32
33
  "markstream-vue": "2.0.25",
33
34
  "qrcode": "1.5.4",
34
35
  "web-push": "3.6.7",
36
+ "ws": "8.22.2",
35
37
  "zod": "4.6.7"
36
38
  },
37
39
  "devDependencies": {
@@ -39,6 +41,7 @@
39
41
  "@types/node": "^24.0.0",
40
42
  "@types/qrcode": "1.5.5",
41
43
  "@types/web-push": "3.6.4",
44
+ "@types/ws": "^8.18.2",
42
45
  "@vitejs/plugin-vue": "6.0.10",
43
46
  "@xterm/addon-fit": "0.11.0",
44
47
  "@xterm/xterm": "6.0.0",