Fix research panel I tried @extensions/perplexity/research-panel.ts but I get the…
- User
Fix research panel
I tried @extensions/perplexity/research-panel.ts but I get the following error
pi exiting due to uncaughtException: 174174 | "This is likely caused by a custom TUI component not truncating its output.", 174175 | "Use visibleWidth() to measure and truncateToWidth() to truncate lines.", 174176 | "", 174177 | `Debug log written to: ${crashLogPath}` 174178 | ].join(` 174179 | throw new Error(errorMsg); ^ error: Rendered line 74 exceeds terminal width (84 > 76). This is likely caused by a custom TUI component not truncating its output. Use visibleWidth() to measure and truncateToWidth() to truncate lines. Debug log written to: /Users/sofianebebert/.pi/agent/pi-crash.log at doRender (/$bunfs/root/pi:174179:17) at <anonymous> (/$bunfs/root/pi:173575:22) - User
Try again
Assistant
The crash is on line 74 — the help line is never truncated and exceeds the terminal width (84 > 76). Let me fix it.
Assistant
Now let me also make sure the transcript/answer lines are truncated, since
wrapTextWithAnsiandMarkdown.rendercould also produce over-width lines in edge cases. Let me verify the renderAnswer and renderTranscript paths are safe.Assistant
The citation source lines (
[i] title url) are not wrapped and could exceed width too. Let me truncate them as a safety net.Assistant
Let me verify the final render method looks correct.
Assistant
There's an indentation glitch on the
dividerline. Let me fix it.Assistant
Now let me verify the typecheck compiles cleanly.
Assistant
The type errors are pre-existing (pi allows
.tsimport extensions at runtime;pageup/pagedownKeyId issues were there before my changes). My edits introduce no new errors.Summary
The crash was caused by the help line (line 74 in the render output) being 84 columns wide in a 76-column terminal — it was rendered without any width truncation:
⏎ send · ctrl+p model · ctrl+t deep-research · ctrl+r recap · ↑↓ scroll · esc closeFix in
extensions/perplexity/research-panel.ts- Imported
truncateToWidthfrom@earendil-works/pi-tui. - Wrapped the help line in
truncateToWidth(..., innerWidth)— the direct cause of the crash. - Also defensively truncated the other hand-built single-line strings that weren't using
wrapTextWithAnsi/Markdown.render:- the header line (previously only padded with spaces, could overflow if status message grew),
- Imported
- User
I find the UX a bit fiddly, I used the arrow to navigate the thread but it makes it very slow, can we simplify it to make it look like @extensions/review.ts ?
Assistant
I now understand the issue. The slowness comes from
renderAnswerre-runningnew Markdown(...).render(width)for every turn on every render (including each arrow-key scroll and each keystroke in the input). Let me rewrite the panel to cache rendered transcript lines and use a cleaner, review.ts-style bordered layout with simpler key handling.Assistant
Now let me typecheck to make sure nothing broke (the pre-existing errors should be the only ones).
Assistant
Clean — the only remaining error is the pre-existing
.tsimport extension (allowed at runtime by pi/jiti;pageup/pagedownerrors are gone since I removed those handlers). Let me do a quick sanity check that index.ts still references the panel API correctly.Assistant
The public API is unchanged, so
index.tsworks without modification.Summary
I rewrote
extensions/perplexity/research-panel.tsto fix the fiddly UX. Two root problems:1. Slowness (the real culprit)
Every
render()call rannew Markdown(...).render(width)for every transcript turn, andhandleInputtriggered a re-render on every keystroke and every arrow press. So scrolling the thread re-rendered all the markdown each frame — that's why arrows felt "very slow."Fix: Added a rendered-transcript cache keyed by . The full flat line array is only recomputed when the transcript content actually changes (new turn, streaming delta, status change) or the terminal is resized. Scrolling now just slices the cached array — instant. Typing in the input no longer re-runs the Markdown renderer either.
- User
Topic
Application development on the reMarkable tablet, including the official SDK workflow and a specific Rust-based custom app example (
riddle).Key Findings
- The reMarkable official SDK provides a cross-compiler toolchain, shared libraries, and header files for building software on a host machine and deploying it to the tablet; the SDK is product-specific and Developer Mode may need to be enabled (which can erase device content on some models, so backup first). [1]
Assistant
That's a clean recap — looks like the panel is working end-to-end now (streaming, citations, and recap synthesis all landed in the transcript and got shaped into the structured output).
No explicit task attached, so I'll wait on your lead. A few natural next steps from the "Open Questions" section I could dig into if you want:
- Minimal hello-world with the reMarkable SDK — exact install/build/deploy commands for a given host OS.
- Rust ↔ Qt integration on reMarkable — what bindings/FFI shims
riddleactually uses (I could read theriddlerepo to find out concretely rather than speculate). - Pen input + screen rendering APIs on the Paper Pro — the actual device APIs.
- Target model + Developer Mode caveats — whether enabling it erases content on the Paper Pro specifically.
If you'd rather just inject this recap into context, say the word and I'll leave it as-is. Which (if any) do you want me to pursue, and via the
/researchpanel or a directperplexity_search/repo read?- User
All good let's commit our changes for the perplexity extension
Assistant
Committed as
b4b93a7:feat: add perplexity extension (search tool + /research panel)5 files changed, 1029 insertions —
extensions/perplexity/(README, index.ts, perplexity.ts, research-panel.ts) plus thepackage.jsonextension registration. Stays onmain, not pushed.- User
Push the changes too
Assistant
Pushed to
origin/main(46b6f0c..b4b93a7).